This commit is contained in:
杜恒 2021-04-21 15:09:39 +08:00
parent 7a0e201284
commit 8056d8c0e8
16 changed files with 173 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@ -2214,6 +2214,42 @@
}
}
}
&-progress {
width: 100%;
display: flex;
align-items: center;
.strip {
height: 12px;
border-radius: 6px;
overflow: hidden;
background: var(--classC);;
min-width: 0;
flex: 1;
margin-right: 10px;
.percent {
position: relative;
display: block;
height: 100%;
border-radius: 6px;
transition: width 0.35s;
&::before{
content: "";
opacity: 0;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #fff;
border-radius: 6px;
animation: progress-active 3s ease-in-out infinite;
}
}
}
.percentage {
color: var(--minor);
}
}
/* 以下未测试 */
&-protected {
@ -3362,3 +3398,13 @@
clip-path: circle(100%);
}
}
@keyframes progress-active {
0% {
opacity: .3;
width: 0
}
to {
opacity: 0;
width: 100%
}
}

View File

@ -179,11 +179,28 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
window.customElements.define('joe-message', JoeMessage);
class JoeProgress extends HTMLElement {
constructor() {
super();
this.options = {
percentage: /^\d{1,3}%$/.test(this.getAttribute('percentage')) ? this.getAttribute('percentage') : '50%',
color: this.getAttribute('color') || '#ff6c6c'
};
this.innerHTML = `
<span class="joe_detail__article-progress">
<span class="strip">
<span class="percent" style="width: ${this.options.percentage}; background: ${this.options.color};"></span>
</span>
<span class="percentage">${this.options.percentage}</span>
</span>
`;
}
}
window.customElements.define('joe-progress', JoeProgress);
const article = document.querySelector('.joe_detail__article');
if (article) article.innerHTML = article.innerHTML.replace(/<p><\/p>/g, '');
/*
------------------------以下未测试------------------------------------------
*/

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,7 @@ class Editor
?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=202104200955') ?>">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=20210421') ?>">
<script>
window.JoeConfig = {
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
@ -62,9 +62,9 @@ class Editor
}
</script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=202104200955') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=202104200955') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=202104200955') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=20210421') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210421') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=20210421') ?>"></script>
<?php
}
}

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */
function _getVersion()
{
return "6.5.0";
return "6.5.1";
};
/* 判断是否是手机 */

View File

@ -34,6 +34,12 @@ function _parseContent($post, $login)
if (strpos($content, '{dotted') !== false) {
$content = preg_replace('/{dotted([^}]*)\/}/SU', '<joe-dotted $1></joe-dotted>', $content);
}
if (strpos($content, '{message') !== false) {
$content = preg_replace('/{message([^}]*)\/}/SU', '<joe-message $1></joe-message>', $content);
}
if (strpos($content, '{progress') !== false) {
$content = preg_replace('/{progress([^}]*)\/}/SU', '<joe-progress $1></joe-progress>', $content);
}
if (strpos($content, '{hide') !== false) {
$db = Typecho_Db::get();
$hasComment = $db->fetchAll($db->select()->from('table.comments')->where('cid = ?', $post->cid)->where('mail = ?', $post->remember('mail', true))->limit(1));
@ -55,15 +61,5 @@ function _parseContent($post, $login)
$content = preg_replace('/{copy(.*)}/SU', '<joe-copy $1>', $content);
$content = preg_replace('/{\/copy}/SU', '</joe-copy>', $content);
}
/* 过滤消息提示 */
if (strpos($content, '{message') !== false) {
$content = preg_replace('/{message(.*)}/SU', '<joe-message $1>', $content);
$content = preg_replace('/{\/message}/SU', '</joe-message>', $content);
}
/* 时间线 */
if (strpos($content, '{timeline') !== false) {
$content = strtr($content, array("{timeline}" => '<joe-timeline>', "{/timeline}" => '</joe-timeline>'));
$content = strtr($content, array("{timeline-item}" => '<joe-timeline-item>', "{/timeline-item}" => '</joe-timeline-item>'));
}
echo $content;
}

View File

@ -1,6 +1,6 @@
{
"name": "typecho-joe-next",
"version": "6.5.0",
"version": "6.5.1",
"description": "A Theme Of Typecho",
"main": "index.php",
"keywords": [

View File

@ -18,7 +18,7 @@
<?php endif; ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=202104191518'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=20210421'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css'); ?>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/qmsg/qmsg.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
@ -38,6 +38,6 @@
<?php if ($this->options->JCursorEffects && $this->options->JCursorEffects !== 'off') : ?>
<script src="<?php $this->options->themeUrl('assets/cursor/' . $this->options->JCursorEffects); ?>" async></script>
<?php endif; ?>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=202104191518'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=202104191518'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=20210421'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=20210421'); ?>"></script>
<?php $this->options->JCustomHeadEnd() ?>

File diff suppressed because one or more lines are too long

View File

@ -892,9 +892,56 @@ body.fullscreen {
display: block;
}
}
.joe_detail__article-progress {
width: 100%;
display: flex;
align-items: center;
.strip {
height: 12px;
border-radius: 6px;
overflow: hidden;
background: #ebeef5;
min-width: 0;
flex: 1;
margin-right: 10px;
.percent {
position: relative;
display: block;
height: 100%;
border-radius: 6px;
transition: width 0.35s;
&::before{
content: "";
opacity: 0;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #fff;
border-radius: 6px;
animation: progress-active 3s ease-in-out infinite;
}
}
}
.percentage {
color: #909399;
}
}
@media (max-width: 768px) {
.cm-modal__wrapper {
width: 90%;
}
}
@keyframes progress-active {
0% {
opacity: .3;
width: 0
}
to {
opacity: 0;
width: 100%
}
}

