AnonAmp Script

Remove ad-links and clickbait from anonamp.com

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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 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;
    }
  } 
}