Skip to content

Commit

Permalink
revert last couple commits for new media awesomemotive#684
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltorbert committed Jan 18, 2017
1 parent c640fb8 commit 996a3bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 39 deletions.
3 changes: 0 additions & 3 deletions admin/aioseop_module_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1758,13 +1758,10 @@ function enqueue_styles() {

/**
* Load scripts for module, can pass data to module script.
*
* @todo Figure out which of these are needed and which can be removed... probably media-upload and thickbox.
*/
function enqueue_scripts() {
wp_enqueue_script( 'sack' );
wp_enqueue_script( 'jquery' );
wp_enqueue_media(); // WP 3.5+ Media upload.
wp_enqueue_script( 'media-upload' );
wp_enqueue_script( 'thickbox' );
wp_enqueue_script( 'common' );
Expand Down
55 changes: 19 additions & 36 deletions js/modules/aioseop_module.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,43 +245,26 @@ jQuery( document ).ready(function() {
});

/**
* @since 2.3.11.2
*
* @since 1.0.0
* @return boolean.
*/
jQuery(document).ready(function($){

var custom_uploader;

jQuery('.aioseop_upload_image_button').click(function(e) {

e.preventDefault();

//If the uploader object has already been created, reopen the dialog
if (custom_uploader) {
custom_uploader.open();
return;
}

//Extend the wp.media object
custom_uploader = wp.media.frames.file_frame = wp.media({
title: 'Choose Image',
button: {
text: 'Choose Image'
},
multiple: false
});

//When a file is selected, grab the URL and set it as the text field's value
custom_uploader.on('select', function() {
attachment = custom_uploader.state().get('selection').first().toJSON();
jQuery('.aioseop_upload_image_label').val(attachment.url);
});

//Open the uploader dialog
custom_uploader.open();

});

jQuery( document ).ready(function() {
var image_field;
jQuery( '.aioseop_upload_image_button' ).click(function() {
window.send_to_editor = aioseopNewSendToEditor;
image_field = jQuery( this ).next();
formfield = image_field.attr( 'name' );
tb_show( '', 'media-upload.php?type=image&TB_iframe=true' );
return false;
});
aioseopStoreSendToEditor = window.send_to_editor;
aioseopNewSendToEditor = function(html) {
imgurl = jQuery( 'img',html ).attr( 'src' );
if ( typeof( imgurl ) !== undefined )
image_field.val( imgurl );
tb_remove();
window.send_to_editor = aioseopStoreSendToEditor;
};
});

/**
Expand Down

0 comments on commit 996a3bc

Please sign in to comment.