PageSourceSearch

https://www.turpravda.ua/static/js/widgets/UploadPhotoWidget.js

js turpravda.ua collected 2026-09-26 07:24:30 UTC 1,761 bytes, 67 lines download raw bytes

1function UploadPhotoWidget($selector, $editorInstance ,$parrent) {
2    var $this = this;
3    var $ = jQuery;
4
5    $this.selector = $selector;
6    $this.widget = {};
7
8    $this.editor = $editorInstance;
9
10    $this.init = function () {
11        $this.widget = $($this.selector);
12
13        $this.insertButton = $this.widget.find('.insertInEditor');
14
15        $( document ).on( "click",  '.insertInEditor', $this.insertButtonClick);
16    };
17
18
19    $this.insertButtonClick = function($e){
20        // Getting clicked element
21        var $el = $($e.target),
22            $cDiv = $el.parent().parent(),
23            $mid = $cDiv.attr('mediaid'),
24            $mDiv = $cDiv.parent();
25
26        var $desc = $mDiv.find('textarea').val();
27
28        var $process =  $this.getMediaUrl($mid);
29
30        $process.success(function($data){
31            if($data && $data.url){
32                $el = $("<img>").attr('src',$data.url);
33                var $html = "<div>" +
34                    "<a href='"+$data.url+"' target='_blank'><img src='"+$data.url+"'></a>";
35
36                if($desc){
37                    $html += "<small>" +
38                            $desc +
39                    "</small>";
40                }
41                
42                $html += "</div>";
43
44                var newElement = CKEDITOR.dom.element.createFromHtml( $html, $this.editor.document );
45                $this.editor.insertElement( newElement );
46
47            }
48        })
49        //console.log($mid);
50    }
51
52    $this.getMediaUrl = function($mId){
53       var $result = $.ajax({
54            url: "/media/getMediaUrl/",
55            type: 'post',
56            dataType: 'json',
57            data : {
58                'mediaId': $mId
59            }
60        });
61
62        return $result;
63    }
64
65    $this.init();
66
67}

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.