Changeset 65381 in spip-zone
- Timestamp:
- Aug 30, 2012, 2:36:25 PM (8 years ago)
- Location:
- _plugins_/ancres_douces
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/ancres_douces/js/jquery.localscroll.js
r23708 r65381 1 1 /** 2 2 * jQuery.LocalScroll 3 * Copyright (c) 2007-200 8Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com3 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com 4 4 * Dual licensed under MIT and GPL. 5 * Date: 6/3/20085 * Date: 3/11/2009 6 6 * 7 7 * @projectDescription Animated scrolling navigation, using anchors. 8 8 * http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html 9 9 * @author Ariel Flesler 10 * @version 1.2. 610 * @version 1.2.7 11 11 * 12 12 * @id jQuery.fn.localScroll … … 25 25 * - jQuery.localScroll can be used if the desired links, are all over the document, it accepts the same settings. 26 26 * - If the setting 'lazy' is set to true, then the binding will still work for later added anchors. 27 * - The setting 'speed' is deprecated, use 'duration' instead. 28 * - If onBefore returns false, the event is ignored. 27 * - If onBefore returns false, the event is ignored. 29 28 **/ 30 29 ;(function( $ ){ 31 var URI = location.href.replace(/#.*/,''); //local url without hash30 var URI = location.href.replace(/#.*/,''); // local url without hash 32 31 33 32 var $localScroll = $.localScroll = function( settings ){ … … 35 34 }; 36 35 37 //Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option. 38 //@see http://www.freewebs.com/flesler/jQuery.ScrollTo/ 39 $localScroll.defaults = {//the defaults are public and can be overriden. 40 duration:1000, //how long to animate. 41 axis:'y',//which of top and left should be modified. 42 event:'click',//on which event to react. 43 stop:true,//avoid queuing animations 44 hash: true//if true, the hash of the selected link, will appear on the address bar. 36 // Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option. 37 // @see http://flesler.demos.com/jquery/scrollTo/ 38 // The defaults are public and can be overriden. 39 $localScroll.defaults = { 40 duration:1000, // How long to animate. 41 axis:'y', // Which of top and left should be modified. 42 event:'click', // On which event to react. 43 stop:true, // Avoid queuing animations 44 target: window, // What to scroll (selector or element). The whole window by default. 45 reset: true // Used by $.localScroll.hash. If true, elements' scroll is resetted before actual scrolling 45 46 /* 46 lock:false, //ignore events if already animating47 lazy:false, //if true, links can be added later, and will still work.48 target:null, //what to scroll (selector or element). Keep it null if want to scroll the whole window.49 filter:null, //filter some anchors out of the matched elements.47 lock:false, // ignore events if already animating 48 lazy:false, // if true, links can be added later, and will still work. 49 filter:null, // filter some anchors out of the matched elements. 50 hash: false // if true, the hash of the selected link, will appear on the address bar. 50 51 */ 51 52 }; 52 53 53 // if the URL contains a hash, it will scroll to the pointed element54 // If the URL contains a hash, it will scroll to the pointed element 54 55 $localScroll.hash = function( settings ){ 55 settings = $.extend( {}, $localScroll.defaults, settings ); 56 // settings.hash = false;//can't be true 57 if( location.hash ) 58 setTimeout(function(){ scroll( 0, location, settings ); }, 0 );//better wrapped with a setTimeout 56 if( location.hash ){ 57 settings = $.extend( {}, $localScroll.defaults, settings ); 58 settings.hash = false; // can't be true 59 60 if( settings.reset ){ 61 var d = settings.duration; 62 delete settings.duration; 63 $(settings.target).scrollTo( 0, settings ); 64 settings.duration = d; 65 } 66 scroll( 0, location, settings ); 67 } 59 68 }; 60 69 … … 62 71 settings = $.extend( {}, $localScroll.defaults, settings ); 63 72 64 return ( settings.persistent || settings.lazy ) 65 ? this.bind( settings.event, function( e ){//use event delegation, more links can be added later. 66 var a = $([e.target, e.target.parentNode]).filter(filter)[0];//if a valid link was clicked. 67 a && scroll( e, a, settings );//do scroll. 68 }) 69 : this.find('a,area')//bind concretely, to each matching link 70 .filter( filter ).bind( settings.event, function(e){ 71 scroll( e, this, settings ); 72 }).end() 73 .end(); 73 return settings.lazy ? 74 // use event delegation, more links can be added later. 75 this.bind( settings.event, function( e ){ 76 // Could use closest(), but that would leave out jQuery -1.3.x 77 var a = $([e.target, e.target.parentNode]).filter(filter)[0]; 78 // if a valid link was clicked 79 if( a ) 80 scroll( e, a, settings ); // do scroll. 81 }) : 82 // bind concretely, to each matching link 83 this.find('a,area') 84 .filter( filter ).bind( settings.event, function(e){ 85 scroll( e, this, settings ); 86 }).end() 87 .end(); 74 88 75 function filter(){// is this a link that points to an anchor and passes a possible filter ? href is checked to avoid a bug in FF.89 function filter(){// is this a link that points to an anchor and passes a possible filter ? href is checked to avoid a bug in FF. 76 90 return !!this.href && !!this.hash && this.href.replace(this.hash,'') == URI && (!settings.filter || $(this).is( settings.filter )); 77 91 }; … … 81 95 var id = link.hash.slice(1), 82 96 elem = document.getElementById(id) || document.getElementsByName(id)[0]; 83 if ( elem ){84 e && e.preventDefault();85 var $target = $( settings.target || $.scrollTo.window() );//if none specified, then the window.86 97 87 if( settings.lock && $target.is(':animated') ||88 settings.onBefore && settings.onBefore.call(link, e, elem, $target) === false )return;98 if ( !elem ) 99 return; 89 100 90 if( settings.stop ) 91 $target.queue('fx',[]).stop();//remove all its animations 92 $target 93 .scrollTo( elem, settings )//do scroll 94 .trigger('notify.serialScroll',[elem]);//notify serialScroll about this change 95 if( settings.hash ) 96 $target.queue(function(){ 97 location = URI+link.hash; 98 // make sure this function is released 99 $(this).dequeue(); 101 if( e ) 102 e.preventDefault(); 103 104 var $target = $( settings.target ); 105 106 if( settings.lock && $target.is(':animated') || 107 settings.onBefore && settings.onBefore.call(settings, e, elem, $target) === false ) 108 return; 109 110 if( settings.stop ) 111 $target.stop(true); // remove all its animations 112 113 if( settings.hash ){ 114 var attr = elem.id == id ? 'id' : 'name', 115 $a = $('<a> </a>').attr(attr, id).css({ 116 position:'absolute', 117 top: $(window).scrollTop(), 118 left: $(window).scrollLeft() 100 119 }); 120 121 elem[attr] = ''; 122 $('body').prepend($a); 123 location = link.hash; 124 $a.remove(); 125 elem[attr] = id; 101 126 } 127 128 $target 129 .scrollTo( elem, settings ) // do scroll 130 .trigger('notify.serialScroll',[elem]); // notify serialScroll about this change 102 131 }; 103 132 -
_plugins_/ancres_douces/js/jquery.scrollto.js
r40831 r65381 1 /* *1 /*! 2 2 * jQuery.ScrollTo 3 * Copyright (c) 2007-20 09Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com3 * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com 4 4 * Dual licensed under MIT and GPL. 5 * Date: 5/25/20095 * Date: 22/08/2012 6 6 * 7 7 * @projectDescription Easy element scrolling using jQuery. 8 8 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html 9 * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.10 *11 9 * @author Ariel Flesler 12 * @version 1.4. 210 * @version 1.4.3 13 11 * 14 12 * @id jQuery.scrollTo … … 21 19 * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc ) 22 20 * - A hash { top:x, left:y }, x and y can be any kind of number/string like above. 23 * - A percentage of the container's dimension/s, for example: 50% to go to the middle.21 * - A percentage of the container's dimension/s, for example: 50% to go to the middle. 24 22 * - The string 'max' for go-to-end. 25 * @param {Number } duration The OVERALL length of the animation, this argument can be the settings object instead.23 * @param {Number, Function} duration The OVERALL length of the animation, this argument can be the settings object instead. 26 24 * @param {Object,Function} settings Optional set of settings or the onAfter callback. 27 25 * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'. 28 * @option {Number } duration The OVERALL length of the animation.26 * @option {Number, Function} duration The OVERALL length of the animation. 29 27 * @option {String} easing The easing method for the animation. 30 28 * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position. … … 42 40 * @example $('div').scrollTo( '+=340px', { axis:'y' } ); 43 41 * 44 * @de c Scroll using a selector (relative to the scrolled element)42 * @desc Scroll using a selector (relative to the scrolled element) 45 43 * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } ); 46 44 * 47 * @ Scroll to a DOM element (same for jQuery object)45 * @desc Scroll to a DOM element (same for jQuery object) 48 46 * @example var second_child = document.getElementById('container').firstChild.nextSibling; 49 47 * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){ … … 54 52 * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } ); 55 53 */ 54 56 55 ;(function( $ ){ 57 56 … … 62 61 $scrollTo.defaults = { 63 62 axis:'xy', 64 duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1 63 duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1, 64 limit:true 65 65 }; 66 66 … … 83 83 var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem; 84 84 85 return $.browser.safari|| doc.compatMode == 'BackCompat' ?85 return /webkit/i.test(navigator.userAgent) || doc.compatMode == 'BackCompat' ? 86 86 doc.body : 87 87 doc.documentElement; … … 102 102 settings = $.extend( {}, $scrollTo.defaults, settings ); 103 103 // Speed is still recognized for backwards compatibility 104 duration = duration || settings. speed || settings.duration;104 duration = duration || settings.duration; 105 105 // Make sure the settings are given right 106 106 settings.queue = settings.queue && settings.axis.length > 1; … … 113 113 114 114 return this._scrollable().each(function(){ 115 // Null target yields nothing, just like jQuery does 116 if (!target) return; 117 115 118 var elem = this, 116 119 $elem = $(elem), … … 129 132 // Relative selector, no break! 130 133 targ = $(targ,this); 134 if (!targ.length) return; 131 135 case 'object': 132 136 // DOMElement / jQuery … … 165 169 166 170 // Number or 'number' 167 if( /^\d+$/.test(attr[key]) )171 if( settings.limit && /^\d+$/.test(attr[key]) ) 168 172 // Check the limits 169 173 attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max ); … … 206 210 return Math.max( html[scroll], body[scroll] ) 207 211 - Math.min( html[size] , body[size] ); 208 209 212 }; 210 213 -
_plugins_/ancres_douces/paquet.xml
r61307 r65381 2 2 prefix="ancresdouces" 3 3 categorie="navigation" 4 version="1. 3.0"4 version="1.4.1" 5 5 etat="stable" 6 6 compatibilite="[3.0.0-dev;3.0.*]" -
_plugins_/ancres_douces/plugin.xml
r52426 r65381 7 7 </multi> 8 8 </auteur> 9 <version>1.4 </version>9 <version>1.4.1</version> 10 10 <etat>stable</etat> 11 11 <description>
Note: See TracChangeset
for help on using the changeset viewer.