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

14. September 2010, 10:48:09

i-0

moderator immoralis

Posts: 3455

I have many shared scripts in several sub-folders, but other Unite people can see shared scripts only in active UserJS folder (when a folder is opened in the UJS manager in side-panel). Is it a bug? Can it be fixed?

14. September 2010, 14:02:10

lucideer

a B person

Posts: 5114

Originally posted by i-0:

Is it a bug? Can it be fixed?


I'm not the developer here obviously, but my guess is that it's not a bug - it's intended behaviour, but it could potentially be fixed. I would guess most users wouldn't expect sub-folders to be shown, given that sub-folders aren't counted as "active" by Opera for script execution either.

14. September 2010, 19:13:50

i-0

moderator immoralis

Posts: 3455

Originally posted by lucideer:

given that sub-folders aren't counted as "active" by Opera for script execution either

Why? I simultaneously use scripts located in several folders, by specifying them as follows:
[User Prefs]
User JavaScript File=folder1,folder2,folder3

If I understood you correctly of course. smile

14. September 2010, 21:06:23

lucideer

a B person

Posts: 5114

I'm well aware you can specify many different folders - however you have to do that for each individual one. Opera doesn't automatically pick up sub-folders if you specify a parent. And similarly, UJS Manager doesn't currently either. It could, but I don't think most would expect it to. Not by default anyway.

18. September 2010, 02:03:12

Quadunit404

Someone

Posts: 365

Does this cause Opera to crash when installing or updating a UserJS for anybody else? That seems to happen to me each time I install or update a UserJS.
Go to ExtendOpera.org for all your customization needs.

18. September 2010, 09:48:54

Opera Software

d.i.z.

bug hunter

Posts: 3029

@i-0: Sounds like a bug, yes. When I think about how it's made, it doesn't look like it would be a 2 minutes fix.

@Quadunit404: I sent you a private message.

19. September 2010, 02:23:21

i-0

moderator immoralis

Posts: 3455

@d.i.z.: It is a pity that quickly to correct won't turn out. But I will hope. Thx in advance!

24. September 2010, 01:50:32

spadija

Posts: 1635

Installing scripts from userscripts.org would be much nicer if you could rename files before installing them. As it is, they come named something like 73213.user.js. Since everything gets automatically named *.user.js on userscripts.org, but some Opera scripts are meant to be run as *.js, being able to rename before installing would also help, since you wouldn't need to go into the user script directory and change the filename yourself.

Thanks for the awesome extension!

24. September 2010, 08:10:19

i-0

moderator immoralis

Posts: 3455

Originally posted by d.i.z.:

@i-0: Sounds like a bug, yes.


Also noticed that the same thing happens when you choose to temporarily disable all scripts: disables only the scripts in active UJS directory.

24. September 2010, 13:29:56 (edited)

Penge4

bug hunter

Posts: 315

Originally posted by spadija:

Opera scripts are meant to be run as *.js, being able to rename before installing would also help


Not every scripts work after rename. If the addEventLister is missing, many script doesn't work, only in "GM emulate mode" with .user.js suffix.

BTW the name of scripts should the script's real name with underline for example: Userscripts.org_Admin_Enhancer.user.js instead of 73213.user.js

24. September 2010, 16:51:33

spadija

Posts: 1635

Originally posted by Penge4:

Not every scripts work after rename. If the addEventLister is missing, many script doesn't work, only in "GM emulate mode" with .user.js suffix.


Yeah. By "some Opera scripts", I meant scripts designed for Opera that aren't supposed to run in GM emulation mode. Obviously, not all scripts need to be renamed, just some, hence why being able to rename before (or even after) saving would be useful.

8. October 2010, 07:59:35

TerDale

"Operator" since 2002

Posts: 62

One feature I have on my wish list is the capability to disable all scripts except the currently selected one.
I'm doing this when one of my installed script is no longer working as expected, to know if some newly installed scripts could interfere, or if this could be due to the latest Opera version installed (including some weekly builds)
What do you think?

TIA
Opera 12.11.1661 32-bit .../... Windows 7 x64 , 16 GB RAM .../... ¤

