home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 123 / cdrom123.iso / essenc / extens / nlinkf / Linkification.xpi / chrome / linkification.jar / content / linkification / linkificationOptions.js < prev    next >
Encoding:
Text File  |  2004-09-11  |  11.0 KB  |  230 lines

  1. var objLinkOptions = {
  2.     LinkOptions_Init: function()
  3.     {
  4.         this.sDefaultProtocol = "h..p:http,h...s:https,f.p:ftp,news:news,nntp:nntp,telnet:telnet";
  5.         this.sDefaultSubdomain = "www:http,ftp:ftp";
  6.         this.sDefaultSiteList = "localhost,.google.com";
  7.         this.sDefaultExcludeTagList = "a,script,select,option,textarea";
  8.         this.sDefaultSpaceTagList = "br,table,tbody,tr,td,p,div,input,ul,ol,li";
  9.  
  10.         this.prefService = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch('linkification.settings.');
  11.  
  12.         this.ndTextBox = document.getElementById('linkify_textbox');
  13.         this.ndTextColor = document.getElementById('linkify_textcolorpicker');
  14.         this.ndBackgroundBox = document.getElementById('linkify_backgroundbox');
  15.         this.ndBackgroundColor = document.getElementById('linkify_backgroundcolorpicker');
  16.         this.ndLinkifyToggle = document.getElementById('linkify_toggle');
  17.         this.ndLinkifyDoubleClick = document.getElementById('linkify_doubleclick');
  18.         this.ndLinkifyOnClick = document.getElementById('linkify_onclick');
  19.         this.ndPopupToggle = document.getElementById('linkify_popuptoggle');
  20.         this.ndOpenInTab = document.getElementById('linkify_openintabbox');
  21.         this.ndOpenInBG = document.getElementById('linkify_opentabinbgbox');
  22.         this.ndSpoofURL = document.getElementById('linkify_spoofurlbox');
  23.         this.ndImageToggle = document.getElementById('linkify_image');
  24.         this.ndLinkifyHTTP = document.getElementById('linkify_http');
  25.         this.ndLinkifyEmail = document.getElementById('linkify_email');
  26.         this.ndLinkifyWWW = document.getElementById('linkify_www');
  27.         this.ndLinkifyIP = document.getElementById('linkify_ip');
  28.         this.ndLinkifyOther = document.getElementById('linkify_other');
  29.         this.ndLinkifyTextProtocolList = document.getElementById('linkify_textprotocollist');
  30.         this.ndLinkifyDefaultProtocol = document.getElementById('linkify_defaultprotocol');
  31.         this.ndLinkifySubdomainProtocolList = document.getElementById('linkify_subdomainprotocollist');
  32.         this.ndLinkifyDefaultSubdomain = document.getElementById('linkify_defaultsubdomain');
  33.         this.ndLinkifySiteList = document.getElementById('linkify_sitelist');
  34.         this.ndLinkifyDefaultSiteList = document.getElementById('linkify_defaultsitelist');
  35.         this.ndLinkifyExcludeTagList = document.getElementById('linkify_excludetaglist');
  36.         this.ndLinkifyDefaultExcludeTagList = document.getElementById('linkify_defaultexcludetags');
  37.         this.ndLinkifySpaceTagList = document.getElementById('linkify_spacetaglist');
  38.         this.ndLinkifyDefaultSpaceTagList = document.getElementById('linkify_defaultspacetags');
  39.         this.ndLinkifyCharLimitEnabled = document.getElementById('linkify_charlimitenabled');
  40.         this.ndLinkifyCharLimit = document.getElementById('linkify_charlimit');
  41.  
  42.         this.ndTextBox.checked = false;
  43.         this.ndTextColor.color = "#006620";
  44.         this.ndBackgroundBox.checked = false;
  45.         this.ndBackgroundColor.color = "#FFF9AB";
  46.         this.ndLinkifyToggle.checked = true;
  47.         this.ndLinkifyDoubleClick.checked = true;
  48.         this.ndLinkifyOnClick.checked = true;
  49.         this.ndPopupToggle.checked = false;
  50.         this.ndOpenInTab.checked = false;
  51.         this.ndOpenInBG.checked = false;
  52.         this.ndSpoofURL.checked = true;
  53.         this.ndImageToggle.checked = true;
  54.         this.ndLinkifyHTTP.checked = true;
  55.         this.ndLinkifyEmail.checked = true;
  56.         this.ndLinkifyWWW.checked = true;
  57.         this.ndLinkifyIP.checked = true;
  58.         this.ndLinkifyOther.checked = true;
  59.         this.ndLinkifyTextProtocolList.value = this.sDefaultProtocol;
  60.         this.ndLinkifySubdomainProtocolList.value = this.sDefaultSubdomain;
  61.         this.ndLinkifySiteList.value = this.sDefaultSiteList;
  62.         this.ndLinkifyExcludeTagList.value = this.sDefaultExcludeTagList;
  63.         this.ndLinkifySpaceTagList.value = this.sDefaultSpaceTagList;
  64.         this.ndLinkifyCharLimitEnabled.checked = true;
  65.         this.ndLinkifyCharLimit.value = 15000;
  66.  
  67.         if (this.prefService.prefHasUserValue('Linkify_HighlightText'))
  68.         {
  69.             this.ndTextBox.checked = this.prefService.getBoolPref('Linkify_HighlightText');
  70.         }
  71.         if (this.prefService.prefHasUserValue('Linkify_HighlightBG'))
  72.         {
  73.             this.ndBackgroundBox.checked = this.prefService.getBoolPref('Linkify_HighlightBG');
  74.         }
  75.         if (this.prefService.prefHasUserValue('Linkify_TextColor'))
  76.         {
  77.             this.ndTextColor.color = this.prefService.getCharPref('Linkify_TextColor');
  78.         }
  79.         if (this.prefService.prefHasUserValue('Linkify_BackgroundColor'))
  80.         {
  81.             this.ndBackgroundColor.color = this.prefService.getCharPref('Linkify_BackgroundColor');
  82.         }
  83.         if (this.prefService.prefHasUserValue('Linkify_Toggle'))
  84.         {
  85.             this.ndLinkifyToggle.checked = this.prefService.getBoolPref('Linkify_Toggle');
  86.         }
  87.         if (this.prefService.prefHasUserValue('Linkify_DoubleClick'))
  88.         {
  89.             this.ndLinkifyDoubleClick.checked = this.prefService.getBoolPref('Linkify_DoubleClick');
  90.         }
  91.         if (this.prefService.prefHasUserValue('Linkify_OnClick'))
  92.         {
  93.             this.ndLinkifyOnClick.checked = this.prefService.getBoolPref('Linkify_OnClick');
  94.         }
  95.         if (this.prefService.prefHasUserValue('Linkify_Popup_Toggle'))
  96.         {
  97.             this.ndPopupToggle.checked = this.prefService.getBoolPref('Linkify_Popup_Toggle');
  98.         }
  99.         if (this.prefService.prefHasUserValue('Linkify_OpenInTab'))
  100.         {
  101.             this.ndOpenInTab.checked = this.prefService.getBoolPref('Linkify_OpenInTab');
  102.         }
  103.         if (this.prefService.prefHasUserValue('Linkify_OpenTabInBG'))
  104.         {
  105.             this.ndOpenInBG.checked = this.prefService.getBoolPref('Linkify_OpenTabInBG');
  106.         }
  107.         if (this.prefService.prefHasUserValue('Linkify_SuppressReferer'))
  108.         {
  109.             this.ndSpoofURL.checked = this.prefService.getBoolPref('Linkify_SuppressReferer');
  110.         }
  111.         if (this.prefService.prefHasUserValue('Linkify_LinkifyImages'))
  112.         {
  113.             this.ndImageToggle.checked = this.prefService.getBoolPref('Linkify_LinkifyImages');
  114.         }
  115.         if (this.prefService.prefHasUserValue('Linkify_HTTP'))
  116.         {
  117.             this.ndLinkifyHTTP.checked = this.prefService.getBoolPref('Linkify_HTTP');
  118.         }
  119.         if (this.prefService.prefHasUserValue('Linkify_Email'))
  120.         {
  121.             this.ndLinkifyEmail.checked = this.prefService.getBoolPref('Linkify_Email');
  122.         }
  123.         if (this.prefService.prefHasUserValue('Linkify_WWW'))
  124.         {
  125.             this.ndLinkifyWWW.checked = this.prefService.getBoolPref('Linkify_WWW');
  126.         }
  127.         if (this.prefService.prefHasUserValue('Linkify_IP'))
  128.         {
  129.             this.ndLinkifyIP.checked = this.prefService.getBoolPref('Linkify_IP');
  130.         }
  131.         if (this.prefService.prefHasUserValue('Linkify_Other'))
  132.         {
  133.             this.ndLinkifyOther.checked = this.prefService.getBoolPref('Linkify_Other');
  134.         }
  135.         if (this.prefService.prefHasUserValue('Linkify_TextProtocolList'))
  136.         {
  137.             this.ndLinkifyTextProtocolList.value = this.prefService.getCharPref('Linkify_TextProtocolList');
  138.         }
  139.         if (this.prefService.prefHasUserValue('Linkify_SubdomainProtocolList'))
  140.         {
  141.             this.ndLinkifySubdomainProtocolList.value = this.prefService.getCharPref('Linkify_SubdomainProtocolList');
  142.         }
  143.         if (this.prefService.prefHasUserValue('Linkify_SiteList'))
  144.         {
  145.             this.ndLinkifySiteList.value = this.prefService.getCharPref('Linkify_SiteList');
  146.         }
  147.         if (this.prefService.prefHasUserValue('Linkify_ExcludeTagList'))
  148.         {
  149.             this.ndLinkifyExcludeTagList.value = this.prefService.getCharPref('Linkify_ExcludeTagList');
  150.         }
  151.         if (this.prefService.prefHasUserValue('Linkify_SpaceTagList'))
  152.         {
  153.             this.ndLinkifySpaceTagList.value = this.prefService.getCharPref('Linkify_SpaceTagList');
  154.         }
  155.         if (this.prefService.prefHasUserValue('Linkify_CharLimitEnabled'))
  156.         {
  157.             this.ndLinkifyCharLimitEnabled.checked = this.prefService.getBoolPref('Linkify_CharLimitEnabled');
  158.         }
  159.         if (this.prefService.prefHasUserValue('Linkify_CharLimit'))
  160.         {
  161.             this.ndLinkifyCharLimit.value = this.prefService.getIntPref('Linkify_CharLimit');
  162.         }
  163.  
  164.         this.LinkOptions_Toggle();
  165.     },
  166.  
  167.     LinkOptions_Update: function()
  168.     {
  169.         this.prefService.setBoolPref('Linkify_HighlightText', this.ndTextBox.checked);
  170.         this.prefService.setCharPref('Linkify_TextColor', this.ndTextColor.color);
  171.         this.prefService.setBoolPref('Linkify_HighlightBG', this.ndBackgroundBox.checked);
  172.         this.prefService.setCharPref('Linkify_BackgroundColor', this.ndBackgroundColor.color);
  173.         this.prefService.setBoolPref('Linkify_Toggle', this.ndLinkifyToggle.checked);
  174.         this.prefService.setBoolPref('Linkify_DoubleClick', this.ndLinkifyDoubleClick.checked);
  175.         this.prefService.setBoolPref('Linkify_OnClick', this.ndLinkifyOnClick.checked);
  176.         this.prefService.setBoolPref('Linkify_Popup_Toggle', this.ndPopupToggle.checked);
  177.         this.prefService.setBoolPref('Linkify_OpenInTab', this.ndOpenInTab.checked);
  178.         this.prefService.setBoolPref('Linkify_OpenTabInBG', this.ndOpenInBG.checked);
  179.         this.prefService.setBoolPref('Linkify_SuppressReferer', this.ndSpoofURL.checked);
  180.         this.prefService.setBoolPref('Linkify_LinkifyImages', this.ndImageToggle.checked);
  181.         this.prefService.setBoolPref('Linkify_HTTP', this.ndLinkifyHTTP.checked);
  182.         this.prefService.setBoolPref('Linkify_Email', this.ndLinkifyEmail.checked);
  183.         this.prefService.setBoolPref('Linkify_WWW', this.ndLinkifyWWW.checked);
  184.         this.prefService.setBoolPref('Linkify_IP', this.ndLinkifyIP.checked);
  185.         this.prefService.setBoolPref('Linkify_Other', this.ndLinkifyOther.checked);
  186.         this.prefService.setCharPref('Linkify_TextProtocolList', this.ndLinkifyTextProtocolList.value);
  187.         this.prefService.setCharPref('Linkify_SubdomainProtocolList', this.ndLinkifySubdomainProtocolList.value);
  188.         this.prefService.setCharPref('Linkify_SiteList', this.ndLinkifySiteList.value);
  189.         this.prefService.setCharPref('Linkify_ExcludeTagList', this.ndLinkifyExcludeTagList.value);
  190.         this.prefService.setCharPref('Linkify_SpaceTagList', this.ndLinkifySpaceTagList.value);
  191.         this.prefService.setBoolPref('Linkify_CharLimitEnabled', this.ndLinkifyCharLimitEnabled.checked);
  192.         this.prefService.setIntPref('Linkify_CharLimit', this.ndLinkifyCharLimit.value);
  193.     },
  194.  
  195.     LinkOptions_Toggle: function()
  196.     {
  197.         this.ndOpenInBG.disabled = !this.ndOpenInTab.checked;
  198.         this.ndLinkifyCharLimit.disabled = !this.ndLinkifyCharLimitEnabled.checked;
  199.     },
  200.  
  201.     LinkOptions_DefaultProtocol: function()
  202.     {
  203.         this.prefService.setCharPref('Linkify_TextProtocolList', this.sDefaultProtocol);
  204.         this.ndLinkifyTextProtocolList.value = this.prefService.getCharPref('Linkify_TextProtocolList');
  205.     },
  206.  
  207.     LinkOptions_DefaultSubdomain: function()
  208.     {
  209.         this.prefService.setCharPref('Linkify_SubdomainProtocolList', this.sDefaultSubdomain);
  210.         this.ndLinkifySubdomainProtocolList.value = this.prefService.getCharPref('Linkify_SubdomainProtocolList');
  211.     },
  212.  
  213.     LinkOptions_DefaultSiteList: function()
  214.     {
  215.         this.prefService.setCharPref('Linkify_SiteList', this.sDefaultSiteList);
  216.         this.ndLinkifySiteList.value = this.prefService.getCharPref('Linkify_SiteList');
  217.     },
  218.  
  219.     LinkOptions_DefaultExcludeTags: function()
  220.     {
  221.         this.prefService.setCharPref('Linkify_ExcludeTagList', this.sDefaultExcludeTagList);
  222.         this.ndLinkifyExcludeTagList.value = this.prefService.getCharPref('Linkify_ExcludeTagList');
  223.     },
  224.  
  225.     LinkOptions_DefaultSpaceTags: function()
  226.     {
  227.         this.prefService.setCharPref('Linkify_SpaceTagList', this.sDefaultSpaceTagList);
  228.         this.ndLinkifySpaceTagList.value = this.prefService.getCharPref('Linkify_SpaceTagList');
  229.     }
  230. };