// ==UserScript== // @name grim's wikia content warning auto-skip // @namespace https://greasyfork.org/en/users/4367-d-p // @description Automatically skip Wikia's content warning disclaimer // @include http*.wikia.com/* // @version 1.2 // @grant none // @downloadURL 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/.*$/ // // 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);