Bug #18029 ยป update_prototype_scriptaculous.diff
typo3/contrib/prototype/prototype.js (working copy) | ||
---|---|---|
/* Prototype JavaScript framework, version 1.6.0
|
||
/* Prototype JavaScript framework, version 1.6.0.1
|
||
* (c) 2005-2007 Sam Stephenson
|
||
*
|
||
* Prototype is freely distributable under the terms of an MIT-style license.
|
||
... | ... | |
*--------------------------------------------------------------------------*/
|
||
var Prototype = {
|
||
Version: '1.6.0',
|
||
Version: '1.6.0.1',
|
||
Browser: {
|
||
IE: !!(window.attachEvent && !window.opera),
|
||
... | ... | |
if (Prototype.Browser.MobileSafari)
|
||
Prototype.BrowserFeatures.SpecificElementExtensions = false;
|
||
if (Prototype.Browser.WebKit)
|
||
Prototype.BrowserFeatures.XPath = false;
|
||
/* Based on Alex Arnell's inheritance implementation. */
|
||
var Class = {
|
||
... | ... | |
Object.extend(Object, {
|
||
inspect: function(object) {
|
||
try {
|
||
if (object === undefined) return 'undefined';
|
||
if (Object.isUndefined(object)) return 'undefined';
|
||
if (object === null) return 'null';
|
||
return object.inspect ? object.inspect() : object.toString();
|
||
} catch (e) {
|
||
... | ... | |
var results = [];
|
||
for (var property in object) {
|
||
var value = Object.toJSON(object[property]);
|
||
if (value !== undefined)
|
||
if (!Object.isUndefined(value))
|
||
results.push(property.toJSON() + ': ' + value);
|
||
}
|
||
... | ... | |
},
|
||
bind: function() {
|
||
if (arguments.length < 2 && arguments[0] === undefined) return this;
|
||
if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
|
||
var __method = this, args = $A(arguments), object = args.shift();
|
||
return function() {
|
||
return __method.apply(object, args.concat($A(arguments)));
|
||
... | ... | |
sub: function(pattern, replacement, count) {
|
||
replacement = this.gsub.prepareReplacement(replacement);
|
||
count = count === undefined ? 1 : count;
|
||
count = Object.isUndefined(count) ? 1 : count;
|
||
return this.gsub(pattern, function(match) {
|
||
if (--count < 0) return match[0];
|
||
... | ... | |
truncate: function(length, truncation) {
|
||
length = length || 30;
|
||
truncation = truncation === undefined ? '...' : truncation;
|
||
truncation = Object.isUndefined(truncation) ? '...' : truncation;
|
||
return this.length > length ?
|
||
this.slice(0, length - truncation.length) + truncation : String(this);
|
||
},
|
||
... | ... | |
},
|
||
isJSON: function() {
|
||
var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
|
||
var str = this;
|
||
if (str.blank()) return false;
|
||
str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
|
||
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
|
||
},
|
||
... | ... | |
if (before == '\\') return match[2];
|
||
var ctx = object, expr = match[3];
|
||
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
|
||
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
|
||
match = pattern.exec(expr);
|
||
if (match == null) return before;
|
||
while (match != null) {
|
||
... | ... | |
},
|
||
inGroupsOf: function(number, fillWith) {
|
||
fillWith = fillWith === undefined ? null : fillWith;
|
||
fillWith = Object.isUndefined(fillWith) ? null : fillWith;
|
||
return this.eachSlice(number, function(slice) {
|
||
while(slice.length < number) slice.push(fillWith);
|
||
return slice;
|
||
... | ... | |
var result;
|
||
this.each(function(value, index) {
|
||
value = iterator(value, index);
|
||
if (result == undefined || value >= result)
|
||
if (result == null || value >= result)
|
||
result = value;
|
||
});
|
||
return result;
|
||
... | ... | |
var result;
|
||
this.each(function(value, index) {
|
||
value = iterator(value, index);
|
||
if (result == undefined || value < result)
|
||
if (result == null || value < result)
|
||
result = value;
|
||
});
|
||
return result;
|
||
... | ... | |
function $A(iterable) {
|
||
if (!iterable) return [];
|
||
if (iterable.toArray) return iterable.toArray();
|
||
var length = iterable.length, results = new Array(length);
|
||
var length = iterable.length || 0, results = new Array(length);
|
||
while (length--) results[length] = iterable[length];
|
||
return results;
|
||
}
|
||
... | ... | |
if (!iterable) return [];
|
||
if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
|
||
iterable.toArray) return iterable.toArray();
|
||
var length = iterable.length, results = new Array(length);
|
||
var length = iterable.length || 0, results = new Array(length);
|
||
while (length--) results[length] = iterable[length];
|
||
return results;
|
||
}
|
||
... | ... | |
var results = [];
|
||
this.each(function(object) {
|
||
var value = Object.toJSON(object);
|
||
if (value !== undefined) results.push(value);
|
||
if (!Object.isUndefined(value)) results.push(value);
|
||
});
|
||
return '[' + results.join(', ') + ']';
|
||
}
|
||
... | ... | |
};
|
||
var Hash = Class.create(Enumerable, (function() {
|
||
if (function() {
|
||
var i = 0, Test = function(value) { this.key = value };
|
||
Test.prototype.key = 'foo';
|
||
for (var property in new Test('bar')) i++;
|
||
return i > 1;
|
||
}()) {
|
||
function each(iterator) {
|
||
var cache = [];
|
||
for (var key in this._object) {
|
||
var value = this._object[key];
|
||
if (cache.include(key)) continue;
|
||
cache.push(key);
|
||
var pair = [key, value];
|
||
pair.key = key;
|
||
pair.value = value;
|
||
iterator(pair);
|
||
}
|
||
}
|
||
} else {
|
||
function each(iterator) {
|
||
for (var key in this._object) {
|
||
var value = this._object[key], pair = [key, value];
|
||
pair.key = key;
|
||
pair.value = value;
|
||
iterator(pair);
|
||
}
|
||
}
|
||
}
|
||
function toQueryPair(key, value) {
|
||
if (Object.isUndefined(value)) return key;
|
||
... | ... | |
this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
|
||
},
|
||
_each: each,
|
||
_each: function(iterator) {
|
||
for (var key in this._object) {
|
||
var value = this._object[key], pair = [key, value];
|
||
pair.key = key;
|
||
pair.value = value;
|
||
iterator(pair);
|
||
}
|
||
},
|
||
set: function(key, value) {
|
||
return this._object[key] = value;
|
||
... | ... | |
Object.extend(this.options, options || { });
|
||
this.options.method = this.options.method.toLowerCase();
|
||
if (Object.isString(this.options.parameters))
|
||
this.options.parameters = this.options.parameters.toQueryParams();
|
||
else if (Object.isHash(this.options.parameters))
|
||
this.options.parameters = this.options.parameters.toObject();
|
||
}
|
||
});
|
||
... | ... | |
getHeader: function(name) {
|
||
try {
|
||
return this.transport.getResponseHeader(name);
|
||
return this.transport.getResponseHeader(name) || null;
|
||
} catch (e) { return null }
|
||
},
|
||
... | ... | |
if(readyState == 4) {
|
||
var xml = transport.responseXML;
|
||
this.responseXML = xml === undefined ? null : xml;
|
||
this.responseXML = Object.isUndefined(xml) ? null : xml;
|
||
this.responseJSON = this._getResponseJSON();
|
||
}
|
||
},
|
||
... | ... | |
_getResponseJSON: function() {
|
||
var options = this.request.options;
|
||
if (!options.evalJSON || (options.evalJSON != 'force' &&
|
||
!(this.getHeader('Content-type') || '').include('application/json')))
|
||
return null;
|
||
!(this.getHeader('Content-type') || '').include('application/json')) ||
|
||
this.responseText.blank())
|
||
return null;
|
||
try {
|
||
return this.transport.responseText.evalJSON(options.sanitizeJSON);
|
||
return this.responseText.evalJSON(options.sanitizeJSON);
|
||
} catch (e) {
|
||
this.request.dispatchException(e);
|
||
}
|
||
... | ... | |
failure: (container.failure || (container.success ? null : container))
|
||
};
|
||
options = options || { };
|
||
options = Object.clone(options);
|
||
var onComplete = options.onComplete;
|
||
options.onComplete = (function(response, param) {
|
||
options.onComplete = (function(response, json) {
|
||
this.updateContent(response.responseText);
|
||
if (Object.isFunction(onComplete)) onComplete(response, param);
|
||
if (Object.isFunction(onComplete)) onComplete(response, json);
|
||
}).bind(this);
|
||
$super(url, options);
|
||
... | ... | |
}
|
||
else receiver.update(responseText);
|
||
}
|
||
if (this.success()) {
|
||
if (this.onComplete) this.onComplete.bind(this).defer();
|
||
}
|
||
}
|
||
});
|
||
... | ... | |
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
|
||
insertions = {bottom:insertions};
|
||
var content, t, range;
|
||
var content, insert, tagName, childNodes;
|
||
for (position in insertions) {
|
||
content = insertions[position];
|
||
... | ... | |
for (position in insertions) {
|
||
content = insertions[position];
|
||
position = position.toLowerCase();
|
||
t = Element._insertionTranslations[position];
|
||
insert = Element._insertionTranslations[position];
|
||
if (content && content.toElement) content = content.toElement();
|
||
if (Object.isElement(content)) {
|
||
t.insert(element, content);
|
||
insert(element, content);
|
||
continue;
|
||
}
|
||
... | ... | |
content = Object.toHTML(content);
|
||
range = element.ownerDocument.createRange();
|
||
t.initializeRange(element, range);
|
||
t.insert(element, range.createContextualFragment(content.stripScripts()));
|
||
tagName = ((position == 'before' || position == 'after')
|
||
? element.parentNode : element).tagName.toUpperCase();
|
||
childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
|
||
if (position == 'top' || position == 'after') childNodes.reverse();
|
||
childNodes.each(insert.curry(element));
|
||
content.evalScripts.bind(content).defer();
|
||
}
|
||
... | ... | |
},
|
||
descendants: function(element) {
|
||
return $A($(element).getElementsByTagName('*')).each(Element.extend);
|
||
return $(element).getElementsBySelector("*");
|
||
},
|
||
firstDescendant: function(element) {
|
||
... | ... | |
element = $(element);
|
||
if (arguments.length == 1) return $(element.parentNode);
|
||
var ancestors = element.ancestors();
|
||
return expression ? Selector.findElement(ancestors, expression, index) :
|
||
ancestors[index || 0];
|
||
return Object.isNumber(expression) ? ancestors[expression] :
|
||
Selector.findElement(ancestors, expression, index);
|
||
},
|
||
down: function(element, expression, index) {
|
||
... | ... | |
down: function(element, expression, index) {
|
||
element = $(element);
|
||
if (arguments.length == 1) return element.firstDescendant();
|
||
var descendants = element.descendants();
|
||
return expression ? Selector.findElement(descendants, expression, index) :
|
||
descendants[index || 0];
|
||
return Object.isNumber(expression) ? element.descendants()[expression] :
|
||
element.select(expression)[index || 0];
|
||
},
|
||
previous: function(element, expression, index) {
|
||
element = $(element);
|
||
if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
|
||
var previousSiblings = element.previousSiblings();
|
||
return expression ? Selector.findElement(previousSiblings, expression, index) :
|
||
previousSiblings[index || 0];
|
||
return Object.isNumber(expression) ? previousSiblings[expression] :
|
||
Selector.findElement(previousSiblings, expression, index);
|
||
},
|
||
next: function(element, expression, index) {
|
||
element = $(element);
|
||
if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
|
||
var nextSiblings = element.nextSiblings();
|
||
return expression ? Selector.findElement(nextSiblings, expression, index) :
|
||
nextSiblings[index || 0];
|
||
return Object.isNumber(expression) ? nextSiblings[expression] :
|
||
Selector.findElement(nextSiblings, expression, index);
|
||
},
|
||
select: function() {
|
||
... | ... | |
var attributes = { }, t = Element._attributeTranslations.write;
|
||
if (typeof name == 'object') attributes = name;
|
||
else attributes[name] = value === undefined ? true : value;
|
||
else attributes[name] = Object.isUndefined(value) ? true : value;
|
||
for (var attr in attributes) {
|
||
var name = t.names[attr] || attr, value = attributes[attr];
|
||
name = t.names[attr] || attr;
|
||
value = attributes[attr];
|
||
if (t.values[attr]) name = t.values[attr](element, value);
|
||
if (value === false || value === null)
|
||
element.removeAttribute(name);
|
||
... | ... | |
descendantOf: function(element, ancestor) {
|
||
element = $(element), ancestor = $(ancestor);
|
||
var originalAncestor = ancestor;
|
||
if (element.compareDocumentPosition)
|
||
return (element.compareDocumentPosition(ancestor) & 8) === 8;
|
||
... | ... | |
}
|
||
while (element = element.parentNode)
|
||
if (element == ancestor) return true;
|
||
if (element == originalAncestor) return true;
|
||
return false;
|
||
},
|
||
... | ... | |
if (property == 'opacity') element.setOpacity(styles[property]);
|
||
else
|
||
elementStyle[(property == 'float' || property == 'cssFloat') ?
|
||
(elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
|
||
(Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
|
||
property] = styles[property];
|
||
return element;
|
||
... | ... | |
}
|
||
};
|
||
if (!document.createRange || Prototype.Browser.Opera) {
|
||
Element.Methods.insert = function(element, insertions) {
|
||
element = $(element);
|
||
if (Object.isString(insertions) || Object.isNumber(insertions) ||
|
||
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
|
||
insertions = { bottom: insertions };
|
||
var t = Element._insertionTranslations, content, position, pos, tagName;
|
||
for (position in insertions) {
|
||
content = insertions[position];
|
||
position = position.toLowerCase();
|
||
pos = t[position];
|
||
if (Prototype.Browser.Opera) {
|
||
Element.Methods.getStyle = Element.Methods.getStyle.wrap(
|
||
function(proceed, element, style) {
|
||
switch (style) {
|
||
case 'left': case 'top': case 'right': case 'bottom':
|
||
if (proceed(element, 'position') === 'static') return null;
|
||
case 'height': case 'width':
|
||
// returns '0px' for hidden elements; we want it to return null
|
||
if (!Element.visible(element)) return null;
|
||
if (content && content.toElement) content = content.toElement();
|
||
if (Object.isElement(content)) {
|
||
pos.insert(element, content);
|
||
continue;
|
||
}
|
||
// returns the border-box dimensions rather than the content-box
|
||
// dimensions, so we subtract padding and borders from the value
|
||
var dim = parseInt(proceed(element, style), 10);
|
||
content = Object.toHTML(content);
|
||
tagName = ((position == 'before' || position == 'after')
|
||
? element.parentNode : element).tagName.toUpperCase();
|
||
if (dim !== element['offset' + style.capitalize()])
|
||
return dim + 'px';
|
||
if (t.tags[tagName]) {
|
||
var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
|
||
if (position == 'top' || position == 'after') fragments.reverse();
|
||
fragments.each(pos.insert.curry(element));
|
||
var properties;
|
||
if (style === 'height') {
|
||
properties = ['border-top-width', 'padding-top',
|
||
'padding-bottom', 'border-bottom-width'];
|
||
}
|
||
else {
|
||
properties = ['border-left-width', 'padding-left',
|
||
'padding-right', 'border-right-width'];
|
||
}
|
||
return properties.inject(dim, function(memo, property) {
|
||
var val = proceed(element, property);
|
||
return val === null ? memo : memo - parseInt(val, 10);
|
||
}) + 'px';
|
||
default: return proceed(element, style);
|
||
}
|
||
else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
|
||
content.evalScripts.bind(content).defer();
|
||
}
|
||
return element;
|
||
};
|
||
}
|
||
);
|
||
if (Prototype.Browser.Opera) {
|
||
Element.Methods._getStyle = Element.Methods.getStyle;
|
||
Element.Methods.getStyle = function(element, style) {
|
||
switch(style) {
|
||
case 'left':
|
||
case 'top':
|
||
case 'right':
|
||
case 'bottom':
|
||
if (Element._getStyle(element, 'position') == 'static') return null;
|
||
default: return Element._getStyle(element, style);
|
||
Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
|
||
function(proceed, element, attribute) {
|
||
if (attribute === 'title') return element.title;
|
||
return proceed(element, attribute);
|
||
}
|
||
};
|
||
Element.Methods._readAttribute = Element.Methods.readAttribute;
|
||
Element.Methods.readAttribute = function(element, attribute) {
|
||
if (attribute == 'title') return element.title;
|
||
return Element._readAttribute(element, attribute);
|
||
};
|
||
);
|
||
}
|
||
else if (Prototype.Browser.IE) {
|
||
... | ... | |
return node ? node.value : "";
|
||
},
|
||
_getEv: function(element, attribute) {
|
||
var attribute = element.getAttribute(attribute);
|
||
attribute = element.getAttribute(attribute);
|
||
return attribute ? attribute.toString().slice(23, -2) : null;
|
||
},
|
||
_flag: function(element, attribute) {
|
||
... | ... | |
};
|
||
// Safari returns margins on body which is incorrect if the child is absolutely
|
||
// positioned. For performance reasons, redefine Position.cumulativeOffset for
|
||
// positioned. For performance reasons, redefine Element#cumulativeOffset for
|
||
// KHTML/WebKit only.
|
||
Element.Methods.cumulativeOffset = function(element) {
|
||
var valueT = 0, valueL = 0;
|
||
... | ... | |
Element._getContentFromAnonymousElement = function(tagName, html) {
|
||
var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
|
||
div.innerHTML = t[0] + html + t[1];
|
||
t[2].times(function() { div = div.firstChild });
|
||
if (t) {
|
||
div.innerHTML = t[0] + html + t[1];
|
||
t[2].times(function() { div = div.firstChild });
|
||
} else div.innerHTML = html;
|
||
return $A(div.childNodes);
|
||
};
|
||
... | ... | |
};
|
||
Element._insertionTranslations = {
|
||
before: {
|
||
adjacency: 'beforeBegin',
|
||
insert: function(element, node) {
|
||
element.parentNode.insertBefore(node, element);
|
||
},
|
||
initializeRange: function(element, range) {
|
||
range.setStartBefore(element);
|
||
}
|
||
before: function(element, node) {
|
||
element.parentNode.insertBefore(node, element);
|
||
},
|
||
top: {
|
||
adjacency: 'afterBegin',
|
||
insert: function(element, node) {
|
||
element.insertBefore(node, element.firstChild);
|
||
},
|
||
initializeRange: function(element, range) {
|
||
range.selectNodeContents(element);
|
||
range.collapse(true);
|
||
}
|
||
top: function(element, node) {
|
||
element.insertBefore(node, element.firstChild);
|
||
},
|
||
bottom: {
|
||
adjacency: 'beforeEnd',
|
||
insert: function(element, node) {
|
||
element.appendChild(node);
|
||
}
|
||
bottom: function(element, node) {
|
||
element.appendChild(node);
|
||
},
|
||
after: {
|
||
adjacency: 'afterEnd',
|
||
insert: function(element, node) {
|
||
element.parentNode.insertBefore(node, element.nextSibling);
|
||
},
|
||
initializeRange: function(element, range) {
|
||
range.setStartAfter(element);
|
||
}
|
||
after: function(element, node) {
|
||
element.parentNode.insertBefore(node, element.nextSibling);
|
||
},
|
||
tags: {
|
||
TABLE: ['<table>', '</table>', 1],
|
||
... | ... | |
};
|
||
(function() {
|
||
this.bottom.initializeRange = this.top.initializeRange;
|
||
Object.extend(this.tags, {
|
||
THEAD: this.tags.TBODY,
|
||
TFOOT: this.tags.TBODY,
|
||
... | ... | |
document.viewport = {
|
||
getDimensions: function() {
|
||
var dimensions = { };
|
||
var B = Prototype.Browser;
|
||
$w('width height').each(function(d) {
|
||
var D = d.capitalize();
|
||
dimensions[d] = self['inner' + D] ||
|
||
(document.documentElement['client' + D] || document.body['client' + D]);
|
||
dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
|
||
(B.Opera) ? document.body['client' + D] : document.documentElement['client' + D];
|
||
});
|
||
return dimensions;
|
||
},
|
||
... | ... | |
this.compileMatcher();
|
||
},
|
||
shouldUseXPath: function() {
|
||
if (!Prototype.BrowserFeatures.XPath) return false;
|
||
var e = this.expression;
|
||
// Safari 3 chokes on :*-of-type and :empty
|
||
if (Prototype.Browser.WebKit &&
|
||
(e.include("-of-type") || e.include(":empty")))
|
||
return false;
|
||
// XPath can't do namespaced attributes, nor can it read
|
||
// the "checked" property from DOM nodes
|
||
if ((/(\[[\w-]*?:|:checked)/).test(this.expression))
|
||
return false;
|
||
return true;
|
||
},
|
||
compileMatcher: function() {
|
||
// Selectors with namespaced attributes can't use the XPath version
|
||
if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression))
|
||
if (this.shouldUseXPath())
|
||
return this.compileXPathMatcher();
|
||
var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
|
||
... | ... | |
},
|
||
className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
|
||
id: "[@id='#{1}']",
|
||
attrPresence: "[@#{1}]",
|
||
attrPresence: function(m) {
|
||
m[1] = m[1].toLowerCase();
|
||
return new Template("[@#{1}]").evaluate(m);
|
||
},
|
||
attr: function(m) {
|
||
m[1] = m[1].toLowerCase();
|
||
m[3] = m[5] || m[6];
|
||
return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
|
||
},
|
||
... | ... | |
'enabled': "[not(@disabled)]",
|
||
'not': function(m) {
|
||
var e = m[6], p = Selector.patterns,
|
||
x = Selector.xpath, le, m, v;
|
||
x = Selector.xpath, le, v;
|
||
var exclusion = [];
|
||
while (e && le != e && (/\S/).test(e)) {
|
||
... | ... | |
tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
|
||
id: /^#([\w\-\*]+)(\b|$)/,
|
||
className: /^\.([\w\-\*]+)(\b|$)/,
|
||
pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
|
||
pseudo:
|
||
/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
|
||
attrPresence: /^\[([\w]+)\]/,
|
||
attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
|
||
},
|
||
... | ... | |
child: function(nodes) {
|
||
var h = Selector.handlers;
|
||
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
||
for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
|
||
for (var j = 0, child; child = node.childNodes[j]; j++)
|
||
if (child.nodeType == 1 && child.tagName != '!') results.push(child);
|
||
}
|
||
return results;
|
||
... | ... | |
// TOKEN FUNCTIONS
|
||
tagName: function(nodes, root, tagName, combinator) {
|
||
tagName = tagName.toUpperCase();
|
||
var uTagName = tagName.toUpperCase();
|
||
var results = [], h = Selector.handlers;
|
||
if (nodes) {
|
||
if (combinator) {
|
||
... | ... | |
if (tagName == "*") return nodes;
|
||
}
|
||
for (var i = 0, node; node = nodes[i]; i++)
|
||
if (node.tagName.toUpperCase() == tagName) results.push(node);
|
||
if (node.tagName.toUpperCase() === uTagName) results.push(node);
|
||
return results;
|
||
} else return root.getElementsByTagName(tagName);
|
||
},
|
||
... | ... | |
},
|
||
findChildElements: function(element, expressions) {
|
||
var exprs = expressions.join(','), expressions = [];
|
||
var exprs = expressions.join(',');
|
||
expressions = [];
|
||
exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
|
||
expressions.push(m[1].strip());
|
||
});
|
||
... | ... | |
}
|
||
});
|
||
if (Prototype.Browser.IE) {
|
||
// IE returns comment nodes on getElementsByTagName("*").
|
||
// Filter them out.
|
||
Selector.handlers.concat = function(a, b) {
|
||
for (var i = 0, node; node = b[i]; i++)
|
||
if (node.tagName !== "!") a.push(node);
|
||
return a;
|
||
};
|
||
}
|
||
function $$() {
|
||
return Selector.findChildElements(document, $A(arguments));
|
||
}
|
||
... | ... | |
serializeElements: function(elements, options) {
|
||
if (typeof options != 'object') options = { hash: !!options };
|
||
else if (options.hash === undefined) options.hash = true;
|
||
else if (Object.isUndefined(options.hash)) options.hash = true;
|
||
var key, value, submitted = false, submit = options.submit;
|
||
var data = elements.inject({ }, function(result, element) {
|
||
... | ... | |
},
|
||
inputSelector: function(element, value) {
|
||
if (value === undefined) return element.checked ? element.value : null;
|
||
if (Object.isUndefined(value)) return element.checked ? element.value : null;
|
||
else element.checked = !!value;
|
||
},
|
||
... | ... | |
},
|
||
textarea: function(element, value) {
|
||
if (value === undefined) return element.value;
|
||
if (Object.isUndefined(value)) return element.value;
|
||
else element.value = value;
|
||
},
|
||
... | ... | |
},
|
||
select: function(element, index) {
|
||
if (index === undefined)
|
||
if (Object.isUndefined(index))
|
||
return this[element.type == 'select-one' ?
|
||
'selectOne' : 'selectMany'](element);
|
||
else {
|
||
... | ... | |
findElement: function(event, expression) {
|
||
var element = Event.element(event);
|
||
return element.match(expression) ? element : element.up(expression);
|
||
if (!expression) return element;
|
||
var elements = [element].concat(element.ancestors());
|
||
return Selector.findElement(elements, expression, 0);
|
||
},
|
||
pointer: function(event) {
|
||
... | ... | |
return false;
|
||
Event.extend(event);
|
||
handler.call(element, event)
|
||
handler.call(element, event);
|
||
};
|
||
wrapper.handler = handler;
|
||
... | ... | |
if (element == document && document.createEvent && !element.dispatchEvent)
|
||
element = document.documentElement;
|
||
var event;
|
||
if (document.createEvent) {
|
||
var event = document.createEvent("HTMLEvents");
|
||
event = document.createEvent("HTMLEvents");
|
||
event.initEvent("dataavailable", true, true);
|
||
} else {
|
||
var event = document.createEventObject();
|
||
event = document.createEventObject();
|
||
event.eventType = "ondataavailable";
|
||
}
|
||
... | ... | |
element.fireEvent(event.eventType, event);
|
||
}
|
||
return event;
|
||
return Event.extend(event);
|
||
}
|
||
};
|
||
})());
|
||
... | ... | |
Object.extend(document, {
|
||
fire: Element.Methods.fire.methodize(),
|
||
observe: Element.Methods.observe.methodize(),
|
||
stopObserving: Element.Methods.stopObserving.methodize()
|
||
stopObserving: Element.Methods.stopObserving.methodize(),
|
||
loaded: false
|
||
});
|
||
(function() {
|
||
/* Support for the DOMContentLoaded event is based on work by Dan Webb,
|
||
Matthias Miller, Dean Edwards and John Resig. */
|
||
var timer, fired = false;
|
||
var timer;
|
||
function fireContentLoadedEvent() {
|
||
if (fired) return;
|
||
if (document.loaded) return;
|
||
if (timer) window.clearInterval(timer);
|
||
document.fire("dom:loaded");
|
||
fired = true;
|
||
document.loaded = true;
|
||
}
|
||
if (document.addEventListener) {
|
typo3/contrib/scriptaculous/builder.js (working copy) | ||
---|---|---|
// script.aculo.us builder.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||
//
|
typo3/contrib/scriptaculous/controls.js (working copy) | ||
---|---|---|
// script.aculo.us controls.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||
// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
||
... | ... | |
Element.hide(this.update);
|
||
Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
|
||
Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this));
|
||
Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
|
||
},
|
||
show: function() {
|
||
... | ... | |
case Event.KEY_UP:
|
||
this.markPrevious();
|
||
this.render();
|
||
if(Prototype.Browser.WebKit) Event.stop(event);
|
||
Event.stop(event);
|
||
return;
|
||
case Event.KEY_DOWN:
|
||
this.markNext();
|
||
... | ... | |
case Event.KEY_DOWN:
|
||
this.markNext();
|
||
this.render();
|
||
if(Prototype.Browser.WebKit) Event.stop(event);
|
||
Event.stop(event);
|
||
return;
|
||
}
|
||
else
|
typo3/contrib/scriptaculous/dragdrop.js (working copy) | ||
---|---|---|
// script.aculo.us dragdrop.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||
// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
|
typo3/contrib/scriptaculous/effects.js (working copy) | ||
---|---|---|
// script.aculo.us effects.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||
// Contributors:
|
||
... | ... | |
Element.getStyles = function(element) {
|
||
element = $(element);
|
||
var css = element.currentStyle, styles;
|
||
styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) {
|
||
hash.set(property, css[property]);
|
||
return hash;
|
||
styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
|
||
results[property] = css[property];
|
||
return results;
|
||
});
|
||
if (!styles.opacity) styles.set('opacity', element.getOpacity());
|
||
if (!styles.opacity) styles.opacity = element.getOpacity();
|
||
return styles;
|
||
};
|
||
};
|
typo3/contrib/scriptaculous/scriptaculous.js (working copy) | ||
---|---|---|
// script.aculo.us scriptaculous.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||
//
|
||
... | ... | |
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
||
var Scriptaculous = {
|
||
Version: '1.8.0',
|
||
Version: '1.8.1',
|
||
require: function(libraryName) {
|
||
// inserting via DOM fails in Safari 2.0, so brute force approach
|
||
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
|
typo3/contrib/scriptaculous/slider.js (working copy) | ||
---|---|---|
// script.aculo.us slider.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs
|
||
//
|
typo3/contrib/scriptaculous/sound.js (working copy) | ||
---|---|---|
// script.aculo.us sound.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us sound.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||
//
|
typo3/contrib/scriptaculous/unittest.js (working copy) | ||
---|---|---|
// script.aculo.us unittest.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
|
||
// script.aculo.us unittest.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||
// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
|