🏠 返回首頁 

百度百科去广告,秒懂百科禁止自动播放

百度百科优化


Install this script?
// ==UserScript==
// @name         百度百科去广告,秒懂百科禁止自动播放
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  百度百科优化
// @author       [email protected]
// @match        https://baike.baidu.com/item/*
// @run-at       document-start
// @icon         none
// @grant        none
// @license      MIT
// ==/UserScript==
function buildStyle(arr) {
var ret = '<style>';
arr.forEach(a => { ret += a + ' { display: none!important; }' });
return ret + '</style>';
}
const adsList = [".navbar-bg-top .appdownload", ".unionAd .union-content", ".after-content", ".header .topA", "#side-share", "#J-declare-wrap"];
const baikeVideoId = "sl-player-el-video";
const styleInsert = buildStyle(adsList);
(function() {
'use strict';
(document.head || document.documentElement).insertAdjacentHTML('beforeend', styleInsert);
function tryPausingVideo(videoEle) {
videoEle.pause();
!videoEle.paused && setTimeout(tryPausingVideo, 10, videoEle);
}
window.onload = function() {
tryPausingVideo(document.getElementById(baikeVideoId));
}
})();