File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 66<%  only_on_error_page do %> 
77  <%=  render_javascript 'error_page' %> 
88<%  end %> 
9+ 
10+ <%  only_on_regular_page do %> 
11+   <%=  render_javascript 'regular_page' %> 
12+ <%  end %> 
Original file line number Diff line number Diff line change 1+ // Push the error page body upwards the size of the console. 
2+ document . addEventListener ( 'DOMContentLoaded' ,  function ( )  { 
3+   var  consoleElement  =  document . getElementById ( 'console' ) ; 
4+   var  resizerElement  =  consoleElement . getElementsByClassName ( 'resizer' ) [ 0 ] ; 
5+   var  bodyElement  =  document . body ; 
6+ 
7+   function  setBodyElementBottomMargin ( pixels )  { 
8+     bodyElement . style . marginBottom  =  pixels  +  'px' ; 
9+   } 
10+ 
11+   var  currentConsoleElementHeight  =  consoleElement . offsetHeight ; 
12+   setBodyElementBottomMargin ( currentConsoleElementHeight ) ; 
13+ 
14+   resizerElement . addEventListener ( 'mousedown' ,  function ( event )  { 
15+     function  recordConsoleElementHeight ( event )  { 
16+       resizerElement . removeEventListener ( 'mouseup' ,  recordConsoleElementHeight ) ; 
17+ 
18+       var  currentConsoleElementHeight  =  consoleElement . offsetHeight ; 
19+       setBodyElementBottomMargin ( currentConsoleElementHeight ) ; 
20+     } 
21+ 
22+     resizerElement . addEventListener ( 'mouseup' ,  recordConsoleElementHeight ) ; 
23+   } ) ; 
24+ } ) ; 
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ def only_on_error_page(*args)
1010      yield  if  Thread . current [ :__web_console_exception ] . present? 
1111    end 
1212
13+     # Execute a block only on regular, non-error, pages. 
14+     def  only_on_regular_page ( *args ) 
15+       yield  if  Thread . current [ :__web_console_binding ] . present? 
16+     end 
17+ 
1318    # Render JavaScript inside a script tag and a closure. 
1419    # 
1520    # This one lets write JavaScript that will automatically get wrapped in a 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments