PluginProbe
Easy Bootstrap Shortcode / 2.5
Easy Bootstrap Shortcode v2.5
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 / well / well_plugin.js

well_plugin.js in Easy Bootstrap Shortcode 2.5, at shortcode/well/well_plugin.js

66 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var well={
2 title:"Well Shortcode",
3 id :'oscitas-form-well',
4 pluginName: 'well'
5 };
6 (function() {
7 _create_tinyMCE_options(well);
8 })();
9
10 function create_oscitas_well(pluginObj){
11 if(jQuery(pluginObj.hashId).length){
12 jQuery(pluginObj.hashId).remove();
13 }
14 // creates a form to be displayed everytime the button is clicked
15 // you should achieve this using AJAX instead of direct html code like this
16 var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table">\
17 <tr>\
18 <th><label for="oscitas-well-type">Well Type:</label></th>\
19 <td><select name="type" id="oscitas-well-type">\
20 <option value="">Default</option>\
21 <option value="well-lg">Large</option>\
22 <option value="well-sm">Small</option>\
23 </select><br />\
24 </td>\
25 </tr>\
26 <tr>\
27 <th><label for="oscitas-well-content">Well Content:</label></th>\
28 <td><textarea name="well" id="oscitas-well-content">Your Content</textarea><br />\
29 </td>\
30 </tr>\
31 <tr>\
32 <th><label for="oscitas-well-class">Custom Class:</label></th>\
33 <td><input type="text" name="line" id="oscitas-well-class" value=""/><br />\
34 </td>\
35 </tr>\
36 </table>\
37 <p class="submit">\
38 <input type="button" id="oscitas-well-submit" class="button-primary" value="Insert Well" name="submit" />\
39 </p>\
40 </div>');
41
42 var table = form.find('table');
43 form.appendTo('body').hide();
44
45
46
47
48 // handles the click event of the submit button
49 form.find('#oscitas-well-submit').click(function(){
50 var cusclass='';
51 if(table.find('#oscitas-well-class').val()!=''){
52 cusclass= ' class="'+table.find('#oscitas-well-class').val()+'"';
53 }
54 var shortcode = '[well type="'+jQuery('#oscitas-well-type').val()+'"'+cusclass+']<br class="osc"/>';
55 shortcode += jQuery('#oscitas-well-content').val()+'<br class="osc"/>';
56 shortcode += '[/well]';
57
58 // inserts the shortcode into the active editor
59 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
60
61 // closes fancybox
62 close_dialogue(pluginObj.hashId);
63 });
64 }
65
66