Test Block
Loading document…
[timeoutVar]
) {
clearTimeout(window
[timeoutVar]
);
}
if (window
[countVar]
< maxRetries) {
window
[countVar]
++;
loadingElem.style.display = ‘block’;
loadingElem.innerHTML = ‘
Loading document… (Retry ‘ + window
[countVar]
+ ‘/’ + maxRetries + ‘)
‘ +
‘‘;
// Add random parameter to avoid caching
setTimeout(function() {
iframeElem.src = ‘https://docs.google.com/gview?url=’ + encodeURIComponent(fileUrl) + ‘&embedded=true&rand=’ + new Date().getTime();
// Set a new timeout for this attempt
window [timeoutVar]
= setTimeout(function() {
retryLoadingFile(fileId, fileUrl);
}, 10000);
}, 1500);
} else {
loadingElem.innerHTML = ‘
Unable to load the document with Google Viewer.
‘ +
‘‘;
}
}
// When iframe successfully loads, clear the timeout
document.getElementById(‘sfdm-85e310ac0a7936aa89d08a3d0bb122e4-iframe’).onload = function() {
if (loadTimeout_sfdm_85e310ac0a7936aa89d08a3d0bb122e4) {
clearTimeout(loadTimeout_sfdm_85e310ac0a7936aa89d08a3d0bb122e4);
}
document.getElementById(‘sfdm-85e310ac0a7936aa89d08a3d0bb122e4-loading’).style.display = ‘none’;
};