Gmail の個別メールへの直リンを取得するブックマークレット
デフォルトの機能では個別メールへの直リンは取得できなかったはず
code:javascript
javascript:(function(){const CONFIG={PREFIX:`${window.location.origin}${window.location.pathname.replace(/\/$/,"")}#all/%60,OVERLAY_TEXT:"Click Anywhere to Copy Gmail Link",BG_COLOR:"rgba(0,0,0,0.6)"};const getLegacyId=()=>document.querySelector('.if data-legacy-message-id, data-legacy-message-id')?.getAttribute('data-legacy-message-id');const id=getLegacyId();if(!id){alert("Email ID not found.");return}const ov=document.createElement("div");Object.assign(ov.style,{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:CONFIG.BG_COLOR,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647,cursor:"pointer",fontSize:"1.5rem",fontFamily:"sans-serif"});ov.textContent=CONFIG.OVERLAY_TEXT;document.body.appendChild(ov);ov.addEventListener("click",()=>{navigator.clipboard.writeText(%60${CONFIG.PREFIX}${id}%60).then(()=>{ov.textContent="Copied!";ov.style.backgroundColor="rgba(0,128,0,0.8)";setTimeout(()=>ov.remove(),600)}).catch(e=>{alert(e);ov.remove()})},{once:true})})();