jekyll-theme-mdui 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/_includes/test.html CHANGED
@@ -1,190 +1,190 @@
1
- {% if disqus_shortname != "" %} {% if page.layout == 'post' %}
2
- <script>
3
- function proxyMode(disqus_proxy_url, disqus_shortname, disqus_identifier, disqus_api_key) {
4
- $.ajax({
5
- url: disqus_proxy_url + "/api/3.0/threads/list.json",
6
- type: 'get',
7
- dataType: 'json',
8
- data: {
9
- api_key: disqus_api_key,
10
- forum: disqus_shortname,
11
- thread: 'ident:' + disqus_identifier
12
- },
13
- success: function (data) {
14
- for (x in data.response) {
15
- if (data.response[x].link.indexOf(disqus_identifier) > 1) {
16
- var postid = data.response[x].id;
17
- $.ajax({
18
- url: disqus_proxy_url + "/api/3.0/posts/list.json",
19
- type: 'get',
20
- dataType: 'json',
21
- data: {
22
- api_key: disqus_api_key,
23
- forum: disqus_shortname,
24
- thread: postid
25
- },
26
- success: function (data) {
27
- function getcontent(data) {
28
- console.log(data);
29
- var el = '<div class="mdui-card mdui-shadow-5">';
30
- el += '<div class="mdui-card-header">';
31
- el += '<img class="mdui-card-header-avatar" src="' + data.author.avatar.cache + '"/>';
32
- el += '<div class="mdui-card-header-title">' + data.author.name + '</div>';
33
- el += '<div class="mdui-card-header-subtitle">' + data.author.about + '</div>';
34
- el += '</div><div id="disqus' + data.id + '" class="mdui-card-content">';
35
- if (data.media.length > 0) {
36
- for (y in data.media) {
37
- data.message += '<a href="' + data.media[y].location + '" target="_blank" ><img class="mdui-img-fluid" src="' + data.media[y].location + '" /></a>'
38
- }
39
- }
40
- el += data.message;
41
- el += '<div class="mdui-card-actions"><button class="mdui-btn mdui-ripple k-reply mdui-float-right">回复</button></div>';
42
- el += '<div class="input mdui-m-b-2 mdui-hidden">';
43
- el += '<div class="mdui-textfield"><textarea class="mdui-textfield-input" placeholder="Description"></textarea></div>';
44
- el += '<div class="mdui-row-sm-3">';
45
- el += '<div class="mdui-col"><div class="mdui-textfield"><input class="mdui-textfield-input" type="text" name="name" placeholder="Name"/></div></div>';
46
- el += '<div class="mdui-col"><div class="mdui-textfield"><input class="mdui-textfield-input" type="text" name="email" placeholder="Email"/></div></div>';
47
- el += '<div class="mdui-col"><div class="mdui-textfield"><input class="mdui-textfield-input" type="text" name="website" placeholder="Website"/></div></div>';
48
- if (data.parent===null){
49
- el += '<button thread="'+data.thread+'" class="mdui-btn k-send mdui-btn-block mdui-ripple">发送</button>';
50
- }else{
51
- el += '<button thread="'+data.thread+'" parent="'+data.parent+'" class="k-send mdui-btn mdui-btn-block mdui-ripple">发送</button>';
52
- }
53
- el += '</div></div></div></div>';
54
-
55
-
56
- return el;
57
- }
58
-
59
- function sortComment(commentList) {
60
- commentList = commentList.map((comment) => {
61
- return Object.assign({}, comment)
62
- });
63
- let newList;
64
- let removeIdList;
65
- let idList;
66
- while (commentList.reduce((p, c) => {
67
- return p || typeof c.parent === 'string'
68
- }, false)) {
69
- newList = commentList.map((comment) => {
70
- return Object.assign({}, comment)
71
- });
72
- idList = commentList.map(comment => comment.id);
73
- removeIdList = [];
74
- commentList.forEach((comment, index) => {
75
- if (typeof comment.parent === 'string' &&
76
- commentList.reduce((p, c) => {
77
- return p && c.parent !==
78
- comment.id
79
- }, true)) {
80
- let parentIndex = idList.indexOf(
81
- comment.parent);
82
- let parent = commentList[parentIndex];
83
- if (typeof newList[parentIndex].chilren ===
84
- 'undefined') newList[parentIndex].chilren = [];
85
- newList[parentIndex].chilren.push(
86
- comment);
87
- removeIdList.push(comment.id);
88
- }
89
- });
90
- newList = newList.filter(comment => removeIdList.indexOf(
91
- comment.id) === -1);
92
- removeIdList = [];
93
- commentList = newList;
94
- }
95
- return commentList;
96
- }
97
- for (x in data.response) {
98
- if (data.response[x].parent !== null)
99
- data.response[x].parent = data.response[x].parent.toString();
100
- }
101
- var response = sortComment(data.response);
102
-
103
- function digui(data) {
104
- if (data.parent === null) {
105
- var el = getcontent(data);
106
- $('#disqusreadonly').append(el);
107
- if (data.chilren) {
108
- for (x of data.chilren) {
109
- digui(x)
110
- }
111
- }
112
- } else {
113
- var el = getcontent(data);
114
- $('#disqusreadonly').find('#disqus' + data.parent).append(
115
- el);
116
- if (data.chilren) {
117
- for (x of data.chilren) {
118
- digui(x)
119
- }
120
- }
121
- }
122
- }
123
- for (x of response) {
124
- digui(x);
125
- }
126
- $(".k-reply").on('click',function(){
127
- var input = $(this).parent().next();
128
- if (input.hasClass('mdui-hidden')){
129
- input.removeClass('mdui-hidden');
130
- }else{
131
- input.addClass('mdui-hidden');
132
- }
133
- });
134
- $(".k-send").on('click',function(){
135
- console.log();
136
- $.ajax({
137
- url: disqus_proxy_url + "/api/3.0/posts/create.json",
138
- type: 'post',
139
- dataType: 'json',
140
- data:{
141
- api_key: disqus_api_key,
142
- parent:$(this).attr('parent'),
143
- thread:$(this).attr('thread'),
144
- author_email:$(this).parents('.input').find("input[name='email']").val(),
145
- author_name:$(this).parents('.input').find("input[name='name']").val(),
146
- author_url:$(this).parents('.input').find("input[name='website']").val(),
147
- message:$(this).parents('.input').find("textarea").val()
148
- }
149
- });
150
- });
151
- }
152
- });
153
- }
154
- }
155
- }
156
- });
157
- xhr.abort();
158
- }
159
- var disqus_proxy_url = "{{site.disqus_proxy_url}}";
160
- var disqus_api_key = '{{site.disqus_api_key}}';
161
- var disqus_shortname = '{{site.disqus_shortname}}';
162
- var disqus_identifier = '{{page.url}}';
163
- var xhr = $.ajax({
164
- url: "https://disqus.com/api/3.0/posts/list.json",
165
- type: 'get',
166
- dataType: 'jsonp',
167
- data: {
168
- api_key: disqus_api_key
169
- },
170
- timeout: 100,
171
- error: function (xhr, textStatus) {
172
- if (textStatus == "timeout") {
173
- proxyMode(disqus_proxy_url, disqus_shortname, disqus_identifier, disqus_api_key);
174
- }
175
- },
176
- success: function () {
177
- if (typeof DISQUS !== 'object') {
178
- (function () {
179
- var s = document.createElement('script');
180
- s.async = true;
181
- s.type = 'text/javascript';
182
- s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
183
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[
184
- 0]).appendChild(s);
185
- }());
186
- }
187
- }
188
- });
189
- </script>
1
+ {% if disqus_shortname != "" %} {% if page.layout == 'post' %}
2
+ <script>
3
+ function proxyMode(disqus_proxy_url, disqus_shortname, disqus_identifier, disqus_api_key) {
4
+ $.ajax({
5
+ url: disqus_proxy_url + "/api/3.0/threads/list.json",
6
+ type: 'get',
7
+ dataType: 'json',
8
+ data: {
9
+ api_key: disqus_api_key,
10
+ forum: disqus_shortname,
11
+ thread: 'ident:' + disqus_identifier
12
+ },
13
+ success: function (data) {
14
+ for (x in data.response) {
15
+ if (data.response[x].link.indexOf(disqus_identifier) > 1) {
16
+ var postid = data.response[x].id;
17
+ $.ajax({
18
+ url: disqus_proxy_url + "/api/3.0/posts/list.json",
19
+ type: 'get',
20
+ dataType: 'json',
21
+ data: {
22
+ api_key: disqus_api_key,
23
+ forum: disqus_shortname,
24
+ thread: postid
25
+ },
26
+ success: function (data) {
27
+ function getcontent(data) {
28
+ console.log(data);
29
+ var el = '<div class="mdui-card mdui-shadow-5">';
30
+ el += '<div class="mdui-card-header">';
31
+ el += '<img class="mdui-card-header-avatar" src="' + data.author.avatar.cache + '"/>';
32
+ el += '<div class="mdui-card-header-title">' + data.author.name + '</div>';
33
+ el += '<div class="mdui-card-header-subtitle">' + data.author.about + '</div>';
34
+ el += '</div><div id="disqus' + data.id + '" class="mdui-card-content">';
35
+ if (data.media.length > 0) {
36
+ for (y in data.media) {
37
+ data.message += '<a href="' + data.media[y].location + '" target="_blank" ><img class="mdui-img-fluid" src="' + data.media[y].location + '" /></a>'
38
+ }
39
+ }
40
+ el += data.message;
41
+ el += '<div class="mdui-card-actions"><button class="mdui-btn mdui-ripple k-reply mdui-float-right">回复</button></div>';
42
+ el += '<div class="input mdui-m-b-2 mdui-hidden">';
43
+ el += '<div class="mdui-textfield"><textarea class="mdui-textfield-input" placeholder="Description"></textarea></div>';
44
+ el += '<div class="mdui-row-sm-3">';
45
+ el += '<div class="mdui-col"><div class="mdui-textfield"><input class="mdui-textfield-input" type="text" name="name" placeholder="Name"/></div></div>';
46
+ el += '<div class="mdui-col"><div class="mdui-textfield"><input class="mdui-textfield-input" type="text" name="email" placeholder="Email"/></div></div>';
47
+ el += '<div class="mdui-col"><div class="mdui-textfield"><input class="mdui-textfield-input" type="text" name="website" placeholder="Website"/></div></div>';
48
+ if (data.parent===null){
49
+ el += '<button thread="'+data.thread+'" class="mdui-btn k-send mdui-btn-block mdui-ripple">发送</button>';
50
+ }else{
51
+ el += '<button thread="'+data.thread+'" parent="'+data.parent+'" class="k-send mdui-btn mdui-btn-block mdui-ripple">发送</button>';
52
+ }
53
+ el += '</div></div></div></div>';
54
+
55
+
56
+ return el;
57
+ }
58
+
59
+ function sortComment(commentList) {
60
+ commentList = commentList.map((comment) => {
61
+ return Object.assign({}, comment)
62
+ });
63
+ let newList;
64
+ let removeIdList;
65
+ let idList;
66
+ while (commentList.reduce((p, c) => {
67
+ return p || typeof c.parent === 'string'
68
+ }, false)) {
69
+ newList = commentList.map((comment) => {
70
+ return Object.assign({}, comment)
71
+ });
72
+ idList = commentList.map(comment => comment.id);
73
+ removeIdList = [];
74
+ commentList.forEach((comment, index) => {
75
+ if (typeof comment.parent === 'string' &&
76
+ commentList.reduce((p, c) => {
77
+ return p && c.parent !==
78
+ comment.id
79
+ }, true)) {
80
+ let parentIndex = idList.indexOf(
81
+ comment.parent);
82
+ let parent = commentList[parentIndex];
83
+ if (typeof newList[parentIndex].chilren ===
84
+ 'undefined') newList[parentIndex].chilren = [];
85
+ newList[parentIndex].chilren.push(
86
+ comment);
87
+ removeIdList.push(comment.id);
88
+ }
89
+ });
90
+ newList = newList.filter(comment => removeIdList.indexOf(
91
+ comment.id) === -1);
92
+ removeIdList = [];
93
+ commentList = newList;
94
+ }
95
+ return commentList;
96
+ }
97
+ for (x in data.response) {
98
+ if (data.response[x].parent !== null)
99
+ data.response[x].parent = data.response[x].parent.toString();
100
+ }
101
+ var response = sortComment(data.response);
102
+
103
+ function digui(data) {
104
+ if (data.parent === null) {
105
+ var el = getcontent(data);
106
+ $('#disqusreadonly').append(el);
107
+ if (data.chilren) {
108
+ for (x of data.chilren) {
109
+ digui(x)
110
+ }
111
+ }
112
+ } else {
113
+ var el = getcontent(data);
114
+ $('#disqusreadonly').find('#disqus' + data.parent).append(
115
+ el);
116
+ if (data.chilren) {
117
+ for (x of data.chilren) {
118
+ digui(x)
119
+ }
120
+ }
121
+ }
122
+ }
123
+ for (x of response) {
124
+ digui(x);
125
+ }
126
+ $(".k-reply").on('click',function(){
127
+ var input = $(this).parent().next();
128
+ if (input.hasClass('mdui-hidden')){
129
+ input.removeClass('mdui-hidden');
130
+ }else{
131
+ input.addClass('mdui-hidden');
132
+ }
133
+ });
134
+ $(".k-send").on('click',function(){
135
+ console.log();
136
+ $.ajax({
137
+ url: disqus_proxy_url + "/api/3.0/posts/create.json",
138
+ type: 'post',
139
+ dataType: 'json',
140
+ data:{
141
+ api_key: disqus_api_key,
142
+ parent:$(this).attr('parent'),
143
+ thread:$(this).attr('thread'),
144
+ author_email:$(this).parents('.input').find("input[name='email']").val(),
145
+ author_name:$(this).parents('.input').find("input[name='name']").val(),
146
+ author_url:$(this).parents('.input').find("input[name='website']").val(),
147
+ message:$(this).parents('.input').find("textarea").val()
148
+ }
149
+ });
150
+ });
151
+ }
152
+ });
153
+ }
154
+ }
155
+ }
156
+ });
157
+ xhr.abort();
158
+ }
159
+ var disqus_proxy_url = "{{site.disqus_proxy_url}}";
160
+ var disqus_api_key = '{{site.disqus_api_key}}';
161
+ var disqus_shortname = '{{site.disqus_shortname}}';
162
+ var disqus_identifier = '{{page.url}}';
163
+ var xhr = $.ajax({
164
+ url: "https://disqus.com/api/3.0/posts/list.json",
165
+ type: 'get',
166
+ dataType: 'jsonp',
167
+ data: {
168
+ api_key: disqus_api_key
169
+ },
170
+ timeout: 100,
171
+ error: function (xhr, textStatus) {
172
+ if (textStatus == "timeout") {
173
+ proxyMode(disqus_proxy_url, disqus_shortname, disqus_identifier, disqus_api_key);
174
+ }
175
+ },
176
+ success: function () {
177
+ if (typeof DISQUS !== 'object') {
178
+ (function () {
179
+ var s = document.createElement('script');
180
+ s.async = true;
181
+ s.type = 'text/javascript';
182
+ s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
183
+ (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[
184
+ 0]).appendChild(s);
185
+ }());
186
+ }
187
+ }
188
+ });
189
+ </script>
190
190
  {% endif %} {% endif %}
