diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 8c994280f..96e6482ea 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -36,6 +36,7 @@ Added - New arguments `--top-navigate` and `--bottom-navigate` (`-t`/`-b`) for `:scroll-page` to specify a navigation action (e.g. automatically go to the next page when arriving at the bottom). - New flag `-d`/`--detach` for `:spawn` to detach the spawned process so it's not closed when qutebrowser is. - New (hidden) command `:follow-selected` (bound to `Enter`/`Ctrl-Enter` by default) to follow the link which is currently selected (e.g. after searching via `/`). +- New setting `ui -> modal-js-dialog` to use the standard modal dialogs for javascript questions instead of using the statusbar. Changed ~~~~~~~ diff --git a/README.asciidoc b/README.asciidoc index a1d4c2128..63d803d8f 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -141,8 +141,8 @@ Contributors, sorted by the number of commits in descending order: * Artur Shaik * Antoni Boucher * ZDarian -* Peter Vilim * Martin Tournoij +* Peter Vilim * John ShaggyTwoDope Jenkins * Jimmy * Zach-Button diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index d3c571aa3..073ad2d63 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -45,6 +45,7 @@ |<>|Whether to hide the statusbar unless a message is shown. |<>|The format to use for the window title. The following placeholders are defined: |<>|Whether to hide the mouse cursor. +|<>|Use standard JavaScript modal dialog for alert() and confirm() |============== .Quick reference for section ``network'' @@ -594,6 +595,17 @@ Valid values: Default: +pass:[false]+ +[[ui-modal-js-dialog]] +=== modal-js-dialog +Use standard JavaScript modal dialog for alert() and confirm() + +Valid values: + + * +true+ + * +false+ + +Default: +pass:[false]+ + == network Settings related to the network. diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index 005a6e300..8e430efcb 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -478,17 +478,23 @@ class BrowserPage(QWebPage): return super().extension(ext, opt, out) return handler(opt, out) - def javaScriptAlert(self, _frame, msg): + 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 self._ask("[js alert] {}".format(msg), usertypes.PromptMode.alert) - def javaScriptConfirm(self, _frame, msg): + 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), diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 1480ddb2e..9df909676 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -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 )),