Changeset 1806619
- Timestamp:
- 01/21/2018 05:14:20 PM (8 years ago)
- Location:
- steemeasy/trunk
- Files:
-
- 7 edited
-
css/steem.plugin.css (modified) (1 diff)
-
js/helper.js (modified) (1 diff)
-
js/render.js (modified) (10 diffs)
-
js/steem.plugin.js (modified) (3 diffs)
-
js/vote.js (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
-
steem.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
steemeasy/trunk/css/steem.plugin.css
r1799077 r1806619 9 9 .steemContainer li{margin:0.75em 0} 10 10 .steemContainer img{max-width:100%;height:auto;} 11 .steemContainer .strikethrough{text-decoration:line-through;opacity:0.5;} 11 12 .steemContainer blockquote{padding:5px;border:none;margin:0;} 12 13 .steemContainer blockquote > p{margin:0!important;} -
steemeasy/trunk/js/helper.js
r1797179 r1806619 50 50 51 51 return { 52 /** 53 * https://github.com/steemit/steemit.com/blob/47fd0e0846bd8c7c941ee4f95d5f971d3dc3981d/app/utils/ParsersAndFormatters.js 54 */ 55 isDeclinePayout: function(discussion) { 56 var maxPayout = parseFloat(String(discussion.max_accepted_payout).replace(/\s[A-Z]*$/, '')); 57 if (maxPayout == 0) { 58 return true; 59 } else { 60 return false; 61 } 62 }, 52 63 getPayout: function(discussion) { 53 64 var totalPendingPayout = parseFloat(discussion.total_pending_payout_value.split(' ')[0]); -
steemeasy/trunk/js/render.js
r1797179 r1806619 27 27 return b; 28 28 }; 29 var _createRow = function(link, comment, author, reward, vote, created ) {29 var _createRow = function(link, comment, author, reward, vote, created, declinePayout) { 30 30 var row = _div('pRow'); 31 31 var pTitle = _div('pTitle'); … … 46 46 pVote.innerHTML = vote; 47 47 48 if (declinePayout) { 49 pReward.classList.add('strikethrough'); 50 } 51 48 52 var tooltipDate = document.createElement('div'); 49 53 tooltipDate.innerHTML = created.mmdd(); … … 63 67 var _commentVote = function(commentAuthor, commentPermlink, upvoteComment, downvoteComment) { 64 68 65 steem.api.getContent(commentAuthor, commentPermlink, function(err, result) { 66 //console.log(err, result); 69 steem.api.getActiveVotes(commentAuthor, commentPermlink, function(err, votes) { 67 70 if (err === null) { 68 var payout = result.pending_payout_value; 69 var v = Helper.countVotes(result.active_votes); 70 71 upvoteComment.querySelector('.btnCount').innerHTML = v.up + '/' + payout; 71 var v = Helper.countVotes(votes); 72 upvoteComment.querySelector('.btnCount').innerHTML = v.up; 73 steem.api.getContent(commentAuthor, commentPermlink, function(err, result) { 74 if (err === null) { 75 var payout = result.pending_payout_value; 76 upvoteComment.querySelector('.btnCount').innerHTML = upvoteComment.querySelector('.btnCount').innerHTML + '/' + payout; 77 } 78 }); 72 79 73 80 // Logged In User Already Voted Mark … … 80 87 } 81 88 } 82 } else {83 console.error('some error', err);84 89 } 85 90 }); 86 87 /*steem.api.getActiveVotes(commentAuthor, commentPermlink, function(err, votes) {88 debugger;89 if (err === null) {90 var v = Helper.countVotes(votes);91 upvoteComment.querySelector('.btnCount').innerHTML = v.up;92 downvoteComment.querySelector('.btnCount').innerHTML = v.down;93 94 // Logged In User Already Voted Mark95 if (window.isAuth) {96 var voted = Vote.hasVoted(votes, username);97 if (voted === 1) {98 upvoteComment.classList.add('voted');99 } else if (voted === -1) {100 downvoteComment.classList.add('voted');101 }102 }103 }104 });*/105 91 }; 106 92 var _replies = function(parentAuthor, parentPermlink, parentDepth, callback) { … … 120 106 var childrenWrap = _div('childrenWrap'); 121 107 Vote.commentVoteBind(upvoteComment); 122 Vote.commentVoteBind(downvoteComment);108 //Vote.commentVoteBind(downvoteComment); 123 109 container.setAttribute('data-author', reply.author); 124 110 container.setAttribute('data-permlink', reply.permlink); … … 131 117 container.appendChild(childrenWrap); 132 118 r.appendChild(container); 133 134 119 _commentVote(reply.author, reply.permlink, upvoteComment, downvoteComment); 135 120 _openReplyCommentForm(replyComment, reply.author, reply.permlink); … … 242 227 243 228 Vote.commentVoteBind(upvoteComment); 244 Vote.commentVoteBind(downvoteComment);229 //Vote.commentVoteBind(downvoteComment); 245 230 container.setAttribute('data-author', username); 246 231 container.setAttribute('data-permlink', rePermlink); … … 293 278 var date = new Date(p.created); 294 279 var payout = Helper.getPayout(p); 295 var row = _createRow(link, p.children, p.author, p.pending_payout_value, p.net_votes, date); 280 var isDeclined = Helper.isDeclinePayout(p); 281 var row = _createRow(link, p.children, p.author, p.pending_payout_value, p.net_votes, date, isDeclined); 296 282 temp.appendChild(row); 297 283 … … 310 296 downvotes: v.down, 311 297 payout: p.pending_payout_value, 298 decline: isDeclined, 312 299 tags: JSON.parse(p.json_metadata).tags 313 300 }; … … 335 322 var v = Helper.countVotes(result.active_votes); 336 323 var tags = JSON.parse(result.json_metadata).tags; 337 showPostDetails(container, result.body, result.title, result.author, permlink, result.created, v.up, v.down, result.pending_payout_value, tags); 324 var isDeclined = Helper.isDeclinePayout(result); 325 showPostDetails(container, result.body, result.title, result.author, permlink, result.created, v.up, v.down, result.pending_payout_value, isDeclined, tags); 338 326 callback(); 339 327 } else { -
steemeasy/trunk/js/steem.plugin.js
r1799077 r1806619 355 355 var key = hashAuthor + '_' + hashPermlink; 356 356 if (args.length == 3) { 357 var detail= document.querySelector('.postDetails');357 var container = document.querySelector('.postDetails'); 358 358 var replyContainer = detail.querySelector('.replyContainer'); 359 359 replyContainer.innerHTML = ''; 360 360 if (args.length === 3) { 361 var post = posts[key]; 362 showPostDetails( detail, post.body, post.title, post.author, hashPermlink, post.created, post.upvotes, post.downvotes, post.payout, post.tags);361 var post = posts[key]; 362 showPostDetails(container, post.body, post.title, post.author, hashPermlink, post.created, post.upvotes, post.downvotes, post.payout, post.decline, post.tags); 363 363 Render.replies(post.author, hashPermlink, 0, function(result) { 364 364 if (result.err === null) { … … 373 373 }); 374 374 375 function showPostDetails(container, markdown, title, author, permlink, created, upvotes, downvotes, payout, tags) {375 function showPostDetails(container, markdown, title, author, permlink, created, upvotes, downvotes, payout, isDeclined, tags) { 376 376 var postBody = container.querySelector('.postBody'); 377 377 var postAuthor = container.querySelector('.postAuthor'); … … 426 426 linksContainer.appendChild(a); 427 427 postReward.innerHTML = payout; 428 428 if (isDeclined) { 429 postReward.classList.add('strikethrough'); 430 } else { 431 postReward.classList.remove('strikethrough'); 432 } 429 433 } 430 434 -
steemeasy/trunk/js/vote.js
r1797179 r1806619 186 186 var v = Helper.countVotes(result.active_votes); 187 187 var key = author + '_' + permlink; 188 var post = _posts[key]; 189 190 post.upvotes = v.up; 191 post.downvotes = v.down; 192 post.payout = payout; 188 189 if (_posts.hasOwnProperty(key)) { 190 // Root Post 191 var post = _posts[key]; 192 post.upvotes = v.up; 193 post.downvotes = v.down; 194 post.payout = payout; 195 } else { 196 // Reply of a post 197 } 193 198 194 199 callback(null, v.up, v.down, payout); … … 283 288 if (isVoted) { 284 289 if (confirm('Are you sure to un-vote?')) { 285 btn.parentNode.querySelector('.downvoteComment').setAttribute('disabled', true);290 //btn.parentNode.querySelector('.downvoteComment').setAttribute('disabled', true); 286 291 btn.parentNode.querySelector('.upvoteComment').setAttribute('disabled', true); 287 292 sc2.vote(username, commentAuthor, commentPermlink, 0, function(err, result) { … … 295 300 btn.classList.remove('voted'); 296 301 btn.parentNode.querySelector('.upvoteComment').removeAttribute('disabled'); 297 btn.parentNode.querySelector('.downvoteComment').removeAttribute('disabled');302 //btn.parentNode.querySelector('.downvoteComment').removeAttribute('disabled'); 298 303 }); 299 304 }); … … 303 308 if (!isUpvote) weight = -10000; 304 309 305 btn.parentNode.querySelector('.downvoteComment').setAttribute('disabled', true);310 //btn.parentNode.querySelector('.downvoteComment').setAttribute('disabled', true); 306 311 btn.parentNode.querySelector('.upvoteComment').setAttribute('disabled', true); 307 312 sc2.vote(username, commentAuthor, commentPermlink, weight, function(err, result) { … … 315 320 btn.classList.add('voted'); 316 321 btn.parentNode.querySelector('.upvoteComment').removeAttribute('disabled'); 317 btn.parentNode.querySelector('.downvoteComment').removeAttribute('disabled');322 //btn.parentNode.querySelector('.downvoteComment').removeAttribute('disabled'); 318 323 }); 319 324 }); -
steemeasy/trunk/readme.txt
r1799077 r1806619 48 48 49 49 == Changelog == 50 = 0.4 = 51 * Decline Payout posts are visualised and can be distinguished by strike line 52 * Bug fixes 50 53 51 = 1.0 = 54 55 = 0.3 = 52 56 * Updated steem.js to v0.6.4 53 57 * steem.js web socket endpoint api.steemit.com (steemd.steemit.com is depreciated) -
steemeasy/trunk/steem.php
r1799077 r1806619 4 4 Plugin URI: https://github.com/sean0010/press 5 5 Description: Steem Wordpress Plugin 6 Version: 0.0. 36 Version: 0.0.4 7 7 Author: morning 8 8 Author URI: htps://steemit.com/@morning … … 132 132 133 133 wp_register_script('helper.js', plugin_dir_url( __FILE__ ) . 'js/helper.js'); 134 wp_enqueue_script('helper.js?v=1 4');134 wp_enqueue_script('helper.js?v=15'); 135 135 136 136 wp_register_script('render.js', plugin_dir_url( __FILE__ ) . 'js/render.js'); 137 wp_enqueue_script('render.js?v=1 4');137 wp_enqueue_script('render.js?v=15'); 138 138 139 139 wp_register_script('vote.js', plugin_dir_url( __FILE__ ) . 'js/vote.js'); … … 144 144 145 145 wp_register_script('steem.plugin.js', plugin_dir_url( __FILE__ ) . 'js/steem.plugin.js'); 146 wp_enqueue_script('steem.plugin.js?v=1 4');146 wp_enqueue_script('steem.plugin.js?v=15'); 147 147 148 148 wp_register_style('steem.plugin.css', plugin_dir_url( __FILE__ ) . 'css/steem.plugin.css'); 149 wp_enqueue_style('steem.plugin.css?v=1 4');149 wp_enqueue_style('steem.plugin.css?v=15'); 150 150 } 151 151
Note: See TracChangeset
for help on using the changeset viewer.