////// Begin site:this Hack (place after line 733) ////// // look for the string 'site:this' in the search terms patternSiteThis = /site%3Athis/i; // if the string exists, rejigger the query if (patternSiteThis.test(aSearchTerms) == true) { // Get the URL of the current window var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); var doc = wm.getMostRecentWindow("navigator:browser").content.document; var siteURL = doc.location.href; // If there, remove 'http://' from the start var siteURL = siteURL.replace(new RegExp(/^http:\/\//i),""); // If there, remove 'www.' from the start var siteURL = siteURL.replace(new RegExp(/^www\./i),""); // If there, remove any trailing forward slash var siteURL = siteURL.replace(new RegExp(/\/$/),""); // If there, delete the string from first forward slash on var siteURL = siteURL.replace(new RegExp(/\/(.*)/),""); // Replace "this" with the domain and port aSearchTerms = aSearchTerms.replace(patternSiteThis,"site%3A"+siteURL); } ////// End site:this Hack //////