Skip to content
Snippets Groups Projects
Verified Commit 13b6caf3 authored by MickGe's avatar MickGe :tiger2:
Browse files

build

parent a0dbe163
Branches dev
No related tags found
No related merge requests found
:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:dark;color:#ffffffde;background-color:#000;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}*{box-sizing:border-box}a{font-weight:500;color:#9ec5e8;text-decoration:inherit}a:hover{color:#5ea0da}body{margin:0;min-height:100vh}h1{font-size:2em;line-height:1.1;margin:2rem auto;padding:1rem 0;text-align:center;position:sticky;top:0;background-color:#000;box-shadow:#000 0 20px 20px;z-index:1}h1 em{opacity:50%}#bm_nb{margin-right:1rem;font-size:95%}#app,.presentation{max-width:920px;margin:0 auto;text-align:center;padding:2rem}.presentation{padding:0 2rem;text-align:start}.presentation .logo{max-width:1em}button{border-radius:8px;border:solid #827d7d 1px;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;min-height:2.5rem;cursor:pointer;transition:all .2s .1s ease-out}button:hover{transform:translate(2px,-2px) scale(1.05);box-shadow:#000 -3px 3px 3px,#fff -3px 3px 4px 1px}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}.actionbar button{margin:0 1em}.news-feed-el{display:flex;flex-direction:column;position:relative;z-index:20}.news-feed-el.reverse{flex-direction:column-reverse}.toot{width:100%;padding:1em;margin:1.2em auto;border:solid #827d7d 1px;border-radius:8px;background:#242424;position:relative;overflow:hidden;text-overflow:ellipsis;max-height:1000vh;transition:opacity 1s .2s ease-in-out,max-height 1.5s .1s ease-out,padding 1s .8s ease-in-out,margin 1s .8s ease-in-out}.toot .banner{display:flex;align-items:center;flex-direction:row;justify-content:space-between}.toot .banner button.unbookmark{background-color:#6c0a0a}.toot-content{text-align:start}.toot .attachments{display:flex;overflow:scroll;align-items:center;column-gap:1em}.toot .attachments img,.toot .attachments video,.toot .attachments audio{max-width:380px;max-height:380px;margin:auto;border-radius:4px}.toot .account{display:flex;flex-direction:row;justify-content:start;align-items:center}.toot .account-avatar{width:46px;height:46px;border-radius:4px;overflow:hidden;margin-right:1em}.toot .account-avatar img{width:100%;height:100;object-fit:cover}.toot.disappeared{opacity:0;max-height:0;padding:0 1em;margin:0 auto}.date-modified{font-size:small;font-style:italic;text-align:end}
:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:dark;color:#ffffffde;background-color:#000;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}*{box-sizing:border-box}a{font-weight:500;color:#9ec5e8;text-decoration:inherit}a:hover{color:#5ea0da}body{margin:0;min-height:100vh}h1{font-size:2em;line-height:1.1;margin:2rem auto;padding:1rem 0;text-align:center;position:sticky;top:0;background-color:#000;box-shadow:#000 0 20px 20px;z-index:1}h1 em{opacity:50%}.loading{margin:5rem auto;height:50px;aspect-ratio:2;border:10px solid #000;background:radial-gradient(farthest-side,#fff 98%,rgba(0,0,0,0)) left/20px 20px,radial-gradient(farthest-side,#fff 98%,rgba(0,0,0,0)) left/20px 20px,radial-gradient(farthest-side,#fff 98%,rgba(0,0,0,0)) center/20px 20px,radial-gradient(farthest-side,#fff 98%,rgba(0,0,0,0)) right/20px 20px,#000;background-repeat:no-repeat;filter:blur(4px) contrast(10);animation:b4 1s infinite}@keyframes b4{to{background-position:right,left,center,right}}#bm_nb{margin-right:1rem;font-size:95%}#app,.presentation{max-width:920px;margin:0 auto;text-align:center;padding:2rem}.presentation{padding:0 2rem;text-align:start}.presentation .logo{max-width:1em}button{border-radius:8px;border:solid #827d7d 1px;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;min-height:2.5rem;cursor:pointer;transition:all .2s .1s ease-out}button:hover{transform:translate(2px,-2px) scale(1.05);box-shadow:#000 -3px 3px 3px,#fff -3px 3px 4px 1px}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}.actionbar button{margin:0 1em}.news-feed-el{display:flex;flex-direction:column;position:relative;z-index:20}.news-feed-el.reverse{flex-direction:column-reverse}.toot{width:100%;padding:1em;margin:1.2em auto;border:solid #827d7d 1px;border-radius:8px;background:#242424;position:relative;overflow:hidden;text-overflow:ellipsis;max-height:1000vh;transition:opacity 1s .2s ease-in-out,max-height 1.5s .1s ease-out,padding 1s .8s ease-in-out,margin 1s .8s ease-in-out}.toot .banner{display:flex;align-items:center;flex-direction:row;justify-content:space-between}.toot .banner button.unbookmark{background-color:#6c0a0a}.toot-content{text-align:start}.toot .attachments{display:flex;overflow:scroll;align-items:center;column-gap:1em}.toot .attachments img,.toot .attachments video,.toot .attachments audio{max-width:380px;max-height:380px;margin:auto;border-radius:4px}.toot .account{display:flex;flex-direction:row;justify-content:start;align-items:center}.toot .account-avatar{width:46px;height:46px;border-radius:4px;overflow:hidden;margin-right:1em}.toot .account-avatar img{width:100%;height:100;object-fit:cover}.toot.disappeared{opacity:0;max-height:0;padding:0 1em;margin:0 auto}.date-modified{font-size:small;font-style:italic;text-align:end}
(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))a(t);new MutationObserver(t=>{for(const n of t)if(n.type==="childList")for(const i of n.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function u(t){const n={};return t.integrity&&(n.integrity=t.integrity),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?n.credentials="include":t.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function a(t){if(t.ep)return;t.ep=!0;const n=u(t);fetch(t.href,n)}})();const d=document.createElement("div");d.classList.add("news-feed-el");d.id="news-feed-el";const E=async(e,s)=>await fetch(e,{mode:"cors",headers:{Authorization:`Bearer ${s}`}}).then(a=>a.json().then(t=>{const n=a.headers.get("link").split(",").map(i=>i.match(/&m(ax|in)_id=\d+/g));return[t,...n]}),a=>{console.error(a)}),$=async(e,s,u,a)=>{const t=`${e}api/v1/statuses/${u}/unbookmark`;await fetch(t,{mode:"cors",method:"POST",headers:{Authorization:`Bearer ${s}`}}).then(n=>{if(n.ok){a.classList.add("disappeared");const i=document.getElementById("bm_nb").textContent-=1;document.title=`${i} Mastodon unBookmarks`}else console.error("*** Bookmark not unbookmarks ***")},n=>{console.error(n)})},_=e=>e.charAt(0).toUpperCase()+e.slice(1),C=(e,s)=>`<div id="${e.id}" class="toot">
(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))a(t);new MutationObserver(t=>{for(const n of t)if(n.type==="childList")for(const i of n.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function m(t){const n={};return t.integrity&&(n.integrity=t.integrity),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?n.credentials="include":t.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function a(t){if(t.ep)return;t.ep=!0;const n=m(t);fetch(t.href,n)}})();const d=document.createElement("div");d.classList.add("news-feed-el");d.id="news-feed-el";const w=async(e,s)=>await fetch(e,{mode:"cors",headers:{Authorization:`Bearer ${s}`}}).then(a=>a.json().then(t=>{const n=a.headers.get("link").split(",").map(i=>i.match(/&m(ax|in)_id=\d+/g));return[t,...n]}),a=>{console.error(a)}),$=async(e,s,m,a)=>{const t=`${e}api/v1/statuses/${m}/unbookmark`;await fetch(t,{mode:"cors",method:"POST",headers:{Authorization:`Bearer ${s}`}}).then(n=>{if(n.ok){a.classList.add("disappeared");const i=document.getElementById("bm_nb").textContent-=1;document.title=`${i} Mastodon unBookmarks`}else console.error("*** Bookmark not unbookmarks ***")},n=>{console.error(n)})},_=e=>e.charAt(0).toUpperCase()+e.slice(1),C=(e,s)=>`<div id="${e.id}" class="toot">
<div class="banner">
<a href="${e.account.url}" target="_blank" title="Voir le profil sur l'instance d'origine"><div class="account"><div class="account-avatar"><img src="${e.account.avatar}" /></div><div class="account.username">${e.account.display_name}</div></div></a>
<button title="Cliquer pour retirer le marque-page" class="unbookmark">&#128278;</button>
......@@ -8,4 +8,4 @@
<div class="date-modified">
<a href="${e.uri}" target="_blank" title="Voir le pouet sur Mastodon">${e.created_atFR}</a>
</div>
</div>`,x=async(e,s)=>{const u=`${e}api/v1/bookmarks/?limit=40`;try{const a=[];let t,n="";do{const r=await E(u+t,s);a.push(...r[0]),[t,n]=[r[1],r[2]]}while(n);a.sort((r,m)=>{const c=r.created_at,o=m.created_at;return c<o?-1:c>o?1:0});const i={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",timeZone:"Europe/Paris"};a.forEach(r=>{r.created_atFR=_(new Date(r.created_at).toLocaleString("fr-FR",i)),r.account.display_name=r.account.display_name.replaceAll(/:\w+:/g,"").trim()||r.account.username;const m=new RegExp('(?<=rel="tag")',"g");r.content=r.content.replaceAll(m,' target="_blank"');const c=r.media_attachments.filter(o=>["image","video","audio"].includes(o.type)).map(o=>{switch(o.type){case"image":return`<img src="${o.preview_url}" title="${o.description}"/>`;case"video":return`<video controls src="${o.remote_url}" poster="${o.preview_url}" title="${o.description}" preload="none" role="button" tabindex="0" width="${o.meta.small.width}" height="${o.meta.small.height}" volume="1"/>`;case"audio":return`<audio controls src="${o.remote_url}" poster="${o.preview_remote_url}" title="${o.description}" preload="none" role="button" tabindex="0" width="${o.meta.small.width}" height="${o.meta.small.height}" volume="1"/>`;default:console.info("Type not prepared…",o.type);break}});c.length&&c.unshift('<div class="attachments">')&&c.push("</div>"),d.innerHTML+=C(r,c)}),d.querySelectorAll(".unbookmark").forEach(r=>{const m=r.parentElement.parentElement,c=m.id;r.addEventListener("click",()=>$(e,s,c,m))});const w=a.length;return{newsFeedEl:d,bookmarksNb:w}}catch(a){return console.error(a),d.innerHTML="<h2>Nothing to display…</h2>",d}},p=document.createElement("div");p.classList.add("actionbar");const k=document.createElement("button");p.appendChild(k);k.innerHTML="&#x21C5;";k.title="Cliquer pour inverser l'ordre";const f=document.createElement("button");p.appendChild(f);f.innerHTML="&#127850;";f.title="Cliquer pour supprimer les cookies";const g=document.createElement("button");p.appendChild(g);g.innerHTML="&#10227;";g.title="Cliquer pour recharger";const R=()=>{document.getElementById("news-feed-el").classList.toggle("reverse")},B=()=>{document.cookie='token=""; expires=Thu, 01 Jan 1970 00:00:01 GMT"; samesite=lax; secure',document.cookie='instanceURL=""; expires=Thu, 01 Jan 1970 00:00:01 GMT"; samesite=lax; secure'},T=()=>{const e=document.getElementById("news-feed-el");document.getElementById("app").removeChild(e),L()};k.addEventListener("click",R);f.addEventListener("click",B);g.addEventListener("click",T);var b;const l=Object.fromEntries((b=document.cookie)==null?void 0:b.split(";").map(e=>e.trim().split("="))),v=prompt("Token? (read:bookmarks & write:bookmarks)",l==null?void 0:l.token),U=l!=null&&l.instanceURL?decodeURIComponent(l.instanceURL):"";let h=prompt("URL instance?",U);h.startsWith("https://")||(h="https://".concat(h));const y=new URL(h);document.cookie=`token=${v}; max-age=604800; samesite=lax; secure`;document.cookie=`instanceURL=${encodeURIComponent(y)}; max-age=604800; samesite=lax; secure`;const L=async()=>{const e=await x(y,v);document.getElementById("app").appendChild((e==null?void 0:e.newsFeedEl)||e),document.getElementById("bm_nb").textContent=(e==null?void 0:e.bookmarksNb)||"Ø",e!=null&&e.bookmarksNb&&(document.title=`${e.bookmarksNb} Mastodon unBookmarks`)},I=()=>{document.getElementById("app").appendChild(p),L()};I();
</div>`,B=async(e,s)=>{const m=`${e}api/v1/bookmarks/?limit=40`;try{const a=[];let t,n="";do{const r=await w(m+t,s);a.push(...r[0]),[t,n]=[r[1],r[2]]}while(n);a.sort((r,u)=>{const c=r.created_at,o=u.created_at;return c<o?-1:c>o?1:0});const i={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",timeZone:"Europe/Paris"};a.forEach(r=>{r.created_atFR=_(new Date(r.created_at).toLocaleString("fr-FR",i)),r.account.display_name=r.account.display_name.replaceAll(/:\w+:/g,"").trim()||r.account.username;const u=new RegExp('(?<=rel="tag")',"g");r.content=r.content.replaceAll(u,' target="_blank"');const c=r.media_attachments.filter(o=>["image","video","audio"].includes(o.type)).map(o=>{switch(o.type){case"image":return`<img src="${o.preview_url}" title="${o.description}"/>`;case"video":return`<video controls src="${o.remote_url}" poster="${o.preview_url}" title="${o.description}" preload="none" role="button" tabindex="0" width="${o.meta.small.width}" height="${o.meta.small.height}" volume="1"/>`;case"audio":return`<audio controls src="${o.remote_url}" poster="${o.preview_remote_url}" title="${o.description}" preload="none" role="button" tabindex="0" width="${o.meta.small.width}" height="${o.meta.small.height}" volume="1"/>`;default:console.info("Type not prepared…",o.type);break}});c.length&&c.unshift('<div class="attachments">')&&c.push("</div>"),d.innerHTML+=C(r,c)}),d.querySelectorAll(".unbookmark").forEach(r=>{const u=r.parentElement.parentElement,c=u.id;r.addEventListener("click",()=>$(e,s,c,u))});const L=a.length;return{newsFeedEl:d,bookmarksNb:L}}catch(a){return console.error(a),d.innerHTML="<h2>Nothing to display…</h2>",d}},p=document.createElement("div");p.classList.add("actionbar");const g=document.createElement("button");p.appendChild(g);g.innerHTML="&#x21C5;";g.title="Cliquer pour inverser l'ordre";const k=document.createElement("button");p.appendChild(k);k.innerHTML="&#127850;";k.title="Cliquer pour supprimer les cookies";const f=document.createElement("button");p.appendChild(f);f.innerHTML="&#10227;";f.title="Cliquer pour recharger";const x=()=>{document.getElementById("news-feed-el").classList.toggle("reverse")},R=()=>{document.cookie='token=""; expires=Thu, 01 Jan 1970 00:00:01 GMT"; samesite=lax; secure',document.cookie='instanceURL=""; expires=Thu, 01 Jan 1970 00:00:01 GMT"; samesite=lax; secure'},I=()=>{const e=document.getElementById("news-feed-el");document.getElementById("app").removeChild(e),document.getElementById("loading").hidden=!1,E()};g.addEventListener("click",x);k.addEventListener("click",R);f.addEventListener("click",I);document.getElementById("loading").hidden=!1;var b;const l=Object.fromEntries((b=document.cookie)==null?void 0:b.split(";").map(e=>e.trim().split("="))),v=prompt("Token? (read:bookmarks & write:bookmarks)",l==null?void 0:l.token),T=l!=null&&l.instanceURL?decodeURIComponent(l.instanceURL):"";let h=prompt("URL instance?",T);h.startsWith("https://")||(h="https://".concat(h));const y=new URL(h);document.cookie=`token=${v}; max-age=604800; samesite=lax; secure`;document.cookie=`instanceURL=${encodeURIComponent(y)}; max-age=604800; samesite=lax; secure`;const E=async()=>{const e=await B(y,v);document.getElementById("loading").hidden=!0,document.getElementById("app").appendChild((e==null?void 0:e.newsFeedEl)||e),document.getElementById("bm_nb").textContent=(e==null?void 0:e.bookmarksNb)||"Ø",e!=null&&e.bookmarksNb&&(document.title=`${e.bookmarksNb} Mastodon unBookmarks`)},U=()=>{document.getElementById("app").appendChild(p),E()};U();
......@@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="./Mastodon_Logotype_(Simple).svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mastodon unBookmarks</title>
<script type="module" crossorigin src="./assets/index-75e1eb6a.js"></script>
<link rel="stylesheet" href="./assets/index-39659396.css">
<script type="module" crossorigin src="./assets/index-e6cadaef.js"></script>
<link rel="stylesheet" href="./assets/index-af430840.css">
</head>
<body>
<h1><span id="bm_nb"></span>Mastodon <em>un</em>Bookmarks</h1>
......@@ -17,6 +17,7 @@
<p><img class="logo" src="https://about.gitlab.com/nuxt-images/ico/favicon-32x32.png" alt="Logo de GitLab"/> Le code source est là : <a href="https://forge.tedomum.net/mickge/mastodon-bookmarks" target="_blank">https://forge.tedomum.net/mickge/mastodon-bookmarks</a>.</p>
</div>
<div id="app"></div>
<div id="loading" class="loading" hidden></div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment