From 320a7bb47aceda837aefbc207e2920e3092cb5a2 Mon Sep 17 00:00:00 2001 From: anekos Date: Sun, 17 Jul 2011 07:31:58 +0900 Subject: 通知表示関連の改善 --- google-plus-commando.js | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/google-plus-commando.js b/google-plus-commando.js index acc9ff6..59ec7ae 100644 --- a/google-plus-commando.js +++ b/google-plus-commando.js @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - 0) + }; + return self; + } + // }}} // Post Help {{{ @@ -293,26 +305,27 @@ let INFO = // Commands {{{ const Commands = { - next: withCount(function () { + moveEntry: function (arrow, vim) { if (Elements.viewer) return click(Elements.viewer.next); - let menus = A(Elements.doc.querySelectorAll('[tabindex="0"][role="menu"]')); - plugins.feedSomeKeys_3.API.feed.apply( - null, - menus.length === 1 ? ['', ['keypress'], menus[0]] - : ['j', ['vkeypress'], Elements.doc] - ); - }), - prev: withCount(function () { - if (Elements.viewer) - return click(Elements.viewer.prev); - let menus = A(Elements.doc.querySelectorAll('[tabindex="0"][role="menu"]')); + + let arrowTarget = (function () { + let notifications = Elements.frames.notifications; + if (notifications && notifications.visible) + return notifications.root.contentDocument.body; + + let menus = A(Elements.doc.querySelectorAll('[tabindex="0"][role="menu"]')); + if (menus.length === 1) + return menus[0]; + })(); + plugins.feedSomeKeys_3.API.feed.apply( null, - menus.length === 1 ? ['', ['keypress'], menus[0]] - : ['k', ['vkeypress'], Elements.doc] + arrowTarget ? [arrow, ['keypress'], arrowTarget] : [vim, ['vkeypress'], Elements.doc] ); - }), + }, + next: withCount(function () Commands.moveEntry('', 'j')), + prev: withCount(function () Commands.moveEntry('', 'k')), comment: function() { let entry = Elements.currentEntry; click(entry.comment); @@ -341,6 +354,10 @@ let INFO = if (e && e.cancel) return click(e.cancel); } + + if (Elements.frames.notifications.visible) + return click(Elements.notification); + click(Elements.doc.body); }, submit: function () { -- cgit v1.2.3