Sha256: 9cc0b2dde583d161053ac74498633fc4ae3fab7660d207f31b7d224f0a1aa31e

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

$.fn.upload_maker = function(destination) {
	$(this).each(function() {
		//Get some vars
		var id = $(this).attr('id');
		var image_input_id = id + '_image_url';
		//write the iframe
		$(this).before('<iframe src="'+destination+'?destination=' + image_input_id +'" frameborder="0"></iframe>');
		//write hidden input
		$(this).after('<input id="' + image_input_id +'" name="' + image_input_id +'" style="position:absolute;left:-9999em" />');
		$('#' + image_input_id).focus(function() {
			var url = $(this).val();
			if (tinyMCE && (ed = tinyMCE.get(id))) {
				ed.execCommand('mceInsertContent', false, '<img src="' + url + '" alt="' + url + '" />');		
			} else {
				insertTag(id, '<img src="' + url + '" alt="' + url + '" />');
			}
	  });
	})
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kitsune-0.0.17 generators/kitsune/templates/javascripts/upload_maker.js