diff options
author | anekos | 2011-12-30 02:22:40 +0900 |
---|---|---|
committer | anekos | 2011-12-30 02:25:00 +0900 |
commit | 065347257e4fd7f9d29723247724abf04dc8f855 (patch) | |
tree | 7f56396f54beb8312adf7f56d0bad6b82ccfa3ed | |
parent | c7df1928de3c2adaf061530712aea329b65058fa (diff) | |
download | vimperator-plugins-065347257e4fd7f9d29723247724abf04dc8f855.tar.bz2 |
設定に dontStop を追加
サイドバーを閉じてもツイートを確保するようにした
-rwxr-xr-x | twittperator/twsidebar.tw | 28 | ||||
-rw-r--r-- | twittperator/twsidebar/chrome/content/twsidebar.xul | 4 |
2 files changed, 27 insertions, 5 deletions
diff --git a/twittperator/twsidebar.tw b/twittperator/twsidebar.tw index f6af3af..c34867c 100755 --- a/twittperator/twsidebar.tw +++ b/twittperator/twsidebar.tw @@ -43,6 +43,9 @@ liberator.modules.TWAnekoSB = ANekoSB = (function () { // 地震ツイートの本文に場所をくっつける earthquake: true, + + // サイドバーを閉じても機能を停止しない + dontStop: true }; // 日本語判定 @@ -202,6 +205,9 @@ liberator.modules.TWAnekoSB = ANekoSB = (function () { Tweets.splice(Config.listMax); } + if (sidebarClosed) + return; + let screenName = Config.screenName; let my = (msg.retweeted_status && msg.retweeted_status.user.screen_name === screenName) || @@ -466,6 +472,7 @@ liberator.modules.TWAnekoSB = ANekoSB = (function () { let Store = storage.newMap("twittperator-anekos-sb", {store: true}); let started = false; let readyToStart = false; + let sidebarClosed = false; let Tweets = __context__.Tweets; if (!Tweets) @@ -473,7 +480,17 @@ liberator.modules.TWAnekoSB = ANekoSB = (function () { let added = {}; - function start () { // {{{ + function start (isOpen) { // {{{ + function restore () { + Array.slice(Tweets).reverse().forEach(makeOnMsg(false)); + } + + if (isOpen && sidebarClosed) { + sidebarClosed = false; + restore(); + return; + } + if (readyToStart) return; if (started) @@ -484,7 +501,7 @@ liberator.modules.TWAnekoSB = ANekoSB = (function () { setTimeout( function () { readyToStart = false; - Array.slice(Tweets).reverse().forEach(makeOnMsg(false)); + restore(); plugins.twittperator.ChirpUserStream.addListener(added.chirp = makeOnMsg(true, 'chirp')); plugins.twittperator.TrackingStream.addListener(added.filter = makeOnMsg(true, 'filter')); }, @@ -492,10 +509,15 @@ liberator.modules.TWAnekoSB = ANekoSB = (function () { ); } // }}} - function stop () { // {{{ + function stop (isClose) { // {{{ if (!started) return liberator.echoerr('TWAnekoSB has not been started!'); + if (isClose && Config.dontStop) { + sidebarClosed = true; + return; + } + plugins.twittperator.ChirpUserStream.removeListener(added.chirp); plugins.twittperator.TrackingStream.removeListener(added.filter); Store.set("history", Tweets); diff --git a/twittperator/twsidebar/chrome/content/twsidebar.xul b/twittperator/twsidebar/chrome/content/twsidebar.xul index 69ab965..abfac9c 100644 --- a/twittperator/twsidebar/chrome/content/twsidebar.xul +++ b/twittperator/twsidebar/chrome/content/twsidebar.xul @@ -3,8 +3,8 @@ <?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?> <?xml-stylesheet href="chrome://twsidebar/content/twsidebar.css" type="text/css"?> <page id="tw-sidebar-page" title="Twitter Sidebar" - onload="window.parent.liberator.modules.TWAnekoSB.start()" - onunload="window.parent.liberator.modules.TWAnekoSB.stop()" + onload="window.parent.liberator.modules.TWAnekoSB.start(true)" + onunload="window.parent.liberator.modules.TWAnekoSB.stop(true)" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > <vbox flex="1"> <tabbox id="tw-anekos-sb-tabbox" flex="1"> |