From 4c5feeaf06e2f160bd75bf1919cb9920835efc87 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Sat, 15 Feb 2014 16:35:10 +0700 Subject: JS cleanup --- web/scripts3.js | 376 +------------------------------------------------------- 1 file changed, 5 insertions(+), 371 deletions(-) diff --git a/web/scripts3.js b/web/scripts3.js index 8445ee19..2b12bfbd 100644 --- a/web/scripts3.js +++ b/web/scripts3.js @@ -1,18 +1,5 @@ +/* var ws=null; -var currentPMUser=""; -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); @@ -31,11 +18,11 @@ function initWS() { try { var jsonMsg=$.parseJSON(msg.data); if(jsonMsg.rid>0) { - incomingComment(jsonMsg); + //incomingComment(jsonMsg); } else if(jsonMsg.mid>0) { - incomingPost(jsonMsg); + //incomingPost(jsonMsg); } else { - incomingPM(jsonMsg); + //incomingPM(jsonMsg); } } catch(err) { console.log(err); @@ -50,353 +37,7 @@ function wsSendKeepAlive() { ws.send(' '); } } - -/******************************************************************************/ - -function initPMUList() { - var ul=$('#pmulist'); - ul.empty(); - $.each(lastConversations,function(i,item) { - var img=$("").attr("src","https://i.juick.com/as/"+item.uid+".png"); - var a=$("").attr("href","#chat/"+item.uname); - a.append(img).append(item.uname); - if(item.MessagesCount) { - a.append($("
").attr("class","unreadcnt").text(item.MessagesCount)); - } - var li=$("
  • ").append(a); - ul.append(li); - }); -} - -/******************************************************************************/ - -function incomingPost(msg) { - console.log(msg); - if(groups[0].MessagesCount>0) { - groups[0].MessagesCount++; - } else { - groups[0].MessagesCount=1; - } - initGroupsList(); -} - -function incomingComment(msg) { - console.log(msg); -} - -function showGroup(gid) { - currentPMUser=""; - currentMID=0; - groups[0].MessagesCount=0; - initGroupsList(); - - $.getJSON('https://api.juick.com/home?hash='+hash+'&callback=?').done(function(data) { - var ul=$('