Guerilla Scripting Topic is solved

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

Moderators: FranklinDM, Lootyhoof

User avatar
gracious1
Keeps coming back
Keeps coming back
Posts: 891
Joined: 2016-05-15, 05:00
Location: humid upstate NY

Re: Guerilla Scripting

Unread post by gracious1 » 2017-08-29, 12:25

ketmar wrote:…you can press shift+f2 to bring command line, and type "guerilla about" there to see some documentation.
I tried, and got the error "too many arguments". :problem:
(PM 27.4.2 x86_64 Ubuntu 14.04.5)

EDIT: I see someone else already reported this. But now I can't delete the post. :silent:
20 July 1969 🌗 Apollo 11 🌓 "One small step for [a] man, one giant leap for mankind." 🚀

User avatar
JebDude
Moongazer
Moongazer
Posts: 10
Joined: 2017-08-28, 08:30

Re: Guerilla Scripting

Unread post by JebDude » 2017-08-29, 18:40

ketmar wrote:i don't even think that command interface in GS is working anymore. for some time, v27 didn't had developer tools, so i had to make a workaround (CLI detection), and it seems that instead of workarounding it i broke it. as CLI tools still not working in my current v27 profile (it is profile problem, not v27), i never really checked it all, sorry. and for now i don't have enough time/motivation to restore this feature, sorry again.

you don't really *need* cli interface to GS, though: i'm using GS myself (of course ;-), and as you can see, i never managed to notice that CLI is not working. ;-) sure, i have to do something with that, but it have to wait for some time.

tl;dr: you're doing it right, it is a bug in GS CLI support. ;-) tnx for reporting.
Cool! Thanks for the feedback. I understand and I don't blame you. So how do you use GS then? What is the workaround?

I've also tried the GUI and adding a "script name" (no spaces i guess?) and the URL and that still isn't working for me either.

I'm hoping I'm missing something easy.

I've also tried copy/paste-ing a script to the guerillajs/script folder, and still nada (on Win 10 btw). Are you able to use any of that with GUI on your install? Or do you just go full manual? I've tried GreasyFork as well as OpenUserJS... links from both sites report an error.

This might be the kick i need to really get INTO scripting, instead of just downloading other peep's coolness :-P

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

Re: Guerilla Scripting

Unread post by ketmar » 2017-08-29, 19:14

i'm using it in manual mode, i.e. manually putting files to %PROFILE%/guerillajs/scripts/
it should work (at least it works for me ;-). GUI part was a late addon for people wanting it, and it seems to have a little use (read: i'm not using it, have no reports on it, so it may be broken too). basically, copying .js file should "just work". just make sure that you're copying it in correct directory (correct profile, and so on).

the thing was designed to work like Opera12 "userscript" feature, and in Opera12 there was no UI to manage scripts at all, so i never really wanted to add one too. ;-) that's why GS is for "advanced users" (it means "yay, no help for ya; you didn't expect that using computer will be easy, did you?!" ;-).

i suspect that you just somehow put .js file in the wrong folder. sorry, i don't know where windows version keeps it's profile folders, so i can't help you here. the only thing i can say for sure is that GS is working in v27.4 and v27.5.0a1 at least, so it prolly should work if you'll do everything right (which can be hard sometimes, yeah ;-).

User avatar
JebDude
Moongazer
Moongazer
Posts: 10
Joined: 2017-08-28, 08:30

Re: Guerilla Scripting

Unread post by JebDude » 2017-09-06, 16:24

ketmar wrote:i'm using it in manual mode, i.e. manually putting files to %PROFILE%/guerillajs/scripts/
it should work (at least it works for me ;-). GUI part was a late addon for people wanting it, and it seems to have a little use (read: i'm not using it, have no reports on it, so it may be broken too). basically, copying .js file should "just work". just make sure that you're copying it in correct directory (correct profile, and so on).

the thing was designed to work like Opera12 "userscript" feature, and in Opera12 there was no UI to manage scripts at all, so i never really wanted to add one too. ;-) that's why GS is for "advanced users" (it means "yay, no help for ya; you didn't expect that using computer will be easy, did you?!" ;-).

