|
3 | 3 | // @name:en Jiandan Hero |
4 | 4 | // @name:zh-TW 煎蛋俠 |
5 | 5 | // @namespace hoothin |
6 | | -// @version 1.3 |
| 6 | +// @version 1.5 |
7 | 7 | // @description 为煎蛋jandan.net提供左右方向键快捷翻页、鼠标悬停显示大图、屏蔽指定用户发言等功能 |
8 | 8 | // @description:en Tools for jandan.net |
9 | 9 | // @description:zh-TW 為煎蛋jandan.net提供左右方向鍵快捷翻頁、鼠標懸停顯示大圖、屏蔽指定用戶發言等功能 |
|
18 | 18 | 'use strict'; |
19 | 19 | var timer,tempImg=document.createElement("img"),getImgWH=function(img,callBack){ |
20 | 20 | if(timer)clearInterval(timer); |
21 | | - tempImg.src=null; |
| 21 | + tempImg.src=""; |
22 | 22 | tempImg.src=img.src; |
23 | 23 | var check=function(){ |
24 | 24 | if(tempImg.width>0 || tempImg.height>0){ |
|
110 | 110 | }; |
111 | 111 | }; |
112 | 112 | img.onmouseout=function(e){ |
113 | | - document.body.removeChild(bigImg); |
| 113 | + if(bigImg.parentNode)bigImg.parentNode.removeChild(bigImg); |
114 | 114 | bigImg.removeAttribute("height"); |
115 | 115 | bigImg.removeAttribute("width"); |
116 | 116 | }; |
117 | 117 | img.onmousemove=function(e){ |
118 | 118 | left=e.clientX; |
119 | 119 | top=e.clientY; |
120 | 120 | if(!bigImg.src || bigImg.src===""){ |
121 | | - img.onmouseover(null); |
| 121 | + img.onmouseover(e); |
122 | 122 | } |
123 | 123 | relocBigImg(left, top); |
124 | 124 | }; |
|
137 | 137 | }; |
138 | 138 | }); |
139 | 139 | $("p").on("mouseout","div.gif-mask",function(e){ |
140 | | - document.body.removeChild(bigImg); |
| 140 | + if(bigImg.parentNode)bigImg.parentNode.removeChild(bigImg); |
141 | 141 | bigImg.removeAttribute("height"); |
142 | 142 | bigImg.removeAttribute("width"); |
143 | 143 | }); |
144 | 144 | $("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 | + } |
147 | 149 | if(!bigImg.src || bigImg.src===""){ |
148 | | - this.onmouseover(null); |
| 150 | + this.onmouseover(e); |
149 | 151 | } |
150 | 152 | relocBigImg(left, top); |
151 | 153 | }); |
|
154 | 156 | var imgHeight=h?h:bigImg.height; |
155 | 157 | var type=imgHeight/imgWidth>document.documentElement.clientHeight/document.documentElement.clientWidth; |
156 | 158 | if(type && imgHeight>document.documentElement.clientHeight){ |
157 | | - imgHeight=document.documentElement.clientHeight; |
| 159 | + imgHeight=bigImg.height=document.documentElement.clientHeight; |
158 | 160 | } |
159 | 161 | if(!type && imgWidth>document.documentElement.clientWidth){ |
160 | | - imgWidth=document.documentElement.clientWidth; |
| 162 | + imgWidth=bigImg.width=document.documentElement.clientWidth; |
161 | 163 | } |
162 | 164 | if(top-imgHeight<0){ |
163 | 165 | top=0; |
|
0 commit comments