fixed window resize + cosmetic fixes
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Sat, 14 Feb 2009 22:17:25 +0000 (22:17 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Sat, 14 Feb 2009 22:17:25 +0000 (22:17 +0000)
planetlab/includes/plc_minitabs.php
planetlab/minitabs/minitabs.js

index 5bce03b..e681477 100644 (file)
@@ -22,9 +22,13 @@ drupal_set_html_head('
 //     (*) 'bubble': a longer message displayed when the mouse stays quite for a while on the label
 //     (*) 'image' : the url of an image used instead of the label
 //     (*) 'height' : used for the image
+//     (*) 'id' : assign given id to the <li> element
+
+// NOTE
+// values can also be set in the URL, e.g. ?var=value&foo=bar, even for POST'ing
 
 // examples
-// function my_tab () { return array('label'=>'The Text','url'=>'http://google.com'); }
+// function my_tab () { return array('label'=>'Go to google','url'=>'http://google.com'); }
 // $tabs=array();
 // $tabs[] = my_tab();
 // $tabs['Simple Tab']="http://planet-lab.org";
@@ -42,14 +46,14 @@ function plc_tabs ($array) {
   print '<ul id="minitabs-list">';
   print "\n";
   foreach ($array as $label=>$todo) {
-    // the 'label' key, if set in the hash, supersedes $key
+    // in case we have a simple string, rewrite it as an array
+    if (is_string ($todo)) $todo=array('method'=>'GET','url'=>$todo);
+    // the 'label' key, if set in the hash, supersedes key
     if ($todo['label']) $label=$todo['label'];
     $tracer="class=minitabs";
     if ($todo['id']) 
       $tracer .= " id=".$todo['id'];
     printf ("<li %s>\n",$tracer);
-    // in case we have a string, rewrite it as an array
-    if (is_string ($todo)) $todo=array('method'=>'GET','url'=>$todo);
     // set default method
     if ( ! $todo['method'] ) $todo['method']='GET';
     // extract var=value settings from url if any
index dcbe6ce..0d29d53 100644 (file)
@@ -76,6 +76,10 @@ var miniTab = {
       miniTab.setActive (miniTab.activeTab,false);
     };
  
+    window.onresize = function (e) {
+      miniTab.initSlide (miniTab.activeTab,true);
+    }
+
     for(var i = 0, input; input = miniTab.inputArr[i]; i++) {
       if(input.className.search("active") != -1) {
        miniTab.activeTab = miniTab.currentTab = i;