tab_module.js 950 Bytes
Newer Older
1 2 3
// IMPORTANT TODO: Namespace

var ${ id }contents=["",
4 5 6 7 8
 %for t in items:
 ${t[1]['content']} , 
 %endfor
 ""
       ];
pmitros committed
9

10
var ${ id }init_functions=["",
11 12 13 14
 %for t in items:
	       function(){ ${t[1]['init_js']} }, 
 %endfor
	       ""];
pmitros committed
15

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
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]);
}

pmitros committed
35
$("#tabs").tabs({select:function(event, ui){
36
	    //global=ui;
37 38 39
	    return true;
	},
        show:function(event,ui){
40 41
	    //global=ui;
	    ${ id }goto(ui.index+1);
42 43 44
	    return true;
        },
        });