<commit_before>/**!
 * AjaxEdit v0.0.1
 *
 * Lightweight jQuery plugin used to edit HTML regions without reloading
 * the page.
 *
 * Author: <NAME>
 * Licence: MIT
 * Repository: github.com/bfontaine/AjaxEdit 
 *
 **/
;(function( $ ) {

    var defaultOptions = {
         
            /* Define when the element will be set to editable mode.
             * Possible values:
             *      - 'hoverButton': A button labelled "Edit" will appear
             *                       when the user put the cursor over the
             *                       element. If they click on the button,
             *                       the element will become editable. This
             *                       is the default.
             *
             *      - Any other value will be threated as an event on the
             *        element, e.g. "dblclick".
             *
             * This can be a list with multiple values.
             */ 
            editOn: 'hoverButton',

            /* This option allows you to have different names for the fields
             * in your API. 
             */ 
            fields: {
                html: 'html', // the name of the field for HTML
                text: 'text'  // the name of the field for text/markup
            },

            // buttons' labels
            buttons: {
                edit:   'Edit',
                save:   'Save',
                cancel: 'Cancel'
            },

            // if this is set to true, the fields' text values will
            // be preloaded. If this is set to false, their text values
            // will be loaded only if the user try to edit them.
            prefetch: false // #NotImplemented

        },


        // This Error is raised when no URL is provided for
        // GETting/POSTing the content
        noURLException = new Error( 'No URL provided.' ),
                        
        // random key used for unique class attributes
        key = '__' + (0|Math.random()*1000) + 'k' + +new Date(),

        // button class (internal usage only)
        button_class = key + '_button',
        // editor div class (internal usage only)
        editor_class = key + '_editor',

        // the button base which will be used for all buttons
        // .ajaxedit-button class is added for the user
        $baseButton = $( '<input>' )
                        .attr( 'type', 'button' )
                        .addClass([ 'ajaxedit-button', button_class ]),

        // the editor base which will be used for all editors (divs)
        $baseEditor = $( '<div></div>' )
                        .attr( 'contenteditable', true )
                        .addClass( editor_class );


    // attach an "Edit" button to the element, which will be made
    // visible when the user move their mouse over the element
    function attachHoverButton( $el, label, callback ) {

        var $editButton = $baseButton.clone()
                            .attr( 'value', label )
                            .click( callback );

        $el.hover(

            function() {
            
                if ( !$el.data( 'edited' ) ) {<commit_msg>minor syntax change.<commit_after>/**!
 * AjaxEdit v0.0.1
 *
 * Lightweight jQuery plugin used to edit HTML regions without reloading
 * the page.
 *
 * Author: <NAME>
 * Licence: MIT
 * Repository: github.com/bfontaine/AjaxEdit 
 *
 **/
;(function( $ ) {

    var defaultOptions = {
         
            /* Define when the element will be set to editable mode.
             * Possible values:
             *      - 'hoverButton': A button labelled "Edit" will appear
             *                       when the user put the cursor over the
             *                       element. If they click on the button,
             *                       the element will become editable. This
             *                       is the default.
             *
             *      - Any other value will be threated as an event on the
             *        element, e.g. "dblclick".
             *
             * This can be a list with multiple values.
             */ 
            editOn: 'hoverButton',

            /* This option allows you to have different names for the fields
             * in your API. 
             */ 
            fields: {
                html: 'html', // the name of the field for HTML
                text: 'text'  // the name of the field for text/markup
            },

            // buttons' labels
            buttons: {
                edit:   'Edit',
                save:   'Save',
                cancel: 'Cancel'
            },

            // if this is set to true, the fields' text values will
            // be preloaded. If this is set to false, their text values
            // will be loaded only if the user try to edit them.
            prefetch: false // #NotImplemented

        },


        // This Error is raised when no URL is provided for
        // getting/posting the content
        noURLException = new Error( 'No URL provided.' ),
                        
        // random key used for unique class attributes
        key = '__' + ( 0|Math.random() * 1000 ) + 'k' + +new Date(),

        // button class (internal usage only)
        button_class = key + '_button',
        // editor div class (internal usage only)
        editor_class = key + '_editor',

        // the button base which will be used for all buttons
        // .ajaxedit-button class is added for the user
        $baseButton = $( '<input>' )
                        .attr( 'type', 'button' )
                        .addClass([ 'ajaxedit-button', button_class ]),

        // the editor base which will be used for all editors (divs)
        $baseEditor = $( '<div></div>' )
                        .attr( 'contenteditable', true )
                        .addClass( editor_class );


    // attach an "Edit" button to the element, which will be made
    // visible when the user move their mouse over the element
    function attachHoverButton( $el, label, callback ) {

        var $editButton = $baseButton.clone()
                            .attr( 'value', label )
                            .click( callback );

        $el.hover(

            function() {
            
                if ( !$el.data( 'edited' ) ) {
{'fraction_non_alphanumeric': 0.09183187946074545, 'fraction_numerical': 0.0025376685170499604, 'mean_word_length': 1.2699784017278617, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '80057', 'n_tokens_mistral': 1589, 'n_tokens_neox': 1499, 'n_words': 601}