1 Star 0 Fork 0

恐咖兵糖 / www.ftls.xyz

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
blog-comments-mastodon.html 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
恐咖兵糖 提交于 2024-04-18 22:29 . pref: 增加注释 优化文件
<!-- 博客文章教程使用 -->
<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>
1
https://gitee.com/kkbt/www.ftls.xyz.git
git@gitee.com:kkbt/www.ftls.xyz.git
kkbt
www.ftls.xyz
www.ftls.xyz
master

搜索帮助