// ==UserScript== // @name Dcard guest popup dismiss // @name:ZH-TW Dcard 訪客瀏覽腳本 // @namespace com.sherryyue.dcardguestmode // @version 0.1 // @description break the pop-block and scrolling restrict while Dcard not logged in. // @author SherryYue // @match *://*.dcard.tw/* // @contributionURL https://github.com/SherryYueChiu/card // @supportURL sherryyue.c@protonmail.com // @icon https://sherryyuechiu.github.io/card/images/logo/maskable_icon_x96.png // @grant none // @downloadURL none // ==/UserScript== (function () { 'use strict'; /** login reqquest popup * @type HTMLElement */ var $loginRequestPopup; /** if popup exsist, dismiss it. */ var loginPopupTraker = () => { $loginRequestPopup = document.querySelector(".__portal"); if ($loginRequestPopup) { breakRestriction(); } } /** dismiss the popup and break the scrolling restriction */ var breakRestriction = () => { // hide login reqquest popup $loginRequestPopup.remove(); // unlock scrolling restriction document.body.style.overflow = "auto"; } // detect every 2 seconds setInterval(loginPopupTraker, 2000); })();