legacy-dotfiles/.conkerorrc
2010-07-13 22:02:52 +02:00

120 lines
No EOL
4.6 KiB
JavaScript

// -*- mode: javascript -*-
require("new-tabs.js");
require("clicks-in-new-buffer.js");
// STYLE
/*let (sheet = get_home_directory()) {
sheet.append(".conkerorrc.d");
sheet.append("stylesheets");
sheet.append("tabs.css");
register_user_stylesheet(make_uri(sheet));
}
function test(window)
{
//var test = window.getElementsByAttribute("id", "tab2-bar");
//if (test.length > 0)
// window.removeChild(test);
//else
// window.minibuffer.message("no luck");
var after = window.document.getElementById("minibuffer");
var testtab = window.document.getElementById("tab2-bar");
window["minibuffer"].message("I'm different!");
window.tab_bar.destroy();
delete window.tab_bar;
window.tab_bar = testtab;
after.parentNode.insertBefore(testtab, after);
}
add_hook("window_initialize_late_hook", test);*/
// VARIABLES
// Make middle mouse button open new tab in background
clicks_in_new_buffer_target = OPEN_NEW_BUFFER_BACKGROUND;
// WEBJUMPS
define_webjump("delicious",
"http://delicious.com/search?p=%s&lc=0&context=userposts%7Cslashed%7C",
$alternative="http://delicious.com/slashed");
define_webjump("gmail",
"https://mail.google.com/mail/#search/%s");
define_webjump("greader",
"http://www.google.com/reader/view/#search/%s/",
$alternative="http://reader.google.com");
define_webjump("github",
"http://github.com/search?q=%s",
$alternative="http://github.com/ryuslash/");
define_webjump("archwiki",
"http://wiki.archlinux.org/index.php?search=%s");
define_webjump("fedorawiki",
"https://fedoraproject.org/wiki/search=%s");
define_webjump("metal-archives",
"http://www.metal-archives.com/search.php?string=%s&type=band");
// FUNCTIONS
interactive("delicious-post",
"bookmark the page via delicious",
function (I) {
check_buffer(I.buffer, content_buffer);
let posturl = 'https://api.del.icio.us/v1/posts/add?&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: ")) +
"&replace=no";
try {
var content = yield send_http_request(
load_spec({uri: posturl}));
I.window.minibuffer.message(content.responseText);
} catch (e) { }
});
interactive("delicious-post-link",
"bookmar the link via delicious",
function (I) {
bo = yield read_browser_object(I);
mylink = load_spec_uri_string(
load_spec(encodeURIComponent(bo)));
check_buffer(I.buffer, content_buffer);
let postlinkurl = "https://api.del.icio.us/v1/posts/add?&yrl=" +
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: ")) +
"&replace=no";
try {
var content = yield send_http_request(
load_spec({uri: postlinkurl}));
I.window.minibuffer.message(content.responseText);
} catch (e) { }
}, $browser_object = browser_object_links);
// KEYMAPPINGS
define_key(default_global_keymap, "p", "delicious-post");
define_key(default_global_keymap, "P", "delicious-post-link");