home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Theme / 8GadgetPack / 8GadgetPackSetup.msi / Gadgets.7z / Gadgets / Clipboarder.gadget / Settings.js < prev   
Text File  |  2009-02-03  |  5KB  |  111 lines

  1.  
  2. var CurrentTip = 0;
  3.  
  4. function LoadSettings() 
  5. {
  6.     HotKeyModifer1.options[0] = new Option(Localized['Modifer8'], 8);
  7.     HotKeyModifer1.options[1] = new Option(Localized['Modifer2'], 2);
  8.     HotKeyModifer1.options[2] = new Option(Localized['Modifer4'], 4);
  9.     HotKeyModifer1.options[3] = new Option(Localized['Modifer9'], 9);
  10.     HotKeyModifer1.options[4] = new Option(Localized['Modifer3'], 3);
  11.     HotKeyModifer1.options[5] = new Option(Localized['Modifer10'], 10);
  12.  
  13.     HotKeyModifer2.options[0] = new Option(Localized['Modifer8'], 8);
  14.     HotKeyModifer2.options[1] = new Option(Localized['Modifer2'], 2);
  15.     HotKeyModifer2.options[2] = new Option(Localized['Modifer4'], 4);
  16.     HotKeyModifer2.options[3] = new Option(Localized['Modifer9'], 9);
  17.     HotKeyModifer2.options[4] = new Option(Localized['Modifer3'], 3);
  18.     HotKeyModifer2.options[5] = new Option(Localized['Modifer10'], 10);
  19.  
  20.     FixedVisibleContents.options[0] = new Option(Localized['Many'], 0);
  21.     FixedVisibleContents.options[1] = new Option(Localized['Less'], 1);
  22.     FixedVisibleContents.options[2] = new Option(Localized['Max1'], 2);
  23.     FixedVisibleContents.options[3] = new Option(Localized['Max2'], 3);
  24.  
  25.     TipText.innerHTML = Localized['Tip_'+(CurrentTip+1)];
  26.     currentIndex.innerHTML = "" + (CurrentTip+1) + Localized['TipOf'] + Localized['NumTips'];
  27.     
  28.     HotKeyText.innerHTML = Localized['HotKeyText'];
  29.     HotKeyText1.innerHTML = Localized['HotKeyText1'];
  30.     HotKeyText2.innerHTML = Localized['HotKeyText2'];
  31.     MaxContentsText.innerHTML = Localized['MaxContentsText'];
  32.     FixedVisibleContentsText.innerHTML = Localized['FixedVisibleContentsText'];
  33.     UseGlassText.innerHTML = Localized['UseGlassText'];
  34.     //UseAnimationText.innerHTML = Localized['UseAnimationText'];
  35.     //SaveToHarddriveText.innerHTML = Localized['SaveToHarddriveText'];
  36.     //IsDragFieldText.innerHTML = Localized['IsDragFieldText'];
  37.     Website.innerHTML = Localized['Website'];
  38.     Website.href = Localized['WebsiteUrl'];
  39.     Feedback.innerHTML = Localized['Feedback'];
  40.     Feedback.href = Localized['FeedbackUrl'];
  41.  
  42.     // Load settings
  43.     HotKeyModifer1.value = System.Gadget.Settings.read("HotKeyModifer1");
  44.     HotKeyModifer2.value = System.Gadget.Settings.read("HotKeyModifer2");
  45.     HotKey1.value = System.Gadget.Settings.read("HotKey1");
  46.     if(HotKey1.value == "@")
  47.         HotKey1.value = "";
  48.     HotKey2.value = System.Gadget.Settings.read("HotKey2");
  49.     if(HotKey2.value == "@")
  50.         HotKey2.value = "";
  51.     MaxContents.value = System.Gadget.Settings.read("MaxContents");
  52.     FixedVisibleContents.value = System.Gadget.Settings.read("FixedVisibleContents");
  53.     UseGlass.checked = System.Gadget.Settings.read("UseGlass") == "1";
  54.     
  55.     System.Gadget.onSettingsClosing = SettingsClosing;
  56. }
  57.  
  58. function SettingsClosing(event)
  59. {
  60.     // Save the settings if the user clicked OK
  61.     if(event.closeAction == event.Action.commit) 
  62.     {
  63.         if(HotKey1.value == "")
  64.             HotKey1.value = "@";
  65.         if(HotKey2.value == "")
  66.             HotKey2.value = "@";
  67.         System.Gadget.Settings.write("HotKeyModifer1", HotKeyModifer1.value);
  68.         System.Gadget.Settings.write("HotKeyModifer2", HotKeyModifer2.value);
  69.         System.Gadget.Settings.write("HotKey1", HotKey1.value.toUpperCase());
  70.         System.Gadget.Settings.write("HotKey2", HotKey2.value.toUpperCase());
  71.         System.Gadget.Settings.write("MaxContents", MaxContents.value);
  72.         System.Gadget.Settings.write("FixedVisibleContents", FixedVisibleContents.value);
  73.         System.Gadget.Settings.write("UseGlass", UseGlass.checked ? "1" : "0");
  74.         System.Gadget.Settings.write("SettingsWritten", "1");
  75.     }
  76.     event.cancel = false;
  77. }
  78.  
  79. function TipsBack()
  80. {
  81.     if ((event.keyCode && event.keyCode != 32) || (event.button == 2))
  82.     {
  83.         return false;
  84.     }
  85.     if(CurrentTip == 0)
  86.         CurrentTip = parseInt(Localized['NumTips'])-1;
  87.     else
  88.         CurrentTip--;
  89.     TipText.innerHTML = Localized['Tip_'+(CurrentTip+1)];
  90.     currentIndex.innerHTML = "" + (CurrentTip+1) + Localized['TipOf'] + Localized['NumTips'];
  91. }
  92.  
  93. function TipsForward()
  94. {
  95.     if ((event.keyCode && event.keyCode != 32) || (event.button == 2))
  96.     {
  97.         return false;
  98.     }
  99.     if(CurrentTip == parseInt(Localized['NumTips'])-1)
  100.         CurrentTip = 0;
  101.     else
  102.         CurrentTip++;
  103.     TipText.innerHTML = Localized['Tip_'+(CurrentTip+1)];
  104.     currentIndex.innerHTML = "" + (CurrentTip+1) + Localized['TipOf'] + Localized['NumTips'];
  105. }
  106.  
  107. function swapImage(img, state)
  108. {
  109.     img.src = "images/settings_" + img.src.split("_")[1] + "_" + state + ".png";
  110. }
  111.