Files
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

77 lines
1.9 KiB
JavaScript

/* For licensing terms, see /license.txt */
$(function () {
var parent$ = window.parent.$,
playerSelector = '#' + parent$('mediaelementwrapper').attr('id') + '_html5',
$player = parent$(playerSelector);
var player = $player.get(0),
def = $.Deferred();
if (!$player.length) {
processText(wordsCount);
return;
}
player.preload = 'auto';
function processText(turns) {
var tagEnd = '</span> ',
tagStart = tagEnd + '<span class="text-highlight">',
wordsPerSecond = Math.ceil(wordsCount / turns);
var indexes = Object.keys(words);
var output = '';
for (var i = 0; i < turns; i++) {
var block = indexes.slice(i * wordsPerSecond, i * wordsPerSecond + wordsPerSecond),
index = block[0];
if (!index) {
continue;
}
output += tagStart + words[index];
for (var j = 1; j < block.length; j++) {
index = block[j];
output += ' ' + words[index];
}
}
output += tagEnd;
output = output.slice(tagEnd.length);
$('.page-blank').html(output);
def.resolve(output);
return def.promise();
}
player.ontimeupdate = function () {
var block = Math.ceil(this.currentTime);
$('.text-highlight')
.removeClass('active')
.filter(function (index) {
return index + 1 == block;
})
.addClass('active');
};
player.onloadedmetadata = function () {
var turns = Math.ceil(this.duration);
processText(turns)
.then(function (output) {
var to = window.setTimeout(function () {
player.play();
window.clearTimeout(to);
}, 1500);
});
}
});