Created
May 8, 2024 08:32
-
-
Save kotobukid/1d1ca14f16acede325714148283bfdae to your computer and use it in GitHub Desktop.
WIXOSSのサイトにアクセスしたときに表示されるみまもりフィルターに、次回以降自動的に同意する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Giraffe Banisher | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-05-08 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.takaratomy.co.jp/products/wixoss/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=takaratomy.co.jp | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let filter_found = false; | |
try { | |
filter_found = document.getElementById('check_page').getElementsByTagName('h3')[0].innerText === 'みまもりフィルター'; | |
} catch { | |
console.log('extension fizzled'); | |
} | |
if (filter_found) { | |
const storage_key = 'ext__wx_age'; | |
const agree_past = localStorage.getItem(storage_key) === 'yes'; | |
const click_pass = () => { | |
const $wrapper = document.getElementsByClassName('btn_area'); | |
if ($wrapper.length > 0) { | |
const $links = $wrapper[0].getElementsByTagName('a'); | |
if ($links.length > 0) { | |
$links[0].click(); | |
} | |
} | |
}; | |
if (agree_past) { | |
click_pass(); | |
} else { | |
const agree = confirm('ここからは対象年齢(たいしょうねんれい)15歳(さい)以上(いじょう)の内容(ないよう)を含(ふく)みます。\nあなたは15歳(さい)以上(いじょう)ですか?'); | |
if (agree) { | |
localStorage.setItem(storage_key, 'yes'); | |
click_pass(); | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment