Skip to content

Commit e33f338

Browse files
committed
Initial design improvements
1 parent 88ba376 commit e33f338

File tree

13 files changed

+838
-887
lines changed

13 files changed

+838
-887
lines changed

.prettierignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
_site
10+
.jekyll-cache
11+
12+
# Ignore files for PNPM, NPM and YARN
13+
pnpm-lock.yaml
14+
package-lock.json
15+
yarn.lock

.prettierrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"useTabs": true,
3+
"singleQuote": true,
4+
"trailingComma": "none",
5+
"printWidth": 180
6+
}

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ gem "minima", "~> 2.5"
1616
# If you have any plugins, put them here!
1717
group :jekyll_plugins do
1818
gem "jekyll-feed", "~> 0.12"
19+
gem "jekyll-prettier"
1920
end
2021

2122
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem

Gemfile.lock

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
addressable (2.7.0)
5-
public_suffix (>= 2.0.2, < 5.0)
4+
addressable (2.8.5)
5+
public_suffix (>= 2.0.2, < 6.0)
66
colorator (1.1.0)
7-
concurrent-ruby (1.1.7)
8-
em-websocket (0.5.2)
7+
concurrent-ruby (1.2.2)
8+
em-websocket (0.5.3)
99
eventmachine (>= 0.12.9)
10-
http_parser.rb (~> 0.6.0)
10+
http_parser.rb (~> 0)
1111
eventmachine (1.2.7)
12-
ffi (1.15.5)
12+
ffi (1.16.2)
1313
forwardable-extended (2.6.0)
14-
http_parser.rb (0.6.0)
15-
i18n (1.8.5)
14+
http_parser.rb (0.8.0)
15+
i18n (1.14.1)
1616
concurrent-ruby (~> 1.0)
1717
jekyll (4.1.1)
1818
addressable (~> 2.4)
@@ -29,21 +29,23 @@ GEM
2929
rouge (~> 3.0)
3030
safe_yaml (~> 1.0)
3131
terminal-table (~> 1.8)
32-
jekyll-feed (0.15.1)
32+
jekyll-feed (0.17.0)
3333
jekyll (>= 3.7, < 5.0)
34+
jekyll-prettier (0.0.0)
35+
jekyll (>= 3.8)
3436
jekyll-redirect-from (0.16.0)
3537
jekyll (>= 3.3, < 5.0)
36-
jekyll-sass-converter (2.1.0)
38+
jekyll-sass-converter (2.2.0)
3739
sassc (> 2.0.1, < 3.0)
38-
jekyll-seo-tag (2.6.1)
39-
jekyll (>= 3.3, < 5.0)
40+
jekyll-seo-tag (2.8.0)
41+
jekyll (>= 3.8, < 5.0)
4042
jekyll-watch (2.2.1)
4143
listen (~> 3.0)
42-
kramdown (2.3.0)
44+
kramdown (2.4.0)
4345
rexml
4446
kramdown-parser-gfm (1.1.0)
4547
kramdown (~> 2.0)
46-
liquid (4.0.3)
48+
liquid (4.0.4)
4749
listen (3.8.0)
4850
rb-fsevent (~> 0.10, >= 0.10.3)
4951
rb-inotify (~> 0.9, >= 0.9.10)
@@ -54,18 +56,18 @@ GEM
5456
jekyll-seo-tag (~> 2.1)
5557
pathutil (0.16.2)
5658
forwardable-extended (~> 2.6)
57-
public_suffix (4.0.6)
59+
public_suffix (5.0.3)
5860
rb-fsevent (0.11.2)
5961
rb-inotify (0.10.1)
6062
ffi (~> 1.0)
61-
rexml (3.2.4)
62-
rouge (3.23.0)
63+
rexml (3.2.6)
64+
rouge (3.30.0)
6365
safe_yaml (1.0.5)
6466
sassc (2.4.0)
6567
ffi (~> 1.9)
6668
terminal-table (1.8.0)
6769
unicode-display_width (~> 1.1, >= 1.1.1)
68-
unicode-display_width (1.7.0)
70+
unicode-display_width (1.8.0)
6971
webrick (1.8.1)
7072

7173
PLATFORMS
@@ -74,6 +76,7 @@ PLATFORMS
7476
DEPENDENCIES
7577
jekyll (~> 4.1.1)
7678
jekyll-feed (~> 0.12)
79+
jekyll-prettier
7780
jekyll-redirect-from
7881
minima (~> 2.5)
7982
tzinfo (~> 1.2)

_includes/banner.html

