Skip to content

Commit

Permalink
Merge pull request #1603 from placeAtlas/staging/code
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans5958 authored Sep 29, 2023
2 parents fcfc465 + 6763966 commit dd3815c
Show file tree
Hide file tree
Showing 22 changed files with 5,257 additions and 5,116 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@

# The 2023 r/place Atlas

The 2023 r/place Atlas is a project aiming to chart all the artworks created during the r/place April Fools event on Reddit in 2023. It is made with information to each artwork of the canvas provided by the community.
The 2023 r/place Atlas is an interactive map aiming to chart all the artworks created during the r/place April Fools event on Reddit in 2023. It is made with information to each artwork of the canvas provided by the community.

This project was established by Roland Rytz for the event in 2017, and further developed and maintained by the Place Atlas team and contributors.
This project was established by Roland Rytz for the event in 2017, and further developed and maintained by the [Place Atlas Initiative](https://place-atlas.stefanocoding.me) and [contributors](https://github.com/placeAtlas/atlas-2023/graphs/contributors).

Read more about the project from [the announcement on Reddit](https://www.reddit.com/r/placeAtlas2023/comments/154z3q4).

This project is licensed under the [GNU Affero General Public License v3.0](LICENSE).

You can check out the website by visiting [2023.place-atlas.stefanocoding.me](https://2023.place-atlas.stefanocoding.me/). If you want to keep distance from GitHub, you may visit [r/placeAtlas2023](https://www.reddit.com/r/placeAtlas2023/).
You can check out the website by visiting [2023.place-atlas.stefanocoding.me](https://2023.place-atlas.stefanocoding.me/). The subreddit, [r/placeAtlas2023](https://www.reddit.com/r/placeAtlas2023/), is available for communications via Reddit.

## Contributing

Expand All @@ -26,11 +28,14 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) to learn how to submit a new entr

## Contributors

> [!NOTE]
> For more credits, including entry contributors, please see [the Credits sections on the About page](https://2023.place-atlas.stefanocoding.me/about#credits).
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat)](#contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Many thanks to these wonderful people for contributing on the scope of this repository. ([emoji key](https://allcontributors.org/docs/en/emoji-key)).

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
Expand Down
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
[context.deploy-preview]
command = "FILE=tools/ci/build-preview.sh; rm -rf dist/; if [ -f $FILE ]; then bash $FILE; else cp -r web/ dist/; fi"
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF data/patches/ web/ tools/ .parcelrc netlify.toml package-lock.json package.json postcss.config.js"

[context.branch-deploy]
command = "FILE=tools/ci/build-preview.sh; rm -rf dist/; if [ -f $FILE ]; then bash $FILE; else cp -r web/ dist/; fi"
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF data/patches/ web/ tools/ .parcelrc netlify.toml package-lock.json package.json postcss.config.js"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
},
"parcelIgnore": [
"sw.js",
"_img/.+"
"_img/.+",
"atlas.json"
],
"browserslist": [
">= 0.5%",
Expand Down
78 changes: 60 additions & 18 deletions tools/extend_entry_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
if len(pre_extend_times) == 0:
pre_extend_times.append(post_extend_time - 1)
pre_extend_times.append(post_extend_time - 2)
post_extend_time = str(post_extend_time)

while not os.path.exists('README.md'):
os.chdir('..')
Expand All @@ -40,29 +39,72 @@ def per_line_entries(entries: list, file: TextIOWrapper):

def extend_time_key(items):
for key, value in list(items.items()):
old_key = key

if key == '':
del items[key]
items[f'{pre_extend_times[0]}-{post_extend_time}'] = value
continue
key = f'{pre_extend_times[0]}-{post_extend_time}'
elif key == '250' or key == '254' or key == '254-258':
del items[key]
items[f'250-258'] = value
continue
key = '250-258'

times = key.split(', ')
for time in times:
new_times = []
to_add_tfc = 0

for time in times.copy():

# Parse keys for analysis
variation = ''
start_time = None
end_time = None
if ':' in time:
variation = time[:time.find(':')]
time = time[time.find(':') + 1:]
elif time.isalpha():
variation = time
time = ''
if '-' in time:
end_time = time[time.find('-') + 1:]
else:
end_time = time
if int(end_time) in pre_extend_times:
if '-' in key:
new_key = key.replace(end_time, post_extend_time)
start_time = int(time[:time.find('-')])
end_time = int(time[time.find('-') + 1:])
elif time:
start_time = end_time = int(time)

# Extend default canvas periods
if end_time in pre_extend_times:
end_time = post_extend_time

# Rebuild period string before adding it
if start_time and end_time:
if start_time == end_time:
time = str(start_time)
else:
new_key = key.replace(end_time, f'{key}-{post_extend_time}')
del items[key]
items[new_key] = value
break
time = f'{start_time}-{end_time}'
else:
time = ''

if time == '':
time = variation
else:
if variation:
time = f'{variation}:{time}'

new_times.append(time)

# Extend default canvas to TFC
if variation == 'T':
to_add_tfc = -1
if variation == '' and start_time <= 250 and 250 <= end_time:
if to_add_tfc == 0:
to_add_tfc = 1

if to_add_tfc == 1:
new_times.append('T')

new_times = list(filter(lambda x: x, list(dict.fromkeys(new_times))))
key = ', '.join(new_times)

if old_key != key:
del items[old_key]
items[key] = value

for entry in atlas_data:
if not entry['id'] in exclude_extend:
Expand Down
3 changes: 1 addition & 2 deletions tools/unused/smallifier.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

<!--
The 2023 r/place Atlas
Copyright (c) 2017 Roland Rytz <[email protected]>
Copyright (c) 2023 Place Atlas contributors
Copyright (c) 2023 Place Atlas Initiative and contributors
Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
-->

Expand Down
22 changes: 17 additions & 5 deletions web/_css/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* The 2023 r/place Atlas
* Copyright (c) 2017 Roland Rytz <[email protected]>
* Copyright (c) 2023 Place Atlas contributors
* Copyright (c) 2023 Place Atlas Initiative and contributors
* Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
*/

Expand Down Expand Up @@ -266,12 +266,12 @@ body[data-init-done] .listTransitioning #innerContainer {
}

#variantControls {
flex: 1 0 auto;
flex: 2 0 auto;
}

#timeControls {
position: relative;
flex: 6 0 300px;
flex: 12 0 300px;
}

