Skip to content

Commit 94a4c99

Browse files
committed
fix
1 parent d7e9b64 commit 94a4c99

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

Picviewer CE+/Picviewer CE+.user.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// @description Powerful picture viewing tool online, which can popup/scale/rotate/batch save pictures or find the HD original picture automatically
77
// @description:zh-CN NLF 的围观图修改版,增加高清原图查找显示(在线看图工具,支持图片翻转、旋转、缩放、弹出大图、批量保存、查找原图)
88
// @description:zh-TW NLF 的圍觀圖修改版,增加高清原圖查詢顯示(線上看圖工具,支援圖片翻轉、旋轉、縮放、彈出大圖、批量儲存、查詢原圖)
9-
// @version 2017.7.26.1
9+
// @version 2017.7.26.2
1010
// @created 2011-6-15
1111
// @namespace http://userscripts.org/users/NLF
1212
// @homepage http://hoothin.com
@@ -3434,6 +3434,10 @@ padding-left:24px;">'+shareItem.name+'</span>');
34343434
},
34353435
curPage:document,
34363436
getPage:function(){
3437+
var pageNum=0;
3438+
if(/[_\-]\d+(\.html)?$/.test(this.href)){
3439+
pageNum=this.href.replace(/.*[\-_](\d+)(\.html)?$/,"$1");
3440+
}
34373441
var curPage=this.curPage;
34383442
let pre=curPage.querySelector("a.prev");
34393443
let next=curPage.querySelector("a.next");
@@ -3461,6 +3465,12 @@ padding-left:24px;">'+shareItem.name+'</span>');
34613465
if(!pret){
34623466
if(aTag.innerHTML=="«"){
34633467
pret=aTag;
3468+
}else if(pageNum==1){
3469+
if(aTag.getAttribute("href") && aTag.getAttribute("href").indexOf(this.href.replace(/.*\/([^\/]+)$/,"$1").replace(/[_-]\d+/,""))!=-1){
3470+
pret=aTag;
3471+
}
3472+
}else if(aTag.getAttribute("href") && aTag.getAttribute("href").replace(/.*[\-_](\d+)(\.html)?$/,"$1")==pageNum-1){
3473+
pret=aTag;
34643474
}
34653475
}
34663476
}
@@ -3484,6 +3494,8 @@ padding-left:24px;">'+shareItem.name+'</span>');
34843494
if(!nextt){
34853495
if(aTag.innerHTML=="»"){
34863496
nextt=aTag;
3497+
}else if(aTag.getAttribute("href").replace(/.*[\-_](\d+)(\.html)?$/,"$1")==parseInt(pageNum)+1){
3498+
nextt=aTag;
34873499
}
34883500
}
34893501
}
@@ -3504,15 +3516,17 @@ padding-left:24px;">'+shareItem.name+'</span>');
35043516
var root_page = /^[^?#]*\//.exec(location.href)[0],
35053517
root_domain = /^\w+\:\/\/\/?[^\/]+/.exec(root_page)[0],
35063518
absolute_regex = /^\w+\:\/\//;
3519+
src=src.replace(/\.\//,"");
35073520
if (/^\/\/\/?/.test(src)){
35083521
src = location.protocol + src;
35093522
}
35103523
else if (!absolute_regex.test(src) && src.charAt(0) != "/"){
35113524
src = (base_path || "") + src;
35123525
}
3513-
return absolute_regex.test(src) ? src : ((src.charAt(0) == "/" ? root_domain : root_page) + src);
3526+
return (absolute_regex.test(src) ? src : ((src.charAt(0) == "/" ? root_domain : root_page) + src));
35143527
},
35153528
completePages:[],
3529+
href:location.href,
35163530
prePage:function(){
35173531
var pageObj=this.getPage(),self=this,textSpan=this.eleMaps['head-command-nextPage'].querySelector("span");
35183532
textSpan.innerHTML="正在加载";
@@ -3545,10 +3559,11 @@ padding-left:24px;">'+shareItem.name+'</span>');
35453559
}else{
35463560
self.completePages.push(href);
35473561
}
3562+
self.href=self.canonicalUri(href);
35483563
GM_xmlhttpRequest({
35493564
method: 'GET',
35503565
overrideMimeType:"text/html;charset="+document.charset,
3551-
url: self.canonicalUri(href),
3566+
url: self.href,
35523567
onload: function(d) {
35533568
let html=document.implementation.createHTMLDocument('');
35543569
html.documentElement.innerHTML = d.responseText;
@@ -3618,10 +3633,11 @@ padding-left:24px;">'+shareItem.name+'</span>');
36183633
}else{
36193634
self.completePages.push(href);
36203635
}
3636+
self.href=self.canonicalUri(href);
36213637
GM_xmlhttpRequest({
36223638
method: 'GET',
36233639
overrideMimeType:"text/html;charset="+document.charset,
3624-
url: self.canonicalUri(href),
3640+
url: self.href,
36253641
onload: function(d) {
36263642
let html=document.implementation.createHTMLDocument('');
36273643
html.documentElement.innerHTML = d.responseText;

0 commit comments

Comments
 (0)