PageSourceSearch

https://www.fx110.com.tw/Scripts/glup/kkpager/kkpager.js?v=

js fx110.com.tw collected 2026-10-08 09:23:30 UTC 34,915 bytes, 741 lines download raw bytes

1/*
2  kkpager V1.3
3  https://github.com/pgkk/kkpager
4
5  Copyright (c) 2013 [email protected]
6  Licensed under the GNU GENERAL PUBLIC LICENSE
7*/
8//<link href="~/style/kkpager_blue.css" rel="stylesheet" />
9//if (!document.getElementById('kkpagecss')) {
10//    var js = document.createElement('link');
11//    js.href = '/style/kkpager_blue.min.css';
12//    js.id = 'kkpagecss';
13//    js.rel = 'stylesheet';
14//    document.body.appendChild(js);
15//}
16
17var kkpager = {
18    type: '', //多个导航栏 单独点击的方法
19    pagerid: 'kkpager', //divID
20    mode: 'link', //模式(link 或者 click)
21    pno: 1, //当前页码
22    total: 1, //总页码
23    totalRecords: 0, //总数据条数
24    isShowPages:7, //显示几页
25    isShowFirstPageBtn: true, //是否显示首页按钮
26    isShowLastPageBtn: true, //是否显示尾页按钮
27    isShowPrePageBtn: true, //是否显示上一页按钮
28    isShowNextPageBtn: true, //是否显示下一页按钮
29    isShowTotalPage: false, //是否显示总页数
30    isShowCurrPage: false,//是否显示当前页
31    isShowTotalRecords: false, //是否显示总记录数
32    isGoPage: false, //是否显示页码跳转输入框
33    isWrapedPageBtns: true,	//是否用span包裹住页码按钮
34    isWrapedInfoTextAndGoPageBtn: true, //是否用span包裹住分页信息和跳转按钮
35    hrefFormer: '', //链接前部
36    hrefLatter: '', //链接尾部
37    gopageWrapId: 'kkpager_gopage_wrap',
38    gopageButtonId: 'kkpager_btn_go',
39    gopageTextboxId: 'kkpager_btn_go_input',
40    lang: {
41        firstPageText: '首頁',
42        firstPageTipText: '首頁',
43        lastPageText: '尾頁',
44        lastPageTipText: '尾頁',
45        prePageText: '上一頁',
46        prePageTipText: '上一頁',
47        nextPageText: '下一頁',
48        nextPageTipText: '下一頁',
49        totalPageBeforeText: '共',
50        totalPageAfterText: '頁',
51        currPageBeforeText: '當前第',
52        currPageAfterText: '頁',
53        totalInfoSplitStr: '/',
54        totalRecordsBeforeText: '共',
55        totalRecordsAfterText: '條數據',
56        gopageBeforeText: '&nbsp;轉到',
57        gopageButtonOkText: '確定',
58        gopageAfterText: '頁',
59        buttonTipBeforeText: '第',
60        buttonTipAfterText: '頁'
61    },
62    //链接算法(当处于link模式),参数n为页码
63    getLink: function (n) {
64        //这里的算法适用于比如:
65        //hrefFormer=http://www.xx.com/news/20131212
66        //hrefLatter=.html
67        //那么首页(第1页)就是http://www.xx.com/news/20131212.html
68        //第2页就是http://www.xx.com/news/20131212_2.html
69        //第n页就是http://www.xx.com/news/20131212_n.html
70        if (n == 1) {
71            return this.hrefFormer + this.hrefLatter;
72        }
73        return this.hrefFormer + '_' + n + this.hrefLatter;
74    },
75    //页码单击事件处理函数(当处于mode模式),参数n为页码
76    click: function (n) {
77        //这里自己实现
78        //这里可以用this或者kkpager访问kkpager对象
79        return false;
80    },
81    //获取href的值(当处于mode模式),参数n为页码
82    getHref: function (n) {
83        //默认返回'javascript:;'
84        return 'javascript:;';
85    },
86    //跳转框得到输入焦点时
87    focus_gopage: function () {
88        var btnGo = $('#' + this.gopageButtonId);
89        $('#' + this.gopageTextboxId).attr('hideFocus', true);
90        btnGo.show();
91        btnGo.css('left', '10px');
92        $('#' + this.gopageTextboxId).addClass('focus');
93        btnGo.animate({ left: '+=41' }, 50);
94    },
95    //跳转框失去输入焦点时
96    blur_gopage: function () {
97        var _this = this;
98        setTimeout(function () {
99            var btnGo = $('#' + _this.gopageButtonId);
100            btnGo.animate({
101                left: '-=25'
102            }, 100, function () {
103                btnGo.hide();
104                $('#' + _this.gopageTextboxId).removeClass('focus');
105            });
106        }, 400);
107    },
108    //跳转输入框按键操作
109    keypress_gopage: function () {
110        var event = arguments[0] || window.event;
111        var code = event.keyCode || event.charCode;
112        //delete key
113        if (code == 8) return true;
114        //enter key
115        if (code == 13) {
116            kkpager.gopage();
117            return false;
118        }
119        //copy and paste
120        if (event.ctrlKey && (code == 99 || code == 118)) return true;
121        //only number key
122        if (code < 48 || code > 57) return false;
123        return true;
124    },
125    //跳转框页面跳转
126    gopage: function () {
127        var str_page = $('#' + this.gopageTextboxId).val();
128        if (isNaN(str_page)) {
129            $('#' + this.gopageTextboxId).val(this.next);
130            return;
131        }
132        var n = parseInt(str_page);
133        if (n < 1) n = 1;
134        if (n > this.total) n = this.total;
135        if (this.mode == 'click') {
136            this._clickHandler(n, '{total:' + this.total + ',pagerid:\'' + this.pagerid + '\'}');
137        } else {
138            window.location = this.getLink(n);
139        }
140    },
141    //不刷新页面直接手动调用选中某一页码
142    selectPage: function (n) {
143        this._config['pno'] = n;
144        this.generPageHtml(this._config, true);
145    },
146    //生成控件代码
147    generPageHtml: function (config, enforceInit) {
148        if (enforceInit || !this.inited) {
149            this.init(config);
150        }
151
152        var str_first = '', str_prv = '', str_next = '', str_last = '';
153        if (this.isShowFirstPageBtn) {
154            if (this.hasPrv) {
155                str_first = '<a ' + this._getHandlerStr(1) + ' title="'
156                    + (this.lang.firstPageTipText || this.lang.firstPageText) + '">' + this.lang.firstPageText + '</a>';
157            } else {
158                str_first = '<span class="disabled">' + this.lang.firstPageText + '</span>';
159            }
160        }
161        if (this.isShowPrePageBtn) {
162            if (this.hasPrv) {
163                str_prv = '<a ' + this._getHandlerStr(this.prv) + ' title="'
164                    + (this.lang.prePageTipText || this.lang.prePageText) + '">' + this.lang.prePageText + '</a>';
165            } else {
166                str_prv = '<span class="disabled">' + this.lang.prePageText + '</span>';
167            }
168        }
169        if (this.isShowNextPageBtn) {
170            if (this.hasNext) {
171                str_next = '<a ' + this._getHandlerStr(this.next) + ' title="'
172                    + (this.lang.nextPageTipText || this.lang.nextPageText) + '">' + this.lang.nextPageText + '</a>';
173            } else {
174                str_next = '<span class="disabled">' + this.lang.nextPageText + '</span>';
175            }
176        }
177        if (this.isShowLastPageBtn) {
178            if (this.hasNext) {
179                str_last = '<a ' + this._getHandlerStr(this.total) + ' title="'
180                    + (this.lang.lastPageTipText || this.lang.lastPageText) + '">' + this.lang.lastPageText + '</a>';
181            } else {
182                str_last = '<span class="disabled">' + this.lang.lastPageText + '</span>';
183            }
184        }
185        var str = '';
186        var dot = '<span class="spanDot">...</span>';
187        var total_info = '<span class="totalText">';
188        var total_info_splitstr = '<span class="totalInfoSplitStr">
188' + this.lang.totalInfoSplitStr + '</span>';
189        if (this.isShowCurrPage) {
190            total_info += this.lang.currPageBeforeText + '<span class="currPageNum">' + this.pno + '</span>' + this.lang.currPageAfterText;
191            if (this.isShowTotalPage) {
192                total_info += total_info_splitstr;
193                total_info += this.lang.totalPageBeforeText + '<span class="totalPageNum">' + this.total + '</span>' + this.lang.totalPageAfterText;
194            } else if (this.isShowTotalRecords) {
195                total_info += total_info_splitstr;
196                total_info += this.lang.totalRecordsBeforeText + '<span class="totalRecordNum">' + this.totalRecords + '</span>' + this.lang.totalRecordsAfterText;
197            }
198        } else if (this.isShowTotalPage) {
199            total_info += this.lang.totalPageBeforeText + '<span class="totalPageNum">' + this.total + '</span>' + this.lang.totalPageAfterText;;
200            if (this.isShowTotalRecords) {
201                total_info += total_info_splitstr;
202                total_info += this.lang.totalRecordsBeforeText + '<span class="totalRecordNum">' + this.totalRecords + '</span>' + this.lang.totalRecordsAfterText;
203            }
204        } else if (this.isShowTotalRecords) {
205            total_info += this.lang.totalRecordsBeforeText + '<span class="totalRecordNum">' + this.totalRecords + '</span>' + this.lang.totalRecordsAfterText;
206        }
207        total_info += '</span>';
208
209        var gopage_info = '';
210        if (this.isGoPage) {
211            gopage_info = '<span class="goPageBox">' + this.lang.gopageBeforeText + '<span id="' + this.gopageWrapId + '">' +
212                '<input type="button" id="' + this.gopageButtonId + '" onclick="kkpager.gopage()" value="'
213                    + this.lang.gopageButtonOkText + '" />' +
214                '<input type="text" id="' + this.gopageTextboxId + '" onfocus="kkpager.focus_gopage()"  onkeypress="return kkpager.keypress_gopage(event);"   onblur="kkpager.blur_gopage()" value="' + this.next + '" /></span>' + this.lang.gopageAfterText + '</span>';
215        }
216
217        //分页处理
218        if (this.total <= 11) {
219            for (var i = 1; i <= this.total; i++) {
220                if (this.pno == i) {
221                    str += '<span class="curr">' + i + '</span>';
222                } else {
223                    str += '<a ' + this._getHandlerStr(i) + ' title="'
224                        + this.lang.buttonTipBeforeText + i + this.lang.buttonTipAfterText + '">' + i + '</a>';
225                }
226            }
227        } else {
228            if (this.pno <= 5) {
229                for (var i = 1; i <= this.isShowPages; i++) {
230                    if (this.pno == i) {
231                        str += '<span class="curr">' + i + '</span>';
232                    } else {
233                        str += '<a ' + this._getHandlerStr(i) + ' title="' +
234                            this.lang.buttonTipBeforeText + i + this.lang.buttonTipAfterText + '">' + i + '</a>';
235                    }
236                }
237                str += dot;
238            } else {
239                str += '<a ' + this._getHandlerStr(1) + ' title="'
240                    + this.lang.buttonTipBeforeText + '1' + this.lang.buttonTipAfterText + '">1</a>';
241                str += '<a ' + this._getHandlerStr(2) + ' title="'
242                    + this.lang.buttonTipBeforeText + '2' + this.lang.buttonTipAfterText + '">2</a>';
243                str += dot;
244
245                var begin = this.pno - 2;
246                var end = this.pno + 2;
247                if (end > this.total) {
248                    end = this.total;
249                    begin = end - 4;
250                    if (this.pno - begin < 2) {
251                        begin = begin - 1;
252                    }
253                } else if (end + 1 == this.total) {
254                    end = this.total;
255                }
256                for (var i = begin; i <= end; i++) {
257                    if (this.pno == i) {
258                        str += '<span class="curr">' + i + '</span>';
259                    } else {
260                        str += '<a ' + this._getHandlerStr(i) + ' title="'
261                            + this.lang.buttonTipBeforeText + i + this.lang.buttonTipAfterText + '">' + i + '</a>';
262                    }
263                }
264                if (end != this.total) {
265                    str += dot;
266                }
267            }
268        }
269        var pagerHtml = '<div>';
270        if (this.isWrapedPageBtns) {
271            pagerHtml += '<span class="pageBtnWrap">' + str_first + str_prv + str + str_next + str_last + '</span>'
272        } else {
273            pagerHtml += str_first + str_prv + str + str_next + str_last;
274        }
275        if (this.isWrapedInfoTextAndGoPageBtn) {
276            pagerHtml += '<span class="infoTextAndGoPageBtnWrap">' + total_info + gopage_info + '</span>';
277        } else {
278            pagerHtml += total_info + gopage_info;
279        }
280        pagerHtml += '</div><div style="clear:both;"></div>';
281        $("#" + this.pagerid).html(pagerHtml);
282    },
283    //分页按钮控件初始化
284    init: function (config) {
285        this.type = config.type;
286        this.pno = isNaN(config.pno) ? 1 : parseInt(config.pno);
287        this.total = isNaN(config.total) ? 1 : parseInt(config.total);
288        this.totalRecords = isNaN(config.totalRecords) ? 0 : parseInt(config.totalRecords);
289        this.isShowPages = isNaN(config.isShowPages) ? 7 : parseInt(config.isShowPages);
290        if (config.pagerid) { this.pagerid = config.pagerid; }
291        if (config.mode) { this.mode = config.mode; }
292        if (config.gopageWrapId) { this.gopageWrapId = config.gopageWrapId; }
293        if (config.gopageButtonId) { this.gopageButtonId = config.gopageButtonId; }
294        if (config.gopageTextboxId) { this.gopageTextboxId = config.gopageTextboxId; }
295        if (config.isShowFirstPageBtn != undefined) { this.isShowFirstPageBtn = config.isShowFirstPageBtn; }
296        if (config.isShowLastPageBtn != undefined) { this.isShowLastPageBtn = config.isShowLastPageBtn; }
297        if (config.isShowPrePageBtn != undefined) { this.isShowPrePageBtn = config.isShowPrePageBtn; }
298        if (config.isShowNextPageBtn != undefined) { this.isShowNextPageBtn = config.isShowNextPageBtn; }
299        if (config.isShowTotalPage != undefined) { this.isShowTotalPage = config.isShowTotalPage; }
300        if (config.isShowCurrPage != undefined) { this.isShowCurrPage = config.isShowCurrPage; }
301        if (config.isShowTotalRecords != undefined) { this.isShowTotalRecords = config.isShowTotalRecords; }
302        if (config.isWrapedPageBtns) { this.isWrapedPageBtns = config.isWrapedPageBtns; }
303        if (config.isWrapedInfoTextAndGoPageBtn) { this.isWrapedInfoTextAndGoPageBtn = config.isWrapedInfoTextAndGoPageBtn; }
304        if (config.isGoPage != undefined) { this.isGoPage = config.isGoPage; }
305        if (config.lang) {
306            for (var key in config.lang) {
307                this.lang[key] = config.lang[key];
308            }
309        }
310        this.hrefFormer = config.hrefFormer || '';
311        this.hrefLatter = config.hrefLatter || '';
312        if (config.getLink && typeof (config.getLink) == 'function') { this.getLink = config.getLink; }
313        if (config.click && typeof (config.click) == 'function') { this.click = config.click; }
314        if (config.getHref && typeof (config.getHref) == 'function') { this.getHref = config.getHref; }
315
316
317
318        if (!this._config) {
319            this._config = config;
320        }
321        //validate
322        if (this.pno < 1) this.pno = 1;
323        this.total = (this.total <= 1) ? 1 : this.total;
324        if (this.pno > this.total) this.pno = this.total;
325        this.prv = (this.pno <= 2) ? 1 : (this.pno - 1);
326        this.next = (this.pno >= this.total - 1) ? this.total : (this.pno + 1);
327        this.hasPrv = (this.pno > 1);
328        this.hasNext = (this.pno < this.total);
329
330        this.inited = true;
331    },
332    _getHandlerStr: function (n) {
333        if (this.mode == 'click') {
334            return 'href="' + this.getHref(n) + '" onclick="return ' + this.type + '._clickHandler(' + n + ',{total:' + this.total + ',pagerid:\'' + this.pagerid + '\'})"';
335        }
336        //link模式,也是默认的
337        return 'href="' + this.getLink(n) + '"';
338    },
339    _clickHandler: function (n, config) {
340        var res = false;
341        if (this.click && typeof this.click == 'function') {
342            res = this.click.call(this, n, config) || false;
343        }
344        return res;
345    },
346    //复制一个新的kkpager 当做每个单独的kkpager用
347    //相当于new的意思
348    deepCopy: function () {
349        return this._deepCopy(this);
350    },
351    _deepCopy: function (kkpager) {
352        var result = {};
353        for (var key in kkpager) {
354            result[key] = typeof kkpager[key] === 'object' ? this._deepCopy(kkpager[key]) : kkpager[key];
355        }
356        return result;
357    }
358
359};
360
361// mode: 'link'  刷新页面
362//kkpager.generPageHtml({
363//    pagerid: "kkpager1", total: 4, pno: 4, isShowCurrPage: true, mode: 'link', click: function (n) {  this.selectPage(n, config);; return false; }
364//}, true);
365
366
367//mode: 'click'  无刷新页面 多个导航栏  在click 里面写ajax方法
368//实例   var的名字 要与 type 里面的一样
369//var a = kkpager.deepCopy();
370//var b = kkpager.deepCopy();
371//a.generPageHtml({
372//    type: "a", pagerid: "kkpager1", total: 4, pno: 4, isShowCurrPage: true, mode: 'click', click: function (n) {  this.selectPage(n, config);; return false; }
373//}, true);
374//b.generPageHtml({ type: "b", pagerid: "kkpager2", total: 5, pno: 5, isShowCurrPage: false, mode: 'click', click: function (n) {  this.selectPage(n, config);; return false; } }, true);
375
376
377var kkpagerNews = {
378    pagerid: 'kkpager', //divID
379    mode: 'link', //模式(link 或者 click)
380    pno: 1, //当前页码
381    total: 1, //总页码
382    totalRecords: 0, //总数据条数
383    isShowPages: 7, //显示几页
384    isJump: 6, //转跳几页
385    isJumpLen:5, //转跳
386    isShowFirstPageBtn: true, //是否显示首页按钮
387    isShowLastPageBtn: true, //是否显示尾页按钮
388    isShowPrePageBtn: true, //是否显示上一页按钮
389    isShowNextPageBtn: true, //是否显示下一页按钮
390    isShowTotalPage: false, //是否显示总页数
391    isShowCurrPage: true,//是否显示当前页
392    isShowTotalRecords: false, //是否显示总记录数
393    isGoPage: false,	//是否显示页码跳转输入框
394    isWrapedPageBtns: true,	//是否用span包裹住页码按钮
395    isWrapedInfoTextAndGoPageBtn: true, //是否用span包裹住分页信息和跳转按钮
396    isEllipsisLink: true,//是否省略号可点击
397    isShowLastPage: true,//是否显示最后一页页码
398    hrefFormer: '', //链接前部
399    hrefLatter: '', //链接尾部
400    gopageWrapId: 'kkpager_gopage_wrap',
401    gopageButtonId: 'kkpager_btn_go',
402    gopageTextboxId: 'kkpager_btn_go_input',
403    lang: {
404        firstPageText: '首頁',
405        firstPageTipText: '首頁',
406        lastPageText: '尾頁',
407        lastPageTipText: '尾頁',
408        prePageText: '上一頁',
409        prePageTipText: '上一頁',
410        nextPageText: '下一頁',
411        nextPageTipText: '下一頁',
412        totalPageBeforeText: '共',
413        totalPageAfterText: '頁',
414        currPageBeforeText: '當前第',
415        currPageAfterText: '頁',
416        totalInfoSplitStr: '/',
417        totalRecordsBeforeText: '共',
418        totalRecordsAfterText: '條數據',
419        gopageBeforeText: '&nbsp;轉到',
420        gopageButtonOkText: '確定',
421        gopageAfterText: '頁',
422        buttonTipBeforeText: '第',
423        buttonTipAfterText: '頁'
424    },
425    //链接算法(当处于link模式),参数n为页码
426    getLink: function (n) {
427        //这里的算法适用于比如:
428        //hrefFormer=http://www.xx.com/news/20131212
429        //hrefLatter=.html
430        //那么首页(第1页)就是http://www.xx.com/news/20131212.html
431        //第2页就是http://www.xx.com/news/20131212_2.html
432        //第n页就是http://www.xx.com/news/20131212_n.html
433        if (n == 1) {
434            return this.hrefFormer + this.hrefLatter;
435        }
436        return this.hrefFormer + '_' + n + this.hrefLatter;
437    },
438    //页码单击事件处理函数(当处于mode模式),参数n为页码
439    click: function (n) {
440        //这里自己实现
441        //这里可以用this或者kkpagerNews访问kkpagerNews对象
442        return false;
443    },
444    //获取href的值(当处于mode模式),参数n为页码
445    getHref: function (n) {
446        //默认返回'#'
447        return '#';
448    },
449    //跳转框得到输入焦点时
450    focus_gopage: function () {
451        var btnGo = $('#' + this.gopageButtonId);
452        $('#' + this.gopageTextboxId).attr('hideFocus', true);
453        btnGo.show();
454        btnGo.css('left', '10px');
455        $('#' + this.gopageTextboxId).addClass('focus');
456        btnGo.animate({ left: '+=30' }, 50);
457    },
458    //跳转框失去输入焦点时
459    blur_gopage: function () {
460        var _this = this;
461        setTimeout(function () {
462            var btnGo = $('#' + _this.gopageButtonId);
463            btnGo.animate({
464                left: '-=25'
465            }, 100, function () {
466                btnGo.hide();
467                $('#' + _this.gopageTextboxId).removeClass('focus');
468            });
469        }, 400);
470    },
471    //跳转输入框按键操作
472    keypress_gopage: function () {
473        var event = arguments[0] || window.event;
474        var code = event.keyCode || event.charCode;
475        //delete key
476        if (code == 8) return true;
477        //enter key
478        if (code == 13) {
479            kkpagerNews.gopage();
480            return false;
481        }
482        //copy and paste
483        if (event.ctrlKey && (code == 99 || code == 118)) return true;
484        //only number key
485        if (code < 48 || code > 57) return false;
486        return true;
487    },
488    //跳转框页面跳转
489    gopage: function () {
490        var str_page = $('#' + this.gopageTextboxId).val();
491        if (isNaN(str_page)) {
492            $('#' + this.gopageTextboxId).val(this.next);
493            return;
494        }
495        var n = parseInt(str_page);
496        if (n < 1) n = 1;
497        if (n > this.total) n = this.total;
498        if (this.mode == 'click') {
499            this._clickHandler(n, '{total:' + this.total + ',pagerid:\'' + this.pagerid + '\'}');
500        } else {
501            window.location = this.getLink(n);
502        }
503    },
504    //不刷新页面直接手动调用选中某一页码
505    selectPage: function (n, config) {
506        this._config['pno'] = n;
507        this._config['total'] = config.total;
508        this._config['pagerid'] = config.pagerid;
509        this.generPageHtml(this._config, true);
510    },
511    //生成控件代码
512    generPageHtml: function (config, enforceInit) {
513        if (enforceInit || !this.inited) {
514            this.init(config);
515        }
516
517        var str_first = '', str_prv = '', str_next = '', str_last = '';
518        if (this.isShowFirstPageBtn) {
519            if (this.hasPrv) {
520                str_first = '<a ' + this._getHandlerStr(1) + ' title="'
521                    + (this.lang.firstPageTipText || this.lang.firstPageText) + '">' + this.lang.firstPageText + '</a>';
522            } else {
523                str_first = '<span class="disabled">' + this.lang.firstPageText + '</span>';
524            }
525        }
526        if (this.isShowPrePageBtn) {
527            if (this.hasPrv) {
528                str_prv = '<a ' + this._getHandlerStr(this.prv) + ' title="'
529                    + (this.lang.prePageTipText || this.lang.prePageText) + '">' + this.lang.prePageText + '</a>';
530            } else {
531                str_prv = '<span class="disabled">' + this.lang.prePageText + '</span>';
532            }
533        }
534        if (this.isShowNextPageBtn) {
535            if (this.hasNext) {
536                str_next = '<a ' + this._getHandlerStr(this.next) + ' title="'
537                    + (this.lang.nextPageTipText || this.lang.nextPageText) + '">' + this.lang.nextPageText + '</a>';
538            } else {
539                str_next = '<span class="disabled">' + this.lang.nextPageText + '</span>';
540            }
541        }
542        if (this.isShowLastPageBtn) {
543            if (this.hasNext) {
544                str_last = '<a ' + this._getHandlerStr(this.total) + ' title="'
545                    + (this.lang.lastPageTipText || this.lang.lastPageText) + '">' + this.lang.lastPageText + '</a>';
546            } else {
547                str_last = '<span class="disabled">' + this.lang.lastPageText + '</span>';
548            }
549        }
550        var str = '';
551        if (this.isEllipsisLink) {
552            var dot = '<a ' + this._getHandlerStr(this.prvMax) + ' title="...">...</a>';
553            var dot2 = '<a ' + this._getHandlerStr(this.nextMax) + ' title="...">...</a>';
554        } else {
555            var dot = '<span class="spanDot">...</span>';
556        }
557        var total_info = '<span class="totalText">';
558        var total_info_splitstr = '<span class="totalInfoSplitStr">
558' + this.lang.totalInfoSplitStr + '</span>';
559        if (this.isShowCurrPage) {
560            total_info += this.lang.currPageBeforeText + '<span class="currPageNum">' + this.pno + '</span>' + this.lang.currPageAfterText;
561            if (this.isShowTotalPage) {
562                total_info += total_info_splitstr;
563                total_info += this.lang.totalPageBeforeText + '<span class="totalPageNum">' + this.total + '</span>' + this.lang.totalPageAfterText;
564            } else if (this.isShowTotalRecords) {
565                total_info += total_info_splitstr;
566                total_info += this.lang.totalRecordsBeforeText + '<span class="totalRecordNum">' + this.totalRecords + '</span>' + this.lang.totalRecordsAfterText;
567            }
568        } else if (this.isShowTotalPage) {
569            total_info += this.lang.totalPageBeforeText + '<span class="totalPageNum">' + this.total + '</span>' + this.lang.totalPageAfterText;;
570            if (this.isShowTotalRecords) {
571                total_info += total_info_splitstr;
572                total_info += this.lang.totalRecordsBeforeText + '<span class="totalRecordNum">' + this.totalRecords + '</span>' + this.lang.totalRecordsAfterText;
573            }
574        } else if (this.isShowTotalRecords) {
575            total_info += this.lang.totalRecordsBeforeText + '<span class="totalRecordNum">' + this.totalRecords + '</span>' + this.lang.totalRecordsAfterText;
576        }
577        total_info += '</span>';
578
579        var gopage_info = '';
580        if (this.isGoPage) {
581            gopage_info = '<span class="goPageBox">' + this.lang.gopageBeforeText + '<span id="' + this.gopageWrapId + '">' +
582                '<input type="button" id="' + this.gopageButtonId + '" onclick="kkpagerNews.gopage()" value="'
583                    + this.lang.gopageButtonOkText + '" />' +
584                '<input type="text" id="' + this.gopageTextboxId + '" onfocus="kkpagerNews.focus_gopage()"  onkeypress="return kkpagerNews.keypress_gopage(event);"   onblur="kkpagerNews.blur_gopage()" value="' + this.next + '" /></span>' + this.lang.gopageAfterText + '</span>';
585        }
586
587        //分页处理
588        if (this.total <= 11) {
589            for (var i = 1; i <= this.total; i++) {
590                if (this.pno == i) {
591                    str += '<span class="curr">' + i + '</span>';
592                } else {
593                    str += '<a ' + this._getHandlerStr(i) + ' title="'
594                        + this.lang.buttonTipBeforeText + i + this.lang.buttonTipAfterText + '">' + i + '</a>';
595                }
596            }
597        } else {
598            if (this.pno <= 5) {
599                for (var i = 1; i <= this.isShowPages; i++) {
600                    if (this.pno == i) {
601                        str += '<span class="curr">' + i + '</span>';
602                    } else {
603                        str += '<a ' + this._getHandlerStr(i) + ' title="' +
604                            this.lang.buttonTipBeforeText + i + this.lang.buttonTipAfterText + '">' + i + '</a>';
605                    }
606                }
607                str += dot2;
608                if (this.isShowLastPage) {
609                    str += '<a ' + this._getHandlerStr(this.total) + ' title="'
610                        + this.lang.buttonTipBeforeText + this.total + this.lang.buttonTipAfterText + '">' + this.total + '</a>';
611                }
612            } else {
613                str += '<a ' + this._getHandlerStr(1) + ' title="'
614                    + this.lang.buttonTipBeforeText + '1' + this.lang.buttonTipAfterText + '">1</a>';
615                str += '<a ' + this._getHandlerStr(2) + ' title="'
616                    + this.lang.buttonTipBeforeText + '2' + this.lang.buttonTipAfterText + '">2</a>';
617                str += dot;
618
619                var begin = this.pno - 2;
620                var end = this.pno + 2;
621                if (end > this.total) {
622                    end = this.total;
623                    begin = end - 4;
624                    if (this.pno - begin < 2) {
625                        begin = begin - 1;
626                    }
627                } else if (end + 1 == this.total) {
628                    end = this.total;
629                }
630                for (var i = begin; i <= end; i++) {
631                    if (this.pno == i) {
632                        str += '<span class="curr">' + i + '</span>';
633                    } else {
634                        str += '<a ' + this._getHandlerStr(i) + ' title="'
635                            + this.lang.buttonTipBeforeText + i + this.lang.buttonTipAfterText + '">' + i + '</a>';
636                    }
637                }
638                if (end != this.total) {
639                    if (this.isEllipsisLink) {
640                        str += dot2;
641                    } else {
642                        str += dot;
643                    }
644                    if (this.isShowLastPage) {
645                        str += '<a ' + this._getHandlerStr(this.total) + ' title="'
646                            + this.lang.buttonTipBeforeText + this.total + this.lang.buttonTipAfterText + '">' + this.total + '</a>';
647                    }
648                }
649            }
650        }
651        var pagerHtml = '<div>';
652        if (this.isWrapedPageBtns) {
653            pagerHtml += '<span class="pageBtnWrap">' + str_first + str_prv + str + str_next + str_last + '</span>'
654        } else {
655            pagerHtml += str_first + str_prv + str + str_next + str_last;
656        }
657        if (this.isWrapedInfoTextAndGoPageBtn) {
658            pagerHtml += '<span class="infoTextAndGoPageBtnWrap">' + total_info + gopage_info + '</span>';
659        } else {
660            pagerHtml += total_info + gopage_info;
661        }
662        pagerHtml += '</div><div style="clear:both;"></div>';
663        $("#" + this.pagerid).html(pagerHtml);
664    },
665    //分页按钮控件初始化
666    init: function (config) {
667        this.type = config.type;
668        this.pno = isNaN(config.pno) ? 1 : parseInt(config.pno);
669        this.total = isNaN(config.total) ? 1 : parseInt(config.total);
670        this.totalRecords = isNaN(config.totalRecords) ? 0 : parseInt(config.totalRecords);
671        this.isShowPages = isNaN(config.isShowPages) ? 7 : parseInt(config.isShowPages);
672        this.isJump = isNaN(config.isJump) ? 6 : parseInt(config.isJump);
673        this.isJumpLen = isNaN(config.isJumpLen) ? 5 : parseInt(config.isJumpLen);
674        if (config.pagerid) { this.pagerid = config.pagerid; }
675        if (config.mode) { this.mode = config.mode; }
676        if (config.gopageWrapId) { this.gopageWrapId = config.gopageWrapId; }
677        if (config.gopageButtonId) { this.gopageButtonId = config.gopageButtonId; }
678        if (config.gopageTextboxId) { this.gopageTextboxId = config.gopageTextboxId; }
679        if (config.isShowFirstPageBtn != undefined) { this.isShowFirstPageBtn = config.isShowFirstPageBtn; }
680        if (config.isShowLastPageBtn != undefined) { this.isShowLastPageBtn = config.isShowLastPageBtn; }
681        if (config.isShowPrePageBtn != undefined) { this.isShowPrePageBtn = config.isShowPrePageBtn; }
682        if (config.isShowNextPageBtn != undefined) { this.isShowNextPageBtn = config.isShowNextPageBtn; }
683        if (config.isShowTotalPage != undefined) { this.isShowTotalPage = config.isShowTotalPage; }
684        if (config.isShowCurrPage != undefined) { this.isShowCurrPage = config.isShowCurrPage; }
685        if (config.isShowTotalRecords != undefined) { this.isShowTotalRecords = config.isShowTotalRecords; }
686        if (config.isWrapedPageBtns) { this.isWrapedPageBtns = config.isWrapedPageBtns; }
687        if (config.isWrapedInfoTextAndGoPageBtn) { this.isWrapedInfoTextAndGoPageBtn = config.isWrapedInfoTextAndGoPageBtn; }
688        if (config.isGoPage != undefined) { this.isGoPage = config.isGoPage; }
689        if (config.lang) {
690            for (var key in config.lang) {
691                this.lang[key] = config.lang[key];
692            }
693        }
694        this.hrefFormer = config.hrefFormer || '';
695        this.hrefLatter = config.hrefLatter || '';
696        if (config.getLink && typeof (config.getLink) == 'function') { this.getLink = config.getLink; }
697        if (config.click && typeof (config.click) == 'function') { this.click = config.click; }
698        if (config.getHref && typeof (config.getHref) == 'function') { this.getHref = config.getHref; }
699        if (!this._config) {
700            this._config = config;
701        }
702        //validate
703        if (this.pno < 1) this.pno = 1;
704        this.total = (this.total <= 1) ? 1 : this.total;
705        if (this.pno > this.total) this.pno = this.total;
706        this.prv = (this.pno <= 2) ? 1 : (this.pno - 1);
707        this.prvMax = (this.pno <= this.isJump) ? 1 : (this.pno - this.isJumpLen);
708        this.next = (this.pno >= this.total - 1) ? this.total : (this.pno + 1);
709        this.nextMax = (this.pno >= this.total - this.isJumpLen) ? this.total : (this.pno + this.isJumpLen);
710        this.hasPrv = (this.pno > 1);
711        this.hasNext = (this.pno < this.total);
712
713        this.inited = true;
714    },
715    _getHandlerStr: function (n) {
716        if (this.mode == 'click') {
717            return 'href="' + this.getHref(n) + '" onclick="return '+this.type+'._clickHandler(' + n + ',{total:' + this.total + ',pagerid:\'' + this.pagerid + '\'})"';
718        }
719        //link模式,也是默认的
720        return 'href="' + this.getLink(n) + '"';
721    },
722    _clickHandler: function (n, config) {
723        var res = false;
724        if (this.click && typeof this.click == 'function') {
725            res = this.click.call(this, n, config) || false;
726        }
727        return res;
728    },
729    //复制一个新的kkpager 当做每个单独的kkpager用
730    //相当于new的意思
731    deepCopy: function () {
732        return this._deepCopy(this);
733    },
734    _deepCopy: function (kkpager) {
735        var result = {};
736        for (var key in kkpager) {
737            result[key] = typeof kkpager[key] === 'object' ? this._deepCopy(kkpager[key]) : kkpager[key];
738        }
739        return result;
740    }
741};

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.