本文最后更新于 2024年5月8日 中午
上文提到
给Memos添加Twikoo评论
自定义脚本
把’.resource-wrapper’替换为’.memo-wrapper’
自定义样式
隐藏评论数
1
| .text-sm.text-gray-500.ml-1{display:none !important
|
- 2023.9.26更新提醒:适用于 memos 0.15.1版本以下
自定义脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| function addArtalkJS() { var memosArtalk = document.createElement("script"); memosArtalk.src = `https://unpkg.com/artalk/dist/Artalk.js`; var artakPos = document.getElementsByTagName("script")[0]; artakPos.parentNode.insertBefore(memosArtalk, artakPos); };
function startArtalk() { start = setInterval(function(){ var artalkDom = document.getElementById('Comments') || ''; var memoAt = document.querySelector('.memo-wrapper') || ''; var memoLoading = document.querySelector('.action-button-container') || ''; var memoLoadingA = document.querySelector('.action-button-container a') || ''; if(window.location.href.replace(/^.*\/(m)\/.*$/,'$1') == "m" && memoLoadingA){ memoLoading.innerHTML = "评论加载中……" } if(window.location.href.replace(/^.*\/(m)\/.*$/,'$1') == "m" && !artalkDom){ addArtalkJS() if(memoAt){ clearInterval(start) var cssLink = document.createElement("link"); cssLink.rel = "stylesheet"; cssLink.href = "https://unpkg.com/artalk/dist/Artalk.css"; document.head.appendChild(cssLink); memoAt.insertAdjacentHTML('afterend', '<div id="Comments"></div>'); setTimeout(function() { Artalk.init({ el: '#Comments', pageKey: location.pathname, pageTitle: document.title, server: 'https://artalk.loliko.cn', site: 'memos', darkMode: 'auto' }); Artalk.on('list-loaded', function() { memoLoading.innerHTML = '' startArtalk(); }); }, 1000); } } }, 1000) } startArtalk();
|
自定义样式
1 2 3
| a.time-text:after { content: ' 评论 💬 '; } .atk-main-editor { margin-top: 20px; }
|