123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /*
- var $ = jQuery;
- $(document).ready(function() {
- //$("***").ttt();
- console.log("OKOKOKO K plugin");
- var mediaUploader;
- $('#upload_image_button').click(function(e) {
- e.preventDefault();
- if (mediaUploader) {
- mediaUploader.open();
- return;
- }
- mediaUploader = wp.media.frames.file_frame = wp.media({
- title: 'Choose Image',
- button: {
- text: 'Choose Image'
- },
- multiple: false
- });
- mediaUploader.on('select', function() {
- var attachment = mediaUploader.state().get('selection').first().toJSON();
- console.log("LLLL",attachment);
- $('#background_image').attr("src",attachment.url);
- });
- mediaUploader.open();
- });
- $('.custom_media').each(function() {
- var self = $(this);
- $('.custom_media_upload', self).click(function() {
- var send_attachment_bkp = wp.media.editor.send.attachment;
- wp.media.editor.send.attachment = function(props, attachment) {
- $('.custom_media_image', self).attr('src', attachment.url);
- var path = "/" + attachment.url.split("/").splice(3).join("/");
- $('.custom_media_url', self).val(path);
- $('.custom_media_id', self).val(attachment.id);
- wp.media.editor.send.attachment = send_attachment_bkp;
- }
- wp.media.editor.open();
- return false;
- });
- });
- });
- */
|