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

📄 jitk_layout.js

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JS
📖 第 1 页 / 共 3 页
字号:
							y[j].style.height = lPanelHeight + "px";
						//}
					}
				}
				if(y[j].nodeName == 'H1'){
			   	    connectEvent(document.getElementById(y[j].id), "click", swapPanel);
				}
			}
		}
	}
}


//DISPLAYS ACTIVE PANEL HIGHLIGHTS ACTIVE H1
function swapPanel(p) {
   var currentP;
	if (!e) var e = window.event;
  if (e){
  if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ){
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	p = targ.id;
    }
   } 
	//HIDE ALL PANELS
	var ele = document.getElementById(p + "Panel");
 //if (ele!=null) { 
	var x = ele.parentNode.childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeName == 'DIV'){
			if(x[i].style.display == "block") {
				var lPanelHeight = x[i].style.height.slice(0,-2);
				currentP = x[i].id;
			}
		}
	}
 		
	//CLEAR ALL H1 ON CLASS REF	  
	var x = ele.parentNode.childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeName == 'H1'){		
			x[i].className = "off";
			connectEvent(document.getElementById(x[i].id), "click", swapPanel);
		}
	}
 //}
	
	//OPEN MY PANEL & CLOSE OPEN PANEL
	var myPanel = p + "Panel";
	smoothSwap(currentP, myPanel, 'height', lPanelHeight, 0, 50);

	//SET ON CLASS
	document.getElementById(p).className = "on";
	disconnectEvent(document.getElementById(p), "click", swapPanel);
	//REMOVE FOCUS
	document.getElementById(p).blur();
}


//DISPLAYS SELECTED ACCORDION SET
function swapAccordSet(p) {
	//HIDE ALL ACCORDION SETS
	var x = document.getElementById(p).parentNode.childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeName == 'DIV'){	
			if(x[i].id != 'overviewMapContainerPanel'){	
				x[i].style.display = "none";
			}
		}
	}
	//OPEN MY ACCORDION SET
	document.getElementById(p).style.display = "block";

	var x = document.getElementById(p).childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeName == 'DIV'){
			if(x[i].style.display == "block") {
				currentP = x[i].id;
			}
		}
	}
}

//DISPLAYS ACTIVE RESULTS & HIGHLIGHTS ACTIVE RESULTS TAB
function swapResults(p) {
	//HIDE ALL PANELS
	var x = document.getElementById('resultsBox').childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeType == 1){		
			x[i].style.display = "none";
		}
	}
	
	//CLEAR ALL TAB ON CLASS REF
	var x = document.getElementById('resultsTabs').childNodes;
	for(i = 0; i < x.length; i++){
		if(x[i].nodeType == 1){		
			x[i].className = "none";
		}
	}
	
	//OPEN MY PANEL
	document.getElementById(p + "Results").style.display = "block";
	//SET ON CLASS
	document.getElementById(p).className = "on";
	//REMOVE FOCUS
	document.getElementById(p).blur();
}

//BUILD A FUNCTION FOR AN ELEMENT USING ITS ATTRIBUTES
function actionBuilder(e) {
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	thisId = targ.id;
	theseArgs = "";
	thisElement = document.getElementById(thisId);
	thisFunction = thisElement.getAttribute("function");
	theseArgs = thisElement.getAttribute("arguments");
	
	eval(thisFunction +'("' + theseArgs +'")');
}



//PUSH OUT AN ARRAY OF ELEMENTS THAT MATCH THIS ATTR/VAL PAIR
function getElementIdByAttributeValue(a, v) {
    var ar = new Array();
    var ac = document.getElementsByTagName('*');
    for (i=0; i<ac.length; i++){
		if (ac[i].getAttribute(a) == v){
			ar.push(ac[i].id);
		}
	}
    return ar;
}



