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

📄 jquery.js

📁 一个PHP源代码,一个简单的论坛 一个 PHP源代码,一个简单的论坛
💻 JS
📖 第 1 页 / 共 3 页
字号:
	var o = new fx(a,b,"opacity");
	o.cur = function(){return parseFloat(o.el.style.opacity);};
	o.a = function() {
		var e = o.el.style;
		if (o.now == 1) o.now = 0.9999;
		if (window.ActiveXObject)
			e.filter = "alpha(opacity=" + o.now*100 + ")";
		e.opacity = o.now;
	};
	o.io = o.now = 1;
	o.a();
	return o;
};
fx.Resize = function(e,o){
	var z = this;
	var h = new fx.Height(e,o);
	if(o) o.onComplete = null;
	var w = new fx.Width(e,o);
	function c(a,b,c){return (!a||a==c||b==c);}
	for(var i in fx.fn){(function(){
		var j = fx.fn[i];
		z[j] = function(a,b){
			if(c(a,b,"height")) h[j]();
			if(c(a,b,"width")) w[j]();
		};
	})()}
	z.modify = function(c,d){
		h.modify(c);
		w.modify(d);
	};
};
fx.FadeSize = function(e,o){
	var z = this;
	var r = new fx.Resize(e,o);
	if(o) o.onComplete = null;
	var p = new fx.Opacity(e,o);
	for(var i in fx.fn){(function(){
		var j = fx.fn[i];
		z[j] = function(a,b){p[j]();r[j](a,b);};
	})()}
};

$.speed = function(s,o) {
  if ( o && o.constructor == Function ) o = { onComplete: o };
  o = o || {};
  var ss = {"crawl":1200,"xslow":850,"slow":600,"medium":400,"fast":200,"xfast":75,"normal":400};
  o.duration = typeof s == "number" ? s : ss[s] || 400;
  return o;
};

$.fn.hide = function(a,o) {
  o = $.speed(a,o);
  return a ? this.each(function(){
    new fx.FadeSize(this,o).hide();
  }) : this._hide();
};

$.fn.show = function(a,o) {
  o = $.speed(a,o);
  return a ? this.each(function(){
    new fx.FadeSize(this,o).show();
  }) : this._show();
};

$.fn.slideDown = function(a,o) {
  o = $.speed(a,o);
  return this.each(function(){
    new fx.Resize(this,o).show("height");
  });
};

$.fn.slideUp = function(a,o) {
  o = $.speed(a,o);
  return this.each(function(){
    new fx.Resize(this,o).hide("height");
  });
};

$.fn.fadeOut = function(a,o) {
  o = $.speed(a,o);
  return a ? this.each(function(){
    new fx.Opacity(this,o).hide();
  }) : this._hide();
};

$.fn.fadeIn = function(a,o) {
  o = $.speed(a,o);
  return a ? this.each(function(){
    new fx.Opacity(this,o).show();
  }) : this._show();
};

$.fn.center = function(f) {
  return this.each(function(){
		if ( !f && this.nodeName == 'IMG' &&
				 !this.offsetWidth && !this.offsetHeight ) {
			var self = this;
			setTimeout(function(){
				$(self).center(true);
			}, 13);
		} else {
			var s = this.style;
			var p = this.parentNode;
			if ( $.css(p,"position") == 'static' )
				p.style.position = 'relative';
			s.position = 'absolute';
			s.left = parseInt(($.css(p,"width") - $.css(this,"width"))/2) + "px";
			s.top = parseInt(($.css(p,"height") - $.css(this,"height"))/2) + "px";
		}
  });
};

$.setAuto = function(e,p) {
  var a = e.style[p];
  var o = $.css(e,p);
  e.style[p] = 'auto';
  var n = $.css(e,p);
  if ( o != n )
    e.style[p] = a;
};
/* mini.fx
 * By John Resig (http://ejohn.org)
 * Based upon moo.fx (http://moofx.mad4milk.net)
 * MIT-style LICENSE
 */
