File: example/bookmarklet.js

Recommend this page to a friend!
  Classes of Dom Hastings  >  terminal-preview  >  example/bookmarklet.js  >  Download  
File: example/bookmarklet.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: terminal-preview
Render ANSI formatting characters as HTML
Author: By
Last change:
Date: 4 years ago
Size: 1,105 bytes
 

Contents

Class file image Download
javascript:(function() {
    var head = document.getElementsByTagName('head')[0],
    _createScript = function(path, onload) {
        var element = document.createElement('script');
        element.src = path;
        element.type = 'text/javascript';

        if (onload) {
            element.onload = onload;
        }

        head.appendChild(element);
    },
    _createStyle = function(path) {
        var element = document.createElement('link');
        element.href = path;
        element.rel = 'stylesheet';
        head.appendChild(element);
    },
    _done = function() {
        _createScript('https://cdn.rawgit.com/dom111/terminal-preview/master/dist/parse-min.js', function() {
            _createStyle('https://cdn.rawgit.com/dom111/terminal-preview/master/dist/terminal-min.css');
            _createScript('https://cdn.rawgit.com/dom111/terminal-preview/master/dist/terminal-min.js')
        });
    };

    if (!('jQuery' in window)) {
        _createScript('https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', _done);
    }
    else {
        _done();
    }
})();