PageSourceSearch

https://park-inn-bielefeld.de/wp-content/plugins/slide-in/js/wdsi.js?ver=1.2

js park-inn-bielefeld.de collected 2026-10-04 01:58:12 UTC 12,152 bytes, 360 lines download raw bytes

1(function ($) {
2
3var Cookies = (function () {
4	// Nabbed from MDN
5	var MdnCookies = {
6		getItem: function (sKey) {
7			if (!sKey || !this.hasItem(sKey)) { return null; }
8			return unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"), "$1"));
9		},
10
11		setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
12			if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return; }
13			var sExpires = "";
14			if (vEnd) {
15				switch (vEnd.constructor) {
16					case Number:
17						sExpires = vEnd === Infinity ? "; expires=Tue, 19 Jan 2038 03:14:07 GMT" : "; max-age=" + vEnd;
18						break;
19					case String:
20						sExpires = "; expires=" + vEnd;
21						break;
22					case Date:
23						sExpires = "; expires=" + vEnd.toGMTString();
24						break;
25				}
26			}
27			document.cookie = escape(sKey) + "=" + escape(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
28		},
29
30		removeItem: function (sKey, sPath) {
31			if (!sKey || !this.hasItem(sKey)) { return; }
32			document.cookie = escape(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sPath ? "; path=" + sPath : "");
33		},
34
35		hasItem: function (sKey) {
36			return (new RegExp("(?:^|;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
37		},
38
39		keys: function () {
40			var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
41			for (var nIdx = 0; nIdx < aKeys.length; nIdx++) { aKeys[nIdx] = unescape(aKeys[nIdx]); }
42			return aKeys;
43		}
44	};
45
46	return {
47		get: function (key) {
48			return MdnCookies.getItem(key);
49		},
50		set: function (key, value) {
51			var reshow = parseInt(_wdsi_data.reshow.timeout, 10) || 0,
52				timeout = new Date((new Date()).getTime() + (reshow * 1000)),
53				path = _wdsi_data.reshow.path,
54				cookie_name = this.create_page_key(key, value)
55
56			;
57			return MdnCookies.setItem(cookie_name, value, timeout, path);
58		},
59		remove: function (key) {
60			return MdnCookies.removeItem(key);
61		},
62		has: function (key) {
63			return MdnCookies.hasItem(key);
64		},
65		keys: function () {
66			return MdnCookies.keys();
67		},
68		create_page_key: function (key, value) {
69			hide_all = _wdsi_data.reshow.all;
70			return hide_all
71				? key
72				: (key + value.replace(/[^-_a-z0-9]/ig, '_'))
73			;
74		}
75	};
76})();
77
78function register_seen_uri () {
79	var cookie_name = _wdsi_data.reshow.name,
80		path = window.location.pathname
81	;
82	Cookies.set(cookie_name, path);
83}
84
85function cache_cookie_exists () {
86	var cookie_name = _wdsi_data.reshow.name,
87		path = window.location.pathname,
88		cookie = false
89	;
90	if (_wdsi_data.reshow.all) { // Check all-cache
91		cookie = Cookies.get(cookie_name);
92	} else { // Check page chache
93		cookie_name = Cookies.create_page_key(cookie_name, path);
94		cookie = Cookies.get(cookie_name);
95	}
96	return cookie;
97}
98
99$(function () {
100
101	// First, check if we got tricked by the cache
102	if (!!cache_cookie_exists()) return false;
103
104	// Next, if related posts content, fix the width
105	var $root = $("#wdsi-slide_in"),
106		$content = $root.find(".wdsi-slide-content"),
107		$related = $root.find(".wdsi-slide-columns"),
108		$wrap = $root.find(".wdsi-slide-wrap"),
109		$posts = $related.length ? $related.find(".wdsi-slide-col") : []
110	;
111	if ($related.length && $posts.length) {
112		var single_width = $posts.outerWidth(),
113			count = $posts.length,
114			window_width = $(window).width(),
115			padding = (count+1.5) * ($posts.outerWidth() - $posts.width()),
116			total_width = (single_width * count) + padding
117		;
118		if (total_width > window_width) {
119			// We are bigger then the screen, ouch! Hide extra posts
120			var delta = Math.ceil((total_width - window_width) / single_width),
121				iter = 0
122			;
123			count -= delta;
124			$($posts.get().reverse()).each(function () {
125				// Hide extra posts
126				if (iter >= delta) return false;
127				$(this).hide();
128				iter++;
129			});
130		} else {
131			// We have less posts then we can - snap width
132			$wrap.width(total_width);
133		}
134	}
135	// Withs fixed, carry on
136
137	var slidein_obj = [];
138	var legacy = false;
139
140	function css_support( property )
141	{
142		var div = document.createElement('div');
143		var reg = new RegExp("(khtml|moz|ms|webkit|)"+property, "i");
144		for ( var s in div.style ) {
145			if ( s.match(reg) )
146				return true;
147		}
148		return false;
149	}
150
151	function calculate_vertical_side( obj ){
152		var h = $(obj).innerHeight();
153		if ( $(obj).hasClass('wdsi-slide-top') )
154			$(obj).css('top', h*-1).data('slidein-pos', h*-1);
155		else if ( $(obj).hasClass('wdsi-slide-bottom') )
156			$(obj).css('bottom', h*-1).data('slidein-pos', h*-1);
157	}
158
159	function calculate_horizontal_side( obj ){
160		var h = $(obj).innerHeight();
161		$(obj).css('margin-top', Math.floor(h/2)*-1);
162		var w = $(obj).innerWidth();
163		if ( $(obj).hasClass('wdsi-slide-right') )
164			$(obj).css('right', w*-1).data('slidein-pos', w*-1);
165		else if ( $(obj).hasClass('wdsi-slide-left') )
166			$(obj).css('left', w*-1).data('slidein-pos', w*-1);
167	}
168
169	function slidein_scroll(){
170		if ( slidein_obj.length == 0 )
171			return; // No slide in element exists
172		var current_pos = $(window).scrollTop();
173		var height = $(document).height()-$(window).height();
174		var percentage = current_pos/height*100;
175		for ( i = 0; i < slidein_obj.length; i++ ) {
176			var obj = slidein_obj[i];
177			var start = $(obj).data('slidein-start');
178			var end = $(obj).data('slidein-end');
179			var len = $(obj).data('slidein-for');
180			var start_after = $(obj).data('slidein-after');
181			var timeout = $(obj).data('slidein-timeout');
182			if ( ! start )
183				continue;
184			var start_pos = 0;
185			var end_pos = height;
186			var start_at = 0;
187			var end_at = 0;
188			// Get start position
189			if ( start.match(/^\d+%$/) )
190				start_pos = Math.round( parseInt(start.replace(/%$/, ''), 10)/100*height );
191			else if ( $(start).length > 0 )
192				start_pos = $(start).offset().top-$(window).height();
193			start_pos = ( start_pos < 0 ) ? 0 : start_pos;
194			// Get end position
195			if ( end ){
196				if ( end.match(/^\d+%$/) )
197					end_pos = Math.round( parseInt(end.replace(/%$/, ''), 10)/100*height );
198				else if ( $(end).length > 0 )
199					end_pos = $(end).offset().top+$(end).height();
200			}
201			else if ( len && len.match(/^\d+%$/) ){
202				end_pos = Math.round( parseInt(len.replace(/%$/, ''), 10)/100*height + start_pos );
203			}
204			// Get start time
205			if ( start_after ){
206				if ( start_after.match(/^\d+s$/) )
207					start_at = Math.round( parseInt(start_after.replace(/s$/, ''), 10) );
208				else if ( start_after.match(/^\d+m$/) )
209					start_at = Math.round( parseInt(start_after.replace(/m$/, ''), 10)*60 );
210				else if ( start_after.match(/^\d+h$/) )
211					start_at = Math.round( parseInt(start_after.replace(/h$/, ''), 10)*3600 );
212			}
213			// Get end time
214			if ( timeout ){
215				if ( timeout.match(/^\d+s$/) )
216					end_at = Math.round( parseInt(timeout.replace(/s$/, ''), 10) );
217				else if ( timeout.match(/^\d+m$/) )
218					end_at = Math.round( parseInt(timeout.replace(/m$/, ''), 10)*60 );
219				else if ( timeout.match(/^\d+h$/) )
220					end_at = Math.round( parseInt(timeout.replace(/h$/, ''), 10)*3600 );
221				end_at += start_at;
222			}
223			//console.log('current_pos: '+current_pos+', height: '+height+', start: '+start+', start_pos: '+start_pos+', for: '+len+', end: '+end+', end_pos:'+end_pos+', start_at: '+start_at+', end_at: '+end_at);
224			if ( $(obj).hasClass('wdsi-slide-active') ) {
225				// Check if the end position is reached
226				if (
227					(current_pos <= height /* <-- catch imbecile mac behavior */ && current_pos > end_pos)
228					||
229					(current_pos >= 0 /* <-- catch imbecile mac behavior */ && current_pos < start_pos)
230				)
231					slidein_hide(obj);
232			} else {
233				// Check if it is on position to show
234				if ( current_pos >= start_pos && current_pos <= end_pos ){
235					slidein_show(obj, start_at);
236					if ( end_at > start_at )
237						slidein_hide(obj, end_at);
238				}
239			}
240		}
241	}
242
243	function slidein_hide(obj, timeout, closed) {
244		var $obj = $(obj);
245		if ( ! timeout ) timeout = 0;
246		if ( closed ) {
247			$obj.data('slidein-closed', '1');
248		}
249		clearTimeout($obj.data('slidein-temp-time-hide'));
250		$obj.data( 'slidein-temp-time-hide', setTimeout(function(){
251			if ( legacy && $obj.data('slidein-running') != '2' ){
252				$obj.data('slidein-running', '2');
253				$obj.removeClass('wdsi-slide-active');
254				if ( $obj.hasClass('wdsi-slide-top') )
255					$obj.stop(true).animate({top: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
256				else if ( $obj.hasClass('wdsi-slide-left') )
257					$obj.stop(true).animate({left: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
258				else if ( $obj.hasClass('wdsi-slide-right') )
259					$obj.stop(true).animate({right: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
260				else if ( $obj.hasClass('wdsi-slide-bottom') )
261					$obj.stop(true).animate({bottom: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
262			}
263			else {
264				$obj.removeClass('wdsi-slide-active');
265			}
266		}, timeout*1000) );
267	}
268
269	function slidein_show(obj, timeout) {
270		var $obj = $(obj);
271		if ( $obj.data('slidein-closed') == '1' )
272			return;
273		if ( ! timeout )
274			timeout = 0;
275		clearTimeout($(obj).data('slidein-temp-time-show'));
276		$obj.data( 'slidein-temp-time-show', setTimeout(function(){
277			if ( legacy && $obj.data('slidein-running') != '1' ){
278				$obj.data('slidein-running', '1');
279				$obj.css('visibility', 'visible');
280				if ( $obj.hasClass('wdsi-slide-top') )
281					$obj.stop(true).animate({top: 0}, 1000, legacy_show_after);
282				else if ( $obj.hasClass('wdsi-slide-left') )
283					$obj.stop(true).animate({left: 0}, 1000, legacy_show_after);
284				else if ( $obj.hasClass('wdsi-slide-right') )
285					$obj.stop(true).animate({right: 0}, 1000, legacy_show_after);
286				else if ( $obj.hasClass('wdsi-slide-bottom') )
287					$obj.stop(true).animate({bottom: 0}, 1000, legacy_show_after);
288			}
289			else {
290				$obj.addClass('wdsi-slide-active');
291			}
292		}, timeout*1000) );
293	}
294
295	function legacy_hide_after() {
296		$(this).css('visibility', 'hidden');
297		$(this).data('slidein-running', '0');
298	}
299
300	function legacy_show_after() {
301		$(this).addClass('wdsi-slide-active');
302		$(this).data('slidein-running', '0');
303	}
304
305	// if width defined in pixels on front-end, reset it when widnow width < slider and rely on 100%
306	function responsify( obj ) {
307		var $wrap = obj.find('.wdsi-slide-wrap');
308		if ( $wrap.length && $wrap.attr('style') && $wrap.attr('style').indexOf('width') >= 0 ) {
309			var slidewidth = parseInt( $wrap.attr('style').replace(/\D/g,''), 10 ),
310				winwidth = $(window).width()
311			;
312
313			if ( winwidth <= slidewidth ) {
314				$wrap.removeAttr('style');
315			}
316			$(window).resize(function() {
317				if ( $(window).width() <= slidewidth ) {
318					$wrap.removeAttr('style');
319				} else if (!$wrap.attr('style')) {
320					$wrap.width( slidewidth );
321				}
322			});
323		}
324	}
325
326	$(window).load(function(){
327		// Initiate
328		$('.wdsi-slide').each(function(){
329			var $me = $(this);
330			$me.css("display", '');
331			if ( $me.is('.wdsi-slide-top, .wdsi-slide-bottom') ) {
332				calculate_vertical_side(this);
333			}
334			if ( $me.is('.wdsi-slide-right, .wdsi-slide-left') ) {
335				calculate_horizontal_side(this);
336			}
337			$me.data('slidein-running', '0');
338			slidein_obj.push(this);
339			responsify( $me );
340		});
341		var is_timed = $("#wdsi-slide_in").length
342			? !!parseInt($("#wdsi-slide_in").attr("data-slidein-after"), 10)
343			: false
344		;
345		if ( ! css_support('transition') )
346			legacy = true;
347		if (!is_timed) $(window).scroll(slidein_scroll);
348		// Call the slidein_scroll first here, so we don't need to wait for scroll event before it show the slide in :))
349		slidein_scroll();
350	});
351
352	$('.wdsi-slide').on('click', '.wdsi-slide-close a', function(e){
353		e.preventDefault();
354		var obj = $(this).closest('.wdsi-slide');
355		slidein_hide(obj, 0, true);
356		register_seen_uri();
357	});
358
359});
360})(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.