function fx(el,op,ty,tz){
	var z = this;
	z.a = function(){z.el.style[ty]=z.now+z.o.unit};
	z.max = function(){return z.el["io"+ty]||z.el["natural"+tz]||z.el["scroll"+tz]||z.cur()};
	z.cur = function(){return parseInt($.getCSS(z.el,ty))};
  z.show = function(){z.ss("block");z.custom(0,z.max())};
	z.hide = function(){z.el.$o=$.getCSS(z.el,"overflow");z.el["io"+ty]=this.cur();z.custom(z.cur(),0)};
	z.ss = function(a){if(y.display!=a)y.display=a};
	z.toggle = function(){if(z.cur()>0)z.hide();else z.show()};
	z.modify = function(a){z.custom(z.cur(),z.cur()+a)};
	z.clear = function(){clearInterval(z.timer);z.timer=null};
	z.el = el.constructor==String?document.getElementById(el):el;
	var y = z.el.style;
	y.overflow = "hidden";
	z.o = { duration: 400, unit: "px" };
	z.step = function(f,tt){
		var t = (new Date).getTime();
		var p = (t - z.s) / z.o.duration;
		if (t >= z.o.duration+z.s) {
			z.now = tt;
			z.clear();
			setTimeout(function(){
				y.overflow = z.el.$o || '';
				if(y.height=="0px"||y.width=="0px")z.ss("none");
				if(z.o.onComplete){z.el.$_ = z.o.onComplete;z.el.$_();}
			},100);
		} else
			z.now = ((-Math.cos(p*Math.PI)/2) + 0.5) * (tt-f) + f;
		z.a();
	};
	z.custom = function(f,t){
		if(z.timer)return;this.now=f;z.a();z.io=z.cur();z.s=(new Date).getTime();
		z.timer=setInterval(function(){z.step(f,t);}, 13);
	};
	if(op)for(var i in op)z.o[i]=op[i];
}
fx.fn = ["show","hide","toggle"];
fx.ty = ["Height","Width","Left","Top"];
for(var i in fx.ty){(function(){
	var c = fx.ty[i];
	fx[c] = function(a,b){
		return new fx(a,b,c.toLowerCase(),c);};
})()}
fx.Opacity = function(a,b){
	var o = new fx(a,b,"opacity");
	o.cur = function(){return parseFloat(o.el.style.opacity);};
	o.a = function() {
		var e = o.el.style;
		if (o.now == 1) o.now = 0.9999;
		if (window.ActiveXObject)
			e.filter = "alpha(opacity=" + o.now*100 + ")";
    e.opacity = o.now;
	};
	o.io = o.now = 1;
	o.a();
	return o;
};
fx.Text = function(a,b){
	b = b || {};
	if(!b.unit) b.unit = "em";
	return new fx(a,b,"fontSize");
};
fx.Resize = function(e,o){
	var z = this;
	var h = new fx.Height(e,o);
	if(o) o.onComplete = null;
	var w = new fx.Width(e,o);
	function c(a,b,c){return (!a||a==c||b==c);}
	for(var i in fx.fn){(function(){
		var j = fx.fn[i];
		z[j] = function(a,b){
			if(c(a,b,"height")) h[j]();
			if(c(a,b,"width")) w[j]();
		};
	})()}
	z.modify = function(c,d){
		h.modify(c);
		w.modify(d);
	};
};
fx.FadeSize = function(e,o){
	var z = this;
	var p = new fx.Opacity(e,o);
	if(o) o.onComplete = null;
	var r = new fx.Resize(e,o);
	for(var i in fx.fn){(function(){
		var j = fx.fn[i];
		z[j] = function(a,b){p[j]();r[j](a,b);};
	})()}
};
fx.MultiFadeSize = function(e,o){
	var z = this, el=[];
	for(var i=0;i<e.length;i++)
		el[i]=new fx.FadeSize(e[i],o);
	for(var i in fx.fn){(function(){
		var j = fx.fn[i];
		z[j] = function(){for(var i in el)el[i][j]();};
	})()}
};

var e = ["blur","focus","contextmenu","load","resize","scroll","unload",
	"click","dblclick","mousedown","mouseup","mouseenter","mouseleave",
	"mousemove","mouseover","mouseout","change","reset","select","submit",
	"keydown","keypress","keyup","abort","error","ready"];
for ( var i = 0; i < e.length; i++ ) {
	(function(){
		var o = e[i];
		$.fn[o] = function(f){ return this.bind(o, f); };
		$.fn["un"+o] = function(f){ return this.unbind(o, f); };
		$.fn["do"+o] = function(){ return this.trigger(o); };
		$.fn["one"+o] = function(f){ return this.bind(o, function(e){
			if ( this[o+f] != null ) return true;
			this[o+f]++;
			return $.apply(this,f,[e]);
		}); };
		
		// Deprecated
		//$.fn["on"+o] = function(f){ return this.bind(o, f); };
	})();
}

