Sha256: 7e0287d9c60b3395aa515f9e929fcd1e74e5e40b2528bbe5404eaf23532bed6c

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

function createStoryJS(hash) {
	var config = {
		debug:     false,
		embed:     true,
		embed_id: 'Timeline',
		type:     'timeline',
		id:       'storyjs',
		width:    '100%',
		height:   '100%',
		lang:     'en'
	};

	function createEmbedDiv() {
		var $root, $embed, classname = "storyjs-embed";
		$root = document.createElement('div');
		$embed = document.getElementById(config.embed_id);
		$embed.appendChild($root);
		$root.setAttribute("id", config.id);
		if (config.width.toString().match("%") ) {
			$embed.style.width = config.width.split("%")[0] + "%";
		} else {
			config.width = config.width - 2;
			$embed.style.width = (config.width) + 'px';
		}
		if (config.height.toString().match("%")) {
			classname += " full-embed";
			$embed.style.height = config.height.split("%")[0] + "%";
		} else if (config.width.toString().match("%")) {
			classname += " full-embed";
			config.height = config.height - 16;
			$embed.style.height = (config.height) + 'px';
		} else {
			classname += " sized-embed";
			config.height = config.height - 16;
			$embed.style.height = (config.height) + 'px';
		}
		$embed.setAttribute("class", classname);
		$embed.setAttribute("className", classname); 
		$root.style.position = 'relative';
	}
	function buildEmbed() {
		var oTimeline;
		VMM.debug = config.debug;
		oTimeline = new VMM.Timeline(config.id);
		oTimeline.init(config);
	}

	for (var prop in hash) {
		if (Object.prototype.hasOwnProperty.call(hash, prop)) {
			config[prop] = hash[prop];
		}
	}

	LazyLoad.locale(config.lang);
	createEmbedDiv();
	buildEmbed();		
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timelineJS-1.1.0 ref/timelineJS-rails/embed.modified.js