File "pp-taxonomy-thumbnail.js"
Full path: /home/kosmetik/public_html/wp-content/plugins/powerpack-elements/assets/js/pp-taxonomy-thumbnail.js
File
size: 1.16 B
MIME-type: text/plain
Charset: utf-8
Download Open Edit Advanced Editor Back
jQuery(function ($) {
$('body').on('click', '#upload_taxonomy_thumbnail_button', function (e) {
e.preventDefault();
var button = $(this),
pp_uploader = wp.media({
title: 'Select Image',
library: {
type: 'image'
},
multiple: false
}).on('select', function () {
var attachment = pp_uploader.state().get('selection').first().toJSON();
$('#taxonomy_thumbnail_id').val(attachment.id);
if (attachment.url.toString().length > 0) {
$('#taxonomy_thumbnail_preview').html('<img id="taxonomy_thumbnail_preview_img" src="' + attachment.url + '" width="150" height="150">');
$("#delete_taxonomy_thumbnail_button").css('display', 'inline-block');
}
})
.open();
});
$('body').on('click', '#delete_taxonomy_thumbnail_button', function (e) {
e.preventDefault();
$('#taxonomy_thumbnail_id').val('');
$('#taxonomy_thumbnail_preview').html('');
$(this).css('display', 'none');
});
$('form#addtag #submit').on('click', function (e) {
$('#taxonomy_thumbnail_preview').html('');
$('#delete_taxonomy_thumbnail_button').css('display', 'none');
setTimeout(function () { $('#taxonomy_thumbnail_id').val(''); }, 5000);
});
});