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 / deslist / deslist_plugin.js

deslist_plugin.js in Easy Bootstrap Shortcode trunk, at shortcode/deslist/deslist_plugin.js

83 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var deslist={
2 title:"List Group Shortcode",
3 id :'oscitas-form-deslists',
4 pluginName: 'deslist'
5 };
6 (function() {
7 _create_tinyMCE_options(deslist);
8 })();
9 function ebs_return_html_deslist(pluginObj){
10 var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table ebs-default-options">\
11 <tr>\
12 <th><label for="oscitas-line">'+ebsjstrans.noof+' '+ebsjstrans.list+' '+ebsjstrans.item+'</label></th>\
13 <td><input type="text" name="line" id="oscitas-deslist-item" value="3"/><br /><small>'+ebsjstrans.enternumval+'</small>\
14 </td>\
15 </tr>\
16 <tr>\
17 <th><label for="oscitas-deslist-style">'+ebsjstrans.list+' '+ebsjstrans.style+'</label></th>\
18 <td><select name="type" id="oscitas-deslist-style">\
19 <option value="">'+ebsjstrans.default+'</option>\
20 <option value="dl-horizontal">'+ebsjstrans.horizontal+'</option>\
21 </select><br />\
22 </td>\
23 </tr>\
24 <tr>\
25 <th><label for="oscitas-deslist-class">'+ebsjstrans.customclass+':</label></th>\
26 <td><input type="text" name="line" id="oscitas-deslist-class" value=""/><br />\
27 </td>\
28 </tr>\
29 </table>\
30 <p class="submit ebs-default-options">\
31 <input type="button" id="oscitas-deslist-submit" class="button-primary" value="'+ebsjstrans.insert+' '+ebsjstrans.list+'" name="submit" />\
32 </p>\
33 <div class="pro-version-image aligncenter" style="display: none;"><img src="'+ebs_url+'shortcode/deslist/screenshot.jpg"/></div>\
34 </div>');
35 return form;
36 }
37 function create_oscitas_deslist(pluginObj){
38
39 var form= jQuery(pluginObj.hashId);
40
41 // creates a form to be displayed everytime the button is clicked
42 // you should achieve this using AJAX instead of direct html code like this
43
44
45 var table = form.find('table');
46
47
48 // handles the click event of the submit button
49 form.find('#oscitas-deslist-submit').click(function(){
50 // defines the options and their default values
51 // again, this is not the most elegant way to do this
52 // but well, this gets the job done nonetheless
53 var options = {
54 'type' : 'arrow'
55 },deslist=0,deslist_type;
56 var cusclass='',style='';
57 if(table.find('#oscitas-deslist-class').val()!=''){
58 cusclass= ' class="'+table.find('#oscitas-deslist-class').val()+'"';
59 }
60 if(table.find('#oscitas-deslist-style').val()!=''){
61 style= ' style="'+table.find('#oscitas-deslist-style').val()+'"';
62 }
63 var shortcode = '['+$ebs_prefix+'dl'+cusclass+style;
64 var deslist_item=jQuery('#oscitas-deslist-item').val();
65 if(isNaN(deslist_item)==false){
66 deslist=deslist_item;
67 } else{
68 deslist=3;
69 }
70
71
72 shortcode += ']<br/>';
73 for(var i=1;i<=deslist;i++){
74 shortcode +='['+$ebs_prefix+'dlitem heading="Heading '+i+'"]'+ebsjstrans.description+' '+i+'[/'+$ebs_prefix+'dlitem]<br/>'
75 }
76 shortcode +='[/'+$ebs_prefix+'dl]';
77
78 // inserts the shortcode into the active editor
79 ebsInsertShortcode(shortcode);
80
81 close_dialogue(pluginObj.hashId);
82 });
83 }