This commit is contained in:
杜恒
2021-04-19 15:18:29 +08:00
parent 3bcf16d512
commit 6f625826ad
15 changed files with 328 additions and 249 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1867,10 +1867,195 @@
}
}
}
&-checkbox {
-webkit-appearance: none;
position: relative;
border-radius: 2px;
width: 15px;
height: 15px;
border: 2px solid var(--theme);
vertical-align: -2px;
&:disabled {
cursor: not-allowed;
}
&:checked {
border: none;
background: var(--theme);
&::after {
content: '';
width: 3px;
height: 7px;
position: absolute;
top: 2px;
left: 5px;
border: 2px solid #fff;
border-top: 0;
border-left: 0;
transform: rotate(45deg);
}
}
}
&-player {
width: 100%;
height: 500px;
}
&-card_default {
display: block;
margin: 0 auto;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: var(--radius-inner);
border: 1px solid var(--classC);
background: var(--background);
> .title {
display: block;
padding: 8px 12px;
border-bottom: 1px solid var(--classC);
color: var(--main);
user-select: none;
}
> .content {
display: block;
padding: 12px;
color: var(--routine);
*:last-child {
margin-bottom: 0 !important;
}
}
}
&-mtitle {
display: flex;
justify-content: center;
> .text {
position: relative;
color: var(--minor);
padding: 0 12px;
transition: padding 0.35s;
&:hover {
padding: 0;
}
&::before,
&::after {
content: '';
position: absolute;
top: 50%;
width: 20px;
height: 1px;
background: var(--theme);
}
&::before {
left: -35px;
}
&::after {
right: -35px;
}
}
}
&-hide {
display: block;
background: repeating-linear-gradient(145deg, var(--classD), var(--classD) 15px, var(--background) 0, var(--background) 25px);
padding: 15px 0;
text-align: center;
position: relative;
user-select: none;
line-height: normal;
> i {
position: relative;
font-style: normal;
cursor: pointer;
color: var(--theme);
}
}
&-abtn {
display: inline-block;
color: #fff;
height: 35px;
line-height: 35px;
padding: 0 15px;
transform-origin: 100% 0;
transform: translateZ(0);
&:hover {
animation-name: wobble-bottom;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
> .icon {
display: inline-block;
vertical-align: top;
text-align: center;
.fa {
color: #fff;
}
[class^='fa-'] {
margin-right: 8px;
}
}
> .content {
color: #fff;
display: inline-block;
vertical-align: top;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
&-anote {
position: relative;
display: inline-block;
color: #fff;
height: 35px;
line-height: 35px;
transform: translateZ(0);
transition: transform 0.35s;
&:hover {
transform: translateY(-3px);
}
> .icon {
display: inline-block;
vertical-align: top;
width: 35px;
height: 35px;
text-align: center;
background: rgba(0, 0, 0, 0.2);
.fa {
color: #fff;
}
}
> .content {
color: #fff;
display: inline-block;
vertical-align: top;
padding: 0 12px;
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&.secondary {
background: #34495e;
}
&.success {
background: #27ae60;
}
&.warning {
background: #f39c12;
}
&.error {
background: #e74c3c;
}
&.info {
background: #3498db;
}
}
&-dotted {
display: block;
width: 100%;
height: 2px;
background-size: 80px;
}
/* 以下未测试 */
&-protected {
display: flex;
justify-content: center;
@@ -1907,65 +2092,6 @@
}
}
}
&-checkbox {
-webkit-appearance: none;
position: relative;
border-radius: 2px;
width: 15px;
height: 15px;
border: 2px solid var(--theme);
vertical-align: -2px;
&:disabled {
cursor: not-allowed;
}
&:checked {
border: none;
background: var(--theme);
&::after {
content: '';
width: 3px;
height: 7px;
position: absolute;
top: 2px;
left: 5px;
border: 2px solid #fff;
border-top: 0;
border-left: 0;
transform: rotate(45deg);
}
}
}
&-card {
margin: 0 auto;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: var(--radius-inner);
border: 1px solid var(--classC);
background: var(--background);
.title {
padding: 8px 10px;
border-bottom: 1px solid var(--classC);
color: var(--main);
user-select: none;
}
.content {
padding: 10px;
color: var(--routine);
}
}
&-hide {
background: repeating-linear-gradient(145deg, var(--classD), var(--classD) 15px, var(--background) 0, var(--background) 25px);
padding: 15px 0;
text-align: center;
position: relative;
user-select: none;
line-height: normal;
i {
position: relative;
font-style: normal;
cursor: pointer;
color: var(--theme);
}
}
&-message {
position: relative;
border-left-width: 4px;
@@ -2043,117 +2169,6 @@
}
}
}
&-mtitle {
display: flex;
justify-content: center;
.text {
position: relative;
color: var(--minor);
padding: 0 12px;
transition: padding 0.35s;
&:hover {
padding: 0;
}
&::before,
&::after {
content: '';
position: absolute;
top: 50%;
width: 20px;
height: 1px;
background: var(--theme);
}
&::before {
left: -35px;
}
&::after {
right: -35px;
}
}
}
&-anote {
position: relative;
display: inline-block;
color: #fff;
height: 35px;
line-height: 35px;
transform: translateZ(0);
transition: transform 0.35s;
&:hover {
transform: translateY(-3px);
}
.icon {
display: inline-block;
vertical-align: top;
width: 35px;
height: 35px;
text-align: center;
background: rgba(0, 0, 0, 0.2);
.fa {
color: #fff;
}
}
.content {
color: #fff;
display: inline-block;
vertical-align: top;
padding: 0 12px;
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&.secondary {
background: #34495e;
}
&.success {
background: #27ae60;
}
&.warning {
background: #f39c12;
}
&.error {
background: #e74c3c;
}
&.info {
background: #3498db;
}
}
&-abtn {
display: inline-block;
color: #fff;
height: 35px;
line-height: 35px;
padding: 0 15px;
transform-origin: 100% 0;
transform: translateZ(0);
&:hover {
animation-name: wobble-bottom;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
.icon {
display: inline-block;
vertical-align: top;
text-align: center;
.fa {
color: #fff;
}
[class^='fa-'] {
margin-right: 8px;
}
}
.content {
color: #fff;
display: inline-block;
vertical-align: top;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
&-copy {
cursor: pointer;
user-select: none;
@@ -2237,11 +2252,6 @@
}
}
}
&-dotted {
width: 100%;
height: 2px;
background-size: 80px;
}
}
&__agree {
display: flex;

View File

@@ -3,11 +3,11 @@ document.addEventListener('DOMContentLoaded', () => {
constructor() {
super();
this.innerHTML = `
<div class="joe_detail__article-mtitle">
<span class="joe_detail__article-mtitle">
<span class="text">
${this.getAttribute('title') || '默认标题'}
</span>
</div>`;
</span>`;
}
}
window.customElements.define('joe-mtitle', JoeMtitle);
@@ -114,7 +114,7 @@ document.addEventListener('DOMContentLoaded', () => {
this.startColor = this.getAttribute('startColor') || '#ff6c6c';
this.endColor = this.getAttribute('endColor') || '#1989fa';
this.innerHTML = `
<div class="joe_detail__article-dotted" style="background-image: repeating-linear-gradient(-45deg, ${this.startColor} 0, ${this.startColor} 20%, transparent 0, transparent 25%, ${this.endColor} 0, ${this.endColor} 45%, transparent 0, transparent 50%)"></div>
<span class="joe_detail__article-dotted" style="background-image: repeating-linear-gradient(-45deg, ${this.startColor} 0, ${this.startColor} 20%, transparent 0, transparent 25%, ${this.endColor} 0, ${this.endColor} 45%, transparent 0, transparent 50%)"></span>
`;
}
}
@@ -125,7 +125,7 @@ document.addEventListener('DOMContentLoaded', () => {
this.render();
}
render() {
this.innerHTML = '<div class="joe_detail__article-hide">此处内容作者设置了 <i>回复</i> 可见</div>';
this.innerHTML = '<span class="joe_detail__article-hide">此处内容作者设置了 <i>回复</i> 可见</span>';
this.$button = this.querySelector('i');
const $comment = document.querySelector('.joe_comment');
const $header = document.querySelector('.joe_header');
@@ -137,11 +137,39 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
window.customElements.define('joe-hide', JoeHide);
class JoeCardDefault extends HTMLElement {
constructor() {
super();
const _temp = this.querySelector('._temp');
this.options = {
width: this.getAttribute('width') || '100%',
label: this.getAttribute('label') || '卡片标题',
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '卡片内容'
};
const htmlStr = `
<span class="joe_detail__article-card_default" style="width: ${this.options.width}">
<span class="title">${this.options.label}</span>
<span class="content">${this.options.content}</span>
</span>
`;
if (this.querySelector('._content')) {
this.querySelector('._content').innerHTML = htmlStr;
} else {
const div = document.createElement('div');
div.className = '_content';
div.innerHTML = htmlStr;
this.appendChild(div);
}
}
}
window.customElements.define('joe-card-default', JoeCardDefault);
const article = document.querySelector('.joe_detail__article');
if (article) article.innerHTML = article.innerHTML.replace(/<p><\/p>/g, '');
/*
------------------------以下未测试------------------------------------------
*/
/* 点击复制 */
class JoeCopy extends HTMLElement {
constructor() {
@@ -188,28 +216,4 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
window.customElements.define('joe-message', JoeMessage);
/* 默认卡片 */
class JoeCard extends HTMLElement {
constructor() {
super();
this.options = {
width: this.getAttribute('width') || '100%',
label: this.getAttribute('label') || '默认标题',
content: this.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '默认内容'
};
this.render();
}
get template() {
return `
<div class="joe_detail__article-card" style="width: ${this.options.width}">
<div class="title">${this.options.label}</div>
<div class="content">${this.options.content}</div>
</div>
`;
}
render() {
this.innerHTML = this.template;
}
}
window.customElements.define('joe-card', JoeCard);
});

File diff suppressed because one or more lines are too long