simple userscript engine aimed at power users

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

Axiomatic

Re: simple userscript engine aimed at power users

Unread post by Axiomatic » 2015-08-03, 17:35

Thank you for the fix. However I have another (possible?) bug for you.

When using Guerilla Script with the UserScript called, 'Webcomic Reader' inside the console I see:

Code: Select all

invalid number of arguments to `GM_getValue()` @ resource://gre/modules/XPIProvider.jsm -> jar:file:///home/SmileyFacedHacker/.moonchild%20productions/pale%20moon/SmileyFacedHacker/extensions/guerilla@ketmar.no-ip.org.xpi!/bootstrap.js:39


The UserScript:
Webcomic Reader: https://openuserjs.org/install/ameboide ... er.user.js

I am not sure whether the UserScript breaks a rule of some set standard, although I can confirm it works in Scriptish. Please take a look at the issue when you have the time.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-03, 18:01

the issue is with slightly different implementation of `GM_getValue()` in GM, GS and Scriptish.

GM accepts one arument, and ignores any extra args.
Scriptish accepts two arguments, using second as "default value".
GS accepts only one argument, throwing error if there are no arguments or more then one argument.

actually, there is nothing wrong in supporting Scriptish variant, so i made GS to accept either one or two arguments for `GM_getValue()`.

thank you for testing. i pushed fix in git, so you can test it if you like. it should work if i didn't messed something. ;-) sorry, no .xpi update for now — i'm designing "package manager" and want to upload next update with package manager working (and possibly on APO too).

yet feel free to ping me if you need new .xpi — or use zbuild.sh script to build it yourself (don't mind the error about missing "advzip" — it's simply ZIP recompressor, and it is purely optional).

Axiomatic

Re: simple userscript engine aimed at power users

Unread post by Axiomatic » 2015-08-03, 19:37

I built GS via the latest Git commit, I can confirm that the UserScript 'Webcomic Reader' works. Thank you.

-- I had to chmod +x zbuild.sh before I could execute the script, did Git mess up with the file mode? Not really a bug, just thought you should know because it seems a bit peculiar. Thank you again ketmar, GS is really a nice add-on.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-04, 06:35

>I had to chmod +x zbuild.sh before I could execute the script, did Git mess up with
>the file mode?

i'm using "sh zbuild.sh" from terminal, so it's not git, it's me who didn't set +x. ;-) i'm using midnight commander to develop GS, and didn't set +x so i will not accidentally run it.

thank you for testing, i'm glad you like GS.

p.s. i wonder why "select like a boss" wasn't made as userscript. with some small cosmetic changes is works as user js in GS.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-08, 21:57

major update: i bumped version!

well, while this is most visible change, there are more: i added simple "package management", so you don't have to manually download scripts from openuserjs or similar sites. GS can download scripts with their supplemental files now, register 'em in internal database and update 'em.

no automatic updates are planned, though: i don't want GS to live it's own hidden life.

see updated README file for brief description of package manager.

note that some scripts may not work as expected or not work at all. please, report here, with script URL, so i can do some investigation and either fix GS, or tell you why your script will not work in GS.

thank you for using GS.

p.s. if you are extension developer, don't miss my upcoming post in developement forum. i'll plan to tell you how i've used slightlty modified xpcshell to debug GS backend — script cache, package downloader and manager, etc. i built a small library that allows to debug backend js in xpcshell and then use almost unmodified source in addon itself. i'll make my lib public, along with some explanations of the process. but be patient, please, i still have to finish documentation and accompanying article, it may take some time!

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-10, 21:38

microupdate. fixed some small bugs, and made GS not restartless.

making GS play as proper restartless addon requires too much efforts for too little gain. restartless mode never worked properly anyway. even if it looks like working, it wasn't. believe me, i know it. ;-)

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-12, 21:27

major bugfix update: i completely forgot that user can open multiple browser windows. everything was broken in this case, in various funny ways. i'm really sorry.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-25, 04:04

update: GuerillaScript can be installed from my website now, and it is able to update itself via internet. read first post to learn more.

_Poke_

Re: simple userscript engine aimed at power users

