wikifeet EU

Remove the annoying article 17 page that EU user see when clicking a picture.

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.

(I already have a user script manager, let me install it!)

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    	  wikifeet EU
// @description   Remove the annoying article 17 page that EU user see when clicking a picture.
// @version  	  1.0.5
// @author        Love4Arhc
// @namespace     https://greasyfork.org/en/users/903627
// @match         https://www.wikifeet.com/*
// @license       MIT License
// @compatible    firefox >=99
// ==/UserScript==

/* jshint esversion: 6 */

const urlParts = document.URL.split('/');
const buttons = document.getElementsByTagName('button');


function reWritePictureUrls() {

  const picDivs = document.getElementsByClassName('pic');
  if (picDivs.length > 0) {

    for (let i=0; i < picDivs.length; i++) {

      var pid = picDivs[i].children[1].innerText;
      if (pid === 'new') {
        pid = picDivs[i].children[2].innerText;  
      }

      picDivs[i].firstChild.removeAttribute('target');
      picDivs[i].firstChild.href = urlParts[3] + '#&gid=1&pid=' + pid;

    }

    if (document.cookie.length > 15) {
      buttons[3].addEventListener('click', reWritePictureUrls);
    }
    else {
      buttons[1].addEventListener('click', reWritePictureUrls);
    }
    
    buttons[2].addEventListener('click', reWritePictureUrls);
  }
}


function reWriteWallPictureUrls() {

  const wallThumbs = document.getElementsByClassName('thumb_wall');
  if (wallThumbs.length > 0) {

    for (let i=0; i < wallThumbs.length; i++) {
      
      let pid = wallThumbs[i].attributes.style.value.split('/')[3];
      
      if (typeof pid !== 'undefined') {
        
        pid.replace('.jpg)', '');
        
        wallThumbs[i].parentElement.removeAttribute('target');
        wallThumbs[i].parentElement.href = urlParts[3] + '#&gid=1&pid=' + pid;    
      }

    }

    document.addEventListener('scroll', reWriteWallPictureUrls);
  }
}

reWritePictureUrls();
reWriteWallPictureUrls();