PageSourceSearch

https://gvuo.cz/core/system/com/mon/dist/js/3.extend.js?v=1.2

js gvuo.cz collected 2026-10-01 14:45:35 UTC 18,037 bytes, 671 lines download raw bytes

1$.fn.wrapStart = function (numWords) {
2    var node = this.contents().filter(function () {
3            return this.nodeType == 3
4        }).first(),
5        text = node.text(),
6        first = text.split(" ", numWords).join(" ");
7
8    if (!node.length)
9        return;
10
11    node[0].nodeValue = text.slice(first.length);
12    node.before('<b>' + first + '</b>');
13
14
15};
16
17$.fn.wrapEnd = function (numWords) {
18    var node = this.contents().filter(function () {
19            return this.nodeType == 3
20        }).last(),
21        text = node.text(),
22        words = text.split(" "),
23        last = words.slice(words.length - numWords).join(" ");
24
25    if (!node.length)
26        return;
27
28    node[0].nodeValue = text.slice(0, -last.length);
29    node.after('<b>' + last + '</b>');
30};
31
32$.fn.halfNewLine = function () {
33
34
35    var node = this.contents().filter(function () {
36            return this.nodeType == 3
37        }).last(),
38
39        text = node.text(),
40        words = text.split(" "),
41        oddPlusOneFix = words.length % 2 === 0 ? 0 : 1,
42        last = words.slice(((words.length + oddPlusOneFix) / 2).toFixed(2)).join(" ");
43
44    if (!node.length)
45        return;
46    if (words.length < 2)
47        return;
48
49    node[0].nodeValue = text.slice(0, -last.length);
50    node.after('<br>' + last);
51};
52
53$.fn.trimObjText = function () {
54    $(this).each(function () {
55        $(this).text($(this).text().trim())
56    });
57};
58
59$.fn.notInit = function (force)  {
60
61    force = (force == undefined) ? 0 : 1;
62    if ($(this).hasClass('js_init')) {
63        if (force) {
64            return this
65        } else {
66            return false
67        }
68
69    } else {
70        return this
71    }
72};
73
74$.fn.getWidths = function ()  {
75
76    var i = 0;
77    $(this).each(function () {
78        i += this.offsetWidth;
79    });
80    return i;
81
82};
83$.fn.getHeights = function ()  {
84
85    var i = 0;
86    $(this).each(function () {
87        i += this.offsetHeight;
88    });
89    return i;
90
91};
92
93var roundFix = function (n, toFixed)  {
94
95
96
97    toFixed = toFixed == undefined ? 0 : toFixed;
98
99    if (Math.round(n) !== n) {
100        return n.toFixed(2);
101    } else {
102        return n
103    }
104
105
106};
107
108$.fn.getMaxWidth = function (elements)  {
109
110    return Math.max.apply(null, $(elements).map(function () {
111        return $(this).outerWidth(true);
112    }).get());
113
114};
115
116$.fn.getMaxHeight = function (elements)  {
117
118    return Math.max.apply(null, $(elements).map(function () {
119        return $(this).height();
120    }).get());
121
122};
123
124$.fn.jsInit = function ()  {
125    $(this).addClass('js_init');
126    return this
127};
128
129$.fn.active = function ()  {
130    $(this).addClass('active');
131    return this
132};
133$.fn.deactive = function ()  {
134    $(this).removeClass('active');
135    return this
136};
137
138$.fn.slideOpenWaitClose = function (animTime, wait)  {
139
140    $(this)
141        .not('.slideAnim')
142        .addClass('slideAnim')
143        .slideDown(animTime)
144        .delay(wait)
145        .slideUp(animTime, function () {
146            $(this).removeClass('slideAnim')
147        });
148
149    return this
150};
151
152
153/*photoswipe start*/
154var initPhotoSwipeFromDOM = function (gallerySelector) {
155
156    // parse slide data (url, title, size ...) from DOM elements 
157    // (children of gallerySelector)
158    var parseThumbnailElements = function (el) {
159        var thumbElements = $(el).find(' figure, .js_gallery_item, .g_item'),
160            numNodes = thumbElements.length,
161            dSize = 'data-size',
162            captionsCls = 'figcaption, .g_item_caption, .js_gallery_item_caption',
163            items = [],
164            figureEl,
165            linkEl,
166            size,
167            item;
168
169
170        for (var i = 0; i < numNodes; i++) {
171
172            figureEl = thumbElements[i]; // <figure> element
173            var figureElObj = $(thumbElements)[i];
174
175            // include only element nodes 
176            if (figureEl.nodeType !== 1) {
177                continue;
178            }
179
180            linkEl = figureEl.children[0]; // <a> element
181
182            if (linkEl.getAttribute(dSize) != "undefined") {
183
184                if (linkEl.getAttribute(dSize)) {
185                    size = linkEl.getAttribute(dSize).split('x');
186                }
187
188            }
189
190            // create slide object
191            item = {
192                src: linkEl.getAttribute('href'),
193                w: parseInt(size[0], 10),
194                h: parseInt(size[1], 10)
195            };
196
197            if (figureEl.children.length > 1) {
198                // <figcaption> content
199
200
201                item.title = figureEl.children[1].innerHTML;
202
203
204            }
205
206            if (linkEl.children.length > 1) {
207
208                item.title = linkEl.children[1].innerHTML
209
210            }
211            if ($(figureEl).find(captionsCls).length > 0) {
212                item.title = $(figureEl).find(captionsCls).html()
213            }
214
215            if (linkEl.children.length > 0) {
216                // <img> thumbnail element, retrieving thumbnail url
217                item.msrc = linkEl.children[0].getAttribute('src');
218            }
219
220            item.el = figureEl; // save link to element for getThumbBoundsFn
221            items.push(item);
222
223
224
225        }
226        /*
227                console.log(items);*/
228
229        return items;
230    };
231
232    // triggers when user clicks on thumbnail
233    var onThumbnailsClick = function (e) {
234        e = e || window.event;
235        e.preventDefault ? e.preventDefault() : e.returnValue = false;
236        e.stopPropagation ? e.stopPropagation() : e.returnValue = false;
237
238        var eTarget = e.target || e.srcElement,
239            clickedGallery = $(eTarget).closest('.js_gallery'),
240            index = clickedGallery.find('a:has(img)').index($(eTarget).closest('a'));
241
242        /*console.log(eTarget, clickedGallery, index);*/
243
244        if (index >= 0) {
245            // open PhotoSwipe if valid index found
246            openPhotoSwipe(index, clickedGallery[0]);
247        }
248
249        return false;
250    };
251
252    // parse picture index and gallery index from URL (#&pid=1&gid=2)
253    var photoswipeParseHash = function () {
254        var hash = window.location.hash.substring(1),
255            params = {};
256
257        if (hash.length < 5) {
258            return params;
259        }
260
261        var vars = hash.split('&');
262        for (var i = 0; i < vars.length; i++) {
263            if (!vars[i]) {
264                continue;
265            }
266            var pair = vars[i].split('=');
267            if (pair.length < 2) {
268                continue;
269            }
270            params[pair[0]] = pair[1];
271        }
272
273        if (params.gid) {
274            params.gid = parseInt(params.gid, 10);
275        }
276
277        return params;
278    };
279
280    var openPhotoSwipe = function (index, galleryElement, disableAnimation, fromURL) {
281        var pswpElement = document.querySelectorAll('.pswp')[0],
282            gallery,
283            options,
284            items;
285
286        items = parseThumbnailElements(galleryElement);
287
288        // define options (if needed)
289        options = {
290
291            // define gallery index (for URL)
292            galleryUID: galleryElement.getAttribute('data-pswp-uid'),
293
294            getThumbBoundsFn: function (index) {
295                // See Options -> getThumbBoundsFn section of documentation for more info
296                var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
297                    pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
298                    rect = thumbnail.getBoundingClientRect();
299
300                return {
301                    x: rect.left,
302                    y: rect.top + pageYScroll,
303                    w: rect.width
304                };
305            }
306
307        };
308
309        // PhotoSwipe opened from URL
310        if (fromURL) {
311            if (options.galleryPIDs) {
312                // parse real index when custom PIDs are used 
313                // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
314                for (var j = 0; j < items.length; j++) {
315                    if (items[j].pid == index) {
316                        options.index = j;
317                        break;
318                    }
319                }
320            } else {
321                // in URL indexes start from 1
322                options.index = parseInt(index, 10) - 1;
323            }
324        } else {
325            options.index = parseInt(index, 10);
326        }
327
328        // exit if index not found
329        if (isNaN(options.index)) {
330            return;
331        }
332
333        if (disableAnimation) {
334            options.showAnimationDuration = 0;
335        }
336
337        // Pass data to PhotoSwipe and initialize it
338        gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
339        gallery.init();
340
341        gallery.listen('close', function () {
342
343            /*$('.pswp').parent().addClass('disable');*/
344
345            /*console.log('gallery close')*/
346
347            /*$('.pswp--open').removeClass('pswp--open');
348
349            setTimeout(function () {
350                $('.pswp--open').removeClass('pswp--open');
351            }, 432)*/
352
353            setTimeout(function () {
354                $('.pswp').removeAttr('class').addClass('pswp');
355            }, 666)
356
357        });
358
359        gallery.listen('imageLoadComplete', function (index, item) {
360
361
362            if ($('a[href="' + item.src + '"]').filter('.js_gallery[data-lock="true"] a').length)  {
363                $(item.container).not('.nope').add($('.pswp__item')).on('contextmenu', function (e) {
364                    e.preventDefault();
365                    return false;
366                }).addClass('nope');
367
368                $('.pswp__button--share').remove();
369            }
370        });
371
372
373
374    };
375
376    var galleryElements = gallerySelector;
377
378    $(galleryElements).find('a:has(img)').click(onThumbnailsClick);
379
380
381    // Parse URL and open gallery if it contains #&pid=3&gid=1
382    var hashData = photoswipeParseHash(),
383        hashGallery = $('.js_gallery[data-pswp-uid="' + hashData.gid + '"]')[0];
384
385    if (hashData.pid && hashData.gid && hashGallery) {
386
387        openPhotoSwipe(hashData.pid, hashGallery, true, true);
388
389    }
390
391};
392
393// used gallery IDs array
394var usedPswpUId = [];
395
396
397/* visible js - check if is visible on page */
398
399! function (t) {
400    var i = t(window);
401    t.fn.visible = function (t, e, o) {
402        if (!(this.length < 1)) {
403            var r = this.length > 1 ? this.eq(0) : this,
404                n = r.get(0),
405                f = i.width(),
406                h = i.height(),
407                o = o ? o : "both",
408                l = e === !0 ? n.offsetWidth * n.offsetHeight : !0;
409            if ("function" == typeof n.getBoundingClientRect) {
410                var g = n.getBoundingClientRect(),
411                    u = g.top >= 0 && g.top < h,
412                    s = g.bottom > 0 && g.bottom <= h,
413                    c = g.left >= 0 && g.left < f,
414                    a = g.right > 0 && g.right <= f,
415                    v = t ? u || s : u && s,
416                    b = t ? c || a : c && a;
417                if ("both" === o) return l && v && b;
418                if ("vertical" === o) return l && v;
419                if ("horizontal" === o) return l && b
420            } else {
421                var d = i.scrollTop(),
422                    p = d + h,
423                    w = i.scrollLeft(),
424                    m = w + f,
425                    y = r.offset(),
426                    z = y.top,
427                    B = z + r.height(),
428                    C = y.left,
429                    R = C + r.width(),
430                    j = t === !0 ? B : z,
431                    q = t === !0 ? z : B,
432                    H = t === !0 ? R : C,
433                    L = t === !0 ? C : R;
434                if ("both" === o) return !!l && p >= q && j >= d && m >= L && H >= w;
435                if ("vertical" === o) return !!l && p >= q && j >= d;
436                if ("horizontal" === o) return !!l && m >= L && H >= w
437            }
438        }
439    }
440}(jQuery);
441
442
443
444/* format numbers */
445
446Number.prototype.format = function (n, x, s, c, unit) {
447    var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')',
448        num = this.toFixed(Math.max(0, ~~n));
449
450    return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || unit));
451};
452
453
454
455/* cookies register */
456
457/**
458 * Copyright (c) 2015, Matej Rumpa, Sabanero s.r.o.
459 *
460 * @author Matej Rumpa
461 * [email protected]
462 * www.sabanero.cz
463 */
464/*------ Inluded following plugin ------*/
465/*!
466 * jQuery Cookie Plugin v1.4.1
467 * https://github.com/carhartl/jquery-cookie
468 *
469 * Copyright 2006, 2014 Klaus Hartl
470 * Released under the MIT license
471 */
472(function (factory) {
473    if (typeof define === 'function' && define.amd) {
474        // AMD (Register as an anonymous module)
475        define(['jquery'], factory);
476    } else if (typeof exports === 'object') {
477        // Node/CommonJS
478        module.exports = factory(require('jquery'));
479    } else {
480        // Browser globals
481        factory(jQuery);
482    }
483}(function ($) {
484
485    var pluses = /\+/g;
486
487    function encode(s) {
488        return config.raw ? s : encodeURIComponent(s);
489    }
490
491    function decode(s) {
492        return config.raw ? s : decodeURIComponent(s);
493    }
494
495    function stringifyCookieValue(value) {
496        return encode(config.json ? JSON.stringify(value) : String(value));
497    }
498
499    function parseCookieValue(s) {
500        if (s.indexOf('"') === 0) {
501            // This is a quoted cookie as according to RFC2068, unescape...
502            s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
503        }
504
505        try {
506            // Replace server-side written pluses with spaces.
507            // If we can't decode the cookie, ignore it, it's unusable.
508            // If we can't parse the cookie, ignore it, it's unusable.
509            s = decodeURIComponent(s.replace(pluses, ' '));
510            return config.json ? JSON.parse(s) : s;
511        } catch (e) {}
512    }
513
514    function read(s, converter) {
515        var value = config.raw ? s : parseCookieValue(s);
516        return $.isFunction(converter) ? converter(value) : value;
517    }
518
519    var config = $.cookie = function (key, value, options) {
520
521        // Write
522
523        if (arguments.length > 1 && !$.isFunction(value)) {
524            options = $.extend({}, config.defaults, options);
525
526            if (typeof options.expires === 'number') {
527                var days = options.expires,
528                    t = options.expires = new Date();
529                t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
530            }
531
532            return (document.cookie = [
533                encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
534                options.path ? '; path=' + options.path : '',
535                options.domain ? '; domain=' + options.domain : '',
536                options.secure ? '; secure' : ''
537            ].join(''));
538        }
539
540        // Read
541
542        var result = key ? undefined : {},
543            // To prevent the for loop in the first place assign an empty array
544            // in case there are no cookies at all. Also prevents odd result when
545            // calling $.cookie().
546            cookies = document.cookie ? document.cookie.split('; ') : [],
547            i = 0,
548            l = cookies.length;
549
550        for (; i < l; i++) {
551            var parts = cookies[i].split('='),
552                name = decode(parts.shift()),
553                cookie = parts.join('=');
554
555            if (key === name) {
556                // If second argument (value) is a function it's a converter...
557                result = read(cookie, value);
558                break;
559            }
560
561            // Prevent storing a cookie that we couldn't decode.
562            if (!key && (cookie = read(cookie)) !== undefined) {
563                result[name] = cookie;
564            }
565        }
566
567        return result;
568    };
569
570    config.defaults = {};
571
572    $.removeCookie = function (key, options) { // Must not alter options, thu
572s extending a fresh object...
573        $.cookie(key, '', $.extend({}, options, {
574            expires: -1
575        }));
576        return !$.cookie(key);
577    };
578
579}));
580/* end of cookies register */
581
582
583
584
585$.urlParam = function (name) {
586    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
587    if (results == null) {
588        return null;
589    } else {
590        return results[1] || 0;
591    }
592}
593
594String.prototype.replaceAll = function (search, replacement) {
595    var target = this;
596    return target.replace(new RegExp(search, 'g'), replacement);
597};
598/*
599$.ajaxSetup ({
600    // Disable caching of AJAX responses
601    cache: false
602});*/
603
604function initMap() {
605
606    $(document).trigger('google_map_api_ready');
607
608    /*console.log('Google Map API ready');*/
609
610}
611
612function firstToUpperCase(str) {
613    return str.substr(0, 1).toUpperCase() + str.substr(1);
614}
615jQuery.expr[':'].contains = function (a, i, m) {
616    return jQuery(a).text().toUpperCase()
617        .indexOf(m[3].toUpperCase()) >= 0;
618};
619
620String.prototype.removeCzChars = function () {
621    var replace_map;
622
623    replace_map = {
624        'Ě': 'E',
625        'Å ': 'S',
626        'Č': 'C',
627        'Ř': 'R',
628        'Ž': 'Z',
629        'Ý': 'Y',
630        'Á': 'A',
631        'Í': 'I',
632        'É': 'E',
633        'Ú': 'U',
634        'Å®': 'U',
635        'Ď': 'D',
636        'Ť': 'T',
637        'Ň': 'N',
638    };
639
640    return this.replace(/[ĚŠČŘŽÝÁÍÉÚŮĎŤŇ]/g, function (match) {
641        return replace_map[match];
642    });
643};
644Number.prototype.pad = function (size) {
645    var s = String(this);
646    while (s.length < (size || 2)) {
647        s = "0" + s;
648    }
649    return s;
650}
651
652m203formTryInit = function () {
653
654    if (typeof m203formInit === "function") {
655        m203formInit()
656    } else {
657        if ($('script[data-id="203"]').length) {
658            $(document).on('m203ready', m203formInit);
659        }
660    }
661};
662
663var iOSfixPerformance = {
664        now: function () {
665            return 0
666        },
667        timing: {
668            domContentLoadedEventEnd: 0
669        }
670    },
671    performance = typeof performance === "object" ? performance : iOSfixPerformance;

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.