代码拉取完成,页面将自动刷新
<!-- 博客文章教程使用 -->
<div class="toot" id="toot-container">
<!-- Toot content will be inserted here using JavaScript -->
</div>
<h2>Comments:</h2>
<div id="comments-container">
<!-- Comments will be inserted here using JavaScript -->
</div>
<div id="comment-info"></div>
<a href="/auth.html">Auth</a>
<div>
<textarea id="statusInput" rows="4" cols="50" placeholder="Enter your status..."></textarea>
<div><button id="submitBtn">Submit</button></div>
</div>
<!-- moment.js 或者 相对时间 Lately.js -->
<script type="text/javascript" src="/js/moment.js"></script>
<script type="text/javascript" src="/js/mastodon.js"></script>
<script>
// !!!IMPORTANT!!! Bot Mastodon access token ONLY read:statuses
const accessToken = "{{ .Get 1 | default .Site.Params.bot_token }}"; // 配置文件设置
// https://example.com/@tom/statuses/xxxx
const statusURL = "{{ .Get 0 }}"
function commentInfo(text) {
document.getElementById('comment-info').textContent = text;
console.log(text);
}
const bot = new MastodonBot(statusURL, accessToken)
// Login User Info
const myAccount = new MastodonUserManager(localStorage.getItem("MASTODON_URL"), localStorage.getItem("MASTODON_ACCESS_TOKEN"), localStorage.getItem("MASTODON_ACCOUNT_URL"));
// Fetch and display the toot and comments when the page loads
// moment : timeFmt
const comments = new MastodonComment(bot, myAccount, commentInfo, moment)
comments.init();
</script>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。