summaryrefslogtreecommitdiff
path: root/resources/jquery
diff options
context:
space:
mode:
Diffstat (limited to 'resources/jquery')
-rw-r--r--resources/jquery/images/jquery.arrowSteps.divider-ltr.pngbin126 -> 0 bytes
-rw-r--r--resources/jquery/images/jquery.arrowSteps.divider-rtl.pngbin127 -> 0 bytes
-rw-r--r--resources/jquery/images/jquery.arrowSteps.head-ltr.pngbin303 -> 0 bytes
-rw-r--r--resources/jquery/images/jquery.arrowSteps.head-rtl.pngbin311 -> 0 bytes
-rw-r--r--resources/jquery/images/jquery.arrowSteps.tail-ltr.pngbin222 -> 0 bytes
-rw-r--r--resources/jquery/images/jquery.arrowSteps.tail-rtl.pngbin219 -> 0 bytes
-rw-r--r--resources/jquery/images/marker.pngbin472 -> 0 bytes
-rw-r--r--resources/jquery/images/mask.pngbin1795 -> 0 bytes
-rw-r--r--resources/jquery/images/sort_both.gifbin1184 -> 0 bytes
-rw-r--r--resources/jquery/images/sort_down.gifbin1174 -> 0 bytes
-rw-r--r--resources/jquery/images/sort_none.gifbin462 -> 0 bytes
-rw-r--r--resources/jquery/images/sort_up.gifbin1174 -> 0 bytes
-rw-r--r--resources/jquery/images/spinner-large.gifbin1788 -> 0 bytes
-rw-r--r--resources/jquery/images/spinner.gifbin1819 -> 0 bytes
-rw-r--r--resources/jquery/images/wheel.pngbin11505 -> 0 bytes
-rw-r--r--resources/jquery/jquery.appear.js138
-rw-r--r--resources/jquery/jquery.arrowSteps.css45
-rw-r--r--resources/jquery/jquery.arrowSteps.js82
-rw-r--r--resources/jquery/jquery.async.js69
-rw-r--r--resources/jquery/jquery.autoEllipsis.js149
-rw-r--r--resources/jquery/jquery.badge.css37
-rw-r--r--resources/jquery/jquery.badge.js76
-rw-r--r--resources/jquery/jquery.byteLength.js31
-rw-r--r--resources/jquery/jquery.byteLimit.js233
-rw-r--r--resources/jquery/jquery.checkboxShiftClick.js35
-rw-r--r--resources/jquery/jquery.client.js263
-rw-r--r--resources/jquery/jquery.color.js54
-rw-r--r--resources/jquery/jquery.colorUtil.js219
-rw-r--r--resources/jquery/jquery.cookie.js47
-rw-r--r--resources/jquery/jquery.cycle.all.js1529
-rw-r--r--resources/jquery/jquery.delayedBind.js76
-rw-r--r--resources/jquery/jquery.expandableField.js137
-rw-r--r--resources/jquery/jquery.farbtastic.css54
-rw-r--r--resources/jquery/jquery.farbtastic.js286
-rw-r--r--resources/jquery/jquery.footHovzer.css6
-rw-r--r--resources/jquery/jquery.footHovzer.js45
-rw-r--r--resources/jquery/jquery.form.js1089
-rw-r--r--resources/jquery/jquery.getAttrs.js24
-rw-r--r--resources/jquery/jquery.hidpi.js117
-rw-r--r--resources/jquery/jquery.highlightText.js69
-rw-r--r--resources/jquery/jquery.hoverIntent.js111
-rw-r--r--resources/jquery/jquery.jStorage.js1143
-rw-r--r--resources/jquery/jquery.js9472
-rw-r--r--resources/jquery/jquery.json.js199
-rw-r--r--resources/jquery/jquery.localize.js170
-rw-r--r--resources/jquery/jquery.makeCollapsible.css14
-rw-r--r--resources/jquery/jquery.makeCollapsible.js381
-rw-r--r--resources/jquery/jquery.mockjax.js382
-rw-r--r--resources/jquery/jquery.mw-jump.js15
-rw-r--r--resources/jquery/jquery.mwExtension.js122
-rw-r--r--resources/jquery/jquery.placeholder.js94
-rw-r--r--resources/jquery/jquery.qunit.completenessTest.js360
-rw-r--r--resources/jquery/jquery.qunit.css244
-rw-r--r--resources/jquery/jquery.qunit.js2152
-rw-r--r--resources/jquery/jquery.spinner.css40
-rw-r--r--resources/jquery/jquery.spinner.js108
-rw-r--r--resources/jquery/jquery.suggestions.css77
-rw-r--r--resources/jquery/jquery.suggestions.js631
-rw-r--r--resources/jquery/jquery.tabIndex.js52
-rw-r--r--resources/jquery/jquery.tablesorter.css17
-rw-r--r--resources/jquery/jquery.tablesorter.js1113
-rw-r--r--resources/jquery/jquery.textSelection.js573
-rw-r--r--resources/jquery/jquery.validate.js1166
-rw-r--r--resources/jquery/jquery.xmldom.js46
64 files changed, 0 insertions, 23592 deletions
diff --git a/resources/jquery/images/jquery.arrowSteps.divider-ltr.png b/resources/jquery/images/jquery.arrowSteps.divider-ltr.png
deleted file mode 100644
index 84ed2a2d..00000000
--- a/resources/jquery/images/jquery.arrowSteps.divider-ltr.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/jquery.arrowSteps.divider-rtl.png b/resources/jquery/images/jquery.arrowSteps.divider-rtl.png
deleted file mode 100644
index 7cfbfeba..00000000
--- a/resources/jquery/images/jquery.arrowSteps.divider-rtl.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/jquery.arrowSteps.head-ltr.png b/resources/jquery/images/jquery.arrowSteps.head-ltr.png
deleted file mode 100644
index eb070280..00000000
--- a/resources/jquery/images/jquery.arrowSteps.head-ltr.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/jquery.arrowSteps.head-rtl.png b/resources/jquery/images/jquery.arrowSteps.head-rtl.png
deleted file mode 100644
index 7ea2fdb5..00000000
--- a/resources/jquery/images/jquery.arrowSteps.head-rtl.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/jquery.arrowSteps.tail-ltr.png b/resources/jquery/images/jquery.arrowSteps.tail-ltr.png
deleted file mode 100644
index 3ad990b6..00000000
--- a/resources/jquery/images/jquery.arrowSteps.tail-ltr.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/jquery.arrowSteps.tail-rtl.png b/resources/jquery/images/jquery.arrowSteps.tail-rtl.png
deleted file mode 100644
index 1d3048ef..00000000
--- a/resources/jquery/images/jquery.arrowSteps.tail-rtl.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/marker.png b/resources/jquery/images/marker.png
deleted file mode 100644
index 19efb6ce..00000000
--- a/resources/jquery/images/marker.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/mask.png b/resources/jquery/images/mask.png
deleted file mode 100644
index fe08de0e..00000000
--- a/resources/jquery/images/mask.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/sort_both.gif b/resources/jquery/images/sort_both.gif
deleted file mode 100644
index 50ad15a0..00000000
--- a/resources/jquery/images/sort_both.gif
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/sort_down.gif b/resources/jquery/images/sort_down.gif
deleted file mode 100644
index ec4f41b0..00000000
--- a/resources/jquery/images/sort_down.gif
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/sort_none.gif b/resources/jquery/images/sort_none.gif
deleted file mode 100644
index edd07e58..00000000
--- a/resources/jquery/images/sort_none.gif
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/sort_up.gif b/resources/jquery/images/sort_up.gif
deleted file mode 100644
index 80189185..00000000
--- a/resources/jquery/images/sort_up.gif
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/spinner-large.gif b/resources/jquery/images/spinner-large.gif
deleted file mode 100644
index 72203fdd..00000000
--- a/resources/jquery/images/spinner-large.gif
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/spinner.gif b/resources/jquery/images/spinner.gif
deleted file mode 100644
index 6146be4e..00000000
--- a/resources/jquery/images/spinner.gif
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/images/wheel.png b/resources/jquery/images/wheel.png
deleted file mode 100644
index 7e53103e..00000000
--- a/resources/jquery/images/wheel.png
+++ /dev/null
Binary files differ
diff --git a/resources/jquery/jquery.appear.js b/resources/jquery/jquery.appear.js
deleted file mode 100644
index 4f77886c..00000000
--- a/resources/jquery/jquery.appear.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * jQuery.appear
- * http://code.google.com/p/jquery-appear/
- *
- * Copyright (c) 2009 Michael Hixson
- * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-*/
-(function($) {
-
- $.fn.appear = function(fn, options) {
-
- var settings = $.extend({
-
- //arbitrary data to pass to fn
- data: undefined,
-
- //call fn only on the first appear?
- one: true
-
- }, options);
-
- return this.each(function() {
-
- var t = $(this);
-
- //whether the element is currently visible
- t.appeared = false;
-
- if (!fn) {
-
- //trigger the custom event
- t.trigger('appear', settings.data);
- return;
- }
-
- var w = $(window);
-
- //fires the appear event when appropriate
- var check = function() {
-
- //is the element hidden?
- if (!t.is(':visible')) {
-
- //it became hidden
- t.appeared = false;
- return;
- }
-
- //is the element inside the visible window?
- var a = w.scrollLeft();
- var b = w.scrollTop();
- var o = t.offset();
- var x = o.left;
- var y = o.top;
-
- if (y + t.height() >= b &&
- y <= b + w.height() &&
- x + t.width() >= a &&
- x <= a + w.width()) {
-
- //trigger the custom event
- if (!t.appeared) t.trigger('appear', settings.data);
-
- } else {
-
- //it scrolled out of view
- t.appeared = false;
- }
- };
-
- //create a modified fn with some additional logic
- var modifiedFn = function() {
-
- //mark the element as visible
- t.appeared = true;
-
- //is this supposed to happen only once?
- if (settings.one) {
-
- //remove the check
- w.unbind('scroll', check);
- var i = $.inArray(check, $.fn.appear.checks);
- if (i >= 0) $.fn.appear.checks.splice(i, 1);
- }
-
- //trigger the original fn
- fn.apply(this, arguments);
- };
-
- //bind the modified fn to the element
- if (settings.one) t.one('appear', settings.data, modifiedFn);
- else t.bind('appear', settings.data, modifiedFn);
-
- //check whenever the window scrolls
- w.scroll(check);
-
- //check whenever the dom changes
- $.fn.appear.checks.push(check);
-
- //check now
- (check)();
- });
- };
-
- //keep a queue of appearance checks
- $.extend($.fn.appear, {
-
- checks: [],
- timeout: null,
-
- //process the queue
- checkAll: function() {
- var length = $.fn.appear.checks.length;
- if (length > 0) while (length--) ($.fn.appear.checks[length])();
- },
-
- //check the queue asynchronously
- run: function() {
- if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
- $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
- }
- });
-
- //run checks when these methods are called
- $.each(['append', 'prepend', 'after', 'before', 'attr',
- 'removeAttr', 'addClass', 'removeClass', 'toggleClass',
- 'remove', 'css', 'show', 'hide'], function(i, n) {
- var old = $.fn[n];
- if (old) {
- $.fn[n] = function() {
- var r = old.apply(this, arguments);
- $.fn.appear.run();
- return r;
- }
- }
- });
-
-})(jQuery); \ No newline at end of file
diff --git a/resources/jquery/jquery.arrowSteps.css b/resources/jquery/jquery.arrowSteps.css
deleted file mode 100644
index f8f6e951..00000000
--- a/resources/jquery/jquery.arrowSteps.css
+++ /dev/null
@@ -1,45 +0,0 @@
-.arrowSteps {
- list-style-type: none;
- list-style-image: none;
- border: 1px solid #666666;
- position: relative;
-}
-
-.arrowSteps li {
- float: left;
- padding: 0px;
- margin: 0px;
- border: 0 none;
-}
-
-.arrowSteps li div {
- padding: 0.5em;
- text-align: center;
- white-space: nowrap;
- overflow: hidden;
-}
-
-.arrowSteps li.arrow div {
- /* @embed */
- background: url(images/jquery.arrowSteps.divider-ltr.png) no-repeat right center;
-}
-
-/* applied to the element preceding the highlighted step */
-.arrowSteps li.arrow.tail div {
- /* @embed */
- background: url(images/jquery.arrowSteps.tail-ltr.png) no-repeat right center;
-}
-
-/* this applies to all highlighted, including the last */
-.arrowSteps li.head div {
- /* @embed */
- background: url(images/jquery.arrowSteps.head-ltr.png) no-repeat left center;
- font-weight: bold;
-}
-
-/* this applies to all highlighted arrows except the last */
-.arrowSteps li.arrow.head div {
- /* TODO: eliminate duplication of jquery.arrowSteps.head.png embedding */
- /* @embed */
- background: url(images/jquery.arrowSteps.head-ltr.png) no-repeat right center;
-}
diff --git a/resources/jquery/jquery.arrowSteps.js b/resources/jquery/jquery.arrowSteps.js
deleted file mode 100644
index a1fd679d..00000000
--- a/resources/jquery/jquery.arrowSteps.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * jQuery arrowSteps plugin
- * Copyright Neil Kandalgaonkar, 2010
- *
- * This work is licensed under the terms of the GNU General Public License,
- * version 2 or later.
- * (see http://www.fsf.org/licensing/licenses/gpl.html).
- * Derivative works and later versions of the code must be free software
- * licensed under the same or a compatible license.
- *
- *
- * DESCRIPTION
- *
- * Show users their progress through a series of steps, via a row of items that fit
- * together like arrows. One item can be highlighted at a time.
- *
- *
- * SYNOPSIS
- *
- * <ul id="robin-hood-daffy">
- * <li id="guard"><div>Guard!</div></li>
- * <li id="turn"><div>Turn!</div></li>
- * <li id="parry"><div>Parry!</div></li>
- * <li id="dodge"><div>Dodge!</div></li>
- * <li id="spin"><div>Spin!</div></li>
- * <li id="ha"><div>Ha!</div></li>
- * <li id="thrust"><div>Thrust!</div></li>
- * </ul>
- *
- * <script>
- * $( '#robin-hood-daffy' ).arrowSteps();
- *
- * $( '#robin-hood-daffy' ).arrowStepsHighlight( '#guard' );
- * // 'Guard!' is highlighted.
- *
- * // ... user completes the 'guard' step ...
- *
- * $( '#robin-hood-daffy' ).arrowStepsHighlight( '#turn' );
- * // 'Turn!' is highlighted.
- * </script>
- *
- */
-( function ( $ ) {
- $.fn.arrowSteps = function () {
- var $steps, width, arrowWidth,
- paddingSide = $( 'body' ).hasClass( 'rtl' ) ? 'padding-left' : 'padding-right';
-
- this.addClass( 'arrowSteps' );
- $steps = this.find( 'li' );
-
- width = parseInt( 100 / $steps.length, 10 );
- $steps.css( 'width', width + '%' );
-
- // Every step except the last one has an arrow pointing forward:
- // at the right hand side in LTR languages, and at the left hand side in RTL.
- // Also add in the padding for the calculated arrow width.
- arrowWidth = parseInt( this.outerHeight(), 10 );
- $steps.filter( ':not(:last-child)' ).addClass( 'arrow' )
- .find( 'div' ).css( paddingSide, arrowWidth.toString() + 'px' );
-
- this.data( 'arrowSteps', $steps );
- return this;
- };
-
- $.fn.arrowStepsHighlight = function ( selector ) {
- var $previous,
- $steps = this.data( 'arrowSteps' );
- $.each( $steps, function ( i, step ) {
- var $step = $( step );
- if ( $step.is( selector ) ) {
- if ($previous) {
- $previous.addClass( 'tail' );
- }
- $step.addClass( 'head' );
- } else {
- $step.removeClass( 'head tail lasthead' );
- }
- $previous = $step;
- } );
- };
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.async.js b/resources/jquery/jquery.async.js
deleted file mode 100644
index 2161f6b9..00000000
--- a/resources/jquery/jquery.async.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * jQuery Asynchronous Plugin 1.0
- *
- * Copyright (c) 2008 Vincent Robert (genezys.net)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- */
-(function($){
-
-// opts.delay : (default 10) delay between async call in ms
-// opts.bulk : (default 500) delay during which the loop can continue synchronously without yielding the CPU
-// opts.test : (default true) function to test in the while test part
-// opts.loop : (default empty) function to call in the while loop part
-// opts.end : (default empty) function to call at the end of the while loop
-$.whileAsync = function(opts) {
- var delay = Math.abs(opts.delay) || 10,
- bulk = isNaN(opts.bulk) ? 500 : Math.abs(opts.bulk),
- test = opts.test || function(){ return true; },
- loop = opts.loop || function(){},
- end = opts.end || function(){};
-
- (function(){
-
- var t = false,
- begin = new Date();
-
- while( t = test() ) {
- loop();
- if( bulk === 0 || (new Date() - begin) > bulk ) {
- break;
- }
- }
- if( t ) {
- setTimeout(arguments.callee, delay);
- }
- else {
- end();
- }
-
- })();
-};
-
-// opts.delay : (default 10) delay between async call in ms
-// opts.bulk : (default 500) delay during which the loop can continue synchronously without yielding the CPU
-// opts.loop : (default empty) function to call in the each loop part, signature: function(index, value) this = value
-// opts.end : (default empty) function to call at the end of the each loop
-$.eachAsync = function(array, opts) {
- var i = 0,
- l = array.length,
- loop = opts.loop || function(){};
-
- $.whileAsync(
- $.extend(opts, {
- test: function() { return i < l; },
- loop: function() {
- var val = array[i];
- return loop.call(val, i++, val);
- }
- })
- );
-};
-
-$.fn.eachAsync = function(opts) {
- $.eachAsync(this, opts);
- return this;
-}
-
-})(jQuery); \ No newline at end of file
diff --git a/resources/jquery/jquery.autoEllipsis.js b/resources/jquery/jquery.autoEllipsis.js
deleted file mode 100644
index 49a932a1..00000000
--- a/resources/jquery/jquery.autoEllipsis.js
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Plugin that automatically truncates the plain text contents of an element
- * and adds an ellipsis.
- */
-( function ( $ ) {
-
-var
- // Cache ellipsed substrings for every string-width-position combination
- cache = {},
-
- // Use a separate cache when match highlighting is enabled
- matchTextCache = {};
-
-$.fn.autoEllipsis = function ( options ) {
- options = $.extend( {
- position: 'center',
- tooltip: false,
- restoreText: false,
- hasSpan: false,
- matchText: null
- }, options );
-
- return this.each( function () {
- var $trimmableText,
- text, trimmableText, w, pw,
- l, r, i, side, m,
- // container element - used for measuring against
- $container = $(this);
-
- if ( options.restoreText ) {
- if ( !$container.data( 'autoEllipsis.originalText' ) ) {
- $container.data( 'autoEllipsis.originalText', $container.text() );
- } else {
- $container.text( $container.data( 'autoEllipsis.originalText' ) );
- }
- }
-
- // trimmable text element - only the text within this element will be trimmed
- if ( options.hasSpan ) {
- $trimmableText = $container.children( options.selector );
- } else {
- $trimmableText = $( '<span>' )
- .css( 'whiteSpace', 'nowrap' )
- .text( $container.text() );
- $container
- .empty()
- .append( $trimmableText );
- }
-
- text = $container.text();
- trimmableText = $trimmableText.text();
- w = $container.width();
- pw = 0;
-
- // Try cache
- if ( options.matchText ) {
- if ( !( text in matchTextCache ) ) {
- matchTextCache[text] = {};
- }
- if ( !( options.matchText in matchTextCache[text] ) ) {
- matchTextCache[text][options.matchText] = {};
- }
- if ( !( w in matchTextCache[text][options.matchText] ) ) {
- matchTextCache[text][options.matchText][w] = {};
- }
- if ( options.position in matchTextCache[text][options.matchText][w] ) {
- $container.html( matchTextCache[text][options.matchText][w][options.position] );
- if ( options.tooltip ) {
- $container.attr( 'title', text );
- }
- return;
- }
- } else {
- if ( !( text in cache ) ) {
- cache[text] = {};
- }
- if ( !( w in cache[text] ) ) {
- cache[text][w] = {};
- }
- if ( options.position in cache[text][w] ) {
- $container.html( cache[text][w][options.position] );
- if ( options.tooltip ) {
- $container.attr( 'title', text );
- }
- return;
- }
- }
-
- if ( $trimmableText.width() + pw > w ) {
- switch ( options.position ) {
- case 'right':
- // Use binary search-like technique for efficiency
- l = 0;
- r = trimmableText.length;
- do {
- m = Math.ceil( ( l + r ) / 2 );
- $trimmableText.text( trimmableText.substr( 0, m ) + '...' );
- if ( $trimmableText.width() + pw > w ) {
- // Text is too long
- r = m - 1;
- } else {
- l = m;
- }
- } while ( l < r );
- $trimmableText.text( trimmableText.substr( 0, l ) + '...' );
- break;
- case 'center':
- // TODO: Use binary search like for 'right'
- i = [Math.round( trimmableText.length / 2 ), Math.round( trimmableText.length / 2 )];
- // Begin with making the end shorter
- side = 1;
- while ( $trimmableText.outerWidth() + pw > w && i[0] > 0 ) {
- $trimmableText.text( trimmableText.substr( 0, i[0] ) + '...' + trimmableText.substr( i[1] ) );
- // Alternate between trimming the end and begining
- if ( side === 0 ) {
- // Make the begining shorter
- i[0]--;
- side = 1;
- } else {
- // Make the end shorter
- i[1]++;
- side = 0;
- }
- }
- break;
- case 'left':
- // TODO: Use binary search like for 'right'
- r = 0;
- while ( $trimmableText.outerWidth() + pw > w && r < trimmableText.length ) {
- $trimmableText.text( '...' + trimmableText.substr( r ) );
- r++;
- }
- break;
- }
- }
- if ( options.tooltip ) {
- $container.attr( 'title', text );
- }
- if ( options.matchText ) {
- $container.highlightText( options.matchText );
- matchTextCache[text][options.matchText][w][options.position] = $container.html();
- } else {
- cache[text][w][options.position] = $container.html();
- }
-
- } );
-};
-
-}( jQuery ) ); \ No newline at end of file
diff --git a/resources/jquery/jquery.badge.css b/resources/jquery/jquery.badge.css
deleted file mode 100644
index f313663e..00000000
--- a/resources/jquery/jquery.badge.css
+++ /dev/null
@@ -1,37 +0,0 @@
-.mw-badge {
- min-width: 7px;
- border-radius: 2px;
- padding: 1px 4px;
- text-align: center;
- font-size: 12px;
- line-height: 12px;
- background-color: #d2d2d2;
- cursor: pointer;
-}
-
-.mw-badge-content {
- font-weight: bold;
- color: white;
- vertical-align: baseline;
- text-shadow: 0 1px rgba(0, 0, 0, 0.4);
-}
-
-.mw-badge-inline {
- margin-left: 3px;
- display: inline-block;
- /* Hack for IE6 and IE7 (bug 47926) */
- zoom: 1;
- *display: inline;
-
-}
-.mw-badge-overlay {
- position: absolute;
- bottom: -1px;
- right: -3px;
- z-index: 50;
-}
-
-.mw-badge-important {
- background-color: #cc0000;
-}
-
diff --git a/resources/jquery/jquery.badge.js b/resources/jquery/jquery.badge.js
deleted file mode 100644
index 9404e818..00000000
--- a/resources/jquery/jquery.badge.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * jQuery Badge plugin
- *
- * @license MIT
- */
-
-/**
- * @author Ryan Kaldari <rkaldari@wikimedia.org>, 2012
- * @author Andrew Garrett <agarrett@wikimedia.org>, 2012
- * @author Marius Hoch <hoo@online.de>, 2012
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * This program is distributed WITHOUT ANY WARRANTY.
- */
-( function ( $, mw ) {
- /**
- * Allows you to put a "badge" on an item on the page. The badge container
- * will be appended to the selected element(s).
- * See mediawiki.org/wiki/ResourceLoader/Default_modules#jQuery.badge
- *
- * @param {number|string} text The value to display in the badge. If the value is falsey (0,
- * null, false, '', etc.), any existing badge will be removed.
- * @param {boolean} inline True if the badge should be displayed inline, false
- * if the badge should overlay the parent element (default is inline)
- * @param {boolean} displayZero True if the number zero should be displayed,
- * false if the number zero should result in the badge being hidden
- * (default is zero will result in the badge being hidden)
- */
- $.fn.badge = function ( text, inline, displayZero ) {
- var $badge = this.find( '.mw-badge' ),
- badgeStyleClass = 'mw-badge-' + ( inline ? 'inline' : 'overlay' ),
- isImportant = true, displayBadge = true;
-
- // If we're displaying zero, ensure style to be non-important
- if ( mw.language.convertNumber( text, true ) === 0 ) {
- isImportant = false;
- if ( !displayZero ) {
- displayBadge = false;
- }
- // If text is falsey (besides 0), hide the badge
- } else if ( !text ) {
- displayBadge = false;
- }
-
- if ( displayBadge ) {
- // If a badge already exists, reuse it
- if ( $badge.length ) {
- $badge
- .toggleClass( 'mw-badge-important', isImportant )
- .find( '.mw-badge-content' )
- .text( text );
- } else {
- // Otherwise, create a new badge with the specified text and style
- $badge = $( '<div class="mw-badge"></div>' )
- .addClass( badgeStyleClass )
- .toggleClass( 'mw-badge-important', isImportant )
- .append(
- $( '<span class="mw-badge-content"></span>' ).text( text )
- )
- .appendTo( this );
- }
- } else {
- $badge.remove();
- }
- return this;
- };
-}( jQuery, mediaWiki ) );
diff --git a/resources/jquery/jquery.byteLength.js b/resources/jquery/jquery.byteLength.js
deleted file mode 100644
index 398937e6..00000000
--- a/resources/jquery/jquery.byteLength.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * jQuery.byteLength
- *
- * Calculate the byte length of a string (accounting for UTF-8).
- *
- * @author Jan Paul Posma, 2011
- * @author Timo Tijhof, 2012
- * @author David Chan, 2013
- */
-jQuery.byteLength = function ( str ) {
-
- // This basically figures out how many bytes a UTF-16 string (which is what js sees)
- // will take in UTF-8 by replacing a 2 byte character with 2 *'s, etc, and counting that.
- // Note, surrogate (\uD800-\uDFFF) characters are counted as 2 bytes, since there's two of them
- // and the actual character takes 4 bytes in UTF-8 (2*2=4). Might not work perfectly in
- // edge cases such as illegal sequences, but that should never happen.
-
- // https://en.wikipedia.org/wiki/UTF-8#Description
- // The mapping from UTF-16 code units to UTF-8 bytes is as follows:
- // > Range 0000-007F: codepoints that become 1 byte of UTF-8
- // > Range 0080-07FF: codepoints that become 2 bytes of UTF-8
- // > Range 0800-D7FF: codepoints that become 3 bytes of UTF-8
- // > Range D800-DFFF: Surrogates (each pair becomes 4 bytes of UTF-8)
- // > Range E000-FFFF: codepoints that become 3 bytes of UTF-8 (continued)
-
- return str
- .replace( /[\u0080-\u07FF\uD800-\uDFFF]/g, '**' )
- .replace( /[\u0800-\uD7FF\uE000-\uFFFF]/g, '***' )
- .length;
-
-};
diff --git a/resources/jquery/jquery.byteLimit.js b/resources/jquery/jquery.byteLimit.js
deleted file mode 100644
index a8c0b065..00000000
--- a/resources/jquery/jquery.byteLimit.js
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * jQuery byteLimit plugin.
- *
- * @author Jan Paul Posma, 2011
- * @author Timo Tijhof, 2011-2012
- */
-( function ( $ ) {
-
- /**
- * Utility function to trim down a string, based on byteLimit
- * and given a safe start position. It supports insertion anywhere
- * in the string, so "foo" to "fobaro" if limit is 4 will result in
- * "fobo", not "foba". Basically emulating the native maxlength by
- * reconstructing where the insertion occured.
- *
- * @param {string} safeVal Known value that was previously returned by this
- * function, if none, pass empty string.
- * @param {string} newVal New value that may have to be trimmed down.
- * @param {number} byteLimit Number of bytes the value may be in size.
- * @param {Function} fn [optional] See $.fn.byteLimit.
- * @return {Object} Object with:
- * - {string} newVal
- * - {boolean} trimmed
- */
- function trimValForByteLength( safeVal, newVal, byteLimit, fn ) {
- var startMatches, endMatches, matchesLen, inpParts,
- oldVal = safeVal;
-
- // Run the hook if one was provided, but only on the length
- // assessment. The value itself is not to be affected by the hook.
- if ( $.byteLength( fn ? fn( newVal ) : newVal ) <= byteLimit ) {
- // Limit was not reached, just remember the new value
- // and let the user continue.
- return {
- newVal: newVal,
- trimmed: false
- };
- }
-
- // Current input is longer than the active limit.
- // Figure out what was added and limit the addition.
- startMatches = 0;
- endMatches = 0;
-
- // It is important that we keep the search within the range of
- // the shortest string's length.
- // Imagine a user adds text that matches the end of the old value
- // (e.g. "foo" -> "foofoo"). startMatches would be 3, but without
- // limiting both searches to the shortest length, endMatches would
- // also be 3.
- matchesLen = Math.min( newVal.length, oldVal.length );
-
- // Count same characters from the left, first.
- // (if "foo" -> "foofoo", assume addition was at the end).
- while (
- startMatches < matchesLen &&
- oldVal.charAt( startMatches ) === newVal.charAt( startMatches )
- ) {
- startMatches += 1;
- }
-
- while (
- endMatches < ( matchesLen - startMatches ) &&
- oldVal.charAt( oldVal.length - 1 - endMatches ) === newVal.charAt( newVal.length - 1 - endMatches )
- ) {
- endMatches += 1;
- }
-
- inpParts = [
- // Same start
- newVal.substring( 0, startMatches ),
- // Inserted content
- newVal.substring( startMatches, newVal.length - endMatches ),
- // Same end
- newVal.substring( newVal.length - endMatches )
- ];
-
- // Chop off characters from the end of the "inserted content" string
- // until the limit is statisfied.
- if ( fn ) {
- // stop, when there is nothing to slice - bug 41450
- while ( $.byteLength( fn( inpParts.join( '' ) ) ) > byteLimit && inpParts[1].length > 0 ) {
- inpParts[1] = inpParts[1].slice( 0, -1 );
- }
- } else {
- while ( $.byteLength( inpParts.join( '' ) ) > byteLimit ) {
- inpParts[1] = inpParts[1].slice( 0, -1 );
- }
- }
-
- newVal = inpParts.join( '' );
-
- return {
- newVal: newVal,
- trimmed: true
- };
- }
-
- var eventKeys = [
- 'keyup.byteLimit',
- 'keydown.byteLimit',
- 'change.byteLimit',
- 'mouseup.byteLimit',
- 'cut.byteLimit',
- 'paste.byteLimit',
- 'focus.byteLimit',
- 'blur.byteLimit'
- ].join( ' ' );
-
- /**
- * Enforces a byte limit on an input field, so that UTF-8 entries are counted as well,
- * when, for example, a database field has a byte limit rather than a character limit.
- * Plugin rationale: Browser has native maxlength for number of characters, this plugin
- * exists to limit number of bytes instead.
- *
- * Can be called with a custom limit (to use that limit instead of the maxlength attribute
- * value), a filter function (in case the limit should apply to something other than the
- * exact input value), or both. Order of parameters is important!
- *
- * @context {jQuery} Instance of jQuery for one or more input elements
- * @param {Number} limit [optional] Limit to enforce, fallsback to maxLength-attribute,
- * called with fetched value as argument.
- * @param {Function} fn [optional] Function to call on the string before assessing the length.
- * @return {jQuery} The context
- */
- $.fn.byteLimit = function ( limit, fn ) {
- // If the first argument is the function,
- // set fn to the first argument's value and ignore the second argument.
- if ( $.isFunction( limit ) ) {
- fn = limit;
- limit = undefined;
- // Either way, verify it is a function so we don't have to call
- // isFunction again after this.
- } else if ( !fn || !$.isFunction( fn ) ) {
- fn = undefined;
- }
-
- // The following is specific to each element in the collection.
- return this.each( function ( i, el ) {
- var $el, elLimit, prevSafeVal;
-
- $el = $( el );
-
- // If no limit was passed to byteLimit(), use the maxlength value.
- // Can't re-use 'limit' variable because it's in the higher scope
- // that would affect the next each() iteration as well.
- // Note that we use attribute to read the value instead of property,
- // because in Chrome the maxLength property by default returns the
- // highest supported value (no indication that it is being enforced
- // by choice). We don't want to bind all of this for some ridiculously
- // high default number, unless it was explicitly set in the HTML.
- // Also cast to a (primitive) number (most commonly because the maxlength
- // attribute contains a string, but theoretically the limit parameter
- // could be something else as well).
- elLimit = Number( limit === undefined ? $el.attr( 'maxlength' ) : limit );
-
- // If there is no (valid) limit passed or found in the property,
- // skip this. The < 0 check is required for Firefox, which returns
- // -1 (instead of undefined) for maxLength if it is not set.
- if ( !elLimit || elLimit < 0 ) {
- return;
- }
-
- if ( fn ) {
- // Save function for reference
- $el.data( 'byteLimit.callback', fn );
- }
-
- // Remove old event handlers (if there are any)
- $el.off( '.byteLimit' );
-
- if ( fn ) {
- // Disable the native maxLength (if there is any), because it interferes
- // with the (differently calculated) byte limit.
- // Aside from being differently calculated (average chars with byteLimit
- // is lower), we also support a callback which can make it to allow longer
- // values (e.g. count "Foo" from "User:Foo").
- // maxLength is a strange property. Removing or setting the property to
- // undefined directly doesn't work. Instead, it can only be unset internally
- // by the browser when removing the associated attribute (Firefox/Chrome).
- // http://code.google.com/p/chromium/issues/detail?id=136004
- $el.removeAttr( 'maxlength' );
-
- } else {
- // If we don't have a callback the bytelimit can only be lower than the charlimit
- // (that is, there are no characters less than 1 byte in size). So lets (re-)enforce
- // the native limit for efficiency when possible (it will make the while-loop below
- // faster by there being less left to interate over).
- $el.attr( 'maxlength', elLimit );
- }
-
-
- // Safe base value, used to determine the path between the previous state
- // and the state that triggered the event handler below - and enforce the
- // limit approppiately (e.g. don't chop from the end if text was inserted
- // at the beginning of the string).
- prevSafeVal = '';
-
- // We need to listen to after the change has already happened because we've
- // learned that trying to guess the new value and canceling the event
- // accordingly doesn't work because the new value is not always as simple as:
- // oldValue + String.fromCharCode( e.which ); because of cut, paste, select-drag
- // replacements, and custom input methods and what not.
- // Even though we only trim input after it was changed (never prevent it), we do
- // listen on events that input text, because there are cases where the text has
- // changed while text is being entered and keyup/change will not be fired yet
- // (such as holding down a single key, fires keydown, and after each keydown,
- // we can trim the previous one).
- // See http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboard-event-order for
- // the order and characteristics of the key events.
- $el.on( eventKeys, function () {
- var res = trimValForByteLength(
- prevSafeVal,
- this.value,
- elLimit,
- fn
- );
-
- // Only set value property if it was trimmed, because whenever the
- // value property is set, the browser needs to re-initiate the text context,
- // which moves the cursor at the end the input, moving it away from wherever it was.
- // This is a side-effect of limiting after the fact.
- if ( res.trimmed === true ) {
- this.value = res.newVal;
- }
- // Always adjust prevSafeVal to reflect the input value. Not doing this could cause
- // trimValForByteLength to compare the new value to an empty string instead of the
- // old value, resulting in trimming always from the end (bug 40850).
- prevSafeVal = res.newVal;
- } );
- } );
- };
-}( jQuery ) );
diff --git a/resources/jquery/jquery.checkboxShiftClick.js b/resources/jquery/jquery.checkboxShiftClick.js
deleted file mode 100644
index b2065665..00000000
--- a/resources/jquery/jquery.checkboxShiftClick.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * jQuery checkboxShiftClick
- *
- * This will enable checkboxes to be checked or unchecked in a row by clicking one,
- * holding shift and clicking another one.
- *
- * @author Timo Tijhof, 2011 - 2012
- * @license GPL v2
- */
-( function ( $ ) {
- $.fn.checkboxShiftClick = function () {
- var prevCheckbox = null,
- $box = this;
- // When our boxes are clicked..
- $box.click( function ( e ) {
- // And one has been clicked before...
- if ( prevCheckbox !== null && e.shiftKey ) {
- // Check or uncheck this one and all in-between checkboxes,
- // except for disabled ones
- $box
- .slice(
- Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
- Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
- )
- .filter( function () {
- return !this.disabled;
- } )
- .prop( 'checked', !!e.target.checked );
- }
- // Either way, update the prevCheckbox variable to the one clicked now
- prevCheckbox = e.target;
- } );
- return $box;
- };
-}( jQuery ) );
diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js
deleted file mode 100644
index 5a95dc5b..00000000
--- a/resources/jquery/jquery.client.js
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
- * User-agent detection
- */
-( function ( $ ) {
-
- /* Private Members */
-
- /**
- * @var {Object} profileCache Keyed by userAgent string,
- * value is the parsed $.client.profile object for that user agent.
- */
- var profileCache = {};
-
- /* Public Methods */
-
- $.client = {
-
- /**
- * Get an object containing information about the client.
- *
- * @param {Object} nav An object with atleast a 'userAgent' and 'platform' key.
- * Defaults to the global Navigator object.
- * @returns {Object} The resulting client object will be in the following format:
- * {
- * 'name': 'firefox',
- * 'layout': 'gecko',
- * 'layoutVersion': 20101026,
- * 'platform': 'linux'
- * 'version': '3.5.1',
- * 'versionBase': '3',
- * 'versionNumber': 3.5,
- * }
- */
- profile: function ( nav ) {
- /*jshint boss: true */
-
- if ( nav === undefined ) {
- nav = window.navigator;
- }
- // Use the cached version if possible
- if ( profileCache[nav.userAgent] === undefined ) {
-
- var
- versionNumber,
-
- /* Configuration */
-
- // Name of browsers or layout engines we don't recognize
- uk = 'unknown',
- // Generic version digit
- x = 'x',
- // Strings found in user agent strings that need to be conformed
- wildUserAgents = ['Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3', 'Iceweasel'],
- // Translations for conforming user agent strings
- userAgentTranslations = [
- // Tons of browsers lie about being something they are not
- [/(Firefox|MSIE|KHTML,?\slike\sGecko|Konqueror)/, ''],
- // Chrome lives in the shadow of Safari still
- ['Chrome Safari', 'Chrome'],
- // KHTML is the layout engine not the browser - LIES!
- ['KHTML', 'Konqueror'],
- // Firefox nightly builds
- ['Minefield', 'Firefox'],
- // This helps keep different versions consistent
- ['Navigator', 'Netscape'],
- // This prevents version extraction issues, otherwise translation would happen later
- ['PLAYSTATION 3', 'PS3']
- ],
- // Strings which precede a version number in a user agent string - combined and used as
- // match 1 in version detection
- versionPrefixes = [
- 'camino', 'chrome', 'firefox', 'iceweasel', 'netscape', 'netscape6', 'opera', 'version', 'konqueror',
- 'lynx', 'msie', 'safari', 'ps3', 'android'
- ],
- // Used as matches 2, 3 and 4 in version extraction - 3 is used as actual version number
- versionSuffix = '(\\/|\\;?\\s|)([a-z0-9\\.\\+]*?)(\\;|dev|rel|\\)|\\s|$)',
- // Names of known browsers
- names = [
- 'camino', 'chrome', 'firefox', 'iceweasel', 'netscape', 'konqueror', 'lynx', 'msie', 'opera',
- 'safari', 'ipod', 'iphone', 'blackberry', 'ps3', 'rekonq', 'android'
- ],
- // Tanslations for conforming browser names
- nameTranslations = [],
- // Names of known layout engines
- layouts = ['gecko', 'konqueror', 'msie', 'trident', 'opera', 'webkit'],
- // Translations for conforming layout names
- layoutTranslations = [ ['konqueror', 'khtml'], ['msie', 'trident'], ['opera', 'presto'] ],
- // Names of supported layout engines for version number
- layoutVersions = ['applewebkit', 'gecko', 'trident'],
- // Names of known operating systems
- platforms = ['win', 'wow64', 'mac', 'linux', 'sunos', 'solaris', 'iphone'],
- // Translations for conforming operating system names
- platformTranslations = [ ['sunos', 'solaris'], ['wow64', 'win'] ],
-
- /* Methods */
-
- /**
- * Performs multiple replacements on a string
- */
- translate = function ( source, translations ) {
- var i;
- for ( i = 0; i < translations.length; i++ ) {
- source = source.replace( translations[i][0], translations[i][1] );
- }
- return source;
- },
-
- /* Pre-processing */
-
- ua = nav.userAgent,
- match,
- name = uk,
- layout = uk,
- layoutversion = uk,
- platform = uk,
- version = x;
-
- if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( ua ) ) {
- // Takes a userAgent string and translates given text into something we can more easily work with
- ua = translate( ua, userAgentTranslations );
- }
- // Everything will be in lowercase from now on
- ua = ua.toLowerCase();
-
- /* Extraction */
-
- if ( match = new RegExp( '(' + names.join( '|' ) + ')' ).exec( ua ) ) {
- name = translate( match[1], nameTranslations );
- }
- if ( match = new RegExp( '(' + layouts.join( '|' ) + ')' ).exec( ua ) ) {
- layout = translate( match[1], layoutTranslations );
- }
- if ( match = new RegExp( '(' + layoutVersions.join( '|' ) + ')\\\/(\\d+)').exec( ua ) ) {
- layoutversion = parseInt( match[2], 10 );
- }
- if ( match = new RegExp( '(' + platforms.join( '|' ) + ')' ).exec( nav.platform.toLowerCase() ) ) {
- platform = translate( match[1], platformTranslations );
- }
- if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( ua ) ) {
- version = match[3];
- }
-
- /* Edge Cases -- did I mention about how user agent string lie? */
-
- // Decode Safari's crazy 400+ version numbers
- if ( name === 'safari' && version > 400 ) {
- version = '2.0';
- }
- // Expose Opera 10's lies about being Opera 9.8
- if ( name === 'opera' && version >= 9.8 ) {
- match = ua.match( /\bversion\/([0-9\.]*)/ );
- if ( match && match[1] ) {
- version = match[1];
- } else {
- version = '10';
- }
- }
- // And Opera 15's lies about being Chrome
- if ( name === 'chrome' && ( match = ua.match( /\bopr\/([0-9\.]*)/ ) ) ) {
- if ( match[1] ) {
- name = 'opera';
- version = match[1];
- }
- }
- // And IE 11's lies about being not being IE
- if ( layout === 'trident' && layoutversion >= 7 && ( match = ua.match( /\brv[ :\/]([0-9\.]*)/ ) ) ) {
- if ( match[1] ) {
- name = 'msie';
- version = match[1];
- }
- }
-
- versionNumber = parseFloat( version, 10 ) || 0.0;
-
- /* Caching */
-
- profileCache[nav.userAgent] = {
- name: name,
- layout: layout,
- layoutVersion: layoutversion,
- platform: platform,
- version: version,
- versionBase: ( version !== x ? Math.floor( versionNumber ).toString() : x ),
- versionNumber: versionNumber
- };
- }
- return profileCache[nav.userAgent];
- },
-
- /**
- * Checks the current browser against a support map object.
- *
- * A browser map is in the following format:
- * {
- * // Multiple rules with configurable operators
- * 'msie': [['>=', 7], ['!=', 9]],
- * // Match no versions
- * 'iphone': false,
- * // Match any version
- * 'android': null
- * }
- *
- * It can optionally be split into ltr/rtl sections:
- * {
- * 'ltr': {
- * 'android': null,
- * 'iphone': false
- * },
- * 'rtl': {
- * 'android': false,
- * // rules are not inherited from ltr
- * 'iphone': false
- * }
- * }
- *
- * @param {Object} map Browser support map
- * @param {Object} [profile] A client-profile object
- * @param {boolean} [exactMatchOnly=false] Only return true if the browser is matched, otherwise
- * returns true if the browser is not found.
- *
- * @returns {boolean} The current browser is in the support map
- */
- test: function ( map, profile, exactMatchOnly ) {
- /*jshint evil: true */
-
- var conditions, dir, i, op, val;
- profile = $.isPlainObject( profile ) ? profile : $.client.profile();
- if ( map.ltr && map.rtl ) {
- dir = $( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr';
- map = map[dir];
- }
- // Check over each browser condition to determine if we are running in a compatible client
- if ( typeof map !== 'object' || map[profile.name] === undefined ) {
- // Not found, return true if exactMatchOnly not set, false otherwise
- return !exactMatchOnly;
- }
- conditions = map[profile.name];
- if ( conditions === false ) {
- // Match no versions
- return false;
- }
- if ( conditions === null ) {
- // Match all versions
- return true;
- }
- for ( i = 0; i < conditions.length; i++ ) {
- op = conditions[i][0];
- val = conditions[i][1];
- if ( typeof val === 'string' ) {
- if ( !( eval( 'profile.version' + op + '"' + val + '"' ) ) ) {
- return false;
- }
- } else if ( typeof val === 'number' ) {
- if ( !( eval( 'profile.versionNumber' + op + val ) ) ) {
- return false;
- }
- }
- }
-
- return true;
- }
- };
-}( jQuery ) );
diff --git a/resources/jquery/jquery.color.js b/resources/jquery/jquery.color.js
deleted file mode 100644
index 8bc45c97..00000000
--- a/resources/jquery/jquery.color.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * jQuery Color Animations
- *
- * @author John Resig, 2007
- * @author Krinkle, 2011
- * Released under the MIT and GPL licenses.
- *
- * - 2011-01-05: Forked for MediaWiki. See also jQuery.colorUtil plugin
- */
-( function ( $ ) {
-
- function getColor( elem, attr ) {
- /*jshint boss:true */
- var color;
-
- do {
- color = $.curCSS( elem, attr );
-
- // Keep going until we find an element that has color, or we hit the body
- if ( color !== '' && color !== 'transparent' || $.nodeName( elem, 'body' ) ) {
- break;
- }
-
- attr = 'backgroundColor';
- } while ( elem = elem.parentNode );
-
- return $.colorUtil.getRGB( color );
- }
-
- // We override the animation for all of these color styles
- $.each([
- 'backgroundColor',
- 'borderBottomColor',
- 'borderLeftColor',
- 'borderRightColor',
- 'borderTopColor',
- 'color',
- 'outlineColor'
- ], function ( i, attr ) {
- $.fx.step[attr] = function ( fx ) {
- if ( fx.state === 0 ) {
- fx.start = getColor( fx.elem, attr );
- fx.end = $.colorUtil.getRGB( fx.end );
- }
-
- fx.elem.style[attr] = 'rgb(' + [
- Math.max( Math.min( parseInt( (fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10 ), 255 ), 0 ),
- Math.max( Math.min( parseInt( (fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10 ), 255 ), 0 ),
- Math.max( Math.min( parseInt( (fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10 ), 255 ), 0 )
- ].join( ',' ) + ')';
- };
- } );
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.colorUtil.js b/resources/jquery/jquery.colorUtil.js
deleted file mode 100644
index 9c6f9ecb..00000000
--- a/resources/jquery/jquery.colorUtil.js
+++ /dev/null
@@ -1,219 +0,0 @@
-/**
- * jQuery Color Utilities
- * Written by Krinkle in 2011
- * Released under the MIT and GPL licenses.
- * Mostly based on other plugins and functions (linted and optimized a little).
- * Sources cited inline.
- */
-( function ( $ ) {
- $.colorUtil = {
-
- // Color Conversion function from highlightFade
- // By Blair Mitchelmore
- // http://jquery.offput.ca/highlightFade/
- // Parse strings looking for color tuples [255,255,255]
- getRGB : function ( color ) {
- /*jshint boss:true */
- var result;
-
- // Check if we're already dealing with an array of colors
- if ( color && $.isArray( color ) && color.length === 3 ) {
- return color;
- }
-
- // Look for rgb(num,num,num)
- if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
- return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
- }
-
- // Look for rgb(num%,num%,num%)
- if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) {
- return [parseFloat(result[1],10)*2.55, parseFloat(result[2],10)*2.55, parseFloat(result[3])*2.55];
- }
-
- // Look for #a0b1c2
- if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
- return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
- }
-
- // Look for #fff
- if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
- return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
- }
-
- // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
- if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) {
- return $.colorUtil.colors.transparent;
- }
-
- // Otherwise, we're most likely dealing with a named color
- return $.colorUtil.colors[$.trim(color).toLowerCase()];
- },
-
- // Some named colors to work with
- // From Interface by Stefan Petre
- // http://interface.eyecon.ro/
- colors: {
- aqua: [0,255,255],
- azure: [240,255,255],
- beige: [245,245,220],
- black: [0,0,0],
- blue: [0,0,255],
- brown: [165,42,42],
- cyan: [0,255,255],
- darkblue: [0,0,139],
- darkcyan: [0,139,139],
- darkgrey: [169,169,169],
- darkgreen: [0,100,0],
- darkkhaki: [189,183,107],
- darkmagenta: [139,0,139],
- darkolivegreen: [85,107,47],
- darkorange: [255,140,0],
- darkorchid: [153,50,204],
- darkred: [139,0,0],
- darksalmon: [233,150,122],
- darkviolet: [148,0,211],
- fuchsia: [255,0,255],
- gold: [255,215,0],
- green: [0,128,0],
- indigo: [75,0,130],
- khaki: [240,230,140],
- lightblue: [173,216,230],
- lightcyan: [224,255,255],
- lightgreen: [144,238,144],
- lightgrey: [211,211,211],
- lightpink: [255,182,193],
- lightyellow: [255,255,224],
- lime: [0,255,0],
- magenta: [255,0,255],
- maroon: [128,0,0],
- navy: [0,0,128],
- olive: [128,128,0],
- orange: [255,165,0],
- pink: [255,192,203],
- purple: [128,0,128],
- violet: [128,0,128],
- red: [255,0,0],
- silver: [192,192,192],
- white: [255,255,255],
- yellow: [255,255,0],
- transparent: [255,255,255]
- },
-
- /**
- * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
- * Converts an RGB color value to HSL. Conversion formula
- * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
- * Assumes r, g, and b are contained in the set [0, 255] and
- * returns h, s, and l in the set [0, 1].
- *
- * @param Number R The red color value
- * @param Number G The green color value
- * @param Number B The blue color value
- * @return Array The HSL representation
- */
- rgbToHsl: function ( R, G, B ) {
- var d,
- r = R / 255,
- g = G / 255,
- b = B / 255,
- max = Math.max( r, g, b ), min = Math.min( r, g, b ),
- h,
- s,
- l = (max + min) / 2;
-
- if ( max === min ) {
- // achromatic
- h = s = 0;
- } else {
- d = max - min;
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
- switch ( max ) {
- case r:
- h = (g - b) / d + (g < b ? 6 : 0);
- break;
- case g:
- h = (b - r) / d + 2;
- break;
- case b:
- h = (r - g) / d + 4;
- break;
- }
- h /= 6;
- }
-
- return [h, s, l];
- },
-
- /**
- * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
- * Converts an HSL color value to RGB. Conversion formula
- * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
- * Assumes h, s, and l are contained in the set [0, 1] and
- * returns r, g, and b in the set [0, 255].
- *
- * @param Number h The hue
- * @param Number s The saturation
- * @param Number l The lightness
- * @return Array The RGB representation
- */
- hslToRgb: function ( h, s, l ) {
- var r, g, b, hue2rgb, q, p;
-
- if ( s === 0 ) {
- r = g = b = l; // achromatic
- } else {
- hue2rgb = function ( p, q, t ) {
- if ( t < 0 ) {
- t += 1;
- }
- if ( t > 1 ) {
- t -= 1;
- }
- if ( t < 1/6 ) {
- return p + (q - p) * 6 * t;
- }
- if ( t < 1/2 ) {
- return q;
- }
- if ( t < 2/3 ) {
- return p + (q - p) * (2/3 - t) * 6;
- }
- return p;
- };
-
- q = l < 0.5 ? l * (1 + s) : l + s - l * s;
- p = 2 * l - q;
- r = hue2rgb( p, q, h + 1/3 );
- g = hue2rgb( p, q, h );
- b = hue2rgb( p, q, h - 1/3 );
- }
-
- return [r * 255, g * 255, b * 255];
- },
-
- /**
- * Get's a brighter or darker rgb() value string.
- *
- * @author Krinkle
- *
- * @example getCSSColorMod( 'red', +0.1 )
- * @example getCSSColorMod( 'rgb(200,50,50)', -0.2 )
- *
- * @param Mixed currentColor current value in css
- * @param Number mod wanted brightness modification between -1 and 1
- * @return String 'rgb(r,g,b)'
- */
- getColorBrightness: function ( currentColor, mod ) {
- var rgbArr = $.colorUtil.getRGB( currentColor ),
- hslArr = $.colorUtil.rgbToHsl(rgbArr[0], rgbArr[1], rgbArr[2] );
- rgbArr = $.colorUtil.hslToRgb(hslArr[0], hslArr[1], hslArr[2]+mod);
-
- return 'rgb(' +
- [parseInt( rgbArr[0], 10), parseInt( rgbArr[1], 10 ), parseInt( rgbArr[2], 10 )].join( ',' ) +
- ')';
- }
-
- };
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.cookie.js b/resources/jquery/jquery.cookie.js
deleted file mode 100644
index 6d5974a2..00000000
--- a/resources/jquery/jquery.cookie.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*!
- * jQuery Cookie Plugin
- * https://github.com/carhartl/jquery-cookie
- *
- * Copyright 2011, Klaus Hartl
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.opensource.org/licenses/GPL-2.0
- */
-(function($) {
- $.cookie = function(key, value, options) {
-
- // key and at least value given, set cookie...
- if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
- options = $.extend({}, options);
-
- if (value === null || value === undefined) {
- options.expires = -1;
- }
-
- if (typeof options.expires === 'number') {
- var days = options.expires, t = options.expires = new Date();
- t.setDate(t.getDate() + days);
- }
-
- value = String(value);
-
- return (document.cookie = [
- encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
- options.path ? '; path=' + options.path : '',
- options.domain ? '; domain=' + options.domain : '',
- options.secure ? '; secure' : ''
- ].join(''));
- }
-
- // key and possibly options given, get cookie...
- options = value || {};
- var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
-
- var pairs = document.cookie.split('; ');
- for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
- if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
- }
- return null;
- };
-})(jQuery);
diff --git a/resources/jquery/jquery.cycle.all.js b/resources/jquery/jquery.cycle.all.js
deleted file mode 100644
index d57fb720..00000000
--- a/resources/jquery/jquery.cycle.all.js
+++ /dev/null
@@ -1,1529 +0,0 @@
-/*!
- * jQuery Cycle Plugin (with Transition Definitions)
- * Examples and documentation at: http://jquery.malsup.com/cycle/
- * Copyright (c) 2007-2010 M. Alsup
- * Version: 2.9999 (13-NOV-2011)
- * Dual licensed under the MIT and GPL licenses.
- * http://jquery.malsup.com/license.html
- * Requires: jQuery v1.3.2 or later
- */
-;(function($, undefined) {
-
-var ver = '2.9999';
-
-// if $.support is not defined (pre jQuery 1.3) add what I need
-if ($.support == undefined) {
- $.support = {
- opacity: !($.browser.msie)
- };
-}
-
-function debug(s) {
- $.fn.cycle.debug && log(s);
-}
-function log() {
- window.console && console.log && console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
-}
-$.expr[':'].paused = function(el) {
- return el.cyclePause;
-}
-
-
-// the options arg can be...
-// a number - indicates an immediate transition should occur to the given slide index
-// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
-// an object - properties to control the slideshow
-//
-// the arg2 arg can be...
-// the name of an fx (only used in conjunction with a numeric value for 'options')
-// the value true (only used in first arg == 'resume') and indicates
-// that the resume should occur immediately (not wait for next timeout)
-
-$.fn.cycle = function(options, arg2) {
- var o = { s: this.selector, c: this.context };
-
- // in 1.3+ we can fix mistakes with the ready state
- if (this.length === 0 && options != 'stop') {
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing slideshow');
- $(function() {
- $(o.s,o.c).cycle(options,arg2);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- // iterate the matched nodeset
- return this.each(function() {
- var opts = handleArguments(this, options, arg2);
- if (opts === false)
- return;
-
- opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
-
- // stop existing slideshow for this container (if there is one)
- if (this.cycleTimeout)
- clearTimeout(this.cycleTimeout);
- this.cycleTimeout = this.cyclePause = 0;
-
- var $cont = $(this);
- var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
- var els = $slides.get();
-
- var opts2 = buildOptions($cont, $slides, els, opts, o);
- if (opts2 === false)
- return;
-
- if (els.length < 2) {
- log('terminating; too few slides: ' + els.length);
- return;
- }
-
- var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
-
- // if it's an auto slideshow, kick it off
- if (startTime) {
- startTime += (opts2.delay || 0);
- if (startTime < 10)
- startTime = 10;
- debug('first timeout: ' + startTime);
- this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards)}, startTime);
- }
- });
-};
-
-function triggerPause(cont, byHover, onPager) {
- var opts = $(cont).data('cycle.opts');
- var paused = !!cont.cyclePause;
- if (paused && opts.paused)
- opts.paused(cont, opts, byHover, onPager);
- else if (!paused && opts.resumed)
- opts.resumed(cont, opts, byHover, onPager);
-}
-
-// process the args that were passed to the plugin fn
-function handleArguments(cont, options, arg2) {
- if (cont.cycleStop == undefined)
- cont.cycleStop = 0;
- if (options === undefined || options === null)
- options = {};
- if (options.constructor == String) {
- switch(options) {
- case 'destroy':
- case 'stop':
- var opts = $(cont).data('cycle.opts');
- if (!opts)
- return false;
- cont.cycleStop++; // callbacks look for change
- if (cont.cycleTimeout)
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- opts.elements && $(opts.elements).stop();
- $(cont).removeData('cycle.opts');
- if (options == 'destroy')
- destroy(opts);
- return false;
- case 'toggle':
- cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
- checkInstantResume(cont.cyclePause, arg2, cont);
- triggerPause(cont);
- return false;
- case 'pause':
- cont.cyclePause = 1;
- triggerPause(cont);
- return false;
- case 'resume':
- cont.cyclePause = 0;
- checkInstantResume(false, arg2, cont);
- triggerPause(cont);
- return false;
- case 'prev':
- case 'next':
- var opts = $(cont).data('cycle.opts');
- if (!opts) {
- log('options not found, "prev/next" ignored');
- return false;
- }
- $.fn.cycle[options](opts);
- return false;
- default:
- options = { fx: options };
- };
- return options;
- }
- else if (options.constructor == Number) {
- // go to the requested slide
- var num = options;
- options = $(cont).data('cycle.opts');
- if (!options) {
- log('options not found, can not advance slide');
- return false;
- }
- if (num < 0 || num >= options.elements.length) {
- log('invalid slide index: ' + num);
- return false;
- }
- options.nextSlide = num;
- if (cont.cycleTimeout) {
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- }
- if (typeof arg2 == 'string')
- options.oneTimeFx = arg2;
- go(options.elements, options, 1, num >= options.currSlide);
- return false;
- }
- return options;
-
- function checkInstantResume(isPaused, arg2, cont) {
- if (!isPaused && arg2 === true) { // resume now!
- var options = $(cont).data('cycle.opts');
- if (!options) {
- log('options not found, can not resume');
- return false;
- }
- if (cont.cycleTimeout) {
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- }
- go(options.elements, options, 1, !options.backwards);
- }
- }
-};
-
-function removeFilter(el, opts) {
- if (!$.support.opacity && opts.cleartype && el.style.filter) {
- try { el.style.removeAttribute('filter'); }
- catch(smother) {} // handle old opera versions
- }
-};
-
-// unbind event handlers
-function destroy(opts) {
- if (opts.next)
- $(opts.next).unbind(opts.prevNextEvent);
- if (opts.prev)
- $(opts.prev).unbind(opts.prevNextEvent);
-
- if (opts.pager || opts.pagerAnchorBuilder)
- $.each(opts.pagerAnchors || [], function() {
- this.unbind().remove();
- });
- opts.pagerAnchors = null;
- if (opts.destroy) // callback
- opts.destroy(opts);
-};
-
-// one-time initialization
-function buildOptions($cont, $slides, els, options, o) {
- var startingSlideSpecified;
- // support metadata plugin (v1.0 and v2.0)
- var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
- var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
- if (meta)
- opts = $.extend(opts, meta);
- if (opts.autostop)
- opts.countdown = opts.autostopCount || els.length;
-
- var cont = $cont[0];
- $cont.data('cycle.opts', opts);
- opts.$cont = $cont;
- opts.stopCount = cont.cycleStop;
- opts.elements = els;
- opts.before = opts.before ? [opts.before] : [];
- opts.after = opts.after ? [opts.after] : [];
-
- // push some after callbacks
- if (!$.support.opacity && opts.cleartype)
- opts.after.push(function() { removeFilter(this, opts); });
- if (opts.continuous)
- opts.after.push(function() { go(els,opts,0,!opts.backwards); });
-
- saveOriginalOpts(opts);
-
- // clearType corrections
- if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
- clearTypeFix($slides);
-
- // container requires non-static position so that slides can be position within
- if ($cont.css('position') == 'static')
- $cont.css('position', 'relative');
- if (opts.width)
- $cont.width(opts.width);
- if (opts.height && opts.height != 'auto')
- $cont.height(opts.height);
-
- if (opts.startingSlide != undefined) {
- opts.startingSlide = parseInt(opts.startingSlide,10);
- if (opts.startingSlide >= els.length || opts.startSlide < 0)
- opts.startingSlide = 0; // catch bogus input
- else
- startingSlideSpecified = true;
- }
- else if (opts.backwards)
- opts.startingSlide = els.length - 1;
- else
- opts.startingSlide = 0;
-
- // if random, mix up the slide array
- if (opts.random) {
- opts.randomMap = [];
- for (var i = 0; i < els.length; i++)
- opts.randomMap.push(i);
- opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
- if (startingSlideSpecified) {
- // try to find the specified starting slide and if found set start slide index in the map accordingly
- for ( var cnt = 0; cnt < els.length; cnt++ ) {
- if ( opts.startingSlide == opts.randomMap[cnt] ) {
- opts.randomIndex = cnt;
- }
- }
- }
- else {
- opts.randomIndex = 1;
- opts.startingSlide = opts.randomMap[1];
- }
- }
- else if (opts.startingSlide >= els.length)
- opts.startingSlide = 0; // catch bogus input
- opts.currSlide = opts.startingSlide || 0;
- var first = opts.startingSlide;
-
- // set position and zIndex on all the slides
- $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
- var z;
- if (opts.backwards)
- z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
- else
- z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
- $(this).css('z-index', z)
- });
-
- // make sure first slide is visible
- $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
- removeFilter(els[first], opts);
-
- // stretch slides
- if (opts.fit) {
- if (!opts.aspect) {
- if (opts.width)
- $slides.width(opts.width);
- if (opts.height && opts.height != 'auto')
- $slides.height(opts.height);
- } else {
- $slides.each(function(){
- var $slide = $(this);
- var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
- if( opts.width && $slide.width() != opts.width ) {
- $slide.width( opts.width );
- $slide.height( opts.width / ratio );
- }
-
- if( opts.height && $slide.height() < opts.height ) {
- $slide.height( opts.height );
- $slide.width( opts.height * ratio );
- }
- });
- }
- }
-
- if (opts.center && ((!opts.fit) || opts.aspect)) {
- $slides.each(function(){
- var $slide = $(this);
- $slide.css({
- "margin-left": opts.width ?
- ((opts.width - $slide.width()) / 2) + "px" :
- 0,
- "margin-top": opts.height ?
- ((opts.height - $slide.height()) / 2) + "px" :
- 0
- });
- });
- }
-
- if (opts.center && !opts.fit && !opts.slideResize) {
- $slides.each(function(){
- var $slide = $(this);
- $slide.css({
- "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
- "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
- });
- });
- }
-
- // stretch container
- var reshape = opts.containerResize && !$cont.innerHeight();
- if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
- var maxw = 0, maxh = 0;
- for(var j=0; j < els.length; j++) {
- var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
- if (!w) w = e.offsetWidth || e.width || $e.attr('width');
- if (!h) h = e.offsetHeight || e.height || $e.attr('height');
- maxw = w > maxw ? w : maxw;
- maxh = h > maxh ? h : maxh;
- }
- if (maxw > 0 && maxh > 0)
- $cont.css({width:maxw+'px',height:maxh+'px'});
- }
-
- var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
- if (opts.pause)
- $cont.hover(
- function(){
- pauseFlag = true;
- this.cyclePause++;
- triggerPause(cont, true);
- },
- function(){
- pauseFlag && this.cyclePause--;
- triggerPause(cont, true);
- }
- );
-
- if (supportMultiTransitions(opts) === false)
- return false;
-
- // apparently a lot of people use image slideshows without height/width attributes on the images.
- // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
- var requeue = false;
- options.requeueAttempts = options.requeueAttempts || 0;
- $slides.each(function() {
- // try to get height/width of each slide
- var $el = $(this);
- this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
- this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
-
- if ( $el.is('img') ) {
- // sigh.. sniffing, hacking, shrugging... this crappy hack tries to account for what browsers do when
- // an image is being downloaded and the markup did not include sizing info (height/width attributes);
- // there seems to be some "default" sizes used in this situation
- var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
- var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
- var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
- var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
- // don't requeue for images that are still loading but have a valid size
- if (loadingIE || loadingFF || loadingOp || loadingOther) {
- if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
- log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
- setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
- requeue = true;
- return false; // break each loop
- }
- else {
- log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
- }
- }
- }
- return true;
- });
-
- if (requeue)
- return false;
-
- opts.cssBefore = opts.cssBefore || {};
- opts.cssAfter = opts.cssAfter || {};
- opts.cssFirst = opts.cssFirst || {};
- opts.animIn = opts.animIn || {};
- opts.animOut = opts.animOut || {};
-
- $slides.not(':eq('+first+')').css(opts.cssBefore);
- $($slides[first]).css(opts.cssFirst);
-
- if (opts.timeout) {
- opts.timeout = parseInt(opts.timeout,10);
- // ensure that timeout and speed settings are sane
- if (opts.speed.constructor == String)
- opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
- if (!opts.sync)
- opts.speed = opts.speed / 2;
-
- var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
- while((opts.timeout - opts.speed) < buffer) // sanitize timeout
- opts.timeout += opts.speed;
- }
- if (opts.easing)
- opts.easeIn = opts.easeOut = opts.easing;
- if (!opts.speedIn)
- opts.speedIn = opts.speed;
- if (!opts.speedOut)
- opts.speedOut = opts.speed;
-
- opts.slideCount = els.length;
- opts.currSlide = opts.lastSlide = first;
- if (opts.random) {
- if (++opts.randomIndex == els.length)
- opts.randomIndex = 0;
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else if (opts.backwards)
- opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1;
- else
- opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
-
- // run transition init fn
- if (!opts.multiFx) {
- var init = $.fn.cycle.transitions[opts.fx];
- if ($.isFunction(init))
- init($cont, $slides, opts);
- else if (opts.fx != 'custom' && !opts.multiFx) {
- log('unknown transition: ' + opts.fx,'; slideshow terminating');
- return false;
- }
- }
-
- // fire artificial events
- var e0 = $slides[first];
- if (!opts.skipInitializationCallbacks) {
- if (opts.before.length)
- opts.before[0].apply(e0, [e0, e0, opts, true]);
- if (opts.after.length)
- opts.after[0].apply(e0, [e0, e0, opts, true]);
- }
- if (opts.next)
- $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1)});
- if (opts.prev)
- $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0)});
- if (opts.pager || opts.pagerAnchorBuilder)
- buildPager(els,opts);
-
- exposeAddSlide(opts, els);
-
- return opts;
-};
-
-// save off original opts so we can restore after clearing state
-function saveOriginalOpts(opts) {
- opts.original = { before: [], after: [] };
- opts.original.cssBefore = $.extend({}, opts.cssBefore);
- opts.original.cssAfter = $.extend({}, opts.cssAfter);
- opts.original.animIn = $.extend({}, opts.animIn);
- opts.original.animOut = $.extend({}, opts.animOut);
- $.each(opts.before, function() { opts.original.before.push(this); });
- $.each(opts.after, function() { opts.original.after.push(this); });
-};
-
-function supportMultiTransitions(opts) {
- var i, tx, txs = $.fn.cycle.transitions;
- // look for multiple effects
- if (opts.fx.indexOf(',') > 0) {
- opts.multiFx = true;
- opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
- // discard any bogus effect names
- for (i=0; i < opts.fxs.length; i++) {
- var fx = opts.fxs[i];
- tx = txs[fx];
- if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
- log('discarding unknown transition: ',fx);
- opts.fxs.splice(i,1);
- i--;
- }
- }
- // if we have an empty list then we threw everything away!
- if (!opts.fxs.length) {
- log('No valid transitions named; slideshow terminating.');
- return false;
- }
- }
- else if (opts.fx == 'all') { // auto-gen the list of transitions
- opts.multiFx = true;
- opts.fxs = [];
- for (p in txs) {
- tx = txs[p];
- if (txs.hasOwnProperty(p) && $.isFunction(tx))
- opts.fxs.push(p);
- }
- }
- if (opts.multiFx && opts.randomizeEffects) {
- // munge the fxs array to make effect selection random
- var r1 = Math.floor(Math.random() * 20) + 30;
- for (i = 0; i < r1; i++) {
- var r2 = Math.floor(Math.random() * opts.fxs.length);
- opts.fxs.push(opts.fxs.splice(r2,1)[0]);
- }
- debug('randomized fx sequence: ',opts.fxs);
- }
- return true;
-};
-
-// provide a mechanism for adding slides after the slideshow has started
-function exposeAddSlide(opts, els) {
- opts.addSlide = function(newSlide, prepend) {
- var $s = $(newSlide), s = $s[0];
- if (!opts.autostopCount)
- opts.countdown++;
- els[prepend?'unshift':'push'](s);
- if (opts.els)
- opts.els[prepend?'unshift':'push'](s); // shuffle needs this
- opts.slideCount = els.length;
-
- // add the slide to the random map and resort
- if (opts.random) {
- opts.randomMap.push(opts.slideCount-1);
- opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
- }
-
- $s.css('position','absolute');
- $s[prepend?'prependTo':'appendTo'](opts.$cont);
-
- if (prepend) {
- opts.currSlide++;
- opts.nextSlide++;
- }
-
- if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
- clearTypeFix($s);
-
- if (opts.fit && opts.width)
- $s.width(opts.width);
- if (opts.fit && opts.height && opts.height != 'auto')
- $s.height(opts.height);
- s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
- s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
-
- $s.css(opts.cssBefore);
-
- if (opts.pager || opts.pagerAnchorBuilder)
- $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
-
- if ($.isFunction(opts.onAddSlide))
- opts.onAddSlide($s);
- else
- $s.hide(); // default behavior
- };
-}
-
-// reset internal state; we do this on every pass in order to support multiple effects
-$.fn.cycle.resetState = function(opts, fx) {
- fx = fx || opts.fx;
- opts.before = []; opts.after = [];
- opts.cssBefore = $.extend({}, opts.original.cssBefore);
- opts.cssAfter = $.extend({}, opts.original.cssAfter);
- opts.animIn = $.extend({}, opts.original.animIn);
- opts.animOut = $.extend({}, opts.original.animOut);
- opts.fxFn = null;
- $.each(opts.original.before, function() { opts.before.push(this); });
- $.each(opts.original.after, function() { opts.after.push(this); });
-
- // re-init
- var init = $.fn.cycle.transitions[fx];
- if ($.isFunction(init))
- init(opts.$cont, $(opts.elements), opts);
-};
-
-// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
-function go(els, opts, manual, fwd) {
- // opts.busy is true if we're in the middle of an animation
- if (manual && opts.busy && opts.manualTrump) {
- // let manual transitions requests trump active ones
- debug('manualTrump in go(), stopping active transition');
- $(els).stop(true,true);
- opts.busy = 0;
- }
- // don't begin another timeout-based transition if there is one active
- if (opts.busy) {
- debug('transition active, ignoring new tx request');
- return;
- }
-
- var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
-
- // stop cycling if we have an outstanding stop request
- if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
- return;
-
- // check to see if we should stop cycling based on autostop options
- if (!manual && !p.cyclePause && !opts.bounce &&
- ((opts.autostop && (--opts.countdown <= 0)) ||
- (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
- if (opts.end)
- opts.end(opts);
- return;
- }
-
- // if slideshow is paused, only transition on a manual trigger
- var changed = false;
- if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
- changed = true;
- var fx = opts.fx;
- // keep trying to get the slide size if we don't have it yet
- curr.cycleH = curr.cycleH || $(curr).height();
- curr.cycleW = curr.cycleW || $(curr).width();
- next.cycleH = next.cycleH || $(next).height();
- next.cycleW = next.cycleW || $(next).width();
-
- // support multiple transition types
- if (opts.multiFx) {
- if (fwd && (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length))
- opts.lastFx = 0;
- else if (!fwd && (opts.lastFx == undefined || --opts.lastFx < 0))
- opts.lastFx = opts.fxs.length - 1;
- fx = opts.fxs[opts.lastFx];
- }
-
- // one-time fx overrides apply to: $('div').cycle(3,'zoom');
- if (opts.oneTimeFx) {
- fx = opts.oneTimeFx;
- opts.oneTimeFx = null;
- }
-
- $.fn.cycle.resetState(opts, fx);
-
- // run the before callbacks
- if (opts.before.length)
- $.each(opts.before, function(i,o) {
- if (p.cycleStop != opts.stopCount) return;
- o.apply(next, [curr, next, opts, fwd]);
- });
-
- // stage the after callacks
- var after = function() {
- opts.busy = 0;
- $.each(opts.after, function(i,o) {
- if (p.cycleStop != opts.stopCount) return;
- o.apply(next, [curr, next, opts, fwd]);
- });
- if (!p.cycleStop) {
- // queue next transition
- queueNext();
- }
- };
-
- debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
-
- // get ready to perform the transition
- opts.busy = 1;
- if (opts.fxFn) // fx function provided?
- opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
- $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- else
- $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- }
- else {
- queueNext();
- }
-
- if (changed || opts.nextSlide == opts.currSlide) {
- // calculate the next slide
- opts.lastSlide = opts.currSlide;
- if (opts.random) {
- opts.currSlide = opts.nextSlide;
- if (++opts.randomIndex == els.length) {
- opts.randomIndex = 0;
- opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
- }
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- if (opts.nextSlide == opts.currSlide)
- opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
- }
- else if (opts.backwards) {
- var roll = (opts.nextSlide - 1) < 0;
- if (roll && opts.bounce) {
- opts.backwards = !opts.backwards;
- opts.nextSlide = 1;
- opts.currSlide = 0;
- }
- else {
- opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
- opts.currSlide = roll ? 0 : opts.nextSlide+1;
- }
- }
- else { // sequence
- var roll = (opts.nextSlide + 1) == els.length;
- if (roll && opts.bounce) {
- opts.backwards = !opts.backwards;
- opts.nextSlide = els.length-2;
- opts.currSlide = els.length-1;
- }
- else {
- opts.nextSlide = roll ? 0 : opts.nextSlide+1;
- opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
- }
- }
- }
- if (changed && opts.pager)
- opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
-
- function queueNext() {
- // stage the next transition
- var ms = 0, timeout = opts.timeout;
- if (opts.timeout && !opts.continuous) {
- ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
- if (opts.fx == 'shuffle')
- ms -= opts.speedOut;
- }
- else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
- ms = 10;
- if (ms > 0)
- p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards) }, ms);
- }
-};
-
-// invoked after transition
-$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
- $(pager).each(function() {
- $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
- });
-};
-
-// calculate timeout value for current transition
-function getTimeout(curr, next, opts, fwd) {
- if (opts.timeoutFn) {
- // call user provided calc fn
- var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
- while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
- t += opts.speed;
- debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
- if (t !== false)
- return t;
- }
- return opts.timeout;
-};
-
-// expose next/prev function, caller must pass in state
-$.fn.cycle.next = function(opts) { advance(opts,1); };
-$.fn.cycle.prev = function(opts) { advance(opts,0);};
-
-// advance slide forward or back
-function advance(opts, moveForward) {
- var val = moveForward ? 1 : -1;
- var els = opts.elements;
- var p = opts.$cont[0], timeout = p.cycleTimeout;
- if (timeout) {
- clearTimeout(timeout);
- p.cycleTimeout = 0;
- }
- if (opts.random && val < 0) {
- // move back to the previously display slide
- opts.randomIndex--;
- if (--opts.randomIndex == -2)
- opts.randomIndex = els.length-2;
- else if (opts.randomIndex == -1)
- opts.randomIndex = els.length-1;
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else if (opts.random) {
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else {
- opts.nextSlide = opts.currSlide + val;
- if (opts.nextSlide < 0) {
- if (opts.nowrap) return false;
- opts.nextSlide = els.length - 1;
- }
- else if (opts.nextSlide >= els.length) {
- if (opts.nowrap) return false;
- opts.nextSlide = 0;
- }
- }
-
- var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
- if ($.isFunction(cb))
- cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
- go(els, opts, 1, moveForward);
- return false;
-};
-
-function buildPager(els, opts) {
- var $p = $(opts.pager);
- $.each(els, function(i,o) {
- $.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
- });
- opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
-};
-
-$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
- var a;
- if ($.isFunction(opts.pagerAnchorBuilder)) {
- a = opts.pagerAnchorBuilder(i,el);
- debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
- }
- else
- a = '<a href="#">'+(i+1)+'</a>';
-
- if (!a)
- return;
- var $a = $(a);
- // don't reparent if anchor is in the dom
- if ($a.parents('body').length === 0) {
- var arr = [];
- if ($p.length > 1) {
- $p.each(function() {
- var $clone = $a.clone(true);
- $(this).append($clone);
- arr.push($clone[0]);
- });
- $a = $(arr);
- }
- else {
- $a.appendTo($p);
- }
- }
-
- opts.pagerAnchors = opts.pagerAnchors || [];
- opts.pagerAnchors.push($a);
-
- var pagerFn = function(e) {
- e.preventDefault();
- opts.nextSlide = i;
- var p = opts.$cont[0], timeout = p.cycleTimeout;
- if (timeout) {
- clearTimeout(timeout);
- p.cycleTimeout = 0;
- }
- var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
- if ($.isFunction(cb))
- cb(opts.nextSlide, els[opts.nextSlide]);
- go(els,opts,1,opts.currSlide < i); // trigger the trans
-// return false; // <== allow bubble
- }
-
- if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
- $a.hover(pagerFn, function(){/* no-op */} );
- }
- else {
- $a.bind(opts.pagerEvent, pagerFn);
- }
-
- if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
- $a.bind('click.cycle', function(){return false;}); // suppress click
-
- var cont = opts.$cont[0];
- var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
- if (opts.pauseOnPagerHover) {
- $a.hover(
- function() {
- pauseFlag = true;
- cont.cyclePause++;
- triggerPause(cont,true,true);
- }, function() {
- pauseFlag && cont.cyclePause--;
- triggerPause(cont,true,true);
- }
- );
- }
-};
-
-// helper fn to calculate the number of slides between the current and the next
-$.fn.cycle.hopsFromLast = function(opts, fwd) {
- var hops, l = opts.lastSlide, c = opts.currSlide;
- if (fwd)
- hops = c > l ? c - l : opts.slideCount - l;
- else
- hops = c < l ? l - c : l + opts.slideCount - c;
- return hops;
-};
-
-// fix clearType problems in ie6 by setting an explicit bg color
-// (otherwise text slides look horrible during a fade transition)
-function clearTypeFix($slides) {
- debug('applying clearType background-color hack');
- function hex(s) {
- s = parseInt(s,10).toString(16);
- return s.length < 2 ? '0'+s : s;
- };
- function getBg(e) {
- for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
- var v = $.css(e,'background-color');
- if (v && v.indexOf('rgb') >= 0 ) {
- var rgb = v.match(/\d+/g);
- return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
- }
- if (v && v != 'transparent')
- return v;
- }
- return '#ffffff';
- };
- $slides.each(function() { $(this).css('background-color', getBg(this)); });
-};
-
-// reset common props before the next transition
-$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
- $(opts.elements).not(curr).hide();
- if (typeof opts.cssBefore.opacity == 'undefined')
- opts.cssBefore.opacity = 1;
- opts.cssBefore.display = 'block';
- if (opts.slideResize && w !== false && next.cycleW > 0)
- opts.cssBefore.width = next.cycleW;
- if (opts.slideResize && h !== false && next.cycleH > 0)
- opts.cssBefore.height = next.cycleH;
- opts.cssAfter = opts.cssAfter || {};
- opts.cssAfter.display = 'none';
- $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
- $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
-};
-
-// the actual fn for effecting a transition
-$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
- var $l = $(curr), $n = $(next);
- var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
- $n.css(opts.cssBefore);
- if (speedOverride) {
- if (typeof speedOverride == 'number')
- speedIn = speedOut = speedOverride;
- else
- speedIn = speedOut = 1;
- easeIn = easeOut = null;
- }
- var fn = function() {
- $n.animate(opts.animIn, speedIn, easeIn, function() {
- cb();
- });
- };
- $l.animate(opts.animOut, speedOut, easeOut, function() {
- $l.css(opts.cssAfter);
- if (!opts.sync)
- fn();
- });
- if (opts.sync) fn();
-};
-
-// transition definitions - only fade is defined here, transition pack defines the rest
-$.fn.cycle.transitions = {
- fade: function($cont, $slides, opts) {
- $slides.not(':eq('+opts.currSlide+')').css('opacity',0);
- opts.before.push(function(curr,next,opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.opacity = 0;
- });
- opts.animIn = { opacity: 1 };
- opts.animOut = { opacity: 0 };
- opts.cssBefore = { top: 0, left: 0 };
- }
-};
-
-$.fn.cycle.ver = function() { return ver; };
-
-// override these globally if you like (they are all optional)
-$.fn.cycle.defaults = {
- activePagerClass: 'activeSlide', // class name used for the active pager link
- after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
- allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
- animIn: null, // properties that define how the slide animates in
- animOut: null, // properties that define how the slide animates out
- aspect: false, // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
- autostop: 0, // true to end slideshow after X transitions (where X == slide count)
- autostopCount: 0, // number of transitions (optionally used with autostop to define X)
- backwards: false, // true to start slideshow at last slide and move backwards through the stack
- before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
- center: null, // set to true to have cycle add top/left margin to each slide (use with width and height options)
- cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE)
- cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
- containerResize: 1, // resize container to fit largest slide
- continuous: 0, // true to start next transition immediately after current one completes
- cssAfter: null, // properties that defined the state of the slide after transitioning out
- cssBefore: null, // properties that define the initial state of the slide before transitioning in
- delay: 0, // additional delay (in ms) for first transition (hint: can be negative)
- easeIn: null, // easing for "in" transition
- easeOut: null, // easing for "out" transition
- easing: null, // easing method for both in and out transitions
- end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
- fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
- fit: 0, // force slides to fit container
- fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
- fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
- height: 'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well)
- manualTrump: true, // causes manual transition to stop an active transition instead of being ignored
- metaAttr: 'cycle',// data- attribute that holds the option data for the slideshow
- next: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
- nowrap: 0, // true to prevent slideshow from wrapping
- onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
- onPrevNextEvent: null,// callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
- pager: null, // element, jQuery object, or jQuery selector string for the element to use as pager container
- pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement)
- pagerEvent: 'click.cycle', // name of event which drives the pager navigation
- pause: 0, // true to enable "pause on hover"
- pauseOnPagerHover: 0, // true to pause when hovering over pager link
- prev: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
- prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide
- random: 0, // true for random, false for sequence (not applicable to shuffle fx)
- randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random
- requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
- requeueTimeout: 250, // ms delay for requeue
- rev: 0, // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
- shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 }
- skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
- slideExpr: null, // expression for selecting slides (if something other than all children is required)
- slideResize: 1, // force slide width/height to fixed size before every transition
- speed: 1000, // speed of the transition (any valid fx speed value)
- speedIn: null, // speed of the 'in' transition
- speedOut: null, // speed of the 'out' transition
- startingSlide: undefined, // zero-based index of the first slide to be displayed
- sync: 1, // true if in/out transitions should occur simultaneously
- timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance)
- timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag)
- updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style)
- width: null // container width (if the 'fit' option is true, the slides will be set to this width as well)
-};
-
-})(jQuery);
-
-
-/*!
- * jQuery Cycle Plugin Transition Definitions
- * This script is a plugin for the jQuery Cycle Plugin
- * Examples and documentation at: http://malsup.com/jquery/cycle/
- * Copyright (c) 2007-2010 M. Alsup
- * Version: 2.73
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-(function($) {
-
-//
-// These functions define slide initialization and properties for the named
-// transitions. To save file size feel free to remove any of these that you
-// don't need.
-//
-$.fn.cycle.transitions.none = function($cont, $slides, opts) {
- opts.fxFn = function(curr,next,opts,after){
- $(next).show();
- $(curr).hide();
- after();
- };
-};
-
-// not a cross-fade, fadeout only fades out the top slide
-$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
- $slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
- opts.before.push(function(curr,next,opts,w,h,rev) {
- $(curr).css('zIndex',opts.slideCount + (!rev === true ? 1 : 0));
- $(next).css('zIndex',opts.slideCount + (!rev === true ? 0 : 1));
- });
- opts.animIn.opacity = 1;
- opts.animOut.opacity = 0;
- opts.cssBefore.opacity = 1;
- opts.cssBefore.display = 'block';
- opts.cssAfter.zIndex = 0;
-};
-
-// scrollUp/Down/Left/Right
-$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var h = $cont.height();
- opts.cssBefore.top = h;
- opts.cssBefore.left = 0;
- opts.cssFirst.top = 0;
- opts.animIn.top = 0;
- opts.animOut.top = -h;
-};
-$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var h = $cont.height();
- opts.cssFirst.top = 0;
- opts.cssBefore.top = -h;
- opts.cssBefore.left = 0;
- opts.animIn.top = 0;
- opts.animOut.top = h;
-};
-$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var w = $cont.width();
- opts.cssFirst.left = 0;
- opts.cssBefore.left = w;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.left = 0-w;
-};
-$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var w = $cont.width();
- opts.cssFirst.left = 0;
- opts.cssBefore.left = -w;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.left = w;
-};
-$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
- $cont.css('overflow','hidden').width();
- opts.before.push(function(curr, next, opts, fwd) {
- if (opts.rev)
- fwd = !fwd;
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
- opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
- });
- opts.cssFirst.left = 0;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.top = 0;
-};
-$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push(function(curr, next, opts, fwd) {
- if (opts.rev)
- fwd = !fwd;
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
- opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
- });
- opts.cssFirst.top = 0;
- opts.cssBefore.left = 0;
- opts.animIn.top = 0;
- opts.animOut.left = 0;
-};
-
-// slideX/slideY
-$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $(opts.elements).not(curr).hide();
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.animIn.width = next.cycleW;
- });
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
- opts.animIn.width = 'show';
- opts.animOut.width = 0;
-};
-$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $(opts.elements).not(curr).hide();
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.animIn.height = next.cycleH;
- });
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.height = 0;
- opts.animIn.height = 'show';
- opts.animOut.height = 0;
-};
-
-// shuffle
-$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
- var i, w = $cont.css('overflow', 'visible').width();
- $slides.css({left: 0, top: 0});
- opts.before.push(function(curr,next,opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- });
- // only adjust speed once!
- if (!opts.speedAdjusted) {
- opts.speed = opts.speed / 2; // shuffle has 2 transitions
- opts.speedAdjusted = true;
- }
- opts.random = 0;
- opts.shuffle = opts.shuffle || {left:-w, top:15};
- opts.els = [];
- for (i=0; i < $slides.length; i++)
- opts.els.push($slides[i]);
-
- for (i=0; i < opts.currSlide; i++)
- opts.els.push(opts.els.shift());
-
- // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
- opts.fxFn = function(curr, next, opts, cb, fwd) {
- if (opts.rev)
- fwd = !fwd;
- var $el = fwd ? $(curr) : $(next);
- $(next).css(opts.cssBefore);
- var count = opts.slideCount;
- $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
- var hops = $.fn.cycle.hopsFromLast(opts, fwd);
- for (var k=0; k < hops; k++)
- fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
- if (fwd) {
- for (var i=0, len=opts.els.length; i < len; i++)
- $(opts.els[i]).css('z-index', len-i+count);
- }
- else {
- var z = $(curr).css('z-index');
- $el.css('z-index', parseInt(z,10)+1+count);
- }
- $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
- $(fwd ? this : curr).hide();
- if (cb) cb();
- });
- });
- };
- $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
-};
-
-// turnUp/Down/Left/Right
-$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.cssBefore.top = next.cycleH;
- opts.animIn.height = next.cycleH;
- opts.animOut.width = next.cycleW;
- });
- opts.cssFirst.top = 0;
- opts.cssBefore.left = 0;
- opts.cssBefore.height = 0;
- opts.animIn.top = 0;
- opts.animOut.height = 0;
-};
-$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssFirst.top = 0;
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.height = 0;
- opts.animOut.height = 0;
-};
-$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.cssBefore.left = next.cycleW;
- opts.animIn.width = next.cycleW;
- });
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
- opts.animIn.left = 0;
- opts.animOut.width = 0;
-};
-$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.animIn.width = next.cycleW;
- opts.animOut.left = curr.cycleW;
- });
- $.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
- opts.animIn.left = 0;
- opts.animOut.width = 0;
-};
-
-// zoom
-$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,false,true);
- opts.cssBefore.top = next.cycleH/2;
- opts.cssBefore.left = next.cycleW/2;
- $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
- $.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
- });
- opts.cssFirst.top = 0;
- opts.cssFirst.left = 0;
- opts.cssBefore.width = 0;
- opts.cssBefore.height = 0;
-};
-
-// fadeZoom
-$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,false);
- opts.cssBefore.left = next.cycleW/2;
- opts.cssBefore.top = next.cycleH/2;
- $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
- });
- opts.cssBefore.width = 0;
- opts.cssBefore.height = 0;
- opts.animOut.opacity = 0;
-};
-
-// blindX
-$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
- var w = $cont.css('overflow','hidden').width();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.width = next.cycleW;
- opts.animOut.left = curr.cycleW;
- });
- opts.cssBefore.left = w;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.left = w;
-};
-// blindY
-$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
- var h = $cont.css('overflow','hidden').height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssBefore.top = h;
- opts.cssBefore.left = 0;
- opts.animIn.top = 0;
- opts.animOut.top = h;
-};
-// blindZ
-$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
- var h = $cont.css('overflow','hidden').height();
- var w = $cont.width();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssBefore.top = h;
- opts.cssBefore.left = w;
- opts.animIn.top = 0;
- opts.animIn.left = 0;
- opts.animOut.top = h;
- opts.animOut.left = w;
-};
-
-// growX - grow horizontally from centered 0 width
-$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.cssBefore.left = this.cycleW/2;
- opts.animIn.left = 0;
- opts.animIn.width = this.cycleW;
- opts.animOut.left = 0;
- });
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
-};
-// growY - grow vertically from centered 0 height
-$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.cssBefore.top = this.cycleH/2;
- opts.animIn.top = 0;
- opts.animIn.height = this.cycleH;
- opts.animOut.top = 0;
- });
- opts.cssBefore.height = 0;
- opts.cssBefore.left = 0;
-};
-
-// curtainX - squeeze in both edges horizontally
-$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true,true);
- opts.cssBefore.left = next.cycleW/2;
- opts.animIn.left = 0;
- opts.animIn.width = this.cycleW;
- opts.animOut.left = curr.cycleW/2;
- opts.animOut.width = 0;
- });
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
-};
-// curtainY - squeeze in both edges vertically
-$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false,true);
- opts.cssBefore.top = next.cycleH/2;
- opts.animIn.top = 0;
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH/2;
- opts.animOut.height = 0;
- });
- opts.cssBefore.height = 0;
- opts.cssBefore.left = 0;
-};
-
-// cover - curr slide covered by next slide
-$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
- var d = opts.direction || 'left';
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- if (d == 'right')
- opts.cssBefore.left = -w;
- else if (d == 'up')
- opts.cssBefore.top = h;
- else if (d == 'down')
- opts.cssBefore.top = -h;
- else
- opts.cssBefore.left = w;
- });
- opts.animIn.left = 0;
- opts.animIn.top = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.left = 0;
-};
-
-// uncover - curr slide moves off next slide
-$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
- var d = opts.direction || 'left';
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- if (d == 'right')
- opts.animOut.left = w;
- else if (d == 'up')
- opts.animOut.top = -h;
- else if (d == 'down')
- opts.animOut.top = h;
- else
- opts.animOut.left = -w;
- });
- opts.animIn.left = 0;
- opts.animIn.top = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.left = 0;
-};
-
-// toss - move top slide and fade away
-$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
- var w = $cont.css('overflow','visible').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- // provide default toss settings if animOut not provided
- if (!opts.animOut.left && !opts.animOut.top)
- $.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
- else
- opts.animOut.opacity = 0;
- });
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
-};
-
-// wipe - clip animation
-$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.cssBefore = opts.cssBefore || {};
- var clip;
- if (opts.clip) {
- if (/l2r/.test(opts.clip))
- clip = 'rect(0px 0px '+h+'px 0px)';
- else if (/r2l/.test(opts.clip))
- clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
- else if (/t2b/.test(opts.clip))
- clip = 'rect(0px '+w+'px 0px 0px)';
- else if (/b2t/.test(opts.clip))
- clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
- else if (/zoom/.test(opts.clip)) {
- var top = parseInt(h/2,10);
- var left = parseInt(w/2,10);
- clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
- }
- }
-
- opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
-
- var d = opts.cssBefore.clip.match(/(\d+)/g);
- var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
-
- opts.before.push(function(curr, next, opts) {
- if (curr == next) return;
- var $curr = $(curr), $next = $(next);
- $.fn.cycle.commonReset(curr,next,opts,true,true,false);
- opts.cssAfter.display = 'block';
-
- var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
- (function f() {
- var tt = t ? t - parseInt(step * (t/count),10) : 0;
- var ll = l ? l - parseInt(step * (l/count),10) : 0;
- var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
- var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
- $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
- (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
- })();
- });
- $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
- opts.animIn = { left: 0 };
- opts.animOut = { left: 0 };
-};
-
-})(jQuery);
diff --git a/resources/jquery/jquery.delayedBind.js b/resources/jquery/jquery.delayedBind.js
deleted file mode 100644
index 40f3d44e..00000000
--- a/resources/jquery/jquery.delayedBind.js
+++ /dev/null
@@ -1,76 +0,0 @@
-( function ( $ ) {
-/**
- * Function that escapes spaces in event names. This is needed because
- * "_delayedBind-foo bar-1000" refers to two events
- */
-function encodeEvent( event ) {
- return event.replace( /-/g, '--' ).replace( / /g, '-' );
-}
-
-$.fn.extend( {
- /**
- * Bind a callback to an event in a delayed fashion.
- * In detail, this means that the callback will be called a certain
- * time after the event fires, but the timer is reset every time
- * the event fires.
- * @param timeout Number of milliseconds to wait
- * @param event Name of the event (string)
- * @param data Data to pass to the event handler (optional)
- * @param callback Function to call
- */
- delayedBind: function ( timeout, event, data, callback ) {
- if ( arguments.length === 3 ) {
- // Shift optional parameter down
- callback = data;
- data = undefined;
- }
- var encEvent = encodeEvent( event );
- return this.each( function () {
- var that = this;
- // Bind the top half
- // Do this only once for every (event, timeout) pair
- if ( !( $(this).data( '_delayedBindBound-' + encEvent + '-' + timeout ) ) ) {
- $(this).data( '_delayedBindBound-' + encEvent + '-' + timeout, true );
- $(this).bind( event, function () {
- var timerID = $(this).data( '_delayedBindTimerID-' + encEvent + '-' + timeout );
- // Cancel the running timer
- if ( timerID !== null ) {
- clearTimeout( timerID );
- }
- timerID = setTimeout( function () {
- $(that).trigger( '_delayedBind-' + encEvent + '-' + timeout );
- }, timeout );
- $(this).data( '_delayedBindTimerID-' + encEvent + '-' + timeout, timerID );
- } );
- }
-
- // Bottom half
- $(this).bind( '_delayedBind-' + encEvent + '-' + timeout, data, callback );
- } );
- },
-
- /**
- * Cancel the timers for delayed events on the selected elements.
- */
- delayedBindCancel: function ( timeout, event ) {
- var encEvent = encodeEvent( event );
- return this.each( function () {
- var timerID = $(this).data( '_delayedBindTimerID-' + encEvent + '-' + timeout );
- if ( timerID !== null ) {
- clearTimeout( timerID );
- }
- } );
- },
-
- /**
- * Unbind an event bound with delayedBind()
- */
- delayedBindUnbind: function ( timeout, event, callback ) {
- var encEvent = encodeEvent( event );
- return this.each( function () {
- $(this).unbind( '_delayedBind-' + encEvent + '-' + timeout, callback );
- } );
- }
-} );
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.expandableField.js b/resources/jquery/jquery.expandableField.js
deleted file mode 100644
index 9e532e52..00000000
--- a/resources/jquery/jquery.expandableField.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * This plugin provides functionality to expand a text box on focus to double it's current width
- *
- * Usage:
- *
- * Set options:
- * $('#textbox').expandableField( { option1: value1, option2: value2 } );
- * $('#textbox').expandableField( option, value );
- * Get option:
- * value = $('#textbox').expandableField( option );
- * Initialize:
- * $('#textbox').expandableField();
- *
- * Options:
- *
- */
-( function ( $ ) {
-
- $.expandableField = {
- /**
- * Expand the field, make the callback
- */
- expandField: function ( e, context ) {
- context.config.beforeExpand.call( context.data.$field, context );
- context.data.$field
- .animate( { 'width': context.data.expandedWidth }, 'fast', function () {
- context.config.afterExpand.call( this, context );
- } );
- },
- /**
- * Condense the field, make the callback
- */
- condenseField: function ( e, context ) {
- context.config.beforeCondense.call( context.data.$field, context );
- context.data.$field
- .animate( { 'width': context.data.condensedWidth }, 'fast', function () {
- context.config.afterCondense.call( this, context );
- } );
- },
- /**
- * Sets the value of a property, and updates the widget accordingly
- * @param property String Name of property
- * @param value Mixed Value to set property with
- */
- configure: function ( context, property, value ) {
- // TODO: Validate creation using fallback values
- context.config[property] = value;
- }
-
- };
-
- $.fn.expandableField = function () {
-
- // Multi-context fields
- var returnValue,
- args = arguments;
-
- $( this ).each( function () {
- var key, context;
-
- /* Construction / Loading */
-
- context = $( this ).data( 'expandableField-context' );
-
- // TODO: Do we need to check both null and undefined?
- if ( context === undefined || context === null ) {
- context = {
- config: {
- // callback function for before collapse
- beforeCondense: function () {},
-
- // callback function for before expand
- beforeExpand: function () {},
-
- // callback function for after collapse
- afterCondense: function () {},
-
- // callback function for after expand
- afterExpand: function () {},
-
- // Whether the field should expand to the left or the right -- defaults to left
- expandToLeft: true
- }
- };
- }
-
- /* API */
- // Handle various calling styles
- if ( args.length > 0 ) {
- if ( typeof args[0] === 'object' ) {
- // Apply set of properties
- for ( key in args[0] ) {
- $.expandableField.configure( context, key, args[0][key] );
- }
- } else if ( typeof args[0] === 'string' ) {
- if ( args.length > 1 ) {
- // Set property values
- $.expandableField.configure( context, args[0], args[1] );
-
- // TODO: Do we need to check both null and undefined?
- } else if ( returnValue === null || returnValue === undefined ) {
- // Get property values, but don't give access to internal data - returns only the first
- returnValue = ( args[0] in context.config ? undefined : context.config[args[0]] );
- }
- }
- }
-
- /* Initialization */
-
- if ( context.data === undefined ) {
- context.data = {
- // The width of the field in it's condensed state
- condensedWidth: $( this ).width(),
-
- // The width of the field in it's expanded state
- expandedWidth: $( this ).width() * 2,
-
- // Reference to the field
- $field: $( this )
- };
-
- $( this )
- .addClass( 'expandableField' )
- .focus( function ( e ) {
- $.expandableField.expandField( e, context );
- } )
- .delayedBind( 250, 'blur', function ( e ) {
- $.expandableField.condenseField( e, context );
- } );
- }
- // Store the context for next time
- $( this ).data( 'expandableField-context', context );
- } );
- return returnValue !== undefined ? returnValue : $(this);
- };
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.farbtastic.css b/resources/jquery/jquery.farbtastic.css
deleted file mode 100644
index 1c6428f8..00000000
--- a/resources/jquery/jquery.farbtastic.css
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Farbtastic Color Picker 1.2
- * © 2008 Steven Wittens
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-.farbtastic {
- position: relative;
-}
-.farbtastic * {
- position: absolute;
- cursor: crosshair;
-}
-.farbtastic, .farbtastic .wheel {
- width: 195px;
- height: 195px;
-}
-.farbtastic .color, .farbtastic .overlay {
- top: 47px;
- left: 47px;
- width: 101px;
- height: 101px;
-}
-.farbtastic .wheel {
- /* @embed */
- background: url(images/wheel.png) no-repeat;
- width: 195px;
- height: 195px;
-}
-.farbtastic .overlay {
- /* @embed */
- background: url(images/mask.png) no-repeat;
-}
-.farbtastic .marker {
- width: 17px;
- height: 17px;
- margin: -8px 0 0 -8px;
- overflow: hidden;
- /* @embed */
- background: url(images/marker.png) no-repeat;
-}
-
diff --git a/resources/jquery/jquery.farbtastic.js b/resources/jquery/jquery.farbtastic.js
deleted file mode 100644
index 18810857..00000000
--- a/resources/jquery/jquery.farbtastic.js
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- * Farbtastic Color Picker 1.2
- * © 2008 Steven Wittens
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//Adapted to uniform style with jQuery UI widgets and slightly change behavior
-//TODO:
-// - remove duplicated code by replacing it with jquery.colorUtils and modern jQuery
-// - uniform code style
-
-jQuery.fn.farbtastic = function (callback) {
- $.farbtastic(this, callback);
- return this;
-};
-
-jQuery.farbtastic = function (container, callback) {
- var container = $(container).get(0);
- return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
-}
-
-jQuery._farbtastic = function (container, callback) {
- // Store farbtastic object
- var fb = this;
-
- // Insert markup
- $(container).html('<div class="farbtastic ui-widget-content"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
- $(container).addClass('ui-widget');
- var e = $('.farbtastic', container);
- fb.wheel = $('.wheel', container).get(0);
- // Dimensions
- fb.radius = 84;
- fb.square = 100;
- fb.width = 194;
-
- // Fix background PNGs in IE6
- if (navigator.appVersion.match(/MSIE [0-6]\./)) {
- $('*', e).each(function () {
- if (this.currentStyle.backgroundImage != 'none') {
- var image = this.currentStyle.backgroundImage;
- image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
- $(this).css({
- 'backgroundImage': 'none',
- 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
- });
- }
- });
- }
-
- /**
- * Link to the given element(s) or callback.
- */
- fb.linkTo = function (callback) {
- // Unbind previous nodes
- if (typeof fb.callback == 'object') {
- $(fb.callback).unbind('keyup', fb.updateValue);
- }
-
- // Reset color
- fb.color = null;
-
- // Bind callback or elements
- if (typeof callback == 'function') {
- fb.callback = callback;
- }
- else if (typeof callback == 'object' || typeof callback == 'string') {
- fb.callback = $(callback);
- fb.callback.bind('keyup', fb.updateValue);
- if (fb.callback.get(0).value) {
- fb.setColor(fb.callback.get(0).value);
- }
- }
- return this;
- }
- fb.updateValue = function (event) {
- if (this.value != fb.color) {
- fb.setColor(this.value);
- }
- }
-
- /**
- * Change color with HTML syntax #123456
- */
- fb.setColor = function (color) {
- var rgb = $.colorUtil.getRGB( color );
- if (fb.color != color && rgb) {
- rgb = rgb.slice( 0 ); //make a clone
- //TODO: rewrite code so that this is not needed
- rgb[0] /= 255;
- rgb[1] /= 255;
- rgb[2] /= 255;
- fb.color = color;
- fb.rgb = rgb;
- fb.hsl = fb.RGBToHSL(fb.rgb);
- fb.updateDisplay();
- }
- return this;
- }
-
- /**
- * Change color with HSL triplet [0..1, 0..1, 0..1]
- */
- fb.setHSL = function (hsl) {
- fb.hsl = hsl;
- fb.rgb = fb.HSLToRGB(hsl);
- fb.color = fb.pack(fb.rgb);
- fb.updateDisplay();
- return this;
- }
-
- /////////////////////////////////////////////////////
-
- /**
- * Retrieve the coordinates of the given event relative to the center
- * of the widget.
- */
- fb.widgetCoords = function (event) {
- var ref = $( fb.wheel ).offset();
- return {
- x: event.pageX - ref.left - fb.width / 2,
- y: event.pageY - ref.top - fb.width / 2
- };
- }
-
- /**
- * Mousedown handler
- */
- fb.mousedown = function (event) {
- // Capture mouse
- if (!document.dragging) {
- $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
- document.dragging = true;
- }
-
- // Check which area is being dragged
- var pos = fb.widgetCoords(event);
- fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
-
- // Process
- fb.mousemove(event);
- return false;
- }
-
- /**
- * Mousemove handler
- */
- fb.mousemove = function (event) {
- // Get coordinates relative to color picker center
- var pos = fb.widgetCoords(event);
-
- // Set new HSL parameters
- if (fb.circleDrag) {
- var hue = Math.atan2(pos.x, -pos.y) / 6.28;
- if (hue < 0) hue += 1;
- fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
- }
- else {
- var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
- var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
- fb.setHSL([fb.hsl[0], sat, lum]);
- }
- return false;
- }
-
- /**
- * Mouseup handler
- */
- fb.mouseup = function () {
- // Uncapture mouse
- $(document).unbind('mousemove', fb.mousemove);
- $(document).unbind('mouseup', fb.mouseup);
- document.dragging = false;
- }
-
- /**
- * Update the markers and styles
- */
- fb.updateDisplay = function () {
- // Markers
- var angle = fb.hsl[0] * 6.28;
- $('.h-marker', e).css({
- left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
- top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
- });
-
- $('.sl-marker', e).css({
- left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
- top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
- });
-
- // Saturation/Luminance gradient
- $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
-
- // Linked elements or callback
- if (typeof fb.callback == 'object') {
- // Set background/foreground color
- $(fb.callback).css({
- backgroundColor: fb.color,
- color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
- });
-
- // Change linked value
- $(fb.callback).each(function() {
- if ( $( this ).val() != fb.color) {
- $( this ).val( fb.color ).change();
- }
- });
- }
- else if (typeof fb.callback == 'function') {
- fb.callback.call(fb, fb.color);
- }
- }
-
- /* Various color utility functions */
- fb.pack = function (rgb) {
- var r = Math.round(rgb[0] * 255);
- var g = Math.round(rgb[1] * 255);
- var b = Math.round(rgb[2] * 255);
- return '#' + (r < 16 ? '0' : '') + r.toString(16) +
- (g < 16 ? '0' : '') + g.toString(16) +
- (b < 16 ? '0' : '') + b.toString(16);
- }
-
- fb.HSLToRGB = function (hsl) {
- var m1, m2, r, g, b;
- var h = hsl[0], s = hsl[1], l = hsl[2];
- m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
- m1 = l * 2 - m2;
- return [this.hueToRGB(m1, m2, h+0.33333),
- this.hueToRGB(m1, m2, h),
- this.hueToRGB(m1, m2, h-0.33333)];
- }
-
- fb.hueToRGB = function (m1, m2, h) {
- h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
- if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
- if (h * 2 < 1) return m2;
- if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
- return m1;
- }
-
- fb.RGBToHSL = function (rgb) {
- var min, max, delta, h, s, l;
- var r = rgb[0], g = rgb[1], b = rgb[2];
- min = Math.min(r, Math.min(g, b));
- max = Math.max(r, Math.max(g, b));
- delta = max - min;
- l = (min + max) / 2;
- s = 0;
- if (l > 0 && l < 1) {
- s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
- }
- h = 0;
- if (delta > 0) {
- if (max == r && max != g) h += (g - b) / delta;
- if (max == g && max != b) h += (2 + (b - r) / delta);
- if (max == b && max != r) h += (4 + (r - g) / delta);
- h /= 6;
- }
- return [h, s, l];
- }
-
- // Install mousedown handler (the others are set on the document on-demand)
- $('*', e).mousedown(fb.mousedown);
-
- // Init color
- fb.setColor('#000000');
-
- // Set linked elements/callback
- if (callback) {
- fb.linkTo(callback);
- }
-}
diff --git a/resources/jquery/jquery.footHovzer.css b/resources/jquery/jquery.footHovzer.css
deleted file mode 100644
index 77d9514c..00000000
--- a/resources/jquery/jquery.footHovzer.css
+++ /dev/null
@@ -1,6 +0,0 @@
-#jquery-foot-hovzer {
- position: fixed;
- bottom: 0;
- width: 100%;
- z-index: 1000;
-}
diff --git a/resources/jquery/jquery.footHovzer.js b/resources/jquery/jquery.footHovzer.js
deleted file mode 100644
index 56fc32d4..00000000
--- a/resources/jquery/jquery.footHovzer.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Utility to stack stuff in an overlay fixed on the bottom of the page.
- *
- * Usage:
- * <code>
- * var hovzer = $.getFootHovzer();
- * hovzer.$.append( $myCollection );
- * hovzer.update();
- * </code>
- *
- * @author Timo Tijhof, 2012
- */
-( function ( $ ) {
- var $hovzer, footHovzer, prevHeight, newHeight;
-
- function getHovzer() {
- if ( $hovzer === undefined ) {
- $hovzer = $( '<div id="jquery-foot-hovzer"></div>' ).appendTo( 'body' );
- }
- return $hovzer;
- }
-
- footHovzer = {
- update: function () {
- var $body;
-
- $body = $( 'body' );
- if ( prevHeight === undefined ) {
- prevHeight = getHovzer().outerHeight( /*includeMargin=*/true );
- $body.css( 'paddingBottom', '+=' + prevHeight + 'px' );
- } else {
- newHeight = getHovzer().outerHeight( true );
- $body.css( 'paddingBottom', ( parseFloat( $body.css( 'paddingBottom' ) ) - prevHeight ) + newHeight );
-
- prevHeight = newHeight;
- }
- }
- };
-
- $.getFootHovzer = function () {
- footHovzer.$ = getHovzer();
- return footHovzer;
- };
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.form.js b/resources/jquery/jquery.form.js
deleted file mode 100644
index 13e9a55c..00000000
--- a/resources/jquery/jquery.form.js
+++ /dev/null
@@ -1,1089 +0,0 @@
-/*!
- * jQuery Form Plugin
- * version: 3.14 (30-JUL-2012)
- * @requires jQuery v1.3.2 or later
- *
- * Examples and documentation at: http://malsup.com/jquery/form/
- * Project repository: https://github.com/malsup/form
- * Dual licensed under the MIT and GPL licenses:
- * http://malsup.github.com/mit-license.txt
- * http://malsup.github.com/gpl-license-v2.txt
- */
-/*global ActiveXObject alert */
-;(function($) {
-"use strict";
-
-/*
- Usage Note:
- -----------
- Do not use both ajaxSubmit and ajaxForm on the same form. These
- functions are mutually exclusive. Use ajaxSubmit if you want
- to bind your own submit handler to the form. For example,
-
- $(document).ready(function() {
- $('#myForm').on('submit', function(e) {
- e.preventDefault(); // <-- important
- $(this).ajaxSubmit({
- target: '#output'
- });
- });
- });
-
- Use ajaxForm when you want the plugin to manage all the event binding
- for you. For example,
-
- $(document).ready(function() {
- $('#myForm').ajaxForm({
- target: '#output'
- });
- });
-
- You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
- form does not have to exist when you invoke ajaxForm:
-
- $('#myForm').ajaxForm({
- delegation: true,
- target: '#output'
- });
-
- When using ajaxForm, the ajaxSubmit function will be invoked for you
- at the appropriate time.
-*/
-
-/**
- * Feature detection
- */
-var feature = {};
-feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
-feature.formdata = window.FormData !== undefined;
-
-/**
- * ajaxSubmit() provides a mechanism for immediately submitting
- * an HTML form using AJAX.
- */
-$.fn.ajaxSubmit = function(options) {
- /*jshint scripturl:true */
-
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
- if (!this.length) {
- log('ajaxSubmit: skipping submit process - no element selected');
- return this;
- }
-
- var method, action, url, $form = this;
-
- if (typeof options == 'function') {
- options = { success: options };
- }
-
- method = this.attr('method');
- action = this.attr('action');
- url = (typeof action === 'string') ? $.trim(action) : '';
- url = url || window.location.href || '';
- if (url) {
- // clean url (don't include hash vaue)
- url = (url.match(/^([^#]+)/)||[])[1];
- }
-
- options = $.extend(true, {
- url: url,
- success: $.ajaxSettings.success,
- type: method || 'GET',
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
- }, options);
-
- // hook for manipulating the form data before it is extracted;
- // convenient for use with rich editors like tinyMCE or FCKEditor
- var veto = {};
- this.trigger('form-pre-serialize', [this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
- return this;
- }
-
- // provide opportunity to alter form data before it is serialized
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
- return this;
- }
-
- var traditional = options.traditional;
- if ( traditional === undefined ) {
- traditional = $.ajaxSettings.traditional;
- }
-
- var elements = [];
- var qx, a = this.formToArray(options.semantic, elements);
- if (options.data) {
- options.extraData = options.data;
- qx = $.param(options.data, traditional);
- }
-
- // give pre-submit callback an opportunity to abort the submit
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
- return this;
- }
-
- // fire vetoable 'validate' event
- this.trigger('form-submit-validate', [a, this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
- return this;
- }
-
- var q = $.param(a, traditional);
- if (qx) {
- q = ( q ? (q + '&' + qx) : qx );
- }
- if (options.type.toUpperCase() == 'GET') {
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
- options.data = null; // data is null for 'get'
- }
- else {
- options.data = q; // data is the query string for 'post'
- }
-
- var callbacks = [];
- if (options.resetForm) {
- callbacks.push(function() { $form.resetForm(); });
- }
- if (options.clearForm) {
- callbacks.push(function() { $form.clearForm(options.includeHidden); });
- }
-
- // perform a load on the target only if dataType is not provided
- if (!options.dataType && options.target) {
- var oldSuccess = options.success || function(){};
- callbacks.push(function(data) {
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
- $(options.target)[fn](data).each(oldSuccess, arguments);
- });
- }
- else if (options.success) {
- callbacks.push(options.success);
- }
-
- options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
- var context = options.context || this ; // jQuery 1.4+ supports scope context
- for (var i=0, max=callbacks.length; i < max; i++) {
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
- }
- };
-
- // are there files to upload?
- var fileInputs = $('input:file:enabled[value]', this); // [value] (issue #113)
- var hasFileInputs = fileInputs.length > 0;
- var mp = 'multipart/form-data';
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
-
- var fileAPI = feature.fileapi && feature.formdata;
- log("fileAPI :" + fileAPI);
- var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
-
- // options.iframe allows user to force iframe mode
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
- if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
- if (options.closeKeepAlive) {
- $.get(options.closeKeepAlive, function() {
- fileUploadIframe(a);
- });
- }
- else {
- fileUploadIframe(a);
- }
- }
- else if ((hasFileInputs || multipart) && fileAPI) {
- fileUploadXhr(a);
- }
- else {
- $.ajax(options);
- }
-
- // clear element array
- for (var k=0; k < elements.length; k++)
- elements[k] = null;
-
- // fire 'notify' event
- this.trigger('form-submit-notify', [this, options]);
- return this;
-
- // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
- function fileUploadXhr(a) {
- var formdata = new FormData();
-
- for (var i=0; i < a.length; i++) {
- formdata.append(a[i].name, a[i].value);
- }
-
- if (options.extraData) {
- for (var p in options.extraData)
- if (options.extraData.hasOwnProperty(p))
- formdata.append(p, options.extraData[p]);
- }
-
- options.data = null;
-
- var s = $.extend(true, {}, $.ajaxSettings, options, {
- contentType: false,
- processData: false,
- cache: false,
- type: 'POST'
- });
-
- if (options.uploadProgress) {
- // workaround because jqXHR does not expose upload property
- s.xhr = function() {
- var xhr = jQuery.ajaxSettings.xhr();
- if (xhr.upload) {
- xhr.upload.onprogress = function(event) {
- var percent = 0;
- var position = event.loaded || event.position; /*event.position is deprecated*/
- var total = event.total;
- if (event.lengthComputable) {
- percent = Math.ceil(position / total * 100);
- }
- options.uploadProgress(event, position, total, percent);
- };
- }
- return xhr;
- };
- }
-
- s.data = null;
- var beforeSend = s.beforeSend;
- s.beforeSend = function(xhr, o) {
- o.data = formdata;
- if(beforeSend)
- beforeSend.call(this, xhr, o);
- };
- $.ajax(s);
- }
-
- // private function for handling file uploads (hat tip to YAHOO!)
- function fileUploadIframe(a) {
- var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
- var useProp = !!$.fn.prop;
-
- if ($(':input[name=submit],:input[id=submit]', form).length) {
- // if there is an input with a name or id of 'submit' then we won't be
- // able to invoke the submit fn on the form (at least not x-browser)
- alert('Error: Form elements must not have name or id of "submit".');
- return;
- }
-
- if (a) {
- // ensure that every serialized input is still enabled
- for (i=0; i < elements.length; i++) {
- el = $(elements[i]);
- if ( useProp )
- el.prop('disabled', false);
- else
- el.removeAttr('disabled');
- }
- }
-
- s = $.extend(true, {}, $.ajaxSettings, options);
- s.context = s.context || s;
- id = 'jqFormIO' + (new Date().getTime());
- if (s.iframeTarget) {
- $io = $(s.iframeTarget);
- n = $io.attr('name');
- if (!n)
- $io.attr('name', id);
- else
- id = n;
- }
- else {
- $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
- }
- io = $io[0];
-
-
- xhr = { // mock object
- aborted: 0,
- responseText: null,
- responseXML: null,
- status: 0,
- statusText: 'n/a',
- getAllResponseHeaders: function() {},
- getResponseHeader: function() {},
- setRequestHeader: function() {},
- abort: function(status) {
- var e = (status === 'timeout' ? 'timeout' : 'aborted');
- log('aborting upload... ' + e);
- this.aborted = 1;
- // #214
- if (io.contentWindow.document.execCommand) {
- try { // #214
- io.contentWindow.document.execCommand('Stop');
- } catch(ignore) {}
- }
- $io.attr('src', s.iframeSrc); // abort op in progress
- xhr.error = e;
- if (s.error)
- s.error.call(s.context, xhr, e, status);
- if (g)
- $.event.trigger("ajaxError", [xhr, s, e]);
- if (s.complete)
- s.complete.call(s.context, xhr, e);
- }
- };
-
- g = s.global;
- // trigger ajax global events so that activity/block indicators work like normal
- if (g && 0 === $.active++) {
- $.event.trigger("ajaxStart");
- }
- if (g) {
- $.event.trigger("ajaxSend", [xhr, s]);
- }
-
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
- if (s.global) {
- $.active--;
- }
- return;
- }
- if (xhr.aborted) {
- return;
- }
-
- // add submitting element to data if we know it
- sub = form.clk;
- if (sub) {
- n = sub.name;
- if (n && !sub.disabled) {
- s.extraData = s.extraData || {};
- s.extraData[n] = sub.value;
- if (sub.type == "image") {
- s.extraData[n+'.x'] = form.clk_x;
- s.extraData[n+'.y'] = form.clk_y;
- }
- }
- }
-
- var CLIENT_TIMEOUT_ABORT = 1;
- var SERVER_ABORT = 2;
-
- function getDoc(frame) {
- var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
- return doc;
- }
-
- // Rails CSRF hack (thanks to Yvan Barthelemy)
- var csrf_token = $('meta[name=csrf-token]').attr('content');
- var csrf_param = $('meta[name=csrf-param]').attr('content');
- if (csrf_param && csrf_token) {
- s.extraData = s.extraData || {};
- s.extraData[csrf_param] = csrf_token;
- }
-
- // take a breath so that pending repaints get some cpu time before the upload starts
- function doSubmit() {
- // make sure form attrs are set
- var t = $form.attr('target'), a = $form.attr('action');
-
- // update form attrs in IE friendly way
- form.setAttribute('target',id);
- if (!method) {
- form.setAttribute('method', 'POST');
- }
- if (a != s.url) {
- form.setAttribute('action', s.url);
- }
-
- // ie borks in some cases when setting encoding
- if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
- $form.attr({
- encoding: 'multipart/form-data',
- enctype: 'multipart/form-data'
- });
- }
-
- // support timout
- if (s.timeout) {
- timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
- }
-
- // look for server aborts
- function checkState() {
- try {
- var state = getDoc(io).readyState;
- log('state = ' + state);
- if (state && state.toLowerCase() == 'uninitialized')
- setTimeout(checkState,50);
- }
- catch(e) {
- log('Server abort: ' , e, ' (', e.name, ')');
- cb(SERVER_ABORT);
- if (timeoutHandle)
- clearTimeout(timeoutHandle);
- timeoutHandle = undefined;
- }
- }
-
- // add "extra" data to form if provided in options
- var extraInputs = [];
- try {
- if (s.extraData) {
- for (var n in s.extraData) {
- if (s.extraData.hasOwnProperty(n)) {
- // if using the $.param format that allows for multiple values with the same name
- if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
- extraInputs.push(
- $('<input type="hidden" name="'+s.extraData[n].name+'">').attr('value',s.extraData[n].value)
- .appendTo(form)[0]);
- } else {
- extraInputs.push(
- $('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n])
- .appendTo(form)[0]);
- }
- }
- }
- }
-
- if (!s.iframeTarget) {
- // add iframe to doc and submit the form
- $io.appendTo('body');
- if (io.attachEvent)
- io.attachEvent('onload', cb);
- else
- io.addEventListener('load', cb, false);
- }
- setTimeout(checkState,15);
- form.submit();
- }
- finally {
- // reset attrs and remove "extra" input elements
- form.setAttribute('action',a);
- if(t) {
- form.setAttribute('target', t);
- } else {
- $form.removeAttr('target');
- }
- $(extraInputs).remove();
- }
- }
-
- if (s.forceSync) {
- doSubmit();
- }
- else {
- setTimeout(doSubmit, 10); // this lets dom updates render
- }
-
- var data, doc, domCheckCount = 50, callbackProcessed;
-
- function cb(e) {
- if (xhr.aborted || callbackProcessed) {
- return;
- }
- try {
- doc = getDoc(io);
- }
- catch(ex) {
- log('cannot access response document: ', ex);
- e = SERVER_ABORT;
- }
- if (e === CLIENT_TIMEOUT_ABORT && xhr) {
- xhr.abort('timeout');
- return;
- }
- else if (e == SERVER_ABORT && xhr) {
- xhr.abort('server abort');
- return;
- }
-
- if (!doc || doc.location.href == s.iframeSrc) {
- // response not received yet
- if (!timedOut)
- return;
- }
- if (io.detachEvent)
- io.detachEvent('onload', cb);
- else
- io.removeEventListener('load', cb, false);
-
- var status = 'success', errMsg;
- try {
- if (timedOut) {
- throw 'timeout';
- }
-
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
- log('isXml='+isXml);
- if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
- if (--domCheckCount) {
- // in some browsers (Opera) the iframe DOM is not always traversable when
- // the onload callback fires, so we loop a bit to accommodate
- log('requeing onLoad callback, DOM not available');
- setTimeout(cb, 250);
- return;
- }
- // let this fall through because server response could be an empty document
- //log('Could not access iframe DOM after mutiple tries.');
- //throw 'DOMException: not available';
- }
-
- //log('response detected');
- var docRoot = doc.body ? doc.body : doc.documentElement;
- xhr.responseText = docRoot ? docRoot.innerHTML : null;
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
- if (isXml)
- s.dataType = 'xml';
- xhr.getResponseHeader = function(header){
- var headers = {'content-type': s.dataType};
- return headers[header];
- };
- // support for XHR 'status' & 'statusText' emulation :
- if (docRoot) {
- xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
- xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
- }
-
- var dt = (s.dataType || '').toLowerCase();
- var scr = /(json|script|text)/.test(dt);
- if (scr || s.textarea) {
- // see if user embedded response in textarea
- var ta = doc.getElementsByTagName('textarea')[0];
- if (ta) {
- xhr.responseText = ta.value;
- // support for XHR 'status' & 'statusText' emulation :
- xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
- xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
- }
- else if (scr) {
- // account for browsers injecting pre around json response
- var pre = doc.getElementsByTagName('pre')[0];
- var b = doc.getElementsByTagName('body')[0];
- if (pre) {
- xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
- }
- else if (b) {
- xhr.responseText = b.textContent ? b.textContent : b.innerText;
- }
- }
- }
- else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
- xhr.responseXML = toXml(xhr.responseText);
- }
-
- try {
- data = httpData(xhr, dt, s);
- }
- catch (e) {
- status = 'parsererror';
- xhr.error = errMsg = (e || status);
- }
- }
- catch (e) {
- log('error caught: ',e);
- status = 'error';
- xhr.error = errMsg = (e || status);
- }
-
- if (xhr.aborted) {
- log('upload aborted');
- status = null;
- }
-
- if (xhr.status) { // we've set xhr.status
- status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
- }
-
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
- if (status === 'success') {
- if (s.success)
- s.success.call(s.context, data, 'success', xhr);
- if (g)
- $.event.trigger("ajaxSuccess", [xhr, s]);
- }
- else if (status) {
- if (errMsg === undefined)
- errMsg = xhr.statusText;
- if (s.error)
- s.error.call(s.context, xhr, status, errMsg);
- if (g)
- $.event.trigger("ajaxError", [xhr, s, errMsg]);
- }
-
- if (g)
- $.event.trigger("ajaxComplete", [xhr, s]);
-
- if (g && ! --$.active) {
- $.event.trigger("ajaxStop");
- }
-
- if (s.complete)
- s.complete.call(s.context, xhr, status);
-
- callbackProcessed = true;
- if (s.timeout)
- clearTimeout(timeoutHandle);
-
- // clean up
- setTimeout(function() {
- if (!s.iframeTarget)
- $io.remove();
- xhr.responseXML = null;
- }, 100);
- }
-
- var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
- if (window.ActiveXObject) {
- doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML(s);
- }
- else {
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
- }
- return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
- };
- var parseJSON = $.parseJSON || function(s) {
- /*jslint evil:true */
- return window['eval']('(' + s + ')');
- };
-
- var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
-
- var ct = xhr.getResponseHeader('content-type') || '',
- xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
- data = xml ? xhr.responseXML : xhr.responseText;
-
- if (xml && data.documentElement.nodeName === 'parsererror') {
- if ($.error)
- $.error('parsererror');
- }
- if (s && s.dataFilter) {
- data = s.dataFilter(data, type);
- }
- if (typeof data === 'string') {
- if (type === 'json' || !type && ct.indexOf('json') >= 0) {
- data = parseJSON(data);
- } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
- $.globalEval(data);
- }
- }
- return data;
- };
- }
-};
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- * is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- * used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.
- */
-$.fn.ajaxForm = function(options) {
- options = options || {};
- options.delegation = options.delegation && $.isFunction($.fn.on);
-
- // in jQuery 1.3+ we can fix mistakes with the ready state
- if (!options.delegation && this.length === 0) {
- var o = { s: this.selector, c: this.context };
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing ajaxForm');
- $(function() {
- $(o.s,o.c).ajaxForm(options);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- if ( options.delegation ) {
- $(document)
- .off('submit.form-plugin', this.selector, doAjaxSubmit)
- .off('click.form-plugin', this.selector, captureSubmittingElement)
- .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
- .on('click.form-plugin', this.selector, options, captureSubmittingElement);
- return this;
- }
-
- return this.ajaxFormUnbind()
- .bind('submit.form-plugin', options, doAjaxSubmit)
- .bind('click.form-plugin', options, captureSubmittingElement);
-};
-
-// private event handlers
-function doAjaxSubmit(e) {
- /*jshint validthis:true */
- var options = e.data;
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
- e.preventDefault();
- $(this).ajaxSubmit(options);
- }
-}
-
-function captureSubmittingElement(e) {
- /*jshint validthis:true */
- var target = e.target;
- var $el = $(target);
- if (!($el.is(":submit,input:image"))) {
- // is this a child element of the submit el? (ex: a span within a button)
- var t = $el.closest(':submit');
- if (t.length === 0) {
- return;
- }
- target = t[0];
- }
- var form = this;
- form.clk = target;
- if (target.type == 'image') {
- if (e.offsetX !== undefined) {
- form.clk_x = e.offsetX;
- form.clk_y = e.offsetY;
- } else if (typeof $.fn.offset == 'function') {
- var offset = $el.offset();
- form.clk_x = e.pageX - offset.left;
- form.clk_y = e.pageY - offset.top;
- } else {
- form.clk_x = e.pageX - target.offsetLeft;
- form.clk_y = e.pageY - target.offsetTop;
- }
- }
- // clear form vars
- setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
-}
-
-
-// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
-$.fn.ajaxFormUnbind = function() {
- return this.unbind('submit.form-plugin click.form-plugin');
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property. An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- */
-$.fn.formToArray = function(semantic, elements) {
- var a = [];
- if (this.length === 0) {
- return a;
- }
-
- var form = this[0];
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
- if (!els) {
- return a;
- }
-
- var i,j,n,v,el,max,jmax;
- for(i=0, max=els.length; i < max; i++) {
- el = els[i];
- n = el.name;
- if (!n) {
- continue;
- }
-
- if (semantic && form.clk && el.type == "image") {
- // handle image inputs on the fly when semantic == true
- if(!el.disabled && form.clk == el) {
- a.push({name: n, value: $(el).val(), type: el.type });
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- continue;
- }
-
- v = $.fieldValue(el, true);
- if (v && v.constructor == Array) {
- if (elements)
- elements.push(el);
- for(j=0, jmax=v.length; j < jmax; j++) {
- a.push({name: n, value: v[j]});
- }
- }
- else if (feature.fileapi && el.type == 'file' && !el.disabled) {
- if (elements)
- elements.push(el);
- var files = el.files;
- if (files.length) {
- for (j=0; j < files.length; j++) {
- a.push({name: n, value: files[j], type: el.type});
- }
- }
- else {
- // #180
- a.push({ name: n, value: '', type: el.type });
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- if (elements)
- elements.push(el);
- a.push({name: n, value: v, type: el.type, required: el.required});
- }
- }
-
- if (!semantic && form.clk) {
- // input type=='image' are not found in elements array! handle it here
- var $input = $(form.clk), input = $input[0];
- n = input.name;
- if (n && !input.disabled && input.type == 'image') {
- a.push({name: n, value: $input.val()});
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- }
- return a;
-};
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&amp;name2=value2
- */
-$.fn.formSerialize = function(semantic) {
- //hand off to jQuery.param for proper encoding
- return $.param(this.formToArray(semantic));
-};
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&amp;name2=value2
- */
-$.fn.fieldSerialize = function(successful) {
- var a = [];
- this.each(function() {
- var n = this.name;
- if (!n) {
- return;
- }
- var v = $.fieldValue(this, successful);
- if (v && v.constructor == Array) {
- for (var i=0,max=v.length; i < max; i++) {
- a.push({name: n, value: v[i]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: this.name, value: v});
- }
- });
- //hand off to jQuery.param for proper encoding
- return $.param(a);
-};
-
-/**
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
- *
- * <form><fieldset>
- * <input name="A" type="text" />
- * <input name="A" type="text" />
- * <input name="B" type="checkbox" value="B1" />
- * <input name="B" type="checkbox" value="B2"/>
- * <input name="C" type="radio" value="C1" />
- * <input name="C" type="radio" value="C2" />
- * </fieldset></form>
- *
- * var v = $(':text').fieldValue();
- * // if no values are entered into the text inputs
- * v == ['','']
- * // if values entered into the text inputs are 'foo' and 'bar'
- * v == ['foo','bar']
- *
- * var v = $(':checkbox').fieldValue();
- * // if neither checkbox is checked
- * v === undefined
- * // if both checkboxes are checked
- * v == ['B1', 'B2']
- *
- * var v = $(':radio').fieldValue();
- * // if neither radio is checked
- * v === undefined
- * // if first radio is checked
- * v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array. If no valid value can be determined the
- * array will be empty, otherwise it will contain one or more values.
- */
-$.fn.fieldValue = function(successful) {
- for (var val=[], i=0, max=this.length; i < max; i++) {
- var el = this[i];
- var v = $.fieldValue(el, successful);
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
- continue;
- }
- if (v.constructor == Array)
- $.merge(val, v);
- else
- val.push(v);
- }
- return val;
-};
-
-/**
- * Returns the value of the field element.
- */
-$.fieldValue = function(el, successful) {
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
- if (successful === undefined) {
- successful = true;
- }
-
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
- (t == 'checkbox' || t == 'radio') && !el.checked ||
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
- tag == 'select' && el.selectedIndex == -1)) {
- return null;
- }
-
- if (tag == 'select') {
- var index = el.selectedIndex;
- if (index < 0) {
- return null;
- }
- var a = [], ops = el.options;
- var one = (t == 'select-one');
- var max = (one ? index+1 : ops.length);
- for(var i=(one ? index : 0); i < max; i++) {
- var op = ops[i];
- if (op.selected) {
- var v = op.value;
- if (!v) { // extra pain for IE...
- v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
- }
- if (one) {
- return v;
- }
- a.push(v);
- }
- }
- return a;
- }
- return $(el).val();
-};
-
-/**
- * Clears the form data. Takes the following actions on the form's input fields:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- */
-$.fn.clearForm = function(includeHidden) {
- return this.each(function() {
- $('input,select,textarea', this).clearFields(includeHidden);
- });
-};
-
-/**
- * Clears the selected form elements.
- */
-$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
- var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
- return this.each(function() {
- var t = this.type, tag = this.tagName.toLowerCase();
- if (re.test(t) || tag == 'textarea') {
- this.value = '';
- }
- else if (t == 'checkbox' || t == 'radio') {
- this.checked = false;
- }
- else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- else if (includeHidden) {
- // includeHidden can be the value true, or it can be a selector string
- // indicating a special test; for example:
- // $('#myForm').clearForm('.special:hidden')
- // the above would clean hidden inputs that have the class of 'special'
- if ( (includeHidden === true && /hidden/.test(t)) ||
- (typeof includeHidden == 'string' && $(this).is(includeHidden)) )
- this.value = '';
- }
- });
-};
-
-/**
- * Resets the form data. Causes all form elements to be reset to their original value.
- */
-$.fn.resetForm = function() {
- return this.each(function() {
- // guard against an input with the name of 'reset'
- // note that IE reports the reset function as an 'object'
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
- this.reset();
- }
- });
-};
-
-/**
- * Enables or disables any matching elements.
- */
-$.fn.enable = function(b) {
- if (b === undefined) {
- b = true;
- }
- return this.each(function() {
- this.disabled = !b;
- });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- */
-$.fn.selected = function(select) {
- if (select === undefined) {
- select = true;
- }
- return this.each(function() {
- var t = this.type;
- if (t == 'checkbox' || t == 'radio') {
- this.checked = select;
- }
- else if (this.tagName.toLowerCase() == 'option') {
- var $sel = $(this).parent('select');
- if (select && $sel[0] && $sel[0].type == 'select-one') {
- // deselect all other options
- $sel.find('option').selected(false);
- }
- this.selected = select;
- }
- });
-};
-
-// expose debug var
-$.fn.ajaxSubmit.debug = false;
-
-// helper fn for console logging
-function log() {
- if (!$.fn.ajaxSubmit.debug)
- return;
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
- if (window.console && window.console.log) {
- window.console.log(msg);
- }
- else if (window.opera && window.opera.postError) {
- window.opera.postError(msg);
- }
-}
-
-})(jQuery);
diff --git a/resources/jquery/jquery.getAttrs.js b/resources/jquery/jquery.getAttrs.js
deleted file mode 100644
index 25b806b6..00000000
--- a/resources/jquery/jquery.getAttrs.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Utility to get all attributes of an element directy as an object.
- *
- * @author Timo Tijhof, 2011
- */
-jQuery.fn.getAttrs = function ( all ) {
- var map = this[0].attributes,
- attrs = {},
- len = map.length,
- i, v;
-
- for ( i = 0; i < len; i++ ) {
- // IE6 includes *all* allowed attributes for thew element (including those
- // not set). Those have values like undefined, null, 0, false, "" or "inherit".
- // However there may be genuine attributes set to that. If you need them,
- // set all to true. They are excluded by default.
- v = map[i].nodeValue;
- if ( all || ( v && v !== 'inherit' ) ) {
- attrs[ map[i].nodeName ] = v;
- }
- }
-
- return attrs;
-};
diff --git a/resources/jquery/jquery.hidpi.js b/resources/jquery/jquery.hidpi.js
deleted file mode 100644
index 70bfc4ea..00000000
--- a/resources/jquery/jquery.hidpi.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Responsive images based on 'srcset' and 'window.devicePixelRatio' emulation where needed.
- *
- * Call $().hidpi() on a document or part of a document to replace image srcs in that section.
- *
- * $.devicePixelRatio() can be used to supplement window.devicePixelRatio with support on
- * some additional browsers.
- */
-( function ( $ ) {
-
-/**
- * Detect reported or approximate device pixel ratio.
- * 1.0 means 1 CSS pixel is 1 hardware pixel
- * 2.0 means 1 CSS pixel is 2 hardware pixels
- * etc
- *
- * Uses window.devicePixelRatio if available, or CSS media queries on IE.
- *
- * @method
- * @returns {number} Device pixel ratio
- */
-$.devicePixelRatio = function () {
- if ( window.devicePixelRatio !== undefined ) {
- // Most web browsers:
- // * WebKit (Safari, Chrome, Android browser, etc)
- // * Opera
- // * Firefox 18+
- return window.devicePixelRatio;
- } else if ( window.msMatchMedia !== undefined ) {
- // Windows 8 desktops / tablets, probably Windows Phone 8
- //
- // IE 10 doesn't report pixel ratio directly, but we can get the
- // screen DPI and divide by 96. We'll bracket to [1, 1.5, 2.0] for
- // simplicity, but you may get different values depending on zoom
- // factor, size of screen and orientation in Metro IE.
- if ( window.msMatchMedia( '(min-resolution: 192dpi)' ).matches ) {
- return 2;
- } else if ( window.msMatchMedia( '(min-resolution: 144dpi)' ).matches ) {
- return 1.5;
- } else {
- return 1;
- }
- } else {
- // Legacy browsers...
- // Assume 1 if unknown.
- return 1;
- }
-};
-
-/**
- * Implement responsive images based on srcset attributes, if browser has no
- * native srcset support.
- *
- * @method
- * @returns {jQuery} This selection
- */
-$.fn.hidpi = function () {
- var $target = this,
- // @todo add support for dpi media query checks on Firefox, IE
- devicePixelRatio = $.devicePixelRatio(),
- testImage = new Image();
-
- if ( devicePixelRatio > 1 && testImage.srcset === undefined ) {
- // No native srcset support.
- $target.find( 'img' ).each( function () {
- var $img = $( this ),
- srcset = $img.attr( 'srcset' ),
- match;
- if ( typeof srcset === 'string' && srcset !== '' ) {
- match = $.matchSrcSet( devicePixelRatio, srcset );
- if (match !== null ) {
- $img.attr( 'src', match );
- }
- }
- });
- }
-
- return $target;
-};
-
-/**
- * Match a srcset entry for the given device pixel ratio
- *
- * @param {number} devicePixelRatio
- * @param {string} srcset
- * @return {mixed} null or the matching src string
- *
- * Exposed for testing.
- */
-$.matchSrcSet = function ( devicePixelRatio, srcset ) {
- var candidates,
- candidate,
- bits,
- src,
- i,
- ratioStr,
- ratio,
- selectedRatio = 1,
- selectedSrc = null;
- candidates = srcset.split( / *, */ );
- for ( i = 0; i < candidates.length; i++ ) {
- candidate = candidates[i];
- bits = candidate.split( / +/ );
- src = bits[0];
- if ( bits.length > 1 && bits[1].charAt( bits[1].length - 1 ) === 'x' ) {
- ratioStr = bits[1].substr( 0, bits[1].length - 1 );
- ratio = parseFloat( ratioStr );
- if ( ratio <= devicePixelRatio && ratio > selectedRatio ) {
- selectedRatio = ratio;
- selectedSrc = src;
- }
- }
- }
- return selectedSrc;
-};
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.highlightText.js b/resources/jquery/jquery.highlightText.js
deleted file mode 100644
index cda2765b..00000000
--- a/resources/jquery/jquery.highlightText.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Plugin that highlights matched word partials in a given element.
- * TODO: Add a function for restoring the previous text.
- * TODO: Accept mappings for converting shortcuts like WP: to Wikipedia:.
- */
-( function ( $ ) {
-
- $.highlightText = {
-
- // Split our pattern string at spaces and run our highlight function on the results
- splitAndHighlight: function ( node, pat ) {
- var i,
- patArray = pat.split( ' ' );
- for ( i = 0; i < patArray.length; i++ ) {
- if ( patArray[i].length === 0 ) {
- continue;
- }
- $.highlightText.innerHighlight( node, patArray[i] );
- }
- return node;
- },
-
- // scans a node looking for the pattern and wraps a span around each match
- innerHighlight: function ( node, pat ) {
- var i, match, pos, spannode, middlebit, middleclone;
- // if this is a text node
- if ( node.nodeType === 3 ) {
- // TODO - need to be smarter about the character matching here.
- // non latin characters can make regex think a new word has begun: do not use \b
- // http://stackoverflow.com/questions/3787072/regex-wordwrap-with-utf8-characters-in-js
- // look for an occurrence of our pattern and store the starting position
- match = node.data.match( new RegExp( '(^|\\s)' + $.escapeRE( pat ), 'i' ) );
- if ( match ) {
- pos = match.index + match[1].length; // include length of any matched spaces
- // create the span wrapper for the matched text
- spannode = document.createElement( 'span' );
- spannode.className = 'highlight';
- // shave off the characters preceding the matched text
- middlebit = node.splitText( pos );
- // shave off any unmatched text off the end
- middlebit.splitText( pat.length );
- // clone for appending to our span
- middleclone = middlebit.cloneNode( true );
- // append the matched text node to the span
- spannode.appendChild( middleclone );
- // replace the matched node, with our span-wrapped clone of the matched node
- middlebit.parentNode.replaceChild( spannode, middlebit );
- }
- // if this is an element with childnodes, and not a script, style or an element we created
- } else if ( node.nodeType === 1 && node.childNodes && !/(script|style)/i.test( node.tagName )
- && !( node.tagName.toLowerCase() === 'span' && node.className.match( /\bhighlight/ ) ) ) {
- for ( i = 0; i < node.childNodes.length; ++i ) {
- // call the highlight function for each child node
- $.highlightText.innerHighlight( node.childNodes[i], pat );
- }
- }
- }
- };
-
- $.fn.highlightText = function ( matchString ) {
- return this.each( function () {
- var $el = $( this );
- $el.data( 'highlightText', { originalText: $el.text() } );
- $.highlightText.splitAndHighlight( this, matchString );
- } );
- };
-
-}( jQuery ) );
-
diff --git a/resources/jquery/jquery.hoverIntent.js b/resources/jquery/jquery.hoverIntent.js
deleted file mode 100644
index adf948df..00000000
--- a/resources/jquery/jquery.hoverIntent.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
-* hoverIntent is similar to jQuery's built-in "hover" function except that
-* instead of firing the onMouseOver event immediately, hoverIntent checks
-* to see if the user's mouse has slowed down (beneath the sensitivity
-* threshold) before firing the onMouseOver event.
-*
-* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
-* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
-*
-* hoverIntent is currently available for use in all personal or commercial
-* projects under both MIT and GPL licenses. This means that you can choose
-* the license that best suits your project, and use it accordingly.
-*
-* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
-* $("ul li").hoverIntent( showNav , hideNav );
-*
-* // advanced usage receives configuration object only
-* $("ul li").hoverIntent({
-* sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
-* interval: 100, // number = milliseconds of polling interval
-* over: showNav, // function = onMouseOver callback (required)
-* timeout: 0, // number = milliseconds delay before onMouseOut function call
-* out: hideNav // function = onMouseOut callback (required)
-* });
-*
-* @param f onMouseOver function || An object with configuration options
-* @param g onMouseOut function || Nothing (use configuration options object)
-* @author Brian Cherne <brian@cherne.net>
-*/
-(function($) {
- $.fn.hoverIntent = function(f,g) {
- // default configuration options
- var cfg = {
- sensitivity: 7,
- interval: 100,
- timeout: 0
- };
- // override configuration options with user supplied object
- cfg = $.extend(cfg, g ? { over: f, out: g } : f );
-
- // instantiate variables
- // cX, cY = current X and Y position of mouse, updated by mousemove event
- // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
- var cX, cY, pX, pY;
-
- // A private function for getting mouse position
- var track = function(ev) {
- cX = ev.pageX;
- cY = ev.pageY;
- };
-
- // A private function for comparing current and previous mouse position
- var compare = function(ev,ob) {
- ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
- // compare mouse positions to see if they've crossed the threshold
- if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
- $(ob).unbind("mousemove",track);
- // set hoverIntent state to true (so mouseOut can be called)
- ob.hoverIntent_s = 1;
- return cfg.over.apply(ob,[ev]);
- } else {
- // set previous coordinates for next time
- pX = cX; pY = cY;
- // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
- ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
- }
- };
-
- // A private function for delaying the mouseOut function
- var delay = function(ev,ob) {
- ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
- ob.hoverIntent_s = 0;
- return cfg.out.apply(ob,[ev]);
- };
-
- // A private function for handling mouse 'hovering'
- var handleHover = function(e) {
- // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
- var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
- while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
- if ( p == this ) { return false; }
-
- // copy objects to be passed into t (required for event object to be passed in IE)
- var ev = $.extend({},e);
- var ob = this;
-
- // cancel hoverIntent timer if it exists
- if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
-
- // else e.type == "onmouseover"
- if (e.type == "mouseover") {
- // set "previous" X and Y position based on initial entry point
- pX = ev.pageX; pY = ev.pageY;
- // update "current" X and Y position based on mousemove
- $(ob).bind("mousemove",track);
- // start polling interval (self-calling timeout) to compare mouse coordinates over time
- if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
-
- // else e.type == "onmouseout"
- } else {
- // unbind expensive mousemove event
- $(ob).unbind("mousemove",track);
- // if hoverIntent state is true, then call the mouseOut function after the specified delay
- if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
- }
- };
-
- // bind the function to the two event listeners
- return this.mouseover(handleHover).mouseout(handleHover);
- };
-})(jQuery); \ No newline at end of file
diff --git a/resources/jquery/jquery.jStorage.js b/resources/jquery/jquery.jStorage.js
deleted file mode 100644
index 6ca21b5c..00000000
--- a/resources/jquery/jquery.jStorage.js
+++ /dev/null
@@ -1,1143 +0,0 @@
-/*
- * ----------------------------- JSTORAGE -------------------------------------
- * Simple local storage wrapper to save data on the browser side, supporting
- * all major browsers - IE6+, Firefox2+, Safari4+, Chrome4+ and Opera 10.5+
- *
- * Copyright (c) 2010 - 2012 Andris Reinman, andris.reinman@gmail.com
- * Project homepage: www.jstorage.info
- *
- * Licensed under MIT-style license:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
- (function(){
- var
- /* jStorage version */
- JSTORAGE_VERSION = "0.3.0",
-
- /* detect a dollar object or create one if not found */
- $ = window.jQuery || window.$ || (window.$ = {}),
-
- /* check for a JSON handling support */
- JSON = {
- parse:
- window.JSON && (window.JSON.parse || window.JSON.decode) ||
- String.prototype.evalJSON && function(str){return String(str).evalJSON();} ||
- $.parseJSON ||
- $.evalJSON,
- stringify:
- Object.toJSON ||
- window.JSON && (window.JSON.stringify || window.JSON.encode) ||
- $.toJSON
- };
-
- // Break if no JSON support was found
- if(!JSON.parse || !JSON.stringify){
- throw new Error("No JSON support found, include //cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js to page");
- }
-
- var
- /* This is the object, that holds the cached values */
- _storage = {},
-
- /* Actual browser storage (localStorage or globalStorage['domain']) */
- _storage_service = {jStorage:"{}"},
-
- /* DOM element for older IE versions, holds userData behavior */
- _storage_elm = null,
-
- /* How much space does the storage take */
- _storage_size = 0,
-
- /* which backend is currently used */
- _backend = false,
-
- /* onchange observers */
- _observers = {},
-
- /* timeout to wait after onchange event */
- _observer_timeout = false,
-
- /* last update time */
- _observer_update = 0,
-
- /* pubsub observers */
- _pubsub_observers = {},
-
- /* skip published items older than current timestamp */
- _pubsub_last = +new Date(),
-
- /* Next check for TTL */
- _ttl_timeout,
-
- /* crc32 table */
- _crc32Table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 "+
- "0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 "+
- "6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 "+
- "FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 "+
- "A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 "+
- "32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 "+
- "56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 "+
- "C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 "+
- "E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 "+
- "6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 "+
- "12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE "+
- "A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 "+
- "DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 "+
- "5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 "+
- "2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF "+
- "04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 "+
- "7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 "+
- "FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 "+
- "A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C "+
- "36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 "+
- "5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 "+
- "C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 "+
- "EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D "+
- "7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 "+
- "18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 "+
- "A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A "+
- "D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A "+
- "53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 "+
- "2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D",
-
- /**
- * XML encoding and decoding as XML nodes can't be JSON'ized
- * XML nodes are encoded and decoded if the node is the value to be saved
- * but not if it's as a property of another object
- * Eg. -
- * $.jStorage.set("key", xmlNode); // IS OK
- * $.jStorage.set("key", {xml: xmlNode}); // NOT OK
- */
- _XMLService = {
-
- /**
- * Validates a XML node to be XML
- * based on jQuery.isXML function
- */
- isXML: function(elm){
- var documentElement = (elm ? elm.ownerDocument || elm : 0).documentElement;
- return documentElement ? documentElement.nodeName !== "HTML" : false;
- },
-
- /**
- * Encodes a XML node to string
- * based on http://www.mercurytide.co.uk/news/article/issues-when-working-ajax/
- */
- encode: function(xmlNode) {
- if(!this.isXML(xmlNode)){
- return false;
- }
- try{ // Mozilla, Webkit, Opera
- return new XMLSerializer().serializeToString(xmlNode);
- }catch(E1) {
- try { // IE
- return xmlNode.xml;
- }catch(E2){}
- }
- return false;
- },
-
- /**
- * Decodes a XML node from string
- * loosely based on http://outwestmedia.com/jquery-plugins/xmldom/
- */
- decode: function(xmlString){
- var dom_parser = ("DOMParser" in window && (new DOMParser()).parseFromString) ||
- (window.ActiveXObject && function(_xmlString) {
- var xml_doc = new ActiveXObject('Microsoft.XMLDOM');
- xml_doc.async = 'false';
- xml_doc.loadXML(_xmlString);
- return xml_doc;
- }),
- resultXML;
- if(!dom_parser){
- return false;
- }
- resultXML = dom_parser.call("DOMParser" in window && (new DOMParser()) || window, xmlString, 'text/xml');
- return this.isXML(resultXML)?resultXML:false;
- }
- },
-
- _localStoragePolyfillSetKey = function(){};
-
-
- ////////////////////////// PRIVATE METHODS ////////////////////////
-
- /**
- * Initialization function. Detects if the browser supports DOM Storage
- * or userData behavior and behaves accordingly.
- */
- function _init(){
- /* Check if browser supports localStorage */
- var localStorageReallyWorks = false;
- if("localStorage" in window){
- try {
- window.localStorage.setItem('_tmptest', 'tmpval');
- localStorageReallyWorks = true;
- window.localStorage.removeItem('_tmptest');
- } catch(BogusQuotaExceededErrorOnIos5) {
- // Thanks be to iOS5 Private Browsing mode which throws
- // QUOTA_EXCEEDED_ERRROR DOM Exception 22.
- }
- }
-
- if(localStorageReallyWorks){
- try {
- if(window.localStorage) {
- _storage_service = window.localStorage;
- _backend = "localStorage";
- _observer_update = _storage_service.jStorage_update;
- }
- } catch(E3) {/* Firefox fails when touching localStorage and cookies are disabled */}
- }
- /* Check if browser supports globalStorage */
- else if("globalStorage" in window){
- try {
- if(window.globalStorage) {
- _storage_service = window.globalStorage[window.location.hostname];
- _backend = "globalStorage";
- _observer_update = _storage_service.jStorage_update;
- }
- } catch(E4) {/* Firefox fails when touching localStorage and cookies are disabled */}
- }
- /* Check if browser supports userData behavior */
- else {
- _storage_elm = document.createElement('link');
- if(_storage_elm.addBehavior){
-
- /* Use a DOM element to act as userData storage */
- _storage_elm.style.behavior = 'url(#default#userData)';
-
- /* userData element needs to be inserted into the DOM! */
- document.getElementsByTagName('head')[0].appendChild(_storage_elm);
-
- try{
- _storage_elm.load("jStorage");
- }catch(E){
- // try to reset cache
- _storage_elm.setAttribute("jStorage", "{}");
- _storage_elm.save("jStorage");
- _storage_elm.load("jStorage");
- }
-
- var data = "{}";
- try{
- data = _storage_elm.getAttribute("jStorage");
- }catch(E5){}
-
- try{
- _observer_update = _storage_elm.getAttribute("jStorage_update");
- }catch(E6){}
-
- _storage_service.jStorage = data;
- _backend = "userDataBehavior";
- }else{
- _storage_elm = null;
- return;
- }
- }
-
- // Load data from storage
- _load_storage();
-
- // remove dead keys
- _handleTTL();
-
- // create localStorage and sessionStorage polyfills if needed
- _createPolyfillStorage("local");
- _createPolyfillStorage("session");
-
- // start listening for changes
- _setupObserver();
-
- // initialize publish-subscribe service
- _handlePubSub();
-
- // handle cached navigation
- if("addEventListener" in window){
- window.addEventListener("pageshow", function(event){
- if(event.persisted){
- _storageObserver();
- }
- }, false);
- }
- }
-
- /**
- * Create a polyfill for localStorage (type="local") or sessionStorage (type="session")
- *
- * @param {String} type Either "local" or "session"
- * @param {Boolean} forceCreate If set to true, recreate the polyfill (needed with flush)
- */
- function _createPolyfillStorage(type, forceCreate){
- var _skipSave = false,
- _length = 0,
- i,
- storage,
- storage_source = {};
-
- var rand = Math.random();
-
- if(!forceCreate && typeof window[type+"Storage"] != "undefined"){
- return;
- }
-
- // Use globalStorage for localStorage if available
- if(type == "local" && window.globalStorage){
- localStorage = window.globalStorage[window.location.hostname];
- return;
- }
-
- // only IE6/7 from this point on
- if(_backend != "userDataBehavior"){
- return;
- }
-
- // Remove existing storage element if available
- if(forceCreate && window[type+"Storage"] && window[type+"Storage"].parentNode){
- window[type+"Storage"].parentNode.removeChild(window[type+"Storage"]);
- }
-
- storage = document.createElement("button");
- document.getElementsByTagName('head')[0].appendChild(storage);
-
- if(type == "local"){
- storage_source = _storage;
- }else if(type == "session"){
- _sessionStoragePolyfillUpdate();
- }
-
- for(i in storage_source){
-
- if(storage_source.hasOwnProperty(i) && i != "__jstorage_meta" && i != "length" && typeof storage_source[i] != "undefined"){
- if(!(i in storage)){
- _length++;
- }
- storage[i] = storage_source[i];
- }
- }
-
- // Polyfill API
-
- /**
- * Indicates how many keys are stored in the storage
- */
- storage.length = _length;
-
- /**
- * Returns the key of the nth stored value
- *
- * @param {Number} n Index position
- * @return {String} Key name of the nth stored value
- */
- storage.key = function(n){
- var count = 0, i;
- _sessionStoragePolyfillUpdate();
- for(i in storage_source){
- if(storage_source.hasOwnProperty(i) && i != "__jstorage_meta" && i!="length" && typeof storage_source[i] != "undefined"){
- if(count == n){
- return i;
- }
- count++;
- }
- }
- }
-
- /**
- * Returns the current value associated with the given key
- *
- * @param {String} key key name
- * @return {Mixed} Stored value
- */
- storage.getItem = function(key){
- _sessionStoragePolyfillUpdate();
- if(type == "session"){
- return storage_source[key];
- }
- return $.jStorage.get(key);
- }
-
- /**
- * Sets or updates value for a give key
- *
- * @param {String} key Key name to be updated
- * @param {String} value String value to be stored
- */
- storage.setItem = function(key, value){
- if(typeof value == "undefined"){
- return;
- }
- storage[key] = (value || "").toString();
- }
-
- /**
- * Removes key from the storage
- *
- * @param {String} key Key name to be removed
- */
- storage.removeItem = function(key){
- if(type == "local"){
- return $.jStorage.deleteKey(key);
- }
-
- storage[key] = undefined;
-
- _skipSave = true;
- if(key in storage){
- storage.removeAttribute(key);
- }
- _skipSave = false;
- }
-
- /**
- * Clear storage
- */
- storage.clear = function(){
- if(type == "session"){
- window.name = "";
- _createPolyfillStorage("session", true);
- return;
- }
- $.jStorage.flush();
- }
-
- if(type == "local"){
-
- _localStoragePolyfillSetKey = function(key, value){
- if(key == "length"){
- return;
- }
- _skipSave = true;
- if(typeof value == "undefined"){
- if(key in storage){
- _length--;
- storage.removeAttribute(key);
- }
- }else{
- if(!(key in storage)){
- _length++;
- }
- storage[key] = (value || "").toString();
- }
- storage.length = _length;
- _skipSave = false;
- }
- }
-
- function _sessionStoragePolyfillUpdate(){
- if(type != "session"){
- return;
- }
- try{
- storage_source = JSON.parse(window.name || "{}");
- }catch(E){
- storage_source = {};
- }
- }
-
- function _sessionStoragePolyfillSave(){
- if(type != "session"){
- return;
- }
- window.name = JSON.stringify(storage_source);
- };
-
- storage.attachEvent("onpropertychange", function(e){
- if(e.propertyName == "length"){
- return;
- }
-
- if(_skipSave || e.propertyName == "length"){
- return;
- }
-
- if(type == "local"){
- if(!(e.propertyName in storage_source) && typeof storage[e.propertyName] != "undefined"){
- _length ++;
- }
- }else if(type == "session"){
- _sessionStoragePolyfillUpdate();
- if(typeof storage[e.propertyName] != "undefined" && !(e.propertyName in storage_source)){
- storage_source[e.propertyName] = storage[e.propertyName];
- _length++;
- }else if(typeof storage[e.propertyName] == "undefined" && e.propertyName in storage_source){
- delete storage_source[e.propertyName];
- _length--;
- }else{
- storage_source[e.propertyName] = storage[e.propertyName];
- }
-
- _sessionStoragePolyfillSave();
- storage.length = _length;
- return;
- }
-
- $.jStorage.set(e.propertyName, storage[e.propertyName]);
- storage.length = _length;
- });
-
- window[type+"Storage"] = storage;
- }
-
- /**
- * Reload data from storage when needed
- */
- function _reloadData(){
- var data = "{}";
-
- if(_backend == "userDataBehavior"){
- _storage_elm.load("jStorage");
-
- try{
- data = _storage_elm.getAttribute("jStorage");
- }catch(E5){}
-
- try{
- _observer_update = _storage_elm.getAttribute("jStorage_update");
- }catch(E6){}
-
- _storage_service.jStorage = data;
- }
-
- _load_storage();
-
- // remove dead keys
- _handleTTL();
-
- _handlePubSub();
- }
-
- /**
- * Sets up a storage change observer
- */
- function _setupObserver(){
- if(_backend == "localStorage" || _backend == "globalStorage"){
- if("addEventListener" in window){
- window.addEventListener("storage", _storageObserver, false);
- }else{
- document.attachEvent("onstorage", _storageObserver);
- }
- }else if(_backend == "userDataBehavior"){
- setInterval(_storageObserver, 1000);
- }
- }
-
- /**
- * Fired on any kind of data change, needs to check if anything has
- * really been changed
- */
- function _storageObserver(){
- var updateTime;
- // cumulate change notifications with timeout
- clearTimeout(_observer_timeout);
- _observer_timeout = setTimeout(function(){
-
- if(_backend == "localStorage" || _backend == "globalStorage"){
- updateTime = _storage_service.jStorage_update;
- }else if(_backend == "userDataBehavior"){
- _storage_elm.load("jStorage");
- try{
- updateTime = _storage_elm.getAttribute("jStorage_update");
- }catch(E5){}
- }
-
- if(updateTime && updateTime != _observer_update){
- _observer_update = updateTime;
- _checkUpdatedKeys();
- }
-
- }, 25);
- }
-
- /**
- * Reloads the data and checks if any keys are changed
- */
- function _checkUpdatedKeys(){
- var oldCrc32List = JSON.parse(JSON.stringify(_storage.__jstorage_meta.CRC32)),
- newCrc32List;
-
- _reloadData();
- newCrc32List = JSON.parse(JSON.stringify(_storage.__jstorage_meta.CRC32));
-
- var key,
- updated = [],
- removed = [];
-
- for(key in oldCrc32List){
- if(oldCrc32List.hasOwnProperty(key)){
- if(!newCrc32List[key]){
- removed.push(key);
- continue;
- }
- if(oldCrc32List[key] != newCrc32List[key]){
- updated.push(key);
- }
- }
- }
-
- for(key in newCrc32List){
- if(newCrc32List.hasOwnProperty(key)){
- if(!oldCrc32List[key]){
- updated.push(key);
- }
- }
- }
-
- _fireObservers(updated, "updated");
- _fireObservers(removed, "deleted");
- }
-
- /**
- * Fires observers for updated keys
- *
- * @param {Array|String} keys Array of key names or a key
- * @param {String} action What happened with the value (updated, deleted, flushed)
- */
- function _fireObservers(keys, action){
- keys = [].concat(keys || []);
- if(action == "flushed"){
- keys = [];
- for(var key in _observers){
- if(_observers.hasOwnProperty(key)){
- keys.push(key);
- }
- }
- action = "deleted";
- }
- for(var i=0, len = keys.length; i<len; i++){
- if(_observers[keys[i]]){
- for(var j=0, jlen = _observers[keys[i]].length; j<jlen; j++){
- _observers[keys[i]][j](keys[i], action);
- }
- }
- }
- }
-
- /**
- * Publishes key change to listeners
- */
- function _publishChange(){
- var updateTime = (+new Date()).toString();
-
- if(_backend == "localStorage" || _backend == "globalStorage"){
- _storage_service.jStorage_update = updateTime;
- }else if(_backend == "userDataBehavior"){
- _storage_elm.setAttribute("jStorage_update", updateTime);
- _storage_elm.save("jStorage");
- }
-
- _storageObserver();
- }
-
- /**
- * Loads the data from the storage based on the supported mechanism
- */
- function _load_storage(){
- /* if jStorage string is retrieved, then decode it */
- if(_storage_service.jStorage){
- try{
- _storage = JSON.parse(String(_storage_service.jStorage));
- }catch(E6){_storage_service.jStorage = "{}";}
- }else{
- _storage_service.jStorage = "{}";
- }
- _storage_size = _storage_service.jStorage?String(_storage_service.jStorage).length:0;
-
- if(!_storage.__jstorage_meta){
- _storage.__jstorage_meta = {};
- }
- if(!_storage.__jstorage_meta.CRC32){
- _storage.__jstorage_meta.CRC32 = {};
- }
- }
-
- /**
- * This functions provides the "save" mechanism to store the jStorage object
- */
- function _save(){
- _dropOldEvents(); // remove expired events
- try{
- _storage_service.jStorage = JSON.stringify(_storage);
- // If userData is used as the storage engine, additional
- if(_storage_elm) {
- _storage_elm.setAttribute("jStorage",_storage_service.jStorage);
- _storage_elm.save("jStorage");
- }
- _storage_size = _storage_service.jStorage?String(_storage_service.jStorage).length:0;
- }catch(E7){/* probably cache is full, nothing is saved this way*/}
- }
-
- /**
- * Function checks if a key is set and is string or numberic
- *
- * @param {String} key Key name
- */
- function _checkKey(key){
- if(!key || (typeof key != "string" && typeof key != "number")){
- throw new TypeError('Key name must be string or numeric');
- }
- if(key == "__jstorage_meta"){
- throw new TypeError('Reserved key name');
- }
- return true;
- }
-
- /**
- * Removes expired keys
- */
- function _handleTTL(){
- var curtime, i, TTL, CRC32, nextExpire = Infinity, changed = false, deleted = [];
-
- clearTimeout(_ttl_timeout);
-
- if(!_storage.__jstorage_meta || typeof _storage.__jstorage_meta.TTL != "object"){
- // nothing to do here
- return;
- }
-
- curtime = +new Date();
- TTL = _storage.__jstorage_meta.TTL;
-
- CRC32 = _storage.__jstorage_meta.CRC32;
- for(i in TTL){
- if(TTL.hasOwnProperty(i)){
- if(TTL[i] <= curtime){
- delete TTL[i];
- delete CRC32[i];
- delete _storage[i];
- changed = true;
- deleted.push(i);
- }else if(TTL[i] < nextExpire){
- nextExpire = TTL[i];
- }
- }
- }
-
- // set next check
- if(nextExpire != Infinity){
- _ttl_timeout = setTimeout(_handleTTL, nextExpire - curtime);
- }
-
- // save changes
- if(changed){
- _save();
- _publishChange();
- _fireObservers(deleted, "deleted");
- }
- }
-
- /**
- * Checks if there's any events on hold to be fired to listeners
- */
- function _handlePubSub(){
- if(!_storage.__jstorage_meta.PubSub){
- return;
- }
- var pubelm,
- _pubsubCurrent = _pubsub_last;
-
- for(var i=len=_storage.__jstorage_meta.PubSub.length-1; i>=0; i--){
- pubelm = _storage.__jstorage_meta.PubSub[i];
- if(pubelm[0] > _pubsub_last){
- _pubsubCurrent = pubelm[0];
- _fireSubscribers(pubelm[1], pubelm[2]);
- }
- }
-
- _pubsub_last = _pubsubCurrent;
- }
-
- /**
- * Fires all subscriber listeners for a pubsub channel
- *
- * @param {String} channel Channel name
- * @param {Mixed} payload Payload data to deliver
- */
- function _fireSubscribers(channel, payload){
- if(_pubsub_observers[channel]){
- for(var i=0, len = _pubsub_observers[channel].length; i<len; i++){
- // send immutable data that can't be modified by listeners
- _pubsub_observers[channel][i](channel, JSON.parse(JSON.stringify(payload)));
- }
- }
- }
-
- /**
- * Remove old events from the publish stream (at least 2sec old)
- */
- function _dropOldEvents(){
- if(!_storage.__jstorage_meta.PubSub){
- return;
- }
-
- var retire = +new Date() - 2000;
-
- for(var i=0, len = _storage.__jstorage_meta.PubSub.length; i<len; i++){
- if(_storage.__jstorage_meta.PubSub[i][0] <= retire){
- // deleteCount is needed for IE6
- _storage.__jstorage_meta.PubSub.splice(i, _storage.__jstorage_meta.PubSub.length - i);
- break;
- }
- }
-
- if(!_storage.__jstorage_meta.PubSub.length){
- delete _storage.__jstorage_meta.PubSub;
- }
-
- }
-
- /**
- * Publish payload to a channel
- *
- * @param {String} channel Channel name
- * @param {Mixed} payload Payload to send to the subscribers
- */
- function _publish(channel, payload){
- if(!_storage.__jstorage_meta){
- _storage.__jstorage_meta = {};
- }
- if(!_storage.__jstorage_meta.PubSub){
- _storage.__jstorage_meta.PubSub = [];
- }
-
- _storage.__jstorage_meta.PubSub.unshift([+new Date, channel, payload]);
-
- _save();
- _publishChange();
- }
-
- /**
- * CRC32 calculation based on http://noteslog.com/post/crc32-for-javascript/
- *
- * @param {String} str String to be hashed
- * @param {Number} [crc] Last crc value in case of streams
- */
- function _crc32(str, crc){
- crc = crc || 0;
-
- var n = 0, //a number between 0 and 255
- x = 0; //an hex number
-
- crc = crc ^ (-1);
- for(var i = 0, len = str.length; i < len; i++){
- n = (crc ^ str.charCodeAt(i)) & 0xFF;
- x = "0x" + _crc32Table.substr(n * 9, 8);
- crc = (crc >>> 8)^x;
- }
- return crc^(-1);
- }
-
- ////////////////////////// PUBLIC INTERFACE /////////////////////////
-
- $.jStorage = {
- /* Version number */
- version: JSTORAGE_VERSION,
-
- /**
- * Sets a key's value.
- *
- * @param {String} key Key to set. If this value is not set or not
- * a string an exception is raised.
- * @param {Mixed} value Value to set. This can be any value that is JSON
- * compatible (Numbers, Strings, Objects etc.).
- * @param {Object} [options] - possible options to use
- * @param {Number} [options.TTL] - optional TTL value
- * @return {Mixed} the used value
- */
- set: function(key, value, options){
- _checkKey(key);
-
- options = options || {};
-
- // undefined values are deleted automatically
- if(typeof value == "undefined"){
- this.deleteKey(key);
- return value;
- }
-
- if(_XMLService.isXML(value)){
- value = {_is_xml:true,xml:_XMLService.encode(value)};
- }else if(typeof value == "function"){
- return undefined; // functions can't be saved!
- }else if(value && typeof value == "object"){
- // clone the object before saving to _storage tree
- value = JSON.parse(JSON.stringify(value));
- }
-
- _storage[key] = value;
-
- _storage.__jstorage_meta.CRC32[key] = _crc32(JSON.stringify(value));
-
- this.setTTL(key, options.TTL || 0); // also handles saving and _publishChange
-
- _localStoragePolyfillSetKey(key, value);
-
- _fireObservers(key, "updated");
- return value;
- },
-
- /**
- * Looks up a key in cache
- *
- * @param {String} key - Key to look up.
- * @param {mixed} def - Default value to return, if key didn't exist.
- * @return {Mixed} the key value, default value or null
- */
- get: function(key, def){
- _checkKey(key);
- if(key in _storage){
- if(_storage[key] && typeof _storage[key] == "object" &&
- _storage[key]._is_xml &&
- _storage[key]._is_xml){
- return _XMLService.decode(_storage[key].xml);
- }else{
- return _storage[key];
- }
- }
- return typeof(def) == 'undefined' ? null : def;
- },
-
- /**
- * Deletes a key from cache.
- *
- * @param {String} key - Key to delete.
- * @return {Boolean} true if key existed or false if it didn't
- */
- deleteKey: function(key){
- _checkKey(key);
- if(key in _storage){
- delete _storage[key];
- // remove from TTL list
- if(typeof _storage.__jstorage_meta.TTL == "object" &&
- key in _storage.__jstorage_meta.TTL){
- delete _storage.__jstorage_meta.TTL[key];
- }
-
- delete _storage.__jstorage_meta.CRC32[key];
- _localStoragePolyfillSetKey(key, undefined);
-
- _save();
- _publishChange();
- _fireObservers(key, "deleted");
- return true;
- }
- return false;
- },
-
- /**
- * Sets a TTL for a key, or remove it if ttl value is 0 or below
- *
- * @param {String} key - key to set the TTL for
- * @param {Number} ttl - TTL timeout in milliseconds
- * @return {Boolean} true if key existed or false if it didn't
- */
- setTTL: function(key, ttl){
- var curtime = +new Date();
- _checkKey(key);
- ttl = Number(ttl) || 0;
- if(key in _storage){
-
- if(!_storage.__jstorage_meta.TTL){
- _storage.__jstorage_meta.TTL = {};
- }
-
- // Set TTL value for the key
- if(ttl>0){
- _storage.__jstorage_meta.TTL[key] = curtime + ttl;
- }else{
- delete _storage.__jstorage_meta.TTL[key];
- }
-
- _save();
-
- _handleTTL();
-
- _publishChange();
- return true;
- }
- return false;
- },
-
- /**
- * Gets remaining TTL (in milliseconds) for a key or 0 when no TTL has been set
- *
- * @param {String} key Key to check
- * @return {Number} Remaining TTL in milliseconds
- */
- getTTL: function(key){
- var curtime = +new Date(), ttl;
- _checkKey(key);
- if(key in _storage && _storage.__jstorage_meta.TTL && _storage.__jstorage_meta.TTL[key]){
- ttl = _storage.__jstorage_meta.TTL[key] - curtime;
- return ttl || 0;
- }
- return 0;
- },
-
- /**
- * Deletes everything in cache.
- *
- * @return {Boolean} Always true
- */
- flush: function(){
- _storage = {__jstorage_meta:{CRC32:{}}};
- _createPolyfillStorage("local", true);
- _save();
- _publishChange();
- _fireObservers(null, "flushed");
- return true;
- },
-
- /**
- * Returns a read-only copy of _storage
- *
- * @return {Object} Read-only copy of _storage
- */
- storageObj: function(){
- function F() {}
- F.prototype = _storage;
- return new F();
- },
-
- /**
- * Returns an index of all used keys as an array
- * ['key1', 'key2',..'keyN']
- *
- * @return {Array} Used keys
- */
- index: function(){
- var index = [], i;
- for(i in _storage){
- if(_storage.hasOwnProperty(i) && i != "__jstorage_meta"){
- index.push(i);
- }
- }
- return index;
- },
-
- /**
- * How much space in bytes does the storage take?
- *
- * @return {Number} Storage size in chars (not the same as in bytes,
- * since some chars may take several bytes)
- */
- storageSize: function(){
- return _storage_size;
- },
-
- /**
- * Which backend is currently in use?
- *
- * @return {String} Backend name
- */
- currentBackend: function(){
- return _backend;
- },
-
- /**
- * Test if storage is available
- *
- * @return {Boolean} True if storage can be used
- */
- storageAvailable: function(){
- return !!_backend;
- },
-
- /**
- * Register change listeners
- *
- * @param {String} key Key name
- * @param {Function} callback Function to run when the key changes
- */
- listenKeyChange: function(key, callback){
- _checkKey(key);
- if(!_observers[key]){
- _observers[key] = [];
- }
- _observers[key].push(callback);
- },
-
- /**
- * Remove change listeners
- *
- * @param {String} key Key name to unregister listeners against
- * @param {Function} [callback] If set, unregister the callback, if not - unregister all
- */
- stopListening: function(key, callback){
- _checkKey(key);
-
- if(!_observers[key]){
- return;
- }
-
- if(!callback){
- delete _observers[key];
- return;
- }
-
- for(var i = _observers[key].length - 1; i>=0; i--){
- if(_observers[key][i] == callback){
- _observers[key].splice(i,1);
- }
- }
- },
-
- /**
- * Subscribe to a Publish/Subscribe event stream
- *
- * @param {String} channel Channel name
- * @param {Function} callback Function to run when the something is published to the channel
- */
- subscribe: function(channel, callback){
- channel = (channel || "").toString();
- if(!channel){
- throw new TypeError('Channel not defined');
- }
- if(!_pubsub_observers[channel]){
- _pubsub_observers[channel] = [];
- }
- _pubsub_observers[channel].push(callback);
- },
-
- /**
- * Publish data to an event stream
- *
- * @param {String} channel Channel name
- * @param {Mixed} payload Payload to deliver
- */
- publish: function(channel, payload){
- channel = (channel || "").toString();
- if(!channel){
- throw new TypeError('Channel not defined');
- }
-
- _publish(channel, payload);
- },
-
- /**
- * Reloads the data from browser storage
- */
- reInit: function(){
- _reloadData();
- }
- };
-
- // Initialize jStorage
- _init();
-
-})();
diff --git a/resources/jquery/jquery.js b/resources/jquery/jquery.js
deleted file mode 100644
index a86bf797..00000000
--- a/resources/jquery/jquery.js
+++ /dev/null
@@ -1,9472 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.8.3
- * http://jquery.com/
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- *
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license
- * http://jquery.org/license
- *
- * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
- */
-(function( window, undefined ) {
-var
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // The deferred used on DOM ready
- readyList,
-
- // Use the correct document accordingly with window argument (sandbox)
- document = window.document,
- location = window.location,
- navigator = window.navigator,
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // Save a reference to some core methods
- core_push = Array.prototype.push,
- core_slice = Array.prototype.slice,
- core_indexOf = Array.prototype.indexOf,
- core_toString = Object.prototype.toString,
- core_hasOwn = Object.prototype.hasOwnProperty,
- core_trim = String.prototype.trim,
-
- // Define a local copy of jQuery
- jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Used for matching numbers
- core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
-
- // Used for detecting and trimming whitespace
- core_rnotwhite = /\S/,
- core_rspace = /\s+/,
-
- // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
-
- // A simple way to check for HTML strings
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
- rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
-
- // Matches dashed string for camelizing
- rmsPrefix = /^-ms-/,
- rdashAlpha = /-([\da-z])/gi,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return ( letter + "" ).toUpperCase();
- },
-
- // The ready event handler and self cleanup method
- DOMContentLoaded = function() {
- if ( document.addEventListener ) {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- } else if ( document.readyState === "complete" ) {
- // we're here because readyState === "complete" in oldIE
- // which is good enough for us to call the dom ready!
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- },
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), $(undefined), $(false)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = rquickExpr.exec( selector );
- }
-
- // Match html or make sure no context is specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = ( context && context.nodeType ? context.ownerDocument || context : document );
-
- // scripts is true for back-compat
- selector = jQuery.parseHTML( match[1], doc, true );
- if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
- this.attr.call( selector, context, true );
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $(#id)
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return ( context || rootjQuery ).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if ( selector.selector !== undefined ) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.8.3",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return core_slice.call( this );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
-
- // Build a new jQuery matched element set
- var ret = jQuery.merge( this.constructor(), elems );
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Add the callback
- jQuery.ready.promise().done( fn );
-
- return this;
- },
-
- eq: function( i ) {
- i = +i;
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( core_slice.apply( this, arguments ),
- "slice", core_slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: core_push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
-
- // Abort if there are pending holds or we're already ready
- if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
- return;
- }
-
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.resolveWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger("ready").off("ready");
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- isWindow: function( obj ) {
- return obj != null && obj == obj.window;
- },
-
- isNumeric: function( obj ) {
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ core_toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- try {
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !core_hasOwn.call(obj, "constructor") &&
- !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
- } catch ( e ) {
- // IE8,9 Will throw exceptions on certain host objects #9897
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || core_hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- var name;
- for ( name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw new Error( msg );
- },
-
- // data: string of html
- // context (optional): If specified, the fragment will be created in this context, defaults to document
- // scripts (optional): If true, will include scripts passed in the html string
- parseHTML: function( data, context, scripts ) {
- var parsed;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
- if ( typeof context === "boolean" ) {
- scripts = context;
- context = 0;
- }
- context = context || document;
-
- // Single tag
- if ( (parsed = rsingleTag.exec( data )) ) {
- return [ context.createElement( parsed[1] ) ];
- }
-
- parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
- return jQuery.merge( [],
- (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
- },
-
- parseJSON: function( data ) {
- if ( !data || typeof data !== "string") {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return ( new Function( "return " + data ) )();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- parseXML: function( data ) {
- var xml, tmp;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
- try {
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
- } catch( e ) {
- xml = undefined;
- }
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && core_rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Convert dashed to camelCase; used by the css and data modules
- // Microsoft forgot to hump their vendor prefix (#9572)
- camelCase: function( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
- },
-
- // args is for internal usage only
- each: function( obj, callback, args ) {
- var name,
- i = 0,
- length = obj.length,
- isObj = length === undefined || jQuery.isFunction( obj );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in obj ) {
- if ( callback.apply( obj[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( obj[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in obj ) {
- if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return obj;
- },
-
- // Use native String.trim function wherever possible
- trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
- function( text ) {
- return text == null ?
- "" :
- core_trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- ( text + "" ).replace( rtrim, "" );
- },
-
- // results is for internal usage only
- makeArray: function( arr, results ) {
- var type,
- ret = results || [];
-
- if ( arr != null ) {
- // The window, strings (and functions) also have 'length'
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- type = jQuery.type( arr );
-
- if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
- core_push.call( ret, arr );
- } else {
- jQuery.merge( ret, arr );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, arr, i ) {
- var len;
-
- if ( arr ) {
- if ( core_indexOf ) {
- return core_indexOf.call( arr, elem, i );
- }
-
- len = arr.length;
- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
-
- for ( ; i < len; i++ ) {
- // Skip accessing in sparse arrays
- if ( i in arr && arr[ i ] === elem ) {
- return i;
- }
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var l = second.length,
- i = first.length,
- j = 0;
-
- if ( typeof l === "number" ) {
- for ( ; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var retVal,
- ret = [],
- i = 0,
- length = elems.length;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( ; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key,
- ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- var tmp, args, proxy;
-
- if ( typeof context === "string" ) {
- tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- args = core_slice.call( arguments, 2 );
- proxy = function() {
- return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Multifunctional method to get and set values of a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
- var exec,
- bulk = key == null,
- i = 0,
- length = elems.length;
-
- // Sets many values
- if ( key && typeof key === "object" ) {
- for ( i in key ) {
- jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
- }
- chainable = 1;
-
- // Sets one value
- } else if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = pass === undefined && jQuery.isFunction( value );
-
- if ( bulk ) {
- // Bulk operations only iterate when executing function values
- if ( exec ) {
- exec = fn;
- fn = function( elem, key, value ) {
- return exec.call( jQuery( elem ), value );
- };
-
- // Otherwise they run against the entire set
- } else {
- fn.call( elems, value );
- fn = null;
- }
- }
-
- if ( fn ) {
- for (; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
- }
-
- chainable = 1;
- }
-
- return chainable ?
- elems :
-
- // Gets
- bulk ?
- fn.call( elems ) :
- length ? fn( elems[0], key ) : emptyGet;
- },
-
- now: function() {
- return ( new Date() ).getTime();
- }
-});
-
-jQuery.ready.promise = function( obj ) {
- if ( !readyList ) {
-
- readyList = jQuery.Deferred();
-
- // Catch cases where $(document).ready() is called after the browser event has already occurred.
- // we once tried to use readyState "interactive" here, but it caused issues like the one
- // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- setTimeout( jQuery.ready, 1 );
-
- // Standards-based browsers support DOMContentLoaded
- } else if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else {
- // Ensure firing before onload, maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var top = false;
-
- try {
- top = window.frameElement == null && document.documentElement;
- } catch(e) {}
-
- if ( top && top.doScroll ) {
- (function doScrollCheck() {
- if ( !jQuery.isReady ) {
-
- try {
- // Use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- top.doScroll("left");
- } catch(e) {
- return setTimeout( doScrollCheck, 50 );
- }
-
- // and execute any waiting functions
- jQuery.ready();
- }
- })();
- }
- }
- }
- return readyList.promise( obj );
-};
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-// String to Object options format cache
-var optionsCache = {};
-
-// Convert String-formatted options into Object-formatted ones and store in cache
-function createOptions( options ) {
- var object = optionsCache[ options ] = {};
- jQuery.each( options.split( core_rspace ), function( _, flag ) {
- object[ flag ] = true;
- });
- return object;
-}
-
-/*
- * Create a callback list using the following parameters:
- *
- * options: an optional list of space-separated options that will change how
- * the callback list behaves or a more traditional option object
- *
- * By default a callback list will act like an event callback list and can be
- * "fired" multiple times.
- *
- * Possible options:
- *
- * once: will ensure the callback list can only be fired once (like a Deferred)
- *
- * memory: will keep track of previous values and will call any callback added
- * after the list has been fired right away with the latest "memorized"
- * values (like a Deferred)
- *
- * unique: will ensure a callback can only be added once (no duplicate in the list)
- *
- * stopOnFalse: interrupt callings when a callback returns false
- *
- */
-jQuery.Callbacks = function( options ) {
-
- // Convert options from String-formatted to Object-formatted if needed
- // (we check in cache first)
- options = typeof options === "string" ?
- ( optionsCache[ options ] || createOptions( options ) ) :
- jQuery.extend( {}, options );
-
- var // Last fire value (for non-forgettable lists)
- memory,
- // Flag to know if list was already fired
- fired,
- // Flag to know if list is currently firing
- firing,
- // First callback to fire (used internally by add and fireWith)
- firingStart,
- // End of the loop when firing
- firingLength,
- // Index of currently firing callback (modified by remove if needed)
- firingIndex,
- // Actual callback list
- list = [],
- // Stack of fire calls for repeatable lists
- stack = !options.once && [],
- // Fire callbacks
- fire = function( data ) {
- memory = options.memory && data;
- fired = true;
- firingIndex = firingStart || 0;
- firingStart = 0;
- firingLength = list.length;
- firing = true;
- for ( ; list && firingIndex < firingLength; firingIndex++ ) {
- if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
- memory = false; // To prevent further calls using add
- break;
- }
- }
- firing = false;
- if ( list ) {
- if ( stack ) {
- if ( stack.length ) {
- fire( stack.shift() );
- }
- } else if ( memory ) {
- list = [];
- } else {
- self.disable();
- }
- }
- },
- // Actual Callbacks object
- self = {
- // Add a callback or a collection of callbacks to the list
- add: function() {
- if ( list ) {
- // First, we save the current length
- var start = list.length;
- (function add( args ) {
- jQuery.each( args, function( _, arg ) {
- var type = jQuery.type( arg );
- if ( type === "function" ) {
- if ( !options.unique || !self.has( arg ) ) {
- list.push( arg );
- }
- } else if ( arg && arg.length && type !== "string" ) {
- // Inspect recursively
- add( arg );
- }
- });
- })( arguments );
- // Do we need to add the callbacks to the
- // current firing batch?
- if ( firing ) {
- firingLength = list.length;
- // With memory, if we're not firing then
- // we should call right away
- } else if ( memory ) {
- firingStart = start;
- fire( memory );
- }
- }
- return this;
- },
- // Remove a callback from the list
- remove: function() {
- if ( list ) {
- jQuery.each( arguments, function( _, arg ) {
- var index;
- while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
- list.splice( index, 1 );
- // Handle firing indexes
- if ( firing ) {
- if ( index <= firingLength ) {
- firingLength--;
- }
- if ( index <= firingIndex ) {
- firingIndex--;
- }
- }
- }
- });
- }
- return this;
- },
- // Control if a given callback is in the list
- has: function( fn ) {
- return jQuery.inArray( fn, list ) > -1;
- },
- // Remove all callbacks from the list
- empty: function() {
- list = [];
- return this;
- },
- // Have the list do nothing anymore
- disable: function() {
- list = stack = memory = undefined;
- return this;
- },
- // Is it disabled?
- disabled: function() {
- return !list;
- },
- // Lock the list in its current state
- lock: function() {
- stack = undefined;
- if ( !memory ) {
- self.disable();
- }
- return this;
- },
- // Is it locked?
- locked: function() {
- return !stack;
- },
- // Call all callbacks with the given context and arguments
- fireWith: function( context, args ) {
- args = args || [];
- args = [ context, args.slice ? args.slice() : args ];
- if ( list && ( !fired || stack ) ) {
- if ( firing ) {
- stack.push( args );
- } else {
- fire( args );
- }
- }
- return this;
- },
- // Call all the callbacks with the given arguments
- fire: function() {
- self.fireWith( this, arguments );
- return this;
- },
- // To know if the callbacks have already been called at least once
- fired: function() {
- return !!fired;
- }
- };
-
- return self;
-};
-jQuery.extend({
-
- Deferred: function( func ) {
- var tuples = [
- // action, add listener, listener list, final state
- [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
- [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
- [ "notify", "progress", jQuery.Callbacks("memory") ]
- ],
- state = "pending",
- promise = {
- state: function() {
- return state;
- },
- always: function() {
- deferred.done( arguments ).fail( arguments );
- return this;
- },
- then: function( /* fnDone, fnFail, fnProgress */ ) {
- var fns = arguments;
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( tuples, function( i, tuple ) {
- var action = tuple[ 0 ],
- fn = fns[ i ];
- // deferred[ done | fail | progress ] for forwarding actions to newDefer
- deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
- function() {
- var returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise()
- .done( newDefer.resolve )
- .fail( newDefer.reject )
- .progress( newDefer.notify );
- } else {
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
- }
- } :
- newDefer[ action ]
- );
- });
- fns = null;
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- return obj != null ? jQuery.extend( obj, promise ) : promise;
- }
- },
- deferred = {};
-
- // Keep pipe for back-compat
- promise.pipe = promise.then;
-
- // Add list-specific methods
- jQuery.each( tuples, function( i, tuple ) {
- var list = tuple[ 2 ],
- stateString = tuple[ 3 ];
-
- // promise[ done | fail | progress ] = list.add
- promise[ tuple[1] ] = list.add;
-
- // Handle state
- if ( stateString ) {
- list.add(function() {
- // state = [ resolved | rejected ]
- state = stateString;
-
- // [ reject_list | resolve_list ].disable; progress_list.lock
- }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
- }
-
- // deferred[ resolve | reject | notify ] = list.fire
- deferred[ tuple[0] ] = list.fire;
- deferred[ tuple[0] + "With" ] = list.fireWith;
- });
-
- // Make the deferred a promise
- promise.promise( deferred );
-
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
-
- // All done!
- return deferred;
- },
-
- // Deferred helper
- when: function( subordinate /* , ..., subordinateN */ ) {
- var i = 0,
- resolveValues = core_slice.call( arguments ),
- length = resolveValues.length,
-
- // the count of uncompleted subordinates
- remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
-
- // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
- deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
-
- // Update function for both resolve and progress values
- updateFunc = function( i, contexts, values ) {
- return function( value ) {
- contexts[ i ] = this;
- values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
- if( values === progressValues ) {
- deferred.notifyWith( contexts, values );
- } else if ( !( --remaining ) ) {
- deferred.resolveWith( contexts, values );
- }
- };
- },
-
- progressValues, progressContexts, resolveContexts;
-
- // add listeners to Deferred subordinates; treat others as resolved
- if ( length > 1 ) {
- progressValues = new Array( length );
- progressContexts = new Array( length );
- resolveContexts = new Array( length );
- for ( ; i < length; i++ ) {
- if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
- resolveValues[ i ].promise()
- .done( updateFunc( i, resolveContexts, resolveValues ) )
- .fail( deferred.reject )
- .progress( updateFunc( i, progressContexts, progressValues ) );
- } else {
- --remaining;
- }
- }
- }
-
- // if we're not waiting on anything, resolve the master
- if ( !remaining ) {
- deferred.resolveWith( resolveContexts, resolveValues );
- }
-
- return deferred.promise();
- }
-});
-jQuery.support = (function() {
-
- var support,
- all,
- a,
- select,
- opt,
- input,
- fragment,
- eventName,
- i,
- isSupported,
- clickFn,
- div = document.createElement("div");
-
- // Setup
- div.setAttribute( "className", "t" );
- div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
-
- // Support tests won't run in some limited or non-browser environments
- all = div.getElementsByTagName("*");
- a = div.getElementsByTagName("a")[ 0 ];
- if ( !all || !a || !all.length ) {
- return {};
- }
-
- // First batch of tests
- select = document.createElement("select");
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName("input")[ 0 ];
-
- a.style.cssText = "top:1px;float:left;opacity:.5";
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName("tbody").length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute("href") === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.5/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Tests for enctype support on a form (#6743)
- enctype: !!document.createElement("form").enctype,
-
- // Makes sure cloning an html5 element does not cause problems
- // Where outerHTML is undefined, this still works
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
-
- // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
- boxModel: ( document.compatMode === "CSS1Compat" ),
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true,
- boxSizingReliable: true,
- pixelPosition: false
- };
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", clickFn = function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent("onclick");
- div.detachEvent( "onclick", clickFn );
- }
-
- // Check if a radio maintains its value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute( "type", "radio" );
- support.radioValue = input.value === "t";
-
- input.setAttribute( "checked", "checked" );
-
- // #11217 - WebKit loses check when the name is after the checked attribute
- input.setAttribute( "name", "t" );
-
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.lastChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- fragment.removeChild( input );
- fragment.appendChild( div );
-
- // Technique from Juriy Zaytsev
- // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for ( i in {
- submit: true,
- change: true,
- focusin: true
- }) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- // Run tests that need a body at doc ready
- jQuery(function() {
- var container, div, tds, marginDiv,
- divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
- body = document.getElementsByTagName("body")[0];
-
- if ( !body ) {
- // Return for frameset docs that don't have a body
- return;
- }
-
- container = document.createElement("div");
- container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
- body.insertBefore( container, body.firstChild );
-
- // Construct the test element
- div = document.createElement("div");
- container.appendChild( div );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
- tds = div.getElementsByTagName("td");
- tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE <= 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
-
- // Check box-sizing and margin behavior
- div.innerHTML = "";
- div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
- support.boxSizing = ( div.offsetWidth === 4 );
- support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
-
- // NOTE: To any future maintainer, we've window.getComputedStyle
- // because jsdom on node.js will break without it.
- if ( window.getComputedStyle ) {
- support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
- support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- marginDiv = document.createElement("div");
- marginDiv.style.cssText = div.style.cssText = divReset;
- marginDiv.style.marginRight = marginDiv.style.width = "0";
- div.style.width = "1px";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
- }
-
- if ( typeof div.style.zoom !== "undefined" ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.innerHTML = "";
- div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "block";
- div.style.overflow = "visible";
- div.innerHTML = "<div></div>";
- div.firstChild.style.width = "5px";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
-
- container.style.zoom = 1;
- }
-
- // Null elements to avoid leaks in IE
- body.removeChild( container );
- container = div = tds = marginDiv = null;
- });
-
- // Null elements to avoid leaks in IE
- fragment.removeChild( div );
- all = a = select = opt = input = fragment = div = null;
-
- return support;
-})();
-var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
- rmultiDash = /([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- deletedIds: [],
-
- // Remove at next major release (1.9/2.0)
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, ret,
- internalKey = jQuery.expando,
- getByName = typeof name === "string",
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
- } else {
- id = internalKey;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // Avoids exposing jQuery metadata on plain JS objects when the object
- // is serialized using JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ] = jQuery.extend( cache[ id ], name );
- } else {
- cache[ id ].data = jQuery.extend( cache[ id ].data, name );
- }
- }
-
- thisCache = cache[ id ];
-
- // jQuery data() is stored in a separate object inside the object's internal data
- // cache in order to avoid key collisions between internal data and user-defined
- // data.
- if ( !pvt ) {
- if ( !thisCache.data ) {
- thisCache.data = {};
- }
-
- thisCache = thisCache.data;
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // Check for both converted-to-camel and non-converted data property names
- // If a data property was specified
- if ( getByName ) {
-
- // First Try to find as-is property data
- ret = thisCache[ name ];
-
- // Test for null|undefined property data
- if ( ret == null ) {
-
- // Try to find the camelCased property
- ret = thisCache[ jQuery.camelCase( name ) ];
- }
- } else {
- ret = thisCache;
- }
-
- return ret;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, i, l,
-
- isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
- id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
-
- thisCache = pvt ? cache[ id ] : cache[ id ].data;
-
- if ( thisCache ) {
-
- // Support array or space separated string names for data keys
- if ( !jQuery.isArray( name ) ) {
-
- // try the string as a key before any manipulation
- if ( name in thisCache ) {
- name = [ name ];
- } else {
-
- // split the camel cased version by spaces unless a key with the spaces exists
- name = jQuery.camelCase( name );
- if ( name in thisCache ) {
- name = [ name ];
- } else {
- name = name.split(" ");
- }
- }
- }
-
- for ( i = 0, l = name.length; i < l; i++ ) {
- delete thisCache[ name[i] ];
- }
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( !pvt ) {
- delete cache[ id ].data;
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject( cache[ id ] ) ) {
- return;
- }
- }
-
- // Destroy the cache
- if ( isNode ) {
- jQuery.cleanData( [ elem ], true );
-
- // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
- } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
- delete cache[ id ];
-
- // When all else fails, null
- } else {
- cache[ id ] = null;
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- // nodes accept data unless otherwise specified; rejection can be conditional
- return !noData || noData !== true && elem.getAttribute("classid") === noData;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var parts, part, attr, name, l,
- elem = this[0],
- i = 0,
- data = null;
-
- // Gets all values
- if ( key === undefined ) {
- if ( this.length ) {
- data = jQuery.data( elem );
-
- if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
- attr = elem.attributes;
- for ( l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( !name.indexOf( "data-" ) ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( elem, name, data[ name ] );
- }
- }
- jQuery._data( elem, "parsedAttrs", true );
- }
- }
-
- return data;
- }
-
- // Sets multiple values
- if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- parts = key.split( ".", 2 );
- parts[1] = parts[1] ? "." + parts[1] : "";
- part = parts[1] + "!";
-
- return jQuery.access( this, function( value ) {
-
- if ( value === undefined ) {
- data = this.triggerHandler( "getData" + part, [ parts[0] ] );
-
- // Try to fetch any internally stored data first
- if ( data === undefined && elem ) {
- data = jQuery.data( elem, key );
- data = dataAttr( elem, key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
- }
-
- parts[1] = value;
- this.each(function() {
- var self = jQuery( this );
-
- self.triggerHandler( "setData" + part, parts );
- jQuery.data( this, key, value );
- self.triggerHandler( "changeData" + part, parts );
- });
- }, null, value, arguments.length > 1, null, false );
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
-
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- // Only convert to a number if it doesn't change the string
- +data + "" === data ? +data :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// checks a cache object for emptiness
-function isEmptyDataObject( obj ) {
- var name;
- for ( name in obj ) {
-
- // if the public data object is empty, the private is still empty
- if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
- continue;
- }
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-jQuery.extend({
- queue: function( elem, type, data ) {
- var queue;
-
- if ( elem ) {
- type = ( type || "fx" ) + "queue";
- queue = jQuery._data( elem, type );
-
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !queue || jQuery.isArray(data) ) {
- queue = jQuery._data( elem, type, jQuery.makeArray(data) );
- } else {
- queue.push( data );
- }
- }
- return queue || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- startLength = queue.length,
- fn = queue.shift(),
- hooks = jQuery._queueHooks( elem, type ),
- next = function() {
- jQuery.dequeue( elem, type );
- };
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- startLength--;
- }
-
- if ( fn ) {
-
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift( "inprogress" );
- }
-
- // clear up the last queue stop function
- delete hooks.stop;
- fn.call( elem, next, hooks );
- }
-
- if ( !startLength && hooks ) {
- hooks.empty.fire();
- }
- },
-
- // not intended for public consumption - generates a queueHooks object, or returns the current one
- _queueHooks: function( elem, type ) {
- var key = type + "queueHooks";
- return jQuery._data( elem, key ) || jQuery._data( elem, key, {
- empty: jQuery.Callbacks("once memory").add(function() {
- jQuery.removeData( elem, type + "queue", true );
- jQuery.removeData( elem, key, true );
- })
- });
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- var setter = 2;
-
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- setter--;
- }
-
- if ( arguments.length < setter ) {
- return jQuery.queue( this[0], type );
- }
-
- return data === undefined ?
- this :
- this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- // ensure a hooks for this queue
- jQuery._queueHooks( this, type );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
- type = type || "fx";
-
- return this.queue( type, function( next, hooks ) {
- var timeout = setTimeout( next, time );
- hooks.stop = function() {
- clearTimeout( timeout );
- };
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, obj ) {
- var tmp,
- count = 1,
- defer = jQuery.Deferred(),
- elements = this,
- i = this.length,
- resolve = function() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- };
-
- if ( typeof type !== "string" ) {
- obj = type;
- type = undefined;
- }
- type = type || "fx";
-
- while( i-- ) {
- tmp = jQuery._data( elements[ i ], type + "queueHooks" );
- if ( tmp && tmp.empty ) {
- count++;
- tmp.empty.add( resolve );
- }
- }
- resolve();
- return defer.promise( obj );
- }
-});
-var nodeHook, boolHook, fixSpecified,
- rclass = /[\t\r\n]/g,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea|)$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- getSetAttribute = jQuery.support.getSetAttribute;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( core_rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var removes, className, elem, c, cl, i, l;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
- if ( (value && typeof value === "string") || value === undefined ) {
- removes = ( value || "" ).split( core_rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
- if ( elem.nodeType === 1 && elem.className ) {
-
- className = (" " + elem.className + " ").replace( rclass, " " );
-
- // loop over each item in the removal list
- for ( c = 0, cl = removes.length; c < cl; c++ ) {
- // Remove until there is nothing to remove,
- while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
- className = className.replace( " " + removes[ c ] + " " , " " );
- }
- }
- elem.className = value ? jQuery.trim( className ) : "";
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( core_rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space separated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ",
- i = 0,
- l = this.length;
- for ( ; i < l; i++ ) {
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret, isFunction,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return;
- }
-
- isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var val,
- self = jQuery(this);
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value, option,
- options = elem.options,
- index = elem.selectedIndex,
- one = elem.type === "select-one" || index < 0,
- values = one ? null : [],
- max = one ? index + 1 : options.length,
- i = index < 0 ?
- max :
- one ? index : 0;
-
- // Loop through all the selected options
- for ( ; i < max; i++ ) {
- option = options[ i ];
-
- // oldIE doesn't update selected after form reset (#2551)
- if ( ( option.selected || i === index ) &&
- // Don't return options that are disabled or in a disabled optgroup
- ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
- ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
- attrFn: {},
-
- attr: function( elem, name, value, pass ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( typeof elem.getAttribute === "undefined" ) {
- return jQuery.prop( elem, name, value );
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // All attributes are lowercase
- // Grab necessary hook if one is defined
- if ( notxml ) {
- name = name.toLowerCase();
- hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, value + "" );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, value ) {
- var propName, attrNames, name, isBool,
- i = 0;
-
- if ( value && elem.nodeType === 1 ) {
-
- attrNames = value.split( core_rspace );
-
- for ( ; i < attrNames.length; i++ ) {
- name = attrNames[ i ];
-
- if ( name ) {
- propName = jQuery.propFix[ name ] || name;
- isBool = rboolean.test( name );
-
- // See #9699 for explanation of this approach (setting first, then removal)
- // Do not do this for boolean attributes (see #10870)
- if ( !isBool ) {
- jQuery.attr( elem, name, "" );
- }
- elem.removeAttribute( getSetAttribute ? name : propName );
-
- // Set corresponding property to false for boolean attributes
- if ( isBool && propName in elem ) {
- elem[ propName ] = false;
- }
- }
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to it's default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- // Use the value property for back compat
- // Use the nodeHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- propFix: {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- },
-
- prop: function( elem, name, value ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return ( elem[ name ] = value );
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabindex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- }
- }
-});
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- // Fall back to attribute presence where some booleans are not supported
- var attrNode,
- property = jQuery.prop( elem, name );
- return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !getSetAttribute ) {
-
- fixSpecified = {
- name: true,
- id: true,
- coords: true
- };
-
- // Use this for any attribute in IE6/7
- // This fixes almost every IE6/7 issue
- nodeHook = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
- ret.value :
- undefined;
- },
- set: function( elem, value, name ) {
- // Set the existing or create a new attribute node
- var ret = elem.getAttributeNode( name );
- if ( !ret ) {
- ret = document.createAttribute( name );
- elem.setAttributeNode( ret );
- }
- return ( ret.value = value + "" );
- }
- };
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-
- // Set contenteditable to false on removals(#10429)
- // Setting to empty string throws an error as an invalid value
- jQuery.attrHooks.contenteditable = {
- get: nodeHook.get,
- set: function( elem, value, name ) {
- if ( value === "" ) {
- value = "false";
- }
- nodeHook.set( elem, value, name );
- }
- };
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return ( elem.style.cssText = value + "" );
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- return null;
- }
- });
-}
-
-// IE6/7 call enctype encoding
-if ( !jQuery.support.enctype ) {
- jQuery.propFix.enctype = "encoding";
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
- }
- }
- });
-});
-var rformElems = /^(?:textarea|input|select)$/i,
- rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
- rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
- rkeyEvent = /^key/,
- rmouseEvent = /^(?:mouse|contextmenu)|click/,
- rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
- hoverHack = function( events ) {
- return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
- };
-
-/*
- * Helper functions for managing events -- not part of the public interface.
- * Props to Dean Edwards' addEvent library for many of the ideas.
- */
-jQuery.event = {
-
- add: function( elem, types, handler, data, selector ) {
-
- var elemData, eventHandle, events,
- t, tns, type, namespaces, handleObj,
- handleObjIn, handlers, special;
-
- // Don't attach events to noData or text/comment nodes (allow plain objects tho)
- if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
- return;
- }
-
- // Caller can pass in an object of custom data in lieu of the handler
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- selector = handleObjIn.selector;
- }
-
- // Make sure that the handler has a unique ID, used to find/remove it later
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure and main handler, if this is the first
- events = elemData.events;
- if ( !events ) {
- elemData.events = events = {};
- }
- eventHandle = elemData.handle;
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
- eventHandle.elem = elem;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = jQuery.trim( hoverHack(types) ).split( " " );
- for ( t = 0; t < types.length; t++ ) {
-
- tns = rtypenamespace.exec( types[t] ) || [];
- type = tns[1];
- namespaces = ( tns[2] || "" ).split( "." ).sort();
-
- // If event changes its type, use the special event handlers for the changed type
- special = jQuery.event.special[ type ] || {};
-
- // If selector defined, determine special event api type, otherwise given type
- type = ( selector ? special.delegateType : special.bindType ) || type;
-
- // Update special based on newly reset type
- special = jQuery.event.special[ type ] || {};
-
- // handleObj is passed to all event handlers
- handleObj = jQuery.extend({
- type: type,
- origType: tns[1],
- data: data,
- handler: handler,
- guid: handler.guid,
- selector: selector,
- needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
- namespace: namespaces.join(".")
- }, handleObjIn );
-
- // Init the event handler queue if we're the first
- handlers = events[ type ];
- if ( !handlers ) {
- handlers = events[ type ] = [];
- handlers.delegateCount = 0;
-
- // Only use addEventListener/attachEvent if the special events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add to the element's handler list, delegates in front
- if ( selector ) {
- handlers.splice( handlers.delegateCount++, 0, handleObj );
- } else {
- handlers.push( handleObj );
- }
-
- // Keep track of which events have ever been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, selector, mappedTypes ) {
-
- var t, tns, type, origType, namespaces, origCount,
- j, events, special, eventType, handleObj,
- elemData = jQuery.hasData( elem ) && jQuery._data( elem );
-
- if ( !elemData || !(events = elemData.events) ) {
- return;
- }
-
- // Once for each type.namespace in types; type may be omitted
- types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
- for ( t = 0; t < types.length; t++ ) {
- tns = rtypenamespace.exec( types[t] ) || [];
- type = origType = tns[1];
- namespaces = tns[2];
-
- // Unbind all events (on this namespace, if provided) for the element
- if ( !type ) {
- for ( type in events ) {
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
- }
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
- type = ( selector? special.delegateType : special.bindType ) || type;
- eventType = events[ type ] || [];
- origCount = eventType.length;
- namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
-
- // Remove matching events
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( ( mappedTypes || origType === handleObj.origType ) &&
- ( !handler || handler.guid === handleObj.guid ) &&
- ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
- eventType.splice( j--, 1 );
-
- if ( handleObj.selector ) {
- eventType.delegateCount--;
- }
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
- }
-
- // Remove generic event handler if we removed something and no more handlers exist
- // (avoids potential for endless recursion during removal of special event handlers)
- if ( eventType.length === 0 && origCount !== eventType.length ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- delete elemData.handle;
-
- // removeData also checks for emptiness and clears the expando if empty
- // so use it instead of delete
- jQuery.removeData( elem, "events", true );
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Don't do events on text and comment nodes
- if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
- return;
- }
-
- // Event object or event type
- var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
- type = event.type || event,
- namespaces = [];
-
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
- return;
- }
-
- if ( type.indexOf( "!" ) >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf( "." ) >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.isTrigger = true;
- event.exclusive = exclusive;
- event.namespace = namespaces.join( "." );
- event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
- ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
-
- // Handle a global trigger
- if ( !elem ) {
-
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- cache = jQuery.cache;
- for ( i in cache ) {
- if ( cache[ i ].events && cache[ i ].events[ type ] ) {
- jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
- }
- }
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- if ( !event.target ) {
- event.target = elem;
- }
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- // Allow special events to draw outside the lines
- special = jQuery.event.special[ type ] || {};
- if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
- return;
- }
-
- // Determine event propagation path in advance, per W3C events spec (#9951)
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
- eventPath = [[ elem, special.bindType || type ]];
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
-
- bubbleType = special.delegateType || type;
- cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
- for ( old = elem; cur; cur = cur.parentNode ) {
- eventPath.push([ cur, bubbleType ]);
- old = cur;
- }
-
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
- if ( old === (elem.ownerDocument || document) ) {
- eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
- }
- }
-
- // Fire handlers on the event path
- for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
-
- cur = eventPath[i][0];
- event.type = eventPath[i][1];
-
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
- if ( handle ) {
- handle.apply( cur, data );
- }
- // Note that this is a bare JS function and not a jQuery handler
- handle = ontype && cur[ ontype ];
- if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
- event.preventDefault();
- }
- }
- event.type = type;
-
- // If nobody prevented the default action, do it now
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
-
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction() check here because IE6/7 fails that test.
- // Don't do default actions on window, that's where global variables be (#6170)
- // IE<9 dies on focus/blur to hidden element (#1486)
- if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
-
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- // Prevent re-triggering of the same event, since we already bubbled it above
- jQuery.event.triggered = type;
- elem[ type ]();
- jQuery.event.triggered = undefined;
-
- if ( old ) {
- elem[ ontype ] = old;
- }
- }
- }
- }
-
- return event.result;
- },
-
- dispatch: function( event ) {
-
- // Make a writable jQuery.Event from the native event object
- event = jQuery.event.fix( event || window.event );
-
- var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
- handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
- delegateCount = handlers.delegateCount,
- args = core_slice.call( arguments ),
- run_all = !event.exclusive && !event.namespace,
- special = jQuery.event.special[ event.type ] || {},
- handlerQueue = [];
-
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[0] = event;
- event.delegateTarget = this;
-
- // Call the preDispatch hook for the mapped type, and let it bail if desired
- if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
- return;
- }
-
- // Determine handlers that should run if there are delegated events
- // Avoid non-left-click bubbling in Firefox (#3861)
- if ( delegateCount && !(event.button && event.type === "click") ) {
-
- for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
-
- // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
- if ( cur.disabled !== true || event.type !== "click" ) {
- selMatch = {};
- matches = [];
- for ( i = 0; i < delegateCount; i++ ) {
- handleObj = handlers[ i ];
- sel = handleObj.selector;
-
- if ( selMatch[ sel ] === undefined ) {
- selMatch[ sel ] = handleObj.needsContext ?
- jQuery( sel, this ).index( cur ) >= 0 :
- jQuery.find( sel, this, null, [ cur ] ).length;
- }
- if ( selMatch[ sel ] ) {
- matches.push( handleObj );
- }
- }
- if ( matches.length ) {
- handlerQueue.push({ elem: cur, matches: matches });
- }
- }
- }
- }
-
- // Add the remaining (directly-bound) handlers
- if ( handlers.length > delegateCount ) {
- handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
- }
-
- // Run delegates first; they may want to stop propagation beneath us
- for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
- matched = handlerQueue[ i ];
- event.currentTarget = matched.elem;
-
- for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
- handleObj = matched.matches[ j ];
-
- // Triggered event must either 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
- if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
-
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
- .apply( matched.elem, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
- }
- }
-
- // Call the postDispatch hook for the mapped type
- if ( special.postDispatch ) {
- special.postDispatch.call( this, event );
- }
-
- return event.result;
- },
-
- // Includes some event props shared by KeyEvent and MouseEvent
- // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
- props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
-
- fixHooks: {},
-
- keyHooks: {
- props: "char charCode key keyCode".split(" "),
- filter: function( event, original ) {
-
- // Add which for key events
- if ( event.which == null ) {
- event.which = original.charCode != null ? original.charCode : original.keyCode;
- }
-
- return event;
- }
- },
-
- mouseHooks: {
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
- filter: function( event, original ) {
- var eventDoc, doc, body,
- button = original.button,
- fromElement = original.fromElement;
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && original.clientX != null ) {
- eventDoc = event.target.ownerDocument || document;
- doc = eventDoc.documentElement;
- body = eventDoc.body;
-
- event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
- event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && fromElement ) {
- event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && button !== undefined ) {
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
- }
-
- return event;
- }
- },
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // Create a writable copy of the event object and normalize some properties
- var i, prop,
- originalEvent = event,
- fixHook = jQuery.event.fixHooks[ event.type ] || {},
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
-
- event = jQuery.Event( originalEvent );
-
- for ( i = copy.length; i; ) {
- prop = copy[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
- if ( !event.target ) {
- event.target = originalEvent.srcElement || document;
- }
-
- // Target should not be a text node (#504, Safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
- event.metaKey = !!event.metaKey;
-
- return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
- },
-
- special: {
- load: {
- // Prevent triggered image.load events from bubbling to window.load
- noBubble: true
- },
-
- focus: {
- delegateType: "focusin"
- },
- blur: {
- delegateType: "focusout"
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- },
-
- simulate: function( type, elem, event, bubble ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- var e = jQuery.extend(
- new jQuery.Event(),
- event,
- { type: type,
- isSimulated: true,
- originalEvent: {}
- }
- );
- if ( bubble ) {
- jQuery.event.trigger( e, null, elem );
- } else {
- jQuery.event.dispatch.call( elem, e );
- }
- if ( e.isDefaultPrevented() ) {
- event.preventDefault();
- }
- }
-};
-
-// Some plugins are using, but it's undocumented/deprecated and will be removed.
-// The 1.7 special event interface should provide all the hooks needed now.
-jQuery.event.handle = jQuery.event.dispatch;
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- var name = "on" + type;
-
- if ( elem.detachEvent ) {
-
- // #8545, #7054, preventing memory leaks for custom events in IE6-8
- // detachEvent needed property on element, by name of that event, to properly expose it to GC
- if ( typeof elem[ name ] === "undefined" ) {
- elem[ name ] = null;
- }
-
- elem.detachEvent( name, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !(this instanceof jQuery.Event) ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // Create a timestamp if incoming event doesn't have one
- this.timeStamp = src && src.timeStamp || jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Create mouseenter/leave events using mouseover/out and event-time checks
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- delegateType: fix,
- bindType: fix,
-
- handle: function( event ) {
- var ret,
- target = this,
- related = event.relatedTarget,
- handleObj = event.handleObj,
- selector = handleObj.selector;
-
- // For mousenter/leave call the handler if related is outside the target.
- // NB: No relatedTarget if the mouse left/entered the browser window
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
- event.type = handleObj.origType;
- ret = handleObj.handler.apply( this, arguments );
- event.type = fix;
- }
- return ret;
- }
- };
-});
-
-// IE submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Lazy-add a submit handler when a descendant form may potentially be submitted
- jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
- // Node name check avoids a VML-related crash in IE (#9807)
- var elem = e.target,
- form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
- if ( form && !jQuery._data( form, "_submit_attached" ) ) {
- jQuery.event.add( form, "submit._submit", function( event ) {
- event._submit_bubble = true;
- });
- jQuery._data( form, "_submit_attached", true );
- }
- });
- // return undefined since we don't need an event listener
- },
-
- postDispatch: function( event ) {
- // If form was submitted by the user, bubble the event up the tree
- if ( event._submit_bubble ) {
- delete event._submit_bubble;
- if ( this.parentNode && !event.isTrigger ) {
- jQuery.event.simulate( "submit", this.parentNode, event, true );
- }
- }
- },
-
- teardown: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
- jQuery.event.remove( this, "._submit" );
- }
- };
-}
-
-// IE change delegation and checkbox/radio fix
-if ( !jQuery.support.changeBubbles ) {
-
- jQuery.event.special.change = {
-
- setup: function() {
-
- if ( rformElems.test( this.nodeName ) ) {
- // IE doesn't fire change on a check/radio until blur; trigger it on click
- // after a propertychange. Eat the blur-change in special.change.handle.
- // This still fires onchange a second time for check/radio after blur.
- if ( this.type === "checkbox" || this.type === "radio" ) {
- jQuery.event.add( this, "propertychange._change", function( event ) {
- if ( event.originalEvent.propertyName === "checked" ) {
- this._just_changed = true;
- }
- });
- jQuery.event.add( this, "click._change", function( event ) {
- if ( this._just_changed && !event.isTrigger ) {
- this._just_changed = false;
- }
- // Allow triggered, simulated change events (#11500)
- jQuery.event.simulate( "change", this, event, true );
- });
- }
- return false;
- }
- // Delegated event; lazy-add a change handler on descendant inputs
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
- var elem = e.target;
-
- if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
- jQuery.event.add( elem, "change._change", function( event ) {
- if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
- jQuery.event.simulate( "change", this.parentNode, event, true );
- }
- });
- jQuery._data( elem, "_change_attached", true );
- }
- });
- },
-
- handle: function( event ) {
- var elem = event.target;
-
- // Swallow native change events from checkbox/radio, we already triggered them above
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
- return event.handleObj.handler.apply( this, arguments );
- }
- },
-
- teardown: function() {
- jQuery.event.remove( this, "._change" );
-
- return !rformElems.test( this.nodeName );
- }
- };
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0,
- handler = function( event ) {
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
- };
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
- });
-}
-
-jQuery.fn.extend({
-
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
- var origFn, type;
-
- // Types can be a map of types/handlers
- if ( typeof types === "object" ) {
- // ( types-Object, selector, data )
- if ( typeof selector !== "string" ) { // && selector != null
- // ( types-Object, data )
- data = data || selector;
- selector = undefined;
- }
- for ( type in types ) {
- this.on( type, selector, data, types[ type ], one );
- }
- return this;
- }
-
- if ( data == null && fn == null ) {
- // ( types, fn )
- fn = selector;
- data = selector = undefined;
- } else if ( fn == null ) {
- if ( typeof selector === "string" ) {
- // ( types, selector, fn )
- fn = data;
- data = undefined;
- } else {
- // ( types, data, fn )
- fn = data;
- data = selector;
- selector = undefined;
- }
- }
- if ( fn === false ) {
- fn = returnFalse;
- } else if ( !fn ) {
- return this;
- }
-
- if ( one === 1 ) {
- origFn = fn;
- fn = function( event ) {
- // Can use an empty set, since event contains the info
- jQuery().off( event );
- return origFn.apply( this, arguments );
- };
- // Use same guid so caller can remove using origFn
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
- }
- return this.each( function() {
- jQuery.event.add( this, types, fn, data, selector );
- });
- },
- one: function( types, selector, data, fn ) {
- return this.on( types, selector, data, fn, 1 );
- },
- off: function( types, selector, fn ) {
- var handleObj, type;
- if ( types && types.preventDefault && types.handleObj ) {
- // ( event ) dispatched jQuery.Event
- handleObj = types.handleObj;
- jQuery( types.delegateTarget ).off(
- handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
- handleObj.selector,
- handleObj.handler
- );
- return this;
- }
- if ( typeof types === "object" ) {
- // ( types-object [, selector] )
- for ( type in types ) {
- this.off( type, selector, types[ type ] );
- }
- return this;
- }
- if ( selector === false || typeof selector === "function" ) {
- // ( types [, fn] )
- fn = selector;
- selector = undefined;
- }
- if ( fn === false ) {
- fn = returnFalse;
- }
- return this.each(function() {
- jQuery.event.remove( this, types, fn, selector );
- });
- },
-
- bind: function( types, data, fn ) {
- return this.on( types, null, data, fn );
- },
- unbind: function( types, fn ) {
- return this.off( types, null, fn );
- },
-
- live: function( types, data, fn ) {
- jQuery( this.context ).on( types, this.selector, data, fn );
- return this;
- },
- die: function( types, fn ) {
- jQuery( this.context ).off( types, this.selector || "**", fn );
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.on( types, selector, data, fn );
- },
- undelegate: function( selector, types, fn ) {
- // ( namespace ) or ( selector, types [, fn] )
- return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.on( name, null, data, fn ) :
- this.trigger( name );
- };
-
- if ( rkeyEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
- }
-
- if ( rmouseEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
- }
-});
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license
- * http://sizzlejs.com/
- */
-(function( window, undefined ) {
-
-var cachedruns,
- assertGetIdNotName,
- Expr,
- getText,
- isXML,
- contains,
- compile,
- sortOrder,
- hasDuplicate,
- outermostContext,
-
- baseHasDuplicate = true,
- strundefined = "undefined",
-
- expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
-
- Token = String,
- document = window.document,
- docElem = document.documentElement,
- dirruns = 0,
- done = 0,
- pop = [].pop,
- push = [].push,
- slice = [].slice,
- // Use a stripped-down indexOf if a native one is unavailable
- indexOf = [].indexOf || function( elem ) {
- var i = 0,
- len = this.length;
- for ( ; i < len; i++ ) {
- if ( this[i] === elem ) {
- return i;
- }
- }
- return -1;
- },
-
- // Augment a function for special use by Sizzle
- markFunction = function( fn, value ) {
- fn[ expando ] = value == null || value;
- return fn;
- },
-
- createCache = function() {
- var cache = {},
- keys = [];
-
- return markFunction(function( key, value ) {
- // Only keep the most recent entries
- if ( keys.push( key ) > Expr.cacheLength ) {
- delete cache[ keys.shift() ];
- }
-
- // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
- return (cache[ key + " " ] = value);
- }, cache );
- },
-
- classCache = createCache(),
- tokenCache = createCache(),
- compilerCache = createCache(),
-
- // Regex
-
- // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
- whitespace = "[\\x20\\t\\r\\n\\f]",
- // http://www.w3.org/TR/css3-syntax/#characters
- characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
-
- // Loosely modeled on CSS identifier characters
- // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
- // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
- identifier = characterEncoding.replace( "w", "w#" ),
-
- // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
- operators = "([*^$|!~]?=)",
- attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
- "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
-
- // Prefer arguments not in parens/brackets,
- // then attribute selectors and non-pseudos (denoted by :),
- // then anything else
- // These preferences are here to reduce the number of selectors
- // needing tokenize in the PSEUDO preFilter
- pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
-
- // For matchExpr.POS and matchExpr.needsContext
- pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
- "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
-
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
-
- rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
- rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
- rpseudo = new RegExp( pseudos ),
-
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
- rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
-
- rnot = /^:not/,
- rsibling = /[\x20\t\r\n\f]*[+~]/,
- rendsWithNot = /:not\($/,
-
- rheader = /h\d/i,
- rinputs = /input|select|textarea|button/i,
-
- rbackslash = /\\(?!\\)/g,
-
- matchExpr = {
- "ID": new RegExp( "^#(" + characterEncoding + ")" ),
- "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
- "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
- "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
- "ATTR": new RegExp( "^" + attributes ),
- "PSEUDO": new RegExp( "^" + pseudos ),
- "POS": new RegExp( pos, "i" ),
- "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
- // For use in libraries implementing .is()
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
- },
-
- // Support
-
- // Used for testing something on an element
- assert = function( fn ) {
- var div = document.createElement("div");
-
- try {
- return fn( div );
- } catch (e) {
- return false;
- } finally {
- // release memory in IE
- div = null;
- }
- },
-
- // Check if getElementsByTagName("*") returns only elements
- assertTagNameNoComments = assert(function( div ) {
- div.appendChild( document.createComment("") );
- return !div.getElementsByTagName("*").length;
- }),
-
- // Check if getAttribute returns normalized href attributes
- assertHrefNotNormalized = assert(function( div ) {
- div.innerHTML = "<a href='#'></a>";
- return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
- div.firstChild.getAttribute("href") === "#";
- }),
-
- // Check if attributes should be retrieved by attribute nodes
- assertAttributes = assert(function( div ) {
- div.innerHTML = "<select></select>";
- var type = typeof div.lastChild.getAttribute("multiple");
- // IE8 returns a string for some attributes even when not present
- return type !== "boolean" && type !== "string";
- }),
-
- // Check if getElementsByClassName can be trusted
- assertUsableClassName = assert(function( div ) {
- // Opera can't find a second classname (in 9.6)
- div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
- if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
- return false;
- }
-
- // Safari 3.2 caches class attributes and doesn't catch changes
- div.lastChild.className = "e";
- return div.getElementsByClassName("e").length === 2;
- }),
-
- // Check if getElementById returns elements by name
- // Check if getElementsByName privileges form controls or returns elements by ID
- assertUsableName = assert(function( div ) {
- // Inject content
- div.id = expando + 0;
- div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
- docElem.insertBefore( div, docElem.firstChild );
-
- // Test
- var pass = document.getElementsByName &&
- // buggy browsers will return fewer than the correct 2
- document.getElementsByName( expando ).length === 2 +
- // buggy browsers will return more than the correct 0
- document.getElementsByName( expando + 0 ).length;
- assertGetIdNotName = !document.getElementById( expando );
-
- // Cleanup
- docElem.removeChild( div );
-
- return pass;
- });
-
-// If slice is not available, provide a backup
-try {
- slice.call( docElem.childNodes, 0 )[0].nodeType;
-} catch ( e ) {
- slice = function( i ) {
- var elem,
- results = [];
- for ( ; (elem = this[i]); i++ ) {
- results.push( elem );
- }
- return results;
- };
-}
-
-function Sizzle( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
- var match, elem, xml, m,
- nodeType = context.nodeType;
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- if ( nodeType !== 1 && nodeType !== 9 ) {
- return [];
- }
-
- xml = isXML( context );
-
- if ( !xml && !seed ) {
- if ( (match = rquickExpr.exec( selector )) ) {
- // Speed-up: Sizzle("#ID")
- if ( (m = match[1]) ) {
- if ( nodeType === 9 ) {
- elem = context.getElementById( m );
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE, Opera, and Webkit return items
- // by name instead of ID
- if ( elem.id === m ) {
- results.push( elem );
- return results;
- }
- } else {
- return results;
- }
- } else {
- // Context is not a document
- if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
- contains( context, elem ) && elem.id === m ) {
- results.push( elem );
- return results;
- }
- }
-
- // Speed-up: Sizzle("TAG")
- } else if ( match[2] ) {
- push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
- return results;
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
- push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
- return results;
- }
- }
- }
-
- // All others
- return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
-}
-
-Sizzle.matches = function( expr, elements ) {
- return Sizzle( expr, null, null, elements );
-};
-
-Sizzle.matchesSelector = function( elem, expr ) {
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
-};
-
-// Returns a function to use in pseudos for input types
-function createInputPseudo( type ) {
- return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === type;
- };
-}
-
-// Returns a function to use in pseudos for buttons
-function createButtonPseudo( type ) {
- return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && elem.type === type;
- };
-}
-
-// Returns a function to use in pseudos for positionals
-function createPositionalPseudo( fn ) {
- return markFunction(function( argument ) {
- argument = +argument;
- return markFunction(function( seed, matches ) {
- var j,
- matchIndexes = fn( [], seed.length, argument ),
- i = matchIndexes.length;
-
- // Match elements found at the specified indexes
- while ( i-- ) {
- if ( seed[ (j = matchIndexes[i]) ] ) {
- seed[j] = !(matches[j] = seed[j]);
- }
- }
- });
- });
-}
-
-/**
- * Utility function for retrieving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
-getText = Sizzle.getText = function( elem ) {
- var node,
- ret = "",
- i = 0,
- nodeType = elem.nodeType;
-
- if ( nodeType ) {
- if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
- // Use textContent for elements
- // innerText usage removed for consistency of new lines (see #11153)
- if ( typeof elem.textContent === "string" ) {
- return elem.textContent;
- } else {
- // Traverse its children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
- ret += getText( elem );
- }
- }
- } else if ( nodeType === 3 || nodeType === 4 ) {
- return elem.nodeValue;
- }
- // Do not include comment or processing instruction nodes
- } else {
-
- // If no nodeType, this is expected to be an array
- for ( ; (node = elem[i]); i++ ) {
- // Do not traverse comment nodes
- ret += getText( node );
- }
- }
- return ret;
-};
-
-isXML = Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-// Element contains another
-contains = Sizzle.contains = docElem.contains ?
- function( a, b ) {
- var adown = a.nodeType === 9 ? a.documentElement : a,
- bup = b && b.parentNode;
- return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
- } :
- docElem.compareDocumentPosition ?
- function( a, b ) {
- return b && !!( a.compareDocumentPosition( b ) & 16 );
- } :
- function( a, b ) {
- while ( (b = b.parentNode) ) {
- if ( b === a ) {
- return true;
- }
- }
- return false;
- };
-
-Sizzle.attr = function( elem, name ) {
- var val,
- xml = isXML( elem );
-
- if ( !xml ) {
- name = name.toLowerCase();
- }
- if ( (val = Expr.attrHandle[ name ]) ) {
- return val( elem );
- }
- if ( xml || assertAttributes ) {
- return elem.getAttribute( name );
- }
- val = elem.getAttributeNode( name );
- return val ?
- typeof elem[ name ] === "boolean" ?
- elem[ name ] ? name : null :
- val.specified ? val.value : null :
- null;
-};
-
-Expr = Sizzle.selectors = {
-
- // Can be adjusted by the user
- cacheLength: 50,
-
- createPseudo: markFunction,
-
- match: matchExpr,
-
- // IE6/7 return a modified href
- attrHandle: assertHrefNotNormalized ?
- {} :
- {
- "href": function( elem ) {
- return elem.getAttribute( "href", 2 );
- },
- "type": function( elem ) {
- return elem.getAttribute("type");
- }
- },
-
- find: {
- "ID": assertGetIdNotName ?
- function( id, context, xml ) {
- if ( typeof context.getElementById !== strundefined && !xml ) {
- var m = context.getElementById( id );
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- } :
- function( id, context, xml ) {
- if ( typeof context.getElementById !== strundefined && !xml ) {
- var m = context.getElementById( id );
-
- return m ?
- m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
- [m] :
- undefined :
- [];
- }
- },
-
- "TAG": assertTagNameNoComments ?
- function( tag, context ) {
- if ( typeof context.getElementsByTagName !== strundefined ) {
- return context.getElementsByTagName( tag );
- }
- } :
- function( tag, context ) {
- var results = context.getElementsByTagName( tag );
-
- // Filter out possible comments
- if ( tag === "*" ) {
- var elem,
- tmp = [],
- i = 0;
-
- for ( ; (elem = results[i]); i++ ) {
- if ( elem.nodeType === 1 ) {
- tmp.push( elem );
- }
- }
-
- return tmp;
- }
- return results;
- },
-
- "NAME": assertUsableName && function( tag, context ) {
- if ( typeof context.getElementsByName !== strundefined ) {
- return context.getElementsByName( name );
- }
- },
-
- "CLASS": assertUsableClassName && function( className, context, xml ) {
- if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
- return context.getElementsByClassName( className );
- }
- }
- },
-
- relative: {
- ">": { dir: "parentNode", first: true },
- " ": { dir: "parentNode" },
- "+": { dir: "previousSibling", first: true },
- "~": { dir: "previousSibling" }
- },
-
- preFilter: {
- "ATTR": function( match ) {
- match[1] = match[1].replace( rbackslash, "" );
-
- // Move the given value to match[3] whether quoted or unquoted
- match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[3] = " " + match[3] + " ";
- }
-
- return match.slice( 0, 4 );
- },
-
- "CHILD": function( match ) {
- /* matches from matchExpr["CHILD"]
- 1 type (only|nth|...)
- 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
- 3 xn-component of xn+y argument ([+-]?\d*n|)
- 4 sign of xn-component
- 5 x of xn-component
- 6 sign of y-component
- 7 y of y-component
- */
- match[1] = match[1].toLowerCase();
-
- if ( match[1] === "nth" ) {
- // nth-child requires argument
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // numeric x and y parameters for Expr.filter.CHILD
- // remember that false/true cast respectively to 0/1
- match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
- match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
-
- // other types prohibit arguments
- } else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- return match;
- },
-
- "PSEUDO": function( match ) {
- var unquoted, excess;
- if ( matchExpr["CHILD"].test( match[0] ) ) {
- return null;
- }
-
- if ( match[3] ) {
- match[2] = match[3];
- } else if ( (unquoted = match[4]) ) {
- // Only check arguments that contain a pseudo
- if ( rpseudo.test(unquoted) &&
- // Get excess from tokenize (recursively)
- (excess = tokenize( unquoted, true )) &&
- // advance to the next closing parenthesis
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
-
- // excess is a negative index
- unquoted = unquoted.slice( 0, excess );
- match[0] = match[0].slice( 0, excess );
- }
- match[2] = unquoted;
- }
-
- // Return only captures needed by the pseudo filter method (type and argument)
- return match.slice( 0, 3 );
- }
- },
-
- filter: {
- "ID": assertGetIdNotName ?
- function( id ) {
- id = id.replace( rbackslash, "" );
- return function( elem ) {
- return elem.getAttribute("id") === id;
- };
- } :
- function( id ) {
- id = id.replace( rbackslash, "" );
- return function( elem ) {
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
- return node && node.value === id;
- };
- },
-
- "TAG": function( nodeName ) {
- if ( nodeName === "*" ) {
- return function() { return true; };
- }
- nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
-
- return function( elem ) {
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
- };
- },
-
- "CLASS": function( className ) {
- var pattern = classCache[ expando ][ className + " " ];
-
- return pattern ||
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
- classCache( className, function( elem ) {
- return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
- });
- },
-
- "ATTR": function( name, operator, check ) {
- return function( elem, context ) {
- var result = Sizzle.attr( elem, name );
-
- if ( result == null ) {
- return operator === "!=";
- }
- if ( !operator ) {
- return true;
- }
-
- result += "";
-
- return operator === "=" ? result === check :
- operator === "!=" ? result !== check :
- operator === "^=" ? check && result.indexOf( check ) === 0 :
- operator === "*=" ? check && result.indexOf( check ) > -1 :
- operator === "$=" ? check && result.substr( result.length - check.length ) === check :
- operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
- operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
- false;
- };
- },
-
- "CHILD": function( type, argument, first, last ) {
-
- if ( type === "nth" ) {
- return function( elem ) {
- var node, diff,
- parent = elem.parentNode;
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- if ( parent ) {
- diff = 0;
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- diff++;
- if ( elem === node ) {
- break;
- }
- }
- }
- }
-
- // Incorporate the offset (or cast to NaN), then check against cycle size
- diff -= last;
- return diff === first || ( diff % first === 0 && diff / first >= 0 );
- };
- }
-
- return function( elem ) {
- var node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- /* falls through */
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
- }
- };
- },
-
- "PSEUDO": function( pseudo, argument ) {
- // pseudo-class names are case-insensitive
- // http://www.w3.org/TR/selectors/#pseudo-classes
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
- // Remember that setFilters inherits from pseudos
- var args,
- fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
- Sizzle.error( "unsupported pseudo: " + pseudo );
-
- // The user may use createPseudo to indicate that
- // arguments are needed to create the filter function
- // just as Sizzle does
- if ( fn[ expando ] ) {
- return fn( argument );
- }
-
- // But maintain support for old signatures
- if ( fn.length > 1 ) {
- args = [ pseudo, pseudo, "", argument ];
- return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
- markFunction(function( seed, matches ) {
- var idx,
- matched = fn( seed, argument ),
- i = matched.length;
- while ( i-- ) {
- idx = indexOf.call( seed, matched[i] );
- seed[ idx ] = !( matches[ idx ] = matched[i] );
- }
- }) :
- function( elem ) {
- return fn( elem, 0, args );
- };
- }
-
- return fn;
- }
- },
-
- pseudos: {
- "not": markFunction(function( selector ) {
- // Trim the selector passed to compile
- // to avoid treating leading and trailing
- // spaces as combinators
- var input = [],
- results = [],
- matcher = compile( selector.replace( rtrim, "$1" ) );
-
- return matcher[ expando ] ?
- markFunction(function( seed, matches, context, xml ) {
- var elem,
- unmatched = matcher( seed, null, xml, [] ),
- i = seed.length;
-
- // Match elements unmatched by `matcher`
- while ( i-- ) {
- if ( (elem = unmatched[i]) ) {
- seed[i] = !(matches[i] = elem);
- }
- }
- }) :
- function( elem, context, xml ) {
- input[0] = elem;
- matcher( input, null, xml, results );
- return !results.pop();
- };
- }),
-
- "has": markFunction(function( selector ) {
- return function( elem ) {
- return Sizzle( selector, elem ).length > 0;
- };
- }),
-
- "contains": markFunction(function( text ) {
- return function( elem ) {
- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
- };
- }),
-
- "enabled": function( elem ) {
- return elem.disabled === false;
- },
-
- "disabled": function( elem ) {
- return elem.disabled === true;
- },
-
- "checked": function( elem ) {
- // In CSS3, :checked should return both checked and selected elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- var nodeName = elem.nodeName.toLowerCase();
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
- },
-
- "selected": function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- "parent": function( elem ) {
- return !Expr.pseudos["empty"]( elem );
- },
-
- "empty": function( elem ) {
- // http://www.w3.org/TR/selectors/#empty-pseudo
- // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
- // not comment, processing instructions, or others
- // Thanks to Diego Perini for the nodeName shortcut
- // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
- var nodeType;
- elem = elem.firstChild;
- while ( elem ) {
- if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
- return false;
- }
- elem = elem.nextSibling;
- }
- return true;
- },
-
- "header": function( elem ) {
- return rheader.test( elem.nodeName );
- },
-
- "text": function( elem ) {
- var type, attr;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" &&
- (type = elem.type) === "text" &&
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
- },
-
- // Input types
- "radio": createInputPseudo("radio"),
- "checkbox": createInputPseudo("checkbox"),
- "file": createInputPseudo("file"),
- "password": createInputPseudo("password"),
- "image": createInputPseudo("image"),
-
- "submit": createButtonPseudo("submit"),
- "reset": createButtonPseudo("reset"),
-
- "button": function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === "button" || name === "button";
- },
-
- "input": function( elem ) {
- return rinputs.test( elem.nodeName );
- },
-
- "focus": function( elem ) {
- var doc = elem.ownerDocument;
- return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
- },
-
- "active": function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- },
-
- // Positional types
- "first": createPositionalPseudo(function() {
- return [ 0 ];
- }),
-
- "last": createPositionalPseudo(function( matchIndexes, length ) {
- return [ length - 1 ];
- }),
-
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
- return [ argument < 0 ? argument + length : argument ];
- }),
-
- "even": createPositionalPseudo(function( matchIndexes, length ) {
- for ( var i = 0; i < length; i += 2 ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
-
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
- for ( var i = 1; i < length; i += 2 ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
-
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
- for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
-
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
- for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- })
- }
-};
-
-function siblingCheck( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
-}
-
-sortOrder = docElem.compareDocumentPosition ?
- function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
- a.compareDocumentPosition :
- a.compareDocumentPosition(b) & 4
- ) ? -1 : 1;
- } :
- function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
-// Always assume the presence of duplicates if sort doesn't
-// pass them to our comparison function (as in Google Chrome).
-[0, 0].sort( sortOrder );
-baseHasDuplicate = !hasDuplicate;
-
-// Document sorting and removing duplicates
-Sizzle.uniqueSort = function( results ) {
- var elem,
- duplicates = [],
- i = 1,
- j = 0;
-
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( ; (elem = results[i]); i++ ) {
- if ( elem === results[ i - 1 ] ) {
- j = duplicates.push( i );
- }
- }
- while ( j-- ) {
- results.splice( duplicates[ j ], 1 );
- }
- }
-
- return results;
-};
-
-Sizzle.error = function( msg ) {
- throw new Error( "Syntax error, unrecognized expression: " + msg );
-};
-
-function tokenize( selector, parseOnly ) {
- var matched, match, tokens, type,
- soFar, groups, preFilters,
- cached = tokenCache[ expando ][ selector + " " ];
-
- if ( cached ) {
- return parseOnly ? 0 : cached.slice( 0 );
- }
-
- soFar = selector;
- groups = [];
- preFilters = Expr.preFilter;
-
- while ( soFar ) {
-
- // Comma and first run
- if ( !matched || (match = rcomma.exec( soFar )) ) {
- if ( match ) {
- // Don't consume trailing commas as valid
- soFar = soFar.slice( match[0].length ) || soFar;
- }
- groups.push( tokens = [] );
- }
-
- matched = false;
-
- // Combinators
- if ( (match = rcombinators.exec( soFar )) ) {
- tokens.push( matched = new Token( match.shift() ) );
- soFar = soFar.slice( matched.length );
-
- // Cast descendant combinators to space
- matched.type = match[0].replace( rtrim, " " );
- }
-
- // Filters
- for ( type in Expr.filter ) {
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
- (match = preFilters[ type ]( match ))) ) {
-
- tokens.push( matched = new Token( match.shift() ) );
- soFar = soFar.slice( matched.length );
- matched.type = type;
- matched.matches = match;
- }
- }
-
- if ( !matched ) {
- break;
- }
- }
-
- // Return the length of the invalid excess
- // if we're just parsing
- // Otherwise, throw an error or return tokens
- return parseOnly ?
- soFar.length :
- soFar ?
- Sizzle.error( selector ) :
- // Cache the tokens
- tokenCache( selector, groups ).slice( 0 );
-}
-
-function addCombinator( matcher, combinator, base ) {
- var dir = combinator.dir,
- checkNonElements = base && combinator.dir === "parentNode",
- doneName = done++;
-
- return combinator.first ?
- // Check against closest ancestor/preceding element
- function( elem, context, xml ) {
- while ( (elem = elem[ dir ]) ) {
- if ( checkNonElements || elem.nodeType === 1 ) {
- return matcher( elem, context, xml );
- }
- }
- } :
-
- // Check against all ancestor/preceding elements
- function( elem, context, xml ) {
- // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
- if ( !xml ) {
- var cache,
- dirkey = dirruns + " " + doneName + " ",
- cachedkey = dirkey + cachedruns;
- while ( (elem = elem[ dir ]) ) {
- if ( checkNonElements || elem.nodeType === 1 ) {
- if ( (cache = elem[ expando ]) === cachedkey ) {
- return elem.sizset;
- } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
- if ( elem.sizset ) {
- return elem;
- }
- } else {
- elem[ expando ] = cachedkey;
- if ( matcher( elem, context, xml ) ) {
- elem.sizset = true;
- return elem;
- }
- elem.sizset = false;
- }
- }
- }
- } else {
- while ( (elem = elem[ dir ]) ) {
- if ( checkNonElements || elem.nodeType === 1 ) {
- if ( matcher( elem, context, xml ) ) {
- return elem;
- }
- }
- }
- }
- };
-}
-
-function elementMatcher( matchers ) {
- return matchers.length > 1 ?
- function( elem, context, xml ) {
- var i = matchers.length;
- while ( i-- ) {
- if ( !matchers[i]( elem, context, xml ) ) {
- return false;
- }
- }
- return true;
- } :
- matchers[0];
-}
-
-function condense( unmatched, map, filter, context, xml ) {
- var elem,
- newUnmatched = [],
- i = 0,
- len = unmatched.length,
- mapped = map != null;
-
- for ( ; i < len; i++ ) {
- if ( (elem = unmatched[i]) ) {
- if ( !filter || filter( elem, context, xml ) ) {
- newUnmatched.push( elem );
- if ( mapped ) {
- map.push( i );
- }
- }
- }
- }
-
- return newUnmatched;
-}
-
-function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
- if ( postFilter && !postFilter[ expando ] ) {
- postFilter = setMatcher( postFilter );
- }
- if ( postFinder && !postFinder[ expando ] ) {
- postFinder = setMatcher( postFinder, postSelector );
- }
- return markFunction(function( seed, results, context, xml ) {
- var temp, i, elem,
- preMap = [],
- postMap = [],
- preexisting = results.length,
-
- // Get initial elements from seed or context
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
-
- // Prefilter to get matcher input, preserving a map for seed-results synchronization
- matcherIn = preFilter && ( seed || !selector ) ?
- condense( elems, preMap, preFilter, context, xml ) :
- elems,
-
- matcherOut = matcher ?
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
-
- // ...intermediate processing is necessary
- [] :
-
- // ...otherwise use results directly
- results :
- matcherIn;
-
- // Find primary matches
- if ( matcher ) {
- matcher( matcherIn, matcherOut, context, xml );
- }
-
- // Apply postFilter
- if ( postFilter ) {
- temp = condense( matcherOut, postMap );
- postFilter( temp, [], context, xml );
-
- // Un-match failing elements by moving them back to matcherIn
- i = temp.length;
- while ( i-- ) {
- if ( (elem = temp[i]) ) {
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
- }
- }
- }
-
- if ( seed ) {
- if ( postFinder || preFilter ) {
- if ( postFinder ) {
- // Get the final matcherOut by condensing this intermediate into postFinder contexts
- temp = [];
- i = matcherOut.length;
- while ( i-- ) {
- if ( (elem = matcherOut[i]) ) {
- // Restore matcherIn since elem is not yet a final match
- temp.push( (matcherIn[i] = elem) );
- }
- }
- postFinder( null, (matcherOut = []), temp, xml );
- }
-
- // Move matched elements from seed to results to keep them synchronized
- i = matcherOut.length;
- while ( i-- ) {
- if ( (elem = matcherOut[i]) &&
- (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
-
- seed[temp] = !(results[temp] = elem);
- }
- }
- }
-
- // Add elements to results, through postFinder if defined
- } else {
- matcherOut = condense(
- matcherOut === results ?
- matcherOut.splice( preexisting, matcherOut.length ) :
- matcherOut
- );
- if ( postFinder ) {
- postFinder( null, results, matcherOut, xml );
- } else {
- push.apply( results, matcherOut );
- }
- }
- });
-}
-
-function matcherFromTokens( tokens ) {
- var checkContext, matcher, j,
- len = tokens.length,
- leadingRelative = Expr.relative[ tokens[0].type ],
- implicitRelative = leadingRelative || Expr.relative[" "],
- i = leadingRelative ? 1 : 0,
-
- // The foundational matcher ensures that elements are reachable from top-level context(s)
- matchContext = addCombinator( function( elem ) {
- return elem === checkContext;
- }, implicitRelative, true ),
- matchAnyContext = addCombinator( function( elem ) {
- return indexOf.call( checkContext, elem ) > -1;
- }, implicitRelative, true ),
- matchers = [ function( elem, context, xml ) {
- return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
- (checkContext = context).nodeType ?
- matchContext( elem, context, xml ) :
- matchAnyContext( elem, context, xml ) );
- } ];
-
- for ( ; i < len; i++ ) {
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
- matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
- } else {
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
-
- // Return special upon seeing a positional matcher
- if ( matcher[ expando ] ) {
- // Find the next relative operator (if any) for proper handling
- j = ++i;
- for ( ; j < len; j++ ) {
- if ( Expr.relative[ tokens[j].type ] ) {
- break;
- }
- }
- return setMatcher(
- i > 1 && elementMatcher( matchers ),
- i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
- matcher,
- i < j && matcherFromTokens( tokens.slice( i, j ) ),
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
- j < len && tokens.join("")
- );
- }
- matchers.push( matcher );
- }
- }
-
- return elementMatcher( matchers );
-}
-
-function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
- var bySet = setMatchers.length > 0,
- byElement = elementMatchers.length > 0,
- superMatcher = function( seed, context, xml, results, expandContext ) {
- var elem, j, matcher,
- setMatched = [],
- matchedCount = 0,
- i = "0",
- unmatched = seed && [],
- outermost = expandContext != null,
- contextBackup = outermostContext,
- // We must always have either seed elements or context
- elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
- // Nested matchers should use non-integer dirruns
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
-
- if ( outermost ) {
- outermostContext = context !== document && context;
- cachedruns = superMatcher.el;
- }
-
- // Add elements passing elementMatchers directly to results
- for ( ; (elem = elems[i]) != null; i++ ) {
- if ( byElement && elem ) {
- for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
- if ( matcher( elem, context, xml ) ) {
- results.push( elem );
- break;
- }
- }
- if ( outermost ) {
- dirruns = dirrunsUnique;
- cachedruns = ++superMatcher.el;
- }
- }
-
- // Track unmatched elements for set filters
- if ( bySet ) {
- // They will have gone through all possible matchers
- if ( (elem = !matcher && elem) ) {
- matchedCount--;
- }
-
- // Lengthen the array for every element, matched or not
- if ( seed ) {
- unmatched.push( elem );
- }
- }
- }
-
- // Apply set filters to unmatched elements
- matchedCount += i;
- if ( bySet && i !== matchedCount ) {
- for ( j = 0; (matcher = setMatchers[j]); j++ ) {
- matcher( unmatched, setMatched, context, xml );
- }
-
- if ( seed ) {
- // Reintegrate element matches to eliminate the need for sorting
- if ( matchedCount > 0 ) {
- while ( i-- ) {
- if ( !(unmatched[i] || setMatched[i]) ) {
- setMatched[i] = pop.call( results );
- }
- }
- }
-
- // Discard index placeholder values to get only actual matches
- setMatched = condense( setMatched );
- }
-
- // Add matches to results
- push.apply( results, setMatched );
-
- // Seedless set matches succeeding multiple successful matchers stipulate sorting
- if ( outermost && !seed && setMatched.length > 0 &&
- ( matchedCount + setMatchers.length ) > 1 ) {
-
- Sizzle.uniqueSort( results );
- }
- }
-
- // Override manipulation of globals by nested matchers
- if ( outermost ) {
- dirruns = dirrunsUnique;
- outermostContext = contextBackup;
- }
-
- return unmatched;
- };
-
- superMatcher.el = 0;
- return bySet ?
- markFunction( superMatcher ) :
- superMatcher;
-}
-
-compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
- var i,
- setMatchers = [],
- elementMatchers = [],
- cached = compilerCache[ expando ][ selector + " " ];
-
- if ( !cached ) {
- // Generate a function of recursive functions that can be used to check each element
- if ( !group ) {
- group = tokenize( selector );
- }
- i = group.length;
- while ( i-- ) {
- cached = matcherFromTokens( group[i] );
- if ( cached[ expando ] ) {
- setMatchers.push( cached );
- } else {
- elementMatchers.push( cached );
- }
- }
-
- // Cache the compiled function
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
- }
- return cached;
-};
-
-function multipleContexts( selector, contexts, results ) {
- var i = 0,
- len = contexts.length;
- for ( ; i < len; i++ ) {
- Sizzle( selector, contexts[i], results );
- }
- return results;
-}
-
-function select( selector, context, results, seed, xml ) {
- var i, tokens, token, type, find,
- match = tokenize( selector ),
- j = match.length;
-
- if ( !seed ) {
- // Try to minimize operations if there is only one group
- if ( match.length === 1 ) {
-
- // Take a shortcut and set the context if the root selector is an ID
- tokens = match[0] = match[0].slice( 0 );
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
- context.nodeType === 9 && !xml &&
- Expr.relative[ tokens[1].type ] ) {
-
- context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
- if ( !context ) {
- return results;
- }
-
- selector = selector.slice( tokens.shift().length );
- }
-
- // Fetch a seed set for right-to-left matching
- for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
- token = tokens[i];
-
- // Abort if we hit a combinator
- if ( Expr.relative[ (type = token.type) ] ) {
- break;
- }
- if ( (find = Expr.find[ type ]) ) {
- // Search, expanding context for leading sibling combinators
- if ( (seed = find(
- token.matches[0].replace( rbackslash, "" ),
- rsibling.test( tokens[0].type ) && context.parentNode || context,
- xml
- )) ) {
-
- // If seed is empty or no tokens remain, we can return early
- tokens.splice( i, 1 );
- selector = seed.length && tokens.join("");
- if ( !selector ) {
- push.apply( results, slice.call( seed, 0 ) );
- return results;
- }
-
- break;
- }
- }
- }
- }
- }
-
- // Compile and execute a filtering function
- // Provide `match` to avoid retokenization if we modified the selector above
- compile( selector, match )(
- seed,
- context,
- xml,
- results,
- rsibling.test( selector )
- );
- return results;
-}
-
-if ( document.querySelectorAll ) {
- (function() {
- var disconnectedMatch,
- oldSelect = select,
- rescape = /'|\\/g,
- rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
-
- // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
- // A support test would require too much code (would include document ready)
- rbuggyQSA = [ ":focus" ],
-
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
- // A support test would require too much code (would include document ready)
- // just skip matchesSelector for :active
- rbuggyMatches = [ ":active" ],
- matches = docElem.matchesSelector ||
- docElem.mozMatchesSelector ||
- docElem.webkitMatchesSelector ||
- docElem.oMatchesSelector ||
- docElem.msMatchesSelector;
-
- // Build QSA regex
- // Regex strategy adopted from Diego Perini
- assert(function( div ) {
- // Select is set to empty string on purpose
- // This is to test IE's treatment of not explictly
- // setting a boolean content attribute,
- // since its presence should be enough
- // http://bugs.jquery.com/ticket/12359
- div.innerHTML = "<select><option selected=''></option></select>";
-
- // IE8 - Some boolean attributes are not treated correctly
- if ( !div.querySelectorAll("[selected]").length ) {
- rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
- }
-
- // Webkit/Opera - :checked should return selected option elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- // IE8 throws error here (do not put tests after this one)
- if ( !div.querySelectorAll(":checked").length ) {
- rbuggyQSA.push(":checked");
- }
- });
-
- assert(function( div ) {
-
- // Opera 10-12/IE9 - ^= $= *= and empty values
- // Should not select anything
- div.innerHTML = "<p test=''></p>";
- if ( div.querySelectorAll("[test^='']").length ) {
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
- }
-
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
- // IE8 throws error here (do not put tests after this one)
- div.innerHTML = "<input type='hidden'/>";
- if ( !div.querySelectorAll(":enabled").length ) {
- rbuggyQSA.push(":enabled", ":disabled");
- }
- });
-
- // rbuggyQSA always contains :focus, so no need for a length check
- rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
-
- select = function( selector, context, results, seed, xml ) {
- // Only use querySelectorAll when not filtering,
- // when this is not xml,
- // and when no QSA bugs apply
- if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
- var groups, i,
- old = true,
- nid = expando,
- newContext = context,
- newSelector = context.nodeType === 9 && selector;
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- groups = tokenize( selector );
-
- if ( (old = context.getAttribute("id")) ) {
- nid = old.replace( rescape, "\\$&" );
- } else {
- context.setAttribute( "id", nid );
- }
- nid = "[id='" + nid + "'] ";
-
- i = groups.length;
- while ( i-- ) {
- groups[i] = nid + groups[i].join("");
- }
- newContext = rsibling.test( selector ) && context.parentNode || context;
- newSelector = groups.join(",");
- }
-
- if ( newSelector ) {
- try {
- push.apply( results, slice.call( newContext.querySelectorAll(
- newSelector
- ), 0 ) );
- return results;
- } catch(qsaError) {
- } finally {
- if ( !old ) {
- context.removeAttribute("id");
- }
- }
- }
- }
-
- return oldSelect( selector, context, results, seed, xml );
- };
-
- if ( matches ) {
- assert(function( div ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9)
- disconnectedMatch = matches.call( div, "div" );
-
- // This should fail with an exception
- // Gecko does not error, returns false instead
- try {
- matches.call( div, "[test!='']:sizzle" );
- rbuggyMatches.push( "!=", pseudos );
- } catch ( e ) {}
- });
-
- // rbuggyMatches always contains :active and :focus, so no need for a length check
- rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
-
- Sizzle.matchesSelector = function( elem, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace( rattributeQuotes, "='$1']" );
-
- // rbuggyMatches always contains :active, so no need for an existence check
- if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
- try {
- var ret = matches.call( elem, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9
- elem.document && elem.document.nodeType !== 11 ) {
- return ret;
- }
- } catch(e) {}
- }
-
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
- };
- }
- })();
-}
-
-// Deprecated
-Expr.pseudos["nth"] = Expr.pseudos["eq"];
-
-// Back-compat
-function setFilters() {}
-Expr.filters = setFilters.prototype = Expr.pseudos;
-Expr.setFilters = new setFilters();
-
-// Override sizzle attribute retrieval
-Sizzle.attr = jQuery.attr;
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.pseudos;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})( window );
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prev(?:Until|All))/,
- isSimple = /^.[^:#\[\.,]*$/,
- rneedsContext = jQuery.expr.match.needsContext,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var i, l, length, n, r, ret,
- self = this;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- ret = this.pushStack( "", "find", selector );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var i,
- targets = jQuery( target, this ),
- len = targets.length;
-
- return this.filter(function() {
- for ( i = 0; i < len; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && (
- typeof selector === "string" ?
- // If this is a positional/relative selector, check membership in the returned set
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
- rneedsContext.test( selector ) ?
- jQuery( selector, this.context ).index( this[0] ) >= 0 :
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var cur,
- i = 0,
- l = this.length,
- ret = [],
- pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( ; i < l; i++ ) {
- cur = this[i];
-
- while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
- }
- cur = cur.parentNode;
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
-
- // No argument, return index in parent
- if ( !elem ) {
- return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
- }
-
- // index in selector
- if ( typeof elem === "string" ) {
- return jQuery.inArray( this[0], jQuery( elem ) );
- }
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- addBack: function( selector ) {
- return this.add( selector == null ?
- this.prevObject : this.prevObject.filter(selector)
- );
- }
-});
-
-jQuery.fn.andSelf = jQuery.fn.addBack;
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-function sibling( cur, dir ) {
- do {
- cur = cur[ dir ];
- } while ( cur && cur.nodeType !== 1 );
-
- return cur;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return sibling( elem, "nextSibling" );
- },
- prev: function( elem ) {
- return sibling( elem, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.merge( [], elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until );
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( this.length > 1 && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return ( elem === qualifier ) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
- });
-}
-function createSafeFragment( document ) {
- var list = nodeNames.split( "|" ),
- safeFrag = document.createDocumentFragment();
-
- if ( safeFrag.createElement ) {
- while ( list.length ) {
- safeFrag.createElement(
- list.pop()
- );
- }
- }
- return safeFrag;
-}
-
-var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
- "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
- rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
- rtagName = /<([\w:]+)/,
- rtbody = /<tbody/i,
- rhtml = /<|&#?\w+;/,
- rnoInnerhtml = /<(?:script|style|link)/i,
- rnocache = /<(?:script|object|embed|option|style)/i,
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
- rcheckableType = /^(?:checkbox|radio)$/,
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rscriptType = /\/(java|ecma)script/i,
- rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
- wrapMap = {
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
- legend: [ 1, "<fieldset>", "</fieldset>" ],
- thead: [ 1, "<table>", "</table>" ],
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
- col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
- area: [ 1, "<map>", "</map>" ],
- _default: [ 0, "", "" ]
- },
- safeFragment = createSafeFragment( document ),
- fragmentDiv = safeFragment.appendChild( document.createElement("div") );
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
-// unless wrapped in a div with non-breaking characters in front of it.
-if ( !jQuery.support.htmlSerialize ) {
- wrapMap._default = [ 1, "X<div>", "</div>" ];
-}
-
-jQuery.fn.extend({
- text: function( value ) {
- return jQuery.access( this, function( value ) {
- return value === undefined ?
- jQuery.text( this ) :
- this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
- }, null, value, arguments.length );
- },
-
- wrapAll: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapAll( html.call(this, i) );
- });
- }
-
- if ( this[0] ) {
- // The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
-
- if ( this[0].parentNode ) {
- wrap.insertBefore( this[0] );
- }
-
- wrap.map(function() {
- var elem = this;
-
- while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
- elem = elem.firstChild;
- }
-
- return elem;
- }).append( this );
- }
-
- return this;
- },
-
- wrapInner: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapInner( html.call(this, i) );
- });
- }
-
- return this.each(function() {
- var self = jQuery( this ),
- contents = self.contents();
-
- if ( contents.length ) {
- contents.wrapAll( html );
-
- } else {
- self.append( html );
- }
- });
- },
-
- wrap: function( html ) {
- var isFunction = jQuery.isFunction( html );
-
- return this.each(function(i) {
- jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
- });
- },
-
- unwrap: function() {
- return this.parent().each(function() {
- if ( !jQuery.nodeName( this, "body" ) ) {
- jQuery( this ).replaceWith( this.childNodes );
- }
- }).end();
- },
-
- append: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 || this.nodeType === 11 ) {
- this.appendChild( elem );
- }
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 || this.nodeType === 11 ) {
- this.insertBefore( elem, this.firstChild );
- }
- });
- },
-
- before: function() {
- if ( !isDisconnected( this[0] ) ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this );
- });
- }
-
- if ( arguments.length ) {
- var set = jQuery.clean( arguments );
- return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
- }
- },
-
- after: function() {
- if ( !isDisconnected( this[0] ) ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- }
-
- if ( arguments.length ) {
- var set = jQuery.clean( arguments );
- return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
- }
- },
-
- // keepData is for internal use only--do not document
- remove: function( selector, keepData ) {
- var elem,
- i = 0;
-
- for ( ; (elem = this[i]) != null; i++ ) {
- if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
- if ( !keepData && elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- jQuery.cleanData( [ elem ] );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- }
- }
-
- return this;
- },
-
- empty: function() {
- var elem,
- i = 0;
-
- for ( ; (elem = this[i]) != null; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- }
-
- // Remove any remaining nodes
- while ( elem.firstChild ) {
- elem.removeChild( elem.firstChild );
- }
- }
-
- return this;
- },
-
- clone: function( dataAndEvents, deepDataAndEvents ) {
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
-
- return this.map( function () {
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
- },
-
- html: function( value ) {
- return jQuery.access( this, function( value ) {
- var elem = this[0] || {},
- i = 0,
- l = this.length;
-
- if ( value === undefined ) {
- return elem.nodeType === 1 ?
- elem.innerHTML.replace( rinlinejQuery, "" ) :
- undefined;
- }
-
- // See if we can take a shortcut and just use innerHTML
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
- ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
- ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
- !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
-
- value = value.replace( rxhtmlTag, "<$1></$2>" );
-
- try {
- for (; i < l; i++ ) {
- // Remove element nodes and prevent memory leaks
- elem = this[i] || {};
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName( "*" ) );
- elem.innerHTML = value;
- }
- }
-
- elem = 0;
-
- // If using innerHTML throws an exception, use the fallback method
- } catch(e) {}
- }
-
- if ( elem ) {
- this.empty().append( value );
- }
- }, null, value, arguments.length );
- },
-
- replaceWith: function( value ) {
- if ( !isDisconnected( this[0] ) ) {
- // Make sure that the elements are removed from the DOM before they are inserted
- // this can help fix replacing a parent with child elements
- if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this), old = self.html();
- self.replaceWith( value.call( this, i, old ) );
- });
- }
-
- if ( typeof value !== "string" ) {
- value = jQuery( value ).detach();
- }
-
- return this.each(function() {
- var next = this.nextSibling,
- parent = this.parentNode;
-
- jQuery( this ).remove();
-
- if ( next ) {
- jQuery(next).before( value );
- } else {
- jQuery(parent).append( value );
- }
- });
- }
-
- return this.length ?
- this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
- this;
- },
-
- detach: function( selector ) {
- return this.remove( selector, true );
- },
-
- domManip: function( args, table, callback ) {
-
- // Flatten any nested arrays
- args = [].concat.apply( [], args );
-
- var results, first, fragment, iNoClone,
- i = 0,
- value = args[0],
- scripts = [],
- l = this.length;
-
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
- return this.each(function() {
- jQuery(this).domManip( args, table, callback );
- });
- }
-
- if ( jQuery.isFunction(value) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- args[0] = value.call( this, i, table ? self.html() : undefined );
- self.domManip( args, table, callback );
- });
- }
-
- if ( this[0] ) {
- results = jQuery.buildFragment( args, this, scripts );
- fragment = results.fragment;
- first = fragment.firstChild;
-
- if ( fragment.childNodes.length === 1 ) {
- fragment = first;
- }
-
- if ( first ) {
- table = table && jQuery.nodeName( first, "tr" );
-
- // Use the original fragment for the last item instead of the first because it can end up
- // being emptied incorrectly in certain situations (#8070).
- // Fragments from the fragment cache must always be cloned and never used in place.
- for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
- callback.call(
- table && jQuery.nodeName( this[i], "table" ) ?
- findOrAppend( this[i], "tbody" ) :
- this[i],
- i === iNoClone ?
- fragment :
- jQuery.clone( fragment, true, true )
- );
- }
- }
-
- // Fix #11809: Avoid leaking memory
- fragment = first = null;
-
- if ( scripts.length ) {
- jQuery.each( scripts, function( i, elem ) {
- if ( elem.src ) {
- if ( jQuery.ajax ) {
- jQuery.ajax({
- url: elem.src,
- type: "GET",
- dataType: "script",
- async: false,
- global: false,
- "throws": true
- });
- } else {
- jQuery.error("no ajax");
- }
- } else {
- jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- });
- }
- }
-
- return this;
- }
-});
-
-function findOrAppend( elem, tag ) {
- return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
-}
-
-function cloneCopyEvent( src, dest ) {
-
- if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
- return;
- }
-
- var type, i, l,
- oldData = jQuery._data( src ),
- curData = jQuery._data( dest, oldData ),
- events = oldData.events;
-
- if ( events ) {
- delete curData.handle;
- curData.events = {};
-
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type, events[ type ][ i ] );
- }
- }
- }
-
- // make the cloned public data object a copy from the original
- if ( curData.data ) {
- curData.data = jQuery.extend( {}, curData.data );
- }
-}
-
-function cloneFixAttributes( src, dest ) {
- var nodeName;
-
- // We do not need to do anything for non-Elements
- if ( dest.nodeType !== 1 ) {
- return;
- }
-
- // clearAttributes removes the attributes, which we don't want,
- // but also removes the attachEvent events, which we *do* want
- if ( dest.clearAttributes ) {
- dest.clearAttributes();
- }
-
- // mergeAttributes, in contrast, only merges back on the
- // original attributes, not the events
- if ( dest.mergeAttributes ) {
- dest.mergeAttributes( src );
- }
-
- nodeName = dest.nodeName.toLowerCase();
-
- if ( nodeName === "object" ) {
- // IE6-10 improperly clones children of object elements using classid.
- // IE10 throws NoModificationAllowedError if parent is null, #12132.
- if ( dest.parentNode ) {
- dest.outerHTML = src.outerHTML;
- }
-
- // This path appears unavoidable for IE9. When cloning an object
- // element in IE9, the outerHTML strategy above is not sufficient.
- // If the src has innerHTML and the destination does not,
- // copy the src.innerHTML into the dest.innerHTML. #10324
- if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
- dest.innerHTML = src.innerHTML;
- }
-
- } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
- // IE6-8 fails to persist the checked state of a cloned checkbox
- // or radio button. Worse, IE6-7 fail to give the cloned element
- // a checked appearance if the defaultChecked value isn't also set
-
- dest.defaultChecked = dest.checked = src.checked;
-
- // IE6-7 get confused and end up setting the value of a cloned
- // checkbox/radio button to an empty string instead of "on"
- if ( dest.value !== src.value ) {
- dest.value = src.value;
- }
-
- // IE6-8 fails to return the selected option to the default selected
- // state when cloning options
- } else if ( nodeName === "option" ) {
- dest.selected = src.defaultSelected;
-
- // IE6-8 fails to set the defaultValue to the correct value when
- // cloning other types of input fields
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
-
- // IE blanks contents when cloning scripts
- } else if ( nodeName === "script" && dest.text !== src.text ) {
- dest.text = src.text;
- }
-
- // Event data gets referenced instead of copied if the expando
- // gets copied too
- dest.removeAttribute( jQuery.expando );
-}
-
-jQuery.buildFragment = function( args, context, scripts ) {
- var fragment, cacheable, cachehit,
- first = args[ 0 ];
-
- // Set context from what may come in as undefined or a jQuery collection or a node
- // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
- // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
- context = context || document;
- context = !context.nodeType && context[0] || context;
- context = context.ownerDocument || context;
-
- // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
- // Cloning options loses the selected state, so don't cache them
- // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
- // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
- // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
- if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
- first.charAt(0) === "<" && !rnocache.test( first ) &&
- (jQuery.support.checkClone || !rchecked.test( first )) &&
- (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
-
- // Mark cacheable and look for a hit
- cacheable = true;
- fragment = jQuery.fragments[ first ];
- cachehit = fragment !== undefined;
- }
-
- if ( !fragment ) {
- fragment = context.createDocumentFragment();
- jQuery.clean( args, context, fragment, scripts );
-
- // Update the cache, but only store false
- // unless this is a second parsing of the same content
- if ( cacheable ) {
- jQuery.fragments[ first ] = cachehit && fragment;
- }
- }
-
- return { fragment: fragment, cacheable: cacheable };
-};
-
-jQuery.fragments = {};
-
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function( name, original ) {
- jQuery.fn[ name ] = function( selector ) {
- var elems,
- i = 0,
- ret = [],
- insert = jQuery( selector ),
- l = insert.length,
- parent = this.length === 1 && this[0].parentNode;
-
- if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
- insert[ original ]( this[0] );
- return this;
- } else {
- for ( ; i < l; i++ ) {
- elems = ( i > 0 ? this.clone(true) : this ).get();
- jQuery( insert[i] )[ original ]( elems );
- ret = ret.concat( elems );
- }
-
- return this.pushStack( ret, name, insert.selector );
- }
- };
-});
-
-function getAll( elem ) {
- if ( typeof elem.getElementsByTagName !== "undefined" ) {
- return elem.getElementsByTagName( "*" );
-
- } else if ( typeof elem.querySelectorAll !== "undefined" ) {
- return elem.querySelectorAll( "*" );
-
- } else {
- return [];
- }
-}
-
-// Used in clean, fixes the defaultChecked property
-function fixDefaultChecked( elem ) {
- if ( rcheckableType.test( elem.type ) ) {
- elem.defaultChecked = elem.checked;
- }
-}
-
-jQuery.extend({
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var srcElements,
- destElements,
- i,
- clone;
-
- if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
- clone = elem.cloneNode( true );
-
- // IE<=8 does not properly clone detached, unknown element nodes
- } else {
- fragmentDiv.innerHTML = elem.outerHTML;
- fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
- }
-
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
- // IE copies events bound via attachEvent when using cloneNode.
- // Calling detachEvent on the clone will also remove the events
- // from the original. In order to get around this, we use some
- // proprietary methods to clear the events. Thanks to MooTools
- // guys for this hotness.
-
- cloneFixAttributes( elem, clone );
-
- // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- // Weird iteration because IE will replace the length property
- // with an element if you are cloning the body and one of the
- // elements on the page has a name or id of "length"
- for ( i = 0; srcElements[i]; ++i ) {
- // Ensure that the destination node is not null; Fixes #9587
- if ( destElements[i] ) {
- cloneFixAttributes( srcElements[i], destElements[i] );
- }
- }
- }
-
- // Copy the events from the original to the clone
- if ( dataAndEvents ) {
- cloneCopyEvent( elem, clone );
-
- if ( deepDataAndEvents ) {
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- for ( i = 0; srcElements[i]; ++i ) {
- cloneCopyEvent( srcElements[i], destElements[i] );
- }
- }
- }
-
- srcElements = destElements = null;
-
- // Return the cloned set
- return clone;
- },
-
- clean: function( elems, context, fragment, scripts ) {
- var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
- safe = context === document && safeFragment,
- ret = [];
-
- // Ensure that context is a document
- if ( !context || typeof context.createDocumentFragment === "undefined" ) {
- context = document;
- }
-
- // Use the already-created safe fragment if context permits
- for ( i = 0; (elem = elems[i]) != null; i++ ) {
- if ( typeof elem === "number" ) {
- elem += "";
- }
-
- if ( !elem ) {
- continue;
- }
-
- // Convert html string into DOM nodes
- if ( typeof elem === "string" ) {
- if ( !rhtml.test( elem ) ) {
- elem = context.createTextNode( elem );
- } else {
- // Ensure a safe container in which to render the html
- safe = safe || createSafeFragment( context );
- div = context.createElement("div");
- safe.appendChild( div );
-
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, "<$1></$2>");
-
- // Go to html and back, then peel off extra wrappers
- tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
- wrap = wrapMap[ tag ] || wrapMap._default;
- depth = wrap[0];
- div.innerHTML = wrap[1] + elem + wrap[2];
-
- // Move to the right depth
- while ( depth-- ) {
- div = div.lastChild;
- }
-
- // Remove IE's autoinserted <tbody> from table fragments
- if ( !jQuery.support.tbody ) {
-
- // String was a <table>, *may* have spurious <tbody>
- hasBody = rtbody.test(elem);
- tbody = tag === "table" && !hasBody ?
- div.firstChild && div.firstChild.childNodes :
-
- // String was a bare <thead> or <tfoot>
- wrap[1] === "<table>" && !hasBody ?
- div.childNodes :
- [];
-
- for ( j = tbody.length - 1; j >= 0 ; --j ) {
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
- }
- }
- }
-
- // IE completely kills leading whitespace when innerHTML is used
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
- div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
- }
-
- elem = div.childNodes;
-
- // Take out of fragment container (we need a fresh div each time)
- div.parentNode.removeChild( div );
- }
- }
-
- if ( elem.nodeType ) {
- ret.push( elem );
- } else {
- jQuery.merge( ret, elem );
- }
- }
-
- // Fix #11356: Clear elements from safeFragment
- if ( div ) {
- elem = div = safe = null;
- }
-
- // Reset defaultChecked for any radios and checkboxes
- // about to be appended to the DOM in IE 6/7 (#8060)
- if ( !jQuery.support.appendChecked ) {
- for ( i = 0; (elem = ret[i]) != null; i++ ) {
- if ( jQuery.nodeName( elem, "input" ) ) {
- fixDefaultChecked( elem );
- } else if ( typeof elem.getElementsByTagName !== "undefined" ) {
- jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
- }
- }
- }
-
- // Append elements to a provided document fragment
- if ( fragment ) {
- // Special handling of each script element
- handleScript = function( elem ) {
- // Check if we consider it executable
- if ( !elem.type || rscriptType.test( elem.type ) ) {
- // Detach the script and store it in the scripts array (if provided) or the fragment
- // Return truthy to indicate that it has been handled
- return scripts ?
- scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
- fragment.appendChild( elem );
- }
- };
-
- for ( i = 0; (elem = ret[i]) != null; i++ ) {
- // Check if we're done after handling an executable script
- if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
- // Append to fragment and handle embedded scripts
- fragment.appendChild( elem );
- if ( typeof elem.getElementsByTagName !== "undefined" ) {
- // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
- jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
-
- // Splice the scripts into ret after their former ancestor and advance our index beyond them
- ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
- i += jsTags.length;
- }
- }
- }
- }
-
- return ret;
- },
-
- cleanData: function( elems, /* internal */ acceptData ) {
- var data, id, elem, type,
- i = 0,
- internalKey = jQuery.expando,
- cache = jQuery.cache,
- deleteExpando = jQuery.support.deleteExpando,
- special = jQuery.event.special;
-
- for ( ; (elem = elems[i]) != null; i++ ) {
-
- if ( acceptData || jQuery.acceptData( elem ) ) {
-
- id = elem[ internalKey ];
- data = id && cache[ id ];
-
- if ( data ) {
- if ( data.events ) {
- for ( type in data.events ) {
- if ( special[ type ] ) {
- jQuery.event.remove( elem, type );
-
- // This is a shortcut to avoid jQuery.event.remove's overhead
- } else {
- jQuery.removeEvent( elem, type, data.handle );
- }
- }
- }
-
- // Remove cache only if it was not already removed by jQuery.event.remove
- if ( cache[ id ] ) {
-
- delete cache[ id ];
-
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( deleteExpando ) {
- delete elem[ internalKey ];
-
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( internalKey );
-
- } else {
- elem[ internalKey ] = null;
- }
-
- jQuery.deletedIds.push( id );
- }
- }
- }
- }
- }
-});
-// Limit scope pollution from any deprecated API
-(function() {
-
-var matched, browser;
-
-// Use of jQuery.browser is frowned upon.
-// More details: http://api.jquery.com/jQuery.browser
-// jQuery.uaMatch maintained for back-compat
-jQuery.uaMatch = function( ua ) {
- ua = ua.toLowerCase();
-
- var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
- /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
- /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
- /(msie) ([\w.]+)/.exec( ua ) ||
- ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
- [];
-
- return {
- browser: match[ 1 ] || "",
- version: match[ 2 ] || "0"
- };
-};
-
-matched = jQuery.uaMatch( navigator.userAgent );
-browser = {};
-
-if ( matched.browser ) {
- browser[ matched.browser ] = true;
- browser.version = matched.version;
-}
-
-// Chrome is Webkit, but Webkit is also Safari.
-if ( browser.chrome ) {
- browser.webkit = true;
-} else if ( browser.webkit ) {
- browser.safari = true;
-}
-
-jQuery.browser = browser;
-
-jQuery.sub = function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
-};
-
-})();
-var curCSS, iframe, iframeDoc,
- ralpha = /alpha\([^)]*\)/i,
- ropacity = /opacity=([^)]*)/,
- rposition = /^(top|right|bottom|left)$/,
- // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
- // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
- rdisplayswap = /^(none|table(?!-c[ea]).+)/,
- rmargin = /^margin/,
- rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
- rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
- rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
- elemdisplay = { BODY: "block" },
-
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
- cssNormalTransform = {
- letterSpacing: 0,
- fontWeight: 400
- },
-
- cssExpand = [ "Top", "Right", "Bottom", "Left" ],
- cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
-
- eventsToggle = jQuery.fn.toggle;
-
-// return a css property mapped to a potentially vendor prefixed property
-function vendorPropName( style, name ) {
-
- // shortcut for names that are not vendor prefixed
- if ( name in style ) {
- return name;
- }
-
- // check for vendor prefixed names
- var capName = name.charAt(0).toUpperCase() + name.slice(1),
- origName = name,
- i = cssPrefixes.length;
-
- while ( i-- ) {
- name = cssPrefixes[ i ] + capName;
- if ( name in style ) {
- return name;
- }
- }
-
- return origName;
-}
-
-function isHidden( elem, el ) {
- elem = el || elem;
- return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
-}
-
-function showHide( elements, show ) {
- var elem, display,
- values = [],
- index = 0,
- length = elements.length;
-
- for ( ; index < length; index++ ) {
- elem = elements[ index ];
- if ( !elem.style ) {
- continue;
- }
- values[ index ] = jQuery._data( elem, "olddisplay" );
- if ( show ) {
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !values[ index ] && elem.style.display === "none" ) {
- elem.style.display = "";
- }
-
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( elem.style.display === "" && isHidden( elem ) ) {
- values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
- }
- } else {
- display = curCSS( elem, "display" );
-
- if ( !values[ index ] && display !== "none" ) {
- jQuery._data( elem, "olddisplay", display );
- }
- }
- }
-
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( index = 0; index < length; index++ ) {
- elem = elements[ index ];
- if ( !elem.style ) {
- continue;
- }
- if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
- elem.style.display = show ? values[ index ] || "" : "none";
- }
- }
-
- return elements;
-}
-
-jQuery.fn.extend({
- css: function( name, value ) {
- return jQuery.access( this, function( elem, name, value ) {
- return value !== undefined ?
- jQuery.style( elem, name, value ) :
- jQuery.css( elem, name );
- }, name, value, arguments.length > 1 );
- },
- show: function() {
- return showHide( this, true );
- },
- hide: function() {
- return showHide( this );
- },
- toggle: function( state, fn2 ) {
- var bool = typeof state === "boolean";
-
- if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
- return eventsToggle.apply( this, arguments );
- }
-
- return this.each(function() {
- if ( bool ? state : isHidden( this ) ) {
- jQuery( this ).show();
- } else {
- jQuery( this ).hide();
- }
- });
- }
-});
-
-jQuery.extend({
- // Add in style property hooks for overriding the default
- // behavior of getting and setting a style property
- cssHooks: {
- opacity: {
- get: function( elem, computed ) {
- if ( computed ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity" );
- return ret === "" ? "1" : ret;
-
- }
- }
- }
- },
-
- // Exclude the following css properties to add px
- cssNumber: {
- "fillOpacity": true,
- "fontWeight": true,
- "lineHeight": true,
- "opacity": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
- },
-
- // Add in properties whose names you wish to fix before
- // setting or getting the value
- cssProps: {
- // normalize float css property
- "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
- },
-
- // Get and set the style property on a DOM Node
- style: function( elem, name, value, extra ) {
- // Don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
- return;
- }
-
- // Make sure that we're working with the right name
- var ret, type, hooks,
- origName = jQuery.camelCase( name ),
- style = elem.style;
-
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
-
- // gets hook for the prefixed version
- // followed by the unprefixed version
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
-
- // Check if we're setting a value
- if ( value !== undefined ) {
- type = typeof value;
-
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
- value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
- // Fixes bug #9237
- type = "number";
- }
-
- // Make sure that NaN and null values aren't set. See: #7116
- if ( value == null || type === "number" && isNaN( value ) ) {
- return;
- }
-
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
- value += "px";
- }
-
- // If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
- // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
- // Fixes bug #5509
- try {
- style[ name ] = value;
- } catch(e) {}
- }
-
- } else {
- // If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
- return ret;
- }
-
- // Otherwise just get the value from the style object
- return style[ name ];
- }
- },
-
- css: function( elem, name, numeric, extra ) {
- var val, num, hooks,
- origName = jQuery.camelCase( name );
-
- // Make sure that we're working with the right name
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
-
- // gets hook for the prefixed version
- // followed by the unprefixed version
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
-
- // If a hook was provided get the computed value from there
- if ( hooks && "get" in hooks ) {
- val = hooks.get( elem, true, extra );
- }
-
- // Otherwise, if a way to get the computed value exists, use that
- if ( val === undefined ) {
- val = curCSS( elem, name );
- }
-
- //convert "normal" to computed value
- if ( val === "normal" && name in cssNormalTransform ) {
- val = cssNormalTransform[ name ];
- }
-
- // Return, converting to number if forced or a qualifier was provided and val looks numeric
- if ( numeric || extra !== undefined ) {
- num = parseFloat( val );
- return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
- }
- return val;
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var ret, name,
- old = {};
-
- // Remember the old values, and insert the new ones
- for ( name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- ret = callback.call( elem );
-
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
-
- return ret;
- }
-});
-
-// NOTE: To any future maintainer, we've window.getComputedStyle
-// because jsdom on node.js will break without it.
-if ( window.getComputedStyle ) {
- curCSS = function( elem, name ) {
- var ret, width, minWidth, maxWidth,
- computed = window.getComputedStyle( elem, null ),
- style = elem.style;
-
- if ( computed ) {
-
- // getPropertyValue is only needed for .css('filter') in IE9, see #12537
- ret = computed.getPropertyValue( name ) || computed[ name ];
-
- if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
- ret = jQuery.style( elem, name );
- }
-
- // A tribute to the "awesome hack by Dean Edwards"
- // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
- // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
- // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
- if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
- width = style.width;
- minWidth = style.minWidth;
- maxWidth = style.maxWidth;
-
- style.minWidth = style.maxWidth = style.width = ret;
- ret = computed.width;
-
- style.width = width;
- style.minWidth = minWidth;
- style.maxWidth = maxWidth;
- }
- }
-
- return ret;
- };
-} else if ( document.documentElement.currentStyle ) {
- curCSS = function( elem, name ) {
- var left, rsLeft,
- ret = elem.currentStyle && elem.currentStyle[ name ],
- style = elem.style;
-
- // Avoid setting ret to empty string here
- // so we don't default to auto
- if ( ret == null && style && style[ name ] ) {
- ret = style[ name ];
- }
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- // but not position css attributes, as those are proportional to the parent element instead
- // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
- if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
-
- // Remember the original values
- left = style.left;
- rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
-
- // Put in the new values to get a computed value out
- if ( rsLeft ) {
- elem.runtimeStyle.left = elem.currentStyle.left;
- }
- style.left = name === "fontSize" ? "1em" : ret;
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- if ( rsLeft ) {
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret === "" ? "auto" : ret;
- };
-}
-
-function setPositiveNumber( elem, value, subtract ) {
- var matches = rnumsplit.exec( value );
- return matches ?
- Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
- value;
-}
-
-function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
- var i = extra === ( isBorderBox ? "border" : "content" ) ?
- // If we already have the right measurement, avoid augmentation
- 4 :
- // Otherwise initialize for horizontal or vertical properties
- name === "width" ? 1 : 0,
-
- val = 0;
-
- for ( ; i < 4; i += 2 ) {
- // both box models exclude margin, so add it if we want it
- if ( extra === "margin" ) {
- // we use jQuery.css instead of curCSS here
- // because of the reliableMarginRight CSS hook!
- val += jQuery.css( elem, extra + cssExpand[ i ], true );
- }
-
- // From this point on we use curCSS for maximum performance (relevant in animations)
- if ( isBorderBox ) {
- // border-box includes padding, so remove it if we want content
- if ( extra === "content" ) {
- val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
- }
-
- // at this point, extra isn't border nor margin, so remove border
- if ( extra !== "margin" ) {
- val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
- }
- } else {
- // at this point, extra isn't content, so add padding
- val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
-
- // at this point, extra isn't content nor padding, so add border
- if ( extra !== "padding" ) {
- val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
- }
- }
- }
-
- return val;
-}
-
-function getWidthOrHeight( elem, name, extra ) {
-
- // Start with offset property, which is equivalent to the border-box value
- var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
- valueIsBorderBox = true,
- isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
-
- // some non-html elements return undefined for offsetWidth, so check for null/undefined
- // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
- // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
- if ( val <= 0 || val == null ) {
- // Fall back to computed then uncomputed css if necessary
- val = curCSS( elem, name );
- if ( val < 0 || val == null ) {
- val = elem.style[ name ];
- }
-
- // Computed unit is not pixels. Stop here and return.
- if ( rnumnonpx.test(val) ) {
- return val;
- }
-
- // we need the check for style in case a browser which returns unreliable values
- // for getComputedStyle silently falls back to the reliable elem.style
- valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
-
- // Normalize "", auto, and prepare for extra
- val = parseFloat( val ) || 0;
- }
-
- // use the active box-sizing model to add/subtract irrelevant styles
- return ( val +
- augmentWidthOrHeight(
- elem,
- name,
- extra || ( isBorderBox ? "border" : "content" ),
- valueIsBorderBox
- )
- ) + "px";
-}
-
-
-// Try to determine the default display value of an element
-function css_defaultDisplay( nodeName ) {
- if ( elemdisplay[ nodeName ] ) {
- return elemdisplay[ nodeName ];
- }
-
- var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
- display = elem.css("display");
- elem.remove();
-
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // Use the already-created iframe if possible
- iframe = document.body.appendChild(
- iframe || jQuery.extend( document.createElement("iframe"), {
- frameBorder: 0,
- width: 0,
- height: 0
- })
- );
-
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write("<!doctype html><html><body>");
- iframeDoc.close();
- }
-
- elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
-
- display = curCSS( elem, "display" );
- document.body.removeChild( iframe );
- }
-
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
-
- return display;
-}
-
-jQuery.each([ "height", "width" ], function( i, name ) {
- jQuery.cssHooks[ name ] = {
- get: function( elem, computed, extra ) {
- if ( computed ) {
- // certain elements can have dimension info if we invisibly show them
- // however, it must have a current display style that would benefit from this
- if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) {
- return jQuery.swap( elem, cssShow, function() {
- return getWidthOrHeight( elem, name, extra );
- });
- } else {
- return getWidthOrHeight( elem, name, extra );
- }
- }
- },
-
- set: function( elem, value, extra ) {
- return setPositiveNumber( elem, value, extra ?
- augmentWidthOrHeight(
- elem,
- name,
- extra,
- jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
- ) : 0
- );
- }
- };
-});
-
-if ( !jQuery.support.opacity ) {
- jQuery.cssHooks.opacity = {
- get: function( elem, computed ) {
- // IE uses filters for opacity
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
- ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
- computed ? "1" : "";
- },
-
- set: function( elem, value ) {
- var style = elem.style,
- currentStyle = elem.currentStyle,
- opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
- filter = currentStyle && currentStyle.filter || style.filter || "";
-
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- style.zoom = 1;
-
- // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
- if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
- style.removeAttribute ) {
-
- // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
- // if "filter:" is present at all, clearType is disabled, we want to avoid this
- // style.removeAttribute is IE Only, but so apparently is this code path...
- style.removeAttribute( "filter" );
-
- // if there there is no filter style applied in a css rule, we are done
- if ( currentStyle && !currentStyle.filter ) {
- return;
- }
- }
-
- // otherwise, set new filter values
- style.filter = ralpha.test( filter ) ?
- filter.replace( ralpha, opacity ) :
- filter + " " + opacity;
- }
- };
-}
-
-// These hooks cannot be added until DOM ready because the support test
-// for it is not run until after DOM ready
-jQuery(function() {
- if ( !jQuery.support.reliableMarginRight ) {
- jQuery.cssHooks.marginRight = {
- get: function( elem, computed ) {
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- // Work around by temporarily setting element display to inline-block
- return jQuery.swap( elem, { "display": "inline-block" }, function() {
- if ( computed ) {
- return curCSS( elem, "marginRight" );
- }
- });
- }
- };
- }
-
- // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
- // getComputedStyle returns percent when specified for top/left/bottom/right
- // rather than make the css module depend on the offset module, we just check for it here
- if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
- jQuery.each( [ "top", "left" ], function( i, prop ) {
- jQuery.cssHooks[ prop ] = {
- get: function( elem, computed ) {
- if ( computed ) {
- var ret = curCSS( elem, prop );
- // if curCSS returns percentage, fallback to offset
- return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
- }
- }
- };
- });
- }
-
-});
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.hidden = function( elem ) {
- return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
- };
-
- jQuery.expr.filters.visible = function( elem ) {
- return !jQuery.expr.filters.hidden( elem );
- };
-}
-
-// These hooks are used by animate to expand properties
-jQuery.each({
- margin: "",
- padding: "",
- border: "Width"
-}, function( prefix, suffix ) {
- jQuery.cssHooks[ prefix + suffix ] = {
- expand: function( value ) {
- var i,
-
- // assumes a single number if not a string
- parts = typeof value === "string" ? value.split(" ") : [ value ],
- expanded = {};
-
- for ( i = 0; i < 4; i++ ) {
- expanded[ prefix + cssExpand[ i ] + suffix ] =
- parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
- }
-
- return expanded;
- }
- };
-
- if ( !rmargin.test( prefix ) ) {
- jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
- }
-});
-var r20 = /%20/g,
- rbracket = /\[\]$/,
- rCRLF = /\r?\n/g,
- rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
- rselectTextarea = /^(?:select|textarea)/i;
-
-jQuery.fn.extend({
- serialize: function() {
- return jQuery.param( this.serializeArray() );
- },
- serializeArray: function() {
- return this.map(function(){
- return this.elements ? jQuery.makeArray( this.elements ) : this;
- })
- .filter(function(){
- return this.name && !this.disabled &&
- ( this.checked || rselectTextarea.test( this.nodeName ) ||
- rinput.test( this.type ) );
- })
- .map(function( i, elem ){
- var val = jQuery( this ).val();
-
- return val == null ?
- null :
- jQuery.isArray( val ) ?
- jQuery.map( val, function( val, i ){
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }) :
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }).get();
- }
-});
-
-//Serialize an array of form elements or a set of
-//key/values into a query string
-jQuery.param = function( a, traditional ) {
- var prefix,
- s = [],
- add = function( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
- };
-
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
- }
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- });
-
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( prefix in a ) {
- buildParams( prefix, a[ prefix ], traditional, add );
- }
- }
-
- // Return the resulting serialization
- return s.join( "&" ).replace( r20, "+" );
-};
-
-function buildParams( prefix, obj, traditional, add ) {
- var name;
-
- if ( jQuery.isArray( obj ) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || rbracket.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
-
- } else {
- // If array item is non-scalar (array or object), encode its
- // numeric index to resolve deserialization ambiguity issues.
- // Note that rack (as of 1.0.0) can't currently deserialize
- // nested arrays properly, and attempting to do so may cause
- // a server error. Possible fixes are to modify rack's
- // deserialization algorithm or to provide an option or flag
- // to force array serialization to be shallow.
- buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
- }
- });
-
- } else if ( !traditional && jQuery.type( obj ) === "object" ) {
- // Serialize object item.
- for ( name in obj ) {
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
- }
-
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
-}
-var
- // Document location
- ajaxLocParts,
- ajaxLocation,
-
- rhash = /#.*$/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
- rquery = /\?/,
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
- rts = /([?&])_=[^&]*/,
- rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
-
- // Keep a copy of the old load method
- _load = jQuery.fn.load,
-
- /* Prefilters
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
- * 2) These are called:
- * - BEFORE asking for a transport
- * - AFTER param serialization (s.data is a string if s.processData is true)
- * 3) key is the dataType
- * 4) the catchall symbol "*" can be used
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
- */
- prefilters = {},
-
- /* Transports bindings
- * 1) key is the dataType
- * 2) the catchall symbol "*" can be used
- * 3) selection will start with transport dataType and THEN go to "*" if needed
- */
- transports = {},
-
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
- allTypes = ["*/"] + ["*"];
-
-// #8138, IE may throw an exception when accessing
-// a field from window.location if document.domain has been set
-try {
- ajaxLocation = location.href;
-} catch( e ) {
- // Use the href attribute of an A element
- // since IE will modify it given document.location
- ajaxLocation = document.createElement( "a" );
- ajaxLocation.href = "";
- ajaxLocation = ajaxLocation.href;
-}
-
-// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
-
-// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
-function addToPrefiltersOrTransports( structure ) {
-
- // dataTypeExpression is optional and defaults to "*"
- return function( dataTypeExpression, func ) {
-
- if ( typeof dataTypeExpression !== "string" ) {
- func = dataTypeExpression;
- dataTypeExpression = "*";
- }
-
- var dataType, list, placeBefore,
- dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
- i = 0,
- length = dataTypes.length;
-
- if ( jQuery.isFunction( func ) ) {
- // For each dataType in the dataTypeExpression
- for ( ; i < length; i++ ) {
- dataType = dataTypes[ i ];
- // We control if we're asked to add before
- // any existing element
- placeBefore = /^\+/.test( dataType );
- if ( placeBefore ) {
- dataType = dataType.substr( 1 ) || "*";
- }
- list = structure[ dataType ] = structure[ dataType ] || [];
- // then we add to the structure accordingly
- list[ placeBefore ? "unshift" : "push" ]( func );
- }
- }
- };
-}
-
-// Base inspection function for prefilters and transports
-function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
- dataType /* internal */, inspected /* internal */ ) {
-
- dataType = dataType || options.dataTypes[ 0 ];
- inspected = inspected || {};
-
- inspected[ dataType ] = true;
-
- var selection,
- list = structure[ dataType ],
- i = 0,
- length = list ? list.length : 0,
- executeOnly = ( structure === prefilters );
-
- for ( ; i < length && ( executeOnly || !selection ); i++ ) {
- selection = list[ i ]( options, originalOptions, jqXHR );
- // If we got redirected to another dataType
- // we try there if executing only and not done already
- if ( typeof selection === "string" ) {
- if ( !executeOnly || inspected[ selection ] ) {
- selection = undefined;
- } else {
- options.dataTypes.unshift( selection );
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, selection, inspected );
- }
- }
- }
- // If we're only executing or nothing was selected
- // we try the catchall dataType if not done already
- if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, "*", inspected );
- }
- // unnecessary when only executing (prefilters)
- // but it'll be ignored by the caller in that case
- return selection;
-}
-
-// A special extend for ajax options
-// that takes "flat" options (not to be deep extended)
-// Fixes #9887
-function ajaxExtend( target, src ) {
- var key, deep,
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
- for ( key in src ) {
- if ( src[ key ] !== undefined ) {
- ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
- }
- }
- if ( deep ) {
- jQuery.extend( true, target, deep );
- }
-}
-
-jQuery.fn.load = function( url, params, callback ) {
- if ( typeof url !== "string" && _load ) {
- return _load.apply( this, arguments );
- }
-
- // Don't do a request if no elements are being requested
- if ( !this.length ) {
- return this;
- }
-
- var selector, type, response,
- self = this,
- off = url.indexOf(" ");
-
- if ( off >= 0 ) {
- selector = url.slice( off, url.length );
- url = url.slice( 0, off );
- }
-
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
-
- // We assume that it's the callback
- callback = params;
- params = undefined;
-
- // Otherwise, build a param string
- } else if ( params && typeof params === "object" ) {
- type = "POST";
- }
-
- // Request the remote document
- jQuery.ajax({
- url: url,
-
- // if "type" variable is undefined, then "GET" method will be used
- type: type,
- dataType: "html",
- data: params,
- complete: function( jqXHR, status ) {
- if ( callback ) {
- self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
- }
- }
- }).done(function( responseText ) {
-
- // Save response for use in complete callback
- response = arguments;
-
- // See if a selector was specified
- self.html( selector ?
-
- // Create a dummy div to hold the results
- jQuery("<div>")
-
- // inject the contents of the document in, removing the scripts
- // to avoid any 'Permission Denied' errors in IE
- .append( responseText.replace( rscript, "" ) )
-
- // Locate the specified elements
- .find( selector ) :
-
- // If not, just inject the full result
- responseText );
-
- });
-
- return this;
-};
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
- jQuery.fn[ o ] = function( f ){
- return this.on( o, f );
- };
-});
-
-jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
-
- return jQuery.ajax({
- type: method,
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- };
-});
-
-jQuery.extend({
-
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- },
-
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function( target, settings ) {
- if ( settings ) {
- // Building a settings object
- ajaxExtend( target, jQuery.ajaxSettings );
- } else {
- // Extending ajaxSettings
- settings = target;
- target = jQuery.ajaxSettings;
- }
- ajaxExtend( target, settings );
- return target;
- },
-
- ajaxSettings: {
- url: ajaxLocation,
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
- global: true,
- type: "GET",
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- processData: true,
- async: true,
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- throws: false,
- traditional: false,
- headers: {},
- */
-
- accepts: {
- xml: "application/xml, text/xml",
- html: "text/html",
- text: "text/plain",
- json: "application/json, text/javascript",
- "*": allTypes
- },
-
- contents: {
- xml: /xml/,
- html: /html/,
- json: /json/
- },
-
- responseFields: {
- xml: "responseXML",
- text: "responseText"
- },
-
- // List of data converters
- // 1) key format is "source_type destination_type" (a single space in-between)
- // 2) the catchall symbol "*" can be used for source_type
- converters: {
-
- // Convert anything to text
- "* text": window.String,
-
- // Text to html (true = no transformation)
- "text html": true,
-
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
-
- // Parse text as xml
- "text xml": jQuery.parseXML
- },
-
- // For options that shouldn't be deep extended:
- // you can add your own custom options here if
- // and when you create one that shouldn't be
- // deep extended (see ajaxExtend)
- flatOptions: {
- context: true,
- url: true
- }
- },
-
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
-
- // Main method
- ajax: function( url, options ) {
-
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
-
- // Force options to be an object
- options = options || {};
-
- var // ifModified key
- ifModifiedKey,
- // Response headers
- responseHeadersString,
- responseHeaders,
- // transport
- transport,
- // timeout handle
- timeoutTimer,
- // Cross-domain detection vars
- parts,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events
- // It's the callbackContext if one was provided in the options
- // and if it's a DOM node or a jQuery collection
- globalEventContext = callbackContext !== s &&
- ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
- jQuery( callbackContext ) : jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks( "once memory" ),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // The jqXHR state
- state = 0,
- // Default abort message
- strAbort = "canceled",
- // Fake xhr
- jqXHR = {
-
- readyState: 0,
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- if ( !state ) {
- var lname = name.toLowerCase();
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match === undefined ? null : match;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Cancel the request
- abort: function( statusText ) {
- statusText = statusText || strAbort;
- if ( transport ) {
- transport.abort( statusText );
- }
- done( 0, statusText );
- return this;
- }
- };
-
- // Callback for when everything is done
- // It is defined here because jslint complains if it is declared
- // at the end of the function (which would be more logical and readable)
- function done( status, nativeStatusText, responses, headers ) {
- var isSuccess, success, error, response, modified,
- statusText = nativeStatusText;
-
- // Called once
- if ( state === 2 ) {
- return;
- }
-
- // State is "done" now
- state = 2;
-
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- clearTimeout( timeoutTimer );
- }
-
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
-
- // Cache response headers
- responseHeadersString = headers || "";
-
- // Set readyState
- jqXHR.readyState = status > 0 ? 4 : 0;
-
- // Get response data
- if ( responses ) {
- response = ajaxHandleResponses( s, jqXHR, responses );
- }
-
- // If successful, handle type chaining
- if ( status >= 200 && status < 300 || status === 304 ) {
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
-
- modified = jqXHR.getResponseHeader("Last-Modified");
- if ( modified ) {
- jQuery.lastModified[ ifModifiedKey ] = modified;
- }
- modified = jqXHR.getResponseHeader("Etag");
- if ( modified ) {
- jQuery.etag[ ifModifiedKey ] = modified;
- }
- }
-
- // If not modified
- if ( status === 304 ) {
-
- statusText = "notmodified";
- isSuccess = true;
-
- // If we have data
- } else {
-
- isSuccess = ajaxConvert( s, response );
- statusText = isSuccess.state;
- success = isSuccess.data;
- error = isSuccess.error;
- isSuccess = !error;
- }
- } else {
- // We extract error from statusText
- // then normalize statusText and status for non-aborts
- error = statusText;
- if ( !statusText || status ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
-
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = ( nativeStatusText || statusText ) + "";
-
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
-
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
- [ jqXHR, s, isSuccess ? success : error ] );
- }
-
- // Complete
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
- }
-
- // Attach deferreds
- deferred.promise( jqXHR );
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
- jqXHR.complete = completeDeferred.add;
-
- // Status-dependent callbacks
- jqXHR.statusCode = function( map ) {
- if ( map ) {
- var tmp;
- if ( state < 2 ) {
- for ( tmp in map ) {
- statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
- }
- } else {
- tmp = map[ jqXHR.status ];
- jqXHR.always( tmp );
- }
- }
- return this;
- };
-
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
- // We also use the url parameter if available
- s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
-
- // A cross-domain request is in order when we have a protocol:host:port mismatch
- if ( s.crossDomain == null ) {
- parts = rurl.exec( s.url.toLowerCase() );
- s.crossDomain = !!( parts &&
- ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
- );
- }
-
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
-
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
- // If request was aborted inside a prefilter, stop there
- if ( state === 2 ) {
- return jqXHR;
- }
-
- // We can fire global events as of now if asked to
- fireGlobals = s.global;
-
- // Uppercase the type
- s.type = s.type.toUpperCase();
-
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
-
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger( "ajaxStart" );
- }
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // If data is available, append data to url
- if ( s.data ) {
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
-
- // Get ifModifiedKey before adding the anti-cache parameter
- ifModifiedKey = s.url;
-
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
-
- var ts = jQuery.now(),
- // try replacing _= if it is there
- ret = s.url.replace( rts, "$1_=" + ts );
-
- // if nothing was replaced, add timestamp to the end
- s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
- }
- }
-
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- ifModifiedKey = ifModifiedKey || s.url;
- if ( jQuery.lastModified[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
- }
- if ( jQuery.etag[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
- }
- }
-
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
-
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
-
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already and return
- return jqXHR.abort();
-
- }
-
- // aborting is no longer a cancellation
- strAbort = "abort";
-
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
-
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
-
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout( function(){
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
-
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch (e) {
- // Propagate exception as error if not done
- if ( state < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- throw e;
- }
- }
- }
-
- return jqXHR;
- },
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {}
-
-});
-
-/* Handles responses to an ajax request:
- * - sets all responseXXX fields accordingly
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
-function ajaxHandleResponses( s, jqXHR, responses ) {
-
- var ct, type, finalDataType, firstDataType,
- contents = s.contents,
- dataTypes = s.dataTypes,
- responseFields = s.responseFields;
-
- // Fill responseXXX fields
- for ( type in responseFields ) {
- if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
- }
- }
-
- // Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
- }
- }
-
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
-
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
-
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
-}
-
-// Chain conversions given the request and the original response
-function ajaxConvert( s, response ) {
-
- var conv, conv2, current, tmp,
- // Work with a copy of dataTypes in case we need to modify it for conversion
- dataTypes = s.dataTypes.slice(),
- prev = dataTypes[ 0 ],
- converters = {},
- i = 0;
-
- // Apply the dataFilter if provided
- if ( s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
-
- // Create converters map with lowercased keys
- if ( dataTypes[ 1 ] ) {
- for ( conv in s.converters ) {
- converters[ conv.toLowerCase() ] = s.converters[ conv ];
- }
- }
-
- // Convert to each sequential dataType, tolerating list modification
- for ( ; (current = dataTypes[++i]); ) {
-
- // There's only work to do if current dataType is non-auto
- if ( current !== "*" ) {
-
- // Convert response if prev dataType is non-auto and differs from current
- if ( prev !== "*" && prev !== current ) {
-
- // Seek a direct converter
- conv = converters[ prev + " " + current ] || converters[ "* " + current ];
-
- // If none found, seek a pair
- if ( !conv ) {
- for ( conv2 in converters ) {
-
- // If conv2 outputs current
- tmp = conv2.split(" ");
- if ( tmp[ 1 ] === current ) {
-
- // If prev can be converted to accepted input
- conv = converters[ prev + " " + tmp[ 0 ] ] ||
- converters[ "* " + tmp[ 0 ] ];
- if ( conv ) {
- // Condense equivalence converters
- if ( conv === true ) {
- conv = converters[ conv2 ];
-
- // Otherwise, insert the intermediate dataType
- } else if ( converters[ conv2 ] !== true ) {
- current = tmp[ 0 ];
- dataTypes.splice( i--, 0, current );
- }
-
- break;
- }
- }
- }
- }
-
- // Apply converter (if not an equivalence)
- if ( conv !== true ) {
-
- // Unless errors are allowed to bubble, catch and return them
- if ( conv && s["throws"] ) {
- response = conv( response );
- } else {
- try {
- response = conv( response );
- } catch ( e ) {
- return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
- }
- }
- }
- }
-
- // Update prev for next iteration
- prev = current;
- }
- }
-
- return { state: "success", data: response };
-}
-var oldCallbacks = [],
- rquestion = /\?/,
- rjsonp = /(=)\?(?=&|$)|\?\?/,
- nonce = jQuery.now();
-
-// Default jsonp settings
-jQuery.ajaxSetup({
- jsonp: "callback",
- jsonpCallback: function() {
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
- this[ callback ] = true;
- return callback;
- }
-});
-
-// Detect, normalize options and install callbacks for jsonp requests
-jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-
- var callbackName, overwritten, responseContainer,
- data = s.data,
- url = s.url,
- hasCallback = s.jsonp !== false,
- replaceInUrl = hasCallback && rjsonp.test( url ),
- replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
- !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
- rjsonp.test( data );
-
- // Handle iff the expected data type is "jsonp" or we have a parameter to set
- if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
-
- // Get callback name, remembering preexisting value associated with it
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
- s.jsonpCallback() :
- s.jsonpCallback;
- overwritten = window[ callbackName ];
-
- // Insert callback into url or form data
- if ( replaceInUrl ) {
- s.url = url.replace( rjsonp, "$1" + callbackName );
- } else if ( replaceInData ) {
- s.data = data.replace( rjsonp, "$1" + callbackName );
- } else if ( hasCallback ) {
- s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
- }
-
- // Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
- if ( !responseContainer ) {
- jQuery.error( callbackName + " was not called" );
- }
- return responseContainer[ 0 ];
- };
-
- // force json dataType
- s.dataTypes[ 0 ] = "json";
-
- // Install callback
- window[ callbackName ] = function() {
- responseContainer = arguments;
- };
-
- // Clean-up function (fires after converters)
- jqXHR.always(function() {
- // Restore preexisting value
- window[ callbackName ] = overwritten;
-
- // Save back as free
- if ( s[ callbackName ] ) {
- // make sure that re-using the options doesn't screw things around
- s.jsonpCallback = originalSettings.jsonpCallback;
-
- // save the callback name for future use
- oldCallbacks.push( callbackName );
- }
-
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
- overwritten( responseContainer[ 0 ] );
- }
-
- responseContainer = overwritten = undefined;
- });
-
- // Delegate to script
- return "script";
- }
-});
-// Install script dataType
-jQuery.ajaxSetup({
- accepts: {
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /javascript|ecmascript/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
-});
-
-// Handle cache's special case and global
-jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- s.global = false;
- }
-});
-
-// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
-
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
-
- var script,
- head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
-
- return {
-
- send: function( _, callback ) {
-
- script = document.createElement( "script" );
-
- script.async = "async";
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( head && script.parentNode ) {
- head.removeChild( script );
- }
-
- // Dereference the script
- script = undefined;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
- }
- }
- };
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709 and #4378).
- head.insertBefore( script, head.firstChild );
- },
-
- abort: function() {
- if ( script ) {
- script.onload( 0, 1 );
- }
- }
- };
- }
-});
-var xhrCallbacks,
- // #5280: Internet Explorer will keep connections alive if we don't abort on unload
- xhrOnUnloadAbort = window.ActiveXObject ? function() {
- // Abort all pending requests
- for ( var key in xhrCallbacks ) {
- xhrCallbacks[ key ]( 0, 1 );
- }
- } : false,
- xhrId = 0;
-
-// Functions to create xhrs
-function createStandardXHR() {
- try {
- return new window.XMLHttpRequest();
- } catch( e ) {}
-}
-
-function createActiveXHR() {
- try {
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
- } catch( e ) {}
-}
-
-// Create the request object
-// (This is still attached to ajaxSettings for backward compatibility)
-jQuery.ajaxSettings.xhr = window.ActiveXObject ?
- /* Microsoft failed to properly
- * implement the XMLHttpRequest in IE7 (can't request local files),
- * so we use the ActiveXObject when it is available
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
- * we need a fallback.
- */
- function() {
- return !this.isLocal && createStandardXHR() || createActiveXHR();
- } :
- // For all other browsers, use the standard XMLHttpRequest object
- createStandardXHR;
-
-// Determine support properties
-(function( xhr ) {
- jQuery.extend( jQuery.support, {
- ajax: !!xhr,
- cors: !!xhr && ( "withCredentials" in xhr )
- });
-})( jQuery.ajaxSettings.xhr() );
-
-// Create transport if the browser can provide an xhr
-if ( jQuery.support.ajax ) {
-
- jQuery.ajaxTransport(function( s ) {
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( !s.crossDomain || jQuery.support.cors ) {
-
- var callback;
-
- return {
- send: function( headers, complete ) {
-
- // Get a new xhr
- var handle, i,
- xhr = s.xhr();
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if ( s.username ) {
- xhr.open( s.type, s.url, s.async, s.username, s.password );
- } else {
- xhr.open( s.type, s.url, s.async );
- }
-
- // Apply custom fields if provided
- if ( s.xhrFields ) {
- for ( i in s.xhrFields ) {
- xhr[ i ] = s.xhrFields[ i ];
- }
- }
-
- // Override mime type if needed
- if ( s.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( s.mimeType );
- }
-
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
- }
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- } catch( _ ) {}
-
- // Do send the request
- // This may raise an exception which is actually
- // handled in jQuery.ajax (so no try/catch here)
- xhr.send( ( s.hasContent && s.data ) || null );
-
- // Listener
- callback = function( _, isAbort ) {
-
- var status,
- statusText,
- responseHeaders,
- responses,
- xml;
-
- // Firefox throws exceptions when accessing properties
- // of an xhr when a network error occurred
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
- try {
-
- // Was never called and is aborted or complete
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
-
- // Only called once
- callback = undefined;
-
- // Do not keep as active anymore
- if ( handle ) {
- xhr.onreadystatechange = jQuery.noop;
- if ( xhrOnUnloadAbort ) {
- delete xhrCallbacks[ handle ];
- }
- }
-
- // If it's an abort
- if ( isAbort ) {
- // Abort it manually if needed
- if ( xhr.readyState !== 4 ) {
- xhr.abort();
- }
- } else {
- status = xhr.status;
- responseHeaders = xhr.getAllResponseHeaders();
- responses = {};
- xml = xhr.responseXML;
-
- // Construct response list
- if ( xml && xml.documentElement /* #4958 */ ) {
- responses.xml = xml;
- }
-
- // When requesting binary data, IE6-9 will throw an exception
- // on any attempt to access responseText (#11426)
- try {
- responses.text = xhr.responseText;
- } catch( e ) {
- }
-
- // Firefox throws an exception when accessing
- // statusText for faulty cross-domain requests
- try {
- statusText = xhr.statusText;
- } catch( e ) {
- // We normalize with Webkit giving an empty statusText
- statusText = "";
- }
-
- // Filter status for non standard behaviors
-
- // If the request is local and we have data: assume a success
- // (success with no data won't get notified, that's the best we
- // can do given current implementations)
- if ( !status && s.isLocal && !s.crossDomain ) {
- status = responses.text ? 200 : 404;
- // IE - #1450: sometimes returns 1223 when it should be 204
- } else if ( status === 1223 ) {
- status = 204;
- }
- }
- }
- } catch( firefoxAccessException ) {
- if ( !isAbort ) {
- complete( -1, firefoxAccessException );
- }
- }
-
- // Call complete if needed
- if ( responses ) {
- complete( status, statusText, responses, responseHeaders );
- }
- };
-
- if ( !s.async ) {
- // if we're in sync mode we fire the callback
- callback();
- } else if ( xhr.readyState === 4 ) {
- // (IE6 & IE7) if it's in cache and has been
- // retrieved directly we need to fire the callback
- setTimeout( callback, 0 );
- } else {
- handle = ++xhrId;
- if ( xhrOnUnloadAbort ) {
- // Create the active xhrs callbacks list if needed
- // and attach the unload handler
- if ( !xhrCallbacks ) {
- xhrCallbacks = {};
- jQuery( window ).unload( xhrOnUnloadAbort );
- }
- // Add to list of active xhrs callbacks
- xhrCallbacks[ handle ] = callback;
- }
- xhr.onreadystatechange = callback;
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback(0,1);
- }
- }
- };
- }
- });
-}
-var fxNow, timerId,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
- rrun = /queueHooks$/,
- animationPrefilters = [ defaultPrefilter ],
- tweeners = {
- "*": [function( prop, value ) {
- var end, unit,
- tween = this.createTween( prop, value ),
- parts = rfxnum.exec( value ),
- target = tween.cur(),
- start = +target || 0,
- scale = 1,
- maxIterations = 20;
-
- if ( parts ) {
- end = +parts[2];
- unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
-
- // We need to compute starting value
- if ( unit !== "px" && start ) {
- // Iteratively approximate from a nonzero starting point
- // Prefer the current property, because this process will be trivial if it uses the same units
- // Fallback to end or a simple constant
- start = jQuery.css( tween.elem, prop, true ) || end || 1;
-
- do {
- // If previous iteration zeroed out, double until we get *something*
- // Use a string for doubling factor so we don't accidentally see scale as unchanged below
- scale = scale || ".5";
-
- // Adjust and apply
- start = start / scale;
- jQuery.style( tween.elem, prop, start + unit );
-
- // Update scale, tolerating zero or NaN from tween.cur()
- // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
- } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
- }
-
- tween.unit = unit;
- tween.start = start;
- // If a +=/-= token was provided, we're doing a relative animation
- tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
- }
- return tween;
- }]
- };
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
- setTimeout(function() {
- fxNow = undefined;
- }, 0 );
- return ( fxNow = jQuery.now() );
-}
-
-function createTweens( animation, props ) {
- jQuery.each( props, function( prop, value ) {
- var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
- index = 0,
- length = collection.length;
- for ( ; index < length; index++ ) {
- if ( collection[ index ].call( animation, prop, value ) ) {
-
- // we're done with this property
- return;
- }
- }
- });
-}
-
-function Animation( elem, properties, options ) {
- var result,
- index = 0,
- tweenerIndex = 0,
- length = animationPrefilters.length,
- deferred = jQuery.Deferred().always( function() {
- // don't match elem in the :animated selector
- delete tick.elem;
- }),
- tick = function() {
- var currentTime = fxNow || createFxNow(),
- remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
- // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
- temp = remaining / animation.duration || 0,
- percent = 1 - temp,
- index = 0,
- length = animation.tweens.length;
-
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( percent );
- }
-
- deferred.notifyWith( elem, [ animation, percent, remaining ]);
-
- if ( percent < 1 && length ) {
- return remaining;
- } else {
- deferred.resolveWith( elem, [ animation ] );
- return false;
- }
- },
- animation = deferred.promise({
- elem: elem,
- props: jQuery.extend( {}, properties ),
- opts: jQuery.extend( true, { specialEasing: {} }, options ),
- originalProperties: properties,
- originalOptions: options,
- startTime: fxNow || createFxNow(),
- duration: options.duration,
- tweens: [],
- createTween: function( prop, end, easing ) {
- var tween = jQuery.Tween( elem, animation.opts, prop, end,
- animation.opts.specialEasing[ prop ] || animation.opts.easing );
- animation.tweens.push( tween );
- return tween;
- },
- stop: function( gotoEnd ) {
- var index = 0,
- // if we are going to the end, we want to run all the tweens
- // otherwise we skip this part
- length = gotoEnd ? animation.tweens.length : 0;
-
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( 1 );
- }
-
- // resolve when we played the last frame
- // otherwise, reject
- if ( gotoEnd ) {
- deferred.resolveWith( elem, [ animation, gotoEnd ] );
- } else {
- deferred.rejectWith( elem, [ animation, gotoEnd ] );
- }
- return this;
- }
- }),
- props = animation.props;
-
- propFilter( props, animation.opts.specialEasing );
-
- for ( ; index < length ; index++ ) {
- result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
- if ( result ) {
- return result;
- }
- }
-
- createTweens( animation, props );
-
- if ( jQuery.isFunction( animation.opts.start ) ) {
- animation.opts.start.call( elem, animation );
- }
-
- jQuery.fx.timer(
- jQuery.extend( tick, {
- anim: animation,
- queue: animation.opts.queue,
- elem: elem
- })
- );
-
- // attach callbacks from options
- return animation.progress( animation.opts.progress )
- .done( animation.opts.done, animation.opts.complete )
- .fail( animation.opts.fail )
- .always( animation.opts.always );
-}
-
-function propFilter( props, specialEasing ) {
- var index, name, easing, value, hooks;
-
- // camelCase, specialEasing and expand cssHook pass
- for ( index in props ) {
- name = jQuery.camelCase( index );
- easing = specialEasing[ name ];
- value = props[ index ];
- if ( jQuery.isArray( value ) ) {
- easing = value[ 1 ];
- value = props[ index ] = value[ 0 ];
- }
-
- if ( index !== name ) {
- props[ name ] = value;
- delete props[ index ];
- }
-
- hooks = jQuery.cssHooks[ name ];
- if ( hooks && "expand" in hooks ) {
- value = hooks.expand( value );
- delete props[ name ];
-
- // not quite $.extend, this wont overwrite keys already present.
- // also - reusing 'index' from above because we have the correct "name"
- for ( index in value ) {
- if ( !( index in props ) ) {
- props[ index ] = value[ index ];
- specialEasing[ index ] = easing;
- }
- }
- } else {
- specialEasing[ name ] = easing;
- }
- }
-}
-
-jQuery.Animation = jQuery.extend( Animation, {
-
- tweener: function( props, callback ) {
- if ( jQuery.isFunction( props ) ) {
- callback = props;
- props = [ "*" ];
- } else {
- props = props.split(" ");
- }
-
- var prop,
- index = 0,
- length = props.length;
-
- for ( ; index < length ; index++ ) {
- prop = props[ index ];
- tweeners[ prop ] = tweeners[ prop ] || [];
- tweeners[ prop ].unshift( callback );
- }
- },
-
- prefilter: function( callback, prepend ) {
- if ( prepend ) {
- animationPrefilters.unshift( callback );
- } else {
- animationPrefilters.push( callback );
- }
- }
-});
-
-function defaultPrefilter( elem, props, opts ) {
- var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
- anim = this,
- style = elem.style,
- orig = {},
- handled = [],
- hidden = elem.nodeType && isHidden( elem );
-
- // handle queue: false promises
- if ( !opts.queue ) {
- hooks = jQuery._queueHooks( elem, "fx" );
- if ( hooks.unqueued == null ) {
- hooks.unqueued = 0;
- oldfire = hooks.empty.fire;
- hooks.empty.fire = function() {
- if ( !hooks.unqueued ) {
- oldfire();
- }
- };
- }
- hooks.unqueued++;
-
- anim.always(function() {
- // doing this makes sure that the complete handler will be called
- // before this completes
- anim.always(function() {
- hooks.unqueued--;
- if ( !jQuery.queue( elem, "fx" ).length ) {
- hooks.empty.fire();
- }
- });
- });
- }
-
- // height/width overflow pass
- if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
-
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- if ( jQuery.css( elem, "display" ) === "inline" &&
- jQuery.css( elem, "float" ) === "none" ) {
-
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
- style.display = "inline-block";
-
- } else {
- style.zoom = 1;
- }
- }
- }
-
- if ( opts.overflow ) {
- style.overflow = "hidden";
- if ( !jQuery.support.shrinkWrapBlocks ) {
- anim.done(function() {
- style.overflow = opts.overflow[ 0 ];
- style.overflowX = opts.overflow[ 1 ];
- style.overflowY = opts.overflow[ 2 ];
- });
- }
- }
-
-
- // show/hide pass
- for ( index in props ) {
- value = props[ index ];
- if ( rfxtypes.exec( value ) ) {
- delete props[ index ];
- toggle = toggle || value === "toggle";
- if ( value === ( hidden ? "hide" : "show" ) ) {
- continue;
- }
- handled.push( index );
- }
- }
-
- length = handled.length;
- if ( length ) {
- dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
- if ( "hidden" in dataShow ) {
- hidden = dataShow.hidden;
- }
-
- // store state if its toggle - enables .stop().toggle() to "reverse"
- if ( toggle ) {
- dataShow.hidden = !hidden;
- }
- if ( hidden ) {
- jQuery( elem ).show();
- } else {
- anim.done(function() {
- jQuery( elem ).hide();
- });
- }
- anim.done(function() {
- var prop;
- jQuery.removeData( elem, "fxshow", true );
- for ( prop in orig ) {
- jQuery.style( elem, prop, orig[ prop ] );
- }
- });
- for ( index = 0 ; index < length ; index++ ) {
- prop = handled[ index ];
- tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
- orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
-
- if ( !( prop in dataShow ) ) {
- dataShow[ prop ] = tween.start;
- if ( hidden ) {
- tween.end = tween.start;
- tween.start = prop === "width" || prop === "height" ? 1 : 0;
- }
- }
- }
- }
-}
-
-function Tween( elem, options, prop, end, easing ) {
- return new Tween.prototype.init( elem, options, prop, end, easing );
-}
-jQuery.Tween = Tween;
-
-Tween.prototype = {
- constructor: Tween,
- init: function( elem, options, prop, end, easing, unit ) {
- this.elem = elem;
- this.prop = prop;
- this.easing = easing || "swing";
- this.options = options;
- this.start = this.now = this.cur();
- this.end = end;
- this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
- },
- cur: function() {
- var hooks = Tween.propHooks[ this.prop ];
-
- return hooks && hooks.get ?
- hooks.get( this ) :
- Tween.propHooks._default.get( this );
- },
- run: function( percent ) {
- var eased,
- hooks = Tween.propHooks[ this.prop ];
-
- if ( this.options.duration ) {
- this.pos = eased = jQuery.easing[ this.easing ](
- percent, this.options.duration * percent, 0, 1, this.options.duration
- );
- } else {
- this.pos = eased = percent;
- }
- this.now = ( this.end - this.start ) * eased + this.start;
-
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
-
- if ( hooks && hooks.set ) {
- hooks.set( this );
- } else {
- Tween.propHooks._default.set( this );
- }
- return this;
- }
-};
-
-Tween.prototype.init.prototype = Tween.prototype;
-
-Tween.propHooks = {
- _default: {
- get: function( tween ) {
- var result;
-
- if ( tween.elem[ tween.prop ] != null &&
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
- return tween.elem[ tween.prop ];
- }
-
- // passing any value as a 4th parameter to .css will automatically
- // attempt a parseFloat and fallback to a string if the parse fails
- // so, simple values such as "10px" are parsed to Float.
- // complex values such as "rotate(1rad)" are returned as is.
- result = jQuery.css( tween.elem, tween.prop, false, "" );
- // Empty strings, null, undefined and "auto" are converted to 0.
- return !result || result === "auto" ? 0 : result;
- },
- set: function( tween ) {
- // use step hook for back compat - use cssHook if its there - use .style if its
- // available and use plain properties where available
- if ( jQuery.fx.step[ tween.prop ] ) {
- jQuery.fx.step[ tween.prop ]( tween );
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
- } else {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- }
-};
-
-// Remove in 2.0 - this supports IE8's panic based approach
-// to setting things on disconnected nodes
-
-Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
- set: function( tween ) {
- if ( tween.elem.nodeType && tween.elem.parentNode ) {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
-};
-
-jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
- var cssFn = jQuery.fn[ name ];
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return speed == null || typeof speed === "boolean" ||
- // special check for .toggle( handler, handler, ... )
- ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
- cssFn.apply( this, arguments ) :
- this.animate( genFx( name, true ), speed, easing, callback );
- };
-});
-
-jQuery.fn.extend({
- fadeTo: function( speed, to, easing, callback ) {
-
- // show any hidden elements after setting opacity to 0
- return this.filter( isHidden ).css( "opacity", 0 ).show()
-
- // animate to the value specified
- .end().animate({ opacity: to }, speed, easing, callback );
- },
- animate: function( prop, speed, easing, callback ) {
- var empty = jQuery.isEmptyObject( prop ),
- optall = jQuery.speed( speed, easing, callback ),
- doAnimation = function() {
- // Operate on a copy of prop so per-property easing won't be lost
- var anim = Animation( this, jQuery.extend( {}, prop ), optall );
-
- // Empty animations resolve immediately
- if ( empty ) {
- anim.stop( true );
- }
- };
-
- return empty || optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
- stop: function( type, clearQueue, gotoEnd ) {
- var stopQueue = function( hooks ) {
- var stop = hooks.stop;
- delete hooks.stop;
- stop( gotoEnd );
- };
-
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
-
- return this.each(function() {
- var dequeue = true,
- index = type != null && type + "queueHooks",
- timers = jQuery.timers,
- data = jQuery._data( this );
-
- if ( index ) {
- if ( data[ index ] && data[ index ].stop ) {
- stopQueue( data[ index ] );
- }
- } else {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
- stopQueue( data[ index ] );
- }
- }
- }
-
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- timers[ index ].anim.stop( gotoEnd );
- dequeue = false;
- timers.splice( index, 1 );
- }
- }
-
- // start the next in the queue if the last step wasn't forced
- // timers currently will call their complete callbacks, which will dequeue
- // but only if they were gotoEnd
- if ( dequeue || !gotoEnd ) {
- jQuery.dequeue( this, type );
- }
- });
- }
-});
-
-// Generate parameters to create a standard animation
-function genFx( type, includeWidth ) {
- var which,
- attrs = { height: type },
- i = 0;
-
- // if we include width, step value is 1 to do all cssExpand values,
- // if we don't include width, step value is 2 to skip over Left and Right
- includeWidth = includeWidth? 1 : 0;
- for( ; i < 4 ; i += 2 - includeWidth ) {
- which = cssExpand[ i ];
- attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
- }
-
- if ( includeWidth ) {
- attrs.opacity = attrs.width = type;
- }
-
- return attrs;
-}
-
-// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx("show"),
- slideUp: genFx("hide"),
- slideToggle: genFx("toggle"),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
-}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
-});
-
-jQuery.speed = function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
-
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
-
- // normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
-
- // Queueing
- opt.old = opt.complete;
-
- opt.complete = function() {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
-
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- }
- };
-
- return opt;
-};
-
-jQuery.easing = {
- linear: function( p ) {
- return p;
- },
- swing: function( p ) {
- return 0.5 - Math.cos( p*Math.PI ) / 2;
- }
-};
-
-jQuery.timers = [];
-jQuery.fx = Tween.prototype.init;
-jQuery.fx.tick = function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
-
- fxNow = jQuery.now();
-
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- if ( !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
-
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- fxNow = undefined;
-};
-
-jQuery.fx.timer = function( timer ) {
- if ( timer() && jQuery.timers.push( timer ) && !timerId ) {
- timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
- }
-};
-
-jQuery.fx.interval = 13;
-
-jQuery.fx.stop = function() {
- clearInterval( timerId );
- timerId = null;
-};
-
-jQuery.fx.speeds = {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
-};
-
-// Back Compat <1.8 extension point
-jQuery.fx.step = {};
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
-}
-var rroot = /^(?:body|html)$/i;
-
-jQuery.fn.offset = function( options ) {
- if ( arguments.length ) {
- return options === undefined ?
- this :
- this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,
- box = { top: 0, left: 0 },
- elem = this[ 0 ],
- doc = elem && elem.ownerDocument;
-
- if ( !doc ) {
- return;
- }
-
- if ( (body = doc.body) === elem ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- docElem = doc.documentElement;
-
- // Make sure it's not a disconnected DOM node
- if ( !jQuery.contains( docElem, elem ) ) {
- return box;
- }
-
- // If we don't have gBCR, just use 0,0 rather than error
- // BlackBerry 5, iOS 3 (original iPhone)
- if ( typeof elem.getBoundingClientRect !== "undefined" ) {
- box = elem.getBoundingClientRect();
- }
- win = getWindow( doc );
- clientTop = docElem.clientTop || body.clientTop || 0;
- clientLeft = docElem.clientLeft || body.clientLeft || 0;
- scrollTop = win.pageYOffset || docElem.scrollTop;
- scrollLeft = win.pageXOffset || docElem.scrollLeft;
- return {
- top: box.top + scrollTop - clientTop,
- left: box.left + scrollLeft - clientLeft
- };
-};
-
-jQuery.offset = {
-
- bodyOffset: function( body ) {
- var top = body.offsetTop,
- left = body.offsetLeft;
-
- if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
- left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
- }
-
- return { top: top, left: left };
- },
-
- setOffset: function( elem, options, i ) {
- var position = jQuery.css( elem, "position" );
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.css( elem, "top" ),
- curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
- props = {}, curPosition = {}, curTop, curLeft;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-
-jQuery.fn.extend({
-
- position: function() {
- if ( !this[0] ) {
- return;
- }
-
- var elem = this[0],
-
- // Get *real* offsetParent
- offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
- offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
-
- // Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
- parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
-
- // Subtract the two offsets
- return {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || document.body;
- while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent || document.body;
- });
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
- var top = /Y/.test( prop );
-
- jQuery.fn[ method ] = function( val ) {
- return jQuery.access( this, function( elem, method, val ) {
- var win = getWindow( elem );
-
- if ( val === undefined ) {
- return win ? (prop in win) ? win[ prop ] :
- win.document.documentElement[ method ] :
- elem[ method ];
- }
-
- if ( win ) {
- win.scrollTo(
- !top ? val : jQuery( win ).scrollLeft(),
- top ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- elem[ method ] = val;
- }
- }, method, val, arguments.length, null );
- };
-});
-
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
-jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
- // margin is only for outerHeight, outerWidth
- jQuery.fn[ funcName ] = function( margin, value ) {
- var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
- extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
-
- return jQuery.access( this, function( elem, type, value ) {
- var doc;
-
- if ( jQuery.isWindow( elem ) ) {
- // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
- // isn't a whole lot we can do. See pull request at this URL for discussion:
- // https://github.com/jquery/jquery/pull/764
- return elem.document.documentElement[ "client" + name ];
- }
-
- // Get document width or height
- if ( elem.nodeType === 9 ) {
- doc = elem.documentElement;
-
- // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
- // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
- return Math.max(
- elem.body[ "scroll" + name ], doc[ "scroll" + name ],
- elem.body[ "offset" + name ], doc[ "offset" + name ],
- doc[ "client" + name ]
- );
- }
-
- return value === undefined ?
- // Get width or height on the element, requesting but not forcing parseFloat
- jQuery.css( elem, type, value, extra ) :
-
- // Set width or height on the element
- jQuery.style( elem, type, value, extra );
- }, type, chainable ? margin : undefined, chainable, null );
- };
- });
-});
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
-
-// Expose jQuery as an AMD module, but only for AMD loaders that
-// understand the issues with loading multiple versions of jQuery
-// in a page that all might call define(). The loader will indicate
-// they have special allowances for multiple jQuery versions by
-// specifying define.amd.jQuery = true. Register as a named module,
-// since jQuery can be concatenated with other files that may use define,
-// but not use a proper concatenation script that understands anonymous
-// AMD modules. A named AMD is safest and most robust way to register.
-// Lowercase jquery is used because AMD module names are derived from
-// file names, and jQuery is normally delivered in a lowercase file name.
-// Do this after creating the global so that if an AMD module wants to call
-// noConflict to hide this version of jQuery, it will work.
-if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
- define( "jquery", [], function () { return jQuery; } );
-}
-
-})( window );
diff --git a/resources/jquery/jquery.json.js b/resources/jquery/jquery.json.js
deleted file mode 100644
index 75953f4d..00000000
--- a/resources/jquery/jquery.json.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
- * jQuery JSON plugin 2.4.0
- *
- * @author Brantley Harris, 2009-2011
- * @author Timo Tijhof, 2011-2012
- * @source This plugin is heavily influenced by MochiKit's serializeJSON, which is
- * copyrighted 2005 by Bob Ippolito.
- * @source Brantley Harris wrote this plugin. It is based somewhat on the JSON.org
- * website's http://www.json.org/json2.js, which proclaims:
- * "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
- * I uphold.
- * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
- */
-(function ($) {
- 'use strict';
-
- var escape = /["\\\x00-\x1f\x7f-\x9f]/g,
- meta = {
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- hasOwn = Object.prototype.hasOwnProperty;
-
- /**
- * jQuery.toJSON
- * Converts the given argument into a JSON representation.
- *
- * @param o {Mixed} The json-serializable *thing* to be converted
- *
- * If an object has a toJSON prototype, that will be used to get the representation.
- * Non-integer/string keys are skipped in the object, as are keys that point to a
- * function.
- *
- */
- $.toJSON = typeof JSON === 'object' && JSON.stringify ? JSON.stringify : function (o) {
- if (o === null) {
- return 'null';
- }
-
- var pairs, k, name, val,
- type = $.type(o);
-
- if (type === 'undefined') {
- return undefined;
- }
-
- // Also covers instantiated Number and Boolean objects,
- // which are typeof 'object' but thanks to $.type, we
- // catch them here. I don't know whether it is right
- // or wrong that instantiated primitives are not
- // exported to JSON as an {"object":..}.
- // We choose this path because that's what the browsers did.
- if (type === 'number' || type === 'boolean') {
- return String(o);
- }
- if (type === 'string') {
- return $.quoteString(o);
- }
- if (typeof o.toJSON === 'function') {
- return $.toJSON(o.toJSON());
- }
- if (type === 'date') {
- var month = o.getUTCMonth() + 1,
- day = o.getUTCDate(),
- year = o.getUTCFullYear(),
- hours = o.getUTCHours(),
- minutes = o.getUTCMinutes(),
- seconds = o.getUTCSeconds(),
- milli = o.getUTCMilliseconds();
-
- if (month < 10) {
- month = '0' + month;
- }
- if (day < 10) {
- day = '0' + day;
- }
- if (hours < 10) {
- hours = '0' + hours;
- }
- if (minutes < 10) {
- minutes = '0' + minutes;
- }
- if (seconds < 10) {
- seconds = '0' + seconds;
- }
- if (milli < 100) {
- milli = '0' + milli;
- }
- if (milli < 10) {
- milli = '0' + milli;
- }
- return '"' + year + '-' + month + '-' + day + 'T' +
- hours + ':' + minutes + ':' + seconds +
- '.' + milli + 'Z"';
- }
-
- pairs = [];
-
- if ($.isArray(o)) {
- for (k = 0; k < o.length; k++) {
- pairs.push($.toJSON(o[k]) || 'null');
- }
- return '[' + pairs.join(',') + ']';
- }
-
- // Any other object (plain object, RegExp, ..)
- // Need to do typeof instead of $.type, because we also
- // want to catch non-plain objects.
- if (typeof o === 'object') {
- for (k in o) {
- // Only include own properties,
- // Filter out inherited prototypes
- if (hasOwn.call(o, k)) {
- // Keys must be numerical or string. Skip others
- type = typeof k;
- if (type === 'number') {
- name = '"' + k + '"';
- } else if (type === 'string') {
- name = $.quoteString(k);
- } else {
- continue;
- }
- type = typeof o[k];
-
- // Invalid values like these return undefined
- // from toJSON, however those object members
- // shouldn't be included in the JSON string at all.
- if (type !== 'function' && type !== 'undefined') {
- val = $.toJSON(o[k]);
- pairs.push(name + ':' + val);
- }
- }
- }
- return '{' + pairs.join(',') + '}';
- }
- };
-
- /**
- * jQuery.evalJSON
- * Evaluates a given json string.
- *
- * @param str {String}
- */
- $.evalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
- /*jshint evil: true */
- return eval('(' + str + ')');
- };
-
- /**
- * jQuery.secureEvalJSON
- * Evals JSON in a way that is *more* secure.
- *
- * @param str {String}
- */
- $.secureEvalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
- var filtered =
- str
- .replace(/\\["\\\/bfnrtu]/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, '');
-
- if (/^[\],:{}\s]*$/.test(filtered)) {
- /*jshint evil: true */
- return eval('(' + str + ')');
- }
- throw new SyntaxError('Error parsing JSON, source is not valid.');
- };
-
- /**
- * jQuery.quoteString
- * Returns a string-repr of a string, escaping quotes intelligently.
- * Mostly a support function for toJSON.
- * Examples:
- * >>> jQuery.quoteString('apple')
- * "apple"
- *
- * >>> jQuery.quoteString('"Where are we going?", she asked.')
- * "\"Where are we going?\", she asked."
- */
- $.quoteString = function (str) {
- if (str.match(escape)) {
- return '"' + str.replace(escape, function (a) {
- var c = meta[a];
- if (typeof c === 'string') {
- return c;
- }
- c = a.charCodeAt();
- return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
- }) + '"';
- }
- return '"' + str + '"';
- };
-
-}(jQuery));
diff --git a/resources/jquery/jquery.localize.js b/resources/jquery/jquery.localize.js
deleted file mode 100644
index d9a2b199..00000000
--- a/resources/jquery/jquery.localize.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * @class jQuery.plugin.localize
- */
-( function ( $, mw ) {
-
-/**
- * Gets a localized message, using parameters from options if present.
- * @ignore
- *
- * @param {Object} options
- * @param {string} key
- * @returns {string} Localized message
- */
-function msg( options, key ) {
- var args = options.params[key] || [];
- // Format: mw.msg( key [, p1, p2, ...] )
- args.unshift( options.prefix + ( options.keys[key] || key ) );
- return mw.msg.apply( mw, args );
-}
-
-/**
- * Localizes a DOM selection by replacing <html:msg /> elements with localized text and adding
- * localized title and alt attributes to elements with title-msg and alt-msg attributes
- * respectively.
- *
- * Call on a selection of HTML which contains `<html:msg key="message-key" />` elements or elements
- * with title-msg="message-key", alt-msg="message-key" or placeholder-msg="message-key" attributes.
- * `<html:msg />` elements will be replaced with localized text, *-msg attributes will be replaced
- * with attributes that do not have the "-msg" suffix and contain a localized message.
- *
- * Example:
- * // Messages: { 'title': 'Awesome', 'desc': 'Cat doing backflip' 'search' contains 'Search' }
- * var html = '\
- * <p>\
- * <html:msg key="title" />\
- * <img src="something.jpg" title-msg="title" alt-msg="desc" />\
- * <input type="text" placeholder-msg="search" />\
- * </p>';
- * $( 'body' ).append( $( html ).localize() );
- *
- * Appends something like this to the body...
- * <p>
- * Awesome
- * <img src="something.jpg" title="Awesome" alt="Cat doing backflip" />
- * <input type="text" placeholder="Search" />
- * </p>
- *
- * Arguments can be passed into uses of a message using the params property of the options object
- * given to .localize(). Multiple messages can be given parameters, because the params property is
- * an object keyed by the message key to apply the parameters to, each containing an array of
- * parameters to use. The limitation is that you can not use different parameters to individual uses
- * of a message in the same selection being localized - they will all recieve the same parameters.
- *
- * Example:
- * // Messages: { 'easy-as': 'Easy as $1 $2 $3.' }
- * var html = '<p><html:msg key="easy-as" /></p>';
- * $( 'body' ).append( $( html ).localize( { 'params': { 'easy-as': ['a', 'b', 'c'] } } ) );
- *
- * Appends something like this to the body...
- * <p>Easy as a, b, c</p>
- *
- * Raw HTML content can be used, instead of it being escaped as text. To do this, just use the raw
- * attribute on a msg element.
- *
- * Example:
- * // Messages: { 'hello': '<b><i>Hello</i> $1!</b>' }
- * var html = '\
- * <p>\
- * <!-- escaped: --><html:msg key="hello" />\
- * <!-- raw: --><html:msg key="hello" raw />\
- * </p>';
- * $( 'body' ).append( $( html ).localize( { 'params': { 'hello': ['world'] } } ) );
- *
- * Appends something like this to the body...
- * <p>
- * <!-- escaped: -->&lt;b&gt;&lt;i&gt;Hello&lt;/i&gt; world!&lt;/b&gt;
- * <!-- raw: --><b><i>Hello</i> world!</b>
- * </p>
- *
- * Message keys can also be remapped, allowing the same generic template to be used with a variety
- * of messages. This is important for improving re-usability of templates.
- *
- * Example:
- * // Messages: { 'good-afternoon': 'Good afternoon' }
- * var html = '<p><html:msg key="greeting" /></p>';
- * $( 'body' ).append( $( html ).localize( { 'keys': { 'greeting': 'good-afternoon' } } ) );
- *
- * Appends something like this to the body...
- * <p>Good afternoon</p>
- *
- * Message keys can also be prefixed globally, which is handy when writing extensions, where by
- * convention all messages are prefixed with the extension's name.
- *
- * Example:
- * // Messages: { 'teleportation-warning': 'You may not get there all in one piece.' }
- * var html = '<p><html:msg key="warning" /></p>';
- * $( 'body' ).append( $( html ).localize( { 'prefix': 'teleportation-' } ) );
- *
- * Appends something like this to the body...
- * <p>You may not get there all in one piece.</p>
- *
- * @method
- * @param {Object} options Map of options to be used while localizing
- * @param {string} options.prefix String to prepend to all message keys
- * @param {Object} options.keys Message key aliases, used for remapping keys to a template
- * @param {Object} options.params Lists of parameters to use with certain message keys
- * @return {jQuery}
- */
-$.fn.localize = function ( options ) {
- var $target = this,
- attributes = ['title', 'alt', 'placeholder'];
-
- // Extend options
- options = $.extend( {
- prefix: '',
- keys: {},
- params: {}
- }, options );
-
- // Elements
- // Ok, so here's the story on this selector. In IE 6/7, searching for 'msg' turns up the
- // 'html:msg', but searching for 'html:msg' doesn't. In later IE and other browsers, searching
- // for 'html:msg' turns up the 'html:msg', but searching for 'msg' doesn't. So searching for
- // both 'msg' and 'html:msg' seems to get the job done. This feels pretty icky, though.
- $target.find( 'msg,html\\:msg' ).each( function () {
- var $el = $(this);
- // Escape by default
- if ( $el.attr( 'raw' ) ) {
- $el.html( msg( options, $el.attr( 'key' ) ) );
- } else {
- $el.text( msg( options, $el.attr( 'key' ) ) );
- }
- // Remove wrapper
- $el.replaceWith( $el.html() );
- } );
-
- // Attributes
- // Note: there's no way to prevent escaping of values being injected into attributes, this is
- // on purpose, not a design flaw.
- $.each( attributes, function ( i, attr ) {
- var msgAttr = attr + '-msg';
- $target.find( '[' + msgAttr + ']' ).each( function () {
- var $el = $(this);
- $el.attr( attr, msg( options, $el.attr( msgAttr ) ) ).removeAttr( msgAttr );
- } );
- } );
-
- // HTML, Text for elements which cannot have children e.g. OPTION
- $target.find( '[data-msg-text]' ).each( function() {
- var $el = $( this );
- $el.text( msg( options, $el.attr( 'data-msg-text' ) ) );
- } );
-
- $target.find( '[data-msg-html]' ).each( function() {
- var $el = $( this );
- $el.html( msg( options, $el.attr( 'data-msg-html' ) ) );
- } );
-
- return $target;
-};
-
-// Let IE know about the msg tag before it's used...
-document.createElement( 'msg' );
-
-/**
- * @class jQuery
- * @mixins jQuery.plugin.localize
- */
-
-}( jQuery, mediaWiki ) );
diff --git a/resources/jquery/jquery.makeCollapsible.css b/resources/jquery/jquery.makeCollapsible.css
deleted file mode 100644
index 993fa8c6..00000000
--- a/resources/jquery/jquery.makeCollapsible.css
+++ /dev/null
@@ -1,14 +0,0 @@
-/* See also jquery.makeCollapsible.js */
-.mw-collapsible-toggle {
- float: right;
-}
-
-/* list-items go as wide as their parent element, don't float them inside list items */
-li .mw-collapsible-toggle {
- float: none;
-}
-
-/* the added list item should have no list-style */
-.mw-collapsible-toggle-li {
- list-style: none;
-}
diff --git a/resources/jquery/jquery.makeCollapsible.js b/resources/jquery/jquery.makeCollapsible.js
deleted file mode 100644
index 0cd6417c..00000000
--- a/resources/jquery/jquery.makeCollapsible.js
+++ /dev/null
@@ -1,381 +0,0 @@
-/**
- * jQuery makeCollapsible
- *
- * This will enable collapsible-functionality on all passed elements.
- * - Will prevent binding twice to the same element.
- * - Initial state is expanded by default, this can be overriden by adding class
- * "mw-collapsed" to the "mw-collapsible" element.
- * - Elements made collapsible have jQuery data "mw-made-collapsible" set to true.
- * - The inner content is wrapped in a "div.mw-collapsible-content" (except for tables and lists).
- *
- * @author Krinkle, 2011-2012
- *
- * Dual license:
- * @license CC-BY 3.0 <http://creativecommons.org/licenses/by/3.0>
- * @license GPL2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
- */
-( function ( $, mw ) {
- var lpx = 'jquery.makeCollapsible> ';
-
- /**
- * Handler for a click on a collapsible toggler.
- *
- * @param {jQuery} $collapsible
- * @param {string} action The action this function will take ('expand' or 'collapse').
- * @param {jQuery|null} [optional] $defaultToggle
- * @param {Object|undefined} options
- */
- function toggleElement( $collapsible, action, $defaultToggle, options ) {
- var $collapsibleContent, $containers, hookCallback;
- options = options || {};
-
- // Validate parameters
-
- // $collapsible must be an instance of jQuery
- if ( !$collapsible.jquery ) {
- return;
- }
- if ( action !== 'expand' && action !== 'collapse' ) {
- // action must be string with 'expand' or 'collapse'
- return;
- }
- if ( $defaultToggle === undefined ) {
- $defaultToggle = null;
- }
- if ( $defaultToggle !== null && !$defaultToggle.jquery ) {
- // is optional (may be undefined), but if defined it must be an instance of jQuery.
- // If it's not, abort right away.
- // After this $defaultToggle is either null or a valid jQuery instance.
- return;
- }
-
- // Trigger a custom event to allow callers to hook to the collapsing/expanding,
- // allowing the module to be testable, and making it possible to
- // e.g. implement persistence via cookies
- $collapsible.trigger( action === 'expand' ? 'beforeExpand.mw-collapsible' : 'beforeCollapse.mw-collapsible' );
- hookCallback = function () {
- $collapsible.trigger( action === 'expand' ? 'afterExpand.mw-collapsible' : 'afterCollapse.mw-collapsible' );
- };
-
- // Handle different kinds of elements
-
- if ( !options.plainMode && $collapsible.is( 'table' ) ) {
- // Tables
- $containers = $collapsible.find( '> tbody > tr' );
- if ( $defaultToggle ) {
- // Exclude table row containing togglelink
- $containers = $containers.not( $defaultToggle.closest( 'tr' ) );
- }
-
- if ( action === 'collapse' ) {
- // Hide all table rows of this table
- // Slide doesn't work with tables, but fade does as of jQuery 1.1.3
- // http://stackoverflow.com/questions/467336#920480
- if ( options.instantHide ) {
- $containers.hide();
- hookCallback();
- } else {
- $containers.stop( true, true ).fadeOut().promise().done( hookCallback );
- }
- } else {
- $containers.stop( true, true ).fadeIn().promise().done( hookCallback );
- }
-
- } else if ( !options.plainMode && ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) ) {
- // Lists
- $containers = $collapsible.find( '> li' );
- if ( $defaultToggle ) {
- // Exclude list-item containing togglelink
- $containers = $containers.not( $defaultToggle.parent() );
- }
-
- if ( action === 'collapse' ) {
- if ( options.instantHide ) {
- $containers.hide();
- hookCallback();
- } else {
- $containers.stop( true, true ).slideUp().promise().done( hookCallback );
- }
- } else {
- $containers.stop( true, true ).slideDown().promise().done( hookCallback );
- }
-
- } else {
- // Everything else: <div>, <p> etc.
- $collapsibleContent = $collapsible.find( '> .mw-collapsible-content' );
-
- // If a collapsible-content is defined, act on it
- if ( !options.plainMode && $collapsibleContent.length ) {
- if ( action === 'collapse' ) {
- if ( options.instantHide ) {
- $collapsibleContent.hide();
- hookCallback();
- } else {
- $collapsibleContent.slideUp().promise().done( hookCallback );
- }
- } else {
- $collapsibleContent.slideDown().promise().done( hookCallback );
- }
-
- // Otherwise assume this is a customcollapse with a remote toggle
- // .. and there is no collapsible-content because the entire element should be toggled
- } else {
- if ( action === 'collapse' ) {
- if ( options.instantHide ) {
- $collapsible.hide();
- hookCallback();
- } else {
- if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) {
- $collapsible.fadeOut().promise().done( hookCallback );
- } else {
- $collapsible.slideUp().promise().done( hookCallback );
- }
- }
- } else {
- if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) {
- $collapsible.fadeIn().promise().done( hookCallback );
- } else {
- $collapsible.slideDown().promise().done( hookCallback );
- }
- }
- }
- }
- }
-
- /**
- * Handles clicking/keypressing on the collapsible element toggle and other
- * situations where a collapsible element is toggled (e.g. the initial
- * toggle for collapsed ones).
- *
- * @param {jQuery} $toggle the clickable toggle itself
- * @param {jQuery} $collapsible the collapsible element
- * @param {jQuery.Event|null} e either the event or null if unavailable
- * @param {Object|undefined} options
- */
- function togglingHandler( $toggle, $collapsible, e, options ) {
- var wasCollapsed, $textContainer, collapseText, expandText;
-
- if ( options === undefined ) {
- options = {};
- }
-
- if ( e ) {
- if ( e.type === 'click' && options.linksPassthru && $.nodeName( e.target, 'a' ) ) {
- // Don't fire if a link was clicked, if requested (for premade togglers by default)
- return;
- } else if ( e.type === 'keypress' && e.which !== 13 && e.which !== 32 ) {
- // Only handle keypresses on the "Enter" or "Space" keys
- return;
- } else {
- e.preventDefault();
- e.stopPropagation();
- }
- }
-
- // This allows the element to be hidden on initial toggle without fiddling with the class
- if ( options.wasCollapsed !== undefined ) {
- wasCollapsed = options.wasCollapsed;
- } else {
- wasCollapsed = $collapsible.hasClass( 'mw-collapsed' );
- }
-
- // Toggle the state of the collapsible element (that is, expand or collapse)
- $collapsible.toggleClass( 'mw-collapsed', !wasCollapsed );
-
- // Toggle the mw-collapsible-toggle classes, if requested (for default and premade togglers by default)
- if ( options.toggleClasses ) {
- $toggle
- .toggleClass( 'mw-collapsible-toggle-collapsed', !wasCollapsed )
- .toggleClass( 'mw-collapsible-toggle-expanded', wasCollapsed );
- }
-
- // Toggle the text ("Show"/"Hide"), if requested (for default togglers by default)
- if ( options.toggleText ) {
- collapseText = options.toggleText.collapseText;
- expandText = options.toggleText.expandText;
-
- $textContainer = $toggle.find( '> a' );
- if ( !$textContainer.length ) {
- $textContainer = $toggle;
- }
- $textContainer.text( wasCollapsed ? collapseText : expandText );
- }
-
- // And finally toggle the element state itself
- toggleElement( $collapsible, wasCollapsed ? 'expand' : 'collapse', $toggle, options );
- }
-
- /**
- * Make any element collapsible.
- *
- * Supported options:
- * - collapseText: text to be used for the toggler when clicking it would
- * collapse the element. Default: the 'data-collapsetext' attribute of
- * the collapsible element or the content of 'collapsible-collapse'
- * message.
- * - expandText: text to be used for the toggler when clicking it would
- * expand the element. Default: the 'data-expandtext' attribute of
- * the collapsible element or the content of 'collapsible-expand'
- * message.
- * - collapsed: boolean, whether to collapse immediately. By default
- * collapse only if the elements has the 'mw-collapsible' class.
- * - $customTogglers: jQuerified list of elements to be used as togglers
- * for this collapsible element. By default, if the collapsible element
- * has an id attribute like 'mw-customcollapsible-XXX', elements with a
- * *class* of 'mw-customtoggle-XXX' are made togglers for it.
- * - plainMode: boolean, whether to use a "plain mode" when making the
- * element collapsible - that is, hide entire tables and lists (instead
- * of hiding only all rows but first of tables, and hiding each list
- * item separately for lists) and don't wrap other elements in
- * div.mw-collapsible-content. May only be used with custom togglers.
- */
- $.fn.makeCollapsible = function ( options ) {
- if ( options === undefined ) {
- options = {};
- }
-
- return this.each( function () {
- var $collapsible, collapseText, expandText, $toggle, actionHandler, buildDefaultToggleLink,
- premadeToggleHandler, $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval;
-
- // Ensure class "mw-collapsible" is present in case .makeCollapsible()
- // is called on element(s) that don't have it yet.
- $collapsible = $( this ).addClass( 'mw-collapsible' );
-
- // Return if it has been enabled already.
- if ( $collapsible.data( 'mw-made-collapsible' ) ) {
- return;
- } else {
- $collapsible.data( 'mw-made-collapsible', true );
- }
-
- // Use custom text or default?
- collapseText = options.collapseText || $collapsible.attr( 'data-collapsetext' ) || mw.msg( 'collapsible-collapse' );
- expandText = options.expandText || $collapsible.attr( 'data-expandtext' ) || mw.msg( 'collapsible-expand' );
-
- // Default click/keypress handler and toggle link to use when none is present
- actionHandler = function ( e, opts ) {
- var defaultOpts = {
- toggleClasses: true,
- toggleText: { collapseText: collapseText, expandText: expandText }
- };
- opts = $.extend( defaultOpts, options, opts );
- togglingHandler( $( this ), $collapsible, e, opts );
- };
- // Default toggle link. Only build it when needed to avoid jQuery memory leaks (event data).
- buildDefaultToggleLink = function () {
- return $( '<a href="#"></a>' )
- .text( collapseText )
- .wrap( '<span class="mw-collapsible-toggle"></span>' )
- .parent()
- .prepend( '&nbsp;[' )
- .append( ']&nbsp;' )
- .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
- };
-
- // Default handler for clicking on premade toggles
- premadeToggleHandler = function ( e, opts ) {
- var defaultOpts = { toggleClasses: true, linksPassthru: true };
- opts = $.extend( defaultOpts, options, opts );
- togglingHandler( $( this ), $collapsible, e, opts );
- };
-
- // Check if this element has a custom position for the toggle link
- // (ie. outside the container or deeper inside the tree)
- if ( options.$customTogglers ) {
- $customTogglers = $( options.$customTogglers );
- } else {
- collapsibleId = $collapsible.attr( 'id' ) || '';
- if ( collapsibleId.indexOf( 'mw-customcollapsible-' ) === 0 ) {
- mw.log( lpx + 'Found custom collapsible: #' + collapsibleId );
- $customTogglers = $( '.' + collapsibleId.replace( 'mw-customcollapsible', 'mw-customtoggle' ) );
-
- // Double check that there is actually a customtoggle link
- if ( !$customTogglers.length ) {
- mw.log( lpx + '#' + collapsibleId + ': Missing toggler!' );
- }
- }
- }
-
- // Bind the togglers
- if ( $customTogglers && $customTogglers.length ) {
- actionHandler = function ( e, opts ) {
- var defaultOpts = {};
- opts = $.extend( defaultOpts, options, opts );
- togglingHandler( $( this ), $collapsible, e, opts );
- };
-
- $toggleLink = $customTogglers;
- $toggleLink.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
-
- } else {
- // If this is not a custom case, do the default: wrap the
- // contents and add the toggle link. Different elements are
- // treated differently.
- if ( $collapsible.is( 'table' ) ) {
- // The toggle-link will be in one the the cells (td or th) of the first row
- $firstItem = $collapsible.find( 'tr:first th, tr:first td' );
- $toggle = $firstItem.find( '> .mw-collapsible-toggle' );
-
- // If theres no toggle link, add it to the last cell
- if ( !$toggle.length ) {
- $toggleLink = buildDefaultToggleLink().prependTo( $firstItem.eq( -1 ) );
- } else {
- actionHandler = premadeToggleHandler;
- $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
- }
-
- } else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) {
- // The toggle-link will be in the first list-item
- $firstItem = $collapsible.find( 'li:first' );
- $toggle = $firstItem.find( '> .mw-collapsible-toggle' );
-
- // If theres no toggle link, add it
- if ( !$toggle.length ) {
- // Make sure the numeral order doesn't get messed up, force the first (soon to be second) item
- // to be "1". Except if the value-attribute is already used.
- // If no value was set WebKit returns "", Mozilla returns '-1', others return 0, null or undefined.
- firstval = $firstItem.attr( 'value' );
- if ( firstval === undefined || !firstval || firstval === '-1' || firstval === -1 ) {
- $firstItem.attr( 'value', '1' );
- }
- $toggleLink = buildDefaultToggleLink();
- $toggleLink.wrap( '<li class="mw-collapsible-toggle-li"></li>' ).parent().prependTo( $collapsible );
- } else {
- actionHandler = premadeToggleHandler;
- $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
- }
-
- } else { // <div>, <p> etc.
-
- // The toggle-link will be the first child of the element
- $toggle = $collapsible.find( '> .mw-collapsible-toggle' );
-
- // If a direct child .content-wrapper does not exists, create it
- if ( !$collapsible.find( '> .mw-collapsible-content' ).length ) {
- $collapsible.wrapInner( '<div class="mw-collapsible-content"></div>' );
- }
-
- // If theres no toggle link, add it
- if ( !$toggle.length ) {
- $toggleLink = buildDefaultToggleLink().prependTo( $collapsible );
- } else {
- actionHandler = premadeToggleHandler;
- $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
- }
- }
- }
-
- // Attributes for accessibility. This isn't necessary when the toggler is already
- // an <a> or a <button> etc., but it doesn't hurt either, and it's consistent.
- $toggleLink.prop( 'tabIndex', 0 );
-
- // Initial state
- if ( options.collapsed || $collapsible.hasClass( 'mw-collapsed' ) ) {
- // One toggler can hook to multiple elements, and one element can have
- // multiple togglers. This is the sanest way to handle that.
- actionHandler.call( $toggleLink.get( 0 ), null, { instantHide: true, wasCollapsed: false } );
- }
- } );
- };
-}( jQuery, mediaWiki ) );
diff --git a/resources/jquery/jquery.mockjax.js b/resources/jquery/jquery.mockjax.js
deleted file mode 100644
index 5f6e1306..00000000
--- a/resources/jquery/jquery.mockjax.js
+++ /dev/null
@@ -1,382 +0,0 @@
-/*!
- * MockJax - jQuery Plugin to Mock Ajax requests
- *
- * Version: 1.4.0
- * Released: 2011-02-04
- * Source: http://github.com/appendto/jquery-mockjax
- * Docs: http://enterprisejquery.com/2010/07/mock-your-ajax-requests-with-mockjax-for-rapid-development
- * Plugin: mockjax
- * Author: Jonathan Sharp (http://jdsharp.com)
- * License: MIT,GPL
- *
- * Copyright (c) 2010 appendTo LLC.
- * Dual licensed under the MIT or GPL licenses.
- * http://appendto.com/open-source-licenses
- */
-(function($) {
- var _ajax = $.ajax,
- mockHandlers = [];
-
- function parseXML(xml) {
- if ( window['DOMParser'] == undefined && window.ActiveXObject ) {
- DOMParser = function() { };
- DOMParser.prototype.parseFromString = function( xmlString ) {
- var doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML( xmlString );
- return doc;
- };
- }
-
- try {
- var xmlDoc = ( new DOMParser() ).parseFromString( xml, 'text/xml' );
- if ( $.isXMLDoc( xmlDoc ) ) {
- var err = $('parsererror', xmlDoc);
- if ( err.length == 1 ) {
- throw('Error: ' + $(xmlDoc).text() );
- }
- } else {
- throw('Unable to parse XML');
- }
- } catch( e ) {
- var msg = ( e.name == undefined ? e : e.name + ': ' + e.message );
- $(document).trigger('xmlParseError', [ msg ]);
- return undefined;
- }
- return xmlDoc;
- }
-
- $.extend({
- ajax: function(origSettings) {
- var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
- mock = false;
- // Iterate over our mock handlers (in registration order) until we find
- // one that is willing to intercept the request
- $.each(mockHandlers, function(k, v) {
- if ( !mockHandlers[k] ) {
- return;
- }
- var m = null;
- // If the mock was registered with a function, let the function decide if we
- // want to mock this request
- if ( $.isFunction(mockHandlers[k]) ) {
- m = mockHandlers[k](s);
- } else {
- m = mockHandlers[k];
- // Inspect the URL of the request and check if the mock handler's url
- // matches the url for this ajax request
- if ( $.isFunction(m.url.test) ) {
- // The user provided a regex for the url, test it
- if ( !m.url.test( s.url ) ) {
- m = null;
- }
- } else {
- // Look for a simple wildcard '*' or a direct URL match
- var star = m.url.indexOf('*');
- if ( ( m.url != '*' && m.url != s.url && star == -1 ) ||
- ( star > -1 && m.url.substr(0, star) != s.url.substr(0, star) ) ) {
- // The url we tested did not match the wildcard *
- m = null;
- }
- }
- if ( m ) {
- // Inspect the data submitted in the request (either POST body or GET query string)
- if ( m.data && s.data ) {
- var identical = false;
- // Deep inspect the identity of the objects
- (function ident(mock, live) {
- // Test for situations where the data is a querystring (not an object)
- if (typeof live === 'string') {
- // Querystring may be a regex
- identical = $.isFunction( mock.test ) ? mock.test(live) : mock == live;
- return identical;
- }
- $.each(mock, function(k, v) {
- if ( live[k] === undefined ) {
- identical = false;
- return false;
- } else {
- identical = true;
- if ( typeof live[k] == 'object' ) {
- return ident(mock[k], live[k]);
- } else {
- if ( $.isFunction( mock[k].test ) ) {
- identical = mock[k].test(live[k]);
- } else {
- identical = ( mock[k] == live[k] );
- }
- return identical;
- }
- }
- });
- })(m.data, s.data);
- // They're not identical, do not mock this request
- if ( identical == false ) {
- m = null;
- }
- }
- // Inspect the request type
- if ( m && m.type && m.type != s.type ) {
- // The request type doesn't match (GET vs. POST)
- m = null;
- }
- }
- }
- if ( m ) {
- mock = true;
-
- // Handle console logging
- var c = $.extend({}, $.mockjaxSettings, m);
- if ( c.log && $.isFunction(c.log) ) {
- c.log('MOCK ' + s.type.toUpperCase() + ': ' + s.url, $.extend({}, s));
- }
-
- var jsre = /=\?(&|$)/, jsc = (new Date()).getTime();
-
- // Handle JSONP Parameter Callbacks, we need to replicate some of the jQuery core here
- // because there isn't an easy hook for the cross domain script tag of jsonp
- if ( s.dataType === "jsonp" ) {
- if ( s.type.toUpperCase() === "GET" ) {
- if ( !jsre.test( s.url ) ) {
- s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
- }
- } else if ( !s.data || !jsre.test(s.data) ) {
- s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
- }
- s.dataType = "json";
- }
-
- // Build temporary JSONP function
- if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
- jsonp = s.jsonpCallback || ("jsonp" + jsc++);
-
- // Replace the =? sequence both in the query string and the data
- if ( s.data ) {
- s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
- }
-
- s.url = s.url.replace(jsre, "=" + jsonp + "$1");
-
- // We need to make sure
- // that a JSONP style response is executed properly
- s.dataType = "script";
-
- // Handle JSONP-style loading
- window[ jsonp ] = window[ jsonp ] || function( tmp ) {
- data = tmp;
- success();
- complete();
- // Garbage collect
- window[ jsonp ] = undefined;
-
- try {
- delete window[ jsonp ];
- } catch(e) {}
-
- if ( head ) {
- head.removeChild( script );
- }
- };
- }
-
- var rurl = /^(\w+:)?\/\/([^\/?#]+)/,
- parts = rurl.exec( s.url ),
- remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
-
- // Test if we are going to create a script tag (if so, intercept & mock)
- if ( s.dataType === "script" && s.type.toUpperCase() === "GET" && remote ) {
- // Synthesize the mock request for adding a script tag
- var callbackContext = origSettings && origSettings.context || s;
-
- function success() {
- // If a local callback was specified, fire it and pass it the data
- if ( s.success ) {
- s.success.call( callbackContext, ( m.response ? m.response.toString() : m.responseText || ''), status, {} );
- }
-
- // Fire the global callback
- if ( s.global ) {
- trigger( "ajaxSuccess", [{}, s] );
- }
- }
-
- function complete() {
- // Process result
- if ( s.complete ) {
- s.complete.call( callbackContext, {} , status );
- }
-
- // The request was completed
- if ( s.global ) {
- trigger( "ajaxComplete", [{}, s] );
- }
-
- // Handle the global AJAX counter
- if ( s.global && ! --jQuery.active ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
-
- function trigger(type, args) {
- (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
- }
-
- if ( m.response && $.isFunction(m.response) ) {
- m.response(origSettings);
- } else {
- $.globalEval(m.responseText);
- }
- success();
- complete();
- return false;
- }
- mock = _ajax.call($, $.extend(true, {}, origSettings, {
- // Mock the XHR object
- xhr: function() {
- // Extend with our default mockjax settings
- m = $.extend({}, $.mockjaxSettings, m);
-
- if ( m.contentType ) {
- m.headers['content-type'] = m.contentType;
- }
-
- // Return our mock xhr object
- return {
- status: m.status,
- readyState: 1,
- open: function() { },
- send: function() {
- // This is a substitute for < 1.4 which lacks $.proxy
- var process = (function(that) {
- return function() {
- return (function() {
- // The request has returned
- this.status = m.status;
- this.readyState = 4;
-
- // We have an executable function, call it to give
- // the mock handler a chance to update it's data
- if ( $.isFunction(m.response) ) {
- m.response(origSettings);
- }
- // Copy over our mock to our xhr object before passing control back to
- // jQuery's onreadystatechange callback
- if ( s.dataType == 'json' && ( typeof m.responseText == 'object' ) ) {
- this.responseText = JSON.stringify(m.responseText);
- } else if ( s.dataType == 'xml' ) {
- if ( typeof m.responseXML == 'string' ) {
- this.responseXML = parseXML(m.responseXML);
- } else {
- this.responseXML = m.responseXML;
- }
- } else {
- this.responseText = m.responseText;
- }
- // jQuery < 1.4 doesn't have onreadystate change for xhr
- if ( $.isFunction(this.onreadystatechange) ) {
- this.onreadystatechange( m.isTimeout ? 'timeout' : undefined );
- }
- }).apply(that);
- };
- })(this);
-
- if ( m.proxy ) {
- // We're proxying this request and loading in an external file instead
- _ajax({
- global: false,
- url: m.proxy,
- type: m.proxyType,
- data: m.data,
- dataType: s.dataType,
- complete: function(xhr, txt) {
- m.responseXML = xhr.responseXML;
- m.responseText = xhr.responseText;
- this.responseTimer = setTimeout(process, m.responseTime || 0);
- }
- });
- } else {
- // type == 'POST' || 'GET' || 'DELETE'
- if ( s.async === false ) {
- // TODO: Blocking delay
- process();
- } else {
- this.responseTimer = setTimeout(process, m.responseTime || 50);
- }
- }
- },
- abort: function() {
- clearTimeout(this.responseTimer);
- },
- setRequestHeader: function() { },
- getResponseHeader: function(header) {
- // 'Last-modified', 'Etag', 'content-type' are all checked by jQuery
- if ( m.headers && m.headers[header] ) {
- // Return arbitrary headers
- return m.headers[header];
- } else if ( header.toLowerCase() == 'last-modified' ) {
- return m.lastModified || (new Date()).toString();
- } else if ( header.toLowerCase() == 'etag' ) {
- return m.etag || '';
- } else if ( header.toLowerCase() == 'content-type' ) {
- return m.contentType || 'text/plain';
- }
- },
- getAllResponseHeaders: function() {
- var headers = '';
- $.each(m.headers, function(k, v) {
- headers += k + ': ' + v + "\n";
- });
- return headers;
- }
- };
- }
- }));
- return false;
- }
- });
- // We don't have a mock request, trigger a normal request
- if ( !mock ) {
- return _ajax.apply($, arguments);
- } else {
- return mock;
- }
- }
- });
-
- $.mockjaxSettings = {
- //url: null,
- //type: 'GET',
- log: function(msg) {
- window['console'] && window.console.log && window.console.log(msg);
- },
- status: 200,
- responseTime: 500,
- isTimeout: false,
- contentType: 'text/plain',
- response: '',
- responseText: '',
- responseXML: '',
- proxy: '',
- proxyType: 'GET',
-
- lastModified: null,
- etag: '',
- headers: {
- etag: 'IJF@H#@923uf8023hFO@I#H#',
- 'content-type' : 'text/plain'
- }
- };
-
- $.mockjax = function(settings) {
- var i = mockHandlers.length;
- mockHandlers[i] = settings;
- return i;
- };
- $.mockjaxClear = function(i) {
- if ( arguments.length == 1 ) {
- mockHandlers[i] = null;
- } else {
- mockHandlers = [];
- }
- };
-})(jQuery);
diff --git a/resources/jquery/jquery.mw-jump.js b/resources/jquery/jquery.mw-jump.js
deleted file mode 100644
index e2868341..00000000
--- a/resources/jquery/jquery.mw-jump.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * JavaScript to show jump links to motor-impaired users when they are focused.
- */
-jQuery( function ( $ ) {
-
- $( '.mw-jump' ).on( 'focus blur', 'a', function ( e ) {
- // Confusingly jQuery leaves e.type as focusout for delegated blur events
- if ( e.type === 'blur' || e.type === 'focusout' ) {
- $( this ).closest( '.mw-jump' ).css({ height: 0 });
- } else {
- $( this ).closest( '.mw-jump' ).css({ height: 'auto' });
- }
- } );
-
-} );
diff --git a/resources/jquery/jquery.mwExtension.js b/resources/jquery/jquery.mwExtension.js
deleted file mode 100644
index de399788..00000000
--- a/resources/jquery/jquery.mwExtension.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * JavaScript backwards-compatibility alternatives and other convenience functions
- */
-( function ( $ ) {
-
- $.extend({
- trimLeft: function ( str ) {
- return str === null ? '' : str.toString().replace( /^\s+/, '' );
- },
- trimRight: function ( str ) {
- return str === null ?
- '' : str.toString().replace( /\s+$/, '' );
- },
- ucFirst: function ( str ) {
- return str.charAt( 0 ).toUpperCase() + str.substr( 1 );
- },
- escapeRE: function ( str ) {
- return str.replace ( /([\\{}()|.?*+\-\^$\[\]])/g, '\\$1' );
- },
- isDomElement: function ( el ) {
- return !!el && !!el.nodeType;
- },
- isEmpty: function ( v ) {
- var key;
- if ( v === '' || v === 0 || v === '0' || v === null
- || v === false || v === undefined )
- {
- return true;
- }
- // the for-loop could potentially contain prototypes
- // to avoid that we check it's length first
- if ( v.length === 0 ) {
- return true;
- }
- if ( typeof v === 'object' ) {
- for ( key in v ) {
- return false;
- }
- return true;
- }
- return false;
- },
- compareArray: function ( arrThis, arrAgainst ) {
- if ( arrThis.length !== arrAgainst.length ) {
- return false;
- }
- for ( var i = 0; i < arrThis.length; i++ ) {
- if ( $.isArray( arrThis[i] ) ) {
- if ( !$.compareArray( arrThis[i], arrAgainst[i] ) ) {
- return false;
- }
- } else if ( arrThis[i] !== arrAgainst[i] ) {
- return false;
- }
- }
- return true;
- },
- compareObject: function ( objectA, objectB ) {
- var prop, type;
-
- // Do a simple check if the types match
- if ( typeof objectA === typeof objectB ) {
-
- // Only loop over the contents if it really is an object
- if ( typeof objectA === 'object' ) {
- // If they are aliases of the same object (ie. mw and mediaWiki) return now
- if ( objectA === objectB ) {
- return true;
- } else {
- // Iterate over each property
- for ( prop in objectA ) {
- // Check if this property is also present in the other object
- if ( prop in objectB ) {
- // Compare the types of the properties
- type = typeof objectA[prop];
- if ( type === typeof objectB[prop] ) {
- // Recursively check objects inside this one
- switch ( type ) {
- case 'object' :
- if ( !$.compareObject( objectA[prop], objectB[prop] ) ) {
- return false;
- }
- break;
- case 'function' :
- // Functions need to be strings to compare them properly
- if ( objectA[prop].toString() !== objectB[prop].toString() ) {
- return false;
- }
- break;
- default:
- // Strings, numbers
- if ( objectA[prop] !== objectB[prop] ) {
- return false;
- }
- break;
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- // Check for properties in B but not in A
- // This is about 15% faster (tested in Safari 5 and Firefox 3.6)
- // ...than incrementing a count variable in the above and below loops
- // See also: http://www.mediawiki.org/wiki/ResourceLoader/Default_modules/compareObject_test#Results
- for ( prop in objectB ) {
- if ( !( prop in objectA ) ) {
- return false;
- }
- }
- }
- }
- } else {
- return false;
- }
- return true;
- }
- });
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.placeholder.js b/resources/jquery/jquery.placeholder.js
deleted file mode 100644
index 8044d880..00000000
--- a/resources/jquery/jquery.placeholder.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * HTML5 placeholder emulation for jQuery plugin
- *
- * This will automatically use the HTML5 placeholder attribute if supported, or emulate this behavior if not.
- *
- * @author Trevor Parscal <tparscal@wikimedia.org>, 2012
- * @author Krinkle <krinklemail@gmail.com>, 2012
- * @version 0.2.0
- * @license GPL v2
- */
-( function ( $ ) {
-
- $.fn.placeholder = function ( text ) {
- var hasArg = arguments.length;
-
- return this.each( function () {
- var placeholder, $input;
-
- if ( hasArg ) {
- this.setAttribute( 'placeholder', text );
- }
-
- // If the HTML5 placeholder attribute is supported, use it
- if ( this.placeholder && 'placeholder' in document.createElement( this.tagName ) ) {
- return;
- }
-
- placeholder = hasArg ? text : this.getAttribute( 'placeholder' );
- $input = $(this);
-
- // Show initially, if empty
- if ( this.value === '' || this.value === placeholder ) {
- $input.addClass( 'placeholder' ).val( placeholder );
- }
-
- $input
- // Show on blur if empty
- .blur( function () {
- if ( this.value === '' ) {
- this.value = placeholder;
- $input.addClass( 'placeholder' );
- }
- } )
-
- // Hide on focus
- // Also listen for other events in case $input was
- // already focused when the events were bound
- .on( 'focus drop keydown paste', function ( e ) {
- if ( $input.hasClass( 'placeholder' ) ) {
- if ( e.type === 'drop' && e.originalEvent.dataTransfer ) {
- // Support for drag&drop. Instead of inserting the dropped
- // text somewhere in the middle of the placeholder string,
- // we want to set the contents of the search box to the
- // dropped text.
-
- // IE wants getData( 'text' ) but Firefox wants getData( 'text/plain' )
- // Firefox fails gracefully with an empty string, IE barfs with an error
- try {
- // Try the Firefox way
- this.value = e.originalEvent.dataTransfer.getData( 'text/plain' );
- } catch ( exception ) {
- // Got an exception, so use the IE way
- this.value = e.originalEvent.dataTransfer.getData( 'text' );
- }
-
- // On Firefox, drop fires after the dropped text has been inserted,
- // but on IE it fires before. If we don't prevent the default action,
- // IE will insert the dropped text twice.
- e.preventDefault();
- } else {
- this.value = '';
- }
- $input.removeClass( 'placeholder' );
- }
- } );
-
- // Blank on submit -- prevents submitting with unintended value
- if ( this.form ) {
- $( this.form ).submit( function () {
- // $input.trigger( 'focus' ); would be problematic
- // because it actually focuses $input, leading
- // to nasty behavior in mobile browsers
- if ( $input.hasClass( 'placeholder' ) ) {
- $input
- .val( '' )
- .removeClass( 'placeholder' );
- }
- });
- }
-
- });
- };
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.qunit.completenessTest.js b/resources/jquery/jquery.qunit.completenessTest.js
deleted file mode 100644
index 20e6678e..00000000
--- a/resources/jquery/jquery.qunit.completenessTest.js
+++ /dev/null
@@ -1,360 +0,0 @@
-/**
- * jQuery QUnit CompletenessTest 0.4
- *
- * Tests the completeness of test suites for object oriented javascript
- * libraries. Written to be used in environments with jQuery and QUnit.
- * Requires jQuery 1.7.2 or higher.
- *
- * Built for and tested with:
- * - Chrome 19
- * - Firefox 4
- * - Safari 5
- *
- * @author Timo Tijhof, 2011-2012
- */
-( function ( $ ) {
- 'use strict';
-
- var util,
- hasOwn = Object.prototype.hasOwnProperty,
- log = (window.console && window.console.log)
- ? function () { return window.console.log.apply(window.console, arguments); }
- : function () {};
-
- // Simplified version of a few jQuery methods, except that they don't
- // call other jQuery methods. Required to be able to run the CompletenessTest
- // on jQuery itself as well.
- util = {
- keys: Object.keys || function ( object ) {
- var key, keys = [];
- for ( key in object ) {
- if ( hasOwn.call( object, key ) ) {
- keys.push( key );
- }
- }
- return keys;
- },
- extend: function () {
- var options, name, src, copy,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length;
-
- for ( ; i < length; i++ ) {
- options = arguments[ i ];
- // Only deal with non-null/undefined values
- if ( options !== null && options !== undefined ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
- },
- each: function ( object, callback ) {
- var name;
- for ( name in object ) {
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
- break;
- }
- }
- },
- // $.type and $.isEmptyObject are safe as is, they don't call
- // other $.* methods. Still need to be derefenced into `util`
- // since the CompletenessTest will overload them with spies.
- type: $.type,
- isEmptyObject: $.isEmptyObject
- };
-
-
- /**
- * CompletenessTest
- * @constructor
- *
- * @example
- * var myTester = new CompletenessTest( myLib );
- * @param masterVariable {Object} The root variable that contains all object
- * members. CompletenessTest will recursively traverse objects and keep track
- * of all methods.
- * @param ignoreFn {Function} Optionally pass a function to filter out certain
- * methods. Example: You may want to filter out instances of jQuery or some
- * other constructor. Otherwise "missingTests" will include all methods that
- * were not called from that instance.
- */
- function CompletenessTest( masterVariable, ignoreFn ) {
-
- // Keep track in these objects. Keyed by strings with the
- // method names (ie. 'my.foo', 'my.bar', etc.) values are boolean true.
- this.injectionTracker = {};
- this.methodCallTracker = {};
- this.missingTests = {};
-
- this.ignoreFn = undefined === ignoreFn ? function () { return false; } : ignoreFn;
-
- // Lazy limit in case something weird happends (like recurse (part of) ourself).
- this.lazyLimit = 2000;
- this.lazyCounter = 0;
-
- var that = this;
-
- // Bind begin and end to QUnit.
- QUnit.begin( function () {
- that.walkTheObject( null, masterVariable, masterVariable, [], CompletenessTest.ACTION_INJECT );
- log( 'CompletenessTest/walkTheObject/ACTION_INJECT', that );
- });
-
- QUnit.done( function () {
- that.populateMissingTests();
- log( 'CompletenessTest/populateMissingTests', that );
-
- var toolbar, testResults, cntTotal, cntCalled, cntMissing;
-
- cntTotal = util.keys( that.injectionTracker ).length;
- cntCalled = util.keys( that.methodCallTracker ).length;
- cntMissing = util.keys( that.missingTests ).length;
-
- function makeTestResults( blob, title, style ) {
- var elOutputWrapper, elTitle, elContainer, elList, elFoot;
-
- elTitle = document.createElement( 'strong' );
- elTitle.textContent = title || 'Values';
-
- elList = document.createElement( 'ul' );
- util.each( blob, function ( key ) {
- var elItem = document.createElement( 'li' );
- elItem.textContent = key;
- elList.appendChild( elItem );
- });
-
- elFoot = document.createElement( 'p' );
- elFoot.innerHTML = '<em>&mdash; CompletenessTest</em>';
-
- elContainer = document.createElement( 'div' );
- elContainer.appendChild( elTitle );
- elContainer.appendChild( elList );
- elContainer.appendChild( elFoot );
-
- elOutputWrapper = document.getElementById( 'qunit-completenesstest' );
- if ( !elOutputWrapper ) {
- elOutputWrapper = document.createElement( 'div' );
- elOutputWrapper.id = 'qunit-completenesstest';
- }
- elOutputWrapper.appendChild( elContainer );
-
- util.each( style, function ( key, value ) {
- elOutputWrapper.style[key] = value;
- });
- return elOutputWrapper;
- }
-
- if ( cntMissing === 0 ) {
- // Good
- testResults = makeTestResults(
- {},
- 'Detected calls to ' + cntCalled + '/' + cntTotal + ' methods. No missing tests!',
- {
- backgroundColor: '#D2E0E6',
- color: '#366097',
- paddingTop: '1em',
- paddingRight: '1em',
- paddingBottom: '1em',
- paddingLeft: '1em'
- }
- );
- } else {
- // Bad
- testResults = makeTestResults(
- that.missingTests,
- 'Detected calls to ' + cntCalled + '/' + cntTotal + ' methods. ' + cntMissing + ' methods not covered:',
- {
- backgroundColor: '#EE5757',
- color: 'black',
- paddingTop: '1em',
- paddingRight: '1em',
- paddingBottom: '1em',
- paddingLeft: '1em'
- }
- );
- }
-
- toolbar = document.getElementById( 'qunit-testrunner-toolbar' );
- if ( toolbar ) {
- toolbar.insertBefore( testResults, toolbar.firstChild );
- }
- });
-
- return this;
- }
-
- /* Static members */
- CompletenessTest.ACTION_INJECT = 500;
- CompletenessTest.ACTION_CHECK = 501;
-
- /* Public methods */
- CompletenessTest.fn = CompletenessTest.prototype = {
-
- /**
- * CompletenessTest.fn.walkTheObject
- *
- * This function recursively walks through the given object, calling itself as it goes.
- * Depending on the action it either injects our listener into the methods, or
- * reads from our tracker and records which methods have not been called by the test suite.
- *
- * @param currName {String|Null} Name of the given object member (Initially this is null).
- * @param currVar {mixed} The variable to check (initially an object,
- * further down it could be anything).
- * @param masterVariable {Object} Throughout our interation, always keep track of the master/root.
- * Initially this is the same as currVar.
- * @param parentPathArray {Array} Array of names that indicate our breadcrumb path starting at
- * masterVariable. Not including currName.
- * @param action {Number} What is this function supposed to do (ACTION_INJECT or ACTION_CHECK)
- */
- walkTheObject: function ( currName, currVar, masterVariable, parentPathArray, action ) {
-
- var key, value, tmpPathArray,
- type = util.type( currVar ),
- that = this;
-
- // Hard ignores
- if ( this.ignoreFn( currVar, that, parentPathArray ) ) {
- return null;
- }
-
- // Handle the lazy limit
- this.lazyCounter++;
- if ( this.lazyCounter > this.lazyLimit ) {
- log( 'CompletenessTest.fn.walkTheObject> Limit reached: ' + this.lazyCounter, parentPathArray );
- return null;
- }
-
- // Functions
- if ( type === 'function' ) {
-
- if ( !currVar.prototype || util.isEmptyObject( currVar.prototype ) ) {
-
- if ( action === CompletenessTest.ACTION_INJECT ) {
-
- that.injectionTracker[ parentPathArray.join( '.' ) ] = true;
- that.injectCheck( masterVariable, parentPathArray, function () {
- that.methodCallTracker[ parentPathArray.join( '.' ) ] = true;
- } );
- }
-
- // We don't support checking object constructors yet...
- // ...we can check the prototypes fine, though.
- } else {
- if ( action === CompletenessTest.ACTION_INJECT ) {
-
- for ( key in currVar.prototype ) {
- if ( hasOwn.call( currVar.prototype, key ) ) {
- value = currVar.prototype[key];
- if ( key === 'constructor' ) {
- continue;
- }
-
- // Clone and break reference to parentPathArray
- tmpPathArray = util.extend( [], parentPathArray );
- tmpPathArray.push( 'prototype' );
- tmpPathArray.push( key );
-
- that.walkTheObject( key, value, masterVariable, tmpPathArray, action );
- }
- }
-
- }
- }
-
- }
-
- // Recursively. After all, this is the *completeness* test
- if ( type === 'function' || type === 'object' ) {
- for ( key in currVar ) {
- if ( hasOwn.call( currVar, key ) ) {
- value = currVar[key];
-
- // Clone and break reference to parentPathArray
- tmpPathArray = util.extend( [], parentPathArray );
- tmpPathArray.push( key );
-
- that.walkTheObject( key, value, masterVariable, tmpPathArray, action );
- }
- }
- }
- },
-
- populateMissingTests: function () {
- var ct = this;
- util.each( ct.injectionTracker, function ( key ) {
- ct.hasTest( key );
- });
- },
-
- /**
- * CompletenessTest.fn.hasTest
- *
- * Checks if the given method name (ie. 'my.foo.bar')
- * was called during the test suite (as far as the tracker knows).
- * If not it adds it to missingTests.
- *
- * @param fnName {String}
- * @return {Boolean}
- */
- hasTest: function ( fnName ) {
- if ( !( fnName in this.methodCallTracker ) ) {
- this.missingTests[fnName] = true;
- return false;
- }
- return true;
- },
-
- /**
- * CompletenessTest.fn.injectCheck
- *
- * Injects a function (such as a spy that updates methodCallTracker when
- * it's called) inside another function.
- *
- * @param masterVariable {Object}
- * @param objectPathArray {Array}
- * @param injectFn {Function}
- */
- injectCheck: function ( masterVariable, objectPathArray, injectFn ) {
- var i, len, prev, memberName, lastMember,
- curr = masterVariable;
-
- // Get the object in question through the path from the master variable,
- // We can't pass the value directly because we need to re-define the object
- // member and keep references to the parent object, member name and member
- // value at all times.
- for ( i = 0, len = objectPathArray.length; i < len; i++ ) {
- memberName = objectPathArray[i];
-
- prev = curr;
- curr = prev[memberName];
- lastMember = memberName;
- }
-
- // Objects are by reference, members (unless objects) are not.
- prev[lastMember] = function () {
- injectFn();
- return curr.apply( this, arguments );
- };
- }
- };
-
- /* Expose */
- window.CompletenessTest = CompletenessTest;
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.qunit.css b/resources/jquery/jquery.qunit.css
deleted file mode 100644
index d7fc0c8e..00000000
--- a/resources/jquery/jquery.qunit.css
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- * QUnit v1.11.0 - A JavaScript Unit Testing Framework
- *
- * http://qunitjs.com
- *
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license.
- * http://jquery.org/license
- */
-
-/** Font Family and Sizes */
-
-#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
- font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
-}
-
-#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
-#qunit-tests { font-size: smaller; }
-
-
-/** Resets */
-
-#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
- margin: 0;
- padding: 0;
-}
-
-
-/** Header */
-
-#qunit-header {
- padding: 0.5em 0 0.5em 1em;
-
- color: #8699a4;
- background-color: #0d3349;
-
- font-size: 1.5em;
- line-height: 1em;
- font-weight: normal;
-
- border-radius: 5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0;
- -webkit-border-top-right-radius: 5px;
- -webkit-border-top-left-radius: 5px;
-}
-
-#qunit-header a {
- text-decoration: none;
- color: #c2ccd1;
-}
-
-#qunit-header a:hover,
-#qunit-header a:focus {
- color: #fff;
-}
-
-#qunit-testrunner-toolbar label {
- display: inline-block;
- padding: 0 .5em 0 .1em;
-}
-
-#qunit-banner {
- height: 5px;
-}
-
-#qunit-testrunner-toolbar {
- padding: 0.5em 0 0.5em 2em;
- color: #5E740B;
- background-color: #eee;
- overflow: hidden;
-}
-
-#qunit-userAgent {
- padding: 0.5em 0 0.5em 2.5em;
- background-color: #2b81af;
- color: #fff;
- text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
-}
-
-#qunit-modulefilter-container {
- float: right;
-}
-
-/** Tests: Pass/Fail */
-
-#qunit-tests {
- list-style-position: inside;
-}
-
-#qunit-tests li {
- padding: 0.4em 0.5em 0.4em 2.5em;
- border-bottom: 1px solid #fff;
- list-style-position: inside;
-}
-
-#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
- display: none;
-}
-
-#qunit-tests li strong {
- cursor: pointer;
-}
-
-#qunit-tests li a {
- padding: 0.5em;
- color: #c2ccd1;
- text-decoration: none;
-}
-#qunit-tests li a:hover,
-#qunit-tests li a:focus {
- color: #000;
-}
-
-#qunit-tests li .runtime {
- float: right;
- font-size: smaller;
-}
-
-.qunit-assert-list {
- margin-top: 0.5em;
- padding: 0.5em;
-
- background-color: #fff;
-
- border-radius: 5px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
-}
-
-.qunit-collapsed {
- display: none;
-}
-
-#qunit-tests table {
- border-collapse: collapse;
- margin-top: .2em;
-}
-
-#qunit-tests th {
- text-align: right;
- vertical-align: top;
- padding: 0 .5em 0 0;
-}
-
-#qunit-tests td {
- vertical-align: top;
-}
-
-#qunit-tests pre {
- margin: 0;
- white-space: pre-wrap;
- word-wrap: break-word;
-}
-
-#qunit-tests del {
- background-color: #e0f2be;
- color: #374e0c;
- text-decoration: none;
-}
-
-#qunit-tests ins {
- background-color: #ffcaca;
- color: #500;
- text-decoration: none;
-}
-
-/*** Test Counts */
-
-#qunit-tests b.counts { color: black; }
-#qunit-tests b.passed { color: #5E740B; }
-#qunit-tests b.failed { color: #710909; }
-
-#qunit-tests li li {
- padding: 5px;
- background-color: #fff;
- border-bottom: none;
- list-style-position: inside;
-}
-
-/*** Passing Styles */
-
-#qunit-tests li li.pass {
- color: #3c510c;
- background-color: #fff;
- border-left: 10px solid #C6E746;
-}
-
-#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
-#qunit-tests .pass .test-name { color: #366097; }
-
-#qunit-tests .pass .test-actual,
-#qunit-tests .pass .test-expected { color: #999999; }
-
-#qunit-banner.qunit-pass { background-color: #C6E746; }
-
-/*** Failing Styles */
-
-#qunit-tests li li.fail {
- color: #710909;
- background-color: #fff;
- border-left: 10px solid #EE5757;
- white-space: pre;
-}
-
-#qunit-tests > li:last-child {
- border-radius: 0 0 5px 5px;
- -moz-border-radius: 0 0 5px 5px;
- -webkit-border-bottom-right-radius: 5px;
- -webkit-border-bottom-left-radius: 5px;
-}
-
-#qunit-tests .fail { color: #000000; background-color: #EE5757; }
-#qunit-tests .fail .test-name,
-#qunit-tests .fail .module-name { color: #000000; }
-
-#qunit-tests .fail .test-actual { color: #EE5757; }
-#qunit-tests .fail .test-expected { color: green; }
-
-#qunit-banner.qunit-fail { background-color: #EE5757; }
-
-
-/** Result */
-
-#qunit-testresult {
- padding: 0.5em 0.5em 0.5em 2.5em;
-
- color: #2b81af;
- background-color: #D2E0E6;
-
- border-bottom: 1px solid white;
-}
-#qunit-testresult .module-name {
- font-weight: bold;
-}
-
-/** Fixture */
-
-#qunit-fixture {
- position: absolute;
- top: -10000px;
- left: -10000px;
- width: 1000px;
- height: 1000px;
-}
diff --git a/resources/jquery/jquery.qunit.js b/resources/jquery/jquery.qunit.js
deleted file mode 100644
index 302545f4..00000000
--- a/resources/jquery/jquery.qunit.js
+++ /dev/null
@@ -1,2152 +0,0 @@
-/**
- * QUnit v1.11.0 - A JavaScript Unit Testing Framework
- *
- * http://qunitjs.com
- *
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license.
- * http://jquery.org/license
- */
-
-(function( window ) {
-
-var QUnit,
- assert,
- config,
- onErrorFnPrev,
- testId = 0,
- fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- // Keep a local reference to Date (GH-283)
- Date = window.Date,
- defined = {
- setTimeout: typeof window.setTimeout !== "undefined",
- sessionStorage: (function() {
- var x = "qunit-test-string";
- try {
- sessionStorage.setItem( x, x );
- sessionStorage.removeItem( x );
- return true;
- } catch( e ) {
- return false;
- }
- }())
- },
- /**
- * Provides a normalized error string, correcting an issue
- * with IE 7 (and prior) where Error.prototype.toString is
- * not properly implemented
- *
- * Based on http://es5.github.com/#x15.11.4.4
- *
- * @param {String|Error} error
- * @return {String} error message
- */
- errorString = function( error ) {
- var name, message,
- errorString = error.toString();
- if ( errorString.substring( 0, 7 ) === "[object" ) {
- name = error.name ? error.name.toString() : "Error";
- message = error.message ? error.message.toString() : "";
- if ( name && message ) {
- return name + ": " + message;
- } else if ( name ) {
- return name;
- } else if ( message ) {
- return message;
- } else {
- return "Error";
- }
- } else {
- return errorString;
- }
- },
- /**
- * Makes a clone of an object using only Array or Object as base,
- * and copies over the own enumerable properties.
- *
- * @param {Object} obj
- * @return {Object} New object with only the own properties (recursively).
- */
- objectValues = function( obj ) {
- // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392.
- /*jshint newcap: false */
- var key, val,
- vals = QUnit.is( "array", obj ) ? [] : {};
- for ( key in obj ) {
- if ( hasOwn.call( obj, key ) ) {
- val = obj[key];
- vals[key] = val === Object(val) ? objectValues(val) : val;
- }
- }
- return vals;
- };
-
-function Test( settings ) {
- extend( this, settings );
- this.assertions = [];
- this.testNumber = ++Test.count;
-}
-
-Test.count = 0;
-
-Test.prototype = {
- init: function() {
- var a, b, li,
- tests = id( "qunit-tests" );
-
- if ( tests ) {
- b = document.createElement( "strong" );
- b.innerHTML = this.nameHtml;
-
- // `a` initialized at top of scope
- a = document.createElement( "a" );
- a.innerHTML = "Rerun";
- a.href = QUnit.url({ testNumber: this.testNumber });
-
- li = document.createElement( "li" );
- li.appendChild( b );
- li.appendChild( a );
- li.className = "running";
- li.id = this.id = "qunit-test-output" + testId++;
-
- tests.appendChild( li );
- }
- },
- setup: function() {
- if ( this.module !== config.previousModule ) {
- if ( config.previousModule ) {
- runLoggingCallbacks( "moduleDone", QUnit, {
- name: config.previousModule,
- failed: config.moduleStats.bad,
- passed: config.moduleStats.all - config.moduleStats.bad,
- total: config.moduleStats.all
- });
- }
- config.previousModule = this.module;
- config.moduleStats = { all: 0, bad: 0 };
- runLoggingCallbacks( "moduleStart", QUnit, {
- name: this.module
- });
- } else if ( config.autorun ) {
- runLoggingCallbacks( "moduleStart", QUnit, {
- name: this.module
- });
- }
-
- config.current = this;
-
- this.testEnvironment = extend({
- setup: function() {},
- teardown: function() {}
- }, this.moduleTestEnvironment );
-
- this.started = +new Date();
- runLoggingCallbacks( "testStart", QUnit, {
- name: this.testName,
- module: this.module
- });
-
- // allow utility functions to access the current test environment
- // TODO why??
- QUnit.current_testEnvironment = this.testEnvironment;
-
- if ( !config.pollution ) {
- saveGlobal();
- }
- if ( config.notrycatch ) {
- this.testEnvironment.setup.call( this.testEnvironment );
- return;
- }
- try {
- this.testEnvironment.setup.call( this.testEnvironment );
- } catch( e ) {
- QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
- }
- },
- run: function() {
- config.current = this;
-
- var running = id( "qunit-testresult" );
-
- if ( running ) {
- running.innerHTML = "Running: <br/>" + this.nameHtml;
- }
-
- if ( this.async ) {
- QUnit.stop();
- }
-
- this.callbackStarted = +new Date();
-
- if ( config.notrycatch ) {
- this.callback.call( this.testEnvironment, QUnit.assert );
- this.callbackRuntime = +new Date() - this.callbackStarted;
- return;
- }
-
- try {
- this.callback.call( this.testEnvironment, QUnit.assert );
- this.callbackRuntime = +new Date() - this.callbackStarted;
- } catch( e ) {
- this.callbackRuntime = +new Date() - this.callbackStarted;
-
- QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) );
- // else next test will carry the responsibility
- saveGlobal();
-
- // Restart the tests if they're blocking
- if ( config.blocking ) {
- QUnit.start();
- }
- }
- },
- teardown: function() {
- config.current = this;
- if ( config.notrycatch ) {
- if ( typeof this.callbackRuntime === "undefined" ) {
- this.callbackRuntime = +new Date() - this.callbackStarted;
- }
- this.testEnvironment.teardown.call( this.testEnvironment );
- return;
- } else {
- try {
- this.testEnvironment.teardown.call( this.testEnvironment );
- } catch( e ) {
- QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
- }
- }
- checkPollution();
- },
- finish: function() {
- config.current = this;
- if ( config.requireExpects && this.expected === null ) {
- QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
- } else if ( this.expected !== null && this.expected !== this.assertions.length ) {
- QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack );
- } else if ( this.expected === null && !this.assertions.length ) {
- QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack );
- }
-
- var i, assertion, a, b, time, li, ol,
- test = this,
- good = 0,
- bad = 0,
- tests = id( "qunit-tests" );
-
- this.runtime = +new Date() - this.started;
- config.stats.all += this.assertions.length;
- config.moduleStats.all += this.assertions.length;
-
- if ( tests ) {
- ol = document.createElement( "ol" );
- ol.className = "qunit-assert-list";
-
- for ( i = 0; i < this.assertions.length; i++ ) {
- assertion = this.assertions[i];
-
- li = document.createElement( "li" );
- li.className = assertion.result ? "pass" : "fail";
- li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" );
- ol.appendChild( li );
-
- if ( assertion.result ) {
- good++;
- } else {
- bad++;
- config.stats.bad++;
- config.moduleStats.bad++;
- }
- }
-
- // store result when possible
- if ( QUnit.config.reorder && defined.sessionStorage ) {
- if ( bad ) {
- sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad );
- } else {
- sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName );
- }
- }
-
- if ( bad === 0 ) {
- addClass( ol, "qunit-collapsed" );
- }
-
- // `b` initialized at top of scope
- b = document.createElement( "strong" );
- b.innerHTML = this.nameHtml + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
-
- addEvent(b, "click", function() {
- var next = b.parentNode.lastChild,
- collapsed = hasClass( next, "qunit-collapsed" );
- ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" );
- });
-
- addEvent(b, "dblclick", function( e ) {
- var target = e && e.target ? e.target : window.event.srcElement;
- if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) {
- target = target.parentNode;
- }
- if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
- window.location = QUnit.url({ testNumber: test.testNumber });
- }
- });
-
- // `time` initialized at top of scope
- time = document.createElement( "span" );
- time.className = "runtime";
- time.innerHTML = this.runtime + " ms";
-
- // `li` initialized at top of scope
- li = id( this.id );
- li.className = bad ? "fail" : "pass";
- li.removeChild( li.firstChild );
- a = li.firstChild;
- li.appendChild( b );
- li.appendChild( a );
- li.appendChild( time );
- li.appendChild( ol );
-
- } else {
- for ( i = 0; i < this.assertions.length; i++ ) {
- if ( !this.assertions[i].result ) {
- bad++;
- config.stats.bad++;
- config.moduleStats.bad++;
- }
- }
- }
-
- runLoggingCallbacks( "testDone", QUnit, {
- name: this.testName,
- module: this.module,
- failed: bad,
- passed: this.assertions.length - bad,
- total: this.assertions.length,
- duration: this.runtime
- });
-
- QUnit.reset();
-
- config.current = undefined;
- },
-
- queue: function() {
- var bad,
- test = this;
-
- synchronize(function() {
- test.init();
- });
- function run() {
- // each of these can by async
- synchronize(function() {
- test.setup();
- });
- synchronize(function() {
- test.run();
- });
- synchronize(function() {
- test.teardown();
- });
- synchronize(function() {
- test.finish();
- });
- }
-
- // `bad` initialized at top of scope
- // defer when previous test run passed, if storage is available
- bad = QUnit.config.reorder && defined.sessionStorage &&
- +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName );
-
- if ( bad ) {
- run();
- } else {
- synchronize( run, true );
- }
- }
-};
-
-// Root QUnit object.
-// `QUnit` initialized at top of scope
-QUnit = {
-
- // call on start of module test to prepend name to all tests
- module: function( name, testEnvironment ) {
- config.currentModule = name;
- config.currentModuleTestEnvironment = testEnvironment;
- config.modules[name] = true;
- },
-
- asyncTest: function( testName, expected, callback ) {
- if ( arguments.length === 2 ) {
- callback = expected;
- expected = null;
- }
-
- QUnit.test( testName, expected, callback, true );
- },
-
- test: function( testName, expected, callback, async ) {
- var test,
- nameHtml = "<span class='test-name'>" + escapeText( testName ) + "</span>";
-
- if ( arguments.length === 2 ) {
- callback = expected;
- expected = null;
- }
-
- if ( config.currentModule ) {
- nameHtml = "<span class='module-name'>" + escapeText( config.currentModule ) + "</span>: " + nameHtml;
- }
-
- test = new Test({
- nameHtml: nameHtml,
- testName: testName,
- expected: expected,
- async: async,
- callback: callback,
- module: config.currentModule,
- moduleTestEnvironment: config.currentModuleTestEnvironment,
- stack: sourceFromStacktrace( 2 )
- });
-
- if ( !validTest( test ) ) {
- return;
- }
-
- test.queue();
- },
-
- // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
- expect: function( asserts ) {
- if (arguments.length === 1) {
- config.current.expected = asserts;
- } else {
- return config.current.expected;
- }
- },
-
- start: function( count ) {
- // QUnit hasn't been initialized yet.
- // Note: RequireJS (et al) may delay onLoad
- if ( config.semaphore === undefined ) {
- QUnit.begin(function() {
- // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first
- setTimeout(function() {
- QUnit.start( count );
- });
- });
- return;
- }
-
- config.semaphore -= count || 1;
- // don't start until equal number of stop-calls
- if ( config.semaphore > 0 ) {
- return;
- }
- // ignore if start is called more often then stop
- if ( config.semaphore < 0 ) {
- config.semaphore = 0;
- QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) );
- return;
- }
- // A slight delay, to avoid any current callbacks
- if ( defined.setTimeout ) {
- window.setTimeout(function() {
- if ( config.semaphore > 0 ) {
- return;
- }
- if ( config.timeout ) {
- clearTimeout( config.timeout );
- }
-
- config.blocking = false;
- process( true );
- }, 13);
- } else {
- config.blocking = false;
- process( true );
- }
- },
-
- stop: function( count ) {
- config.semaphore += count || 1;
- config.blocking = true;
-
- if ( config.testTimeout && defined.setTimeout ) {
- clearTimeout( config.timeout );
- config.timeout = window.setTimeout(function() {
- QUnit.ok( false, "Test timed out" );
- config.semaphore = 1;
- QUnit.start();
- }, config.testTimeout );
- }
- }
-};
-
-// `assert` initialized at top of scope
-// Asssert helpers
-// All of these must either call QUnit.push() or manually do:
-// - runLoggingCallbacks( "log", .. );
-// - config.current.assertions.push({ .. });
-// We attach it to the QUnit object *after* we expose the public API,
-// otherwise `assert` will become a global variable in browsers (#341).
-assert = {
- /**
- * Asserts rough true-ish result.
- * @name ok
- * @function
- * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
- */
- ok: function( result, msg ) {
- if ( !config.current ) {
- throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
- }
- result = !!result;
-
- var source,
- details = {
- module: config.current.module,
- name: config.current.testName,
- result: result,
- message: msg
- };
-
- msg = escapeText( msg || (result ? "okay" : "failed" ) );
- msg = "<span class='test-message'>" + msg + "</span>";
-
- if ( !result ) {
- source = sourceFromStacktrace( 2 );
- if ( source ) {
- details.source = source;
- msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr></table>";
- }
- }
- runLoggingCallbacks( "log", QUnit, details );
- config.current.assertions.push({
- result: result,
- message: msg
- });
- },
-
- /**
- * Assert that the first two arguments are equal, with an optional message.
- * Prints out both actual and expected values.
- * @name equal
- * @function
- * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
- */
- equal: function( actual, expected, message ) {
- /*jshint eqeqeq:false */
- QUnit.push( expected == actual, actual, expected, message );
- },
-
- /**
- * @name notEqual
- * @function
- */
- notEqual: function( actual, expected, message ) {
- /*jshint eqeqeq:false */
- QUnit.push( expected != actual, actual, expected, message );
- },
-
- /**
- * @name propEqual
- * @function
- */
- propEqual: function( actual, expected, message ) {
- actual = objectValues(actual);
- expected = objectValues(expected);
- QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
- },
-
- /**
- * @name notPropEqual
- * @function
- */
- notPropEqual: function( actual, expected, message ) {
- actual = objectValues(actual);
- expected = objectValues(expected);
- QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
- },
-
- /**
- * @name deepEqual
- * @function
- */
- deepEqual: function( actual, expected, message ) {
- QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
- },
-
- /**
- * @name notDeepEqual
- * @function
- */
- notDeepEqual: function( actual, expected, message ) {
- QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
- },
-
- /**
- * @name strictEqual
- * @function
- */
- strictEqual: function( actual, expected, message ) {
- QUnit.push( expected === actual, actual, expected, message );
- },
-
- /**
- * @name notStrictEqual
- * @function
- */
- notStrictEqual: function( actual, expected, message ) {
- QUnit.push( expected !== actual, actual, expected, message );
- },
-
- "throws": function( block, expected, message ) {
- var actual,
- expectedOutput = expected,
- ok = false;
-
- // 'expected' is optional
- if ( typeof expected === "string" ) {
- message = expected;
- expected = null;
- }
-
- config.current.ignoreGlobalErrors = true;
- try {
- block.call( config.current.testEnvironment );
- } catch (e) {
- actual = e;
- }
- config.current.ignoreGlobalErrors = false;
-
- if ( actual ) {
- // we don't want to validate thrown error
- if ( !expected ) {
- ok = true;
- expectedOutput = null;
- // expected is a regexp
- } else if ( QUnit.objectType( expected ) === "regexp" ) {
- ok = expected.test( errorString( actual ) );
- // expected is a constructor
- } else if ( actual instanceof expected ) {
- ok = true;
- // expected is a validation function which returns true is validation passed
- } else if ( expected.call( {}, actual ) === true ) {
- expectedOutput = null;
- ok = true;
- }
-
- QUnit.push( ok, actual, expectedOutput, message );
- } else {
- QUnit.pushFailure( message, null, 'No exception was thrown.' );
- }
- }
-};
-
-/**
- * @deprecate since 1.8.0
- * Kept assertion helpers in root for backwards compatibility.
- */
-extend( QUnit, assert );
-
-/**
- * @deprecated since 1.9.0
- * Kept root "raises()" for backwards compatibility.
- * (Note that we don't introduce assert.raises).
- */
-QUnit.raises = assert[ "throws" ];
-
-/**
- * @deprecated since 1.0.0, replaced with error pushes since 1.3.0
- * Kept to avoid TypeErrors for undefined methods.
- */
-QUnit.equals = function() {
- QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
-};
-QUnit.same = function() {
- QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
-};
-
-// We want access to the constructor's prototype
-(function() {
- function F() {}
- F.prototype = QUnit;
- QUnit = new F();
- // Make F QUnit's constructor so that we can add to the prototype later
- QUnit.constructor = F;
-}());
-
-/**
- * Config object: Maintain internal state
- * Later exposed as QUnit.config
- * `config` initialized at top of scope
- */
-config = {
- // The queue of tests to run
- queue: [],
-
- // block until document ready
- blocking: true,
-
- // when enabled, show only failing tests
- // gets persisted through sessionStorage and can be changed in UI via checkbox
- hidepassed: false,
-
- // by default, run previously failed tests first
- // very useful in combination with "Hide passed tests" checked
- reorder: true,
-
- // by default, modify document.title when suite is done
- altertitle: true,
-
- // when enabled, all tests must call expect()
- requireExpects: false,
-
- // add checkboxes that are persisted in the query-string
- // when enabled, the id is set to `true` as a `QUnit.config` property
- urlConfig: [
- {
- id: "noglobals",
- label: "Check for Globals",
- tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
- },
- {
- id: "notrycatch",
- label: "No try-catch",
- tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
- }
- ],
-
- // Set of all modules.
- modules: {},
-
- // logging callback queues
- begin: [],
- done: [],
- log: [],
- testStart: [],
- testDone: [],
- moduleStart: [],
- moduleDone: []
-};
-
-// Export global variables, unless an 'exports' object exists,
-// in that case we assume we're in CommonJS (dealt with on the bottom of the script)
-if ( typeof exports === "undefined" ) {
- extend( window, QUnit );
-
- // Expose QUnit object
- window.QUnit = QUnit;
-}
-
-// Initialize more QUnit.config and QUnit.urlParams
-(function() {
- var i,
- location = window.location || { search: "", protocol: "file:" },
- params = location.search.slice( 1 ).split( "&" ),
- length = params.length,
- urlParams = {},
- current;
-
- if ( params[ 0 ] ) {
- for ( i = 0; i < length; i++ ) {
- current = params[ i ].split( "=" );
- current[ 0 ] = decodeURIComponent( current[ 0 ] );
- // allow just a key to turn on a flag, e.g., test.html?noglobals
- current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
- urlParams[ current[ 0 ] ] = current[ 1 ];
- }
- }
-
- QUnit.urlParams = urlParams;
-
- // String search anywhere in moduleName+testName
- config.filter = urlParams.filter;
-
- // Exact match of the module name
- config.module = urlParams.module;
-
- config.testNumber = parseInt( urlParams.testNumber, 10 ) || null;
-
- // Figure out if we're running the tests from a server or not
- QUnit.isLocal = location.protocol === "file:";
-}());
-
-// Extend QUnit object,
-// these after set here because they should not be exposed as global functions
-extend( QUnit, {
- assert: assert,
-
- config: config,
-
- // Initialize the configuration options
- init: function() {
- extend( config, {
- stats: { all: 0, bad: 0 },
- moduleStats: { all: 0, bad: 0 },
- started: +new Date(),
- updateRate: 1000,
- blocking: false,
- autostart: true,
- autorun: false,
- filter: "",
- queue: [],
- semaphore: 1
- });
-
- var tests, banner, result,
- qunit = id( "qunit" );
-
- if ( qunit ) {
- qunit.innerHTML =
- "<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
- "<h2 id='qunit-banner'></h2>" +
- "<div id='qunit-testrunner-toolbar'></div>" +
- "<h2 id='qunit-userAgent'></h2>" +
- "<ol id='qunit-tests'></ol>";
- }
-
- tests = id( "qunit-tests" );
- banner = id( "qunit-banner" );
- result = id( "qunit-testresult" );
-
- if ( tests ) {
- tests.innerHTML = "";
- }
-
- if ( banner ) {
- banner.className = "";
- }
-
- if ( result ) {
- result.parentNode.removeChild( result );
- }
-
- if ( tests ) {
- result = document.createElement( "p" );
- result.id = "qunit-testresult";
- result.className = "result";
- tests.parentNode.insertBefore( result, tests );
- result.innerHTML = "Running...<br/>&nbsp;";
- }
- },
-
- // Resets the test setup. Useful for tests that modify the DOM.
- reset: function() {
- var fixture = id( "qunit-fixture" );
- if ( fixture ) {
- fixture.innerHTML = config.fixture;
- }
- },
-
- // Trigger an event on an element.
- // @example triggerEvent( document.body, "click" );
- triggerEvent: function( elem, type, event ) {
- if ( document.createEvent ) {
- event = document.createEvent( "MouseEvents" );
- event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
- 0, 0, 0, 0, 0, false, false, false, false, 0, null);
-
- elem.dispatchEvent( event );
- } else if ( elem.fireEvent ) {
- elem.fireEvent( "on" + type );
- }
- },
-
- // Safe object type checking
- is: function( type, obj ) {
- return QUnit.objectType( obj ) === type;
- },
-
- objectType: function( obj ) {
- if ( typeof obj === "undefined" ) {
- return "undefined";
- // consider: typeof null === object
- }
- if ( obj === null ) {
- return "null";
- }
-
- var match = toString.call( obj ).match(/^\[object\s(.*)\]$/),
- type = match && match[1] || "";
-
- switch ( type ) {
- case "Number":
- if ( isNaN(obj) ) {
- return "nan";
- }
- return "number";
- case "String":
- case "Boolean":
- case "Array":
- case "Date":
- case "RegExp":
- case "Function":
- return type.toLowerCase();
- }
- if ( typeof obj === "object" ) {
- return "object";
- }
- return undefined;
- },
-
- push: function( result, actual, expected, message ) {
- if ( !config.current ) {
- throw new Error( "assertion outside test context, was " + sourceFromStacktrace() );
- }
-
- var output, source,
- details = {
- module: config.current.module,
- name: config.current.testName,
- result: result,
- message: message,
- actual: actual,
- expected: expected
- };
-
- message = escapeText( message ) || ( result ? "okay" : "failed" );
- message = "<span class='test-message'>" + message + "</span>";
- output = message;
-
- if ( !result ) {
- expected = escapeText( QUnit.jsDump.parse(expected) );
- actual = escapeText( QUnit.jsDump.parse(actual) );
- output += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" + expected + "</pre></td></tr>";
-
- if ( actual !== expected ) {
- output += "<tr class='test-actual'><th>Result: </th><td><pre>" + actual + "</pre></td></tr>";
- output += "<tr class='test-diff'><th>Diff: </th><td><pre>" + QUnit.diff( expected, actual ) + "</pre></td></tr>";
- }
-
- source = sourceFromStacktrace();
-
- if ( source ) {
- details.source = source;
- output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>";
- }
-
- output += "</table>";
- }
-
- runLoggingCallbacks( "log", QUnit, details );
-
- config.current.assertions.push({
- result: !!result,
- message: output
- });
- },
-
- pushFailure: function( message, source, actual ) {
- if ( !config.current ) {
- throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
- }
-
- var output,
- details = {
- module: config.current.module,
- name: config.current.testName,
- result: false,
- message: message
- };
-
- message = escapeText( message ) || "error";
- message = "<span class='test-message'>" + message + "</span>";
- output = message;
-
- output += "<table>";
-
- if ( actual ) {
- output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeText( actual ) + "</pre></td></tr>";
- }
-
- if ( source ) {
- details.source = source;
- output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>";
- }
-
- output += "</table>";
-
- runLoggingCallbacks( "log", QUnit, details );
-
- config.current.assertions.push({
- result: false,
- message: output
- });
- },
-
- url: function( params ) {
- params = extend( extend( {}, QUnit.urlParams ), params );
- var key,
- querystring = "?";
-
- for ( key in params ) {
- if ( !hasOwn.call( params, key ) ) {
- continue;
- }
- querystring += encodeURIComponent( key ) + "=" +
- encodeURIComponent( params[ key ] ) + "&";
- }
- return window.location.protocol + "//" + window.location.host +
- window.location.pathname + querystring.slice( 0, -1 );
- },
-
- extend: extend,
- id: id,
- addEvent: addEvent
- // load, equiv, jsDump, diff: Attached later
-});
-
-/**
- * @deprecated: Created for backwards compatibility with test runner that set the hook function
- * into QUnit.{hook}, instead of invoking it and passing the hook function.
- * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.
- * Doing this allows us to tell if the following methods have been overwritten on the actual
- * QUnit object.
- */
-extend( QUnit.constructor.prototype, {
-
- // Logging callbacks; all receive a single argument with the listed properties
- // run test/logs.html for any related changes
- begin: registerLoggingCallback( "begin" ),
-
- // done: { failed, passed, total, runtime }
- done: registerLoggingCallback( "done" ),
-
- // log: { result, actual, expected, message }
- log: registerLoggingCallback( "log" ),
-
- // testStart: { name }
- testStart: registerLoggingCallback( "testStart" ),
-
- // testDone: { name, failed, passed, total, duration }
- testDone: registerLoggingCallback( "testDone" ),
-
- // moduleStart: { name }
- moduleStart: registerLoggingCallback( "moduleStart" ),
-
- // moduleDone: { name, failed, passed, total }
- moduleDone: registerLoggingCallback( "moduleDone" )
-});
-
-if ( typeof document === "undefined" || document.readyState === "complete" ) {
- config.autorun = true;
-}
-
-QUnit.load = function() {
- runLoggingCallbacks( "begin", QUnit, {} );
-
- // Initialize the config, saving the execution queue
- var banner, filter, i, label, len, main, ol, toolbar, userAgent, val,
- urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter,
- numModules = 0,
- moduleFilterHtml = "",
- urlConfigHtml = "",
- oldconfig = extend( {}, config );
-
- QUnit.init();
- extend(config, oldconfig);
-
- config.blocking = false;
-
- len = config.urlConfig.length;
-
- for ( i = 0; i < len; i++ ) {
- val = config.urlConfig[i];
- if ( typeof val === "string" ) {
- val = {
- id: val,
- label: val,
- tooltip: "[no tooltip available]"
- };
- }
- config[ val.id ] = QUnit.urlParams[ val.id ];
- urlConfigHtml += "<input id='qunit-urlconfig-" + escapeText( val.id ) +
- "' name='" + escapeText( val.id ) +
- "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) +
- " title='" + escapeText( val.tooltip ) +
- "'><label for='qunit-urlconfig-" + escapeText( val.id ) +
- "' title='" + escapeText( val.tooltip ) + "'>" + val.label + "</label>";
- }
-
- moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " +
- ( config.module === undefined ? "selected='selected'" : "" ) +
- ">< All Modules ></option>";
-
- for ( i in config.modules ) {
- if ( config.modules.hasOwnProperty( i ) ) {
- numModules += 1;
- moduleFilterHtml += "<option value='" + escapeText( encodeURIComponent(i) ) + "' " +
- ( config.module === i ? "selected='selected'" : "" ) +
- ">" + escapeText(i) + "</option>";
- }
- }
- moduleFilterHtml += "</select>";
-
- // `userAgent` initialized at top of scope
- userAgent = id( "qunit-userAgent" );
- if ( userAgent ) {
- userAgent.innerHTML = navigator.userAgent;
- }
-
- // `banner` initialized at top of scope
- banner = id( "qunit-header" );
- if ( banner ) {
- banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> ";
- }
-
- // `toolbar` initialized at top of scope
- toolbar = id( "qunit-testrunner-toolbar" );
- if ( toolbar ) {
- // `filter` initialized at top of scope
- filter = document.createElement( "input" );
- filter.type = "checkbox";
- filter.id = "qunit-filter-pass";
-
- addEvent( filter, "click", function() {
- var tmp,
- ol = document.getElementById( "qunit-tests" );
-
- if ( filter.checked ) {
- ol.className = ol.className + " hidepass";
- } else {
- tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " ";
- ol.className = tmp.replace( / hidepass /, " " );
- }
- if ( defined.sessionStorage ) {
- if (filter.checked) {
- sessionStorage.setItem( "qunit-filter-passed-tests", "true" );
- } else {
- sessionStorage.removeItem( "qunit-filter-passed-tests" );
- }
- }
- });
-
- if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) {
- filter.checked = true;
- // `ol` initialized at top of scope
- ol = document.getElementById( "qunit-tests" );
- ol.className = ol.className + " hidepass";
- }
- toolbar.appendChild( filter );
-
- // `label` initialized at top of scope
- label = document.createElement( "label" );
- label.setAttribute( "for", "qunit-filter-pass" );
- label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." );
- label.innerHTML = "Hide passed tests";
- toolbar.appendChild( label );
-
- urlConfigCheckboxesContainer = document.createElement("span");
- urlConfigCheckboxesContainer.innerHTML = urlConfigHtml;
- urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input");
- // For oldIE support:
- // * Add handlers to the individual elements instead of the container
- // * Use "click" instead of "change"
- // * Fallback from event.target to event.srcElement
- addEvents( urlConfigCheckboxes, "click", function( event ) {
- var params = {},
- target = event.target || event.srcElement;
- params[ target.name ] = target.checked ? true : undefined;
- window.location = QUnit.url( params );
- });
- toolbar.appendChild( urlConfigCheckboxesContainer );
-
- if (numModules > 1) {
- moduleFilter = document.createElement( 'span' );
- moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' );
- moduleFilter.innerHTML = moduleFilterHtml;
- addEvent( moduleFilter.lastChild, "change", function() {
- var selectBox = moduleFilter.getElementsByTagName("select")[0],
- selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value);
-
- window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } );
- });
- toolbar.appendChild(moduleFilter);
- }
- }
-
- // `main` initialized at top of scope
- main = id( "qunit-fixture" );
- if ( main ) {
- config.fixture = main.innerHTML;
- }
-
- if ( config.autostart ) {
- QUnit.start();
- }
-};
-
-addEvent( window, "load", QUnit.load );
-
-// `onErrorFnPrev` initialized at top of scope
-// Preserve other handlers
-onErrorFnPrev = window.onerror;
-
-// Cover uncaught exceptions
-// Returning true will surpress the default browser handler,
-// returning false will let it run.
-window.onerror = function ( error, filePath, linerNr ) {
- var ret = false;
- if ( onErrorFnPrev ) {
- ret = onErrorFnPrev( error, filePath, linerNr );
- }
-
- // Treat return value as window.onerror itself does,
- // Only do our handling if not surpressed.
- if ( ret !== true ) {
- if ( QUnit.config.current ) {
- if ( QUnit.config.current.ignoreGlobalErrors ) {
- return true;
- }
- QUnit.pushFailure( error, filePath + ":" + linerNr );
- } else {
- QUnit.test( "global failure", extend( function() {
- QUnit.pushFailure( error, filePath + ":" + linerNr );
- }, { validTest: validTest } ) );
- }
- return false;
- }
-
- return ret;
-};
-
-function done() {
- config.autorun = true;
-
- // Log the last module results
- if ( config.currentModule ) {
- runLoggingCallbacks( "moduleDone", QUnit, {
- name: config.currentModule,
- failed: config.moduleStats.bad,
- passed: config.moduleStats.all - config.moduleStats.bad,
- total: config.moduleStats.all
- });
- }
-
- var i, key,
- banner = id( "qunit-banner" ),
- tests = id( "qunit-tests" ),
- runtime = +new Date() - config.started,
- passed = config.stats.all - config.stats.bad,
- html = [
- "Tests completed in ",
- runtime,
- " milliseconds.<br/>",
- "<span class='passed'>",
- passed,
- "</span> assertions of <span class='total'>",
- config.stats.all,
- "</span> passed, <span class='failed'>",
- config.stats.bad,
- "</span> failed."
- ].join( "" );
-
- if ( banner ) {
- banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" );
- }
-
- if ( tests ) {
- id( "qunit-testresult" ).innerHTML = html;
- }
-
- if ( config.altertitle && typeof document !== "undefined" && document.title ) {
- // show ✖ for good, ✔ for bad suite result in title
- // use escape sequences in case file gets loaded with non-utf-8-charset
- document.title = [
- ( config.stats.bad ? "\u2716" : "\u2714" ),
- document.title.replace( /^[\u2714\u2716] /i, "" )
- ].join( " " );
- }
-
- // clear own sessionStorage items if all tests passed
- if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) {
- // `key` & `i` initialized at top of scope
- for ( i = 0; i < sessionStorage.length; i++ ) {
- key = sessionStorage.key( i++ );
- if ( key.indexOf( "qunit-test-" ) === 0 ) {
- sessionStorage.removeItem( key );
- }
- }
- }
-
- // scroll back to top to show results
- if ( window.scrollTo ) {
- window.scrollTo(0, 0);
- }
-
- runLoggingCallbacks( "done", QUnit, {
- failed: config.stats.bad,
- passed: passed,
- total: config.stats.all,
- runtime: runtime
- });
-}
-
-/** @return Boolean: true if this test should be ran */
-function validTest( test ) {
- var include,
- filter = config.filter && config.filter.toLowerCase(),
- module = config.module && config.module.toLowerCase(),
- fullName = (test.module + ": " + test.testName).toLowerCase();
-
- // Internally-generated tests are always valid
- if ( test.callback && test.callback.validTest === validTest ) {
- delete test.callback.validTest;
- return true;
- }
-
- if ( config.testNumber ) {
- return test.testNumber === config.testNumber;
- }
-
- if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {
- return false;
- }
-
- if ( !filter ) {
- return true;
- }
-
- include = filter.charAt( 0 ) !== "!";
- if ( !include ) {
- filter = filter.slice( 1 );
- }
-
- // If the filter matches, we need to honour include
- if ( fullName.indexOf( filter ) !== -1 ) {
- return include;
- }
-
- // Otherwise, do the opposite
- return !include;
-}
-
-// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions)
-// Later Safari and IE10 are supposed to support error.stack as well
-// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
-function extractStacktrace( e, offset ) {
- offset = offset === undefined ? 3 : offset;
-
- var stack, include, i;
-
- if ( e.stacktrace ) {
- // Opera
- return e.stacktrace.split( "\n" )[ offset + 3 ];
- } else if ( e.stack ) {
- // Firefox, Chrome
- stack = e.stack.split( "\n" );
- if (/^error$/i.test( stack[0] ) ) {
- stack.shift();
- }
- if ( fileName ) {
- include = [];
- for ( i = offset; i < stack.length; i++ ) {
- if ( stack[ i ].indexOf( fileName ) !== -1 ) {
- break;
- }
- include.push( stack[ i ] );
- }
- if ( include.length ) {
- return include.join( "\n" );
- }
- }
- return stack[ offset ];
- } else if ( e.sourceURL ) {
- // Safari, PhantomJS
- // hopefully one day Safari provides actual stacktraces
- // exclude useless self-reference for generated Error objects
- if ( /qunit.js$/.test( e.sourceURL ) ) {
- return;
- }
- // for actual exceptions, this is useful
- return e.sourceURL + ":" + e.line;
- }
-}
-function sourceFromStacktrace( offset ) {
- try {
- throw new Error();
- } catch ( e ) {
- return extractStacktrace( e, offset );
- }
-}
-
-/**
- * Escape text for attribute or text content.
- */
-function escapeText( s ) {
- if ( !s ) {
- return "";
- }
- s = s + "";
- // Both single quotes and double quotes (for attributes)
- return s.replace( /['"<>&]/g, function( s ) {
- switch( s ) {
- case '\'':
- return '&#039;';
- case '"':
- return '&quot;';
- case '<':
- return '&lt;';
- case '>':
- return '&gt;';
- case '&':
- return '&amp;';
- }
- });
-}
-
-function synchronize( callback, last ) {
- config.queue.push( callback );
-
- if ( config.autorun && !config.blocking ) {
- process( last );
- }
-}
-
-function process( last ) {
- function next() {
- process( last );
- }
- var start = new Date().getTime();
- config.depth = config.depth ? config.depth + 1 : 1;
-
- while ( config.queue.length && !config.blocking ) {
- if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {
- config.queue.shift()();
- } else {
- window.setTimeout( next, 13 );
- break;
- }
- }
- config.depth--;
- if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
- done();
- }
-}
-
-function saveGlobal() {
- config.pollution = [];
-
- if ( config.noglobals ) {
- for ( var key in window ) {
- // in Opera sometimes DOM element ids show up here, ignore them
- if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) {
- continue;
- }
- config.pollution.push( key );
- }
- }
-}
-
-function checkPollution() {
- var newGlobals,
- deletedGlobals,
- old = config.pollution;
-
- saveGlobal();
-
- newGlobals = diff( config.pollution, old );
- if ( newGlobals.length > 0 ) {
- QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") );
- }
-
- deletedGlobals = diff( old, config.pollution );
- if ( deletedGlobals.length > 0 ) {
- QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") );
- }
-}
-
-// returns a new Array with the elements that are in a but not in b
-function diff( a, b ) {
- var i, j,
- result = a.slice();
-
- for ( i = 0; i < result.length; i++ ) {
- for ( j = 0; j < b.length; j++ ) {
- if ( result[i] === b[j] ) {
- result.splice( i, 1 );
- i--;
- break;
- }
- }
- }
- return result;
-}
-
-function extend( a, b ) {
- for ( var prop in b ) {
- if ( b[ prop ] === undefined ) {
- delete a[ prop ];
-
- // Avoid "Member not found" error in IE8 caused by setting window.constructor
- } else if ( prop !== "constructor" || a !== window ) {
- a[ prop ] = b[ prop ];
- }
- }
-
- return a;
-}
-
-/**
- * @param {HTMLElement} elem
- * @param {string} type
- * @param {Function} fn
- */
-function addEvent( elem, type, fn ) {
- // Standards-based browsers
- if ( elem.addEventListener ) {
- elem.addEventListener( type, fn, false );
- // IE
- } else {
- elem.attachEvent( "on" + type, fn );
- }
-}
-
-/**
- * @param {Array|NodeList} elems
- * @param {string} type
- * @param {Function} fn
- */
-function addEvents( elems, type, fn ) {
- var i = elems.length;
- while ( i-- ) {
- addEvent( elems[i], type, fn );
- }
-}
-
-function hasClass( elem, name ) {
- return (" " + elem.className + " ").indexOf(" " + name + " ") > -1;
-}
-
-function addClass( elem, name ) {
- if ( !hasClass( elem, name ) ) {
- elem.className += (elem.className ? " " : "") + name;
- }
-}
-
-function removeClass( elem, name ) {
- var set = " " + elem.className + " ";
- // Class name may appear multiple times
- while ( set.indexOf(" " + name + " ") > -1 ) {
- set = set.replace(" " + name + " " , " ");
- }
- // If possible, trim it for prettiness, but not neccecarily
- elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set );
-}
-
-function id( name ) {
- return !!( typeof document !== "undefined" && document && document.getElementById ) &&
- document.getElementById( name );
-}
-
-function registerLoggingCallback( key ) {
- return function( callback ) {
- config[key].push( callback );
- };
-}
-
-// Supports deprecated method of completely overwriting logging callbacks
-function runLoggingCallbacks( key, scope, args ) {
- var i, callbacks;
- if ( QUnit.hasOwnProperty( key ) ) {
- QUnit[ key ].call(scope, args );
- } else {
- callbacks = config[ key ];
- for ( i = 0; i < callbacks.length; i++ ) {
- callbacks[ i ].call( scope, args );
- }
- }
-}
-
-// Test for equality any JavaScript type.
-// Author: Philippe Rathé <prathe@gmail.com>
-QUnit.equiv = (function() {
-
- // Call the o related callback with the given arguments.
- function bindCallbacks( o, callbacks, args ) {
- var prop = QUnit.objectType( o );
- if ( prop ) {
- if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
- return callbacks[ prop ].apply( callbacks, args );
- } else {
- return callbacks[ prop ]; // or undefined
- }
- }
- }
-
- // the real equiv function
- var innerEquiv,
- // stack to decide between skip/abort functions
- callers = [],
- // stack to avoiding loops from circular referencing
- parents = [],
-
- getProto = Object.getPrototypeOf || function ( obj ) {
- return obj.__proto__;
- },
- callbacks = (function () {
-
- // for string, boolean, number and null
- function useStrictEquality( b, a ) {
- /*jshint eqeqeq:false */
- if ( b instanceof a.constructor || a instanceof b.constructor ) {
- // to catch short annotaion VS 'new' annotation of a
- // declaration
- // e.g. var i = 1;
- // var j = new Number(1);
- return a == b;
- } else {
- return a === b;
- }
- }
-
- return {
- "string": useStrictEquality,
- "boolean": useStrictEquality,
- "number": useStrictEquality,
- "null": useStrictEquality,
- "undefined": useStrictEquality,
-
- "nan": function( b ) {
- return isNaN( b );
- },
-
- "date": function( b, a ) {
- return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf();
- },
-
- "regexp": function( b, a ) {
- return QUnit.objectType( b ) === "regexp" &&
- // the regex itself
- a.source === b.source &&
- // and its modifers
- a.global === b.global &&
- // (gmi) ...
- a.ignoreCase === b.ignoreCase &&
- a.multiline === b.multiline &&
- a.sticky === b.sticky;
- },
-
- // - skip when the property is a method of an instance (OOP)
- // - abort otherwise,
- // initial === would have catch identical references anyway
- "function": function() {
- var caller = callers[callers.length - 1];
- return caller !== Object && typeof caller !== "undefined";
- },
-
- "array": function( b, a ) {
- var i, j, len, loop;
-
- // b could be an object literal here
- if ( QUnit.objectType( b ) !== "array" ) {
- return false;
- }
-
- len = a.length;
- if ( len !== b.length ) {
- // safe and faster
- return false;
- }
-
- // track reference to avoid circular references
- parents.push( a );
- for ( i = 0; i < len; i++ ) {
- loop = false;
- for ( j = 0; j < parents.length; j++ ) {
- if ( parents[j] === a[i] ) {
- loop = true;// dont rewalk array
- }
- }
- if ( !loop && !innerEquiv(a[i], b[i]) ) {
- parents.pop();
- return false;
- }
- }
- parents.pop();
- return true;
- },
-
- "object": function( b, a ) {
- var i, j, loop,
- // Default to true
- eq = true,
- aProperties = [],
- bProperties = [];
-
- // comparing constructors is more strict than using
- // instanceof
- if ( a.constructor !== b.constructor ) {
- // Allow objects with no prototype to be equivalent to
- // objects with Object as their constructor.
- if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) ||
- ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) {
- return false;
- }
- }
-
- // stack constructor before traversing properties
- callers.push( a.constructor );
- // track reference to avoid circular references
- parents.push( a );
-
- for ( i in a ) { // be strict: don't ensures hasOwnProperty
- // and go deep
- loop = false;
- for ( j = 0; j < parents.length; j++ ) {
- if ( parents[j] === a[i] ) {
- // don't go down the same path twice
- loop = true;
- }
- }
- aProperties.push(i); // collect a's properties
-
- if (!loop && !innerEquiv( a[i], b[i] ) ) {
- eq = false;
- break;
- }
- }
-
- callers.pop(); // unstack, we are done
- parents.pop();
-
- for ( i in b ) {
- bProperties.push( i ); // collect b's properties
- }
-
- // Ensures identical properties name
- return eq && innerEquiv( aProperties.sort(), bProperties.sort() );
- }
- };
- }());
-
- innerEquiv = function() { // can take multiple arguments
- var args = [].slice.apply( arguments );
- if ( args.length < 2 ) {
- return true; // end transition
- }
-
- return (function( a, b ) {
- if ( a === b ) {
- return true; // catch the most you can
- } else if ( a === null || b === null || typeof a === "undefined" ||
- typeof b === "undefined" ||
- QUnit.objectType(a) !== QUnit.objectType(b) ) {
- return false; // don't lose time with error prone cases
- } else {
- return bindCallbacks(a, callbacks, [ b, a ]);
- }
-
- // apply transition with (1..n) arguments
- }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) );
- };
-
- return innerEquiv;
-}());
-
-/**
- * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
- * http://flesler.blogspot.com Licensed under BSD
- * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
- *
- * @projectDescription Advanced and extensible data dumping for Javascript.
- * @version 1.0.0
- * @author Ariel Flesler
- * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
- */
-QUnit.jsDump = (function() {
- function quote( str ) {
- return '"' + str.toString().replace( /"/g, '\\"' ) + '"';
- }
- function literal( o ) {
- return o + "";
- }
- function join( pre, arr, post ) {
- var s = jsDump.separator(),
- base = jsDump.indent(),
- inner = jsDump.indent(1);
- if ( arr.join ) {
- arr = arr.join( "," + s + inner );
- }
- if ( !arr ) {
- return pre + post;
- }
- return [ pre, inner + arr, base + post ].join(s);
- }
- function array( arr, stack ) {
- var i = arr.length, ret = new Array(i);
- this.up();
- while ( i-- ) {
- ret[i] = this.parse( arr[i] , undefined , stack);
- }
- this.down();
- return join( "[", ret, "]" );
- }
-
- var reName = /^function (\w+)/,
- jsDump = {
- // type is used mostly internally, you can fix a (custom)type in advance
- parse: function( obj, type, stack ) {
- stack = stack || [ ];
- var inStack, res,
- parser = this.parsers[ type || this.typeOf(obj) ];
-
- type = typeof parser;
- inStack = inArray( obj, stack );
-
- if ( inStack !== -1 ) {
- return "recursion(" + (inStack - stack.length) + ")";
- }
- if ( type === "function" ) {
- stack.push( obj );
- res = parser.call( this, obj, stack );
- stack.pop();
- return res;
- }
- return ( type === "string" ) ? parser : this.parsers.error;
- },
- typeOf: function( obj ) {
- var type;
- if ( obj === null ) {
- type = "null";
- } else if ( typeof obj === "undefined" ) {
- type = "undefined";
- } else if ( QUnit.is( "regexp", obj) ) {
- type = "regexp";
- } else if ( QUnit.is( "date", obj) ) {
- type = "date";
- } else if ( QUnit.is( "function", obj) ) {
- type = "function";
- } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) {
- type = "window";
- } else if ( obj.nodeType === 9 ) {
- type = "document";
- } else if ( obj.nodeType ) {
- type = "node";
- } else if (
- // native arrays
- toString.call( obj ) === "[object Array]" ||
- // NodeList objects
- ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) )
- ) {
- type = "array";
- } else if ( obj.constructor === Error.prototype.constructor ) {
- type = "error";
- } else {
- type = typeof obj;
- }
- return type;
- },
- separator: function() {
- return this.multiline ? this.HTML ? "<br />" : "\n" : this.HTML ? "&nbsp;" : " ";
- },
- // extra can be a number, shortcut for increasing-calling-decreasing
- indent: function( extra ) {
- if ( !this.multiline ) {
- return "";
- }
- var chr = this.indentChar;
- if ( this.HTML ) {
- chr = chr.replace( /\t/g, " " ).replace( / /g, "&nbsp;" );
- }
- return new Array( this._depth_ + (extra||0) ).join(chr);
- },
- up: function( a ) {
- this._depth_ += a || 1;
- },
- down: function( a ) {
- this._depth_ -= a || 1;
- },
- setParser: function( name, parser ) {
- this.parsers[name] = parser;
- },
- // The next 3 are exposed so you can use them
- quote: quote,
- literal: literal,
- join: join,
- //
- _depth_: 1,
- // This is the list of parsers, to modify them, use jsDump.setParser
- parsers: {
- window: "[Window]",
- document: "[Document]",
- error: function(error) {
- return "Error(\"" + error.message + "\")";
- },
- unknown: "[Unknown]",
- "null": "null",
- "undefined": "undefined",
- "function": function( fn ) {
- var ret = "function",
- // functions never have name in IE
- name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];
-
- if ( name ) {
- ret += " " + name;
- }
- ret += "( ";
-
- ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" );
- return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" );
- },
- array: array,
- nodelist: array,
- "arguments": array,
- object: function( map, stack ) {
- var ret = [ ], keys, key, val, i;
- QUnit.jsDump.up();
- keys = [];
- for ( key in map ) {
- keys.push( key );
- }
- keys.sort();
- for ( i = 0; i < keys.length; i++ ) {
- key = keys[ i ];
- val = map[ key ];
- ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) );
- }
- QUnit.jsDump.down();
- return join( "{", ret, "}" );
- },
- node: function( node ) {
- var len, i, val,
- open = QUnit.jsDump.HTML ? "&lt;" : "<",
- close = QUnit.jsDump.HTML ? "&gt;" : ">",
- tag = node.nodeName.toLowerCase(),
- ret = open + tag,
- attrs = node.attributes;
-
- if ( attrs ) {
- for ( i = 0, len = attrs.length; i < len; i++ ) {
- val = attrs[i].nodeValue;
- // IE6 includes all attributes in .attributes, even ones not explicitly set.
- // Those have values like undefined, null, 0, false, "" or "inherit".
- if ( val && val !== "inherit" ) {
- ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" );
- }
- }
- }
- ret += close;
-
- // Show content of TextNode or CDATASection
- if ( node.nodeType === 3 || node.nodeType === 4 ) {
- ret += node.nodeValue;
- }
-
- return ret + open + "/" + tag + close;
- },
- // function calls it internally, it's the arguments part of the function
- functionArgs: function( fn ) {
- var args,
- l = fn.length;
-
- if ( !l ) {
- return "";
- }
-
- args = new Array(l);
- while ( l-- ) {
- // 97 is 'a'
- args[l] = String.fromCharCode(97+l);
- }
- return " " + args.join( ", " ) + " ";
- },
- // object calls it internally, the key part of an item in a map
- key: quote,
- // function calls it internally, it's the content of the function
- functionCode: "[code]",
- // node calls it internally, it's an html attribute value
- attribute: quote,
- string: quote,
- date: quote,
- regexp: literal,
- number: literal,
- "boolean": literal
- },
- // if true, entities are escaped ( <, >, \t, space and \n )
- HTML: false,
- // indentation unit
- indentChar: " ",
- // if true, items in a collection, are separated by a \n, else just a space.
- multiline: true
- };
-
- return jsDump;
-}());
-
-// from jquery.js
-function inArray( elem, array ) {
- if ( array.indexOf ) {
- return array.indexOf( elem );
- }
-
- for ( var i = 0, length = array.length; i < length; i++ ) {
- if ( array[ i ] === elem ) {
- return i;
- }
- }
-
- return -1;
-}
-
-/*
- * Javascript Diff Algorithm
- * By John Resig (http://ejohn.org/)
- * Modified by Chu Alan "sprite"
- *
- * Released under the MIT license.
- *
- * More Info:
- * http://ejohn.org/projects/javascript-diff-algorithm/
- *
- * Usage: QUnit.diff(expected, actual)
- *
- * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
- */
-QUnit.diff = (function() {
- /*jshint eqeqeq:false, eqnull:true */
- function diff( o, n ) {
- var i,
- ns = {},
- os = {};
-
- for ( i = 0; i < n.length; i++ ) {
- if ( !hasOwn.call( ns, n[i] ) ) {
- ns[ n[i] ] = {
- rows: [],
- o: null
- };
- }
- ns[ n[i] ].rows.push( i );
- }
-
- for ( i = 0; i < o.length; i++ ) {
- if ( !hasOwn.call( os, o[i] ) ) {
- os[ o[i] ] = {
- rows: [],
- n: null
- };
- }
- os[ o[i] ].rows.push( i );
- }
-
- for ( i in ns ) {
- if ( !hasOwn.call( ns, i ) ) {
- continue;
- }
- if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) {
- n[ ns[i].rows[0] ] = {
- text: n[ ns[i].rows[0] ],
- row: os[i].rows[0]
- };
- o[ os[i].rows[0] ] = {
- text: o[ os[i].rows[0] ],
- row: ns[i].rows[0]
- };
- }
- }
-
- for ( i = 0; i < n.length - 1; i++ ) {
- if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null &&
- n[ i + 1 ] == o[ n[i].row + 1 ] ) {
-
- n[ i + 1 ] = {
- text: n[ i + 1 ],
- row: n[i].row + 1
- };
- o[ n[i].row + 1 ] = {
- text: o[ n[i].row + 1 ],
- row: i + 1
- };
- }
- }
-
- for ( i = n.length - 1; i > 0; i-- ) {
- if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null &&
- n[ i - 1 ] == o[ n[i].row - 1 ]) {
-
- n[ i - 1 ] = {
- text: n[ i - 1 ],
- row: n[i].row - 1
- };
- o[ n[i].row - 1 ] = {
- text: o[ n[i].row - 1 ],
- row: i - 1
- };
- }
- }
-
- return {
- o: o,
- n: n
- };
- }
-
- return function( o, n ) {
- o = o.replace( /\s+$/, "" );
- n = n.replace( /\s+$/, "" );
-
- var i, pre,
- str = "",
- out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ),
- oSpace = o.match(/\s+/g),
- nSpace = n.match(/\s+/g);
-
- if ( oSpace == null ) {
- oSpace = [ " " ];
- }
- else {
- oSpace.push( " " );
- }
-
- if ( nSpace == null ) {
- nSpace = [ " " ];
- }
- else {
- nSpace.push( " " );
- }
-
- if ( out.n.length === 0 ) {
- for ( i = 0; i < out.o.length; i++ ) {
- str += "<del>" + out.o[i] + oSpace[i] + "</del>";
- }
- }
- else {
- if ( out.n[0].text == null ) {
- for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) {
- str += "<del>" + out.o[n] + oSpace[n] + "</del>";
- }
- }
-
- for ( i = 0; i < out.n.length; i++ ) {
- if (out.n[i].text == null) {
- str += "<ins>" + out.n[i] + nSpace[i] + "</ins>";
- }
- else {
- // `pre` initialized at top of scope
- pre = "";
-
- for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) {
- pre += "<del>" + out.o[n] + oSpace[n] + "</del>";
- }
- str += " " + out.n[i].text + nSpace[i] + pre;
- }
- }
- }
-
- return str;
- };
-}());
-
-// for CommonJS enviroments, export everything
-if ( typeof exports !== "undefined" ) {
- extend( exports, QUnit );
-}
-
-// get at whatever the global object is, like window in browsers
-}( (function() {return this;}.call()) ));
diff --git a/resources/jquery/jquery.spinner.css b/resources/jquery/jquery.spinner.css
deleted file mode 100644
index a9e06dbe..00000000
--- a/resources/jquery/jquery.spinner.css
+++ /dev/null
@@ -1,40 +0,0 @@
-.mw-spinner {
- background-color: transparent;
- background-position: center center;
- background-repeat: no-repeat;
-}
-
-.mw-spinner-small {
- /* @embed */
- background-image: url(images/spinner.gif);
- height: 20px;
- width: 20px;
- /* Avoid issues with .mw-spinner-block when floated without width. */
- min-width: 20px;
-}
-
-.mw-spinner-large {
- /* @embed */
- background-image: url(images/spinner-large.gif);
- height: 32px;
- width: 32px;
- /* Avoid issues with .mw-spinner-block when floated without width. */
- min-width: 32px;
-}
-
-.mw-spinner-block {
- display: block;
- /* This overrides width from .mw-spinner-large / .mw-spinner-small,
- * This is where the min-width kicks in.
- */
- width: 100%;
-}
-
-.mw-spinner-inline {
- display: inline-block;
- vertical-align: middle;
-
- /* IE < 8 */
- zoom: 1;
- *display: inline;
-}
diff --git a/resources/jquery/jquery.spinner.js b/resources/jquery/jquery.spinner.js
deleted file mode 100644
index 27dabc6c..00000000
--- a/resources/jquery/jquery.spinner.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * jQuery Spinner
- *
- * Simple jQuery plugin to create, inject and remove spinners.
- *
- * @class jQuery.plugin.spinner
- */
-( function ( $ ) {
-
- // Default options for new spinners,
- // stored outside the function to share between calls.
- var defaults = {
- id: undefined,
- size: 'small',
- type: 'inline'
- };
-
- $.extend({
- /**
- * Create a spinner element
- *
- * The argument is an object with options used to construct the spinner. These can be:
- *
- * It is a good practice to keep a reference to the created spinner to be able to remove it later.
- * Alternatively one can use the id option and #removeSpinner (but make sure to choose an id
- * that's unlikely to cause conflicts, e.g. with extensions, gadgets or user scripts).
- *
- * CSS classes used:
- * - .mw-spinner for every spinner
- * - .mw-spinner-small / .mw-spinner-large for size
- * - .mw-spinner-block / .mw-spinner-inline for display types
- *
- * // Create a large spinner reserving all available horizontal space.
- * var $spinner = $.createSpinner({ size: 'large', type: 'block' });
- * // Insert above page content.
- * $( '#mw-content-text' ).prepend( $spinner );
- *
- * // Place a small inline spinner next to the "Save" button
- * var $spinner = $.createSpinner({ size: 'small', type: 'inline' });
- * // Alternatively, just `$.createSpinner();` as these are the default options.
- * $( '#wpSave' ).after( $spinner );
- *
- * // The following two are equivalent:
- * $.createSpinner( 'magic' );
- * $.createSpinner({ id: 'magic' });
- *
- * @static
- * @inheritable
- * @param {Object|string} [opts] ID string or options:
- * - id: If given, spinner will be given an id of "mw-spinner-{id}"
- * - size: 'small' (default) or 'large' for a 20-pixel or 32-pixel spinner
- * - type: 'inline' (default) or 'block'. Inline creates an inline-block with width and
- * height equal to spinner size. Block is a block-level element with width 100%, height
- * equal to spinner size.
- * @return {jQuery}
- */
- createSpinner: function ( opts ) {
- if ( opts !== undefined && $.type( opts ) !== 'object' ) {
- opts = {
- id: opts
- };
- }
-
- opts = $.extend( {}, defaults, opts );
-
- var $spinner = $( '<div>', { 'class': 'mw-spinner', 'title': '...' } );
- if ( opts.id !== undefined ) {
- $spinner.attr( 'id', 'mw-spinner-' + opts.id );
- }
-
- $spinner.addClass( opts.size === 'large' ? 'mw-spinner-large' : 'mw-spinner-small' );
- $spinner.addClass( opts.type === 'block' ? 'mw-spinner-block' : 'mw-spinner-inline' );
-
- return $spinner;
- },
-
- /**
- * Remove a spinner element
- *
- * @static
- * @inheritable
- * @param {string} id Id of the spinner, as passed to #createSpinner
- * @return {jQuery} The (now detached) spinner element
- */
- removeSpinner: function ( id ) {
- return $( '#mw-spinner-' + id ).remove();
- }
- });
-
- /**
- * Inject a spinner after each element in the collection
- *
- * Inserts spinner as siblings, not children, of the target elements.
- * Collection contents remain unchanged.
- *
- * @param {Object|string} [opts] See #createSpinner
- * @return {jQuery}
- */
- $.fn.injectSpinner = function ( opts ) {
- return this.after( $.createSpinner( opts ) );
- };
-
- /**
- * @class jQuery
- * @mixins jQuery.plugin.spinner
- */
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.suggestions.css b/resources/jquery/jquery.suggestions.css
deleted file mode 100644
index e0ba647b..00000000
--- a/resources/jquery/jquery.suggestions.css
+++ /dev/null
@@ -1,77 +0,0 @@
-/* suggestions plugin */
-
-.suggestions {
- overflow: hidden;
- position: absolute;
- top: 0;
- left: 0;
- width: 0;
- border: none;
- z-index: 1099;
- padding: 0;
- margin: -1px -1px 0 0;
-}
-
-/* IGNORED BY IE6 */
-html > body .suggestions {
- margin: -1px 0 0 0;
-}
-
-.suggestions-special {
- position: relative;
- background-color: white;
- cursor: pointer;
- border: solid 1px #aaaaaa;
- padding: 0;
- margin: 0;
- margin-top: -2px;
- display: none;
- padding: 0.25em 0.25em;
- line-height: 1.25em;
-}
-
-.suggestions-results {
- background-color: white;
- cursor: pointer;
- border: solid 1px #aaaaaa;
- padding: 0;
- margin: 0;
-}
-
-.suggestions-result {
- color: black;
- margin: 0;
- line-height: 1.5em;
- padding: 0.01em 0.25em;
- text-align: left;
-}
-
-.suggestions-result-current {
- background-color: #4C59A6;
- color: white;
-}
-
-.suggestions-special .special-label {
- color: gray;
- text-align: left;
-}
-
-.suggestions-special .special-query {
- color: black;
- font-style: italic;
- text-align: left;
-}
-
-.suggestions-special .special-hover {
- background-color: silver;
-}
-
-.suggestions-result-current .special-label,
-.suggestions-result-current .special-query {
- color: white;
-}
-
-.autoellipsis-matched,
-.highlight {
- font-weight: bold;
-}
diff --git a/resources/jquery/jquery.suggestions.js b/resources/jquery/jquery.suggestions.js
deleted file mode 100644
index 28e2afc4..00000000
--- a/resources/jquery/jquery.suggestions.js
+++ /dev/null
@@ -1,631 +0,0 @@
-/**
- * This plugin provides a generic way to add suggestions to a text box.
- *
- * Usage:
- *
- * Set options:
- * $( '#textbox' ).suggestions( { option1: value1, option2: value2 } );
- * $( '#textbox' ).suggestions( option, value );
- * Get option:
- * value = $( '#textbox' ).suggestions( option );
- * Initialize:
- * $( '#textbox' ).suggestions();
- *
- * Options:
- *
- * fetch(query): Callback that should fetch suggestions and set the suggestions property.
- * Executed in the context of the textbox
- * Type: Function
- * cancel: Callback function to call when any pending asynchronous suggestions fetches
- * should be canceled. Executed in the context of the textbox
- * Type: Function
- * special: Set of callbacks for rendering and selecting
- * Type: Object of Functions 'render' and 'select'
- * result: Set of callbacks for rendering and selecting
- * Type: Object of Functions 'render' and 'select'
- * $region: jQuery selection of element to place the suggestions below and match width of
- * Type: jQuery Object, Default: $(this)
- * suggestions: Suggestions to display
- * Type: Array of strings
- * maxRows: Maximum number of suggestions to display at one time
- * Type: Number, Range: 1 - 100, Default: 7
- * delay: Number of ms to wait for the user to stop typing
- * Type: Number, Range: 0 - 1200, Default: 120
- * submitOnClick: Whether to submit the form containing the textbox when a suggestion is clicked
- * Type: Boolean, Default: false
- * maxExpandFactor: Maximum suggestions box width relative to the textbox width. If set
- * to e.g. 2, the suggestions box will never be grown beyond 2 times the width of the textbox.
- * Type: Number, Range: 1 - infinity, Default: 3
- * expandFrom: Which direction to offset the suggestion box from.
- * Values 'start' and 'end' translate to left and right respectively depending on the
- * directionality of the current document, according to $( 'html' ).css( 'direction' ).
- * Type: String, default: 'auto', options: 'left', 'right', 'start', 'end', 'auto'.
- * positionFromLeft: Sets expandFrom=left, for backwards compatibility
- * Type: Boolean, Default: true
- * highlightInput: Whether to hightlight matched portions of the input or not
- * Type: Boolean, Default: false
- */
-( function ( $ ) {
-
-$.suggestions = {
- /**
- * Cancel any delayed maybeFetch() call and callback the context so
- * they can cancel any async fetching if they use AJAX or something.
- */
- cancel: function ( context ) {
- if ( context.data.timerID !== null ) {
- clearTimeout( context.data.timerID );
- }
- if ( $.isFunction( context.config.cancel ) ) {
- context.config.cancel.call( context.data.$textbox );
- }
- },
-
- /**
- * Restore the text the user originally typed in the textbox, before it
- * was overwritten by highlight(). This restores the value the currently
- * displayed suggestions are based on, rather than the value just before
- * highlight() overwrote it; the former is arguably slightly more sensible.
- */
- restore: function ( context ) {
- context.data.$textbox.val( context.data.prevText );
- },
-
- /**
- * Ask the user-specified callback for new suggestions. Any previous delayed
- * call to this function still pending will be canceled. If the value in the
- * textbox is empty or hasn't changed since the last time suggestions were fetched,
- * this function does nothing.
- * @param {Boolean} delayed Whether or not to delay this by the currently configured amount of time
- */
- update: function ( context, delayed ) {
- // Only fetch if the value in the textbox changed and is not empty, or if the results were hidden
- // if the textbox is empty then clear the result div, but leave other settings intouched
- function maybeFetch() {
- if ( context.data.$textbox.val().length === 0 ) {
- context.data.$container.hide();
- context.data.prevText = '';
- } else if (
- context.data.$textbox.val() !== context.data.prevText ||
- !context.data.$container.is( ':visible' )
- ) {
- if ( typeof context.config.fetch === 'function' ) {
- context.data.prevText = context.data.$textbox.val();
- context.config.fetch.call( context.data.$textbox, context.data.$textbox.val() );
- }
- }
- }
-
- // Cancels any delayed maybeFetch call, and invokes context.config.cancel.
- $.suggestions.cancel( context );
-
- if ( delayed ) {
- // To avoid many started/aborted requests while typing, we're gonna take a short
- // break before trying to fetch data.
- context.data.timerID = setTimeout( maybeFetch, context.config.delay );
- } else {
- maybeFetch();
- }
- $.suggestions.special( context );
- },
-
- special: function ( context ) {
- // Allow custom rendering - but otherwise don't do any rendering
- if ( typeof context.config.special.render === 'function' ) {
- // Wait for the browser to update the value
- setTimeout( function () {
- // Render special
- var $special = context.data.$container.find( '.suggestions-special' );
- context.config.special.render.call( $special, context.data.$textbox.val(), context );
- }, 1 );
- }
- },
-
- /**
- * Sets the value of a property, and updates the widget accordingly
- * @param property String Name of property
- * @param value Mixed Value to set property with
- */
- configure: function ( context, property, value ) {
- var newCSS,
- $autoEllipseMe, $result, $results, childrenWidth,
- i, expWidth, matchedText, maxWidth, text;
-
- // Validate creation using fallback values
- switch( property ) {
- case 'fetch':
- case 'cancel':
- case 'special':
- case 'result':
- case '$region':
- case 'expandFrom':
- context.config[property] = value;
- break;
- case 'suggestions':
- context.config[property] = value;
- // Update suggestions
- if ( context.data !== undefined ) {
- if ( context.data.$textbox.val().length === 0 ) {
- // Hide the div when no suggestion exist
- context.data.$container.hide();
- } else {
- // Rebuild the suggestions list
- context.data.$container.show();
- // Update the size and position of the list
- newCSS = {
- top: context.config.$region.offset().top + context.config.$region.outerHeight(),
- bottom: 'auto',
- width: context.config.$region.outerWidth(),
- height: 'auto'
- };
-
- // Process expandFrom, after this it is set to left or right.
- context.config.expandFrom = ( function ( expandFrom ) {
- var regionWidth, docWidth, regionCenter, docCenter,
- docDir = $( document.documentElement ).css( 'direction' ),
- $region = context.config.$region;
-
- // Backwards compatible
- if ( context.config.positionFromLeft ) {
- expandFrom = 'left';
-
- // Catch invalid values, default to 'auto'
- } else if ( $.inArray( expandFrom, ['left', 'right', 'start', 'end', 'auto'] ) === -1 ) {
- expandFrom = 'auto';
- }
-
- if ( expandFrom === 'auto' ) {
- if ( $region.data( 'searchsuggest-expand-dir' ) ) {
- // If the markup explicitly contains a direction, use it.
- expandFrom = $region.data( 'searchsuggest-expand-dir' );
- } else {
- regionWidth = $region.outerWidth();
- docWidth = $( document ).width();
- if ( ( regionWidth / docWidth ) > 0.85 ) {
- // If the input size takes up more than 85% of the document horizontally
- // expand the suggestions to the writing direction's native end.
- expandFrom = 'start';
- } else {
- // Calculate the center points of the input and document
- regionCenter = $region.offset().left + regionWidth / 2;
- docCenter = docWidth / 2;
- if ( Math.abs( regionCenter - docCenter ) / docCenter < 0.10 ) {
- // If the input's center is within 10% of the document center
- // use the writing direction's native end.
- expandFrom = 'start';
- } else {
- // Otherwise expand the input from the closest side of the page,
- // towards the side of the page with the most free open space
- expandFrom = regionCenter > docCenter ? 'right' : 'left';
- }
- }
- }
- }
-
- if ( expandFrom === 'start' ) {
- expandFrom = docDir === 'rtl' ? 'right': 'left';
-
- } else if ( expandFrom === 'end' ) {
- expandFrom = docDir === 'rtl' ? 'left': 'right';
- }
-
- return expandFrom;
-
- }( context.config.expandFrom ) );
-
- if ( context.config.expandFrom === 'left' ) {
- // Expand from left
- newCSS.left = context.config.$region.offset().left;
- newCSS.right = 'auto';
- } else {
- // Expand from right
- newCSS.left = 'auto';
- newCSS.right = $( document ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() );
- }
-
- context.data.$container.css( newCSS );
- $results = context.data.$container.children( '.suggestions-results' );
- $results.empty();
- expWidth = -1;
- $autoEllipseMe = $( [] );
- matchedText = null;
- for ( i = 0; i < context.config.suggestions.length; i++ ) {
- /*jshint loopfunc:true */
- text = context.config.suggestions[i];
- $result = $( '<div>' )
- .addClass( 'suggestions-result' )
- .attr( 'rel', i )
- .data( 'text', context.config.suggestions[i] )
- .mousemove( function () {
- context.data.selectedWithMouse = true;
- $.suggestions.highlight(
- context,
- $(this).closest( '.suggestions-results .suggestions-result' ),
- false
- );
- } )
- .appendTo( $results );
- // Allow custom rendering
- if ( typeof context.config.result.render === 'function' ) {
- context.config.result.render.call( $result, context.config.suggestions[i], context );
- } else {
- // Add <span> with text
- $result.append( $( '<span>' )
- .css( 'whiteSpace', 'nowrap' )
- .text( text )
- );
- }
-
- if ( context.config.highlightInput ) {
- matchedText = context.data.prevText;
- }
-
- // Widen results box if needed
- // New width is only calculated here, applied later
- childrenWidth = $result.children().outerWidth();
- if ( childrenWidth > $result.width() && childrenWidth > expWidth ) {
- // factor in any padding, margin, or border space on the parent
- expWidth = childrenWidth + ( context.data.$container.width() - $result.width() );
- }
- $autoEllipseMe = $autoEllipseMe.add( $result );
- }
- // Apply new width for results box, if any
- if ( expWidth > context.data.$container.width() ) {
- maxWidth = context.config.maxExpandFactor*context.data.$textbox.width();
- context.data.$container.width( Math.min( expWidth, maxWidth ) );
- }
- // autoEllipse the results. Has to be done after changing the width
- $autoEllipseMe.autoEllipsis( {
- hasSpan: true,
- tooltip: true,
- matchText: matchedText
- } );
- }
- }
- break;
- case 'maxRows':
- context.config[property] = Math.max( 1, Math.min( 100, value ) );
- break;
- case 'delay':
- context.config[property] = Math.max( 0, Math.min( 1200, value ) );
- break;
- case 'maxExpandFactor':
- context.config[property] = Math.max( 1, value );
- break;
- case 'submitOnClick':
- case 'positionFromLeft':
- case 'highlightInput':
- context.config[property] = value ? true : false;
- break;
- }
- },
-
- /**
- * Highlight a result in the results table
- * @param result <tr> to highlight: jQuery object, or 'prev' or 'next'
- * @param updateTextbox If true, put the suggestion in the textbox
- */
- highlight: function ( context, result, updateTextbox ) {
- var selected = context.data.$container.find( '.suggestions-result-current' );
- if ( !result.get || selected.get( 0 ) !== result.get( 0 ) ) {
- if ( result === 'prev' ) {
- if( selected.hasClass( 'suggestions-special' ) ) {
- result = context.data.$container.find( '.suggestions-result:last' );
- } else {
- result = selected.prev();
- if ( !( result.length && result.hasClass( 'suggestions-result' ) ) ) {
- // there is something in the DOM between selected element and the wrapper, bypass it
- result = selected.parents( '.suggestions-results > *' ).prev().find( '.suggestions-result' ).eq(0);
- }
-
- if ( selected.length === 0 ) {
- // we are at the beginning, so lets jump to the last item
- if ( context.data.$container.find( '.suggestions-special' ).html() !== '' ) {
- result = context.data.$container.find( '.suggestions-special' );
- } else {
- result = context.data.$container.find( '.suggestions-results .suggestions-result:last' );
- }
- }
- }
- } else if ( result === 'next' ) {
- if ( selected.length === 0 ) {
- // No item selected, go to the first one
- result = context.data.$container.find( '.suggestions-results .suggestions-result:first' );
- if ( result.length === 0 && context.data.$container.find( '.suggestions-special' ).html() !== '' ) {
- // No suggestion exists, go to the special one directly
- result = context.data.$container.find( '.suggestions-special' );
- }
- } else {
- result = selected.next();
- if ( !( result.length && result.hasClass( 'suggestions-result' ) ) ) {
- // there is something in the DOM between selected element and the wrapper, bypass it
- result = selected.parents( '.suggestions-results > *' ).next().find( '.suggestions-result' ).eq(0);
- }
-
- if ( selected.hasClass( 'suggestions-special' ) ) {
- result = $( [] );
- } else if (
- result.length === 0 &&
- context.data.$container.find( '.suggestions-special' ).html() !== ''
- ) {
- // We were at the last item, jump to the specials!
- result = context.data.$container.find( '.suggestions-special' );
- }
- }
- }
- selected.removeClass( 'suggestions-result-current' );
- result.addClass( 'suggestions-result-current' );
- }
- if ( updateTextbox ) {
- if ( result.length === 0 || result.is( '.suggestions-special' ) ) {
- $.suggestions.restore( context );
- } else {
- context.data.$textbox.val( result.data( 'text' ) );
- // .val() doesn't call any event handlers, so
- // let the world know what happened
- context.data.$textbox.change();
- }
- context.data.$textbox.trigger( 'change' );
- }
- },
-
- /**
- * Respond to keypress event
- * @param key Integer Code of key pressed
- */
- keypress: function ( e, context, key ) {
- var selected,
- wasVisible = context.data.$container.is( ':visible' ),
- preventDefault = false;
-
- switch ( key ) {
- // Arrow down
- case 40:
- if ( wasVisible ) {
- $.suggestions.highlight( context, 'next', true );
- context.data.selectedWithMouse = false;
- } else {
- $.suggestions.update( context, false );
- }
- preventDefault = true;
- break;
- // Arrow up
- case 38:
- if ( wasVisible ) {
- $.suggestions.highlight( context, 'prev', true );
- context.data.selectedWithMouse = false;
- }
- preventDefault = wasVisible;
- break;
- // Escape
- case 27:
- context.data.$container.hide();
- $.suggestions.restore( context );
- $.suggestions.cancel( context );
- context.data.$textbox.trigger( 'change' );
- preventDefault = wasVisible;
- break;
- // Enter
- case 13:
- context.data.$container.hide();
- preventDefault = wasVisible;
- selected = context.data.$container.find( '.suggestions-result-current' );
- if ( selected.length === 0 || context.data.selectedWithMouse ) {
- // if nothing is selected OR if something was selected with the mouse,
- // cancel any current requests and submit the form
- $.suggestions.cancel( context );
- context.config.$region.closest( 'form' ).submit();
- } else if ( selected.is( '.suggestions-special' ) ) {
- if ( typeof context.config.special.select === 'function' ) {
- context.config.special.select.call( selected, context.data.$textbox );
- }
- } else {
- if ( typeof context.config.result.select === 'function' ) {
- $.suggestions.highlight( context, selected, true );
- context.config.result.select.call( selected, context.data.$textbox );
- } else {
- $.suggestions.highlight( context, selected, true );
- }
- }
- break;
- default:
- $.suggestions.update( context, true );
- break;
- }
- if ( preventDefault ) {
- e.preventDefault();
- e.stopImmediatePropagation();
- }
- }
-};
-$.fn.suggestions = function () {
-
- // Multi-context fields
- var returnValue,
- args = arguments;
-
- $(this).each( function () {
- var context, key;
-
- /* Construction / Loading */
-
- context = $(this).data( 'suggestions-context' );
- if ( context === undefined || context === null ) {
- context = {
- config: {
- fetch: function () {},
- cancel: function () {},
- special: {},
- result: {},
- $region: $(this),
- suggestions: [],
- maxRows: 7,
- delay: 120,
- submitOnClick: false,
- maxExpandFactor: 3,
- expandFrom: 'auto',
- highlightInput: false
- }
- };
- }
-
- /* API */
-
- // Handle various calling styles
- if ( args.length > 0 ) {
- if ( typeof args[0] === 'object' ) {
- // Apply set of properties
- for ( key in args[0] ) {
- $.suggestions.configure( context, key, args[0][key] );
- }
- } else if ( typeof args[0] === 'string' ) {
- if ( args.length > 1 ) {
- // Set property values
- $.suggestions.configure( context, args[0], args[1] );
- } else if ( returnValue === null || returnValue === undefined ) {
- // Get property values, but don't give access to internal data - returns only the first
- returnValue = ( args[0] in context.config ? undefined : context.config[args[0]] );
- }
- }
- }
-
- /* Initialization */
-
- if ( context.data === undefined ) {
- context.data = {
- // ID of running timer
- timerID: null,
-
- // Text in textbox when suggestions were last fetched
- prevText: null,
-
- // Number of results visible without scrolling
- visibleResults: 0,
-
- // Suggestion the last mousedown event occured on
- mouseDownOn: $( [] ),
- $textbox: $(this),
- selectedWithMouse: false
- };
-
- context.data.$container = $( '<div>' )
- .css( 'display', 'none' )
- .addClass( 'suggestions' )
- .append(
- $( '<div>' ).addClass( 'suggestions-results' )
- // Can't use click() because the container div is hidden when the
- // textbox loses focus. Instead, listen for a mousedown followed
- // by a mouseup on the same div.
- .mousedown( function ( e ) {
- context.data.mouseDownOn = $( e.target ).closest( '.suggestions-results .suggestions-result' );
- } )
- .mouseup( function ( e ) {
- var $result = $( e.target ).closest( '.suggestions-results .suggestions-result' ),
- $other = context.data.mouseDownOn;
-
- context.data.mouseDownOn = $( [] );
- if ( $result.get( 0 ) !== $other.get( 0 ) ) {
- return;
- }
- // do not interfere with non-left clicks or if modifier keys are pressed (e.g. ctrl-click)
- if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
- $.suggestions.highlight( context, $result, true );
- context.data.$container.hide();
- if ( typeof context.config.result.select === 'function' ) {
- context.config.result.select.call( $result, context.data.$textbox );
- }
- }
- // but still restore focus to the textbox, so that the suggestions will be hidden properly
- context.data.$textbox.focus();
- } )
- )
- .append(
- $( '<div>' ).addClass( 'suggestions-special' )
- // Can't use click() because the container div is hidden when the
- // textbox loses focus. Instead, listen for a mousedown followed
- // by a mouseup on the same div.
- .mousedown( function ( e ) {
- context.data.mouseDownOn = $( e.target ).closest( '.suggestions-special' );
- } )
- .mouseup( function ( e ) {
- var $special = $( e.target ).closest( '.suggestions-special' ),
- $other = context.data.mouseDownOn;
-
- context.data.mouseDownOn = $( [] );
- if ( $special.get( 0 ) !== $other.get( 0 ) ) {
- return;
- }
- // do not interfere with non-left clicks or if modifier keys are pressed (e.g. ctrl-click)
- if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
- context.data.$container.hide();
- if ( typeof context.config.special.select === 'function' ) {
- context.config.special.select.call( $special, context.data.$textbox );
- }
- }
- // but still restore focus to the textbox, so that the suggestions will be hidden properly
- context.data.$textbox.focus();
- } )
- .mousemove( function ( e ) {
- context.data.selectedWithMouse = true;
- $.suggestions.highlight(
- context, $( e.target ).closest( '.suggestions-special' ), false
- );
- } )
- )
- .appendTo( $( 'body' ) );
-
- $(this)
- // Stop browser autocomplete from interfering
- .attr( 'autocomplete', 'off')
- .keydown( function ( e ) {
- // Store key pressed to handle later
- context.data.keypressed = e.which;
- context.data.keypressedCount = 0;
-
- switch ( context.data.keypressed ) {
- // This preventDefault logic is duplicated from
- // $.suggestions.keypress(), which sucks
- // Arrow down
- case 40:
- e.preventDefault();
- e.stopImmediatePropagation();
- break;
- // Arrow up, Escape and Enter
- case 38:
- case 27:
- case 13:
- if ( context.data.$container.is( ':visible' ) ) {
- e.preventDefault();
- e.stopImmediatePropagation();
- }
- }
- } )
- .keypress( function ( e ) {
- context.data.keypressedCount++;
- $.suggestions.keypress( e, context, context.data.keypressed );
- } )
- .keyup( function ( e ) {
- // Some browsers won't throw keypress() for arrow keys. If we got a keydown and a keyup without a
- // keypress in between, solve it
- if ( context.data.keypressedCount === 0 ) {
- $.suggestions.keypress( e, context, context.data.keypressed );
- }
- } )
- .blur( function () {
- // When losing focus because of a mousedown
- // on a suggestion, don't hide the suggestions
- if ( context.data.mouseDownOn.length > 0 ) {
- return;
- }
- context.data.$container.hide();
- $.suggestions.cancel( context );
- } );
- }
-
- // Store the context for next time
- $(this).data( 'suggestions-context', context );
- } );
- return returnValue !== undefined ? returnValue : $(this);
-};
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.tabIndex.js b/resources/jquery/jquery.tabIndex.js
deleted file mode 100644
index cdae0bad..00000000
--- a/resources/jquery/jquery.tabIndex.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * jQuery tabIndex
- */
-( function ( $ ) {
-
- /**
- * Finds the lowerst tabindex in use within a selection
- *
- * @return number Lowest tabindex on the page
- */
- $.fn.firstTabIndex = function () {
- var minTabIndex = null;
- $(this).find( '[tabindex]' ).each( function () {
- var tabIndex = parseInt( $(this).prop( 'tabindex' ), 10 );
- // In IE6/IE7 the above jQuery selector returns all elements,
- // becuase it has a default value for tabIndex in IE6/IE7 of 0
- // (rather than null/undefined). Therefore check "> 0" as well.
- // Under IE7 under Windows NT 5.2 is also capable of returning NaN.
- if ( tabIndex > 0 && !isNaN( tabIndex ) ) {
- // Initial value
- if ( minTabIndex === null ) {
- minTabIndex = tabIndex;
- } else if ( tabIndex < minTabIndex ) {
- minTabIndex = tabIndex;
- }
- }
- } );
- return minTabIndex;
- };
-
- /**
- * Finds the highest tabindex in use within a selection
- *
- * @return number Highest tabindex on the page
- */
- $.fn.lastTabIndex = function () {
- var maxTabIndex = null;
- $(this).find( '[tabindex]' ).each( function () {
- var tabIndex = parseInt( $(this).prop( 'tabindex' ), 10 );
- if ( tabIndex > 0 && !isNaN( tabIndex ) ) {
- // Initial value
- if ( maxTabIndex === null ) {
- maxTabIndex = tabIndex;
- } else if ( tabIndex > maxTabIndex ) {
- maxTabIndex = tabIndex;
- }
- }
- } );
- return maxTabIndex;
- };
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.tablesorter.css b/resources/jquery/jquery.tablesorter.css
deleted file mode 100644
index a88acc09..00000000
--- a/resources/jquery/jquery.tablesorter.css
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Table Sorting */
-table.jquery-tablesorter th.headerSort {
- /* @embed */
- background-image: url(images/sort_both.gif);
- cursor: pointer;
- background-repeat: no-repeat;
- background-position: center right;
- padding-right: 21px;
-}
-table.jquery-tablesorter th.headerSortUp {
- /* @embed */
- background-image: url(images/sort_up.gif);
-}
-table.jquery-tablesorter th.headerSortDown {
- /* @embed */
- background-image: url(images/sort_down.gif);
-}
diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js
deleted file mode 100644
index b3d7bb3d..00000000
--- a/resources/jquery/jquery.tablesorter.js
+++ /dev/null
@@ -1,1113 +0,0 @@
-/**
- * TableSorter for MediaWiki
- *
- * Written 2011 Leo Koppelkamm
- * Based on tablesorter.com plugin, written (c) 2007 Christian Bach.
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Depends on mw.config (wgDigitTransformTable, wgDefaultDateFormat, wgContentLanguage)
- * and mw.language.months.
- *
- * Uses 'tableSorterCollation' in mw.config (if available)
- */
-/**
- *
- * @description Create a sortable table with multi-column sorting capabilitys
- *
- * @example $( 'table' ).tablesorter();
- * @desc Create a simple tablesorter interface.
- *
- * @example $( 'table' ).tablesorter( { sortList: [ { 0: 'desc' }, { 1: 'asc' } ] } );
- * @desc Create a tablesorter interface initially sorting on the first and second column.
- *
- * @option String cssHeader ( optional ) A string of the class name to be appended
- * to sortable tr elements in the thead of the table. Default value:
- * "header"
- *
- * @option String cssAsc ( optional ) A string of the class name to be appended to
- * sortable tr elements in the thead on a ascending sort. Default value:
- * "headerSortUp"
- *
- * @option String cssDesc ( optional ) A string of the class name to be appended
- * to sortable tr elements in the thead on a descending sort. Default
- * value: "headerSortDown"
- *
- * @option String sortInitialOrder ( optional ) A string of the inital sorting
- * order can be asc or desc. Default value: "asc"
- *
- * @option String sortMultisortKey ( optional ) A string of the multi-column sort
- * key. Default value: "shiftKey"
- *
- * @option Boolean sortLocaleCompare ( optional ) Boolean flag indicating whatever
- * to use String.localeCampare method or not. Set to false.
- *
- * @option Boolean cancelSelection ( optional ) Boolean flag indicating if
- * tablesorter should cancel selection of the table headers text.
- * Default value: true
- *
- * @option Array sortList ( optional ) An array containing objects specifying sorting.
- * By passing more than one object, multi-sorting will be applied. Object structure:
- * { <Integer column index>: <String 'asc' or 'desc'> }
- * Default value: []
- *
- * @option Boolean debug ( optional ) Boolean flag indicating if tablesorter
- * should display debuging information usefull for development.
- *
- * @event sortEnd.tablesorter: Triggered as soon as any sorting has been applied.
- *
- * @type jQuery
- *
- * @name tablesorter
- *
- * @cat Plugins/Tablesorter
- *
- * @author Christian Bach/christian.bach@polyester.se
- */
-
-( function ( $, mw ) {
- /*jshint onevar:false */
-
- /* Local scope */
-
- var ts,
- parsers = [];
-
- /* Parser utility functions */
-
- function getParserById( name ) {
- var len = parsers.length;
- for ( var i = 0; i < len; i++ ) {
- if ( parsers[i].id.toLowerCase() === name.toLowerCase() ) {
- return parsers[i];
- }
- }
- return false;
- }
-
- function getElementSortKey( node ) {
- var $node = $( node ),
- // Use data-sort-value attribute.
- // Use data() instead of attr() so that live value changes
- // are processed as well (bug 38152).
- data = $node.data( 'sortValue' );
-
- if ( data !== null && data !== undefined ) {
- // Cast any numbers or other stuff to a string, methods
- // like charAt, toLowerCase and split are expected.
- return String( data );
- } else {
- if ( !node ) {
- return $node.text();
- } else if ( node.tagName.toLowerCase() === 'img' ) {
- return $node.attr( 'alt' ) || ''; // handle undefined alt
- } else {
- return $.map( $.makeArray( node.childNodes ), function( elem ) {
- // 1 is for document.ELEMENT_NODE (the constant is undefined on old browsers)
- if ( elem.nodeType === 1 ) {
- return getElementSortKey( elem );
- } else {
- return $.text( elem );
- }
- } ).join( '' );
- }
- }
- }
-
- function detectParserForColumn( table, rows, cellIndex ) {
- var l = parsers.length,
- nodeValue,
- // Start with 1 because 0 is the fallback parser
- i = 1,
- rowIndex = 0,
- concurrent = 0,
- needed = ( rows.length > 4 ) ? 5 : rows.length;
-
- while ( i < l ) {
- if ( rows[rowIndex] && rows[rowIndex].cells[cellIndex] ) {
- nodeValue = $.trim( getElementSortKey( rows[rowIndex].cells[cellIndex] ) );
- } else {
- nodeValue = '';
- }
-
- if ( nodeValue !== '') {
- if ( parsers[i].is( nodeValue, table ) ) {
- concurrent++;
- rowIndex++;
- if ( concurrent >= needed ) {
- // Confirmed the parser for multiple cells, let's return it
- return parsers[i];
- }
- } else {
- // Check next parser, reset rows
- i++;
- rowIndex = 0;
- concurrent = 0;
- }
- } else {
- // Empty cell
- rowIndex++;
- if ( rowIndex > rows.length ) {
- rowIndex = 0;
- i++;
- }
- }
- }
-
- // 0 is always the generic parser (text)
- return parsers[0];
- }
-
- function buildParserCache( table, $headers ) {
- var rows = table.tBodies[0].rows,
- sortType,
- parsers = [];
-
- if ( rows[0] ) {
-
- var cells = rows[0].cells,
- len = cells.length,
- i, parser;
-
- for ( i = 0; i < len; i++ ) {
- parser = false;
- sortType = $headers.eq( i ).data( 'sortType' );
- if ( sortType !== undefined ) {
- parser = getParserById( sortType );
- }
-
- if ( parser === false ) {
- parser = detectParserForColumn( table, rows, i );
- }
-
- parsers.push( parser );
- }
- }
- return parsers;
- }
-
- /* Other utility functions */
-
- function buildCache( table ) {
- var totalRows = ( table.tBodies[0] && table.tBodies[0].rows.length ) || 0,
- totalCells = ( table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length ) || 0,
- parsers = table.config.parsers,
- cache = {
- row: [],
- normalized: []
- };
-
- for ( var i = 0; i < totalRows; ++i ) {
-
- // Add the table data to main data array
- var $row = $( table.tBodies[0].rows[i] ),
- cols = [];
-
- // if this is a child row, add it to the last row's children and
- // continue to the next row
- if ( $row.hasClass( table.config.cssChildRow ) ) {
- cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add( $row );
- // go to the next for loop
- continue;
- }
-
- cache.row.push( $row );
-
- for ( var j = 0; j < totalCells; ++j ) {
- cols.push( parsers[j].format( getElementSortKey( $row[0].cells[j] ), table, $row[0].cells[j] ) );
- }
-
- cols.push( cache.normalized.length ); // add position for rowCache
- cache.normalized.push( cols );
- cols = null;
- }
-
- return cache;
- }
-
- function appendToTable( table, cache ) {
- var row = cache.row,
- normalized = cache.normalized,
- totalRows = normalized.length,
- checkCell = ( normalized[0].length - 1 ),
- fragment = document.createDocumentFragment();
-
- for ( var i = 0; i < totalRows; i++ ) {
- var pos = normalized[i][checkCell];
-
- var l = row[pos].length;
-
- for ( var j = 0; j < l; j++ ) {
- fragment.appendChild( row[pos][j] );
- }
-
- }
- table.tBodies[0].appendChild( fragment );
-
- $( table ).trigger( 'sortEnd.tablesorter' );
- }
-
- /**
- * Find all header rows in a thead-less table and put them in a <thead> tag.
- * This only treats a row as a header row if it contains only <th>s (no <td>s)
- * and if it is preceded entirely by header rows. The algorithm stops when
- * it encounters the first non-header row.
- *
- * After this, it will look at all rows at the bottom for footer rows
- * And place these in a tfoot using similar rules.
- * @param $table jQuery object for a <table>
- */
- function emulateTHeadAndFoot( $table ) {
- var $rows = $table.find( '> tbody > tr' );
- if( !$table.get(0).tHead ) {
- var $thead = $( '<thead>' );
- $rows.each( function () {
- if ( $(this).children( 'td' ).length > 0 ) {
- // This row contains a <td>, so it's not a header row
- // Stop here
- return false;
- }
- $thead.append( this );
- } );
- $table.find(' > tbody:first').before( $thead );
- }
- if( !$table.get(0).tFoot ) {
- var $tfoot = $( '<tfoot>' );
- var len = $rows.length;
- for ( var i = len-1; i >= 0; i-- ) {
- if( $( $rows[i] ).children( 'td' ).length > 0 ){
- break;
- }
- $tfoot.prepend( $( $rows[i] ));
- }
- $table.append( $tfoot );
- }
- }
-
- function buildHeaders( table, msg ) {
- var maxSeen = 0,
- colspanOffset = 0,
- longest,
- columns,
- i,
- $tableHeaders = $( [] ),
- $tableRows = $( 'thead:eq(0) > tr', table );
- if ( $tableRows.length <= 1 ) {
- $tableHeaders = $tableRows.children( 'th' );
- } else {
- // We need to find the cells of the row containing the most columns
- var rowspan,
- headersIndex = [];
- $tableRows.each( function ( rowIndex ) {
- $.each( this.cells, function( index2, cell ) {
- rowspan = Number( cell.rowSpan );
- for ( i = 0; i < rowspan; i++ ) {
- if ( headersIndex[rowIndex+i] === undefined ) {
- headersIndex[rowIndex+i] = $( [] );
- }
- headersIndex[rowIndex+i].push( cell );
- }
- } );
- } );
- $.each( headersIndex, function ( index, cellArray ) {
- if ( cellArray.length >= maxSeen ) {
- maxSeen = cellArray.length;
- longest = index;
- }
- } );
- $tableHeaders = headersIndex[longest];
- }
-
- // as each header can span over multiple columns (using colspan=N),
- // we have to bidirectionally map headers to their columns and columns to their headers
- table.headerToColumns = [];
- table.columnToHeader = [];
-
- $tableHeaders.each( function ( headerIndex ) {
- columns = [];
- for ( i = 0; i < this.colSpan; i++ ) {
- table.columnToHeader[ colspanOffset + i ] = headerIndex;
- columns.push( colspanOffset + i );
- }
-
- table.headerToColumns[ headerIndex ] = columns;
- colspanOffset += this.colSpan;
-
- this.headerIndex = headerIndex;
- this.order = 0;
- this.count = 0;
-
- if ( $( this ).hasClass( table.config.unsortableClass ) ) {
- this.sortDisabled = true;
- }
-
- if ( !this.sortDisabled ) {
- $( this )
- .addClass( table.config.cssHeader )
- .prop( 'tabIndex', 0 )
- .attr( {
- role: 'columnheader button',
- title: msg[1]
- } );
- }
-
- // add cell to headerList
- table.config.headerList[headerIndex] = this;
- } );
-
- return $tableHeaders;
-
- }
-
- /**
- * Sets the sort count of the columns that are not affected by the sorting to have them sorted
- * in default (ascending) order when their header cell is clicked the next time.
- *
- * @param {jQuery} $headers
- * @param {Number[][]} sortList
- * @param {Number[][]} headerToColumns
- */
- function setHeadersOrder( $headers, sortList, headerToColumns ) {
- // Loop through all headers to retrieve the indices of the columns the header spans across:
- $.each( headerToColumns, function( headerIndex, columns ) {
-
- $.each( columns, function( i, columnIndex ) {
- var header = $headers[headerIndex];
-
- if ( !isValueInArray( columnIndex, sortList ) ) {
- // Column shall not be sorted: Reset header count and order.
- header.order = 0;
- header.count = 0;
- } else {
- // Column shall be sorted: Apply designated count and order.
- $.each( sortList, function( j, sortColumn ) {
- if ( sortColumn[0] === i ) {
- header.order = sortColumn[1];
- header.count = sortColumn[1] + 1;
- return false;
- }
- } );
- }
- } );
-
- } );
- }
-
- function isValueInArray( v, a ) {
- var l = a.length;
- for ( var i = 0; i < l; i++ ) {
- if ( a[i][0] === v ) {
- return true;
- }
- }
- return false;
- }
-
- function setHeadersCss( table, $headers, list, css, msg, columnToHeader ) {
- // Remove all header information and reset titles to default message
- $headers.removeClass( css[0] ).removeClass( css[1] ).attr( 'title', msg[1] );
-
- for ( var i = 0; i < list.length; i++ ) {
- $headers.eq( columnToHeader[ list[i][0] ] )
- .addClass( css[ list[i][1] ] )
- .attr( 'title', msg[ list[i][1] ] );
- }
- }
-
- function sortText( a, b ) {
- return ( (a < b) ? -1 : ((a > b) ? 1 : 0) );
- }
-
- function sortTextDesc( a, b ) {
- return ( (b < a) ? -1 : ((b > a) ? 1 : 0) );
- }
-
- function multisort( table, sortList, cache ) {
- var sortFn = [];
- var len = sortList.length;
- for ( var i = 0; i < len; i++ ) {
- sortFn[i] = ( sortList[i][1] ) ? sortTextDesc : sortText;
- }
- cache.normalized.sort( function ( array1, array2 ) {
- var col, ret;
- for ( var i = 0; i < len; i++ ) {
- col = sortList[i][0];
- ret = sortFn[i].call( this, array1[col], array2[col] );
- if ( ret !== 0 ) {
- return ret;
- }
- }
- // Fall back to index number column to ensure stable sort
- return sortText.call( this, array1[array1.length - 1], array2[array2.length - 1] );
- } );
- return cache;
- }
-
- function buildTransformTable() {
- var digits = '0123456789,.'.split( '' );
- var separatorTransformTable = mw.config.get( 'wgSeparatorTransformTable' );
- var digitTransformTable = mw.config.get( 'wgDigitTransformTable' );
- if ( separatorTransformTable === null || ( separatorTransformTable[0] === '' && digitTransformTable[2] === '' ) ) {
- ts.transformTable = false;
- } else {
- ts.transformTable = {};
-
- // Unpack the transform table
- var ascii = separatorTransformTable[0].split( '\t' ).concat( digitTransformTable[0].split( '\t' ) );
- var localised = separatorTransformTable[1].split( '\t' ).concat( digitTransformTable[1].split( '\t' ) );
-
- // Construct regex for number identification
- for ( var i = 0; i < ascii.length; i++ ) {
- ts.transformTable[localised[i]] = ascii[i];
- digits.push( $.escapeRE( localised[i] ) );
- }
- }
- var digitClass = '[' + digits.join( '', digits ) + ']';
-
- // We allow a trailing percent sign, which we just strip. This works fine
- // if percents and regular numbers aren't being mixed.
- ts.numberRegex = new RegExp('^(' + '[-+\u2212]?[0-9][0-9,]*(\\.[0-9,]*)?(E[-+\u2212]?[0-9][0-9,]*)?' + // Fortran-style scientific
- '|' + '[-+\u2212]?' + digitClass + '+[\\s\\xa0]*%?' + // Generic localised
- ')$', 'i');
- }
-
- function buildDateTable() {
- var regex = [];
- ts.monthNames = {};
-
- for ( var i = 0; i < 12; i++ ) {
- var name = mw.language.months.names[i].toLowerCase();
- ts.monthNames[name] = i + 1;
- regex.push( $.escapeRE( name ) );
- name = mw.language.months.genitive[i].toLowerCase();
- ts.monthNames[name] = i + 1;
- regex.push( $.escapeRE( name ) );
- name = mw.language.months.abbrev[i].toLowerCase().replace( '.', '' );
- ts.monthNames[name] = i + 1;
- regex.push( $.escapeRE( name ) );
- }
-
- // Build piped string
- regex = regex.join( '|' );
-
- // Build RegEx
- // Any date formated with . , ' - or /
- ts.dateRegex[0] = new RegExp( /^\s*(\d{1,2})[\,\.\-\/'\s]{1,2}(\d{1,2})[\,\.\-\/'\s]{1,2}(\d{2,4})\s*?/i);
-
- // Written Month name, dmy
- ts.dateRegex[1] = new RegExp( '^\\s*(\\d{1,2})[\\,\\.\\-\\/\'\\s]+(' + regex + ')' + '[\\,\\.\\-\\/\'\\s]+(\\d{2,4})\\s*$', 'i' );
-
- // Written Month name, mdy
- ts.dateRegex[2] = new RegExp( '^\\s*(' + regex + ')' + '[\\,\\.\\-\\/\'\\s]+(\\d{1,2})[\\,\\.\\-\\/\'\\s]+(\\d{2,4})\\s*$', 'i' );
-
- }
-
- /**
- * Replace all rowspanned cells in the body with clones in each row, so sorting
- * need not worry about them.
- *
- * @param $table jQuery object for a <table>
- */
- function explodeRowspans( $table ) {
- var rowspanCells = $table.find( '> tbody > tr > [rowspan]' ).get();
-
- // Short circuit
- if ( !rowspanCells.length ) {
- return;
- }
-
- // First, we need to make a property like cellIndex but taking into
- // account colspans. We also cache the rowIndex to avoid having to take
- // cell.parentNode.rowIndex in the sorting function below.
- $table.find( '> tbody > tr' ).each( function () {
- var col = 0;
- var l = this.cells.length;
- for ( var i = 0; i < l; i++ ) {
- this.cells[i].realCellIndex = col;
- this.cells[i].realRowIndex = this.rowIndex;
- col += this.cells[i].colSpan;
- }
- } );
-
- // Split multi row cells into multiple cells with the same content.
- // Sort by column then row index to avoid problems with odd table structures.
- // Re-sort whenever a rowspanned cell's realCellIndex is changed, because it
- // might change the sort order.
- function resortCells() {
- rowspanCells = rowspanCells.sort( function ( a, b ) {
- var ret = a.realCellIndex - b.realCellIndex;
- if ( !ret ) {
- ret = a.realRowIndex - b.realRowIndex;
- }
- return ret;
- } );
- $.each( rowspanCells, function () {
- this.needResort = false;
- } );
- }
- resortCells();
-
- var spanningRealCellIndex, rowSpan, colSpan;
- function filterfunc() {
- return this.realCellIndex >= spanningRealCellIndex;
- }
-
- function fixTdCellIndex() {
- this.realCellIndex += colSpan;
- if ( this.rowSpan > 1 ) {
- this.needResort = true;
- }
- }
-
- while ( rowspanCells.length ) {
- if ( rowspanCells[0].needResort ) {
- resortCells();
- }
-
- var cell = rowspanCells.shift();
- rowSpan = cell.rowSpan;
- colSpan = cell.colSpan;
- spanningRealCellIndex = cell.realCellIndex;
- cell.rowSpan = 1;
- var $nextRows = $( cell ).parent().nextAll();
- for ( var i = 0; i < rowSpan - 1; i++ ) {
- var $tds = $( $nextRows[i].cells ).filter( filterfunc );
- var $clone = $( cell ).clone();
- $clone[0].realCellIndex = spanningRealCellIndex;
- if ( $tds.length ) {
- $tds.each( fixTdCellIndex );
- $tds.first().before( $clone );
- } else {
- $nextRows.eq( i ).append( $clone );
- }
- }
- }
- }
-
- function buildCollationTable() {
- ts.collationTable = mw.config.get( 'tableSorterCollation' );
- ts.collationRegex = null;
- if ( ts.collationTable ) {
- var keys = [];
-
- // Build array of key names
- for ( var key in ts.collationTable ) {
- if ( ts.collationTable.hasOwnProperty(key) ) { //to be safe
- keys.push(key);
- }
- }
- if (keys.length) {
- ts.collationRegex = new RegExp( '[' + keys.join( '' ) + ']', 'ig' );
- }
- }
- }
-
- function cacheRegexs() {
- if ( ts.rgx ) {
- return;
- }
- ts.rgx = {
- IPAddress: [
- new RegExp( /^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/)
- ],
- currency: [
- new RegExp( /(^[£$€¥]|[£$€¥]$)/),
- new RegExp( /[£$€¥]/g)
- ],
- url: [
- new RegExp( /^(https?|ftp|file):\/\/$/),
- new RegExp( /(https?|ftp|file):\/\//)
- ],
- isoDate: [
- new RegExp( /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/)
- ],
- usLongDate: [
- new RegExp( /^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/)
- ],
- time: [
- new RegExp( /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/)
- ]
- };
- }
-
- /**
- * Converts sort objects [ { Integer: String }, ... ] to the internally used nested array
- * structure [ [ Integer , Integer ], ... ]
- *
- * @param sortObjects {Array} List of sort objects.
- * @return {Array} List of internal sort definitions.
- */
-
- function convertSortList( sortObjects ) {
- var sortList = [];
- $.each( sortObjects, function( i, sortObject ) {
- $.each ( sortObject, function( columnIndex, order ) {
- var orderIndex = ( order === 'desc' ) ? 1 : 0;
- sortList.push( [parseInt( columnIndex, 10 ), orderIndex] );
- } );
- } );
- return sortList;
- }
-
- /* Public scope */
-
- $.tablesorter = {
-
- defaultOptions: {
- cssHeader: 'headerSort',
- cssAsc: 'headerSortUp',
- cssDesc: 'headerSortDown',
- cssChildRow: 'expand-child',
- sortInitialOrder: 'asc',
- sortMultiSortKey: 'shiftKey',
- sortLocaleCompare: false,
- unsortableClass: 'unsortable',
- parsers: {},
- widgets: [],
- headers: {},
- cancelSelection: true,
- sortList: [],
- headerList: [],
- selectorHeaders: 'thead tr:eq(0) th',
- debug: false
- },
-
- dateRegex: [],
- monthNames: {},
-
- /**
- * @param $tables {jQuery}
- * @param settings {Object} (optional)
- */
- construct: function ( $tables, settings ) {
- return $tables.each( function ( i, table ) {
- // Declare and cache.
- var $headers, cache, config,
- $table = $( table ),
- firstTime = true;
-
- // Quit if no tbody
- if ( !table.tBodies ) {
- return;
- }
- if ( !table.tHead ) {
- // No thead found. Look for rows with <th>s and
- // move them into a <thead> tag or a <tfoot> tag
- emulateTHeadAndFoot( $table );
-
- // Still no thead? Then quit
- if ( !table.tHead ) {
- return;
- }
- }
- $table.addClass( 'jquery-tablesorter' );
-
- // FIXME config should probably not be stored in the plain table node
- // New config object.
- table.config = {};
-
- // Merge and extend.
- config = $.extend( table.config, $.tablesorter.defaultOptions, settings );
-
- // Save the settings where they read
- $.data( table, 'tablesorter', { config: config } );
-
- // Get the CSS class names, could be done else where.
- var sortCSS = [ config.cssDesc, config.cssAsc ];
- var sortMsg = [ mw.msg( 'sort-descending' ), mw.msg( 'sort-ascending' ) ];
-
- // Build headers
- $headers = buildHeaders( table, sortMsg );
-
- // Grab and process locale settings.
- buildTransformTable();
- buildDateTable();
-
- // Precaching regexps can bring 10 fold
- // performance improvements in some browsers.
- cacheRegexs();
-
- function setupForFirstSort() {
- firstTime = false;
-
- // Defer buildCollationTable to first sort. As user and site scripts
- // may customize tableSorterCollation but load after $.ready(), other
- // scripts may call .tablesorter() before they have done the
- // tableSorterCollation customizations.
- buildCollationTable();
-
- // Legacy fix of .sortbottoms
- // Wrap them inside inside a tfoot (because that's what they actually want to be) &
- // and put the <tfoot> at the end of the <table>
- var $sortbottoms = $table.find( '> tbody > tr.sortbottom' );
- if ( $sortbottoms.length ) {
- var $tfoot = $table.children( 'tfoot' );
- if ( $tfoot.length ) {
- $tfoot.eq(0).prepend( $sortbottoms );
- } else {
- $table.append( $( '<tfoot>' ).append( $sortbottoms ) );
- }
- }
-
- explodeRowspans( $table );
-
- // try to auto detect column type, and store in tables config
- table.config.parsers = buildParserCache( table, $headers );
- }
-
- // Apply event handling to headers
- // this is too big, perhaps break it out?
- $headers.not( '.' + table.config.unsortableClass ).on( 'keypress click', function ( e ) {
- if ( e.type === 'click' && e.target.nodeName.toLowerCase() === 'a' ) {
- // The user clicked on a link inside a table header.
- // Do nothing and let the default link click action continue.
- return true;
- }
-
- if ( e.type === 'keypress' && e.which !== 13 ) {
- // Only handle keypresses on the "Enter" key.
- return true;
- }
-
- if ( firstTime ) {
- setupForFirstSort();
- }
-
- // Build the cache for the tbody cells
- // to share between calculations for this sort action.
- // Re-calculated each time a sort action is performed due to possiblity
- // that sort values change. Shouldn't be too expensive, but if it becomes
- // too slow an event based system should be implemented somehow where
- // cells get event .change() and bubbles up to the <table> here
- cache = buildCache( table );
-
- var totalRows = ( $table[0].tBodies[0] && $table[0].tBodies[0].rows.length ) || 0;
- if ( !table.sortDisabled && totalRows > 0 ) {
- // Get current column sort order
- this.order = this.count % 2;
- this.count++;
-
- var cell = this;
- // Get current column index
- var columns = table.headerToColumns[ this.headerIndex ];
- var newSortList = $.map( columns, function (c) {
- // jQuery "helpfully" flattens the arrays...
- return [[c, cell.order]];
- });
- // Index of first column belonging to this header
- var i = columns[0];
-
- if ( !e[config.sortMultiSortKey] ) {
- // User only wants to sort on one column set
- // Flush the sort list and add new columns
- config.sortList = newSortList;
- } else {
- // Multi column sorting
- // It is not possible for one column to belong to multiple headers,
- // so this is okay - we don't need to check for every value in the columns array
- if ( isValueInArray( i, config.sortList ) ) {
- // The user has clicked on an already sorted column.
- // Reverse the sorting direction for all tables.
- for ( var j = 0; j < config.sortList.length; j++ ) {
- var s = config.sortList[j],
- o = config.headerList[s[0]];
- if ( isValueInArray( s[0], newSortList ) ) {
- o.count = s[1];
- o.count++;
- s[1] = o.count % 2;
- }
- }
- } else {
- // Add columns to sort list array
- config.sortList = config.sortList.concat( newSortList );
- }
- }
-
- // Reset order/counts of cells not affected by sorting
- setHeadersOrder( $headers, config.sortList, table.headerToColumns );
-
- // Set CSS for headers
- setHeadersCss( $table[0], $headers, config.sortList, sortCSS, sortMsg, table.columnToHeader );
- appendToTable(
- $table[0], multisort( $table[0], config.sortList, cache )
- );
-
- // Stop normal event by returning false
- return false;
- }
-
- // Cancel selection
- } ).mousedown( function () {
- if ( config.cancelSelection ) {
- this.onselectstart = function () {
- return false;
- };
- return false;
- }
- } );
-
- /**
- * Sorts the table. If no sorting is specified by passing a list of sort
- * objects, the table is sorted according to the initial sorting order.
- * Passing an empty array will reset sorting (basically just reset the headers
- * making the table appear unsorted).
- *
- * @param sortList {Array} (optional) List of sort objects.
- */
- $table.data( 'tablesorter' ).sort = function( sortList ) {
-
- if ( firstTime ) {
- setupForFirstSort();
- }
-
- if ( sortList === undefined ) {
- sortList = config.sortList;
- } else if ( sortList.length > 0 ) {
- sortList = convertSortList( sortList );
- }
-
- // Set each column's sort count to be able to determine the correct sort
- // order when clicking on a header cell the next time
- setHeadersOrder( $headers, sortList, table.headerToColumns );
-
- // re-build the cache for the tbody cells
- cache = buildCache( table );
-
- // set css for headers
- setHeadersCss( table, $headers, sortList, sortCSS, sortMsg, table.columnToHeader );
-
- // sort the table and append it to the dom
- appendToTable( table, multisort( table, sortList, cache ) );
- };
-
- // sort initially
- if ( config.sortList.length > 0 ) {
- setupForFirstSort();
- config.sortList = convertSortList( config.sortList );
- $table.data( 'tablesorter' ).sort();
- }
-
- } );
- },
-
- addParser: function ( parser ) {
- var l = parsers.length,
- a = true;
- for ( var i = 0; i < l; i++ ) {
- if ( parsers[i].id.toLowerCase() === parser.id.toLowerCase() ) {
- a = false;
- }
- }
- if ( a ) {
- parsers.push( parser );
- }
- },
-
- formatDigit: function ( s ) {
- var out, c, p, i;
- if ( ts.transformTable !== false ) {
- out = '';
- for ( p = 0; p < s.length; p++ ) {
- c = s.charAt(p);
- if ( c in ts.transformTable ) {
- out += ts.transformTable[c];
- } else {
- out += c;
- }
- }
- s = out;
- }
- i = parseFloat( s.replace( /[, ]/g, '' ).replace( '\u2212', '-' ) );
- return isNaN( i ) ? 0 : i;
- },
-
- formatFloat: function ( s ) {
- var i = parseFloat(s);
- return isNaN( i ) ? 0 : i;
- },
-
- formatInt: function ( s ) {
- var i = parseInt( s, 10 );
- return isNaN( i ) ? 0 : i;
- },
-
- clearTableBody: function ( table ) {
- $( table.tBodies[0] ).empty();
- }
- };
-
- // Shortcut
- ts = $.tablesorter;
-
- // Register as jQuery prototype method
- $.fn.tablesorter = function ( settings ) {
- return ts.construct( this, settings );
- };
-
- // Add default parsers
- ts.addParser( {
- id: 'text',
- is: function () {
- return true;
- },
- format: function ( s ) {
- s = $.trim( s.toLowerCase() );
- if ( ts.collationRegex ) {
- var tsc = ts.collationTable;
- s = s.replace( ts.collationRegex, function ( match ) {
- var r = tsc[match] ? tsc[match] : tsc[match.toUpperCase()];
- return r.toLowerCase();
- } );
- }
- return s;
- },
- type: 'text'
- } );
-
- ts.addParser( {
- id: 'IPAddress',
- is: function ( s ) {
- return ts.rgx.IPAddress[0].test(s);
- },
- format: function ( s ) {
- var a = s.split( '.' ),
- r = '',
- l = a.length;
- for ( var i = 0; i < l; i++ ) {
- var item = a[i];
- if ( item.length === 1 ) {
- r += '00' + item;
- } else if ( item.length === 2 ) {
- r += '0' + item;
- } else {
- r += item;
- }
- }
- return $.tablesorter.formatFloat(r);
- },
- type: 'numeric'
- } );
-
- ts.addParser( {
- id: 'currency',
- is: function ( s ) {
- return ts.rgx.currency[0].test(s);
- },
- format: function ( s ) {
- return $.tablesorter.formatDigit( s.replace( ts.rgx.currency[1], '' ) );
- },
- type: 'numeric'
- } );
-
- ts.addParser( {
- id: 'url',
- is: function ( s ) {
- return ts.rgx.url[0].test(s);
- },
- format: function ( s ) {
- return $.trim( s.replace( ts.rgx.url[1], '' ) );
- },
- type: 'text'
- } );
-
- ts.addParser( {
- id: 'isoDate',
- is: function ( s ) {
- return ts.rgx.isoDate[0].test(s);
- },
- format: function ( s ) {
- return $.tablesorter.formatFloat((s !== '') ? new Date(s.replace(
- new RegExp( /-/g), '/')).getTime() : '0' );
- },
- type: 'numeric'
- } );
-
- ts.addParser( {
- id: 'usLongDate',
- is: function ( s ) {
- return ts.rgx.usLongDate[0].test(s);
- },
- format: function ( s ) {
- return $.tablesorter.formatFloat( new Date(s).getTime() );
- },
- type: 'numeric'
- } );
-
- ts.addParser( {
- id: 'date',
- is: function ( s ) {
- return ( ts.dateRegex[0].test(s) || ts.dateRegex[1].test(s) || ts.dateRegex[2].test(s ));
- },
- format: function ( s ) {
- var match;
- s = $.trim( s.toLowerCase() );
-
- if ( ( match = s.match( ts.dateRegex[0] ) ) !== null ) {
- if ( mw.config.get( 'wgDefaultDateFormat' ) === 'mdy' || mw.config.get( 'wgContentLanguage' ) === 'en' ) {
- s = [ match[3], match[1], match[2] ];
- } else if ( mw.config.get( 'wgDefaultDateFormat' ) === 'dmy' ) {
- s = [ match[3], match[2], match[1] ];
- } else {
- // If we get here, we don't know which order the dd-dd-dddd
- // date is in. So return something not entirely invalid.
- return '99999999';
- }
- } else if ( ( match = s.match( ts.dateRegex[1] ) ) !== null ) {
- s = [ match[3], '' + ts.monthNames[match[2]], match[1] ];
- } else if ( ( match = s.match( ts.dateRegex[2] ) ) !== null ) {
- s = [ match[3], '' + ts.monthNames[match[1]], match[2] ];
- } else {
- // Should never get here
- return '99999999';
- }
-
- // Pad Month and Day
- if ( s[1].length === 1 ) {
- s[1] = '0' + s[1];
- }
- if ( s[2].length === 1 ) {
- s[2] = '0' + s[2];
- }
-
- var y;
- if ( ( y = parseInt( s[0], 10) ) < 100 ) {
- // Guestimate years without centuries
- if ( y < 30 ) {
- s[0] = 2000 + y;
- } else {
- s[0] = 1900 + y;
- }
- }
- while ( s[0].length < 4 ) {
- s[0] = '0' + s[0];
- }
- return parseInt( s.join( '' ), 10 );
- },
- type: 'numeric'
- } );
-
- ts.addParser( {
- id: 'time',
- is: function ( s ) {
- return ts.rgx.time[0].test(s);
- },
- format: function ( s ) {
- return $.tablesorter.formatFloat( new Date( '2000/01/01 ' + s ).getTime() );
- },
- type: 'numeric'
- } );
-
- ts.addParser( {
- id: 'number',
- is: function ( s ) {
- return $.tablesorter.numberRegex.test( $.trim( s ));
- },
- format: function ( s ) {
- return $.tablesorter.formatDigit(s);
- },
- type: 'numeric'
- } );
-
-}( jQuery, mediaWiki ) );
diff --git a/resources/jquery/jquery.textSelection.js b/resources/jquery/jquery.textSelection.js
deleted file mode 100644
index 2b5a4406..00000000
--- a/resources/jquery/jquery.textSelection.js
+++ /dev/null
@@ -1,573 +0,0 @@
-/**
- * These plugins provide extra functionality for interaction with textareas.
- */
-( function ( $ ) {
- /*jshint noempty:false */
-
- if ( document.selection && document.selection.createRange ) {
- // On IE, patch the focus() method to restore the windows' scroll position
- // (bug 32241)
- $.fn.extend({
- focus: ( function ( jqFocus ) {
- return function () {
- var $w, state, result;
- if ( arguments.length === 0 ) {
- $w = $( window );
- state = {top: $w.scrollTop(), left: $w.scrollLeft()};
- result = jqFocus.apply( this, arguments );
- window.scrollTo( state.top, state.left );
- return result;
- }
- return jqFocus.apply( this, arguments );
- };
- }( $.fn.focus ) )
- });
- }
-
- $.fn.textSelection = function ( command, options ) {
- var fn,
- context,
- hasIframe,
- needSave,
- retval;
-
- /**
- * Helper function to get an IE TextRange object for an element
- */
- function rangeForElementIE( e ) {
- if ( e.nodeName.toLowerCase() === 'input' ) {
- return e.createTextRange();
- } else {
- var sel = document.body.createTextRange();
- sel.moveToElementText( e );
- return sel;
- }
- }
-
- /**
- * Helper function for IE for activating the textarea. Called only in the
- * IE-specific code paths below; makes use of IE-specific non-standard
- * function setActive() if possible to avoid screen flicker.
- */
- function activateElementOnIE( element ) {
- if ( element.setActive ) {
- element.setActive(); // bug 32241: doesn't scroll
- } else {
- $( element ).focus(); // may scroll (but we patched it above)
- }
- }
-
- fn = {
- /**
- * Get the contents of the textarea
- */
- getContents: function () {
- return this.val();
- },
- /**
- * Get the currently selected text in this textarea. Will focus the textarea
- * in some browsers (IE/Opera)
- */
- getSelection: function () {
- var retval, range,
- el = this.get( 0 );
-
- if ( $(el).is( ':hidden' ) ) {
- // Do nothing
- retval = '';
- } else if ( document.selection && document.selection.createRange ) {
- activateElementOnIE( el );
- range = document.selection.createRange();
- retval = range.text;
- } else if ( el.selectionStart || el.selectionStart === 0 ) {
- retval = el.value.substring( el.selectionStart, el.selectionEnd );
- }
-
- return retval;
- },
- /**
- * Ported from skins/common/edit.js by Trevor Parscal
- * (c) 2009 Wikimedia Foundation (GPLv2) - http://www.wikimedia.org
- *
- * Inserts text at the beginning and end of a text selection, optionally
- * inserting text at the caret when selection is empty.
- *
- * @fixme document the options parameters
- */
- encapsulateSelection: function ( options ) {
- return this.each( function () {
- var selText, scrollTop, insertText,
- isSample, range, range2, range3, startPos, endPos,
- pre = options.pre,
- post = options.post;
-
- /**
- * Check if the selected text is the same as the insert text
- */
- function checkSelectedText() {
- if ( !selText ) {
- selText = options.peri;
- isSample = true;
- } else if ( options.replace ) {
- selText = options.peri;
- } else {
- while ( selText.charAt( selText.length - 1 ) === ' ' ) {
- // Exclude ending space char
- selText = selText.substring( 0, selText.length - 1 );
- post += ' ';
- }
- while ( selText.charAt( 0 ) === ' ' ) {
- // Exclude prepending space char
- selText = selText.substring( 1, selText.length );
- pre = ' ' + pre;
- }
- }
- }
-
- /**
- * Do the splitlines stuff.
- *
- * Wrap each line of the selected text with pre and post
- */
- function doSplitLines( selText, pre, post ) {
- var i,
- insertText = '',
- selTextArr = selText.split( '\n' );
- for ( i = 0; i < selTextArr.length; i++ ) {
- insertText += pre + selTextArr[i] + post;
- if ( i !== selTextArr.length - 1 ) {
- insertText += '\n';
- }
- }
- return insertText;
- }
-
- isSample = false;
- if ( this.style.display === 'none' ) {
- // Do nothing
- } else if ( document.selection && document.selection.createRange ) {
- // IE
-
- // Note that IE9 will trigger the next section unless we check this first.
- // See bug 35201.
-
- activateElementOnIE( this );
- if ( context ) {
- context.fn.restoreCursorAndScrollTop();
- }
- if ( options.selectionStart !== undefined ) {
- $(this).textSelection( 'setSelection', { 'start': options.selectionStart, 'end': options.selectionEnd } );
- }
-
- selText = $(this).textSelection( 'getSelection' );
- scrollTop = this.scrollTop;
- range = document.selection.createRange();
-
- checkSelectedText();
- insertText = pre + selText + post;
- if ( options.splitlines ) {
- insertText = doSplitLines( selText, pre, post );
- }
- if ( options.ownline && range.moveStart ) {
- range2 = document.selection.createRange();
- range2.collapse();
- range2.moveStart( 'character', -1 );
- // FIXME: Which check is correct?
- if ( range2.text !== '\r' && range2.text !== '\n' && range2.text !== '' ) {
- insertText = '\n' + insertText;
- pre += '\n';
- }
- range3 = document.selection.createRange();
- range3.collapse( false );
- range3.moveEnd( 'character', 1 );
- if ( range3.text !== '\r' && range3.text !== '\n' && range3.text !== '' ) {
- insertText += '\n';
- post += '\n';
- }
- }
-
- range.text = insertText;
- if ( isSample && options.selectPeri && range.moveStart ) {
- range.moveStart( 'character', - post.length - selText.length );
- range.moveEnd( 'character', - post.length );
- }
- range.select();
- // Restore the scroll position
- this.scrollTop = scrollTop;
- } else if ( this.selectionStart || this.selectionStart === 0 ) {
- // Mozilla/Opera
-
- $(this).focus();
- if ( options.selectionStart !== undefined ) {
- $(this).textSelection( 'setSelection', { 'start': options.selectionStart, 'end': options.selectionEnd } );
- }
-
- selText = $(this).textSelection( 'getSelection' );
- startPos = this.selectionStart;
- endPos = this.selectionEnd;
- scrollTop = this.scrollTop;
- checkSelectedText();
- if ( options.selectionStart !== undefined
- && endPos - startPos !== options.selectionEnd - options.selectionStart )
- {
- // This means there is a difference in the selection range returned by browser and what we passed.
- // This happens for Chrome in the case of composite characters. Ref bug #30130
- // Set the startPos to the correct position.
- startPos = options.selectionStart;
- }
-
- insertText = pre + selText + post;
- if ( options.splitlines ) {
- insertText = doSplitLines( selText, pre, post );
- }
- if ( options.ownline ) {
- if ( startPos !== 0 && this.value.charAt( startPos - 1 ) !== '\n' && this.value.charAt( startPos - 1 ) !== '\r' ) {
- insertText = '\n' + insertText;
- pre += '\n';
- }
- if ( this.value.charAt( endPos ) !== '\n' && this.value.charAt( endPos ) !== '\r' ) {
- insertText += '\n';
- post += '\n';
- }
- }
- this.value = this.value.substring( 0, startPos ) + insertText +
- this.value.substring( endPos, this.value.length );
- // Setting this.value scrolls the textarea to the top, restore the scroll position
- this.scrollTop = scrollTop;
- if ( window.opera ) {
- pre = pre.replace( /\r?\n/g, '\r\n' );
- selText = selText.replace( /\r?\n/g, '\r\n' );
- post = post.replace( /\r?\n/g, '\r\n' );
- }
- if ( isSample && options.selectPeri && !options.splitlines ) {
- this.selectionStart = startPos + pre.length;
- this.selectionEnd = startPos + pre.length + selText.length;
- } else {
- this.selectionStart = startPos + insertText.length;
- this.selectionEnd = this.selectionStart;
- }
- }
- $(this).trigger( 'encapsulateSelection', [ options.pre, options.peri, options.post, options.ownline,
- options.replace, options.spitlines ] );
- });
- },
- /**
- * Ported from Wikia's LinkSuggest extension
- * https://svn.wikia-code.com/wikia/trunk/extensions/wikia/LinkSuggest
- * Some code copied from
- * http://www.dedestruct.com/2008/03/22/howto-cross-browser-cursor-position-in-textareas/
- *
- * Get the position (in resolution of bytes not necessarily characters)
- * in a textarea
- *
- * Will focus the textarea in some browsers (IE/Opera)
- *
- * @fixme document the options parameters
- */
- getCaretPosition: function ( options ) {
- function getCaret( e ) {
- var caretPos = 0,
- endPos = 0,
- preText, rawPreText, periText,
- rawPeriText, postText, rawPostText,
- // IE Support
- preFinished,
- periFinished,
- postFinished,
- // Range containing text in the selection
- periRange,
- // Range containing text before the selection
- preRange,
- // Range containing text after the selection
- postRange;
-
- if ( document.selection && document.selection.createRange ) {
- // IE doesn't properly report non-selected caret position through
- // the selection ranges when textarea isn't focused. This can
- // lead to saving a bogus empty selection, which then screws up
- // whatever we do later (bug 31847).
- activateElementOnIE( e );
-
- preFinished = false;
- periFinished = false;
- postFinished = false;
- periRange = document.selection.createRange().duplicate();
-
- preRange = rangeForElementIE( e );
- // Move the end where we need it
- preRange.setEndPoint( 'EndToStart', periRange );
-
- postRange = rangeForElementIE( e );
- // Move the start where we need it
- postRange.setEndPoint( 'StartToEnd', periRange );
-
- // Load the text values we need to compare
- preText = rawPreText = preRange.text;
- periText = rawPeriText = periRange.text;
- postText = rawPostText = postRange.text;
-
- /*
- * Check each range for trimmed newlines by shrinking the range by 1
- * character and seeing if the text property has changed. If it has
- * not changed then we know that IE has trimmed a \r\n from the end.
- */
- do {
- if ( !preFinished ) {
- if ( preRange.compareEndPoints( 'StartToEnd', preRange ) === 0 ) {
- preFinished = true;
- } else {
- preRange.moveEnd( 'character', -1 );
- if ( preRange.text === preText ) {
- rawPreText += '\r\n';
- } else {
- preFinished = true;
- }
- }
- }
- if ( !periFinished ) {
- if ( periRange.compareEndPoints( 'StartToEnd', periRange ) === 0 ) {
- periFinished = true;
- } else {
- periRange.moveEnd( 'character', -1 );
- if ( periRange.text === periText ) {
- rawPeriText += '\r\n';
- } else {
- periFinished = true;
- }
- }
- }
- if ( !postFinished ) {
- if ( postRange.compareEndPoints( 'StartToEnd', postRange ) === 0 ) {
- postFinished = true;
- } else {
- postRange.moveEnd( 'character', -1 );
- if ( postRange.text === postText ) {
- rawPostText += '\r\n';
- } else {
- postFinished = true;
- }
- }
- }
- } while ( ( !preFinished || !periFinished || !postFinished ) );
- caretPos = rawPreText.replace( /\r\n/g, '\n' ).length;
- endPos = caretPos + rawPeriText.replace( /\r\n/g, '\n' ).length;
- } else if ( e.selectionStart || e.selectionStart === 0 ) {
- // Firefox support
- caretPos = e.selectionStart;
- endPos = e.selectionEnd;
- }
- return options.startAndEnd ? [ caretPos, endPos ] : caretPos;
- }
- return getCaret( this.get( 0 ) );
- },
- /**
- * @fixme document the options parameters
- */
- setSelection: function ( options ) {
- return this.each( function () {
- var selection, length, newLines;
- if ( $(this).is( ':hidden' ) ) {
- // Do nothing
- } else if ( this.selectionStart || this.selectionStart === 0 ) {
- // Opera 9.0 doesn't allow setting selectionStart past
- // selectionEnd; any attempts to do that will be ignored
- // Make sure to set them in the right order
- if ( options.start > this.selectionEnd ) {
- this.selectionEnd = options.end;
- this.selectionStart = options.start;
- } else {
- this.selectionStart = options.start;
- this.selectionEnd = options.end;
- }
- } else if ( document.body.createTextRange ) {
- selection = rangeForElementIE( this );
- length = this.value.length;
- // IE doesn't count \n when computing the offset, so we won't either
- newLines = this.value.match( /\n/g );
- if ( newLines ) {
- length = length - newLines.length;
- }
- selection.moveStart( 'character', options.start );
- selection.moveEnd( 'character', -length + options.end );
-
- // This line can cause an error under certain circumstances (textarea empty, no selection)
- // Silence that error
- try {
- selection.select();
- } catch ( e ) { }
- }
- });
- },
- /**
- * Ported from Wikia's LinkSuggest extension
- * https://svn.wikia-code.com/wikia/trunk/extensions/wikia/LinkSuggest
- *
- * Scroll a textarea to the current cursor position. You can set the cursor
- * position with setSelection()
- * @param options boolean Whether to force a scroll even if the caret position
- * is already visible. Defaults to false
- *
- * @fixme document the options parameters (function body suggests options.force is a boolean, not options itself)
- */
- scrollToCaretPosition: function ( options ) {
- function getLineLength( e ) {
- return Math.floor( e.scrollWidth / ( $.client.profile().platform === 'linux' ? 7 : 8 ) );
- }
- function getCaretScrollPosition( e ) {
- // FIXME: This functions sucks and is off by a few lines most
- // of the time. It should be replaced by something decent.
- var i, j,
- nextSpace,
- text = e.value.replace( /\r/g, '' ),
- caret = $( e ).textSelection( 'getCaretPosition' ),
- lineLength = getLineLength( e ),
- row = 0,
- charInLine = 0,
- lastSpaceInLine = 0;
-
- for ( i = 0; i < caret; i++ ) {
- charInLine++;
- if ( text.charAt( i ) === ' ' ) {
- lastSpaceInLine = charInLine;
- } else if ( text.charAt( i ) === '\n' ) {
- lastSpaceInLine = 0;
- charInLine = 0;
- row++;
- }
- if ( charInLine > lineLength ) {
- if ( lastSpaceInLine > 0 ) {
- charInLine = charInLine - lastSpaceInLine;
- lastSpaceInLine = 0;
- row++;
- }
- }
- }
- nextSpace = 0;
- for ( j = caret; j < caret + lineLength; j++ ) {
- if (
- text.charAt( j ) === ' ' ||
- text.charAt( j ) === '\n' ||
- caret === text.length
- ) {
- nextSpace = j;
- break;
- }
- }
- if ( nextSpace > lineLength && caret <= lineLength ) {
- charInLine = caret - lastSpaceInLine;
- row++;
- }
- return ( $.client.profile().platform === 'mac' ? 13 : ( $.client.profile().platform === 'linux' ? 15 : 16 ) ) * row;
- }
- return this.each(function () {
- var scroll, range, savedRange, pos, oldScrollTop;
- if ( $(this).is( ':hidden' ) ) {
- // Do nothing
- } else if ( this.selectionStart || this.selectionStart === 0 ) {
- // Mozilla
- scroll = getCaretScrollPosition( this );
- if ( options.force || scroll < $(this).scrollTop() ||
- scroll > $(this).scrollTop() + $(this).height() ) {
- $(this).scrollTop( scroll );
- }
- } else if ( document.selection && document.selection.createRange ) {
- // IE / Opera
- /*
- * IE automatically scrolls the selected text to the
- * bottom of the textarea at range.select() time, except
- * if it was already in view and the cursor position
- * wasn't changed, in which case it does nothing. To
- * cover that case, we'll force it to act by moving one
- * character back and forth.
- */
- range = document.body.createTextRange();
- savedRange = document.selection.createRange();
- pos = $(this).textSelection( 'getCaretPosition' );
- oldScrollTop = this.scrollTop;
- range.moveToElementText( this );
- range.collapse();
- range.move( 'character', pos + 1);
- range.select();
- if ( this.scrollTop !== oldScrollTop ) {
- this.scrollTop += range.offsetTop;
- } else if ( options.force ) {
- range.move( 'character', -1 );
- range.select();
- }
- savedRange.select();
- }
- $(this).trigger( 'scrollToPosition' );
- } );
- }
- };
-
- // Apply defaults
- switch ( command ) {
- //case 'getContents': // no params
- //case 'setContents': // no params with defaults
- //case 'getSelection': // no params
- case 'encapsulateSelection':
- options = $.extend( {
- pre: '', // Text to insert before the cursor/selection
- peri: '', // Text to insert between pre and post and select afterwards
- post: '', // Text to insert after the cursor/selection
- ownline: false, // Put the inserted text on a line of its own
- replace: false, // If there is a selection, replace it with peri instead of leaving it alone
- selectPeri: true, // Select the peri text if it was inserted (but not if there was a selection and replace==false, or if splitlines==true)
- splitlines: false, // If multiple lines are selected, encapsulate each line individually
- selectionStart: undefined, // Position to start selection at
- selectionEnd: undefined // Position to end selection at. Defaults to start
- }, options );
- break;
- case 'getCaretPosition':
- options = $.extend( {
- // Return [start, end] instead of just start
- startAndEnd: false
- }, options );
- // FIXME: We may not need character position-based functions if we insert markers in the right places
- break;
- case 'setSelection':
- options = $.extend( {
- // Position to start selection at
- start: undefined,
- // Position to end selection at. Defaults to start
- end: undefined,
- // Element to start selection in (iframe only)
- startContainer: undefined,
- // Element to end selection in (iframe only). Defaults to startContainer
- endContainer: undefined
- }, options );
-
- if ( options.end === undefined ) {
- options.end = options.start;
- }
- if ( options.endContainer === undefined ) {
- options.endContainer = options.startContainer;
- }
- // FIXME: We may not need character position-based functions if we insert markers in the right places
- break;
- case 'scrollToCaretPosition':
- options = $.extend( {
- force: false // Force a scroll even if the caret position is already visible
- }, options );
- break;
- }
-
- context = $(this).data( 'wikiEditor-context' );
- hasIframe = context !== undefined && context && context.$iframe !== undefined;
-
- // IE selection restore voodoo
- needSave = false;
- if ( hasIframe && context.savedSelection !== null ) {
- context.fn.restoreSelection();
- needSave = true;
- }
- retval = ( hasIframe ? context.fn : fn )[command].call( this, options );
- if ( hasIframe && needSave ) {
- context.fn.saveSelection();
- }
-
- return retval;
- };
-
-}( jQuery ) );
diff --git a/resources/jquery/jquery.validate.js b/resources/jquery/jquery.validate.js
deleted file mode 100644
index 72296a61..00000000
--- a/resources/jquery/jquery.validate.js
+++ /dev/null
@@ -1,1166 +0,0 @@
-/**
- * jQuery Validation Plugin 1.8.1
- *
- * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
- * http://docs.jquery.com/Plugins/Validation
- *
- * Copyright (c) 2006 - 2011 Jörn Zaefferer
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-(function($) {
-
-$.extend($.fn, {
- // http://docs.jquery.com/Plugins/Validation/validate
- validate: function( options ) {
-
- // if nothing is selected, return nothing; can't chain anyway
- if (!this.length) {
- options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
- return;
- }
-
- // check if a validator for this form was already created
- var validator = $.data(this[0], 'validator');
- if ( validator ) {
- return validator;
- }
-
- validator = new $.validator( options, this[0] );
- $.data(this[0], 'validator', validator);
-
- if ( validator.settings.onsubmit ) {
-
- // allow suppresing validation by adding a cancel class to the submit button
- this.find("input, button").filter(".cancel").click(function() {
- validator.cancelSubmit = true;
- });
-
- // when a submitHandler is used, capture the submitting button
- if (validator.settings.submitHandler) {
- this.find("input, button").filter(":submit").click(function() {
- validator.submitButton = this;
- });
- }
-
- // validate the form on submit
- this.submit( function( event ) {
- if ( validator.settings.debug )
- // prevent form submit to be able to see console output
- event.preventDefault();
-
- function handle() {
- if ( validator.settings.submitHandler ) {
- if (validator.submitButton) {
- // insert a hidden input as a replacement for the missing submit button
- var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
- }
- validator.settings.submitHandler.call( validator, validator.currentForm );
- if (validator.submitButton) {
- // and clean up afterwards; thanks to no-block-scope, hidden can be referenced
- hidden.remove();
- }
- return false;
- }
- return true;
- }
-
- // prevent submit for invalid forms or custom submit handlers
- if ( validator.cancelSubmit ) {
- validator.cancelSubmit = false;
- return handle();
- }
- if ( validator.form() ) {
- if ( validator.pendingRequest ) {
- validator.formSubmitted = true;
- return false;
- }
- return handle();
- } else {
- validator.focusInvalid();
- return false;
- }
- });
- }
-
- return validator;
- },
- // http://docs.jquery.com/Plugins/Validation/valid
- valid: function() {
- if ( $(this[0]).is('form')) {
- return this.validate().form();
- } else {
- var valid = true;
- var validator = $(this[0].form).validate();
- this.each(function() {
- valid &= validator.element(this);
- });
- return valid;
- }
- },
- // attributes: space seperated list of attributes to retrieve and remove
- removeAttrs: function(attributes) {
- var result = {},
- $element = this;
- $.each(attributes.split(/\s/), function(index, value) {
- result[value] = $element.attr(value);
- $element.removeAttr(value);
- });
- return result;
- },
- // http://docs.jquery.com/Plugins/Validation/rules
- rules: function(command, argument) {
- var element = this[0];
-
- if (command) {
- var settings = $.data(element.form, 'validator').settings;
- var staticRules = settings.rules;
- var existingRules = $.validator.staticRules(element);
- switch(command) {
- case "add":
- $.extend(existingRules, $.validator.normalizeRule(argument));
- staticRules[element.name] = existingRules;
- if (argument.messages)
- settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
- break;
- case "remove":
- if (!argument) {
- delete staticRules[element.name];
- return existingRules;
- }
- var filtered = {};
- $.each(argument.split(/\s/), function(index, method) {
- filtered[method] = existingRules[method];
- delete existingRules[method];
- });
- return filtered;
- }
- }
-
- var data = $.validator.normalizeRules(
- $.extend(
- {},
- $.validator.metadataRules(element),
- $.validator.classRules(element),
- $.validator.attributeRules(element),
- $.validator.staticRules(element)
- ), element);
-
- // make sure required is at front
- if (data.required) {
- var param = data.required;
- delete data.required;
- data = $.extend({required: param}, data);
- }
-
- return data;
- }
-});
-
-// Custom selectors
-$.extend($.expr[":"], {
- // http://docs.jquery.com/Plugins/Validation/blank
- blank: function(a) {return !$.trim("" + a.value);},
- // http://docs.jquery.com/Plugins/Validation/filled
- filled: function(a) {return !!$.trim("" + a.value);},
- // http://docs.jquery.com/Plugins/Validation/unchecked
- unchecked: function(a) {return !a.checked;}
-});
-
-// constructor for validator
-$.validator = function( options, form ) {
- this.settings = $.extend( true, {}, $.validator.defaults, options );
- this.currentForm = form;
- this.init();
-};
-
-$.validator.format = function(source, params) {
- if ( arguments.length == 1 )
- return function() {
- var args = $.makeArray(arguments);
- args.unshift(source);
- return $.validator.format.apply( this, args );
- };
- if ( arguments.length > 2 && params.constructor != Array ) {
- params = $.makeArray(arguments).slice(1);
- }
- if ( params.constructor != Array ) {
- params = [ params ];
- }
- $.each(params, function(i, n) {
- source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
- });
- return source;
-};
-
-$.extend($.validator, {
-
- defaults: {
- messages: {},
- groups: {},
- rules: {},
- errorClass: "error",
- validClass: "valid",
- errorElement: "label",
- focusInvalid: true,
- errorContainer: $( [] ),
- errorLabelContainer: $( [] ),
- onsubmit: true,
- ignore: [],
- ignoreTitle: false,
- onfocusin: function(element) {
- this.lastActive = element;
-
- // hide error label and remove error class on focus if enabled
- if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
- this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
- this.addWrapper(this.errorsFor(element)).hide();
- }
- },
- onfocusout: function(element) {
- if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
- this.element(element);
- }
- },
- onkeyup: function(element) {
- if ( element.name in this.submitted || element == this.lastElement ) {
- this.element(element);
- }
- },
- onclick: function(element) {
- // click on selects, radiobuttons and checkboxes
- if ( element.name in this.submitted )
- this.element(element);
- // or option elements, check parent select in that case
- else if (element.parentNode.name in this.submitted)
- this.element(element.parentNode);
- },
- highlight: function(element, errorClass, validClass) {
- if (element.type === 'radio') {
- this.findByName(element.name).addClass(errorClass).removeClass(validClass);
- } else {
- $(element).addClass(errorClass).removeClass(validClass);
- }
- },
- unhighlight: function(element, errorClass, validClass) {
- if (element.type === 'radio') {
- this.findByName(element.name).removeClass(errorClass).addClass(validClass);
- } else {
- $(element).removeClass(errorClass).addClass(validClass);
- }
- }
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
- setDefaults: function(settings) {
- $.extend( $.validator.defaults, settings );
- },
-
- messages: {
- required: "This field is required.",
- remote: "Please fix this field.",
- email: "Please enter a valid email address.",
- url: "Please enter a valid URL.",
- date: "Please enter a valid date.",
- dateISO: "Please enter a valid date (ISO).",
- number: "Please enter a valid number.",
- digits: "Please enter only digits.",
- creditcard: "Please enter a valid credit card number.",
- equalTo: "Please enter the same value again.",
- accept: "Please enter a value with a valid extension.",
- maxlength: $.validator.format("Please enter no more than {0} characters."),
- minlength: $.validator.format("Please enter at least {0} characters."),
- rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
- range: $.validator.format("Please enter a value between {0} and {1}."),
- max: $.validator.format("Please enter a value less than or equal to {0}."),
- min: $.validator.format("Please enter a value greater than or equal to {0}.")
- },
-
- autoCreateRanges: false,
-
- prototype: {
-
- init: function() {
- this.labelContainer = $(this.settings.errorLabelContainer);
- this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
- this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
- this.submitted = {};
- this.valueCache = {};
- this.pendingRequest = 0;
- this.pending = {};
- this.invalid = {};
- this.reset();
-
- var groups = (this.groups = {});
- $.each(this.settings.groups, function(key, value) {
- $.each(value.split(/\s/), function(index, name) {
- groups[name] = key;
- });
- });
- var rules = this.settings.rules;
- $.each(rules, function(key, value) {
- rules[key] = $.validator.normalizeRule(value);
- });
-
- function delegate(event) {
- var validator = $.data(this[0].form, "validator"),
- eventType = "on" + event.type.replace(/^validate/, "");
- validator.settings[eventType] && validator.settings[eventType].call(validator, this[0] );
- }
- $(this.currentForm)
- .validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate)
- .validateDelegate(":radio, :checkbox, select, option", "click", delegate);
-
- if (this.settings.invalidHandler)
- $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/form
- form: function() {
- this.checkForm();
- $.extend(this.submitted, this.errorMap);
- this.invalid = $.extend({}, this.errorMap);
- if (!this.valid())
- $(this.currentForm).triggerHandler("invalid-form", [this]);
- this.showErrors();
- return this.valid();
- },
-
- checkForm: function() {
- this.prepareForm();
- for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
- this.check( elements[i] );
- }
- return this.valid();
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/element
- element: function( element ) {
- element = this.clean( element );
- this.lastElement = element;
- this.prepareElement( element );
- this.currentElements = $(element);
- var result = this.check( element );
- if ( result ) {
- delete this.invalid[element.name];
- } else {
- this.invalid[element.name] = true;
- }
- if ( !this.numberOfInvalids() ) {
- // Hide error containers on last error
- this.toHide = this.toHide.add( this.containers );
- }
- this.showErrors();
- return result;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/showErrors
- showErrors: function(errors) {
- if(errors) {
- // add items to error list and map
- $.extend( this.errorMap, errors );
- this.errorList = [];
- for ( var name in errors ) {
- this.errorList.push({
- message: errors[name],
- element: this.findByName(name)[0]
- });
- }
- // remove items from success list
- this.successList = $.grep( this.successList, function(element) {
- return !(element.name in errors);
- });
- }
- this.settings.showErrors
- ? this.settings.showErrors.call( this, this.errorMap, this.errorList )
- : this.defaultShowErrors();
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/resetForm
- resetForm: function() {
- if ( $.fn.resetForm )
- $( this.currentForm ).resetForm();
- this.submitted = {};
- this.prepareForm();
- this.hideErrors();
- this.elements().removeClass( this.settings.errorClass );
- },
-
- numberOfInvalids: function() {
- return this.objectLength(this.invalid);
- },
-
- objectLength: function( obj ) {
- var count = 0;
- for ( var i in obj )
- count++;
- return count;
- },
-
- hideErrors: function() {
- this.addWrapper( this.toHide ).hide();
- },
-
- valid: function() {
- return this.size() == 0;
- },
-
- size: function() {
- return this.errorList.length;
- },
-
- focusInvalid: function() {
- if( this.settings.focusInvalid ) {
- try {
- $(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
- .filter(":visible")
- .focus()
- // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
- .trigger("focusin");
- } catch(e) {
- // ignore IE throwing errors when focusing hidden elements
- }
- }
- },
-
- findLastActive: function() {
- var lastActive = this.lastActive;
- return lastActive && $.grep(this.errorList, function(n) {
- return n.element.name == lastActive.name;
- }).length == 1 && lastActive;
- },
-
- elements: function() {
- var validator = this,
- rulesCache = {};
-
- // select all valid inputs inside the form (no submit or reset buttons)
- return $(this.currentForm)
- .find("input, select, textarea")
- .not(":submit, :reset, :image, [disabled]")
- .not( this.settings.ignore )
- .filter(function() {
- !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
-
- // select only the first element for each name, and only those with rules specified
- if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
- return false;
-
- rulesCache[this.name] = true;
- return true;
- });
- },
-
- clean: function( selector ) {
- return $( selector )[0];
- },
-
- errors: function() {
- return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext );
- },
-
- reset: function() {
- this.successList = [];
- this.errorList = [];
- this.errorMap = {};
- this.toShow = $([]);
- this.toHide = $([]);
- this.currentElements = $([]);
- },
-
- prepareForm: function() {
- this.reset();
- this.toHide = this.errors().add( this.containers );
- },
-
- prepareElement: function( element ) {
- this.reset();
- this.toHide = this.errorsFor(element);
- },
-
- check: function( element ) {
- element = this.clean( element );
-
- // if radio/checkbox, validate first element in group instead
- if (this.checkable(element)) {
- element = this.findByName( element.name ).not(this.settings.ignore)[0];
- }
-
- var rules = $(element).rules();
- var dependencyMismatch = false;
- for (var method in rules ) {
- var rule = { method: method, parameters: rules[method] };
- try {
- var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters );
-
- // if a method indicates that the field is optional and therefore valid,
- // don't mark it as valid when there are no other rules
- if ( result == "dependency-mismatch" ) {
- dependencyMismatch = true;
- continue;
- }
- dependencyMismatch = false;
-
- if ( result == "pending" ) {
- this.toHide = this.toHide.not( this.errorsFor(element) );
- return;
- }
-
- if( !result ) {
- this.formatAndAdd( element, rule );
- return false;
- }
- } catch(e) {
- this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
- + ", check the '" + rule.method + "' method", e);
- throw e;
- }
- }
- if (dependencyMismatch)
- return;
- if ( this.objectLength(rules) )
- this.successList.push(element);
- return true;
- },
-
- // return the custom message for the given element and validation method
- // specified in the element's "messages" metadata
- customMetaMessage: function(element, method) {
- if (!$.metadata)
- return;
-
- var meta = this.settings.meta
- ? $(element).metadata()[this.settings.meta]
- : $(element).metadata();
-
- return meta && meta.messages && meta.messages[method];
- },
-
- // return the custom message for the given element name and validation method
- customMessage: function( name, method ) {
- var m = this.settings.messages[name];
- return m && (m.constructor == String
- ? m
- : m[method]);
- },
-
- // return the first defined argument, allowing empty strings
- findDefined: function() {
- for(var i = 0; i < arguments.length; i++) {
- if (arguments[i] !== undefined)
- return arguments[i];
- }
- return undefined;
- },
-
- defaultMessage: function( element, method) {
- return this.findDefined(
- this.customMessage( element.name, method ),
- this.customMetaMessage( element, method ),
- // title is never undefined, so handle empty string as undefined
- !this.settings.ignoreTitle && element.title || undefined,
- $.validator.messages[method],
- "<strong>Warning: No message defined for " + element.name + "</strong>"
- );
- },
-
- formatAndAdd: function( element, rule ) {
- var message = this.defaultMessage( element, rule.method ),
- theregex = /\$?\{(\d+)\}/g;
- if ( typeof message == "function" ) {
- message = message.call(this, rule.parameters, element);
- } else if (theregex.test(message)) {
- message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters);
- }
- this.errorList.push({
- message: message,
- element: element
- });
-
- this.errorMap[element.name] = message;
- this.submitted[element.name] = message;
- },
-
- addWrapper: function(toToggle) {
- if ( this.settings.wrapper )
- toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
- return toToggle;
- },
-
- defaultShowErrors: function() {
- for ( var i = 0; this.errorList[i]; i++ ) {
- var error = this.errorList[i];
- this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
- this.showLabel( error.element, error.message );
- }
- if( this.errorList.length ) {
- this.toShow = this.toShow.add( this.containers );
- }
- if (this.settings.success) {
- for ( var i = 0; this.successList[i]; i++ ) {
- this.showLabel( this.successList[i] );
- }
- }
- if (this.settings.unhighlight) {
- for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
- this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
- }
- }
- this.toHide = this.toHide.not( this.toShow );
- this.hideErrors();
- this.addWrapper( this.toShow ).show();
- },
-
- validElements: function() {
- return this.currentElements.not(this.invalidElements());
- },
-
- invalidElements: function() {
- return $(this.errorList).map(function() {
- return this.element;
- });
- },
-
- showLabel: function(element, message) {
- var label = this.errorsFor( element );
- if ( label.length ) {
- // refresh error/success class
- label.removeClass().addClass( this.settings.errorClass );
-
- // check if we have a generated label, replace the message then
- label.attr("generated") && label.html(message);
- } else {
- // create label
- label = $("<" + this.settings.errorElement + "/>")
- .attr({"for": this.idOrName(element), generated: true})
- .addClass(this.settings.errorClass)
- .html(message || "");
- if ( this.settings.wrapper ) {
- // make sure the element is visible, even in IE
- // actually showing the wrapped element is handled elsewhere
- label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
- }
- if ( !this.labelContainer.append(label).length )
- this.settings.errorPlacement
- ? this.settings.errorPlacement(label, $(element) )
- : label.insertAfter(element);
- }
- if ( !message && this.settings.success ) {
- label.text("");
- typeof this.settings.success == "string"
- ? label.addClass( this.settings.success )
- : this.settings.success( label );
- }
- this.toShow = this.toShow.add(label);
- },
-
- errorsFor: function(element) {
- var name = this.idOrName(element);
- return this.errors().filter(function() {
- return $(this).attr('for') == name;
- });
- },
-
- idOrName: function(element) {
- return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
- },
-
- checkable: function( element ) {
- return /radio|checkbox/i.test(element.type);
- },
-
- findByName: function( name ) {
- // select by name and filter by form for performance over form.find("[name=...]")
- var form = this.currentForm;
- return $(document.getElementsByName(name)).map(function(index, element) {
- return element.form == form && element.name == name && element || null;
- });
- },
-
- getLength: function(value, element) {
- switch( element.nodeName.toLowerCase() ) {
- case 'select':
- return $("option:selected", element).length;
- case 'input':
- if( this.checkable( element) )
- return this.findByName(element.name).filter(':checked').length;
- }
- return value.length;
- },
-
- depend: function(param, element) {
- return this.dependTypes[typeof param]
- ? this.dependTypes[typeof param](param, element)
- : true;
- },
-
- dependTypes: {
- "boolean": function(param, element) {
- return param;
- },
- "string": function(param, element) {
- return !!$(param, element.form).length;
- },
- "function": function(param, element) {
- return param(element);
- }
- },
-
- optional: function(element) {
- return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
- },
-
- startRequest: function(element) {
- if (!this.pending[element.name]) {
- this.pendingRequest++;
- this.pending[element.name] = true;
- }
- },
-
- stopRequest: function(element, valid) {
- this.pendingRequest--;
- // sometimes synchronization fails, make sure pendingRequest is never < 0
- if (this.pendingRequest < 0)
- this.pendingRequest = 0;
- delete this.pending[element.name];
- if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {
- $(this.currentForm).submit();
- this.formSubmitted = false;
- } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
- $(this.currentForm).triggerHandler("invalid-form", [this]);
- this.formSubmitted = false;
- }
- },
-
- previousValue: function(element) {
- return $.data(element, "previousValue") || $.data(element, "previousValue", {
- old: null,
- valid: true,
- message: this.defaultMessage( element, "remote" )
- });
- }
-
- },
-
- classRuleSettings: {
- required: {required: true},
- email: {email: true},
- url: {url: true},
- date: {date: true},
- dateISO: {dateISO: true},
- dateDE: {dateDE: true},
- number: {number: true},
- numberDE: {numberDE: true},
- digits: {digits: true},
- creditcard: {creditcard: true}
- },
-
- addClassRules: function(className, rules) {
- className.constructor == String ?
- this.classRuleSettings[className] = rules :
- $.extend(this.classRuleSettings, className);
- },
-
- classRules: function(element) {
- var rules = {};
- var classes = $(element).attr('class');
- classes && $.each(classes.split(' '), function() {
- if (this in $.validator.classRuleSettings) {
- $.extend(rules, $.validator.classRuleSettings[this]);
- }
- });
- return rules;
- },
-
- attributeRules: function(element) {
- var rules = {};
- var $element = $(element);
-
- for (var method in $.validator.methods) {
- var value = $element.attr(method);
- if (value) {
- rules[method] = value;
- }
- }
-
- // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
- if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
- delete rules.maxlength;
- }
-
- return rules;
- },
-
- metadataRules: function(element) {
- if (!$.metadata) return {};
-
- var meta = $.data(element.form, 'validator').settings.meta;
- return meta ?
- $(element).metadata()[meta] :
- $(element).metadata();
- },
-
- staticRules: function(element) {
- var rules = {};
- var validator = $.data(element.form, 'validator');
- if (validator.settings.rules) {
- rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
- }
- return rules;
- },
-
- normalizeRules: function(rules, element) {
- // handle dependency check
- $.each(rules, function(prop, val) {
- // ignore rule when param is explicitly false, eg. required:false
- if (val === false) {
- delete rules[prop];
- return;
- }
- if (val.param || val.depends) {
- var keepRule = true;
- switch (typeof val.depends) {
- case "string":
- keepRule = !!$(val.depends, element.form).length;
- break;
- case "function":
- keepRule = val.depends.call(element, element);
- break;
- }
- if (keepRule) {
- rules[prop] = val.param !== undefined ? val.param : true;
- } else {
- delete rules[prop];
- }
- }
- });
-
- // evaluate parameters
- $.each(rules, function(rule, parameter) {
- rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
- });
-
- // clean number parameters
- $.each(['minlength', 'maxlength', 'min', 'max'], function() {
- if (rules[this]) {
- rules[this] = Number(rules[this]);
- }
- });
- $.each(['rangelength', 'range'], function() {
- if (rules[this]) {
- rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
- }
- });
-
- if ($.validator.autoCreateRanges) {
- // auto-create ranges
- if (rules.min && rules.max) {
- rules.range = [rules.min, rules.max];
- delete rules.min;
- delete rules.max;
- }
- if (rules.minlength && rules.maxlength) {
- rules.rangelength = [rules.minlength, rules.maxlength];
- delete rules.minlength;
- delete rules.maxlength;
- }
- }
-
- // To support custom messages in metadata ignore rule methods titled "messages"
- if (rules.messages) {
- delete rules.messages;
- }
-
- return rules;
- },
-
- // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
- normalizeRule: function(data) {
- if( typeof data == "string" ) {
- var transformed = {};
- $.each(data.split(/\s/), function() {
- transformed[this] = true;
- });
- data = transformed;
- }
- return data;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/addMethod
- addMethod: function(name, method, message) {
- $.validator.methods[name] = method;
- $.validator.messages[name] = message != undefined ? message : $.validator.messages[name];
- if (method.length < 3) {
- $.validator.addClassRules(name, $.validator.normalizeRule(name));
- }
- },
-
- methods: {
-
- // http://docs.jquery.com/Plugins/Validation/Methods/required
- required: function(value, element, param) {
- // check if dependency is met
- if ( !this.depend(param, element) )
- return "dependency-mismatch";
- switch( element.nodeName.toLowerCase() ) {
- case 'select':
- // could be an array for select-multiple or a string, both are fine this way
- var val = $(element).val();
- return val && val.length > 0;
- case 'input':
- if ( this.checkable(element) )
- return this.getLength(value, element) > 0;
- default:
- return $.trim(value).length > 0;
- }
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/remote
- remote: function(value, element, param) {
- if ( this.optional(element) )
- return "dependency-mismatch";
-
- var previous = this.previousValue(element);
- if (!this.settings.messages[element.name] )
- this.settings.messages[element.name] = {};
- previous.originalMessage = this.settings.messages[element.name].remote;
- this.settings.messages[element.name].remote = previous.message;
-
- param = typeof param == "string" && {url:param} || param;
-
- if ( this.pending[element.name] ) {
- return "pending";
- }
- if ( previous.old === value ) {
- return previous.valid;
- }
-
- previous.old = value;
- var validator = this;
- this.startRequest(element);
- var data = {};
- data[element.name] = value;
- $.ajax($.extend(true, {
- url: param,
- mode: "abort",
- port: "validate" + element.name,
- dataType: "json",
- data: data,
- success: function(response) {
- validator.settings.messages[element.name].remote = previous.originalMessage;
- var valid = response === true;
- if ( valid ) {
- var submitted = validator.formSubmitted;
- validator.prepareElement(element);
- validator.formSubmitted = submitted;
- validator.successList.push(element);
- validator.showErrors();
- } else {
- var errors = {};
- var message = response || validator.defaultMessage( element, "remote" );
- errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
- validator.showErrors(errors);
- }
- previous.valid = valid;
- validator.stopRequest(element, valid);
- }
- }, param));
- return "pending";
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/minlength
- minlength: function(value, element, param) {
- return this.optional(element) || this.getLength($.trim(value), element) >= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/maxlength
- maxlength: function(value, element, param) {
- return this.optional(element) || this.getLength($.trim(value), element) <= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/rangelength
- rangelength: function(value, element, param) {
- var length = this.getLength($.trim(value), element);
- return this.optional(element) || ( length >= param[0] && length <= param[1] );
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/min
- min: function( value, element, param ) {
- return this.optional(element) || value >= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/max
- max: function( value, element, param ) {
- return this.optional(element) || value <= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/range
- range: function( value, element, param ) {
- return this.optional(element) || ( value >= param[0] && value <= param[1] );
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/email
- email: function(value, element) {
- // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
- return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/url
- url: function(value, element) {
- // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
- return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/date
- date: function(value, element) {
- return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/dateISO
- dateISO: function(value, element) {
- return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/number
- number: function(value, element) {
- return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/digits
- digits: function(value, element) {
- return this.optional(element) || /^\d+$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/creditcard
- // based on http://en.wikipedia.org/wiki/Luhn
- creditcard: function(value, element) {
- if ( this.optional(element) )
- return "dependency-mismatch";
- // accept only digits and dashes
- if (/[^0-9-]+/.test(value))
- return false;
- var nCheck = 0,
- nDigit = 0,
- bEven = false;
-
- value = value.replace(/\D/g, "");
-
- for (var n = value.length - 1; n >= 0; n--) {
- var cDigit = value.charAt(n);
- var nDigit = parseInt(cDigit, 10);
- if (bEven) {
- if ((nDigit *= 2) > 9)
- nDigit -= 9;
- }
- nCheck += nDigit;
- bEven = !bEven;
- }
-
- return (nCheck % 10) == 0;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/accept
- accept: function(value, element, param) {
- param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
- return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/equalTo
- equalTo: function(value, element, param) {
- // bind to the blur event of the target in order to revalidate whenever the target field is updated
- // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
- var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
- $(element).valid();
- });
- return value == target.val();
- }
-
- }
-
-});
-
-// deprecated, use $.validator.format instead
-$.format = $.validator.format;
-
-})(jQuery);
-
-// ajax mode: abort
-// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
-// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
-;(function($) {
- var pendingRequests = {};
- // Use a prefilter if available (1.5+)
- if ( $.ajaxPrefilter ) {
- $.ajaxPrefilter(function(settings, _, xhr) {
- var port = settings.port;
- if (settings.mode == "abort") {
- if ( pendingRequests[port] ) {
- pendingRequests[port].abort();
- }
- pendingRequests[port] = xhr;
- }
- });
- } else {
- // Proxy ajax
- var ajax = $.ajax;
- $.ajax = function(settings) {
- var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
- port = ( "port" in settings ? settings : $.ajaxSettings ).port;
- if (mode == "abort") {
- if ( pendingRequests[port] ) {
- pendingRequests[port].abort();
- }
- return (pendingRequests[port] = ajax.apply(this, arguments));
- }
- return ajax.apply(this, arguments);
- };
- }
-})(jQuery);
-
-// provides cross-browser focusin and focusout events
-// IE has native support, in other browsers, use event caputuring (neither bubbles)
-
-// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
-// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
-;(function($) {
- // only implement if not provided by jQuery core (since 1.4)
- // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs
- if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
- $.each({
- focus: 'focusin',
- blur: 'focusout'
- }, function( original, fix ){
- $.event.special[fix] = {
- setup:function() {
- this.addEventListener( original, handler, true );
- },
- teardown:function() {
- this.removeEventListener( original, handler, true );
- },
- handler: function(e) {
- arguments[0] = $.event.fix(e);
- arguments[0].type = fix;
- return $.event.handle.apply(this, arguments);
- }
- };
- function handler(e) {
- e = $.event.fix(e);
- e.type = fix;
- return $.event.handle.call(this, e);
- }
- });
- };
- $.extend($.fn, {
- validateDelegate: function(delegate, type, handler) {
- return this.bind(type, function(event) {
- var target = $(event.target);
- if (target.is(delegate)) {
- return handler.apply(target, arguments);
- }
- });
- }
- });
-})(jQuery);
diff --git a/resources/jquery/jquery.xmldom.js b/resources/jquery/jquery.xmldom.js
deleted file mode 100644
index 85d0083d..00000000
--- a/resources/jquery/jquery.xmldom.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*!
- * jQuery xmlDOM Plugin v1.0
- * http://outwestmedia.com/jquery-plugins/xmldom/
- *
- * Released: 2009-04-06
- * Version: 1.0
- *
- * Copyright (c) 2009 Jonathan Sharp, Out West Media LLC.
- * Dual licensed under the MIT and GPL licenses.
- * http://docs.jquery.com/License
- */
-(function($) {
- // IE DOMParser wrapper
- if ( window['DOMParser'] == undefined && window.ActiveXObject ) {
- DOMParser = function() { };
- DOMParser.prototype.parseFromString = function( xmlString ) {
- var doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML( xmlString );
- return doc;
- };
- }
-
- $.xmlDOM = function(xml, onErrorFn) {
- try {
- var xmlDoc = ( new DOMParser() ).parseFromString( xml, 'text/xml' );
- if ( $.isXMLDoc( xmlDoc ) ) {
- var err = $('parsererror', xmlDoc);
- if ( err.length == 1 ) {
- throw('Error: ' + $(xmlDoc).text() );
- }
- } else {
- throw('Unable to parse XML');
- }
- } catch( e ) {
- var msg = ( e.name == undefined ? e : e.name + ': ' + e.message );
- if ( $.isFunction( onErrorFn ) ) {
- onErrorFn( msg );
- } else {
- $(document).trigger('xmlParseError', [ msg ]);
- }
- return $([]);
- }
- return $( xmlDoc );
- };
-})(jQuery); \ No newline at end of file