Add loading spinner when using frameReady - refs BT#19389

pull/4096/head
Angel Fernando Quiroz Campos 4 years ago
parent b15498e947
commit b37fe6b662
  1. 7
      main/document/showinframes.php
  2. 12
      main/inc/lib/display.lib.php
  3. 4
      main/lp/scorm_api.php

@ -426,19 +426,12 @@ if ($execute_iframe) {
echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]); echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]);
$translate = api_get_configuration_value('translate_html');
$display = '';
if ($translate) {
$display = ' display:none;';
}
echo '<div class="embed-responsive embed-responsive-16by9">'; echo '<div class="embed-responsive embed-responsive-16by9">';
echo '<iframe echo '<iframe
id="mainFrame" id="mainFrame"
name="mainFrame" name="mainFrame"
border="0" border="0"
class="embed-responsive-item" class="embed-responsive-item"
style="'.$display.'"
src="'.$file_url_web.'&rand='.mt_rand(1, 10000).'" src="'.$file_url_web.'&rand='.mt_rand(1, 10000).'"
height="500" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>'; height="500" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>';
echo '</div>'; echo '</div>';

@ -2946,6 +2946,12 @@ HTML;
$videoFeatures = implode("','", $videoFeatures); $videoFeatures = implode("','", $videoFeatures);
$frameReady = ' $frameReady = '
var $iframe = $("'.$frameName.'");
var $iframeSpinner = $("<span aria-hidden=\"true\" class=\"fa fa-spinner fa-spin fa-3x\"></span>");
$iframe.hide().parent().append($iframeSpinner);
$.frameReady(function() { $.frameReady(function() {
$(function () { $(function () {
$("video:not(.skip), audio:not(.skip)").mediaelementplayer({ $("video:not(.skip), audio:not(.skip)").mediaelementplayer({
@ -2957,9 +2963,9 @@ HTML;
vrPath: "'.$webPublicPath.'assets/vrview/build/vrview.js" vrPath: "'.$webPublicPath.'assets/vrview/build/vrview.js"
}); });
window.setTimeout(function () { var iframe = window.top.document.querySelector("'.$frameName.'");
window.top.document.getElementById("mainFrame").style.display = ""; iframe.parentNode.querySelector(".fa").remove()
}, 1500); iframe.style.display = "block";
}); });
}, },
"'.$frameName.'", "'.$frameName.'",

@ -1679,6 +1679,10 @@ function switch_item(current_item, next_item)
} else { } else {
?> ?>
log_in_log('loading '+mysrc+' in frame'); log_in_log('loading '+mysrc+' in frame');
var $iframeSpinner = $('<span aria-hidden="true" class="fa fa-spinner fa-spin fa-3x"></span>');
cont_f.hide().parent().append($iframeSpinner);
cont_f.attr("src",mysrc); cont_f.attr("src",mysrc);
<?php <?php
} ?> } ?>

Loading…
Cancel
Save