
Strategy
So, Adblock ... But here I’ll speak not so much about ad blocking, as about optimization and proper use of this interesting add-on with its versatility. I do not belong to those who are annoyed by the advertisement itself - I am annoyed by the method of its delivery.
More precisely, it
annoys me:
- weighting of the pages and the complication of the process of their loading, as a result - slowing it down;
- traffic growth (in corporate environment);
- spyware scripts, collecting personal information;
- when, with a loaded HTML document, I still do not see the page due to delays in loading some dirty tricks from the left servers;
- the emergence of the plugin-container process, which eats memory in volumes commensurate with the browser itself.
In addition to advertising, these problems create no less various counters and “social widgets” (a new evil, about which the Web 1.0 did not know), because the pages even without ads contain several counter scripts, and for each button like “I like” each social network loads its own script! Therefore, my strategy will be completely different from the strategy of creators of standard subscriptions for Adblock:
1) the main thing is not to eliminate advertising, the goal is to reduce the page load time, memory consumption, traffic, etc. - optimization "
from the machine ", so the focus is on scripts and flash, and just hide the elements with the ## directive - the least interesting thing is,
2) Pareto-efficiency principle: 20% of the rules block 80% of unwanted content,
3) (corollary of claim 1 and 2) universal rules, as far as possible!
4) sites that I don’t go to / irrelevant in this country - let them contain a bunch of unwanted content, I absolutely don’t want my CPU to run through a megabyte of rules that never work (when work once a year).
Study
The adblock (the firefox version has been tested) is a packed xpi (not unpacked during installation), weighing 786 kb. Most of this archive (468 kb in compressed form, 1.3 mb in unpacked) is in localizations, which are (unnecessary) easy to remove from xpi with the same 7-zip. (Looking ahead: a reduction in memory consumption as a result of this procedure was not found, so the add-on unpacking did not affect either).
')
The blocking rules are stored in the FF profile folder, in the adblockplus subfolder or similar in the add-on name (the other add-on settings are stored in the browser’s standard “settings registry”). Looking there, I found 2 huge files - INI and CSS, weighing about 1.8 MB together (this “discovery” was the reason for this research). It is clear that the gift of such volumes (especially CSS!) Will not do, even if our browser was written in pure assembler. To understand how much Adblock is burdensome for the system, measurements of memory consumption were carried out with the latest, at the time of this writing, versions of add-ons of the Adblock family in different configurations: without subscriptions, with a subscription against counters (cnt), and 3 subscriptions - default RuAdlist + Easylist , BitBlock against social network widgets and cnt against counters. I note that RuAdlist + Easylist accounts for about 90% of the file size in the last configuration, so the last column is also valid for the default Adblock Plus.
Memory consumption by Firefox 17.0.1 browser (in megabytes) with different addbons of the Adblock familysubscriptions | 0 | 1 (cnt) | 3 (ruad + easy, bitblock, cnt) |
---|
adblock lite 1.4.3 |
---|
blank | 58 | 58 | 68 |
yandex.ru | 73 | 73 | 139 |
growth | 15 | 15 | 71 |
adblock edge 2.0.2 |
---|
blank | 56 | 57 | 119 |
yandex.ru | 73 | 69 | 129 |
growth | 17 | 12 | ten |
adblock plus 2.2.1 |
---|
blank | 56 | 57 | 116 |
yandex.ru | 70 | 69 | 128 |
growth | 14 | 12 | 12 |
What can be seen from the table (except that the results are, on the whole, puzzling): the initial assumptions about optimization and lightness, in practice are confirmed to the exact opposite: the most basic, mainstream Adblock plus is the most economical, and the lite version, despite its the name consumes the memory the most, and, in addition, it slows down the drawing of heavy pages, such as searching for images in Yandex.
Why is this so? It's all about the versions of Adblock plus, which are the basis of alternative add-ons - they are all older, and new ones are better optimized (an infrequent occurrence in the software world). In versions 1.x, the rules cache was used as a javascript file, this solution was unsuccessful in terms of performance and was abandoned.
Let's look inside xpi. In chrome / locale are localizations for various languages, mentioned above. The most interesting is the defaults folder. By modifying the prefs.js file, you can automate Adblock for setting up all the settings, which is convenient for mass deployment. The standard syntax is as in the settings of the browser itself. The following settings are recommended:
pref("extensions.adblockplus.savestats", false);
pref("extensions.adblockplus.hideContributeButton", true);
pref("extensions.adblockplus.patternsbackups", 2);
pref("extensions.adblockplus.subscriptions_exceptionsurl", ""); // " "
pref("extensions.adblockplus.subscriptions_exceptionscheckbox", false);
// : ,
(For more on these and other options in prefs.js, read here:
adblockplus.org/ru/preferences )
Unfortunately, add-on parameters cannot be predefined in the settings file of the browser itself (for example, as in
my previous article ) - when the add-on is first loaded, it overwrites all predefined settings with default settings. The problem is solved only by putting the modified prefs.js back into XPI.
Own rules of the game
Standard subscriptions are not only heavy, they do not block the google analytics scripts that are heavy and spy-abusing on almost every site, which means that you have to write at least one rule manually. And if you write one thing, then why (knowing the reg. Expression) and not all?
The rules were conveniently grouped by topic: in case of a violation of page usability, it is easier to localize the problem by turning off the rules block by block. The following lists are based on both ready-made subscriptions and own developments in the field of “anti-banner” rules for Squid. The Adblock interface is friendly with the clipboard - it allows you to copy selected rules as text strings or paste copied text as rules.
custom ///rs[0-9₽ ?\.mail\.ru/[bd /
|| radar.imgsmail.ru ^
/images.rambler.ru/(n|upl)//
|| rl0.ru $ domain = ~ rambler.ru
|| hhcdn.ru/nposter/*
|| pics.top.rbc.ru/top_pics/v2/jslib/ch2.js
|| pics.rbc.ru/js/api.js
| http: //pics.rbc.ru/*/afm/img.gif?
|| pics.rbc.ru/banners/*
|| loadup.ru / * $ third-party
|| myuniques.ru ^ $ third-party
|| oskale.ru ^ $ third-party
|| partner.pladform.ru ^ $ third-party
|| ningme.ru/*video2*$third-party
|| klonedaset.org ^ $ third-party
|| vmblock.net ^ $ third-party
|| wigetmedia.com/$script,third-party
@@ || adv.magna.ru/$script
@@ || swa.mail.ru/cgi-bin / * $ script
|| backromy.com ^ $ script, third-party
|| cs.sopital.com ^ $ third-party
|| awaps.yandex.ru ^
|| stream.traflux.info ^ $ third-party
|| corcon.ru/style/*
|| beats.palaven.info ^
|| cdn.vidigital.ru/media/$object-subrequest
|| pay-hit.com ^ $ script, third-party
|| ucoz.net/ads_w*.js
|| ucoz.net/src / * $ script, stylesheet
|| spotsniper.ru /? * $ script, third-party
|| themodules.ru ^ $ third-party
|| bs.yandex.ru/show / * $ script, third-party
|| am10.ru ^ $ script
|| cedexis $ script, third-party
|| mythings.com ^ $ third-party
|| criteo. $ third-party
|| image.subscribe.ru/advert/
counters //count(er)?\[\?\.//$third-party
/ counters?
|| google-analytics.com / *. js $ third-party, script
|| google-analytics.com / __ utm.gif?
|| bs.yandex.ru/informer
|| tns-counter.ru/V
/ top100 ^
/xtcore.js
/xgemius.js
///cnt\[10[**./$third-party
/cnt.$third-party
|| kiks.yandex.
|| mc.yandex.ru ^
|| yandex.ru/cycounter? *
counter.rambler.ru/
|| yabs.yandex.ru/count/
|| an.yandex.ru ^
|| top $ third-party
|| i.bigmir.net/cnt/
|| count.ru/c$third-party
|| hit.gemius.pl
|| c.bigmir.net ^
|| spylog. $ third-party
|| hotlog. $ third-party
|| openstat.net/$third-party
|| web-visor.com/c.js
|| b.scorecardresearch.com/$third-party
|| atdmt.com ^ $ third-party
|| amung.us ^ $ third-party
|| montblanc.rambler.ru ^ $ script
|| top-fwz1.mail.ru ^
### counters
uni-banners /\D(?||\\123\\[\___ [8] 88|88\ [3-_x] 3\[123 [/ i ])\ D/$domain=~money.yandex.ru
/\[.-/中1\[26[0\[-x_0016?\[.-/[/
/\[.-/[468\[-x_\\\6868
/\[.-/[300\[-x_ long250\[.-/[/
/\[.-/[728\[-x_[90\[.-/-/
/240x400*.swf
/200x300*.swf
/(200|468)_1\.swf/
///ad\[sv= ?[0-9-9 ?\\/
//e?rle\.cgi/
/erle.js
|| reklama. $ script, subdocument, object
|| advert $ third-party
|| banner $ third-party
|| adserv $ third-party
/ informer ^ $ third-party
|| pagead $ third-party
/ advert.
/ \\/_banbanner\.js/$script
^ banner $ third-party
/ pagead ^ $ third-party
// ad \ [sv]? //
^ adfox $ script
^ adriver $ script
|| * ads. * / $ third-party
/awaps.html
^ krutilka / $ third-party
##. b-banner
### left_ads
### top-ads
### bn-bot-wrap
/ * popunder $ third-party, script
^ popunder $ image, ~ image, popup
/show_ads.js
/ pop? $ popup
|| * pop * / $ third-party, popup
* teaser * / * $ third-party, script
|| tizer $ third-party
banners || yabs.yandex.ru/resource/
|| adriver.ru/$third-party
|| googleadservices.com ^ $ third-party
|| autocontext.begun.ru/
|| bn.adblender.ru
|| doubleclick.net/$third-party
|| directadvert.ru $ third-party
|| tbn.ru $ third-party
|| adwolf. $ third-party
|| dt00.net/$third-party
|| goodadvert.ru/$third-party
|| marketgid.com/$third-party
|| luxup.ru/$third-party
|| zorkabiz.ru/$third-party
|| novoteka.ru/$third-party
|| arbocontext.ru/$third-party
|| videoclick.ru/$third-party
|| looksmart.com/$third-party
|| rorer.ru/$third-party
|| mixmarket.biz/$third-party
|| adonweb.ru/$third-party
|| 1100ad.com/$third-party
|| b2bvideo.ru/js/video.js.php?
|| molodejj.tv/$third-party
|| richmedia.yimg.com/
|| content.medialand.ru/ * $ third-party
|| medialand.ru / * $ third-party, ~ script
|| magna.ru/fcgi / * $ third-party
|| engine.video-link.ru/$third-party
|| videoclick.ru/$third-party
|| videoclik. $ third-party
|| b.kavanga.ru/exp? *
|| rotaban.ru ^ $ third-party
|| post.rmbn.ru ^
|| intellitxt.com ^ $ script, third-party
|| content.relax.ru ^ $ third-party
|| target.smi2.net/client/target.js
### sape_okn
anti-social //icon?\[_-[(rss|facebook|twitter|gplus|vk)\[-. long/
/icons/facebook$domain=~facebook.com
/ addthis_widget.
|| api-public.addthis.com/url/shares.json
| http: //userapi.com/js/api/
/rss.png
|| facebook.com/widgets/like$third-party
|| facebook.com/plugins / *. php? $ third-party, subdocument
|| * .ak.facebook.com / connect / * $ subdocument
/facebook.gif|$domain=~facebook.com
|| api.facebook.com ^ $ third-party
|| api.qip.ru $ third-party
|| connect.mail.ru ^ $ third-party
|| odnoklassniki.ru ^ $ third-party, ~ stylesheet
|| stg.odnoklassniki.ru/share/$third-party
|| odnoklassniki.ru/dk? st.cmd = extOneClickLike
|| connect.ok.ru/connect.js$third-party
|| connect.facebook.net / * / all.js $ third-party
|| mystatus.skype.com ^
|| vkontakte.ru/widget_$domain=~vk.com
|| vk.com/widget_$third-party
|| vk.com/share.php? * $ script, third-party
|| vk.com/images/upload.gif | $ domain = ~ vk.com
|| vkontakte.ru/share.php? *
|| userapi.com ^ $ third-party, domain = ~ vk.com
|| stg.odnoklassniki.ru/share/odkl_share.js$third-party
plusone.js | $ third-party
|| plus.google.com/$subdocument,domain=~google.com,google.com
|| google. * / cse / brand? form =
|| apis.google.com / _ / + 1 / * $ third-party
|| platform.twitter.com/widgets.js$third-party
|| yandex.st/share/$domain=~yandex.ru
/widget.js$third-party
/share.js$third-party,domain=~mail.ru
|| share.pluso.ru/$third-party
|| platform.twitter.com/widgets / * $ third-party
|| surfingbird.ru/share/share.min.js
|| surfingbird.ru/button? *
##. g_blank_likes
##. googleplus
##. g-plus
##. twitter
##. twitter-follow-button
~ facebook.com ### facebook
##. facebook
##. fb-like
##. vkontakte
##. yashare-auto-init
##. social-links
##. fb-like-box
##. gmt-social-buttons
##. post_share
##. share-button
##. share_block
##. sharebar
##. social-links
### social-media
### b_soc
~ mts.ru ##. social
##. addthis_toolbox
Anti-Adblock / blockblock * $ script
/ anti_ab.
/ adb * _detector.
/*adblock$script,domain=~adblockplus.org
The custom group is rules for certain sites and a sort of dump for new rules created visually through the context menu “Adblock plus: block image ...”: a new rule created in this way is added to the first group of filters at the end of the list.
So, all this, it would seem, a considerable number of rules actually turns into INI and CSS, in total, weighing
only 9.5 kb. Which is about 200 times (!) Less than the option with three subscriptions. With the same result.A lazy implementation of this strategy is also possible: a standard subscription against counters is
added ruadlist.googlecode.com/svn/trunk/cntblock.txt - weighs a modest 12 kb and, well, is updated by the developer, and several rules are written manually: against google analytics, several universal rules against banners and against 1-2 of the most common social network scripts:
example of a very simple rule set || google-analytics.com/$third-party
/ pagead ^ $ third-party
|| googleadservices.com ^ $ third-party
///adv?[0-909 ?\\//third-party
|| * ads. * / $ third-party
//e?rle\./
banner $ third-party
/ informer ^ $ third-party
^ adfox $ script
^ adriver $ script
|| adfox. $ third-party
|| adriver. $ third-party
|| adwolf. $ third-party
|| connect.facebook.net / * / all.js
|| google.com/js/plusone.js$third-party
|| doubleclick.net ^ $ third-party
|| autocontext.begun.ru ^ $ third-party
|| directadvert.ru ^ $ third-party
/ blockBlock * $ script
Online organization can create your own subscription. It's easy: the resulting patterns.ini is taken from the adblockplus folder, in it the contents of each section [Subscription filters] are uploaded to the web server as a separate TXT file with the heading [Adblock Plus 2.0] in the first line. You can automatically connect your subscriptions, for example, by placing patterns.ini in the adblockplus folder on each machine. patterns.ini (for example, the most minimal) can be pushed right into XPI - in the same defaults folder where we (see above) replaced prefs.js.
Help in Russian on syntax rules for Adblock PlusDownload patterns.ini with the above rules