summaryrefslogtreecommitdiffstats
path: root/.conkerorrc/init.js
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-10-03 02:48:59 +0200
committerGravatar Tom Willemsen2012-10-03 02:48:59 +0200
commit59a8f44e4d3374f61e8989c648aeb324885afc6b (patch)
tree243f2dde94f4e3bf3bcfe522a8ae583af2ea4f23 /.conkerorrc/init.js
parentb4e8c45e18cec74210e8d3d5c0d46ebcc41e5024 (diff)
downloaddotfiles-59a8f44e4d3374f61e8989c648aeb324885afc6b.tar.gz
dotfiles-59a8f44e4d3374f61e8989c648aeb324885afc6b.zip
.conkerorrc/init.js
Diffstat (limited to '.conkerorrc/init.js')
-rw-r--r--.conkerorrc/init.js88
1 files changed, 88 insertions, 0 deletions
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];