cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              body {
    margin: 0;
    height: 100vh;
    --size: 1.5;
}
.cmd [role="presentation"] {
    padding-bottom: 3px;
}
.emoji {
    width: calc(var(--size, 1) * 14px) !important;
    height: calc(var(--size, 1) * 14px);
    background-size: cover;
    display: inline-block;
    color: transparent;
    position: relative;
}
.cmd .cursor span.emoji {
    color: transparent;
}
.cmd .cursor .emoji.emoji.emoji {
    -webkit-animation: terminal-blink 1s infinite linear;
    -moz-animation: terminal-blink 1s infinite linear;
    -ms-animation: terminal-blink 1s infinite linear;
    animation: terminal-blink 1s infinite linear;
    
    -webkit-animation: var(--animation, terminal-blink) 1s infinite linear;
    -moz-animation: var(--animation, terminal-blink) 1s infinite linear;
    -ms-animation: var(--animation, terminal-blink) 1s infinite linear;
    animation: var(--animation, terminal-blink) 1s infinite linear;
}
.cmd .emoji.emoji.emoji span {
    animation: none;
}
.cmd .emoji.emoji.emoji, .cmd .emoji.emoji.emoji span {
    color: transparent;
    background-color: transparent;
}
/*
use css below if you use

--animation: terminal-underline

span:not(.cursor) > .emoji {
    top: 1px;
}
.cursor .emoji {
    top: -1px;
}
*/
            
          
!
            
              var term = $('body').terminal(function(command) {
    this.echo('you typed ' + JSON.stringify(command), {
        formatters: false
    });
}, {
    name: 'emoji',
    // detect iframe codepen preview
    enabled: $('body').attr('onload') === undefined,
    onInit: function() {
        this.echo('type &#58;smiley&#58; or &#58;&#41; to render emoji :smiley:')
            .echo('<span>You can also paste Unicode codepoints that create emoji ' +
                  'like 8️⃣ to render <span style="width: 1ch" class="emoji eight" '+
                  'data-text="8️⃣">8️⃣</span></span>', {raw: true})
            .echo('you need to wait a moment while we fetch emoji data')
            .echo('to see available emoji type &#58;&lt;CHAR(S)&gt; and press tab twice')
    },
    completion: function(string, callback) {
        if (string.match(/^:/)) {
            callback(names.map(function(name) {
                return ':' + name + ':';
            }));
        }
    }
});
// for codepen preview
if (!term.enabled()) {
    term.find('.cursor').addClass('blink');
}
var names = [];
$.get('https://rawgit.com/iamcal/emoji-data/master/emoji.json').then(function(list) {
    //return;
    var text = {};
    
    var css = [];
    list.forEach(function(emoji, i) {
        if (emoji.text && !text[emoji.text]) {
            text[emoji.text] = emoji.short_name;
        }
        // escape special characters in class name https://mathiasbynens.be/notes/css-escapes
        var className = emoji.short_name.replace(/\+/g, '\\+').replace(/^(\d)/i, '\\3$1 ');
        css.push('.emoji.' + className + '{background-image: url(https://rawgit.com/iamcal/emoji-data/master/img-twitter-64/' + emoji.image + ');}');
        names.push(emoji.short_name);
    });
    $('<style>' + css.join('\n') + '</style>').appendTo('head');
    
    // new API from version 1.10.0, old one with function will still work but
    // if you need to use replacement that change length of the input text
    // you need to use [regex, str] or function formatter (from version 1.19.0)
    // where you use $.terminal.tracking_replace that returns [string, position]
    // the same should be returned by formatter, optionally you can check if options
    // have position if not you can return string (this will ensure that formatter
    // work with different versions of jQuery Terminal)
    $.terminal.defaults.formatters.push([
        new RegExp(':(' + names.map(function(name) {
            return $.terminal.escape_regex(name)
        }).join('|') + '):', 'g'),
        '[[;;;emoji $1]⻇]'
    ]);
    Object.keys(text).forEach(function(name) {
        $.terminal.defaults.formatters.push([
            new RegExp($.terminal.escape_regex(name), 'g'),
            '[[;;;emoji ' + text[name] + ']⻇]'
        ]);
    });
    // this is unicode emoji handling
    $.terminal.defaults.formatters.push(function(string, options) {
        var result = [string, options.position];
        list.forEach(function(emoji) {
            if (emoji.unified) {
                var unicode = emoji.unified.split('-').map(function(u) {
                    return '\\u' + u;
                }).join('');
                var re = new RegExp('(' + unicode + ')', 'gu');
                result = $.terminal.tracking_replace(
                    result[0],
                    re,
                    '[[;;;emoji ' + emoji.short_name + ']$1]',
                    result[1]
                );
            }
        });
        return result;
    });
    term.refresh();
});

github('jcubic/jquery.terminal');
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console