Unread post by _Poke_ » 2015-08-25, 11:11

I could install it fine without any about:config edits. PM complained about a connection error installing normally, but I just saved to desktop then installed. Maybe that's a PM bug?
Maybe you'd still need the edit for it to update though.

You could probably get it hosted on the PM addons site if you wanted, though I guess as is it'd be slower to push out updates.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-25, 11:26

_Poke_ wrote:I could install it fine without any about:config edits. PM complained about a connection error installing normally, but I just saved to desktop then installed. Maybe that's a PM bug?
no, installing from local file works ok. you need to tweak about:config to install directly from website, without saving it first, though.
_Poke_ wrote:You could probably get it hosted on the PM addons site if you wanted, though I guess as is it'd be slower to push out updates.
that is the plan. but for this release i was simply testing my update.rdf generator, found it working and rolled an update.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-08-30, 19:14

we (me and my pet addon) are at APMO now! thanks, Tobin!

to celebrate this wonderful event, GS now has inline options page.

Tharn

Re: simple userscript engine aimed at power users

Unread post by Tharn » 2015-09-17, 16:05

Working quite well for me, even though I'm too stubborn to read documentation on principle. ;)

Question though: How is this extension with leftover js pieces in browser memory? Does it clean up after itself? I know Greasemonkey has some issues in this department so I was looking for something a bit more efficient to work in a low memory environment.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-09-17, 19:00

it tries hard to nuke all javascript sandboxes it creates (literally, with the corresponding API) on page unload — this is the best i can do to clean up the memory, and it seems to work well. it (GS) also slightly faster (but you won't notice that ;-) and using less memory for addon itself (than GreaseMonkey), 'cause GreaseMonkey have to support all mozco weirdness like e10s.

p.s. if you're writing scripts by yourself (i bet you do! ;-), please note that new version is on it's way. nothing radically new, but non-standard "@require" and "@library" metas are deprecated and replaced by js API instead. don't worry, though, support for deprecated features wll be there at least for one or two versions.

Omitooshi

Re: simple userscript engine aimed at power users

Unread post by Omitooshi » 2015-10-09, 04:31

you should add the explanations in the OP in the addon site.
I was scratching my head after i installed it. -_-

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-10-09, 05:49

yes, i tend to forget about other users — i know how to use GS, so everybody should know too! i'll think about adding a toolbar button which will open simple "howto" on clicking, and automatic opening howto/readme on first install. this should provide some hints to users who doesn't know what to do after installing GS.

Omitooshi

Re: simple userscript engine aimed at power users

Unread post by Omitooshi » 2015-10-09, 07:16

You could easily and immediately add some explanations in the preferences.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-10-09, 07:27

it's not that easy to add text to inline preferences. addons can have two types of preferences: their own XUL window, or so-called "inline preferences". the latter is very limited, and adding something besides some standard controls there is even harder then creating XUL window from scratch. and i'm using inline preferences... :-)

Omitooshi

Re: simple userscript engine aimed at power users

Unread post by Omitooshi » 2015-10-09, 09:32

I checked again what i had seen.
It seams that, they shoved a quite long explanation at the place where you have the line "Userscript injecting ...". But all the text is visible in FF only, PM is the one that is limited. They also have a picture and a link for the name. Self-Destructing Cookies is a good example.

It seams like a good feature request. :D
What if you asked the devs for that?
You just complained about it :P

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: simple userscript engine aimed at power users

Unread post by ketmar » 2015-10-09, 10:21

tbh, i don't like "inline options" at all. they are there just 'cause i found API for that and wanted to try it. :-) i can write a patch to "improve" inline options, but i'd rather don't.

and i think that opening some info tab on first run plus useless, but visible toolbar icon is enough.

ok, toolbar icon can be useful — i can show number of active scripts and other things there, maybe even add some kind of control UI a-la uBlock Origin. i'll think about that too.

wost_

Re: simple userscript engine aimed at power users

Unread post by wost_ » 2015-10-09, 13:19

There is a "description" property available for an inline option, it shows additional text under the option's name. But yes, inline preferences are poor if you want something more than few checkboxes.

Locked