diff --git a/assets/js/spoiler.js b/assets/js/spoiler.js index 3406b6c36a..b0c07ae2c6 100644 --- a/assets/js/spoiler.js +++ b/assets/js/spoiler.js @@ -9,6 +9,7 @@ function buildSpoilers($elem){ $elem.each(function(){ + $(this).addClass("spoiler-build"); $(this).before($("", { text: "Afficher/Masquer le contenu masqué", class: "spoiler-title ico-after view", @@ -24,7 +25,9 @@ $(document).ready(function(){ buildSpoilers($("#content .spoiler")); $("#content").on("DOMNodeInserted", ".spoiler", function(e){ - buildSpoilers($(e.target)); + if($(e.target).is(".spoiler:not(.spoiler-build)")){ + buildSpoilers($(e.target)); + } }); }); })(document, jQuery); \ No newline at end of file