1/* ------------------------------------------------------------------------------ 2 3 - JQuery Plugin : Diaporama 4 - Version : 0.12.0 5 - Date : December, 10, 2015 6 - Developped by : SEV/Ouest-Communication 7 - Licence : GNU GPL 8 - Website: http://www.ouest-communication.com 9 - Require : JQuery 1.3.2 or later 10 11 This program is free software; you can redistribute it and/or 12 modify it under the terms of the GNU General Public License 13 as published by the Free Software Foundation; either version 2 14 of the License, or (at your option) any later version. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 25 ------------------------------------------------------------------------------ */ 26 27(function($){ 28 $.fn.extend({ 29 diaporamaVignettes: function(options){ 30 var timeout; 31 var intrface; 32 var current = 0; 33 var diapo = this; 34 var diapos = diapo.find('img'); 35 var diaposArray = diapos.toArray(); 36 var nbDiapos = diaposArray.length; 37 var texts = diapo.find('.text'); 38 39 var start = function(dir, auto){ 40 timeout = setTimeout(function(){ nav('next', 1); }, 0); 41 } 42 43 var stop = function(autoRestart){ 44 clearTimeout(timeout); 45 if(autoRestart) setTimeout(start, options.duration*2); 46 } 47 48 this.nav = function(dir, auto){ 49 stop(0); 50 var speed = (auto)?options.speedAuto:options.speed; 51 $(diaposArray[current]).fadeOut(speed); // disparition de la current 52 switch(dir){ 53 case 'prev': if((current-1)==-1) current=nbDiapos-1; else current--; break; 54 case 'next': if((current+1)==nbDiapos) current=0; else current++; break; 55 } 56 //console.log(); 57 /*if($(diaposArray[current]).height() < $(diapo).height()) { 58 $(diaposArray[current]).css({ 59 'top' : '50%', 60 'margin-top' : '-' + ( $(diaposArray[current]).height() / 2 ) + 'px' 61 }); 62 } else { 63 $(diaposArray[current]).css({ 64 'top' : '0', 65 'margin-top' : '0' 66 }); 67 }*/ 68 $(diaposArray[current]).fadeIn(speed); // apparition de la next 69 70 } 71 72 this.goTo = function(number){ 73 stop(0); 74 var speed = options.speed; 75 $(diaposArray[current]).fadeOut(speed); // disparition de la current 76 current=number; 77 //console.log(); 78 if($(diaposArray[current]).height() < $(diapo).height()) { 79 $(diaposArray[current]).css({ 80 'top' : '50%', 81 'margin-top' : '-' + ( $(diaposArray[current]).height() / 2 ) + 'px' 82 }); 83 } else { 84 $(diaposArray[current]).css({ 85 'top' : '0', 86 'margin-top' : '0' 87 }); 88 } 89 $(diaposArray[current]).fadeIn(speed); // apparition de la next 90 91 } 92 93 var initDiapo = function(){ 94 var i = nbDiapos; 95 var pos = diapo.css('position'); 96 97 // Style 98 if('absolute'!=pos) diapo.css('position', 'relative'); 99 diapo.css('overflow', 'hidden'); 100 101 // Initialisation de l'affichage des images 102 diapos.css('position', 'absolute'); 103 diapos.hide().first().show(); 104 texts.hide().first().show(); 105 diapos.each(function(){ 106 var img = new Image; 107 img.src = this.src; 108 diapo.css('z-index', i); 109 if( diapo.height() < diapo.height() ) { // Alignement 110 var temp = diapo.height() - diapo.height(); 111 diapo.css( 'top', ( temp / 2 ) ); 112 } 113 i--; 114 }); 115 116 /*$( window ).resize(function() { 117 fit( options.autofit ); 118 } ); 119 fit( options.autofit );*/ 120 } 121 122 var initInterface = function(){ 123 124 if ( 0 < diapo.find('.interface').length ) { 125 diapo.find('.interface').remove(); 126 } 127 128 // Interface creation 129 var intrfaceHTML = ''; 130 intrfaceHTML += '<div class="interface">'; 131 intrfaceHTML += '<div class="button prev"></div>'; 132 intrfaceHTML += '<div class="button next"></div>'; 133 intrfaceHTML += '</div>'; 134 diapo.append( intrfaceHTML ); 135 diapo.addClass('diaporama-skin-classic'); 136 intrface = diapo.find('.interface'); 137 138 // Base style 139 intrface.css({ 140 'z-index' : '100', 141 'position' : 'absolute', 142 'width' : diapo.width() + 'px', 143 'top' : ( diapo.height() / 2 ) + 'px',
144 'margin-top' : '-' + ( intrface.height() / 2 ) + 'px', 145 }); 146 intrface.find('.button').css({ 147 'z-index' : '110', 148 'cursor' : 'pointer', 149 }); 150 151 // Event triggers 152 intrface.find('.button.prev').click( function(){ nav('prev', 0) } ); 153 intrface.find('.button.next').click( function(){ nav('next', 0) } ); 154 155 if ( 1 >= diapos.length ) { 156 intrface.find('.button').hide(); 157 } 158 } 159 160 var fit = function( fitType ) { 161 var height = $(diaposArray[0]).height(); 162 $( diapo ).height( height ); 163 $('#diaporama .interface').height( height ); 164 165 initInterface(); 166 } 167 168 var centerDiapos = function ( diapoHeight ) { 169 diapos.each( function(index, el) { 170 $( el ).css({ 171 'left' : '50%', 172 'max-width' : 'none', 173 'width' : 'auto', 174 'margin-left': '-' + ( $( el ).width() / 2 ) + 'px', 175 'margin-top' : '-' + ( ( $( el ).height() - diapoHeight ) / 2 ) + 'px', 176 }); 177 } ); 178 } 179 180 var defaults = { 181 'speedAuto' : 2000, // Vitesse de l'animation en mode auto 182 'speed' : 1000, // Vitesse de l'animation en utilisant les boutons 183 'duration' : 5000, // Temps durant lequel l'image est visible 184 'autostart' : 0, // Démarrge automatique 185 'typeInterface' : 0, // Type d'interface (default : aucune) 186 'autofit' : 'width', // Façon dont le diaporama s'adapte au document 187 'autofitBottom' : 0 // Margin bottom de l'autofit (pour le mode 'height') 188 }; 189 var options = $.extend(defaults, options); 190 191 // Initialisation 192 initDiapo(); 193 194 // Interface 195 if(0!=options.typeInterface){ initInterface() } 196 197 // Start ! 198 if(1<nbDiapos && options.autostart){ start('next', 1); } 199 200 $(window).on("load", function() { 201 // fit( options.autofit ); 202 }) 203 204 this.initialize = function() { 205 return this; 206 }; 207 208 return this.initialize(); 209 } 210 }); 211})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.