Changeset 56809
- Timestamp:
- 10/09/2023 09:29:42 PM (16 months ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/post.js
r55561 r56809 512 512 return __( 'The changes you made will be lost if you navigate away from this page.' ); 513 513 } 514 }).on( ' unload.edit-post', function( event ) {514 }).on( 'pagehide.edit-post', function( event ) { 515 515 if ( ! releaseLock ) { 516 516 return; -
trunk/src/js/_enqueues/lib/gallery.js
r50547 r56809 89 89 }); 90 90 91 jQuery(window).on( 'unload', function () { window.tinymce = window.tinyMCE = window.wpgallery = null; } ); // Cleanup.92 93 91 /* gallery settings */ 94 92 window.tinymce = null; -
trunk/src/js/_enqueues/wp/heartbeat.js
r53226 r56809 224 224 } 225 225 226 $(window).on( ' unload.wp-heartbeat', function() {226 $(window).on( 'pagehide.wp-heartbeat', function() { 227 227 // Don't connect anymore. 228 s ettings.suspend = true;228 suspend(); 229 229 230 230 // Abort the last request if not completed. … … 233 233 } 234 234 }); 235 236 $(window).on( 237 'pageshow.wp-heartbeat', 238 /** 239 * Handles pageshow event, specifically when page navigation is restored from back/forward cache. 240 * 241 * @param {jQuery.Event} event 242 * @param {PageTransitionEvent} event.originalEvent 243 */ 244 function ( event ) { 245 if ( event.originalEvent.persisted ) { 246 /* 247 * When page navigation is stored via bfcache (Back/Forward Cache), consider this the same as 248 * if the user had just switched to the tab since the behavior is similar. 249 */ 250 focused(); 251 } 252 } 253 ); 235 254 236 255 // Check for user activity every 30 seconds. … … 542 561 543 562 // Resume if suspended. 544 settings.suspend = false;563 resume(); 545 564 546 565 if ( ! settings.hasFocus ) { … … 551 570 552 571 /** 572 * Suspends connecting. 573 */ 574 function suspend() { 575 settings.suspend = true; 576 } 577 578 /** 579 * Resumes connecting. 580 */ 581 function resume() { 582 settings.suspend = false; 583 } 584 585 /** 553 586 * Runs when the user becomes active after a period of inactivity. 554 587 * … … 594 627 // Always suspend after 60 minutes of inactivity. This will release the post lock, etc. 595 628 if ( ( settings.suspendEnabled && lastActive > 600000 ) || lastActive > 3600000 ) { 596 s ettings.suspend = true;629 suspend(); 597 630 } 598 631 -
trunk/src/js/_enqueues/wp/mce-view.js
r48650 r56809 644 644 } 645 645 646 function reload() {647 if ( ! editor.isHidden() ) {648 $( node ).data( 'rendered', null );649 650 setTimeout( function() {651 wp.mce.views.render();652 } );653 }654 }655 656 646 function addObserver() { 657 647 observer = new MutationObserver( _.debounce( resize, 100 ) ); … … 664 654 } 665 655 666 $( iframeWin ).on( 'load', resize ) .on( 'unload', reload );656 $( iframeWin ).on( 'load', resize ); 667 657 668 658 MutationObserver = iframeWin.MutationObserver || iframeWin.WebKitMutationObserver || iframeWin.MozMutationObserver; -
trunk/src/js/_enqueues/wp/media/models.js
r48650 r56809 3 3 */ 4 4 5 var $ = jQuery, 6 Attachment, Attachments, l10n, media; 5 var Attachment, Attachments, l10n, media; 7 6 8 7 /** @namespace wp */ … … 238 237 }); 239 238 }; 240 241 // Clean up. Prevents mobile browsers caching.242 $(window).on('unload', function(){243 window.wp = null;244 }); -
trunk/src/js/_enqueues/wp/widgets/text.js
r51409 r56809 292 292 293 293 // When a widget is moved in the DOM the dynamically-created TinyMCE iframe will be destroyed and has to be re-built. 294 $( editor.getWin() ).on( ' unload', function() {294 $( editor.getWin() ).on( 'pagehide', function() { 295 295 _.defer( buildEditor ); 296 296 }); -
trunk/src/wp-includes/functions.php
r56763 r56809 7586 7586 7587 7587 /** 7588 * Outputs a small JS snippet on preview tabs/windows to remove `window.name` on unload.7588 * Outputs a small JS snippet on preview tabs/windows to remove `window.name` when a user is navigating to another page. 7589 7589 * 7590 7590 * This prevents reusing the same tab for a preview when the user has navigated away. … … 7615 7615 7616 7616 if ( window.addEventListener ) { 7617 window.addEventListener( ' unload', function() { window.name = ''; }, false);7617 window.addEventListener( 'pagehide', function() { window.name = ''; } ); 7618 7618 } 7619 7619 }());
Note: See TracChangeset
for help on using the changeset viewer.