Sha256: d00d1b829f0d70e4aac2c1f69094993a283e5355fc083c084ef88048bb7ae62c

Contents?: true

Size: 1.7 KB

Versions: 9

Compression:

Stored size: 1.7 KB

Contents

/*!
 * This file is part of Aloha Editor
 * Author & Copyright (c) 2010 Gentics Software GmbH, aloha@gentics.com
 * Licensed unter the terms of http://www.aloha-editor.com/license.html
 */
// Ensure GENTICS Namespace
GENTICS = window.GENTICS || {};
GENTICS.Utils = GENTICS.Utils || {};

define( 'util/lang', [], function(){} );

// Start Closure
(function(window, undefined) {
	
	var
		jQuery = window.alohaQuery || window.jQuery, $ = jQuery,
		GENTICS = window.GENTICS,
		Class = window.Class,
		console = window.console;

/**
 * Takes over all properties from the 'properties' object to the target object.
 * If a property in 'target' with the same name as a property in 'properties' is already defined it is overridden.
 *
 * Example:
 *
 * var o1 = {a : 1, b : 'hello'};
 * var o2 = {a : 3, c : 'world'};
 *
 * GENTICS.Utils.applyProperties(o1, o2);
 *
 * Will result in an o1 object like this:
 *
 * {a : 3, b: 'hello', c: 'world'}
 *
 * @static
 * @return void
 */
GENTICS.Utils.applyProperties = function (target, properties) {
	var name;
	for (name in properties) {
		if (properties.hasOwnProperty(name)) {
			target[name] = properties[name];
		}
	}
};

/**
 * Generate a unique hexadecimal string with 4 charachters
 * @return {string}
 */
GENTICS.Utils.uniqeString4 = function () {
   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};

/**
 * Generate a unique value represented as a 32 character hexadecimal string,
 * such as 21EC2020-3AEA-1069-A2DD-08002B30309D
 * @return {string}
 */
GENTICS.Utils.guid = function () {
	var S4 = GENTICS.Utils.uniqeString4;
	return (S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4());
};

})(window);

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
locomotive-aloha-rails-0.20.1.5 vendor/assets/javascripts/aloha/lib/util/lang.js
aloha-rails-0.0.2 vendor/assets/javascripts/aloha/lib/util/lang.js
free_text-0.0.3 app/assets/javascripts/aloha-0.10.0/lib/util/lang.js
locomotive-aloha-rails-0.20.1.4 vendor/assets/javascripts/aloha/lib/util/lang.js
locomotive-aloha-rails-0.20.1.3 vendor/assets/javascripts/aloha/lib/util/lang.js
locomotive-aloha-rails-0.20.1.2 vendor/assets/javascripts/aloha/lib/util/lang.js
locomotive-aloha-rails-0.20.1.1 vendor/assets/javascripts/aloha/lib/util/lang.js
aloha-rails-0.0.1 vendor/assets/javascripts/aloha/lib/util/lang.js
locomotive-aloha-rails-0.20.1 vendor/assets/javascripts/aloha/lib/util/lang.js