My UJS Manager service

Forums » General Opera topics » Opera Unite

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

Go to last post

23. August 2009, 21:49:42

Opera Software

d.i.z.

bug hunter

Posts: 3029

My UJS Manager service

Here is my take on Unite technology. It's simple manager for User Scripts directory.

Features:
  • enable/disable selected script
  • display userjs header fields
  • edit userjs settings (requires modifications to script files)
  • quick find through scripts


To install, save file anywhere, drop into Opera window and pick you user scripts folder.
Although I haven't had any problems with corrupted/deleted files, it's better to backup user scripts directory before trying this service.

Download: UJS Manager

Editing scripts from manager requires special modifications to scripts and is more of an expert feature. So not for faint of heart wink.

Here is a snippet of my user script that shows three object properties that will be exposed to UJS Manager as nice switchable checkboxes:
prettyify_js          : /*@Prettify Javascript@bool@*/false/*@*/,
replace               : /*@__replace 3@string@*/'debugger; if (! (a[J]'/*@*/,
replace_scripttext    : /*@Replace text in scripts@bool@*/false/*@*/,


Idea is to wrap any javascript variable into special formatted comment.
Syntax is:
/*@CUSTOM_NAME@(bool|int|string)@*/JS_VARIABLE/*@*/

Here's picture of some helper script that I've modified to expose most useful settings: http://files.myopera.com/d.i.z./files/ujs02.png

3. March 2010, 16:22:57

Frenzie

Posts: 14478

It told me about the update a few times, but when I went over to http://unite.opera.com/application/401/ it was just v2.3. v2.4 finally seems to be there now, cheers.

And when I said "to the left" earlier I meant "to the right" of course. p
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

3. March 2010, 19:12:35

Opera Software

d.i.z.

bug hunter

Posts: 3029

Yep, notification about new bersion broken in 10.50 because .text property was removed from HTMLElement. Fixed in 2.4 of course.

4. March 2010, 08:08:42

Frenzie

Posts: 14478

The v2.4 theme looks fine in my standard layout on Windows, but with my purple layout on Linux it looks out of place and just like the standard layout. Previously it adjusted itself (presumably with some -o-skin property or something?). Can we get automatically adjusting colors back for the next version? bigsmile
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

4. March 2010, 22:54:32

Opera Software

d.i.z.

bug hunter

Posts: 3029

I don't think I will bring it back. It was causing problems because skin elements can be unavailable in custom skins. Even official skin in 10.50 removed some skin elements that I was using.

I can't see good way of using skin elements and retaining readability in all cases. One of the reason is that color: -o-skin does not work like it should. If given skin element is not available, it uses red color.

4. March 2010, 22:59:40

lucideer

a B person

Posts: 5114

Originally posted by d.i.z.:

skin elements can be unavailable in custom skins


