Alle Beiträge von hansen

Regex schnell&scheiße Testtool

<?
include "phpExtendFunx.php";

if( !$_REQUEST['showForm'] && ( isset($_REQUEST['re']) || isset($_REQUEST['str']) ) ){
  ob_start();
  $rear= explode("\n",$_REQUEST['re']);
  switch($_REQUEST['func']){
    case 'replace':
      $ret= preg_replace( trim(array_shift($rear)), implode("\n",$rear), $_REQUEST['str'] );
      $ret= "<pre>". htmlspecialchars( filter($ret) ) ."</pre>";
      break;
    case 'match':
//      preg_match( $_REQUEST['re'],$_REQUEST['str'], $rex );
      preg_match( trim(array_shift($rear)), $_REQUEST['str'], $rex );
      $ret= "<pre>". htmlspecialchars( filter( preg_replace( '~Array\s*\(~mUsi', 'Array (', print_r($rex,1) ) ) ) ."</pre>";
      break;
    case 'split':
      $ret= filter( preg_split( trim(array_shift($rear)), $_REQUEST['str'] ) );
      $ret= "<pre>". implode( "\n<hr>", array_map('htmlspecialchars',$ret) ) ."</pre>";
      break;
    default:
//      preg_match_all( $_REQUEST['re'],$_REQUEST['str'], $rex, $_REQUEST['order'] );
      preg_match_all( trim(array_shift($rear)), $_REQUEST['str'], $rex, $_REQUEST['order'] );
      $ret= "<pre>". htmlspecialchars( filter( preg_replace( '~Array\s*\(~mUsi', 'Array (', print_r($rex,1) ) ) ) ."</pre>";
  }
  
  $msg= ob_get_contents();
  ob_end_clean();
  
  if( preg_match('~offset\s([0-9]+)\b~mUsi',$msg,$mRex) ){
    echo "<script type=\"text/javascript\">"
        ."window.parent.hilite(".($mRex[1]+1).")"
        ."</script>\n";
  }
  echo "<html><body>";
  echo $msg;
  
  if($err= pcre_errmsg()){
    echo "<p style='color:#FF0000;'>$err</p>";
  }
  else{
    if($_REQUEST['scroll']){
//      $ret= preg_replace('~(\A(.*\n){'.$_REQUEST['scroll'].'})~','$1<a name=hier>',$ret);
      $ret.= "<script>document.body.scrollTop= window.parent.document.checker['scroll'].value</script>"; 
    }
    echo $ret;
  }
  echo "</body></html>";
  die();
}
if($_SERVER['QUERY_STRING'] && !$_REQUEST['re'] && !$_REQUEST['str'] ){
  $qs= urldecode($_SERVER['QUERY_STRING']);
//  echo htmlspecialchars($qs);
  preg_match( '~^(?:\s*\w*?(filter|grep|match_all|match|replace_callback|replace|split)?\s*\(\s*)?(\'|"|/)((?:\\\\\2|.)*?(?:\2\s*\..*\.\s*\2(?:\\\\\2|.)+?)*)\2(\w*)(?:\s*,\s*(\'|")((?:\\\\\5|.)+?)\5)?(?:\s*,\s*(\'|")((?:\\\\\7|.)+?)\7)?~m', $qs, $qsrex);
/*                         1: func name                                              /1           2: preg quote char      qot.(var,func,etc).qot esc.qot     endqot , param2? 5:qot 6: param w/o qot    , param3? 7:qot 8: param w/o qot
                                                                                       func is optional   3: regex                                             4: modifiers         
  matches:                                                                                                    escaped quote or else, ungreedy                           
    1: func pt. 2                        
    2: quotechar regex                   
    3: regex                             
    4: mod regex                         
    5: quotechar param2                  
    6: param2 (replace/subject)          
    7: quotechar param3                  
    8: param3 (subject, nur bei replace) 
*/
  if($qsrex[3]){
    if($qsrex[1]){
      $_REQUEST['func']= $qsrex[1];
    }
    if( $qsrex[8] || in_array($qsrex[1], array('filter','replace','replace_callback') ) ){
      $_REQUEST['re']= str_replace('\\'.$qsrex[2], $qsrex[2], $qsrex[3]) ."\n". ($qsrex[6] ? str_replace('\\'.$qsrex[5],$qsrex[5],$qsrex[6]) : "#");
      $_REQUEST['str']= str_replace('\\'.$qsrex[7], $qsrex[7], $qsrex[8]);
    }
    else{
      $_REQUEST['re']=  str_replace('\\'.$qsrex[2], $qsrex[2], $qsrex[3]);
      $_REQUEST['str']= str_replace('\\'.$qsrex[5],$qsrex[5],$qsrex[6]);
    }
  }
  else{
    $_REQUEST['re']= preg_match('~^(.).*\1[musiexADSUXJ]*$~',$qs) ? $qs : '~'.$qs.'~';
  }
  if(!$_REQUEST['str']){
    $_REQUEST['str']= $qs ."\n\n". print_r($qsrex,1);
  }
/*  echo "<pre>"
    .print_r($qsrex,1)
    .print_r($_REQUEST,1)
    ."</pre>";
*/
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>PCRE Tester</title>
  
<script type="text/javascript">

  String.prototype.repeat= function(times){
    var ret='';
    for(var i=0; i<times; i++){
      ret+=this;
    }
    return ret;
  }
  
  String.prototype.trim = function(){
    return this.replace(/(^\s*|\s*$)/mg,'');
  }
  String.prototype.reverse= function(){
    var ret='';
    for( var i=(this.length-1); i>=0; i-- ){
      ret+= this.substr(i,1);
    }
    return ret;
  }
  
  
  function trace(msg,mode,target){
    return false;
    if(!target){
      var target=document.getElementById('trace');
    }
    if(!target) return false;
    
    if(mode=='overwrite'){
      target.innerHTML = msg;
    }
    else if(mode=='nobr'){
      target.innerHTML+= msg;
    }
    else if(mode=='asc'){
      target.innerHTML+= msg + '\n';
    }
    else{
      target.innerHTML= msg + '\n' + target.innerHTML;
    }
  }

  


  function checkRe(force){
    var changed;
    var reStr= document.getElementById('re').value;

    var str= document.getElementById('str').value;
    
    if(reStr != document.getElementById('re').bak){
      document.getElementById('re').bak= reStr;
      document.getElementById('re').changed= true;
      changed++;
    }
    if(str != document.getElementById('str').bak){
      document.getElementById('str').bak= str;
      changed++;
    }
    if(!force && !changed){
      return false;    
    }
    
    
    if( document.getElementById('usePhp').checked ){
      document.checker['scroll'].value= frames[0].document.body.scrollTop;
      document.checker.submit();
      return true;
    }

// use javascript

    if(!reStr.length){
      return false;
    }

    if(document.getElementById('funcR').checked){
      var rr= reStr.split('\n').shift().match(/^([\/~])?(.*)\1(\w*)$/);
      var re= new RegExp( rr[2], rr[3]);
      document.getElementById('rex').innerHTML= str.replace(re, reStr.split('\n').pop() );
      return true;
    }
    var rr= reStr.split('\n').shift().match(/^([\/~])?(.*)\1(\w*)$/);
    var re= new RegExp( rr[2], (rr[3] ? rr[3] : (document.getElementById('funcA').checked ? 'g' : '')) );
    
    document.getElementById('rex').innerHTML= dump( str.match(re), 3,0,'noFunx' );
    return false;
  }

  
  
  function setUsePhp(me){
    if(me.checked){
      document.getElementById('rex').innerHTML= '<iframe name=rex src="" style="width:100%; height:100%></iframe>';
    }
    else{
      document.getElementById('rex').innerHTML='';
    }  
  }
  
  
  function setAuto(){
    if( document.getElementById('autoCheck').checked ){
      document.getElementById('str').onkeyup= checkRe;
      document.getElementById('re').onkeyup= checkRe;
    }
    else{
      document.getElementById('str').onkeyup= null;
      document.getElementById('re').onkeyup= null;
    }
  }
  



  function dump(me,recursive,depth,noFunx){
    if(typeof me == 'false') me=this;
    if(typeof depth != 'number') depth=0;
    if(typeof recursive != 'number') recursive=0; // 0:all, int>0:levels of rec, int<0:none
    var ret='';
    for(var i in me){
      if(typeof me[i]=='function'){ 
        ret+= noFunx ? '' : String(me[i]).split('\n').shift() +'\n';
      }
      else{
        ret+= '  '.repeat(depth) + i + ' = (' + typeof me[i] +') ';
        if(typeof me[i]=='object' && (recursive<0 || depth<recursive)){
          recuret='';
          try{
            recuret= dump(me[i],recursive,depth+1)
          }
          catch(e){}
          ret+='Array {\n' + recuret + '  '.repeat(depth) +'}\n';
        }
        else{
          try{
            ret+= String(me[i]) + '\n';
          }
          catch(e){}
        }
      }
    }
    return ret;   
  }
  

  function hilite(p1,p0,temp,label){
    if(typeof p0!='number'){
      var p0= 0;
      var leftMark= false;
    }
    else{
      var leftMark= true;
    }
    
    var r= document.getElementById('reMark');
    var l= document.getElementById('liMark');
    
    scl= document.getElementById('re').scrollLeft;

    l.style.display= leftMark ? 'block' : 'none';

    r.style.left=  (p0)*charWidth+3 -scl +'px'; 
    r.style.width= (p1-p0+1)*charWidth +'px';
    r.style.display= 'block';

    if(temp){
      r.style.color= '#009900';
    }
    else{
      r.style.color= '#FF0000';
      r.l= leftMark ? p0 : false;
      r.r= p1;
      r.s= true;
    }
    
    document.getElementById('remLabel').innerHTML= label ? label : ''; 
  }
  

  function hlStore(){
/*
    var r= document.getElementById('reMark');
    var l= document.getElementById('liMark');
    r.l= l.style.display=='block' ? (parseInt( r.style.left )-3)/charWidth : false;
    r.r= parseInt( r.style.width )/charWidth;
    r.s= typeof r.set == 'boolean' ? r.set : false;

    trace('hlStore: '+ r.l+'|'+r.r+'|'+r.s);
*/
  }
  
  
  function hlRecall(){
    var r= document.getElementById('reMark');
    if(!r.s){
      r.style.display= 'none';
      return false;
    }
    trace('hlRecall: '+ r.l+'|'+r.r+'|'+r.s);
    hilite(r.r, r.l);
    return true;
  }


  function showPos(me){
    var p= Math.floor( (me.pageX + this.scrollLeft - x0) / charWidth );
//    matchBraces(this.value,p);
    var mb= matchBraces(p);
//    trace(mb);
    document.getElementById('pos').value= p + (mb ? ' - #'+mb.n : '');
  }
  
  
  

  function numSort(a,b){
    return a-b;
  }

  

  function parseBraces(str,force){
    if(typeof str!='string'){
      if(   !force
         && !document.getElementById('re').changed 
         && typeof document.getElementById('re').parsedBraces != 'undefined'
        ){
        return document.getElementById('re').parsedBraces;
      }
      var store= true;    
      var str= document.getElementById('re').value;
    }
    if( str.length==0 ) return false;
    
    trace('parseBraces: '+ str); 
    
    if(typeof p=='undefined') var p= 0;

    var braces= [];
    var braceIndex= [];
    var sortedBraces= [];
    var i= 0;
    var rex
    var msg= '';
//    var re= new RegExp( document.getElementById('re').value ); // \\(([^()]*)\\)
    var re= new RegExp( '\\(([^()]*)\\)' ); 
    
    while(i<100 && ( rex= str.match(re) ) ){
      braces[rex.index]= rex;
      rex.end= rex.index+rex[0].length-1;
      braceIndex.push(rex.index);
      str= str.substr(0,rex.index) +i+ '.'.repeat(rex[1].length) +i+ str.substr(rex.index + rex[0].length);
      i++;
    }

    braceIndex.sort( numSort );
    for(i=0; i<braceIndex.length; i++){
      braces[braceIndex[i]].num= i+1; 
    }
    
/*
    document.getElementById('rex').innerHTML= msg +'\n --- braceIndex: '+ braceIndex.join(',') +'\n ---braces:---\n'+ dump(braces,3,0,'noFunx');
*/
    
    if(store){
      document.getElementById('re').parsedBraces= braces;
      document.getElementById('re').changed= false;
    }
    
    return braces;
  }
  
  
  
  function matchBraces(p,str,force){
    var braces= parseBraces(str,force);
    for(var i in braces){
      if( braces[i].index==p || braces[i].end==p ){
        hilite( braces[i].end, braces[i].index, 'temp', braces[i].num  );
        return {n:braces[i].num, a:braces[i].index, b:braces[i].end };
      }  
    }
    hlRecall();
    return false;
  }
  
  
  function setCharDim(){
    charWidth= kbd.offsetWidth;
    charHeight=kbd.offsetHeight;
  }
  
    
  window.onload= function(){
    setCharDim();
    kbd.onclick= function(){ setCharDim() };
    setAuto();
    checkRe('force');
    document.getElementById('re').onmousemove= showPos;
  }
  
  var charWidth= 8;
  var charHeight= 16;
  var x0= 11;
</script>

</head>

<body>
<form name=checker action="?" target=rex method=post style="display:inline">

<textarea name=str id=str style="width:100%; height:42%" wrap=off><?=$_REQUEST['str'] ?></textarea>

<div id=reWrap style="position:relative; left:0px; width:100%; height:7%;">
  <pre id=reMark style="position:absolute; left:3px; top:0px; width:800px; display:none; line-height:5pt; color:#F00; border-top:1px solid; border-color:-use-moz-text-color; margin:0; padding:0; text-align:right;" 
    onClick="this.s=false; this.style.display='none'"
    onMouseOver="hlStore()" onMouseOut="hlRecall()"
    ><div 
      id=liMark style="position:absolute; left:0px; top:0px; display:none;">▼</div><div 
      id=remLabel style="position:absolute; left:0px; bottom:9pt; font-weight:bold;"></div>▼</pre> 
  <textarea name=re id=re style="width:100%; height:100%;" wrap=off onMouseMove="showPos(this)"><?=$_REQUEST['re'] ?></textarea>
</div>
<input type=text id=pos name=pos style="float:right; width:5em;">
<kbd id=kbd style="float:right; background:#CCC">0</kbd>

<input type=hidden name=scroll value="">
<input type=submit value=check onClick="return checkRe(true)" style="width:200px;"> &nbsp;
<input type=checkbox id=autoCheck checked onClick="setAuto(this)"  > auto &nbsp; 
<input type=checkbox id=usePhp    checked onClick="setUsePhp(this)"> use php &nbsp; |
 &nbsp;
<input type=radio name=func id=funcA value="match_all" <?=$_REQUEST['func']=="match_all" && ($funcSet=1) ? "checked" : "" ?>>match_all &nbsp;
<input type=radio name=func id=funcM value="match"     <?=$_REQUEST['func']=="match"     && ($funcSet=1) ? "checked" : "" ?>>match &nbsp;
<input type=radio name=func id=funcR value="replace"   <?=$_REQUEST['func']=="replace"   && ($funcSet=1) ? "checked" : "" ?>>replace &nbsp;
<?= $_REQUEST['func'] && !$funcSet ? "\n<input type=text size=6 name=func id=func_ value=\"". $_REQUEST['func'] ."\"> &nbsp; " : "" ?>|
 &nbsp;
<input type=radio name=order id=set value="<?=PREG_SET_ORDER ?>" checked>set &nbsp;
<input type=radio name=order id=pat value="<?=PREG_PATTERN_ORDER ?>">ptn 
 &nbsp;
<input type=text id=filter name=filter style="display:inline-block; left:0; right:0; min-width:15em; font-family:monospace;">


</form>

<div id=rex style="height:47%; border:1px solid #333333; background:#EEEEEE; overflow:auto; white-space:pre; margin:0; padding:0;"
  ><iframe name=rex src="?re=~abc~mUsi" style="width:100%; height:100%; border:0px; margin:0; padding:0;"></iframe
></div>

<? /*
<pre id=trace style="height:100%; width:300px; position:absolute; top:0px; right:0px; background:#FFFFFF; border:1px solid red; padding:3px; margin:0px; overflow:auto;">
</pre>
*/ ?>

</body>
</html>

<?

function filter($str,$force=0){
  if(!$force && !$_REQUEST['filter']) return $str;
  preg_match_all($_REQUEST['filter'],$str,$rex);
  return implode("\n",$rex[0]);
}

function pcre_errmsg() {
  $err=preg_last_error();
  switch ($err) {
    case PREG_NO_ERROR:
      return false;
    case PREG_INTERNAL_ERROR:
      return "PREG_INTERNAL_ERROR - there was an internal PCRE error\n";
    case PREG_BACKTRACK_LIMIT_ERROR:
      return "PREG_BACKTRACK_LIMIT_ERROR - backtrack limit was exhausted. Available since PHP 5.2.0.\n";
    case PREG_RECURSION_LIMIT_ERROR:
      return "PREG_RECURSION_LIMIT_ERROR - recursion limit was exhausted. Available since PHP 5.2.0.\n";
    case PREG_BAD_UTF8_ERROR:
      return "PREG_BAD_UTF8_ERROR - the last error was caused by malformed UTF-8 data (only when running a regex in UTF-8 mode). Available since PHP 5.2.0.\n";
    case PREG_BAD_UTF8_OFFSET_ERROR:
      return "PREG_BAD_UTF8_OFFSET_ERROR - the offset didn't correspond to the begin of a valid UTF-8 code point (only when running a regex in UTF-8 mode). Available since PHP 5.3.0.\n";
    default:
      return false;
    }
}


?>

Javascript schnell&scheiße Testtool

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>JS Tester</title>

<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" type="text/css" href="static.css">

<!--- _javascript --->
<script type="text/javascript" src="/lib/js/standard_funx.js"></script>
<script type="text/javascript" src="/lib/js/resize.js"></script>
<script type="text/javascript">
  var ie= navigator.appName.match(/Explorer/);
  
  function m(str,target,clear){
    if(!target) var target= '#msg';
    var d= new Date();
    var ds= (''
          + d.getHours() +':'
          + d.getMinutes() +':'
          + d.getSeconds() +'.'
          + d.getMilliseconds()
          + '').sub().bold();
    if(ie){
      str= String(str).replace(/\n/g,'<br>\n');
    }
    if(clear){
      _(target).innerHTML=  ds +'--------------------------------------------'+(ie?'<br>':'')+'\n'+ str;
    }
    else{
//       var ss= _(target).selectionStart;
      _(target).innerHTML= ds +'--------------------------------------------'+(ie?'<br>':'')+'\n'+ str +(ie?'<br>':'')+'\n'+ _(target).innerHTML;
//       _(target).selectionStart= ss;
    } 
  }
  trace=m;
  
  

  function showPos(me){
//     var l= Math.ceil( (me.layerY + this.scrollTop) / charHeight );
//     var c= Math.floor( (me.layerX + this.scrollLeft) / charWidth );
    var l= Math.ceil( (me.layerY + this.scrollTop +2) / charHeight );
    var c= Math.floor((me.layerX + this.scrollLeft+1) / charWidth );
    f.pos.value= 'L '+ l +' | C '+ c;
  }
  
  
  function js1Key(e){
    if(!e) e= window.event;
    if(e.keyCode==13 && !e.shiftKey){
      if( this.history[this.hi]!=this.value ){
        this.history.unshift( this.value );
        this.hi= 0;
      }
      bash(this.value);
      if(ie){ e.cancelBubble= true; e.returnValue= false; }
      else  { e.stopPropagation(); e.preventDefault(); }
      return false;
    }
    if(e.keyCode==38 && e.ctrlKey){
      this.value= this.history[ this.hi<this.history.length ? this.hi++ : (this.hi=-1)];
    }
    if(e.keyCode==38 && e.ctrlKey){
      this.value= this.history[ this.hi>=0 ? this.hi-- : (this.hi= this.history.length-1) ];
    }
/*
    if(e.keyCode==38 && this.hi<this.h.length-1){
      this.value= this.h[ ++this.hi ];
    };
    if(e.keyCode==40 && this.hi>0){
      this.value= this.h[ --this.hi ];
    };
    if(e.keyCode==13){
      if(!this.h) this.h=[];
      this.hi=0;
      if(this.h[0] != this.value) this.h.unshift(this.value);
      try{
        var opt,v= this.value;
        eval( v.substr(0,1)==':'
          ? 'trace(\">\"+ '+ (v.substr(1,1)==':'
            ? 'dump('+ v.substr(v.indexOf(' ')) +','+ ((opt=v.substring(2,v.indexOf(' '))) ? opt : 1) +')'
            : v.substr(1)) +')'
          : v
        );
      } catch(e){
        trace(dump(e,0,0));
      }
    };
*/
  }
  
  
  function js2Key(e,callr){
    if(!e) e= window.event;
    if(e.keyCode==13){
      if( e.ctrlKey ){
        if(e.type=='keyup') bash( this.value );
        if(ie){ 
          e.cancelBubble= true; e.returnValue= false;
        }
        else  {
          e.stopPropagation(); e.preventDefault();
        }
      }
      else if(e.type=='keyup'){
        var lastLine= this.value.substr(0,this.selectionStart).split('\n').slice(-2,-1).join();
        var indent= lastLine.match(/^(\s*)/)[1];
        if( lastLine.substr(-1).match(/[({[]/) ){
          indent+= '  ';
        }
        else if( lastLine.substr(-1).match(/[)}\]]/) ){
          indent= indent.substr(0,indent.length-2);
        }
        for(var i=0; i<indent.length; i++){
          doKey(indent.charCodeAt(i),this);
        }
      }
    }
    if(e && e.keyCode && e.keyCode==9){
      if(callr){
      }
      else{
        doKey(32,this);
        if(ie) doKey(32,this);
        if(ie){ e.cancelBubble= true; e.returnValue= false; }
        else  { e.stopPropagation(); e.preventDefault(); }
      }
//      return; 
    }
    if(_('#bpBtn').live) b.innerHTML= this.value;
  }
  
  
  function doKey(chr,me){
    if(ie){
      document.selection.createRange().text+= String.fromCharCode(chr); 
      return;
    }
    var e= document.createEvent('KeyboardEvent');
    e.initKeyEvent('keypress',true,true,null,false,false,false,false,0,chr);
    me.dispatchEvent(e);
  } 
  
  
  




  function bash(str){
    try{
      if(str.substr(0,2)=='>>'){
        m( dump( eval(str.substr(2)),1 ) );
      }
      else if (str.substr(0,1)=='>'){
        m( eval(str.substr(1)) );
      }
      else{
        eval( str );
      }
    }
    catch(e){
      if(ie){
        m('ERR: '+ dump(e,2) );
        throw(e);
        return;
      }
      m(   e.message +' in <a href="'+ e.fileName +'">'+ e.fileName +'</a>, L '+ e.lineNumber 
         +( e.fileName && e.fileName!=location.href 
            ? '\n<div class=errSrc><iframe '
             +'name=err'+ (++errCount) +'  class=errSrc '
             +'src="'+ e.fileName +'#'+ e.lineNumber +'" '
             +'onload="contentWindow.scrollTo(1,'+ ((e.lineNumber-2)*charHeight) +'); initResize(this.parentNode)">'
             +'</iframe></div>\n' 
            : ''
          )
       );
    }
  }

  
  function writeHistoryList(){
    var hl= _('#hl');
    hl.innerHTML='';
    var h= _('#js1').history;
    var hi= _('#js1').hi;
    for( var i=0; i<h.length; i++){
      hl.innerHTML+= '<li><a name="'+i+'" '+ (i==hi ? 'class=active ' : '') 
                    +'onClick="_(\'#js1\').value=this.text;" '
                    +'onDblClick="_(\'#js1\').hi='+i+'; _(\'#js1\').onkeypress( event.merge({keyCode:13}) )"'
                    +'>'+ h[i].replace(/</g,'&lt;') +'</a></li>\n';
    }
//    m(h);
    return false;
  }
  
  
  function addBodyPane(w,props){
    w= w ? w : 50;
    f.style.width= (100-w)+'%';
    ( b= document.body.appendChild( document.createElement('div') ) ).style.merge({
      position:'absolute',
      top:0,
      left:w+'%',
      right:0,
      bottom:0,
      overflow:'auto',
      border:'1px solid green'  
    });
    b.id= 'html';
    b.merge(props);
    b.ondblclick= function(){ js2.value= this.innerHTML }
    return b;
  }
  
  
  function bodyPaneButton(me){
    if(typeof b!='object') return addBodyPane();
    if(me.live){
      me.rmClass('live');
      return me.live= false;
    }
    me.addClass('live');
    return me.live= true;
  }
  
  

  window.onload= function(){
    f.js1.history= [];
    f.js1.hi= 0;
    f.js1.onkeypress= js1Key;
//    f.js1.onkeyup= bash;
//     _('#js1c').onmousemove= showPos;
//     _('#js2c').onmousemove= showPos;
//     _('#msgc').onmousemove= showPos;
    _('#hb').onmouseover= function(){ writeHistoryList() };
    f.js2.onkeyup= js2Key; 
    f.js2.onkeypress= js2Key;
    initResize(js2c); 
    initResize(jsc); 
    initResize(f); 
    js2c.doResize= function(e){
      if(!e) e= window.event;
      this.style.height= Math.round((this.v0 + e.screenY-this.m0.y) / this.parentNode.offsetHeight *100)+'%';
      _('#js1c').style.height= (100-Number(this.style.height))+'%';
      if(ie){ e.cancelBubble= true; e.returnValue= false; }
      else  { e.stopPropagation(); e.preventDefault(); }
    }
    jsc.doResize= function(e){
      if(!e) e= window.event;
      this.style.height= Math.round((this.v0 + e.screenY-this.m0.y) / this.parentNode.offsetHeight *100)+'%';
      _('#msgc').style.height= (100-Number(this.style.height))+'%';
      if(ie){ e.cancelBubble= true; e.returnValue= false; }
      else  { e.stopPropagation(); e.preventDefault(); }
    }
  }

  var charWidth= 8;
  var charHeight= 16;
  var x0= 11;
  var errCount=0;
  
  
</script>

<!--- _css --->
<style>
  * {
    box-sizing:border-box;
    -moz-box-sizing:border-box;
    -khtml-box-sizing:border-box;
    -webkit-box-sizing:border-box;
  }
  
  html, body {height:100%;}
  
  body {
    margin:0px; padding:0px;
  }
  
  #h {
    position:absolute;
    right:75px;
    top:0px;
    height:600%;
  }
  
  #h ul {
    display:none;
  }
  
  #h:hover ul {
    display:block;
    position:relative;
    z-index:15;
    max-height:100%;
    overflow:auto;
    margin:0;
    padding:0 20px 0 5px;
    background:#EEEEEE;
    border:1px solid #000;
    list-style:none;
  }
  #h a {
    display:block;
    white-space:nowrap;
    font-family:monospace;
  }
  #h a:hover {
    background:#CEC;
  }
  #h a.active {
    background:#FBB;
  }

  #bpBtn.live {
    background-color:#F90;
  }

  #msg div.errSrc {
    position:relative;
    border:1px solid #990000;
    height:5em;
    width:95%;
    margin-left:1%;
  }
  iframe.errSrc {
    width:100%;
    height:100%;
    background:#FFF;
    border:0;
  }
  
