244 lines
7.2 KiB
244 lines
7.2 KiB
<?php if (JAK_SHOW_IPS) { ?>
|
|
<script src="<?php echo BASE_URL;?>js/leaflet.js" type="text/javascript"></script>
|
|
<?php } ?>
|
|
<script src="<?php echo BASE_URL;?>js/emoji.js" type="text/javascript"></script>
|
|
<?php if ($jakuser->getVar("files") && $livechat['status'] == 1 && $livechat['ended'] == 0) { ?>
|
|
<script type="text/javascript" src="<?php echo BASE_URL_ORIG;?>js/dropzone.js"></script>
|
|
<?php } ?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
// We need to load the chat
|
|
activeConvID = <?php echo $page1;?>;
|
|
getInfo(activeConvID);
|
|
// Load the client information
|
|
getClientInfo('<a data-chat="info">', true);
|
|
|
|
$(document).on("click", ".edit-msg", function(e) {
|
|
e.preventDefault();
|
|
|
|
if ($(this).hasClass('active')) {
|
|
$('#msgeditid, #msgquoteid').val("");
|
|
$('.edit-msg, .edit-quote').removeClass('active');
|
|
$('.media-text').removeClass('highlight');
|
|
$('#message').val("").focus();
|
|
} else {
|
|
$('#msgquoteid').val("");
|
|
$('.edit-msg, .edit-quote').removeClass('active');
|
|
$('.media-text').removeClass('highlight');
|
|
$(this).addClass('active');
|
|
var editid = $(this).data("id");
|
|
var msgtoedit = $(this).data("msg");
|
|
$('#msgeditid').val(editid);
|
|
$('#msg'+editid).addClass('highlight');
|
|
$('#message').val(msgtoedit).focus();
|
|
}
|
|
});
|
|
|
|
$(document).on("click", ".edit-quote", function(e) {
|
|
e.preventDefault();
|
|
|
|
if ($(this).hasClass('active')) {
|
|
$('#msgquoteid, #msgeditid, #message').val("");
|
|
$('.edit-quote, .edit-msg').removeClass('active');
|
|
$('.media-text').removeClass('highlight');
|
|
$('#message').focus();
|
|
} else {
|
|
$('#msgeditid, #message').val("");
|
|
$('.edit-quote, .edit-msg').removeClass('active');
|
|
$('.media-text').removeClass('highlight');
|
|
$(this).addClass('active');
|
|
var editid = $(this).data("id");
|
|
$('#msgquoteid').val(editid);
|
|
$('#msg'+editid).addClass('highlight');
|
|
$('#message').focus();
|
|
}
|
|
});
|
|
|
|
$(document).on("click", ".edit-remove", function(e) {
|
|
e.preventDefault();
|
|
|
|
var _this = $(this);
|
|
var msgid = $(_this).data("id");
|
|
var plevel = $(_this).data("plevel");
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: ls.main_url + 'ajax/oprequests.php',
|
|
data: "oprq=hidemsg&id="+msgid+"&cid="+activeConvID+"&plevel="+plevel+"&uid="+ls.opid,
|
|
dataType: 'json',
|
|
success: function(msg){
|
|
|
|
if (msg.status) {
|
|
$(_this).toggleClass("text-danger");
|
|
$(_this).data("plevel", msg.plevel);
|
|
md.showNotification('check', msg.txt, 'success', 'top', 'right');
|
|
} else {
|
|
md.showNotification('warning', msg.txt, 'danger', 'top', 'right');
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
|
|
$(document).on("click", ".edit-starred", function(e) {
|
|
e.preventDefault();
|
|
|
|
var _this = $(this);
|
|
var msgid = $(_this).data("id");
|
|
var starred = $(_this).data("starred");
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: ls.main_url + 'ajax/oprequests.php',
|
|
data: "oprq=starred&id="+msgid+"&cid="+activeConvID+"&starred="+starred+"&uid="+ls.opid,
|
|
dataType: 'json',
|
|
success: function(msg){
|
|
|
|
if (msg.status) {
|
|
if (starred == 1) {
|
|
$(_this).find('i').removeClass("fa fa-star").addClass('fal fa-star');
|
|
} else {
|
|
$(_this).find('i').removeClass("fal fa-star").addClass('fa fa-star');
|
|
}
|
|
$(_this).data("starred", msg.starred);
|
|
md.showNotification('check', msg.txt, 'success', 'top', 'right');
|
|
} else {
|
|
md.showNotification('warning', msg.txt, 'danger', 'top', 'right');
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
|
|
$(document).on('click', '.lc-info', function(e) {
|
|
e.preventDefault();
|
|
getClientInfo(this, false);
|
|
});
|
|
|
|
// Translate text live
|
|
$(document).on("click", ".translate-chat", function(e) {
|
|
e.preventDefault();
|
|
|
|
var _this = $(this);
|
|
var msgid = $(_this).data("id");
|
|
|
|
// Show the loader
|
|
$(".tl-loader", _this).removeClass("d-none");
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: ls.main_url + 'ajax/oprequests.php',
|
|
data: "oprq=translatechat&id="+msgid+"&cid="+activeConvID+"&uid="+ls.opid,
|
|
dataType: 'json',
|
|
success: function(msg){
|
|
|
|
if (msg.status == 1) {
|
|
|
|
// We will add the translation below
|
|
$('#aitranslate'+msgid).html(msg.translation).fadeIn();
|
|
|
|
// Success message
|
|
md.showNotification('check', msg.txt, 'success', 'top', 'right');
|
|
|
|
} else {
|
|
md.showNotification('warning', msg.txt, 'danger', 'top', 'right');
|
|
}
|
|
|
|
// Hide the loader
|
|
$(".tl-loader", _this).addClass("d-none");
|
|
return true;
|
|
}
|
|
});
|
|
});
|
|
|
|
$(document).on('click', '.lc-info', function(e) {
|
|
e.preventDefault();
|
|
getClientInfo(this, false);
|
|
});
|
|
|
|
function getClientInfo(loadInfo,firstload) {
|
|
|
|
if ($(loadInfo).hasClass('active')) {
|
|
$(".flex-client-info").html("");
|
|
$('.lc-info').removeClass('active');
|
|
} else {
|
|
if (!firstload) {
|
|
$('.lc-info').removeClass('active');
|
|
$(loadInfo).addClass('active');
|
|
}
|
|
|
|
|
|
|
|
if (!$('.main-chat-output').hasClass('flex-info-open')) $('.main-chat-output').addClass('flex-info-open');
|
|
var creq = $(loadInfo).data('chat');
|
|
|
|
if (creq && activeConvID) {
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: ls.main_url + 'ajax/chatinfo.php',
|
|
data: "creq="+creq+"&uid="+ls.opid+"&convid="+activeConvID,
|
|
dataType: 'json',
|
|
success: function(msg){
|
|
|
|
if (msg.status == 1) {
|
|
$('#lcinfo-container').fadeIn();
|
|
$(".flex-client-info").html(msg.html);
|
|
$("#lcinfo-title").html(msg.title);
|
|
$("#lcinfo-icon").html(msg.icon);
|
|
$('.selectpicker').selectpicker('refresh');
|
|
return true;
|
|
} else {
|
|
md.showNotification('warning', msg.text, 'danger', 'top', 'right');
|
|
$(".flex-client-info").html("");
|
|
$('#lcinfo-container').fadeOut();
|
|
return false;
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
<?php if ($jakuser->getVar("files") && $livechat['status'] == 1 && $livechat['ended'] == 0) { ?>
|
|
Dropzone.autoDiscover = false;
|
|
$(function() {
|
|
// Now that the DOM is fully loaded, create the dropzone, and setup the
|
|
// event listeners
|
|
var myDropzone = new Dropzone("#cUploadDrop", {dictResponseError: "SERVER ERROR",
|
|
dictDefaultMessage: "<?php echo $jkl['u9'];?>",
|
|
acceptedFiles: "<?php echo JAK_ALLOWEDO_FILES;?>",
|
|
url: "<?php echo BASE_URL_ORIG;?>uploader/uploadero.php"});
|
|
myDropzone.on("sending", function(file, xhr, formData) {
|
|
// Will send the filesize along with the file as POST data.
|
|
formData.append("convID", activeConvID);
|
|
formData.append("userIDU", <?php echo $jakuser->getVar("id");?>);
|
|
formData.append("base_url", "<?php echo BASE_URL_ORIG;?>");
|
|
formData.append("operatorNameU", "<?php echo $jakuser->getVar("name");?>");
|
|
formData.append("operatorLanguage", "<?php echo $USER_LANGUAGE;?>");
|
|
});
|
|
myDropzone.on("complete", function(file) {
|
|
myDropzone.removeAllFiles();
|
|
loadchat = true;
|
|
scrollchat = true;
|
|
getInput(activeConvID);
|
|
});
|
|
});
|
|
<?php } ?>
|
|
|
|
$(document).ready(function(){
|
|
|
|
var clipboard = new ClipboardJS('.clipboard');
|
|
|
|
clipboard.on('success', function(e) {
|
|
|
|
md.showNotification('check', '<?php echo addslashes($jkl["g284"]);?>', 'success', 'top', 'right');
|
|
|
|
e.clearSelection();
|
|
});
|
|
|
|
});
|
|
</script>
|
|
|