Not sure I understand how this is possible (I'm not a skinner though) - don't all skins fall back to the default skin element definitions for undefined elements?

4. March 2010, 23:08:57

Frenzie

Posts: 14478

Originally posted by d.i.z.:

I don't think I will bring it back. It was causing problems because skin elements can be unavailable in custom skins. Even official skin in 10.50 removed some skin elements that I was using.


Aw. sad

Another question, your screenshot shows this nice hierarchy of options but with the information you've given I can only get a straight list?
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

4. March 2010, 23:32:59

Opera Software

d.i.z.

bug hunter

Posts: 3029

Not sure I understand how this is possible (I'm not a skinner though) - don't all skins fall back to the default skin element definitions for undefined elements?


I didn't really test with custom skins. I guess they do. So I guess the biggest problem I stumbled upon was that I couldn't get the color that I could use for text that would always contrast with skin element background. Text color is not always defined in skin section. In this case, getting color would just return red which is not most pleasant to look at.

Another question, your screenshot shows this nice hierarchy of options but with the information you've given I can only get a straight list?


Ah, yes, looks like I forgot to mention it. Number of underscores before CUSTOM_NAME defines how big left-margin it gets in em's.
For example, this will give 1em left margin: /*@_CUSTOM_NAME@(bool|int|string)@*/JS_VARIABLE/*@*/

5. March 2010, 07:44:24

Frenzie

Posts: 14478

Originally posted by d.i.z.:

Ah, yes, looks like I forgot to mention it. Number of underscores before CUSTOM_NAME defines how big left-margin it gets in em's.

For example, this will give 1em left margin: /*@_CUSTOM_NAME@(bool|int|string)@*/JS_VARIABLE/*@*/


Thanks. Don't forget to update the instructions at some point. smile

I also notice the text inputs (for int and string) are on the right whereas mine are on the left. Is this some other option or is it just an older default?
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

5. March 2010, 15:13:43

Opera Software

d.i.z.

bug hunter

Posts: 3029

I also notice the text inputs (for int and string) are on the right whereas mine are on the left. Is this some other option or is it just an older default?


I changed that in latest version so that they are not hidden completely with small width.

22. April 2010, 15:24:33

i-0

moderator immoralis

Posts: 3455

Added option to toggle all scripts


Wow! Thank you! I'm happy.

26. April 2010, 15:47:51

I am new to this application so bear with me. I open a script in Opera and receive the message "UJS Manager detected script file. It can be installed as a user script." and associated button "Install User Script". I select this button and a new page displays with the error: "This won't work. Bad unique id.". What could I be doing wrong?

I also noticed that I defined my JavaScript home as: "D:\Program Files\Opera backup files\Javascripts" but if I enter a new JavaScript using USJ Manager it writes it out to: "C:\Program Files\Opera backup files\Javascripts". My Windows XP is booted from my D: drive.
Thanks in Advance...
__________________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

26. April 2010, 16:30:46

Opera Software

d.i.z.

bug hunter

Posts: 3029

Don't you have two copies of UJS Manager installed?

26. April 2010, 18:55:17

Thanks for you help. I only had one version. I deleted it and installed again and it is working now. Not sure what has changed.
Thanks in Advance...
__________________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

26. April 2010, 19:16:04

netwolf

Posts: 1786

Had the same issue with an old installation (10.10). When attempting to udpate the script, I got the same error message.
Using Win 7 x64 and latest Opera snapshpot, lab build or final, whatever is newer...

26. April 2010, 22:03:13

Originally posted by netwolf:

Had the same issue with an old installation (10.10). When attempting to update the script, I got the same error message.


I am running Version 10.52 Build 3370 on a Win32 Windows XP. Maybe something was hanging around so I am assuming the same ballpark error. Thanks for your input.
Thanks in Advance...
__________________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

29. April 2010, 16:30:26

I just installed Windows 7 Enterprise (64 bit) and UJS Manager is not functioning. When I select that Unite application server I just receive a flashing circle (hourglass I guess). It never comes back with the UJS Manager front end. Could it be a file access security problem? I never really worked with Vista nor Windows 7 and they seem to be a lot tighter on folder\file access.

Also if I open a javascript file and select the "Install user Script" button I recieve the error: "The address was not found (Error 404)". USJ Manager error.png

I am running Opera v10.53 Build 3374
Thanks in Advance...
__________________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

29. April 2010, 17:14:38

Opera Software

d.i.z.

bug hunter

Posts: 3029

Yes, you might have chosen directory that Opera has no permission to write into. Next version should show meaningful message when that happens instead of failing miserably.

You should just create some folder for user scripts inside C: for example and it should work.

9. June 2010, 12:52:27

Alpha-Toxic

Posts: 190

@d.i.z.:
I'll go a bit off-topic. I just saw the "What is your dream Unite app?" post in the Unite blog. After writing a comment there
http://my.opera.com/unite/blog/what-is-your-dream-unite-app#comment30716792

What I want: something similar to UJS but about urlfilter.ini. I want a app that does this:
The user enters a list of URLs that point to urlfilter files on the net (say Fanboys's list), periodically (or on demand) downloads the latest versions from those URLs and keeps them in a folder somewhere in Opera's folder. Takes the files and combines them (by simply appending the 'exclude' parts) into a single urlfilter.ini, puts it in Opera's folder and tels the user to restart Opera.
I am maintaining my own urlfilter.ini that is a localized version of Fanboy's list and it would be great if I could put just my additions in my repository and the user could just point said Unite app to both my short list and Fanboy's big list and have the automatically combined. I really really want this...


I realized that if anyone can do it, that's you. So my questions are, in your opinion, is a UJS Manager-like app for managing urlfilter.ini even possible and, more importantly, are you willing to make it?

BTW, the UJS Manager is ridiculously good, especially for people like me that constantly install, try and remove different userjs.

9. June 2010, 13:09:16

burnout426

Posts: 12531

Originally posted by Alpha-Toxic:

What I want: something similar to UJS but about urlfilter.ini.



And, I want one like that but for webmailproviders.ini wink

9. June 2010, 22:38:49

Opera Software

d.i.z.

bug hunter

Posts: 3029

Originally posted by Alpha-Toxic:

@d.i.z.:
I'll go a bit off-topic. I just saw the "What is your dream Unite app?" post in the Unite blog. After writing a comment there
http://my.opera.com/unite/blog/what-is-your-dream-unite-app#comment30716792

What I want: something similar to UJS but about urlfilter.ini. I want a app that does this:
The user enters a list of URLs that point to urlfilter files on the net (say Fanboys's list), periodically (or on demand) downloads the latest versions from those URLs and keeps them in a folder somewhere in Opera's folder. Takes the files and combines them (by simply appending the 'exclude' parts) into a single urlfilter.ini, puts it in Opera's folder and tels the user to restart Opera.
I am maintaining my own urlfilter.ini that is a localized version of Fanboy's list and it would be great if I could put just my additions in my repository and the user could just point said Unite app to both my short list and Fanboy's big list and have the automatically combined. I really really want this...


I realized that if anyone can do it, that's you. So my questions are, in your opinion, is a UJS Manager-like app for managing urlfilter.ini even possible and, more importantly, are you willing to make it?

BTW, the UJS Manager is ridiculously good, especially for people like me that constantly install, try and remove different userjs.


It sounds like something that could be made in few lines in some scripting language.
I'm a bash newb but something like that could work:
wget http://filter1
wget http:// filter2
cat filter_header filter1 filter2 myfilter > urlfilter.ini

On windows you can install cygwin to get all required tools for that.

26. June 2010, 13:08:33

Opera Software

d.i.z.

bug hunter

Posts: 3029

In latest version (2.8) I've added simple (semi hidden) script update notifier.

Every three days all active scripts are checked for update. It looks for update by checking (in that order):
a) original URL that script was installed from (if it was installed using UJS Manager - download URL is saved by it)
b) userjs header field "download"
c) userjs header field "ujs:download"
d) userjs header field "identifier"

