summaryrefslogtreecommitdiff
path: root/resources/jquery/jquery.async.js
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /resources/jquery/jquery.async.js
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'resources/jquery/jquery.async.js')
-rw-r--r--resources/jquery/jquery.async.js33
1 files changed, 12 insertions, 21 deletions
diff --git a/resources/jquery/jquery.async.js b/resources/jquery/jquery.async.js
index 61493f71..2161f6b9 100644
--- a/resources/jquery/jquery.async.js
+++ b/resources/jquery/jquery.async.js
@@ -13,33 +13,28 @@
// 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)
-{
+$.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(){};
+ end = opts.end || function(){};
(function(){
var t = false,
begin = new Date();
- while( t = test() )
- {
+ while( t = test() ) {
loop();
- if( bulk === 0 || (new Date() - begin) > bulk )
- {
+ if( bulk === 0 || (new Date() - begin) > bulk ) {
break;
}
}
- if( t )
- {
+ if( t ) {
setTimeout(arguments.callee, delay);
}
- else
- {
+ else {
end();
}
@@ -50,17 +45,15 @@ $.whileAsync = function(opts)
// 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,
+$.eachAsync = function(array, opts) {
+ var i = 0,
l = array.length,
loop = opts.loop || function(){};
$.whileAsync(
$.extend(opts, {
- test: function(){ return i < l; },
- loop: function()
- {
+ test: function() { return i < l; },
+ loop: function() {
var val = array[i];
return loop.call(val, i++, val);
}
@@ -68,11 +61,9 @@ $.eachAsync = function(array, opts)
);
};
-$.fn.eachAsync = function(opts)
-{
+$.fn.eachAsync = function(opts) {
$.eachAsync(this, opts);
return this;
}
-})(jQuery);
-
+})(jQuery); \ No newline at end of file