changeset 40:d52657711e61

fix bug in references javascript.
author casties
date Mon, 29 Jun 2015 17:04:59 +0000
parents ec638eda0d68
children 464224060150
files src/main/webapp/imageServer/resources/js/diva4ismi.js
diffstat 1 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/webapp/imageServer/resources/js/diva4ismi.js	Mon Jun 29 16:22:06 2015 +0000
+++ b/src/main/webapp/imageServer/resources/js/diva4ismi.js	Mon Jun 29 17:04:59 2015 +0000
@@ -248,17 +248,17 @@
     setEntry('#witness-notes',notes);
     //setEntry('#witness-refs',"TODO");
 
-    $('#witness-refs').html(referencesContent);
-    for(refKey in json.data.references){
-		var ref = json.data.references[refKey];
-	var loc="#bibl-entry-"+titleId+"-"+ createIdFromRef(refKey) ;
-	    var bibInf=json.data.references[refKey];
-	showBibliographyEntryFormatted(refKey,bibInf,loc);	    
-	}
-    if ((json.data.references == null)||(json.data.references.keys().length == 0)) {
+    if ((json.data.references == null)||(Object.keys(json.data.references).length == 0)) {
         $('#witness-refs').parent().hide();
-    };
-
+    } else {
+        $('#witness-refs').html(referencesContent);
+        for (refKey in json.data.references) {
+            var ref = json.data.references[refKey];
+            var loc = "#bibl-entry-" + titleId + "-" + createIdFromRef(refKey);
+            var bibInf = json.data.references[refKey];
+            showBibliographyEntryFormatted(refKey, bibInf, loc);
+        }
+    }
 	
 }
 
@@ -396,16 +396,17 @@
 	//$('#title-notes').text(notes);
         setEntry('#title-notes',notes);
 
-	$('#title-bib').html(referencesContent);
-       	for(var refKey in json.data.references){
-		var ref = json.data.references[refKey];
-	    var loc="#bibl-entry-"+titleId+"-"+ createIdFromRef(refKey) ;
-	    var bibInf=json.data.references[refKey];
-	    showBibliographyEntryFormatted(refKey,bibInf,loc);	    
-	}
-    if ((json.data.references == null)||(json.data.references.keys().length == 0)) {
-        $('#title-bib').parent().hide();
-    };
+        if ((json.data.references == null)||(Object.keys(json.data.references).length == 0)) {
+            $('#title-bib').parent().hide();
+        } else {
+            $('#title-bib').html(referencesContent);
+           	for (var refKey in json.data.references) {
+           	    var ref = json.data.references[refKey];
+           	    var loc="#bibl-entry-"+titleId+"-"+ createIdFromRef(refKey) ;
+           	    var bibInf=json.data.references[refKey];
+           	    showBibliographyEntryFormatted(refKey,bibInf,loc);	    
+           	}
+        }