aboutsummaryrefslogtreecommitdiffstats
path: root/src/chrome/content/options
diff options
context:
space:
mode:
authorjmccrohan <jmccrohan@gmail.com>2011-04-06 15:29:05 +0100
committerjmccrohan <jmccrohan@gmail.com>2011-04-06 15:29:05 +0100
commit67810a8a0b08fc8697ee8fc8843af3757c12a421 (patch)
treeb9117ba19c4eff31666aa76010a69a9950623457 /src/chrome/content/options
parentf5d92fb14f7bfc5105700e60fb6fc35fb4e31401 (diff)
downloadMultiproxy-Switch-67810a8a0b08fc8697ee8fc8843af3757c12a421.tar.gz
Initial Commit
Diffstat (limited to '')
-rw-r--r--src/chrome/content/options/options.js80
-rw-r--r--src/chrome/content/options/options.xul32
2 files changed, 112 insertions, 0 deletions
diff --git a/src/chrome/content/options/options.js b/src/chrome/content/options/options.js
new file mode 100644
index 0000000..ecd4ea9
--- /dev/null
+++ b/src/chrome/content/options/options.js
@@ -0,0 +1,80 @@
+
+var oMain = null;
+var inMozOptions = false;
+
+function initOptions(){
+ try{
+
+ //Prefs
+ var oPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
+
+ //Get Opener
+ if(opener.mproxy_menuShowing){
+ oMain = opener;
+ }
+ else if(opener.parent.opener && opener.parent.opener.mproxy_menuShowing){
+ oMain = opener.parent.opener
+ inMozOptions = true;
+ }
+
+ //Prefill
+ if(oPrefs.prefHasUserValue("mproxy.clear.cookies"))
+ document.getElementById("mproxy.clear.cookies").checked = oPrefs.getBoolPref("mproxy.clear.cookies");
+ if(oPrefs.prefHasUserValue("mproxy.reload.tab"))
+ document.getElementById("mproxy.reload.tab").checked = oPrefs.getBoolPref("mproxy.reload.tab");
+ if(oPrefs.prefHasUserValue("mproxy.display.context"))
+ document.getElementById("mproxy.display.context").checked = oPrefs.getBoolPref("mproxy.display.context");
+ if(oPrefs.prefHasUserValue("mproxy.display.statusbar"))
+ document.getElementById("mproxy.display.statusbar").checked = oPrefs.getBoolPref("mproxy.display.statusbar");
+
+ /*if(oPrefs.prefHasUserValue("mproxy.tabs.manager"))
+ document.getElementById("mproxy.tabs.manager").checked = oPrefs.getBoolPref("mproxy.tabs.manager");*/
+
+ //Set menushowing options
+ if(oMain != null){
+ document.getElementById("mproxy.display.toolbar").checked = oMain.mproxy_menuShowing("toolbar");
+ }
+ else{
+ document.getElementById("mproxy.display.toolbar").style.display = "none";
+ }
+
+ // Thunderbird
+ if(navigator.userAgent.search(/Thunderbird/gi) > -1){
+ document.getElementById("mproxy.display.context").style.display = "none";
+ document.getElementById("mproxy.display.toolbar").style.display = "none";
+ }
+
+ }catch(err){ alert(mproxy_getString("error.unknown") +"\n"+ err); }
+}
+
+function saveOptions(){
+
+ try{
+
+ //Save
+ var oPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
+
+ oPrefs.setBoolPref("mproxy.clear.cookies", document.getElementById("mproxy.clear.cookies").checked);
+ oPrefs.setBoolPref("mproxy.reload.tab", document.getElementById("mproxy.reload.tab").checked);
+ oPrefs.setBoolPref("mproxy.display.statusbar", document.getElementById("mproxy.display.statusbar").checked);
+
+ // Not Thunderbird
+ if(navigator.userAgent.search(/Thunderbird/gi) < 0){
+ oPrefs.setBoolPref("mproxy.display.context", document.getElementById("mproxy.display.context").checked);
+
+ if(oMain != null){
+ oPrefs.setBoolPref("mproxy.display.toolbar", document.getElementById("mproxy.display.toolbar").checked);
+ }
+ }
+
+
+ if(oMain != null)
+ oMain.mproxy_showMenus();
+
+ }catch(err){ alert(mproxy_getString("error.unknown") +"\n"+err); }
+
+ if(oMain != null && !inMozOptions)
+ oMain.focus();
+
+ return true;
+}
diff --git a/src/chrome/content/options/options.xul b/src/chrome/content/options/options.xul
new file mode 100644
index 0000000..f555dd5
--- /dev/null
+++ b/src/chrome/content/options/options.xul
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
+
+<!DOCTYPE dialog SYSTEM "chrome://mproxy/locale/locale.dtd">
+
+<dialog buttons="accept"
+ id="mproxy-options-dialog"
+ ondialogaccept="return saveOptions();"
+ onload="initOptions()"
+ title="&prefs.title;"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/x-javascript" src="chrome://mproxy/content/globals.js"></script>
+ <script type="application/x-javascript" src="chrome://mproxy/content/options/options.js"></script>
+ <script type="application/x-javascript" src="chrome://mproxy/content/proxy.js"></script>
+
+ <groupbox style="width: 200px;">
+ <caption label="&prefs.general;"/>
+ <checkbox id="mproxy.display.toolbar" label="&prefs.general.toolbar;" checked="false" />
+ <checkbox id="mproxy.display.context" label="&prefs.general.context;" checked="false" />
+ <checkbox id="mproxy.display.statusbar" label="&prefs.general.statusbar;" checked="true" />
+ <!-- <checkbox id="mproxy.tabs.manager" label="Allow the use of different proxies in different tabs & windows." checked="true" /> -->
+ </groupbox>
+
+ <groupbox style="width: 200px;">
+ <caption label="&prefs.switch;"/>
+ <checkbox id="mproxy.clear.cookies" label="&prefs.switch.cookies;" checked="false" />
+ <checkbox id="mproxy.reload.tab" label="&prefs.switch.refresh;" checked="true" />
+ </groupbox>
+
+</dialog>