PluginProbe
Easy Bootstrap Shortcode / trunk
Easy Bootstrap Shortcode vtrunk
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 / thumbnail / thumbnail_plugin.js

thumbnail_plugin.js in Easy Bootstrap Shortcode trunk, at shortcode/thumbnail/thumbnail_plugin.js

128 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var thumbnail={
2 title:"Responsive Image Shortcode",
3 id :'oscitas-form-thumbnail',
4 pluginName: 'thumbnail'
5 };
6 (function() {
7 _create_tinyMCE_options(thumbnail);
8 })();
9
10 function ebs_return_html_thumbnail(pluginObj){
11 var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table ebs-default-options">\
12 <th><label for="oscitas-label-content">'+ebsjstrans.upload+' '+ebsjstrans.image+':</label></th>\
13 <td id="osc_thumbnail_upload"><input id="oscitas-thumbnail-src" type="hidden" name="oscitas-thumbnail-src" value="" />\
14 <input id="_btn" class="upload_image_button" type="button" value="'+ebsjstrans.upload+' '+ebsjstrans.image+'" />\
15 </td>\
16 </tr>\
17 <tr>\
18 <th><label for="oscitas-thumbnail-link">'+ebsjstrans.alternate+' '+ebsjstrans.text+':</label></th>\
19 <td><input type="text" name="oscitas-alt-txt" id="oscitas-alt-txt" value=""/><br />\
20 </td>\
21 </tr>\
22 <tr>\
23 <th><label for="oscitas-thumbnail-link">'+ebsjstrans.link+':</label></th>\
24 <td><input type="text" name="oscitas-thumbnail-link" id="oscitas-thumbnail-link" value=""/><br />\
25 </td>\
26 </tr>\
27 <tr>\
28 <th><label for="oscitas-thumbnail-link">'+ebsjstrans.target+':</label></th>\
29 <td><select name="oscitas-thumbnail-link-target" id="oscitas-thumbnail-link-target"><option value="_self">'+ebsjstrans.self+'</option><option value="_blank">'+ebsjstrans.newtarget+'</option></select><br />\
30 </td>\
31 </tr>\
32 <tr>\
33 <th><label for="oscitas-thumbnail-link">'+ebsjstrans.show+' '+ebsjstrans.border+':</label></th>\
34 <td><input type="checkbox" name="oscitas-thumbnail-border" id="oscitas-thumbnail-border" value="1"/><br />\
35 </td>\
36 </tr>\
37 <tr>\
38 <th><label for="oscitas-thumbnail-class">'+ebsjstrans.customclass+':</label></th>\
39 <td><input type="text" name="line" id="oscitas-thumbnail-class" value=""/><br />\
40 </td>\
41 </tr>\
42 </table>\
43 <p class="submit ebs-default-options">\
44 <input type="button" id="oscitas-thumbnail-submit" class="button-primary" value="'+ebsjstrans.insert+' '+ebsjstrans.thumbnail+'" name="submit" />\
45 </p>\
46 <div class="pro-version-image aligncenter" style="display: none;"><img src="'+ebs_url+'shortcode/thumbnail/screenshot.jpg"/></div>\
47 </div>');
48
49 return form;
50 }
51
52 function create_oscitas_thumbnail(pluginObj){
53 var form=jQuery(pluginObj.hashId);
54
55
56
57 var table = form.find('table');
58
59
60
61 form.find('.upload_image_button').click(function() {
62 jQuery('body').addClass('ebs_plugin_shown_now');
63 jQuery('.ui-widget-overlay, .ui-dialog').css('z-index',100);
64 jQuery('html').addClass('Image');
65 formfield = jQuery(this).prev().attr('id');
66 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
67 return false;
68 });
69
70 window.original_send_to_editor = window.send_to_editor;
71
72 window.send_to_editor = function(html) {
73 if (formfield) {
74 if (jQuery(html).find('img').length) {
75 fileurl = jQuery('img', html).attr('src');
76 } else if (jQuery(html).attr('src')) {
77 fileurl = jQuery(html).attr('src');
78 }
79 jQuery('#' + formfield).val(fileurl);
80 tb_remove();
81 form.find('#osc_thumbnail_upload img').remove();
82 form.find('#osc_thumbnail_upload').append('<img src="'+fileurl+'">');
83 jQuery('body').removeClass('ebs_plugin_shown_now');
84 jQuery('html').removeClass('Image');
85
86 } else {
87 window.original_send_to_editor(html);
88 jQuery('body').removeClass('ebs_plugin_shown_now');
89 }
90
91 };
92
93
94 // handles the click event of the submit button
95 form.find('#oscitas-thumbnail-submit').click(function(){
96 var shortcode='';
97 var cusclass='',link='', border='',tget='', alt='';
98 if(table.find('#oscitas-thumbnail-class').val()!=''){
99 cusclass= ' class="'+table.find('#oscitas-thumbnail-class').val()+'"';
100 }
101 if(table.find('#oscitas-thumbnail-link').val()!=''){
102 link= ' link="'+form.find('#oscitas-thumbnail-link').val()+'"';
103 }
104
105 if(table.find('#oscitas-alt-txt').val()!=''){
106 alt= ' alt="'+form.find('#oscitas-alt-txt').val()+'"';
107 }
108
109 if(table.find('#oscitas-thumbnail-link-target').val()!=''){
110 tget= ' target="'+form.find('#oscitas-thumbnail-link-target').val()+'"';
111 }
112
113 if(table.find('#oscitas-thumbnail-border').is(':checked')){
114 border= ' border="1"';
115 }
116
117 if(form.find('#oscitas-thumbnail-src').val()!=''){
118 shortcode = '['+$ebs_prefix+'thumbnail'+link+cusclass+border+tget+alt+' src="'+form.find('#oscitas-thumbnail-src').val()+'"]';
119 }
120 // inserts the shortcode into the active editor
121 ebsInsertShortcode(shortcode);
122
123 // closes Dialoguebox
124 close_dialogue(pluginObj.hashId);
125 });
126 }
127
128