Reddit Mobile Banner Kill

Removes the banner prompting to open reddit in the mobile app. This script only does anything on mobile browsers that support Tampermonkey

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Reddit Mobile Banner Kill
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  Removes the banner prompting to open reddit in the mobile app. This script only does anything on mobile browsers that support Tampermonkey
// @author       Zoidy
// @license      MIT
// @match        *://*.reddit.com/*
// @match        *://reddit.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @require      https://code.jquery.com/jquery-3.4.1.slim.min.js
// @grant        none
// ==/UserScript==

(function() {
    console.log("Reddit mobile app banner kill loaded!");

    //Top button on homepage
    $(".TopNav__useAppButton").hide();
    $("#get-app").hide();
    $("li.TopNav__promoButton").hide();

    var id = setInterval(function() {
        //View in app or continue in browser (version A)
        $("button.XPromoPopupRpl__actionButton:contains('Continue')").click(); //click the continue button. Should hide banner for the rest of the session
        $("div.XPromoPopupRpl").parent().hide();                               //Hide the banner in case clicking continue doesn't work
        $("div.XPromoBottomBar").hide();                                       //hide the other 'open in app' banner
        $("body").removeClass("scroll-disabled");

        //View in app or continue in browser (version B - a different popup appears sometimes)
        try{
            $("#secondary-button",
				$("xpromo-bottom-sheet",
					$("xpromo-app-selector",
						$("shreddit-async-loader",
							$("shreddit-experience-tree.theme-beta")[0].shadowRoot
						)[0].shadowRoot
					)[0].shadowRoot
				)[0].shadowRoot
            ).click();
        }catch(e){}

        //View in app or continue in browser (version B)
        try{
            $("#secondary-button",
				$("xpromo-bottom-sheet",
					$("xpromo-app-selector",
						$("shreddit-async-loader",
							$("shreddit-experience-tree.theme-beta")[0].shadowRoot
						)[0].shadowRoot
					)[0].shadowRoot
				)[0]
             ).click();
        }catch(e){}

        //See Reddit in... (new version C)
        try{
            $('button#secondary-button',
				$('xpromo-app-selector',
					$('shreddit-async-loader[paint-group="xpromo"][bundlename="app_selector"]')[0].shadowRoot
				)[0].shadowRoot
             ).click()
        }catch(e){}

        //Top button on homepage. hide again, they sometimes reappear
        $(".TopNav__useAppButton").hide();
        $("#get-app").hide();

        //Top button on child pages
        $("shreddit-async-loader[bundlename='top_button'][paint-group='xpromo']").hide();

        //"This Page looks better in the app"
        try{
            $("xpromo-bottom-bar",
				$("shreddit-async-loader[bundlename='bottom_bar_xpromo']")[0].shadowRoot
			).hide();
        }catch(e){}

        //"View Reddit in app bottom banner"
        try{
            $("#xpromo-bottom-sheet button").click();
        }catch(e){}
    }, 200);

    //keep the hiding code running for a while since things reappear.
    setTimeout(function(){
        clearInterval(id);
        console.log("Reddit mobile app banner kill ended!");
    },7000);
})();