IMage3D

/*!
 * Image3D
 * Copyright (c) 2010 cloudgamer
 * Blog: http://cloudgamer.cnblogs.com/
 * Date: 2010-9-18
 */

//容器对象
var Image3D = function(container, options){
	this._initialize( container, options );
	this._initMode();
	if ( this._support ) {
		this._initContainer();
	} else {//模式不支持
		this.onError("not support");
	}
};
Image3D.prototype = {
  //初始化程序
  _initialize: function(container, options) {
	var container = this._container = $(container);
	this._clientWidth = container.clientWidth;//显示区域宽度
	this._clientHeight = container.clientHeight;//显示区域高度
	this._support = false;//是否支持指定模式
	this._layers = {};//层集合
	this._invalid = [];//无效层集合
	this._show = $.emptyFunction;
	
	var opt = this._setOptions(options);
	
	this.fixedFar = opt.fixedFar;
	
	this._x = opt.x;
	this._y = opt.y;
	this._z = opt.z;
	this._r = opt.r;
	this._getScale = opt.getScale;
	
	this.onError = opt.onError;
	
	$CE.fireEvent( this, "init" );
  },
  //设置默认属性
  _setOptions: function(options) {
    this.options = {//默认值
		mode:		"css3|zoom|base",//模式
		x:			0,//水平偏移值
		y:			0,//垂直偏移值
		z:			0,//深度偏移值
		r:			0,//旋转角度(css3支持)
		fixedFar:	false,//是否远点固定
		getScale:	function(z){ return 1 - z / 1000; },//获取比例方法
		onError:	function(err){}//出错时执行
    };
    return $.extend(this.options, options || {});
  },
  //模式设置
  _initMode: function() {
	var modes = Image3D.modes;
	this._support = $A.some( this.options.mode.toLowerCase().split("|"), function(mode){
		mode = modes[ mode ];
		if ( mode && mode.support ) {
			this._show = mode.show; return true;
		}
	}, this );
  },
  //初始化容器对象
  _initContainer: function() {
	var container = this._container, style = container.style, position = $D.getStyle( container, "position" );
	this._style = { "position": style.position, "overflow": style.overflow };//备份样式
	if ( position != "relative" && position != "absolute" ) { style.position = "relative"; }
	style.overflow = "hidden";
	$CE.fireEvent( this, "initContainer" );
  },
  //显示
  show: function() {
	if ( !this._support ){ this.onError("not support"); return; }
	$A.forEach( this._layers, function(layer, z){ this._showLayer( z * 1 ); }, this );
  },
  //根据深度显示层
  _showLayer: function(z) {
	var layer = this._layers[ z ], scale = this._getScale( z + this._z );
	if ( scale <= 1 && scale > 0 ) {
		var moveScale = this.fixedFar ? scale : (1 - scale);
		this._show( layer, scale, this._x * moveScale, this._y * moveScale );
		layer.style.visibility  = "visible";
	} else {
		layer.style.visibility  = "hidden";
	}
  },
  //添加图片
  add: function(src, options) {
	if ( !this._support ){ this.onError("not support"); return; }
	var img = new Image(), opt = options || {}, oThis = this;
	//加载函数
	function load(){ this.onload = null; oThis._load( this, opt); };
	function error(){ oThis.onError("err image"); };
	//加载图片
	img.onload = load; img.onerror = error; img.src = src;
	//返回图片操作对象
	return {
		img: img,
		src: src,
		options: opt,
		show: function(){//重新显示
			oThis._remove(img); img.onload = load; img.src = this.src;
		},
		remove: function(){ oThis._remove(img); }//移除
	}
  },
  //加载图片
  _load: function(img, options) {
	//设置属性
	var opt = $.extend({//默认值
		x:		0,//水平位移
		y:		0,//垂直位移
		z:		0,//深度
		width:	0,//宽度
		height:	0,//高度
		scaleW:	1,//宽度缩放比例
		scaleH:	1//高度缩放比例
	}, options || {} );
	//图片定位
	var clientWidth = this._clientWidth, clientHeight = this._clientHeight,
		width = opt.width || img.width * opt.scaleW,
		height = opt.height || img.height * opt.scaleH;
		z = img._z = opt.z;
	//设置样式
	img.style.cssText = "position:absolute;border:0;padding:0;margin:0;-ms-interpolation-mode:nearest-neighbor;"
		+ "z-index:" + (99999 - z) + ";width:" + width + "px;height:" + height + "px;"
		+ "left:" + (((clientWidth - width) / 2 + opt.x) / clientWidth * 100).toFixed(5) + "%;"
		+ "top:" + ((clientHeight - height - opt.y) / clientHeight * 100).toFixed(5) + "%;";
	//插入层并显示
	this._insertLayer( img, z );
	this._showLayer( z );
  },
  //插入层
  _insertLayer: function(img, z) {
	var layer = this._layers[ z ];
	if ( !layer ) {//创建层
		layer = this._invalid.pop();
		if ( !layer ) {
			layer = document.createElement("div");
			layer.style.cssText = "position:absolute;border:0;padding:0;margin:0;left:0;top:0;visibility:hidden;background:transparent;width:" + this._clientWidth + "px;height:" + this._clientHeight + "px";
		}
		//修正zIndex
		if ( $B.ie6 || $B.ie7 ) { layer.style.zIndex = 99999 - z; }
		layer._count = 0;//记录层包含图片数
		layer._z = z;
		this._layers[ z ] = this._container.appendChild(layer);
	}
	layer._count++;
	layer.appendChild(img);
  },
  //移除
  _remove: function(img) {
	var z = img._z, layer = this._layers[ z ];
	if ( layer && img.parentNode == layer ) {//确定正确元素
		layer.removeChild(img);
		if ( !--layer._count ) {//层里面没有图片
			delete this._layers[ z ];
			this._invalid.push(this._container.removeChild(layer));//可重复使用
		}
	}
  },
  //重置
  reset: function() {
	var opt = this.options;
	this._x = opt.x; this._y = opt.y; this._z = opt.z; this._r = opt.r;
	this.show();
  },
  //销毁程序
  dispose: function() {
	$CE.fireEvent( this, "dispose" );
	//清除dom
	var container = this._container;
	$D.setStyle( container, this._style );//恢复样式
	//清除层元素
	$A.forEach( this._layers, function(layer){
		layer.innerHTML = ""; container.removeChild(layer);
	});
	//清除属性
	this._container = this._invalid = this._layers = this._style = this._support = null;
  }
};


