-
-
Save TimSorbet/47422 to your computer and use it in GitHub Desktop.
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
CmdUtils.makeSearchCommand({ | |
name: "Homestar Runner Wiki", | |
url: "http://www.hrwiki.org/index.php/Special:Search?search={QUERY}", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL" | |
}); | |
CmdUtils.makeSearchCommand({ | |
name: "StarCraft Wiki", | |
url: "http://starcraft.wikia.com/wiki/Special:Search?search={QUERY}", | |
icon: "http://images.wikia.com/starcraft/images/6/64/Favicon.ico", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL" | |
}); | |
CmdUtils.makeSearchCommand({ | |
name: "SC2Pod Wiki", | |
url: "http://www.sc2pod.com/wiki/Special:Search?search={QUERY}", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL" | |
}); | |
CmdUtils.CreateCommand({ | |
names: ["Bible", "TNIV Bible"], | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
locale: "en-US", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL", | |
icon: "http://www.biblica.com/images/logos/favicon.png", | |
description: "Searches the TNIV Bible for your passage, word, or phrase.", | |
preview: function(pBlock, args) { //preview code partially taken from the commands at http://www.geero.net/ | |
if (args.object.text == '') { | |
pBlock.innerHTML = _('Searches the TNIV Bible for your passage, word, or phrase.'); | |
return; | |
} | |
var previewTemplate = _("Searching the TNIV Bible for <b>${query}</b> ..."); | |
var previewData = {query: args.object.text}; | |
pBlock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
var params = { | |
q: args.object.text, | |
tniv: 'yes' | |
} | |
var passageURL = 'http://www.biblica.com/bible/verse/print.php?' + jQuery.param( params ); | |
jQuery.ajax({ | |
type: "GET", | |
url: passageURL, | |
dataType: "html", | |
error: function() { | |
pBlock.innerHTML = _("<i>Error retreiving summary.</i>"); | |
}, | |
success: function(searchResponse) { | |
startBlock = '</h1>'; | |
if ((ind = searchResponse.indexOf(startBlock)) > -1) { | |
middle = searchResponse.substr(ind + startBlock.length); | |
endBlock = '<b>'; | |
if ((ind = middle.indexOf(endBlock)) > -1) { | |
middle = middle.substr(0, ind); | |
} | |
pBlock.innerHTML = middle; | |
} else { | |
pBlock.innerHTML = _('Passage not found. Issue command to search as a word or phrase.'); | |
} | |
} | |
}); | |
displayMessage(args.object.text.IndexOf("1")); | |
}, | |
execute: function(args) { | |
var passage = args.object.text; | |
displayMessage(_("Looking up " + passage + "...")) | |
var params = { | |
q: passage, | |
tniv: 'yes' | |
} | |
var passageURL = 'http://www.biblica.com/bible/verse/print.php?' + jQuery.param( params ); | |
jQuery.ajax({ | |
type: "GET", | |
url: passageURL, | |
dataType: "html", | |
error: function() { | |
displayMessage(_("Unable to clean up passage name. Opening as given...")); | |
Utils.openUrlInBrowser("http://www.biblica.com/search/define.php?search_type=bible_search&search_value=" + args.object.text); | |
}, | |
success: function(searchResponse) { | |
startBlock = '<title>'; | |
startBlockAlt = '“'; | |
endBlock = ' TNIV'; | |
endBlockAlt = '”'; | |
ind = searchResponse.indexOf(startBlock); | |
indthere = ind > -1; | |
ind2 = searchResponse.indexOf(startBlock + ' '); | |
ind2there = ind2 > -1; | |
cond1 = indthere && !ind2there; | |
cond2 = indthere && ind2there; | |
if (cond1) { | |
middle = searchResponse.substr(ind + startBlock.length); | |
if ((ind = middle.indexOf(endBlock)) > -1) { | |
middle = middle.substr(0, ind); | |
} | |
Utils.openUrlInBrowser("http://www.biblica.com/bible/verse/index.php?tniv=yes&q=" + middle); | |
} else if (cond2) { | |
indStart = searchResponse.indexOf(startBlockAlt); | |
middle = searchResponse.substr(indStart + startBlockAlt.length); | |
if ((ind2 = middle.indexOf(endBlockAlt)) > -1) { | |
middle = middle.substr(0, ind2); | |
} | |
Utils.openUrlInBrowser("http://www.biblica.com/bible/word/index.php?selected_version_word=tniv&limit=10&word_request=" + args.object.text); | |
} | |
} | |
}) | |
} | |
}); | |
CmdUtils.makeSearchCommand({ | |
names: ["Bible-simple-open"], | |
url: "http://www.biblica.com/search/define.php?search_type=bible_search&search_value={QUERY}", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL" | |
}); | |
CmdUtils.makeSearchCommand({ | |
names: ["Merriam-Webster Dictionary", "Dictionary", "Define"], | |
url: "http://www.merriam-webster.com/dictionary/{QUERY}", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL" | |
}); | |
CmdUtils.makeSearchCommand({ | |
names: ["Merriam-Webster Thesaurus", "Thesaurus"], | |
url: "http://www.merriam-webster.com/thesaurus/{QUERY}", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL" | |
}); | |
CmdUtils.CreateCommand({ | |
name: "open URL", | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
locale: "en-US", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL", | |
description: "Opens the selected URL.", | |
preview: function(pblock, args) { | |
var html = _("Opens the URL "); | |
if (args.object.text) { | |
html += args.object.text; | |
} else { | |
html += _("you input."); | |
} | |
pblock.innerHTML = html; | |
}, | |
execute: function(args) { | |
Utils.openUrlInBrowser(args.object.text); | |
} | |
}); | |
CmdUtils.makeSearchCommand({ | |
name: "IGN", | |
url: "http://search.ign.com/products?query={QUERY}", | |
icon: "http://media.ign.com/ign/favicon.ico", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL" | |
}); | |
CmdUtils.CreateCommand({ | |
name: "FileShack", | |
arguments: [{role: 'object', nountype: noun_arb_text}, {role: 'location', nountype: ["all", "demos", "mods", "media", "patches", "drivers", "utils"], label: 'section'}], | |
locale: "en-US", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL", | |
icon: "http://www.fileshack.com/favicon.ico", | |
description: "Searches Fileshack.", | |
preview: function(pblock, args) { | |
var text = args.object.text; | |
var section = args.location.text; | |
if (section) { | |
pblock.innerHTML = _("Searches Fileshack for " + text + " in the " + section + " section."); | |
} else { | |
if (text) { | |
pblock.innerHTML = _("Searches Fileshack for " + text + " in the all section."); | |
} else { | |
pblock.innerHTML = _("Searches Fileshack for your words in the all section."); | |
} | |
} | |
}, | |
execute: function(args) { | |
var section = 0; | |
switch(args.location.text) { | |
case "all": | |
section = 0; | |
break; | |
case "demos": | |
section = 1; | |
break; | |
case "patches": | |
section = 2; | |
break; | |
case "mods": | |
section = 3; | |
break; | |
case "media": | |
section = 4; | |
break; | |
case "drivers": | |
section = 5; | |
break; | |
case "utils": | |
section = 6; | |
break; | |
} | |
var searchUrl = "http://www.fileshack.com/search.x"; | |
var searchParams = {terms: args.object.text, search_for: section, type: "files"}; | |
Utils.openUrlInBrowser(searchUrl + Utils.paramsToString(searchParams)); | |
} | |
}); | |
CmdUtils.CreateCommand({ | |
name: "Metacritic", | |
arguments: [{role: 'object', nountype: noun_arb_text}, {role: 'location', nountype: _(["all", "movies", "film", "video", "film and video", "music", "games", "books", "television", "tv"]), label: 'section'}], | |
locale: "en-US", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL", | |
icon: "http://www.metacritic.com/favicon.ico", | |
description: "Searches Metacritic.", | |
preview: function(pblock, args) { | |
var text = args.object.text; | |
var section = args.location.text; | |
if (section) { | |
pblock.innerHTML = _("Searches Metacritic for " + text + " in the " + section + " section."); | |
} else { | |
if (text) { | |
pblock.innerHTML = _("Searches Metacritic for " + text + " in the all section."); | |
} else { | |
pblock.innerHTML = _("Searches Metacritic for your words in the all section."); | |
} | |
} | |
}, | |
execute: function(args) { | |
var section = 0; | |
switch(args.location.text) { | |
case _("all"): | |
section = 0; | |
break; | |
case _("movies"): case _("film"): case _("video"): case _("film and video"): | |
section = 1; | |
break; | |
case _("music"): | |
section = 2; | |
break; | |
case _("games"): | |
section = 3; | |
break; | |
case _("books"): | |
section = 4; | |
break; | |
case _("television"): | |
section = 6; | |
break; | |
case _("tv"): | |
section = 6; | |
break; | |
} | |
var searchUrl = "http://www.metacritic.com/search/process?ts=" + args.object.text + "&ty=" + section; | |
Utils.openUrlInBrowser(searchUrl); | |
} | |
}); | |
//Note: This command was automatically generated by the create-bookmarklet-command command. | |
CmdUtils.makeBookmarkletCommand({ | |
name: "download YouTube video", | |
locale: "en-US", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL", | |
url: "javascript:window.location.href%20=%20'http://youtube.com/get_video?video_id='%20+%20swfArgs['video_id']%20+%20\"&l=\"%20+%20swfArgs['l']%20+%20\"&sk=\"%20+%20swfArgs['sk']%20+%20'&fmt_map'%20+%20swfArgs['fmt_map']%20+%20'&t='%20+%20swfArgs['t'];" | |
}); | |
String.prototype.rot13 = function(){ //v1.0 | |
return this.replace(/[a-zA-Z]/g, function(c){ | |
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26); | |
}); | |
}; | |
CmdUtils.CreateCommand({ | |
names: ["ROT-13", "ROT 13", "ROT13"], | |
locale: "en-US", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL", | |
description: "ROT-13s the selected text.", | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
preview: function( pblock, args ) { | |
pblock.innerHTML = _("ROT-13s the selected text."); | |
if(args.object.text) { | |
pblock.innerHTML = _("The ROT-13 of<br>" + args.object.html + "<br>is<br>" + args.object.html.rot13()); | |
} | |
}, | |
execute: function(args) { CmdUtils.setSelection(args.object.text.rot13()); } | |
}); | |
CmdUtils.CreateCommand({ | |
name: ["BBcode link to Google", "Google-it", "link to Google"], | |
icon: "http://www.google.com/favicon.ico", | |
locale: "en-US", | |
author: {name: "Timothy Sorbera", email: "tim.sorbera@gmail.com"}, | |
license: "MPL", | |
description: "Links to a Google search of the input", | |
help: "Links to a Google search of the input", | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
preview: function( pblock, args ) { | |
pblock.innerHTML = _("Links to a Google search of the input" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment