[Mapbender-commits] r1851 - in trunk/mapbender/http: css javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Nov 26 07:52:17 EST 2007


Author: nimix
Date: 2007-11-26 07:52:15 -0500 (Mon, 26 Nov 2007)
New Revision: 1851

Modified:
   trunk/mapbender/http/css/popup.css
   trunk/mapbender/http/javascripts/popup.js
Log:
proper setWidth and setHeight handeling and some other fixes

Modified: trunk/mapbender/http/css/popup.css
===================================================================
--- trunk/mapbender/http/css/popup.css	2007-11-26 10:25:57 UTC (rev 1850)
+++ trunk/mapbender/http/css/popup.css	2007-11-26 12:52:15 UTC (rev 1851)
@@ -1,21 +1,29 @@
 @CHARSET "UTF-8";
-div.jqmNotice .jqResize {position: absolute; right: 2px; bottom: 2px;width:16px;height:16px;background:url(../img/resize.gif);}
+/*fixes*/
 div.jqmNotice iframe {width:100%;height:100%;}
 div.jqmNotice div.scrollDiv {overflow:auto;position:relative;top:0px;left:0px;right:0px;bottom:0px;width:100%;height:100%;}
 
 div.jqmNotice {
     display: none;
-    z-index:50;
+    overflow:hidden;
     position: absolute;
-    width: 300px;
-    height:250px;
+    
+/*styles that can change*/
     background:#EEEEEE url(../img/info_on.gif) 5px 5px no-repeat;
     border: 1px solid #000;
     padding: 0;
     padding-bottom:30px;
-    overflow:hidden;
 }
 
+div.jqmNotice .jqResize {
+	position: absolute; 
+	right: 2px; 
+	bottom: 2px;
+	width:16px;
+	height:16px;
+	background:url(../img/resize.gif);
+}
+
 .jqmnTitle{margin: 0 25px;}
   
 .jqmnTitle h1{

Modified: trunk/mapbender/http/javascripts/popup.js
===================================================================
--- trunk/mapbender/http/javascripts/popup.js	2007-11-26 10:25:57 UTC (rev 1850)
+++ trunk/mapbender/http/javascripts/popup.js	2007-11-26 12:52:15 UTC (rev 1851)
@@ -122,7 +122,7 @@
  * @param {Number} popy top posision of the popup
  * 
  */
-function mb_popup(title,html,width,height,posx,posy) {
+function mb_popup(title,html,width,height,posx,posy,opacity) {
 	//get first free place
 	var create_pos=popup_count;
 	for(var i = 0; i < popup_count;i++)
@@ -134,14 +134,34 @@
 	//Set member vars
 	this.left=posx?posx:25*create_pos;
 	this.top=posy?posy:25*create_pos;
-	this.width=width;
-	this.height=height;
+	this.width=width?width:300;
+	this.height=height?height:250;
 	this.title=title;
+	this.opacity=opacity?opacity:1.0;
 	this.html=html.indexOf("url:")==0?('<iframe src="'+html.substr(4)+'"></iframe>'):('<div class="scrollDiv">'+html+'</div>');
 	this.id="popup"+String(create_pos);
 	popup_count++;
 }
 
+function createCatcher(){
+	$("#mouse_catch").remove();
+	var div=document.createElement('div');
+	div.style.position="absolute";
+	div.style.top="0px";
+	div.style.left="0px";
+	div.style.width=document.body.scrollWidth+"px";
+	div.style.height=document.body.scrollHeight+"px";
+	div.id="mouse_catch";
+	div.style.zIndex=popup_top-2;
+	if(top.ie)
+		div.style.background = "url(../img/transparent.gif)";
+	window.document.body.appendChild(div);
+}
+
+function removeCatcher(){
+	$("#mouse_catch").remove();
+}
+
 /**
  * Shows the popup
  */
@@ -154,54 +174,31 @@
 	
 	div.style.left=String(this.left)+"px";
 	div.style.top=String(this.top)+"px";
-//	div.style.width=String(this.width)+"px";
-//	div.style.height=String(this.height)+"px";
+	div.style.width=String(this.width)+"px";
+	div.style.height=String(this.height)+"px";
 	div.style.zIndex=popup_top++;
+	div.style.opacity=String(this.opacity);
 	
 	//create Window elements
 	div.innerHTML='<div class="jqmnTitle jqDrag"><h1>'+this.title+'</h1></div><div class="jqmnContent">'+this.html+'</div><img src="../img/close_icon.png" class="jqmClose" alt="close" /><div class="jqResize" />';
 	
 	//create window
 	document.body.appendChild(div);
-	$(div.firstChild).mousedown(function() {
-		var div=document.createElement('div');
-		div.style.position="absolute";
-		div.style.top="-150px";
-		div.style.left="-150px";
-		div.style.width=String(this.parentNode.clientWidth+300)+"px";
-		div.style.height=String(this.parentNode.clientHeight+150)+"px";
-		if(top.ie)
-			div.style.background = "url(../img/transparent.gif)";
-		div.style.cursor = "move";				
-		this.appendChild(div);
-	});
-	$(div.firstChild).mouseup(function() {
-		$(this.lastChild).remove();
-	});
-	$(div.lastChild).mousedown(function() {
-		var div=document.createElement('div');
-		div.style.position="absolute";
-		div.style.top="-250px";
-		div.style.left="-250px";
-		div.style.width="516px";
-		div.style.height="516px";
-		if(top.ie)
-			div.style.background = "url(../img/transparent.gif)";
-		div.style.cursor = "move";				
-		this.appendChild(div);
-	});
-	$(div.lastChild).mouseup(function() {
-		$(this.lastChild).remove();
-	});	
+	$(div.firstChild).mousedown(function(){createCatcher();});
+	$(div.firstChild).mouseup(function(){removeCatcher();});
+	$(div.lastChild).mousedown(function(){createCatcher();});
+	$(div.lastChild).mouseup(function(){removeCatcher();});	
+	
 	$("#"+this.id, document).jqDrag('.jqDrag').jqResize('.jqResize').jqm({
       overlay: 0,
       onShow: function(h) {
         //on show annimate
-        h.w.css('opacity',1.00).slideDown("slow"); 
+        h.w.show();
        },
       onHide: function(h) {
         // on close do animation and destroy dom element.
-        h.w.slideUp("slow",function() {if(h.o) h.o.remove(); if(h.w)h.w.remove();});}
+        h.w.slideUp("slow",function() {if(h.o) h.o.remove(); if(h.w)h.w.remove();removeCatcher();});}
+        
       });
 	$("#"+this.id).jqm().jqmShow();
 	//on click bring window to top
@@ -211,7 +208,8 @@
 /**
  * Hides the popup
  */
-mb_popup.prototype.hide = function(){
+mb_popup.prototype.hide = function(){	
+	var div=document.getElementById(this.id);
 	$("#"+this.id).jqm().jqmHide();
 }
 
@@ -260,6 +258,17 @@
 }
 
 /**
+ * sets the opacity of the popup window
+ *
+ * @param {Number} opacity new opacity value of the popup  
+ */
+mb_popup.prototype.setOpacity = function(opacityy){
+	this.opacity=opacityy;
+	var div=document.getElementById(this.id);
+	if(div)div.style.opacity=opacityy;
+}
+
+/**
  * sets the title of the popup window
  *
  * @param {String} title new title text of the popup  
@@ -296,4 +305,4 @@
  */
 mb_popup.prototype.isVisible = function(){
 	return document.getElementById(this.id)?true:false;
-}
+}
\ No newline at end of file



More information about the Mapbender_commits mailing list