File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,25 @@ function popout() {
4747 win . focus ( ) ;
4848 } catch ( err ) { } ;
4949}
50+ function pageLoaded ( ) {
51+ let currentTab = getCurrentTab ( ) ;
52+ let iframe = document . querySelector ( `[data-iframe-id="${ currentTab } "]` ) ;
53+ iframe . addEventListener ( 'load' , function ( ) {
54+ let val = iframe . contentWindow . location . href ;
55+ let currentProx = localStorage . getItem ( 'proxy' ) ;
56+ //remove the https:// or http:// and the prefix
57+ val = val . replace ( window . location . origin , '' ) ;
58+ if ( currentProx === 'uv' ) {
59+ val = val . replace ( __uv$config . prefix , '' ) ;
60+ val = __uv$config . decodeUrl ( val ) ;
61+ }
62+ if ( currentProx === 'dynamic' ) {
63+ val = val . replace ( __dynam$ic . prefix + 'route/?url=' , '' ) ;
64+ val = __dynam$ic . decodeUrl ( val ) ;
65+ }
66+ updateSearch ( val ) ;
67+ } ) ;
68+ }
5069function fullscreen ( ) {
5170 //this has two options, fullscreen the page, and fullscreen the tab to the window (add later)
5271 let currentTab = getCurrentTab ( ) ;
@@ -90,3 +109,7 @@ function searchBar(value) {
90109 i . value = value ;
91110 f . dispatchEvent ( new Event ( 'submit' ) ) ;
92111}
112+ function updateSearch ( value ) {
113+ const s = document . getElementById ( 'search-input' ) ;
114+ s . value = value ;
115+ }
Original file line number Diff line number Diff line change 1919form . addEventListener ( "submit" , ( event ) => {
2020 event . preventDefault ( ) ;
2121 const url = search ( address . value , localStorage . getItem ( "searchEngine" ) ) ;
22+ updateSearch ( url ) ;
2223 address . value = "" ;
2324 switch ( localStorage . getItem ( "proxy" ) ) {
2425 case "uv" :
Original file line number Diff line number Diff line change @@ -79,6 +79,17 @@ function handoffToTABS(url) {
7979 let tabId = chromeTabs . activeTabEl . getAttribute ( 'data-tab-id' ) ;
8080 iframe . setAttribute ( 'data-iframe-id' , tabId ) ;
8181 document . body . appendChild ( iframe ) ;
82+ pageLoaded ( ) ;
83+ }
84+ function changeTabDetail ( title , favicon ) {
85+ let tabId = chromeTabs . activeTabEl
86+ //get the div chrome-tab-content
87+ let tabContent = tabId . querySelector ( '.chrome-tab-content' ) ;
88+ let tabTitle = tabContent . querySelector ( '.chrome-tab-title' ) ;
89+ let tabFavicon = tabContent . querySelector ( '.chrome-tab-favicon' ) ;
90+ tabTitle . innerHTML = title ;
91+ //the tab favicon is set with a background image
92+ tabFavicon . style . backgroundImage = `url(${ favicon } )` ;
8293}
8394
8495function restoreTabs ( ) {
You can’t perform that action at this time.
0 commit comments