⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jitk_layout.js

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JS
📖 第 1 页 / 共 3 页
字号:
		} else {
			mFrom = 0;
		}
		smoothModify('map', 'height', mFrom, mapHeight, 200);
		smoothModify('resultsBox', 'height', document.getElementById("resultsBox").style.height.slice(0, -2), 0, 200);
		
		jitkViewer_resizeMapHeight(mapHeight);
	}
else	if (p == "reset"){
		document.getElementById("map").style.display = "block";
		document.getElementById("mapHeader").style.display = "block";
		document.getElementById("mapContainer").style.display = "block";
		v_diffpos = 0;
		document.getElementById("resultsContainer").style.display = "block";
		document.getElementById("resultsBox").style.display = "block";
		document.getElementById("hbar").style.display = "block";
		showResults = true;
		mapHeight = winH - notMap;
		if(document.getElementById("resultsBox").style.height.slice(0, -2) != "") {
			rFrom = document.getElementById("resultsBox").style.height.slice(0, -2);
		} else {
			rFrom = 0;
		}
		smoothModify('map', 'height', document.getElementById("map").style.height.slice(0, -2), mapHeight, 100);
		smoothModify('resultsBox', 'height', rFrom, resultsBoxH, 200);
		
		jitkViewer_resizeMapHeight(mapHeight);
	}
	h_allowed = false;
	return false;
}


//STORES THE STARTING DRAG VALUE FOR VBAR (BETWEEN MAP AND RESULTS)
function vPosition(p) {
	//document.onmouseup = new Function("v_allowed = false; return false;")
	document.onmouseup = vEndPos;
	document.onmousemove = vNewPos;
	if (navigator.appName=="Netscape") {
		v_startpos = p.screenY + v_diffpos;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		v_startpos = event.clientY + v_diffpos;
	}
	v_allowed = true;
	return false;
}


//ADJUSTS HEIGHT OF MAP AND RESULTS WITH VBAR DRAG
function vNewPos(p) {
	if (v_allowed) {
		if (!document.all)
			v_endpos = p.screenY;
		else
			v_endpos = event.clientY;
			v_diffpos = v_startpos- v_endpos;
		var mapHeight = winH - notMap;
		if (v_diffpos > -(resultsBoxH) && v_diffpos < mapHeight) {
			//REOPEN MAP IF HIDDEN
			document.getElementById("mapHeader").style.display = "block";
			document.getElementById("mapContainer").style.display = "block";
			document.getElementById("resultsContainer").style.display = "block";
			document.getElementById("resultsBox").style.display = "block";
			document.getElementById("map").style.height = mapHeight - v_diffpos + "px";
			document.getElementById("resultsBox").style.height = resultsBoxH + v_diffpos + "px";
		}
	}
}


function vEndPos(p) {
	if (v_allowed) {
		v_allowed = false;
		var sMapDivHeight = document.getElementById("map").style.height
		var iMapDivHeight = sMapDivHeight.substring(0, sMapDivHeight.indexOf("px"));
		
		if (iMapDivHeight <= 0) {
			iMapDivHeight = jitkViewer_zeroSize;
		}else {
			jitkViewer_resizeMapHeight(iMapDivHeight);
		}
	}

	document.onmouseup = new Function("v_allowed = false; return false;")	
	return false;
}


