PageSourceSearch

https://www.visitenkarterri.com/js/jquery/plugins/jquery.grab.js

js visitenkarterri.com collected 2026-09-24 21:22:06 UTC 5,169 bytes, 189 lines download raw bytes

1(function($){
2	var	extend		= $.extend,
3		mousedown	= 'mousedown',
4		mousemove	= 'mousemove',
5		mouseup		= 'mouseup',
6		touchstart	= 'touchstart',
7		touchmove	= 'touchmove',
8		touchend	= 'touchend',
9		touchcancel	= 'touchcancel';
10
11	function unbind(elem, type, func){
12		if (type.substr(0,5) !== 'touch'){ // A temporary fix for IE8 data passing problem in Jin.
13			return $(elem).unbind(type, func);
14		}
15		var fnc, i;
16		for (i=0; i<bind._binds.length; i++){
17			if (bind._binds[i].elem === elem && bind._binds[i].type === type && bind._binds[i].func === func){
18				if (document.addEventListener){
19					elem.removeEventListener(type, bind._binds[i].fnc, false);
20				} else {
21					elem.detachEvent('on'+type, bind._binds[i].fnc);
22				}
23				bind._binds.splice(i--, 1);
24			}
25		}
26	}
27
28	function bind(elem, type, func, pass){
29		if (type.substr(0,5) !== 'touch'){ // A temporary fix for IE8 data passing problem in Jin.
30			return $(elem).bind(type, pass, func);
31		}
32		var fnc, i;
33		if (bind[type]){
34			return bind[type].bind(elem, type, func, pass);
35		}
36		fnc = function(e){
37			if (!e){ // Fix some ie bugs...
38				e = window.event;
39			}
40			if (!e.stopPropagation){
41				e.stopPropagation = function(){ this.cancelBubble = true; };
42			}
43			e.data = pass;
44			func.call(elem, e);
45		};
46		if (document.addEventListener){
47			elem.addEventListener(type, fnc, false);
48		} else {
49			elem.attachEvent('on' + type, fnc);
50		}
51		bind._binds.push({elem: elem, type: type, func: func, fnc: fnc});
52	}
53
54	function grab(elem, options)
55	{
56		var data = {
57			move: {x: 0, y: 0},
58			offset: {x: 0, y: 0},
59			position: {x: 0, y: 0},
60			start: {x: 0, y: 0},
61			affects: document.documentElement,
62			stopPropagation: false,
63			preventDefault: true,
64			touch: true // Implementation unfinished, and doesn't support multitouch
65		};
66		extend(data, options);
67		data.element = elem;
68		bind(elem, mousedown, mouseDown, data);
69		if (data.touch){
70			bind(elem, touchstart, touchStart, data);
71		}
72	}
73	function ungrab(elem){
74		unbind(elem, mousedown, mousedown);
75	}
76	function mouseDown(e){
77		e.data.position.x = e.pageX;
78		e.data.position.y = e.pageY;
79		e.data.start.x = e.pageX;
80		e.data.start.y = e.pageY;
81		e.data.event = e;
82		if (e.data.onstart && e.data.onstart.call(e.data.element, e.data)){
83			return;
84		}
85		if (e.preventDefault && e.data.preventDefault){
86			e.preventDefault();
87		}
88		if (e.stopPropagation && e.data.stopPropagation){
89			e.stopPropagation();
90		}
91		bind(e.data.affects, mousemove, mouseMove, e.data);
92		bind(e.data.affects, mouseup, mouseUp, e.data);
93	}
94	function mouseMove(e){
95		if (e.preventDefault && e.data.preventDefault){
96			e.preventDefault();
97		}
98		if (e.stopPropagation && e.data.preventDefault){
99			e.stopPropagation();
100		}
101		e.data.move.x = e.pageX - e.data.position.x;
102		e.data.move.y = e.pageY - e.data.position.y;
103		e.data.position.x = e.pageX;
104		e.data.position.y = e.pageY;
105		e.data.offset.x = e.pageX - e.data.start.x;
106		e.data.offset.y = e.pageY - e.data.start.y;
107		e.data.event = e;
108		if (e.data.onmove){
109			e.data.onmove.call(e.data.element, e.data);
110		}
111	}
112	function mouseUp(e){
113		if (e.preventDefault && e.data.preventDefault){
114			e.preventDefault();
115		}
116		if (e.stopPropagation && e.data.stopPropagation){
117			e.stopPropagation();
118		}
119		unbind(e.data.affects, mousemove, mouseMove);
120		unbind(e.data.affects, mouseup, mouseUp);
121		e.data.event = e;
122		if (e.data.onfinish){
123			e.data.onfinish.call(e.data.element, e.data);
124		}
125	}
126	function touchStart(e){
127		e.data.position.x = e.touches[0].pageX;
128		e.data.position.y = e.touches[0].pageY;
129		e.data.start.x = e.touches[0].pageX;
130		e.data.start.y = e.touches[0].pageY;
131		e.data.event = e;
132		if (e.data.onstart && e.data.onstart.call(e.data.element, e.data)){
133			return;
134		}
135		if (e.preventDefault && e.data.preventDefault){
136			e.preventDefault();
137		}
138		if (e.stopPropagation && e.data.stopPropagation){
139			e.stopPropagation();
140		}
141		bind(e.data.affects, touchmove, touchMove, e.data);
142		bind(e.data.affects, touchend, touchEnd, e.data);
143	}
144	function touchMove(e){
145		if (e.preventDefault && e.data.preventDefault){
146			e.preventDefault();
147		}
148		if (e.stopPropagation && e.data.stopPropagation){
149			e.stopPropagation();
150		}
151		e.data.move.x = e.touches[0].pageX - e.data.position.x;
152		e.data.move.y = e.touches[0].pageY - e.data.position.y;
153		e.data.position.x = e.touches[0].pageX;
154		e.data.position.y = e.touches[0].pageY;
155		e.data.offset.x = e.touches[0].pageX - e.data.start.x;
156		e.data.offset.y = e.touches[0].pageY - e.data.start.y;
157		e.data.event = e;
158		if (e.data.onmove){
159			e.data.onmove.call(e.data.elem, e.data);
160		}
161	}
162	function touchEnd(e){
163		if (e.preventDefault && e.data.preventDefault){
164			e.preventDefault();
165		}
166		if (e.stopPropagation && e.data.stopPropagation){
167			e.stopPropagation();
168		}
169		unbind(e.data.affects, touchmove, touchMove);
170		unbind(e.data.affects, touchend, touchEnd);
171		e.data.event = e;
172		if (e.data.onfinish){
173			e.data.onfinish.call(e.data.element, e.data);
174		}
175	}
176
177	bind._binds = [];
178
179	$.fn.grab = function(a, b){
180		return this.each(function(){
181			return grab(this, a, b);
182		});
183	};
184	$.fn.ungrab = function(a){
185		return this.each(function(){
186			return ungrab(this, a);
187		});
188	};
189})(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.