[SPIP Zone] r4513 - in /_plugins_/_squelettes_: fading_rollover/ memobox/

Author: renatoformato@virgilio.it
Date: Sat Aug 12 21:40:58 2006
New Revision: 4513

Log:
fadingrollover plugin, patch to jquery-1.0a.js to handle correctly mouseout, credits

Added:
    _plugins_/_squelettes_/fading_rollover/
    _plugins_/_squelettes_/fading_rollover/README.txt
    _plugins_/_squelettes_/fading_rollover/fadingrollover.js
    _plugins_/_squelettes_/fading_rollover/fadingrollover_pipelines.php
    _plugins_/_squelettes_/fading_rollover/jquery-1.0a.js
    _plugins_/_squelettes_/fading_rollover/plugin.xml
Modified:
    _plugins_/_squelettes_/memobox/jquery-1.0a.js
    _plugins_/_squelettes_/memobox/memobox.js

Added: _plugins_/_squelettes_/fading_rollover/README.txt

--- _plugins_/_squelettes_/fading_rollover/README.txt (added)
+++ _plugins_/_squelettes_/fading_rollover/README.txt Sat Aug 12 21:40:58 2006
@@ -0,0 +1,14 @@
+Customization
+
+1)fadingrollover.js
+
+FADINGROLLOVER_SEL
+Set the CSS style selector to match the items to apply the effect to
+Ex: var FADINGROLLOVER_SEL = 'li';
+
+
+FADINGROLLOVER_COLOR
+Set the CSS background color to which the effect will fade
+Ex: var FADINGROLLOVER_COLOR = '#FF0000';
+
+2)Have fun :slight_smile:

Added: _plugins_/_squelettes_/fading_rollover/fadingrollover.js

--- _plugins_/_squelettes_/fading_rollover/fadingrollover.js (added)
+++ _plugins_/_squelettes_/fading_rollover/fadingrollover.js Sat Aug 12 21:40:58 2006
@@ -0,0 +1,101 @@
+/*
+ * fadingrollover for SPIP
+ *
+ * Copyright (c) 2006 Renato Formato (renatoformato@virgilio.it)
+ * Licensed under the GPL License:
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ */
+//CSS style selector to match the fading elements
+var FADINGROLLOVER_SEL = 'li';
+var FADINGROLLOVER_COLOR = '#FF0000';
+
+$(document).ready(function() {
+ $(FADINGROLLOVER_SEL).fadingRollover(FADINGROLLOVER_COLOR);
+});
+
+//fadingRollover effect
+jQuery.fn.fadingRollover = function(colorTo,s) {
+ return this.each(function(){
+ var currentColor = getStyle(this,'backgroundColor');
+ var rolloverEl = this;
+ $(this).hover(function(){fadingRolloverIn(rolloverEl,colorTo,s)},function(){fadingRolloverOut(rolloverEl,currentColor,s)});
+ })
+}
+
+function fadingRolloverIn(el,colorTo,s) {
+ if(el.rolloutEffect) {el.rolloutEffect.clear();el.rolloutEffect=null;}
+ var o = jQuery.speed(s,function(){el.rollinEffect=null;});
+ el.rollinEffect = new jQuery.fx.fadingToColor(el,colorTo,o);
+
+}
+
+function fadingRolloverOut(el,colorTo,s) {
+ if(el.rollinEffect) {el.rollinEffect.clear();el.rollinEffect=null;}
+ var o = jQuery.speed(s,function(){el.rolloutEffect=null;});
+ el.rolloutEffect = new jQuery.fx.fadingToColor(el,colorTo,o);
+}
+
+//fadeToColor effect
+jQuery.fn.fadingToColor = function(colorTo,s) {
+ var o = jQuery.speed(s);
+ return this.each(function() {
+ new jQuery.fx.fadingToColor(this,colorTo,o)
+ }
+ );
+}
+
+jQuery.fx.fadingToColor = function(el,colorTo,o) {
+ var z = this;
+ z.ce = CSSToRGB(colorTo);
+ z.cs = CSSToRGB(getStyle(el,'backgroundColor'));
+ z.o = o;
+ z.clear = function(){clearInterval(timer);timer=null;};
+ var tstart =(new Date).getTime();
+ z.step = function(){
+ var t = (new Date).getTime();
+ var p = (t - tstart) / z.o.duration;
+ if (t >= z.o.duration+tstart) {
+ z.clear();
+ el.style.backgroundColor = RGBToCSS(z.ce);
+ z.o.complete();
+ } else {
+ var pos = ((-Math.cos(p*Math.PI)/2) + 0.5);
+ var rgb = [parseInt(pos*(z.ce[0]-z.cs[0])+z.cs[0]),
+ parseInt(pos*(z.ce[1]-z.cs[1])+z.cs[1]),
+ parseInt(pos*(z.ce[2]-z.cs[2])+z.cs[2])];
+ el.style.backgroundColor = RGBToCSS(rgb);
+ }
+ };
+ var timer=setInterval(function(){z.step();},13);
+}
+
+function getStyle(e,s) {
+ var v = e.style[s];
+ if(!v) {
+ if (document.defaultView && document.defaultView.getComputedStyle) {
+ s = s.replace(/([A-Z])/g,function(str){return '-'+str.toLowerCase()});
+ v = document.defaultView.getComputedStyle(e, null).getPropertyValue(s);
+ } else if (e.currentStyle) {
+ v = e.currentStyle[s];
+ }
+ }
+ if(v=='transparent' && e.parentNode) v = getStyle(e.parentNode,s);
+ return v;
+}
+
+function CSSToRGB(c) {
+ var rgb = [];
+ var m = c.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
+ if(m) {
+ rgb = [parseInt(m[1]),parseInt(m[2]),parseInt(m[3])];
+ } else if(c.substring(1).length==3) {
+ var chars = [c.charAt(1)+c.charAt(1),c.charAt(2)+c.charAt(2),c.charAt(3)+c.charAt(3)]
+ rgb = [parseInt(chars[0],16),parseInt(chars[1],16),parseInt(chars[2],16)];
+ } else {
+ rgb = [parseInt(c.substring(1,3),16),parseInt(c.substring(3,5),16),parseInt(c.substring(5,7),16)];
+ }
+ return rgb;
+}
+
+function RGBToCSS(rgb) {return 'rgb('+rgb.join(',')+')';}

