Raw Source
Banale / Hdblog remove ads

// ==UserScript==
// @author Banale
// @exclude 
// @name     Hdblog remove ads
// @description This script remove the ADS on hdblog.it/hdmotori.it!
// @copyright 2018, Banale (https://openuserjs.org/users/Banale)
// @license MIT
// @version  1.0.0
// @include http://*hdblog.it/*
// @include https://*hdblog.it/*
// @include http://*hdmotori.it/*
// @include https://*hdmotori.it/*

// ==/UserScript==

/*=======================================================
  Script
======================================================*/

(function (window) {
  'use strict';

  Element.prototype.remove = function () {
    this.parentElement.removeChild(this);
  };
  NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
    for (var i = this.length - 1; i >= 0; i--) {
      if (this[i] && this[i].parentElement) {
        this[i].parentElement.removeChild(this[i]);
      }
    }
  };

  var elementToRemove = [
    'banner1_720',
    'banner3_300600',
    'banner_square1',
    'banner_square2',
    'banner_square3',
    'box_highlight_hot',
    'gad728x90',
    'social_buttons',
    'gad300x250'
  ];

  for (var i = 0; i < elementToRemove.length; i++) {
    if (document.getElementById(elementToRemove[i])) {
      document.getElementById(elementToRemove[i]).remove();
    }

    if (document.getElementsByClassName(elementToRemove[i])) {
      document.getElementsByClassName(elementToRemove[i]).remove();
    }
  }

  setTimeout(function () {
    document.getElementsByTagName('body')[0].style.backgroundImage = '';
    document.getElementsByTagName('body')[0].style.paddingTop = '0px';
  }, 3000);

})(window);