diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml index 1ab4c71cfc6cc11651827d0a5eaff640da0179a4..53f85561e2b5fce2c02b6557cb1d2ac089740d3c 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-themes/xwiki-platform-flamingo-theme-ui/src/main/resources/FlamingoThemesCode/ThemeSheet.xml @@ -362,9 +362,14 @@ // Put a gray curtain in front of the iframe var addCurtain = function() { - var iframePosition = iframe.position(); - $("<div id=\"preview-curtain\"><h2>$services.localization.render('platform.flamingo.themes.loading')</h2></div>").insertAfter(iframe); var previewCurtain = $("#preview-curtain"); + if (previewCurtain.length > 0) { + // The curtain already exist, do nothing. + return; + } + var iframePosition = iframe.position(); + previewCurtain = $("<div id=\"preview-curtain\"><h2>$services.localization.render('platform.flamingo.themes.loading')</h2></div>"); + previewCurtain.insertAfter(iframe); previewCurtain.width(iframe.outerWidth(true)); previewCurtain.height(iframe.outerHeight(true)); previewCurtain.css("left", iframePosition.left); @@ -501,7 +506,6 @@ // 3: Refresh the live preview waitUntilLessIsLoadedInIFrame(function(){ - removeCurtain(); // We need to refresh just after LESS is loaded because the fist rendering does not handle the variables of the // flamingo theme. Unfortunately, it means that the preview is rendered twice at the loading of the page. // We refresh it in a thread to avoid blocking the browser. @@ -509,8 +513,8 @@ }); }; - // Initialize the iframe - waitUntilIFrameIsLoaded(initIframe); + // Add the curtain which will be removed when the iframe will be loaded and the LESS code compiled + addCurtain() // The user can navigate to an other page inside the iframe, so when the page changes (onload), // we re-init the iframe to use LESS iframe.load(initIframe);