Skip to content

Instantly share code, notes, and snippets.

@adryd325
Created December 6, 2023 03:55
Show Gist options
  • Save adryd325/14285bc8db06adcd0ccf6be999a46243 to your computer and use it in GitHub Desktop.
Save adryd325/14285bc8db06adcd0ccf6be999a46243 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Feature Switches
// @namespace Violentmonkey Scripts
// @version 0.1
// @description Feature Switches
// @author adryd
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
function initialStatePatcher() {
let initialState = {}
Object.defineProperty(window, "__INITIAL_STATE__", {
set: function set(value) {
initialState = value
initialState.featureSwitch.debug = Object.assign({}, value.featureSwitch.user.config);
},
get: function get() {
return initialState
},
configurable: true
})
}
const script = document.createElement("script")
script.text = "(" + initialStatePatcher.toString()+")()"
document.documentElement.appendChild(script);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment