Appinn comment

Display the comments from the Appinn forum on the bottom of the corresponding page on the main site.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Appinn comment
// @name:zh-CN   小众软件评论显示
// @namespace    hoothin
// @version      2024-06-08
// @description  Display the comments from the Appinn forum on the bottom of the corresponding page on the main site.
// @description:zh-CN  将小众软件论坛的评论内容显示在主站对应页面下部
// @author       hoothin
// @match        https://www.appinn.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        GM_xmlhttpRequest
// @connect      meta.appinn.net
// ==/UserScript==

(function() {
    'use strict';
    const commentLink = document.querySelector('a.wpdc-join-discussion-link');
    if (!commentLink) return;
    GM_xmlhttpRequest({
        url: commentLink.href,
        method: 'GET',
        onload: function(res) {
            try {
                let doc = document.implementation.createHTMLDocument('');
                doc.documentElement.innerHTML = res.response;
                let dataPreloaded = doc.getElementById('data-preloaded');
                if (!dataPreloaded) return;
                dataPreloaded = JSON.parse(JSON.parse(dataPreloaded.dataset.preloaded)["topic_" + commentLink.href.match(/\d+/)[0]]).post_stream.posts;
                let posts = document.createElement("ul");
                posts.style.maxHeight = '90vh';
                posts.style.overflow = 'auto';
                posts.style.margin = '0';
                let title = document.createElement("h3");
                title.innerText = "评论内容";
                document.querySelector('article').appendChild(title);
                document.querySelector('article').appendChild(posts);
                dataPreloaded.forEach(item => {
                    posts.innerHTML += `<li style='border-top: 1px solid #313131;'><p style='font-weight: bold;'>${item.display_username || item.username}</p>${item.cooked}</li>`;
                });
            } catch (e) {
            }
        }
    });
})();