data/_includes/tips.html CHANGED
@@ -1,6 +1,6 @@
1
- <div class="mdui-card mdui-shadow-0 mdui-color-green-600" style="margin:12px 0px; ">
2
- <div class="mdui-card-content">
3
- <p><b>PROTIPS: </b></p>
4
- <p>{{include.content}}</p>
5
- </div>
1
+ <div class="mdui-card mdui-shadow-0 mdui-color-green-600" style="margin:12px 0px; ">
2
+ <div class="mdui-card-content">
3
+ <p><b>PROTIPS: </b></p>
4
+ <p>{{include.content}}</p>
5
+ </div>
6
6
  </div>
data/_includes/toc.html CHANGED
@@ -1,3 +1,3 @@
1
- <div id="toc-card" class="mdui-card mdui-shadow-0">
2
- <div id="toc"></div>
1
+ <div id="toc-card" class="mdui-card mdui-shadow-0">
2
+ <div id="toc"></div>
3
3
  </div>
data/_includes/warn.html CHANGED
@@ -1,6 +1,6 @@
1
- <div class="mdui-card mdui-shadow-0 mdui-color-red" style="margin:12px 0px; ">
2
- <div class="mdui-card-content">
3
- <p><b>WARNINGS: </b></p>
4
- <p>{{include.content}}</p>
5
- </div>
1
+ <div class="mdui-card mdui-shadow-0 mdui-color-red" style="margin:12px 0px; ">
2
+ <div class="mdui-card-content">
3
+ <p><b>WARNINGS: </b></p>
4
+ <p>{{include.content}}</p>
5
+ </div>
6
6
  </div>
