PageSourceSearch

https://digitalwarfare.com/wp-content/plugins/marquee-image-crawle…?ver=2ec95f5eefba259a5d4c14ba1eadd97b

js digitalwarfare.com collected 2026-10-09 01:23:32 UTC 12,693 bytes, 339 lines download raw bytes

1/* 
2GNU General Public License v2 or later
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17
18License URI	: http://www.gnu.org/licenses/gpl-2.0.html
19*/
20
21function MarqueeImageCrawler(settings){
22	if(!document.createElement) return;
23	MarqueeImageCrawler.ar.push(settings);
24	MarqueeImageCrawler.run(settings.uniqueid);
25}
26
27(function(){
28	if(!document.createElement) return;
29	if(typeof opera === 'undefined'){window.opera = false;}
30	MarqueeImageCrawler.ar = [];
31
32	document.write('<style type="text/css">.marquee{white-space:nowrap;overflow:hidden;visibility:hidden;}' +
33		'#ImageCrawlerNoBorder{border:none!important;margin:0!important;}<\/style>');
34	var c = 0, tTRE = [/^\s*$/, /^\s*/, /\s*$/, /[^\/]+$/],
35	req1 = {'position': 'relative', 'overflow': 'hidden'}, defaultconfig = {
36	style: {
37		'margin': '0 auto'
38	},
39	direction: 'left',
40	speed: 2,
41	mouse: 'pause'
42	}, dash, ie = false, oldie = 0, ie5 = false, iever = 0;
43 
44	if(!ie5){
45		dash = /-(.)/g;
46		function toHump(a, b){return b.toUpperCase();};
47		String.prototype.encamel = function(){return this.replace(dash, toHump);};
48	}
49
50	if(ie && iever < 8){
51		MarqueeImageCrawler.table = [];
52		window.attachEvent('onload', function(){
53			MarqueeImageCrawler.OK = true;
54			var i = -1, limit = MarqueeImageCrawler.table.length;
55			while(++i < limit)
56			MarqueeImageCrawler.run(MarqueeImageCrawler.table[i]);
57		});
58	}
59
60	function intable(el){
61		while((el = el.parentNode))
62		if(el.tagName && el.tagName.toLowerCase() === 'table')
63		return true;
64		return false;
65	};
66
67	MarqueeImageCrawler.run = function(id){
68		if(ie && !MarqueeImageCrawler.OK && iever < 8 && intable(document.getElementById(id))){
69			MarqueeImageCrawler.table.push(id);
70			return;
71		}
72		if(!document.getElementById(id))
73			setTimeout(function(){MarqueeImageCrawler.run(id);}, 300);
74		else
75			new Marq(c++, document.getElementById(id));
76	}
77
78	function trimTags(tag){
79		var r = [], i = 0, e;
80		while((e = tag.firstChild) && e.nodeType === 3 && tTRE[0].test(e.nodeValue))
81			tag.removeChild(e);
82		while((e = tag.lastChild) && e.nodeType === 3 && tTRE[0].test(e.nodeValue))
83			tag.removeChild(e);
84		if((e = tag.firstChild) && e.nodeType === 3)
85			e.nodeValue = e.nodeValue.replace(tTRE[1], '');
86		if((e = tag.lastChild) && e.nodeType === 3)
87			e.nodeValue = e.nodeValue.replace(tTRE[2], '');
88		while((e = tag.firstChild))
89			r[i++] = tag.removeChild(e);
90		return r;
91	}
92
93	function randthem(tag){
94		var els = oldie? tag.all : tag.getElementsByTagName('*'), i = els.length, childels = [];
95		while (--i > -1){
96			if(els[i].parentNode === tag){
97				childels.push(els[i]);
98			}
99		}
100		childels.sort(function(){return 0.5 - Math.random();});
101		i = childels.length;
102		while (--i > -1){
103			tag.appendChild(childels[i]);
104		}
105	}
106
107	function Marq(c, tag){
108		var p, u, s, a, ims, ic, i, marqContent, cObj = this;
109		this.mq = MarqueeImageCrawler.ar[c];
110		if(this.mq.random){
111			if(tag.getElementsByTagName && tag.getElementsByTagName('tr').length === 1 && tag.childNodes.length === 1){
112				randthem(tag.getElementsByTagName('tr')[0]);
113			} else {
114				randthem(tag);
115			}
116		}
117		
118	for (p in defaultconfig)
119	if((this.mq.hasOwnProperty && !this.mq.hasOwnProperty(p)) || (!this.mq.hasOwnProperty && !this.mq[p]))
120	this.mq[p] = defaultconfig[p];
121	this.mq.direction = this.mq.persist && this.cookie.get(this.mq.uniqueid)? this.cookie.get(this.mq.uniqueid).split(':')[2] : this.mq.direction;
122	this.mq.style.width = !this.mq.style.width || isNaN(parseInt(this.mq.style.width))? '100%' : this.mq.style.width;
123	if(!tag.getElementsByTagName('img')[0])
124		this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? tag.offsetHeight + 3 + 'px' : this.mq.style.height;
125	else
126		this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? 'auto' : this.mq.style.height;
127	u = this.mq.style.width.split(/\d/);
128	this.cw = this.mq.style.width? [parseInt(this.mq.style.width), u[u.length - 1]] : ['a'];
129	marqContent = trimTags(tag);
130	tag.className = tag.id = '';
131	tag.removeAttribute('class', 0);
132	tag.removeAttribute('id', 0);
133	if(ie)
134	tag.removeAttribute('className', 0);
135	tag.appendChild(tag.cloneNode(false));
136	tag.className = ['marquee', c].join('');
137	tag.style.overflow = 'hidden';
138	this.c = tag.firstChild;
139	this.c.appendChild(this.c.cloneNode(false));
140	this.c.style.visibility = 'hidden';
141	a = [[req1, this.c.style], [this.mq.style, this.c.style]];
142	for (i = a.length - 1; i > -1; --i)
143	for (p in a[i][0])
144	if((a[i][0].hasOwnProperty && a[i][0].hasOwnProperty(p)) || (!a[i][0].hasOwnProperty))
145	a[i][1][p.encamel()] = a[i][0][p];
146	this.m = this.c.firstChild;
147	if(this.mq.mouse === 'pause'){
148		this.c.onmouseover = function(){cObj.mq.stopped = true;};
149		this.c.onmouseout = function(){cObj.mq.stopped = false;};
150	}
151	this.m.style.position = 'absolute';
152	this.m.style.left = '-10000000px';
153	this.m.style.whiteSpace = 'nowrap';
154	if(ie5) this.c.firstChild.appendChild((this.m = document.createElement('nobr')));
155	if(!this.mq.noAddedSpace)
156	this.m.appendChild(document.createTextNode('\xa0'));
157	for(i = 0; marqContent[i]; ++i)
158		this.m.appendChild(marqContent[i]);
159	if(ie5) this.m = this.c.firstChild;
160		ims = this.m.getElementsByTagName('img');
161	if(ims.length){
162		for(ic = 0, i = 0; i < ims.length; ++i){
163			ims[i].style.display = 'inline';
164			if(!ims[i].alt && !this.mq.noAddedAlt){
165				ims[i].alt = (tTRE[3].exec(ims[i].src)) || ('Image #' + [i + 1]);
166			if(!ims[i].title){ims[i].title = '';}
167		}
168		ims[i].style.display = 'inline';
169		ims[i].style.verticalAlign = ims[i].style.verticalAlign || 'top';
170		if(typeof ims[i].complete === 'boolean' && ims[i].complete)
171			ic++;
172		else {
173			ims[i].onload = ims[i].onerror = function(){
174			if(++ic === ims.length)
175				cObj.setup(c);
176			};
177		}
178		if(ic === ims.length)
179			this.setup(c);
180		}
181	}
182		else this.setup(c)
183	}
184
185	Marq.prototype.setup = function(c){
186		if(this.mq.setup) return;
187		this.mq.setup = this;
188		var s, w, cObj = this, exit = 10000;
189		if(this.c.style.height === 'auto')
190		this.c.style.height = this.m.offsetHeight + 4 + 'px';
191		this.c.appendChild(this.m.cloneNode(true));
192		this.m = [this.m, this.m.nextSibling];
193		if(typeof this.mq.initcontent === 'function'){
194			this.mq.initcontent.apply(this.mq, [this.m]);
195		}
196		if(this.mq.mouse === 'cursor driven'){
197			this.r = this.mq.neutral || 16;
198			this.sinc = this.mq.speed;
199			this.c.onmousemove = function(e){cObj.mq.stopped = false; cObj.directspeed(e)};
200			if(this.mq.moveatleast){
201				this.mq.speed = this.mq.moveatleast;
202			if(this.mq.savedirection){
203			if(this.mq.savedirection === 'reverse'){
204				this.c.onmouseout = function(e){
205				if(cObj.contains(e)) return;
206				cObj.mq.speed = cObj.mq.moveatleast;
207				cObj.mq.direction = cObj.mq.direction === 'right'? 'left' : 'right';};     
208			} else {
209				this.mq.savedirection = this.mq.direction;
210				this.c.onmouseout = function(e){
211				if(cObj.contains(e)) return;
212				cObj.mq.speed = cObj.mq.moveatleast;
213				cObj.mq.direction = cObj.mq.savedirection;};     
214			}
215			} else
216			this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.mq.speed = cObj.mq.moveatleast;};
217		}
218		else
219			this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.slowdeath();};
220		}
221		this.w = this.m[0].offsetWidth;
222		this.m[0].style.left = this.mq.persist && this.cookie.get(this.mq.uniqueid)? this.cookie.get(this.mq.uniqueid).split(':')[0] : 0;
223		this.c.id = 'ImageCrawlerNoBorder';
224		this.m[0].style.top = this.m[1].style.top = Math.floor((this.c.offsetHeight - this.m[0].offsetHeight) / 2 - oldie) + 'px';
225		this.c.id = '';
226		this.c.removeAttribute('id', 0);
227		this.m[1].style.left = this.mq.persist && this.cookie.get(this.mq.uniqueid)? this.cookie.get(this.mq.uniqueid).split(':')[1] : this.w + 'px';
228		s = this.mq.moveatleast? Math.max(this.mq.moveatleast, this.sinc) : (this.sinc || this.mq.speed);
229		while(this.c.offsetWidth > this.w - s && --exit){
230			w = isNaN(this.cw[0])? this.w - s : --this.cw[0];
231			if(w < 1 || this.w < Math.max(1, s)){break;}
232			this.c.style.width = isNaN(this.cw[0])? this.w - s + 'px' : --this.cw[0] + this.cw[1];
233		}
234		this.c.style.visibility = 'visible';
235		this.runit();
236	}
237
238	Marq.prototype.slowdeath = function(){
239		var cObj = this;
240		if(this.mq.speed){
241			this.mq.speed -= 1;
242			this.timer = setTimeout(function(){cObj.slowdeath();}, 100);
243		}
244	}
245
246	Marq.prototype.runit = function(){
247		var cObj = this, d = this.mq.direction === 'right'? 1 : -1;
248		if(this.mq.stopped || this.mq.stopMarquee){
249			setTimeout(function(){cObj.runit();}, 300);
250			return;
251		}
252		if(this.mq.mouse != 'cursor driven')
253			this.mq.speed = Math.max(1, this.mq.speed);
254		if(d * parseInt(this.m[0].style.left) >= this.w)
255			this.m[0].style.left = parseInt(this.m[1].style.left) - d * this.w + 'px';
256		if(d * parseInt(this.m[1].style.left) >= this.w)
257			this.m[1].style.left = parseInt(this.m[0].style.left) - d * this.w + 'px';
258		this.m[0].style.left = parseInt(this.m[0].style.left) + d * this.mq.speed + 'px';
259		this.m[1].style.left = parseInt(this.m[1].style.left) + d * this.mq.speed + 'px';
260		if(window.opera && this.mq.persist){
261			this.cookie.set(this.mq.uniqueid, this.m[0].style.left + ':' + this.m[1].style.left + ':' + this.mq.direction);
262		}
263		setTimeout(function(){cObj.runit();}, 30 + (this.mq.addDelay || 0));
264	}
265
266	Marq.prototype.cookie = {
267		set: function(n, v, d){
268			if(d){var dt = new Date(); 
269			dt.setDate(dt.getDate() + d);
270			d = '; expires=' + dt.toGMTString();}
271			document.cookie = n + '=' + escape(v) + (d || '') + '; path=/';
272			},
273			get: function(n){
274				var c = document.cookie.match('(^|;)\x20*' + n + '=([^;]*)');
275				return c? unescape(c[2]) : null;
276			},
277			kill: function(n){
278				cook.set(n, '', -1);
279			},
280			killall: function(){
281				var cookies = document.cookie.split(';'), i = cookies.length - 1;
282				for (i; i > -1; --i){
283					cook.kill(cookies[i].split('=')[0]);
284				}
285			}
286	};
287
288	Marq.prototype.directspeed = function(e){
289		e = e || window.event;
290		if(this.timer) clearTimeout(this.timer);
291			var c = this.c, w = c.offsetWidth, l = c.offsetLeft, mp = (typeof e.pageX === 'number'?
292		e.pageX : e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft) - l,
293		lb = (w - this.r) / 2, rb = (w + this.r) / 2;
294		while((c = c.offsetParent)) mp -= c.offsetLeft;
295			this.mq.direction = mp > rb? 'left' : 'right';
296		this.mq.speed = Math.round((mp > rb? (mp - rb) : mp < lb? (lb - mp) : 0) / lb * this.sinc);
297	}
298
299	Marq.prototype.contains = function(e){
300		if(e && e.relatedTarget){var c = e.relatedTarget; if(c === this.c) return true;
301		while ((c = c.parentNode)) if(c === this.c) return true;}
302		return false;
303	}
304
305	function resize(){
306		for(var s, w, m, i = 0; i < MarqueeImageCrawler.ar.length; ++i){
307			if(MarqueeImageCrawler.ar[i] && MarqueeImageCrawler.ar[i].setup){
308				m = MarqueeImageCrawler.ar[i].setup;
309				s = m.mq.moveatleast? Math.max(m.mq.moveatleast, m.sinc) : (m.sinc || m.mq.speed);
310				m.c.style.width = m.mq.style.width;
311				m.cw[0] = m.cw.length > 1? parseInt(m.mq.style.width) : 'a';
312				while(m.c.offsetWidth > m.w - s){
313				w = isNaN(m.cw[0])? m.w - s : --m.cw[0];
314				if(w < 1){break;}
315					m.c.style.width = isNaN(m.cw[0])? m.w - s + 'px' : --m.cw[0] + m.cw[1];
316				}
317			}
318		}
319	}
320
321	function unload(){
322		for(var m, i = 0; i < MarqueeImageCrawler.ar.length; ++i){
323			if(MarqueeImageCrawler.ar[i] && MarqueeImageCrawler.ar[i].persist && MarqueeImageCrawler.ar[i].setup){
324				m = MarqueeImageCrawler.ar[i].setup;
325				m.cookie.set(m.mq.uniqueid, m.m[0].style.left + ':' + m.m[1].style.left + ':' + m.mq.direction);
326			}
327		}
328	}
329
330	if (window.addEventListener){
331		window.addEventListener('resize', resize, false);
332		window.addEventListener('unload', unload, false);
333	}
334	else if (window.attachEvent){
335		window.attachEvent('onresize', resize);
336		window.attachEvent('onunload', unload);
337	}
338
339})();

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.