Commit missing proxy components from r3266
This commit is contained in:
parent
501d6c6e77
commit
f20ed8507e
2 changed files with 108 additions and 0 deletions
82
chrome/content/zotero/proxy.js
Normal file
82
chrome/content/zotero/proxy.js
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright (c) 2006 Center for History and New Media
|
||||
George Mason University, Fairfax, Virginia, USA
|
||||
http://chnm.gmu.edu
|
||||
|
||||
Licensed under the Educational Community License, Version 1.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.opensource.org/licenses/ecl1.php
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
Utilities based in part on code taken from Piggy Bank 2.1.1 (BSD-licensed)
|
||||
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for proxy.xul add proxy confirmation dialog
|
||||
* @namespace
|
||||
*/
|
||||
Zotero_Proxy_Dialog = new function() {
|
||||
var halfSecondsRemaining = 4;
|
||||
var acceptButton;
|
||||
var addString;
|
||||
|
||||
/**
|
||||
* Initializes dialog
|
||||
*/
|
||||
this.init = function() {
|
||||
document.getElementById("description").firstChild.nodeValue = Zotero.getString("proxies.recognized.message",
|
||||
[window.arguments[0].site, window.arguments[0].proxy]);
|
||||
acceptButton = document.documentElement.getButton("accept")
|
||||
acceptButton.disabled = true;
|
||||
addString = Zotero.getString("proxies.recognized.add");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
halfSecondsRemaining = Math.round(prefs.getIntPref("security.dialog_enable_delay")/500)+1;
|
||||
_updateRemaining();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when "Add" button is pressed
|
||||
*/
|
||||
this.accept = function() {
|
||||
window.arguments[0].disable = document.getElementById("disable").checked;
|
||||
window.arguments[0].add = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when "Ignore" button is pressed
|
||||
*/
|
||||
this.cancel = function() {
|
||||
window.arguments[0].disable = document.getElementById("disable").checked;
|
||||
window.arguments[0].add = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the number of seconds the accept button remains disabled, then sets a timeout to call
|
||||
* itself again, or alternatively, enables the button
|
||||
* @inner
|
||||
*/
|
||||
function _updateRemaining() {
|
||||
halfSecondsRemaining--;
|
||||
if(halfSecondsRemaining == 0) {
|
||||
acceptButton.disabled = false;
|
||||
acceptButton.label = addString;
|
||||
} else {
|
||||
acceptButton.label = addString+" ("+halfSecondsRemaining+")";
|
||||
window.setTimeout(_updateRemaining, 500);
|
||||
}
|
||||
}
|
||||
}
|
26
chrome/content/zotero/proxy.xul
Normal file
26
chrome/content/zotero/proxy.xul
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/zotero.css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
|
||||
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&zotero.proxy.recognized.title;" buttons="cancel,accept" id="proxy-dialog"
|
||||
buttonlabelcancel="&zotero.proxy.recognized.ignore.label;"
|
||||
ondialogaccept="Zotero_Proxy_Dialog.accept()" ondialogcancel="Zotero_Proxy_Dialog.cancel()"
|
||||
onload="Zotero_Proxy_Dialog.init()">
|
||||
|
||||
<script src="include.js"/>
|
||||
<script src="proxy.js"/>
|
||||
|
||||
<vbox flex="1" style="width:510px">
|
||||
<hbox align="start">
|
||||
<image class="alert-icon"/>
|
||||
<vbox flex="1">
|
||||
<description class="zotero-warning">&zotero.proxy.recognized.warning;</description>
|
||||
<description>&zotero.proxy.recognized.warning.secondary;</description>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
<description id="description"> </description>
|
||||
<checkbox id="disable" label="&zotero.proxy.recognized.disable.label;"/>
|
||||
</vbox>
|
||||
</dialog>
|
Loading…
Add table
Reference in a new issue