Update Conkeror config
This commit is contained in:
parent
f2fd5b1db1
commit
b833a5ce69
4 changed files with 171 additions and 21 deletions
49
conkeror/.conkerorrc/content-delay.js
Normal file
49
conkeror/.conkerorrc/content-delay.js
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
This script is a hack that provides delayed loading for content buffers.
|
||||||
|
The initial url of a buffer will not be loaded until that buffer is
|
||||||
|
switched to. Precaution is taken that the buffer's display_uri_string
|
||||||
|
returns the delayed url, not about:blank, so things like tabs and sessions
|
||||||
|
will still work properly.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
function content_delay (spec) {
|
||||||
|
this.delayed_load = spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
function content_delay_init (b) {
|
||||||
|
if (b != b.window.buffers.current &&
|
||||||
|
b instanceof content_buffer &&
|
||||||
|
b.opener instanceof session_token)
|
||||||
|
{
|
||||||
|
b.load = content_delay;
|
||||||
|
b.__defineGetter__("display_uri_string",
|
||||||
|
function () {
|
||||||
|
if (this.delayed_load) {
|
||||||
|
if (this.delayed_load instanceof load_spec)
|
||||||
|
return load_spec_uri_string(this.delayed_load);
|
||||||
|
return this.delayed_load;
|
||||||
|
}
|
||||||
|
if (this._display_uri)
|
||||||
|
return this._display_uri;
|
||||||
|
if (this.current_uri)
|
||||||
|
return this.current_uri.spec;
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function content_delay_do_initial_load (b) {
|
||||||
|
if (b.hasOwnProperty("load")) {
|
||||||
|
delete b.load;
|
||||||
|
if (b.hasOwnProperty("delayed_load")) {
|
||||||
|
b.load(b.delayed_load);
|
||||||
|
delete b.delayed_load;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
add_hook("create_buffer_early_hook", content_delay_init);
|
||||||
|
|
||||||
|
add_hook("select_buffer_hook", content_delay_do_initial_load);
|
12
conkeror/.conkerorrc/firebug.js
Normal file
12
conkeror/.conkerorrc/firebug.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
define_variable("firebug_url",
|
||||||
|
"http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js");
|
||||||
|
|
||||||
|
function firebug (I) {
|
||||||
|
var doc = I.buffer.document;
|
||||||
|
var script = doc.createElement('script');
|
||||||
|
script.setAttribute('type', 'text/javascript');
|
||||||
|
script.setAttribute('src', firebug_url);
|
||||||
|
script.setAttribute('onload', 'firebug.init();');
|
||||||
|
doc.body.appendChild(script);
|
||||||
|
}
|
||||||
|
interactive("firebug", "open firebug lite", firebug);
|
|
@ -1,17 +1,20 @@
|
||||||
require("content-policy.js");
|
require("content-policy.js");
|
||||||
require("favicon");
|
require("favicon");
|
||||||
require("session");
|
require("session");
|
||||||
|
require("github");
|
||||||
|
require("reddit");
|
||||||
|
|
||||||
load_paths.push("file:///usr/local/clark/share/conkeror/modules/");
|
load_paths.push("file:///usr/local/clark/share/conkeror/modules/");
|
||||||
load_paths.push("file:///home/slash/projects/cdispass/");
|
load_paths.push("file:///home/slash/projects/cdispass/");
|
||||||
load_paths.push("file:///home/slash/.conkerorrc/site-js/");
|
load_paths.push("file:///home/slash/.conkerorrc/site-js/");
|
||||||
load_paths.push("file:///home/slash/.conkerorrc/clark-conkeror/");
|
load_paths.push("file:///home/slash/.conkerorrc/clark-conkeror/");
|
||||||
|
load_paths.push("file:///home/slash/.conkerorrc/page-modes/");
|
||||||
theme_load_paths.push("/home/slash/.conkerorrc/themes/");
|
theme_load_paths.push("/home/slash/.conkerorrc/themes/");
|
||||||
opensearch_load_paths.push(make_file("/home/slash/.conkerorrc/search-engines/"));
|
opensearch_load_paths.push(make_file("/home/slash/.conkerorrc/search-engines/"));
|
||||||
|
|
||||||
require("clark");
|
require("clark");
|
||||||
require("cdispass");
|
require("cdispass");
|
||||||
require("quickdispatch");
|
require("jira");
|
||||||
|
|
||||||
define_browser_object_class(
|
define_browser_object_class(
|
||||||
"history-url", null,
|
"history-url", null,
|
||||||
|
@ -27,16 +30,7 @@ define_browser_object_class(
|
||||||
|
|
||||||
function ext_title_format(window) {
|
function ext_title_format(window) {
|
||||||
return '(' + get_current_profile() +') '
|
return '(' + get_current_profile() +') '
|
||||||
+ window.buffers.current.description;
|
+ window.buffers.current.title;
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
function oni_before_quit_func() {
|
||||||
|
@ -188,13 +182,11 @@ session_auto_save_auto_load = true;
|
||||||
|
|
||||||
define_key(content_buffer_form_keymap, "C-g", "unfocus");
|
define_key(content_buffer_form_keymap, "C-g", "unfocus");
|
||||||
define_key(content_buffer_normal_keymap, "C-x C-b", "switch-to-buffer");
|
define_key(content_buffer_normal_keymap, "C-x C-b", "switch-to-buffer");
|
||||||
define_key(content_buffer_normal_keymap, "C-x C-f", "clark-find-url-new-buffer");
|
|
||||||
define_key(content_buffer_normal_keymap, "C-y", "paste-url-new-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");
|
||||||
define_key(content_buffer_normal_keymap, "b", clark_keymap);
|
define_key(content_buffer_normal_keymap, "b", clark_keymap);
|
||||||
define_key(content_buffer_normal_keymap, "g", "clark-find-url");
|
|
||||||
define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer");
|
define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer");
|
||||||
define_key(content_buffer_text_keymap, "C-c d", "dispass-and-submit");
|
define_key(content_buffer_text_keymap, "C-c d", "dispass");
|
||||||
define_key(default_base_keymap, "C-x f", "follow-new-buffer");
|
define_key(default_base_keymap, "C-x f", "follow-new-buffer");
|
||||||
|
|
||||||
add_hook("before_quit_hook", oni_before_quit_func);
|
add_hook("before_quit_hook", oni_before_quit_func);
|
||||||
|
@ -216,17 +208,26 @@ external_content_handlers.set(
|
||||||
"libreoffice"
|
"libreoffice"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function read_url_duckduckbang_handler(input)
|
||||||
|
{
|
||||||
|
var m = /^!/.test(input);
|
||||||
|
|
||||||
|
if (m)
|
||||||
|
return "https://duckduckgo.com/?q=" + encodeURIComponent(input);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var gh_url = "http://github.com/";
|
var gh_url = "http://github.com/";
|
||||||
function read_url_github_repo_command_handler(input)
|
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);
|
var m = /^gh\s+(\S+\/\S+)(?:\s+(\#\d+|\@\S+|issues|pulls|wiki|graphs|network|admin)(?:\s+(\#\d+|new))?)?$/.exec(input);
|
||||||
|
|
||||||
if (m) {
|
if (m) {
|
||||||
repo_url = gh_url + m[1] + "/";
|
var repo_url = gh_url + m[1] + "/";
|
||||||
|
|
||||||
switch (m[2]) {
|
switch (m[2]) {
|
||||||
case "issues":
|
case "issues":
|
||||||
issues_url = repo_url + m[2] + "/";
|
var issues_url = repo_url + m[2] + "/";
|
||||||
|
|
||||||
if (m[3]) {
|
if (m[3]) {
|
||||||
if (m[3][0] == '#')
|
if (m[3][0] == '#')
|
||||||
|
@ -268,7 +269,7 @@ function read_url_github_command_handler(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
read_url_handler_list = [read_url_github_command_handler,
|
read_url_handler_list = [read_url_github_command_handler,
|
||||||
read_url_qd_handler];
|
read_url_duckduckbang_handler];
|
||||||
|
|
||||||
// Mozrepl
|
// Mozrepl
|
||||||
let (mozrepl_init = get_home_directory()) {
|
let (mozrepl_init = get_home_directory()) {
|
||||||
|
@ -288,7 +289,7 @@ register_user_stylesheet(
|
||||||
escape(
|
escape(
|
||||||
"@namespace url(\"http://www.w3.org/1999/xhtml\");\n" +
|
"@namespace url(\"http://www.w3.org/1999/xhtml\");\n" +
|
||||||
"span.__conkeror_hint {\n" +
|
"span.__conkeror_hint {\n" +
|
||||||
" font-family: \"Envy Code R\" !important;\n" +
|
" font-family: \"Fantasque Sans Mono\" !important;\n" +
|
||||||
" font-size: 12px !important;\n" +
|
" font-size: 12px !important;\n" +
|
||||||
" line-height: 12px !important;\n" +
|
" line-height: 12px !important;\n" +
|
||||||
" padding: 0 2px !important;\n" +
|
" padding: 0 2px !important;\n" +
|
||||||
|
@ -296,6 +297,78 @@ register_user_stylesheet(
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
oni_add_sheet("github.css");
|
interactive("scuttle-post",
|
||||||
oni_add_sheet("help.css");
|
"bookmark the page via scuttle",
|
||||||
oni_add_sheet("git-scm.css");
|
function (I) {
|
||||||
|
check_buffer(I.buffer, content_buffer);
|
||||||
|
let posturl = 'https://ryuslash.org/scuttle/api/posts_add.php?&url=' +
|
||||||
|
encodeURIComponent(
|
||||||
|
load_spec_uri_string(
|
||||||
|
load_spec(I.buffer.top_frame))) +
|
||||||
|
'&description=' +
|
||||||
|
encodeURIComponent(
|
||||||
|
yield I.minibuffer.read(
|
||||||
|
$prompt = "name (required): ",
|
||||||
|
$initial_value = I.buffer.title)) +
|
||||||
|
'&tags=' +
|
||||||
|
encodeURIComponent(
|
||||||
|
yield I.minibuffer.read(
|
||||||
|
$prompt = "tags (space delimited): ")) +
|
||||||
|
'&extended=' +
|
||||||
|
encodeURIComponent(
|
||||||
|
yield I.minibuffer.read(
|
||||||
|
$prompt = "extended description: "));
|
||||||
|
|
||||||
|
try {
|
||||||
|
var content = yield send_http_request(
|
||||||
|
load_spec({uri: posturl}));
|
||||||
|
I.window.minibuffer.message(content.responseText);
|
||||||
|
} catch (e) { }
|
||||||
|
});
|
||||||
|
|
||||||
|
interactive("scuttle-post-link",
|
||||||
|
"bookmark the link via scuttle",
|
||||||
|
function (I) {
|
||||||
|
var bo = yield read_browser_object(I);
|
||||||
|
var mylink = load_spec_uri_string(
|
||||||
|
load_spec(encodeURIComponent(bo)));
|
||||||
|
check_buffer(I.buffer, content_buffer);
|
||||||
|
let postlinkurl = 'https://ryuslash.org/scuttle/api/posts_add.php?&url=' +
|
||||||
|
mylink +
|
||||||
|
'&description=' +
|
||||||
|
encodeURIComponent(
|
||||||
|
yield I.minibuffer.read(
|
||||||
|
$prompt = "name (required): ",
|
||||||
|
$initial_value = bo.textContent)) +
|
||||||
|
'&tags=' +
|
||||||
|
encodeURIComponent(
|
||||||
|
yield I.minibuffer.read(
|
||||||
|
$prompt = "tags (space delimited): ")) +
|
||||||
|
'&extended=' +
|
||||||
|
encodeURIComponent(
|
||||||
|
yield I.minibuffer.read(
|
||||||
|
$prompt = "extended description: "));
|
||||||
|
|
||||||
|
try {
|
||||||
|
var content = yield send_http_request(
|
||||||
|
load_spec({uri: postlinkurl}));
|
||||||
|
I.window.minibuffer.message(content.responseText);
|
||||||
|
} catch (e) { }
|
||||||
|
}, $browser_object = browser_object_links);
|
||||||
|
|
||||||
|
define_key(default_global_keymap, "p", "scuttle-post");
|
||||||
|
define_key(default_global_keymap, "P", "scuttle-post-link");
|
||||||
|
|
||||||
|
// define_webjump("scuttle", "https://ryuslash.org/scuttle/search.php?p=%s&chk=&context=userposts%7Cthomas&fr=del_icio_us&lc=");
|
||||||
|
|
||||||
|
// Bring back the spellchecking!
|
||||||
|
session_pref("layout.spellcheckDefault", 1);
|
||||||
|
|
||||||
|
// Set cookie behaviour to only accept cookies from the originating
|
||||||
|
// server and cookie lifetime to expire at the end of each session.
|
||||||
|
session_pref("network.cookie.cookieBehavior", 1);
|
||||||
|
session_pref("network.cookie.lifetimePolicy", 2);
|
||||||
|
|
||||||
|
// Please don't track me, for whatever that's worth.
|
||||||
|
session_pref("privacy.donottrackheader.enabled", true);
|
||||||
|
session_pref("privacy.donottrackheader.value", 1);
|
||||||
|
|
16
conkeror/.conkerorrc/page-modes/jira.js
Normal file
16
conkeror/.conkerorrc/page-modes/jira.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
define_keymap("jira_keymap", $display_name="jira");
|
||||||
|
|
||||||
|
define_key(jira_keymap, "1", null, $fallthrough);
|
||||||
|
define_key(jira_keymap, "2", null, $fallthrough);
|
||||||
|
define_key(jira_keymap, "3", null, $fallthrough);
|
||||||
|
|
||||||
|
define_keymaps_page_mode("jira-mode",
|
||||||
|
build_url_regexp($domain = /.*\.atlassian/,
|
||||||
|
$tlds=["net"]),
|
||||||
|
{ normal: jira_keymap },
|
||||||
|
$display_name = "Jira",
|
||||||
|
$doc="A page mode for Jira.");
|
||||||
|
|
||||||
|
page_mode_activate(jira_mode);
|
||||||
|
|
||||||
|
provide("jira");
|
Loading…
Reference in a new issue