Merge branch 'preview' of https://github.com/the1812/Bilibili-Evolved into preview

This commit is contained in:
Coulomb 2019-01-20 17:24:08 +08:00
commit 8e3b6ef6ec
4 changed files with 33 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(()=>{return(e,t)=>{(async()=>{const e=await SpinQuery.select(()=>document.querySelector(`input[key=defaultPlayerLayout]`));const t=await SpinQuery.select(()=>document.querySelector(`input[key=defaultBangumiLayout]`));if(!e||!t){logError("无法加载播放器布局选项.");return}class o{setCookie(e,t){document.cookie=`${e}=${t};path=/;domain=.bilibili.com;max-age=31536000`}clearCookie(e){document.cookie=`${e}=;path=/;domain=.bilibili.com;max-age=0`}getValue(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)${e}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1")}useNewLayout(){}useOldLayout(){}setLayout(e){if(e){this.useNewLayout()}else{this.useOldLayout()}}}class s extends o{constructor(){super();this.cookieKey="stardustvideo"}useNewLayout(){this.setCookie(this.cookieKey,1)}useOldLayout(){this.setCookie(this.cookieKey,-1)}}class i extends o{constructor(){super();this.cookieKey="stardustpgcv"}useNewLayout(){this.setCookie(this.cookieKey,"0606")}useOldLayout(){this.setCookie(this.cookieKey,0)}}const u=new s;$(e).on("input",()=>{u.setLayout(e.value==="新版")});const a=new i;$(t).on("input",()=>{a.setLayout(t.value==="新版")})})()}})();
(()=>{return(e,t)=>{(async()=>{const t=await SpinQuery.select(()=>document.querySelector(`input[key=defaultPlayerLayout]`));const o=await SpinQuery.select(()=>document.querySelector(`input[key=defaultBangumiLayout]`));if(!t||!o){logError("无法加载播放器布局选项.");return}class s{setCookie(e,t){document.cookie=`${e}=${t};path=/;domain=.bilibili.com;max-age=31536000`}clearCookie(e){document.cookie=`${e}=;path=/;domain=.bilibili.com;max-age=0`}getValue(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)${e}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1")}useNewLayout(){}useOldLayout(){}setLayout(e){if(e){this.useNewLayout()}else{this.useOldLayout()}}}class i extends s{checkCookies(){const t=this.getValue(this.cookieKey);if(t===""||parseInt(t)<0){e.defaultPlayerLayout="旧版"}else{e.defaultPlayerLayout="新版"}saveSettings(e)}constructor(){super();this.cookieKey="stardustvideo";this.checkCookies()}useNewLayout(){this.setCookie(this.cookieKey,1)}useOldLayout(){this.setCookie(this.cookieKey,-1)}}class u extends s{checkCookies(){const t=this.getValue(this.cookieKey);if(t===""||parseInt(t)<=0){e.defaultBangumiLayout="旧版"}else{e.defaultBangumiLayout="新版"}saveSettings(e)}constructor(){super();this.cookieKey="stardustpgcv";this.checkCookies()}useNewLayout(){this.setCookie(this.cookieKey,"0606")}useOldLayout(){this.setCookie(this.cookieKey,0)}}const a=new i;$(t).on("input",()=>{a.setLayout(t.value==="新版")});const c=new u;$(o).on("input",()=>{c.setLayout(o.value==="新版")})})()}})();

View File

@ -41,10 +41,24 @@
}
class VideoLayoutCookie extends LayoutCookie
{
checkCookies()
{
const value = this.getValue(this.cookieKey);
if (value === "" || parseInt(value) < 0)
{
settings.defaultPlayerLayout = "旧版";
}
else
{
settings.defaultPlayerLayout = "新版";
}
saveSettings(settings);
}
constructor()
{
super();
this.cookieKey = "stardustvideo";
this.checkCookies();
}
useNewLayout()
{
@ -57,10 +71,24 @@
}
class BangumiLayoutCookie extends LayoutCookie
{
checkCookies()
{
const value = this.getValue(this.cookieKey);
if (value === "" || parseInt(value) <= 0)
{
settings.defaultBangumiLayout = "旧版";
}
else
{
settings.defaultBangumiLayout = "新版";
}
saveSettings(settings);
}
constructor()
{
super();
this.cookieKey = "stardustpgcv";
this.checkCookies();
}
useNewLayout()
{