Commits

Luke Plant committed 03d1dd3

Only fetch the verse list when it makes sense

  • Participants
  • Parent commits 93c353d

Comments (0)

Files changed (1)

lukeplant_me_uk/bibleverses/web/js/bibleverses.js

     }
 }
 
+function pageNeedsVerseList() {
+    return (getElementsByTagAndClassName("span", "verseadmin").length > 0);
+}
+
 function setCheckBoxDisplay(state) {
     // Would be much nicer to do this using a stylesheet rule
     var vadmins = getElementsByTagAndClassName("span", "verseadmin");
 }
 
 function loadVerses() {
-    var d = doGetRequest("verses");
-    d.addCallbacks(verseListArrived, standardErrorHandler);
+    var email = get_email();
+    if (email != null && email != "") {
+	if (pageNeedsVerseList()) {
+	    var d = doGetRequest("verses");
+	    d.addCallbacks(verseListArrived, standardErrorHandler);
+	}
+    }
 }
 
 connect(window, 'onload',