diff options
Diffstat (limited to 'posts/2020-12-1-HTML-JS-RSS-Feed/index.html')
-rw-r--r-- | posts/2020-12-1-HTML-JS-RSS-Feed/index.html | 196 |
1 files changed, 196 insertions, 0 deletions
diff --git a/posts/2020-12-1-HTML-JS-RSS-Feed/index.html b/posts/2020-12-1-HTML-JS-RSS-Feed/index.html new file mode 100644 index 0000000..14f9a0d --- /dev/null +++ b/posts/2020-12-1-HTML-JS-RSS-Feed/index.html @@ -0,0 +1,196 @@ +<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"/><meta name="og:site_name" content="Navan Chauhan"/><link rel="canonical" href="https://navanchauhan.github.io/posts/2020-12-1-HTML-JS-RSS-Feed"/><meta name="twitter:url" content="https://navanchauhan.github.io/posts/2020-12-1-HTML-JS-RSS-Feed"/><meta name="og:url" content="https://navanchauhan.github.io/posts/2020-12-1-HTML-JS-RSS-Feed"/><title>RSS Feed written in HTML + JavaScript | Navan Chauhan</title><meta name="twitter:title" content="RSS Feed written in HTML + JavaScript | Navan Chauhan"/><meta name="og:title" content="RSS Feed written in HTML + JavaScript | Navan Chauhan"/><meta name="description" content="Short code-snippet for an RSS feed, written in HTML and JavaScript"/><meta name="twitter:description" content="Short code-snippet for an RSS feed, written in HTML and JavaScript"/><meta name="og:description" content="Short code-snippet for an RSS feed, written in HTML and JavaScript"/><meta name="twitter:card" content="summary"/><link rel="stylesheet" href="/styles.css" type="text/css"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="shortcut icon" href="/images/favicon.png" type="image/png"/><link rel="alternate" href="/feed.rss" type="application/rss+xml" title="Subscribe to Navan Chauhan"/><meta name="twitter:image" content="https://navanchauhan.github.io/images/logo.png"/><meta name="og:image" content="https://navanchauhan.github.io/images/logo.png"/></head><head><script async src="//gc.zgo.at/count.js" data-goatcounter="https://navanchauhan.goatcounter.com/count"></script></head><body class="item-page"><header><div class="wrapper"><a class="site-name" href="/">Navan Chauhan</a><nav><ul><li><a href="/about">About Me</a></li><li><a class="selected" href="/posts">Posts</a></li><li><a href="/publications">Publications</a></li><li><a href="/assets/résumé.pdf">Résumé</a></li><li><a href="https://navanchauhan.github.io/repo">Repo</a></li></ul></nav></div></header><div class="wrapper"><article><div class="content"><span class="reading-time">5 minute read</span><span class="reading-time">Created on December 1, 2020</span><h1>RSS Feed written in HTML + JavaScript</h1><p>If you want to directly open the HTML file in your browser after saving, don't forget to set <code>CORS_PROXY=""</code></p><pre><code><div class="highlight"><span></span><span class="cp"><!doctype html></span> +<span class="p"><</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">"en"</span><span class="p">></span> +<span class="p"><</span><span class="nt">head</span><span class="p">></span> + <span class="p"><</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">"utf-8"</span><span class="p">></span> + <span class="p"><</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">"viewport"</span> <span class="na">content</span><span class="o">=</span><span class="s">"width=device-width, initial-scale=1"</span><span class="p">></span> + <span class="p"><</span><span class="nt">title</span><span class="p">></span> + RSS Feed + <span class="p"></</span><span class="nt">title</span><span class="p">></span> + <span class="p"><</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">"stylesheet"</span> <span class="na">href</span><span class="o">=</span><span class="s">"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"</span> <span class="na">integrity</span><span class="o">=</span><span class="s">"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">"anonymous"</span><span class="p">></span> +<span class="p"></</span><span class="nt">head</span><span class="p">></span> +<span class="p"><</span><span class="nt">body</span><span class="p">></span> + +<span class="p"><</span><span class="nt">h1</span> <span class="na">align</span><span class="o">=</span><span class="s">"center"</span> <span class="na">class</span><span class="o">=</span><span class="s">"display-1"</span><span class="p">></span>RSS Feed<span class="p"></</span><span class="nt">h1</span><span class="p">></span> +<span class="p"><</span><span class="nt">main</span><span class="p">></span> + <span class="p"><</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">"container"</span><span class="p">></span> + <span class="p"><</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">"list-group pb-4"</span> <span class="na">id</span><span class="o">=</span><span class="s">"contents"</span><span class="p">></</span><span class="nt">div</span><span class="p">></span> +<span class="p"><</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">"feed"</span><span class="p">></span> +<span class="p"></</span><span class="nt">div</span><span class="p">></</span><span class="nt">div</span><span class="p">></span> +<span class="p"></</span><span class="nt">main</span><span class="p">></span> + +<span class="p"><</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">"https://gitcdn.xyz/repo/rbren/rss-parser/master/dist/rss-parser.js"</span><span class="p">></</span><span class="nt">script</span><span class="p">></span> +<span class="p"><</span><span class="nt">script</span><span class="p">></span> + +<span class="kr">const</span> <span class="nx">feeds</span> <span class="o">=</span> <span class="p">{</span> + <span class="s2">"BuzzFeed - India"</span><span class="o">:</span> <span class="p">{</span> + <span class="s2">"link"</span><span class="o">:</span><span class="s2">"https://www.buzzfeed.com/in.xml"</span><span class="p">,</span> + <span class="s2">"summary"</span><span class="o">:</span><span class="kc">true</span> + <span class="p">},</span> + <span class="s2">"New Yorker"</span><span class="o">:</span> <span class="p">{</span> + <span class="s2">"link"</span><span class="o">:</span><span class="s2">"http://www.newyorker.com/feed/news"</span><span class="p">,</span> + <span class="p">},</span> + <span class="s2">"Vox"</span><span class="o">:</span><span class="p">{</span> + <span class="s2">"link"</span><span class="o">:</span><span class="s2">"https://www.vox.com/rss/index.xml"</span><span class="p">,</span> + <span class="s2">"limit"</span><span class="o">:</span> <span class="mf">3</span> + <span class="p">},</span> + <span class="s2">"r/Jokes"</span><span class="o">:</span><span class="p">{</span> + <span class="s2">"link"</span><span class="o">:</span><span class="s2">"https://reddit.com/r/Jokes/hot/.rss?sort=hot"</span><span class="p">,</span> + <span class="s2">"ignore"</span><span class="o">:</span> <span class="p">[</span><span class="s2">"repost"</span><span class="p">,</span><span class="s2">"discord"</span><span class="p">]</span> + <span class="p">}</span> +<span class="p">}</span> + +<span class="kr">const</span> <span class="nx">config_extra</span> <span class="o">=</span> <span class="p">{</span> +<span class="s2">"Responsive-Images"</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> +<span class="s2">"direct-link"</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> +<span class="s2">"show-date"</span><span class="o">:</span><span class="kc">false</span><span class="p">,</span> +<span class="s2">"left-column"</span><span class="o">:</span><span class="kc">false</span><span class="p">,</span> +<span class="s2">"defaults"</span><span class="o">:</span> <span class="p">{</span> + <span class="s2">"limit"</span><span class="o">:</span> <span class="mf">5</span><span class="p">,</span> + <span class="s2">"summary"</span><span class="o">:</span> <span class="kc">true</span> +<span class="p">}</span> +<span class="p">}</span> + +<span class="kr">const</span> <span class="nx">CORS_PROXY</span> <span class="o">=</span> <span class="s2">"https://cors-anywhere.herokuapp.com/"</span> + +<span class="kd">var</span> <span class="nx">contents_title</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"h2"</span><span class="p">)</span> +<span class="nx">contents_title</span><span class="p">.</span><span class="nx">textContent</span> <span class="o">=</span> <span class="s2">"Contents"</span> +<span class="nx">contents_title</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"pb-1"</span><span class="p">)</span> +<span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">"contents"</span><span class="p">).</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">contents_title</span><span class="p">)</span> + +<span class="nx">async</span> <span class="kd">function</span> <span class="nx">myfunc</span><span class="p">(</span><span class="nx">key</span><span class="p">){</span> + + <span class="kd">var</span> <span class="nx">count_lim</span> <span class="o">=</span> <span class="nx">feeds</span><span class="p">[</span><span class="nx">key</span><span class="p">][</span><span class="s2">"limit"</span><span class="p">]</span> + <span class="kd">var</span> <span class="nx">count_lim</span> <span class="o">=</span> <span class="p">(</span><span class="nx">count_lim</span> <span class="o">===</span> <span class="kc">undefined</span><span class="p">)</span> <span class="o">?</span> <span class="nx">config_extra</span><span class="p">[</span><span class="s2">"defaults"</span><span class="p">][</span><span class="s2">"limit"</span><span class="p">]</span> <span class="o">:</span> <span class="nx">count_lim</span> + + <span class="kd">var</span> <span class="nx">show_summary</span> <span class="o">=</span> <span class="nx">feeds</span><span class="p">[</span><span class="nx">key</span><span class="p">][</span><span class="s2">"summary"</span><span class="p">]</span> + <span class="kd">var</span> <span class="nx">show_summary</span> <span class="o">=</span> <span class="p">(</span><span class="nx">show_summary</span> <span class="o">===</span> <span class="kc">undefined</span><span class="p">)</span> <span class="o">?</span> <span class="nx">config_extra</span><span class="p">[</span><span class="s2">"defaults"</span><span class="p">][</span><span class="s2">"summary"</span><span class="p">]</span> <span class="o">:</span> <span class="nx">show_summary</span> + + <span class="kd">var</span> <span class="nx">ignore_tags</span> <span class="o">=</span> <span class="nx">feeds</span><span class="p">[</span><span class="nx">key</span><span class="p">][</span><span class="s2">"ignore"</span><span class="p">]</span> + <span class="kd">var</span> <span class="nx">ignore_tags</span> <span class="o">=</span> <span class="p">(</span><span class="nx">ignore_tags</span> <span class="o">===</span> <span class="kc">undefined</span><span class="p">)</span> <span class="o">?</span> <span class="p">[]</span> <span class="o">:</span> <span class="nx">ignore_tags</span> + + <span class="kd">var</span> <span class="nx">contents</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> + <span class="nx">contents</span><span class="p">.</span><span class="nx">href</span> <span class="o">=</span> <span class="s2">"#"</span> <span class="o">+</span> <span class="nx">key</span> + <span class="nx">contents</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"list-group-item"</span><span class="p">,</span><span class="s2">"list-group-item-action"</span><span class="p">)</span> + <span class="nx">contents</span><span class="p">.</span><span class="nx">textContent</span> <span class="o">=</span> <span class="nx">key</span> + <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">"contents"</span><span class="p">).</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">contents</span><span class="p">)</span> + <span class="kd">var</span> <span class="nx">feed_div</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"div"</span><span class="p">)</span> + <span class="nx">feed_div</span><span class="p">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">key</span> + <span class="nx">feed_div</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="s2">"id"</span><span class="p">,</span> <span class="nx">key</span><span class="p">);</span> + <span class="kd">var</span> <span class="nx">title</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"h2"</span><span class="p">);</span> + <span class="nx">title</span><span class="p">.</span><span class="nx">textContent</span> <span class="o">=</span> <span class="s2">"From "</span> <span class="o">+</span> <span class="nx">key</span><span class="p">;</span> + <span class="nx">title</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"pb-1"</span><span class="p">)</span> + <span class="nx">feed_div</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">title</span><span class="p">)</span> + <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">"feed"</span><span class="p">).</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">feed_div</span><span class="p">)</span> + <span class="kd">var</span> <span class="nx">parser</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">RSSParser</span><span class="p">();</span> + <span class="kd">var</span> <span class="nx">countPosts</span> <span class="o">=</span> <span class="mf">0</span> + <span class="nx">parser</span><span class="p">.</span><span class="nx">parseURL</span><span class="p">(</span><span class="nx">CORS_PROXY</span> <span class="o">+</span> <span class="nx">feeds</span><span class="p">[</span><span class="nx">key</span><span class="p">][</span><span class="s2">"link"</span><span class="p">],</span> <span class="kd">function</span><span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">feed</span><span class="p">)</span> <span class="p">{</span> + <span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="k">throw</span> <span class="nx">err</span><span class="p">;</span> + <span class="nx">feed</span><span class="p">.</span><span class="nx">items</span><span class="p">.</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">entry</span><span class="p">)</span> <span class="p">{</span> + <span class="k">if</span> <span class="p">(</span><span class="nx">countPosts</span> <span class="o"><</span> <span class="nx">count_lim</span><span class="p">)</span> <span class="p">{</span> + + <span class="kd">var</span> <span class="nx">skip</span> <span class="o">=</span> <span class="kc">false</span> + <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mf">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="nx">ignore_tags</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> + <span class="k">if</span> <span class="p">(</span><span class="nx">entry</span><span class="p">.</span><span class="nx">title</span><span class="p">.</span><span class="nx">includes</span><span class="p">(</span><span class="nx">ignore_tags</span><span class="p">[</span><span class="nx">i</span><span class="p">])){</span> + <span class="kd">var</span> <span class="nx">skip</span> <span class="o">=</span> <span class="kc">true</span> + <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">entry</span><span class="p">.</span><span class="nx">content</span><span class="p">.</span><span class="nx">includes</span><span class="p">(</span><span class="nx">ignore_tags</span><span class="p">[</span><span class="nx">i</span><span class="p">])){</span> + <span class="kd">var</span> <span class="nx">skip</span> <span class="o">=</span> <span class="kc">true</span> + <span class="p">}</span> + <span class="p">}</span> + + <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">skip</span><span class="p">)</span> <span class="p">{</span> + + <span class="kd">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"div"</span><span class="p">);</span> + <span class="nx">node</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"card"</span><span class="p">,</span><span class="s2">"mb-3"</span><span class="p">);</span> + <span class="kd">var</span> <span class="nx">row</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"div"</span><span class="p">)</span> + <span class="nx">row</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"row"</span><span class="p">,</span><span class="s2">"no-gutters"</span><span class="p">)</span> + + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"left-column"</span><span class="p">]){</span> + <span class="kd">var</span> <span class="nx">left_col</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"div"</span><span class="p">)</span> + <span class="nx">left_col</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"col-md-2"</span><span class="p">)</span> + <span class="kd">var</span> <span class="nx">left_col_body</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"div"</span><span class="p">)</span> + <span class="nx">left_col_body</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"card-body"</span><span class="p">)</span> + <span class="p">}</span> + + <span class="kd">var</span> <span class="nx">right_col</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"div"</span><span class="p">)</span> + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"left-column"</span><span class="p">]){</span> + <span class="nx">right_col</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"col-md-10"</span><span class="p">)</span> + <span class="p">}</span> + <span class="kd">var</span> <span class="nx">node_title</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"h5"</span><span class="p">)</span> + + <span class="nx">node_title</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"card-header"</span><span class="p">)</span> + <span class="nx">node_title</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">entry</span><span class="p">.</span><span class="nx">title</span> + + <span class="nx">node_body</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"div"</span><span class="p">)</span> + <span class="nx">node_body</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"card-body"</span><span class="p">)</span> + + <span class="nx">node_content</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"p"</span><span class="p">)</span> + + <span class="k">if</span> <span class="p">(</span><span class="nx">show_summary</span><span class="p">){</span> + <span class="nx">node_content</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">entry</span><span class="p">.</span><span class="nx">content</span> + <span class="p">}</span> + <span class="nx">node_content</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"card-text"</span><span class="p">)</span> + + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"direct-link"</span><span class="p">]){</span> + <span class="nx">node_link</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"p"</span><span class="p">)</span> + <span class="nx">node_link</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"card-text"</span><span class="p">)</span> + <span class="nx">node_link</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">"<b>Link:</b> <a href='"</span> <span class="o">+</span> <span class="nx">entry</span><span class="p">.</span><span class="nx">link</span> <span class="o">+</span><span class="s2">"'>Direct Link</a>"</span> + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"left-column"</span><span class="p">]){</span> + <span class="nx">left_col_body</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node_link</span><span class="p">)</span> + <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> + <span class="nx">node_content</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node_link</span><span class="p">)</span> + <span class="p">}</span> + <span class="p">}</span> + + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"show-date"</span><span class="p">]){</span> + <span class="nx">node_date</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">"p"</span><span class="p">)</span> + <span class="nx">node_date</span><span class="p">.</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"card-text"</span><span class="p">)</span> + <span class="nx">node_date</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">"<p><b>Date: </b>"</span> <span class="o">+</span> <span class="nx">entry</span><span class="p">.</span><span class="nx">pubDate</span> <span class="o">+</span> <span class="s2">"</p>"</span> + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"left-column"</span><span class="p">]){</span> + <span class="nx">left_col_body</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node_date</span><span class="p">)</span> + <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> + <span class="nx">node_content</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node_date</span><span class="p">)</span> + + <span class="p">}</span> + <span class="p">}</span> + + <span class="nx">node</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node_title</span><span class="p">)</span> + + <span class="nx">node_body</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node_content</span><span class="p">)</span> + + <span class="nx">right_col</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node_body</span><span class="p">)</span> + + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"left-column"</span><span class="p">]){</span> + <span class="nx">left_col</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">left_col_body</span><span class="p">)</span> + <span class="nx">row</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">left_col</span><span class="p">)</span> + <span class="p">}</span> + + <span class="nx">row</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">right_col</span><span class="p">)</span> + + <span class="nx">node</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">row</span><span class="p">)</span> + + <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="nx">key</span><span class="p">).</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> + <span class="nx">countPosts</span><span class="o">+=</span><span class="mf">1</span> + <span class="p">}</span> + <span class="p">}</span> + <span class="p">})</span> + + <span class="k">if</span> <span class="p">(</span><span class="nx">config_extra</span><span class="p">[</span><span class="s2">"Responsive-Images"</span><span class="p">]){</span> + <span class="kd">var</span> <span class="nx">inputs</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">'img'</span><span class="p">)</span> + <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mf">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="nx">inputs</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> + <span class="nx">inputs</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">classList</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="s2">"img-fluid"</span><span class="p">)</span> + <span class="p">}</span> + <span class="p">}</span> + + <span class="p">})</span> + + <span class="k">return</span> <span class="kc">true</span> +<span class="p">}</span> +<span class="p">(</span><span class="nx">async</span> <span class="p">()</span> <span class="p">=></span> <span class="p">{</span> +<span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">key</span> <span class="k">in</span> <span class="nx">feeds</span><span class="p">)</span> <span class="p">{</span> + <span class="kd">let</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">await</span> <span class="nx">myfunc</span><span class="p">(</span><span class="nx">key</span><span class="p">);</span> +<span class="p">}})();</span> + +<span class="p"></</span><span class="nt">script</span><span class="p">></span> +<span class="p"><</span><span class="nt">noscript</span><span class="p">></span>Uh Oh! Your browser does not support JavaScript or JavaScript is currently disabled. Please enable JavaScript or switch to a different browser.<span class="p"></</span><span class="nt">noscript</span><span class="p">></span> +<span class="p"></</span><span class="nt">body</span><span class="p">></</span><span class="nt">html</span><span class="p">></span> +</div></code></pre></div><span>Tagged with: </span><ul class="tag-list"><li><a href="/tags/tutorial">Tutorial</a></li><li><a href="/tags/codesnippet">Code-Snippet</a></li><li><a href="/tags/html">HTML</a></li><li><a href="/tags/javascript">JavaScript</a></li></ul></article></div><footer><p>Made with ❤️ using <a href="https://github.com/johnsundell/publish">Publish</a></p><p><a href="/feed.rss">RSS feed</a></p></footer></body></html>
\ No newline at end of file |