Created
June 20, 2022 02:14
-
-
Save kgtkr/bbe0c9fd57d0153b8b5e6dca3be20b68 to your computer and use it in GitHub Desktop.
Tweetdeck filter dm request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Tweetdeck filter dm request | |
// @namespace tweetdeck_filter_dm_request | |
// @version 0.0.1 | |
// @description tweetdeckでDMリクエストを非表示にする | |
// @author kgtkr | |
// @match https://tweetdeck.twitter.com/* | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
TD.services.TwitterConversation.prototype.originalFromJSONObject = | |
TD.services.TwitterConversation.prototype.fromJSONObject; | |
TD.services.TwitterConversation.prototype.fromJSONObject = function ( | |
...args | |
) { | |
this.trusted = args[0].trusted; | |
return this.originalFromJSONObject(...args); | |
}; | |
TD.services.TwitterClient.prototype.originalMakeTwitterCall = | |
TD.services.TwitterClient.prototype.makeTwitterCall; | |
TD.services.TwitterClient.prototype.makeTwitterCall = function (...args) { | |
if (args[0] === "https://api.twitter.com/1.1/dm/user_updates.json") { | |
const originalCallback = args[4]; | |
args[4] = (...xs) => { | |
xs[0] = xs[0].filter((x) => x.trusted); | |
return originalCallback(...xs); | |
}; | |
} | |
return this.originalMakeTwitterCall(...args); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment