Skip to content
This repository was archived by the owner on Feb 4, 2024. It is now read-only.

Commit fe275ac

Browse files
committed
Avoid image overlap on the right column
1 parent 93c22ae commit fe275ac

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

resources/js/contentTransformation.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,24 @@ window.addEventListener('load', function () {
136136
};
137137
});
138138

139+
/* Shift images to the right */
140+
window.addEventListener('load', function () {
141+
var imgs = $('main .thumb, main .mermaid');
142+
var prev = $('head');
143+
144+
imgs.each(function () {
145+
$this = $(this);
146+
var v_offest = $this.offset().top;
147+
var height = $this.height();
148+
cutoff = prev.offset().top + prev.height();
149+
if (v_offest <= cutoff) {
150+
var new_offset = cutoff + 20;
151+
$this.css('top', `${new_offset}px`); // Default UIkit margin
152+
}
153+
prev = $this;
154+
})
155+
});
156+
139157
/* Preview Wikilinks */
140158
window.addEventListener('load', function () {
141159
var own = top.location.host.toString();
@@ -166,10 +184,10 @@ window.addEventListener('load', function () {
166184
if (res.type != 'no-extract') {
167185
caller.find('p').html(res.extract);
168186
};
169-
caller.find('p').html('No extract available!'); // TODO: Add "warning" icon for policy pages, and "info" icon for guideline pages
187+
caller.find('p').html('No extract available!'); // TODO: Add "warning" icon for policy pages, and "info" icon for guideline pages
170188
})
171189
.fail(function (res, status, err) {
172190
caller.find('p').html('Article not found!<br>Reason: ' + status + ', ' + err);
173191
});
174192
};
175-
});
193+
});

resources/templates/main.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
{{#if catlinks}}<nav>{{{catlinks}}}</nav>{{/if}} {{! TODO: Move category links to side- or toolbar }}
107107
{{#if dataAfterContent}}<div>{{{dataAfterContent}}}</div>{{/if}}
108108
</main>
109-
<div id="right col" class="uk-width-1-4">
109+
<div id="right-col" class="uk-width-1-4">
110110
111111
</div>
112112
<div class="uk-width-1-4">

0 commit comments

Comments
 (0)