PageSourceSearch

https://cargo.sale/js/addons/abt__unitheme2/product_image_gallery.js?ver=1790881503

js cargo.sale collected 2026-10-03 23:44:05 UTC 10,502 bytes, 303 lines download raw bytes

1/*******************************************************************************************
2*   ___  _          ______                     _ _                _                        *
3*  / _ \| |         | ___ \                   | (_)              | |              © 2026   *
4* / /_\ | | _____  _| |_/ /_ __ __ _ _ __   __| |_ _ __   __ _   | |_ ___  __ _ _ __ ___   *
5* |  _  | |/ _ \ \/ / ___ \ '__/ _` | '_ \ / _` | | '_ \ / _` |  | __/ _ \/ _` | '_ ` _ \  *
6* | | | | |  __/>  <| |_/ / | | (_| | | | | (_| | | | | | (_| |  | ||  __/ (_| | | | | | | *
7* \_| |_/_|\___/_/\_\____/|_|  \__,_|_| |_|\__,_|_|_| |_|\__, |  \___\___|\__,_|_| |_| |_| *
8*                                                         __/ |                            *
9*                                                        |___/                             *
10* ---------------------------------------------------------------------------------------- *
11* This is commercial software, only users who have purchased a valid license and accept    *
12* to the terms of the License Agreement can install and use this program.                  *
13* ---------------------------------------------------------------------------------------- *
14* website: https://cs-cart.alexbranding.com                                                *
15*   email: [email protected]                                                           *
16*******************************************************************************************/
17function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
18(function (_, $) {
19var ITEMS_COUNT_DEFAULT = 3;
20var scroller_type;
21var icon_left_circle = '<span class="ty-icon icon-left-circle ty-icon-left-circle"></span>',
22icon_right_circle = '<span class="ty-icon icon-right-circle ty-icon-right-circle"></span>',
23icon_left_open_thin = '<span class="ut2-icon-arrow_back_black"></span>',
24icon_right_open_thin = '<span class="ut2-icon-arrow_forward_black"></span>';
25var methods = {
26init: function init() {
27var container = $(this);
28var params = {
29items_count: container.data('caItemsCount') ? container.data('caItemsCount') : ITEMS_COUNT_DEFAULT,
30items_responsive: container.data('caItemsResponsive') ? true : false
31};
32if (container.hasClass('jcarousel-skin') || container.parent().hasClass('jcarousel-skin')) {
33scroller_type = 'jcarousel';
34} else {
35scroller_type = 'owlcarousel';
36}
37if (methods.countElms(container) <= params.items_count) {
38container.removeClass('owl-carousel');
39}
40if (methods.countElms(container) > params.items_count || container.hasClass('jcarousel-skin') && methods.countElms(container) > params.items_count) {
41if (container.data('owl-carousel') || container.data('jcarousel')) {
42return true;
43}
44methods.check(container, params);
45}
46methods.bind(container);
47return true;
48},
49load: function load(container, params) {
50if (scroller_type == 'owlcarousel') {
51container.owlCarousel({
52direction: _.language_direction,
53items: params.items_count,
54singleItem: params.items_count == 1 ? true : false,
55responsive: params.items_responsive,
56pagination: false,
57navigation: true,
58lazyLoad: true,
59navigationText: params.items_count == 1 ? [icon_left_circle, icon_right_circle] : [icon_left_open_thin, icon_right_open_thin],
60theme: params.items_count == 1 ? 'owl-one-theme' : 'owl-more-theme',
61beforeInit: function beforeInit() {
62$.ceEvent('trigger', 'ce.product_image_gallery.inner.beforeInit', [this]);
63},
64afterInit: function afterInit(item) {
65$(item).css({
66'visibility': 'visible',
67'position': 'relative'
68});
69}
70});
71} else {
72$('li', container).show();
73container.jcarousel({
74scroll: 1,
75wrap: 'circular',
76animation: 'fast',
77initCallback: $.ceScrollerMethods.init_callback,
78itemFallbackDimension: params.i_width,
79item_width: params.i_width,
80item_height: params.i_height,
81clip_width: params.c_width,
82clip_height: params.i_height,
83buttonNextHTML: '<div>' + icon_right_open_thin + '</div>',
84buttonPrevHTML: '<div>' + icon_left_open_thin + '</div>',
85buttonNextEvent: 'click',
86buttonPrevEvent: 'click',
87size: methods.countElms(container)
88});
89}
90},
91check: function check(container, params) {
92if (container.data('owl-carousel') || container.data('jcarousel') || params.i_width || params.i_height) {
93return true;
94}
95var t_elm = false;
96if ($('.cm-gallery-item', container).length) {
97var load = false;
98$('.cm-gallery-item', container).each(function () {
99var elm = $(this);
100var i_elm = $('img', elm);
101if (i_elm.length) {
102if (i_elm.attr('width') && i_elm.attr('width').length || elm.outerWidth() >= i_elm.width()) {
103t_elm = elm;
104return false;
105}
106load = true;
107}
108});
109if (!t_elm) {
110if (load) {
111var check_load = function check_load() {
112methods.check(container, params);
113};
114setTimeout(check_load, 500);
115return false;
116} else {
117t_elm = $('.cm-gallery-item:first', container);
118}
119}
120} else {
121t_elm = $('img:first', container);
122}
123params.i_width = t_elm.outerWidth(true);
124params.i_height = t_elm.outerHeight(true);
125params.c_width = params.i_width * params.items_count;
126container.closest('.cm-image-gallery-wrapper').width(params.c_width);
127return methods.load(container, params);
128},
129bind: function bind(container) {
130container.click(function (e) {
131var jelm = $(e.target);
132var pjelm;
133var in_elm;
134if (scroller_type == 'owlcarousel') {
135in_elm = jelm.parents('.cm-item-gallery') || jelm.parents('div.cm-thumbnails-mini') ? true : false;
136} else {
137in_elm = jelm.parents('li') || jelm.parents('div.cm-thumbnails-mini') ? true : false;
138}
139if (in_elm && !jelm.is('img')) {
140return false;
141}
142if (jelm.hasClass('cm-thumbnails-mini') || (pjelm = jelm.parents('a:first.cm-thumbnails-mini'))) {
143jelm = pjelm && pjelm.length ? pjelm : jelm;
144var c_id = jelm.data('caGalleryLargeId'),
145image_box;
146if (scroller_type == 'owlcarousel') {
147image_box = $('#' + c_id).closest('.cm-preview-wrapper');
148if (!image_box.length) {
149image_box = $('.cm-preview-wrapper:first');
150}
151} else {
152var jc_box = $(this).parents('.jcarousel-skin:first');
153image_box = jc_box.length ? jc_box.parents(':first') : $(this).parents(':first');
154}
155$(image_box).trigger('owl.goTo', $(jelm).data('caImageOrder') || 0);
156}
157});
158},
159countElms: function countElms(container) {
160if (scroller_type == 'owlcarousel') {
161return $('.cm-gallery-item', container).length;
162} else {
163return $('li', container).length;
164}
165}
166};
167$.fn.ceProductImageGallery = function (method) {
168if ($('.jcarousel-skin').length !== 0) {
169if (!$().jcarousel) {
170var gelms = $(this);
171$.getScript('js/lib/jcarousel/jquery.jcarousel.js', function () {
172gelms.ceProductImageGallery();
173});
174return false;
175}
176} else {
177if (!$().owlCarousel) {
178var gelms = $(this);
179$.getScript('js/lib/owlcarousel/owl.carousel.min.js', function () {
180gelms.ceProductImageGallery();
181});
182return false;
183}
184}
185return $(this).each(function (i, elm) {
186var errors = {};
187if (methods[method]) {
188return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
189} else if (_typeof(method) === 'object' || !method) {
190return methods.init.apply(this, arguments);
191} else {
192$.error('ty.productimagegallery: method ' + method + ' does not exist');
193}
194});
195};
196})(Tygh, Tygh.$);
197(function (_, $) {
198$.ceEvent('on', 'ce.commoninit', function (context) {
199var wrapper = $('.cm-preview-wrapper', context);
200var gallery_items_view = +(_.abt__ut2.settings?.products[_.abt__ut2?.details_layout]?.multiple_product_images?.[_.abt__ut2.device]||1);
201if (gallery_items_view == 2) {
202var item = gallery_items_view,
203itemsDesktop = gallery_items_view,
204itemsDesktopSmall = 2,
205itemsTablet = 1,
206itemsMobile = 1;
207}
208if (gallery_items_view == 3) {
209var item = gallery_items_view,
210itemsDesktop = gallery_items_view,
211itemsDesktopSmall = 2,
212itemsTablet = 2,
213itemsMobile = 1;
214}
215var desktop = [1400, itemsDesktop],
216desktopSmall = [1230, itemsDesktopSmall],
217tablet = [1040, itemsTablet],
218mobile = [900, itemsMobile];
219if (wrapper.length) {
220let params = {
221direction: _.language_direction,
222center: true,
223pagination: false,
224addClassActive: true,
225beforeInit: function beforeInit() {
226$.ceEvent('trigger', 'ce.product_image_gallery.beforeInit', [this]);
227},
228afterInit: function afterInit(item) {
229var thumbnails = $('.cm-thumbnails-mini', item.parents('[data-ca-previewer]')),
230previewers = $('.cm-image-previewer', item.parents('[data-ca-previewer]')),
231previousScreenX = 0,
232newScreenX = 0,
233swipeThreshold = 7;
234previewers.each(function (index, elm) {
235$(elm).data('caImageOrder', index);
236});
237thumbnails.on('click', function () {
238item.trigger('owl.goTo', $(this).data('caImageOrder') ? $(this).data('caImageOrder') : 0);
239});
240item.on('touchstart', function (e) {
241previousScreenX = e.changedTouches[0].screenX;
242});
243item.on('touchmove', function (e) {
244newScreenX = e.changedTouches[0].screenX;
245if (Math.abs(newScreenX - previousScreenX) > swipeThreshold && e.cancelable) {
246e.preventDefault();
247}
248previousScreenX = newScreenX;
249});
250$('.cm-image-previewer.hidden', item).toggleClass('hidden', false);
251$.ceEvent('trigger', 'ce.product_image_gallery.ready');
252},
253
254afterAction: function () {
255var owl = this;
256var currentIndex = typeof owl.currentItem !== 'undefined' ? owl.currentItem : 0;
257var $gallery = $(owl.$elem);
258var $parent = $gallery.parent();
259var $thumbs = $('.cm-thumbnails-mini', $parent);
260$thumbs.removeClass('active');
261$thumbs.filter('[data-ca-image-order="' + currentIndex + '"]').addClass('active');
262var $miniCarousel = $('.owl-carousel.cm-image-gallery', $parent);
263if ($miniCarousel.length) {
264var miniOwl = $miniCarousel.data('owlCarousel');
265if (miniOwl && miniOwl.currentItem !== currentIndex) {
266$miniCarousel.trigger('owl.goTo', currentIndex);
267}
268}
269$.ceEvent('trigger', 'ce.product_image_gallery.image_changed');
270}
271}
272if($('.ty-quick-view__wrapper').length) {
273params = {
274...params,
275singleItem: true,
276items: 1,
277navigation: false
278}
279} else if(gallery_items_view > 1 ) {
280params = {
281...params,
282singleItem: false,
283items: item,
284itemsDesktop: desktop,
285itemsDesktopSmall: desktopSmall,
286itemsTablet: tablet,
287itemsMobile: mobile,
288navigation: true,
289navigationText: ['<i class="ut2-icon-arrow_back_black hand ty-hand" />', '<i class="ut2-icon-arrow_forward_black hand ty-hand" />']
290}
291} else {
292params = {
293...params,
294singleItem: true,
295items: 1,
296navigation: true,
297navigationText: ['<i class="ut2-icon-arrow_back_black hand ty-hand" />', '<i class="ut2-icon-arrow_forward_black hand ty-hand" />']
298}
299}
300wrapper.owlCarousel(params);
301}
302});
303})(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.