//变换模式
Image3D.modes = function(){
	var unit = $B.firefox ? "px" : "", css3Transform;//ccs3变换样式
	return {
		css3: {//css3设置
			support: function(){
				var style = document.createElement("div").style;
				return $A.some(
					[ "transform", "MozTransform", "webkitTransform", "OTransform" ],
					function(css){ if ( css in style ) {
						css3Transform = css; return true;
					}});
			}(),
			show: function(layer, scale, x, y) {
				var Cos = Math.cos(this._r), Sin = Math.sin(this._r);
				layer.style.zIndex = 99999 - layer._z;
				//设置变换
				layer.style[ css3Transform ] = "matrix("
					+ ( Cos * scale).toFixed(5) + "," + (Sin * scale).toFixed(5) + ","
					+ (-Sin * scale).toFixed(5) + "," + (Cos * scale).toFixed(5) + ", "
					+ Math.round(x) + unit + ", " + Math.round(y) + unit + ")";
			}
		},
		zoom: {//zoom设置
			support: function(){ return "zoom" in document.createElement("div").style; }(),
			show: function(layer, scale, x, y){
				var style = layer.style, MAX = Number.MAX_VALUE, opScale = 1 - scale,
					left = this._clientWidth * opScale / 2 + x,
					top = this._clientHeight * opScale / 2 + y;
				//定位修正
				if ( !$B.ie6 && !$B.ie7 ) {  left /= scale; top /= scale; }
				//值修正
				left = Math.min(MAX, Math.max( -MAX, left )) | 0;
				top = Math.min(MAX, Math.max( -MAX, top )) | 0;
				//样式设置
				style.zoom = scale; style.left = left + "px"; style.top = top + "px";
			}
		},
		base: {//base设置
			support: true,
			show: function(layer, scale, x, y){
				var opScale = 1 - scale,
					left = this._clientWidth * opScale / 2 + x,
					top = this._clientHeight * opScale / 2 + y;
				//设置
				$A.forEach( layer.getElementsByTagName("img"), function(img){
					//获取记录的数据
					var original = img._original = img._original || {
						width: img.offsetWidth,	height: img.offsetHeight,
						left: img.offsetLeft, 	top: img.offsetTop
					};
					//样式设置
					$D.setStyle( img, {
						width: (original.width * scale | 0) + "px",
						height: (original.height * scale | 0) + "px",
						left: (original.left * scale + left | 0) + "px",
						top: (original.top * scale + top | 0) + "px"
					});
				});
			}
		}
	};
}();


