mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-04-21 07:41:56 +00:00
Inject JS before content loaded
This commit is contained in:
parent
693d545923
commit
2b5f1f727b
1 changed files with 2 additions and 2 deletions
|
|
@ -124,7 +124,7 @@ impl PartialUi for WebView {
|
||||||
Ok(())
|
Ok(())
|
||||||
}).expect("Cannot add full screen element changed");
|
}).expect("Cannot add full screen element changed");
|
||||||
|
|
||||||
webview.add_navigation_completed(move |wv, _| {
|
webview.add_content_loading(move |wv, _| {
|
||||||
wv.execute_script(r##"
|
wv.execute_script(r##"
|
||||||
try{console.log('Shell JS injected');if(window.self === window.top) {
|
try{console.log('Shell JS injected');if(window.self === window.top) {
|
||||||
window.qt={webChannelTransport:{send:window.chrome.webview.postMessage}};
|
window.qt={webChannelTransport:{send:window.chrome.webview.postMessage}};
|
||||||
|
|
@ -133,7 +133,7 @@ impl PartialUi for WebView {
|
||||||
}}catch(e){}
|
}}catch(e){}
|
||||||
"##, |_| Ok(())).expect("Cannot add script to webview");
|
"##, |_| Ok(())).expect("Cannot add script to webview");
|
||||||
Ok(())
|
Ok(())
|
||||||
}).expect("Cannot add navigation completed");
|
}).expect("Cannot add content loading");
|
||||||
|
|
||||||
WebView::resize_to_window_bounds(Some(&controller), Some(hwnd));
|
WebView::resize_to_window_bounds(Some(&controller), Some(hwnd));
|
||||||
controller.put_is_visible(true).ok();
|
controller.put_is_visible(true).ok();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue