This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
donottrack-min.js
1 lines (1 loc) · 4.79 KB
/
donottrack-min.js
1
function aop_around(a,b){aop.around({target:a,method:b},function(a){if(typeof a.arguments[0].src==="string"&&(a.arguments[0].tagName.toLowerCase()==="script"||a.arguments[0].tagName.toLowerCase()==="img"||a.arguments[0].tagName.toLowerCase()==="iframe")&&a.arguments[0].src!=="javascript:void(0)"){if(sanitizer(a.arguments[0].src)===true){a.arguments[0].src="javascript:void(0)"}}return a.proceed()})}function sanitizer(a){var b=new RegExp("(?:f|ht)tp(?:s)?://([^/]+)","im");try{a=a.match(b)[1].toString()}catch(c){return a}if(mode==="blacklist"){for(x in list["black"]){if(typeof list["black"][x]==="string"){if(a.indexOf(list["black"][x].toLowerCase())!==-1){a=true;break}}}}else{for(x in list["white"]){if(typeof list["white"][x]==="string"){if(a.indexOf(list["white"][x].toLowerCase())!==-1){tmpS=false;break}else{tmpS=true}}}if(tmpS===true)a=tmpS}return a}(function(){var _after=1;var _afterThrow=2;var _afterFinally=3;var _before=4;var _around=5;var _intro=6;var _regexEnabled=true;var _arguments="arguments";var _undef="undefined";var getType=function(){var a=Object.prototype.toString,b={},c={1:"element",3:"textnode",9:"document",11:"fragment"},d="Arguments Array Boolean Date Document Element Error Fragment Function NodeList Null Number Object RegExp String TextNode Undefined Window".split(" ");for(var e=d.length;e--;){var f=d[e],g=window[f];if(g){try{b[a.call(new g)]=f.toLowerCase()}catch(h){}}}return function(d){return d==null&&(d===undefined?_undef:"null")||d.nodeType&&c[d.nodeType]||typeof d.length=="number"&&(d.callee&&_arguments||d.alert&&"window"||d.item&&"nodelist")||b[a.call(d)]}}();var isFunc=function(a){return getType(a)=="function"};var weaveOne=function(source,method,advice){var old=source[method];if(advice.type!=_intro&&!isFunc(old)){var oldObject=old;old=function(){var code=arguments.length>0?_arguments+"[0]":"";for(var i=1;i<arguments.length;i++){code+=","+_arguments+"["+i+"]"}return eval("oldObject("+code+");")}}var aspect;if(advice.type==_after||advice.type==_afterThrow||advice.type==_afterFinally)aspect=function(){var a,b=null;try{a=old.apply(this,arguments)}catch(c){b=c}if(advice.type==_after)if(b==null)a=advice.value.apply(this,[a,method]);else throw b;else if(advice.type==_afterThrow&&b!=null)a=advice.value.apply(this,[b,method]);else if(advice.type==_afterFinally)a=advice.value.apply(this,[a,b,method]);return a};else if(advice.type==_before)aspect=function(){advice.value.apply(this,[arguments,method]);return old.apply(this,arguments)};else if(advice.type==_intro)aspect=function(){return advice.value.apply(this,arguments)};else if(advice.type==_around){aspect=function(){var a={object:this,args:Array.prototype.slice.call(arguments)};return advice.value.apply(a.object,[{arguments:a.args,method:method,proceed:function(){return old.apply(a.object,a.args)}}])}}aspect.unweave=function(){source[method]=old;pointcut=source=aspect=old=null};source[method]=aspect;return aspect};var search=function(a,b,c){var d=[];for(var e in a){var f=null;try{f=a[e]}catch(g){}if(f!=null&&e.match(b.method)&&isFunc(f))d[d.length]={source:a,method:e,advice:c}}return d};var weave=function(a,b){var c=typeof a.target.prototype!=_undef?a.target.prototype:a.target;var d=[];if(b.type!=_intro&&typeof c[a.method]==_undef){var e=search(a.target,a,b);if(e.length==0)e=search(c,a,b);for(var f in e)d[d.length]=weaveOne(e[f].source,e[f].method,e[f].advice)}else{d[0]=weaveOne(c,a.method,b)}return _regexEnabled?d:d[0]};aop={after:function(a,b){return weave(a,{type:_after,value:b})},afterThrow:function(a,b){return weave(a,{type:_afterThrow,value:b})},afterFinally:function(a,b){return weave(a,{type:_afterFinally,value:b})},before:function(a,b){return weave(a,{type:_before,value:b})},around:function(a,b){return weave(a,{type:_around,value:b})},introduction:function(a,b){return weave(a,{type:_intro,value:b})},setup:function(a){_regexEnabled=a.regexMatch}}})();if(dnt_config.ifdnt!=="1"||navigator.doNotTrack==="yes"||navigator.msDoNotTrack==="1"||navigator.doNotTrack==="1"||document.cookie.indexOf("dont_track_me=1")!==-1||document.cookie.indexOf("civicAllowCookies=no")!==-1){var mode=dnt_config.mode;var list=[];list["black"]=dnt_config.black;list["white"]=dnt_config.white;aop.around({target:document,method:"write"},function(a){if(a.arguments[0].search(/img|script|iframe/i)!==-1){if(sanitizer(a.arguments[0])===true){a.arguments[0]=a.arguments[0].replace(/</g,"<!-- ").replace(/>/g," -->")}}return a.proceed()});scriptParent=document.getElementsByTagName("script")[0].parentNode;if(scriptParent.tagName.toLowerCase!=="head"){head=document.getElementsByTagName("head")[0];aop_around(head,"insertBefore");aop_around(head,"appendChild")}aop_around(scriptParent,"insertBefore");aop_around(scriptParent,"appendChild");var a2a_config=a2a_config||{};a2a_config.no_3p=1;var addthis_config={data_use_cookies:false};var _gaq=_gaq||[];_gaq.push(["_gat._anonymizeIp"])}