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 --- src/java/com/juick/http/www/PageTemplates.java | 2 +- src/java/com/juick/http/www/User.java | 6 ++--- web/scripts3.js | 37 +++++++++++++++++--------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 1c958bd1..768406d9 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -52,7 +52,7 @@ public class PageTemplates { out.print(""); out.print(""); out.print(""); - out.print(""); + out.print(""); if (headers != null) { out.print(headers); } diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 5de54341..38910b01 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -304,9 +304,9 @@ public class User { } else { out.println("
  • "); } -// if (!UserQueries.isInBL(sql, user.UID, visitor.UID) && !UserQueries.isInBL(sql, visitor.UID, user.UID)) { -// out.println("
  • "); -// } + if (!UserQueries.isInBLAny(sql, user.UID, visitor.UID)) { + out.println("
  • "); + } out.println(" "); } else { out.println("
    "); 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($('