home *** CD-ROM | disk | FTP | other *** search
- var objLinkOptions = {
- LinkOptions_Init: function()
- {
- this.sDefaultProtocol = "h..p:http,h...s:https,f.p:ftp,news:news,nntp:nntp,telnet:telnet";
- this.sDefaultSubdomain = "www:http,ftp:ftp";
- this.sDefaultSiteList = "localhost,.google.com";
- this.sDefaultExcludeTagList = "a,script,select,option,textarea";
- this.sDefaultSpaceTagList = "br,table,tbody,tr,td,p,div,input,ul,ol,li";
-
- this.prefService = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch('linkification.settings.');
-
- this.ndTextBox = document.getElementById('linkify_textbox');
- this.ndTextColor = document.getElementById('linkify_textcolorpicker');
- this.ndBackgroundBox = document.getElementById('linkify_backgroundbox');
- this.ndBackgroundColor = document.getElementById('linkify_backgroundcolorpicker');
- this.ndLinkifyToggle = document.getElementById('linkify_toggle');
- this.ndLinkifyDoubleClick = document.getElementById('linkify_doubleclick');
- this.ndLinkifyOnClick = document.getElementById('linkify_onclick');
- this.ndPopupToggle = document.getElementById('linkify_popuptoggle');
- this.ndOpenInTab = document.getElementById('linkify_openintabbox');
- this.ndOpenInBG = document.getElementById('linkify_opentabinbgbox');
- this.ndSpoofURL = document.getElementById('linkify_spoofurlbox');
- this.ndImageToggle = document.getElementById('linkify_image');
- this.ndLinkifyHTTP = document.getElementById('linkify_http');
- this.ndLinkifyEmail = document.getElementById('linkify_email');
- this.ndLinkifyWWW = document.getElementById('linkify_www');
- this.ndLinkifyIP = document.getElementById('linkify_ip');
- this.ndLinkifyOther = document.getElementById('linkify_other');
- this.ndLinkifyTextProtocolList = document.getElementById('linkify_textprotocollist');
- this.ndLinkifyDefaultProtocol = document.getElementById('linkify_defaultprotocol');
- this.ndLinkifySubdomainProtocolList = document.getElementById('linkify_subdomainprotocollist');
- this.ndLinkifyDefaultSubdomain = document.getElementById('linkify_defaultsubdomain');
- this.ndLinkifySiteList = document.getElementById('linkify_sitelist');
- this.ndLinkifyDefaultSiteList = document.getElementById('linkify_defaultsitelist');
- this.ndLinkifyExcludeTagList = document.getElementById('linkify_excludetaglist');
- this.ndLinkifyDefaultExcludeTagList = document.getElementById('linkify_defaultexcludetags');
- this.ndLinkifySpaceTagList = document.getElementById('linkify_spacetaglist');
- this.ndLinkifyDefaultSpaceTagList = document.getElementById('linkify_defaultspacetags');
- this.ndLinkifyCharLimitEnabled = document.getElementById('linkify_charlimitenabled');
- this.ndLinkifyCharLimit = document.getElementById('linkify_charlimit');
-
- this.ndTextBox.checked = false;
- this.ndTextColor.color = "#006620";
- this.ndBackgroundBox.checked = false;
- this.ndBackgroundColor.color = "#FFF9AB";
- this.ndLinkifyToggle.checked = true;
- this.ndLinkifyDoubleClick.checked = true;
- this.ndLinkifyOnClick.checked = true;
- this.ndPopupToggle.checked = false;
- this.ndOpenInTab.checked = false;
- this.ndOpenInBG.checked = false;
- this.ndSpoofURL.checked = true;
- this.ndImageToggle.checked = true;
- this.ndLinkifyHTTP.checked = true;
- this.ndLinkifyEmail.checked = true;
- this.ndLinkifyWWW.checked = true;
- this.ndLinkifyIP.checked = true;
- this.ndLinkifyOther.checked = true;
- this.ndLinkifyTextProtocolList.value = this.sDefaultProtocol;
- this.ndLinkifySubdomainProtocolList.value = this.sDefaultSubdomain;
- this.ndLinkifySiteList.value = this.sDefaultSiteList;
- this.ndLinkifyExcludeTagList.value = this.sDefaultExcludeTagList;
- this.ndLinkifySpaceTagList.value = this.sDefaultSpaceTagList;
- this.ndLinkifyCharLimitEnabled.checked = true;
- this.ndLinkifyCharLimit.value = 15000;
-
- if (this.prefService.prefHasUserValue('Linkify_HighlightText'))
- {
- this.ndTextBox.checked = this.prefService.getBoolPref('Linkify_HighlightText');
- }
- if (this.prefService.prefHasUserValue('Linkify_HighlightBG'))
- {
- this.ndBackgroundBox.checked = this.prefService.getBoolPref('Linkify_HighlightBG');
- }
- if (this.prefService.prefHasUserValue('Linkify_TextColor'))
- {
- this.ndTextColor.color = this.prefService.getCharPref('Linkify_TextColor');
- }
- if (this.prefService.prefHasUserValue('Linkify_BackgroundColor'))
- {
- this.ndBackgroundColor.color = this.prefService.getCharPref('Linkify_BackgroundColor');
- }
- if (this.prefService.prefHasUserValue('Linkify_Toggle'))
- {
- this.ndLinkifyToggle.checked = this.prefService.getBoolPref('Linkify_Toggle');
- }
- if (this.prefService.prefHasUserValue('Linkify_DoubleClick'))
- {
- this.ndLinkifyDoubleClick.checked = this.prefService.getBoolPref('Linkify_DoubleClick');
- }
- if (this.prefService.prefHasUserValue('Linkify_OnClick'))
- {
- this.ndLinkifyOnClick.checked = this.prefService.getBoolPref('Linkify_OnClick');
- }
- if (this.prefService.prefHasUserValue('Linkify_Popup_Toggle'))
- {
- this.ndPopupToggle.checked = this.prefService.getBoolPref('Linkify_Popup_Toggle');
- }
- if (this.prefService.prefHasUserValue('Linkify_OpenInTab'))
- {
- this.ndOpenInTab.checked = this.prefService.getBoolPref('Linkify_OpenInTab');
- }
- if (this.prefService.prefHasUserValue('Linkify_OpenTabInBG'))
- {
- this.ndOpenInBG.checked = this.prefService.getBoolPref('Linkify_OpenTabInBG');
- }
- if (this.prefService.prefHasUserValue('Linkify_SuppressReferer'))
- {
- this.ndSpoofURL.checked = this.prefService.getBoolPref('Linkify_SuppressReferer');
- }
- if (this.prefService.prefHasUserValue('Linkify_LinkifyImages'))
- {
- this.ndImageToggle.checked = this.prefService.getBoolPref('Linkify_LinkifyImages');
- }
- if (this.prefService.prefHasUserValue('Linkify_HTTP'))
- {
- this.ndLinkifyHTTP.checked = this.prefService.getBoolPref('Linkify_HTTP');
- }
- if (this.prefService.prefHasUserValue('Linkify_Email'))
- {
- this.ndLinkifyEmail.checked = this.prefService.getBoolPref('Linkify_Email');
- }
- if (this.prefService.prefHasUserValue('Linkify_WWW'))
- {
- this.ndLinkifyWWW.checked = this.prefService.getBoolPref('Linkify_WWW');
- }
- if (this.prefService.prefHasUserValue('Linkify_IP'))
- {
- this.ndLinkifyIP.checked = this.prefService.getBoolPref('Linkify_IP');
- }
- if (this.prefService.prefHasUserValue('Linkify_Other'))
- {
- this.ndLinkifyOther.checked = this.prefService.getBoolPref('Linkify_Other');
- }
- if (this.prefService.prefHasUserValue('Linkify_TextProtocolList'))
- {
- this.ndLinkifyTextProtocolList.value = this.prefService.getCharPref('Linkify_TextProtocolList');
- }
- if (this.prefService.prefHasUserValue('Linkify_SubdomainProtocolList'))
- {
- this.ndLinkifySubdomainProtocolList.value = this.prefService.getCharPref('Linkify_SubdomainProtocolList');
- }
- if (this.prefService.prefHasUserValue('Linkify_SiteList'))
- {
- this.ndLinkifySiteList.value = this.prefService.getCharPref('Linkify_SiteList');
- }
- if (this.prefService.prefHasUserValue('Linkify_ExcludeTagList'))
- {
- this.ndLinkifyExcludeTagList.value = this.prefService.getCharPref('Linkify_ExcludeTagList');
- }
- if (this.prefService.prefHasUserValue('Linkify_SpaceTagList'))
- {
- this.ndLinkifySpaceTagList.value = this.prefService.getCharPref('Linkify_SpaceTagList');
- }
- if (this.prefService.prefHasUserValue('Linkify_CharLimitEnabled'))
- {
- this.ndLinkifyCharLimitEnabled.checked = this.prefService.getBoolPref('Linkify_CharLimitEnabled');
- }
- if (this.prefService.prefHasUserValue('Linkify_CharLimit'))
- {
- this.ndLinkifyCharLimit.value = this.prefService.getIntPref('Linkify_CharLimit');
- }
-
- this.LinkOptions_Toggle();
- },
-
- LinkOptions_Update: function()
- {
- this.prefService.setBoolPref('Linkify_HighlightText', this.ndTextBox.checked);
- this.prefService.setCharPref('Linkify_TextColor', this.ndTextColor.color);
- this.prefService.setBoolPref('Linkify_HighlightBG', this.ndBackgroundBox.checked);
- this.prefService.setCharPref('Linkify_BackgroundColor', this.ndBackgroundColor.color);
- this.prefService.setBoolPref('Linkify_Toggle', this.ndLinkifyToggle.checked);
- this.prefService.setBoolPref('Linkify_DoubleClick', this.ndLinkifyDoubleClick.checked);
- this.prefService.setBoolPref('Linkify_OnClick', this.ndLinkifyOnClick.checked);
- this.prefService.setBoolPref('Linkify_Popup_Toggle', this.ndPopupToggle.checked);
- this.prefService.setBoolPref('Linkify_OpenInTab', this.ndOpenInTab.checked);
- this.prefService.setBoolPref('Linkify_OpenTabInBG', this.ndOpenInBG.checked);
- this.prefService.setBoolPref('Linkify_SuppressReferer', this.ndSpoofURL.checked);
- this.prefService.setBoolPref('Linkify_LinkifyImages', this.ndImageToggle.checked);
- this.prefService.setBoolPref('Linkify_HTTP', this.ndLinkifyHTTP.checked);
- this.prefService.setBoolPref('Linkify_Email', this.ndLinkifyEmail.checked);
- this.prefService.setBoolPref('Linkify_WWW', this.ndLinkifyWWW.checked);
- this.prefService.setBoolPref('Linkify_IP', this.ndLinkifyIP.checked);
- this.prefService.setBoolPref('Linkify_Other', this.ndLinkifyOther.checked);
- this.prefService.setCharPref('Linkify_TextProtocolList', this.ndLinkifyTextProtocolList.value);
- this.prefService.setCharPref('Linkify_SubdomainProtocolList', this.ndLinkifySubdomainProtocolList.value);
- this.prefService.setCharPref('Linkify_SiteList', this.ndLinkifySiteList.value);
- this.prefService.setCharPref('Linkify_ExcludeTagList', this.ndLinkifyExcludeTagList.value);
- this.prefService.setCharPref('Linkify_SpaceTagList', this.ndLinkifySpaceTagList.value);
- this.prefService.setBoolPref('Linkify_CharLimitEnabled', this.ndLinkifyCharLimitEnabled.checked);
- this.prefService.setIntPref('Linkify_CharLimit', this.ndLinkifyCharLimit.value);
- },
-
- LinkOptions_Toggle: function()
- {
- this.ndOpenInBG.disabled = !this.ndOpenInTab.checked;
- this.ndLinkifyCharLimit.disabled = !this.ndLinkifyCharLimitEnabled.checked;
- },
-
- LinkOptions_DefaultProtocol: function()
- {
- this.prefService.setCharPref('Linkify_TextProtocolList', this.sDefaultProtocol);
- this.ndLinkifyTextProtocolList.value = this.prefService.getCharPref('Linkify_TextProtocolList');
- },
-
- LinkOptions_DefaultSubdomain: function()
- {
- this.prefService.setCharPref('Linkify_SubdomainProtocolList', this.sDefaultSubdomain);
- this.ndLinkifySubdomainProtocolList.value = this.prefService.getCharPref('Linkify_SubdomainProtocolList');
- },
-
- LinkOptions_DefaultSiteList: function()
- {
- this.prefService.setCharPref('Linkify_SiteList', this.sDefaultSiteList);
- this.ndLinkifySiteList.value = this.prefService.getCharPref('Linkify_SiteList');
- },
-
- LinkOptions_DefaultExcludeTags: function()
- {
- this.prefService.setCharPref('Linkify_ExcludeTagList', this.sDefaultExcludeTagList);
- this.ndLinkifyExcludeTagList.value = this.prefService.getCharPref('Linkify_ExcludeTagList');
- },
-
- LinkOptions_DefaultSpaceTags: function()
- {
- this.prefService.setCharPref('Linkify_SpaceTagList', this.sDefaultSpaceTagList);
- this.ndLinkifySpaceTagList.value = this.prefService.getCharPref('Linkify_SpaceTagList');
- }
- };