If any of these is available then it proceeds to check if either userjs header field "version" of remote script is higher or "ujs:modified" is later.

Given that most user scripts don't use these headers (some even don't use "version"), it will not be able to detect update in a lot of cases unfortunately but still better than nothing.

26. June 2010, 18:59:36

Penge4

bug hunter

Posts: 317

Would be great if the update process merges the @include and @exclude headers with my custom urls and with the newer version new items.

1. July 2010, 08:07:23

Björni

Posts: 131

Hi,
I´m using the UJS Manger at long time and I have never problems with it. But now when i open a UJS-Link the manager doesen´t run...??
10.60RC3 3445 and the older version... by O 10.60 beta Build 3437 works !!
Build 3437
UJS!.JPG
Build 3445
UJS2.JPG

Thanks for help

1. July 2010, 11:28:50

Opera Software

d.i.z.

bug hunter

Posts: 3029

Have you disabled ujs_manager_installer.js by any chance?

1. July 2010, 11:56:56

Björni

Posts: 131

Have you disabled ujs_manager_installer.js by any chance?
hi
No they work everytime ujs.JPG
bye

1. July 2010, 12:02:23

Opera Software

d.i.z.

bug hunter

Posts: 3029

I mean the script that is named ujs_manager_installer.js

1. July 2010, 13:54:07

Björni

Posts: 131

hi
Yes !!
Look please
ss.JPG

Thanks & bye

1. July 2010, 19:57:59

Opera Software

d.i.z.

bug hunter

Posts: 3029

Some other user script might conflict with it then. Try removing other scripts one by one and figuring out which one is causing it.

1. July 2010, 22:19:12 (edited)

Björni

Posts: 131

