• Stars
    star
    414
  • Rank 104,146 (Top 3 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 12 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Render ANSI art using HTML5 / JavaScript
                                                _)
   _ \   __|   __|   _` |  __ \    _ \   __|     |   __|
   __/ \__ \  (     (   |  |   |   __/ \__ \     | \__ \
 \___| ____/ \___| \__,_|  .__/  \___| ____/ _)  | ____/
                          _|                 ___/


  escapes.js is a small JavaScript / Canvas library for rendering ANSI art. It
  has no dependencies, but it integrates nicely with jQuery.

  Demo: http://atdt.github.com/escapes.js/

  Example:

      escapes('path/to/file.ans', function () {
          document.body.appendChild(this);
      });


  Example (with jQuery):

      escapes('path/to/file.ans', function () {
          $(this).appendTo('body');
      });


  Within the callback, the value of "this" is set to a canvas element
  containing the rendered ANSI. The element is augmented with a couple of
  useful methods:

    this.toImageTag()

        Creates an image tag with a PNG of the ANSI.

    this.toDownloadURL()

        Returns a string URL containing the rendered ANSI as a base64-encoded
        PNG file, with a MIME type of "image/octet-stream". If you set this URL
        as the href attribute of a link tag, clicking on it will open a "Save
        File..." dialog.

  escapes() takes a configuration object as an optional third parameter. You
  can use it to make the default background color transparent by passing in
  {transparent: true}.

  If you're using escapes.js with jQuery, you can invoke the library as
  $.ansiRender([url]). This returns a jQuery.Deferred object:

      $.ansiRender('path/to/file.ans').done(function () {
            // do stuff
      });

  Thie chief advantage of this approach is that it allows you to synchronize
  ANSI rendering with other asyncronous operations (using Deferred.when, for
  example). You can read more about jQuery.Deferred here:

  http://api.jquery.com/category/deferred-object/

  For lots & lots of beautiful ANSI art, check out http://sixteencolors.net/

More Repositories

1

monotonic

An implementation of time.monotonic() for Python 2 & Python 3
Python
64
star
2

wob.js

an experiment in concurrency
JavaScript
39
star
3

chrome-force-media-type

Force links to open as particular content-types in Google Chrome
JavaScript
21
star
4

snoflake

A JavaScript runtime for the SNOBOL4 programming language
JavaScript
16
star
5

gerrit-stream

Sample code for grabbing Gerrit stream-events output using Python
Python
11
star
6

afraid

A simple client for the afraid.org dynamic DNS service
Python
7
star
7

SkelJS

SkelJS aims to be a reference implementation of a JavaScript-centric MediaWiki extension, embodying best practices.
JavaScript
6
star
8

gerrit

fork of gerrit
Java
4
star
9

wmf-vagrant

The canonical home for the Wikimedia Foundation's Vagrant package is at:
Puppet
4
star
10

psi.js

Pythonic Strings for JavaScript
JavaScript
3
star
11

UdpKafka

udplog - Kafka router
Java
3
star
12

xvo

X-Vary-Options for Varnish
C
2
star
13

marcel

Python
2
star
14

E3Experiments

A scaffold for members of the Editor Engagement Experiments to use when deploying simple experiments.
JavaScript
2
star
15

vim-mediawiki

Vim Script
2
star
16

anbernic_favorites_tool

Tool for shuffling or sorting the favorites list on Anbernic consoles. Not affiliated with or endorsed by Anbernic.
C++
2
star
17

gerp

JavaScript
2
star
18

emitt3r

Node.js udp2log client with Redis as a data store.
JavaScript
1
star
19

httr-srchr

httr-srchr tells you where IO is happening in your filesystem
Python
1
star
20

mwprof

C
1
star
21

murmurhash3_mysql

MySQL UDF (User Defined Function) for the 32-bit variant of MurmurHash3, a fast, non-cryptographic hash function.
C
1
star
22

Draft

JavaScript Development Server
JavaScript
1
star
23

dnt

Chrome / Chromium extension for universal tracking opt-out via Do Not Track headers
JavaScript
1
star
24

zpubsub

C
1
star
25

git-itemize

"git commit --interactive" for commit messages.
Python
1
star
26

python-udp-gmond

Python
1
star
27

python-memcached-gmond

Python Gmond Module for Memcached
Python
1
star