| 1 |
var image={ |
| 2 |
title:"Image Effects Shortcode", |
| 3 |
id :'oscitas-form-image', |
| 4 |
pluginName: 'image' |
| 5 |
}; |
| 6 |
(function() { |
| 7 |
_create_tinyMCE_options(image); |
| 8 |
})(); |
| 9 |
|
| 10 |
function ebs_return_html_image(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><th><label for="oscitas-label-content">'+ebsjstrans.upload+' '+ebsjstrans.image+':</label></th>\ |
| 13 |
<td id="osc_image_upload"><input id="oscitas-image-src" type="hidden" name="oscitas-thumbnail-src" value="" />\ |
| 14 |
<input id="_btn" class="upload_image_button" type="button" value="'+ebsjstrans.upload+' '+ebsjstrans.image+'" />\ |
| 15 |
</td>\ |
| 16 |
</tr>\ |
| 17 |
<tr>\ |
| 18 |
<th><label for="oscitas-image-shape">'+ebsjstrans.image+' '+ebsjstrans.shape+':</label></th>\ |
| 19 |
<td><select name="oscitas-image-shape" id="oscitas-image-shape">\ |
| 20 |
<option value="img-rounded">'+ebsjstrans.rounded+'</option>\ |
| 21 |
<option value="img-circle">'+ebsjstrans.circle+'</option>\ |
| 22 |
<option value="img-thumbnail">'+ebsjstrans.thumbnail+'</option>\ |
| 23 |
</select>\ |
| 24 |
</td>\ |
| 25 |
</tr>\ |
| 26 |
<tr>\ |
| 27 |
<th><label for="oscitas-image-class">'+ebsjstrans.customclass+':</label></th>\ |
| 28 |
<td><input type="text" name="line" id="oscitas-image-class" value=""/><br />\ |
| 29 |
</td>\ |
| 30 |
</tr>\ |
| 31 |
</table>\ |
| 32 |
<p class="submit ebs-default-options">\ |
| 33 |
<input type="button" id="oscitas-image-submit" class="button-primary" value="'+ebsjstrans.insert+' '+ebsjstrans.image+'" name="submit" />\ |
| 34 |
</p>\ |
| 35 |
<div class="pro-version-image aligncenter" style="display: none;"><img src="'+ebs_url+'shortcode/image/screenshot.jpg"/></div>\ |
| 36 |
</div>'); |
| 37 |
return form; |
| 38 |
} |
| 39 |
function create_oscitas_image(pluginObj){ |
| 40 |
|
| 41 |
var form=jQuery(pluginObj.hashId); |
| 42 |
|
| 43 |
var table = form.find('table'); |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
form.find('.upload_image_button').click(function() { |
| 48 |
jQuery('body').addClass('ebs_plugin_shown_now'); |
| 49 |
jQuery('.ui-widget-overlay, .ui-dialog').css('z-index',100); |
| 50 |
jQuery('html').addClass('Image'); |
| 51 |
formfield = jQuery(this).prev().attr('id'); |
| 52 |
tb_show('', 'media-upload.php?type=image&TB_iframe=true'); |
| 53 |
return false; |
| 54 |
}); |
| 55 |
|
| 56 |
window.original_send_to_editor = window.send_to_editor; |
| 57 |
|
| 58 |
window.send_to_editor = function(html) { |
| 59 |
if (formfield) { |
| 60 |
if (jQuery(html).find('img').length) { |
| 61 |
fileurl = jQuery('img', html).attr('src'); |
| 62 |
} else if (jQuery(html).attr('src')) { |
| 63 |
fileurl = jQuery(html).attr('src'); |
| 64 |
} |
| 65 |
jQuery('#' + formfield).val(fileurl); |
| 66 |
tb_remove(); |
| 67 |
form.find('#osc_image_upload img').remove(); |
| 68 |
form.find('#osc_image_upload').append('<img src="'+fileurl+'">') |
| 69 |
jQuery('body').removeClass('ebs_plugin_shown_now'); |
| 70 |
jQuery('html').removeClass('Image'); |
| 71 |
|
| 72 |
} else { |
| 73 |
window.original_send_to_editor(html); |
| 74 |
jQuery('body').removeClass('ebs_plugin_shown_now'); |
| 75 |
} |
| 76 |
|
| 77 |
}; |
| 78 |
|
| 79 |
|
| 80 |
// handles the click event of the submit button |
| 81 |
form.find('#oscitas-image-submit').click(function(){ |
| 82 |
var shortcode=''; |
| 83 |
var shape=form.find('#oscitas-image-shape').val(); |
| 84 |
var cusclass=''; |
| 85 |
if(table.find('#oscitas-image-class').val()!=''){ |
| 86 |
cusclass= ' class="'+table.find('#oscitas-image-class').val()+'"'; |
| 87 |
} |
| 88 |
if(form.find('#oscitas-image-src').val()!=''){ |
| 89 |
shortcode = '['+$ebs_prefix+'image'+cusclass+' src="'+form.find('#oscitas-image-src').val()+'" shape="'+shape+'"]'; |
| 90 |
} |
| 91 |
// inserts the shortcode into the active editor |
| 92 |
ebsInsertShortcode(shortcode); |
| 93 |
|
| 94 |
// closes Dialoguebox |
| 95 |
close_dialogue(pluginObj.hashId); |
| 96 |
}); |
| 97 |
} |
| 98 |
|
| 99 |
|