Merge branch 'modal-js-dialogs' of https://github.com/Carpetsmoker/qutebrowser into Carpetsmoker-modal-js-dialogs

This commit is contained in:
Florian Bruhin 2015-05-31 21:39:47 +02:00
commit 018d7a87be
3 changed files with 11 additions and 0 deletions

View File

@ -45,6 +45,7 @@
|<<ui-hide-statusbar,hide-statusbar>>|Whether to hide the statusbar unless a message is shown.
|<<ui-window-title-format,window-title-format>>|The format to use for the window title. The following placeholders are defined:
|<<ui-hide-mouse-cursor,hide-mouse-cursor>>|Whether to hide the mouse cursor.
|<<ui-model-js-dialog,modal-js-dialog>>|Use standard JavaScript modal dialog for alert() and confirm()
|==============
.Quick reference for section ``network''

View File

@ -481,6 +481,9 @@ class BrowserPage(QWebPage):
def javaScriptAlert(self, _frame, msg):
"""Override javaScriptAlert to use the statusbar."""
log.js.debug("alert: {}".format(msg))
if config.get('ui', 'modal-js-dialog'):
return super().javaScriptAlert(_frame, msg)
if (self._is_shutting_down or
config.get('content', 'ignore-javascript-alert')):
return
@ -489,6 +492,9 @@ class BrowserPage(QWebPage):
def javaScriptConfirm(self, _frame, msg):
"""Override javaScriptConfirm to use the statusbar."""
log.js.debug("confirm: {}".format(msg))
if config.get('ui', 'modal-js-dialog'):
return super().javaScriptConfirm(_frame, msg)
if self._is_shutting_down:
return False
ans = self._ask("[js confirm] {}".format(msg),

View File

@ -305,6 +305,10 @@ def data(readonly=False):
SettingValue(typ.Bool(), 'false'),
"Whether to hide the mouse cursor."),
('modal-js-dialog',
SettingValue(typ.Bool(), 'false'),
"Use standard JavaScript modal dialog for alert() and confirm()"),
readonly=readonly
)),