Onepager: when no wiki link.
[wolnelektury.git] / src / wolnelektury / static / js / book_text / references.js
index ee7e2bd..cd782c8 100644 (file)
             $this.addClass('interesting');
             ref = interestingReferences[uri];
 
-            $this.attr('href', ref.wikipedia_link);
-            $this.attr('target', '_blank');
+            if (ref.wikipedia_link) {
+                $this.attr('href', ref.wikipedia_link);
+                $this.attr('target', '_blank');
+            } else {
+                $this.removeAttr('href')
+            }
         }
     });
 
         }
 
         $("#reference-link").text(ref.label);
-        $("#reference-link").attr('href', ref.wikipedia_link);
+        if (ref.wikipedia_link) {
+            $("#reference-link").attr('href', ref.wikipedia_link);
+        } else {
+            $('#reference-link').removeAttr('href');
+        }
 
+        $("#reference-print").attr('href', '/mapa/ulotka/' + ref.id);
+        
         _paq.push(['trackEvent', 'html', 'reference']);
     });
 
     $('a.anchor').on('click', function(e) {
         // Workaround for bad TOC markers.
         if ($(this).closest('#toc').length) return;
+        if ($(this).closest('.toc').length) return;
         if ($(this).closest('#wltoc').length) return;
         e.preventDefault();