Greasemonkey Manual:Installing Scripts: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
No edit summary
 
No edit summary
 
(71 intermediate revisions by 36 users not shown)
Line 1: Line 1:
{{Greasemonkey Manual TOC}}
{{Greasemonkey Manual TOC}}


= About User Scripts =
== About User Scripts ==


The purpose of [[Greasemonkey]] is to manage [[user script]]s.
The purpose of [[Greasemonkey]] is to manage user scripts.
[[User script]]s allow the ''user'' to control the way they use the web, by customizing it with scripting.
[[User script]]s allow the ''user'' to control the way they use the web, by customizing it with scripting.
[[Greasemonkey]] won't do any good without any scripts installed.
The [https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/ Greasemonkey extension] won't do any good without any scripts installed.
So, the first thing an eager user should do is find and install (or write!) a useful script.


First, a word on finding [[user script]]s.
The first thing an eager user should do is find and install ''(or write!)'' a useful script.
They ''may'' be located anywhere, on the internet or off.
The [[Greasemonkey]] community, however, most often uses the general-purpose [[user script]]ing site created for it: http://userscripts.org/.


To install a script, navigate to it it with Firefox after installing [[Greasemonkey]].
:* A word on finding [[user script]]s. They may be located anywhere on the internet but you should look first at [[User_Script_Hosting|common hosts]].
This is most often done by clicking a link on a web page, but you may also drag-and-drop a local file into a Firefox window, or use the "File, Open..." dialog to open it.


An aside: What is a user script?
Installation of a script is most often done by clicking a link on a web page.
Any file that ends in <code>.user.js</code> is a user script.
<!-- Not in 4.0
If the URL of a link you click, or otherwise navigate to, ends with <code>.user.js</code>, then [[Greasemonkey]] will intercept the loading file, and present its installation dialog.
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.
-->


= The Installation Dialog =
:* Any file that ends in '''<code>.user.js</code>''' is a user script.


[[Image:Install-dialog.png|thumb|150 px|Greasemonkey Installation Dialog]]
When navigating to a URL which ends with <code>.user.js</code>, [[Greasemonkey]] will trigger the installation dialog.
Note that [[Greasemonkey]] must be [[Troubleshooting_(Users)#Greasemonkey Enabled Status|enabled]] to do so.


Whenever you navigate to a [[user script]] as described above, Greasemonkey will open its installation dialog, instead of loading the script like a normal page.
== The Installation Dialog ==
A thumbnail of this dialog is shown to the right.
It displays the name and description of the script, if available, as well as the [[include and exclude rules]] that apply.


The install button will, of course, install the script in question.
[[Image:Install-dialog.png|left|thumb|150px|GM Installation Dialog]]
Like the Firefox extension install dialog, the install 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].
Likewise, the cancel button will perform the obvious action.


The third button is the View Script Source button, and will also perform the obvious action that the name implies.
When navigating to a [[user script]], Greasemonkey will open its installation dialog instead of loading the script like a normal page.
At this point, [[Greasemonkey]] has already downloaded the [[user script]] in question, to display the name and other details.
A thumbnail of this dialog is shown to the left.
When you ask [[Greasemonkey]] to show you the script source, it shows you the temporary file that it has already downloaded, as in [[:media:View-source.png|this screenshot]].
It displays the name and description of the script as well as the [[include and exclude rules]] and special [[API]]s that apply.
This, also, is intentionally engineered to avoid a potential security problem, wherein an evil server could deliver one innocent script, for viewing, and on the second load an evil script, for installing.
<!-- Not in 4.0!
This approach ensures that the script is downloaded only once, and that if you examine the source of a script, ''that'' is the script you will install.
''Note:'' Greasemonkey must be  [[Troubleshooting (Users)#Greasemonkey Enabled Status|enabled]] to install scripts.
-->


Finally, in this view script source dialog, there is an info bar, similar to the extension installation security warning.
;* The Install button
This bar includes an install button, which, like the button in the prior dialog, will also install the script.
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].


= See Also =
;* The Cancel button
This button will cancel the installation of a script.


* Shared script repository: http://userscripts.org/
<!-- Not in 4.0
;* 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]].
In this window there is an information bar at the top similar to the Firefox extension installation security warning.
Clicking the install button here will also install the script.
 
-->
Now with some scripts installed, we can open the [[Greasemonkey Manual:Monkey Menu|Monkey Menu]] to list and manage them.

Latest revision as of 19:06, 3 November 2017


Greasemonkey Manual
Using Greasemonkey
Installing Scripts
Monkey Menu
Getting Help
User Script Authoring
Editing
Environment
API

About User Scripts

The purpose of Greasemonkey is to manage user scripts. User scripts allow the user to control the way they use the web, by customizing it with scripting. The 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.

Installation of a script is most often done by clicking a link on a web page.

  • Any file that ends in .user.js is a user script.

When navigating to a URL which ends with .user.js, Greasemonkey will trigger the installation dialog. Note that Greasemonkey must be enabled to do so.

The Installation Dialog

GM Installation Dialog

When navigating to a user script, Greasemonkey will open its installation dialog instead of loading the script like a normal page. A thumbnail of this dialog is shown to the left. It displays the name and description of the script as well as the include and exclude rules and special APIs that apply.

  • 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 security vulnerability.

  • The Cancel button

This button will cancel the installation of a script.

Now with some scripts installed, we can open the Monkey Menu to list and manage them.