TQuery

我的仿jq库

Versione datata 10/12/2021. Vedi la nuova versione l'ultima versione.

Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.greasyfork.org/scripts/11045/996871/TQuery.js

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Autore
axetroy
Versione
0.0.1.20150907023508
Creato il
18/07/2015
Aggiornato il
10/12/2021
Dimensione
58 KB
Licenza
Non disponibile

TQuery

这是一个模拟jquery的轻量js库,(当然这里包含了很多的注释代码) 实现了jquery的大部分常用方法,包括选择符,事件绑定、处理,DOM操作,ajax等等 个人使用.....

用法我就不多说了,跟jquery差不多,而且目前也就我一个人用。

兼容哪些浏览器

支持IE8+,chrome,firefox,opera等。IE8下,不定期删除某些兼容IE8下的部分。

如何添加插件?

1,源码中提供了一个extend方法,用于添加插件

格式是这样$().extend(fnName,fn); 参数:方法名,执行的方法 比如

$().extend('alert',function(){
  //do something
  alert( this );
    return this;  //返回TQuery对象,以便链式操作    $('p').css('width','500').alert().scoll()........
});

调用:

$().alert();  >>>>>>    TQuery{'elements':[],'vision':1.0,'length':0};

已经实现的方法(包括我jquery没有的)

选择器:

  • $(selectors)
  • .eq()
  • .first()
  • .last()
  • .not()
  • .filter()
  • .find()
  • .add()
  • .slice()
  • .end()
  • .has()
  • .visible()
  • .unvisible()

遍历操作:

  • .each()
  • .findParent()
  • .parent()
  • .parents()
  • .children()
  • .prev()
  • .prevAll()
  • .next()
  • .nextAll()
  • .siblings()

事件操作:

  • .ready()
  • .load()
  • .click()
  • .keydown()
  • .keyup()
  • .keypress()
  • .mousedown()
  • .mouseup()
  • .mouseenter()
  • .mouseleave()
  • .mousemove()
  • .mouseover()
  • .mouseout()
  • .hover()
  • .on()
  • .toggleClick()
  • .scroll()
  • .mouseScroll()
  • .mouseScrollUp()
  • .mouseScrollDown()
  • .bind()
  • .unbind()
  • .one()
  • .trigger()
  • .live()
  • .die()
  • .mutation()

获取尺寸及设置:

  • .width()
  • .height()
  • .innerWIdth()
  • .innerHeight()
  • .top()
  • .left()
  • .viewWidth()
  • .viewHeight()
  • .style()
  • .scrollTop()
  • .scrollHeight()
  • .scrollLeft()
  • .scrollWidth()
  • .size()
  • .offset()

属性attr的设置:

  • .prop()
  • .toggleProp()
  • .attr()
  • .toggleAttr()
  • .removeAttr()
  • .hasClass()
  • .addClass()
  • .removeClass()
  • .toggleClass()
  • .data()
  • .removeData()

CSS的操作设置:

  • .css()
  • .addStyle()
  • .removeStyle()

JS动画特效:

  • .animate()
  • .stop()
  • .show()
  • .hide()
  • .fadeToggle()
  • .fadeIn()
  • .fadeOut()
  • .fadeTo()
  • .scale()
  • .toggle()
  • .slideToggle()
  • .slideRight()
  • .slideLeft()
  • .slideDown()
  • .slideUp()
  • .scrollTo()
  • .scrollToggle()

DOM节点的操作:

  • .clone()
  • .append()
  • .appendChild()
  • .prepend()
  • .prependChild()
  • .after()
  • .before()
  • .remove()
  • .empty()
  • .html()
  • .text()
  • .val()

其他方法:

  • .proxy()
  • .delay()
  • .do()

转换:

  • .get()
  • .toArray()
  • .index()

工具集合:

  • $.type()
  • $.isNumber()
  • $.isString()
  • $.isFunction()
  • $.isArray()
  • $.isObject()
  • $.isDOM()
  • $.isWindow()
  • $.isUndefined()
  • $.ajax()
  • $.unique()
  • $.noop()
  • $.trim()
  • $.now()
  • $.reload()
  • $.toArray()
  • $.upper()
  • $.shuffleArray()
  • $.sizeof()
  • $.browser()
  • $.browser.webkit()
  • $.browser.msie()
  • $.browser.moz()
  • $.browser.opera()
  • $.merge()
  • $.map()
  • $.parseJSON()