PageSourceSearch

https://designtaxi.com/js/i-rd.js?4

js designtaxi.com collected 2026-09-24 15:27:06 UTC 9,492 bytes, 175 lines download raw bytes

1/*! Cookies.js - 0.3.1; Copyright (c) 2013, Scott Hamper; http://www.opensource.org/licenses/MIT */
2(function(e){"use strict";var a=function(b,d,c){return 1===arguments.length?a.get(b):a.set(b,d,c)};a._document=document;a._navigator=navigator;a.defaults={path:"/"};a.get=function(b){a._cachedDocumentCookie!==a._document.cookie&&a._renewCache();return a._cache[b]};a.set=function(b,d,c){c=a._getExtendedOptions(c);c.expires=a._getExpiresDate(d===e?-1:c.expires);a._document.cookie=a._generateCookieString(b,d,c);return a};a.expire=function(b,d){return a.set(b,e,d)};a._getExtendedOptions=function(b){return{path:b&&
3b.path||a.defaults.path,domain:b&&b.domain||a.defaults.domain,expires:b&&b.expires||a.defaults.expires,secure:b&&b.secure!==e?b.secure:a.defaults.secure}};a._isValidDate=function(b){return"[object Date]"===Object.prototype.toString.call(b)&&!isNaN(b.getTime())};a._getExpiresDate=function(b,d){d=d||new Date;switch(typeof b){case "number":b=new Date(d.getTime()+1E3*b);break;case "string":b=new Date(b)}if(b&&!a._isValidDate(b))throw Error("`expires` parameter cannot be converted to a valid Date instance");
4return b};a._generateCookieString=function(b,a,c){b=encodeURIComponent(b);a=(a+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent);c=c||{};b=b+"="+a+(c.path?";path="+c.path:"");b+=c.domain?";domain="+c.domain:"";b+=c.expires?";expires="+c.expires.toUTCString():"";return b+=c.secure?";secure":""};a._getCookieObjectFromString=function(b){var d={};b=b?b.split("; "):[];for(var c=0;c<b.length;c++){var f=a._getKeyValuePairFromCookieString(b[c]);d[f.key]===e&&(d[f.key]=f.value)}return d};a._getKeyValuePairFromCookieString=
5function(b){var a=b.indexOf("="),a=0>a?b.length:a;return{key:decodeURIComponent(b.substr(0,a)),value:decodeURIComponent(b.substr(a+1))}};a._renewCache=function(){a._cache=a._getCookieObjectFromString(a._document.cookie);a._cachedDocumentCookie=a._document.cookie};a._areEnabled=function(){return a._navigator.cookieEnabled||"1"===a.set("cookies.js",1).get("cookies.js")};a.enabled=a._areEnabled();"function"===typeof define&&define.amd?define(function(){return a}):"undefined"!==typeof exports?("undefined"!==
6typeof module&&module.exports&&(exports=module.exports=a),exports.Cookies=a):window.Cookies=a})();
7
8Cookies.defaults = {
9    path: '/',
10    expires: '01/01/2030'
11};
12
13window.difference = function(a1,a2) {return $.grep(a1,function(x) {return $.inArray(x, a2) < 0})};
14
15// if(!window.disable_interstitial) {
16//     window.disable_interstitial = URI(window.location.href).search(true)['interstital_shown'];
17// }
18
19var isMobile = {
20Android: function() {
21    return navigator.userAgent.match(/Android/i);
22},
23BlackBerry: function() {
24    return navigator.userAgent.match(/BlackBerry/i);
25},
26iOS: function() {
27    return navigator.userAgent.match(/iPhone|iPad|iPod/i);
28},
29Opera: function() {
30    return navigator.userAgent.match(/Opera Mini/i);
31},
32Windows: function() {
33    return navigator.userAgent.match(/IEMobile/i);
34},
35any: function() {
36    return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
37}
38};
39
40function getParameterByName(name, url) {
41    if (!url) url = window.location.href;
42    name = name.replace(/[\[\]]/g, "\\$&");
43    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
44        results = regex.exec(url);
45    if (!results) return null;
46    if (!results[2]) return '';
47    return decodeURIComponent(results[2].replace(/\+/g, " "));
48}
49
50//if(!isMobile.any()){
51    // var advertiser_list = ['BZA', 'IMG'];
52    // var time_before_next_shown_in_seconds = 86400; // 1 day
53
54    // var interstital_json = Cookies('interstital');
55    // var  interstital = {};
56    // var time_now = Math.round(new Date().getTime() / 1000);
57    // try {
58    //     interstital = JSON.parse(interstital_json);
59    // } catch (err) {
60    //     interstital = {
61    //         'last_shown': 0,
62    //         'visited': []
63    //     };
64    // }
65    // if(time_now - interstital.last_shown > time_before_next_shown_in_seconds) {
66    //     var advertisers_not_visited = difference(advertiser_list, interstital.visited);
67    //     if(advertisers_not_visited.length > 0) {
68    //         var advertiser = advertisers_not_visited[Math.round(Math.random()*(advertisers_not_visited.length-1))];
69    //         interstital.visited.push(advertiser);
70    //         interstital.last_shown = time_now;
71    //         Cookies.set('interstital', JSON.stringify(interstital));
72    //         window.location.href = 'interstital.html?advertiser=' + advertiser + '&return_url=' + encodeURIComponent(window.location.href);
73    //     }
74    // }
75
76    var utm_source = getParameterByName('utm_source');
77    if (!navigator.userAgent.match(/Crowsnest/i) && utm_source != 'smartnews' && !navigator.userAgent.match(/Googlebot/i)) {
78        var advertiser_list = {
79            // 'BZA2': {
80            //     'exposure_interval': 30 * 86400 //Once a month, 86400 seconds in a day
81            // },
82            // 'IMG': {
83            //     'exposure_interval': -1 //Only once forever
84            // },
85            // 'TCF': {
86            //     'exposure_interval': -1 //Only once forever
87            // },
88            'External': {
89                // 'exposure_interval': 86400 //Only once forever
90                'exposure_interval': 1 //Once every 5 min
91            }
92            // 'DTDEALS': {
93            //     'exposure_interval': -1
94            // }
95        };
96        var time_before_next_shown_in_seconds = 300; // 5 min
97
98        var interstital_json = Cookies('interstital');
99        var interstital = {};
100        var time_now = Math.round(new Date().getTime() / 1000);
101        try {
102            interstital_buffer = JSON.parse(interstital_json);
103            //If cookie is of old format, convert to new format
104            if(interstital_buffer.last_shown) {
105                console.log(interstital_buffer.last_shown);
106                interstital_buffer.last_shown = Math.min(interstital_buffer.last_shown, time_now);
107                interstital = {
108                    'visited': {}
109                }
110                for(i = 0; i < interstital_buffer.visited.length; ++i) {
111                    interstital.visited[interstital_buffer.visited[i]] = interstital_buffer.last_shown;
112                }
113            } else {
114                interstital = interstital_buffer;
115            }
116        } catch (err) {
117            interstital = {
118                'visited': {}
119            };
120        }
121
122        var last_visited = 0;
123
124        //Loop through and see which advertiser is ready for another exposure
125        var ready_advertisers = $.grep(Object.keys(advertiser_list), function(advertiser) {
126            if(interstital.visited[advertiser]) {
127                last_visited = interstital.visited[advertiser] > last_visited ? interstital.visited[advertiser] : last_visited;
128                if(advertiser_list[advertiser].exposure_interval > 0) {
129                    return (interstital.visited[advertiser] + advertiser_list[advertiser].exposure_interval) < time_now;
130                } else {
131                    return false;
132                }
133            } else {
134                return true;
135            }
136        });
137
138        var news_id = window.location.pathname.split( '/' )[2];
139        if (typeof news_id == "undefined") {
140            news_id = 'index';
141        }
142        var show_ad = Cookies.get(news_id);
143
144        var has_i_rd_cookie = Cookies.get('i_rd_cookie');
145
146        //if((!window.disable_interstitial) && (time_now - last_visited > time_before_next_shown_in_seconds) && (ready_advertisers.length > 0)) {
147        if ((!window.disable_interstitial) && (ready_advertisers.length > 0) && typeof show_ad == 'undefined') {
148            if (i_rd_frequency == 0 || has_i_rd_cookie == i_rd_frequency_unit) {
149                if (i_rd_dfp_status == 1 || i_rd_ab_status == 1) {
150                    window.stop();
151                    var advertiser = ready_advertisers[Math.round(Math.random()*(ready_advertisers.length-1))];
152                    interstital.visited[advertiser] = time_now;
153                    Cookies.set('interstital', JSON.stringify(interstital));
154                    Cookies.set(news_id, 1, {expires: 3600});
155                    if(!isMobile.any()){
156                        window.location.href = 'interstitial.html?v=1&advertiser=' + advertiser + '&return_url=' + encodeURIComponent(window.location.href);
157                    } else {
158                        window.location.href = 'interstitial-m.html?v=1&advertiser=' + advertiser + '&return_url=' + encodeURIComponent(window.location.href);
159                    }   
160                }
161            } else {
162                if (i_rd_frequency_unit == "hours") {
163                    var hour = i_rd_frequency*3600;
164                    Cookies.set('i_rd_cookie', i_rd_frequency_unit, {expires: hour});
165                } else if (i_rd_frequency_unit == "days") {
166                    var day = i_rd_frequency*86400;
167                    Cookies.set('i_rd_cookie', i_rd_frequency_unit, {expires: day});
168                } else if (i_rd_frequency_unit == "weeks") {
169                    var week = i_rd_frequency*604800;
170                    Cookies.set('i_rd_cookie', i_rd_frequency_unit, {expires: week});
171                }
172            }
173        }
174    }
175//}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.