Simple instagram Images

Simple userscript to open instagram images in another tab.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Simple instagram Images
// @namespace    http://tampermonkey.net/
// @version      2024-10-18
// @description  Simple userscript to open instagram images in another tab.
// @author       pe-dro
// @match        *://*.instagram.com/*
// @source       https://github.com/pe-dro/simple-instagram-images/
// @supportURL   https://github.com/pe-dro/simple-instagram-images/
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license
// ==/UserScript==

(function() {
    'use strict';

function removeElements() {
    const elements = document.querySelectorAll('._aagw');
    elements.forEach(el => el.remove());
}

function makeImagesClickable() {
    const divs = document.querySelectorAll('._aagv');
    divs.forEach(div => {
        const imgs = div.querySelectorAll('img');
        imgs.forEach(img => {
            const link = img.src;
            img.style.cursor = 'pointer';
            img.addEventListener('click', () => {
                window.open(link, '_blank');
            });
        });
    });
}


setInterval(() => {
    removeElements();
    makeImagesClickable();
}, 1000); 
})();