commit d8850b25c237461135c2d9be18cdbd9c0ac2c39f
parent 0fca78bb7e64eca0ede42acb98647e15d8b77441
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 16 Apr 2016 14:22:11 -0400
Fix buttons in proxy redirect notification box
Diffstat:
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/proxy.js b/chrome/content/zotero/xpcom/proxy.js
@@ -134,7 +134,13 @@ Zotero.Proxies = new function() {
browser,
window,
Zotero.getString('proxies.notification.associated.label', [host, channel.URI.hostPort]),
- [{ label: "proxies.notification.settings.button", callback: function() { _prefsOpenCallback(bw[1]); } }]);
+ [
+ {
+ label: "proxies.notification.settings.button",
+ callback: () => _prefsOpenCallback(window)
+ }
+ ]
+ );
}
} else {
if (!browser) return;
@@ -263,9 +269,16 @@ Zotero.Proxies = new function() {
window,
Zotero.getString('proxies.notification.redirected.label', [channel.URI.hostPort, proxiedURI.hostPort]),
[
- { label: "general.dontShowAgain", callback: function() { _disableRedirectNotification(); } },
- { label: "proxies.notification.settings.button", callback: function() { _prefsOpenCallback(bw[1]); } }
- ]);
+ {
+ label: "general.dontShowAgain",
+ callback: () => _disableRedirectNotification()
+ },
+ {
+ label: "proxies.notification.settings.button",
+ callback: () => _prefsOpenCallback(window)
+ }
+ ]
+ );
}
browser.loadURIWithFlags(proxied, 0, channel.URI, null, null);
@@ -464,11 +477,13 @@ Zotero.Proxies = new function() {
/**
* Show a proxy-related notification
- * @param {Array} bw output of _getBrowserWindow
- * @param {String} label notification text
- * @param {Array} buttons dicts of button label resource string and associated callback
+ * @param {Browser} browser
+ * @param {Window} window
+ * @param {String} label - notification text
+ * @param {Object[]} buttons - Array of objects with 'label' (for getString()) and 'callback'
*/
function _showNotification(browser, window, label, buttons) {
+ // Get localized button labels
buttons = buttons.map(function(button) {
return {
label: Zotero.getString(button.label),