Add an option to not show the proxy redirection notification
This commit is contained in:
parent
a5ce4d2a66
commit
34c0e746f5
6 changed files with 42 additions and 14 deletions
|
@ -50,6 +50,8 @@
|
||||||
<vbox style="margin-left: 1em">
|
<vbox style="margin-left: 1em">
|
||||||
<checkbox id="zotero-proxies-autoRecognize" label="&zotero.preferences.proxies.autoRecognize;"
|
<checkbox id="zotero-proxies-autoRecognize" label="&zotero.preferences.proxies.autoRecognize;"
|
||||||
command="zotero-proxies-update"/>
|
command="zotero-proxies-update"/>
|
||||||
|
<checkbox id="zotero-proxies-showRedirectNotification" label="&zotero.preferences.proxies.showRedirectNotification;"
|
||||||
|
command="zotero-proxies-update"/>
|
||||||
<hbox style="display: block; line-height: 1.75em">
|
<hbox style="display: block; line-height: 1.75em">
|
||||||
<checkbox id="zotero-proxies-disableByDomain-checkbox"
|
<checkbox id="zotero-proxies-disableByDomain-checkbox"
|
||||||
label="&zotero.preferences.proxies.disableByDomain;"
|
label="&zotero.preferences.proxies.disableByDomain;"
|
||||||
|
|
|
@ -40,6 +40,7 @@ Zotero_Preferences.Proxies = {
|
||||||
var transparent = document.getElementById('zotero-proxies-transparent').checked;
|
var transparent = document.getElementById('zotero-proxies-transparent').checked;
|
||||||
Zotero.Prefs.set("proxies.transparent", transparent);
|
Zotero.Prefs.set("proxies.transparent", transparent);
|
||||||
Zotero.Prefs.set("proxies.autoRecognize", document.getElementById('zotero-proxies-autoRecognize').checked);
|
Zotero.Prefs.set("proxies.autoRecognize", document.getElementById('zotero-proxies-autoRecognize').checked);
|
||||||
|
Zotero.Prefs.set("proxies.showRedirectNotification", document.getElementById('zotero-proxies-showRedirectNotification').checked);
|
||||||
Zotero.Prefs.set("proxies.disableByDomainString", document.getElementById('zotero-proxies-disableByDomain-textbox').value);
|
Zotero.Prefs.set("proxies.disableByDomainString", document.getElementById('zotero-proxies-disableByDomain-textbox').value);
|
||||||
Zotero.Prefs.set("proxies.disableByDomain", document.getElementById('zotero-proxies-disableByDomain-checkbox').checked &&
|
Zotero.Prefs.set("proxies.disableByDomain", document.getElementById('zotero-proxies-disableByDomain-checkbox').checked &&
|
||||||
document.getElementById('zotero-proxies-disableByDomain-textbox').value != "");
|
document.getElementById('zotero-proxies-disableByDomain-textbox').value != "");
|
||||||
|
@ -50,8 +51,10 @@ Zotero_Preferences.Proxies = {
|
||||||
document.getElementById('proxyTree-delete').disabled =
|
document.getElementById('proxyTree-delete').disabled =
|
||||||
document.getElementById('proxyTree').disabled =
|
document.getElementById('proxyTree').disabled =
|
||||||
document.getElementById('zotero-proxies-autoRecognize').disabled =
|
document.getElementById('zotero-proxies-autoRecognize').disabled =
|
||||||
|
document.getElementById('zotero-proxies-showRedirectNotification').disabled =
|
||||||
document.getElementById('zotero-proxies-disableByDomain-checkbox').disabled =
|
document.getElementById('zotero-proxies-disableByDomain-checkbox').disabled =
|
||||||
document.getElementById('zotero-proxies-disableByDomain-textbox').disabled = !transparent;
|
document.getElementById('zotero-proxies-disableByDomain-textbox').disabled =
|
||||||
|
!transparent;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,6 +144,7 @@ Zotero_Preferences.Proxies = {
|
||||||
document.getElementById('proxyTree-delete').disabled = true;
|
document.getElementById('proxyTree-delete').disabled = true;
|
||||||
document.getElementById('zotero-proxies-transparent').checked = Zotero.Prefs.get("proxies.transparent");
|
document.getElementById('zotero-proxies-transparent').checked = Zotero.Prefs.get("proxies.transparent");
|
||||||
document.getElementById('zotero-proxies-autoRecognize').checked = Zotero.Prefs.get("proxies.autoRecognize");
|
document.getElementById('zotero-proxies-autoRecognize').checked = Zotero.Prefs.get("proxies.autoRecognize");
|
||||||
|
document.getElementById('zotero-proxies-showRedirectNotification').checked = Zotero.Prefs.get("proxies.showRedirectNotification");
|
||||||
document.getElementById('zotero-proxies-disableByDomain-checkbox').checked = Zotero.Prefs.get("proxies.disableByDomain");
|
document.getElementById('zotero-proxies-disableByDomain-checkbox').checked = Zotero.Prefs.get("proxies.disableByDomain");
|
||||||
document.getElementById('zotero-proxies-disableByDomain-textbox').value = Zotero.Prefs.get("proxies.disableByDomainString");
|
document.getElementById('zotero-proxies-disableByDomain-textbox').value = Zotero.Prefs.get("proxies.disableByDomainString");
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,8 @@ Zotero.Proxies = new function() {
|
||||||
Zotero.Proxies.lastIPCheck = 0;
|
Zotero.Proxies.lastIPCheck = 0;
|
||||||
Zotero.Proxies.lastIPs = "";
|
Zotero.Proxies.lastIPs = "";
|
||||||
Zotero.Proxies.disabledByDomain = false;
|
Zotero.Proxies.disabledByDomain = false;
|
||||||
|
|
||||||
|
Zotero.Proxies.showRedirectNotification = Zotero.Prefs.get("proxies.showRedirectNotification");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +109,7 @@ Zotero.Proxies = new function() {
|
||||||
if(!bw) return;
|
if(!bw) return;
|
||||||
_showNotification(bw,
|
_showNotification(bw,
|
||||||
Zotero.getString('proxies.notification.associated.label', [host, channel.URI.hostPort]),
|
Zotero.getString('proxies.notification.associated.label', [host, channel.URI.hostPort]),
|
||||||
"settings", function() { _prefsOpenCallback(bw[1]) });
|
[{ label: "proxies.notification.settings.button", callback: function() { _prefsOpenCallback(bw[1]); } }]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// otherwise, try to detect a proxy
|
// otherwise, try to detect a proxy
|
||||||
|
@ -132,7 +134,7 @@ Zotero.Proxies = new function() {
|
||||||
// Ask to save only if automatic proxy recognition is on
|
// Ask to save only if automatic proxy recognition is on
|
||||||
savedTransparent = _showNotification(bw,
|
savedTransparent = _showNotification(bw,
|
||||||
Zotero.getString('proxies.notification.recognized.label', [proxy.hosts[0], channel.URI.hostPort]),
|
Zotero.getString('proxies.notification.recognized.label', [proxy.hosts[0], channel.URI.hostPort]),
|
||||||
"enable", function() { _showDialog(proxy.hosts[0], channel.URI.hostPort, proxy) });
|
[{ label: "proxies.notification.enable.button", callback: function() { _showDialog(proxy.hosts[0], channel.URI.hostPort, proxy); } }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy.save();
|
proxy.save();
|
||||||
|
@ -234,9 +236,15 @@ Zotero.Proxies = new function() {
|
||||||
|
|
||||||
// Otherwise, redirect. Note that we save the URI we're redirecting from as the
|
// Otherwise, redirect. Note that we save the URI we're redirecting from as the
|
||||||
// referrer, since we can't make a proper redirect
|
// referrer, since we can't make a proper redirect
|
||||||
_showNotification(bw,
|
if(Zotero.Proxies.showRedirectNotification) {
|
||||||
Zotero.getString('proxies.notification.redirected.label', [channel.URI.hostPort, proxiedURI.hostPort]),
|
_showNotification(bw,
|
||||||
"settings", function() { _prefsOpenCallback(bw[1]) });
|
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]); } }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
browser.loadURIWithFlags(proxied, 0, channel.URI, null, null);
|
browser.loadURIWithFlags(proxied, 0, channel.URI, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,26 +425,37 @@ Zotero.Proxies = new function() {
|
||||||
* Show a proxy-related notification
|
* Show a proxy-related notification
|
||||||
* @param {Array} bw output of _getBrowserWindow
|
* @param {Array} bw output of _getBrowserWindow
|
||||||
* @param {String} label notification text
|
* @param {String} label notification text
|
||||||
* @param {String} button button text ("settings" or "enable")
|
* @param {Array} buttons dicts of button label resource string and associated callback
|
||||||
* @param {Function} callback callback to be executed if button is pressed
|
|
||||||
*/
|
*/
|
||||||
function _showNotification(bw, label, button, callback) {
|
function _showNotification(bw, label, buttons) {
|
||||||
var browser = bw[0];
|
var browser = bw[0];
|
||||||
var window = bw[1];
|
var window = bw[1];
|
||||||
|
|
||||||
|
buttons = buttons.map(function(button) {
|
||||||
|
return {
|
||||||
|
label: Zotero.getString(button.label),
|
||||||
|
callback: button.callback
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var listener = function() {
|
var listener = function() {
|
||||||
var nb = window.gBrowser.getNotificationBox();
|
var nb = window.gBrowser.getNotificationBox();
|
||||||
nb.appendNotification(label,
|
nb.appendNotification(label,
|
||||||
'zotero-proxy', 'chrome://browser/skin/Info.png', nb.PRIORITY_WARNING_MEDIUM,
|
'zotero-proxy', 'chrome://browser/skin/Info.png', nb.PRIORITY_WARNING_MEDIUM,
|
||||||
[{
|
buttons);
|
||||||
label:Zotero.getString('proxies.notification.'+button+'.button'),
|
|
||||||
callback:callback
|
|
||||||
}]);
|
|
||||||
browser.removeEventListener("pageshow", listener, false);
|
browser.removeEventListener("pageshow", listener, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.addEventListener("pageshow", listener, false);
|
browser.addEventListener("pageshow", listener, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables proxy redirection notification
|
||||||
|
*/
|
||||||
|
function _disableRedirectNotification() {
|
||||||
|
Zotero.Proxies.showRedirectNotification = false;
|
||||||
|
Zotero.Prefs.set("proxies.showRedirectNotification",false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens preferences window
|
* Opens preferences window
|
||||||
|
|
|
@ -144,6 +144,7 @@
|
||||||
<!ENTITY zotero.preferences.proxies.desc_after_link "for more information.">
|
<!ENTITY zotero.preferences.proxies.desc_after_link "for more information.">
|
||||||
<!ENTITY zotero.preferences.proxies.transparent "Enable proxy redirection">
|
<!ENTITY zotero.preferences.proxies.transparent "Enable proxy redirection">
|
||||||
<!ENTITY zotero.preferences.proxies.autoRecognize "Automatically recognize proxied resources">
|
<!ENTITY zotero.preferences.proxies.autoRecognize "Automatically recognize proxied resources">
|
||||||
|
<!ENTITY zotero.preferences.proxies.showRedirectNotification "Show notification when redirecting through a proxy">
|
||||||
<!ENTITY zotero.preferences.proxies.disableByDomain "Disable proxy redirection when my domain name contains ">
|
<!ENTITY zotero.preferences.proxies.disableByDomain "Disable proxy redirection when my domain name contains ">
|
||||||
<!ENTITY zotero.preferences.proxies.configured "Configured Proxies">
|
<!ENTITY zotero.preferences.proxies.configured "Configured Proxies">
|
||||||
<!ENTITY zotero.preferences.proxies.hostname "Hostname">
|
<!ENTITY zotero.preferences.proxies.hostname "Hostname">
|
||||||
|
|
|
@ -55,6 +55,7 @@ general.numMore = %S more…
|
||||||
general.openPreferences = Open Preferences
|
general.openPreferences = Open Preferences
|
||||||
general.keys.ctrlShift = Ctrl+Shift+
|
general.keys.ctrlShift = Ctrl+Shift+
|
||||||
general.keys.cmdShift = Cmd+Shift+
|
general.keys.cmdShift = Cmd+Shift+
|
||||||
|
general.dontShowAgain = Don’t Show Again
|
||||||
|
|
||||||
general.operationInProgress = A Zotero operation is currently in progress.
|
general.operationInProgress = A Zotero operation is currently in progress.
|
||||||
general.operationInProgress.waitUntilFinished = Please wait until it has finished.
|
general.operationInProgress.waitUntilFinished = Please wait until it has finished.
|
||||||
|
|
|
@ -154,6 +154,7 @@ pref("extensions.zotero.proxies.autoRecognize", true);
|
||||||
pref("extensions.zotero.proxies.transparent", true);
|
pref("extensions.zotero.proxies.transparent", true);
|
||||||
pref("extensions.zotero.proxies.disableByDomain", false);
|
pref("extensions.zotero.proxies.disableByDomain", false);
|
||||||
pref("extensions.zotero.proxies.disableByDomainString", ".edu");
|
pref("extensions.zotero.proxies.disableByDomainString", ".edu");
|
||||||
|
pref("extensions.zotero.proxies.showRedirectNotification", true);
|
||||||
|
|
||||||
// Data layer purging
|
// Data layer purging
|
||||||
pref("extensions.zotero.purge.creators", false);
|
pref("extensions.zotero.purge.creators", false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue