forked from sch/Rivista
Improve the handling of subscription hyperlinks.
This commit is contained in:
parent
12a0628767
commit
0785b167ad
2 changed files with 15 additions and 8 deletions
|
@ -1,10 +1,17 @@
|
||||||
window.onload = function(){
|
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')) {
|
for (let element of document.querySelectorAll('#articles > ul > li > div > h4, #feed > #header > h2#subtitle.date')) {
|
||||||
let timeStamp = new Date(element.textContent);
|
let timeStamp = new Date(element.textContent);
|
||||||
element.textContent = timeStamp.toUTCString();
|
element.textContent = timeStamp.toUTCString();
|
||||||
}
|
}
|
||||||
// Parse Markdown/
|
// Parse Markdown
|
||||||
for (let element of document.querySelectorAll('#articles > ul > li > div > p')) {
|
for (let element of document.querySelectorAll('#articles > ul > li > div > p')) {
|
||||||
let markDown = element.textContent
|
let markDown = element.textContent
|
||||||
element.innerHTML = marked.parse(markDown);
|
element.innerHTML = marked.parse(markDown);
|
||||||
|
|
|
@ -64,18 +64,18 @@ xmlns:atom='http://www.w3.org/2005/Atom'>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id='actions'>
|
<div id='actions'>
|
||||||
<a title='Subscribe the latest updates and news.'
|
<a id='follow' title='Subscribe the latest updates and news.'
|
||||||
onclick='window.open("feed:" + location.href, "_self")'>
|
onclick='window.open(location.href.replace(/^https?:/, "feed:"), "_self")'>
|
||||||
<!-- xsl:attribute name="href">
|
<!-- xsl:attribute name="href">
|
||||||
feed:<xsl:value-of select="atom:link[@rel='self']/@href" />
|
feed:<xsl:value-of select="atom:link[@rel='self']/@href" />
|
||||||
</xsl:attribute -->
|
</xsl:attribute -->
|
||||||
Follow
|
Follow
|
||||||
</a>
|
</a>
|
||||||
<a title='Subscribe via SubToMe.'>
|
<a id='subtome' title='Subscribe via SubToMe.'>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name='href'>
|
||||||
https://www.subtome.com/#/subscribe?feeds=<xsl:value-of select="atom:link[@rel='self']/@href" />
|
javascript:location.href='https://www.subtome.com/#/subscribe?feeds='+location.href;
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:attribute name="onclick">
|
<xsl:attribute name='onclick'>
|
||||||
(
|
(
|
||||||
function(btn){
|
function(btn){
|
||||||
var z=document.createElement('script');
|
var z=document.createElement('script');
|
||||||
|
|
Loading…
Reference in a new issue