Zeile 1 | Zeile 1 |
---|
/* Prototype JavaScript framework, version 1.6.0.2
| /* Prototype JavaScript framework, version 1.6.0.3
|
* (c) 2005-2008 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license.
| * (c) 2005-2008 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license.
|
Zeile 7 | Zeile 7 |
---|
*--------------------------------------------------------------------------*/
var Prototype = {
|
*--------------------------------------------------------------------------*/
var Prototype = {
|
Version: '1.6.0.2',
| Version: '1.6.0.3',
|
Browser: {
|
Browser: {
|
IE: !!(window.attachEvent && !window.opera), Opera: !!window.opera,
| IE: !!(window.attachEvent && navigator.userAgent.indexOf('Opera') === -1), Opera: navigator.userAgent.indexOf('Opera') > -1,
|
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
|
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
|
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
| Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') === -1,
|
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) },
BrowserFeatures: { XPath: !!document.evaluate,
|
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) },
BrowserFeatures: { XPath: !!document.evaluate,
|
| SelectorsAPI: !!document.querySelector,
|
ElementExtensions: !!window.HTMLElement, SpecificElementExtensions:
|
ElementExtensions: !!window.HTMLElement, SpecificElementExtensions:
|
document.createElement('div').__proto__ && document.createElement('div').__proto__ !== document.createElement('form').__proto__
| document.createElement('div')['__proto__'] && document.createElement('div')['__proto__'] !== document.createElement('form')['__proto__']
|
},
ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
| },
ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
|
Zeile 83 | Zeile 86 |
---|
var property = properties[i], value = source[property]; if (ancestor && Object.isFunction(value) && value.argumentNames().first() == "$super") {
|
var property = properties[i], value = source[property]; if (ancestor && Object.isFunction(value) && value.argumentNames().first() == "$super") {
|
var method = value, value = Object.extend((function(m) {
| var method = value; value = (function(m) {
|
return function() { return ancestor[m].apply(this, arguments) };
|
return function() { return ancestor[m].apply(this, arguments) };
|
})(property).wrap(method), { valueOf: function() { return method }, toString: function() { return method.toString() } });
| })(property).wrap(method);
value.valueOf = method.valueOf.bind(method); value.toString = method.toString.bind(method);
|
} this.prototype[property] = value; }
| } this.prototype[property] = value; }
|
Zeile 146 | Zeile 150 |
---|
toHTML: function(object) { return object && object.toHTML ? object.toHTML() : String.interpret(object);
|
toHTML: function(object) { return object && object.toHTML ? object.toHTML() : String.interpret(object);
|
},
| },
|
keys: function(object) { var keys = [];
|
keys: function(object) { var keys = [];
|
for (var property in object)
| for (var property in object)
|
keys.push(property); return keys; },
| keys.push(property); return keys; },
|
Zeile 160 | Zeile 164 |
---|
for (var property in object) values.push(object[property]); return values;
|
for (var property in object) values.push(object[property]); return values;
|
},
| },
|
clone: function(object) { return Object.extend({ }, object); },
isElement: function(object) {
|
clone: function(object) { return Object.extend({ }, object); },
isElement: function(object) {
|
return object && object.nodeType == 1; },
| return !!(object && object.nodeType == 1); },
|
isArray: function(object) { return object != null && typeof object == "object" &&
| isArray: function(object) { return object != null && typeof object == "object" &&
|
Zeile 198 | Zeile 202 |
---|
Object.extend(Function.prototype, { argumentNames: function() {
|
Object.extend(Function.prototype, { argumentNames: function() {
|
var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
| var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1] .replace(/\s+/g, '').split(',');
|
return names.length == 1 && !names[0] ? [] : names; },
| return names.length == 1 && !names[0] ? [] : names; },
|
Zeile 207 | Zeile 212 |
---|
var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments)));
|
var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments)));
|
} },
| } },
|
bindAsEventListener: function() { var __method = this, args = $A(arguments), object = args.shift();
| bindAsEventListener: function() { var __method = this, args = $A(arguments), object = args.shift();
|
Zeile 230 | Zeile 235 |
---|
return window.setTimeout(function() { return __method.apply(__method, args); }, timeout);
|
return window.setTimeout(function() { return __method.apply(__method, args); }, timeout);
|
| },
defer: function() { var args = [0.01].concat($A(arguments)); return this.delay.apply(this, args);
|
},
wrap: function(wrapper) {
|
},
wrap: function(wrapper) {
|
var __method = this;
| var __method = this;
|
return function() { return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); }
| return function() { return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); }
|
Zeile 247 | Zeile 257 |
---|
}; } });
|
}; } });
|
Function.prototype.defer = Function.prototype.delay.curry(0.01);
| |
Date.prototype.toJSON = function() { return '"' + this.getUTCFullYear() + '-' +
| Date.prototype.toJSON = function() { return '"' + this.getUTCFullYear() + '-' +
|
Zeile 530 | Zeile 538 |
---|
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }, unescapeHTML: function() {
|
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }, unescapeHTML: function() {
|
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
| return this.stripTags().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
} });
| } });
|
Zeile 547 | Zeile 555 |
---|
text: document.createTextNode('') });
|
text: document.createTextNode('') });
|
with (String.prototype.escapeHTML) div.appendChild(text);
| String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
|
var Template = Class.create({ initialize: function(template, pattern) {
| var Template = Class.create({ initialize: function(template, pattern) {
|
Zeile 589 | Zeile 597 |
---|
var Enumerable = { each: function(iterator, context) { var index = 0;
|
var Enumerable = { each: function(iterator, context) { var index = 0;
|
iterator = iterator.bind(context);
| |
try { this._each(function(value) {
|
try { this._each(function(value) {
|
iterator(value, index++);
| iterator.call(context, value, index++);
|
}); } catch (e) { if (e != $break) throw e;
| }); } catch (e) { if (e != $break) throw e;
|
Zeile 601 | Zeile 608 |
---|
},
eachSlice: function(number, iterator, context) {
|
},
eachSlice: function(number, iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| |
var index = -number, slices = [], array = this.toArray();
|
var index = -number, slices = [], array = this.toArray();
|
| if (number < 1) return array;
|
while ((index += number) < array.length) slices.push(array.slice(index, index+number)); return slices.collect(iterator, context); },
all: function(iterator, context) {
|
while ((index += number) < array.length) slices.push(array.slice(index, index+number)); return slices.collect(iterator, context); },
all: function(iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| iterator = iterator || Prototype.K;
|
var result = true; this.each(function(value, index) {
|
var result = true; this.each(function(value, index) {
|
result = result && !!iterator(value, index);
| result = result && !!iterator.call(context, value, index);
|
if (!result) throw $break; }); return result; },
any: function(iterator, context) {
|
if (!result) throw $break; }); return result; },
any: function(iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| iterator = iterator || Prototype.K;
|
var result = false; this.each(function(value, index) {
|
var result = false; this.each(function(value, index) {
|
if (result = !!iterator(value, index))
| if (result = !!iterator.call(context, value, index))
|
throw $break; }); return result; },
collect: function(iterator, context) {
|
throw $break; }); return result; },
collect: function(iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| iterator = iterator || Prototype.K;
|
var results = []; this.each(function(value, index) {
|
var results = []; this.each(function(value, index) {
|
results.push(iterator(value, index));
| results.push(iterator.call(context, value, index));
|
}); return results; },
detect: function(iterator, context) {
|
}); return results; },
detect: function(iterator, context) {
|
iterator = iterator.bind(context);
| |
var result; this.each(function(value, index) {
|
var result; this.each(function(value, index) {
|
if (iterator(value, index)) {
| if (iterator.call(context, value, index)) {
|
result = value; throw $break; }
| result = value; throw $break; }
|
Zeile 650 | Zeile 656 |
---|
},
findAll: function(iterator, context) {
|
},
findAll: function(iterator, context) {
|
iterator = iterator.bind(context);
| |
var results = []; this.each(function(value, index) {
|
var results = []; this.each(function(value, index) {
|
if (iterator(value, index))
| if (iterator.call(context, value, index))
|
results.push(value); }); return results; },
grep: function(filter, iterator, context) {
|
results.push(value); }); return results; },
grep: function(filter, iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| iterator = iterator || Prototype.K;
|
var results = [];
if (Object.isString(filter))
| var results = [];
if (Object.isString(filter))
|
Zeile 668 | Zeile 673 |
---|
this.each(function(value, index) { if (filter.match(value))
|
this.each(function(value, index) { if (filter.match(value))
|
results.push(iterator(value, index));
| results.push(iterator.call(context, value, index));
|
}); return results; },
| }); return results; },
|
Zeile 696 | Zeile 701 |
---|
},
inject: function(memo, iterator, context) {
|
},
inject: function(memo, iterator, context) {
|
iterator = iterator.bind(context);
| |
this.each(function(value, index) {
|
this.each(function(value, index) {
|
memo = iterator(memo, value, index);
| memo = iterator.call(context, memo, value, index);
|
}); return memo; },
| }); return memo; },
|
Zeile 711 | Zeile 715 |
---|
},
max: function(iterator, context) {
|
},
max: function(iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| iterator = iterator || Prototype.K;
|
var result; this.each(function(value, index) {
|
var result; this.each(function(value, index) {
|
value = iterator(value, index);
| value = iterator.call(context, value, index);
|
if (result == null || value >= result) result = value; });
| if (result == null || value >= result) result = value; });
|
Zeile 722 | Zeile 726 |
---|
},
min: function(iterator, context) {
|
},
min: function(iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| iterator = iterator || Prototype.K;
|
var result; this.each(function(value, index) {
|
var result; this.each(function(value, index) {
|
value = iterator(value, index);
| value = iterator.call(context, value, index);
|
if (result == null || value < result) result = value; });
| if (result == null || value < result) result = value; });
|
Zeile 733 | Zeile 737 |
---|
},
partition: function(iterator, context) {
|
},
partition: function(iterator, context) {
|
iterator = iterator ? iterator.bind(context) : Prototype.K;
| iterator = iterator || Prototype.K;
|
var trues = [], falses = []; this.each(function(value, index) {
|
var trues = [], falses = []; this.each(function(value, index) {
|
(iterator(value, index) ?
| (iterator.call(context, value, index) ?
|
trues : falses).push(value); }); return [trues, falses];
| trues : falses).push(value); }); return [trues, falses];
|
Zeile 751 | Zeile 755 |
---|
},
reject: function(iterator, context) {
|
},
reject: function(iterator, context) {
|
iterator = iterator.bind(context);
| |
var results = []; this.each(function(value, index) {
|
var results = []; this.each(function(value, index) {
|
if (!iterator(value, index))
| if (!iterator.call(context, value, index))
|
results.push(value); }); return results; },
sortBy: function(iterator, context) {
|
results.push(value); }); return results; },
sortBy: function(iterator, context) {
|
iterator = iterator.bind(context);
| |
return this.map(function(value, index) {
|
return this.map(function(value, index) {
|
return {value: value, criteria: iterator(value, index)};
| return { value: value, criteria: iterator.call(context, value, index) };
|
}).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0;
| }).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0;
|
Zeile 815 | Zeile 820 |
---|
if (Prototype.Browser.WebKit) { $A = function(iterable) { if (!iterable) return [];
|
if (Prototype.Browser.WebKit) { $A = function(iterable) { if (!iterable) return [];
|
if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && iterable.toArray) return iterable.toArray();
| // In Safari, only use the `toArray` method if it's not a NodeList. // A NodeList is a function, has an function `item` property, and a numeric // `length` property. Adapted from Google Doctype. if (!(typeof iterable === 'function' && typeof iterable.length === 'number' && typeof iterable.item === 'function') && iterable.toArray) return iterable.toArray();
|
var length = iterable.length || 0, results = new Array(length); while (length--) results[length] = iterable[length]; return results;
| var length = iterable.length || 0, results = new Array(length); while (length--) results[length] = iterable[length]; return results;
|
Zeile 963 | Zeile 972 |
---|
return this + 1; },
|
return this + 1; },
|
times: function(iterator) { $R(0, this, true).each(iterator);
| times: function(iterator, context) { $R(0, this, true).each(iterator, context);
|
return this; },
| return this; },
|
Zeile 1011 | Zeile 1020 |
---|
},
get: function(key) {
|
},
get: function(key) {
|
return this._object[key];
| // simulating poorly supported hasOwnProperty if (this._object[key] !== Object.prototype[key]) return this._object[key];
|
},
unset: function(key) {
| },
unset: function(key) {
|
Zeile 1051 | Zeile 1062 |
---|
},
toQueryString: function() {
|
},
toQueryString: function() {
|
return this.map(function(pair) {
| return this.inject([], function(results, pair) {
|
var key = encodeURIComponent(pair.key), values = pair.value;
if (values && typeof values == 'object') { if (Object.isArray(values))
|
var key = encodeURIComponent(pair.key), values = pair.value;
if (values && typeof values == 'object') { if (Object.isArray(values))
|
return values.map(toQueryPair.curry(key)).join('&'); } return toQueryPair(key, values);
| return results.concat(values.map(toQueryPair.curry(key))); } else results.push(toQueryPair(key, values)); return results;
|
}).join('&'); },
| }).join('&'); },
|
Zeile 1085 | Zeile 1096 |
---|
this.start = start; this.end = end; this.exclusive = exclusive;
|
this.start = start; this.end = end; this.exclusive = exclusive;
|
},
| },
|
_each: function(iterator) { var value = this.start; while (this.include(value)) { iterator(value); value = value.succ(); }
|
_each: function(iterator) { var value = this.start; while (this.include(value)) { iterator(value); value = value.succ(); }
|
},
| },
|
include: function(value) { if (value < this.start)
| include: function(value) { if (value < this.start)
|
Zeile 1115 | Zeile 1126 |
---|
function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false;
|
function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false;
|
},
| },
|
activeRequestCount: 0 };
|
activeRequestCount: 0 };
|
|
|
Ajax.Responders = { responders: [],
|
Ajax.Responders = { responders: [],
|
|
|
_each: function(iterator) { this.responders._each(iterator); },
| _each: function(iterator) { this.responders._each(iterator); },
|
Zeile 1173 | Zeile 1184 |
---|
this.options.parameters = this.options.parameters.toQueryParams(); else if (Object.isHash(this.options.parameters)) this.options.parameters = this.options.parameters.toObject();
|
this.options.parameters = this.options.parameters.toQueryParams(); else if (Object.isHash(this.options.parameters)) this.options.parameters = this.options.parameters.toObject();
|
}
| }
|
});
Ajax.Request = Class.create(Ajax.Base, {
| });
Ajax.Request = Class.create(Ajax.Base, {
|
Zeile 1197 | Zeile 1208 |
---|
}
this.parameters = params;
|
}
this.parameters = params;
|
|
|
if (params = Object.toQueryString(params)) { // when GET, append parameters to URL
| if (params = Object.toQueryString(params)) { // when GET, append parameters to URL
|
Zeile 1221 | Zeile 1234 |
---|
this.body = this.method == 'post' ? (this.options.postBody || params) : null; this.transport.send(this.body);
|
this.body = this.method == 'post' ? (this.options.postBody || params) : null; this.transport.send(this.body);
|
|
|
/* Force Firefox to handle ready state 4 for synchronous requests */ if (!this.options.asynchronous && this.transport.overrideMimeType) this.onStateChange();
} catch (e) {
|
/* Force Firefox to handle ready state 4 for synchronous requests */ if (!this.options.asynchronous && this.transport.overrideMimeType) this.onStateChange();
} catch (e) {
|
this.dispatchException(e);
| this.dispatchException(e);
|
} },
| } },
|
Zeile 1256 | Zeile 1269 |
---|
if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) headers['Connection'] = 'close';
|
if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) headers['Connection'] = 'close';
|
}
| }
|
// user-defined headers if (typeof this.options.requestHeaders == 'object') {
| // user-defined headers if (typeof this.options.requestHeaders == 'object') {
|
Zeile 1271 | Zeile 1284 |
---|
for (var name in headers) this.transport.setRequestHeader(name, headers[name]);
|
for (var name in headers) this.transport.setRequestHeader(name, headers[name]);
|
},
| },
|
success: function() { var status = this.getStatus();
| success: function() { var status = this.getStatus();
|
Zeile 1286 | Zeile 1299 |
---|
respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
|
respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
|
|
|
if (state == 'Complete') { try { this._complete = true;
| if (state == 'Complete') { try { this._complete = true;
|
Zeile 1307 | Zeile 1320 |
---|
try { (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
|
try { (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
|
} catch (e) {
| } catch (e) {
|
this.dispatchException(e); }
if (state == 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction;
|
this.dispatchException(e); }
if (state == 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction;
|
}
| }
|
},
isSameOrigin: function() {
| },
isSameOrigin: function() {
|
Zeile 1343 | Zeile 1356 |
---|
dispatchException: function(exception) { (this.options.onException || Prototype.emptyFunction)(this, exception); Ajax.Responders.dispatch('onException', this, exception);
|
dispatchException: function(exception) { (this.options.onException || Prototype.emptyFunction)(this, exception); Ajax.Responders.dispatch('onException', this, exception);
|
} });
| } });
|
Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
| Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
Zeile 1517 | Zeile 1530 |
---|
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) results.push(Element.extend(query.snapshotItem(i)));
|
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) results.push(Element.extend(query.snapshotItem(i)));
|
return results; }; }
| return results; }; }
|
/*--------------------------------------------------------------------------*/
if (!window.Node) var Node = { };
| /*--------------------------------------------------------------------------*/
if (!window.Node) var Node = { };
|
Zeile 1542 | Zeile 1555 |
---|
NOTATION_NODE: 12 }); }
|
NOTATION_NODE: 12 }); }
|
|
|
(function() { var element = this.Element; this.Element = function(tagName, attributes) {
| (function() { var element = this.Element; this.Element = function(tagName, attributes) {
|
Zeile 1558 | Zeile 1571 |
---|
return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); }; Object.extend(this.Element, element || { });
|
return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); }; Object.extend(this.Element, element || { });
|
| if (element) this.Element.prototype = element.prototype;
|
}).call(window);
Element.cache = { };
| }).call(window);
Element.cache = { };
|
Zeile 1570 | Zeile 1584 |
---|
toggle: function(element) { element = $(element); Element[Element.visible(element) ? 'hide' : 'show'](element);
|
toggle: function(element) { element = $(element); Element[Element.visible(element) ? 'hide' : 'show'](element);
|
return element; },
| return element; },
|
hide: function(element) {
|
hide: function(element) {
|
$(element).style.display = 'none';
| element = $(element); element.style.display = 'none';
|
return element; },
show: function(element) {
|
return element; },
show: function(element) {
|
$(element).style.display = ''; return element;
| element = $(element); element.style.display = ''; return element;
|
},
remove: function(element) {
| },
remove: function(element) {
|
Zeile 1733 | Zeile 1749 |
---|
element = $(element); if (arguments.length == 1) return element.firstDescendant(); return Object.isNumber(expression) ? element.descendants()[expression] :
|
element = $(element); if (arguments.length == 1) return element.firstDescendant(); return Object.isNumber(expression) ? element.descendants()[expression] :
|
element.select(expression)[index || 0];
| Element.select(element, expression)[index || 0];
|
},
previous: function(element, expression, index) {
| },
previous: function(element, expression, index) {
|
Zeile 1755 | Zeile 1771 |
---|
select: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element, args);
|
select: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element, args);
|
},
| },
|
adjacent: function() { var args = $A(arguments), element = $(args.shift());
| adjacent: function() { var args = $A(arguments), element = $(args.shift());
|
Zeile 1863 | Zeile 1879 |
---|
descendantOf: function(element, ancestor) { element = $(element), ancestor = $(ancestor);
|
descendantOf: function(element, ancestor) { element = $(element), ancestor = $(ancestor);
|
var originalAncestor = ancestor;
| |
if (element.compareDocumentPosition) return (element.compareDocumentPosition(ancestor) & 8) === 8;
|
if (element.compareDocumentPosition) return (element.compareDocumentPosition(ancestor) & 8) === 8;
|
if (element.sourceIndex && !Prototype.Browser.Opera) { var e = element.sourceIndex, a = ancestor.sourceIndex, nextAncestor = ancestor.nextSibling; if (!nextAncestor) { do { ancestor = ancestor.parentNode; } while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); } if (nextAncestor && nextAncestor.sourceIndex) return (e > a && e < nextAncestor.sourceIndex); }
| if (ancestor.contains) return ancestor.contains(element) && ancestor !== element;
|
while (element = element.parentNode)
|
while (element = element.parentNode)
|
if (element == originalAncestor) return true;
| if (element == ancestor) return true;
|
return false; },
| return false; },
|
Zeile 1895 | Zeile 1903 |
---|
element = $(element); style = style == 'float' ? 'cssFloat' : style.camelize(); var value = element.style[style];
|
element = $(element); style = style == 'float' ? 'cssFloat' : style.camelize(); var value = element.style[style];
|
if (!value) {
| if (!value || value == 'auto') {
|
var css = document.defaultView.getComputedStyle(element, null); value = css ? css[style] : null; }
| var css = document.defaultView.getComputedStyle(element, null); value = css ? css[style] : null; }
|
Zeile 1934 | Zeile 1942 |
---|
getDimensions: function(element) { element = $(element);
|
getDimensions: function(element) { element = $(element);
|
var display = $(element).getStyle('display');
| var display = element.getStyle('display');
|
if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight};
| if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight};
|
Zeile 1963 | Zeile 1971 |
---|
element.style.position = 'relative'; // Opera returns the offset relative to the positioning context, when an // element is position relative but top and left have not been defined
|
element.style.position = 'relative'; // Opera returns the offset relative to the positioning context, when an // element is position relative but top and left have not been defined
|
if (window.opera) {
| if (Prototype.Browser.Opera) {
|
element.style.top = 0; element.style.left = 0; }
| element.style.top = 0; element.style.left = 0; }
|
Zeile 1998 | Zeile 2006 |
---|
if (!element._overflow) return element; element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; element._overflow = null;
|
if (!element._overflow) return element; element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; element._overflow = null;
|
return element; },
| return element; },
|
cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do {
| cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do {
|
Zeile 2018 | Zeile 2026 |
---|
valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) {
|
valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) {
|
if (element.tagName == 'BODY') break;
| if (element.tagName.toUpperCase() == 'BODY') break;
|
var p = Element.getStyle(element, 'position'); if (p !== 'static') break; }
| var p = Element.getStyle(element, 'position'); if (p !== 'static') break; }
|
Zeile 2028 | Zeile 2036 |
---|
absolutize: function(element) { element = $(element);
|
absolutize: function(element) { element = $(element);
|
if (element.getStyle('position') == 'absolute') return;
| if (element.getStyle('position') == 'absolute') return element;
|
// Position.prepare(); // To be done manually by Scripty when it needs it.
var offsets = element.positionedOffset();
| // Position.prepare(); // To be done manually by Scripty when it needs it.
var offsets = element.positionedOffset();
|
Zeile 2052 | Zeile 2060 |
---|
relativize: function(element) { element = $(element);
|
relativize: function(element) { element = $(element);
|
if (element.getStyle('position') == 'relative') return;
| if (element.getStyle('position') == 'relative') return element;
|
// Position.prepare(); // To be done manually by Scripty when it needs it.
element.style.position = 'relative';
| // Position.prepare(); // To be done manually by Scripty when it needs it.
element.style.position = 'relative';
|
Zeile 2103 | Zeile 2111 |
---|
element = forElement; do {
|
element = forElement; do {
|
if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
| if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
|
valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0; }
| valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0; }
|
Zeile 2178 | Zeile 2186 |
---|
case 'height': case 'width': // returns '0px' for hidden elements; we want it to return null if (!Element.visible(element)) return null;
|
case 'height': case 'width': // returns '0px' for hidden elements; we want it to return null if (!Element.visible(element)) return null;
|
|
|
// 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);
| // 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);
|
Zeile 2218 | Zeile 2226 |
---|
Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( function(proceed, element) { element = $(element);
|
Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( function(proceed, element) { element = $(element);
|
| // IE throws an error if element is not in document try { element.offsetParent } catch(e) { return $(document.body) }
|
var position = element.getStyle('position'); if (position !== 'static') return proceed(element); element.setStyle({ position: 'relative' });
| var position = element.getStyle('position'); if (position !== 'static') return proceed(element); element.setStyle({ position: 'relative' });
|
Zeile 2231 | Zeile 2242 |
---|
Element.Methods[method] = Element.Methods[method].wrap( function(proceed, element) { element = $(element);
|
Element.Methods[method] = Element.Methods[method].wrap( function(proceed, element) { element = $(element);
|
| try { element.offsetParent } catch(e) { return Element._returnOffset(0,0) }
|
var position = element.getStyle('position'); if (position !== 'static') return proceed(element); // Trigger hasLayout on the offset parent so that IE6 reports
| var position = element.getStyle('position'); if (position !== 'static') return proceed(element); // Trigger hasLayout on the offset parent so that IE6 reports
|
Zeile 2245 | Zeile 2258 |
---|
} ); });
|
} ); });
|
| Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap( function(proceed, element) { try { element.offsetParent } catch(e) { return Element._returnOffset(0,0) } return proceed(element); } );
|
Element.Methods.getStyle = function(element, style) { element = $(element);
| Element.Methods.getStyle = function(element, style) { element = $(element);
|
Zeile 2337 | Zeile 2358 |
---|
Element._attributeTranslations.has = {};
$w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
|
Element._attributeTranslations.has = {};
$w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
|
'encType maxLength readOnly longDesc').each(function(attr) {
| 'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
|
Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; Element._attributeTranslations.has[attr.toLowerCase()] = attr; });
| Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; Element._attributeTranslations.has[attr.toLowerCase()] = attr; });
|
Zeile 2390 | Zeile 2411 |
---|
(value < 0.00001) ? 0 : value;
if (value == 1)
|
(value < 0.00001) ? 0 : value;
if (value == 1)
|
if(element.tagName == 'IMG' && element.width) {
| if(element.tagName.toUpperCase() == 'IMG' && element.width) {
|
element.width++; element.width--; } else try { var n = document.createTextNode(' ');
| element.width++; element.width--; } else try { var n = document.createTextNode(' ');
|
Zeile 2467 | Zeile 2488 |
---|
else element.outerHTML = content.stripScripts();
content.evalScripts.bind(content).defer();
|
else element.outerHTML = content.stripScripts();
content.evalScripts.bind(content).defer();
|
return element; }; }
| return element; }; }
|
Element._returnOffset = function(l, t) { var result = [l, t]; result.left = l;
| Element._returnOffset = function(l, t) { var result = [l, t]; result.left = l;
|
Zeile 2506 | Zeile 2527 |
---|
TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3], TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4], SELECT: ['<select>', '</select>', 1]
|
TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3], TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4], SELECT: ['<select>', '</select>', 1]
|
} };
| } };
|
(function() { Object.extend(this.tags, {
| (function() { Object.extend(this.tags, {
|
Zeile 2521 | Zeile 2542 |
---|
hasAttribute: function(element, attribute) { attribute = Element._attributeTranslations.has[attribute] || attribute; var node = $(element).getAttributeNode(attribute);
|
hasAttribute: function(element, attribute) { attribute = Element._attributeTranslations.has[attribute] || attribute; var node = $(element).getAttributeNode(attribute);
|
return node && node.specified;
| return !!(node && node.specified);
|
} };
| } };
|
Zeile 2530 | Zeile 2551 |
---|
Object.extend(Element, Element.Methods);
if (!Prototype.BrowserFeatures.ElementExtensions &&
|
Object.extend(Element, Element.Methods);
if (!Prototype.BrowserFeatures.ElementExtensions &&
|
document.createElement('div').__proto__) {
| document.createElement('div')['__proto__']) {
|
window.HTMLElement = { };
|
window.HTMLElement = { };
|
window.HTMLElement.prototype = document.createElement('div').__proto__;
| window.HTMLElement.prototype = document.createElement('div')['__proto__'];
|
Prototype.BrowserFeatures.ElementExtensions = true; }
| Prototype.BrowserFeatures.ElementExtensions = true; }
|
Zeile 2547 | Zeile 2568 |
---|
element.nodeType != 1 || element == window) return element;
var methods = Object.clone(Methods),
|
element.nodeType != 1 || element == window) return element;
var methods = Object.clone(Methods),
|
tagName = element.tagName, property, value;
| tagName = element.tagName.toUpperCase(), property, value;
|
// extend methods for specific tags if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
| // extend methods for specific tags if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
|
Zeile 2643 | Zeile 2664 |
---|
if (window[klass]) return window[klass];
window[klass] = { };
|
if (window[klass]) return window[klass];
window[klass] = { };
|
window[klass].prototype = document.createElement(tagName).__proto__;
| window[klass].prototype = document.createElement(tagName)['__proto__'];
|
return window[klass]; }
| return window[klass]; }
|
Zeile 2669 | Zeile 2690 |
---|
document.viewport = { getDimensions: function() {
|
document.viewport = { getDimensions: function() {
|
var dimensions = { }; var B = Prototype.Browser;
| var dimensions = { }, B = Prototype.Browser;
|
$w('width height').each(function(d) { var D = d.capitalize();
|
$w('width height').each(function(d) { var D = d.capitalize();
|
dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] : (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D];
| if (B.WebKit && !document.evaluate) { // Safari <3.0 needs self.innerWidth/Height dimensions[d] = self['inner' + D]; } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) { // Opera <9.5 needs document.body.clientWidth/Height dimensions[d] = document.body['client' + D] } else { dimensions[d] = document.documentElement['client' + D]; }
|
}); return dimensions;
|
}); return dimensions;
|
},
| },
|
getWidth: function() { return this.getDimensions().width;
| getWidth: function() { return this.getDimensions().width;
|
Zeile 2686 | Zeile 2713 |
---|
getHeight: function() { return this.getDimensions().height; },
|
getHeight: function() { return this.getDimensions().height; },
|
|
|
getScrollOffsets: function() { return Element._returnOffset( window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); } };
|
getScrollOffsets: function() { return Element._returnOffset( window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); } };
|
/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
| /* Portions of the Selector class are derived from Jack Slocum's DomQuery,
|
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style * license. Please see http://www.yui-ext.com/ for more information. */
|
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style * license. Please see http://www.yui-ext.com/ for more information. */
|
|
|
var Selector = Class.create({ initialize: function(expression) { this.expression = expression.strip();
|
var Selector = Class.create({ initialize: function(expression) { this.expression = expression.strip();
|
this.compileMatcher();
| if (this.shouldUseSelectorsAPI()) { this.mode = 'selectorsAPI'; } else if (this.shouldUseXPath()) { this.mode = 'xpath'; this.compileXPathMatcher(); } else { this.mode = "normal"; this.compileMatcher(); }
|
},
shouldUseXPath: function() {
| },
shouldUseXPath: function() {
|
Zeile 2715 | Zeile 2752 |
---|
// XPath can't do namespaced attributes, nor can it read // the "checked" property from DOM nodes
|
// XPath can't do namespaced attributes, nor can it read // the "checked" property from DOM nodes
|
if ((/(\[[\w-]*?:|:checked)/).test(this.expression))
| if ((/(\[[\w-]*?:|:checked)/).test(e))
|
return false;
return true; },
|
return false;
return true; },
|
compileMatcher: function() { if (this.shouldUseXPath()) return this.compileXPathMatcher();
| shouldUseSelectorsAPI: function() { if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
|
|
|
| if (!Selector._div) Selector._div = new Element('div');
// Make sure the browser treats the selector as valid. Test on an // isolated element to minimize cost of this check. try { Selector._div.querySelector(this.expression); } catch(e) { return false; }
return true; },
compileMatcher: function() {
|
var e = this.expression, ps = Selector.patterns, h = Selector.handlers, c = Selector.criteria, le, p, m;
| var e = this.expression, ps = Selector.patterns, h = Selector.handlers, c = Selector.criteria, le, p, m;
|
Zeile 2742 | Zeile 2792 |
---|
p = ps[i]; if (m = e.match(p)) { this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
|
p = ps[i]; if (m = e.match(p)) { this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
|
new Template(c[i]).evaluate(m)); e = e.replace(m[0], ''); break;
| new Template(c[i]).evaluate(m)); e = e.replace(m[0], ''); break;
|
} } }
| } } }
|
Zeile 2752 | Zeile 2802 |
---|
this.matcher.push("return h.unique(n);\n}"); eval(this.matcher.join('\n')); Selector._cache[this.expression] = this.matcher;
|
this.matcher.push("return h.unique(n);\n}"); eval(this.matcher.join('\n')); Selector._cache[this.expression] = this.matcher;
|
},
| },
|
compileXPathMatcher: function() { var e = this.expression, ps = Selector.patterns, x = Selector.xpath, le, m;
| compileXPathMatcher: function() { var e = this.expression, ps = Selector.patterns, x = Selector.xpath, le, m;
|
Zeile 2771 | Zeile 2821 |
---|
new Template(x[i]).evaluate(m)); e = e.replace(m[0], ''); break;
|
new Template(x[i]).evaluate(m)); e = e.replace(m[0], ''); break;
|
}
| }
|
} }
| } }
|
Zeile 2781 | Zeile 2831 |
---|
findElements: function(root) { root = root || document;
|
findElements: function(root) { root = root || document;
|
if (this.xpath) return document._getElementsByXPath(this.xpath, root); return this.matcher(root);
| var e = this.expression, results;
switch (this.mode) { case 'selectorsAPI': // querySelectorAll queries document-wide, then filters to descendants // of the context element. That's not what we want. // Add an explicit context to the selector if necessary. if (root !== document) { var oldId = root.id, id = $(root).identify(); e = "#" + id + " " + e; }
results = $A(root.querySelectorAll(e)).map(Element.extend); root.id = oldId;
return results; case 'xpath': return document._getElementsByXPath(this.xpath, root); default: return this.matcher(root); }
|
},
match: function(element) {
| },
match: function(element) {
|
Zeile 2873 | Zeile 2942 |
---|
'first-child': '[not(preceding-sibling::*)]', 'last-child': '[not(following-sibling::*)]', 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
|
'first-child': '[not(preceding-sibling::*)]', 'last-child': '[not(following-sibling::*)]', 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
|
'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
| 'empty': "[count(*) = 0 and (count(text()) = 0)]",
|
'checked': "[@checked]",
|
'checked': "[@checked]",
|
'disabled': "[@disabled]", 'enabled': "[not(@disabled)]",
| 'disabled': "[(@disabled) and (@type!='hidden')]", 'enabled': "[not(@disabled) and (@type!='hidden')]",
|
'not': function(m) { var e = m[6], p = Selector.patterns, x = Selector.xpath, le, v;
| 'not': function(m) { var e = m[6], p = Selector.patterns, x = Selector.xpath, le, v;
|
Zeile 2968 | Zeile 3037 |
---|
className: /^\.([\w\-\*]+)(\b|$)/, pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
|
className: /^\.([\w\-\*]+)(\b|$)/, pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
|
attrPresence: /^\[([\w]+)\]/,
| attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
|
attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ },
| attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ },
|
Zeile 3081 | Zeile 3150 |
---|
nextElementSibling: function(node) { while (node = node.nextSibling)
|
nextElementSibling: function(node) { while (node = node.nextSibling)
|
if (node.nodeType == 1) return node;
| if (node.nodeType == 1) return node;
|
return null; },
| return null; },
|
Zeile 3095 | Zeile 3164 |
---|
tagName: function(nodes, root, tagName, combinator) { var uTagName = tagName.toUpperCase(); var results = [], h = Selector.handlers;
|
tagName: function(nodes, root, tagName, combinator) { var uTagName = tagName.toUpperCase(); var results = [], h = Selector.handlers;
|
if (nodes) { if (combinator) {
| if (nodes) { if (combinator) {
|
// fastlane for ordinary descendant combinators if (combinator == "descendant") { for (var i = 0, node; node = nodes[i]; i++)
| // fastlane for ordinary descendant combinators if (combinator == "descendant") { for (var i = 0, node; node = nodes[i]; i++)
|
Zeile 3121 | Zeile 3190 |
---|
for (var i = 0, node; node = nodes[i]; i++) if (targetNode.parentNode == node) return [targetNode]; } else if (combinator == 'descendant') {
|
for (var i = 0, node; node = nodes[i]; i++) if (targetNode.parentNode == node) return [targetNode]; } else if (combinator == 'descendant') {
|
for (var i = 0, node; node = nodes[i]; i++)
| for (var i = 0, node; node = nodes[i]; i++)
|
if (Element.descendantOf(targetNode, node)) return [targetNode]; } else if (combinator == 'adjacent') { for (var i = 0, node; node = nodes[i]; i++)
| if (Element.descendantOf(targetNode, node)) return [targetNode]; } else if (combinator == 'adjacent') { for (var i = 0, node; node = nodes[i]; i++)
|
Zeile 3134 | Zeile 3203 |
---|
return []; } return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
|
return []; } return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
|
},
| },
|
className: function(nodes, root, className, combinator) { if (nodes && combinator) nodes = this[combinator](nodes); return Selector.handlers.byClassName(nodes, root, className);
|
className: function(nodes, root, className, combinator) { if (nodes && combinator) nodes = this[combinator](nodes); return Selector.handlers.byClassName(nodes, root, className);
|
},
| },
|
byClassName: function(nodes, root, className) { if (!nodes) nodes = Selector.handlers.descendant([root]);
| byClassName: function(nodes, root, className) { if (!nodes) nodes = Selector.handlers.descendant([root]);
|
Zeile 3159 | Zeile 3228 |
---|
var results = []; for (var i = 0, node; node = nodes[i]; i++) if (Element.hasAttribute(node, attr)) results.push(node);
|
var results = []; for (var i = 0, node; node = nodes[i]; i++) if (Element.hasAttribute(node, attr)) results.push(node);
|
return results; },
| return results; },
|
attr: function(nodes, root, attr, value, operator, combinator) { if (!nodes) nodes = root.getElementsByTagName("*");
| attr: function(nodes, root, attr, value, operator, combinator) { if (!nodes) nodes = root.getElementsByTagName("*");
|
Zeile 3170 | Zeile 3239 |
---|
var nodeValue = Element.readAttribute(node, attr); if (nodeValue === null) continue; if (handler(nodeValue, value)) results.push(node);
|
var nodeValue = Element.readAttribute(node, attr); if (nodeValue === null) continue; if (handler(nodeValue, value)) results.push(node);
|
}
| }
|
return results; },
| return results; },
|
Zeile 3185 | Zeile 3254 |
---|
'first-child': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) { if (Selector.handlers.previousElementSibling(node)) continue;
|
'first-child': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) { if (Selector.handlers.previousElementSibling(node)) continue;
|
results.push(node);
| results.push(node);
|
} return results; },
| } return results; },
|
Zeile 3200 | Zeile 3269 |
---|
var h = Selector.handlers; for (var i = 0, results = [], node; node = nodes[i]; i++) if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
|
var h = Selector.handlers; for (var i = 0, results = [], node; node = nodes[i]; i++) if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
|
results.push(node);
| results.push(node);
|
return results; }, 'nth-child': function(nodes, formula, root) {
| return results; }, 'nth-child': function(nodes, formula, root) {
|
Zeile 3270 | Zeile 3339 |
---|
'empty': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) { // IE treats comments as element nodes
|
'empty': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) { // IE treats comments as element nodes
|
if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
| if (node.tagName == '!' || node.firstChild) continue;
|
results.push(node); } return results;
| results.push(node); } return results;
|
Zeile 3280 | Zeile 3349 |
---|
var h = Selector.handlers, selectorType, m; var exclusions = new Selector(selector).findElements(root); h.mark(exclusions);
|
var h = Selector.handlers, selectorType, m; var exclusions = new Selector(selector).findElements(root); h.mark(exclusions);
|
for (var i = 0, results = [], node; node = nodes[i]; i++)
| for (var i = 0, results = [], node; node = nodes[i]; i++)
|
if (!node._countedByPrototype) results.push(node); h.unmark(exclusions); return results; },
|
if (!node._countedByPrototype) results.push(node); h.unmark(exclusions); return results; },
|
'enabled': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) if (!node.disabled) results.push(node); return results; },
| 'enabled': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) if (!node.disabled && (!node.type || node.type !== 'hidden')) results.push(node); return results; },
|
'disabled': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) if (node.disabled) results.push(node);
| 'disabled': function(nodes, value, root) { for (var i = 0, results = [], node; node = nodes[i]; i++) if (node.disabled) results.push(node);
|
Zeile 3308 | Zeile 3378 |
---|
operators: { '=': function(nv, v) { return nv == v; }, '!=': function(nv, v) { return nv != v; },
|
operators: { '=': function(nv, v) { return nv == v; }, '!=': function(nv, v) { return nv != v; },
|
'^=': function(nv, v) { return nv.startsWith(v); },
| '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); }, '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); }, '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
|
'$=': function(nv, v) { return nv.endsWith(v); }, '*=': function(nv, v) { return nv.include(v); }, '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
|
'$=': function(nv, v) { return nv.endsWith(v); }, '*=': function(nv, v) { return nv.include(v); }, '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
|
'|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
| '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() + '-').include('-' + (v || "").toUpperCase() + '-'); }
|
},
split: function(expression) {
| },
split: function(expression) {
|
Zeile 3321 | Zeile 3394 |
---|
expressions.push(m[1].strip()); }); return expressions;
|
expressions.push(m[1].strip()); }); return expressions;
|
},
| },
|
matchElements: function(elements, expression) { var matches = $$(expression), h = Selector.handlers; h.mark(matches);
| matchElements: function(elements, expression) { var matches = $$(expression), h = Selector.handlers; h.mark(matches);
|
Zeile 3386 | Zeile 3459 |
---|
var data = elements.inject({ }, function(result, element) { if (!element.disabled && element.name) { key = element.name; value = $(element).getValue();
|
var data = elements.inject({ }, function(result, element) { if (!element.disabled && element.name) { key = element.name; value = $(element).getValue();
|
if (value != null && (element.type != 'submit' || (!submitted &&
| if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
|
submit !== false && (!submit || key == submit) && (submitted = true)))) { if (key in result) { // a key is already present; construct an array of values
| submit !== false && (!submit || key == submit) && (submitted = true)))) { if (key in result) { // a key is already present; construct an array of values
|
Zeile 3402 | Zeile 3475 |
---|
return options.hash ? data : Object.toQueryString(data); } };
|
return options.hash ? data : Object.toQueryString(data); } };
|
| |
Form.Methods = { serialize: function(form, options) {
| Form.Methods = { serialize: function(form, options) {
|
Zeile 3548 | Zeile 3620 |
---|
disable: function(element) { element = $(element);
|
disable: function(element) { element = $(element);
|
element.blur();
| |
element.disabled = true; return element; },
| element.disabled = true; return element; },
|
Zeile 3588 | Zeile 3659 |
---|
else element.value = value; },
|
else element.value = value; },
|
select: function(element, index) { if (Object.isUndefined(index))
| select: function(element, value) { if (Object.isUndefined(value))
|
return this[element.type == 'select-one' ? 'selectOne' : 'selectMany'](element); else {
|
return this[element.type == 'select-one' ? 'selectOne' : 'selectMany'](element); else {
|
var opt, value, single = !Object.isArray(index);
| var opt, currentValue, single = !Object.isArray(value);
|
for (var i = 0, length = element.length; i < length; i++) { opt = element.options[i];
|
for (var i = 0, length = element.length; i < length; i++) { opt = element.options[i];
|
value = this.optionValue(opt);
| currentValue = this.optionValue(opt);
|
if (single) {
|
if (single) {
|
if (value == index) {
| if (currentValue == value) {
|
opt.selected = true; return; } }
|
opt.selected = true; return; } }
|
else opt.selected = index.include(value);
| else opt.selected = value.include(currentValue);
|
} } },
| } } },
|
Zeile 3774 | Zeile 3845 |
---|
isRightClick: function(event) { return isButton(event, 2) },
element: function(event) {
|
isRightClick: function(event) { return isButton(event, 2) },
element: function(event) {
|
var node = Event.extend(event).target; return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); },
| event = Event.extend(event);
var node = event.target, type = event.type, currentTarget = event.currentTarget;
if (currentTarget && currentTarget.tagName) { // Firefox screws up the "click" event when moving between radio buttons // via arrow keys. It also screws up the "load" and "error" events on images, // reporting the document as the target instead of the original image. if (type === 'load' || type === 'error' || (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' && currentTarget.type === 'radio')) node = currentTarget; } if (node.nodeType == Node.TEXT_NODE) node = node.parentNode; return Element.extend(node); },
|
findElement: function(event, expression) { var element = Event.element(event); if (!expression) return element; var elements = [element].concat(element.ancestors()); return Selector.findElement(elements, expression, 0);
|
findElement: function(event, expression) { var element = Event.element(event); if (!expression) return element; var elements = [element].concat(element.ancestors()); return Selector.findElement(elements, expression, 0);
|
},
| },
|
pointer: function(event) {
|
pointer: function(event) {
|
| var docElement = document.documentElement, body = document.body || { scrollLeft: 0, scrollTop: 0 };
|
return { x: event.pageX || (event.clientX +
|
return { x: event.pageX || (event.clientX +
|
(document.documentElement.scrollLeft || document.body.scrollLeft)),
| (docElement.scrollLeft || body.scrollLeft) - (docElement.clientLeft || 0)),
|
y: event.pageY || (event.clientY +
|
y: event.pageY || (event.clientY +
|
(document.documentElement.scrollTop || document.body.scrollTop))
| (docElement.scrollTop || body.scrollTop) - (docElement.clientTop || 0))
|
}; },
|
}; },
|
|
|
pointerX: function(event) { return Event.pointer(event).x }, pointerY: function(event) { return Event.pointer(event).y },
| pointerX: function(event) { return Event.pointer(event).x }, pointerY: function(event) { return Event.pointer(event).y },
|
Zeile 3835 | Zeile 3925 |
---|
};
} else {
|
};
} else {
|
Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
| Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
|
Object.extend(Event.prototype, methods); return Prototype.K; } })();
|
Object.extend(Event.prototype, methods); return Prototype.K; } })();
|
|
|
Object.extend(Event, (function() { var cache = Event.cache;
| Object.extend(Event, (function() { var cache = Event.cache;
|
Zeile 3886 | Zeile 3976 |
---|
function findWrapper(id, eventName, handler) { var c = getWrappersForEventName(id, eventName); return c.find(function(wrapper) { return wrapper.handler == handler });
|
function findWrapper(id, eventName, handler) { var c = getWrappersForEventName(id, eventName); return c.find(function(wrapper) { return wrapper.handler == handler });
|
}
| }
|
function destroyWrapper(id, eventName, handler) { var c = getCacheForID(id); if (!c[eventName]) return false; c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
|
function destroyWrapper(id, eventName, handler) { var c = getCacheForID(id); if (!c[eventName]) return false; c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
|
}
| }
|
function destroyCache() { for (var id in cache) for (var eventName in cache[id]) cache[id][eventName] = null;
|
function destroyCache() { for (var id in cache) for (var eventName in cache[id]) cache[id][eventName] = null;
|
}
| }
|
|
|
| // Internet Explorer needs to remove event handlers on page unload // in order to avoid memory leaks.
|
if (window.attachEvent) { window.attachEvent("onunload", destroyCache);
|
if (window.attachEvent) { window.attachEvent("onunload", destroyCache);
|
| }
// Safari has a dummy event handler on page unload so that it won't // use its bfcache. Safari <= 3.1 has an issue with restoring the "document" // object when page is returned to via the back button using its bfcache. if (Prototype.Browser.WebKit) { window.addEventListener('unload', Prototype.emptyFunction, false);
|
}
return {
| }
return {
|