Skip to content

Commit

Permalink
Liked no account fix + new/picks merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekiah-A committed Nov 14, 2022
1 parent 94e2b46 commit 8acc71b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 27 deletions.
3 changes: 3 additions & 0 deletions Other/purgatory-entry-template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<entry guid="" onclick="window.location.href = './purgatory-poem?guid=' + this.getAttribute('guid');">
<div id="_poemPreview" class="preview">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
<p id="_specialNotification" class="special-notification">
<div id="_specialTooltip" class="button-tooltip"></div>
</p>
<h4 id="_poemName">Poem name</h4>
<div class="info">
<span id="_poemAuthor" style="flex: 2;">By Author</span>
Expand Down
61 changes: 43 additions & 18 deletions contents.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@
height: 64px;
}

entry .special-notification {
margin-top: 0px;
margin-bottom: 0px;
color: #017cff;
position: absolute;
top: 44%;
text-align: center;
width: 100%;
font-weight: bold;
font-style: italic;
}

entry .button-tooltip {
left: 0px !important;
top: 40px !important;
}

entry .preview::after {
opacity: 1;
width: 100%;
Expand Down Expand Up @@ -182,11 +199,6 @@
pointer-events: none;
}

#filtersBar > div:hover .button-tooltip {
pointer-events: all;
opacity: 1;
}

.sounds-button {
background: var(--button-opaque);
padding: 15px;
Expand Down Expand Up @@ -593,25 +605,38 @@ <h3>Other stuff:</h3>
}

async function addPurgatoryEntries(filter) {
let entryTemplate = await (await fetch("./Other/purgatory-entry-template")).text()
let entryTemplate = stringToHtml(await (await fetch("./Other/purgatory-entry-template")).text())

if (filter != "all") {
purgatoryGrid.style.display = "none"
purgatoryFlex.style.display = "flex"
while (purgatoryFlex.firstChild) { purgatoryFlex.removeChild(purgatoryFlex.lastChild) }
while (purgatoryGrid.firstChild) { purgatoryGrid.removeChild(purgatoryGrid.lastChild) }

while (purgatoryFlex.firstChild) { purgatoryFlex.removeChild(purgatoryFlex.lastChild) }
let entries = filter == "liked" ? (await isLoggedIn() ? getAccountData().likedPoems : localStorage.liked) : await (await fetch("https://server.poemanthology.org:81/" + (filter == "new" ? "PurgatoryNew" : "PurgatoryPicks"))).json()
for (let entry of entries) { await appendEntry(entry, purgatoryFlex, entryTemplate) }
}
else {
purgatoryGrid.style.display = "none"
purgatoryFlex.style.display = "flex"

let entries = null;
if (filter == "all") {
purgatoryFlex.style.display = "none"
purgatoryGrid.style.display = "grid"

while (purgatoryGrid.firstChild) { purgatoryGrid.removeChild(purgatoryGrid.lastChild) }
let entries = await (await fetch("https://server.poemanthology.org:81/PurgatoryAll")).json()
for (let entry of entries) { await appendEntry(entry, purgatoryGrid, entryTemplate) }
entries = await (await fetch("https://server.poemanthology.org:81/PurgatoryAll")).json()
}
else if (filter == "liked") {
entries = await isLoggedIn() ? getAccountData().likedPoems : JSON.parse(localStorage.liked)
}
else if (filter == "new") {
//Picks appear first on new, and have a different template
let picks = await (await fetch("https://server.poemanthology.org:81/PurgatoryPicks")).json()
let pickTemplate = entryTemplate.valueOf()
pickTemplate.querySelector("#_specialNotification").textContent = "Subliminal pick"
pickTemplate.querySelector("#_specialTooltip").textContent = "The best of the best - this poem has been selected by the subliminal teeam to be something that you SHOULd see now!"

for (let pickEntry of picks) { await appendEntry(pickEntry, purgatoryFlex, pickTemplate) }

entries = await (await fetch("https://server.poemanthology.org:81/PurgatoryNew")).json()
}

for (let entry of entries) { await appendEntry(entry, purgatoryFlex, entryTemplate) }

if (!params.get("purgatorynew") || !purgatoryFlex.children[0]) return
purgatoryFlex.children[0].classList.add("entry-new")
window.scrollTo(0, 0)
Expand All @@ -623,7 +648,7 @@ <h3>Other stuff:</h3>

async function appendEntry(entry, element, template) {
let entryData = await (await fetch("https://server.poemanthology.org:81/Purgatory/" + entry)).json()
let newE = stringToHtml(template.valueOf())
let newE = template.valueOf()
newE.setAttribute("guid", entryData?.guid)
newE.querySelector("#_poemPreview").textContent = (
entryData.poemContent?.substring(0, 56)
Expand Down
5 changes: 0 additions & 5 deletions poem-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@
margin-top: 8px;
}

.management-button:hover .button-tooltip {
pointer-events: all;
opacity: 1;
}

.button-tooltip {
left: calc(-100% - 32px) !important;
}
Expand Down
10 changes: 6 additions & 4 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ h2 {
margin-top: 0px;
}

/*Hovering any direct parent of a button tooltip will cause it to appear */
*:hover > .button-tooltip {
pointer-events: all;
opacity: 1;
}

#headerFrame {
width: 100%;
height: 100%;
Expand Down Expand Up @@ -311,10 +317,6 @@ h2 {
line-height: 32px;
position: relative;
}
.profile-badge:hover .button-tooltip {
pointer-events: all;
opacity: 1;
}

.button-tooltip {
left: calc(-100% - 184px) !important;
Expand Down

0 comments on commit 8acc71b

Please sign in to comment.