Skip to content

Commit cbb4f5a

Browse files
committed
Add two new Google searches
1 parent 08f11c2 commit cbb4f5a

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use strict";
2+
var selection;
3+
if (window.getSelection) {
4+
selection = window.getSelection().toString();
5+
} else if (document.selection && document.selection.type !== "Control") {
6+
selection = document.selection.createRange().text;
7+
}
8+
if (selection === undefined || selection.length === 0) {
9+
window.alert('Select the desired text to search.');
10+
} else {
11+
window.open('https://www.google.com/search?q=define%3A' + encodeURIComponent(selection.trim()), '_blank').focus();
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use strict";
2+
var selection;
3+
if (window.getSelection) {
4+
selection = window.getSelection().toString();
5+
} else if (document.selection && document.selection.type !== "Control") {
6+
selection = document.selection.createRange().text;
7+
}
8+
if (selection === undefined || selection.length === 0) {
9+
window.alert('Select the desired text to search.');
10+
} else {
11+
window.open('https://www.google.com/search?q=weather%3A' + encodeURIComponent(selection.trim()), '_blank').focus();
12+
}

javascripts/index.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,18 @@
4343
"name": "DOM - Enable all",
4444
"description": "This bookmarklet reenables every element that is disabled in the page (button, text field, etc.)."
4545
},
46+
{
47+
"name": "Google Search - Search definition for selection",
48+
"description": "Search for a definition related to the current selection using Google."
49+
},
4650
{
4751
"name": "Google Search - Search related sites",
4852
"description": "Search for sites related to the current one using Google."
4953
},
54+
{
55+
"name": "Google Search - Search weather for selection",
56+
"description": "Search for weather information related to the current selection using Google."
57+
},
5058
{
5159
"name": "Reddit - Search selection",
5260
"description": "Use this bookmarklet to search the current text selection on Reddit. Most web browsers only support a single default search engine. This bookmarklet can be used as a shortcut to use an alternate search engine."

0 commit comments

Comments
 (0)