Giter VIP home page Giter VIP logo

chibi's Introduction

Chibi

This is a tiny jQuery script that will inject a JavaScript REPL into your DOM. It behaves like the Google Chrome console but this will operate right into your page.

Why would you ever need this? Well, if you find yourself hosted in an environment that pretends to be a browser but doesn't have a console then this might come in handy.

It works perfectly in IE8 too.

Usage

Make sure you have jQuery 1.9 or higher and the Chibi script loaded. Then just create a <div> somewhere on your page to hold your console:

<div id="console"></div>

And initialize using jQuery's ready function:

<script>
    $(function () {
        $('#console').chibi();
    });
</script>

If you want to output data to the console from your script you can do so with the info and error actions:

<script>
    $('#console').chibi('info', 'info message');
    $('#console').chibi('error', 'error message');
</script>

You can clear the console with the clear action:

<script>
    $('#console').chibi('clear');
</script>

The console supports a rudimentary history feature with the up and down keys. It's not very smart yet: it will not duplicate the last command but that's basically it.

Oh yeah, you might wanna include chibi.css too for some basic styling.

TODO

  • Support more than one console in the DOM
  • More sensible history support
  • Configuration options

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.