Greasy Fork

Greasy Fork is available in English.

grim's wikia content warning auto-skip

Automatically skip Wikia's content warning disclaimer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        grim's wikia content warning auto-skip
// @namespace   http://greasyfork.icu/en/users/4367-d-p
// @description Automatically skip Wikia's content warning disclaimer
// @include     http*.wikia.com*/*
// @version     1.1
// @grant       none
// ==/UserScript==


// see:
// http://stackoverflow.com/questions/23783774/using-a-regular-expression-in-a-greasemonkey-include
// https://wiki.greasespot.net/Include_and_exclude_rules
// http://stackoverflow.com/questions/12897446/greasemonkey-wait-for-page-to-load-before-executing-code-techniques



// surround everything with the '/' to specify regex matching
// regex means http or https
// including any subdomain, including the domain wikia.com by itself. 
// subdomain can be any length with any characters, with a dot at the end. subdomain optional
// * in a regex match is not a typical wildcard. I need .* because the * in regex means that any character (.) appears 0 or more times.
// so in regex, 'https://example.com/xx-xx/Asset/*' means '/' appears 0 or more times
// outside of regex matching, like in greasemonkey's case, * means wildcard
// so 'https://example.com/xx-xx/Asset/*' means anything can appear after '/'
// at .com top level domain
// with anything proceeding afterwards

// So your https://example.com/xx-xx/Asset/* pattern would become:
// @include  /^https:\/\/example\.com\/[a-z]{2}\-[a-z]{2}\/Asset\/.*$/

// you can use either of these includes
// include     http*.wikia.com*/*
// include     /^https?://(.*\.)?wikia\.com/.*$/

// <button id="ContentWarningApprove" class="approve">I understand and I wish to continue</button>

// call script after the page loads
// unlike blogspot, wikia needs time to load because the buttons popup afterwards

window.addEventListener('load', function() {
    // your code here
	
	//document.getElementsByClassName('approve').click();
	// this does not work
	
	//document.getElementsByClassName('approve')[0].click();
	// this works. however, ID is preferred over class
	// for some reason getElementsByClassName doesn't work sometimes. maybe ajax is still trying to load?
	
	
	document.getElementById('ContentWarningApprove').click();
	// this works
	
}, false);