PageSourceSearch

https://waverlyfreelibrary.org/wp-content/themes/colormag-pro/asse…/jquery.new.newsTicker.js?ver=5.1.4

js waverlyfreelibrary.org collected 2026-10-08 03:23:18 UTC 19,292 bytes, 725 lines download raw bytes

1!(function (t, e) {
2	'use strict';
3	'object' == typeof module &&
4		'object' == typeof module.exports &&
5		(module.exports = t.document
6			? void 0
7			: function (t) {
8					if (!t.document)
9						throw new Error('jQuery requires a window with a document');
10				});
11})('undefined' != typeof window ? window : this),
12	(function (t) {
13		'use strict';
14		(t.breakingNews = function (e, i) {
15			var s = {
16					effect: 'scroll',
17					direction: 'ltr',
18					height: 20,
19					fontSize: 'default',
20					themeColor: 'default',
21					background: 'default',
22					borderWidth: 1,
23					radius: 2,
24					source: 'html',
25					rss2jsonApiKey: '',
26					play: !0,
27					delayTimer: 4e3,
28					scrollSpeed: 2,
29					stopOnHover: !0,
30					position: 'auto',
31					zIndex: 99999,
32				},
33				n = this;
34			n.settings = {};
35			var r = t(e),
36				o = ((e = e), r.children('.bn-label')),
37				a = r.children('.bn-news'),
38				l = a.children('ul'),
39				c = l.children('li'),
40				d = r.children('.bn-controls'),
41				f = d.find('.bn-prev').parent(),
42				h = d.find('.bn-action').parent(),
43				u = d.find('.bn-next').parent(),
44				g = !1,
45				p = !0,
46				m = l.children('li').length,
47				b = 0,
48				y = !1,
49				w = function () {
50					if (
51						(0 < o.length &&
52							('rtl' == n.settings.direction
53								? a.css({
54										right: o.outerWidth(),
55									})
56								: a.css({
57										left: o.outerWidth(),
58									})),
59						0 < d.length)
60					) {
61						var e = d.outerWidth();
62						'rtl' == n.settings.direction
63							? a.css({
64									left: e,
65								})
66							: a.css({
67									right: e,
68								});
69					}
70					if ('scroll' === n.settings.effect) {
71						var i = 0;
72						c.each(function () {
73							i += t(this).outerWidth();
74						}),
75							(i += 10),
76							l.css({
77								width: i,
78							});
79					}
80				},
81				k = function () {
82					var t = parseFloat(l.css('marginLeft'));
83					(t -= n.settings.scrollSpeed / 2),
84						l.css({
85							marginLeft: t,
86						}),
87						t <= -l.find('li:first-child').outerWidth() &&
88							(l.find('li:first-child').insertAfter(l.find('li:last-child')),
89							l.css({
90								marginLeft: 0,
91							})),
92						!1 === g &&
93							((window.requestAnimationFrame && requestAnimationFrame(k)) ||
94								setTimeout(k, 16));
95				},
96				v = function () {
97					var t = parseFloat(l.css('marginRight'));
98					(t -= n.settings.scrollSpeed / 2),
99						l.css({
100							marginRight: t,
101						}),
102						t <= -l.find('li:first-child').outerWidth() &&
103							(l.find('li:first-child').insertAfter(l.find('li:last-child')),
104							l.css({
105								marginRight: 0,
106							})),
107						!1 === g &&
108							((window.requestAnimationFrame && requestAnimationFrame(v)) ||
109								setTimeout(v, 16));
110				},
111				q = function () {
112					switch (((p = !0), n.settings.effect)) {
113						case 'typography':
114							l.find('li').hide(),
115								l.find('li').eq(b).width(30).show(),
116								l.find('li').eq(b).animate(
117									{
118										width: '100%',
119										opacity: 1,
120									},
121									1500,
122								);
123							break;
124						case 'fade':
125							l.find('li').hide(), l.find('li').eq(b).fadeIn();
126							break;
127						case 'slide-down':
128							m <= 1
129								? l.find('li').animate(
130										{
131											top: 30,
132											opacity: 0,
133										},
134										300,
135										function () {
136											t(this).css({
137												top: -30,
138												opacity: 0,
139												display: 'block',
140											}),
141												t(this).animate(
142													{
143														top: 0,
144														opacity: 1,
145													},
146													300,
147												);
148										},
149									)
150								: (l.find('li:visible').animate(
151										{
152											top: 30,
153											opacity: 0,
154										},
155										300,
156										function () {
157											t(this).hide();
158										},
159									),
160									l
161										.find('li')
162										.eq(b)
163										.css({
164											top: -30,
165											opacity: 0,
166										})
167										.show(),
168									l.find('li').eq(b).animate(
169										{
170											top: 0,
171											opacity: 1,
172										},
173										300,
174									));
175							break;
176						case 'slide-up':
177							m <= 1
178								? l.find('li').animate(
179										{
180											top: -30,
181											opacity: 0,
182										},
183										300,
184										function () {
185											t(this).css({
186												top: 30,
187												opacity: 0,
188												display: 'block',
189											}),
190												t(this).animate(
191													{
192														top: 0,
193														opacity: 1,
194													},
195													300,
196												);
197										},
198									)
199								: (l.find('li:visible').animate(
200										{
201											top: -30,
202											opacity: 0,
203										},
204										300,
205										function () {
206											t(this).hide();
207										},
208									),
209									l
210										.find('li')
211										.eq(b)
212										.css({
213											top: 30,
214											opacity: 0,
215										})
216										.show(),
217									l.find('li').eq(b).animate(
218										{
219											top: 0,
220											opacity: 1,
221										},
222										300,
223									));
224							break;
225						case 'slide-left':
226							m <= 1
227								? l.find('li').animate(
228										{
229											left: '50%',
230											opacity: 0,
231										},
232										300,
233										function () {
234											t(this).css({
235												left: -50,
236												opacity: 0,
237												display: 'block',
238											}),
239												t(this).animate(
240													{
241														left: 0,
242														opacity: 1,
243													},
244													300,
245												);
246										},
247									)
248								: (l.find('li:visible').animate(
249										{
250											left: '50%',
251											opacity: 0,
252										},
253										300,
254										function () {
255											t(this).hide();
256										},
257									),
258									l
259										.find('li')
260										.eq(b)
261										.css({
262											left: -50,
263											opacity: 0,
264										})
265										.show(),
266									l.find('li').eq(b).animate(
267										{
268											left: 0,
269											opacity: 1,
270										},
271										300,
272									));
273							break;
274						case 'slide-right':
275							m <= 1
276								? l.find('li').animate(
277										{
278											left: '-50%',
279											opacity: 0,
280										},
281										300,
282										function () {
283											t(this).css({
284												left: '50%',
285												opacity: 0,
286												display: 'block',
287											}),
288												t(this).animate(
289													{
290														left: 0,
291														opacity: 1,
292													},
293													300,
294												);
295										},
296									)
297								: (l.find('li:visible').animate(
298										{
299											left: '-50%',
300											opacity: 0,
301										},
302										300,
303										function () {
304											t(this).hide();
305										},
306									),
307									l
308										.find('li')
309										.eq(b)
310										.css({
311											left: '50%',
312											opacity: 0,
313										})
314										.show(),
315									l.find('li').eq(b).animate(
316										{
317											left: 0,
318											opacity: 1,
319										},
320										300,
321									));
322							break;
323						default:
324							l.find('li').hide(), l.find('li').eq(b).show();
325					}
326				},
327				x = function () {
328					if (((g = !1), n.settings.play))
329						switch (n.settings.effect) {
330							case 'scroll':
331								'rtl' === n.settings.direction
332									? l.width() > a.width() && v()
333									: l.width() > a.width() && k();
334								break;
335							default:
336								n.pause(),
337									(y = setInterval(function () {
338										n.next();
339									}, n.settings.delayTimer));
340						}
341				};
342			(n.init = function () {
343				if (
344					((n.settings = t.extend({}, s, i)),
345					'fixed-top' === n.settings.position
346						? r.addClass('bn-fixed-top').css({
347								'z-index': n.settings.zIndex,
348							})
349						: 'fixed-bottom' === n.settings.position &&
350							r.addClass('bn-fixed-bottom').css({
351								'z-index': n.settings.zIndex,
352							}),
353					'default' != n.settings.fontSize &&
354						r.css({
355							'font-size': n.settings.fontSize,
356						}),
357					'default' != n.settings.themeColor &&
358						(r.css({
359							'border-color': n.settings.themeColor,
360							color: n.settings.themeColor,
361						}),
362						o.css({
363							background: n.settings.themeColor,
364						})),
365					'default' != n.settings.background &&
366						r.css({
367							background: n.settings.background,
368						}),
369					r.css({
370						height: n.settings.height,
371						'line-height':
372							n.settings.height - 2 * n.settings.borderWidth + 'px',
373						'border-radius': n.settings.radius,
374						'border-width': n.settings.borderWidth,
375					}),
376					c.find('.bn-seperator').css({
377						height: n.settings.height - 2 * n.settings.borderWidth,
378					}),
379					r.addClass(
380						'bn-effect-' +
381							n.settings.effect +
382							' bn-direction-' +
383							n.settings.direction,
384					),
385					w(),
386					'object' == typeof n.settings.source)
387				)
388					switch (n.settings.source.type) {
389						case 'rss':
390							'rss2json' === n.settings.source.usingApi
391								? (((d = new XMLHttpRequest()).onreadystatechange =
392										function () {
393											if (4 == d.readyState && 200 == d.status) {
394												var t = JSON.parse(d.responseText),
395													e = '',
396													i = '';
397												switch (n.settings.source.showingField) {
398													case 'title':
399														i = 'title';
400														break;
401													case 'description':
402														i = 'description';
403														break;
404													case 'link':
405														i = 'link';
406														break;
407													default:
408														i = 'title';
409												}
410												var s = '';
411												void 0 !== n.settings.source.seperator &&
412													void 0 !== typeof n.settings.source.seperator &&
413													(s = n.settings.source.seperator);
414												for (var r = 0; r < t.items.length; r++)
415													n.settings.source.linkEnabled
416														? (e +=
417																'<li><a target="' +
418																n.settings.source.target +
419																'" href="' +
420																t.items[r].link +
421																'">' +
422																s +
423																t.items[r][i] +
424																'</a></li>')
425														: (e +=
426																'<li><a>' + s + t.items[r][i] + '</a></li>');
427												l.empty().append(e),
428													(c = l.children('li')),
429													(m = l.children('li').length),
430													w(),
431													'scroll' != n.settings.effect && q(),
432													c.find('.bn-seperator').css({
433														height:
434															n.settings.height - 2 * n.settings.borderWidth,
435													}),
436													x();
437											}
438										}),
439									d.open(
440										'GET',
441										'https://api.rss2json.com/v1/api.json?rss_url=' +
442											n.settings.source.url +
443											'&count=' +
444											n.settings.source.limit +
445											'&api_key=' +
446											n.settings.source.rss2jsonApiKey,
447										!0,
448									),
449									d.send())
450								: ((e = new XMLHttpRequest()).open(
451										'GET',
452										'https://query.yahooapis.com/v1/public/yql?q=' +
453											encodeURIComponent(
454												'select * from rss where url="' +
455													n.settings.source.url +
456													'" limit ' +
457													n.settings.source.limit,
458											) +
459											'&format=json',
460										!0,
461									),
462									(e.onreadystatechange = function () {
463										if (4 == e.readyState)
464											if (200 == e.status) {
465												var t = JSON.parse(e.responseText),
466													i = '',
467													s = '';
468												switch (n.settings.source.showingField) {
469													case 'title':
470														s = 'title';
471														break;
472													case 'description':
473														s = 'description';
474														break;
475													case 'link':
476														s = 'link';
477														break;
478													default:
479														s = 'title';
480												}
481												var r = '';
482												'undefined' != n.settings.source.seperator &&
483													void 0 !== n.settings.source.seperator &&
484													(r = n.settings.source.seperator);
485												for (var o = 0; o < t.query.results.item.length; o++)
486													n.settings.source.linkEnabled
487														? (i +=
488																'<li><a target="' +
489																n.settings.source.target +
490																'" href="' +
491																t.query.results.item[o].link +
492																'">' +
493																r +
494																t.query.results.item[o][s] +
495																'</a></li>')
496														: (i +=
497																'<li><a>' +
498																r +
499																t.query.results.item[o][s] +
500																'</a></li>');
501												l.empty().append(i),
502													(c = l.children('li')),
503													(m = l.children('li').length),
504													w(),
505													'scroll' != n.settings.effect && q(),
506													c.find('.bn-seperator').css({
507														height:
508															n.settings.height - 2 * n.settings.borderWidth,
509													}),
510													x();
511											} else
512												l.empty().append(
513													'<li><span class="bn-loader-text">' +
514														n.settings.source.errorMsg +
515														'</span></li>',
516												);
517									}),
518									e.send(null));
519							break;
520						case 'json':
521							t.getJSON(n.settings.source.url, function (t) {
522								var e,
523									i = '';
524								e =
525									'undefined' === n.settings.source.showingField
526										? 'title'
527										: n.settings.source.showingField;
528								var s = '';
529								void 0 !== n.settings.source.seperator &&
530									void 0 !== typeof n.settings.source.seperator &&
531									(s = n.settings.source.seperator);
532								for (
533									var r = 0;
534									r < t.length && !(r >= n.settings.source.limit);
535									r++
536								)
537									n.settings.source.linkEnabled
538										? (i +=
539												'<li><a target="' +
540												n.settings.source.target +
541												'" href="' +
542												t[r].link +
543												'">' +
544												s +
545												t[r][e] +
546												'</a></li>')
547										: (i += '<li><a>' + s + t[r][e] + '</a></li>'),
548										'undefined' === t[r][e] &&
549											console.log('"' + e + '" does not exist in this json.');
550								l.empty().append(i),
551									(c = l.children('li')),
552									(m = l.children('li').length),
553									w(),
554									'scroll' != n.settings.effect && q(),
555									c.find('.bn-seperator').css({
556										height: n.settings.height - 2 * n.settings.borderWidth,
557									}),
558									x();
559							});
560							break;
561						default:
562							console.log(
563								'Please check your "source" object parameter. Incorrect Value',
564							);
565					}
566				else
567					'html' === n.settings.source
568						? ('scroll' != n.settings.effect && q(), x())
569						: console.log(
570								'Please check your "source" parameter. Incorrect Value',
571							);
572				var e, d;
573				n.settings.play
574					? h.find('span').removeClass('bn-play').addClass('bn-pause')
575					: h.find('span').removeClass('bn-pause').addClass('bn-play'),
576					r.on('mouseleave', function (e) {
577						var i = t(document.elementFromPoint(e.clientX, e.clientY)).parents(
578							'.breaking-news-ticker',
579						)[0];
580						t(this)[0] !== i &&
581							(!0 === n.settings.stopOnHover
582								? !0 === n.settings.play && n.play()
583								: !0 === n.settings.play && !0 === g && n.play());
584					}),
585					r.on('mouseenter', function () {
586						!0 === n.settings.stopOnHover && n.pause();
587					}),
588					u.on('click', function () {
589						p && ((p = !1), n.pause(), n.next());
590					}),
591					f.on('click', function () {
592						p && ((p = !1), n.pause(), n.prev());
593					}),
594					h.on('click', function () {
595						p &&
596							(h.find('span').hasClass('bn-pause')
597								? (h.find('span').removeClass('bn-pause').addClass('bn-play'),
598									n.stop())
599								: ((n.settings.play = !0),
600									h.find('span').removeClass('bn-play').addClass('bn-pause')));
601					}),
602					t(window).on('resize', function () {
603						r.width() < 480
604							? (o.hide(),
605								'rtl' == n.settings.direction
606									? a.css({
607											right: 0,
608										})
609									: a.css({
610											left: 0,
611										}))
612							: (o.show(),
613								'rtl' == n.settings.direction
614									? a.css({
615											right: o.outerWidth(),
616										})
617									: a.css({
618											left: o.outerWidth(),
619										}));
620					});
621			}),
622				(n.pause = function () {
623					(g = !0), clearInterval(y);
624				}),
625				(n.stop = function () {
626					(g = !0), (n.settings.play = !1);
627				}),
628				(n.play = function () {
629					x();
630				}),
631				(n.next = function () {
632					!(function () {
633						switch (n.settings.effect) {
634							case 'scroll':
635								'rtl' === n.settings.direction
636									? l.stop().animate(
637											{
638												marginRight: -l.find('li:first-child').outerWidth(),
639											},
640											300,
641											function () {
642												l
643													.find('li:first-child')
644													.insertAfter(l.find('li:last-child')),
645													l.css({
646														marginRight: 0,
647													}),
648													(p = !0);
649											},
650										)
651									: l.stop().animate(
652											{
653												marginLeft: -l.find('li:first-child').outerWidth(),
654											},
655											300,
656											function () {
657												l
658													.find('li:first-child')
659													.insertAfter(l.find('li:last-child')),
660													l.css({
661														marginLeft: 0,
662													}),
663													(p = !0);
664											},
665										);
666								break;
667							default:
668								m <= ++b && (b = 0), q();
669						}
670					})();
671				}),
672				(n.prev = function () {
673					!(function () {
674						switch (n.settings.effect) {
675							case 'scroll':
676								'rtl' === n.settings.direction
677									? (0 <= parseInt(l.css('marginRight'), 10) &&
678											(l.css({
679												'margin-right': -l.find('li:last-child').outerWidth(),
680											}),
681											l
682												.find('li:last-child')
683												.insertBefore(l.find('li:first-child'))),
684										l.stop().animate(
685											{
686												marginRight: 0,
687											},
688											300,
689											function () {
690												p = !0;
691											},
692										))
693									: (0 <= parseInt(l.css('marginLeft'), 10) &&
694											(l.css({
695												'margin-left': -l.find('li:last-child').outerWidth(),
696											}),
697											l
698												.find('li:last-child')
699												.insertBefore(l.find('li:first-child'))),
700										l.stop().animate(
701											{
702												marginLeft: 0,
703											},
704											300,
705											function () {
706												p = !0;
707											},
708										));
709								break;
710							default:
711								--b < 0 && (b = m - 1), q();
712						}
713					})();
714				}),
715				n.init();
716		}),
717			(t.fn.breakingNews = function (e) {
718				return this.each(function () {
719					if (null == t(this).data('breakingNews')) {
720						var i = new t.breakingNews(this, e);
721						t(this).data('breakingNews', i);
722					}
723				});
724			});
725	})(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.