PageSourceSearch

https://khaniyabasmun.gov.np/sites/all/themes/newmun/js/vendor/easypaginate/jquery.easyPaginate.js?tfhzgo

js khaniyabasmun.gov.np collected 2026-10-02 22:08:11 UTC 9,333 bytes, 230 lines download raw bytes

1/*
2* jQuery easyShare plugin
3* Update on 04 april 2017
4* Version 1.2
5*
6* Licensed under GPL <http://en.wikipedia.org/wiki/GNU_General_Public_License>
7* Copyright (c) 2008, St?hane Litou <[email protected]>
8* All rights reserved.
9*
10    This program is free software: you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation, either version 3 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program.  If not, see <http://www.gnu.org/licenses/>.
22*/
23
24(function($){
25$.fn.easyPaginate = function (options) {
26    var defaults = {
27        paginateElement: 'li',
28        hashPage: 'page',
29        elementsPerPage: 10,
30        effect: 'default',
31        slideOffset: 200,
32        firstButton: true,
33        firstButtonText: '<<',
34        lastButton: true,
35        lastButtonText: '>>',        
36        prevButton: true,
37        prevButtonText: '<',        
38        nextButton: true,
39        nextButtonText: '>'
40    }
41        
42    return this.each (function (instance) {        
43        
44        var plugin = {};
45        plugin.el = $(this);
46        plugin.el.addClass('easyPaginateList');
47
48        plugin.settings = {
49            pages: 0,
50            objElements: Object,
51            currentPage: 1
52        }
53        
54        var getNbOfPages = function() {
55            return Math.ceil(plugin.settings.objElements.length / plugin.settings.elementsPerPage);         
56        };
57        
58        var displayNav = function() {
59            htmlNav = '<div class="easyPaginateNav">';
60            
61            if(plugin.settings.firstButton) {
62                htmlNav += '<a href="#'+plugin.settings.hashPage+':1" title="First page" rel="1" class="first">'+plugin.settings.firstButtonText+'</a>';
63            }
64            
65            if(plugin.settings.prevButton) {
66                htmlNav += '<a href="" title="Previous" rel="" class="prev">'+plugin.settings.prevButtonText+'</a>';
67            }
68            
69            for(i = 1;i <= plugin.settings.pages;i++) {
70                htmlNav += '<a href="#'+plugin.settings.hashPage+':'+i+'" title="Page '+i+'" rel="'+i+'" class="page">'+i+'</a>';
71            };
72            
73            if(plugin.settings.nextButton) {
74                htmlNav += '<a href="" title="Next" rel="" class="next">'+plugin.settings.nextButtonText+'</a>';
75            }
76            
77            if(plugin.settings.lastButton) {
78                htmlNav += '<a href="#'+plugin.settings.hashPage+':'+plugin.settings.pages+'" title="Last page" rel="'+plugin.settings.pages+'" class="last">'+plugin.settings.lastButtonText+'</a>';
79            }
80            
81            htmlNav += '</div>';
82            plugin.nav = $(htmlNav);
83            plugin.nav.css({
84                'width': plugin.el.width()
85            });
86            plugin.el.after(plugin.nav);
87
88            var elSelector = '#' + plugin.el.get(0).id + ' + ';
89            $(elSelector + ' .easyPaginateNav a.page,'
90                + elSelector + ' .easyPaginateNav a.first,'
91                + elSelector + ' .easyPaginateNav a.last').on('click', function(e) {
92                e.preventDefault();
93                displayPage($(this).attr('rel'));                
94            });
95
96            $(elSelector + ' .easyPaginateNav a.prev').on('click', function(e) {
97                e.preventDefault();
98                page = plugin.settings.currentPage > 1?parseInt(plugin.settings.currentPage) - 1:1;
99                displayPage(page);
100            });
101
102            $(elSelector + ' .easyPaginateNav a.next').on('click', function(e) {
103                e.preventDefault();
104                page = plugin.settings.currentPage < plugin.settings.pages?parseInt(plugin.settings.currentPage) + 1:plugin.settings.pages;
105                displayPage(page);
106            });
107        };
108        
109        var displayPage = function(page, forceEffect) {
110            if(plugin.settings.currentPage != page) {
111                plugin.settings.currentPage = parseInt(page);
112                offsetStart = (page - 1) * plugin.settings.elementsPerPage;
113                offsetEnd = page * plugin.settings.elementsPerPage;
114                if(typeof(forceEffect) != 'undefined') {
115                    eval("transition_"+forceEffect+"("+offsetStart+", "+offsetEnd+")");
116                }else {
117                    eval("transition_"+plugin.settings.effect+"("+offsetStart+", "+offsetEnd+")");
118                }
119                
120                plugin.nav.find('.current').removeClass('current');
121                plugin.nav.find('a.page:eq('+(page - 1)+')').addClass('current');
122                
123                switch(plugin.settings.currentPage) {
124                    case 1:
125                        $('.easyPaginateNav a', plugin).removeClass('disabled');
126                        $('.easyPaginateNav a.first, .easyPaginateNav a.prev', plugin).addClass('disabled');
127                        break;
128                    case plugin.settings.pages:
129                        $('.easyPaginateNav a', plugin).removeClass('disabled');
130                        $('.easyPaginateNav a.last, .easyPaginateNav a.next', plugin).addClass('disabled');
131                        break;
132                    default:
133                        $('.easyPaginateNav a', plugin).removeClass('disabled');
134                        break;
135                }
136            }
137        };
138        
139        var transition_default = function(offsetStart, offsetEnd) {
140            plugin.currentElements.hide();
141            plugin.currentElements = plugin.settings.objElements.slice(offsetStart, offsetEnd).clone();
142            plugin.el.html(plugin.currentElements);
143            plugin.currentElements.show();
144        };
145        
146        var transition_fade = function(offsetStart, offsetEnd) {
147            plugin.currentElements.fadeOut();
148            plugin.currentElements = plugin.settings.objElements.slice(offsetStart, offsetEnd).clone();
149            plugin.el.html(plugin.currentElements);
150            plugin.currentElements.fadeIn();
151        };
152        
153        var transition_slide = function(offsetStart, offsetEnd) {
154            plugin.currentElements.animate({
155                'margin-left': plugin.settings.slideOffset * -1,
156                'opacity': 0
157            }, function() {
158                $(this).remove();
159            });
160            
161            plugin.currentElements = plugin.settings.objElements.slice(offsetStart, offsetEnd).clone();
162            plugin.currentElements.css({
163                'margin-left': plugin.settings.slideOffset,
164                'display': 'block',
165                'opacity': 0,
166                'min-width': plugin.el.width() / 2
167            });
168            plugin.el.html(plugin.currentElements);
169            plugin.currentElements.animate({
170                'margin-left': 0,
171                'opacity': 1
172            });
173        };
174                
175        var transition_climb = function(offsetStart, offsetEnd) {            
176            plugin.currentElements.each(function(i) {
177                var $objThis = $(this);
178                setTimeout(function() {
179                    $objThis.animate({
180                        'margin-left': plugin.settings.slideOffset * -1,
181                        'opacity': 0
182                    }, function() {
183                        $(this).remove();
184                    });
185                }, i * 200);
186            });
187            
188            plugin.currentElements = plugin.settings.objElements.slice(offsetStart, offsetEnd).clone();
189            plugin.currentElements.css({
190                'margin-left': plugin.settings.slideOffset,
191                'display': 'block',
192                'opacity': 0,
193                'min-width': plugin.el.width() / 2
194            });
195            plugin.el.html(plugin.currentElements);
196            plugin.currentElements.each(function(i) {
197                var $objThis = $(this);
198                setTimeout(function() {
199                    $objThis.animate({
200                        'margin-left': 0,
201                        'opacity': 1
202                    });
203                }, i * 200);
204            });
205        };
206                
207        plugin.settings = $.extend({}, defaults, options);
208        
209        plugin.currentElements = $([]);
210        plugin.settings.objElements = plugin.el.find(plugin.settings.paginateElement);
211        plugin.settings.pages = getNbOfPages();
212        if(plugin.settings.pages > 1) {
213            plugin.el.html();
214    
215            // Here we go
216            displayNav();
217            
218            page = 1;
219            if(document.location.hash.indexOf('#'+plugin.settings.hashPage+':') != -1) {
220                page = parseInt(document.location.hash.replace('#'+plugin.settings.hashPage+':', ''));
221                if(page.length <= 0 || page < 1 || page > plugin.settings.pages) {
222                    page = 1;
223                }
224            }
225            
226            displayPage(page, 'default');
227        }
228    });
229};
230})(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.