occweb/js/term.js

42 lines
115 KiB
JavaScript
Raw Normal View History

/**@license
* __ _____ ________ __
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.0.2
*
* This file is part of jQuery Terminal. http://terminal.jcubic.pl
*
* Copyright (c) 2010-2018 Jakub Jankiewicz <http://jcubic.pl/me>
* Released under the MIT license
*
* Contains:
*
* Storage plugin Distributed under the MIT License
* modified to work from Data URIs that block storage and cookies in Chrome
* Copyright (c) 2010 Dave Schindler
*
* jQuery Timers licenced with the WTFPL
* <http://jquery.offput.ca/timers/>
*
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* Available under the MIT License
*
* jQuery Caret
* Copyright (c) 2009, Gideon Sireling
* 3 clause BSD License
*
* sprintf.js
* Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro>
* licensed under 3 clause BSD license
*
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* Date: Sat, 22 Dec 2018 15:04:13 +0000
*/
(function(e){var m=function(){if(!m.cache.hasOwnProperty(arguments[0])){m.cache[arguments[0]]=m.parse(arguments[0])}return m.format.call(null,m.cache[arguments[0]],arguments)};m.format=function(e,t){var n=1,r=e.length,i="",o,a=[],u,s,l,f,c,p;for(u=0;u<r;u++){i=D(e[u]);if(i==="string"){a.push(e[u])}else if(i==="array"){l=e[u];if(l[2]){o=t[n];for(s=0;s<l[2].length;s++){if(!o.hasOwnProperty(l[2][s])){throw m('[sprintf] property "%s" does not exist',l[2][s])}o=o[l[2][s]]}}else if(l[1]){o=t[l[1]]}else{o=t[n++]}if(/[^s]/.test(l[8])&&D(o)!=="number"){throw m("[sprintf] expecting number but found %s",D(o))}switch(l[8]){case"b":o=o.toString(2);break;case"c":o=String.fromCharCode(o);break;case"d":o=parseInt(o,10);break;case"e":o=l[7]?o.toExponential(l[7]):o.toExponential();break;case"f":o=l[7]?parseFloat(o).toFixed(l[7]):parseFloat(o);break;case"o":o=o.toString(8);break;case"s":o=(o=String(o))&&l[7]?o.slice(0,l[7]):o;break;case"u":o=o>>>0;break;case"x":o=o.toString(16);break;case"X":o=o.toString(16).toUpperCase();break}o=/[def]/.test(l[8])&&l[3]&&o>=0?" +"+o:o;c=l[4]?l[4]==="0"?"0":l[4].charAt(1):" ";p=l[6]-String(o).length;f=l[6]?d(c,p):"";a.push(l[5]?o+f:f+o)}}return a.join("")};m.cache={};m.parse=function(e){var t=e,n=[],r=[],i=0;while(t){if((n=/^[^\x25]+/.exec(t))!==null){r.push(n[0])}else if((n=/^\x25{2}/.exec(t))!==null){r.push("%")}else if((n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))!==null){if(n[2]){i|=1;var o=[],a=n[2],u=[];if((u=/^([a-z_][a-z_\d]*)/i.exec(a))!==null){o.push(u[1]);while((a=a.slice(u[0].length))!==""){if((u=/^\.([a-z_][a-z_\d]*)/i.exec(a))!==null){o.push(u[1])}else if((u=/^\[(\d+)\]/.exec(a))!==null){o.push(u[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}n[2]=o}else{i|=2}if(i===3){throw"[sprintf] mixing positional and named placeholders is not (yet) supported"}r.push(n)}else{throw"[sprintf] huh?"}t=t.slice(n[0].length)}return r};var t=function(e,t,n){n=t.slice(0);n.splice(0,0,e);return m.apply(null,n)};function D(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function d(e,t){for(var n=[];t>0;n[--t]=e){}return n.join("")}e.sprintf=m;e.vsprintf=t})(typeof global!=="undefined"?global:window);(function(r,i){var e=typeof window!=="undefined"?window:global;if(typeof define==="function"&&define.amd){define(["jquery","wcwidth"],r)}else if(typeof module==="object"&&module.exports){module.exports=function(e,t,n){if(t===i){if(window!==i){t=require("jquery")}else{t=require("jquery")(e)}}if(n===i){n=require("wcwidth")}r(t,n);return t}}else{r(e.jQuery,e.wcwidth)}})(function($,wcwidth,undefined){"use strict";function debug(e){if(false){console.log(e)}}function DelayQueue(){var t=$.Callbacks();var n=false;this.resolve=function(){t.fire();n=true};this.add=function(e){if(n){e()}else{t.add(e)}}}$.omap=function(n,r){var i={};$.each(n,function(e,t){i[e]=r.call(n,e,t)});return i};$.fn.text_length=function(){return this.map(function(){return $(this).text().length}).get().reduce(function(e,t){return e+t},0)};var Clone={clone_object:function(e){var t={};if(typeof e==="object"){if($.isArray(e)){return this.clone_array(e)}else if(e===null){return e}else{for(var n in e){if($.isArray(e[n])){t[n]=this.clone_array(e[n])}else if(typeof e[n]==="object"){t[n]=this.clone_object(e[n])}else{t[n]=e[n]}}}}return t},clone_array:function(e){if(!is_function(Array.prototype.map)){throw new Error("Your browser don't support ES5 array map "+"use es5-shim")}return e.slice(0).map(function(e){if(typeof e==="object"){return this.clone_object(e)}else{return e}}.bind(this))}};var clone=function(e){return Clone.clone_object(e)};var localStorage;(function(){var e=function(){try{var e="test",t=window.localStorage;t.setItem(e,"1");t.removeItem(e);return true}catch(e){return false}};var t=function(){try{document.cookie.split(";");return true}catch(e){return false}};var n=e();function r(e,t){var n;if(typeof e==="string"&&typeof t==="string"){localStorage[e]=t;return true}else if(typeof e==="object"&&typeof t==="undefined"){for(n in e){if(e.hasOwnProperty(n)){localStorage[
//# sourceMappingURL=jquery.terminal.min.js.map