1
!function(e,r){"function"==typeof define&&define.amd?define(["jquery"],function(e){return r(e)}
2
):"object"==typeof module&&module.exports?module.exports=r(require("jquery")):r(e.jQuery)}
3
(this,function(e){!function(e){e.fn.iframeTracker=function(r){"function"==typeof r&&(r={blurCallback:r}
4
);var t=this.get();if(null===r||!1===r)e.iframeTracker.untrack(t);else{if("object"!=typeof r)throw new Error("Wrong handler type (must be an object, or null|false to untrack)");e.iframeTracker.track(t,r)}
5
return this}
6
,e.iframeTracker={focusRetriever:null,focusRetrieved:!1,handlersList:[],isIE8AndOlder:!1,init:function(){try{!0===e.browser.msie&&e.browser.version<9&&(this.isIE8AndOlder=!0)}
7
catch(e){try{navigator.userAgent.match(/(msie) ([\w.]+)/i)[2]<9&&(this.isIE8AndOlder=!0)}
8
catch(e){}
9
}
10
if(e(window).focus(),e(window).blur(function(r){e.iframeTracker.windowLoseFocus(r)}
11
),e("body").append('<div style="position:fixed; top:0; left:0; overflow:hidden;"><input style="position:absolute; left:-300px;" type="text" value="" id="focus_retriever" readonly="true" /></div>'),this.focusRetriever=e("#focus_retriever"),this.focusRetrieved=!1,this.isIE8AndOlder){this.focusRetriever.blur(function(r){r.stopPropagation(),r.preventDefault(),e.iframeTracker.windowLoseFocus(r)}
12
),e("body").click(function(r){e(window).focus()}
13
),e("form").click(function(e){e.stopPropagation()}
14
);try{e("body").on("click","form",function(e){e.stopPropagation()}
15
)}
16
catch(e){console.log("[iframeTracker] Please update jQuery to 1.7 or newer. (exception: "+e.message+")")}
17
}
18
}
19
,track:function(r,t){t.target=r,e.iframeTracker.handlersList.push(t),e(r).bind("mouseover",{handler:t}
20
,e.iframeTracker.mouseoverListener).bind("mouseout",{handler:t}
21
,e.iframeTracker.mouseoutListener)}
22
,untrack:function(r){if("function"==typeof Array.prototype.filter){e(r).each(function(r){e(this).unbind("mouseover",e.iframeTracker.mouseoverListener).unbind("mouseout",e.iframeTracker.mouseoutListener)}
23
);var t=function(e){return null!==e}
24
;for(var i in this.handlersList){for(var o in this.handlersList[i].target)-1!==e.inArray(this.handlersList[i].target[o],r)&&(this.handlersList[i].target[o]=null);this.handlersList[i].target=this.handlersList[i].target.filter(t),0===this.handlersList[i].target.length&&(this.handlersList[i]=null)}
25
this.handlersList=this.handlersList.filter(t)}
26
else console.log("Your browser doesn't support Array filter, untrack disabled")}
27
,mouseoverListener:function(r){r.data.handler.over=!0,e.iframeTracker.retrieveFocus();try{r.data.handler.overCallback(this,r)}
28
catch(e){}
29
}
30
,mouseoutListener:function(r){r.data.handler.over=!1,e.iframeTracker.retrieveFocus();try{r.data.handler.outCallback(this,r)}
31
catch(e){}
32
}
33
,retrieveFocus:function(){document.activeElement&&"IFRAME"===document.activeElement.tagName&&(e.iframeTracker.focusRetriever.focus(),e.iframeTracker.focusRetrieved=!0)}
34
,windowLoseFocus:function(e){for(var r in this.handlersList)if(!0===this.handlersList[r].over)try{this.handlersList[r].blurCallback(e)}
35
catch(e){}
36
}
37
}
38
,e(document).ready(function(){e.iframeTracker.init()}
39
)}
40
(e)}
...
</html>