<commit_before>/**
* Javascript meant to update the posts
* with appropriate UI elements
*/
define('app.thread_post', ['jquery', 'jquery_ui', 'lib.editor'], function($, UI, Editor){

    var app = {

        'start' : function() {

            Editor.initEditor();

            $('#reply-editor').on('submit', function(){
                
                // grab the content of the editor and add to textarea
                var editorContent = Editor.tinyMCE.activeEditor.getContent({'format' : 'raw'})
                $('#body').html(editorContent);
            });

            // on click event for preview section
            $('#preview-button').on('click', function(){

                
                // update preview section
                $("#preview-content").html(Editor.tinyMCE.activeEditor.getContent({'format' : 'raw'}));

            });

            // initialize content for page
            $("#post-edited-dialog").dialog({
                autoOpen: false,
            });

            $("div.reply-edited-dialog").dialog({
                autoOpen: false,
            });

            // note may not use dialog because there is a chance it will
            // not appear well on phone
            $('#post-edited').on('click', function(){

                $('#post-edited-dialog').dialog('open');

            });

            // initialize links for editing
            $('a.edited-reply-link').on('click', function(){

                // go up a level and find the closest dialog
                $("#" + $(this).attr('dialog-link')).dialog('open')

            });

            // link for replying, generates quote in reply section
            $('button.reply-link').on('click', function(){

                var replyContent = $(this).siblings('div.reply-content').html();
                var replyUser = $(this).siblings('table.profile-info').find('a.reply-user').text();
                replyContent = "<blockquote>" + replyContent + "<br>From: " + replyUser  + "</blockquote>\n\n"
                $("#body").val(replyContent);

                // scroll to body element
                $("html, body").animate({ scrollTop: $('#body').offset().top }, 1000);
            });
        }
    }

    return app;

});

require(['app.thread_post'], function(app){
    app.start();
});<commit_msg>Fix replies and formatting changes for code<commit_after>/**
* Javascript meant to update the posts
* with appropriate UI elements
*/
define('app.thread_post', ['jquery', 'jquery_ui', 'lib.editor'], function($, UI, Editor){

    var app = {

        'start' : function() {

            Editor.initEditor();

            // update form textarea before submit so that we can submit
            $('#reply-editor').on('submit', function(){
                var editorContent = Editor.tinyMCE.activeEditor.getContent({'format' : 'raw'})
                $('#body').html(editorContent);
            });

            // on click event for preview section update its preview section
            $('#preview-button').on('click', function(){
                $("#preview-content").html(Editor.tinyMCE.activeEditor.getContent({'format' : 'raw'}));
            });

            // initialize content for page
            $("#post-edited-dialog").dialog({
                autoOpen: false,
            });

            $("div.reply-edited-dialog").dialog({
                autoOpen: false,
            });

            // note may not use dialog because there is a chance it will not appear well on phone
            // open dialog for edited post
            $('#post-edited').on('click', function(){
                $('#post-edited-dialog').dialog('open');
            });

            // initialize links for edited replies
            $('a.edited-reply-link').on('click', function(){

                // go up a level and find the closest dialog
                $("#" + $(this).attr('dialog-link')).dialog('open')
            });

            // link for replying, generates quote in reply section
            $('button.reply-link').on('click', function(){

                var replyContent = $(this).siblings('div.reply-content').html();
                var replyUser = $(this).siblings('table.profile-info').find('a.reply-user').text();
                replyContent = "<blockquote>" + replyContent + "<br>From: " + replyUser  + "</blockquote>\n\n"
                Editor.tinyMCE.activeEditor.setContent(replyContent);

                // scroll to body element
                $("html, body").animate({ scrollTop: $('#body').offset().top }, 1000);
            });
        }
    }

    return app;

});

// start app on page load
require(['app.thread_post'], function(app){
    app.start();
});
{'fraction_non_alphanumeric': 0.16294405445649862, 'fraction_numerical': 0.0017017655817911082, 'mean_word_length': 1.8189448441247003, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3288784', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1157, 'n_words': 290}