PageSourceSearch

https://novumhouse.pl/wp-content/themes/jollyness/library/js/isotope-scripts.js?ver=4.5.3

js novumhouse.pl collected 2026-10-08 17:13:10 UTC 12,104 bytes, 292 lines download raw bytes

1
2
3
4
5jQuery(document).ready(function ($) {
6    "use strict";
7
8
9    // ========================= smartresize ===============================
10
11    /*
12     * smartresize: debounced resize event for jQuery
13     *
14     * latest version and complete README available on Github:
15     * https://github.com/louisremi/jquery.smartresize.js
16     *
17     * Copyright 2011 @louis_remi
18     * Licensed under the MIT license.
19     */
20
21    var $event = $.event,
22        dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
23        resizeTimeout;
24
25    $event.special.smartresize = {
26        setup: function() {
27            $(this).bind( "resize", $event.special.smartresize.handler );
28        },
29        teardown: function() {
30            $(this).unbind( "resize", $event.special.smartresize.handler );
31        },
32        handler: function( event, execAsap ) {
33            // Save the context
34            var context = this,
35                args = arguments;
36
37            // set correct event type
38            event.type = "smartresize";
39
40            if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
41            resizeTimeout = setTimeout(function() {
42                $event[ dispatchMethod ].apply( context, args );
43            }, execAsap === "execAsap"? 0 : 100 );
44        }
45    };
46
47    $.fn.smartresize = function( fn ) {
48        return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
49    };
50
51
52    jQuery(document).ready(function () {
53        jQuery('.isotope-masonry').each(function () {
54
55            var $portfolio_container = jQuery(this).find('.isotope-items');
56            var $sorting_buttons = jQuery(this).find('nav.portfolio-filter').find('a');
57            var $columns = jQuery(this).data('columns');
58
59            var portfolioLayout = 'fitRows';
60
61            if( $portfolio_container.hasClass('masonry_wrapper') ) {
62                portfolioLayout = 'masonry';
63            }
64
65
66            if (!$columns) {
67                $columns = 1
68            }
69
70            var colWidth = function () {
71                var w = $portfolio_container.width(),
72                    columnNum = 1,
73                    columnWidth = 0;
74                if (w > 1200) {
75                    columnNum  = 5;
76                } else if (w > 900) {
77                    columnNum  = 4;
78                } else if (w > 600) {
79                    columnNum  = 3;
80                } else if (w > 300) {
81                    columnNum  = 2;
82                }
83                columnWidth = Math.floor(w/columnNum);
84                $portfolio_container.find('.isotope-item').each(function() {
85                    var $item = $(this),
86                        multiplier_w = $item.attr('class').match(/item-w(\d)/),
87                        multiplier_h = $item.attr('class').match(/item-h(\d)/),
88                        width = multiplier_w ? columnWidth*multiplier_w[1]-4 : columnWidth-4,
89                        height = multiplier_h ? columnWidth*multiplier_h[1]*0.5-4 : columnWidth*0.5- 4,
90                        background = $item.find(".boxes_img > a > img").attr("src");
91                    if(portfolioLayout == 'masonry'){
92                    $item.find(".boxes_img").css('position','static');
93                    $item.find(".boxes_img > a").hide();
94                    $item.css({
95                        width: width,
96                        height: height,
97                        background: "transparent url('"+background+"') no-repeat center"
98                    });
99                    }
100                });
101                return columnWidth;
102            };
103
104            var sorting_buttons_show = function () {
105                $sorting_buttons.each(function () {
106
107                    var selector = jQuery(this).attr('data-filter');
108                    var count = $portfolio_container.find(selector).length;
109
110                    if (count == 0) {
111                        jQuery(this).parents('li').css('display', 'none');
112                    } else {
113                        jQuery(this).parents('li').css('display', 'inline-block');
114                    }
115
116                })
117            };
118
119            function refreshWaypoints() {
120                setTimeout(function () {
121                }, 1000);
122            }
123
124            function setPortfolio() {
125                sorting_buttons_show();
126                $portfolio_container.imagesLoaded(function () {
127                    colWidth();
128                    $portfolio_container.isotope('layout');
129                });
130            }
131
132            ////filter event
133
134            $sorting_buttons.on('click', function () {
135
136                var selector = jQuery(this).attr('data-filter');
137
138                $portfolio_container.isotope({filter: selector}, refreshWaypoints());
139
140                jQuery(this).parents('.list-inline').find('a').removeClass('active');
141                jQuery(this).addClass('active');
142
143                return false;
144            });
145
146
147
148
149            //// start up isotope with default settings
150
151            var isotope = function () {
152                $portfolio_container.isotope({
153                    resizable: true,
154                    itemSelector: '.isotope-item',
155                    layoutMode: portfolioLayout,
156                    gutter: 0,
157                    masonry: {
158                        columnWidth: colWidth(),
159                        gutterWidth: 10
160                    }
161                });
162            };
163
164
165
166            $portfolio_container.imagesLoaded(function () {
167                //initial call to setup isotope
168                isotope();
169                sorting_buttons_show();
170            });
171
172            jQuery(window).smartresize(isotope);
173
174            if (window.jollyness_pagination_data == undefined) {
175                return false;
176            }
177
178            var page_num = parseInt(jollyness_pagination_data.startPage) + 1;
179            var max_pages = parseInt(jollyness_pagination_data.maxPages);
180            var next_link = jollyness_pagination_data.nextLink;
181
182            var loaded_text = jollyness_pagination_data.loaded_text;
183
184            var container_has_isotope = false;
185
186
187            var $button = jQuery('#ajax-pagination-load-more');
188
189            if (page_num > max_pages) {
190                $button.addClass('last-page').children('span').text(loaded_text);
191            }
192
193            $button.bind('click', function () {
194
195                if (page_num <= max_pages && !jQuery(this).hasClass('loading') && !jQuery(this).hasClass('last-page')) {
196
197                    jQuery.ajax({
198                        type: 'GET',
199                        url: next_link,
200                        dataType: 'html',
201                        beforeSend: function () {
202                            $button.addClass('loading');
203                        },
204                        complete: function (XMLHttpRequest) {
205                            $button.removeClass('loading');
206
207                            if (XMLHttpRequest.status == 200 && XMLHttpRequest.responseText != '') {
208                                page_num++;
209                                next_link = next_link.replace(/\/page\/[0-9]?/, '/page/' + page_num);
210
211                                if (page_num > max_pages) {
212                                    $button.addClass('last-page').children('span').text(loaded_text);
213                                }
214
215                                if (jQuery(XMLHttpRequest.responseText).find('.isotope-masonry').length > 0) {
216                                    container_has_isotope = (typeof($portfolio_container.isotope) === 'function');
217                                    jQuery(XMLHttpRequest.responseText).find('.isotope-items').children().each(function () {
218                                        if (!container_has_isotope) {
219                                            $portfolio_container.append($(this));
220                                            jQuery('body').trigger('container-add-item', jQuery(this));
221
222                                        } else {
223                                            $portfolio_container.isotope('insert', jQuery(this), setPortfolio());
224                                            jQuery('body').trigger('isotope-add-item', jQuery(this));
225                                        }
226
227                                        jQuery('.grid-media-popup').magnificPopup({
228                                            type: 'inline',
229                                            autoHeight : true,
230                                            callbacks: {
231                                                open: function() {
232
233                                                    if(jQuery(this.content).find('.crum-owl-slider').length){
234                                                        jQuery(this.content).find('.crum-owl-slider').owlCarousel({
235                                                            loop: true,
236                                                            margin: 0,
237                                                            navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
238                                                            nav: true,
239                                                            dots: false,
240                                                            items: 1
241                                                        });
242                                                    }
243
244                                                    if(jQuery(this.content).find('.grid-video-popup').length) {
245
246                                                        var iframeHeight = jQuery(".grid-video-popup iframe").height();
247                                                        var iframeWidth = jQuery(".grid-video-popup iframe").width();
248
249                                                        jQuery(".grid-video-popup iframe").css({
250                                                            "margin-top": -iframeHeight / 2,
251                                                            "margin-left": -iframeWidth / 2
252                                                        });
253
254                                                        var embedHeight = jQuery(".grid-video-popup embed").height();
255                                                        var embedWidth = jQuery(".grid-video-popup embed").width();
256
257                                                        jQuery(".grid-video-popup embed").css({
258                                                            "margin-top": -embedHeight / 2,
259                                                            "margin-left": -embedWidth / 2
260                                                        });
261
262                                                        var videoHeight = jQuery(".grid-video-popup .wp-video").height();
263                                                        var videoWidth = jQuery(".grid-video-popup .wp-video").width();
264
265                                                        jQuery(".grid-video-popup .wp-video").css({
266                                                            "margin-top": -videoHeight / 2,
267                                                            "margin-left": -videoWidth / 2
268                                                        });
269
270                                                    }
271                                                }
272                                            }
273                                        });
274
275                                        $('[data-toggle="tooltip"]').tooltip();
276
277                                    });
278                                }
279                            }
280                        }
281                    });
282                }
283
284                return false;
285
286            });
287
288
289        });
290    });
291
292});

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.