Шитпостинг

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

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


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


Авиация

Сообщений 81 страница 90 из 134

81

Код:

document.addEventListener("paste", function(event) {
    var items = event.clipboardData.items;
    if (items) {
        for (var i = 0; i < items.length; i++) {
            if (items[i].type.indexOf("image") !== -1) {
                var blob = items[i].getAsFile();
                var URLObj = window.URL || window.webkitURL;
                var source = URLObj.createObjectURL(blob);
                var img = new Image();
                img.src = source;
                img.onload = function() {
                    // do something with the image
                    // for example, upload it to a server
                    // you can use FormData and XMLHttpRequest for that
                    var fd = new FormData();
                    fd.append("image", blob);
                    var xhr = new XMLHttpRequest();
                    xhr.open("POST", "path/to/upload");
                    xhr.send(fd);
                }
            }
        }
    }
});


82

let imgur_upload_form = '<form id="imgur_uploader"><chx_i class="chxicon-upload"></chx_i><input id="imgur_uploader_input" type="file" accept="image/*" name="chximg"></form>'
document.querySelector(".chx-imgur-uploader").insertAdjacentHTML('beforeend', imgur_upload_form);

document.querySelector("[name='chximg']").addEventListener("change", event => {

    let file_data = document.querySelector('#imgur_uploader_input').files[0];
    let form_data = new FormData();
    form_data.append('chximg', file_data);
    var request = new XMLHttpRequest();
    request.open('POST', chatx_server + 'imgur_uploader.php', true);

    request.setRequestHeader('Accept', 'multipart/form-data');

    request.send(form_data);
    loadingModal();
    request.onload = function() {

        if (this.status >= 200 && this.status < 400) {

            var form_data = this.response;
            generateImageTagAndSend(form_data);
        } else {
            // We reached our target server, but it returned an error
        }
    };

    request.onerror = function() {};
});

document.addEventListener("paste", function(event) {
    var items = event.clipboardData.items;
    if (items) {
        for (var i = 0; i < items.length; i++) {
            if (items[i].type.indexOf("image") !== -1) {
                var blob = items[i].getAsFile();
                var URLObj = window.URL || window.webkitURL;
                var source = URLObj.createObjectURL(blob);
                var img = new Image();
                img.src = source;
                img.onload = function() {
                    var form_data = new FormData();
                    form_data.append("chximg", blob);
                    var request = new XMLHttpRequest();
                    request.open('POST', chatx_server + 'imgur_uploader.php', true);
               
                    request.setRequestHeader('Accept', 'multipart/form-data');
               
                    request.send(form_data);
                    loadingModal();
                    request.onload = function() {
               
                        if (this.status >= 200 && this.status < 400) {
               
                            var form_data = this.response;
                            generateImageTagAndSend(form_data);
                        } else {
                            // We reached our target server, but it returned an error
                        }
                    };
               
                    request.onerror = function() {};
                }
            }
        }
    }
});

83

Код:
let imgur_upload_form = '<form id="imgur_uploader"><chx_i class="chxicon-upload"></chx_i><input id="imgur_uploader_input" type="file" accept="image/*" name="chximg"></form>';
document.querySelector(".chx-imgur-uploader").insertAdjacentHTML('beforeend', imgur_upload_form);

function uploadImage(file) {
    let form_data = new FormData();
    form_data.append('chximg', file);
    let request = new XMLHttpRequest();
    request.open('POST', chatx_server + 'imgur_uploader.php', true);

    request.setRequestHeader('Accept', 'multipart/form-data');
    request.send(form_data);
    loadingModal();

    request.onload = function() {
        if (this.status >= 200 && this.status < 400) {
            generateImageTagAndSend(this.response);
        } else {
            // We reached our target server, but it returned an error
        }
    };

    request.onerror = function() {};
}

document.querySelector("[name='chximg']").addEventListener("change", event => {
    let file_data = document.querySelector('#imgur_uploader_input').files[0];
    uploadImage(file_data);
});

document.addEventListener("paste", function(event) {
    let items = event.clipboardData.items;
    if (items) {
        for (let i = 0; i < items.length; i++) {
            if (items[i].type.indexOf("image") !== -1) {
                let blob = items[i].getAsFile();
                uploadImage(blob);
                break;
            }
        }
    }
});

84

Код:
let src = chatx_server + 'assets/audio/1_1.ogg';
let audio = new Audio(src);

audio.addEventListener("ended", function() {
audio.currentTime = 0;
});

function playSound() {
if (audio.paused) {
audio.play();
} else {
audio.currentTime = 0;
}
}

85

https://css-tricks.com/almanac/properties/a/all/

86

Код:
const bb1 = document.querySelector('#bb1');
bb1.addEventListener('click', () => {
  bbtags("shoutbox-comment", "[b]", "[/b]");
});

const bb2 = document.querySelector('#bb2');
bb2.addEventListener('click', () => {
  bbtags("shoutbox-comment", "[u]", "[/u]");
});

const bb3 = document.querySelector('#bb3');
bb3.addEventListener('click', () => {
  bbtags("shoutbox-comment", "[i]", "[/i]");
});

