Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function(w,d){
- w.__clADF__urlPull = {};
- var counter =1;
- var debug = true;
- function log(msg) {
- if(debug) console.log(msg);
- }
- function forEach(array, callback, scope) {
- for (var i = 0; i < array.length; i++) {
- callback.call(scope, i, array[i]);
- }
- };
- function addBanners(title){
- log("addBanners init");
- var articles = document.querySelectorAll('.article__container');
- if(articles.length)
- {
- forEach(articles, function (index, article) {
- var articleTitle = article.querySelector('.alasliderimage p').innerText.trim();
- var content = article.querySelector('.typography');
- var adUnitNode = content.querySelector('div[id^="adfox_"]');
- if(articleTitle == title && !adUnitNode)
- {
- log("addBanners adding banner with counter " + counter);
- var el = document.createElement('div');
- el.setAttribute("id", "adfox_154505042490062278-" + counter);
- el.setAttribute("style","margin-bottom:1em;");
- content.insertBefore(el, content.firstChild);
- (function() {
- (function(w, n) {
- w[n] = w[n] || [];
- w[n].push({
- ownerId: 262633,
- containerId: 'adfox_154505042490062278-' + counter,
- params: {
- pp: 'old',
- ps: 'dbuh',
- p2: 'gbwp',
- pk: __clADF__.state
- }
- });
- })(window, 'adfoxAsyncParams');
- counter++;
- }).call(this);
- }
- });
- }
- }
- var getPolicy = function(href) {
- log("getPolicy init");
- var title = document.title;
- var referer = document.referrer;
- function a(ref) {
- __clADF__.adxAllowed(0)
- }
- var b = window,
- c = b.document,
- d = c.getElementsByTagName('head')[0];
- d || (d = c.createElement('head'), b.appendChild(d)), b.__clADF__ = {
- state: 0,
- loaded: 0,
- adxAllowed: function(a) {
- log(b.__clADF__);
- if (1 != this.loaded) {
- log('getPolicy loaded = false');
- n = 'adfoxAsyncParams', b[n] && log(b[n]) && b[n].forEach(function(b) {
- b.params.pk = a
- }), n1 = n + 'Scroll', b[n1] && log(b[n1]) && b[n1].forEach(function(b) {
- b[0].params.pk = a
- }), n1 = n + 'Adaptive', b[n1] && log(b[n1]) && b[n1].forEach(function(b) {
- b[0].params.pk = a
- }), n = 'Adaptive', b[n] && log(b[n]) && b[n].forEach(function(b) {
- b[0].params.pk = a
- }), this.state = a;
- var s = c.querySelector('script[src="https://yastatic.net/pcode/adfox/loader.js"]');
- if(!s)
- {
- log("getPolicy adding loader");
- var d = c.createElement('script');
- d.setAttribute('src', 'https://yastatic.net/pcode/adfox/loader.js'), d.setAttribute('async', 'async');
- var e = c.getElementsByTagName('head')[0];
- e || (e = c.createElement('head'), b.appendChild(e)), e.appendChild(d);
- }
- else
- {
- log("getPolicy already got loader");
- }
- this.loaded = 1
- b.__clADF__urlPull[href] = b.__clADF__;
- }
- else
- {
- var contents = document.querySelectorAll('.typography');
- if (contents.length)
- {
- addBanners(title);
- }
- log('getPolicy loaded = true');
- }
- }
- };
- if(!w.__clADF__urlPull[href])
- {
- log('getPolicy new __clADF__ for href: ' + href);
- var e = c.createElement('script');
- e.setAttribute('src', '//clickiocdn.com/hbadx/?' +
- 'f=__clADF__&rt=' + new Date().getTime() +
- '&site_id=218227&title=' + encodeURIComponent(title) +
- '&r=' + encodeURIComponent(referer)),
- e.setAttribute('async', 'async'),
- e.onreadystatechange = e.onload = function()
- {
- log('getPolicy onreadystatechange for href: ' + href);
- if('loaded' != this.readyState && 'complete' != this.readyState)
- {
- log('getPolicy not loaded for href: ' + href);
- setTimeout(function(){
- a(title);
- }, 0);
- }
- else
- {
- log('getPolicy loaded for href: ' + href);
- }
- },
- e.onerror = function()
- {
- log('getPolicy onerror for href: ' + href);
- setTimeout(a, 0)
- }, d.appendChild(e), setTimeout(a, 3e3)
- }
- else {
- log('getPolicy already have __clADF__ for href: ' + href);
- w.__clADF__ = w.__clADF__urlPull[href];
- }
- };
- getPolicy(document.location.href);
- var oldHref = document.location.href;
- window.onload = function() {
- var bodyList = document.querySelector("body"),
- observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if (oldHref != document.location.href) {
- oldHref = document.location.href;
- log("LOCATION IS:", document.location.href);
- getPolicy(document.location.href);
- }
- });
- });
- var config = {
- childList: true,
- subtree: true
- };
- observer.observe(bodyList, config);
- };
- })(window, document);
- </script>
Add Comment
Please, Sign In to add comment