From c67d7b832ee19a3cf1961129e1742cf80ea8beb9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 30 Nov 2007 22:42:37 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20=E0=20jour=20de=20script.aculo.us=20en?= =?UTF-8?q?=20version=201.8=20finale=20et=20prototype=201.6=20finale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/includes/scriptaculous/CHANGELOG | 14 +- .../includes/scriptaculous/lib/prototype.js | 82 +++++--- htdocs/includes/scriptaculous/src/builder.js | 2 +- htdocs/includes/scriptaculous/src/controls.js | 183 +++++++++--------- htdocs/includes/scriptaculous/src/dragdrop.js | 18 +- htdocs/includes/scriptaculous/src/effects.js | 55 +++--- .../scriptaculous/src/scriptaculous.js | 6 +- htdocs/includes/scriptaculous/src/slider.js | 9 +- htdocs/includes/scriptaculous/src/sound.js | 2 +- htdocs/includes/scriptaculous/src/unittest.js | 2 +- 10 files changed, 206 insertions(+), 167 deletions(-) diff --git a/htdocs/includes/scriptaculous/CHANGELOG b/htdocs/includes/scriptaculous/CHANGELOG index 84a8a6a9355..b6d7b2f79d1 100644 --- a/htdocs/includes/scriptaculous/CHANGELOG +++ b/htdocs/includes/scriptaculous/CHANGELOG @@ -1,4 +1,16 @@ -*SVN* +*V1.8.0* (November 6, 2007) + +* Update to Prototype 1.6.0 final + +* Ajax.InPlaceEditor now can deal with callbacks that return an object. Closes #10064. [tdd] + +* Fix a potential problem with the loader and Firefox 2.0 on the Mac. Closes #9951. [awaters] + +* Add duration and distance options to Effect.Shake. Closes #8637. [amiel, rmm5t] + +* Update code to use new Hash implemention in Prototype 1.6. Update InPlaceEditor to use new Class.create syntax. [tdd] + +*V1.8.0 preview 0* (October 12, 2007) * Update to new Class.create syntax in Prototype 1.6; update to latest Prototype 1.6 trunk. diff --git a/htdocs/includes/scriptaculous/lib/prototype.js b/htdocs/includes/scriptaculous/lib/prototype.js index f193e81fb04..5c73462946b 100644 --- a/htdocs/includes/scriptaculous/lib/prototype.js +++ b/htdocs/includes/scriptaculous/lib/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.6.0_rc1 +/* Prototype JavaScript framework, version 1.6.0 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. @@ -7,7 +7,7 @@ *--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.6.0_rc1', + Version: '1.6.0', Browser: { IE: !!(window.attachEvent && !window.opera), @@ -21,8 +21,9 @@ var Prototype = { XPath: !!document.evaluate, ElementExtensions: !!window.HTMLElement, SpecificElementExtensions: + document.createElement('div').__proto__ && document.createElement('div').__proto__ !== - document.createElement('form').__proto__ + document.createElement('form').__proto__ }, ScriptFragment: ']*>([\\S\\s]*?)<\/script>', @@ -74,10 +75,14 @@ var Class = { Class.Methods = { addMethods: function(source) { - var ancestor = this.superclass && this.superclass.prototype; + var ancestor = this.superclass && this.superclass.prototype; + var properties = Object.keys(source); - for (var property in source) { - var value = source[property]; + if (!Object.keys({ toString: true }).length) + properties.push("toString", "valueOf"); + + for (var i = 0, length = properties.length; i < length; i++) { + var property = properties[i], value = source[property]; if (ancestor && Object.isFunction(value) && value.argumentNames().first() == "$super") { var method = value, value = Object.extend((function(m) { @@ -561,7 +566,7 @@ var Template = Class.create({ var ctx = object, expr = match[3]; var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); - if (match == null) return ''; + if (match == null) return before; while (match != null) { var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; @@ -1092,6 +1097,7 @@ var Hash = Class.create(Enumerable, (function() { } })()); +Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; Hash.from = $H; var ObjectRange = Class.create(Enumerable, { initialize: function(start, end, exclusive) { @@ -1399,8 +1405,10 @@ Ajax.Response = Class.create({ _getHeaderJSON: function() { var json = this.getHeader('X-JSON'); + if (!json) return null; + json = decodeURIComponent(escape(json)); try { - return json ? json.evalJSON(this.request.options.sanitizeJSON) : null; + return json.evalJSON(this.request.options.sanitizeJSON); } catch (e) { this.request.dispatchException(e); } @@ -1408,11 +1416,11 @@ Ajax.Response = Class.create({ _getResponseJSON: function() { var options = this.request.options; + if (!options.evalJSON || (options.evalJSON != 'force' && + !(this.getHeader('Content-type') || '').include('application/json'))) + return null; try { - if (options.evalJSON == 'force' || (options.evalJSON && - (this.getHeader('Content-type') || '').include('application/json'))) - return this.transport.responseText.evalJSON(options.sanitizeJSON); - return null; + return this.transport.responseText.evalJSON(options.sanitizeJSON); } catch (e) { this.request.dispatchException(e); } @@ -1817,7 +1825,7 @@ Element.Methods = { if (!(element = $(element))) return; var elementClassName = element.className; return (elementClassName.length > 0 && (elementClassName == className || - elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))); + new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); }, addClassName: function(element, className) { @@ -1859,6 +1867,20 @@ Element.Methods = { descendantOf: function(element, ancestor) { element = $(element), ancestor = $(ancestor); + + 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) return (e > a && e < nextAncestor.sourceIndex); + } + while (element = element.parentNode) if (element == ancestor) return true; return false; @@ -2248,7 +2270,11 @@ else if (Prototype.Browser.IE) { return filter.replace(/alpha\([^\)]*\)/gi,''); } element = $(element); - if (!element.currentStyle.hasLayout) element.style.zoom = 1; + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + var filter = element.getStyle('filter'), style = element.style; if (value == 1 || value === '') { (filter = stripAlpha(filter)) ? @@ -2344,7 +2370,7 @@ else if (Prototype.Browser.IE) { })(Element._attributeTranslations.read.values); } -else if (Prototype.Browser.Gecko) { +else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { Element.Methods.setOpacity = function(element, value) { element = $(element); element.style.opacity = (value == 1) ? 0.999999 : @@ -3121,6 +3147,7 @@ Object.extend(Selector, { }, attrPresence: function(nodes, root, attr) { + if (!nodes) nodes = root.getElementsByTagName("*"); var results = []; for (var i = 0, node; node = nodes[i]; i++) if (Element.hasAttribute(node, attr)) results.push(node); @@ -3684,24 +3711,27 @@ Object.extend(Event, { }); Event.Methods = (function() { + var isButton; + if (Prototype.Browser.IE) { - function isButton(event, code) { - return event.button == ({ 0: 1, 1: 4, 2: 2 })[code]; - } + var buttonMap = { 0: 1, 1: 4, 2: 2 }; + isButton = function(event, code) { + return event.button == buttonMap[code]; + }; } else if (Prototype.Browser.WebKit) { - function isButton(event, code) { + isButton = function(event, code) { switch (code) { case 0: return event.which == 1 && !event.metaKey; case 1: return event.which == 1 && event.metaKey; default: return false; } - } + }; } else { - function isButton(event, code) { + isButton = function(event, code) { return event.which ? (event.which === code + 1) : (event.button === code); - } + }; } return { @@ -3735,6 +3765,7 @@ Event.Methods = (function() { Event.extend(event); event.preventDefault(); event.stopPropagation(); + event.stopped = true; } }; })(); @@ -3784,7 +3815,7 @@ Object.extend(Event, (function() { } function getDOMEventName(eventName) { - if (eventName && eventName.match(/:/)) return "dataavailable"; + if (eventName && eventName.include(':')) return "dataavailable"; return eventName; } @@ -3803,8 +3834,9 @@ Object.extend(Event, (function() { if (c.pluck("handler").include(handler)) return false; var wrapper = function(event) { - if (event.eventName && event.eventName != eventName) - return false; + if (!Event || !Event.extend || + (event.eventName && event.eventName != eventName)) + return false; Event.extend(event); handler.call(element, event) diff --git a/htdocs/includes/scriptaculous/src/builder.js b/htdocs/includes/scriptaculous/src/builder.js index 301087d14ad..953b4a53221 100644 --- a/htdocs/includes/scriptaculous/src/builder.js +++ b/htdocs/includes/scriptaculous/src/builder.js @@ -1,4 +1,4 @@ -// script.aculo.us builder.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 +// script.aculo.us builder.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // diff --git a/htdocs/includes/scriptaculous/src/controls.js b/htdocs/includes/scriptaculous/src/controls.js index 9cbeae9c6f1..0088d18bb25 100644 --- a/htdocs/includes/scriptaculous/src/controls.js +++ b/htdocs/includes/scriptaculous/src/controls.js @@ -1,4 +1,4 @@ -// script.aculo.us controls.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 +// script.aculo.us controls.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // 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) @@ -35,15 +35,12 @@ // enables autocompletion on multiple tokens. This is most // useful when one of the tokens is \n (a newline), as it // allows smart autocompletion after linebreaks. -// -// vim:expandtab ts=8 sw=2 if(typeof Effect == 'undefined') throw("controls.js requires including script.aculo.us' effects.js library"); var Autocompleter = { } -Autocompleter.Base = function() { }; -Autocompleter.Base.prototype = { +Autocompleter.Base = Class.create({ baseInitialize: function(element, update, options) { element = $(element) this.element = element; @@ -245,7 +242,7 @@ Autocompleter.Base.prototype = { } var value = ''; if (this.options.select) { - var nodes = document.getElementsByClassName(this.options.select, selectedElement) || []; + var nodes = $(selectedElement).select('.' + this.options.select) || []; if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); } else value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); @@ -335,7 +332,7 @@ Autocompleter.Base.prototype = { } return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); } -} +}); Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { var boundary = Math.min(newS.length, oldS.length); @@ -345,8 +342,7 @@ Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(new return boundary; }; -Ajax.Autocompleter = Class.create(); -Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), { +Ajax.Autocompleter = Class.create(Autocompleter.Base, { initialize: function(element, update, url, options) { this.baseInitialize(element, update, options); this.options.asynchronous = true; @@ -373,7 +369,6 @@ Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.pro onComplete: function(request) { this.updateChoices(request.responseText); } - }); // The local array autocompleter. Used when you'd prefer to @@ -411,8 +406,7 @@ Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.pro // In that case, the other options above will not apply unless // you support them. -Autocompleter.Local = Class.create(); -Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), { +Autocompleter.Local = Class.create(Autocompleter.Base, { initialize: function(element, update, array, options) { this.baseInitialize(element, update, options); this.options.array = array; @@ -484,74 +478,7 @@ Field.scrollFreeActivate = function(field) { }, 1); } -Ajax.InPlaceEditor = Class.create(); -Object.extend(Ajax.InPlaceEditor, { - DefaultOptions: { - ajaxOptions: { }, - autoRows: 3, // Use when multi-line w/ rows == 1 - cancelControl: 'link', // 'link'|'button'|false - cancelText: 'cancel', - clickToEditText: 'Click to edit', - externalControl: null, // id|elt - externalControlOnly: false, - fieldPostCreation: 'activate', // 'activate'|'focus'|false - formClassName: 'inplaceeditor-form', - formId: null, // id|elt - highlightColor: '#ffff99', - highlightEndColor: '#ffffff', - hoverClassName: '', - htmlResponse: true, - loadingClassName: 'inplaceeditor-loading', - loadingText: 'Loading...', - okControl: 'button', // 'link'|'button'|false - okText: 'ok', - paramName: 'value', - rows: 1, // If 1 and multi-line, uses autoRows - savingClassName: 'inplaceeditor-saving', - savingText: 'Saving...', - size: 0, - stripLoadedTextTags: false, - submitOnBlur: false, - textAfterControls: '', - textBeforeControls: '', - textBetweenControls: '' - }, - DefaultCallbacks: { - callback: function(form) { - return Form.serialize(form); - }, - onComplete: function(transport, element) { - // For backward compatibility, this one is bound to the IPE, and passes - // the element directly. It was too often customized, so we don't break it. - new Effect.Highlight(element, { - startcolor: this.options.highlightColor, keepBackgroundImage: true }); - }, - onEnterEditMode: null, - onEnterHover: function(ipe) { - ipe.element.style.backgroundColor = ipe.options.highlightColor; - if (ipe._effect) - ipe._effect.cancel(); - }, - onFailure: function(transport, ipe) { - alert('Error communication with the server: ' + transport.responseText.stripTags()); - }, - onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. - onLeaveEditMode: null, - onLeaveHover: function(ipe) { - ipe._effect = new Effect.Highlight(ipe.element, { - startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, - restorecolor: ipe._originalBackground, keepBackgroundImage: true - }); - } - }, - Listeners: { - click: 'enterEditMode', - keydown: 'checkForEscapeOrReturn', - mouseover: 'enterHover', - mouseout: 'leaveHover' - } -}); -Ajax.InPlaceEditor.prototype = { +Ajax.InPlaceEditor = Class.create({ initialize: function(element, url, options) { this.url = url; this.element = element = $(element); @@ -696,8 +623,10 @@ Ajax.InPlaceEditor.prototype = { var form = this._form; var value = $F(this._controls.editor); this.prepareSubmission(); - var params = this.options.callback(form, value); - params = (params ? params + '&' : '?') + 'editorId=' + this.element.id; + var params = this.options.callback(form, value) || ''; + if (Object.isString(params)) + params = params.toQueryParams(); + params.editorId = this.element.id; if (this.options.htmlResponse) { var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); Object.extend(options, { @@ -818,21 +747,16 @@ Ajax.InPlaceEditor.prototype = { // binding + direct element this._boundComplete(transport, this.element); } -}; +}); + Object.extend(Ajax.InPlaceEditor.prototype, { dispose: Ajax.InPlaceEditor.prototype.destroy }); - -Ajax.InPlaceCollectionEditor = Class.create(); -Ajax.InPlaceCollectionEditor.DefaultOptions = { - loadingCollectionText: 'Loading options...' -}; -Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype); -Object.extend(Ajax.InPlaceCollectionEditor.prototype, { - initialize: function(element, url, options) { +Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { + initialize: function($super, element, url, options) { this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; - Ajax.InPlaceEditor.prototype.initialize.call(this, element, url, options); + $super(element, url, options); }, createEditField: function() { @@ -944,13 +868,82 @@ Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(opt fallback('highlightEndColor', options.highlightendcolor); }; +Object.extend(Ajax.InPlaceEditor, { + DefaultOptions: { + ajaxOptions: { }, + autoRows: 3, // Use when multi-line w/ rows == 1 + cancelControl: 'link', // 'link'|'button'|false + cancelText: 'cancel', + clickToEditText: 'Click to edit', + externalControl: null, // id|elt + externalControlOnly: false, + fieldPostCreation: 'activate', // 'activate'|'focus'|false + formClassName: 'inplaceeditor-form', + formId: null, // id|elt + highlightColor: '#ffff99', + highlightEndColor: '#ffffff', + hoverClassName: '', + htmlResponse: true, + loadingClassName: 'inplaceeditor-loading', + loadingText: 'Loading...', + okControl: 'button', // 'link'|'button'|false + okText: 'ok', + paramName: 'value', + rows: 1, // If 1 and multi-line, uses autoRows + savingClassName: 'inplaceeditor-saving', + savingText: 'Saving...', + size: 0, + stripLoadedTextTags: false, + submitOnBlur: false, + textAfterControls: '', + textBeforeControls: '', + textBetweenControls: '' + }, + DefaultCallbacks: { + callback: function(form) { + return Form.serialize(form); + }, + onComplete: function(transport, element) { + // For backward compatibility, this one is bound to the IPE, and passes + // the element directly. It was too often customized, so we don't break it. + new Effect.Highlight(element, { + startcolor: this.options.highlightColor, keepBackgroundImage: true }); + }, + onEnterEditMode: null, + onEnterHover: function(ipe) { + ipe.element.style.backgroundColor = ipe.options.highlightColor; + if (ipe._effect) + ipe._effect.cancel(); + }, + onFailure: function(transport, ipe) { + alert('Error communication with the server: ' + transport.responseText.stripTags()); + }, + onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. + onLeaveEditMode: null, + onLeaveHover: function(ipe) { + ipe._effect = new Effect.Highlight(ipe.element, { + startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, + restorecolor: ipe._originalBackground, keepBackgroundImage: true + }); + } + }, + Listeners: { + click: 'enterEditMode', + keydown: 'checkForEscapeOrReturn', + mouseover: 'enterHover', + mouseout: 'leaveHover' + } +}); + +Ajax.InPlaceCollectionEditor.DefaultOptions = { + loadingCollectionText: 'Loading options...' +}; // Delayed observer, like Form.Element.Observer, // but waits for delay after last key input // Ideal for live-search fields -Form.Element.DelayedObserver = Class.create(); -Form.Element.DelayedObserver.prototype = { +Form.Element.DelayedObserver = Class.create({ initialize: function(element, delay, callback) { this.delay = delay || 0.5; this.element = $(element); @@ -969,4 +962,4 @@ Form.Element.DelayedObserver.prototype = { this.timer = null; this.callback(this.element, $F(this.element)); } -}; +}); diff --git a/htdocs/includes/scriptaculous/src/dragdrop.js b/htdocs/includes/scriptaculous/src/dragdrop.js index 96eba902d91..14ebc6f5c30 100644 --- a/htdocs/includes/scriptaculous/src/dragdrop.js +++ b/htdocs/includes/scriptaculous/src/dragdrop.js @@ -1,4 +1,4 @@ -// script.aculo.us dragdrop.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 +// script.aculo.us dragdrop.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // 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) @@ -224,10 +224,7 @@ var Draggables = { /*--------------------------------------------------------------------------*/ -var Draggable = Class.create(); -Draggable._dragging = { }; - -Draggable.prototype = { +var Draggable = Class.create({ initialize: function(element) { var defaults = { handle: false, @@ -570,12 +567,13 @@ Draggable.prototype = { } return { top: T, left: L, width: W, height: H }; } -} +}); + +Draggable._dragging = { }; /*--------------------------------------------------------------------------*/ -var SortableObserver = Class.create(); -SortableObserver.prototype = { +var SortableObserver = Class.create({ initialize: function(element, observer) { this.element = $(element); this.observer = observer; @@ -591,7 +589,7 @@ SortableObserver.prototype = { if(this.lastValue != Sortable.serialize(this.element)) this.observer(this.element) } -} +}); var Sortable = { SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, @@ -716,7 +714,7 @@ var Sortable = { (options.elements || this.findElements(element, options) || []).each( function(e,i) { var handle = options.handles ? $(options.handles[i]) : - (options.handle ? $(e).getElementsByClassName(options.handle)[0] : e); + (options.handle ? $(e).select('.' + options.handle)[0] : e); options.draggables.push( new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); Droppables.add(e, options_for_droppable); diff --git a/htdocs/includes/scriptaculous/src/effects.js b/htdocs/includes/scriptaculous/src/effects.js index 2862f6f8332..27c29016aa7 100644 --- a/htdocs/includes/scriptaculous/src/effects.js +++ b/htdocs/includes/scriptaculous/src/effects.js @@ -1,4 +1,4 @@ -// script.aculo.us effects.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 +// script.aculo.us effects.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Contributors: @@ -226,16 +226,13 @@ Effect.Queues = { get: function(queueName) { if (!Object.isString(queueName)) return queueName; - if (!this.instances[queueName]) - this.instances[queueName] = new Effect.ScopedQueue(); - - return this.instances[queueName]; + return this.instances.get(queueName) || + this.instances.set(queueName, new Effect.ScopedQueue()); } }; Effect.Queue = Effect.Queues.get('global'); -Effect.Base = Class.create(); -Effect.Base.prototype = { +Effect.Base = Class.create({ position: null, start: function(options) { function codeForEvent(options,eventName){ @@ -303,10 +300,10 @@ Effect.Base.prototype = { inspect: function() { var data = $H(); for(property in this) - if (!Object.isFunction(this[property])) data[property] = this[property]; + if (!Object.isFunction(this[property])) data.set(property, this[property]); return '#'; } -}; +}); Effect.Parallel = Class.create(Effect.Base, { initialize: function(effects) { @@ -657,21 +654,27 @@ Effect.DropOut = function(element) { Effect.Shake = function(element) { element = $(element); + var options = Object.extend({ + distance: 20, + duration: 0.5 + }, arguments[1] || {}); + var distance = parseFloat(options.distance); + var split = parseFloat(options.duration) / 10.0; var oldStyle = { top: element.getStyle('top'), left: element.getStyle('left') }; - return new Effect.Move(element, - { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { + return new Effect.Move(element, + { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { new Effect.Move(effect.element, - { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, - { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, - { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, - { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, - { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { + { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { effect.element.undoPositioned().setStyle(oldStyle); }}) }}) }}) }}) }}) }}); }; @@ -1006,9 +1009,10 @@ Effect.Transform = Class.create({ }, addTracks: function(tracks){ tracks.each(function(track){ - var data = $H(track).values().first(); + track = $H(track); + var data = track.values().first(); this.tracks.push($H({ - ids: $H(track).keys().first(), + ids: track.keys().first(), effect: Effect.Morph, options: { style: data } })); @@ -1018,8 +1022,9 @@ Effect.Transform = Class.create({ play: function(){ return new Effect.Parallel( this.tracks.map(function(track){ - var elements = [$(track.ids) || $$(track.ids)].flatten(); - return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) }); + var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); + var elements = [$(ids) || $$(ids)].flatten(); + return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); }).flatten(), this.options ); @@ -1050,11 +1055,11 @@ String.prototype.parseStyle = function(){ } Element.CSS_PROPERTIES.each(function(property){ - if (style[property]) styleRules[property] = style[property]; + if (style[property]) styleRules.set(property, style[property]); }); if (Prototype.Browser.IE && this.include('opacity')) - styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]; + styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); return styleRules; }; @@ -1072,10 +1077,10 @@ if (document.defaultView && document.defaultView.getComputedStyle) { element = $(element); var css = element.currentStyle, styles; styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) { - hash[property] = css[property]; + hash.set(property, css[property]); return hash; }); - if (!styles.opacity) styles.opacity = element.getOpacity(); + if (!styles.opacity) styles.set('opacity', element.getOpacity()); return styles; }; }; @@ -1114,4 +1119,4 @@ $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTex function(f) { Effect.Methods[f] = Element[f]; } ); -Element.addMethods(Effect.Methods); \ No newline at end of file +Element.addMethods(Effect.Methods); diff --git a/htdocs/includes/scriptaculous/src/scriptaculous.js b/htdocs/includes/scriptaculous/src/scriptaculous.js index 4eb84b6b03a..c976e6bff73 100644 --- a/htdocs/includes/scriptaculous/src/scriptaculous.js +++ b/htdocs/includes/scriptaculous/src/scriptaculous.js @@ -1,4 +1,4 @@ -// script.aculo.us scriptaculous.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 +// script.aculo.us scriptaculous.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // @@ -24,10 +24,10 @@ // For details, see the script.aculo.us web site: http://script.aculo.us/ var Scriptaculous = { - Version: '1.8.0_pre1', + Version: '1.8.0', require: function(libraryName) { // inserting via DOM fails in Safari 2.0, so brute force approach - document.write(''); + document.write('