(siblingElem.nodeName != 'SPAN') && (siblingElem.className != 'site')) { siblingElem = siblingElem.nextSibling; if (siblingElem && siblingElem.className && (siblingElem.className.match(/res[13]/))) break; } if (siblingElem) rtnHtml = siblingElem.getElementsByTagName('a')[0]; if (rtnHtml) rtnHtml = rtnHtml.innerHTML; return rtnHtml;};searchshield.getTopLevelDocument = function (doc){ // return the top level document for the given doc, could be itself // TODO: determine a method of doing this for IE, if necessary // don't check about:blank if (doc && ((doc.location.href == "about:blank") || (doc.location.href == "about:Tabs"))) return doc; // Check if already a top level document for (var i = 0; i < gBrowser.browsers.length; i++) { if (doc == gBrowser.browsers[i].contentDocument) return doc; } // Not a top level, check all frames var documents; for (var j = 0; j < gBrowser.browsers.length; j++) { // get all docs for each browser documents = searchshield.getDocuments(gBrowser.browsers[j].contentWindow, new Array()); for (var k = 0; k < documents.length; k++) { // check if doc is from current browser if (doc == documents[k]) { // it is, return the top level doc for this browser return gBrowser.browsers[j].contentDocument; } } } return doc;};searchshield.getTopLevelWindow = function (){ // TODO: determine a method of doing this for IE, if necessary return mediator.getMostRecentWindow("navigator:browser");};//Event functionssearchshield.addListener = function (object, evtType, listener, useCapture){ useCapture = !!useCapture; if (object.addEventListener) { object.addEventListener(evtType, listener, useCapture); return true; } else if (object.attachEvent) { object.attachEvent("on"+evtType, listener); return true; } return false;};searchshield.cancelEvent = function (event){ event.cancelBubble = true; event.returnValue = false;};searchshield.doEvent = function (evtObj, evtTarget, evtName, evtType, bubbles, cancelable){ bubbles = !!bubbles; cancelable = !!cancelable; if (document.createEvent) { var evt = document.createEvent("Events"); evt.initEvent(evtName, bubbles, cancelable); evtTarget.dispatchEvent(evt); return true; } else if (document.createEventObject) { var evt = document.createEventObject(evtObj); evtTarget.fireEvent("on" + evtType, evt); return true; } return false;};searchshield.removeListener = function (object, evtType, listener, useCapture){ useCapture = !!useCapture; if (object.removeEventListener) { object.removeEventListener(evtType, listener, useCapture); return true; } else if (object.detachEvent) { object.detachEvent(evtType, listener); return true; } return false;};// HTML functionssearchshield.CleanupHTML = function (data){ if (data == null) return data; // cleanup html data, replace any new lines data = data.replace(/\r/g, ""); data = data.replace(/\n/g, ""); // escape any single quotes data = data.replace(/'/g, "\\'"); return data;};searchshield.removeHtmlTags = function (str){ var re = new RegExp('(<[^>]+>)','g'); var strStr = new String(str); if (!!strStr) return strStr.replace(re, ''); else return str; };// Browser functionssearchshield.elementSize = function (element){ //returns an array [sizeX, sizeY] var elemX; var elemY; elemX = parseInt(element.offsetWidth); elemY = parseInt(element.offsetHeight) return [elemX, elemY];};searchshield.GetFullBoundingRect = function (element){ if (!element) return; // 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