diff options
author | anekos | 2011-09-16 02:15:02 +0900 |
---|---|---|
committer | anekos | 2011-09-16 02:15:02 +0900 |
commit | 8c4a04a7d5547c39a8d08ac234aabdf2e356ee17 (patch) | |
tree | 10a038262d26538b402dfd8d5d0e6af71ec73aaa /google-plus-commando.js | |
parent | 9ca2fdd387d305e452cd2834dbfa9a504200157d (diff) | |
download | vimperator-plugins-8c4a04a7d5547c39a8d08ac234aabdf2e356ee17.tar.bz2 |
ボタンクリックを非同期に
Diffstat (limited to 'google-plus-commando.js')
-rw-r--r-- | google-plus-commando.js | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/google-plus-commando.js b/google-plus-commando.js index 83df0ef..88913a3 100644 --- a/google-plus-commando.js +++ b/google-plus-commando.js @@ -36,7 +36,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - <plugin name="GooglePlusCommando" version="2.4.4" + <plugin name="GooglePlusCommando" version="2.4.5" href="http://github.com/vimpr/vimperator-plugins/blob/master/google-plus-commando.js" summary="The handy commands for Google+" lang="en-US" @@ -246,14 +246,30 @@ let g:gplus_commando_map_menu = "m" function IA (list) Iterator(A(list)); - function click (elem) { + function click (elem, after) { + click if (!elem) throw GPCError('elem is undefined'); - buffer.followLink(elem, liberator.CURRENT_TAB); + setTimeout( + function () { + buffer.followLink(elem, liberator.CURRENT_TAB); + setTimeout(after, 1); + }, + 1 + ); } - function clicks (elems) { - elems.forEach(click); + function clicks (elems, after) { + if (!(elems && elems.length)) + return; + + setTimeout( + function () { + click(elems[0], elems.length === 1 && after); + clicks(elems.slice(1)); + }, + 1 + ); } function isDisplayed (elem) @@ -868,16 +884,16 @@ let g:gplus_commando_map_menu = "m" next: withCount(function () Commands.moveEntry(true)), prev: withCount(function () Commands.moveEntry(false)), comment: function () { + let after = PostHelp.show; let notifications = Elements.frames.notifications; if (notifications && notifications.visible && notifications.entry.visible) { let e = notifications.entry.current; e.scrollTop = e.scrollHeight; - click(notifications.entry.comment); + click(notifications.entry.comment, after); } else { let entry = Elements.currentEntry; - click(entry.comment); + click(entry.comment, after); } - PostHelp.show(); }, plusone: function () click(Elements.currentEntry.plusone), share: function () click(Elements.currentEntry.share), |