i suspect that you just somehow put .js file in the wrong folder. sorry, i don't know where windows version keeps it's profile folders, so i can't help you here. the only thing i can say for sure is that GS is working in v27.4 and v27.5.0a1 at least, so it prolly should work if you'll do everything right (which can be hard sometimes, yeah ;-).
Thanks man! That's all I needed. I enjoy messing around to see what I can do. I'll post my results once I get a chance to mess around with it so people can get an idea of what direction to go with it.

Last question... syntax? Is the help file still good for the syntax (in theory)? I figure I'll do something simple like adding an alert() box just to see it working then I'll mess with it from there.

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

Re: Guerilla Scripting

Unread post by ketmar » 2017-09-30, 22:59

interim fix: gcli interface should work again (at least partially).

p.s.: syntax is mostly compatible with GreaseMonkey/Opera12 userjs.

Zero3K
Moonbather
Moonbather
Posts: 57
Joined: 2018-01-18, 18:50

Re: Guerilla Scripting

Unread post by Zero3K » 2018-03-15, 19:22

1. Is there a way to disable/enable certain userscripts via its menu item? If not, then please consider adding it.
2. Is there a way to add/remove the includes/excludes of a certain userscript via a dialog box? If not, then please consider adding it.

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

Re: Guerilla Scripting

Unread post by ketmar » 2018-03-15, 22:31

sorry, this is not GreaseMonkey, and never planned to be one. i regret adding package UI -- it was a mistake too. GS is meant to be controlled via direct file operations, not via GUI. that is, you already have a perfect GUI to manage your userscirpts: your favorite file manager. and a perfect tool to do anything with scripts: your favorite text editor. GS was designed with this usage in mind. the whole idea of GS is that you don't have to mess with menus and options: just drop a script in userscript directory (or edit it, or delete it), and it immediately works.

Zero3K
Moonbather
Moonbather
Posts: 57
Joined: 2018-01-18, 18:50

Re: Guerilla Scripting

Unread post by Zero3K » 2018-03-15, 23:15

ketmar wrote:sorry, this is not GreaseMonkey, and never planned to be one. i regret adding package UI -- it was a mistake too. GS is meant to be controlled via direct file operations, not via GUI. that is, you already have a perfect GUI to manage your userscirpts: your favorite file manager. and a perfect tool to do anything with scripts: your favorite text editor. GS was designed with this usage in mind. the whole idea of GS is that you don't have to mess with menus and options: just drop a script in userscript directory (or edit it, or delete it), and it immediately works.
How about adding a menu entry to open the default location for userscripts (unless there already is one)?

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

Re: Guerilla Scripting

Unread post by ketmar » 2018-03-15, 23:19

i believe that it is better done with a bookmark in your file manager. there is no way to open location in arbitrary FM. consider FAR Manager for windows, for example: there is just no way to ask existing FAR instance to open something in it's panel (and there can be active multipanel plugin, for example, and other complications).

i believe that such menu item adds a little (if any) value for GS target audience.

Zero3K
Moonbather
Moonbather
Posts: 57
Joined: 2018-01-18, 18:50

Re: Guerilla Scripting

Unread post by Zero3K » 2018-03-16, 04:59

