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 / tooltip / tooltip_plugin.js

tooltip_plugin.js in Easy Bootstrap Shortcode 4.4, at shortcode/tooltip/tooltip_plugin.js

123 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var tooltip={
2 title:"Tooltip Image Shortcode",
3 id :'oscitas-form-tooltip',
4 pluginName: 'tooltip'
5 };
6 (function() {
7 _create_tinyMCE_options(tooltip);
8 })();
9
10 function ebs_return_html_tooltip(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-tooltip-style">Tooltip Style:</label></th>\
14 <td><select name="type" id="oscitas-tooltip-style">\
15 <option value="top">Top</option>\
16 <option value="bottom">Bottom</option>\
17 <option value="left">Left</option>\
18 <option value="right">Right</option>\
19 <option value="auto">Auto</option>\
20 </select><br />\
21 </td>\
22 </tr>\
23 <tr>\
24 <th><label for="oscitas-tooltip-text">Tooltip Text:</label></th>\
25 <td><input type="text" name="tooltip-text" id="oscitas-tooltip-text" value="Tooltip"/><br />\
26 </td>\
27 </tr>\
28 <tr>\
29 <th><label for="oscitas-tooltip-type">Type:</label></th>\
30 <td><select name="type" id="oscitas-tooltip-type">\
31 <option value="link">Link</option>\
32 <option value="button">Button</option>\
33 </select><br />\
34 </td>\
35 </tr >\
36 <tr class="oscitas-tooltip-link-tr">\
37 <th><label for="oscitas-tooltip-link">Link:</label></th>\
38 <td><input type="text" name="tooltip-link" id="oscitas-tooltip-link" value="#"/><br />\
39 </td>\
40 </tr>\
41 <tr class="oscitas-tooltip-link-tr">\
42 <th><label for="oscitas-tooltip-link">Open New Window:</label></th>\
43 <td><input type="checkbox" id="oscitas-tooltip-link-target" value="_blank"/><br />\
44 </td>\
45 </tr>\
46 <tr>\
47 <th><label for="oscitas-tooltip-link-text">Value:</label></th>\
48 <td><input type="text" name="link-text" id="oscitas-tooltip-link-text" value="Hover Me"/><br />\
49 </td>\
50 </tr>\
51 <tr>\
52 <th><label for="oscitas-tooltip-class">Custom Class:</label></th>\
53 <td><input type="text" name="line" id="oscitas-tooltip-class" value=""/><br />\
54 </td>\
55 </tr>\
56 </table>\
57 <p class="submit">\
58 <input type="button" id="oscitas-tooltip-submit" class="button-primary" value="Insert Tooltip" name="submit" />\
59 </p>\
60 </div>');
61
62 return form;
63 }
64 function create_oscitas_tooltip(pluginObj){
65 var form=jQuery(pluginObj.hashId);
66
67 var table = form.find('table');
68
69 var colors = ['color', 'bgcolor'];
70
71 form.find('#oscitas-tooltip-type').change(function(){
72 if(jQuery(this).val()=='link'){
73 table.find('.oscitas-tooltip-link-tr').show();
74 table.find('#oscitas-tooltip-link').val('#');
75 } else{
76 table.find('.oscitas-tooltip-link-tr').hide();
77 table.find('#oscitas-tooltip-link').val('');
78 }
79 jQuery(this).parents('#oscitas-table').find('tr:visible:even').css('background', '#ffffff');
80 jQuery(this).parents('#oscitas-table').find('tr:visible:odd').css('background', '#efefef');
81 })
82
83 // handles the click event of the submit button
84 form.find('#oscitas-tooltip-submit').click(function() {
85 // defines the options and their default values
86 // again, this is not the most elegant way to do this
87 // but well, this gets the job done nonetheless
88 var cusclass='';
89 if(table.find('#oscitas-tooltip-class').val()!=''){
90 cusclass= ' class="'+table.find('#oscitas-tooltip-class').val()+'"';
91 }
92 var shortcode = '['+$ebs_prefix+'tooltip';
93 shortcode += ' type="' + table.find('#oscitas-tooltip-type').val();
94
95 shortcode += '" ';
96
97 shortcode += ' link="' + table.find('#oscitas-tooltip-link').val()+'"';
98
99 shortcode += ' target="' + (table.find('#oscitas-tooltip-link-target').is(':checked') ? '_blank' : '_self');
100
101 shortcode += '" ';
102 shortcode += ' tooltip="' + table.find('#oscitas-tooltip-text').val();
103
104 shortcode += '" ';
105 shortcode += ' style="' + table.find('#oscitas-tooltip-style').val();
106
107 shortcode += '" ';
108
109 shortcode += cusclass;
110
111 shortcode += ']';
112 shortcode+= table.find('#oscitas-tooltip-link-text').val();
113 shortcode+='[/'+$ebs_prefix+'tooltip]';
114
115 // inserts the shortcode into the active editor
116 tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
117
118 // closes fancybox
119 close_dialogue(pluginObj.hashId);
120 });
121 }
122
123