diff options
-rw-r--r-- | google-plus-commando.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/google-plus-commando.js b/google-plus-commando.js index 0baadd6..da8a904 100644 --- a/google-plus-commando.js +++ b/google-plus-commando.js @@ -270,12 +270,18 @@ let INFO = function Notifications (root) { let self = { get root () root, - get visible () (parseInt(root.style.height, 10) > 0) + get visible () { + let h = parseInt(root.style.height, 10) > 0; + if (!h) + return false; + let nwc = plugins.googlePlusCommando.element.frames.notifications.root.contentDocument.querySelector('#nw-content'); + return parseInt(util.computedStyle(nwc).height, 10) > 100; + } }; return self; } - return [S, Elements]; + return Elements; })(); // }}} @@ -350,9 +356,11 @@ let INFO = // Commands {{{ const Commands = { - moveEntry: function (arrow, vim) { + moveEntry: function (next) { + let [arrow, vim, dir] = next ? ['<Down>', 'j', 'next'] : ['<Up>', 'k', 'prev']; + if (Elements.viewer) - return click(Elements.viewer.next); + return click(Elements.viewer[dir]); let arrowTarget = (function () { let notifications = Elements.frames.notifications; @@ -369,8 +377,8 @@ let INFO = arrowTarget ? [arrow, ['keypress'], arrowTarget] : [vim, ['vkeypress'], Elements.doc] ); }, - next: withCount(function () Commands.moveEntry('<Down>', 'j')), - prev: withCount(function () Commands.moveEntry('<Up>', 'k')), + next: withCount(function () Commands.moveEntry(true)), + prev: withCount(function () Commands.moveEntry(false)), comment: function() { let entry = Elements.currentEntry; click(entry.comment); |