@@ -1,26 +1,26 @@
1
- ---
2
- layout: default
3
- ---
4
- <div class="k-container">
5
- <div class="k-posts-list"></div>
6
- {% for category in site.categories %}
7
- <ul class="mdui-list">
8
- <li class="mdui-subheader"><a name="{{ category | first }}">{{ category | first | upcase }}</a>
9
- {% for posts in category %}
10
- {% for post in posts %}
11
- {% if post.title %}
12
- <li class="mdui-list-item mdui-ripple">
13
- <a href="{{ post.url }}">
14
- <div class="mdui-list-item-content">
15
- <div class="mdui-list-item-title mdui-list-item-one-line">{{ post.title }}</div>
16
- <div class="mdui-list-item-text mdui-list-item-one-line">{{ post.excerpt | strip_html}}</div>
17
- </div>
18
- </a>
19
- </li>
20
- {% endif %}
21
- {% endfor %}
22
- {% endfor %}
23
- </li>
24
- </ul>
25
- {% endfor %}
1
+ ---
2
+ layout: default
3
+ ---
4
+ <div class="k-container">
5
+ <div class="k-posts-list"></div>
6
+ {% for category in site.categories %}
7
+ <ul class="mdui-list">
8
+ <li class="mdui-subheader"><a name="{{ category | first }}">{{ category | first | upcase }}</a>
9
+ {% for posts in category %}
10
+ {% for post in posts %}
11
+ {% if post.title %}
12
+ <li class="mdui-list-item mdui-ripple">
13
+ <a href="{{ post.url }}">
14
+ <div class="mdui-list-item-content">
15
+ <div class="mdui-list-item-title mdui-list-item-one-line">{{ post.title }}</div>
16
+ <div class="mdui-list-item-text mdui-list-item-one-line">{{ post.excerpt | strip_html}}</div>
17
+ </div>
18
+ </a>
19
+ </li>
20
+ {% endif %}
21
+ {% endfor %}
22
+ {% endfor %}
23
+ </li>
24
+ </ul>
25
+ {% endfor %}
26
26
  </div>