Показать сообщение отдельно
  #4 (permalink)  
Старый 20.01.2013, 17:46
Аспирант
Отправить личное сообщение для useruser Посмотреть профиль Найти все сообщения от useruser
 
Регистрация: 20.01.2013
Сообщений: 34

Axios, перенос не в отображении, а в текстовом поле, как будто нажали enter
Вот код
$(document).ready(function () {
    $("div.entry-content").mouseup(function (e) {
        username = $(this).parents("div.post:first").find(".myclass").text();

        var lang = (navigator.language || navigator.systemLanguage || navigator.userLanguage || 'en').substr(0, 2).toLowerCase();
        if (lang == 'ru') {
            quotetext = 'Цитировать выделенное';
        }
        else {
            quotetext = 'Quote selected';
        }

        if (window.getSelection) {
            theSelection = window.getSelection().toString();
        }
        else if (document.getSelection) {
            theSelection = document.getSelection();
        }
        else if (document.selection) {
            theSelection = document.selection.createRange().text;
        }

        $("#addQuote").remove();
        if (theSelection != false && e.which == 1 && username != false) {
            $("body").append('<div id="addQuote" style="left: ' + (e.pageX + 15) + 'px; top: ' + (e.pageY + 15) + 'px;">' + quotetext + '<div class="arrow-up"></div></div>');

            $("#addQuote").click(function () {
                $(this).animate({height:'0', opacity:'0'}, 350, function () {
                    $(this).remove();
                });
//Вот цитирование
                PUNBB.pun_bbcode.insert_text('[quote="' + username + '"]' + theSelection + '[/quote]', '');
//А здесь курсор должен перейти на новую строку
				
            });

            $("#addQuote").oneTime(3000, function () {
                if ($(this).is(':visible')) {
                    $(this).animate({height:'0', opacity:'0', left:'0'}, 350, function () {
                        $(this).remove();
                    });
                }
            });
        }
    });
});
Ответить с цитированием