1/** 2 * @file 3 * Global utilities. 4 * 5 */ 6(function ($, Drupal) { 7 "use strict"; 8 9 Drupal.behaviors.jobtwinner_barrio = { 10 attach: function (context, settings) { 11 12 /*$('.form-control').on('focus blur', function (e) { 13 $(this).parents('.js-form-item').toggleClass('focused', (e.type === 'focus' || this.value.length > 0)); 14 }).trigger('blur');*/ 15 var checkAutoFill = function(){ 16 //console.log("check"); 17 $('.form-control:-webkit-autofill').each(function(){ 18 $(this).closest('.js-form-item').addClass('autofilled'); 19 }); 20 } 21 $('.js-form-item').floatingFormLabels(); 22 23 // Check that not too many elements are active in overlay form 24 $('.profile-mein-wunschjob-edit-form.profile-form input[type=checkbox]').change(function() { 25 if ($('.profile-mein-wunschjob-edit-form.profile-form input:checkbox:checked').length > '4'){ 26 $(this).prop('checked', false); 27 alert("Es sind maximal 4 Positionen möglich."); 28 }; 29 }); 30 31 $('.profile-meine-berufserfahrung-edit-form.profile-form input[type=checkbox]').change(function() { 32 if ($('.profile-meine-berufserfahrung-edit-form.profile-form input:checkbox:checked').length > '4'){ 33 $(this).prop('checked', false); 34 alert("Es sind maximal 4 Positionen möglich."); 35 }; 36 }); 37 38 /* 39 * Put it on the 'input' event 40 * (happens on every change in an input field) 41 */ 42 $('html').on('input', function() { 43 $('.js-form-item').removeClass('autofilled'); 44 checkAutoFill(); 45 }); 46 $.fn.onAutoFillEvent = function (callback) { 47 var el = $(this), 48 lastText = "", 49 maxCheckCount = 10, 50 checkCount = 0; 51 52 (function infunc() { 53 var text = el.val(); 54 55 if (text != lastText) { 56 lastText = text; 57 callback(el); 58 } 59 if (checkCount > maxCheckCount) { 60 return false; 61 } 62 checkCount++; 63 setTimeout(infunc, 100); 64 }()); 65 }; 66 67 //var rellax = new Rellax('.rellax'); 68 $(".colorbox-youtube").colorbox({iframe:true, innerWidth:480, innerHeight:390}); 69 var cboxOptions = { 70 width: '95%', 71 height: '60%', 72 maxWidth: '960px', 73 maxHeight: '660px', 74 } 75 76 $('.colorbox-youtube').colorbox(cboxOptions); 77 78 $(document).ready(function() { 79 console.log("ready"); 80 if ($(window).width() < 767) { 81 console.log("small"); 82 $('.menu--main .dropdown-toggle').each(function(){ 83 ///$(this).attr('data-bs-toggle','dropdown'); 84 }) 85 } 86 87 var $overlayWrapper = $('.inserat-preview-overlay-wrapper:not(.processed)'); 88 $overlayWrapper.each(function() { 89 var $this = $(this); 90 $("#drupal-modal").scrollTop(0); 91 92 $this.addClass('processed'); 93 console.log($this); 94 95 $this.find('button').on('click', function(e) { 96 e.preventDefault(); 97 console.log('close overlay'); 98 99 $this.remove(); 100 }) 101 }); 102 }) 103 104 /* 105 * trigger it also inside a timeOut event 106 * (happens after chrome auto-filled fields on page-load) 107 */ 108 window.onload = function(){ 109 //console.log("ready"); 110 if ($(window).width() < 767) { 111 console.log("smaller"); 112 $('.menu--main .dropdown-toggle').each(function(){ 113 $(this).after( '<span class="" aria-expanded="false" style="position: absolute; z-index: 1; right: 0; top: 0; width: 30px; height: 30px; " data-bs-toggle="dropdown" data-toggle="dropdown"></span>' ); 114 //$(this).attr('data-bs-toggle','dropdown'); 115 }) 116 } 117 setTimeout(function(){ 118 checkAutoFill(); 119 }, 0); 120 121 122 $("form input").each(function (i, element) { 123 var el = $(element); 124 125 el.onAutoFillEvent( 126 function () { 127 el.addClass('used'); 128 el.closest('.js-form-item').addClass('ffl-floated'); 129 } 130 ); 131 }); 132 133 }; 134 135 }, 136 }; 137})(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.