PluginProbe
Easy Bootstrap Shortcode / 4.4
Easy Bootstrap Shortcode v4.4
trunk 2.4.0 2.5 3.4 3.5 3.6 3.7 4.0.0 4.4 4.5 4.5.4 5.0.0 5.0.1 5.0.2
easy-bootstrap-shortcodes / shortcode / image / image_plugin.js

image_plugin.js in Easy Bootstrap Shortcode 4.4, at shortcode/image/image_plugin.js

98 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var image={
2 title:"Image Effects Shortcode",
3 id :'oscitas-form-image',
4 pluginName: 'image'
5 };
6 (function() {
7 _create_tinyMCE_options(image);
8 })();
9
10 function ebs_return_html_image(pluginObj){
11 var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table">\
12 <tr><th><label for="oscitas-label-content">Upload Image:</label></th>\
13 <td id="osc_image_upload"><input id="oscitas-image-src" type="hidden" name="oscitas-thumbnail-src" value="" />\
14 <input id="_btn" class="upload_image_button" type="button" value="Upload Image" />\
15 </td>\
16 </tr>\
17 <tr>\
18 <th><label for="oscitas-image-shape">Image Shape:</label></th>\
19 <td><select name="oscitas-image-shape" id="oscitas-image-shape">\
20 <option value="img-rounded">Rounded</option>\
21 <option value="img-circle">Circle</option>\
22 <option value="img-thumbnail">Thumbnail</option>\
23 </select>\
24 </td>\
25 </tr>\
26 <tr>\
27 <th><label for="oscitas-image-class">Custom Class:</label></th>\
28 <td><input type="text" name="line" id="oscitas-image-class" value=""/><br />\
29 </td>\
30 </tr>\
31 </table>\
32 <p class="submit">\
33 <input type="button" id="oscitas-image-submit" class="button-primary" value="Insert Image" name="submit" />\
34 </p>\
35 </div>');
36 return form;
37 }
38 function create_oscitas_image(pluginObj){
39
40 var form=jQuery(pluginObj.hashId);
41
42 var table = form.find('table');
43
44
45
46 form.find('.upload_image_button').click(function() {
47 jQuery('body').addClass('ebs_plugin_shown_now');
48 jQuery('.ui-widget-overlay, .ui-dialog').css('z-index',100);
49 jQuery('html').addClass('Image');
50 formfield = jQuery(this).prev().attr('id');
51 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
52 return false;
53 });
54
55 window.original_send_to_editor = window.send_to_editor;
56
57 window.send_to_editor = function(html) {
58 if (formfield) {
59 if (jQuery(html).find('img').length) {
60 fileurl = jQuery('img', html).attr('src');
61 } else if (jQuery(html).attr('src')) {
62 fileurl = jQuery(html).attr('src');
63 }
64 jQuery('#' + formfield).val(fileurl);
65 tb_remove();
66 form.find('#osc_image_upload img').remove();
67 form.find('#osc_image_upload').append('<img src="'+fileurl+'">')
68 jQuery('body').removeClass('ebs_plugin_shown_now');
69 jQuery('html').removeClass('Image');
70
71 } else {
72 window.original_send_to_editor(html);
73 jQuery('body').removeClass('ebs_plugin_shown_now');
74 }
75
76 };
77
78
79 // handles the click event of the submit button
80 form.find('#oscitas-image-submit').click(function(){
81 var shortcode='';
82 var shape=form.find('#oscitas-image-shape').val();
83 var cusclass='';
84 if(table.find('#oscitas-image-class').val()!=''){
85 cusclass= ' class="'+table.find('#oscitas-image-class').val()+'"';
86 }
87 if(form.find('#oscitas-image-src').val()!=''){
88 shortcode = '['+$ebs_prefix+'image'+cusclass+' src="'+form.find('#oscitas-image-src').val()+'" shape="'+shape+'"]';
89 }
90 // inserts the shortcode into the active editor
91 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
92
93 // closes Dialoguebox
94 close_dialogue(pluginObj.hashId);
95 });
96 }
97
98