Greasy Fork

Greasy Fork is available in English.

跳过优酷、腾讯和爱奇艺视频开头广告

try to take over the world!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         跳过优酷、腾讯和爱奇艺视频开头广告
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  try to take over the world!
// @author       zhengmingliang
// @match        *://*.v.qq.com/*
// @match        *://*.v.youku.com/*
// @match        *://*.iqiyi.com/*
// @grant        https://github.com/small-rose/skip-video-ad/blob/master/skip-ad.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

   // 腾讯、优酷和爱奇艺跳过广告
var url = window.location.href;
if(new RegExp("v.qq.com").test(url)) {
	window.setInterval(function (){
        let time = document.querySelectorAll(".txp_ad video");
		if(time.length) {
			for(let i = 0; i<time.length; i++){
				time[i].currentTime = 110
			}
		}
    }, 1000);
}else if(new RegExp("v.youku.com").test(url)) {
	var timerTask = window.setInterval(function (){
		//$(".h5-ext-layer").find("div").remove();$(".control-play-icon").click()
		var oDiv = document.querySelectorAll(".h5-ext-layer div");
		if(oDiv && oDiv.length > 0){
			console.log(oDiv.length);
			Array.from(oDiv).forEach(i => i.remove());
			console.log("成功移除元素:.h5-ext-layer div")
			var oIcon = document.getElementsByClassName("control-play-icon");
			if(oIcon && oIcon.length>0) oIcon[0].click();
			console.log("成功点击:.control-play-icon");
			window.clearInterval(timerTask);
		}else{
			console.log(".h5-ext-layer div 尚未加载!!!")
		}
	}, 1000);
} else if(new RegExp("iqiyi.com").test(url)) {
	callIqyTask();
	var itemTask = window.setInterval(function(){
		var oTime = document.querySelectorAll(".cd-time");
		if(oTime && oTime.length>0 && parseInt(oTime[0].innerText) > 1) {
			console.log('==========================================' + oTime[0].innerText);
			callIqyTask();
			//window.clearInterval(itemTask);
		}else{
			console.log('================== 大王叫我来巡山,我把人间转一转 ========================' + (oTime[0] && oTime[0].innerText ? oTime[0].innerText : ''));
		}
	}, 1000)
}

function callIqyTask() {
	console.log('callIqyTask...')
	var iqyTask = window.setInterval(function (){
		//$(".skippable-after").click()
		var oDiv = document.querySelectorAll(".skippable-after");
		if(oDiv && oDiv.length > 0){
			console.log(oDiv.length);
			oDiv[0].click();
			console.log("成功点击 .skippable-after");
			let oTime = document.querySelectorAll(".cd-time");
			if(oTime && oTime.length>0 && parseInt(oTime[0].innerText) > 1) { oTime[0].innerText=1 }
			window.clearInterval(iqyTask);
		}else{
			console.log(".skippable-after 尚未加载!!!")
		}
	}, 1000);
}
})();