mirror of
https://github.com/ONLYOFFICE/onlyoffice.github.io.git
synced 2026-02-10 09:55:09 +08:00
Refacroting embed addon
This commit is contained in:
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
(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||
|
||||
{};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=
|
||||
window.AscEmbed.workers||[];a=new b(a);window.AscEmbed.workers.push(a);return a}})();
|
||||
(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=
|
||||
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())};
|
||||
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}})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user