From d420618cc9f541f9dbcc43e7e8f28988d9a8b904 Mon Sep 17 00:00:00 2001 From: vishvanath45 Date: Tue, 31 Jan 2017 23:55:34 +0530 Subject: [PATCH] fixes --- popup.js | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/popup.js b/popup.js index 24b5542..46ec0db 100644 --- a/popup.js +++ b/popup.js @@ -1,7 +1,9 @@ +"use strict"; // Styling content // Place suggestion in query box + function suggestionAsValue() { var sLabel; sLabel = document.getElementById("suggest-label"); @@ -43,7 +45,17 @@ 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; @@ -98,16 +110,17 @@ 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+")"); - - if(document.getElementById("GDrive").checked === true) - { - 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+")"); + 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 */ @@ -157,4 +170,4 @@ document.addEventListener("DOMContentLoaded", function () { document.addEventListener("keyup", keyboardShortCutListener, false); suggestion(); suggestionAsValue(); -}); \ No newline at end of file +});