lighter pepecine

Enable viewing on remote backend instead of the slow embeded viewing + minor tweaks(WIP)

As of 14. 12. 2016. See the latest version.

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        lighter pepecine
// @namespace   nil
// @description Enable viewing on remote backend instead of the slow embeded viewing + minor tweaks(WIP)
// @include     http://pepecine.net/episodio-online/*
// @version     0.1
// @grant       none
// ==/UserScript==

function delete_social() {
  // delete social divs
  var ids = ["fblikebg", "fblikepop", "social"];
  ids.forEach(function delnodebyid(id) {
    node = document.getElementById(id);
    if (!node) return;
    node.parentNode.removeChild(node);
  });
}

function disable_embededviewing() {
  var links2embeded_vid = Array.filter(document.getElementsByTagName('a'), function is_link2embededvid(elt) {
    //if (location.href.indexOf(elt.href) !== 0) return false;
    if (elt.rel !== "nofollow") return false;
    if (elt.dataset.bind.indexOf("click: renderTab.bind(") !== 0) return false;
    return true;
  });
  //console.log("nb: " + links2embeded_vid.length);
  links2embeded_vid.forEach(function makeDirectLink(a, i){
    var bind = a.dataset.bind;
    var dest_url = bind.substr(bind.indexOf("'") + 1);
    dest_url = dest_url.substr(0, dest_url.indexOf("'"));
    a.href = dest_url;
    delete a.dataset.bind;
    a.target = "_blank";
    a.addEventListener('click', function click(e) {
      e.preventDefault();
      location.href = this.href;
    }, false);
  });
  
      
  var imgs = Array.filter(document.getElementsByTagName("img"), function has_datasetbind() {
    if (img.dataset.bind.length > 0) return true;
    return false;
  });
  console.log("nb img:" + imgs.length);
  imgs.forEach(function delnode(node) {
    node.parentNode.removeChild(node);
  });
}

function init_lighter_pepe() {
  delete_social();
  disable_embededviewing();
}
 
document.addEventListener('DOMContentLoaded', init_lighter_pepe);