From 67fc7568c2c4aabb4fefd2cfde2a3db064c2852c Mon Sep 17 00:00:00 2001 From: anekos Date: Sat, 27 Aug 2011 12:54:50 +0900 Subject: 共有ダイアログ関係修正 --- google-plus-commando.js | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'google-plus-commando.js') diff --git a/google-plus-commando.js b/google-plus-commando.js index 23f9d1f..6cbcb74 100644 --- a/google-plus-commando.js +++ b/google-plus-commando.js @@ -36,7 +36,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - '), + //cssRules.find(/0pt 4px 16px rgba\(0, 0, 0, 0.2\).*-moz-border-right-color.*z-index: 1101/)); + submit: 'td[valign="top"] > div[role="button"]:nth-child(1)', + cancel: 'td[valign="top"] > div[role="button"]:nth-child(2)' }, frames: { notifications: { @@ -429,10 +432,37 @@ let g:gplus_commando_map_menu = "m" }; } + function get3 (root) { + function button (editor, name) + editor.parentNode.querySelector(S.role('button', <>[id$=".{name}"])); + + if (!root) + return; + + let editors = A(root.querySelectorAll('div.editable')).filter(hasIFrame); + if (editors.length === 0) + return; + if (editors.length > 1) + throw 'Two and more editors were found.'; + + return { + editor: #1=(editors[0]), + button: { + submit: root.querySelector(S.dialog.submit), + cancel: root.querySelector(S.dialog.cancel), + } + }; + } + let doc = content.document; let win = document.commandDispatcher.focusedWindow; - return get1(doc) || get2() || get1(Elements.frames.notifications.root.contentDocument); + return ( + get1(doc) || + get2() || + get1(Elements.frames.notifications.root.contentDocument) || + (Elements.dialog.root && get3(Elements.dialog.root)) + ); }, /** @@ -549,6 +579,7 @@ let g:gplus_commando_map_menu = "m" return bs[n]; } let self = { + get root () root, get buttons () A(root.querySelectorAll(S.role('button'))), get submit () nButton(0), get cancel () nButton(1) -- cgit v1.2.3