mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-18 04:11:33 +00:00
upgrade scriptaculous
This commit is contained in:
24
lib/scriptaculous/controls.js
vendored
24
lib/scriptaculous/controls.js
vendored
@@ -1,8 +1,8 @@
|
|||||||
// script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
||||||
|
|
||||||
// Copyright (c) 2005-2007 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-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
||||||
// (c) 2005-2007 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
|
||||||
@@ -39,10 +39,10 @@
|
|||||||
if(typeof Effect == 'undefined')
|
if(typeof Effect == 'undefined')
|
||||||
throw("controls.js requires including script.aculo.us' effects.js library");
|
throw("controls.js requires including script.aculo.us' effects.js library");
|
||||||
|
|
||||||
var Autocompleter = { }
|
var Autocompleter = { };
|
||||||
Autocompleter.Base = Class.create({
|
Autocompleter.Base = Class.create({
|
||||||
baseInitialize: function(element, update, options) {
|
baseInitialize: function(element, update, options) {
|
||||||
element = $(element)
|
element = $(element);
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.update = $(update);
|
this.update = $(update);
|
||||||
this.hasFocus = false;
|
this.hasFocus = false;
|
||||||
@@ -211,13 +211,13 @@ Autocompleter.Base = Class.create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
markPrevious: function() {
|
markPrevious: function() {
|
||||||
if(this.index > 0) this.index--
|
if(this.index > 0) this.index--;
|
||||||
else this.index = this.entryCount-1;
|
else this.index = this.entryCount-1;
|
||||||
this.getEntry(this.index).scrollIntoView(true);
|
this.getEntry(this.index).scrollIntoView(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
markNext: function() {
|
markNext: function() {
|
||||||
if(this.index < this.entryCount-1) this.index++
|
if(this.index < this.entryCount-1) this.index++;
|
||||||
else this.index = 0;
|
else this.index = 0;
|
||||||
this.getEntry(this.index).scrollIntoView(false);
|
this.getEntry(this.index).scrollIntoView(false);
|
||||||
},
|
},
|
||||||
@@ -459,7 +459,7 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (partial.length)
|
if (partial.length)
|
||||||
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
|
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
|
||||||
return "<ul>" + ret.join('') + "</ul>";
|
return "<ul>" + ret.join('') + "</ul>";
|
||||||
}
|
}
|
||||||
}, options || { });
|
}, options || { });
|
||||||
@@ -476,7 +476,7 @@ Field.scrollFreeActivate = function(field) {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
Field.activate(field);
|
Field.activate(field);
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
Ajax.InPlaceEditor = Class.create({
|
Ajax.InPlaceEditor = Class.create({
|
||||||
initialize: function(element, url, options) {
|
initialize: function(element, url, options) {
|
||||||
@@ -606,7 +606,7 @@ Ajax.InPlaceEditor = Class.create({
|
|||||||
this.triggerCallback('onEnterHover');
|
this.triggerCallback('onEnterHover');
|
||||||
},
|
},
|
||||||
getText: function() {
|
getText: function() {
|
||||||
return this.element.innerHTML;
|
return this.element.innerHTML.unescapeHTML();
|
||||||
},
|
},
|
||||||
handleAJAXFailure: function(transport) {
|
handleAJAXFailure: function(transport) {
|
||||||
this.triggerCallback('onFailure', transport);
|
this.triggerCallback('onFailure', transport);
|
||||||
@@ -782,7 +782,7 @@ Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
|
|||||||
onSuccess: function(transport) {
|
onSuccess: function(transport) {
|
||||||
var js = transport.responseText.strip();
|
var js = transport.responseText.strip();
|
||||||
if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
|
if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
|
||||||
throw 'Server returned an invalid collection representation.';
|
throw('Server returned an invalid collection representation.');
|
||||||
this._collection = eval(js);
|
this._collection = eval(js);
|
||||||
this.checkForExternalText();
|
this.checkForExternalText();
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|||||||
52
lib/scriptaculous/dragdrop.js
vendored
52
lib/scriptaculous/dragdrop.js
vendored
@@ -1,7 +1,6 @@
|
|||||||
// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
||||||
|
|
||||||
// Copyright (c) 2005-2007 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-2007 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/
|
||||||
@@ -123,7 +122,7 @@ var Droppables = {
|
|||||||
if(this.last_active)
|
if(this.last_active)
|
||||||
this.deactivate(this.last_active);
|
this.deactivate(this.last_active);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var Draggables = {
|
var Draggables = {
|
||||||
drags: [],
|
drags: [],
|
||||||
@@ -220,7 +219,7 @@ var Draggables = {
|
|||||||
).length;
|
).length;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -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);
|
||||||
@@ -333,8 +332,8 @@ var Draggable = Class.create({
|
|||||||
|
|
||||||
if(this.options.ghosting) {
|
if(this.options.ghosting) {
|
||||||
this._clone = this.element.cloneNode(true);
|
this._clone = this.element.cloneNode(true);
|
||||||
this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
|
this._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
|
||||||
if (!this.element._originallyAbsolute)
|
if (!this._originallyAbsolute)
|
||||||
Position.absolutize(this.element);
|
Position.absolutize(this.element);
|
||||||
this.element.parentNode.insertBefore(this._clone, this.element);
|
this.element.parentNode.insertBefore(this._clone, this.element);
|
||||||
}
|
}
|
||||||
@@ -405,9 +404,9 @@ var Draggable = Class.create({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(this.options.ghosting) {
|
if(this.options.ghosting) {
|
||||||
if (!this.element._originallyAbsolute)
|
if (!this._originallyAbsolute)
|
||||||
Position.relativize(this.element);
|
Position.relativize(this.element);
|
||||||
delete this.element._originallyAbsolute;
|
delete this._originallyAbsolute;
|
||||||
Element.remove(this._clone);
|
Element.remove(this._clone);
|
||||||
this._clone = null;
|
this._clone = null;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
@@ -480,10 +479,10 @@ var Draggable = Class.create({
|
|||||||
} else {
|
} else {
|
||||||
if(Object.isArray(this.options.snap)) {
|
if(Object.isArray(this.options.snap)) {
|
||||||
p = p.map( function(v, i) {
|
p = p.map( function(v, i) {
|
||||||
return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
|
return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this));
|
||||||
} else {
|
} else {
|
||||||
p = p.map( function(v) {
|
p = p.map( function(v) {
|
||||||
return (v/this.options.snap).round()*this.options.snap }.bind(this))
|
return (v/this.options.snap).round()*this.options.snap }.bind(this));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
@@ -562,7 +561,7 @@ var Draggable = Class.create({
|
|||||||
H = documentElement.clientHeight;
|
H = documentElement.clientHeight;
|
||||||
} else {
|
} else {
|
||||||
W = body.offsetWidth;
|
W = body.offsetWidth;
|
||||||
H = body.offsetHeight
|
H = body.offsetHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { top: T, left: L, width: W, height: H };
|
return { top: T, left: L, width: W, height: H };
|
||||||
@@ -610,7 +609,8 @@ var Sortable = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
destroy: function(element){
|
destroy: function(element){
|
||||||
var s = Sortable.options(element);
|
element = $(element);
|
||||||
|
var s = Sortable.sortables[element.id];
|
||||||
|
|
||||||
if(s) {
|
if(s) {
|
||||||
Draggables.removeObserver(s.element);
|
Draggables.removeObserver(s.element);
|
||||||
@@ -691,14 +691,14 @@ var Sortable = {
|
|||||||
tree: options.tree,
|
tree: options.tree,
|
||||||
hoverclass: options.hoverclass,
|
hoverclass: options.hoverclass,
|
||||||
onHover: Sortable.onHover
|
onHover: Sortable.onHover
|
||||||
}
|
};
|
||||||
|
|
||||||
var options_for_tree = {
|
var options_for_tree = {
|
||||||
onHover: Sortable.onEmptyHover,
|
onHover: Sortable.onEmptyHover,
|
||||||
overlap: options.overlap,
|
overlap: options.overlap,
|
||||||
containment: options.containment,
|
containment: options.containment,
|
||||||
hoverclass: options.hoverclass
|
hoverclass: options.hoverclass
|
||||||
}
|
};
|
||||||
|
|
||||||
// fix for gecko engine
|
// fix for gecko engine
|
||||||
Element.cleanWhitespace(element);
|
Element.cleanWhitespace(element);
|
||||||
@@ -731,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));
|
||||||
@@ -826,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')
|
||||||
@@ -853,11 +853,11 @@ var Sortable = {
|
|||||||
children: [],
|
children: [],
|
||||||
position: parent.children.length,
|
position: parent.children.length,
|
||||||
container: $(children[i]).down(options.treeTag)
|
container: $(children[i]).down(options.treeTag)
|
||||||
}
|
};
|
||||||
|
|
||||||
/* Get the element containing the children and recurse over it */
|
/* Get the element containing the children and recurse over it */
|
||||||
if (child.container)
|
if (child.container)
|
||||||
this._tree(child.container, options, child)
|
this._tree(child.container, options, child);
|
||||||
|
|
||||||
parent.children.push (child);
|
parent.children.push (child);
|
||||||
}
|
}
|
||||||
@@ -882,7 +882,7 @@ var Sortable = {
|
|||||||
children: [],
|
children: [],
|
||||||
container: element,
|
container: element,
|
||||||
position: 0
|
position: 0
|
||||||
}
|
};
|
||||||
|
|
||||||
return Sortable._tree(element, options, root);
|
return Sortable._tree(element, options, root);
|
||||||
},
|
},
|
||||||
@@ -942,14 +942,14 @@ var Sortable = {
|
|||||||
}).join('&');
|
}).join('&');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// Returns true if child is contained within element
|
// Returns true if child is contained within element
|
||||||
Element.isParent = function(child, element) {
|
Element.isParent = function(child, element) {
|
||||||
if (!child.parentNode || child == element) return false;
|
if (!child.parentNode || child == element) return false;
|
||||||
if (child.parentNode == element) return true;
|
if (child.parentNode == element) return true;
|
||||||
return Element.isParent(child.parentNode, element);
|
return Element.isParent(child.parentNode, element);
|
||||||
}
|
};
|
||||||
|
|
||||||
Element.findChildren = function(element, only, recursive, tagName) {
|
Element.findChildren = function(element, only, recursive, tagName) {
|
||||||
if(!element.hasChildNodes()) return null;
|
if(!element.hasChildNodes()) return null;
|
||||||
@@ -967,8 +967,8 @@ Element.findChildren = function(element, only, recursive, tagName) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (elements.length>0 ? elements.flatten() : []);
|
return (elements.length>0 ? elements.flatten() : []);
|
||||||
}
|
};
|
||||||
|
|
||||||
Element.offsetSize = function (element, type) {
|
Element.offsetSize = function (element, type) {
|
||||||
return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
|
return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
|
||||||
}
|
};
|
||||||
107
lib/scriptaculous/effects.js
vendored
107
lib/scriptaculous/effects.js
vendored
@@ -1,6 +1,6 @@
|
|||||||
// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
||||||
|
|
||||||
// Copyright (c) 2005-2007 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/)
|
||||||
@@ -72,25 +72,20 @@ var Effect = {
|
|||||||
Transitions: {
|
Transitions: {
|
||||||
linear: Prototype.K,
|
linear: Prototype.K,
|
||||||
sinoidal: function(pos) {
|
sinoidal: function(pos) {
|
||||||
return (-Math.cos(pos*Math.PI)/2) + 0.5;
|
return (-Math.cos(pos*Math.PI)/2) + .5;
|
||||||
},
|
},
|
||||||
reverse: function(pos) {
|
reverse: function(pos) {
|
||||||
return 1-pos;
|
return 1-pos;
|
||||||
},
|
},
|
||||||
flicker: function(pos) {
|
flicker: function(pos) {
|
||||||
var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
|
var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
|
||||||
return pos > 1 ? 1 : pos;
|
return pos > 1 ? 1 : pos;
|
||||||
},
|
},
|
||||||
wobble: function(pos) {
|
wobble: function(pos) {
|
||||||
return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
|
return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
|
||||||
},
|
},
|
||||||
pulse: function(pos, pulses) {
|
pulse: function(pos, pulses) {
|
||||||
pulses = pulses || 5;
|
return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
|
||||||
return (
|
|
||||||
((pos % (1/pulses)) * pulses).round() == 0 ?
|
|
||||||
((pos * pulses * 2) - (pos * pulses * 2).floor()) :
|
|
||||||
1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
spring: function(pos) {
|
spring: function(pos) {
|
||||||
return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
|
return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
|
||||||
@@ -152,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);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -235,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;
|
||||||
@@ -251,18 +239,30 @@ Effect.Base = Class.create({
|
|||||||
this.totalTime = this.finishOn-this.startOn;
|
this.totalTime = this.finishOn-this.startOn;
|
||||||
this.totalFrames = this.options.fps*this.options.duration;
|
this.totalFrames = this.options.fps*this.options.duration;
|
||||||
|
|
||||||
eval('this.render = function(pos){ '+
|
this.render = (function() {
|
||||||
'if (this.state=="idle"){this.state="running";'+
|
function dispatch(effect, eventName) {
|
||||||
codeForEvent(this.options,'beforeSetup')+
|
if (effect.options[eventName + 'Internal'])
|
||||||
(this.setup ? 'this.setup();':'')+
|
effect.options[eventName + 'Internal'](effect);
|
||||||
codeForEvent(this.options,'afterSetup')+
|
if (effect.options[eventName])
|
||||||
'};if (this.state=="running"){'+
|
effect.options[eventName](effect);
|
||||||
'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
|
}
|
||||||
'this.position=pos;'+
|
|
||||||
codeForEvent(this.options,'beforeUpdate')+
|
return function(pos) {
|
||||||
(this.update ? 'this.update(pos);':'')+
|
if (this.state === "idle") {
|
||||||
codeForEvent(this.options,'afterUpdate')+
|
this.state = "running";
|
||||||
'}}');
|
dispatch(this, 'beforeSetup');
|
||||||
|
if (this.setup) this.setup();
|
||||||
|
dispatch(this, 'afterSetup');
|
||||||
|
}
|
||||||
|
if (this.state === "running") {
|
||||||
|
pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
|
||||||
|
this.position = pos;
|
||||||
|
dispatch(this, 'beforeUpdate');
|
||||||
|
if (this.update) this.update(pos);
|
||||||
|
dispatch(this, 'afterUpdate');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
this.event('beforeStart');
|
this.event('beforeStart');
|
||||||
if (!this.options.sync)
|
if (!this.options.sync)
|
||||||
@@ -510,16 +510,15 @@ Effect.Highlight = Class.create(Effect.Base, {
|
|||||||
Effect.ScrollTo = function(element) {
|
Effect.ScrollTo = function(element) {
|
||||||
var options = arguments[1] || { },
|
var options = arguments[1] || { },
|
||||||
scrollOffsets = document.viewport.getScrollOffsets(),
|
scrollOffsets = document.viewport.getScrollOffsets(),
|
||||||
elementOffsets = $(element).cumulativeOffset(),
|
elementOffsets = $(element).cumulativeOffset();
|
||||||
max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
|
|
||||||
|
|
||||||
if (options.offset) elementOffsets[1] += options.offset;
|
if (options.offset) elementOffsets[1] += options.offset;
|
||||||
|
|
||||||
return new Effect.Tween(null,
|
return new Effect.Tween(null,
|
||||||
scrollOffsets.top,
|
scrollOffsets.top,
|
||||||
elementOffsets[1] > max ? max : elementOffsets[1],
|
elementOffsets[1],
|
||||||
options,
|
options,
|
||||||
function(p){ scrollTo(scrollOffsets.left, p.round()) }
|
function(p){ scrollTo(scrollOffsets.left, p.round()); }
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -570,7 +569,7 @@ Effect.Puff = function(element) {
|
|||||||
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
|
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
|
||||||
Object.extend({ duration: 1.0,
|
Object.extend({ duration: 1.0,
|
||||||
beforeSetupInternal: function(effect) {
|
beforeSetupInternal: function(effect) {
|
||||||
Position.absolutize(effect.effects[0].element)
|
Position.absolutize(effect.effects[0].element);
|
||||||
},
|
},
|
||||||
afterFinishInternal: function(effect) {
|
afterFinishInternal: function(effect) {
|
||||||
effect.effects[0].element.hide().setStyle(oldStyle); }
|
effect.effects[0].element.hide().setStyle(oldStyle); }
|
||||||
@@ -627,7 +626,7 @@ Effect.SwitchOff = function(element) {
|
|||||||
afterFinishInternal: function(effect) {
|
afterFinishInternal: function(effect) {
|
||||||
effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
|
effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}, arguments[1] || { }));
|
}, arguments[1] || { }));
|
||||||
};
|
};
|
||||||
@@ -676,7 +675,7 @@ Effect.Shake = function(element) {
|
|||||||
new Effect.Move(effect.element,
|
new Effect.Move(effect.element,
|
||||||
{ x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
|
{ x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
|
||||||
effect.element.undoPositioned().setStyle(oldStyle);
|
effect.element.undoPositioned().setStyle(oldStyle);
|
||||||
}}) }}) }}) }}) }}) }});
|
}}); }}); }}); }}); }}); }});
|
||||||
};
|
};
|
||||||
|
|
||||||
Effect.SlideDown = function(element) {
|
Effect.SlideDown = function(element) {
|
||||||
@@ -818,7 +817,7 @@ Effect.Grow = function(element) {
|
|||||||
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
|
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
|
||||||
}
|
}
|
||||||
}, options)
|
}, options)
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -879,11 +878,13 @@ Effect.Shrink = function(element) {
|
|||||||
|
|
||||||
Effect.Pulsate = function(element) {
|
Effect.Pulsate = function(element) {
|
||||||
element = $(element);
|
element = $(element);
|
||||||
var options = arguments[1] || { };
|
var options = arguments[1] || { },
|
||||||
var oldOpacity = element.getInlineOpacity();
|
oldOpacity = element.getInlineOpacity(),
|
||||||
var transition = options.transition || Effect.Transitions.sinoidal;
|
transition = options.transition || Effect.Transitions.linear,
|
||||||
var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
|
reverser = function(pos){
|
||||||
reverser.bind(transition);
|
return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
|
||||||
|
};
|
||||||
|
|
||||||
return new Effect.Opacity(element,
|
return new Effect.Opacity(element,
|
||||||
Object.extend(Object.extend({ duration: 2.0, from: 0,
|
Object.extend(Object.extend({ duration: 2.0, from: 0,
|
||||||
afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
|
afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
|
||||||
@@ -936,7 +937,7 @@ Effect.Morph = Class.create(Effect.Base, {
|
|||||||
effect.transforms.each(function(transform) {
|
effect.transforms.each(function(transform) {
|
||||||
effect.element.style[transform.style] = '';
|
effect.element.style[transform.style] = '';
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.start(options);
|
this.start(options);
|
||||||
@@ -947,7 +948,7 @@ Effect.Morph = Class.create(Effect.Base, {
|
|||||||
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
|
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
|
||||||
color = color.parseColor();
|
color = color.parseColor();
|
||||||
return $R(0,2).map(function(i){
|
return $R(0,2).map(function(i){
|
||||||
return parseInt( color.slice(i*2+1,i*2+3), 16 )
|
return parseInt( color.slice(i*2+1,i*2+3), 16 );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.transforms = this.style.map(function(pair){
|
this.transforms = this.style.map(function(pair){
|
||||||
@@ -980,7 +981,7 @@ Effect.Morph = Class.create(Effect.Base, {
|
|||||||
transform.unit != 'color' &&
|
transform.unit != 'color' &&
|
||||||
(isNaN(transform.originalValue) || isNaN(transform.targetValue))
|
(isNaN(transform.originalValue) || isNaN(transform.targetValue))
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
update: function(position) {
|
update: function(position) {
|
||||||
@@ -1083,7 +1084,7 @@ if (document.defaultView && document.defaultView.getComputedStyle) {
|
|||||||
if (!styles.opacity) styles.opacity = element.getOpacity();
|
if (!styles.opacity) styles.opacity = element.getOpacity();
|
||||||
return styles;
|
return styles;
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
Effect.Methods = {
|
Effect.Methods = {
|
||||||
morph: function(element, style) {
|
morph: function(element, style) {
|
||||||
@@ -1092,7 +1093,7 @@ Effect.Methods = {
|
|||||||
return element;
|
return element;
|
||||||
},
|
},
|
||||||
visualEffect: function(element, effect, options) {
|
visualEffect: function(element, effect, options) {
|
||||||
element = $(element)
|
element = $(element);
|
||||||
var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
|
var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
|
||||||
new Effect[klass](element, options);
|
new Effect[klass](element, options);
|
||||||
return element;
|
return element;
|
||||||
@@ -1111,7 +1112,7 @@ $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
|
|||||||
element = $(element);
|
element = $(element);
|
||||||
Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
|
Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
|
||||||
return element;
|
return element;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
||||||
|
|
||||||
// Copyright (c) 2005-2007 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,16 +24,25 @@
|
|||||||
// 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.1',
|
Version: '1.8.3',
|
||||||
require: function(libraryName) {
|
require: function(libraryName) {
|
||||||
|
try{
|
||||||
// inserting via DOM fails in Safari 2.0, so brute force approach
|
// inserting via DOM fails in Safari 2.0, so brute force approach
|
||||||
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
|
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',
|
REQUIRED_PROTOTYPE: '1.6.0.3',
|
||||||
load: function() {
|
load: function() {
|
||||||
function convertVersionString(versionString){
|
function convertVersionString(versionString) {
|
||||||
var r = versionString.split('.');
|
var v = versionString.replace(/_.*|\./g, '');
|
||||||
return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
|
v = parseInt(v + '0'.times(4-v.length));
|
||||||
|
return versionString.indexOf('_') > -1 ? v-1 : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((typeof Prototype=='undefined') ||
|
if((typeof Prototype=='undefined') ||
|
||||||
@@ -44,15 +53,16 @@ var Scriptaculous = {
|
|||||||
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
|
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
|
||||||
Scriptaculous.REQUIRED_PROTOTYPE);
|
Scriptaculous.REQUIRED_PROTOTYPE);
|
||||||
|
|
||||||
$A(document.getElementsByTagName("script")).findAll( function(s) {
|
var js = /scriptaculous\.js(\?.*)?$/;
|
||||||
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
|
$$('head script[src]').findAll(function(s) {
|
||||||
}).each( function(s) {
|
return s.src.match(js);
|
||||||
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
|
}).each(function(s) {
|
||||||
var includes = s.src.match(/\?.*load=([a-z,]*)/);
|
var path = s.src.replace(js, ''),
|
||||||
|
includes = s.src.match(/\?.*load=([a-z,]*)/);
|
||||||
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
|
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
|
||||||
function(include) { Scriptaculous.require(path+include+'.js') });
|
function(include) { Scriptaculous.require(path+include+'.js') });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
Scriptaculous.load();
|
Scriptaculous.load();
|
||||||
Reference in New Issue
Block a user