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 / labels / labels_plugin.js

labels_plugin.js in Easy Bootstrap Shortcode 2.5, at shortcode/labels/labels_plugin.js

69 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var labels={
2 title:"Label Shortcode",
3 id :'oscitas-form-label',
4 pluginName: 'labels'
5 };
6 (function() {
7 _create_tinyMCE_options(labels);
8 })();
9
10 function create_oscitas_labels(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-label-type">Label Type:</label></th>\
19 <td><select name="type" id="oscitas-label-type">\
20 <option value="label-default">Default</option>\
21 <option value="label-primary">Primary</option>\
22 <option value="label-success">Success</option>\
23 <option value="label-info">Information</option>\
24 <option value="label-warning">Warning</option>\
25 <option value="label-danger">Danger</option>\
26 </select><br />\
27 </td>\
28 </tr>\
29 <tr>\
30 <th><label for="oscitas-label-content">Label Content:</label></th>\
31 <td><input type="text" name="label" id="oscitas-label-content" value="Label"/><br />\
32 </td>\
33 </tr>\
34 <tr>\
35 <th><label for="oscitas-label-class">Custom Class:</label></th>\
36 <td><input type="text" name="line" id="oscitas-label-class" value=""/><br />\
37 </td>\
38 </tr>\
39 </table>\
40 <p class="submit">\
41 <input type="button" id="oscitas-label-submit" class="button-primary" value="Insert Label" name="submit" />\
42 </p>\
43 </div>');
44
45 var table = form.find('table');
46 form.appendTo('body').hide();
47
48
49
50
51 // handles the click event of the submit button
52 form.find('#oscitas-label-submit').click(function(){
53 var cusclass='';
54 if(table.find('#oscitas-label-class').val()!=''){
55 cusclass= ' class="'+table.find('#oscitas-label-class').val()+'"';
56 }
57 var shortcode = '[label type="'+jQuery('#oscitas-label-type').val()+'"'+cusclass+']<br/>';
58 shortcode += jQuery('#oscitas-label-content').val()+'<br/>';
59 shortcode += '[/label]';
60
61 // inserts the shortcode into the active editor
62 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
63
64 // closes fancybox
65 close_dialogue(pluginObj.hashId);
66 });
67 }
68
69