您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
B站动态页功能增强
当前为
// ==UserScript== // @name Bili Trends Extend // @namespace http://tampermonkey.net/ // @version 0.2 // @description B站动态页功能增强 // @author Yi MIT // @match https://t.bilibili.com/* // @match https://www.bilibili.com/video/* // @match https://www.bilibili.com/list/* // @match https://www.bilibili.com/bangumi/play/* // @match https://www.bilibili.com/opus/* // @match https://space.bilibili.com/* // @match https://www.bilibili.com/v/topic/detail/* // @match https://www.bilibili.com/cheese/play/* // @match https://bgmlist.com/ // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant GM_xmlhttpRequest // @grant GM_setValue // @grant GM_getValue // @require https://unpkg.com/[email protected]/dist/sweetalert2.all.min.js // @require https://unpkg.com/[email protected]/dist/sweetalert.min.js // @require https://unpkg.com/[email protected]/dist/jquery.min.js // @require https://unpkg.com/[email protected]/browser/index.js // @require https://unpkg.com/[email protected]/browser/index.js // @require https://unpkg.com/[email protected]/dist/pako.min.js // @require https://cdn.bootcdn.net/ajax/libs/flv.js/1.6.2/flv.min.js // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/mpegts.min.js // @run-at document-end // @license MIT // ==/UserScript== let liveTemp; let AnimationTimelineAll; let MyAnimationTimelineID; let MyAnimationTimeline = new Array(7); let translateXList = [44, 370, 696, 1022, 1348, 1674, 2000]; let dayNum; let cookies; let flv; let stopTime; let playPromise; let weekChinese = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; //bilibili(主站>港澳台>港澳>台)、gamer(动画疯)、muse_hk(木棉花 HK)、acfun、Ani-One(羚邦)、iqiyi(爱奇艺) let url_bili = "https://www.bilibili.com/bangumi/media/md{{id}}/"; let url_gamer = "https://acg.gamer.com.tw/acgDetail.php?s={{id}}"; let url_muse_hk = "https://www.youtube.com/playlist?list={{id}}"; let url_acfun = "https://www.acfun.cn/bangumi/aa{{id}}"; let url_ani_one = "https://www.youtube.com/playlist?list={{id}}"; let url_iqiyi = "https://www.iqiyi.com/{{id}}.html"; let url = window.location.host; let ms = 2000; let lastClick = Date.now() - ms; (function() { if (url.indexOf('bilibili') !== -1) { async function level1() { liveTemp = await GetPromiseAndWait("https://api.bilibili.com/x/polymer/web-dynamic/v1/portal"); var formdata = new FormData(); AnimationTimelineAll = await GetPromiseAndWait_1("https://bgmlist.com/api/v1/bangumi/onair"); MyAnimationTimelineID = await GetPromiseAndWait_2("https://bgmlist.com/api/v1/preference/bangumi"); MyAnimationTimeline[0] = new Array(); MyAnimationTimeline[1] = new Array(); MyAnimationTimeline[2] = new Array(); MyAnimationTimeline[3] = new Array(); MyAnimationTimeline[4] = new Array(); MyAnimationTimeline[5] = new Array(); MyAnimationTimeline[6] = new Array(); for (let j = 0; j < AnimationTimelineAll.length; j++) { var TOrF = MyAnimationTimelineID.indexOf(AnimationTimelineAll[j].id); if (TOrF !== -1) { let date = timeConversion(AnimationTimelineAll[j].begin); let id = AnimationTimelineAll[j].sites[0].id; let id_gamer = -1; let id_bilibili = -1; let id_iqiyi = -1; let id_acfun = -1; let id_muse_hk = -1; let id_ani_one = -1; for (let l = 0; l < AnimationTimelineAll[j].sites.length; l++) { if (AnimationTimelineAll[j].sites[l].site === "gamer") { id_gamer = AnimationTimelineAll[j].sites[l].id; date = timeConversion(AnimationTimelineAll[j].sites[l].begin); } else if (AnimationTimelineAll[j].sites[l].site === "bilibili") { if (id_bilibili === -1) { id_bilibili = AnimationTimelineAll[j].sites[l].id; } } else if (AnimationTimelineAll[j].sites[l].site === "iqiyi") { id_iqiyi = AnimationTimelineAll[j].sites[l].id; } else if (AnimationTimelineAll[j].sites[l].site === "acfun") { id_acfun = AnimationTimelineAll[j].sites[l].id; } else if (AnimationTimelineAll[j].sites[l].site === "muse_hk") { id_muse_hk = AnimationTimelineAll[j].sites[l].id; } else if (AnimationTimelineAll[j].sites[l].site === "ani_one") { id_ani_one = AnimationTimelineAll[j].sites[l].id; } } let day = date.getDay(); let hour = (date.getHours() + "").length === 1 ? "0" + date.getHours() : date.getHours(); let minute = (date.getMinutes() + "").length === 1 ? "0" + date.getMinutes() : date .getMinutes(); let title = AnimationTimelineAll[j].titleTranslate['zh-Hans'] !== undefined ? AnimationTimelineAll[j].titleTranslate['zh-Hans'][0] : AnimationTimelineAll[j].title; let jump_url = { bili: id_bilibili, gamer: id_gamer, iqiyi: id_iqiyi, acfun: id_acfun, muse_hk: id_muse_hk, ani_one: id_ani_one }; var tempObject = { time: (hour + ":" + minute), title: title, id: id, jump_id: jump_url }; MyAnimationTimeline[day].push(tempObject); } } for (let l = 0; l < 7; l++) { MyAnimationTimeline[l].sort((a, b) => { let aHours = parseInt(a.time.substring(0, 2)); let bHours = parseInt(b.time.substring(0, 2)); let aMin = parseInt(a.time.substring(3, 5)); let bMin = parseInt(b.time.substring(3, 5)); if (aHours !== bHours) { return aHours - bHours; } return aMin - bMin; }); } if (liveTemp != null) { for (let i = 0; i < liveTemp.length; i++) { let livesUrl = await (await fetch( "https://api.live.bilibili.com/xlive/web-room/v1/index/getRoomPlayInfo?room_id=" + liveTemp[i].room_id + "&play_url=1&mask=1&qn=10000&platform=web")).json(); if (livesUrl.data.play_url === null) { continue; } liveTemp[i].liveUrl = livesUrl.data.play_url.durl[0].url; // liveTemp[i].uid = livesUrl.data.url; } for (let i = 0; i < liveTemp.length; i++) { const liveInfo = await (await fetch( "https://api.live.bilibili.com/room/v1/Room/get_info?room_id=" + liveTemp[i] .room_id )).json(); liveTemp[i].online = liveInfo.data.online; liveTemp[i].liveTime = liveInfo.data.live_time; liveTemp[i].liveCover = liveInfo.data.user_cover; } } cookies = splicingCookie(); } level1(); setTimeout(() => { const liveList = document.querySelectorAll(".bili-dyn-live-users__item-container"); const section = document.getElementsByTagName("section"); section[4].className = "sticky"; section[4].style.zIndex = "2"; section[4].style.marginBottom = "0px"; let sectionNew = document.createElement("section"); sectionNew.className = "section_new"; sectionNew.style.display = "none"; document.getElementsByTagName("aside")[1].insertBefore(sectionNew, section[4]); userCrad(); const dynBanner = document.querySelector(".bili-dyn-banner"); // viscousHeight(dynBanner, 72, "relative", -1); dynBanner.removeChild(document.querySelector(".bili-dyn-banner__img")); const liveUsersName = document.querySelectorAll(".bili-dyn-live-users__item__uname"); const liveUsersTitle = document.querySelectorAll(".bili-dyn-live-users__item__title"); const liveRealList = liveTemp; if (liveTemp !== null) { let changeTextDad = document.querySelector(".bili-dyn-live-users__body"); while (changeTextDad.hasChildNodes()) { changeTextDad.removeChild(changeTextDad.lastChild); } for (var i = 0; i < liveRealList.length; i++) { //为每个框赋予鼠标悬停、移除事件 let live_users_container = document.createElement("div"); live_users_container.className = "bili-dyn-live-users__container"; let live_users__item_container = document.createElement("div"); live_users__item_container.className = "bili-dyn-live-users__item-container"; live_users_container.appendChild(live_users__item_container); let live_users__item = document.createElement("div"); live_users__item.className = "bili-dyn-live-users__item"; live_users__item_container.appendChild(live_users__item); let live_users__item__left = document.createElement("div"); live_users__item__left.className = "bili-dyn-live-users__item__left"; live_users__item.appendChild(live_users__item__left); let live_users__item__face = document.createElement("div"); live_users__item__face.className = "bili-dyn-live-users__item__face"; live_users__item__left.appendChild(live_users__item__face); let img_face = document.createElement("div"); img_face.className = "b-img--face b-img"; live_users__item__face.appendChild(img_face); let img_inner = document.createElement("picture"); img_inner.className = "b-img__inner"; img_face.appendChild(img_inner); let avif = document.createElement("source"); avif.type = "image/avif"; avif.srcset = liveRealList[i].face + "@96w_96h_!web-dynamic.avif"; let webp = document.createElement("source"); webp.type = "image/webp"; webp.srcset = liveRealList[i].face + "@96w_96h_!web-dynamic.webp"; let face_img = document.createElement("img"); face_img.src = liveRealList[i].face + "@96w_96h_!web-dynamic.webp"; face_img.loading = "lazy"; img_inner.appendChild(avif); img_inner.appendChild(webp); img_inner.appendChild(face_img); let live_users_item_living = document.createElement("div"); live_users_item_living.className = "bili-dyn-live-users__item__living"; live_users__item__left.appendChild(live_users_item_living); let live_users__item__right = document.createElement("div"); live_users__item__right.className = "bili-dyn-live-users__item__right"; live_users__item.appendChild(live_users__item__right); let live_users__item__uname = document.createElement("div"); live_users__item__uname.className = "bili-dyn-live-users__item__uname bili-ellipsis"; live_users__item__uname.innerHTML = liveRealList[i].uname; live_users__item__right.appendChild(live_users__item__uname); let live_users__item__title = document.createElement("div"); live_users__item__title.className = "bili-dyn-live-users__item__title bili-ellipsis"; live_users__item__title.innerHTML = liveRealList[i].title; live_users__item__right.appendChild(live_users__item__title); changeTextDad.appendChild(live_users_container); live_users__item_container.addEventListener('click', (function(num, liverRealList) { return function(e) { window.open("https://live.bilibili.com/" + liveRealList[num] .room_id); } })(i, liveRealList)) live_users__item_container.addEventListener('mouseover', (function(num, liveMember, liverName, liverTitle, liverRealList, stopTimeTemp) { return function(e) { let changeTextDad = document.querySelector(".bili-dyn-banner"); var name = document.createTextNode(liverRealList[num].uname); var title = document.createTextNode(liverRealList[num].title); var online = document.createTextNode("观看人数:" + liverRealList[ num] .online); var liveTime = document.createTextNode("开播时间:" + liverRealList[ num] .liveTime); var liveCover = document.createElement("video"); var liveFather = document.createElement("div"); let name_bold = document.createElement("div"); name_bold.style.fontWeight = "bold"; name_bold.innerText = liverRealList[num].uname; liveFather.className = "liveFather"; liveFather.style.padding = "9px 10px 10px 10px"; liveCover.preload = "none"; liveCover.muted = "muted"; liveCover.style.height = "178.88px"; liveCover.className = "video"; liveCover.addEventListener('click', (function(j, list) { return function(e) { window.open( "https://live.bilibili.com/" + list[j].room_id); } })(num, liverRealList)); let liveTemp = document.querySelector(".liveTempShow"); userCradInfo(liverRealList[num].mid); let section = document.getElementsByTagName("section"); let section_height = document.getElementsByTagName("section")[0] .scrolHeight; section[5].style.top = "330px"; section[5].style.height = "310px"; section[section.length - 1].style.top = "648px"; if (liveTemp === null) { var para = document.createElement("div"); para.className = "liveTempShow"; para.style.height = "100%"; changeTextDad.appendChild(para); liveFather.appendChild(name_bold); // liveFather.appendChild(document.createElement("br")); liveFather.appendChild(title); liveFather.appendChild(document.createElement("br")); liveFather.appendChild(online); liveFather.appendChild(document.createElement("br")); liveFather.appendChild(liveTime); para.appendChild(liveFather); para.appendChild(liveCover); let dynTopicBox = document.querySelectorAll( ".bili-dyn-topic-box"); let sticky = document.querySelectorAll(".sticky"); sticky[1].style.zIndex = "1"; sticky[0].style.marginBottom = "8px"; } else { pausemix(); while (liveTemp.hasChildNodes()) { liveTemp.removeChild(liveTemp.lastChild); } liveFather.appendChild(name_bold); // liveFather.appendChild(document.createElement("br")); liveFather.appendChild(title); liveFather.appendChild(document.createElement("br")); liveFather.appendChild(online); liveFather.appendChild(document.createElement("br")); liveFather.appendChild(liveTime); liveTemp.appendChild(liveFather); liveTemp.appendChild(liveCover); } flv = flvjs.createPlayer({ type: 'flv', url: liverRealList[num].liveUrl, isLive: true, //数据源是否为直播流 hasAudio: true, //数据源是否包含有音频 hasVideo: true, //数据源是否包含有视频 enableStashBuffer: false //是否启用缓存区 }, { enableWorker: false, //不启用分离线程 enableStashBuffer: false, //关闭IO隐藏缓冲区 autoCleanupSourceBuffer: true, //自动清除缓存 }); flv.attachMediaElement(liveCover); flv.load(); playPromise = flv.play(); clearTimeout(stopTime); let tempHeight = document.querySelector(".liveFather") .offsetHeight + liveCover.offsetHeight; changeTextDad.style.height = "100%"; let dynTopicBox = document.querySelectorAll( ".bili-dyn-topic-box"); let sticky = document.querySelectorAll(".sticky"); } })(i, liveList, liveUsersName, liveUsersTitle, liveRealList, stopTime)); live_users__item_container.addEventListener("mouseout", (function() { let liveTemp = document.querySelector(".liveTempShow"); if (liveTemp !== null) { closeTime(); } })); } } deleteTopic(); newAnimationTime(); }, 4000); function closeTime() { stopTime = setTimeout(() => { pausemix(); const changeTextDad = document.querySelector(".bili-dyn-banner"); changeTextDad.style.height = heightMeasurement(0); while (changeTextDad.hasChildNodes()) { changeTextDad.removeChild(changeTextDad.lastChild); } const dynTopicBox = document.querySelectorAll(".bili-dyn-topic-box"); const sticky = document.querySelectorAll(".sticky"); sticky[0].style.margin = "0px"; document.querySelectorAll(".section_new")[0].style.display = "none"; let section = document.getElementsByTagName("section"); section[5].style.height = "0%"; let section_height = document.getElementsByTagName("section")[0].scrolHeight + 8; section[section.length - 1].style.top = "72px"; }, 10000); } function pausemix() { if (flv !== null) { if (playPromise !== undefined) { playPromise.then(_ => {}).catch(error => {}); } flv.pause() flv.unload() flv.detachMediaElement() flv.destroy() flv = null } } //卡片 function userCrad() { let user_profile = document.createElement("div"); user_profile.className = "bili-user-profile"; user_profile.style.position = "sticky"; user_profile.style.top = "5px"; document.querySelectorAll(".section_new")[0].appendChild(user_profile); let user_profile__content = document.createElement("div"); user_profile__content.className = "bili-user-profile__content"; user_profile.appendChild(user_profile__content); let user_profile_view = document.createElement("div"); user_profile_view.className = "bili-user-profile-view"; user_profile__content.appendChild(user_profile_view); let user_profile_view__background = document.createElement("div"); user_profile_view__background.className = "bili-user-profile-view__background"; user_profile_view__background.style.backgroundImage = "url(//i0.hdslb.com/bfs/space/768cc4fd97618cf589d23c2711a1d1a729f42235.png@732w_170h_1c.webp)"; user_profile_view.appendChild(user_profile_view__background); let user_profile_view__avatar = document.createElement("a"); user_profile_view__avatar.className = "bili-user-profile-view__avatar"; user_profile_view__avatar.href = "https://space.bilibili.com/51030552"; user_profile_view__avatar.target = "_blank"; user_profile_view.appendChild(user_profile_view__avatar); let user_profile_view__avatar__face = document.createElement("div"); user_profile_view__avatar__face.className = "bili-user-profile-view__avatar__face b-img--face b-img"; user_profile_view__avatar.appendChild(user_profile_view__avatar__face); let img__inner = document.createElement("picture"); img__inner.className = "b-img__inner"; user_profile_view__avatar__face.appendChild(img__inner); let source_webp = document.createElement("source"); source_webp.type = "image/webp"; source_webp.className = "source_webp"; source_webp.srcset = "//i0.hdslb.com/bfs/face/1b106c22e231af79f0ba8aee5669301e3bfa1780.jpg@96w_96h_!web-dynamic.webp"; img__inner.appendChild(source_webp); let img_webp = document.createElement("img"); img_webp.className = "img_webp"; img_webp.src = "//i0.hdslb.com/bfs/face/1b106c22e231af79f0ba8aee5669301e3bfa1780.jpg@96w_96h_!web-dynamic.webp"; img_webp.loading = "lazy"; img__inner.appendChild(img_webp); let user_profile_view__avatar__icon = document.createElement("span"); user_profile_view__avatar__icon.className = "bili-user-profile-view__avatar__icon officialverify--0"; user_profile_view__avatar.appendChild(user_profile_view__avatar__icon); let user_profile_view__info = document.createElement("div"); user_profile_view__info.className = "bili-user-profile-view__info"; user_profile_view.appendChild(user_profile_view__info); let user_profile_view__info__header = document.createElement("div"); user_profile_view__info__header.className = "bili-user-profile-view__info__header"; user_profile_view__info.appendChild(user_profile_view__info__header); let user_profile_view__info__uname = document.createElement("a"); user_profile_view__info__uname.className = "bili-user-profile-view__info__uname"; user_profile_view__info__uname.href = "https://space.bilibili.com/51030552"; user_profile_view__info__uname.target = "_blank"; user_profile_view__info__uname.style.color = "rgb(251, 114, 153)"; user_profile_view__info__uname.innerHTML = "星汐Seki"; user_profile_view__info__header.appendChild(user_profile_view__info__uname); let user_profile_view__info__gender = document.createElement("div"); user_profile_view__info__gender.className = "bili-user-profile-view__info__gender female"; user_profile_view__info__header.appendChild(user_profile_view__info__gender); let user_profile_view__info__level = document.createElement("div"); user_profile_view__info__level.className = "bili-user-profile-view__info__level"; user_profile_view__info__header.appendChild(user_profile_view__info__level); let img_level = document.createElement("img"); img_level.className = "img_level"; img_level.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI+SURBVHgB7ZcxbNNAFIb/M0lKsSNgadaSmVZstExIBQmkimaFDgixIhqYEDMgJpoCY1GnlhkhYAkrYu8e5mRBiDptCM31Xlq7cc7xpXGU1NL7Flt353vvv3v33hlgGIZhGIZhEovAGPizeHtFShQxIBJYu/jlW4neUxgDyoGCWrppDIiAXFKPoIDfi7euW8K6jxEgIadJBWFdykPYtvmbWhWtWk1r9wUIiFUp5RWMEHI++/Z93+N3Hj/C/q9KcA7/TeICRkw/Kx8Y7+jjrbBJs+sbOP/5K+xXr2Fisvi0PTb7YSPUIWsq157PWXuHzJ0CBkW6LlrVqtauHWJhO7ByucPOmVmYSF2e8R09k8/j//Z2oD+9cONoPtXftf2dtFSM/334ACfFQsJJvICx1IEwKHQn7i737KcQa34va+2nSICNs/eWI8e4SkT3GeMQGhaUJps/f2jt6blrkfViqAJSV+e1LabU2g/S3cFuaVWfc302UkDsECLDHhNLhcBBpCKXnps/HlutYdjEFlB/+SJQIekgUvEiIRn19KAMsvdxE8PGGEKTxSdaG8VrY2vzsLyrzOA+f9a+dngV/Jxa+U7I+XrpDaKgNBpmSzgOYgnILNwMbW+Wy/7NMEyER0Ot+t6WeeUpznvZimLgEOq+GXoiOsPJ6HzdRVy0HSBHdtV2i6lcz48odLqzjfctiaAz0KtydrJfqRhtmWyGhtA/g+EoyPHGCQ5rHFuEL4B+lIWUK0gAEuITGIZhGIZhmORzAFVa0dNZxTNHAAAAAElFTkSuQmCC"; user_profile_view__info__level.appendChild(img_level); let user_profile_view__info__viplabel = document.createElement("div"); user_profile_view__info__viplabel.className = "bili-user-profile-view__info__viplabel"; user_profile_view__info__viplabel.style.backgroundColor = "rgb(251, 114, 153)"; user_profile_view__info__viplabel.style.color = "rgb(255, 255, 255)"; user_profile_view__info__header.appendChild(user_profile_view__info__viplabel); let user_profile_view__info__viplabel__text = document.createElement("div"); user_profile_view__info__viplabel__text.className = "bili-user-profile-view__info__viplabel__text"; user_profile_view__info__viplabel__text.innerHTML = "年度大会员"; user_profile_view__info__viplabel.appendChild(user_profile_view__info__viplabel__text); let user_profil1e__info__body = document.createElement("div"); user_profil1e__info__body.className = "bili-user-profil1e__info__body"; user_profile_view__info.appendChild(user_profil1e__info__body); let user_profile_view__info__stats = document.createElement("div"); user_profile_view__info__stats.className = "bili-user-profile-view__info__stats"; user_profil1e__info__body.appendChild(user_profile_view__info__stats); let user_profile_view__info__stat_follow = document.createElement("a"); user_profile_view__info__stat_follow.className = "bili-user-profile-view__info__stat follow"; user_profile_view__info__stat_follow.target = "_blank"; user_profile_view__info__stats.appendChild(user_profile_view__info__stat_follow); // let span_follow = document.createElement("span"); // span_follow.innerHTML = "201"; // user_profile_view__info__stat_follow.appendChild(span_follow); user_profile_view__info__stat_follow.innerText = "601 关注"; let user_profile_view__info__stat_fans = document.createElement("a"); user_profile_view__info__stat_fans.className = "bili-user-profile-view__info__stat fans"; user_profile_view__info__stat_fans.target = "_blank"; user_profile_view__info__stats.appendChild(user_profile_view__info__stat_fans); // let span_fans = document.createElement("span"); // span_fans.innerHTML = ""; user_profile_view__info__stat_fans.innerHTML = "20.4万 粉丝"; // user_profile_view__info__stat_fans.appendChild(span_fans); let user_profile_view__info__stat_like = document.createElement("div"); user_profile_view__info__stat_like.className = "bili-user-profile-view__info__stat like"; user_profile_view__info__stats.appendChild(user_profile_view__info__stat_like); // let span_like = document.createElement("span"); // span_like.innerHTML = ""; user_profile_view__info__stat_like.innerHTML = "340.3万 获赞"; // user_profile_view__info__stat_like.appendChild(span_like); let user_profile_view__info__officialverify = document.createElement("div"); user_profile_view__info__officialverify.className = "bili-user-profile-view__info__officialverify"; user_profil1e__info__body.appendChild(user_profile_view__info__officialverify); let officialverify_0 = document.createElement("i"); officialverify_0.className = "officialverify--0"; user_profile_view__info__officialverify.appendChild(officialverify_0); let span_bili = document.createElement("span"); span_bili.className = "span_bili"; span_bili.innerHTML = "bilibili个人认证:bilibili 知名虚拟UP主、直播高能主播"; user_profile_view__info__officialverify.appendChild(span_bili); let user_profile_view__info__signature = document.createElement("div"); user_profile_view__info__signature.className = "bili_user_profile_view__info__signature"; user_profile_view__info__signature.innerHTML = "PSPlive所属的星星星汐seki,也可以叫我小七~是17岁美少女!开心就完事了嗷!"; user_profil1e__info__body.appendChild(user_profile_view__info__signature); /* let user_profile_view__info__footer = document.createElement("div"); user_profile_view__info__footer.className = "bili-user-profile-view__info__footer"; user_profile_view__info.appendChild(user_profile_view__info__footer); */ } //修改卡片信息 async function userCradInfo(id) { if (Date.now() - lastClick >= ms) { document.querySelectorAll(".section_new")[0].setAttribute("style", "display;height: 250px;z-index: 3;position: sticky;top: 72px;"); document.querySelectorAll(".bili-user-profile")[0].style.height = "100%"; document.querySelectorAll(".bili-user-profile")[0].style.width = "100%"; document.querySelectorAll(".bili-user-profile__content")[0].style.width = "100%"; document.querySelectorAll(".bili-user-profile__content")[0].style.height = "100%"; document.querySelectorAll(".bili-user-profile-view")[0].style.height = "100%"; document.querySelectorAll(".bili-user-profile-view__background")[0].style.width = "100%"; document.querySelectorAll(".bili-user-profile-view__background")[0].style.height = "28.9%"; document.querySelectorAll(".bili-user-profile-view__info")[0].style.padding = "25% 5% 3% 20%"; document.querySelectorAll(".bili-user-profile-view__info")[0].style.height = "100%"; document.querySelectorAll(".bili-user-profile-view__avatar")[0].style.top = "32%"; document.querySelectorAll(".bili-user-profile-view__avatar")[0].style.left = "2%"; document.querySelectorAll(".bili-user-profile-view__avatar")[0].style.width = "48px"; document.querySelectorAll(".bili-user-profile-view__avatar")[0].style.height = "48px"; let info = await (await fetch("https://api.bilibili.com/x/web-interface/card?mid=" + id + "&photo=true")).json(); document.querySelectorAll(".bili-user-profile-view__background")[0].style.backgroundImage = "url(" + info.data.space.s_img + "@732w_170h_1c.webp)"; document.querySelectorAll(".source_webp")[0].srcset = info.data.card.face + "@96w_96h_!web-dynamic.webp"; document.querySelectorAll(".img_webp")[0].src = info.data.card.face + "@96w_96h_!web-dynamic.webp"; document.querySelectorAll(".bili-user-profile-view__info__uname")[0].innerHTML = info.data.card .name; document.querySelectorAll(".bili-user-profile-view__info__stat")[0].innerHTML = dataHandle(info .data.card.attention) + " 关注"; document.querySelectorAll(".bili-user-profile-view__info__stat")[1].innerHTML = dataHandle(info .data.card.fans) + " 粉丝"; document.querySelectorAll(".bili-user-profile-view__info__stat")[2].innerHTML = dataHandle(info .data.like_num) + " 获赞"; document.querySelectorAll(".span_bili")[0].innerHTML = "bilibili个人认证:" + info.data.card .official_verify.desc; document.querySelectorAll(".bili_user_profile_view__info__signature")[0].innerHTML = info.data .card.sign; document.querySelectorAll(".bili-user-profile-view__avatar")[0].href = "https://space.bilibili.com/" + id; document.querySelectorAll(".bili-user-profile-view__info__uname")[0].href = "https://space.bilibili.com/" + id; lastClick = Date.now(); } else { setTimeout(userCradInfo(id), 1000); } } //数字处理 function dataHandle(num) { if (num >= 10000) { let first = parseInt(num / 10000); let second = ((num % 10000) * 0.0001).toFixed(1); num = ""; num = first + "." + second.substring(2) + "万"; // alert(second + " : " + num); } return num; } //时间表 function newAnimationTime() { const sticky = document.querySelectorAll(".sticky"); sticky[sticky.length - 1].style.cssText = "overflow:hidden;background-color: #fff;border-radius: 6px;"; const timeList = document.querySelector(".bili-dyn-topic-box"); const arrowLeft = document.createElement("div"); const arrowRight = document.createElement("div"); arrowLeft.className = "arrow-left"; arrowLeft.style.cssText = "z-index: 2;position: absolute;top: 15px;left: 4px;width: 14px;height: 26px;background: url(https://s1.hdslb.com/bfs/static/bangumi-timeline/assets/icons.png) no-repeat -77px -542px;background-size: 247px 663px;cursor: pointer;"; arrowRight.className = "arrow-right"; arrowRight.style.cssText = "z-index: 3;position: absolute;top: 15px;right: 4px;width: 14px;height: 26px;background: url(https://s1.hdslb.com/bfs/static/bangumi-timeline/assets/icons.png) no-repeat -158px -542px;background-size: 247px 663px;cursor: pointer;"; const tlWeeks = document.createElement("div"); tlWeeks.className = "tl-weeks"; const tlHeadList = document.createElement("ul"); tlHeadList.className = "tl-head-list"; tlWeeks.appendChild(tlHeadList); tlHeadList.style.cssText = "z-index: 1;width: 2282px;transform: translateX(-44px);list-style: none;"; let day = new Date().getDay(); let hour = new Date().getHours(); let min = new Date().getMinutes(); dayNum = day; tlHeadList.style.transform = "translateX(-" + translateXList[day] + "px)"; tlWeeks.style.cssText = "overflow: hidden;"; tlWeeks.style.height = (43 * MyAnimationTimeline[dayNum].length) + 74 + "px"; arrowLeft.addEventListener("click", (function(tlHeadListTemp) { return function(e) { if (dayNum !== 0) { dayNum = (dayNum - 1) % 7; arrowLeft.style.cursor = "pointer"; arrowRight.style.cursor = "pointer"; tlHeadListTemp.style.transform = "translateX(-" + translateXList[dayNum] + "px)"; tlWeeks.style.height = 43 * MyAnimationTimeline[dayNum].length + 74 + "px"; } else { arrowLeft.style.cursor = "not-allowed"; arrowRight.style.cursor = "pointer"; } } })(tlHeadList)); arrowRight.addEventListener("click", (function(tlHeadListTemp) { return function(e) { if (dayNum !== 6) { dayNum = (dayNum + 1) % 7; arrowLeft.style.cursor = "pointer"; arrowRight.style.cursor = "pointer"; tlHeadListTemp.style.transform = "translateX(-" + translateXList[dayNum] + "px)"; tlWeeks.style.height = 43 * MyAnimationTimeline[dayNum].length + 74 + "px"; } else { arrowLeft.style.cursor = "pointer"; arrowRight.style.cursor = "not-allowed"; } } })(tlHeadList)); //const nowWeek = getWeekDates(); const nowWeek = getWeekDate({ baselineDate: new Date() }); for (let j = 0; j < 7; j++) { let tlHead = document.createElement("div"); tlHead.className = "tl-head"; tlHead.style.cssText = "z-index: 1;width: 326px;float: left;"; tlHead.style.height = 43 * MyAnimationTimeline[0].length + 40 + "px"; let indicator = document.createElement("span"); indicator.className = "indicator"; indicator.style.cssText = "top: 30px;height: 6px;width: 102px;margin-left: -80px;font-size: 18px;display: inline-block;position: absolute;border-radius: 8px;"; let tDate = document.createElement("span"); tDate.className = "t-date-" + j; //tDate.innerHTML = nowWeek[j]; tDate.innerHTML = nowWeek[(j - 1 == -1 ? 6 : j - 1) % 7].dateStr.substring(5); tDate.style.cssText = "margin-left: 40px;" let tWeek = document.createElement("span"); tWeek.className = "t-week-" + j; tWeek.innerHTML = weekChinese[j]; tlHead.appendChild(tDate); tlHead.appendChild(tWeek); tlHead.appendChild(indicator); let seasonList = document.createElement("ul"); /* if (j >= day || j === 0) { indicator.style.background = "#fb7299"; alert(day); } else { tDate.style.color = "#bf90f0"; tWeek.style.color = "#bf90f0"; indicator.style.background = "#bf90f0"; } */ let flag = true if (day === 0) { if (j === 0) { indicator.style.background = "#fb7299"; } else { tDate.style.color = "#bf90f0"; tWeek.style.color = "#bf90f0"; indicator.style.background = "#bf90f0"; flag = false; } } else { if (j !== 0 && j < day) { tDate.style.color = "#bf90f0"; tWeek.style.color = "#bf90f0"; indicator.style.background = "#bf90f0"; flag = false; } else { indicator.style.background = "#fb7299"; } } seasonList.style.cssText = "position: relative;padding: 0;top: 20px;width: 250px;margin-left: 40px;"; for (let i = 0; i < MyAnimationTimeline[j].length; i++) { let seasonItem = document.createElement("li"); seasonItem.style.cssText = "overflow: hidden;padding-bottom:5px;"; let animationJump = document.createElement("div"); let animationTime = document.createElement("div"); animationTime.style.cssText = "float: left;width: 50px;"; animationTime.innerHTML = MyAnimationTimeline[j][i].time; let animationTitle = document.createElement("div"); let aAnimationTitle = document.createElement("a"); animationJump.style.cssText = "display: none;width: 250px;height: 43px;justify-content: center;align-items: center;"; if (MyAnimationTimeline[j][i].jump_id.bili !== -1) { let jump_div = document.createElement("div"); jump_div.style.height = "100%"; jump_div.style.width = "43px"; jump_div.style.padding = "0 10px"; let img_bili = document.createElement("a"); let svg_bili = document.createElement("img"); svg_bili.src = "https://tukuimg.bdstatic.com/cms/2dfea3b61b924ab4fd61bbd3119839ac.jpeg"; svg_bili.style.height = "43px"; img_bili.href = url_bili.replace("{{id}}", MyAnimationTimeline[j][i].jump_id.bili); img_bili.target = "blank"; img_bili.style.height = "43px"; img_bili.appendChild(svg_bili); jump_div.appendChild(img_bili); animationJump.appendChild(jump_div); } if (MyAnimationTimeline[j][i].jump_id.gamer !== -1) { let jump_div = document.createElement("div"); jump_div.style.height = "100%"; jump_div.style.width = "43px"; jump_div.style.padding = "0 10px"; let img_gamer = document.createElement("a"); let svg_gamer = document.createElement("img"); svg_gamer.src = "https://tm-image.tianyancha.com/tm/d1f36b1caa4234588c197386d6ec207d.jpg"; svg_gamer.style.height = "43px"; img_gamer.href = url_gamer.replace("{{id}}", MyAnimationTimeline[j][i].jump_id.gamer); img_gamer.target = "blank"; img_gamer.style.height = "43px"; img_gamer.appendChild(svg_gamer); jump_div.appendChild(img_gamer); animationJump.appendChild(jump_div); } if (MyAnimationTimeline[j][i].jump_id.iqiyi !== -1) { let jump_div = document.createElement("div"); jump_div.style.height = "100%"; jump_div.style.width = "43px"; jump_div.style.padding = "0 10px"; let img_iqiyi = document.createElement("a"); let svg_iqiyi = document.createElement("img"); svg_iqiyi.src = "https://img.zcool.cn/community/01218b5ebdd8b6a801207200d0937f.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100"; svg_iqiyi.style.height = "43px"; img_iqiyi.href = url_iqiyi.replace("{{id}}", MyAnimationTimeline[j][i].jump_id.iqiyi); img_iqiyi.target = "blank"; img_iqiyi.style.height = "43px"; img_iqiyi.appendChild(svg_iqiyi); jump_div.appendChild(img_iqiyi); animationJump.appendChild(jump_div); } if (MyAnimationTimeline[j][i].jump_id.acfun !== -1) { let jump_div = document.createElement("div"); jump_div.style.height = "100%"; jump_div.style.width = "43px"; jump_div.style.padding = "0 10px"; let img_acfun = document.createElement("a"); let svg_acfun = document.createElement("img"); svg_acfun.src = "https://img1.baidu.com/it/u=3203365066,1237761905&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"; svg_acfun.style.height = "43px"; img_acfun.href = url_acfun.replace("{{id}}", MyAnimationTimeline[j][i].jump_id.acfun); img_acfun.target = "blank"; img_acfun.style.height = "43px"; img_acfun.appendChild(svg_acfun); jump_div.appendChild(img_acfun); animationJump.appendChild(jump_div); } if (MyAnimationTimeline[j][i].jump_id.muse_hk !== -1) { let jump_div = document.createElement("div"); jump_div.style.height = "100%"; jump_div.style.width = "43px"; jump_div.style.padding = "0 10px"; let img_muse_hk = document.createElement("a"); let svg_muse_hk = document.createElement("img"); svg_muse_hk.src = "https://www.e-muse.com.tw/wp-content/themes/ks_emuse/assets/img/header/muse_logo.svg"; svg_muse_hk.style.height = "34px"; img_muse_hk.href = url_muse_hk.replace("{{id}}", MyAnimationTimeline[j][i].jump_id.muse_hk); img_muse_hk.target = "blank"; img_muse_hk.style.height = "43px"; img_muse_hk.appendChild(svg_muse_hk); jump_div.appendChild(img_muse_hk); animationJump.appendChild(jump_div); } if (MyAnimationTimeline[j][i].jump_id.ani_one !== -1) { let jump_div = document.createElement("div"); jump_div.style.height = "100%"; jump_div.style.width = "43px"; jump_div.style.padding = "0 10px"; let img_ani_one = document.createElement("a"); let svg_ani_one = document.createElement("img"); svg_ani_one.src = "https://img0.baidu.com/it/u=2390051341,1723763860&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=448"; svg_ani_one.style.height = "40px"; img_ani_one.href = url_ani_one.replace("{{id}}", MyAnimationTimeline[j][i].jump_id.ani_one); img_ani_one.target = "blank"; img_ani_one.style.height = "34px"; img_ani_one.appendChild(svg_ani_one); jump_div.appendChild(img_ani_one); animationJump.appendChild(jump_div); } seasonItem.addEventListener("click", function(j_id, aTime, aTitle, aJump) { if (animationTime.style.display === "none") { animationTime.style.display = "block"; animationTitle.style.display = "block"; animationJump.style.display = "none"; } else { animationTime.style.display = "none"; animationTitle.style.display = "none"; animationJump.style.display = "flex"; } }, (MyAnimationTimeline[j][i].jump_id, animationTime, animationTitle, animationJump)); aAnimationTitle.target = "_blank"; aAnimationTitle.innerHTML = MyAnimationTimeline[j][i].title; animationTitle.appendChild(aAnimationTitle); animationTitle.style.cssText = "float: left;width: 200px;height: 43px"; let hourTemp = parseInt(MyAnimationTimeline[j][i].time.substring(0, 2)); let minTemp = parseInt(MyAnimationTimeline[j][i].time.substring(3, 5)); if (flag === false) { animationTime.style.color = "#bf90f0"; animationTitle.style.color = "#bf90f0"; } else { if (j === day) { if (hour >= hourTemp && min >= minTemp) { animationTime.style.color = "#fb7299"; animationTitle.style.color = "#fb7299"; } } } seasonItem.appendChild(animationJump); seasonItem.appendChild(animationTime); seasonItem.appendChild(animationTitle); seasonList.appendChild(seasonItem); } tlHead.appendChild(seasonList); tlHeadList.appendChild(tlHead); } timeList.appendChild(arrowLeft); timeList.appendChild(tlWeeks); timeList.appendChild(arrowRight); switch (day) { case 0: document.querySelector(".t-week-0").style.color = "#fb7299"; document.querySelector(".t-date-0").style.color = "#fb7299"; break; case 1: document.querySelector(".t-week-1").style.color = "#fb7299"; document.querySelector(".t-date-1").style.color = "#fb7299"; break; case 2: document.querySelector(".t-week-2").style.color = "#fb7299"; document.querySelector(".t-date-2").style.color = "#fb7299"; break; case 3: document.querySelector(".t-week-3").style.color = "#fb7299"; document.querySelector(".t-date-3").style.color = "#fb7299"; break; case 4: document.querySelector(".t-week-4").style.color = "#fb7299"; document.querySelector(".t-date-4").style.color = "#fb7299"; break; case 5: document.querySelector(".t-week-5").style.color = "#fb7299"; document.querySelector(".t-date-5").style.color = "#fb7299"; break; case 6: document.querySelector(".t-week-6").style.color = "#fb7299"; document.querySelector(".t-date-6").style.color = "#fb7299"; break; } } function openEdge(url) { window.open("microsoft-edge:" + url); } function getWeekDates() { let date = new Date(); let weekData = []; const week = date.getDay() - 1; date = getDateByDate(date, week * -1); for (let i = 0; i < 7; i++) { weekData.push(formatDate(i == 0 ? date : getDateByDate(date, 1))) } return weekData; } ///////////////////////////// const formatDate = function(date = new Date()) { let year = date.getFullYear(); let month = (date.getMonth() + 1); let day = date.getDate(); let week = ['天', '一', '二', '三', '四', '五', '六'][date.getDay()]; const dateInfo = { date: new Date(date), dateStr: `${year}-${month.toString().padStart(2,'0')}-${day.toString().padStart(2,'0')}`, year, month, day, week, isToday: false } const today = new Date(); // 判断是否为当天 if (today.getFullYear() === year && (today.getMonth() + 1) === month && today.getDate() === day) { dateInfo['isToday'] = true; } return dateInfo; }; // 根据基准日期,获取长度为dayLenth的日期数组 const setDate = function(date = new Date(), step = 7) { let weekData = []; const week = date.getDay() - 1; date = getDateByDate(date, week * -1); for (let i = 0; i < step; i++) { weekData.push(formatDate(i == 0 ? date : getDateByDate(date, 1))) } return weekData; }; // 根据基准日期获取前后某天的日期对象 const getDateByDate = function(date = new Date(), range = 0) { date.setDate(date.getDate() + range); return date; }; /* 获取以baselineDate所在周的一周、前一周、下一周的日期和星期信息(切换周期也可通过参数dayLenth自行设置) baselineDate: 设置的基准日期(返回的日期列表的第一个日期) range: 以 baselineDate 为基准日期的前后天数范围(如基准日期的range为0,需要返回前7天日期,则range为-7,后7天则range为7) step: 需要获取的日期信息周期天数,默认获取baselineDate所在周的一周日期信息 */ const getWeekDate = ({ baselineDate = new Date(), range = 0, step = 7 }) => { return setDate(getDateByDate(baselineDate, range), step); }; ///////////////////////// function heightMeasurement(...waitElement) { //高度求和 var height = 0; for (var i = 0; i < waitElement.length; i++) { height += waitElement[i]; } return height + "px"; } function viscousHeight(waitElement, height, position, i) { //设置定位种类及top if (i === -1) { waitElement.style.position = position; waitElement.style.top = height + "px"; } if (i >= 0) { waitElement[i].style.position = position; waitElement[i].style.top = height + "px"; } } function deleteTopic() { const topicPanel = document.querySelector(".topic-panel"); document.querySelector(".bili-dyn-topic-box").removeChild(topicPanel); } function getURL_GM_livers(url) { //返回响应json return new Promise((resolve, reject) => { GM_xmlhttpRequest({ method: 'GET', url: url, synchronous: true, cookie: cookies, headers: { "Content-Type": "application/json; charset=utf-8", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", }, onload: function(response) { if (response.status >= 200 && response.status < 400) { resolve(response.responseText); } else { // alert("人呢!"); } } }); }) } async function GetPromiseAndWait(url) { let text = await getURL_GM_livers(url); text = JSON.parse(text); // return text.data.live_users.items === undefined ? null : text.data.live_users.items; return text.data.live_users === null ? null : text.data.live_users.items; } async function GetPromiseAndWait_0(url) { let text = await getURL_GM_livers(url); text = JSON.parse(text); return text; } function getURL_GM_livers_1(url) { //返回响应json return new Promise((resolve, reject) => { GM_xmlhttpRequest({ method: 'GET', url: url, synchronous: true, headers: { "Content-Type": "application/json; charset=utf-8", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", }, onload: function(response) { if (response.status >= 200 && response.status < 400) { resolve(response.responseText); } else { // alert("人呢!"); } } }); }) } async function GetPromiseAndWait_1(url) { let text = await getURL_GM_livers_1(url); text = JSON.parse(text); return text.items; // return ('items' in text) ? text.items : null; } function getURL_GM_livers_2(url) { //返回响应json return new Promise((resolve, reject) => { GM_xmlhttpRequest({ method: 'GET', url: url, synchronous: true, headers: { "Content-Type": "application/json; charset=utf-8", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", Authorization: 'Bearer ' + GM_getValue('bearer'), }, onload: function(response) { if (response.status >= 200 && response.status < 400) { resolve(response.responseText); } else { alert('若想使用番剧时间表功能请先前往 "https://bgmlist.com/" 网站登录并关注喜欢的番剧'); } } }); }) } async function GetPromiseAndWait_2(url) { let text = await getURL_GM_livers_2(url); text = JSON.parse(text); return text.watching; } function timeConversion(time) { //世界时间转换本地时间 // var utcTime = new Date(time); // var localTime = new Date(utcTime.getTime() + utcTime.getTimezoneOffset() 60 1000); var localTime = new Date(time); return localTime; } function splicingCookie() { var cookies = document.cookie; return cookies; } } else { let bearer = localStorage.getItem('bgmlist:credential'); GM_setValue('bearer', bearer); } })();