PageSourceSearch

https://korolgovorit.online/nassets/ea450fdc/file_widget.js?v=1765633899

js korolgovorit.online collected 2026-09-28 09:05:47 UTC 3,842 bytes, 119 lines download raw bytes

1window.fileWidgetQueueNum = 15;
2jQuery.widget( 'gc.fileWidget', {
3    uploader: null,
4    showButtonOnStart: false,
5    options: {
6        onComplete: null
7    },
8    _create: function () {
9        var self = this;
10
11        var $block = $("<div>");
12        $block.insertAfter( this.element );
13
14        this.stateEl = $("<span style='float: left;'>");
15        this.stateEl.appendTo( $block );
16
17        this.previewEl = $("<div>")
18        this.previewEl.appendTo( $block )
19
20        if ( this.element.val() == "" ) {
21            //this.stateEl.html( "Нет файла" );
22        }
23
24        var labelChange = 'Изменить';
25        var labelDelete = 'Удалить';
26
27        if (typeof Yii != 'undefined') {
28            labelChange = Yii.t( "common", "Change" );
29            labelDelete = Yii.t( "common", "Delete" );
30        }
31
32        var $controlsEl = $("<div style='padding-top: 10px'>");
33
34        $uploader = $("<a href='javascript:void(0)' class='dotted-link'>" + labelChange + "</a>");
35        $uploader.appendTo( $controlsEl );
36        this.uploader = $uploader;
37
38        this.deleteLink  = $deleteLink = $( "<a class='dotted-link' style='margin-left: 10px' href='javascript:void(0)'>" + labelDelete + "</a>" );
39        $deleteLink.click( function() {
40            self.element.val("");
41            self.element.change();
42            self.showPreview();
43        });
44        $deleteLink.appendTo( $controlsEl )
45
46        $controlsEl.appendTo( $block );
47
48        this.showPreview();
49
50        $uploader.click( function() {
51
52            if ( $(this).data('uploadifive-inited' ) ) {
53                return;
54            }
55
56            window.fileWidgetQueueNum++;
57            var queueId = "queue" + window.fileWidgetQueueNum;
58            $el = $("<div id='" + queueId + "'></div>")
59            $el.insertAfter( $(this))
60
61            var labelUpload = 'Загрузить';
62
63            if (typeof Yii != 'undefined') {
64                labelUpload = Yii.t( "common", "Upload" );
65            }
66
67            var uploadifiveParams = {
68                auto: true,
69                buttonText: labelUpload,
70                width: 120,
71                id: window.queueNum,
72                queueID: queueId,
73                dnd: false,
74                removeCompleted: true,
75                multi: false,
76                uploadScript: '/fileservice/widget/upload?deprecated=101'
77                    + '&secure=' + window.isEnabledSecureUpload
78                    + '&host=' + window.fileserviceUploadHost,
79                formData: {fullAnswer: true},
80                onUploadError: function (file, errorCode, errorMsg) {
81                    alert("ERROR");
82                },
83                onUploadComplete: function (e, res) {
84                    res = JSON.parse(res);
85                    self.element.val(res.hash);
86                    self.showPreview();
87                    self.element.change();
88                }
89            };
90
91            if (window.isEnabledSecureUpload && window.fileserviceUploadHost) {
92                uploadifiveParams.onUpload = getUploadifySecretLink;
93            }
94
95            $(this).uploadifive(uploadifiveParams);
96
97            $(this).data('uploadifive-inited', true)
98        })
99    },
100    showUploader: function() {
101        this.uploader.click();
102    },
103    showPreview: function( showFileWidgetIfNull ) {
104        var value = this.element.val();
105        if ( value && value != "" ) {
106            var thumbnailUrl = getThumbnailUrl( value, 200, 200 );
107            this.previewEl.html( "<img src='" + thumbnailUrl +"'>" );
108            this.previewEl.show();
109            this.deleteLink.show();
110        }
111        else {
112            this.previewEl.hide();
113            this.deleteLink.hide();
114            if ( showFileWidgetIfNull ) {
115                this.uploader.click();
116            }
117        }
118    }
119});

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.