// ==UserScript== // @name 多瑙影院去广告 & 增强 // @namespace moe.jixun.dn-noad // @version 1.4.3 // @description 多瑙网站视频与网站广告去除,以及其他增强功能。 // @author Jixun Moe // @include http://*.dnvod.eu/* // @include https://*.dnvod.eu/* // @include http://*.duonao.tv/* // @include https://*.duonao.tv/* // @grant GM_info // @require https://greasyfork.org/scripts/2599/code/GM2_port.js?v184155 // @compatible Firefox Grease Monkey // @compatible Chrome Tamper Monkey // @compatible Opera Violent Monkey // @run-at document-start // @downloadURL none // ==/UserScript== const ads = `#msg_winw, .clickbg, .r-gg, #box, .bfq-r, [class^="ggw-"], .tgg, #myaudient2, .footerwhole, .gg, .custom-contaienr`; 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(); // 切换到下一剧集 } // 移除播放器 logo 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 = ''; } // Player AD removal. // 劫持播放器的广告参数 var bakConfig; if (w.PlayerConfig && w.PlayerConfig.desktopPlayer) { let p = JSON.parse(JSON.stringify(GM_info.version && w.PlayerConfig)); updateConfig(p); let config = cloneInto(p, w.PlayerConfig); Object.defineProperty(w, 'PlayerConfig', { value: config }); } 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 { margin: auto; text-align: center; } `; document.head.appendChild(style); // 删除广告元素 each.call(document.querySelectorAll(ads), remove); // 检测是否需要移除播放器 Logo if (w.ckstyle) { removePlayerLogo(); } // 检测是否需要实现播放下一集功能 if (w.playerstop) { exportFunction(playNextEp, unsafeWindow, { defineAs: "playerstop" }); } });