(img,callBack)
| 21 | (function() { |
| 22 | 'use strict'; |
| 23 | var timer,tempImg=document.createElement("img"),getImgWH=function(img,callBack){ |
| 24 | if(timer)clearInterval(timer); |
| 25 | tempImg.src=""; |
| 26 | tempImg.src=img.src; |
| 27 | var check=function(){ |
| 28 | if(tempImg.width>0 || tempImg.height>0){ |
| 29 | if(timer)clearInterval(timer); |
| 30 | callBack(tempImg.width,tempImg.height); |
| 31 | return true; |
| 32 | }else{ |
| 33 | return false; |
| 34 | } |
| 35 | }; |
| 36 | var geted=check(); |
| 37 | if(!geted){ |
| 38 | timer = setInterval(check,40); |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | document.addEventListener("keyup", function(e) { |
| 43 | if(/INPUT|TEXTAREA/.test(document.activeElement.tagName))return; |
no test coverage detected