PageSourceSearch

https://kirov-portal.ru/template/js/mistake/mistake.js

js kirov-portal.ru collected 2026-10-02 05:20:32 UTC 4,453 bytes, 146 lines download raw bytes

1var isCtrl = false;
2var SynErrorLeng = 0;
3var MistakeWindowLastCoord = { x: 0, y: 0 };
4
5function getSelectionCoords(t) {
6	var sel = document.selection, range;
7	var doc = document.documentElement, body = document.body;
8	var FCollapse = ( t == 0 ) ? 0 : 1;
9	var x = 0, y = 0;
10
11	if(sel) {
12		if (sel.type != "Control") {
13			range = sel.createRange();
14			range.collapse( FCollapse );
15			x = range.boundingLeft + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
16			y = range.boundingTop + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
17		}
18	} else if (window.getSelection) {
19		sel = window.getSelection();
20		if (sel.rangeCount) {
21			range = sel.getRangeAt(0).cloneRange();
22			if (range.getClientRects) {
23				range.collapse( FCollapse );
24				var rect = range.getClientRects()[0];
25				if( rect != undefined ) {
26					x = rect.left + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
27					y = rect.top + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
28				}
29			}
30		}
31	}
32	return { x: x, y: y };
33}
34function OpenMistakeTextSelected() {
35	if (window.getSelection) {
36		var terror = window.getSelection();
37	} else if (document.getSelection) {
38		var terror = document.getSelection();
39	} else if (document.selection) {
40		var terror = document.selection.createRange().text;
41	}
42	terror = terror.toString();
43
44	return terror;
45}
46function OpenMistakeWindow() {
47	var terror = OpenMistakeTextSelected();
48	var SynErrorLength = terror.length;
49
50	if( terror != '' ) {
51		if( SynErrorLength < 10 ) {
52			alert('Вы выделили слишком мало символов. Необходимо хотя бы 10');
53		} else if( SynErrorLength > 400 ) {
54			alert('Вы выделили слишком много символов. Необходимый максимум 400');
55		} else {
56			if(!MW.IsOpen) {
57				$('#MistakeOpenWindow').remove();
58
59				MW.Show({
60					cont: "<div style='margin: 16px auto; width: 109px;'><img src='/images/ajax-loader.gif'><span style='left: 10px; position: relative; top: -12px;'>загрузка...</span></div>",
61					position: 'fixed',
62					top: 150,
63					left: 'center',
64					Hcont: "Нашли ошибку на сайте?",
65					width: 557,
66					height: 292,
67					btn_close: 1,
68					OverlayClickClose: 1,
69					IssetOverlay: true
70				});
71
72				var terror = encodeURIComponent(terror);
73
74				ajax.conf({
75					'url': '/sitemistake/',
76					'data': 'terror='+terror,
77					'type': 'POST',
78				}).html(function( res, status, xhr ) {
79					$('#MWCont').html(res);
80					if(res.cont != undefined) {
81						$('#MWCont').html(res.cont);
82					}
83					if(res.error != undefined) $('#err').html("<div style='color: red; margin: 20px auto; text-align: center;'>"+res.error+"</div>");
84					if(res.script != undefined) eval(res.script);
85				});
86			} else {
87				MW.Close();
88			}
89		}
90	}
91}
92
93
94
95$(document).keyup(function(e) {
96	if (e.which == 17) isCtrl = false
97}).keydown(function(e) {
98	if (e.which == 17) isCtrl = true;
99	if (e.which == 13 && isCtrl == true) {
100		OpenMistakeWindow();
101	}
102});
103$(document).on('mouseup', 'body', function(e) {
104	var t = $(e.target);
105	var terror = OpenMistakeTextSelected();
106
107	if( t.parents('div.newsContent').length > 0 && t.parents('div.NoMistake').length == 0 ) {
108		if( terror.length >= 10 && terror.length <= 400 ) {
109			var coordBallun = getSelectionCoords(0);
110
111			if( MistakeWindowLastCoord.x != coordBallun.x || MistakeWindowLastCoord.y != coordBallun.y ) {
112				$('#MistakeOpenWindow').remove();
113
114				$('<img>', {
115					'id': 'MistakeOpenWindow',
116					'src': '/template/js/mistake/exclamation_24x24.png',
117					'css': {
118						'position': 'absolute',
119						'z-index': '100',
120						'top': coordBallun.y+'px',
121						'left': coordBallun.x+3+'px'
122					},
123					'click': function() {
124						OpenMistakeWindow();
125					}
126				}).prependTo('#inner');
127
128				MistakeWindowLastCoord.x = coordBallun.x;
129				MistakeWindowLastCoord.y = coordBallun.y;
130			} else {
131				setTimeout(function() {
132					terror = OpenMistakeTextSelected();
133					if( terror.length < 10 ) {
134						$('#MistakeOpenWindow').remove();
135						MistakeWindowLastCoord.x = 0;
136						MistakeWindowLastCoord.y = 0;
137					}
138				}, 250);
139			}
140		} else {
141			$('#MistakeOpenWindow').remove();
142			MistakeWindowLastCoord.x = 0;
143			MistakeWindowLastCoord.y = 0;
144		}
145	}
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.