AnonAmp Script

Remove ad-links and clickbait from anonamp.com

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name AnonAmp Script
// @namespace Amp Scripts 
// @match https://*.anonamp.com/*
// @grant none
// @version 1.0.1
// @description Remove ad-links and clickbait from anonamp.com
// ==/UserScript==

var tags = document.getElementsByTagName('img');
for (var i = 0; i < tags.length; i++) {
  var imageSrc = tags[i].src
      .replace('thumb/', 'src/')
      .replace('s.jpg', '.jpg')
      .replace('s.png', '.png')
      .replace('s.gif', '.gif');
  console.log('Replacing: ' + imageSrc);
  var anchor = tags[i].parentElement;
  while( anchor && anchor.tagName.toUpperCase()!="A" ) {
    console.log('Tag: ' + anchor.tagName);    
    anchor = anchor.parentElement;
  }
  if( anchor ) {
    console.log('Href: ' + anchor.href);
    if( anchor.href.indexOf('src.php?') > -1 ) {
      anchor.href = imageSrc;
    }
    if( imageSrc.endsWith('locked.gif')) {
      anchor.target = '_top';
    }
    if( anchor.href.indexOf('pic.php?') > -1 ) {
      anchor.href = imageSrc;
    }
  } 
}