PageSourceSearch

https://www.kore.co.il/themes/HDB/trg.js?ver=9245

js kore.co.il collected 2026-09-24 23:45:46 UTC 7,077 bytes, 148 lines download raw bytes

1/*! js-cookie v3.0.1 | MIT */
2!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}return function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}));
3
4const api = Cookies.withAttributes({
5    path: '/',
6    secure: true
7})
8
9
10var hdbtrg = {
11    
12    token: '',
13    
14    post(action, data, callback, fail = null)
15    {
16        fetch(action, {
17            method: 'POST',
18            credentials: 'include',
19            headers: {
20              'Accept': 'application/json',
21              'Content-Type': 'application/json',
22                'token': this.token
23            },
24            body: JSON.stringify(data)
25        }).then((response) => {
26            if (response.ok || response.status === 200) 
27            {
28                return response.json();
29            }
30            throw new Error('Something went wrong');
31        })
32        .then((responseJson) => {
33            callback(responseJson);
34        })
35        .catch((error) => {
36            console.log(error);
37            if (fail != null) fail();
38        });
39            
40    },
41    
42    isNull: function (str)
43    {
44      return (str == '' || str == null || str == undefined);
45    },
46    
47    
48    get_banners(arr_banners) {
49        return new Promise((resolve, reject) => {
50            
51            if (arr_banners.length === 0) {
52                reject('No banners to fetch.');
53                return;
54            }
55            
56            let postdata = {};
57
58            let cval = Cookies.get('trg_unique');
59            if (this.isNull(cval)) {
60                localStorage.removeItem('trg_unique_data');
61                Cookies.set('trg_unique', 'true', { expires: 1, domain: 'bhol.co.il' });
62                postdata.unique = [];
63            }
64
65            let trg_unique_data = localStorage.getItem('trg_unique_data');
66            if (this.isNull(trg_unique_data)) trg_unique_data = [];
67            else trg_unique_data = JSON.parse(trg_unique_data);
68
69            postdata.unique = trg_unique_data;
70
71            postdata.banners = arr_banners;
72
73            this.post('system/ad_manager/get_all_banners', postdata, (data) => {
74                
75                if (data && data.banners) {
76                    
77                    for (let i in data.banners)
78                    {
79                        let banner = data.banners[i];
80                        if (!this.isNull(banner))
81                        {
82                            if (!trg_unique_data.includes(banner.banner_id)) trg_unique_data.push(banner.banner_id);
83                        }
84                    }
85                        
86                    localStorage.setItem('trg_unique_data', JSON.stringify(trg_unique_data));
87                    
88                    resolve(data.banners);
89                } else {
90                    reject('Failed to fetch banners data.');
91                }
92            });
93        });
94    },
95    
96    
97    // Banners
98    init_banners(arr_banners = false)
99    {
100        if (!arr_banners) {
101            arr_banners = [];
102
103            let bannersListEl = document.querySelectorAll('.trg_banner');
104            bannersListEl.forEach(bannerEl => {
105                arr_banners.push({ id: bannerEl.id, type: bannerEl.getAttribute('data-type'), tag: bannerEl.getAttribute('data-tag') });
106            });
107        }
108
109        this.get_banners(arr_banners).then(() => {
110        
111            this.post('get_banners', postdata, (data) => {
112
113                for (let i in data.banners)
114                {
115                    let banner = data.banners[i];
116                    if (!this.isNull(banner))
117                    {
118
119                        if (banner.has_close_btn) banner.html += '<a class="close" onClick="$(`#' + banner.id + '`).slideUp(400, function(){ $(`#' + banner.id + '`).remove(); })"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 460.775 460.775" xml:space="preserve"><path d="M285.08,230.397L456.218,59.27c6.076-6.077,6.076-15.911,0-21.986L423.511,4.565c-2.913-2.911-6.866-4.55-10.992-4.55c-4.127,0-8.08,1.639-10.993,4.55l-171.138,171.14L59.25,4.565c-2.913-2.911-6.866-4.55-10.993-4.55c-4.126,0-8.08,1.639-10.992,4.55L4.558,37.284c-6.077,6.075-6.077,15.909,0,21.986l171.138,171.128L4.575,401.505c-6.074,6.077-6.074,15.911,0,21.986l32.709,32.719c2.911,2.911,6.865,4.55,10.992,4.55c4.127,0,8.08-1.639,10.994-4.55l171.117-171.12l171.118,171.12c2.913,2.911,6.866,4.55,10.993,4.55c4.128,0,8.081-1.639,10.992-4.55l32.709-32.719c6.074-6.075,6.074-15.909,0-21.986L285.08,230.397z"/></svg></a>';
120                        $('#' + banner.id).html(banner.html);
121                        if (banner.slide_on_show) {
122                            setTimeout(() => { $('#' + banner.id).addClass('loaded'); }, 1000);
123                        }
124
125                        if(banner.auto_close_time > 0){
126                            setTimeout(() => { 
127                                $('#' + banner.id).slideUp(400, function(){ $('#' + banner.id).remove(); }); 
128                            }, banner.auto_close_time * 1000);
129
130                            console.log("has close time");
131                        }
132
133                    }
134                }
135
136
137                $('.bannerCls img').lazy();
138            }, () => {
139                $('#page').trigger('adblock_active');
140            });
141        
142        });
143        
144    }
145    
146}
147
148//hdbtrg.init();

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.