Hi,

I've got a quick question about folding.js (actually targeted at 
Christopher who introduced that code). I can't really tell what the <a> 
wrapping and the fragId business is all about:

http://trac.edgewall.org/browser/trunk/trac/htdocs/js/folding.js

It seems everything works fine if we would use a <span> instead, e.g.


$.fn.enableFolding = function(autofold) {
  return this.each(function() {
    var t = $(this).text();
    $(this).text("");
    var trigger = $(this).append("<span></span>").children();
    trigger.text(t);

    trigger.click(function() {
      $(this.parentNode.parentNode).toggleClass("collapsed");
    });
    if ( autofold )
      trigger.click();
  }).css("cursor", "pointer");
}


Anything I missed?

-- Christian




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Index: trac/htdocs/js/folding.js
===================================================================
--- trac/htdocs/js/folding.js	(revision 6379)
+++ trac/htdocs/js/folding.js	(working copy)
@@ -1,22 +1,14 @@
 $.fn.enableFolding = function(autofold) {
-  var fragId = document.location.hash;
-  if (fragId && /^#no\d+$/.test(fragId)) {
-    fragId = parseInt(fragId.substr(3));
-  }
-
-  var count = 1;
   return this.each(function() {
     var t = $(this).text();
     $(this).text("");
-    var trigger = $(this).append("<a href='#no" + count + "'></a>").children();
+    var trigger = $(this).append("<span></span>").children();
     trigger.text(t);
 
-     trigger.click(function() {
-       if (fragId == count) { fragId = 0; return; }
-       $(this.parentNode.parentNode).toggleClass("collapsed");
-     });
-     if ( autofold )
-       trigger.click();
-    count++;
+    trigger.click(function() {
+      $(this.parentNode.parentNode).toggleClass("collapsed");
+    });
+    if ( autofold )
+      trigger.click();
   }).css("cursor", "pointer");
 }
Index: trac/htdocs/css/admin.css
===================================================================
--- trac/htdocs/css/admin.css	(revision 6379)
+++ trac/htdocs/css/admin.css	(working copy)
@@ -43,10 +43,10 @@
 .plugin h3 a { 
  padding: 2px .5em; text-align: left; width: 60%;
 }
-.plugin h3 a { background: url(../expanded.png) 0 50% no-repeat;
+.plugin h3 span { background: url(../expanded.png) 0 50% no-repeat;
  padding-left: 16px;
 }
-.collapsed h3 a { background-image: url(../collapsed.png); }
+.collapsed h3 span { background-image: url(../collapsed.png); }
 .plugin .buttons { margin-top: 0; text-align: right }
 .plugin .uninstall { margin-top: -2.6em; padding: 0 }
 .plugin .summary, .plugin .info { color: #999; font-size: 80%;
Index: trac/htdocs/css/report.css
===================================================================
--- trac/htdocs/css/report.css	(revision 6379)
+++ trac/htdocs/css/report.css	(working copy)
@@ -76,18 +76,15 @@
 .tickets .fullrow .meta { color: #999; }
 .tickets .fullrow hr { display: none }
 
-fieldset legend :link, fieldset legend :visited { 
+fieldset legend span { 
  background: url(../expanded.png) 0 50% no-repeat;
  border: none;
  color: #666;
  font-size: 110%;
  padding-left: 16px;
 }
-fieldset legend :link:hover, fieldset legend :visited:hover {
-  background-color: transparent;
-}
 
-fieldset.collapsed legend :link, fieldset.collapsed legend :visited { 
+fieldset.collapsed legend span { 
  background-image: url(../collapsed.png);  
 }
 fieldset.collapsed table, fieldset.collapsed div { display: none }
@@ -114,4 +111,4 @@
   vertical-align: middle;
   text-align: center;
   font-size: 85%;
-}
\ No newline at end of file
+}

Reply via email to