no-style-please2 0.5.0 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7108dbd31a792d4cb97d54e262a91e7c043247de152a1a394261384cd5c37dc6
4
- data.tar.gz: 2c59bb78129cc08c5e48ff02573975fa77ebb58038d4bf120787dcf854a2d85c
3
+ metadata.gz: 2461eca97e61c3f33512d5dac781ee5136f3d56fec9a7a6dd6231de205a5f6c3
4
+ data.tar.gz: 64cca40402fa13421ad158a8db0d1fe3025096e7afe6e2e7c890ff735d6c31eb
5
5
  SHA512:
6
- metadata.gz: fed97a7243ffc82dc5aed673ec6eb41200f5f60c815c4f9cc26c83200170c2012ab2ecc6d9b308e9e86b913c324c981339e61ce2a3a44aa32d11c09068a47541
7
- data.tar.gz: 6f0916dad46e01a1990569139af5ba5b910cc3a144e4ff3d4d9a1412084478137e36f8f19d1ed217f653318a20604147e2d91675beb38be9c8c9073e8365f07a
6
+ metadata.gz: 5a03bf0b15b4c0ea7df4f3e8873d7761efd6060978114ba865afe57af65ed6bdb2c279148c35d1b8e7ecf1f0e221ecdf279dee3e7772a205ab4952a728b9b27a
7
+ data.tar.gz: 4afe8a137187b62c5cc3d4bd47b3d147169c3d51a32b4227d268ca1f126ddb1b8dfd5b5e756915a3128cb8798360a0e62c779c7ae423deba80ab7d7435819878
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # no style, please!
2
2
 
