Skip to content

Commit

Permalink
update themes
Browse files Browse the repository at this point in the history
  • Loading branch information
D0n9X1n committed Dec 25, 2020
1 parent bf0eee0 commit 7246ed0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const knownPrefix = "<hbe-prefix></hbe-prefix>";

// disable log
var silent = false;
// use default theme
var theme = 'default';

hexo.extend.filter.register('after_post_render', (data) => {
Expand Down Expand Up @@ -69,19 +70,20 @@ hexo.extend.filter.register('after_post_render', (data) => {
// Let's rock n roll
const config = Object.assign(defaultConfig, hexo.config.encrypt, data);
silent = config.silent;
theme = config.theme;
theme = config.theme.trim().toLowerCase();

// read theme from file
// deprecate the template keyword
if (config.template != "") {
dlog('warn', 'Looks like you use a deprecated property "template" to set up template, consider to use "theme"? See https://github.com/D0n9X1n/hexo-blog-encrypt#encrypt-theme');
}

let template = fs.readFileSync(path.resolve(__dirname, `./lib/hbe.${config.theme}.html`)).toString();
// read theme from file
let template = fs.readFileSync(path.resolve(__dirname, `./lib/hbe.${theme}.html`)).toString();

if (tagUsed === false) {
dlog('info', `hexo-blog-encrypt: encrypting "${data.title.trim()}" based on the password configured in Front-matter.`);
dlog('info', `hexo-blog-encrypt: encrypting "${data.title.trim()}" based on the password configured in Front-matter with theme: ${theme}.`);
} else {
dlog('info', `hexo-blog-encrypt: encrypting "${data.title.trim()}" based on Tag: "${tagUsed}".`);
dlog('info', `hexo-blog-encrypt: encrypting "${data.title.trim()}" based on Tag: "${tagUsed}" with theme ${theme}.`);
}

data.content = knownPrefix + data.content.trim();
Expand Down
2 changes: 1 addition & 1 deletion lib/hbe.style.css
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@
background: transparent;
padding: 0.5em 0;
margin-bottom: 2em;
color: #fff;
color: #2C3E50;
}

.hbe-input-label-shrink {
Expand Down
2 changes: 1 addition & 1 deletion lib/hbe.wave.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<script id="hbeData" type="hbeData" data-hmacdigest="{{hbeHmacDigest}}">{{hbeEncryptedData}}</script>
<div class="hbe hbe-content">
<div class="hbe hbe-input hbe-input-wave">
<input class="hbe hbe-input-field hbe-input-field-wave" type="text" id="hbePass">
<input class="hbe hbe-input-field hbe-input-field-wave" type="password" id="hbePass">
<label class="hbe hbe-input-label hbe-input-label-wave" for="hbePass">
<span class="hbe hbe-input-label-content hbe-input-label-content-wave">{{hbeMessage}}</span>
</label>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint --ext .js ./"
},
"version": "3.1.0",
"version": "3.1.1",
"devDependencies": {
"eslint": "^6.2.2"
}
Expand Down

0 comments on commit 7246ed0

Please sign in to comment.