</style>
  

</head>

<body>
<form id=f name=f style="position:relative; left:0; top:0; width:100%; height:100%; margin:0; padding:0; border:0; overflow:hidden;">
<div id=jsc style="position:absolute; left:0; width:100%; top:0; height:55%; padding:0; margin:0; border:01px solid red;">
  <div id=js2c style="position:absolute; left:0; width:100%; top:0;    height:85%; margin:0; padding:0; border:0;"><textarea id=js2 name=js2 style="width:100%; height:100%;" wrap=off></textarea></div>
  <div id=js1c style="position:absolute; left:0; width:100%; bottom:0; height:15%; margin:0; padding:0 110px 0 0;">
    <textarea id=js1 name=js1 style="width:100%; height:100%; margin:0;" wrap=off>&gt; </textarea>
    <div style="position:absolute; right:80px; top:0px; vertical-align:baseline;"><input type=checkbox name=qex checked style="vertical-align:middle;">&para;&raquo;</div>
    <div id=h style=""><button id=hb onClick="writeHistoryList(); return false;" style="position:absolute; top:0px; right:-15px; height:18px; padding:0px; font:bold 8pt/5pt Tahoma;">H</button><ul id=hl><li><i>leer</i></li></ul></div>
    <input type=text name=pos style="position:absolute; border-width:1px; right:60px; bottom:0px; width:50px; font:bold 8pt/5pt Arial;">
    <input type=button value="«&uarr;" onclick="eval(f.js2.value)" style="position:absolute; right:25px; top:0px; height:18px; padding:0px; font:bold 8pt/5pt Tahoma;">
    <input type=button value="&uarr;»" onclick="(typeof b=='object'?b:addBodyPane()).innerHTML=js2.value" style="position:absolute; right:0px; top:0px; height:18px; padding:0px; font:bold 8pt/5pt Tahoma;">
    <input type=button value="b›" id=bpBtn onclick="bodyPaneButton(this)" style="position:absolute; right:0px; top:18px; height:18px; padding:0px; font:bold 8pt/5pt Tahoma;">
    <input type=button value="x&darr;" onclick="_('#msg').innerHTML=''" style="position:absolute; right:25px; bottom:0px; height:18px; padding:0; font:bold 8pt/5pt Tahoma; valign:top;">
  </div>
</div>
<div id=msgc style="position:absolute; left:0; right:0; bottom:0; height:45%; margin:0; padding:0;"><pre id=msg name=msg style="height:100%; overflow:auto; margin:0; border:1px solid #000; background:#EEE">doc.cookie= <?= htmlspecialchars(print_r($_COOKIE,1)) ?></pre></div> 
</form>  

</body>
</html>

Blådernblåser

Mixtur: