@@ -7,28 +7,21 @@ window.addEventListener("load", () => {
77 form . addEventListener ( "submit" , async event => {
88 event . preventDefault ( ) ;
99 const formValue = input . value . trim ( ) ;
10- const url = isUrl ( formValue )
11- ? prependHttps ( formValue )
12- : `https://www.google.com/search?q=${ formValue } ` ;
10+ const url = isUrl ( formValue ) ? prependHttps ( formValue ) : `https://www.google.com/search?q=${ formValue } ` ;
1311 processUrl ( url ) ;
1412 } ) ;
1513 }
1614 function processUrl ( url ) {
1715 sessionStorage . setItem ( "GoUrl" , __uv$config . encodeUrl ( url ) ) ;
1816 const iframeContainer = document . getElementById ( "frame-container" ) ;
19- const activeIframe = Array . from ( iframeContainer . querySelectorAll ( "iframe" ) ) . find (
20- iframe => iframe . classList . contains ( "active" ) ,
21- ) ;
17+ const activeIframe = Array . from ( iframeContainer . querySelectorAll ( "iframe" ) ) . find ( iframe => iframe . classList . contains ( "active" ) ) ;
2218 activeIframe . src = `/a/${ __uv$config . encodeUrl ( url ) } ` ;
2319 activeIframe . dataset . tabUrl = url ;
2420 input . value = url ;
2521 console . log ( activeIframe . dataset . tabUrl ) ;
2622 }
2723 function isUrl ( val = "" ) {
28- if (
29- / ^ h t t p ( s ? ) : \/ \/ / . test ( val ) ||
30- ( val . includes ( "." ) && val . substr ( 0 , 1 ) !== " " )
31- ) {
24+ if ( / ^ h t t p ( s ? ) : \/ \/ / . test ( val ) || ( val . includes ( "." ) && val . substr ( 0 , 1 ) !== " " ) ) {
3225 return true ;
3326 }
3427 return false ;
@@ -53,8 +46,7 @@ document.addEventListener("DOMContentLoaded", event => {
5346 const newTab = document . createElement ( "li" ) ;
5447 const tabTitle = document . createElement ( "span" ) ;
5548 const newIframe = document . createElement ( "iframe" ) ;
56- newIframe . sandbox =
57- "allow-same-origin allow-scripts allow-forms allow-pointer-lock allow-modals allow-orientation-lock allow-presentation allow-storage-access-by-user-activation" ;
49+ newIframe . sandbox = "allow-same-origin allow-scripts allow-forms allow-pointer-lock allow-modals allow-orientation-lock allow-presentation allow-storage-access-by-user-activation" ;
5850 // When Top Navigation is not allowed links with the "top" value will be entirely blocked, if we allow Top Navigation it will overwrite the tab, which is obviously not wanted.
5951 tabTitle . textContent = `New Tab ${ tabCounter } ` ;
6052 tabTitle . className = "t" ;
@@ -140,14 +132,10 @@ document.addEventListener("DOMContentLoaded", event => {
140132 tabCounter = 0 ;
141133 document . getElementById ( "iv" ) . value = "" ;
142134 } else {
143- const nextTabIndex = remainingTabs . findIndex (
144- tab => tab . dataset . tabId !== tabId ,
145- ) ;
135+ const nextTabIndex = remainingTabs . findIndex ( tab => tab . dataset . tabId !== tabId ) ;
146136 if ( nextTabIndex > - 1 ) {
147137 const nextTabToActivate = remainingTabs [ nextTabIndex ] ;
148- const nextIframeToActivate = iframeContainer . querySelector (
149- `[data-tab-id='${ nextTabToActivate . dataset . tabId } ']` ,
150- ) ;
138+ const nextIframeToActivate = iframeContainer . querySelector ( `[data-tab-id='${ nextTabToActivate . dataset . tabId } ']` ) ;
151139 for ( const tab of remainingTabs ) {
152140 tab . classList . remove ( "active" ) ;
153141 }
@@ -226,9 +214,7 @@ function popout() {
226214 const newWindow = window . open ( "about:blank" , "_blank" ) ;
227215 if ( newWindow ) {
228216 const name = localStorage . getItem ( "name" ) || "My Drive - Google Drive" ;
229- const icon =
230- localStorage . getItem ( "icon" ) ||
231- "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png" ;
217+ const icon = localStorage . getItem ( "icon" ) || "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png" ;
232218 newWindow . document . title = name ;
233219 const link = newWindow . document . createElement ( "link" ) ;
234220 link . rel = "icon" ;
@@ -358,22 +344,15 @@ if (navigator.userAgent.includes("Chrome")) {
358344}
359345function Load ( ) {
360346 const activeIframe = document . querySelector ( "#frame-container iframe.active" ) ;
361- if (
362- activeIframe &&
363- activeIframe . contentWindow . document . readyState === "complete"
364- ) {
347+ if ( activeIframe && activeIframe . contentWindow . document . readyState === "complete" ) {
365348 const website = activeIframe . contentWindow . document . location . href ;
366349 if ( website . includes ( "/a/" ) ) {
367- const websitePath = website
368- . replace ( window . location . origin , "" )
369- . replace ( "/a/" , "" ) ;
350+ const websitePath = website . replace ( window . location . origin , "" ) . replace ( "/a/" , "" ) ;
370351 localStorage . setItem ( "decoded" , websitePath ) ;
371352 const decodedValue = decodeXor ( websitePath ) ;
372353 document . getElementById ( "iv" ) . value = decodedValue ;
373354 } else if ( website . includes ( "/a/q/" ) ) {
374- const websitePath = website
375- . replace ( window . location . origin , "" )
376- . replace ( "/a/q/" , "" ) ;
355+ const websitePath = website . replace ( window . location . origin , "" ) . replace ( "/a/q/" , "" ) ;
377356 const decodedValue = decodeXor ( websitePath ) ;
378357 localStorage . setItem ( "decoded" , websitePath ) ;
379358 document . getElementById ( "iv" ) . value = decodedValue ;
@@ -392,9 +371,7 @@ function decodeXor(input) {
392371 return (
393372 decodeURIComponent ( str )
394373 . split ( "" )
395- . map ( ( char , ind ) =>
396- ind % 2 ? String . fromCharCode ( char . charCodeAt ( Number . NaN ) ^ 2 ) : char ,
397- )
374+ . map ( ( char , ind ) => ( ind % 2 ? String . fromCharCode ( char . charCodeAt ( Number . NaN ) ^ 2 ) : char ) )
398375 . join ( "" ) + ( search . length ? `?${ search . join ( "?" ) } ` : "" )
399376 ) ;
400377}
0 commit comments