Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /sstree/www/ > Reply to message

sstree
Reply to message

* = Required fields
* Subject
* Body
Attachments
Send reply to
Topic
Author (directly in email)
Please type the letters in the image above.

Original message

Author anoncvs
Full name anonymous CVS access
Date 2003-04-16 21:12:26 PDT
Message User: jrobbins
Date: 03/04/16 21:12:26

Modified
 /sstree/www/
  example4.html

Log
 removed use of regexes

File Changes:

Directory: /sstree/www/
=======================

File [changed]: example4.html
Url: http://sstree.tigris​.org/source/browse/s​stree/www/example4.h​tml.diff?r1=1.6&​r2=1.7
Delta lines: +13 -7
--------------------
--- example4.html 16 Apr 2003 01:38:11 -0000 1.6
+++ example4.html 17 Apr 2003 04:12:26 -0000 1.7
@@ -18,12 +18,11 @@
  var rows = document.getElements​ByTagName("TR");
  elm.style.background = "url(/branding/image​s/sstree/folder-clos​ed.gif)";
  var newDisplay = "none";
- var thisID = elm.parentNode.paren​tNode.parentNode.id;​
- var effectivePat = "^" + thisID + "-";
+ var thisID = elm.parentNode.paren​tNode.parentNode.id + "-";
+ var matchDirectChildrenOnly = false;
  for (var i = 0; i < rows.length; i++) {
    var r = rows[i];
- var matches = r.id.match(effectivePat);
- if (matches != null) {
+ if (matchStart(r.id, thisID, matchDirectChildrenOnly)) {
     if (r.style.display == "none") {
      newDisplay = "table-row";
      elm.style.background = "url(/branding/image​s/sstree/folder-open​.gif)";
@@ -32,16 +31,23 @@
    }
  }
  if (newDisplay == "table-row") {
- effectivePat = "^" + thisID + "-\\d+$";
+ matchDirectChildrenOnly = true;
  }
  for (var j = 0; j < rows.length; j++) {
    var s = rows[j];
- var matches2 = s.id.match(effectivePat);
- if (matches2 != null) {
+ if (matchStart(s.id, thisID, matchDirectChildrenOnly)) {
      s.style.display = newDisplay;
      s.style.background = "url(/branding/image​s/sstree/folder-clos​ed.gif)";
    }
  }
+}
+
+function matchStart(target, pattern, matchDirectChildrenOnly) {
+ var pos = target.indexOf(pattern);
+ if (pos != 0) return false;
+ if (!matchDirectChildrenOnly) return true;
+ if (target.slice(pos + pattern.length, target.length).indexOf("-") >= 0) return false;
+ return true;
 }
 
 function collapseAllRows() {




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@sstr​ee.tigris.org
For additional commands, e-mail: cvs-help at sstree dot tigris dot org