From c6244d637d1eb353d41d1ba6ff739bfce2e2b47d Mon Sep 17 00:00:00 2001 From: Nick Budak Date: Wed, 29 Nov 2023 14:58:17 -0800 Subject: [PATCH] Add javascript: prefix to compiled bookmarklet This is required for Chrome to allow you to create a bookmark, otherwise it'll complain it's an invalid URL. --- public/bookmarklet.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/bookmarklet.min.js b/public/bookmarklet.min.js index effd371..2996756 100644 --- a/public/bookmarklet.min.js +++ b/public/bookmarklet.min.js @@ -1 +1 @@ -(()=>{var d=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var p=d(()=>{var s=window.location.toString().match(/https:\/\/www\.dndbeyond\.com\/characters\/(\d+)/);if(!s)return;var r="https://character-service.dndbeyond.com/character/v5/character",i="https://character-service.dndbeyond.com/character/v5/game-data",l=s[1],h=(a,e)=>{let t=document.createElement("a");t.setAttribute("href","data:application/json;charset=utf-8,"+encodeURIComponent(e)),t.setAttribute("download",a),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)};(async()=>{let a=await fetch(`${r}/${l}`),{data:e}=await a.json();for(let{level:t,subclassDefinition:c}of e.classes){if(!c)continue;let o=await fetch(`${i}/always-prepared-spells?classLevel=${t}&classId=${c.id}&campaign=${e.campaign?e.campaign.id:void 0}`),{data:n}=await o.json();n.length!==0&&e.classSpells.push({entityTypeId:0,characterClassId:c.id,spells:n})}h(`${e.name}.json`,JSON.stringify(e))})().catch(console.error)});p();})(); +javascript:(()=>{var d=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var p=d(()=>{var s=window.location.toString().match(/https:\/\/www\.dndbeyond\.com\/characters\/(\d+)/);if(!s)return;var r="https://character-service.dndbeyond.com/character/v5/character",i="https://character-service.dndbeyond.com/character/v5/game-data",l=s[1],h=(a,e)=>{let t=document.createElement("a");t.setAttribute("href","data:application/json;charset=utf-8,"+encodeURIComponent(e)),t.setAttribute("download",a),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)};(async()=>{let a=await fetch(`${r}/${l}`),{data:e}=await a.json();for(let{level:t,subclassDefinition:c}of e.classes){if(!c)continue;let o=await fetch(`${i}/always-prepared-spells?classLevel=${t}&classId=${c.id}&campaign=${e.campaign?e.campaign.id:void 0}`),{data:n}=await o.json();n.length!==0&&e.classSpells.push({entityTypeId:0,characterClassId:c.id,spells:n})}h(`${e.name}.json`,JSON.stringify(e))})().catch(console.error)});p();})();