Close the Header's menu when opening the QR.

Handle errors when opening the QR dialog.
This commit is contained in:
Nicolas Stepien 2013-02-12 03:43:12 +01:00
parent 566b468327
commit 0f0d410209
3 changed files with 28 additions and 9 deletions

View File

@ -1832,10 +1832,13 @@
Main.css += "#postForm, .postingMode {\n display: none;\n}"; Main.css += "#postForm, .postingMode {\n display: none;\n}";
} }
link = $.el('a', { link = $.el('a', {
textContent: 'Open the QR', textContent: 'Quick Reply',
href: 'javascript:;' href: 'javascript:;'
}); });
$.on(link, 'click', QR.open); $.on(link, 'click', function() {
Header.menu.close();
return QR.open();
});
$.event('AddMenuEntry', { $.event('AddMenuEntry', {
type: 'header', type: 'header',
el: link el: link
@ -1848,7 +1851,7 @@
}, },
readyInit: function() { readyInit: function() {
if (Conf['Persistent QR']) { if (Conf['Persistent QR']) {
QR.dialog(); QR.open();
if (Conf['Auto Hide QR']) { if (Conf['Auto Hide QR']) {
QR.hide(); QR.hide();
} }
@ -1865,7 +1868,14 @@
QR.el.hidden = false; QR.el.hidden = false;
return QR.unhide(); return QR.unhide();
} else { } else {
return QR.dialog(); try {
return QR.dialog();
} catch (err) {
return Main.handleErrors({
message: 'Quick Reply dialog creation crashed.',
error: err
});
}
} }
}, },
close: function() { close: function() {

View File

@ -3,7 +3,9 @@ alpha
Major rewrite of 4chan X. Major rewrite of 4chan X.
New feature, the Header: New feature, the Header:
Access the list of boards directly from the Header. Access the list of boards directly from the Header.
Access to settings and extra features easily from the Header's menu. From the Header's menu, access to:
Settings
Quick Reply
Can be auto-hidden. Can be auto-hidden.
Added touch and multi-touch support for dragging windows. Added touch and multi-touch support for dragging windows.
The Thread Updater will pause when offline, and resume when online. The Thread Updater will pause when offline, and resume when online.

View File

@ -772,9 +772,11 @@ QR =
""" """
link = $.el 'a', link = $.el 'a',
textContent: 'Open the QR' textContent: 'Quick Reply'
href: 'javascript:;' href: 'javascript:;'
$.on link, 'click', QR.open $.on link, 'click', ->
Header.menu.close()
QR.open()
$.event 'AddMenuEntry', $.event 'AddMenuEntry',
type: 'header' type: 'header'
el: link el: link
@ -787,7 +789,7 @@ QR =
readyInit: -> readyInit: ->
if Conf['Persistent QR'] if Conf['Persistent QR']
QR.dialog() QR.open()
QR.hide() if Conf['Auto Hide QR'] QR.hide() if Conf['Auto Hide QR']
$.on d, 'dragover', QR.dragOver $.on d, 'dragover', QR.dragOver
$.on d, 'drop', QR.dropFile $.on d, 'drop', QR.dropFile
@ -801,7 +803,12 @@ QR =
QR.el.hidden = false QR.el.hidden = false
QR.unhide() QR.unhide()
else else
QR.dialog() try
QR.dialog()
catch err
Main.handleErrors
message: 'Quick Reply dialog creation crashed.'
error: err
close: -> close: ->
QR.el.hidden = true QR.el.hidden = true
QR.abort() QR.abort()