Posted By

rugby on 08/04/13


Tagged

blocking ads proxy adblock


Versions (?)

No-ads.pac


 / Published in: JavaScript
 

Ad Blocking Proxy Auto Configuration script by John LoVerso.

Version 5.107 - 2013/06/24

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // John's No-ADS proxy auto configuration script
  4. // http://www.schooner.com/~loverso/no-ads/
  5. // Questions/help web forum at http://www.network54.com/Hide/Forum/223428
  6. //
  7. // Copyright 1996-2004, John LoVerso. All Rights Reserved.
  8. //
  9. // Permission is given to use and distribute this file, as long as this
  10. // copyright message and author notice are not removed.
  11. //
  12. // No responsibility is taken for any errors on inaccuracies inherent
  13. // either to the comments or the code of this program, but if reported
  14. // to me, then an attempt will be made to fix them.
  15. //
  16. // ("no monies exchanged" in Copyright clause removed 11/2001)
  17. //
  18. var noadsver = "$Id: no-ads.pac,v 5.107 2013/06/04 19:19:08 loverso Exp loverso $";
  19.  
  20. // ****
  21. // **** If you do not use a proxy to access the Internet, then the following
  22. // **** line is already fine.
  23. // ****
  24. // **** If you use an a proxy to access the Internet, as required by your
  25. // **** ISP or firewall, then change the line below, replacing
  26. // **** "DIRECT" with "PROXY hostname:port", using the correct hostname:port
  27. // **** for your proxy server.
  28. // ****
  29. var normal = "DIRECT";
  30.  
  31. // ***
  32. // *** If you are not using a blackhold proxy, then you can leave this
  33. // *** setting as is.
  34. // ***
  35. // *** Otherwise, update the next line with the correct hostname:port
  36. // *** of your blackhole proxy server. If you are using Larry Wang's
  37. // *** BHP for Windows, you need to change the "0.0.0.0" to "127.0.0.1"
  38. // ***
  39. //var blackhole = "PROXY 0.0.0.0:3421";
  40. var blackhole = "PROXY 255.255.255.0:3421";
  41. // Safari/MacOS needs the old value
  42. if (typeof(navigator) != "undefined"
  43. && navigator.appVersion.indexOf("Mac") != -1) {
  44. blackhole = "PROXY 0.0.0.0:3421";
  45. }
  46.  
  47.  
  48. // ***
  49. // *** If you need a different proxy to access local/internal hosts vs.
  50. // *** the rest of the Internet, set 'localproxy' to that value. Otherwise,
  51. // *** 'localproxy' defaults to the same value as 'normal', so you do
  52. // *** not need to change anything in the normal case.
  53. // ***
  54. // *** Some typical cases:
  55. // *** - 'normal' might be one proxy, and 'localproxy' might be another
  56. // *** - 'normal' might be a proxy, and 'localproxy' might be "DIRECT"
  57. // ***
  58. // *** You will also need to change the LOCAL section below by adding
  59. // *** rules to match your local/internal hosts.
  60. // ***
  61. var localproxy = normal;
  62.  
  63. // ***
  64. // *** 'bypass' is the preferred proxy setting for when no-ads is inactive.
  65. // *** Either use '= normal' or '= localproxy' (or perhaps just "DIRECT").
  66. // *** This only matters when you need to use a localproxy.
  67. // *** (You probably don't need to care about this)
  68. // ***
  69. var bypass = normal;
  70.  
  71. ///////////////////////////////////////////////////////////////////////////////
  72. //
  73. // This simple kludge uses a mechanism built into most browsers (IE, Netscape,
  74. // Mozilla, Firefox, and Opera) on most platforms to block connections to
  75. // banner ad servers.
  76. //
  77. // This mechanism uses the "proxy auto configuration" to blackhole requests
  78. // to load ad images without forcing all your traffic through an ad-blocking
  79. // proxy server. Of course, unlike ad-blocking proxy servers, this does not
  80. // otherwise not strip cookies.
  81. //
  82. // "Proxy auto configuration" invokes the JavaScript FindProxyForURL function
  83. // below each time your browser requests a URL. This works even if you have
  84. // JavaScript otherwise disabled in your browser! (Which you should!)
  85. //
  86.  
  87. //
  88. // Send me your additions or comments. I'll credit you in the file.
  89. // (But I've removed all email addresses to stop spam harvesters).
  90. //
  91.  
  92.  
  93. ///////////////////////////////////////////////////////////////////////////////
  94. //
  95. // These are the basic steps needed to use "no-ads.pac".
  96. // Detailed instructions follow below!
  97. //
  98. // 1. Save this as a file (no-ads.pac) on your local disk
  99. // (or, add it to your home page, if you have one)
  100. // 2. Select a no-ads "blackhole".
  101. // 3. Configure your browser to use this file as it's auto proxy configuration.
  102. // 4. Clear your browser's cache
  103. // (or else it may still show you ads it has saved on your disk).
  104. //
  105.  
  106.  
  107. ///////////////////////////////////////////////////////////////////////////////
  108. //
  109. // 1. SAVE THIS FILE
  110. //
  111. // Copy this file to your local machine; use your home directory (UNIX)
  112. // or your Desktop or C:\ directory (Windows).
  113. //
  114.  
  115.  
  116.  
  117. ///////////////////////////////////////////////////////////////////////////////
  118. //
  119. // 2. SELECT A NO-ADS BLACKHOLE
  120. //
  121. // You can skip this section if you are using any version of Internet Explorer.
  122. // You can also skip this section for Netscape 7.1, Mozilla 1.4, or
  123. // Firefox 1.0 (or later), as they include PAC failover support (but do
  124. // read the note in section "2a" below).
  125. //
  126. //
  127. // The basic trick of no-ads is to match the site or URL of annoying web content
  128. // and tell your browser to use a proxy that will deny loading of that resource
  129. // (image, page, etc).
  130. //
  131. // A "black-hole" proxy server is one that always denies loading a web page.
  132. // ("send it off to a blackhole").
  133. //
  134. // When you initially get "no-ads.pac", it is using this as the blackhole:
  135. //
  136. // "PROXY 0.0.0.0:3421"
  137. //
  138. // This says to use the local host at a port which nothing should be listening
  139. // on. Thus, this is "a server that doesn't repond."
  140. //
  141. // This is a good default for all systems, and especially Windows.
  142. // However, if you are using the Blackhole Proxy Server on Windows,
  143. // be sure to change it to "PROXY 127.0.0.1:3421"
  144. //
  145. //
  146. // Some possibilities for the blackhole:
  147. //
  148. // a. A server that doesn't respond.
  149. //
  150. // *** This works for all versions of Internet Explorer.
  151. // *** This mostly works for Mozilla, Firefox, and Netscape.
  152. //
  153. // If you do nothing, then this is configured to direct annoying
  154. // content to the proxy running on your own host at port 3421.
  155. // Since you shouldn't have anything running on that port, that
  156. // connection will timeout and the annoying content will never be
  157. // loaded.
  158. //
  159. // Older versions of Netscape wait to connect to the proxy server
  160. // (usually it needs to load part of the image to layout the web
  161. // page), and then asks if you want to disable the proxy that
  162. // doesn't answer.
  163. //
  164. // Older versions of Mozilla will give an alert saying it couldn't
  165. // connect to the proxy server.
  166. //
  167. // Mozilla 1.4+, Firefox 1.0+ and Netscape 7.1 will only give
  168. // you this alert if the whole page being display is blocked,
  169. // rather than just an image on that page. Thus, I still
  170. // recommend a blackhole proxy even though it isn't needed.
  171. //
  172. // Opera will disable your auto proxy config if the proxy server
  173. // doesn't respond.
  174. //
  175. // IE doesn't care that the proxy server isn't responding. As
  176. // this avoids a connection for annoying content, it is fastest.
  177. //
  178. // b. A simple, blackhole server
  179. //
  180. // When needed, I run a simple "server" at port 3421 that denies
  181. // all requests. Some options you can use for this:
  182. //
  183. // - On Windows, you can try Larry Wang's black-hole proxy program:
  184. //
  185. // http://leisuresuit10.tripod.com/BlackHoleProxy/
  186. //
  187. // I can not vouch that his binaries are virus free, but he does
  188. // offer the source code.
  189. //
  190. // - I use this shell script on UNIX; it is invoked via inetd.
  191. // /usr/local/lib/noproxy:
  192. //
  193. // #!/bin/sh
  194. // read a
  195. // read b
  196. // echo HTTP/1.0 501 No Ads Accepted
  197. // echo ""
  198. // exit
  199. //
  200. // Add this line to inetd.conf ('kill -HUP' inetd afterwards):
  201. //
  202. // 3421 stream tcp nowait nobody /usr/local/lib/noproxy noproxy
  203. //
  204. // This simple script doesn't work on Linux because of the
  205. // (IMHO) broken way it's TCP stack works. See the bottom of
  206. // http://www.schooner.com/~loverso/no-ads/ for a complete copy
  207. // of the `noproxy' shell script.
  208. //
  209. // If always exec'ing a shell was expensive on your computer
  210. // (it isn't on mine), then you could use a "wait"-style Perl
  211. // script that would accept() incoming connections.
  212. //
  213. // - Sean Burke has a black-hole proxy written in Perl script:
  214. //
  215. // http://www.speech.cs.cmu.edu/~sburke/pub/black_hole_http_server.pl
  216. // (This is a standalone server, not run from inetd).
  217. //
  218. // e. A trick: use an HTTP/1.0 non-proxy server
  219. //
  220. // An HTTP/1.0 non-proxy server will return a 501 error when
  221. // given a proxy request. Thus, just use the address of your
  222. // local intranet web server as your blackhole PROXY.
  223. // The downside of this is that it will probably also log an
  224. // error, which wastes a small amount of resources.
  225. //
  226. // ***
  227. // *** Be sure to update the "blackhole" variable above with a setting of
  228. // *** "PROXY hostname:port" that matches your blackhole server!!
  229. // ***
  230. //
  231. // ***
  232. // *** If you already use a proxy server to access the WWW,
  233. // *** change the "normal" variable above from "DIRECT" to
  234. // *** be "PROXY proxy:port" to match your proxy server.
  235. // ***
  236.  
  237.  
  238. ///////////////////////////////////////////////////////////////////////////////
  239. //
  240. // 3. TO CONFIGURE YOUR BROWSER
  241. //
  242. // The Proxy Auto Configuration file can be either on the local disk or
  243. // accessed from a web server, with the following constraints:
  244. //
  245. // a. IE4 can only load the PAC from a web server (http:// URL)
  246. // b. Netscape, Mozilla, Firefox and IE (5 or later) can load the
  247. // PAC from anywhere.
  248. // c. Netscape, Mozilla, Firefox and (probably) Opera require the correct
  249. // MIME type when loading the PAC from a web server.
  250. //
  251. //
  252. // To set the Proxy Auto Configuration with Netscape, Mozilla, or Firefox:
  253. //
  254. // 1. Enable Proxy Auto Config:
  255. //
  256. // For Netsacpe/Mozilla:
  257. //
  258. // Open "Edit->Preferences"
  259. // Select "Advanced"
  260. // Select "Proxies"
  261. //
  262. // For Firefox (1.0):
  263. //
  264. // Open "Tools->Options"
  265. // Select "Coonection Settings" on the General tab:
  266. //
  267. // Select the "Auto proxy configuration URL" option.
  268. // Enter URL or path of where you've saved this file, such as:
  269. //
  270. // http://yourserver/no-ads.pac
  271. //
  272. // If you place this on your local disk, you should use a
  273. // file: URL such as:
  274. //
  275. // file:/home/loverso/no-ads.pac (UNIX)
  276. // file:///c:/windows/desktop/no-ads.pac (Windows)
  277. //
  278. // (file:/ and file:// will work in Mozilla, but file:/// is correct
  279. // required for Firefox)
  280. //
  281. // 2. If you are serving this from a web server, these browsers require
  282. // the correct MIME type on the file before using it. You must configure
  283. // your web server to provide a "application/x-ns-proxy-autoconfig"
  284. // MIME type.
  285. //
  286. // a. For Apache, name the file with a ".pac" extension and add this
  287. // line to the http.conf (or the .htaccess file in the same directory):
  288. //
  289. // AddType application/x-ns-proxy-autoconfig .pac
  290. //
  291. // b. For IIS (instructions from Kevin Roth)
  292. //
  293. // Open Internet Services Manager
  294. // Right click on the web site (or directory) you wish to change.
  295. // Choose Properties
  296. // Click the "HTTP Headers" tab
  297. // Click the "File Types" button in the "MIME Map" section
  298. // Click the "New Type..." button
  299. // Enter "pac" for "Associated Extension"
  300. // Enter "application/x-ns-proxy-autoconfig" for "Content Type (MIME)"
  301. // Click OK to close the Add type dialog, the MIME types dialog,
  302. // and the main properties dialog.
  303. //
  304. // (This is definately needed for NS, but not for IE)
  305. //
  306. //
  307. // To set the Proxy Auto Configuration with IE:
  308. //
  309. // 1. Enable Proxy Auto Config:
  310. //
  311. // Open "Tools->Internet Options"
  312. // Select "Connections" tab
  313. // Click "LAN Settings"
  314. // or Choose an entry from "Dial-up settings" and click "Settings"
  315. //
  316. // On the settings dialog, select "Use automatic configuration script"
  317. // Enter the URL of this file in Address field.
  318. //
  319. // http://yourserver/no-ads.pac
  320. // file:///c:/windows/desktop/no-ads.pac (Windows)
  321. //
  322. // You can only use a file: URL with IE5 (or later).
  323. // ("file:///" with with IE versions after 5.0 SP2)
  324. //
  325. // 2. Fix Security Settings (IMPORTANT):
  326. //
  327. // Select "Security" tab
  328. // Select "Local intranet"
  329. // Click "Sites" box
  330. // Unselect "include all sites that bypass the proxy server" option
  331. //
  332. // 3. Disable "Auto Proxy Caching" (IMPORTANT):
  333. // (thanks to Kevin Roth for alerting me of this!)
  334. //
  335. // IE contains a proxy result caching mechanism that will defeat the
  336. // ability to block servers that server both ad and non-ad content.
  337. // To prevent this, add the registry key described in this MS KB article:
  338. //
  339. // http://support.microsoft.com/?kbid=271361
  340. //
  341. // You can do so by downloading this file and clicking on it to load
  342. // it into the registry. This must be done on a per-user basis.
  343. // http://www.schooner.com/~loverso/no-ads/IE-no-auto-proxy-cache.reg
  344. //
  345. // IE doesn't currently check the MIME type of the PAC file.
  346. //
  347. // To see some notes from MS on PAC in IE, see
  348. // http://msdn.microsoft.com/library/periodic/period99/faq0599.htm
  349. // (they seem to have removed this URL)
  350. //
  351. //
  352. // To set the Proxy Auto Configuration with Opera 6 (6.04 on Windows tested):
  353. //
  354. // 1. Enable Proxy Auto Config:
  355. // Open the Preferences (Alt-P)
  356. // Select "Network"
  357. // Click the "Proxy servers" box
  358. // Select "Use automatic proxy configuration"
  359. // Enter the URL of this file as
  360. //
  361. // http://yourserver/no-ads.pac
  362. // file://c:/windows/desktop/no-ads.pac
  363. //
  364. // (file:/// might be needed; I've not tested Opera lately)
  365. //
  366. // 2. You must use a blackhole proxy for Opera (it will not work with an
  367. // address of a server that does not respond).
  368. //
  369. // 3. Be sure to clear the cache and exit/restart Opera.
  370. //
  371.  
  372.  
  373. ///////////////////////////////////////////////////////////////////////////////
  374. //
  375. // 4. CLEAR YOUR BROWSER'S CACHE
  376. //
  377. // For Internet Explorer:
  378. //
  379. // Open "Tools->Internet Options"
  380. // Select "Delete Files" under "Temporary Internet Files"
  381. // Click "OK"
  382. //
  383. // For Mozilla/Netscape Navigator:
  384. //
  385. // Open "Edit->Preferences"
  386. // Select "Advanced"
  387. // Select "Proxies"
  388. // Click "Clear Disk Cache"
  389. // Click "Clear Memory Cache"
  390. //
  391. // For Firefox:
  392. //
  393. // Open "Tools->Options"
  394. // Select the "Privay" tab
  395. // Scroll down or go to the "Cache" section
  396. // Click "Clear"
  397. //
  398. // For Opera:
  399. //
  400. // Open "File->Preferences"
  401. // Select "History and cache"
  402. // Click "Empty now"
  403. //
  404.  
  405.  
  406. ///////////////////////////////////////////////////////////////////////////////
  407. //
  408. // To see the definition of this page's JavaScript contents, see
  409. //
  410. // http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
  411. //
  412. // Microsoft includes this in their KB article:
  413. //
  414. // http://support.microsoft.com/support/kb/articles/Q209/2/66.ASP
  415. //
  416. // Special PAC functions:
  417. // Hostname:
  418. // isPlainHostName(host)
  419. // dnsDomainIs(host, domain)
  420. // localHostOrDomainIs(host, hostdom)
  421. // isResolvable(host)
  422. // isInNet(host, pattern, mask)
  423. // Utility:
  424. // dnsResolve(host)
  425. // myIpAddress()
  426. // dnsDomainLevels(host)
  427. // URL:
  428. // shExpMatch(str, shexp)
  429. // Time:
  430. // weekdayRange(wd1, wd2, gmt)
  431. // dateRange(...)
  432. // timeRange(...)
  433. //
  434. // Other functions and methods that may work:
  435. // http://developer.netscape.com/docs/manuals/communicator/jsref/win1.htm
  436. // Note that "alert()" only works with Netscape4 and IE, and Mozilla 1.4+.
  437. //
  438. // NOTE:
  439. // isInNet() will resolve a hostname to an IP address, and cause
  440. // hangs on Mozilla/Firefox. Currently, these are stubbed out and replaced
  441. // with shExpMatch(host, "a.b.c.*"), which doesn't do the same thing,
  442. // but is sufficient for these purposes.
  443. //
  444. // Additional Mozilla/Firefox comments:
  445. //
  446. // All the above PAC functions are implemented in JavaScript,
  447. // and are added to the body of your PAC file when it is loaded.
  448. // See the "components/nsProxyAutoConfig.js" browser install
  449. // directory.
  450. //
  451. // - shExpMatch() is implemented as three pattern.replaces()
  452. // followed by a call to RegExp() (SLOW)
  453. // - isPlainHostname() just checks for lack of "." in the string
  454. // - dnsDomainIs() just matches strings exactly
  455. // - alert() is bound to this.proxyAlert(), which displays a message
  456. // in the JavaScript console window
  457.  
  458. ///////////////////////////////////////////////////////////////////////////////
  459. //
  460. // Regular Expressions
  461. //
  462. // Angus Turnbull pointed out the JavaScript 1.2 RE operators to me.
  463. // These should work in NS4 and IE4 (or later), but I have only tested on
  464. // Mozilla (1.3), IE5.5, and IE6. PLEASE TELL ME IF IT WORKS FOR YOU!
  465. //
  466. // A good introduction is at:
  467. // http://www.evolt.org/article/Regular_Expressions_in_JavaScript/17/36435/
  468. // Some references:
  469. // (old Netscape documentation is gone)
  470. // http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/regexp.html
  471. // http://developer.netscape.com/docs/manuals/js/client/jsref/regexp.htm
  472. // http://www.webreference.com/js/column5/
  473. // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsobjRegExpression.asp
  474. // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsgrpRegExpSyntax.asp
  475. // Real-time evaluator:
  476. // http://www.cuneytyilmaz.com/prog/jrx/
  477. //
  478. // I'm slowly replacing multiple glob patterns with regexps.
  479. // By using RE literals of /.../ rather than the constructor 'new RegExp()',
  480. // the regexps should be compiled as no-ads.pac is loaded.
  481. //
  482. // Important notes:
  483. // - if using the constructor, \ needs to be quoted; thus "\\." is used
  484. // to match a literal '.'. In the RE literal form, I need to end up
  485. // quoting any / for a URL path.
  486. // - Avoid these for now; they are broken or not supported in "older"
  487. // browsers such as NS4 and IE4:
  488. // - look-aheads (?=pat)
  489. // - non-greedy ? - a ? that follows *,+,?, and {}; (s)? is NOT non-greedy
  490. //
  491.  
  492. // matches several common URL paths for ad images:
  493. // such as: /banner/ /..._banner/ /banner_...
  494. // but matches several words and includes plurals
  495. // and catch .../!ad...
  496.  
  497. //var re_banner = /\/(.*_){0,1}(ad|advert|adverts?|adimage|adframe|adserver|admentor|adview|banner|bannerimg|popup|popunder)(s)?[_.\/]/i;
  498. //var re_banner = /(\b|[_0-9])(ad|advert(ising)?|adimage|adframe|adserv|admentor|adview|banner|popup|popunder)s?(\b|[_0-9])/i;
  499. //var re_banner = /(\b|[_])(ad|advert(ising)?|adimage|adframe|adserv|admentor|adview|banner|popup|popunder)s?(\b|[_0-9])/i;
  500. // var re_banner = /[/](?!no-)([^/]*?)(\b|[_])(ad|advert(ising)?|adimage|adframe|adserv|admentor|adview|banner|popup|popunder)s?(\b|[_0-9])/i;
  501.  
  502. var re_banner = /[/]([^/]*?)(advert|adimage|adframe|adserv|admentor|adview|banner|popunder|media\/subtract)s?/i;
  503.  
  504. var re_banner_white = /(load|feature=banner|upload_popup|popupplayer|popupmenu\.css|loginpopup|bannerbomb|popup\.lala\.com\/)/i;
  505.  
  506. // try to not block guids containing '...-ad...'
  507. var re_banner2 = /[/](?!no-ads)([^/]*?([^0-9/][^-/]))?(\b|[_])(ad[s]?)(\b|[_0-9])/i;
  508.  
  509.  
  510. // matches host/domain names starting with "ad" but not (admin|add|adsl)
  511. // or any hostname starting with "pop", "clicks", and "cash"
  512. // or any hostname containing "banner"
  513. // ^(ad(s)?.{0,4}\.|pop|click|cash|[^.]*banner|[^.]*adserv)
  514. // ^(ad(?!(min|sl|d\.))|pop|click|cash|[^.]*banner|[^.]*adserv)
  515. // ^(ad(?!(min|sl|d\.))|pop|click|cash|[^.]*banner|[^.]*adserv|.*\.ads\.)
  516. // ^(www\.)?(ad(?!(mission|visor|alur|iumx|ult|obe.*|min|sl|d|olly.*))|tology|pop|click(?!redblue)|cash|[^.]*banner|[^.]*adserv|.+\.ads?\.)
  517. //var re_adhost = /.../i;
  518.  
  519. var re_adhost = /\b((new)?ad(?!(vantage|am|mission|visor|alur|iumx|ult|vizia|obe|min|sl|d|olly|vance))|ads\b|adserv|pop(?!ular|corn|e)|click(?!redblue|andbuy|.reference)|cash(?!back)|banner|bans)/i;
  520.  
  521. // http://www.afcyhf.com/image-1742473-10472361
  522. // http://www.tkqlhce.com/image-1742473-10510557
  523. var re_crud = /www\.\w+\.com\/image-\d+-\d+$/;
  524.  
  525. // neg:
  526. // admin.foobar.com
  527. // add.iahoo.com
  528. // adsl.allow.com
  529. // administration.all.net
  530. // pos:
  531. // fire.ads.ighoo.com
  532. // ads.foo.org
  533. // ad0121.aaaa.com
  534. // adserver.goo.biz
  535. // popup.foo.bar
  536.  
  537. // matched against hostname
  538. var re_whitelist_domains = /(^|\.)(adafruit\..*|advogato\.org|adirondack\..*|kintera\.org|sprintpcs\.com|adp\.com|lego\.com|dell\.com|mozdev\.org|mozilla\.org|fidelity\.com|tirerack\.com|titantv\.com|lala\.com|sprint\.com|nextel\.com|verizon\.com|vupload\.facebook\.com|rit\.edu|mididb\.com|sony\.tv|market\.android\.com|weeklyad\.staples\.com|(code|plus|www)\.google\.com|googleadservices\.com|thetvdb\.com|bits\te.wikimedia\.org|css\.slickdealscdn\.com)$/i;
  539.  
  540.  
  541. ///////////////////////////////////////////////////////////////////////////////
  542.  
  543. var isActive = 1;
  544.  
  545. function FindProxyForURL(url, host)
  546. {
  547. //DEBUG alert("checking: url=" + url);
  548.  
  549. // Excellent kludge from Sean M. Burke:
  550. // Enable or disable no-ads for the current browser session.
  551. //
  552. // To disable, visit this URL: http://no-ads.int/off
  553. // To re-enable, visit this URL: http://no-ads.int/on
  554. //
  555. // (this will not work with Mozilla or Opera if the alert()s are present)
  556. //
  557. // This happens before lowercasing the URL, so make sure you use lowercase!
  558. //
  559. if (shExpMatch(host, "no-ads.int")) {
  560. if (shExpMatch(url, "*/on*")) {
  561. isActive = 1;
  562. //LOG alert("no-ads has been enabled.\n" + url);
  563. } else if (shExpMatch(url, "*/off*")) {
  564. isActive = 0;
  565. //LOG alert("no-ads has been disabled.\n" + url);
  566. } else if (shExpMatch(url, "*no-ads.int/")) {
  567. alert("no-ads is "+(isActive ? "enabled" : "disabled")+".\n" + url);
  568. } else {
  569. alert("no-ads unknown option.\n" + url);
  570. }
  571.  
  572. return blackhole;
  573. }
  574.  
  575. if (!isActive) {
  576. //LOG3 alert("no-ads inactive bypass: " + url);
  577. return bypass;
  578. }
  579.  
  580. // Suggestion from Quinten Martens
  581. // Make everything lower case.
  582. // WARNING: all shExpMatch rules following MUST be lowercase!
  583. url = url.toLowerCase();
  584. host = host.toLowerCase();
  585.  
  586. //
  587. // Local/Internal rule
  588. // matches to this rule get the 'local' proxy.
  589. // Adding rules here enables the use of 'local'
  590. //
  591. if (0
  592. //LOCAL-RULES
  593. // add rules such as:
  594. // || dnsDomainIs(host, "schooner.com")
  595. // || isPlainHostName(host)
  596. // or for a single host
  597. // || (host == "some-local-host")
  598. ) {
  599. //LOG3 alert("no-ads local: " + url);
  600. return localproxy;
  601. }
  602.  
  603. //
  604. // Whitelist section from InvisiBill
  605. //
  606. // Add sites here that should never be matched for ads.
  607. //
  608. if (0
  609. //WHITELIST-RULES
  610. // To add whitelist domains, simple add a line such as:
  611. // || dnsDomainIs(host, "schooner.com")
  612. // or for a single host
  613. // || (host == "some-host-name")
  614.  
  615. // Note: whitelisting schooner.com will defeat the "is-it-working"
  616. // test page at http://www.schooner.com/~loverso/no-ads/ads/
  617.  
  618. // any whitelisted domain
  619. || re_whitelist_domains.test(host)
  620.  
  621. // Apple.com "Switch" ads
  622. || shExpMatch(url, "*.apple.com/switch/ads/*")
  623.  
  624. // Uncomment for metacrawler
  625. // || (host == "clickit.go2net.com")
  626.  
  627. || (host == "web.lightningcast.net") // I forgot why I added this
  628.  
  629. || (host == "adf.ly"
  630. && shExpMatch(url, "*/http:/*"))
  631. || (host == "cdn.adf.ly"
  632. && shExpMatch(url, "*js"))
  633.  
  634. || (host == "images.rottentomatoescdn.com"
  635. && shExpMatch(url, "*/scripts?"))
  636.  
  637. // Wunderground (weather station 'banners')
  638. || (( dnsDomainIs(host, ".wunderground.com")
  639. || dnsDomainIs(host, ".wund.com")
  640. )
  641. && ( shExpMatch(url, "*/cgi-bin/banner/ban/wxbanner*")
  642. || shExpMatch(url, "*/weathersticker/*")
  643. || shExpMatch(url, "*/cgi-bin/satbanner*")
  644. )
  645. )
  646. ) {
  647. //LOG3 alert("no-ads whitelist: " + url);
  648. return normal;
  649. }
  650.  
  651. // To add more sites, simply include them in the correct format.
  652. //
  653. // The sites below are ones I currently block. Tell me of others you add!
  654.  
  655. // Remove the "//DEBUG2" to enable debug messages
  656. if (0
  657. //BLOCK-RULES
  658. //DEBUG2 || alert("start")
  659.  
  660. // Block IE4/5 "favicon.ico" fetches
  661. // (to avoid being tracked as having bookmarked the site)
  662. || shExpMatch(url, "*/favicon.*")
  663. || shExpMatch(url, "*/animated_favicon*")
  664.  
  665. //////
  666. //
  667. // Global Section
  668. // tries to match common names
  669. //
  670.  
  671. // REs for common URL paths
  672. //
  673. //DEBUG2 || ((m = re_banner.exec(url)) && alert("re_banner\n0= " + m[0]+"\n1= " + m[1]+"\n2= " + m[2]+"\n3= " + m[3]+"\n4= " + m[4]))
  674. //
  675. || (re_banner.test(url) && !re_banner_white.test(url))
  676. //
  677. //DEBUG2 || alert("passed re_banner")
  678.  
  679. //DEBUG2 || ((m = re_banner2.exec(url)) && alert("re_banner2\n0= " + m[0]+"\n1= " + m[1]+"\n2= " + m[2]+"\n3= " + m[3]+"\n4= " + m[4]))
  680. //
  681. || re_banner2.test(url)
  682. //
  683. //DEBUG2 || alert("passed re_banner2")
  684.  
  685. // RE for common adserver hostnames.
  686. // The regexp matches all hostnames starting with "ad" that are not
  687. // admin|add|adsl
  688. // (replaces explicit shExpMatch's below)
  689. || re_adhost.test(host)
  690. //
  691. //DEBUG2 || alert("passed re_adhost")
  692.  
  693. //////
  694. //
  695. // banner/ad organizations
  696. // Just delete the entire namespace
  697. //
  698.  
  699. // Facebook ... The new evil
  700. // || (dnsDomainIs(host, ".facebook.com")
  701. // && (shExpMatch(url, "*/plugins/like*")
  702. // )
  703. // )
  704. // || dnsDomainIs(host, ".fbcdn.net")
  705.  
  706. // doubleclick
  707. || dnsDomainIs(host, ".doubleclick.com")
  708. || dnsDomainIs(host, ".doubleclick.net")
  709. || dnsDomainIs(host, ".rpts.net")
  710. || dnsDomainIs(host, ".2mdn.net")
  711. || dnsDomainIs(host, ".2mdn.com")
  712.  
  713.  
  714. // these set cookies
  715. || dnsDomainIs(host, ".globaltrack.com")
  716. || dnsDomainIs(host, ".burstnet.com")
  717. || dnsDomainIs(host, ".adbureau.net")
  718. || dnsDomainIs(host, ".targetnet.com")
  719. || dnsDomainIs(host, ".humanclick.com")
  720. || dnsDomainIs(host, ".linkexchange.com")
  721.  
  722. || dnsDomainIs(host, ".fastclick.com")
  723. || dnsDomainIs(host, ".fastclick.net")
  724.  
  725. // one whole class C full of ad servers (fastclick)
  726. // XXX this might need the resolver
  727. // || isInNet(host, "205.180.85.0", "255.255.255.0")
  728. || shExpMatch(host, "205.180.85.*")
  729.  
  730. // these use 1x1 images to track you
  731. || dnsDomainIs(host, ".admonitor.com")
  732. || dnsDomainIs(host, ".focalink.com")
  733.  
  734. || dnsDomainIs(host, ".websponsors.com")
  735. || dnsDomainIs(host, ".advertising.com")
  736. || dnsDomainIs(host, ".cybereps.com")
  737. || dnsDomainIs(host, ".postmasterdirect.com")
  738. || dnsDomainIs(host, ".mediaplex.com")
  739. || dnsDomainIs(host, ".adtegrity.com")
  740. || dnsDomainIs(host, ".bannerbank.ru")
  741. || dnsDomainIs(host, ".bannerspace.com")
  742. || dnsDomainIs(host, ".theadstop.com")
  743. || dnsDomainIs(host, ".l90.com")
  744. || dnsDomainIs(host, ".webconnect.net")
  745. || dnsDomainIs(host, ".avenuea.com")
  746. || dnsDomainIs(host, ".flycast.com")
  747. || dnsDomainIs(host, ".engage.com")
  748. || dnsDomainIs(host, ".imgis.com")
  749. || dnsDomainIs(host, ".datais.com")
  750. || dnsDomainIs(host, ".link4ads.com")
  751. || dnsDomainIs(host, ".247media.com")
  752. || dnsDomainIs(host, ".hightrafficads.com")
  753. || dnsDomainIs(host, ".tribalfusion.com")
  754. || dnsDomainIs(host, ".rightserve.net")
  755. || dnsDomainIs(host, ".admaximize.com")
  756. || dnsDomainIs(host, ".valueclick.com")
  757. || dnsDomainIs(host, ".adlibris.se")
  758. || dnsDomainIs(host, ".vibrantmedia.com")
  759. || dnsDomainIs(host, ".coremetrics.com")
  760. || dnsDomainIs(host, ".vx2.cc")
  761. || dnsDomainIs(host, ".webpower.com")
  762. || dnsDomainIs(host, ".everyone.net")
  763. || dnsDomainIs(host, ".zedo.com")
  764. || dnsDomainIs(host, ".bigbangmedia.com")
  765. || dnsDomainIs(host, ".ad-annex.com")
  766. || dnsDomainIs(host, ".iwdirect.com")
  767. || dnsDomainIs(host, ".adlink.de")
  768. || dnsDomainIs(host, ".bidclix.net")
  769. || dnsDomainIs(host, ".webclients.net")
  770. || dnsDomainIs(host, ".linkcounter.com")
  771. || dnsDomainIs(host, ".sitetracker.com")
  772. || dnsDomainIs(host, ".adtrix.com")
  773. || dnsDomainIs(host, ".netshelter.net")
  774. || dnsDomainIs(host, ".rn11.com")
  775. // http://vpdc.ru4.com/content/images/66/011.gif
  776. || dnsDomainIs(host, ".ru4.com")
  777. // no '.' for rightmedia.net
  778. || dnsDomainIs(host, "rightmedia.net")
  779. || dnsDomainIs(host, ".casalemedia.com")
  780. || dnsDomainIs(host, ".casalemedia.com")
  781. || dnsDomainIs(host, "quantserve.com")
  782. || dnsDomainIs(host, "quantcast.com")
  783. || dnsDomainIs(host, "crwdcntrl.net")
  784. || dnsDomainIs(host, "scorecardresearch.net")
  785. || dnsDomainIs(host, "pubmatic.net")
  786. || dnsDomainIs(host, "yumenetworks.com")
  787. || dnsDomainIs(host, "brilig.com")
  788.  
  789. || dnsDomainIs(host, "perfb.com")
  790. || dnsDomainIs(host, "blogads.com")
  791.  
  792. || dnsDomainIs(host, "fetchback.com")
  793. || dnsDomainIs(host, "creatives.badongo.com")
  794. || dnsDomainIs(host, "pmsrvr.com")
  795. || dnsDomainIs(host, "trafficmack.com")
  796.  
  797.  
  798. // C-J
  799. || dnsDomainIs(host, ".commission-junction.com")
  800. || dnsDomainIs(host, ".qkimg.net")
  801. // emjcd.com ... many others
  802.  
  803. // */adv/*
  804. || dnsDomainIs(host, ".bluestreak.com")
  805.  
  806. // Virtumundo -- as annoying as they get
  807. || dnsDomainIs(host, ".virtumundo.com")
  808. || dnsDomainIs(host, ".treeloot.com")
  809. || dnsDomainIs(host, ".memberprize.com")
  810.  
  811. // internetfuel and _some_ of the sites they redirect to
  812. // (more internetfuel - from Sam G)
  813. || dnsDomainIs(host, ".internetfuel.net")
  814. || dnsDomainIs(host, ".internetfuel.com")
  815. || dnsDomainIs(host, ".peoplecaster.com")
  816. || dnsDomainIs(host, ".cupidsdatabase.com")
  817. || dnsDomainIs(host, ".automotive-times.com")
  818. || dnsDomainIs(host, ".healthy-lifetimes.com")
  819. || dnsDomainIs(host, ".us-world-business.com")
  820. || dnsDomainIs(host, ".internet-2-web.com")
  821. || dnsDomainIs(host, ".my-job-careers.com")
  822. || dnsDomainIs(host, ".freeonline.com")
  823. || dnsDomainIs(host, ".exitfuel.com")
  824. || dnsDomainIs(host, ".netbroadcaster.com")
  825. || dnsDomainIs(host, ".spaceports.com")
  826. || dnsDomainIs(host, ".mircx.com")
  827. || dnsDomainIs(host, ".exitchat.com")
  828. || dnsDomainIs(host, ".atdmt.com")
  829. || dnsDomainIs(host, ".partner2profit.com")
  830. || dnsDomainIs(host, ".centrport.net")
  831. || dnsDomainIs(host, ".centrport.com")
  832. || dnsDomainIs(host, ".rampidads.com")
  833.  
  834. || dnsDomainIs(host, ".dt07.net")
  835.  
  836. //////
  837. //
  838. // banner servers
  839. // (typically these set cookies or serve animated ads)
  840. //
  841.  
  842. || dnsDomainIs(host, "commonwealth.riddler.com")
  843. || dnsDomainIs(host, "banner.freeservers.com")
  844. || dnsDomainIs(host, "usads.futurenet.com")
  845. || dnsDomainIs(host, "banners.egroups.com")
  846. || dnsDomainIs(host, "ngadclient.hearme.com")
  847. || dnsDomainIs(host, "affiliates.allposters.com")
  848. || dnsDomainIs(host, "adincl.go2net.com")
  849. || dnsDomainIs(host, "webads.bizservers.com")
  850. || dnsDomainIs(host, ".addserv.com")
  851. || dnsDomainIs(host, ".falkag.net")
  852. || dnsDomainIs(host, ".buysellads.com")
  853.  
  854. || (host == "promote.pair.com")
  855.  
  856. || dnsDomainIs(host, ".interclick.com")
  857. || dnsDomainIs(host, ".travelscream.com")
  858.  
  859. // marketwatch.com (flash ads), but CSS get loaded
  860. || (dnsDomainIs(host, ".mktw.net")
  861. && !shExpMatch(url, "*/css/*"))
  862. || dnsDomainIs(host, ".cjt1.net")
  863. || dnsDomainIs(host, ".bns1.net")
  864.  
  865. // "undergroundonline"
  866. // comes from iframe with this url: http://mediamgr.ugo.com/html.ng/size=728x90&affiliate=megagames&channel=games&subchannel=pc&Network=affiliates&rating=g
  867. || dnsDomainIs(host, "image.ugo.com")
  868. || dnsDomainIs(host, "mediamgr.ugo.com")
  869.  
  870. // web ads and "cheap Long Distance"
  871. || dnsDomainIs(host, "zonecms.com")
  872. || dnsDomainIs(host, "zoneld.com")
  873.  
  874. // AOL
  875. || dnsDomainIs(host, ".atwola.com")
  876. || dnsDomainIs(host, "toolbar.aol.com")
  877. || dnsDomainIs(host, ".adsdk.com")
  878.  
  879. // animated ads shown at techbargains
  880. || (dnsDomainIs(host, ".overstock.com")
  881. && shExpMatch(url, "*/linkshare/*"))
  882. || (dnsDomainIs(host, ".supermediastore.com")
  883. && shExpMatch(url, "*/lib/supermediastore/*"))
  884. || (dnsDomainIs(host, ".shop4tech.com")
  885. && shExpMatch(url, "*/assets/*"))
  886. || (dnsDomainIs(host, ".softwareandstuff.com")
  887. && shExpMatch(url, "*/media/*"))
  888. || (dnsDomainIs(host, ".buy.com")
  889. && shExpMatch(url, "*/affiliate/*"))
  890.  
  891. || (dnsDomainIs(host, "pdaphonehome.com")
  892. && (shExpMatch(url, "*/pocketpcmagbest.gif")
  893. || shExpMatch(url, "*/link-msmobiles.gif")))
  894. || (dnsDomainIs(host, "ppc4you.com")
  895. && shExpMatch(url, "*/ppc_top_sites.gif"))
  896.  
  897. // more animated ads... these really drive me crazy
  898. || (dnsDomainIs(host, ".freewarepalm.com")
  899. && shExpMatch(url, "*/sponsors/*"))
  900.  
  901. || dnsDomainIs(host, "travelscream.com")
  902. || dnsDomainIs(host, "traveldeals.com")
  903. || dnsDomainIs(host, "traveldeals.wunderground.com")
  904. || dnsDomainIs(host, "as5000.com")
  905.  
  906. //////
  907. //
  908. // Ads/noise that make web pages SLOW
  909. //
  910.  
  911. || (dnsDomainIs(host, "mc.dailymotion.com")
  912. && shExpMatch(url, "*/masscast/*"))
  913.  
  914. // "widget" at RottenTomatoes (provided by 'thespringbox')
  915. // **maybe just use 'flashblock' everywhere**
  916. || (host == "downloads.thespringbox.com"
  917. // uncomment this to be more targeted and just remove the one at RT
  918. // && shEXpMatch(url, "*/wrapper.php?file=51832.sbw")
  919. )
  920.  
  921.  
  922. //////
  923. //
  924. // popups/unders
  925. //
  926.  
  927. || dnsDomainIs(host, "remotead.cnet.com")
  928. || dnsDomainIs(host, ".1st-dating.com")
  929. || dnsDomainIs(host, ".mousebucks.com")
  930. || dnsDomainIs(host, ".yourfreedvds.com")
  931. || dnsDomainIs(host, ".popupsavings.com")
  932. || dnsDomainIs(host, ".popupmoney.com")
  933. || dnsDomainIs(host, ".popuptraffic.com")
  934. || dnsDomainIs(host, ".popupnation.com")
  935. || dnsDomainIs(host, ".infostart.com")
  936. || dnsDomainIs(host, ".popupad.net")
  937. || dnsDomainIs(host, ".usapromotravel.com")
  938. || dnsDomainIs(host, ".goclick.com")
  939. || dnsDomainIs(host, ".trafficwave.net")
  940. || dnsDomainIs(host, ".popupad.net")
  941. || dnsDomainIs(host, ".paypopup.com")
  942.  
  943. // Popups from ezboard
  944. || dnsDomainIs(host, ".greenreaper.com")
  945. || dnsDomainIs(host, ".spewey.com")
  946. || dnsDomainIs(host, ".englishharbour.com")
  947. || dnsDomainIs(host, ".casino-trade.com")
  948. || dnsDomainIs(host, "got2goshop.com")
  949. // more ezboard crud (from Miika Asunta)
  950. || dnsDomainIs(host, ".addynamix.com")
  951. || dnsDomainIs(host, ".trafficmp.com")
  952. || dnsDomainIs(host, ".makingmoneyfromhome.net")
  953. || dnsDomainIs(host, ".leadcart.com")
  954.  
  955. || dnsDomainIs(host, "euros4click.de")
  956.  
  957. // http://www.power-mark.com/js/popunder.js
  958. || dnsDomainIs(host, ".power-mark.com")
  959.  
  960. //////
  961. //
  962. // User tracking (worse than ads) && hit counting "services"
  963. //
  964.  
  965. // "web trends live"
  966. || dnsDomainIs(host, ".webtrendslive.com")
  967. || dnsDomainIs(host, ".wtlive.com")
  968. || dnsDomainIs(host, ".imrworldwide.com")
  969.  
  970. // 1x1 tracking images
  971. // ** (but also used in some pay-for-clicks that I want to follow,
  972. // ** so disabled for now. 9/2001)
  973. // || dnsDomainIs(host, "service.bfast.com")
  974.  
  975. // one whole class C full of ad servers
  976. // XXX this might need the resolver
  977. // || isInNet(host, "66.40.16.0", "255.255.255.0")
  978. || shExpMatch(host, "66.40.16.*")
  979.  
  980. || dnsDomainIs(host, ".web-stat.com")
  981. || dnsDomainIs(host, ".superstats.com")
  982. || dnsDomainIs(host, ".allhits.ru")
  983. || dnsDomainIs(host, ".list.ru")
  984. || dnsDomainIs(host, ".counted.com")
  985. || dnsDomainIs(host, ".rankyou.com")
  986. || dnsDomainIs(host, ".clickcash.com")
  987. || dnsDomainIs(host, ".clickbank.com")
  988. || dnsDomainIs(host, ".paycounter.com")
  989. || dnsDomainIs(host, ".cashcount.com")
  990. || dnsDomainIs(host, ".clickedyclick.com")
  991. || dnsDomainIs(host, ".clickxchange.com")
  992. || dnsDomainIs(host, ".sitestats.com")
  993. || dnsDomainIs(host, ".site-stats.com")
  994. || dnsDomainIs(host, ".hitbox.com")
  995. || dnsDomainIs(host, ".exitdirect.com")
  996. || dnsDomainIs(host, ".realtracker.com")
  997. || dnsDomainIs(host, ".etracking.com")
  998. || dnsDomainIs(host, ".livestat.com")
  999. || dnsDomainIs(host, ".spylog.com")
  1000. || dnsDomainIs(host, ".freestats.com")
  1001. || dnsDomainIs(host, ".addfreestats.com")
  1002. || dnsDomainIs(host, ".topclicks.net")
  1003. || dnsDomainIs(host, ".mystat.pl")
  1004. || dnsDomainIs(host, ".hitz4you.de")
  1005. || dnsDomainIs(host, ".hitslink.com")
  1006. || dnsDomainIs(host, ".thecounter.com")
  1007. || dnsDomainIs(host, ".roiservice.com")
  1008. || dnsDomainIs(host, ".overture.com")
  1009. || dnsDomainIs(host, ".xiti.com")
  1010. || dnsDomainIs(host, ".cj.com")
  1011. || dnsDomainIs(host, ".anrdoezrs.net")
  1012. || dnsDomainIs(host, ".hey.it")
  1013. || dnsDomainIs(host, ".ppctracking.net")
  1014. || dnsDomainIs(host, ".darkcounter.com")
  1015. || dnsDomainIs(host, ".2o7.com")
  1016. || dnsDomainIs(host, ".2o7.net")
  1017. || dnsDomainIs(host, ".gostats.com")
  1018. || dnsDomainIs(host, ".everstats.com")
  1019. || dnsDomainIs(host, ".onestat.com")
  1020. || dnsDomainIs(host, ".statcounter.com")
  1021. || dnsDomainIs(host, ".trafic.ro")
  1022. || dnsDomainIs(host, ".exitexchange.com")
  1023. || dnsDomainIs(host, "clicktorrent.info")
  1024. || dnsDomainIs(host, "ventimedia.com")
  1025. || dnsDomainIs(host, "flashmediaportal.com")
  1026.  
  1027. // clickability, via CNN
  1028. || dnsDomainIs(host, ".clickability.com")
  1029. || dnsDomainIs(host, ".savethis.com")
  1030.  
  1031. || dnsDomainIs(host, ".extremetracking.com")
  1032. || dnsDomainIs(host, ".extreme-dm.com")
  1033. || dnsDomainIs(host, ".pop6.com")
  1034. || dnsDomainIs(host, ".medleyads.com")
  1035.  
  1036. // bogus 'news'
  1037. || dnsDomainIs(host, "news6insider.com")
  1038.  
  1039. // bogus 'virusscan' popup/hijack
  1040. // antivirus-whitelist.cw.cm
  1041. // redirected from zyvqerta.cw.cm
  1042. // redirected from contmoovui4d.co.cc
  1043. // (I'm tempted to toss all these bogus TLDs in the trash,
  1044. // but I'll just stay on the second level)
  1045. || dnsDomainIs(host, "cw.cm")
  1046. || dnsDomainIs(host, "co.cc")
  1047.  
  1048. || dnsDomainIs(host, "hideus.in")
  1049. || dnsDomainIs(host, "addthis.com")
  1050. || dnsDomainIs(host, "popadscdn.net")
  1051.  
  1052. //////
  1053. //
  1054. // Dead domain parking
  1055. //
  1056. || dnsDomainIs(host, ".netster.com")
  1057.  
  1058. //////
  1059. //
  1060. // Search engine "optimizers"
  1061. //
  1062. || dnsDomainIs(host, ".searchmarketing.com")
  1063.  
  1064. //////
  1065. //
  1066. // Spyware/worms
  1067. //
  1068.  
  1069. || dnsDomainIs(host, ".friendgreetings.com")
  1070. || dnsDomainIs(host, ".permissionedmedia.com")
  1071. || dnsDomainIs(host, ".searchbarcash.com")
  1072.  
  1073. //////
  1074. //
  1075. // Surveys, votes, quizes
  1076. //
  1077.  
  1078. || dnsDomainIs(host, ".zoomerang.com")
  1079. || dnsDomainIs(host, ".quizrocket.com")
  1080. || (dnsDomainIs(host, ".amazonaws.com")
  1081. && shExpMatch(url, "*/udm_img/mid*")
  1082. )
  1083.  
  1084. //////
  1085. //
  1086. // "Casino" ads (scams)
  1087. //
  1088.  
  1089. || dnsDomainIs(host, ".aceshigh.com")
  1090. || dnsDomainIs(host, ".idealcasino.net")
  1091. || dnsDomainIs(host, ".casinobar.net")
  1092. || dnsDomainIs(host, ".casinoionair.com")
  1093.  
  1094. || (dnsDomainIs(host, ".go2net.com")
  1095. && shExpMatch(url, "*adclick*")
  1096. )
  1097.  
  1098. //////
  1099. //
  1100. // Spammers
  1101. //
  1102.  
  1103. || dnsDomainIs(host, ".licensed-collectibles.com")
  1104. || dnsDomainIs(host, ".webdesignprofessional.com")
  1105.  
  1106. //////
  1107. //
  1108. // Directed at extra annoying places
  1109. //
  1110.  
  1111. // Attempts to download ad-supported spyware without asking first
  1112. || dnsDomainIs(host, ".gator.com")
  1113.  
  1114. // ebay
  1115. || ((dnsDomainIs(host, "pics.ebay.com")
  1116. || dnsDomainIs(host, "pics.ebaystatic.com"))
  1117. && shExpMatch(url, "*/pics/mops/*/*[0-9]x[0-9]*")
  1118. )
  1119. || (dnsDomainIs(host, "ebayobjects.com")
  1120. && shExpMatch(url, "*search/keywords*")
  1121. )
  1122. || dnsDomainIs(host, "admarketplace.com")
  1123. || dnsDomainIs(host, "admarketplace.net")
  1124.  
  1125. // Bravenet & Ezboard
  1126. || (dnsDomainIs(host, ".ezboard.com")
  1127. && shExpMatch(url, "*/bravenet/*")
  1128. )
  1129. || (dnsDomainIs(host, ".bravenet.com")
  1130. && ( shExpMatch(host, "*counter*")
  1131. || shExpMatch(url, "*/jsbanner*")
  1132. || shExpMatch(url, "*/bravenet/*")
  1133. )
  1134. )
  1135.  
  1136. // GeoCities
  1137. // (checking "toto" from Prakash Persaud)
  1138. || (( dnsDomainIs(host,"geo.yahoo.com")
  1139. || dnsDomainIs(host,".geocities.com"))
  1140. && (
  1141. shExpMatch(url,"*/toto?s*")
  1142. || shExpMatch(url, "*geocities.com/js_source*")
  1143. || dnsDomainIs(host, "visit.geocities.com")
  1144. )
  1145. )
  1146.  
  1147. // Yahoo ads (direct and via Akamai)
  1148. // http://us.a1.yimg.com/us.yimg.com/a/...
  1149. || (dnsDomainIs(host,"yimg.com")
  1150. && !( shExpMatch(url,"*yimg.com/a/i/*")
  1151. || shExpMatch(url,"*yimg.com/a/lib/*")
  1152. || shExpMatch(url,"*yimg.com/a/combo*")
  1153. )
  1154. && ( shExpMatch(url,"*yimg.com/a/*")
  1155. || shExpMatch(url,"*yimg.com/*/adv/*")
  1156. || shExpMatch(url,"*yimg.com/*/promotions/*")
  1157. )
  1158. )
  1159. // "eyewonder" ads at Yahoo
  1160. || dnsDomainIs(host,"qz3.net")
  1161. || dnsDomainIs(host,".eyewonder.com")
  1162.  
  1163. // background ad images
  1164. || dnsDomainIs(host,"buzzcity.com")
  1165.  
  1166. // FortuneCity - ads and tracking
  1167. || (dnsDomainIs(host,".fortunecity.com")
  1168. && ( shExpMatch(url,"*/js/adscript*")
  1169. || shExpMatch(url,"*/js/fctrack*")
  1170. )
  1171. )
  1172.  
  1173. // zdnet
  1174. // tracking webbugs:
  1175. // http://gserv.zdnet.com/clear/ns.gif?a000009999999999999+2093
  1176. || (dnsDomainIs(host, ".zdnet.com")
  1177. && ( dnsDomainIs(host, "ads3.zdnet.com")
  1178. || host == "gserv.zdnet.com"
  1179. || shExpMatch(url, "*/texis/cs/ad.html")
  1180. || shExpMatch(url, "*/adverts")
  1181. )
  1182. )
  1183.  
  1184. // cnet
  1185. // web bugs and ad redirections
  1186. // taken care of by hostname rules:
  1187. // http://adimg.com.com/...
  1188. // http://adlog.com.com/...
  1189. // http://dw.com.com/clear/c.gif
  1190. // http://dw.com.com/redir?astid=2&destUrl=http%3A%2F%2Fwww.buy ...
  1191. // http://mads.com.com/mac-ad?...
  1192. || (host == "dw.com.com" || host == "mads.com.com")
  1193. || (dnsDomainIs(host, ".com.com")
  1194. && ( host == "dw.com.com"
  1195. || host == "mads.com.com"
  1196. )
  1197. )
  1198.  
  1199. // nytimes
  1200. || (dnsDomainIs(host, ".nytimes.com")
  1201. && shExpMatch(url,"*/adx/*")
  1202. )
  1203.  
  1204. // pop-after
  1205. || dnsDomainIs(host, ".unicast.net")
  1206.  
  1207.  
  1208. // Be Free affiliate ads
  1209. || dnsDomainIs(host, ".reporting.net")
  1210. || dnsDomainIs(host, ".affliate.net")
  1211. || (dnsDomainIs(host, ".akamai.net")
  1212. && shExpMatch(url, "*.affiliate.net/*")
  1213. )
  1214.  
  1215. // Infospace.com popunder
  1216. // for "webmarket.com" & "shopping.dogpile.com" -- just say no!
  1217. || (dnsDomainIs(host, ".infospace.com")
  1218. && shExpMatch(url, "*/goshopping/*")
  1219. )
  1220. || dnsDomainIs(host, ".webmarket.com")
  1221. || dnsDomainIs(host, "shopping.dogpile.com")
  1222.  
  1223. // goto.com popunder for information.gopher.com
  1224. || dnsDomainIs(host, "information.gopher.com")
  1225.  
  1226. // About.com popunder and floating ad bar
  1227. || (dnsDomainIs(host, ".about.com")
  1228. && (0
  1229. || shExpMatch(url, "*/sprinks/*")
  1230. || shExpMatch(url, "*about.com/0/js/*")
  1231. || shExpMatch(url, "*about.com/f/p/*")
  1232. )
  1233. )
  1234.  
  1235. // Dell
  1236. || (dnsDomainIs(host, ".dell.com")
  1237. && shExpMatch(url, "*/images/affiliates/*")
  1238. )
  1239.  
  1240. // IFilm iframes
  1241. || (dnsDomainIs(host, ".ifilm.com")
  1242. && (shExpMatch(url, "*/partners/*")
  1243. || shExpMatch(url, "*/redirect*")
  1244. )
  1245. )
  1246.  
  1247. // tomshardware
  1248. // they are most annoying:
  1249. // - cookies on their background images to track you
  1250. // - looping shockwave ads
  1251. // this kills most of the crud
  1252. // || isInNet(host, "216.92.21.0", "255.255.255.0")
  1253. || ((dnsDomainIs(host, ".tomshardware.com")
  1254. || shExpMatch(host, "216.92.21.*"))
  1255. && ( shExpMatch(url, "*/cgi-bin/banner*")
  1256. || shExpMatch(url, "*/cgi-bin/bd.m*")
  1257. || shExpMatch(url, "*/images/banner/*")
  1258. )
  1259. )
  1260.  
  1261. || shExpMatch(url, "*mapsonus.com/ad.images*")
  1262.  
  1263. // Slashdot: added these when I saw hidden 1x1 images with cookies
  1264. || dnsDomainIs(host, "adfu.blockstackers.com")
  1265. || (dnsDomainIs(host, "slashdot.org")
  1266. && (
  1267. shExpMatch(url, "*/slashdot/pc.gif*")
  1268. || shExpMatch(url, "*/pagecount.gif*")
  1269. || shExpMatch(url, "*/adlog.pl*")
  1270. )
  1271. )
  1272. || dnsDomainIs(host, "googlesyndication.com")
  1273. || dnsDomainIs(host, "google-analytics.com")
  1274.  
  1275. // it-aint-cool.com
  1276. || (dnsDomainIs(host, "aintitcool.com")
  1277. && (
  1278. shExpMatch(url, "*/newline/*")
  1279. || shExpMatch(url, "*/drillteammedia/*")
  1280. || shExpMatch(url, "*/foxsearchlight/*")
  1281. || shExpMatch(url, "*/media/aol*")
  1282. || shExpMatch(url, "*swf")
  1283. )
  1284. )
  1285.  
  1286. // Staples & CrossMediaServices
  1287. || (dnsDomainIs(host, ".staples.com")
  1288. && shExpMatch(url, "*/pixeltracker/*")
  1289. )
  1290. || dnsDomainIs(host, "pt.crossmediaservices.com")
  1291.  
  1292. // OfficeMax affiliate art (affArt->affart because of toLowerCase)
  1293. || (dnsDomainIs(host, ".officemax.com")
  1294. && shExpMatch(url, "*/affart/*")
  1295. )
  1296.  
  1297. // complicated JavaScript for directed ads!
  1298. // 1/5/2004: allow /js/ as they now use it for graphs
  1299. // || (dnsDomainIs(host, ".anandtech.com")
  1300. // && (shExpMatch(url,"*/js/*")
  1301. // || shExpMatch(url,"*/bnr_*")
  1302. // )
  1303. // )
  1304.  
  1305. // hardocp
  1306. // http://65.119.30.151/UploadFilesForNewegg/onlineads/newegg728hardocp.swf
  1307. || (host == "hera.hardocp.com")
  1308. || shExpMatch(url,"*/onlineads/*")
  1309.  
  1310. // complicated JavaScript for gliding ads!
  1311. || (dnsDomainIs(host, ".fatwallet.com")
  1312. && shExpMatch(url,"*/js/*")
  1313. )
  1314.  
  1315. // cnet ads
  1316. || dnsDomainIs(host, "promo.search.com")
  1317.  
  1318. // IMDB celeb photos
  1319. // (Photos/CMSIcons->photos/cmsicons because of toLowerCase)
  1320. || (dnsDomainIs(host, "imdb.com")
  1321. && ( shExpMatch(url, "*/photos/cmsicons/*")
  1322. || shExpMatch(url, "*/icons/*/celeb/*")
  1323. || shExpMatch(url, "*.swf")
  1324. )
  1325. )
  1326. // incredibly annoying IMDB shock/flash ads
  1327. || dnsDomainIs(host, "kliptracker.com")
  1328. || dnsDomainIs(host, "klipmart.com")
  1329.  
  1330. // more incredibly annoying shock/flash ads
  1331. || host == "avpa.javalobby.org"
  1332.  
  1333. || host == "spinbox.techtracker.com"
  1334.  
  1335. // Amazon affiliate 'search'. retrieves a JS that writes new HTML
  1336. // that references one or more images "related to your search".
  1337. // (If there is a real use for rcm.amazon.com, let me know)
  1338. // http://rcm.amazon.com/e/cm?t=starlingtechnolo&l=st1&search=cynicism&mode=books&p=11&o=1&bg1=CEE7FF&fc1=000000&lc1=083194&lt1=_blank
  1339. || host == "rcm.amazon.com"
  1340.  
  1341. // megaupload affiliate
  1342. || (dnsDomainIs(host, ".megaupload.com") && (
  1343. shExpMatch(url, "*/aff*.php")
  1344. || shExpMatch(url, "*/mrads/*")
  1345. )
  1346. )
  1347. || dnsDomainIs(host, ".megaflirt.com")
  1348.  
  1349. || dnsDomainIs(host, ".ifriends.com")
  1350.  
  1351. || ((dnsDomainIs(host, ".gamecopyworld.com")
  1352. || dnsDomainIs(host, ".linkworld.com")
  1353. || dnsDomainIs(host, ".filetarget.com")
  1354. )&& (
  1355. shExpMatch(url, "*/ii/*")
  1356. || shExpMatch(url, "*/@_eve*")
  1357. // || shExpMatch(url, "*/@*")
  1358. )
  1359. )
  1360.  
  1361. || dnsDomainIs(host, "lookoutmovies.com")
  1362. || dnsDomainIs(host, "tube-player.com")
  1363.  
  1364.  
  1365. // www.afcyhf.com/image-1742473-10472361
  1366. // www.tkqlhce.com/image-1742473-10510557
  1367. || re_crud.test(url)
  1368.  
  1369.  
  1370. //////
  1371. //
  1372. // Other "Scum And Villainry"
  1373. //
  1374.  
  1375. // Popup from "reserved" domains at register.com
  1376. // (I considered blocking all of register.com)
  1377. || (dnsDomainIs(host, ".register.com")
  1378. && (shExpMatch(url,"*.js")
  1379. || shExpMatch(host, "searchtheweb*")
  1380. || shExpMatch(host, "futuresite*")
  1381. )
  1382. )
  1383.  
  1384. || dnsDomainIs(host, ".oingo.com")
  1385. || dnsDomainIs(host, ".namingsolutions.com")
  1386.  
  1387. // "Data collection"
  1388. || dnsDomainIs(host, "coremetrics.com")
  1389.  
  1390. // Sets your home page
  1391. || dnsDomainIs(host, "firehunt.com")
  1392.  
  1393. // tracking
  1394. || dnsDomainIs(host, "appliedsemantics.com")
  1395.  
  1396. // Scum who buy ad space from the above
  1397. // || dnsDomainIs(host, ".hartfordrents.com")
  1398. // || dnsDomainIs(host, ".chicagocomputerrentals.com")
  1399. // || dnsDomainIs(host, ".ccrsolutions.com")
  1400. // || dnsDomainIs(host, ".rushcomputer.com")
  1401. // || dnsDomainIs(host, ".localesimates.com")
  1402. // || dnsDomainIs(host, ".unitedvision.com")
  1403. // XXX this might need the resolver
  1404. // || isInNet(host, "216.216.246.31", "255.255.255.255")
  1405. || (host == "216.216.246.31")
  1406.  
  1407. // avsforum ads
  1408. // || isInNet(host, "216.66.21.35", "255.255.255.255")
  1409. || (host == "216.66.21.35")
  1410. || dnsDomainIs(host, ".avsads.com")
  1411.  
  1412. // bogus "search" sites at non-existent sites
  1413. || dnsDomainIs(host, ".search411.com")
  1414.  
  1415. // palmgear.com
  1416. || (dnsDomainIs(host, "palmgear.com")
  1417. && ( shExpMatch(url, "*/adsales/*")
  1418. || shExpMatch(url, "*/emailblast*")
  1419. )
  1420. )
  1421.  
  1422. || dnsDomainIs(host, "prreleases.net")
  1423.  
  1424. //////
  1425. //
  1426. // Contributed adult sites
  1427. //
  1428.  
  1429. || dnsDomainIs(host, "porntrack.com")
  1430. || dnsDomainIs(host, "sexe-portail.com")
  1431. || dnsDomainIs(host, "sextracker.com")
  1432. || dnsDomainIs(host, "sexspy.com")
  1433. || dnsDomainIs(host, "offshoreclicks.com")
  1434. || dnsDomainIs(host, "exxxit.com")
  1435. || dnsDomainIs(host, "private-dailer.biz")
  1436. || shExpMatch(url, "*retestrak.nl/misc/reet.gif")
  1437. || shExpMatch(url, "*dontstayin.com/*.swf")
  1438. || shExpMatch(url, "*pornotube.com/textads*")
  1439. || dnsDomainIs(host, "xratedbucks.com")
  1440. || dnsDomainIs(host, "hornymatches.com")
  1441. || dnsDomainIs(host, "hornymatches.com")
  1442. || dnsDomainIs(host, "etology.com")
  1443. || dnsDomainIs(host, "streamray.com")
  1444. || dnsDomainIs(host, "awempire.com")
  1445. || dnsDomainIs(host, "promos.fling.com")
  1446. || dnsDomainIs(host, "pussygreen.com")
  1447. || dnsDomainIs(host, "livejasmin.com")
  1448. || dnsDomainIs(host, "imlive.com")
  1449. || dnsDomainIs(host, "ihookup.com")
  1450.  
  1451. || (dnsDomainIs(host, "shufuni.com")
  1452. && ( shExpMatch(url, "*images/activepage*")
  1453. )
  1454. )
  1455.  
  1456. //EXTRA-BLOCK-RULES
  1457. ) {
  1458. //LOG2 alert("no-ads blocking: " + url);
  1459.  
  1460. // deny this request
  1461. return blackhole;
  1462.  
  1463. } else {
  1464. //LOG3 alert("no-ads allowing: " + url);
  1465.  
  1466. // all other requests go direct and avoid any overhead
  1467. return normal;
  1468. }
  1469. }
  1470.  
  1471. ///////////////////////////////////////////////////////////////////////////////
  1472. //
  1473. // This line is just for testing; you can ignore it. But, if you are having
  1474. // problems where you think this PAC file isn't being loaded, then change this
  1475. // to read "if (1)" and the alert box should appear when the browser loads this
  1476. // file.
  1477. //
  1478. // This works for IE4, IE5, IE5.5, IE6 and Netscape 2.x, 3.x, and 4.x.
  1479. // (For IE6, tested on Win2K)
  1480. // This does not work for Mozilla before 1.4 (and not for Netscape 6.x).
  1481. // In Mozilla 1.4+ and Fireox, this will write to the JavaScript console.
  1482. //
  1483. if (0) {
  1484. alert("no-ads.pac: LOADED:\n" +
  1485. " version: "+noadsver+"\n" +
  1486. " blackhole: "+blackhole+"\n" +
  1487. " normal: "+normal+"\n" +
  1488. " localproxy: "+localproxy+"\n" +
  1489. " bypass: "+bypass+"\n"
  1490. //MSG
  1491. );
  1492. }
  1493.  
  1494. // The above should show you that this JavaScript is executed in an
  1495. // unprotected global context. NEVER point at someone elses autoconfig file;
  1496. // always load from your own copy!
  1497.  
  1498. // an alert that returns true (normally it returns void)
  1499. function alertmatch(str)
  1500. {
  1501. alert(str);
  1502. return 1;
  1503. }
  1504.  
  1505. ///////////////////////////////////////////////////////////////////////////////
  1506. //
  1507. // Replacement function for dnsDomainIs(). This is to replace the
  1508. // prefix problem, which a leading '.' used to be used for.
  1509. //
  1510. // dnsDomainIs("bar.com", "bar.com") => true
  1511. // dnsDomainIs("www.bar.com", "bar.com") => true
  1512. // dnsDomainIs("www.foobar.com", "bar.com") => true <<< incorrect
  1513. //
  1514. // _dnsDomainIs("bar.com", "bar.com") => true
  1515. // _dnsDomainIs("www.bar.com", "bar.com") => true
  1516. // _dnsDomainIs("www.foobar.com", "bar.com") => false <<< correct
  1517. //
  1518. function _dnsDomainIs(host, domain) {
  1519. if (host.length > domain.length) {
  1520. return (host.substring(host.length - domain.length - 1) == "." + domain);
  1521. }
  1522. return (host == domain);
  1523. }

Report this snippet  

You need to login to post a comment.