mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-10 18:40:30 +08:00
v1.0
This commit is contained in:
45
app/src/main/assets/h.js
Normal file
45
app/src/main/assets/h.js
Normal file
@@ -0,0 +1,45 @@
|
||||
javascript:
|
||||
if (typeof (loaded) == "undefined"){
|
||||
var loaded = true;
|
||||
function scanChapters(chapter){
|
||||
var chapterList = chapter.getElementsByClassName("table-all")[0].getElementsByTagName("a");
|
||||
var chapterArr = Array();
|
||||
for(var i = 0; i < chapterList.length; i++){
|
||||
chapterArr.push(JSON.constructor());
|
||||
chapterArr[i]["name"] = chapterList[i].title;
|
||||
chapterArr[i]["url"] = chapterList[i].href;
|
||||
}
|
||||
return chapterArr;
|
||||
}
|
||||
function modify(){
|
||||
var url = location.href;
|
||||
if(url.indexOf("/chapter/")>0){
|
||||
var imglist = document.getElementsByClassName("container-fluid comicContent")[0].getElementsByTagName("li");
|
||||
var nextChapter = document.getElementsByClassName("comicContent-next")[0].getElementsByTagName("a")[0].href;
|
||||
var prevChapter = document.getElementsByClassName("comicContent-prev")[1].getElementsByTagName("a")[0].href;
|
||||
if(nextChapter == location.href) nextChapter = "null";
|
||||
if(prevChapter == location.href) prevChapter = "null";
|
||||
var liststr = document.title.split(" - ")[1] + " " + location.href.substring(location.href.lastIndexOf("/")+1) + "\n" + nextChapter + "\n" + prevChapter;
|
||||
for(var i = 0; i < imglist.length; i++) liststr += "\n" + imglist[i].getElementsByTagName("img")[0].dataset.src;
|
||||
GM.loadChapter(liststr);
|
||||
}else {
|
||||
var json = Array();
|
||||
var chapters = document.getElementsByClassName("upLoop")[0].children;
|
||||
var newObj = null;
|
||||
for(var i = 0; i < chapters.length; i++) {
|
||||
if(i % 2) {
|
||||
newObj["chapters"] = scanChapters(chapters[i]);
|
||||
json.push(newObj);
|
||||
newObj = null;
|
||||
}
|
||||
else {
|
||||
newObj = JSON.constructor();
|
||||
newObj["name"] = chapters[i].innerText;
|
||||
}
|
||||
}
|
||||
GM.setTitle(document.getElementsByTagName("h6")[0].title);
|
||||
GM.setFab(JSON.stringify(json));
|
||||
}
|
||||
}
|
||||
modify();
|
||||
}else modify();
|
||||
46
app/src/main/assets/i.js
Normal file
46
app/src/main/assets/i.js
Normal file
@@ -0,0 +1,46 @@
|
||||
javascript:
|
||||
if (typeof (loaded) == "undefined") {
|
||||
var loaded = true;
|
||||
var invoke = {
|
||||
preUrl: "",
|
||||
pinTitle: function () {
|
||||
/*document.getElementsByClassName("van-button__content")[2].click();*/
|
||||
document.getElementsByClassName("indexTitle")[0].style.position = "fixed";
|
||||
document.getElementsByClassName("indexTitle")[0].style.zIndex = 999;
|
||||
document.getElementsByClassName("indexTitle")[0].style.width = document.body.clientWidth - 18 + "px";
|
||||
document.getElementsByClassName("copySwiper")[0].style.marginTop = "56px";
|
||||
document.getElementsByClassName("indexTitle")[0].style.marginTop = "-56px";
|
||||
},
|
||||
notCallGM: function (url) {
|
||||
if (this.preUrl == url) return false;
|
||||
else {
|
||||
this.preUrl = url;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
clickClass: function (name, index) { document.getElementsByClassName(name)[index].click(); },
|
||||
clickClassCenter: function (name, index) {
|
||||
var ev = document.createEvent('HTMLEvents');
|
||||
ev.clientX = innerWidth / 2;
|
||||
ev.clientY = innerHeight / 2;
|
||||
ev.initEvent('click', false, true);
|
||||
document.getElementsByClassName(name)[index].dispatchEvent(ev);
|
||||
},
|
||||
resetPreUrl: function () { this.preUrl = ""; },
|
||||
loadChapter: function () { this.clickClassCenter("comicContentPopupImageItem", 0); GM.loadComic(location.href); },
|
||||
urlChangeListener: function (todo) {
|
||||
setInterval(function () { if (invoke.notCallGM(location.href)) { todo(); } }, 1000);
|
||||
}
|
||||
};
|
||||
function modify() {
|
||||
var url = location.href;
|
||||
GM.hideFab();
|
||||
if (url.endsWith("/index")) invoke.pinTitle();
|
||||
else if (url.indexOf("/comicContent/") > 0) setTimeout(function () { invoke.loadChapter() }, 1000);
|
||||
else if (url.indexOf("/details/comic/") > 0) GM.loadComic(url);
|
||||
}
|
||||
modify();
|
||||
invoke.urlChangeListener(modify);
|
||||
} else {
|
||||
setTimeout(modify, 1280);
|
||||
}
|
||||
Reference in New Issue
Block a user