home *** CD-ROM | disk | FTP | other *** search
-
- var com_smartlinkcorp_imtranslatorOptions = new Object();
-
-
- var ImTranslator_Prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService)
- .getBranch("imtranslator.");
-
-
- com_smartlinkcorp_imtranslatorOptions.imtranslator_initializeOptions = function () {
- if (!ImTranslator_Prefs.prefHasUserValue("showBut")) ImTranslator_Prefs.setBoolPref("showBut",true);
- this.showBut = document.getElementById("showBut");
- this.showBut.checked = ImTranslator_Prefs.getBoolPref("showBut");
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorSelectorSet();
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorDirFrom();
- com_smartlinkcorp_imtranslatorOptions.imtranslatorDirTo("dirParentTo");
-
- if (!ImTranslator_Prefs.prefHasUserValue("AutoDetect")) ImTranslator_Prefs.setBoolPref("AutoDetect",false);
- this.AutoDetect = document.getElementById("AutoDetect");
- this.AutoDetect.checked = ImTranslator_Prefs.getBoolPref("AutoDetect");
-
- if (!ImTranslator_Prefs.prefHasUserValue("AutoBack")) ImTranslator_Prefs.setBoolPref("AutoBack",false);
- this.AutoBack = document.getElementById("AutoBack");
- this.AutoBack.checked = ImTranslator_Prefs.getBoolPref("AutoBack");
-
- if (!ImTranslator_Prefs.prefHasUserValue("AutoSpell")) ImTranslator_Prefs.setBoolPref("AutoSpell",false);
- this.AutoSpell = document.getElementById("AutoSpell");
- this.AutoSpell.checked = ImTranslator_Prefs.getBoolPref("AutoSpell");
-
- if (!ImTranslator_Prefs.prefHasUserValue("AutoDecode")) ImTranslator_Prefs.setBoolPref("AutoDecode",false);
- this.AutoDecode = document.getElementById("AutoDecode");
- this.AutoDecode.checked = ImTranslator_Prefs.getBoolPref("AutoDecode");
-
- if (!ImTranslator_Prefs.prefHasUserValue("AutoTranslit")) ImTranslator_Prefs.setBoolPref("AutoTranslit",false);
- this.AutoTranslit = document.getElementById("AutoTranslit");
- this.AutoTranslit.checked = ImTranslator_Prefs.getBoolPref("AutoTranslit");
-
- if (!ImTranslator_Prefs.prefHasUserValue("GoogleOnly")) ImTranslator_Prefs.setBoolPref("GoogleOnly",false);
- this.GoogleOnly = document.getElementById("GoogleOnly");
- this.GoogleOnly.checked = ImTranslator_Prefs.getBoolPref("GoogleOnly");
-
- if (!ImTranslator_Prefs.prefHasUserValue("AutoDictionary")) ImTranslator_Prefs.setBoolPref("AutoDictionary",false);
- this.AutoDictionary = document.getElementById("AutoDictionary");
- this.AutoDictionary.checked = ImTranslator_Prefs.getBoolPref("AutoDictionary");
-
- }
-
- com_smartlinkcorp_imtranslatorOptions.imtranslator_saveOptions = function () {
- this.showBut = document.getElementById("showBut").checked;
- ImTranslator_Prefs.setBoolPref("showBut",this.showBut);
-
- this.locParent = document.getElementById("locParent").value;
- ImTranslator_Prefs.setCharPref("locParent",this.locParent);
-
-
- this.dirParentFrom = document.getElementById("dirParentFrom");
- this.dirParentTo = document.getElementById("dirParentTo");
- if(this.dirParentFrom.value == this.dirParentTo.value){
- alert("Default (from/to) language direction cannot be the same!");
- return false;
- }else{
- ImTranslator_Prefs.setCharPref("dirParentFrom",this.dirParentFrom.value);
- ImTranslator_Prefs.setCharPref("dirParentTo",this.dirParentTo.value);
- }
-
-
- this.AutoDetect = document.getElementById("AutoDetect").checked;
- ImTranslator_Prefs.setBoolPref("AutoDetect",this.AutoDetect);
-
- this.AutoBack = document.getElementById("AutoBack").checked;
- ImTranslator_Prefs.setBoolPref("AutoBack",this.AutoBack);
-
- this.AutoSpell = document.getElementById("AutoSpell").checked;
- ImTranslator_Prefs.setBoolPref("AutoSpell",this.AutoSpell);
-
- this.AutoDecode = document.getElementById("AutoDecode").checked;
- ImTranslator_Prefs.setBoolPref("AutoDecode",this.AutoDecode);
-
- this.AutoTranslit = document.getElementById("AutoTranslit").checked;
- ImTranslator_Prefs.setBoolPref("AutoTranslit",this.AutoTranslit);
-
- this.GoogleOnly = document.getElementById("GoogleOnly").checked;
- ImTranslator_Prefs.setBoolPref("GoogleOnly",this.GoogleOnly);
-
- this.AutoDictionary = document.getElementById("AutoDictionary").checked;
- ImTranslator_Prefs.setBoolPref("AutoDictionary",this.AutoDictionary);
-
- Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).savePrefFile(null);
- }
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorHomePage = function ()
- {
-
- var url = "http://www.smartlinkcorp.com";
- var windowService = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
- var currentWindow = windowService.getMostRecentWindow("navigator:browser");
-
- if(currentWindow)
- {
- try {
- currentWindow.delayedOpenTab(url);
- } catch(e) {
- currentWindow.loadURI(url);
- }
- }
- else
- window.open(url);
-
- }
-
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorToolbarSet = function ()
- {
- if(document.getElementById("showBut").checked==true)
- document.getElementById("ImTimg1").src="chrome://imtranslator/skin/ImTbuttonOff.png";
- else
- document.getElementById("ImTimg1").src="chrome://imtranslator/skin/ImTbuttonOn.png";
- }
-
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorCheckBoxSet = function ()
- {
- if (!ImTranslator_Prefs.prefHasUserValue("loc")) {
- this.showLoc = document.getElementById("showBut");
- this.showLoc.selected = ImTranslator_Prefs.getBoolPref("showBut");
- }
- /*
- var ImTob=document.getElementById("showBut");
- com_smartlinkcorp_imtranslatorOptions.imtranslatorToolbarSet();
- if(ImTob.checked==true) ImTob.checked=false;
- else ImTob.checked=true;
- */
- }
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorSelectorSet = function ()
- {
- if (!ImTranslator_Prefs.getCharPref("locParent")) ImTranslator_Prefs.setCharPref("locParent","en");
- this.locParent = document.getElementById("locParent");
-
- for(var i=0;i<this.locParent.itemCount;i++) {
- if(this.locParent.getItemAtIndex(i).value == ImTranslator_Prefs.getCharPref("locParent")) {this.locParent.selectedIndex=i;}
- }
- }
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorDirFrom = function ()
- {
- if (!ImTranslator_Prefs.getCharPref("dirParentFrom")) ImTranslator_Prefs.setCharPref("dirParentFrom","en");
- this.dirParentFrom = document.getElementById("dirParentFrom");
-
- for(var i=0;i<this.dirParentFrom.itemCount;i++) {
- if(this.dirParentFrom.getItemAtIndex(i).value == ImTranslator_Prefs.getCharPref("dirParentFrom")) {this.dirParentFrom.selectedIndex=i;}
- }
- }
-
- com_smartlinkcorp_imtranslatorOptions.imtranslatorDirTo = function ()
- {
- if (!ImTranslator_Prefs.getCharPref("dirParentTo")) ImTranslator_Prefs.setCharPref("dirParentTo","en");
- this.dirParentTo = document.getElementById("dirParentTo");
-
- for(var i=0;i<this.dirParentTo.itemCount;i++) {
- if(this.dirParentTo.getItemAtIndex(i).value == ImTranslator_Prefs.getCharPref("dirParentTo")) {this.dirParentTo.selectedIndex=i;}
- }
- }
-
-
-
-
-