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 / rule / rule_plugin.js

rule_plugin.js in Easy Bootstrap Shortcode 2.5, at shortcode/rule/rule_plugin.js

92 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var rule={
2 title:"Horizontal Rule Shortcode",
3 id :'oscitas-form-rule',
4 pluginName: 'rule',
5 setRowColors:false
6 };
7 (function() {
8 _create_tinyMCE_options(rule);
9 })();
10
11 function create_oscitas_rule(pluginObj){
12 if(jQuery(pluginObj.hashId).length){
13 jQuery(pluginObj.hashId).remove();
14 }
15 // creates a form to be displayed everytime the button is clicked
16 // you should achieve this using AJAX instead of direct html code like this
17 var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table">\
18 <tr>\
19 <th><label for="oscitas-rule-style">Style:</label></th>\
20 <td><select name="type" id="oscitas-rule-style">\
21 <option value="rule-dotted">Dotted</option>\
22 <option value="rule-dashed">Dashed</option>\
23 <option value="rule-double">Double</option>\
24 <option value="rule-double-thick-thin">Double Thick Thin</option>\
25 <option value="rule-fadecorder">Fade Corner</option>\
26 <option value="rule-double-fadecorder">Double Fade Corner</option>\
27 <option value="rule-shadow">Shadow</option>\
28 <option value="rule-diagonal">Diagonal</option>\
29 <option value="rule-wave">Wave</option>\
30 <option value="rule-thick">Thick</option>\
31 <option value="rule-thin">Thin</option>\
32 </select><br />\
33 </td>\
34 </tr>\
35 <tr>\
36 <th><label for="oscitas-rule-margin">Margin:</label></th>\
37 <td><input type="text" name="line" id="oscitas-rule-margin" value=""/><br />\
38 <small>Enter a numeric value Ex. 20</small>\
39 </td>\
40 </tr>\
41 <tr>\
42 <th><label for="oscitas-rule-class">Custom Class:</label></th>\
43 <td><input type="text" name="line" id="oscitas-rule-class" value=""/><br />\
44 </td>\
45 </tr>\
46 </table>\
47 <p class="submit">\
48 <input type="button" id="oscitas-rule-submit" class="button-primary" value="Insert Horizontal Rule" name="submit" />\
49 </p>\
50 </div>');
51
52 var table = form.find('table');
53 form.appendTo('body').hide();
54
55
56
57
58
59
60
61 // handles the click event of the submit button
62 form.find('#oscitas-rule-submit').click(function() {
63 // defines the options and their default values
64 // again, this is not the most elegant way to do this
65 // but well, this gets the job done nonetheless
66 var cusclass='',margin='';
67 if(table.find('#oscitas-rule-class').val()!=''){
68 cusclass= ' class="'+table.find('#oscitas-rule-class').val()+'"';
69 }
70 if(table.find('#oscitas-rule-margin').val()!=''){
71 margin= ' margin="'+table.find('#oscitas-rule-margin').val()+'"';
72 }
73 var shortcode = '[rule'+cusclass+margin;
74
75 shortcode += ' style="' + table.find('#oscitas-rule-style').val();
76
77 shortcode += '" ';
78 //shortcode += ' btntag="'+table.find('#oscitas-button-type').val()+'" ';
79
80
81
82 shortcode += ']';
83
84 // inserts the shortcode into the active editor
85 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
86
87 // closes Dialoguebox
88 close_dialogue(pluginObj.hashId);
89 });
90 }
91
92