Store depth as data
Store depth as data

file:a/js/tree.js -> file:b/js/tree.js
--- a/js/tree.js
+++ b/js/tree.js
@@ -58,12 +58,10 @@
 				row.find('a.expander').text(expanded);
 			}
 		} else {
-			var indent = cell.html().match(/^(—+)/);
-			if (indent)
-				indent = indent[1];
-			else
-				indent = '';
-			indent += '—';
+			var depth = row.data('depth');
+			if (depth == null)
+				depth = 0;
+			depth++;
 
 			var img = jQuery(document.createElement('img'));
 			img.attr('src', url + "images/tree-loader.gif");
@@ -80,6 +78,7 @@
 				subRows.each(function() {
 					$(this).data('parent', treeHash);
 					$(this).data('expanded', true);
+					$(this).data('depth', depth);
 				});
 
 				var classList = row.attr('class').split(/\s+/);
@@ -89,7 +88,10 @@
 					}
 				});
 
-				subRows.find('td.fileName').prepend(indent);
+				var fileCell = subRows.find('td.fileName');
+				for (var i = 0; i < depth; i++) {
+					fileCell.prepend('—');
+				}
 				subRows.each(function() {
 					var treeLink = $(this).find('a.jsTree');
 					if (treeLink && (treeLink.size() > 0)) {

comments