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 | |
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')
-rw-r--r-- | notifier/growl.css | 11 | ||||
-rw-r--r-- | notifier/observer_growl.js | 21 | ||||
-rw-r--r-- | notifier/subject_hatelabo_bottle.js | 21 |
3 files changed, 34 insertions, 19 deletions
diff --git a/notifier/growl.css b/notifier/growl.css index 5cbd9ed..0912af4 100644 --- a/notifier/growl.css +++ b/notifier/growl.css @@ -45,8 +45,6 @@ div.observer_growl div.observer_growl_notification, div.observer_growl div.obser background-color: #000; color: #fff; opacity: .85; - filter: alpha(opacity = 85); - zoom: 1; width: 235px; padding: 10px; margin-top: 5px; @@ -56,7 +54,6 @@ div.observer_growl div.observer_growl_notification, div.observer_growl div.obser text-align: left; display: none; -moz-border-radius: 5px; - -webkit-border-radius: 5px; } div.observer_growl div.observer_growl_notification { @@ -68,6 +65,14 @@ div.observer_growl div.observer_growl_notification div.header { font-size: 10px; } +div.observer_growl div.observer_growl_notification div.header a:link { + color: #EF6D29; +} + +div.observer_growl div.observer_growl_notification div.header a:hover { + color: #A50000; +} + div.observer_growl div.observer_growl_notification div.close { float: right; font-weight: bold; diff --git a/notifier/observer_growl.js b/notifier/observer_growl.js index 8f973c6..9fb8f88 100644 --- a/notifier/observer_growl.js +++ b/notifier/observer_growl.js @@ -1,11 +1,11 @@ // PLUGIN_INFO//{{{ var PLUGIN_INFO = <VimperatorPlugin> - <name>{name}</name> + <name>{NAME}</name> <description>notification from the subjects is notified to you by the Growl style.</description> <description lang="ja">Growl風通知。</description> <author mail="suvene@zeromemory.info" homepage="http://zeromemory.sblo.jp/">suVene</author> - <version>0.1.0</version> + <version>0.1.1</version> <minVersion>2.0pre</minVersion> <maxVersion>2.0pre</maxVersion> </VimperatorPlugin>; @@ -24,7 +24,7 @@ var Growl = function() {//{{{ }; Growl.prototype = { defaults: { - life: 5000 + life: 10000 }, initialize: function(dom, container, options) { this.dom = dom; @@ -62,12 +62,13 @@ notifier.observer.register(notifier.Observer, { var doc = window.content.document; var container = doc.getElementById("observer_growl"); if (!container) { - doc.body.appendChild(util.xmlToDom(<div id="observer_growl" class="observer_growl top-right"/>, doc)); + doc.body.appendChild($U.xmlToDom(<div id="observer_growl" class="observer_growl top-right"/>, doc)); container = doc.getElementById("observer_growl"); } var notification = this.createPopup(message, doc, container); // TODO: animation!!! + var node = doc.importNode(notification, true); container.appendChild(notification); if (container.childNodes.length == 1) { @@ -82,11 +83,17 @@ notifier.observer.register(notifier.Observer, { var html = <div class="observer_growl_notification" style="display: block;"> <div class="close">×</div> - <div class="header">{new XMLList(this.count + ': ' + message.title)}</div> + <div class="header">{new XMLList( + (message.link ? '<a href="' + message.link + '">' : '') + + this.count + ': ' + message.title + + (message.link ? '</a>' : '') + )}</div> <div class="message">{new XMLList(message.message || '')}</div> </div>; - dom = util.xmlToDom(html, doc, nodes); - dom.__data__ = new Growl(dom, nodes, message.options.growl); + dom = $U.xmlToDom(html, doc, nodes); + // TODO: get settings + var options = {}; + dom.__data__ = new Growl(dom, nodes, {}); return dom; }, checkStatus: function() { 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) + })); + } }); })(); |