Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #1689

Merged
merged 4 commits into from
Dec 19, 2023
Merged

Cleanup #1689

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions data/read-ids.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7017,3 +7017,7 @@
18efhth
18efodo
18ey6up
18ldmu5
18ldb8h
18ldjlc
18ldqfe
26 changes: 13 additions & 13 deletions web/_js/main/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function initDraw() {
showListButton.parentElement.appendChild(drawBackButton)
showListButton.remove()
drawButton.remove()

// Opens draw menu
wrapper.classList.remove('listHidden')
bsOffcanvasDraw.show()
Expand Down Expand Up @@ -338,7 +338,7 @@ function initDraw() {
if (exportArea.value > 40000) {
exportArea.value = " " + miniJsonString
}

// Reddit

let redditPostJsonString = " " + prettyJsonString.split("\n").join("\n ")
Expand Down Expand Up @@ -461,7 +461,7 @@ function initDraw() {
discordGroup.replaceChildren()
/**
* @instanceonly
* Temporarily remove wikifield
* Temporarily remove wikifield
* Lack of use, used incorrectly more than it is used correctly.
*/
// wikiGroup.replaceChildren()
Expand Down Expand Up @@ -502,7 +502,7 @@ function initDraw() {
for (const entry of Object.values(atlas)) {

const path = entry.path

backgroundContext.beginPath()

if (path[0]) {
Expand Down Expand Up @@ -567,8 +567,8 @@ function initDraw() {
;[atlasDisplay, atlasOrder] = generateAtlasDisplay(atlas, atlasOrder, currentPeriod, currentVariation)
renderBackground(atlasDisplay)
renderHighlight(atlasDisplay)
}
}

const getEntry = id => {
if (!id) return
return atlasAll[id]
Expand Down Expand Up @@ -820,11 +820,11 @@ function initDraw() {
const [,, hashX, hashY, hashZoom] = hash.split('/')

setView(
(isNaN(hashX) || hashX === '') ? center[0] : Number(hashX),
(isNaN(hashY) || hashY === '') ? center[1] : Number(hashY),
(isNaN(hashX) || hashX === '') ? center[0] : Number(hashX),
(isNaN(hashY) || hashY === '') ? center[1] : Number(hashY),
(isNaN(hashZoom) || hashZoom === '') ? 4 : Number(hashZoom)
)

document.addEventListener('timeupdate', () => {
renderBackground(atlasDisplay)
updatePeriodGroups()
Expand Down Expand Up @@ -877,7 +877,7 @@ function initPeriodGroups() {
const periodCopyEl = periodGroupEl.querySelector('.period-copy')
const periodDuplicateEl = periodGroupEl.querySelector('.period-duplicate')
const periodDeleteEl = periodGroupEl.querySelector('.period-delete')

const periodVariationEl = periodGroupEl.querySelector('.period-variation')
const periodStatusEl = periodGroupEl.querySelector('.period-status')

Expand Down Expand Up @@ -941,19 +941,19 @@ function initPeriodGroups() {
})
startPeriodViewEl.addEventListener('click', () => {
updateTime(parseInt(startPeriodEl.value), getCurrentVariation())

// Set zoom view
periodCenter = calculateCenter(path)
setView(periodCenter[0], periodCenter[1], setZoomByPath(path))
})

function getCurrentVariation() {
return periodVariationEl[periodVariationEl.selectedIndex].value
}

function startPeriodUpdate(value) {
endPeriodListEl.innerHTML = '<option value="' + (parseInt(value) + 1) + '"></option>'

// Update time only when value changes
if (startPeriodEl.value !== timelineSlider.value) {
timelineSlider.value = value
Expand Down
30 changes: 15 additions & 15 deletions web/_js/main/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const moreEntriesObserver = new IntersectionObserver(entries => {

moreEntriesObserver.observe(moreEntriesButton)

let defaultSort = sortInput.value
let defaultSort = sortInput.value

let lastPos = [0, 0]

Expand Down Expand Up @@ -137,10 +137,6 @@ offcanvasList.addEventListener('hidden.bs.offcanvas', e => {

closeObjectsListButton.addEventListener("click", clearObjectsList)

container.addEventListener("mouseleave", () => {
if (!fixed) clearObjectsList()
})

function clearObjectsList() {
hovered = []
fixed = false
Expand Down Expand Up @@ -403,7 +399,7 @@ async function resetEntriesList() {

if (entriesList.contains(moreEntriesButton)) {
entriesList.removeChild(moreEntriesButton)
}
}

let entriesLeft = entriesLimit
let element
Expand All @@ -412,7 +408,7 @@ async function resetEntriesList() {

if (atlasDisplay[atlasOrder[entriesOffset]]) {
// console.log(i, entriesLeft)

let entry = atlasDisplay[atlasOrder[entriesOffset]]
element = createInfoBlock(entry)

Expand Down Expand Up @@ -475,16 +471,16 @@ async function resetEntriesList() {

entriesOffset += 1
entriesLeft -= 1

entriesList.appendChild(element)

}

if (atlasOrder.length > entriesOffset) {
moreEntriesButton.innerHTML = "Show " + Math.min(entriesLimit, atlasOrder.length - entriesOffset) + " more"
entriesList.appendChild(moreEntriesButton)
}

}
moreEntriesButton.addEventListener('click', showMoreEntries)
showMoreEntries()
Expand Down Expand Up @@ -676,8 +672,8 @@ async function updateViewFromHash() {
await updateTime(targetPeriod, targetVariation)

setView(
(isNaN(hashX) || hashX === '') ? undefined : Number(hashX),
(isNaN(hashY) || hashY === '') ? undefined : Number(hashY),
(isNaN(hashX) || hashX === '') ? undefined : Number(hashX),
(isNaN(hashY) || hashY === '') ? undefined : Number(hashY),
(isNaN(hashZoom) || hashZoom === '') ? undefined : Number(hashZoom)
)

Expand Down Expand Up @@ -705,8 +701,8 @@ async function updateViewFromHash() {
objectsContainer.appendChild(infoElement)

setView(
(isNaN(hashX) || hashX === '') ? entry.center[0] : Number(hashX),
(isNaN(hashY) || hashY === '') ? entry.center[1] : Number(hashY),
(isNaN(hashX) || hashX === '') ? entry.center[0] : Number(hashX),
(isNaN(hashY) || hashY === '') ? entry.center[1] : Number(hashY),
(isNaN(hashZoom) || hashZoom === '') ? calculateZoomFromPath(entry.path) : Number(hashZoom)
)

Expand Down Expand Up @@ -836,6 +832,10 @@ function initViewGlobal() {
document.addEventListener('timeupdate', event => {
drawButton.href = "./?mode=draw" + formatHash(null, event.detail.period, event.detail.variation)
})

document.addEventListener("mouseleave", () => {
if (!fixed) clearObjectsList()
})
}


Expand Down
Loading