|
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 |
8 | 7 | if (logo.length) {
|
9 |
| - logo_end = logo.offset().top + logo.outerHeight(); |
| 8 | + logoEnd = logo.offset().top + logo.outerHeight() |
10 | 9 | }
|
11 | 10 | if (hr.length) {
|
12 |
| - hr_position = hr.offset().top; |
| 11 | + hrPosition = hr.offset().top |
13 | 12 | }
|
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) |
22 | 21 | }
|
23 |
| - }; |
| 22 | + } |
24 | 23 |
|
25 |
| - console.log('UberLab launched…'); |
26 |
| - check_logo_height(); |
| 24 | + console.log('UberLab launched…') |
27 | 25 |
|
28 |
| -}); |
| 26 | + // fix spacing between border and text |
| 27 | + checkLogoHeight() |
| 28 | +}) |
0 commit comments