Sha256: f2873f200588c2693b56c25a04b06a0bfbc719ca69efd05ded96bb9c6d1f1886

Contents?: true

Size: 1.75 KB

Versions: 57

Compression:

Stored size: 1.75 KB

Contents

/**
 *	Xenon API Functions
 *
 *	Theme by: www.laborator.co
 **/


function rtl() // checks whether the content is in RTL mode
{
	if(typeof window.isRTL == 'boolean')
		return window.isRTL;
		
	window.isRTL = jQuery("html").get(0).dir == 'rtl' ? true : false;
	
	return window.isRTL;
}



// Page Loader
function show_loading_bar(options)
{
	var defaults = {
		pct: 0, 
		delay: 1.3, 
		wait: 0,
		before: function(){},
		finish: function(){},
		resetOnEnd: true
	};
	
	if(typeof options == 'object')
		defaults = jQuery.extend(defaults, options);
	else
	if(typeof options == 'number')
		defaults.pct = options;
		
	
	if(defaults.pct > 100)
		defaults.pct = 100;
	else
	if(defaults.pct < 0)
		defaults.pct = 0;
	
	var $ = jQuery,
		$loading_bar = $(".xenon-loading-bar");
	
	if($loading_bar.length == 0)
	{
		$loading_bar = $('<div class="xenon-loading-bar progress-is-hidden"><span data-pct="0"></span></div>');
		public_vars.$body.append( $loading_bar );
	}
	
	var $pct = $loading_bar.find('span'),
		current_pct = $pct.data('pct'),
		is_regress = current_pct > defaults.pct;
	
	
	defaults.before(current_pct);
	
	TweenMax.to($pct, defaults.delay, {css: {width: defaults.pct + '%'}, delay: defaults.wait, ease: is_regress ? Expo.easeOut : Expo.easeIn,
	onStart: function()
	{
		$loading_bar.removeClass('progress-is-hidden');
	},
	onComplete: function()
	{
		var pct = $pct.data('pct');
		
		if(pct == 100 && defaults.resetOnEnd)
		{
			hide_loading_bar();
		}
		
		defaults.finish(pct);
	}, 
	onUpdate: function()
	{
		$pct.data('pct', parseInt($pct.get(0).style.width, 10));
	}});
}

function hide_loading_bar()
{
	var $ = jQuery,
		$loading_bar = $(".xenon-loading-bar"),
		$pct = $loading_bar.find('span');
	
	$loading_bar.addClass('progress-is-hidden');
	$pct.width(0).data('pct', 0);
}

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
kuppayam-0.1.32 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.31 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.30 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.29 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.28 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.27 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.26 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.25 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.24 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.23 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.22 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.21 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.20 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.19 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.18 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.17 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.16 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.15 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.14 vendor/assets/javascripts/xenon-api.js
kuppayam-0.1.13 vendor/assets/javascripts/xenon-api.js