💄 Fixed the waline reaction icon pixes in mobile driver.

This commit is contained in:
凡梦星尘 2022-10-27 08:54:54 +08:00
parent 525c8a7cf5
commit 9160a33053
3 changed files with 15 additions and 33 deletions

View File

@ -3,15 +3,12 @@
display: none
}
@include mobile() {
.wl-reaction-img {
@include mobile() {
width: 24px;
height: 24px;
width: 32px;
height: 32px;
}
}
.wl-reaction-votes {
@include mobile() {
padding: 0.85px;
font-weight: 500;
font-size: .65em;

View File

@ -33,7 +33,7 @@ NexT.plugins.comments.waline = function() {
NexT.utils.lazyLoadComponent(element, function () {
NexT.utils.getScript(waline_js, function(){
const waline_css = NexT.utils.getCDNResource(NexT.CONFIG.waline.css);
NexT.utils.getStyle(waline_css);
NexT.utils.getStyle(waline_css, 'before');
Waline.init({
locale,

View File

@ -515,13 +515,19 @@ NexT.utils = {
});
},
getStyle: function (src, parent) {
getStyle: function (src, position='after', parent) {
const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', src);
(parent || document.head).appendChild(link);
const head = (parent || document.head);
console.log(head)
if (position === 'before') {
head.prepend(link);
} else {
head.append(link);
}
},
getScript: function (src, options = {}, legacyCondition) {
@ -595,26 +601,5 @@ NexT.utils = {
});
intersectionObserver.observe(element);
});
},
loadComments: function (selector, legacyCallback) {
if (legacyCallback) {
return this.loadComments(selector).then(legacyCallback);
}
return new Promise(resolve => {
const element = document.querySelector(selector);
if (!element) {
resolve();
return;
}
const intersectionObserver = new IntersectionObserver((entries, observer) => {
const entry = entries[0];
if (!entry.isIntersecting) return;
resolve();
observer.disconnect();
});
intersectionObserver.observe(element);
});
}
};