jquery.terminal
Version:
jQuery Terminal Emulator is a plugin for creating command line interpreters in your applications.
51 lines (50 loc) • 2.06 kB
JavaScript
/**@license
* __ _____ ________ __
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.45.2
*
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
*
* Copyright (c) 2010-2025 Jakub T. Jankiewicz <https://jcubic.pl/me>
* Released under the MIT license
*/
/* global jQuery */
(function() {
function get(url) {
var element;
if (url.match(/css$/)) {
element = document.createElement('link');
element.setAttribute('href', url);
element.setAttribute('rel', 'stylesheet');
} else if (url.match(/js$/)) {
element = document.createElement('script');
element.setAttribute('src', url);
}
console.log(element);
return new Promise(function(resolve, reject) {
console.log(element);
if (element) {
element.onload = resolve;
var head = document.querySelector('head');
head.appendChild(element);
} else {
reject();
}
});
}
var terminals = window.terminals || [];
if (typeof jQuery === 'undefined') {
get('http://code.jquery.com/jquery-3.5.0.min.js').then(function() {
jQuery.noConflict();
get('https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.45.2/css/jquery.terminal.min.css');
return get('https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.45.2/js/jquery.terminal.min.js');
}).then(function() {
terminals.forEach(function(spec) {
jQuery.fn.terminal.apply(jQuery(spec[0]), spec.slice(1));
});
});
}
})();