+70-70
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,78 @@
11
<div class="row">
2-
<div class="col-md-12">
3-
<img class="banner" src="/assets/banners/banner000.jpg"><a href="/">
4-
<img class="logo" src='/assets/logos/or_logo.png' alt="Logo for Open Rails">
5-
<span class="logo_text">Open Rails</span>
6-
</a><a href="#" title="Click for another picture">
7-
<span class="glyphicon glyphicon-chevron-right next_banner"></span>
8-
</a><script type="text/javascript">
9-
(async function(){
10-
const banner = document.currentScript.previousSibling.previousSibling.previousSibling;
11-
const another = document.currentScript.previousSibling;
12-
let session;
13-
try {
14-
session = sessionStorage;
15-
} catch {
16-
session = undefined;
17-
}
2+
<div class="col-md-12">
3+
<img class="banner" id="banner" src="/assets/banners/banner000.jpg" />
4+
<a href="/" class="logo-container">
5+
<img class="logo" src="/assets/logos/or_logo.png" alt="Logo for Open Rails" />
6+
<span class="logo_text">Open Rails</span>
7+
</a>
8+
<a href="#" title="Click for another picture" id="show-another-image">
9+
<span class="glyphicon glyphicon-chevron-right next_banner"></span>
10+
</a>
11+
<script type="text/javascript">
12+
(async function () {
13+
const banner = document.getElementById('banner');
14+
const another = document.getElementById('show-another-image');
15+
let session;
16+
try {
17+
session = sessionStorage;
18+
} catch {
19+
session = undefined;
20+
}
1821

19-
const show = () => {
20-
if (session === undefined)
21-
return false;
22-
const curImage = session.getItem("or_banner_image");
23-
const curTitle = session.getItem("or_banner_title");
24-
const curSupplier = session.getItem("or_banner_supplier");
25-
if ([curImage, curTitle, curSupplier].some(x => x === null))
26-
return false;
27-
banner.src = curImage;
28-
banner.title = `${curTitle}\nposted by ${curSupplier}`;
29-
return true;
30-
};
31-
const loadJson = async (url) => new Promise((resolve, reject) => {
32-
const req = new XMLHttpRequest();
33-
req.open("GET", url);
34-
req.addEventListener("load", (e) => {
35-
resolve(req.response);
36-
});
37-
req.addEventListener("error", reject);
38-
req.addEventListener("abort", reject);
39-
req.responseType = "json";
40-
req.send();
41-
});
22+
const show = () => {
23+
if (session === undefined) return false;
24+
const curImage = session.getItem('or_banner_image');
25+
const curTitle = session.getItem('or_banner_title');
26+
const curSupplier = session.getItem('or_banner_supplier');
27+
if ([curImage, curTitle, curSupplier].some((x) => x === null)) return false;
28+
banner.src = curImage;
29+
banner.title = `${curTitle}\nposted by ${curSupplier}`;
30+
return true;
31+
};
32+
const loadJson = async (url) =>
33+
new Promise((resolve, reject) => {
34+
const req = new XMLHttpRequest();
35+
req.open('GET', url);
36+
req.addEventListener('load', (e) => {
37+
resolve(req.response);
38+
});
39+
req.addEventListener('error', reject);
40+
req.addEventListener('abort', reject);
41+
req.responseType = 'json';
42+
req.send();
43+
});
4244

43-
/* Load the current banner, as stored in the cookies, immediately.
44-
* It takes a visibly long time for the browser to load the banner list,
45-
* even when it's already cached. */
46-
const showAgain = !show();
47-
const list = await loadJson("/assets/banners/banner_list.json");
45+
/* Load the current banner, as stored in the cookies, immediately.
46+
* It takes a visibly long time for the browser to load the banner list,
47+
* even when it's already cached. */
48+
const showAgain = !show();
49+
const list = await loadJson('/assets/banners/banner_list.json');
4850

49-
const pick = (l) => l[Math.floor(Math.random() * l.length)];
50-
const next = () => {
51-
if (session === undefined)
52-
return;
53-
const b = pick(list);
54-
const path = `/assets/banners/${b["image"]}`;
55-
session.setItem("or_banner_image", path);
56-
session.setItem("or_banner_title", b["title"]);
57-
session.setItem("or_banner_supplier", b["supplier"]);
51+
const pick = (l) => l[Math.floor(Math.random() * l.length)];
52+
const next = () => {
53+
if (session === undefined) return;
54+
const b = pick(list);
55+
const path = `/assets/banners/${b['image']}`;
56+
session.setItem('or_banner_image', path);
57+
session.setItem('or_banner_title', b['title']);
58+
session.setItem('or_banner_supplier', b['supplier']);
5859

59-
// Preload the next banner.
60-
new Image().src = path;
61-
};
60+
// Preload the next banner.
61+
new Image().src = path;
62+
};
6263

63-
another.addEventListener("click", (e) => {
64-
show();
65-
next();
66-
e.preventDefault();
67-
});
64+
another.addEventListener('click', (e) => {
65+
show();
66+
next();
67+
e.preventDefault();
68+
});
6869

69-
next();
70-
if (showAgain)
71-
{
72-
show();
73-
next();
74-
}
75-
})();
76-
</script>
77-
</div>
70+
next();
71+
if (showAgain) {
72+
show();
73+
next();
74+
}
75+
})();
76+
</script>
77+
</div>
7878
</div>

0 commit comments

Comments
 (0)