Sha256: 234c908399f27f19bfb3e509a55e61e17406a77d3247acc6f0bd1d651fb4204c

Contents?: true

Size: 1.04 KB

Versions: 23

Compression:

Stored size: 1.04 KB

Contents

// Ajax Preloader
var Preloader;

if (Preloader == undefined) {
	Preloader = function(dom_id) {
		this.show(dom_id);
	};
}

Preloader.select = function(dom_id) {
  var element_id = (dom_id == null) ? 'preloader' : dom_id;

  if (this.element == null)
  {      
    this.element = document.getElementById(element_id);
  }
};

Preloader.show = function(dom_id) {
  this.select(dom_id);
	if (this.element == null) return;
	    
  this.draw();
};

Preloader.draw = function(){
  if (this.element == null) return;
  
  var client = window.innerHeight || document.documentElement.clientHeight;
  var top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
  var prefix = top + (client / 2);
	
	this.element.style.top = prefix + 'px';
	this.element.style.display = '';
};

Preloader.hide = function(dom_id){
  this.select(dom_id);
	if (this.element == null) return;
	
	this.element.style.display = 'none';
	this.element.style.top = '0px';
};

Preloader.is_enable = function(){
  return (document.getElementById('preloader') != null);
};

Version data entries

23 entries across 18 versions & 5 rubygems

Version Path
freeberry-0.2.7 lib/generators/freeberry/base/templates/javascripts/preloader.js
freeberry-0.2.6 lib/generators/freeberry/base/templates/javascripts/preloader.js
freeberry-0.2.5 lib/generators/freeberry/base/templates/javascripts/preloader.js