Skip to content

Commit 9f49730

Browse files
committed
fix
1 parent 14166d5 commit 9f49730

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

JiandanHero/JiandanHero.user.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:en Jiandan Hero
44
// @name:zh-TW 煎蛋俠
55
// @namespace hoothin
6-
// @version 0.6
6+
// @version 0.8
77
// @description 为煎蛋jandan.net提供左右方向键快捷翻页、鼠标悬停显示大图、屏蔽指定用户发言等功能
88
// @description:en Tools for jandan.net
99
// @description:zh-TW 為煎蛋jandan.net提供左右方向鍵快捷翻頁、鼠標懸停顯示大圖、屏蔽指定用戶發言等功能
@@ -83,6 +83,7 @@
8383
img.onmouseout=function(e){
8484
document.body.removeChild(bigImg);
8585
bigImg.removeAttribute("height");
86+
bigImg.removeAttribute("width");
8687
};
8788
img.onmousemove=function(e){
8889
left=e.clientX;
@@ -94,9 +95,13 @@
9495
};
9596
}
9697
function relocBigImg(left, top){
97-
if(bigImg.height>document.documentElement.clientHeight){
98+
var type=bigImg.height/bigImg.width>document.documentElement.clientHeight/document.documentElement.clientWidth;
99+
if(type && bigImg.height>document.documentElement.clientHeight){
98100
bigImg.height=document.documentElement.clientHeight;
99101
}
102+
if(!type && bigImg.width>document.documentElement.clientWidth){
103+
bigImg.width=document.documentElement.clientWidth;
104+
}
100105
if(top+bigImg.height>document.documentElement.clientHeight){
101106
top=document.documentElement.clientHeight-bigImg.height;
102107
}

0 commit comments

Comments
 (0)