PageSourceSearch

https://samdurak.ru/templates/main2023/js/libs.js

js samdurak.ru collected 2026-10-10 00:38:11 UTC 6,133 bytes, 146 lines download raw bytes

1
2$(document).ready(function(){
3	
4	/* ====================== BUILDING ====================== */
5	
6	$('body').append('<div class="overlay"></div><div class="mobile-menu" id="mobile-menu"></div><div class="mobile-menu-close"><span class="fal fa-times"></span></div><div id="scrolltop"><span class="fal fa-long-arrow-up"></span></div>');
7	$('.js-this-in-mobile-menu').each(function() {
8		$(this).clone().prependTo('#mobile-menu');
9	});	
10	
11	/* ====================== EVENTS ====================== */
12
13	$(document).on('click','.js-show-search',function(){
14		$('.header__search').slideToggle(200);
15		$(this).find('.fal').toggleClass('fa-search fa-times');
16	})
17	.on('click','.js-show-login',function(){
18		$('.overlay, .login').fadeIn(200);
19		$('body').addClass('modal-is-opened');
20		return false;
21	})
22	.on('click','.mobile-menu .submenu > a',function(){
23		$(this).parent().find('.nav__list-hidden').slideToggle(200);
24		$(this).parent().siblings().find('.nav__list-hidden').slideUp(200);
25		$(this).closest('.nav__list').siblings().find('.nav__list-hidden').slideUp(200);
26		return false;
27	});	
28	
29	$(document).on('click','.pagination__btn-loader a',function(){
30		var urlNext = $(this).attr('href'), scrollNext = $(this).offset().top;
31        if (urlNext !== undefined) {
32			$.ajax({
33				url: urlNext,
34				beforeSend: function() { ShowLoading('<p class="bolder">Загрузка.</p> Пожалуйста, подождите.'); },			 
35                success: function(data) {
36                    $('#pagination').remove(); $('#dle-content').append($('#dle-content', data).html());
37                    window.history.pushState("", "", urlNext);
38					$('html, body').animate({scrollTop:scrollNext}, 800);	
39					$('.pagination__btn-loader span').text('Больше нет новостей');
40					HideLoading(''); setTimeout(function() { $(window).lazyLoadXT(); }, 300);
41                },
42				  error: function() { HideLoading(''); alert('что-то пошло не так'); }
43			});
44		};
45		return false;
46	});
47
48	
49	$(".js-show-comments").click(function(){
50		$('html, body').animate({scrollTop:$('.page__comments').offset().top -20}, 800);
51	});
52
53	$(".js-show-mobile-menu").click(function(){
54		$('.overlay').fadeIn(200);
55		$('#mobile-menu, .mobile-menu-close').addClass('is-active');
56		$('body').addClass('mobile-menu-is-opened');
57	});
58	$(document).on('click','.overlay, .login__close, .mobile-menu-close',function(){
59		$('.overlay, .login').fadeOut(200);
60		$('#mobile-menu, .mobile-menu-close').removeClass('is-active');
61		$('body').removeClass('modal-is-opened mobile-menu-is-opened');
62	});
63	
64	/* ====================== DLE SCRIPTS ====================== */
65
66	$(document).on('click','.ac-form__editor textarea, .fr-wrapper, .ac-form',function(){
67		$('.ac-form').addClass('is-active');
68	});
69    $('#dle-content > #dle-ajax-comments').appendTo($('#page__comments-list')); 
70	$('.login__social-btns a').on('click',function(){
71	   	var href = $(this).attr('href'), width  = 820, height = 420, 
72	   		left   = (screen.width  - width)/2, top   = (screen.height - height)/2-100;   
73		auth_window = window.open(href, 'auth_window', "width="+width+",height="+height+",top="+top+",left="+left+"menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
74       	return false;
75	}); 
76	$('.js-comm-author').each(function(){
77        var a = $(this), b = a.closest('.js-comm'), c = a.text().substr(0,1), 
78            f = b.find('.js-comm-avatar'), e = f.children('img').attr('src'),
79			d = ["#c57c3b","#753bc5","#79c53b","#eb3b5a","#45aaf2","#2bcbba","#778ca3"], rand = Math.floor(Math.random() * d.length);
80		if (e == '/templates/'+dle_skin+'/dleimages/noavatar.png') {
81            f.html('<div class="comment-item__letter d-flex jc-center ai-center" style="background-color:'+d[rand]+'">'+c+'</div>');
82		};
83    });	
84	var gotop = $('#scrolltop'); 
85	$(window).scroll (function () {
86		if ( $(this).scrollTop () > 300 ) { gotop.fadeIn(200); } 
87		else { gotop.fadeOut(200); }
88	});	
89	gotop.click(function(){
90		$('html, body').animate({ scrollTop : 0 }, 'slow');
91	});
92});
93
94/* END */
95
96$(document).ready(function(){
97	
98	$('.frate').each(function(){
99        var rate = $(this),
100			rdata = rate.find('.rate-data'),
101			rrate = parseInt(rdata.find('.ratingtypeplusminus').text(), 10),
102			rvote = parseInt(rdata.find('span[id*=vote]').text(), 10);
103			rate.append('<div class="rbar"><div class="rfill"></div></div>');
104			rate.find('.rate-plus').after('<div class="rate-perc">0%</div>');
105		if ( rvote >= rrate && rvote > 0 ) {
106			var m = (rvote - rrate)/2, 
107				p = rvote - m,
108				perc = Math.round(p/rvote*100);
109			rate.find('.rate-plus span.rcount').html(p);
110			rate.find('.rate-minus span.rcount').html(m);
111			rate.find('.rfill').css({'width':''+perc+'%'});
112			rate.find('.rate-perc').html(''+perc+'%');
113			perc < 49 ? rate.find('.rate-perc').addClass('low') : rate.find('.rate-perc').addClass('high'); 
114		} else {
115			rate.find('.rate-plus span.rcount').html('0');
116			rate.find('.rate-minus span.rcount').html('0');
117			
118		};
119		rate.addClass('done'); 
120    });
121	
122});
123
124function doRateLD( rate, id ) {
125		ShowLoading('');
126		$.get(dle_root + "engine/ajax/controller.php?mod=rating", { go_rate: rate, news_id: id, skin: dle_skin, user_hash: dle_login_hash }, function(data){
127			HideLoading('');
128			if ( data.success ) {
129				var rating = data.rating;
130				rating = rating.replace(/&lt;/g, "<");
131				rating = rating.replace(/&gt;/g, ">");
132				rating = rating.replace(/&amp;/g, "&");
133				$("#ratig-layer-" + id).html(rating);
134				$("#vote-num-id-" + id).html(data.votenum);
135				var rt = parseInt($(rating).text()),
136					m = (data.votenum - rt)/2,
137					p = data.votenum - m,
138					perc = Math.round(p/data.votenum*100),
139					fRate = $("#frate-" + id);
140				fRate.find('.rate-plus span.rcount').html(p);
141				fRate.find('.rate-minus span.rcount').html(m);
142				fRate.find('.rfill').css({'width':''+perc+'%'});
143				fRate.find('.rate-perc').html(''+perc+'%');
144			} else if (data.error) {DLEalert ( data.errorinfo, dle_info );}
145		}, "json");
146	};

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.