2010-07-06 20:42:22 +02:00
|
|
|
// -*- mode: javascript -*-
|
|
|
|
require("new-tabs.js");
|
2010-07-06 23:44:38 +02:00
|
|
|
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)
|
|
|
|
{
|
2010-07-13 21:58:17 +02:00
|
|
|
//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);
|
2010-07-06 23:44:38 +02:00
|
|
|
}
|
|
|
|
|
2010-07-13 21:58:17 +02:00
|
|
|
add_hook("window_initialize_late_hook", test);
|
2010-07-06 23:44:38 +02:00
|
|
|
|
|
|
|
// VARIABLES
|
|
|
|
// Make middle mouse button open new tab in background
|
|
|
|
clicks_in_new_buffer_target = OPEN_NEW_BUFFER_BACKGROUND;
|
|
|
|
|
|
|
|
// WEBJUMPS
|
|
|
|
define_webjump("delicious",
|
2010-07-13 21:58:17 +02:00
|
|
|
"http://delicious.com/search?p=linux&lc=0&context=userposts%7Cslashed%7C&replace=no",
|
2010-07-06 23:44:38 +02:00
|
|
|
$alternative="http://delicious.com/slashed");
|
|
|
|
define_webjump("gmail",
|
|
|
|
"https://mail.google.com/mail/#search/%s");
|
|
|
|
define_webjump("greader",
|
2010-07-13 21:58:17 +02:00
|
|
|
"http://www.google.com/reader/view/#search/%s/",
|
|
|
|
$alternative="http://reader.google.com");
|
2010-07-06 23:44:38 +02:00
|
|
|
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");
|
2010-07-13 21:58:17 +02:00
|
|
|
define_webjump("metal-archives",
|
|
|
|
"http://www.metal-archives.com/search.php?string=%s&type=band");
|
2010-07-06 23:44:38 +02:00
|
|
|
|
|
|
|
// 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: "));
|
|
|
|
|
|
|
|
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: "));
|
|
|
|
|
|
|
|
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");
|