fix(layout): clone right column before plugins

This commit is contained in:
ppoffice 2020-09-13 00:20:05 -04:00
parent fcc6ec404c
commit 333c1c0fcb
No known key found for this signature in database
GPG Key ID: B33335481CC0D498
4 changed files with 13 additions and 10 deletions

View File

@ -34,6 +34,7 @@ module.exports = class extends Component {
<script dangerouslySetInnerHTML={{ __html: `moment.locale("${language}");` }}></script>
<script dangerouslySetInnerHTML={{ __html: embeddedConfig }}></script>
{clipboard ? <script src={cdn('clipboard', '2.0.4', 'dist/clipboard.min.js')} defer={true}></script> : null}
<script src={url_for('/js/column.js')}></script>
<Plugins site={site} config={config} page={page} helper={helper} head={false} />
<script src={url_for('/js/main.js')} defer={true}></script>
</Fragment>;

View File

@ -3,12 +3,6 @@
return Array.prototype.slice.call(document.querySelectorAll.apply(document, arguments));
}
if ($('.columns .column-right').length && $('.columns .column-right-shadow').length && !$('.columns .column-right-shadow')[0].children.length) {
for (const child of $('.columns .column-right')[0].children) {
$('.columns .column-right-shadow')[0].append(child.cloneNode(true));
}
}
$('body > .navbar, body > .section, body > .footer').forEach(element => {
element.style.transition = '0s';
element.style.opacity = '0';

12
source/js/column.js Normal file
View File

@ -0,0 +1,12 @@
(function() {
function $() {
return Array.prototype.slice.call(document.querySelectorAll.apply(document, arguments));
}
// copy widgets in the right column, when exist, to the bottom of the left column
if ($('.columns .column-right').length && $('.columns .column-right-shadow').length && !$('.columns .column-right-shadow')[0].children.length) {
for (const child of $('.columns .column-right')[0].children) {
$('.columns .column-right-shadow')[0].append(child.cloneNode(true));
}
}
}());

View File

@ -20,10 +20,6 @@
$('.justified-gallery').justifiedGallery();
}
if (!$('.columns .column-right-shadow').children().length) {
$('.columns .column-right-shadow').append($('.columns .column-right').children().clone());
}
if (typeof moment === 'function') {
$('.article-meta time').each(function() {
$(this).text(moment($(this).attr('datetime')).fromNow());