title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
x
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
|
Tuesday, December 03, 2024 | |
Okay, let's write a Chrome extension. I've done this before, but couldn't really remember how, and since "manifest version 3" for Chrome extensions is some sort of big deal that changes all the rules, I might as well start over. Google does have a "Hello World" tutorial here, but it's important to note that it's what at least this answer at SO calls a popup extension. (It also has some broken links to, eg, its sample extension icon, but you can get it all from the GitHub repo they link to.) Getting the devtools window up for a popup extension, like the one you create in this "hello, world!" tutorial, is kind of a pain. You seem to have to first invoke your extension to show the popup, then right-click the popup, and finally select Inspect, which isn't super-easy to do. In fact, getting the correct dev tools window open is continually a source of pain for me. Popup needs inspect, an "action-only" background process extension needs it opened from the Let's take a closer look. Create an action-only extensionIf you want to simply perform an action (aka, "run a script") when the extension's taskbar button is clicked, you follow this example from Google's docs. Though it's "action only", the info for what to execute ยญdoesn't live in the An action-only extension reduces to this: manifest.json
Then simply add an event listener for the extension's "button" to your
To be clear, that's all you need to have for an extension, those two files, In this case, without a popup, you open devtools by clicking the link within Inspect views
service worker on the Extensions page (that is, what's displayed from the That said, once you have it up, though there is a "refresh" button for extensions, you can make edits to the javascript file and have it refresh during your next action run (afaict), so you're up and running for a while once the tools are open. Manipulating the tabOkay, chances are pretty good that you want to interact with the content of the page. I don't, but let me point you in the right direction. You're going to want to get used to your new friend, That might be most easily done by reviewing Google's Page Redder extension sample over here on GitHub. In brief, the code is this: service-worker.js
manifest.json
Now, if you want to access in-scope dev tools, you need to open them as you normally would from that tab with F12. Allowing the user to select optionsThe next thing I wanted was to add user-defined options. Interesting that it requires (Not that I'd do anything super-nefarious, but maybe I'd store the last time I showed an advertisement page or might store than that've paid a subscription with some sort of key or something. My point is that the possibilities are many, and before I thought I wouldn't allow myself to consider them.) Anyhow... I'm not showing a full page UI (though that's an option too), so I'd include a new UI file (
Asking for moneyI haven't really given this a good look yet, but I did learn that, unlike Safari on Mac, Google no longer lets you charge for the installation of an extension from their store. There's what appears to be an amazingly well-written howto for building a Stripe-integrated license checker for free at Cloudflare at this blog post, "How to create a paid Chrome browser extension" from earlier this year. Labels: chrome, chrome extension, extension posted by Jalindrine at 12/03/2024 10:06:00 AM |
|
| |
All posts can be accessed here: Just the last year o' posts: |
||||||||||||||||||||||
|