[Greasemonkey] Explicit ID, Not Namespace

Matt Sargent matt.sargent at earthlink.net
Mon Mar 13 21:29:59 EST 2006


If you install a script with the same name and namespace as one already 
loaded, it overwrites the original.

On 13 Mar 2006 at 15:37, csaba2000 wrote:

> 
> 
> Bill Donnelly wrote:
> > 
> >  > Just give the second script the same name and
> >  > namespace.  When you install the second script, the generated 
> > filename will
> >  > be something similar (though different (even if you install the
> >  > same 
> > script
> >  > twice)), but what matters is what gets written into GM's
> >  > config.xml. 
> > The
> >  > two scripts will share storage variables.
> > 
> > Is this true? I haven't tried it, but the second script should
> > replace the first script, not be additional and along side it. Or
> > what am I missing?
> > 
> 
> Ahem.  That's how I remember discovering it, but I'll be darned if I
> can reproduce the adding of duplicate names right now.  Since that
> time, I have manually (or via client side php scripts) edited the
> config.xml file when I want to do this type of thing (storage sharing
> among scripts).  For example, install the example script once,
> normally, and then go into the config.xml file and duplicate the last
> section.
> 
> So it means that I'd really rather prefer some type of optional
> @DefaultStorageId directive and to let GM_set/getValue take an
> optional id parameter.
> 
> As for the example script - there was a small error with it - so I've
> corrected it to work with google.com.
> 
> // ==UserScript==
> // @name          delme Test2
> // @namespace     delmeTest2
> // @description   Testing multiple identically named scripts
> // @include       http://*google.com/
> // ==/UserScript==
> 
> GM_setValue ("testVal", GM_getValue("testVal","first, ")+"more, ");
> alert (GM_getValue("testVal","didn't find it")); // END FILE
> 
> Be wary about uninstalling the duplicate script using the normal
> (Tools \ Manage User Scripts \ Uninstall) interface.  It seems to be a
> little overly enthusiastic about removing scripts and may remove some
> additional ones(!) from the end of the list.  I suggest making backups
> of both your scripts and the config.xml file before mucking about.
> 
> Csaba Gabor from Vienna
> --
> View this message in context:
> http://www.nabble.com/Explicit-ID%2C-Not-Namespace-t1183186.html#a3388
> 145 Sent from the MozDev - greasemonkey forum at Nabble.com.
> 
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
> 




More information about the Greasemonkey mailing list