1/** 2 * Easy Login WooCommerce à æ´é å¿«å nonce æç¼ã 3 * 4 * 訪客éåç»å ¥ / è¨»åæ¡æå䏿¬¡æ°é®® nonceï¼è¦å¯«è¢«æ´é å¿«ååçµçèå¼ã 5 * è©³ç´°èæ¯è¦ inc/elw-nonce-refresh.php æªé ã 6 */ 7( function ( $ ) { 8 'use strict'; 9 10 if ( typeof window.xoo_el_localize === 'undefined' || typeof window.scIcgCompatElw === 'undefined' ) { 11 return; 12 } 13 14 var lastRefresh = 0; 15 var inFlight = false; 16 var maxAgeMs = ( parseInt( window.scIcgCompatElw.maxAge, 10 ) || 1800 ) * 1000; 17 18 /** 19 * æç¼ nonceã 20 * 21 * @param {boolean} force ç¥éæ°é®®åº¦æª¢æ¥ï¼AJAX 已被 403 æä¸æä½¿ç¨ï¼ã 22 */ 23 function refreshNonce( force ) { 24 if ( inFlight ) { 25 return; 26 } 27 if ( ! force && lastRefresh && Date.now() - lastRefresh < maxAgeMs ) { 28 return; 29 } 30 31 inFlight = true; 32 33 $.post( window.scIcgCompatElw.ajaxUrl, { action: 'sc_icg_compat_elw_nonce' } ) 34 .done( function ( res ) { 35 if ( res && res.success && res.data && res.data.nonce ) { 36 window.xoo_el_localize.nonce = res.data.nonce; 37 lastRefresh = Date.now(); 38 } 39 } ) 40 .always( function () { 41 inFlight = false; 42 } ); 43 } 44 45 // 主è¦è§¸ç¼é»ï¼ELW éåæåæç»å ¥ / 註å / å¿è¨å¯ç¢¼è¡¨å®æï¼xoo-el-js.js çå ¬éäºä»¶ï¼ã 46 $( document.body ).on( 'xoo_el_form_toggled', function () { 47 refreshNonce( false ); 48 } ); 49 50 // ä¿éªè§¸ç¼é»ä¸ï¼inline 表å®ä¸ä¸å®è§¸ç¼ toggledï¼æ¹è½è§¸ç¼å¨é»æã 51 $( document ).on( 52 'click', 53 '.xoo-el-login-tgr, .xoo-el-reg-tgr, .xoo-el-lostpw-tgr, .xoo-el-sing-tgr', 54 function () { 55 refreshNonce( false ); 56 } 57 ); 58 59 // ä¿éªè§¸ç¼é»äºï¼ä½¿ç¨è å·²éå§è¼¸å ¥æè¼å ¥æ¬è ³æ¬çæ å¢ï¼å¦ JS delayï¼ã 60 $( document ).on( 'focus', '.xoo-el-form-container input', function () { 61 refreshNonce( false ); 62 } ); 63 64 /** 65 * ä¿éªè§¸ç¼é»ä¸ï¼ELW çè«æ±çç被 403 æä¸æå¼·å¶æç¼ã 66 * 67 * ELW 失æå¾æèªåéé 2 次ï¼jQuery çå ¨å ajaxError æ©æ¼å®ç local complete å·è¡ï¼ 68 * å æ¤é裡ç¼åºçæç¼è«æ±ææ©æè¶å¨ç¬¬ 2 次ééå宿ï¼è®æµç¨èªçã 69 * 屬 best-effortï¼å³ä½¿æ²è¶ä¸ï¼ä½¿ç¨è éæ°éåºæ nonce ä¹å·²æ¯æ°çã 70 */ 71 $( document ).ajaxError( function ( event, jqxhr, settings ) { 72 if ( ! settings || typeof settings.url !== 'string' ) { 73 return; 74 } 75 if ( settings.url.indexOf( 'admin-ajax.php' ) === -1 || jqxhr.status !== 403 ) { 76 return; 77 } 78 refreshNonce( true ); 79 } ); 80} )( jQuery );
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.