const bb4 = document.querySelector('#bb4');
bb4.addEventListener('click', () => {
  const form = document.querySelector('.shoutbox-form');
  const height = form.offsetHeight;
  const colorPrompt = document.querySelector('.chx-color-bb-prompt');
  colorPrompt.style.height = height - 3;

  const imagePrompt = document.querySelector('.chx-image-bb-prompt');
  imagePrompt.style.display = 'none';
  const linkPrompt = document.querySelector('.chx-link-bb-prompt');
  linkPrompt.style.display = 'none';
  colorPrompt.style.display = 'block';

  const bb4_1 = document.querySelector('#bb4_1');
  bb4_1.addEventListener('click', () => {
    bbtags("shoutbox-comment", "[color=red]", "[/color]");
  });
  
  const bb4_2 = document.querySelector('#bb4_2');
  bb4_2.addEventListener('click', () => {
    bbtags("shoutbox-comment", "[color=orange]", "[/color]");
  });
  
  const bb4_3 = document.querySelector('#bb4_3');
  bb4_3.addEventListener('click', () => {
    bbtags("shoutbox-comment", "[color=yellow]", "[/color]");
  });
  
  const bb4_4 = document.querySelector('#bb4_4');
  bb4_4.addEventListener('click', () => {
    bbtags("shoutbox-comment", "[color=green]", "[/color]");
  });
  
  const bb4_5 = document.querySelector('#bb4_5');
  bb4_5.addEventListener('click', () => {
    bbtags("shoutbox-comment", "[color=lightblue]", "[/color]");
  });
  
  const bb4_6 = document.querySelector('#bb4_6');
  bb4_6.addEventListener('click', () => {
    bbtags("shoutbox-comment", "[color=blue]", "[/color]");
  });
  
  const bb4_7 = document.querySelect

87

function errorNameEmpty() {
    jQuery('.name-required').css({
        'display': 'block'
    });
    setTimeout(function() {
        jQuery('.name-required').fadeOut(300);
    }, 2000);
}

// Submit form if name field is filled in, otherwise show warning
function chatSubmit() {
    if (jQuery('#false_shoutbox_name').val() === '') {
        errorNameEmpty();
    } else {
        jQuery("#chx-new-message").submit();
        jQuery('.chx-pre-textarea, #chx-new-message').removeClass("scrollable");
        jQuery(".chx-container").stop().animate({
            scrollTop: jQuery(".shoutbox-content")[0].scrollHeight
        }, 0);
    }
}

88

function errorNameEmpty() {
    document.querySelector('.name-required').style.display = 'block';
    setTimeout(() => {
        document.querySelector('.name-required').style.display = 'none';
    }, 2000);
}

function chatSubmit() {
    const nameInput = document.querySelector('#false_shoutbox_name');
    if (nameInput.value === '') {
        return errorNameEmpty();
    }

    const preTextarea = document.querySelector('.chx-pre-textarea');
    const messageForm = document.querySelector('#chx-new-message');
    preTextarea.classList.remove("scrollable");
    messageForm.classList.remove("scrollable");

    const container = document.querySelector(".chx-container");
    const content = document.querySelector(".shoutbox-content");
    container.scrollTop = content.scrollHeight;

    document.querySelector("#chx-new-message").submit();
}

89

/**
* Shows a warning message if the name input is empty.
*/
function showNameRequiredWarning() {
    const nameRequiredWarning = document.querySelector('.name-required');
    nameRequiredWarning.style.display = 'block';
    setTimeout(() => {
        nameRequiredWarning.style.display = 'none';
    }, 2000);
}

/**
* Submits the chat form if the name input is filled.
*/
function submitChatForm() {
    const nameInput = document.querySelector('#false_shoutbox_name');
    if (nameInput.value.trim() === '') {
        return showNameRequiredWarning();
    }

    const preTextarea = document.querySelector('.chx-pre-textarea');
    const messageForm = document.querySelector('#chx-new-message');
    preTextarea.classList.remove("scrollable");
    messageForm.classList.remove("scrollable");

    const container = document.querySelector(".chx-container");
    const content = document.querySelector(".shoutbox-content");
    container.scrollTop = content.scrollHeight;

    document.querySelector("#chx-new-message").submit();
}

90

/**
* Shows a warning message if the name input is empty.
*/
function showNameRequiredWarning() {
    const nameRequiredWarning = document.querySelector('.name-required');
    nameRequiredWarning.style.display = 'block';
    setTimeout(() => {
        nameRequiredWarning.style.display = 'none';
    }, 2000);
}

/**
* Submits the chat form if the name input is filled.
*/
function submitChatForm() {
    const nameInput = document.querySelector('#false_shoutbox_name');
    if (nameInput.value.trim() === '') {
        showNameRequiredWarning();
        return;
    }

    const preTextarea = document.querySelector('.chx-pre-textarea');
    const messageForm = document.querySelector('#chx-new-message');
    preTextarea.classList.remove("scrollable");
    messageForm.classList.remove("scrollable");

    const container = document.querySelector(".chx-container");
    const content = document.querySelector(".shoutbox-content");
    container.scrollTop = content.scrollHeight;

    document.querySelector("#chx-new-message").submit();
}

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

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


Похожие темы


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