<commit_before>$(function() {

    var instance = jsPlumb.getInstance({
        // default drag options
        DragOptions : { cursor: 'pointer', zIndex:2000 },
        // the overlays to decorate each connection with.  note that the label overlay uses a function to generate the label text; in this
        // case it returns the 'labelText' member that we set on each connection in the 'init' method below.
        ConnectionOverlays : [
            [ "Arrow", { location:1 } ],
            [ "Label", {
                location:0.1,
                id:"label",
                cssClass:"aLabel"
            }]
        ],
        Container:"flowchart-demo"
    });

    // this is the paint style for the connecting lines..
    var connectorPaintStyle = {
            lineWidth:4,
            strokeStyle:"#61B7CF",
            joinstyle:"round",
            outlineColor:"white",
            outlineWidth:2
        },
    // .. and this is the hover style.
        connectorHoverStyle = {
            lineWidth:4,
            strokeStyle:"#216477",
            outlineWidth:2,
            outlineColor:"white"
        },
        endpointHoverStyle = {
            fillStyle:"#216477",
            strokeStyle:"#216477"
        },
    // the definition of source endpoints (the small blue ones)
        sourceEndpoint = {
            endpoint:"Dot",
            paintStyle:{
                strokeStyle:"#7AB02C",
                fillStyle:"transparent",
                radius:7,
                lineWidth:3
            },
            isSource:true,
            connector:[ "Flowchart", { stub:[40, 60], gap:10, cornerRadius:5, alwaysRespectStubs:true } ],
            connectorStyle:connectorPaintStyle,
            hoverPaintStyle:endpointHoverStyle,
            connectorHoverStyle:connectorHoverStyle,
            dragOptions:{},
            overlays:[
                [ "Label", {
                    location:[0.5, 1.5],
                    label:"Drag",
                    cssClass:"endpointSourceLabel"
                } ]
            ]
        },
    // the definition of target endpoints (will appear when the user drags a connection)
        targetEndpoint = {
            endpoint:"Dot",
            paintStyle:{ fillStyle:"#7AB02C",radius:11 },
            hoverPaintStyle:endpointHoverStyle,
            maxConnections:-1,
            dropOptions:{ hoverClass:"hover", activeClass:"active" },
            isTarget:true,
            overlays:[
                [ "Label", { location:[0.5, -0.5], label:"Drop", cssClass:"endpointTargetLabel" } ]
            ]
        };


    var contentPosFromEvent = function(evt) {
        // Calculate the click position relative to content which is our scrollable area
        var content = $('#content');
        return {
            x: evt.pageX + content.scrollLeft() - content.offset().left,
            y: evt.pageY + content.scrollTop() - content.offset().top
        }
    };


    var deleteNode = function(id) {
        console.log("Requesting deletion of " + id);

        $.ajax({url: "/flow/nodes/" + id,
            method: "DELETE"
        });
    };

    var putNode = function(id, config) {
        $.ajax({url: "/flow/nodes/" + id,
            method: "PUT",
            processData: false,
            data: JSON.stringify(config),
            contentType: "text/json"
        })
    };

    var postNode = function(nodetype, position) {
        var px = position.x | 0
        var py = position.y | 0
        console.log("Trying to create " + nodetype + " node at (" + px + "," + py + ")");
        $.ajax({url: "/flow/nodes",
            method: "POST",
            processData: false,
            contentType: "text/json",
            data: JSON.stringify({
                "nodeType": nodetype,
                "x": String(px),
                "y": String(py)
            })
        })
    };


    /**
     * Blocking function for connecting two nodes
     * @param sourceId Source node
     * @param targetId Target node
     * @param sourceLocation Source endpoint location<commit_msg>Apparently num | 0 doesn't actually make it a decimal.<commit_after>$(function() {

    var instance = jsPlumb.getInstance({
        // default drag options
        DragOptions : { cursor: 'pointer', zIndex:2000 },
        // the overlays to decorate each connection with.  note that the label overlay uses a function to generate the label text; in this
        // case it returns the 'labelText' member that we set on each connection in the 'init' method below.
        ConnectionOverlays : [
            [ "Arrow", { location:1 } ],
            [ "Label", {
                location:0.1,
                id:"label",
                cssClass:"aLabel"
            }]
        ],
        Container:"flowchart-demo"
    });

    // this is the paint style for the connecting lines..
    var connectorPaintStyle = {
            lineWidth:4,
            strokeStyle:"#61B7CF",
            joinstyle:"round",
            outlineColor:"white",
            outlineWidth:2
        },
    // .. and this is the hover style.
        connectorHoverStyle = {
            lineWidth:4,
            strokeStyle:"#216477",
            outlineWidth:2,
            outlineColor:"white"
        },
        endpointHoverStyle = {
            fillStyle:"#216477",
            strokeStyle:"#216477"
        },
    // the definition of source endpoints (the small blue ones)
        sourceEndpoint = {
            endpoint:"Dot",
            paintStyle:{
                strokeStyle:"#7AB02C",
                fillStyle:"transparent",
                radius:7,
                lineWidth:3
            },
            isSource:true,
            connector:[ "Flowchart", { stub:[40, 60], gap:10, cornerRadius:5, alwaysRespectStubs:true } ],
            connectorStyle:connectorPaintStyle,
            hoverPaintStyle:endpointHoverStyle,
            connectorHoverStyle:connectorHoverStyle,
            dragOptions:{},
            overlays:[
                [ "Label", {
                    location:[0.5, 1.5],
                    label:"Drag",
                    cssClass:"endpointSourceLabel"
                } ]
            ]
        },
    // the definition of target endpoints (will appear when the user drags a connection)
        targetEndpoint = {
            endpoint:"Dot",
            paintStyle:{ fillStyle:"#7AB02C",radius:11 },
            hoverPaintStyle:endpointHoverStyle,
            maxConnections:-1,
            dropOptions:{ hoverClass:"hover", activeClass:"active" },
            isTarget:true,
            overlays:[
                [ "Label", { location:[0.5, -0.5], label:"Drop", cssClass:"endpointTargetLabel" } ]
            ]
        };


    var contentPosFromEvent = function(evt) {
        // Calculate the click position relative to content which is our scrollable area
        var content = $('#content');
        return {
            x: evt.pageX + content.scrollLeft() - content.offset().left,
            y: evt.pageY + content.scrollTop() - content.offset().top
        }
    };


    var deleteNode = function(id) {
        console.log("Requesting deletion of " + id);

        $.ajax({url: "/flow/nodes/" + id,
            method: "DELETE"
        });
    };

    var putNode = function(id, config) {
        $.ajax({url: "/flow/nodes/" + id,
            method: "PUT",
            processData: false,
            data: JSON.stringify(config),
            contentType: "text/json"
        })
    };

    var postNode = function(nodetype, position) {
        var px = Math.round(position.x)
        var py = Math.round(position.y)
        console.log("Trying to create " + nodetype + " node at (" + px + "," + py + ")");
        $.ajax({url: "/flow/nodes",
            method: "POST",
            processData: false,
            contentType: "text/json",
            data: JSON.stringify({
                "nodeType": nodetype,
                "x": String(px),
                "y": String(py)
            })
        })
    };


    /**
     * Blocking function for connecting two nodes
     * @param sourceId Source node
     * @param targetId Target node
     * @param sourceLocation Source endpoint location
{'fraction_non_alphanumeric': 0.11640405520947844, 'fraction_numerical': 0.014535238793208746, 'mean_word_length': 1.603497615262321, 'pattern_counts': {'":': 6, '<': 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': '2195710', 'n_tokens_mistral': 2220, 'n_tokens_neox': 2100, 'n_words': 525}