PageSourceSearch

https://risen2.ru/includes/js/jquery.comments.js

js risen2.ru collected 2026-10-02 19:25:47 UTC 11,161 bytes, 403 lines download raw bytes

1		$(function() {
2			 $('#tooltiper a').tooltip({
3				 track: true,
4				 delay: 0,
5				 showURL: false,
6				 fade: 200
7			 });
8		 });
9		 
10		 
11/* Áëîê êîììåíòîâ - Åùå */
12function loadComments(numOfComments)
13{
14    var lastCom = parseInt($('#tooltiper').attr('lastComment')); // - èç äèâà/ïîëÿ ñ êîììåíòàìè áåð¸ì íîìåð ïîñëåäíåãî êîììåíòà/èõ êîë-âî. Ìîæíî äëÿ ýòîãî ôåéê-ñâîéñòâî ñîçäàòü è ìåíÿòü åãî.
15    $.post('includes/comments_func.php?op=block', {commNumber : numOfComments, lastComment : lastCom} , function(data) {
16		$("#tooltiper").hide().fadeOut(300);
17		$("#loadericon").show();
18		$("#tooltiper").fadeIn(300).html(data);
19		$("#loadericon").hide();
20		lastCom += parseInt(numOfComments);
21        $('#tooltiper').attr('lastComment', lastCom);
22        });
23}
24
25$(function() {
26  $('#commentform').submit(handleSubmit);
27  $('#submit_content').removeAttr('disabled');
28
29	if ($('#ischeck').val() == 1)
30	{	 
31		$("#comments_new").everyTime(10000,function(i){
32
33			var commentwaslast = parseInt($('#comments_new').attr('commlast'));
34			var commentwasfirst = parseInt($('#comments_new').attr('commfirst'));
35			var commentwascurr = parseInt($('#comments_new').attr('commcurr'));
36
37			if (commentwasfirst != commentwaslast)
38			{
39				commentwaslast = commentwasfirst;
40			}
41			var data = {
42				"srctype": $('#comments_new').attr('srctype'),
43				"commlast": commentwaslast,
44				"srcid": parseInt($('#comments_new').attr('srcid'))
45			};
46
47			$.ajax({
48			  type: 'POST',
49			  url: "includes/comments_func.php?op=check",
50			  cache: false,
51			  data: data,
52			  headers: {
53			    'X-Requested-With': 'XMLHttpRequest'
54			  },
55			  success: function(html){
56				var htmlExpl = html.split('<|>');
57				if (htmlExpl[1] != undefined && ($('#newComm_' + htmlExpl[0]).length < 1 || (htmlExpl[2] != undefined && $('#newComm_' + htmlExpl[2]).length < 1)))
58					$("#comments_new").hide().html(htmlExpl[1]).fadeIn('slow');
59			  }
60			})
61		})
62	}
63});
64
65function handleSubmit() {
66	var form = $(this);
67	var remember = $('#remember').attr('checked');
68	var postername = form.find('#postername').val();
69	var skod2 = form.find('#skod2').val();
70	var email = form.find('#email').val();
71	var data = {
72		"postername": postername,
73		"email": email,
74		"remember": remember,
75		"comment": form.find('#comment').val(),
76		"skod2": skod2,
77		"srcid": form.find('#srcid').val(),
78		"srctype": form.find('#srctype').val()
79	};
80	postComment(data);
81	if (remember=="checked") {
82		$.cookie('autoname', postername, { expires: 999 });
83		$.cookie('autoemail', email, { expires: 999 });
84	} else {	
85		$.cookie('autoname', "");
86		$.cookie('autoemail', "");
87		//form.find('#postername').val('');
88		//form.find('#email').val('');
89	}
90	return false;
91}
92
93function postComment(data) {
94  $.ajax({
95    type: 'POST',
96    url: 'includes/comments_func.php?op=post',
97    data: data,
98    headers: {
99      'X-Requested-With': 'XMLHttpRequest'
100    },
101    success: postSuccess,
102    error: postError
103  });
104}
105
106function postSuccess(data, textStatus, jqXHR) {
107	var dataExpl = data.split('<|>');
108	$('#commError').remove();
109	if (dataExpl[1] == undefined)
110	{
111		var newComm = '<div id="commError" style="display: none;">' + dataExpl[0] + '</div>';
112		$('#commentform').before(newComm);
113		$('#commError').fadeOut(0).fadeIn('slow');
114	}
115	else
116	{
117		if (dataExpl[2] == undefined)
118		{
119			$('.comment_loader').show().fadeIn('slow');
120			$('#submit_content').attr('disabled', 'disabled').val('Àíòèôëóä...');
121		}
122		$('#comments_new').attr('commlast', dataExpl[0]).attr('commcurr', dataExpl[0]);
123		var newComm = '<div id="newComm_' + dataExpl[0] + '" commid="' + dataExpl[0] + '">' + dataExpl[1] + '</div>';
124		$('#comments_new').before(newComm);
125		$('#newComm_' + dataExpl[0]).fadeOut(0).slideToggle('slow');
126		$('#comment').fadeOut(0).val('').fadeIn('slow');
127		if (dataExpl[2] == undefined)
128			setTimeout(function() { $('.comment_loader').fadeOut('slow').hide(); $('#submit_content').removeAttr('disabled').val('Îòïðàâèòü'); }, 30000);
129	}
130}
131
132function postError(jqXHR, textStatus, errorThrown) {
133  alert(error);
134}
135
136function CommentsFormBack() {
137	$('#commError').slideToggle('slow', function(){ $(this).remove();});
138}
139function CommentsEditFormBack(tid) {
140	$('#commError').slideToggle('slow', function(){ 
141		$(this).remove();
142		$("#comment_"+tid).fadeIn('slow', function(){ 
143			$(this).html($("#comment_hide_"+tid).html());
144			$("#comment_hide_"+tid).remove();
145		});
146	});
147}
148function CommentEditCancel(tid) {
149	//$('#commError').slideToggle('slow', function(){ 
150		//$(this).remove();
151	$("#comment_"+tid).fadeIn(300).html($("#comment_hide_"+tid).html());
152	$("#comment_hide_"+tid).remove();
153	fombj_edit = 0;
154
155	//});
156}
157
158function CommentsShow(commentStart, commentEnd)
159{
160	var form =  $('#commentform');	
161	//var oldcomms =  $("#comments_new_show").html();
162	//var oldcomms2 =  $("#comments_new_show2").html();
163	var commentwaslast = $('#comments_new').attr('commlast');
164	var commentwasfirst = $('#comments_new').attr('commfirst');
165
166	if (commentwaslast > commentEnd)
167		commentEnd = commentwaslast;
168
169	var data = {
170		"srcid": form.find('#srcid').val(),
171		"srctype": form.find('#srctype').val(),
172		"commlast": commentStart,
173		"commend": commentEnd
174	};	
175	$.ajax({
176	  type: 'POST',
177	  url: "includes/comments_func.php?op=check&load=1",
178	  cache: true,
179	  data: data,
180      headers: {
181        'X-Requested-With': 'XMLHttpRequest'
182      },
183	  success: function(html){
184		if (commentwaslast > commentwasfirst && commentStart != commentEnd)
185		{
186			for (var i = commentwasfirst; i <= commentwaslast; i++) {
187				$('#newComm_' + i).remove();
188				var i_new = i+1;
189				$('#comment_' + i_new).remove();
190			};
191			/*$('div[id*="newComm"]').each(function(i) {
192
193				console.log($(this).attr('commid'));
194				console.log($(this).html());
195			});*/	  
196		}
197
198		$('#comments_new').fadeOut('slow').hide().attr('commlast', commentEnd).attr('commfirst', commentEnd);
199		var newaddedComm = '<div id="newaddedComms_' + commentEnd + '">' + html + '</div>';
200		$('#comments_new').before(newaddedComm);
201		$('#newaddedComms_' + commentEnd).fadeOut(0).fadeIn('slow');
202	  }
203	});	
204}
205	
206function CommentRemove(srctype, srcid, tid)
207{
208	$('#commError').remove();
209	var data = {
210		"srcid": srcid,
211		"srctype": srctype,
212		"tid": tid
213	};	
214			$.ajax({
215			  type: 'POST',
216			  url: "includes/comments_func.php?op=remove",
217			  cache: true,
218			  data: data,
219    headers: {
220      'X-Requested-With': 'XMLHttpRequest'
221    },
222	success: function(html){
223		if (html.indexOf('<!--ERROR_COMMENT-->') != -1)
224		{	
225			if (!tid) {
226				alert('Îøèáêà! Åñëè âû íå çíàåòå ïðè÷èíó îøèáêè, ñîîáùèòå îá ýòîì òåõíè÷åñêîìó àäìèíèñòðàòîðó ÷åðåç îáðàòíóþ ñâÿçü.');
227			}
228			else
229			{
230				$('#comment_' + tid).before('<div id="commError" style="display:none;">' + html + '</div>');
231				$('#commError').slideToggle("slow");
232			}
233		}
234		else
235		{
236			if (!tid) {
237				$("#comments_all").slideToggle("slow");	
238				$("#comments_page, #comments_page2").slideToggle("slow");
239				//$("#comments_all").slideToggle("slow").html(html);
240			} else {
241				$("#comment_"+tid).slideToggle("slow");		
242			}
243		}				
244	  }
245	});		
246	
247	}	
248	
249function CommentEdit(srctype, srcid, tid)
250	{
251	$('#commError').remove();
252	var data = {
253		"srcid": srcid,
254		"srctype": srctype,
255		"tid": tid
256	};	
257			$.ajax({
258			  type: 'POST',
259			  url: "includes/comments_func.php?op=edit",
260			  cache: true,
261			  data: data,
262    headers: {
263      'X-Requested-With': 'XMLHttpRequest'
264    },
265	success: function(html){
266		//console.log('test1');
267		if (html.indexOf('<!--ERROR_COMMENT-->') != -1)
268		{	
269			if (!tid) {
270				alert('Îøèáêà! Åñëè âû íå çíàåòå ïðè÷èíó îøèáêè, ñîîáùèòå îá ýòîì òåõíè÷åñêîìó àäìèíèñòðàòîðó ÷åðåç îáðàòíóþ ñâÿçü.');
271			}
272			else
273			{
274				//console.log('test2');
275				$('#comment_' + tid).before('<div id="commError" style="display:none;">' + html + '</div>');
276				$('#commError').slideToggle("slow");
277			}
278		}
279		else
280		{	
281			$('#comment_' + tid).before('<div id="comment_hide_' + tid + '" style="display: none;">' + $('#comment_' + tid).html() + '</div>');
282			//$('#comment_hide_' + tid).hide();			
283			$("#comment_"+tid).fadeIn(300).html(html);		
284				//$("#comment_"+tid).slideToggle("slow").html(html);					
285		}
286	}
287 });		
288	
289	}	
290	
291function CommentEditSave(tid) {
292	$('#commError').remove();
293	var form = $('#commentform_'+tid);
294	var postername = form.find('#postername').val();
295	var email = form.find('#email').val();
296	var srcid = form.find('#srcid').val();
297	var srctype = form.find('#srctype').val();
298	var data = {
299		"postername": postername,
300		"email": email,
301		"comment": form.find('#comment').val(),
302		"tid": tid,
303		"srcid": srcid,
304		"srctype": srctype
305	};
306	
307			$.ajax({
308			  type: 'POST',
309			  url: "includes/comments_func.php?op=editsave",
310			  cache: true,
311			  data: data,
312    headers: {
313      'X-Requested-With': 'XMLHttpRequest'
314    },
315	success: function(html){
316		if (html.indexOf('<!--ERROR_COMMENT-->') != -1)
317		{	
318			if (!tid) {
319				alert('Îøèáêà! Åñëè âû íå çíàåòå ïðè÷èíó îøèáêè, ñîîáùèòå îá ýòîì òåõíè÷åñêîìó àäìèíèñòðàòîðó ÷åðåç îáðàòíóþ ñâÿçü.');
320			}
321			else
322			{
323				$('#comment_' + tid).before('<div id="commError" style="display:none;">' + html + '</div>');
324				$('#commError').slideToggle("slow");
325			}
326		}
327		else
328		{
329			$("#comment_hide_"+tid).remove();
330			$("#comment_"+tid).fadeOut(300).fadeIn(300).html(html);	
331			fombj_edit = 0;
332		}					
333	}
334 });		
335	
336	return false;
337}
338
339// Get user selection text on page
340function getSelectedText() {
341    if (window.getSelection) {
342        return window.getSelection();
343    }
344    else if (document.selection) {
345        return document.selection.createRange().text;
346    }
347    return '';
348}
349function getSelectionHtml() {
350    var html = "";
351    if (typeof window.getSelection != "undefined") {
352        var sel = window.getSelection();
353        if (sel.rangeCount) {
354            var container = document.createElement("div");
355            for (var i = 0, len = sel.rangeCount; i < len; ++i) {
356                container.appendChild(sel.getRangeAt(i).cloneContents());
357            }
358            html = container.innerHTML;
359        }
360    } else if (typeof document.selection != "undefined") {
361        if (document.selection.type == "Text") {
362            html = document.selection.createRange().htmlText;
363        }
364    }
365    return html;
366}
367function QuoteDo(name, textid) {
368	var oldComment = $('#comment').val();
369	var postername = '';
370	if (name != undefined && textid != undefined)
371	{
372		var newText = $('#'+textid).html();	// IE ÒÓÒ ÔÈÊÑ?	
373		postername = '=' + name;
374	}
375	var selectedText = getSelectedText();
376	if (selectedText != '')
377		newText = selectedText.toString();
378
379	//if ( $.browser.msie )	
380		//newText = decodeURIComponent(newText);
381	var newText2 = '';
382	$.ajax
383	({
384		url: 'includes/comments_func.php?op=getBB',
385		dataType: 'text',
386		type: 'POST',
387		//contentType: 'application/x-www-form-urlencoded; charset=windows-1251',
388		//async: false,
389		data:
390		{
391			text: newText
392		},
393		success: function (data)
394		{
395			data = data.replace(/\r\n/g, '');
396			$('#comment').val(oldComment + ' [quote' + postername + ']' + data + '[/quote]');
397		},
398		error: function (jqXHR, textStatus, errorThrown)
399		{	
400			alert('Îøèáêà çàïðîñà: ' + textStatus + '\n\nÐåêîìåíäóåì íàæàòü Ctrl+Shift+Del è óäàëèòü êýø áðàóçåðà, à çàòåì ïîâòîðèòü áðîíèðîâàíèå.');
401		}
402	});
403}

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.