PageSourceSearch

https://rule15.ru/assets/701efeb1/js/script.js?v=1543369066

js rule15.ru collected 2026-09-30 03:07:37 UTC 6,825 bytes, 218 lines download raw bytes

1var arrowupEnabled = false;
2
3//noinspection JSUnusedGlobalSymbols
4Date.prototype.yyyymmdd = function() {
5    var yyyy = this.getFullYear().toString();
6    var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
7    var dd  = this.getDate().toString();
8    return yyyy + '-' + (mm[1]?mm:"0"+mm[0]) + '-' + (dd[1]?dd:"0"+dd[0]); // padding
9};
10
11//noinspection JSUnusedGlobalSymbols
12Date.prototype.ddmmyyyy = function() {
13    var yyyy = this.getFullYear().toString();
14    var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
15    var dd  = this.getDate().toString();
16    return (dd[1]?dd:"0"+dd[0]) + '-' + (mm[1]?mm:"0"+mm[0]) + '-' + yyyy; // padding
17};
18
19$.fn.outerHTML = function(){
20    // IE, Chrome & Safari will comply with the non-standard outerHTML, all others (FF) will have a fall-back for cloning
21    return (!this.length) ? this : (this[0].outerHTML || (
22        function(el){
23            var div = document.createElement('div');
24            div.appendChild(el.cloneNode(true));
25            var contents = div.innerHTML;
26            div = null;
27            return contents;
28        })(this[0]));
29
30};
31
32//noinspection JSUnusedGlobalSymbols
33function randomInteger(min, max) {
34    var rand = min + Math.random() * (max + 1 - min);
35    rand = Math.floor(rand);
36    return rand;
37}
38
39jQuery.fn.removeAttributes = function() {
40    return this.each(function() {
41        var attributes = $.map(this.attributes, function(item) {
42            return item.name;
43        });
44        var img = $(this);
45        $.each(attributes, function(i, item) {
46            img.removeAttr(item);
47        });
48    });
49};
50
51var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
52var body = $('body');
53
54body.addClass(iOS ? 'iOS' : 'noiOS');
55
56var scrollPos = 0;
57
58function addLink() {
59    //Get the selected text and append the extra info
60    var selection = window.getSelection(),
61        pagelink = '<br /><br /> Подробнее на сайте Правило 15 ©: ' + document.location.href,
62        copytext = selection + pagelink,
63        newdiv = document.createElement('div');
64
65    //hide the newly created container
66    newdiv.style.position = 'absolute';
67    newdiv.style.left = '-99999px';
68
69    //insert the container, fill it with the extended text, and define the new selection
70    document.body.appendChild(newdiv);
71    newdiv.innerHTML = copytext;
72    selection.selectAllChildren(newdiv);
73
74    window.setTimeout(function () {
75        document.body.removeChild(newdiv);
76    }, 100);
77}
78
79(function($) {
80    $(window).scroll(function() {
81        //noinspection JSValidateTypes
82        var pos = $(this).scrollTop(),
83            moveDown = pos > scrollPos;
84
85        if (pos >= 20 && false) {
86            if (moveDown) {
87                body.addClass('head-min');
88            } else {
89                body.removeClass('head-min');
90            }
91        }
92
93        scrollPos = pos;
94    });
95
96    $('[data-toggle="popover"]').popover();
97
98    $(function() {
99        if (isGuest) {
100            $('.pgl').tooltip({title: 'Необходима авторизация'});
101        } else {
102            body.on('click', '.pgl', function() {
103                var target = $(this);
104                $.get('/vote/good', {type: target.data('type'), id: target.data('id')}, function(data) {
105                    $('[data-type='+target.data('type')+'][data-id='+target.data('id')+']').toggleClass('isg').find('.count').html(data);
106                });
107            });
108        }
109    });
110
111    if (!$('.w900').is('*') && !$('.allow-copy').length) {
112        body.bind('copy', function() {
113            // $('#popup-copyright').modal('show');
114            addLink();
115            return true;
116        });
117    }
118
119    body.on('click', ".search-btn, .search-close", function() {
120
121        if (body.hasClass("site-search-open")) {
122            $('.header').css('z-index', 3);
123        } else {
124            $('.header').css('z-index', 2);
125        }
126
127        body.toggleClass("site-search-open");
128        $(".query").focus();
129    });
130
131    body.on('blur', '.query', function() {
132        if (body.hasClass("site-search-open")) {
133            $('.header').css('z-index', 3);
134        } else {
135            $('.header').css('z-index', 2);
136        }
137
138        body.toggleClass("site-search-open");
139    });
140
141    $(document).keyup(function(e) {
142        var serachHeaderInputVal = $('.search-header-input').val();
143        if (e.keyCode == 13 && serachHeaderInputVal) {
144            location.href = '/search?query=' + serachHeaderInputVal;
145        }
146
147        if (e.keyCode == 27 && body.hasClass("site-search-open")) {
148            if (body.hasClass("site-search-open")) {
149                $('.header').css('z-index', 3);
150            } else {
151                $('.header').css('z-index', 2);
152            }
153            $(".query").blur();
154        }
155    });
156
157    $( window ).scroll(function() {
158        //noinspection JSValidateTypes
159        // if ($(this).scrollTop() >= 1000 && !arrowupEnabled) {
160            // body.append('<a class="arrowup"><i class="fa fa-chevron-circle-up fa-3x"></i></a>');
161            // arrowupEnabled = true;
162        // }
163
164        //noinspection JSValidateTypes
165        // if ($(this).scrollTop() < 1000 && arrowupEnabled) {
166            // $('.arrowup').remove();
167            // arrowupEnabled = false;
168        // }
169    });
170
171    body.on('click', '.arrowup', function () {
172        $('html, body').animate({
173            scrollTop: 0
174        }, 400);
175    });
176
177    body.on('click', '.mob-uinfo', function () {
178        $(this).find('.fa').toggleClass('fa-chevron-down').toggleClass('fa-chevron-up');
179        $('.mob-usermenu').slideToggle();
180    });
181
182    $('.adopt-tables table, .adopt-tables table *').removeAttributes();
183
184    $('.adopt-tables table').each(function() {
185        var adotbl = [];
186        $(this).addClass('table-bordered table-striped table-condensed cf');
187        $(this).find('tr:first td').each(function() {
188            adotbl.push($(this).text());
189        });
190
191        $(this).find('tr').each(function() {
192            $(this).find('td').each(function(index) {
193                $(this).attr('data-title', adotbl[index]);
194            });
195        });
196    });
197
198    $("img").on('error', function () {
199      $(this).unbind("error").attr("src", "//rule15s.com" + $(this).attr("src"));
200    });
201
202    //очищаем содержимое #modal_view окна при его закрытии
203    $('#modal_view').on('hidden.bs.modal', function (e) {
204        $('#modal_view .modal-body').empty();
205    });
206
207})(jQuery);
208
209
210$(document).ready(function() {
211    var wh = $(window).outerHeight() - $('.footer').outerHeight();
212    $('.wrap').css('min-height', wh);
213
214    $(window).resize(function() {
215        var wh = $(window).outerHeight() - $('.footer').outerHeight();
216        $('.wrap').css('min-height', wh);
217    });
218});

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.