From 8188296842c19c23a1194e0a3725a2489a5642f2 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 19 Sep 2005 02:07:19 +0000 Subject: [PATCH] * Renamed 'ScriptaculousEffect' back to 'Effect' because there is no longer any namespace conflict. --- webcit/ChangeLog | 5 +- webcit/static/controls.js | 8 +- webcit/static/dragdrop.js | 6 +- webcit/static/effects.js | 176 +++++++++++++++++++------------------- 4 files changed, 99 insertions(+), 96 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index e2f253d06..f6febbc08 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,8 @@ $Log$ +Revision 625.16 2005/09/19 02:07:17 ajc +* Renamed 'ScriptaculousEffect' back to 'Effect' because there is no + longer any namespace conflict. + Revision 625.15 2005/09/18 21:47:49 ajc *** empty log message *** @@ -3026,4 +3030,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/static/controls.js b/webcit/static/controls.js index d8c9cf5f9..43cdb3eaa 100644 --- a/webcit/static/controls.js +++ b/webcit/static/controls.js @@ -76,10 +76,10 @@ Autocompleter.Base.prototype = { update.style.position = 'absolute'; Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); } - new ScriptaculousEffect.Appear(update,{duration:0.15}); + new Effect.Appear(update,{duration:0.15}); }; this.options.onHide = this.options.onHide || - function(element, update){ new ScriptaculousEffect.Fade(update,{duration:0.15}) }; + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; if (typeof(this.options.tokens) == 'string') this.options.tokens = new Array(this.options.tokens); @@ -463,7 +463,7 @@ Ajax.InPlaceEditor.prototype = { okText: "ok", rows: 1, onComplete: function(transport, element) { - new ScriptaculousEffect.Highlight(element, {startcolor: this.options.highlightcolor}); + new Effect.Highlight(element, {startcolor: this.options.highlightcolor}); }, onFailure: function(transport) { alert("Error communicating with the server: " + transport.responseText.stripTags()); @@ -656,7 +656,7 @@ Ajax.InPlaceEditor.prototype = { } Element.removeClassName(this.element, this.options.hoverClassName) if (this.saving) return; - this.effect = new ScriptaculousEffect.Highlight(this.element, { + this.effect = new Effect.Highlight(this.element, { startcolor: this.options.highlightcolor, endcolor: this.options.highlightendcolor, restorecolor: this.originalBackground diff --git a/webcit/static/dragdrop.js b/webcit/static/dragdrop.js index 9113f3daa..55461c1b9 100644 --- a/webcit/static/dragdrop.js +++ b/webcit/static/dragdrop.js @@ -153,14 +153,14 @@ Draggable.prototype = { var options = Object.extend({ handle: false, starteffect: function(element) { - new ScriptaculousEffect.Opacity(element, {duration:0.2, from:1.0, to:0.7}); + new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7}); }, reverteffect: function(element, top_offset, left_offset) { var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; - new ScriptaculousEffect.MoveBy(element, -top_offset, -left_offset, {duration:dur}); + new Effect.MoveBy(element, -top_offset, -left_offset, {duration:dur}); }, endeffect: function(element) { - new ScriptaculousEffect.Opacity(element, {duration:0.2, from:0.7, to:1.0}); + new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0}); }, zindex: 1000, revert: false diff --git a/webcit/static/effects.js b/webcit/static/effects.js index 0b59d4837..71de14c47 100644 --- a/webcit/static/effects.js +++ b/webcit/static/effects.js @@ -22,7 +22,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -var ScriptaculousEffect = { +var Effect = { tagifyText: function(element) { var tagifyStyle = "position:relative"; if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ";zoom:1"; @@ -60,41 +60,41 @@ var ScriptaculousEffect = { } }; -var ScriptaculousEffect2 = ScriptaculousEffect; // deprecated +var Effect2 = Effect; // deprecated /* ------------- transitions ------------- */ -ScriptaculousEffect.Transitions = {} +Effect.Transitions = {} -ScriptaculousEffect.Transitions.linear = function(pos) { +Effect.Transitions.linear = function(pos) { return pos; } -ScriptaculousEffect.Transitions.sinoidal = function(pos) { +Effect.Transitions.sinoidal = function(pos) { return (-Math.cos(pos*Math.PI)/2) + 0.5; } -ScriptaculousEffect.Transitions.reverse = function(pos) { +Effect.Transitions.reverse = function(pos) { return 1-pos; } -ScriptaculousEffect.Transitions.flicker = function(pos) { +Effect.Transitions.flicker = function(pos) { return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random(0.25); } -ScriptaculousEffect.Transitions.wobble = function(pos) { +Effect.Transitions.wobble = function(pos) { return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; } -ScriptaculousEffect.Transitions.pulse = function(pos) { +Effect.Transitions.pulse = function(pos) { return (Math.floor(pos*10) % 2 == 0 ? (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10))); } -ScriptaculousEffect.Transitions.none = function(pos) { +Effect.Transitions.none = function(pos) { return 0; } -ScriptaculousEffect.Transitions.full = function(pos) { +Effect.Transitions.full = function(pos) { return 1; } /* ------------- core effects ------------- */ -ScriptaculousEffect.Queue = { +Effect.Queue = { effects: [], interval: null, findLast: function() { @@ -146,13 +146,13 @@ ScriptaculousEffect.Queue = { } } -ScriptaculousEffect.Base = function() {}; -ScriptaculousEffect.Base.prototype = { +Effect.Base = function() {}; +Effect.Base.prototype = { setOptions: function(options) { this.options = Object.extend({ - transition: ScriptaculousEffect.Transitions.sinoidal, + transition: Effect.Transitions.sinoidal, duration: 1.0, // seconds - fps: 25.0, // max. 25fps due to ScriptaculousEffect.Queue implementation + fps: 25.0, // max. 25fps due to Effect.Queue implementation sync: false, // true for combining from: 0.0, to: 1.0, @@ -167,7 +167,7 @@ ScriptaculousEffect.Base.prototype = { this.startOn = this.options.delay*1000; this.finishOn = this.startOn + (this.options.duration*1000); if(this.options.beforeStart) this.options.beforeStart(this); - if(!this.options.sync) ScriptaculousEffect.Queue.add(this); + if(!this.options.sync) Effect.Queue.add(this); }, loop: function(timePos) { if(timePos >= this.startOn) { @@ -199,13 +199,13 @@ ScriptaculousEffect.Base.prototype = { if(this.options.afterUpdate) this.options.afterUpdate(this); }, cancel: function() { - if(!this.options.sync) ScriptaculousEffect.Queue.remove(this); + if(!this.options.sync) Effect.Queue.remove(this); this.state = 'finished'; } } -ScriptaculousEffect.Parallel = Class.create(); -Object.extend(Object.extend(ScriptaculousEffect.Parallel.prototype, ScriptaculousEffect.Base.prototype), { +Effect.Parallel = Class.create(); +Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), { initialize: function(effects) { this.effects = effects || []; this.start(arguments[1]); @@ -225,8 +225,8 @@ Object.extend(Object.extend(ScriptaculousEffect.Parallel.prototype, Scriptaculou // Internet Explorer caveat: works only on elements that have // a 'layout', meaning having a given width or height. // There is no way to safely set this automatically. -ScriptaculousEffect.Opacity = Class.create(); -Object.extend(Object.extend(ScriptaculousEffect.Opacity.prototype, ScriptaculousEffect.Base.prototype), { +Effect.Opacity = Class.create(); +Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), { initialize: function(element) { this.element = $(element); var options = Object.extend({ @@ -250,8 +250,8 @@ Object.extend(Object.extend(ScriptaculousEffect.Opacity.prototype, Scriptaculous } }); -ScriptaculousEffect.MoveBy = Class.create(); -Object.extend(Object.extend(ScriptaculousEffect.MoveBy.prototype, ScriptaculousEffect.Base.prototype), { +Effect.MoveBy = Class.create(); +Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), { initialize: function(element, toTop, toLeft) { this.element = $(element); this.toTop = toTop; @@ -274,8 +274,8 @@ Object.extend(Object.extend(ScriptaculousEffect.MoveBy.prototype, ScriptaculousE } }); -ScriptaculousEffect.Scale = Class.create(); -Object.extend(Object.extend(ScriptaculousEffect.Scale.prototype, ScriptaculousEffect.Base.prototype), { +Effect.Scale = Class.create(); +Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { initialize: function(element, percent) { this.element = $(element) var options = Object.extend({ @@ -333,8 +333,8 @@ Object.extend(Object.extend(ScriptaculousEffect.Scale.prototype, ScriptaculousEf } }); -ScriptaculousEffect.Highlight = Class.create(); -Object.extend(Object.extend(ScriptaculousEffect.Highlight.prototype, ScriptaculousEffect.Base.prototype), { +Effect.Highlight = Class.create(); +Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), { initialize: function(element) { this.element = $(element); var options = Object.extend({ @@ -378,8 +378,8 @@ Object.extend(Object.extend(ScriptaculousEffect.Highlight.prototype, Scriptaculo } }); -ScriptaculousEffect.ScrollTo = Class.create(); -Object.extend(Object.extend(ScriptaculousEffect.ScrollTo.prototype, ScriptaculousEffect.Base.prototype), { +Effect.ScrollTo = Class.create(); +Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), { initialize: function(element) { this.element = $(element); this.start(arguments[1] || {}); @@ -404,7 +404,7 @@ Object.extend(Object.extend(ScriptaculousEffect.ScrollTo.prototype, Scriptaculou /* ------------- combination effects ------------- */ -ScriptaculousEffect.Fade = function(element) { +Effect.Fade = function(element) { var options = Object.extend({ from: 1.0, to: 0.0, @@ -412,10 +412,10 @@ ScriptaculousEffect.Fade = function(element) { { Element.hide(effect.element); effect.setOpacity(1); } }, arguments[1] || {}); - return new ScriptaculousEffect.Opacity(element,options); + return new Effect.Opacity(element,options); } -ScriptaculousEffect.Appear = function(element) { +Effect.Appear = function(element) { var options = Object.extend({ from: 0.0, to: 1.0, @@ -425,13 +425,13 @@ ScriptaculousEffect.Appear = function(element) { afterUpdate: function(effect) { Element.show(effect.element); } }, arguments[1] || {}); - return new ScriptaculousEffect.Opacity(element,options); + return new Effect.Opacity(element,options); } -ScriptaculousEffect.Puff = function(element) { - return new ScriptaculousEffect.Parallel( - [ new ScriptaculousEffect.Scale(element, 200, { sync: true, scaleFromCenter: true }), - new ScriptaculousEffect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], +Effect.Puff = function(element) { + return new Effect.Parallel( + [ new Effect.Scale(element, 200, { sync: true, scaleFromCenter: true }), + new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], Object.extend({ duration: 1.0, beforeUpdate: function(effect) { effect.effects[0].element.style.position = 'absolute'; }, @@ -441,10 +441,10 @@ ScriptaculousEffect.Puff = function(element) { ); } -ScriptaculousEffect.BlindUp = function(element) { +Effect.BlindUp = function(element) { element = $(element); Element.makeClipping(element); - return new ScriptaculousEffect.Scale(element, 0, + return new Effect.Scale(element, 0, Object.extend({ scaleContent: false, scaleX: false, afterFinish: function(effect) @@ -456,12 +456,12 @@ ScriptaculousEffect.BlindUp = function(element) { ); } -ScriptaculousEffect.BlindDown = function(element) { +Effect.BlindDown = function(element) { element = $(element); element.style.height = '0px'; Element.makeClipping(element); Element.show(element); - return new ScriptaculousEffect.Scale(element, 100, + return new Effect.Scale(element, 100, Object.extend({ scaleContent: false, scaleX: false, scaleMode: 'contents', @@ -473,13 +473,13 @@ ScriptaculousEffect.BlindDown = function(element) { ); } -ScriptaculousEffect.SwitchOff = function(element) { - return new ScriptaculousEffect.Appear(element, +Effect.SwitchOff = function(element) { + return new Effect.Appear(element, { duration: 0.4, - transition: ScriptaculousEffect.Transitions.flicker, + transition: Effect.Transitions.flicker, afterFinish: function(effect) { effect.element.style.overflow = 'hidden'; - new ScriptaculousEffect.Scale(effect.element, 1, + new Effect.Scale(effect.element, 1, { duration: 0.3, scaleFromCenter: true, scaleX: false, scaleContent: false, afterUpdate: function(effect) { @@ -491,10 +491,10 @@ ScriptaculousEffect.SwitchOff = function(element) { } ); } -ScriptaculousEffect.DropOut = function(element) { - return new ScriptaculousEffect.Parallel( - [ new ScriptaculousEffect.MoveBy(element, 100, 0, { sync: true }), - new ScriptaculousEffect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], +Effect.DropOut = function(element) { + return new Effect.Parallel( + [ new Effect.MoveBy(element, 100, 0, { sync: true }), + new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], Object.extend( { duration: 0.5, afterFinish: function(effect) @@ -502,30 +502,30 @@ ScriptaculousEffect.DropOut = function(element) { }, arguments[1] || {})); } -ScriptaculousEffect.Shake = function(element) { - return new ScriptaculousEffect.MoveBy(element, 0, 20, +Effect.Shake = function(element) { + return new Effect.MoveBy(element, 0, 20, { duration: 0.05, afterFinish: function(effect) { - new ScriptaculousEffect.MoveBy(effect.element, 0, -40, + new Effect.MoveBy(effect.element, 0, -40, { duration: 0.1, afterFinish: function(effect) { - new ScriptaculousEffect.MoveBy(effect.element, 0, 40, + new Effect.MoveBy(effect.element, 0, 40, { duration: 0.1, afterFinish: function(effect) { - new ScriptaculousEffect.MoveBy(effect.element, 0, -40, + new Effect.MoveBy(effect.element, 0, -40, { duration: 0.1, afterFinish: function(effect) { - new ScriptaculousEffect.MoveBy(effect.element, 0, 40, + new Effect.MoveBy(effect.element, 0, 40, { duration: 0.1, afterFinish: function(effect) { - new ScriptaculousEffect.MoveBy(effect.element, 0, -20, + new Effect.MoveBy(effect.element, 0, -20, { duration: 0.05, afterFinish: function(effect) { }}) }}) }}) }}) }}) }}); } -ScriptaculousEffect.SlideDown = function(element) { +Effect.SlideDown = function(element) { element = $(element); element.style.height = '0px'; Element.makeClipping(element); Element.cleanWhitespace(element); Element.makePositioned(element.firstChild); Element.show(element); - return new ScriptaculousEffect.Scale(element, 100, + return new Effect.Scale(element, 100, Object.extend({ scaleContent: false, scaleX: false, scaleMode: 'contents', @@ -539,13 +539,13 @@ ScriptaculousEffect.SlideDown = function(element) { ); } -ScriptaculousEffect.SlideUp = function(element) { +Effect.SlideUp = function(element) { element = $(element); Element.makeClipping(element); Element.cleanWhitespace(element); Element.makePositioned(element.firstChild); Element.show(element); - return new ScriptaculousEffect.Scale(element, 0, + return new Effect.Scale(element, 0, Object.extend({ scaleContent: false, scaleX: false, afterUpdate: function(effect) @@ -560,12 +560,12 @@ ScriptaculousEffect.SlideUp = function(element) { ); } -ScriptaculousEffect.Squish = function(element) { - return new ScriptaculousEffect.Scale(element, 0, +Effect.Squish = function(element) { + return new Effect.Scale(element, 0, { afterFinish: function(effect) { Element.hide(effect.element); } }); } -ScriptaculousEffect.Grow = function(element) { +Effect.Grow = function(element) { element = $(element); var options = arguments[1] || {}; @@ -575,9 +575,9 @@ ScriptaculousEffect.Grow = function(element) { Element.show(element); var direction = options.direction || 'center'; - var moveTransition = options.moveTransition || ScriptaculousEffect.Transitions.sinoidal; - var scaleTransition = options.scaleTransition || ScriptaculousEffect.Transitions.sinoidal; - var opacityTransition = options.opacityTransition || ScriptaculousEffect.Transitions.full; + var moveTransition = options.moveTransition || Effect.Transitions.sinoidal; + var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal; + var opacityTransition = options.opacityTransition || Effect.Transitions.full; var initialMoveX, initialMoveY; var moveX, moveY; @@ -610,21 +610,21 @@ ScriptaculousEffect.Grow = function(element) { break; } - return new ScriptaculousEffect.MoveBy(element, initialMoveY, initialMoveX, { + return new Effect.MoveBy(element, initialMoveY, initialMoveX, { duration: 0.01, beforeUpdate: function(effect) { $(element).style.height = '0px'; }, afterFinish: function(effect) { - new ScriptaculousEffect.Parallel( - [ new ScriptaculousEffect.Opacity(element, { sync: true, to: 1.0, from: 0.0, transition: opacityTransition }), - new ScriptaculousEffect.MoveBy(element, moveY, moveX, { sync: true, transition: moveTransition }), - new ScriptaculousEffect.Scale(element, 100, { + new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 1.0, from: 0.0, transition: opacityTransition }), + new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: moveTransition }), + new Effect.Scale(element, 100, { scaleMode: { originalHeight: originalHeight, originalWidth: originalWidth }, sync: true, scaleFrom: 0, scaleTo: 100, transition: scaleTransition })], options); } }); } -ScriptaculousEffect.Shrink = function(element) { +Effect.Shrink = function(element) { element = $(element); var options = arguments[1] || {}; @@ -634,9 +634,9 @@ ScriptaculousEffect.Shrink = function(element) { Element.show(element); var direction = options.direction || 'center'; - var moveTransition = options.moveTransition || ScriptaculousEffect.Transitions.sinoidal; - var scaleTransition = options.scaleTransition || ScriptaculousEffect.Transitions.sinoidal; - var opacityTransition = options.opacityTransition || ScriptaculousEffect.Transitions.none; + var moveTransition = options.moveTransition || Effect.Transitions.sinoidal; + var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal; + var opacityTransition = options.opacityTransition || Effect.Transitions.none; var moveX, moveY; @@ -662,34 +662,34 @@ ScriptaculousEffect.Shrink = function(element) { break; } - return new ScriptaculousEffect.Parallel( - [ new ScriptaculousEffect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: opacityTransition }), - new ScriptaculousEffect.Scale(element, 0, { sync: true, transition: moveTransition }), - new ScriptaculousEffect.MoveBy(element, moveY, moveX, { sync: true, transition: scaleTransition }) ], + return new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: opacityTransition }), + new Effect.Scale(element, 0, { sync: true, transition: moveTransition }), + new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: scaleTransition }) ], options); } -ScriptaculousEffect.Pulsate = function(element) { +Effect.Pulsate = function(element) { element = $(element); var options = arguments[1] || {}; - var transition = options.transition || ScriptaculousEffect.Transitions.sinoidal; - var reverser = function(pos){ return transition(1-ScriptaculousEffect.Transitions.pulse(pos)) }; + var transition = options.transition || Effect.Transitions.sinoidal; + var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) }; reverser.bind(transition); - return new ScriptaculousEffect.Opacity(element, + return new Effect.Opacity(element, Object.extend(Object.extend({ duration: 3.0, afterFinish: function(effect) { Element.show(effect.element); } }, options), {transition: reverser})); } -ScriptaculousEffect.Fold = function(element) { +Effect.Fold = function(element) { element = $(element); element.style.overflow = 'hidden'; - return new ScriptaculousEffect.Scale(element, 5, Object.extend({ + return new Effect.Scale(element, 5, Object.extend({ scaleContent: false, scaleTo: 100, scaleX: false, afterFinish: function(effect) { - new ScriptaculousEffect.Scale(element, 1, { + new Effect.Scale(element, 1, { scaleContent: false, scaleTo: 0, scaleY: false, @@ -697,7 +697,7 @@ ScriptaculousEffect.Fold = function(element) { }}, arguments[1] || {})); } -// old: new ScriptaculousEffect.ContentZoom(element, percent) +// old: new Effect.ContentZoom(element, percent) // new: Element.setContentZoom(element, percent) Element.setContentZoom = function(element, percent) { -- 2.39.2