Commit 216db510 by Piotr Mitros

Tabs _appear_ to work, but no internet

parent 1f6d5830
...@@ -22,10 +22,8 @@ var ${ id }destroy_functions=["", ...@@ -22,10 +22,8 @@ var ${ id }destroy_functions=["",
var ${ id }loc = -1; var ${ id }loc = -1;
function ${ id }goto(i) { function ${ id }goto(i) {
// TODO:
// ${ id }contents[${ id }loc] = $('#content').html();
if (${ id }loc!=-1) if (${ id }loc!=-1)
${ id }init_functions[ ${ id }loc ](); ${ id }destroy_functions[ ${ id }loc ]();
$('#content').html(${ id }contents[i]); $('#content').html(${ id }contents[i]);
${ id }init_functions[i]() ${ id }init_functions[i]()
$('#tt_'+${ id }loc).attr("style", "background-color:grey"); $('#tt_'+${ id }loc).attr("style", "background-color:grey");
...@@ -52,7 +50,7 @@ function ${ id }prev() { ...@@ -52,7 +50,7 @@ function ${ id }prev() {
$(function() { $(function() {
var i; var i;
for(i=1; i<11; i++) { for(i=1; i<${ len(items)+1 }; i++) {
${ id }setup_click(i); ${ id }setup_click(i);
} }
$('#${ id }next').click(function(eo) { ${ id }next();}); $('#${ id }next').click(function(eo) { ${ id }next();});
......
<script>
</script>
<div id="tabs"> <div id="tabs">
<ul> <ul>
% for t in items: % for t in items:
...@@ -10,7 +7,6 @@ ...@@ -10,7 +7,6 @@
% for t in items: % for t in items:
<div id="tabs-${items.index(t)}"> <div id="tabs-${items.index(t)}">
${t[1]['content']}
</div> </div>
% endfor % endfor
......
var ${ id }files=["", // IMPORTANT TODO: Namespace
var ${ id }contents=["",
%for t in items: %for t in items:
${t[1]['content']} , ${t[1]['content']} ,
%endfor %endfor
"" ""
]; ];
var ${ id }functions=["", var ${ id }init_functions=["",
%for t in items: %for t in items:
function(){ ${t[1]['init_js']} }, function(){ ${t[1]['init_js']} },
%endfor %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){ $("#tabs").tabs({select:function(event, ui){
global=ui; //global=ui;
return true; return true;
}, },
show:function(event,ui){ show:function(event,ui){
global=ui; //global=ui;
alert('hello'); ${ id }goto(ui.index+1);
return true; return true;
}, },
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment