8 ms·
Userscripts Are Fun and Are Still Very Much Relevant
- the_duke 6y agoTampermonkey, ViolentMonkey and GreaseMonkey are all available in Firefox. Can anyone provide a comparison? Edit for the early commenters: as I stated, all of the above are available on current Firefox. Greasemonkey also has been ported to webextensions. Hence my question. Edit 2: TamperMonkey is closed source source and apparently embeds Google Analytics. Either of those immediately kill it for me, considering the kind of access the addon gets. ViolentMonkey "does not collect user data at the moment", but also allows for it in the privacy policy. I think I'll stick with GreaseMonkey.
- mmm_grayons 6y agoGreaseMonkey is the "legacy" option. ViolentMonkey runs on Chrome. TamperMonkey runs on Firefox.
- bronson 6y agoFrom tfa: “you simply install ViolentMonkey (on Chrome, use TamperMonkey for other browsers)” Greasemonkey is old news.
- aboodman 6y agoHere's a short relevant Reddit thread: https://www.reddit.com/r/firefox/comments/9uemks/greasemonkey_tampermonkey_violentmonkey_which_one/ https://www.reddit.com/r/firefox/comments/9uemks/greasemonke... Though I wrote Greasemonkey originally, I have no idea regarding the answer to this question. What I can say is that Anthony Lieuallen is a super standup guy, which is why I handed it over to him and Johan way back. Based on that alone, I personally continue to use GM whenever I have a need.
- brianzelip 6y agoThanks! GreaseMonkey was so crucial back during my Ingress days!
- arantius 6y agoThanks Aaron! GreaseMonkey is still pure open source, MIT licensed. For a while we had some general telemetry built in, but that was back in the 3.x days, so not for over two years now.
- mlinksva 6y agoOne difference: Tampermonkey is closed source while ViolentMonkey and Greasemonkey are MIT licensed.
- mathnmusic 6y agoUsage stats from Mozilla AMO: ViolentMonkey: 50K TamperMonkey: 418K GreaseMonkey: 478K
- aasasd 6y agoVM appeared quite recently, compared to the other two. Its usage has been growing for some time, but dunno about the last months. My guess is, it's a fresh open-source option for those who don't like the current glacial-rate development of GM—but not sure how it is in terms of features.
- piyush_soni 6y agoI think when Firefox moved to WebExtensions and GreaseMonkey was too late to adapt their code, TamperMonkey had quickly made the switch supporting the full GM API and more. I had seen after a while and GM had become even more limiting in terms of what you could do, so I just made the switch to TamperMonkey. Didn't notice the privacy policy so far, will have to re-evaluate my options now.
- mappu 6y agoEven an MIT licensed extension can be changed on a whim and pushed through update - and browsers make it deliberately inconvenient to run a local extension checkout long-term. I have a chip on my shoulder here, because i was the victim of when the de-facto analogous extension for CSS, Stylish, silently changed ownership and violated my privacy without ever prompting me to accept any new ToS. No userscript or extension has ever seemed sufficiently interesting for me to risk that ever happening again, (PSA: Make sure you do not have Stylish installed.)
- square_usual 6y agoAnd, if you're looking for a Stylish alternative, pick up Stylus: https://addons.mozilla.org/en-US/firefox/addon/styl-us/ https://addons.mozilla.org/en-US/firefox/addon/styl-us/
- Polylactic_acid 6y agoThis is why my extensions are limited to highly trusted and highly essential ones like ublock. I just can't trust extensions to be good now and good forever after. Its way to tempting for an extension developer to sell it on to an ad corp.
- j-james 6y ago> ViolentMonkey "does not collect user data at the moment", but also allows for it in the privacy policy. That reddit thread is outdated. ViolentMonkey's actual privacy policy unambiguously states that they do not collect any user data. https://violentmonkey.github.io/privacy/ https://violentmonkey.github.io/privacy/
- cltsang 6y ago> "does not collect user data at the moment" There are limited record of edit history of ViolendMonkey's privacy policy [0] that I can locate, so don't know if it's true in the past, but I don't see this statement in ViolentMonkey privacy policy now [1]. [0] https://github.com/violentmonkey/violentmonkey.github.io/commits/source/content/pages/privacy/index.md https://github.com/violentmonkey/violentmonkey.github.io/com... [1] https://violentmonkey.github.io/privacy/ https://violentmonkey.github.io/privacy/
- aasasd 6y agoAs you noted, TM is closed-source. However, GM is very sparsely developed after the switch to webextensions—still no script management interface, as far as I can see. TM whips it in terms of features. VM appeared recently in the FF land, and my guess is, it's for those who hope for faster development—however dunno if those hopes are realized, feature-wise.
- roryokane 6y ago> dunno if those hopes are realized, feature-wise Violentmonkey has all the features I need. I don’t know what features Tampermonkey has, but I can’t think of much more I could ask for in Violentmonkey. VM has: • A dashboard page where you can remove, disable, or update user scripts. • A CodeMirror editor with syntax highlighting for editing installed scripts. • A ‘+’ button to create a new script for the current site. • Support for scripts that use the GM_… functions like `GM_setValue` and `GM_registerMenuCommand`. • Site-specific actions in the extension menu: enable or disable scripts for this site, run those scripts’ menu commands, or search Greasy Fork for published scripts that apply to this site.
- rossvor 6y agoI've stuck with Greasemonkey myself too. My reason is a bit more esoteric -- I use a user script which adds a dicebear.io/adorable.io avatars based on usernames on HN (I find it easier to remember commenters by the avatar/username combo rather than just username), and Greasemonkey seems to have been the only one out of the three to successfully bypass HN's CSP rules and show the actual hotlinked images.
- frumiousirc 6y agoCan you please name or link the avatar script? Search fu is failing me.
- rossvor 6y agoSure. https://openuserjs.org/scripts/rossvor/Hacker_News_avatars https://openuserjs.org/scripts/rossvor/Hacker_News_avatars
- maple3142 6y agoI am an author of many userscripts, and I personally tell my script users to switch from GreasyMonkey when they have problem using my script. The reason is GM inject the script a little bit differently since GM 4 was released, which breaks some hooking techniques so script will break. As for myself, I use ViolentMonkey because it is more reliable (compared to GM) and open source.
- megous 6y agoI only use extensions that don't have minimized/obfuscated code in the xpi file. So that leaves only GreaseMonkey. There's zero technical reason to minimize extension JS code, since it's already compressed in xpi (zip) file. It's not a silver bullet (I caught people who managed to put a tracker into non-minimized code too, in the past.), but minimized code is hard to compare for chnages and review during updates, so that's a no no for me.
- roryokane 6y agoI use Violentmonkey because unlike Tampermonkey, it’s open source, and unlike Greasemonkey, it supports old user scripts that use the synchronous `GM_…` functions such as `GM_getValue` and `GM_setValue`. Greasemonkey 4, released in 2017, introduced a new asynchronous API `GM.…` (e.g. `GM.getValue`), and dropped support for the equivalent synchronous `GM_…` functions: https://www.greasespot.net/2017/09/greasemonkey-4-for-script-authors.html https://www.greasespot.net/2017/09/greasemonkey-4-for-script.... There also used to be some functions such as `GM_registerMenuCommand` that Greasemonkey 4 provided no equivalent to. However, it looks like Greasemonkey’s polyfill (https://github.com/greasemonkey/gm4-polyfill https://github.com/greasemonkey/gm4-polyfill) has expanded its support for the old `GM_…` functions since I last checked, so maybe migrating old scripts I use to Greasemonkey 4’s new API won’t be as difficult and limiting as the last time I considered it. I probably won’t bother unless I have a reason to switch away from Violentmonkey, though. The user script I use that still uses the old APIs is Webcomic Reader, if you’re wondering. It preloads previous and next comics to speed up browsing, and restyles sites to show hidden per-comic bonuses like title text. It’s at https://github.com/anka-213/webcomic_reader https://github.com/anka-213/webcomic_reader, and its issue about potential Greasemonkey migration is at https://github.com/anka-213/webcomic_reader/issues/130 https://github.com/anka-213/webcomic_reader/issues/130.
- Sevii 6y agoThe company I work for basically relies on use scripts to make any of our internal tools usable. Its kind of insane and makes on-boarding new employees somewhat difficult when they aren't even looking at the same UI as tenured people.
- rovr138 6y agoYou could create a basic profile for Firefox and load it on their computers. That would solve the issue of different UI’s initially and on-boarding would be easier. I use daily at least 3 Firefox profiles - Plain, Work, Personal I have others specific to clients. Firefox containers are an option now (although my setup predates this). This still allows extensions and everything to be encapsulated.
- lucasverra 6y ago> I have others specific to clients. Firefox containers are an option now (although my setup predates this). This still allows extensions and everything to be encapsulated. Thanks for pointing this out, i was thinking about this but lazy enough to postpone research. Now i know
- stjohnswarts 6y agoLook at the LTS versions of firefox (plug for my favorite browser). However similar is available for Chrome and shouldn't take more than a day to test and deploy for a small-medium office by any competent IT person.
- insin 6y ago> We could create a browser extension, but that means developing one for all major browsers. Personally, I use most of the extensions I've written in userscript form via Greasemonkey for the convenience of being able to drop straight into editing and testing it when I spot something which could be added or needs to be fixed. If your userscript doesn't depend on any APIs provided by the userscript manager you're using, you can package it up as a WebExtension by adding a manifest.json: { "manifest_version": 2, "name": "Your Userscript", "version": "1.0", "content_scripts": [ { "matches": [ "https://example.com/*", ], "js": [ "./your-userscript.user.js" ] } ] } Once you've dropped a manifest.json in, web-ext [1] is handy for running extensions in Firefox and Chrome in a temporary profile/developer mode. It also reloads the extension when you make changes. This is particularly useful if your script grows to the point where it could benefit from an options screen, as you can configure `"options_ui": {"page": "options.html"}` instead of having to hack an options UI into the target site yourself. [1] https://github.com/mozilla/web-ext https://github.com/mozilla/web-ext
- iudqnolq 6y agoI thought web-ext was only for Firefox, and I didn't see anything in the Readme about Chrome?
- dkthehuman 6y agoI’ve been really into using scripts to enhance my browsing experience, so much so that I’ve spent the last 6+ months developing these extensions to curate my experience on the Web: - Intention (https://getintention.com https://getintention.com) - Pauses distractions so I can scroll less and do more - Hide Feed (https://hidefeed.com https://hidefeed.com) - Replaces feeds with my daily focus - Hide Likes (https://hidelikes.com https://hidelikes.com) - Hides vanity metrics for a more authentic experience online They’ve made a significant difference to my browsing experience —- give them a try!
- imjasonmiller 6y agoI’m using one to speed up YouTube videos by 2 by default [1], which saves me quite some time. 1. https://webapps.stackexchange.com/a/136744 https://webapps.stackexchange.com/a/136744
- luckylion 6y agoI like Hide Likes, I've done similar things with Stylus on some sites (e.g. HN where I hide the points of my own comments).
- ltultraweight 6y agoWould you consider releasing these (especially Intention) as FLOSS?
- grimgrin 6y agoHere is the one I advertise the most https://greasyfork.org/en/scripts/811-resize-yt-to-window-size https://greasyfork.org/en/scripts/811-resize-yt-to-window-si... https://github.com/Zren/ResizeYoutubePlayerToWindowSize/ https://github.com/Zren/ResizeYoutubePlayerToWindowSize/ The only thing that would irk would some, I think, is that any stats/details are out of sight, a scroll/pgdn away
- _pmf_ 6y agoIf somebody could tell me how to use user scripts and user CSS on Brave mobile, I'd be a happy person.
- square_usual 6y agoBrave mobile doesn't allow extensions/addons, so your only bet on Android is Firefox. If you're on iOS, IIRC Firefox on iOS doesn't support extensions, so tough luck ;_;
- sexy_seedbox 6y agoIf you're on Android, then switch to Kiwi Browser which allows extensions.
- vezycash 6y agoKiwi browser has full extension support. Firefox for android is scheduled to drop support for all extensions except ONE. And add them back with time. Thus I've not updated mine in weeks. So I don't know the status of the version on play store.
- flixing 6y agoContrary to the suggested browser Kiwi which is discontinued I'd suggest Yandex browser in android which supports extensions.
- b0ner_t0ner 6y agoDiscontinued? It's fully open sourced: https://github.com/kiwibrowser/src#timeline https://github.com/kiwibrowser/src#timeline
- nfour 6y agoI recently wrote a tiny alternative to the mentioned webpack plugin https://github.com/nfour/TinyWebpackUserscriptPlugin https://github.com/nfour/TinyWebpackUserscriptPlugin Using it in this project with some userscripts (see webpack.config.ts): https://github.com/nfour/userscripts https://github.com/nfour/userscripts Tampermonkey seems like the best script manager for developer experience (as far as I could tell from trying the others) when configured as recommended (removing cache checks etc.), though it still requires 2 page refreshes to show changes. If anyone knows of an improved workflow I'm all ears. I'd like to see something closer to webpack hot reloading, though I suspect we either need a new script manager, or a userscript framework that can be configured to hotswap code. Perhaps browser managed content scripts will be viable? https://github.com/violentmonkey/violentmonkey/issues/604 https://github.com/violentmonkey/violentmonkey/issues/604
- aktuel 6y agoMy main use case for user scripts is to automatically authenticate on brain dead corporate sites. webex is one example where you cannot save name/password in the browser per default.
- deleted 6y ago[deleted]
- chrismorgan 6y agoI’ve written extensive user scripts to improve inferior web interfaces of tools that we use for work. My two biggest ones are for a work tracker and a support system. The support system one especially is considered indispensable by the support staff and almost everyone else that ever interacts with it. (Why not just change support system?—you may ask. There were certain features that provided the concrete reason for staying with that one. And in bigger businesses you often don’t have the flexibility to choose different things anyway.) A fair fraction of the user scripting is actually just stylesheets, and indeed I started out with just user stylesheets. It’s amazing what you can do with such stylesheets. You can reduce borders, margin and spacing, reorder sections with flexbox and/or grid layout, hide irrelevant functionality or data fields that you never use but the tool doesn’t let you hide, emphasise details that are important to you, reduce the need for scrolling (more efficient layout is routinely able to make things 30–50% shorter without feeling in any way cramped, because many layouts are simply unnecessarily wasteful of space), make sidebars sticky to save scrolling, increase the size of elements and popups that are inexplicably small with forced scrolling, and loads more. And that’s just the styles part. Add scripting and you can do things like set the document title because the system just sets “AppName” or “Manage Request”; automatically click on “load more” links; restructure content for better consumption; in history streams collapse automated things with a single line summary, or bulky tables of the fields that changed with more compact representation; highlight things differently based on the result of some function on the element (e.g. who wrote it), change how times are presented (e.g. replace an absolute timestamp with absolute and relative, plus showing other timezones that could be relevant in a tooltip); add a button to copy the ID or link for an item; and much more that I haven’t even thought of yet. My user scripts are readily configurable: each feature can be turned on or off independently, since a few of the features some people like and others don’t. I’ve thought and said before that this should be a plausible business: forced to use a web app that’s slowing you down? Hire me and I’ll make it easier and faster for you to use. I guarantee improved happiness and at least some productivity boost, and enormous productivity boosts are possible, like orders of magnitude in some cases, by better information presentation and automating arduous human-driven tasks. There’s always the danger that the app will change underneath you, but this isn’t often a problem. If you’re interested in this idea and have any web apps that you might like help with making a user script to improve, email me at userscripts@chrismorgan.info.
- darekkay 6y agoUserscripts are great. I'm using it mainly for adjusting page styles (similar to Stylish[1]). I'm reading this very HN page in my custom dark mode. But I've also created some behavior-altering or automation scripts, some of them being open-source [2]. Adding a "@downloadURL" attribute makes it possible to sync the scripts easily across all devices (and users). Userscripts was also my main reason for switching to Firefox, because the mobile version supports Addons. [1] https://userstyles.org/ https://userstyles.org/ [2] https://github.com/darekkay/config-files/tree/master/userscripts https://github.com/darekkay/config-files/tree/master/userscr...
- malwarebytess 6y agoGiven the increasingly hostile nature of websites, along with the tendency to remove user control, userscripts are not just still relevant but more relevant than ever. Here's some that I like: https://greasyfork.org/en/scripts/10096-general-url-cleaner https://greasyfork.org/en/scripts/10096-general-url-cleaner https://greasyfork.org/fr/scripts/19210-google-direct-links-for-pages-and-images https://greasyfork.org/fr/scripts/19210-google-direct-links-... https://github.com/ParticleCore/Iridium https://github.com/ParticleCore/Iridium
- Veedrac 6y ago> https://greasyfork.org/en/scripts/10096-general-url-cleaner https://greasyfork.org/en/scripts/10096-general-url-cleaner Redirecting away from smile.amazon.com leaves a bad taste in my mouth.
- malwarebytess 6y agoThat's not what that does. It makes it work for smile links. In any case, the code is there it can be changed.
- rkagerer 6y agoReading how many popular websites embed tracking in URL's leaves a bad taste in my mouth. I've been cleaning them by hand up 'till now.
- Ileca 6y agoWhy use a userscript when you can use a search engine that is not from a spyware company? Like Startpage, Qwant, Duckduckgo or Searx? Alleluia, direct links out of the box. For youtube, why not give Invidious a try (ok, it has its downs)? Sometimes, the best solution to "hostile websites" is to not use them in the first place (or use their proxified versions).
- Vuska 6y agoI tried my best to switch to DDG this year. The results just aren't as good as Google.
- Firehawke 6y agoI have severe photosensitivity; large blocks of white hurt my eyes. I use userscripts with Tampermonkey to change sites like this one and Github to a dark color theme that my eyes will tolerate much better.
- turnipla 6y agoYour OS might be able to “reduce white point” everywhere or you can replicate it via color profile.
- tartoran 6y agoI think I might have the same thing tough if I reduce temperature I can tolerate white allright. It actually removes all the blues and starts to look pinkish. I use the f.lux app with a slight color temperature reduction at all times. Sometimes I accidentally turn it off and what a difference on my eyes!
- dragonshed 6y agoOne of my favorite browser extensions, Simplify [0], started its life as a userscript/userstyle. I've used Greasemonkey scripts to fix stupid (and in one case, broken) things on mandatory intranet sites. They're invaluable. [0] https://github.com/leggett/simplify https://github.com/leggett/simplify
- stefs 6y ago15 years ago i used userscripts for ... kinda cheating at a popular browser game. i didn't do anything _really_ illegal, it just extended the UI. e.g. if you sent an army to rob a village, it stored the type and level of workshops and calculated how many troops you'd have to send plundering the next time. it worked really well. next i changed the backend from local storage to a shared database and shared the script with a few friends from my clan. that kinda broke the game. we were incredibly successful but i also immediately lost interest, quit the game and killed the server.
- patrickk 6y agoIn a similar vein: https://code.tutsplus.com/tutorials/how-to-build-a-python-bot-that-can-play-web-games--active-11117 https://code.tutsplus.com/tutorials/how-to-build-a-python-bo...
- andrepd 6y agoSounds like tribal wars or travian ;)
- shultays 6y agoI did same for ogame! I can't remember exact details but I could queue stuff the game wouldn't let me. some were paid features i think
- howenterprisey 6y agoMediaWiki (the software that runs Wikipedia) has extensive built-in support for user scripts. There's a decent number of them, too, used for everything from automation of batch tasks to adding any feature one could ask for to the interface. I've written a few myself. Actually, the first programs I ever wrote that other people really used were user scripts. I remember live-debugging one with several users in my ear via TeamSpeak once. "Working yet?" "Nope." "Nah." https://en.wikipedia.org/wiki/WP:User_scripts https://en.wikipedia.org/wiki/WP:User_scripts
- davide_v 6y agoYeah, as a developer I still use userscripts and also create them sometimes. Just some days ago I updated my Wikipedia Flag Icons e I recently created a super simple one to sort Linkedin feed chronologically by default. Both are open source and available as extensions too: - https://github.com/DavideViolante/Wikipedia-Flag-Icons https://github.com/DavideViolante/Wikipedia-Flag-Icons - https://github.com/DavideViolante/Linkedin-Feed-Sort-By-Recent https://github.com/DavideViolante/Linkedin-Feed-Sort-By-Rece...
- ptrik 6y agoRecently wrote a userscript to sync video progress with my friend via peerjs. Works like a charm. And it supports any <video>. The edit-reload dev experience is still much better than extensions.
- aib 6y agoAre userscripts still run once after page load? That was a major pain point last time I tried using them, on a dynamic page. I tried hooking some events and run-registered-function-on-tree-change-but-at-most-at-N-msec-intervals, but it got out of hand and ended up looking to take much more time to write than the handler it was going to call, so I filed it under "should be written once and properly" and postponed the whole thing.
- insin 6y agoMutationObserver should do the trick if you can pick elements which consistently change at times you'd want to re-run. Watching for <title> changes tends to be good for single page apps.
- giu 6y agoFunnily enough, one of my first GreaseMonkey scripts that I wrote 9 years ago was one that added the ability to collapse threads here on HackerNews [0]; this functionality was finally added in the past year or so to HN (not based on my implementation). Worked like a charm back in the days :) Another more popular GreaseMonkey script of mine was the Wikipedia TeX Source Extractor [1]; I used it extensively during my studies when writing lecture summaries, papers, or my thesis. Userscripts are definitely fun and can be quite useful. [0] https://github.com/giu/hacker-news-threadify https://github.com/giu/hacker-news-threadify [1] https://github.com/giu/wikipedia-tex-source-extractor https://github.com/giu/wikipedia-tex-source-extractor Update: After not having touched the code of [1] for over 8 years, I just updated the userscript to work with Firefox 75.0 and the GreaseMoneky add-on v4.9.
- tiborsaas 6y agoI made this bookmarklet for Mixcloud to be able to save the current track to my YouTube playlist. javascript:window.open('http://google.com/search?q=' + [].slice.call(document.querySelectorAll('span[class*=TrackInfo]')).reduce((acc,el)=>acc + el.innerText.split(' —')[0] + ' ', '').trim())
- maple3142 6y agoI am surprised by the fact that my userscript (Local YouTube Downloader) is mentioned. Thanks!
- dirtyid 6y agoHighlight new comment on HN https://greasyfork.org/en/scripts/18066-hn-comment-trees https://greasyfork.org/en/scripts/18066-hn-comment-trees For reddit: https://github.com/Farow/userscripts/blob/master/reddit-highlight-new-comments.user.js https://github.com/Farow/userscripts/blob/master/reddit-high... Gmail android creator had a unified one for HN+reddit that syncs across sessions, but it lacks features and haven't been updates in years: https://chrome.google.com/webstore/detail/new-comments/jldpfbgmbdnnjdgohphppjnpadogdime https://chrome.google.com/webstore/detail/new-comments/jldpf... My most used bookmarklets increments playback speed for html5 videos, i have one that +0.5x and one that -0.5x javascript:(function() {var media = document.querySelectorAll('video,audio'); var rate = media[0].playbackRate+0.5; Array.prototype.forEach.call(media, function(player) {if (rate == null) {return;} else if (rate != 0) { player.playbackRate = rate; } else {player.playbackRate = 1;}}); })(); Also skip forward / back 30s javascript:(function() {var media = document.querySelectorAll('video,audio')[0];media.currentTime = media.currentTime+29;})(); Forgot: https://timelens.io/youtube/ https://timelens.io/youtube/ Great great for skipping past ads or blocks of content based on visual timeline. Wish this was in more in native media players.
- anotheryou 6y agoFor HN I prefer this one: https://github.com/andreicristianpetcu/HNMarkAllRead/releases https://github.com/andreicristianpetcu/HNMarkAllRead/release... (chrome one is in the store) It marks comments or posts as "read" (or "seen") for a whole page and than hides them. And you can tell it not to hide posts where you "subscribed" to the comments. I can never go back, so tired of skimming over the same top posts all day again and again. I think it also does tree comments.
- nailer 6y ago> We could create a browser extension, but that means developing one for all major browsers. No it doesn't. A single webextension works across Firefox, Edge and Chrome. Safari is an exception though. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Build_a_cross_browser_extension https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
- okareaman 6y agoI installed TamperMonkey recently and wrote some scripts to improve my Twitter experience. Very handy. Then it popped up a request for donations screen, which is an understandable approach by the TamperMonkey author, but I became uncomfortable that TamperMonkey was watching everything I did on the web and reporting back to the author, so I uninstalled it.
- jccalhoun 6y agoFor me, userscripts have been a great way to learn javascript. I have no programming experience and the ability to find something I want to tweak and be able to implement it on a web site is pretty cool. I created a userscript a few years ago and during the quarantine I've been learning a lot rewriting it to work better.
- thanksforfish 6y agoWhat's the security story for userscripts?
- t0astbread 6y agoOn the user's side: Treat userscripts like stuff you paste in the browser console. In terms of actual tech: GreaseMonkey (and probably also Tamper-/ViolentMonkey) does some sort or isolation between the userscript and the page so that the page can't hijack the userscript. More on that here: https://wiki.greasespot.net/UnsafeWindow https://wiki.greasespot.net/UnsafeWindow
- anotheryou 6y agoMost are short at least, if you know js you can actually skim for blobs, URLs or obfuscation (blobs or URLs can be legitimate, just without them I feel quite safe right away). Feels way safer than installing an add-on from the store, but of course just for me as a programmer.
- fakedrake 6y agoHow about pushing for browsers to allow for the same functionality browser wide? And, yes, I am still bitter about firefox killing vimperator.
- gklitt 6y agoStrongly agree with the original article, and it's fun to see all the niche use cases that people are mentioning here. But I have a major frustration with user scripts: writing them requires experience with Javascript and reverse engineering websites. This is fine for the HN crowd, but locks out most web users, who can't program at all. I bet that if it were slightly easier to develop user scripts, there'd be 10x as many of them. I'm sure I'm not the only one who's helped a coworker write a bookmarklet / user script essential for their workplace sanity. Would be curious what people's experiences have been helping nontechnical people extend websites, or if you know of tools in this area. My current attempt at this is a project called Wildcard, which requires a programmer to write some site-specific scraping code, but then shows the scraped data to the end user in a spreadsheet and lets them decide what to do with it: https://www.geoffreylitt.com/wildcard/salon2020/ https://www.geoffreylitt.com/wildcard/salon2020/
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- matheusmoreira 6y agoWould be nice if every website had a scraper. People maintain huge content blocking databases so why not scraping code? It should be possible to treat every website like an API.
- dunham 6y agoMany years ago there was a browser plugin out of MIT called "piggy bank". It included a browser for exploring RDF data (longwell), and the ability to define scrapers of RDF data on a per-site basis. (I think it was javascript and tagged with the hostname of the site, but it's been a while.) It stored stuff locally, but could also upload to a server hosted longwell instance. Every now and then I wish I still had something like that, but the team has long since moved on and it's bit-rotted a bit. More recently, I've found that a lot of recipe web sites have been embedding the recipe as json-ld data (I presume to appease Google), so I've written a grease-monkey script to collect those as I browse and post to a personal couchdb instance. I haven't gotten around to putting a UI on that or further processing the data yet (e.g. I need some agents to fetch images or pull them from browser cache), too many irons in the fire, but maybe someday.
- netcraft 6y agoSo the last time I tried to make an extension (I believe in chrome) for an application I work on, I could not access data stored in the global object - I was trying to make data available to the extension to do more with and show like debug information. Can you access js variables with userscripts like you could in the developer console?
- bombledmonk 6y agoI've spent 9 years maintaining a userscript for a website that now has a new beta in React. Boy, is that a pain in the behind comparatively. I'm pretty sure what I'm doing on the old version of the site won't be possible, but that is yet to be determined.
- jjordan 6y agoYou may want to check out Social Fixer (socialfixer.com). It's a userscript that manipulates and adds features to Facebook, which is written in React. You may get some ideas from them.
- gabrielsroka 6y ago[I posted this as a "Show HN" a few days ago [0]] I wrote a short JavaScript snippet to export HN Favorites to a CSV file. It scrapes the HTML and navigates from page to page. Setup and usage instructions are in the file. Check out https://gabrielsroka.github.io/getHNFavorites.js https://gabrielsroka.github.io/getHNFavorites.js or to view the source code, see https://github.com/gabrielsroka/gabrielsroka.github.io/blob/master/getHNFavorites.js https://github.com/gabrielsroka/gabrielsroka.github.io/blob/... [0] https://news.ycombinator.com/item?id=22788236 https://news.ycombinator.com/item?id=22788236
- concordDance 6y agoAs someone who has made a number of userscripts to improve his experience with various websites (mostly for work), I'm glad they're getting some attention :) So often simple UI changes like resizing a textbox or adding the ability to collapse comment threads can make a big difference to your experience.
- ori_b 6y ago> Nowadays the internet is pretty decent for all ... what? The web is rapidly becoming more and more unusable. Often, sites only work well when I fully disable JavaScript, and the associated autoplay ads, trackers, custom half broken and CPU intensive navigation behavior overrides, and similar sources of misbehavior. The modern web is more user hostile than ever before.
- stjohnswarts 6y agoI agree that the web is a bunch of potholes with autoplay sound and video, pop ups, in your face ads, etc. I find an adblocker, turning off autoplay in firefox, and pi-hole fix 99% of that. So I don't think you can say "often" that you have to fix things, unless you refuse to use similar methods that I've used. Literally the only site I will jump through hoops for and turn things off for (whitelist) is my bank, and they don't have anything other than a couple of annoying popups.
- ori_b 6y ago> I find an adblocker, turning off autoplay in firefox, and pi-hole fix 99% of that. I find that turning off JavaScript works even better. Ad blockers don't generally disable JavaScript that tries to change how, for example, scrolling works.
- DonCopal 6y agoThis is how Hacker News looks like with my script: https://i.imgur.com/We97pJC.png https://i.imgur.com/We97pJC.png Numbers on the left (11, 12, 13) are shortcuts to open a thread (for example, pressing 14 opens the "Userscripts are fun..." thread). Numbers after that (e.g. 65,20) are karma and number of comments, respectively. Much more compact than the default layout and shows better which topics are hot.
- afefers 6y agoIs it available somewhere? I really liked it!
- t0astbread 6y agoI block cookies (and some other stuff) on YouTube, which also causes all of my settings to fall back to the most annoying defaults possible. So I use a combination of userscripts and userstyles to batter the YouTube client until it does what I want (i.e. a dark theme by default, auto-pausing of channel trailers, a sane default volume and a few other things). It's pretty amazing how powerful userscripts and -styles are!
- rgrau 6y agoSince 2012 I'm using a userscript I wrote to inject a button to each github code comment to open my editor at the file-and-line. It feels strange this is not something more people want, but I haven't seen any other project that addresses the same, so I'm still kinda maintaining it: https://github.com/kidd/org-protocol-github-lines/ https://github.com/kidd/org-protocol-github-lines/
- matlin 6y agoI wish there were a userscript equivalent for API's. e.g. someone could make and share a script to get flight details from the Gmail API. The advantage would be that I could run the script rather than give an oauth token to a third party to run it on my behalf.
- darkarmani 6y agoI can't believe that cut-n-paste can be modified by websites and it isn't easy to regain control. For some sites, when you copy a text selection it adds the url as well. I really wish you could tell your browser to disallow this kind of modification. I only want to copy what i see with my eyes. (WYSISYG)