From 0785b167adb72b610f0337bd156b224aaefe7bce Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Tue, 9 Jul 2024 19:17:40 +0300 Subject: [PATCH] Improve the handling of subscription hyperlinks. --- script/postprocess.js | 11 +++++++++-- xsl/atom_as_xhtml.xsl | 12 ++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/script/postprocess.js b/script/postprocess.js index dc37784..67e8f45 100644 --- a/script/postprocess.js +++ b/script/postprocess.js @@ -1,10 +1,17 @@ window.onload = function(){ - // Convert ISO8601 To UTC/ + // Fix button follow + let follow = document.querySelector('#follow'); + feedUrl = location.href.replace(/^https?:/, 'feed:'); + follow.href = feedUrl; + follow.onclick = window.open(feedUrl, "_self"); + // Fix button subtome + document.querySelector('#subtome').href='https://www.subtome.com/#/subscribe?feeds='+location.href; + // Convert ISO8601 To UTC for (let element of document.querySelectorAll('#articles > ul > li > div > h4, #feed > #header > h2#subtitle.date')) { let timeStamp = new Date(element.textContent); element.textContent = timeStamp.toUTCString(); } - // Parse Markdown/ + // Parse Markdown for (let element of document.querySelectorAll('#articles > ul > li > div > p')) { let markDown = element.textContent element.innerHTML = marked.parse(markDown); diff --git a/xsl/atom_as_xhtml.xsl b/xsl/atom_as_xhtml.xsl index c59b7b7..02ee0d5 100644 --- a/xsl/atom_as_xhtml.xsl +++ b/xsl/atom_as_xhtml.xsl @@ -64,18 +64,18 @@ xmlns:atom='http://www.w3.org/2005/Atom'>
- + Follow - - - https://www.subtome.com/#/subscribe?feeds= + + + javascript:location.href='https://www.subtome.com/#/subscribe?feeds='+location.href; - + ( function(btn){ var z=document.createElement('script');