25. October 2010, 20:52:02

Opera Software

d.i.z.

bug hunter

Posts: 3029

- 3.0
* Added: CodeMirror editing component which supports syntax highlighting, line numbering and more
* Added: possible to change file name of user script on installing
* Fixed: ujs_manager_installer.js script is now less strict on checking if given page contains script only. Fixes compatibility with some other user scripts.
* Fixed: escaping problems that caused line endings to be changed on installing script

26. October 2010, 08:36:53

QuHno

Posts: 973

Originally posted by d.i.z.:

* Added: CodeMirror editing component which supports syntax highlighting, line numbering and more


Coooo-el! up

26. October 2010, 13:08:26

netwolf

Posts: 1786

Thanks for the update!
I got a problem with it though: when clicking the Edit button of an arbitrary script, I don't see the source anymore (as with previous versions), but Opera goes to 99% CPU usage instead.

Using v11 snapshot (1029) on XP SP3.
Using Win 7 x64 and latest Opera snapshpot, lab build or final, whatever is newer...

26. October 2010, 14:20:11

Penge4

bug hunter

Posts: 315

Originally posted by d.i.z.:

* Added: CodeMirror editing component which supports syntax highlighting, line numbering and more
* Added: possible to change file name of user script on installing


Big thanks!

26. October 2010, 16:34:11

Opera Software

d.i.z.

bug hunter

Posts: 3029

Originally posted by netwolf:

I got a problem with it though: when clicking the Edit button of an arbitrary script, I don't see the source anymore (as with previous versions), but Opera goes to 99% CPU usage instead.


Maybe specific to some script? It would be bug in CodeMirror then which should be reported.

26. October 2010, 18:32:12

QuHno

Posts: 973

No such problems with my XP SP3 and Opera 11.
The highlighting is a bit on the pale side for my taste (monitor calibrated to ECI-RGB) but OK...

26. October 2010, 18:39:28

Frenzie

Posts: 14440

Works fine here too with v3.0.
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

31. October 2010, 23:18:24

Rodny

Posts: 6

Originally posted by d.i.z.:

* Fixed: escaping problems that caused line endings to be changed on installing script


Thanks.

10. November 2010, 10:27:02

ohmanger

Posts: 9

I can't edit files (I get a 'Wasn't able to read file or file empty!' error) and afais they aren't running either (I don't get an option to install them when I go to a .js page)

7. February 2011, 16:43:38

