You need to be logged in to post in the forums. If you do not have an account, please sign up first.

21. September 2008, 21:45:12

Lex1

Posts: 1718

FAQ

Installing User JavaScript

Before User JavaScript can run in Opera, you must enable the feature by pointing Opera to your User JavaScript directory
  1. Create a directory for storing User JavaScript files, for instance C:\userjs\
  2. Go to Tools -> Preferences -> Advanced -> Content -> JavaScript Options. Add the location of your newly created script directory to My JavaScript files.


Installing User JavaScript files
Scripts can be installed in one of the following ways:
  1. If you want to review the script prior to installation, you can just visit the script, and select “Save As…” when you are viewing the script.
  2. Mouse: By right-clicking the download link, and select “Save target as … “. Save the script to your previously created User JavaScript folder.
  3. Keyboard: By focusing the download link, and pressing “Ctrl-Shift-S”. Save the script to your previously created User JavaScript folder.

Uninstalling User JavaScript files
Permanent uninstallation of User JavaScript files is done by deleting the script file from the folder containing your User JavaScript files.

If you want to disable a script file without permanently removing it, this is easiest achieved by changing the file suffix of the script file. Example: renaming myScript.js to myScript.js.xx will disable the script.

Also you can use UserJS Manager for installing and disabling UserJS.

