After installing NoScript, open its option (by opening context menu on the small icon on the status bar/add-on bar, or through Addons Manager)
Go to Advanced tab. In that page, go to ABE tab. Under Rulesets, click on USER. Here is an example ruleset, put it in the textbox on the right:
# User-defined rules. Feel free to experiment here. Site http://res.nimg.jp/js/ads.js* Deny
I'm not sure how URL matching works, whether it uses regexp or not. Some examples on the FAQ does show regexp usage, but my example above seems to also match
You may use uBlock Origin in Chrome and Firefox:
If you are using Firefox, you can also use AdBlock Plus to block all functions in a specific file. (Instructions below are for Windows.)
- In the toolbar, click the AdBlock Plus icon, and select Open blockable items from the menu.
- A window will appear, listing everything that ABP can block. You can scroll through the list to find the particular script file or you can type in the Search box to narrow the list down. Once you've found the file to block, right-click the file and select Block this item ....
- ABP will create a new filter based on that file and will list several options for you:
- The complete path to the file (www.domain.com/scripts/ascriptyoudontlike.js)
- Any file in that subdomain (www.domain.com)
- Any file in that domain (domain.com)
- A custom rule that you can define; by default, this starts off the same as 1.
You may need to refresh the page to ensure that file is blocked.
Chrome has this functionality built in now, its comes under Request Blocking in the dev tools. This answer over on StackOverflow has a great description on how to use it.
If you're using Firefox, the NoScript plugin will allow you to do this.