⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pager.js

📁 电气元件在图纸中的符号
💻 JS
字号:
function iwmsPager(curPage, sumPage, rewrite){
	this.cur=curPage;
	this.sum=sumPage;
	this.rewrite=rewrite;
}

iwmsPager.prototype.GetUrl=function(p){
	if (p<=0){p=1;}
	if (p>this.sum){p=this.sum;}
	var u = location.href;
	if (!this.rewrite){
		if (u.indexOf("?")<0){
			u="?";
		}else{
			u=u.substr(u.indexOf("?"));
		}
		u=u.replace(/page=\d+&?/ig,"");
		if (p>1){
			if(u!="?"){
				u=u.replace("?","?page="+p+"&");
			}else{
				u=u.replace("?","?page="+p);
			}
		}
	}else{
		u=u.substr(u.lastIndexOf("/")+1);
		u=u.replace(/p\d+/ig,"");
		if (p>1){
			u=u.replace(".","p"+p+".");
		}
	}
	return u;
}

iwmsPager.prototype.Jump=function(){
	var n = document.getElementById("goPage").value;
	n = parseInt(n);
	if (isNaN(n)){return;}
	location=this.GetUrl(n);
}

iwmsPager.prototype.Next=function(){
	if (this.sum==1)return;
	var n=this.cur==this.sum?1:this.cur+1;
	location=this.GetUrl(n);
}

iwmsPager.prototype.Prev=function(){
	if (this.sum==1)return;
	var n=this.cur==1?this.sum:this.cur-1;
	location=this.GetUrl(n);
}

function keyPage(event){
	if (typeof(pager)!="undefined"){
		event = event ? event : (window.event ? window.event : null); 
		if (event.keyCode==37) pager.Prev();
		if (event.keyCode==39) pager.Next();
	}
}

document.onkeydown=keyPage;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -