diff --git a/js/checkbox.js b/js/checkbox.js index 739d3fa..e8d9dff 100755 --- a/js/checkbox.js +++ b/js/checkbox.js @@ -14,11 +14,3 @@ ''; })(Drupal); -jQuery( window ).on( "load", function() { - console.log( "window loaded" ); - //jQuery(".mirador80").remove(); - //jQuery(".mirador104").click(); -// jQuery('.mirador104 button.MuiButtonBase-root.MuiIconButton-root').trigger('click'); - -}); - diff --git a/js/custom.js b/js/custom.js index d343768..c67e6e1 100644 --- a/js/custom.js +++ b/js/custom.js @@ -2,23 +2,55 @@ //stuff goes here })(Drupal); -(function ($) { - - Drupal.behaviors.LangSwitchBehavior = { - attach: function (context, settings) { - $("#text-fr").hide(); - - $( "#show-text-en" , context).click(function(e) { - e.preventDefault(); - $("#text-en").show(); - $("#text-fr").hide(); - }); - $( "#show-text-fr" , context).click(function(e) { - e.preventDefault(); - $("#text-en").hide(); - $("#text-fr").show(); - }); - } - }; - -}(jQuery)); + +(function (Drupal) { + Drupal.behaviors.LangSwitchBehavior = { + attach: function (context, settings) { + const textEn = context.querySelector('#text-en'); + const textFr = context.querySelector('#text-fr'); + const showEn = context.querySelector('#show-text-en'); + const showFr = context.querySelector('#show-text-fr'); + + // Hide French text initially + if (textFr) { + textFr.style.display = 'none'; + } + + if (showEn && textEn && textFr) { + showEn.addEventListener('click', function (e) { + e.preventDefault(); + textEn.style.display = ''; + textFr.style.display = 'none'; + }); + } + + if (showFr && textEn && textFr) { + showFr.addEventListener('click', function (e) { + e.preventDefault(); + textEn.style.display = 'none'; + textFr.style.display = ''; + }); + } + } + }; +})(Drupal); +//(function ($) { + + //Drupal.behaviors.LangSwitchBehavior = { + //attach: function (context, settings) { + //$("#text-fr").hide(); + + //$( "#show-text-en" , context).click(function(e) { + //e.preventDefault(); + //$("#text-en").show(); + //$("#text-fr").hide(); + //}); + //$( "#show-text-fr" , context).click(function(e) { + //e.preventDefault(); + //$("#text-en").hide(); + //$("#text-fr").show(); + //}); + //} + //}; + +//}(jQuery));