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