Improve toast

This commit is contained in:
the1812 2018-09-29 16:12:03 +08:00
parent 3d5517264c
commit 14f65424cd
7 changed files with 23 additions and 22 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,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Bilibili Evolved (Preview) // @name Bilibili Evolved (Preview)
// @version 1.4.4 // @version 1.4.5
// @description 增强哔哩哔哩Web端体验. (预览版分支) // @description 增强哔哩哔哩Web端体验. (预览版分支)
// @author Grant Howard, Coulomb-G // @author Grant Howard, Coulomb-G
// @match *://*.bilibili.com/* // @match *://*.bilibili.com/*
@ -52,7 +52,7 @@
notifyNewVersion: true, notifyNewVersion: true,
fixFullscreen: false, fixFullscreen: false,
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js", latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js",
currentVersion: "1.4.4" currentVersion: "1.4.5"
}; };
function loadSettings() function loadSettings()
{ {
@ -686,14 +686,14 @@
{ {
// execution error // execution error
console.error(`Failed to apply feature "${key}": ${error}`); console.error(`Failed to apply feature "${key}": ${error}`);
Toast.error(`加载组件"${Resource.all[key].displayName}"失败.`, "错误"); Toast.error(`加载组件<span>${Resource.all[key].displayName}</span>失败.`, "错误");
} }
} }
}).catch(reason => }).catch(reason =>
{ {
// download error // download error
console.error(`Download error, XHR status: ${reason}`); console.error(`Download error, XHR status: ${reason}`);
Toast.error(`无法下载"${Resource.all[key].displayName}"组件.`, "错误"); Toast.error(`无法下载组件<span>${Resource.all[key].displayName}</span>.`, "错误");
}); });
return promise; return promise;
} }

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Bilibili Evolved // @name Bilibili Evolved
// @version 1.4.4 // @version 1.4.5
// @description 增强哔哩哔哩Web端体验. // @description 增强哔哩哔哩Web端体验.
// @author Grant Howard, Coulomb-G // @author Grant Howard, Coulomb-G
// @match *://*.bilibili.com/* // @match *://*.bilibili.com/*
@ -52,7 +52,7 @@
notifyNewVersion: true, notifyNewVersion: true,
fixFullscreen: false, fixFullscreen: false,
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/master/bilibili-evolved.user.js", latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/master/bilibili-evolved.user.js",
currentVersion: "1.4.4" currentVersion: "1.4.5"
}; };
function loadSettings() function loadSettings()
{ {
@ -686,14 +686,14 @@
{ {
// execution error // execution error
console.error(`Failed to apply feature "${key}": ${error}`); console.error(`Failed to apply feature "${key}": ${error}`);
Toast.error(`加载组件"${Resource.all[key].displayName}"失败.`, "错误"); Toast.error(`加载组件<span>${Resource.all[key].displayName}</span>失败.`, "错误");
} }
} }
}).catch(reason => }).catch(reason =>
{ {
// download error // download error
console.error(`Download error, XHR status: ${reason}`); console.error(`Download error, XHR status: ${reason}`);
Toast.error(`无法下载"${Resource.all[key].displayName}"组件.`, "错误"); Toast.error(`无法下载组件<span>${Resource.all[key].displayName}</span>.`, "错误");
}); });
return promise; return promise;
} }

View File

@ -1 +1 @@
.toast-card-container{position:fixed;left:16px;bottom:16px;display:flex;flex-direction:column;align-items:start;z-index:99999;}.toast-card{background:#444;min-width:240px;border-radius:8px;box-shadow:0 1px 20px rgba(0,0,0,.1);height:0;transition:all 0.3s cubic-bezier(0.18,0.89,0.32,1.28);transform:translateY(16px);transform-origin:bottom;opacity:0;overflow:hidden;display:flex;flex-direction:column;}.toast-card.visible{height:96px;transform:scale(1) translateY(0);opacity:0.95;margin-top:16px;}.toast-card-header{display:flex;align-items:center;}.toast-card-title{font-size:18px;color:#fff6;margin:16px;font-weight:bold;flex:1 1 auto;}svg.toast-card-dismiss{height:24px;width:24px;flex:0 0 auto;padding:16px;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:all .2s ease-out;transform-origin:center;}svg.toast-card-dismiss:hover{transform:scale(1.2);}svg.toast-card-dismiss:active{transform:scale(1.1);}svg.toast-card-dismiss path{fill:#fff6;}.toast-card-message{color:#eeed;font-size:14px;margin:16px;margin-top:0;}.toast-card.toast-default{background:#444;}.toast-card.toast-error{background:#652020;}.toast-card.toast-info{background:#303d61;}.toast-card.toast-success{background:#274227;}.toast-card .link{display:inline-block;padding:4px 8px;background-color:rgba(0,0,0,.1);border-radius:4px;text-decoration:none;color:#eeed;transition:all .2s ease-out;}.toast-card .link:hover{background-color:rgba(0,0,0,.2);}.toast-card .link:active{background-color:rgba(0,0,0,.1);} .toast-card-container{position:fixed;left:16px;bottom:16px;display:flex;flex-direction:column;align-items:start;z-index:99999;}.toast-card{background:#444;min-width:240px;border-radius:8px;box-shadow:0 1px 20px rgba(0,0,0,.1);height:0;transition:all 0.3s cubic-bezier(0.18,0.89,0.32,1.28);transform:translateY(16px);transform-origin:bottom;opacity:0;overflow:hidden;display:flex;flex-direction:column;}.toast-card.visible{height:96px;transform:scale(1) translateY(0);opacity:0.95;margin-top:16px;}.toast-card-header{display:flex;align-items:center;}.toast-card-title{font-size:18px;color:#fff6;margin:16px;font-weight:bold;flex:1 1 auto;}svg.toast-card-dismiss{height:24px;width:24px;flex:0 0 auto;padding:16px;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:all .2s ease-out;transform-origin:center;}svg.toast-card-dismiss:hover{transform:scale(1.2);}svg.toast-card-dismiss:active{transform:scale(1.1);}svg.toast-card-dismiss path{fill:#fff6;}.toast-card-message{color:#eeed;font-size:14px;margin:16px;margin-top:0;}.toast-card.toast-default{background:#444;}.toast-card.toast-error{background:#652020;}.toast-card.toast-info{background:#303d61;}.toast-card.toast-success{background:#274227;}.toast-card span,.toast-card .link{display:inline-block;padding:4px 8px;background-color:rgba(0,0,0,.1);border-radius:4px;text-decoration:none;color:#eeed;transition:all .2s ease-out;}.toast-card .link:hover{background-color:rgba(0,0,0,.2);}.toast-card .link:active{background-color:rgba(0,0,0,.1);}

View File

@ -88,6 +88,7 @@ svg.toast-card-dismiss path
{ {
background: #274227; background: #274227;
} }
.toast-card span,
.toast-card .link .toast-card .link
{ {
display: inline-block; display: inline-block;

View File

@ -1 +1 @@
1.4.4 1.4.5