main.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. console.log('salut');
  2. // menu burger open
  3. var burger = document.getElementById("block-burger");
  4. var burgertitle = document.getElementById("block-burger-menu");
  5. burgertitle.addEventListener("click", toggleMenu);
  6. function toggleMenu(event) {
  7. console.log(event);
  8. burger.classList.toggle('opened');
  9. }
  10. // faq reponse open
  11. var answers = document.getElementsByClassName("field--name-field-reponse");
  12. var questions = document.getElementsByClassName("field--name-field-question");
  13. for (let i = 0; i < questions.length; i++) {
  14. const question = questions[i]
  15. question.addEventListener("click", toggleFaq);
  16. }
  17. function toggleFaq(event) {
  18. console.log(event);
  19. for (let i = 0; i < answers.length; i++) {
  20. const answer = answers[i]
  21. answer.classList.toggle('opened');}
  22. }
  23. // open external link in new window
  24. // $(".ext").each(
  25. // function(i,e){
  26. // window.open(e, '_blank');
  27. // }
  28. // );
  29. // var target = document.getElementsByClassName("ext");
  30. // document.addEventListener("click", function(e) {
  31. // if (e.target == true )
  32. // {
  33. // e.target.setAttribute("target", "_blank");
  34. // }
  35. // });
  36. // add id to field
  37. // Add data-extlink attribute.
  38. // $links_to_process.attr('data-extlink', '');
  39. // var i;
  40. // var length = $links_to_process.length;
  41. // for (i = 0; i < length; i++) {
  42. // var $link = $($links_to_process[i]);
  43. // if (drupalSettings.data.extlink.extUseFontAwesome) {
  44. // if (class_name === drupalSettings.data.extlink.mailtoClass) {
  45. // $link[icon_placement]('<span class="fa-' + class_name + ' extlink"><span class="' + drupalSettings.data.extlink.extFaMailtoClasses + '" aria-label="' + drupalSettings.data.extlink.mailtoLabel + '"></span></span>');
  46. // }
  47. // else {
  48. // $link[icon_placement]('<span class="fa-' + class_name + ' extlink"><span class="' + drupalSettings.data.extlink.extFaLinkClasses + '" aria-label="' + drupalSettings.data.extlink.extLabel + '"></span></span>');
  49. // }
  50. // }
  51. // else {
  52. // if (class_name === drupalSettings.data.extlink.mailtoClass) {
  53. // $link[icon_placement]('<svg focusable="false" class="' + class_name + '" role="img" aria-label="' + drupalSettings.data.extlink.mailtoLabel + '" xmlns="http://www.w3.org/2000/svg" viewBox="0 10 70 20"><metadata><sfw xmlns="http://ns.adobe.com/SaveForWeb/1.0/"><sliceSourceBounds y="-8160" x="-8165" width="16389" height="16384" bottomLeftOrigin="true"/><optimizationSettings><targetSettings targetSettingsID="0" fileFormat="PNG24Format"><PNG24Format transparency="true" filtered="false" interlaced="false" noMatteColor="false" matteColor="#FFFFFF"/></targetSettings></optimizationSettings></sfw></metadata><title>' + drupalSettings.data.extlink.mailtoLabel + '</title><path d="M56 14H8c-1.1 0-2 0.9-2 2v32c0 1.1 0.9 2 2 2h48c1.1 0 2-0.9 2-2V16C58 14.9 57.1 14 56 14zM50.5 18L32 33.4 13.5 18H50.5zM10 46V20.3l20.7 17.3C31.1 37.8 31.5 38 32 38s0.9-0.2 1.3-0.5L54 20.3V46H10z"/></svg>');
  54. // }
  55. // else {
  56. // $link[icon_placement]('<svg focusable="false" class="' + class_name + '" role="img" aria-label="' + drupalSettings.data.extlink.extLabel + '" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 40"><metadata><sfw xmlns="http://ns.adobe.com/SaveForWeb/1.0/"><sliceSourceBounds y="-8160" x="-8165" width="16389" height="16384" bottomLeftOrigin="true"/><optimizationSettings><targetSettings targetSettingsID="0" fileFormat="PNG24Format"><PNG24Format transparency="true" filtered="false" interlaced="false" noMatteColor="false" matteColor="#FFFFFF"/></targetSettings></optimizationSettings></sfw></metadata><title>' + drupalSettings.data.extlink.extLabel + '</title><path d="M48 26c-1.1 0-2 0.9-2 2v26H10V18h26c1.1 0 2-0.9 2-2s-0.9-2-2-2H8c-1.1 0-2 0.9-2 2v40c0 1.1 0.9 2 2 2h40c1.1 0 2-0.9 2-2V28C50 26.9 49.1 26 48 26z"/><path d="M56 6H44c-1.1 0-2 0.9-2 2s0.9 2 2 2h7.2L30.6 30.6c-0.8 0.8-0.8 2 0 2.8C31 33.8 31.5 34 32 34s1-0.2 1.4-0.6L54 12.8V20c0 1.1 0.9 2 2 2s2-0.9 2-2V8C58 6.9 57.1 6 56 6z"/></svg>');
  57. // }
  58. // }
  59. // }
  60. // };