Instagram Close Fix

work around, for the instagram bug to select elements when closing the post

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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            Instagram Close Fix
// @namespace       https://greasyfork.org/users/821661
// @description     work around, for the instagram bug to select elements when closing the post
// @match           https://www.instagram.com/*
// @version         1.6
// @author          hdyzen
// @license         MIT
// ==/UserScript==

(function () {
	'use strict';

	const events = ['pointerdown', 'pointerup'];
	events.forEach((event) => addEvent(event));

	function addEvent(event) {
		document.addEventListener(event, (e) => {
			if (!e.target.closest('.x1qjc9v5.x9f619.x78zum5.xdt5ytf.x1iyjqo2.xl56j7k')) return;
			e.preventDefault();
			e.stopPropagation();
			document.querySelector('[role="button"]:has([points="20.643 3.357 12 12 3.353 20.647"])').click();
		});
	}
})();