Certain UserJS
a-lib-stacktrace.js and a-lib-xmlhttp-cd.js - Cross-domain XMLHttpRequest for Opera.
aagmfunctions.js - Emulates some functions of Greasemonkey. Used for providing of the best compatibility with scripts from FireFox.
allinbackground.js - Opens links in a background on Ctrl+Click.
alt2title.js - If the tag «Title» is not set, copies content of tag «Alt» in him. It's needed for the "correct show" of tag «Alt» as a pop-up prompt at pictures, as it does IE. (let-me-see-img.js usually better)
auto-copy.js - Copies the selected text in the clipboard (flash is needed). A version correctly working with Russian language is here.
autocopy.js - Copies the selected text with formatting in the clipboard. Only for Windows.
autosizer.js - This script activates when you use Opera to view an image file and adds five different viewing modes for images: "Original", "Shrink to Fit", "Maximize", "Fit to Width" and "Fit to Height". New version here. Version for Opera 9.5 here.
bbcode.js - Inserts in the textarea any BBCode and HTML tags.
block-external-scripts.js - Blocks loading of scripts from other domains. It takes away advertising realized on js, for example, Google AdSense or "pop-up windows v2.0", like this.
blockexternal.js - Blocks scripts, pictures, frames and flash from other domains. It advertising in most cases. There is a white list.
block_external.js - More advanced variation on a that theme from Mikivanch. Allows to block pictures by size. Does not block scripts.
BlockIt.js - Bloker of scripts. Approximate analogue of extension NoScript for FireFox.
bug-me-not.js - Using service BugMeNot.com searches logins and passwords for the sites of requiring authentifications. Run on Ctrl+Shift+Double Click.
convert2phf.js - Saves a page in phf or mht. A page is saved with all of changes done by javascript.
coolirisalike.js - At pressing of Ctrl and hovering of mouse on links, the preview window shows. (attempt to realize the analogue of Firefox exptension Cooliris Previews).
devConsole.js - Console of developer. For work as UserJS will replace the first line «(function()» on «function ujs_devConsole()», and last «})()» on«}» and use the button: Dev console.
disable-script.js - Blocks all of scripts on sites, but allows to use UserJS.
dlembed.js - Double click on blank space of page, will add before each flash, link for downloading. There exists button version.
extra-download-links.js - Adds links to the pictures and flash in sidebar "Reference". Here last version.
fix-content-type.js - If HTML pages are incorrectly served as text, this script attempts to correct them, and load them as HTML
fix-gzipped-pages.js - Corrects the twice gzip-compressed pages.
get-link-info.js - Gives out information about link. Namely: size, date, content-type. Sufficiently bugged and consumes a more traffic what separate utilities.
google-translate - Text translation, including full pages, selected text and textarea, with a Google Translate.
google-translation with tooltip - Variant from Ayush, oriented to translation of separate words.
hide-objects.js - Hides a flash on pages. Unblocking via double click. (Flashblocker is better).
highlighter.js - Advanced search with highlighting. Including in Google and with using of regular expressions.
HighlightText.js - At pressure on the button, changes the color of current selection on yellow and it memorizes in cookies. Analogue of extension Line Marker for FireFox.
image_reloader_for_opera.js - Image loading, on Ctrl+Click or long pressing of the left mouse button.
imgthumb.js - When you hover a image link youll see a thumbnail in bottom left corner.
keyboard.userjs.js - Virtual keyboard which is added to the test fields on a page.
let-me-see-img.js - In place of the not visible not loaded images shows a border. In addition, shortens too long inscriptions in place of images and copies content from alt to title.
link-alert.js - This script identifies links to specific file types, and displays an appropriate icon when the link is hovered. Sufficiently bugged. Better to use links-with-icons.css.
linkifier.js - Does «text links» a clickable. There can be problems with speed.
linkify-txt.js - Does clickable, a links in text files.
logger.js - Writes down history of the visited pages in a file. Java is needed.
middleclickJSOverride.js - Provides correct work, in case click a middle-button on javascript-link.
multipopup.js - Beautiful transparent tooltips with additional possibilities. Not forget to disable built-in tooltips. Can cause problems.
no_meta_redirect.js - Disable a meta-redirect.
noclicktoactivate.js - Avoiding click-to-activate for plugins (flash, for instance). Version for Opera 9.5 here.
open-in-background-with-long-press.js - Opens new tab in a background with long click. Useful for laptop users. In Opera 9.5x you must set Ctrl+F12->Advanced->Content->Javascript options->Allow lowering of windows.
open-in-new-window.js - All links will opened on a new page. Works only on sites which written in beginning of script.
open_browser.js - Opens the certain sites in the certain browser. Only for Windows.
ops.js - Provides autocomplete feature for text input fields. Two (improved) variants are here.
ospell.js - On-line spell checking in textarea.
pdfHandler.js - Deletes an empty page at opening files *.pdf, *.doc and *.xls.
Remove_it_permanently-for_Opera.js - Deletes the clicked element of page. Permanently. Only for Windows.
removeblank.user.js - Deletes all attributes «target="_blank"», which cause opening of links on a new page.
robosticky.js - Add sticky-notes to HTML and XHTML pages.
safe-alert.js - Allows to stop appearance of js-alert for a page.
scroller.js - Enables to scroll a page, with pressing Ctrl and left button and moving a mouse.
seobar3.js - Is a powerful tool for web-site promoters and analysts. SEObar can display the following information on the page of your browser: Alexa Traffic Rank, Google Page Rank, Yandex CY and more.
Smilize.user.js - Transform text smiles (for example, smile, :-), :d, bigsmile, etc) in animated gif. Need aagmfunctions.js.
snap-links.js - Open multiple links by drawing a box around links.
snap-images_userjs.js - Similar for images.
text-replacement.js - Replaces the certain text on all of pages.
titleprotector.js - Does not allow web-pages to change a title of browser with JavaScript.
xerath-plugsome-toolbar.js - Shows near each flash, toolbar with buttons: Reload, Save, Play and Pause. Two last work not everywhere.
xerath-power-drag.js - Allows to change the size of textarea and images by a mouse.
xml-tree.user.js - Shows XML files as a tree and with syntax-highlighting.
zoom-image.user.js - This script allows you to zoom individual images using an image toolbar appearing whenever you hold your mouse over an image.

Site-specific UserJS
experts-exchange.com - ExpertsExchangeFilter.user.js. Removes all the garbage, fake entries and other stuff.
google.com - Google Fx (need aagmfunctions.js). Nice Look&Feel + ThumbShots + Global Suggest (multi-lang) + Streaming Auto-Pages + Easy Adv. Features + Images relink, cache pages & easy filters.
livejournal.com - lj_unfolder.user.js. This script adds to Livejournal comment pages ability to download logn threads inline, ajaxy.
my.opera.com - MyOpera Community Enhancements.
rapidshare.com - rapidshare_com.js (scripts for similar services is here).
youtube.com - youtube_com.js, youtube_down.js, videoscript.user.js.



For developers
http://userjs.org/help/tutorials/

Avoid a global variables and functions. Use anonymous function:
(function(){
  Yours code
})();

If you uses non english symbols in UserJS, encode it (\uXXXX) or save script in utf-8 without BOM (not works in Opera 9.2).

For getting info from other domain use cross-document-messaging. For compatibility with Opera 8-9 and Opera 9.5 use similar code:
if(window.postMessage){frame.contentWindow.postMessage(post)}else{frame.contentDocument.postMessage(post)}


Certain bugs
«window.getSelection()» - loses line feed. Try «document.getSelection()» or see quick-reply.js wink
«window.getSelection().containsNode()» - Always false.
«document.selection.type» - «None» even if selection exists. Opera 9.5 only.

«mousedown» - breaks drag-n-drop on page. Use «BeforeEvent.mousedown»
...

14. October 2008, 16:25:20

arnymars

Natural Hobbiest

Posts: 464

Excellent FAQ.
Still, I'd suggest to add brief explanation next to each Site-specific UserJS above. Plus, add a link to the author's site with an updated explanation in English or any other language (to use with translator). Its scary to install a generic name script without knowing what it does.

23. October 2008, 15:20:24

Nice list , but i have a question .
Virtual Keyboard isnt working with Wand . When i double clicked the password field ( which marked with yellow ) its not opening .
How can i fix this ?

26. October 2008, 17:28:25

Any idea i still cant fix it ?

13. November 2008, 14:25:31

ZAHEK

z@h3k

Posts: 7565

Is there any difference between to be worked this scripts under windows and linux?
Becouse some my colleagues said to me some userjs doesn't work with linux.But windows is OK.

3. January 2009, 19:15:30

totalimpact

Posts: 4

Any reason why scripts wouldnt work - I have the copy clipboard script and google images script, and neither works. I have built a script dir in my profile and set it in preferences, and made sure to check the enable java script box, and set the option in opera6.ini to: Always Load User JavaScript=1 and yes i restarted opera several times.

After all that I also installed the userjs manager, it shows my scripts activated, but they do nothing.

1. March 2009, 17:52:41

Hades32

What I use:

Posts: 1917

Originally posted by Lex1:

For getting info from other domain use cross-document-messaging. For compatibility with Opera 8-9 and Opera 9.5 use similar code:


This doesn't seem to be working in Opera 10 anymore. Example: http://trash.chregu.tv/xdom.html

I have a question: Why isn't UserJS allowed to make cross domain requests? Widgets are allowed to do so...!?
Using Windows 7 64Bit SP1 and of course Opera
(If nothing else stated the most current weekly) on a nice Dell Studio XPS 16!

1. March 2009, 18:14:17 (edited)

Lex1

Posts: 1718

Hades32

document.addEventListener("message",function


Use window.addEventListener

Why isn't UserJS allowed to make cross domain requests?


Security. Afaik, userjs run in the context of page. GM-scripts is isolated. Widgets at all have no access to page.

7. March 2009, 22:09:18

Hades32

What I use:

Posts: 1917

Originally posted by Lex1:

Widgets at all have no access to page.


Nope. You can allow them access to any page you want.
Using Windows 7 64Bit SP1 and of course Opera
(If nothing else stated the most current weekly) on a nice Dell Studio XPS 16!

8. March 2009, 12:43:26

Hades32

What I use:

Posts: 1917

Originally posted by Lex1:

«Widgets at all have no access to page» in browser.


ahh, yes. That's sadly correct.
Using Windows 7 64Bit SP1 and of course Opera
(If nothing else stated the most current weekly) on a nice Dell Studio XPS 16!

25. August 2009, 10:32:51

CCVo

Posts: 2052

Originally posted by totalimpact:

Any reason why scripts wouldnt work - I have the copy clipboard script and google images script, and neither works. I have built a script dir in my profile and set it in preferences, and made sure to check the enable java script box, and set the option in opera6.ini to: Always Load User JavaScript=1 and yes i restarted opera several times.

After all that I also installed the userjs manager, it shows my scripts activated, but they do nothing.


Same here.
But, I found here a post regarding the override.ini file.
I didn't delete anything, as the poster there suggests, but changed the relevant User JavaScript values from 0 to 1.
Seems to help, tho I'm not yet convinced everything is working as it should...
Opera 10.53 3374

7. February 2010, 20:02:19

techlawsam

Posts: 2161

thanks again! great FAQ

9. February 2010, 04:06:14

usatonycuba

« Just Learning »

Posts: 266

Originally posted by samMD:

thanks again! great FAQ

+1 lo

3. March 2010, 16:17:23

Frenzie

Posts: 14440

Is (was) document.selection the same as window.getSelection()?
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

3. March 2010, 16:54:52

Lex1

Posts: 1718

Yes, something like (window|document).getSelection, from IE-world.
document.selection also can to work with a textarea, what has no direct analogue. However, it is mainly essential for bookmarklets.

1. April 2010, 15:16:46

The-Remcotje

Posts: 63

Originally posted by CCVo:

Originally posted by totalimpact:

Any reason why scripts wouldnt work - I have the copy clipboard script and google images script, and neither works. I have built a script dir in my profile and set it in preferences, and made sure to check the enable java script box, and set the option in opera6.ini to: Always Load User JavaScript=1 and yes i restarted opera several times.

After all that I also installed the userjs manager, it shows my scripts activated, but they do nothing.


Same here.
But, I found here a post regarding the override.ini file.
I didn't delete anything, as the poster there suggests, but changed the relevant User JavaScript values from 0 to 1.
Seems to help, tho I'm not yet convinced everything is working as it should...



okay, I have the same problem, but I really can't find the override.ini file, where can I find it?

2. April 2010, 16:08:47

The-Remcotje

Posts: 63

Originally posted by The-Remcotje:

Originally posted by CCVo:

Originally posted by totalimpact:

Any reason why scripts wouldnt work - I have the copy clipboard script and google images script, and neither works. I have built a script dir in my profile and set it in preferences, and made sure to check the enable java script box, and set the option in opera6.ini to: Always Load User JavaScript=1 and yes i restarted opera several times.

After all that I also installed the userjs manager, it shows my scripts activated, but they do nothing.


Same here.
But, I found here a post regarding the override.ini file.
I didn't delete anything, as the poster there suggests, but changed the relevant User JavaScript values from 0 to 1.
Seems to help, tho I'm not yet convinced everything is working as it should...



okay, I have the same problem, but I really can't find the override.ini file, where can I find it?



Allright, I think I have done something wrong because the downloaded script contained 0 characters, I don't know why. But now it's fixed and it works fine. Also Unite's UJS Manager is a great tool, it makes it so easy to download new scripts!

19. April 2010, 16:54:45

Lex1

Posts: 1718

document.selection.createRange().text


Approximate analogue:
var getText=function(){var d=document,s=d.getSelection(),t=d.getElementsByTagName('textarea');if(!s)for(var i=0,e;e=t[i];i++){if(s=e.value.substring(e.selectionStart,e.selectionEnd))break}return s};

9. October 2010, 15:44:30

DavidCan

Posts: 10

Nice list of FAQ. Thank you.

3. March 2011, 19:23:01

sofiamarcella

Posts: 3

good, i can add on ... thank for FAQ

20. February 2013, 17:56:44

99th

Posts: 1

hi. i'm looking for piece of script to prevent google search interface from capturing my keyboard input no matter where focus is: everytime i use oldschool "1" and "2" to switch between tabs, google handles those keypresses and substitute "1" and "2" chars into it's search field. is there any complete solution for this problem? would appreciate any suggestions. thx in advance.

26. February 2013, 14:34:57

XAntares

хаха гага

Posts: 140

You could

Originally posted by 99th:

i'm looking for piece of script to prevent google search interface from capturing my keyboard input no matter where focus is: everytime i use oldschool "1" and "2" to switch between tabs, google handles those keypresses and substitute "1" and "2" chars into it's search field.


You might take a look at this short UserJS: »» google-search-key-unbreaker-userjs.
Never argue with an idiot. They drag you down to their level, then beat you with experience. «« « ‹‹ ‹

Forums » General Opera topics » User JavaScript