PageSourceSearch

https://kinderita.ru/wp-content/themes/novomag-theme/js/theme-scripts.js

js kinderita.ru collected 2026-10-07 06:20:23 UTC 10,687 bytes, 333 lines download raw bytes

1var breakingStart = true; // autostart breaking news
2var breakingSpeed = 40; // breaking msg speed
3
4var breakingScroll = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
5var breakingOffset = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
6var elementsToClone = [true, true, true, true, true, true, true, true, true, true];
7var elementsActive = [];
8var theCount = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
9
10
11
12(function( $ ) {
13	"use strict";
14	
15	jQuery(window).resize(function() {
16		refreshSidebar();
17	});
18
19	jQuery(window).ready(function() {
20
21
22
23		jQuery(".tab-a").each(function(){
24			jQuery(this).find("h3").eq(0).addClass("active");
25		});
26
27		jQuery(".tab-d").each(function(){
28			jQuery(this).children("div").eq(0).addClass("active");
29		});
30
31		jQuery(".tab-a h3").click(function(){
32			var thisel = jQuery(this);
33			var thisindex = thisel.index();
34			thisel.addClass("active").siblings("h3.active").removeClass("active");
35			thisel.parent().siblings(".tab-d").children("div").eq(thisindex).addClass("active").siblings("div.active").removeClass("active");
36			refreshSidebar();
37		});
38
39		jQuery(".w-photos .photo-images").each(function(){
40			jQuery(this).children("a").eq(0).addClass("active");
41		});
42
43		jQuery(".gallery-link-left").click(function(){
44			slideGalleryWidget(jQuery(this).siblings(".photo-images").children("a.active").prev());
45			return false;
46		});
47
48		jQuery(".gallery-link-right").click(function(){
49			slideGalleryWidget(jQuery(this).siblings(".photo-images").children("a.active").next());
50			return false;
51		});
52
53		jQuery(".carousel-right").click(function(){
54			var thisel = jQuery(this);
55			var maxcount = Math.ceil((thisel.siblings(".inner-carousel").children(".item").size())/3);
56			if(thisel.parent().attr("rel")){
57				if(thisel.parent().attr("rel") < maxcount-1){
58					var nuum = parseInt(thisel.parent().attr("rel"))+1;
59				}else{
60					var nuum = parseInt(thisel.parent().attr("rel"));
61				}
62			}else{
63				if(maxcount-1 >= 1){
64					var nuum = 1;
65				}else{
66					var nuum = 0;
67				}
68			}
69			thisel.parent().attr("rel", nuum);
70			thisel.siblings(".inner-carousel").animate({
71				"left" : "-"+(nuum*103.5)+"%"
72			}, 200);
73			return false;
74		});
75
76		jQuery(".carousel-left").click(function(){
77			var thisel = jQuery(this);
78			if(thisel.parent().attr("rel")){
79				if(thisel.parent().attr("rel") > 0){
80					var nuum = parseInt(thisel.parent().attr("rel"))-1;
81				}else{
82					var nuum = parseInt(thisel.parent().attr("rel"));
83				}
84			}else{
85				var nuum = 0;
86			}
87			thisel.parent().attr("rel", nuum);
88			thisel.siblings(".inner-carousel").animate({
89				"left" : "-"+(nuum*103.5)+"%"
90			}, 200);
91			return false;
92		});
93
94		jQuery(".slider .slider-navigation li > a").click(function() {
95			var thisel = jQuery(this);
96			var thisindex = thisel.parent().index();
97			thisel.parent().addClass("active").siblings("li.active").removeClass("active");
98			thisel.parent().parent().siblings(".slider-image").children("a").eq(thisindex).addClass("active").siblings("a.active").each(function() {
99				var curel = jQuery(this);
100				setTimeout(function () {
101					curel.removeClass("active");
102				}, 100);
103			});
104			return false;
105		});
106
107
108		// Alert box close
109		jQuery('a[href="#close-alert"]').click(function() {
110			jQuery(this).parent().animate({
111				opacity: 0,
112				padding: "0px 13px",
113				margin: "0px",
114				height: "0px"
115			}, 300, function() {
116				refreshSidebar();
117			});
118			return false;
119		});
120
121		// Accordion blocks
122		jQuery(".accordion > div > a").click(function() {
123			var thisel = jQuery(this).parent();
124			if(thisel.hasClass("active")){
125				thisel.removeClass("active").children("div").animate({
126					"height": "toggle",
127					"opacity": "toggle",
128					"padding-top": "toggle"
129				}, 300);
130				return false;
131			}
132			// thisel.siblings("div").removeClass("active");
133			thisel.siblings("div").each(function() {
134				var tz = jQuery(this);
135				if(tz.hasClass("active")){
136					tz.removeClass("active").children("div").animate({
137						"height": "toggle",
138						"opacity": "toggle",
139						"padding-top": "toggle"
140					}, 300, function() {
141						refreshSidebar();
142					});
143				}
144			});
145			// thisel.addClass("active");
146			thisel.addClass("active").children("div").animate({
147				"height": "toggle",
148				"opacity": "toggle",
149				"padding-top": "toggle"
150			}, 300, function() {
151				refreshSidebar();
152			});
153			return false;
154		});
155	  
156
157		// Tabbed blocks
158		jQuery(".short-tabs").each(function() {
159			var thisel = jQuery(this);
160			thisel.children("div").eq(0).addClass("active");
161			thisel.children("ul").children("li").eq(0).addClass("active");
162		});
163
164		jQuery(".short-tabs > ul > li a").click(function() {
165			var thisel = jQuery(this).parent();
166			thisel.siblings(".active").removeClass("active");
167			thisel.addClass("active");
168			thisel.parent().siblings("div.active").removeClass("active");
169			thisel.parent().siblings("div").eq(thisel.index()).addClass("active");
170			refreshSidebar();
171			return false;
172		});
173
174		jQuery(".lightbox").click(function () {
175			jQuery(".lightbox").css('overflow', 'hidden');
176			jQuery("body").css('overflow', 'auto');
177			jQuery(".lightbox .lightcontent").fadeOut('fast');
178			jQuery(".lightbox").fadeOut('slow');
179		}).children().click(function(e) {
180			return false;
181		});
182
183
184		// Responsive menu
185		jQuery(".main-menu > div").append('<a href="#" class="toggle-menu"><i class="fa fa-ban"></i> Меню сайта</a>');
186		jQuery(".header-topmenu > div").append('<a href="#" class="toggle-menu"><i class="fa fa-ban"></i> Меню сайта</a>');
187		
188		jQuery(".toggle-menu").click(function() {
189			var thisel = jQuery(this).siblings("ul");
190			thisel.fadeToggle();
191			return false;
192		});
193
194
195		// Refresh sidebars look
196		setTimeout(function () {
197			refreshSidebar();
198		}, 220);
199		refreshSidebar();
200
201
202        // Breaking News Scroller
203        jQuery(".breaking-news .breaking-block").each(function () {
204            var thisitem = jQuery(this);
205        	thisitem.find("ul").html(thisitem.find("ul").html()+thisitem.find("ul").html());
206            // thisitem.find("ul li").css("width", thisitem.width() + "px");
207        });
208
209        jQuery(".breaking-controls a").click(function () {
210            var thisitem = jQuery(this), itemul = thisitem.parent().parent().find(".breaking-block ul"), items = itemul.find("li"), sega = (items.size() - 1) * (items.width() + parseInt(items.css("margin-right")));
211            if (thisitem.hasClass("breaking-arrow-left")) {
212                if (0 >= Math.abs(parseInt(itemul.css("margin-left")))) {
213                    itemul.css("margin-left", (sega * (-1)) + "px");
214                } else {
215                    itemul.css("margin-left", (parseInt(itemul.css("margin-left")) + (items.width() + parseInt(items.css("margin-right")))) + "px");
216                }
217            } else {
218                if (sega <= Math.abs(parseInt(itemul.css("margin-left")))) {
219                    itemul.css("margin-left", "0px");
220                } else {
221                    itemul.css("margin-left", (parseInt(itemul.css("margin-left")) + (items.width() + parseInt(items.css("margin-right"))) * (-1)) + "px");
222                }
223            }
224            return false;
225        });
226
227        jQuery(".breaking-news").mouseenter(function () {
228            var thisindex = jQuery(this).attr("rel");
229            clearTimeout(elementsActive[thisindex]);
230        }).mouseleave(function () {
231            var thisindex = jQuery(this).attr("rel");
232            elementsActive[thisindex] = false;
233        });
234
235        start();
236
237		if(_otSliderAuto){
238			themesAutoLoad();
239		}
240
241		jQuery(".slider a.ot-slider-right").click(function() {
242			var thenextpage = (jQuery(".slider > .slider-navigation > li.active").next().index() == "-1")?0:jQuery(".slider > .slider-navigation > li.active").next().index();
243			themesLoadPage(thenextpage);
244			themesCancelLoad();
245			return false;
246		});
247
248		jQuery(".slider a.ot-slider-left").click(function() {
249			var thenextpage = (jQuery(".slider > .slider-navigation > li.active").prev().index() == "-1")?jQuery(".slider > .slider-navigation > li").size()-1:jQuery(".slider > .slider-navigation > li.active").prev().index();
250			themesLoadPage(thenextpage);
251			themesCancelLoad();
252			return false;
253		});
254
255	});
256
257})(jQuery);
258
259function start() {
260    var z = 0;
261    jQuery('.breaking-block ul').each(function () {
262        var thisitem = jQuery(this), thisindex = z;
263
264        z = z + 1;
265        if (thisitem.find("li").size() > 0) {
266
267            if (!breakingStart) { return false; }
268            var theBreakingMargin = parseInt(thisitem.find("li").css("margin-right")), theBreakingWidth = parseInt(thisitem.parent().css("width"));
269            theCount[thisindex] = (Math.ceil(thisitem.find("li").size() / 2) * (parseInt(thisitem.find("li").width()) + parseInt(thisitem.find("li").css("margin-right"))));
270
271            if (elementsToClone[thisindex]) {
272                jQuery(this).parent().parent().addClass("isscrolling");
273                jQuery('.breaking-block').eq(thisindex).parent().attr("rel", thisindex);
274                thisitem.find("li").clone().appendTo(this);
275
276                elementsToClone[thisindex] = false;
277            }
278            var theNumber = theCount[thisindex] + breakingOffset[thisindex];
279            if (Math.abs(theNumber) <= (Math.abs(breakingScroll[thisindex]))) {
280                cloneBreakingLine(thisindex);
281            }
282
283            if (!elementsActive[thisindex]) {
284                elementsActive[thisindex] = setInterval(function () {
285                    beginScrolling(thisitem, thisindex);
286                }, breakingSpeed);
287            }
288        }
289    });
290
291    setTimeout("start()", breakingSpeed);
292}
293
294function beginScrolling(thisitem, thisindex) {
295    breakingScroll[thisindex] = breakingScroll[thisindex] - 1;
296    thisitem.css("left", breakingScroll[thisindex] + 'px');
297}
298
299function cloneBreakingLine(thisindex) {
300    breakingScroll[thisindex] = 0;
301    jQuery('.breaking-block').eq(thisindex).find('ul').css("left", "0px");
302}
303
304function lightboxclose(){
305	jQuery(".lightbox").css('overflow', 'hidden');
306	jQuery(".lightbox .lightcontent").fadeOut('fast');
307	jQuery(".lightbox").fadeOut('slow');
308	jQuery("body").css('overflow', 'auto');
309}
310
311
312function refreshSidebar() {
313	jQuery("#sidebar").each(function() {
314		jQuery(this).css("height", "auto");
315		var maxheight = jQuery(this).height();
316		var secondheight = jQuery(".main-content").height();
317		maxheight = (parseInt(secondheight) > parseInt(maxheight))?secondheight:maxheight;
318		jQuery("#sidebar").css("min-height", maxheight);
319	});
320}
321
322function slideGalleryWidget(theitem) {
323	theitem.css("opacity", "0").css("display", "block").animate({
324		"opacity" : "1"
325	}, 200, function(){
326		jQuery(this).addClass("active").siblings("a.active").removeClass("active").css("display", "none");
327		refreshSidebar();
328	});
329}
330
331
332
333

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.