'; html += '
'; html += riskCategory + '
'; html += riskName + '
'; html += '
'; return html; }, popup: function (event, flyover, nSeverity, blUrl) { //set verdict info var div = document.getElementById('XPLSS_InlineFlyover'); if (div == null) return; // blUrl is an object for a blacklisted short url // when it is passed get the final url if (blUrl != undefined) { var finalUrl = searchshield.avgCallFunc(document, 'GetFinalUrl', blUrl.sUrl); var riskUrl = blUrl.sUrl; if ((finalUrl) && (searchshield.FilterUrl(finalUrl, xplSearch.engine.shortened_urls))) finalUrl = avglsinlineflyover.getUrlFromQueryString(finalUrl); var riskName = blUrl.riskNameLabel + finalUrl; flyover = avglsinlineflyover.build(blUrl.riskCategory, riskName, blUrl.bgColor, blUrl.borderColor); } div.innerHTML = flyover; div.style.width = "auto"; //reset width div.style.position = "absolute"; if (searchshield.quirksMode || searchshield.docMode <= 7) { var className = xplSearch.engine.inline.color.classname[nSeverity]; var imgBase = "linkscanner://" + className + "_inline_border_"; var divWidth = searchshield.elementSize(div)[0]; //round up to nearest 10 to avoid intentional wrapping in div var flyoverWidth = divWidth + (10 - Math.ceil(10*((divWidth/10) - Math.floor(divWidth/10)))); var ilfoDivs = div.getElementsByTagName("div"); if (ilfoDivs && ilfoDivs.length == 5) { //div.style.fontSize = "10px"; div.style.backgroundImage = "url(" + imgBase + "tl.png)"; div.style.backgroundPosition = "0 0"; div.style.backgroundRepeat = "no-repeat"; div.style.width = flyoverWidth + "px"; div.style.zIndex = "9999"; // avgILFO_head ilfoDivs[0].style.backgroundImage = "url(" + imgBase + "tr.png)"; ilfoDivs[0].style.backgroundPosition = "top right"; ilfoDivs[0].style.backgroundRepeat = "no-repeat"; ilfoDivs[0].style.width = flyoverWidth + "px"; ilfoDivs[0].style.height = "5px"; // avgILFO_head div ilfoDivs[1].style.height = "5px"; // avgILFO_content ilfoDivs[2].style.backgroundImage = "url(" + imgBase + "r.png)"; ilfoDivs[2].style.backgroundPosition = "top right"; ilfoDivs[2].style.backgroundRepeat = "repeat-y"; ilfoDivs[2].style.fontSize = "10px"; ilfoDivs[2].style.color = "black"; ilfoDivs[2].style.padding = "0px 10px"; ilfoDivs[2].style.textAlign = "left"; ilfoDivs[2].style.wordWrap = "break-word"; ilfoDivs[2].style.lineHeight = "130%"; // avgILFO_foot ilfoDivs[3].style.backgroundImage = "url(" + imgBase + "bl.png)"; ilfoDivs[3].style.backgroundPosition = "bottom left"; ilfoDivs[3].style.backgroundRepeat = "no-repeat"; ilfoDivs[3].style.height = "5px"; // avgILFO_foot div ilfoDivs[4].style.backgroundImage = "url(" + imgBase + "br.png)"; ilfoDivs[4].style.backgroundPosition = "bottom right"; ilfoDivs[4].style.backgroundRepeat = "no-repeat"; ilfoDivs[4].style.width = flyoverWidth + "px"; ilfoDivs[4].style.height = "5px"; } else { div.style.fontSize = "10px"; div.style.backgroundColor = xplSearch.engine.inline.color.background[nSeverity]; div.style.border = xplSearch.engine.inline.color.border[nSeverity] + " solid 3px"; div.style.padding = "3px 8px"; } } else { // apply updated styles for new flyover content var sheets = document.styleSheets; for (var i=0; i < sheets.length; i++) { if (sheets.id && sheets.id == "avgILFOStyle") { var avgILFOStyle = sheets; break; } } if (typeof(avgILFOStyle) !== "undefined") { var className = xplSearch.engine.inline.color.classname[nSeverity]; var divWidth = searchshield.elementSize(div)[0]; //round up to nearest 10 to avoid intentional wrapping in div var flyoverWidth = divWidth + (10 - Math.ceil(10*((divWidth/10) - Math.floor(divWidth/10)))); var rules = avgILFOStyle.rules; for (var i=0; i < rules.length; i++) { var bgImg = rules.style.backgroundImage; var selText = rules.selectorText.toLowerCase(); if (bgImg) { var bgImgStyle = bgImg.replace(/default/, className); rules.style.backgroundImage = bgImgStyle; } if (((selText == ".avgilfo") || (selText == ".avgilfo_head") || (selText == ".avgilfo_foot div")) && (rules.style.width) && (rules.style.width == "0px")) { rules.style.width = (flyoverWidth) + "px"; } } } } if (!event) event = window.event; var eventTarget = event.srcElement; avglsinlineflyover.position(eventTarget); }, hide: function (event) { if (!event) event = window.event; var div = document.getElementById("XPLSS_InlineFlyover"); if (div == null) return; div.style.visibility = "hidden"; //invisible div.style.left = "-5000px"; if (!searchshield.quirksMode) { // reset flyover styles var sheets = document.styleSheets; for (var i=0; i < sheets.length; i++) { if (sheets.id && sheets.id == "avgILFOStyle") { var avgILFOStyle = sheets; break; } } if (typeof(avgILFOStyle) !== "undefined") { var rules = avgILFOStyle.rules; for (var i=0; i < rules.length; i++) { var bgImg = rules.style.backgroundImage; var selText = rules.selectorText.toLowerCase(); if (bgImg) { var bgImgStyle = bgImg.replace(/:\/\/([a-z]+)_/i, '://default_'); rules.style.backgroundImage = bgImgStyle; } if (((selText == ".avgilfo") || (selText == ".avgilfo_head") || (selText == ".avgilfo_foot div")) && (rules.style.width)) { rules.style.width = "0px"; } } } } }, position: function (imageElem) { var flyover = document.getElementById('XPLSS_InlineFlyover'); if (flyover == null) return; // relative position of flyover in relation to icon var locateX = 0; // 0=left, 1=right var locateY = 0; // 0=above, 1=below, 2=beside icon // get window sizes var winSize = searchshield.viewPortSize(); var windowX = winSize[0]; var windowY = winSize[1]; // Must know if there is a horizontal scroll bar for Firefox // for proper flyover positioning near bottom edge var scrollYWidth = winSize[2]; var scrollBarX = winSize[2] > 0 ? true : false; // get the exact size of the flyover var flyoverSize = searchshield.elementSize(flyover); var flyoverX = flyoverSize[0]; var flyoverY = flyoverSize[1]; flyover.style.width = flyoverX + "px"; // get the bounding rect for image(s) var imgRect = imageElem.getBoundingClientRect(); // half width/height (center) of element bounding rect var halfX = (imgRect.right - imgRect.left) / 2; var halfY = (imgRect.bottom- imgRect.top) / 2; // element the mouse is over, get the center position var posX = searchshield.offsetLeft(imageElem) + halfX; var posY = searchshield.offsetTop(imageElem) + halfY; var pageOffsetX = 0; var pageOffsetY = 0; var hasParentFrame = false; // normalize pos to 0 -- get amount of scrolling in browser window var scroll = searchshield.scrollSize(imageElem); pageOffsetX = scroll[0]; pageOffsetY = scroll[1]; hasParentFrame = scroll[2]; posX -= pageOffsetX; posY -= pageOffsetY; //compensate for Firefox 3 if (posX < imgRect.left) posX = imgRect.left+halfX; // setup the offsets var offsetX = posX; var offsetY = posY; // calc where to display on page if ((windowX - posX) > posX) { // right //offsetX += halfX; offsetX = imgRect.right + 3; locateX = 1; } else { //left //offsetX -= (flyoverX + halfX); offsetX = imgRect.left - flyoverX - 3; } if ((windowY - posY) > posY) { // below if (posY < (windowY/4)) { offsetY -= halfY; locateY = 1; } else { offsetY -= (flyoverY / 2) - halfY; locateY = 2; } } else { // above if ((windowY - posY) < (windowY/4)) { offsetY -= (flyoverY - halfY); } else { offsetY -= (flyoverY / 2) + halfY; locateY = 2; } } // make sure we aren't off the screen if (offsetY < 0) offsetY = 0; if ((offsetY + flyoverY) > windowY) { offsetY = windowY - flyoverY; } else if (scrollBarX && ((windowY - (posY + halfY)) < scrollYWidth)) { //verdict overlaps the horizontal scrollbar offsetY = windowY - (flyoverY + scrollYWidth); } // add page offsets back - if not in frame if (!hasParentFrame) { offsetX += pageOffsetX; offsetY += pageOffsetY; } //posX += pageOffsetX; //posY += pageOffsetY; //var paddedOffsetX = 0; //provide space between icon and flyover //var padX = 3; //if (locateX == 0) // paddedOffsetX = offsetX - padX; //else // paddedOffsetX = offsetX + padX; // set where to put the flyover flyover.style.top = offsetY + "px"; flyover.style.left = offsetX + "px"; avglsinlineflyover.display(); }, display: function () { var div = document.getElementById('XPLSS_InlineFlyover'); if (div == null) return; // show the flyover div.style.visibility = "visible"; }, imageExists: function(element) { if (element) { // check next siblings children var sibling = element.nextSibling; if ((sibling == null) || (sibling.getElementsByTagName == null)) return false; var images = sibling.getElementsByTagName("IMG"); if (images == null) return false; for (var i = 0; i < images.length; i++) { if (images.id == "avg_ls_image") return true; } } return false; }, getImage: function (anchor) { if (anchor) { var imageElem = null; var images = anchor.getElementsByTagName("img"); if (images == null) return imageElem; for (var i = 0; i < images.length; i++) { if (images.id == "avg_ls_image") { imageElem = images; break; } } return imageElem; } }, getUrlFromQueryString: function (inUrl) { var url = inUrl; var uri = searchshield.parseLink(unescape(inUrl)); if (uri.source != null) { // regexp failed so used split to parse url var qsUrl = uri.source.indexOf("?url="); if (qsUrl != -1) url = uri.source.substring(qsUrl + 5); else url = uri.source; } else if ((uri.qsArray.url != null) && (uri.qsArray.url.length > 0)) { url = uri.qsArray.url; } return url; }, mouseOverHandler: function (e, doc, engine) { if (e && e.srcElement && e.srcElement.href) { // need to keep a reference to the function registered // by the listener to be able to remove it. var handlerFunc = arguments.callee; var element = e.srcElement; var href = e.srcElement.href; // need an engine if (!engine) return; // check if it has an image already if (avglsinlineflyover.imageExists(element)) return; // add the image, returns the anchor not the image var new_element = engine.add_inline_image(doc, element, null, null); // do the check and update in the background setTimeout(function() {avglsinlineflyover.checkAndUpdate(doc, element, new_element, engine, handlerFunc)}, 1); } }, checkAndUpdate: function (doc, element, new_element, engine, handlerFunc) { if (!engine) return; try { // remove the listener and get final url element.detachEvent("onmouseover", handlerFunc, false); var finalUrl = searchshield.avgCallFunc(doc, 'GetFinalUrl', element.href); } catch(e) {} if ((typeof(finalUrl) != 'undefined') && finalUrl) { // if still a tiny url check for final url embedded in querystring if (searchshield.FilterUrl(finalUrl, engine.shortened_urls) && (finalUrl.indexOf("?url=") != -1)) { finalUrl = avglsinlineflyover.getUrlFromQueryString(finalUrl); } // update the verdict engine.display_inline(doc, new_element, finalUrl, null, true); } else { engine.avg_ls_inline_hide_verdict(new_element); } } }; /////////////// FLYOVERS /////////////// (function(){ setTimeout( function() { try { if ((self == top) && top.document) { searchshield.init(top.document, 1); } } catch(e){return;} }, 1 ); return; })(); // --> // ]]>