#bottomBar.no-time-slider #timeControls {
Expand Down Expand Up @@ -448,13 +448,25 @@ body:not([data-dev]) .show-only-on-dev {
display: none !important
}

#objectsList,
#offcanvasList,
#offcanvasDraw,
#closeObjectsListButton {
margin-top: var(--global-top-padding);
}

.copyleft {
display: inline-block;
transform: rotateY(180deg);
}

/* about.html */

#credits a {
#entry-contributors-wrapper a {
text-decoration: none;
}

#credits a:hover {
#entry-contributors-wrapper a:hover {
text-decoration: underline;
}

Expand Down
21 changes: 17 additions & 4 deletions web/_headers
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
/*
Access-Control-Allow-Origin: *

/_img/canvas/*/*.png
cache-control: public, max-age=604800

# Hashed resources: 1 year and immutable

/_js/*
Cache-Control: public, immutable, max-age=31536000

/_css/*
Cache-Control: public, immutable, max-age=31536000

# Canvas images: 1 year

/_img/canvas/*
Cache-Control: public, max-age=31536000

/_img/canvas/*.png
cache-control: public, max-age=604800
Cache-Control: public, max-age=31536000

/_img/canvas/*/*.png
Cache-Control: public, max-age=31536000
Binary file added web/_img/canvas/tfc/base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions web/_js/about.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* The 2023 r/place Atlas
* Copyright (c) 2017 Roland Rytz <[email protected]>
* Copyright (c) 2023 Place Atlas contributors
* Copyright (c) 2023 Place Atlas Initiative and contributors
* Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
*/

const contributorsEl = document.querySelector('#contributors-wrapper')
const contributorsEl = document.querySelector('#entry-contributors-wrapper')

