@@ -91,107 +91,72 @@ <h1 id="h_title">{{$wiki_page.title}}
91
91
{{/if}}
92
92
{{$content}}
93
93
</ article >
94
- < hr />
95
- <!-- Duoshuo Comment BEGIN -->
94
+ < hr />
96
95
{{if $wiki_page.close_comment == 0}}
97
- < div class ="ds-thread " data-thread-key ="wiki-106 " data-title ="Swoole扩展 "
98
- data-url ="http://wiki.swoole.com/wiki/page/106.html " id ="ds-thread ">
96
+ < div class ="ds-thread " id ="ds-thread ">
99
97
< div id ="ds-reset ">
100
- < div class ="ds-meta "> < a href ="javascript:void(0) "
101
- class ="ds-like-thread-button ds-rounded ds-thread-liked "> < span
102
- class ="ds-icon ds-icon-heart "> </ span > < span class ="ds-thread-like-text "> 已喜欢</ span > < span
103
- class ="ds-thread-cancel-like "> 取消喜欢</ span > </ a > < span class ="ds-like-panel "> < span
104
- class ="ds-highlight "> {{$thread.likes}}</ span > 人喜欢</ span > </ div >
105
98
< div class ="ds-comments-info ">
106
- < div class ="ds-sort "> < a class ="ds-order-desc "> 最新</ a > < a class ="ds-order-asc ds-current "> 最早</ a > < a
107
- class ="ds-order-hot "> 最热</ a > </ div >
99
+ < div class ="ds-sort "> < a class ="ds-order-desc " target ="_blank "> 最新</ a > < a class ="ds-order-asc ds-current " target ="_blank "> 最早</ a > < a class ="ds-order-hot " target ="_blank "> 最热</ a > </ div >
108
100
< ul class ="ds-comments-tabs ">
109
- < li class ="ds-tab "> < a class ="ds-comments-tab-duoshuo ds-current "
110
- href ="javascript:void(0); "> < span class ="ds-highlight "> {{$comments|@count}}</ span > 条评论</ a >
101
+ < li class ="ds-tab "> < a class ="ds-comments-tab-duoshuo ds-current " href ="javascript:void(0); " target ="_blank "> < span class ="ds-highlight "> {{$comments|@count}}</ span > 条评论</ a >
111
102
</ li >
112
103
</ ul >
113
104
</ div >
114
-
115
105
< ul class ="ds-comments ">
116
106
{{foreach item=v from=$comments}}
117
- < li class ="ds-post " >
107
+ < li class ="ds-post ">
118
108
< div class ="ds-post-self ">
119
109
< div class ="ds-avatar " data-user-id ="8435783 "> < a rel ="nofollow author " target ="_blank "
120
110
href ="{{$v.author_url}} "
121
111
title ="{{$v.author_name}} "> < img
122
- src ="https://wiki.swoole.com /static/images/default.png "
112
+ src ="{{if $v.avatar}}{{$v.avatar}}{{else}} /static/images/default.png{{/if}} "
123
113
alt ="{{$v.author_name}} "> </ a > </ div >
124
114
< div class ="ds-comment-body ">
125
115
< div class ="ds-comment-header "> < a class ="ds-user-name ds-highlight " data-qqt-account =""
126
116
href ="{{$v.author_url}} "
127
117
rel ="nofollow " target ="_blank " data-user-id ="8435783 "> {{$v.author_name}}</ a >
128
118
</ div >
129
119
< p > {{$v.message}}</ p >
130
-
131
- < div class ="ds-comment-footer ds-comment-actions "> < span class ="ds-time "> {{$v.created_at|substr:0:10}}</ span > < a
132
- class ="ds-post-reply " href ="javascript:void(0); "> < span
133
- class ="ds-icon ds-icon-reply "> </ span > 回复</ a > < a class ="ds-post-likes "
134
- href ="javascript:void(0); "> < span
135
- class ="ds-icon ds-icon-like "> </ span > 顶</ a > < a class ="ds-post-repost "
136
- href ="javascript:void(0); ">
137
- </ div >
138
120
</ div >
121
+ </ div >
139
122
</ li >
140
123
{{/foreach}}
141
124
</ ul >
142
- < div class ="ds-paginator " style ="display: none; ">
143
- < div class ="ds-border "> </ div >
144
- < a data-page ="1 " href ="javascript:void(0); " class ="ds-current "> 1</ a > </ div >
145
- < div class ="ds-toolbar ">
146
- < div class ="ds-account-control "> < span class ="ds-icon ds-icon-settings "> </ span > < span > 帐号管理</ span >
147
- < ul >
148
- < li > < a class ="ds-bind-more " href ="javascript:void(0); " style ="border-top: none "> 绑定更多</ a >
149
- </ li >
150
- < li > < a target ="_blank " href ="http://duoshuo.com/settings/ "> 设置</ a > </ li >
151
- < li > < a rel ="nofollow " href ="http://www4swoole.duoshuo.com/logout/ "
152
- style ="border-bottom: none "> 登出</ a > </ li >
153
- </ ul >
154
- </ div >
155
- < div class ="ds-visitor "> < a class ="ds-visitor-name " href ="http://weibo.com/hantianfeng "
156
- target ="_blank "> Rango-韩天峰</ a > < a class ="ds-unread-comments-count "
157
- href ="javascript:void(0); " title ="你没有新回复 "
158
- style ="display: none; "> 0</ a > </ div >
159
- </ div >
160
- < div class ="ds-replybox "> < a class ="ds-avatar " href ="http://duoshuo.com/settings/avatar/ " target ="_blank "
161
- title ="设置头像 "> < img
162
- src ="http://tva4.sinaimg.cn/crop.1.1.561.561.50/3fecf63djw8f7t533npdhj20g00i5dgz.jpg "
163
- alt ="Rango-韩天峰 "> </ a >
164
125
165
- < form method =" post " > < input type =" hidden " name =" thread_id " value =" 1163167853466092117 ">
166
- < input type =" hidden " name =" parent_id " value ="" >
167
- < input type =" hidden " name =" nonce " value =" 573edf51578e7 ">
168
-
169
- < div class ="ds-textarea-wrapper ds-rounded-top "> < textarea name =" message " title =" Ctrl+Enter快捷提交 "
170
- placeholder ="说点什么吧… "> </ textarea >
126
+ < div class =" ds-replybox " id =" post_comment_div " style =" display: none; ">
127
+ < div class =" ds-avatar " > < img src ="" id =" login_user_avatar " > </ div >
128
+ < form method =" post " onsubmit =" return postComment(this); ">
129
+ < input type =" hidden " name =" wiki_id " value =" {{$wiki_page.id}} " >
130
+ < div class ="ds-textarea-wrapper ds-rounded-top ">
131
+ < textarea name =" message " title =" Ctrl+Enter快捷提交 " placeholder ="说点什么吧(支持Markdown语法) … "> </ textarea >
171
132
< pre class ="ds-hidden-text "> </ pre >
172
133
</ div >
173
134
< div class ="ds-post-toolbar ">
174
- < div class ="ds-post-options ds-gradient-bg "> < span class ="ds-sync "> < input
175
- id ="ds-sync-checkbox " type ="checkbox " name ="repost " checked ="checked " value ="weibo "> < label
176
- for ="ds-sync-checkbox "> 分享到:</ label > < a href ="javascript:void(0) "
177
- class ="ds-service-icon ds-weibo "
178
- data-service ="weibo " title ="新浪微博 "> </ a > </ span >
135
+ < div class ="ds-post-options ds-gradient-bg ">
179
136
</ div >
180
137
< button class ="ds-post-button " type ="submit "> 发布</ button >
181
- < div class ="ds-toolbar-buttons "> < a class ="ds-toolbar-button ds-add-emote " title ="插入表情 "> </ a >
182
- </ div >
183
138
</ div >
184
139
</ form >
185
140
</ div >
186
141
</ div >
142
+ </ div >
187
143
</ div >
188
144
< link href ="/static/css/duoshuo.css " rel ="stylesheet ">
189
145
{{/if}}
190
146
< script type ="text/javascript ">
147
+ function postComment ( o ) {
148
+ if ( $ . trim ( o . message . value ) == '' ) {
149
+ return false ;
150
+ }
151
+ $ . post ( '/api/postComment/' , { 'content' : o . message . value , 'app' : 'wiki' , 'id' :o . wiki_id . value } , function ( data ) {
152
+ if ( data . code == 0 ) {
153
+ location . reload ( ) ;
154
+ }
155
+ } ) ;
156
+ return false ;
157
+ }
191
158
var _bdhmProtocol = ( ( "https:" == document . location . protocol ) ? "https://" : "http://" ) ;
192
-
193
159
$ ( document ) . ready ( function ( ) {
194
- var resize_count = 0 ;
195
160
var timer = setInterval ( function ( ) {
196
161
var a = $ ( "#sidebar" ) [ 0 ] ;
197
162
var b = $ ( "div.wiki_content" ) [ 0 ] ;
@@ -202,15 +167,28 @@ <h1 id="h_title">{{$wiki_page.title}}
202
167
}
203
168
window . clearInterval ( timer ) ;
204
169
} , 300 ) ;
205
- } ) ;
206
-
207
- $ ( document ) . ready ( function ( ) {
208
170
$ ( 'a' ) . each ( function ( e ) {
209
171
//外链
210
172
if ( this . href . substring ( _bdhmProtocol . length , location . host . length + _bdhmProtocol . length ) != location . host ) {
211
173
this . target = "_blank" ;
212
174
}
213
175
} ) ;
176
+ $ . getJSON ( '/api/getLoginInfo' , function ( data ) {
177
+ $ ( '#post_comment_div' ) . show ( ) ;
178
+ if ( data . code == 0 ) {
179
+ if ( data . data . avatar . substring ( 0 , 5 ) != 'https' ) {
180
+ if ( data . data . avatar . substring ( 0 , 4 ) == 'http' ) {
181
+ data . data . avatar = 'https' + data . data . avatar . substring ( 4 ) ;
182
+ } else {
183
+ data . data . avatar = 'https://' + location . host + data . data . avatar ;
184
+ }
185
+
186
+ }
187
+ $ ( '#login_user_avatar' ) . attr ( 'src' , data . data . avatar ) . attr ( 'alt' , data . data . nickname ) . attr ( 'title' , data . data . nickname ) ;
188
+ } else {
189
+ $ ( '#post_comment_div' ) . html ( '<p><br/><a href="http://www.swoole.com/page/login/">[登录后发表评论]</a></p>' ) ;
190
+ }
191
+ } ) ;
214
192
} ) ;
215
193
</ script >
216
194
</ div >
0 commit comments