3
3
  <img src="https://raw.githubusercontent.com/riggraz/no-style-please/master/logo.png" width="64" align="left" />A (nearly) no-CSS, fast, minimalist [Jekyll](https://jekyllrb.com/) theme.
4
- Inspired by [elly's site](http://tilde.town/~elly/), expressly created for [my personal blog](https://riggraz.dev/).
4
+ Inspired by [elly's site](http://tilde.town/~elly/) [riggraz](https://riggraz.dev/)
5
5
 
6
- <h3 align="center"><a href="https://riggraz.dev/no-style-please/">Try the demo out!</a></h3>
6
+ <h3 align="center"><a href="https://vitock.github.io/no-style-please-demo">Try the demo out!</a></h3>
7
7
 
8
8
  <img src="https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/featured-image.png" />
9
9
 
@@ -14,6 +14,10 @@ Inspired by [elly's site](http://tilde.town/~elly/), expressly created for [my p
14
14
  + mathjax , inluce_code post_link support, include
15
15
  + support, link to other post
16
16
  + encrytion support. Only those who know the password can view the article
17
+
18
+ **IMPORTANT NOTE**
19
+ ONLY textual contents of article will be encrypted ,the pictures will **NOT** be encrypted
20
+
17
21
 
18
22
  #### how to encrypt your post
19
23
  1. generate your own public & private key to protect your password
data/_config.yml CHANGED
@@ -17,6 +17,18 @@ theme_config:
17
17
  back_home_text: ".." # customize text for homepage link in post layout
18
18
  date_format: "%Y-%m-%d" # customize how date is formatted
19
19
  show_description: false # show blog description in home page
20
+ encrypt_title: "Content is Encryped :)"
21
+ encrypt_clear_btn: "清空缓存密码"
22
+ decrypt_btn: 解密
23
+ encrypt_btn: 重新加密
24
+ tag_showall: true
25
+ all_tags_path: tags
26
+ all_tags_title: All Tags
27
+
28
+ #
29
+ # forbid_cache_password: true
30
+
31
+
20
32
 
21
33
  sass:
22
34
  style: :compressed
@@ -1,61 +1,140 @@
1
1
 
2
2
  <div id="encrypted">
3
- <h3> 内容已经加密</h3>
4
- <input style="width:100%; " type="password" id="passwordinput" placeholder="输入密码"></input>
5
- <p>
6
- <input type="button" value="解密" id="DecryptBtn"/>
7
- </div>
8
- <div id="decrypted">
9
- </div>
10
- <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/salsa20.min.js"></script>
11
- <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/base64.js"></script>
12
- <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/md5.js"></script>
13
- <script>
14
- var encryptedContent = '{{ content | contentEncrypt:page}}'
3
+ <h3> {{ site.theme_config.encrypt_title | default : 'Content is Encrypted'}} </h3>
4
+
5
+ <input style="width:100%; " type="password" id="passwordinput" placeholder="输入密码"></input>
6
+ <p>
7
+ <input type="button" value= "{{ site.theme_config.decrypt_btn | default : 'Decrypt' }}" id="DecryptBtn"/>
8
+ <input type="button" value= "{{ site.theme_config.encrypt_clear_btn | default: 'Clear password cache' }}" id="ClearBtn1"/>
9
+
10
+ </div>
11
+
12
+ <div id="decrypted" style = "display:none">
13
+ <p>
14
+ <div>
15
+
16
+ <input type="button" value= "{{ site.theme_config.encrypt_btn | default: 'Encrypt' }}" id="EncryptBtn"/>
15
17
 
16
- function hexToUint8Arr(hexString){
17
- return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
18
- }
19
- function decrypt (key0){
20
- // const key = Uint8Array([...]); // 32 bytes key
21
- var key = new TextEncoder("utf-8").encode(md5(key0));
18
+ <input type="button" value= "{{ site.theme_config.encrypt_clear_btn | default: 'Clear password cache' }}" id="ClearBtn2"/>
19
+
20
+ </div>
21
+ <div id = 'decryptContent'>
22
+ </div>
23
+ </div>
24
+ <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/salsa20.min.js"></script>
25
+ <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/base64.js"></script>
26
+ <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/md5.js"></script>
27
+ <script>
28
+ !function(){
29
+ var encryptedContent = '{{ content | contentEncrypt:page}}'
30
+
31
+ function hexToUint8Arr(hexString){
32
+ return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
33
+ }
34
+ function decrypt (key0){
35
+ // const key = Uint8Array([...]); // 32 bytes key
36
+ var key = new TextEncoder("utf-8").encode(md5(key0));
37
+
38
+ /// hex
39
+ var nonceStr = encryptedContent.substring(0,16)
40
+ var nonce = hexToUint8Arr(nonceStr)
41
+
42
+ const msg = encryptedContent.substring(17)
43
+ const message = Base64.toUint8Array(msg)
44
+ // Encrypt //
45
+ const decrypt = new JSSalsa20(key, nonce).decrypt(message);
46
+ var plain = new TextDecoder("utf-8").decode(decrypt)
47
+ var check = md5(plain)
48
+ if(check.indexOf(nonceStr) == 0){
49
+ setKey(key0)
50
+ /// hide input
51
+ document.getElementById("encrypted").style.display = 'none'
52
+ // / show decrypted
53
+
54
+ document.getElementById("decrypted").style.display = 'block'
55
+ document.getElementById("decryptContent").innerHTML = plain
56
+
57
+ setTimeout(function(){
58
+ var loadevent = document.createEvent("Event")
59
+ loadevent.initEvent("load", true, true)
60
+
61
+ var DOMContentLoaded_event = document.createEvent("Event")
62
+ DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true)
63
+
64
+ window.dispatchEvent(loadevent)
65
+ window.dispatchEvent(DOMContentLoaded_event)
66
+ console.log('333a334a')
67
+
68
+ }, 500);
69
+
70
+ }else{
71
+ alert("wrong password.")
72
+ }
73
+ }
22
74
 
23
- /// hex
24
- var nonceStr = encryptedContent.substring(0,16)
25
- var nonce = hexToUint8Arr(nonceStr)
26
-
27
- const msg = encryptedContent.substring(17)
28
- const message = Base64.toUint8Array(msg)
29
- // Encrypt //
30
- const decrypt = new JSSalsa20(key, nonce).decrypt(message);
31
- var plain = new TextDecoder("utf-8").decode(decrypt)
32
- var check = md5(plain)
33
- if(check.indexOf(nonceStr) == 0){
75
+ document.getElementById("DecryptBtn").onclick = function(){
76
+ var key = document.getElementById("passwordinput").value
77
+ decrypt(key);
78
+ }
79
+
80
+ document.getElementById("EncryptBtn").onclick = function(){
34
81
  /// hide input
35
- document.getElementById("encrypted").style.display = 'none'
82
+ document.getElementById("encrypted").style.display = 'block'
36
83
  // / show decrypted
37
- document.getElementById("decrypted").innerHTML = plain
84
+ document.getElementById("decrypted").style.display = "none"
85
+
86
+ clearKey()
87
+ }
38
88
 
39
- setTimeout(function(){
40
- var loadevent = document.createEvent("Event")
41
- loadevent.initEvent("load", true, true)
89
+ document.getElementById("EncryptBtn").onclick = function(){
90
+ /// hide input
91
+ document.getElementById("encrypted").style.display = 'block'
92
+ // / show decrypted
93
+ document.getElementById("decrypted").style.display = "none"
94
+
95
+ clearKey()
96
+ }
42
97
 
43
- var DOMContentLoaded_event = document.createEvent("Event")
44
- DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true)
98
+ document.getElementById("ClearBtn1").onclick = function(){
99
+ localStorage.clear();
100
+ }
101
+ document.getElementById("ClearBtn2").onclick = function(){
102
+ localStorage.clear();
103
+ }
45
104
 
46
- window.dispatchEvent(loadevent)
47
- window.dispatchEvent(DOMContentLoaded_event)
48
- console.log('333a334a')
105
+
49
106
 
50
- }, 500);
51
-
52
- }else{
53
- alert("wrong password.")
54
- }
55
- }
56
-
57
- document.getElementById("DecryptBtn").onclick = function(){
58
- var key = document.getElementById("passwordinput").value
59
- decrypt(key);
60
- }
61
- </script>
107
+
108
+
109
+ {% if site.theme_config.forbid_cache_password %}
110
+ function readKey(){
111
+ }
112
+ function setKey(value){
113
+ }
114
+ function clearKey() {
115
+ }
116
+ {% else %}
117
+ function readKey(){
118
+ var key = md5(location.pathname)
119
+ return localStorage.getItem(key)
120
+ }
121
+ function setKey(value){
122
+ var key = md5(location.pathname)
123
+ return localStorage.setItem(key,value)
124
+ }
125
+ function clearKey() {
126
+ var key = md5(location.pathname)
127
+ localStorage.removeItem(key)
128
+ }
129
+ var cachekey = readKey()
130
+ if(cachekey){
131
+ decrypt(cachekey)
132
+ }
133
+ {% endif %}
134
+
135
+
136
+
137
+ }()
138
+
139
+ </script>
140
+
@@ -3,13 +3,22 @@ layout: default
3
3
  ---
4
4
  {%-include back_link.html -%}
5
5
  <div class="post">
6
- <h1>Tag: {{ page.tag }}</h1>
6
+ <h1></h1>
7
+ <li>Tag: {{ page.tag }}</li>
8
+
7
9
  <ul>
8
- {% for post in site.tags[page.tag] %}
10
+ {% for post in site.tags[page.tag] %}
9
11
  <li><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a> ({{ post.date | date_to_string }})<br>
10
12
  {{ post.description }}
11
13
  </li>
12
14
  {% endfor %}
13
15
  </ul>
14
16
  </div>
15
- <hr>
17
+ {% if site.theme_config.tag_showall %}
18
+ <li><a href="{{ site.baseurl }}/{{site.theme_config.all_tags_path | default:'tags' }}.html"> {{site.theme_config.all_tags_title | default:'All Tags' }}</a>
19
+ </li>
20
+
21
+ {% endif %}
22
+
23
+ <hr>
24
+
@@ -70,6 +70,9 @@ table, th, td {
70
70
  code {
71
71
  color: white;
72
72
  background: black;
73
+ // border-radius: 2px;
74
+ // padding-left: 2px;
75
+ // padding-right: 2px;
73
76
  }
74
77
 
75
78
  div.highlighter-rouge code {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no-style-please2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vitock