//拖动视觉变换
Image3D.prototype._initialize = (function(){
	var init = Image3D.prototype._initialize,
		MAX = Number.MAX_VALUE,
		methods = {
			"init": function(){
				var opt = this.options;
				this._mtMinX = opt.mrMinX;
				this._mtMaxX = opt.mrMaxX;
				this._mtMinY = opt.mrMinY;
				this._mtMaxY = opt.mrMaxY;
				this._mtSTART = $F.bind( start, this );
				this._mtMOVE = $F.bind( move, this );
				this._mtSTOP = $F.bind( stop, this );
			},
			"initContainer": function(){
				$E.addEvent( this._container, "mousedown", this._mtSTART );
			},
			"dispose": function(){
				$E.removeEvent( this._container, "mousedown", this._mtSTART );
				this._mtSTOP();
				this._mtSTART = this._mtMOVE = this._mtSTOP = null;
			}
		};
	//开始函数
	function start(e){
		this._mtX = this._x + e.clientX;
		this._mtY = this._y + e.clientY;
		$E.addEvent( document, "mousemove", this._mtMOVE );
		$E.addEvent( document, "mouseup", this._mtSTOP );
		if ( $B.ie ) {
			var container = this._container;
			$E.addEvent( container, "losecapture", this._mtSTOP );
			container.setCapture();
		} else {
			$E.addEvent( window, "blur", this._mtSTOP );
			e.preventDefault();
		}
	};
	//拖动函数
	function move(e){
		this._x = Math.min(this._mtMaxX, Math.max( this._mtMinX, this._mtX - e.clientX ));
		this._y = Math.min(this._mtMaxY, Math.max( this._mtMinY, this._mtY - e.clientY ));
		this.show();
		window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
	};
	//停止函数
	function stop(){
		$E.removeEvent( document, "mousemove", this._mtMOVE );
		$E.removeEvent( document, "mouseup", this._mtSTOP );
		if ( $B.ie ) {
			var container = this._container;
			$E.removeEvent( container, "losecapture", this._mtSTOP );
			container.releaseCapture();
		} else {
			$E.removeEvent( window, "blur", this._mtSTOP );
		};
	};
	return function(){
		var options = arguments[1];
		if ( !options || options.mouseTranslate !== false ) {
			//扩展options
			$.extend( options, {
				mrMinX:	-Number.MAX_VALUE,//x最小值
				mrMaxX:	Number.MAX_VALUE,//x最大值
				mrMinY:	-Number.MAX_VALUE,//y最小值
				mrMaxY:	Number.MAX_VALUE//y最大值
			}, false );
			//扩展钩子
			$A.forEach( methods, function( method, name ){
				$CE.addEvent( this, name, method );
			}, this );
		}
		init.apply( this, arguments );
	}
})();

//滚轮深度变换
Image3D.prototype._initialize = (function(){
	var init = Image3D.prototype._initialize,
		mousewheel = $B.firefox ? "DOMMouseScroll" : "mousewheel",
		methods = {
			"init": function(){
				this._mzMin = this.options.mzMin;
				this._mzMax = this.options.mzMax;
				this._mzZoom = $F.bind( zoom, this );
			},
			"initContainer": function(){
				$E.addEvent( this._container, mousewheel, this._mzZoom );
			},
			"dispose": function(){
				$E.removeEvent( this._container, mousewheel, this._mzZoom );
				this._mzZoom = null;
			}
		};
	//缩放函数
	function zoom(e){
		this._z = Math.min(this._mzMax, Math.max( this._mzMin,
			(e.wheelDelta ? -e.wheelDelta : e.detail * 40) + this._z ));
		this.show();
		e.preventDefault();
	};
	return function(){
		var options = arguments[1];
		if ( !options || options.mouseZoom !== false ) {
			//扩展options
			$.extend( options, {
				mzMin:	-Number.MAX_VALUE,//z最小值
				mzMax:	Number.MAX_VALUE//z最大值
			}, false );
			//扩展钩子
			$A.forEach( methods, function( method, name ){
				$CE.addEvent( this, name, method );
			}, this );
		}
		init.apply( this, arguments );
	}
})();
/*!
 * Image3D
 * Copyright (c) 2010 cloudgamer
 * Blog: http://cloudgamer.cnblogs.com/
 * Date: 2010-9-18
 */

//容器对象
var Image3D = function(container, options){
	this._initialize( container, options );
	this._initMode();
	if ( this._support ) {
		this._initContainer();
	} else {//模式不支持
		this.onError("not support");
	}
};
Image3D.prototype = {
  //初始化程序
  _initialize: function(container, options) {
	var container = this._container = $(container);
	this._clientWidth = container.clientWidth;//显示区域宽度
	this._clientHeight = container.clientHeight;//显示区域高度
	this._support = false;//是否支持指定模式
	this._layers = {};//层集合
	this._invalid = [];//无效层集合
	this._show = $.emptyFunction;
	
	var opt = this._setOptions(options);
	
	this.fixedFar = opt.fixedFar;
	
	this._x = opt.x;
	this._y = opt.y;
	this._z = opt.z;
	this._r = opt.r;
	this._getScale = opt.getScale;
	
	this.onError = opt.onError;
	
	$CE.fireEvent( this, "init" );
  },
  //设置默认属性
  _setOptions: function(options) {
    this.options = {//默认值
		mode:		"css3|zoom|base",//模式
		x:			0,//水平偏移值
		y:			0,//垂直偏移值
		z:			0,//深度偏移值
		r:			0,//旋转角度(css3支持)
		fixedFar:	false,//是否远点固定
		getScale:	function(z){ return 1 - z / 1000; },//获取比例方法
		onError:	function(err){}//出错时执行
    };
    return $.extend(this.options, options || {});
  },
  //模式设置
  _initMode: function() {
	var modes = Image3D.modes;
	this._support = $A.some( this.options.mode.toLowerCase().split("|"), function(mode){
		mode = modes[ mode ];
		if ( mode && mode.support ) {
			this._show = mode.show; return true;
		}
	}, this );
  },
  //初始化容器对象
  _initContainer: function() {
	var container = this._container, style = container.style, position = $D.getStyle( container, "position" );
	this._style = { "position": style.position, "overflow": style.overflow };//备份样式
	if ( position != "relative" && position != "absolute" ) { style.position = "relative"; }
	style.overflow = "hidden";
	$CE.fireEvent( this, "initContainer" );
  },
  //显示
  show: function() {
	if ( !this._support ){ this.onError("not support"); return; }
	$A.forEach( this._layers, function(layer, z){ this._showLayer( z * 1 ); }, this );
  },
  //根据深度显示层
  _showLayer: function(z) {
	var layer = this._layers[ z ], scale = this._getScale( z + this._z );
	if ( scale <= 1 && scale > 0 ) {
		var moveScale = this.fixedFar ? scale : (1 - scale);
		this._show( layer, scale, this._x * moveScale, this._y * moveScale );
		layer.style.visibility  = "visible";
	} else {
		layer.style.visibility  = "hidden";
	}
  },
  //添加图片
  add: function(src, options) {
	if ( !this._support ){ this.onError("not support"); return; }
	var img = new Image(), opt = options || {}, oThis = this;
	//加载函数
	function load(){ this.onload = null; oThis._load( this, opt); };
	function error(){ oThis.onError("err image"); };
	//加载图片
	img.onload = load; img.onerror = error; img.src = src;
	//返回图片操作对象
	return {
		img: img,
		src: src,
		options: opt,
		show: function(){//重新显示
			oThis._remove(img); img.onload = load; img.src = this.src;
		},
		remove: function(){ oThis._remove(img); }//移除
	}
  },
  //加载图片
  _load: function(img, options) {
	//设置属性
	var opt = $.extend({//默认值
		x:		0,//水平位移
		y:		0,//垂直位移
		z:		0,//深度
		width:	0,//宽度
		height:	0,//高度
		scaleW:	1,//宽度缩放比例
		scaleH:	1//高度缩放比例
	}, options || {} );
	//图片定位
	var clientWidth = this._clientWidth, clientHeight = this._clientHeight,
		width = opt.width || img.width * opt.scaleW,
		height = opt.height || img.height * opt.scaleH;
		z = img._z = opt.z;
	//设置样式
	img.style.cssText = "position:absolute;border:0;padding:0;margin:0;-ms-interpolation-mode:nearest-neighbor;"
		+ "z-index:" + (99999 - z) + ";width:" + width + "px;height:" + height + "px;"
		+ "left:" + (((clientWidth - width) / 2 + opt.x) / clientWidth * 100).toFixed(5) + "%;"
		+ "top:" + ((clientHeight - height - opt.y) / clientHeight * 100).toFixed(5) + "%;";
	//插入层并显示
	this._insertLayer( img, z );
	this._showLayer( z );
  },
  //插入层
  _insertLayer: function(img, z) {
	var layer = this._layers[ z ];
	if ( !layer ) {//创建层
		layer = this._invalid.pop();
		if ( !layer ) {
			layer = document.createElement("div");
			layer.style.cssText = "position:absolute;border:0;padding:0;margin:0;left:0;top:0;visibility:hidden;background:transparent;width:" + this._clientWidth + "px;height:" + this._clientHeight + "px";
		}
		//修正zIndex
		if ( $B.ie6 || $B.ie7 ) { layer.style.zIndex = 99999 - z; }
		layer._count = 0;//记录层包含图片数
		layer._z = z;
		this._layers[ z ] = this._container.appendChild(layer);
	}
	layer._count++;
	layer.appendChild(img);
  },
  //移除
  _remove: function(img) {
	var z = img._z, layer = this._layers[ z ];
	if ( layer && img.parentNode == layer ) {//确定正确元素
		layer.removeChild(img);
		if ( !--layer._count ) {//层里面没有图片
			delete this._layers[ z ];
			this._invalid.push(this._container.removeChild(layer));//可重复使用
		}
	}
  },
  //重置
  reset: function() {
	var opt = this.options;
	this._x = opt.x; this._y = opt.y; this._z = opt.z; this._r = opt.r;
	this.show();
  },
  //销毁程序
  dispose: function() {
	$CE.fireEvent( this, "dispose" );
	//清除dom
	var container = this._container;
	$D.setStyle( container, this._style );//恢复样式
	//清除层元素
	$A.forEach( this._layers, function(layer){
		layer.innerHTML = ""; container.removeChild(layer);
	});
	//清除属性
	this._container = this._invalid = this._layers = this._style = this._support = null;
  }
};


