PageSourceSearch

http://52mud.com/inc/pager.js

js 52mud.com collected 2026-10-03 18:19:37 UTC 1,442 bytes, 70 lines download raw bytes

1function iwmsPager(curPage, sumPage, rewrite){
2	this.cur=curPage;
3	this.sum=sumPage;
4	this.rewrite=rewrite;
5}
6
7iwmsPager.prototype.GetUrl=function(p){
8	if (p<=0){p=1;}
9	if (p>this.sum){p=this.sum;}
10	var u = location.href;
11	if (!this.rewrite){
12		if (u.indexOf("?")<0){
13			u="?";
14		}else{
15			u=u.substr(u.indexOf("?"));
16		}
17		u=u.replace(/page=\d+&?/ig,"");
18		if (p>1){
19			if(u!="?"){
20				u=u.replace("?","?page="+p+"&");
21			}else{
22				u=u.replace("?","?page="+p);
23			}
24		}
25	}else{
26		u=u.substr(u.lastIndexOf("/")+1);
27		u=u.replace(/p\d+/ig,"");
28		if (p>1){
29			u=u.replace(".","p"+p+".");
30		}
31	}
32	return u;
33}
34
35iwmsPager.prototype.Jump=function(e,o){
36	if (e.keyCode!=13){
37		return;
38	}
39	var n=parseInt(o.value);
40	if (isNaN(n)){return;}
41	location=this.GetUrl(n);
42}
43
44iwmsPager.prototype.Next=function(){
45	if (this.sum==1)return;
46	var n=this.cur==this.sum?1:this.cur+1;
47	location=this.GetUrl(n);
48}
49
50iwmsPager.prototype.Prev=function(){
51	if (this.sum==1)return;
52	var n=this.cur==1?this.sum:this.cur-1;
53	location=this.GetUrl(n);
54}
55
56function keyPage(event){
57	var ac;
58	if (ac=document.activeElement){
59		if(ac.tagName=="INPUT" || ac.tagName=="TEXTAREA"){
60			return;
61		}
62	}
63	if (typeof(pager)!="undefined"){
64		event = event ? event : (window.event ? window.event : null); 
65		if (event.keyCode==37) pager.Prev();
66		if (event.keyCode==39) pager.Next();
67	}
68}
69
70document.onkeydown=keyPage;

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.