<commit_before>var cc_editable_page_dirty = false;

jq_admin_toolbar(document).ready( function() {  
    // Turn off automatic editor creation first.
    CKEDITOR.disableAutoInline = true;

    var cc_text_config = { 
        toolbar : [
                        { name: 'clipboard', items : [ 'Cut','Copy','Paste','-','Undo','Redo' ] },
                    ],
        enterMode : CKEDITOR.ENTER_BR,
        shiftEnterMode : CKEDITOR.ENTER_BR,
        forcePasteAsPlainText : true,
        entities : true,
        floatSpacePinnedOffsetY : 40,
    };

    jq_admin_toolbar('.cc_admin_editable.cc_text_editable').each(function(index) {
        CKEDITOR.inline($(this).attr('id'), cc_text_config); 
    });

    jq_admin_toolbar('#admin-save-changes').click(function() {
        jq_admin_toolbar('#admin-save-status').html('Saving...').show();
        data = new Object();

        jq_admin_toolbar('.cc_admin_editable').each(function() {
            id = jq_admin_toolbar(this).attr('id');

            if (typeof CKEDITOR.instances[id] !== 'undefined') {
                data[id] = CKEDITOR.instances[id].getData();
            } else {
                data[id] = jq_admin_toolbar(this).html();
            }
        });

        jq_admin_toolbar('.cc_hidden_editable').each(function() {
            id = jq_admin_toolbar(this).attr('id');
            data[id] = jq_admin_toolbar(this).val();
        });

        jq_admin_toolbar.ajax({
            url: ADMIN_URL + "/content/entries/save-inline-content", 
            data: data,
            type: 'post',
            error: function(XMLHttpRequest, textStatus, errorThrown){
                jq_admin_toolbar('#admin-save-status').html('Error: ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText).show();
                alert('Error: ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);
            },
            success: function(data){
                cc_editable_page_dirty = false;
                jq_admin_toolbar('#admin-save-status').html('Saved').show().delay(5000).fadeOut();
            }
        });
        
        return false;
    });

    jq_admin_toolbar('.cc_admin_editable').live('focus', function() {
        id = jq_admin_toolbar(this).attr('id');

        if (typeof CKEDITOR.instances[id] !== 'undefined') {
            before = CKEDITOR.instances[id].getData();
        } else {
            before = $(this).html();
        }
    }).live('blur keyup paste DOMNodeInserted', function() { 
        if (!cc_editable_page_dirty) {
            id = jq_admin_toolbar(this).attr('id');

            if (typeof CKEDITOR.instances[id] !== 'undefined') {
                new_content = CKEDITOR.instances[id].getData();
            } else {
                new_content = $(this).html();
            }

            if (before != new_content) { <commit_msg>IE inline editing bug fixes<commit_after>var cc_editable_page_dirty = false;

// Turn off automatic editor creation first.
CKEDITOR.disableAutoInline = true;

jq_admin_toolbar(document).ready( function() {  

    var cc_text_config = { 
        toolbar : [
                        { name: 'clipboard', items : [ 'Cut','Copy','Paste','-','Undo','Redo' ] },
                    ],
        enterMode : CKEDITOR.ENTER_BR,
        shiftEnterMode : CKEDITOR.ENTER_BR,
        forcePasteAsPlainText : true,
        entities : true,
        floatSpacePinnedOffsetY : 40,
    };

    jq_admin_toolbar('.cc_admin_editable.cc_text_editable').each(function(index) {
        CKEDITOR.inline($(this).attr('id'), cc_text_config); 
    });

    jq_admin_toolbar('#admin-save-changes').click(function() {
        jq_admin_toolbar('#admin-save-status').html('Saving...').show();
        data = new Object();

        jq_admin_toolbar('.cc_admin_editable').each(function() {
            id = jq_admin_toolbar(this).attr('id');

            if (typeof CKEDITOR.instances[id] !== 'undefined') {
                data[id] = CKEDITOR.instances[id].getData();
            } else {
                data[id] = jq_admin_toolbar(this).html();
            }
        });

        jq_admin_toolbar('.cc_hidden_editable').each(function() {
            id = jq_admin_toolbar(this).attr('id');
            data[id] = jq_admin_toolbar(this).val();
        });

        jq_admin_toolbar.ajax({
            url: ADMIN_URL + "/content/entries/save-inline-content", 
            data: data,
            type: 'post',
            error: function(XMLHttpRequest, textStatus, errorThrown){
                jq_admin_toolbar('#admin-save-status').html('Error: ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText).show();
                alert('Error: ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);
            },
            success: function(data){
                cc_editable_page_dirty = false;
                jq_admin_toolbar('#admin-save-status').html('Saved').show().delay(5000).fadeOut();
            }
        });
        
        return false;
    });

    jq_admin_toolbar('.cc_admin_editable').live('focus', function() {
        id = jq_admin_toolbar(this).attr('id');

        if (typeof CKEDITOR.instances[id] !== 'undefined') {
            before = CKEDITOR.instances[id].getData();
        } else {
            before = $(this).html();
        }
    }).live('blur keyup paste DOMNodeInserted', function() { 
        if (!cc_editable_page_dirty) {
            id = jq_admin_toolbar(this).attr('id');

            if (typeof CKEDITOR.instances[id] !== 'undefined') {
                new_content = CKEDITOR.instances[id].getData();
            } else {
                new_content = $(this).html();
            }

            if (typeof before !== 'undefined' && before != new_content) { 
{'fraction_non_alphanumeric': 0.1495278069254984, 'fraction_numerical': 0.002098635886673662, 'mean_word_length': 2.1544401544401546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1214589', 'n_tokens_mistral': 1762, 'n_tokens_neox': 1663, 'n_words': 235}