3 ms·
Random aside: this extension had absolutely the worst internals of any I've ever looked at. Love the functionality, but really wish I'd never seen the spaghetti
by dmw_ng 3y ago
Random aside: this extension had absolutely the worst internals of any I've ever looked at. Love the functionality, but really wish I'd never seen the spaghetti behind the illusion (source files below). It feels like approaching it as a text classification problem might produce a clean general solution
https://github.com/OhMyGuus/I-Still-Dont-Care-About-Cookies/blob/master/src/data/rules.js https://github.com/OhMyGuus/I-Still-Dont-Care-About-Cookies/...
https://github.com/OhMyGuus/I-Still-Dont-Care-About-Cookies/blob/master/src/data/js/6_cookieHandler.js https://github.com/OhMyGuus/I-Still-Dont-Care-About-Cookies/...
- paddw 3y agoThere is nothing wrong with these internals. Hard-coded rules are not necessarily "spaghetti code". I sincerely doubt there is any reliable way to come up with a general solution without relying on hard coded rules (at least without using AI).
- dmw_ng 3y agoIt doesn't seem like an overly difficult problem: try to find a text fragment (e.g. DOM mutation observer) requesting consent in some container that has some other element with an onclick handler (maybe optionally trying to figure out if image filenames / labels of that element look sensible). Maybe an approach like this will only work 70% of the time, but that seems likely to be a better strategy than embedding a giant list of every relevant site on the Internet
- arp242 3y agoEven a single false positive would be too many, as it would probably break the entire site.
- geysersam 3y agoIsn't it just a lot of data? Not sure what's bad about the code. I mean, the variable names could be more enlightening, and there are no comments, but I don't think it qualifies as "spaghetti".
- jamesmurdza 3y agoI'm not the dev but I find the code logical since each selector is arbitrary and based on a completely different HTML page. Abstracting it would be a huge hassle—would be interesting to see an attempt though!