1/** 2 * @file 3 * Toggle buttons. 4 */ 5 6(function ($, Drupal) { 7 8 'use strict'; 9 10 Drupal.behaviors.utdanning_toggle_buttons = { 11 attach: function (context, settings) { 12 if (context !== document) { 13 return; 14 } 15 $(function () { 16 var $plusMinusButtons = $('.plus-minus-button'); 17 18 if ($plusMinusButtons.length) { 19 20 $plusMinusButtons.click(function () { 21 const showing = $(this).html().trim() === 'Vis'; 22 $(this).html((showing) ? 'Skjul' : 'Vis'); 23 $($(this).data('additionalControls')).toggleClass('collapse'); 24 }); 25 } 26 27 var $visFlereButtons = $('.vis-flere'); 28 29 if ($visFlereButtons.length) { 30 31 $visFlereButtons.click(function () { 32 $(this).html(($(this).html().trim() === 'Vis flere +') ? 'Vis færre -' : 'Vis flere +'); 33 }); 34 } 35 36 var $kontaktinfoToggle = $('.kontaktinfo-toggle'); 37 38 if ($kontaktinfoToggle.length) { 39 40 $kontaktinfoToggle.click(function () { 41 $(this).html(($(this).html().trim() === 'Vis kontaktinfo') ? 'Lukk kontaktinfo' : 'Vis kontaktinfo'); 42 $(this).toggleClass('open'); 43 $('.kontaktinfo-content').toggleClass('hide'); 44 }); 45 } 46 47 // Tabs on the bedrift page. 48 var $unoTabs = $('[data-toggle="uno-tab"]'); 49 50 if ($unoTabs.length) { 51 52 $unoTabs.click(function (e) { 53 e.preventDefault(); 54 // Handle the height of the background element. 55 var id = $(this).data('target'); 56 var height = $(this).outerHeight(); 57 58 if ($(this).hasClass('active') && window.innerWidth <= 992) { 59 $(this).removeClass('active'); 60 $('#' + id).removeClass('show').removeClass('active'); 61 $('.section-tab').removeClass('active'); 62 $('.bg-' + id).removeClass('active'); 63 } 64 else { 65 $('.uno-tab-pane').removeClass('show').removeClass('active'); 66 $('.col-bg').removeClass('active'); 67 $('#' + id).addClass('show').addClass('active'); 68 $('.bg-' + id).addClass('active').height(height); 69 70 if (window.innerWidth > 992) { 71 var containerHeight = $('#' + id).height(); 72 if (containerHeight > _GLOBAL_initialTableHeight) { 73 $('.yrke-section').height(containerHeight + 60); 74 $('.col-right-overlay').height(containerHeight + 60); 75 } 76 else { 77 $('.yrke-section').height(_GLOBAL_initialTableHeight); 78 $('.col-right-overlay').height(_GLOBAL_initialTableHeight); 79 } 80 // Handle the possible sub-links that need the background of the element changed. 81 $('.sub-link').removeClass('active'); 82 if ($(this).closest('.sub-link').length) { 83 $(this).closest('.sub-link').addClass('active'); 84 } 85 // Set the current element active. 86 $('.section-tab').removeClass('active'); 87 $(this).addClass('active'); 88 } 89 // For mobile: 90 else { 91 var divHeight = $('#' + id).height() + $('.col-' + id).height(); 92 $('.bg-' + id).height(divHeight); 93 $('.section-tab').removeClass('active'); 94 $('#' + id + '-tab').addClass('active'); 95 $('#' + id).addClass('show').addClass('active'); 96 } 97 } 98 99 }); 100 } 101 }); 102 } 103 }; 104 105})(jQuery, Drupal);
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.