lighter pepecine

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

Version vom 14.12.2016. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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