-
-
Save mappmechanic/ddbc0107eab1e2c64a8169f35acbf5d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On Blur of editting my status update the status by sending Pusher event | |
document.getElementById('mystatus').addEventListener('blur',sendStatusUpdateReq); | |
function sendStatusUpdateReq(event){ | |
var newStatus = document.getElementById('mystatus').innerHTML; | |
var username = document.getElementById('myusername').innerText; | |
channel.trigger("client-status-update", { | |
username: username, | |
status: newStatus | |
}); | |
} | |
// New Update Event Handler | |
// We will take the Comment Template, replace placeholders and append to commentsList | |
function statusUpdated(data){ | |
var updatedMemberHtml = memberTemplateStr; | |
updatedMemberHtml = updatedMemberHtml.replace('{{username}}',data.username); | |
updatedMemberHtml = updatedMemberHtml.replace('{{status}}',data.status); | |
updatedMemberHtml = updatedMemberHtml.replace('{{time}}','just now'); | |
document.getElementById("user-"+data.username).style.color = '#1B8D98'; | |
document.getElementById("user-"+data.username).innerHTML=updatedMemberHtml; | |
setTimeout(function(){ | |
document.getElementById("user-"+data.username).style.color = '#000'; | |
},500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment