1(function ($, Drupal, drupalSettings) { 2 3 $(document).idle({ 4 onIdle: function () { 5 // Bail, if settings that we depend on is not set. 6 if (!drupalSettings.jysk_promo) { 7 return; 8 } 9 var localStorage = window.localStorage; 10 var jyskPromo = JSON.parse(localStorage.getItem('jyskPromoExpiry')); 11 12 if (!jyskPromo || !jyskPromo.value || jyskPromo.expiry < new Date().getTime()) { 13 JyskAjaxThrobber('show'); 14 var options = { 15 'body': drupalSettings.jysk_promo.body, 16 'styleBgColor': drupalSettings.jysk_promo.styleBgColor, 17 }; 18 jysk.notification.openNotification(Drupal.theme('jysk_promo_modal', options), 'jyskPromo'); 19 JyskAjaxThrobber('hide'); 20 dataLayerPush('promotion-push', { 21 promotion_push: 'Shown', 22 promotion_push_url: $(location).attr('pathname') 23 }); 24 setLocalStorageJyskPromo(); 25 } 26 else { 27 // Prevent any further idling. 28 $(this).trigger('idle:stop'); 29 } 30 }, 31 events: 'mousemove mouseup mousedown touchstart mouseenter scroll resize', 32 idle: parseInt(drupalSettings.jysk_promo?.idleTime), 33 }); 34 35 // We should show modal once per day (24 hours). 36 function setLocalStorageJyskPromo() { 37 var daysPass = drupalSettings.jysk_promo.daysPass ? parseInt(drupalSettings.jysk_promo.daysPass) : 30; 38 var dayInMs = 24 * 60 * 60 * 1000 * daysPass; 39 var item = { 40 value: '1', 41 expiry: Date.now() + dayInMs, 42 } 43 window.localStorage.setItem('jyskPromoExpiry', JSON.stringify(item)); 44 } 45 46})(jQuery, Drupal, drupalSettings);
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.