Tieba Bypass Login

解除百度贴吧强制登录

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name				Tieba Bypass Login
// @name:zh-CN			Tieba Bypass Login
// @namespace			[email protected]
// @author				依然独特
// @description			解除百度贴吧强制登录
// @description:zh-CN	解除百度贴吧强制登录
// @version				0.0.4
// @run-at				document-start
// @require				https://greasyfork.org/scripts/18715-hooks/code/Hooks.js?version=661566
// @include				*://tieba.baidu.com/*
// @include				*://tiebac.baidu.com/*
// @include				*://*.tieba.baidu.com/*
// @match				*://tieba.baidu.com/*
// @match				*://tiebac.baidu.com/*
// @match				*://*.tieba.baidu.com/*
// @grant				unsafeWindow
// @license				CC-BY-4.0
// ==/UserScript==

"use strict";

(function() {
	let executed = false

	// We want to change user login state as soon as possible
	Hooks.get(unsafeWindow, "_", (...args) => {
		const [_target, _propertyName, _oldValue, _newValue] = args
		
		// Only on desktop site `PageData' will be defined
		if (!executed && unsafeWindow.PageData != null) {
			unsafeWindow.PageData.user.is_login = 1
			unsafeWindow.PageData.user.no_login_user_browse_switch = 0
			executed = true
		}

		return Hooks.Reply.get(args);
	})
})()