Remove message and popup. Unlock all links on the page.
当前为
// ==UserScript==
// @name Instagram - browse not logged
// @name:fr Instagram - naviguer non-identifié
// @namespace https://github.com/Procyon-b
// @version 0.2.2
// @description Remove message and popup. Unlock all links on the page.
// @description:fr Retire les message et dialogue d'inscription. Débloque tous les liens de la page.
// @author Achernar
// @match https://www.instagram.com/*
// @grant none
// ==/UserScript==
(function() {
"use strict";
// find newly added links
var obs=new MutationObserver(function(muts){
for (let mut of muts) {
for (let n of mut.addedNodes) {
if (n.classList.contains('Nnq7C')) fixLinks(n);
}
}
});
obs.observe(document.body, {attributes: false, childList: true, subtree: true});
function openLink(ev) {
this.cloneNode(false).dispatchEvent(new MouseEvent('click',ev));
}
function fixLinks(r) {
(r || document.body).querySelectorAll(':scope a[href^="/"]').forEach(function(e){
if (!e.sclk) {
e.sclk=true;
if (!e.href.endsWith('/related_profiles/')) e.addEventListener('click',openLink);
}
});
}
// fix links already on page
setTimeout(fixLinks,200);
setTimeout(fixLinks,2000);
// page lazy to load?
setTimeout(fixLinks,10000);
setTimeout(fixLinks,20000);
// hide message & popup
var st=document.createElement("style");
st.textContent='.N9d2H[style="width: 100%;"][class*=" "] {display: none;} body[style*="overflow"] {overflow: initial !important;} body[style*="overflow"] > div._Yhr4[role="presentation"] {display: none;}@keyframes hidestart{from {width: 0;} to {width: ;} }body>div._Yhr4[role="presentation"] {animation-name: hidestart;animation-timing-function: step-end;animation-duration: 1s;}';
document.head.appendChild(st);
})();