| OLD | NEW | 
 | (Empty) | 
|    1 var schemes = { |  | 
|    2  'http:': 4, |  | 
|    3  'https:': 3, |  | 
|    4  'ftp:': 2, |  | 
|    5  'irc:': 1 |  | 
|    6 } |  | 
|    7  |  | 
|    8 var domainReferrals = { |  | 
|    9   'amazon.co.uk': 'tag=uf07d-21', |  | 
|   10   'amazon.com': 'tag=uf024-20', |  | 
|   11   'amazon.de': 'tag=uf0e6-21', |  | 
|   12   'amazon.fr': 'tag=uf02b-21', |  | 
|   13   'amazon.es': 'tag=uf07-21', |  | 
|   14   'amazon.it': 'tag=uf08d-21', |  | 
|   15   'ozon.ru': 'partner=urlfixer' |  | 
|   16 } |  | 
|   17  |  | 
|   18 var additionalDomains = [ |  | 
|   19   'fab.com', |  | 
|   20   'ku.dk', |  | 
|   21   'google.cz', |  | 
|   22   'komplett.ie', |  | 
|   23   'lotto.ie', |  | 
|   24   'bt.yahoo.com', |  | 
|   25   'o.co', |  | 
|   26   'bet.hu', |  | 
|   27   'haz.de', |  | 
|   28   'sas.com', |  | 
|   29   'nic.ir', |  | 
|   30   'tomtop.com', |  | 
|   31   'uwa.edu.au', |  | 
|   32   'spacex.com', |  | 
|   33   'eif.org', |  | 
|   34   'geld.de', |  | 
|   35   // From http://www.wikipedia.org/ |  | 
|   36   'en.wikipedia.org', 'ja.wikipedia.org', 'de.wikipedia.org', 'es.wikipedia.org'
     , 'ru.wikipedia.org', 'fr.wikipedia.org', 'it.wikipedia.org', 'pl.wikipedia.org'
     , 'pt.wikipedia.org', 'zh.wikipedia.org', 'ar.wikipedia.org', 'bg.wikipedia.org'
     , 'ca.wikipedia.org', 'cs.wikipedia.org', 'da.wikipedia.org', 'de.wikipedia.org'
     , 'en.wikipedia.org', 'es.wikipedia.org', 'eo.wikipedia.org', 'eu.wikipedia.org'
     , 'fa.wikipedia.org', 'fr.wikipedia.org', 'ko.wikipedia.org', 'hi.wikipedia.org'
     , 'hr.wikipedia.org', 'id.wikipedia.org', 'it.wikipedia.org', 'he.wikipedia.org'
     , 'lt.wikipedia.org', 'hu.wikipedia.org', 'ms.wikipedia.org', 'nl.wikipedia.org'
     , 'ja.wikipedia.org', 'no.wikipedia.org', 'pl.wikipedia.org', 'pt.wikipedia.org'
     , 'kk.wikipedia.org', 'ro.wikipedia.org', 'ru.wikipedia.org', 'sk.wikipedia.org'
     , 'sl.wikipedia.org', 'sr.wikipedia.org', 'fi.wikipedia.org', 'sv.wikipedia.org'
     , 'tr.wikipedia.org', 'uk.wikipedia.org', 'vi.wikipedia.org', 'vo.wikipedia.org'
     , 'war.wikipedia.org', 'zh.wikipedia.org', 'af.wikipedia.org', 'als.wikipedia.or
     g', 'am.wikipedia.org', 'an.wikipedia.org', 'ast.wikipedia.org', 'ht.wikipedia.o
     rg', 'az.wikipedia.org', 'bn.wikipedia.org', 'ba.wikipedia.org', 'be.wikipedia.o
     rg', 'bpy.wikipedia.org', 'bs.wikipedia.org', 'br.wikipedia.org', 'cv.wikipedia.
     org', 'cy.wikipedia.org', 'et.wikipedia.org', 'el.wikipedia.org', 'fy.wikipedia.
     org', 'ga.wikipedia.org', 'gl.wikipedia.org', 'gu.wikipedia.org', 'hy.wikipedia.
     org', 'io.wikipedia.org', 'ia.wikipedia.org', 'is.wikipedia.org', 'jv.wikipedia.
     org', 'kn.wikipedia.org', 'ka.wikipedia.org', 'ku.wikipedia.org', 'la.wikipedia.
     org', 'lv.wikipedia.org', 'lb.wikipedia.org', 'lmo.wikipedia.org', 'mk.wikipedia
     .org', 'mg.wikipedia.org', 'ml.wikipedia.org', 'mr.wikipedia.org', 'my.wikipedia
     .org', 'new.wikipedia.org', 'ne.wikipedia.org', 'nn.wikipedia.org', 'nap.wikiped
     ia.org', 'oc.wikipedia.org', 'pms.wikipedia.org', 'nds.wikipedia.org', 'qu.wikip
     edia.org', 'pnb.wikipedia.org', 'sq.wikipedia.org', 'scn.wikipedia.org', 'simple
     .wikipedia.org', 'ceb.wikipedia.org', 'sh.wikipedia.org', 'su.wikipedia.org', 's
     w.wikipedia.org', 'tl.wikipedia.org', 'ta.wikipedia.org', 'tt.wikipedia.org', 't
     e.wikipedia.org', 'th.wikipedia.org', 'bug.wikipedia.org', 'ur.wikipedia.org', '
     wa.wikipedia.org', 'yo.wikipedia.org', 'diq.wikipedia.org', 'ace.wikipedia.org',
      'frp.wikipedia.org', 'arc.wikipedia.org', 'gn.wikipedia.org', 'av.wikipedia.org
     ', 'ay.wikipedia.org', 'bjn.wikipedia.org', 'bh.wikipedia.org', 'bcl.wikipedia.o
     rg', 'bar.wikipedia.org', 'bo.wikipedia.org', 'co.wikipedia.org', 'pdc.wikipedia
     .org', 'dv.wikipedia.org', 'nv.wikipedia.org', 'ang.wikipedia.org', 'eml.wikiped
     ia.org', 'myv.wikipedia.org', 'ext.wikipedia.org', 'hif.wikipedia.org', 'fo.wiki
     pedia.org', 'frr.wikipedia.org', 'fur.wikipedia.org', 'gv.wikipedia.org', 'gag.w
     ikipedia.org', 'gd.wikipedia.org', 'gan.wikipedia.org', 'glk.wikipedia.org', 'ha
     k.wikipedia.org', 'xal.wikipedia.org', 'haw.wikipedia.org', 'hsb.wikipedia.org',
      'ilo.wikipedia.org', 'ie.wikipedia.org', 'os.wikipedia.org', 'kl.wikipedia.org'
     , 'pam.wikipedia.org', 'csb.wikipedia.org', 'kw.wikipedia.org', 'km.wikipedia.or
     g', 'rw.wikipedia.org', 'kv.wikipedia.org', 'ky.wikipedia.org', 'mrj.wikipedia.o
     rg', 'lad.wikipedia.org', 'lbe.wikipedia.org', 'lij.wikipedia.org', 'li.wikipedi
     a.org', 'ln.wikipedia.org', 'jbo.wikipedia.org', 'mt.wikipedia.org', 'mi.wikiped
     ia.org', 'xmf.wikipedia.org', 'arz.wikipedia.org', 'mzn.wikipedia.org', 'mdf.wik
     ipedia.org', 'mn.wikipedia.org', 'nah.wikipedia.org', 'nrm.wikipedia.org', 'nov.
     wikipedia.org', 'ce.wikipedia.org', 'mhr.wikipedia.org', 'or.wikipedia.org', 'as
     .wikipedia.org', 'uz.wikipedia.org', 'pi.wikipedia.org', 'pag.wikipedia.org', 'p
     a.wikipedia.org', 'pap.wikipedia.org', 'ps.wikipedia.org', 'koi.wikipedia.org', 
     'pfl.wikipedia.org', 'pcd.wikipedia.org', 'krc.wikipedia.org', 'crh.wikipedia.or
     g', 'ksh.wikipedia.org', 'rm.wikipedia.org', 'rue.wikipedia.org', 'sa.wikipedia.
     org', 'se.wikipedia.org', 'sc.wikipedia.org', 'sah.wikipedia.org', 'sco.wikipedi
     a.org', 'stq.wikipedia.org', 'si.wikipedia.org', 'szl.wikipedia.org', 'so.wikipe
     dia.org', 'ckb.wikipedia.org', 'tg.wikipedia.org', 'tpi.wikipedia.org', 'to.wiki
     pedia.org', 'tk.wikipedia.org', 'udm.wikipedia.org', 'ug.wikipedia.org', 'vec.wi
     kipedia.org', 'vls.wikipedia.org', 'wo.wikipedia.org', 'wuu.wikipedia.org', 'yi.
     wikipedia.org', 'zea.wikipedia.org', 'kbd.wikipedia.org', 'ak.wikipedia.org', 'a
     b.wikipedia.org', 'bm.wikipedia.org', 'bi.wikipedia.org', 'bxr.wikipedia.org', '
     ch.wikipedia.org', 'ny.wikipedia.org', 'za.wikipedia.org', 'dsb.wikipedia.org', 
     'ee.wikipedia.org', 'ff.wikipedia.org', 'ki.wikipedia.org', 'got.wikipedia.org',
      'ha.wikipedia.org', 'ig.wikipedia.org', 'iu.wikipedia.org', 'ik.wikipedia.org',
      'ks.wikipedia.org', 'kg.wikipedia.org', 'lo.wikipedia.org', 'ltg.wikipedia.org'
     , 'lg.wikipedia.org', 'cdo.wikipedia.org', 'mwl.wikipedia.org', 'mo.wikipedia.or
     g', 'fj.wikipedia.org', 'na.wikipedia.org', 'cr.wikipedia.org', 'pih.wikipedia.o
     rg', 'om.wikipedia.org', 'pnt.wikipedia.org', 'kaa.wikipedia.org', 'dz.wikipedia
     .org', 'rmy.wikipedia.org', 'rn.wikipedia.org', 'sm.wikipedia.org', 'sg.wikipedi
     a.org', 'st.wikipedia.org', 'nso.wikipedia.org', 'tn.wikipedia.org', 'sn.wikiped
     ia.org', 'sd.wikipedia.org', 'cu.wikipedia.org', 'ss.wikipedia.org', 'srn.wikipe
     dia.org', 'ty.wikipedia.org', 'kab.wikipedia.org', 'tet.wikipedia.org', 'ti.wiki
     pedia.org', 'chr.wikipedia.org', 'tum.wikipedia.org', 'ts.wikipedia.org', 'chy.w
     ikipedia.org', 've.wikipedia.org', 'tw.wikipedia.org', 'vep.wikipedia.org', 'xh.
     wikipedia.org', 'zu.wikipedia.org', 'de.wikipedia.org', 'pl.wikipedia.org', 'ja.
     wikipedia.org', 'zh.wikipedia.org', 'ru.wikipedia.org', 'eo.wikipedia.org', 'vi.
     wikipedia.org', |  | 
|   37   // From http://www.google.com/supported_domains |  | 
|   38   'google.com', 'google.ad', 'google.ae', 'google.com.af', 'google.com.ag', 'goo
     gle.com.ai', 'google.am', 'google.co.ao', 'google.com.ar', 'google.as', 'google.
     at', 'google.com.au', 'google.az', 'google.ba', 'google.com.bd', 'google.be', 'g
     oogle.bf', 'google.bg', 'google.com.bh', 'google.bi', 'google.bj', 'google.com.b
     n', 'google.com.bo', 'google.com.br', 'google.bs', 'google.co.bw', 'google.by', 
     'google.com.bz', 'google.ca', 'google.cd', 'google.cf', 'google.cg', 'google.ch'
     , 'google.ci', 'google.co.ck', 'google.cl', 'google.cm', 'google.cn', 'google.co
     m.co', 'google.co.cr', 'google.com.cu', 'google.cv', 'google.com.cy', 'google.cz
     ', 'google.de', 'google.dj', 'google.dk', 'google.dm', 'google.com.do', 'google.
     dz', 'google.com.ec', 'google.ee', 'google.com.eg', 'google.es', 'google.com.et'
     , 'google.fi', 'google.com.fj', 'google.fm', 'google.fr', 'google.ga', 'google.g
     e', 'google.gg', 'google.com.gh', 'google.com.gi', 'google.gl', 'google.gm', 'go
     ogle.gp', 'google.gr', 'google.com.gt', 'google.gy', 'google.com.hk', 'google.hn
     ', 'google.hr', 'google.ht', 'google.hu', 'google.co.id', 'google.ie', 'google.c
     o.il', 'google.im', 'google.co.in', 'google.iq', 'google.is', 'google.it', 'goog
     le.je', 'google.com.jm', 'google.jo', 'google.co.jp', 'google.co.ke', 'google.co
     m.kh', 'google.ki', 'google.kg', 'google.co.kr', 'google.com.kw', 'google.kz', '
     google.la', 'google.com.lb', 'google.li', 'google.lk', 'google.co.ls', 'google.l
     t', 'google.lu', 'google.lv', 'google.com.ly', 'google.co.ma', 'google.md', 'goo
     gle.me', 'google.mg', 'google.mk', 'google.ml', 'google.mn', 'google.ms', 'googl
     e.com.mt', 'google.mu', 'google.mv', 'google.mw', 'google.com.mx', 'google.com.m
     y', 'google.co.mz', 'google.com.na', 'google.com.nf', 'google.com.ng', 'google.c
     om.ni', 'google.ne', 'google.nl', 'google.no', 'google.com.np', 'google.nr', 'go
     ogle.nu', 'google.co.nz', 'google.com.om', 'google.com.pa', 'google.com.pe', 'go
     ogle.com.ph', 'google.com.pk', 'google.pl', 'google.pn', 'google.com.pr', 'googl
     e.ps', 'google.pt', 'google.com.py', 'google.com.qa', 'google.ro', 'google.ru', 
     'google.rw', 'google.com.sa', 'google.com.sb', 'google.sc', 'google.se', 'google
     .com.sg', 'google.sh', 'google.si', 'google.sk', 'google.com.sl', 'google.sn', '
     google.so', 'google.sm', 'google.st', 'google.com.sv', 'google.td', 'google.tg',
      'google.co.th', 'google.com.tj', 'google.tk', 'google.tl', 'google.tm', 'google
     .tn', 'google.to', 'google.com.tr', 'google.tt', 'google.com.tw', 'google.co.tz'
     , 'google.com.ua', 'google.co.ug', 'google.co.uk', 'google.com.uy', 'google.co.u
     z', 'google.com.vc', 'google.co.ve', 'google.vg', 'google.co.vi', 'google.com.vn
     ', 'google.vu', 'google.ws', 'google.rs', 'google.co.za', 'google.co.zm', 'googl
     e.co.zw', 'google.cat', |  | 
|   39   // From http://www.ebay.ch/ (eBay-Websites) |  | 
|   40   'mercadolibre.com.ar', 'ebay.com.au', 'ebay.at', 'ebay.be', 'mercadolivre.com.
     br', 'ebay.com.cn', 'ebay.dk', 'ebay.de', 'ebay.fr', 'ebay.gr', 'ebay.co.uk', 'e
     bay.com.hk', 'ebay.in', 'ebay.ie', 'ebay.it', 'ebay.ca', 'auction.co.kr', 'ebay.
     com.my', 'mercadolibre.com.mx', 'pages.ebay.com', 'ebay.nl', 'ebay.no', 'ebay.ph
     ', 'ebay.pl', 'ebay.ru', 'ebay.se', 'ebay.com.sg', 'ebay.es', 'ruten.com.tw', 'e
     bay.co.th', 'gittigidiyor.com', 'ebay.cz', 'ebay.com', 'ebay.vn', |  | 
|   41   // From http://www.amazon.com/ (footer) |  | 
|   42   'amazon.ca', 'amazon.cn', 'amazon.fr', 'amazon.de', 'amazon.it', 'amazon.co.jp
     ', 'amazon.es', 'amazon.co.uk', |  | 
|   43  |  | 
|   44   // From http://en.wikipedia.org/wiki/.gov#States_in_GOV |  | 
|   45   'al.gov', 'alabama.gov', |  | 
|   46   'alaska.gov', |  | 
|   47   'az.gov', |  | 
|   48   'ar.gov', 'arkansas.gov', |  | 
|   49   'ca.gov', 'california.gov', |  | 
|   50   'colorado.gov', |  | 
|   51   'ct.gov', |  | 
|   52   'delaware.gov', |  | 
|   53   'florida.gov', 'fl.gov', |  | 
|   54   'georgia.gov', 'ga.gov', |  | 
|   55   'guam.gov', |  | 
|   56   'hawaii.gov', |  | 
|   57   'idaho.gov', |  | 
|   58   'illinois.gov', |  | 
|   59   'in.gov', |  | 
|   60   'iowa.gov', 'ia.gov', |  | 
|   61   'ks.gov', 'kansas.gov', |  | 
|   62   'ky.gov', 'kentucky.gov', |  | 
|   63   'louisiana.gov', |  | 
|   64   'maine.gov', |  | 
|   65   'maryland.gov', |  | 
|   66   'mass.gov', |  | 
|   67   'michigan.gov', |  | 
|   68   'mn.gov', |  | 
|   69   'mississippi.gov', |  | 
|   70   'mo.gov', |  | 
|   71   'mt.gov', 'montana.gov', |  | 
|   72   'nebraska.gov', |  | 
|   73   'nv.gov', |  | 
|   74   'nh.gov', 'visitnh.gov', |  | 
|   75   'nj.gov', 'newjersey.gov', |  | 
|   76   'newmexico.gov', |  | 
|   77   'ny.gov', |  | 
|   78   'nc.gov', 'northcarolina.gov', |  | 
|   79   'nd.gov', |  | 
|   80   'ohio.gov', 'oh.gov', |  | 
|   81   'ok.gov', |  | 
|   82   'oregon.gov', |  | 
|   83   'pa.gov', 'pennsylvania.gov', |  | 
|   84   'pr.gov', |  | 
|   85   'ri.gov', |  | 
|   86   'sc.gov', |  | 
|   87   'sd.gov', |  | 
|   88   'tennessee.gov', 'tn.gov', |  | 
|   89   'texas.gov', |  | 
|   90   'utah.gov', |  | 
|   91   'vermont.gov', |  | 
|   92   'virginia.gov', |  | 
|   93   'wa.gov', 'washington.gov', |  | 
|   94   'wv.gov', |  | 
|   95   'wisconsin.gov', |  | 
|   96   'wyoming.gov', |  | 
|   97   'dc.gov' |  | 
|   98 ]; |  | 
|   99  |  | 
|  100 var additionalTLDs = [ |  | 
|  101   // From http://en.wikipedia.org/wiki/.ar |  | 
|  102   'com.ar', 'edu.ar', 'gob.ar', 'gov.ar', 'int.ar', 'mil.ar', 'net.ar', 'org.ar'
     , 'tur.ar', |  | 
|  103  |  | 
|  104   // From http://en.wikipedia.org/wiki/.au |  | 
|  105   'com.au', 'net.au', 'org.au', 'edu.au', 'gov.au', 'csiro.au', 'asn.au', 'id.au
     ', |  | 
|  106  |  | 
|  107   // From http://en.wikipedia.org/wiki/.bd |  | 
|  108   'com.bd', 'edu.bd', 'ac.bd', 'net.bd', 'gov.bd', 'org.bd', 'mil.bd', |  | 
|  109  |  | 
|  110   // From http://en.wikipedia.org/wiki/.bn |  | 
|  111   'com.bn', 'edu.bn', 'gov.bn', 'net.bn', 'org.bn', |  | 
|  112  |  | 
|  113   // From http://en.wikipedia.org/wiki/.ck |  | 
|  114   'co.ck', 'org.ck', 'edu.ck', 'gov.ck', 'net.ck', 'gen.ck', 'biz.ck', 'info.ck'
     , |  | 
|  115  |  | 
|  116   // From http://en.wikipedia.org/wiki/.cy |  | 
|  117   'ac.cy', 'net.cy', 'gov.cy', 'org.cy', 'pro.cy', 'name.cy', 'ekloges.cy', |  | 
|  118   'tm.cy', 'ltd.cy', 'biz.cy', 'press.cy', 'parliament.cy', 'com.cy', |  | 
|  119  |  | 
|  120   // From http://en.wikipedia.org/wiki/.er |  | 
|  121   'com.er', 'edu.er', 'gov.er', 'mil.er', 'net.er', 'org.er', 'ind.er', |  | 
|  122  |  | 
|  123   // From http://en.wikipedia.org/wiki/.et |  | 
|  124   'com.et', 'gov.et', 'org.et', 'edu.et', 'net.et', 'biz.et', 'name.et', 'info.e
     t', |  | 
|  125  |  | 
|  126   // From http://en.wikipedia.org/wiki/.fj |  | 
|  127   'ac.fj', 'biz.fj', 'com.fj', 'info.fj', 'mil.fj', 'name.fj', 'net.fj', 'org.fj
     ', 'pro.fj', |  | 
|  128  |  | 
|  129   // From http://en.wikipedia.org/wiki/.fk |  | 
|  130   'co.fk', 'org.fk', 'gov.fk', 'ac.fk', 'nom.fk', 'net.fk', |  | 
|  131  |  | 
|  132   // From http://en.wikipedia.org/wiki/.gt |  | 
|  133   'com.gt', 'edu.gt', 'net.gt', 'gob.gt', 'org.gt', 'mil.gt', 'ind.gt', |  | 
|  134  |  | 
|  135   // From http://en.wikipedia.org/wiki/.gu |  | 
|  136   'com.gu', 'net.gu', 'gov.gu', 'org.gu', 'edu.gu', |  | 
|  137  |  | 
|  138   // From http://en.wikipedia.org/wiki/.il |  | 
|  139   'ac.il', 'co.il', 'org.il', 'net.il', 'k12.il', 'gov.il', 'muni.il', 'idf.il', |  | 
|  140  |  | 
|  141   // From http://en.wikipedia.org/wiki/.jm |  | 
|  142   'com.jm', 'net.jm', 'org.jm', 'edu.jm', 'gov.jm', 'mil.jm', |  | 
|  143  |  | 
|  144   // From http://en.wikipedia.org/wiki/.ke |  | 
|  145   'co.ke', 'or.ke', 'ne.ke', 'go.ke', 'ac.ke', 'sc.ke', 'me.ke', 'mobi.ke', 'inf
     o.ke', |  | 
|  146  |  | 
|  147   // From http://en.wikipedia.org/wiki/.kh |  | 
|  148   'per.kh', 'com.kh', 'edu.kh', 'gov.kh', 'mil.kh', 'net.kh', 'org.kh', |  | 
|  149  |  | 
|  150   // From http://en.wikipedia.org/wiki/.kw |  | 
|  151   'edu.kw', 'com.kw', 'net.kw', 'org.kw', 'gov.kw', |  | 
|  152  |  | 
|  153   // From http://en.wikipedia.org/wiki/.mm |  | 
|  154   'net.mm', 'com.mm', 'edu.mm', 'org.mm', 'gov.mm', |  | 
|  155  |  | 
|  156   // From http://en.wikipedia.org/wiki/.mt |  | 
|  157   'com.mt', 'org.mt', 'net.mt', 'edu.mt', 'gov.mt', |  | 
|  158  |  | 
|  159   // From http://en.wikipedia.org/wiki/.mz |  | 
|  160   'adv.mz', 'ac.mz', 'co.mz', 'org.mz', 'gov.mz', 'edu.mz', |  | 
|  161  |  | 
|  162   // From http://en.wikipedia.org/wiki/.ni |  | 
|  163   'gob.ni', 'co.ni', 'com.ni', 'ac.ni', 'edu.ni', 'org.ni', 'nom.ni', 'net.ni', 
     'mil.ni', |  | 
|  164  |  | 
|  165   // From http://en.wikipedia.org/wiki/.np |  | 
|  166   'com.np', 'edu.np', 'gov.np', 'mil.np', 'net.np', 'org.np', |  | 
|  167  |  | 
|  168   // From http://en.wikipedia.org/wiki/.nz |  | 
|  169   'ac.nz', 'co.nz', 'geek.nz', 'gen.nz', 'maori.nz', 'net.nz', 'org.nz', 'school
     .nz', |  | 
|  170   'cri.nz', 'govt.nz', 'iwi.nz', 'parliament.nz', 'mil.nz', 'health.nz', |  | 
|  171  |  | 
|  172   // From http://en.wikipedia.org/wiki/.om |  | 
|  173   'com.om', 'co.om', 'edu.om', 'ac.om', 'sch.om', 'gov.om', 'net.om', 'org.om', |  | 
|  174   'mil.om', 'museum.om', 'biz.om', 'pro.om', 'med.om', |  | 
|  175  |  | 
|  176   // From http://en.wikipedia.org/wiki/.pg |  | 
|  177   'com.pg', 'net.pg', 'ac.pg', 'gov.pg', 'mil.pg', 'org.pg', |  | 
|  178  |  | 
|  179   // From http://en.wikipedia.org/wiki/.py |  | 
|  180   'org.py', 'edu.py', 'mil.py', 'gov.py', 'net.py', 'com.py', 'coop.py', |  | 
|  181  |  | 
|  182   // From http://en.wikipedia.org/wiki/.qa |  | 
|  183   'com.qa', 'net.qa', 'org.qa', 'gov.qa', 'edu.qa', 'mil.qa', 'name.qa', 'sch.qa
     ', |  | 
|  184  |  | 
|  185   // From http://en.wikipedia.org/wiki/.sv |  | 
|  186   'edu.sv', 'gob.sv', 'com.sv', 'org.sv', 'red.sv', |  | 
|  187  |  | 
|  188   // From http://en.wikipedia.org/wiki/.tr |  | 
|  189   'com.tr', 'gen.tr', 'org.tr', 'biz.tr', 'info.tr', 'av.tr', 'dr.tr', 'pol.tr', |  | 
|  190   'bel.tr', 'tsk.tr', 'bbs.tr', 'k12.tr', 'edu.tr', 'name.tr', 'net.tr', 'gov.tr
     ', |  | 
|  191   'web.tr', 'tel.tr', 'tv.tr', 'nc.tr', |  | 
|  192  |  | 
|  193   // From http://en.wikipedia.org/wiki/.uk |  | 
|  194   'ac.uk', 'co.uk', 'gov.uk', 'judiciary.uk', 'ltd.uk', 'me.uk', 'mod.uk', 'net.
     uk', |  | 
|  195   'nhs.uk', 'nic.uk', 'org.uk',  'parliament.uk', 'plc.uk', 'police.uk', 'sch.uk
     ', |  | 
|  196  |  | 
|  197   // From http://en.wikipedia.org/wiki/.uy |  | 
|  198   'com.uy', 'edu.uy', 'gub.uy', 'net.uy', 'mil.uy', 'org.uy', |  | 
|  199  |  | 
|  200   // From http://en.wikipedia.org/wiki/.ve |  | 
|  201   'com.ve', 'net.ve', 'org.ve', 'info.ve', 'co.ve', 'web.ve', 'gob.ve', 'edu.ve'
     , 'mil.ve', 'tec.ve', |  | 
|  202  |  | 
|  203   // From http://en.wikipedia.org/wiki/.ye |  | 
|  204   'com.ye', 'co.ye', 'ltd.ye', 'me.ye', 'net.ye', 'org.ye', 'plc.ye', 'gov.ye', |  | 
|  205  |  | 
|  206   // From http://en.wikipedia.org/wiki/.za |  | 
|  207   'ac.za', 'city.za', 'co.za', 'edu.za', 'gov.za', 'law.za', 'mil.za', 'nom.za',
      'org.za', 'school.za', |  | 
|  208   'alt.za', 'net.work.za', 'ngo.za', 'tm.za', 'web.za', 'bourse.za', |  | 
|  209   'agric.za', 'cybernet.za', 'grondar.za', 'iaccess.za', 'inca.za', 'nis.za', 'o
     livetti.za', 'pix.za', |  | 
|  210  |  | 
|  211   // From http://en.wikipedia.org/wiki/.zm |  | 
|  212   'ac.zm', 'co.zm', 'com.zm', 'edu.zm', 'gov.zm', 'net.zm', 'org.zm', 'sch.zm', |  | 
|  213  |  | 
|  214   // From http://en.wikipedia.org/wiki/.zw |  | 
|  215   'co.zw', 'ac.zw', 'org.zw' |  | 
|  216 ]; |  | 
|  217  |  | 
|  218 function getSuffixes(target, items) |  | 
|  219 { |  | 
|  220   var suffixes = {}; |  | 
|  221  |  | 
|  222   for(var item in items) |  | 
|  223   { |  | 
|  224     var suffix = item[item.length-1] || ""; |  | 
|  225  |  | 
|  226     if(typeof(suffixes[suffix])=="undefined") |  | 
|  227     { |  | 
|  228       suffixes[suffix] = {}; |  | 
|  229     } |  | 
|  230     suffixes[suffix][item.substr(0,item.length-1)] = items[item]; |  | 
|  231   } |  | 
|  232  |  | 
|  233   for(var suffix in suffixes) |  | 
|  234   { |  | 
|  235     var first; |  | 
|  236     var cnt = 0; |  | 
|  237     for(var i in suffixes[suffix]) |  | 
|  238     { |  | 
|  239       first = i; |  | 
|  240       cnt++; |  | 
|  241     } |  | 
|  242  |  | 
|  243     if(cnt==1) |  | 
|  244     { |  | 
|  245       target[suffix] = (first && first.match(/./g).reverse().join("") || "") |  | 
|  246         + " " + suffixes[suffix][first]; |  | 
|  247     } |  | 
|  248     else |  | 
|  249     { |  | 
|  250       target[suffix] = {}; |  | 
|  251       getSuffixes(target[suffix], suffixes[suffix]); |  | 
|  252     } |  | 
|  253   } |  | 
|  254 } |  | 
|  255  |  | 
|  256 function urlopen(url, attempts) |  | 
|  257 { |  | 
|  258         if(typeof(attempts)=="undefined") |  | 
|  259                 attempts = 3; |  | 
|  260  |  | 
|  261         //Tries to open a particular URL, retries on failure. |  | 
|  262   let request; |  | 
|  263   for(var i=0; i<attempts; i++) |  | 
|  264   { |  | 
|  265     try |  | 
|  266     { |  | 
|  267       request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.
     nsIXMLHttpRequest); |  | 
|  268       request.open("GET", url, false); |  | 
|  269       request.overrideMimeType("text/plain"); |  | 
|  270       request.send(null); |  | 
|  271       if(request.responseText) |  | 
|  272       { |  | 
|  273         break; |  | 
|  274       } |  | 
|  275     } |  | 
|  276     catch(e) |  | 
|  277     { |  | 
|  278       if(e.result != Cr.NS_ERROR_FILE_NOT_FOUND) |  | 
|  279         Cu.reportError(e); |  | 
|  280     } |  | 
|  281   } |  | 
|  282  |  | 
|  283   if(!request.responseText) |  | 
|  284   { |  | 
|  285     throw new Error("could not open URL: "+url); |  | 
|  286   } |  | 
|  287  |  | 
|  288   return request.responseText; |  | 
|  289 } |  | 
|  290  |  | 
|  291 function loadTLDs() |  | 
|  292 { |  | 
|  293         var url = 'http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/eff
     ective_tld_names.dat?raw=1'; |  | 
|  294         var resource = urlopen(url).split(/\n/); |  | 
|  295         additionalTLDs = additionalTLDs.concat(resource); |  | 
|  296 } |  | 
|  297  |  | 
|  298 var tlditer = 0; |  | 
|  299 function iterateTLDs() |  | 
|  300 { |  | 
|  301         for(var len=additionalTLDs.length; tlditer<len; tlditer++) |  | 
|  302         { |  | 
|  303                 tlditer++; |  | 
|  304  |  | 
|  305                 var line = additionalTLDs[tlditer]; |  | 
|  306                 line = line.trim(); |  | 
|  307  |  | 
|  308                 if(line.indexOf("//")==0) |  | 
|  309                         continue; |  | 
|  310  |  | 
|  311                 if(line.indexOf("*.")==0) |  | 
|  312                         tld = line.substr(2); |  | 
|  313                 else if(line.indexOf("!")==0) |  | 
|  314                         tld = line.substr(1); |  | 
|  315                 else tld = line; |  | 
|  316  |  | 
|  317                 return tld; |  | 
|  318         } |  | 
|  319 } |  | 
|  320  |  | 
|  321 function getTLDs(domains, tldPriority) |  | 
|  322 { |  | 
|  323         var tld; |  | 
|  324         while(tld = iterateTLDs()) |  | 
|  325         { |  | 
|  326                 if(typeof(domains[tld]) == "undefined") |  | 
|  327                         domains[tld] = tldPriority; |  | 
|  328         } |  | 
|  329 } |  | 
|  330  |  | 
|  331 function updateSchemes(rules) |  | 
|  332 { |  | 
|  333         rules["scheme"] = {}; |  | 
|  334         getSuffixes(rules["scheme"], schemes); |  | 
|  335 } |  | 
|  336  |  | 
|  337 function updateDomains(rules) |  | 
|  338 { |  | 
|  339         var domains = {}; |  | 
|  340         //var reader = null ...sys.stdin |  | 
|  341  |  | 
|  342   for(var i=0, len=additionalDomains.length; i<len; i++) |  | 
|  343   { |  | 
|  344     var domain = additionalDomains[i].trim(); |  | 
|  345     if(!domain || typeof(domains[domain])!="undefined") |  | 
|  346     { |  | 
|  347       continue; |  | 
|  348     } |  | 
|  349     domains[domain] = i; |  | 
|  350   } |  | 
|  351  |  | 
|  352   var maxPriority = i; |  | 
|  353   for(var domain in domains) |  | 
|  354   { |  | 
|  355     domains[domain] = maxPriority - domains[domain]; |  | 
|  356   } |  | 
|  357  |  | 
|  358   var regexp = /^[^.]+\.+/; |  | 
|  359   var priority; |  | 
|  360   for(var domain in domains) |  | 
|  361   { |  | 
|  362     while(true) |  | 
|  363     { |  | 
|  364       if(!regexp.test(domain)) |  | 
|  365       { |  | 
|  366         break; |  | 
|  367       } |  | 
|  368       priority = domains[domain]; |  | 
|  369       domain = domain.replace(regexp, ""); |  | 
|  370       if(!domain) |  | 
|  371       { |  | 
|  372         break; |  | 
|  373       } |  | 
|  374       if(typeof(domains[domain])=="undefined" || domains[domain] < priority - ma
     xPriority) |  | 
|  375       { |  | 
|  376         domains[domain] = priority - maxPriority; |  | 
|  377       } |  | 
|  378     } |  | 
|  379   } |  | 
|  380  |  | 
|  381   // Fill up with "official" TLDs |  | 
|  382   getTLDs(domains, -maxPriority); |  | 
|  383  |  | 
|  384   rules["domain"] = {}; |  | 
|  385   getSuffixes(rules["domain"], domains); |  | 
|  386 } |  | 
|  387  |  | 
|  388 exports.updateRules = updateRules; |  | 
|  389 function updateRules() |  | 
|  390 { |  | 
|  391   loadTLDs(); |  | 
|  392  |  | 
|  393         var rules = {}; |  | 
|  394         rules["domainReferrals"] = domainReferrals; |  | 
|  395         updateSchemes(rules); |  | 
|  396         updateDomains(rules); |  | 
|  397          |  | 
|  398   return rules; |  | 
|  399 } |  | 
| OLD | NEW |