@d.i.z.: (If you're working on a new version...) Please, add an information that you have to enable iframes in order to be able to edit the code. I was very confused for a short time. Then I started Dragonfly and saw that there's an iframe in there :/.

7. February 2011, 20:53:37

Opera Software

d.i.z.

bug hunter

Posts: 3029

@Saskatchewan: Suggested that change to CodeMirror and modified local copy accordingly.
I have not really worked on UJS Manager lately so I don't know when I will have something for release though. It might take a while.

@ohmanger: Sounds like you might not have enough privileges to access files in that directory. Try some other like C:\userjs.

15. December 2011, 11:42:31

nctrns

Posts: 7

I'm using Opera 11.60 and the latest UJS Manager. I get a 404 when I try to open it. Any help?

15. December 2011, 13:30:02

Opera Software

d.i.z.

bug hunter

Posts: 3029

If you try to open it from the Unite side-panel, does it work? If not, does Home service work?

15. December 2011, 13:38:10

I guess it doesn't work for a few days now (for me), since the Unite Home app was updated.

It doesn't work even when opened "manually" from the side panel. Unite Home does work.

16. December 2011, 20:42:39 (edited)

rif

Posts: 561

Originally posted by nctrns:

I'm using Opera 11.60 and the latest UJS Manager. I get a 404 when I try to open it. Any help?

I'm also getting the 404. Tried deleting and reinstalling. Tried opening from side panel and //admin.home.rif.operaunite.com/# and that didn't work either.

Just tried it on the laptop and I also get the 404 error.

20. December 2011, 16:04:00

Opera Software

d.i.z.

bug hunter

Posts: 3029

I can reproduce, will look into it.

20. December 2011, 16:10:13

Frenzie

Posts: 14440

Oh, I'm getting that too, but I thought it was just because I copied a bunch of Unite stuff over from an older profile (albeit other Unite apps seem to work fine).
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

20. December 2011, 16:24:52

Opera Software

d.i.z.

bug hunter

Posts: 3029

OK. Latest version (3.2) doesn't work because it is actually a 3.0 version. I have fixed that problem in 3.1 which was published on unite.opera.com but apparently some time later it got reverted to 3.0 and at the same time labeled as 3.2.

So for now just download 3.1 which has this problem fixed - https://unite.opera.com/application/download/401/3.1/ and in the meantime I'll try to figure out why did this screwup happen.

20. December 2011, 16:40:06

TerDale

"Operator" since 2002

Posts: 62

Thanks d.i.z., we're back to life with this fixed version wink
Opera 12.11.1661 32-bit .../... Windows 7 x64 , 16 GB RAM .../... ¤

21. December 2011, 14:48:22

QuHno

Posts: 973

Thanks for the fix, works fine with all installed Opera versions up

26. December 2011, 23:00:45

Originally posted by d.i.z.:

OK. Latest version (3.2) doesn't work because it is actually a 3.0 version. I have fixed that problem in 3.1 which was published on unite.opera.com but apparently some time later it got reverted to 3.0 and at the same time labeled as 3.2.

So for now just download 3.1 which has this problem fixed - https://unite.opera.com/application/download/401/3.1/ and in the meantime I'll try to figure out why did this screwup happen.



There is some bad css in client_style.css, -o-text-overflow should be just text-overflow. Should also see if the new codemirror and jquery would work.

Do you think Tampermonkey could be ported or used to extend UJS Manager? If it was combined with an Extension we could have a working gm-menu.

1. January 2012, 22:13:36

a303

Posts: 22

I was getting the 404 as well, and after about an hour I read that I had to downgrade to v3.1. Now, I can see the UJS Manager page with my installed scripts, and installation from userscripts.org works normally.

But the scripts don't work at all, as if they were not installed. The four scripts I have installed are:
1. aagmfunctions.js
2. No Click to Activate
3. UJS Manager - script installer
4. YousableTubeFix for Opera

None of them (except UJS Manager - script installer) seem to work; toggling them has no effect. I still have to click a Flash video to 'use the control'. Can anyone help?

My setup: O11.60b1185 (x86_64) on Ubuntu 10.04, Flash 11.2 beta 3. No other extensions installed.

3. January 2012, 13:53:31

a303

Posts: 22

Can anyone help?

3. January 2012, 20:15:37

Opera Software

d.i.z.

bug hunter

Posts: 3029

@a303: I suppose these specific scripts have some problems. Put them somewhere and possibly someone will look at them.

@toyotabedzrock: thanks. Will try to fix those some day. As for doing more of what Tampermonkey can do, I'm afraid I won't have much time to work on that. I can only hope that someone will pick up the sources (https://github.com/rchl/UJSManager) and do something creative with them. smile

25. November 2012, 15:19:39

D555

Posts: 229

I hope that some one good man will convert it into Opera extension! Please!!!

26. November 2012, 02:25:01

spadija

Posts: 1635

If it were possible, I would have already done it. Unfortunately, Opera extensions don't have access to write files to your computer, so they can't save script files to your user script directory, nor can they modify the scripts that are already there.

26. November 2012, 13:49:11

D555

Posts: 229

saving is easy when starting common dialog to save file...if is known the directory it won't be the problem...
modifying is possible with starting an external app, for example - notepad

26. November 2012, 15:45:49

spadija

Posts: 1635

You can't just open a file dialog to save the file, you can only open the file in a new tab and force a download. Opera 12.10 broke the only way I could find to force a download with a proper filename, so you're either going to open a download dialog to save a file named "default" (no extension) or you can display the script in a tab as text.

For something like UJS manager to work, it needs to be able to turn scripts on and off. To do that, it needs to be able to rename the scripts so that Opera will ignore them. To do that, the extension needs to be able to rename files, which it can't do.

Forums » General Opera topics » Opera Unite