1(function( $ ) { 2 3 $(function() { 4 $( '.fallback' ).each(function(){ 5 if ( $(this).attr('type') == 'text') { 6 $(this).addClass( 'color-field' ); 7 } 8 }); 9 }); 10 11 // Add Color Picker to all inputs that have 'color-field' class 12 $(document).ready(function() { 13 $('.color-field').wpColorPicker(); 14 }); 15 16})( jQuery ); 17 18jQuery(document).ready(function(){ 19 bpGroupChatHeartbeat(); 20 bpGroupChatLoadMessages('fresh'); 21 jQuery(document).everyTime(5000, function() { 22 bpGroupChatLoadMessages(); 23 }, 0); 24 jQuery(document).everyTime(10000, function() { 25 bpGroupChatHeartbeat(); 26 }, 0); 27 28}); 29 30function bpGroupChatHeartbeat(i) { 31 var groupInfo = document.getElementById('group-chatroom-info'); 32 if ( groupInfo !== null ) { 33 var groupId = groupInfo.dataset.groupid; 34 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, bp_group_chat_online_query: "1", bp_group_chat_group_id: groupId, action: 'bp_chat_heartbeat' }, function(data) { 35 if ( data != jQuery('#chat-users-online').html() ) { 36 jQuery('#chat-users-online').html(data); 37 } 38 }); 39 } 40} 41 42function bpGroupChatsubmitNewMessage(){ 43 var groupInfo = document.getElementById('group-chatroom-info'); 44 var groupId = groupInfo.dataset.groupid; 45 var message = document.getElementById('bp_group_chat_textbox'); 46 var message_content = message.innerHTML; 47 var emoji = document.getElementById( 'bp-group-chatroom-emoji' ); 48 var video = document.getElementById( 'bp_group_chatroom_video' ); 49 emoji.style.display = 'none'; 50 video.style.display = 'none'; 51 if ( message_content != '' ) { 52 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, bp_group_chat_new_message: "1", bp_group_chat_group_id: groupId, bp_group_chat_textbox: message_content, action: 'bp_chat_new_message' }, function() { 53 message.innerHTML = ''; 54 bpGroupChatLoadMessages(); 55 }); 56 } 57} 58 59function bpGroupChatLoadMessages(update = 'update' ) { 60 var groupInfo = document.getElementById('group-chatroom-info'); 61 if ( groupInfo !== null ) { 62 if ( update == 'fresh' ) { 63 var groupId = groupInfo.dataset.groupid; 64 var messages = document.getElementById( 'bp-chat-chat-container' ); 65 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, bp_group_chat_load_messages: "2", bp_group_chat_group_id: groupId, action: 'bp_chat_load_messages' }, function(data) { 66 if ( data != '' ) { 67 jQuery('#bp-chat-chat-container').html(data); 68 var shouldScroll = messages.scrollTop + messages.clientHeight === messages.scrollHeight; 69 if ( !shouldScroll ) { 70 scrollToBottom(); 71 } 72 } 73 }); 74 75 } else { 76 var groupId = groupInfo.dataset.groupid; 77 var messages = document.getElementById( 'bp-chat-chat-container' ); 78 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, bp_group_chat_load_messages: "1", bp_group_chat_group_id: groupId, action: 'bp_chat_load_messages' }, function(data) { 79 if ( data != '' ) { 80 jQuery('#bp-chat-chat-container').append(data); 81 var shouldScroll = messages.scrollTop + messages.clientHeight === messages.scrollHeight; 82 if ( !shouldScroll ) { 83 scrollToBottom(); 84 } 85 } 86 }); 87 } 88 } 89} 90function scrollToBottom() { 91 var messages = document.getElementById( 'bp-chat-chat-container' ); 92 messages.scrollTop = messages.scrollHeight; 93} 94//Video embed functions 95function bpGroupChatOpenVideo() { 96 var emoji = document.getElementById( 'bp-group-chatroom-emoji' ); 97 emoji.style.display = 'none'; 98 var video = document.getElementById( 'bp_group_chatroom_video' ); 99 video.style.display = 'block'; 100} 101 102function bpGroupChatEmbedVideo() { 103 var video = document.getElementById( 'bp_group_chatroom_video' ); 104 var videoInput = document.getElementById('bp_group_chat_videobox'); 105 var groupInfo = document.getElementById('group-chatroom-info'); 106 var groupId = groupInfo.dataset.groupid; 107 108 if ( videoInput.value != '' ) { 109 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, video_url: videoInput.value, bp_group_chat_new_video: "1", bp_group_chat_group_id: groupId, action: 'bp_chat_new_video' }, function() { 110 videoInput.value = ''; 111 video.style.display = 'none'; 112 bpGroupChatLoadMessages();
113 }); 114 115 } else { 116 video.style.display = 'none'; 117 } 118 119} 120 121// Delete Message 122 123function bpChatroomDeleteMsg( msgId ) { 124 125 var groupInfo = document.getElementById( 'group-chatroom-info' ); 126 var message = document.getElementById( 'bp-group-chatroom-' + msgId ); 127 var groupId = groupInfo.dataset.groupid; 128 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, message_id: msgId, bp_group_chat_delete_msg: "1", bp_group_chat_group_id: groupId, action: 'bp_chat_delete_msg' }, function() { 129 message.style.display = 'none'; 130 }); 131 132} 133 134// Emoji support 135 136//Open Emoji 137function bpGroupChatOpenEmoji() { 138 var video = document.getElementById( 'bp_group_chatroom_video' ); 139 video.style.display = 'none'; 140 var emoji = document.getElementById( 'bp-group-chatroom-emoji' ); 141 emoji.style.display = 'block'; 142 var reveal = document.getElementById('content1' ); 143 reveal.style.display = 'block'; 144} 145 146// Close Emoji window 147function bpGroupChatroonClosePopup() { 148 var emoji = document.getElementById( 'bp-group-chatroom-emoji' ); 149 emoji.style.display = 'none'; 150 151} 152 153// Insert Emoji 154function emojiinsert(icon) { 155 156 var icontag = '<img src="'+bpgc_translate.siteUrl+'includes/icons/'+icon+'" width="18" height="18" style="margin-left:3px; margin-right:3px; vertical-align:middle; -webkit-box-shadow:none; -moz-box-shadow:none; box-shadow:none;">'; 157 var href = 'bpgc_translate.siteUrl' + 'includes/icons.' + icon; 158 var message = document.getElementById('bp_group_chat_textbox'); 159 var emoji = document.getElementById( 'bp-group-chatroom-emoji' ); 160 var msgDiv = document.getElementById('bp-group-chatbox-text-input'); 161 var newMsg = message.innerHTML + icontag; 162 message.innerHTML = newMsg 163 emoji.style.display = 'none'; 164 165 return; 166} 167 168//Display Emoji 169 170jQuery(document).ready(function(){ 171 var tabSelector = document.getElementById('bp-group-chatroom-emoji-selectors'); 172 function revealEmoji(e) { 173 selectorID = e.target.id; 174 idNumber = selectorID.replace( 'tab', '' ); 175 176 for ( i=1; i < 8; i++ ) { 177 if ( i == idNumber ) { 178 var reveal = document.getElementById('content' + idNumber ); 179 if ( reveal != null ) { 180 reveal.style.display = 'block'; 181 } 182 } else { 183 var hide = document.getElementById('content' + i ); 184 if ( hide != null ) { 185 hide.style.display = 'none'; 186 } 187 } 188 } 189 } 190 if ( tabSelector != null ) { 191 tabSelector.addEventListener( 'click', revealEmoji ); 192 } 193}); 194 195// Close thread manually 196function bpChatroomCloseThread() { 197 198 var groupInfo = document.getElementById( 'group-chatroom-info' ); 199 var groupId = groupInfo.dataset.groupid; 200 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, bp_group_chat_close_thread: "1", bp_group_chat_group_id: groupId, action: 'bp_chat_close_thread' }, function(data) { 201 console.log('success: ', data); 202 }); 203 204} 205 206// Insert Media 207 208function bpGroupChatOpenMedia() { 209 210 var attachedImage = {}; 211 var pml_global = {}; 212 213 pml_global.custom_uploader = wp.media.frames.file_frame = wp.media({ 214 title: 'Choose an image', 215 frame: 'select', 216 button: { 217 text: 'Pick it', 218 id: 'pick-link-to-wp-file', 219 onclick: function () { 220 //console.log('hello'); 221 } 222 }, 223 multiple: false 224 }); 225 226 pml_global.custom_uploader.on('select', function () { 227 attachedImage = pml_global.custom_uploader.state().get('selection').first().toJSON(); 228 handleFormSubmit(attachedImage); 229 }); 230 231 pml_global.custom_uploader.open(attachedImage); 232} 233 234function handleFormSubmit(attachedImage) { 235 if(attachedImage) { 236 ; 237 jQuery.post(ajaxurl, { security: chat_ajax_object.check_nonce, imageURL: attachedImage.url, bp_group_chat_insert_image: "1", action: 'bp_chat_insert_image' }, function() { 238 239 }); 240 } 241}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.