diff --git a/js/jquery.terminal-src.js b/js/jquery.terminal-src.js index 07e57e97..d49dc552 100644 --- a/js/jquery.terminal-src.js +++ b/js/jquery.terminal-src.js @@ -6857,6 +6857,8 @@ // --------------------------------------------------------------------- // :: Replace terminal formatting with html // --------------------------------------------------------------------- + var href_re = /^(((?:blob:)?https?|file|ftp):\/\/|\.{0,2}\/)/; + var src_re = /^(https?:|file:|blob:|data:)/; $.terminal.format = function format(str, options) { var settings = $.extend({}, { linksNoReferrer: false, @@ -6868,11 +6870,11 @@ }, options || {}); // ----------------------------------------------------------------- var valid_href = with_url_validation(function(url) { - return url.match(/^(((?:blob:)?https?|file|ftp):\/\/|\.{0,2}\/)/) || is_path(url); + return url.match(href_re) || is_path(url); }, settings); // ----------------------------------------------------------------- var valid_src = with_url_validation(function(url) { - return url.match(/^(https?:|file:|blob:|data:)/) || is_path(url); + return url.match(src_re) || is_path(url); }, settings); // ----------------------------------------------------------------- function filter_attr_names(names) { diff --git a/js/jquery.terminal.js b/js/jquery.terminal.js index 6d7a1d72..462bd786 100644 --- a/js/jquery.terminal.js +++ b/js/jquery.terminal.js @@ -41,7 +41,7 @@ * * broken image by Sophia Bai from the Noun Project (CC-BY) * - * Date: Sat, 02 Nov 2024 21:32:11 +0000 + * Date: Sat, 02 Nov 2024 21:39:24 +0000 */ /* global define, Map, BigInt */ /* eslint-disable */ @@ -5350,7 +5350,7 @@ // ------------------------------------------------------------------------- $.terminal = { version: 'DEV', - date: 'Sat, 02 Nov 2024 21:32:11 +0000', + date: 'Sat, 02 Nov 2024 21:39:24 +0000', // colors from https://www.w3.org/wiki/CSS/Properties/color/keywords color_names: [ 'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white', @@ -6857,6 +6857,8 @@ // --------------------------------------------------------------------- // :: Replace terminal formatting with html // --------------------------------------------------------------------- + var href_re = /^(((?:blob:)?https?|file|ftp):\/\/|\.{0,2}\/)/; + var src_re = /^(https?:|file:|blob:|data:)/; $.terminal.format = function format(str, options) { var settings = $.extend({}, { linksNoReferrer: false, @@ -6868,11 +6870,11 @@ }, options || {}); // ----------------------------------------------------------------- var valid_href = with_url_validation(function(url) { - return url.match(/^(((?:blob:)?https?|file|ftp):\/\/|\.{0,2}\/)/) || is_path(url); + return url.match(href_re) || is_path(url); }, settings); // ----------------------------------------------------------------- var valid_src = with_url_validation(function(url) { - return url.match(/^(https?:|file:|blob:|data:)/) || is_path(url); + return url.match(src_re) || is_path(url); }, settings); // ----------------------------------------------------------------- function filter_attr_names(names) { diff --git a/js/jquery.terminal.min.js b/js/jquery.terminal.min.js index 63d82812..5dd73bb4 100644 --- a/js/jquery.terminal.min.js +++ b/js/jquery.terminal.min.js @@ -41,7 +41,7 @@ * * broken image by Sophia Bai from the Noun Project (CC-BY) * - * Date: Sat, 02 Nov 2024 21:32:11 +0000 + * Date: Sat, 02 Nov 2024 21:39:24 +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 r=1,n=e.length,i="",a,u=[],o,s,l,f,c,p;for(o=0;o>>0;break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase();break}a=/[def]/.test(l[8])&&l[3]&&a>=0?" +"+a:a;c=l[4]?l[4]==="0"?"0":l[4].charAt(1):" ";p=l[6]-String(a).length;f=l[6]?d(c,p):"";u.push(l[5]?a+f:f+a)}}return u.join("")};m.cache={};m.parse=function(e){var t=e,r=[],n=[],i=0;while(t){if((r=/^[^\x25]+/.exec(t))!==null){n.push(r[0])}else if((r=/^\x25{2}/.exec(t))!==null){n.push("%")}else if((r=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))!==null){if(r[2]){i|=1;var a=[],u=r[2],o=[];if((o=/^([a-z_][a-z_\d]*)/i.exec(u))!==null){a.push(o[1]);while((u=u.slice(o[0].length))!==""){if((o=/^\.([a-z_][a-z_\d]*)/i.exec(u))!==null){a.push(o[1])}else if((o=/^\[(\d+)\]/.exec(u))!==null){a.push(o[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}r[2]=a}else{i|=2}if(i===3){throw"[sprintf] mixing positional and named placeholders is not (yet) supported"}n.push(r)}else{throw"[sprintf] huh?"}t=t.slice(r[0].length)}return n};var t=function(e,t,r){r=t.slice(0);r.splice(0,0,e);return m.apply(null,r)};function D(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function d(e,t){for(var r=[];t>0;r[--t]=e){}return r.join("")}e.sprintf=m;e.vsprintf=t})(typeof global!=="undefined"?global:self||window);(function(n,i){var r;if(typeof window!=="undefined"){r=window}else if(typeof self!=="undefined"){r=self}else if(typeof global!=="undefined"){r=global}else{throw new Error("Unknow context")}if(typeof define==="function"&&define.amd){define(["jquery","wcwidth"],function(e,t){n(e,t,r);return e})}else if(typeof module==="object"&&module.exports){module.exports=function(e,t,r){if(t===i){if(typeof window!=="undefined"){t=require("jquery")}else{t=require("jquery")(e)}}if(r===i){r=require("wcwidth")}n(t,r,e);return t}}else{if(!r.jQuery){r.$=r.cash}n(r.jQuery||r.cash,r.wcwidth,r)}})(function($,wcwidth,root,undefined){"use strict";function debug(e){if(false){console.log(e)}}function DelayQueue(){var t=$.Callbacks();var r=false;var e=this;this.resolve=function(){t.fire();e.resolved=r=true};this.add=function(e){if(r){e()}else{t.add(e)}}}$.omap=function(r,n){var i={};$.each(r,function(e,t){i[e]=n.call(r,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(Array.isArray(e)){return this.clone_array(e)}else if(e===null){return e}else{for(var r in e){if(Array.isArray(e[r])){t[r]=this.clone_array(e[r])}else if(typeof e[r]==="object"){t[r]=this.clone_object(e[r])}else{t[r]=e[r]}}}}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)};if("Map"in root&&!("clear"in Map.prototype)){Map.prototype.clear=function(){this.forEach(function(e,t,r){r.delete(t)})}}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 r=e();function n(e,t){var r;if(typeof e==="string"&&typeof t==="string"){localStorage[e]=t;return true}else if(typeof e==="object"&&typeof t==="undefined"){for(r in e){if(e.hasOwnProperty(r)){localStorage[r]=e[r]}}return true}return false}function i(e,t){var r,n,i;r=new Date;r.setTime(r.getTime()+31536e6);n="; expires="+r.toGMTString();if(typeof e==="string"&&typeof t==="string"){document.cookie=e+"="+t+n+"; path=/";return true}else if(typeof e==="object"&&typeof t==="undefined"){for(i in e){if(e.hasOwnProperty(i)){document.cookie=i+"="+e[i]+n+"; path=/"}}return true}return false}function a(e){return localStorage[e]}function u(e){var t,r,n,i;t=e+"=";r=document.cookie.split(";");for(n=0;n=i||t<0||D&&r>=s}function y(){var e=$();if(_(e)){return b(e)}f=setTimeout(y,g(e))}function b(e){f=undefined;if(d&&u){return h(e)}u=o=undefined;return l}function C(){if(f!==undefined){clearTimeout(f)}p=0;u=c=o=f=undefined}function F(){return f===undefined?l:b($())}function w(){var e=$(),t=_(e);u=arguments;o=this;c=e;if(t){if(f===undefined){return v(c)}if(D){f=setTimeout(y,i);return h(c)}}if(f===undefined){f=setTimeout(y,i)}return l}w.cancel=C;w.flush=F;return w}}();var jQuery=$;(function(e){jQuery.fn.extend({everyTime:function(e,t,r,n,i){return this.each(function(){jQuery.timer.add(this,e,t,r,n,i)})},oneTime:function(e,t,r){return this.each(function(){jQuery.timer.add(this,e,t,r,1)})},stopTime:function(e,t){return this.each(function(){jQuery.timer.remove(this,e,t)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1e3,das:1e4,hs:1e5,ks:1e6},timeParse:function(e){if(e===undefined||e===null){return null}var t=this.regex.exec(e.toString().trim());if(t[2]){var r=parseInt(t[1],10);var n=this.powers[t[2]]||1;return r*n}else{return e}},add:function(e,t,r,n,i,a){var u=0;if(typeof r==="function"){if(!i){i=n}n=r;r=t}t=jQuery.timer.timeParse(t);if(typeof t!=="number"||isNaN(t)||t<=0){return}if(i&&i.constructor!==Number){a=!!i;i=0}i=i||0;a=a||false;if(!e.$timers){e.$timers={}}if(!e.$timers[r]){e.$timers[r]={}}n.$timerID=n.$timerID||this.guid++;var o=function(){if(a&&o.inProgress){return}o.inProgress=true;if(++u>i&&i!==0||n.call(e,u)===false){jQuery.timer.remove(e,r,n)}o.inProgress=false};o.$timerID=n.$timerID;if(!e.$timers[r][n.$timerID]){e.$timers[r][n.$timerID]=setInterval(o,t)}if(!this.global[r]){this.global[r]=[]}this.global[r].push(e)},remove:function(e,t,r){var n=e.$timers,i;if(n){if(!t){for(var a in n){if(n.hasOwnProperty(a)){this.remove(e,a,r)}}}else if(n[t]){if(r){if(r.$timerID){clearInterval(n[t][r.$timerID]);delete n[t][r.$timerID]}}else{for(var u in n[t]){if(n[t].hasOwnProperty(u)){clearInterval(n[t][u]);delete n[t][u]}}}for(i in n[t]){if(n[t].hasOwnProperty(i)){break}}if(!i){i=null;delete n[t]}}for(i in n){if(n.hasOwnProperty(i)){break}}if(!i){e.$timers=null}}}}});if(/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())){e(window).one("unload",function(){var e=jQuery.timer.global;for(var t in e){if(e.hasOwnProperty(t)){var r=e[t],n=r.length;while(--n){jQuery.timer.remove(r[n],t)}}}})}})(jQuery);(function(f){if(!String.prototype.split.toString().match(/\[native/)){return}var c=String.prototype.split,p=/()??/.exec("")[1]===f,r;r=function(e,t,r){if(Object.prototype.toString.call(t)!=="[object RegExp]"){return c.call(e,t,r)}var n=[],i=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),a=0,u,o,s,l;t=new RegExp(t.source,i+"g");e+="";if(!p){u=new RegExp("^"+t.source+"$(?!\\s)",i)}r=r===f?-1>>>0:r>>>0;while(o=t.exec(e)){s=o.index+o[0].length;if(s>a){n.push(e.slice(a,o.index));if(!p&&o.length>1){o[0].replace(u,function(){for(var e=1;e1&&o.index=r){break}}if(t.lastIndex===o.index){t.lastIndex++}}if(a===e.length){if(l||!t.test("")){n.push("")}}else{n.push(e.slice(a))}return n.length>r?n.slice(0,r):n};String.prototype.split=function(e,t){return r(this,e,t)};return r})();$.fn.caret=function(e){var t=this[0];var r=t.contentEditable==="true";if(arguments.length===0){if(window.getSelection){if(r){if(!this.is(":focus")){t.focus()}var n=window.getSelection().getRangeAt(0),i=n.cloneRange();i.selectNodeContents(t);i.setEnd(n.endContainer,n.endOffset);return i.toString().length}return t.selectionStart}if(document.selection){t.focus();if(r){var n=document.selection.createRange(),i=document.body.createTextRange();i.moveToElementText(t);i.setEndPoint("EndToEnd",n);return i.text.length}var e=0,a=t.createTextRange(),i=document.selection.createRange().duplicate(),u=i.getBookmark();a.moveToBookmark(u);while(a.moveStart("character",-1)!==0)e++;return e}return 0}if(e===-1)e=this[r?"text":"val"]().length;if(window.getSelection){if(r){if(!this.is(":focus")){t.focus()}var o=window.getSelection();o.collapse(o.focusNode,e)}else t.setSelectionRange(e,e)}else if(document.body.createTextRange){var a=document.body.createTextRange();a.moveToElementText(t);a.moveStart("character",e);a.collapse(true);a.select()}if(!r&&!this.is(":focus")){t.focus()}return e};function make_callback_plugin(e){var s=$.extend({init:$.noop,destroy:$.noop,name:"event"},e);return function(n,i){var a=arguments.length===0;var u=arguments[0]==="unbind";if(!a&&!u&&!is_function(n)){throw new Error("Invalid argument, it need to a function or string "+'"unbind" or no arguments.')}if(u){n=is_function(arguments[1])?arguments[1]:null}var o="callbacks_"+s.name;return this.each(function(){var t=$(this);var r;function e(e){r.fireWith(t,[e])}if(a||u){r=t.data(o);if(a){r&&r.fire()}else{if(n&&r){r.remove(n);if(!r.has()){r=null}}else{r=null}if(!r){t.removeData(o);s.destroy.call(this,e,i)}}}else if(t.data(o)){$(this).data(o).add(n)}else{r=$.Callbacks();r.add(n);t.data(o,r);s.init.call(this,e,i)}})}}$.fn.resizer=make_callback_plugin({name:"resize",init:function(e,t){var r=$.extend({prefix:""},t);var n=$(this);var i;var a=true;if(n.is("body")){$(window).on("resize.resizer",e)}else if(window.ResizeObserver){i=new ResizeObserver(function(){if(!a){setTimeout(e,0)}a=false});i.observe(this);n.data("observer",i)}else{var u=$("