Greasy Fork

Greasy Fork is available in English.

AcFun小助手

文章区:评论区域居中、文章内容始终显示、高亮楼主名字;

当前为 2018-01-04 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         AcFun小助手
// @namespace    https://github.com/maijz128
// @version      0.1.0
// @description  文章区:评论区域居中、文章内容始终显示、高亮楼主名字;
// @author       MaiJZ
// @match        *://*.acfun.cn/a/*
// @grant        none
// ==/UserScript==

const IS_DEBUG = false;
const v = {};

(function () {
    initVar();
    main();
})();

function initVar() {
    const repository = 'http://maijz.gitee.io/acfunhelper/public';
    const localhost = 'http://localhost:8080';
    const HOST = IS_DEBUG ? localhost : repository;

    v.Styles = [
        HOST + '/index.bundle.css'
    ];
    v.Scripts = [
        HOST + '/index.bundle.js'
    ];
}

function main() {
    loadStyles();
    loadScripts();
}

function loadStyles() {
    const elContainer = document.head;

    for (let index = 0; index < v.Styles.length; index++) {
        const styleURL = v.Styles[index];

        const elStyle = document.createElement('link');
        elStyle.setAttribute('href', styleURL);
        elStyle.setAttribute('rel', 'stylesheet');
        elStyle.setAttribute('type', 'text/css');

        elContainer.appendChild(elStyle);
    }
}

function loadScripts() {
    const CONTAINER_ID = 'script-container';
    const elContainer = document.createElement('div');
    elContainer.setAttribute('id', CONTAINER_ID);
    document.body.appendChild(elContainer);


    for (let index = 0; index < v.Scripts.length; index++) {
        const scriptURL = v.Scripts[index];

        const elScript = document.createElement('script');
        elScript.src = scriptURL;
        elContainer.appendChild(elScript);
    }
}