Prevent Zoom Pro Ads and Success Hash

Prevents the #success Hash on Zoom join links to allow sharing the link with others and prevents Zoom Pro ads from appearing after the button is clicked.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Prevent Zoom Pro Ads and Success Hash
// @namespace   https://github.com/DenverCoder1
// @version     0.0.4
// @description Prevents the #success Hash on Zoom join links to allow sharing the link with others and prevents Zoom Pro ads from appearing after the button is clicked.
// @match       https://*.zoom.us/j/*
// @match       https://*.zoom.us/s/*
// @match       https://*.zoom.us/postattendee
// @grant       none
// @author      Jonah Lawrence (DenverCoder1)
// @license     MIT
// ==/UserScript==

/* jshint esversion: 8 */

/**
 * Redirect success links containing the #success hash and "/s/" to the same link at /j/ without the hash.
 */
function redirectSuccessToJoin() {
    history.replaceState(null, null, window.location.href.replace("/s/", "/j/").replace(/#.*?$/, ""));
}

// if window contains a /postattendee (zoom ad), redirect to last join url or default url
if (window.location.href.includes("/postattendee")) {
    const lastJoinUrl = localStorage.getItem("lastJoinUrl");
    if (lastJoinUrl) {
        window.location.href = lastJoinUrl;
    } else {
        window.history.back();
        // fallback to default url if can't go back
        window.location.href = "https://google.com";
    }
}
// if on a success link, redirect to join link
else if (window.location.href.includes("/s/")) {
    redirectSuccessToJoin();
}

// check for the url to change, and turn it back into the /j/ url
window.addEventListener("hashchange", redirectSuccessToJoin);
// set last join link to redirect back to later
window.localStorage.setItem("lastJoinUrl", window.location.href);