Javlib(图书馆) 净化

屏蔽广告/优化打开链接

As of 20. 01. 2021. 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 or Violentmonkey 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==
// @icon         http://www.javlib.com/favicon.ico
// @name         Javlib(图书馆) 净化
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  屏蔽广告/优化打开链接
// @author       Avral
// @match        *://*.com/*
// @match        *://javlib.com/*
// @match        *://zlibz.com/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function () {
  function enumdel(arrs){
	$.each(arrs, function(index, a){
	  a.remove();
	});
  }
  function init(){
	if (document.title.indexOf("JAVLibrary") == -1)return;
	console.log("Initing...");
	/*var $videoimages = null;
	document.onselect = function(){}
	document.onclick = function(){}
	document.onmousedown = function(){}
	document.onmouseup = function(){}
	document.write = function(){}
	document.writeln = function(){}*/
	window.open = function(){};

	enumdel($("[id^='topbanner'"));
	enumdel($("[id^='sidebanner'"));
	enumdel($("[id^='middlebanner'"));
	enumdel($("[id^='bottombanner'"));
	$("table.comment a[href*='redirect.php?url']").each(function(index, a){
	  var origin = location.origin;
	  a.href = decodeURIComponent(a.href.replace(origin+"/cn/redirect.php?url=",""));
	  $.ajax({
		url: a.href,
		type: 'GET',
		dataType: "jsonp",
		complete: (response)=>{
		  if(response.status==200){
			a.innerHTML = "(有效)"+a.innerHTML;
			return;
		  }
		  a.innerHTML = "(已失效)"+a.innerHTML;
		}
	  });
	});
	$("div.videos div.id").each(function(index, a){
	  $.ajax({
		url:"http://127.0.0.1:8999/" + a.innerHTML,
		type: "POST",
		data:{},
		success: function (result) {
		  a.innerHTML += result;
		}
	  });
	});
	$("div#video_id td.text").each(function(index, a){
	  $.ajax({
		url:"http://127.0.0.1:8999/" + a.innerHTML,
		type: "POST",
		data:{},
		success: function (result) {
		  a.innerHTML += result;
		}
	  });
	});
  }
  /*$(document).ready(function(){
	init();
  });*/
  init();
}) ();