@@ -10,6 +10,13 @@ export default {
1010 } ,
1111
1212 popupScript : {
13+ onClick : ( ) => {
14+ chrome . sessions . getRecentlyClosed ( { } , ( data ) => {
15+ console . log ( data ) ;
16+ } ) ;
17+ } ,
18+
19+ // fake window update screen
1320 _onClick : async ( ) => {
1421 const { openWebAndRunScript } = await import ( "./helpers/utils.js" ) ;
1522 openWebAndRunScript ( {
@@ -23,6 +30,8 @@ export default {
2330 waitUntilLoadEnd : true ,
2431 } ) ;
2532 } ,
33+
34+ // saveAsMHTML
2635 _onClick : async ( ) => {
2736 const { getCurrentTab, showLoading } = await import ( "./helpers/utils.js" ) ;
2837 const tab = await getCurrentTab ( ) ;
@@ -36,6 +45,8 @@ export default {
3645 filename : "web.mhtml" ,
3746 } ) ;
3847 } ,
48+
49+ // Delete browsers history
3950 _onClick : async ( ) => {
4051 const { getCurrentTab, showLoading } = await import ( "./helpers/utils.js" ) ;
4152
@@ -97,6 +108,8 @@ export default {
97108 ]
98109 */
99110 } ,
111+
112+ // devtool command
100113 _onClick : async ( ) => {
101114 // const {
102115 // attachDebugger,
@@ -150,6 +163,7 @@ export default {
150163 } ,
151164
152165 contentScript : {
166+ // text size in KB
153167 _onClick : ( ) => {
154168 function formatSize ( size , fixed = 0 ) {
155169 size = Number ( size ) ;
@@ -187,55 +201,7 @@ export default {
187201 alert ( e ) ;
188202 }
189203 } ,
190- _onClick : ( ) => {
191- function analyzeWebpage ( ) {
192- const href = window . location . href ,
193- hostname = window . location . hostname ,
194- a = href . replace ( "www." , "" ) ;
195-
196- const features = {
197- "IP Address" : ( ( ) => {
198- const ipv4Regex =
199- / ^ ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] [ 0 - 9 ] | [ 0 1 ] ? [ 0 - 9 ] [ 0 - 9 ] ? ) \. ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] [ 0 - 9 ] | [ 0 1 ] ? [ 0 - 9 ] [ 0 - 9 ] ? ) \. ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] [ 0 - 9 ] | [ 0 1 ] ? [ 0 - 9 ] [ 0 - 9 ] ? ) \. ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] [ 0 - 9 ] | [ 0 1 ] ? [ 0 - 9 ] [ 0 - 9 ] ? ) $ / ;
200- const ipv6Regex = / ^ 0 x ( [ 0 - 9 a - f A - F ] { 2 } ) ( .| $ ) { 3 } [ 0 - 9 a - f A - F ] { 2 } $ / ;
201- if ( ipv4Regex . test ( hostname ) || ipv6Regex . test ( hostname ) ) return 1 ;
202- return - 1 ;
203- } ) ( ) ,
204- "URL Length" :
205- href . length < 54
206- ? - 1
207- : href . length >= 54 && href . length <= 75
208- ? 0
209- : 1 ,
210- "Tiny URL" : a . length < 7 ? 1 : - 1 ,
211- "@ Symbol" : / @ / . test ( href ) ? 1 : - 1 ,
212- "Redirecting using //" : href . lastIndexOf ( "//" ) > 7 ? 1 : - 1 ,
213- "(-) Prefix/Suffix in domain" : / - / . test ( hostname ) ? 1 : - 1 ,
214- "No. of Sub Domains" : ( ( ) => {
215- let len = ( a . match ( RegExp ( "\\." , "g" ) ) || [ ] ) . length ;
216- return len == 1 ? - 1 : len == 2 ? 0 : 1 ;
217- } ) ( ) ,
218- HTTPS : / h t t p s : \/ \/ / . test ( href ) ? - 1 : 1 ,
219- Favicon : ( ( ) => {
220- let icon ;
221- const c = document . getElementsByTagName ( "link" ) ;
222- for ( let t = 0 ; t < c . length ; t ++ ) {
223- ( "icon" != c [ t ] . getAttribute ( "rel" ) &&
224- "shortcut icon" != c [ t ] . getAttribute ( "rel" ) ) ||
225- ( icon = c [ t ] . getAttribute ( "href" ) ) ;
226- }
227- if ( ! icon || icon . length != 12 ) return - 1 ;
228-
229- let i = RegExp ( hostname , "g" ) ;
230- return i . test ( icon ) ? - 1 : 1 ;
231- } ) ( ) ,
232- } ;
233204
234- console . log ( "Webpage Features:" , features ) ;
235- }
236-
237- analyzeWebpage ( ) ;
238- } ,
239205 // render video in document.title
240206 _onClick : ( ) => {
241207 let video = document . querySelector ( "video" ) ;
@@ -280,17 +246,6 @@ export default {
280246 updateFavicon ( ) ;
281247 } ,
282248 } ,
283-
284- pageScript : {
285- _onClick : async ( ) => {
286- console . log ( "send" ) ;
287- let res = await UfsGlobal . Extension . runInContentScript (
288- "chrome.runtime.sendMessage" ,
289- [ { action : "test" } , "callback" ]
290- ) ;
291- console . log ( res ) ;
292- } ,
293- } ,
294249} ;
295250
296251const backup = ( ) => {
0 commit comments