im writing a firefox addon to append signatures to posts in cplusplus.com, but im having a little trouble, as it has been a long time since i wrote in javascript. right now i just want it to verify that i am in fact on the c++ forums and if it is dynamically load an alert, but its not working (ie no matter what regex i try it will only load for every site or for no site). here is my code:
require("sdk/tabs").on("ready", CatchURL);
function CatchURL(tab) {
if(IsCorrectSite(tab)){
tab.attach({
contentScript: "alert(\"" + tab.url + "\");"
});
}
}
function IsCorrectSite(tab)
{
var Site = new String(tab.url);
if(Site.search("http://www\.cplusplus\.com/forum/.*/.*"))
return true;
return false;
}