sjehuda Author

Below is a draft utilizing fetch.

fetch(document.documentURI)
  .then((response) => {
     const contentType = response.headers.get('content-type');
     if (checkMediaType(contentType)) {
       return response.text();
     }
  })
  .then((data) => {
      renderFeed(data)
  })

I've examined the following code, and I haven't found the ease and sensibility of coding with fetch significantly advantageous because of the following reasons:

  • Fetch doesn't support file URL.
  • The code is short enough for callback to be understandable.
var
  xmlHTTPRequest, xmlFile,
  mimeType, isFeed;

const mimeArray = [
  'application/atom+xml',
  'application/stream+json',
  'application/rss+xml',
  'application/rdf+xml'
];

fetch(document.documentURI)
  .then((response) => {
     const contentType = response.headers.get('content-type');
     if (!checkMediaType(contentType)) {
       throw new TypeError("Page does not seem to be a feed!");
     }
     return response.arrayBuffer();
  })
  .then((data) => {
    let decoder = new TextDecoder(document.characterSet);
    let text = decoder.decode(data);
    renderFeed(text)
  })

function checkStatus(response) {
  if (response.status >= 200 && response.status < 300) {
    return Promise.resolve(response.responseText)
  } else {
    return Promise.reject(new Error(response.statusText))
  }
}

// Check if is of type syndication feed
function checkMediaType(mimeType) {

  if (!mimeType) {
    mimeType = 'text/plain';
  }

  for (let i = 0; i < mimeArray.length; i++) {
    if (mimeType.includes(mimeArray[i])
       ) {
      return true;
    }
    // Check if is application/xml or text/xml
    else
    if (mimeType.includes('/xml') || mimeType.includes('/html')) {
      const tagArray = ['feed', 'atom:link', 'rss', 'rdf:RDF'];
      for (let i = 0; i < tagArray.length; i++) {
        var query = document.getElementsByTagName(tagArray[i]);
        if (query.length) {
          return true;
        }
      }
    }
    // Check if is plain text (XPath only is usable)
    else
    if (mimeType.match('text/plain')) {
      const tagArray = ['<feed', '<atom:link', '<rss', '<rdf:RDF'];
      for (let i = 0; i < tagArray.length; i++) {
        query = ['//*[contains(text(), "' + tagArray[i] + '")]'];
        query = queryByXPath(query);
        if (query.length) {
          return true;
        }
      }
    }
  }
}

