1/** 2 * @file 3 * Webform behaviors. 4 */ 5 6(function ($, Drupal) { 7 8 'use strict'; 9 10 // Trigger Drupal's attaching of behaviors after the page is 11 // completely loaded. 12 // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button 13 // @see https://stackoverflow.com/questions/20899274/how-to-refresh-page-on-back-button-click/20899422#20899422 14 var isChrome = (/chrom(e|ium)/.test(window.navigator.userAgent.toLowerCase())); 15 if (isChrome) { 16 // Track back button in navigation. 17 // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button 18 var backButton = false; 19 if (window.performance) { 20 var navEntries = window.performance.getEntriesByType('navigation'); 21 if (navEntries.length > 0 && navEntries[0].type === 'back_forward') { 22 backButton = true; 23 } 24 else if (window.performance.navigation 25 && window.performance.navigation.type === window.performance.navigation.TYPE_BACK_FORWARD) { 26 backButton = true; 27 } 28 } 29 30 // If the back button is pressed, delay Drupal's attaching of behaviors. 31 if (backButton) { 32 var attachBehaviors = Drupal.attachBehaviors; 33 Drupal.attachBehaviors = function (context, settings) { 34 setTimeout(function (context, settings) { 35 attachBehaviors(context, settings); 36 }, 300); 37 }; 38 } 39 } 40 41})(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.