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

Report this snippet  

You need to login to post a comment.