| 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 ebs-default-options">\ |
| 12 |
<tr>\ |
| 13 |
<th><label for="oscitas-tooltip-style">'+ebsjstrans.tooltip+' '+ebsjstrans.style+':</label></th>\ |
| 14 |
<td>\ |
| 15 |
<select name="type" id="oscitas-tooltip-style">\ |
| 16 |
<option value="top">'+ebsjstrans.top+'</option>\ |
| 17 |
<option value="bottom">'+ebsjstrans.bottom+'</option>\ |
| 18 |
<option value="left">'+ebsjstrans.left+'</option>\ |
| 19 |
<option value="right">'+ebsjstrans.right+'</option>\ |
| 20 |
<option value="auto">'+ebsjstrans.auto+'</option>\ |
| 21 |
</select><br />\ |
| 22 |
</td>\ |
| 23 |
</tr>\ |
| 24 |
<tr>\ |
| 25 |
<th><label for="oscitas-tooltip-text">'+ebsjstrans.tooltip+' '+ebsjstrans.text+':</label></th>\ |
| 26 |
<td><input type="text" name="tooltip-text" id="oscitas-tooltip-text" value="Tooltip"/><br />\ |
| 27 |
</td>\ |
| 28 |
</tr>\ |
| 29 |
<tr>\ |
| 30 |
<th><label for="oscitas-tooltip-type">'+ebsjstrans.type+'Type:</label></th>\ |
| 31 |
<td><select name="type" id="oscitas-tooltip-type">\ |
| 32 |
<option value="link">'+ebsjstrans.link+'</option>\ |
| 33 |
<option value="button">'+ebsjstrans.button+'</option>\ |
| 34 |
</select><br />\ |
| 35 |
</td>\ |
| 36 |
</tr >\ |
| 37 |
<tr class="oscitas-tooltip-link-tr">\ |
| 38 |
<th><label for="oscitas-tooltip-link">'+ebsjstrans.link+':</label></th>\ |
| 39 |
<td><input type="text" name="tooltip-link" id="oscitas-tooltip-link" value="#"/><br />\ |
| 40 |
</td>\ |
| 41 |
</tr>\ |
| 42 |
<tr class="oscitas-tooltip-link-tr">\ |
| 43 |
<th><label for="oscitas-tooltip-link">'+ebsjstrans.newtarget+':</label></th>\ |
| 44 |
<td><input type="checkbox" id="oscitas-tooltip-link-target" value="_blank"/><br />\ |
| 45 |
</td>\ |
| 46 |
</tr>\ |
| 47 |
<tr>\ |
| 48 |
<th><label for="oscitas-tooltip-link-text">'+ebsjstrans.value+':</label></th>\ |
| 49 |
<td><input type="text" name="link-text" id="oscitas-tooltip-link-text" value="'+ebsjstrans.hover+' '+ebsjstrans.me+'"/><br />\ |
| 50 |
</td>\ |
| 51 |
</tr>\ |
| 52 |
<tr>\ |
| 53 |
<th><label for="oscitas-tooltip-class">'+ebsjstrans.customclass+':</label></th>\ |
| 54 |
<td><input type="text" name="line" id="oscitas-tooltip-class" value=""/><br />\ |
| 55 |
</td>\ |
| 56 |
</tr>\ |
| 57 |
</table>\ |
| 58 |
<p class="submit ebs-default-options">\ |
| 59 |
<input type="button" id="oscitas-tooltip-submit" class="button-primary" value="'+ebsjstrans.insert+' '+ebsjstrans.tooltip+'" name="submit" />\ |
| 60 |
</p>\ |
| 61 |
<div class="pro-version-image aligncenter" style="display: none;"><img src="'+ebs_url+'shortcode/tooltip/screenshot.jpg"/></div>\ |
| 62 |
</div>'); |
| 63 |
|
| 64 |
return form; |
| 65 |
} |
| 66 |
function create_oscitas_tooltip(pluginObj){ |
| 67 |
var form=jQuery(pluginObj.hashId); |
| 68 |
|
| 69 |
var table = form.find('table'); |
| 70 |
|
| 71 |
var colors = ['color', 'bgcolor']; |
| 72 |
|
| 73 |
form.find('#oscitas-tooltip-type').change(function(){ |
| 74 |
if(jQuery(this).val()=='link'){ |
| 75 |
table.find('.oscitas-tooltip-link-tr').show(); |
| 76 |
table.find('#oscitas-tooltip-link').val('#'); |
| 77 |
} else{ |
| 78 |
table.find('.oscitas-tooltip-link-tr').hide(); |
| 79 |
table.find('#oscitas-tooltip-link').val(''); |
| 80 |
} |
| 81 |
jQuery(this).parents('#oscitas-table').find('tr:visible:even').css('background', '#ffffff'); |
| 82 |
jQuery(this).parents('#oscitas-table').find('tr:visible:odd').css('background', '#efefef'); |
| 83 |
}) |
| 84 |
|
| 85 |
// handles the click event of the submit button |
| 86 |
form.find('#oscitas-tooltip-submit').click(function() { |
| 87 |
// defines the options and their default values |
| 88 |
// again, this is not the most elegant way to do this |
| 89 |
// but well, this gets the job done nonetheless |
| 90 |
var cusclass=''; |
| 91 |
if(table.find('#oscitas-tooltip-class').val()!=''){ |
| 92 |
cusclass= ' class="'+table.find('#oscitas-tooltip-class').val()+'"'; |
| 93 |
} |
| 94 |
var shortcode = '['+$ebs_prefix+'tooltip'; |
| 95 |
shortcode += ' type="' + table.find('#oscitas-tooltip-type').val(); |
| 96 |
|
| 97 |
shortcode += '" '; |
| 98 |
|
| 99 |
shortcode += ' link="' + table.find('#oscitas-tooltip-link').val()+'"'; |
| 100 |
|
| 101 |
shortcode += ' target="' + (table.find('#oscitas-tooltip-link-target').is(':checked') ? '_blank' : '_self'); |
| 102 |
|
| 103 |
shortcode += '" '; |
| 104 |
shortcode += ' tooltip="' + table.find('#oscitas-tooltip-text').val(); |
| 105 |
|
| 106 |
shortcode += '" '; |
| 107 |
shortcode += ' style="' + table.find('#oscitas-tooltip-style').val(); |
| 108 |
|
| 109 |
shortcode += '" '; |
| 110 |
|
| 111 |
shortcode += cusclass; |
| 112 |
|
| 113 |
shortcode += ']'; |
| 114 |
shortcode+= table.find('#oscitas-tooltip-link-text').val(); |
| 115 |
shortcode+='[/'+$ebs_prefix+'tooltip]'; |
| 116 |
|
| 117 |
// inserts the shortcode into the active editor |
| 118 |
ebsInsertShortcode(shortcode); |
| 119 |
|
| 120 |
// closes fancybox |
| 121 |
close_dialogue(pluginObj.hashId); |
| 122 |
}); |
| 123 |
} |
| 124 |
|
| 125 |
|