Skip to content

Commit dec4285

Browse files
committed
fix
1 parent 9ea3e1e commit dec4285

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

Picviewer CE+/Picviewer CE+.user.js

Lines changed: 20 additions & 7 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.12.4.1
9+
// @version 2018.1.1.1
1010
// @created 2011-6-15
1111
// @namespace http://userscripts.org/users/NLF
1212
// @homepage http://hoothin.com
@@ -1011,7 +1011,7 @@
10111011
// 通配型规则,无视站点.
10121012
var tprules=[
10131013
function(img, a) { // 解决新的dz论坛的原图获取方式.
1014-
var regs = [/(.+\/attachments?\/.+)\.thumb\.\w{2,5}$/i,/(wp-content\/uploads\/.*)\-\d+x\d+/i,/.*(?:url|src)=(https?:\/\/.*\.(?:jpg|jpeg|png|gif|bmp)).*/i,/.*thumb\.php\?src=([^&]*).*/i];
1014+
var regs = [/(.+\/attachments?\/.+)\.thumb\.\w{2,5}$/i,/((wp-content|moecdn\.org)\/uploads\/.*)\-\d+x\d+/i,/.*(?:url|src)=(https?:\/\/.*\.(?:jpg|jpeg|png|gif|bmp)).*/i,/.*thumb\.php\?src=([^&]*).*/i];
10151015
var oldsrc = this.src,newsrc = this.src;
10161016
if (oldsrc){
10171017
for(let reg of regs){
@@ -1020,7 +1020,7 @@
10201020
}
10211021
}
10221022
}
1023-
var original=this.getAttribute('data-original');
1023+
var original=this.getAttribute?this.getAttribute('data-original'):"";
10241024
if(original && original!=oldsrc)return original;
10251025
else if(/\.sinaimg\.(cn|com)\/mw\d+\//.test(oldsrc)){
10261026
newsrc=oldsrc.replace(/.*(https?:\/\/[^\.]+\.sinaimg\.(cn|com))\/mw\d+\//,"$1/large/");
@@ -8662,12 +8662,25 @@ left: -45px;\
86628662
if (target.nodeName != 'IMG' && typeof target.className === 'string' && target.className.indexOf("pv-float-bar")==-1){
86638663
var targetStyle=getComputedStyle(target);
86648664
if(prefs.floatBar.listenBg && targetStyle.backgroundImage && /^url/.test(targetStyle.backgroundImage) && targetStyle.width.replace("px","")>prefs.floatBar.minSizeLimit.w && targetStyle.height.replace("px","")>prefs.floatBar.minSizeLimit.h){
8665-
var src=targetStyle.backgroundImage.replace(/url\(["'](.*)["']\)/,"$1");
8665+
var src=targetStyle.backgroundImage.replace(/url\(["'](.*)["']\)/,"$1"),nsrc=src,noActual=true,type="scale";
8666+
var img={src:src};
8667+
tprules._find(function(rule,index,array){
8668+
try{
8669+
nsrc=rule.call(img,img,null);
8670+
if(src){
8671+
type="tpRule";
8672+
noActual=false;
8673+
return true;
8674+
};
8675+
}catch(err){
8676+
throwErrorInfo(err);
8677+
};
8678+
});
86668679
result = {
8667-
src: src,
8668-
type: "scale",
8680+
src: nsrc,
8681+
type: type,
86698682
imgSrc: src,
8670-
noActual:true,
8683+
noActual:noActual,
86718684
img: target
86728685
};
86738686
}else if(target.children.length<=2 && target.querySelectorAll("img").length==1){

0 commit comments

Comments
 (0)