panciAutoLoad

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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,
  });
}