PageSourceSearch

https://uhtl.ru/system/javascript/core.js

js uhtl.ru collected 2026-10-06 18:28:54 UTC 41,696 bytes, 923 lines download raw bytes

1var sedjs = {
2    /*= Popup
3    -------------------------------------*/
4    popup: function(code, w, h, modal) {
5        if (!modal) {
6            window.open(sedjs.get_basehref() + 'plug?o=' + code, '', 'toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=' + w + ',height=' + h + ',left=32,top=16');
7        } else {
8            window.modal = sedjs.modal.open('popup', 'iframe', sedjs.get_basehref() + 'plug?o=' + code, "Popup", 'width=' + w + 'px,height=' + h + 'px,resize=1,scrolling=1,center=1', 'load');
9        }
10    },
11
12    /*= PFS
13    -------------------------------------*/
14    pfs: function(id, c1, c2, modal) {
15        if (!modal) {
16            window.open(sedjs.get_basehref() + 'pfs?userid=' + id + '&c1=' + c1 + '&c2=' + c2, 'PFS', 'status=1, toolbar=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=yes,width=990,height=600,left=32,top=16');
17        } else {
18            window.modal = sedjs.modal.open("pfs", "iframe", sedjs.get_basehref() + 'pfs?userid=' + id + '&c1=' + c1 + '&c2=' + c2, "PFS", "width=990px,height=600px,resize=1,scrolling=1,center=1", "load");
19        }
20    },
21
22    /*= Help
23    -------------------------------------*/
24    help: function(rcode, c1, c2, modal) {
25        if (!modal) {
26            window.open(sedjs.get_basehref() + 'plug?h=' + rcode + '&c1=' + c1 + '&c2=' + c2, 'Help', 'toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=480,height=512,left=32,top=16');
27        } else {
28            window.modal = sedjs.modal.open("help", "iframe", sedjs.get_basehref() + 'plug?h=' + rcode + '&c1=' + c1 + '&c2=' + c2, "Help", "width=500px,height=520px,resize=1,scrolling=1,center=1", "load");
29        }
30    },
31
32    /*= Polls
33    -------------------------------------*/
34    polls: function(rcode, modal) {
35        if (!modal) {
36            window.open(sedjs.get_basehref() + 'polls?stndl=1&id=' + rcode, 'Polls', 'toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=608,height=448,left=16,top=16');
37        } else {
38            window.modal = sedjs.modal.open("polls", "iframe", sedjs.get_basehref() + 'polls?stndl=1&id=' + rcode, "Polls", "width=610px,height=450px,resize=1,scrolling=1,center=1", "load");
39        }
40    },
41
42    /*= Poll vote
43    -------------------------------------*/
44    pollvote: function(rcode, rvote, modal) {
45        if (!modal) {
46            window.open(sedjs.get_basehref() + 'polls?a=send&stndl=1&id=' + rcode + '&vote=' + rvote, 'Polls', 'toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=608,height=448,left=16,top=16');
47        } else {
48            window.modal = sedjs.modal.open("pollvote", "iframe", sedjs.get_basehref() + 'polls?a=send&stndl=1&id=' + rcode + '&vote=' + rvote, "Polls", "width=610px,height=450px,resize=1,scrolling=1,center=1", "load");
49        }
50    },
51
52    /*= Picture show 
53    -------------------------------------*/
54    picture: function(url, sx, sy, modal) {
55        if (!modal) {
56            var ptop = (window.screen.height - 200) / 2;
57            var pleft = (window.screen.width - 200) / 2;
58            window.open(sedjs.get_basehref() + 'pfs?m=view&v=' + url, 'Picture', 'toolbar=0,location=0,status=0, directories=0,menubar=0,resizable=1,scrollbars=yes,width=' + sx + ',height=' + sy + ',left=' + pleft + ',top=' + ptop + '');
59        } else {
60            var imglink = 'datas/users/' + url;
61            var randid = imglink.replace(/[^a-z0-9]/gi, '');
62            window.modal = sedjs.modal.open('img-' + randid, 'image', imglink, 'Picture', 'resize=0, scrolling=0, center=1', 'load');
63        }
64    },
65
66    /*= Redirect
67    -------------------------------------*/
68    redirect: function(url) {
69        location.href = url.options[url.selectedIndex].value;
70    },
71
72    /*= Confirm action
73    -------------------------------------*/
74    confirmact: function(mess) {
75        if (confirm(mess)) { return true; } else { return false; }
76    },
77
78    /*= Get base href
79    -------------------------------------*/
80    get_basehref: function() {
81        var loc = "";
82        var b = document.getElementsByTagName('base');
83        if (b && b[0] && b[0].href) {
84            if (b[0].href.substr(b[0].href.length - 1) == '/' && loc.charAt(0) == '/')
85                loc = loc.substr(1);
86            loc = b[0].href + loc;
87        }
88        return loc;
89    },
90
91    /*= Toggle Block
92    -------------------------------------*/
93    toggleblock: function(id) {
94        var bl = document.getElementById(id);
95        if (bl.style.display == 'none') { bl.style.display = ''; } else { bl.style.display = 'none'; }
96    },
97
98    /*= Seditio Tabs
99    based on Nanotabs - www.sunsean.com
100    -------------------------------------*/
101    sedtabs: function(settings) {
102        var gc = function(s) { return document.getElementsByClassName(s); };
103        if (!document.getElementsByClassName) {
104            var all = document.getElementsByTagName('*');
105            gc = function(c) {
106                var e = [];
107                c = ' ' + c + ' ';
108                for (var i = 0; i < all.length; i++)
109                    if ((' ' + all[i].className + ' ').indexOf(c) >= 0)
110                        e.push(all[i]);
111                return e;
112            }
113        }
114        var w = function(id) { var d; return (d = document.getElementById(id)) && [d] || gc(id); },
115            bind = function(f) { var self = this; return function() { return f.apply(self, arguments); }; },
116            map = function(f, e, a) { for (var i = 0; i < e.length; i++) f.apply(e[i], a || []); },
117            add = function(c) {
118                this.className += c;
119                var tabtitle = this.getAttribute('data-tabtitle');
120                if (tabtitle && document.getElementsByClassName('tab-title') != null) { document.getElementsByClassName('tab-title')[0].innerText = tabtitle; }
121            },
122            remove = function(c) { this.className = this.className.replace(new RegExp("(^|\\s)" + c + "(\\s|$)", 'g'), ''); },
123            hide = function() { this.style.display = "none"; },
124            show = function() { this.style.display = "block"; };
125        var tab = function(id, a, e, s) {
126            map(remove, a, [s.s]);
127            add.call(this, s.s);
128            map(hide, e);
129            map(show, w(id));
130        };
131        stabs = function(s) {
132            var i, s = s || {},
133                o = "cesdf".split('');
134            for (i in o) s[o[i]] = s[o[i]] || stabs.settings[o[i]];
135            var c = w(s.c),
136                f = function() {
137                    var t = this,
138                        o = t[0],
139                        a = [t[1], t[2], t[3], t[4]];
140                    if (!s.f || s.f.apply(o, a) !== false) tab.apply(o, a);
141                    return false;
142                };
143            for (i = 0; i < c.length; i++) {
144                var x = 0,
145                    e = [],
146                    a = [],
147                    h = [],
148                    t = c[i].getElementsByTagName("a");
149                for (var j = 0; j < t.length; j++)
150                    if (t[j].href.match(/#tab/)) {
151                        h.push(t[j].href.split('#')[1]);
152                        if (typeof s.d == "string" && h[x] == s.d) s.d = x;
153                        a.push(t[j]);
154                        var g = w(h[x]);
155                        for (var k = 0; k < g.length; k++) e.push(g[k]);
156                        x++;
157                    }
158                for (var j = 0; j < a.length; j++)
159                    a[j]['on' + s.e] = bind.call([a[j], h[j], a, e, s], f);
160                if (typeof s.d == "number" && s.d >= 0) tab.call(a[s.d], h[s.d], a, e, s);
161            }
162        };
163
164        stabs.settings = { c: "sedtabs", e: "click", s: "selected", d: 0, f: false };
165        stabs(settings);
166
167    },
168
169    /*= Get Attribute rel on links & start show thumb in modal window
170    -------------------------------------*/
171    getrel: function(rel) {
172        var pagelinks = document.getElementsByTagName("a");
173        for (var i = 0; i < pagelinks.length; i++) {
174            if (pagelinks[i].getAttribute("rel") && pagelinks[i].getAttribute("rel") == rel) {
175                pagelinks[i].onclick = function() {
176                    var imglink = this.getAttribute("href");
177                    var imgtitle = "Picture";
178                    if (this.getAttribute("title")) {
179                        imgtitle = this.getAttribute("title");
180                    }
181                    var randid = imglink.replace(/[^a-z0-9]/gi, '');
182                    sedjs.modal.open('img-' + randid, 'image', imglink, imgtitle, 'resize=0,scrolling=0,center=1', 'load');
183                    return false;
184                }
185            }
186        }
187    },
188
189    /*= Seditio Ajax functions
190    -------------------------------------*/
191    ajax: {
192        getHTTPObject: function() {
193            var http = false;
194            if (typeof ActiveXObject != 'undefined') {
195                try { http = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {
196                    try { http = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { http = false; }
197                }
198            } else if (window.XMLHttpRequest) {
199                try { http = new XMLHttpRequest(); } catch (e) { http = false; }
200            }
201            return http;
202        },
203        load: function(url, callback, format, method, opt) {
204            var http = this.init();
205            if (!http || !url) return;
206            if (http.overrideMimeType) http.overrideMimeType('text/xml');
207            if (!method) method = "GET";
208            if (!format) format = "text";
209            if (!opt) opt = {};
210            format = format.toLowerCase();
211            method = method.toUpperCase();
212            var now = "uid=" + new Date().getTime();
213            url += (url.indexOf("?") + 1) ? "&" : "?";
214            url += now;
215            var parameters = null;
216            if (method == "POST") {
217                var postparams = '';
218                if (opt.formid) postparams = '&' + this.serialize(opt.formid);
219                var parts = url.split("\?");
220                //url = parts[0];
221                parameters = parts[1] + postparams;
222            }
223            http.open(method, url, true);
224            if (method == "POST") { http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); }
225            var ths = this;
226            if (opt.handler) {
227                http.onreadystatechange = function() { opt.handler(http); };
228            } else {
229                http.onreadystatechange = function() {
230                    if (http.readyState == 4) {
231                        if (http.status == 200) {
232                            var result = "";
233                            if (http.responseText) result = http.responseText;
234                            if (format.charAt(0) == "j") {
235                                result = result.replace(/[\n\r]/g, "");
236                                result = eval('(' + result + ')');
237
238                            } else if (format.charAt(0) == "x") {
239                                result = http.responseXML;
240                            }
241                            if (callback) callback(result);
242                        } else {
243                            if (opt.loading) document.getElementById(opt.loadingid).removeChild(opt.loading);
244
245                            if (opt.onError) { opt.onError(http.status); }
246                        }
247                    }
248                }
249            }
250            http.send(parameters);
251        },
252        bind: function(user_options) {
253            var opt = {
254                'url': '',
255                'onSuccess': false,
256                'onError': false,
257                'format': "text",
258                'method': "GET",
259                'update': "",
260                'loading': "",
261                'formid': ""
262            };
263            for (var key in opt) {
264                if (user_options[key]) {
265                    opt[key] = user_options[key];
266                }
267            }
268            if (!opt.url) return;
269            var div = false;
270            if (opt.loading) {
271                div = document.createElement("div");
272                opt.loadingid = opt.loading;
273                var intElemOffsetHeight = Math.floor(document.getElementById(opt.loading).offsetHeight / 2) + 16;
274                var intElemOffsetWidth = Math.floor(document.getElementById(opt.loading).offsetWidth / 2) - 16;
275                div.setAttribute("style", "position:absolute; margin-top:-" + intElemOffsetHeight + "px; margin-left:" + intElemOffsetWidth + "px;");
276                div.setAttribute("class", "loading-indicator");
277                document.getElementById(opt.loading).appendChild(div);
278                opt.loading = div;
279            }
280            this.load(opt.url, function(data) {
281                if (opt.onSuccess) opt.onSuccess(data);
282                if (div) document.getElementById(opt.loadingid).removeChild(div);
283                if (opt.update && data != "") { document.getElementById(opt.update).innerHTML = data; }
284            }, opt.format, opt.method, opt);
285        },
286        serialize: function(formid) {
287            var form = document.getElementById(formid);
288            if (!form || form.nodeName !== "FORM") {
289                return;
290            }
291            var i, j, q = [];
292            for (i = form.elements.length - 1; i >= 0; i = i - 1) {
293                if (form.elements[i].name === "") {
294                    continue;
295                }
296                switch (form.elements[i].nodeName) {
297                    case 'INPUT':
298                        switch (form.elements[i].type) {
299                            case 'text':
300                            case 'hidden':
301                            case 'password':
302                            case 'button':
303                            case 'reset':
304                            case 'submit':
305                                q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value));
306                                break;
307                            case 'checkbox':
308                            case 'radio':
309                                if (form.elements[i].checked) {
310                                    q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value));
311                                }
312                                break;
313                            case 'file':
314                                break;
315                        }
316                        break;
317                    case 'TEXTAREA':
318                        q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value));
319                        break;
320                    case 'SELECT':
321                        switch (form.elements[i].type) {
322                            case 'select-one':
323                                q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value));
324                                break;
325                            case 'select-multiple':
326                                for (j = form.elements[i].options.length - 1; j >= 0; j = j - 1) {
327                                    if (form.elements[i].options[j].selected) {
328                                        q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].options[j].value));
329                                    }
330                                }
331                                break;
332                        }
333                        break;
334                    case 'BUTTON':
335                        switch (form.elements[i].type) {
336                            case 'reset':
337                            case 'submit':
338                            case 'button':
339                                q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value));
340                                break;
341                        }
342                        break;
343                }
344            }
345            return q.join("&");
346        },
347        init: function() { return this.getHTTPObject(); }
348    },
349
350    /*= Seditio Modal Windows functions
351    based on DHTML Windows - www.dynamicdrive.com
352    -------------------------------------*/
353    modal: {
354        imagefiles: ['/system/img/vars/min.gif', '/system/img/vars/close.gif', '/system/img/vars/restore.gif', '/system/img/vars/resize.gif'],
355        maxheightimage: 600,
356        maxwidthimage: 800,
357        minimizeorder: 0,
358        zIndexvalue: 1000,
359        tobjects: [],
360        lastactivet: {},
361
362        init: function(t) {
363            var domwindow = document.createElement("div");
364            domwindow.id = t;
365            domwindow.className = "sed_modal";
366            var domwindowdata = '';
367            domwindowdata = '<div class="modal-handle">';
368            domwindowdata += 'Modal Window<div class="modal-control
368s"><img src="' + this.imagefiles[0] + '" title="Minimize" /><img src="' + this.imagefiles[1] + '" title="Close" /></div>';
369            domwindowdata += '</div>';
370            domwindowdata += '<div class="modal-contentarea" id="area-' + t + '"></div>';
371            domwindowdata += '<div class="modal-statusarea"><div class="modal-resizearea" style="background: transparent url(' + this.imagefiles[3] + ') top right no-repeat;">&nbsp;</div></div>';
372            domwindowdata += '</div>';
373            domwindow.innerHTML = domwindowdata;
374            document.body.appendChild(domwindow);
375            //this.zIndexvalue=(this.zIndexvalue)? this.zIndexvalue+1 : 100
376            var t = document.getElementById(t);
377            var divs = t.getElementsByTagName("div");
378            for (var i = 0; i < divs.length; i++) {
379                if (/modal-/.test(divs[i].className)) {
380                    t[divs[i].className.replace(/modal-/, "")] = divs[i];
381                }
382            }
383            //t.style.zIndex=this.zIndexvalue //set z-index of this dhtml window
384            t.handle._parent = t;
385            t.resizearea._parent = t;
386            t.controls._parent = t;
387            t.onclose = function() { return true; };
388            t.onmousedown = function() { sedjs.modal.setfocus(this); };
389            t.handle.onmousedown = sedjs.modal.setupdrag;
390            t.resizearea.onmousedown = sedjs.modal.setupdrag;
391            t.controls.onclick = sedjs.modal.enablecontrols;
392            t.show = function() { sedjs.modal.show(this); };
393            t.hide = function() { sedjs.modal.hide(this); };
394            t.close = function() { sedjs.modal.close(this); };
395            t.setSize = function(w, h) { sedjs.modal.setSize(this, w, h); };
396            t.moveTo = function(x, y) { sedjs.modal.moveTo(this, x, y); };
397            t.isResize = function(bol) { sedjs.modal.isResize(this, bol); };
398            t.isResize = function(bol) { sedjs.modal.isResize(this, bol); };
399            t.isScrolling = function(bol) { sedjs.modal.isScrolling(this, bol); };
400            t.load = function(contenttype, contentsource, title) { sedjs.modal.load(this, contenttype, contentsource, title); };
401            this.tobjects[this.tobjects.length] = t;
402            return t;
403        },
404
405        open: function(t, contenttype, contentsource, title, attr, recalonload) {
406            var d = sedjs.modal;
407
408            function getValue(Name) {
409                var config = new RegExp(Name + "=([^,]+)", "i");
410                return (config.test(attr)) ? parseInt(RegExp.$1) : 0;
411            }
412            if (document.getElementById(t) == null) { t = this.init(t); } else { t = document.getElementById(t); }
413            this.setfocus(t);
414            if (contenttype != 'image') {
415                t.setSize(getValue(("width")), (getValue("height")));
416                var xpos = getValue("center") ? "middle" : getValue("left");
417                var ypos = getValue("center") ? "middle" : getValue("top");
418                //t.moveTo(xpos, ypos) //Position window
419                if (typeof recalonload != "undefined" && recalonload == "recal" && this.scroll_top == 0) {
420                    if (window.attachEvent && !window.opera)
421                        this.addEvent(window, function() { setTimeout(function() { t.moveTo(xpos, ypos) }, 400) }, "load");
422                    else
423                        this.addEvent(window, function() { t.moveTo(xpos, ypos) }, "load");
424                }
425                t.isResize(getValue("resize"));
426                t.isScrolling(getValue("scrolling"));
427                t.style.visibility = "visible";
428                t.style.display = "block";
429                t.contentarea.style.display = "block";
430                t.contentarea.innerHTML = ""; //?? clear content
431                t.moveTo(xpos, ypos);
432            }
433            //sedjs.modal.hide(t);
434            t.load(contenttype, contentsource, title);
435            if (t.state == "minimized" && t.controls.firstChild.title == "Restore") {
436                t.controls.firstChild.setAttribute("src", sedjs.modal.imagefiles[0]);
437                t.controls.firstChild.setAttribute("title", "Minimize");
438                t.state = "fullview";
439            }
440            //sedjs.modal.show(t);
441            return t;
442        },
443
444        //set window size (min is 150px wide by 100px tall)
445        setSize: function(t, w, h) {
446            t.style.width = Math.max(parseInt(w), 150) + "px";
447            t.contentarea.style.height = Math.max(parseInt(h), 100) + "px";
448        },
449
450        //move window. Position includes current viewpoint of document
451        moveTo: function(t, x, y) {
452            this.getviewpoint();
453            t.style.left = (x == "middle") ? this.scroll_left + (this.docwidth - t.offsetWidth) / 2 + "px" : this.scroll_left + parseInt(x) + "px";
454            t.style.top = (y == "middle") ? this.scroll_top + (this.docheight - t.offsetHeight) / 2 + "px" : this.scroll_top + parseInt(y) + "px";
455        },
456
457        //show or hide resize inteface (part of the status bar)
458        isResize: function(t, bol) {
459            t.statusarea.style.display = (bol) ? "block" : "none";
460            t.resizeBool = (bol) ? 1 : 0;
461        },
462
463        //scale size image
464        scaleSize: function(maxW, maxH, currW, currH) {
465            var ratio = currH / currW;
466            if (currW >= maxW && ratio <= 1) {
467                currW = maxW;
468                currH = currW * ratio;
469            } else if (currH >= maxH) {
470                currH = maxH;
471                currW = currH / ratio;
472            }
473            return [currW, currH];
474        },
475
476        //set whether loaded content contains scrollbars
477        isScrolling: function(t, bol) {
478            t.contentarea.style.overflow = (bol) ? "auto" : "hidden";
479        },
480
481        //loads content into window plus set its title (4 content types: "inline", "iframe", "image" or "ajax")
482        load: function(t, contenttype, contentsource, title) {
483            if (t.isClosed) {
484                alert("Modal Window has been closed, so no window to load contents into. Open/Create the window again.");
485                return
486            }
487            var contenttype = contenttype.toLowerCase();
488            if (typeof title != "undefined")
489                t.handle.firstChild.nodeValue = title;
490            if (contenttype == "inline")
491                t.contentarea.innerHTML = contentsource;
492            else if (contenttype == "image") {
493
494                /* Loading Indicator */
495                loader = document.createElement("div");
496                loader.setAttribute("style", "position:absolute;");
497                loader.setAttribute("class", "loading-indicator");
498                document.body.appendChild(loader);
499                sedjs.modal.moveTo(loader, 'middle', 'middle');
500                t.loading = loader;
501                /**/
502
503                var i = new Image();
504                i.onload = function(isa) {
505                    var max_h = (window.innerHeight > 150) ? window.innerHeight - 100 : sedjs.modal.maxheightimage;
506                    var max_w = (window.innerWidth > 150) ? window.innerWidth - 100 : sedjs.modal.maxwidthimage;
507                    if (i.height > max_h) {
508                        var newSize = sedjs.modal.scaleSize(max_w, max_h, i.width, i.height);
509                        i.width = newSize[0];
510                        i.height = newSize[1];
511                    }
512                    t.setSize(i.width + 4, i.height);
513                    t.moveTo('middle', 'middle');
514                    if (loader) document.body.removeChild(loader);
515                };
516                i.onerror = function(asa) {
517                    if (loader) document.body.removeChild(loader);
518                };
519
520                i.src = contentsource;
521                t.contentarea.appendChild(i);
522                t.statusarea.style.display = "none";
523                t.contentarea.style.overflow = "hidden";
524                t.style.visibility = "visible";
525                t.style.display = "block";
526                t.contentarea.style.display = "block";
527            } else if (contenttype == "div") {
528                var inlinedivref = document.getElementById(contentsource);
529                t.contentarea.innerHTML = (inlinedivref.defaultHTML || inlinedivref.innerHTML);
530                if (!inlinedivref.defaultHTML) { inlinedivref.defaultHTML = inlinedivref.innerHTML; }
531                inlinedivref.innerHTML = "";
532                inlinedivref.style.display = "none";
533            } else if (contenttype == "iframe") {
534                t.contentarea.style.overflow = "hidden";
535                if (!t.contentarea.firstChild || t.contentarea.firstChild.tagName != "IFRAME") {
536                    t.contentarea.innerHTML = '<iframe src="" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-' + t.id + '" id="id_iframe-' + t.id + '"></iframe>';
537                }
538                window.frames["_iframe-" + t.id].location.replace(contentsource);
539            } else if (contenttype == "ajax") {
540                sedjs.ajax.bind({ url: contentsource, method: 'GET', update: 'area-' + t.id, loading: t.id });
541            }
542            t.contentarea.datatype = contenttype;
543        },
544
545        setupdrag: function(e) {
546            var d = sedjs.modal;
547            var t = this._parent;
548            d.etarget = this;
549            var e = window.event || e;
550            d.initmousex = e.clientX;
551            d.initmousey = e.clientY;
552            d.initx = parseInt(t.offsetLeft);
553            d.inity = parseInt(t.offsetTop);
554            d.width = parseInt(t.offsetWidth);
555            d.contentheight = parseInt(t.contentarea.offsetHeight);
556            if (t.contentarea.datatype == "iframe") {
557                t.style.backgroundColor = "#F8F8F8";
558                t.contentarea.style.visibility = "hidden";
559            }
560            document.onmousemove = d.getdistance;
561            document.onmouseup = function() {
562                if (t.contentarea.datatype == "iframe") {
563                    t.contentarea.style.backgroundColor = "white";
564                    t.contentarea.style.visibility = "visible";
565                }
566                d.stop();
567            };
568            return false;
569        },
570
571        getdistance: function(e) {
572            var d = sedjs.modal;
573            var etarget = d.etarget;
574            var e = window.event || e;
575            d.distancex = e.clientX - d.initmousex;
576            d.distancey = e.clientY - d.initmousey;
577            if (etarget.className == "modal-handle")
578                d.move(etarget._parent, e);
579            else if (etarget.className == "modal-resizearea")
580                d.resize(etarget._parent, e);
581            return false;
582        },
583
584        //get window viewpoint numbers
585        getviewpoint: function() {
586            var ie = document.all && !window.opera;
587            var domclientWidth = document.documentElement && parseInt(document.documentElement.clientWidth) || 100000;
588            this.standardbody = (document.compatMode == "CSS1Compat") ? document.documentElement : document.body;
589            this.scroll_top = (ie) ? this.standardbody.scrollTop : window.pageYOffset;
590            this.scroll_left = (ie) ? this.standardbody.scrollLeft : window.pageXOffset;
591            this.docwidth = (ie) ? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent)) ? window.innerWidth : Math.min(domclientWidth, window.innerWidth - 16);
592            this.docheight = (ie) ? this.standardbody.clientHeight : window.innerHeight;
593        },
594
595        //remember certain attributes of the window when it's minimized or closed, such as dimensions, position on page
596        rememberattrs: function(t) {
597            this.getviewpoint();
598            t.lastx = parseInt((t.style.left || t.offsetLeft)) - sedjs.modal.scroll_left;
599            t.lasty = parseInt((t.style.top || t.offsetTop)) - sedjs.modal.scroll_top;
600            t.lastwidth = parseInt(t.style.width);
601        },
602
603        move: function(t, e) {
604            t.style.left = sedjs.modal.distancex + sedjs.modal.initx + "px";
605            t.style.top = sedjs.modal.distancey + sedjs.modal.inity + "px";
606        },
607
608        resize: function(t, e) {
609            t.style.width = Math.max(sedjs.modal.width + sedjs.modal.distancex, 150) + "px";
610            t.contentarea.style.height = Math.max(sedjs.modal.contentheight + sedjs.modal.distancey, 100) + "px";
611        },
612
613        enablecontrols: function(e) {
614            var d = sedjs.modal;
615            var sourceobj = window.event ? window.event.srcElement : e.target;
616            if (/Minimize/i.test(sourceobj.getAttribute("title")))
617                d.minimize(sourceobj, this._parent);
618            else if (/Restore/i.test(sourceobj.getAttribute("title")))
619                d.restore(sourceobj, this._parent);
620            else if (/Close/i.test(sourceobj.getAttribute("title")))
621                d.close(this._parent);
622            return false;
623        },
624
625        minimize: function(button, t) {
626            sedjs.modal.rememberattrs(t);
627            button.setAttribute("src", sedjs.modal.imagefiles[2]);
628            button.setAttribute("title", "Restore");
629            t.state = "minimized";
630            t.contentarea.style.display = "none";
631            t.statusarea.style.display = "none";
632            if (typeof t.minimizeorder == "undefined") {
633                sedjs.modal.minimizeorder++;
634                t.minimizeorder = sedjs.modal.minimizeorder;
635            }
636            t.style.left = "10px";
637            t.style.width = "200px";
638            var windowspacing = t.minimizeorder * 10;
639            t.style.top = sedjs.modal.scroll_top + sedjs.modal.docheight - (t.handle.offsetHeight * t.minimizeorder) - windowspacing + "px";
640        },
641
642        restore: function(button, t) {
643            sedjs.modal.getviewpoint();
644            button.setAttribute("src", sedjs.modal.imagefiles[0]);
645            button.setAttribute("title", "Minimize");
646            t.state = "fullview";
647            t.style.display = "block";
648            t.contentarea.style.display = "block";
649            if (t.resizeBool)
650                t.statusarea.style.display = "block";
651            t.style.left = parseInt(t.lastx) + sedjs.modal.scroll_left + "px";
652            t.style.top = parseInt(t.lasty) + sedjs.modal.scroll_top + "px";
653            t.style.width = parseInt(t.lastwidth) + "px";
654        },
655
656        close: function(t) {
657            try {
658                var closewinbol = t.onclose();
659            } catch (err) {
660                var closewinbol = true;
661            } finally {
662                if (typeof closewinbol == "undefined") {
663                    alert("An error has occured somwhere inside your \"onclose\" event handler");
664                    var closewinbol = true;
665                }
666            }
667            if (closewinbol) {
668                if (t.state != "minimized")
669                    sedjs.modal.rememberattrs(t);
670                if (window.frames["_iframe-" + t.id])
671                    window.frames["_iframe-" + t.id].location.replace("about:blank");
672                else
673                    t.contentarea.innerHTML = "";
674                t.style.display = "none";
675                t.isClosed = true;
676                document.body.removeChild(t); // ???
677            }
678            return closewinbol;
679        },
680
681        //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)	
682        setopacity: function(targetobject, value) {
683            if (!targetobject)
684                return;
685            if (targetobject.filters && targetobject.filters[0]) {
686                if (typeof targetobject.filters[0].opacity == "number")
687                    targetobject.filters[0].opacity = value * 100;
688                else
689                    targetobject.style.filter = "alpha(opacity=" + value * 100 + ")";
690            } else if (typeof targetobject.style.MozOpacity != "undefined")
691                targetobject.style.MozOpacity = value;
692            else if (typeof targetobject.style.opacity != "undefined")
693                targetobject.style.opacity = value;
694        },
695
696        //Sets focus to the currently active window
697        setfocus: function(t) {
698            this.zIndexvalue++;
699            t.style.zIndex = this.zIndexvalue;
700            t.isClosed = false;
701            this.setopacity(this.lastactivet.handle, 0.5);
702            this.setopacity(t.handle, 1);
703            this.lastactivet = t;
704        },
705
706        show: function(t) {
707            if (t.isClosed) {
708                alert("Modal Window has been closed, so nothing to show. Open/Create the window again.");
709                return;
710            }
711            if (t.lastx)
712                sedjs.modal.restore(t.controls.firstChild, t);
713            else
714                t.style.display = "block";
715            this.setfocus(t);
716            t.state = "fullview";
717        },
718
719        hide: function(t) {
720            t.style.display = "none";
721        },
722
723        stop: function() {
724            sedjs.modal.etarget = null;
725            document.onmousemove = null;
726            document.onmouseup = null;
727        },
728
729        //assign a function to execute to an event handler (ie: onunload)
730        addEvent: function(target, functionref, tasktype) {
731            var tasktype = (window.addEventListener) ? tasktype : "on" + tasktype;
732            if (target.addEventListener)
733                target.addEventListener(tasktype, functionref, false);
734            else if (target.attachEvent)
735                target.attachEvent(tasktype, functionref);
736        },
737
738        cleanup: function() {
739            for (var i = 0; i < sedjs.modal.tobjects.length; i++) {
740                sedjs.modal.tobjects[i].handle._parent = sedjs.modal.tobjects[i].resizearea._parent = sedjs.modal.tobjects[i].controls._parent = null;
741            }
742            window.onload = null;
743        }
744    },
745
746    setActiveStyleSheet: function(title) {      
747        var i, a, main;      
748        for (i = 0;
749            (a = document.getElementsByTagName("link")[i]); i++) {         if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title"))         {                   a.disabled = true;                   if (a.getAttribute("title") == title) a.disabled = false;           }       }
750    },
751
752    getActiveStyleSheet: function() {    
753        var i, a;      
754        for (i = 0;
755            (a = document.getElementsByTagName("link")[i]); i++)     {             if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled)         return a.getAttribute("title");       }    
756        return null;
757    },
758
759    getPreferredStyleSheet: function() {      
760        var i, a;      
761        for (i = 0;
762            (a = document.getElementsByTagName("link")[i]); i++)     {             if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title"))         return a.getAttribute("title");       }      
763        return null;
764    },
765
766    createCookie: function(name, value, days) {      
767        if (days)     {        
768            var date = new Date();        
769            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));        
770            var expires = "; expires=" + date.toGMTString();      
771        }      
772        else expires = "";      
773        document.cookie = name + "=" + value + expires + "; path=/";
774    },
775
776    readCookie: function(name) {      
777        var nameEQ = name + "=";      
778        var ca = document.cookie.split(';');      
779        for (var i = 0; i < ca.length; i++)     {             var c = ca[i];             while (c.charAt(0) == ' ') c = c.substring(1, c.length);             if (c.indexOf(nameEQ) == 0)         return c.substring(nameEQ.length, c.length);       }      
780        return null;
781    },
782
783    antispam: function() {
784        if (document.getElementById('anti1')) {
785            document.getElementById('anti1').value += document.getElementById('anti2').value;
786        }
787    },
788
789    genSEF: function(from, to, allow_slashes) {
790        var str = from.value.toLowerCase();
791        var slash = "";
792        if (allow_slashes) slash = "\\/";
793
794        var LettersFrom = "абвгдезиклмнопрстуфыэйхё";
795        var LettersTo = "abvgdeziklmnoprstufyejxe";
796        var Consonant = "бвгджзйклмнпрстфхцчшщ";
797        var Vowel = "аеёиоуыэюя";
798        var BiLetters = {
799            "ж": "zh",
800            "ц": "ts",
801            "ч": "ch",
802            "ш": "sh",
803            "щ": "sch",
804            "ю": "ju",
805            "я": "ja"
806        };
807
808        str = str.replace(/[_\s\.,?!\[\](){}]+/g, "_");
809        str = str.replace(/-{2,}/g, "--");
810        str = str.replace(/_\-+_/g, "--");
811
812        str = str.toLowerCase();
813
814        //here we replace ъ/ь
815        str = str.replace(
816            new RegExp("(ь|ъ)([" + Vowel + "])", "g"), "j$2");
817        str = str.replace(/(ь|ъ)/g, "");
818
819        //transliterating
820        var _str = "";
821        for (var x = 0; x < str.length; x++)
822            if ((index = LettersFrom.indexOf(str.charAt(x))) > -1)
823                _str += LettersTo.charAt(index);
824            else
825                _str += str.charAt(x);
826        str = _str;
827
828        var _str = "";
829        for (var x = 0; x < str.length; x++)
830            if (BiLetters[str.charAt(x)])
831                _str += BiLetters[str.charAt(x)];
832            else
833                _str += str.charAt(x);
834        str = _str;
835
836        str = str.replace(/j{2,}/g, "j");
837
838        str = str.replace(new RegExp("[^" + slash + "0-9a-z_\\-]+", "g"), "");
839
840        to.value = str;
841    },
842
843    /*= Add poll option */
844    add_poll_option: function(apo) {
845        let delete_button = '<button type="button" class="poll-option-delete" onclick="sedjs.remove_poll_option(this);">x</button>';
846        let elem = document.querySelectorAll(apo);
847        let last = elem[elem.length - 1];
848        let clone = last.cloneNode(true);
849        if (clone.querySelector('.poll-option-delete') == null) clone.innerHTML += delete_button;
850        let num = clone.querySelector('.num').innerHTML;
851        clone.querySelector('.num').innerHTML = parseInt(num) + 1;
852        clone.querySelector('input').value = '';
853        clone.querySelector('input').setAttribute('name', 'poll_option[]');
854        clone.querySelector('input').setAttribute('value', '');
855        last.after(clone);
856    },
857
858    /*= Remove poll option */
859    remove_poll_option: function(apo) {
860        let root = apo.parentNode;
861        root.parentNode.removeChild(root);
862    },
863
864    /*= Copy url from href */
865    copyurl: function(el) {
866        event.preventDefault();
867        var cpLink = el.getAttribute('href');
868        var dummy = document.createElement("input");
869        document.body.appendChild(dummy);
870        dummy.setAttribute('value', cpLink);
871        dummy.select();
872        document.execCommand('copy');
873        document.body.removeChild(dummy);
874    },
875
876    /*= Auto set file title from file name without extension */
877    autofiletitle: function() {
878        var fileUpload = document.getElementsByClassName('file');
879        for (var i = 0; i < fileUpload.length; i++) {
880            fileUpload[i].onchange = function() {
881                var filename = this.value;
882                var inputFileTitleName = this.name.replace('userfile', 'ntitle');
883                var k = filename.split('\\').pop().split('/').pop();
884                var a = k.split(".");
885                if (a.length === 1 || (a[0] === "" && a.length === 2)) {
886                    return "";
887                }
888                document.getElementsByName(inputFileTitleName)[0].value = a[0];
889            }
890        }
891    }
892
893};
894
895function addLoadEvent(funct) {
896    var oldonload = window.onload;
897    if (typeof window.onload != 'function') {
898        window.onload = funct;
899    } else {
900        window.onload = function() {
901            oldonload();
902            funct();
903        }
904    }
905}
906
907onloadfunct = function() {
908    sedjs.sedtabs();
909    sedjs.autofiletitle();
910    //	sedjs.sedtabs({c:"sedtabs2", e:"click", s:"selected", d:0, f:false });  //Example other tab conteiner
911    sedjs.getrel("sedthumb");
912    var cookie = sedjs.readCookie("style");  
913    var title = cookie ? cookie : sedjs.getPreferredStyleSheet();  
914    sedjs.setActiveStyleSheet(title);
915};
916
917addLoadEvent(onloadfunct);
918
919window.onunload = function() {  
920    var title = sedjs.getActiveStyleSheet();  
921    sedjs.createCookie("style", title, 365);
922    //sedjs.modal.cleanup();
923};

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.