Ok doh
Yes i have !!
The oAutoPagerize-Script is the one

5. July 2010, 10:48:05

Frenzie

Posts: 14478

It seems like the latest version doesn't read userscript headers anymore if they're not on the first line, plus it automatically strips said first line & UTF-8 BOM when automatically installing scripts.
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

12. July 2010, 19:48:26

drlaunch

Traveler from Beyond

Posts: 1063

The script installer doesn't work when oAutoPagerize is active. Any workarounds for this?

12. July 2010, 19:58:53

Frenzie

Posts: 14478

I imagine excluding *.js might do the trick in the majority of cases?
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

15. July 2010, 20:39:29

Opera Software

d.i.z.

bug hunter

Posts: 3029

Heads up.
Current Opera builds seem to have some bug that makes XHR in unite applications stop working after restarting Opera (works only after first install of application).
That makes UJS Manager not load when it tries to check for update because I'm not catching exception (fixed in 2.9).

20. July 2010, 02:12:06 (edited)

webrider

10.10.1893 user

Banned user

Originally posted by Frenzie:

It seems like the latest version doesn't read userscript headers anymore if they're not on the first line, plus it automatically strips said first line & UTF-8 BOM when automatically installing scripts.


yup
http://unite.opera.com/application/401/2.9/2/#comment20832

I made a change to only accept user script headers that are located in the beginning of the file. If it is not, then it is invalid header which Opera should not consider valid either.


Why u did it? I can't remember any paper that contains such requirements. Moreover, Opera can easily recognize metadata from 2nd, 10th, 1000th line or even next to the last bracket.
Новая Opera! Загрузите новый быстрый браузер. Для PC, Mac, и Linux

20. July 2010, 08:21:26

Opera Software

d.i.z.

bug hunter

Posts: 3029

Originally posted by webrider:

Why u did it? I can't remember any paper that contains such requirements. Moreover, Opera can easily recognize metadata from 2nd, 10th, 1000th line or even next to the last bracket.


Because I found scripts that include header of another script inside a comment but did not have it's own header. So then name and other info were all wrong in manager.
But clearly I have to allow that. Just need to make parsing smarter.

20. July 2010, 21:24:51

Frenzie

Posts: 14478

Are scripts automatically handled as UTF-8? If not, stripping the BOM could mess things up for non-Western UserJS authors. The reason for the new line is that Opera ignores the UserJS if there's a BOM present.

I don't care much about the lack of reading headers, but the automated stripping of the BOM doesn't seem like a very good idea to me. If you wish I'll whip up a couple of tests to prove whether it is or isn't a problem.
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

21. July 2010, 00:06:54

Opera Software

d.i.z.

bug hunter

Posts: 3029

Originally posted by Frenzie:

Are scripts automatically handled as UTF-8? If not, stripping the BOM could mess things up for non-Western UserJS authors.


Yes, Opera handles scripts as UTF-8 by default unless there is @encoding directive specified. Then it uses specified encoding.

Originally posted by Frenzie:

The reason for the new line is that Opera ignores the UserJS if there's a BOM present.


Yes, I know this bug.

Stripping of BOM is not something that I do deliberately. It just goes away when passing user script text through textarea (obviously). I'm not sure if I will be able to preserve this somehow as usually this is not something that is exposed in javascript. I guess I could specify "user-defined" encoding in XHR to trigger data mode and then I won't loose anything but it might be harder when editing scripts for example...

21. July 2010, 09:34:29

Frenzie

Posts: 14478

Originally posted by d.i.z.:

Originally posted by Frenzie:

Are scripts automatically handled as UTF-8? If not, stripping the BOM could mess things up for non-Western UserJS authors.



Yes, Opera handles scripts as UTF-8 by default unless there is @encoding directive specified. Then it uses specified encoding.


I suppose it shouldn't really be a problem then, though it could cause some unintended consequences (at least if you've got your editor set up to treat files without a BOM as 8-bit).

Originally posted by d.i.z.:

Stripping of BOM is not something that I do deliberately. It just goes away when passing user script text through textarea (obviously). I'm not sure if I will be able to preserve this somehow as usually this is not something that is exposed in javascript. I guess I could specify "user-defined" encoding in XHR to trigger data mode and then I won't loose anything but it might be harder when editing scripts for example...


