PageSourceSearch

https://www.ps2gameshop.nl/js/light/light_product_image_gallery.js?ver=4.7.4

js ps2gameshop.nl collected 2026-10-08 23:44:12 UTC 9,146 bytes, 223 lines download raw bytes

1
2(function(_, $) {
3
4    var ITEMS_COUNT_DEFAULT = 3;
5    var scroller_type;
6
7    var methods = {
8        init: function() {
9            var container = $(this);
10            var params = {
11                items_count: container.data('caItemsCount') ? container.data('caItemsCount') : ITEMS_COUNT_DEFAULT,
12                items_responsive: container.data('caItemsResponsive') ? true : false
13            };
14
15            if (container.hasClass('jcarousel-skin') || container.parent().hasClass('jcarousel-skin')) {
16                scroller_type = 'jcarousel';
17            } else {
18                scroller_type = 'owlcarousel';
19            }
20
21            if (methods.countElms(container) <= params.items_count) {
22                container.removeClass('owl-carousel');
23            }
24
25            if (methods.countElms(container) > params.items_count || (container.hasClass('jcarousel-skin') && methods.countElms(container) > params.items_count)) {
26                if (container.data('owl-carousel') || container.data('jcarousel')) {
27                    return true;
28                }
29
30                methods.check(container, params);
31            }
32
33            methods.bind(container);
34
35            return true;
36        },
37
38        load: function(container, params) {
39            if (scroller_type == 'owlcarousel') {
40                container.owlCarousel({
41                    items: params.items_count,
42                    loop: true,
43                    nav: true,
44                    dots: false,
45                    lazyLoad: true,
46                    navText: params.items_count == 1 ? ['<i class="icon-left-circle ty-icon-left-circle"></i>', '<i class="icon-right-circle ty-icon-right-circle"></i>'] : ['<i class="icon-left-open-thin ty-icon-left-open-thin"></i>', '<i class="icon-right-open-thin ty-icon-right-open-thin"></i>'],
47                });
48            } else {
49                $('li', container).show();
50                container.jcarousel({
51                    scroll: 1,
52                    wrap: 'circular',
53                    animation: 'fast',
54                    initCallback: $.ceScrollerMethods.init_callback,
55                    itemFallbackDimension: params.i_width,
56                    item_width: params.i_width,
57                    item_height: params.i_height,
58                    clip_width: params.c_width,
59                    clip_height: params.i_height,
60                    buttonNextHTML: '<div><i class="icon-right-open-thin ty-icon-right-open-thin"></i></div>',
61                    buttonPrevHTML: '<div><i class="icon-left-open-thin ty-icon-left-open-thin"></i></div>',
62                    buttonNextEvent: 'click',
63                    buttonPrevEvent: 'click',
64                    size: methods.countElms(container)
65                });
66            }
67        },
68
69        check: function(container, params) {
70            if (container.data('owl-carousel') || container.data('jcarousel')) {
71                return true;
72            }
73
74            if (!params.i_width || !params.i_height) {
75                var t_elm = false;
76
77                if ($('.cm-gallery-item', container).length) {
78                    var load = false;
79
80                    // check images are loaded
81                    $('.cm-gallery-item', container).each(function() {
82                        var elm = $(this);
83                        var i_elm = $('img', elm);
84
85                        if (i_elm.length) {
86                            if (elm.outerWidth() >= i_elm.width()) {
87                                // find first loaded image
88                                t_elm = elm;
89                                return false;
90                            }
91                            load = true;
92                        }
93                    });
94                    if (!t_elm) {
95                        if (load) {
96                            var check_load = function() {
97                                methods.check(container, params);
98                            }
99                            // wait until image is loaded
100                            setTimeout(check_load, 500);
101                            return false;
102                        } else {
103                            t_elm = $('.cm-gallery-item:first', container);
104                        }
105                    }
106                } else {
107                    t_elm = $('img:first', container);
108                }
109
110                params.i_width = t_elm.outerWidth(true);
111                params.i_height = t_elm.outerHeight(true);
112                params.c_width = params.i_width * params.items_count;
113
114                if (scroller_type == 'owlcarousel') {
115                    container.closest('.cm-image-gallery-wrapper').width(params.c_width);
116                }
117
118                container.closest('.cm-image-gallery-wrapper').width(params.c_width);
119            }
120
121            return methods.load(container, params);
122        },
123
124        bind: function(container) {
125            container.click(function(e) {
126                var jelm = $(e.target);
127                var pjelm;
128                var in_elm;
129
130                // Check elm clicking
131                if (scroller_type == 'owlcarousel') {
132                    in_elm = jelm.parents('.cm-item-gallery') || jelm.parents('div.cm-thumbnails-mini') ? true : false;
133                } else {
134                    in_elm = jelm.parents('li') || jelm.parents('div.cm-thumbnails-mini') ? true : false;
135                }
136
137                if (in_elm && !jelm.is('img')) { // Check if the object is image or SWF embed object or parent is SWF-container
138                    return false;
139                }
140
141                if (jelm.hasClass('cm-thumbnails-mini') || (pjelm = jelm.parents('a:first.cm-thumbnails-mini'))) {
142                    jelm = (pjelm && pjelm.length) ? pjelm : jelm;
143
144                    var c_id = jelm.data('caGalleryLargeId'),
145                        image_box;
146
147                    if (scroller_type == 'owlcarousel') {
148                        image_box = $('#' + c_id).closest('.cm-preview-wrapper');
149
150                        if (!image_box.length) {
151                            image_box = $('.cm-preview-wrapper:first');
152                        }
153                    } else {
154                        var jc_box = $(this).parents('.jcarousel-skin:first');
155                        image_box = (jc_box.length) ? jc_box.parents(':first') : $(this).parents(':first');
156                    }
157
158                    $('.cm-image-previewer', image_box).each(function() {
159                        if ($(this).hasClass('cm-thumbnails-mini')) {
160                            return;
161                        }
162                        var id = $(this).prop('id');
163
164                        if (id == c_id) {
165                            $('.cm-thumbnails-mini', container).removeClass('active');
166                            jelm.addClass('active');
167                            $(this).removeClass('hidden');
168                            $('div', $(this)).removeClass('hidden');
168// Special for Flash containers
169                            $('#box_' + id).removeClass('hidden');
170                        } else {
171                            $(this).addClass('hidden');
172                            $('div', $(this)).addClass('hidden');// Special for Flash containers
173                            $('#box_' + id).addClass('hidden');
174                        }
175                    });
176                }
177            });
178        },
179
180        countElms: function(container) {
181            if (scroller_type == 'owlcarousel') {
182                return $('.cm-gallery-item', container).length;
183            } else {
184                return $('li', container).length;
185            }
186        }
187    };
188
189    $.fn.ceProductImageGallery = function(method) {
190
191        if($('.jcarousel-skin').length !== 0) {
192            if(!$().jcarousel) {
193                var gelms = $(this);
194                $.getScript('js/lib/jcarousel/jquery.jcarousel.js', function() {
195                    gelms.ceProductImageGallery();
196                });
197                return false;
198            }
199        } else {
200            if (!$().owlCarousel) {
201                var gelms = $(this);
202                $.getScript('js/lib/owlcarousel/owl.carousel.min.js', function() {
203                    gelms.ceProductImageGallery();
204                });
205                return false;
206            }
207        }
208
209        return $(this).each(function(i, elm) {
210
211            // These vars are local for each element
212            var errors = {};
213
214            if (methods[method]) {
215                return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
216            } else if ( typeof method === 'object' || ! method ) {
217                return methods.init.apply(this, arguments);
218            } else {
219                $.error('ty.productimagegallery: method ' +  method + ' does not exist');
220            }
221        });
222    };
223})(Tygh, Tygh.$);

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.