Greasy Fork is available in English.

TweetDeck 延命

for old tweetdeck

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        TweetDeck 延命
// @namespace   https://rinsuki.net
// @match       https://tweetdeck.twitter.com/*
// @version     1.0.1
// @author      -
// @description for old tweetdeck
// @run-at      document-start
// ==/UserScript==

function hook() {
  const xp = XMLHttpRequest.prototype
  const config = Object.getOwnPropertyDescriptor(xp, "responseText")
  let selfDestructTimer
  const myConfig = {
    ...config,
    get() {
      const orig = config.get.bind(this)()
      if (this.responseURL.startsWith("https://api.twitter.com/1.1/help/settings.json")) {
        const obj = JSON.parse(orig)
        console.info("original settings", obj)
        obj.config.tweetdeck_graphql_login = {value: true}
        const newResponseText = JSON.stringify(obj)
       console.info("feature flag hooked", newResponseText)
        if (selfDestructTimer != null) clearTimeout(selfDestructTimer)
        selfDestructTimer = setTimeout(() => {
          if (Object.getOwnPropertyDescriptor(xp, "responseText").get === myConfig.get) {
            console.info("it seems getter is not overrided, so hook will self-destruct...")
            Object.defineProperty(xp, "responseText", config)
          }
        }, 1000)
        return newResponseText
      }
      console.info("unrelated request...")
      return orig
    }
  }
  Object.defineProperty(xp, "responseText", myConfig)
}

if ("wrappedJSObject" in window) {
  console.info("hook for firefox")
  window.wrappedJSObject.eval(`(${hook.toString().replace(" hook", "")})()`)
} else {
  console.info("hook for chromium")
  hook()
}