diff --git a/seq_module.js b/seq_module.js
index 7483e89534..f4f136de16 100644
--- a/seq_module.js
+++ b/seq_module.js
@@ -22,10 +22,8 @@ var ${ id }destroy_functions=["",
var ${ id }loc = -1;
function ${ id }goto(i) {
- // TODO:
- // ${ id }contents[${ id }loc] = $('#content').html();
if (${ id }loc!=-1)
- ${ id }init_functions[ ${ id }loc ]();
+ ${ id }destroy_functions[ ${ id }loc ]();
$('#content').html(${ id }contents[i]);
${ id }init_functions[i]()
$('#tt_'+${ id }loc).attr("style", "background-color:grey");
@@ -52,7 +50,7 @@ function ${ id }prev() {
$(function() {
var i;
- for(i=1; i<11; i++) {
+ for(i=1; i<${ len(items)+1 }; i++) {
${ id }setup_click(i);
}
$('#${ id }next').click(function(eo) { ${ id }next();});
diff --git a/tab_module.html b/tab_module.html
index d5e28b6a57..b2f2e3280e 100644
--- a/tab_module.html
+++ b/tab_module.html
@@ -1,6 +1,3 @@
-
-
% for t in items:
@@ -10,7 +7,6 @@
% for t in items:
- ${t[1]['content']}
% endfor
diff --git a/tab_module.js b/tab_module.js
index b0c0d36a4d..e8e5adc7e7 100644
--- a/tab_module.js
+++ b/tab_module.js
@@ -1,23 +1,44 @@
-var ${ id }files=["",
+// IMPORTANT TODO: Namespace
+
+var ${ id }contents=["",
%for t in items:
${t[1]['content']} ,
%endfor
""
];
-var ${ id }functions=["",
+var ${ id }init_functions=["",
%for t in items:
function(){ ${t[1]['init_js']} },
%endfor
""];
+var ${ id }destroy_functions=["",
+ %for t in items:
+ function(){ ${t[1]['destroy_js']} },
+ %endfor
+ ""];
+
+var ${ id }loc = -1;
+
+function ${ id }goto(i) {
+ if (${ id }loc!=-1)
+ ${ id }destroy_functions[ ${ id }loc ]();
+ $('#tabs-'+(i-1)).html(${ id }contents[i]);
+ ${ id }init_functions[i]()
+ $('#tt_'+${ id }loc).attr("style", "background-color:grey");
+ ${ id }loc=i;
+ $('#tt_'+i).attr("style", "background-color:red");
+ MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
+}
+
$("#tabs").tabs({select:function(event, ui){
- global=ui;
+ //global=ui;
return true;
},
show:function(event,ui){
- global=ui;
- alert('hello');
+ //global=ui;
+ ${ id }goto(ui.index+1);
return true;
},
});