BiliBiliEX - 视频下载、回到旧版
// ==UserScript==
// @name BiliBiliEX - 视频下载、回到旧版
// @version 1.3
// @description BiliBili扩展
// @author Miss & We & fei li
// @match https://www.bilibili.com/video/*
// @match https://*.bilibili.com/*
// @require https://gitee.com/ASev/oil-monkey-script/raw/master/JavaScript/down.js
// @grant GM_registerMenuCommand
// ==/UserScript==
(function() {
'use strict';
// Your code here...
//back_old()
//back_new()
GM_registerMenuCommand("回到旧版", back_old);
GM_registerMenuCommand("重回新版", back_new);
bili_down()
})();
function back_old(){
var cookieValue = getCookie('go_old_video')
if (cookieValue == "-1") {
console.log(
`%c 已回到旧版BiliBili`,
"background: #222; color: #bada55"
);
document.cookie = "go_old_video=1; domain=.bilibili.com";
document.cookie = "i-wanna-go-back=1; domain=.bilibili.com";
document.cookie = "nostalgia_conf=1; domain=.bilibili.com";
location.reload();
}
}
function back_new(){
var cookieValue = getCookie('go_old_video')
if (cookieValue == "1") {
console.log(
`%c 已来到新版BiliBili`,
"background: #222; color: #bada55"
);
document.cookie = "go_old_video=-1; domain=.bilibili.com";
document.cookie = "i-wanna-go-back=-1; domain=.bilibili.com";
document.cookie = "nostalgia_conf=-1; domain=.bilibili.com";
location.reload();
}
}
function getCookie(cookieName) {
const strCookie = document.cookie
const cookieList = strCookie.split(';')
for(let i = 0; i < cookieList.length; i++) {
const arr = cookieList[i].split('=')
if (cookieName === arr[0].trim()) {
return arr[1]
}
}
return ''
}