[Greasemonkey] replacing text

Vlaj Bert vlajbert at gmail.com
Thu Jun 16 10:37:19 EDT 2005


Replace() is case sensitive so watch for that.

It's doubtful, but possible, that your request is really
http://www.tooligans.com. Most servers will redirect directory
requests to / or /index.html. If your include is really what's below
then your script isn't running. The @include should be /, /index.html
or just /*.

Vlajbert - http://vlajbert.blogspot.com/

On 6/16/05, blackwater dev <blackwaterdev at gmail.com> wrote:
> Still no luck:
> 
> Here is my script:
> //
> //
> // ==UserScript==
> // @name          test replace
> // @namespace     http://test.tooligans.com
> // @description   replaces  site with dev site
> // @include       http://www.tooligans.com
> // ==/UserScript==
> 
> document.body.innerHTML =
> document.body.innerHTML.replace(/tooligans.com/,'2.tooligans.com');
> 
> When I visit the page, I have a link like this:
> 
> <a target=new class=dark href="http://tooligans.com?uid=54">test</a>
> 
> I want this to be replaced with 2.tooligans.com or course the uid
> param would stay as that is dynamic so after the script runs I want:
> 
> <a target=new  href="http://2.tooligans.com?uid=54">test</a>
> 
> Thanks!
> On 6/16/05, Anthony Lieuallen <arantius at gmail.com> wrote:
> > On 6/16/05, blackwater dev <blackwaterdev at gmail.com> wrote:
> > > document.body.innerHTML =
> > > document.body.innerHTML.replace(/tooligans.com/,/2.tooligans.com/);
> > >
> > > What is wrong with this statement?  In my meta data, I am specifying
> > > the site to use it for.
> >
> > Using the replace JS method, the first argument can be a regular
> > expression, but the second must be a string.  I.E:
> >
> > document.body.innerHTML =
> > document.body.innerHTML.replace(/tooligans.com/, '2.tooligans.com' );
> > _______________________________________________
> > Greasemonkey mailing list
> > Greasemonkey at mozdev.org
> > http://mozdev.org/mailman/listinfo/greasemonkey
> >
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list