Browse Source

eur-lex: don't display titles if the corresponding category is empty.

Adrien Nader 8 years ago
parent
commit
72119cefb4
1 changed files with 8 additions and 4 deletions
  1. 8 4
      eur-lex/eur-lex_toc.user.js

+ 8 - 4
eur-lex/eur-lex_toc.user.js

@@ -106,10 +106,14 @@ fold_button.onclick = (function() {
 })();
 
 toc_ltr.appendChild(fold_button);
-toc_ltr.appendChild(h1_articles);
-toc_ltr.appendChild(ol_articles);
-toc_ltr.appendChild(h1_annexes);
-toc_ltr.appendChild(ol_annexes);
+if (article_titles.snapshotLength > 0) {
+  toc_ltr.appendChild(h1_articles);
+  toc_ltr.appendChild(ol_articles);
+}
+if (annex_titles.snapshotLength > 0) {
+  toc_ltr.appendChild(h1_annexes);
+  toc_ltr.appendChild(ol_annexes);
+}
 toc.appendChild(toc_ltr);
 document.getElementsByTagName('body')[0].appendChild(toc);
 document.getElementsByTagName('head')[0].appendChild(style);