<commit_before>engine.ImportExtension("qt.core");
engine.ImportExtension("qt.gui");
    
function nextSlide() {
    print("Next slide!");
    changeSlide(1);
}

function prevSlide() {
    print("Previous slide!");
    changeSlide(-1);
}


function changeSlide(dir) {
    print("Changing slide!");
    var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
    var slide_index = dyn.GetAttribute("Current") + dir;
    
    if (dyn.GetAttribute(slide_index + "") == undefined) {
	slide_index = 0;
    } else if (dyn.GetAttribute(slide_index + "") == undefined) {
	//FIXME
	slide_index = 0;
    }

    dyn.SetAttribute("Current", slide_index);
}

function changeSlideTo(slide_index) {
    print("Changing slide!");
    var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
    dyn.SetAttribute("Current", slide_index);
}


function onSlideChanged(attribute, type) {
    print('I changes!!!!11!');
    var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
    var index = dyn.GetAttribute('Current');

    canvassource = me.GetComponentRaw('EC_3DCanvasSource')
    canvassource.source = dyn.GetAttribute(index);
}

// start canvas
var canvas = me.GetComponentRaw('EC_3DCanvas');
frame.DelayedExecute(1).Triggered.connect(this, function () {
    canvas.Start();
});

me.Action("MousePress").Triggered.connect(nextSlide);

var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
dyn.OnAttributeChanged.connect(onSlideChanged);<commit_msg>slidesshow.js twid: add missing 'var' and ; (thanks emacs for pointing out)<commit_after>engine.ImportExtension("qt.core");
engine.ImportExtension("qt.gui");

function nextSlide() {
    print("Next slide!");
    changeSlide(1);
}

function prevSlide() {
    print("Previous slide!");
    changeSlide(-1);
}


function changeSlide(dir) {
    print("Changing slide!");
    var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
    var slide_index = dyn.GetAttribute("Current") + dir;

    if (dyn.GetAttribute(slide_index + "") == undefined) {
	slide_index = 0;
    } else if (dyn.GetAttribute(slide_index + "") == undefined) {
	//FIXME
	slide_index = 0;
    }

    dyn.SetAttribute("Current", slide_index);
}

function changeSlideTo(slide_index) {
    print("Changing slide!");
    var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
    dyn.SetAttribute("Current", slide_index);
}


function onSlideChanged(attribute, type) {
    print('I changes!!!!11!');
    var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
    var index = dyn.GetAttribute('Current');

    var canvassource = me.GetComponentRaw('EC_3DCanvasSource');
    canvassource.source = dyn.GetAttribute(index);
}

// start canvas
var canvas = me.GetComponentRaw('EC_3DCanvas');
frame.DelayedExecute(1).Triggered.connect(this, function () {
    canvas.Start();
});

me.Action("MousePress").Triggered.connect(nextSlide);

var dyn = me.GetComponentRaw("EC_DynamicComponent", "Slidelist");
dyn.OnAttributeChanged.connect(onSlideChanged);
{'fraction_non_alphanumeric': 0.15599070693660802, 'fraction_numerical': 0.005974112180550946, 'mean_word_length': 4.98015873015873, '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': '2866001', 'n_tokens_mistral': 968, 'n_tokens_neox': 954, 'n_words': 166}