diff --git a/.build.php b/.build.php
index a31910f..df1f228 100644
--- a/.build.php
+++ b/.build.php
@@ -60,16 +60,3 @@ function fetchFiles(string $subdir)
return $files;
}
-
-/**
- * GitHub Action
- * 自动更新 Hash 文件
- */
-
-$files = fetchFiles('./');
-$hash = [];
-
-foreach ($files as $file)
- $hash[] = hash('sha256', file_get_contents($file)) . ' ' . $file;
-
-file_put_contents(__DIR__ . "/hash.txt", implode("\n", $hash));
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fece176..f6b436f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: Auto Build
+name: Build-Ci
on:
push:
@@ -9,14 +9,13 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- - name: Check
+ - name: Checkout
uses: actions/checkout@v1
- - name: Build
- run: php .build.php
- - name: Commit
- uses: stefanzweifel/git-auto-commit-action@v2.5.0
+ - name: Build MDr-Petals
+ run: |
+ php .build.php
+ - name: Upload Artifact
+ uses: actions/upload-artifact@v2
with:
- commit_message: Auto Build
- branch: petals
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ name: sci-hub-p2p-frontend-${{ matrix.node-version }}
+ path: ./
\ No newline at end of file
diff --git a/.github/workflows/hash.yml b/.github/workflows/hash.yml
deleted file mode 100644
index d3a24ae..0000000
--- a/.github/workflows/hash.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Auto Hash
-
-on:
- push:
- branches:
- - master
-
-jobs:
- run:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v1
- - name: Running update.php hash
- run: php update.php hash
- - name: Commit hash.txt
- uses: stefanzweifel/git-auto-commit-action@v2.5.0
- with:
- commit_message: Update hash.txt
- branch: master
- file_pattern: hash.txt
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/comments.php b/comments.php
index b9e73b2..68dce95 100644
--- a/comments.php
+++ b/comments.php
@@ -1,14 +1,15 @@
permalink) :
- if (!$this->user->hasLogin()) :
- $showLimited = true;
- else :
- if (!$this->user->pass('editor', true)) :
+if (count(FindContents('page-whisper.php')) > 0)
+ if (FindContents('page-whisper.php')[0]["permalink"] == $this->permalink) :
+ if (!$this->user->hasLogin()) :
$showLimited = true;
+ else :
+ if (!$this->user->pass('editor', true)) :
+ $showLimited = true;
+ endif;
endif;
endif;
-endif;
if ($showLimited) :
echo '';
endif;
diff --git a/core/config.ini.php b/core/config.ini.php
index 50e88a9..5982a69 100644
--- a/core/config.ini.php
+++ b/core/config.ini.php
@@ -11,4 +11,7 @@
'mdrCopytext' => null, // 自定义底部版权所属,默认为站点名称。
'mdrMDUICDNlink' => null, // MDUI 静态资源自建地址,只在上面的选项选择自建时需要。
'mdrcjCDNlink' => null, // 其他公共静态资源自建地址,只在上面的选项选择自建时需要。
-]);
\ No newline at end of file
+ 'mdrSponsor' => [
+ //['爱发电', 'deep-purple-accent', 'https://afdian.net'],
+ ], //参照上述格式
+]);
diff --git a/core/css/style-petals.css b/core/css/style-petals.css
index eafa83c..e27eb03 100644
--- a/core/css/style-petals.css
+++ b/core/css/style-petals.css
@@ -29,7 +29,7 @@
}
#main {
- margin-top: -20px;
+ margin-top: -12px;
}
#main>* {
@@ -174,6 +174,58 @@ footer {
padding-bottom: 2px;
}
+/** License **/
+
+.license {
+ padding: 24px;
+ overflow: hidden;
+ position: relative;
+ background-color: #f5f5f5;
+}
+
+body.mdui-theme-layout-dark .license {
+ background-color: #383838;
+}
+
+.license, .license p {
+ margin: 0;
+}
+
+.license svg {
+ position: absolute;
+ width: 128px;
+ height: 128px;
+ top: -35px;
+ right: -22px;
+ opacity: .25;
+}
+
+body.mdui-theme-layout-dark .license svg {
+ filter: invert(1);
+}
+
+/** Sponsor **/
+
+.mdr-sponsor {
+ text-align: center;
+}
+
+.mdr-sponsor .mdui-btn {
+ border-radius: 5px;
+}
+
+/** Tags **/
+
+.tags {
+ margin-bottom: 15px;
+ padding: 0 10px;
+ text-align: center
+}
+
+.tags .mdui-chip {
+ margin: 0 2px;
+}
+
/* Page Navigator */
.page-navigator {
@@ -223,7 +275,7 @@ footer {
padding-top: 100%;
}
-.link-card > * {
+.link-card>* {
position: absolute;
bottom: 0;
}
\ No newline at end of file
diff --git a/core/css/style.css b/core/css/style.css
index 7226bd7..55b6eee 100644
--- a/core/css/style.css
+++ b/core/css/style.css
@@ -274,12 +274,6 @@ html.pray {
top: 8px
}
-.tags {
- margin: 15px 0;
- padding: 0 10px;
- text-align: center
-}
-
#post .mdui-card-header {
padding-top: 8px;
padding-bottom: 8px;
diff --git a/core/functions.php b/core/functions.php
index b02e4f3..db135bc 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -4,12 +4,22 @@
require_once __DIR__ . '/lib/Main.php';
require_once __DIR__ . '/lib/ShortCode.php';
+$options = Helper::options();
+
define('MDR_DEBUG', file_exists(__DIR__ . '/.debugger'));
-if (!defined('MDR_OUTREQUIER') && Helper::options()->GravatarUrl)
- define('__TYPECHO_GRAVATAR_PREFIX__', Helper::options()->GravatarUrl);
+if (!defined('MDR_OUTREQUIER') && $options->GravatarUrl)
+ define('__TYPECHO_GRAVATAR_PREFIX__', $options->GravatarUrl);
define('MDR_PJAX', isset($_GET['_pjax']) ? true : false);
define('MDR_COLOR', json_decode(file_get_contents(__DIR__ . '/lib/Color.json'), true));
define('MDR_VERSION', Typecho_Plugin::parseInfo(__DIR__ . '/../index.php')['version']);
+define('MDR_LANG', __DIR__ . '/../lang');
+
+/* if ($options->lang && $options->lang != 'zh_CN')
+ if (file_exists(MDR_LANG . '/' . $options->lang . '.mo')) {
+ Typecho_I18n::translate('');
+ Typecho_I18n::addLang(MDR_LANG . '/' . $options->lang . '.mo');
+ }
+*/
function cjUrl($path)
{
@@ -67,7 +77,7 @@ function Postviews($archive)
Typecho_Cookie::set('contents_views', $cookie);
}
}
- echo $exist == 0 ? '暂无阅读' : $exist . ' 次阅读';
+ echo $exist == 0 ? _t('暂无阅读') : _t('%d 次阅读', $exist);
}
/**
@@ -129,7 +139,7 @@ function Contents_Post_Initial($limit = 10, $order = 'created')
echo '
PjaxOption ? '' : ' href="' . $post['permalink'] . '"') . '>' . htmlspecialchars($post['title']) . '' . "\n";
}
} else {
- echo '暂无文章' . "\n";
+ echo '' . _t('暂时没有文章') . '' . "\n";
}
}
@@ -158,7 +168,7 @@ function Contents_Comments_Initial($limit = 10, $ignoreAuthor = 0)
echo 'PjaxOption ? '' : ' href="' . permaLink($comment) . '"') . ' title="来自: ' . $parent['title'] . '">' . $comment['author'] . ': ' . ($parent['hidden'] && $options->PjaxOption ? '内容被隐藏' : Typecho_Common::subStr(strip_tags($comment['text']), 0, 35, '...')) . '' . "\n";
}
} else {
- echo '暂无回复' . "\n";
+ echo '' . _t('暂时没有回复') . '' . "\n";
}
}
@@ -248,14 +258,14 @@ function Whisper()
);
} else {
return array(
- '暂无内容
',
+ '' . _t('暂时没有内容') . '
',
$page['permalink'],
$page['title']
);
}
} else {
return array(
- '暂无内容
'
+ '' . _t('暂时没有内容') . '
'
);
}
}
@@ -398,6 +408,7 @@ function MyLinks($links)
/* function 许可协议 */
function license($license)
{
+ $svg = "";
$licenselist = array(
'BY' => '署名 4.0 国际 (CC BY 4.0)',
'BY-SA' => '署名-相同方式共享 4.0 国际 (CC BY-SA 4.0)',
@@ -406,11 +417,24 @@ function license($license)
'BY-NC-SA' => '署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)',
'BY-NC-ND' => '署名-非商业性使用-禁止演绎 4.0 国际 (CC BY-NC-ND 4.0)'
);
- if (isset($license) && $license != 'NONE') {
- echo '';
- } else {
- echo '本篇文章未指定许可协议。
';
- }
+ $text = (isset($license) && $license != 'NONE') ?
+ '本篇文章采用 ' . $licenselist[$license] . ' 许可协议进行许可。' :
+ "本篇文章未指定许可协议。";
+
+ echo "$text
转载或引用本文时请遵守许可协议,注明出处。
$svg
";
+}
+
+/* function Sponsor */
+function mdrSponsor($class)
+{
+ if (!isset($class->mdrSponsor)) return;
+ if (!is_array($class->mdrSponsor)) return;
+ if (count($class->mdrSponsor) < 1) return;
+ $buttons = '';
+ foreach ($class->mdrSponsor as list($name, $color, $link))
+ $buttons .= "$name
";
+
+ echo '';
}
/* function 是否为状态 */
@@ -459,15 +483,17 @@ function staticUrl($file = '')
$lists = explode("\r\n", Helper::options()->mdrMDUICDNlink);
$mdrMDUIlinks = [
'mdui.min.css' => [
- 'cssnet' => 'cdnjs.loli.net/ajax/libs/mdui/0.4.3/css/mdui.min.css',
- 'bootcss' => 'cdn.bootcss.com/mdui/0.4.2/css/mdui.min.css',
- 'cdnjs' => 'cdnjs.cloudflare.com/ajax/libs/mdui/0.4.3/css/mdui.min.css',
+ 'jsdelivr' => 'cdn.jsdelivr.net/npm/mdui@1.0.1/dist/css/mdui.min.css',
+ 'cssnet' => 'cdnjs.loli.net/ajax/libs/mdui/1.0.1/css/mdui.min.css',
+ 'bootcss' => 'cdn.bootcss.com/mdui/1.0.1/css/mdui.min.css',
+ 'cdnjs' => 'cdnjs.cloudflare.com/ajax/libs/mdui/1.0.1/css/mdui.min.css',
'custom' => isset($lists[0]) ? $lists[0] : ''
],
'mdui.min.js' => [
- 'cssnet' => 'cdnjs.loli.net/ajax/libs/mdui/0.4.3/js/mdui.min.js',
- 'bootcss' => 'cdn.bootcss.com/mdui/0.4.2/js/mdui.min.js',
- 'cdnjs' => 'cdnjs.cloudflare.com/ajax/libs/mdui/0.4.3/js/mdui.min.js',
+ 'jsdelivr' => 'cdn.jsdelivr.net/npm/mdui@1.0.1/dist/js/mdui.min.js',
+ 'cssnet' => 'cdnjs.loli.net/ajax/libs/mdui/1.0.1/js/mdui.min.js',
+ 'bootcss' => 'cdn.bootcss.com/mdui/1.0.1/js/mdui.min.js',
+ 'cdnjs' => 'cdnjs.cloudflare.com/ajax/libs/mdui/1.0.1/js/mdui.min.js',
'custom' => isset($lists[1]) ? $lists[1] : ''
]
];
@@ -494,13 +520,13 @@ function staticUrl($file = '')
'jquery.fancybox.min.css' => [
'bc' => 'cdn.bootcss.com/fancybox/3.5.7/jquery.fancybox.min.css',
'cf' => 'cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css',
- 'jd' => 'cdn.jsdelivr.net/npm/fancybox@3.0.1/dist/css/jquery.fancybox.css',
+ 'jd' => 'cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.css',
'custom' => isset($lists[3]) ? $lists[3] : ''
],
'jquery.fancybox.min.js' => [
'bc' => 'cdn.bootcss.com/fancybox/3.5.7/jquery.fancybox.min.js',
'cf' => 'cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js',
- 'jd' => 'cdn.jsdelivr.net/npm/fancybox@3.0.1/dist/js/jquery.fancybox.min.js',
+ 'jd' => 'cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js',
'custom' => isset($lists[4]) ? $lists[4] : ''
]
];
diff --git a/core/js/darkmode.js b/core/js/darkmode.js
index a667eef..f62e9e5 100644
--- a/core/js/darkmode.js
+++ b/core/js/darkmode.js
@@ -32,12 +32,12 @@ const getDarkModeFromCookie = () => {
* 是否为 Dark Mode
*/
const getDarkModeFromDom = () => {
- return mdui.JQ('body').hasClass('mdui-theme-layout-dark')
+ return mdui.$('body').hasClass('mdui-theme-layout-dark')
}
/**MDr On DarkMode */
const onDarkMode = () => {
- var body = mdui.JQ('body'),
+ var body = mdui.$('body'),
appbar = document.getElementsByClassName('mdui-appbar')[0];
console.log('Dark mode on');
document.cookie = "dark=1;path=/;" + mdrDarkModeFD;
@@ -49,7 +49,7 @@ const onDarkMode = () => {
/**MDr Off Darkmode */
const offDarkMode = () => {
- var body = mdui.JQ('body'),
+ var body = mdui.$('body'),
appbar = document.getElementsByClassName('mdui-appbar')[0];
console.log('Dark mode off');
document.cookie = "dark=0;path=/;" + mdrDarkModeFD;
@@ -61,8 +61,8 @@ const offDarkMode = () => {
/* Dark Mode 对于 @print 的适配 */
window.addEventListener("beforeprint", function () {
- var body = mdui.JQ('body'),
- appbar = mdui.JQ('.mdui-appbar');
+ var body = mdui.$('body'),
+ appbar = mdui.$('.mdui-appbar');
appbar.hide();
if (body.hasClass('mdui-theme-layout-dark')) {
body.addClass('mdui-theme-layout-dark-print');
@@ -70,8 +70,8 @@ window.addEventListener("beforeprint", function () {
}
});
window.addEventListener("afterprint", function () {
- var body = mdui.JQ('body'),
- appbar = mdui.JQ('.mdui-appbar');
+ var body = mdui.$('body'),
+ appbar = mdui.$('.mdui-appbar');
appbar.show();
if (body.hasClass('mdui-theme-layout-dark-print')) {
body.addClass('mdui-theme-layout-dark');
diff --git a/core/js/script.js b/core/js/script.js
index 51e0412..76ebd28 100644
--- a/core/js/script.js
+++ b/core/js/script.js
@@ -15,7 +15,7 @@ const mdrScroll = () => {
header.css('background', getDarkModeFromDom() ? '#212121' : '#ffffff');
} else {
header.addClass('mdui-shadow-0');
- header.css('background', 'none');
+ header.css('background', getDarkModeFromDom() ? '#121212' : '#ffffff');
}
}
@@ -77,10 +77,10 @@ const mdrCatalog = (data) => {
return;
}
mdrTab.show(0);
- var list = mdui.JQ('#mdrDrawerLtoc .mdui-list');
+ var list = mdui.$('#mdrDrawerLtoc .mdui-list');
list.empty();
data.forEach((value) => {
- var dom = mdui.JQ(document.createElement('a'));
+ var dom = mdui.$(document.createElement('a'));
dom.addClass('mdui-list-item mdui-ripple');
dom.addClass('mdui-p-l-' + Math.min(value.depth * 2, 5));
dom.attr('href', '#cl-' + value.count);
diff --git a/footer.php b/footer.php
index aac0481..f6dc543 100644
--- a/footer.php
+++ b/footer.php
@@ -14,7 +14,7 @@
©
options->mdrCopytext) ? $this->options->mdrCopytext() : $this->options->title() ?>.
Powered by Typecho.
- Theme MDr by FlyingSky.
+ Theme MDr-Petals by FlyingSky.
@@ -26,12 +26,12 @@
const mdrVersion = '= MDR_VERSION ?>';
const mdrSnackbar = '= $this->options->mdrSnackbar ?>';
const mdrTab = new mdui.Tab('#mdrTab');
- const mdrTabDom = mdui.JQ('#mdrTab');
+ const mdrTabDom = mdui.$('#mdrTab');
const mdrAjaxLoadTimes = = $this->options->AjaxLoadTimes ?>;
user->hasLogin() && $this->user->pass('administrator', true) and null !== @$_GET['debug']) : ?>
-
+
user->hasLogin() && $this->user->pass('administrator', true) and null !== @$_GET['debug']) : ?>
-
+