Perplexity.ai: Remove login requirement

Remove login requirement on Perplexity.ai. This includes all annoying overlays, cookie banner and Login features.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name             Perplexity.ai: Remove login requirement
// @name:de          Perplexity.ai: Login-Bedingung entfernen
// @name:en          Perplexity.ai: Remove login requirement
// @author           Maingron
// @namespace        https://maingron.com/
// @homepage         https://maingron.com/
// @supportURL       https://github.com/Maingron/random-stuff/issues
// @source           https://github.com/Maingron/random-stuff/blob/main/004%20Browser%20Scripts/Userscripts/Perplexity.ai%20-%20Remove%20login%20requirement.user.js
// @version          2026.05.4
// @description      Remove login requirement on Perplexity.ai. This includes all annoying overlays, cookie banner and Login features.
// @description:de   Login Bedingung auf Perpexity.ai entfernen. Dies entfernt alle nervigen Overlays, Cookie Banner und Login Features.
// @description:en   Remove login requirement on Perplexity.ai. This includes all annoying overlays, cookie banner and Login features.
// @icon             https://www.perplexity.ai/favicon.ico
// @icon             https://www.perplexity.ai/favicon.svg
// @copyright        2026 Maingron
// @created          2026-05-07
// @modified         2026-05-26
// @license          MIT
// @match            http*://www.perplexity.ai/*
// @match            http*://perplexity.ai/*
// @grant            GM_addStyle
// @tag              perplexity
// @tag              perplexity.ai
// @tag              Pop-Up
// OpenUserJS:       https://openuserjs.org/scripts/Maingron/Perplexity.ai_Remove_login_requirement
// Greasy Fork:      https://greasyfork.org/de/scripts/577012-perplexity-ai-remove-login-requirement
// ==/UserScript==




(function() {
	'use strict';
	console.log("[UserScript][Maingron][Perplexity.ai: Remove login requirement] Removing overlays and writing CSS Code to page");

	// Allow scrolling - Perplexity disables scrolling by preventDefault(e). We intercept and prevent preventDefault if wheel or scroll
	const originalPreventDefault = Event.prototype.preventDefault;
	Event.prototype.preventDefault = function () {
		if (this.type == "wheel" || this.type == "scroll") { } else {
			return originalPreventDefault.call(this);
		}
	};


	const elementsSelectors = [
		"html[lang][dir] body script#google-identity-services-script",
		"html[lang][dir] body #credential_picker_container iframe",
		"html[lang][dir] body #cookie-consent",
		"html[lang][dir] body div[data-type='portal']"
	];

	GM_addStyle(`
		${elementsSelectors.join(",")} {
			display: none !important;
			visibility: hidden !important;
			opacity: 0 !important;
			pointer-events: none !important;
			user-select: none !important;
		}
	`);

	window.addEventListener("load", function () {
		window.setTimeout(function () {
			document.querySelectorAll(elementsSelectors).forEach((item) => {
				item.remove();
			});
		}, 4400 + Math.random() * 2400); // Timeout value is slightly randomized to make it seem more organic
	});
})();