instaclear

Lightweight script that monitors your instagram-journey and kills annoying overlays at real-time mode. It let you save photos just using default context-menu.

31.07.2020 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         instaclear
// @namespace    sanyabeat.instaclear
// @version      1.6
// @description  Lightweight script that monitors your instagram-journey and kills annoying overlays at real-time mode. It let you save photos just using default context-menu.
// @author       sanyabeast <[email protected]>
// @match        https://www.instagram.com/
// @match        https://www.instagram.com/*
// @match        https://www.instagram.com/*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    console.log("%cinstacler works", "color: magenta")

    function trycatch ( cb ) {
        try { cb(); } catch ( err ) { console.warn( err ) }
    }

    function enable_hires(){
        trycatch ( ()=>{
            let processed_count = 0
            let image_els = document.querySelectorAll("[srcset]")
            for ( let i = 0; i < image_els.length; i++ ) {
                let img = image_els[i]
                if (!img.ic_processed){
                    let srcset = img.srcset.split(",")
                    let last_src_descriptor = srcset[0]
                    let last_src = last_src_descriptor.split(" ")[0]
                    img.src = last_src
                    console.log(last_src, "\n\n")
                    processed_count++
                    img.ic_processed = true
                }
            }

            if (processed_count > 0 ) console.log(`%cjust enabled hi-res for ${processed_count + 1} images`, "color: cyan")
        } )

        return true
    }

    function clear_instagram () {
        trycatch ( ()=>{
            let cleared_count = 0
            let o = document.querySelectorAll("div + div");
            for ( let i=0; i<o.length; i++ ){
                if (o[i].attributes.length === 1 && o[i].children.length === 0 && o[i].style.zIndex !== "-1") {
                    cleared_count++
                    o[i].style.zIndex = "-1"
                }
            }

            if (cleared_count > 0 ) console.log(`%cjust cleared ${cleared_count + 1} emptyboxes`, "color: orange")
        } )

        return false
    }

    let observer = new MutationObserver( e => setTimeout( o => enable_hires() && clear_instagram(), 250) );
    observer.observe( document.body, { attributes: true, childList: true, subtree: true } );
})();