PageSourceSearch

https://sib.org.bz/wp-content/plugins/newscodes/lib/js/newscodes.js?ver=2.2.1

js sib.org.bz collected 2026-09-24 22:12:20 UTC 13,774 bytes, 387 lines download raw bytes

1;(function(e){e.fn.nc_marquee=function(t){return this.each(function(){var n=e.extend({},e.fn.nc_marquee.defaults,t),r=e(this),i,s,o,u,a,f=3,l="animation-play-state",c=false,h=function(e,t,n){var r=["webkit","moz","MS","o",""];for(var i=0;i<r.length;i++){if(!r[i])t=t.toLowerCase();e.addEventListener(r[i]+t,n,false)}},p=function(e){var t=[];for(var n in e){if(e.hasOwnProperty(n)){t.push(n+":"+e[n])}}t.push();return"{"+t.join(",")+"}"},d=function(){r.timer=setTimeout(M,n.delayBeforeStart)},v={pause:function(){if(c&&n.allowCss3Support){i.css(l,"paused")}else{if(e.fn.pause){i.pause()}}r.data("runningStatus","paused");r.trigger("paused")},resume:function(){if(c&&n.allowCss3Support){i.css(l,"running")}else{if(e.fn.resume){i.resume()}}r.data("runningStatus","resumed");r.trigger("resumed")},toggle:function(){v[r.data("runningStatus")=="resumed"?"pause":"resume"]()},destroy:function(){clearTimeout(r.timer);r.find("*").andSelf().unbind();r.html(r.find(".js-marquee:first").html())}};if(typeof t==="string"){if(e.isFunction(v[t])){if(!i){i=r.find(".js-marquee-wrapper")}if(r.data("css3AnimationIsSupported")===true){c=true}v[t]()}return}var m={},g;e.each(n,function(e,t){g=r.attr("data-"+e);if(typeof g!=="undefined"){switch(g){case"true":g=true;break;case"false":g=false;break}n[e]=g}});n.duration=n.speed||n.duration;u=n.direction=="up"||n.direction=="down";n.gap=n.duplicated?parseInt(n.gap):0;r.wrapInner('<div class="js-marquee"></div>');var y=r.find(".js-marquee").css({"margin-right":n.gap,"float":"left"});if(n.duplicated){y.clone(true).appendTo(r)}r.wrapInner('<div style="width:100000px" class="js-marquee-wrapper"></div>');i=r.find(".js-marquee-wrapper");if(u){var b=r.height();i.removeAttr("style");r.height(b);r.find(".js-marquee").css({"float":"none","margin-bottom":n.gap,"margin-right":0});if(n.duplicated)r.find(".js-marquee:last").css({"margin-bottom":0});var w=r.find(".js-marquee:first").height()+n.gap;n.duration=(parseInt(w,10)+parseInt(b,10))/parseInt(b,10)*n.duration}else{a=r.find(".js-marquee:first").width()+n.gap;s=r.width();n.duration=(parseInt(a,10)+parseInt(s,10))/parseInt(s,10)*n.duration}if(n.duplicated){n.duration=n.duration/2}if(n.allowCss3Support){var E=document.body||document.createElement("div"),S="marqueeAnimation-"+Math.floor(Math.random()*1e7),x="Webkit Moz O ms Khtml".split(" "),T="animation",N="",C="";if(E.style.animation){C="@keyframes "+S+" ";c=true}if(c===false){for(var k=0;k<x.length;k++){if(E.style[x[k]+"AnimationName"]!==undefined){var L="-"+x[k].toLowerCase()+"-";T=L+T;l=L+l;C="@"+L+"keyframes "+S+" ";c=true;break}}}if(c){N=S+" "+n.duration/1e3+"s "+n.delayBeforeStart/1e3+"s infinite "+n.css3easing;r.data("css3AnimationIsSupported",true)}}var A=function(){i.css("margin-top",n.direction=="up"?b+"px":"-"+w+"px")},O=function(){i.css("margin-left",n.direction=="left"?s+"px":"-"+a+"px")};if(n.duplicated){if(u){i.css("margin-top",n.direction=="up"?b:"-"+(w*2-n.gap)+"px")}else{i.css("margin-left",n.direction=="left"?s+"px":"-"+(a*2-n.gap)+"px")}f=1}else{if(u){A()}else{O()}}var M=function(){if(n.duplicated){if(f===1){n._originalDuration=n.duration;if(u){n.duration=n.direction=="up"?n.duration+b/(w/n.duration):n.duration*2}else{n.duration=n.direction=="left"?n.duration+s/(a/n.duration):n.duration*2}if(N){N=S+" "+n.duration/1e3+"s "+n.delayBeforeStart/1e3+"s "+n.css3easing}f++}else if(f===2){n.duration=n._originalDuration;if(N){S=S+"0";C=e.trim(C)+"0 ";N=S+" "+n.duration/1e3+"s 0s infinite "+n.css3easing}f++}}if(u){if(n.duplicated){if(f>2){i.css("margin-top",n.direction=="up"?0:"-"+w+"px")}o={"margin-top":n.direction=="up"?"-"+w+"px":0}}else{A();o={"margin-top":n.direction=="up"?"-"+i.height()+"px":b+"px"}}}else{if(n.duplicated){if(f>2){i.css("margin-left",n.direction=="left"?0:"-"+a+"px")}o={"margin-left":n.direction=="left"?"-"+a+"px":0}}else{O();o={"margin-left":n.direction=="left"?"-"+a+"px":s+"px"}}}r.trigger("beforeStarting");if(c){i.css(T,N);var t=C+" { 100%  "+p(o)+"}",l=e("style");if(l.length!==0){l.filter(":last").append(t)}else{e("head").append("<style>"+t+"</style>")}h(i[0],"AnimationIteration",function(){r.trigger("finished")});h(i[0],"AnimationEnd",function(){M();r.trigger("finished")})}else{i.animate(o,n.duration,n.easing,function(){r.trigger("finished");
1if(n.pauseOnCycle){d()}else{M()}})}r.data("runningStatus","resumed")};r.bind("pause",v.pause);r.bind("resume",v.resume);if(n.pauseOnHover){r.bind("mouseenter mouseleave",v.toggle)}if(c&&n.allowCss3Support){M()}else{d()}})};e.fn.nc_marquee.defaults={allowCss3Support:true,css3easing:"linear",easing:"linear",delayBeforeStart:1e3,direction:"left",duplicated:false,duration:5e3,gap:20,pauseOnCycle:false,pauseOnHover:false}})(jQuery);
2
3(function($){
4
5if ( typeof nc.fonts === 'object' ) {
6	$.each( nc.fonts, function(e,f) {
7		$('head').append('<link href="'+f+'" rel="stylesheet" type="text/css">');
8	});
9}
10
11$.fn.nc_ticker = function(options) {
12	var defaults = {
13		speed: 700,
14		pause: 4000,
15		showItems: 3,
16		animation: '',
17		mousePause: true,
18		isPaused: false,
19		direction: 'up',
20		height: 0
21	};
22
23	options = $.extend(defaults, options);
24
25	moveUp = function(obj2, height, options){
26		if(options.isPaused)
27			return;
28		
29		var obj = obj2.children('ul.newscodes-wrap');
30		
31		var clone = obj.children('li:first').clone(true);
32		
33		if(options.height > 0)
34		{
35			height = obj.children('li:first').height();
36		}		
37		
38		obj.animate({top: '-=' + height + 'px'}, options.speed, function() {
39			$(this).children('li:first').remove();
40			$(this).css('top', '0px');
41		});
42		
43		if(options.animation == 'fade')
44		{
45			obj.children('li:first').fadeOut(options.speed);
46			if(options.height == 0)
47			{
48			obj.children('li:eq(' + options.showItems + ')').hide().fadeIn(options.speed).show();
49			}
50		}
51
52		clone.appendTo(obj);
53	};
54	
55	moveDown = function(obj2, height, options){
56		if(options.isPaused)
57			return;
58		
59		var obj = obj2.children('ul.newscodes-wrap');
60		
61		var clone = obj.children('li:last').clone(true);
62		
63		if(options.height > 0)
64		{
65			height = obj.children('li:first').height();
66		}
67		
68		obj.css('top', '-' + height + 'px')
69			.prepend(clone);
70			
71		obj.animate({top: 0}, options.speed, function() {
72			$(this).children('li:last').remove();
73		});
74		
75		if(options.animation == 'fade')
76		{
77			if(options.height == 0)
78			{
79				obj.children('li:eq(' + options.showItems + ')').fadeOut(options.speed);
80			}
81			obj.children('li:first').hide().fadeIn(options.speed).show();
82		}
83	};
84	
85	return this.each(function() {
86		var obj = $(this);
87		var maxHeight = 0;
88
89		obj.css({overflow: 'hidden', position: 'relative'})
90			.children('ul.newscodes-wrap').css({position: 'absolute', margin: 0, padding: 0, width: '100%'})
91			.children('li').css({margin: 0, padding: 0});
92
93		if(options.height == 0)
94		{
95			obj.children('ul.newscodes-wrap').children('li').each(function(){
96				if($(this).height() > maxHeight)
97				{
98					maxHeight = $(this).height();
99				}
100			});
101
102			obj.children('ul.newscodes-wrap').children('li').each(function(){
103				$(this).height(maxHeight);
104			});
105
106			obj.height(maxHeight * options.showItems );
107
108		}
109		else
110		{
111			obj.height(options.height);
112		}
113
114		setInterval(function(){ 
115			var currMaxHeight = typeof nc.instances[obj.attr('ID')].maxHeight === 'undefined' ? maxHeight : nc.instances[obj.attr('ID')].maxHeight;
116			if(options.direction == 'up')
117			{ 
118				moveUp(obj, currMaxHeight, options); 
119			}
120			else
121			{ 
122				moveDown(obj, currMaxHeight, options); 
123			} 
124		}, options.pause);
125		
126		if(options.mousePause)
127		{
128			obj.bind("mouseenter",function(){
129				options.isPaused = true;
130			}).bind("mouseleave",function(){
131				options.isPaused = false;
132			});
133		}
134	});
135};
136})(jQuery);
137
138(function($){
139"use strict";
140
141	String.prototype.getAttr = function (k) {
142		var p = new RegExp('\\b' + k + '\\b', 'gi');
143		return this.search(p) != -1 ? decodeURIComponent(this.substr(this.search(p) + k.length + 1).substr(0, this.substr(this.search(p) + k.length + 1).search(/(&|;|$)/))) : "";
144	};
145
146	var nc_loading = 'notactive';
147
148	function nc_ajax( settings ) {
149
150		var data = {
151			action: 'nc_ajax_factory',
152			nc_settings: settings
153		};
154
155		return $.ajax({
156			type: 'POST',
157			url: nc.ajax,
158			data: data,
159			success: function(response) {
160				nc_loading = 'notactive';
161			},
162			error: function() {
163				$.alert({
164					title: 'Error',
165					content: 'AJAX Error!'
166				});
167				nc_loading = 'notactive';
168			}
169		});
170
171	}
172
173	function nc_resize() {
174
175		$('.newscodes.nc-type-news-ticker-tiny, .newscodes.nc-type-news-ticker, .newscodes.nc-type-news-ticker-compact').each(function() {
176
177			var obj = $(this);
178			var maxHeight = 0;
179			var showItems = nc.instances[obj.attr('ID')].atts.ticker_visible;
180
181			obj.removeAttr('style');
182			obj.children('ul.newscodes-wrap').removeAttr('style');
183			obj.children('ul.newscodes-wrap').children('li').removeAttr('style');
184
185			obj.css({overflow: 'hidden', position: 'relative'})
186			.children('ul.newscodes-wrap').css({position: 'absolute', margin: 0, padding: 0, width: '100%'})
187			.children('li').css({margin: 0, padding: 0});
188
189			obj.children('ul.newscodes-wrap').children('li').each(function(){
190				if($(this).height() > maxHeight)
191				{
192					maxHeight = $(this).height();
193				}
194			});
195
196			obj.children('ul.newscodes-wrap').children('li').each(function(){
197				$(this).height(maxHeight);
198			});
199
200			obj.height(maxHeight * showItems );
201
202			nc.instances[obj.attr('ID')].maxHeight = maxHeight;
203
204		});
205
206	}
207
208	$(document).on( 'click', '.newscodes[data-ajax="true"] .newscodes-pagination a', function() {
209		if ( nc_loading == 'active' ) {
210			return false;
211		}
212		nc_loading = 'active';
213
214		var wrap = $(this).closest('.newscodes');
215		var href = $(this).attr('href');
216
217		wrap.addClass('nc-loading');
218
219		var settings = {
220			'paged' : href.indexOf('paged=') >= 0 ? href.getAttr('paged') : 1,
221			'instance' : nc.instances[wrap.attr('ID')]
222		};
223
224		$.when( nc_ajax( settings ) ).done( function(response) {
225
226			wrap.after($(response));
227			var newWrap = wrap.next();
228
229			newWrap.css({'margin-top':-parseInt(wrap.outerHeight(), 10)-parseInt(wrap.css('margin-bottom'), 10)+'px'}).fadeIn(300, function() {
230				//$(this).removeAttr('style');
231			});
232
233			wrap.fadeOut(300, function() {
234				$(this).remove();
235				newWrap.removeClass('newscodes-ajax-return').removeAttr('style');
236			});
237
238		});
239
240		return false;
241
242	});
243
244	$(document).on( 'click', '.newscodes[data-ajax="true"] .newscodes-load-more .nc-load-more', function() {
245		if ( nc_loading == 'active' ) {
246			return false;
247		}
248		nc_loading = 'active';
249
250		var wrap = $(this).closest('.newscodes');
251		var offset = wrap.find('li').length;
252
253		wrap.addClass('nc-loading');
254
255		var settings = {
256			'offset' : offset,
257			'instance' : nc.instances[wrap.attr('ID')]
258		};
259
260		$.when( nc_ajax( settings ) ).done( function(response) {
261
262			if ($(response).find('li').length==0) {
263				wrap.find('.newscodes-load-more').fadeOut(300, function() {
264					$(this).remove();
265				});
266			}
267			else {
268				if (!wrap.hasClass('nc-type-news-columned-featured-list','nc-type-news-columned-featured-list-tiny','nc-type-news-columned-featured-compact')){
269					$(response).find('li').each( function(i, el) {
270						wrap.find('ul').append(el);
271						var added = wrap.find('ul li:last');
272						added.hide();
273						setTimeout(function() {
274							added.fadeIn();
275						}, (i++)*100);
276					});
277				}
278				else {
279					if (wrap.find('.newscodes-wrap-load-more').length==0) {
280						wrap.find('ul:eq(1)').after($('<ul class="newscodes-wrap newscodes-wrap-load-more"></ul>'));
281					}
282					var newWrap = wrap.find('.newscodes-wrap-load-more');
283					$(response).find('li').each( function(i, el) {
284						newWrap.append(el);
285						var added = newWrap.find('li:last');
286						added.hide();
287						setTimeout(function() {
288							added.fadeIn();
289						}, (i++)*100);
290					});
291				}
292			}
293
294
295			wrap.removeClass('nc-loading');
296
297
298		});
299
300		return false;
301
302	});
303
304	$('.newscodes.nc-type-news-marquee').each( function() {
305
306		var el = $(this);
307
308		el.find('.newscodes-wrap').nc_marquee({
309			duration: 10000,
310			delayBeforeStart: 0,
311			duplicated: true,
312			pauseOnHover: true,
313			direction: nc.instances[el.attr('ID')].atts.marquee_direction
314		});
315	});
316
317	$('.newscodes.nc-type-news-ticker-tiny, .newscodes.nc-type-news-ticker, .newscodes.nc-type-news-ticker-compact').each( function() {
318
319		var el = $(this);
320
321		el.nc_ticker({
322			showItems:nc.instances[el.attr('ID')].atts.ticker_visible,
323			direction:nc.instances[el.attr('ID')].atts.ticker_direction,
324			'animation':'fade'
325		});
326
327	});
328
329	if ( $('.newscodes.nc-type-news-ticker-tiny, .newscodes.nc-type-news-ticker, .newscodes.nc-type-news-ticker-compact').length > 0 ) {
330		var nc_resize_id;
331		$(window).resize(function() {
332			clearTimeout(nc_resize_id);
333			nc_resize_id = setTimeout(nc_resize, 300);
334		});
335	}
336
337	$(document).on('click', '.newscodes-multi .nc-multi-terms li', function() {
338
339		var el = $(this);
340
341		if ( el.hasClass('current') ) {
342			return false;
343		}
344
345		var wrap = el.closest('.newscodes-multi');
346
347		el.parent().find('.current').removeClass('current');
348
349		el.addClass('current');
350
351		var current = wrap.find('.newscodes:visible');
352
353		var selected = wrap.find('.newscodes:eq('+el.index()+')');
354
355		current.fadeOut(300, function() {
356			selected.css({'position':'','top':'','left':'','width':''});
357		});
358
359		selected.css({'position':'absolute','top':0,'left':0,'width':'100%'}).fadeIn(300, function() {
360		});
361
362
363	});
364
365
366	$(document).on('mouseover', '.nc-type-news-one-tabbed-posts .nc-figure-wrapper', function(){
367
368		var wrap = $(this).closest('ul');
369		var el = $(this).closest('li');
370
371		if (el.hasClass('nc-active')){
372			return false;
373		}
374
375		wrap.find('li.nc-active .nc-tabbed-post').stop(true).fadeOut(150, function(){
376
377			wrap.find('li.nc-active').removeClass('nc-active');
378
379			el.addClass('nc-active').find('.nc-tabbed-post').stop(true).fadeIn(150, function(){
380			});
381
382		});
383
384	});
385
386
387})(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.