$.fn.hover = function(f,g) {
	// Check if mouse(over|out) are still within the same parent element
	return this.each(function(){
		var obj = this;
		addEvent(this, "mouseover", function(e) {
			var p = ( e.fromElement != null ? e.fromElement : e.relatedTarget );
			while ( p && p != obj ) p = p.parentNode;
			if ( p == obj ) return false;
			return $.apply(obj,f,[e]);
		});
		addEvent(this, "mouseout", function(e) {
			var p = ( e.toElement != null ? e.toElement : e.relatedTarget );
			while ( p && p != obj ) p = p.parentNode;
			if ( p == obj ) return false;
			return $.apply(obj,g,[e]);
		});
	});
};

// Deprecated
$.fn.onhover = $.fn.hover;

$.ready = function() {
  if ( $.$$timer ) {
	  clearInterval( $.$$timer );
	  $.$$timer = null;
	  for ( var i = 0; i < $.$$ready.length; i++ )
		  $.apply( document, $.$$ready[i] );
	  $.$$ready = null;
  }
};

if ( document.addEventListener )
	document.addEventListener( "DOMContentLoaded", $.ready, null );

addEvent( window, "load", $.ready );

$.fn.ready = function(f) {
	return this.each(function(){
		if ( $.$$timer ) {
			$.$$ready.push( f );
		} else {
      var o = this;
			$.$$ready = [ f ];
			$.$$timer = setInterval( function(){
				if ( o && o.getElementsByTagName && o.getElementById && o.body )
					$.ready();
			}, 10 );
		}
	});
};

// Deprecated
$.fn.onready = $.fn.ready;

$.fn.toggle = function(a,b) {
	return a && b ? this.click(function(e){
		this.$$last = this.$$last == a ? b : a;
		e.preventDefault();
		return $.apply( this, this.$$last, [e] ) || false;
	}) : this._toggle();
};

// AJAX Plugin
// Docs Here:
// http://jquery.com/docs/ajax/

if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'function') {
  var XMLHttpRequest = function() {
    return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') >= 0) ? 
      "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP");
  };
}

$.xml = function( type, url, data, ret ) {
  var xml = new XMLHttpRequest();

  if ( xml ) {
    xml.open(type || "GET", url, true);

    if ( data )
      xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    if ( ret )
      xml.onreadystatechange = function() {
        if ( xml.readyState == 4 ) ret(xml);
      };

    xml.send(data)
  }
};

$.httpData = function(r,type) {
  return r.getResponseHeader("content-type").indexOf("xml") > 0 || type == "xml" ?
    r.responseXML : r.responseText;
};

$.get = function( url, ret, type ) {
  $.xml( "GET", url, null, function(r) {
    if ( ret ) ret( $.httpData(r,type) );
  });
};

$.getXML = function( url, ret ) {
  $.get( url, ret, "xml" );
};

$.post = function( url, data, ret, type ) {
  $.xml( "POST", url, $.param(data), function(r) {
    if ( ret ) ret( $.httpData(r,type) );
  });
};

$.postXML = function( url, data, ret ) {
  $.post( url, data, ret, "xml" );
};

$.param = function(a) {
  var s = [];
  for ( var i in a )
    s[s.length] = i + "=" + encodeURIComponent( a[i] );
  return s.join("&");
};

$.fn.load = function(a,o,f) {
  // Arrrrghhhhhhhh!!
  // I overwrote the event plugin's .load
  // this won't happen again, I hope -John
  if ( a && a.constructor == Function )
    return this.bind("load", a);

  var t = "GET";
  if ( o && o.constructor == Function ) {
    f = o; o = null;
  }
  if (o != null) {
    o = $.param(o);
    t = "POST";
  }
  var self = this;
  $.xml(t,a,o,function(h){
  var h = h.responseText;
    self.html(h).find("script").each(function(){
      try {
        eval( this.text || this.textContent || this.innerHTML );
      } catch(e){}
    });
    if(f)f(h);
  });
  return this;
};


⌨️ 快捷键说明

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