//SMOOTHLY CHANGES CSS VALUES
function smoothModify(id, prop, from, to, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 1;
	if (useAnimation == "true") {
		if(from > to){
			while(from >= to){
				delta = from - to;
				step = delta % 10;
				if (step == 0){
					setTimeout("doModify('"+id+"','"+prop+"',"+from+")",(timer * speed));
				}
				timer++;
				from--;
			}
		}
		if(to > from){
			while(to >= from){
				delta = to - from;
				step = delta % 10;
				if (step == 0){
					setTimeout("doModify('"+id+"','"+prop+"',"+from+")",(timer * speed));
				}
				timer++;
				from++;
			}
		}
	} else {
		doModify(id,prop,to);
	}
}

//SMOOTHLY SWAPS CSS VALUES OF 2 ELEMENTS
function smoothSwap(id1, id2, prop, id1val, id2val, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 1;
	startID2 = id2val;
	if (useAnimation == "true") {
		while(id1val >= startID2){
			delta = id1val - startID2;
			step = delta % 10;
			if (step == 0){
				setTimeout("doModify('"+id1+"','"+prop+"',"+id1val+")",(timer * speed));
				setTimeout("doModify('"+id2+"','"+prop+"',"+id2val+")",(timer * speed));
			}
			timer++;
			id2val++;
			id1val--;
		}
	} else {
		doModify(id1,prop,id2val);
		doModify(id2,prop,id1val);
	}
}

//USED BY SMOOTHMODIFY 7 SMOOTHSWAP FUNCTIONS TO CHANGE CSS VALUES BY ONE STEPPING 
function doModify(id, prop, to) {
	if(to == 0){
		document.getElementById(id).style.display = "none";
	} else {
		document.getElementById(id).style.display = "block";
	}
	if(prop == "opacity"){
		document.getElementById(id).style.opacity = (to / 100);
		document.getElementById(id).style.MozOpacity = (to / 100);
		document.getElementById(id).style.KhtmlOpacity = (to / 100);
		document.getElementById(id).style.filter = "alpha(opacity=" + to + ")";
	} else {
		document.getElementById(id).style[prop] =  to + "px";
	}
}

//DROP-DOWN MENU IE6 SUPPORT
//This code fixes the hover state of the drop-down menu in IE. IE6 only recognizes the :hover psudoclass for A tags so a class assignment is swapped on the LI tag to replicate hover functionality.
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			if (taskWindowManager.windows[taskWindowManager.windowIds[0]] != null) {
				var win = taskWindowManager.windows[taskWindowManager.windowIds[0]];
				$("#nav").css("z-index",win.jitkGetGlobalZIndex()+1);			
	  		}
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}


if (window.attachEvent) { 
	window.attachEvent("onload", sfHover);
}
//END DROP-DOWN MENU IE6 SUPPORT


/**
 * show task window loading indicator (needs to find the window object first)
 */
function JitkShowLoading(el, taskId) {
	var win = JitkGetTaskWindowId(taskId);
	if (win != null) {
		win.submit(el);
	}
}

/**
 * set the selected tab of a task window 
 * !!! only use this function when a different task than the currently active one is needed !!!
 * the actual assignment happens automatically through the JitkShowLoading function upon submitting the task to the server
 */
function JitkSetSelectedTab(taskId, selectedTab) {
	var win = JitkGetTaskWindowId(taskId);
	if (win != null) {
		win.setSelectedTab(selectedTab);
	}
}

/**
 * show/hide task window message (needs to find the window object first)
 */
function JitkShowMessage(taskId, type, text) {
	var win = JitkGetTaskWindowId(taskId);
	if (win != null) {
		win.showMessage(type, text);
	}
}
function JitkHideMessage(taskId) {
	var win = JitkGetTaskWindowId(taskId);
	if (win != null) {
		win.hideMessage();
	}
}

/**
 * show/hide loading indicator (without submitting the form)
 */
function JitkShowLoadingIndicator(taskId) {
	var win = JitkGetTaskWindowId(taskId);
	if (win != null) {
		win.showLoading();
	}
}
function JitkHideLoadingIndicator(taskId) {
	var win = JitkGetTaskWindowId(taskId);
	if (win != null) {
		win.hideLoading();
	}
	$("#"+taskId+" img").ifixpng();
}

/**
 * adjust the task window size manually
 */
function JitkAdjustWindowSize(taskId) {
	var win = JitkGetTaskWindowId(taskId);
	if (win != null) {
		win.fit();
	}
}

/**
 * find the task window object of a given task cell id 
 */
function JitkGetTaskWindowId(taskId) {
	if (taskWindowManager) {
		var win;
		win = taskWindowManager.windows["win_EsriTaskCell_"+taskId];
		if (win != null) {
			return win;
		} else {
			win = taskWindowManager.windows["win_"+taskId];
			if (win != null) {
				return win;
			} else {
				win = taskWindowManager.windows[taskId];
				if (win != null) {
					return win;
				}
			}
		}
	}
	return null;
}

function jitkDisableButton(buttonId) {
	$("#"+buttonId).fadeTo(1, 0.5);
}
function jitkEnableButton(buttonId) {
	$("#"+buttonId).fadeTo(1, 1);
}

/* FIX IE6 dragging issue */
// introduce global variables that save the current state of the floating window
var jitkSavedTarget = null;
var jitkDragOK = false;
var jitkDragXoffset = 0;
var jitkDragYoffset = 0; 

// on mouse move handler
function JitkMoveHandler(e) {
	if (e == null) { e = window.event } 
	if (e.button <= 1 && jitkDragOK){
		jitkSavedTarget.style.left = e.clientX - jitkDragXoffset + 'px';
		jitkSavedTarget.style.top = e.clientY - jitkDragYoffset + 'px';
		return false;
	}
}

// on mouse up handler
function JitkDragCleanup(e) {
	document.onmousemove = null;
	document.onmouseup = null;
	jitkDragOK = false;
}

// prototype the mouseInteraction member function of jitk_jquery_ui_mouse.js with IE6 specific code
(function($) {
	$.extend($.ui.mouseInteraction.prototype, {
		
		destroy: function() { $(this.element).unbind('mousedown.draggable'); },
		trigger: function() { return this.click.apply(this, arguments); },
		click: function(e) {
			
			if(
				   e.which != 1 //only left click starts dragging
				|| $.inArray(e.target.nodeName.toLowerCase(), this.options.dragPrevention) != -1 // Prevent execution on defined elements
				|| (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition
			) return true;
			
			var self = this;
			var initialize = function() {
				self._MP = { left: e.pageX, top: e.pageY }; // Store the click mouse position
				if ((jQuery.browser.msie) && (parseInt(jQuery.browser.version,10) == 6)) {
					if (self.element.className.indexOf("ui-draggable") != -1) {
						jitkSavedTarget = self.element;       
						jitkDragOK = true;
						jitkDragXoffset = e.clientX-parseInt(self.element.style.left);
						jitkDragYoffset = e.clientY-parseInt(self.element.style.top);
						document.onmousemove = JitkMoveHandler;
						document.onmouseup = JitkDragCleanup;
						return false;
					}
				} else {
					$(document).bind('mouseup.draggable', function() { return self.stop.apply(self, arguments); }).bind('mousemove.draggable', function() { return self.drag.apply(self, arguments); });
				}
			};

			if(this.options.delay) {
				if(this.timer) clearInterval(this.timer);
				this.timer = setTimeout(initialize, this.options.delay);
			} else {
				initialize();
			}
			
			return false;
			
		},
		stop: function(e) {
			var o = this.options;
			if(!this.initialized) return $(document).unbind('mouseup.draggable').unbind('mousemove.draggable');

			if(this.options.stop) this.options.stop.call(this.options.executor || this, e, this.element);
			$(document).unbind('mouseup.draggable').unbind('mousemove.draggable');
			this.initialized = false;
			return false;
		},
		drag: function(e) {
			var o = this.options;
			if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check
			
			if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) {
				if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element);
				this.initialized = true;
			} else {
				if(!this.initialized) return false;
			}

			if(o.drag) o.drag.call(this.options.executor || this, e, this.element);
			return false;
			
		}
	});
})(jQuery);

⌨️ 快捷键说明

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