Steam: Bypass age confirmation prompts

Suppresses age confirmations on Steam store pages and community hubs

目前為 2016-06-15 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Steam: Bypass age confirmation prompts
// @namespace    steam
// @version      1.2
// @description  Suppresses age confirmations on Steam store pages and community hubs
// @author       lunboks
// @match        *://steamcommunity.com/app/*
// @match        *://store.steampowered.com/agecheck/app/*
// @match        *://store.steampowered.com/app/*/agecheck*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    "use strict";

    if (location.hostname === "store.steampowered.com") {
        // Set up long-lived cookies to bypass age verification
        var date = new Date();
        date.setUTCFullYear(date.getUTCFullYear() + 1);

        var cookieOptions = "; path=/; max-age=31536000; expires=" + date.toUTCString();

        // this bypasses the "mature content - continue/cancel" screen
        document.cookie = "mature_content=1" + cookieOptions;
        // this bypasses the "enter your date of birth" screen
        document.cookie = "birthtime=0" + cookieOptions; // 1970-01-01

        // Reload after making sure we're actually on a page with an age gate
        window.addEventListener("DOMContentLoaded", function () {
            if (document.getElementById("agegate_box") || document.getElementById("app_agegate")) {
                document.body.hidden = true;
                location.reload();
            }
        }, false);
    } else if (location.hostname === "steamcommunity.com") {
        // This bypasses the mature content overlay on community hubs.
        // Since the overlay is put up during page load, we don't have to reload here.
        var appID = location.pathname.match(/^\/app\/(\d+)/);

        if (appID !== null) {
            try {
                window.sessionStorage.setItem("age_gate_" + appID[1], "true");
            } catch (ignore) {}
        }
    }
})();