Skip to content

Commit 4c03afa

Browse files
committed
🚨 Javascript standard style
1 parent 02e9b42 commit 4c03afa

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ indent_size = 4
77
indent_style = space
88
insert_final_newline = yes
99
trim_trailing_whitespace = yes
10+
11+
[*.js]
12+
indent_size = 2

source/_static/js/custom.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
$(function() {
2-
3-
function check_logo_height() {
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;
1+
$(function () {
2+
function checkLogoHeight () {
3+
var logo = $('div[itemprop="articleBody"] > .sidebar')
4+
var hr = $('div[itemprop="articleBody"] > .section > hr')
5+
var logoEnd = 0
6+
var hrPosition = 0
87
if (logo.length) {
9-
logo_end = logo.offset().top + logo.outerHeight();
8+
logoEnd = logo.offset().top + logo.outerHeight()
109
}
1110
if (hr.length) {
12-
hr_position = hr.offset().top;
11+
hrPosition = hr.offset().top
1312
}
14-
console.log('[logo] ' + logo_end + " vs " + 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);
13+
console.log('[logo] ' + logoEnd + ' vs ' + hrPosition)
14+
if (logoEnd > hrPosition) {
15+
var marginTop = parseInt(hr.css('margin-top'), 10)
16+
var marginBottom = parseInt(hr.css('margin-bottom'), 10)
17+
var offset = Math.ceil((logoEnd - hrPosition) / 2)
18+
hr.css('margin-top', marginTop + offset + 'px')
19+
hr.css('margin-bottom', marginBottom + offset + 'px')
20+
console.log('[logo] pushed first break down by ' + offset * 2)
2221
}
23-
};
22+
}
2423

25-
console.log('UberLab launched…');
26-
check_logo_height();
24+
console.log('UberLab launched…')
2725

28-
});
26+
// fix spacing between border and text
27+
checkLogoHeight()
28+
})

0 commit comments

Comments
 (0)