Changeset 10352
- Timestamp:
- 01/13/2009 11:50:01 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/jquery/jquery.js
r10326 r10352 1 1 /*! 2 * jQuery JavaScript Library v1.3 b22 * jQuery JavaScript Library v1.3rc2 3 3 * http://jquery.com/ 4 4 * … … 7 7 * http://docs.jquery.com/License 8 8 * 9 * Date: 2009-01- 05 18:33:56 -0500 (Mon, 05Jan 2009)10 * Revision: 6 0569 * Date: 2009-01-12 19:11:21 -0500 (Mon, 12 Jan 2009) 10 * Revision: 6100 11 11 */ 12 12 (function(){ … … 87 87 return jQuery( document ).ready( selector ); 88 88 89 // Make sure that old selector state is passed along 90 if ( selector.selector && selector.context ) { 91 this.selector = selector.selector; 92 this.context = selector.context; 93 } 94 89 95 return this.setArray(jQuery.makeArray(selector)); 90 96 }, … … 94 100 95 101 // The current version of jQuery being used 96 jquery: "1.3 b2",102 jquery: "1.3rc2", 97 103 98 104 // The number of elements contained in the matched element set … … 214 220 215 221 wrapAll: function( html ) { 216 if ( this[0] ) 222 if ( this[0] ) { 217 223 // The elements to wrap the target around 218 jQuery( html, this[0].ownerDocument ) 219 .clone() 220 .insertBefore( this[0] ) 221 .map(function(){ 222 var elem = this; 223 224 while ( elem.firstChild ) 225 elem = elem.firstChild; 226 227 return elem; 228 }) 229 .append(this); 224 var wrap = jQuery( html, this[0].ownerDocument ).clone(); 225 226 if ( this[0].parentNode ) 227 wrap.insertBefore( this[0] ); 228 229 wrap.map(function(){ 230 var elem = this; 231 232 while ( elem.firstChild ) 233 elem = elem.firstChild; 234 235 return elem; 236 }).append(this); 237 } 230 238 231 239 return this; … … 274 282 }, 275 283 284 // For internal use only. 285 // Behaves like an Array's .push method, not like a jQuery method. 286 push: [].push, 287 276 288 find: function( selector ) { 277 var elems = jQuery.map(this, function(elem){ 278 return jQuery.find( selector, elem ); 279 }); 280 281 return this.pushStack( /[^+>] [^+>]/.test( selector ) ? 282 jQuery.unique( elems ) : 283 elems, "find", selector ); 289 if ( this.length === 1 && !/,/.test(selector) ) { 290 var ret = this.pushStack( [], "find", selector ); 291 ret.length = 0; 292 jQuery.find( selector, this[0], ret ); 293 return ret; 294 } else { 295 var elems = jQuery.map(this, function(elem){ 296 return jQuery.find( selector, elem ); 297 }); 298 299 return this.pushStack( /[^+>] [^+>]/.test( selector ) ? 300 jQuery.unique( elems ) : 301 elems, "find", selector ); 302 } 284 303 }, 285 304 … … 341 360 342 361 closest: function( selector ) { 362 var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null; 363 343 364 return this.map(function(){ 344 365 var cur = this; 345 366 while ( cur && cur.ownerDocument ) { 346 if ( jQuery(cur).is(selector) )367 if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) 347 368 return cur; 348 369 cur = cur.parentNode; … … 920 941 if ( fragment ) { 921 942 for ( var i = 0; ret[i]; i++ ) { 922 if ( jQuery.nodeName( ret[i], "script" ) ) {923 scripts.push( ret[i].parentNode .removeChild( ret[i] ));943 if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { 944 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); 924 945 } else { 925 946 if ( ret[i].nodeType === 1 ) … … 956 977 // Safari mis-reports the default selected property of a hidden option 957 978 // Accessing the parent's selectedIndex property fixes it 958 if ( name == "selected" )979 if ( name == "selected" && elem.parentNode ) 959 980 elem.parentNode.selectedIndex; 960 981 … … 973 994 return elem.getAttributeNode( name ).nodeValue; 974 995 975 // elem.tab index doesn't always return the correct value996 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 976 997 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 977 if ( name == jQuery.props.tabindex ) { 978 var attributeNode = elem.getAttributeNode(jQuery.props.tabindex); 979 return attributeNode && attributeNode.specified && attributeNode.value || undefined; 998 if ( name == "tabIndex" ) { 999 var attributeNode = elem.getAttributeNode( "tabIndex" ); 1000 return attributeNode && attributeNode.specified 1001 ? attributeNode.value 1002 : elem.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i) 1003 ? 0 1004 : undefined; 980 1005 } 981 1006 … … 1138 1163 mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) 1139 1164 }; 1140 1141 // Check to see if the W3C box model is being used1142 jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";1143 1165 1144 1166 jQuery.each({ … … 1375 1397 }); 1376 1398 } 1377 });(function(){ 1399 });/*! 1400 * Sizzle CSS Selector Engine - v0.9.1 1401 * Copyright 2009, The Dojo Foundation 1402 * Released under the MIT, BSD, and GPL Licenses. 1403 * More information: http://sizzlejs.com/ 1404 */ 1405 (function(){ 1406 1407 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g, 1408 done = 0, 1409 toString = Object.prototype.toString; 1410 1411 var Sizzle = function(selector, context, results, seed) { 1412 results = results || []; 1413 context = context || document; 1414 1415 if ( context.nodeType !== 1 && context.nodeType !== 9 ) 1416 return []; 1417 1418 if ( !selector || typeof selector !== "string" ) { 1419 return results; 1420 } 1421 1422 var parts = [], m, set, checkSet, check, mode, extra, prune = true; 1423 1424 // Reset the position of the chunker regexp (start from head) 1425 chunker.lastIndex = 0; 1426 1427 while ( (m = chunker.exec(selector)) !== null ) { 1428 parts.push( m[1] ); 1429 1430 if ( m[2] ) { 1431 extra = RegExp.rightContext; 1432 break; 1433 } 1434 } 1435 1436 if ( parts.length > 1 && Expr.match.POS.exec( selector ) ) { 1437 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { 1438 var later = "", match; 1439 1440 // Position selectors must be done after the filter 1441 while ( (match = Expr.match.POS.exec( selector )) ) { 1442 later += match[0]; 1443 selector = selector.replace( Expr.match.POS, "" ); 1444 } 1445 1446 set = Sizzle.filter( later, Sizzle( selector, context ) ); 1447 } else { 1448 set = Expr.relative[ parts[0] ] ? 1449 [ context ] : 1450 Sizzle( parts.shift(), context ); 1451 1452 while ( parts.length ) { 1453 var tmpSet = []; 1454 1455 selector = parts.shift(); 1456 if ( Expr.relative[ selector ] ) 1457 selector += parts.shift(); 1458 1459 for ( var i = 0, l = set.length; i < l; i++ ) { 1460 Sizzle( selector, set[i], tmpSet ); 1461 } 1462 1463 set = tmpSet; 1464 } 1465 } 1466 } else { 1467 var ret = seed ? 1468 { expr: parts.pop(), set: makeArray(seed) } : 1469 Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context ); 1470 set = Sizzle.filter( ret.expr, ret.set ); 1471 1472 if ( parts.length > 0 ) { 1473 checkSet = makeArray(set); 1474 } else { 1475 prune = false; 1476 } 1477 1478 while ( parts.length ) { 1479 var cur = parts.pop(), pop = cur; 1480 1481 if ( !Expr.relative[ cur ] ) { 1482 cur = ""; 1483 } else { 1484 pop = parts.pop(); 1485 } 1486 1487 if ( pop == null ) { 1488 pop = context; 1489 } 1490 1491 Expr.relative[ cur ]( checkSet, pop, isXML(context) ); 1492 } 1493 } 1494 1495 if ( !checkSet ) { 1496 checkSet = set; 1497 } 1498 1499 if ( !checkSet ) { 1500 throw "Syntax error, unrecognized expression: " + (cur || selector); 1501 } 1502 1503 if ( toString.call(checkSet) === "[object Array]" ) { 1504 if ( !prune ) { 1505 results.push.apply( results, checkSet ); 1506 } else if ( context.nodeType === 1 ) { 1507 for ( var i = 0; checkSet[i] != null; i++ ) { 1508 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { 1509 results.push( set[i] ); 1510 } 1511 } 1512 } else { 1513 for ( var i = 0; checkSet[i] != null; i++ ) { 1514 if ( checkSet[i] && checkSet[i].nodeType === 1 ) { 1515 results.push( set[i] ); 1516 } 1517 } 1518 } 1519 } else { 1520 makeArray( checkSet, results ); 1521 } 1522 1523 if ( extra ) { 1524 Sizzle( extra, context, results, seed ); 1525 } 1526 1527 return results; 1528 }; 1529 1530 Sizzle.matches = function(expr, set){ 1531 return Sizzle(expr, null, null, set); 1532 }; 1533 1534 Sizzle.find = function(expr, context){ 1535 var set, match; 1536 1537 if ( !expr ) { 1538 return []; 1539 } 1540 1541 for ( var i = 0, l = Expr.order.length; i < l; i++ ) { 1542 var type = Expr.order[i], match; 1543 1544 if ( (match = Expr.match[ type ].exec( expr )) ) { 1545 var left = RegExp.leftContext; 1546 1547 if ( left.substr( left.length - 1 ) !== "\\" ) { 1548 match[1] = (match[1] || "").replace(/\\/g, ""); 1549 set = Expr.find[ type ]( match, context ); 1550 if ( set != null ) { 1551 expr = expr.replace( Expr.match[ type ], "" ); 1552 break; 1553 } 1554 } 1555 } 1556 } 1557 1558 if ( !set ) { 1559 set = context.getElementsByTagName("*"); 1560 } 1561 1562 return {set: set, expr: expr}; 1563 }; 1564 1565 Sizzle.filter = function(expr, set, inplace, not){ 1566 var old = expr, result = [], curLoop = set, match, anyFound; 1567 1568 while ( expr && set.length ) { 1569 for ( var type in Expr.filter ) { 1570 if ( (match = Expr.match[ type ].exec( expr )) != null ) { 1571 var filter = Expr.filter[ type ], goodArray = null, goodPos = 0, found, item; 1572 anyFound = false; 1573 1574 if ( curLoop == result ) { 1575 result = []; 1576 } 1577 1578 if ( Expr.preFilter[ type ] ) { 1579 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not ); 1580 1581 if ( !match ) { 1582 anyFound = found = true; 1583 } else if ( match === true ) { 1584 continue; 1585 } else if ( match[0] === true ) { 1586 goodArray = []; 1587 var last = null, elem; 1588 for ( var i = 0; (elem = curLoop[i]) !== undefined; i++ ) { 1589 if ( elem && last !== elem ) { 1590 goodArray.push( elem ); 1591 last = elem; 1592 } 1593 } 1594 } 1595 } 1596 1597 if ( match ) { 1598 for ( var i = 0; (item = curLoop[i]) !== undefined; i++ ) { 1599 if ( item ) { 1600 if ( goodArray && item != goodArray[goodPos] ) { 1601 goodPos++; 1602 } 1603 1604 found = filter( item, match, goodPos, goodArray ); 1605 var pass = not ^ !!found; 1606 1607 if ( inplace && found != null ) { 1608 if ( pass ) { 1609 anyFound = true; 1610 } else { 1611 curLoop[i] = false; 1612 } 1613 } else if ( pass ) { 1614 result.push( item ); 1615 anyFound = true; 1616 } 1617 } 1618 } 1619 } 1620 1621 if ( found !== undefined ) { 1622 if ( !inplace ) { 1623 curLoop = result; 1624 } 1625 1626 expr = expr.replace( Expr.match[ type ], "" ); 1627 1628 if ( !anyFound ) { 1629 return []; 1630 } 1631 1632 break; 1633 } 1634 } 1635 } 1636 1637 expr = expr.replace(/\s*,\s*/, ""); 1638 1639 // Improper expression 1640 if ( expr == old ) { 1641 if ( anyFound == null ) { 1642 throw "Syntax error, unrecognized expression: " + expr; 1643 } else { 1644 break; 1645 } 1646 } 1647 1648 old = expr; 1649 } 1650 1651 return curLoop; 1652 }; 1653 1654 var Expr = Sizzle.selectors = { 1655 order: [ "ID", "NAME", "TAG" ], 1656 match: { 1657 ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, 1658 CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, 1659 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, 1660 ATTR: /\[((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\]/, 1661 TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, 1662 CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, 1663 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, 1664 PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ 1665 }, 1666 attrMap: { 1667 "class": "className", 1668 "for": "htmlFor" 1669 }, 1670 relative: { 1671 "+": function(checkSet, part){ 1672 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 1673 var elem = checkSet[i]; 1674 if ( elem ) { 1675 var cur = elem.previousSibling; 1676 while ( cur && cur.nodeType !== 1 ) { 1677 cur = cur.previousSibling; 1678 } 1679 checkSet[i] = typeof part === "string" ? 1680 cur || false : 1681 cur === part; 1682 } 1683 } 1684 1685 if ( typeof part === "string" ) { 1686 Sizzle.filter( part, checkSet, true ); 1687 } 1688 }, 1689 ">": function(checkSet, part, isXML){ 1690 if ( typeof part === "string" && !/\W/.test(part) ) { 1691 part = isXML ? part : part.toUpperCase(); 1692 1693 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 1694 var elem = checkSet[i]; 1695 if ( elem ) { 1696 var parent = elem.parentNode; 1697 checkSet[i] = parent.nodeName === part ? parent : false; 1698 } 1699 } 1700 } else { 1701 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 1702 var elem = checkSet[i]; 1703 if ( elem ) { 1704 checkSet[i] = typeof part === "string" ? 1705 elem.parentNode : 1706 elem.parentNode === part; 1707 } 1708 } 1709 1710 if ( typeof part === "string" ) { 1711 Sizzle.filter( part, checkSet, true ); 1712 } 1713 } 1714 }, 1715 "": function(checkSet, part, isXML){ 1716 var doneName = "done" + (done++), checkFn = dirCheck; 1717 1718 if ( !part.match(/\W/) ) { 1719 var nodeCheck = part = isXML ? part : part.toUpperCase(); 1720 checkFn = dirNodeCheck; 1721 } 1722 1723 checkFn("parentNode", part, doneName, checkSet, nodeCheck); 1724 }, 1725 "~": function(checkSet, part, isXML){ 1726 var doneName = "done" + (done++), checkFn = dirCheck; 1727 1728 if ( typeof part === "string" && !part.match(/\W/) ) { 1729 var nodeCheck = part = isXML ? part : part.toUpperCase(); 1730 checkFn = dirNodeCheck; 1731 } 1732 1733 checkFn("previousSibling", part, doneName, checkSet, nodeCheck); 1734 } 1735 }, 1736 find: { 1737 ID: function(match, context){ 1738 if ( context.getElementById ) { 1739 var m = context.getElementById(match[1]); 1740 return m ? [m] : []; 1741 } 1742 }, 1743 NAME: function(match, context){ 1744 return context.getElementsByName ? context.getElementsByName(match[1]) : null; 1745 }, 1746 TAG: function(match, context){ 1747 return context.getElementsByTagName(match[1]); 1748 } 1749 }, 1750 preFilter: { 1751 CLASS: function(match, curLoop, inplace, result, not){ 1752 match = " " + match[1].replace(/\\/g, "") + " "; 1753 1754 for ( var i = 0; curLoop[i]; i++ ) { 1755 if ( not ^ (" " + curLoop[i].className + " ").indexOf(match) >= 0 ) { 1756 if ( !inplace ) 1757 result.push( curLoop[i] ); 1758 } else if ( inplace ) { 1759 curLoop[i] = false; 1760 } 1761 } 1762 1763 return false; 1764 }, 1765 ID: function(match){ 1766 return match[1].replace(/\\/g, ""); 1767 }, 1768 TAG: function(match, curLoop){ 1769 for ( var i = 0; !curLoop[i]; i++ ){} 1770 return isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); 1771 }, 1772 CHILD: function(match){ 1773 if ( match[1] == "nth" ) { 1774 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 1775 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( 1776 match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || 1777 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); 1778 1779 // calculate the numbers (first)n+(last) including if they are negative 1780 match[2] = (test[1] + (test[2] || 1)) - 0; 1781 match[3] = test[3] - 0; 1782 } 1783 1784 // TODO: Move to normal caching system 1785 match[0] = "done" + (done++); 1786 1787 return match; 1788 }, 1789 ATTR: function(match){ 1790 var name = match[1]; 1791 1792 if ( Expr.attrMap[name] ) { 1793 match[1] = Expr.attrMap[name]; 1794 } 1795 1796 if ( match[2] === "~=" ) { 1797 match[4] = " " + match[4] + " "; 1798 } 1799 1800 return match; 1801 }, 1802 PSEUDO: function(match, curLoop, inplace, result, not){ 1803 if ( match[1] === "not" ) { 1804 // If we're dealing with a complex expression, or a simple one 1805 if ( match[3].match(chunker).length > 1 ) { 1806 match[3] = Sizzle(match[3], null, null, curLoop); 1807 } else { 1808 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 1809 if ( !inplace ) { 1810 result.push.apply( result, ret ); 1811 } 1812 return false; 1813 } 1814 } else if ( Expr.match.POS.test( match[0] ) ) { 1815 return true; 1816 } 1817 1818 return match; 1819 }, 1820 POS: function(match){ 1821 match.unshift( true ); 1822 return match; 1823 } 1824 }, 1825 filters: { 1826 enabled: function(elem){ 1827 return elem.disabled === false && elem.type !== "hidden"; 1828 }, 1829 disabled: function(elem){ 1830 return elem.disabled === true; 1831 }, 1832 checked: function(elem){ 1833 return elem.checked === true; 1834 }, 1835 selected: function(elem){ 1836 // Accessing this property makes selected-by-default 1837 // options in Safari work properly 1838 elem.parentNode.selectedIndex; 1839 return elem.selected === true; 1840 }, 1841 parent: function(elem){ 1842 return !!elem.firstChild; 1843 }, 1844 empty: function(elem){ 1845 return !elem.firstChild; 1846 }, 1847 has: function(elem, i, match){ 1848 return !!Sizzle( match[3], elem ).length; 1849 }, 1850 header: function(elem){ 1851 return /h\d/i.test( elem.nodeName ); 1852 }, 1853 text: function(elem){ 1854 return "text" === elem.type; 1855 }, 1856 radio: function(elem){ 1857 return "radio" === elem.type; 1858 }, 1859 checkbox: function(elem){ 1860 return "checkbox" === elem.type; 1861 }, 1862 file: function(elem){ 1863 return "file" === elem.type; 1864 }, 1865 password: function(elem){ 1866 return "password" === elem.type; 1867 }, 1868 submit: function(elem){ 1869 return "submit" === elem.type; 1870 }, 1871 image: function(elem){ 1872 return "image" === elem.type; 1873 }, 1874 reset: function(elem){ 1875 return "reset" === elem.type; 1876 }, 1877 button: function(elem){ 1878 return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; 1879 }, 1880 input: function(elem){ 1881 return /input|select|textarea|button/i.test(elem.nodeName); 1882 } 1883 }, 1884 setFilters: { 1885 first: function(elem, i){ 1886 return i === 0; 1887 }, 1888 last: function(elem, i, match, array){ 1889 return i === array.length - 1; 1890 }, 1891 even: function(elem, i){ 1892 return i % 2 === 0; 1893 }, 1894 odd: function(elem, i){ 1895 return i % 2 === 1; 1896 }, 1897 lt: function(elem, i, match){ 1898 return i < match[3] - 0; 1899 }, 1900 gt: function(elem, i, match){ 1901 return i > match[3] - 0; 1902 }, 1903 nth: function(elem, i, match){ 1904 return match[3] - 0 == i; 1905 }, 1906 eq: function(elem, i, match){ 1907 return match[3] - 0 == i; 1908 } 1909 }, 1910 filter: { 1911 CHILD: function(elem, match){ 1912 var type = match[1], parent = elem.parentNode; 1913 1914 var doneName = "child" + parent.childNodes.length; 1915 1916 if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) { 1917 var count = 1; 1918 1919 for ( var node = parent.firstChild; node; node = node.nextSibling ) { 1920 if ( node.nodeType == 1 ) { 1921 node.nodeIndex = count++; 1922 } 1923 } 1924 1925 parent[ doneName ] = count - 1; 1926 } 1927 1928 if ( type == "first" ) { 1929 return elem.nodeIndex == 1; 1930 } else if ( type == "last" ) { 1931 return elem.nodeIndex == parent[ doneName ]; 1932 } else if ( type == "only" ) { 1933 return parent[ doneName ] == 1; 1934 } else if ( type == "nth" ) { 1935 var add = false, first = match[2], last = match[3]; 1936 1937 if ( first == 1 && last == 0 ) { 1938 return true; 1939 } 1940 1941 if ( first == 0 ) { 1942 if ( elem.nodeIndex == last ) { 1943 add = true; 1944 } 1945 } else if ( (elem.nodeIndex - last) % first == 0 && (elem.nodeIndex - last) / first >= 0 ) { 1946 add = true; 1947 } 1948 1949 return add; 1950 } 1951 }, 1952 PSEUDO: function(elem, match, i, array){ 1953 var name = match[1], filter = Expr.filters[ name ]; 1954 1955 if ( filter ) { 1956 return filter( elem, i, match, array ); 1957 } else if ( name === "contains" ) { 1958 return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; 1959 } else if ( name === "not" ) { 1960 var not = match[3]; 1961 1962 for ( var i = 0, l = not.length; i < l; i++ ) { 1963 if ( not[i] === elem ) { 1964 return false; 1965 } 1966 } 1967 1968 return true; 1969 } 1970 }, 1971 ID: function(elem, match){ 1972 return elem.nodeType === 1 && elem.getAttribute("id") === match; 1973 }, 1974 TAG: function(elem, match){ 1975 return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; 1976 }, 1977 CLASS: function(elem, match){ 1978 return match.test( elem.className ); 1979 }, 1980 ATTR: function(elem, match){ 1981 var result = elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4]; 1982 return result == null ? 1983 false : 1984 type === "=" ? 1985 value === check : 1986 type === "*=" ? 1987 value.indexOf(check) >= 0 : 1988 type === "~=" ? 1989 (" " + value + " ").indexOf(check) >= 0 : 1990 !match[4] ? 1991 result : 1992 type === "!=" ? 1993 value != check : 1994 type === "^=" ? 1995 value.indexOf(check) === 0 : 1996 type === "$=" ? 1997 value.substr(value.length - check.length) === check : 1998 type === "|=" ? 1999 value === check || value.substr(0, check.length + 1) === check + "-" : 2000 false; 2001 }, 2002 POS: function(elem, match, i, array){ 2003 var name = match[2], filter = Expr.setFilters[ name ]; 2004 2005 if ( filter ) { 2006 return filter( elem, i, match, array ); 2007 } 2008 } 2009 } 2010 }; 2011 2012 for ( var type in Expr.match ) { 2013 Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); 2014 } 2015 2016 var makeArray = function(array, results) { 2017 array = Array.prototype.slice.call( array ); 2018 2019 if ( results ) { 2020 results.push.apply( results, array ); 2021 return results; 2022 } 2023 2024 return array; 2025 }; 2026 2027 // Perform a simple check to determine if the browser is capable of 2028 // converting a NodeList to an array using builtin methods. 2029 try { 2030 Array.prototype.slice.call( document.documentElement.childNodes ); 2031 2032 // Provide a fallback method if it does not work 2033 } catch(e){ 2034 makeArray = function(array, results) { 2035 var ret = results || []; 2036 2037 if ( toString.call(array) === "[object Array]" ) { 2038 Array.prototype.push.apply( ret, array ); 2039 } else { 2040 if ( typeof array.length === "number" ) { 2041 for ( var i = 0, l = array.length; i < l; i++ ) { 2042 ret.push( array[i] ); 2043 } 2044 } else { 2045 for ( var i = 0; array[i]; i++ ) { 2046 ret.push( array[i] ); 2047 } 2048 } 2049 } 2050 2051 return ret; 2052 }; 2053 } 2054 2055 // Check to see if the browser returns elements by name when 2056 // querying by getElementById (and provide a workaround) 2057 (function(){ 2058 // We're going to inject a fake input element with a specified name 2059 var form = document.createElement("form"), 2060 id = "script" + (new Date).getTime(); 2061 form.innerHTML = "<input name='" + id + "'/>"; 2062 2063 // Inject it into the root element, check its status, and remove it quickly 2064 var root = document.documentElement; 2065 root.insertBefore( form, root.firstChild ); 2066 2067 // The workaround has to do additional checks after a getElementById 2068 // Which slows things down for other browsers (hence the branching) 2069 if ( !!document.getElementById( id ) ) { 2070 Expr.find.ID = function(match, context){ 2071 if ( context.getElementById ) { 2072 var m = context.getElementById(match[1]); 2073 return m ? m.id === match[1] || m.getAttributeNode && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; 2074 } 2075 }; 2076 2077 Expr.filter.ID = function(elem, match){ 2078 var node = elem.getAttributeNode && elem.getAttributeNode("id"); 2079 return elem.nodeType === 1 && node && node.nodeValue === match; 2080 }; 2081 } 2082 2083 root.removeChild( form ); 2084 })(); 2085 2086 // Check to see if the browser returns only elements 2087 // when doing getElementsByTagName("*") 2088 (function(){ 2089 // Create a fake element 2090 var div = document.createElement("div"); 2091 div.appendChild( document.createComment("") ); 2092 2093 // Make sure no comments are found 2094 if ( div.getElementsByTagName("*").length > 0 ) { 2095 Expr.find.TAG = function(match, context){ 2096 var results = context.getElementsByTagName(match[1]); 2097 2098 // Filter out possible comments 2099 if ( match[1] === "*" ) { 2100 var tmp = []; 2101 2102 for ( var i = 0; results[i]; i++ ) { 2103 if ( results[i].nodeType === 1 ) { 2104 tmp.push( results[i] ); 2105 } 2106 } 2107 2108 results = tmp; 2109 } 2110 2111 return results; 2112 }; 2113 } 2114 })(); 2115 2116 if ( document.querySelectorAll ) (function(){ 2117 var oldSizzle = Sizzle; 2118 2119 Sizzle = function(query, context, extra, seed){ 2120 context = context || document; 2121 2122 if ( !seed && context.nodeType === 9 ) { 2123 try { 2124 return makeArray( context.querySelectorAll(query), extra ); 2125 } catch(e){} 2126 } 2127 2128 return oldSizzle(query, context, extra, seed); 2129 }; 2130 2131 Sizzle.find = oldSizzle.find; 2132 Sizzle.filter = oldSizzle.filter; 2133 Sizzle.selectors = oldSizzle.selectors; 2134 Sizzle.matches = oldSizzle.matches; 2135 })(); 2136 2137 if ( document.documentElement.getElementsByClassName ) { 2138 Expr.order.splice(1, 0, "CLASS"); 2139 Expr.find.CLASS = function(match, context) { 2140 return context.getElementsByClassName(match[1]); 2141 }; 2142 } 2143 2144 function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck ) { 2145 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 2146 var elem = checkSet[i]; 2147 if ( elem ) { 2148 elem = elem[dir]; 2149 var match = false; 2150 2151 while ( elem && elem.nodeType ) { 2152 var done = elem[doneName]; 2153 if ( done ) { 2154 match = checkSet[ done ]; 2155 break; 2156 } 2157 2158 if ( elem.nodeType === 1 ) 2159 elem[doneName] = i; 2160 2161 if ( elem.nodeName === cur ) { 2162 match = elem; 2163 break; 2164 } 2165 2166 elem = elem[dir]; 2167 } 2168 2169 checkSet[i] = match; 2170 } 2171 } 2172 } 2173 2174 function dirCheck( dir, cur, doneName, checkSet, nodeCheck ) { 2175 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 2176 var elem = checkSet[i]; 2177 if ( elem ) { 2178 elem = elem[dir]; 2179 var match = false; 2180 2181 while ( elem && elem.nodeType ) { 2182 if ( elem[doneName] ) { 2183 match = checkSet[ elem[doneName] ]; 2184 break; 2185 } 2186 2187 if ( elem.nodeType === 1 ) { 2188 elem[doneName] = i; 2189 2190 if ( typeof cur !== "string" ) { 2191 if ( elem === cur ) { 2192 match = true; 2193 break; 2194 } 2195 2196 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { 2197 match = elem; 2198 break; 2199 } 2200 } 2201 2202 elem = elem[dir]; 2203 } 2204 2205 checkSet[i] = match; 2206 } 2207 } 2208 } 2209 2210 var contains = document.compareDocumentPosition ? function(a, b){ 2211 return a.compareDocumentPosition(b) & 16; 2212 } : function(a, b){ 2213 return a !== b && (a.contains ? a.contains(b) : true); 2214 }; 2215 2216 var isXML = function(elem){ 2217 return elem.documentElement && !elem.body || 2218 elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; 2219 }; 2220 2221 // EXPOSE 2222 jQuery.find = Sizzle; 2223 jQuery.filter = Sizzle.filter; 2224 jQuery.expr = Sizzle.selectors; 2225 jQuery.expr[":"] = jQuery.expr.filters; 2226 2227 Sizzle.selectors.filters.hidden = function(elem){ 2228 return "hidden" === elem.type || 2229 jQuery.css(elem, "display") === "none" || 2230 jQuery.css(elem, "visibility") === "hidden"; 2231 }; 2232 2233 Sizzle.selectors.filters.visible = function(elem){ 2234 return "hidden" !== elem.type && 2235 jQuery.css(elem, "display") !== "none" && 2236 jQuery.css(elem, "visibility") !== "hidden"; 2237 }; 2238 2239 Sizzle.selectors.filters.animated = function(elem){ 2240 return jQuery.grep(jQuery.timers, function(fn){ 2241 return elem === fn.elem; 2242 }).length; 2243 }; 2244 2245 jQuery.multiFilter = function( expr, elems, not ) { 2246 if ( not ) { 2247 expr = ":not(" + expr + ")"; 2248 } 2249 2250 return Sizzle.matches(expr, elems); 2251 }; 2252 2253 jQuery.dir = function( elem, dir ){ 2254 var matched = [], cur = elem[dir]; 2255 while ( cur && cur != document ) { 2256 if ( cur.nodeType == 1 ) 2257 matched.push( cur ); 2258 cur = cur[dir]; 2259 } 2260 return matched; 2261 }; 2262 2263 jQuery.nth = function(cur, result, dir, elem){ 2264 result = result || 1; 2265 var num = 0; 2266 2267 for ( ; cur; cur = cur[dir] ) 2268 if ( cur.nodeType == 1 && ++num == result ) 2269 break; 2270 2271 return cur; 2272 }; 2273 2274 jQuery.sibling = function(n, elem){ 2275 var r = []; 2276 2277 for ( ; n; n = n.nextSibling ) { 2278 if ( n.nodeType == 1 && n != elem ) 2279 r.push( n ); 2280 } 2281 2282 return r; 2283 }; 2284 2285 return; 2286 2287 window.Sizzle = Sizzle; 2288 2289 })(); 2290 /* 2291 * A number of helper functions used for managing events. 2292 * Many of the ideas behind this code originated from 2293 * Dean Edwards' addEvent library. 2294 */ 2295 jQuery.event = { 2296 2297 // Bind an event to an element 2298 // Original by Dean Edwards 2299 add: function(elem, types, handler, data) { 2300 if ( elem.nodeType == 3 || elem.nodeType == 8 ) 2301 return; 2302 2303 // For whatever reason, IE has trouble passing the window object 2304 // around, causing it to be cloned in the process 2305 if ( elem.setInterval && elem != window ) 2306 elem = window; 2307 2308 // Make sure that the function being executed has a unique ID 2309 if ( !handler.guid ) 2310 handler.guid = this.guid++; 2311 2312 // if data is passed, bind to handler 2313 if ( data !== undefined ) { 2314 // Create temporary function pointer to original handler 2315 var fn = handler; 2316 2317 // Create unique handler function, wrapped around original handler 2318 handler = this.proxy( fn ); 2319 2320 // Store data in unique handler 2321 handler.data = data; 2322 } 2323 2324 // Init the element's event structure 2325 var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), 2326 handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ 2327 // Handle the second event of a trigger and when 2328 // an event is called after a page has unloaded 2329 return typeof jQuery !== "undefined" && !jQuery.event.triggered ? 2330 jQuery.event.handle.apply(arguments.callee.elem, arguments) : 2331 undefined; 2332 }); 2333 // Add elem as a property of the handle function 2334 // This is to prevent a memory leak with non-native 2335 // event in IE. 2336 handle.elem = elem; 2337 2338 // Handle multiple events separated by a space 2339 // jQuery(...).bind("mouseover mouseout", fn); 2340 jQuery.each(types.split(/\s+/), function(index, type) { 2341 // Namespaced event handlers 2342 var namespaces = type.split("."); 2343 type = namespaces.shift(); 2344 handler.type = namespaces.slice().sort().join("."); 2345 2346 // Get the current list of functions bound to this event 2347 var handlers = events[type]; 2348 2349 if ( jQuery.event.specialAll[type] ) 2350 jQuery.event.specialAll[type].setup.call(elem, data, namespaces); 2351 2352 // Init the event handler queue 2353 if (!handlers) { 2354 handlers = events[type] = {}; 2355 2356 // Check for a special event handler 2357 // Only use addEventListener/attachEvent if the special 2358 // events handler returns false 2359 if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) { 2360 // Bind the global event handler to the element 2361 if (elem.addEventListener) 2362 elem.addEventListener(type, handle, false); 2363 else if (elem.attachEvent) 2364 elem.attachEvent("on" + type, handle); 2365 } 2366 } 2367 2368 // Add the function to the element's handler list 2369 handlers[handler.guid] = handler; 2370 2371 // Keep track of which events have been used, for global triggering 2372 jQuery.event.global[type] = true; 2373 }); 2374 2375 // Nullify elem to prevent memory leaks in IE 2376 elem = null; 2377 }, 2378 2379 guid: 1, 2380 global: {}, 2381 2382 // Detach an event or set of events from an element 2383 remove: function(elem, types, handler) { 2384 // don't do events on text and comment nodes 2385 if ( elem.nodeType == 3 || elem.nodeType == 8 ) 2386 return; 2387 2388 var events = jQuery.data(elem, "events"), ret, index; 2389 2390 if ( events ) { 2391 // Unbind all events for the element 2392 if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") ) 2393 for ( var type in events ) 2394 this.remove( elem, type + (types || "") ); 2395 else { 2396 // types is actually an event object here 2397 if ( types.type ) { 2398 handler = types.handler; 2399 types = types.type; 2400 } 2401 2402 // Handle multiple events seperated by a space 2403 // jQuery(...).unbind("mouseover mouseout", fn); 2404 jQuery.each(types.split(/\s+/), function(index, type){ 2405 // Namespaced event handlers 2406 var namespaces = type.split("."); 2407 type = namespaces.shift(); 2408 var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); 2409 2410 if ( events[type] ) { 2411 // remove the given handler for the given type 2412 if ( handler ) 2413 delete events[type][handler.guid]; 2414 2415 // remove all handlers for the given type 2416 else 2417 for ( var handle in events[type] ) 2418 // Handle the removal of namespaced events 2419 if ( namespace.test(events[type][handle].type) ) 2420 delete events[type][handle]; 2421 2422 if ( jQuery.event.specialAll[type] ) 2423 jQuery.event.specialAll[type].teardown.call(elem, namespaces); 2424 2425 // remove generic event handler if no more handlers exist 2426 for ( ret in events[type] ) break; 2427 if ( !ret ) { 2428 if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) { 2429 if (elem.removeEventListener) 2430 elem.removeEventListener(type, jQuery.data(elem, "handle"), false); 2431 else if (elem.detachEvent) 2432 elem.detachEvent("on" + type, jQuery.data(elem, "handle")); 2433 } 2434 ret = null; 2435 delete events[type]; 2436 } 2437 } 2438 }); 2439 } 2440 2441 // Remove the expando if it's no longer used 2442 for ( ret in events ) break; 2443 if ( !ret ) { 2444 var handle = jQuery.data( elem, "handle" ); 2445 if ( handle ) handle.elem = null; 2446 jQuery.removeData( elem, "events" ); 2447 jQuery.removeData( elem, "handle" ); 2448 } 2449 } 2450 }, 2451 2452 // bubbling is internal 2453 trigger: function( event, data, elem, bubbling ) { 2454 // Event object or event type 2455 var type = event.type || event; 2456 2457 if( !bubbling ){ 2458 event = typeof event === "object" ? 2459 // jQuery.Event object 2460 event[expando] ? event : 2461 // Object literal 2462 jQuery.extend( jQuery.Event(type), event ) : 2463 // Just the event type (string) 2464 jQuery.Event(type); 2465 2466 if ( type.indexOf("!") >= 0 ) { 2467 event.type = type = type.slice(0, -1); 2468 event.exclusive = true; 2469 } 2470 2471 // Handle a global trigger 2472 if ( !elem ) { 2473 // Don't bubble custom events when global (to avoid too much overhead) 2474 event.stopPropagation(); 2475 // Only trigger if we've ever bound an event for it 2476 if ( this.global[type] ) 2477 jQuery.each( jQuery.cache, function(){ 2478 if ( this.events && this.events[type] ) 2479 jQuery.event.trigger( event, data, this.handle.elem ); 2480 }); 2481 } 2482 2483 // Handle triggering a single element 2484 2485 // don't do events on text and comment nodes 2486 if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) 2487 return undefined; 2488 2489 // Clean up in case it is reused 2490 event.result = undefined; 2491 event.target = elem; 2492 2493 // Clone the incoming data, if any 2494 data = jQuery.makeArray(data); 2495 data.unshift( event ); 2496 } 2497 2498 event.currentTarget = elem; 2499 2500 // Trigger the event, it is assumed that "handle" is a function 2501 var handle = jQuery.data(elem, "handle"); 2502 if ( handle ) 2503 handle.apply( elem, data ); 2504 2505 // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) 2506 if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) 2507 event.result = false; 2508 2509 // Trigger the native events (except for clicks on links) 2510 if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { 2511 this.triggered = true; 2512 try { 2513 elem[ type ](); 2514 // prevent IE from throwing an error for some hidden elements 2515 } catch (e) {} 2516 } 2517 2518 this.triggered = false; 2519 2520 if ( !event.isPropagationStopped() ) { 2521 var parent = elem.parentNode || elem.ownerDocument; 2522 if ( parent ) 2523 jQuery.event.trigger(event, data, parent, true); 2524 } 2525 }, 2526 2527 handle: function(event) { 2528 // returned undefined or false 2529 var all, handlers; 2530 2531 event = arguments[0] = jQuery.event.fix( event || window.event ); 2532 2533 // Namespaced event handlers 2534 var namespaces = event.type.split("."); 2535 event.type = namespaces.shift(); 2536 2537 // Cache this now, all = true means, any handler 2538 all = !namespaces.length && !event.exclusive; 2539 2540 var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); 2541 2542 handlers = ( jQuery.data(this, "events") || {} )[event.type]; 2543 2544 for ( var j in handlers ) { 2545 var handler = handlers[j]; 2546 2547 // Filter the functions by class 2548 if ( all || namespace.test(handler.type) ) { 2549 // Pass in a reference to the handler function itself 2550 // So that we can later remove it 2551 event.handler = handler; 2552 event.data = handler.data; 2553 2554 var ret = handler.apply(this, arguments); 2555 2556 if( ret !== undefined ){ 2557 event.result = ret; 2558 if ( ret === false ) { 2559 event.preventDefault(); 2560 event.stopPropagation(); 2561 } 2562 } 2563 2564 if( event.isImmediatePropagationStopped() ) 2565 break; 2566 2567 } 2568 } 2569 }, 2570 2571 props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), 2572 2573 fix: function(event) { 2574 if ( event[expando] ) 2575 return event; 2576 2577 // store a copy of the original event object 2578 // and "clone" to set read-only properties 2579 var originalEvent = event; 2580 event = jQuery.Event( originalEvent ); 2581 2582 for ( var i = this.props.length, prop; i; ){ 2583 prop = this.props[ --i ]; 2584 event[ prop ] = originalEvent[ prop ]; 2585 } 2586 2587 // Fix target property, if necessary 2588 if ( !event.target ) 2589 event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either 2590 2591 // check if target is a textnode (safari) 2592 if ( event.target.nodeType == 3 ) 2593 event.target = event.target.parentNode; 2594 2595 // Add relatedTarget, if necessary 2596 if ( !event.relatedTarget && event.fromElement ) 2597 event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; 2598 2599 // Calculate pageX/Y if missing and clientX/Y available 2600 if ( event.pageX == null && event.clientX != null ) { 2601 var doc = document.documentElement, body = document.body; 2602 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); 2603 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); 2604 } 2605 2606 // Add which for key events 2607 if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) 2608 event.which = event.charCode || event.keyCode; 2609 2610 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) 2611 if ( !event.metaKey && event.ctrlKey ) 2612 event.metaKey = event.ctrlKey; 2613 2614 // Add which for click: 1 == left; 2 == middle; 3 == right 2615 // Note: button is not normalized, so don't use it 2616 if ( !event.which && event.button ) 2617 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); 2618 2619 return event; 2620 }, 2621 2622 proxy: function( fn, proxy ){ 2623 proxy = proxy || function(){ return fn.apply(this, arguments); }; 2624 // Set the guid of unique handler to the same of original handler, so it can be removed 2625 proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; 2626 // So proxy can be declared as an argument 2627 return proxy; 2628 }, 2629 2630 special: { 2631 ready: { 2632 // Make sure the ready event is setup 2633 setup: bindReady, 2634 teardown: function() {} 2635 } 2636 }, 2637 2638 specialAll: { 2639 live: { 2640 setup: function( selector, namespaces ){ 2641 jQuery.event.add( this, namespaces[0], liveHandler ); 2642 }, 2643 teardown: function( namespaces ){ 2644 if ( namespaces.length ) { 2645 var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); 2646 2647 jQuery.each( (jQuery.data(this, "events").live || {}), function(){ 2648 if ( name.test(this.type) ) 2649 remove++; 2650 }); 2651 2652 if ( remove < 1 ) 2653 jQuery.event.remove( this, namespaces[0], liveHandler ); 2654 } 2655 } 2656 } 2657 } 2658 }; 2659 2660 jQuery.Event = function( src ){ 2661 // Allow instantiation without the 'new' keyword 2662 if( !this.preventDefault ) 2663 return new jQuery.Event(src); 2664 2665 // Event object 2666 if( src && src.type ){ 2667 this.originalEvent = src; 2668 this.type = src.type; 2669 this.timeStamp = src.timeStamp; 2670 // Event type 2671 }else 2672 this.type = src; 2673 2674 if( !this.timeStamp ) 2675 this.timeStamp = now(); 2676 2677 // Mark it as fixed 2678 this[expando] = true; 2679 }; 2680 2681 function returnFalse(){ 2682 return false; 2683 } 2684 function returnTrue(){ 2685 return true; 2686 } 2687 2688 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 2689 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 2690 jQuery.Event.prototype = { 2691 preventDefault: function() { 2692 this.isDefaultPrevented = returnTrue; 2693 2694 var e = this.originalEvent; 2695 if( !e ) 2696 return; 2697 // if preventDefault exists run it on the original event 2698 if (e.preventDefault) 2699 e.preventDefault(); 2700 // otherwise set the returnValue property of the original event to false (IE) 2701 e.returnValue = false; 2702 }, 2703 stopPropagation: function() { 2704 this.isPropagationStopped = returnTrue; 2705 2706 var e = this.originalEvent; 2707 if( !e ) 2708 return; 2709 // if stopPropagation exists run it on the original event 2710 if (e.stopPropagation) 2711 e.stopPropagation(); 2712 // otherwise set the cancelBubble property of the original event to true (IE) 2713 e.cancelBubble = true; 2714 }, 2715 stopImmediatePropagation:function(){ 2716 this.isImmediatePropagationStopped = returnTrue; 2717 this.stopPropagation(); 2718 }, 2719 isDefaultPrevented: returnFalse, 2720 isPropagationStopped: returnFalse, 2721 isImmediatePropagationStopped: returnFalse 2722 }; 2723 // Checks if an event happened on an element within another element 2724 // Used in jQuery.event.special.mouseenter and mouseleave handlers 2725 var withinElement = function(event) { 2726 // Check if mouse(over|out) are still within the same parent element 2727 var parent = event.relatedTarget; 2728 // Traverse up the tree 2729 while ( parent && parent != this ) 2730 try { parent = parent.parentNode; } 2731 catch(e) { parent = this; } 2732 2733 if( parent != this ){ 2734 // set the correct event type 2735 event.type = event.data; 2736 // handle event if we actually just moused on to a non sub-element 2737 jQuery.event.handle.apply( this, arguments ); 2738 } 2739 }; 2740 2741 jQuery.each({ 2742 mouseover: 'mouseenter', 2743 mouseout: 'mouseleave' 2744 }, function( orig, fix ){ 2745 jQuery.event.special[ fix ] = { 2746 setup: function(){ 2747 jQuery.event.add( this, orig, withinElement, fix ); 2748 }, 2749 teardown: function(){ 2750 jQuery.event.remove( this, orig, withinElement ); 2751 } 2752 }; 2753 }); 2754 2755 jQuery.fn.extend({ 2756 bind: function( type, data, fn ) { 2757 return type == "unload" ? this.one(type, data, fn) : this.each(function(){ 2758 jQuery.event.add( this, type, fn || data, fn && data ); 2759 }); 2760 }, 2761 2762 one: function( type, data, fn ) { 2763 var one = jQuery.event.proxy( fn || data, function(event) { 2764 jQuery(this).unbind(event, one); 2765 return (fn || data).apply( this, arguments ); 2766 }); 2767 return this.each(function(){ 2768 jQuery.event.add( this, type, one, fn && data); 2769 }); 2770 }, 2771 2772 unbind: function( type, fn ) { 2773 return this.each(function(){ 2774 jQuery.event.remove( this, type, fn ); 2775 }); 2776 }, 2777 2778 trigger: function( type, data ) { 2779 return this.each(function(){ 2780 jQuery.event.trigger( type, data, this ); 2781 }); 2782 }, 2783 2784 triggerHandler: function( type, data ) { 2785 if( this[0] ){ 2786 var event = jQuery.Event(type); 2787 event.preventDefault(); 2788 event.stopPropagation(); 2789 jQuery.event.trigger( event, data, this[0] ); 2790 return event.result; 2791 } 2792 }, 2793 2794 toggle: function( fn ) { 2795 // Save reference to arguments for access in closure 2796 var args = arguments, i = 1; 2797 2798 // link all the functions, so any of them can unbind this click handler 2799 while( i < args.length ) 2800 jQuery.event.proxy( fn, args[i++] ); 2801 2802 return this.click( jQuery.event.proxy( fn, function(event) { 2803 // Figure out which function to execute 2804 this.lastToggle = ( this.lastToggle || 0 ) % i; 2805 2806 // Make sure that clicks stop 2807 event.preventDefault(); 2808 2809 // and execute the function 2810 return args[ this.lastToggle++ ].apply( this, arguments ) || false; 2811 })); 2812 }, 2813 2814 hover: function(fnOver, fnOut) { 2815 return this.mouseenter(fnOver).mouseleave(fnOut); 2816 }, 2817 2818 ready: function(fn) { 2819 // Attach the listeners 2820 bindReady(); 2821 2822 // If the DOM is already ready 2823 if ( jQuery.isReady ) 2824 // Execute the function immediately 2825 fn.call( document, jQuery ); 2826 2827 // Otherwise, remember the function for later 2828 else 2829 // Add the function to the wait list 2830 jQuery.readyList.push( fn ); 2831 2832 return this; 2833 }, 2834 2835 live: function( type, fn ){ 2836 var proxy = jQuery.event.proxy( fn ); 2837 proxy.guid += this.selector + type; 2838 2839 jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy ); 2840 2841 return this; 2842 }, 2843 2844 die: function( type, fn ){ 2845 jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null ); 2846 return this; 2847 } 2848 }); 2849 2850 function liveHandler( event ){ 2851 var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"), 2852 stop = true, 2853 elems = []; 2854 2855 jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){ 2856 if ( check.test(fn.type) ) { 2857 var elem = jQuery(event.target).closest(fn.data)[0]; 2858 if ( elem ) 2859 elems.push({ elem: elem, fn: fn }); 2860 } 2861 }); 2862 2863 jQuery.each(elems, function(){ 2864 if ( !event.isImmediatePropagationStopped() && 2865 this.fn.call(this.elem, event, this.fn.data) === false ) 2866 stop = false; 2867 }); 2868 2869 return stop; 2870 } 2871 2872 function liveConvert(type, selector){ 2873 return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join("."); 2874 } 2875 2876 jQuery.extend({ 2877 isReady: false, 2878 readyList: [], 2879 // Handle when the DOM is ready 2880 ready: function() { 2881 // Make sure that the DOM is not already loaded 2882 if ( !jQuery.isReady ) { 2883 // Remember that the DOM is ready 2884 jQuery.isReady = true; 2885 2886 // If there are functions bound, to execute 2887 if ( jQuery.readyList ) { 2888 // Execute all of them 2889 jQuery.each( jQuery.readyList, function(){ 2890 this.call( document, jQuery ); 2891 }); 2892 2893 // Reset the list of functions 2894 jQuery.readyList = null; 2895 } 2896 2897 // Trigger any bound ready events 2898 jQuery(document).triggerHandler("ready"); 2899 } 2900 } 2901 }); 2902 2903 var readyBound = false; 2904 2905 function bindReady(){ 2906 if ( readyBound ) return; 2907 readyBound = true; 2908 2909 // Mozilla, Opera and webkit nightlies currently support this event 2910 if ( document.addEventListener ) { 2911 // Use the handy event callback 2912 document.addEventListener( "DOMContentLoaded", function(){ 2913 document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); 2914 jQuery.ready(); 2915 }, false ); 2916 2917 // If IE event model is used 2918 } else if ( document.attachEvent ) { 2919 // ensure firing before onload, 2920 // maybe late but safe also for iframes 2921 document.attachEvent("onreadystatechange", function(){ 2922 if ( document.readyState === "complete" ) { 2923 document.detachEvent( "onreadystatechange", arguments.callee ); 2924 jQuery.ready(); 2925 } 2926 }); 2927 2928 // If IE and not an iframe 2929 // continually check to see if the document is ready 2930 if ( document.documentElement.doScroll && !window.frameElement ) (function(){ 2931 if ( jQuery.isReady ) return; 2932 2933 try { 2934 // If IE is used, use the trick by Diego Perini 2935 // http://javascript.nwbox.com/IEContentLoaded/ 2936 document.documentElement.doScroll("left"); 2937 } catch( error ) { 2938 setTimeout( arguments.callee, 0 ); 2939 return; 2940 } 2941 2942 // and execute any waiting functions 2943 jQuery.ready(); 2944 })(); 2945 } 2946 2947 // A fallback to window.onload, that will always work 2948 jQuery.event.add( window, "load", jQuery.ready ); 2949 } 2950 2951 jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + 2952 "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + 2953 "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){ 2954 2955 // Handle event binding 2956 jQuery.fn[name] = function(fn){ 2957 return fn ? this.bind(name, fn) : this.trigger(name); 2958 }; 2959 }); 2960 2961 // Prevent memory leaks in IE 2962 // And prevent errors on refresh with events like mouseover in other browsers 2963 // Window isn't included so as not to unbind existing unload events 2964 jQuery( window ).bind( 'unload', function(){ 2965 for ( var id in jQuery.cache ) 2966 // Skip the window 2967 if ( id != 1 && jQuery.cache[ id ].handle ) 2968 jQuery.event.remove( jQuery.cache[ id ].handle.elem ); 2969 }); 2970 (function(){ 1378 2971 1379 2972 jQuery.support = {}; … … 1428 3021 cssFloat: !!a.style.cssFloat, 1429 3022 1430 // Verify tabindex attribute existence1431 // (IE uses tabIndex instead of tabindex)1432 tabindex: !a.getAttributeNode('tabindex'),1433 1434 3023 // Will be defined later 1435 3024 scriptEval: false, 1436 noCloneEvent: true 3025 noCloneEvent: true, 3026 boxModel: null 1437 3027 }; 1438 3028 … … 1464 3054 } 1465 3055 3056 // Figure out if the W3C box model works as expected 3057 // document.body must exist before we can do this 3058 jQuery(function(){ 3059 var div = document.createElement("div"); 3060 div.style.width = "1px"; 3061 div.style.paddingLeft = "1px"; 3062 3063 document.body.appendChild( div ); 3064 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; 3065 document.body.removeChild( div ); 3066 }); 1466 3067 })(); 1467 3068 … … 1478 3079 cellspacing: "cellSpacing", 1479 3080 rowspan: "rowSpan", 1480 tabindex: jQuery.support.tabindex ? "tabindex" :"tabIndex"3081 tabindex: "tabIndex" 1481 3082 }; 1482 /*1483 * Sizzle CSS Selector Engine - v0.91484 * Copyright 2009, John Resig (http://ejohn.org/)1485 * released under the MIT License1486 */1487 (function(){1488 1489 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g;1490 1491 var done = 0;1492 1493 var Sizzle = function(selector, context, results, seed) {1494 var doCache = !results;1495 results = results || [];1496 context = context || document;1497 1498 if ( context.nodeType !== 1 && context.nodeType !== 9 )1499 return [];1500 1501 if ( !selector || typeof selector !== "string" ) {1502 return results;1503 }1504 1505 var parts = [], m, set, checkSet, check, mode, extra;1506 1507 // Reset the position of the chunker regexp (start from head)1508 chunker.lastIndex = 0;1509 1510 while ( (m = chunker.exec(selector)) !== null ) {1511 parts.push( m[1] );1512 1513 if ( m[2] ) {1514 extra = RegExp.rightContext;1515 break;1516 }1517 }1518 1519 if ( parts.length > 1 && Expr.match.POS.exec( selector ) ) {1520 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {1521 var later = "", match;1522 1523 // Position selectors must be done after the filter1524 while ( (match = Expr.match.POS.exec( selector )) ) {1525 later += match[0];1526 selector = selector.replace( Expr.match.POS, "" );1527 }1528 1529 set = Sizzle.filter( later, Sizzle( selector, context ) );1530 } else {1531 set = Expr.relative[ parts[0] ] ?1532 [ context ] :1533 Sizzle( parts.shift(), context );1534 1535 while ( parts.length ) {1536 var tmpSet = [];1537 1538 selector = parts.shift();1539 if ( Expr.relative[ selector ] )1540 selector += parts.shift();1541 1542 for ( var i = 0, l = set.length; i < l; i++ ) {1543 Sizzle( selector, set[i], tmpSet );1544 }1545 1546 set = tmpSet;1547 }1548 }1549 } else {1550 var ret = seed ?1551 { expr: parts.pop(), set: makeArray(seed) } :1552 Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context );1553 set = Sizzle.filter( ret.expr, ret.set );1554 1555 if ( parts.length > 0 ) {1556 checkSet = makeArray(set);1557 }1558 1559 while ( parts.length ) {1560 var cur = parts.pop(), pop = cur;1561 1562 if ( !Expr.relative[ cur ] ) {1563 cur = "";1564 } else {1565 pop = parts.pop();1566 }1567 1568 if ( pop == null ) {1569 pop = context;1570 }1571 1572 Expr.relative[ cur ]( checkSet, pop );1573 }1574 }1575 1576 if ( !checkSet ) {1577 checkSet = set;1578 }1579 1580 if ( !checkSet ) {1581 throw "Syntax error, unrecognized expression: " + (cur || selector);1582 }1583 1584 if ( checkSet instanceof Array ) {1585 if ( context.nodeType === 1 ) {1586 for ( var i = 0; checkSet[i] != null; i++ ) {1587 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {1588 results.push( set[i] );1589 }1590 }1591 } else {1592 for ( var i = 0; checkSet[i] != null; i++ ) {1593 if ( checkSet[i] && checkSet[i].nodeType === 1 ) {1594 results.push( set[i] );1595 }1596 }1597 }1598 } else {1599 makeArray( checkSet, results );1600 }1601 1602 if ( extra ) {1603 Sizzle( extra, context, results, seed );1604 }1605 1606 return results;1607 };1608 1609 Sizzle.matches = function(expr, set){1610 return Sizzle(expr, null, null, set);1611 };1612 1613 Sizzle.find = function(expr, context){1614 var set, match;1615 1616 if ( !expr ) {1617 return [];1618 }1619 1620 for ( var i = 0, l = Expr.order.length; i < l; i++ ) {1621 var type = Expr.order[i], match;1622 1623 if ( (match = Expr.match[ type ].exec( expr )) ) {1624 var left = RegExp.leftContext;1625 1626 if ( left.substr( left.length - 1 ) !== "\\" ) {1627 match[1] = (match[1] || "").replace(/\\/g, "");1628 set = Expr.find[ type ]( match, context );1629 if ( set != null ) {1630 expr = expr.replace( Expr.match[ type ], "" );1631 break;1632 }1633 }1634 }1635 }1636 1637 if ( !set ) {1638 set = context.getElementsByTagName("*");1639 }1640 1641 return {set: set, expr: expr};1642 };1643 1644 Sizzle.filter = function(expr, set, inplace){1645 var old = expr, result = [], curLoop = set, match, anyFound;1646 1647 while ( expr && set.length ) {1648 for ( var type in Expr.filter ) {1649 if ( (match = Expr.match[ type ].exec( expr )) != null ) {1650 var filter = Expr.filter[ type ], goodArray = null, goodPos = 0, found, item;1651 anyFound = false;1652 1653 if ( curLoop == result ) {1654 result = [];1655 }1656 1657 if ( Expr.preFilter[ type ] ) {1658 match = Expr.preFilter[ type ]( match, curLoop );1659 1660 if ( match[0] === true ) {1661 goodArray = [];1662 var last = null, elem;1663 for ( var i = 0; (elem = curLoop[i]) !== undefined; i++ ) {1664 if ( elem && last !== elem ) {1665 goodArray.push( elem );1666 last = elem;1667 }1668 }1669 }1670 }1671 1672 for ( var i = 0; (item = curLoop[i]) !== undefined; i++ ) {1673 if ( item ) {1674 if ( goodArray && item != goodArray[goodPos] ) {1675 goodPos++;1676 }1677 1678 found = filter( item, match, goodPos, goodArray );1679 if ( inplace && found != null ) {1680 curLoop[i] = found ? curLoop[i] : false;1681 if ( found ) {1682 anyFound = true;1683 }1684 } else if ( found ) {1685 result.push( item );1686 anyFound = true;1687 }1688 }1689 }1690 1691 if ( found !== undefined ) {1692 if ( !inplace ) {1693 curLoop = result;1694 }1695 1696 expr = expr.replace( Expr.match[ type ], "" );1697 1698 if ( !anyFound ) {1699 return [];1700 }1701 1702 break;1703 }1704 }1705 }1706 1707 expr = expr.replace(/\s*,\s*/, "");1708 1709 // Improper expression1710 if ( expr == old ) {1711 if ( anyFound == null ) {1712 throw "Syntax error, unrecognized expression: " + expr;1713 } else {1714 break;1715 }1716 }1717 1718 old = expr;1719 }1720 1721 return curLoop;1722 };1723 1724 var Expr = Sizzle.selectors = {1725 order: [ "ID", "NAME", "TAG" ],1726 match: {1727 ID: /#((?:[\w\u0128-\uFFFF_-]|\\.)+)/,1728 CLASS: /\.((?:[\w\u0128-\uFFFF_-]|\\.)+)/,1729 NAME: /\[name=['"]*((?:[\w\u0128-\uFFFF_-]|\\.)+)['"]*\]/,1730 ATTR: /\[((?:[\w\u0128-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\]/,1731 TAG: /^((?:[\w\u0128-\uFFFF\*_-]|\\.)+)/,1732 CHILD: /:(only|nth|last|first)-child\(?(even|odd|[\dn+-]*)\)?/,1733 POS: /:(nth|eq|gt|lt|first|last|even|odd)\(?(\d*)\)?(?:[^-]|$)/,1734 PSEUDO: /:((?:[\w\u0128-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/1735 },1736 attrMap: {1737 "class": "className"1738 },1739 relative: {1740 "+": function(checkSet, part){1741 for ( var i = 0, l = checkSet.length; i < l; i++ ) {1742 var elem = checkSet[i];1743 if ( elem ) {1744 var cur = elem.previousSibling;1745 while ( cur && cur.nodeType !== 1 ) {1746 cur = cur.previousSibling;1747 }1748 checkSet[i] = typeof part === "string" ?1749 cur || false :1750 cur === part;1751 }1752 }1753 1754 if ( typeof part === "string" ) {1755 Sizzle.filter( part, checkSet, true );1756 }1757 },1758 ">": function(checkSet, part){1759 if ( typeof part === "string" && !/\W/.test(part) ) {1760 part = part.toUpperCase();1761 1762 for ( var i = 0, l = checkSet.length; i < l; i++ ) {1763 var elem = checkSet[i];1764 if ( elem ) {1765 var parent = elem.parentNode;1766 checkSet[i] = parent.nodeName === part ? parent : false;1767 }1768 }1769 } else {1770 for ( var i = 0, l = checkSet.length; i < l; i++ ) {1771 var elem = checkSet[i];1772 if ( elem ) {1773 checkSet[i] = typeof part === "string" ?1774 elem.parentNode :1775 elem.parentNode === part;1776 }1777 }1778 1779 if ( typeof part === "string" ) {1780 Sizzle.filter( part, checkSet, true );1781 }1782 }1783 },1784 "": function(checkSet, part){1785 var doneName = "done" + (done++), checkFn = dirCheck;1786 1787 if ( !part.match(/\W/) ) {1788 var nodeCheck = part = part.toUpperCase();1789 checkFn = dirNodeCheck;1790 }1791 1792 checkFn("parentNode", part, doneName, checkSet, nodeCheck);1793 },1794 "~": function(checkSet, part){1795 var doneName = "done" + (done++), checkFn = dirCheck;1796 1797 if ( typeof part === "string" && !part.match(/\W/) ) {1798 var nodeCheck = part = part.toUpperCase();1799 checkFn = dirNodeCheck;1800 }1801 1802 checkFn("previousSibling", part, doneName, checkSet, nodeCheck);1803 }1804 },1805 find: {1806 ID: function(match, context){1807 if ( context.getElementById ) {1808 var m = context.getElementById(match[1]);1809 return m ? [m] : [];1810 }1811 },1812 NAME: function(match, context){1813 return context.getElementsByName ? context.getElementsByName(match[1]) : null;1814 },1815 TAG: function(match, context){1816 return context.getElementsByTagName(match[1]);1817 }1818 },1819 preFilter: {1820 CLASS: function(match){1821 return new RegExp( "(?:^|\\s)" + match[1] + "(?:\\s|$)" );1822 },1823 ID: function(match){1824 return match[1];1825 },1826 TAG: function(match){1827 return match[1].toUpperCase();1828 },1829 CHILD: function(match){1830 if ( match[1] == "nth" ) {1831 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'1832 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(1833 match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||1834 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);1835 1836 // calculate the numbers (first)n+(last) including if they are negative1837 match[2] = (test[1] + (test[2] || 1)) - 0;1838 match[3] = test[3] - 0;1839 }1840 1841 // TODO: Move to normal caching system1842 match[0] = "done" + (done++);1843 1844 return match;1845 },1846 ATTR: function(match){1847 var name = match[1];1848 1849 if ( Expr.attrMap[name] ) {1850 match[1] = Expr.attrMap[name];1851 }1852 1853 if ( match[2] === "~=" ) {1854 match[4] = " " + match[4] + " ";1855 }1856 1857 return match;1858 },1859 PSEUDO: function(match, curLoop){1860 if ( match[1] === "not" ) {1861 // If we're dealing with a complex expression, or a simple one1862 match[3] = match[3].match(chunker).length > 1 ?1863 Sizzle(match[3], null, null, curLoop) :1864 Sizzle.filter(match[3], curLoop);1865 }1866 1867 return match;1868 },1869 POS: function(match){1870 match.unshift( true );1871 return match;1872 }1873 },1874 filters: {1875 enabled: function(elem){1876 return elem.disabled === false && elem.type !== "hidden";1877 },1878 disabled: function(elem){1879 return elem.disabled === true;1880 },1881 checked: function(elem){1882 return elem.checked === true;1883 },1884 selected: function(elem){1885 // Accessing this property makes selected-by-default1886 // options in Safari work properly1887 elem.parentNode.selectedIndex;1888 return elem.selected === true;1889 },1890 parent: function(elem){1891 return !!elem.firstChild;1892 },1893 empty: function(elem){1894 return !elem.firstChild;1895 },1896 has: function(elem, i, match){1897 return !!Sizzle( match[3], elem ).length;1898 },1899 header: function(elem){1900 return /h\d/i.test( elem.nodeName );1901 },1902 text: function(elem){1903 return "text" === elem.type;1904 },1905 radio: function(elem){1906 return "radio" === elem.type;1907 },1908 checkbox: function(elem){1909 return "checkbox" === elem.type;1910 },1911 file: function(elem){1912 return "file" === elem.type;1913 },1914 password: function(elem){1915 return "password" === elem.type;1916 },1917 submit: function(elem){1918 return "submit" === elem.type;1919 },1920 image: function(elem){1921 return "image" === elem.type;1922 },1923 reset: function(elem){1924 return "reset" === elem.type;1925 },1926 button: function(elem){1927 return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";1928 },1929 input: function(elem){1930 return /input|select|textarea|button/i.test(elem.nodeName);1931 }1932 },1933 setFilters: {1934 first: function(elem, i){1935 return i === 0;1936 },1937 last: function(elem, i, match, array){1938 return i === array.length - 1;1939 },1940 even: function(elem, i){1941 return i % 2 === 0;1942 },1943 odd: function(elem, i){1944 return i % 2 === 1;1945 },1946 lt: function(elem, i, match){1947 return i < match[3] - 0;1948 },1949 gt: function(elem, i, match){1950 return i > match[3] - 0;1951 },1952 nth: function(elem, i, match){1953 return match[3] - 0 == i;1954 },1955 eq: function(elem, i, match){1956 return match[3] - 0 == i;1957 }1958 },1959 filter: {1960 CHILD: function(elem, match){1961 var type = match[1], parent = elem.parentNode;1962 1963 var doneName = match[0];1964 1965 if ( parent && !parent[ doneName ] ) {1966 var count = 1;1967 1968 for ( var node = parent.firstChild; node; node = node.nextSibling ) {1969 if ( node.nodeType == 1 ) {1970 node.nodeIndex = count++;1971 }1972 }1973 1974 parent[ doneName ] = count - 1;1975 }1976 1977 if ( type == "first" ) {1978 return elem.nodeIndex == 1;1979 } else if ( type == "last" ) {1980 return elem.nodeIndex == parent[ doneName ];1981 } else if ( type == "only" ) {1982 return parent[ doneName ] == 1;1983 } else if ( type == "nth" ) {1984 var add = false, first = match[2], last = match[3];1985 1986 if ( first == 1 && last == 0 ) {1987 return true;1988 }1989 1990 if ( first == 0 ) {1991 if ( elem.nodeIndex == last ) {1992 add = true;1993 }1994 } else if ( (elem.nodeIndex - last) % first == 0 && (elem.nodeIndex - last) / first >= 0 ) {1995 add = true;1996 }1997 1998 return add;1999 }2000 },2001 PSEUDO: function(elem, match, i, array){2002 var name = match[1], filter = Expr.filters[ name ];2003 2004 if ( filter ) {2005 return filter( elem, i, match, array );2006 } else if ( name === "contains" ) {2007 return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;2008 } else if ( name === "not" ) {2009 var not = match[3];2010 2011 for ( var i = 0, l = not.length; i < l; i++ ) {2012 if ( not[i] === elem ) {2013 return false;2014 }2015 }2016 2017 return true;2018 }2019 },2020 ID: function(elem, match){2021 return elem.nodeType === 1 && elem.getAttribute("id") === match;2022 },2023 TAG: function(elem, match){2024 return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;2025 },2026 CLASS: function(elem, match){2027 return match.test( elem.className );2028 },2029 ATTR: function(elem, match){2030 var result = elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];2031 return result == null ?2032 false :2033 type === "=" ?2034 value === check :2035 type === "*=" ?2036 value.indexOf(check) >= 0 :2037 type === "~=" ?2038 (" " + value + " ").indexOf(check) >= 0 :2039 !match[4] ?2040 result :2041 type === "!=" ?2042 value != check :2043 type === "^=" ?2044 value.indexOf(check) === 0 :2045 type === "$=" ?2046 value.substr(value.length - check.length) === check :2047 type === "|=" ?2048 value === check || value.substr(0, check.length + 1) === check + "-" :2049 false;2050 },2051 POS: function(elem, match, i, array){2052 var name = match[2], filter = Expr.setFilters[ name ];2053 2054 if ( filter ) {2055 return filter( elem, i, match, array );2056 }2057 }2058 }2059 };2060 2061 for ( var type in Expr.match ) {2062 Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );2063 }2064 2065 var makeArray = function(array, results) {2066 array = Array.prototype.slice.call( array );2067 2068 if ( results ) {2069 results.push.apply( results, array );2070 return results;2071 }2072 2073 return array;2074 };2075 2076 // Perform a simple check to determine if the browser is capable of2077 // converting a NodeList to an array using builtin methods.2078 try {2079 Array.prototype.slice.call( document.documentElement.childNodes );2080 2081 // Provide a fallback method if it does not work2082 } catch(e){2083 makeArray = function(array, results) {2084 var ret = results || [];2085 2086 if ( array instanceof Array ) {2087 Array.prototype.push.apply( ret, array );2088 } else {2089 if ( typeof array.length === "number" ) {2090 for ( var i = 0, l = array.length; i < l; i++ ) {2091 ret.push( array[i] );2092 }2093 } else {2094 for ( var i = 0; array[i]; i++ ) {2095 ret.push( array[i] );2096 }2097 }2098 }2099 2100 return ret;2101 };2102 }2103 2104 // Check to see if the browser returns elements by name when2105 // querying by getElementById (and provide a workaround)2106 (function(){2107 // We're going to inject a fake input element with a specified name2108 var form = document.createElement("form"),2109 id = "script" + (new Date).getTime();2110 form.innerHTML = "<input name='" + id + "'/>";2111 2112 // Inject it into the root element, check its status, and remove it quickly2113 var root = document.documentElement;2114 root.insertBefore( form, root.firstChild );2115 2116 // The workaround has to do additional checks after a getElementById2117 // Which slows things down for other browsers (hence the branching)2118 if ( !!document.getElementById( id ) ) {2119 Expr.find.ID = function(match, context){2120 if ( context.getElementById ) {2121 var m = context.getElementById(match[1]);2122 return m ? m.id === match[1] || m.getAttributeNode && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];2123 }2124 };2125 2126 Expr.filter.ID = function(elem, match){2127 var node = elem.getAttributeNode && elem.getAttributeNode("id");2128 return elem.nodeType === 1 && node && node.nodeValue === match;2129 };2130 }2131 2132 root.removeChild( form );2133 })();2134 2135 // Check to see if the browser returns only elements2136 // when doing getElementsByTagName("*")2137 (function(){2138 // Create a fake element2139 var div = document.createElement("div");2140 div.appendChild( document.createComment("") );2141 2142 // Make sure no comments are found2143 if ( div.getElementsByTagName("*").length > 0 ) {2144 Expr.find.TAG = function(match, context){2145 var results = context.getElementsByTagName(match[1]);2146 2147 // Filter out possible comments2148 if ( match[1] === "*" ) {2149 var tmp = [];2150 2151 for ( var i = 0; results[i]; i++ ) {2152 if ( results[i].nodeType === 1 ) {2153 tmp.push( results[i] );2154 }2155 }2156 2157 results = tmp;2158 }2159 2160 return results;2161 };2162 }2163 })();2164 2165 if ( document.querySelectorAll ) (function(){2166 var oldSizzle = Sizzle;2167 2168 Sizzle = function(query, context, extra, seed){2169 context = context || document;2170 2171 if ( !seed && context.nodeType === 9 ) {2172 try {2173 return makeArray( context.querySelectorAll(query) );2174 } catch(e){}2175 }2176 2177 return oldSizzle(query, context, extra, seed);2178 };2179 2180 Sizzle.find = oldSizzle.find;2181 Sizzle.filter = oldSizzle.filter;2182 Sizzle.selectors = oldSizzle.selectors;2183 Sizzle.matches = oldSizzle.matches;2184 })();2185 2186 if ( document.documentElement.getElementsByClassName ) {2187 Expr.order.splice(1, 0, "CLASS");2188 Expr.find.CLASS = function(match, context) {2189 return context.getElementsByClassName(match[1]);2190 };2191 }2192 2193 function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck ) {2194 for ( var i = 0, l = checkSet.length; i < l; i++ ) {2195 var elem = checkSet[i];2196 if ( elem ) {2197 elem = elem[dir];2198 var match = false;2199 2200 while ( elem && elem.nodeType ) {2201 var done = elem[doneName];2202 if ( done ) {2203 match = checkSet[ done ];2204 break;2205 }2206 2207 if ( elem.nodeType === 1 )2208 elem[doneName] = i;2209 2210 if ( elem.nodeName === cur ) {2211 match = elem;2212 break;2213 }2214 2215 elem = elem[dir];2216 }2217 2218 checkSet[i] = match;2219 }2220 }2221 }2222 2223 function dirCheck( dir, cur, doneName, checkSet, nodeCheck ) {2224 for ( var i = 0, l = checkSet.length; i < l; i++ ) {2225 var elem = checkSet[i];2226 if ( elem ) {2227 elem = elem[dir];2228 var match = false;2229 2230 while ( elem && elem.nodeType ) {2231 if ( elem[doneName] ) {2232 match = checkSet[ elem[doneName] ];2233 break;2234 }2235 2236 if ( elem.nodeType === 1 ) {2237 elem[doneName] = i;2238 2239 if ( typeof cur !== "string" ) {2240 if ( elem === cur ) {2241 match = true;2242 break;2243 }2244 2245 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {2246 match = elem;2247 break;2248 }2249 }2250 2251 elem = elem[dir];2252 }2253 2254 checkSet[i] = match;2255 }2256 }2257 }2258 2259 var contains = document.compareDocumentPosition ? function(a, b){2260 return a.compareDocumentPosition(b) & 16;2261 } : function(a, b){2262 return a !== b && (a.contains ? a.contains(b) : true);2263 };2264 2265 // EXPOSE2266 jQuery.find = Sizzle;2267 jQuery.filter = Sizzle.filter;2268 jQuery.expr = Sizzle.selectors;2269 jQuery.expr[":"] = jQuery.expr.filters;2270 2271 Sizzle.selectors.filters.hidden = function(elem){2272 return "hidden" === elem.type ||2273 jQuery.css(elem, "display") === "none" ||2274 jQuery.css(elem, "visibility") === "hidden";2275 };2276 2277 Sizzle.selectors.filters.visible = function(elem){2278 return "hidden" !== elem.type &&2279 jQuery.css(elem, "display") !== "none" &&2280 jQuery.css(elem, "visibility") !== "hidden";2281 };2282 2283 Sizzle.selectors.filters.animated = function(elem){2284 return jQuery.grep(jQuery.timers, function(fn){2285 return elem === fn.elem;2286 }).length;2287 };2288 2289 jQuery.multiFilter = function( expr, elems, not ) {2290 if ( not ) {2291 expr = ":not(" + expr + ")";2292 }2293 2294 return Sizzle.matches(expr, elems);2295 };2296 2297 jQuery.dir = function( elem, dir ){2298 var matched = [], cur = elem[dir];2299 while ( cur && cur != document ) {2300 if ( cur.nodeType == 1 )2301 matched.push( cur );2302 cur = cur[dir];2303 }2304 return matched;2305 };2306 2307 jQuery.nth = function(cur, result, dir, elem){2308 result = result || 1;2309 var num = 0;2310 2311 for ( ; cur; cur = cur[dir] )2312 if ( cur.nodeType == 1 && ++num == result )2313 break;2314 2315 return cur;2316 };2317 2318 jQuery.sibling = function(n, elem){2319 var r = [];2320 2321 for ( ; n; n = n.nextSibling ) {2322 if ( n.nodeType == 1 && n != elem )2323 r.push( n );2324 }2325 2326 return r;2327 };2328 2329 return;2330 2331 window.Sizzle = Sizzle;2332 2333 })();2334 /*2335 * A number of helper functions used for managing events.2336 * Many of the ideas behind this code originated from2337 * Dean Edwards' addEvent library.2338 */2339 jQuery.event = {2340 2341 // Bind an event to an element2342 // Original by Dean Edwards2343 add: function(elem, types, handler, data) {2344 if ( elem.nodeType == 3 || elem.nodeType == 8 )2345 return;2346 2347 // For whatever reason, IE has trouble passing the window object2348 // around, causing it to be cloned in the process2349 if ( elem.setInterval && elem != window )2350 elem = window;2351 2352 // Make sure that the function being executed has a unique ID2353 if ( !handler.guid )2354 handler.guid = this.guid++;2355 2356 // if data is passed, bind to handler2357 if ( data !== undefined ) {2358 // Create temporary function pointer to original handler2359 var fn = handler;2360 2361 // Create unique handler function, wrapped around original handler2362 handler = this.proxy( fn, function() {2363 // Pass arguments and context to original handler2364 return fn.apply(this, arguments);2365 });2366 2367 // Store data in unique handler2368 handler.data = data;2369 }2370 2371 // Init the element's event structure2372 var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),2373 handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){2374 // Handle the second event of a trigger and when2375 // an event is called after a page has unloaded2376 return typeof jQuery !== "undefined" && !jQuery.event.triggered ?2377 jQuery.event.handle.apply(arguments.callee.elem, arguments) :2378 undefined;2379 });2380 // Add elem as a property of the handle function2381 // This is to prevent a memory leak with non-native2382 // event in IE.2383 handle.elem = elem;2384 2385 // Handle multiple events separated by a space2386 // jQuery(...).bind("mouseover mouseout", fn);2387 jQuery.each(types.split(/\s+/), function(index, type) {2388 // Namespaced event handlers2389 var namespaces = type.split(".");2390 type = namespaces.shift();2391 handler.type = namespaces.slice().sort().join(".");2392 2393 // Get the current list of functions bound to this event2394 var handlers = events[type];2395 2396 if ( jQuery.event.specialAll[type] )2397 jQuery.event.specialAll[type].setup.call(elem, data, namespaces);2398 2399 // Init the event handler queue2400 if (!handlers) {2401 handlers = events[type] = {};2402 2403 // Check for a special event handler2404 // Only use addEventListener/attachEvent if the special2405 // events handler returns false2406 if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {2407 // Bind the global event handler to the element2408 if (elem.addEventListener)2409 elem.addEventListener(type, handle, false);2410 else if (elem.attachEvent)2411 elem.attachEvent("on" + type, handle);2412 }2413 }2414 2415 // Add the function to the element's handler list2416 handlers[handler.guid] = handler;2417 2418 // Keep track of which events have been used, for global triggering2419 jQuery.event.global[type] = true;2420 });2421 2422 // Nullify elem to prevent memory leaks in IE2423 elem = null;2424 },2425 2426 guid: 1,2427 global: {},2428 2429 // Detach an event or set of events from an element2430 remove: function(elem, types, handler) {2431 // don't do events on text and comment nodes2432 if ( elem.nodeType == 3 || elem.nodeType == 8 )2433 return;2434 2435 var events = jQuery.data(elem, "events"), ret, index;2436 2437 if ( events ) {2438 // Unbind all events for the element2439 if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )2440 for ( var type in events )2441 this.remove( elem, type + (types || "") );2442 else {2443 // types is actually an event object here2444 if ( types.type ) {2445 handler = types.handler;2446 types = types.type;2447 }2448 2449 // Handle multiple events seperated by a space2450 // jQuery(...).unbind("mouseover mouseout", fn);2451 jQuery.each(types.split(/\s+/), function(index, type){2452 // Namespaced event handlers2453 var namespaces = type.split(".");2454 type = namespaces.shift();2455 var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");2456 2457 if ( events[type] ) {2458 // remove the given handler for the given type2459 if ( handler )2460 delete events[type][handler.guid];2461 2462 // remove all handlers for the given type2463 else2464 for ( handler in events[type] )2465 // Handle the removal of namespaced events2466 if ( namespace.test(events[type][handler].type) )2467 2468 delete events[type][handler];2469 2470 if ( jQuery.event.specialAll[type] )2471 jQuery.event.specialAll[type].teardown.call(elem, namespaces);2472 2473 // remove generic event handler if no more handlers exist2474 for ( ret in events[type] ) break;2475 if ( !ret ) {2476 if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {2477 if (elem.removeEventListener)2478 elem.removeEventListener(type, jQuery.data(elem, "handle"), false);2479 else if (elem.detachEvent)2480 elem.detachEvent("on" + type, jQuery.data(elem, "handle"));2481 }2482 ret = null;2483 delete events[type];2484 }2485 }2486 });2487 }2488 2489 // Remove the expando if it's no longer used2490 for ( ret in events ) break;2491 if ( !ret ) {2492 var handle = jQuery.data( elem, "handle" );2493 if ( handle ) handle.elem = null;2494 jQuery.removeData( elem, "events" );2495 jQuery.removeData( elem, "handle" );2496 }2497 }2498 },2499 2500 // bubbling is internal2501 trigger: function( event, data, elem, bubbling ) {2502 // Event object or event type2503 var type = event.type || event;2504 2505 if( !bubbling ){2506 event = typeof event === "object" ?2507 // jQuery.Event object2508 event[expando] ? event :2509 // Object literal2510 jQuery.extend( jQuery.Event(type), event ) :2511 // Just the event type (string)2512 jQuery.Event(type);2513 2514 if ( type.indexOf("!") >= 0 ) {2515 event.type = type = type.slice(0, -1);2516 event.exclusive = true;2517 }2518 2519 // Handle a global trigger2520 if ( !elem ) {2521 // Don't bubble custom events when global (to avoid too much overhead)2522 event.stopPropagation();2523 // Only trigger if we've ever bound an event for it2524 if ( this.global[type] )2525 jQuery.each( jQuery.cache, function(){2526 if ( this.events && this.events[type] )2527 jQuery.event.trigger( event, data, this.handle.elem );2528 });2529 }2530 2531 // Handle triggering a single element2532 2533 // don't do events on text and comment nodes2534 if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )2535 return undefined;2536 2537 // Clean up in case it is reused2538 event.result = undefined;2539 event.target = elem;2540 2541 // Clone the incoming data, if any2542 data = jQuery.makeArray(data);2543 data.unshift( event );2544 }2545 2546 event.currentTarget = elem;2547 2548 // Trigger the event, it is assumed that "handle" is a function2549 var handle = jQuery.data(elem, "handle");2550 if ( handle )2551 handle.apply( elem, data );2552 2553 // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)2554 if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )2555 event.result = false;2556 2557 // Trigger the native events (except for clicks on links)2558 if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {2559 this.triggered = true;2560 try {2561 elem[ type ]();2562 // prevent IE from throwing an error for some hidden elements2563 } catch (e) {}2564 }2565 2566 this.triggered = false;2567 2568 if ( !event.isPropagationStopped() ) {2569 var parent = elem.parentNode || elem.ownerDocument;2570 if ( parent )2571 jQuery.event.trigger(event, data, parent, true);2572 }2573 },2574 2575 handle: function(event) {2576 // returned undefined or false2577 var all, handlers;2578 2579 event = arguments[0] = jQuery.event.fix( event || window.event );2580 2581 // Namespaced event handlers2582 var namespaces = event.type.split(".");2583 event.type = namespaces.shift();2584 2585 // Cache this now, all = true means, any handler2586 all = !namespaces.length && !event.exclusive;2587 2588 var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");2589 2590 handlers = ( jQuery.data(this, "events") || {} )[event.type];2591 2592 for ( var j in handlers ) {2593 var handler = handlers[j];2594 2595 // Filter the functions by class2596 if ( all || namespace.test(handler.type) ) {2597 // Pass in a reference to the handler function itself2598 // So that we can later remove it2599 event.handler = handler;2600 event.data = handler.data;2601 2602 var ret = handler.apply(this, arguments);2603 2604 if( ret !== undefined ){2605 event.result = ret;2606 if ( ret === false ) {2607 event.preventDefault();2608 event.stopPropagation();2609 }2610 }2611 2612 if( event.isImmediatePropagationStopped() )2613 break;2614 2615 }2616 }2617 },2618 2619 props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),2620 2621 fix: function(event) {2622 if ( event[expando] )2623 return event;2624 2625 // store a copy of the original event object2626 // and "clone" to set read-only properties2627 var originalEvent = event;2628 event = jQuery.Event( originalEvent );2629 2630 for ( var i = this.props.length, prop; i; ){2631 prop = this.props[ --i ];2632 event[ prop ] = originalEvent[ prop ];2633 }2634 2635 // Fix target property, if necessary2636 if ( !event.target )2637 event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either2638 2639 // check if target is a textnode (safari)2640 if ( event.target.nodeType == 3 )2641 event.target = event.target.parentNode;2642 2643 // Add relatedTarget, if necessary2644 if ( !event.relatedTarget && event.fromElement )2645 event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;2646 2647 // Calculate pageX/Y if missing and clientX/Y available2648 if ( event.pageX == null && event.clientX != null ) {2649 var doc = document.documentElement, body = document.body;2650 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);2651 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);2652 }2653 2654 // Add which for key events2655 if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )2656 event.which = event.charCode || event.keyCode;2657 2658 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)2659 if ( !event.metaKey && event.ctrlKey )2660 event.metaKey = event.ctrlKey;2661 2662 // Add which for click: 1 == left; 2 == middle; 3 == right2663 // Note: button is not normalized, so don't use it2664 if ( !event.which && event.button )2665 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));2666 2667 return event;2668 },2669 2670 proxy: function( fn, proxy ){2671 // Set the guid of unique handler to the same of original handler, so it can be removed2672 proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;2673 // So proxy can be declared as an argument2674 return proxy;2675 },2676 2677 special: {2678 ready: {2679 // Make sure the ready event is setup2680 setup: bindReady,2681 teardown: function() {}2682 }2683 },2684 2685 specialAll: {2686 live: {2687 setup: function( selector, namespaces ){2688 jQuery.event.add( this, namespaces[0], liveHandler );2689 },2690 teardown: function( namespaces ){2691 if ( namespaces.length ) {2692 var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");2693 2694 jQuery.each( (jQuery.data(this, "events").live || {}), function(){2695 if ( name.test(this.type) )2696 remove++;2697 });2698 2699 if ( remove <= 1 )2700 jQuery.event.remove( this, namespaces[0], liveHandler );2701 }2702 }2703 }2704 }2705 };2706 2707 jQuery.Event = function( src ){2708 // Allow instantiation without the 'new' keyword2709 if( !this.preventDefault )2710 return new jQuery.Event(src);2711 2712 // Event object2713 if( src && src.type ){2714 this.originalEvent = src;2715 this.type = src.type;2716 this.timeStamp = src.timeStamp;2717 // Event type2718 }else2719 this.type = src;2720 2721 if( !this.timeStamp )2722 this.timeStamp = now();2723 2724 // Mark it as fixed2725 this[expando] = true;2726 };2727 2728 function returnFalse(){2729 return false;2730 }2731 function returnTrue(){2732 return true;2733 }2734 2735 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding2736 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html2737 jQuery.Event.prototype = {2738 preventDefault: function() {2739 this.isDefaultPrevented = returnTrue;2740 2741 var e = this.originalEvent;2742 if( !e )2743 return;2744 // if preventDefault exists run it on the original event2745 if (e.preventDefault)2746 e.preventDefault();2747 // otherwise set the returnValue property of the original event to false (IE)2748 e.returnValue = false;2749 },2750 stopPropagation: function() {2751 this.isPropagationStopped = returnTrue;2752 2753 var e = this.originalEvent;2754 if( !e )2755 return;2756 // if stopPropagation exists run it on the original event2757 if (e.stopPropagation)2758 e.stopPropagation();2759 // otherwise set the cancelBubble property of the original event to true (IE)2760 e.cancelBubble = true;2761 },2762 stopImmediatePropagation:function(){2763 this.isImmediatePropagationStopped = returnTrue;2764 this.stopPropagation();2765 },2766 isDefaultPrevented: returnFalse,2767 isPropagationStopped: returnFalse,2768 isImmediatePropagationStopped: returnFalse2769 };2770 // Checks if an event happened on an element within another element2771 // Used in jQuery.event.special.mouseenter and mouseleave handlers2772 var withinElement = function(event) {2773 // Check if mouse(over|out) are still within the same parent element2774 var parent = event.relatedTarget;2775 // Traverse up the tree2776 while ( parent && parent != this )2777 try { parent = parent.parentNode; }2778 catch(e) { parent = this; }2779 2780 if( parent != this ){2781 // set the correct event type2782 event.type = event.data;2783 // handle event if we actually just moused on to a non sub-element2784 jQuery.event.handle.apply( this, arguments );2785 }2786 };2787 2788 jQuery.each({2789 mouseover: 'mouseenter',2790 mouseout: 'mouseleave'2791 }, function( orig, fix ){2792 jQuery.event.special[ fix ] = {2793 setup: function(){2794 jQuery.event.add( this, orig, withinElement, fix );2795 },2796 teardown: function(){2797 jQuery.event.remove( this, orig, withinElement );2798 }2799 };2800 });2801 2802 jQuery.fn.extend({2803 bind: function( type, data, fn ) {2804 return type == "unload" ? this.one(type, data, fn) : this.each(function(){2805 jQuery.event.add( this, type, fn || data, fn && data );2806 });2807 },2808 2809 one: function( type, data, fn ) {2810 var one = jQuery.event.proxy( fn || data, function(event) {2811 jQuery(this).unbind(event, one);2812 return (fn || data).apply( this, arguments );2813 });2814 return this.each(function(){2815 jQuery.event.add( this, type, one, fn && data);2816 });2817 },2818 2819 unbind: function( type, fn ) {2820 return this.each(function(){2821 jQuery.event.remove( this, type, fn );2822 });2823 },2824 2825 trigger: function( type, data ) {2826 return this.each(function(){2827 jQuery.event.trigger( type, data, this );2828 });2829 },2830 2831 triggerHandler: function( type, data ) {2832 if( this[0] ){2833 var event = jQuery.Event(type);2834 event.preventDefault();2835 event.stopPropagation();2836 jQuery.event.trigger( event, data, this[0] );2837 return event.result;2838 }2839 },2840 2841 toggle: function( fn ) {2842 // Save reference to arguments for access in closure2843 var args = arguments, i = 1;2844 2845 // link all the functions, so any of them can unbind this click handler2846 while( i < args.length )2847 jQuery.event.proxy( fn, args[i++] );2848 2849 return this.click( jQuery.event.proxy( fn, function(event) {2850 // Figure out which function to execute2851 this.lastToggle = ( this.lastToggle || 0 ) % i;2852 2853 // Make sure that clicks stop2854 event.preventDefault();2855 2856 // and execute the function2857 return args[ this.lastToggle++ ].apply( this, arguments ) || false;2858 }));2859 },2860 2861 hover: function(fnOver, fnOut) {2862 return this.mouseenter(fnOver).mouseleave(fnOut);2863 },2864 2865 ready: function(fn) {2866 // Attach the listeners2867 bindReady();2868 2869 // If the DOM is already ready2870 if ( jQuery.isReady )2871 // Execute the function immediately2872 fn.call( document, jQuery );2873 2874 // Otherwise, remember the function for later2875 else2876 // Add the function to the wait list2877 jQuery.readyList.push( fn );2878 2879 return this;2880 },2881 2882 live: function( type, fn ){2883 jQuery(document).bind( liveConvert(type, this.selector), this.selector, fn );2884 return this;2885 },2886 2887 die: function( type, fn ){2888 jQuery(document).unbind( liveConvert(type, this.selector), fn );2889 return this;2890 }2891 });2892 2893 function liveHandler( event ){2894 var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),2895 stop = true;2896 2897 jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){2898 if ( !event.isImmediatePropagationStopped() && check.test(fn.type) ) {2899 var elem = jQuery(event.target).closest(fn.data)[0];2900 if ( elem && fn.call(elem, event, fn.data) === false )2901 stop = false;2902 }2903 });2904 return stop;2905 }2906 2907 function liveConvert(type, selector){2908 return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");2909 }2910 2911 jQuery.extend({2912 isReady: false,2913 readyList: [],2914 // Handle when the DOM is ready2915 ready: function() {2916 // Make sure that the DOM is not already loaded2917 if ( !jQuery.isReady ) {2918 // Remember that the DOM is ready2919 jQuery.isReady = true;2920 2921 // If there are functions bound, to execute2922 if ( jQuery.readyList ) {2923 // Execute all of them2924 jQuery.each( jQuery.readyList, function(){2925 this.call( document, jQuery );2926 });2927 2928 // Reset the list of functions2929 jQuery.readyList = null;2930 }2931 2932 // Trigger any bound ready events2933 jQuery(document).triggerHandler("ready");2934 }2935 }2936 });2937 2938 var readyBound = false;2939 2940 function bindReady(){2941 if ( readyBound ) return;2942 readyBound = true;2943 2944 // Mozilla, Opera and webkit nightlies currently support this event2945 if ( document.addEventListener ) {2946 // Use the handy event callback2947 document.addEventListener( "DOMContentLoaded", function(){2948 document.removeEventListener( "DOMContentLoaded", arguments.callee, false );2949 jQuery.ready();2950 }, false );2951 2952 // If IE event model is used2953 } else if ( document.attachEvent ) {2954 // ensure firing before onload,2955 // maybe late but safe also for iframes2956 document.attachEvent("onreadystatechange", function(){2957 if ( document.readyState === "complete" ) {2958 document.detachEvent( "onreadystatechange", arguments.callee );2959 jQuery.ready();2960 }2961 });2962 2963 // If IE and not an iframe2964 // continually check to see if the document is ready2965 if ( document.documentElement.doScroll && !window.frameElement ) (function(){2966 if ( jQuery.isReady ) return;2967 2968 try {2969 // If IE is used, use the trick by Diego Perini2970 // http://javascript.nwbox.com/IEContentLoaded/2971 document.documentElement.doScroll("left");2972 } catch( error ) {2973 setTimeout( arguments.callee, 0 );2974 return;2975 }2976 2977 // and execute any waiting functions2978 jQuery.ready();2979 })();2980 }2981 2982 // A fallback to window.onload, that will always work2983 jQuery.event.add( window, "load", jQuery.ready );2984 }2985 2986 jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +2987 "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +2988 "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){2989 2990 // Handle event binding2991 jQuery.fn[name] = function(fn){2992 return fn ? this.bind(name, fn) : this.trigger(name);2993 };2994 });2995 2996 // Prevent memory leaks in IE2997 // And prevent errors on refresh with events like mouseover in other browsers2998 // Window isn't included so as not to unbind existing unload events2999 jQuery( window ).bind( 'unload', function(){3000 for ( var id in jQuery.cache )3001 // Skip the window3002 if ( id != 1 && jQuery.cache[ id ].handle )3003 jQuery.event.remove( jQuery.cache[ id ].handle.elem );3004 });3005 3083 jQuery.fn.extend({ 3006 3084 // Keep a copy of the old load
Note: See TracChangeset
for help on using the changeset viewer.