diff --git a/shaarli-pro/dist/custom_views.min.js b/shaarli-pro/dist/custom_views.min.js index 3953136..b2c6814 100644 --- a/shaarli-pro/dist/custom_views.min.js +++ b/shaarli-pro/dist/custom_views.min.js @@ -1 +1 @@ -function renderMarkdown(t){return"undefined"!=typeof window&&"function"==typeof window.renderMarkdown?window.renderMarkdown(t):String(t||"").replace(/\n/g,"
")}function applyKeepNoteFormatting(t,e){if("undefined"!=typeof window&&"function"==typeof window.applyKeepNoteFormatting)return window.applyKeepNoteFormatting(t,e)}document.addEventListener("DOMContentLoaded",function(){const t=new URLSearchParams(window.location.search),e=t.get("searchtags")||t.get("searchTags")||"",o=window.location.pathname.match(/\/tag\/(.+)$/),n=(e+" "+(o?decodeURIComponent(o[1]):"")).toLowerCase().split(/[\s,]+/).filter(t=>t),a=!!document.querySelector('.sidebar-link[aria-label="Notes"].active, .header-nav-link[aria-label="Notes"].active, .sidebar-link[href*="searchtags=note"].active, .sidebar-link[href*="searchtags=shaarli-note"].active')||!!document.querySelector('.sidebar-link[aria-label="'+window.ShaarliProI18n.t("Notes")+'"].active, .header-nav-link[aria-label="'+window.ShaarliProI18n.t("Notes")+'"].active'),r=!!document.querySelector('.sidebar-link[aria-label="Mes tâches"].active, .header-nav-link[aria-label="Mes tâches"].active, .sidebar-link[href*="searchtags=shaarli-todo"].active, .sidebar-link[href*="searchtags=todo"].active')||!!document.querySelector('.sidebar-link[aria-label="'+window.ShaarliProI18n.t("My tasks")+'"].active, .header-nav-link[aria-label="'+window.ShaarliProI18n.t("My tasks")+'"].active'),i=!!document.querySelector('.sidebar-link[aria-label="Archive"].active, .header-nav-link[aria-label="Archive"].active, .sidebar-link[href*="searchtags=shaarli-archive"].active, .sidebar-link[href*="searchtags=shaarli-archiver"].active')||!!document.querySelector('.sidebar-link[aria-label="'+window.ShaarliProI18n.t("Archive")+'"].active, .header-nav-link[aria-label="'+window.ShaarliProI18n.t("Archive")+'"].active'),l=Array.from(document.querySelectorAll(".search-tag-chip")).map(t=>(t.textContent||"").trim().toLowerCase()),s=t=>"shaarli-archive"===t||"shaarli-archiver"===t,d=t=>"note"===t||"shaarli-note"===t||"#note"===t,c=t=>"todo"===t||"shaarli-todo"===t||"#todo"===t,u=n.some(d)||a||l.some(d),m=n.some(c)||r||l.some(c),p=n.some(s)||i||l.some(s),f=document.getElementById("links-list"),g=document.querySelector(".content-container"),h=()=>{try{document.body.classList.remove("view-todo","view-notes","view-archive")}catch(t){}const t=document.querySelector(".content-toolbar");t&&(t.style.display="");const e=document.getElementById("links-list");e&&(e.style.display=""),document.querySelectorAll(".notes-wrapper.todo-wrapper").forEach(t=>t.remove())};window.renderMarkdown=function(t){if(!t)return"";const e=String(t).replace(/\r\n?/g,"\n"),o=t=>String(t).replace(/&/g,"&").replace(//g,">"),n=t=>String(t).replace(/&/g,"&").replace(/"/g,""").replace(//g,">"),a=t=>{const e=String(t||"").trim();return e&&/^(https?:|mailto:|\/)/i.test(e)?e:""},r=t=>{let e=o(t||"");const r=[];return e=e.replace(/`([^`\n]+)`/g,(t,e)=>{const o=`__MD_CODE_${r.length}__`;return r.push(`${e}`),o}),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(t,e,o)=>{const r=a(o);return r?`${n(e)}`:t}),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,e,o)=>{const r=a(o);return r?`${e}`:t}),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/__(.+?)__/g,"$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/\*(.+?)\*/g,"$1"),e=e.replace(/_(.+?)_/g,"$1"),e=e.replace(/<u>([\s\S]*?)<\/u>/g,"$1"),e=e.replace(/__MD_CODE_(\d+)__/g,(t,e)=>r[Number(e)]||""),e},i=e.split("\n"),l=[];let s=!1,d=!1,c=!1,u=!1,m="",p=[];const f=()=>{s&&(l.push(""),s=!1),d&&(l.push(""),d=!1),c&&(l.push(""),c=!1)};if(i.forEach(t=>{const e=t.trim(),a=e.match(/^```\s*([\w-]+)?\s*$/);if(a){if(f(),u){const t=m?` data-lang="${n(m)}"`:"";l.push(`
${o(p.join("\n"))}
`),u=!1,m="",p=[]}else u=!0,m=a[1]||"",p=[];return}if(u)return void p.push(t);if(!e)return f(),void l.push('
');const i=t.match(/^\s*(#{1,6})\s+(.+)$/);if(i){f();const t=i[1].length;return void l.push(`${r(i[2])}`)}const g=t.match(/^\s*>\s?(.*)$/);if(g)return f(),void l.push(`
${r(g[1])}
`);const h=t.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.+)$/);if(h){s&&(l.push(""),s=!1),d&&(l.push(""),d=!1),c||(l.push('"),s=!1),c&&(l.push(""),c=!1),d||(l.push("
    "),d=!0),void l.push(`
  1. ${r(y[1])}
  2. `);const b=t.match(/^\s*[-*+]\s+(.+)$/);if(b)return d&&(l.push("
"),d=!1),c&&(l.push(""),c=!1),s||(l.push(""),s=!1),d&&(l.push(""),d=!1),c&&(l.push(""),c=!1)};if(i.forEach(t=>{const e=t.trim(),r=e.match(/^```\s*([\w-]+)?\s*$/);if(r){if(f(),u){const t=m?` data-lang="${n(m)}"`:"";l.push(`
${o(p.join("\n"))}
`),u=!1,m="",p=[]}else u=!0,m=r[1]||"",p=[];return}if(u)return void p.push(t);if(!e)return f(),void l.push('
');const i=t.match(/^\s*(#{1,6})\s+(.+)$/);if(i){f();const t=i[1].length;return void l.push(`${a(i[2])}`)}const h=t.match(/^\s*>\s?(.*)$/);if(h)return f(),void l.push(`
${a(h[1])}
`);const g=t.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.+)$/);if(g){s&&(l.push(""),s=!1),d&&(l.push(""),d=!1),c||(l.push('"),s=!1),c&&(l.push(""),c=!1),d||(l.push("
    "),d=!0),void l.push(`
  1. ${a(b[1])}
  2. `);const y=t.match(/^\s*[-*+]\s+(.+)$/);if(y)return d&&(l.push("
"),d=!1),c&&(l.push(""),c=!1),s||(l.push("