.conkerorrc/init.js

This commit is contained in:
Tom Willemsen 2012-11-27 11:11:34 +01:00
parent c545bedf7f
commit c789688f62

View file

@ -1,10 +1,11 @@
require("content-policy.js"); require("content-policy.js");
require("favicon"); require("favicon");
var linkwave_program = "/home/slash/var/src/linkwave/src/linkwave"; load_paths.push("file:///home/slash/var/src/linkwave/conkeror/");
theme_load_paths.push("/home/slash/.conkerorrc/themes/"); theme_load_paths.push("/home/slash/.conkerorrc/themes/");
require("linkwave");
define_browser_object_class( define_browser_object_class(
"history-url", null, "history-url", null,
function (I, prompt) { function (I, prompt) {
@ -46,53 +47,6 @@ function oni_escape(str) {
return str.replace(/(["$`])/g, '\\$1'); return str.replace(/(["$`])/g, '\\$1');
} }
function oni_linkwave_add(I) {
check_buffer(I.buffer, content_buffer);
let url =
load_spec_uri_string(load_spec(I.buffer.top_frame));
let title = yield I.minibuffer.read(
$prompt = "name (required): ",
$initial_value = I.buffer.title);
// let tags = escape(yield I.minibuffer.read(
// $prompt = "tags (space delimited): "));
let description = yield I.minibuffer.read(
$prompt = "extended description: ");
let command = linkwave_program + ' "' + url + '" "' + title + '" "'
+ description + '"';
let result = yield shell_command(command);
if (!result)
I.window.minibuffer.message('Added to linkwave');
else
I.window.minibuffer.message('Couldn\'t add to linkwave');
}
interactive("linkwave-add", "Bookmark the page in linkwave",
oni_linkwave_add);
function oni_linkwave_add_link(I) {
bo = yield read_browser_object(I);
let url = load_spec_uri_string(
load_spec(encodeURIComponent(bo)));
check_buffer(I.buffer, content_buffer);
let title = yield I.minibuffer.read(
$prompt = "name (required): ",
$initial_value = bo.textContent);
// let tags = escape(yield I.minibuffer.read(
// $prompt = "tags (space delimited): "));
let description = yield I.minibuffer.read(
$prompt = "extended description: ");
let command = linkwave_program + ' "' + url + '" "' + title + '" "'
+ description + '"';
let result = yield shell_command(command);
if (!result)
I.window.minibuffer.message('Added to linkwave');
else
I.window.minibuffer.message('Couldn\'t add to linkwave');
}
interactive("linkwave-add-link", "Bookmark the a link in linkwave",
oni_linkwave_add_link);
function oni_org_store_link(I) { function oni_org_store_link(I) {
var cmd_str = 'emacsclient \"org-protocol://store-link://' var cmd_str = 'emacsclient \"org-protocol://store-link://'
+ encodeURIComponent(I.buffer.display_uri_string) + '/' + encodeURIComponent(I.buffer.display_uri_string) + '/'