Skip to content

Commit d3b5dc9

Browse files
committed
fix
1 parent 3ca5ca8 commit d3b5dc9

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

JiandanHero/JiandanHero.user.js

Lines changed: 12 additions & 10 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 1.3
6+
// @version 1.5
77
// @description 为煎蛋jandan.net提供左右方向键快捷翻页、鼠标悬停显示大图、屏蔽指定用户发言等功能
88
// @description:en Tools for jandan.net
99
// @description:zh-TW 為煎蛋jandan.net提供左右方向鍵快捷翻頁、鼠標懸停顯示大圖、屏蔽指定用戶發言等功能
@@ -18,7 +18,7 @@
1818
'use strict';
1919
var timer,tempImg=document.createElement("img"),getImgWH=function(img,callBack){
2020
if(timer)clearInterval(timer);
21-
tempImg.src=null;
21+
tempImg.src="";
2222
tempImg.src=img.src;
2323
var check=function(){
2424
if(tempImg.width>0 || tempImg.height>0){
@@ -110,15 +110,15 @@
110110
};
111111
};
112112
img.onmouseout=function(e){
113-
document.body.removeChild(bigImg);
113+
if(bigImg.parentNode)bigImg.parentNode.removeChild(bigImg);
114114
bigImg.removeAttribute("height");
115115
bigImg.removeAttribute("width");
116116
};
117117
img.onmousemove=function(e){
118118
left=e.clientX;
119119
top=e.clientY;
120120
if(!bigImg.src || bigImg.src===""){
121-
img.onmouseover(null);
121+
img.onmouseover(e);
122122
}
123123
relocBigImg(left, top);
124124
};
@@ -137,15 +137,17 @@
137137
};
138138
});
139139
$("p").on("mouseout","div.gif-mask",function(e){
140-
document.body.removeChild(bigImg);
140+
if(bigImg.parentNode)bigImg.parentNode.removeChild(bigImg);
141141
bigImg.removeAttribute("height");
142142
bigImg.removeAttribute("width");
143143
});
144144
$("p").on("mousemove","div.gif-mask",function(e){
145-
left=e.clientX;
146-
top=e.clientY;
145+
if(e){
146+
left=e.clientX;
147+
top=e.clientY;
148+
}
147149
if(!bigImg.src || bigImg.src===""){
148-
this.onmouseover(null);
150+
this.onmouseover(e);
149151
}
150152
relocBigImg(left, top);
151153
});
@@ -154,10 +156,10 @@
154156
var imgHeight=h?h:bigImg.height;
155157
var type=imgHeight/imgWidth>document.documentElement.clientHeight/document.documentElement.clientWidth;
156158
if(type && imgHeight>document.documentElement.clientHeight){
157-
imgHeight=document.documentElement.clientHeight;
159+
imgHeight=bigImg.height=document.documentElement.clientHeight;
158160
}
159161
if(!type && imgWidth>document.documentElement.clientWidth){
160-
imgWidth=document.documentElement.clientWidth;
162+
imgWidth=bigImg.width=document.documentElement.clientWidth;
161163
}
162164
if(top-imgHeight<0){
163165
top=0;

0 commit comments

Comments
 (0)