1/** 2 * @file 3 * Global utilities. 4 * 5 */ 6 7(function ($, Drupal, once, drupalSettings) { 8 9 var initialized; 10 var grid; 11 var masonryOptions; 12 var openOffcanvas; 13 var openOffcanvasObj; 14 openOffcanvas = function(){ 15 var offcanvasDom = document.getElementById('offcanvasContent'); 16 var offcanvas = new bootstrap.Offcanvas(offcanvasDom); 17 return offcanvas; 18 } 19 20 function init(context, settings) { 21 if (!initialized) { 22 23 initialized = true; 24 25 var windowWidth = $(window).width(); 26 var windowHeight = $(window).height(); 27 28 // OnScroll event handler 29 const onScroll = () => { 30 // Get scroll value 31 const scroll = document.documentElement.scrollTop 32 // If scroll value is more than 0 - add class 33 if (scroll > 0) { 34 document.body.classList.add("scrolled"); 35 } else { 36 document.body.classList.remove("scrolled") 37 } 38 } 39 40 // Use the function 41 window.addEventListener('scroll', onScroll); 42 43 44 // OFF CANVAS 45 $('[data-toggle="offcanvas"]').on('click', function () { 46 $('.offcanvas-collapse').toggleClass('open') 47 }) 48 // TOOLTIPS 49 //$('.goTooltip').tooltip(); 50 51 // MODAL DISABLE PAGE 52 $('#MenuModal').on('shown.bs.modal', function () { 53 $('#page-wrapper').attr('aria-hidden','true'); 54 $(this).removeAttr('aria-modal'); 55 }) 56 $('#MenuModal').on('hidden.bs.modal', function () { 57 $('#page-wrapper').attr('aria-hidden','false'); 58 $(this).removeAttr('aria-modal'); 59 }); 60 61 // SCROLL SPY 62 // if($('.list-spy').length) { 63 // var id = $('.list-spy').attr('id'); 64 // $('body').scrollspy({ target: '#'+id, offset: 200 }); 65 // } 66 67 // ACCORDION 68 $('.accordion-all-open').on('click', function (e) { 69 e.preventDefault(); 70 71 var accordionParentID = $(this).data('target'); 72 $(accordionParentID).find('.collapse').removeAttr('data-parent').collapse('show').attr('data-parent', accordionParentID); 73 $('.accordion-all-actions a').removeClass('active'); 74 $(this).addClass('active'); 75 76 }); 77 $('.accordion-all-close').on('click', function (e) { 78 e.preventDefault(); 79 80 var accordionParentID = $(this).data('target'); 81 $(accordionParentID).find('.collapse').attr('data-parent', accordionParentID).collapse('hide'); 82 $('.accordion-all-actions a').removeClass('active'); 83 $(this).addClass('active'); 84 85 }); 86 87 // SPECIAL HIDE FORM ELEMENTS 88 $('.special-hide').fadeOut(100); 89 $(document).on('focus', '.special-show', function(e){ 90 //if(!$('.special-hide:visible')) { 91 $('.special-hide').fadeIn(350); 92 //} 93 }); 94 95 $('.navbar-toggler').on('click', function(e){ 96 if(!$(this).hasClass('collapsed')) { $('body').addClass('nav-open'); } 97 else { $('body').removeClass('nav-open'); } 98 }); 99 100 welcomeKitReady(function() { var wk = new WelcomeKitEmbed('YI75Rd'); wk.group('job'); wk.display(["department","officeCity","contractType"]); wk.locale('fr'); wk.website('wttj_fr'); wk.render(); }); 101 102 } 103 } 104 105 Drupal.behaviors.sidiese = { 106 attach: function (context, settings) { 107 // RUN ONCE ELEMENTS 108 init(context, settings); 109 //var bLazy = new Blazy(); 110 var windowWidth = $(window).width(); 111 var winHeight = $(window).height(); 112 // OPEN IN OFFCANVAS 113 //$(document, context).once('offcanvasopencontent').on('click', '.offcanvas-open', function (e) { 114 $(once('offcanvasopencontent', '.offcanvas-open', context)).on('click', function (e) { 115 e.preventDefault(); 116 $('#offcanvasContent .offcanvas-body').html('<div class="text-align-center throbber"><div class="spinner-grow" role="status"><span class="visually-hidden">Loading...</span></div></div>'); 117 const title = $(this).attr('title') ? $(this).attr('title') : ''; 118 $('#offcanvasContentLabel').html(title); 119 openOffcanvasObj = openOffcanvas(); 120 openOffcanvasObj.show(); 121 var href = $(this).attr('href'); 122 Drupal.ajax({url: href, wrapper: 'custom-ajax-content', method: 'html'}).execute().done( function(){ 123 //$('#offcanvasProduct .offcanvas-body').html(data); 124 }); 125 }); 126 127 $(once('offcanvasopencontent-webform', '.offcanvas-open-webform', context)).on('click', function (e) { 128 e.preventDefault(); 129 $('#offcanvasContent .offcanvas-body').html('<div class="text-align-center throbber"><div class="spinner-grow" role="status"><span class="visually-hidden">Loading...</span></div></div>'); 130 const p = $(this).parents('.cat-start') 131 $('#offcanvasContentLabel').html(p.data('t')) 132 openOffcanvasObj = openOffcanvas() 133 openOffcanvasObj.show() 134 const href = `${p.data('wf')}?id=${p.data('id')}&d=${$(this).data('d')}&t=${$(this).data('t')}&u=${$(this).data('u')}` 135 const ajaxExecute = Drupal.ajax({url: href, wrapper: 'custom-ajax-content', method: 'html'}).execute() 136 ajaxExecute.done( function(){ 137 $('screen-webform-load').addClass('showed') 138 screen_section_show('.screen-webform-load') 139 //console.log('WF loaded') 140 }) 141 .fail(function() { 142 alert( "error" ); 143 }) 144 }); 145 } 146 }; 147 148})(jQuery, Drupal, once, drupalSettings); 149
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.