reekside

aranzulla.it

Jun 23rd, 2016
1,484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.88 KB | None | 0 0
  1.  
  2. var abCheck = {
  3. is_mobile : false,
  4. scriptNotLoaded : null,
  5. completed : false,
  6. redirect_params : '?p=%pid%',
  7. base_url : '/',
  8. script_url : '',
  9. iframe_url : '//pagead2.googlesyndication.com',
  10. img_url : '//googleads.g.doubleclick.net',
  11. iframe_class : '',
  12. img_class : '',
  13. chrome_url : 'locked-chrome.html',
  14. firefox_url : 'locked-firefox.html',
  15. opera_url : 'locked-opera.html',
  16. safari_url : 'locked-safari.html',
  17. ie_url : 'locked-ie.html',
  18. default_url : '',
  19. DEBUG : (location.search.indexOf('debug_ab=true') >= 0 || location.hash.indexOf('debug_ab') >= 0),
  20. NORDR : (location.search.indexOf('nordr=true') >= 0 || location.hash.indexOf('nordr') >= 0),
  21. ID1 : 'abt1',
  22. ID2 : 'abt2',
  23. ID3 : 'abt3',
  24. log : function (fab) {
  25. if (console && console.log) {
  26. console.log('fab=' + fab);
  27. }
  28. if (typeof ga != 'undefined') {
  29. if (abCheck.is_mobile) {
  30. ga('send', 'event', 'fab', (fab == '0' ? 'assente' : 'presente'), {
  31. nonInteraction : true
  32. });
  33. } else if (fab == '0') {
  34. if (cookieMan.checkCookie(cookieMan.cookieName)) {
  35. ga('send', 'event', 'fab', 'disabilitato', {
  36. nonInteraction : true
  37. });
  38. cookieMan.deleteCookie(cookieMan.cookieName);
  39. } else {
  40. ga('send', 'event', 'fab', 'assente', {
  41. nonInteraction : true
  42. });
  43. }
  44. }
  45. }
  46. },
  47. remove : function (id) {
  48. var e = document.getElementById(id);
  49. if (e) {
  50. e.parentElement.removeChild(e);
  51. }
  52. },
  53. abCompleted : function () {
  54. abCheck.completed = true;
  55. if (!abCheck.DEBUG) {
  56. abCheck.remove(abCheck.ID1);
  57. abCheck.remove(abCheck.ID2);
  58. abCheck.remove(abCheck.ID3);
  59. }
  60. },
  61. abnDetected : function () {
  62. abCheck.log('0');
  63. abCheck.abCompleted();
  64. },
  65. abDetected : function (source) {
  66. abCheck.log('1-' + source);
  67. abCheck.abCompleted();
  68. if (abCheck.is_mobile)
  69. return;
  70. var isOpera = false;
  71. try {
  72. isOpera = (!!opr && !!opr.addons) || !!opera || navigator.userAgent.indexOf(' OPR/') >= 0;
  73. } catch (e) {}
  74.  
  75. var isFirefox = typeof InstallTrigger !== 'undefined';
  76. var isSafari = false;
  77. try {
  78. isSafari = Object.prototype.toString.call(HTMLElement).indexOf('Constructor') > 0;
  79. } catch (e) {}
  80.  
  81. var isIE = false;
  82. try {
  83. isIE = /*@cc_on!@*/
  84. false || !!document.documentMode;
  85. } catch (e) {}
  86.  
  87. var isEdge = false;
  88. try {
  89. isEdge = !isIE && !!StyleMedia;
  90. } catch (e) {}
  91.  
  92. var isChrome = false;
  93. try {
  94. isChrome = !!chrome && !!chrome.webstore;
  95. } catch (e) {}
  96.  
  97. var s = abCheck.default_url;
  98. if (isOpera) {
  99. s = abCheck.opera_url;
  100. } else if (isFirefox) {
  101. s = abCheck.firefox_url;
  102. } else if (isSafari) {
  103. s = abCheck.safari_url;
  104. } else if (isIE) {
  105. s = abCheck.ie_url;
  106. } else if (s == '' || isChrome) {
  107. s = abCheck.chrome_url;
  108. }
  109. var rurl = abCheck.base_url + s;
  110. if (fabConf.pid != '') {
  111. rurl += abCheck.redirect_params.replace('%pid%', fabConf.pid);
  112. }
  113. if (abCheck.DEBUG) {
  114. if (rurl.indexOf('?') < 0) {
  115. rurl += '?';
  116. }
  117. rurl += '&debug_ab=true';
  118. }
  119. if (rurl.indexOf('?') < 0) {
  120. rurl += '?';
  121. }
  122. rurl += '&fabm=' + source + '&rnd=' + Math.random();
  123. if (abCheck.NORDR) {
  124. console.log("document.location = '" + rurl + "'");
  125. } else {
  126. document.location = rurl;
  127. }
  128. },
  129. adblockblock : function (source) {
  130. abCheck.abDetected(source);
  131. },
  132. check : function (e) {
  133. if (e) {
  134. if (e.style && (e.style.display == 'none' || e.style.visibility == 'hidden')) {
  135. return true;
  136. }
  137. if (window.getComputedStyle !== undefined) {
  138. var cs = window.getComputedStyle(e, null);
  139. if (cs) {
  140. if ((cs.getPropertyValue('display') == 'none' || cs.getPropertyValue('visibility') == 'hidden')) {
  141. return true;
  142. }
  143. var mb = cs.getPropertyValue('-moz-binding');
  144. if (mb && (s = mb.toString()) != '' && (s.indexOf('abp-elemhidehit') >= 0 || s.indexOf('#foobarbazdummy') >= 0)) {
  145. return true;
  146. }
  147. }
  148. }
  149. return false;
  150. }
  151. return true;
  152. },
  153. loadScript : function () {
  154. if (abCheck.script_url == '')
  155. return;
  156. var s = document.createElement('script');
  157. s.type = 'text/javascript';
  158. s.async = true;
  159. s.src = abCheck.script_url;
  160. abCheck.ID3 = abCheck.rid();
  161. s.setAttribute('id', abCheck.ID3);
  162. var _load = function () {
  163. abCheck.scriptNotLoaded = false;
  164. };
  165. var _error = function () {
  166. abCheck.scriptNotLoaded = true;
  167. };
  168. if (typeof s.onload != "undefined") {
  169. s.onload = _load;
  170. } else if (s.readyState) {
  171. s.onreadystatechange = function () {
  172. if (s.readyState === "complete" || s.readyState === "loaded") {
  173. _load();
  174. }
  175. }
  176. } else {
  177. return;
  178. }
  179. if (typeof s.onerror != "undefined") {
  180. s.onerror = _error;
  181. } else {
  182. return;
  183. }
  184. var e = document.getElementsByTagName('head');
  185. e = e && e.length ? e : document.getElementsByTagName('body');
  186. if (e && e.length) {
  187. e = e[0];
  188. e.insertBefore(s, e.firstChild);
  189. }
  190. },
  191. adblocktest : function (testnumber) {
  192. if (abCheck.scriptNotLoaded != null && abCheck.scriptNotLoaded) {
  193. abCheck.adblockblock('m3');
  194. return;
  195. }
  196. if (typeof testnumber == 'undefined') {
  197. testnumber = 0;
  198. }
  199. var e1 = document.getElementById(abCheck.ID1);
  200. var e2 = document.getElementById(abCheck.ID2);
  201. if (abCheck.check(e1)) {
  202. abCheck.adblockblock('m1');
  203. } else if (abCheck.check(e2)) {
  204. abCheck.adblockblock('m2');
  205. } else if (testnumber == 0) {
  206. setTimeout(function () {
  207. abCheck.adblocktest(1);
  208. }, 5000);
  209. } else {
  210. abCheck.abnDetected();
  211. }
  212. },
  213. rid : function () {
  214. var r = "";
  215. var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  216. var len = Math.floor(Math.random() * 16) + 10;
  217. for (var i = 0; i < len; i++) {
  218. r += possible.charAt(Math.floor(Math.random() * possible.length));
  219. }
  220. if (document.getElementById('r')) {
  221. return abCheck.rid();
  222. }
  223. return r;
  224. },
  225. load : function (n) {
  226. if (typeof n == 'undefined') {
  227. n = 0;
  228. }
  229. var b = document.getElementsByTagName('body');
  230. if (!b) {
  231. if (n < 10) {
  232. setTimeout(function () {
  233. abCheck.load(n + 1);
  234. }, 1000);
  235. return;
  236. } else {
  237. b = document.body;
  238. }
  239. } else {
  240. b = b[0];
  241. }
  242. abCheck.ID1 = abCheck.rid();
  243. var e1 = document.createElement('iframe');
  244. e1.setAttribute('src', abCheck.iframe_url);
  245. e1.setAttribute('frameborder', '0');
  246. e1.setAttribute('width', '1');
  247. e1.setAttribute('height', '1');
  248. e1.setAttribute('id', abCheck.ID1);
  249. if (abCheck.iframe_class != '') {
  250. e1.setAttribute('class', abCheck.iframe_class);
  251. }
  252. b.insertBefore(e1, b.lastChild);
  253. abCheck.ID2 = abCheck.rid();
  254. var e2 = document.createElement('img');
  255. e2.setAttribute('src', abCheck.img_url);
  256. e2.setAttribute('width', '1');
  257. e2.setAttribute('height', '1');
  258. e2.setAttribute('alt', abCheck.rid());
  259. e2.setAttribute('id', abCheck.ID2);
  260. if (abCheck.img_class != '') {
  261. e2.setAttribute('class', abCheck.img_class);
  262. }
  263. b.insertBefore(e2, b.lastChild);
  264. abCheck.loadScript();
  265. setTimeout(abCheck.adblocktest, 3000);
  266. },
  267. init : function (a) {
  268. cookieMan.deleteCookie(cookieMan.refreshCookieName);
  269. abCheck.is_mobile = (/(android|bb\d+|meego).+mobile|android|ipad|playbook|silk|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)));
  270. if (typeof cookieMan === 'undefined' || window.fab) {
  271. abCheck.abDetected('file');
  272. } else if (typeof window.onload != 'undefined') {
  273. var _onload = window.onload;
  274. window.onload = function () {
  275. window.onload = null;
  276. console.log('onload');
  277. if (_onload) {
  278. _onload();
  279. _onload = null;
  280. }
  281. setTimeout(abCheck.load, 2000);
  282. };
  283. } else {
  284. console.log('doc_ready');
  285. setTimeout(abCheck.load, 2000);
  286. }
  287. }
  288. };
  289. if (abCheck.DEBUG) {
  290. function emitAllChecks() {
  291. if (abCheck.completed) {
  292. console.log("file\tmethod 1\tmethod 2\tmethod 3");
  293. var e1 = document.getElementById(abCheck.ID1);
  294. var e2 = document.getElementById(abCheck.ID2);
  295. console.log(window.fab + "\t" + abCheck.check(e1) + "\t" + abCheck.check(e2) + "\t" + abCheck.scriptNotLoaded);
  296. } else {
  297. setTimeout(emitAllChecks, 1000);
  298. }
  299. }
  300. var orig_onload = window.onload;
  301. window.onload = function () {
  302. if (orig_onload) {
  303. orig_onload();
  304. }
  305. setTimeout(emitAllChecks, 1000);
  306. }
  307. }
  308. (function (a) {
  309. abCheck.init(a);
  310. })(navigator.userAgent || navigator.vendor || window.opera);
  311. < / script >
  312. < !--End AdBlock-- >
Advertisement
Add Comment
Please, Sign In to add comment