AlkantarClanX12

Your IP : 216.73.217.24


Current Path : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/
Upload File :
Current File : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/media-uploader.js

jQuery(document).ready(function($){
    var mediaUploader;
    var mediaUploaderSocial;
    var mediaUploaderReview;
    var inventory_new_listing;
    var inventory_new_listing_fr;
    var inventory_used_listing;
    var inventory_used_listing_fr;
    var custom_offer_image;

    $('#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();
        $('#background_image').val(attachment.url);
      });
      mediaUploader.open();
    });

    $('#upload_image_button_social').click(function(e) {
        e.preventDefault();
          if (mediaUploaderSocial) {
            mediaUploaderSocial.open();
          return;
        }
        mediaUploaderSocial = wp.media.frames.file_frame = wp.media({
          title: 'Choose Image',
          button: {
          text: 'Choose Image'
        }, multiple: false });
        mediaUploaderSocial.on('select', function() {
          var attachment = mediaUploaderSocial.state().get('selection').first().toJSON();
          $('#socialmedia_image').val(attachment.url);
        });
        mediaUploaderSocial.open();
      });

      $('#upload_image_button_review').click(function(e) {
        e.preventDefault();
          if (mediaUploaderReview) {
            mediaUploaderReview.open();
          return;
        }
        mediaUploaderReview = wp.media.frames.file_frame = wp.media({
          title: 'Choose Image',
          button: {
          text: 'Choose Image'
        }, multiple: false });
        mediaUploaderReview.on('select', function() {
          var attachment = mediaUploaderReview.state().get('selection').first().toJSON();
          $('#social_review_image').val(attachment.url);
        });
        mediaUploaderReview.open();
      });

      $('#upload_image_button_footer').click(function(e) {
        e.preventDefault();
          if (mediaUploaderReview) {
            mediaUploaderReview.open();
          return;
        }
        mediaUploaderReview = wp.media.frames.file_frame = wp.media({
          title: 'Choose Image',
          button: {
          text: 'Choose Image'
        }, multiple: false });
        mediaUploaderReview.on('select', function() {
          var attachment = mediaUploaderReview.state().get('selection').first().toJSON();
          $('#logo_footer_image').val(attachment.url);
        });
        mediaUploaderReview.open();
      });

			// Botón para seleccionar imagen de la nueva funcionalidad listing new
			$('#upload_image_button_inv_new').click(function(e) {
        e.preventDefault();
        if (inventory_new_listing) {
            inventory_new_listing.open();
            return;
        }
        inventory_new_listing = wp.media({
            title: 'Select Image',
            button: {
                text: 'Use this image'
            },
            multiple: false
        });
        inventory_new_listing.on('select', function() {
            var attachment = inventory_new_listing.state().get('selection').first().toJSON();
            $('#image_new').val(attachment.url);
        });
        inventory_new_listing.open();
    });

		//boton para seleccionar imagen de la nueva funcionalidad listing new fr
		$('#upload_image_button_inv_new_fr').click(function(e) {
				e.preventDefault();
				if (inventory_new_listing_fr) {
						inventory_new_listing_fr.open();
						return;
				}
				inventory_new_listing_fr = wp.media({
						title: 'Select Image',
						button: {
								text: 'Use this image'
						},
						multiple: false
				});
				inventory_new_listing_fr.on('select', function() {
						var attachment = inventory_new_listing_fr.state().get('selection').first().toJSON();
						$('#image_new_fr').val(attachment.url);
				});
				inventory_new_listing_fr.open();
		});

		// Botón para seleccionar imagen de la nueva funcionalidad listing used
		$('#upload_image_button_inv_used').click(function(e) {
				e.preventDefault();
				if (inventory_used_listing) {
						inventory_used_listing.open();
						return;
				}
				inventory_used_listing = wp.media({
						title: 'Select Image',
						button: {
								text: 'Use this image'
						},
						multiple: false
				});
				inventory_used_listing.on('select', function() {
						var attachment = inventory_used_listing.state().get('selection').first().toJSON();
						$('#image_used').val(attachment.url);
				});
				inventory_used_listing.open();
		});

		// Botón para seleccionar imagen de la nueva funcionalidad listing used fr
		$('#upload_image_button_inv_used_fr').click(function(e) {
				e.preventDefault();
				if (inventory_used_listing_fr) {
						inventory_used_listing_fr.open();
						return;
				}
				inventory_used_listing_fr = wp.media({
						title: 'Select Image',
						button: {
								text: 'Use this image'
						},
						multiple: false
				});
				inventory_used_listing_fr.on('select', function() {
						var attachment = inventory_used_listing_fr.state().get('selection').first().toJSON();
						$('#image_used_fr').val(attachment.url);
				});
				inventory_used_listing_fr.open();
		});
});