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;
}
Member Avatar for Warrens80

I would ask dani.

:L i dont have sufficient rights

Don't ask me! I don't know the first thing about Firefox extensions and I only know jQuery. You know what, though? Someone here is actually in the middle of doing something very similar for DaniWeb. Let me see if I can find their thread because they'd be the person you want to talk to.

alright thanks :) what do i have to do to be ablle to live char with people?

darn :L oh well. its not that important. i was thinking of switching to chrome as my main anyways for the dart support. (compiling to javascript whenever i update something is too tedious for me)

Smart man :) I gave up on Mozilla years ago.

meh i dont think i can do that. it put up with all of my crappy html when i first got into programming and linux. weve built a bond

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.