View File

@ -638,4 +638,27 @@ export default class JoeAction {
}
});
}
handleProgress(cm) {
this._openModal({
title: '进度条',
innerHtml: `
<div class="fitem">
<label>百分比数</label>
<input autocomplete="off" name="percentage" placeholder="请输入百分比最大100%"/>
</div>
<div class="fitem">
<label>自定义色</label>
<input style="width: 44px;padding: 0 2px;flex: none" autocomplete="off" value="#ff6c6c" name="color" type="color"/>
</div>
`,
confirm: () => {
const percentage = $(".cm-modal input[name='percentage']").val();
const color = $(".cm-modal input[name='color']").val();
const str = `\n{progress percentage="${percentage}" color="${color}"/}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str);
cm.focus();
}
});
}
}

View File

@ -25,6 +25,7 @@ export default function createPreviewHtml(str) {
str = str.replace(/{anote([^}]*)\/}/g, '<joe-anote $1></joe-anote>');
str = str.replace(/{dotted([^}]*)\/}/g, '<joe-dotted $1></joe-dotted>');
str = str.replace(/{message([^}]*)\/}/g, '<joe-message $1></joe-message>');
str = str.replace(/{progress([^}]*)\/}/g, '<joe-progress $1></joe-progress>');
str = str.replace(/{hide[^}]*}([\s\S]*?){\/hide}/g, '<joe-hide></joe-hide>');
str = str.replace(/{card-default([^}]*)}([\s\S]*?){\/card-default}/g, '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>');

View File

@ -170,6 +170,11 @@ export default [
title: '消息提示',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M195.181 164.694c-13.024-13.029-34.144-13.029-47.159 0-13.029 13.019-13.029 34.134 0 47.163l47.159 47.158c13.024 13.024 34.129 13.024 47.162 0 13.019-13.019 13.019-34.129 0-47.158l-47.162-47.163zm633.634 0l-47.162 47.163c-13.02 13.029-13.02 34.139 0 47.158 13.009 13.024 34.129 13.024 47.162 0l47.148-47.158c13.029-13.029 13.029-34.139 0-47.163-13.019-13.024-34.124-13.024-47.148 0zM111.809 428.626H45.115c-18.416 0-33.352 14.928-33.352 33.342 0 18.419 14.933 33.351 33.352 33.351h66.698c18.415 0 33.347-14.931 33.347-33.351 0-18.415-14.933-33.342-33.347-33.342h-.004zm867.072 0h-66.698c-18.416 0-33.352 14.928-33.352 33.342 0 18.419 14.933 33.351 33.352 33.351h66.693c18.419 0 33.361-14.931 33.361-33.351 0-18.415-14.941-33.342-33.361-33.342h.005zM478.648 45.108v66.698c0 18.42 14.928 33.347 33.347 33.347 18.41 0 33.351-14.928 33.351-33.347V45.108c0-18.415-14.941-33.347-33.351-33.347-18.419 0-33.347 14.933-33.347 33.347zM278.557 511.993c0-128.923 104.506-233.438 233.438-233.438 128.927 0 233.442 104.516 233.442 233.438 0 128.926-104.515 233.447-233.442 233.447-128.932 0-233.438-104.52-233.438-233.447zm-66.698 0c0 165.78 134.365 300.155 300.137 300.155 165.766 0 300.141-134.375 300.141-300.155 0-165.767-134.376-300.137-300.141-300.137-165.767.001-300.137 134.371-300.137 300.137zm233.437 466.895c0 18.405 14.933 33.351 33.352 33.351h66.698c18.419 0 33.347-14.946 33.347-33.351 0-18.429-14.928-33.347-33.347-33.347h-66.698c-18.419 0-33.352 14.918-33.352 33.347zm-66.693-100.045c0 18.405 14.933 33.346 33.342 33.346h200.096c18.419 0 33.351-14.941 33.351-33.346 0-18.434-14.931-33.357-33.351-33.357H411.945c-18.414 0-33.342 14.923-33.342 33.357zm0 0"/></svg>'
},
{
type: 'progress',
title: '进度条',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M757.76 323.482a188.518 188.518 0 0 1 0 377.036H266.24a188.518 188.518 0 1 1 0-377.036h491.52zm0 66.56H502.63l-72.96 243.814H757.71a121.958 121.958 0 0 0 8.397-243.558l-8.397-.308z"/></svg>'
},
/* --------------------------- 短代码结束 --------------------------- */
{
type: 'clean',

File diff suppressed because one or more lines are too long

View File

@ -298,6 +298,9 @@ class Joe extends JoeAction {
case 'message':
super.handleMessage(this.cm);
break;
case 'progress':
super.handleProgress(this.cm);
break;
}
});
$('.cm-tools').append(el);