From 9606bcd4adda1face76e946515405a4670fc25f3 Mon Sep 17 00:00:00 2001 From: suVene Date: Tue, 6 Jan 2009 16:09:15 +0000 Subject: * sticky_keywords を Regexp(keyword, 'i') で比較。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@28057 d0d07461-0603-4401-acd4-de1884942a52 --- notifier/observer_growl.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'notifier') diff --git a/notifier/observer_growl.js b/notifier/observer_growl.js index a10f2e3..d8c60c1 100644 --- a/notifier/observer_growl.js +++ b/notifier/observer_growl.js @@ -11,7 +11,7 @@ var PLUGIN_INFO = notification from the subjects is notified to you by the Growl style. Growl風通知。 suVene - 0.1.6 + 0.1.7 MIT 2.0pre 2.0pre @@ -70,6 +70,8 @@ Growl.prototype = { this.node = node; this.created = new Date(); this.options = $U.extend(this.defaults, (options || {})); + this.sticky_keywords_exp = + this.options.sticky_keywords.map(function(k) new RegExp(k, 'i')); this.message = message; var div = node.getElementsByTagName('div'); div[0].addEventListener('click', $U.bind(this, this.remove), false); @@ -186,7 +188,7 @@ notifier.observer.register(notifier.Observer, { var text = growl.message.title + ' ' + growl.message.message.replace(/(?:<[^>]*>)+/g, ''); - if (growl.options.sticky_keywords.some(function(k) text.indexOf(k) > -1) || + if (growl.sticky_keywords_exp.some(function(k) text.match(k)) || growl.created.getTime() + growl.options.life * 1000 > new Date().getTime()) return false; -- cgit v1.2.3