Skip to content

Instantly share code, notes, and snippets.

@knowlet
Created June 11, 2019 06:28
Show Gist options
  • Save knowlet/1a3bb5e00fa47cca68e6017fbae00469 to your computer and use it in GitHub Desktop.
Save knowlet/1a3bb5e00fa47cca68e6017fbae00469 to your computer and use it in GitHub Desktop.
動漫伊甸看看
// ==UserScript==
// @name 動漫伊甸看看
// @namespace https://knwolet.me
// @version 0.1
// @description try to take over the world!
// @author knowlet
// @match http://dmeden.net/comichtml/*/1.html*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
const pageNum = Number(document.querySelector('a+a+b').textContent.split('/')[1].trim());
const curImg = document.querySelector('img[id^=img]');
var sNextImgName = document.getElementById("hdNextImg").value;
sNextImgName = getDomain(parseInt(cuDomainNo)) + unsuan(sNextImgName);
const pages = [...Array(pageNum).keys()].slice(2);
Promise.all(pages.map(idx => fetch(location.href.replace(/(\d{1,3})(\.html)/, `${idx}$2`))
.then(res => res.text())
.then(text => {
const src = getDomain(parseInt(0)) + unsuan(text.match(/value=\"([a-z]{100,200})\"/)[1]);
const img = new Image();
img.src = src;
return img;
}))).then(img_list => img_list.forEach(elm => dvMsg.appendChild(elm)))
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment