Woundorf / foxreplace

Replace text in webpages
https://addons.mozilla.org/firefox/addon/foxreplace/
GNU General Public License v3.0
88 stars 21 forks source link

make foxreplace also available as a greasemonkey script #259

Open ssbarnea opened 5 years ago

ssbarnea commented 5 years ago

I may sound as a weird request but I will try to explain a challenge I faced and why the greasemonkey approach makes sense.

I wrote a relatively extensive set of text replacements for annotating openstack build logs and published it at https://github.com/openstack/coats/blob/master/coats/FoxReplace.json in order to share it with others.

Now the first question it came from openstack community was: can I run it as a greasemonkey script? Yep, users like greasemonkey scripts and even inside the same repository we have one that makes Gerrit interface better integrated with Zuul CI. People trust a script because they can read it, hack it and updated it when they want, without getting more than they asked for ;)

The other obvious benefit is that greasemonkey scripts work in all browsers that matter (Firefox, Chrome and Safari), having multiple extensions to run them. Not everyone uses Firefox, in fact I switched from Chrome to Safari about two years ago and few months ago I switched from Safari to Firefox only because of FoxReplace.

If we would have greasemonkey script that loads the same FoxReplace.json file from an URL we would be in a very sweet spot. My original plan was to to it myself but my knowledge of JavaScript is very poor, like 10-20x slowed than on anything python or CI related.

On the other hand this approach could be a much better way to achieve cross-browser support than trying to implement a cross browser extension, the UI part being usually the biggest time consuming part. Greasemonkey scripts don't need UI....

Woundorf commented 5 years ago

Maybe it can be done, but my knowledge of Greasemonkey scripting is minimal, so it would be better if you find someone who knows better how to program for Greasemonkey.

If someone reading this wants to do it, the main functionality is implemented in core.js and replace.js, and called from content.js. Thus copying and adapting the content of those files in a Greasemonkey script would be a good start I think.

marsjaninzmarsa commented 5 years ago

On the other hand this approach could be a much better way to achieve cross-browser support than trying to implement a cross browser extension, the UI part being usually the biggest time consuming part. Greasemonkey scripts don't need UI....

They still need some place to manage config, but they don't have dedicated place in browser UI, so I'm not so sure about being easiest than... not much more than packing extension as .crx instead of .xpi covering Chrome and Opera.