Move "sotto storto cit" script in a dedicated file

parent 942e7822
......@@ -3,8 +3,7 @@
© {{ site.time | date: '%Y' }}
<span><a href="https://www.poul.org">POuL</a></span>
<span><a href="https://gitlab.poul.org/sito/poul-jekyll">Source code</a></span>
<span class="desktop-only"><a href="#" id="fix-sotto-storto-link"
onclick="fixSottoStortoCit(); return false;">Fix rotation</a></span>
<span class="desktop-only"><a href="#" id="fix-sotto-storto-link">Fix rotation</a></span>
<span><a href="#" id="fix-open-dyslexic-link">Enable futuristic font</a></span>
</div>
<div class="socials">
......
<script src="{{ '/site/assets/vendor/jquery@3.4.1/jquery.slim.min.js' | static_url }}"></script>
<script src="{{ '/assets/js/dropcap.min.js' | relative_url }}"></script>
<script src="{{ '/assets/js/responsive-nav.min.js' | relative_url }}"></script>
<script src="{{ '/assets/js/scripts.js' | relative_url }}"></script>
<script src="{{ '/assets/js/simple-bits-client.js' | relative_url }}"></script>
\ No newline at end of file
// A $( document ).ready() block.
$(document).ready(function () {
"use strict";
document.addEventListener('DOMContentLoaded', () => {
// DropCap.js
var dropcaps = document.querySelectorAll(".dropcap");
......@@ -13,15 +14,4 @@ $(document).ready(function () {
return Math.round(parseFloat(value));
});
});
function fixSottoStortoCit() {
if (document.body.classList.contains("sotto-dritto")) {
document.body.classList.remove("sotto-dritto");
document.getElementById('fix-sotto-storto-link').text = "Fix rotation";
} else {
document.body.classList.add("sotto-dritto");
document.getElementById('fix-sotto-storto-link').text = "Lol no, put it back";
}
}
});
\ No newline at end of file
"use strict";
document.addEventListener('DOMContentLoaded', () => {
document.querySelector("#fix-sotto-storto-link").addEventListener("click", (e) => {
e.preventDefault();
if (document.body.classList.contains("sotto-dritto")) {
document.body.classList.remove("sotto-dritto");
document.getElementById("fix-sotto-storto-link").text = "Fix rotation";
} else {
document.body.classList.add("sotto-dritto");
document.getElementById("fix-sotto-storto-link").text = "Lol no, put it back";
}
});
});
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment