PageSourceSearch

https://tvkrasnodar.ru/local/templates/.default/js/knockout-tv.js?v=31790282624

js tvkrasnodar.ru collected 2026-09-24 20:43:47 UTC 5,430 bytes, 162 lines download raw bytes

1/*!
2  Knockout paged seminar extender 0.5.0
3  By: Igor Vanzhula (C) 2018
4*/
5(function(root, program){
6    if(typeof define === 'function' && define.amd){
7        define(['knockout'], program);
8    } else if (typeof exports === 'object') {
9        module.exports = program(require('knockout'));
10    } else {
11        root.KnockoutElse = program(root.ko);
12    }
13}(this, function(ko){
14    "use strict";
15
16    // polyfill for IE < 9
17    if(!Array.isArray){
18        Array.isArray = function(arg){
19            return Object.prototype.toString.call(arg) === '[object Array]';
20        };
21    }
22
23    // Utilities
24    function isObservableArray(value) {
25        return ko.isObservable(value) && Array.isArray(ko.unwrap(value));
26    } 
27
28    ko.paging = {
29        defaults: {},
30        generators: {}
31    };
32
33    ko.extenders.paged = function(target, options){
34        if(!isObservableArray(target)){
35            throw new Error('The paged extender can only be applied to observable arrays.');
36        }
37        
38        var now = new Date();
39        var hours = now.getHours();
40        if(hours < 5){
41            now.setDate(now.getDate() - 1);
42        }
43
44        target.chosenDay = ko.observableArray([('0' + now.getDate()).slice(-2) + '.' + ('0' + (now.getMonth() + 1)).slice(-2) + '.' + now.getFullYear()]);
45        target.chosenTime = ko.observableArray(['0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23']);
46        target.getDayPrint = function(t){
47            var tt = t;
48            var result = '';
49            jQuery(target.daysPrint()).each(function(indx, element){
50                if(indx == tt){
51                    result = element;
52                }
53            });
54            return result;
55        };
56        target.toggleDay = function(t){
57            $(target.chosenDay()).each(function(indx, element){
58                target.chosenDay.remove(element);
59            });
60            target.chosenDay.push(t);
61            return false;
62        };
63        target.toggleTime = function(t){
64            $(target.chosenTime()).each(function(indx, element){
65                target.chosenTime.remove(element);
66            });
67            
68            if(t == 'morning'){
69                target.chosenTime.push('5','6','7','8','9','10');
70            }
71            else if(t == 'noon'){
72                target.chosenTime.push('11','12','13','14','15','16');
73            }
74            else if(t == 'evening'){
75                target.chosenTime.push('17','18','19','20','21','22');
76            }
77            else if(t == 'night'){
78                target.chosenTime.push('23','0','1','2','3','4');
79            }
80            else{
81                target.chosenTime.push('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23');
82            }
83            return false;
84        };
85        
86        target.filtered = ko.pureComputed(function(){
87            var programs, program, _i, _len, _ref, days, daysPrint, check;
88            programs = [];
89            days = [];
90            daysPrint = [];
91            _ref = target();
92            
93            for(_i = 0, _len = _ref.length; _i < _len; _i++){
94                program = _ref[_i];
95                if(jQuery.inArray(program.day, days) === -1){
96                    days.push(program.day);
97                }
98                if(jQuery.inArray(program.dayPrint, daysPrint) === -1){
99                    daysPrint.push(program.dayPrint);
100                }
101                
102                check = true;
103                if((target.chosenDay().length === 0) || jQuery.inArray(program.day, target.chosenDay()) > -1) {} else {
104                    check = false;
105                }
106                if((target.chosenTime().length === 0) || jQuery.inArray(program.hour, target.chosenTime()) > -1) {} else {
107                    check = false;
108                }
109                
110                if(check){
111                    programs.push(program);
112                }
113            }
114            target.days(days);
115            target.daysPrint(daysPrint);
116            return programs;
117        });
118        target.filtered.extend({ rateLimit: 1 });
119
120        var _days = ko.observable([]);    
121        target.days = ko.pureComputed({
122            read: function(){
123                return _days();
124            },
125            write: function(value){
126                _days(value);
127            },
128            owner: target
129        });
130        target.getDays = ko.pureComputed(function(){
131            return target.days();
132        });
133        var _daysPrint = ko.observable([]);    
134        target.daysPrint = ko.pureComputed({
135            read: function(){
136                return _daysPrint();
137            },
138            write: function(value){
139                _daysPrint(value);
140            },
141            owner: target
142        });
143        target.getDaysPrint = ko.pureComputed(function(){
144            return target.daysPrint();
145        });
146
147
148        target.pageItems = ko.pureComputed(function(){
149            return target.filtered();
150        });
151        target.pageItems.extend({ rateLimit: 2 });
152        target.itemCount = ko.pureComputed(function(){
153            return target.filtered().length;
154        });
155
156        return target;
157    };
158
159    ko.pagedObservableArray = function(initialValue, options){
160        return ko.observableArray(initialValue).extend({ paged: options });    
161    };
162}));

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.