Vlad Kurkin (b_vladi) wrote in changelog,
Vlad Kurkin
b_vladi
changelog

[livejournal] r19556: LJSUP-8974: RTE: Ability to add and disp...

Committer: vkurkin
LJSUP-8974: RTE: Ability to add and display lj-like buttons
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-02 02:00:13 UTC (rev 19555)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-02 02:06:52 UTC (rev 19556)
@@ -798,8 +798,6 @@
 						onClick : function(){
 							var attr = [], likeHtml = '';
 
-							ljNoteData.LJLikeCommand.node && ljNoteData.LJLikeCommand.node.remove();
-
 							for(var i = 0; i < buttonsLength; i++){
 								var button = likeButtons[i];
 								if(ljLikeInputs.$[i].checked){
@@ -809,7 +807,14 @@
 							}
 
 							if(attr.length){
-								editor.insertHtml('<div class="lj-like" lj-cmd="LJLikeCommand" buttons="' + attr.join(',') + '">' + likeHtml + '</div>'); // IE7 fix
+								if(ljNoteData.LJLikeCommand.node){
+									ljNoteData.LJLikeCommand.node.setAttribute('buttons', attr.join(','));
+									ljNoteData.LJLikeCommand.node.setHtml(likeHtml);
+								} else {
+									editor.insertHtml('<div class="lj-like" lj-cmd="LJLikeCommand" buttons="' + attr.join(',') + '">' + likeHtml + '</div>'); // IE7 fix
+								}
+							} else if(ljNoteData.LJLikeCommand.node){
+								ljNoteData.LJLikeCommand.node.remove();
 							}
 
 							ljLikeDialog.hide();

Tags: b_vladi, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments