Skip to content

Userscripts I use for Hermit (cosmetic filters for Japanese websites)

License

Notifications You must be signed in to change notification settings

hanubeki/bromite-cosmetic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Userscripts for Hermit (Original: Bromite User Scripts)

This is a repository that hosts User Scripts for Bromite, an Android browser. They might also work on other mobile or desktop browsers, but I only use them on Bromite.

I (hanubeki) use this script on Hermit - Lite Apps Browser, however, as of 27.2.0, Userscripts are not working due to regressions; wait them to fix the bug and update the app.

Scripts

Here scripts are sorted by category. See below on how to install them into your browser.

Blockers

Bromite has a built-in ad blocker (also see xarantolus' Bromite ad blocking project), but some sites are very good at bypassing it. We can improve blocking on these sites using scripts.

  • Cosmetic AdBlock: block annoying elements
    • You can also use the lite version with about half the size, it only includes rules for the top 250k domains from this top 1M domains dataset
    • The Bromite AdBlock engine does not support cosmetic filtering, so this script implements that capability (to a very basic extent)
    • This script doesn't know about exception rules, so it will block too many elements on some pages
      • This fork has an attempt to support some exception rules (currently only ~domain, #@# and #@$# are supported)
      • However, it can't be merged into xarantolus' upstream since the script must be generated into single file to exceptions to work.
    • Rules are regenerated once a week from the filter lists defined in this file
    • Do not use the normal script on less powerful devices
      • In xarantolus' performance tests, sites take an average of 300-400ms longer to load ("first contentful paint" metric) when the script is active (tests were done on a Mi Mix 2, a phone released 2017)
      • However, it takes way more than 400ms to manually click "Decline" on an annoying popup, so I think it is a good tradeoff
      • This fork is much slower than upstream as the script has experimental ~domain support

Installing a script

Make sure you have a recent version of Bromite installed. Then you can follow these steps:

  1. At first you need to download the script file. You can do this for the scripts in this repository by holding on the link until the menu appears, then selecting "Download link"
  2. Now you can go to Bromite settings (three dots at the top right, then Settings)
  3. Scroll down to open the "User Scripts" section under the "Advanced" menu
  4. Make sure "Activate User Scripts" is enabled/on
  5. Select the "Add script" button
  6. Now select the file you just downloaded (likely in your downloads directory)
  7. Confirm the installation
  8. (Optionally) Click the "View source" button to verify the content of the script
  9. Enable the newly installed script using the switch at the left side

Usage on Hermit

You will need in-app purchase for userscript feature or premium on Hermit - Lite Apps Browser.

  1. Open Latest release page on GitHub.
  2. Tap on the cosmetic.user.js link in "Assets" section.
  3. Dismiss the download dialog if it is appeared.
  4. Tap on the "Install" button in the installation dialog.
  5. Open lite app quick settings sidebar by tap on the cog icon in the toolbar (unless frameless mode) or swipe from right edge (if you enabled swipe gestures).
  6. Turn on Cosmetic Ad Block for Bromite/Hermit in userscripts.
  7. Close and restart the app and see if it works.

Auto-generated scripts

Some scripts are auto-generated (because they need to be regenerated from time to time to include up to date sources). The source code for the generators is in subdirectories of the generate directory.

You can see statistics (e.g. number of included rules) in the latest release.

Creating your own scripts

You can also create your own scripts, see the official documentation on how to do that. You should read the Chromium User Script Design Document to learn about existing pitfalls.

I recommend trying out remote debugging via a desktop browser if your script doesn't behave as expected.

If you want to remove certain elements on dynamic pages (like Twitter), I recommend this snippet of code, it's very helpful.

Issues & Contributing

If you have any issues with these scripts (e.g. some ads aren't blocked for an ad blocking script), please feel free to open an issue. Also if you want to add something, feel free to do that :)

All scripts unless otherwise noted are published under the MIT License (see the LICENSE file). Some scripts might be licensed differently (e.g. because they are derived from GPL-licensed works), which is indicated by the license header at the top of the file

About

Userscripts I use for Hermit (cosmetic filters for Japanese websites)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 62.3%
  • JavaScript 34.7%
  • Shell 3.0%