PageSourceSearch

https://st.uralweb.ru/js/api/likes.js?2.11

js uralweb.ru collected 2026-09-24 08:26:29 UTC 1,814 bytes, 71 lines download raw bytes

1;
2/**
3 * api/likes.js 
4 */
5$(function () {
6	
7	var api_link = '/api/likes/like';
8	var show_timer;
9	var hide_timer;
10	
11	function togleLikes ( flag ) {
12		if (flag === true) {
13			$('.likes-container').css('display','flex');
14		} else {
15			$('.likes-container').css('display','none');
16		}
17	}
18	function togleLikesMobile ( flag ) {
19		var current_state = $('.likes-container').css('display');
20		
21		if ( current_state == 'none' || flag === true ) {
22			$('.likes-container').css('display','flex');
23		}
24		if ( current_state == 'flex' || flag === false ) {
25			$('.likes-container').css('display','none');
26		}
27	}
28	
29	$('body').on('mouseenter','.likes-button-all',function(event) {
30		show_timer = setTimeout(function(){
31			togleLikes(true);
32	    },500);
33		clearTimeout(hide_timer);
34	}).on('mouseleave','.likes-button-all',function(event) {
35		hide_timer = setTimeout(function(){
36			togleLikes(false);
37	    },500);
38		clearTimeout(show_timer);
39	});
40	
41
42	$('body').on('click','.likes-button-all button',function(event){
43		event.preventDefault();
44		var targetTag	= $(event.target).prop('tagName');
45		if ( $.browser.mobile && targetTag == 'SPAN' ) {
46			togleLikesMobile();
47		} else {
48			var data 		= $(this).data();
49			var section		= $(this).data('section');
50			var objectid	= $(this).data('objectid');
51			var container	= 'likes_'+section+'_'+objectid;
52			$.ajax({
53	            type: "POST",
54	            url: api_link,
55	            data: data,
56	            dataType: 'json',
57	            success: function (resp) {
58	            	if ( resp.error == 0 ) {
59	            		$('#'+container).parent().replaceWith(resp.content);
60	            		if ( $.browser.mobile ) {
61	            			togleLikesMobile(false);
62	            		} else {
63	            			togleLikes(true);
64	            		}
65	            	}
66	            }
67	        });
68		}
69	});
70	
71});

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.