User Specified Javascript

Opera 8 introduces the ability to execute a user javascript file in every page loaded, a bit like the browser stylesheet. This allows one to add in javascript fixes for any sites that need them, and enhance sites with new functionality.

Scripts [⊗]

The unofficial central script repository: http://userjs.org/

Collections

Individual scripts

Documentation [⊗]

How to add scripts [⊗]

To add the scripts, make a directory and point Opera at it using Preferences » Advanced » Content » Javascript options » My javascript files:

image

You can then simply drop scripts into that directory and Opera will use them automatically. If you want to limit their effects to particular web sites, you can use comment metadata to do so:

// ==UserScript==
// @include http://example.com/*
// @include http://www.example.com/*
// @exclude http://example.com/directory/*
// @exclude http://www.example.com/example.html
// ==/UserScript==

Note: Peter Karlsson aka nafmo said:

Setting up a script environment on a page costs memory, so Opera only does it if it actually encounters a script tag. However, without that, user JavaScripts can't be executed.

You can force Opera to run User JavaScript on other pages by adding

[User Prefs]
Always Load User JavaScript=1

to your opera6.ini file.

Historical Interlude [⊗]

Here is a post from a current developer and maintainer of the GreaseMonkey repository — note Rijk's comment is interesting for Opera users:

Opera’s userscript support has been developed during the year 2004, before Greasemonkey, as part of larger modifications of Opera’s core. This part was interesting enough for power-users to put into the current beta release, but it is only a small part of what we’ve been working on. Expect more in the future.

Rijk has later embellished this with:

It should be noted that Greasemonkey was not the inspiration for developing User JavaScript, as CNet.com seems to imply. This idea had come up between Jonny A. (Opera tech thinker) and Lars H., (our main JavaScript guy) in 2002 already, and the code was actually written last year.

Categories

CategoryOpera
CategoryTechnical

Backlinks
There are 20 comments on this page. [Display and/or add comments]