Created
November 5, 2020 15:37
-
-
Save saenai255/cfd41f7be584662d387a129228732489 to your computer and use it in GitHub Desktop.
instagram seen block
This file contains hidden or 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 Block Seen | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Blocks Instagram message seen | |
// @author Paul Cosma | |
// @match https://www.instagram.com/* | |
// @grant none | |
// ==/UserScript== | |
XMLHttpRequest.prototype.__open = XMLHttpRequest.prototype.open; | |
XMLHttpRequest.prototype.open = function(...args) { | |
const [_, url] = args; | |
if (url !== null) { | |
const bla = decodeURIComponent(url); | |
const urlMatches = url.match(/\/direct_v2\/web\/threads\/[0-9]*\/items\/[0-9]*\/seen/gi); | |
if (Array.isArray(urlMatches) && urlMatches.length === 1) { | |
console.error(`Seen request ${url} blocked.`); | |
return false; | |
} | |
} | |
return this.__open(...args); | |
} | |
document.addEventListener('DOMContentLoaded', function(){ | |
const popup = document.createElement('h1'); | |
popup.style.cssText = ` | |
position: fixed; | |
z-index: 99999; | |
top: min(75px, 10vh); | |
left: 10px; | |
background: lightgreen; | |
padding: 10px 30px 10px 30px; | |
font-weight: bold; | |
opacity: 75%; | |
`; | |
popup.textContent = 'SeenBlocker is ON'; | |
document.body.appendChild(popup); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment