0
-/* Prototype JavaScript framework, version 1.5.0_
pre10
+/* Prototype JavaScript framework, version 1.5.0_
rc00
* (c) 2005 Sam Stephenson <sam@conio.net>
0
* Prototype is freely distributable under the terms of an MIT-style license.
0
/*--------------------------------------------------------------------------*/
0
- Version: '1.5.0_
pre1',
0
ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
0
emptyFunction: function() {},
0
var Abstract = new Object();
0
Object.extend = function(destination, source) {
0
- for (
property in source) {
0
+ for (
var property in source) {
0
destination[property] = source[property];
0
evalScripts: function() {
0
- return this.extractScripts().map(
eval);
0
+ return this.extractScripts().map(
function(script) { return eval(script) });
0
escapeHTML: function() {
0
this.each(function(value, index) {
0
value = (iterator || Prototype.K)(value, index);
0
- if (
value >= (result || value))
0
+ if (
result == undefined || value >= result)
0
this.each(function(value, index) {
0
value = (iterator || Prototype.K)(value, index);
0
- if (
value <= (result || value))
0
+ if (
result == undefined || value < result)
0
Object.extend(Array.prototype, Enumerable);
0
-Array.prototype._reverse = Array.prototype.reverse;
0
+if (!Array.prototype._reverse)
0
+ Array.prototype._reverse = Array.prototype.reverse;
0
Object.extend(Array.prototype, {
0
_each: function(iterator) {
0
return this.inject([], function(array, value) {
0
- return array.concat(value
value.constructor == Array ?
0
+ return array.concat(value
&& value.constructor == Array ?
0
value.flatten() : [value]);
0
return (inline !== false ? this : this.toArray())._reverse();
0
- for (var i = 0; i < this.length - 1; i++)
0
- this[i] = this[i + 1];
0
return '[' + this.map(Object.inspect).join(', ') + ']';
0
_each: function(iterator) {
0
+ for (
var key in this) {
0
if (typeof value == 'function') continue;
0
getTransport: function() {
0
+ function() {return new XMLHttpRequest()},
0
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
0
- function() {return new ActiveXObject('Microsoft.XMLHTTP')},
0
- function() {return new XMLHttpRequest()}
0
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')}
0
+ contentType: 'application/x-www-form-urlencoded',
0
Object.extend(this.options, options || {});
0
'Accept', 'text/javascript, text/html, application/xml, text/xml, */*'];
0
if (this.options.method == 'post') {
0
- requestHeaders.push('Content-type',
0
- 'application/x-www-form-urlencoded');
0
+ requestHeaders.push('Content-type', this.options.contentType);
0
/* Force "Connection: close" for Mozilla browsers to work around
0
* a bug where XMLHttpReqeuest sends an incorrect Content-length
0
- return eval(
this.header('X-JSON'));
0
+ return eval(
'(' + this.header('X-JSON') + ')');
0
-Element.extend.cache = {
0
- findOrStore: function(value) {
0
- return this[value] = this[value] || function() {
0
- return value.apply(null, [this].concat($A(arguments)));
0
+Element.extend.cache = {
0
+ findOrStore: function(value) {
0
+ return this[value] = this[value] || function() {
0
+ return value.apply(null, [this].concat($A(arguments)));
0
setStyle: function(element, style) {
0
+ for (
var name in style)
0
element.style[name.camelize()] = style[name];
0
Element.addMethods = function(methods) {
0
Object.extend(Element.Methods, methods || {});
0
if(typeof HTMLElement != 'undefined') {
0
var methods = Element.Methods, cache = Element.extend.cache;
0
for (property in methods) {
0
var value = methods[property];
0
- if (typeof value == 'function')
{0
+ if (typeof value == 'function')
0
HTMLElement.prototype[property] = cache.findOrStore(value);
0
_nativeExtensions = true;
0
this.element.insertAdjacentHTML(this.adjacency, this.content);
0
- if (this.element.tagName.toLowerCase() == 'tbody') {
0
+ var tagName = this.element.tagName.toLowerCase();
0
+ if (tagName == 'tbody' || tagName == 'tr') {
0
this.insertContent(this.contentFromAnonymousTable());
0
var elements = new Array();
0
- for (
tagName in Form.Element.Serializers) {
0
+ for (
var tagName in Form.Element.Serializers) {
0
var tagElements = form.getElementsByTagName(tagName);
0
for (var j = 0; j < tagElements.length; j++)
0
elements.push(tagElements[j]);
0
var value = '', opt, index = element.selectedIndex;
0
opt = element.options[index];
0
- if (!value && !('value' in opt))
0
+ value = opt.value || opt.text;
0
return [element.name, value];
0
selectMany: function(element) {
0
- var value =
new Array();
0
for (var i = 0; i < element.length; i++) {
0
var opt = element.options[i];
0
- var optValue = opt.value;
0
- if (!optValue && !('value' in opt))
0
+ value.push(opt.value || opt.text);
0
return [element.name, value];
0
/* prevent memory leaks in IE */
0
-Event.observe(window, 'unload', Event.unloadCache, false);
0
+if (navigator.appVersion.match(/\bMSIE\b/))
0
+ Event.observe(window, 'unload', Event.unloadCache, false);
0
// set to true if needed, warning: firefox performance problems
0
// NOT neeeded for page scrolling, only if draggable contained in
Comments
No one has commented yet.