From 522dc220a02c36e208935e9f6789c547616269e4 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Tue, 10 Dec 2013 00:16:54 +0700 Subject: #chat/username links --- web/scripts3.js | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'web') diff --git a/web/scripts3.js b/web/scripts3.js index dc2cc330..a8630b7e 100644 --- a/web/scripts3.js +++ b/web/scripts3.js @@ -4,6 +4,16 @@ var currentMID=0; /******************************************************************************/ +function initPage() { + var url=window.location.hash.substring(1); + if(url.substr(0,5)==="chat/") { + var uname=url.substr(5); + showPM(uname); + } +} + +/******************************************************************************/ + function initWS() { ws = new WebSocket("wss://ws.juick.com/?hash="+hash); ws.onopen = function() { @@ -48,7 +58,7 @@ function initPMUList() { ul.empty(); $.each(lastConversations,function(i,item) { var img=$("").attr("src","https://i.juick.com/as/"+item.uid+".png"); - var a=$("").attr("href","#").attr("onclick","return showPM('"+item.uname+"')"); + var a=$("").attr("href","#chat/"+item.uname); a.append(img).append(item.uname); if(item.MessagesCount) { a.append($("
").attr("class","unreadcnt").text(item.MessagesCount)); @@ -323,9 +333,17 @@ function showPM(uname) { initPMUList(); } + currentPMUser=uname; + + var content=$('#content'); + content.empty(); + content.append($('