// Begin processing
function renderFeed(xmlFile) {

  var
    domParser,
    xmlDocument, xsltProcessor,
    newDocument, head, style, isRTL,
    stylesheet_ltr, stylesheet_rtl,
    insertDocument, removeDocument;

  xmlFile =
    xmlFile
    .trim();

  domParser = new DOMParser();

  xmlDocument =
    domParser
    .parseFromString(
      xmlFile,
      'text/xml'
    );

  xsltProcessor = new XSLTProcessor();

  xslFile = '<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns="http://purl.org/rss/1.0/" xmlns:admin="http://webns.net/mvcb/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:c="http://s.opencalais.com/1/pred/" xmlns:cc="http://web.resource.org/cc/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:dbo="http://dbpedia.org/ontology/" xmlns:dbp="http://dbpedia.org/property/" xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#" xmlns:fh="http://purl.org/syndication/history/1.0" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:foo="http://purl.org/rss/1.0/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:prov="http://www.w3.org/ns/prov#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="html" indent="yes" omit-xml-decleration="no"/><xsl:output media-type="application/atom+xml"/><xsl:template match="/atom:feed"><xsl:variable name="rtl" select="@xml:lang[ contains(self::node(),&quot;ar&quot;) or contains(self::node(),&quot;fa&quot;) or contains(self::node(),&quot;he&quot;) or contains(self::node(),&quot;ji&quot;) or contains(self::node(),&quot;ku&quot;) or contains(self::node(),&quot;ur&quot;) or contains(self::node(),&quot;yi&quot;)]"/><html><head><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;description&quot;"/><xsl:with-param name="content" select="atom:subtitle"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;generator&quot;"/><xsl:with-param name="content" select="&quot;syndication4humans https://sjehuda.github.io/&quot;"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;mimetype&quot;"/><xsl:with-param name="content" select="&quot;application/atom+xml&quot;"/></xsl:call-template><title><xsl:choose><xsl:when test="atom:title and not(atom:title=&quot;&quot;)"><xsl:value-of select="atom:title"/></xsl:when><xsl:otherwise>Streamburner News Reader</xsl:otherwise></xsl:choose></title><xsl:if test="$rtl"><meta name="semitic" content="true"/></xsl:if></head><body><div id="feed"><header><div id="title"><xsl:choose><xsl:when test="atom:title and not(atom:title=&quot;&quot;)"><xsl:attribute name="title"><xsl:value-of select="atom:title"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:when><xsl:otherwise><div class="empty"/></xsl:otherwise></xsl:choose></div><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="atom:subtitle"/></xsl:attribute><xsl:value-of select="atom:subtitle"/></div></header><section id="links"><a title="Click to get the latest updates and news" onclick="location.href = &quot;feed:&quot; + location.href"></a><a title="Subscribe via SubToMe"><xsl:attribute name="href">https://www.subtome.com/#/subscribe?feeds=<xsl:value-of select="atom:link[@rel=&quot;self&quot;]/@href"/></xsl:attribute><xsl:attribute name="onclick">(function(btn){var z=document.createElement(&quot;script&quot;);document.subtomeBtn=btn;z.src=&quot;https://www.subtome.com/load.js&quot;;document.body.appendChild(z);})(this);return false;</xsl:attribute></a><a title="Learn about syndication feed" onclick="document.getElementById(&quot;aboutfeed&quot;).classList.toggle(&quot;show&quot;);" class="popup"><span class="popuptext" id="aboutfeed"/></a><a href="https://wikiless.org/wiki/Template:Aggregators" title="Get a feed reader for desktop and mobile"/><a href="https://wikiless.org/wiki/RSS" title="Learn the benefits of using feeds for personal and corporates"/></section><xsl:choose><xsl:when test="atom:entry"><div id="toc"><xsl:for-each select="atom:entry[not(position() &gt;20)]"><xsl:if test="atom:title"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:element></xsl:if></xsl:for-each></div></xsl:when></xsl:choose><section id="articles"><xsl:choose><xsl:when test="atom:entry"><xsl:for-each select="atom:entry[not(position() &gt;20)]"><div class="entry"><xsl:if test="atom:title"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:choose><xsl:when test="atom:link[contains(@rel,&quot;alternate&quot;)]"><xsl:value-of select="atom:link[contains(@rel,&quot;alternate&quot;)]/@href"/></xsl:when><xsl:otherwise><xsl:value-of select="atom:link/@href"/></xsl:otherwise></xsl:choose></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="atom:title"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:element></div></xsl:if><xsl:choose><xsl:when test="geo:lat and geo:long"><xsl:variable name="lat" select="geo:lat"/><xsl:variable name="lng" select="geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">๐Ÿ“</a></span></xsl:when><xsl:when test="geo:Point"><xsl:variable name="lat" select="geo:Point/geo:lat"/><xsl:variable name="lng" select="geo:Point/geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">๐Ÿ“</a></span></xsl:when><xsl:when test="georss:point"><xsl:variable name="lat" select="substring-before(georss:point, &quot; &quot;)"/><xsl:variable name="lng" select="substring-after(georss:point, &quot; &quot;)"/><xsl:variable name="name" select="georss:featurename"/><span class="geolocation"><a href="geo:{$lat},{$lng}" title="{$name}">๐Ÿ“</a></span></xsl:when></xsl:choose><xsl:choose><xsl:when test="atom:updated"><div class="updated"><xsl:value-of select="atom:updated"/></div></xsl:when><xsl:when test="atom:published"><div class="published"><xsl:value-of select="atom:published"/></div></xsl:when><xsl:otherwise><div class="warning atom1 published"/></xsl:otherwise></xsl:choose><xsl:if test="atom:content or atom:summary"><div class="content"><xsl:choose><xsl:when test="atom:summary[contains(@type,&quot;text&quot;)]"><xsl:attribute name="type"><xsl:value-of select="atom:summary/@type"/></xsl:attribute><xsl:value-of select="atom:summary"/></xsl:when><xsl:when test="atom:summary[contains(@type,&quot;base64&quot;)]"></xsl:when><xsl:when test="atom:content[contains(@type,&quot;text&quot;)]"><xsl:attribute name="type"><xsl:value-of select="atom:content/@type"/></xsl:attribute><xsl:value-of select="atom:content"/></xsl:when><xsl:when test="atom:content[contains(@type,&quot;base64&quot;)]"></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="atom:summary and not(atom:summary=&quot;&quot;)"><xsl:value-of select="atom:summary" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="atom:content" disable-output-escaping="yes"/></xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose></div></xsl:if><xsl:if test="atom:link[contains(@rel,&quot;enclosure&quot;)]"><div class="enclosure" title="Right-click and Save link asโ€ฆ"><xsl:for-each select="atom:link[contains(@rel,&quot;enclosure&quot;)]"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@href"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:if test="@length &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@length"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each><xsl:for-each select="media:content"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:if test="@fileSize &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@fileSize"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each></div></xsl:if></div><xsl:if test="not(atom:id)"><div class="warning atom1 id"/></xsl:if></xsl:for-each></xsl:when><xsl:otherwise><div class="notice no-entry"/></xsl:otherwise></xsl:choose></section></div></body></html></xsl:template><xsl:output media-type="application/rdf+xml"/><xsl:template match="/rdf:RDF"><xsl:variable name="rtl" select="channel/language[ contains(text(),&quot;ar&quot;) or contains(text(),&quot;fa&quot;) or contains(text(),&quot;he&quot;) or contains(text(),&quot;ji&quot;) or contains(text(),&quot;ku&quot;) or contains(text(),&quot;ur&quot;) or contains(text(),&quot;yi&quot;)]"/><html><head><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;description&quot;"/><xsl:with-param name="content" select="foo:channel/foo:description"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;generator&quot;"/><xsl:with-param name="content" select="&quot;syndication4humans https://sjehuda.github.io/&quot;"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;mimetype&quot;"/><xsl:with-param name="content" select="&quot;application/rdf+xml&quot;"/></xsl:call-template><title><xsl:choose><xsl:when test="foo:channel/foo:title and not(foo:channel/foo:title=&quot;&quot;)"><xsl:value-of select="foo:channel/foo:title"/></xsl:when><xsl:otherwise>Streamburner News Reader</xsl:otherwise></xsl:choose></title><xsl:if test="$rtl"><meta name="semitic" content="true"/></xsl:if></head><body><div id="feed"><header><div id="title"><xsl:choose><xsl:when test="foo:channel/foo:title and not(foo:channel/foo:title=&quot;&quot;)"><xsl:attribute name="title"><xsl:value-of select="foo:channel/foo:title"/></xsl:attribute><xsl:value-of select="foo:channel/foo:title"/></xsl:when><xsl:otherwise><div class="empty"/></xsl:otherwise></xsl:choose></div><xsl:choose><xsl:when test="foo:channel/itunes:subtitle"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="foo:channel/itunes:subtitle"/></xsl:attribute><xsl:value-of select="foo:channel/itunes:subtitle"/></div></xsl:when><xsl:when test="foo:channel/foo:description"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="foo:channel/foo:description"/></xsl:attribute><xsl:value-of select="foo:channel/foo:description"/></div></xsl:when></xsl:choose></header><section id="links"><a title="Click to get the latest updates and news" onclick="location.href = &quot;feed:&quot; + location.href"></a><a title="Subscribe via SubToMe"><xsl:attribute name="href">https://www.subtome.com/#/subscribe?feeds=<xsl:value-of select="atom:link[@rel=&quot;self&quot;]/@href"/></xsl:attribute><xsl:attribute name="onclick">(function(btn){var z=document.createElement(&quot;script&quot;);document.subtomeBtn=btn;z.src=&quot;https://www.subtome.com/load.js&quot;;document.body.appendChild(z);})(this);return false;</xsl:attribute></a><a title="Learn about syndication feed" onclick="document.getElementById(&quot;aboutfeed&quot;).classList.toggle(&quot;show&quot;);" class="popup"><span class="popuptext" id="aboutfeed"/></a><a href="https://wikiless.org/wiki/Template:Aggregators" title="Get a feed reader for desktop and mobile"/><a href="https://wikiless.org/wiki/RSS" title="Learn the benefits of using feeds for personal and corporates"/></section><xsl:choose><xsl:when test="foo:item"><div id="toc"><xsl:for-each select="foo:item[not(position() &gt;20)]"><xsl:choose><xsl:when test="itunes:subtitle"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></xsl:when><xsl:when test="foo:title"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="foo:title"/></xsl:element></xsl:when></xsl:choose></xsl:for-each></div></xsl:when></xsl:choose><section id="articles"><xsl:choose><xsl:when test="foo:item"><xsl:for-each select="foo:item[not(position() &gt;20)]"><div class="entry"><xsl:choose><xsl:when test="itunes:subtitle"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="foo:link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="itunes:subtitle"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></div></xsl:when><xsl:when test="foo:title"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="foo:link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="foo:title"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="foo:title"/></xsl:element></div></xsl:when><xsl:otherwise><div class="warning rss title"/></xsl:otherwise></xsl:choose><xsl:choose><xsl:when test="geo:lat and geo:long"><xsl:variable name="lat" select="geo:lat"/><xsl:variable name="lng" select="geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">๐Ÿ“</a></span></xsl:when><xsl:when test="geo:Point"><xsl:variable name="lat" select="geo:Point/geo:lat"/><xsl:variable name="lng" select="geo:Point/geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">๐Ÿ“</a></span></xsl:when><xsl:when test="georss:point"><xsl:variable name="lat" select="substring-before(georss:point, &quot; &quot;)"/><xsl:variable name="lng" select="substring-after(georss:point, &quot; &quot;)"/><xsl:variable name="name" select="georss:featurename"/><span class="geolocation"><a href="geo:{$lat},{$lng}" title="{$name}">๐Ÿ“</a></span></xsl:when></xsl:choose><xsl:if test="dc:date"><div class="published"><xsl:value-of select="dc:date"/></div></xsl:if><xsl:choose><xsl:when test="content:encoded"><div class="content"><xsl:value-of select="content:encoded" disable-output-escaping="yes"/></div></xsl:when><xsl:when test="foo:description"><div class="content"><xsl:value-of select="foo:description" disable-output-escaping="yes"/></div></xsl:when><xsl:when test="itunes:summary"><div class="content"><xsl:value-of select="itunes:summary" disable-output-escaping="yes"/></div></xsl:when><xsl:otherwise><div class="warning rss description"/></xsl:otherwise></xsl:choose><xsl:if test="enc:enclosure"><div class="enclosure" title="Right-click and Save link asโ€ฆ"><xsl:for-each select="enc:enclosure"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="substring-before(@enc:type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@rdf:resource"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@rdf:resource"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="substring-before(@enc:type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:if test="@enc:length &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@enc:length"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each></div></xsl:if></div></xsl:for-each></xsl:when><xsl:otherwise><div class="notice no-entry"/></xsl:otherwise></xsl:choose></section></div></body></html></xsl:template><xsl:output media-type="application/rss+xml"/><xsl:template match="/rss"><xsl:variable name="rtl" select="channel/language[ contains(text(),&quot;ar&quot;) or contains(text(),&quot;fa&quot;) or contains(text(),&quot;he&quot;) or contains(text(),&quot;ji&quot;) or contains(text(),&quot;ku&quot;) or contains(text(),&quot;ur&quot;) or contains(text(),&quot;yi&quot;)]"/><html><head><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;description&quot;"/><xsl:with-param name="content" select="channel/description"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;generator&quot;"/><xsl:with-param name="content" select="&quot;syndication4humans https://sjehuda.github.io/&quot;"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;mimetype&quot;"/><xsl:with-param name="content" select="&quot;application/rss+xml&quot;"/></xsl:call-template><title><xsl:choose><xsl:when test="channel/title and not(channel/title=&quot;&quot;)"><xsl:value-of select="channel/title"/></xsl:when><xsl:otherwise>Streamburner News Reader</xsl:otherwise></xsl:choose></title><xsl:if test="$rtl"><meta name="semitic" content="true"/></xsl:if></head><body><div id="feed"><header><div id="title"><xsl:choose><xsl:when test="channel/title and not(channel/title=&quot;&quot;)"><xsl:attribute name="title"><xsl:value-of select="channel/title"/></xsl:attribute><xsl:value-of select="channel/title"/></xsl:when><xsl:otherwise><div class="empty"/></xsl:otherwise></xsl:choose></div><xsl:choose><xsl:when test="channel/itunes:subtitle"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="channel/itunes:subtitle"/></xsl:attribute><xsl:value-of select="channel/itunes:subtitle"/></div></xsl:when><xsl:when test="channel/description"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="channel/description"/></xsl:attribute><xsl:value-of select="channel/description"/></div></xsl:when></xsl:choose></header><section id="links"><a title="Click to get the latest updates and news" onclick="location.href = &quot;feed:&quot; + location.href"></a><a title="Subscribe via SubToMe"><xsl:attribute name="href">https://www.subtome.com/#/subscribe?feeds=<xsl:value-of select="atom:link[@rel=&quot;self&quot;]/@href"/></xsl:attribute><xsl:attribute name="onclick">(function(btn){var z=document.createElement(&quot;script&quot;);document.subtomeBtn=btn;z.src=&quot;https://www.subtome.com/load.js&quot;;document.body.appendChild(z);})(this);return false;</xsl:attribute></a><a title="Learn about syndication feed" onclick="document.getElementById(&quot;aboutfeed&quot;).classList.toggle(&quot;show&quot;);" class="popup"><span class="popuptext" id="aboutfeed"/></a><a href="https://wikiless.org/wiki/Template:Aggregators" title="Get a feed reader for desktop and mobile"/><a href="https://wikiless.org/wiki/RSS" title="Learn the benefits of using feeds for personal and corporates"/></section><xsl:choose><xsl:when test="channel/item"><div id="toc"><xsl:for-each select="channel/item[not(position() &gt;20)]"><xsl:choose><xsl:when test="itunes:subtitle"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></xsl:when><xsl:when test="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="title"/></xsl:element></xsl:when></xsl:choose></xsl:for-each></div></xsl:when></xsl:choose><section id="articles"><xsl:choose><xsl:when test="channel/item"><xsl:for-each select="channel/item[not(position() &gt;20)]"><div class="entry"><xsl:choose><xsl:when test="itunes:subtitle"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="itunes:subtitle"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></div></xsl:when><xsl:when test="title"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="title"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="title"/></xsl:element></div></xsl:when><xsl:otherwise><div class="warning rss2 title"/></xsl:otherwise></xsl:choose><xsl:choose><xsl:when test="geo:lat and geo:long"><xsl:variable name="lat" select="geo:lat"/><xsl:variable name="lng" select="geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">๐Ÿ“</a></span></xsl:when><xsl:when test="geo:Point"><xsl:variable name="lat" select="geo:Point/geo:lat"/><xsl:variable name="lng" select="geo:Point/geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">๐Ÿ“</a></span></xsl:when><xsl:when test="georss:point"><xsl:variable name="lat" select="substring-before(georss:point, &quot; &quot;)"/><xsl:variable name="lng" select="substring-after(georss:point, &quot; &quot;)"/><xsl:variable name="name" select="georss:featurename"/><span class="geolocation"><a href="geo:{$lat},{$lng}" title="{$name}">๐Ÿ“</a></span></xsl:when></xsl:choose><xsl:if test="pubDate"><div class="published"><xsl:value-of select="pubDate"/></div></xsl:if><xsl:choose><xsl:when test="content:encoded"><div class="content"><xsl:value-of select="content:encoded" disable-output-escaping="yes"/></div></xsl:when><xsl:when test="description"><div class="content"><xsl:value-of select="description" disable-output-escaping="yes"/></div></xsl:when><xsl:when test="itunes:summary"><div class="content"><xsl:value-of select="itunes:summary" disable-output-escaping="yes"/></div></xsl:when><xsl:otherwise><div class="warning rss2 description"/></xsl:otherwise></xsl:choose><xsl:if test="enclosure or media:content"><div class="enclosure" title="Right-click and Save link asโ€ฆ"><xsl:for-each select="enclosure"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:if test="@length &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@length"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each><xsl:for-each select="media:content"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:if test="@fileSize &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@fileSize"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each></div></xsl:if></div></xsl:for-each></xsl:when><xsl:otherwise><div class="notice no-entry"/></xsl:otherwise></xsl:choose></section></div></body></html></xsl:template><xsl:template name="metadata"><xsl:param name="name"/><xsl:param name="content"/><xsl:if test="$content and not($content=&quot;&quot;)"><xsl:element name="meta"><xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute><xsl:attribute name="content"><xsl:value-of select="$content"/></xsl:attribute></xsl:element></xsl:if></xsl:template><xsl:template name="extract-filename"><xsl:param name="url"/><xsl:choose><xsl:when test="substring($url, string-length($url) - string-length(&quot;/&quot;) + 1) = &quot;/&quot;"><xsl:value-of select="substring-after(substring($url, 1, string-length($url) - 1),&quot;://&quot;)"/></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="contains($url,&quot;/&quot;) and contains(substring-after($url,&quot;/&quot;),&quot;.&quot;)"><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="substring-after($url,&quot;/&quot;)"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:value-of select="$url"/></xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="transform-filesize"><xsl:param name="length"/><xsl:choose><xsl:when test="$length &lt; 2"><xsl:value-of select="$length"/>Byte</xsl:when><xsl:when test="floor($length div 1024) &lt; 1"><xsl:value-of select="$length"/>Bytes</xsl:when><xsl:when test="floor($length div (1024 * 1024)) &lt; 1"><xsl:value-of select="floor($length div 1024)"/>.<xsl:value-of select="substring($length mod 1024,0,2)"/>KiB</xsl:when><xsl:when test="floor($length div (1024 * 1024 * 1024)) &lt; 1"><xsl:value-of select="floor($length div (1024 * 1024))"/>.<xsl:value-of select="substring($length mod (1024 * 1024),0,2)"/>MiB</xsl:when><xsl:otherwise><xsl:value-of select="floor($length div (1024 * 1024 * 1024))"/>.<xsl:value-of select="substring($length mod (1024 * 1024 * 1024),0,2)"/>GiB</xsl:otherwise></xsl:choose></xsl:template></xsl:stylesheet>';

  xsltStylesheet =
    domParser
    .parseFromString(
      xslFile, 'application/xml' // application/xslt+xml or text/xsl are Not Valid
    );

  xsltProcessor
  .importStylesheet(
    xsltStylesheet
  );

  newDocument =
    xsltProcessor
    .transformToDocument(
      xmlDocument
    );

  // FIXME
  // Blocked due to server policy
  // https://archlinux.org/feeds/packages/
  // https://www.openstreetmap.org/traces/rss
  // https://gultsch.social/@daniel.rss
  // NOTE
  // We can use inline style (i.e. style="")
  // but that would make the code lesser manageable
  stylesheet_ltr = "html,body{padding:0;margin:0}body{background:WhiteSmoke;color:#333;hyphens:auto}header{margin:0 -1em 1em -1em;margin-bottom:1em;padding:1em 1em 0 1em}#feed{min-width:400px;overflow:auto;position:relative}*{max-width:100%;object-fit:contain;height:auto}#logo{display:inline-block;float:left;overflow:hidden;position:relative;height:60px;width:60px;margin-right:9;padding-top:12}#logo>a>img{margin:auto;max-width:100%;position:absolute;width:5em;bottom:0;right:0;left:0;top:0}#title{font-variant:small-caps;text-align:center}#title{font-weight:bold;margin-bottom:0;overflow:hidden;-webkit-line-clamp:2;white-space:nowrap;margin:0;font-size:2.2em}#title .empty:before{font-variant:small-caps;content:'Streamburner News Dashboard';text-align:center}#subtitle{overflow:hidden;-webkit-line-clamp:2;white-space:wrap;font-weight:bold;font-size:1.5em;text-align:center;font-variant:small-caps}.container{display:flex}#links{border-top:.1em solid;margin:auto;width:50%;text-align:center;direction:ltr}#links>a{padding:10px;text-decoration:none;font-size:70%}#links>a:nth-child(1):after{content:'Follow';cursor:pointer;border-color:grey;border-left-style:solid;border-radius:1px;padding:6px;background:#eee !important}#links>a:nth-child(2):after{content:'SubToMe';cursor:pointer}#links>a:nth-child(3):after{content:'Whatโ€™s This?';cursor:help}#links>a:nth-child(4):after{content:'Get a News Reader'}#links>a:nth-child(5):after{content:'More Info...'}#toc{margin-left:3%;padding:5px}#toc:before{content:'Latest Updates';font-size:76%;font-weight:bold}#toc>a{text-decoration:none;font-size:66%;display:block;padding:5px 0;margin-left:1%}#toc>a:hover{text-decoration:underline}#toc>a:visited{text-decoration:line-through}.popup{position:relative;display:inline-block;cursor:pointer}.popup .popuptext{visibility:hidden;width:160px;color:#fff;border-radius:6px;padding:18px;position:absolute;z-index:1;background-color:#555;position:absolute;right:4%;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:50%;text-align:left}.popup .popuptext:after{content:'๐Ÿ“ฐ Web Syndication News Feed \\A\\A ' ' Syndication Feed is a mean for content and media publishers ' 'to reach a wider audience easily. ' ' It allows you to receive information directly without the ' 'going from site to site. \\A\\A ' ' Essentially, a feed is a function that allows โ€œFeed Readersโ€ ' 'to access multiple websites automatically looking for new ' 'content and then posting the information about new content ' 'and updates to another website, mobile app or desktop software ' 'at the office. \\A\\A ' ' Feeds provide a way for users to keep up with the latest ' 'news, events and package and delivery status information ' 'posted on different websites such as social networks, torrent ' 'indexers or podcasts in one spot.';white-space:pre-wrap;line-height:1.8;font-size:150%}.popup .show{visibility:visible;-webkit-animation:fadeIn 1s;animation:fadeIn 1s}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}#articles{justify-content:space-between;max-width:90%;margin:0 auto;padding:10px 0}#articles>*{margin:.5em;white-space:normal;vertical-align:top;margin-bottom:50px}.entry{border-bottom:inset;margin-left:auto;margin-right:auto;overflow:auto;line-height:1.6;font-size:85%;overflow-x:hidden}.entry:hover{background:#f8f9fa}.entry *{max-width:98%}.entry>a{white-space:normal}.title{cursor:pointer;display:inline-block;font-size:110%;font-weight:bold;text-decoration:underline;overflow:visible;text-overflow:ellipsis;white-space:nowrap;font-variant:small-caps}a{color:#333;display:inline-block}.geolocation>a{text-decoration:none;padding-left:6px}.author{font-size:75%;margin:0 auto 0 auto}.author:before{content:'By '}.author:after{content:' / '}.published,.updated{font-size:75%;margin:0 auto 0 auto}.content{margin:15px auto 15px 1%;inline-size:95%;text-indent:3px}.content[type='text']{font-family:monospace}code{overflow:auto;display:block;max-height:300px;border-radius:4px}.enclosure{background:#eee;border:1px solid GrayText;border-radius:4px;clear:both;color:#525c66;cursor:help;direction:ltr;font-size:.8em;margin:5px auto 15px 1%;padding:15px;vertical-align:middle;border:1px solid #aaa;border-radius:.5em;max-width:100%;moz-border-radius:.5em;padding:1em}.enclosure>span:after{content:' (Document file) '}.enclosure>span.executable:after{content:' (Executable file) '}.enclosure>span.image:after{content:' (Image file) '}.enclosure>span.audio:after{content:' (Audio file) '}.enclosure>span.video:after{content:' (Video file) '}.enclosure>span[icon]:after{content:'๐Ÿ“„๏ธ';margin:3px}.enclosure>span[icon='executable']:after{content:'๐Ÿ“ฆ๏ธ';margin:3px}.enclosure>span[icon='image']:after{content:'๐Ÿ–ผ๏ธ';margin:3px}.enclosure>span[icon='audio']:after{content:'๐ŸŽผ๏ธ';margin:3px}.enclosure>span[icon='video']:after{content:'๐Ÿ“ฝ๏ธ';margin:3px}.notice{text-align:center;display:block;font-size:130%;font-weight:lighter;font-variant-caps:small-caps;font-style:oblique;color:FireBrick}.warning{display:block;font-size:60%;font-weight:bold;color:DarkRed}.no-entry:after{content:'This news feed is empty'}.atom1.author:after{content:'Atom 1.0 Warning: Element </author> is missing'}.atom1.id:after{content:'Atom 1.0 Warning: Element </id> is missing'}.atom1.link:after{content:'Atom 1.0 Warning: Element </link> is missing'}.atom1.published:after{content:'Atom 1.0 Warning: Element </published> is missing'}.atom1.title:after{content:'Atom 1.0 Warning: Element </title> is missing'}.rss2.description:after{content:'RSS 2.0 Warning: Element </description> is missing'}.rss2.link:after{content:'RSS 2.0 Warning: Element </link> is missing'}.rss2.title:after{content:'RSS 2.0 Warning: Element </title> is missing'}abbr,acronym{border-bottom:1px dotted #c30}dt{font-weight:bold}";
  stylesheet_rtl = "html,body{text-align:right}#feed{direction:rtl}#logo{float:right;margin-left:9}.geolocation>a{padding-right:6px}.image{float:right;margin-left:40px;margin-right:auto}"
  style = newDocument.createElement('style');
  newDocument.head.append(style);
  style.type = 'text/css';

  // NOTE
  // Because we use JS, maybe it is better to set direction by
  // the letters of the initial set of words.
  var isRTL =
    newDocument
    .querySelector(
      'meta[name="semitic"]'
    );

  if (isRTL) {
    style.innerHTML =
      stylesheet_ltr +
      stylesheet_rtl;
  } else {
    style.innerHTML =
      stylesheet_ltr;
  }

  //var newDoc = document.adoptNode(newDoc.documentElement, true);
  insertDocument =
    document
    .importNode(
      newDocument
      .documentElement,
      true
    );

  removeDocument =
    document
    .documentElement;

  document
  .replaceChild(
    insertDocument,
    removeDocument
  );

}

function queryByXPath(queries) {
  var result;
  let i = 0;
  do {
    result = document.evaluate(
      queries[i], document,
      null, XPathResult.STRING_TYPE);
    i = i + 1;
    result = result.stringValue;
  } while (!result && i < queries.length);
  return result;
}

Conclusion: Examine Promise with XMLHttpRequest.




Solved with .enable

- DarkReader.auto({brightness:100,contrast:90,sepia:10});
+ DarkReader.enable({brightness:100,contrast:90,sepia:10});
๏ฟผ```

I've found a good solution at karmatics.com

Script

<script type="text/javascript">
    function toggle( targetId ){
         if (document.getElementById){
            target = document.getElementById( targetId );
                if (target.style.display == "none"){
                    target.style.display = "";
                } else {
                    target.style.display = "none";
                }
            }
        }
</script>

HTML

    <p id="install"><a href="aardvark.xpi" id="button"><span>Install Now</span></a> <a href="#" onclick="toggle('installing');return false;">Installation Notes</a></p>
    <div id="installing" style="display:none;">
        <div>
        <p><img src="/web/20050423235409im_/http://karmatics.com/aardvark/img/options.gif" alt="Extension options" class="floatl marl"/> If you get a prompt about installing software, click <em>Edit Options</em>, click <em>Allow</em>, then click <em>OK</em>. Click Install Now again and Aardvark should be installed just like any other extension.</p>
        <p>You will need to restart Firefox before using the extension. Once you have done so, you may right-click, and then select "Start Aardvark" from the menu (alternatively you can select "Start Aardvark" from the Tools menu at the top of the browser window).</p>
        <p><a href="#" onclick="toggle('installing');return false;" id="closer"> &times; close</a></p>
        </div>
    </div>

Hello,

I'd be glad to get help in porting Aardvark to a Userscript.

Currently, the bookmarklet is not usable in some web broswers due to new restricting policies.

Console

Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure script '<URL>'. This request has been blocked; the content must be served over HTTPS.
bookmarklet.js:71 Mixed Content: The page at 'https://www.karmatics.com/aardvark/' was loaded over HTTPS, but requested an insecure script 'http://karmatics.com/aardvark/aardvarkStrings.js'. This request has been blocked; the content must be served over HTTPS.
bookmarklet.js:71 Mixed Content: The page at 'https://www.karmatics.com/aardvark/' was loaded over HTTPS, but requested an insecure script 'http://karmatics.com/aardvark/aardvarkUtils.js'. This request has been blocked; the content must be served over HTTPS.
bookmarklet.js:71 Mixed Content: The page at 'https://www.karmatics.com/aardvark/' was loaded over HTTPS, but requested an insecure script 'http://karmatics.com/aardvark/aardvarkDBox.js'. This request has been blocked; the content must be served over HTTPS.
bookmarklet.js:71 Mixed Content: The page at 'https://www.karmatics.com/aardvark/' was loaded over HTTPS, but requested an insecure script 'http://karmatics.com/aardvark/aardvarkCommands.js'. This request has been blocked; the content must be served over HTTPS.
bookmarklet.js:71 Mixed Content: The page at 'https://www.karmatics.com/aardvark/' was loaded over HTTPS, but requested an insecure script 'http://karmatics.com/aardvark/aardvarkMain.js'. This request has been blocked; the content must be served over HTTPS.

I'm not sure where to begin.

Here's the [initial draft[(https://openuserjs.org/scripts/sjehuda/Aardvark) which is really a copy & paste of the bookmarklet advertised on the Aardvark homepage.


TrustedHTML error
Page won't transform.

lidel's stream of shared things
https://feeds.lidel.org/lidel-trashlog

VM6 Newspaper:174
This document requires 'TrustedHTML' assignment.
renderFeed	@	VM6 Newspaper:174

VM6 Newspaper:174
Uncaught TypeError: Failed to execute 'parseFromString' on 'DOMParser': This document requires 'TrustedHTML' assignment.
    at renderFeed (VM6 Newspaper:174)
    at checkMediaType (VM6 Newspaper:155)
    at XMLHttpRequest.xmlHTTPRequest.onreadystatechange (VM6 Newspaper:96)

Page turns dark

Anjan Momi Homepage
https://momi.ca/feed.xml

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="https://momi.ca/feed.xml" rel="self" type="application/rss+xml" />
<title>Anjan Momi Homepage</title>
<description>Anjandev Momi's Homepage</description>
<link>https://momi.ca/</link>
<managingEditor>anjan@momi.ca (Anjandev Momi)</managingEditor>
<lastBuildDate>Fri, 21 Oct 2022 03:34:18 -0700</lastBuildDate>

<item>
<guid>https://momi.ca/posts/2022-09-07-mainline.html</guid>
<link>https://momi.ca/posts/2022-09-07-mainline.html</link>
<pubDate>Wed, 07 Sep 2022 00:00:00 -0700</pubDate>
<title>The Pinephone Pro, PostmarketOS, and Why Mainlining Phones is Important</title>
<description><![CDATA[

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Anjan's Homepage</title>
        <link rel="icon" type="image/svg+xml" href="https://momi.ca/favicon.svg">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="https://momi.ca/css/base.css">
        <link rel="stylesheet" type="text/css" href="https://momi.ca/css/dark.css">
        <link rel="alternate" type="application/atom+xml" href="https://momi.ca/feed.xml">
    </head>
    <body>
        <div class="container">
            <div class="content">
<h1 class="page-title">The Pinephone Pro, PostmarketOS, and Why Mainlining Phones is Important</h1>
<p class="date">Published 2022-09-07 on <a href="https://momi.ca/">Anjan's Homepage</a></p>
<p>
In <code>#sxmo</code> on OFTC, users often ask why the pinephone pro is less functional on postmarketOS than other distros.
PostmarketOS uses a mainline pinephone pro kernel <sup><a id="fnr.1" class="footref" href="https://momi.ca/#fn.1" role="doc-backlink">1</a></sup>.

https://momi.ca/css/dark.css

/* Common theme */
html,
body,
:not([style*="background-color:"]) {
    background-color: rgb(16, 20, 23) !important;
}
html,
body,
:not([style*="color:"]) {
    color: rgb(167, 158, 139) !important;
}
h1:not([style*="color:"]),
h2:not([style*="color:"]),
h3:not([style*="color:"]),
h4:not([style*="color:"]),
h5:not([style*="color:"]),
h6:not([style*="color:"]) {
    color: rgb(209, 76, 51) !important;
}
cite:not([style*="color:"]) {
    color: rgb(128, 204, 148) !important;
}
input:not([style*="background-color:"]),
textarea:not([style*="background-color:"]),
button:not([style*="background-color:"]),
[role="button"] {
    background-color: rgb(32, 48, 64) !important;
}
input:not([style*="background-color:"]):hover,
textarea:not([style*="background-color:"]):hover,
button:not([style*="background-color:"]):hover,
[role="button"]:hover {
    background-color: rgb(30, 54, 78) !important;
}
input:not([style*="background-color:"]):active, input:not([style*="background-color:"]):focus,
textarea:not([style*="background-color:"]):active, textarea:not([style*="background-color:"]):focus,
button:not([style*="background-color:"]):active, button:not([style*="background-color:"]):focus,
[role="button"]:active, [role="button"]:focus {
    background-color: rgb(29, 56, 83) !important;
}
a:not([style*="color:"]) {
    color: rgb(128, 182, 204) !important;
}
a:not([style*="color:"]):hover {
    color: rgb(142, 193, 217) !important;
}
a:not([style*="color:"]):active, a:not([style*="color:"]):focus {
    color: rgb(155, 203, 230) !important;
}
:not([style*="border-color:"]),
::before,
::after {
    border-color: rgb(80, 115, 134) !important;
}
div:empty {
    background-color: rgb(16, 20, 23) !important;
}
input::placeholder,
textarea::placeholder {
    color: rgb(167, 158, 139) !important;
}
input:not([style*="background-image:"]),
textarea:not([style*="background-image:"]) {
    background-image: none !important;
}

.inline-block {
   display: inline-block;
}

https://momi.ca/css/base.css

.webring .articles {
  display: flex; }

.webring .title {
  margin: 0; }

.webring .article {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  margin: 0 0.5rem;
  padding: 0.5rem;
  background: #eee; }

.webring .article:first-child {
  margin-left: 0; }

.webring .article:last-child {
  margin-right: 0; }

.webring .summary {
  font-size: 0.8rem;
  flex: 1 1 0; }

.webring .attribution {
  text-align: right;
  font-size: 0.8rem;
  color: #555; }

.webring .date {
  color: black; }

pre {
  border: 1px #ddd solid;
  border-radius: 0;
  overflow-x: auto;
  background: transparent;
  line-height: 1.2;
  max-width: 100%;
  margin: 0 auto; }

pre code {
  white-space: pre;
  word-wrap: normal; }

code {
  font-family: monospace;
  color: #000;
  font-size: 9pt; }

html, body {
  overflow-x: hidden;
  font-family: sans-serif;
  font-size: 12pt; }

article p {
  line-height: 1.25;
  font-size: 12pt; }

body {
  background: #fff;
  padding-bottom: 2rem; }

iframe[src*="youtube"] {
  width: 100%;
  height: 400px;
  margin: 20px 0; }

.video-js {
  width: 100% !important;
  height: 0px !important;
  padding-top: 62.5%; }

video {
  max-width: 100%; }

.asciicast iframe {
  margin: 0 auto !important;
  display: block !important; }

img {
  max-width: 100%;
  margin: 0 auto;
  display: block; }

a {
  color: blue;
  text-decoration: underline; }

h1 {
  padding-top: 0;
  font-size: 16pt; }

h1, h2, h3, h4, h5 {
  text-align: left; }

h1 small {
  font-size: 14pt; }

.footnotes::before {
  content: "References:"; }

.footnotes {
  font-size: 8pt;
  margin-top: 50px; }

blockquote {
  padding-left: 10px;
  padding-top: 3px;
  padding-bottom: 3px;
  margin-left: 0;
  border-left: 4px #aaa solid;
  font-size: 11pt;
  color: #666; }

.sidebar {
  padding-top: 20px; }

.sidebar .fa {
  width: 18px;
  text-align: center; }

.sidebar, .sidebar a {
  color: #444; }

.sidebar a {
  text-decoration: underline; }

.sidebar h3 {
  font-size: 14pt;
  margin-top: 40px; }

.sidebar h4, h5 {
  margin: 5px 0; }

.sidebar h4 {
  font-weight: bold; }

.btn {
  display: inline-block;
  padding: .1rem .75rem;
  background: #e9ecef;
  border: #343a40 1px solid;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
  color: #000;
  text-decoration: none;
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out; }
  .btn:hover {
    text-decoration: none;
    background: #f8f9fa;
    color: #000; }
  .btn.btn-primary {
    border: #001933 1px solid;
    background: #0069d9;
    color: #fff; }
    .btn.btn-primary:hover {
      background: #0062cc;
      color: #fff; }

em {
  font-style: italic; }

.subtitle {
  text-align: center;
  margin-bottom: 1rem;
  margin-top: -10px;
  font-style: italic;
  font-size: 10pt; }

hr {
  border-color: #999; }

.post-stub h2 {
  font-size: 12pt;
  font-weight: bold; }

.post-stub .date {
  color: #999;
  display: inline-block;
  min-width: 6rem; }

.date {
  color: #999; }

.date a {
  color: #999;
  text-decoration: underline; }

.container {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr; }
  .container .page-title {
    grid-column-start: 1;
    grid-column-end: 3; }
  .container .content {
    max-width: 670px;
    grid-column-start: 1; }
  .container .sidebar {
    grid-column-start: 2;
    padding-left: 1rem; }
  @media (max-width: 768px) {
    .container {
      display: block; }
      .container .sidebar {
        padding-left: 0; } }
@media (min-width: 576px) {
  .visible-xs {
    display: none; } }

.page-title {
  margin-bottom: 0; }

.text-center {
  text-align: center; }

.text-muted {
  color: #444; }

pre {
  padding: 1rem;
  background: #efefef; }

.external-links {
  padding-top: 0.5rem; }
  .external-links > p {
    position: relative; }
  .external-links > p:not(:last-child) {
    padding-bottom: 0.5rem; }
  .external-links .context {
    position: absolute;
    top: -0.9rem;
    left: 0;
    font-size: 0.8rem;
    color: black; }

.pull-right {
  float: right; }

.pull-left {
  float: left; }

.icon {
  display: inline-block;
  line-height: .75em;
  width: 0.4em;
  vertical-align: -0.2em; }
  .icon path {
    fill: currentColor; }

.avatar {
  max-width: 50%;
  border-radius: 5px; }

/* Imported from bootstrap, for the donation fee calculator */
* {
  box-sizing: border-box; }

.form-control {
  display: block;
  width: 100%;
  height: 34px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.42857143;
  color: #555;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit; }

button, input, optgroup, select, textarea {
  color: inherit;
  font: inherit;
  margin: 0; }

.panel {
  margin-bottom: 20px;
  background-color: #fff;
  border: 1px solid transparent;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); }

.panel-default {
  border-color: #ddd; }

.panel-default > .panel-heading {
  color: #333;
  background-color: #f5f5f5;
  border-color: #ddd; }

.panel-heading {
  padding: 10px 15px;
  border-bottom: 1px solid transparent;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px; }

.panel-body {
  padding: 15px; }

.form-group {
  margin-bottom: 15px; }

label {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 5px;
  font-weight: 700; }

fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0; }

.checkbox-inline, .radio-inline {
  position: relative;
  display: inline-block;
  padding-left: 20px;
  margin-bottom: 0;
  font-weight: 400;
  vertical-align: middle;
  cursor: pointer;
  margin-right: 1rem; }

.checkbox input[type=checkbox],
.checkbox-inline input[type=checkbox],
.radio input[type=radio],
.radio-inline input[type=radio] {
  position: absolute;
  margin-top: 4px\9;
  margin-left: -20px; }

input[type=checkbox],
input[type=radio] {
  margin: 4px 0 0;
  margin-top: 1px\9;
  line-height: normal;
  box-sizing: border-box;
  padding: 0; }

.input-group {
  position: relative;
  display: table;
  border-collapse: separate; }

.input-group-addon:first-child {
  border-right: 0; }

.input-group-addon:last-child {
  border-left: 0; }

.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn-group:not(:last-child) > .btn,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0; }

.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn,
.input-group-btn:first-child > .btn:not(:first-child),
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group > .btn,
.input-group-btn:last-child > .dropdown-toggle {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0; }

.input-group .form-control:not(:first-child):not(:last-child),
.input-group-addon:not(:first-child):not(:last-child),
.input-group-btn:not(:first-child):not(:last-child) {
  border-radius: 0; }

.input-group .form-control {
  position: relative;
  z-index: 2;
  float: left;
  width: 100%;
  margin-bottom: 0; }

.input-group-addon {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  color: #555;
  text-align: center;
  background-color: #eee;
  border: 1px solid #ccc;
  border-radius: 4px; }

.input-group-addon, .input-group-btn {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle; }

.input-group .form-control,
.input-group-addon, .input-group-btn {
  display: table-cell; }

.table {
  width: 100%;
  max-width: 100%;
  margin-bottom: 20px; }

table {
  border-collapse: collapse;
  border-spacing: 0; }

th {
  text-align: left; }

.table > caption + thead > tr:first-child > td,
.table > caption + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > td,
.table > colgroup + thead > tr:first-child > th,
.table > thead:first-child > tr:first-child > td,
.table > thead:first-child > tr:first-child > th {
  border-top: 0; }

.table > thead > tr > th {
  vertical-align: bottom;
  border-bottom: 2px solid #ddd; }

.table > tbody > tr > td,
.table > tbody > tr > th,
.table > tfoot > tr > td,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > thead > tr > th {
  padding: 8px;
  line-height: 1.42857143;
  vertical-align: top;
  border-top: 1px solid #ddd; }

.table > tbody > tr.active > td,
.table > tbody > tr.active > th,
.table > tbody > tr > td.active,
.table > tbody > tr > th.active,
.table > tfoot > tr.active > td,
.table > tfoot > tr.active > th,
.table > tfoot > tr > td.active,
.table > tfoot > tr > th.active,
.table > thead > tr.active > td,
.table > thead > tr.active > th,
.table > thead > tr > td.active,
.table > thead > tr > th.active {
  background-color: #f5f5f5; }



// @name        Dark Mode
// @namespace   darkreader.org
// @match       *://*/*
// @grant       none
// @icon        https://p.pstatp.com/origin/ff740000b3f19de1691e
// @version     1.0.0
// @author      wenhairu
// @require     https://cdn.jsdelivr.net/npm/darkreader/darkreader.min.js
// ==/UserScript==
 
/* globals DarkReader */

DarkReader.auto({brightness:100,contrast:90,sepia:10});








Conclusion: From my study, this is a deliberate attempt to eliminate the XSLT and XPath technologies.

Boycott Mozilla and it's counterparts that cooperating with it!


3.00MB
3.07MB

146.38KB
146.39KB
146.40KB
146.41KB
146.42KB
146.43KB
146.44KB
146.45KB
146.46KB
146.47KB
146.48KB


xsl

<xsl:value-of select='atom:link[contains(@rel,"alternate")]/@href'/>

xml

    <entry>
      <title>2.7.0 Maintenance and security release</title>
      <link href="http://www.freerdp.com/2022/04/25/2_7_0-release" />
      <updated>2022-04-25T00:00:00+00:00</updated>
      <id>http://www.freerdp.com/2022/04/25/2_7_0-release</id>
      <content type="html">&lt;p&gt;FreeRDP 2.7.0 has just been released and uploaded to&lt;/p&gt;


Dino. Communicating happiness
https://dino.im/index.xml
https://dino.im/toot/index.xml

Problem:
Dino.im Toot links don't appear because title is empty, therefor link is not displayed and isn't clickable/reachable to end-user.

Solution (XSLT):
When there's no title, set text to (No title) or *** No title *** (Liferea fashion)

Generated HTML code:

<section xmlns="http://www.w3.org/1999/xhtml" id="articles"><div class="entry">
<div class="title"><a href="https://dino.im/toot/107787204408646020/" title="" id="newspaper-oujs-1"></a></div>
<div class="published">Sat, 12 Feb 2022 21:43:35 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/106228549009869402/" title="" id="newspaper-oujs-2"></a></div>
<div class="published">Thu, 13 May 2021 15:17:01 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/105198712041391648/" title="" id="newspaper-oujs-3"></a></div>
<div class="published">Thu, 12 Nov 2020 18:15:56 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/104671894466537578/" title="" id="newspaper-oujs-4"></a></div>
<div class="published">Tue, 11 Aug 2020 17:19:18 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/104237036622834210/" title="" id="newspaper-oujs-5"></a></div>
<div class="published">Tue, 26 May 2020 22:09:14 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103568619376380206/" title="" id="newspaper-oujs-6"></a></div>
<div class="published">Wed, 29 Jan 2020 21:01:56 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103385843480659384/" title="" id="newspaper-oujs-7"></a></div>
<div class="published">Sat, 28 Dec 2019 14:19:37 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103328905174441773/" title="" id="newspaper-oujs-8"></a></div>
<div class="published">Wed, 18 Dec 2019 12:59:28 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103018769092949060/" title="" id="newspaper-oujs-9"></a></div>
<div class="published">Thu, 24 Oct 2019 18:27:47 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102872465350824728/" title="" id="newspaper-oujs-10"></a></div>
<div class="published">Sat, 28 Sep 2019 22:20:49 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102809054908406084/" title="" id="newspaper-oujs-11"></a></div>
<div class="published">Tue, 17 Sep 2019 17:34:42 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102763956386246870/" title="" id="newspaper-oujs-12"></a></div>
<div class="published">Mon, 09 Sep 2019 18:25:33 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102700206576283877/" title="" id="newspaper-oujs-13"></a></div>
<div class="published">Thu, 29 Aug 2019 12:13:08 +0000</div>
<div class="content"></div>
</div></section>


Hello,

I'm developing a script that does the followings:

  1. Creates a new page (from HTML and CSS string)
  2. Extract media from page
  3. Embed the media and metadata inside the new page
  • Both media and metadata placements vary from site to site.
  1. Replace old page by new

The question is this:
**Should I allocate the script into sections of action or do a switch/case to any domain seperately?
**
First (allocate by action) may make the script shorter.
Second (allocate by domain) will make the script longer but easily manageable.

Is there another option?
What's best?