PageSourceSearch

https://110km.ru/js/attachments.js

js 110km.ru collected 2026-09-25 03:02:00 UTC 4,971 bytes, 165 lines download raw bytes

1function browseAttachments(url, field_id, type, subtype)
2{
3    url += '?field=' + field_id;
4    if (type) {
5        url += '&type=' + type;
6        if (subtype) {
7            url += '&subtype=' + subtype;
8        }
9    }
10
11    window.open(url, 'att_browser', 'top=10,left=10,width=600,height=500,location=0,status=1,scrollbars=1,toolbar=0,resizable=1');
12}
13
14function sendBack(field_id, id, guid, filename, width, height)
15{
16    if (field_id == 'tinyMCElight') {
17        sendBackToTinyMCElight(guid, filename, width, height);
18    } else if (field_id == 'tinyMCE') {
19        sendBackToTinyMCE(guid, filename, width, height);
20    } else if (field_id.substr(0, 18) == 'gallery_container_') {
21        sendBackToGalleryContainer(field_id.substr(18, field_id.length - 18), id, guid, filename, width, height);
22    } else {
23        if (window.parent.document.getElementById(field_id)) {
24            window.parent.document.getElementById(field_id).value="/attachment/"+guid+"/"+filename;
25            top.tinymce.activeEditor.windowManager.close();
26            return;
27        }
28        var win = window.opener;
29        var elm = win.document.getElementById(field_id);
30        if (elm) {
31            elm.value = id;
32            with (win.document) {
33                getElementById('txt_' + field_id).firstChild.nodeValue = filename;
34                getElementById('reset_' + field_id).style.display = 'inline';
35
36                var preview = getElementById('preview_' + field_id);
37                if (!preview) {
38                    var container = getElementById('preview_container_' + field_id);
39                    var preview = createElement('img');
40
41                    container.appendChild(preview);
42
43                    preview.id = 'preview_' + field_id;
44                    preview.alt = 'preview';
45                }
46                preview.src = generateAttachmentUrl(guid, filename, 200, 48, true);
47            }
48            win.focus()
49            window.close();
50        }
51    }
52}
53
54function sendBackMany(field_id, fields)
55{
56
57	console.log(field_id);
58
59    if (field_id.substr(0, 18) == 'gallery_container_') {
60
61
62        var win = window.opener;
63        var gallery_name = field_id.substr(18, field_id.length - 18);
64
65        fields.each(
66            function (item)
67            {
68            	console.log(item);
69                win.addImageToGallery(gallery_name, item.id, item.guid, item.filename, item.width, item.height);            
70            }
71        )
72
73        win.focus();
74        window.close();
75    } else {
76        sendBack(field_id, fields[0].id, fields[0].guid, fields[0].filename, fields[0].width, fields[0].height);
77    }
78}
79
80function sendBackToGalleryContainer(gallery_name, id, guid, filename, width, height)
81{
82    var win = window.opener;
83    win.addImageToGallery(gallery_name, id, guid, filename, width, height);
84    win.focus();
85    window.close();        
86}
87
88function sendBackToTinyMCE(guid, filename, width, height)
89{
90    var url = '/attachment/' + guid + '/' + filename;
91    var win = opener.tinyMCE.getWindowArg('window');
92    //var win = opener.tinyMCE.tinyMCEPopup.getWindowArg('window');
93    if (win.document.getElementById('src')) {
94        win.document.getElementById('src').value = url;
95        //win.showPreviewImage(url);
96    } else if (win.document.getElementById('file')) {
97
98        win.document.getElementById('file').value = url;
99        win.document.getElementById('width').value = width;
100        win.document.getElementById('height').value = height;
101    }
102
103    win.focus();
104
105    window.close();
106}
107
108function sendBackToTinyMCElight(guid, filename, width, height)
109{
110    var url = '/attachment/' + guid + '/' + filename;
111    var win = opener.tinyMCE.getWindowArg('window');
112
113    win.document.getElementById('src').value = url;
114    win.document.getElementById('width').value = width;
115    win.document.getElementById('height').value = height;
116
117    win.focus();
118
119    window.close();
120}
121
122function resetAttachmentsChoice(id)
123{
124    with (document) {
125        getElementById(id).value = '';
126        getElementById('txt_' + id).firstChild.nodeValue = '(файл не выбран)';
127        getElementById('reset_' + id).style.display = 'none';
128
129        var preview = getElementById('preview_' + id);
130        if (preview) {
131            preview.parentNode.removeChild(preview);
132        }
133    }
134}
135
136function generateAttachmentUrlFromObj(obj)
137{
138    return generateAttachmentUrl(obj.guid, obj.filename, obj.width, obj.height, true);
139}
140
141function generateAttachmentPreviewUrlFromObj(obj)
142{
143    return generateAttachmentUrl(obj.guid, obj.filename, 64, 64, true);
144}
145
146function generateAttachmentUrl(guid, filename, width, height, proportional)
147{
148    var url = 'attachment/' + guid;
149
150    if (proportional == true)
151        url += '/proportional';
152
153    if (width || height) {
154        url += '/';
155        if (width)
156            url += width;
157        url += 'x';
158        if (height)
159            url += height;
160    }
161
162    url += '/' + filename;
163
164    return url;
165}

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.