1const cuteAlert=({url,type,title,message,img,buttonText='OK',confirmText='OK',vibrate=[],playSound=null,cancelText='Cancel',closeStyle,})=>{return new Promise(resolve=>{const existingAlert=document.querySelector('.alert-wrapper');if(existingAlert){existingAlert.remove()} 2const body=document.querySelector('body');const scripts=document.getElementsByTagName('script');let src='';for(let script of scripts){if(script.src.includes('cute-alert.js')){src=script.src.substring(0,script.src.lastIndexOf('/'))}} 3let btnTemplate=` 4 <button class="alert-button ${type}-bg ${type}-btn">${buttonText}</button> 5 `;if(type==='question'){btnTemplate=` 6 <div class="question-buttons"> 7 <button class="confirm-button ${type}-bg ${type}-btn">${confirmText}</button> 8 <button class="cancel-button error-bg error-btn">${cancelText}</button> 9 </div> 10 `} 11if(vibrate.length>0){navigator.vibrate(vibrate)} 12if(playSound!==null){let sound=new Audio(playSound);sound.play()} 13const template=` 14 <div class="alert-wrapper"> 15 <div class="alert-frame"> 16 ${ 17 img === undefined 18 ? '<div class="alert-header ' + type + '-bg">' 19 : '<div class="alert-header-base">' 20 } 21 <span class="alert-close ${ 22 closeStyle === 'circle' 23 ? 'alert-close-circle' 24 : 'alert-close-default' 25 }">X</span> 26 ${ 27 img === undefined 28 ? '<img class="alert-img" src="' + 29 src + 30 "/img/" + 31 type + 32 ".svg" + 33 '" />' 34 : '<div class="custom-img-wrapper">' + img + "</div>" 35 } 36 </div> 37 <div class="alert-body"> 38 <span class="alert-title">${title}</span> 39 <span class="alert-message">${message}</span> 40 ${btnTemplate} 41 </div> 42 </div> 43 </div> 44 `;body.insertAdjacentHTML('afterend',template);const alertWrapper=document.querySelector('.alert-wrapper');const alertFrame=document.querySelector('.alert-frame');const alertClose=document.querySelector('.alert-close');if(type==='question'){const confirmButton=document.querySelector('.confirm-button');const cancelButton=document.querySelector('.cancel-button');confirmButton.addEventListener('click',()=>{alertWrapper.remove();resolve('confirm')});cancelButton.addEventListener('click',()=>{alertWrapper.remove();resolve()})}else{const alertButton=document.querySelector('.alert-button');alertButton.addEventListener('click',()=>{alertWrapper.remove();resolve('ok')})} 45alertClose.addEventListener('click',()=>{alertWrapper.remove();resolve('close')});alertFrame.addEventListener('click',e=>{e.stopPropagation()})})};const cuteToast=({type,title,message,timer=5000,vibrate=[],playSound=null})=>{return new Promise(resolve=>{const body=document.querySelector('body');const scripts=document.getElementsByTagName('script');let src='';for(let script of scripts){if(script.src.includes('cute-alert.js')){src=script.src.substring(0,script.src.lastIndexOf('/'))}} 46let templateContainer=document.querySelector('.toast-container');if(!templateContainer){body.insertAdjacentHTML('afterend','<div class="toast-container"></div>',);templateContainer=document.querySelector('.toast-container')} 47const toastId=mfCaoId();const templateContent=` 48 <div class="toast-content ${type}-bg" id="${toastId}-toast-content"> 49 <div> 50 <div class="toast-frame"> 51 <div class="toast-body"> 52 <img class="toast-body-img" src="${src}/img/${type}.svg" />' 53 <div class="toast-body-content"> 54 <span class="toast-title">${title}</span> 55 <span class="toast-message">${message}</span> 56 </div> 57 <div class="toast-close" id="${toastId}-toast-close">X</div> 58 </div> 59 </div> 60 <div class="toast-timer ${type}-timer" style="animation: timer${timer}ms linear;> 61 </div> 62 </div> 63 `;const toasts=document.querySelectorAll('.toast-content');if(toasts.length){toasts[0].insertAdjacentHTML('beforebegin',templateContent)}else{templateContainer.innerHTML=templateContent} 64const toastContent=document.getElementById(`${toastId}-toast-content`);if(vibrate.length>0){navigator.vibrate(vibrate)} 65if(playSound!==null){let sound=new Audio(playSound);sound.play()} 66setTimeout(()=>{toastContent.remove();resolve()},timer);const toastClose=document.getElementById(`${toastId}-toast-close`);toastClose.addEventListener('click',()=>{toastContent.remove();resolve()})})};const mfCaId=()=>{return'_'+Math.random().toString(36).substr(2,9)}
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.