-
-
Save jasonong/145896 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.CreateCommand({ | |
names: ["rails"], | |
icon: "http://rubyonrails.org/favicon.ico", | |
description: "Search rails documentation", | |
help: "Type a rails class or method.", | |
author: {name: "Jason Ong", email: "[email protected]"}, | |
license: "GPL", | |
homepage: "", | |
arguments: [{role: "object", nountype: noun_arb_text, label: "class or method"}], | |
preview: function preview(pblock, args) { | |
var helpKeyWords = "class or method"; | |
var searchQuery = args.object.text; | |
var searchText = (searchQuery.length <= 0) ? helpKeyWords : searchQuery; | |
var previewTemplate = "Search rails api for <b><i>${query}</i></b>"; | |
var previewData = {query: searchText}; | |
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
}, | |
execute: function execute(args) { | |
var url = "http://apidock.com/rails/{TERM}"; | |
var urlString = url.replace("{TERM}", args.object.text); | |
Utils.openUrlInBrowser(urlString); | |
} | |
}); | |
CmdUtils.CreateCommand({ | |
names: ["railsdoc"], | |
icon: "http://rubyonrails.org/favicon.ico", | |
description: "View rails documentation", | |
help: "Type a rails class or method.", | |
author: {name: "Jason Ong", email: "[email protected]"}, | |
license: "GPL", | |
homepage: "", | |
arguments: [{role: "object", nountype: noun_arb_text, label: "class or method"}], | |
preview: function preview(pblock, args) { | |
var helpKeyWords = "class or method"; | |
var searchQuery = args.object.text; | |
var searchText = (searchQuery.length <= 0) ? helpKeyWords : searchQuery; | |
var previewTemplate = "Search rails api for <b><i>${query}</i></b>"; | |
var previewData = {query: searchText}; | |
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
}, | |
execute: function execute(args) { | |
var url = "file:///home/jasonong/doc/rails/2.3.2/doc/index.html{TERM}"; | |
var urlString = url.replace("{TERM}", args.object.text); | |
Utils.openUrlInBrowser(urlString); | |
} | |
}); | |
CmdUtils.CreateCommand({ | |
names: ["rubydoc"], | |
icon: "http://www.ruby-lang.org/favicon.ico", | |
description: "View ruby documentation", | |
help: "Type a rails class or method.", | |
author: {name: "Jason Ong", email: "[email protected]"}, | |
license: "GPL", | |
homepage: "", | |
arguments: [{role: "object", nountype: noun_arb_text, label: "class or method"}], | |
preview: function preview(pblock, args) { | |
var helpKeyWords = "class or method"; | |
var searchQuery = args.object.text; | |
var searchText = (searchQuery.length <= 0) ? helpKeyWords : searchQuery; | |
var previewTemplate = "Search rails api for <b><i>${query}</i></b>"; | |
var previewData = {query: searchText}; | |
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
}, | |
execute: function execute(args) { | |
var url = "file:///home/jasonong/doc/ruby-doc-bundle/ProgrammingRuby/index.html{TERM}"; | |
var urlString = url.replace("{TERM}", args.object.text); | |
Utils.openUrlInBrowser(urlString); | |
} | |
}); | |
CmdUtils.CreateCommand({ | |
names: ["shortcuts: firefox"], | |
icon: "http://www.mozilla.com/favicon.ico", | |
description: "c.", | |
help: "Just view it.", | |
author: {name: "Jason Ong", email: "[email protected]"}, | |
license: "GPL", | |
homepage: "", | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
preview: function preview(pblock, args) { | |
var cmd = "" | |
cmd += "CTRL + F = <i>find in this page</i><br/>"; | |
cmd += "/ = <i>find as you type</i><br/>"; | |
cmd += "ESC = <i>hide find tab</i><br/>"; | |
pblock.innerHTML = cmd; | |
}, | |
execute: function execute(args) { | |
//displayMessage("You selected: " + args.object.text, this); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment