From 5134421f281c7de1729a8e187d267395be331342 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 28 Sep 2012 10:40:07 +0200 Subject: .conkerorrc/init.js --- .conkerorrc/init.js | 3 +++ 1 file changed, 3 insertions(+) (limited to '.conkerorrc/init.js') diff --git a/.conkerorrc/init.js b/.conkerorrc/init.js index d8305af..e8af74e 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", -- cgit v1.2.3-54-g00ecf From 59a8f44e4d3374f61e8989c648aeb324885afc6b Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 3 Oct 2012 02:48:59 +0200 Subject: .conkerorrc/init.js --- .conkerorrc/init.js | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) (limited to '.conkerorrc/init.js') diff --git a/.conkerorrc/init.js b/.conkerorrc/init.js index e8af74e..3d247ba 100644 --- a/.conkerorrc/init.js +++ b/.conkerorrc/init.js @@ -167,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]; -- cgit v1.2.3-54-g00ecf