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 / icon / icon_plugin.js

icon_plugin.js in Easy Bootstrap Shortcode 4.4, at shortcode/icon/icon_plugin.js

98 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var icon={
2 title:"Icon Shortcode",
3 id :'oscitas-form-icon',
4 pluginName: 'icon'
5 };
6 (function() {
7 _create_tinyMCE_options(icon, 800);
8 })();
9
10 function ebs_return_html_icon(pluginObj){
11
12 var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table">\
13 <tr>\
14 <th><label for="oscitas-heading-icon">Select Icon:</label></th>\
15 <td><div id="click_icon_list_icon" class="oscitas-icon-div"><span id="osc_show_icon_icon"></span><span class="show-drop"></span></div><input type="hidden" id="osc_icon_class_val_icon" value="glyphicon-adjust">\
16 <div id="osc_show_iconlist_icon" class="oscitas-icon" style="display:none;width:100%">'+font_awesome_include('oscitas-heading-icon_icon')+'</div>\
17 </td>\
18 </tr>\
19 <tr>\
20 <th><label for="oscitas-icon-iconcolor">Icon Color:</label></th>\
21 <td><input type="text" name="label" id="oscitas-icon-iconcolor" class="color" value="" /><br />\
22 </td>\
23 </tr>\
24 <tr>\
25 <th><label for="oscitas-icon-fontsize">Icon Font Size:</label></th>\
26 <td><input type="text" name="line" id="oscitas-icon-fontsize" value=""/>px\
27 </td>\
28 </tr>\
29 <tr>\
30 <th><label for="oscitas-icon-class">Custom Class:</label></th>\
31 <td><input type="text" name="line" id="oscitas-icon-class" value=""/><br />\
32 </td>\
33 </tr>\
34 </table>\
35 <p class="submit">\
36 <input type="button" id="oscitas-icon-submit" class="button-primary" value="Insert icon" name="submit" />\
37 </p>\
38 </div>');
39
40 return form;
41
42 }
43 function create_oscitas_icon(pluginObj){
44 var form=jQuery(pluginObj.hashId);
45 var table = form.find('table');
46 jQuery('.glyphicon').css('display','inline');
47
48 form.find('.color').wpColorPicker();
49 var t= table.find('#osc_icon_class_val_icon').val();
50 table.find('#osc_show_icon_icon').removeClass().addClass('glyphicon').addClass(t);
51 table.find('#click_icon_list_icon').click(function(){
52 if(!jQuery(this).hasClass('osc_icon_showing_icon')){
53 jQuery(this).addClass('osc_icon_showing_icon')
54 table.find('#osc_show_iconlist_icon').show();
55 } else{
56 jQuery(this).removeClass('osc_icon_showing_icon')
57 table.find('#osc_show_iconlist_icon').hide();
58 }
59 });
60 table.find('.oscitas-heading-icon_icon li').click(function(){
61 var val=jQuery(this).attr('data-value');
62 var type=jQuery(this).attr('type');
63 table.find('.oscitas-heading-icon_icon li').removeClass('osc_icon_selected_button');
64 jQuery(this).addClass('osc_icon_selected_button');
65 table.find('#osc_show_iconlist_icon').hide();
66 table.find('#osc_show_icon_icon').removeClass().addClass(type).addClass(val);
67 table.find('#osc_icon_class_val_icon').val(type+' '+val);
68 })
69
70
71
72
73
74
75 // handles the click event of the submit button
76 form.find('#oscitas-icon-submit').click(function(){
77 var cusclass='';
78 if(table.find('#oscitas-icon-iconcolor').val()!=''){
79 cusclass+= ' color="'+table.find('#oscitas-icon-iconcolor').val()+'"';
80 }if(table.find('#oscitas-icon-fontsize').val()!=''){
81 cusclass+= ' fontsize="'+table.find('#oscitas-icon-fontsize').val()+'"';
82 }
83 if(table.find('#oscitas-icon-class').val()!=''){
84 cusclass+= ' class="'+table.find('#oscitas-icon-class').val()+'"';
85 }
86 var icon = table.find('#osc_icon_class_val_icon').val();
87 var shortcode='';
88 shortcode='['+$ebs_prefix+'icon type="'+icon+'"'+cusclass+']'
89
90 // inserts the shortcode into the active editor
91 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
92
93 // closes fancybox
94 close_dialogue(pluginObj.hashId);
95 });
96 }
97
98