User:Rod McGuire/Wiki defined example user scripts: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Created page with 'Example user scripts can be defined in the Greasespot wiki. Currently such wiki pages seem to be creatable only in <code>User:</code> space. One could try creating a page such …'
 
mNo edit summary
 
Line 4: Line 4:


One could try creating a page such as [[User:Rod_McGuire/dataschemetest.user.js]], but this has two problems:
One could try creating a page such as [[User:Rod_McGuire/dataschemetest.user.js]], but this has two problems:
# If you try to access such a wiki page when Greasemonkey is running, Greasemonkey will try to install the wiki page, not its Javascript code, as a user script.
# If you try to access such a wiki page when Greasemonkey is running, Greasemonkey will try to install the wiki page, not its Javascript code, as a user script. AND Gresemonkey will prevent you from seeing the wiki page.
# There is no direct way to install the Javascript code as a script in Greasemonkey.
# There is no direct way to install the Javascript code as a script in Greasemonkey.


The solution is to define a user script page with a name that ends in <code>.js</code>, but not <code>.user.js</code>, such as [[User:Rod_McGuire/dataschemetest.u.js]], then use [[Template:RawWikiUserscript]] to create a link to the raw Javascript text (for example: {{RawWikiUserscript|User:Rod_McGuire/dataschemetest.u.js|dataschemetest}}.user.js) that can cause Greasemonkey to treat the content as an installable script.
The solution is to define a user script page with a name that ends in <code>.js</code>, but not <code>.user.js</code>, such as [[User:Rod_McGuire/dataschemetest.u.js]], then use [[Template:RawWikiUserscript]] to create a link to the raw Javascript text (for example: {{RawWikiUserscript|User:Rod_McGuire/dataschemetest.u.js|dataschemetest}}.user.js) that can cause Greasemonkey to treat the content as an installable script.

Latest revision as of 20:12, 2 February 2010

Example user scripts can be defined in the Greasespot wiki.

Currently such wiki pages seem to be creatable only in User: space.

One could try creating a page such as User:Rod_McGuire/dataschemetest.user.js, but this has two problems:

  1. If you try to access such a wiki page when Greasemonkey is running, Greasemonkey will try to install the wiki page, not its Javascript code, as a user script. AND Gresemonkey will prevent you from seeing the wiki page.
  2. There is no direct way to install the Javascript code as a script in Greasemonkey.

The solution is to define a user script page with a name that ends in .js, but not .user.js, such as User:Rod_McGuire/dataschemetest.u.js, then use Template:RawWikiUserscript to create a link to the raw Javascript text (for example: dataschemetest.user.js) that can cause Greasemonkey to treat the content as an installable script.