From 32bb0ef5f3d831cc728cf8d387d3ce6003cd5cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Schoorens?= Date: Tue, 12 Sep 2023 18:00:55 +0200 Subject: [PATCH] support global conf --- dist/odm.min.js | 2 +- src/odm.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dist/odm.min.js b/dist/odm.min.js index 4e72e97..46d16e4 100644 --- a/dist/odm.min.js +++ b/dist/odm.min.js @@ -1 +1 @@ -function OverlayDisplayManager(e){const t=["id","language","defaultButtonsClass","overlaySelectorPlace","hideOnEscape","margin","elementPadding","topBarHeight","bottomBarHeight","zIndex"];if(this.id=1,this.language="en",this.defaultButtonsClass="",this.overlaySelectorPlace="body",this.hideOnEscape=!0,this.margin=2,this.elementPadding=1,this.topBarHeight=1.75,this.bottomBarHeight=2,this.zIndex=null,this.pendingShowParams=null,this.messages={},this.widget=null,this.maxWidth=0,this.maxHeight=0,this.image=null,this.elementPlace=null,this.displayed=!1,this.displayedElement=null,this.elementPaddingDisplayed=!1,this.topBarDisplayed=!1,this.bottomBarDisplayed=!1,this.displayMode=null,this.title="",this.resources=[],this.currentIndex=0,this.currentResource=null,this.locked=!1,this.noFixed=!1,this.elementFirstFocused=null,this.lastFocus=null,this.ignoreUntilFocusChanges=!1,window.jsu&&(this.language=window.jsu.getCurrentLang()),e){let i;for(i in e)t.indexOf(i)<0?console.error("Unknown attribute given to OverlayDisplayManager: "+i):this[i]=e[i]}this.setLanguage(this.language),"complete"===document.readyState||"interactive"===document.readyState?setTimeout(this._init.bind(this),1):document.addEventListener("DOMContentLoaded",this._init.bind(this)),window.addEventListener("resize",this.onResize.bind(this))}OverlayDisplayManager.version=3,OverlayDisplayManager.prototype._init=function(){isNaN(this.id)||(window.odmIdCount?(window.odmIdCount++,this.id=window.odmIdCount):(window.odmIdCount=1,this.id=1));let e="";"body"==this.overlaySelectorPlace&&"iPad"!=navigator.platform&&"iPhone"!=navigator.platform&&"iPod"!=navigator.platform||(this.noFixed=!0,e="no-fixed"),this.widget=document.createElement("div"),this.widget.setAttribute("id","odm_"+this.id),this.widget.setAttribute("class","odm-main "+e),this.zIndex&&this.widget.setAttribute("style","z-index:"+this.zIndex),this.widget.innerHTML='
',document.querySelector(this.overlaySelectorPlace).appendChild(this.widget),this.elementPlace=this.widget.querySelector(".odm-element-content");const t=this;this.widget.querySelector(".odm-previous").addEventListener("click",function(){t.previous()}),this.widget.querySelector(".odm-next").addEventListener("click",function(){t.next()}),this.widget.querySelector(".odm-close").addEventListener("click",function(){t.locked||t.hide()}),this.widget.querySelector(".odm-closer").addEventListener("click",function(){t.locked||t.hide()}),this.widget.querySelector(".odm-element-content").addEventListener("click",function(){!t.locked&&"image"==t.displayMode&&t.resources.length<2&&t.image&&!t.image.loadingFailed&&t.hide()}),window.addEventListener("keydown",function(e){if(t.displayed)switch(e.keyCode){case 27:!t.locked&&t.hideOnEscape&&(e.stopImmediatePropagation(),t.hide());break;case 37:e.stopImmediatePropagation(),t.previous();break;case 39:e.stopImmediatePropagation(),t.next()}}),this.onResize(),this.pendingShowParams&&this.show(this.pendingShowParams)},OverlayDisplayManager.prototype.trapFocus=function(e){this.ignoreUntilFocusChanges||(this.widget.querySelector(".odm-block").contains(e.target)?this.lastFocus=e.target:(this.focusFirstDescendant(this.widget.querySelector(".odm-block")),this.lastFocus==document.activeElement&&this.focusLastDescendant(this.widget.querySelector(".odm-block")),this.lastFocus=document.activeElement))},OverlayDisplayManager.prototype.focusLastDescendant=function(e){for(let t=e.childNodes.length-1;t>=0;t--){const i=e.childNodes[t];if(this.attemptFocus(i)||this.focusLastDescendant(i))return!0}return!1},OverlayDisplayManager.prototype.focusFirstDescendant=function(e){for(let t=0;t0||0===e.tabIndex&&null!==e.getAttribute("tabIndex"))return!0;if(e.disabled)return!1;switch(e.nodeName){case"A":return!!e.href&&"ignore"!=e.rel;case"INPUT":return"hidden"!=e.type&&"file"!=e.type;case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},OverlayDisplayManager.prototype.setLanguage=function(e){"fr"==e?(this.language="fr",this.messages={close:"Fermer",loading:"Chargement...",notFound:"Image introuvable",unknownResource:"Type de ressource inconnu",previous:"Précédent",next:"Suivant"}):(this.language="en",this.messages={close:"Close",loading:"Loading...",notFound:"Image not found",unknownResource:"Unknown resource type",previous:"Previous",next:"Next"}),this.widget&&(this.widget.querySelector(".odm-close").setAttribute("title",this.messages.close),this.widget.querySelector(".odm-close").setAttribute("aria-label",this.messages.close),this.widget.querySelector(".odm-hover-loading div").innerHTML=this.messages.loading,this.widget.querySelector(".odm-previous b").innerHTML=this.messages.previous,this.widget.querySelector(".odm-next b").innerHTML=this.messages.next)},OverlayDisplayManager.prototype.onResize=function(){let e;this.displayedElement&&this.displayedElement.parentElement==this.elementPlace&&(e=this.displayedElement);let t=15;if(e)try{const i=window.getComputedStyle(e).getPropertyValue("fontSize");i.indexOf("px")>0&&(t=parseFloat(i.replace(/[^0-9.]+/g,"")))}catch(e){}const i=this.margin;let s=this.margin;if(this.topBarDisplayed&&(s+=this.topBarHeight),this.bottomBarDisplayed&&(s+=this.bottomBarHeight),"body"!=this.overlaySelectorPlace){const e=document.querySelector(this.overlaySelectorPlace);this.maxWidth=e.offsetWidth-i*t,this.maxHeight=e.offsetHeight-s*t}else this.maxWidth=window.innerWidth-i*t,this.maxHeight=window.innerHeight-s*t;const o=this.elementPaddingDisplayed?this.elementPadding*t:0;e&&(this.maxWidth>0&&e.style.setProperty("max-width",this.maxWidth-o+"px"),this.maxHeight>0&&e.style.setProperty("max-height",this.maxHeight-o+"px"))},OverlayDisplayManager.prototype._setResources=function(e){if(this.widget&&!this.displayed){this.loadingDisplayed=!0;const e=document.createElement("div");e.setAttribute("class","odm-element odm-loading"),e.innerHTML=this.messages.loading,this._displayElement(e),this.image=null,this.currentResource=null}if(this.resources=[],"string"!=typeof e&&void 0!==e.length)for(let t=0;t1?(e.index&&e.index>0&&e.index0?this.widget.querySelector(".odm-previous").style.setProperty("display","block"):this.widget.querySelector(".odm-previous").style.setProperty("display","none"),this.currentIndex1;t&&!this.topBarDisplayed?(this.topBarDisplayed=!0,this.widget.classList.add("odm-top-bar-displayed"),this.onResize()):!t&&this.topBarDisplayed&&(this.topBarDisplayed=!1,this.widget.classList.remove("odm-top-bar-displayed"),this.onResize())},OverlayDisplayManager.prototype._checkButtonsDisplay=function(e){const t=e.buttons;if(t){if(!t.loaded){this.widget.querySelector(".odm-buttons").innerHTML="";for(let e=0;e=this.resources.length||e<0||(this.widget.querySelector(".odm-resources").innerHTML=e+1+" / "+this.resources.length,e>0?this.widget.querySelector(".odm-previous").style.setProperty("display","block"):this.widget.querySelector(".odm-previous").style.setProperty("display",""),e0&&this.currentIndex+10&&this.currentIndex-1>=0&&this.goToIndex(this.currentIndex-1)},OverlayDisplayManager.prototype._displayElement=function(e,t){const i=this.elementPlace;if(this.displayedElement&&this.displayedElement!=e){const e=this.displayedElement,t=function(){e.parentElement==i&&e.parentElement.removeChild(e),e.style.setProperty("opacity",""),e.style.setProperty("position",""),e.classList.remove("odm-element")};!this.displayed||e.classList.contains("odm-loading")||e.classList.contains("odm-error")?t():(e.style.setProperty("opacity","0"),e.style.setProperty("position","absolute"),setTimeout(t,300))}this.elementPaddingDisplayed=Boolean(t),this.displayedElement=e,e&&e.parentElement!=i&&i.appendChild(e)},OverlayDisplayManager.prototype._refreshElement=function(){this._displayElement(this.displayedElement,this.elementPaddingDisplayed)},OverlayDisplayManager.prototype._displayError=function(e){const t=document.createElement("div");t.innerHTML='
'+(e in this.messages?this.messages[e]:e)+"
",this._displayElement(t)},OverlayDisplayManager.prototype._showLoading=function(){if(this.loadingDisplayed)return;this.loadingDisplayed=!0,null!==this.loadingTimeoutId&&(clearTimeout(this.loadingTimeoutId),this.loadingTimeoutId=null);const e=this;this.loadingTimeoutId=setTimeout(function(){e.widget.classList.add("odm-hover-loading-displayed")},300)},OverlayDisplayManager.prototype._hideLoading=function(){this.loadingDisplayed&&(this.loadingDisplayed=!1,null!==this.loadingTimeoutId&&(clearTimeout(this.loadingTimeoutId),this.loadingTimeoutId=null),this.widget.classList.remove("odm-hover-loading-displayed"))},OverlayDisplayManager.prototype._loadImage=function(e,t){if("image"!=this.displayMode){this.displayMode="image",this.loadingDisplayed=!0;const e=document.createElement("div");e.setAttribute("class","odm-element odm-loading"),e.innerHTML=this.messages.loading,this._displayElement(e)}else if(this.image&&this.image.oriSrc==e.image)return void(t&&t(Boolean(this.image.loadingFailed)));this.image=new Image,this.image.odm=this,this.image.odmCallback=t;const i=e.alt||"";this._showLoading(),this.image.onload=function(){const e=document.createElement("img");e.setAttribute("class","odm-element"),e.setAttribute("alt",i),e.setAttribute("src",this.src),e.setAttribute("style","max-width: "+this.odm.maxWidth+"px; max-height: "+this.odm.maxHeight+"px;"),this.odm._hideLoading(),this.odm._displayElement(e),this.odmCallback&&this.odmCallback(!0)},this.image.onabort=this.image.onload,this.image.onerror=function(){this.loadingFailed=!0,this.odm._hideLoading(),this.odm._displayError("notFound"),this.odmCallback&&this.odmCallback(!1)},this.image.oriSrc=e.image,this.image.src=e.image},OverlayDisplayManager.prototype._loadIframe=function(e,t){"iframe"!=this.displayMode&&(this.displayMode="iframe");const i=e.width?e.width:this.maxWidth+"px",s=e.height?e.height:this.maxHeight+"px",o=document.createElement("iframe");o.setAttribute("class","odm-element"),o.setAttribute("src",e.iframe),o.setAttribute("style","width: "+i+"; height: "+s+";"),this._displayElement(o),t&&t(!0)},OverlayDisplayManager.prototype._loadHTML=function(e,t){let i;"html"!=this.displayMode&&(this.displayMode="html"),"string"==typeof e.html?(i=document.createElement("div")).innerHTML=e.html:(i="detach"in e.html?e.html[0]:e.html).parentElement&&i.parentElement.removeChild(i),i.classList.add("odm-element"),i.style.setProperty("max-width",this.maxWidth-this.elementPadding+"px"),i.style.setProperty("max-height",this.maxHeight-this.elementPadding+"px"),i.style.setProperty("opacity",""),i.style.setProperty("position",""),this._displayElement(i,!0),t&&t(!0)}; \ No newline at end of file +function OverlayDisplayManager(e){const t=["id","language","defaultButtonsClass","overlaySelectorPlace","hideOnEscape","margin","elementPadding","topBarHeight","bottomBarHeight","zIndex"];if(this.id=1,this.language="en",this.defaultButtonsClass="",this.overlaySelectorPlace="body",this.hideOnEscape=!0,this.margin=2,this.elementPadding=1,this.topBarHeight=1.75,this.bottomBarHeight=2,this.zIndex=null,this.pendingShowParams=null,this.messages={},this.widget=null,this.maxWidth=0,this.maxHeight=0,this.image=null,this.elementPlace=null,this.displayed=!1,this.displayedElement=null,this.elementPaddingDisplayed=!1,this.topBarDisplayed=!1,this.bottomBarDisplayed=!1,this.displayMode=null,this.title="",this.resources=[],this.currentIndex=0,this.currentResource=null,this.locked=!1,this.noFixed=!1,this.elementFirstFocused=null,this.lastFocus=null,this.ignoreUntilFocusChanges=!1,window.jsu&&(this.language=window.jsu.getCurrentLang()),e){let i;for(i in e)t.indexOf(i)<0?console.error("Unknown attribute given to OverlayDisplayManager: "+i):this[i]=e[i]}this.setLanguage(this.language),"complete"===document.readyState||"interactive"===document.readyState?setTimeout(this._init.bind(this),1):document.addEventListener("DOMContentLoaded",this._init.bind(this)),window.addEventListener("resize",this.onResize.bind(this))}OverlayDisplayManager.version=3,OverlayDisplayManager.prototype._init=function(){isNaN(this.id)||(window.odmIdCount?(window.odmIdCount++,this.id=window.odmIdCount):(window.odmIdCount=1,this.id=1));let e=[];"body"==this.overlaySelectorPlace&&"iPad"!=navigator.platform&&"iPhone"!=navigator.platform&&"iPod"!=navigator.platform||(this.noFixed=!0,e.push("no-fixed")),window.odmConf&&window.odmConf.extraCssClasses&&(e=e.concat(window.odmConf.extraCssClasses)),this.widget=document.createElement("div"),this.widget.setAttribute("id","odm_"+this.id),this.widget.setAttribute("class","odm-main "+e.join(" ")),this.zIndex&&this.widget.setAttribute("style","z-index:"+this.zIndex),this.widget.innerHTML='
',document.querySelector(this.overlaySelectorPlace).appendChild(this.widget),this.elementPlace=this.widget.querySelector(".odm-element-content");const t=this;this.widget.querySelector(".odm-previous").addEventListener("click",function(){t.previous()}),this.widget.querySelector(".odm-next").addEventListener("click",function(){t.next()}),this.widget.querySelector(".odm-close").addEventListener("click",function(){t.locked||t.hide()}),this.widget.querySelector(".odm-closer").addEventListener("click",function(){t.locked||t.hide()}),this.widget.querySelector(".odm-element-content").addEventListener("click",function(){!t.locked&&"image"==t.displayMode&&t.resources.length<2&&t.image&&!t.image.loadingFailed&&t.hide()}),window.addEventListener("keydown",function(e){if(t.displayed)switch(e.keyCode){case 27:!t.locked&&t.hideOnEscape&&(e.stopImmediatePropagation(),t.hide());break;case 37:e.stopImmediatePropagation(),t.previous();break;case 39:e.stopImmediatePropagation(),t.next()}}),this.onResize(),this.pendingShowParams&&this.show(this.pendingShowParams)},OverlayDisplayManager.prototype.trapFocus=function(e){this.ignoreUntilFocusChanges||(this.widget.querySelector(".odm-block").contains(e.target)?this.lastFocus=e.target:(this.focusFirstDescendant(this.widget.querySelector(".odm-block")),this.lastFocus==document.activeElement&&this.focusLastDescendant(this.widget.querySelector(".odm-block")),this.lastFocus=document.activeElement))},OverlayDisplayManager.prototype.focusLastDescendant=function(e){for(let t=e.childNodes.length-1;t>=0;t--){const i=e.childNodes[t];if(this.attemptFocus(i)||this.focusLastDescendant(i))return!0}return!1},OverlayDisplayManager.prototype.focusFirstDescendant=function(e){for(let t=0;t0||0===e.tabIndex&&null!==e.getAttribute("tabIndex"))return!0;if(e.disabled)return!1;switch(e.nodeName){case"A":return!!e.href&&"ignore"!=e.rel;case"INPUT":return"hidden"!=e.type&&"file"!=e.type;case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},OverlayDisplayManager.prototype.setLanguage=function(e){"fr"==e?(this.language="fr",this.messages={close:"Fermer",loading:"Chargement...",notFound:"Image introuvable",unknownResource:"Type de ressource inconnu",previous:"Précédent",next:"Suivant"}):(this.language="en",this.messages={close:"Close",loading:"Loading...",notFound:"Image not found",unknownResource:"Unknown resource type",previous:"Previous",next:"Next"}),this.widget&&(this.widget.querySelector(".odm-close").setAttribute("title",this.messages.close),this.widget.querySelector(".odm-close").setAttribute("aria-label",this.messages.close),this.widget.querySelector(".odm-hover-loading div").innerHTML=this.messages.loading,this.widget.querySelector(".odm-previous b").innerHTML=this.messages.previous,this.widget.querySelector(".odm-next b").innerHTML=this.messages.next)},OverlayDisplayManager.prototype.onResize=function(){let e;this.displayedElement&&this.displayedElement.parentElement==this.elementPlace&&(e=this.displayedElement);let t=15;if(e)try{const i=window.getComputedStyle(e).getPropertyValue("fontSize");i.indexOf("px")>0&&(t=parseFloat(i.replace(/[^0-9.]+/g,"")))}catch(e){}const i=this.margin;let s=this.margin;if(this.topBarDisplayed&&(s+=this.topBarHeight),this.bottomBarDisplayed&&(s+=this.bottomBarHeight),"body"!=this.overlaySelectorPlace){const e=document.querySelector(this.overlaySelectorPlace);this.maxWidth=e.offsetWidth-i*t,this.maxHeight=e.offsetHeight-s*t}else this.maxWidth=window.innerWidth-i*t,this.maxHeight=window.innerHeight-s*t;const o=this.elementPaddingDisplayed?this.elementPadding*t:0;e&&(this.maxWidth>0&&e.style.setProperty("max-width",this.maxWidth-o+"px"),this.maxHeight>0&&e.style.setProperty("max-height",this.maxHeight-o+"px"))},OverlayDisplayManager.prototype._setResources=function(e){if(this.widget&&!this.displayed){this.loadingDisplayed=!0;const e=document.createElement("div");e.setAttribute("class","odm-element odm-loading"),e.innerHTML=this.messages.loading,this._displayElement(e),this.image=null,this.currentResource=null}if(this.resources=[],"string"!=typeof e&&void 0!==e.length)for(let t=0;t1?(e.index&&e.index>0&&e.index0?this.widget.querySelector(".odm-previous").style.setProperty("display","block"):this.widget.querySelector(".odm-previous").style.setProperty("display","none"),this.currentIndex1;t&&!this.topBarDisplayed?(this.topBarDisplayed=!0,this.widget.classList.add("odm-top-bar-displayed"),this.onResize()):!t&&this.topBarDisplayed&&(this.topBarDisplayed=!1,this.widget.classList.remove("odm-top-bar-displayed"),this.onResize())},OverlayDisplayManager.prototype._checkButtonsDisplay=function(e){const t=e.buttons;if(t){if(!t.loaded){this.widget.querySelector(".odm-buttons").innerHTML="";for(let e=0;e=this.resources.length||e<0||(this.widget.querySelector(".odm-resources").innerHTML=e+1+" / "+this.resources.length,e>0?this.widget.querySelector(".odm-previous").style.setProperty("display","block"):this.widget.querySelector(".odm-previous").style.setProperty("display",""),e0&&this.currentIndex+10&&this.currentIndex-1>=0&&this.goToIndex(this.currentIndex-1)},OverlayDisplayManager.prototype._displayElement=function(e,t){const i=this.elementPlace;if(this.displayedElement&&this.displayedElement!=e){const e=this.displayedElement,t=function(){e.parentElement==i&&e.parentElement.removeChild(e),e.style.setProperty("opacity",""),e.style.setProperty("position",""),e.classList.remove("odm-element")};!this.displayed||e.classList.contains("odm-loading")||e.classList.contains("odm-error")?t():(e.style.setProperty("opacity","0"),e.style.setProperty("position","absolute"),setTimeout(t,300))}this.elementPaddingDisplayed=Boolean(t),this.displayedElement=e,e&&e.parentElement!=i&&i.appendChild(e)},OverlayDisplayManager.prototype._refreshElement=function(){this._displayElement(this.displayedElement,this.elementPaddingDisplayed)},OverlayDisplayManager.prototype._displayError=function(e){const t=document.createElement("div");t.innerHTML='
'+(e in this.messages?this.messages[e]:e)+"
",this._displayElement(t)},OverlayDisplayManager.prototype._showLoading=function(){if(this.loadingDisplayed)return;this.loadingDisplayed=!0,null!==this.loadingTimeoutId&&(clearTimeout(this.loadingTimeoutId),this.loadingTimeoutId=null);const e=this;this.loadingTimeoutId=setTimeout(function(){e.widget.classList.add("odm-hover-loading-displayed")},300)},OverlayDisplayManager.prototype._hideLoading=function(){this.loadingDisplayed&&(this.loadingDisplayed=!1,null!==this.loadingTimeoutId&&(clearTimeout(this.loadingTimeoutId),this.loadingTimeoutId=null),this.widget.classList.remove("odm-hover-loading-displayed"))},OverlayDisplayManager.prototype._loadImage=function(e,t){if("image"!=this.displayMode){this.displayMode="image",this.loadingDisplayed=!0;const e=document.createElement("div");e.setAttribute("class","odm-element odm-loading"),e.innerHTML=this.messages.loading,this._displayElement(e)}else if(this.image&&this.image.oriSrc==e.image)return void(t&&t(Boolean(this.image.loadingFailed)));this.image=new Image,this.image.odm=this,this.image.odmCallback=t;const i=e.alt||"";this._showLoading(),this.image.onload=function(){const e=document.createElement("img");e.setAttribute("class","odm-element"),e.setAttribute("alt",i),e.setAttribute("src",this.src),e.setAttribute("style","max-width: "+this.odm.maxWidth+"px; max-height: "+this.odm.maxHeight+"px;"),this.odm._hideLoading(),this.odm._displayElement(e),this.odmCallback&&this.odmCallback(!0)},this.image.onabort=this.image.onload,this.image.onerror=function(){this.loadingFailed=!0,this.odm._hideLoading(),this.odm._displayError("notFound"),this.odmCallback&&this.odmCallback(!1)},this.image.oriSrc=e.image,this.image.src=e.image},OverlayDisplayManager.prototype._loadIframe=function(e,t){"iframe"!=this.displayMode&&(this.displayMode="iframe");const i=e.width?e.width:this.maxWidth+"px",s=e.height?e.height:this.maxHeight+"px",o=document.createElement("iframe");o.setAttribute("class","odm-element"),o.setAttribute("src",e.iframe),o.setAttribute("style","width: "+i+"; height: "+s+";"),this._displayElement(o),t&&t(!0)},OverlayDisplayManager.prototype._loadHTML=function(e,t){let i;"html"!=this.displayMode&&(this.displayMode="html"),"string"==typeof e.html?(i=document.createElement("div")).innerHTML=e.html:(i="detach"in e.html?e.html[0]:e.html).parentElement&&i.parentElement.removeChild(i),i.classList.add("odm-element"),i.style.setProperty("max-width",this.maxWidth-this.elementPadding+"px"),i.style.setProperty("max-height",this.maxHeight-this.elementPadding+"px"),i.style.setProperty("opacity",""),i.style.setProperty("position",""),this._displayElement(i,!0),t&&t(!0)}; \ No newline at end of file diff --git a/src/odm.js b/src/odm.js index 91150a9..95533a6 100644 --- a/src/odm.js +++ b/src/odm.js @@ -91,14 +91,17 @@ OverlayDisplayManager.prototype._init = function () { this.id = 1; } } - let extraClass = ''; + let extraClass = []; if (this.overlaySelectorPlace != 'body' || navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod') { this.noFixed = true; - extraClass = 'no-fixed'; + extraClass.push('no-fixed'); + } + if (window.odmConf && window.odmConf.extraCssClasses) { + extraClass = extraClass.concat(window.odmConf.extraCssClasses); } this.widget = document.createElement('div'); this.widget.setAttribute('id', 'odm_' + this.id); - this.widget.setAttribute('class', 'odm-main ' + extraClass); + this.widget.setAttribute('class', 'odm-main ' + extraClass.join(' ')); if (this.zIndex) { this.widget.setAttribute('style', 'z-index:' + this.zIndex); }