//ATTACHES FUNCTIONS TO RESIZE BARS & SCALES PAGE ELEMENTS 
function setevent() {

	jitkHeaderHeight = $("topmenu").height() + $("header").height();
	
	 //CONNECT ACTIONBULDER FUNCTION TO ELEMENTS THAT REQUEST IT
	var buildActions = getElementIdByAttributeValue('actionBuilder', 'true');
	for (i=0; i<buildActions.length; ++i) {
		thisElement = document.getElementById(buildActions[i]);
		thisAction = thisElement.getAttribute("onthis");
		connectEvent(thisElement, thisAction, actionBuilder);
	}

	//GRAB THE HORIZONTAL BAR TO CHANGE THE VERTICAL POSITION OF ELEMENTS ON THE PAGE
	if (useActiveBorders == "true") {
		connectEvent(document.getElementById("hbar"), "mousedown", vPosition);
		connectEvent(document.getElementById("hbar"), "dblclick", resultsView);
	} else {
		document.getElementById("hbar").style.cursor = "default";
	}

	//GRAB THE VERTICAL BAR TO CHANGE THE HORIZONTAL POSITION OF ELEMENTS ON THE PAGE
	if (useActiveBorders == "true") {
		connectEvent(document.getElementById("vbar"), "mousedown", hPosition);
		connectEvent(document.getElementById("vbar"), "dblclick", accordionHide);
	} else {
		document.getElementById("vbar").style.cursor = "default";
	}
	 
		
	
	//RUN SCALE FUNCTION ON RESIZE
	window.onresize = scaleboxes;
	//AND GO AHEAD AND RUN IT NOW ON LOAD
	scaleboxes();
	
	
	//INITIATE THE FADE AWAY EFFECT ON THE "FADER" DIV OVERLAY
	setTimeout("smoothModify('fader', 'opacity', 100, 0, 1000)", 1000);
	
	//HIDE RESULTS DISPLAY
	jitkViewer_displayResults('min');
	
	//SHOW ACCORDIAN SET
	swapAccordSet('accordianMapContents');
	
	// add onclick handler to menu so that it automatically shows as the top-most element
	if (!$.browser.msie) {
		$("#nav").mouseover(function(){
			if (taskWindowManager.windows[taskWindowManager.windowIds[0]] != null) {
				var win = taskWindowManager.windows[taskWindowManager.windowIds[0]];
				$("#nav").css("z-index",win.jitkGetGlobalZIndex()+1);			
	  		}
		});
	}
			
}


function resultsView() {
	resultsDisplay("max");
	disconnectEvent(document.getElementById("hbar"), "dblclick", resultsView);
	connectEvent(document.getElementById("hbar"), "dblclick", resultsHide);
}

function resultsHide() {
	resultsDisplay("min");
	disconnectEvent(document.getElementById("hbar"), "dblclick", resultsHide);
	connectEvent(document.getElementById("hbar"), "dblclick", resultsView);
}

function accordionView() {
	accordDisplay('reset');
	disconnectEvent(document.getElementById("vbar"), "dblclick", accordionView);
	connectEvent(document.getElementById("vbar"), "dblclick", accordionHide);
}

function accordionHide() {
	hPositionJump(0);
	disconnectEvent(document.getElementById("vbar"), "dblclick", accordionHide);
	connectEvent(document.getElementById("vbar"), "dblclick", accordionView);
}



