|
8 | 8 | // @namespace http://tampermonkey.net/ |
9 | 9 | // @require https://cdn.jsdelivr.net/jquery/1.7.2/jquery.min.js |
10 | 10 | // @require https://cdn.jsdelivr.net/hi-base64/0.2.0/base64.min.js |
11 | | -// @version 1.3.0 |
| 11 | +// @version 1.3.1 |
12 | 12 | // @author Hoothin |
13 | 13 | // @mail rixixi@gmail.com |
14 | 14 | // @include http*://*/* |
|
214 | 214 | offNode.click(function(e){ |
215 | 215 | if(!siteConfig.directUrl)GM_setValue("eoUrl",getRightUrl(offUrl)); |
216 | 216 | e.stopPropagation(); |
| 217 | + hideIcons(); |
217 | 218 | }); |
218 | 219 | if(siteConfig.bgImg)offNode.css("background-image","url(\""+siteConfig.bgImg+"\")"); |
219 | 220 | if(siteConfig.hide || GM_getValue("eoHide"+siteConfig.name))continue; |
220 | 221 | offNodes.push(offNode); |
221 | 222 | parentDiv.prepend(offNode); |
222 | 223 | } |
223 | | - parentDiv.mouseover(function(e){ |
224 | | - e.stopPropagation(); |
225 | | - }); |
226 | | - document.addEventListener("mouseover", function(e){ |
| 224 | + if(typeof(HTMLElement)!="undefined"){ |
| 225 | + HTMLElement.prototype.contains=function(obj) { |
| 226 | + while(obj){ |
| 227 | + if(obj==this) |
| 228 | + return true; |
| 229 | + obj=obj.parentNode; |
| 230 | + } |
| 231 | + return false; |
| 232 | + }; |
| 233 | + } |
| 234 | + var marginTop=offNodes.length*25; |
| 235 | + parentDiv.prepend($('<div style="position:absolute;width:25px;height:'+marginTop+'px;margin-top:-'+(marginTop-25)+'px;background-color:white;opacity:0.001;"></div>')); |
| 236 | + parentDiv.mouseout(function(e){ |
| 237 | + var relatedTarget=(e.relatedTarget||e.fromElement); |
| 238 | + if(relatedTarget && !parentDiv[0].contains(relatedTarget)) |
227 | 239 | hideIcons(); |
228 | 240 | }); |
229 | 241 | var preNode; |
|
467 | 479 | if(siteConfig.bgImg)icon.css("background-image","url(\""+siteConfig.bgImg+"\")"); |
468 | 480 | icon.on("click", function(){ |
469 | 481 | var eoHide=GM_getValue("eoHide"+siteConfig.name); |
| 482 | + if(!eoHide){ |
| 483 | + var allHide=true; |
| 484 | + $("#icons>div").each(function(){ |
| 485 | + if(this!=icon[0] && $(this).css("opacity")!="0.2"){ |
| 486 | + allHide=false; |
| 487 | + return false; |
| 488 | + } |
| 489 | + }); |
| 490 | + if(allHide){ |
| 491 | + alert("不能全部禁用!"); |
| 492 | + return; |
| 493 | + } |
| 494 | + } |
470 | 495 | GM_setValue("eoHide"+siteConfig.name, !eoHide); |
471 | 496 | icon.css("opacity",eoHide?"1":"0.2"); |
472 | 497 | icon.attr("title",(eoHide?i18n.disable:i18n.enable)+i18n[siteConfig.name] ); |
|
0 commit comments