Skip to content

Commit

Permalink
Add searches
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasleplus committed Oct 14, 2024
1 parent 587c3a3 commit e6a2d95
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 0 deletions.
12 changes: 12 additions & 0 deletions javascripts/Search Amazon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://www.amazon.com/s?k=' + encodeURIComponent(selection.trim());, '_blank').focus();
}
12 changes: 12 additions & 0 deletions javascripts/Search Bing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://www.bing.com/search?q=' + encodeURIComponent(selection.trim());, '_blank').focus();
}
12 changes: 12 additions & 0 deletions javascripts/Search DuckDuckGo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://duckduckgo.com/?q=' + encodeURIComponent(selection.trim());, '_blank').focus();
}
12 changes: 12 additions & 0 deletions javascripts/Search Google.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://www.google.com/search?udm=14&q=' + encodeURIComponent(selection.trim());, '_blank').focus();
}
12 changes: 12 additions & 0 deletions javascripts/Search Reddit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://www.reddit.com/search?q=' + encodeURIComponent(selection.trim());, '_blank').focus();
}
12 changes: 12 additions & 0 deletions javascripts/Search StackOverflow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://stackoverflow.com/search?q=' + encodeURIComponent(selection.trim());, '_blank').focus();
}
12 changes: 12 additions & 0 deletions javascripts/Search Wikipedia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://en.wikipedia.org/w/index.php?title=Special:Search&search=' + encodeURIComponent(selection.trim());, '_blank').focus();
}
12 changes: 12 additions & 0 deletions javascripts/Search YouTube.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var selection;
if (window.getSelection) {
selection = window.getSelection().toString();
} else if (document.selection && document.selection.type !== "Control") {
selection = document.selection.createRange().text;
}
if (selection === undefined) {
window.alert('Select the desired text to search.');
} else {
window.open('https://www.youtube.com/results?search_query=' + encodeURIComponent(selection.trim());, '_blank').focus();
}

0 comments on commit e6a2d95

Please sign in to comment.