Skip to content

Commit

Permalink
beautify code
Browse files Browse the repository at this point in the history
  • Loading branch information
ylevch committed May 6, 2021
1 parent 880da36 commit c8abe8d
Showing 1 changed file with 20 additions and 43 deletions.
63 changes: 20 additions & 43 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,28 @@
function doSearch (search_target, tab)

{

chrome.tabs.create(
{

url : "https://www.google.com/search?tbm=bks&q="+search_target,
active : false,
index : tab.index + 1

} );

function doSearch(search_target, tab) {
chrome.tabs.create({
url: "https://www.google.com/search?tbm=bks&q=" + search_target,
active: true,
index: tab.index + 1
});
}



function selectionHandler (info, tab)

{

var replaced = info.selectionText.replace(/ /g, "+");
doSearch( replaced, tab );

function selectionHandler(info, tab) {
var replaced = info.selectionText.replace(/ /g, "+");
doSearch(replaced, tab);
}



function resetContextMenus ()

{

chrome.contextMenus.removeAll(
function()

{
var id = chrome.contextMenus.create(
{

title: "Search Google Books for '%s'",
contexts: [ "selection" ], onclick: selectionHandler

} );
}
);

function resetContextMenus() {
chrome.contextMenus.removeAll(
function() {
var id = chrome.contextMenus.create({
title: "Search Google Books for '%s'",
contexts: ["selection"],
onclick: selectionHandler
});
}
);
}



resetContextMenus();
resetContextMenus();

0 comments on commit c8abe8d

Please sign in to comment.