Skip to content

Commit

Permalink
merged 4 commits into one.
Browse files Browse the repository at this point in the history
  • Loading branch information
vishvanath45 committed Jan 31, 2017
1 parent 87ce723 commit c074b5a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
9 changes: 9 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ <h1><span style="color:#4285f4">F</span><span style="color:#ea4335">e</span><spa
<input type="checkbox" name="books" value="books" id="books">
<label for="books" title="Ctrl+Alt+b">Books</label>
</td>
</tr>
<tr>
<td colspan="2">

<input type="checkbox" name="GDrive" value="GDrive" id="GDrive">
<label for="GDrive">Also Show Results from Google Drive</label>

</td>

</tr>
<tr>
<td>
Expand Down
29 changes: 27 additions & 2 deletions popup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use strict";

// Styling content

// Place suggestion in query box

function suggestionAsValue() {
var sLabel;
sLabel = document.getElementById("suggest-label");
Expand Down Expand Up @@ -43,14 +45,25 @@ function keyboardShortCutListener(e) {
}
}
}

/* eslint-disable */
function trim(s, mask) {
while (~mask.indexOf(s[0])) {
s = s.slice(1);
}
while (~mask.indexOf(s[s.length - 1])) {
s = s.slice(0, -1);
}
return s;
}
/* eslint-enable */
function register(event) {
var set1;
var set2;
var set3;
var check1;
var check2;
var check3;
var check4;
var query;
var formats;
var querySplit;
Expand All @@ -65,6 +78,7 @@ function register(event) {
check1 = document.getElementById("music").checked;
check2 = document.getElementById("video").checked;
check3 = document.getElementById("books").checked;
check4 = document.getElementById("GDrive").checked;
querySplit = query.split(".");
dotCheck = querySplit.length > 1;

Expand Down Expand Up @@ -96,8 +110,19 @@ function register(event) {
query = querySplit[0];
formats = formats + "|" + suggestedFormat;
}
formats = trim(formats, "|");

/* eslint-disable */
window.open("http://www.google.com/search?q="+query+" -"+uuid+" -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" ("+formats+")");
window.open("http://www.google.com/search?q=" + query + " - " + uuid + " -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" (" + formats + ")");
if (check4) {

if ((document.getElementById("video").checked === true) || (document.getElementById("music").checked === true)) {
window.open("https://www.google.co.in/#q=" + query + " site:drive.google.com (" + formats + ")");

} else {
window.open("https://www.google.co.in/#q=" + query + " site:docs.google.com (" + formats + ")");
}
}
/* eslint-enable */
} else {
document.getElementById("searchWarning").style.display = "none";
Expand Down

0 comments on commit c074b5a

Please sign in to comment.