// get bounding rect for incoming element var elementRect = element.getBoundingClientRect(); var nextImg = null; var nextImgRect = null; // first check for another non-TextNode element after this one var siblingElement = searchshield.NextSiblingNode(element); if ( siblingElement && siblingElement.firstChild && siblingElement.id && siblingElement.id.indexOf("XPLSS_") != -1) { nextImg = siblingElement.firstChild; nextImgRect = nextImg.getBoundingClientRect(); } else { return elementRect; } if ((nextImgRect.top >= elementRect.bottom) && (nextImgRect.left <= elementRect.left)) { // images appear to be on seperate lines return elementRect; } // else merge the rects together into a new one var newRect = new function() { this.top=0; this.left=0; this.right=0; this.bottom=0; this.mid=0;}; newRect.top = Math.min(elementRect.top, nextImgRect.top); newRect.left= Math.min(elementRect.left, nextImgRect.left); newRect.right=Math.max(elementRect.right, nextImgRect.right); newRect.bottom=Math.max(elementRect.bottom, nextImgRect.bottom); newRect.mid = Math.min(elementRect.right, nextImgRect.left); return newRect;};searchshield.offsetLeft = function (element){ var offset = 0; while (element) { offset += element.offsetLeft; element = element.offsetParent; } return offset;};searchshield.offsetTop = function (element){ var offset = 0; while (element) { offset += element.offsetTop; element = element.offsetParent; } return offset;};searchshield.scrollSize = function (imageElem){ // returns an array [scrollX, scrollY, hasParentFrame] var scrollX; var scrollY; var hasParentFrame; // firefox if (window.pageXOffset && window.pageYOffset) { scrollX = window.pageXOffset; scrollY = window.pageYOffset; } else if (document.documentElement || document.body) { scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; scrollY = document.documentElement.scrollTop || document.body.scrollTop; if (imageElem) { var frames = document.frames; if (frames) { for (var i=0; i < frames.length; i++) { var img; try { img = frames[i].document.getElementById(imageElem.id); } catch(domErr){} if (img != null) { scrollX = frames[i].document.documentElement.scrollLeft; scrollY = frames[i].document.documentElement.scrollTop; hasParentFrame = true; break; } } } } } else { scrollX = 0; scrollY = 0; } return [parseInt(scrollX,10), parseInt(scrollY,10), hasParentFrame];};searchshield.viewPortSize = function (){ // returns an array [width, height, scrollYWidth], where scrollYWidth is always 0 for IE var scrollXWidth = 19; var scrollYWidth = 0; // 0 for Microsoft IE var scrollBarX = false; var windowX; var windowY; // firefox if (window.innerWidth && window.innerHeight) { //TODO: validate this block if implemented for firefox windowX = window.innerWidth - scrollXWidth; windowY = window.innerHeight; try { scrollYWidth = Math.floor(Math.abs(window.innerHeight - document.documentElement.clientHeight)) + 1; scrollBarX = (document.documentElement.clientWidth < document.documentElement.scrollWidth); } catch(err){} if (scrollBarX && !scrollYWidth) scrollYWidth = 18; //normally 17 (+1 top border) } else if (document.documentElement || document.body) { windowX = (document.documentElement.clientWidth || document.body.clientWidth) - scrollXWidth; windowY = document.documentElement.clientHeight || document.body.clientHeight; } else { windowX = 0; windowY = 0; } return [windowX, windowY, scrollYWidth];};searchshield.zoomLevel = function (){ var level = 1; if (document.body.getBoundingClientRect) { // rect is only in physical pixel size before IE8 var rect = document.body.getBoundingClientRect(); level = Math.round (((rect.right - rect.left) / (document.body.offsetWidth)) * 100) / 100; } return level;};// Href functionssearchshield.checkUrl = function (url){ // cleanup a url, make sure there is a protocol on the front for scanning try { // trim url = url.replace(/^\s+/, "").replace(/\s+$/, ""); // if no protocol, add http:// to it if (url.indexOf("://") == -1) url = "http://" + url; } catch(err){} return url;};searchshield.DoesURLContain = function (url, contain){ if ((url == null) || (url.length < 1)) return false; // breakup the url to check var parts = url.split('/'); if (parts.length < 3) return false; var domain= parts[2].toLowerCase(); if (domain.indexOf(contain) > -1) return true; return false;};searchshield.FilterUrl =