From 8860ec5b9f362284b66a2abbefe7071bf756c768 Mon Sep 17 00:00:00 2001
From: suVene
Date: Mon, 15 Dec 2008 16:51:03 +0000
Subject: * 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
---
notifier/growl.css | 11 ++++++++---
notifier/observer_growl.js | 21 ++++++++++++++-------
notifier/subject_hatelabo_bottle.js | 21 ++++++++++++---------
3 files changed, 34 insertions(+), 19 deletions(-)
(limited to 'notifier')
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 =
- {name}
+ {NAME}
notification from the subjects is notified to you by the Growl style.
Growl風通知。
suVene
- 0.1.0
+ 0.1.1
2.0pre
2.0pre
;
@@ -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(
, doc));
+ doc.body.appendChild($U.xmlToDom(, 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 =
×
-
+
{new XMLList(message.message || '')}
;
- 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 =
- {name}
+ {NAME}
notifies if hatena bottle was changed.
はてなボトルの変更通知。
suVene
@@ -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)
+ }));
+ }
});
})();
--
cgit v1.2.3