Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
fix: error placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
gustaveWPM committed Oct 4, 2023
1 parent e8ab492 commit 66fedb3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions docs/assets/maugallery.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// * ... Prefix Class
const _mauGalleryManager = {
mauGalleryGlobalConfig: {
mauPrefixClass: typeof _asyncMauGalleryLauncher !== 'undefined' ? _asyncMauGalleryLauncher.Launcher.globalMauGalleryConfig.mauPrefixClass : 'mau'
mauPrefixClass: typeof _asyncMauGalleryLauncher !== 'undefined' ? _asyncMauGalleryLauncher.Launcher.globalMauGalleryConfig.mauPrefixClass : 'mau',
galleryPlaceholderClass: typeof _asyncMauGalleryLauncher !== 'undefined' ? _asyncMauGalleryLauncher.Launcher.globalMauGalleryConfig.galleryPlaceholderClass : 'gallery-placeholder'
}
};

Expand All @@ -15,7 +16,6 @@ Object.assign(_mauGalleryManager.mauGalleryGlobalConfig, {
modalTriggerClass: 'modal-trigger',
galleryItemClass: 'gallery-item',
modalWrapperClass: 'modal-component',
galleryPlaceHolderClass: 'gallery-placeholder',
styles: {
animation: {
modal: {
Expand Down Expand Up @@ -1077,8 +1077,8 @@ if (typeof _asyncMauGalleryLauncher === 'undefined') {

_mauGalleryManager.mauGalleriesConfig.forEach((conf) => {
new _mauGalleryManager.MauGallery(conf);
const galleryPlaceHolderClass = _mauGalleryManager.options('galleryPlaceHolderClass');
const placeholder = document.querySelector(`#${conf.galleryRootNodeId} .${galleryPlaceHolderClass}`);
const galleryPlaceholderClass = _mauGalleryManager.options('galleryPlaceholderClass');
const placeholder = document.querySelector(`#${conf.galleryRootNodeId} .${galleryPlaceholderClass}`);
if (placeholder) placeholder.remove();
});
}
16 changes: 9 additions & 7 deletions docs/assets/maugalleryLauncher.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
let _asyncMauGalleryLauncher = {
LauncherCls: class LauncherCls {
constructor() {
this.failedToLoadMauGalleryMsg = 'Failed to load MauGallery! Please, retry to load this page.';
this.failedToLoadMauGalleryMsg = 'Failed to load MauGallery! Please, try to refresh this page.';
this.boostrapIsAsyncLoadedSomewhereElseInMyCodebasePleaseDoNotAsyncLoadItHereImBeggingYou = false;
this.globalMauGalleryConfig = {
mauPrefixClass: 'mau'
mauPrefixClass: 'mau',
galleryPlaceholderClass: 'gallery-placeholder'
};

this.readyToMountGalleriesComponents = false;
Expand Down Expand Up @@ -43,8 +44,8 @@ let _asyncMauGalleryLauncher = {
clearInterval(coroutine);
launcherPtr.Launcher.mauGalleriesConfig.forEach((conf) => {
new _mauGalleryManager.MauGallery(conf);
const galleryPlaceHolderClass = _mauGalleryManager.options('galleryPlaceHolderClass');
const placeholder = document.querySelector(`#${conf.galleryRootNodeId} .${galleryPlaceHolderClass}`);
const galleryPlaceholderClass = _mauGalleryManager.options('galleryPlaceholderClass');
const placeholder = document.querySelector(`#${conf.galleryRootNodeId} .${galleryPlaceholderClass}`);
if (placeholder) placeholder.remove();
});
}
Expand Down Expand Up @@ -482,10 +483,11 @@ let _asyncMauGalleryLauncher = {
errorCallbacks: [
async function failedToInjectMauGallery() {
const mauPrefixClass = _asyncMauGalleryLauncher.Launcher.globalMauGalleryConfig.mauPrefixClass;
const galleryPlaceHolderClass = _asyncMauGalleryLauncher.Launcher.globalMauGalleryConfig.galleryPlaceHolderClass;
const placeholders = document.querySelectorAll(`.${mauPrefixClass}.${galleryPlaceHolderClass}`);
const galleryPlaceholderClass = _asyncMauGalleryLauncher.Launcher.globalMauGalleryConfig.galleryPlaceholderClass;
const placeholders = document.querySelectorAll(`.${mauPrefixClass}.${galleryPlaceholderClass}`);
placeholders.forEach(
(element) => (element.outerHTML = `<div class="mau gallery-placeholder alert alert-danger" role="alert">${_asyncMauGalleryLauncher.Launcher.failedToLoadMauGalleryMsg}</div>`)
(element) =>
(element.outerHTML = `<div class="${mauPrefixClass} ${galleryPlaceholderClass} alert alert-danger" role="alert">${_asyncMauGalleryLauncher.Launcher.failedToLoadMauGalleryMsg}</div>`)
);
}
]
Expand Down

0 comments on commit 66fedb3

Please sign in to comment.