panciAutoLoad

www.gssy.cc 动漫自动加载当前章节

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 panciAutoLoad
// @namespace Violentmonkey Scripts
// @match http://www.gssy.cc/*
// @grant none
// @description www.gssy.cc 动漫自动加载当前章节
// @version 0.0.1.20190214055623
// ==/UserScript==

var baseUrl = document.location.toString().match(/http:\/\/www.gssy.cc\/[0-9]+/);
var maxPage = 0;
var currentPage = 0;

var re = new RegExp("<img.+/>","g");

$(function(){
    console.log("ready");
	pageNumbers = $(".page-numbers");
	maxPage  = parseInt(pageNumbers[pageNumbers.length - 2].innerHTML);
	currentPage = parseInt($(".current")[0].innerText);
    getNextPage();
});

function insertImage(data){
  //console.log(data);
  plist = data.match(re);
  appstr = '';
  for(index = 2;index < plist.length; index++){
    appstr = appstr + plist[index];
  }
  $("#image_div>p:last").append("<p>当前加载 第" + currentPage + "页内容</p>");
  $("#image_div>p:last").append("<p>" + appstr + "</p>");
  $("#image_div>p:last").append("<p>完成加载 第" + currentPage + "页内容</p>");
  getNextPage();
}

function getNextPage(){
  currentPage++;
  if(currentPage > maxPage) {
    $("#image_div>p:last").append("<p>完成全部加载内容</p>");
    return;
  }
  targetUrl = baseUrl + '/' + currentPage;
  console.log("loading "+ targetUrl);
  $.ajax({
      url: targetUrl,
      data: {
      },
      type: 'GET',
      success: insertImage,
  });
}