summaryrefslogtreecommitdiff
path: root/data/js/tabs.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/js/tabs.js')
-rw-r--r--data/js/tabs.js52
1 files changed, 25 insertions, 27 deletions
diff --git a/data/js/tabs.js b/data/js/tabs.js
index 861cb9ff..470bd077 100644
--- a/data/js/tabs.js
+++ b/data/js/tabs.js
@@ -16,36 +16,34 @@
*
* Only one jt_select list-of-tabs can be used on a single page.
*/
-(function(){
- var links = byId('jt_select') ? byName(byId('jt_select'), 'a') : [];
+var links = byId('jt_select') ? byName(byId('jt_select'), 'a') : [];
- function init() {
- var sel;
- var first;
- for(var i=0; i<links.length; i++) {
- links[i].onclick = function() { set(this.id); return false };
- if(!first)
- first = links[i].id;
- if(location.hash && links[i].id == 'jt_sel_'+location.hash.substr(1))
- sel = links[i].id;
- }
- if(first)
- set(sel||first, 1);
+function init() {
+ var sel;
+ var first;
+ for(var i=0; i<links.length; i++) {
+ links[i].onclick = function() { set(this.id); return false };
+ if(!first)
+ first = links[i].id;
+ if(location.hash && links[i].id == 'jt_sel_'+location.hash.substr(1))
+ sel = links[i].id;
}
+ if(first)
+ set(sel||first, 1);
+}
- function set(which, nolink) {
- which = which.substr(7);
+function set(which, nolink) {
+ which = which.substr(7);
- for(var i=0; i<links.length; i++) {
- var name = links[i].id.substr(7);
- if(name != 'all')
- setClass(byId('jt_box_'+name), 'hidden', which != 'all' && which != name);
- setClass(links[i].parentNode, 'tabselected', name == which);
- }
-
- if(!nolink)
- location.href = '#'+which;
+ for(var i=0; i<links.length; i++) {
+ var name = links[i].id.substr(7);
+ if(name != 'all')
+ setClass(byId('jt_box_'+name), 'hidden', which != 'all' && which != name);
+ setClass(links[i].parentNode, 'tabselected', name == which);
}
- init();
-})()
+ if(!nolink)
+ location.href = '#'+which;
+}
+
+init();