PageSourceSearch

https://sspu.ru/errorsend/mistakes.js

js sspu.ru collected 2026-10-01 12:38:26 UTC 4,259 bytes, 154 lines download raw bytes

1// Ñêðèïò îòïðàâêè ñîîáùåíèé îá îøèáêå http://mistakes.ru/script/mistakes_dev
2// Âåðñèÿ 4.1
3// 27.04.2015
4var loc = window.location;
5var mis;
6nN = navigator.appName; 
7
8function createMessage() {
9// Èçìåíèòå ñëåäóþùóþ ñòðîêó. Çäåñü íóæíî óêàçàòü ïóòü ê ôàéëó mistakes.php
10  var misphploc = '/errorsend/mistakes.php'
11  var container = document.createElement('div')
12  var scroll = dde.scrollTop || db.scrollTop;
13  var mtop = scroll + 100 + 'px';
14  var mleft = Math.floor(dde.clientWidth/2) - 175 + 'px';
15  container.innerHTML = '<div id="mistake">\
16  <div id="m_window" style="top:' + mtop + '; left:' + mleft + '";>\
17        <iframe frameborder="0" name="mis" id="m_frame" src="' + misphploc + '"></iframe></div> \
18  </div></div>'
19
20  return container.firstChild
21}
22
23function positionMessage(elem) {
24  elem.style.position = 'absolute';
25  var pageheight = Math.max(dde.scrollHeight, db.scrollHeight, dde.clientHeight);
26  var pagewidth = Math.max(dde.scrollWidth, db.scrollWidth, dde.clientWidth);
27  elem.style.height = pageheight + 'px';
28  elem.style.width = pagewidth + 'px';
29}
30
31function winop() {
32  dde=document.documentElement;
33  db=document.body;
34  var messageElem = createMessage()
35  positionMessage(messageElem)
36  db.appendChild(messageElem)
37}
38
39function getText(e) 
40{
41        if (!e) e= window.event; 
42        if((e.ctrlKey) && ((e.keyCode==10)||(e.keyCode==13))) 
43        {CtrlEnter();} 
44    return true;}
45    
46function mis_get_sel_text(){
47   if (window.getSelection) {
48    txt = window.getSelection();
49    selected_text = txt.toString();
50    full_text = txt.anchorNode.textContent;
51    selection_start = txt.anchorOffset;
52    selection_end = txt.focusOffset;
53  }
54  else if (document.getSelection) {
55    txt = document.getSelection();
56    selected_text = txt.toString();
57    full_text = txt.anchorNode.textContent;
58    selection_start = txt.anchorOffset;
59    selection_end = txt.focusOffset;
60  }
61  else if (document.selection) {
62    txt = document.selection.createRange();
63    selected_text = txt.text;
64    full_text = txt.parentElement().innerText;
65
66    var stored_range = txt.duplicate();
67    stored_range.moveToElementText(txt.parentElement());
68    stored_range.setEndPoint('EndToEnd', txt);
69    selection_start = stored_range.text.length - txt.text.length;
70    selection_end = selection_start + selected_text.length;
71  }
72  else {
73    return;
74  }
75  var txt = {
76    selected_text: selected_text,
77    full_text: full_text,
78    selection_start: selection_start,
79    selection_end: selection_end
80  };
81  return txt;
82}
83
84function mis_get_sel_context(sel) {
85  selection_start = sel.selection_start;
86  selection_end = sel.selection_end;
87  if (selection_start > selection_end) {
88    tmp = selection_start;
89    selection_start = selection_end;
90    selection_end = tmp;
91  }
92  
93  context = sel.full_text;
94
95  context_first = context.substring(0, selection_start);
96  context_second = context.substring(selection_start, selection_end);
97  context_third = context.substring(selection_end, context.length);
98  context = context_first + '<strong>' + context_second + '</strong>' + context_third;
99  
100  context_start = selection_start - 60;
101  if (context_start < 0) {
102    context_start = 0;
103  }
104
105  context_end = selection_end + 60;
106  if (context_end > context.length) {
107    context_end = context.length;
108  }
109
110  context = context.substring(context_start, context_end);
111
112  context_start = context.indexOf(' ') + 1;
113
114  if (selection_start + 60 < context.length) {
115    context_end = context.lastIndexOf(' ', selection_start + 60);
116  }
117  else {
118    context_end = context.length;
119  }
120
121  selection_start = context.indexOf('<strong>');
122  if (context_start > selection_start) {
123    context_start = 0;
124  }
125
126  if (context_start) {
127    context = context.substring(context_start, context_end);
128  }
129
130  return context;
131}
132
133function CtrlEnter(){
134    var sel = mis_get_sel_text();
135    if (sel.selected_text.length > 300) {
136		alert('Ìîæíî âûäåëèòü íå áîëåå 300 ñèìâîëîâ!');
137    }
138    else if (sel.selected_text.length == 0) {
139		alert('Âûäåëèòå îøèáêó!');
140    }
141    else {
142      // Get selection context.
143      mis = mis_get_sel_context(sel);
144      winop();
145
146    }
147  };
148  
149 function PressLink(){
150		mis = 'Ïîæàëóéñòà, îïèøèòå îøèáêó â êîììåíòàðèè.';
151		winop();
152  };
153
154document.onkeypress = getText;

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.