1/** 2* simplePagination.js v1.6 3* A simple jQuery pagination plugin. 4* http://flaviusmatis.github.com/simplePagination.js/ 5* 6* Copyright 2012, Flavius Matis 7* Released under the MIT license. 8* http://flaviusmatis.github.com/license.html 9*/ 10 11(function ($) { 12 13 var methods = { 14 init: function (options) { 15 var o = $.extend({ 16 items: 1, 17 itemsOnPage: 1, 18 pages: 0, 19 displayedPages: 5, 20 edges: 2, 21 currentPage: 1, 22 hrefTextPrefix: '#page-', 23 hrefTextSuffix: '', 24 prevText: 'Prev', 25 nextText: 'Next', 26 ellipseText: '…', 27 cssStyle: 'light-theme', 28 selectOnClick: true, 29 onPageClick: function (pageNumber, event) { 30 // Callback triggered when a page is clicked 31 // Page number is given as an optional parameter 32 }, 33 onInit: function () { 34 // Callback triggered immediately after initialization 35 } 36 }, options || {}); 37 38 var self = this; 39 40 o.pages = o.pages ? o.pages : Math.ceil(o.items / o.itemsOnPage) ? Math.ceil(o.items / o.itemsOnPage) : 1; 41 o.currentPage = o.currentPage - 1; 42 o.halfDisplayed = o.displayedPages / 2; 43 44 this.each(function () { 45 self.addClass(o.cssStyle + ' simple-pagination').data('pagination', o); 46 methods._draw.call(self); 47 }); 48 49 o.onInit(); 50 51 return this; 52 }, 53 54 selectPage: function (page) { 55 56 methods._selectPage.call(this, page - 1); 57 return this; 58 }, 59 60 prevPage: function () { 61 var o = this.data('pagination'); 62 if (o.currentPage > 0) { 63 methods._selectPage.call(this, o.currentPage - 1); 64 } 65 return this; 66 }, 67 68 nextPage: function () { 69 var o = this.data('pagination'); 70 if (o.currentPage < o.pages - 1) { 71 methods._selectPage.call(this, o.currentPage + 1); 72 } 73 return this; 74 }, 75 76 getPagesCount: function () { 77 return this.data('pagination').pages; 78 }, 79 80 getCurrentPage: function () { 81 return this.data('pagination').currentPage + 1; 82 }, 83 84 destroy: function () { 85 this.empty(); 86 return this; 87 }, 88 89 redraw: function () { 90 methods._draw.call(this); 91 return this; 92 }, 93 94 disable: function () { 95 var o = this.data('pagination'); 96 o.disabled = true; 97 this.data('pagination', o); 98 methods._draw.call(this); 99 return this; 100 }, 101 102 enable: function () { 103 var o = this.data('pagination'); 104 o.disabled = false; 105 this.data('pagination', o); 106 methods._draw.call(this); 107 return this; 108 }, 109 110 updateItems: function (newItems) { 111 var o = this.data('pagination'); 112 o.items = newItems; 113 o.pages = Math.ceil(o.items / o.itemsOnPage) ? Math.ceil(o.items / o.itemsOnPage) : 1; 114 this.data('pagination', o); 115 methods._draw.call(this); 116 }, 117 118 _draw: function () { 119 var o = this.data('pagination'), 120 interval = methods._getInterval(o), 121 i; 122 123 methods.destroy.call(this); 124 125 var $panel = this.prop("tagName") === "UL" ? this : $('<ul></ul>').appendTo(this); 126 127 // Generate Prev link 128 if (o.prevText) { 129 methods._appendItem.call(this, o.currentPage - 1, { text: o.prevText, classes: 'prev' }); 130 } 131 132 // Generate start edges 133 if (interval.start > 0 && o.edges > 0) { 134 var end = Math.min(o.edges, interval.start); 135 for (i = 0; i < end; i++) { 136 methods._appendItem.call(this, i); 137 } 138 if (o.edges < interval.start && (interval.start - o.edges != 1)
138) { 139 $panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>'); 140 } else if (interval.start - o.edges == 1) { 141 methods._appendItem.call(this, o.edges); 142 } 143 } 144 145 // Generate interval links 146 for (i = interval.start; i < interval.end; i++) { 147 methods._appendItem.call(this, i); 148 } 149 150 // Generate end edges 151 if (interval.end < o.pages && o.edges > 0) { 152 if (o.pages - o.edges > interval.end && (o.pages - o.edges - interval.end != 1)) { 153 $panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>'); 154 } else if (o.pages - o.edges - interval.end == 1) { 155 methods._appendItem.call(this, interval.end++); 156 } 157 var begin = Math.max(o.pages - o.edges, interval.end); 158 for (i = begin; i < o.pages; i++) { 159 methods._appendItem.call(this, i); 160 } 161 } 162 163 // Generate Next link 164 if (o.nextText) { 165 methods._appendItem.call(this, o.currentPage + 1, { text: o.nextText, classes: 'next' }); 166 } 167 }, 168 169 _getInterval: function (o) { 170 return { 171 start: Math.ceil(o.currentPage > o.halfDisplayed ? Math.max(Math.min(o.currentPage - o.halfDisplayed, (o.pages - o.displayedPages)), 0) : 0), 172 end: Math.ceil(o.currentPage > o.halfDisplayed ? Math.min(o.currentPage + o.halfDisplayed, o.pages) : Math.min(o.displayedPages, o.pages)) 173 }; 174 }, 175 176 _appendItem: function (pageIndex, opts) { 177 var self = this, options, $link, o = self.data('pagination'), $linkWrapper = $('<li></li>'), $ul = self.find('ul'); 178 179 pageIndex = pageIndex < 0 ? 0 : (pageIndex < o.pages ? pageIndex : o.pages - 1); 180 181 options = $.extend({ 182 text: pageIndex + 1, 183 classes: '' 184 }, opts || {}); 185 186 if (pageIndex == o.currentPage || o.disabled) { 187 if (o.disabled) { 188 $linkWrapper.addClass('disabled'); 189 } else { 190 $linkWrapper.addClass('active'); 191 } 192 $link = $('<a href="' + o.hrefTextPrefix + (pageIndex + 1) + o.hrefTextSuffix + '" class="page-link current">' + (options.text) + '</a>'); 193 //$link = $('<span class="current">' + (options.text) + '</span>'); 194 } else { 195 $link = $('<a href="' + o.hrefTextPrefix + (pageIndex + 1) + o.hrefTextSuffix + '" class="page-link">' + (options.text) + '</a>'); 196 $link.click(function (event) { 197 return methods._selectPage.call(self, pageIndex, event); 198 }); 199 } 200 201 if (options.classes) { 202 $link.addClass(options.classes); 203 } 204 205 $linkWrapper.append($link); 206 207 if ($ul.length) { 208 $ul.append($linkWrapper); 209 } else { 210 self.append($linkWrapper); 211 } 212 }, 213 214 _selectPage: function (pageIndex, event) { 215 debugger; 216 // alert("hi" + pageIndex + event); 217 var o = this.data('pagination'); 218 o.currentPage = pageIndex; 219 if (o.selectOnClick) { 220 methods._draw.call(this); 221 } 222 return o.onPageClick(pageIndex + 1); 223 224 //return onPageClick(pageIndex + 1); 225 } 226 227 }; 228 229 $.fn.pagination = function (method) { 230 //alert("hi"); 231 232 // Method calling logic 233 if (methods[method] && method.charAt(0) != '_') { 234 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 235 } else if (typeof method === 'object' || !method) { 236 return methods.init.apply(this, arguments); 237 } else { 238 $.error('Method ' + method + ' does not exist on jQuery.pagination'); 239 } 240 241 }; 242 243})(jQuery); 244 245$(".qr_arrow").click(function () { 246 $(".qr_outer").addClass("display_no") 247}); 248 249function qrcod() { 250 $(".qr_outer").removeClass("display_no") 251}
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.