Sn

Sniper: A Manifest V3 web extension for dynamic user specified actions

Hacker News

Sniper: A Manifest V3 web extension for dynamic user specified actions

This extension makes use of JS computed property names to perform user specified dynamic actions on user specified elements. I started working on an extension primarily for my own very specific use case. I knew of Tampermonkey and it's relatives before, but hadn't used it extensively. I also was following the news of MV3, so wasn't sure of their long term viability. But more than anything having recently got into frontend development I also just wanted to build an extension myself, getting to understand the newer limitation and alternatives was just a bonus point. Literally a couple of days ago I got to know (From HN nonetheless https://news.ycombinator.com/item?id=38526277 ) that userscripts are going to be allowed in MV3 too, so I finally decided to actually check out ViolentMonkey, which is pretty neat, but from the looks of it would have to migrate to `chrome.userScripts.register` which would eventually require `userScripts` permission and with it would need [developer mode enabled]( https://developer.chrome.com/docs/extensions/reference/api/u... ). While browsing through the subsequent discussions I saw there were many other alternatives for dynamic script execution, from creating and the dynamic code to `<script>` tags to using `evaljs`, but I wasn't aware of them while building this (see for ex: https://news.ycombinator.com/item?id=31425256 and https://github.com/Tampermonkey/tampermonkey/issues/644#issu... ) (and tbf it wan't even my goal to get full JS execution in my extension). Long term my goal was to build a small JSON config for the actions needed and parse and apply them to have the desired behavior. I also was planning on exposing some extension only behavior (like tab functionality) via message passing with service workers (The config could be something like ``` { "selectors": ['.container h1', 'h2'], "actions" : [ { "action": "setAttribute", "args": ["style", "color:green"] }... ] } ``` ) But now given that MV3 will support userScripts and since devmode is not a deal breaker for me, I plan to use violent monkey itself. I'm sharing this code for anyone else who might be find it useful. P.S: For installation you have to load unpacked extension in your browser, since I haven't uploaded it to any extension marketplace and for firefox users the extension makes use of [URLPattern]( https://developer.mozilla.org/en-US/docs/Web/API/URLPattern ) for dispatching content scripts config from service worker which unfortunately is not yet supported, so it might not work as expected.

Share card

Actual performance

2points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: started · Missing: supports, reddit linkedin, podcasting
84%84% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: user, new, using · Missing: mac, agents, macos
74%74% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
TrustMRRFits verified-revenue profile · Strong signals: users · Missing: mobile apps, ios, personal
50%50% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: ide, io · Missing: https docs, excited, just released
42%42% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoMay struggle as an AppSumo deal · Strong signals: users · Missing: plus, platform, intuitive
35%35% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
13%13% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Pr
Privaxy – Adblocking past manifest v334%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Privaxy – Adblocking past manifest v3

Hacker News2
Un
Unimodal – Our AI Manifest26%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Unimodal – Our AI Manifest

Hacker News2
A
A free metatag, sitemap and web manifest generator36%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A free metatag, sitemap and web manifest generator

Hacker News1
We
Web RPA Extension39%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Web RPA Extension

Hacker News2
Di
Dialogflow and Actions on Google for Web50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Dialogflow and Actions on Google for Web

Hacker News1
RS
RSS Live Bookmarks for Chrome (manifest v3)33%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

RSS Live Bookmarks for Chrome (manifest v3)

Hacker News1
rq
rqlite v3.4.1 – replicating SQLite via Raft consensus59%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

rqlite v3.4.1 – replicating SQLite via Raft consensus

Hacker News8
Te
Tensorflow and Inception v3 on MNIST52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Tensorflow and Inception v3 on MNIST

Hacker News2
Py
PyPDFForm v3.0.0 Has Released47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

PyPDFForm v3.0.0 Has Released

Hacker News1
Si
SingleFile Lite, new version of SingleFile compatible with Manifest V328%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

SingleFile Lite, new version of SingleFile compatible with Manifest V3

Hacker News4