PDA

View Full Version : it would be nice to have a feature in firefox ...



Skaperen
August 16th, 2020, 01:02 AM
it would be nice to have a feature in firefox that allows a local user script (e.g. an API) to carry out navigation (click on stuff, type in stuff, drag things around, scroll and pan), access and save stuff (HTML, style sheet, javascript, DOM), and view (pixels of entire screen) on the current page. this would allow the script to work on a logged in page on sites with non-standard logins which can't be delivered with ordinary HTTPS libraries or require manual navigation to reach.

of course such a feature would have to be done with security in mind to prevent bad actors from navigating by bank account or spending my bitcoin.

halogen2
August 16th, 2020, 03:01 AM
Can't Firefox extensions already do almost all of this?

If you want to write such extension yourself, to use it you'll need either Firefox Developer Edition or this Firefox build (https://wiki.mozilla.org/Add-ons/Extension_Signing#Unbranded_Builds).

Skaperen
August 17th, 2020, 06:52 AM
what language are extensions written in? if Java or C++ or Perl then it won't be happening. what i think all programs on the scale that users want to "script them", they should accept a secured Unix socket connection at any time and do everything over that. requiring the script to be inside the process or start with the process is too limited. it needs to be a well defined inter-process API. then any language that can do networking can be used.

securing it might include starting it with an environment variable or other configuration telling it which ports to accept or keys to use.

pqwoerituytrueiwoq
August 17th, 2020, 04:32 PM
so basically tampermonkey?
https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/

halogen2
August 17th, 2020, 07:45 PM
what language are extensions written in?

Usually Javascript and JSON for the code, HTML/CSS for the UI. See documentation (https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions).

Skaperen
August 17th, 2020, 11:26 PM
so basically tampermonkey?
https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/

i went there (and then on to the tampermonkey.net site) to look for API documentation to see how it can be used. i could not find any. so i cannot judge this.

Skaperen
August 17th, 2020, 11:51 PM
Usually Javascript and JSON for the code, HTML/CSS for the UI. See documentation (https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions).

it seems that my best choice will be to develop an extension.

my project is to improve the UI of the ancestry.com web site for myself and other paying users. one lacking feature is the ability to copy or compare branches between trees.

math492m
August 18th, 2020, 02:21 PM
yup would have been nice

pqwoerituytrueiwoq
September 13th, 2020, 10:39 AM
i went there (and then on to the tampermonkey.net site) to look for API documentation to see how it can be used. i could not find any. so i cannot judge this.
It is just native JavaScript, the script you make will run during page load
TamperMonkey based on GreaseMonkey
https://wiki.greasespot.net/Greasemonkey_Manual:API
https://www.tampermonkey.net/documentation.php

in JS you can click a button like this

inputElement.click();
or if it is not a input/button element you may want to do it like this

element.dispatchEvent(new Event('click'));
here is a example of something you may want to automate (youtube set to dark mode and stop autoplay; great for private windows)
https://pastebin.com/EqNAW55j