view war/scripts/blockUI/FullscreenWindow.js @ 3:cf06b77a8bbd

Committed branch of the e4D repos sti-gwt branch 16384. git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@36 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
author StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
date Tue, 17 Jul 2012 13:34:40 +0000
parents
children
line wrap: on
line source

var fullscreen = new function(){
	
	var loader = new Image();
	loader.src = 'images/ajax-loader.gif';

	this.fullscreens = [];	
	this.zIndex = 5;
	this.margin = 20;
	
	this.loaderContent = function(){
    		var content = $("<div/>");
		content.css('position','absolute');
		content.append("<p id='statusText' style='text-align: center;color:white;'></p>");
		content.append("<img src='images/ajax-loader.gif'/>");
		return content;
	}


    this.addFullscreen = function(content){
		var blockDiv = $("<div/>").appendTo('body');
		blockDiv.addClass("blockDiv");
		blockDiv.css('width',$(document).width()+'px');
		blockDiv.css('height',$(document).height()+'px');
		blockDiv.css('z-index',++this.zIndex);
		var overlay = $("<div/>").appendTo(blockDiv);
		overlay.addClass("blockDivOverlay");
		overlay.css('width',$(document).width()+'px');
		overlay.css('height',$(document).height()+'px');
		$(content).appendTo(blockDiv);
		this.fullscreens.push({
		      content: content,
		      overlay: overlay,
		      blockDiv: blockDiv
        });
        this.centerDiv(content);
    }
    
    this.centerDiv = function(div){
        var left = Math.floor($(document).width()/2-div.width()/2);
        var top = Math.floor($(document).height()/2-div.height()/2);
		div.css('top', top+'px');
		div.css('left', left+'px');
    }
	
	this.removeFullscreen = function(){
	   $(this.fullscreens[this.fullscreens.length-1].blockDiv).remove();
	   this.fullscreens.pop();
	}
	
	this.resize = function(){
	   for( var i in this.fullscreens ){
            this.fullscreens[i].blockDiv.css('width',$(document).width()+'px');
            this.fullscreens[i].blockDiv.css('height',$(document).height()+'px');
            this.fullscreens[i].overlay.css('width',$(document).width()+'px');
            this.fullscreens[i].overlay.css('height',$(document).height()+'px');
            this.centerDiv(this.fullscreens[i].content);
	   }
	}
	
}