Skip to content

Commit d3978fd

Browse files
brutusSalocinHB
authored andcommitted
Feature/fix overlapping logo (Uberspace#101)
* 📝 add changes to please linter Feel free to discard this. * 🐛 fix overlapping logo
1 parent 8b29694 commit d3978fd

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ be built locally.
1111

1212
### Initial Setup
1313

14-
```
14+
```shell
1515
$ virtualenv venv --python=python3.6
1616
$ source venv/bin/activate
1717
$ pip install -r requirements.txt
1818
```
1919

2020
### Building
2121

22-
```
22+
```shell
2323
$ source venv/bin/activate
2424
$ make html
2525
```
2626

27-
The HTML views are now present in `build/html`.
27+
The HTML views are now present in `build/html`.
2828

2929
## License
3030

31-
All text and code in this repository is licensed under [CC-BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
31+
All text and code in this repository is licensed under [CC-BY-NC-SA 4.0][].
3232
All project logos are property of the respective project.
33+
34+
[CC-BY-NC-SA 4.0]: https://creativecommons.org/licenses/by-nc-sa/4.0/

source/_static/js/custom.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
var app = {
2+
3+
check_logo_height: function() {
4+
var logo = $('div[itemprop="articleBody"] > .sidebar')
5+
var hr = $('div[itemprop="articleBody"] > .section > hr')
6+
var logo_end = 0
7+
var hr_position = 0
8+
if (logo.length) {
9+
logo_end = logo.offset().top + logo.outerHeight();
10+
}
11+
if (hr.length) {
12+
hr_position = hr.offset().top;
13+
}
14+
// console.log('[logo] ' + logo_end + " → " + hr_position);
15+
if (logo_end > hr_position) {
16+
var margin_top = parseInt(hr.css('margin-top'), 10)
17+
var margin_bottom = parseInt(hr.css('margin-bottom'), 10)
18+
var offset = Math.ceil((logo_end - hr_position) / 2)
19+
hr.css('margin-top', (margin_top + offset) + 'px');
20+
hr.css('margin-bottom', (margin_bottom + offset) + 'px');
21+
console.log( '[logo] pushed first break down by ' + (offset * 2));
22+
}
23+
},
24+
25+
init: function() {
26+
console.log('UberLab launched…');
27+
app.check_logo_height();
28+
}
29+
30+
}
31+
32+
app.init()

source/conf.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
html_context = {
9393
'css_files': ['_static/css/custom.css'],
9494
'display_github': True,
95-
'github_user': 'Uberspace',
96-
'github_repo': 'lab',
95+
'github_user': 'Uberspace',
96+
'github_repo': 'lab',
9797
'github_version': 'master',
9898
'conf_py_path': '/source/'
9999
}
@@ -129,3 +129,7 @@
129129

130130
# Output file base name for HTML help builder.
131131
htmlhelp_basename = 'Uberspace7labdoc'
132+
133+
134+
def setup(app):
135+
app.add_javascript('js/custom.js')

0 commit comments

Comments
 (0)