Шитпостинг

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Шитпостинг » Обои для рабочего стола » Авиация


Авиация

Сообщений 41 страница 50 из 134

41

Код:
        function load() {
            if (loadPaused) {
                jQuery.ajax({
                    dataType: "json",
                    url: chatx_server + 'load.php',
                    xhrFields: {
                        withCredentials: true
                    },
                    success: function(data) {
                        if (!secondLoad) {
                            appendComments(data);
                            scrollBottom();
                        } else {
                            var wrapper = document.querySelector(".simplebar-content-wrapper");
                            ul = jQuery('chx_ul.shoutbox-content');
                            if ((wrapper.scrollHeight - wrapper.scrollTop - 20) <= wrapper.clientHeight && mouseDown !== 1 && !document.querySelector(".shoutbox-comment-ago:hover")) {
                                if (ulHist.children.length > 0) {
                                    ulHist.innerHTML = "";
                                    document.querySelector('.chx-history chx_i').style.display = "block";
                                    document.querySelector('.chx-history chx_div').style.display = "none";
                                }
                                appendComments(data);
                                scrollBottom();
                            }

                        }
                        secondLoad = true;
                        notification();
                        highlightMyMsg();

                    }

                });
            } else {
                console.log('load paused')
            }
        }

42

Код:
function load() {
    if (!loadPaused) {
        console.log('load paused');
        return;
    }

    var xhr = new XMLHttpRequest();
    xhr.responseType = "json";
    xhr.open("GET", chatx_server + 'load.php');
    xhr.withCredentials = true;

    xhr.onload = function() {
        if (xhr.status !== 200) {
            return;
        }

        var wrapper = document.querySelector(".simplebar-content-wrapper");
        var ul = document.querySelector('chx_ul.shoutbox-content');

        if (!secondLoad) {
            appendComments(xhr.response);
            scrollBottom();
        } else if ((wrapper.scrollHeight - wrapper.scrollTop - 20) <= wrapper.clientHeight && mouseDown !== 1 && !document.querySelector(".shoutbox-comment-ago:hover")) {
            if (ulHist.children.length > 0) {
                ulHist.innerHTML = "";
                document.querySelector('.chx-history chx_i').style.display = "block";
                document.querySelector('.chx-history chx_div').style.display = "none";
            }
            appendComments(xhr.response);
            scrollBottom();
        }

        secondLoad = true;
        notification();
        highlightMyMsg();
    };

    xhr.send();
}

43

Код:
            shoutboxForm = jQuery('.shoutbox-form'),
            form = shoutboxForm.find('form'),
            nameElement = form.find('#shoutbox-name'),
            commentElement = form.find('#shoutbox-comment'),

44

Код:
const shoutboxForm = document.querySelector('.shoutbox-form');
const form = shoutboxForm.querySelector('form');
const nameElement = form.querySelector('#shoutbox-name');
const commentElement = form.querySelector('#shoutbox-comment');


45

Код:
nameElement.val(localStorage.getItem('nameElement') || "");

46

nameElement.value = localStorage.getItem('nameElement') || "";

47

Код:
        form.submit(function(e) {
            e.preventDefault();

            if (!canPostComment) return;

            let name = sessionName === '' ? nameElement.val().trim() : sessionName;
            let comment = commentElement.val().trim();

            if (name.length && comment.length && comment.length <= m_c) {

                publish(name, comment);

                // Prevent new shouts from being published
                canPostComment = false;

                // Allow a new comment to be posted after 0.5 seconds
                setTimeout(function() {
                    canPostComment = true;
                }, 500);

            }

        });

48

Код:
form.addEventListener("submit", function(e) {
    e.preventDefault();

    if (!canPostComment) return;

    let name = sessionName === '' ? nameElement.value.trim() : sessionName;
    let comment = commentElement.value.trim();

    if (name.length && comment.length && comment.length <= m_c) {

        publish(name, comment);

        // Prevent new shouts from being published
        canPostComment = false;

        // Allow a new comment to be posted after 0.5 seconds
        setTimeout(function() {
            canPostComment = true;
        }, 500);

    }
});

49

jQuery('chx_ul').on('click', '.shoutbox-comment-reply', function(e) {
            let replyName = jQuery(this).data('name');
            commentElement.val('@' + '' + replyName + ' ').focus();
        });

50

Код:
document.querySelector('chx_ul').addEventListener('click', function(e) {
    if (!e.target.classList.contains('shoutbox-comment-reply')) {
        return;
    }
    let replyName = e.target.dataset.name;
    commentElement.value = '@' + '' + replyName + ' ';
    commentElement.focus();
});

Быстрый ответ

Напишите ваше сообщение и нажмите «Отправить»


Похожие темы


Вы здесь » Шитпостинг » Обои для рабочего стола » Авиация