Commits

Wolfgang Scherer committed de0b00c

index.php: show/hide export mode (jQuery).

  • Participants
  • Parent commits f2b665e
  • Tags v0.8

Comments (0)

Files changed (3)

     text-align: center;
     font-size: 8pt;
 }
+h4._more, h4._less {
+    cursor: pointer;
+}
+h4._more:after {
+    content: "...";
+    font-weight: bold;
+    padding-left: 4px;
+}
+h4._less:before {
+    content: "^";
+    font-weight: bold;
+    padding-right: 4px;
+}
 ';
 
+$headers = '<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>';
+
 $script ='
+jQuery(document).ready(function(){
+    $("#expert-mode").click(function(ev) {
+        ev.preventDefault();
+        var jthis = $(this);
+        var contents = jthis.next();
+        if (contents.is(":visible")) {
+            jthis.addClass("_more");
+            jthis.removeClass("_less");
+            contents.hide();
+        } else {
+            jthis.removeClass("_more");
+            jthis.addClass("_less");
+            contents.show();
+        }
+        return false;
+    }).click();
+});
 ';
 
 echo substitute_elements(
     $HEAD, Array(
         'title' => trim($title),
         'css' => trim($css),
+        'headers' => trim($headers),
         'script' => trim($script),
         ));
 hl($title);
 {
     if ( $x_wsv_raw ) {
         $text_rows = 15;
+        $id = null;
     } else {
         $text_rows = 5;
+        $id = 'expert-mode';
     }
-    $form[] = sshl(get_text('expert_mode'));
+    $form[] = sshl(get_text('expert_mode'), $id);
+#    $form[] = sshl('<a href="#">'.get_text('expert_mode').'</a>', 'expert-mode-head');
+    $form[] = '<div>';
     // raw message
     $form[] = sprintf('<span class="label">%s<sup>*</sup>:</span>', get_text('message'));
     $form[] = (
     $form[] = sprintf('<input type="submit" name="raw" value="%s" />', get_text('save'));
     //$form[] = ' ' . get_text('disable_encoding');
     $form[] = '<hr class="sep"/>';
+    $form[] = '</div>';
 
 }
 

File lib/template.php

 }
 @css@
       --></style>
+@headers@
     <script type="text/javascript"><!--
 @script@
       //--></script>

File lib/util.php

     return sprintf('<h3>%s</h3>', $message);
 }
 
-function sshl($message)
+function sshl($message, $id=null)
 {
-    return sprintf('<h4>%s</h4>', $message);
+    if ( isset($id) ) {
+        $id_fmt = sprintf(' id="%s"', $id);
+    } else {
+        $id_fmt = '';
+    }
+    return sprintf('<h4%s>%s</h4>', $id_fmt, $message);
 }
 
 function hl($message)