Вход Регистрация
Файл: sys/static/js/comments.js
Строк: 62
<?php
/**
* Комментарии DCMS-Social v3
* Версия: 1
*/ 

jQuery(function($) {

    $(
document).on('click''.attachments-item .remove', function() {
        var 
parent = $(this).closest('.attachments-item'); 
            
parent.remove(); 
    });

    $(
document).on('click''.load-files', function() {
        var 
hash = $(this).data('hash') || ''
        var 
type = $(this).data('type') || false
        var 
term = $(this).data('term') || false
        var 
title = $(this).text(); 

        
$media = new MediaManager(); 
        
$media.open({
            
selector'.wrap-choose-manager[data-hash="' hash '"]'
            
titletitle
            
typetype
            
termterm
            
onSelected: function(obj) {
                var 
attachments = $('.attachments[data-hash="' hash '"]'); 
                
obj.forEach(function(fileindex) {
                    
attachments.append($('<div/>', {
                        
style'background-image: url(' file.thumbnail ')'
                        class: 
'attachments-item'
                        
append: [
                            $(
'<input/>', {
                                
type'hidden'
                                
valuefile.file_id
                                
name'attachments[]'
                            }), 
                            $(
'<i/>', {
                                class: 
file.icon
                            }), 
                            $(
'<span/>', {
                                class: 
'title'
                                
textfile.title
                            }), 
                            $(
'<span/>', {
                                class: 
'remove'
                                
html'&times;'
                            }), 
                        ]
                    }));
                }); 
            }
        }); 
    });

    $(
document).on('keyup''.ds-editor-textarea', function(event) {
        var 
id = $(this).attr('id'); 
        var 
msg = $(this).val(); 
            
msg msg.replace(new RegExp('r?n','g'), '<br>');


        var 
= $('.ds-editor-helper[data-hash="' id '"]'); 
            
h.html(msg); 

        var 
height h.height(); 

        
height += 19;
        if (
event.keyCode == 13) {
            
height += 16;
        }

        $(
this).css('height'height 'px');  
    }); 

    $(
"form.form-ajax").on("submit", function() {
        var 
formData = new FormData(this);

        $.
ajax({
            
type"POST",
            
url: $(this).attr('action'),
            
data:  formData,
            
processDatafalse,
            
contentTypefalse,
            
success: function(data) {
                $(
'#log').html(data); 
            },
            
error: function() {
                
console.log('Error send'); 
            }
         });

        return 
false;
    });
});
?>
Онлайн: 1
Реклама