Added: _plugins_/_squelettes_/fading_rollover/fadingrollover_pipelines.php

--- _plugins_/_squelettes_/fading_rollover/fadingrollover_pipelines.php (added)
+++ _plugins_/_squelettes_/fading_rollover/fadingrollover_pipelines.php Sat Aug 12 21:40:58 2006
@@ -0,0 +1,9 @@
+<?php
+
+function fadingrollover_insert_head($flux){
+ $flux .= '<script src="'.find_in_path('jquery-1.0a.js').'" type="text/javascript"></script>';
+ $flux .= "<script type='text/javascript' src='".find_in_path('fadingrollover.js')."'></script>\n";
+ return $flux;
+}
+
+?>

Added: _plugins_/_squelettes_/fading_rollover/jquery-1.0a.js

--- _plugins_/_squelettes_/fading_rollover/jquery-1.0a.js (added)
+++ _plugins_/_squelettes_/fading_rollover/jquery-1.0a.js Sat Aug 12 21:40:58 2006
@@ -0,0 +1,1525 @@
+/*
+ * jQuery - New Wave Javascript
+ *
+ * Copyright (c) 2006 John Resig (jquery.com)
+ * Licensed under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * $Date: 2006-07-01 10:05:50 -0400 (Sat, 01 Jul 2006) $
+ * $Rev: 110 $
+ */
+
+// Global undefined variable
+window.undefined = window.undefined;
+
+/**
+ * Create a new jQuery Object
+ * @constructor
+ */
+function jQuery(a,c) {
+ // Watch for when a jQuery object is passed in as an arg
+ if ( a && a.jquery )
+ return a;
+
+ // If the context is global, return a new object
+ if ( window == this )
+ return new jQuery(a,c);
+
+ // Find the matching elements and save them for later
+ this.cur = jQuery.Select(
+ a || jQuery.context || document,
+ c && c.jquery && c.get(0) || c
+ );
+}
+
+/**
+ * The jQuery query object.
+ */
+if ( !window.$ )
+ var $ = jQuery;
+
+/*
+ * Handle support for overriding other $() functions. Way too many libraries
+ * provide this function to simply ignore it and overwrite it.
+ */
+else
+ var $ = function(a,c) {
+ // Check to see if this is a possible collision case
+ if ( !c && a.constructor == String &&
+
+ // Make sure that the expression is a colliding one
+ !/[^a-zA-Z0-9_-]/.test(a) &&
+
+ // and that there are no elements that match it
+ // (this is the one truly ambiguous case)
+ !document.getElementsByTagName(a).length ) {
+
+ // Only return the element if it's found
+ var obj = document.getElementById(a);
+ if ( obj ) return obj;
+
+ }
+
+ return jQuery(a,c);
+ };
+
+jQuery.fn = jQuery.prototype = {
+ /**
+ * The current SVN version of jQuery.
+ *
+ * @private
+ * @type String
+ */
+ jquery: "$Rev: 110 $",
+
+ /**
+ * The number of elements currently matched.
+ *
+ * @type Number
+ */
+ size: function() {
+ return this.get().length;
+ },
+
+ /**
+ * Access the elements matched. If a number is provided,
+ * the Nth element is returned, otherwise, an array of all
+ * matched items is returned.
+ *
+ * @type Array,DOMElement
+ */
+ get: function(num) {
+ return num == undefined ? this.cur : this.cur[num];
+ },
+
+ each: function(f) {
+ for ( var i = 0; i < this.size(); i++ )
+ f.apply( this.get(i), [i] );
+ return this;
+ },
+ set: function(a,b) {
+ return this.each(function(){
+ if ( b === undefined )
+ for ( var j in a )
+ jQuery.attr(this,j,a[j]);
+ else
+ jQuery.attr(this,a,b);
+ });
+ },
+ html: function(h) {
+ return h == undefined && this.size() ?
+ this.get(0).innerHTML : this.set( "innerHTML", h );
+ },
+ val: function(h) {
+ return h == undefined && this.size() ?
+ this.get(0).value : this.set( "value", h );
+ },
+ text: function(e) {
+ e = e || this.get();
+ var t = "";
+ for ( var j = 0; j < e.length; j++ )
+ for ( var i = 0; i < e[j].childNodes.length; i++ )
+ t += e[j].childNodes[i].nodeType != 1 ?
+ e[j].childNodes[i].nodeValue :
+ jQuery.fn.text(e[j].childNodes[i].childNodes);
+ return t;
+ },
+
+ css: function(a,b) {
+ return a.constructor != String || b ?
+ this.each(function(){
+ if ( b === undefined )
+ for ( var j in a )
+ jQuery.attr(this.style,j,a[j]);
+ else
+ jQuery.attr(this.style,a,b);
+ }) : jQuery.css( this.get(0), a );
+ },
+ toggle: function() {
+ return this.each(function(){
+ var d = jQuery.css(this,"display");
+ if ( !d || d == "none" )
+ $(this).show();
+ else
+ $(this).hide();
+ });
+ },
+ show: function() {
+ return this.each(function(){
+ this.style.display = this.oldblock ? this.oldblock : "";
+ if ( jQuery.css(this,"display") == "none" )
+ this.style.display = "block";
+ });
+ },
+ hide: function() {
+ return this.each(function(){
+ this.oldblock = jQuery.css(this,"display");
+ if ( this.oldblock == "none" )
+ this.oldblock = "block";
+ this.style.display = "none";
+ });
+ },
+ addClass: function(c) {
+ return this.each(function(){
+ jQuery.className.add(this,c);
+ });
+ },
+ removeClass: function(c) {
+ return this.each(function(){
+ jQuery.className.remove(this,c);
+ });
+ },
+
+ toggleClass: function(c) {
+ return this.each(function(){
+ if (jQuery.hasWord(this,c))
+ jQuery.className.remove(this,c);

[... 1386 lines stripped ...]