existing contextvar searchshield = searchshield || {};searchshield.clockUrl;// constantssearchshield.SCORE_SS_SAFE = 1;searchshield.SCORE_SS_CAUTION = 2;searchshield.SCORE_SS_WARNING = 3;searchshield.SCORE_SS_BLOCK = 4;searchshield.SCORE_SS_VERISIGN = 7;searchshield.BLOCK_NONE = 0;searchshield.BLOCK_NORMAL = 1;searchshield.BLOCK_PHISH = 2;searchshield.BLOCK_YAHOO = 3;searchshield.XPLCHECK_RESULT_SEV_NONE = 0;searchshield.XPLCHECK_RESULT_SEV_LOW = 1;searchshield.XPLCHECK_RESULT_SEV_MED = 2;searchshield.XPLCHECK_RESULT_SEV_BLOCK = 3;searchshield.VERISIGN_SPLIT_NOTEST = 0;searchshield.VERISIGN_SPLIT_TESTA = 1;searchshield.VERISIGN_SPLIT_TESTB = 2;searchshield.needLivePhishCheck = false;searchshield.allowedSites = [];searchshield.enabled = function (doc){ var result = searchshield.avgCallFunc(doc, 'GetSearchEnabled'); return (result == '1' ? 1 : 0);};searchshield.init = function (doc){ if ((doc == null) || (doc.location == null) || (doc.location.href.search(/about:/) != -1)) return; if (!searchshield.enabled(doc)) return; if (!g_aEng) g_aEng = searchshield.Search.prototype.detectEngine(doc.location.href); if (!g_aEng) return; // init search object (not declared or is null) if (typeof xplSearch === 'undefined') { // global xplSearch = new searchshield.Search(); // reset the links added flag xplSearch.new_links = false; xplSearch.doc = doc; xplSearch.href = xplSearch.doc.location.href; xplSearch.uri = searchshield.parseLink(xplSearch.href); xplSearch.engine = new searchshield[g_aEng+'SearchEngine'](xplSearch) xplSearch.addEngine(xplSearch.engine); searchshield.launch(doc); } if (doc.location.href != g_loc) { g_loc = doc.location.href; if ((typeof xplSearch !== 'undefined') && (xplSearch != null)) searchshield.launch(doc); }};searchshield.launch = function (doc){ // IE specific check searchshield.quirksMode = (self.top.document.compatMode == 'BackCompat'); searchshield.docMode = parseInt(navigator.userAgent.split('MSIE')[1]); if ((self === top) && (self.document === doc)) { if (!xplSearch.engine) return; // set verdict display config xplSearch.engine.setRatingsConfig(doc); // init the alert popup searchshield.initPopupAlert(doc); if (xplSearch.engine.type != 'inline') { // save function reference for memory clean up later var fn = function(event){avglsflyover.hide(null)}; //hide flyover if these events occur window.detachEvent('onscroll', fn); window.attachEvent('onscroll', fn); doc.detachEvent('onkeydown', fn); doc.attachEvent('onkeydown', fn); } // only start monitor on top doc searchshield.avgPageMonitor.start(doc); } return;};// search monitors and processors - doc is always top most documentsearchshield.avgPageMonitor = { previousUrl: null, start: function(doc){ searchshield.avgPageMonitor.stop(); searchshield.avgPageMonitor.process(doc); searchshield.avgPageMonitor.timeoutID = window.setTimeout(function(){searchshield.avgPageMonitor.start(doc)}, 1000); }, process: function(doc){ var currentUrl = doc.location.href; var refresh = 0; if (this.previousUrl != currentUrl) { this.previousUrl = currentUrl; avgreport.scanResult(doc, currentUrl); refresh = (xplSearch.engine.name == 'google') ? 1 : 0; } searchshield.avgProcessSearch(doc, refresh); }, stop: function(){ if (searchshield.avgPageMonitor.timeoutID) { window.clearTimeout(searchshield.avgPageMonitor.timeoutID); delete searchshield.avgPageMonitor.timeoutID; } }};searchshield.avgProcessSearch = function (doc, refresh){ // doc may be about:Tabs or about:Blank if (!doc) return; if (!searchshield.enabled(doc)) return; if (!searchshield.clockUrl) searchshield.clockUrl = searchshield.avgCallFunc(doc, 'GetIconUrl', '0'); xplSearch.clockUrl = searchshield.clockUrl if (!xplSearch.engine) return; // get result links xplSearch.links = []; var links = searchshield.avgGetSearchLinks(doc, xplSearch.engine, refresh); searchshield.needLivePhishCheck = false; for (var i=0; i < links.length; i++) { var isPhishing = searchshield.avglsCheckandUpdate(links[i]); if (isPhishing) searchshield.needLivePhishCheck = true; } if (searchshield.needLivePhishCheck) { var prev = '1'; if ( xplSearch.engine.type == 'inline' ) prev = '0'; searchshield.avgCallFunc(doc, 'GetPhishingResults', prev); searchshield.needLivePhishCheck = false; } else if (links.length > 0 && xplSearch.engine.type != 'inline') { searchshield.avgCallFunc(doc, 'FinalScanComplete'); } // attach click handlers for popup alerts doc.body.detachEvent("onclick", searchshield.blockClick); doc.body.attachEvent("onclick", searchshield.blockClick); doc.body.detachEvent("ondblclick", searchshield.blockClick); doc.body.attachEvent("ondblclick", searchshield.blockClick);};searchshield.avgGetSearchLinks = function (doc, engine, refresh){ if (!doc.body) return; var alltags = doc.body.getElementsByTagName('a'); for (var i = 0; i < alltags.length; i++) { if ( !refresh ) { // no checked test if refreshing - google if (alltags[i].getAttribute('avglschecked')) continue; } // mark search result anchor so it isn't processed repeatedly alltags[i].setAttribute('avglschecked', '1'); // ignore linked resources if (alltags[i].tagName == 'LINK') continue; // ignore in-page bookmarks and javascript if ((!alltags[i].href) || (alltags[i].href.charAt(0) == '#') || // in-page bookmark (alltags[i].href.indexOf("javascript") == 0)) continue; // ignore verdicts if (/XPLSS_/.test(alltags[i].id)) continue; // ignore flyover anchors if (/avgthreatlabs/.test(alltags[i].host)) continue; var href =