change index to tutorial
This commit is contained in:
237
index.html
237
index.html
@ -1,122 +1,123 @@
|
||||
<h1>How to self-host your torrents en-masse with zzzot</h1>
|
||||
|
||||
<h1 id="how-to-self-host-your-torrents-en-masse-with-zzzot">How to
|
||||
self-host your torrents en-masse with zzzot</h1>
|
||||
<p>I2P is a great network for distributing information using Bittorrent.
|
||||
However, it's not always easy to make your torrents discoverable to others.
|
||||
Uploading files via a WebUI can be time-consuming when you wish to share hundreds of files.
|
||||
It's easy to run an open tracker using zzzot, but open trackers don't maintain a searchable index of the files people are sharing.
|
||||
This is a hack that will allow you to treat zzzot as both an open tracker <strong>and</strong> a searchable indexing tracker of files that you want to share.</p>
|
||||
|
||||
<h2>Step Zero: Install zzzot</h2>
|
||||
|
||||
<p>You need zzzot to make this work.
|
||||
You can install zzzot by pasting this link <code>http://stats.i2p/i2p/plugins/zzzot.su3</code> into "Install from URL" on the <a href="http://localhost:7657/configplugins">Plugin Config page</a>.
|
||||
You can also obtain zzzot from zzz's plugins page <a href="http://stats.i2p/i2p/plugins/">inside of I2P</a>.</p>
|
||||
|
||||
<h2>Step One: Symlink your i2psnark downloads directory to zzzot's docroot</h2>
|
||||
|
||||
<p>After you install zzzot, symlink directory where I2PSnark stores it's downloads to a sub-directory of zzzot's document root.
|
||||
If you're on Linux and used a <code>.jar</code> installer, this command will work:</p>
|
||||
|
||||
However, it’s not always easy to make your torrents discoverable to
|
||||
others. Uploading files via a WebUI can be time-consuming when you wish
|
||||
to share hundreds of files. It’s easy to run an open tracker using
|
||||
zzzot, but open trackers don’t maintain a searchable index of the files
|
||||
people are sharing. This is a hack that will allow you to treat zzzot as
|
||||
both an open tracker <strong>and</strong> a searchable indexing tracker
|
||||
of files that you want to share.</p>
|
||||
<h2 id="step-zero-install-zzzot">Step Zero: Install zzzot</h2>
|
||||
<p>You need zzzot to make this work. You can install zzzot by pasting
|
||||
this link <code>http://stats.i2p/i2p/plugins/zzzot.su3</code> into
|
||||
“Install from URL” on the <a
|
||||
href="http://localhost:7657/configplugins">Plugin Config page</a>. You
|
||||
can also obtain zzzot from zzz’s plugins page <a
|
||||
href="http://stats.i2p/i2p/plugins/">inside of I2P</a>.</p>
|
||||
<h2
|
||||
id="step-one-symlink-your-i2psnark-downloads-directory-to-zzzots-docroot">Step
|
||||
One: Symlink your i2psnark downloads directory to zzzot’s docroot</h2>
|
||||
<p>After you install zzzot, symlink directory where I2PSnark stores it’s
|
||||
downloads to a sub-directory of zzzot’s document root. If you’re on
|
||||
Linux and used a <code>.jar</code> installer, this command will
|
||||
work:</p>
|
||||
<p><code>ln -sf ~/.i2p/i2psnark ~/.i2p/plugins/zzzot/eepsite/docroot/i2psnark</code></p>
|
||||
|
||||
<p>Or, if you used a Debian package:</p>
|
||||
|
||||
<p><code>sudo -u i2psvc ln -sf /var/lib/i2p/i2p-config/i2psnark /var/lib/i2p/i2p-config/plugins/zzzot/eepsite/docroot/i2psnark</code></p>
|
||||
|
||||
<h2>Step Two: Generate a new zzzot homepage</h2>
|
||||
|
||||
<p>When you visit the zzzot plugin's homepage via a web browser, either locally or via I2P, it simply serves up the files found in the <code>eepsite/docroot</code>.
|
||||
This allows you to customize the zzzot homepage in order to show whatever you want.
|
||||
We're going to take advantage of this to generate an index of the torrents we're sharing along with some details about them.
|
||||
To do this we'll use a shell script to generate the page.</p>
|
||||
|
||||
<p>```sh</p>
|
||||
|
||||
<h1>! /usr/bin/env sh</h1>
|
||||
|
||||
<p>tagList() {
|
||||
for torrent in i2psnark/*.torrent; do
|
||||
filename=$(echo $torrent | sed 's|.torrent||g')
|
||||
title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g')
|
||||
tags=$(echo $title | sed 's|.| |g' | sed 's|@| |g')
|
||||
echo " <div class=\"tags\">Tags:"
|
||||
for tag in $tags; do
|
||||
for tag in $tags; do
|
||||
echo " <a class=\"$tag lvix1\" href=\"#$tag\">$tag</a>"
|
||||
done
|
||||
done
|
||||
echo " </div>"
|
||||
done
|
||||
}</p>
|
||||
|
||||
<p>generatePage() {
|
||||
echo "<!doctype html>"
|
||||
echo "<html lang=en>"
|
||||
echo "<head>"
|
||||
echo "<meta charset=utf-8>"
|
||||
echo "<title>Torrent Index</title>"
|
||||
echo "<script src=\"script.js\"></script>"
|
||||
echo "<style>"
|
||||
echo "div {"
|
||||
echo " display: \"inline\";"
|
||||
echo "}"
|
||||
echo "</style>"
|
||||
echo "</head>"
|
||||
echo "<body>"
|
||||
cd "$SHARE"
|
||||
tagList | sort -u
|
||||
for torrent in i2psnark/*.torrent; do
|
||||
filename=$(echo $torrent | sed 's|.torrent||g')
|
||||
title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g')
|
||||
tags=$(echo $title | sed 's|.| |g' | sed 's|@| |g')
|
||||
echo " <div id="$filename" class=\"$tags\">"
|
||||
echo " <a href=\"$torrent\">$title</a></br>"
|
||||
echo " <div class=\"tags\">Tags:"
|
||||
for tag in $tags; do
|
||||
echo "<a class=\"$tag lvix1\" href=\"#$tag\">$tag</a>"
|
||||
done
|
||||
echo " </div>"
|
||||
echo " </div>"
|
||||
done
|
||||
cd $BACK
|
||||
echo "</body>"
|
||||
echo "</html>"
|
||||
}</p>
|
||||
|
||||
<p>generatePage
|
||||
```</p>
|
||||
|
||||
<h2>Step Three(Optional): Add the ability to filter torrents with Javascript</h2>
|
||||
|
||||
<p>If you're indexing hundreds of torrents, it will help to have the ability to filter the torrents based on their contents.
|
||||
Our script from step two converts the titles of the torrents into a list of tags, which can then be filtered.
|
||||
This provides us with a way of searching the available torrents efficiently.</p>
|
||||
|
||||
<p><code>javascript
|
||||
window.addEventListener("load", function() {
|
||||
setupTags();
|
||||
function setupTags() {
|
||||
let els = document.querySelectorAll(".lvix1");
|
||||
for (let el of els) el.addEventListener("click", function() {
|
||||
let cl = el.classList[0];
|
||||
console.log(cl);
|
||||
let divs = document.querySelectorAll("."+cl);
|
||||
for (let div of divs) div.style.display = hideDivs(div.style.display);
|
||||
showTags()
|
||||
})
|
||||
}
|
||||
function showTags() {
|
||||
let els = document.querySelectorAll(".lvix1");
|
||||
for (let el of els) {
|
||||
console.log("unhiding", el.classList)
|
||||
el.style.display = "inline";
|
||||
}
|
||||
}
|
||||
function hideDivs(prev) {
|
||||
if (prev === "none") {
|
||||
return "inline";
|
||||
}
|
||||
return "none"
|
||||
}
|
||||
})
|
||||
</code></p>
|
||||
<h2 id="step-two-generate-a-new-zzzot-homepage">Step Two: Generate a new
|
||||
zzzot homepage</h2>
|
||||
<p>When you visit the zzzot plugin’s homepage via a web browser, either
|
||||
locally or via I2P, it simply serves up the files found in the
|
||||
<code>eepsite/docroot</code>. This allows you to customize the zzzot
|
||||
homepage in order to show whatever you want. We’re going to take
|
||||
advantage of this to generate an index of the torrents we’re sharing
|
||||
along with some details about them. To do this we’ll use a shell script
|
||||
to generate the page.</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co">#! /usr/bin/env sh</span></span>
|
||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="fu">tagList()</span> <span class="kw">{</span></span>
|
||||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> torrent <span class="kw">in</span> i2psnark/<span class="pp">*</span>.torrent<span class="kw">;</span> <span class="cf">do</span></span>
|
||||
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="va">filename</span><span class="op">=</span><span class="va">$(</span><span class="bu">echo</span> <span class="va">$torrent</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|.torrent||g'</span><span class="va">)</span></span>
|
||||
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> <span class="va">title</span><span class="op">=</span><span class="va">$(</span><span class="bu">echo</span> <span class="va">$filename</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|-| |g'</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|i2psnark/||g'</span><span class="va">)</span></span>
|
||||
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="va">tags</span><span class="op">=</span><span class="va">$(</span><span class="bu">echo</span> <span class="va">$title</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|\.| |g'</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|@| |g'</span><span class="va">)</span></span>
|
||||
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" <div class=</span><span class="dt">\"</span><span class="st">tags</span><span class="dt">\"</span><span class="st">>Tags:"</span></span>
|
||||
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> tag <span class="kw">in</span> <span class="va">$tags</span><span class="kw">;</span> <span class="cf">do</span></span>
|
||||
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> tag <span class="kw">in</span> <span class="va">$tags</span><span class="kw">;</span> <span class="cf">do</span></span>
|
||||
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" <a class=</span><span class="dt">\"</span><span class="va">$tag</span><span class="st"> lvix1</span><span class="dt">\"</span><span class="st"> href=</span><span class="dt">\"</span><span class="st">#</span><span class="va">$tag</span><span class="dt">\"</span><span class="st">></span><span class="va">$tag</span><span class="st"></a>"</span></span>
|
||||
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a> <span class="cf">done</span></span>
|
||||
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> <span class="cf">done</span></span>
|
||||
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" </div>"</span></span>
|
||||
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a> <span class="cf">done</span></span>
|
||||
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="kw">}</span></span>
|
||||
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a><span class="fu">generatePage()</span> <span class="kw">{</span></span>
|
||||
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<!doctype html>"</span></span>
|
||||
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<html lang=en>"</span></span>
|
||||
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<head>"</span></span>
|
||||
<span id="cb1-22"><a href="#cb1-22" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<meta charset=utf-8>"</span></span>
|
||||
<span id="cb1-23"><a href="#cb1-23" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<title>Torrent Index</title>"</span></span>
|
||||
<span id="cb1-24"><a href="#cb1-24" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<script src=</span><span class="dt">\"</span><span class="st">script.js</span><span class="dt">\"</span><span class="st">></script>"</span></span>
|
||||
<span id="cb1-25"><a href="#cb1-25" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<style>"</span></span>
|
||||
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"div {"</span></span>
|
||||
<span id="cb1-27"><a href="#cb1-27" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" display: </span><span class="dt">\"</span><span class="st">inline</span><span class="dt">\"</span><span class="st">;"</span></span>
|
||||
<span id="cb1-28"><a href="#cb1-28" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"}"</span></span>
|
||||
<span id="cb1-29"><a href="#cb1-29" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"</style>"</span></span>
|
||||
<span id="cb1-30"><a href="#cb1-30" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"</head>"</span></span>
|
||||
<span id="cb1-31"><a href="#cb1-31" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<body>"</span></span>
|
||||
<span id="cb1-32"><a href="#cb1-32" aria-hidden="true" tabindex="-1"></a> <span class="bu">cd</span> <span class="st">"</span><span class="va">$SHARE</span><span class="st">"</span></span>
|
||||
<span id="cb1-33"><a href="#cb1-33" aria-hidden="true" tabindex="-1"></a> <span class="ex">tagList</span> <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-u</span></span>
|
||||
<span id="cb1-34"><a href="#cb1-34" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> torrent <span class="kw">in</span> i2psnark/<span class="pp">*</span>.torrent<span class="kw">;</span> <span class="cf">do</span></span>
|
||||
<span id="cb1-35"><a href="#cb1-35" aria-hidden="true" tabindex="-1"></a> <span class="va">filename</span><span class="op">=</span><span class="va">$(</span><span class="bu">echo</span> <span class="va">$torrent</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|.torrent||g'</span><span class="va">)</span></span>
|
||||
<span id="cb1-36"><a href="#cb1-36" aria-hidden="true" tabindex="-1"></a> <span class="va">title</span><span class="op">=</span><span class="va">$(</span><span class="bu">echo</span> <span class="va">$filename</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|-| |g'</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|i2psnark/||g'</span><span class="va">)</span></span>
|
||||
<span id="cb1-37"><a href="#cb1-37" aria-hidden="true" tabindex="-1"></a> <span class="va">tags</span><span class="op">=</span><span class="va">$(</span><span class="bu">echo</span> <span class="va">$title</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|\.| |g'</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s|@| |g'</span><span class="va">)</span></span>
|
||||
<span id="cb1-38"><a href="#cb1-38" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" <div id="</span><span class="va">$filename</span><span class="st">" class=</span><span class="dt">\"</span><span class="va">$tags</span><span class="dt">\"</span><span class="st">>"</span></span>
|
||||
<span id="cb1-39"><a href="#cb1-39" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" <a href=</span><span class="dt">\"</span><span class="va">$torrent</span><span class="dt">\"</span><span class="st">></span><span class="va">$title</span><span class="st"></a></br>"</span></span>
|
||||
<span id="cb1-40"><a href="#cb1-40" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" <div class=</span><span class="dt">\"</span><span class="st">tags</span><span class="dt">\"</span><span class="st">>Tags:"</span></span>
|
||||
<span id="cb1-41"><a href="#cb1-41" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> tag <span class="kw">in</span> <span class="va">$tags</span><span class="kw">;</span> <span class="cf">do</span></span>
|
||||
<span id="cb1-42"><a href="#cb1-42" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"<a class=</span><span class="dt">\"</span><span class="va">$tag</span><span class="st"> lvix1</span><span class="dt">\"</span><span class="st"> href=</span><span class="dt">\"</span><span class="st">#</span><span class="va">$tag</span><span class="dt">\"</span><span class="st">></span><span class="va">$tag</span><span class="st"></a>"</span></span>
|
||||
<span id="cb1-43"><a href="#cb1-43" aria-hidden="true" tabindex="-1"></a> <span class="cf">done</span></span>
|
||||
<span id="cb1-44"><a href="#cb1-44" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" </div>"</span></span>
|
||||
<span id="cb1-45"><a href="#cb1-45" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">" </div>"</span></span>
|
||||
<span id="cb1-46"><a href="#cb1-46" aria-hidden="true" tabindex="-1"></a> <span class="cf">done</span></span>
|
||||
<span id="cb1-47"><a href="#cb1-47" aria-hidden="true" tabindex="-1"></a> <span class="bu">cd</span> <span class="va">$BACK</span></span>
|
||||
<span id="cb1-48"><a href="#cb1-48" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"</body>"</span></span>
|
||||
<span id="cb1-49"><a href="#cb1-49" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> <span class="st">"</html>"</span></span>
|
||||
<span id="cb1-50"><a href="#cb1-50" aria-hidden="true" tabindex="-1"></a><span class="kw">}</span></span>
|
||||
<span id="cb1-51"><a href="#cb1-51" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb1-52"><a href="#cb1-52" aria-hidden="true" tabindex="-1"></a><span class="ex">generatePage</span></span></code></pre></div>
|
||||
<h2
|
||||
id="step-threeoptional-add-the-ability-to-filter-torrents-with-javascript">Step
|
||||
Three(Optional): Add the ability to filter torrents with Javascript</h2>
|
||||
<p>If you’re indexing hundreds of torrents, it will help to have the
|
||||
ability to filter the torrents based on their contents. Our script from
|
||||
step two converts the titles of the torrents into a list of tags, which
|
||||
can then be filtered. This provides us with a way of searching the
|
||||
available torrents efficiently.</p>
|
||||
<div class="sourceCode" id="cb2"><pre
|
||||
class="sourceCode javascript"><code class="sourceCode javascript"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="bu">window</span><span class="op">.</span><span class="fu">addEventListener</span>(<span class="st">"load"</span><span class="op">,</span> <span class="kw">function</span>() {</span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">setupTags</span>()<span class="op">;</span></span>
|
||||
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="kw">function</span> <span class="fu">setupTags</span>() {</span>
|
||||
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="kw">let</span> els <span class="op">=</span> <span class="bu">document</span><span class="op">.</span><span class="fu">querySelectorAll</span>(<span class="st">".lvix1"</span>)<span class="op">;</span></span>
|
||||
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> (<span class="kw">let</span> el <span class="kw">of</span> els) el<span class="op">.</span><span class="fu">addEventListener</span>(<span class="st">"click"</span><span class="op">,</span> <span class="kw">function</span>() {</span>
|
||||
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="kw">let</span> cl <span class="op">=</span> el<span class="op">.</span><span class="at">classList</span>[<span class="dv">0</span>]<span class="op">;</span></span>
|
||||
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> <span class="bu">console</span><span class="op">.</span><span class="fu">log</span>(cl)<span class="op">;</span></span>
|
||||
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> <span class="kw">let</span> divs <span class="op">=</span> <span class="bu">document</span><span class="op">.</span><span class="fu">querySelectorAll</span>(<span class="st">"."</span><span class="op">+</span>cl)<span class="op">;</span></span>
|
||||
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> (<span class="kw">let</span> div <span class="kw">of</span> divs) div<span class="op">.</span><span class="at">style</span><span class="op">.</span><span class="at">display</span> <span class="op">=</span> <span class="fu">hideDivs</span>(div<span class="op">.</span><span class="at">style</span><span class="op">.</span><span class="at">display</span>)<span class="op">;</span></span>
|
||||
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">showTags</span>()</span>
|
||||
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> })</span>
|
||||
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> }</span>
|
||||
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> <span class="kw">function</span> <span class="fu">showTags</span>() {</span>
|
||||
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a> <span class="kw">let</span> els <span class="op">=</span> <span class="bu">document</span><span class="op">.</span><span class="fu">querySelectorAll</span>(<span class="st">".lvix1"</span>)<span class="op">;</span></span>
|
||||
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> (<span class="kw">let</span> el <span class="kw">of</span> els) {</span>
|
||||
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a> <span class="bu">console</span><span class="op">.</span><span class="fu">log</span>(<span class="st">"unhiding"</span><span class="op">,</span> el<span class="op">.</span><span class="at">classList</span>)</span>
|
||||
<span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a> el<span class="op">.</span><span class="at">style</span><span class="op">.</span><span class="at">display</span> <span class="op">=</span> <span class="st">"inline"</span><span class="op">;</span></span>
|
||||
<span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a> }</span>
|
||||
<span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a> }</span>
|
||||
<span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a> <span class="kw">function</span> <span class="fu">hideDivs</span>(prev) {</span>
|
||||
<span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (prev <span class="op">===</span> <span class="st">"none"</span>) {</span>
|
||||
<span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="st">"inline"</span><span class="op">;</span></span>
|
||||
<span id="cb2-23"><a href="#cb2-23" aria-hidden="true" tabindex="-1"></a> }</span>
|
||||
<span id="cb2-24"><a href="#cb2-24" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="st">"none"</span></span>
|
||||
<span id="cb2-25"><a href="#cb2-25" aria-hidden="true" tabindex="-1"></a> }</span>
|
||||
<span id="cb2-26"><a href="#cb2-26" aria-hidden="true" tabindex="-1"></a>})</span></code></pre></div>
|
||||
|
Reference in New Issue
Block a user