Updated mootools
Save "show advanced settings" in cookie
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,6 +20,7 @@ authors:
|
||||
- Tim Wienk
|
||||
- Christoph Pojer
|
||||
- Aaron Newton
|
||||
- Jacob Thornton
|
||||
|
||||
requires:
|
||||
- Core/MooTools
|
||||
@@ -30,8 +31,8 @@ provides: [MooTools.More]
|
||||
*/
|
||||
|
||||
MooTools.More = {
|
||||
'version': '1.3.1.1',
|
||||
'build': '0292a3af1eea242b817fecf9daa127417d10d4ce'
|
||||
'version': '1.3.2.1',
|
||||
'build': 'e586bcd2496e9b22acfde32e12f84d49ce09e59d'
|
||||
};
|
||||
|
||||
|
||||
@@ -182,7 +183,7 @@ String.implement({
|
||||
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
})();
|
||||
|
||||
|
||||
/*
|
||||
@@ -506,7 +507,7 @@ Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
|
||||
if (this[klass]) this[klass].implement(Events.prototype);
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
})();
|
||||
|
||||
|
||||
/*
|
||||
@@ -544,7 +545,7 @@ Event.definePseudo = function(key, listener){
|
||||
var proto = Element.prototype;
|
||||
[Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
|
||||
|
||||
}).call(this);
|
||||
})();
|
||||
|
||||
|
||||
/*
|
||||
@@ -586,6 +587,12 @@ var check = function(split, target, event){
|
||||
return Slick.match(target, split.value) && (!condition || condition.call(target, event));
|
||||
};
|
||||
|
||||
var bubbleUp = function(split, event, fn){
|
||||
for (var target = event.target; target && target != this; target = document.id(target.parentNode)){
|
||||
if (target && check(split, target, event)) return fn.call(target, event, target);
|
||||
}
|
||||
};
|
||||
|
||||
var formObserver = function(eventName){
|
||||
|
||||
var $delegationKey = '$delegation:';
|
||||
@@ -607,16 +614,20 @@ var formObserver = function(eventName){
|
||||
var event = args[0],
|
||||
forms = this.retrieve($delegationKey + 'forms', []),
|
||||
target = event.target,
|
||||
form = (target.get('tag') == 'form') ? target : event.target.getParent('form'),
|
||||
formEvents = form.retrieve($delegationKey + 'originalFn', []),
|
||||
formListeners = form.retrieve($delegationKey + 'listeners', []);
|
||||
form = (target.get('tag') == 'form') ? target : event.target.getParent('form');
|
||||
|
||||
if (!form) return;
|
||||
|
||||
var formEvents = form.retrieve($delegationKey + 'originalFn', []),
|
||||
formListeners = form.retrieve($delegationKey + 'listeners', []),
|
||||
self = this;
|
||||
|
||||
forms.include(form);
|
||||
this.store($delegationKey + 'forms', forms);
|
||||
|
||||
if (!formEvents.contains(fn)){
|
||||
var formListener = function(event){
|
||||
if (check(split, this, event)) fn.call(this, event);
|
||||
bubbleUp.call(self, split, event, fn);
|
||||
};
|
||||
form.addEvent(eventName, formListener);
|
||||
|
||||
@@ -636,9 +647,9 @@ var inputObserver = function(eventName){
|
||||
listener: function(split, fn, args){
|
||||
var events = {blur: function(){
|
||||
this.removeEvents(events);
|
||||
}};
|
||||
}}, self = this;
|
||||
events[eventName] = function(event){
|
||||
if (check(split, this, event)) fn.call(this, event);
|
||||
bubbleUp.call(self, split, event, fn);
|
||||
};
|
||||
args[0].target.addEvents(events);
|
||||
}
|
||||
@@ -669,24 +680,14 @@ if (!eventListenerSupport) Object.append(eventOptions, {
|
||||
select: inputObserver('select')
|
||||
});
|
||||
|
||||
|
||||
Event.definePseudo('relay', {
|
||||
listener: function(split, fn, args, monitor, options){
|
||||
var event = args[0];
|
||||
|
||||
for (var target = event.target; target && target != this; target = target.parentNode){
|
||||
var finalTarget = document.id(target);
|
||||
if (check(split, finalTarget, event)){
|
||||
if (finalTarget) fn.call(finalTarget, event, finalTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
listener: function(split, fn, args){
|
||||
bubbleUp.call(this, split, args[0], fn);
|
||||
},
|
||||
options: eventOptions
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
})();
|
||||
|
||||
|
||||
/*
|
||||
@@ -826,7 +827,7 @@ Fx.Slide = new Class({
|
||||
|
||||
this.addEvent('complete', function(){
|
||||
this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
|
||||
if (this.open && options.resetHeight) wrapper.setStyle('height', '');
|
||||
if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
|
||||
}, true);
|
||||
},
|
||||
|
||||
@@ -1050,12 +1051,6 @@ var Drag = new Class({
|
||||
var limit = options.limit;
|
||||
this.limit = {x: [], y: []};
|
||||
|
||||
var styles = this.element.getStyles('left', 'right', 'top', 'bottom');
|
||||
this._invert = {
|
||||
x: options.modifiers.x == 'left' && styles.left == 'auto' && !isNaN(styles.right.toInt()) && (options.modifiers.x = 'right'),
|
||||
y: options.modifiers.y == 'top' && styles.top == 'auto' && !isNaN(styles.bottom.toInt()) && (options.modifiers.y = 'bottom')
|
||||
};
|
||||
|
||||
var z, coordinates;
|
||||
for (z in options.modifiers){
|
||||
if (!options.modifiers[z]) continue;
|
||||
@@ -1072,7 +1067,6 @@ var Drag = new Class({
|
||||
else this.value.now[z] = this.element[options.modifiers[z]];
|
||||
|
||||
if (options.invert) this.value.now[z] *= -1;
|
||||
if (this._invert[z]) this.value.now[z] *= -1;
|
||||
|
||||
this.mouse.pos[z] = event.page[z] - this.value.now[z];
|
||||
|
||||
@@ -1122,7 +1116,6 @@ var Drag = new Class({
|
||||
this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
|
||||
|
||||
if (options.invert) this.value.now[z] *= -1;
|
||||
if (this._invert[z]) this.value.now[z] *= -1;
|
||||
|
||||
if (options.limit && this.limit[z]){
|
||||
if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
|
||||
@@ -1236,10 +1229,9 @@ Drag.Move = new Class({
|
||||
this.container = document.id(this.container.getDocument().body);
|
||||
|
||||
if (this.options.style){
|
||||
if (this.options.modifiers.x == "left" && this.options.modifiers.y == "top"){
|
||||
var parentStyles,
|
||||
parent = element.getOffsetParent();
|
||||
var styles = element.getStyles('left', 'top');
|
||||
if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
|
||||
var parent = element.getOffsetParent(),
|
||||
styles = element.getStyles('left', 'top');
|
||||
if (parent && (styles.left == 'auto' || styles.top == 'auto')){
|
||||
element.setPosition(element.getPosition(parent));
|
||||
}
|
||||
@@ -1640,8 +1632,7 @@ Request.JSONP = new Class({
|
||||
|
||||
Implements: [Chain, Events, Options],
|
||||
|
||||
options: {
|
||||
/*
|
||||
options: {/*
|
||||
onRequest: function(src, scriptElement){},
|
||||
onComplete: function(data){},
|
||||
onSuccess: function(data){},
|
||||
@@ -1708,7 +1699,8 @@ Request.JSONP = new Class({
|
||||
},
|
||||
|
||||
getScript: function(src){
|
||||
if (!this.script) this.script = new Element('script[type=text/javascript]', {
|
||||
if (!this.script) this.script = new Element('script', {
|
||||
type: 'text/javascript',
|
||||
async: true,
|
||||
src: src
|
||||
});
|
||||
@@ -1716,7 +1708,7 @@ Request.JSONP = new Class({
|
||||
},
|
||||
|
||||
success: function(args, index){
|
||||
if (!this.running) return false;
|
||||
if (!this.running) return;
|
||||
this.clear()
|
||||
.fireEvent('complete', args).fireEvent('success', args)
|
||||
.callChain();
|
||||
@@ -1835,10 +1827,10 @@ Class.refactor = function(original, refactors){
|
||||
|
||||
Object.each(refactors, function(item, name){
|
||||
var origin = original.prototype[name];
|
||||
if (origin && origin.$origin) origin = origin.$origin;
|
||||
origin = (origin && origin.$origin) || origin || function(){};
|
||||
original.implement(name, (typeof item == 'function') ? function(){
|
||||
var old = this.previous;
|
||||
this.previous = origin || function(){};
|
||||
this.previous = origin;
|
||||
var value = item.apply(this, arguments);
|
||||
this.previous = old;
|
||||
return value;
|
||||
@@ -1875,7 +1867,7 @@ provides: [Class.Binds]
|
||||
|
||||
Class.Mutators.Binds = function(binds){
|
||||
if (!this.prototype.initialize) this.implement('initialize', function(){});
|
||||
return binds;
|
||||
return Array.from(binds).concat(this.prototype.Binds || []);
|
||||
};
|
||||
|
||||
Class.Mutators.initialize = function(initialize){
|
||||
@@ -2055,7 +2047,7 @@ Element.implement({
|
||||
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
})();
|
||||
|
||||
|
||||
/*
|
||||
@@ -2071,219 +2063,228 @@ license: MIT-style license
|
||||
|
||||
authors:
|
||||
- Aaron Newton
|
||||
- Jacob Thornton
|
||||
|
||||
requires:
|
||||
- Core/Options
|
||||
- Core/Element.Dimensions
|
||||
- /Element.Measure
|
||||
- Element.Measure
|
||||
|
||||
provides: [Element.Position]
|
||||
|
||||
...
|
||||
*/
|
||||
|
||||
(function(){
|
||||
(function(original){
|
||||
|
||||
var original = Element.prototype.position;
|
||||
var local = Element.Position = {
|
||||
|
||||
options: {/*
|
||||
edge: false,
|
||||
returnPos: false,
|
||||
minimum: {x: 0, y: 0},
|
||||
maximum: {x: 0, y: 0},
|
||||
relFixedPosition: false,
|
||||
ignoreMargins: false,
|
||||
ignoreScroll: false,
|
||||
allowNegative: false,*/
|
||||
relativeTo: document.body,
|
||||
position: {
|
||||
x: 'center', //left, center, right
|
||||
y: 'center' //top, center, bottom
|
||||
},
|
||||
offset: {x: 0, y: 0}
|
||||
},
|
||||
|
||||
getOptions: function(element, options){
|
||||
options = Object.merge({}, local.options, options);
|
||||
local.setPositionOption(options);
|
||||
local.setEdgeOption(options);
|
||||
local.setOffsetOption(element, options);
|
||||
local.setDimensionsOption(element, options);
|
||||
return options;
|
||||
},
|
||||
|
||||
setPositionOption: function(options){
|
||||
options.position = local.getCoordinateFromValue(options.position);
|
||||
},
|
||||
|
||||
setEdgeOption: function(options){
|
||||
var edgeOption = local.getCoordinateFromValue(options.edge);
|
||||
options.edge = edgeOption ? edgeOption :
|
||||
(options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
|
||||
{x: 'left', y: 'top'};
|
||||
},
|
||||
|
||||
setOffsetOption: function(element, options){
|
||||
var parentOffset = {x: 0, y: 0},
|
||||
offsetParent = element.measure(function(){
|
||||
return document.id(this.getOffsetParent());
|
||||
}),
|
||||
parentScroll = offsetParent.getScroll();
|
||||
|
||||
if (!offsetParent || offsetParent == element.getDocument().body) return;
|
||||
parentOffset = offsetParent.measure(function(){
|
||||
var position = this.getPosition();
|
||||
if (this.getStyle('position') == 'fixed'){
|
||||
var scroll = window.getScroll();
|
||||
position.x += scroll.x;
|
||||
position.y += scroll.y;
|
||||
}
|
||||
return position;
|
||||
});
|
||||
|
||||
options.offset = {
|
||||
parentPositioned: offsetParent != document.id(options.relativeTo),
|
||||
x: options.offset.x - parentOffset.x + parentScroll.x,
|
||||
y: options.offset.y - parentOffset.y + parentScroll.y
|
||||
};
|
||||
},
|
||||
|
||||
setDimensionsOption: function(element, options){
|
||||
options.dimensions = element.getDimensions({
|
||||
computeSize: true,
|
||||
styles: ['padding', 'border', 'margin']
|
||||
});
|
||||
},
|
||||
|
||||
getPosition: function(element, options){
|
||||
var position = {};
|
||||
options = local.getOptions(element, options);
|
||||
var relativeTo = document.id(options.relativeTo) || document.body;
|
||||
|
||||
local.setPositionCoordinates(options, position, relativeTo);
|
||||
if (options.edge) local.toEdge(position, options);
|
||||
|
||||
var offset = options.offset;
|
||||
position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
|
||||
position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
|
||||
|
||||
local.toMinMax(position, options);
|
||||
|
||||
if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
|
||||
if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
|
||||
if (options.ignoreMargins) local.toIgnoreMargins(position, options);
|
||||
|
||||
position.left = Math.ceil(position.left);
|
||||
position.top = Math.ceil(position.top);
|
||||
delete position.x;
|
||||
delete position.y;
|
||||
|
||||
return position;
|
||||
},
|
||||
|
||||
setPositionCoordinates: function(options, position, relativeTo){
|
||||
var offsetY = options.offset.y,
|
||||
offsetX = options.offset.x,
|
||||
calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
|
||||
top = calc.y,
|
||||
left = calc.x,
|
||||
winSize = window.getSize();
|
||||
|
||||
switch(options.position.x){
|
||||
case 'left': position.x = left + offsetX; break;
|
||||
case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
|
||||
default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
|
||||
}
|
||||
|
||||
switch(options.position.y){
|
||||
case 'top': position.y = top + offsetY; break;
|
||||
case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
|
||||
default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
|
||||
}
|
||||
},
|
||||
|
||||
toMinMax: function(position, options){
|
||||
var xy = {left: 'x', top: 'y'}, value;
|
||||
['minimum', 'maximum'].each(function(minmax){
|
||||
['left', 'top'].each(function(lr){
|
||||
value = options[minmax] ? options[minmax][xy[lr]] : null;
|
||||
if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
toRelFixedPosition: function(relativeTo, position){
|
||||
var winScroll = window.getScroll();
|
||||
position.top += winScroll.y;
|
||||
position.left += winScroll.x;
|
||||
},
|
||||
|
||||
toIgnoreScroll: function(relativeTo, position){
|
||||
var relScroll = relativeTo.getScroll();
|
||||
position.top -= relScroll.y;
|
||||
position.left -= relScroll.x;
|
||||
},
|
||||
|
||||
toIgnoreMargins: function(position, options){
|
||||
position.left += options.edge.x == 'right'
|
||||
? options.dimensions['margin-right']
|
||||
: (options.edge.x != 'center'
|
||||
? -options.dimensions['margin-left']
|
||||
: -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
|
||||
|
||||
position.top += options.edge.y == 'bottom'
|
||||
? options.dimensions['margin-bottom']
|
||||
: (options.edge.y != 'center'
|
||||
? -options.dimensions['margin-top']
|
||||
: -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
|
||||
},
|
||||
|
||||
toEdge: function(position, options){
|
||||
var edgeOffset = {},
|
||||
dimensions = options.dimensions,
|
||||
edge = options.edge;
|
||||
|
||||
switch(edge.x){
|
||||
case 'left': edgeOffset.x = 0; break;
|
||||
case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
|
||||
// center
|
||||
default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
|
||||
}
|
||||
|
||||
switch(edge.y){
|
||||
case 'top': edgeOffset.y = 0; break;
|
||||
case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
|
||||
// center
|
||||
default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
|
||||
}
|
||||
|
||||
position.x += edgeOffset.x;
|
||||
position.y += edgeOffset.y;
|
||||
},
|
||||
|
||||
getCoordinateFromValue: function(option){
|
||||
if (typeOf(option) != 'string') return option;
|
||||
option = option.toLowerCase();
|
||||
|
||||
return {
|
||||
x: option.test('left') ? 'left'
|
||||
: (option.test('right') ? 'right' : 'center'),
|
||||
y: option.test(/upper|top/) ? 'top'
|
||||
: (option.test('bottom') ? 'bottom' : 'center')
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Element.implement({
|
||||
|
||||
position: function(options){
|
||||
//call original position if the options are x/y values
|
||||
if (options && (options.x != null || options.y != null)){
|
||||
return original ? original.apply(this, arguments) : this;
|
||||
if (options && (options.x != null || options.y != null)) {
|
||||
return (original ? original.apply(this, arguments) : this);
|
||||
}
|
||||
var position = this.setStyle('position', 'absolute').calculatePosition(options);
|
||||
return (options && options.returnPos) ? position : this.setStyles(position);
|
||||
},
|
||||
|
||||
Object.each(options || {}, function(v, k){
|
||||
if (v == null) delete options[k];
|
||||
});
|
||||
|
||||
options = Object.merge({
|
||||
// minimum: { x: 0, y: 0 },
|
||||
// maximum: { x: 0, y: 0},
|
||||
relativeTo: document.body,
|
||||
position: {
|
||||
x: 'center', //left, center, right
|
||||
y: 'center' //top, center, bottom
|
||||
},
|
||||
offset: {x: 0, y: 0}/*,
|
||||
edge: false,
|
||||
returnPos: false,
|
||||
relFixedPosition: false,
|
||||
ignoreMargins: false,
|
||||
ignoreScroll: false,
|
||||
allowNegative: false*/
|
||||
}, options);
|
||||
|
||||
//compute the offset of the parent positioned element if this element is in one
|
||||
var parentOffset = {x: 0, y: 0},
|
||||
parentPositioned = false;
|
||||
|
||||
/* dollar around getOffsetParent should not be necessary, but as it does not return
|
||||
* a mootools extended element in IE, an error occurs on the call to expose. See:
|
||||
* http://mootools.lighthouseapp.com/projects/2706/tickets/333-element-getoffsetparent-inconsistency-between-ie-and-other-browsers */
|
||||
var offsetParent = this.measure(function(){
|
||||
return document.id(this.getOffsetParent());
|
||||
});
|
||||
if (offsetParent && offsetParent != this.getDocument().body){
|
||||
parentOffset = offsetParent.measure(function(){
|
||||
return this.getPosition();
|
||||
});
|
||||
parentPositioned = offsetParent != document.id(options.relativeTo);
|
||||
options.offset.x = options.offset.x - parentOffset.x;
|
||||
options.offset.y = options.offset.y - parentOffset.y;
|
||||
}
|
||||
|
||||
//upperRight, bottomRight, centerRight, upperLeft, bottomLeft, centerLeft
|
||||
//topRight, topLeft, centerTop, centerBottom, center
|
||||
var fixValue = function(option){
|
||||
if (typeOf(option) != 'string') return option;
|
||||
option = option.toLowerCase();
|
||||
var val = {};
|
||||
|
||||
if (option.test('left')){
|
||||
val.x = 'left';
|
||||
} else if (option.test('right')){
|
||||
val.x = 'right';
|
||||
} else {
|
||||
val.x = 'center';
|
||||
}
|
||||
|
||||
if (option.test('upper') || option.test('top')){
|
||||
val.y = 'top';
|
||||
} else if (option.test('bottom')){
|
||||
val.y = 'bottom';
|
||||
} else {
|
||||
val.y = 'center';
|
||||
}
|
||||
|
||||
return val;
|
||||
};
|
||||
|
||||
options.edge = fixValue(options.edge);
|
||||
options.position = fixValue(options.position);
|
||||
if (!options.edge){
|
||||
if (options.position.x == 'center' && options.position.y == 'center') options.edge = {x:'center', y:'center'};
|
||||
else options.edge = {x:'left', y:'top'};
|
||||
}
|
||||
|
||||
this.setStyle('position', 'absolute');
|
||||
var rel = document.id(options.relativeTo) || document.body,
|
||||
calc = rel == document.body ? window.getScroll() : rel.getPosition(),
|
||||
top = calc.y, left = calc.x;
|
||||
|
||||
var dim = this.getDimensions({
|
||||
computeSize: true,
|
||||
styles:['padding', 'border','margin']
|
||||
});
|
||||
|
||||
var pos = {},
|
||||
prefY = options.offset.y,
|
||||
prefX = options.offset.x,
|
||||
winSize = window.getSize();
|
||||
|
||||
switch (options.position.x){
|
||||
case 'left':
|
||||
pos.x = left + prefX;
|
||||
break;
|
||||
case 'right':
|
||||
pos.x = left + prefX + rel.offsetWidth;
|
||||
break;
|
||||
default: //center
|
||||
pos.x = left + ((rel == document.body ? winSize.x : rel.offsetWidth)/2) + prefX;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (options.position.y){
|
||||
case 'top':
|
||||
pos.y = top + prefY;
|
||||
break;
|
||||
case 'bottom':
|
||||
pos.y = top + prefY + rel.offsetHeight;
|
||||
break;
|
||||
default: //center
|
||||
pos.y = top + ((rel == document.body ? winSize.y : rel.offsetHeight)/2) + prefY;
|
||||
break;
|
||||
}
|
||||
|
||||
if (options.edge){
|
||||
var edgeOffset = {};
|
||||
|
||||
switch (options.edge.x){
|
||||
case 'left':
|
||||
edgeOffset.x = 0;
|
||||
break;
|
||||
case 'right':
|
||||
edgeOffset.x = -dim.x-dim.computedRight-dim.computedLeft;
|
||||
break;
|
||||
default: //center
|
||||
edgeOffset.x = -(dim.totalWidth/2);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (options.edge.y){
|
||||
case 'top':
|
||||
edgeOffset.y = 0;
|
||||
break;
|
||||
case 'bottom':
|
||||
edgeOffset.y = -dim.y-dim.computedTop-dim.computedBottom;
|
||||
break;
|
||||
default: //center
|
||||
edgeOffset.y = -(dim.totalHeight/2);
|
||||
break;
|
||||
}
|
||||
|
||||
pos.x += edgeOffset.x;
|
||||
pos.y += edgeOffset.y;
|
||||
}
|
||||
|
||||
pos = {
|
||||
left: ((pos.x >= 0 || parentPositioned || options.allowNegative) ? pos.x : 0).toInt(),
|
||||
top: ((pos.y >= 0 || parentPositioned || options.allowNegative) ? pos.y : 0).toInt()
|
||||
};
|
||||
|
||||
var xy = {left: 'x', top: 'y'};
|
||||
|
||||
['minimum', 'maximum'].each(function(minmax){
|
||||
['left', 'top'].each(function(lr){
|
||||
var val = options[minmax] ? options[minmax][xy[lr]] : null;
|
||||
if (val != null && ((minmax == 'minimum') ? pos[lr] < val : pos[lr] > val)) pos[lr] = val;
|
||||
});
|
||||
});
|
||||
|
||||
if (rel.getStyle('position') == 'fixed' || options.relFixedPosition){
|
||||
var winScroll = window.getScroll();
|
||||
pos.top+= winScroll.y;
|
||||
pos.left+= winScroll.x;
|
||||
}
|
||||
if (options.ignoreScroll){
|
||||
var relScroll = rel.getScroll();
|
||||
pos.top -= relScroll.y;
|
||||
pos.left -= relScroll.x;
|
||||
}
|
||||
|
||||
if (options.ignoreMargins){
|
||||
pos.left += (
|
||||
options.edge.x == 'right' ? dim['margin-right'] :
|
||||
options.edge.x == 'center' ? -dim['margin-left'] + ((dim['margin-right'] + dim['margin-left'])/2) :
|
||||
- dim['margin-left']
|
||||
);
|
||||
pos.top += (
|
||||
options.edge.y == 'bottom' ? dim['margin-bottom'] :
|
||||
options.edge.y == 'center' ? -dim['margin-top'] + ((dim['margin-bottom'] + dim['margin-top'])/2) :
|
||||
- dim['margin-top']
|
||||
);
|
||||
}
|
||||
|
||||
pos.left = Math.ceil(pos.left);
|
||||
pos.top = Math.ceil(pos.top);
|
||||
if (options.returnPos) return pos;
|
||||
else this.setStyles(pos);
|
||||
return this;
|
||||
calculatePosition: function(options){
|
||||
return local.getPosition(this, options);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
})(Element.prototype.position);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -82,7 +82,9 @@ Page.Settings = new Class({
|
||||
var self = this;
|
||||
|
||||
var c = self.advanced_toggle.checked ? 'addClass' : 'removeClass';
|
||||
self.el[c]('show_advanced')
|
||||
self.el[c]('show_advanced');
|
||||
|
||||
Cookie.write('advanced_toggle_checked', +self.advanced_toggle.checked, {'duration': 365});
|
||||
},
|
||||
|
||||
create: function(json){
|
||||
@@ -96,6 +98,7 @@ Page.Settings = new Class({
|
||||
'text': 'Show advanced settings'
|
||||
}),
|
||||
self.advanced_toggle = new Element('input[type=checkbox].inlay', {
|
||||
'checked': +Cookie.read('advanced_toggle_checked'),
|
||||
'events': {
|
||||
'change': self.showAdvanced.bind(self)
|
||||
}
|
||||
@@ -103,6 +106,7 @@ Page.Settings = new Class({
|
||||
)
|
||||
)
|
||||
);
|
||||
self.showAdvanced();
|
||||
|
||||
new Form.Check(self.advanced_toggle)
|
||||
|
||||
@@ -130,7 +134,7 @@ Page.Settings = new Class({
|
||||
var class_name = (option.type || 'string').capitalize();
|
||||
var input = new Option[class_name](self, section_name, option.name, option);
|
||||
input.inject(self.tabs[group.tab].groups[group.name]);
|
||||
input.fireEvent('injected')
|
||||
input.fireEvent('injected');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user