// <i aria-label="GitHub" class="bi bi-github"></i>
const gitHubEl = document.createElement("i")
Expand Down Expand Up @@ -34,6 +34,8 @@ fetch('all-authors.txt')
userEl.href = 'https://reddit.com/user/' + contributor
userEl.textContent = contributor
}
userEl.target = '_blank'
userEl.rel = 'noreferrer'
contributorsEl.appendChild(userEl)
contributorsEl.appendChild(document.createTextNode(' '))
}
Expand Down
18 changes: 17 additions & 1 deletion web/_js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,22 @@ const variationsConfig = {
],
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 192 192" aria-hidden="true"><polygon points="154 0 154 38 39 38 39 192 0 192 0 0"/><polygon points="192 38 192 192 77 192 77 153 154 153 154 38"/><rect x="77" y="77" width="38" height="38"/></svg>'
},
tfc: {
name: "The Final Clean",
code: "T",
default: 0,
drawablePeriods: [0, 0],
drawableRegions: [
[[0, 0], [-1500, -1000, 1499, 999]],
],
versions: [
{
timestamp: "Final",
url: "./_img/canvas/tfc/base.png",
}
],
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 192 192" aria-hidden="true"><defs><style>.a{fill-rule:evenodd;}</style></defs><path class="a" d="M69.79,83.55c-.47,.65-.59,1.35-.59,1.35-.26,1.47,.76,2.72,.92,3.12,2.84,7.1,4.49,13.93,3.97,16.39-.47,2.18-5.6,5.65-12.36,8.33-3.63,1.44-6.11,2.99-8.04,5.01-7.17,7.51-10.24,17.86-7.14,24.05,3.93,7.84,18.38,5.86,28.05-3.85,2.09-2.1,3.15-3.83,6.63-10.77,2.97-5.93,4.26-8.05,5.47-8.95,2.04-1.52,9.82,.1,17.41,3.64,1.71,.8,2.31,1.04,2.78,.98,0,0,.22-.05,.43-.14,1.31-.59,17.43-17,25.58-25.34-1.79,.09-3.57,.18-5.36,.28-2.84,2.63-5.68,5.27-8.52,7.9-10.85-10.85-21.7-21.71-32.55-32.56,1.73-1.8,3.46-3.6,5.18-5.4-.29-1.56-.57-3.12-.86-4.69-1.34,1.27-19.42,18.45-21.01,20.66Zm-10.45,44.57c2.5,0,4.53,2.03,4.53,4.53s-2.03,4.53-4.53,4.53-4.53-2.03-4.53-4.53,2.03-4.53,4.53-4.53Z"/><path class="f" d="M132.9,97.36c-.88,.22-7.88,1.92-9.91-1.04-1.11-1.62-1.05-4.71-.52-6.57,.74-2.59,.9-4.06,.25-4.73-.73-.76-2.03-.31-3.73-.18-3.4,.27-8.08-.86-9.6-3.16-2.77-4.21,4.48-13.03,2.31-14.69-.17-.13-.34-.16-.67-.22-4.24-.73-6.79,4.71-11.66,5.1-2.93,.24-6.21-1.39-7.72-4.02-1.11-1.94-1-3.96-.86-4.95h0s7.38-7.39,17.6-17.52c12.75,12.73,25.51,25.47,38.26,38.2l-13.75,13.79Z"/><polygon points="154 0 154 38 39 38 39 192 0 192 0 0"/><polygon points="192 38 192 192 77 192 77 153 154 153 154 38"/></svg>'
}
}
window.variationsConfig = variationsConfig

Expand All @@ -328,7 +344,7 @@ window.useNumericalId = useNumericalId

