Greasemonkey Manual:Installing Scripts: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m (Reverted edits by 99.243.100.185 (Talk) to last revision by Arantius)
No edit summary
Line 1: Line 1:
{{Greasemonkey Manual TOC}}
<?xml version="1.0"?>


== About User Scripts ==
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:em="http://www.mozilla.org/2004/em-rdf#">


The purpose of [[Greasemonkey]] is to manage user scripts.
  <Description about="urn:mozilla:install-manifest">
[[User script]]s allow the ''user'' to control the way they use the web, by customizing it with scripting.
The [https://addons.mozilla.org/firefox/addon/748 Greasemonkey extension] won't do any good without any scripts installed.


The first thing an eager user should do is find and install ''(or write!)'' a useful script.
    <em:id>{e4a8a97b-f2ed-450b-b12d-ee082ba24781}</em:id>
    <!-- NOTE : build.sh will correct the em:version, if applicable -->
    <em:version>0.8.20090123.1</em:version>
    <em:creator>Aaron Boodman; http://youngpup.net/</em:creator>
    <em:homepageURL>http://www.greasespot.net/</em:homepageURL>
    <em:optionsURL>chrome://greasemonkey/content/manage.xul</em:optionsURL>
    <em:iconURL>chrome://greasemonkey/content/icon_medium.png</em:iconURL>


:* A word on finding [[user script]]s. They may be located anywhere on the internet or even offline. The Greasemonkey community typically uses the general purpose user script repository site created for it at [http://userscripts.org/ http://userscripts.org].
    <em:name>Greasemonkey</em:name>
    <em:description>A User Script Manager for Firefox</em:description>


Installation of a script is most often done by clicking a link on a web page. One may also drag-and-drop a local file into the browser window, or optionally use the menu bar [http://support.mozilla.com/en-US/kb/Menu+Reference#Open_File_ File &rarr; Open File...] dialog to open it.
    <em:contributor>Anthony Lieuallen; http://arantius.com</em:contributor>
    <em:contributor>Chris Feldmann; http://axlotl.net</em:contributor>
    <em:contributor>David Schontzler; http://stilleye.com/</em:contributor>
    <em:contributor>Gareth Andrew; http://freegarethandrew.org</em:contributor>
    <em:contributor>Hisateru Tanaka</em:contributor>
    <em:contributor>Jeremy Dunck; http://dunck.us/anabasis/</em:contributor>
    <em:contributor>Jesper Kristensen &lt;mail&#64;jesperkristensen.dk&gt;</em:contributor>
    <em:contributor>Johan SundstrГ¶m; http://ecmanaut.blogspot.com/</em:contributor>
    <em:contributor>JP Sugarbroad</em:contributor>
    <em:contributor>Juan Pablo Guereca Alonso</em:contributor>
    <em:contributor>Manpreet Singh</em:contributor>
    <em:contributor>Mark Pilgrim; http://diveintomark.org</em:contributor>
    <em:contributor>Marti Martz</em:contributor>
    <em:contributor>Matthias Bauer; http://moeffju.net/</em:contributor>
    <em:contributor>Matthew Gray; http://mkgray.com:8000/</em:contributor>
    <em:contributor>Nikolas Coukouma; http://atrus.org/</em:contributor>
    <em:contributor>Ori Avtallon</em:contributor>
    <em:contributor>Pak Kei (logo); http://arkidect.com/</em:contributor>
    <em:contributor>Sergio Abreu; http://sitedosergio.sitesbr.net</em:contributor>
    <em:contributor>Tommi Rautava</em:contributor>


:* Any file that ends in '''<code>.user.js</code>''' is a valid Greasemonkey user script.
    <!-- Firefox -->
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>1.5</em:minVersion>
        <em:maxVersion>3.1b2</em:maxVersion>
      </Description>
    </em:targetApplication>


When the URL of a link is clicked or otherwise navigated to ends with <code>.user.js</code>, [[Greasemonkey]] will intercept the loading file by presenting the installation dialog.
    <!-- Songbird -->
    <em:targetApplication>
      <Description>
        <em:id>songbird@songbirdnest.com</em:id>
        <em:minVersion>0.3pre</em:minVersion>
        <em:maxVersion>1.0.*</em:maxVersion>
      </Description>
    </em:targetApplication>


== The Installation Dialog ==
    <em:file>
      <Description about="urn:mozilla:extension:file:greasemonkey">
        <em:package>content/</em:package>
      </Description>
    </em:file>


When navigating to a [[user script]], Greasemonkey will open its installation dialog instead of loading the script like a normal page.
  </Description>
A thumbnail of this dialog is shown to the left.
It displays the name and description of the script, if available, as well as the [[include and exclude rules]] that apply.


[[Image:Install-dialog.png|left|thumb|150px|GM Installation Dialog]]
</RDF>
 
;* The Install button
This button will, of course, install the script in question.
Like the Firefox extension installation dialog, this button is disabled for a few seconds to avoid the same potential [http://www.squarefree.com/2004/07/01/race-conditions-in-security-dialogs security vulnerability].
 
;* The Cancel button
This button will cancel the installation of a script.
 
;* The View Script Source button
This button will allow viewing of the source code contained in the script.
At this point, [[Greasemonkey]] has already downloaded the [[user script]] in question to display the name and other details.
 
When a user shows the script source, it displays the temporary file that Greasemonkey has already downloaded depicted in this [[:media:View-source.png|screenshot]]. This is intentionally engineered to avoid a potential security problem. An evil server could deliver one innocent script for viewing, and on the second load an evil script for installing.
This approach ensures that the script is downloaded only once.  Upon examination of the visible script source, ''this copy'' is the script that will be installed.
 
Finally, in this window there is an information bar at the top similar to the Firefox extension installation security warning. This bar includes another Install button much like the the prior dialog. Clicking this button will also install the script. Using the [[Greasemonkey_Manual:Manage_Dialog|Manage Dialog]] is the next step.

Revision as of 21:14, 11 December 2010

<?xml version="1.0"?>

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

  xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 <Description about="urn:mozilla:install-manifest">
   <em:id>{e4a8a97b-f2ed-450b-b12d-ee082ba24781}</em:id>
   <em:version>0.8.20090123.1</em:version>
   <em:creator>Aaron Boodman; http://youngpup.net/</em:creator>
   <em:homepageURL>http://www.greasespot.net/</em:homepageURL>
   <em:optionsURL>chrome://greasemonkey/content/manage.xul</em:optionsURL>
   <em:iconURL>chrome://greasemonkey/content/icon_medium.png</em:iconURL>
   <em:name>Greasemonkey</em:name>
   <em:description>A User Script Manager for Firefox</em:description>
   <em:contributor>Anthony Lieuallen; http://arantius.com</em:contributor>
   <em:contributor>Chris Feldmann; http://axlotl.net</em:contributor>
   <em:contributor>David Schontzler; http://stilleye.com/</em:contributor>
   <em:contributor>Gareth Andrew; http://freegarethandrew.org</em:contributor>
   <em:contributor>Hisateru Tanaka</em:contributor>
   <em:contributor>Jeremy Dunck; http://dunck.us/anabasis/</em:contributor>
   <em:contributor>Jesper Kristensen <mail@jesperkristensen.dk></em:contributor>
   <em:contributor>Johan Sundström; http://ecmanaut.blogspot.com/</em:contributor>
   <em:contributor>JP Sugarbroad</em:contributor>
   <em:contributor>Juan Pablo Guereca Alonso</em:contributor>
   <em:contributor>Manpreet Singh</em:contributor>
   <em:contributor>Mark Pilgrim; http://diveintomark.org</em:contributor>
   <em:contributor>Marti Martz</em:contributor>
   <em:contributor>Matthias Bauer; http://moeffju.net/</em:contributor>
   <em:contributor>Matthew Gray; http://mkgray.com:8000/</em:contributor>
   <em:contributor>Nikolas Coukouma; http://atrus.org/</em:contributor>
   <em:contributor>Ori Avtallon</em:contributor>
   <em:contributor>Pak Kei (logo); http://arkidect.com/</em:contributor>
   <em:contributor>Sergio Abreu; http://sitedosergio.sitesbr.net</em:contributor>
   <em:contributor>Tommi Rautava</em:contributor>
   <em:targetApplication>
     <Description>
       <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
       <em:minVersion>1.5</em:minVersion>
       <em:maxVersion>3.1b2</em:maxVersion>
     </Description>
   </em:targetApplication>
   <em:targetApplication>
     <Description>
       <em:id>songbird@songbirdnest.com</em:id>
       <em:minVersion>0.3pre</em:minVersion>
       <em:maxVersion>1.0.*</em:maxVersion>
     </Description>
   </em:targetApplication>
   <em:file>
     <Description about="urn:mozilla:extension:file:greasemonkey">
       <em:package>content/</em:package>
     </Description>
   </em:file>
 </Description>

</RDF>