*** empty log message ***
authorMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 11 Jul 2005 01:50:56 +0000 (01:50 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 11 Jul 2005 01:50:56 +0000 (01:50 +0000)
tests/js-test/js/httpd/httpd.js
tests/js-test/js/httpd/string.js [new file with mode: 0644]

index 0f22043..c00641b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: httpd.js,v 1.51 2005/07/10 22:41:17 mmondor Exp $ */
+/* $Id: httpd.js,v 1.52 2005/07/11 01:50:56 mmondor Exp $ */
 
 /*
  * Copyright (c) 2005, Matthew Mondor
@@ -106,6 +106,7 @@ try {
        err.put(x + " while reading options file\n");
        exit();
 }
+eval(file_read('string.js'));          /* startsWith()/endsWith() */
 eval(file_read('ml.js'));              /* MLTag object for HTML generation */
 eval(file_read('root.js'));            /* Root object for virtual chroot(2) */
 
@@ -115,7 +116,7 @@ eval(file_read('root.js'));         /* Root object for virtual chroot(2) */
  * Server identification
  */
 SERVER_VERSION                 = 'mmondor_js_httpd/0.0.1 (NetBSD)';
-SERVER_CVSID   = '$Id: httpd.js,v 1.51 2005/07/10 22:41:17 mmondor Exp $';
+SERVER_CVSID   = '$Id: httpd.js,v 1.52 2005/07/11 01:50:56 mmondor Exp $';
 
 
 
diff --git a/tests/js-test/js/httpd/string.js b/tests/js-test/js/httpd/string.js
new file mode 100644 (file)
index 0000000..5ed8080
--- /dev/null
@@ -0,0 +1,34 @@
+/* $Id: string.js,v 1.1 2005/07/11 01:50:56 mmondor Exp $ */
+
+/*
+ * Copyright (c) 2005, Matthew Mondor
+ * ALL RIGHTS RESERVED.
+ */
+
+/*
+ * Extension to the standard String object to support startsWith() and
+ * endsWith() very useful methods.
+ */
+
+
+
+String.prototype.startsWith = function(str)
+{
+       var t = str.length;
+
+       if (this.length >= t && this.substr(0, t) == str)
+               return true;
+
+       return false;
+}
+
+String.prototype.endsWith = function(str)
+{
+       var t1 = str.length;
+       var t2 = this.length;
+
+       if (t2 >= t1 && this.substr(t2 - t1, t1) == str)
+               return true;
+
+       return false;
+}