PluginProbe
Easy Bootstrap Shortcode / 4.4
Easy Bootstrap Shortcode v4.4
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 / lists / lists_plugin.js

lists_plugin.js in Easy Bootstrap Shortcode 4.4, at shortcode/lists/lists_plugin.js

87 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var lists={
2 title:"List Group Shortcode",
3 id :'oscitas-form-lists',
4 pluginName: 'lists'
5 };
6 (function() {
7 _create_tinyMCE_options(lists);
8 })();
9
10 function ebs_return_html_lists(pluginObj){
11 var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table">\
12 <tr>\
13 <th><label for="oscitas-type">Lists style</label></th>\
14 <td><select name="type" id="oscitas-type">\
15 <option value="">None</option>\
16 <option value="glyphicon-arrow-right">Arrow</option>\
17 <option value="glyphicon-ok">Check</option>\
18 <option value="glyphicon-plus">Plus</option>\
19 <option value="glyphicon-minus">Minus</option>\
20 </select><br />\
21 </td>\
22 </tr>\
23 <tr>\
24 <th><label for="oscitas-line">No of List Item</label></th>\
25 <td><input type="text" name="line" id="oscitas-list-item" value="3"/><br /><small>Enter a numeric value</small>\
26 </td>\
27 </tr>\
28 <tr>\
29 <th><label for="oscitas-list-class">Custom Class:</label></th>\
30 <td><input type="text" name="line" id="oscitas-list-class" value=""/><br />\
31 </td>\
32 </tr>\
33 </table>\
34 <p class="submit">\
35 <input type="button" id="oscitas-submit" class="button-primary" value="Insert List" name="submit" />\
36 </p>\
37 </div>');
38 return form;
39 }
40 function create_oscitas_lists(pluginObj){
41
42 var form=jQuery(pluginObj.hashId);
43
44 var table = form.find('table');
45
46
47 // handles the click event of the submit button
48 form.find('#oscitas-submit').click(function(){
49 // defines the options and their default values
50 // again, this is not the most elegant way to do this
51 // but well, this gets the job done nonetheless
52 var options = {
53 'type' : 'arrow'
54 },list=0,list_type;
55 var cusclass='';
56 if(table.find('#oscitas-list-class').val()!=''){
57 cusclass= ' class="'+table.find('#oscitas-list-class').val()+'"';
58 }
59 var shortcode = '['+$ebs_prefix+'list'+cusclass;
60 var list_item=jQuery('#oscitas-list-item').val();
61 if(isNaN(list_item)==false){
62 list=list_item;
63 } else{
64 list=3;
65 }
66
67
68 shortcode += ']<br/>';
69 if(table.find('#oscitas-type').val()!=''){
70 list_type=' type="'+table.find('#oscitas-type').val()+'"';
71 }
72 else{
73 list_type='';
74 }
75 for(var i=1;i<=list;i++){
76 shortcode +='['+$ebs_prefix+'li'+list_type+']your list content[/'+$ebs_prefix+'li]<br/>'
77 }
78 shortcode +='[/'+$ebs_prefix+'list]';
79
80 // inserts the shortcode into the active editor
81 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
82
83 close_dialogue(pluginObj.hashId);
84 });
85 }
86
87