PageSourceSearch

https://yama-onedrive.com/wp-content/plugins/drawit/js/qt-btn.js?ver=1.1.3&fver=20200320072146

js yama-onedrive.com collected 2026-10-07 18:50:05 UTC 4,007 bytes, 88 lines download raw bytes

1(function() {
2    plugin_slug = 'drawit';
3    plugin_name = 'DrawIt';
4    media_upload_url = drawitFE.mediaupload;
5
6    // Add text-only button.
7    QTags.addButton(plugin_slug, plugin_name, function(el, canvas) {
8        selected_code = "";
9        diag_title = "";
10        img_id = "";
11        canvas.focus();
12
13        // If editing an existing diagram, then get the path for it.
14        if(document.selection) { // IE
15			selected_code = document.selection.createRange().text;
16        } else { // FF, WebKit, Opera, etc.
17            selected_code = canvas.value.substring(canvas.selectionStart, canvas.selectionEnd);
18        }
19
20        canvas.focus();
21
22        // If this errors out, then just leave the title and id as default values.
23        try {
24            // Add <span></span> around this copy of selection for ease of jQuery parsing
25            // (eases matching of both <img> at top level or at nested level of selection).
26            j_code = jQuery('<span>' + selected_code + '</span>').find('img').first();
27
28            // If editing an existing diagram, then get the title of it (if provided).
29            diag_title = j_code.attr('title');
30            if (typeof diag_title === typeof undefined || diag_title === false) {
31                // If not in recognized <img> format, check for [drawit-svg] format.
32                svg_re = /\[\s*drawit-svg\s+(.*)\s*]/;
33                matching = svg_re.exec(selected_code);
34                selected_code = '<img ' + matching[1] + ' />';
35                j_code = jQuery('<span>' + selected_code + '</span>').find('img').first();
36
37                if (typeof diag_title === typeof undefined || diag_title === false) {
38                    diag_title = "";
39                } else {
40                    diag_title = '&title=' + diag_title;
41                }
42            } else {
43                diag_title = '&title=' + diag_title;
44            }
45
46            // If there are multiple classes defined, then find the one we want
47            // that has the attachment id#.
48            img_class = j_code.attr('class');
49            if (typeof img_class !== typeof undefined && img_class !== false) {
50                img_class_split = img_class.split(' ');
51                for(i = 0; i < img_class_split.length; i++) {
52                    elem = img_class_split[i];
53                    if(elem.indexOf('wp-image-') === 0) {
54                        img_class_split = elem.split('-');
55                        img_id = '&img_id=' + img_class_split[2];
56                    }
57                }
58            }
59
60        } catch(err) {
61            diag_title = "";
62            img_id = "";
63        }
64
65        // To attach new diagram to this post, need to also indicate post ID.
66        post_id_get = new RegExp('[\?&amp;]post=([^&amp;#]*)').exec(window.location.href);
67        post_id = (post_id_get !== null && post_id_get.length > 1) ? post_id_get[1] : 0;
68
69        // Here is the form to use.
70        //tb_show('Draw a diagram', 'media-upload.php?referer=' + plugin_slug + '&type=' + plugin_slug + '&post_id=' + post_id + diag_title + img_id + '&TB_iframe=true', false);
71        tb_show('Draw a diagram', media_upload_url + '?referer=' + plugin_slug + '&type=' + plugin_slug + '&post_id=' + post_id + diag_title + img_id + '&TB_iframe=true', false);
72
73        // "thickbox" from tb_show doesn't allow size overriding directly with
74        // 'width' and 'margin-left' (these get updated dynamically when the
75        // window resizes), so we need to work around this to make our
76        // editor's thickbox large enough to show the entire editor.
77        jQuery('#TB_window').css({
78            'min-width': '90%',
79            'left': 'calc(-1 * (' + jQuery('#TB_window').css('margin-left') + ') + 5%)',
80            'background': 'url("../wp-content/plugins/' + plugin_slug + '/img/wpspin-2x.gif") no-repeat center center #fff'
81        });
82        jQuery('#TB_window > iframe').css({
83            'min-width': '100%'
84        });
85
86        return false;
87    });
88})();

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.