PageSourceSearch

https://zemljevid.najdi.si/assets/scripts/gam-helper.js

js najdi.si collected 2026-09-24 09:19:26 UTC 4,462 bytes, 122 lines download raw bytes

1var GamHelper = {
2    valueUrl: [],
3    valuePageType: [],
4    valuePageCategory: [],
5    valueProvider: [],
6    valueKeywords: [],
7    valueAdvertiser: [],
8    valueVisitorType: [],
9    valuePoiId: [],
10    valuePoiType: [],
11    valueActivity: [],
12    valueRegion: [],
13    data: [],
14
15    init: function(data) {
16        if (typeof data !== "undefined") {
17            this.data = data;
18            this.valueUrl = this.transformStringToArray(window.location.href.replace(window.location.origin + '/', ''));
19
20            if(typeof this.data.pageType !== "undefined" && this.data.pageType != '') {
21                this.valuePageType = this.transformStringToArray(this.data.pageType);
22            }
23            if(typeof this.data.pageCategory !== "undefined" && this.data.pageCategory != '') {
24                this.valuePageCategory = this.transformStringToArray(this.data.pageCategory);
25            }
26            if(typeof this.data.provider !== "undefined" && this.data.provider != '') {
27                this.valueProvider = this.transformStringToArray(this.data.provider);
28            }
29            if(typeof this.data.keywords !== "undefined" && this.data.keywords != '') {
30                this.valueKeywords = this.transformStringToArray(this.data.keywords);
31            }
32            if(typeof this.data.advertiser !== "undefined" && this.data.advertiser != '') {
33                this.valueAdvertiser = this.transformStringToArray(this.data.advertiser);
34            }
35            if(typeof this.data.visitorType !== "undefined" && this.data.visitorType != '') {
36                this.valueVisitorType = this.transformStringToArray(this.data.visitorType);
37            }
38            if(typeof this.data.poiId !== "undefined" && this.data.poiId != '') {
39                this.valuePoiId = this.transformStringToArray(this.data.poiId);
40            }
41            if(typeof this.data.poiType !== "undefined" && this.data.poiType != '') {
42                this.valuePoiId = this.transformStringToArray(this.data.poiType);
43            }
44            if(typeof this.data.dejavnost !== "undefined" && this.data.dejavnost != '') {
45                this.valueActivity = this.transformStringToArray(this.data.dejavnost);
46            }
47            if(typeof this.data.regija !== "undefined" && this.data.regija != '') {
48                this.valueRegion = this.transformStringToArray(this.data.regija);
49            }
50        }
51        this.setWindowKeyValues();
52        this.setWindowPageType();
53    },
54
55    setWindowKeyValues: function() {
56        window.keyValues = {
57            'url': this.valueUrl,
58            'type': this.valuePageType,
59            'category': this.valuePageCategory,
60            'provider': this.valueProvider,
61            'keywords': this.valueKeywords,
62            'advertiser': this.valueAdvertiser,
63            'visitorType': this.valueVisitorType,
64            'poiId': this.valuePoiId,
65            'poiType': this.valuePoiType,
66            'activity': this.valueActivity,
67            'region': this.valueRegion,
68            'size': this.valueSize,
69            'noads': this.noAds()
70        } 
71    },
72
73    setWindowPageType: function() {
74        window.pageType = this.valuePageType;
75    },
76
77    transformStringToArray: function(str) {
78        str = str.trim();
79        str = str.toLowerCase();
80        str = this.charReplace(str);
81        return str.split(',');
82    },
83
84    noAds: function() {
85        if((typeof this.data.advertiser !== "undefined" && this.data.advertiser.toLowerCase() == 'true') || (typeof this.data.provider !== "undefined" && this.data.provider.toLowerCase() == 'world')) {
86            return 1;
87        } else {
88            return 0;
89        }
90    },
91
92    charReplace: function(str) {
93        var obj = {
94            ' ': '_',
95            '#': '_',
96            'Å¡': 's',
97            'č': 'c',
98            'ć': 'c',
99            'ž': 'z',
100            'đ': 'dz',
101            'ü': 'u',
102            'ö': 'o',
103            'ä': 'a',
104            '&': '_',
105            '%': '_',
106            '€': 'eur',
107            '@': 'at',
108            '!': '_',
109            ':': '_',
110            '__': '_',
111            ',_': ',',
112            '_,': ','
113        } 
114 
115        for (var key in obj) {
116            str = str.replace(RegExp(key, 'g'), obj[key]);
117        }
118        return str;
119    }
120}
121
122GamHelper.init(pageData);

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.