asfdjksdjfk

This commit is contained in:
remi 2022-05-05 13:26:31 +02:00
parent afca6cb0c9
commit 40665ec706
6 changed files with 320 additions and 434 deletions

166
base.html
View File

@ -5,163 +5,7 @@
<meta charset="utf-8">
<title>avg convo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
:root {
--notes-color: rgb(255, 235, 181);
--spacer-color: rgba(0,0,0,0.4);
--spacer-color-2: rgba(0,0,0,0.2);
--left-color: rgb(167, 179, 167);
--right-color: rgb(97, 206, 97);
}
@font-face {
font-family: "heonian";
src: url('https://cronut.cafe/~lustlion/myrheon/HeonianAlone.otf');
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
}
main {
max-width: 600px;
margin: auto;
}
.convo-container {
display: flex;
justify-content: space-between;
align-items: center;
margin: 8px;
}
.right {
flex-direction: row-reverse;
}
.convo {
width: 400px;
border: 1px solid var(--left-color);
border-radius: 8px;
padding: 8px;
}
.right .convo {
border: 1px solid var(--right-color);
}
.convo p {
margin: 0;
margin-top: 8px;
}
.convo-header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 1.5rem;
}
.convo-header img {
border-radius: 42069px;
width: 48px;
margin-right: 8px;
}
.convo-date {
font-size: 0.75rem;
color: var(--spacer-color);
flex-grow: 1;
text-align: right;
}
.notes {
width: 300px;
margin: 8px;
border-top: 1px solid var(--notes-color);
border-bottom: 1px solid var(--notes-color);
text-align: center;
}
.spacer {
width: calc(100% - 16px);
height: 1px;
margin-top: 8px; margin-bottom: 8px;
margin: auto;
background-color: var(--spacer-color);
}
.words {
text-align: center;
}
.words table {
margin: auto;
border-collapse: collapse;
text-align: left;
}
.words table td, .words table th {
padding: 8px;
border-right: 1px solid var(--spacer-color-2);
}
.words table td:last-child, .words table th:last-child {
border-right: none;
}
.words table th {
border-top: 1px solid var(--spacer-color);
border-bottom: 1px solid var(--spacer-color);
}
.words table td:first-of-type {
font-family: "heonian";
}
.clickable {
cursor: pointer;
}
#popup-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
display: flex;
justify-content: center;
align-items: center;
/* backdrop-filter: blur(20px); */
/* -webkit-backdrop-filter: blur(20px); */
/* above is completely unnecessary, but looks pretty */
transition: opacity 0.3s;
cursor: pointer;
}
#popup {
width: 300px;
background-color: white;
border-radius: 8px;
padding: 8px;
box-shadow: 0 0 8px rgba(0,0,0,0.2);
cursor: default;
}
#popup h1 {
text-align: center;
}
#popup-heo {
font-family: "heonian";
}
data-swap {
display: none;
}
</style>
<link rel="stylesheet" href="text_analysis.css">
</head>
<body>
@ -239,6 +83,14 @@
<p id="popup-meaning"></p>
</div>
</div>
<div id="smol-popup" style="opacity: 0; pointer-events: none;">
<h1>um</h1>
<div>
heonian: <span id="smol-heo"></span><br>
type: <span id="smol-type"></span>
</div>
<p id="smol-meaning"></p>
</div>
</main>
<data-swap>
<p></p>

View File

@ -1 +1 @@
<th>
<td>

View File

@ -5,3 +5,9 @@
</noscript>
<table>
<tbody>
<tr>
<th>heonian</th>
<th>romanization</th>
<th>type</th>
<th>meaning</th>
</tr>

28
main.js
View File

@ -10,17 +10,18 @@ let currentFont = "r";
let timeout = "";
function init() {
// createWordList();
createWordList();
// injectWords();
// document.querySelector("#popup-container").addEventListener("click", () => {
// document.querySelector("#popup-container").style.opacity = 0;
// document.querySelector("#popup-container").style.pointerEvents = "none";
// });
document.querySelector("#popup-container").addEventListener("click", () => {
document.querySelector("#popup-container").style.opacity = 0;
document.querySelector("#popup-container").style.pointerEvents = "none";
});
// above are commented out until wordlist is added~
document.querySelector("#font-button").addEventListener("click", () => {fontButton();});
}
function showPopup(word) {
clearHover();
let p = document.querySelector("#popup");
let c = document.querySelector("#popup-container")
p.querySelector("h1").innerText = word;
@ -31,7 +32,7 @@ function showPopup(word) {
c.style.pointerEvents = "all";
}
function showSmolPopup(word) {
function showSmolPopup(word, event) {
let p = document.querySelector("#smol-popup");
p.querySelector("h1").innerText = word;
p.querySelector("#smol-heo").innerText = words[word]["heonian"];
@ -39,14 +40,20 @@ function showSmolPopup(word) {
p.querySelector("#smol-meaning").innerText = words[word]["meaning"];
p.style.opacity = 1;
p.style.pointerEvents = "all";
// set position to cursor position
let rect = document.body.getBoundingClientRect();
let x = event.clientX - rect.left;
let y = event.clientY - rect.top;
p.style.left = x - 100 + "px";
p.style.top = y + 25 + "px";
}
function checkHover(word) {
function checkHover(word, event) {
if (timeout != "") {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
showSmolPopup(word);
showSmolPopup(word, event);
}, 450);
}
@ -54,6 +61,9 @@ function clearHover() {
if (timeout != "") {
clearTimeout(timeout);
}
let p = document.querySelector("#smol-popup");
p.style.opacity = 0;
p.style.pointerEvents = "none";
}
function createWordList() { //sometimes i really dislike javascript..
@ -94,7 +104,7 @@ function injectWords() {
showPopup(element.innerText);
}, false);
element.addEventListener('mouseover', function(e) {
checkHover(element.innerText);
checkHover(element.innerText, e);
}
, false);
element.addEventListener('mouseout', function(e) {

534
test.html

File diff suppressed because it is too large Load Diff

View File

@ -181,11 +181,23 @@ main {
cursor: default;
}
#popup h1 {
#smol-popup {
width: 200px;
background-color: white;
border-radius: 8px;
padding: 8px;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
position: fixed;
top: 0;
left: 0;
transition: opacity 0.3s;
}
#popup h1, #smol-popup h1 {
text-align: center;
}
#popup-heo {
#popup-heo, #smol-heo {
font-family: "heonian";
}