1/* 2 * Easy Paginate 1.0 - jQuery plugin 3 * written by Alen Grakalic 4 * http://cssglobe.com/ 5 * 6 * Copyright (c) 2011 Alen Grakalic (http://cssglobe.com) 7 * Dual licensed under the MIT (MIT-LICENSE.txt) 8 * and GPL (GPL-LICENSE.txt) licenses. 9 * 10 * Built for jQuery library 11 * http://jquery.com 12 * 13 */ 14 15(function($) { 16 17 $.fn.easyPaginate = function(options){ 18 19 var defaults = { 20 step: 1, 21 delay: 10, 22 numeric: true, 23 nextprev: false, 24 auto:false, 25 pause:4000, 26 clickstop:true, 27 controls: 'pagination', 28 current: 'sel' 29 }; 30 31 var options = $.extend(defaults, options); 32 var step = options.step; 33 var lower, upper; 34 var children = $(this).children(); 35 var count = children.length; 36 var obj, next, prev; 37 var page = 1; 38 var timeout; 39 var clicked = false; 40 41 function show(){ 42 clearTimeout(timeout); 43 lower = ((page-1) * step); 44 upper = lower+step; 45 $(children).each(function(i){ 46 var child = $(this); 47 child.hide(); 48 if(i>=lower && i<upper){ setTimeout(function(){ child.fadeIn('fast') }, ( i-( Math.floor(i/step) * step) )*options.delay ); } 49 if(options.nextprev){ 50 if(upper >= count) { next.fadeOut('fast'); } else { next.fadeIn('fast'); }; 51 if(lower >= 1) { prev.fadeIn('fast'); } else { prev.fadeOut('fast'); }; 52 }; 53 }); 54 $('li','#'+ options.controls).removeClass(options.current); 55 $('li[data-index="'+page+'"]','#'+ options.controls).addClass(options.current); 56 57 if(options.auto){ 58 if(options.clickstop && clicked){}else{ timeout = setTimeout(auto,options.pause); }; 59 }; 60 }; 61 62 function auto(){ 63 if(upper <= count){ page++; show(); } 64 }; 65 66 this.each(function(){ 67 68 obj = this; 69 70 if(count>step){ 71 72 var pages = Math.floor(count/step); 73 if((count/step) > pages) pages++; 74 75 var ol = $('<ol id="'+ options.controls +'"></ol>').insertAfter(obj); 76 77 if(options.nextprev){ 78 prev = $('<li class="prev">Previous</li>') 79 .hide() 80 .appendTo(ol) 81 .click(function(){ 82 clicked = true; 83 page--; 84 show(); 85 }); 86 }; 87 88 if(options.numeric){ 89 for(var i=1;i<=pages;i++){ 90 $('<li data-index="'+ i +'">'+ i +'</li>') 91 .appendTo(ol) 92 .click(function(){ 93 clicked = true; 94 page = $(this).attr('data-index'); 95 show(); 96 }); 97 }; 98 }; 99 100 if(options.nextprev){ 101 next = $('<li class="next">Next</li>') 102 .hide() 103 .appendTo(ol) 104 .click(function(){ 105 clicked = true; 106 page++; 107 show(); 108 }); 109 }; 110 111 show(); 112 }; 113 }); 114 115 }; 116 117})(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.