<commit_before>
// jquery to change background-color of page on click

// color palette listeners

// console.log('Is main.js running?');

$("#darkblue").click(function() {
    canvas.backgroundColor="#9CBFDC";
    canvas.renderAll();
});

$("#medred").click(function() {
    canvas.backgroundColor="#D98F84";
    canvas.renderAll();
});

$("#lightred").click(function() {
    canvas.backgroundColor="#F0D3CE";
    canvas.renderAll();
});

$("#lightblue").click(function() {
    canvas.backgroundColor="#CADDEC";
    canvas.renderAll();
});

$("#lightgrey").click(function() {
    canvas.backgroundColor="#E0E5E7";
    canvas.renderAll();
});

$("#darkred").click(function() {
    canvas.backgroundColor="#D85961";
    canvas.renderAll();
});

// Canvas

var canvas = new fabric.Canvas('canvas', {
  backgroundColor: '#D98F84',
});

//on page load inits base image
window.onload = init;

function init() {
    // console.log('test');
    fabric.Image.fromURL(path, function(img) {
        var x = 60;
        var img = img.scale(0.8);
        img.set("left", x);
        // alert("X value is" + x);
        img.set("top", 100);
        img.selectable = false;
        canvas.add(img);
    });
}


const slider__value = document.querySelector("#slider");

const downloadLink = document.querySelector("#downloadLnk");

slider__value.addEventListener('change', updateImages);

downloadLink.addEventListener('click', saveImage);

var path = './img/transp_antwaun.png'; // antwaun

// var path = './img/prettypurdie500.png'; // Bernard 'Pretty' Purdie


//Adds image to canvas and repeats enterred amount
function updateImages() {
    var bckgcolor = canvas.backgroundColor;
    // alert(bckgcolor);
    canvas.clear();
    canvas.backgroundColor = bckgcolor;
    const imgArray = [];
    for (var i = 0; i < this.value; i++) {
        imgArray.push(path);
    }

    imgArray.forEach((image, index) => {
        fabric.Image.fromURL(image, function(img) {
            var x = 60 + (15 * index);
            console.log("index value is: " + index);
            var img = img.scale(0.8);
            img.set("left", x);
            // alert("X value is" + x);
            img.set("top", 100);
            img.selectable = false;
            canvas.add(img);
        });
    });
}

function saveImage() {
    console.log('saveImage func')
    var dt = canvas.toDataURL({format: 'jpeg'});
    this.href = dt;
}<commit_msg>made path a const<commit_after>
// jquery to change background-color of page on click

// color palette listeners

// console.log('Is main.js running?');

$("#darkblue").click(function() {
    canvas.backgroundColor="#9CBFDC";
    canvas.renderAll();
});

$("#medred").click(function() {
    canvas.backgroundColor="#D98F84";
    canvas.renderAll();
});

$("#lightred").click(function() {
    canvas.backgroundColor="#F0D3CE";
    canvas.renderAll();
});

$("#lightblue").click(function() {
    canvas.backgroundColor="#CADDEC";
    canvas.renderAll();
});

$("#lightgrey").click(function() {
    canvas.backgroundColor="#E0E5E7";
    canvas.renderAll();
});

$("#darkred").click(function() {
    canvas.backgroundColor="#D85961";
    canvas.renderAll();
});

// Canvas

var canvas = new fabric.Canvas('canvas', {
  backgroundColor: '#D98F84',
});

//on page load inits base image
window.onload = init;

function init() {
    // console.log('test');
    fabric.Image.fromURL(path, function(img) {
        var x = 60;
        var img = img.scale(0.8);
        img.set("left", x);
        // alert("X value is" + x);
        img.set("top", 100);
        img.selectable = false;
        canvas.add(img);
    });
}


const slider__value = document.querySelector("#slider");

const downloadLink = document.querySelector("#downloadLnk");

slider__value.addEventListener('change', updateImages);

downloadLink.addEventListener('click', saveImage);

const path = './img/transp_antwaun.png'; // antwaun

// var path = './img/prettypurdie500.png'; // Bernard 'Pretty' Purdie


//Adds image to canvas and repeats enterred amount
function updateImages() {
    var bckgcolor = canvas.backgroundColor;
    // alert(bckgcolor);
    canvas.clear();
    canvas.backgroundColor = bckgcolor;
    const imgArray = [];
    for (var i = 0; i < this.value; i++) {
        imgArray.push(path);
    }

    imgArray.forEach((image, index) => {
        fabric.Image.fromURL(image, function(img) {
            var x = 60 + (15 * index);
            console.log("index value is: " + index);
            var img = img.scale(0.8);
            img.set("left", x);
            // alert("X value is" + x);
            img.set("top", 100);
            img.selectable = false;
            canvas.add(img);
        });
    });
    // var group = new fabric.Group(canvas.getObjects()); //  remove
    // canvas.add(group);
    // canvas.centerObject(group);
    // alert('ran');
    // canvas.renderAll();
}

function saveImage() {
    console.log('saveImage func')
    var dt = canvas.toDataURL({format: 'jpeg'});
    this.href = dt;
}
{'fraction_non_alphanumeric': 0.17857142857142858, 'fraction_numerical': 0.01556264964086193, 'mean_word_length': 2.886046511627907, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5670070', 'n_tokens_mistral': 1625, 'n_tokens_neox': 1571, 'n_words': 320}