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}";
}
link = $.el('a', {
textContent: 'Open the QR',
textContent: 'Quick Reply',
href: 'javascript:;'
});
$.on(link, 'click', QR.open);
$.on(link, 'click', function() {
Header.menu.close();
return QR.open();
});
$.event('AddMenuEntry', {
type: 'header',
el: link
@ -1848,7 +1851,7 @@
},
readyInit: function() {
if (Conf['Persistent QR']) {
QR.dialog();
QR.open();
if (Conf['Auto Hide QR']) {
QR.hide();
}
@ -1865,7 +1868,14 @@
QR.el.hidden = false;
return QR.unhide();
} else {
return QR.dialog();
try {
return QR.dialog();
} catch (err) {
return Main.handleErrors({
message: 'Quick Reply dialog creation crashed.',
error: err
});
}
}
},
close: function() {

View File

@ -3,7 +3,9 @@ alpha
Major rewrite of 4chan X.
New feature, 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.
Added touch and multi-touch support for dragging windows.
The Thread Updater will pause when offline, and resume when online.

View File

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