Last active
April 30, 2024 16:36
-
-
Save jareha/f65f87e2a32c14d7cd8a1a2cd2fc51c3 to your computer and use it in GitHub Desktop.
Keyword search (bookmarklet) template with implementations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
(function () { | |
const fallback = null; | |
const keyword = "%s"; | |
const service = "https://www.example.com/"; | |
const suffix = ""; | |
if (keyword !== "" || keyword !== "%" + "s") { | |
window.location = `${service}?q=${keyword}${suffix}`; | |
} else { | |
window.location = fallback || service; | |
} | |
})(); | |
// javascript:(function(){const keyword="%s";const service="https://www.example.com/";let url=service;if(keyword!==""||keyword!=="%s"){url=`${service}?q=${keyword}${suffix}`}window.location=url})(); | |
// Minified at https://duckduckgo.com/?q=javascript+minifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
(function () { | |
const keyword = "%s"; | |
const service = "http://www.color-hex.com"; | |
if (keyword !== "" || keyword !== "%" + "s") { | |
window.location = `${service}/color/${keyword.replace("#", "")}`; | |
} else { | |
window.location = service; | |
} | |
})(); | |
// javascript:(function(){const keyword="%s";const service="http://www.color-hex.com";if(keyword!==""||keyword!=="%s"){window.location=`${ service }/color/${keyword.replace("#","")}`}else{window.location=service}})(); | |
// Minified at https://duckduckgo.com/?q=javascript+minifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
(function () { | |
const fallback = "https://developer.mozilla.org/en-US/docs/"; | |
const keyword = "%s"; | |
const service = "https://www.duckduckgo.com/"; | |
if (keyword !== "" || keyword !== "%" + "s") { | |
window.location = `${service}?q=site:https://developer.mozilla.org/en-US/docs/+${keyword}`; | |
} else { | |
window.location = fallback; | |
} | |
})(); | |
// javascript:(function(){const fallback="https://developer.mozilla.org/en-US/docs/";const keyword="%s";const service="https://www.duckduckgo.com/";if(keyword!==""||keyword!=="%s"){window.location=`${ service }?q=site:https://developer.mozilla.org/en-US/docs/+${ keyword }`}else{window.location=fallback}})(); | |
// Minified at https://duckduckgo.com/?q=javascript+minifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
(function () { | |
const keyword = "%s"; | |
const service = "https://www.duckduckgo.com/"; | |
if (keyword !== "" || keyword !== "%" + "s") { | |
window.location = `${service}?q=${keyword}&kp=-2`; | |
} else { | |
window.location = service; | |
} | |
})(); | |
/* | |
* DuckDuckGo params: https://duckduckgo.com/params | |
* Safe Search: `kp = -2` (off) | |
** `kp = 1` (on) | |
** `kp = -1` (moderate) | |
*/ | |
// javascript:(function(){const keyword="%s";const service="https://www.duckduckgo.com/";let url=service;if(keyword!==""||keyword!=="%s"){url=`${service}?q=${keyword}`}window.location=url})(); | |
// Minified at https://duckduckgo.com/?q=javascript+minifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
(function () { | |
const fallback = "http://www.facebook.com/jareha"; | |
const keyword = "%s"; | |
const service = "http://www.facebook.com/"; | |
if (keyword !== "" || keyword !== "%" + "s") { | |
window.location = `${service}search/top?q=${keyword}&init=quick&tas=search_preload`; | |
} else { | |
window.location = fallback || service; | |
} | |
})(); | |
// javascript:(function(){const fallback=null;const keyword="%s";const service="http://www.facebook.com/";if(keyword!==""||keyword!=="%s"){window.location=`${ service }search/top?q=${ keyword }&init=quick&tas=search_preload`}else{window.location=fallback||service}})(); | |
// Minified at https://duckduckgo.com/?q=javascript+minifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
(function () { | |
const fallback = "https://foursquare.com/city-guide"; | |
const keyword = "%s"; | |
const service = "https://foursquare.com/"; | |
if (keyword !== "" || keyword !== "%" + "s") { | |
window.location = `${service}explore?near=Chicago, IL&q=${keyword}`; | |
} else { | |
window.location = fallback; | |
} | |
})(); | |
// javascript:(function(){const fallback="https://foursquare.com/city-guide";const keyword="%s";const service="https://foursquare.com/";if(keyword!==""||keyword!=="%s"){window.location=`${service}explore?near=Chicago, IL&q=${ keyword }`}else{window.location=fallback}})(); | |
// Minified at https://duckduckgo.com/?q=javascript+minifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
(function () { | |
const service = "http://validator.w3.org/"; | |
let uri = window.location.href; | |
uri = uri.replace(/(about:blank|about:newtab|about:privatebrowsing)/g, ""); | |
if (uri) { | |
window.location = service + "check?uri=" + uri + "&charset=(detect+automatically)&doctype=Inline&ss=1&group=0"; | |
} else { | |
window.location = service + "#validate_by_input+with_options"; | |
} | |
})(); | |
// javascript:(function(){const service="http://validator.w3.org/";let uri=window.location.href;uri=uri.replace(/(about:blank|about:newtab|about:privatebrowsing)/g,"");if(uri){window.location=service+"check?uri="+uri+"&charset=(detect+automatically)&doctype=Inline&ss=1&group=0"}else{window.location=service+"#validate_by_input+with_options"}})(); | |
// Minified at https://duckduckgo.com/?q=javascript+minifier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment