PageSourceSearch

https://kritikanstvo.ru/js/main.js

js kritikanstvo.ru collected 2026-10-02 10:13:02 UTC 17,405 bytes, 477 lines download raw bytes

1$(function(){
2	topmenu();
3	function topmenu() {
4		var sub_ul = '#tabs ul ul',
5			sub_cls = 'subtabs_hover',
6			sub_cls_2 = 'subtabs_hover_2',
7			li = 'li';
8			
9		if($(sub_ul + ' li.active') || $(sub_ul + ' li.parent')){
10			$(sub_ul + ' li.active, ' + sub_ul + ' li.parent').parents('li').addClass('parent');
11		}
12		// 071021 - здесь и чуть ниже вдвое уменьшены тайминги
13		$('#tabs > ul > li > a').hoverIntent({
14    		over: topmenu_over,
15    		out: topmenu_out,
16			interval: 100,
17			timeout: 200,
18			sensitivity: 4
19		});
20		$('#tabs ul ul').hoverIntent({
21    		over: topmenu_over_2,
22    		out: topmenu_out_2,
23			interval: 0,
24			timeout: 100,
25			sensitivity: 4
26		});
27		function topmenu_over(){
28			$(this).parent(li).addClass(sub_cls);
29		}
30		function topmenu_out(){
31			$(this).parent(li).removeClass(sub_cls);
32	
33		}
34		function topmenu_over_2(){
35			$(this).parent(li).addClass(sub_cls_2);
36		}
37		function topmenu_out_2(){
38			$(this).parent(li).removeClass(sub_cls_2);
39		}
40	}
41});
42
43$(document).ready(function(){
44	
45	// Reviews list switcher
46	$('#button_reviews_list_games').click(function () {
47	$('#reviews_list_movies').hide(); $('#reviews_list_games').show();
48	$('#button_reviews_list_games').removeClass('button_frontrow').addClass('button_frontrow_down');
49	$('#button_reviews_list_movies').removeClass('button_frontrow_down').addClass('button_frontrow');
50	});
51	
52	$('#button_reviews_list_movies').click(function () {
53	$('#reviews_list_games').hide(); $('#reviews_list_movies').show();
54	$('#button_reviews_list_movies').removeClass('button_frontrow').addClass('button_frontrow_down');
55	$('#button_reviews_list_games').removeClass('button_frontrow_down').addClass('button_frontrow');
56	});
57	
58	// Reviews list switcher
59	$('#button_newskg_list_games').click(function () {
60	$('#newskg_list_movies').hide(); $('#newskg_list_games').show();
61	$('#button_newskg_list_games').removeClass('button_frontrow').addClass('button_frontrow_down');
62	$('#button_newskg_list_movies').removeClass('button_frontrow_down').addClass('button_frontrow');
63	});
64	
65	$('#button_newskg_list_movies').click(function () {
66	$('#newskg_list_games').hide(); $('#newskg_list_movies').show();
67	$('#button_newskg_list_movies').removeClass('button_frontrow').addClass('button_frontrow_down');
68	$('#button_newskg_list_games').removeClass('button_frontrow_down').addClass('button_frontrow');
69	});
70	
71	// Qtip	
72	$('[title!=""]').qtip({
73		position: {
74			my: 'bottom center',
75			at: 'top center',
76			adjust: {x: 12, y: -6}
77		}
78	});
79	$('.js-tooltipBottomLeft').qtip({
80		position: {
81			my: 'bottom center',
82			at: 'top left',
83			adjust: {x: -18, y: 76}
84		}
85	});
86	
87	// Fancybox main_form
88	
89	$('.main_form').fancybox({
90		scrolling: 'no',
91		arrows    : false,
92		autoCenter: false,
93		autoSize: true,
94		fitToView: false,
95		topRatio: 0,
96		nextClick : false,
97		helpers : {thumbs : {width  : 1, height : 1}}
98		});	
99});
100
101// Настройка календаря
102$(function() {
103	$( "#mf_review_online_datepicker" ).datepicker({
104		changeMonth: true,
105		changeYear: true
106	});
107	$( "#mf_wisdom_online_datepicker" ).datepicker({
108		changeMonth: true,
109		changeYear: true
110	});
111});
112
113
114// Загрузка с заменой div
115$.fn.loadWith = function(u){
116    var c=$(this);
117	c.load(u, function () {
118		c.hide().fadeIn('fast',function(){
119			c.replaceWith(c.children());
120			$('[title!=""]').qtip({position: {my: 'bottom center', at: 'top center', adjust: {x: 12, y: -6}}});
121		});
122	});
123};
124
125function goToByScroll(id){
126	$('html,body').animate({scrollTop: $("#"+id).offset().top},'normal');
127}
128
129function js_encode (text)
130{
131	return escape(encodeURIComponent(text));
132
133}
134
135function select_tab (table, url, title, div_to_show, div_to_hide, div_to_hide2)
136{
137
138	//
139	if (div_to_show=='releases_full' && $('#releases_full').html()=='')	
140	{
141		$('#releases_full').html('<p style="text-align: center; padding-top: 15px;"><img src="/i/wait.gif"></p>').load('/useractions.php?action=show_releases&section=' + url.replace(/.*\/releases\/([^\/]*)\/.*/,'$1') + '&year=full');
142	}
143	//
144
145	$('#' + div_to_hide).hide();
146	if (typeof div_to_hide2 != 'undefined')
147		$('#' + div_to_hide2).hide();
148		
149	$('#' + div_to_show).fadeIn('fast');
150	$('a[id^=page_lists_tab]').attr('class','inactive');
151	$('#page_lists_tab' + table + '_hd').attr('class','active');
152	window.history.replaceState('object or string', 'Title', url);
153	$(document).attr('title', title);
154}
155
156function change_url_start (start)
157{
158	url=document.URL;
159	if (url.search(/\/start\/([0-9]+)\//)>0)
160		url=url.replace(/\/start\/([0-9]+)\//, '/start/'+start+'/');
161	else
162	{
163		if (url.substr(-1)=='/')
164			url=url+'start/'+start+'/';
165		else
166			url=url+'/start/'+start+'/';		
167	}
168	window.history.replaceState('object or string', 'Title', url);
169}
170
171
172	function ending (num, e1, e2, e3)
173	{
174
175	// Формирует окончание в соответствии с числом
176	// $num - число
177	// $e1,$e2,$3 - окончания существительного. Например - 1 мяч (''), 2 мяча ('а'), 6 мячей ('ей')
178
179		if (((num%100)>10)&&((num%100)<20)) return e3;
180		if ((num%10)==1) return e1;
181		if (((num%10)>1)&&((num%10)<5)) return e2;
182		return e3;
183	}
184
185
186function sort_table (codename, page, table, type, sorting, reviews_count, rating, num)
187{
188	if (sorting=='')
189		sorting=$("#sort_value").val();
190	else
191		$("#sort_value").val(sorting);
192
193	if (type=='')
194		type=$("#type_value").val();
195	else
196	{
197		$("#type_value").val(type);
198		$("[id*=type_selector_]").removeClass('active');
199		if (page=='publication')
200			$("#type_selector_" + type).addClass('active');
201		else
202			$("#type_selector_" + (type>=2000000?2:(type>=1000000?1:0))).addClass('active');
203		
204		reviews_count_text='рецензи' + ending (reviews_count, 'я', 'и', 'й')
205		
206		$('#review_count').html(reviews_count>0?reviews_count + ' ' + reviews_count_text:'Рецензии');
207		
208	}
209	
210	
211	$("#" + table + "_header").load("/useractions.php?action=sort&table=" + table + "&page=" + page + "&codename=" + codename + "&type=" + type + "&reviews_count=" + reviews_count + "&rating=" + rating + "&sort=" + sorting + "&num=" + num);
212
213	// console.log ("/useractions.php?action=more&table=" + table + "&page=" + page + "&codename=" + codename + "&type=" + type + "&reviews_count=" + reviews_count + "&rating=" + rating + "&sort=" + sorting + "&start=0&num=" + num);
214
215	$("#" + table + "_list").load("/useractions.php?action=more&table=" + table + "&page=" + page + "&codename=" + codename + "&type=" + type + "&reviews_count=" + reviews_count + "&rating=" + rating + "&sort=" + sorting + "&start=0&num=" + num).fadeOut("fast").fadeIn("normal");
216
217	$('[title!=""]').qtip({position: {my: 'bottom center', at: 'top center', adjust: {x: 12, y: -6}}});
218
219}
220
221$(function() {
222    var cache = {};
223    $( "#s" ).autocomplete({
224        minLength: 3,
225      open: function(event, ui) {
226            $(this).autocomplete("widget").css({
227                "width": 271
228            });
229        },
230        source: function( request, response ) {
231            var term = request.term;
232            if ( term in cache ) {
233                response( cache[ term ] );
234                return;
235            } 
236            $.getJSON( "/useractions.php?action=search", request, function( data, status, xhr ) {
237                cache[ term ] = data;
238                response( data );
239            });               
240        }
241        ,
242		    select: function(e, ui) {
243				if (ui.item.section=='movies')
244  					location.replace("/movies/" + ui.item.id + "/");
245  				else
246				if (ui.item.section=='games')
247  					location.replace("/games/" + ui.item.id + "/");
248  				else
249				if (ui.item.section=='critics')
250  					location.replace("/critics/" + ui.item.id + "/");
251  				else
252				if (ui.item.section=='publications')
253  					location.replace("/publications/" + ui.item.id + "/");
254  				
255				return false;
256		    }
257    }
258    ).each(function() {
259	$(this).data('autocomplete')._renderItem = function(ul, item) {
260	if (item.id=='_movies') return $("<li class='search_header'></li>").append('Фильмы').appendTo(ul);
261	else
262	if (item.id=='_games') return $("<li class='search_header'></li>").append('Игры').appendTo(ul);
263	else
264	if (item.id=='_critics') return $("<li class='search_header'></li>").append('Критики').appendTo(ul); 
265	else
266	if (item.id=='_publications') return $("<li class='search_header'></li>").append('Издания').appendTo(ul);
267	else
268	{
269		if (item.section=='movies')
270	        return $("<li class='search_item'></li>").data("item.autocomplete", item).append(
271                '<a><span class="search_link">«' + item.russian + '»</span>' + (item.original!="" && item.original!=null && item.original!=item.russian?'<span class="search_text"> / ' + item.original + (item.year!=""?' (' + item.year + ")":"") + "</span>":"") + "</a>")
272                .appendTo(ul);
273		else
274		if (item.section=='games')
275	        return $("<li class='search_item'></li>").data("item.autocomplete", item).append(
276                '<a><span class="search_link">' + item.original + '</span>' + (item.platforms!="" || item.year!=""?'<span class="search_text"> (' + item.year + (item.platforms!="" && item.year!=''?" / ":"") + item.platforms + ")</span>":"") + "</a>")
277                .appendTo(ul);
278		else
279		if (item.section=='critics')
280	        return $("<li class='search_item'></li>").data("item.autocomplete", item).append(
281                '<a><span class="search_link">' + item.name + "</span></a>")
282                .appendTo(ul);
283		else
284		if (item.section=='publications')
285	        return $("<li class='search_item'></li>").data("item.autocomplete", item).append(
286                '<a><span class="search_link">' + item.name + "</span></a>")
287                .appendTo(ul);
288		}
289	};
290});
291
292    $("input[id$='_item_title']").autocomplete({
293        minLength: 3,
294        source: function( request, response ) {
295            var term = request.term;
296            if ( term in cache ) {
297                response( cache[ term ] );
298                return;
299            } 
300            $.getJSON( "/useractions.php?action=search&where=movies_games", request, function( data, status, xhr ) {
301                cache[ term ] = data;
302                response( data );
303            });               
304        }
305        ,
306		    select: function(e, ui) {
307  					$('#universal_codename').val(ui.item.id);
308  					var select_section=ui.item.section;
309  					var button_type=this.id.replace('_item_title','');
310  					if (select_section=='movies')
311  					{
312	  					$('#' + button_type + '_type_movie_pseudo').click();
313						//$('#' + button_type + '_type_movie_pseudo').addClass('active');
314						//$('#' + button_type + '_type_game_pseudo').removeClass('active');
315					} else
316  					if (select_section=='games')
317  					{
318	  					$('#' + button_type + '_type_game_pseudo').click();
319						//$('#' + button_type + '_type_game_pseudo').addClass('active');
320						//$('#' + button_type + '_type_movie_pseudo').removeClass('active');
321					}
322		    }
323        
324    }
325    ).each(function() {
326	$(this).data('autocomplete')._renderItem = function(ul, item) {
327	if (item.id=='_movies') return $("<li style='display: block; margin: 5px 5px 5px 5px;'></li>").append('Фильмы').appendTo(ul);
328	else
329	if (item.id=='_games') return $("<li style='display: block; margin: 10px 5px 5px 5px;'></li>").append('Игры').appendTo(ul);
330	else
331	{
332		if (item.section=='movies')
333	        return $("<li></li>").data("item.autocomplete", item).append(
334                '<a style="color: #487686;">«' + item.russian + '»<span style="color: #000000;">' + (item.original!="" && item.original!=null?" / " + item.original + "</span></a>":""))
335                .appendTo(ul);
336		else
337		if (item.section=='games')
338	        return $("<li></li>").data("item.autocomplete", item).append(
339                '<a style="color: #487686;">' + item.original + (item.platforms!="" && item.platforms!="uni" && item.platforms!=null?'<span style="color: #000000;"> (' + item.platforms + ")</span>":"") + "</a>")
340                .appendTo(ul);
341		}
342	};
343});
344
345
346    $("input[id$='_item_src']").autocomplete({
347        minLength: 3,
348        source: function( request, response ) {
349            var term = request.term;
350            if ( term in cache ) {
351                response( cache[ term ] );
352                return;
353            } 
354            $.getJSON( "/useractions.php?action=search&where=publications", request, function( data, status, xhr ) {
355                cache[ term ] = data;
356                response( data );
357            });               
358        }
359    }
360    ).each(function() {
361	$(this).data('autocomplete')._renderItem = function(ul, item) {
362        return $("<li></li>").data("item.autocomplete", item).append(
363            '<a style="color: #487686;">' + item.name + "</a>")
364            .appendTo(ul);                
365	};
366});
367
368    $("input[id$='_item_author']").autocomplete({
369        minLength: 3,
370        source: function( request, response ) {
371            var term = request.term;
372            if ( term in cache ) {
373                response( cache[ term ] );
374                return;
375            } 
376            $.getJSON( "/useractions.php?action=search&where=critics", request, function( data, status, xhr ) {
377                cache[ term ] = data;
378                response( data );
379            });               
380        }
381    }
382    ).each(function() {
383	$(this).data('autocomplete')._renderItem = function(ul, item) {
384        return $("<li></li>").data("item.autocomplete", item).append(
385            '<a style="color: #487686;">' + item.name + "</a>")
386            .appendTo(ul);
387	};
388});
389
390});
391
392
393/* Fancybox global_report */
394
395$(document).ready(function() {
396	// Класс "global_report" (здесь и ниже) оставлен для обратной совместимости со старыми кусками сайта, которые еще не успели перевести на использование js-openGlobalReport)
397	$('.js-openGlobalReport, .global_report').fancybox({
398	scrolling: 'no',
399	arrows    : false, autoCenter: true,
400	autoSize: true,
401	fitToView: false,
402	topRatio: 0.5,
403	nextClick : false,
404	padding : 0,
405	tpl: {closeBtn: '<a class="gr_close" href="javascript:;">&nbsp;</a>'},
406	helpers : {thumbs : {width  : 1, height : 1}, overlay : null, title:  null}
407});
408
409$(document).ready(function(){
410$('input[id="gr_submit"]').attr('disabled','disabled');
411$('#error_description').keyup(function(){
412    if($('#error_description').val() == "" || $('#error_type').val()==""){
413        $('input[id="gr_submit"]').attr('disabled','disabled');
414    }
415    else{
416        $('input[id="gr_submit"]').removeAttr('disabled');
417    }
418    });
419
420$('#error_type').change(function(){
421    if($('#error_description').val() == "" || $('#error_type').val()==""){
422        $('input[id="gr_submit"]').attr('disabled','disabled');
423    }
424    else{
425        $('input[id="gr_submit"]').removeAttr('disabled');
426    }
427    });
428
429});
430
431
432// Класс "global_report" (здесь и выше) оставлен для обратной совместимости со старыми кусками сайта, которые еще не успели перевести на использование js-openGlobalReport)
433$('.js-openGlobalReport, .global_report').click(function() {
434    $('#error_user_url').val('http://www.kritikanstvo.ru'+window.location.href.toString().split(window.location.host)[1]);
435    $('#error_url').val('http://www.kritikanstvo.ru'+window.location.href.toString().split(window.location.host)[1]);
436});
437
438$('#gr_submit').click(function() {
439	
440    	$.ajax({url: '/useractions.php?action=inserterror&type=' + encodeURIComponent($('#error_type').val()) + '&user_url=' + encodeURIComponent($('#error_user_url').val()) + '&url=' + encodeURIComponent($('#error_url').val()) + '&description=' + encodeURIComponent($('#error_description').val()),
441    	  dataType: "json"})
442    .done(function(data) {
443    			//$('#error_type option:not([value])').attr('selected', 'selected');
444				//$("#error_type option:first").attr('selected','selected');
445				// $('#error_type').selectbox('change', '', 'Блабла');
446				$('#error_description').val('');
447				$('.gr_form').hide();
448				$('.gr_done').fadeIn('slow');
449	})
450    .fail(function() { alert("Не получилось отправить сообщение об ошибке."); });
451	/*
452	$.getJSON( '/useractions.php?type=' + encodeURIComponent($('#error_type').val()) + '&user_url=' + encodeURIComponent($('#error_user_url').val()) + '&url=' + encodeURIComponent($('#error_url').val()) + '&description=' + encodeURIComponent($('#error_description').val()), request, function( data, status, xhr )
453	{
454    	$('.gr_form').hide();
455    	$('.gr_done').fadeIn('slow');
456	});
457	*/
458});
459$('#gr_finish').click(function() {
460	$.fancybox.close();
461    $('.gr_done').hide('slow');
462    $('.gr_form').show('slow');
463});
464});
465
466// Для скрипта jquery-scrolltofixed-min.js - закрепляет кнопку багрепорта при скроллинге. Больше не нужен, т.к. Ð
466ºÐ½Ð¾Ð¿ÐºÐ° переехала в шапку.
467// $(document).ready(function() {
468// 	$('.global_report').scrollToFixed({ marginTop: 70});
469// });
470
471$(document).ready(function()
472	{$('#scrolltop').click(function(){$('html, body').animate({scrollTop:0}, 'normal'); return false;});}
473);
474$(window).scroll(function()
475	{if ($(this).scrollTop() > 700) {$('#scrolltop:hidden').stop(true, true).fadeIn();}
476	else {$('#scrolltop').stop(true, true).fadeOut();}}
477);

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.