Skip to content

Commit 802d135

Browse files
committed
Refacroting embed addon
1 parent 27ad26f commit 802d135

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

embed/embed.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
*/
3232

3333
"use strict";
34-
(function(){function b(a){this.frame=a;this.x=window.scrollX;this.y=window.scrollY;this.isLock=!1;document.addEventListener("scroll",this.onScroll.bind(this),!1);window.addEventListener("blur",this.onBlur.bind(this),!1);window.addEventListener("pointermove",this.onMove.bind(this),!1);window.addEventListener("wheel",this.onMove.bind(this),!1);this.frame.addEventListener("pointerover",this.onOver.bind(this),!1);this.frame.addEventListener("pointerleave",this.onLeave.bind(this),!1)}window.AscEmbed=window.AscEmbed||
35-
{};b.prototype.onScroll=function(){document.activeElement===this.frame||this.isLock?window.scrollTo(this.x,this.y):(this.x=window.scrollX,this.y=window.scrollY)};b.prototype.onBlur=function(){if(document.activeElement===this.frame){this.isLock=!0;var a=this;setTimeout(function(){a.isLock=!1},100)}};b.prototype.onOver=function(){};b.prototype.onLeave=function(){this.frame.blur()};b.prototype.onMove=function(){document.activeElement===this.frame&&this.frame.blur()};window.AscEmbed.initWorker=function(a){window.AscEmbed.workers=
36-
window.AscEmbed.workers||[];a=new b(a);window.AscEmbed.workers.push(a);return a}})();
34+
(function(){function b(a){this.frame=a;this.x=window.scrollX;this.y=window.scrollY;this.lockCounter=0;document.addEventListener("scroll",this.onScroll.bind(this),!1);window.addEventListener("blur",this.onBlur.bind(this),!1);window.addEventListener("pointermove",this.onMove.bind(this),!1);window.addEventListener("wheel",this.onMove.bind(this),!1);this.frame.addEventListener("pointerover",this.onOver.bind(this),!1);this.frame.addEventListener("pointerleave",this.onLeave.bind(this),!1)}window.AscEmbed=
35+
window.AscEmbed||{};b.prototype.onScroll=function(){document.activeElement===this.frame||0!==this.lockCounter?window.scrollTo(this.x,this.y):(this.x=window.scrollX,this.y=window.scrollY)};b.prototype.onBlur=function(){document.activeElement===this.frame&&this.lockWithTimeout(500)};b.prototype.onOver=function(){};b.prototype.onLeave=function(){this.lockWithTimeout(100);this.frame.blur()};b.prototype.onMove=function(){document.activeElement===this.frame&&(this.lockWithTimeout(100),this.frame.blur())};
36+
b.prototype.lockWithTimeout=function(a){this.lockCounter++;var c=this;setTimeout(function(){c.lockCounter--},a)};window.AscEmbed.initWorker=function(a){window.AscEmbed.workers=window.AscEmbed.workers||[];a=new b(a);window.AscEmbed.workers.push(a);return a}})();
37+

0 commit comments

Comments
 (0)