Last active
August 29, 2015 14:14
-
-
Save tonyfast/59533147ebac39fc0d02 to your computer and use it in GitHub Desktop.
Jquery + Jquery.terminal :: A Browser based console in Jquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <head> | |
| <script src="//cdn.jsdelivr.net/g/jquery,jquery.terminal"></script> | |
| <style> | |
| terminal{ | |
| position: fixed; | |
| height: 80%; | |
| right: -550px; | |
| display: block-inline; | |
| width: 650px; | |
| background-color: lightblue; | |
| } | |
| terminal.show{ | |
| right: 0px; | |
| } | |
| terminal .console{ | |
| margin-left: 40px; | |
| margin-top: 10%; | |
| } | |
| terminal .toggle{ | |
| font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
| float: left; | |
| -webkit-transform: rotate(270deg); | |
| text-align: center; | |
| margin-top: 50%; | |
| margin-bottom: 50%; | |
| width: auto; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <link id="terminal" rel="stylesheet" href="http://terminal.jcubic.pl/css/jquery.terminal.css"> | |
| <terminal> | |
| <span class="toggle"><b>click to test $.terminal</b></span> | |
| <div class="console"></div> | |
| </terminal> | |
| <script> | |
| $(document).ready(function($, undefined) { | |
| $('.console').terminal(function(command, term) { | |
| if (command !== '') { | |
| try { | |
| var result = window.eval(command); | |
| if (result !== undefined) { | |
| term.echo(new String(result)); | |
| } | |
| } catch(e) { | |
| term.error(new String(e)); | |
| } | |
| } else { | |
| term.echo(''); | |
| } | |
| }, { | |
| greetings: 'Enjoy a browser based Javascript console', | |
| name: 'js_demo', | |
| height: "80%", | |
| prompt: '> '}); | |
| $('terminal').first().each( function(){ | |
| var t = $(this).find('.toggle'); | |
| var p = $(this); | |
| $(t).click( function(){ | |
| $(p).toggleClass('show'); | |
| })//click | |
| });//each | |
| });//ready | |
| </script> | |
| </body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment