Parcourir la source

eur-lex: prefer CSS' resize to the toggle button.

We add a resize: both on the TOC and only display the toggle button if the
browser doesn't handle this attribute. This gives the user full control on
the TOC dimensions.
Adrien Nader il y a 8 ans
Parent
commit
a17f6cce19
1 fichiers modifiés avec 8 ajouts et 1 suppressions
  1. 8 1
      eur-lex/eur-lex_toc.user.js

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

@@ -25,6 +25,7 @@ style.innerHTML = '\
   direction: ltr;\
   overflow-x: auto;\
   background-color: antiquewhite;\
+  resize: both;\
 }\
 #the-toc-this-website-lacks li {\
   padding: 0.5em;\
@@ -46,6 +47,10 @@ var ol_articles = document.createElement('ol');
 var h1_annexes = document.createElement('h1');
 var ol_annexes = document.createElement('ol');
 
+toc.style = "resize: both;";
+var has_css_resize = (toc.style !== "");
+toc.style = "";
+
 h1_articles.textContent = 'Articles';
 h1_annexes.textContent = 'Annexes';
 
@@ -100,7 +105,9 @@ visibility_button.onclick = (function() {
   }
 })();
 
-toc.appendChild(visibility_button);
+if (! has_css_resize) {
+  toc.appendChild(visibility_button);
+}
 if (article_titles.snapshotLength > 0) {
   toc_ltr.appendChild(h1_articles);
   toc_ltr.appendChild(ol_articles);