1+ const  browserAppData  =  chrome  ||  browser ; 
2+ 
3+ import  './back_zeuz.js' ; 
4+ // import '../common_files/poly_fill.js'; 
15
26/* Zeuz function start */ 
37var  master  =  { } ; 
48var  clickEnabled  =  true ; 
59
610/* Open panel */ 
711
12+ // import {getWindowSize} from "/back_zeuz.js"; 
13+ function  getWindowSize ( callback )  { 
14+     chrome . storage . local . get ( 'window' ,  function ( result )  { 
15+         var  height  =  740 ; 
16+         //var width = 780; 
17+         var  width  =  1110 ; 
18+         if  ( result )  { 
19+             try  { 
20+                 result  =  result . window ; 
21+                 if  ( result . height )  { 
22+                     height  =  result . height ; 
23+                 } 
24+                 if  ( result . width )  { 
25+                     width  =  result . width ; 
26+                 } 
27+             }  catch  ( e )  { 
28+             } 
29+         } 
30+         callback ( height ,  width ) ; 
31+     } ) ; 
32+ } 
33+ 
834function  open_panel ( tab )  { 
935    let  contentWindowId  =  tab . windowId ; 
1036    if  ( master [ contentWindowId ]  !=  undefined )  { 
11-         browser . windows . update ( master [ contentWindowId ] ,  { 
37+         browserAppData . windows . update ( master [ contentWindowId ] ,  { 
1238            focused : true 
1339        } ) . catch ( function ( e )  { 
1440            master [ contentWindowId ]  ==  undefined ; 
@@ -25,8 +51,8 @@ function open_panel(tab) {
2551    } ,  1000 ) ; 
2652
2753    var  f  =  function ( height ,  width )  { 
28-         browser . windows . create ( { 
29-             url : browser . runtime . getURL ( "panel/index.html" ) , 
54+         browserAppData . windows . create ( { 
55+             url : browserAppData . runtime . getURL ( "panel/index.html" ) , 
3056            type : "popup" , 
3157            //height: 705, 
3258            height : height , 
@@ -41,7 +67,7 @@ function open_panel(tab) {
4167                        clearInterval ( interval ) ; 
4268                    } 
4369
44-                     browser . tabs . query ( { 
70+                     browserAppData . tabs . query ( { 
4571                        active : true , 
4672                        windowId : panelWindowInfo . id , 
4773                        status : "complete" 
@@ -61,7 +87,7 @@ function open_panel(tab) {
6187                } ,  200 ) ; 
6288            } ) ; 
6389        } ) . then ( function  bridge ( panelWindowInfo ) { 
64-             return  browser . tabs . sendMessage ( panelWindowInfo . tabs [ 0 ] . id ,  { 
90+             return  browserAppData . tabs . sendMessage ( panelWindowInfo . tabs [ 0 ] . id ,  { 
6591                selfWindowId : panelWindowInfo . id , 
6692                commWindowId : contentWindowId 
6793            } ) ; 
@@ -74,55 +100,55 @@ function open_panel(tab) {
74100
75101/* Create menu */ 
76102function  create_menus ( )  { 
77-     browser . contextMenus . create ( { 
103+     browserAppData . contextMenus . create ( { 
78104        id : "verifyText" , 
79105        title : "verifyText" , 
80106        documentUrlPatterns : [ "<all_urls>" ] , 
81107        contexts : [ "all" ] 
82108    } ) ; 
83-     browser . contextMenus . create ( { 
109+     browserAppData . contextMenus . create ( { 
84110        id : "verifyTitle" , 
85111        title : "verifyTitle" , 
86112        documentUrlPatterns : [ "<all_urls>" ] , 
87113        contexts : [ "all" ] 
88114    } ) ; 
89-     browser . contextMenus . create ( { 
115+     browserAppData . contextMenus . create ( { 
90116        id : "verifyValue" , 
91117        title : "verifyValue" , 
92118        documentUrlPatterns : [ "<all_urls>" ] , 
93119        contexts : [ "all" ] 
94120    } ) ; 
95-     browser . contextMenus . create ( { 
121+     browserAppData . contextMenus . create ( { 
96122        id : "assertText" , 
97123        title : "assertText" , 
98124        documentUrlPatterns : [ "<all_urls>" ] , 
99125        contexts : [ "all" ] 
100126    } ) ; 
101-     browser . contextMenus . create ( { 
127+     browserAppData . contextMenus . create ( { 
102128        id : "assertTitle" , 
103129        title : "assertTitle" , 
104130        documentUrlPatterns : [ "<all_urls>" ] , 
105131        contexts : [ "all" ] 
106132    } ) ; 
107-     browser . contextMenus . create ( { 
133+     browserAppData . contextMenus . create ( { 
108134        id : "assertValue" , 
109135        title : "assertValue" , 
110136        documentUrlPatterns : [ "<all_urls>" ] , 
111137        contexts : [ "all" ] 
112138    } ) ; 
113-     browser . contextMenus . create ( { 
139+     browserAppData . contextMenus . create ( { 
114140        id : "storeText" , 
115141        title : "storeText" , 
116142        documentUrlPatterns : [ "<all_urls>" ] , 
117143        contexts : [ "all" ] 
118144    } ) ; 
119-     browser . contextMenus . create ( { 
145+     browserAppData . contextMenus . create ( { 
120146        id : "storeTitle" , 
121147        title : "storeTitle" , 
122148        documentUrlPatterns : [ "<all_urls>" ] , 
123149        contexts : [ "all" ] 
124150    } ) ; 
125-     browser . contextMenus . create ( { 
151+     browserAppData . contextMenus . create ( { 
126152        id : "storeValue" , 
127153        title : "storeValue" , 
128154        documentUrlPatterns : [ "<all_urls>" ] , 
@@ -131,25 +157,25 @@ function create_menus() {
131157} 
132158
133159
134- browser . browserAction . onClicked . addListener ( open_panel ) ; 
135- browser . windows . onRemoved . addListener ( function ( windowId )  { 
160+ browserAppData . action . onClicked . addListener ( open_panel ) ; 
161+ browserAppData . windows . onRemoved . addListener ( function ( windowId )  { 
136162    let  keys  =  Object . keys ( master ) ; 
137163    for  ( let  key  of  keys )  { 
138164        if  ( master [ key ]  ===  windowId )  { 
139165            delete  master [ key ] ; 
140166            if  ( keys . length  ===  1 )  { 
141-                 browser . contextMenus . removeAll ( ) ; 
167+                 browserAppData . contextMenus . removeAll ( ) ; 
142168            } 
143169        } 
144170    } 
145171} ) ; 
146172
147173var  port ; 
148- browser . contextMenus . onClicked . addListener ( function ( info ,  tab )  { 
174+ browserAppData . contextMenus . onClicked . addListener ( function ( info ,  tab )  { 
149175    port . postMessage ( {  cmd : info . menuItemId  } ) ; 
150176} ) ; 
151177
152- browser . runtime . onConnect . addListener ( function ( m )  { 
178+ browserAppData . runtime . onConnect . addListener ( function ( m )  { 
153179    port  =  m ; 
154180} ) ; 
155181
0 commit comments