From 9160a330535ed57c2c899595a151307decdc045f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Thu, 27 Oct 2022 08:54:54 +0800 Subject: [PATCH] :lipstick: Fixed the waline reaction icon pixes in mobile driver. --- .../components/third-party/waline.scss | 15 ++++----- assets/js/third-party/comments/waline.js | 2 +- assets/js/utils.js | 31 +++++-------------- 3 files changed, 15 insertions(+), 33 deletions(-) diff --git a/assets/css/_common/components/third-party/waline.scss b/assets/css/_common/components/third-party/waline.scss index 9d459f9..648c450 100644 --- a/assets/css/_common/components/third-party/waline.scss +++ b/assets/css/_common/components/third-party/waline.scss @@ -2,16 +2,13 @@ .wl-actions>button:nth-child(3) { display: none } - - .wl-reaction-img { - @include mobile() { - width: 24px; - height: 24px; + + @include mobile() { + .wl-reaction-img { + width: 32px; + height: 32px; } - } - - .wl-reaction-votes { - @include mobile() { + .wl-reaction-votes { padding: 0.85px; font-weight: 500; font-size: .65em; diff --git a/assets/js/third-party/comments/waline.js b/assets/js/third-party/comments/waline.js index 2766f5e..d5fc383 100644 --- a/assets/js/third-party/comments/waline.js +++ b/assets/js/third-party/comments/waline.js @@ -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, diff --git a/assets/js/utils.js b/assets/js/utils.js index 823d672..31b548d 100644 --- a/assets/js/utils.js +++ b/assets/js/utils.js @@ -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); - }); } }; \ No newline at end of file