Fix: optimize speed

Qual: update scriptaculous en protoype
This commit is contained in:
Regis Houssin 2010-05-10 20:59:18 +00:00
parent 23549635ae
commit 5fef42452e
14 changed files with 1847 additions and 1270 deletions

Binary file not shown.

View File

@ -1,3 +1,19 @@
*V1.8.3* (October 8, 2009)
* Update to Prototype 1.6.1
* Effect.toggle to return effect (to be able to do Effect.toggle(element, 'appear', {sync: true});) [RStankov]
* Use element.identify() for fetching element.id in Sortable.create [RStankov]
* Fix deprecated usage of Position.cumulativeOffset. [#182 state:resolved] [James Wheare]
* Make loader work for application/xhtml+xml served documents. Closes #95. [Pavel Sedek]
* Check for Windows Media plugin and RealPlayer plugin in Firefox on Windows to allow sound playback. Closes #36, #86. [Alexander Gavazov et al.]
* Remove dead code in effects.js. Closes #125. [Confusioner]
*V1.8.2* (November 18, 2008) *V1.8.2* (November 18, 2008)
* Update to Prototype 1.6.0.3 * Update to Prototype 1.6.0.3

View File

@ -1,4 +1,4 @@
Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
// script.aculo.us builder.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us builder.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/

View File

@ -1,8 +1,8 @@
// script.aculo.us controls.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan) // (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) // (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
// Contributors: // Contributors:
// Richard Livsey // Richard Livsey
// Rahul Bhargava // Rahul Bhargava

View File

@ -1,7 +1,6 @@
// script.aculo.us dragdrop.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/
@ -313,7 +312,7 @@ var Draggable = Class.create({
tag_name=='TEXTAREA')) return; tag_name=='TEXTAREA')) return;
var pointer = [Event.pointerX(event), Event.pointerY(event)]; var pointer = [Event.pointerX(event), Event.pointerY(event)];
var pos = Position.cumulativeOffset(this.element); var pos = this.element.cumulativeOffset();
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
Draggables.activate(this); Draggables.activate(this);
@ -456,7 +455,7 @@ var Draggable = Class.create({
}, },
draw: function(point) { draw: function(point) {
var pos = Position.cumulativeOffset(this.element); var pos = this.element.cumulativeOffset();
if(this.options.ghosting) { if(this.options.ghosting) {
var r = Position.realOffset(this.element); var r = Position.realOffset(this.element);
pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
@ -732,7 +731,7 @@ var Sortable = {
} }
// keep reference // keep reference
this.sortables[element.id] = options; this.sortables[element.identify()] = options;
// for onupdate // for onupdate
Draggables.addObserver(new SortableObserver(element, options.onUpdate)); Draggables.addObserver(new SortableObserver(element, options.onUpdate));
@ -827,7 +826,7 @@ var Sortable = {
hide().addClassName('dropmarker').setStyle({position:'absolute'}); hide().addClassName('dropmarker').setStyle({position:'absolute'});
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
} }
var offsets = Position.cumulativeOffset(dropon); var offsets = dropon.cumulativeOffset();
Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
if(position=='after') if(position=='after')

View File

@ -1,6 +1,6 @@
// script.aculo.us effects.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors: // Contributors:
// Justin Palmer (http://encytemedia.com/) // Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/) // Mark Pilgrim (http://diveintomark.org/)
@ -98,7 +98,7 @@ var Effect = {
} }
}, },
DefaultOptions: { DefaultOptions: {
duration: 0.3, // seconds (DOL CHANGE: Reduc time to show effect) duration: 1.0, // seconds
fps: 100, // 100= assume 66fps max. fps: 100, // 100= assume 66fps max.
sync: false, // true for combining sync: false, // true for combining
from: 0.0, from: 0.0,
@ -147,14 +147,13 @@ var Effect = {
'blind': ['BlindDown','BlindUp'], 'blind': ['BlindDown','BlindUp'],
'appear': ['Appear','Fade'] 'appear': ['Appear','Fade']
}, },
toggle: function(element, effect) { toggle: function(element, effect, options) {
element = $(element); element = $(element);
effect = (effect || 'appear').toLowerCase(); effect = (effect || 'appear').toLowerCase();
var options = Object.extend({
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 } queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
}, arguments[2] || { }); }, options || {}));
Effect[element.visible() ?
Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
} }
}; };
@ -230,12 +229,6 @@ Effect.Queue = Effect.Queues.get('global');
Effect.Base = Class.create({ Effect.Base = Class.create({
position: null, position: null,
start: function(options) { start: function(options) {
function codeForEvent(options,eventName){
return (
(options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
(options[eventName] ? 'this.options.'+eventName+'(this);' : '')
);
}
if (options && options.transition === false) options.transition = Effect.Transitions.linear; if (options && options.transition === false) options.transition = Effect.Transitions.linear;
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { }); this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
this.currentFrame = 0; this.currentFrame = 0;

View File

@ -1,6 +1,6 @@
// script.aculo.us scriptaculous.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
@ -24,10 +24,18 @@
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/
var Scriptaculous = { var Scriptaculous = {
Version: '1.8.2', Version: '1.8.3',
require: function(libraryName) { require: function(libraryName) {
// inserting via DOM fails in Safari 2.0, so brute force approach try{
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>'); // inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
} catch(e) {
// for xhtml+xml served content, fall back to DOM methods
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = libraryName;
document.getElementsByTagName('head')[0].appendChild(script);
}
}, },
REQUIRED_PROTOTYPE: '1.6.0.3', REQUIRED_PROTOTYPE: '1.6.0.3',
load: function() { load: function() {

View File

@ -1,6 +1,6 @@
// script.aculo.us slider.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us slider.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Marty Haught, Thomas Fuchs // Copyright (c) 2005-2009 Marty Haught, Thomas Fuchs
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/
@ -209,12 +209,12 @@ Control.Slider = Class.create({
var pointer = [Event.pointerX(event), Event.pointerY(event)]; var pointer = [Event.pointerX(event), Event.pointerY(event)];
var track = handle; var track = handle;
if (track==this.track) { if (track==this.track) {
var offsets = Position.cumulativeOffset(this.track); var offsets = this.track.cumulativeOffset();
this.event = event; this.event = event;
this.setValue(this.translateToValue( this.setValue(this.translateToValue(
(this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
)); ));
var offsets = Position.cumulativeOffset(this.activeHandle); var offsets = this.activeHandle.cumulativeOffset();
this.offsetX = (pointer[0] - offsets[0]); this.offsetX = (pointer[0] - offsets[0]);
this.offsetY = (pointer[1] - offsets[1]); this.offsetY = (pointer[1] - offsets[1]);
} else { } else {
@ -227,7 +227,7 @@ Control.Slider = Class.create({
this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
this.updateStyles(); this.updateStyles();
var offsets = Position.cumulativeOffset(this.activeHandle); var offsets = this.activeHandle.cumulativeOffset();
this.offsetX = (pointer[0] - offsets[0]); this.offsetX = (pointer[0] - offsets[0]);
this.offsetY = (pointer[1] - offsets[1]); this.offsetY = (pointer[1] - offsets[1]);
} }
@ -246,7 +246,7 @@ Control.Slider = Class.create({
}, },
draw: function(event) { draw: function(event) {
var pointer = [Event.pointerX(event), Event.pointerY(event)]; var pointer = [Event.pointerX(event), Event.pointerY(event)];
var offsets = Position.cumulativeOffset(this.track); var offsets = this.track.cumulativeOffset();
pointer[0] -= this.offsetX + offsets[0]; pointer[0] -= this.offsetX + offsets[0];
pointer[1] -= this.offsetY + offsets[1]; pointer[1] -= this.offsetY + offsets[1];
this.event = event; this.event = event;

View File

@ -1,6 +1,6 @@
// script.aculo.us sound.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us sound.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// //
// Based on code created by Jules Gravinese (http://www.webveteran.com/) // Based on code created by Jules Gravinese (http://www.webveteran.com/)
// //
@ -50,6 +50,10 @@ Sound = {
if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){ if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 })) if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>'); Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>');
else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('Windows Media') != -1 }))
Sound.template = new Template('<object id="sound_#{track}_#{id}" type="application/x-mplayer2" data="#{url}"></object>');
else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('RealPlayer') != -1 }))
Sound.template = new Template('<embed type="audio/x-pn-realaudio-plugin" style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>');
else else
Sound.play = function(){}; Sound.play = function(){};
} }

View File

@ -1,8 +1,8 @@
// script.aculo.us unittest.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // script.aculo.us unittest.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) // (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
// (c) 2005-2008 Michael Schuerig (http://www.schuerig.de/michael/) // (c) 2005-2009 Michael Schuerig (http://www.schuerig.de/michael/)
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/

View File

@ -750,6 +750,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
//header("Content-type: text/html; charset=UTF-8"); //header("Content-type: text/html; charset=UTF-8");
header("Content-type: text/html; charset=".$conf->file->character_set_client); header("Content-type: text/html; charset=".$conf->file->character_set_client);
// PHP compression
if (isset($conf->global->MAIN_OPTIMIZE_SPEED)) ob_start("ob_gzhandler");
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd>'; //print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd>';
print "\n"; print "\n";