Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a one-liner shell script I'd like to apply from time to time to various web pages with the least amount of effort. It uses xmlstarlet but I could easily convert it to XSLT instead.
How would it be possible to turn that into a plug-in or extension for Firefox or Chromium? Must javascript always be involved or can I use plain shell scripting instead? There is a lot of material out there but what I have found so far is many years out of date.
I tried to do something similar last year, but I don't think it's possible to escape the JavaScript sandbox via Extension, and it wasn't worth the effort to pursue figuring out if/how Plugins could do it - but if you do figure it out I'd be interested to know.
For browser extensions, Javascript is the only option. Actually there's also WASM, but compiling a shell script to WASM? It's maybe possible - but very complicated, and you will still need Javascript for the actual extensions. Also, WASM cannot access files, links or anything - it's sandboxed for a reason.
Every browser (and Javascript) has a good XML parser with xpath support. So it shouldn't be very hard to port it.
For example borderify. Then do some xpath magic - either with the DOM or an external xml source. It can be done with very few lines of code. And if you get stuck, post the code in the programming forum.
Thanks. The link about XPath in javascript will be very useful once I brush up on the language.
However, the borderify script injects javascript into the page. For various reasons outside my influence, I cannot turn on javascript for the specific site to be processed. Maybe there is another example which adjusts the HTML itself without injecting javascript?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.