Skip to content

Instantly share code, notes, and snippets.

@cionman
Last active November 28, 2017 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cionman/aaada7eb9ccd8a43881aa233a3fb13f9 to your computer and use it in GitHub Desktop.
Save cionman/aaada7eb9ccd8a43881aa233a3fb13f9 to your computer and use it in GitHub Desktop.
유저 초대 모달창 유저리스트 화면 가져오기
<script>
/**
* 초기 필드 변수 할당
*/
FirebaseChat.prototype.init = function(){
// ...생략
this.ulAddUserList = document.getElementById('ulAddUserList');
}
/**
* 챗방 오픈 , 메세지 로드 및 AddUserList
*/
FirebaseChat.prototype.openChatRoom = function(roomId, roomTitle){ // 파라미터 추가
//...생략
this.setAddUserList();
}
/**
* 유저 초대 팝업 모달 창 셋팅
*/
FirebaseChat.prototype.setAddUserList = function(){
this.ulAddUserList.innerHTML = this.ulUserList.innerHTML
var arrAddUserList = Array.prototype.slice.call(this.ulAddUserList.getElementsByTagName('li'));
var cbArrayForEach = function(item){
var itemUserUid = item.getAttribute('data-targetUserUid');
if(this.roomUserlist.indexOf(itemUserUid) === -1){
item.getElementsByClassName('done')[0].classList.remove('hiddendiv');
item.addEventListener('click',function(){
if(Array.prototype.slice.call(this.classList).indexOf('blue-text') == -1){
this.classList.add('blue-text');
}else{
this.classList.remove('blue-text');
}
});
}else{
item.parentNode.removeChild(item);
}
}
arrAddUserList.forEach(cbArrayForEach.bind(this));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment