PageSourceSearch

https://imt-ishim.ru/simai/asset/simai.property/sf4/js/script.js?176523057936532

js imt-ishim.ru collected 2026-10-02 23:12:16 UTC 36,532 bytes, 889 lines download raw bytes

1
2function property() {
3
4    var list = document.body.querySelectorAll('input:not([type="hidden"])');
5    var select = document.body.querySelectorAll('select');
6    var textarea = document.body.querySelectorAll('textarea');
7    var checkbox = document.body.querySelectorAll('input[type="checkbox"]');
8    var listImage = document.body.querySelectorAll('[data-list]');
9    var cond = document.querySelectorAll('.radio-change');
10    var sort = document.querySelectorAll('[data-sort]');
11
12    function isTrue(el) {
13        if(el != null && el != undefined) return true; else return false;
14    }
15
16    var inactive = document.body.querySelectorAll('.sf4_property_inactive');
17
18    if(isTrue(inactive)) {
19        for(var k = 0; k < inactive.length; k++) {
20            var el = inactive[k];
21            el.addEventListener('click', function(e) {
22                e.currentTarget.classList.remove('sf4_property_inactive');
23                var input = e.currentTarget.querySelector('.hidden-input'),
24                    allElements = e.currentTarget.querySelectorAll('[disabled=""]');
25
26                for(var k = 0; k < allElements.length; k++)
27                    if(allElements[k].hasAttribute('disabled')) allElements[k].removeAttribute('disabled');
28                if(isTrue(input)) {
29                    input.setAttribute('value', "Y");
30                    input.value = "Y";
31                }
32                var allInput = e.currentTarget.querySelectorAll('input'),
33                    event = new Event('input');
34                if(isTrue(allInput)) {
35                    for(var x = 0; x < allInput.length; x++) {
36                        var eIn = allInput[x];
37                        if(eIn.classList.contains('hidden-input')) {
38                            eIn.focus();
39                        }
40                    }
41                }
42            })
43        }
44    }
45
46
47    var btnMulti = document.body.querySelectorAll('input[data-button-property=""]');
48        if(btnMulti != null) {
49            for(var k = 0; k < btnMulti.length; k++) {
50                btnMulti[k].onclick = function(e) {
51                    addField(e);
52                }
53            }
54        }
55
56
57    // ----------- SELECT ------------- //
58
59    if(select != null) {
60        for(var k = 0; k < select.length; k++) {
61            var slc = select[k];
62                slc.addEventListener('change', function(e) {
63                    var el = e.currentTarget;
64                    var chang = el.parentNode.querySelector('[if-type="checkbox"]');
65                    for(var s = 0; s < el.options.length; s++) {
66                        var opt = el.options[s];
67                        if(opt.selected) {
68                            opt.setAttribute('selected', '');
69                            if (chang != null) {
70                                chang.setAttribute('checked', 'checked');
71                                chang.setAttribute('value', opt.value);
72                            }
73                        } else {
74                            opt.removeAttribute('selected');
75                            if (chang != null) {
76                                chang.removeAttribute('checked');
77                            }
78                        }
79                    }
80                    var chan = new Event('change');
81                    if (chang != null) {
82                        chang.dispatchEvent(chan);
83                    }
84                });
85        }
86    }
87
88    if(isTrue(list)) {
89        for(var k = 0; k < list.length; k++) {
90            var el = list[k];
91            el.addEventListener('input', function(e) {
92                var input = e.target,
93                    condition = input.nextElementSibling,
94                    event = new Event('change');
95                if(condition !== null)
96                {
97                    if(condition.type != "hidden" || condition.type != "hidden") {
98                        if(isTrue(condition)) {
99                            condition.setAttribute('value', linkConditionSetValue(input) + input.value)
100                            condition.setAttribute('checked', 'checked');
101                            condition.dispatchEvent(event);
102                            if(input.hasAttribute('data-protocol')) {
103                                condition.value = linkConditionSetValue(input) + input.value;
104                            } else condition.value = input.value;
105                            condition.checked = true;
106                        }
107                        if(isTrue(input)) {
108                            if(input.classList.contains('form-check-input')) {
109                                if(input.checked) {
110                                    input.value = "Y";
111                                    input.checked = true;
112                                    input.setAttribute('value', 'Y');
113                                    input.setAttribute('checked', 'checked');
114                                } else {
115                                    input.setAttribute('value', 'N');
116                                    input.removeAttribute('checked');
117                                    input.checked = false;
118                                    input.value = "N";
119                                }
120                            }
121                        }
122                    }
123
124                }
125                
126            });
127        }
128    }
129
130    function linkConditionSetValue(input) {
131        if(input) {
132            if(input.hasAttribute('data-protocol')) {
133                
134                var container = input.parentNode,
135                    selectProtocol = container.querySelector('select[data-protocol=""]');
136                if(selectProtocol) {
137                    for(var k = 0; k < selectProtocol.options.length; k++) {
138                        var opt = selectProtocol.options[k];
139                        if(opt.selected) {
140                            return opt.value;
141                        }
142                    }
143                }
144            }
145        }
146    }
147
148    if(isTrue(textarea)) {
149        for(var k = 0; k < textarea.length; k++) {
150            var el = textarea[k];
151            el.addEventListener('input', function(e) {
152                var input = e.target,
153                    condition = input.nextElementSibling,
154                    event = new Event('change');
155                if(isTrue(condition)) {
156                    condition.setAttribute('value', input.value)
157                    condition.setAttribute('checked', 'checked');
158                    condition.dispatchEvent(event);
159                    condition.value = input.value;
160                    condition.checked = true;
161                }
162            })
163        }
164    }
165
166    if(isTrue(listImage)) {
167        for(var k = 0; k < listImage.length; k++) {
168            var data = listImage[k];
169            if(data.hasAttribute('data-list')) {
170                var dataList = data.getAttribute('data-list');
171                //imageAction(data);
172            }
173        }
174    }
175
176    // ----------- CHECKBOX ------------- //
177
178    if(checkbox != null) {
179        for(var k = 0; k < checkbox.length; k++) {
180            var check = checkbox[k],
181                chang = check.nextElementSibling;
182
183            if(check.checked) {
184                check.setAttribute('checked', '');
185                if(chang != null && chang != undefined)
186                    chang.setAttribute('checked', 'checked');
187            } else {
188                check.removeAttribute('checked', '');
189                if(chang != null && chang != undefined)
190                    chang.removeAttribute('checked');
191            }
192
193            if(chang != null && chang != undefined) {
194                var chan = new Event('change');
195                chang.dispatchEvent(chan);
196            }
197        }
198    }
199
200    var checkbox = document.body.querySelectorAll('[data-property-checkbox]');
201
202    if(checkbox != null) {
203        for(var k = 0; k < checkbox.length; k++) {
204            checkbox[k].addEventListener('change', function(e) {
205                var el = e.target,
206                    chang = el.nextElementSibling
207                if(el.checked) {
208                    el.value = 'Y'
209                    el.setAttribute('value', 'Y');
210                    el.setAttribute('checked', '');
211                    chang.setAttribute('checked', 'checked');
212                    chang.setAttribute('value', el.value);
213                } else {
214                    el.value = "N";
215                    el.setAttribute('value', 'N');
216                    el.setAttribute('checked', '');
217                    el.removeAttribute('checked');      
218                    chang.removeAttribute('checked');   
219                    chang.setAttribute('value', el.value);
220                }
221                var chan = new Event('change');
222                chang.dispatchEvent(chan);
223            });
224        }
225    }
226        if(inactive != null) {
227            for(var i = 0; i < inactive.length; i++) {
228
229                var input = inactive[i].querySelectorAll('input'),
230                    select = inactive[i].querySelectorAll('select'),
231                    textarea = inactive[i].querySelectorAll('textarea');
232
233                if(inactive[i].hasAttribute('data-input')) {
234                    inactive[i].ondragend = function(e) {
235                        e.target.parentNode.parentNode.querySelector('.hidden-input').value = 'Y'; 
236                        searchParent(e.target);				
237                    }
238                }
239
240                if(input != null) {
241                    for(var k = 0; k < input.length; k++) {
242                        var data = input[k];
243
244                        
245
246                        if(data.hasAttribute('data-property-checkbox')) {
247                            var dataCheck = data.getAttribute('data-property-checkbox');
248                                data.addEventListener('input', function(e) {
249                                    var el = e.target,
250                                        elHidden = el.parentNode.querySelector('.hidden-input');
251
252                                    if(el.checked) {
253                                        el.value = 'Y';
254                                        el.setAttribute('value', 'Y');
255                                        el.setAttribute('checked', 'checked');
256                                    } else {
257                                        el.value = 'N';
258                                        el.setAttribute('value', 'N');
259                                        el.removeAttribute('checked')
260                                    }
261                                    
262                                    if(elHidden != null) {
263                                        elHidden.value = 'Y'; 
264                                        elHidden.setAttribute('value', 'Y');                                                                       
265                                    }
266                                    searchParent(el);
267                                });
268                        }
269
270                        if(data.hasAttribute('data-entity')) {
271                            if(data.getAttribute('data-entity')) {
272
273                                var btn = data.parentNode.querySelector('input[type="button"]');
274                                if(btn != null) {
275                                    btn.addEventListener('click', function(e) {
276                                        var el = e.target;
277                                        var hidden = el.parentNode.parentNode.querySelector('.hidden-input');
278                                        hidden.value = "Y";
279                                        hidden.setAttribute('value', 'Y');
280                                        searchParent(el);
281                                    });
282                                }
283                            }
284                        }
285
286                        if(data.hasAttribute('data-datetime')) {
287                            if(data.getAttribute('data-datetime') == 'inactive-public') {
288                                data.addEventListener('click', function(e) {
289                                    data.classList.remove("sf4_property_inactive");
290                                })
291                                inactiveMode(data);
292                            }
293                        }
294                    }
295                }
296            }
297        }
298
299
300        if(list != null) {
301            for(var k = 0; k < list.length; k++) {
302                var listOne = list[k];
303                
304                if(listOne.hasAttribute('data-list')) {
305                    switch(listOne.getAttribute('data-list')) {
306                        case 'public-button':
307                            imageAction(listOne, true);
308                            break;
309                        case 'public-button-radio':
310                            imageAction(listOne, true);
311                            break;
312                        case 'public-image-list-one':
313                            imageAction(listOne);
314                        break;
315                        case 'public-image-list-multi':
316                            imageAction(listOne);
317                            break;                  
318                    }
319                }
320
321                if(listOne.hasAttribute('data-number')) {
322                    switch(listOne.getAttribute('data-number')) {
323                        case 'public-one':
324                            
325                            listOne.addEventListener('input', function(e) {
326                                var chang = e.target.nextElementSibling;
327                                chang.setAttribute('value', e.target.value);
328                                chang.setAttribute('checked', 'checked')
329                                var chan = new Event('change');
330                                chang.dispatchEvent(chan);
331                            });
332                            break;
333                    }
334                }
335            }
336        }
337
338        function addField(e) {
339            var btn = e.target,
340                container = btn.parentNode;
341            if(container != null) {
342                var el = container.querySelectorAll("*");
343                var propContainerElement = btn.parentNode.parentNode.querySelectorAll('*');
344                var input = [],
345                    entity = [],
346                    string = [],
347                    text = [],
348                    number = [],
349                    phone = [],
350                    url = [],
351                    link = [],
352                    date = [];
353
354                for(var i = 0; i < el.length; i++) {
355                    if(el[i].hasAttribute('data-property-field')) {
356                        switch(el[i].getAttribute('data-property-field')) {
357                            case 'entity':
358                                entity.push(el[i]);
359                                break;
360                            case 'string':
361                                string.push(el[i]);
362                                break;
363                            case 'text':
364                                text.push(el[i]);
365                                break;
366                            case 'number':
367                                number.push(el[i]);
368                                break;
369                            case 'phone':
370                                phone.push(el[i]);
371                                break;
372                            case 'url':
373                                url.push(el[i]);
374                                break;
375                            /*case 'link':
376                                link.push(el[i]);
377                                break;*/
378                            case 'date':
379                                date.push(el[i]);
380                                break;
381                        }
382                    }
383                }
384                for(var k = 0; k < propContainerElement.length; k++) {
385                    if(propContainerElement[k].hasAttribute('data-property-field')) {
386                        switch(propContainerElement[k].getAttribute('data-property-field')) {
387                            case 'link':
388                                link.push(propContainerElement[k]);
389                                break;
390                        }
391                    }
392                }
393                if(entity.length != 0) addEntity(entity, e);
394                if(text.length != 0) addText(text, e);
395                if(string.length != 0) addString(string, e);
396                if(number.length != 0) addString(number, e);
397                if(phone.length != 0) addString(phone, e);
398                if(url.length != 0) addString(url, e);
399                if(link.length != 0) addStringLink(link, e);
400                if(date.length != 0) addDate(date, e);
401            }
402        }
403        
404        function inactiveMode(input) {
405
406
407            input.addEventListener('input', function(e) {
408                var el = e.target;
409                el.parentNode.parentNode.querySelector('.hidden-input').value = 'Y'; 
410                searchParent(el);
411            });
412
413            input.addEventListener('change', function(e) {
414                var el = e.target;            
415                el.parentNode.parentNode.querySelector('.hidden-input').value = 'Y'; 					
416                searchParent(el);
417            });
418        }
419
420        function imageAction(input, active) {
421            input.addEventListener('click', function(e) {
422                var el = e.target;
423                var radio = el.parentNode.parentNode.querySelectorAll('input');
424                
425
426                var chang = el.nextElementSibling;
427                if(isTrue(chang))
428                    var par = chang.parentNode.parentNode.querySelectorAll('.radio-ch
428ange');
429                else {
430                    chang = el.parentNode.parentNode.querySelector('.radio-change');
431                    par = el.parentNode.parentNode.querySelectorAll('.radio-change');
432                }
433
434                var checkedValue = '';
435
436                for(var k = 0; k < radio.length; k++) {
437                    if(radio[k].checked && radio.length == 1) {
438                        checkedValue += radio[k].value
439                    } else if(radio[k].checked && radio.length > 1) {
440                        checkedValue += radio[k].value;
441                    }
442                }
443
444                par[0].setAttribute('value', checkedValue)
445
446                chang.setAttribute('checked', 'checked')
447                
448
449                var chan = new Event('change');
450                chang.dispatchEvent(chan);
451                par[0].dispatchEvent(chan)
452                chang.setAttribute('value', el.value);
453
454
455                if(input.type == 'radio') {
456                    for(var k = 0; k < radio.length; k++) {
457                        radio[k].checked = false;
458                        radio[k].removeAttribute('checked');
459                        if(active) radio[k].parentNode.classList.remove('active');   
460                    }
461                    el.checked = true;
462                    el.setAttribute('checked', '');
463                    if(active) el.parentNode.classList.add('active');
464                } else if(input.type == 'checkbox') {
465                    if(!el.checked) {
466                        el.checked = false;
467                        el.removeAttribute('checked');
468                        if(active) el.parentNode.classList.remove('active');
469                    } else {
470                        el.checked = true;
471                        el.setAttribute('checked', '');
472                        if(active) el.parentNode.classList.add('active');
473                    }
474                }
475            });
476        }
477
478        function searchParent(el) {
479            if(el != null && el.tagName != 'BODY') {
480                if(!el.parentNode.classList.contains('sf4_property_inactive')) searchParent(el.parentNode);
481                else el.parentNode.classList.remove('sf4_property_inactive');
482            }
483        }
484        
485        function rand() {
486            return Math.random() * (500000000000000000 - 50000000000000000) + 50000000000000000;
487        }
488
489        function addStringLink(link, e) {
490            var btnContainer = document.createElement('div');
491            btnContainer.className = e.currentTarget.parentNode.getAttribute('class');
492            var endClone = link[link.length - 1].cloneNode(true),
493                btnClone = e.currentTarget.cloneNode(true),
494                input = endClone.querySelectorAll('input'),
495                name = [];
496            if(input) {
497                for(var k = 0; k < input.length; k++) name.push(input[k].name);
498                for(var k = 0; k < input.length; k++) {
499                    input[k].value = '';
500                    input[k].name = fieldIncrementName(name[k], link);
501                    input[k].removeAttribute('required');
502                }
503                btnClone.onclick = function(ev) {
504                    addField(ev);
505                }
506                btnContainer.appendChild(btnClone);
507                link.push(endClone);
508                link.push(btnContainer);
509                var parent = link[0].parentNode;
510                parent.innerHTML = '';
511                for(var i = 0; i < link.length; i++) parent.appendChild(link[i]);
512            }
513        }
514
515        function addString(string, e) {
516            var endClone = string[string.length - 1].cloneNode(true),
517                btnClone = e.target.cloneNode(true),
518                input = endClone.querySelectorAll('input'),
519                name = input[0].name;
520                btnClone.onclick = function(e) {
521                    addField(e);
522                }
523                if(input == null)
524                    input = endClone.querySelectorAll('textarea');
525                input[0].value = '';
526                input[0].name = nameReplace(name, string);
527                input[0].removeAttribute('required');
528
529                if(input[0].hasAttribute('data-phone')) {
530                    var id = 'phone_mask_' + rand();
531                    input[0].id = id;
532                    id = '#' + id;
533
534                    jQuery(function($) {
535                        $(id).mask('+9 (999) 999-9999');
536                    });
537                }
538
539                if(input[0].hasAttribute('data-url')) {
540                    var id = rand();
541                    input[0].id = id;
542                    var btn = input[1];
543                    if(btn != null) {
544                        btn.addEventListener('click', function(e) {
545                                BX.adminShowMenu(this, [
546                                    {'TEXT':'Site directory','TITLE':'#SITE_DIR# - Site directory','ONCLICK':'SF.SFSetUrlVar(\'#
546SITE_DIR#\', \''+ id + '\')'},
547                                    {'SEPARATOR':true},
548                                    {'TEXT':'Storage id','TITLE':'#STORAGE_ID# - Storage id','ONCLICK':'SF.SFSetUrlVar(\'#STORAGE_ID#\', \''+ id + '\')'},
549                                    {'TEXT':'Section id','TITLE':'#SECTION_ID# - Section id','ONCLICK':'SF.SFSetUrlVar(\'#SECTION_ID#\', \''+ id + '\')'},
550                                    {'TEXT':'Item id','TITLE':'#ITEM_ID# - Item id','ONCLICK':'SF.SFSetUrlVar(\'#ITEM_ID#\', \''+ id + '\')'}], ''
551                                );
552                            });
553                    }
554                }
555                
556                string.push(endClone);
557                string.push(btnClone);
558                var parent = string[0].parentNode;
559                parent.innerHTML = '';
560                for(var i = 0; i < string.length; i++) parent.appendChild(string[i]);
561        }
562
563        function addDate(date, e) {
564            var endClone = date[date.length - 1].cloneNode(true),
565                btnClone = e.target.cloneNode(true);
566                var input = endClone.querySelectorAll('input'),
567                name = input[0].name;
568                btnClone.onclick = function(e) {
569                    addField(e);
570                }
571                input[0].value = '';
572                input[0].name = nameReplace(name, date);
573                input[0].removeAttribute('required');
574                date.push(endClone);
575                date.push(btnClone);
576                var parent = date[0].parentNode;
577                parent.innerHTML = '';
578                for(var i = 0; i < date.length; i++) parent.appendChild(date[i]);
579
580                jQuery(function($) {
581                    $('input[name="' + input[0].name + '"]').flatpickr({
582                        dateFormat: "d.m.Y",
583                        allowInput: true,
584                        locale: 'ru',
585                    });
586                });
587        }
588
589        function addText(text, e) {
590            var endClone = text[text.length - 1].cloneNode(true),
591                btnClone = e.target.cloneNode(true),
592                textArea = endClone.querySelectorAll('textarea'),
593                name = textArea[0].name;
594                btnClone.onclick = function(e) {
595                    addField(e);
596                }
597                var newText = document.createElement('textarea'),
598                    conText = document.createElement('div');
599                conText.className = 'form-group';
600                conText.setAttribute('data-property-field', 'text');
601                newText.name = nameReplace(name, text);
602                newText.className = 'form-control';
603                newText.removeAttribute('required');
604                newText.rows = textArea[0].rows;
605                newText.cols = textArea[0].cols;
606                conText.appendChild(newText);  
607                text.push(conText);
608                text.push(btnClone);
609                var parent = text[0].parentNode;
610                parent.innerHTML = '';
611                for(var i = 0; i < text.length; i++) parent.appendChild(text[i]);
612        }
613
614        function nameReplace(name, text) {
615            /*var startIndex = name.indexOf('[n', 0);
616            var length = 2;
617            if (startIndex < 0) {
618                startIndex = name.indexOf('[', 0);
619                length = 1;
620            }
621
622            if(text.length > 11) {
623                var index = name.substr(startIndex + length, 2);
624                var name = name.substr(0, name.length - 3);
625            }
626            else {
627                var index = name.substr(startIndex + length, 1);
628                var name = name.substr(0, name.length - 2);
629            }
630            
631            name += (Number(index)) + rand() + ']';*/
632            
633            var name_arr = name.split('[n');
634            var n_index = name_arr.pop();
635            if (n_index && name_arr.length > 0)
636            {
637                n_index = '0' + n_index.replace(/\D+/g,"");
638                n_index = parseInt(n_index);
639                n_index ++;
640                name = name_arr.join('[n');
641                name += '[n' +  n_index + ']';
642            }
643            else
644            {
645                var name_arr = name.split('[');
646                name_arr.pop();
647                name = name_arr.join('[');
648                name += '[n0]';
649            }
650            
651            return name;
652        }
653
654        function fieldIncrementName(name, text) {
655            var limit = name.substr(name.indexOf('[n', 0) + 2),
656                index = name.substr(name.indexOf('[n', 0) + 2, limit.length - 2),
657                name = name.substr(0, name.indexOf('[n', 0) + 2);
658            index++;
659            return name + index + '1]';
660        }
661
662        function addEntity(entity, e) {
663            var cI = entity[entity.length - 1].cloneNode(true),
664                cB = e.target.cloneNode(true),
665                inp = cI.querySelectorAll('input'),
666                id = inp[0].id,
667                btn = inp[1].getAttribute('onclick'),
668                name = inp[0].name,
669                randId = rand();
670
671            cB.onclick = function(e) {
672                addField(e);
673            }
674            btn = btn.replace(id, randId);
675            inp[0].value = '';
676            inp[0].name = nameReplace(name, entity);
677            inp[0].setAttribute('id', randId);
678            inp[1].setAttribute('onclick', btn);
679            entity.push(cI);
680            entity.push(cB);
681            var parent = entity[0].parentNode;
682            parent.innerHTML = '';
683            for(var j = 0; j < entity.length; j++) parent.appendChild(entity[j]);
684        }
685
686
687    // #region Link
688    
689        var link = document.body.querySelectorAll('.container-link');
690        for(var k = 0; k < link.length; k++) {
691            var container = link[k].querySelectorAll('.property_link');
692            for(var w = 0; w < container.length; w++) {
693                var input = container[w].querySelectorAll('input');
694                var select = container[w].querySelector('select');
695                for(var h = 0; h < input.length; h++) {
696                    if(input[h].hasAttribute('data-protocol')) {
697                        deleteSpace(input[h]);
698                        replaiceProtocol(select, input[h]);
699                        identifyProtocol(input[h]);
700                    }
701                }
702            }
703        }
704
705       /* window.addEventListener('click', function(e) {
706            var el = e.target;
707            if(el.oninput != null)
708                identifyProtocol(el);
709            if(el.hasAttribute('data-protocol'))
710                identifyProtocol(el);
711        });*/
712
713        function deleteSpace(input) {
714            var str = '';                
715            for(var s = 0; s < input.value.length; s++) if(input.value[s] != ' ') str += input.value[s];
716            input.value = str;
717        }
718
719        function identifyProtocol(el) {
720            if(el.hasAttribute('data-protocol')) { 
721                var input = el;
722                var select = el.parentNode.querySelector('select');
723                if(input != null) {
724                    if(input.hasAttribute('data-protocol')) {
725                        el.elSelect = select;
726                        select.elInput = el;
727                        el.oninput = function(e) {
728                            let input = e.currentTarget;
729                            replaiceProtocol(input.elSelect, input);
730                        }
731                        select.addEventListener('change', function(e) {
732                            var sel = e.currentTarget;
733                            replaiceProtocol(sel, sel.elInput);
734                        })
735                    }
736                }
737            }
738        }
739
740        function replaiceProtocol(select, input) {
741            deleteSpace(input);
742            var fullLink = select.parentNode.querySelector('input[data-link-full=""]');
743            for(var j = 0; j < select.options.length; j++) {
744                var options = select.options[j];
745                if(input.value.substring(0, options.value.length) == options.value) {
746                    select.selectedIndex = j;
747                    input.value = input.value.substring(options.value.length, input.value.length);
748                    select.options[j].setAttribute('selected', '');
749                    select.options[j].selected = true;
750                } else if(input.value.substring(0, 1) === '/') {
751                    select.selectedIndex = 2;
752                    select.options[2].selected = true;
753                    select.options[2].setAttribute('selected', '');
754                } else if(input.value.substring(0, options.value.length) === './') {
755                    select.selectedIndex = 3;
756                    select.options[3].selected = true;
757                    select.options[3].setAttribute('selected', '');
758                } else if(input.value.substring(0, options.value.length) === '../') {
759                    select.selectedIndex = 4;
760                    select.options[4].selected = true;
761                    select.options[4].setAttribute('selected', '');
762                }
763            }
764            if(input.value != "") fullLink.value = setFullLink(select) + input.value;
765            else fullLink.value = '';
766        }
767
768        function setFullLink(select) {
769            for(var k = 0; k < select.options.length; k++) if(select.options[k].selected) return select.options[k].value;
770            return false;
771        }
772
773        if(isTrue(cond)) {
774            for(var k = 0; k < cond.length; k++) {
775                var el = cond[k],
776                    event = new Event('change');
777                el.dispatchEvent(event);
778            }
779        }
780
781    // #endregion Link
782
783    SF.SFSetUrlVar = function(id, el_id) {
784    var obj_ta = BX(el_id);
785    //IE
786    if (document.selection) {
787        obj_ta.focus();
788        var sel = document.selection.createRange();
789        sel.text = id;
790        //var range = obj_ta.createTextRange();
791        //range.move('character', caretPos);
792        //range.select();
793    }
794    //FF
795    else if (obj_ta.selectionStart || obj_ta.selectionStart == '0')
796    {
797        var startPos = obj_ta.selectionStart;
798        var endPos = obj_ta.selectionEnd;
799        var caretPos = startPos + id.length;
800        obj_ta.value = obj_ta.value.substring(0, startPos) + id + obj_ta.value.substring(endPos, obj_ta.value.length);
801        obj_ta.setSelectionRange(caretPos, caretPos);
802        obj_ta.focus();
803    }
804    else
805    {
806        obj_ta.value += id;
807        obj_ta.focus();
808    }
809
810    BX.fireEvent(obj_ta, 'change');
811    obj_ta.focus();
812}
813
814
815'use strict';
816
817;( function ( document, window, index ) {
818    var inputs = document.querySelectorAll( '[data-file=""]' );
819    
820    Array.prototype.forEach.call( inputs, function( input )
821    {
822        var label	 = input.nextElementSibling,
823            labelVal = label.innerHTML;
824
825        input.addEventListener( 'change', function(e) {  
826            var fileName = '';
827            if( this.files && this.files.length > 1 )
828                fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
829            else fileName = e.target.value.split( '\\' ).pop();
830
831            if( fileName ) {
832                if(fileName.length > 16)
833                    label.querySelector( 'span' ).innerHTML = fileName.slice(0, 16) + '...';
834                else label.querySelector( 'span' ).innerHTML = fileName;
835            }
836            else label.innerHTML = labelVal;
837
838            // Для свойств
839            var el = e.target;
840            if(el.hasAttribute('data-inactive'))
841                el.parentNode.parentNode.classList.remove('sf4_property_inactive')
842        });
843
844        // Firefox bug fix
845        input.addEventListener( 'focus', function(){ input.classList.add( 'has-focus' ); });
846        input.addEventListener( 'blur', function(){ input.classList.remove( 'has-focus' ); });
847    });
848}( document, window, 0 ));
849
850
851};
852
853
854try {
855    property();
856} catch(error) {
857    window.addEventListener('DOMContentLoaded', function(e) {
858        property();
859    });
860}
861
862
863
864
865
866SF.send = function(event, element) {
867    if(document.createEvent){
868        var e = document.createEvent('Events');
869        e.initEvent(event, true, false);
870    }
871    else if(document.createEventObject()) {
872        var e = document.createEventObject();
873    }
874    else return;
875
876    if(element.dispatchEvent)
877        element.dispatchEvent(e);
878    else if(element.fireEvent) element.fireEvent(event, e);
879}
880
881SF.receive = function(event, el, handler) {
882    if(window.addEventListener)
883        el.addEventListener(event, handler, false);
884    else if(window.attachEvent)
885        el.attachEvent(event, handler);
886}
887
888SF.receive('open-setting', window, property);
889

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.