-
-
Save cionman/27efbcd86779262bae011e62eaa3ca0e 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
<script> | |
/** | |
* loadRoomList 에서 데이터를 받아왔을 때 | |
*/ | |
FirebaseChat.prototype.getRoomList = function(snapshot){ | |
var arrRoomListHtml = []; | |
var cbDisplayRoomList = function(data){ | |
//...생략 | |
// 채팅방을 로드 후 url에 roomId파라미터가 있으면 채팅방을 클릭한다. | |
var paramData = FirebaseChat.getParam('roomId'); | |
if(paramData && paramData.length > 0){ | |
document.getElementById('liRoom' + paramData).click(); | |
history.replaceState('','', '/'); | |
} | |
} | |
/** | |
* 파라미터 값을 확인 | |
*/ | |
FirebaseChat.getParam = function (name){ | |
var result = ""; | |
var queryString = window.location.search; | |
var paramMap = {} | |
if (queryString == "") result = undefined; | |
if (typeof result != "undefined"){ | |
var params = queryString.split("?")[1]; | |
if (params == "") result = undefined; | |
if (typeof result != "undefined") { | |
var paramObj = params.split("&"); | |
for (var i=0; i<paramObj.length; i++){ | |
var datas = paramObj[i].split("="); | |
paramMap[datas[0]] = datas[1]; | |
} | |
result = paramMap[name]; | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment