[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


AdGuard allows arbitrary javascript in trusted filters. That includes user filters, without having to click 3 layers of "I'm not a retard" buttons. This uses #%# syntax. Here are some examples:
boards.4chan.org#%#if (location.pathname.includes('catalog')) { grecaptcha = true }
boards.4chan.org#%#if (performance.getEntries()[0].responseStatus == 404) { location.hostname = 'desuarchive.org' }

Additionally, because hostname redirection is explicitly out of scope of webRequest and declarativeNetRequest, and the adblockers using it, in general the easiest way to handle this without rewriting all links on all pages is simply:
x.com#%#location.hostname = 'xcancel.com'

You can use custom scriptlets in uBlock Origin to achieve the same effect, which I used to do, but it's tedious because you must load an external userResourseLocation, and on Firefox, this cannot be a local file. The AdGuard way is much simpler and saner and puts everything together at once.
I believe for most people, this kind of thing will completely obviate the need to run a separate userscript manager at all. This is a good thing for security because userscripts use in-band signaling to declare their scope and the most popular managers don't warn you when this changes. With adblockers, scriptlets or raw javascript, the scope is external to the script. But if you do use userscripts please at least disable auto updates on any site you log in to. I hope someone finds this useful.
>>
Buy a fucking ad, nigger.
>>
>>107762254
/thread
>>
>>107762220
Why should any of this be in a content blocker?
That's what userscripts are for.
>>
>>107762654
See >>100146442
Generally JavaScript filters are only for development and anything permanent is converted to a scriptlet. But there are a few one-off exceptions that notably uBlock's AdGuard converter will just ignore although I assume they have equivalent coverage from elsewhere or just don't care.
You can use :style() to apply CSS rather than as a selector which might be more useful to more people than small scripts. It would be a bit of a waste to load in a ton of extra code and introduce race conditions by using three different extensions for adblocking, userscripts, and userstyles, ne?
boards.4chan.org##.danbo-slot,.adl,.adl+hr,.desktop>hr,#delform>hr,.middlead,body>.aboveMidAd
boards.4chan.org,sys.4chan.org##:root:style(color-scheme: dark !important;)
boards.4chan.org###threadWatcher:style(border: 1px solid #111111 !important;)
boards.4chan.org##.deadlink:style(text-decoration: line-through !important; color: #5f89ac !important;)
>>
File: Untitled.jpg (291 KB, 1741x1752)
291 KB
291 KB JPG
Additionally, AdGuard has better integration with the browser Dev Tools so you can use the element picker right from them, and properly catches script/scriptlet errors telling you whatever broke instead of just dumping shit in the console like uBlock Origin does. Much better for power users and filter developers in my opinion.
>>
Also if you install AdGuard Extra it works on Twitch ads, no reddit bot locking your thread wontfix.
>>
I thought this thread would get more traction... I thought /g/ was full of power users...
>>
>>107767411
2026 /g/ is all smartphones, AIslop and ragebait
>>
>>107765105
>arguing with muh reddit
Bad sign.
>>
this is cool



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.