1(function () { 2 'use strict'; 3 var script = document.currentScript; 4 var ticketEndpoint = script && script.dataset.ticketEndpoint ? script.dataset.ticketEndpoint : '/index.php?ppt_download_ticket=1'; 5 6 function setCardState(card, state, message) { 7 if (!card) return; 8 card.dataset.pptDownloadState = state || ''; 9 if (card.matches && card.matches('.ppt-protected-download')) { 10 if (!card.dataset.pptOriginalLabel) card.dataset.pptOriginalLabel = card.textContent; 11 card.textContent = message || card.dataset.pptOriginalLabel; 12 if (state === 'loading') card.setAttribute('aria-busy', 'true'); else card.removeAttribute('aria-busy'); 13 return; 14 } 15 Array.prototype.forEach.call(card.querySelectorAll('[data-ppt-download-label]'), function (label) { 16 label.textContent = message || 'ä¸è½½'; 17 }); 18 Array.prototype.forEach.call(card.querySelectorAll('.ppt-protected-download'), function (link) { 19 if (state === 'loading') link.setAttribute('aria-busy', 'true'); else link.removeAttribute('aria-busy'); 20 }); 21 } 22 23 document.addEventListener('click', function (event) { 24 var link = event.target && event.target.closest ? event.target.closest('.ppt-protected-download') : null; 25 if (!link) return; 26 event.preventDefault(); 27 var card = link.closest('.ppt-download-card') || link; 28 if (card.dataset.pptDownloadState === 'loading' || !link.dataset.pptDownload) return; 29 setCardState(card, 'loading', 'æ£å¨åå¤â¦'); 30 fetch(ticketEndpoint, { 31 method: 'POST', credentials: 'same-origin', cache: 'no-store', 32 headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'Accept': 'application/json' }, 33 body: 'file=' + encodeURIComponent(link.dataset.pptDownload) 34 }).then(function (response) { 35 return response.json().then(function (payload) { 36 if (!response.ok || !payload.ok || !payload.url) throw new Error(payload.error || 'æ æ³çæä¸è½½é¾æ¥'); 37 return payload; 38 }); 39 }).then(function (payload) { 40 setCardState(card, '', 'ä¸è½½'); 41 window.location.assign(payload.url); 42 }).catch(function (error) { 43 setCardState(card, 'error', 'éè¯'); 44 if (card) card.setAttribute('title', error.message || 'ä¸è½½å¤±è´¥ï¼è¯·éè¯'); 45 }); 46 }); 47}());
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.