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 / progressbar / progressbar_plugin.js

progressbar_plugin.js in Easy Bootstrap Shortcode 2.5, at shortcode/progressbar/progressbar_plugin.js

116 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var progressbar={
2 title:"Progressbar Shortcode",
3 id :'oscitas-form-progressbar',
4 pluginName: 'progressbar',
5 setRowColors: true
6 };
7 (function() {
8 _create_tinyMCE_options(progressbar, 800);
9 })();
10
11 function create_oscitas_progressbar(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-progressbar-style">Progress Bar Type:</label></th>\
20 <td><select name="type" id="oscitas-progressbar-style">\
21 <option value="">Default</option>\
22 <option value="progress-bar-success">Success</option>\
23 <option value="progress-bar-info">Information</option>\
24 <option value="progress-bar-warning">Warning</option>\
25 <option value="progress-bar-danger">Danger</option>\
26 </select><br />\
27 </td>\
28 </tr>\
29 <tr>\
30 <th><label for="oscitas-progressbar-label">Progressbar Label:</label></th>\
31 <td><input type="text" name="title" id="oscitas-progressbar-label" value=""/><br />\
32 </td>\
33 </tr>\
34 <tr>\
35 <th><label for="oscitas-progressbar-progress">Progress Value:</label></th>\
36 <td><input type="text" name="title" id="oscitas-progressbar-progress" value="50"/><br />\
37 <small>Enter a numeric value between 0 to 100, Default value is 50</small>\
38 </td>\
39 </tr>\
40 <tr>\
41 <th><label for="oscitas-progressbar-stripped">Stripped Progress Bar:</label></th>\
42 <td>\
43 <input type="checkbox" id="oscitas-progressbar-stripped">\
44 </td>\
45 </tr>\
46 <tr id="osc_progress_animate" style="display: none;">\
47 <th><label for="oscitas-progressbar-animated">Animated Progress Bar:</label></th>\
48 <td>\
49 <input type="checkbox" id="oscitas-progressbar-animated">\
50 </td>\
51 </tr>\
52 <tr>\
53 <th><label for="oscitas-progressbar-class">Custom Class:</label></th>\
54 <td><input type="text" name="line" id="oscitas-progressbar-class" value=""/><br />\
55 </td>\
56 </tr>\
57 </table>\
58 <p class="submit">\
59 <input type="button" id="oscitas-progressbar-submit" class="button-primary" value="Insert Button" name="submit" />\
60 </p>\
61 </div>');
62
63 var table = form.find('table');
64 form.appendTo('body').hide();
65 jQuery('#oscitas-form-progressbar table tr:visible:even').css('background', '#F0F0F0');
66 jQuery('#oscitas-form-progressbar table tr:visible:odd').css('background', '#DADADD');
67 table.find('#oscitas-progressbar-stripped').click(function(){
68 if(jQuery(this).prop('checked')){
69 jQuery('#osc_progress_animate').show();
70 } else{
71 jQuery('#osc_progress_animate').hide();
72 }
73 jQuery('#oscitas-form-progressbar table tr:visible:even').css('background', '#F0F0F0');
74 jQuery('#oscitas-form-progressbar table tr:visible:odd').css('background', '#DADADD');
75 })
76
77
78
79
80
81 // handles the click event of the submit button
82 form.find('#oscitas-progressbar-submit').click(function(){
83
84 var cusclass='',type='',value='',stripped='',label='';
85 if(jQuery('#oscitas-progressbar-stripped').prop('checked')){
86 stripped=' barstyle="progress-striped';
87 if(jQuery('#oscitas-progressbar-animated').prop('checked')){
88 stripped +=' active';
89 }
90 stripped +='"';
91 }
92 if(table.find('#oscitas-progressbar-class').val()!=''){
93 cusclass= ' class="'+table.find('#oscitas-progressbar-class').val()+'"';
94 }
95 if(table.find('#oscitas-progressbar-style').val()!=''){
96 type= ' bartype="'+table.find('#oscitas-progressbar-style').val()+'"';
97 }
98 if(table.find('#oscitas-progressbar-progress').val()!=''){
99 value= ' value="'+table.find('#oscitas-progressbar-progress').val()+'"';
100 }
101 if(table.find('#oscitas-progressbar-label').val()!=''){
102 label= ' label="'+table.find('#oscitas-progressbar-label').val()+'"';
103 }
104 var shortcode = '[progressbar'+value+cusclass+type+stripped+label;
105
106 shortcode += ']';
107
108 // inserts the shortcode into the active editor
109 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
110
111 // closes fancybox
112 close_dialogue(pluginObj.hashId);
113 });
114 }
115
116