Sha256: 7dfbe0fb6743f6e7889b4850b298cd9ce15e62b30ca70e3bf5ed326cda90109a

Contents?: true

Size: 1.98 KB

Versions: 16

Compression:

Stored size: 1.98 KB

Contents

//= require rails_admin_image_manager/editor/image_manager_picker

window.addQueryString = function ( url, params ) {
	var queryString = [];
	if (!params) return url;
	else {
		for (var i in params) queryString.push(i + "=" + encodeURIComponent( params[i]));
	}
	return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
}

window.insertImageManagerMedia = function(idImage, idInput, url) {
  $('#'+idInput).val(idImage)
  $("[data-manager-preview='"+idInput+"']").attr('src',url)
	$('#deselect_'+idInput).show();
}

var popup = function( url, width, height, options ) {
	width = width || '80%';
	height = height || '70%';

	if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
		width = parseInt( window.screen.width * parseInt( width, 10 ) / 100, 10 );

	if ( typeof height == 'string' && height.length > 1 && height.substr( height.length - 1, 1 ) == '%' )
		height = parseInt( window.screen.height * parseInt( height, 10 ) / 100, 10 );

	if ( width < 640 )
		width = 640;

	if ( height < 420 )
		height = 420;

	var top = parseInt( ( window.screen.height - height ) / 2, 10 ),
		left = parseInt( ( window.screen.width - width ) / 2, 10 );

	options = ( options || 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes' ) + ',width=' + width +
		',height=' + height +
		',top=' + top +
		',left=' + left;

	var popupWindow = window.open( '', null, options, true );

	// Blocked by a popup blocker.
	if ( !popupWindow )
		return false;

	try {
		// Chrome is problematic with moveTo/resizeTo, but it's not really needed here (http://dev.ckeditor.com/ticket/8855).
		var ua = navigator.userAgent.toLowerCase();
		if ( ua.indexOf( ' chrome/' ) == -1 ) {
			popupWindow.moveTo( left, top );
			popupWindow.resizeTo( width, height );
		}
		popupWindow.focus();
		popupWindow.location.href = url;
	} catch ( e ) {
		popupWindow = window.open( url, null, options, true );
	}

	return true;
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rails_admin_image_manager-0.1.34 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.33 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.31 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.30 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.3 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.29 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.28 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.27 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.26 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.25 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.24 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.23 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.22 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.21 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.20 app/assets/javascripts/rails_admin_image_manager/base.js.erb
rails_admin_image_manager-0.1.15 app/assets/javascripts/rails_admin_image_manager/base.js.erb