diff options
Diffstat (limited to '.conkerorrc')
-rw-r--r-- | .conkerorrc/Makefile | 4 | ||||
-rw-r--r-- | .conkerorrc/ext_restore.js | 33 | ||||
-rw-r--r-- | .conkerorrc/init.js | 85 | ||||
-rw-r--r-- | .conkerorrc/styles/Makefile | 4 | ||||
-rw-r--r-- | .conkerorrc/styles/github.css | 161 | ||||
-rw-r--r-- | .conkerorrc/styles/help.css | 19 |
6 files changed, 295 insertions, 11 deletions
diff --git a/.conkerorrc/Makefile b/.conkerorrc/Makefile index d2bc0db..8161f39 100644 --- a/.conkerorrc/Makefile +++ b/.conkerorrc/Makefile @@ -1,5 +1,5 @@ DESTDIR:=$(DESTDIR)/.conkerorrc -modules=themes -objects=gtk2rc init.js +modules=themes styles +objects=gtk2rc init.js ext_restore.js include ../dotfiles.mk diff --git a/.conkerorrc/ext_restore.js b/.conkerorrc/ext_restore.js new file mode 100644 index 0000000..39b125e --- /dev/null +++ b/.conkerorrc/ext_restore.js @@ -0,0 +1,33 @@ +/// From http://conkeror.org/Tips#Restore_Killed_Buffer_Url +// I think by the time kill_buffer_hook runs the buffer is gone so I +// patch kill_buffer + +var kill_buffer_original = kill_buffer_original || kill_buffer; + +var killed_buffer_urls = []; + +kill_buffer = function (buffer, force) { + if (buffer.display_uri_string) { + killed_buffer_urls.push(buffer.display_uri_string); + } + + kill_buffer_original(buffer,force); +}; + +interactive("restore-killed-buffer-url", "Loads url from a previously killed buffer", + function restore_killed_buffer_url (I) { + if (killed_buffer_urls.length !== 0) { + var url = yield I.minibuffer.read( + $prompt = "Restore killed url:", + $completer = all_word_completer($completions = killed_buffer_urls), + $default_completion = killed_buffer_urls[killed_buffer_urls.length - 1], + $auto_complete = "url", + $auto_complete_initial = true, + $auto_complete_delay = 0, + $match_required); + + load_url_in_new_buffer(url); + } else { + I.window.minibuffer.message("No killed buffer urls"); + } + }); diff --git a/.conkerorrc/init.js b/.conkerorrc/init.js index 6594523..157f125 100644 --- a/.conkerorrc/init.js +++ b/.conkerorrc/init.js @@ -1,10 +1,10 @@ require("content-policy.js"); require("favicon"); -load_paths.push("file:///home/slash/var/src/linkwave/conkeror/"); +load_paths.push("file:///home/slash/projects/markam/conkeror/"); theme_load_paths.push("/home/slash/.conkerorrc/themes/"); -require("linkwave"); +require("markam"); define_browser_object_class( "history-url", null, @@ -23,6 +23,15 @@ function ext_title_format(window) { + window.buffers.current.description; } +function oni_add_sheet(css) { + let (sheet = get_home_directory()) { + sheet.append(".conkerorrc"); + sheet.append("styles"); + sheet.append(css); + register_user_stylesheet(make_uri(sheet)); + }; +} + function oni_before_quit_func() { var w = get_recent_conkeror_window(); var result = (w == null) || @@ -112,18 +121,43 @@ define_webjump("arch/packages", "https://www.archlinux.org/packages/?sort=&q=%s&limit=50", $alternative="https://packages.archlinux.org"); +/// Chickadee +// From http://conkeror.org/Webjumps +function chickadee_completer (input, cursor_position, conservative) { + var completions = []; + var content = yield send_http_request( + load_spec({uri: "http://api.call-cc.org/cdoc/ajax/prefix?q="+ + encodeURIComponent(input)})); + if (content.responseText) { + var parser = Cc["@mozilla.org/xmlextras/domparser;1"] + .createInstance(Ci.nsIDOMParser); + var doc = parser.parseFromString(content.responseText, "text/xml"); + var res = doc.getElementsByTagName("li"); + for (let i = 0, n = res.length; i < n; ++i) { + completions.push(res[i].textContent); + } + } + yield co_return(prefix_completer($completions = completions) + (input, cursor_position, conservative)); +} +define_webjump("chickadee", + "http://api.call-cc.org/cdoc?q=%s&query-name=Lookup", + $alternative = "http://api.call-cc.org/doc/", + $completer = chickadee_completer); +/// /Chickadee + // content_policy_bytype_table.object = oni_block_flash; cwd = make_file("/home/slash/downloads/"); hint_digits = "arstdhneio"; read_buffer_show_icons = true; title_format_fn = ext_title_format; url_remoting_fn = load_url_in_new_buffer; +markam_program = "/home/slash/projects/markam/src/markam"; -define_key(content_buffer_normal_keymap, "h", - "find-url-from-history-new-buffer"); -define_key(content_buffer_normal_keymap, "H", - "find-url-from-history"); define_key(content_buffer_normal_keymap, "C-x C-b", "switch-to-buffer"); +define_key(content_buffer_normal_keymap, "C-y", "paste-url-new-buffer"); +define_key(content_buffer_normal_keymap, "H", "find-url-from-history"); +define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer"); define_key(default_base_keymap, "C-x f", "follow-new-buffer"); add_hook("before_quit_hook", oni_before_quit_func); @@ -227,14 +261,47 @@ function read_url_github_command_handler(input) function read_url_local_port_handler(input) { - var m = /^lh (\d{1,5})$/.exec(input); + var m = /^lh (\d{1,5})(?:\s+([a-zA-Z0-9%/]+))?$/.exec(input), + rv = null; if (m) { - return "http://localhost:" + m[1]; + rv = "http://localhost:" + m[1]; + + if (m[2]) + rv += "/" + m[2]; } - return null; + return rv; } read_url_handler_list = [read_url_local_port_handler, read_url_github_command_handler]; + +// Mozrepl +let (mozrepl_init = get_home_directory()) { + mozrepl_init.appendRelativePath(".mozrepl-conkeror.js"); + session_pref('extensions.mozrepl.initUrl', make_uri(mozrepl_init).spec); +}; + +if ('@hyperstruct.net/mozlab/mozrepl;1' in Cc) { + let mozrepl = Cc['@hyperstruct.net/mozlab/mozrepl;1'] + .getService(Ci.nsIMozRepl); + if (!mozrepl.isActive()) + mozrepl.start(4242); +} + +register_user_stylesheet( + "data:text/css," + + escape( + "@namespace url(\"http://www.w3.org/1999/xhtml\");\n" + + "span.__conkeror_hint {\n" + + " font-family: \"Envy Code R\" !important;\n" + + " font-size: 12px !important;\n" + + " line-height: 12px !important;\n" + + " padding: 0 2px !important;\n" + + "}" + ) +); + +oni_add_sheet("github.css"); +oni_add_sheet("help.css"); diff --git a/.conkerorrc/styles/Makefile b/.conkerorrc/styles/Makefile new file mode 100644 index 0000000..fb44500 --- /dev/null +++ b/.conkerorrc/styles/Makefile @@ -0,0 +1,4 @@ +DESTDIR:=$(DESTDIR)/styles +objects=github.css help.css + +include ../../dotfiles.mk diff --git a/.conkerorrc/styles/github.css b/.conkerorrc/styles/github.css new file mode 100644 index 0000000..ff3a643 --- /dev/null +++ b/.conkerorrc/styles/github.css @@ -0,0 +1,161 @@ +@-moz-document url(https://github.com/), url(https://github.com/dashboard) { + #dashboard .filter-bar { + background: #222224 !important; + border-bottom: none !important; + } + + #dashboard .filter-bar li a.filter_selected { + color: #eeeeec !important; + } + + #dashboard .repos { + border: none !important; + background-color: #171719 !important; + } + + #dashboard .repos .bottom-bar { + background-color: #222224 !important; + } + + #dashboard .repos .top-bar { + background: #222224 !important; + border-bottom: none !important; + } + + #dashboard .repos h2 { + color: inherit !important; + } + + #dashboard ul.repo_list li.private { + background: #222224 !important; + } + + #dashboard ul.repo_list li a { + border-width: 0 !important; + } + + #footer { + text-shadow: none !important; + } + + .button .minibutton { + background: #171719 !important; + } + + .header { + background: #222224 !important; + color: #eeeeec !important; + border-bottom: none !important; + text-shadow: none !important; + } + + .header .divider-vertical { + background: #222224 !important; + border-right: none !important; + } + + .header .top-nav a { + color: #eeeeec !important; + } + + .header .topsearch a#advanced_search { + color: #eeeeec !important; + } + + .header #user-links a { + color: #eeeeec !important; + } + + .markdown-body code, + .markdown-body tt { + background-color: #222224 !important; + border: none !important; + color: #eeeeec !important; + font-family: "Envy Code R" !important; + } + + .minibutton.dark-grey { + background: #171719 !important;o + } + + .news .alert { + border-top: none !important; + } + + .news .alert .branch-link, + .news .alert .pull-info { + background: #222224 !important; + color: #eeeeec !important; + } + + .news .alert .gravatar { + background: none !important; + } + + .news .alert .simple .title { + color: #eeeeec !important; + } + + .news .commits li img { + background: none !important; + } + + .news blockquote { + color: #eeeeec !important; + } + + .pagehead .container > ul.tabs { + background: #171719 !important; + border: none !important; + } + + .pagehead .container > ul.tabs li a { + text-shadow: none !important; + border: none !important; + } + + .pagehead .container > ul.tabs li a:hover { + background: #222224 !important; + } + + .pagehead .container > ul.tabs li a.selected { + background: #222224 !important; + } + + .pagehead-actions a.feed { + background: #222224 !important; + border: none !important; + } + + .pagination { + background: #171719 !important; + border: none !important; + } + + .pagination a { + text-shadow: none !important; + border-bottom: none !important; + } + + .pagination a:hover { + background: #222224 !important; + } + + a { + color: #ffbb56 !important; + } + + a:visited { + color: #ee82ee !important; + } + + a.header-logo-blacktocat, + a.header-logo-blacktocat:visited { + color: #eeeeec !important; + } + + body { + background-color: #111113 !important; + color: #eeeeec !important; + } +} diff --git a/.conkerorrc/styles/help.css b/.conkerorrc/styles/help.css new file mode 100644 index 0000000..03888b6 --- /dev/null +++ b/.conkerorrc/styles/help.css @@ -0,0 +1,19 @@ +@-moz-document url(chrome://conkeror-help/content/help.html) { + body { + background: #111113 !important; + color: #eeeeec !important; + } + + a { + color: #ffbb56 !important; + } + + a:visited { + color: #ee82ee !important; + } + + pre, .key { + background: #222224 !important; + font-family: "Envy Code R" !important; + } +} |