function scaleboxes() {
	//alert('scaleboxes');
	var iResultBoxHeight = resultsBoxH + v_diffpos;
	var iAccordianWidth = leftPanel - h_diffpos;

	if (iResultBoxHeight <= 0) {
		iResultBoxHeight = jitkViewer_zeroSize;
	}
	
	if (iAccordianWidth <= 0) {
		iAccordianWidth = jitkViewer_zeroSize;
	}
	
	// Disabled by new version of Steve's code
	//document.getElementById("resultsBox").style.height = iResultBoxHeight + "px";
	document.getElementById("accordions").style.width = leftPanel - h_diffpos  + "px";

	//GET CURRENT WINDOW HEIGHT
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winH = document.body.offsetHeight;
		}
	}
		// Resize the map
	if (showResults == true) {
		mapHeight = winH - notMap - v_diffpos;
		
		if (mapHeight <= 0) {
			mapHeight = jitkViewer_zeroSize;
		}
		
		document.getElementById("map").style.height = mapHeight  + "px";
	}
	else {
		mapHeight = winH - notPanel - mapHeaderH;
		
		if (mapHeight <= 0) {
			mapHeight = jitkViewer_zeroSize;
		}	
		
		document.getElementById("map").style.height = mapHeight  + "px";
   }		
		
	//SCALE LEFT PANEL
	var panelHeight = (winH - notPanel) - overviewMapSpaceHeight;
	if (panelHeight<=0) panelHeight = jitkViewer_zeroSize;
	resizeAccordions(panelHeight);

	//SCALE THE VBAR
	var vbarHeight = winH - notPanel;
	var vbar = document.getElementById('vbar');

	var iVBarHeight = vbarHeight + bottomMargin;
	
	if (iVBarHeight <= 0) {
		iVBarHeight = jitkViewer_zeroSize;
	}
	
	vbar.style.height = iVBarHeight + "px";
	
	var hControlsHeight = vbarHeight + bottomMargin;
	var hControls = document.getElementById('hControls');	
	
	if (hControlsHeight <= 0) {
		hControlsHeight = jitkViewer_zeroSize;
	}
	
	hControls.style.height = hControlsHeight/2 + "px";

	//SCALE THE TOOLBAR
	var toolbarHeight = winH - notPanel;
	var toolbar = document.getElementById('toolbar');
	
	var iToolbarHeight = toolbarHeight + bottomMargin;
	
	if (iToolbarHeight <= 0) {
		iToolbarHeight = jitkViewer_zeroSize;
	}
	
	toolbar.style.height = iToolbarHeight + "px";

	//SCALE THE RIGHT PANEL
	var mapHeight = winH - notPanel;


	var mapDisclaimerWidth = $("#mapDisclaimer").width();
	var accordionWidth = $("#accordions").width();
	var toolbarWidth = $("#toolbar").width();
	var vbarWidth = $("#vbar").width();
	var mapContainerWidth = $("#mapContainer").width();
	var mapSpacingWidth = 12;
	var windowWidth = $("#topmenu").outerWidth({margin:true});
	var notMapWidth = accordionWidth + toolbarWidth + vbarWidth + mapSpacingWidth + 1;

	var newMapWidth = windowWidth - notMapWidth;
	var newMapContainerWidth = newMapWidth + mapSpacingWidth;

	var rightPanelTop = $("#topmenu").outerHeight({margin:true}) + $("#header").outerHeight({margin:true});
	var rightPanelLeft = accordionWidth + toolbarWidth + vbarWidth;
	$("#rightPanel").css("top",rightPanelTop);
	$("#rightPanel").css("left",rightPanelLeft);


	$("#map > div").width(newMapWidth);
	$("#mapDisclaimer").width(mapDisclaimerWidth);
	$("#mapContainer").width(newMapContainerWidth);
	$("#mapHeader").width(newMapContainerWidth);
	
	$("#resultsBox").width(newMapWidth-1);
	$("#resultsContainer").width(newMapContainerWidth);

	
	//var rightPanel = document.getElementById('rightPanel');
	//if(rightPanel <=0) rightPanel = jitkViewer_zeroSize;
	//rightPanel.style.height = panelHeight + "px";

	//INITIALIZE OVERVIEW MAP
	//var overviewMap = document.getElementById('overviewMap');
	//overviewMap.style.height = overviewMapHeight + "px";

	//ATTACH HOVER STATE & SWAP FUNCTION TO TOOLBAR IMAGES
	//THIS FUNCTION MAY BE DELETED IN FINAL DEPLOYMENT
	/*
	var x = document.getElementById('buttonset').childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeName == 'A'){
			a = x[i].firstChild.src;
			overimg = new Array();
			overimg = a.split('.');
			filename = overimg[0] + "U.jpg";
			x[i].firstChild.setAttribute("srcover", filename);
			x[i].firstChild.onmouseover = function(){
				this.setAttribute("oldsrc", this.src);
				this.src=this.getAttribute("srcover");
				this.blur();
			}
			x[i].firstChild.onmouseout = function(){
				this.src=this.getAttribute("oldsrc");
				this.blur();
			}
		}
	} 
	*/
	//END SWAP FUNCTION
	
	// IE6 only: reduce the width of #resultsBox by 1px to work-around scroll hack
	if ($.browser.msie) {
		$("#resultsBox").width($("#resultsBox").width() - 1);
	}

	/*
	//IE ONLY. SETS SOME ELEMENTS TO "UNSELECTABLE" THIS AVOIDS
	//OCCASIONAL "FLASHING" ARTIFACTS WHEN DRAGGING PANELS
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		var noSelect = new Array("toolbar","hControls","vbar","rightPanel","mapHeader","elevatorBox")
		for (i=0; i<noSelect.length; ++i) {
			$("#"+noSelect[i]).attr("unselectable", "on");
		}
	}
	*/
	
	jitkViewer_resizeCounter++;
	setTimeout('jitkViewer_throttleResize(' + jitkViewer_resizeCounter + ')', 750);
} //END SCALEBOXES