Oh right, I didn't realize the installation also utilized that method (I just checked the script). I assumed it passed the URI to the Unite service which then downloaded it internally. Or maybe it used to do that? Unless my memory betrays me I don't think it used to strip anything. right
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

21. July 2010, 20:20:30

Opera Software

d.i.z.

bug hunter

Posts: 3029

Originally posted by Frenzie:

I assumed it passed the URI to the Unite service which then downloaded it internally. Or maybe it used to do that?


It used to do this but it didn't work for pages that check referrer. So now I use XHR on page to fetch source and pass as text to "backend".

2. August 2010, 06:32:27

Stuffw1972

Posts: 2

I am new to Opera and have just installed UJS Manager.. I went to userscripts.org and installed a script that I have used in FF , but I can not seem to get it to work here.. I installed Facebook gift-wall-respect acceptor.. I am just hoping u can help.. thanks.

2. August 2010, 13:37:05

Galileo

Opera follower

Posts: 299

Not every script that works in firefox works in Opera also. You can read if they work in the description of the script probably.
WinXP+SP3, Opera 12.00 beta Build 1387
Help expand the Public BTS (un-official) when reporting bugs | Opera Desktop Team | Download Opera | http://www.opera.com/browser/features/

5. August 2010, 22:01:31

Quadunit404

Someone

Posts: 366

Some of the scripts don't mention Opera and yet they work anyway. I've had good luck with a lot of scripts related to YouTube and Google. Other sites? Not so much, but of course it's always good to at least try.
Go to ExtendOpera.org for all your customization needs.

8. August 2010, 19:26:55

Frenzie

Posts: 14478

Even if they don't work in Opera it's usually little trouble to make it work due to unnecessary use of GM-specific functionality (the large majority of GM functions is essentially stupid).
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

15. August 2010, 08:44:19

greench

Posts: 4816

Hi d.i.z,

Could you add multi language support to UJS Manager? All strings in the application are English.
Sorularınızı sorabileceğiniz yeni adresimiz Opera Türkiye Forum

29. August 2010, 19:28:40

Penge4

bug hunter

Posts: 317

Minor bug when the Fit-to-Width is active:

31. August 2010, 16:10:16

Nailz

Posts: 754

The script installer script wasnt working for me since a while. It magically fixed itself (dont ask me how/why, it just did) when I renamed the js to "!ujs_manager_installer.js" - maybe that should be the default?

2. September 2010, 05:27:21

InDigazzZ

Posts: 1067

Originally posted by Nailz:

maybe that should be the default?


yep

9. September 2010, 20:09:31

Rodny

Posts: 6

During UJ-scripts installation UJS Manager changes carriage return from Unix 0x0A to Win 0x0D 0x0A. Because of this stops working noads.js by Lex1. It downloads Adblock Plus subscriptions, but doesn't import them into itself.

11. September 2010, 18:40:58

QuHno

read a book!

Posts: 988

Originally posted by d.i.z.:

If any of these is available then it proceeds to check if either userjs header field "version" of remote script is higher or "ujs:modified" is later.


Does it work with UJS hosted on files.myopera.com too?
What takes precedence, the "version" or the "ujs:modified" info?

Can you update the Infos at unite.opera.com so that script authors can see, that they don't need to build updater of their own, if they include those headers and ask the users to use the UJS Manager?

12. September 2010, 15:19:33

Opera Software

d.i.z.

bug hunter

Posts: 3029

Originally posted by QuHno:

Does it work with UJS hosted on files.myopera.com too?


Unfortunately not. Hotlinking protection prevents it from working.

Originally posted by QuHno:

What takes precedence, the "version" or the "ujs:modified" info?


"version" is checked first. If it's not available or equal then ujs:modified is checked.

Originally posted by Rodny:

During UJ-scripts installation UJS Manager changes carriage return from Unix 0x0A to Win 0x0D 0x0A. Because of this stops working noads.js by Lex1. It downloads Adblock Plus subscriptions, but doesn't import them into itself.


I don't understand why changing line breaks would break script but I have fixed UJSM bug and will include it in next release.

Forums » General Opera topics » Opera Unite