//变换模式
Image3D.modes = function(){
	var unit = $B.firefox ? "px" : "", css3Transform;//ccs3变换样式
	return {
		css3: {//css3设置
			support: function(){
				var style = document.createElement("div").style;
				return $A.some(
					[ "transform", "MozTransform", "webkitTransform", "OTransform" ],
					function(css){ if ( css in style ) {
						css3Transform = css; return true;
					}});
			}(),
			show: function(layer, scale, x, y) {
				var Cos = Math.cos(this._r), Sin = Math.sin(this._r);
				layer.style.zIndex = 99999 - layer._z;
				//设置变换
				layer.style[ css3Transform ] = "matrix("
					+ ( Cos * scale).toFixed(5) + "," + (Sin * scale).toFixed(5) + ","
					+ (-Sin * scale).toFixed(5) + "," + (Cos * scale).toFixed(5) + ", "
					+ Math.round(x) + unit + ", " + Math.round(y) + unit + ")";
			}
		},
		zoom: {//zoom设置
			support: function(){ return "zoom" in document.createElement("div").style; }(),
			show: function(layer, scale, x, y){
				var style = layer.style, MAX = Number.MAX_VALUE, opScale = 1 - scale,
					left = this._clientWidth * opScale / 2 + x,
					top = this._clientHeight * opScale / 2 + y;
				//定位修正
				if ( !$B.ie6 && !$B.ie7 ) {  left /= scale; top /= scale; }
				//值修正
				left = Math.min(MAX, Math.max( -MAX, left )) | 0;
				top = Math.min(MAX, Math.max( -MAX, top )) | 0;
				//样式设置
				style.zoom = scale; style.left = left + "px"; style.top = top + "px";
			}
		},
		base: {//base设置
			support: true,
			show: function(layer, scale, x, y){
				var opScale = 1 - scale,
					left = this._clientWidth * opScale / 2 + x,
					top = this._clientHeight * opScale / 2 + y;
				//设置
				$A.forEach( layer.getElementsByTagName("img"), function(img){
					//获取记录的数据
					var original = img._original = img._original || {
						width: img.offsetWidth,	height: img.offsetHeight,
						left: img.offsetLeft, 	top: img.offsetTop
					};
					//样式设置
					$D.setStyle( img, {
						width: (original.width * scale | 0) + "px",
						height: (original.height * scale | 0) + "px",
						left: (original.left * scale + left | 0) + "px",
						top: (original.top * scale + top | 0) + "px"
					});
				});
			}
		}
	};
}();


