summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/js/htdocs/util.js
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-27 21:58:51 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-27 21:58:51 +0000
commit093d169f38327c96964f9a42bc8fcd8f9eb32179 (patch)
tree0b3f612558ab97c02428314e97d159d764c1c1f7 /sca-cpp/trunk/modules/js/htdocs/util.js
parent50fd6e0d7427c7d3332d7550b73245075e3879f1 (diff)
HTML cleanup, improve layout on different browsers, iOS and android devices and add robots.txt and some icons. Support execution and preview of components from the edit pages.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1086046 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/js/htdocs/util.js')
-rw-r--r--sca-cpp/trunk/modules/js/htdocs/util.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/util.js b/sca-cpp/trunk/modules/js/htdocs/util.js
index 5697ad27d4..3719a9cecc 100644
--- a/sca-cpp/trunk/modules/js/htdocs/util.js
+++ b/sca-cpp/trunk/modules/js/htdocs/util.js
@@ -286,6 +286,43 @@ function properties(o) {
}
/**
+ * Convert a host name to a domain name.
+ */
+function domainname(host) {
+ var h = reverse(host.split('.'));
+ return reverse(mklist(car(h), cadr(h))).join('.');
+}
+
+/**
+ * Return true if a host name is a subdomain.
+ */
+function issubdomain(host) {
+ return host.split('.').length > 2;
+}
+
+/**
+ * Convert a host name to a domain name title.
+ */
+function domaintitle(host) {
+ var h = reverse(host.split('.'));
+ var d = isNil(cdr(h))? car(h) : cadr(h);
+ return d.substr(0, 1).toUpperCase() + d.substr(1);
+}
+
+/**
+ * Format a string like Python format.
+ */
+function format() {
+ var i = 0;
+ var s = '';
+ for (a in arguments) {
+ s = i == 0? arguments[a] : s.replace('{' + a + '}', arguments[a]);
+ i++;
+ }
+ return s;
+}
+
+/**
* Functions with side effects. Use with moderation.
*/