PageSourceSearch

https://www.shop-klausmann-schuhe-sport.de/out/flow/src/js/libs/smoothproducts.js?1583311850

js shop-klausmann-schuhe-sport.de collected 2026-10-09 03:57:48 UTC 9,675 bytes, 265 lines download raw bytes

1/*
2 * Smoothproducts version 2.0.2
3 * http://kthornbloom.com/smoothproducts.php
4 *
5 * Copyright 2013, Kevin Thornbloom
6 * Free to use and abuse under the MIT license.
7 * http://www.opensource.org/licenses/mit-license.php
8 */
9
10(function($) {
11	$.fn.extend({
12		smoothproducts: function() {
13
14			// Add some markup & set some CSS
15
16			$('.sp-loading').hide();
17			$('.sp-wrap').each(function() {
18				$(this).addClass('sp-touch');
19				var thumbQty = $('a', this).length;
20
21				// If more than one image
22				if (thumbQty > 1) {
23					var firstLarge,firstThumb,
24						defaultImage = $('a.sp-default', this)[0]?true:false;
25					$(this).append('<div class="sp-large"></div><div class="sp-thumbs sp-tb-active"></div>');
26					$('a', this).each(function(index) {
27						var thumb = $('img', this).attr('src'),
28							large = $(this).attr('href'),
29							classes = '';
30						//set default image
31						if((index === 0 && !defaultImage) || $(this).hasClass('sp-default')){
32							classes = ' class="sp-current"';
33							firstLarge = large;
34							firstThumb = $('img', this)[0].src;
35						}
36						$(this).parents('.sp-wrap').find('.sp-thumbs').append('<a href="' + large + '" style="background-image:url(' + thumb + ')"'+classes+'></a>');
37						$(this).remove();
38					});
39					$('.sp-large', this).append('<a href="' + firstLarge + '" class="sp-current-big"><img src="' + firstThumb + '" alt="" /></a>');
40					$('.sp-wrap').css('display', 'inline-block');
41				// If only one image
42				} else {
43					$(this).append('<div class="sp-large"></div>');
44					$('a', this).appendTo($('.sp-large', this)).addClass('.sp-current-big');
45					$('.sp-wrap').css('display', 'inline-block');
46				}
47			});
48
49
50			// Prevent clicking while things are happening
51			$(document.body).on('click', '.sp-thumbs', function(event) {
52				event.preventDefault();
53			});
54
55
56			// Is this a touch screen or not?
57			$(document.body).on('mouseover', function(event) {
58				$('.sp-wrap').removeClass('sp-touch').addClass('sp-non-touch');
59				event.preventDefault();
60			});
61
62			$(document.body).on('touchstart', function() {
63				$('.sp-wrap').removeClass('sp-non-touch').addClass('sp-touch');
64			});
65
66			// Clicking a thumbnail
67			$(document.body).on('click', '.sp-tb-active a', function(event) {
68
69				event.preventDefault();
70				$(this).parent().find('.sp-current').removeClass();
71				$(this).addClass('sp-current');
72				$(this).parents('.sp-wrap').find('.sp-thumbs').removeClass('sp-tb-active');
73				$(this).parents('.sp-wrap').find('.sp-zoom').remove();
74
75				var currentHeight = $(this).parents('.sp-wrap').find('.sp-large').height(),
76					currentWidth = $(this).parents('.sp-wrap').find('.sp-large').width();
77				$(this).parents('.sp-wrap').find('.sp-large').css({
78					overflow: 'hidden',
79					height: currentHeight + 'px',
80					width: currentWidth + 'px'
81				});
82
83				$(this).addClass('sp-current').parents('.sp-wrap').find('.sp-large a').remove();
84
85				var nextLarge = $(this).parent().find('.sp-current').attr('href'),
86					nextThumb = get_url_from_background($(this).parent().find('.sp-current').css('backgroundImage'));
87
88				$(this).parents('.sp-wrap').find('.sp-large').html('<a href="' + nextLarge + '" class="sp-current-big"><img src="' + nextThumb + '"/></a>');
89				$(this).parents('.sp-wrap').find('.sp-large').hide().fadeIn(250, function() {
90
91// 					var autoHeight = $(this).parents('.sp-wrap').find('.sp-large img').height();
92
93// 					$(this).parents('.sp-wrap').find('.sp-large').animate({
94// 						height: autoHeight
95// 					}, 'fast', function() {
96// 						$('.sp-large').css({
97// 							height: 'auto',
98// 							width: 'auto'
99// 						});
100// 					});
101
102					$(this).parents('.sp-wrap').find('.sp-thumbs').addClass('sp-tb-active');
103				});
104			});
105
106			// Zoom In non-touch
107// 			$(document.body).on('mouseenter', '.sp-non-touch .sp-large', function(event) {
108// 				var largeUrl = $('a', this).attr('href');
109// 				$(this).append('<div class="sp-zoom"><img src="' + largeUrl + '"/></div>');
110// 				$(this).find('.sp-zoom').fadeIn(250);
111// 				event.preventDefault();
112// 			});
113
114			// Zoom Out non-touch
115// 			$(document.body).on('mouseleave', '.sp-non-touch .sp-large', function(event) {
116// 				$(this).find('.sp-zoom').fadeOut(250, function() {
117// 					$(this).remove();
118// 				});
119// 				event.preventDefault();
120// 			});
121
122			// Open in Lightbox non-touch
123			$(document.body).on('click', '.sp-non-touch .sp-zoom', function(event) {
124				var currentImg = $(this).html(),
125					thumbAmt = $(this).parents('.sp-wrap').find('.sp-thumbs a').length,
126					currentThumb = ($(this).parents('.sp-wrap').find('.sp-thumbs .sp-current').index())+1;
127				$(this).parents('.sp-wrap').addClass('sp-selected');
128				$('body').append("<div class='sp-lightbox' data-currenteq='"+currentThumb+"'>" + currentImg + "</div>");
129
130				if(thumbAmt > 1){
131					$('.sp-lightbox').append("<a href='#' id='sp-prev'></a><a href='#' id='sp-next'></a>");
132					if(currentThumb == 1) {
133						$('#sp-prev').css('opacity','.1');
134					} else if (currentThumb == thumbAmt){
135						$('#sp-next').css('opacity','.1');
136					}
137				}
138				$('.sp-lightbox').fadeIn();
139				event.preventDefault();
140			});
141
142			// Open in Lightbox touch
143			$(document.body).on('click', '.sp-large a', function(event) {
144				var currentImg = $(this).attr('href'),
145					thumbAmt = $(this).parents('.sp-wrap').find('.sp-thumbs a').length,
146					currentThumb = ($(this).parents('.sp-wrap').find('.sp-thumbs .sp-current').index())+1;
147
148				$(this).parents('.sp-wrap').addClass('sp-selected');
149				$('body').append('<div class="sp-lightbox" data-currenteq="'+currentThumb+'"><img src="' + currentImg + '"/></div>');
150
151				if(thumbAmt > 1){
152					$('.sp-lightbox').append("<a href='#' id='sp-prev'></a><a href='#' id='sp-next'></a>");
153					if(currentThumb == 1) {
154						$('#sp-prev').css('opacity','.1');
155					} else if (currentThumb == thumbAmt){
156						$('#sp-next').css('opacity','.1');
157					}
158				}
159				$('.sp-lightbox').fadeIn();
160				event.preventDefault();
161			});
162
163			// Pagination Forward
164			$(document.body).on('click', '#sp-next', function(event) {
165				event.stopPropagation();
166				var currentEq = $('.sp-lightbox').data('currenteq'),
167					totalItems = $('.sp-selected .sp-thumbs a').length;
168
169					if(currentEq >= totalItems) {
170					} else {
171						var nextEq = currentEq + 1,
172						newImg = $('.sp-selected .sp-thumbs').find('a:eq('+currentEq+')').attr('href'),
173						newThumb = get_url_from_background($('.sp-selected .sp-thumbs').find('a:eq('+currentEq+')').css('backgroundImage'));
174						if (currentEq == (totalItems - 1)) {
175							$('#sp-next').css('opacity','.1');
176						}
177						$('#sp-prev').css('opacity','1');
178						$('.sp-selected .sp-current').removeClass();
179						$('.sp-selected .sp-thumbs a:eq('+currentEq+')').addClass('sp-current');
180						$('.sp-selected .sp-large').empty().append('<a href='+newImg+'><img src="'+newThumb+'"/></a>');
181						$('.sp-lightbox img').fadeOut(250, function() {
182							$(this).remove();
183							$('.sp-lightbox').data('currenteq',nextEq).append('<img src="'+newImg+'"/>');
184							$('.sp-lightbox img').hide().fadeIn(250);
185						});
186					}
187
188				event.preventDefault();
189			});
190
191		// Pagination Backward
192			$(document.body).on('click', '#sp-prev', function(event) {
193
194				event.stopPropagation();
195				var currentEq = $('.sp-lightbox').data('currenteq'),
196					currentEq = currentEq - 1;
197					if(currentEq <= 0) {
198					} else {
199						if (currentEq == 1) {
200							$('#sp-prev').css('opacity','.1');
201						}
202						var nextEq = currentEq - 1,
203						newImg = $('.sp-selected .sp-thumbs').find('a:eq('+nextEq+')').attr('href'),
204						newThumb = get_url_from_background($('.sp-selected .sp-thumbs').find('a:eq('+nextEq+')').css('backgroundImage'));
205						$('#sp-next').css('opacity','1');
206						$('.sp-selected .sp-current').removeClass();
207						$('.sp-selected .sp-thumbs a:eq('+nextEq+')').addClass('sp-current');
208						$('.sp-selected .sp-large').empty().append('<a href='+newImg+'><img src="'+newThumb+'"/></a>');
209						$('.sp-lightbox img').fadeOut(250, function() {
210							$(this).remove();
211							$('.sp-lightbox').data('currenteq',currentEq).append('<img src="'+newImg+'"/>');
212							$('.sp-lightbox img').hide().fadeIn(250);
213						});
214					}
215				event.preventDefault();
216			});
217
218
219			// Close Lightbox
220			$(document.body).on('click', '.sp-lightbox', function() {
221				closeModal();
222			});
223
224			// Close on Esc
225			$(document).keydown(function(e) {
226				if (e.keyCode == 27) {
227					closeModal();
228					return false;
229				}
230			});
231
232			function closeModal (){
233				$('.sp-selected').removeClass('sp-selected');
234				$('.sp-lightbox').fadeOut(function() {
235						$(this).remove();
236				});
237			}
238
239
240			// Panning zoomed image (non-touch)
241
242			$('.sp-large').mousemove(function(e) {
243				var viewWidth = $(this).width(),
244					viewHeight = $(this).height(),
245					largeWidth = $(this).find('.sp-zoom').width(),
246					largeHeight = $(this).find('.sp-zoom').height(),
247					parentOffset = $(this).parent().offset(),
248					relativeXPosition = (e.pageX - parentOffset.left),
249					relativeYPosition = (e.pageY - parentOffset.top),
250					moveX = Math.floor((relativeXPosition * (viewWidth - largeWidth) / viewWidth)),
251					moveY = Math.floor((relativeYPosition * (viewHeight - largeHeight) / viewHeight));
252
253				$(this).find('.sp-zoom').css({
254					left: moveX,
255					top: moveY
256				});
257
258			});
259
260			function get_url_from_background(bg){
261				return bg.match(/url\([\"\']{0,1}(.+)[\"\']{0,1}\)+/i)[1];
262			}
263		}
264	});
265})(jQuery);

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.