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