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 / tables / tables_plugin.js

tables_plugin.js in Easy Bootstrap Shortcode trunk, at shortcode/tables/tables_plugin.js

122 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var tables={
2 title:"Table Shortcode",
3 id :'oscitas-form-table',
4 pluginName: 'tables'
5 };
6 (function() {
7 _create_tinyMCE_options(tables);
8 })();
9
10 function ebs_return_html_tables(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 <tr>\
13 <th><label for="oscitas-table-width">'+ebsjstrans.table+' '+ebsjstrans.width+':</label></th>\
14 <td><input type="text" name="icontag" id="oscitas-table-width" value="100%" /><br />\
15 </td>\
16 </tr>\
17 <tr>\
18 <th><label for="oscitas-table-columns">'+ebsjstrans.columns+':</label></th>\
19 <td><input type="text" name="link" id="oscitas-table-columns" value="4" /><br />\
20 </td>\
21 </tr>\
22 <tr>\
23 <th><label for="oscitas-table-rows">'+ebsjstrans.rows+':</label></th>\
24 <td><input type="text" name="title" id="oscitas-table-rows" value="4" /><br />\
25 </td>\
26 </tr>\
27 <tr>\
28 <th><label for="oscitas-table-rows">'+ebsjstrans.table+' '+ebsjstrans.style+':</label></th>\
29 <td>\
30 <select name="tablestyle" id="oscitas-table-style">\
31 <option value="">'+ebsjstrans.simple+'</option>\
32 <option value="table-striped">'+ebsjstrans.striped+'</option>\
33 <option value="table-bordered">'+ebsjstrans.bordered+'</option>\
34 <option value="table-striped table-bordered">'+ebsjstrans.striped+' + '+ebsjstrans.bordered+'</option>\
35 </select>\
36 <br />\
37 </td>\
38 </tr>\
39 <tr>\
40 <th><label for="oscitas-table-rows">'+ebsjstrans.show+' '+ebsjstrans.hover+' '+ebsjstrans.effect+':</label></th>\
41 <td>\
42 <input type="checkbox" id="oscitas-table-hover" value="table-hover">\
43 <br />\
44 </td>\
45 </tr>\
46 <tr>\
47 <th><label for="oscitas-table-rows">'+ebsjstrans.responsive+':</label></th>\
48 <td>\
49 <input type="checkbox" id="oscitas-table-scroll" value="table-responsive">\
50 <br />\
51 </td>\
52 </tr>\
53 <tr>\
54 <th><label for="oscitas-table-class">'+ebsjstrans.customclass+':</label></th>\
55 <td><input type="text" name="line" id="oscitas-table-class" value=""/><br />\
56 </td>\
57 </tr>\
58 </table>\
59 <p class="submit ebs-default-options">\
60 <input type="button" id="oscitas-submit" class="button-primary" value="'+ebsjstrans.insert+' '+ebsjstrans.table+'" name="submit" />\
61 </p>\
62 <div class="pro-version-image aligncenter" style="display: none;"><img src="'+ebs_url+'shortcode/tables/screenshot.jpg"/></div>\
63 </div>');
64 return form;
65 }
66 function create_oscitas_tables(pluginObj){
67 var form=jQuery(pluginObj.hashId);
68
69 var table = form.find('table');
70
71
72 // handles the click event of the submit button
73 form.find('#oscitas-submit').click(function(){
74 // defines the options and their default values
75 // again, this is not the most elegant way to do this
76 // but well, this gets the job done nonetheless
77 var cusclass='';
78 if(table.find('#oscitas-table-class').val()!=''){
79 cusclass= ' class="'+table.find('#oscitas-table-class').val()+'"';
80 }
81 var columns = table.find('#oscitas-table-columns').val();
82 var rows = table.find('#oscitas-table-rows').val();
83 var value = table.find('#oscitas-table-width').val();
84 var osStyle = table.find('#oscitas-table-style').val();
85
86 var osHover = table.find('#oscitas-table-hover').prop('checked') ? ' table-hover' : '' ;
87 var osScroll = table.find('#oscitas-table-scroll').prop('checked')? 'true': 'false';
88 //creating table
89 var shortcode = '['+$ebs_prefix+'table ';
90 shortcode += 'width ="' + value + '"';
91 shortcode += ' style ="' + osStyle +osHover+ '"';
92 shortcode += ' responsive ="' +osScroll+ '"'+cusclass;
93
94 shortcode += ']<br/>['+$ebs_prefix+'table_head]<br/>';
95 for (var i=1;i<=columns;i++)
96 {
97 shortcode += '['+$ebs_prefix+'th_column]'+ebsjstrans.heading+'-'+i+'[/'+$ebs_prefix+'th_column]<br/>';
98 }
99 shortcode += '[/'+$ebs_prefix+'table_head]<br/>['+$ebs_prefix+'table_body]<br/>';
100
101 for (var j=1;j<=rows;j++)
102 {
103 shortcode += '['+$ebs_prefix+'table_row]<br/>';
104 for (var i=1;i<=columns;i++)
105 {
106 shortcode += '['+$ebs_prefix+'row_column]'+ebsjstrans.value+'-'+i+'[/'+$ebs_prefix+'row_column]<br/>';
107 }
108
109 shortcode += '[/'+$ebs_prefix+'table_row]<br/>';
110 }
111 shortcode += '[/'+$ebs_prefix+'table_body]<br/>[/'+$ebs_prefix+'table]';
112
113
114 // inserts the shortcode into the active editor
115 ebsInsertShortcode(shortcode);
116
117 // closes fancybox
118 close_dialogue(pluginObj.hashId);
119 });
120 }
121
122