diff options
author | otsune | 2008-04-07 19:46:50 +0000 |
---|---|---|
committer | otsune | 2008-04-07 19:46:50 +0000 |
commit | 231fbdaab8a83f39c2b1b224349ba23af4774c5e (patch) | |
tree | 5a7d36dd8b140515f726628091081c7ce3926c53 | |
parent | c136485e4e0b2052719fe24cda688891e01130dd (diff) | |
download | vimperator-plugins-231fbdaab8a83f39c2b1b224349ba23af4774c5e.tar.bz2 |
vimperator-plugins/pukka.js: Add detect rel="bookmark"
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@9109 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | pukka.js | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -3,7 +3,7 @@ * Add `pukka' http://codesorcery.net/pukka/ command to Bookmark del.icio.us * For liberator 0.6pre * @author otsune (based on teramako) - * @version 0.2 + * @version 0.3 * * Variable: * g:pukka_normalizelink @@ -20,7 +20,7 @@ */ (function(){ - var useNormalizelink = liberator.globalVariables.pukka_normalizelink || false; + var useNormalizelink = liberator.globalVariables.pukka_normalizelink || true; liberator.commands.addUserCommand(['pukka','pu'], 'Post to Pukka bookmark', function(args){ if (!liberator.buffer.title || !liberator.buffer.URL || liberator.buffer.URL=='about:blank'){ @@ -37,10 +37,23 @@ function(args){ },{ completer: function(filter){ var complist = []; + + complist.push([liberator.buffer.URL, 'Raw URL: ' + liberator.buffer.title]); + if(useNormalizelink){ complist.push([getNormalizedPermalink(liberator.buffer.URL), 'Normalized URL: ' + liberator.buffer.title]); } - complist.push([liberator.buffer.URL, 'Raw URL: ' + liberator.buffer.title]); + + // detect rel="bookmark" + var elem; + var relb = liberator.buffer.evaluateXPath( +// '//*[@rel="bookmark"]', + '//*[contains(concat(" ", normalize-space(@rel), " "), " bookmark ")]', + null, null, true); + while ((elem = relb.iterateNext()) !== null) { + complist.push([elem.toString(), '@rel="bookmark" URL: ' + elem]); + } + return [0, complist]; } } |