Skip to content

Commit

Permalink
feat(css)
Browse files Browse the repository at this point in the history
  • Loading branch information
removeif committed Apr 4, 2020
1 parent 8f1f2c6 commit e777341
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ comment:
has_hot_recommend: true # 是否有热门推荐
has_latest_comment: true #是否有最新评论

global_gray: false #true 全局灰色,特定时期可以开启,false-不开启

has_latest_modify_time: true #是否显示最后修改时间 true开启,false-关闭

busuanzi_only_count: false #当上面plugins中busuanzi: true时,此配置busuanzi_only_count为true时,网站不显示不蒜子统计数据,但是会每次统计。false时显示统计数据。
Expand Down
7 changes: 5 additions & 2 deletions layout/common/head.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ module.exports = class extends Component {
meta_generator = true,
head = {},
article,
highlight
highlight,
has_live_2D_switch,
global_gray
} = config;
const {
meta = [],
Expand All @@ -49,7 +51,6 @@ module.exports = class extends Component {
} = head;

const language = page.lang || page.language || config.language;
const has_live_2D_switch = config.has_live_2D_switch;
let hlTheme, images;
if (highlight && highlight.enable === false) {
hlTheme = null;
Expand Down Expand Up @@ -99,6 +100,7 @@ module.exports = class extends Component {
}

var hasLive2D = has_live_2D_switch == undefined || has_live_2D_switch;
var globalGray = global_gray != undefined && global_gray;
return <head>
<meta charset="utf-8" />
{meta_generator ? <meta name="generator" content={`Hexo ${env.version}`} /> : null}
Expand Down Expand Up @@ -143,6 +145,7 @@ module.exports = class extends Component {
{hlTheme ? <link rel="stylesheet" href={cdn('highlight.js', '9.12.0', 'styles/' + hlTheme + '.css')} /> : null}
<Plugins site={site} config={config} helper={helper} page={page} head={true} />
<link rel="stylesheet" href={my_cdn(url_for('/css/style.css'))} />
{globalGray ? <link rel="stylesheet" href={url_for('/css/global_gray.css')} /> : null}
<script src={cdn('jquery', '3.3.1', 'dist/jquery.min.js')}></script>
<script src={my_cdn(url_for('/js/globalUtils.js'))}></script>
{adsenseClientId ? <script data-ad-client={adsenseClientId}
Expand Down
8 changes: 8 additions & 0 deletions source/css/global_gray.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
html{
filter: gray !important;
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
}

0 comments on commit e777341

Please sign in to comment.