File size: 1,351 Bytes
5704551
 
 
 
 
 
bb89ebf
3c14aef
bb89ebf
3c14aef
5704551
bb89ebf
5704551
 
 
 
 
 
3c14aef
 
 
bb89ebf
 
3c14aef
 
5704551
bb89ebf
3c14aef
 
5704551
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function(a){
    if(!window.my_observe_outpaint)
    {
        console.log("setup outpaint here");
        window.my_observe_outpaint = new MutationObserver(function (event) {
            console.log(event);
            let app=document.querySelector("gradio-app");
            let frame=app.querySelector("#sdinfframe").contentWindow;
            var str=document.querySelector("gradio-app").querySelector("#output textarea").value;
            frame.postMessage(["outpaint", str], "*");
        });
        window.my_observe_outpaint_target=document.querySelector("gradio-app").querySelector("#output span")
        window.my_observe_outpaint.observe(window.my_observe_outpaint_target, {
            attributes: false, 
            subtree: true,
            childList: true, 
            characterData: true
        });
        window.addEventListener("message", function(e){
            if(e.data[0]=="transfer")
            {
                document.querySelector("gradio-app").querySelector("#input textarea").value=e.data[1];
                document.querySelector("gradio-app").querySelector("#proceed").click();
            }
        });
    }
    let app=document.querySelector("gradio-app");
    let frame=app.querySelector("#sdinfframe").contentWindow;
    frame.postMessage(["transfer"],"*")
    return a;
}