summaryrefslogtreecommitdiffstats
path: root/.conkerorrc/init.js
diff options
context:
space:
mode:
Diffstat (limited to '.conkerorrc/init.js')
-rw-r--r--.conkerorrc/init.js91
1 files changed, 91 insertions, 0 deletions
diff --git a/.conkerorrc/init.js b/.conkerorrc/init.js
index d8305af..3d247ba 100644
--- a/.conkerorrc/init.js
+++ b/.conkerorrc/init.js
@@ -131,6 +131,9 @@ define_webjump("google",
define_webjump("github",
"https://github.com/search?q=%s&type=Everything&repo=&langOverride=&start_value=1",
$alternative="https://github.com");
+define_webjump("mdn",
+ "https://developer.mozilla.org/en-US/search?q=%s",
+ $alternative="https://developer.mozilla.org/");
// Archlinux
define_webjump("arch/wiki",
"https://wiki.archlinux.org/index.php?search=%s",
@@ -164,3 +167,91 @@ remove_hook("download_added_hook", open_download_buffer_automatically);
hints_minibuffer_annotation_mode(true);
theme_load("naquadah");
+
+var gh_url = "http://github.com/";
+function read_url_github_ad_command_handler(input)
+{
+ var m = /^gh\s+@(\S+)(?:\s+((?:un)?follow))?/.exec(input);
+ if (m) {
+ if (m[2])
+ return gh_url + "users/follow?target=";
+ return gh_url + m[1];
+ }
+
+ return null;
+}
+
+function read_url_github_my_command_handler(input)
+{
+ var m = /^gh\s+my\s+(dashboard|issues|notifications|profile|pulls|stars)/.exec(input);
+
+ if (m) {
+ switch (m[1]) {
+ case "dashboard":
+ case "notifications":
+ case "stars":
+ return gh_url + m[1];
+ case "issues":
+ case "pulls":
+ return gh_url + "dashboard/" + m[1];
+ case "profile":
+ return gh_url + "settings/" + m[1];
+ }
+ }
+
+ return null;
+}
+
+function read_url_github_repo_command_handler(input)
+{
+ var m = /^gh\s+(\S+\/\S+)(?:\s+(\#\d+|\@\S+|issues|pulls|wiki|graphs|network|admin)(?:\s+(\#\d+|new))?)?$/.exec(input);
+
+ if (m) {
+ repo_url = gh_url + m[1] + "/";
+
+ switch (m[2]) {
+ case "issues":
+ issues_url = repo_url + m[2] + "/";
+
+ if (m[3]) {
+ if (m[3][0] == '#')
+ return issues_url + m[3].substring(1);
+ else if (m[3] == "new")
+ return issues_url + m[3];
+ else
+ break;
+ }
+
+ return issues_url;
+ case "pulls":
+ case "wiki":
+ case "graphs":
+ case "network":
+ case "admin":
+ return repo_url + m[2];
+ default:
+ // Still need watch and unwatch
+ if (m[2]) {
+ if (m[2][0] == '#')
+ return repo_url + "issues/" + m[2].substring(1);
+ else if (m[2][0] == '@')
+ return repo_url + "tree/" + m[2].substring(1);
+ else
+ break;
+ }
+
+ return repo_url;
+ }
+ }
+
+ return null;
+}
+
+function read_url_github_command_handler(input)
+{
+ return read_url_github_ad_command_handler(input)
+ || read_url_github_my_command_handler(input)
+ || read_url_github_repo_command_handler(input);
+}
+
+read_url_handler_list = [read_url_github_command_handler];