Greasy Fork is available in English.

多瑙影院去广告 & 增强

多瑙网站视频与网站广告去除,以及其他增强功能。

נכון ליום 20-03-2017. ראה הגרסה האחרונה.

// ==UserScript==
// @name         多瑙影院去广告 & 增强
// @namespace    moe.jixun.dn-noad
// @version      1.3.1
// @license MIT
// @description  多瑙网站视频与网站广告去除,以及其他增强功能。
// @author       Jixun Moe<https://jixun.moe/>
// @include      http://*.dnvod.eu/*
// @include      https://*.dnvod.eu/*
// @include      http://*.duonao.tv/*
// @include      https://*.duonao.tv/*
// @grant        GM_info
// @run-at       document-start
// ==/UserScript==

// 再内嵌我脚本到你 Chrome 插件,
// 不仅不给 Credit 还混淆以后别指望我更新了。
// 切用且珍惜。

var w = unsafeWindow;
var each = [].forEach;

function remove (el) {
    if (el && el.parentNode) el.parentNode.removeChild(el);
}

function playNextEp () {
    let query = location.search.replace(/&.+/, '');
    let currentEp = document.querySelector('.bfan-n>a[href*="' + query + '"]');
    if (!currentEp) return ;

    let nextEp = currentEp.parentNode.parentNode.nextElementSibling;
    if (!nextEp) return ;

    nextEp = nextEp.querySelector('a');
    if (nextEp) nextEp.click();
}

function removePlayerLogo () {
    let ckstyle = w.ckstyle();
    ckstyle.logo = 'null';
    ckstyle.advmarquee = '';
    w.ckstyle = exportFunction(function () { return ckstyle; }, w);
}

function updateConfig (config) {
    let p = GM_info.version && config.desktopPlayer;
    p.l = p.r = p.d = p.u = p.pub_link = p.pub_surl = p.t = p.te = '';
    p.e = 6;

    let q = GM_info.version && config.mobilePlayer;
    q.sl = q.sr = q.ste = '';
}

const ads = '#msg_winw, .clickbg, .r-gg, #box, .bfq-r, [class^="ggw-"], .tgg, #myaudient2, .footerwhole, .gg, .custom-contaienr';

// Player AD removal.
var bakConfig;
if (w.PlayerConfig && w.PlayerConfig.desktopPlayer) {
    let p = JSON.parse(JSON.stringify(GM_info.version && w.PlayerConfig));
    updateConfig(p);
    cloneInto(p, w.PlayerConfig);
} else {
    Object.defineProperty(w, 'PlayerConfig', {
        get: exportFunction(function () { return bakConfig; }, w),
        set: exportFunction(function (config) {
            bakConfig = config;
            updateConfig(bakConfig);
            console.info(bakConfig);
        }, w)
    });
}

addEventListener('DOMContentLoaded', function() {
    'use strict';

    var style = document.createElement('style');
    style.textContent = `
${ads} { display: none !important; }
.bfq { background: black; }
.bfq-l { width: calc(100% - 20px); }
#video > #a1 { text-align: center; }
.bx-${GM_info.name} { width: 100%; }
`;
    document.head.appendChild(style);

    // delete all.
    each.call(document.querySelectorAll(ads), remove);

    // Remove player logo
    if (w.ckstyle) {
        removePlayerLogo();
    }

    // Auto play next ep.
    if (w.playerstop) {
        exportFunction(playNextEp, unsafeWindow, { defineAs: "playerstop" });
    }
});