Skip to content

Commit c074b5a

Browse files
author
vishvanath45
committed
merged 4 commits into one.
1 parent 87ce723 commit c074b5a

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

popup.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ <h1><span style="color:#4285f4">F</span><span style="color:#ea4335">e</span><spa
4848
<input type="checkbox" name="books" value="books" id="books">
4949
<label for="books" title="Ctrl+Alt+b">Books</label>
5050
</td>
51+
</tr>
52+
<tr>
53+
<td colspan="2">
54+
55+
<input type="checkbox" name="GDrive" value="GDrive" id="GDrive">
56+
<label for="GDrive">Also Show Results from Google Drive</label>
57+
58+
</td>
59+
5160
</tr>
5261
<tr>
5362
<td>

popup.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
"use strict";
12

23
// Styling content
34

45
// Place suggestion in query box
6+
57
function 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 */
4759
function 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

Comments
 (0)