home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Theme / 8GadgetPack / 8GadgetPackSetup.msi / Gadgets.7z / Gadgets / Clipboarder.gadget / Settings.220.js < prev    next >
Text File  |  2013-08-13  |  8KB  |  183 lines

  1.  
  2. var CurrentTip = 0;
  3. var SoundFile = "";
  4.  
  5. function LoadSettings() 
  6. {
  7.     document.body.style.width  = "300px";
  8.     document.body.style.height = "400px";
  9.  
  10.     HotKeyModifer1.options[0] = new Option(Localized['Modifer8'], 8);
  11.     HotKeyModifer1.options[1] = new Option(Localized['Modifer2'], 2);
  12.     HotKeyModifer1.options[2] = new Option(Localized['Modifer4'], 4);
  13.     HotKeyModifer1.options[3] = new Option(Localized['Modifer12'], 12);
  14.     HotKeyModifer1.options[4] = new Option(Localized['Modifer9'], 9);
  15.     HotKeyModifer1.options[5] = new Option(Localized['Modifer3'], 3);
  16.     HotKeyModifer1.options[6] = new Option(Localized['Modifer10'], 10);
  17.     HotKeyModifer1.options[7] = new Option(Localized['Modifer0'], 0);
  18.  
  19.     HotKeyModifer2.options[0] = new Option(Localized['Modifer8'], 8);
  20.     HotKeyModifer2.options[1] = new Option(Localized['Modifer2'], 2);
  21.     HotKeyModifer2.options[2] = new Option(Localized['Modifer4'], 4);
  22.     HotKeyModifer2.options[3] = new Option(Localized['Modifer12'], 12);
  23.     HotKeyModifer2.options[4] = new Option(Localized['Modifer9'], 9);
  24.     HotKeyModifer2.options[5] = new Option(Localized['Modifer3'], 3);
  25.     HotKeyModifer2.options[6] = new Option(Localized['Modifer10'], 10);
  26.     HotKeyModifer2.options[7] = new Option(Localized['Modifer0'], 0);
  27.  
  28.     FixedVisibleContents.options[0] = new Option(Localized['Many'], 0);
  29.     FixedVisibleContents.options[1] = new Option(Localized['Less'], 1);
  30.     FixedVisibleContents.options[2] = new Option(Localized['Max1'], 2);
  31.     FixedVisibleContents.options[3] = new Option(Localized['Max2'], 3);
  32.  
  33.     TipText.innerHTML = Localized['Tip_'+(CurrentTip+1)];
  34.     currentIndex.innerHTML = "" + (CurrentTip+1) + Localized['TipOf'] + (parseInt(Localized['NumTips']));
  35.     
  36.     if(System.Gadget.Settings.read("HotKeyTheft") == "1")
  37.         UseHotKeysText.innerHTML = Localized['UseHotKeysTextTheft'];
  38.     else
  39.         UseHotKeysText.innerHTML = Localized['UseHotKeysText'];
  40.     HotKeyText1.innerHTML = Localized['HotKeyText1'];
  41.     HotKeyText2.innerHTML = Localized['HotKeyText2'];
  42.     MaxContentsText.innerHTML = Localized['MaxContentsText'];
  43.     FixedVisibleContentsText.innerHTML = Localized['FixedVisibleContentsText'];
  44.     //UseGlassText.innerHTML = Localized['UseGlassText'];
  45.     //UseAnimationText.innerHTML = Localized['UseAnimationText'];
  46.     UseNumpadHotkeyText.innerHTML = Localized['UseNumpadHotkeyText'];
  47.     UseForegroundText.innerHTML = Localized['UseForegroundText'];
  48.     UseSaveText.innerHTML = Localized['UseSaveText'];
  49.     UseSoundText.innerHTML = Localized['UseSoundText'];
  50.     MonitorClipboardText.innerHTML = Localized['MonitorClipboardText'];
  51.     UseHotkeyUnformattedText.innerHTML = Localized['UseHotkeyUnformattedText'];
  52.     //IsDragFieldText.innerHTML = Localized['IsDragFieldText'];
  53.     Website.innerHTML = Localized['Website'];
  54.     Website.href = Localized['WebsiteUrl'];
  55.     Feedback.innerHTML = Localized['Feedback'];
  56.     Feedback.href = Localized['FeedbackUrl'];
  57.     S7.innerHTML = Localized['Donate'];
  58.     S7.href = Localized['DonateUrl'];
  59.  
  60.     // Load settings
  61.     UseHotKeys.checked = System.Gadget.Settings.read("UseHotkeys") == "1";
  62.     HotKeyModifer1.disabled = !(System.Gadget.Settings.read("UseHotkeys") == "1");
  63.     HotKeyModifer2.disabled = !(System.Gadget.Settings.read("UseHotkeys") == "1");
  64.     HotKey1.disabled = !(System.Gadget.Settings.read("UseHotkeys") == "1");
  65.     HotKey2.disabled = !(System.Gadget.Settings.read("UseHotkeys") == "1");
  66.     HotKeyText1.disabled = !(System.Gadget.Settings.read("UseHotkeys") == "1");
  67.     HotKeyText2.disabled = !(System.Gadget.Settings.read("UseHotkeys") == "1");
  68.  
  69.     HotKeyModifer1.value = System.Gadget.Settings.read("HotKeyModifer1");
  70.     HotKeyModifer2.value = System.Gadget.Settings.read("HotKeyModifer2");
  71.     HotKey1.value = System.Gadget.Settings.read("HotKey1");
  72.     if(HotKey1.value == "@")
  73.         HotKey1.value = "";
  74.     HotKey2.value = System.Gadget.Settings.read("HotKey2");
  75.     if(HotKey2.value == "@")
  76.         HotKey2.value = "";
  77.  
  78.     MaxContents.value = System.Gadget.Settings.read("MaxContents");
  79.     FixedVisibleContents.value = System.Gadget.Settings.read("FixedVisibleContents");
  80.     //UseGlass.checked = System.Gadget.Settings.read("UseGlass") == "1";
  81.     //UseAnimation.checked = System.Gadget.Settings.read("UseAnimation") == "1";
  82.     UseNumpadHotkey.checked = System.Gadget.Settings.read("UseNumpadHotkey") == "1";
  83.     UseSave.checked = System.Gadget.Settings.read("UseSave") != "";
  84.     UseForeground.checked = System.Gadget.Settings.read("UseForeground") == "1";
  85.     SoundSelect.disabled = !(UseSound.checked = System.Gadget.Settings.read("UseSound") == "1");
  86.     SoundFile = System.Gadget.Settings.read("SoundFile");
  87.     MonitorClipboard.checked = System.Gadget.Settings.read("MonitorClipboard") == "1";
  88.     UseHotkeyUnformatted.checked = System.Gadget.Settings.read("UseHotkeyUnformatted") == "1";
  89.  
  90.     System.Gadget.onSettingsClosing = SettingsClosing;
  91. }
  92.  
  93. function SettingsClosing(event)
  94. {
  95.     // Save the settings if the user clicked OK
  96.     if(event.closeAction == event.Action.commit) 
  97.     {
  98.         if(HotKey1.value == "")
  99.             HotKey1.value = "@";
  100.         if(HotKey2.value == "")
  101.             HotKey2.value = "@";
  102.         System.Gadget.Settings.write("UseHotKeys", UseHotKeys.checked ? "1" : "0");
  103.         System.Gadget.Settings.write("HotKeyModifer1", HotKeyModifer1.value);
  104.         System.Gadget.Settings.write("HotKeyModifer2", HotKeyModifer2.value);
  105.         System.Gadget.Settings.write("HotKey1", HotKey1.value.toUpperCase());
  106.         System.Gadget.Settings.write("HotKey2", HotKey2.value.toUpperCase());
  107.         System.Gadget.Settings.write("MaxContents", MaxContents.value);
  108.         System.Gadget.Settings.write("FixedVisibleContents", FixedVisibleContents.value);
  109.         //System.Gadget.Settings.write("UseGlass", UseGlass.checked ? "1" : "0");
  110.         //System.Gadget.Settings.write("UseAnimation", UseAnimation.checked ? "1" : "0");
  111.         System.Gadget.Settings.write("UseNumpadHotkey", UseNumpadHotkey.checked ? "1" : "0");
  112.         if(UseSave.checked)
  113.         {
  114.             if(System.Gadget.Settings.read("UseSave") == "")
  115.                 System.Gadget.Settings.write("UseSave", "@");
  116.         }
  117.         else
  118.                System.Gadget.Settings.write("UseSave", "");
  119.         System.Gadget.Settings.write("UseForeground", UseForeground.checked ? "1" : "0");
  120.         System.Gadget.Settings.write("UseSound", UseSound.checked ? "1" : "0");
  121.         System.Gadget.Settings.write("SoundFile", SoundFile);
  122.         System.Gadget.Settings.write("MonitorClipboard", MonitorClipboard.checked ? "1" : "0");
  123.         System.Gadget.Settings.write("UseHotkeyUnformatted", UseHotkeyUnformatted.checked ? "1" : "0");
  124.         System.Gadget.Settings.write("SettingsWritten", "1");
  125.     }
  126.     event.cancel = false;
  127. }
  128.  
  129. function OnUseSoundChanged()
  130. {
  131.     SoundSelect.disabled = !UseSound.checked;
  132. }
  133.  
  134. function OnUseHotKeysChanged()
  135. {
  136.     HotKeyModifer1.disabled = !UseHotKeys.checked;
  137.     HotKeyModifer2.disabled = !UseHotKeys.checked;
  138.     HotKey1.disabled = !UseHotKeys.checked;
  139.     HotKey2.disabled = !UseHotKeys.checked;
  140.     HotKeyText1.disabled = !UseHotKeys.checked;
  141.     HotKeyText2.disabled = !UseHotKeys.checked;
  142. }
  143.  
  144. function OnSoundFile()
  145. {
  146.     SoundFile = System.Gadget.document.parentWindow.Net.GetSoundFile(SoundFile, Localized["SoundSelectionTitle"]);
  147. }
  148.  
  149. function TipsBack()
  150. {
  151.     if ((event.keyCode && event.keyCode != 32) || (event.button == 2))
  152.     {
  153.         return false;
  154.     }
  155.     if(CurrentTip == 0)
  156.         CurrentTip = parseInt(Localized['NumTips']) - 1;
  157.     else
  158.         CurrentTip--;
  159.     TipText.innerHTML = Localized['Tip_'+(CurrentTip+1)];
  160.     currentIndex.innerHTML = "" + (CurrentTip+1) + Localized['TipOf'] + (parseInt(Localized['NumTips']));
  161.     return true;
  162. }
  163.  
  164. function TipsForward()
  165. {
  166.     if ((event.keyCode && event.keyCode != 32) || (event.button == 2))
  167.     {
  168.         return false;
  169.     }
  170.     if(CurrentTip == parseInt(Localized['NumTips'])-1)
  171.         CurrentTip = 0;
  172.     else
  173.         CurrentTip++;
  174.     TipText.innerHTML = Localized['Tip_'+(CurrentTip+1)];
  175.     currentIndex.innerHTML = "" + (CurrentTip+1) + Localized['TipOf'] + (parseInt(Localized['NumTips']));
  176.     return true;
  177. }
  178.  
  179. function swapImage(img, state)
  180. {
  181.     img.src = "images/settings_" + img.src.split("_")[1] + "_" + state + ".png";
  182. }
  183.