handlers.js 1.43 KB
Newer Older
Pham Huy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
var topWin = window.dialogArguments || opener || parent || top;

function fileDialogStart() {}
function fileQueued() {}
function uploadStart() {}
function uploadProgress() {}
function prepareMediaItem() {}
function prepareMediaItemInit() {}
function itemAjaxError() {}
function deleteSuccess() {}
function deleteError() {}
function updateMediaForm() {}
function uploadSuccess() {}
function uploadComplete() {}
function wpQueueError() {}
function wpFileError() {}
function fileQueueError() {}
function fileDialogComplete() {}
function uploadError() {}
function cancelUpload() {}

function switchUploader() {
	jQuery( '#' + swfu.customSettings.swfupload_element_id ).hide();
	jQuery( '#' + swfu.customSettings.degraded_element_id ).show();
	jQuery( '.upload-html-bypass' ).hide();
}

function swfuploadPreLoad() {
	switchUploader();
}

function swfuploadLoadFailed() {
	switchUploader();
}

jQuery(document).ready(function($){
	$( 'input[type="radio"]', '#media-items' ).on( 'click', function(){
		var tr = $(this).closest('tr');

		if ( $(tr).hasClass('align') )
			setUserSetting('align', $(this).val());
		else if ( $(tr).hasClass('image-size') )
			setUserSetting('imgsize', $(this).val());
	});

	$( 'button.button', '#media-items' ).on( 'click', function(){
		var c = this.className || '';
		c = c.match(/url([^ '"]+)/);
		if ( c && c[1] ) {
			setUserSetting('urlbutton', c[1]);
			$(this).siblings('.urlfield').val( $(this).attr('title') );
		}
	});
});