Endless deviantart gallery pages

rt

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Endless deviantart gallery pages
// @namespace    https://www.topcl.net/
// @version      0.2
// @description  rt
// @author       vj
// @match        http://*.deviantart.com/gallery/*
// @match        http://*.deviantart.com/favourites/*
// @match        http://*.deviantart.com/prints/*
// @grant        none
// ==/UserScript==

var pg=1;

function loadPage(url)
{
	//debugger;
	pg++;
	console.log("loadPage " + pg + " - " + url);
	
	//load html
	var xhr=new XMLHttpRequest();
	xhr.open("GET",url,true);
	xhr.send(null);

	xhr.onload = function (e) {
		if (xhr.readyState === 4 && xhr.status === 200) {
			//parse html
			var ndoc=document.implementation.createHTMLDocument("");
			ndoc.body.innerHTML=xhr.response;

			//check result
			var rs=ndoc.getElementById("gmi-ResourceStream");
			if(!rs){console.log("Stop: gmi-ResourceStream not found");}
			
			//add to page
			document.getElementById("gmi-ResourceStream").innerHTML+=rs.innerHTML;

			//check next page
			var next=$(ndoc).find(".next>a").attr("href");
			if(!next)
			{
				console.log("Stop: not found .next>a href");
				return;
			}

			//go next page
			loadPage(next);
		}
	};
}


loadPage(document.getElementById("gmi-GPageButton").href);