Skip to content

Commit 0c54781

Browse files
committed
Initial commit
1 parent 3d765ab commit 0c54781

32 files changed

+682
-46
lines changed

.github/workflows/ci.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ permissions:
44
contents: write
55

66
jobs:
7-
report:
7+
deploy:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
@@ -13,11 +13,12 @@ jobs:
1313
- name: Install Deps
1414
run: |
1515
sudo apt-get install libcmark-dev curl
16-
curl -L https://codeberg.org/0ref/jelly/releases/download/0.1.0/jelly-linux-x86_64 --output jelly
16+
curl -L https://codeberg.org/0ref/jelly/releases/download/0.1.1/jelly-linux-x86_64 --output jelly
1717
curl -L https://github.com/wilsonzlin/minify-html/releases/download/v0.15.0/minhtml-0.15.0-x86_64-unknown-linux-gnu --output minhtml
1818
chmod +x ./jelly
1919
chmod +x ./minhtml
2020
./jelly -i src -o build
21+
cp -r ./public/* build/
2122
./minhtml --keep-closing-tags --minify-css --minify-js \
2223
--keep-spaces-between-attributes \
2324
--keep-input-type-text-attr \

build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ if [ "$CMD" = "clean" ]; then
99
rm -rf $BUILD
1010
exit 0
1111
elif [ "$CMD" = "serve" ]; then
12-
find src/ | entr -rs "jelly -i src -o $BUILD && python3 -m http.server -d $BUILD 4000"
12+
find src/ public/ | entr -rs "jelly -i src -o $BUILD && ln -sf "$PWD/public/*" $BUILD/ && python3 -m http.server -d $BUILD 4000"
1313
exit 0
1414
else
15-
echo "Invalid command '$CMD', Available commands are: clean/serve/release."
15+
echo "Invalid command '$CMD', Available commands are: clean/serve."
1616
exit 1
1717
fi

public/css/styles.css

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
@font-face {
2+
font-family: 'Liberation Mono';
3+
src: url('/fonts/liberation-mono/LiberationMono.woff2') format('woff2'), url('/fonts/liberation-mono/LiberationMono.woff') format('woff');
4+
font-weight: 400;
5+
font-style: normal;
6+
font-display: swap
7+
}
8+
@font-face {
9+
font-family: 'Liberation Mono';
10+
src: url('/fonts/liberation-mono/LiberationMono-Italic.woff2') format('woff2'), url('/fonts/liberation-mono/LiberationMono-Italic.woff') format('woff');
11+
font-weight: 400;
12+
font-style: italic;
13+
font-display: swap
14+
}
15+
@font-face {
16+
font-family: 'Liberation Mono';
17+
src: url('/fonts/liberation-mono/LiberationMono-Bold.woff2') format('woff2'), url('/fonts/liberation-mono/LiberationMono-Bold.woff') format('woff');
18+
font-weight: 700;
19+
font-style: normal;
20+
font-display: swap
21+
}
22+
@font-face {
23+
font-family: 'Liberation Mono';
24+
src: url('/fonts/liberation-mono/LiberationMono-BoldItalic.woff2') format('woff2'), url('/fonts/liberation-mono/LiberationMono-BoldItalic.woff') format('woff');
25+
font-weight: 700;
26+
font-style: italic;
27+
font-display: swap
28+
}
29+
30+
* {
31+
margin: 0;
32+
padding: 0;
33+
box-sizing: border-box;
34+
font-smooth: never;
35+
font-kerning: normal;
36+
font-feature-settings: kern;
37+
text-rendering: optimizeLegibility;
38+
-webkit-font-smoothing: antialiased;
39+
-moz-osx-font-smoothing: grayscale;
40+
scroll-behavior: smooth;
41+
}
42+
43+
:root {
44+
font-size: 110%;
45+
letter-spacing: -0.5px;
46+
line-height: 1.3;
47+
font-family: "Liberation Mono", monospace;
48+
tab-size: 2;
49+
}
50+
51+
body {
52+
color: #000;
53+
background: #FFF;
54+
margin: 1rem auto 3rem auto;
55+
padding: 0 0.75rem;
56+
max-width: 600px;
57+
}
58+
59+
body, p, pre, code {
60+
font-size: 1rem;
61+
}
62+
h1, h2, h3, h4, h5, h6 {
63+
text-transform: capitalize;
64+
font-weight: 400;
65+
letter-spacing: 0.5px;
66+
margin-top: 1.75rem;
67+
}
68+
p {
69+
margin-top: 1.5rem;
70+
}
71+
h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p {
72+
margin-top: 0.5rem;
73+
}
74+
75+
ul, ol {
76+
margin-top: 1rem;
77+
}
78+
ul {
79+
padding-left: 1.25rem;
80+
}
81+
ol {
82+
padding-left: 1.75rem;
83+
}
84+
ul > li:not(:first-of-type), ol > li:not(:first-of-type) {
85+
margin-top: 0.25rem;
86+
}
87+
ul {
88+
list-style: none;
89+
}
90+
ul li:before {
91+
content: "- ";
92+
margin-left: -2ch;
93+
width: 2ch;
94+
display: inline-block;
95+
}
96+
97+
a, a:visited {
98+
color: #000;
99+
text-decoration-color: #000 !important;
100+
line-height: 1.5 !important;
101+
text-decoration: underline;
102+
text-underline-offset: 0.17rem;
103+
}
104+
a:hover {
105+
text-decoration: none;
106+
}
107+
108+
hr {
109+
border-top: 1px solid #000;
110+
}
111+
112+
img {
113+
display: block;
114+
margin: 0 auto;
115+
max-width: 100%;
116+
height: auto;
117+
}
118+
119+
pre {
120+
overflow: auto;
121+
scrollbar-width: thin;
122+
white-space: pre;
123+
margin-top: 1rem;
124+
margin-left: 0.5rem;
125+
}
126+
pre code, pre {
127+
background: none !important;
128+
}
129+
pre code {
130+
padding: 0 !important;
131+
}
132+
code:not(pre code) {
133+
color: #000 !important;
134+
font-weight: bold;
135+
}
136+
137+
body > nav > a:not(:first-of-type) {
138+
margin-left: 1ch;
139+
}
140+
141+
body > header > div > time {
142+
display: inline;
143+
font-size: 0.9rem;
144+
opacity: 0.75;
145+
}
146+
body > header > div > time.modified_on {
147+
font-style: italic;
148+
margin-left: 0.5rem;
149+
}
150+
body > header > div > time:empty {
151+
display: none;
152+
}
153+
body > header > div > time.modified_on:before {
154+
content: "(Edited: "
155+
}
156+
body > header > div > time.modified_on:after {
157+
content: ")";
158+
}

public/favicon.png

3.86 KB
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

public/lib/moment-2.30.1/moment.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/media/csprite-preview.png

38.6 KB
Loading

public/media/icon-80x32_9x.png

3.93 KB
Loading

public/media/wiki/fill-tool.gif

722 KB
Loading
299 KB
Loading

public/media/wiki/new-canvas.gif

517 KB
Loading

public/media/wiki/open-file.gif

753 KB
Loading

public/robots.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
User-agent: GPTBot
2+
Disallow: /
3+
User-agent: ChatGPT-User
4+
Disallow: /
5+
User-agent: Google-Extended
6+
Disallow: /
7+
User-agent: PerplexityBot
8+
Disallow: /
9+
User-agent: Amazonbot
10+
Disallow: /
11+
User-agent: ClaudeBot
12+
Disallow: /
13+
User-agent: Omgilibot
14+
Disallow: /
15+
User-Agent: FacebookBot
16+
Disallow: /
17+
User-Agent: Applebot
18+
Disallow: /
19+
User-agent: anthropic-ai
20+
Disallow: /
21+
User-agent: Bytespider
22+
Disallow: /
23+
User-agent: Claude-Web
24+
Disallow: /
25+
User-agent: Diffbot
26+
Disallow: /
27+
User-agent: ImagesiftBot
28+
Disallow: /
29+
User-agent: Omgilibot
30+
Disallow: /
31+
User-agent: Omgili
32+
Disallow: /
33+
User-agent: YouBot
34+
Disallow: /

src/download.md

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title Download
3+
date
4+
last_modified_at
5+
---
6+
7+
<noscript>
8+
<p>This page relies on JavaScript for fetching binaries, If you don't want to enable JavaScript you can download the binaries at <a href="https://github.com/csprite/csprite/releases">Github Releases</a></p>
9+
</noscript>
10+
11+
<div style="display: none;" id="downloadContent">
12+
<p>Loading...</p>
13+
</div>
14+
<div style="display: none;" id="downloadContentGit">
15+
<p>Loading...</p>
16+
</div>
17+
18+
<script src="/lib/moment-2.30.1/moment.min.js" async></script>
19+
<script async>
20+
const RepoPath = "csprite/csprite";
21+
22+
// Returns Difference Between 2 Dates In Hours
23+
function TimeDifference(date1, date2) {
24+
let a = moment(date1);
25+
let b = moment(date2);
26+
return a.diff(b, 'hours');
27+
}
28+
29+
async function LoadLatestStableBuilds() {
30+
let downloadContent = document.getElementById("downloadContent");
31+
try {
32+
let GhReleases = localStorage.getItem(`GhReleases`);
33+
if (GhReleases) GhReleases = JSON.parse(GhReleases);
34+
if (!GhReleases || TimeDifference(new Date().getTime(), GhReleases.timestamp) >= 1) {
35+
console.log("No Valid Gh Releases Cache Found!");
36+
const response = await fetch(`https://api.github.com/repos/${RepoPath}/releases/latest`);
37+
GhReleases = await response.json();
38+
GhReleases.timestamp = new Date().getTime();
39+
localStorage.setItem(`GhReleases`, JSON.stringify(GhReleases));
40+
} else {
41+
console.log("Valid Gh Releases Found!");
42+
}
43+
44+
let myList = document.createElement("ul");
45+
GhReleases.assets.push({ browser_download_url: GhReleases.zipball_url, name: "Source code (.zip)" });
46+
GhReleases.assets.push({ browser_download_url: GhReleases.tarball_url, name: "Source code (.tar.gz)" });
47+
for (var i = 0; i < GhReleases.assets.length; i++) {
48+
let myListItem = document.createElement("li");
49+
myListItem.innerHTML += `<a href="${GhReleases.assets[i].browser_download_url}">${GhReleases.assets[i].name}</a>`
50+
myList.appendChild(myListItem);
51+
}
52+
53+
downloadContent.innerHTML = `
54+
<h2>Latest Stable Builds</h2>
55+
<p>The current stable release of csprite is ${GhReleases.tag_name.substring(1, GhReleases.tag_name.length)} (${moment(GhReleases.published_at).fromNow()}).</p>
56+
${myList.outerHTML}
57+
`.trim();
58+
} catch(err) {
59+
console.info(err);
60+
downloadContent.innerHTML = `<p>Failed To Fetch Download Links, Go To <a href="https://github.com/${RepoPath}/releases/latest">GitHub Releases Page</a> Instead.</p>`;
61+
}
62+
}
63+
64+
async function LoadLatestGitBuilds() {
65+
let downloadContentGit = document.getElementById("downloadContentGit");
66+
try {
67+
let GhReleasesGit = localStorage.getItem(`GhReleasesGit`);
68+
if (GhReleasesGit) GhReleasesGit = JSON.parse(GhReleasesGit);
69+
if (!GhReleasesGit || TimeDifference(new Date().getTime(), GhReleasesGit.timestamp) >= 1) {
70+
console.log("No Valid Gh Releases Git Cache Found!");
71+
const response = await fetch(`https://api.github.com/repos/${RepoPath}/releases/tags/latest-git`);
72+
GhReleasesGit = await response.json();
73+
GhReleasesGit.timestamp = new Date().getTime();
74+
localStorage.setItem(`GhReleasesGit`, JSON.stringify(GhReleasesGit));
75+
} else {
76+
console.log("Valid Gh Releases Git Found!");
77+
}
78+
79+
let myList = document.createElement("ul");
80+
GhReleasesGit.assets.push({ browser_download_url: GhReleasesGit.zipball_url, name: "Source code (.zip)" });
81+
GhReleasesGit.assets.push({ browser_download_url: GhReleasesGit.tarball_url, name: "Source code (.tar.gz)" });
82+
for (var i = 0; i < GhReleasesGit.assets.length; i++) {
83+
let myListItem = document.createElement("li");
84+
myListItem.innerHTML = `<a href="${GhReleasesGit.assets[i].browser_download_url}">${GhReleasesGit.assets[i].name}</a>`;
85+
myList.appendChild(myListItem);
86+
}
87+
88+
downloadContentGit.innerHTML = `
89+
<h2>Latest Git Builds</h2>
90+
<p>the latest git builds (${moment(GhReleasesGit.published_at).fromNow()}) of csprite provides latest features but the features might be un-documented & the builds might be unstable.</p>
91+
${ myList.outerHTML }
92+
<p>If above links aren't working, You can download directly from <a href="https://github.com/${RepoPath}/releases/tag/latest-git" target="_blank">GitHub Releases</a>.</p>
93+
`.trim();
94+
} catch(err) {
95+
console.info(err);
96+
downloadContentGit.innerHTML = `<p><a href="https://github.com/${RepoPath}/releases/tag/latest-git" target="_blank">Download the latest git build</a> of csprite provides latest features but the features might be un-documented & the builds might be unstable.</p>`;
97+
}
98+
}
99+
100+
window.addEventListener("load", function() {
101+
document.getElementById("downloadContent").style.display = "unset";
102+
document.getElementById("downloadContentGit").style.display = "unset";
103+
LoadLatestStableBuilds();
104+
LoadLatestGitBuilds();
105+
});
106+
</script>

src/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ date
44
last_modified_at
55
---
66

7+
csprite (Pronounced see-sprite) is a free & easy to use pixel art editor.
8+
9+
![csprite-preview](/media/csprite-preview.png)

0 commit comments

Comments
 (0)