diff options
| author | 2012-12-28 20:24:20 +0100 | |
|---|---|---|
| committer | 2012-12-28 20:24:20 +0100 | |
| commit | 5535308fffdd58ac17937d676c096fe889acb77e (patch) | |
| tree | 9cbebf6655a102cf3fa02acbf92fdbc30d8da74d /conkeror | |
| parent | 57f06ec8c977d9011b2692f20c7d5967c7d2a0cc (diff) | |
| download | markam-5535308fffdd58ac17937d676c096fe889acb77e.tar.gz markam-5535308fffdd58ac17937d676c096fe889acb77e.zip | |
Restructure
Put all source files in `src/' and add the `conkeror/' directory from
the old project.
Diffstat (limited to 'conkeror')
| -rw-r--r-- | conkeror/linkwave.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/conkeror/linkwave.js b/conkeror/linkwave.js new file mode 100644 index 0000000..8ac3a52 --- /dev/null +++ b/conkeror/linkwave.js @@ -0,0 +1,52 @@ +define_variable("linkwave_program", "/home/slash/projects/nlinkwave/src/linkwave", + "The location of the linkwave executable."); + +function linkwave_add_url(I, url, title) +{ + let url_string = load_spec_uri_string(load_spec(url)); + let title = yield I.minibuffer.read($prompt="name (required): ", + $initial_value=title); + let description = yield I.minibuffer.read( + $prompt="extended description: " + ); + let tags = yield I.minibuffer.read( + $prompt="tags (comma delimited): " + ); + let command = linkwave_program + ' "' + url_string + '" "' + title + + '" "' + description + '" \'' + + tags.split(',').map(function (str) + { return str.trim(); }).join("' '") + + "'"; + yield shell_command(command); +} + +function linkwave_add(I) { + check_buffer(I.buffer, content_buffer); + let result = yield linkwave_add_url(I, I.buffer.top_frame, + I.buffer.title); + + if (!result) + I.window.minibuffer.message('Added to linkwave'); + else + I.window.minibuffer.message('Couldn\'t add to linkwave'); +} +interactive("linkwave-add", + "Bookmark a page in linkwave", + linkwave_add); + +function linkwave_add_link(I) { + check_buffer(I.buffer, content_buffer); + bo = yield read_browser_object(I); + let result = yield linkwave_add_url(I, encodeURIComponent(bo), + bo.textContent); + + if (!result) + I.window.minibuffer.message('Added to linkwave'); + else + I.window.minibuffer.message('Couldn\'t add to linkwave'); +} +interactive("linkwave-add-link", + "Bookmark a link in linkwave", + linkwave_add_link); + +provide("linkwave"); |
