diff options
author | suVene | 2008-12-15 16:51:03 +0000 |
---|---|---|
committer | suVene | 2008-12-15 16:51:03 +0000 |
commit | 8860ec5b9f362284b66a2abbefe7071bf756c768 (patch) | |
tree | 604bf1c039220b333621c107518b1c83f15a4f0f /notifier/subject_hatelabo_bottle.js | |
parent | 28f7f11fdca052b4cfd8fb3d6628dd9b5e95b201 (diff) | |
download | vimperator-plugins-8860ec5b9f362284b66a2abbefe7071bf756c768.tar.bz2 |
* growl.css - add head link style.
* observer_growl.js - add hyperlink.mod default life 10 seconds.
* subject_hatelabo_bottle.js - parse permalink.
* notifier.js - follow pluginManager.etc.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26822 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'notifier/subject_hatelabo_bottle.js')
-rw-r--r-- | notifier/subject_hatelabo_bottle.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/notifier/subject_hatelabo_bottle.js b/notifier/subject_hatelabo_bottle.js index 2335cad..71a5a27 100644 --- a/notifier/subject_hatelabo_bottle.js +++ b/notifier/subject_hatelabo_bottle.js @@ -1,7 +1,7 @@ // PLUGIN_INFO//{{{ var PLUGIN_INFO = <VimperatorPlugin> - <name>{name}</name> + <name>{NAME}</name> <description>notifies if hatena bottle was changed.</description> <description lang="ja">はてなボトルの変更通知。</description> <author mail="suvene@zeromemory.info" homepage="http://zeromemory.sblo.jp/">suVene</author> @@ -32,18 +32,21 @@ notifier.subject.register(notifier.SubjectHttp, { logger.log('preInitialize: '); }, parse: function(res) { - // if (this.count == 0) return []; for debug - if (!res.isSuccess() || res.responseText == '') return null; - return res.getHTMLDocument('id("body")//div[contains(concat(" ", @class, " "), " entry ")]'); + // if (this.count == 0) return []; // for debug + var doc = res.getHTMLDocument('id("body")//div[contains(concat(" ", @class, " "), " entry ")]'); + return doc; }, diff: function(cache, parsed) parsed.filter(function(element) !cache.some(function(c) c.textContent == element.textContent)), - buildMessages: function(diff) - diff.map(function(d) - new notifier.Message('Hatelab bottle', $U.xmlSerialize(d), { - growl: { life: 7000 } - })) + buildMessages: function(diff) { + return diff.map($U.bind(this, function(d) { + var permalink = $U.getNodesFromXPath('descendant::a[@class="hatena-star-uri"]', d); + if (permalink.length > 0) + permalink = URL + permalink[0]; + return new notifier.Message('Hatelab bottle', $U.xmlSerialize(d), permalink) + })); + } }); })(); |