1/** 2 * jqFancyTransitions - jQuery plugin 3 * @version: 1.8 (2010/06/13) 4 * @requires jQuery v1.2.2 or later 5 * @author Ivan Lazarevic 6 * Examples and documentation at: http://www.workshop.rs/projects/jqfancytransitions 7 8 * Dual licensed under the MIT and GPL licenses: 9 * http://www.opensource.org/licenses/mit-license.php 10 * http://www.gnu.org/licenses/gpl.html 11**/ 12 13(function($) { 14 var opts = new Array; 15 var level = new Array; 16 var img = new Array; 17 var links = new Array; 18 var titles = new Array; 19 var order = new Array; 20 var imgInc = new Array; 21 var inc = new Array; 22 var stripInt = new Array; 23 var imgInt = new Array; 24 25 $.fn.jqFancyTransitions = $.fn.jqfancytransitions = function(options){ 26 27 init = function(el){ 28 29 opts[el.id] = $.extend({}, $.fn.jqFancyTransitions.defaults, options); 30 img[el.id] = new Array(); // images array 31 links[el.id] = new Array(); // links array 32 titles[el.id] = new Array(); // titles array 33 order[el.id] = new Array(); // strips order array 34 imgInc[el.id] = 0; 35 inc[el.id] = 0; 36 37 params = opts[el.id]; 38 39 if(params.effect == 'zipper'){ params.direction = 'alternate'; params.position = 'alternate'; } 40 if(params.effect == 'wave'){ params.direction = 'alternate'; params.position = 'top'; } 41 if(params.effect == 'curtain'){ params.direction = 'alternate'; params.position = 'curtain'; } 42 43 // width of strips 44 stripWidth = parseInt(params.width / params.strips); 45 gap = params.width - stripWidth*params.strips; // number of pixels 46 stripLeft = 0; 47 48 // create images and titles arrays 49 $.each($('#'+el.id+' img'), function(i,item){ 50 img[el.id][i] = $(item).attr('src'); 51 links[el.id][i] = $(item).next().attr('href'); 52 titles[el.id][i] = $(item).attr('alt') ? $(item).attr('alt') : ''; 53 $(item).hide(); 54 }); 55 56 // set panel 57 $('#'+el.id).css({ 58 'background-image':'url('+img[el.id][0]+')', 59 'width': params.width, 60 'height': params.height, 61 'position': 'relative', 62 'background-position': 'top left' 63 }); 64 65 // create title bar 66 $('#'+el.id).append("<div class='ft-title' id='ft-title-"+el.id+"' style='position: absolute; bottom:0; left: 0; z-index: 1000; color: #fff; background-color: #000; '>"+titles[el.id][0]+"</div>"); 67 if(titles[el.id][imgInc[el.id]]) 68 $('#ft-title-'+el.id).css('opacity',opts[el.id].titleOpacity); 69 else 70 $('#ft-title-'+el.id).css('opacity',0); 71 72 if(params.navigation){ 73 $.navigation(el); 74 $('#ft-buttons-'+el.id).children().first().addClass('ft-button-'+el.id+'-active'); 75 } 76 77 odd = 1; 78 // creating bars 79 // and set their position 80 for(j=1; j < params.strips+1; j++){ 81 82 if( gap > 0){ 83 tstripWidth = stripWidth + 1; 84 gap--; 85 } else { 86 tstripWidth = stripWidth; 87 } 88 89 if(params.links) 90 $('#'+el.id).append("<a href='"+links[el.id][0]+"' class='ft-"+el.id+"' id='ft-"+el.id+j+"' style='width:"+tstripWidth+"px; height:"+params.height+"px; float: left; position: absolute;outline:none;'></a>"); 91 else 92 $('#'+el.id).append("<div class='ft-"+el.id+"' id='ft-"+el.id+j+"' style='width:"+tstripWidth+"px; height:"+params.height+"px; float: left; position: absolute;'></div>"); 93 94 // positioning bars 95 $("#ft-"+el.id+j).css({ 96 'background-position': -stripLeft +'px top', 97 'left' : stripLeft 98 }); 99 100 stripLeft += tstripWidth; 101 102 if(params.position == 'bottom') 103 $("#ft-"+el.id+j).css( 'bottom', 0 ); 104 105 if (j%2 == 0 && params.position == 'alternate') 106 $("#ft-"+el.id+j).css( 'bottom', 0 ); 107 108 // bars order 109 // fountain 110 if(params.direction == 'fountain' || params.direction == 'fountainAlternate'){ 111 order[el.id][j-1] = parseInt(params.strips/2) - (parseInt(j/2)*odd); 112 order[el.id][params.strips-1] = params.strips; // fix for odd number of bars 113 odd *= -1; 114 } else { 115 // linear 116 order[el.id][j-1] = j; 117 } 118 119 } 120 121 $('.ft-'+el.id).mouseover(function(){ 122 opts[el.id].pause = true; 123 }); 124 125 $('.ft-'+el.id).mouseout(function(){ 126 opts[el.id].pause = false; 127 }); 128 129 $('#ft-title-'+el.id).mouseover(function(){ 130 opts[el.id].pause = true; 131 }); 132 133 $('#ft-title-'+el.id).mouseout(function(){ 134 opts[el.id].pause = false; 135 }); 136 137 clearInterval(imgInt[el.id]); 138 imgInt[el.id] = setInterval(function() { $.transition(el) }
138, params.delay+params.stripDelay*params.strips); 139 140 }; 141 142 // transition 143 $.transition = function(el,direction){ 144 145 if(opts[el.id].pause == true) return; 146 147 stripInt[el.id] = setInterval(function() { $.strips(order[el.id][inc[el.id]], el) },opts[el.id].stripDelay); 148 149 $('#'+el.id).css({ 'background-image': 'url('+img[el.id][imgInc[el.id]]+')' }); 150 151 if(typeof(direction) == "undefined") 152 imgInc[el.id]++; 153 else 154 if(direction == 'prev') 155 imgInc[el.id]--; 156 else 157 imgInc[el.id] = direction; 158 159 if (imgInc[el.id] == img[el.id].length) { 160 imgInc[el.id] = 0; 161 } 162 163 if (imgInc[el.id] == -1){ 164 imgInc[el.id] = img[el.id].length-1; 165 } 166 167 if(titles[el.id][imgInc[el.id]]!=''){ 168 $('#ft-title-'+el.id).animate({ opacity: 0 }, opts[el.id].titleSpeed, function(){ 169 $(this).html(titles[el.id][imgInc[el.id]]).animate({ opacity: opts[el.id].titleOpacity }, opts[el.id].titleSpeed); 170 }); 171 } else { 172 $('#ft-title-'+el.id).animate({ opacity: 0}, opts[el.id].titleSpeed); 173 } 174 175 inc[el.id] = 0; 176 177 buttons = $('#ft-buttons-'+el.id).children(); 178 179 buttons.each(function(index){ 180 if(index == imgInc[el.id]){ 181 $(this).addClass('ft-button-'+el.id+'-active'); 182 } else{ 183 $(this).removeClass('ft-button-'+el.id+'-active'); 184 } 185 }); 186 187 if(opts[el.id].direction == 'random') 188 $.fisherYates (order[el.id]); 189 190 if((opts[el.id].direction == 'right' && order[el.id][0] == 1) 191 || opts[el.id].direction == 'alternate' 192 || opts[el.id].direction == 'fountainAlternate') 193 order[el.id].reverse(); 194 }; 195 196 197 // strips animations 198 $.strips = function(itemId, el){ 199 200 temp = opts[el.id].strips; 201 if (inc[el.id] == temp) { 202 clearInterval(stripInt[el.id]); 203 return; 204 } 205 $('.ft-'+el.id).attr('href',links[el.id][imgInc[el.id]]); 206 if(opts[el.id].position == 'curtain'){ 207 currWidth = $('#ft-'+el.id+itemId).width(); 208 $('#ft-'+el.id+itemId).css({ width: 0, opacity: 0, 'background-image': 'url('+img[el.id][imgInc[el.id]]+')' }); 209 $('#ft-'+el.id+itemId).animate({ width: currWidth, opacity: 1 }, 1000); 210 } else { 211 $('#ft-'+el.id+itemId).css({ height: 0, opacity: 0, 'background-image': 'url('+img[el.id][imgInc[el.id]]+')' }); 212 $('#ft-'+el.id+itemId).animate({ height: opts[el.id].height, opacity: 1 }, 1000); 213 } 214 215 inc[el.id]++; 216 217 }; 218 219 // navigation 220 $.navigation = function(el){ 221 // create prev and next 222 $('#'+el.id).append("<a href='#' id='ft-prev-"+el.id+"' class='ft-prev'>prev</a>"); 223 $('#'+el.id).append("<a href='#' id='ft-next-"+el.id+"' class='ft-next'>next</a>"); 224 $('#ft-prev-'+el.id).css({ 225 'position' : 'absolute', 226 'top' : params.height/2 - 15, 227 'left' : 0, 228 'z-index' : 1001, 229 'line-height': '30px', 230 'opacity' : 0.7 231 }).click( function(e){ 232 e.preventDefault(); 233 $.transition(el,'prev'); 234 clearInterval(imgInt[el.id]); 235 imgInt[el.id] = setInterval(function() { $.transition(el) }, params.delay+params.stripDelay*params.strips); 236 }); 237 238 $('#ft-next-'+el.id).css({ 239 'position' : 'absolute', 240 'top' : params.height/2 - 15, 241 'right' : 0, 242 'z-index' : 1001, 243 'line-height': '30px', 244 'opacity' : 0.7 245 }).click( function(e){ 246 e.preventDefault(); 247 $.transition(el); 248 clearInterval(imgInt[el.id]); 249 imgInt[el.id] = setInterval(function() { $.transition(el) }, params.delay+params.stripDelay*params.strips); 250 }); 251 252 // image buttons 253 $("<div id='ft-buttons-"+el.id+"'></div>").insertAfter($('#'+el.id)); 254 $('#ft-buttons-'+el.id).css({ 255 'text-align' : 'left', 256 'padding-top' : 5, 257 'width' : opts[el.id].width 258 }); 259 for(k=1;k<img[el.id].length+1;k++){ 260 $('#ft-buttons-'+el.id).append("<a href='#' class='ft-button-"+el.id+"'>"+k+"</a> "); 261 } 262 $('.ft-button-'+el.id).css({ 263 'padding' : 5 264 }); 265 266 $.each($('.ft-button-'+el.id), function(i,item){ 267 $(item).click( function(e){ 268 e.preventDefault(); 269 $.transition(el,i); 270 clearInterval(imgInt[el.id]); 271 imgInt[el.id] = setInterval(function() { $.transition(el) }
271, params.delay+params.stripDelay*params.strips); 272 }) 273 }); 274 } 275 276 277 278 // shuffle array function 279 $.fisherYates = function(arr) { 280 var i = arr.length; 281 if ( i == 0 ) return false; 282 while ( --i ) { 283 var j = Math.floor( Math.random() * ( i + 1 ) ); 284 var tempi = arr[i]; 285 var tempj = arr[j]; 286 arr[i] = tempj; 287 arr[j] = tempi; 288 } 289 } 290 291 this.each ( 292 function(){ init(this); } 293 ); 294 295}; 296 297 // default values 298 $.fn.jqFancyTransitions.defaults = { 299 width: 420, // width of panel 300 height: 252, // height of panel 301 strips: 10, // number of strips 302 delay: 5000, // delay between images in ms 303 stripDelay: 50, // delay beetwen strips in ms 304 titleOpacity: 0.7, // opacity of title 305 titleSpeed: 1000, // speed of title appereance in ms 306 position: 'top', // top, bottom, alternate, curtain 307 direction: 'left', // left, right, alternate, random, fountain, fountainAlternate 308 effect: '', // curtain, zipper, wave 309 navigation: false, // prev next and buttons 310 links : false // show images as links 311 }; 312 313})(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.