Compressed jquery plugins using Google Closure Compiler.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8655 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		
							
								
								
									
										117
									
								
								xCAT-UI/js/jquery/hoverIntent.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										117
									
								
								xCAT-UI/js/jquery/hoverIntent.js
									
									
									
									
										vendored
									
									
								
							| @@ -1,117 +0,0 @@ | ||||
| (function($) { | ||||
| 	/* hoverIntent by Brian Cherne */ | ||||
| 	$.fn.hoverIntent = function(f, g) { | ||||
| 		// default configuration options | ||||
| 		var cfg = { | ||||
| 			sensitivity : 7, | ||||
| 			interval : 100, | ||||
| 			timeout : 0 | ||||
| 		}; | ||||
| 		// override configuration options with user supplied object | ||||
| 		cfg = $.extend(cfg, g ? { | ||||
| 			over : f, | ||||
| 			out : g | ||||
| 		} : f); | ||||
|  | ||||
| 		// instantiate variables | ||||
| 		// cX, cY = current X and Y position of mouse, updated by mousemove | ||||
| 		// event | ||||
| 		// pX, pY = previous X and Y position of mouse, set by mouseover and | ||||
| 		// polling interval | ||||
| 		var cX, cY, pX, pY; | ||||
|  | ||||
| 		// A private function for getting mouse position | ||||
| 		var track = function(ev) { | ||||
| 			cX = ev.pageX; | ||||
| 			cY = ev.pageY; | ||||
| 		}; | ||||
|  | ||||
| 		// A private function for comparing current and previous mouse position | ||||
| 		var compare = function(ev, ob) { | ||||
| 			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); | ||||
| 			// compare mouse positions to see if they've crossed the threshold | ||||
| 			if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { | ||||
| 				$(ob).unbind("mousemove", track); | ||||
| 				// set hoverIntent state to true (so mouseOut can be called) | ||||
| 				ob.hoverIntent_s = 1; | ||||
| 				return cfg.over.apply(ob, [ ev ]); | ||||
| 			} else { | ||||
| 				// set previous coordinates for next time | ||||
| 				pX = cX; | ||||
| 				pY = cY; | ||||
| 				// use self-calling timeout, guarantees intervals are spaced out | ||||
| 				// properly (avoids JavaScript timer bugs) | ||||
| 				ob.hoverIntent_t = setTimeout(function() { | ||||
| 					compare(ev, ob); | ||||
| 				}, cfg.interval); | ||||
| 			} | ||||
| 		}; | ||||
|  | ||||
| 		// A private function for delaying the mouseOut function | ||||
| 		var delay = function(ev, ob) { | ||||
| 			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); | ||||
| 			ob.hoverIntent_s = 0; | ||||
| 			return cfg.out.apply(ob, [ ev ]); | ||||
| 		}; | ||||
|  | ||||
| 		// A private function for handling mouse 'hovering' | ||||
| 		var handleHover = function(e) { | ||||
| 			// next three lines copied from jQuery.hover, ignore children | ||||
| 			// onMouseOver/onMouseOut | ||||
| 			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) | ||||
| 				|| e.relatedTarget; | ||||
| 			while (p && p != this) { | ||||
| 				try { | ||||
| 					p = p.parentNode; | ||||
| 				} catch (e) { | ||||
| 					p = this; | ||||
| 				} | ||||
| 			} | ||||
| 			if (p == this) { | ||||
| 				return false; | ||||
| 			} | ||||
|  | ||||
| 			// copy objects to be passed into t (required for event object to be | ||||
| 			// passed in IE) | ||||
| 			var ev = jQuery.extend( {}, e); | ||||
| 			var ob = this; | ||||
|  | ||||
| 			// cancel hoverIntent timer if it exists | ||||
| 			if (ob.hoverIntent_t) { | ||||
| 				ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); | ||||
| 			} | ||||
|  | ||||
| 			// else e.type == "onmouseover" | ||||
| 			if (e.type == "mouseover") { | ||||
| 				// set "previous" X and Y position based on initial entry point | ||||
| 				pX = ev.pageX; | ||||
| 				pY = ev.pageY; | ||||
| 				// update "current" X and Y position based on mousemove | ||||
| 				$(ob).bind("mousemove", track); | ||||
| 				// start polling interval (self-calling timeout) to compare | ||||
| 				// mouse coordinates over time | ||||
| 				if (ob.hoverIntent_s != 1) { | ||||
| 					ob.hoverIntent_t = setTimeout(function() { | ||||
| 						compare(ev, ob); | ||||
| 					}, cfg.interval); | ||||
| 				} | ||||
|  | ||||
| 				// else e.type == "onmouseout" | ||||
| 			} else { | ||||
| 				// unbind expensive mousemove event | ||||
| 				$(ob).unbind("mousemove", track); | ||||
| 				// if hoverIntent state is true, then call the mouseOut function | ||||
| 				// after the specified delay | ||||
| 				if (ob.hoverIntent_s == 1) { | ||||
| 					ob.hoverIntent_t = setTimeout(function() { | ||||
| 						delay(ev, ob); | ||||
| 					}, cfg.timeout); | ||||
| 				} | ||||
| 			} | ||||
| 		}; | ||||
|  | ||||
| 		// bind the function to the two event listeners | ||||
| 		return this.mouseover(handleHover).mouseout(handleHover); | ||||
| 	}; | ||||
|  | ||||
| })(jQuery); | ||||
							
								
								
									
										3
									
								
								xCAT-UI/js/jquery/hoverIntent.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								xCAT-UI/js/jquery/hoverIntent.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| (function(e){e.fn.hoverIntent=function(l,m){var d={sensitivity:7,interval:100,timeout:0};d=e.extend(d,m?{over:l,out:m}:l);var g,h,i,j,k=function(c){g=c.pageX;h=c.pageY},n=function(c,a){a.hoverIntent_t=clearTimeout(a.hoverIntent_t);if(Math.abs(i-g)+Math.abs(j-h)<d.sensitivity){e(a).unbind("mousemove",k);a.hoverIntent_s=1;return d.over.apply(a,[c])}else{i=g;j=h;a.hoverIntent_t=setTimeout(function(){n(c,a)},d.interval)}},o=function(c){for(var a=(c.type=="mouseover"?c.fromElement:c.toElement)||c.relatedTarget;a&& | ||||
| a!=this;)try{a=a.parentNode}catch(p){a=this}if(a==this)return false;var f=jQuery.extend({},c),b=this;if(b.hoverIntent_t)b.hoverIntent_t=clearTimeout(b.hoverIntent_t);if(c.type=="mouseover"){i=f.pageX;j=f.pageY;e(b).bind("mousemove",k);if(b.hoverIntent_s!=1)b.hoverIntent_t=setTimeout(function(){n(f,b)},d.interval)}else{e(b).unbind("mousemove",k);if(b.hoverIntent_s==1)b.hoverIntent_t=setTimeout(function(){b.hoverIntent_t=clearTimeout(b.hoverIntent_t);b.hoverIntent_s=0;d.out.apply(b,[f])},d.timeout)}}; | ||||
| return this.mouseover(o).mouseout(o)}})(jQuery); | ||||
| @@ -1,370 +0,0 @@ | ||||
| /** | ||||
|  * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) | ||||
|  *  | ||||
|  * Dual licensed under the MIT and GPL licenses.  | ||||
|  * This basically means you can use this code however you want for | ||||
|  * free, but don't claim to have written it yourself! | ||||
|  * Donations always accepted: http://www.JavascriptToolbox.com/donate/ | ||||
|  *  | ||||
|  * Please do not link to the .js files on javascripttoolbox.com from | ||||
|  * your site. Copy the files locally to your server instead. | ||||
|  *  | ||||
|  */ | ||||
| /** | ||||
|  * jquery.contextmenu.js jQuery Plugin for Context Menus http://www.JavascriptToolbox.com/lib/contextmenu/ | ||||
|  *  | ||||
|  * Copyright (c) 2008 Matt Kruse (javascripttoolbox.com) Dual licensed under the MIT and GPL licenses. | ||||
|  *  | ||||
|  * @version 1.1 | ||||
|  * @history 1.1 2010-01-25 Fixed a problem with 1.4 which caused undesired show/hide animations | ||||
|  * @history 1.0 2008-10-20 Initial Release | ||||
|  * @todo slideUp doesn't work in IE - because of iframe? | ||||
|  * @todo Hide all other menus when contextmenu is shown? | ||||
|  * @todo More themes | ||||
|  * @todo Nested context menus | ||||
|  */ | ||||
| ; | ||||
| (function($) { | ||||
| 	$.contextMenu = { | ||||
| 		shadow : true, | ||||
| 		shadowOffset : 0, | ||||
| 		shadowOffsetX : 5, | ||||
| 		shadowOffsetY : 5, | ||||
| 		shadowWidthAdjust : -3, | ||||
| 		shadowHeightAdjust : -3, | ||||
| 		shadowOpacity : .2, | ||||
| 		shadowClass : 'context-menu-shadow', | ||||
| 		shadowColor : 'black', | ||||
|  | ||||
| 		offsetX : 0, | ||||
| 		offsetY : 0, | ||||
| 		appendTo : 'body', | ||||
| 		direction : 'down', | ||||
| 		constrainToScreen : true, | ||||
|  | ||||
| 		showTransition : 'show', | ||||
| 		hideTransition : 'hide', | ||||
| 		showSpeed : null, | ||||
| 		hideSpeed : null, | ||||
| 		showCallback : null, | ||||
| 		hideCallback : null, | ||||
|  | ||||
| 		className : 'context-menu', | ||||
| 		itemClassName : 'context-menu-item', | ||||
| 		itemHoverClassName : 'context-menu-item-hover', | ||||
| 		disabledItemClassName : 'context-menu-item-disabled', | ||||
| 		disabledItemHoverClassName : 'context-menu-item-disabled-hover', | ||||
| 		separatorClassName : 'context-menu-separator', | ||||
| 		innerDivClassName : 'context-menu-item-inner', | ||||
| 		themePrefix : 'context-menu-theme-', | ||||
| 		theme : 'default', | ||||
|  | ||||
| 		separator : 'context-menu-separator', // A specific key to identify a separator | ||||
| 		target : null, // The target of the context click, to be populated when triggered | ||||
| 		menu : null, // The jQuery object containing the HTML object that is the menu itself | ||||
| 		shadowObj : null, // Shadow object | ||||
| 		bgiframe : null, // The iframe object for IE6 | ||||
| 		shown : false, // Currently being shown? | ||||
| 		useIframe : /* @cc_on @ *//* @if (@_win32) true, @else @ */false,/* @end @ */// This is a better check than | ||||
| 		// looking | ||||
| 		// at userAgent! | ||||
|  | ||||
| 		// Create the menu instance | ||||
| 		create : function(menu, opts) { | ||||
| 			var cmenu = $.extend( {}, this, opts); // Clone all default | ||||
| 			// properties to created | ||||
| 			// object | ||||
|  | ||||
| 			// If a selector has been passed in, then use that as the menu | ||||
| 			if (typeof menu == "string") { | ||||
| 				cmenu.menu = $(menu); | ||||
| 			} | ||||
| 			// If a function has been passed in, call it each time the menu is shown to create the menu | ||||
| 			else if (typeof menu == "function") { | ||||
| 				cmenu.menuFunction = menu; | ||||
| 			} | ||||
| 			// Otherwise parse the Array passed in | ||||
| 			else { | ||||
| 				cmenu.menu = cmenu.createMenu(menu, cmenu); | ||||
| 			} | ||||
| 			if (cmenu.menu) { | ||||
| 				cmenu.menu.css( { | ||||
| 					display : 'none' | ||||
| 				}); | ||||
| 				$(cmenu.appendTo).append(cmenu.menu); | ||||
| 			} | ||||
|  | ||||
| 			// Create the shadow object if shadow is enabled | ||||
| 			if (cmenu.shadow) { | ||||
| 				cmenu.createShadow(cmenu); // Extracted to method for | ||||
| 				// extensibility | ||||
| 				if (cmenu.shadowOffset) { | ||||
| 					cmenu.shadowOffsetX = cmenu.shadowOffsetY = cmenu.shadowOffset; | ||||
| 				} | ||||
| 			} | ||||
| 			$('body').bind('contextmenu', function() { | ||||
| 				cmenu.hide(); | ||||
| 			}); // If right-clicked somewhere else in the document, hide this | ||||
| 			// menu | ||||
| 			return cmenu; | ||||
| 		}, | ||||
|  | ||||
| 		// Create an iframe object to go behind the menu | ||||
| 		createIframe : function() { | ||||
| 			return $('<iframe frameborder="0" tabindex="-1" src="javascript:false" style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=0);"/>'); | ||||
| 		}, | ||||
|  | ||||
| 		// Accept an Array representing a menu structure and turn it into HTML | ||||
| 		createMenu : function(menu, cmenu) { | ||||
| 			var className = cmenu.className; | ||||
| 			$.each(cmenu.theme.split(","), function(i, n) { | ||||
| 				className += ' ' + cmenu.themePrefix + n | ||||
| 			}); | ||||
| 			var $t = $('<table cellspacing=0 cellpadding=0></table>') | ||||
| 				.click(function() { | ||||
| 					cmenu.hide(); | ||||
| 					return false; | ||||
| 				}); // We wrap a table around it so width can be flexible | ||||
| 			var $tr = $('<tr></tr>'); | ||||
| 			var $td = $('<td></td>'); | ||||
| 			var $div = $('<div class="' + className + '"></div>'); | ||||
|  | ||||
| 			// Each menu item is specified as either: | ||||
| 			// title:function | ||||
| 			// or title: { property:value ... } | ||||
| 			for ( var i = 0; i < menu.length; i++) { | ||||
| 				var m = menu[i]; | ||||
| 				if (m == $.contextMenu.separator) { | ||||
| 					$div.append(cmenu.createSeparator()); | ||||
| 				} else { | ||||
| 					for ( var opt in menu[i]) { | ||||
| 						$div.append(cmenu.createMenuItem(opt, menu[i][opt])); // Extracted | ||||
| 						// to | ||||
| 						// method | ||||
| 						// for | ||||
| 						// extensibility | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			if (cmenu.useIframe) { | ||||
| 				$td.append(cmenu.createIframe()); | ||||
| 			} | ||||
| 			$t.append($tr.append($td.append($div))) | ||||
| 			return $t; | ||||
| 		}, | ||||
|  | ||||
| 		// Create an individual menu item | ||||
| 		createMenuItem : function(label, obj) { | ||||
| 			var cmenu = this; | ||||
| 			if (typeof obj == "function") { | ||||
| 				obj = { | ||||
| 					onclick : obj | ||||
| 				}; | ||||
| 			} // If passed a simple function, turn it into a property of an object | ||||
| 			// Default properties, extended in case properties are passed | ||||
| 			var o = $.extend( { | ||||
| 				onclick : function() { | ||||
| 				}, | ||||
| 				className : '', | ||||
| 				hoverClassName : cmenu.itemHoverClassName, | ||||
| 				icon : '', | ||||
| 				disabled : false, | ||||
| 				title : '', | ||||
| 				hoverItem : cmenu.hoverItem, | ||||
| 				hoverItemOut : cmenu.hoverItemOut | ||||
| 			}, obj); | ||||
| 			// If an icon is specified, hard-code the background-image style. | ||||
| 			// Themes that don't show images should take this into account in | ||||
| 			// their CSS | ||||
| 			var iconStyle = (o.icon) ? 'background-image:url(' + o.icon + ');' : ''; | ||||
| 			var $div = $('<div class="' + cmenu.itemClassName + ' ' + | ||||
| 				o.className + | ||||
| 				((o.disabled) ? ' ' + cmenu.disabledItemClassName : '') + | ||||
| 				'" title="' + o.title + '"></div>') | ||||
| 				// If the item is disabled, don't do anything when it is clicked | ||||
| 				.click(function(e) { | ||||
| 					if (cmenu.isItemDisabled(this)) { | ||||
| 						return false; | ||||
| 					} else { | ||||
| 						return o.onclick.call(cmenu.target, this, cmenu, e) | ||||
| 					} | ||||
| 				}) | ||||
| 				// Change the class of the item when hovered over | ||||
| 				.hover(function() { | ||||
| 					o.hoverItem | ||||
| 						.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName); | ||||
| 				}, function() { | ||||
| 					o.hoverItemOut | ||||
| 						.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName); | ||||
| 				}); | ||||
| 			var $idiv = $('<div class="' + cmenu.innerDivClassName + | ||||
| 				'" style="' + iconStyle + '">' + label + '</div>'); | ||||
| 			$div.append($idiv); | ||||
| 			return $div; | ||||
| 		}, | ||||
|  | ||||
| 		// Create a separator row | ||||
| 		createSeparator : function() { | ||||
| 			return $('<div class="' + this.separatorClassName + '"></div>'); | ||||
| 		}, | ||||
|  | ||||
| 		// Determine if an individual item is currently disabled. This is called each time the item is hovered or | ||||
| 		// clicked because the disabled status may change at any time | ||||
| 		isItemDisabled : function(item) { | ||||
| 			return $(item).is('.' + this.disabledItemClassName); | ||||
| 		}, | ||||
|  | ||||
| 		// Functions to fire on hover. Extracted to methods for extensibility | ||||
| 		hoverItem : function(c) { | ||||
| 			$(this).addClass(c); | ||||
| 		}, | ||||
| 		hoverItemOut : function(c) { | ||||
| 			$(this).removeClass(c); | ||||
| 		}, | ||||
|  | ||||
| 		// Create the shadow object | ||||
| 		createShadow : function(cmenu) { | ||||
| 			cmenu.shadowObj = $('<div class="' + cmenu.shadowClass + '"></div>') | ||||
| 				.css( { | ||||
| 					display : 'none', | ||||
| 					position : "absolute", | ||||
| 					zIndex : 9998, | ||||
| 					opacity : cmenu.shadowOpacity, | ||||
| 					backgroundColor : cmenu.shadowColor | ||||
| 				}); | ||||
| 			$(cmenu.appendTo).append(cmenu.shadowObj); | ||||
| 		}, | ||||
|  | ||||
| 		// Display the shadow object, given the position of the menu itself | ||||
| 		showShadow : function(x, y, e) { | ||||
| 			var cmenu = this; | ||||
| 			if (cmenu.shadow) { | ||||
| 				cmenu.shadowObj.css( { | ||||
| 					width : (cmenu.menu.width() + cmenu.shadowWidthAdjust) + | ||||
| 						"px", | ||||
| 					height : (cmenu.menu.height() + cmenu.shadowHeightAdjust) + | ||||
| 						"px", | ||||
| 					top : (y + cmenu.shadowOffsetY) + "px", | ||||
| 					left : (x + cmenu.shadowOffsetX) + "px" | ||||
| 				}).addClass(cmenu.shadowClass)[cmenu.showTransition] | ||||
| 					(cmenu.showSpeed); | ||||
| 			} | ||||
| 		}, | ||||
|  | ||||
| 		// A hook to call before the menu is shown, in case special processing needs to be done. | ||||
| 		// Return false to cancel the default show operation | ||||
| 		beforeShow : function() { | ||||
| 			return true; | ||||
| 		}, | ||||
|  | ||||
| 		// Show the context menu | ||||
| 		show : function(t, e) { | ||||
| 			var cmenu = this, x = e.pageX, y = e.pageY; | ||||
| 			cmenu.target = t; // Preserve the object that triggered this | ||||
| 			// context menu so menu item click methods can | ||||
| 			// see it | ||||
| 			if (cmenu.beforeShow() !== false) { | ||||
| 				// If the menu content is a function, call it to populate the menu each time it is displayed | ||||
| 				if (cmenu.menuFunction) { | ||||
| 					if (cmenu.menu) { | ||||
| 						$(cmenu.menu).remove(); | ||||
| 					} | ||||
| 					cmenu.menu = cmenu | ||||
| 						.createMenu(cmenu.menuFunction(cmenu, t), cmenu); | ||||
| 					cmenu.menu.css( { | ||||
| 						display : 'none' | ||||
| 					}); | ||||
| 					$(cmenu.appendTo).append(cmenu.menu); | ||||
| 				} | ||||
| 				var $c = cmenu.menu; | ||||
| 				x += cmenu.offsetX; | ||||
| 				y += cmenu.offsetY; | ||||
| 				var pos = cmenu.getPosition(x, y, cmenu, e); // Extracted to | ||||
| 				// method for | ||||
| 				// extensibility | ||||
| 				cmenu.showShadow(pos.x, pos.y, e); | ||||
| 				// Resize the iframe if needed | ||||
| 				if (cmenu.useIframe) { | ||||
| 					$c.find('iframe').css( { | ||||
| 						width : $c.width() + cmenu.shadowOffsetX + | ||||
| 							cmenu.shadowWidthAdjust, | ||||
| 						height : $c.height() + cmenu.shadowOffsetY + | ||||
| 							cmenu.shadowHeightAdjust | ||||
| 					}); | ||||
| 				} | ||||
| 				$c.css( { | ||||
| 					top : pos.y + "px", | ||||
| 					left : pos.x + "px", | ||||
| 					position : "absolute", | ||||
| 					zIndex : 9999 | ||||
| 				})[cmenu.showTransition] | ||||
| 					(cmenu.showSpeed, ((cmenu.showCallback) ? function() { | ||||
| 						cmenu.showCallback.call(cmenu); | ||||
| 					} : null)); | ||||
| 				cmenu.shown = true; | ||||
| 				$(document).one('click', null, function() { | ||||
| 					cmenu.hide() | ||||
| 				}); // Handle a single click to the document to hide the menu | ||||
| 			} | ||||
| 		}, | ||||
|  | ||||
| 		// Find the position where the menu should appear, given an x,y of the click event | ||||
| 		getPosition : function(clickX, clickY, cmenu, e) { | ||||
| 			var x = clickX + cmenu.offsetX; | ||||
| 			var y = clickY + cmenu.offsetY | ||||
| 			var h = $(cmenu.menu).height(); | ||||
| 			var w = $(cmenu.menu).width(); | ||||
| 			var dir = cmenu.direction; | ||||
| 			if (cmenu.constrainToScreen) { | ||||
| 				var $w = $(window); | ||||
| 				var wh = $w.height(); | ||||
| 				var ww = $w.width(); | ||||
| 				if (dir == "down" && (y + h - $w.scrollTop() > wh)) { | ||||
| 					dir = "up"; | ||||
| 				} | ||||
| 				var maxRight = x + w - $w.scrollLeft(); | ||||
| 				if (maxRight > ww) { | ||||
| 					x -= (maxRight - ww); | ||||
| 				} | ||||
| 			} | ||||
| 			if (dir == "up") { | ||||
| 				y -= h; | ||||
| 			} | ||||
| 			return { | ||||
| 				'x' : x, 'y' : y | ||||
| 			}; | ||||
| 		}, | ||||
|  | ||||
| 		// Hide the menu, of course | ||||
| 		hide : function() { | ||||
| 			var cmenu = this; | ||||
| 			if (cmenu.shown) { | ||||
| 				if (cmenu.iframe) { | ||||
| 					$(cmenu.iframe).hide(); | ||||
| 				} | ||||
| 				if (cmenu.menu) { | ||||
| 					cmenu.menu[cmenu.hideTransition] | ||||
| 						(cmenu.hideSpeed, ((cmenu.hideCallback) ? function() { | ||||
| 							cmenu.hideCallback.call(cmenu); | ||||
| 						} : null)); | ||||
| 				} | ||||
| 				if (cmenu.shadow) { | ||||
| 					cmenu.shadowObj[cmenu.hideTransition](cmenu.hideSpeed); | ||||
| 				} | ||||
| 			} | ||||
| 			cmenu.shown = false; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	// This actually adds the .contextMenu() function to the jQuery namespace | ||||
| 	$.fn.contextMenu = function(menu, options) { | ||||
| 		var cmenu = $.contextMenu.create(menu, options); | ||||
| 		return this.each(function() { | ||||
| 			// Show menu on left click | ||||
| 			$(this).bind('click', function(e) { | ||||
| 				cmenu.show(this, e); | ||||
| 				return false; | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
| })(jQuery); | ||||
							
								
								
									
										22
									
								
								xCAT-UI/js/jquery/jquery.contextmenu.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								xCAT-UI/js/jquery/jquery.contextmenu.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| /* | ||||
|  Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) | ||||
|  | ||||
|  Dual licensed under the MIT and GPL licenses.  | ||||
|  This basically means you can use this code however you want for | ||||
|  free, but don't claim to have written it yourself! | ||||
|  Donations always accepted: http://www.JavascriptToolbox.com/donate/ | ||||
|  | ||||
|  Please do not link to the .js files on javascripttoolbox.com from | ||||
|  your site. Copy the files locally to your server instead. | ||||
|  | ||||
| */ | ||||
| (function(c){c.contextMenu={shadow:true,shadowOffset:0,shadowOffsetX:5,shadowOffsetY:5,shadowWidthAdjust:-3,shadowHeightAdjust:-3,shadowOpacity:0.2,shadowClass:"context-menu-shadow",shadowColor:"black",offsetX:0,offsetY:0,appendTo:"body",direction:"down",constrainToScreen:true,showTransition:"show",hideTransition:"hide",showSpeed:null,hideSpeed:null,showCallback:null,hideCallback:null,className:"context-menu",itemClassName:"context-menu-item",itemHoverClassName:"context-menu-item-hover",disabledItemClassName:"context-menu-item-disabled", | ||||
| disabledItemHoverClassName:"context-menu-item-disabled-hover",separatorClassName:"context-menu-separator",innerDivClassName:"context-menu-item-inner",themePrefix:"context-menu-theme-",theme:"default",separator:"context-menu-separator",target:null,menu:null,shadowObj:null,bgiframe:null,shown:false,useIframe:false,create:function(b,d){var a=c.extend({},this,d);if(typeof b=="string")a.menu=c(b);else if(typeof b=="function")a.menuFunction=b;else a.menu=a.createMenu(b,a);if(a.menu){a.menu.css({display:"none"}); | ||||
| c(a.appendTo).append(a.menu)}if(a.shadow){a.createShadow(a);if(a.shadowOffset)a.shadowOffsetX=a.shadowOffsetY=a.shadowOffset}c("body").bind("contextmenu",function(){a.hide()});return a},createIframe:function(){return c('<iframe frameborder="0" tabindex="-1" src="javascript:false" style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=0);"/>')},createMenu:function(b,d){var a=d.className;c.each(d.theme.split(","),function(l,k){a+=" "+d.themePrefix+k});for(var e=c("<table cellspacing=0 cellpadding=0></table>").click(function(){d.hide(); | ||||
| return false}),g=c("<tr></tr>"),f=c("<td></td>"),h=c('<div class="'+a+'"></div>'),i=0;i<b.length;i++)if(b[i]==c.contextMenu.separator)h.append(d.createSeparator());else for(var j in b[i])h.append(d.createMenuItem(j,b[i][j]));d.useIframe&&f.append(d.createIframe());e.append(g.append(f.append(h)));return e},createMenuItem:function(b,d){var a=this;if(typeof d=="function")d={onclick:d};var e=c.extend({onclick:function(){},className:"",hoverClassName:a.itemHoverClassName,icon:"",disabled:false,title:"", | ||||
| hoverItem:a.hoverItem,hoverItemOut:a.hoverItemOut},d),g=e.icon?"background-image:url("+e.icon+");":"",f=c('<div class="'+a.itemClassName+" "+e.className+(e.disabled?" "+a.disabledItemClassName:"")+'" title="'+e.title+'"></div>').click(function(h){return a.isItemDisabled(this)?false:e.onclick.call(a.target,this,a,h)}).hover(function(){e.hoverItem.call(this,a.isItemDisabled(this)?a.disabledItemHoverClassName:e.hoverClassName)},function(){e.hoverItemOut.call(this,a.isItemDisabled(this)?a.disabledItemHoverClassName: | ||||
| e.hoverClassName)});g=c('<div class="'+a.innerDivClassName+'" style="'+g+'">'+b+"</div>");f.append(g);return f},createSeparator:function(){return c('<div class="'+this.separatorClassName+'"></div>')},isItemDisabled:function(b){return c(b).is("."+this.disabledItemClassName)},hoverItem:function(b){c(this).addClass(b)},hoverItemOut:function(b){c(this).removeClass(b)},createShadow:function(b){b.shadowObj=c('<div class="'+b.shadowClass+'"></div>').css({display:"none",position:"absolute",zIndex:9998,opacity:b.shadowOpacity, | ||||
| backgroundColor:b.shadowColor});c(b.appendTo).append(b.shadowObj)},showShadow:function(b,d){this.shadow&&this.shadowObj.css({width:this.menu.width()+this.shadowWidthAdjust+"px",height:this.menu.height()+this.shadowHeightAdjust+"px",top:d+this.shadowOffsetY+"px",left:b+this.shadowOffsetX+"px"}).addClass(this.shadowClass)[this.showTransition](this.showSpeed)},beforeShow:function(){return true},show:function(b,d){var a=this,e=d.pageX,g=d.pageY;a.target=b;if(a.beforeShow()!==false){if(a.menuFunction){a.menu&& | ||||
| c(a.menu).remove();a.menu=a.createMenu(a.menuFunction(a,b),a);a.menu.css({display:"none"});c(a.appendTo).append(a.menu)}var f=a.menu;e+=a.offsetX;g+=a.offsetY;e=a.getPosition(e,g,a,d);a.showShadow(e.x,e.y,d);a.useIframe&&f.find("iframe").css({width:f.width()+a.shadowOffsetX+a.shadowWidthAdjust,height:f.height()+a.shadowOffsetY+a.shadowHeightAdjust});f.css({top:e.y+"px",left:e.x+"px",position:"absolute",zIndex:9999})[a.showTransition](a.showSpeed,a.showCallback?function(){a.showCallback.call(a)}:null); | ||||
| a.shown=true;c(document).one("click",null,function(){a.hide()})}},getPosition:function(b,d,a){b=b+a.offsetX;d=d+a.offsetY;var e=c(a.menu).height(),g=c(a.menu).width(),f=a.direction;if(a.constrainToScreen){var h=c(window),i=h.height();a=h.width();if(f=="down"&&d+e-h.scrollTop()>i)f="up";g=b+g-h.scrollLeft();if(g>a)b-=g-a}if(f=="up")d-=e;return{x:b,y:d}},hide:function(){var b=this;if(b.shown){b.iframe&&c(b.iframe).hide();if(b.menu)b.menu[b.hideTransition](b.hideSpeed,b.hideCallback?function(){b.hideCallback.call(b)}: | ||||
| null);b.shadow&&b.shadowObj[b.hideTransition](b.hideSpeed)}b.shown=false}};c.fn.contextMenu=function(b,d){var a=c.contextMenu.create(b,d);return this.each(function(){c(this).bind("click",function(e){a.show(this,e);return false})})}})(jQuery); | ||||
| @@ -1,110 +0,0 @@ | ||||
| /** | ||||
|  * Cookie plugin | ||||
|  * | ||||
|  * Copyright (c) 2006 Klaus Hartl (stilbuero.de) | ||||
|  * Dual licensed under the MIT and GPL licenses: | ||||
|  * http://www.opensource.org/licenses/mit-license.php | ||||
|  * http://www.gnu.org/licenses/gpl.html | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * Create a cookie with the given name and value and other optional parameters. | ||||
|  * | ||||
|  * @example $.cookie('the_cookie', 'the_value'); | ||||
|  * @desc Set the value of a cookie. | ||||
|  * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); | ||||
|  * @desc Create a cookie with all available options. | ||||
|  * @example $.cookie('the_cookie', 'the_value'); | ||||
|  * @desc Create a session cookie. | ||||
|  * @example $.cookie('the_cookie', null); | ||||
|  * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain | ||||
|  *       used when the cookie was set. | ||||
|  * | ||||
|  * @param String name The name of the cookie. | ||||
|  * @param String value The value of the cookie. | ||||
|  * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. | ||||
|  * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. | ||||
|  *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted. | ||||
|  *                             If set to null or omitted, the cookie will be a session cookie and will not be retained | ||||
|  *                             when the the browser exits. | ||||
|  * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). | ||||
|  * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). | ||||
|  * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will | ||||
|  *                        require a secure protocol (like HTTPS). | ||||
|  * @type undefined | ||||
|  * | ||||
|  * @name $.cookie | ||||
|  * @cat Plugins/Cookie | ||||
|  * @author Klaus Hartl/klaus.hartl@stilbuero.de | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * Get the value of a cookie with the given name. | ||||
|  *  | ||||
|  * @example $.cookie('the_cookie'); | ||||
|  * @desc Get the value of a cookie. | ||||
|  *  | ||||
|  * @param String | ||||
|  *            name The name of the cookie. | ||||
|  * @return The value of the cookie. | ||||
|  * @type String | ||||
|  *  | ||||
|  * @name $.cookie | ||||
|  * @cat Plugins/Cookie | ||||
|  * @author Klaus Hartl/klaus.hartl@stilbuero.de | ||||
|  */ | ||||
| jQuery.cookie = function(name, value, options) { | ||||
| 	if (typeof value != 'undefined') { // name and value given, set cookie | ||||
| 		options = options || {}; | ||||
| 		if (value === null) { | ||||
| 			value = ''; | ||||
| 			options.expires = -1; | ||||
| 		} | ||||
| 		var expires = ''; | ||||
| 		if (options.expires && | ||||
| 			(typeof options.expires == 'number' || options.expires.toUTCString)) { | ||||
| 			var date; | ||||
| 			if (typeof options.expires == 'number') { | ||||
| 				date = new Date(); | ||||
| 				date.setTime(date.getTime() + | ||||
| 					(options.expires * 24 * 60 * 60 * 1000)); | ||||
| 			} else { | ||||
| 				date = options.expires; | ||||
| 			} | ||||
| 			expires = '; expires=' + date.toUTCString(); // use expires | ||||
| 			// attribute, | ||||
| 			// max-age is not | ||||
| 			// supported by IE | ||||
| 		} | ||||
| 		// CAUTION: Needed to parenthesize options.path and options.domain | ||||
| 		// in the following expressions, otherwise they evaluate to undefined | ||||
| 		// in the packed version for some reason... | ||||
| 		var path = options.path ? '; path=' + (options.path) : ''; | ||||
| 		var domain = options.domain ? '; domain=' + (options.domain) : ''; | ||||
| 		var secure = options.secure ? '; secure' : ''; | ||||
| 		document.cookie = [ | ||||
| 			name, | ||||
| 			'=', | ||||
| 			encodeURIComponent(value), | ||||
| 			expires, | ||||
| 			path, | ||||
| 			domain, | ||||
| 			secure ].join(''); | ||||
| 	} else { // only name given, get cookie | ||||
| 		var cookieValue = null; | ||||
| 		if (document.cookie && document.cookie != '') { | ||||
| 			var cookies = document.cookie.split(';'); | ||||
| 			for ( var i = 0; i < cookies.length; i++) { | ||||
| 				var cookie = jQuery.trim(cookies[i]); | ||||
| 				// Does this cookie string begin with the name we want? | ||||
| 				if (cookie.substring(0, name.length + 1) == (name + '=')) { | ||||
| 					cookieValue = decodeURIComponent(cookie | ||||
| 						.substring(name.length + 1)); | ||||
| 					break; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		return cookieValue; | ||||
| 	} | ||||
| }; | ||||
							
								
								
									
										11
									
								
								xCAT-UI/js/jquery/jquery.cookie.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								xCAT-UI/js/jquery/jquery.cookie.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| /* | ||||
|  Cookie plugin | ||||
|  | ||||
|  Copyright (c) 2006 Klaus Hartl (stilbuero.de) | ||||
|  Dual licensed under the MIT and GPL licenses: | ||||
|  http://www.opensource.org/licenses/mit-license.php | ||||
|  http://www.gnu.org/licenses/gpl.html | ||||
|  | ||||
| */ | ||||
| jQuery.cookie=function(d,c,a){if(typeof c!="undefined"){a=a||{};if(c===null){c="";a.expires=-1}var b="";if(a.expires&&(typeof a.expires=="number"||a.expires.toUTCString)){if(typeof a.expires=="number"){b=new Date;b.setTime(b.getTime()+a.expires*24*60*60*1E3)}else b=a.expires;b="; expires="+b.toUTCString()}var e=a.path?"; path="+a.path:"",f=a.domain?"; domain="+a.domain:"";a=a.secure?"; secure":"";document.cookie=[d,"=",encodeURIComponent(c),b,e,f,a].join("")}else{c=null;if(document.cookie&&document.cookie!= | ||||
| ""){a=document.cookie.split(";");for(b=0;b<a.length;b++){e=jQuery.trim(a[b]);if(e.substring(0,d.length+1)==d+"="){c=decodeURIComponent(e.substring(d.length+1));break}}}return c}}; | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										62
									
								
								xCAT-UI/js/jquery/jquery.flot.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								xCAT-UI/js/jquery/jquery.flot.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | ||||
| /* | ||||
|  Javascript plotting library for jQuery, v. 0.6. | ||||
|  Released under the MIT license by IOLA, December 2007. | ||||
| */ | ||||
| (function(){jQuery.color={};jQuery.color.make=function(E,y,x,M){var z={};z.r=E||0;z.g=y||0;z.b=x||0;z.a=M!=null?M:1;z.add=function(G,H){for(var F=0;F<G.length;++F)z[G.charAt(F)]+=H;return z.normalize()};z.scale=function(G,H){for(var F=0;F<G.length;++F)z[G.charAt(F)]*=H;return z.normalize()};z.toString=function(){return z.a>=1?"rgb("+[z.r,z.g,z.b].join(",")+")":"rgba("+[z.r,z.g,z.b,z.a].join(",")+")"};z.normalize=function(){function G(H,F,J){return F<H?H:F>J?J:F}z.r=G(0,parseInt(z.r),255);z.g=G(0, | ||||
| parseInt(z.g),255);z.b=G(0,parseInt(z.b),255);z.a=G(0,z.a,1);return z};z.clone=function(){return jQuery.color.make(z.r,z.b,z.g,z.a)};return z.normalize()};jQuery.color.extract=function(E,y){var x;do{x=E.css(y).toLowerCase();if(x!=""&&x!="transparent")break;E=E.parent()}while(!jQuery.nodeName(E.get(0),"body"));if(x=="rgba(0, 0, 0, 0)")x="transparent";return jQuery.color.parse(x)};jQuery.color.parse=function(E){var y,x=jQuery.color.make;if(y=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(E))return x(parseInt(y[1], | ||||
| 10),parseInt(y[2],10),parseInt(y[3],10));if(y=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E))return x(parseInt(y[1],10),parseInt(y[2],10),parseInt(y[3],10),parseFloat(y[4]));if(y=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(E))return x(parseFloat(y[1])*2.55,parseFloat(y[2])*2.55,parseFloat(y[3])*2.55);if(y=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E))return x(parseFloat(y[1])* | ||||
| 2.55,parseFloat(y[2])*2.55,parseFloat(y[3])*2.55,parseFloat(y[4]));if(y=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(E))return x(parseInt(y[1],16),parseInt(y[2],16),parseInt(y[3],16));if(y=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(E))return x(parseInt(y[1]+y[1],16),parseInt(y[2]+y[2],16),parseInt(y[3]+y[3],16));E=jQuery.trim(E).toLowerCase();if(E=="transparent")return x(255,255,255,0);else{y=A[E];return x(y[0],y[1],y[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245, | ||||
| 220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144], | ||||
| lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(); | ||||
| (function(A){function E(x,M,z,G){function H(a,e){e=[D].concat(e);for(var b=0;b<a.length;++b)a[b].apply(this,e)}function F(a){for(var e=[],b=0;b<a.length;++b){var c=A.extend(true,{},r.series);if(a[b].data){c.data=a[b].data;delete a[b].data;A.extend(true,c,a[b]);a[b].data=c.data}else c.data=a[b];e.push(c)}C=e;e=C.length;b=[];c=[];for(a=0;a<C.length;++a){var d=C[a].color;if(d!=null){--e;typeof d=="number"?c.push(d):b.push(A.color.parse(C[a].color))}}for(a=0;a<c.length;++a)e=Math.max(e,c[a]+1);b=[];for(a= | ||||
| c=0;b.length<e;){d=r.colors.length==a?A.color.make(100,100,100):A.color.parse(r.colors[a]);d.scale("rgb",1+(c%2==1?-1:1)*Math.ceil(c/2)*0.2);b.push(d);++a;if(a>=r.colors.length){a=0;++c}}for(a=e=0;a<C.length;++a){c=C[a];if(c.color==null){c.color=b[e].toString();++e}else if(typeof c.color=="number")c.color=b[c.color].toString();if(c.lines.show==null){var f;d=true;for(f in c)if(c[f].show){d=false;break}if(d)c.lines.show=true}c.xaxis=J(c,"xaxis");c.yaxis=J(c,"yaxis")}Y()}function J(a,e){var b=a[e];if(!b|| | ||||
| b==1)return u[e];if(typeof b=="number")return u[e.charAt(0)+b+e.slice(1)];return b}function Y(){function a(t,B,O){if(B<t.datamin)t.datamin=B;if(O>t.datamax)t.datamax=O}var e=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,c,d,f,k,g,j,h,m,l,v,s;for(m in u){u[m].datamin=e;u[m].datamax=b;u[m].used=false}for(c=0;c<C.length;++c){g=C[c];g.datapoints={points:[]};H(S.processRawData,[g,g.data,g.datapoints])}for(c=0;c<C.length;++c){g=C[c];var q=g.data,n=g.datapoints.format;if(!n){n=[];n.push({x:true,number:true, | ||||
| required:true});n.push({y:true,number:true,required:true});g.bars.show&&n.push({y:true,number:true,required:false,defaultValue:0});g.datapoints.format=n}if(g.datapoints.pointsize==null){if(g.datapoints.pointsize==null)g.datapoints.pointsize=n.length;h=g.datapoints.pointsize;j=g.datapoints.points;insertSteps=g.lines.show&&g.lines.steps;g.xaxis.used=g.yaxis.used=true;for(d=f=0;d<q.length;++d,f+=h){s=q[d];var p=s==null;if(!p)for(k=0;k<h;++k){l=s[k];if(v=n[k]){if(v.number&&l!=null){l=+l;if(isNaN(l))l= | ||||
| null}if(l==null){if(v.required)p=true;if(v.defaultValue!=null)l=v.defaultValue}}j[f+k]=l}if(p)for(k=0;k<h;++k){l=j[f+k];if(l!=null){v=n[k];v.x&&a(g.xaxis,l,l);v.y&&a(g.yaxis,l,l)}j[f+k]=null}else if(insertSteps&&f>0&&j[f-h]!=null&&j[f-h]!=j[f]&&j[f-h+1]!=j[f+1]){for(k=0;k<h;++k)j[f+h+k]=j[f+k];j[f+1]=j[f-h+1];f+=h}}}}for(c=0;c<C.length;++c){g=C[c];H(S.processDatapoints,[g,g.datapoints])}for(c=0;c<C.length;++c){g=C[c];j=g.datapoints.points;h=g.datapoints.pointsize;s=f=e;p=q=b;for(d=0;d<j.length;d+= | ||||
| h)if(j[d]!=null)for(k=0;k<h;++k){l=j[d+k];if(v=n[k]){if(v.x){if(l<f)f=l;if(l>q)q=l}if(v.y){if(l<s)s=l;if(l>p)p=l}}}if(g.bars.show){d=g.bars.align=="left"?0:-g.bars.barWidth/2;if(g.bars.horizontal){s+=d;p+=d+g.bars.barWidth}else{f+=d;q+=d+g.bars.barWidth}}a(g.xaxis,f,q);a(g.yaxis,s,p)}for(m in u){if(u[m].datamin==e)u[m].datamin=null;if(u[m].datamax==b)u[m].datamax=null}}function W(){function a(d,f){function k(l){return l}var g,j,h=f.transform||k,m=f.inverseTransform;if(d==u.xaxis||d==u.x2axis){g=d.scale= | ||||
| P/(h(d.max)-h(d.min));j=h(d.min);d.p2c=h==k?function(l){return(l-j)*g}:function(l){return(h(l)-j)*g};d.c2p=m?function(l){return m(j+l/g)}:function(l){return j+l/g}}else{g=d.scale=Q/(h(d.max)-h(d.min));j=h(d.max);d.p2c=h==k?function(l){return(j-l)*g}:function(l){return(j-h(l))*g};d.c2p=m?function(l){return m(j-l/g)}:function(l){return j-l/g}}}function e(d,f){var k,g=[],j;d.labelWidth=f.labelWidth;d.labelHeight=f.labelHeight;if(d==u.xaxis||d==u.x2axis){if(d.labelWidth==null)d.labelWidth=R/(d.ticks.length> | ||||
| 0?d.ticks.length:1);if(d.labelHeight==null){g=[];for(k=0;k<d.ticks.length;++k)(j=d.ticks[k].label)&&g.push('<div class="tickLabel" style="float:left;width:'+d.labelWidth+'px">'+j+"</div>");if(g.length>0){k=A('<div style="position:absolute;top:-10000px;width:10000px;font-size:smaller">'+g.join("")+'<div style="clear:left"></div></div>').appendTo(x);d.labelHeight=k.height();k.remove()}}}else if(d.labelWidth==null||d.labelHeight==null){for(k=0;k<d.ticks.length;++k)(j=d.ticks[k].label)&&g.push('<div class="tickLabel">'+ | ||||
| j+"</div>");if(g.length>0){k=A('<div style="position:absolute;top:-10000px;font-size:smaller">'+g.join("")+"</div>").appendTo(x);if(d.labelWidth==null)d.labelWidth=k.width();if(d.labelHeight==null)d.labelHeight=k.find("div").height();k.remove()}}if(d.labelWidth==null)d.labelWidth=0;if(d.labelHeight==null)d.labelHeight=0}function b(){var d=r.grid.borderWidth;for(i=0;i<C.length;++i)d=Math.max(d,2*(C[i].points.radius+C[i].points.lineWidth/2));w.left=w.right=w.top=w.bottom=d;var f=r.grid.labelMargin+ | ||||
| r.grid.borderWidth;if(u.xaxis.labelHeight>0)w.bottom=Math.max(d,u.xaxis.labelHeight+f);if(u.yaxis.labelWidth>0)w.left=Math.max(d,u.yaxis.labelWidth+f);if(u.x2axis.labelHeight>0)w.top=Math.max(d,u.x2axis.labelHeight+f);if(u.y2axis.labelWidth>0)w.right=Math.max(d,u.y2axis.labelWidth+f);P=R-w.left-w.right;Q=T-w.bottom-w.top}for(var c in u)I(u[c],r[c]);if(r.grid.show){for(c in u){V(u[c],r[c]);ma(u[c],r[c]);e(u[c],r[c])}b()}else{w.left=w.right=w.top=w.bottom=0;P=R;Q=T}for(c in u)a(u[c],r[c]);r.grid.show&& | ||||
| na();oa()}function I(a,e){var b=+(e.min!=null?e.min:a.datamin),c=+(e.max!=null?e.max:a.datamax),d=c-b;if(d==0){d=c==0?1:0.01;if(e.min==null)b-=d;if(e.max==null||e.min!=null)c+=d}else{var f=e.autoscaleMargin;if(f!=null){if(e.min==null){b-=d*f;if(b<0&&a.datamin!=null&&a.datamin>=0)b=0}if(e.max==null){c+=d*f;if(c>0&&a.datamax!=null&&a.datamax<=0)c=0}}}a.min=b;a.max=c}function V(a,e){var b=(a.max-a.min)/(typeof e.ticks=="number"&&e.ticks>0?e.ticks:a==u.xaxis||a==u.x2axis?0.3*Math.sqrt(R):0.3*Math.sqrt(T)), | ||||
| c,d,f;if(e.mode=="time"){var k={second:1E3,minute:6E4,hour:36E5,day:864E5,month:2592E6,year:525949.2*60*1E3};f=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];c=0;if(e.minTickSize!=null)c=typeof e.tickSize=="number"?e.tickSize:e.minTickSize[0]* | ||||
| k[e.minTickSize[1]];for(d=0;d<f.length-1;++d)if(b<(f[d][0]*k[f[d][1]]+f[d+1][0]*k[f[d+1][1]])/2&&f[d][0]*k[f[d][1]]>=c)break;c=f[d][0];d=f[d][1];if(d=="year"){f=Math.pow(10,Math.floor(Math.log(b/k.year)/Math.LN10));b=b/k.year/f;c=b<1.5?1:b<3?2:b<7.5?5:10;c*=f}if(e.tickSize){c=e.tickSize[0];d=e.tickSize[1]}b=function(h){var m=[],l=h.tickSize[0],v=h.tickSize[1],s=new Date(h.min),q=l*k[v];v=="second"&&s.setUTCSeconds(y(s.getUTCSeconds(),l));v=="minute"&&s.setUTCMinutes(y(s.getUTCMinutes(),l));v=="hour"&& | ||||
| s.setUTCHours(y(s.getUTCHours(),l));v=="month"&&s.setUTCMonth(y(s.getUTCMonth(),l));v=="year"&&s.setUTCFullYear(y(s.getUTCFullYear(),l));s.setUTCMilliseconds(0);q>=k.minute&&s.setUTCSeconds(0);q>=k.hour&&s.setUTCMinutes(0);q>=k.day&&s.setUTCHours(0);q>=k.day*4&&s.setUTCDate(1);q>=k.year&&s.setUTCMonth(0);var n=0,p=Number.NaN,t;do{t=p;p=s.getTime();m.push({v:p,label:h.tickFormatter(p,h)});if(v=="month")if(l<1){s.setUTCDate(1);var B=s.getTime();s.setUTCMonth(s.getUTCMonth()+1);var O=s.getTime();s.setTime(p+ | ||||
| n*k.hour+(O-B)*l);n=s.getUTCHours();s.setUTCHours(0)}else s.setUTCMonth(s.getUTCMonth()+l);else v=="year"?s.setUTCFullYear(s.getUTCFullYear()+l):s.setTime(p+q)}while(p<h.max&&p!=t);return m};f=function(h,m){var l=new Date(h);if(e.timeformat!=null)return A.plot.formatDate(l,e.timeformat,e.monthNames);var v=m.tickSize[0]*k[m.tickSize[1]],s=m.max-m.min,q=e.twelveHourClock?" %p":"";fmt=v<k.minute?"%h:%M:%S"+q:v<k.day?s<2*k.day?"%h:%M"+q:"%b %d %h:%M"+q:v<k.month?"%b %d":v<k.year?s<k.year?"%b":"%b %y": | ||||
| "%y";return A.plot.formatDate(l,fmt,e.monthNames)}}else{var g=e.tickDecimals,j=-Math.floor(Math.log(b)/Math.LN10);if(g!=null&&j>g)j=g;f=Math.pow(10,-j);b=b/f;if(b<1.5)c=1;else if(b<3){c=2;if(b>2.25&&(g==null||j+1<=g)){c=2.5;++j}}else c=b<7.5?5:10;c*=f;if(e.minTickSize!=null&&c<e.minTickSize)c=e.minTickSize;if(e.tickSize!=null)c=e.tickSize;a.tickDecimals=Math.max(0,g!=null?g:j);b=function(h){var m=[],l=y(h.min,h.tickSize),v=0,s=Number.NaN,q;do{q=s;s=l+v*h.tickSize;m.push({v:s,label:h.tickFormatter(s, | ||||
| h)});++v}while(s<h.max&&s!=q);return m};f=function(h,m){return h.toFixed(m.tickDecimals)}}a.tickSize=d?[c,d]:c;a.tickGenerator=b;a.tickFormatter=A.isFunction(e.tickFormatter)?function(h,m){return""+e.tickFormatter(h,m)}:f}function ma(a,e){a.ticks=[];if(a.used){if(e.ticks==null)a.ticks=a.tickGenerator(a);else if(typeof e.ticks=="number"){if(e.ticks>0)a.ticks=a.tickGenerator(a)}else if(e.ticks){var b=e.ticks;if(A.isFunction(b))b=b({min:a.min,max:a.max});var c,d;for(c=0;c<b.length;++c){var f=null,k= | ||||
| b[c];if(typeof k=="object"){d=k[0];if(k.length>1)f=k[1]}else d=k;if(f==null)f=a.tickFormatter(d,a);a.ticks[c]={v:d,label:f}}}if(e.autoscaleMargin!=null&&a.ticks.length>0){if(e.min==null)a.min=Math.min(a.min,a.ticks[0].v);if(e.max==null&&a.ticks.length>1)a.max=Math.max(a.max,a.ticks[a.ticks.length-1].v)}}}function da(){o.clearRect(0,0,R,T);var a=r.grid;a.show&&!a.aboveData&&ea();for(var e=0;e<C.length;++e){var b=C[e];b.lines.show&&pa(b);b.bars.show&&qa(b);b.points.show&&ra(b)}H(S.draw,[o]);a.show&& | ||||
| a.aboveData&&ea()}function fa(a,e){var b=e+"axis",c=e+"2axis",d,f;if(a[b]){d=u[b];f=a[b].from;b=a[b].to}else if(a[c]){d=u[c];f=a[c].from;b=a[c].to}else{d=u[b];f=a[e+"1"];b=a[e+"2"]}if(f!=null&&b!=null&&f>b)return{from:b,to:f,axis:d};return{from:f,to:b,axis:d}}function ea(){var a;o.save();o.translate(w.left,w.top);if(r.grid.backgroundColor){o.fillStyle=ga(r.grid.backgroundColor,Q,0,"rgba(255, 255, 255, 0)");o.fillRect(0,0,P,Q)}var e=r.grid.markings;if(e){if(A.isFunction(e))e=e({xmin:u.xaxis.min,xmax:u.xaxis.max, | ||||
| ymin:u.yaxis.min,ymax:u.yaxis.max,xaxis:u.xaxis,yaxis:u.yaxis,x2axis:u.x2axis,y2axis:u.y2axis});for(a=0;a<e.length;++a){var b=e[a],c=fa(b,"x"),d=fa(b,"y");if(c.from==null)c.from=c.axis.min;if(c.to==null)c.to=c.axis.max;if(d.from==null)d.from=d.axis.min;if(d.to==null)d.to=d.axis.max;if(!(c.to<c.axis.min||c.from>c.axis.max||d.to<d.axis.min||d.from>d.axis.max)){c.from=Math.max(c.from,c.axis.min);c.to=Math.min(c.to,c.axis.max);d.from=Math.max(d.from,d.axis.min);d.to=Math.min(d.to,d.axis.max);if(!(c.from== | ||||
| c.to&&d.from==d.to)){c.from=c.axis.p2c(c.from);c.to=c.axis.p2c(c.to);d.from=d.axis.p2c(d.from);d.to=d.axis.p2c(d.to);if(c.from==c.to||d.from==d.to){o.beginPath();o.strokeStyle=b.color||r.grid.markingsColor;o.lineWidth=b.lineWidth||r.grid.markingsLineWidth;o.moveTo(c.from,d.from);o.lineTo(c.to,d.to);o.stroke()}else{o.fillStyle=b.color||r.grid.markingsColor;o.fillRect(c.from,d.to,c.to-c.from,d.from-d.to)}}}}}o.lineWidth=1;o.strokeStyle=r.grid.tickColor;o.beginPath();b=u.xaxis;for(a=0;a<b.ticks.length;++a){e= | ||||
| b.ticks[a].v;if(!(e<=b.min||e>=u.xaxis.max)){o.moveTo(Math.floor(b.p2c(e))+o.lineWidth/2,0);o.lineTo(Math.floor(b.p2c(e))+o.lineWidth/2,Q)}}b=u.yaxis;for(a=0;a<b.ticks.length;++a){e=b.ticks[a].v;if(!(e<=b.min||e>=b.max)){o.moveTo(0,Math.floor(b.p2c(e))+o.lineWidth/2);o.lineTo(P,Math.floor(b.p2c(e))+o.lineWidth/2)}}b=u.x2axis;for(a=0;a<b.ticks.length;++a){e=b.ticks[a].v;if(!(e<=b.min||e>=b.max)){o.moveTo(Math.floor(b.p2c(e))+o.lineWidth/2,-5);o.lineTo(Math.floor(b.p2c(e))+o.lineWidth/2,5)}}b=u.y2axis; | ||||
| for(a=0;a<b.ticks.length;++a){e=b.ticks[a].v;if(!(e<=b.min||e>=b.max)){o.moveTo(P-5,Math.floor(b.p2c(e))+o.lineWidth/2);o.lineTo(P+5,Math.floor(b.p2c(e))+o.lineWidth/2)}}o.stroke();if(r.grid.borderWidth){a=r.grid.borderWidth;o.lineWidth=a;o.strokeStyle=r.grid.borderColor;o.strokeRect(-a/2,-a/2,P+a,Q+a)}o.restore()}function na(){function a(c,d){for(var f=0;f<c.ticks.length;++f){var k=c.ticks[f];!k.label||k.v<c.min||k.v>c.max||e.push(d(k,c))}}x.find(".tickLabels").remove();var e=['<div class="tickLabels" style="font-size:smaller;color:'+ | ||||
| r.grid.color+'">'],b=r.grid.labelMargin+r.grid.borderWidth;a(u.xaxis,function(c,d){return'<div style="position:absolute;top:'+(w.top+Q+b)+"px;left:"+Math.round(w.left+d.p2c(c.v)-d.labelWidth/2)+"px;width:"+d.labelWidth+'px;text-align:center" class="tickLabel">'+c.label+"</div>"});a(u.yaxis,function(c,d){return'<div style="position:absolute;top:'+Math.round(w.top+d.p2c(c.v)-d.labelHeight/2)+"px;right:"+(w.right+P+b)+"px;width:"+d.labelWidth+'px;text-align:right" class="tickLabel">'+c.label+"</div>"}); | ||||
| a(u.x2axis,function(c,d){return'<div style="position:absolute;bottom:'+(w.bottom+Q+b)+"px;left:"+Math.round(w.left+d.p2c(c.v)-d.labelWidth/2)+"px;width:"+d.labelWidth+'px;text-align:center" class="tickLabel">'+c.label+"</div>"});a(u.y2axis,function(c,d){return'<div style="position:absolute;top:'+Math.round(w.top+d.p2c(c.v)-d.labelHeight/2)+"px;left:"+(w.left+P+b)+"px;width:"+d.labelWidth+'px;text-align:left" class="tickLabel">'+c.label+"</div>"});e.push("</div>");x.append(e.join(""))}function pa(a){function e(k, | ||||
| g,j,h,m){var l=k.points;k=k.pointsize;var v=null,s=null;o.beginPath();for(var q=k;q<l.length;q+=k){var n=l[q-k],p=l[q-k+1],t=l[q],B=l[q+1];if(!(n==null||t==null)){if(p<=B&&p<m.min){if(B<m.min)continue;n=(m.min-p)/(B-p)*(t-n)+n;p=m.min}else if(B<=p&&B<m.min){if(p<m.min)continue;t=(m.min-p)/(B-p)*(t-n)+n;B=m.min}if(p>=B&&p>m.max){if(B>m.max)continue;n=(m.max-p)/(B-p)*(t-n)+n;p=m.max}else if(B>=p&&B>m.max){if(p>m.max)continue;t=(m.max-p)/(B-p)*(t-n)+n;B=m.max}if(n<=t&&n<h.min){if(t<h.min)continue;p= | ||||
| (h.min-n)/(t-n)*(B-p)+p;n=h.min}else if(t<=n&&t<h.min){if(n<h.min)continue;B=(h.min-n)/(t-n)*(B-p)+p;t=h.min}if(n>=t&&n>h.max){if(t>h.max)continue;p=(h.max-n)/(t-n)*(B-p)+p;n=h.max}else if(t>=n&&t>h.max){if(n>h.max)continue;B=(h.max-n)/(t-n)*(B-p)+p;t=h.max}if(n!=v||p!=s)o.moveTo(h.p2c(n)+g,m.p2c(p)+j);v=t;s=B;o.lineTo(h.p2c(t)+g,m.p2c(B)+j)}}o.stroke()}function b(k,g,j){var h=k.points;k=k.pointsize;var m=Math.min(Math.max(0,j.min),j.max),l;l=0;for(var v=false,s=k;s<h.length;s+=k){var q=h[s-k],n= | ||||
| h[s-k+1],p=h[s],t=h[s+1];if(v&&q!=null&&p==null){o.lineTo(g.p2c(l),j.p2c(m));o.fill();v=false}else if(!(q==null||p==null)){if(q<=p&&q<g.min){if(p<g.min)continue;n=(g.min-q)/(p-q)*(t-n)+n;q=g.min}else if(p<=q&&p<g.min){if(q<g.min)continue;t=(g.min-q)/(p-q)*(t-n)+n;p=g.min}if(q>=p&&q>g.max){if(p>g.max)continue;n=(g.max-q)/(p-q)*(t-n)+n;q=g.max}else if(p>=q&&p>g.max){if(q>g.max)continue;t=(g.max-q)/(p-q)*(t-n)+n;p=g.max}if(!v){o.beginPath();o.moveTo(g.p2c(q),j.p2c(m));v=true}if(n>=j.max&&t>=j.max){o.lineTo(g.p2c(q), | ||||
| j.p2c(j.max));o.lineTo(g.p2c(p),j.p2c(j.max));l=p}else if(n<=j.min&&t<=j.min){o.lineTo(g.p2c(q),j.p2c(j.min));o.lineTo(g.p2c(p),j.p2c(j.min));l=p}else{var B=q,O=p;if(n<=t&&n<j.min&&t>=j.min){q=(j.min-n)/(t-n)*(p-q)+q;n=j.min}else if(t<=n&&t<j.min&&n>=j.min){p=(j.min-n)/(t-n)*(p-q)+q;t=j.min}if(n>=t&&n>j.max&&t<=j.max){q=(j.max-n)/(t-n)*(p-q)+q;n=j.max}else if(t>=n&&t>j.max&&n<=j.max){p=(j.max-n)/(t-n)*(p-q)+q;t=j.max}if(q!=B){l=n<=j.min?j.min:j.max;o.lineTo(g.p2c(B),j.p2c(l));o.lineTo(g.p2c(q),j.p2c(l))}o.lineTo(g.p2c(q), | ||||
| j.p2c(n));o.lineTo(g.p2c(p),j.p2c(t));if(p!=O){l=t<=j.min?j.min:j.max;o.lineTo(g.p2c(p),j.p2c(l));o.lineTo(g.p2c(O),j.p2c(l))}l=Math.max(p,O)}}}if(v){o.lineTo(g.p2c(l),j.p2c(m));o.fill()}}o.save();o.translate(w.left,w.top);o.lineJoin="round";var c=a.lines.lineWidth,d=a.shadowSize;if(c>0&&d>0){o.lineWidth=d;o.strokeStyle="rgba(0,0,0,0.1)";var f=Math.PI/18;e(a.datapoints,Math.sin(f)*(c/2+d/2),Math.cos(f)*(c/2+d/2),a.xaxis,a.yaxis);o.lineWidth=d/2;e(a.datapoints,Math.sin(f)*(c/2+d/4),Math.cos(f)*(c/ | ||||
| 2+d/4),a.xaxis,a.yaxis)}o.lineWidth=c;o.strokeStyle=a.color;if(d=aa(a.lines,a.color,0,Q)){o.fillStyle=d;b(a.datapoints,a.xaxis,a.yaxis)}c>0&&e(a.datapoints,0,0,a.xaxis,a.yaxis);o.restore()}function ra(a){function e(f,k,g,j,h,m,l){var v=f.points;f=f.pointsize;for(var s=0;s<v.length;s+=f){var q=v[s],n=v[s+1];if(!(q==null||q<m.min||q>m.max||n<l.min||n>l.max)){o.beginPath();o.arc(m.p2c(q),l.p2c(n)+j,k,0,h,false);if(g){o.fillStyle=g;o.fill()}o.stroke()}}}o.save();o.translate(w.left,w.top);var b=a.lines.lineWidth, | ||||
| c=a.shadowSize,d=a.points.radius;if(b>0&&c>0){c=c/2;o.lineWidth=c;o.strokeStyle="rgba(0,0,0,0.1)";e(a.datapoints,d,null,c+c/2,Math.PI,a.xaxis,a.yaxis);o.strokeStyle="rgba(0,0,0,0.2)";e(a.datapoints,d,null,c/2,Math.PI,a.xaxis,a.yaxis)}o.lineWidth=b;o.strokeStyle=a.color;e(a.datapoints,d,aa(a.points,a.color),0,2*Math.PI,a.xaxis,a.yaxis);o.restore()}function ha(a,e,b,c,d,f,k,g,j,h,m){var l,v,s,q;if(m){q=v=s=true;l=false;m=b;a=a;b=e+c;d=e+d;if(a<m){e=a;a=m;m=e;l=true;v=false}}else{l=v=s=true;q=false; | ||||
| m=a+c;a=a+d;d=b;b=e;if(b<d){e=b;b=d;d=e;q=true;s=false}}if(!(a<g.min||m>g.max||b<j.min||d>j.max)){if(m<g.min){m=g.min;l=false}if(a>g.max){a=g.max;v=false}if(d<j.min){d=j.min;q=false}if(b>j.max){b=j.max;s=false}m=g.p2c(m);d=j.p2c(d);a=g.p2c(a);b=j.p2c(b);if(k){h.beginPath();h.moveTo(m,d);h.lineTo(m,b);h.lineTo(a,b);h.lineTo(a,d);h.fillStyle=k(d,b);h.fill()}if(l||v||s||q){h.beginPath();h.moveTo(m,d+f);l?h.lineTo(m,b+f):h.moveTo(m,b+f);s?h.lineTo(a,b+f):h.moveTo(a,b+f);v?h.lineTo(a,d+f):h.moveTo(a,d+ | ||||
| f);q?h.lineTo(m,d+f):h.moveTo(m,d+f);h.stroke()}}}function qa(a){o.save();o.translate(w.left,w.top);o.lineWidth=a.bars.lineWidth;o.strokeStyle=a.color;var e=a.bars.align=="left"?0:-a.bars.barWidth/2;(function(b,c,d,f,k,g,j){var h=b.points;b=b.pointsize;for(var m=0;m<h.length;m+=b)h[m]!=null&&ha(h[m],h[m+1],h[m+2],c,d,f,k,g,j,o,a.bars.horizontal)})(a.datapoints,e,e+a.bars.barWidth,0,a.bars.fill?function(b,c){return aa(a.bars,a.color,b,c)}:null,a.xaxis,a.yaxis);o.restore()}function aa(a,e,b,c){var d= | ||||
| a.fill;if(!d)return null;if(a.fillColor)return ga(a.fillColor,b,c,e);a=A.color.parse(e);a.a=typeof d=="number"?d:0.4;a.normalize();return a.toString()}function oa(){x.find(".legend").remove();if(r.legend.show){var a=[],e=false,b=r.legend.labelFormatter,c,d;for(i=0;i<C.length;++i){c=C[i];if(d=c.label){if(i%r.legend.noColumns==0){e&&a.push("</tr>");a.push("<tr>");e=true}if(b)d=b(d,c);a.push('<td class="legendColorBox"><div style="border:1px solid '+r.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+ | ||||
| c.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+d+"</td>")}}e&&a.push("</tr>");if(a.length!=0){e='<table style="font-size:smaller;color:'+r.grid.color+'">'+a.join("")+"</table>";if(r.legend.container!=null)A(r.legend.container).html(e);else{a="";b=r.legend.position;c=r.legend.margin;if(c[0]==null)c=[c,c];if(b.charAt(0)=="n")a+="top:"+(c[1]+w.top)+"px;";else if(b.charAt(0)=="s")a+="bottom:"+(c[1]+w.bottom)+"px;";if(b.charAt(1)=="e")a+="right:"+(c[0]+w.right)+"px;";else if(b.charAt(1)== | ||||
| "w")a+="left:"+(c[0]+w.left)+"px;";e=A('<div class="legend">'+e.replace('style="','style="position:absolute;'+a+";")+"</div>").appendTo(x);if(r.legend.backgroundOpacity!=0){b=r.legend.backgroundColor;if(b==null){b=(b=r.grid.backgroundColor)&&typeof b=="string"?A.color.parse(b):A.color.extract(e,"background-color");b.a=1;b=b.toString()}c=e.children();A('<div style="position:absolute;width:'+c.width()+"px;height:"+c.height()+"px;"+a+"background-color:"+b+';"> </div>').prependTo(e).css("opacity",r.legend.backgroundOpacity)}}}}} | ||||
| function sa(a){r.grid.hoverable&&ia("plothover",a,function(e){return e.hoverable!=false})}function ta(a){ia("plotclick",a,function(e){return e.clickable!=false})}function ia(a,e,b){var c=X.offset(),d={pageX:e.pageX,pageY:e.pageY},f=e.pageX-c.left-w.left;e=e.pageY-c.top-w.top;if(u.xaxis.used)d.x=u.xaxis.c2p(f);if(u.yaxis.used)d.y=u.yaxis.c2p(e);if(u.x2axis.used)d.x2=u.x2axis.c2p(f);if(u.y2axis.used)d.y2=u.y2axis.c2p(e);var k=r.grid.mouseActiveRadius,g=k*k+1,j=null,h,m;for(h=0;h<C.length;++h)if(b(C[h])){var l= | ||||
| C[h],v=l.xaxis,s=l.yaxis,q=l.datapoints.points,n=l.datapoints.pointsize,p=v.c2p(f),t=s.c2p(e),B=k/v.scale,O=k/s.scale;if(l.lines.show||l.points.show)for(m=0;m<q.length;m+=n){var N=q[m],L=q[m+1];if(N!=null)if(!(N-p>B||N-p<-B||L-t>O||L-t<-O)){N=Math.abs(v.p2c(N)-f);L=Math.abs(s.p2c(L)-e);L=N*N+L*L;if(L<=g){g=L;j=[h,m/n]}}}if(l.bars.show&&!j){v=l.bars.align=="left"?0:-l.bars.barWidth/2;l=v+l.bars.barWidth;for(m=0;m<q.length;m+=n){N=q[m];L=q[m+1];s=q[m+2];if(N!=null)if(C[h].bars.horizontal?p<=Math.max(s, | ||||
| N)&&p>=Math.min(s,N)&&t>=L+v&&t<=L+l:p>=N+v&&p<=N+l&&t>=Math.min(s,L)&&t<=Math.max(s,L))j=[h,m/n]}}}if(j){h=j[0];m=j[1];n=C[h].datapoints.pointsize;b={datapoint:C[h].datapoints.points.slice(m*n,(m+1)*n),dataIndex:m,series:C[h],seriesIndex:h}}else b=null;if(b){b.pageX=parseInt(b.series.xaxis.p2c(b.datapoint[0])+c.left+w.left);b.pageY=parseInt(b.series.yaxis.p2c(b.datapoint[1])+c.top+w.top)}if(r.grid.autoHighlight){for(c=0;c<U.length;++c){f=U[c];f.auto==a&&!(b&&f.series==b.series&&f.point==b.datapoint)&& | ||||
| ja(f.series,f.point)}b&&ka(b.series,b.datapoint,a)}x.trigger(a,[d,b])}function Z(){ba||(ba=setTimeout(ua,30))}function ua(){ba=null;K.save();K.clearRect(0,0,R,T);K.translate(w.left,w.top);var a,e;for(a=0;a<U.length;++a){e=U[a];if(e.series.bars.show)va(e.series,e.point);else{var b=e.series,c=e.point;e=c[0];c=c[1];var d=b.xaxis,f=b.yaxis;if(!(e<d.min||e>d.max||c<f.min||c>f.max)){var k=b.points.radius+b.points.lineWidth/2;K.lineWidth=k;K.strokeStyle=A.color.parse(b.color).scale("a",0.5).toString();b= | ||||
| 1.5*k;K.beginPath();K.arc(d.p2c(e),f.p2c(c),b,0,2*Math.PI,false);K.stroke()}}}K.restore();H(S.drawOverlay,[K])}function ka(a,e,b){if(typeof a=="number")a=C[a];if(typeof e=="number")e=a.data[e];var c=la(a,e);if(c==-1){U.push({series:a,point:e,auto:b});Z()}else if(!b)U[c].auto=false}function ja(a,e){if(a==null&&e==null){U=[];Z()}if(typeof a=="number")a=C[a];if(typeof e=="number")e=a.data[e];var b=la(a,e);if(b!=-1){U.splice(b,1);Z()}}function la(a,e){for(var b=0;b<U.length;++b){var c=U[b];if(c.series== | ||||
| a&&c.point[0]==e[0]&&c.point[1]==e[1])return b}return-1}function va(a,e){K.lineWidth=a.bars.lineWidth;K.strokeStyle=A.color.parse(a.color).scale("a",0.5).toString();var b=A.color.parse(a.color).scale("a",0.5).toString(),c=a.bars.align=="left"?0:-a.bars.barWidth/2;ha(e[0],e[1],e[2]||0,c,c+a.bars.barWidth,0,function(){return b},a.xaxis,a.yaxis,K,a.bars.horizontal)}function ga(a,e,b,c){if(typeof a=="string")return a;else{e=o.createLinearGradient(0,b,0,e);b=0;for(var d=a.colors.length;b<d;++b){var f= | ||||
| a.colors[b];if(typeof f!="string"){f=A.color.parse(c).scale("rgb",f.brightness);f.a*=f.opacity;f=f.toString()}e.addColorStop(b/(d-1),f)}return e}}var C=[],r={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:true,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{mode:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null, | ||||
| labelHeight:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:false},yaxis:{autoscaleMargin:0.02},x2axis:{autoscaleMargin:null},y2axis:{autoscaleMargin:0.02},series:{points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff"},lines:{lineWidth:2,fill:false,fillColor:null,steps:false},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,align:"left",horizontal:false},shadowSize:3},grid:{show:true,aboveData:false,color:"#545454", | ||||
| backgroundColor:null,tickColor:"rgba(0,0,0,0.15)",labelMargin:5,borderWidth:2,borderColor:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:false,hoverable:false,autoHighlight:true,mouseActiveRadius:10},hooks:{}},$=null,ca=null,X=null,o=null,K=null,u={xaxis:{},yaxis:{},x2axis:{},y2axis:{}},w={left:0,right:0,top:0,bottom:0},R=0,T=0,P=0,Q=0,S={processOptions:[],processRawData:[],processDatapoints:[],draw:[],bindEvents:[],drawOverlay:[]},D=this;D.setData=F;D.setupGrid=W;D.draw= | ||||
| da;D.getPlaceholder=function(){return x};D.getCanvas=function(){return $};D.getPlotOffset=function(){return w};D.width=function(){return P};D.height=function(){return Q};D.offset=function(){var a=X.offset();a.left+=w.left;a.top+=w.top;return a};D.getData=function(){return C};D.getAxes=function(){return u};D.getOptions=function(){return r};D.highlight=ka;D.unhighlight=ja;D.triggerRedrawOverlay=Z;D.pointOffset=function(a){return{left:parseInt(J(a,"xaxis").p2c(+a.x)+w.left),top:parseInt(J(a,"yaxis").p2c(+a.y)+ | ||||
| w.top)}};D.hooks=S;(function(){for(var a=0;a<G.length;++a){var e=G[a];e.init(D);e.options&&A.extend(true,r,e.options)}})(D);(function(a){A.extend(true,r,a);if(r.grid.borderColor==null)r.grid.borderColor=r.grid.color;if(r.xaxis.noTicks&&r.xaxis.ticks==null)r.xaxis.ticks=r.xaxis.noTicks;if(r.yaxis.noTicks&&r.yaxis.ticks==null)r.yaxis.ticks=r.yaxis.noTicks;if(r.grid.coloredAreas)r.grid.markings=r.grid.coloredAreas;if(r.grid.coloredAreasColor)r.grid.markingsColor=r.grid.coloredAreasColor;r.lines&&A.extend(true, | ||||
| r.series.lines,r.lines);r.points&&A.extend(true,r.series.points,r.points);r.bars&&A.extend(true,r.series.bars,r.bars);if(r.shadowSize)r.series.shadowSize=r.shadowSize;for(var e in S)if(r.hooks[e]&&r.hooks[e].length)S[e]=S[e].concat(r.hooks[e]);H(S.processOptions,[r])})(z);(function(){function a(e,b){var c=document.createElement("canvas");c.width=e;c.height=b;if(A.browser.msie)c=window.G_vmlCanvasManager.initElement(c);return c}R=x.width();T=x.height();x.html("");x.css("position")=="static"&&x.css("position", | ||||
| "relative");if(R<=0||T<=0)throw"Invalid dimensions for plot, width = "+R+", height = "+T;A.browser.msie&&window.G_vmlCanvasManager.init_(document);$=A(a(R,T)).appendTo(x).get(0);o=$.getContext("2d");ca=A(a(R,T)).css({position:"absolute",left:0,top:0}).appendTo(x).get(0);K=ca.getContext("2d");K.stroke()})();F(M);W();da();X=A([ca,$]);r.grid.hoverable&&X.mousemove(sa);r.grid.clickable&&X.click(ta);H(S.bindEvents,[X]);var U=[],ba=null}function y(x,M){return M*Math.floor(x/M)}A.plot=function(x,M,z){return new E(A(x), | ||||
| M,z,A.plot.plugins)};A.plot.plugins=[];A.plot.formatDate=function(x,M,z){var G=function(V){V=""+V;return V.length==1?"0"+V:V},H=[],F=false,J=x.getUTCHours(),Y=J<12;if(z==null)z=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(M.search(/%p|%P/)!=-1)if(J>12)J-=12;else if(J==0)J=12;for(var W=0;W<M.length;++W){var I=M.charAt(W);if(F){switch(I){case "h":I=""+J;break;case "H":I=G(J);break;case "M":I=G(x.getUTCMinutes());break;case "S":I=G(x.getUTCSeconds());break;case "d":I= | ||||
| ""+x.getUTCDate();break;case "m":I=""+(x.getUTCMonth()+1);break;case "y":I=""+x.getUTCFullYear();break;case "b":I=""+z[x.getUTCMonth()];break;case "p":I=Y?"am":"pm";break;case "P":I=Y?"AM":"PM"}H.push(I);F=false}else if(I=="%")F=true;else H.push(I)}return H.join("")}})(jQuery); | ||||
| @@ -1,675 +0,0 @@ | ||||
| /*! | ||||
|  * jQuery Form Plugin | ||||
|  * version: 2.43 (12-MAR-2010) | ||||
|  * @requires jQuery v1.3.2 or later | ||||
|  * | ||||
|  * Examples and documentation at: http://malsup.com/jquery/form/ | ||||
|  * Dual licensed under the MIT and GPL licenses: | ||||
|  *   http://www.opensource.org/licenses/mit-license.php | ||||
|  *   http://www.gnu.org/licenses/gpl.html | ||||
|  */ | ||||
| ;(function($) { | ||||
|  | ||||
| /* | ||||
| 	Usage Note: | ||||
| 	----------- | ||||
| 	Do not use both ajaxSubmit and ajaxForm on the same form.  These | ||||
| 	functions are intended to be exclusive.  Use ajaxSubmit if you want | ||||
| 	to bind your own submit handler to the form.  For example, | ||||
|  | ||||
| 	$(document).ready(function() { | ||||
| 		$('#myForm').bind('submit', function() { | ||||
| 			$(this).ajaxSubmit({ | ||||
| 				target: '#output' | ||||
| 			}); | ||||
| 			return false; // <-- important! | ||||
| 		}); | ||||
| 	}); | ||||
|  | ||||
| 	Use ajaxForm when you want the plugin to manage all the event binding | ||||
| 	for you.  For example, | ||||
|  | ||||
| 	$(document).ready(function() { | ||||
| 		$('#myForm').ajaxForm({ | ||||
| 			target: '#output' | ||||
| 		}); | ||||
| 	}); | ||||
|  | ||||
| 	When using ajaxForm, the ajaxSubmit function will be invoked for you | ||||
| 	at the appropriate time. | ||||
| */ | ||||
|  | ||||
| /** | ||||
|  * ajaxSubmit() provides a mechanism for immediately submitting | ||||
|  * an HTML form using AJAX. | ||||
|  */ | ||||
| $.fn.ajaxSubmit = function(options) { | ||||
| 	// fast fail if nothing selected (http://dev.jquery.com/ticket/2752) | ||||
| 	if (!this.length) { | ||||
| 		log('ajaxSubmit: skipping submit process - no element selected'); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	if (typeof options == 'function') | ||||
| 		options = { success: options }; | ||||
|  | ||||
| 	var url = $.trim(this.attr('action')); | ||||
| 	if (url) { | ||||
| 		// clean url (don't include hash vaue) | ||||
| 		url = (url.match(/^([^#]+)/)||[])[1]; | ||||
|    	} | ||||
|    	url = url || window.location.href || ''; | ||||
|  | ||||
| 	options = $.extend({ | ||||
| 		url:  url, | ||||
| 		type: this.attr('method') || 'GET', | ||||
| 		iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' | ||||
| 	}, options || {}); | ||||
|  | ||||
| 	// hook for manipulating the form data before it is extracted; | ||||
| 	// convenient for use with rich editors like tinyMCE or FCKEditor | ||||
| 	var veto = {}; | ||||
| 	this.trigger('form-pre-serialize', [this, options, veto]); | ||||
| 	if (veto.veto) { | ||||
| 		log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	// provide opportunity to alter form data before it is serialized | ||||
| 	if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { | ||||
| 		log('ajaxSubmit: submit aborted via beforeSerialize callback'); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	var a = this.formToArray(options.semantic); | ||||
| 	if (options.data) { | ||||
| 		options.extraData = options.data; | ||||
| 		for (var n in options.data) { | ||||
| 		  if(options.data[n] instanceof Array) { | ||||
| 			for (var k in options.data[n]) | ||||
| 			  a.push( { name: n, value: options.data[n][k] } ); | ||||
| 		  } | ||||
| 		  else | ||||
| 			 a.push( { name: n, value: options.data[n] } ); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// give pre-submit callback an opportunity to abort the submit | ||||
| 	if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { | ||||
| 		log('ajaxSubmit: submit aborted via beforeSubmit callback'); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	// fire vetoable 'validate' event | ||||
| 	this.trigger('form-submit-validate', [a, this, options, veto]); | ||||
| 	if (veto.veto) { | ||||
| 		log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	var q = $.param(a); | ||||
|  | ||||
| 	if (options.type.toUpperCase() == 'GET') { | ||||
| 		options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; | ||||
| 		options.data = null;  // data is null for 'get' | ||||
| 	} | ||||
| 	else | ||||
| 		options.data = q; // data is the query string for 'post' | ||||
|  | ||||
| 	var $form = this, callbacks = []; | ||||
| 	if (options.resetForm) callbacks.push(function() { $form.resetForm(); }); | ||||
| 	if (options.clearForm) callbacks.push(function() { $form.clearForm(); }); | ||||
|  | ||||
| 	// perform a load on the target only if dataType is not provided | ||||
| 	if (!options.dataType && options.target) { | ||||
| 		var oldSuccess = options.success || function(){}; | ||||
| 		callbacks.push(function(data) { | ||||
| 			var fn = options.replaceTarget ? 'replaceWith' : 'html'; | ||||
| 			$(options.target)[fn](data).each(oldSuccess, arguments); | ||||
| 		}); | ||||
| 	} | ||||
| 	else if (options.success) | ||||
| 		callbacks.push(options.success); | ||||
|  | ||||
| 	options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg | ||||
| 		for (var i=0, max=callbacks.length; i < max; i++) | ||||
| 			callbacks[i].apply(options, [data, status, xhr || $form, $form]); | ||||
| 	}; | ||||
|  | ||||
| 	// are there files to upload? | ||||
| 	var files = $('input:file', this).fieldValue(); | ||||
| 	var found = false; | ||||
| 	for (var j=0; j < files.length; j++) | ||||
| 		if (files[j]) | ||||
| 			found = true; | ||||
|  | ||||
| 	var multipart = false; | ||||
| //	var mp = 'multipart/form-data'; | ||||
| //	multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); | ||||
|  | ||||
| 	// options.iframe allows user to force iframe mode | ||||
| 	// 06-NOV-09: now defaulting to iframe mode if file input is detected | ||||
|    if ((files.length && options.iframe !== false) || options.iframe || found || multipart) { | ||||
| 	   // hack to fix Safari hang (thanks to Tim Molendijk for this) | ||||
| 	   // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d | ||||
| 	   if (options.closeKeepAlive) | ||||
| 		   $.get(options.closeKeepAlive, fileUpload); | ||||
| 	   else | ||||
| 		   fileUpload(); | ||||
| 	   } | ||||
|    else | ||||
| 	   $.ajax(options); | ||||
|  | ||||
| 	// fire 'notify' event | ||||
| 	this.trigger('form-submit-notify', [this, options]); | ||||
| 	return this; | ||||
|  | ||||
|  | ||||
| 	// private function for handling file uploads (hat tip to YAHOO!) | ||||
| 	function fileUpload() { | ||||
| 		var form = $form[0]; | ||||
|  | ||||
| 		if ($(':input[name=submit]', form).length) { | ||||
| 			alert('Error: Form elements must not be named "submit".'); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		var opts = $.extend({}, $.ajaxSettings, options); | ||||
| 		var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts); | ||||
|  | ||||
| 		var id = 'jqFormIO' + (new Date().getTime()); | ||||
| 		var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ opts.iframeSrc +'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />'); | ||||
| 		var io = $io[0]; | ||||
|  | ||||
| 		$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); | ||||
|  | ||||
| 		var xhr = { // mock object | ||||
| 			aborted: 0, | ||||
| 			responseText: null, | ||||
| 			responseXML: null, | ||||
| 			status: 0, | ||||
| 			statusText: 'n/a', | ||||
| 			getAllResponseHeaders: function() {}, | ||||
| 			getResponseHeader: function() {}, | ||||
| 			setRequestHeader: function() {}, | ||||
| 			abort: function() { | ||||
| 				this.aborted = 1; | ||||
| 				$io.attr('src', opts.iframeSrc); // abort op in progress | ||||
| 			} | ||||
| 		}; | ||||
|  | ||||
| 		var g = opts.global; | ||||
| 		// trigger ajax global events so that activity/block indicators work like normal | ||||
| 		if (g && ! $.active++) $.event.trigger("ajaxStart"); | ||||
| 		if (g) $.event.trigger("ajaxSend", [xhr, opts]); | ||||
|  | ||||
| 		if (s.beforeSend && s.beforeSend(xhr, s) === false) { | ||||
| 			s.global && $.active--; | ||||
| 			return; | ||||
| 		} | ||||
| 		if (xhr.aborted) | ||||
| 			return; | ||||
|  | ||||
| 		var cbInvoked = false; | ||||
| 		var timedOut = 0; | ||||
|  | ||||
| 		// add submitting element to data if we know it | ||||
| 		var sub = form.clk; | ||||
| 		if (sub) { | ||||
| 			var n = sub.name; | ||||
| 			if (n && !sub.disabled) { | ||||
| 				opts.extraData = opts.extraData || {}; | ||||
| 				opts.extraData[n] = sub.value; | ||||
| 				if (sub.type == "image") { | ||||
| 					opts.extraData[n+'.x'] = form.clk_x; | ||||
| 					opts.extraData[n+'.y'] = form.clk_y; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		// take a breath so that pending repaints get some cpu time before the upload starts | ||||
| 		function doSubmit() { | ||||
| 			// make sure form attrs are set | ||||
| 			var t = $form.attr('target'), a = $form.attr('action'); | ||||
|  | ||||
| 			// update form attrs in IE friendly way | ||||
| 			form.setAttribute('target',id); | ||||
| 			if (form.getAttribute('method') != 'POST') | ||||
| 				form.setAttribute('method', 'POST'); | ||||
| 			if (form.getAttribute('action') != opts.url) | ||||
| 				form.setAttribute('action', opts.url); | ||||
|  | ||||
| 			// ie borks in some cases when setting encoding | ||||
| 			if (! opts.skipEncodingOverride) { | ||||
| 				$form.attr({ | ||||
| 					encoding: 'multipart/form-data', | ||||
| 					enctype:  'multipart/form-data' | ||||
| 				}); | ||||
| 			} | ||||
|  | ||||
| 			// support timout | ||||
| 			if (opts.timeout) | ||||
| 				setTimeout(function() { timedOut = true; cb(); }, opts.timeout); | ||||
|  | ||||
| 			// add "extra" data to form if provided in options | ||||
| 			var extraInputs = []; | ||||
| 			try { | ||||
| 				if (opts.extraData) | ||||
| 					for (var n in opts.extraData) | ||||
| 						extraInputs.push( | ||||
| 							$('<input type="hidden" name="'+n+'" value="'+opts.extraData[n]+'" />') | ||||
| 								.appendTo(form)[0]); | ||||
|  | ||||
| 				// add iframe to doc and submit the form | ||||
| 				$io.appendTo('body'); | ||||
| 				$io.data('form-plugin-onload', cb); | ||||
| 				form.submit(); | ||||
| 			} | ||||
| 			finally { | ||||
| 				// reset attrs and remove "extra" input elements | ||||
| 				form.setAttribute('action',a); | ||||
| 				t ? form.setAttribute('target', t) : $form.removeAttr('target'); | ||||
| 				$(extraInputs).remove(); | ||||
| 			} | ||||
| 		}; | ||||
|  | ||||
| 		if (opts.forceSync) | ||||
| 			doSubmit(); | ||||
| 		else | ||||
| 			setTimeout(doSubmit, 10); // this lets dom updates render | ||||
| 	 | ||||
| 		var domCheckCount = 100; | ||||
|  | ||||
| 		function cb() { | ||||
| 			if (cbInvoked)  | ||||
| 				return; | ||||
|  | ||||
| 			var ok = true; | ||||
| 			try { | ||||
| 				if (timedOut) throw 'timeout'; | ||||
| 				// extract the server response from the iframe | ||||
| 				var data, doc; | ||||
|  | ||||
| 				doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document; | ||||
| 				 | ||||
| 				var isXml = opts.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); | ||||
| 				log('isXml='+isXml); | ||||
| 				if (!isXml && (doc.body == null || doc.body.innerHTML == '')) { | ||||
| 				 	if (--domCheckCount) { | ||||
| 						// in some browsers (Opera) the iframe DOM is not always traversable when | ||||
| 						// the onload callback fires, so we loop a bit to accommodate | ||||
| 				 		log('requeing onLoad callback, DOM not available'); | ||||
| 						setTimeout(cb, 250); | ||||
| 						return; | ||||
| 					} | ||||
| 					log('Could not access iframe DOM after 100 tries.'); | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| 				log('response detected'); | ||||
| 				cbInvoked = true; | ||||
| 				xhr.responseText = doc.body ? doc.body.innerHTML : null; | ||||
| 				xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; | ||||
| 				xhr.getResponseHeader = function(header){ | ||||
| 					var headers = {'content-type': opts.dataType}; | ||||
| 					return headers[header]; | ||||
| 				}; | ||||
|  | ||||
| 				if (opts.dataType == 'json' || opts.dataType == 'script') { | ||||
| 					// see if user embedded response in textarea | ||||
| 					var ta = doc.getElementsByTagName('textarea')[0]; | ||||
| 					if (ta) | ||||
| 						xhr.responseText = ta.value; | ||||
| 					else { | ||||
| 						// account for browsers injecting pre around json response | ||||
| 						var pre = doc.getElementsByTagName('pre')[0]; | ||||
| 						if (pre) | ||||
| 							xhr.responseText = pre.innerHTML; | ||||
| 					}			   | ||||
| 				} | ||||
| 				else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) { | ||||
| 					xhr.responseXML = toXml(xhr.responseText); | ||||
| 				} | ||||
| 				data = $.httpData(xhr, opts.dataType); | ||||
| 			} | ||||
| 			catch(e){ | ||||
| 				log('error caught:',e); | ||||
| 				ok = false; | ||||
| 				xhr.error = e; | ||||
| 				$.handleError(opts, xhr, 'error', e); | ||||
| 			} | ||||
|  | ||||
| 			// ordering of these callbacks/triggers is odd, but that's how $.ajax does it | ||||
| 			if (ok) { | ||||
| 				opts.success(data, 'success'); | ||||
| 				if (g) $.event.trigger("ajaxSuccess", [xhr, opts]); | ||||
| 			} | ||||
| 			if (g) $.event.trigger("ajaxComplete", [xhr, opts]); | ||||
| 			if (g && ! --$.active) $.event.trigger("ajaxStop"); | ||||
| 			if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error'); | ||||
|  | ||||
| 			// clean up | ||||
| 			setTimeout(function() { | ||||
| 				$io.removeData('form-plugin-onload'); | ||||
| 				$io.remove(); | ||||
| 				xhr.responseXML = null; | ||||
| 			}, 100); | ||||
| 		}; | ||||
|  | ||||
| 		function toXml(s, doc) { | ||||
| 			if (window.ActiveXObject) { | ||||
| 				doc = new ActiveXObject('Microsoft.XMLDOM'); | ||||
| 				doc.async = 'false'; | ||||
| 				doc.loadXML(s); | ||||
| 			} | ||||
| 			else | ||||
| 				doc = (new DOMParser()).parseFromString(s, 'text/xml'); | ||||
| 			return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * ajaxForm() provides a mechanism for fully automating form submission. | ||||
|  * | ||||
|  * The advantages of using this method instead of ajaxSubmit() are: | ||||
|  * | ||||
|  * 1: This method will include coordinates for <input type="image" /> elements (if the element | ||||
|  *	is used to submit the form). | ||||
|  * 2. This method will include the submit element's name/value data (for the element that was | ||||
|  *	used to submit the form). | ||||
|  * 3. This method binds the submit() method to the form for you. | ||||
|  * | ||||
|  * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely | ||||
|  * passes the options argument along after properly binding events for submit elements and | ||||
|  * the form itself. | ||||
|  */ | ||||
| $.fn.ajaxForm = function(options) { | ||||
| 	return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) { | ||||
| 		e.preventDefault(); | ||||
| 		$(this).ajaxSubmit(options); | ||||
| 	}).bind('click.form-plugin', function(e) { | ||||
| 		var target = e.target; | ||||
| 		var $el = $(target); | ||||
| 		if (!($el.is(":submit,input:image"))) { | ||||
| 			// is this a child element of the submit el?  (ex: a span within a button) | ||||
| 			var t = $el.closest(':submit'); | ||||
| 			if (t.length == 0) | ||||
| 				return; | ||||
| 			target = t[0]; | ||||
| 		} | ||||
| 		var form = this; | ||||
| 		form.clk = target; | ||||
| 		if (target.type == 'image') { | ||||
| 			if (e.offsetX != undefined) { | ||||
| 				form.clk_x = e.offsetX; | ||||
| 				form.clk_y = e.offsetY; | ||||
| 			} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin | ||||
| 				var offset = $el.offset(); | ||||
| 				form.clk_x = e.pageX - offset.left; | ||||
| 				form.clk_y = e.pageY - offset.top; | ||||
| 			} else { | ||||
| 				form.clk_x = e.pageX - target.offsetLeft; | ||||
| 				form.clk_y = e.pageY - target.offsetTop; | ||||
| 			} | ||||
| 		} | ||||
| 		// clear form vars | ||||
| 		setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); | ||||
| 	}); | ||||
| }; | ||||
|  | ||||
| // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm | ||||
| $.fn.ajaxFormUnbind = function() { | ||||
| 	return this.unbind('submit.form-plugin click.form-plugin'); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * formToArray() gathers form element data into an array of objects that can | ||||
|  * be passed to any of the following ajax functions: $.get, $.post, or load. | ||||
|  * Each object in the array has both a 'name' and 'value' property.  An example of | ||||
|  * an array for a simple login form might be: | ||||
|  * | ||||
|  * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] | ||||
|  * | ||||
|  * It is this array that is passed to pre-submit callback functions provided to the | ||||
|  * ajaxSubmit() and ajaxForm() methods. | ||||
|  */ | ||||
| $.fn.formToArray = function(semantic) { | ||||
| 	var a = []; | ||||
| 	if (this.length == 0) return a; | ||||
|  | ||||
| 	var form = this[0]; | ||||
| 	var els = semantic ? form.getElementsByTagName('*') : form.elements; | ||||
| 	if (!els) return a; | ||||
| 	for(var i=0, max=els.length; i < max; i++) { | ||||
| 		var el = els[i]; | ||||
| 		var n = el.name; | ||||
| 		if (!n) continue; | ||||
|  | ||||
| 		if (semantic && form.clk && el.type == "image") { | ||||
| 			// handle image inputs on the fly when semantic == true | ||||
| 			if(!el.disabled && form.clk == el) { | ||||
| 				a.push({name: n, value: $(el).val()}); | ||||
| 				a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); | ||||
| 			} | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		var v = $.fieldValue(el, true); | ||||
| 		if (v && v.constructor == Array) { | ||||
| 			for(var j=0, jmax=v.length; j < jmax; j++) | ||||
| 				a.push({name: n, value: v[j]}); | ||||
| 		} | ||||
| 		else if (v !== null && typeof v != 'undefined') | ||||
| 			a.push({name: n, value: v}); | ||||
| 	} | ||||
|  | ||||
| 	if (!semantic && form.clk) { | ||||
| 		// input type=='image' are not found in elements array! handle it here | ||||
| 		var $input = $(form.clk), input = $input[0], n = input.name; | ||||
| 		if (n && !input.disabled && input.type == 'image') { | ||||
| 			a.push({name: n, value: $input.val()}); | ||||
| 			a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); | ||||
| 		} | ||||
| 	} | ||||
| 	return a; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Serializes form data into a 'submittable' string. This method will return a string | ||||
|  * in the format: name1=value1&name2=value2 | ||||
|  */ | ||||
| $.fn.formSerialize = function(semantic) { | ||||
| 	//hand off to jQuery.param for proper encoding | ||||
| 	return $.param(this.formToArray(semantic)); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Serializes all field elements in the jQuery object into a query string. | ||||
|  * This method will return a string in the format: name1=value1&name2=value2 | ||||
|  */ | ||||
| $.fn.fieldSerialize = function(successful) { | ||||
| 	var a = []; | ||||
| 	this.each(function() { | ||||
| 		var n = this.name; | ||||
| 		if (!n) return; | ||||
| 		var v = $.fieldValue(this, successful); | ||||
| 		if (v && v.constructor == Array) { | ||||
| 			for (var i=0,max=v.length; i < max; i++) | ||||
| 				a.push({name: n, value: v[i]}); | ||||
| 		} | ||||
| 		else if (v !== null && typeof v != 'undefined') | ||||
| 			a.push({name: this.name, value: v}); | ||||
| 	}); | ||||
| 	//hand off to jQuery.param for proper encoding | ||||
| 	return $.param(a); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Returns the value(s) of the element in the matched set.  For example, consider the following form: | ||||
|  * | ||||
|  *  <form><fieldset> | ||||
|  *	  <input name="A" type="text" /> | ||||
|  *	  <input name="A" type="text" /> | ||||
|  *	  <input name="B" type="checkbox" value="B1" /> | ||||
|  *	  <input name="B" type="checkbox" value="B2"/> | ||||
|  *	  <input name="C" type="radio" value="C1" /> | ||||
|  *	  <input name="C" type="radio" value="C2" /> | ||||
|  *  </fieldset></form> | ||||
|  * | ||||
|  *  var v = $(':text').fieldValue(); | ||||
|  *  // if no values are entered into the text inputs | ||||
|  *  v == ['',''] | ||||
|  *  // if values entered into the text inputs are 'foo' and 'bar' | ||||
|  *  v == ['foo','bar'] | ||||
|  * | ||||
|  *  var v = $(':checkbox').fieldValue(); | ||||
|  *  // if neither checkbox is checked | ||||
|  *  v === undefined | ||||
|  *  // if both checkboxes are checked | ||||
|  *  v == ['B1', 'B2'] | ||||
|  * | ||||
|  *  var v = $(':radio').fieldValue(); | ||||
|  *  // if neither radio is checked | ||||
|  *  v === undefined | ||||
|  *  // if first radio is checked | ||||
|  *  v == ['C1'] | ||||
|  * | ||||
|  * The successful argument controls whether or not the field element must be 'successful' | ||||
|  * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). | ||||
|  * The default value of the successful argument is true.  If this value is false the value(s) | ||||
|  * for each element is returned. | ||||
|  * | ||||
|  * Note: This method *always* returns an array.  If no valid value can be determined the | ||||
|  *	   array will be empty, otherwise it will contain one or more values. | ||||
|  */ | ||||
| $.fn.fieldValue = function(successful) { | ||||
| 	for (var val=[], i=0, max=this.length; i < max; i++) { | ||||
| 		var el = this[i]; | ||||
| 		var v = $.fieldValue(el, successful); | ||||
| 		if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) | ||||
| 			continue; | ||||
| 		v.constructor == Array ? $.merge(val, v) : val.push(v); | ||||
| 	} | ||||
| 	return val; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Returns the value of the field element. | ||||
|  */ | ||||
| $.fieldValue = function(el, successful) { | ||||
| 	var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); | ||||
| 	if (typeof successful == 'undefined') successful = true; | ||||
|  | ||||
| 	if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || | ||||
| 		(t == 'checkbox' || t == 'radio') && !el.checked || | ||||
| 		(t == 'submit' || t == 'image') && el.form && el.form.clk != el || | ||||
| 		tag == 'select' && el.selectedIndex == -1)) | ||||
| 			return null; | ||||
|  | ||||
| 	if (tag == 'select') { | ||||
| 		var index = el.selectedIndex; | ||||
| 		if (index < 0) return null; | ||||
| 		var a = [], ops = el.options; | ||||
| 		var one = (t == 'select-one'); | ||||
| 		var max = (one ? index+1 : ops.length); | ||||
| 		for(var i=(one ? index : 0); i < max; i++) { | ||||
| 			var op = ops[i]; | ||||
| 			if (op.selected) { | ||||
| 				var v = op.value; | ||||
| 				if (!v) // extra pain for IE... | ||||
| 					v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value; | ||||
| 				if (one) return v; | ||||
| 				a.push(v); | ||||
| 			} | ||||
| 		} | ||||
| 		return a; | ||||
| 	} | ||||
| 	return el.value; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Clears the form data.  Takes the following actions on the form's input fields: | ||||
|  *  - input text fields will have their 'value' property set to the empty string | ||||
|  *  - select elements will have their 'selectedIndex' property set to -1 | ||||
|  *  - checkbox and radio inputs will have their 'checked' property set to false | ||||
|  *  - inputs of type submit, button, reset, and hidden will *not* be effected | ||||
|  *  - button elements will *not* be effected | ||||
|  */ | ||||
| $.fn.clearForm = function() { | ||||
| 	return this.each(function() { | ||||
| 		$('input,select,textarea', this).clearFields(); | ||||
| 	}); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Clears the selected form elements. | ||||
|  */ | ||||
| $.fn.clearFields = $.fn.clearInputs = function() { | ||||
| 	return this.each(function() { | ||||
| 		var t = this.type, tag = this.tagName.toLowerCase(); | ||||
| 		if (t == 'text' || t == 'password' || tag == 'textarea') | ||||
| 			this.value = ''; | ||||
| 		else if (t == 'checkbox' || t == 'radio') | ||||
| 			this.checked = false; | ||||
| 		else if (tag == 'select') | ||||
| 			this.selectedIndex = -1; | ||||
| 	}); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Resets the form data.  Causes all form elements to be reset to their original value. | ||||
|  */ | ||||
| $.fn.resetForm = function() { | ||||
| 	return this.each(function() { | ||||
| 		// guard against an input with the name of 'reset' | ||||
| 		// note that IE reports the reset function as an 'object' | ||||
| 		if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) | ||||
| 			this.reset(); | ||||
| 	}); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Enables or disables any matching elements. | ||||
|  */ | ||||
| $.fn.enable = function(b) { | ||||
| 	if (b == undefined) b = true; | ||||
| 	return this.each(function() { | ||||
| 		this.disabled = !b; | ||||
| 	}); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Checks/unchecks any matching checkboxes or radio buttons and | ||||
|  * selects/deselects and matching option elements. | ||||
|  */ | ||||
| $.fn.selected = function(select) { | ||||
| 	if (select == undefined) select = true; | ||||
| 	return this.each(function() { | ||||
| 		var t = this.type; | ||||
| 		if (t == 'checkbox' || t == 'radio') | ||||
| 			this.checked = select; | ||||
| 		else if (this.tagName.toLowerCase() == 'option') { | ||||
| 			var $sel = $(this).parent('select'); | ||||
| 			if (select && $sel[0] && $sel[0].type == 'select-one') { | ||||
| 				// deselect all other options | ||||
| 				$sel.find('option').selected(false); | ||||
| 			} | ||||
| 			this.selected = select; | ||||
| 		} | ||||
| 	}); | ||||
| }; | ||||
|  | ||||
| // helper fn for console logging | ||||
| // set $.fn.ajaxSubmit.debug to true to enable debug logging | ||||
| function log() { | ||||
| 	if ($.fn.ajaxSubmit.debug) { | ||||
| 		var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); | ||||
| 		if (window.console && window.console.log) | ||||
| 			window.console.log(msg); | ||||
| 		else if (window.opera && window.opera.postError) | ||||
| 			window.opera.postError(msg); | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| })(jQuery); | ||||
							
								
								
									
										28
									
								
								xCAT-UI/js/jquery/jquery.form.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								xCAT-UI/js/jquery/jquery.form.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| /* | ||||
|  jQuery Form Plugin | ||||
|  version: 2.43 (12-MAR-2010) | ||||
|  @requires jQuery v1.3.2 or later | ||||
|  | ||||
|  Examples and documentation at: http://malsup.com/jquery/form/ | ||||
|  Dual licensed under the MIT and GPL licenses: | ||||
|  http://www.opensource.org/licenses/mit-license.php | ||||
|  http://www.gnu.org/licenses/gpl.html | ||||
| */ | ||||
| (function(b){function o(){if(b.fn.ajaxSubmit.debug){var a="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log)window.console.log(a);else window.opera&&window.opera.postError&&window.opera.postError(a)}}b.fn.ajaxSubmit=function(a){function e(){function s(){var q=h.attr("target"),n=h.attr("action");k.setAttribute("target",z);k.getAttribute("method")!="POST"&&k.setAttribute("method","POST");k.getAttribute("action")!=g.url&&k.setAttribute("action",g.url);g.skipEncodingOverride|| | ||||
| h.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});g.timeout&&setTimeout(function(){C=true;t()},g.timeout);var m=[];try{if(g.extraData)for(var v in g.extraData)m.push(b('<input type="hidden" name="'+v+'" value="'+g.extraData[v]+'" />').appendTo(k)[0]);u.appendTo("body");u.data("form-plugin-onload",t);k.submit()}finally{k.setAttribute("action",n);q?k.setAttribute("target",q):h.removeAttr("target");b(m).remove()}}function t(){if(!D){var q=true;try{if(C)throw"timeout";var n,m;m=w.contentWindow? | ||||
| w.contentWindow.document:w.contentDocument?w.contentDocument:w.document;var v=g.dataType=="xml"||m.XMLDocument||b.isXMLDoc(m);o("isXml="+v);if(!v&&(m.body==null||m.body.innerHTML=="")){if(--G){o("requeing onLoad callback, DOM not available");setTimeout(t,250);return}o("Could not access iframe DOM after 100 tries.");return}o("response detected");D=true;j.responseText=m.body?m.body.innerHTML:null;j.responseXML=m.XMLDocument?m.XMLDocument:m;j.getResponseHeader=function(H){return{"content-type":g.dataType}[H]}; | ||||
| if(g.dataType=="json"||g.dataType=="script"){var E=m.getElementsByTagName("textarea")[0];if(E)j.responseText=E.value;else{var F=m.getElementsByTagName("pre")[0];if(F)j.responseText=F.innerHTML}}else if(g.dataType=="xml"&&!j.responseXML&&j.responseText!=null)j.responseXML=A(j.responseText);n=b.httpData(j,g.dataType)}catch(B){o("error caught:",B);q=false;j.error=B;b.handleError(g,j,"error",B)}if(q){g.success(n,"success");x&&b.event.trigger("ajaxSuccess",[j,g])}x&&b.event.trigger("ajaxComplete",[j,g]); | ||||
| x&&!--b.active&&b.event.trigger("ajaxStop");if(g.complete)g.complete(j,q?"success":"error");setTimeout(function(){u.removeData("form-plugin-onload");u.remove();j.responseXML=null},100)}}function A(q,n){if(window.ActiveXObject){n=new ActiveXObject("Microsoft.XMLDOM");n.async="false";n.loadXML(q)}else n=(new DOMParser).parseFromString(q,"text/xml");return n&&n.documentElement&&n.documentElement.tagName!="parsererror"?n:null}var k=h[0];if(b(":input[name=submit]",k).length)alert('Error: Form elements must not be named "submit".'); | ||||
| else{var g=b.extend({},b.ajaxSettings,a),r=b.extend(true,{},b.extend(true,{},b.ajaxSettings),g),z="jqFormIO"+(new Date).getTime(),u=b('<iframe id="'+z+'" name="'+z+'" src="'+g.iframeSrc+'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />'),w=u[0];u.css({position:"absolute",top:"-1000px",left:"-1000px"});var j={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted= | ||||
| 1;u.attr("src",g.iframeSrc)}},x=g.global;x&&!b.active++&&b.event.trigger("ajaxStart");x&&b.event.trigger("ajaxSend",[j,g]);if(r.beforeSend&&r.beforeSend(j,r)===false)r.global&&b.active--;else if(!j.aborted){var D=false,C=0;if(r=k.clk){var y=r.name;if(y&&!r.disabled){g.extraData=g.extraData||{};g.extraData[y]=r.value;if(r.type=="image"){g.extraData[y+".x"]=k.clk_x;g.extraData[y+".y"]=k.clk_y}}}g.forceSync?s():setTimeout(s,10);var G=100}}}if(!this.length){o("ajaxSubmit: skipping submit process - no element selected"); | ||||
| return this}if(typeof a=="function")a={success:a};var c=b.trim(this.attr("action"));if(c)c=(c.match(/^([^#]+)/)||[])[1];c=c||window.location.href||"";a=b.extend({url:c,type:this.attr("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},a||{});c={};this.trigger("form-pre-serialize",[this,a,c]);if(c.veto){o("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(a.beforeSerialize&&a.beforeSerialize(this,a)===false){o("ajaxSubmit: submit aborted via beforeSerialize callback"); | ||||
| return this}var f=this.formToArray(a.semantic);if(a.data){a.extraData=a.data;for(var d in a.data)if(a.data[d]instanceof Array)for(var l in a.data[d])f.push({name:d,value:a.data[d][l]});else f.push({name:d,value:a.data[d]})}if(a.beforeSubmit&&a.beforeSubmit(f,this,a)===false){o("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[f,this,a,c]);if(c.veto){o("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}d=b.param(f);if(a.type.toUpperCase()== | ||||
| "GET"){a.url+=(a.url.indexOf("?")>=0?"&":"?")+d;a.data=null}else a.data=d;var h=this,i=[];a.resetForm&&i.push(function(){h.resetForm()});a.clearForm&&i.push(function(){h.clearForm()});if(!a.dataType&&a.target){var p=a.success||function(){};i.push(function(s){var t=a.replaceTarget?"replaceWith":"html";b(a.target)[t](s).each(p,arguments)})}else a.success&&i.push(a.success);a.success=function(s,t,A){for(var k=0,g=i.length;k<g;k++)i[k].apply(a,[s,t,A||h,h])};d=b("input:file",this).fieldValue();l=false; | ||||
| for(c=0;c<d.length;c++)if(d[c])l=true;if(d.length&&a.iframe!==false||a.iframe||l||0)a.closeKeepAlive?b.get(a.closeKeepAlive,e):e();else b.ajax(a);this.trigger("form-submit-notify",[this,a]);return this};b.fn.ajaxForm=function(a){return this.ajaxFormUnbind().bind("submit.form-plugin",function(e){e.preventDefault();b(this).ajaxSubmit(a)}).bind("click.form-plugin",function(e){var c=e.target,f=b(c);if(!f.is(":submit,input:image")){c=f.closest(":submit");if(c.length==0)return;c=c[0]}var d=this;d.clk=c; | ||||
| if(c.type=="image")if(e.offsetX!=undefined){d.clk_x=e.offsetX;d.clk_y=e.offsetY}else if(typeof b.fn.offset=="function"){f=f.offset();d.clk_x=e.pageX-f.left;d.clk_y=e.pageY-f.top}else{d.clk_x=e.pageX-c.offsetLeft;d.clk_y=e.pageY-c.offsetTop}setTimeout(function(){d.clk=d.clk_x=d.clk_y=null},100)})};b.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};b.fn.formToArray=function(a){var e=[];if(this.length==0)return e;var c=this[0],f=a?c.getElementsByTagName("*"):c.elements; | ||||
| if(!f)return e;for(var d=0,l=f.length;d<l;d++){var h=f[d],i=h.name;if(i)if(a&&c.clk&&h.type=="image"){if(!h.disabled&&c.clk==h){e.push({name:i,value:b(h).val()});e.push({name:i+".x",value:c.clk_x},{name:i+".y",value:c.clk_y})}}else if((h=b.fieldValue(h,true))&&h.constructor==Array)for(var p=0,s=h.length;p<s;p++)e.push({name:i,value:h[p]});else h!==null&&typeof h!="undefined"&&e.push({name:i,value:h})}if(!a&&c.clk){a=b(c.clk);f=a[0];if((i=f.name)&&!f.disabled&&f.type=="image"){e.push({name:i,value:a.val()}); | ||||
| e.push({name:i+".x",value:c.clk_x},{name:i+".y",value:c.clk_y})}}return e};b.fn.formSerialize=function(a){return b.param(this.formToArray(a))};b.fn.fieldSerialize=function(a){var e=[];this.each(function(){var c=this.name;if(c){var f=b.fieldValue(this,a);if(f&&f.constructor==Array)for(var d=0,l=f.length;d<l;d++)e.push({name:c,value:f[d]});else f!==null&&typeof f!="undefined"&&e.push({name:this.name,value:f})}});return b.param(e)};b.fn.fieldValue=function(a){for(var e=[],c=0,f=this.length;c<f;c++){var d= | ||||
| b.fieldValue(this[c],a);d===null||typeof d=="undefined"||d.constructor==Array&&!d.length||(d.constructor==Array?b.merge(e,d):e.push(d))}return e};b.fieldValue=function(a,e){var c=a.name,f=a.type,d=a.tagName.toLowerCase();if(typeof e=="undefined")e=true;if(e&&(!c||a.disabled||f=="reset"||f=="button"||(f=="checkbox"||f=="radio")&&!a.checked||(f=="submit"||f=="image")&&a.form&&a.form.clk!=a||d=="select"&&a.selectedIndex==-1))return null;if(d=="select"){var l=a.selectedIndex;if(l<0)return null;c=[];d= | ||||
| a.options;var h=(f=f=="select-one")?l+1:d.length;for(l=f?l:0;l<h;l++){var i=d[l];if(i.selected){var p=i.value;p||(p=i.attributes&&i.attributes.value&&!i.attributes.value.specified?i.text:i.value);if(f)return p;c.push(p)}}return c}return a.value};b.fn.clearForm=function(){return this.each(function(){b("input,select,textarea",this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var a=this.type,e=this.tagName.toLowerCase();if(a=="text"||a=="password"||e=="textarea")this.value= | ||||
| "";else if(a=="checkbox"||a=="radio")this.checked=false;else if(e=="select")this.selectedIndex=-1})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType)this.reset()})};b.fn.enable=function(a){if(a==undefined)a=true;return this.each(function(){this.disabled=!a})};b.fn.selected=function(a){if(a==undefined)a=true;return this.each(function(){var e=this.type;if(e=="checkbox"||e=="radio")this.checked=a;else if(this.tagName.toLowerCase()== | ||||
| "option"){e=b(this).parent("select");a&&e[0]&&e[0].type=="select-one"&&e.find("option").selected(false);this.selected=a}})}})(jQuery); | ||||
| @@ -1,543 +0,0 @@ | ||||
| /* | ||||
|  * Jeditable - jQuery in place edit plugin | ||||
|  * | ||||
|  * Copyright (c) 2006-2009 Mika Tuupola, Dylan Verheul | ||||
|  * | ||||
|  * Licensed under the MIT license: | ||||
|  *   http://www.opensource.org/licenses/mit-license.php | ||||
|  * | ||||
|  * Project home: | ||||
|  *   http://www.appelsiini.net/projects/jeditable | ||||
|  * | ||||
|  * Based on editable by Dylan Verheul <dylan_at_dyve.net>: | ||||
|  *    http://www.dyve.net/jquery/?editable | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|   * Version 1.7.1 | ||||
|   * | ||||
|   * ** means there is basic unit tests for this parameter.  | ||||
|   * | ||||
|   * @name  Jeditable | ||||
|   * @type  jQuery | ||||
|   * @param String  target             (POST) URL or function to send edited content to ** | ||||
|   * @param Hash    options            additional options  | ||||
|   * @param String  options[method]    method to use to send edited content (POST or PUT) ** | ||||
|   * @param Function options[callback] Function to run after submitting edited content ** | ||||
|   * @param String  options[name]      POST parameter name of edited content | ||||
|   * @param String  options[id]        POST parameter name of edited div id | ||||
|   * @param Hash    options[submitdata] Extra parameters to send when submitting edited content. | ||||
|   * @param String  options[type]      text, textarea or select (or any 3rd party input type) ** | ||||
|   * @param Integer options[rows]      number of rows if using textarea **  | ||||
|   * @param Integer options[cols]      number of columns if using textarea ** | ||||
|   * @param Mixed   options[height]    'auto', 'none' or height in pixels ** | ||||
|   * @param Mixed   options[width]     'auto', 'none' or width in pixels ** | ||||
|   * @param String  options[loadurl]   URL to fetch input content before editing ** | ||||
|   * @param String  options[loadtype]  Request type for load url. Should be GET or POST. | ||||
|   * @param String  options[loadtext]  Text to display while loading external content. | ||||
|   * @param Mixed   options[loaddata]  Extra parameters to pass when fetching content before editing. | ||||
|   * @param Mixed   options[data]      Or content given as paramameter. String or function.** | ||||
|   * @param String  options[indicator] indicator html to show when saving | ||||
|   * @param String  options[tooltip]   optional tooltip text via title attribute ** | ||||
|   * @param String  options[event]     jQuery event such as 'click' of 'dblclick' ** | ||||
|   * @param String  options[submit]    submit button value, empty means no button ** | ||||
|   * @param String  options[cancel]    cancel button value, empty means no button ** | ||||
|   * @param String  options[cssclass]  CSS class to apply to input form. 'inherit' to copy from parent. ** | ||||
|   * @param String  options[style]     Style to apply to input form 'inherit' to copy from parent. ** | ||||
|   * @param String  options[select]    true or false, when true text is highlighted ?? | ||||
|   * @param String  options[placeholder] Placeholder text or html to insert when element is empty. ** | ||||
|   * @param String  options[onblur]    'cancel', 'submit', 'ignore' or function ?? | ||||
|   *              | ||||
|   * @param Function options[onsubmit] function(settings, original) { ... } called before submit | ||||
|   * @param Function options[onreset]  function(settings, original) { ... } called before reset | ||||
|   * @param Function options[onerror]  function(settings, original, xhr) { ... } called on error | ||||
|   *              | ||||
|   * @param Hash    options[ajaxoptions]  jQuery Ajax options. See docs.jquery.com. | ||||
|   *              | ||||
|   */ | ||||
|  | ||||
| (function($) { | ||||
|  | ||||
|     $.fn.editable = function(target, options) { | ||||
|              | ||||
|         if ('disable' == target) { | ||||
|             $(this).data('disabled.editable', true); | ||||
|             return; | ||||
|         } | ||||
|         if ('enable' == target) { | ||||
|             $(this).data('disabled.editable', false); | ||||
|             return; | ||||
|         } | ||||
|         if ('destroy' == target) { | ||||
|             $(this) | ||||
|                 .unbind($(this).data('event.editable')) | ||||
|                 .removeData('disabled.editable') | ||||
|                 .removeData('event.editable'); | ||||
|             return; | ||||
|         } | ||||
|          | ||||
|         var settings = $.extend({}, $.fn.editable.defaults, {target:target}, options); | ||||
|          | ||||
|         /* setup some functions */ | ||||
|         var plugin   = $.editable.types[settings.type].plugin || function() { }; | ||||
|         var submit   = $.editable.types[settings.type].submit || function() { }; | ||||
|         var buttons  = $.editable.types[settings.type].buttons  | ||||
|                     || $.editable.types['defaults'].buttons; | ||||
|         var content  = $.editable.types[settings.type].content  | ||||
|                     || $.editable.types['defaults'].content; | ||||
|         var element  = $.editable.types[settings.type].element  | ||||
|                     || $.editable.types['defaults'].element; | ||||
|         var reset    = $.editable.types[settings.type].reset  | ||||
|                     || $.editable.types['defaults'].reset; | ||||
|         var callback = settings.callback || function() { }; | ||||
|         var onedit   = settings.onedit   || function() { };  | ||||
|         var onsubmit = settings.onsubmit || function() { }; | ||||
|         var onreset  = settings.onreset  || function() { }; | ||||
|         var onerror  = settings.onerror  || reset; | ||||
|            | ||||
|         /* show tooltip */ | ||||
|         if (settings.tooltip) { | ||||
|             $(this).attr('title', settings.tooltip); | ||||
|         } | ||||
|          | ||||
|         settings.autowidth  = 'auto' == settings.width; | ||||
|         settings.autoheight = 'auto' == settings.height; | ||||
|          | ||||
|         return this.each(function() { | ||||
|                          | ||||
|             /* save this to self because this changes when scope changes */ | ||||
|             var self = this;   | ||||
|                     | ||||
|             /* inlined block elements lose their width and height after first edit */ | ||||
|             /* save them for later use as workaround */ | ||||
|             var savedwidth  = $(self).width(); | ||||
|             var savedheight = $(self).height(); | ||||
|              | ||||
|             /* save so it can be later used by $.editable('destroy') */ | ||||
|             $(this).data('event.editable', settings.event); | ||||
|              | ||||
|             /* if element is empty add something clickable (if requested) */ | ||||
|             if (!$.trim($(this).html())) { | ||||
|                 $(this).html(settings.placeholder); | ||||
|             } | ||||
|              | ||||
|             $(this).bind(settings.event, function(e) { | ||||
|                  | ||||
|                 /* abort if disabled for this element */ | ||||
|                 if (true === $(this).data('disabled.editable')) { | ||||
|                     return; | ||||
|                 } | ||||
|                  | ||||
|                 /* prevent throwing an exeption if edit field is clicked again */ | ||||
|                 if (self.editing) { | ||||
|                     return; | ||||
|                 } | ||||
|                  | ||||
|                 /* abort if onedit hook returns false */ | ||||
|                 if (false === onedit.apply(this, [settings, self])) { | ||||
|                    return; | ||||
|                 } | ||||
|                  | ||||
|                 /* prevent default action and bubbling */ | ||||
|                 e.preventDefault(); | ||||
|                 e.stopPropagation(); | ||||
|                  | ||||
|                 /* remove tooltip */ | ||||
|                 if (settings.tooltip) { | ||||
|                     $(self).removeAttr('title'); | ||||
|                 } | ||||
|                  | ||||
|                 /* figure out how wide and tall we are, saved width and height */ | ||||
|                 /* are workaround for http://dev.jquery.com/ticket/2190 */ | ||||
|                 if (0 == $(self).width()) { | ||||
|                     //$(self).css('visibility', 'hidden'); | ||||
|                     settings.width  = savedwidth; | ||||
|                     settings.height = savedheight; | ||||
|                 } else { | ||||
|                     if (settings.width != 'none') { | ||||
|                         settings.width =  | ||||
|                             settings.autowidth ? $(self).width()  : settings.width; | ||||
|                     } | ||||
|                     if (settings.height != 'none') { | ||||
|                         settings.height =  | ||||
|                             settings.autoheight ? $(self).height() : settings.height; | ||||
|                     } | ||||
|                 } | ||||
|                 //$(this).css('visibility', ''); | ||||
|                  | ||||
|                 /* remove placeholder text, replace is here because of IE */ | ||||
|                 if ($(this).html().toLowerCase().replace(/(;|")/g, '') ==  | ||||
|                     settings.placeholder.toLowerCase().replace(/(;|")/g, '')) { | ||||
|                         $(this).html(''); | ||||
|                 } | ||||
|                                  | ||||
|                 self.editing    = true; | ||||
|                 self.revert     = $(self).html(); | ||||
|                 $(self).html(''); | ||||
|  | ||||
|                 /* create the form object */ | ||||
|                 var form = $('<form />'); | ||||
|                  | ||||
|                 /* apply css or style or both */ | ||||
|                 if (settings.cssclass) { | ||||
|                     if ('inherit' == settings.cssclass) { | ||||
|                         form.attr('class', $(self).attr('class')); | ||||
|                     } else { | ||||
|                         form.attr('class', settings.cssclass); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 if (settings.style) { | ||||
|                     if ('inherit' == settings.style) { | ||||
|                         form.attr('style', $(self).attr('style')); | ||||
|                         /* IE needs the second line or display wont be inherited */ | ||||
|                         form.css('display', $(self).css('display'));                 | ||||
|                     } else { | ||||
|                         form.attr('style', settings.style); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 /* add main input element to form and store it in input */ | ||||
|                 var input = element.apply(form, [settings, self]); | ||||
|  | ||||
|                 /* set input content via POST, GET, given data or existing value */ | ||||
|                 var input_content; | ||||
|                  | ||||
|                 if (settings.loadurl) { | ||||
|                     var t = setTimeout(function() { | ||||
|                         input.disabled = true; | ||||
|                         content.apply(form, [settings.loadtext, settings, self]); | ||||
|                     }, 100); | ||||
|  | ||||
|                     var loaddata = {}; | ||||
|                     loaddata[settings.id] = self.id; | ||||
|                     if ($.isFunction(settings.loaddata)) { | ||||
|                         $.extend(loaddata, settings.loaddata.apply(self, [self.revert, settings])); | ||||
|                     } else { | ||||
|                         $.extend(loaddata, settings.loaddata); | ||||
|                     } | ||||
|                     $.ajax({ | ||||
|                        type : settings.loadtype, | ||||
|                        url  : settings.loadurl, | ||||
|                        data : loaddata, | ||||
|                        async : false, | ||||
|                        success: function(result) { | ||||
|                           window.clearTimeout(t); | ||||
|                           input_content = result; | ||||
|                           input.disabled = false; | ||||
|                        } | ||||
|                     }); | ||||
|                 } else if (settings.data) { | ||||
|                     input_content = settings.data; | ||||
|                     if ($.isFunction(settings.data)) { | ||||
|                         input_content = settings.data.apply(self, [self.revert, settings]); | ||||
|                     } | ||||
|                 } else { | ||||
|                     input_content = self.revert;  | ||||
|                 } | ||||
|                 content.apply(form, [input_content, settings, self]); | ||||
|  | ||||
|                 input.attr('name', settings.name); | ||||
|          | ||||
|                 /* add buttons to the form */ | ||||
|                 buttons.apply(form, [settings, self]); | ||||
|           | ||||
|                 /* add created form to self */ | ||||
|                 $(self).append(form); | ||||
|           | ||||
|                 /* attach 3rd party plugin if requested */ | ||||
|                 plugin.apply(form, [settings, self]); | ||||
|  | ||||
|                 /* focus to first visible form element */ | ||||
|                 $(':input:visible:enabled:first', form).focus(); | ||||
|  | ||||
|                 /* highlight input contents when requested */ | ||||
|                 if (settings.select) { | ||||
|                     input.select(); | ||||
|                 } | ||||
|          | ||||
|                 /* discard changes if pressing esc */ | ||||
|                 input.keydown(function(e) { | ||||
|                     if (e.keyCode == 27) { | ||||
|                         e.preventDefault(); | ||||
|                         //self.reset(); | ||||
|                         reset.apply(form, [settings, self]); | ||||
|                     } | ||||
|                 }); | ||||
|  | ||||
|                 /* discard, submit or nothing with changes when clicking outside */ | ||||
|                 /* do nothing is usable when navigating with tab */ | ||||
|                 var t; | ||||
|                 if ('cancel' == settings.onblur) { | ||||
|                     input.blur(function(e) { | ||||
|                         /* prevent canceling if submit was clicked */ | ||||
|                         t = setTimeout(function() { | ||||
|                             reset.apply(form, [settings, self]); | ||||
|                         }, 500); | ||||
|                     }); | ||||
|                 } else if ('submit' == settings.onblur) { | ||||
|                     input.blur(function(e) { | ||||
|                         /* prevent double submit if submit was clicked */ | ||||
|                         t = setTimeout(function() { | ||||
|                             form.submit(); | ||||
|                         }, 200); | ||||
|                     }); | ||||
|                 } else if ($.isFunction(settings.onblur)) { | ||||
|                     input.blur(function(e) { | ||||
|                         settings.onblur.apply(self, [input.val(), settings]); | ||||
|                     }); | ||||
|                 } else { | ||||
|                     input.blur(function(e) { | ||||
|                       /* TODO: maybe something here */ | ||||
|                     }); | ||||
|                 } | ||||
|  | ||||
|                 form.submit(function(e) { | ||||
|  | ||||
|                     if (t) {  | ||||
|                         clearTimeout(t); | ||||
|                     } | ||||
|  | ||||
|                     /* do no submit */ | ||||
|                     e.preventDefault();  | ||||
|              | ||||
|                     /* call before submit hook. */ | ||||
|                     /* if it returns false abort submitting */                     | ||||
|                     if (false !== onsubmit.apply(form, [settings, self])) {  | ||||
|                         /* custom inputs call before submit hook. */ | ||||
|                         /* if it returns false abort submitting */ | ||||
|                         if (false !== submit.apply(form, [settings, self])) {  | ||||
|  | ||||
|                           /* check if given target is function */ | ||||
|                           if ($.isFunction(settings.target)) { | ||||
|                               var str = settings.target.apply(self, [input.val(), settings]); | ||||
|                               $(self).html(str); | ||||
|                               self.editing = false; | ||||
|                               callback.apply(self, [self.innerHTML, settings]); | ||||
|                               /* TODO: this is not dry */                               | ||||
|                               if (!$.trim($(self).html())) { | ||||
|                                   $(self).html(settings.placeholder); | ||||
|                               } | ||||
|                           } else { | ||||
|                               /* add edited content and id of edited element to POST */ | ||||
|                               var submitdata = {}; | ||||
|                               submitdata[settings.name] = input.val(); | ||||
|                               submitdata[settings.id] = self.id; | ||||
|                               /* add extra data to be POST:ed */ | ||||
|                               if ($.isFunction(settings.submitdata)) { | ||||
|                                   $.extend(submitdata, settings.submitdata.apply(self, [self.revert, settings])); | ||||
|                               } else { | ||||
|                                   $.extend(submitdata, settings.submitdata); | ||||
|                               } | ||||
|  | ||||
|                               /* quick and dirty PUT support */ | ||||
|                               if ('PUT' == settings.method) { | ||||
|                                   submitdata['_method'] = 'put'; | ||||
|                               } | ||||
|  | ||||
|                               /* show the saving indicator */ | ||||
|                               $(self).html(settings.indicator); | ||||
|                                | ||||
|                               /* defaults for ajaxoptions */ | ||||
|                               var ajaxoptions = { | ||||
|                                   type    : 'POST', | ||||
|                                   data    : submitdata, | ||||
|                                   dataType: 'html', | ||||
|                                   url     : settings.target, | ||||
|                                   success : function(result, status) { | ||||
|                                       if (ajaxoptions.dataType == 'html') { | ||||
|                                         $(self).html(result); | ||||
|                                       } | ||||
|                                       self.editing = false; | ||||
|                                       callback.apply(self, [result, settings]); | ||||
|                                       if (!$.trim($(self).html())) { | ||||
|                                           $(self).html(settings.placeholder); | ||||
|                                       } | ||||
|                                   }, | ||||
|                                   error   : function(xhr, status, error) { | ||||
|                                       onerror.apply(form, [settings, self, xhr]); | ||||
|                                   } | ||||
|                               }; | ||||
|                                | ||||
|                               /* override with what is given in settings.ajaxoptions */ | ||||
|                               $.extend(ajaxoptions, settings.ajaxoptions);    | ||||
|                               $.ajax(ajaxoptions);           | ||||
|                                | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                      | ||||
|                     /* show tooltip again */ | ||||
|                     $(self).attr('title', settings.tooltip); | ||||
|                      | ||||
|                     return false; | ||||
|                 }); | ||||
|             }); | ||||
|              | ||||
|             /* privileged methods */ | ||||
|             this.reset = function(form) { | ||||
|                 /* prevent calling reset twice when blurring */ | ||||
|                 if (this.editing) { | ||||
|                     /* before reset hook, if it returns false abort reseting */ | ||||
|                     if (false !== onreset.apply(form, [settings, self])) {  | ||||
|                         $(self).html(self.revert); | ||||
|                         self.editing   = false; | ||||
|                         if (!$.trim($(self).html())) { | ||||
|                             $(self).html(settings.placeholder); | ||||
|                         } | ||||
|                         /* show tooltip again */ | ||||
|                         if (settings.tooltip) { | ||||
|                             $(self).attr('title', settings.tooltip);                 | ||||
|                         } | ||||
|                     }                     | ||||
|                 } | ||||
|             };             | ||||
|         }); | ||||
|  | ||||
|     }; | ||||
|  | ||||
|  | ||||
|     $.editable = { | ||||
|         types: { | ||||
|             defaults: { | ||||
|                 element : function(settings, original) { | ||||
|                     var input = $('<input type="hidden"></input>');                 | ||||
|                     $(this).append(input); | ||||
|                     return(input); | ||||
|                 }, | ||||
|                 content : function(string, settings, original) { | ||||
|                     $(':input:first', this).val(string); | ||||
|                 }, | ||||
|                 reset : function(settings, original) { | ||||
|                   original.reset(this); | ||||
|                 }, | ||||
|                 buttons : function(settings, original) { | ||||
|                     var form = this; | ||||
|                     if (settings.submit) { | ||||
|                         /* if given html string use that */ | ||||
|                         if (settings.submit.match(/>$/)) { | ||||
|                             var submit = $(settings.submit).click(function() { | ||||
|                                 if (submit.attr("type") != "submit") { | ||||
|                                     form.submit(); | ||||
|                                 } | ||||
|                             }); | ||||
|                         /* otherwise use button with given string as text */ | ||||
|                         } else { | ||||
|                             var submit = $('<button type="submit" />'); | ||||
|                             submit.html(settings.submit);                             | ||||
|                         } | ||||
|                         $(this).append(submit); | ||||
|                     } | ||||
|                     if (settings.cancel) { | ||||
|                         /* if given html string use that */ | ||||
|                         if (settings.cancel.match(/>$/)) { | ||||
|                             var cancel = $(settings.cancel); | ||||
|                         /* otherwise use button with given string as text */ | ||||
|                         } else { | ||||
|                             var cancel = $('<button type="cancel" />'); | ||||
|                             cancel.html(settings.cancel); | ||||
|                         } | ||||
|                         $(this).append(cancel); | ||||
|  | ||||
|                         $(cancel).click(function(event) { | ||||
|                             //original.reset(); | ||||
|                             if ($.isFunction($.editable.types[settings.type].reset)) { | ||||
|                                 var reset = $.editable.types[settings.type].reset;                                                                 | ||||
|                             } else { | ||||
|                                 var reset = $.editable.types['defaults'].reset;                                 | ||||
|                             } | ||||
|                             reset.apply(form, [settings, original]); | ||||
|                             return false; | ||||
|                         }); | ||||
|                     } | ||||
|                 } | ||||
|             }, | ||||
|             text: { | ||||
|                 element : function(settings, original) { | ||||
|                     var input = $('<input />'); | ||||
|                     if (settings.width  != 'none') { input.width(settings.width);  } | ||||
|                     if (settings.height != 'none') { input.height(settings.height); } | ||||
|                     /* https://bugzilla.mozilla.org/show_bug.cgi?id=236791 */ | ||||
|                     //input[0].setAttribute('autocomplete','off'); | ||||
|                     input.attr('autocomplete','off'); | ||||
|                     $(this).append(input); | ||||
|                     return(input); | ||||
|                 } | ||||
|             }, | ||||
|             textarea: { | ||||
|                 element : function(settings, original) { | ||||
|                     var textarea = $('<textarea />'); | ||||
|                     if (settings.rows) { | ||||
|                         textarea.attr('rows', settings.rows); | ||||
|                     } else if (settings.height != "none") { | ||||
|                         textarea.height(settings.height); | ||||
|                     } | ||||
|                     if (settings.cols) { | ||||
|                         textarea.attr('cols', settings.cols); | ||||
|                     } else if (settings.width != "none") { | ||||
|                         textarea.width(settings.width); | ||||
|                     } | ||||
|                     $(this).append(textarea); | ||||
|                     return(textarea); | ||||
|                 } | ||||
|             }, | ||||
|             select: { | ||||
|                element : function(settings, original) { | ||||
|                     var select = $('<select />'); | ||||
|                     $(this).append(select); | ||||
|                     return(select); | ||||
|                 }, | ||||
|                 content : function(data, settings, original) { | ||||
|                     /* If it is string assume it is json. */ | ||||
|                     if (String == data.constructor) {       | ||||
|                         eval ('var json = ' + data); | ||||
|                     } else { | ||||
|                     /* Otherwise assume it is a hash already. */ | ||||
|                         var json = data; | ||||
|                     } | ||||
|                     for (var key in json) { | ||||
|                         if (!json.hasOwnProperty(key)) { | ||||
|                             continue; | ||||
|                         } | ||||
|                         if ('selected' == key) { | ||||
|                             continue; | ||||
|                         }  | ||||
|                         var option = $('<option />').val(key).append(json[key]); | ||||
|                         $('select', this).append(option);     | ||||
|                     }                     | ||||
|                     /* Loop option again to set selected. IE needed this... */  | ||||
|                     $('select', this).children().each(function() { | ||||
|                         if ($(this).val() == json['selected'] ||  | ||||
|                             $(this).text() == $.trim(original.revert)) { | ||||
|                                 $(this).attr('selected', 'selected'); | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|  | ||||
|         /* Add new input type */ | ||||
|         addInputType: function(name, input) { | ||||
|             $.editable.types[name] = input; | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     // publicly accessible defaults | ||||
|     $.fn.editable.defaults = { | ||||
|         name       : 'value', | ||||
|         id         : 'id', | ||||
|         type       : 'text', | ||||
|         width      : 'auto', | ||||
|         height     : 'auto', | ||||
|         event      : 'click.editable', | ||||
|         onblur     : 'cancel', | ||||
|         loadtype   : 'GET', | ||||
|         loadtext   : 'Loading...', | ||||
|         placeholder: 'Click to edit', | ||||
|         loaddata   : {}, | ||||
|         submitdata : {}, | ||||
|         ajaxoptions: {} | ||||
|     }; | ||||
|  | ||||
| })(jQuery); | ||||
							
								
								
									
										25
									
								
								xCAT-UI/js/jquery/jquery.jeditable.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								xCAT-UI/js/jquery/jquery.jeditable.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| /* | ||||
|  Jeditable - jQuery in place edit plugin | ||||
|  | ||||
|  Copyright (c) 2006-2009 Mika Tuupola, Dylan Verheul | ||||
|  | ||||
|  Licensed under the MIT license: | ||||
|  http://www.opensource.org/licenses/mit-license.php | ||||
|  | ||||
|  Project home: | ||||
|  http://www.appelsiini.net/projects/jeditable | ||||
|  | ||||
|  Based on editable by Dylan Verheul <dylan_at_dyve.net>: | ||||
|  http://www.dyve.net/jquery/?editable | ||||
| */ | ||||
| (function(a){a.fn.editable=function(d,e){if("disable"==d)a(this).data("disabled.editable",true);else if("enable"==d)a(this).data("disabled.editable",false);else if("destroy"==d)a(this).unbind(a(this).data("event.editable")).removeData("disabled.editable").removeData("event.editable");else{var b=a.extend({},a.fn.editable.defaults,{target:d},e),i=a.editable.types[b.type].plugin||function(){},j=a.editable.types[b.type].submit||function(){},s=a.editable.types[b.type].buttons||a.editable.types.defaults.buttons, | ||||
| q=a.editable.types[b.type].content||a.editable.types.defaults.content,t=a.editable.types[b.type].element||a.editable.types.defaults.element,o=a.editable.types[b.type].reset||a.editable.types.defaults.reset,r=b.callback||function(){},u=b.onedit||function(){},v=b.onsubmit||function(){},w=b.onreset||function(){},x=b.onerror||o;b.tooltip&&a(this).attr("title",b.tooltip);b.autowidth="auto"==b.width;b.autoheight="auto"==b.height;return this.each(function(){var c=this,y=a(c).width(),z=a(c).height();a(this).data("event.editable", | ||||
| b.event);a.trim(a(this).html())||a(this).html(b.placeholder);a(this).bind(b.event,function(k){if(true!==a(this).data("disabled.editable"))if(!c.editing)if(false!==u.apply(this,[b,c])){k.preventDefault();k.stopPropagation();b.tooltip&&a(c).removeAttr("title");if(0==a(c).width()){b.width=y;b.height=z}else{if(b.width!="none")b.width=b.autowidth?a(c).width():b.width;if(b.height!="none")b.height=b.autoheight?a(c).height():b.height}a(this).html().toLowerCase().replace(/(;|")/g,"")==b.placeholder.toLowerCase().replace(/(;|")/g, | ||||
| "")&&a(this).html("");c.editing=true;c.revert=a(c).html();a(c).html("");var f=a("<form />");if(b.cssclass)"inherit"==b.cssclass?f.attr("class",a(c).attr("class")):f.attr("class",b.cssclass);if(b.style)if("inherit"==b.style){f.attr("style",a(c).attr("style"));f.css("display",a(c).css("display"))}else f.attr("style",b.style);var h=t.apply(f,[b,c]),l;if(b.loadurl){var m=setTimeout(function(){h.disabled=true;q.apply(f,[b.loadtext,b,c])},100);k={};k[b.id]=c.id;a.isFunction(b.loaddata)?a.extend(k,b.loaddata.apply(c, | ||||
| [c.revert,b])):a.extend(k,b.loaddata);a.ajax({type:b.loadtype,url:b.loadurl,data:k,async:false,success:function(g){window.clearTimeout(m);l=g;h.disabled=false}})}else if(b.data){l=b.data;if(a.isFunction(b.data))l=b.data.apply(c,[c.revert,b])}else l=c.revert;q.apply(f,[l,b,c]);h.attr("name",b.name);s.apply(f,[b,c]);a(c).append(f);i.apply(f,[b,c]);a(":input:visible:enabled:first",f).focus();b.select&&h.select();h.keydown(function(g){if(g.keyCode==27){g.preventDefault();o.apply(f,[b,c])}});if("cancel"== | ||||
| b.onblur)h.blur(function(){m=setTimeout(function(){o.apply(f,[b,c])},500)});else if("submit"==b.onblur)h.blur(function(){m=setTimeout(function(){f.submit()},200)});else a.isFunction(b.onblur)?h.blur(function(){b.onblur.apply(c,[h.val(),b])}):h.blur(function(){});f.submit(function(g){m&&clearTimeout(m);g.preventDefault();if(false!==v.apply(f,[b,c]))if(false!==j.apply(f,[b,c]))if(a.isFunction(b.target)){g=b.target.apply(c,[h.val(),b]);a(c).html(g);c.editing=false;r.apply(c,[c.innerHTML,b]);a.trim(a(c).html())|| | ||||
| a(c).html(b.placeholder)}else{g={};g[b.name]=h.val();g[b.id]=c.id;a.isFunction(b.submitdata)?a.extend(g,b.submitdata.apply(c,[c.revert,b])):a.extend(g,b.submitdata);if("PUT"==b.method)g._method="put";a(c).html(b.indicator);var p={type:"POST",data:g,dataType:"html",url:b.target,success:function(n){p.dataType=="html"&&a(c).html(n);c.editing=false;r.apply(c,[n,b]);a.trim(a(c).html())||a(c).html(b.placeholder)},error:function(n){x.apply(f,[b,c,n])}};a.extend(p,b.ajaxoptions);a.ajax(p)}a(c).attr("title", | ||||
| b.tooltip);return false})}});this.reset=function(k){if(this.editing)if(false!==w.apply(k,[b,c])){a(c).html(c.revert);c.editing=false;a.trim(a(c).html())||a(c).html(b.placeholder);b.tooltip&&a(c).attr("title",b.tooltip)}}})}};a.editable={types:{defaults:{element:function(){var d=a('<input type="hidden"></input>');a(this).append(d);return d},content:function(d){a(":input:first",this).val(d)},reset:function(d,e){e.reset(this)},buttons:function(d,e){var b=this;if(d.submit){if(d.submit.match(/>$/))var i= | ||||
| a(d.submit).click(function(){i.attr("type")!="submit"&&b.submit()});else{i=a('<button type="submit" />');i.html(d.submit)}a(this).append(i)}if(d.cancel){if(d.cancel.match(/>$/))var j=a(d.cancel);else{j=a('<button type="cancel" />');j.html(d.cancel)}a(this).append(j);a(j).click(function(){(a.isFunction(a.editable.types[d.type].reset)?a.editable.types[d.type].reset:a.editable.types.defaults.reset).apply(b,[d,e]);return false})}}},text:{element:function(d){var e=a("<input />");d.width!="none"&&e.width(d.width); | ||||
| d.height!="none"&&e.height(d.height);e.attr("autocomplete","off");a(this).append(e);return e}},textarea:{element:function(d){var e=a("<textarea />");if(d.rows)e.attr("rows",d.rows);else d.height!="none"&&e.height(d.height);if(d.cols)e.attr("cols",d.cols);else d.width!="none"&&e.width(d.width);a(this).append(e);return e}},select:{element:function(){var d=a("<select />");a(this).append(d);return d},content:function(d,e,b){if(String==d.constructor)eval("var json = "+d);else var i=d;for(var j in i)if(i.hasOwnProperty(j))if("selected"!= | ||||
| j){d=a("<option />").val(j).append(i[j]);a("select",this).append(d)}a("select",this).children().each(function(){if(a(this).val()==i.selected||a(this).text()==a.trim(b.revert))a(this).attr("selected","selected")})}}},addInputType:function(d,e){a.editable.types[d]=e}};a.fn.editable.defaults={name:"value",id:"id",type:"text",width:"auto",height:"auto",event:"click.editable",onblur:"cancel",loadtype:"GET",loadtext:"Loading...",placeholder:"Click to edit",loaddata:{},submitdata:{},ajaxoptions:{}}})(jQuery); | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										176
									
								
								xCAT-UI/js/jquery/jquery.jstree.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										176
									
								
								xCAT-UI/js/jquery/jquery.jstree.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,176 @@ | ||||
| /* | ||||
|  jsTree 1.0-rc1 | ||||
|  http://jstree.com/ | ||||
|  | ||||
|  Copyright (c) 2010 Ivan Bozhanov (vakata.com) | ||||
|  | ||||
|  Dual licensed under the MIT and GPL licenses (same as jQuery): | ||||
|  http://www.opensource.org/licenses/mit-license.php | ||||
|  http://www.gnu.org/licenses/gpl.html | ||||
| */ | ||||
| (function(b){b.vakata={};b.vakata.css={get_css:function(a,d,e){a=a.toLowerCase();var g=e.cssRules||e.rules,i=0;do{if(g.length&&i>g.length+5)break;if(g[i].selectorText&&g[i].selectorText.toLowerCase()==a)if(d===true){e.removeRule&&e.removeRule(i);e.deleteRule&&e.deleteRule(i);return true}else return g[i]}while(g[++i]);return false},add_css:function(a,d){if(b.jstree.css.get_css(a,false,d))return false;d.insertRule?d.insertRule(a+" { }",0):d.addRule(a,null,0);return b.vakata.css.get_css(a)},remove_css:function(a, | ||||
| d){return b.vakata.css.get_css(a,true,d)},add_sheet:function(a){var d;if(a.str){d=document.createElement("style");d.setAttribute("type","text/css");if(d.styleSheet){document.getElementsByTagName("head")[0].appendChild(d);d.styleSheet.cssText=a.str}else{d.appendChild(document.createTextNode(a.str));document.getElementsByTagName("head")[0].appendChild(d)}return d.sheet||d.styleSheet}if(a.url)if(document.createStyleSheet)try{document.createStyleSheet(a.url)}catch(e){}else{d=document.createElement("link"); | ||||
| d.rel="stylesheet";d.type="text/css";d.media="all";d.href=a.url;document.getElementsByTagName("head")[0].appendChild(d);return d.styleSheet}}}})(jQuery); | ||||
| (function(b){var a=[],d=-1,e={},g={},i=false;b.fn.jstree=function(c){var f=typeof c=="string",h=Array.prototype.slice.call(arguments,1),j=this;!f&&b.meta&&h.push(b.metadata.get(this).jstree);c=!f&&h.length?b.extend.apply(null,[true,c].concat(h)):c;if(f&&c.substring(0,1)=="_")return j;f?this.each(function(){var l=a[b.data(this,"jstree-instance-id")];l=l&&b.isFunction(l[c])?l[c].apply(l,h):l;if(typeof l!=="undefined"&&(c.indexOf("is_"===0)||l!==true&&l!==false)){j=l;return false}}):this.each(function(){var l= | ||||
| b.data(this,"jstree-instance-id"),k=false;typeof l!=="undefined"&&a[l]&&a[l].destroy();l=parseInt(a.push({}),10)-1;b.data(this,"jstree-instance-id",l);c||(c={});c.plugins=b.isArray(c.plugins)?c.plugins:b.jstree.defaults.plugins;b.inArray("core",c.plugins)===-1&&c.plugins.unshift("core");k=b.extend(true,{},b.jstree.defaults,c);k.plugins=c.plugins;b.each(e,function(m){if(b.inArray(m,k.plugins)===-1){k[m]=null;delete k[m]}});a[l]=new b.jstree._instance(l,b(this).addClass("jstree jstree-"+l),k);b.each(a[l]._get_settings().plugins, | ||||
| function(m,n){a[l].data[n]={}});b.each(a[l]._get_settings().plugins,function(m,n){e[n]&&e[n].__init.apply(a[l])});a[l].init()});return j};b.jstree={defaults:{plugins:[]},_focused:function(){return a[d]||null},_reference:function(c){if(a[c])return a[c];var f=b(c);if(!f.length&&typeof c==="string")f=b("#"+c);if(!f.length)return null;return a[f.closest(".jstree").data("jstree-instance-id")]||null},_instance:function(c,f,h){this.data={core:{}};this.get_settings=function(){return b.extend(true,{},h)}; | ||||
| this._get_settings=function(){return h};this.get_index=function(){return c};this.get_container=function(){return f};this._set_settings=function(j){h=b.extend(true,{},h,j)}},_fn:{},plugin:function(c,f){f=b.extend({},{__init:b.noop,__destroy:b.noop,_fn:{},defaults:false},f);e[c]=f;b.jstree.defaults[c]=f.defaults;b.each(f._fn,function(h,j){j.plugin=c;j.old=b.jstree._fn[h];b.jstree._fn[h]=function(){var l,k=j,m=Array.prototype.slice.call(arguments);l=new b.Event("before.jstree");var n=false;do{if(k&& | ||||
| k.plugin&&b.inArray(k.plugin,this._get_settings().plugins)!==-1)break;k=k.old}while(k);if(k){l=this.get_container().triggerHandler(l,{func:h,inst:this,args:m});if(l!==false){if(typeof l!=="undefined")m=l;return l=h.indexOf("_")===0?k.apply(this,m):k.apply(b.extend({},this,{__callback:function(p){this.get_container().triggerHandler(h+".jstree",{inst:this,args:m,rslt:p,rlbk:n})},__rollback:function(){return n=this.get_rollback()},__call_old:function(p){return k.old.apply(this,p?Array.prototype.slice.call(arguments, | ||||
| 1):m)}}),m)}}};b.jstree._fn[h].old=j.old;b.jstree._fn[h].plugin=c})},rollback:function(c){if(c){b.isArray(c)||(c=[c]);b.each(c,function(f,h){a[h.i].set_rollback(h.h,h.d)})}}};b.jstree._fn=b.jstree._instance.prototype={};b(function(){var c=navigator.userAgent.toLowerCase(),f=(c.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],h=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } "; | ||||
| if(/msie/.test(c)&&parseInt(f,10)==6){i=true;h+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}if(/msie/.test(c)&& | ||||
| parseInt(f,10)==7)h+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } ";b.vakata.css.add_sheet({str:h})});b.jstree.plugin("core",{__init:function(){this.data.core.to_open=b.map(b.makeArray(this.get_settings().core.initially_open),function(c){return"#"+c.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/")})},defaults:{html_titles:false,animation:500,initially_open:[],rtl:false,strings:{loading:"Loading ...",new_node:"New node"}},_fn:{init:function(){this.set_focus(); | ||||
| this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl");this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins> </ins><a class='jstree-loading' href='#'><ins class='jstree-icon'> </ins>"+this._get_settings().core.strings.loading+"</a></li></ul>");this.data.core.li_height=this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height()||18;this.get_container().delegate("li > ins","click.jstree",b.proxy(function(c){var f= | ||||
| b(c.target);f.is("ins")&&c.pageY-f.offset().top<this.data.core.li_height&&this.toggle_node(f)},this)).bind("mousedown.jstree",b.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(){var c;if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){c=window.getSelection();try{c.removeAllRanges();c.collapse()}catch(f){}}});this.__callback();this.load_node(-1,function(){this.loaded();this.reopen()})},destroy:function(){var c,f=this.get_index(), | ||||
| h=this._get_settings(),j=this;b.each(h.plugins,function(l,k){try{e[k].__destroy.apply(j)}catch(m){}});this.__callback();if(this.is_focused())for(c in a)if(a.hasOwnProperty(c)&&c!=f){a[c].set_focus();break}if(f===d)d=-1;this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree-instance-id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/ig,"")});a[f]=null;delete a[f]},save_opened:function(){var c=this;this.data.core.to_open= | ||||
| [];this.get_container().find(".jstree-open").each(function(){c.data.core.to_open.push("#"+this.id.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/"))});this.__callback(c.data.core.to_open)},reopen:function(c){var f=this,h=true,j=[],l=[];if(!c){this.data.core.reopen=false;this.data.core.refreshing=true}if(this.data.core.to_open.length){b.each(this.data.core.to_open,function(k,m){if(m=="#")return true;b(m).length&&b(m).is(".jstree-closed")?j.push(m):l.push(m)});if(j.length){this.data.core.to_open= | ||||
| l;b.each(j,function(k,m){f.open_node(m,function(){f.reopen(true)},true)});h=false}}if(h){this.data.core.reopen&&clearTimeout(this.data.core.reopen);this.data.core.reopen=setTimeout(function(){f.__callback({},f)},50);this.data.core.refreshing=false}},refresh:function(c){var f=this;this.save_opened();c||(c=-1);(c=this._get_node(c))||(c=-1);c!==-1&&c.children("UL").remove();this.load_node(c,function(){f.__callback({obj:c});f.reopen()})},loaded:function(){this.__callback()},set_focus:function(){var c= | ||||
| b.jstree._focused();c&&c!==this&&c.get_container().removeClass("jstree-focused");if(c!==this){this.get_container().addClass("jstree-focused");d=this.get_index()}this.__callback()},is_focused:function(){return d==this.get_index()},_get_node:function(c){var f=b(c,this.get_container());if(f.is(".jstree")||c==-1)return-1;f=f.closest("li",this.get_container());return f.length?f:false},_get_next:function(c,f){c=this._get_node(c);if(c===-1)return this.get_container().find("> ul > li:first-child");if(!c.length)return false; | ||||
| if(f)return c.nextAll("li").size()>0?c.nextAll("li:eq(0)"):false;return c.hasClass("jstree-open")?c.find("li:eq(0)"):c.nextAll("li").size()>0?c.nextAll("li:eq(0)"):c.parentsUntil(".jstree","li").next("li").eq(0)},_get_prev:function(c,f){c=this._get_node(c);if(c===-1)return this.get_container().find("> ul > li:last-child");if(!c.length)return false;if(f)return c.prevAll("li").length>0?c.prevAll("li:eq(0)"):false;if(c.prev("li").length){for(c=c.prev("li").eq(0);c.hasClass("jstree-open");)c=c.children("ul:eq(0)").children("li:last"); | ||||
| return c}else{var h=c.parentsUntil(".jstree","li:eq(0)");return h.length?h:false}},_get_parent:function(c){c=this._get_node(c);if(c==-1||!c.length)return false;c=c.parentsUntil(".jstree","li:eq(0)");return c.length?c:-1},_get_children:function(c){c=this._get_node(c);if(c===-1)return this.get_container().children("ul:eq(0)").children("li");if(!c.length)return false;return c.children("ul:eq(0)").children("li")},get_path:function(c,f){var h=[],j=this;c=this._get_node(c);if(c===-1||!c||!c.length)return false; | ||||
| c.parentsUntil(".jstree","li").each(function(){h.push(f?this.id:j.get_text(this))});h.reverse();h.push(f?c.attr("id"):this.get_text(c));return h},is_open:function(c){return(c=this._get_node(c))&&c!==-1&&c.hasClass("jstree-open")},is_closed:function(c){return(c=this._get_node(c))&&c!==-1&&c.hasClass("jstree-closed")},is_leaf:function(c){return(c=this._get_node(c))&&c!==-1&&c.hasClass("jstree-leaf")},open_node:function(c,f,h){c=this._get_node(c);if(!c.length)return false;if(!c.hasClass("jstree-closed")){f&& | ||||
| f.call();return false}var j=h||i?0:this._get_settings().core.animation,l=this;if(this._is_loaded(c)){j&&c.children("ul").css("display","none");c.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");j&&c.children("ul").stop(true).slideDown(j,function(){this.style.display=""});this.__callback({obj:c});f&&f.call()}else{c.children("a").addClass("jstree-loading");this.load_node(c,function(){l.open_node(c,f,h)},f)}},close_node:function(c,f){c=this._get_node(c); | ||||
| var h=f||i?0:this._get_settings().core.animation;if(!c.length||!c.hasClass("jstree-open"))return false;h&&c.children("ul").attr("style","display:block !important");c.removeClass("jstree-open").addClass("jstree-closed");h&&c.children("ul").stop(true).slideUp(h,function(){this.style.display=""});this.__callback({obj:c})},toggle_node:function(c){c=this._get_node(c);if(c.hasClass("jstree-closed"))return this.open_node(c);if(c.hasClass("jstree-open"))return this.close_node(c)},open_all:function(c,f){c= | ||||
| c?this._get_node(c):this.get_container();if(!c||c===-1)c=this.get_container();if(f)c=c.find("li.jstree-closed");else{f=c;c=c.is(".jstree-closed")?c.find("li.jstree-closed").andSelf():c.find("li.jstree-closed")}var h=this;c.each(function(){var j=this;h._is_loaded(this)?h.open_node(this,false,true):h.open_node(this,function(){h.open_all(j,f)},true)});f.find("li.jstree-closed").length===0&&this.__callback({obj:f})},close_all:function(c){var f=this;c=c?this._get_node(c):this.get_container();if(!c||c=== | ||||
| -1)c=this.get_container();c.find("li.jstree-open").andSelf().each(function(){f.close_node(this)});this.__callback({obj:c})},clean_node:function(c){c=c&&c!=-1?b(c):this.get_container();c=c.is("li")?c.find("li").andSelf():c.find("li");c.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");c.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();this.__callback({obj:c})}, | ||||
| get_rollback:function(){this.__callback();return{i:this.get_index(),h:this.get_container().children("ul").clone(true),d:this.data}},set_rollback:function(c,f){this.get_container().empty().append(c);this.data=f;this.__callback()},load_node:function(c){this.__callback({obj:c})},_is_loaded:function(){return true},create_node:function(c,f,h,j,l){c=this._get_node(c);f=typeof f==="undefined"?"last":f;var k=b("<li>"),m=this._get_settings().core,n;if(c!==-1&&!c.length)return false;if(!l&&!this._is_loaded(c)){this.load_node(c, | ||||
| function(){this.create_node(c,f,h,j,true)});return false}this.__rollback();if(typeof h==="string")h={data:h};h||(h={});h.attr&&k.attr(h.attr);h.state&&k.addClass("jstree-"+h.state);if(!h.data)h.data=m.strings.new_node;if(!b.isArray(h.data)){n=h.data;h.data=[];h.data.push(n)}b.each(h.data,function(p,o){n=b("<a>");if(b.isFunction(o))o=o.call(this,h);if(typeof o=="string")n.attr("href","#")[m.html_titles?"html":"text"](o);else{if(!o.attr)o.attr={};if(!o.attr.href)o.attr.href="#";n.attr(o.attr)[m.html_titles? | ||||
| "html":"text"](o.title);o.language&&n.addClass(o.language)}n.prepend("<ins class='jstree-icon'> </ins>");if(o.icon)o.icon.indexOf("/")===-1?n.children("ins").addClass(o.icon):n.children("ins").css("background","url('"+o.icon+"') center center no-repeat");k.append(n)});k.prepend("<ins class='jstree-icon'> </ins>");if(c===-1){c=this.get_container();if(f==="before")f="first";if(f==="after")f="last"}switch(f){case "before":c.before(k);n=this._get_parent(c);break;case "after":c.after(k);n=this._get_parent(c); | ||||
| break;case "inside":case "first":c.children("ul").length||c.append("<ul>");c.children("ul").prepend(k);n=c;break;case "last":c.children("ul").length||c.append("<ul>");c.children("ul").append(k);n=c;break;default:c.children("ul").length||c.append("<ul>");f||(f=0);n=c.children("ul").children("li").eq(f);n.length?n.before(k):c.children("ul").append(k);n=c}if(n===-1||n.get(0)===this.get_container().get(0))n=-1;this.clean_node(n);this.__callback({obj:k,parent:n});j&&j.call(this,k);return k},get_text:function(c){c= | ||||
| this._get_node(c);if(!c.length)return false;var f=this._get_settings().core.html_titles;c=c.children("a:eq(0)");if(f){c=c.clone();c.children("INS").remove();return c.html()}else{c=c.contents().filter(function(){return this.nodeType==3})[0];return c.nodeValue}},set_text:function(c,f){c=this._get_node(c);if(!c.length)return false;c=c.children("a:eq(0)");if(this._get_settings().core.html_titles){var h=c.children("INS").clone();c.html(f).prepend(h);this.__callback({obj:c,name:f});return true}else{c=c.contents().filter(function(){return this.nodeType== | ||||
| 3})[0];this.__callback({obj:c,name:f});return c.nodeValue=f}},rename_node:function(c,f){c=this._get_node(c);this.__rollback();c&&c.length&&this.set_text.apply(this,Array.prototype.slice.call(arguments))&&this.__callback({obj:c,name:f})},delete_node:function(c){c=this._get_node(c);if(!c.length)return false;this.__rollback();var f=this._get_parent(c),h=this._get_prev(c);c=c.remove();f!==-1&&f.find("> ul > li").length===0&&f.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");this.clean_node(f); | ||||
| this.__callback({obj:c,prev:h});return c},prepare_move:function(c,f,h,j,l){var k={};k.ot=b.jstree._reference(k.o)||this;k.o=k.ot._get_node(c);k.r=f===-1?-1:this._get_node(f);k.p=typeof k==="undefined"?"last":h;if(!(!l&&g.o&&g.o[0]===k.o[0]&&g.r[0]===k.r[0]&&g.p===k.p)){k.ot=b.jstree._reference(k.o)||this;k.rt=f===-1?k.ot:b.jstree._reference(k.r)||this;if(k.r===-1){k.cr=-1;switch(k.p){case "first":case "before":case "inside":k.cp=0;break;case "after":case "last":k.cp=k.rt.get_container().find(" > ul > li").length; | ||||
| break;default:k.cp=k.p}}else{if(!/^(before|after)$/.test(k.p)&&!this._is_loaded(k.r))return this.load_node(k.r,function(){this.prepare_move(c,f,h,j,true)});switch(k.p){case "before":k.cp=k.r.index();k.cr=k.rt._get_parent(k.r);break;case "after":k.cp=k.r.index()+1;k.cr=k.rt._get_parent(k.r);break;case "inside":case "first":k.cp=0;k.cr=k.r;break;case "last":k.cp=k.r.find(" > ul > li").length;k.cr=k.r;break;default:k.cp=k.p;k.cr=k.r}}k.np=k.cr==-1?k.rt.get_container():k.cr;k.op=k.ot._get_parent(k.o); | ||||
| k.or=k.np.find(" > ul > li:nth-child("+(k.cp+1)+")");g=k}this.__callback(g);j&&j.call(this,g)},check_move:function(){var c=g,f=true;if(c.or[0]===c.o[0])return false;c.o.each(function(){if(c.r.parentsUntil(".jstree").andSelf().filter("li").index(this)!==-1)return f=false});return f},move_node:function(c,f,h,j,l,k){if(!l)return this.prepare_move(c,f,h,function(n){this.move_node(n,false,false,j,true,k)});if(!k&&!this.check_move())return false;this.__rollback();f=false;if(j){f=c.o.clone();f.find("*[id]").andSelf().each(function(){if(this.id)this.id= | ||||
| "copy_"+this.id})}else f=c.o;if(c.or.length)c.or.before(f);else{c.np.children("ul").length||b("<ul>").appendTo(c.np);c.np.children("ul:eq(0)").append(f)}try{c.ot.clean_node(c.op);c.rt.clean_node(c.np);c.op.find("> ul > li").length||c.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove()}catch(m){}if(j){g.cy=true;g.oc=f}this.__callback(g);return g},_get_move:function(){return g}}})})(jQuery); | ||||
| (function(b){b.jstree.plugin("ui",{__init:function(){this.data.ui.selected=b();this.data.ui.last_selected=false;this.data.ui.hovered=null;this.data.ui.to_select=this.get_settings().ui.initially_select;this.get_container().delegate("a","click.jstree",b.proxy(function(a){a.preventDefault();this.select_node(a.currentTarget,true,a)},this)).delegate("a","mouseenter.jstree",b.proxy(function(a){this.hover_node(a.target)},this)).delegate("a","mouseleave.jstree",b.proxy(function(a){this.dehover_node(a.target)}, | ||||
| this)).bind("reopen.jstree",b.proxy(function(){this.reselect()},this)).bind("get_rollback.jstree",b.proxy(function(){this.dehover_node();this.save_selected()},this)).bind("set_rollback.jstree",b.proxy(function(){this.reselect()},this)).bind("close_node.jstree",b.proxy(function(a,d){var e=this._get_settings().ui,g=this._get_node(d.rslt.obj),i=g&&g.length?g.children("ul").find(".jstree-clicked"):b(),c=this;e.selected_parent_close===false||!i.length||i.each(function(){c.deselect_node(this);e.selected_parent_close=== | ||||
| "select_parent"&&c.select_node(g)})},this)).bind("delete_node.jstree",b.proxy(function(a,d){var e=this._get_settings().ui.select_prev_on_delete,g=this._get_node(d.rslt.obj);g=g&&g.length?g.find(".jstree-clicked"):[];var i=this;g.each(function(){i.deselect_node(this)});e&&g.length&&this.select_node(d.rslt.prev)},this)).bind("move_node.jstree",b.proxy(function(a,d){d.rslt.cy&&d.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked")},this))},defaults:{select_limit:-1,select_multiple_modifier:"ctrl", | ||||
| selected_parent_close:"select_parent",select_prev_on_delete:true,disable_selecting_children:false,initially_select:[]},_fn:{_get_node:function(a,d){if(typeof a==="undefined"||a===null)return d?this.data.ui.selected:this.data.ui.last_selected;var e=b(a,this.get_container());if(e.is(".jstree")||a==-1)return-1;e=e.closest("li",this.get_container());return e.length?e:false},save_selected:function(){var a=this;this.data.ui.to_select=[];this.data.ui.selected.each(function(){a.data.ui.to_select.push("#"+ | ||||
| this.id.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/"))});this.__callback(this.data.ui.to_select)},reselect:function(){var a=this,d=this.data.ui.to_select;d=b.map(b.makeArray(d),function(e){return"#"+e.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/")});this.deselect_all();b.each(d,function(e,g){g&&g!=="#"&&a.select_node(g)});this.__callback()},refresh:function(){this.save_selected();return this.__call_old()},hover_node:function(a){a=this._get_node(a);if(!a.length)return false; | ||||
| a.hasClass("jstree-hovered")||this.dehover_node();this.data.ui.hovered=a.children("a").addClass("jstree-hovered").parent();this.__callback({obj:a})},dehover_node:function(){var a=this.data.ui.hovered;if(!a||!a.length)return false;if(this.data.ui.hovered[0]===a.children("a").removeClass("jstree-hovered").parent()[0])this.data.ui.hovered=null;this.__callback({obj:a})},select_node:function(a,d,e){a=this._get_node(a);if(a==-1||!a||!a.length)return false;var g=this._get_settings().ui;e=g.select_multiple_modifier== | ||||
| "on"||g.select_multiple_modifier!==false&&e&&e[g.select_multiple_modifier+"Key"];var i=this.is_selected(a),c=true;if(d){if(g.disable_selecting_children&&e&&a.parents("li",this.get_container()).children(".jstree-clicked").length)return false;c=false;switch(true){case i&&!e:this.deselect_all();i=false;c=true;break;case !i&&!e:if(g.select_limit==-1||g.select_limit>0){this.deselect_all();c=true}break;case i&&e:this.deselect_node(a);break;case !i&&e:if(g.select_limit==-1||this.data.ui.selected.length+ | ||||
| 1<=g.select_limit)c=true}}if(c&&!i){a.children("a").addClass("jstree-clicked");this.data.ui.selected=this.data.ui.selected.add(a);this.data.ui.last_selected=a;this.__callback({obj:a})}},deselect_node:function(a){a=this._get_node(a);if(!a.length)return false;if(this.is_selected(a)){a.children("a").removeClass("jstree-clicked");this.data.ui.selected=this.data.ui.selected.not(a);if(this.data.ui.last_selected.get(0)===a.get(0))this.data.ui.last_selected=this.data.ui.selected.eq(0);this.__callback({obj:a})}}, | ||||
| toggle_select:function(a){a=this._get_node(a);if(!a.length)return false;this.is_selected(a)?this.deselect_node(a):this.select_node(a)},is_selected:function(a){return this.data.ui.selected.index(this._get_node(a))>=0},get_selected:function(a){return a?b(a).find(".jstree-clicked").parent():this.data.ui.selected},deselect_all:function(a){a?b(a).find(".jstree-clicked").removeClass("jstree-clicked"):this.get_container().find(".jstree-clicked").removeClass("jstree-clicked");this.data.ui.selected=b([]); | ||||
| this.data.ui.last_selected=false;this.__callback()}}});b.jstree.defaults.plugins.push("ui")})(jQuery); | ||||
| (function(b){b.jstree.plugin("crrm",{__init:function(){this.get_container().bind("move_node.jstree",b.proxy(function(a,d){if(this._get_settings().crrm.move.open_onmove){var e=this;d.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function(){e.open_node(this,false,true)})}},this))},defaults:{input_width_limit:200,move:{always_copy:false,open_onmove:true,default_position:"last",check_move:function(){return true}}},_fn:{_show_input:function(a,d){a=this._get_node(a);var e=this._get_settings().core.rtl, | ||||
| g=this._get_settings().crrm.input_width_limit,i=a.children("ins").width(),c=a.find("> a:visible > ins").width()*a.find("> a:visible > ins").length,f=this.get_text(a),h=b("<div>",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),j=a.css("position","relative").append(b("<input>",{value:f,css:{padding:"0",border:"1px solid silver",position:"absolute",left:e?"auto":i+c+4+"px",right:e?i+c+4+"px":"auto",top:"0px",height:this.data.core.li_height-2+"px", | ||||
| lineHeight:this.data.core.li_height-2+"px",width:"150px"},blur:b.proxy(function(){var l=a.children("input"),k=l.val();if(k==="")k=f;l.remove();this.set_text(a,f);this.rename_node(a,k);d.call(this,a,k,f);a.css("position","")},this),keyup:function(l){l=l.keyCode||l.which;if(l==27){this.value=f;this.blur()}else l==13?this.blur():j.width(Math.min(h.text("pW"+this.value).width(),g))}})).children("input");this.set_text(a,"");h.css({fontFamily:j.css("fontFamily")||"",fontSize:j.css("fontSize")||"",fontWeight:j.css("fontWeight")|| | ||||
| "",fontStyle:j.css("fontStyle")||"",fontStretch:j.css("fontStretch")||"",fontVariant:j.css("fontVariant")||"",letterSpacing:j.css("letterSpacing")||"",wordSpacing:j.css("wordSpacing")||""});j.width(Math.min(h.text("pW"+j[0].value).width(),g))[0].select()},rename:function(a){a=this._get_node(a);this.__rollback();var d=this.__callback;this._show_input(a,function(e,g,i){d.call(this,{obj:e,new_name:g,old_name:i})})},create:function(a,d,e,g,i){var c=this;(a=this._get_node(a))||(a=-1);this.__rollback(); | ||||
| return this.create_node(a,d,e,function(f){var h=this._get_parent(f),j=b(f).index();g&&g.call(this,f);h.length&&h.hasClass("jstree-closed")&&this.open_node(h,false,true);i?c.__callback({obj:f,name:this.get_text(f),parent:h,position:j}):this._show_input(f,function(l,k){c.__callback({obj:l,name:k,parent:h,position:j})})})},remove:function(a){a=this._get_node(a,true);this.__rollback();this.delete_node(a);this.__callback({obj:a})},check_move:function(){if(!this.__call_old())return false;if(!this._get_settings().crrm.move.check_move.call(this, | ||||
| this._get_move()))return false;return true},move_node:function(a,d,e,g,i,c){var f=this._get_settings().crrm.move;if(!i){if(!e)e=f.default_position;if(e==="inside"&&!f.default_position.match(/^(before|after)$/))e=f.default_position;return this.__call_old(true,a,d,e,g,false,c)}if(f.always_copy===true||f.always_copy==="multitree"&&a.rt.get_index()!==a.ot.get_index())g=true;this.__call_old(true,a,d,e,g,true,c)},cut:function(a){a=this._get_node(a);this.data.crrm.cp_nodes=false;this.data.crrm.ct_nodes= | ||||
| false;if(!a||!a.length)return false;this.data.crrm.ct_nodes=a},copy:function(a){a=this._get_node(a);this.data.crrm.cp_nodes=false;this.data.crrm.ct_nodes=false;if(!a||!a.length)return false;this.data.crrm.cp_nodes=a},paste:function(a){a=this._get_node(a);if(!a||!a.length)return false;if(!this.data.crrm.ct_nodes&&!this.data.crrm.cp_nodes)return false;this.data.crrm.ct_nodes&&this.move_node(this.data.crrm.ct_nodes,a);this.data.crrm.cp_nodes&&this.move_node(this.data.crrm.cp_nodes,a,false,true);this.data.crrm.cp_nodes= | ||||
| false;this.data.crrm.ct_nodes=false}}});b.jstree.defaults.plugins.push("crrm")})(jQuery); | ||||
| (function(b){var a=[];b.jstree._themes=false;b.jstree.plugin("themes",{__init:function(){this.get_container().bind("init.jstree",b.proxy(function(){var d=this._get_settings().themes;this.data.themes.dots=d.dots;this.data.themes.icons=d.icons;this.set_theme(d.theme,d.url)},this)).bind("loaded.jstree",b.proxy(function(){this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons()},this))},defaults:{theme:"default",url:false,dots:true,icons:true}, | ||||
| _fn:{set_theme:function(d,e){if(!d)return false;e||(e=b.jstree._themes+d+"/style.css");if(b.inArray(e,a)==-1){b.vakata.css.add_sheet({url:e,rel:"jstree"});a.push(e)}if(this.data.themes.theme!=d){this.get_container().removeClass("jstree-"+this.data.themes.theme);this.data.themes.theme=d}this.get_container().addClass("jstree-"+d);this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons();this.__callback()},get_theme:function(){return this.data.themes.theme}, | ||||
| show_dots:function(){this.data.themes.dots=true;this.get_container().children("ul").removeClass("jstree-no-dots")},hide_dots:function(){this.data.themes.dots=false;this.get_container().children("ul").addClass("jstree-no-dots")},toggle_dots:function(){this.data.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this.data.themes.icons=true;this.get_container().children("ul").removeClass("jstree-no-icons")},hide_icons:function(){this.data.themes.icons=false;this.get_container().children("ul").addClass("jstree-no-icons")}, | ||||
| toggle_icons:function(){this.data.themes.icons?this.hide_icons():this.show_icons()}}});b(function(){b.jstree._themes===false&&b("script").each(function(){if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)){b.jstree._themes=this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/,"")+"themes/";return false}});if(b.jstree._themes===false)b.jstree._themes="themes/"});b.jstree.defaults.plugins.push("themes")})(jQuery); | ||||
| (function(b){var a=[];b.jstree.plugin("hotkeys",{__init:function(){if(typeof b.hotkeys==="undefined")throw"jsTree hotkeys: jQuery hotkeys plugin not included.";if(!this.data.ui)throw"jsTree hotkeys: jsTree UI plugin not included.";b.each(this._get_settings().hotkeys,function(d){if(b.inArray(d,a)==-1){b(document).bind("keydown",d,function(e){var g;var i=b.jstree._focused(),c;if(i&&i.data&&i.data.hotkeys&&i.data.hotkeys.enabled)if(c=i._get_settings().hotkeys[d])g=c.call(i,e);return g});a.push(d)}}); | ||||
| this.enable_hotkeys()},defaults:{up:function(){this.hover_node(this._get_prev(this.data.ui.hovered||this.data.ui.last_selected||-1));return false},down:function(){this.hover_node(this._get_next(this.data.ui.hovered||this.data.ui.last_selected||-1));return false},left:function(){var d=this.data.ui.hovered||this.data.ui.last_selected;if(d)d.hasClass("jstree-open")?this.close_node(d):this.hover_node(this._get_prev(d));return false},right:function(){var d=this.data.ui.hovered||this.data.ui.last_selected; | ||||
| if(d&&d.length)d.hasClass("jstree-closed")?this.open_node(d):this.hover_node(this._get_next(d));return false},space:function(){this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").click();return false},"ctrl+space":function(d){d.type="click";this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(d);return false},f2:function(){this.rename(this.data.ui.hovered||this.data.ui.last_selected)},del:function(){this.remove(this.data.ui.hovered||this._get_node(null))}},_fn:{enable_hotkeys:function(){this.data.hotkeys.enabled= | ||||
| true},disable_hotkeys:function(){this.data.hotkeys.enabled=false}}})})(jQuery); | ||||
| (function(b){b.jstree.plugin("json_data",{defaults:{data:false,ajax:false,correct_state:true,progressive_render:false},_fn:{load_node:function(a,d,e){var g=this;this.load_node_json(a,function(){g.__callback({obj:a});d.call(this)},e)},_is_loaded:function(a){var d=this._get_settings().json_data;if((a=this._get_node(a))&&a!==-1&&d.progressive_render&&!a.is(".jstree-open, .jstree-leaf")&&a.children("ul").children("li").length===0&&a.data("jstree-children")){if(d=this._parse_json(a.data("jstree-children"))){a.append(d); | ||||
| b.removeData(a,"jstree-children")}this.clean_node(a);return true}return a==-1||!a||!d.ajax||a.is(".jstree-open, .jstree-leaf")||a.children("ul").children("li").size()>0},load_node_json:function(a,d,e){var g=this.get_settings().json_data,i,c=function(){};i=function(){};if((a=this._get_node(a))&&a!==-1)if(a.data("jstree-is-loading"))return;else a.data("jstree-is-loading",true);switch(true){case !g.data&&!g.ajax:throw"Neither data nor ajax settings supplied.";case !!g.data&&!g.ajax||!!g.data&&!!g.ajax&& | ||||
| (!a||a===-1):if(!a||a==-1)if(i=this._parse_json(g.data)){this.get_container().children("ul").empty().append(i.children());this.clean_node()}else g.correct_state&&this.get_container().children("ul").empty();d&&d.call(this);break;case !g.data&&!!g.ajax||!!g.data&&!!g.ajax&&a&&a!==-1:c=function(f,h,j){var l=this.get_settings().json_data.ajax.error;l&&l.call(this,f,h,j);if(a!=-1&&a.length){a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);h==="success"&&g.correct_state&& | ||||
| a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}else h==="success"&&g.correct_state&&this.get_container().children("ul").empty();e&&e.call(this)};i=function(f,h,j){var l=this.get_settings().json_data.ajax.success;if(l)f=l.call(this,f,h,j)||f;if(f===""||!b.isArray(f)&&!b.isPlainObject(f))return c.call(this,j,h,"");if(f=this._parse_json(f)){if(a===-1||!a)this.get_container().children("ul").empty().append(f.children());else{a.append(f).children(".jstree-loading").removeClass("jstree-loading"); | ||||
| a.data("jstree-is-loading",false)}this.clean_node(a);d&&d.call(this)}else if(a===-1||!a){if(g.correct_state){this.get_container().children("ul").empty();d&&d.call(this)}}else{a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);if(g.correct_state){a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");d&&d.call(this)}}};g.ajax.context=this;g.ajax.error=c;g.ajax.success=i;if(!g.ajax.dataType)g.ajax.dataType="json";if(b.isFunction(g.ajax.url))g.ajax.url= | ||||
| g.ajax.url.call(this,a);if(b.isFunction(g.ajax.data))g.ajax.data=g.ajax.data.call(this,a);b.ajax(g.ajax)}},_parse_json:function(a,d){var e=false,g=this._get_settings(),i=g.json_data,c=g.core.html_titles,f;if(!a)return e;if(b.isFunction(a))a=a.call(this);if(b.isArray(a)){e=b();if(!a.length)return false;g=0;for(i=a.length;g<i;g++){f=this._parse_json(a[g],true);if(f.length)e=e.add(f)}}else{if(typeof a=="string")a={data:a};if(!a.data&&a.data!=="")return e;e=b("<li>");a.attr&&e.attr(a.attr);a.metadata&& | ||||
| e.data("jstree",a.metadata);a.state&&e.addClass("jstree-"+a.state);if(!b.isArray(a.data)){f=a.data;a.data=[];a.data.push(f)}b.each(a.data,function(h,j){f=b("<a>");if(b.isFunction(j))j=j.call(this,a);if(typeof j=="string")f.attr("href","#")[c?"html":"text"](j);else{if(!j.attr)j.attr={};if(!j.attr.href)j.attr.href="#";f.attr(j.attr)[c?"html":"text"](j.title);j.language&&f.addClass(j.language)}f.prepend("<ins class='jstree-icon'> </ins>");if(!j.icon&&a.icon)j.icon=a.icon;if(j.icon)j.icon.indexOf("/")=== | ||||
| -1?f.children("ins").addClass(j.icon):f.children("ins").css("background","url('"+j.icon+"') center center no-repeat");e.append(f)});e.prepend("<ins class='jstree-icon'> </ins>");if(a.children)if(i.progressive_render&&a.state!=="open")e.addClass("jstree-closed").data("jstree-children",a.children);else{if(b.isFunction(a.children))a.children=a.children.call(this,a);if(b.isArray(a.children)&&a.children.length){f=this._parse_json(a.children,true);if(f.length){g=b("<ul>");g.append(f);e.append(g)}}}}if(!d){g= | ||||
| b("<ul>");g.append(e);e=g}return e},get_json:function(a,d,e,g){var i=[],c=this._get_settings(),f=this,h,j,l,k,m,n;a=this._get_node(a);if(!a||a===-1)a=this.get_container().find("> ul > li");d=b.isArray(d)?d:["id","class"];!g&&this.data.types&&d.push(c.types.type_attr);e=b.isArray(e)?e:[];a.each(function(){l=b(this);h={data:[]};if(d.length)h.attr={};b.each(d,function(p,o){if((j=l.attr(o))&&j.length&&j.replace(/jstree[^ ]*|$/ig,"").length)h.attr[o]=j.replace(/jstree[^ ]*|$/ig,"")});if(l.hasClass("jstree-open"))h.state= | ||||
| "open";if(l.hasClass("jstree-closed"))h.state="closed";k=l.children("a");k.each(function(){m=b(this);if(e.length||b.inArray("languages",c.plugins)!==-1||m.children("ins").get(0).style.backgroundImage.length||m.children("ins").get(0).className&&m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").length){n=false;b.inArray("languages",c.plugins)!==-1&&b.isArray(c.languages)&&c.languages.length&&b.each(c.languages,function(p,o){if(m.hasClass(o)){n=o;return false}});j={attr:{},title:f.get_text(m, | ||||
| n)};b.each(e,function(p,o){h.attr[o]=(m.attr(o)||"").replace(/jstree[^ ]*|$/ig,"")});b.each(c.languages,function(p,o){if(m.hasClass(o)){j.language=o;return true}});if(m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)j.icon=m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"");if(m.children("ins").get(0).style.backgroundImage.length)j.icon=m.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}else j= | ||||
| f.get_text(m);if(k.length>1)h.data.push(j);else h.data=j});l=l.find("> ul > li");if(l.length)h.children=f.get_json(l,d,e,true);i.push(h)});return i}}})})(jQuery); | ||||
| (function(b){b.jstree.plugin("languages",{__init:function(){this._load_css()},defaults:[],_fn:{set_lang:function(a){var d=this._get_settings().languages,e=false,g=".jstree-"+this.get_index()+" a";if(!b.isArray(d)||d.length===0)return false;if(b.inArray(a,d)==-1)if(d[a])a=d[a];else return false;if(a==this.data.languages.current_language)return true;e=b.vakata.css.get_css(g+"."+this.data.languages.current_language,false,this.data.languages.language_css);if(e!==false)e.style.display="none";e=b.vakata.css.get_css(g+ | ||||
| "."+a,false,this.data.languages.language_css);if(e!==false)e.style.display="";this.data.languages.current_language=a;this.__callback(a);return true},get_lang:function(){return this.data.languages.current_language},get_text:function(a,d){a=this._get_node(a)||this.data.ui.last_selected;if(!a.size())return false;var e=this._get_settings().languages,g=this._get_settings().core.html_titles;if(b.isArray(e)&&e.length){d=d&&b.inArray(d,e)!=-1?d:this.data.languages.current_language;a=a.children("a."+d)}else a= | ||||
| a.children("a:eq(0)");if(g){a=a.clone();a.children("INS").remove();return a.html()}else{a=a.contents().filter(function(){return this.nodeType==3})[0];return a.nodeValue}},set_text:function(a,d,e){a=this._get_node(a)||this.data.ui.last_selected;if(!a.size())return false;var g=this._get_settings().languages,i=this._get_settings().core.html_titles;if(b.isArray(g)&&g.length){e=e&&b.inArray(e,g)!=-1?e:this.data.languages.current_language;a=a.children("a."+e)}else a=a.children("a:eq(0)");if(i){g=a.children("INS").clone(); | ||||
| a.html(d).prepend(g);this.__callback({obj:a,name:d,lang:e});return true}else{a=a.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:a,name:d,lang:e});return a.nodeValue=d}},_load_css:function(){var a=this._get_settings().languages,d="/* languages css */",e=".jstree-"+this.get_index()+" a",g;if(b.isArray(a)&&a.length){this.data.languages.current_language=a[0];for(g=0;g<a.length;g++){d+=e+"."+a[g]+" {";if(a[g]!=this.data.languages.current_language)d+=" display:none; ";d+= | ||||
| " } "}this.data.languages.language_css=b.vakata.css.add_sheet({str:d})}},create_node:function(a,d,e,g){return this.__call_old(true,a,d,e,function(i){var c=this._get_settings().languages,f=i.children("a"),h;if(b.isArray(c)&&c.length){for(h=0;h<c.length;h++)f.is("."+c[h])||i.append(f.eq(0).clone().removeClass(c.join(" ")).addClass(c[h]));f.not("."+c.join(", .")).remove()}g&&g.call(this,i)})}}})})(jQuery); | ||||
| (function(b){b.jstree.plugin("cookies",{__init:function(){if(typeof b.cookie==="undefined")throw"jsTree cookie: jQuery cookie plugin not included.";var a=this._get_settings().cookies,d;if(a.save_opened)if((d=b.cookie(a.save_opened))&&d.length)this.data.core.to_open=d.split(",");if(a.save_selected)if((d=b.cookie(a.save_selected))&&d.length&&this.data.ui)this.data.ui.to_select=d.split(",");this.get_container().one((this.data.ui?"reselect":"reopen")+".jstree",b.proxy(function(){this.get_container().bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", | ||||
| b.proxy(function(e){this._get_settings().cookies.auto_save&&this.save_cookie((e.handleObj.namespace+e.handleObj.type).replace("jstree",""))},this))},this))},defaults:{save_opened:"jstree_open",save_selected:"jstree_select",auto_save:true,cookie_options:{}},_fn:{save_cookie:function(a){if(!this.data.core.refreshing){var d=this._get_settings().cookies;if(a)switch(a){case "open_node":case "close_node":if(d.save_opened){this.save_opened();b.cookie(d.save_opened,this.data.core.to_open.join(","),d.cookie_options)}break; | ||||
| case "select_node":case "deselect_node":if(d.save_selected&&this.data.ui){this.save_selected();b.cookie(d.save_selected,this.data.ui.to_select.join(","),d.cookie_options)}}else{if(d.save_opened){this.save_opened();b.cookie(d.save_opened,this.data.core.to_open.join(","),d.cookie_options)}if(d.save_selected&&this.data.ui){this.save_selected();b.cookie(d.save_selected,this.data.ui.to_select.join(","),d.cookie_options)}}}}}});b.jstree.defaults.plugins.push("cookies")})(jQuery); | ||||
| (function(b){b.jstree.plugin("sort",{__init:function(){this.get_container().bind("load_node.jstree",b.proxy(function(a,d){var e=this._get_node(d.rslt.obj);e=e===-1?this.get_container().children("ul"):e.children("ul");this.sort(e)},this)).bind("rename_node.jstree",b.proxy(function(a,d){this.sort(d.rslt.obj.parent())},this)).bind("move_node.jstree",b.proxy(function(a,d){this.sort((d.rslt.np==-1?this.get_container():d.rslt.np).children("ul"))},this))},defaults:function(a,d){return this.get_text(a)>this.get_text(d)? | ||||
| 1:-1},_fn:{sort:function(a){var d=this._get_settings().sort,e=this;a.append(b.makeArray(a.children("li")).sort(b.proxy(d,e)));a.find("> li > ul").each(function(){e.sort(b(this))});this.clean_node(a)}}})})(jQuery); | ||||
| (function(b){var a=false,d=false,e=false,g=false,i=false,c=false,f=false;b.vakata.dnd={is_down:false,is_drag:false,helper:false,scroll_spd:10,init_x:0,init_y:0,threshold:5,user_data:{},drag_start:function(h,j,l){b.vakata.dnd.is_drag&&b.vakata.drag_stop({});try{h.currentTarget.unselectable="on";h.currentTarget.onselectstart=function(){return false};if(h.currentTarget.style)h.currentTarget.style.MozUserSelect="none"}catch(k){}b.vakata.dnd.init_x=h.pageX;b.vakata.dnd.init_y=h.pageY;b.vakata.dnd.user_data= | ||||
| j;b.vakata.dnd.is_down=true;b.vakata.dnd.helper=b("<div id='vakata-dragged'>").html(l).css("opacity","0.75");b(document).bind("mousemove",b.vakata.dnd.drag);b(document).bind("mouseup",b.vakata.dnd.drag_stop);return false},drag:function(h){if(b.vakata.dnd.is_down){if(!b.vakata.dnd.is_drag)if(Math.abs(h.pageX-b.vakata.dnd.init_x)>5||Math.abs(h.pageY-b.vakata.dnd.init_y)>5){b.vakata.dnd.helper.appendTo("body");b.vakata.dnd.is_drag=true;b(document).triggerHandler("drag_start.vakata",{event:h,data:b.vakata.dnd.user_data})}else return; | ||||
| if(h.type==="mousemove"){var j=b(document),l=j.scrollTop();j=j.scrollLeft();if(h.pageY-l<20){if(i&&c==="down"){clearInterval(i);i=false}if(!i){c="up";i=setInterval(function(){b(document).scrollTop(b(document).scrollTop()-b.vakata.dnd.scroll_spd)},150)}}else if(i&&c==="up"){clearInterval(i);i=false}if(b(window).height()-(h.pageY-l)<20){if(i&&c==="up"){clearInterval(i);i=false}if(!i){c="down";i=setInterval(function(){b(document).scrollTop(b(document).scrollTop()+b.vakata.dnd.scroll_spd)},150)}}else if(i&& | ||||
| c==="down"){clearInterval(i);i=false}if(h.pageX-j<20){if(g&&f==="right"){clearInterval(g);g=false}if(!g){f="left";g=setInterval(function(){b(document).scrollLeft(b(document).scrollLeft()-b.vakata.dnd.scroll_spd)},150)}}else if(g&&f==="left"){clearInterval(g);g=false}if(b(window).width()-(h.pageX-j)<20){if(g&&f==="left"){clearInterval(g);g=false}if(!g){f="right";g=setInterval(function(){b(document).scrollLeft(b(document).scrollLeft()+b.vakata.dnd.scroll_spd)},150)}}else if(g&&f==="right"){clearInterval(g); | ||||
| g=false}}b.vakata.dnd.helper.css({left:h.pageX+5+"px",top:h.pageY+10+"px"});b(document).triggerHandler("drag.vakata",{event:h,data:b.vakata.dnd.user_data})}},drag_stop:function(h){b(document).unbind("mousemove",b.vakata.dnd.drag);b(document).unbind("mouseup",b.vakata.dnd.drag_stop);b(document).triggerHandler("drag_stop.vakata",{event:h,data:b.vakata.dnd.user_data});b.vakata.dnd.helper.remove();b.vakata.dnd.init_x=0;b.vakata.dnd.init_y=0;b.vakata.dnd.user_data={};b.vakata.dnd.is_down=false;b.vakata.dnd.is_drag= | ||||
| false}};b(function(){b.vakata.css.add_sheet({str:"#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } "})});b.jstree.plugin("dnd",{__init:function(){this.data.dnd={active:false,after:false,inside:false,before:false,off:false,prepared:false,w:0,to1:false,to2:false,cof:false,cw:false,ch:false,i1:false,i2:false};this.get_container().bind("mouseenter.jstree",b.proxy(function(){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree&& | ||||
| this.data.themes){e.attr("class","jstree-"+this.data.themes.theme);b.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}},this)).bind("mouseleave.jstree",b.proxy(function(){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).bind("mousemove.jstree",b.proxy(function(j){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){var l=this.get_container()[0];if(j.pageX+ | ||||
| 24>this.data.dnd.cof.left+this.data.dnd.cw){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(b.proxy(function(){this.scrollLeft+=b.vakata.dnd.scroll_spd},l),100)}else if(j.pageX-24<this.data.dnd.cof.left){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(b.proxy(function(){this.scrollLeft-=b.vakata.dnd.scroll_spd},l),100)}else this.data.dnd.i1&&clearInterval(this.data.dnd.i1);if(j.pageY+24>this.data.dnd.cof.top+this.data.dnd.ch){this.data.dnd.i2&& | ||||
| clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(b.proxy(function(){this.scrollTop+=b.vakata.dnd.scroll_spd},l),100)}else if(j.pageY-24<this.data.dnd.cof.top){this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(b.proxy(function(){this.scrollTop-=b.vakata.dnd.scroll_spd},l),100)}else this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).delegate("a","mousedown.jstree",b.proxy(function(j){if(j.which===1){this.start_drag(j.currentTarget,j);return false}},this)).delegate("a", | ||||
| "mouseenter.jstree",b.proxy(function(j){b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree&&this.dnd_enter(j.currentTarget)},this)).delegate("a","mousemove.jstree",b.proxy(function(j){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){if(typeof this.data.dnd.off.top==="undefined")this.data.dnd.off=b(j.target).offset();this.data.dnd.w=(j.pageY-(this.data.dnd.off.top||0))%this.data.core.li_height;if(this.data.dnd.w<0)this.data.dnd.w+=this.data.core.li_height;this.dnd_show()}},this)).delegate("a", | ||||
| "mouseleave.jstree",b.proxy(function(j){if(b.vakata.dnd.is_drag&&b.vakata.dnd.user_data.jstree){this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");e.hide();if(d&&d[0]===j.target.parentNode){if(this.data.dnd.to1){clearTimeout(this.data.dnd.to1);this.data.dnd.to1=false}if(this.data.dnd.to2){clearTimeout(this.data.dnd.to2);this.data.dnd.to2=false}}}},this)).delegate("a","mouseup.jstree",b.proxy(function(j){b.vakata.dnd.is_drag&& | ||||
| b.vakata.dnd.user_data.jstree&&this.dnd_finish(j)},this));b(document).bind("drag_stop.vakata",b.proxy(function(){this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;this.data.dnd.off=false;this.data.dnd.prepared=false;this.data.dnd.w=false;this.data.dnd.to1=false;this.data.dnd.to2=false;this.data.dnd.active=false;this.data.dnd.foreign=false;e&&e.css({top:"-2000px"})},this)).bind("drag_start.vakata",b.proxy(function(j,l){if(l.data.jstree){var k=b(l.event.target);k.closest(".jstree").hasClass("jstree-"+ | ||||
| this.get_index())&&this.dnd_enter(k)}},this));var h=this._get_settings().dnd;h.drag_target&&b(document).delegate(h.drag_target,"mousedown.jstree",b.proxy(function(j){a=j.target;b.vakata.dnd.drag_start(j,{jstree:true,obj:j.target},"<ins class='jstree-icon'></ins>"+b(j.target).text());if(this.data.themes){e.attr("class","jstree-"+this.data.themes.theme);b.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); | ||||
| j=this.get_container();this.data.dnd.cof=j.offset();this.data.dnd.cw=parseInt(j.width(),10);this.data.dnd.ch=parseInt(j.height(),10);this.data.dnd.foreign=true;return false},this));h.drop_target&&b(document).delegate(h.drop_target,"mouseenter.jstree",b.proxy(function(j){this.data.dnd.active&&this._get_settings().dnd.drop_check.call(this,{o:a,r:b(j.target)})&&b.vakata.dnd.helper.children("ins").attr("class","jstree-ok")},this)).delegate(h.drop_target,"mouseleave.jstree",b.proxy(function(){this.data.dnd.active&& | ||||
| b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")},this)).delegate(h.drop_target,"mouseup.jstree",b.proxy(function(j){this.data.dnd.active&&b.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&this._get_settings().dnd.drop_finish.call(this,{o:a,r:b(j.target)})},this))},defaults:{copy_modifier:"ctrl",check_timeout:200,open_timeout:500,drop_target:".jstree-drop",drop_check:function(){return true},drop_finish:b.noop,drag_target:".jstree-draggable",drag_finish:b.noop,drag_check:function(){return{after:false, | ||||
| before:false,inside:true}}},_fn:{dnd_prepare:function(){if(d&&d.length){this.data.dnd.off=d.offset();if(this._get_settings().core.rtl)this.data.dnd.off.right=this.data.dnd.off.left+d.width();if(this.data.dnd.foreign){var h=this._get_settings().dnd.drag_check.call(this,{o:a,r:d});this.data.dnd.after=h.after;this.data.dnd.before=h.before;this.data.dnd.inside=h.inside;this.data.dnd.prepared=true;return this.dnd_show()}this.prepare_move(a,d,"before");this.data.dnd.before=this.check_move();this.prepare_move(a, | ||||
| d,"after");this.data.dnd.after=this.check_move();if(this._is_loaded(d)){this.prepare_move(a,d,"inside");this.data.dnd.inside=this.check_move()}else this.data.dnd.inside=false;this.data.dnd.prepared=true;return this.dnd_show()}},dnd_show:function(){if(this.data.dnd.prepared){var h=["before","inside","after"],j=false,l=this._get_settings().core.rtl;h=this.data.dnd.w<this.data.core.li_height/3?["before","inside","after"]:this.data.dnd.w<=this.data.core.li_height*2/3?this.data.dnd.w<this.data.core.li_height/ | ||||
| 2?["inside","before","after"]:["inside","after","before"]:["after","inside","before"];b.each(h,b.proxy(function(k,m){if(this.data.dnd[m]){b.vakata.dnd.helper.children("ins").attr("class","jstree-ok");j=m;return false}},this));j===false&&b.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");h=l?this.data.dnd.off.right-18:this.data.dnd.off.left+10;switch(j){case "before":e.css({left:h+"px",top:this.data.dnd.off.top-6+"px"}).show();break;case "after":e.css({left:h+"px",top:this.data.dnd.off.top+ | ||||
| this.data.core.li_height-7+"px"}).show();break;case "inside":e.css({left:h+(l?-4:4)+"px",top:this.data.dnd.off.top+this.data.core.li_height/2-5+"px"}).show();break;default:e.hide()}return j}},dnd_open:function(){this.data.dnd.to2=false;this.open_node(d,b.proxy(this.dnd_prepare,this),true)},dnd_finish:function(h){if(this.data.dnd.foreign){if(this.data.dnd.after||this.data.dnd.before||this.data.dnd.inside)this._get_settings().dnd.drag_finish.call(this,{o:a,r:d})}else{this.dnd_prepare();this.move_node(a, | ||||
| d,this.dnd_show(),h[this._get_settings().dnd.copy_modifier+"Key"])}d=a=false;e.hide()},dnd_enter:function(h){var j=this._get_settings().dnd;this.data.dnd.prepared=false;d=this._get_node(h);if(j.check_timeout){this.data.dnd.to1&&clearTimeout(this.data.dnd.to1);this.data.dnd.to1=setTimeout(b.proxy(this.dnd_prepare,this),j.check_timeout)}else this.dnd_prepare();if(j.open_timeout){this.data.dnd.to2&&clearTimeout(this.data.dnd.to2);if(d&&d.length&&d.hasClass("jstree-closed"))this.data.dnd.to2=setTimeout(b.proxy(this.dnd_open, | ||||
| this),j.open_timeout)}else d&&d.length&&d.hasClass("jstree-closed")&&this.dnd_open()},start_drag:function(h,j){a=this._get_node(h);if(this.data.ui&&this.is_selected(a))a=this._get_node(null,true);b.vakata.dnd.drag_start(j,{jstree:true,obj:a},"<ins class='jstree-icon'></ins>"+(a.length>1?"Multiple selection":this.get_text(a)));if(this.data.themes){e.attr("class","jstree-"+this.data.themes.theme);b.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}var l=this.get_container(); | ||||
| this.data.dnd.cof=l.children("ul").offset();this.data.dnd.cw=parseInt(l.width(),10);this.data.dnd.ch=parseInt(l.height(),10);this.data.dnd.active=true}}});b(function(){b.vakata.css.add_sheet({str:"#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; } #vakata-dragged .jstree-ok { background:green; } #vakata-dragged .jstree-invalid { background:red; } #jstree-marker { padding:0; margin:0; line-height:12px; font-size:1px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:silver; } "}); | ||||
| e=b("<div>").attr({id:"jstree-marker"}).hide().appendTo("body");b(document).bind("drag_start.vakata",function(h,j){j.data.jstree&&e.show()});b(document).bind("drag_stop.vakata",function(h,j){j.data.jstree&&e.hide()})})})(jQuery); | ||||
| (function(b){b.jstree.plugin("checkbox",{__init:function(){this.select_node=this.deselect_node=this.deselect_all=b.noop;this.get_selected=this.get_checked;this.get_container().bind("open_node.jstree create_node.jstree clean_node.jstree",b.proxy(function(a,d){this._prepare_checkboxes(d.rslt.obj)},this)).bind("loaded.jstree",b.proxy(function(){this._prepare_checkboxes()},this)).delegate("a","click.jstree",b.proxy(function(a){this._get_node(a.target).hasClass("jstree-checked")?this.uncheck_node(a.target): | ||||
| this.check_node(a.target);this.data.ui&&this.save_selected();this.data.cookies&&this.save_cookie("select_node");a.preventDefault()},this))},__destroy:function(){this.get_container().find(".jstree-checkbox").remove()},_fn:{_prepare_checkboxes:function(a){a=!a||a==-1?this.get_container():this._get_node(a);var d,e=this,g;a.each(function(){g=b(this);d=g.is("li")&&g.hasClass("jstree-checked")?"jstree-checked":"jstree-unchecked";g.find("a").not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'> </ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(d)}); | ||||
| a.is("li")?this._repair_state(a):a.find("> ul > li").each(function(){e._repair_state(this)})},change_state:function(a,d){a=this._get_node(a);if(d=d===false||d===true?d:a.hasClass("jstree-checked"))a.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");else{a.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");if(this.data.ui)this.data.ui.last_selected=a;this.data.checkbox.last_selected=a}a.parentsUntil(".jstree", | ||||
| "li").each(function(){var e=b(this);if(d)if(e.children("ul").children(".jstree-checked, .jstree-undetermined").length){e.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");return false}else e.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");else if(e.children("ul").children(".jstree-unchecked, .jstree-undetermined").length){e.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"); | ||||
| return false}else e.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked")});if(this.data.ui)this.data.ui.selected=this.get_checked();this.__callback(a)},check_node:function(a){this.change_state(a,false)},uncheck_node:function(a){this.change_state(a,true)},check_all:function(){var a=this;this.get_container().children("ul").children("li").each(function(){a.check_node(this,false)})},uncheck_all:function(){var a=this;this.get_container().children("ul").children("li").each(function(){a.change_state(this, | ||||
| true)})},is_checked:function(a){a=this._get_node(a);return a.length?a.is(".jstree-checked"):false},get_checked:function(a){a=!a||a===-1?this.get_container():this._get_node(a);return a.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked")},get_unchecked:function(a){a=!a||a===-1?this.get_container():this._get_node(a);return a.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked")},show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")}, | ||||
| hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(a){a=this._get_node(a);if(a.length){var d=a.find("> ul > .jstree-checked").length,e=a.find("> ul > .jstree-undetermined").length,g=a.find("> ul > li").length;if(g===0)a.hasClass("jstree-undetermined")&&this.check_node(a);else if(d===0&&e===0)this.uncheck_node(a);else d===g?this.check_node(a):a.parentsUntil(".jstree","li").removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined")}}, | ||||
| reselect:function(){if(this.data.ui){var a=this,d=this.data.ui.to_select;d=b.map(b.makeArray(d),function(e){return"#"+e.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/")});this.deselect_all();b.each(d,function(e,g){a.check_node(g)});this.__callback()}}}})})(jQuery); | ||||
| (function(b){b.vakata.xslt=function(d,e,g){var i="",c;if(document.recalc){c=document.createElement("xml");i=document.createElement("xml");c.innerHTML=d;i.innerHTML=e;b("body").append(c).append(i);setTimeout(function(f,h,j){return function(){j.call(null,f.transformNode(h.XMLDocument));setTimeout(function(l,k){return function(){jQuery("body").remove(l).remove(k)}}(f,h),200)}}(c,i,g),100);return true}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor!== | ||||
| "undefined"){c=new XSLTProcessor;i=b.isFunction(c.transformDocument)?typeof window.XMLSerializer!=="undefined":true;if(!i)return false;d=(new DOMParser).parseFromString(d,"text/xml");e=(new DOMParser).parseFromString(e,"text/xml");if(b.isFunction(c.transformDocument)){i=document.implementation.createDocument("","",null);c.transformDocument(d,e,i,null);g.call(null,XMLSerializer().serializeToString(i))}else{c.importStylesheet(e);i=c.transformToFragment(d,document);g.call(null,b("<div>").append(i).html())}return true}return false}; | ||||
| var a={nest:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/">\t<xsl:call-template name="nodes">\t\t<xsl:with-param name="node" select="/root" />\t</xsl:call-template></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<ul>\t<xsl:for-each select="$node/item">\t\t<xsl:variable name="children" select="count(./item) > 0" />\t\t<li>\t\t\t<xsl:attribute name="class">\t\t\t\t<xsl:if test="position() = last()">jstree-last </xsl:if>\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t\t\t</xsl:choose>\t\t\t\t<xsl:value-of select="@class" />\t\t\t</xsl:attribute>\t\t\t<xsl:for-each select="@*">\t\t\t\t<xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t</xsl:if>\t\t\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t\t\t<xsl:for-each select="content/name">\t\t\t\t<a>\t\t\t\t<xsl:attribute name="href">\t\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t\t\t</xsl:choose>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t\t\t<xsl:for-each select="@*">\t\t\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t\t</xsl:if>\t\t\t\t</xsl:for-each>\t\t\t\t\t<ins>\t\t\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t\t\t</xsl:attribute>\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t\t\t<xsl:text> </xsl:text>\t\t\t\t\t</ins>\t\t\t\t\t<xsl:value-of select="current()" />\t\t\t\t</a>\t\t\t</xsl:for-each>\t\t\t<xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>\t\t</li>\t</xsl:for-each>\t</ul></xsl:template></xsl:stylesheet>', | ||||
| flat:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/">\t<ul>\t<xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">\t\t<xsl:call-template name="nodes">\t\t\t<xsl:with-param name="node" select="." />\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t</xsl:call-template>\t</xsl:for-each>\t</ul></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<xsl:param name="is_last" />\t<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) > 0" />\t<li>\t<xsl:attribute name="class">\t\t<xsl:if test="$is_last = true()">jstree-last </xsl:if>\t\t<xsl:choose>\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t</xsl:choose>\t\t<xsl:value-of select="@class" />\t</xsl:attribute>\t<xsl:for-each select="@*">\t\t<xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t</xsl:if>\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t<xsl:for-each select="content/name">\t\t<a>\t\t<xsl:attribute name="href">\t\t\t<xsl:choose>\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t</xsl:choose>\t\t</xsl:attribute>\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t<xsl:for-each select="@*">\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t</xsl:if>\t\t</xsl:for-each>\t\t\t<ins>\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t<xsl:text> </xsl:text>\t\t\t</ins>\t\t\t<xsl:value-of select="current()" />\t\t</a>\t</xsl:for-each>\t<xsl:if test="$children">\t\t<ul>\t\t<xsl:for-each select="//item[@parent_id=$node/attribute::id]">\t\t\t<xsl:call-template name="nodes">\t\t\t\t<xsl:with-param name="node" select="." />\t\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t\t</xsl:call-template>\t\t</xsl:for-each>\t\t</ul>\t</xsl:if>\t</li></xsl:template></xsl:stylesheet>'}; | ||||
| b.jstree.plugin("xml_data",{defaults:{data:false,ajax:false,xsl:"flat",clean_node:false,correct_state:true},_fn:{load_node:function(d,e,g){var i=this;this.load_node_xml(d,function(){i.__callback({obj:d});e.call(this)},g)},_is_loaded:function(d){var e=this._get_settings().xml_data;d=this._get_node(d);return d==-1||!d||!e.ajax||d.is(".jstree-open, .jstree-leaf")||d.children("ul").children("li").size()>0},load_node_xml:function(d,e,g){var i=this.get_settings().xml_data,c=function(){},f=function(){}; | ||||
| if((d=this._get_node(d))&&d!==-1)if(d.data("jstree-is-loading"))return;else d.data("jstree-is-loading",true);switch(true){case !i.data&&!i.ajax:throw"Neither data nor ajax settings supplied.";case !!i.data&&!i.ajax||!!i.data&&!!i.ajax&&(!d||d===-1):if(!d||d==-1)this.parse_xml(i.data,b.proxy(function(h){if(h){h=h.replace(/ ?xmlns="[^"]*"/ig,"");if(h.length>10){h=b(h);this.get_container().children("ul").empty().append(h.children());i.clean_node&&this.clean_node(d);e&&e.call(this)}}else if(i.correct_state){this.get_container().children("ul").empty(); | ||||
| e&&e.call(this)}},this));break;case !i.data&&!!i.ajax||!!i.data&&!!i.ajax&&d&&d!==-1:c=function(h,j,l){var k=this.get_settings().xml_data.ajax.error;k&&k.call(this,h,j,l);if(d!==-1&&d.length){d.children(".jstree-loading").removeClass("jstree-loading");d.data("jstree-is-loading",false);j==="success"&&i.correct_state&&d.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}else j==="success"&&i.correct_state&&this.get_container().children("ul").empty();g&&g.call(this)};f=function(h,j,l){h= | ||||
| l.responseText;var k=this.get_settings().xml_data.ajax.success;if(k)h=k.call(this,h,j,l)||h;if(h=="")return c.call(this,l,j,"");this.parse_xml(h,b.proxy(function(m){if(m){m=m.replace(/ ?xmlns="[^"]*"/ig,"");if(m.length>10){m=b(m);if(d===-1||!d)this.get_container().children("ul").empty().append(m.children());else{d.children(".jstree-loading").removeClass("jstree-loading");d.append(m);d.data("jstree-is-loading",false)}i.clean_node&&this.clean_node(d);e&&e.call(this)}else if(d&&d!==-1){d.children(".jstree-loading").removeClass("jstree-loading"); | ||||
| d.data("jstree-is-loading",false);if(i.correct_state){d.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");e&&e.call(this)}}else if(i.correct_state){this.get_container().children("ul").empty();e&&e.call(this)}}},this))};i.ajax.context=this;i.ajax.error=c;i.ajax.success=f;if(!i.ajax.dataType)i.ajax.dataType="xml";if(b.isFunction(i.ajax.url))i.ajax.url=i.ajax.url.call(this,d);if(b.isFunction(i.ajax.data))i.ajax.data=i.ajax.data.call(this,d);b.ajax(i.ajax)}},parse_xml:function(d,e){var g= | ||||
| this._get_settings().xml_data;b.vakata.xslt(d,a[g.xsl],e)},get_xml:function(d,e,g,i,c){var f="",h=this._get_settings(),j=this,l,k,m,n,p;d||(d="flat");c||(c=0);e=this._get_node(e);if(!e||e===-1)e=this.get_container().find("> ul > li");g=b.isArray(g)?g:["id","class"];!c&&this.data.types&&b.inArray(h.types.type_attr,g)===-1&&g.push(h.types.type_attr);i=b.isArray(i)?i:[];c||(f+="<root>");e.each(function(){f+="<item";m=b(this);b.each(g,function(o,q){f+=" "+q+'="'+(m.attr(q)||"").replace(/jstree[^ ]*|$/ig, | ||||
| "").replace(/^\s+$/ig,"")+'"'});if(m.hasClass("jstree-open"))f+=' state="open"';if(m.hasClass("jstree-closed"))f+=' state="closed"';if(d==="flat")f+=' parent_id="'+c+'"';f+=">";f+="<content>";n=m.children("a");n.each(function(){l=b(this);p=false;f+="<name";b.inArray("languages",h.plugins)!==-1&&b.each(h.languages,function(o,q){if(l.hasClass(q)){f+=' lang="'+q+'"';p=q;return false}});i.length&&b.each(i,function(o,q){f+=" "+q+'="'+(l.attr(q)||"").replace(/jstree[^ ]*|$/ig,"")+'"'});if(l.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig, | ||||
| "").replace(/^\s+$/ig,"").length)f+=' icon="'+l.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"")+'"';if(l.children("ins").get(0).style.backgroundImage.length)f+=' icon="'+l.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")+'"';f+=">";f+="<![CDATA["+j.get_text(l,p)+"]]\>";f+="</name>"});f+="</content>";k=m[0].id;m=m.find("> ul > li");k=m.length?j.get_xml(d,m,g,i,k):"";if(d=="nest")f+=k;f+="</item>";if(d=="flat")f+=k});c||(f+="</root>"); | ||||
| return f}}})})(jQuery); | ||||
| (function(b){b.expr[":"].jstree_contains=function(a,d,e){return(a.textContent||a.innerText||"").toLowerCase().indexOf(e[3].toLowerCase())>=0};b.jstree.plugin("search",{__init:function(){this.data.search.str="";this.data.search.result=b()},defaults:{ajax:false,case_insensitive:false},_fn:{search:function(a,d){if(a!==""){var e=this.get_settings().search,g=this,i=function(){},c=function(){};this.data.search.str=a;if(!d&&e.ajax!==false&&this.get_container().find(".jstree-closed:eq(0)").length>0){this.search.supress_callback= | ||||
| true;i=function(){};c=function(f,h,j){var l=this.get_settings().search.ajax.success;if(l)f=l.call(this,f,h,j)||f;this.data.search.to_open=f;this._search_open()};e.ajax.context=this;e.ajax.error=i;e.ajax.success=c;if(b.isFunction(e.ajax.url))e.ajax.url=e.ajax.url.call(this,a);if(b.isFunction(e.ajax.data))e.ajax.data=e.ajax.data.call(this,a);if(!e.ajax.data)e.ajax.data={search_string:a};if(!e.ajax.dataType||/^json/.exec(e.ajax.dataType))e.ajax.dataType="json";b.ajax(e.ajax)}else{this.data.search.result.length&& | ||||
| this.clear_search();this.data.search.result=this.get_container().find("a"+(this.data.languages?"."+this.get_lang():"")+":"+(e.case_insensitive?"jstree_contains":"contains")+"("+this.data.search.str+")");this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function(){g.open_node(this,false,true)});this.__callback({nodes:this.data.search.result,str:a})}}},clear_search:function(){this.data.search.result.removeClass("jstree-search");this.__callback(this.data.search.result); | ||||
| this.data.search.result=b()},_search_open:function(){var a=this,d=true,e=[],g=[];if(this.data.search.to_open.length){b.each(this.data.search.to_open,function(i,c){if(c=="#")return true;b(c).length&&b(c).is(".jstree-closed")?e.push(c):g.push(c)});if(e.length){this.data.search.to_open=g;b.each(e,function(i,c){a.open_node(c,function(){a._search_open(true)})});d=false}}d&&this.search(this.data.search.str,true)}}})})(jQuery); | ||||
| (function(b){b.vakata.context={cnt:b("<div id='vakata-contextmenu'>"),vis:false,tgt:false,par:false,func:false,data:false,show:function(a,d,e,g,i,c){if(a=b.vakata.context.parse(a)){b.vakata.context.vis=true;b.vakata.context.tgt=d;b.vakata.context.par=c||d||null;b.vakata.context.data=i||null;b.vakata.context.cnt.html(a).css({visibility:"hidden",display:"block",left:0,top:0});i=b.vakata.context.cnt.height();c=b.vakata.context.cnt.width();if(e+c>b(document).width()){e=b(document).width()-(c+5);b.vakata.context.cnt.find("li > ul").addClass("right")}if(g+ | ||||
| i>b(document).height()){g-=i+d[0].offsetHeight;b.vakata.context.cnt.find("li > ul").addClass("bottom")}b.vakata.context.cnt.css({left:e,top:g}).find("li:has(ul)").bind("mouseenter",function(){var f=b(document).width(),h=b(document).height(),j=b(this).children("ul").show();f!==b(document).width()&&j.toggleClass("right");h!==b(document).height()&&j.toggleClass("bottom")}).bind("mouseleave",function(){b(this).children("ul").hide()}).end().css({visibility:"visible"}).show();b(document).triggerHandler("context_show.vakata")}}, | ||||
| hide:function(){b.vakata.context.vis=false;b.vakata.context.cnt.attr("class","").hide();b(document).triggerHandler("context_hide.vakata")},parse:function(a,d){if(!a)return false;var e="",g=false,i=true;if(!d)b.vakata.context.func={};e+="<ul>";b.each(a,function(c,f){if(!f)return true;b.vakata.context.func[c]=f.action;if(!i&&f.separator_before)e+="<li class='vakata-separator vakata-separator-before'></li>";i=false;e+="<li class='"+(f._class||"")+(f._disabled?" jstree-contextmenu-disabled ":"")+"'><ins "; | ||||
| if(f.icon&&f.icon.indexOf("/")===-1)e+=" class='"+f.icon+"' ";if(f.icon&&f.icon.indexOf("/")!==-1)e+=" style='background:url("+f.icon+") center center no-repeat;' ";e+="> </ins><a href='#' rel='"+c+"'>";if(f.submenu)e+="<span style='float:right;'>»</span>";e+=f.label+"</a>";if(f.submenu)if(g=b.vakata.context.parse(f.submenu,true))e+=g;e+="</li>";if(f.separator_after){e+="<li class='vakata-separator vakata-separator-after'></li>";i=true}});e=e.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/, | ||||
| "");e+="</ul>";return e.length>10?e:false},exec:function(a){if(b.isFunction(b.vakata.context.func[a])){b.vakata.context.func[a].call(b.vakata.context.data,b.vakata.context.par);return true}else return false}};b(function(){b.vakata.css.add_sheet({str:"#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } #vakata-contextmenu ul { min-width:180px; *width:180px; } #vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } #vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } #vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } #vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } #vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } #vakata-contextmenu .right { right:100%; left:auto; } #vakata-contextmenu .bottom { bottom:-1px; top:auto; } #vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } "}); | ||||
| b.vakata.context.cnt.delegate("a","click",function(a){a.preventDefault()}).delegate("a","mouseup",function(){!b(this).parent().hasClass("jstree-contextmenu-disabled")&&b.vakata.context.exec(b(this).attr("rel"))?b.vakata.context.hide():b(this).blur()}).delegate("a","mouseover",function(){b.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover")}).appendTo("body");b(document).bind("mousedown",function(a){b.vakata.context.vis&&!b.contains(b.vakata.context.cnt[0],a.target)&&b.vakata.context.hide()}); | ||||
| typeof b.hotkeys!=="undefined"&&b(document).bind("keydown","up",function(a){if(b.vakata.context.vis){var d=b.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();d.length||(d=b.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last());d.addClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","down",function(a){if(b.vakata.context.vis){var d= | ||||
| b.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();d.length||(d=b.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first());d.addClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","right",function(a){if(b.vakata.context.vis){b.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover"); | ||||
| a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","left",function(a){if(b.vakata.context.vis){b.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","esc",function(a){b.vakata.context.hide();a.preventDefault()}).bind("keydown","space",function(a){b.vakata.context.cnt.find(".vakata-hover").last().children("a").click();a.preventDefault()})});b.jstree.plugin("contextmenu", | ||||
| {__init:function(){this.get_container().delegate("a","contextmenu.jstree",b.proxy(function(a){a.preventDefault();this.show_contextmenu(a.currentTarget,a.pageX,a.pageY)},this)).bind("destroy.jstree",b.proxy(function(){this.data.contextmenu&&b.vakata.context.hide()},this));b(document).bind("context_hide.vakata",b.proxy(function(){this.data.contextmenu=false},this))},defaults:{select_node:false,show_at_node:true,items:{create:{separator_before:false,separator_after:true,label:"Create",action:function(a){this.create(a)}}, | ||||
| rename:{separator_before:false,separator_after:false,label:"Rename",action:function(a){this.rename(a)}},remove:{separator_before:false,icon:false,separator_after:false,label:"Delete",action:function(a){this.remove(a)}},ccp:{separator_before:true,icon:false,separator_after:false,label:"Edit",action:false,submenu:{cut:{separator_before:false,separator_after:false,label:"Cut",action:function(a){this.cut(a)}},copy:{separator_before:false,icon:false,separator_after:false,label:"Copy",action:function(a){this.copy(a)}}, | ||||
| paste:{separator_before:false,icon:false,separator_after:false,label:"Paste",action:function(a){this.paste(a)}}}}}},_fn:{show_contextmenu:function(a,d,e){a=this._get_node(a);var g=this.get_settings().contextmenu,i=a.children("a:visible:eq(0)"),c=false;if(g.select_node&&this.data.ui&&!this.is_selected(a)){this.deselect_all();this.select_node(a,true)}if(g.show_at_node||typeof d==="undefined"||typeof e==="undefined"){c=i.offset();d=c.left;e=c.top+this.data.core.li_height}if(b.isFunction(g.items))g.items= | ||||
| g.items.call(this,a);this.data.contextmenu=true;b.vakata.context.show(g.items,i,d,e,this,a);this.data.themes&&b.vakata.context.cnt.attr("class","jstree-"+this.data.themes.theme+"-context")}}})})(jQuery); | ||||
| (function(b){b.jstree.plugin("types",{__init:function(){var a=this._get_settings().types;this.data.types.attach_to=[];this.get_container().bind("init.jstree",b.proxy(function(){var d=a.type_attr,e="",g=this;b.each(a.types,function(i,c){b.each(c,function(f){/^(max_depth|max_children|icon|valid_children)$/.test(f)||g.data.types.attach_to.push(f)});if(!c.icon)return true;if(c.icon.image||c.icon.position){e+=i=="default"?".jstree-"+g.get_index()+" a > .jstree-icon { ":".jstree-"+g.get_index()+" li["+ | ||||
| d+"="+i+"] > a > .jstree-icon { ";if(c.icon.image)e+=" background-image:url("+c.icon.image+"); ";e+=c.icon.position?" background-position:"+c.icon.position+"; ":" background-position:0 0; ";e+="} "}});e!=""&&b.vakata.css.add_sheet({str:e})},this)).bind("before.jstree",b.proxy(function(d,e){if(b.inArray(e.func,this.data.types.attach_to)!==-1){var g=this._get_settings().types.types,i=this._get_type(e.args[0]);if((g[i]&&typeof g[i][e.func]!=="undefined"||g["default"]&&typeof g["default"][e.func]!=="undefined")&& | ||||
| !this._check(e.func,e.args[0])){d.stopImmediatePropagation();return false}}},this))},defaults:{max_children:-1,max_depth:-1,valid_children:"all",type_attr:"rel",types:{"default":{max_children:-1,max_depth:-1,valid_children:"all"}}},_fn:{_get_type:function(a){a=this._get_node(a);return!a||!a.length?false:a.attr(this._get_settings().types.type_attr)||"default"},set_type:function(a,d){d=this._get_node(d);return!d.length||!a?false:d.attr(this._get_settings().types.type_attr,a)},_check:function(a,d,e){var g= | ||||
| false,i=this._get_type(d),c=0,f=this,h=this._get_settings().types;if(d===-1)if(h[a])g=h[a];else return;else{if(i===false)return;if(h.types[i]&&h.types[i][a])g=h.types[i][a];else if(h.types["default"]&&h.types["default"][a])g=h.types["default"][a]}if(b.isFunction(g))g=g.call(this,d);a==="max_depth"&&d!==-1&&e!==false&&h.max_depth!==-2&&g!==0&&this._get_node(d).children("a:eq(0)").parentsUntil(".jstree","li").each(function(j){if(h.max_depth!==-1&&h.max_depth-(j+1)<=0){g=0;return false}c=j===0?g:f._check(a, | ||||
| this,false);if(c!==-1&&c-(j+1)<=0){g=0;return false}if(c>=0&&(c-(j+1)<g||g<0))g=c-(j+1);if(h.max_depth>=0&&(h.max_depth-(j+1)<g||g<0))g=h.max_depth-(j+1)});return g},check_move:function(){if(!this.__call_old())return false;var a=this._get_move(),d=a.rt._get_settings().types,e=a.rt._check("max_children",a.cr),g=a.rt._check("max_depth",a.cr),i=a.rt._check("valid_children",a.cr),c=0,f=1;if(i==="none")return false;if(b.isArray(i)&&a.ot&&a.ot._get_type){a.o.each(function(){if(b.inArray(a.ot._get_type(this), | ||||
| i)===-1)return f=false});if(f===false)return false}if(d.max_children!==-2&&e!==-1){c=a.cr===-1?this.get_container().children("> ul > li").not(a.o).length:a.cr.children("> ul > li").not(a.o).length;if(c+a.o.length>e)return false}if(d.max_depth!==-2&&g!==-1){f=0;if(g===0)return false;if(typeof a.o.d==="undefined"){for(d=a.o;d.length>0;){d=d.find("> ul > li");f++}a.o.d=f}if(g-a.o.d<0)return false}return true},create_node:function(a,d,e,g,i,c){if(!c&&(i||this._is_loaded(a))){var f=d&&d.match(/^before|after$/i)&& | ||||
| a!==-1?this._get_parent(a):this._get_node(a),h=this._get_settings().types,j=this._check("max_children",f),l=this._check("max_depth",f),k=this._check("valid_children",f);e||(e={});if(k==="none")return false;if(b.isArray(k))if(!e.attr||!e.attr[h.type_attr]){if(!e.attr)e.attr={};e.attr[h.type_attr]=k[0]}else if(b.inArray(e.attr[h.type_attr],k)===-1)return false;if(h.max_children!==-2&&j!==-1){f=f===-1?this.get_container().children("> ul > li").length:f.children("> ul > li").length;if(f+1>j)return false}if(h.max_depth!== | ||||
| -2&&l!==-1&&l-1<0)return false}return this.__call_old(true,a,d,e,g,i,c)}}})})(jQuery); | ||||
| (function(b){b.jstree.plugin("html_data",{__init:function(){this.data.html_data.original_container_html=this.get_container().find(" > ul > li").clone(true);this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function(){return this.nodeType==3}).remove()},defaults:{data:false,ajax:false,correct_state:true},_fn:{load_node:function(a,d,e){var g=this;this.load_node_html(a,function(){g.__callback({obj:a});d.call(this)},e)},_is_loaded:function(a){a=this._get_node(a);return a== | ||||
| -1||!a||!this._get_settings().html_data.ajax||a.is(".jstree-open, .jstree-leaf")||a.children("ul").children("li").size()>0},load_node_html:function(a,d,e){var g,i=this.get_settings().html_data,c=function(){};g=function(){};if((a=this._get_node(a))&&a!==-1)if(a.data("jstree-is-loading"))return;else a.data("jstree-is-loading",true);switch(true){case !i.data&&!i.ajax:if(!a||a==-1){this.get_container().children("ul").empty().append(this.data.html_data.original_container_html).find("li, a").filter(function(){return this.firstChild.tagName!== | ||||
| "INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");this.clean_node()}d&&d.call(this);break;case !!i.data&&!i.ajax||!!i.data&&!!i.ajax&&(!a||a===-1):if(!a||a==-1){g=b(i.data);g.is("ul")||(g=b("<ul>").append(g));this.get_container().children("ul").empty().append(g.children()).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); | ||||
| this.clean_node()}d&&d.call(this);break;case !i.data&&!!i.ajax||!!i.data&&!!i.ajax&&a&&a!==-1:a=this._get_node(a);c=function(f,h,j){var l=this.get_settings().html_data.ajax.error;l&&l.call(this,f,h,j);if(a!=-1&&a.length){a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);h==="success"&&i.correct_state&&a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}else h==="success"&&i.correct_state&&this.get_container().children("ul").empty();e&&e.call(this)}; | ||||
| g=function(f,h,j){var l=this.get_settings().html_data.ajax.success;if(l)f=l.call(this,f,h,j)||f;if(f=="")return c.call(this,j,h,"");if(f){f=b(f);f.is("ul")||(f=b("<ul>").append(f));if(a==-1||!a)this.get_container().children("ul").empty().append(f.children()).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");else{a.children(".jstree-loading").removeClass("jstree-loading"); | ||||
| a.append(f).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");a.data("jstree-is-loading",false)}this.clean_node(a);d&&d.call(this)}else if(a&&a!==-1){a.children(".jstree-loading").removeClass("jstree-loading");a.data("jstree-is-loading",false);if(i.correct_state){a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");d&&d.call(this)}}else if(i.correct_state){this.get_container().children("ul").empty(); | ||||
| d&&d.call(this)}};i.ajax.context=this;i.ajax.error=c;i.ajax.success=g;if(!i.ajax.dataType)i.ajax.dataType="html";if(b.isFunction(i.ajax.url))i.ajax.url=i.ajax.url.call(this,a);if(b.isFunction(i.ajax.data))i.ajax.data=i.ajax.data.call(this,a);b.ajax(i.ajax)}}}});b.jstree.defaults.plugins.push("html_data")})(jQuery); | ||||
| (function(b){b.jstree.plugin("themeroller",{__init:function(){var a=this._get_settings().themeroller;this.get_container().addClass("ui-widget-content").delegate("a","mouseenter.jstree",function(){b(this).addClass(a.item_h)}).delegate("a","mouseleave.jstree",function(){b(this).removeClass(a.item_h)}).bind("open_node.jstree create_node.jstree",b.proxy(function(d,e){this._themeroller(e.rslt.obj)},this)).bind("loaded.jstree refresh.jstree",b.proxy(function(){this._themeroller()},this)).bind("close_node.jstree", | ||||
| b.proxy(function(d,e){e.rslt.obj.children("ins").removeClass(a.opened).addClass(a.closed)},this)).bind("select_node.jstree",b.proxy(function(d,e){e.rslt.obj.children("a").addClass(a.item_a)},this)).bind("deselect_node.jstree deselect_all.jstree",b.proxy(function(){this.get_container().find("."+a.item_a).removeClass(a.item_a).end().find(".jstree-clicked").addClass(a.item_a)},this)).bind("move_node.jstree",b.proxy(function(d,e){this._themeroller(e.rslt.o)},this))},__destroy:function(){var a=this._get_settings().themeroller, | ||||
| d=["ui-icon"];b.each(a,function(e,g){g=g.split(" ");if(g.length)d=d.concat(g)});this.get_container().removeClass("ui-widget-content").find("."+d.join(", .")).removeClass(d.join(" "))},_fn:{_themeroller:function(a){var d=this._get_settings().themeroller;a=!a||a==-1?this.get_container():this._get_node(a).parent();a.find("li.jstree-closed > ins.jstree-icon").removeClass(d.opened).addClass("ui-icon "+d.closed).end().find("li.jstree-open > ins.jstree-icon").removeClass(d.closed).addClass("ui-icon "+d.opened).end().find("a").addClass(d.item).children("ins.jstree-icon").addClass("ui-icon "+ | ||||
| d.item_icon)}},defaults:{opened:"ui-icon-triangle-1-se",closed:"ui-icon-triangle-1-e",item:"ui-state-default",item_h:"ui-state-hover",item_a:"ui-state-active",item_icon:"ui-icon-folder-collapsed"}});b(function(){b.vakata.css.add_sheet({str:".jstree .ui-icon { overflow:visible; } .jstree a { padding:0 2px; }"})})})(jQuery); | ||||
| (function(b){b.jstree.plugin("unique",{__init:function(){this.get_container().bind("before.jstree",b.proxy(function(a,d){var e=[],g=true,i;if(d.func=="move_node")if(d.args[4]===true)if(d.args[0].o&&d.args[0].o.length){d.args[0].o.children("a").each(function(){e.push(b(this).text().replace(/^\s+/g,""))});g=this._check_unique(e,d.args[0].np.find("> ul > li").not(d.args[0].o))}if(d.func=="create_node")if(d.args[4]||this._is_loaded(d.args[0])){g=this._get_node(d.args[0]);if(d.args[1]&&(d.args[1]==="before"|| | ||||
| d.args[1]==="after")){g=this._get_parent(d.args[0]);if(!g||g===-1)g=this.get_container()}if(typeof d.args[2]==="string")e.push(d.args[2]);else!d.args[2]||!d.args[2].data?e.push(this._get_settings().core.strings.new_node):e.push(d.args[2].data);g=this._check_unique(e,g.find("> ul > li"))}if(d.func=="rename_node"){e.push(d.args[1]);i=this._get_node(d.args[0]);g=this._get_parent(i);if(!g||g===-1)g=this.get_container();g=this._check_unique(e,g.find("> ul > li").not(i))}if(!g){a.stopPropagation();return false}}, | ||||
| this))},_fn:{_check_unique:function(a,d){var e=[];d.children("a").each(function(){e.push(b(this).text().replace(/^\s+/g,""))});if(!e.length||!a.length)return true;e=e.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");if(e.length+a.length!=e.concat(a).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length)return false;return true},check_move:function(){if(!this.__call_old())return false; | ||||
| var a=this._get_move(),d=[];if(a.o&&a.o.length){a.o.children("a").each(function(){d.push(b(this).text().replace(/^\s+/g,""))});return this._check_unique(d,a.np.find("> ul > li").not(a.o))}return true}}})})(jQuery); | ||||
| @@ -1,465 +0,0 @@ | ||||
| /* | ||||
|     author: ApmeM (artem.votincev@gmail.com) | ||||
|     date: 9-June-2010 | ||||
|     version: 1.4 | ||||
|     download: http://code.google.com/p/jq-serverbrowse/ | ||||
|  */ | ||||
|  | ||||
| (function($) { | ||||
| 	$.fn.serverBrowser = function(settings) { | ||||
| 		this.each(function() { | ||||
|  | ||||
| 			var config = { | ||||
| 				// Event function | ||||
| 				// Appear when user click 'Ok' button, or doubleclick on file | ||||
| 				onSelect : function(file) { | ||||
| 					alert('You select: ' + file); | ||||
| 				}, | ||||
| 				onLoad : function() { | ||||
| 					return config.basePath; | ||||
| 				}, | ||||
| 				multiselect : false, | ||||
| 				// Image parameters | ||||
| 				// System images (loading.gif, unknown.png, folder.png and | ||||
| 				// images from knownPaths) will be referenced to systemImageUrl | ||||
| 				// if systemImageUrl is empty or not specified - imageUrl will | ||||
| 				// be taken | ||||
| 				// All other images (like images for extension) will be taken | ||||
| 				// from imageUrl | ||||
| 				imageUrl : 'img/', | ||||
| 				systemImageUrl : '', | ||||
| 				showUpInList : false, | ||||
| 				// Path properties | ||||
| 				// Base path, that links should start from. | ||||
| 				// If opened path is not under this path, alert will be shown | ||||
| 				// and nothing will be opened | ||||
| 				// Path separator, that will be used to split specified paths | ||||
| 				// and join paths to a string | ||||
| 				basePath : 'C:', | ||||
| 				separatorPath : '/', | ||||
| 				// Paths, that will be displayed on the left side of the dialog | ||||
| 				// This is a link to specified paths on the server | ||||
| 				useKnownPaths : true, | ||||
| 				knownPaths : [ { | ||||
| 					text : 'Desktop', | ||||
| 					image : 'desktop.png', | ||||
| 					path : 'C:/Users/All Users/Desktop' | ||||
| 				}, { | ||||
| 					text : 'Documents', | ||||
| 					image : 'documents.png', | ||||
| 					path : 'C:/Users/All Users/Documents' | ||||
| 				} ], | ||||
| 				// Images for known extension (like 'png', 'exe', 'zip'), that | ||||
| 				// will be displayed with its real names | ||||
| 				// Images, that is not in this list will be referenced to | ||||
| 				// 'unknown.png' image | ||||
| 				// If list is empty - all images is known. | ||||
| 				knownExt : [], | ||||
| 				// Server path to this plugin handler | ||||
| 				handlerUrl : 'browserDlg.txt', | ||||
| 				// JQuery-ui dialog settings | ||||
| 				title : 'Browse', | ||||
| 				width : 300, | ||||
| 				height : 300, | ||||
| 				position : [ 'center', 'center' ], | ||||
|  | ||||
| 				// Administrative parameters used to | ||||
| 				// help programmer or system administrator | ||||
| 				requestMethod : 'POST' | ||||
| 			}; | ||||
|  | ||||
| 			if (settings) | ||||
| 				$.extend(config, settings); | ||||
| 			// Required configuration elements | ||||
| 			// We need to set some configuration elements without user | ||||
| 			// For example there should be 2 buttons on the bottom, | ||||
| 			// And dialog should be opened after button is pressed, not when it | ||||
| 			// created | ||||
| 			// Also we need to know about dialog resizing | ||||
| 			$.extend(config, { | ||||
| 				autoOpen : false, | ||||
| 				modal : true, | ||||
| 				buttons : { | ||||
| 					"Open" : function() { | ||||
| 						doneOk(); | ||||
| 					}, | ||||
| 					"Cancel" : function() { | ||||
| 						browserDlg.dialog("close"); | ||||
| 					} | ||||
| 				}, | ||||
| 				resize : function(event, ui) { | ||||
| 					recalculateSize(event, ui); | ||||
| 				} | ||||
| 			}); | ||||
|  | ||||
| 			function systemImageUrl() { | ||||
| 				if (config.systemImageUrl.length == 0) { | ||||
| 					return config.imageUrl; | ||||
| 				} else { | ||||
| 					return config.systemImageUrl; | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			var privateConfig = { | ||||
| 				// This stack array will store history navigation data | ||||
| 				// When user open new directory, old directory will be added to | ||||
| 				// this list | ||||
| 				// If user want, he will be able to move back by this history | ||||
| 				browserHistory : [], | ||||
|  | ||||
| 				// This array contains all currently selected items | ||||
| 				// When user select element, it will add associated path into | ||||
| 				// this array | ||||
| 				// When user deselect element - associated path will be removed | ||||
| 				// Exception: if 'config.multiselect' is false, only one element | ||||
| 				// will be stored in this array. | ||||
| 				selectedItems : [] | ||||
| 			}; | ||||
|  | ||||
| 			// Main dialog div | ||||
| 			// It will be converted into jQuery-ui dialog box using my | ||||
| 			// configuration parameters | ||||
| 			// It contains 3 divs | ||||
| 			var browserDlg = $('<div title="' + config.title + '"></div>').css( { | ||||
| 				'overflow' : 'hidden' | ||||
| 			}).appendTo(document.body); | ||||
| 			browserDlg.dialog(config); | ||||
|  | ||||
| 			// First div on the top | ||||
| 			// It contains textbox field and buttons | ||||
| 			// User can enter any paths he want to open in this textbox and | ||||
| 			// press enter | ||||
| 			// There is 3 buttons on the panel: | ||||
| 			var enterPathDiv = $('<div></div>').addClass('ui-widget-content').appendTo(browserDlg).css( { | ||||
| 				'height' : '30px', | ||||
| 				'width' : '100%', | ||||
| 				'padding-top' : '7px' | ||||
| 			}); | ||||
|  | ||||
| 			var enterButton = $('<div></div>').css( { | ||||
| 				'float' : 'left', | ||||
| 				'vertical-align' : 'middle', | ||||
| 				'margin-left' : '6px' | ||||
| 			}).addClass('ui-corner-all').hover(function() { | ||||
| 				$(this).addClass('ui-state-hover'); | ||||
| 			}, function() { | ||||
| 				$(this).removeClass('ui-state-hover'); | ||||
| 			}); | ||||
|  | ||||
| 			var enterLabel = $('<span></span>').text('Look in: ').appendTo(enterButton.clone(false).appendTo(enterPathDiv)); | ||||
|  | ||||
| 			var enterText = $('<input type="text">').keypress(function(e) { | ||||
| 				if (e.keyCode == '13') { | ||||
| 					e.preventDefault(); | ||||
| 					loadPath(enterText.val()); | ||||
| 				} | ||||
| 			}).css('width', '200px').appendTo(enterButton.clone(false).appendTo(enterPathDiv)); | ||||
|  | ||||
| 			// Back button. | ||||
| 			// When user click on it, 2 last elements of the history pop from | ||||
| 			// the list, and reload second of them. | ||||
| 			var enterBack = $('<div></div>').addClass('ui-corner-all ui-icon ui-icon-circle-arrow-w').click(function() { | ||||
| 				privateConfig.browserHistory.pop(); // Remove current element. | ||||
| 													// It is not required now. | ||||
| 				var backPath = config.basePath; | ||||
| 				if (privateConfig.browserHistory.length > 0) { | ||||
| 					backPath = privateConfig.browserHistory.pop(); | ||||
| 				} | ||||
| 				loadPath(backPath); | ||||
| 			}).appendTo(enterButton.clone(true).appendTo(enterPathDiv)); | ||||
|  | ||||
| 			// Level Up Button | ||||
| 			// When user click on it, last element of the history will be taken, | ||||
| 			// and '..' will be applied to the end of the array. | ||||
| 			var enterUp = $('<div></div>').addClass('ui-corner-all ui-icon ui-icon-arrowreturnthick-1-n').click(function() { | ||||
| 				backPath = privateConfig.browserHistory[privateConfig.browserHistory.length - 1]; | ||||
| 				if (backPath != config.basePath) { | ||||
| 					loadPath(backPath + config.separatorPath + '..'); | ||||
| 				} | ||||
| 			}).appendTo(enterButton.clone(true).appendTo(enterPathDiv)); | ||||
|  | ||||
| 			// Second div is on the left | ||||
| 			// It contains images and texts for pre-defined paths | ||||
| 			// User just click on them and it will open pre-defined path | ||||
| 			var knownPathDiv = $('<div></div>').addClass('ui-widget-content').css( { | ||||
| 				'text-align' : 'center', | ||||
| 				'overflow' : 'auto', | ||||
| 				'float' : 'left', | ||||
| 				'width' : '100px' | ||||
| 			}); | ||||
| 			if (config.useKnownPaths) { | ||||
| 				knownPathDiv.appendTo(browserDlg); | ||||
| 				$.each(config.knownPaths, function(index, path) { | ||||
| 					var knownDiv = $('<div></div>').css( { | ||||
| 						'margin' : '10px' | ||||
| 					}).hover(function() { | ||||
| 						$(this).addClass('ui-state-hover'); | ||||
| 					}, function() { | ||||
| 						$(this).removeClass('ui-state-hover'); | ||||
| 					}).click(function() { | ||||
| 						loadPath(path.path); | ||||
| 					}).appendTo(knownPathDiv); | ||||
|  | ||||
| 					$('<img />').attr( { | ||||
| 						src : systemImageUrl() + config.separatorPath + path.image | ||||
| 					}).css( { | ||||
| 						width : '32px', | ||||
| 						margin : '5px 10px 5px 5px' | ||||
| 					}).appendTo(knownDiv); | ||||
| 					$('<br/>').appendTo(knownDiv); | ||||
| 					$('<span></span>').text(path.text).appendTo(knownDiv); | ||||
| 				}); | ||||
| 			} | ||||
|  | ||||
| 			// Third div is everywhere :) | ||||
| 			// It show files and folders in the current path | ||||
| 			// User can click on path to select or deselect it | ||||
| 			// Doubleclick on path will open it | ||||
| 			// Also doubleclick on file will select this file and close dialog | ||||
| 			var browserPathDiv = $('<div></div>').addClass('ui-widget-content').css( { | ||||
| 				'float' : 'right', | ||||
| 				'overflow' : 'auto' | ||||
| 			}).appendTo(browserDlg); | ||||
|  | ||||
| 			// Now everything is done | ||||
| 			// When user will be ready - he just click on the area you select | ||||
| 			// for this plugin and dialog will appear | ||||
| 			$(this).click(function() { | ||||
| 				privateConfig.browserHistory = []; | ||||
| 				var startpath = removeBackPath(config.onLoad()); | ||||
|  | ||||
| 				startpath = startpath.split(config.separatorPath); | ||||
| 				startpath.pop(); | ||||
| 				startpath = startpath.join(config.separatorPath); | ||||
|  | ||||
| 				if (!checkBasePath(startpath)) { | ||||
| 					startpath = config.basePath; | ||||
| 				} | ||||
| 				loadPath(startpath); | ||||
| 				browserDlg.dialog('open'); | ||||
| 				recalculateSize(); | ||||
| 			}); | ||||
|  | ||||
| 			// Function check if specified path is a child path of a | ||||
| 			// 'config.basePath' | ||||
| 			// If it is not - user should see message, that path invalid, or | ||||
| 			// path should be changed to valid. | ||||
| 			function checkBasePath(path) { | ||||
| 				if (config.basePath == '') | ||||
| 					return true; | ||||
| 				var confPath = config.basePath.split(config.separatorPath); | ||||
| 				var curPath = path.split(config.separatorPath); | ||||
| 				if (confPath.length > curPath.length) | ||||
| 					return false; | ||||
| 				var result = true; | ||||
| 				$.each(confPath, function(index, partConfPath) { | ||||
| 					if (partConfPath != curPath[index]) { | ||||
| 						result = false; | ||||
| 					} | ||||
| 				}); | ||||
| 				return result; | ||||
| 			} | ||||
|  | ||||
| 			// Function remove '..' parts of the path | ||||
| 			// Process depend on config.separatorPath option | ||||
| 			// On the server side you need to check / or \ separators | ||||
| 			function removeBackPath(path) { | ||||
| 				var confPath = config.basePath.split(config.separatorPath); | ||||
| 				var curPath = path.split(config.separatorPath); | ||||
| 				var newcurPath = []; | ||||
| 				$.each(curPath, function(index, partCurPath) { | ||||
| 					if (partCurPath == "..") { | ||||
| 						newcurPath.pop(); | ||||
| 					} else { | ||||
| 						newcurPath.push(partCurPath); | ||||
| 					} | ||||
| 				}); | ||||
| 				return newcurPath.join(config.separatorPath); | ||||
| 			} | ||||
|  | ||||
| 			// This function will be called when user click 'Open' | ||||
| 			// It check if any path is selected, and call config.onSelect | ||||
| 			// function with path list | ||||
| 			function doneOk() { | ||||
| 				var newCurPath = []; | ||||
| 				$.each(privateConfig.selectedItems, function(index, item) { | ||||
| 					newCurPath.push($.data(item, 'path')); | ||||
| 				}); | ||||
| 				if (newCurPath.length == 0) { | ||||
| 					newCurPath.push(privateConfig.browserHistory.pop()); | ||||
| 				} | ||||
|  | ||||
| 				if (config.multiselect) | ||||
| 					config.onSelect(newCurPath); | ||||
| 				else { | ||||
| 					if (newCurPath.length == 1) { | ||||
| 						config.onSelect(newCurPath[0]); | ||||
| 					} else if (newCurPath.length > 1) { | ||||
| 						alert('Plugin work incorrectly. If error repeat, please add issue into http://code.google.com/p/jq-serverbrowse/issues/list with steps to reproduce.'); | ||||
| 						return; | ||||
| 					} | ||||
| 				} | ||||
| 				browserDlg.dialog("close"); | ||||
| 			} | ||||
|  | ||||
| 			// Function recalculate and set new width and height for left and | ||||
| 			// right div elements | ||||
| 			// height have '-2' because of the borders | ||||
| 			// width have '-4' because of a border an 2 pixels space between | ||||
| 			// divs | ||||
| 			function recalculateSize(event, ui) { | ||||
| 				knownPathDiv.css( { | ||||
| 					'height' : browserDlg.height() - enterPathDiv.outerHeight(true) - 2 | ||||
| 				}); | ||||
| 				browserPathDiv.css( { | ||||
| 					'height' : browserDlg.height() - enterPathDiv.outerHeight(true) - 2, | ||||
| 					'width' : browserDlg.width() - knownPathDiv.outerWidth(true) - 4 | ||||
| 				}); | ||||
| 			} | ||||
|  | ||||
| 			// Function adds new element into browserPathDiv element depends on | ||||
| 			// file parameters | ||||
| 			// If file.isError is set, error message will be displayed instead | ||||
| 			// of clickable area | ||||
| 			// Clickable div contain image from extension and text from file | ||||
| 			// parameter | ||||
| 			function addElement(file) { | ||||
| 				var itemDiv = $('<div></div>').css( { | ||||
| 					margin : '2px' | ||||
| 				}).appendTo(browserPathDiv); | ||||
| 				if (file.isError) { | ||||
| 					itemDiv.addClass('ui-state-error ui-corner-all').css( { | ||||
| 						padding : '0pt 0.7em' | ||||
| 					}); | ||||
| 					var p = $('<p></p>').appendTo(itemDiv); | ||||
| 					$('<span></span>').addClass('ui-icon ui-icon-alert').css( { | ||||
| 						'float' : 'left', | ||||
| 						'margin-right' : '0.3em' | ||||
| 					}).appendTo(p); | ||||
| 					$('<span></span>').text(file.name).appendTo(p); | ||||
| 				} else { | ||||
| 					var fullPath = file.path + config.separatorPath + file.name; | ||||
| 					itemDiv.hover(function() { | ||||
| 						$(this).addClass('ui-state-hover'); | ||||
| 					}, function() { | ||||
| 						$(this).removeClass('ui-state-hover'); | ||||
| 					}); | ||||
| 					var itemImage = $('<img />').css( { | ||||
| 						width : '16px', | ||||
| 						margin : '0 5px 0 0' | ||||
| 					}).appendTo(itemDiv); | ||||
| 					var itemText = $('<span></span>').text(file.name).appendTo(itemDiv); | ||||
| 					if (file.isFolder) | ||||
| 						itemImage.attr( { | ||||
| 							src : systemImageUrl() + 'folder.png' | ||||
| 						}); | ||||
| 					else { | ||||
| 						ext = file.name.split('.').pop(); | ||||
| 						var res = ''; | ||||
| 						if (ext == '' || ext == file.name || (config.knownExt.length > 0 && $.inArray(ext, config.knownExt) < 0)) | ||||
| 							itemImage.attr( { | ||||
| 								src : systemImageUrl() + 'unknown.png' | ||||
| 							}); | ||||
| 						else | ||||
| 							itemImage.attr( { | ||||
| 								src : config.imageUrl + ext + '.png' | ||||
| 							}); | ||||
| 					} | ||||
| 					$.data(itemDiv, 'path', fullPath); | ||||
| 					itemDiv.unbind('click').bind('click', function(e) { | ||||
| 						if (!$(this).hasClass('ui-state-active')) { | ||||
| 							if (!config.multiselect && privateConfig.selectedItems.length > 0) { | ||||
| 								$(privateConfig.selectedItems[0]).click(); | ||||
| 							} | ||||
| 							privateConfig.selectedItems.push(itemDiv); | ||||
| 						} else { | ||||
| 							var newCurPath = []; | ||||
| 							$.each(privateConfig.selectedItems, function(index, item) { | ||||
| 								if ($.data(item, 'path') != fullPath) | ||||
| 									newCurPath.push(item); | ||||
| 							}); | ||||
| 							privateConfig.selectedItems = newCurPath; | ||||
| 						} | ||||
| 						$(this).toggleClass('ui-state-active'); | ||||
| 					}); | ||||
|  | ||||
| 					itemDiv.unbind('dblclick').bind('dblclick', function(e) { | ||||
| 						if (file.isFolder) { | ||||
| 							loadPath(fullPath); | ||||
| 						} else { | ||||
| 							privateConfig.selectedItems = [ itemDiv ]; | ||||
| 							doneOk(); | ||||
| 						} | ||||
| 					}); | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			// Main plugin function | ||||
| 			// When user enter path manually, select it from pre-defined path, | ||||
| 			// or doubleclick in browser this function will call | ||||
| 			// It send a request on the server to retrieve child directories and | ||||
| 			// files of the specified path | ||||
| 			// If path is not under 'config.basePath', alert will be shown and | ||||
| 			// nothing will be opened | ||||
| 			function loadPath(path) { | ||||
| 				privateConfig.selectedItems = []; | ||||
|  | ||||
| 				// First we need to remove all '..' parts of the path | ||||
| 				path = removeBackPath(path); | ||||
|  | ||||
| 				// Then we need to check, if path based on 'config.basePath' | ||||
| 				if (!checkBasePath(path)) { | ||||
| 					alert('Path should be based from ' + config.basePath); | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| 				// Then we can put this path into history | ||||
| 				privateConfig.browserHistory.push(path); | ||||
|  | ||||
| 				// Show it to user | ||||
| 				enterText.val(path); | ||||
|  | ||||
| 				// And load | ||||
| 				$.ajax( { | ||||
| 					url : config.handlerUrl, | ||||
| 					type : config.requestMethod, | ||||
| 					data : { | ||||
| 						action : 'browse', | ||||
| 						path : path, | ||||
| 						time : new Date().getTime() | ||||
| 					}, | ||||
| 					beforeSend : function() { | ||||
| 						browserPathDiv.empty().css( { | ||||
| 							'text-align' : 'center' | ||||
| 						}); | ||||
| 						$('<img />').attr( { | ||||
| 							src : systemImageUrl() + 'loading.gif' | ||||
| 						}).css( { | ||||
| 							width : '32px' | ||||
| 						}).appendTo(browserPathDiv); | ||||
| 					}, | ||||
| 					success : function(files) { | ||||
| 						browserPathDiv.empty().css( { | ||||
| 							'text-align' : 'left' | ||||
| 						}); | ||||
| 						if (path != config.basePath && config.showUpInList) { | ||||
| 							addElement( { | ||||
| 								name : '..', | ||||
| 								isFolder : true, | ||||
| 								isError : false, | ||||
| 								path : path | ||||
| 							}); | ||||
| 						} | ||||
| 						$.each(files, function(index, file) { | ||||
| 							addElement($.extend(file, { | ||||
| 								path : path | ||||
| 							})); | ||||
| 						}); | ||||
| 					}, | ||||
| 					dataType : 'json' | ||||
| 				}); | ||||
| 			} | ||||
| 		}); | ||||
| 		return this; | ||||
| 	}; | ||||
| })(jQuery); | ||||
							
								
								
									
										17
									
								
								xCAT-UI/js/jquery/jquery.serverBrowser.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								xCAT-UI/js/jquery/jquery.serverBrowser.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| /* | ||||
|  Author: ApmeM (artem.votincev@gmail.com) | ||||
|  Date: 9-June-2010 | ||||
|  Version: 1.4 | ||||
|  Download: http://code.google.com/p/jq-serverbrowse/ | ||||
| */ | ||||
| (function(b){b.fn.serverBrowser=function(p){this.each(function(){function l(){return c.systemImageUrl.length==0?c.imageUrl:c.systemImageUrl}function q(a){if(c.basePath=="")return true;var d=c.basePath.split(c.separatorPath),e=a.split(c.separatorPath);if(d.length>e.length)return false;var g=true;b.each(d,function(m,r){if(r!=e[m])g=false});return g}function s(a){c.basePath.split(c.separatorPath);a=a.split(c.separatorPath);var d=[];b.each(a,function(e,g){g==".."?d.pop():d.push(g)});return d.join(c.separatorPath)} | ||||
| function t(){var a=[];b.each(f.selectedItems,function(d,e){a.push(b.data(e,"path"))});a.length==0&&a.push(f.browserHistory.pop());if(c.multiselect)c.onSelect(a);else if(a.length==1)c.onSelect(a[0]);else if(a.length>1){alert("Plugin work incorrectly. If error repeat, please add issue into http://code.google.com/p/jq-serverbrowse/issues/list with steps to reproduce.");return}h.dialog("close")}function u(){n.css({height:h.height()-i.outerHeight(true)-2});k.css({height:h.height()-i.outerHeight(true)- | ||||
| 2,width:h.width()-n.outerWidth(true)-4})}function v(a){var d=b("<div></div>").css({margin:"2px"}).appendTo(k);if(a.isError){d.addClass("ui-state-error ui-corner-all").css({padding:"0pt 0.7em"});var e=b("<p></p>").appendTo(d);b("<span></span>").addClass("ui-icon ui-icon-alert").css({"float":"left","margin-right":"0.3em"}).appendTo(e);b("<span></span>").text(a.name).appendTo(e)}else{var g=a.path+c.separatorPath+a.name;d.hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")}); | ||||
| e=b("<img />").css({width:"16px",margin:"0 5px 0 0"}).appendTo(d);b("<span></span>").text(a.name).appendTo(d);if(a.isFolder)e.attr({src:l()+"folder.png"});else{ext=a.name.split(".").pop();ext==""||ext==a.name||c.knownExt.length>0&&b.inArray(ext,c.knownExt)<0?e.attr({src:l()+"unknown.png"}):e.attr({src:c.imageUrl+ext+".png"})}b.data(d,"path",g);d.unbind("click").bind("click",function(){if(b(this).hasClass("ui-state-active")){var m=[];b.each(f.selectedItems,function(r,w){b.data(w,"path")!=g&&m.push(w)}); | ||||
| f.selectedItems=m}else{!c.multiselect&&f.selectedItems.length>0&&b(f.selectedItems[0]).click();f.selectedItems.push(d)}b(this).toggleClass("ui-state-active")});d.unbind("dblclick").bind("dblclick",function(){if(a.isFolder)j(g);else{f.selectedItems=[d];t()}})}}function j(a){f.selectedItems=[];a=s(a);if(q(a)){f.browserHistory.push(a);x.val(a);b.ajax({url:c.handlerUrl,type:c.requestMethod,data:{action:"browse",path:a,time:(new Date).getTime()},beforeSend:function(){k.empty().css({"text-align":"center"}); | ||||
| b("<img />").attr({src:l()+"loading.gif"}).css({width:"32px"}).appendTo(k)},success:function(d){k.empty().css({"text-align":"left"});a!=c.basePath&&c.showUpInList&&v({name:"..",isFolder:true,isError:false,path:a});b.each(d,function(e,g){v(b.extend(g,{path:a}))})},dataType:"json"})}else alert("Path should be based from "+c.basePath)}var c={onSelect:function(a){alert("You select: "+a)},onLoad:function(){return c.basePath},multiselect:false,imageUrl:"img/",systemImageUrl:"",showUpInList:false,basePath:"C:", | ||||
| separatorPath:"/",useKnownPaths:true,knownPaths:[{text:"Desktop",image:"desktop.png",path:"C:/Users/All Users/Desktop"},{text:"Documents",image:"documents.png",path:"C:/Users/All Users/Documents"}],knownExt:[],handlerUrl:"browserDlg.txt",title:"Browse",width:300,height:300,position:["center","center"],requestMethod:"POST"};p&&b.extend(c,p);b.extend(c,{autoOpen:false,modal:true,buttons:{Open:function(){t()},Cancel:function(){h.dialog("close")}},resize:function(a,d){u(a,d)}});var f={browserHistory:[], | ||||
| selectedItems:[]},h=b('<div title="'+c.title+'"></div>').css({overflow:"hidden"}).appendTo(document.body);h.dialog(c);var i=b("<div></div>").addClass("ui-widget-content").appendTo(h).css({height:"30px",width:"100%","padding-top":"7px"}),o=b("<div></div>").css({"float":"left","vertical-align":"middle","margin-left":"6px"}).addClass("ui-corner-all").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});b("<span></span>").text("Look in: ").appendTo(o.clone(false).appendTo(i)); | ||||
| var x=b('<input type="text">').keypress(function(a){if(a.keyCode=="13"){a.preventDefault();j(x.val())}}).css("width","200px").appendTo(o.clone(false).appendTo(i));b("<div></div>").addClass("ui-corner-all ui-icon ui-icon-circle-arrow-w").click(function(){f.browserHistory.pop();var a=c.basePath;if(f.browserHistory.length>0)a=f.browserHistory.pop();j(a)}).appendTo(o.clone(true).appendTo(i));b("<div></div>").addClass("ui-corner-all ui-icon ui-icon-arrowreturnthick-1-n").click(function(){backPath=f.browserHistory[f.browserHistory.length- | ||||
| 1];backPath!=c.basePath&&j(backPath+c.separatorPath+"..")}).appendTo(o.clone(true).appendTo(i));var n=b("<div></div>").addClass("ui-widget-content").css({"text-align":"center",overflow:"auto","float":"left",width:"100px"});if(c.useKnownPaths){n.appendTo(h);b.each(c.knownPaths,function(a,d){var e=b("<div></div>").css({margin:"10px"}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")}).click(function(){j(d.path)}).appendTo(n);b("<img />").attr({src:l()+ | ||||
| c.separatorPath+d.image}).css({width:"32px",margin:"5px 10px 5px 5px"}).appendTo(e);b("<br/>").appendTo(e);b("<span></span>").text(d.text).appendTo(e)})}var k=b("<div></div>").addClass("ui-widget-content").css({"float":"right",overflow:"auto"}).appendTo(h);b(this).click(function(){f.browserHistory=[];var a=s(c.onLoad());a=a.split(c.separatorPath);a.pop();a=a.join(c.separatorPath);if(!q(a))a=c.basePath;j(a);h.dialog("open");u()})});return this}})(jQuery); | ||||
							
								
								
									
										12
									
								
								xCAT-UI/js/jquery/jquery.topzindex.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								xCAT-UI/js/jquery/jquery.topzindex.min.js
									
									
									
									
										vendored
									
									
								
							| @@ -1,8 +1,8 @@ | ||||
| /* | ||||
| 	TopZIndex 1.2 (October 21, 2010) plugin for jQuery | ||||
| 	http://topzindex.googlecode.com/ | ||||
| 	Copyright (c) 2009-2011 Todd Northrop | ||||
| 	http://www.speednet.biz/ | ||||
| 	Licensed under GPL 3, see  <http://www.gnu.org/licenses/> | ||||
| */ | ||||
|  * TopZIndex 1.2 (October 21, 2010) plugin for jQuery | ||||
|  * http://topzindex.googlecode.com/ | ||||
|  * Copyright (c) 2009-2011 Todd Northrop | ||||
|  * http://www.speednet.biz/ | ||||
|  * Licensed under GPL 3, see  <http://www.gnu.org/licenses/> | ||||
|  */ | ||||
| (function(a){a.topZIndex=function(b){return Math.max(0,Math.max.apply(null,a.map((b||"*")==="*"?a.makeArray(document.getElementsByTagName("*")):a(b),function(b){return parseFloat(a(b).css("z-index"))||null})))};a.fn.topZIndex=function(b){if(this.length===0)return this;b=a.extend({increment:1},b);var c=a.topZIndex(b.selector),d=b.increment;return this.each(function(){this.style.zIndex=c+=d})}})(jQuery); | ||||
							
								
								
									
										121
									
								
								xCAT-UI/js/jquery/superfish.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										121
									
								
								xCAT-UI/js/jquery/superfish.js
									
									
									
									
										vendored
									
									
								
							| @@ -1,121 +0,0 @@ | ||||
|  | ||||
| /* | ||||
|  * Superfish v1.4.8 - jQuery menu widget | ||||
|  * Copyright (c) 2008 Joel Birch | ||||
|  * | ||||
|  * Dual licensed under the MIT and GPL licenses: | ||||
|  * 	http://www.opensource.org/licenses/mit-license.php | ||||
|  * 	http://www.gnu.org/licenses/gpl.html | ||||
|  * | ||||
|  * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt | ||||
|  */ | ||||
|  | ||||
| ;(function($){ | ||||
| 	$.fn.superfish = function(op){ | ||||
|  | ||||
| 		var sf = $.fn.superfish, | ||||
| 			c = sf.c, | ||||
| 			$arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), | ||||
| 			over = function(){ | ||||
| 				var $$ = $(this), menu = getMenu($$); | ||||
| 				clearTimeout(menu.sfTimer); | ||||
| 				$$.showSuperfishUl().siblings().hideSuperfishUl(); | ||||
| 			}, | ||||
| 			out = function(){ | ||||
| 				var $$ = $(this), menu = getMenu($$), o = sf.op; | ||||
| 				clearTimeout(menu.sfTimer); | ||||
| 				menu.sfTimer=setTimeout(function(){ | ||||
| 					o.retainPath=($.inArray($$[0],o.$path)>-1); | ||||
| 					$$.hideSuperfishUl(); | ||||
| 					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} | ||||
| 				},o.delay);	 | ||||
| 			}, | ||||
| 			getMenu = function($menu){ | ||||
| 				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; | ||||
| 				sf.op = sf.o[menu.serial]; | ||||
| 				return menu; | ||||
| 			}, | ||||
| 			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; | ||||
| 			 | ||||
| 		return this.each(function() { | ||||
| 			var s = this.serial = sf.o.length; | ||||
| 			var o = $.extend({},sf.defaults,op); | ||||
| 			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ | ||||
| 				$(this).addClass([o.hoverClass,c.bcClass].join(' ')) | ||||
| 					.filter('li:has(ul)').removeClass(o.pathClass); | ||||
| 			}); | ||||
| 			sf.o[s] = sf.op = o; | ||||
| 			 | ||||
| 			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { | ||||
| 				if (o.autoArrows) addArrow( $('>a:first-child',this) ); | ||||
| 			}) | ||||
| 			.not('.'+c.bcClass) | ||||
| 				.hideSuperfishUl(); | ||||
| 			 | ||||
| 			var $a = $('a',this); | ||||
| 			$a.each(function(i){ | ||||
| 				var $li = $a.eq(i).parents('li'); | ||||
| 				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); | ||||
| 			}); | ||||
| 			o.onInit.call(this); | ||||
| 			 | ||||
| 		}).each(function() { | ||||
| 			var menuClasses = [c.menuClass]; | ||||
| 			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); | ||||
| 			$(this).addClass(menuClasses.join(' ')); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	var sf = $.fn.superfish; | ||||
| 	sf.o = []; | ||||
| 	sf.op = {}; | ||||
| 	sf.IE7fix = function(){ | ||||
| 		var o = sf.op; | ||||
| 		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined) | ||||
| 			this.toggleClass(sf.c.shadowClass+'-off'); | ||||
| 		}; | ||||
| 	sf.c = { | ||||
| 		bcClass     : 'sf-breadcrumb', | ||||
| 		menuClass   : 'sf-js-enabled', | ||||
| 		anchorClass : 'sf-with-ul', | ||||
| 		arrowClass  : 'sf-sub-indicator', | ||||
| 		shadowClass : 'sf-shadow' | ||||
| 	}; | ||||
| 	sf.defaults = { | ||||
| 		hoverClass	: 'sfHover', | ||||
| 		pathClass	: 'overideThisToUse', | ||||
| 		pathLevels	: 1, | ||||
| 		delay		: 800, | ||||
| 		animation	: {opacity:'show'}, | ||||
| 		speed		: 'normal', | ||||
| 		autoArrows	: true, | ||||
| 		dropShadows : true, | ||||
| 		disableHI	: false,		// true disables hoverIntent detection | ||||
| 		onInit		: function(){}, // callback functions | ||||
| 		onBeforeShow: function(){}, | ||||
| 		onShow		: function(){}, | ||||
| 		onHide		: function(){} | ||||
| 	}; | ||||
| 	$.fn.extend({ | ||||
| 		hideSuperfishUl : function(){ | ||||
| 			var o = sf.op, | ||||
| 				not = (o.retainPath===true) ? o.$path : ''; | ||||
| 			o.retainPath = false; | ||||
| 			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) | ||||
| 					.find('>ul').hide().css('visibility','hidden'); | ||||
| 			o.onHide.call($ul); | ||||
| 			return this; | ||||
| 		}, | ||||
| 		showSuperfishUl : function(){ | ||||
| 			var o = sf.op, | ||||
| 				sh = sf.c.shadowClass+'-off', | ||||
| 				$ul = this.addClass(o.hoverClass) | ||||
| 					.find('>ul:hidden').css('visibility','visible'); | ||||
| 			sf.IE7fix.call($ul); | ||||
| 			o.onBeforeShow.call($ul); | ||||
| 			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); | ||||
| 			return this; | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| })(jQuery); | ||||
							
								
								
									
										15
									
								
								xCAT-UI/js/jquery/superfish.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								xCAT-UI/js/jquery/superfish.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| /* | ||||
|  Superfish v1.4.8 - jQuery menu widget | ||||
|  Copyright (c) 2008 Joel Birch | ||||
|  | ||||
|  Dual licensed under the MIT and GPL licenses: | ||||
|  http://www.opensource.org/licenses/mit-license.php | ||||
|  http://www.gnu.org/licenses/gpl.html | ||||
|  | ||||
|  CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt | ||||
| */ | ||||
| (function(a){a.fn.superfish=function(c){var b=a.fn.superfish,h=b.c,n=a(['<span class="',h.arrowClass,'"> »</span>'].join("")),i=function(){var d=a(this),e=j(d);clearTimeout(e.sfTimer);d.showSuperfishUl().siblings().hideSuperfishUl()},k=function(){var d=a(this),e=j(d),g=b.op;clearTimeout(e.sfTimer);e.sfTimer=setTimeout(function(){g.retainPath=a.inArray(d[0],g.$path)>-1;d.hideSuperfishUl();g.$path.length&&d.parents(["li.",g.hoverClass].join("")).length<1&&i.call(g.$path)},g.delay)},j=function(d){d= | ||||
| d.parents(["ul.",h.menuClass,":first"].join(""))[0];b.op=b.o[d.serial];return d};return this.each(function(){var d=this.serial=b.o.length,e=a.extend({},b.defaults,c);e.$path=a("li."+e.pathClass,this).slice(0,e.pathLevels).each(function(){a(this).addClass([e.hoverClass,h.bcClass].join(" ")).filter("li:has(ul)").removeClass(e.pathClass)});b.o[d]=b.op=e;a("li:has(ul)",this)[a.fn.hoverIntent&&!e.disableHI?"hoverIntent":"hover"](i,k).each(function(){e.autoArrows&&a(">a:first-child",this).addClass(h.anchorClass).append(n.clone())}).not("."+ | ||||
| h.bcClass).hideSuperfishUl();var g=a("a",this);g.each(function(l){var m=g.eq(l).parents("li");g.eq(l).focus(function(){i.call(m)}).blur(function(){k.call(m)})});e.onInit.call(this)}).each(function(){var d=[h.menuClass];b.op.dropShadows&&!(a.browser.msie&&a.browser.version<7)&&d.push(h.shadowClass);a(this).addClass(d.join(" "))})};var f=a.fn.superfish;f.o=[];f.op={};f.IE7fix=function(){var c=f.op;a.browser.msie&&a.browser.version>6&&c.dropShadows&&c.animation.opacity!=undefined&&this.toggleClass(f.c.shadowClass+ | ||||
| "-off")};f.c={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",arrowClass:"sf-sub-indicator",shadowClass:"sf-shadow"};f.defaults={hoverClass:"sfHover",pathClass:"overideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},speed:"normal",autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};a.fn.extend({hideSuperfishUl:function(){var c=f.op,b=c.retainPath===true?c.$path:"";c.retainPath= | ||||
| false;b=a(["li.",c.hoverClass].join(""),this).add(this).not(b).removeClass(c.hoverClass).find(">ul").hide().css("visibility","hidden");c.onHide.call(b);return this},showSuperfishUl:function(){var c=f.op,b=this.addClass(c.hoverClass).find(">ul:hidden").css("visibility","visible");f.IE7fix.call(b);c.onBeforeShow.call(b);b.animate(c.animation,c.speed,function(){f.IE7fix.call(b);c.onShow.call(b)});return this}})})(jQuery); | ||||
							
								
								
									
										28
									
								
								xCAT-UI/js/jquery/tooltip.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								xCAT-UI/js/jquery/tooltip.min.js
									
									
									
									
										vendored
									
									
								
							| @@ -1,18 +1,10 @@ | ||||
| /* | ||||
|   | ||||
|  jQuery Tools 1.2.5 Tooltip - UI essentials | ||||
|  | ||||
|  NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. | ||||
|  | ||||
|  http://flowplayer.org/tools/tooltip/ | ||||
|  | ||||
|  Since: November 2008 | ||||
|  Date:    Wed Sep 22 06:02:10 2010 +0000  | ||||
| */ | ||||
| (function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,d=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];d+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))h-=f(window).scrollTop();var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")d-=a/2;if(i=="left")d-=a;return{top:h,left:d}}function u(a,b){var c=this,h=a.add(c),d,i=0,j= | ||||
| 0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(e){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(e)},b.predelay);else c.show(e)}).bind(k[1],function(e){clearTimeout(j);if(b.delay)i= | ||||
| setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow"; | ||||
| h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c; | ||||
| e=e||f.Event();e.type="onBeforeHide";h.trigger(e);if(!e.isDefaultPrevented()){l=false;o[b.effect][1].call(c,function(){e.type="onHide";h.trigger(e)});return c}},isShown:function(e){return e?l=="full":l},getConf:function(){return b},getTip:function(){return d},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(n){n&&f(c).bind(g,n);return c}})}f.tools=f.tools||{version:"1.2.5"};f.tools.tooltip= | ||||
| {conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){o[a]=[b,c]}};var o={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide(); | ||||
| a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery); | ||||
| /* | ||||
|  * jQuery Tools 1.2.5 Tooltip - UI essentials | ||||
|  */ | ||||
| (function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,d=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];d+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))h-=f(window).scrollTop();var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")d-=a/2;if(i=="left")d-=a;return{top:h,left:d}}function u(a,b){var c=this,h=a.add(c),d,i=0,j= | ||||
| 0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(e){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(e)},b.predelay);else c.show(e)}).bind(k[1],function(e){clearTimeout(j);if(b.delay)i= | ||||
| setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow"; | ||||
| h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c; | ||||
| e=e||f.Event();e.type="onBeforeHide";h.trigger(e);if(!e.isDefaultPrevented()){l=false;o[b.effect][1].call(c,function(){e.type="onHide";h.trigger(e)});return c}},isShown:function(e){return e?l=="full":l},getConf:function(){return b},getTip:function(){return d},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(n){n&&f(c).bind(g,n);return c}})}f.tools=f.tools||{version:"1.2.5"};f.tools.tooltip= | ||||
| {conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){o[a]=[b,c]}};var o={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide(); | ||||
| a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery); | ||||
|   | ||||
| @@ -414,16 +414,16 @@ function createMenu(items) { | ||||
| function initPage() { | ||||
| 	// JQuery plugins | ||||
| 	includeJs("js/jquery/jquery.dataTables.min.js"); | ||||
| 	includeJs("js/jquery/jquery.form.js"); | ||||
| 	includeJs("js/jquery/jquery.jeditable.js"); | ||||
| 	includeJs("js/jquery/jquery.contextmenu.js"); | ||||
| 	includeJs("js/jquery/jquery.cookie.js"); | ||||
| 	includeJs("js/jquery/superfish.js"); | ||||
| 	includeJs("js/jquery/hoverIntent.js"); | ||||
| 	includeJs("js/jquery/jquery.jstree.js"); | ||||
| 	includeJs("js/jquery/jquery.flot.js"); | ||||
| 	includeJs("js/jquery/jquery.form.min.js"); | ||||
| 	includeJs("js/jquery/jquery.jeditable.min.js"); | ||||
| 	includeJs("js/jquery/jquery.contextmenu.min.js"); | ||||
| 	includeJs("js/jquery/jquery.cookie.min.js"); | ||||
| 	includeJs("js/jquery/superfish.min.js"); | ||||
| 	includeJs("js/jquery/hoverIntent.min.js"); | ||||
| 	includeJs("js/jquery/jquery.jstree.min.js"); | ||||
| 	includeJs("js/jquery/jquery.flot.min.js"); | ||||
| 	includeJs("js/jquery/tooltip.min.js"); | ||||
| 	includeJs("js/jquery/jquery.serverBrowser.js"); | ||||
| 	includeJs("js/jquery/jquery.serverBrowser.min.js"); | ||||
|  | ||||
| 	// Page plugins | ||||
| 	includeJs("js/configure/configure.js");	 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user