2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
"use strict";(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[580],{33580:(t,e,i)=>{i.r(e);var n=i(78673),s={};class a extends n.A{constructor(t){super(t);var e=t.orig;this.origElem=e,this.divid=e.id,this.dataEdit=this.parseBooleanAttribute(e,"data-edit"),this.isImage=this.parseBooleanAttribute(e,"data-isimage"),this.displayClass="block",this.parseBooleanAttribute(e,"data-hidden")&&(this.displayClass="none"),this.numberOfRows=e.dataset.rows,this.numberOfCols=e.dataset.cols,this.isImage||(this.dataEdit?this.createTextArea():this.createPre(),this.fileName&&(this.containerDiv.dataset.filename=this.fileName));let i=this.containerDiv.parentElement?.querySelector(".datafile_caption");i&&"none"===this.displayClass&&(i.style.display="none"),this.indicate_component_ready()}createPre(){this.containerDiv=document.createElement("pre"),this.containerDiv.id=this.divid,this.containerDiv.style.display=this.displayClass,this.containerDiv.innerHTML=this.origElem.innerHTML,this.origElem.replaceWith(this.containerDiv)}createTextArea(){this.containerDiv=document.createElement("textarea"),this.containerDiv.id=this.divid,this.numberOfRows&&(this.containerDiv.rows=this.numberOfRows),this.numberOfCols&&(this.containerDiv.cols=this.numberOfCols),this.containerDiv.innerHTML=this.origElem.innerHTML,this.containerDiv.classList.add("datafiletextfield"),this.origElem.replaceWith(this.containerDiv)}}document.addEventListener("runestone:login-complete",(function(){document.querySelectorAll("[data-component=datafile]").forEach((function(t){try{s[t.id]=new a({orig:t})}catch(e){console.log(`Error rendering DataFile ${t.id}`)}}))})),void 0===window.component_factory&&(window.component_factory={}),window.component_factory.datafile=function(t){return new a(t)}}}]);
|
|
//# sourceMappingURL=580.f387819ad2e14f0a.js.map
|