jekyll-theme-mdui 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/_includes/script.html +29 -73
- data/_layouts/category.html +9 -1
- data/_layouts/tags.html +9 -2
- data/assets/css/main.css +41 -0
- data/assets/js/rgbaster.min.js +74 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f94ec4000bc32d137aa8a1d1ff8a67fa64a7889
|
4
|
+
data.tar.gz: 4c29aadf4a10cf44d5ecc0a61ff9355ba6038401
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0874b2432b2c7e8fc1bebc96351c814c24e5dd26a8c2f90da9da2d41f2197213d4daade0f26f58b553950f77f923564d1e406432cc7bc74d8e9d457505219dcf'
|
7
|
+
data.tar.gz: a2313e1189a9033d075228661c72570a1004482b963a8b250d5662dafc08fc27a8b1c5db964bfd0f37a250de34e943f799157ece8afc9a0ac3001e88d2e1d242
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
## General
|
20
20
|
|
21
|
-
[![Version](https://img.shields.io/badge/version-0.4.
|
21
|
+
[![Version](https://img.shields.io/badge/version-0.4.7-green.svg?style=flat-square)]()
|
22
22
|
[![Jekyll](https://img.shields.io/badge/Jekyll-3.4+-green.svg?style=flat-square)](https://jekyllrb.com/)
|
23
23
|
[![Gem](https://img.shields.io/gem/dt/jekyll-theme-mdui.svg?style=flat-square)](https://rubygems.org/gems/jekyll-theme-mdui/)
|
24
24
|
|
@@ -40,13 +40,13 @@
|
|
40
40
|
|
41
41
|
## Docs
|
42
42
|
|
43
|
-
[Docs](http://mdui.kejun.space/#/)
|
43
|
+
[Docs](http://mdui.kejun.space/#/)(!!!Need Help!!!)
|
44
44
|
|
45
45
|
[中文文档](http://mdui.kejun.space/#/zh-cn/)
|
46
46
|
|
47
47
|
## TODO
|
48
48
|
|
49
|
-
- [ ] Editor - Online preview
|
49
|
+
- [ ] Editor - Online preview (!!!Need Help!!!)
|
50
50
|
- [ ] Category - Better style
|
51
51
|
- [ ] Site style - More custom options
|
52
52
|
|
@@ -62,6 +62,7 @@ File Required or Optional:
|
|
62
62
|
|tags.json|Optional|If you use the tags page, it is required.|
|
63
63
|
|_data/friends.yml|Optional|If you use the friends page, it is required.|
|
64
64
|
|_data/sns.yml|Optional|It is footer sns,if you want userd, it is required.|
|
65
|
+
|_data/meng.yml|Optional|It is Meng option,if you want userd, it is required.|
|
65
66
|
|_data/site.yml|Required|It is theme config.|
|
66
67
|
|_data/lang.yml|Required|It is language config.|
|
67
68
|
|_data/menus.yml|Required|It is site menus config.|
|
data/_includes/script.html
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
{% if site.data.meng.console.switch == true %}
|
11
11
|
{% if site.data.meng.console.theme_info == true %}
|
12
12
|
<script>
|
13
|
-
console.info("\n %c © Jekyll Theme MDUI | Version: 0.4.
|
13
|
+
console.info("\n %c © Jekyll Theme MDUI | Version: 0.4.7 | https://github.com/KeJunMao/jekyll-theme-mdui \n\n", "color: {{site.data.meng.console.color}}; background:{{site.data.meng.console.background}}; padding:5px 0; border-radius: 5px 5px 5px 5px;");
|
14
14
|
</script>
|
15
15
|
{% endif %}
|
16
16
|
<script>
|
@@ -275,82 +275,38 @@ var disqus = {
|
|
275
275
|
{% if site.data.site.uiux.meng == true %}
|
276
276
|
{% if site.data.meng.header.switch == true%}
|
277
277
|
<script>
|
278
|
-
const REG_HEX = /(^#?[0-9A-F]{6}$)|(^#?[0-9A-F]{3}$)/i;
|
279
|
-
|
280
|
-
/*
|
281
|
-
* rgb字符串解析
|
282
|
-
* accepts: #333 #accded (without # is also fine)
|
283
|
-
* not accept yet: rgb(), rgba()
|
284
|
-
*/
|
285
|
-
var rgbToHex = function(rgb) {
|
286
|
-
var color = rgb.toString().match(/\d+/g);
|
287
|
-
var hex = "#";
|
288
|
-
for (var i = 0; i < 3; i++) {
|
289
|
-
hex += ("0" + Number(color[i]).toString(16)).slice(-2);
|
290
|
-
}
|
291
|
-
return hex;
|
292
|
-
};
|
293
|
-
function parseRGB(str){
|
294
|
-
if(typeof str === 'string' && REG_HEX.test(str) ){
|
295
|
-
str = str.replace('#', '');
|
296
|
-
let arr;
|
297
|
-
if(str.length === 3){
|
298
|
-
arr = str.split('').map(c => (c+c));
|
299
|
-
}
|
300
|
-
else if(str.length === 6){
|
301
|
-
arr = str.match(/[a-zA-Z0-9]{2}/g);
|
302
|
-
}
|
303
|
-
else{
|
304
|
-
throw new Error('wrong color format');
|
305
|
-
}
|
306
|
-
return arr.map((c) => parseInt(c, 16));
|
307
|
-
}
|
308
|
-
throw new Error('color should be string');
|
309
|
-
}
|
310
|
-
|
311
|
-
/*
|
312
|
-
* rgb value to hsl 色相(H)、饱和度(S)、明度(L)
|
313
|
-
*/
|
314
|
-
function rgbToHsl(rgbStr){
|
315
|
-
let [r, g, b] = parseRGB(rgbStr);
|
316
|
-
r /= 255, g /= 255, b /= 255;
|
317
|
-
let max = Math.max(r, g, b), min = Math.min(r, g, b);
|
318
|
-
let h, s, l = (max + min) / 2;
|
319
|
-
|
320
|
-
if(max == min){
|
321
|
-
h = s = 0;
|
322
|
-
}else{
|
323
|
-
let d = max - min;
|
324
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
325
|
-
switch(max){
|
326
|
-
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
327
|
-
case g: h = (b - r) / d + 2; break;
|
328
|
-
case b: h = (r - g) / d + 4; break;
|
329
|
-
}
|
330
|
-
h /= 6;
|
331
|
-
}
|
332
|
-
return [h, s, l];
|
333
|
-
}
|
334
|
-
|
335
|
-
/*
|
336
|
-
* 判断颜色属于深色还是浅色
|
337
|
-
*/
|
338
|
-
function isColorDarkOrLight(rgbStr){
|
339
|
-
var color = rgbToHex(rgbStr);
|
340
|
-
let [h, s, l] = rgbToHsl(color);
|
341
|
-
return (l > 0.5)? 'light' : 'dark';
|
342
|
-
}
|
343
278
|
var appVersion = navigator.appVersion;
|
344
|
-
|
345
279
|
if (appVersion.indexOf('Mobile') > 0){
|
346
280
|
var isMobile = true;
|
347
281
|
}
|
348
|
-
if
|
349
|
-
var
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
282
|
+
{% if page.themecolor == null %}
|
283
|
+
var pagethemecolorid = '{{page.id | remove:"/"}}ThemeColor';
|
284
|
+
var headertextcolor;
|
285
|
+
if (!localStorage[pagethemecolorid]){
|
286
|
+
if (isMobile){
|
287
|
+
var s = document.createElement('script'); s.async = true;
|
288
|
+
s.type = 'text/javascript';
|
289
|
+
s.src = '{{ "/assets/js/rgbaster.min.js" | prepend: site.baseurl }}';
|
290
|
+
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
291
|
+
}
|
292
|
+
}else{
|
293
|
+
if (isMobile){
|
294
|
+
headerthemecolor = localStorage[pagethemecolorid];
|
295
|
+
headertextcolor = localStorage[pagethemecolorid+'text'];
|
296
|
+
$('header').css('background-color',headerthemecolor);
|
297
|
+
$("meta[name='theme-color']").attr('content', headerthemecolor);
|
298
|
+
$('header').css('color',headertextcolor);
|
299
|
+
}
|
300
|
+
}
|
301
|
+
{% else %}
|
302
|
+
headerthemecolor = {{page.themecolor}};
|
303
|
+
headertextcolor = {{page.themetextcolor}};
|
304
|
+
if (isMobile){
|
305
|
+
$('header').css('background-color',headerthemecolor);
|
306
|
+
$("meta[name='theme-color']").attr('content', headerthemecolor);
|
307
|
+
$('header').css('color',headertextcolor);
|
308
|
+
}
|
309
|
+
{% endif %}
|
354
310
|
</script>
|
355
311
|
{% endif %}
|
356
312
|
{% endif %}
|
data/_layouts/category.html
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
---
|
2
2
|
layout: default
|
3
3
|
---
|
4
|
+
<div class="k-posts-list"></div>
|
5
|
+
{% if site.data.site.uiux.meng == true %}
|
6
|
+
{% if site.data.meng.background.switch == true %}
|
7
|
+
<div class="k-container mdui-card">
|
8
|
+
{% else %}
|
9
|
+
<div class="k-container">
|
10
|
+
{% endif %}
|
11
|
+
{% else %}
|
4
12
|
<div class="k-container">
|
5
|
-
|
13
|
+
{% endif %}
|
6
14
|
{% for category in site.categories %}
|
7
15
|
<ul class="mdui-list">
|
8
16
|
<li class="mdui-subheader"><a name="{{ category | first }}">{{ category | first | upcase }}</a>
|
data/_layouts/tags.html
CHANGED
@@ -10,9 +10,16 @@ layout: default
|
|
10
10
|
|
11
11
|
{% assign sortedtags = tags | split:' ' | sort %}
|
12
12
|
|
13
|
-
|
13
|
+
<div class="k-posts-list"></div>
|
14
|
+
{% if site.data.site.uiux.meng == true %}
|
15
|
+
{% if site.data.meng.background.switch == true %}
|
16
|
+
<div class="k-container mdui-card">
|
17
|
+
{% else %}
|
18
|
+
<div class="k-container">
|
19
|
+
{% endif %}
|
20
|
+
{% else %}
|
14
21
|
<div class="k-container">
|
15
|
-
|
22
|
+
{% endif %}
|
16
23
|
{% for tag in sortedtags %}
|
17
24
|
{% assign index = site.tags[tag] | size %}
|
18
25
|
{% assign fontsize = 14 %}
|
data/assets/css/main.css
CHANGED
@@ -208,6 +208,47 @@ a{
|
|
208
208
|
cursor:url({{site.data.meng.cursor.pointer_url}}), pointer;
|
209
209
|
}
|
210
210
|
{% endif %}
|
211
|
+
{% if site.data.meng.background.switch == true %}
|
212
|
+
body{
|
213
|
+
background-image: url({{site.data.meng.background.background_img}});
|
214
|
+
background-size: cover;
|
215
|
+
background-position: 50% 50%;
|
216
|
+
background-attachment: fixed;
|
217
|
+
background-repeat: no-repeat;
|
218
|
+
}
|
219
|
+
#toc-card{
|
220
|
+
background-color:transparent;
|
221
|
+
}
|
222
|
+
#toc a{
|
223
|
+
color: {{site.data.meng.background.text_color}};
|
224
|
+
}
|
225
|
+
{% if site.data.meng.background.transparent_header == true %}
|
226
|
+
header{
|
227
|
+
background-color:rgba(0, 0, 0, 0);
|
228
|
+
color: {{site.data.meng.background.text_color}};
|
229
|
+
}
|
230
|
+
{% endif %}
|
231
|
+
{% if site.data.meng.background.transparent_footer == true %}
|
232
|
+
footer .mdui-card{
|
233
|
+
color: {{site.data.meng.background.text_color}};
|
234
|
+
background-color:rgba(0, 0, 0, 0);
|
235
|
+
}
|
236
|
+
{% endif %}
|
237
|
+
{% endif %}
|
238
|
+
{% if site.data.meng.card.switch ==true %}
|
239
|
+
.k-list-card{
|
240
|
+
background-color:{{site.data.meng.card.background_color}};
|
241
|
+
}
|
242
|
+
.k-container.mdui-card{
|
243
|
+
background-color:{{site.data.meng.card.background_color}};
|
244
|
+
}
|
245
|
+
.k-friend .mdui-card{
|
246
|
+
background-color:{{site.data.meng.card.background_color}};
|
247
|
+
}
|
248
|
+
.k-post-media{
|
249
|
+
opacity: {{site.data.meng.card.card_img_opacity}};
|
250
|
+
}
|
251
|
+
{% endif %}
|
211
252
|
{% endif %}
|
212
253
|
|
213
254
|
{% for sns in site.data.sns %}
|
data/assets/js/rgbaster.min.js
CHANGED
@@ -1,11 +1,84 @@
|
|
1
1
|
!function(n,t){"use strict";var e=function(n,t){var e=document.createElement("canvas");return e.setAttribute("width",n),e.setAttribute("height",t),e.getContext("2d")},r=function(n,t){var r=new Image,i=n.src||n;"data:"!==i.substring(0,5)&&(r.crossOrigin="Anonymous"),r.onload=function(){var n=e(r.width,r.height);n.drawImage(r,0,0);var i=n.getImageData(0,0,r.width,r.height);t&&t(i.data)},r.src=i},i=function(n){return["rgb(",n,")"].join("")},a=function(n){var t=[];for(var e in n)t.push(o(e,n[e]));return t.sort(function(n,t){return t.count-n.count}),t},u=function(n,t){if(n.length>t)return n.slice(0,t);for(var e=n.length-1;t-1>e;e++)n.push(o("0,0,0",0));return n},o=function(n,t){return{name:i(n),count:t}},c=10,s={};s.colors=function(n,e){e=e||{};var o=e.exclude||[],s=e.paletteSize||c;r(n,function(n){for(var r={},c="",f=[],d=0;d<n.length;d+=4)f[0]=n[d],f[1]=n[d+1],f[2]=n[d+2],c=f.join(","),-1===f.indexOf(t)&&0!==n[d+3]&&-1===o.indexOf(i(c))&&(r[c]=c in r?r[c]+1:1);if(e.success){var g=u(a(r),s+1);e.success({dominant:g[0].name,secondary:g[1].name,palette:g.map(function(n){return n.name}).slice(1)})}})},n.RGBaster=n.RGBaster||s}(window);
|
2
|
-
|
2
|
+
const REG_HEX = /(^#?[0-9A-F]{6}$)|(^#?[0-9A-F]{3}$)/i;
|
3
|
+
|
4
|
+
/*
|
5
|
+
* rgb字符串解析
|
6
|
+
* {{page.id}}
|
7
|
+
* accepts: #333 #accded (without # is also fine)
|
8
|
+
* not accept yet: rgb(), rgba()
|
9
|
+
*/
|
10
|
+
var rgbToHex = function(rgb) {
|
11
|
+
var color = rgb.toString().match(/\d+/g);
|
12
|
+
var hex = "#";
|
13
|
+
for (var i = 0; i < 3; i++) {
|
14
|
+
hex += ("0" + Number(color[i]).toString(16)).slice(-2);
|
15
|
+
}
|
16
|
+
return hex;
|
17
|
+
};
|
18
|
+
function parseRGB(str){
|
19
|
+
if(typeof str === 'string' && REG_HEX.test(str) ){
|
20
|
+
str = str.replace('#', '');
|
21
|
+
let arr;
|
22
|
+
if(str.length === 3){
|
23
|
+
arr = str.split('').map(c => (c+c));
|
24
|
+
}
|
25
|
+
else if(str.length === 6){
|
26
|
+
arr = str.match(/[a-zA-Z0-9]{2}/g);
|
27
|
+
}
|
28
|
+
else{
|
29
|
+
throw new Error('wrong color format');
|
30
|
+
}
|
31
|
+
return arr.map((c) => parseInt(c, 16));
|
32
|
+
}
|
33
|
+
throw new Error('color should be string');
|
34
|
+
}
|
35
|
+
|
36
|
+
/*
|
37
|
+
* rgb value to hsl 色相(H)、饱和度(S)、明度(L)
|
38
|
+
*/
|
39
|
+
function rgbToHsl(rgbStr){
|
40
|
+
let [r, g, b] = parseRGB(rgbStr);
|
41
|
+
r /= 255, g /= 255, b /= 255;
|
42
|
+
let max = Math.max(r, g, b), min = Math.min(r, g, b);
|
43
|
+
let h, s, l = (max + min) / 2;
|
44
|
+
|
45
|
+
if(max == min){
|
46
|
+
h = s = 0;
|
47
|
+
}else{
|
48
|
+
let d = max - min;
|
49
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
50
|
+
switch(max){
|
51
|
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
52
|
+
case g: h = (b - r) / d + 2; break;
|
53
|
+
case b: h = (r - g) / d + 4; break;
|
54
|
+
}
|
55
|
+
h /= 6;
|
56
|
+
}
|
57
|
+
return [h, s, l];
|
58
|
+
}
|
59
|
+
|
60
|
+
/*
|
61
|
+
* 判断颜色属于深色还是浅色
|
62
|
+
*/
|
63
|
+
function isColorDarkOrLight(rgbStr){
|
64
|
+
var color = rgbToHex(rgbStr);
|
65
|
+
let [h, s, l] = rgbToHsl(color);
|
66
|
+
return (l > 0.5)? 'light' : 'dark';
|
67
|
+
}
|
68
|
+
var headerColor;
|
69
|
+
var img = $('.k-post-media').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
|
3
70
|
var colors = RGBaster.colors(img, {
|
4
71
|
paletteSize: 30,
|
5
72
|
success: function(colors){
|
73
|
+
headerColor = colors.dominant;
|
74
|
+
localStorage[pagethemecolorid] = headerColor;
|
6
75
|
if(isColorDarkOrLight(colors.dominant) === "dark"){
|
76
|
+
headertextcolor = '#fff';
|
77
|
+
localStorage[pagethemecolorid+'text'] = headertextcolor;
|
7
78
|
$('header').css('color','#fff');
|
8
79
|
}else{
|
80
|
+
headertextcolor = '#000';
|
81
|
+
localStorage[pagethemecolorid+'text'] = headertextcolor;
|
9
82
|
$('header').css('color','#000');
|
10
83
|
}
|
11
84
|
$('header').css('background-color',colors.dominant);
|