1/** 2 * Title: media-uploader-old.js 3 * 4 * Description: Defines JS for media uploader for WP version prior to 3.5. 5 * 6 * Please do not edit this file. This file is part of the Cyber Chimps Framework and all modifications 7 * should be made in a child theme. 8 * 9 * @category Cyber Chimps Framework 10 * @package Framework 11 * @since 1.0 12 * @author CyberChimps 13 * @license http://www.opensource.org/licenses/gpl-license.php GPL v3.0 (or later) 14 * @link http://www.cyberchimps.com/ 15 */ 16 17jQuery(document).ready(function () { 18 19 // Save the original value 20 var orig_send_to_editor = window.send_to_editor; 21 22 // Call the uploader on click of upload button 23 jQuery('.upload_image_button').click(function () { 24 25 // Get reference to the parent. 26 var parent = jQuery(this).parent(); 27 28 window.send_to_editor = function (html) { 29 imgurl = jQuery('img', html).attr('src'); 30 parent.find('.upload_image_field').val(imgurl); 31 tb_remove(); 32 33 // Reset the original value 34 window.send_to_editor = orig_send_to_editor; 35 } 36 37 formfield = jQuery('#upload_image').attr('name'); 38 tb_show('', 'media-upload.php?type=image&TB_iframe=true'); 39 40 return false; 41 }); 42});