DEV Community

Cover image for I made a Dev.to Chrome extension. Tried UserScript too, but failed.
Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

I made a Dev.to Chrome extension. Tried UserScript too, but failed.

More importantly, are UserScript's dead? It is a good way to go cross-browser, and over the CORS. But, Chrome extensions seem to be more popular these days.

Also, UserScript was my first exposure to JavaScript as well.

The extension can be compile from the repo. (or download from releases)

GitHub logo patarapolw / better-dev.to

Add specific features to Dev.to, such as humanize-duration

And, it is I-cannot-wait to this post.

What did I learn

  • Dev.to is a Preact app, and the extension doesn't reload on every navigation. I have to listen to popstate.
  • I can easily do this to GitHub as well, just like refined-github.
  • I don't know how to properly use MutationObserver nor listen to HTTP events, so I abuse MutationObserver with querySelectorAll on every mutations.
  • Chrome extension seems quite similar in concept to Electron or Cordova. Not sure about TypeScript / ESLint support for global variables.

Top comments (1)

Collapse
 
ben profile image
Ben Halpern

I could see us making "user scripts" a natively-supported feature on the platform. Like, if it's stuff that only affects you, it could be something we could support as part of the site without the need for an extension.

Just a thought, nothing I'd come close to commit to without a lot of careful consideration and debate.