summaryrefslogtreecommitdiff
path: root/src/client/view/tab.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-12-16 17:37:42 +0200
committerAlon Levy <alon@pobox.com>2014-12-16 17:37:42 +0200
commitade19de410e0a789a921ec1666b278b2a64176d6 (patch)
treec4c54b106de93609ca7bb70a20fd4be696715dbe /src/client/view/tab.js
parentc7d026b1d504323a8c61d51b726e5e8d2337fc4b (diff)
moving files around after repository merger
Diffstat (limited to 'src/client/view/tab.js')
-rw-r--r--src/client/view/tab.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/client/view/tab.js b/src/client/view/tab.js
new file mode 100644
index 00000000..97ba1351
--- /dev/null
+++ b/src/client/view/tab.js
@@ -0,0 +1,57 @@
+"use strict"
+
+define(['jquery'],
+function($) {
+
+function Tab(dict) {
+ var k,
+ selector = {},
+ name = [];
+
+ for (k in dict) {
+ if (dict.hasOwnProperty(k) == false) {
+ continue;
+ }
+ selector[k] = dict[k];
+ name.push(k);
+ }
+ this._selector = selector;
+ this._name = name;
+}
+
+Tab.prototype.show = function(shown_name) {
+ var i,
+ name,
+ element;
+
+ for (i = 0 ; i < this._name.length ; ++i) {
+ name = this._name[i];
+ element = $(this._selector[name]);
+ if (name === shown_name) {
+ element.fadeIn(300);
+ } else {
+ element.hide();
+ }
+ }
+}
+
+Tab.prototype.hide = function() {
+ var i;
+
+ for (i = 0 ; i < this._name.length ; ++i) {
+ $(this._selector[this._name[i]]).fadeOut(300);
+ }
+}
+
+Tab.prototype.get = function(name, sel) {
+ // selector concatenation
+ var e = $(this._selector[name] + ' ' + sel);
+
+ return e;
+}
+
+return {
+ Tab: Tab
+};
+
+});