PageSourceSearch

https://unit.travel/static/scripts/custom/bn.js?v=16.01

js unit.travel collected 2026-10-01 16:33:52 UTC 5,976 bytes, 141 lines download raw bytes

1var BN = {
2    source: {},
3    width: '100%',
4    height: '200px',
5    perItem: 4,
6    wraper: [],
7    itemSelector: '.filter-item:visible',
8    isReshowOnFilter: true,
9    setSource: function(source) {
10        this.source = source;
11        return this;
12    },
13    setPerItem: function(perItem) {
14        this.perItem = perItem;
15        return this;
16    },
17    setItemSelector: function(selector) {
18        this.itemSelector = selector;
19        return this;
20    },
21    setWraper: function(wraper) {
22        this.wraper = wraper;
23        return this;
24    },
25    setReshowOnFilter: function(isReshowOnFilter) {
26        this.isReshowOnFilter = isReshowOnFilter;
27        return this;
28    },
29    show: function() {
30        $('.banner-box').remove();
31        if (!Object.keys(this.source).length)
32            return 0;
33        var items = $(this.itemSelector);
34        if (!items.length)
35            return 0;
36        var filterItemSize = items.length,
37            needItems = (filterItemSize - filterItemSize % this.perItem) / this.perItem, pos = 0,
38            perItem = this.perItem;
39        if((filterItemSize - filterItemSize % this.perItem) / this.perItem < 1)
40            return 0;
41        for(i = 0; i < filterItemSize; i++) {
42            if(undefined == this.source[pos]) {
43                break;
44            }
45            if(pos > 0 && 4 == this.perItem) {
46                perItem = 20;
47            }
48            if(0 == i || 0 != (i + 1) % perItem)
49                continue;
50            var html = this._render(this.source[pos]);
51            if(this.wraper.length > 1) {
52                html = this.wraper[0] + html + this.wraper[1];
53            }
54            items.eq(i).after($(html).addClass('banner-box'));
55            pos++;
56        }
57        if($('#cashbackInfoBn').length) {
58            items.eq(1).after($($('#cashbackInfoBn').html()).addClass('banner-box'));
59        }
60    },
61    _render: function(row) {
62        var callback = 'href="javascript:BN.getSearchForm(' + row.id + ')"';
63        if('search' != row.target) {
64            if(row.link == ''){
65                callback = 'href="javascript:void(0)" style="cursor: default"';
66            } else {
67                callback = 'href="/banner/' + row.code + '" target="_blank"';
68            }
69        }
70        if(undefined != row.v2) {
71            var isPrice = undefined != row.v2.price,
72                textHtml = '<div class="left-s">' +
73                        '<div class="title">' + row.v2.title + '</div>' +
74                         ('' != row.v2.text ? '<div class="text">
74' + row.v2.text + '</div>' : '') +
75                    '</div>',
76                priceHtml = !isPrice ? '' : ('<div class="right-s">' +
77                        row.v2.pricetext[0] +
78                        '<div class="price">' + row.v2.price + '</div>' +
79                        '<div class="small">' + row.v2.pricetext[1] + '</div>' +
80                    '</div>');
81            return '<div class="banner-section">' +
82                        '<a ' + callback + ' class="' + row.css + ' search-result-banner' + (!isPrice ? ' img-pos-left' : '') + '" title="' + row.alt + '">' +
83                            (isPrice ? textHtml : '') +
84                            '<div class="center-s" style="background-image: url(\'/static/photos/banners/orig/' + row.photo + '\');"></div>' +
85                            (!isPrice ? textHtml : priceHtml) +
86                        '</a>' +
87                    '</div>'
88        }
89        var source = '<img style="width:' + this.width + ';max-height: ' + this.height + '" src="/static/photos/banners/orig/' + ('' !== row.photo_mobile && $('body').hasClass('is-mobile') ? row.photo_mobile : row.photo)  + '">' +
90            '<span class="banner-text">' + row.title + '</span>';
91        if('' != row.video) {
92            source = '<video class="banner-video" loop muted autoplay>' +
93                '<source src="/static/photos/banners/orig/' + row.video + '" type="video/webm"/>' +
94            '</video>';
95        }
96        return '<div class="banner-section single">' +
97            '<div class="banner">'+
98                '<a ' + callback + ' class="' + row.css + ' banner-link" title="' + row.alt + '">' +
99                    source +
100                '</a>' +
101            '</div>' +
102        '</div>';
103    },
104    init: function() {
105        this.show();
106        if(this.isReshowOnFilter) {
107            $('body').on('data-filter',function(){
108                BN.show();
109            });
110        }
111    },
112    getSearchForm: function(id) {
113        if(undefined == window.SearchForm)
114            return 0;
115        $.post(Helper.buildLangUrl('/banner/blocksearchform'), {id: id}, function(data) {
116            modal.open({content: data, onopen: function() {
117                $('#modal-content .styled').selectBox();
118                SearchForm._initCommonAutocomplete('#modal-content input.autocomplete-box');
119                SearchForm._initCommonDateChoseBoxs('#modal-content input.date-chose-box');
120                $('#modal-content .progress-button').click(function() {
121                    $(this).progressInitialize().progressTimed(12);
122                })
123            },  onclose: function(){
124
125            }});
126        });
127    },
128    waitShowPreloader: function (callback, data) {
129        var box = $('#progresSearch');
130        if(!box.length || box.hasClass('is-wait') || undefined == box.data('waitseconds') || box.hasClass('is-start'))
131            return callback(data);
132        box.addClass('is-start');
133        var waitSeconds = box.data('waitseconds'), startTime = $('body').data('time'), interval = setInterval(function () {
134            if(startTime + (waitSeconds * 1000) < (new Date()).getTime()) {
135                box.addClass('is-wait');
136                clearInterval(interval);
137                callback(data);
138            }
139        }, 1000);
140    }
141};

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.