function jitkViewer_throttleResize(iLocalResizeCounter) {
  	if (iLocalResizeCounter == jitkViewer_resizeCounter) {
		jitkViewer_sizeMapToPage();
	}
  
  	return true;
}

function jitkViewer_sizeMapToPage() {
	//alert('jitkViewer_sizeMapToPage');
	var b = EsriUtils.getPageBounds();
   	var iWidth = b.width - leftItemsW + h_diffpos + jitkViewer_mapBorderWidth - 27;
   	
   	// The ADF Map control will break if the width is any less than 1
   	if (iWidth <= 0) {
   		iWidth = 1;
   	}
   	
	var sMapDivHeight = document.getElementById("map").style.height
	var iMapDivHeight = sMapDivHeight.substring(0, sMapDivHeight.indexOf("px"));
		
	// The ADF Map control will break if the height is any less than 1
	if (iMapDivHeight <= 0) {
		iMapDivHeight = 1;
	}
   	
   	jitkViewer_resizeMap(iWidth, iMapDivHeight);
}



//THESE FUNCTIONS CONTROL THE FADE FOR THE PAGE CONTENT
//changes the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

//adjust the timing of the fade
function blendDiv(divid, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 1;
	changeOpac(100, divid);
	var i = 100;
	while(i>0){
		setTimeout("changeOpac(" + i + ",'" + divid + "')",(timer * speed));
		timer++;
		i--;
	}
	setInterval( "hideFader('" + divid + "')", (timer * speed));
}

//hide the fader div when it's done
function hideFader(divid) {
 	document.getElementById(divid).style.display = "none";
}


function resizeAccordions(panelHeight) { 
	//RESIZE ACCORDION SETS
	var x = document.getElementById('accordions').childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeName == 'DIV'){		
			if(x[i].id != 'overviewMapContainerPanel'){
				//x[i].style.height = panelHeight + "px";
				y = x[i].childNodes
				//LOOP THROUGH MY ACCORDION PANELS - HOW MANY DO WE HAVE?
				var myPanels = 0;
				for(j = 0; j < y.length; j++){
					if(y[j].nodeName == 'DIV'){	
						myPanels = myPanels + 1;
					}
				}
			}
			//NOW RUN BACK THROUGH AND SET OUR HEIGHTS
			var inactiveaccordionHeight = myPanels*accordionHeight;
			lPanelHeight = panelHeight - inactiveaccordionHeight;
			if (lPanelHeight<=0) lPanelHeight = jitkViewer_zeroSize;
			for(j = 0; j < y.length; j++){
				if(y[j].nodeName == 'DIV'){	
					if(y[j].id != 'overviewMap'){
						//if(y[j].style.display == "block") {
							//smoothModify(y[j].id, 'height', y[j].style.height.slice(0, -2), lPanelHeight, 100);
						//} else {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -