2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00
xcat-core/docs/webcontent/js/gwdiframe_min.js
2018-12-17 03:00:14 -05:00

7 lines
2.6 KiB
JavaScript

(function(){'use strict';var b,f=function(a){return"gwd-page"==a.tagName.toLowerCase()||"gwd-page"==a.getAttribute("is")},g=function(a){if(f(a))return a;for(;a&&9!=a.nodeType;)if((a=a.parentElement)&&f(a))return a;return null},h=function(a,c,d){var e=e||c;a.hasAttribute(c)?(a=a.getAttribute(c),d.setAttribute(e,a)):d.removeAttribute(e)};var k=["allowFullscreen","name","scrolling"];var l=function(a,c){var d=document.createEvent("Event");d.initEvent(a,!0,!0);c.dispatchEvent(d)};var m=function(){};goog.inherits(m,HTMLElement);b=m.prototype;
b.createdCallback=function(){for(var a;a=this.firstChild;)this.removeChild(a);this.a=document.createElement("iframe");this.c=this.getAttribute("source");this.f=this.g.bind(this);this.b=!1;this.a.setAttribute("allowtransparency",!0);this.a.setAttribute("border",0);this.a.setAttribute("frameborder",0);this.a.setAttribute("sandbox","allow-same-origin allow-forms allow-scripts");this.a.setAttribute("seamless","seamless");for(a=0;a<k.length;a++)h(this,k[a],this.a);a=document.createElement("div");a.classList.add("intermediate-element");
a.appendChild(this.a);this.appendChild(a);Object.defineProperty(this,"nativeElement",{enumerable:!0,get:function(){return this.a}});Object.defineProperty(this,"src",{enumerable:!0,get:function(){return this.a.src},set:function(a){this.a.src=a}});Object.defineProperty(this,"srcdoc",{enumerable:!0,get:function(){return this.a.srcdoc},set:function(a){this.a.srcdoc=a}});Object.defineProperty(this,"scrolling",{enumerable:!0,get:function(){return this.a.scrolling},set:function(a){this.a.scrolling=a}});
Object.defineProperty(this,"allowFullscreen",{enumerable:!0,get:function(){return this.a.allowFullscreen},set:function(a){a?this.setAttribute("allowFullscreen",""):this.removeAttribute("allowFullscreen")}});Object.defineProperty(this,"name",{enumerable:!0,get:function(){return this.a.name},set:function(a){this.a.name=a}})};
b.attachedCallback=function(){setTimeout(function(){if("function"==typeof this.gwdLoad&&"function"==typeof this.gwdIsLoaded&&!this.gwdIsLoaded()){var a=g(this),c=a&&"function"==typeof a.gwdIsLoaded;(!a||c&&a.gwdIsLoaded())&&this.gwdLoad()}}.bind(this),0)};b.setUrl=function(a){a!=this.c&&(this.b=!1,this.c=a);this.gwdLoad()};b.gwdLoad=function(){this.b||(this.a.addEventListener("load",this.f,!1),this.setAttribute("src",this.c))};b.gwdIsLoaded=function(){return this.b};
b.g=function(){this.b=!0;this.a.removeEventListener("load",this.f,!1);l("iframeload",this);l("ready",this)};b.attributeChangedCallback=function(a){h(this,a,this.a)};document.registerElement("gwd-iframe",{prototype:m.prototype});}).call(this);