Greasy Fork

Greasy Fork is available in English.

Acfun Ad Helper

移动暂停广告并缩小至右下角,点击×关闭后不再显示

当前为 2020-09-05 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Acfun Ad Helper
// @namespace    http://tampermonkey.net/
// @icon         https://tx-free-imgs.acfun.cn/content/2020_4_5/1.5860178587515075E9.png
// @version      0.2
// @description  移动暂停广告并缩小至右下角,点击×关闭后不再显示
// @author       https://www.acfun.cn/u/12619631
// @match         *://www.acfun.cn/*
// @require      http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    // Your code here...

    let timer = setInterval(function () {
        console.log('Acfun ad helper searching...');
        if ($('.pause-display').length == 0) {
            console.log("Not find class 'pause-display'.");
        } else {
            move_pause_ad();
            close_pause_ad();
            window.clearInterval(timer);
            console.log('Ad was moved.')
        }
    }, 1000);

    $(document).ready(function () {
        window.clearInterval(timer);
    });
})();

function move_pause_ad() {
    let pause_ad = $('.pause-display')
    pause_ad.css({
        'position': 'absolute',
        'max-width': '15%',
        'min-width': '0',
        'bottom': '5%',
        'right': '1%'
    });
    return pause_ad;
}

function close_pause_ad() {
    $('.close-icon').click(function () {
        $('.pause-display').css('display', 'none');
    });
}