// ==UserScript== // @name 贵物班友会 // @namespace http://tampermonkey.net/ // @version 2.3.1 // @description 贵物班友会(bgm.tv、bangumi.tv、chii.in) // @author 老悠 // @include https://bgm.tv/* // @include https://bangumi.tv/* // @match https://chii.in/* // @grant GM_addStyle // @grant GM_getResourceText // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; GM_addStyle('.dialog { width: 100%; height: 100vh; background-color: rgba(0, 0, 0, 0.5); position: absolute; top: 0; left: 0;line-height: 30px; display: none; } .dialog .container {width: 220px;height: 100px; background-color: #fff;margin: calc((100vh - 100px)/2) auto; position: relative;} .dialog .container .dialog_footer { position: absolute; bottom: 0; } .dialog .container .dialog_footer button {position: relative;left: 50px;display: inline-block;width: 50px;bottom: 10px;} .monster-tooltip {display: none;position: absolute;background-color: #f9f9f9;border: 1px solid #ccc;padding: 5px 10px;border-radius: 5px;font-size: 14px;}') let yodbUrl="https://ly.syaro.io:380/yodb/api/"; //let yodbUrl="http://192.168.224.134:8080/yodb/"; let myBgmId; let myBgmId2; let protocol = window.location.protocol; let host = window.location.host; let baseUrl = protocol + '//' + host; $.get(baseUrl+"/home",function(html,status){ let $html=$(html); let $avatar=$html.find("#headerProfile .avatar:first"); let tempHtml=$avatar.html(); if(tempHtml){ let bgImgSplit=$avatar.html().split(".jpg")[0].split("/"); let split=$avatar.prop("href").split("/"); myBgmId=split[split.length-1]; myBgmId2=bgImgSplit[bgImgSplit.length-1]; } let modalHtml='
' +'
' +'
' +'
' +'
' +'     颜色:' +'' +'' +'
' +'     备注:
' +'
' +'
' +' ' +' ' +'
' +'
' +'
'; let modalHtml2='
' +'
' +'
' +'
' +'
' +'     bgmId:' +'
' +'     名称:' +'
' +'     淳朴度:' +'
' +'     简介:
' +'
' +'
' +' ' +' ' +'
' +'
' +'
'; $('body').append(modalHtml2); let initModalVal=function(){ let ava=$("#headerProfile a.avatar"); if(!ava){ return; } let hrefVal=ava.attr("href"); if(!hrefVal){ return; } let newBgmId; let oldBgmId; if(hrefVal.indexOf("/user/")>-1){ let split=hrefVal.split("/"); newBgmId=split[split.length-1]; let imgUrl=ava.find("span").css("background-image"); if(imgUrl){ let oldSplit=imgUrl.split("/"); let oldTempSplit=oldSplit[oldSplit.length-1].split("."); oldBgmId=oldTempSplit[0]; //没有头像无法获得原始bgmId if(oldBgmId=='icon'){ oldBgmId=newBgmId; } } } $("#markBgmId").val(newBgmId); $.get(yodbUrl+'anon/vulgar/monsterScore/detailByBgmId/'+newBgmId+"?newMyBgmId="+myBgmId+"&oldMyBgmId="+myBgmId2, function(res){ if(!res||!res.data){ if(newBgmId!=oldBgmId){ $.get(yodbUrl+'anon/vulgar/monsterScore/detailByBgmId/'+oldBgmId+"?newMyBgmId="+myBgmId+"&oldMyBgmId="+myBgmId2, function(res){ setModalVal(res.data); }); } }else{ setModalVal(res.data); } }); } let setModalVal=function(modalData){ $("#markBgmId").val(modalData.monster.bgmId); $("#markName").val(modalData.name); $("#markScore").val(modalData.score); $("#markCont").text(modalData.cont); } initModalVal(); let marksModalHtml='
' +'
' +'
' +'
' +'
' +'
' +' 全量傻逼备注JSON:
' +'
' +'
' +'