a_sram / Art-13 Simulation

// ==UserScript==
// @name         Art-13 Simulation
// @namespace    http://wykop.pl/
// @version      0.1
// @description  Art-13
// @author       a_sram
// @match        https://*.wykop.pl/*
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
  'use strict';

  $('a').click(function (event) {

    var href = $(this).attr('href');

    if (href.indexOf('wykop') == -1) {
      var rand = Math.floor((Math.random() * 10) + 1);

      if (rand >= 4) {
        var sure = confirm('Do you want to follow this link? It may contain copyrighted material which has not been licensed.');
        if (sure == true) {
          return true;
        }
        else {
          return false;
        }
      }
    }
    else {
      return true;
    }
  });

  $('.text').find('p').each(function (index, value) {
    var rand = Math.floor((Math.random() * 20) + 1);

    if (rand >= 15) {
      $(this).text('Content has violated the copyright rights of a third party and thus has been removed.');
      $(this).css('color', 'red');
    }
  });

  $('img').each(function (index, value) {
    var rand = Math.floor((Math.random() * 10) + 1);

    if ($(this).height() > 100 && rand >= 5) {
      $(this).attr('src', 'http://tubularinsights.com/wp-content/uploads/2008/03/1000-banned.jpg');
    }
  });

})();