Commit d1cb8c14 by jmclaus Committed by Carson Gee

Addressed comments.

(cherry picked from commit f85b0d0bc23ff4458a783302f3a6900bb08619e9)
parent 25e0627e
...@@ -32,7 +32,7 @@ var JSInput = (function ($, undefined) { ...@@ -32,7 +32,7 @@ var JSInput = (function ($, undefined) {
/* END Utils */ /* END Utils */
var loadingTimeout = 300; var loadingTimeout = getLoadingTimeout();
function jsinputConstructor(elem) { function jsinputConstructor(elem) {
// Define an class that will be instantiated for each jsinput element // Define an class that will be instantiated for each jsinput element
...@@ -207,13 +207,17 @@ var JSInput = (function ($, undefined) { ...@@ -207,13 +207,17 @@ var JSInput = (function ($, undefined) {
} }
function getLoadingTimeout() { function getLoadingTimeout() {
var allSections = $('section.jsinput'), timeout; var allSections = $('section.jsinput'), t,
timeout = 300; // Default value
allSections.each(function(index, value) { allSections.each(function(index, value) {
timeout = $(value).attr("data-loading-timeout"); t = $(value).attr("data-loading-timeout");
if (timeout && isFinite(timeout)) { if (t && isFinite(t)) {
loadingTimeout = Math.max(loadingTimeout, timeout); timeout = Math.max(t, timeout);
} }
}); });
return timeout;
} }
// This is ugly, but without a timeout pages with multiple/heavy jsinputs // This is ugly, but without a timeout pages with multiple/heavy jsinputs
...@@ -221,7 +225,6 @@ var JSInput = (function ($, undefined) { ...@@ -221,7 +225,6 @@ var JSInput = (function ($, undefined) {
// 300 ms is arbitrary but this has functioned with the only application // 300 ms is arbitrary but this has functioned with the only application
// that has ever used JSInput, jsVGL. Something more sturdy should be put in // that has ever used JSInput, jsVGL. Something more sturdy should be put in
// place. // place.
getLoadingTimeout();
if ($.isReady) { if ($.isReady) {
setTimeout(walkDOM, loadingTimeout); setTimeout(walkDOM, loadingTimeout);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment