Commits

Michel Albert  committed d0be1d7

Only folding certain elements.

  • Participants
  • Parent commits e571b81

Comments (0)

Files changed (1)

File js/sphinx-folding.js

 goog.require('goog.debug.Console');
 goog.require('goog.debug.Logger');
 goog.require('goog.dom');
+goog.require('goog.dom.classes');
 goog.require('goog.ui.AnimatedZippy');
 
 
   }
   goog.debug.Console.autoInstall();
 
+  var hasClass = goog.dom.classes.has;
   var defterms = goog.dom.getElementsByTagNameAndClass('dt');
   goog.array.forEach(defterms, function(defterm){
-    var container = goog.dom.getNextElementSibling(defterm);
-    if (goog.isDefAndNotNull(container)) {
-      var zippy = new goog.ui.AnimatedZippy(defterm, container, false);
-      zippy.animationDuration = 100;
+    var defList = defterm.parentNode;
+    if (hasClass(defList, 'class') ||
+        hasClass(defList, 'method') ||
+        hasClass(defList, 'exception') ||
+        hasClass(defList, 'function')) {
+      var container = goog.dom.getNextElementSibling(defterm);
+      if (goog.isDefAndNotNull(container)) {
+        var zippy = new goog.ui.AnimatedZippy(defterm, container, false);
+        zippy.animationDuration = 100;
+      }
     }
   });
 };