WhisperMaPhone/main/templates/whispermaphone/index.html

45 lines
1.5 KiB
HTML
Raw Normal View History

2020-09-06 03:12:54 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
2020-09-06 16:39:00 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1">
2020-09-06 03:12:54 +00:00
<title>Title</title>
2020-09-06 16:00:44 +00:00
2020-09-06 16:39:00 +00:00
{% load static %}
<link href="{% static "main/main.css" %}" rel="stylesheet">
2020-09-06 03:12:54 +00:00
</head>
<body>
2020-09-06 16:39:00 +00:00
<header><span class="text">Thoughts</span></header>
2020-09-06 04:06:16 +00:00
2020-09-06 16:00:44 +00:00
<section class="main-wrap">
2020-09-06 04:06:16 +00:00
{% for thought in thoughts %}
2020-09-06 16:00:44 +00:00
<div class="thought">
<div class="main-text">{{thought.text}}</div>
<div class="extended-text hidden">{{thought.extended_text}}</div>
2020-09-06 04:06:16 +00:00
</div>
2020-09-06 16:39:00 +00:00
<hr class="thought-end">
{% endfor %}
2020-09-06 16:00:44 +00:00
</section>
<footer>Proudly developed with open source technologies.</footer>
<script>
const els = document.querySelectorAll(".thought");
for (let el of els) {
const extended = el.querySelector(".extended-text");
if (extended.textContent.length) {
const text = el.querySelector(".main-text");
const showMoreButton = document.createElement("button");
showMoreButton.appendChild(document.createTextNode("Show More"));
showMoreButton.addEventListener("click", evt => {
// Remove our-self
showMoreButton.parentNode.removeChild(showMoreButton);
// Show the extended text
extended.classList.remove("hidden");
})
text.appendChild(showMoreButton);
}
}
</script>
2020-09-06 03:12:54 +00:00
</body>
</html>