1+ "use strict" ;
12
23// Styling content
34
45// Place suggestion in query box
6+
57function suggestionAsValue ( ) {
68 var sLabel ;
79 sLabel = document . getElementById ( "suggest-label" ) ;
@@ -43,14 +45,25 @@ function keyboardShortCutListener(e) {
4345 }
4446 }
4547}
46-
48+ /* eslint-disable */
49+ function trim ( s , mask ) {
50+ while ( ~ mask . indexOf ( s [ 0 ] ) ) {
51+ s = s . slice ( 1 ) ;
52+ }
53+ while ( ~ mask . indexOf ( s [ s . length - 1 ] ) ) {
54+ s = s . slice ( 0 , - 1 ) ;
55+ }
56+ return s ;
57+ }
58+ /* eslint-enable */
4759function register ( event ) {
4860 var set1 ;
4961 var set2 ;
5062 var set3 ;
5163 var check1 ;
5264 var check2 ;
5365 var check3 ;
66+ var check4 ;
5467 var query ;
5568 var formats ;
5669 var querySplit ;
@@ -65,6 +78,7 @@ function register(event) {
6578 check1 = document . getElementById ( "music" ) . checked ;
6679 check2 = document . getElementById ( "video" ) . checked ;
6780 check3 = document . getElementById ( "books" ) . checked ;
81+ check4 = document . getElementById ( "GDrive" ) . checked ;
6882 querySplit = query . split ( "." ) ;
6983 dotCheck = querySplit . length > 1 ;
7084
@@ -96,8 +110,19 @@ function register(event) {
96110 query = querySplit [ 0 ] ;
97111 formats = formats + "|" + suggestedFormat ;
98112 }
113+ formats = trim ( formats , "|" ) ;
114+
99115 /* eslint-disable */
100- window . open ( "http://www.google.com/search?q=" + query + " -" + uuid + " -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" (" + formats + ")" ) ;
116+ window . open ( "http://www.google.com/search?q=" + query + " - " + uuid + " -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" (" + formats + ")" ) ;
117+ if ( check4 ) {
118+
119+ if ( ( document . getElementById ( "video" ) . checked === true ) || ( document . getElementById ( "music" ) . checked === true ) ) {
120+ window . open ( "https://www.google.co.in/#q=" + query + " site:drive.google.com (" + formats + ")" ) ;
121+
122+ } else {
123+ window . open ( "https://www.google.co.in/#q=" + query + " site:docs.google.com (" + formats + ")" ) ;
124+ }
125+ }
101126 /* eslint-enable */
102127 } else {
103128 document . getElementById ( "searchWarning" ) . style . display = "none" ;
0 commit comments