console.info(`%cThe 2023 r/place Atlas
%cCopyright (c) 2017 Roland Rytz <[email protected]>
Copyright (c) 2023 Place Atlas contributors
Copyright (c) 2023 Place Atlas Initiative and contributors
Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
https://2023.place-atlas.stefanocoding.me/
Expand Down
2 changes: 1 addition & 1 deletion web/_js/main/atlas.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* The 2023 r/place Atlas
* Copyright (c) 2017 Roland Rytz <[email protected]>
* Copyright (c) 2023 Place Atlas contributors
* Copyright (c) 2023 Place Atlas Initiative and contributors
* Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
*/

Expand Down
2 changes: 1 addition & 1 deletion web/_js/main/draw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* The 2023 r/place Atlas
* Copyright (c) 2017 Roland Rytz <[email protected]>
* Copyright (c) 2023 Place Atlas contributors
* Copyright (c) 2023 Place Atlas Initiative and contributors
* Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
*/

Expand Down
2 changes: 1 addition & 1 deletion web/_js/main/infoblock.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* The 2023 r/place Atlas
* Copyright (c) 2017 Roland Rytz <[email protected]>
* Copyright (c) 2023 Place Atlas contributors
* Copyright (c) 2023 Place Atlas Initiative and contributors
* Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
*/

Expand Down
46 changes: 35 additions & 11 deletions web/_js/main/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* The 2023 r/place Atlas
* Copyright (c) 2017 Roland Rytz <[email protected]>
* Copyright (c) 2023 Place Atlas contributors
* Copyright (c) 2023 Place Atlas Initiative and contributors
* Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
*/

Expand Down Expand Up @@ -100,6 +100,17 @@ async function init() {
}
}

// Experimental: TemplateManager support
// Add a .json file of TemplateManager on the "template" URL param.
// e.g. ?template=https://osu.place/e/osuplace2023.json
// CORS bypass is required (e.g. a proxy, CORS Anywhere).
if (params.get("template")) {
const [ templateDatas ] = await loadTemplateData(params.get("template"))
const templateLayers = await loadTemplateImages(templateDatas)
additionalLayers.push(...templateLayers)
updateAdditionalLayer(additionalLayers)
}

if (mode === "about") window.location.replace("./about.html")

// For Reviewing Reddit Changes
Expand Down Expand Up @@ -520,18 +531,31 @@ function generateAtlasAll(atlas = atlasAll) {
return newAtlas
}

// Announcement system
// Notice system

const noticeEl = document.querySelector("#headerNotice")
const noticeButton = noticeEl.querySelector('[role=button]')
const noticeText = noticeEl.querySelector('p').textContent.trim()

const announcementEl = document.querySelector("#headerAnnouncement")
const announcementButton = announcementEl.querySelector('[role=button]')
const announcementText = announcementEl.querySelector('p').textContent.trim()
const resizeGlobalTopPadding = () => {
document.body.style.setProperty("--global-top-padding", noticeEl.offsetHeight + 'px')
}

if (window.localStorage.getItem('announcement-closed')) {
window.localStorage.setItem('closed-notice', window.localStorage.getItem('announcement-closed'))
window.localStorage.removeItem('announcement-closed')
}

if (announcementText && announcementText !== window.localStorage.getItem('announcement-closed')) {
announcementButton.click()
document.querySelector('#objectsList').style.marginTop = '2.8rem'
if (noticeText && noticeText !== window.localStorage.getItem('closed-notice')) {
noticeButton.click()
setTimeout(() => {
document.body.style.setProperty("--global-top-padding", noticeEl.offsetHeight + 'px')
}, 500)
window.addEventListener('resize', resizeGlobalTopPadding)
}

announcementEl.querySelector('[role=button]').addEventListener('click', () => {
window.localStorage.setItem('announcement-closed', announcementText)
document.querySelector('#objectsList').style.marginTop = '0'
noticeEl.querySelector('[role=button]').addEventListener('click', () => {
window.localStorage.setItem('closed-notice', noticeText)
window.removeEventListener('resize', resizeGlobalTopPadding)
document.body.style.setProperty("--global-top-padding", null)
})
2 changes: 1 addition & 1 deletion web/_js/main/overlap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* The 2023 r/place Atlas
* Copyright (c) 2017 Roland Rytz <[email protected]>
* Copyright (c) 2023 Place Atlas contributors
* Copyright (c) 2023 Place Atlas Initiative and contributors
* Licensed under AGPL-3.0 (https://2023.place-atlas.stefanocoding.me/license.txt)
*/

Expand Down
Loading

0 comments on commit dd3815c

Please sign in to comment.