//拖动视觉变换
Image3D.prototype._initialize = (function(){
	var init = Image3D.prototype._initialize,
		MAX = Number.MAX_VALUE,
		methods = {
			"init": function(){
				var opt = this.options;
				this._mtMinX = opt.mrMinX;
				this._mtMaxX = opt.mrMaxX;
				this._mtMinY = opt.mrMinY;
				this._mtMaxY = opt.mrMaxY;
				this._mtSTART = $F.bind( start, this );
				this._mtMOVE = $F.bind( move, this );
				this._mtSTOP = $F.bind( stop, this );
			},
			"initContainer": function(){
				$E.addEvent( this._container, "mousedown", this._mtSTART );
			},
			"dispose": function(){
				$E.removeEvent( this._container, "mousedown", this._mtSTART );
				this._mtSTOP();
				this._mtSTART = this._mtMOVE = this._mtSTOP = null;
			}
		};
	//开始函数
	function start(e){
		this._mtX = this._x + e.clientX;
		this._mtY = this._y + e.clientY;
		$E.addEvent( document, "mousemove", this._mtMOVE );
		$E.addEvent( document, "mouseup", this._mtSTOP );
		if ( $B.ie ) {
			var container = this._container;
			$E.addEvent( container, "losecapture", this._mtSTOP );
			container.setCapture();
		} else {
			$E.addEvent( window, "blur", this._mtSTOP );
			e.preventDefault();
		}
	};
	//拖动函数
	function move(e){
		this._x = Math.min(this._mtMaxX, Math.max( this._mtMinX, this._mtX - e.clientX ));
		this._y = Math.min(this._mtMaxY, Math.max( this._mtMinY, this._mtY - e.clientY ));
		this.show();
		window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
	};
	//停止函数
	function stop(){
		$E.removeEvent( document, "mousemove", this._mtMOVE );
		$E.removeEvent( document, "mouseup", this._mtSTOP );
		if ( $B.ie ) {
			var container = this._container;
			$E.removeEvent( container, "losecapture", this._mtSTOP );
			container.releaseCapture();
		} else {
			$E.removeEvent( window, "blur", this._mtSTOP );
		};
	};
	return function(){
		var options = arguments[1];
		if ( !options || options.mouseTranslate !== false ) {
			//扩展options
			$.extend( options, {
				mrMinX:	-Number.MAX_VALUE,//x最小值
				mrMaxX:	Number.MAX_VALUE,//x最大值
				mrMinY:	-Number.MAX_VALUE,//y最小值
				mrMaxY:	Number.MAX_VALUE//y最大值
			}, false );
			//扩展钩子
			$A.forEach( methods, function( method, name ){
				$CE.addEvent( this, name, method );
			}, this );
		}
		init.apply( this, arguments );
	}
})();

//滚轮深度变换
Image3D.prototype._initialize = (function(){
	var init = Image3D.prototype._initialize,
		mousewheel = $B.firefox ? "DOMMouseScroll" : "mousewheel",
		methods = {
			"init": function(){
				this._mzMin = this.options.mzMin;
				this._mzMax = this.options.mzMax;
				this._mzZoom = $F.bind( zoom, this );
			},
			"initContainer": function(){
				$E.addEvent( this._container, mousewheel, this._mzZoom );
			},
			"dispose": function(){
				$E.removeEvent( this._container, mousewheel, this._mzZoom );
				this._mzZoom = null;
			}
		};
	//缩放函数
	function zoom(e){
		this._z = Math.min(this._mzMax, Math.max( this._mzMin,
			(e.wheelDelta ? -e.wheelDelta : e.detail * 40) + this._z ));
		this.show();
		e.preventDefault();
	};
	return function(){
		var options = arguments[1];
		if ( !options || options.mouseZoom !== false ) {
			//扩展options
			$.extend( options, {
				mzMin:	-Number.MAX_VALUE,//z最小值
				mzMax:	Number.MAX_VALUE//z最大值
			}, false );
			//扩展钩子
			$A.forEach( methods, function( method, name ){
				$CE.addEvent( this, name, method );
			}, this );
		}
		init.apply( this, arguments );
	}
})();

eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([3-59cf-hj-mo-rt-yCG-NP-RT-Z]|[12]\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 $,$B,$A,$F,$D,$E,$CE,$S;(3(){4 O,B,A,F,D,E,CE,S;O=3(id){5"22"==1F id?P.getElementById(id):id};O.emptyFunction=3(){};O.extend=3(N,13,1r){9(1r===23)1r=14;I(4 Q x 13){9(1r||!(Q x N)){N[Q]=13[Q]}}5 N};O.deepextend=3(N,13){I(4 Q x 13){4 1h=13[Q];9(N===1h)continue;9(1F 1h==="c"){N[Q]=L.callee(N[Q]||{},1h)}J{N[Q]=1h}}5 N};O.wrapper=3(me,25){4 1G=3(){me.R(Z,L)};4 1H=3(){};1H.15=25.15;1G.15=new 1H;5 1G};B=(3(T){4 b={17:/17/.M(T)&&!/1I/.M(T),1I:/1I/.M(T),26:/webkit/.M(T)&&!/1J/.M(T),27:/27/.M(T),1J:/1J/.M(T)};4 1s="";I(4 i x b){9(b[i]){1s="26"==i?"1i":i;1K}}b.1i=1s&&1L("(?:"+1s+")[\\\\/: ]([\\\\d.]+)").M(T)?1L.$1:"0";b.ie=b.17;b.28=b.17&&1N(b.1i,10)==6;b.ie7=b.17&&1N(b.1i,10)==7;b.29=b.17&&1N(b.1i,10)==8;5 b})(1O.navigator.userAgent.toLowerCase());A=3(){4 m={isArray:3(2a){5 Object.15.toString.18(2a)==="[c 1P]"},1t:3(K,W,j){9(K.1t){5 1u(j)?K.1t(W):K.1t(W,j)}J{4 U=K.1j;j=1u(j)?0:j<0?1v.2b(j)+U:1v.2c(j);I(;j<U;j++){9(K[j]===W)5 j}5-1}},1w:3(K,W,j){9(K.1w){5 1u(j)?K.1w(W):K.1w(W,j)}J{4 U=K.1j;j=1u(j)||j>=U-1?U-1:j<0?1v.2b(j)+U:1v.2c(j);I(;j>-1;j--){9(K[j]===W)5 j}5-1}}};3 11(c,t){9(23===c.1j){I(4 l x c){9(y===t(c[l],l,c))1K}}J{I(4 i=0,U=c.1j;i<U;i++){9(i x c){9(y===t(c[i],i,c))1K}}}};11({2d:3(c,t,r){11(c,3(){t.R(r,L)})},map:3(c,t,r){4 m=[];11(c,3(){m.2e(t.R(r,L))});5 m},1x:3(c,t,r){4 m=[];11(c,3(2f){t.R(r,L)&&m.2e(2f)});5 m},every:3(c,t,r){4 m=14;11(c,3(){9(!t.R(r,L)){m=y;5 y}});5 m},some:3(c,t,r){4 m=y;11(c,3(){9(t.R(r,L)){m=14;5 y}});5 m}},3(2g,l){m[l]=3(c,t,r){9(c[l]){5 c[l](t,r)}J{5 2g(c,t,r)}}});5 m}();F=(3(){4 19=1P.15.19;5{bind:3(1y,r){4 1a=19.18(L,2);5 3(){5 1y.R(r,1a.2h(19.18(L)))}},bindAsEventListener:3(1y,r){4 1a=19.18(L,2);5 3(h){5 1y.R(r,[E.1k(h)].2h(1a))}}}})();D={1z:3(p){4 1b=p?p.2i:P;5 1b.2j.2k||1b.2l.2k},1A:3(p){4 1b=p?p.2i:P;5 1b.2j.2m||1b.2l.2m},2n:P.1l?3(a,b){5!!(a.2o(b)&16)}:3(a,b){5 a!=b&&a.2n(b)},G:3(p){4 q=0,V=0,X=0,Y=0;9(!p.2p||B.29){4 n=p;while(n){q+=n.offsetLeft,V+=n.offsetTop;n=n.offsetParent};X=q+p.offsetWidth;Y=V+p.offsetHeight}J{4 G=p.2p();q=X=D.1A(p);V=Y=D.1z(p);q+=G.q;X+=G.X;V+=G.V;Y+=G.Y};5{"q":q,"V":V,"X":X,"Y":Y}},clientRect:3(p){4 G=D.G(p),1Q=D.1A(p),1R=D.1z(p);G.q-=1Q;G.X-=1Q;G.V-=1R;G.Y-=1R;5 G},1c:P.1l?3(u){5 P.1l.2q(u,1m)}:3(u){5 u.1S},getStyle:P.1l?3(u,l){4 o=P.1l.2q(u,1m);5 l x o?o[l]:o.getPropertyValue(l)}:3(u,l){4 o=u.o,1c=u.1S;9(l=="12"){9(/1T\\(12=(.*)\\)/i.M(1c.1x)){4 12=parseFloat(1L.$1);5 12?12/2r:0}5 1}J 9(l=="2s"){l="2t"}4 m=1c[l]||1c[S.1U(l)];9(!/^-?\\d+(?:px)?$/i.M(m)&&/^\\-?\\d/.M(m)){4 q=o.q,1B=u.runtimeStyle,2v=1B.q;1B.q=1c.q;o.q=m||0;m=o.pixelLeft+"px";o.q=q;1B.q=2v}5 m},setStyle:3(1n,o,1d){9(!1n.1j){1n=[1n]}9(1F o=="22"){4 s=o;o={};o[s]=1d}A.2d(1n,3(u){I(4 l x o){4 1d=o[l];9(l=="12"&&B.ie){u.o.1x=(u.1S.1x||"").2w(/1T\\([^)]*\\)/,"")+"1T(12="+1d*2r+")"}J 9(l=="2s"){u.o[B.ie?"2t":"cssFloat"]=1d}J{u.o[S.1U(l)]=1d}}})}};E=(3(){4 1e,1f,v=1,1V=3(g,f,k){9(!k.$v)k.$v=v++;9(!g.C)g.C={};4 H=g.C[f];9(!H){H=g.C[f]={};9(g["on"+f]){H[0]=g["on"+f]}}};9(1O.1X){4 1o={"mouseenter":"2x","mouseleave":"2y"};1e=3(g,f,k){9(f x 1o){1V(g,f,k);4 2z=g.C[f][k.$v]=3(h){4 1C=h.1p;9(!1C||(g!=1C&&!(g.2o(1C)&16))){k.18(Z,h)}};g.1X(1o[f],2z,y)}J{g.1X(f,k,y)}};1f=3(g,f,k){9(f x 1o){9(g.C&&g.C[f]){g.2A(1o[f],g.C[f][k.$v],y);1Y g.C[f][k.$v]}}J{g.2A(f,k,y)}}}J{1e=3(g,f,k){1V(g,f,k);g.C[f][k.$v]=k;g["on"+f]=1D};1f=3(g,f,k){9(g.C&&g.C[f]){1Y g.C[f][k.$v]}};3 1D(){4 1E=14,h=1k();4 H=Z.C[h.f];I(4 i x H){Z.$1D=H[i];9(Z.$1D(h)===y){1E=y}}5 1E}}3 1k(h){9(h)5 h;h=1O.h;h.pageX=h.clientX+D.1A(h.1Z);h.pageY=h.clientY+D.1z(h.1Z);h.target=h.1Z;h.20=20;h.21=21;4 1p={"2y":h.toElement,"2x":h.fromElement}[h.f];9(1p){h.1p=1p}5 h};3 20(){Z.cancelBubble=14};3 21(){Z.1E=y};5{"1e":1e,"1f":1f,"1k":1k}})();CE=(3(){4 v=1;5{1e:3(c,f,k){9(!k.$$v)k.$$v=v++;9(!c.w)c.w={};9(!c.w[f])c.w[f]={};c.w[f][k.$$v]=k},1f:3(c,f,k){9(c.w&&c.w[f]){1Y c.w[f][k.$$v]}},fireEvent:3(c,f){9(!c.w)5;4 1a=1P.15.19.18(L,2),H=c.w[f];I(4 i x H){H[i].R(c,1a)}},clearEvent:3(c){9(!c.w)5;I(4 f x c.w){4 H=c.w[f];I(4 i x H){H[i]=1m}c.w[f]=1m}c.w=1m}}})();S={1U:3(s){5 s.2w(/-([a-z])/ig,3(all,2B){5 2B.toUpperCase()})}};9(B.28){try{P.execCommand("BackgroundImageCache",y,14)}catch(e){}};$=O;$B=B;$A=A;$F=F;$D=D;$E=E;$CE=CE;$S=S})();',[],162,'|||function|var|return||||if|||object|||type|element|event||from|handler|name|ret||style|node|left|thisp||callback|elem|guid|cusevents|in|false||||events||||rect|handlers|for|else|array|arguments|test|destination||document|property|apply||ua|len|top|elt|right|bottom|this||each|opacity|source|true|prototype||msie|call|slice|args|doc|curStyle|value|addEvent|removeEvent||copy|version|length|fixEvent|defaultView|null|elems|fix|relatedTarget||override|vMark|indexOf|isNaN|Math|lastIndexOf|filter|fun|getScrollTop|getScrollLeft|rtStyle|related|handleEvent|returnValue|typeof|ins|subclass|opera|chrome|break|RegExp||parseInt|window|Array|sLeft|sTop|currentStyle|alpha|camelize|storage||addEventListener|delete|srcElement|stopPropagation|preventDefault|string|undefined||parent|safari|firefox|ie6|ie8|obj|ceil|floor|forEach|push|item|method|concat|ownerDocument|documentElement|scrollTop|body|scrollLeft|contains|compareDocumentPosition|getBoundingClientRect|getComputedStyle|100|float|styleFloat||rsLeft|replace|mouseover|mouseout|fixhandler|removeEventListener|letter'.split('|'),0,{}))


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值