I have a bug to report. E-Hentai Downloader (https://github.com/ccloli/E-Hentai-Down ... er.user.js) doesn't work when I am using it with Guerilla Scripting.

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

Re: Guerilla Scripting

Unread post by ketmar » 2018-03-16, 05:31

please, provide at least some easy way to reproduce it, and GS messages from Error Console. note that GS doesn't support full GM API, so if a script is using some unsupported API, i probably won't fix it: being another "fully compatible GM fork" is not a goal of GS.

Zero3K
Moonbather
Moonbather
Posts: 57
Joined: 2018-01-18, 18:50

Re: Guerilla Scripting

Unread post by Zero3K » 2018-03-16, 05:48

ketmar wrote:please, provide at least some easy way to reproduce it, and GS messages from Error Console. note that GS doesn't support full GM API, so if a script is using some unsupported API, i probably won't fix it: being another "fully compatible GM fork" is not a goal of GS.

Code: Select all

Security wrapper denied access to property scriptHandler on privileged Javascript object. Support for exposing privileged objects to untrusted content via __exposedProps__ is being gradually removed - use WebIDL bindings or Components.utils.cloneInto instead. Note that only the first denied property access from a given global object will be reported. e-hentai-downloader.user.js:72:0
GM_info(): stub! startup.js:101:0
UJS ERROR: TypeError: GM_info.script is undefined : 12062 startup.js:101:0
@file:///C:/Users/Bryan/AppData/Roaming/Moonchild%20Productions/Pale%20Moon/Profiles/x511ar0s.default/guerillajs/scripts/e-hentai-downloader.user.js:12062:1
 startup.js:101:0
GM_info.script is undefined e-hentai-downloader.user.js:12062:0
You can test it by going to https://e-hentai.org/g/1192669/4646adde9c/.

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

Re: Guerilla Scripting

Unread post by ketmar » 2018-03-16, 05:57

tnx. that is the case of unsupported API: `GM_Info` is not supported, and there are no plans to support it. sorry.

author of the given script tried to support various GM forks and compatible implementations. GS is neither of those, so detection code failed. currently, GS will not provide any workarounds for that: if you want to use such complex scripts, either fix 'em yourself, or use one of compatible GM forks out there.

but thank you for your report: maybe i'll implement some more GM support in the future based on it. just don't expect it to be done soon. ;-)

Zero3K
Moonbather
Moonbather
Posts: 57
Joined: 2018-01-18, 18:50

Re: Guerilla Scripting

Unread post by Zero3K » 2018-03-24, 15:25

Here's what the developer of E-Hentai Downloader replied with in an issue regarding the adding of support for Guerilla Scripting:
Sorry I tried, but it seems that Guerilla Scripting has some unreasonable bugs, and they makes the script stop working. Also I can't debug with it, it doesn't throw any error, I can't use breakpoint to check what's going on, even debugger command is also not working. Sorry I give it up, maybe you can try Greasemonkey for Pale Moon.

I'm not sure why a variable assignment can be wrong and that byteLength is exist.
Here's an image that he provided in the response:

https://user-images.githubusercontent.c ... 19ed3c.png

Also, he just replied that enabling all the options is not showing him any error info.

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

Re: Guerilla Scripting

Unread post by ketmar » 2018-03-24, 16:09

then it won't work. sorry, i won't debug his thing for him, and it looks like he is not really interested in making it work with GS too. so just move this to WONTFIX.

Zero3K
Moonbather
Moonbather
Posts: 57
Joined: 2018-01-18, 18:50

Re: Guerilla Scripting

Unread post by Zero3K » 2018-03-24, 17:07

Here's what he replied with a few minutes ago:
Okay, got it now. Sorry for the late reply, as I reverted my virtual machine back to some point and just reinstall the browser just now.

Seems that Guerilla Scripting has some permission bugs, although I removed the related GM_info log that Guerilla Scripting doesn't support, it still denies me to access some critical parameters.

So back to the first, I give up, it's the bug of Guerilla Scripting itself. If it doesn't allow me to access these values, the script won't work.
Along with an image of the errors he was getting:

https://user-images.githubusercontent.c ... 29c54d.png

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

Re: Guerilla Scripting

Unread post by ketmar » 2018-03-24, 17:32

i uploaded 0.0.3.7.2 with a hack that may fix the last issue. or it may not, i don't know. ;-)

Zero3K
Moonbather
Moonbather
Posts: 57
Joined: 2018-01-18, 18:50

Re: Guerilla Scripting

Unread post by Zero3K » 2018-03-24, 18:11

Here's what he just replied with:
I checked the GM_xhr source code of guerillascript, it exposed response property, so it should works fine, but I was denied to get response.byteLength. I Googled that error message, seems that it may happens when accessing cross-origin content, maybe Guerilla Scripting doesn't handle cross-origin content well?

What about the Security wrapper message?

It says I cannot access GM_info.scriptHandler (also GM_info.script and so on), as it's not exposed those properties (from GM_xhr source code, you can see it exposes some properties by setting them on __exposedProps__). I checked the source code about GM_info, only got this:

Object.defineProperty(sandbox, "GM_info", {
get: tieto(null, function () { logError("GM_info(): stub!"); return {}; }),
});

Yes, GM_info is not supported by Guerilla Scripting, and it sets a useless getter (only to show the error) to prevent us to use some fallback ways. I tried passing it by self-creating a GM_info, but it also denied me.

So for the compatibility, I recommend you to use Greasemonkey for Pale Moon. Guerilla Scripting is not fully support GM function, and may have some unknown bugs (if it's GM compatible as it claims, everything should be fine), also its community environment is not as strong as Greasemonkey and other extensions -- not to say it's bad, it should be a thought work to write a extension like this, but for most compatibility, you should try a more stable solution.
EDIT2: Here's another reply from him:
Yeah I noticed the new version when I was writing the previous comment. I just wanna to say the developer is nearly stop updating it (so am I :-( ) but I noticed it on its git repo (it says 15 minutes ago) so I deleted it soon.

However I also have something want to write in the previous comment. I checked the source code of the newer version at that time, and it just exposed the byteLength property. But it doesn't make sense, that's not the main problem. Even though I remove all the code that uses response.byteLength it also throws an error on JSZip when converting that response to another type (maybe Uint8Array I guess).

The main problem is not byteLength cannot be accessed, but the data is cross-origined, and Guerilla Scripting doesn't solve it as expected, it just send the data directly to the user script, and user script cannot read the data due to the same-origin security.
Last edited by Zero3K on 2018-03-24, 18:36, edited 1 time in total.

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

Re: Guerilla Scripting

Unread post by ketmar » 2018-03-24, 18:38

he is absolutely right. "compatible" doesn't mean "support everything GM has", it means "if something from GM is supported, it will likely work as in GM". there are no plans to implement `GM_info`, tho: the error message there is exactly to indicate that.

as for "obsolete method" spam in console -- idc. it works, and i won't change the code just to get rid of some warnings.

that is, thx for all your efforts! but GS was never meant to execute huge complex scripts, it is mostly for small scripts, to fix some annoyances on web pages. (and usually for the scripts you written by yourself, so you can fix 'em easily ;-). if you want a full-featured engine for huge scripts like that one, you'd better stick to GM.

again, thank you for your efforts. but we came to the limits of what GS can (and will) do here. sorry.

Koshmaar

Re: Guerilla Scripting

Unread post by Koshmaar » 2018-06-01, 09:19

Hello, Ketmar, you should add a hello-world script to readme, so people know where to start from :) Also, add in first paragraph info about restart - scripts are reloaded only when you restart PM. Lost 10 mins of life because of this wandering why the hell it doesn't work... :)

Script that worked for me:

Code: Select all

// ==UserScript==
// @include *://online.mbank.pl/*
// ==/UserScript==


(function() {
    'use strict';

    var body = document.getElementsByTagName("body")[0];
    body.classList.remove("lifting");
    body.style.backgroundImage = "url(http://nowedemo.mbank.pl/gfx/bg/bg_content.png)";
	
	console.log("guerilla script mbank.js removed lifting classes");
})();

Locked