Updated mootools

Save "show advanced settings" in cookie
This commit is contained in:
Ruud
2011-09-06 12:34:02 +02:00
parent 9353454229
commit 097ca4e2ed
3 changed files with 406 additions and 301 deletions
+161 -61
View File
@@ -3,10 +3,10 @@
MooTools: the javascript framework
web build:
- http://mootools.net/core/c1215700e7dedaa9d48503126daf2111
- http://mootools.net/core/3e4fc9be110c01367e16b46df47d66b7
packager build:
- packager build Core/Class Core/Class.Extras Core/Element Core/Element.Style Core/Element.Dimensions Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request.JSON Core/DOMReady
- packager build Core/Class Core/Class.Extras Core/Element Core/Element.Style Core/Element.Dimensions Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request.JSON Core/Cookie Core/DOMReady
/*
---
@@ -33,8 +33,8 @@ provides: [Core, MooTools, Type, typeOf, instanceOf, Native]
(function(){
this.MooTools = {
version: '1.3.1',
build: 'af48c8d589f43f32212f9bb8ff68a127e6a3ba6c'
version: '1.3.2',
build: 'c9f1ff10e9e7facb65e9481049ed1b450959d587'
};
// typeOf, instanceOf
@@ -398,7 +398,7 @@ String.extend('uniqueID', function(){
}).call(this);
})();
/*
@@ -419,13 +419,7 @@ provides: Array
Array.implement({
invoke: function(methodName){
var args = Array.slice(arguments, 1);
return this.map(function(item){
return item[methodName].apply(item, args);
});
},
/*<!ES5>*/
every: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++){
if ((i in this) && !fn.call(bind, this[i], i, this)) return false;
@@ -441,12 +435,6 @@ Array.implement({
return results;
},
clean: function(){
return this.filter(function(item){
return item != null;
});
},
indexOf: function(item, from){
var len = this.length;
for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
@@ -469,6 +457,20 @@ Array.implement({
}
return false;
},
/*</!ES5>*/
clean: function(){
return this.filter(function(item){
return item != null;
});
},
invoke: function(methodName){
var args = Array.slice(arguments, 1);
return this.map(function(item){
return item[methodName].apply(item, args);
});
},
associate: function(keys){
var obj = {}, length = Math.min(this.length, keys.length);
@@ -694,6 +696,7 @@ Function.implement({
return null;
},
/*<!ES5>*/
bind: function(bind){
var self = this,
args = (arguments.length > 1) ? Array.slice(arguments, 1) : null;
@@ -704,6 +707,7 @@ Function.implement({
return self.apply(bind, args || arguments);
};
},
/*</!ES5>*/
pass: function(args, bind){
var self = this;
@@ -894,7 +898,7 @@ Class.Mutators = {
}
};
}).call(this);
})();
/*
@@ -1015,7 +1019,7 @@ this.Options = new Class({
});
}).call(this);
})();
/*
@@ -1179,12 +1183,13 @@ Document.mirror(function(name, method){
});
document.html = document.documentElement;
document.head = document.getElementsByTagName('head')[0];
if (!document.head) document.head = document.getElementsByTagName('head')[0];
if (document.execCommand) try {
document.execCommand("BackgroundImageCache", false, true);
} catch (e){}
/*<ltIE9>*/
if (this.attachEvent && !this.addEventListener){
var unloadEvent = function(){
this.detachEvent('onunload', unloadEvent);
@@ -1216,10 +1221,11 @@ try {
};
});
}
/*</ltIE9>*/
}).call(this);
})();
/*
@@ -1785,17 +1791,28 @@ local.search = function(context, expression, append, first){
/*<query-selector-override>*/
querySelector: if (context.querySelectorAll) {
if (!this.isHTMLDocument || this.brokenMixedCaseQSA || qsaFailExpCache[expression] ||
(this.brokenCheckedQSA && expression.indexOf(':checked') > -1) ||
(this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression)) || Slick.disableQSA) break querySelector;
if (!this.isHTMLDocument
|| qsaFailExpCache[expression]
//TODO: only skip when expression is actually mixed case
|| this.brokenMixedCaseQSA
|| (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
|| (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
|| (!contextIsDocument //Abort when !contextIsDocument and...
// there are multiple expressions in the selector
// since we currently only fix non-document rooted QSA for single expression selectors
&& expression.indexOf(',') > -1
)
|| Slick.disableQSA
) break querySelector;
var _expression = expression;
var _expression = expression, _context = context;
if (!contextIsDocument){
// non-document rooted QSA
// credits to Andrew Dupont
var currentId = context.getAttribute('id'), slickid = 'slickid__';
context.setAttribute('id', slickid);
var currentId = _context.getAttribute('id'), slickid = 'slickid__';
_context.setAttribute('id', slickid);
_expression = '#' + slickid + ' ' + _expression;
context = _context.parentNode;
}
try {
@@ -1806,8 +1823,9 @@ local.search = function(context, expression, append, first){
break querySelector;
} finally {
if (!contextIsDocument){
if (currentId) context.setAttribute('id', currentId);
else context.removeAttribute('id');
if (currentId) _context.setAttribute('id', currentId);
else _context.removeAttribute('id');
context = _context;
}
}
@@ -2445,8 +2463,10 @@ var Element = function(tag, props){
var attributes = parsed.attributes;
if (attributes) for (var i = 0, l = attributes.length; i < l; i++){
var attr = attributes[i];
if (attr.value != null && attr.operator == '=' && props[attr.key] == null)
props[attr.key] = attr.value;
if (props[attr.key] != null) continue;
if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value;
else if (!attr.value && !attr.operator) props[attr.key] = true;
}
if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' ');
@@ -3103,11 +3123,12 @@ if (!document.createElement('div').contains) Element.implement(contains);
});
// IE purge
/*<ltIE9>*/
if (window.attachEvent && !window.addEventListener) window.addListener('unload', function(){
Object.each(collected, clean);
if (window.CollectGarbage) CollectGarbage();
});
/*</ltIE9>*/
})();
@@ -3139,6 +3160,7 @@ Element.Properties.tag = {
};
/*<ltIE9>*/
(function(maxLength){
if (maxLength != null) Element.Properties.maxlength = Element.Properties.maxLength = {
get: function(){
@@ -3147,7 +3169,9 @@ Element.Properties.tag = {
}
};
})(document.createElement('input').getAttribute('maxLength'));
/*</ltIE9>*/
/*<!webkit>*/
Element.Properties.html = (function(){
var tableTest = Function.attempt(function(){
@@ -3184,6 +3208,7 @@ Element.Properties.html = (function(){
return html;
})();
/*</!webkit>*/
/*
@@ -3218,7 +3243,8 @@ var setOpacity = function(element, opacity){
if (hasOpacity){
element.style.opacity = opacity;
} else {
opacity = (opacity == 1) ? '' : 'alpha(opacity=' + opacity * 100 + ')';
opacity = (opacity * 100).limit(0, 100).round();
opacity = (opacity == 100) ? '' : 'alpha(opacity=' + opacity + ')';
var filter = element.style.filter || element.getComputedStyle('filter') || '';
element.style.filter = reAlpha.test(filter) ? filter.replace(reAlpha, opacity) : filter + opacity;
}
@@ -3364,7 +3390,7 @@ Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, bor
Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
});
}).call(this);
})();
/*
@@ -3610,7 +3636,7 @@ function getCompatElement(element){
return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
}
}).call(this);
})();
//aliases
Element.alias({position: 'setPosition'}); //compatability
@@ -3830,7 +3856,7 @@ var pullInstance = function(fps){
}
};
}).call(this);
})();
/*
@@ -4301,7 +4327,7 @@ Object.extend({
var results = {};
for (var i = 0, l = keys.length; i < l; i++){
var k = keys[i];
results[k] = object[k];
if (k in object) results[k] = object[k];
}
return results;
},
@@ -4316,9 +4342,10 @@ Object.extend({
filter: function(object, fn, bind){
var results = {};
Object.each(object, function(value, key){
if (fn.call(bind, value, key, object)) results[key] = value;
});
for (var key in object){
var value = object[key];
if (hasOwnProperty.call(object, key) && fn.call(bind, value, key, object)) results[key] = value;
}
return results;
},
@@ -4749,7 +4776,7 @@ JSON.decode = function(string, secure){
return eval('(' + string + ')');
};
}).call(this);
})();
/*
@@ -4800,6 +4827,82 @@ Request.JSON = new Class({
});
/*
---
name: Cookie
description: Class for creating, reading, and deleting browser Cookies.
license: MIT-style license.
credits:
- Based on the functions by Peter-Paul Koch (http://quirksmode.org).
requires: [Options, Browser]
provides: Cookie
...
*/
var Cookie = new Class({
Implements: Options,
options: {
path: '/',
domain: false,
duration: false,
secure: false,
document: document,
encode: true
},
initialize: function(key, options){
this.key = key;
this.setOptions(options);
},
write: function(value){
if (this.options.encode) value = encodeURIComponent(value);
if (this.options.domain) value += '; domain=' + this.options.domain;
if (this.options.path) value += '; path=' + this.options.path;
if (this.options.duration){
var date = new Date();
date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
value += '; expires=' + date.toGMTString();
}
if (this.options.secure) value += '; secure';
this.options.document.cookie = this.key + '=' + value;
return this;
},
read: function(){
var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
return (value) ? decodeURIComponent(value[1]) : null;
},
dispose: function(){
new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write('');
return this;
}
});
Cookie.write = function(key, value, options){
return new Cookie(key, options).write(value);
};
Cookie.read = function(key){
return new Cookie(key).read();
};
Cookie.dispose = function(key, options){
return new Cookie(key, options).dispose();
};
/*
---
@@ -5103,7 +5206,7 @@ Element.Events = {
}).call(this);
})();
/*
@@ -5129,12 +5232,7 @@ var ready,
checks = [],
shouldPoll,
timer,
isFramed = true;
// Thanks to Rich Dougherty <http://www.richdougherty.com/>
try {
isFramed = window.frameElement != null;
} catch(e){}
testElement = document.createElement('div');
var domready = function(){
clearTimeout(timer);
@@ -5151,7 +5249,6 @@ var check = function(){
domready();
return true;
}
return false;
};
@@ -5162,19 +5259,23 @@ var poll = function(){
document.addListener('DOMContentLoaded', domready);
/*<ltIE8>*/
// doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
var testElement = document.createElement('div');
if (testElement.doScroll && !isFramed){
checks.push(function(){
try {
testElement.doScroll();
return true;
} catch (e){}
return false;
});
// testElement.doScroll() throws when the DOM is not ready, only in the top window
var doScrollWorks = function(){
try {
testElement.doScroll();
return true;
} catch (e){}
return false;
}
// If doScroll works already, it can't be used to determine domready
// e.g. in an iframe
if (testElement.doScroll && !doScrollWorks()){
checks.push(doScrollWorks);
shouldPoll = true;
}
/*</ltIE8>*/
if (document.readyState) checks.push(function(){
var state = document.readyState;
@@ -5203,7 +5304,6 @@ Element.Events.load = {
domready();
delete Element.Events.load;
}
return true;
}
};