Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/widget-media.js.tar

home/xbodynamge/lebauwcentre/wp-content/themes/zerif-lite/js/widget-media.js000064400000006252151116273540023272 0ustar00/* global jQuery */
/* global wp */
jQuery( document ).ready(
	function($) {
			'use strict';

			$( document ).on(
				'change','.custom_media_url',function() {
					var value       = $.trim( $( this ).val() );
					var image_input = $( this ).parent().find( '.custom_media_image' );
					var media_id    = $( this ).parent().parent().find( '.custom_media_id' );
					if (value.length === 0) {
						image_input.attr( 'src','' );
						image_input.attr( 'alt','' );
						media_id.val( '' );
					}
					var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
					if (typeof saveBtn !== 'undefined') {
						saveBtn.trigger( 'click' );
					}
				}
			);

		function media_upload(button_class) {
			var _custom_media = true;

			$( 'body' ).on(
				'click', button_class, function() {

					var button_id           = '#' + $( this ).attr( 'id' );
					var media_id            = jQuery( this ).parent().parent().children( '.custom_media_id' );
					var display_field       = jQuery( this ).parent().children( 'input:text' );
					var display_image       = jQuery( this ).parent().children( '.custom_media_image' );
					var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

					_custom_media = true;

					wp.media.editor.send.attachment = function(props, attachment) {
						if ( typeof attachment !== 'undefined' ) {
							if ( _custom_media ) {
								if ( typeof display_field !== 'undefined' ) {

									if ( typeof attachment.id !== 'undefined' ) {
										media_id.val( attachment.id );
									}

									if ( typeof attachment.sizes !== 'undefined' ) {
										if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
											if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
												display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.sizes.thumbnail.url );
											}
										} else {
											if ( typeof attachment.url !== 'undefined' ) {
												display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.url );
											}
										}
									} else {
										if ( typeof attachment.url !== 'undefined' ) {
											display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
											image_in_customizer.val( attachment.url );
										}
									}

									switch (props.size) {
										case 'full':
											display_field.val( attachment.sizes.full.url );
											break;
										case 'medium':
											display_field.val( attachment.sizes.medium.url );
											break;
										case 'thumbnail':
											display_field.val( attachment.sizes.thumbnail.url );
											break;
										default:
											display_field.val( attachment.url );
											break;
									}
									display_field.trigger( 'change' );
								}
							} else {
								return wp.media.editor.send.attachment( button_id, [props, attachment] );
							}
						}
					};

						wp.media.editor.open( button_class );
						window.send_to_editor = function () {

						};
						return false;
				}
			);
		}

			media_upload( '.custom_media_button' );
	}
);
home/xbodynamge/www/wp-content/themes/zerif-lite/js/widget-media.js000064400000006252151123026720021430 0ustar00/* global jQuery */
/* global wp */
jQuery( document ).ready(
	function($) {
			'use strict';

			$( document ).on(
				'change','.custom_media_url',function() {
					var value       = $.trim( $( this ).val() );
					var image_input = $( this ).parent().find( '.custom_media_image' );
					var media_id    = $( this ).parent().parent().find( '.custom_media_id' );
					if (value.length === 0) {
						image_input.attr( 'src','' );
						image_input.attr( 'alt','' );
						media_id.val( '' );
					}
					var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
					if (typeof saveBtn !== 'undefined') {
						saveBtn.trigger( 'click' );
					}
				}
			);

		function media_upload(button_class) {
			var _custom_media = true;

			$( 'body' ).on(
				'click', button_class, function() {

					var button_id           = '#' + $( this ).attr( 'id' );
					var media_id            = jQuery( this ).parent().parent().children( '.custom_media_id' );
					var display_field       = jQuery( this ).parent().children( 'input:text' );
					var display_image       = jQuery( this ).parent().children( '.custom_media_image' );
					var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

					_custom_media = true;

					wp.media.editor.send.attachment = function(props, attachment) {
						if ( typeof attachment !== 'undefined' ) {
							if ( _custom_media ) {
								if ( typeof display_field !== 'undefined' ) {

									if ( typeof attachment.id !== 'undefined' ) {
										media_id.val( attachment.id );
									}

									if ( typeof attachment.sizes !== 'undefined' ) {
										if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
											if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
												display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.sizes.thumbnail.url );
											}
										} else {
											if ( typeof attachment.url !== 'undefined' ) {
												display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.url );
											}
										}
									} else {
										if ( typeof attachment.url !== 'undefined' ) {
											display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
											image_in_customizer.val( attachment.url );
										}
									}

									switch (props.size) {
										case 'full':
											display_field.val( attachment.sizes.full.url );
											break;
										case 'medium':
											display_field.val( attachment.sizes.medium.url );
											break;
										case 'thumbnail':
											display_field.val( attachment.sizes.thumbnail.url );
											break;
										default:
											display_field.val( attachment.url );
											break;
									}
									display_field.trigger( 'change' );
								}
							} else {
								return wp.media.editor.send.attachment( button_id, [props, attachment] );
							}
						}
					};

						wp.media.editor.open( button_class );
						window.send_to_editor = function () {

						};
						return false;
				}
			);
		}

			media_upload( '.custom_media_button' );
	}
);
home/xbodynamge/crosstraining/wp-content/themes/zerif-lite/js/widget-media.js000060400000006252151131534350023467 0ustar00/* global jQuery */
/* global wp */
jQuery( document ).ready(
	function($) {
			'use strict';

			$( document ).on(
				'change','.custom_media_url',function() {
					var value       = $.trim( $( this ).val() );
					var image_input = $( this ).parent().find( '.custom_media_image' );
					var media_id    = $( this ).parent().parent().find( '.custom_media_id' );
					if (value.length === 0) {
						image_input.attr( 'src','' );
						image_input.attr( 'alt','' );
						media_id.val( '' );
					}
					var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
					if (typeof saveBtn !== 'undefined') {
						saveBtn.trigger( 'click' );
					}
				}
			);

		function media_upload(button_class) {
			var _custom_media = true;

			$( 'body' ).on(
				'click', button_class, function() {

					var button_id           = '#' + $( this ).attr( 'id' );
					var media_id            = jQuery( this ).parent().parent().children( '.custom_media_id' );
					var display_field       = jQuery( this ).parent().children( 'input:text' );
					var display_image       = jQuery( this ).parent().children( '.custom_media_image' );
					var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

					_custom_media = true;

					wp.media.editor.send.attachment = function(props, attachment) {
						if ( typeof attachment !== 'undefined' ) {
							if ( _custom_media ) {
								if ( typeof display_field !== 'undefined' ) {

									if ( typeof attachment.id !== 'undefined' ) {
										media_id.val( attachment.id );
									}

									if ( typeof attachment.sizes !== 'undefined' ) {
										if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
											if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
												display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.sizes.thumbnail.url );
											}
										} else {
											if ( typeof attachment.url !== 'undefined' ) {
												display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.url );
											}
										}
									} else {
										if ( typeof attachment.url !== 'undefined' ) {
											display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
											image_in_customizer.val( attachment.url );
										}
									}

									switch (props.size) {
										case 'full':
											display_field.val( attachment.sizes.full.url );
											break;
										case 'medium':
											display_field.val( attachment.sizes.medium.url );
											break;
										case 'thumbnail':
											display_field.val( attachment.sizes.thumbnail.url );
											break;
										default:
											display_field.val( attachment.url );
											break;
									}
									display_field.trigger( 'change' );
								}
							} else {
								return wp.media.editor.send.attachment( button_id, [props, attachment] );
							}
						}
					};

						wp.media.editor.open( button_class );
						window.send_to_editor = function () {

						};
						return false;
				}
			);
		}

			media_upload( '.custom_media_button' );
	}
);
www/wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/assets/js/widget-media.js000064400000005754151136504370032664 0ustar00home/xbodynamge/* global jQuery */
/* global wp */
jQuery( document ).ready( function($) {
	'use strict';

	$( document ).on('change','.custom_media_url',function() {
		var value = $.trim( $( this ).val() );
		var image_input = $( this ).parent().find( '.custom_media_image' );
		var media_id = $( this ).parent().parent().find( '.custom_media_id' );
		if (value.length === 0) {
			image_input.attr( 'src','' );
			image_input.attr( 'alt','' );
			media_id.val( '' );
		}
		var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
		if (typeof saveBtn !== 'undefined') {
			saveBtn.trigger( "click" );
		}
	});

	function media_upload(button_class) {
		var _custom_media = true;

		$( 'body' ).on('click', button_class, function() {

			var button_id = '#' + $( this ).attr( 'id' );
			var media_id = jQuery( this ).parent().parent().children( '.custom_media_id' );
			var display_field = jQuery( this ).parent().children( 'input:text' );
			var display_image = jQuery( this ).parent().children( '.custom_media_image' );
			var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

			_custom_media = true;

			wp.media.editor.send.attachment = function(props, attachment) {
				if ( typeof attachment !== 'undefined' ) {
					if ( _custom_media ) {
						if ( typeof display_field !== 'undefined' ) {

							if ( typeof attachment.id !== 'undefined' ) {
								media_id.val( attachment.id );
							}

							if ( typeof attachment.sizes !== 'undefined' ) {
								if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
									if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
										display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.sizes.thumbnail.url );
									}
								} else {
									if ( typeof attachment.url !== 'undefined' ) {
										display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.url );
									}
								}
							} else {
								if ( typeof attachment.url !== 'undefined' ) {
									display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
									image_in_customizer.val( attachment.url );
								}
							}

							switch (props.size) {
								case 'full':
									display_field.val( attachment.sizes.full.url );
									break;
								case 'medium':
									display_field.val( attachment.sizes.medium.url );
									break;
								case 'thumbnail':
									display_field.val( attachment.sizes.thumbnail.url );
									break;
								default:
									display_field.val( attachment.url );
									break;
							}
							display_field.trigger( 'change' );
						}// End if().
					} else {
						return wp.media.editor.send.attachment( button_id, [props, attachment] );
					}// End if().
				}// End if().
			};

			wp.media.editor.open( button_class );
			window.send_to_editor = function (html) {

			};
			return false;
		});
	}

	media_upload( '.custom_media_button' );
});
home/xbodynamge/dev/wp-content/themes/zerif-lite/js/widget-media.js000064400000006252151137773310021373 0ustar00/* global jQuery */
/* global wp */
jQuery( document ).ready(
	function($) {
			'use strict';

			$( document ).on(
				'change','.custom_media_url',function() {
					var value       = $.trim( $( this ).val() );
					var image_input = $( this ).parent().find( '.custom_media_image' );
					var media_id    = $( this ).parent().parent().find( '.custom_media_id' );
					if (value.length === 0) {
						image_input.attr( 'src','' );
						image_input.attr( 'alt','' );
						media_id.val( '' );
					}
					var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
					if (typeof saveBtn !== 'undefined') {
						saveBtn.trigger( 'click' );
					}
				}
			);

		function media_upload(button_class) {
			var _custom_media = true;

			$( 'body' ).on(
				'click', button_class, function() {

					var button_id           = '#' + $( this ).attr( 'id' );
					var media_id            = jQuery( this ).parent().parent().children( '.custom_media_id' );
					var display_field       = jQuery( this ).parent().children( 'input:text' );
					var display_image       = jQuery( this ).parent().children( '.custom_media_image' );
					var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

					_custom_media = true;

					wp.media.editor.send.attachment = function(props, attachment) {
						if ( typeof attachment !== 'undefined' ) {
							if ( _custom_media ) {
								if ( typeof display_field !== 'undefined' ) {

									if ( typeof attachment.id !== 'undefined' ) {
										media_id.val( attachment.id );
									}

									if ( typeof attachment.sizes !== 'undefined' ) {
										if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
											if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
												display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.sizes.thumbnail.url );
											}
										} else {
											if ( typeof attachment.url !== 'undefined' ) {
												display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.url );
											}
										}
									} else {
										if ( typeof attachment.url !== 'undefined' ) {
											display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
											image_in_customizer.val( attachment.url );
										}
									}

									switch (props.size) {
										case 'full':
											display_field.val( attachment.sizes.full.url );
											break;
										case 'medium':
											display_field.val( attachment.sizes.medium.url );
											break;
										case 'thumbnail':
											display_field.val( attachment.sizes.thumbnail.url );
											break;
										default:
											display_field.val( attachment.url );
											break;
									}
									display_field.trigger( 'change' );
								}
							} else {
								return wp.media.editor.send.attachment( button_id, [props, attachment] );
							}
						}
					};

						wp.media.editor.open( button_class );
						window.send_to_editor = function () {

						};
						return false;
				}
			);
		}

			media_upload( '.custom_media_button' );
	}
);
dev/wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/assets/js/widget-media.js000064400000005754151140230040032577 0ustar00home/xbodynamge/* global jQuery */
/* global wp */
jQuery( document ).ready( function($) {
	'use strict';

	$( document ).on('change','.custom_media_url',function() {
		var value = $.trim( $( this ).val() );
		var image_input = $( this ).parent().find( '.custom_media_image' );
		var media_id = $( this ).parent().parent().find( '.custom_media_id' );
		if (value.length === 0) {
			image_input.attr( 'src','' );
			image_input.attr( 'alt','' );
			media_id.val( '' );
		}
		var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
		if (typeof saveBtn !== 'undefined') {
			saveBtn.trigger( "click" );
		}
	});

	function media_upload(button_class) {
		var _custom_media = true;

		$( 'body' ).on('click', button_class, function() {

			var button_id = '#' + $( this ).attr( 'id' );
			var media_id = jQuery( this ).parent().parent().children( '.custom_media_id' );
			var display_field = jQuery( this ).parent().children( 'input:text' );
			var display_image = jQuery( this ).parent().children( '.custom_media_image' );
			var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

			_custom_media = true;

			wp.media.editor.send.attachment = function(props, attachment) {
				if ( typeof attachment !== 'undefined' ) {
					if ( _custom_media ) {
						if ( typeof display_field !== 'undefined' ) {

							if ( typeof attachment.id !== 'undefined' ) {
								media_id.val( attachment.id );
							}

							if ( typeof attachment.sizes !== 'undefined' ) {
								if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
									if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
										display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.sizes.thumbnail.url );
									}
								} else {
									if ( typeof attachment.url !== 'undefined' ) {
										display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.url );
									}
								}
							} else {
								if ( typeof attachment.url !== 'undefined' ) {
									display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
									image_in_customizer.val( attachment.url );
								}
							}

							switch (props.size) {
								case 'full':
									display_field.val( attachment.sizes.full.url );
									break;
								case 'medium':
									display_field.val( attachment.sizes.medium.url );
									break;
								case 'thumbnail':
									display_field.val( attachment.sizes.thumbnail.url );
									break;
								default:
									display_field.val( attachment.url );
									break;
							}
							display_field.trigger( 'change' );
						}// End if().
					} else {
						return wp.media.editor.send.attachment( button_id, [props, attachment] );
					}// End if().
				}// End if().
			};

			wp.media.editor.open( button_class );
			window.send_to_editor = function (html) {

			};
			return false;
		});
	}

	media_upload( '.custom_media_button' );
});
wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/assets/js/widget-media.js000064400000005754151144670660034525 0ustar00home/xbodynamge/lebauwcentre/* global jQuery */
/* global wp */
jQuery( document ).ready( function($) {
	'use strict';

	$( document ).on('change','.custom_media_url',function() {
		var value = $.trim( $( this ).val() );
		var image_input = $( this ).parent().find( '.custom_media_image' );
		var media_id = $( this ).parent().parent().find( '.custom_media_id' );
		if (value.length === 0) {
			image_input.attr( 'src','' );
			image_input.attr( 'alt','' );
			media_id.val( '' );
		}
		var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
		if (typeof saveBtn !== 'undefined') {
			saveBtn.trigger( "click" );
		}
	});

	function media_upload(button_class) {
		var _custom_media = true;

		$( 'body' ).on('click', button_class, function() {

			var button_id = '#' + $( this ).attr( 'id' );
			var media_id = jQuery( this ).parent().parent().children( '.custom_media_id' );
			var display_field = jQuery( this ).parent().children( 'input:text' );
			var display_image = jQuery( this ).parent().children( '.custom_media_image' );
			var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

			_custom_media = true;

			wp.media.editor.send.attachment = function(props, attachment) {
				if ( typeof attachment !== 'undefined' ) {
					if ( _custom_media ) {
						if ( typeof display_field !== 'undefined' ) {

							if ( typeof attachment.id !== 'undefined' ) {
								media_id.val( attachment.id );
							}

							if ( typeof attachment.sizes !== 'undefined' ) {
								if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
									if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
										display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.sizes.thumbnail.url );
									}
								} else {
									if ( typeof attachment.url !== 'undefined' ) {
										display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.url );
									}
								}
							} else {
								if ( typeof attachment.url !== 'undefined' ) {
									display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
									image_in_customizer.val( attachment.url );
								}
							}

							switch (props.size) {
								case 'full':
									display_field.val( attachment.sizes.full.url );
									break;
								case 'medium':
									display_field.val( attachment.sizes.medium.url );
									break;
								case 'thumbnail':
									display_field.val( attachment.sizes.thumbnail.url );
									break;
								default:
									display_field.val( attachment.url );
									break;
							}
							display_field.trigger( 'change' );
						}// End if().
					} else {
						return wp.media.editor.send.attachment( button_id, [props, attachment] );
					}// End if().
				}// End if().
			};

			wp.media.editor.open( button_class );
			window.send_to_editor = function (html) {

			};
			return false;
		});
	}

	media_upload( '.custom_media_button' );
});
wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/assets/js/widget-media.js000060400000005754151145434240034717 0ustar00home/xbodynamge/crosstraining/* global jQuery */
/* global wp */
jQuery( document ).ready( function($) {
	'use strict';

	$( document ).on('change','.custom_media_url',function() {
		var value = $.trim( $( this ).val() );
		var image_input = $( this ).parent().find( '.custom_media_image' );
		var media_id = $( this ).parent().parent().find( '.custom_media_id' );
		if (value.length === 0) {
			image_input.attr( 'src','' );
			image_input.attr( 'alt','' );
			media_id.val( '' );
		}
		var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
		if (typeof saveBtn !== 'undefined') {
			saveBtn.trigger( "click" );
		}
	});

	function media_upload(button_class) {
		var _custom_media = true;

		$( 'body' ).on('click', button_class, function() {

			var button_id = '#' + $( this ).attr( 'id' );
			var media_id = jQuery( this ).parent().parent().children( '.custom_media_id' );
			var display_field = jQuery( this ).parent().children( 'input:text' );
			var display_image = jQuery( this ).parent().children( '.custom_media_image' );
			var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

			_custom_media = true;

			wp.media.editor.send.attachment = function(props, attachment) {
				if ( typeof attachment !== 'undefined' ) {
					if ( _custom_media ) {
						if ( typeof display_field !== 'undefined' ) {

							if ( typeof attachment.id !== 'undefined' ) {
								media_id.val( attachment.id );
							}

							if ( typeof attachment.sizes !== 'undefined' ) {
								if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
									if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
										display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.sizes.thumbnail.url );
									}
								} else {
									if ( typeof attachment.url !== 'undefined' ) {
										display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
										image_in_customizer.val( attachment.url );
									}
								}
							} else {
								if ( typeof attachment.url !== 'undefined' ) {
									display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
									image_in_customizer.val( attachment.url );
								}
							}

							switch (props.size) {
								case 'full':
									display_field.val( attachment.sizes.full.url );
									break;
								case 'medium':
									display_field.val( attachment.sizes.medium.url );
									break;
								case 'thumbnail':
									display_field.val( attachment.sizes.thumbnail.url );
									break;
								default:
									display_field.val( attachment.url );
									break;
							}
							display_field.trigger( 'change' );
						}// End if().
					} else {
						return wp.media.editor.send.attachment( button_id, [props, attachment] );
					}// End if().
				}// End if().
			};

			wp.media.editor.open( button_class );
			window.send_to_editor = function (html) {

			};
			return false;
		});
	}

	media_upload( '.custom_media_button' );
});
home/xbodynamge/namtation/wp-content/themes/zerif-lite/js/widget-media.js000064400000006252151146676310022611 0ustar00/* global jQuery */
/* global wp */
jQuery( document ).ready(
	function($) {
			'use strict';

			$( document ).on(
				'change','.custom_media_url',function() {
					var value       = $.trim( $( this ).val() );
					var image_input = $( this ).parent().find( '.custom_media_image' );
					var media_id    = $( this ).parent().parent().find( '.custom_media_id' );
					if (value.length === 0) {
						image_input.attr( 'src','' );
						image_input.attr( 'alt','' );
						media_id.val( '' );
					}
					var saveBtn = $( this ).closest( '.form' ).find( '.widget-control-save' );
					if (typeof saveBtn !== 'undefined') {
						saveBtn.trigger( 'click' );
					}
				}
			);

		function media_upload(button_class) {
			var _custom_media = true;

			$( 'body' ).on(
				'click', button_class, function() {

					var button_id           = '#' + $( this ).attr( 'id' );
					var media_id            = jQuery( this ).parent().parent().children( '.custom_media_id' );
					var display_field       = jQuery( this ).parent().children( 'input:text' );
					var display_image       = jQuery( this ).parent().children( '.custom_media_image' );
					var image_in_customizer = jQuery( this ).parent().children( '.custom_media_display_in_customizer' );

					_custom_media = true;

					wp.media.editor.send.attachment = function(props, attachment) {
						if ( typeof attachment !== 'undefined' ) {
							if ( _custom_media ) {
								if ( typeof display_field !== 'undefined' ) {

									if ( typeof attachment.id !== 'undefined' ) {
										media_id.val( attachment.id );
									}

									if ( typeof attachment.sizes !== 'undefined' ) {
										if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
											if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
												display_image.attr( 'src', attachment.sizes.thumbnail.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.sizes.thumbnail.url );
											}
										} else {
											if ( typeof attachment.url !== 'undefined' ) {
												display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
												image_in_customizer.val( attachment.url );
											}
										}
									} else {
										if ( typeof attachment.url !== 'undefined' ) {
											display_image.attr( 'src', attachment.url ).css( 'display', 'block' );
											image_in_customizer.val( attachment.url );
										}
									}

									switch (props.size) {
										case 'full':
											display_field.val( attachment.sizes.full.url );
											break;
										case 'medium':
											display_field.val( attachment.sizes.medium.url );
											break;
										case 'thumbnail':
											display_field.val( attachment.sizes.thumbnail.url );
											break;
										default:
											display_field.val( attachment.url );
											break;
									}
									display_field.trigger( 'change' );
								}
							} else {
								return wp.media.editor.send.attachment( button_id, [props, attachment] );
							}
						}
					};

						wp.media.editor.open( button_class );
						window.send_to_editor = function () {

						};
						return false;
				}
			);
		}

			media_upload( '.custom_media_button' );
	}
);