Last active
February 2, 2019 07:54
-
-
Save UnluckyNinja/4d7cc3d8fb3a179d2d3e482bfb04e96f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name dmzj 记录 | |
// @namespace wut | |
// @version 0.1.1 | |
// @description wut | |
// @copyright 2018, wut | |
// @run-at document-end | |
// @author wut | |
// @match *://i.dmzj.com/subscribe | |
// @match *://manhua.dmzj.com/* | |
// @require https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349 | |
// @require https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js | |
// @grant unsafeWindow | |
// ==/UserScript== | |
// userscript for https://chrome.google.com/webstore/detail/dhdgffkkebhmkfjojejmpbldmpobfkfo | |
(function($, window) { | |
'use strict'; | |
function onProfilePage(){ | |
// Your code here... | |
function historyCookie(comic_Id,chapter_id,curr_Page){ | |
console.log('hc started') | |
if(Cookies.get('my', {domain: 'manhua.dmzj.com', path:"/"}) == null){ | |
return false | |
console.log('not login') | |
} | |
console.log('hc logged') | |
var cookieData = Date.parse(new Date()).toString().substr(0,10); | |
if(Cookies.get("history_CookieR", {domain: 'dmzj.com', path:"/"})==undefined){ | |
let item_obj = {}; | |
item_obj[comic_Id] = chapter_id; | |
item_obj["comicId"] = comic_Id;//漫画id | |
item_obj["chapterId"] = chapter_id;//话id | |
item_obj["page"] = curr_Page;//第几页 | |
item_obj["time"] =cookieData//观看时间 | |
Cookies.set("history_CookieR", JSON.stringify([item_obj]),{domain: 'dmzj.com', path:"/",expires: 1}); | |
console.log(JSON.stringify([item_obj])) | |
console.log('first read') | |
}else{ | |
var cookie_obj = $.parseJSON(Cookies.get("history_CookieR", {domain: 'dmzj.com', path:"/"})); | |
var exist = false; | |
for(var i=0;i<cookie_obj.length;i++) { | |
var obj = cookie_obj[i]; | |
if(obj[comic_Id]) { | |
obj[comic_Id] = chapter_id;//漫画id | |
obj["comicId"] = comic_Id;//漫画id | |
obj["chapterId"] = chapter_id;//漫画id | |
obj["page"] = curr_Page;//漫画页数 | |
obj["time"] = cookieData; //观看时间 | |
exist = true; | |
break; | |
} | |
} | |
if(!exist) { | |
let item_obj = {}; | |
item_obj[comic_Id] = chapter_id; | |
item_obj["comicId"] = comic_Id;//漫画id | |
item_obj["chapterId"] = chapter_id;//漫画id | |
item_obj["page"] = curr_Page; | |
item_obj["time"] =cookieData; | |
cookie_obj.push(item_obj); | |
} | |
Cookies.set("history_CookieR", JSON.stringify(cookie_obj),{domain: 'dmzj.com', path:"/", expires: 1}); | |
console.log('read') | |
} | |
} | |
function apply(node){ | |
let abutton = $(node).find('.dy_r p a').first() | |
let chapterId = abutton.attr('href').match(/(\d+).shtml/)[1] | |
let comicId = $(node).find('a.qx').first().attr('value') | |
abutton.click(()=>{ | |
console.log('clicked') | |
historyCookie(comicId, chapterId, 1) | |
}) | |
} | |
$('body').ready(function(){ | |
waitForKeyElements('div.dy_content_li' , (node)=>apply(node)) | |
}) | |
} | |
function onComicPage(){ | |
setTimeout(()=>{ | |
var cookie = Cookies.get("history_CookieR", {domain: 'dmzj.com', path:"/"}) | |
if(cookie !=undefined){ | |
try{ | |
window.historyLog(cookie) | |
}catch(e){ | |
console.log("你需要再打开一个能正常浏览的页面,来推送记录") | |
return; | |
} | |
Cookies.remove("history_CookieR", {domain: 'dmzj.com', path:"/"}) | |
console.log("记录已推送") | |
} | |
}, 1000) | |
} | |
if(window.location.host === 'manhua.dmzj.com'){ | |
onComicPage() | |
}else{ | |
onProfilePage() | |
} | |
}).call(unsafeWindow || window, (unsafeWindow || window).$, unsafeWindow || window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
从订阅列表里点这里,打开的新页面可以直接关掉

找到一部未隐藏的漫画,打开任意一话,保持打开至少2秒
手机上点击这里

刷新一下就能看到入口
