diff --git a/t.min.js b/t.min.js index b74e173..4231655 100644 --- a/t.min.js +++ b/t.min.js @@ -1,2 +1,2 @@ /*t.js-1.5.4;(c)2014-2019 - Mntn(r) c/o Benjamin Lips ;MIT-Licensed ;For documentation, see */ -;(function(c){c.fn.t=function(k,J){return this.each(function(){if(k=='queue')return(c(this).q(J));var a=J,l=k,b=c(this),r=b,w,m,u,n,x,y=-1,p=!1,B=0,D=0,E=-1,z="12qwertyuiop[]asdfghjkl;zxcvbnm,./~!@#$%^&*()_+:1234567890-=op".split([]),e=function(a,b){return c.type(a)[0]==(b||"n")},F=function(){_g=c.grep(g,function(a){return"&"==a[0]||!a[1]}).length-1;return-1<_g?_g:0},A=function(b){E!=b&&a.blink&&(a.blink_perm||r.data("blinking",E=b?1:0))},f={c:0,beep:function(){0==f.c&&(f.c=c("html").data().__TAC);f.o&&f.o.stop();f.o=f.c.createOscillator();f.o.frequency.setValueAtTime(1,f.c.currentTime);f.g=f.c.createGain();f.o.connect(f.g);f.g.connect(f.c.destination);f.o.start();f.o.stop(f.c.currentTime+.03)}};if("beep"==l&&!b.data().is_typing&&c("html").data().__TAC)return f.beep(),this;if("speed"==l&&e(a)&&9*");if(b.data().is_typing)return l=="paused".slice(0,-1)&&(b.data("paused",e(a,"b")?oo_=a:b.data("paused")?oo_=!1:oo_=!0),b.data().blink&&b.data("blinking",oo_)),this;if(l=="paused".slice(0,-1))return this;b.data("is_typing",1);e(l,"o")&&(a=l);if(/t\-/.test(b.attr("class")))return this;if("add"==l&&b.data().t){var t=a;a=c.extend({},b.data());var G=b=c(":first",b),H=e(a.typing,"f");t="<"+a.tag+' class="typing-add">'+t+""}else{"add"==l&&(l=a,a={});a=c.extend({t:!0,delay:!1,speed:50,speed_vary:!1,caret:"\u258e",tag:"span",blink:!0,beep:!1,blink_perm:!1,repeat:-3,pause_on_click:!1,pause_on_tab_switch:0,wrap:!1,mistype:!1,locale:"en",init:!1,typing:!1,fin:!1},a?a:b.data());t=x=!1;var d,I;b.data().t||(b.wrapInner(c("<"+a.tag+"/>",{"class":"t-container",style:"top:auto;bottom:auto;"})),/^[ar]/.test(b.css("position"))||b.css({position:"relative"}),b.css({overflow:"hidden"}));a.wrap&&!b.parent().data().t_wrap&&(b.wrap(c("
",/[.#]/.test(a.wrap[0])?"#"==a.wrap[0]?{id:a.wrap.substr(1)}:{"class":a.wrap.substr(1)}:{style:a.wrap})),b.parent().data("t_wrap",1));e(a.beep,"b")||(a.beep=!1);!0===a.beep&&e(c("html").data().__TAC,"u")&&(c("html").data("__TAC",__TAC=(window.AudioContext=window.AudioContext||window.webkitAudioContext)?new AudioContext:!1),__TAC||(a.beep=!1));!1===a.repeat&&(a.repeat=-3);!0===a.blink&&(a.blink=3*a.speed);e(a.blink)&&100>a.blink&&(a.blink=100);!0===a.caret&&(a.caret="\u258e");e(a.caret,"s")&&!c(".t-caret",b)[0]&&(!e(a.blink)&&(a.blink=!1),x=c("<"+a.tag+"/>",{"class":"t-caret",html:a.caret}).appendTo(b),a.blink&&b.append("\u200b")&&b.data("bi",setInterval(function(){if(0==r.length)return clearInterval(r.data("bi"));++D>=r.data().blink/10&&(D=0,(r.data().blinking|(v="h"==x.css("visibility")[0])||a.blink_perm)&&x.css({visibility:v?"visible":"hidden"}))},10)));a.blink||b.data().bi&&clearInterval(b.data().bi)&&b.removeData("bi");!e(a.blink_perm,"b")&&(a.blink_perm=!0);a.speed=!e(a.speed)||10>a.speed?10:a.speed;a.speed_vary&&(a.speed/=2.5);1/i.test(g=String(t||g))&&b.parent().data("kbd",j_=1)&&b.parent().data("mistype",b.parent().data("mistype")?_j=b.parent().data().mistype:_j=10)&&(a.mistype=_j)&&(a.kbd=j_?j_:!1);g=g.replace(/(.*?)[\u200b]+$/,"$1").replace(//g,"$1").replace(/([^0-9])<\/ins>/g,"$1").replace(/<(embed|command|col|wbr|img|br|input|hr|area|source|track|keygen|param)(.*?)[\/]?>/g,"<#$1$2/>").replace(/\s*(\d*[.]?\d*)\s*(<\/ins>)/g,'').replace(/([\s\S]*?)(<\/ins>)/g,function(a,b,c){return"<#ins"+b+">"+c.replace(/<(?!#)/g,"<#")+"<#/ins>"+(c?"":"")}).replace(/<(del.*?data-del=")(.*?)(".*?)><\/(del>)/g,"<#$1$2$3><#/$4$2([\s\S]*?)<\/del>/g,function(a,b,c,d){n=(n=c.match(/\s*(.*?)\s*<\/s>/i))&&n[0]?' data-s="'+(n[1]||"1")+'"':"";u=(u=c.match(/data-ins="(.*?)"/))&&u[1]?u[1]:""==n?.25:.75;c=c.replace(/(.*?<\/s>|<[\/]?.*?>)/g,"");return"'+("*"!=c?c:"")+""}).replace(/\s*(\d+)\s*<\/s>/g,'').replace(/<(\w+)(.*?)>/g,"<$1$2><#/$1>").replace(/<\/(\w+)>/g," ($1)").replace(/<[#]+/g,"<").replace(/(\/del>)\*[\s\S]*?<\/ins>|<[^<]+\/>|<\/> \(\w+\)|<[\s\S]+?><\/\w+>|&[#x]?[a-z0-9]+;|\r|\n|\t|\S|\s/ig);!e(d)&&(d=g.shift());g.push("\u200b");"de"==a.locale&&(z='12qwertzuiop\u00fc+asdfghjkl\u00f6\u00e4#=m.data("speed")/10)if(B=0,m.data("paused"))y=1;else if(!p){p=!p;if(e(d)){if(0<--d){p=!p;A(.25>=b.data().ins?0:1==y?y=-1:1);return}d=b.data().ins?"":g.shift()}else if(a.speed_vary&&~~(4*Math.random())){p=!p;return}A(0);if(b.data().del&&(!0===m.data().beep&&f.beep(),b.data().s&&!d[0]&&b.text(""),w=String(b.data().del),!e(d,"a")&&"/"==d[1]&&(d=w.replace(/\\n/g,"\n").split([])),e(d,"a"))){if(y=d.pop()){b.data().s?b.html(d.join([])+""+b.data().del.substr(d.length)+""):b.text(d.join([]));p=!p;return}"*"==w&&(G.wrapInner(c("<"+a.tag+"/>",{"class":"typing-0",style:"display:none;"})),b=b.parent(),t&&(g=c.merge(["<"+a.tag+' class="typing-add">"],g,[""]),b=b.parent()));b=b.parent();"\u200b"==w&&b.find(":last").remove();d=""}for(;"/"==d[1];)b=b.parent(),d=g.shift()||"";for(;;)if(!0===m.data().beep&&f.beep(),b.append(d),H&&a.typing(m,d,F(),K),!/[\s\S]+d.charCodeAt(0)?z[__].toUpperCase():z[__],"",d],g),d=''),d&&"/"==d[1]&&b.data().ins&&(d=~~(1E3*Number(b.data().ins)/m.data().speed)),p=!p):(clearInterval(I),m.removeData(["is_typing","paused","ti"]),e(a.repeat)&&--a.repeat,-1*");if(b.data().is_typing)return l=="paused".slice(0,-1)&&(b.data("paused",e(a,"b")?oo_=a:b.data("paused")?oo_=!1:oo_=!0),b.data().blink&&b.data("blinking",oo_)),this;if(l=="paused".slice(0,-1))return this;b.data("is_typing",1);e(l,"o")&&(a=l);if(/t\-/.test(b.attr("class")))return this;if("add"==l&&b.data().t){var t=a;a=c.extend({},b.data());var G=b=c(":first",b),H=e(a.typing,"f");t="<"+a.tag+' class="typing-add">'+t+""}else{"add"==l&&(l=a,a={});a=c.extend({t:!0,delay:!1,speed:50,speed_vary:!1,caret:"\u258e",tag:"span",blink:!0,beep:!1,blink_perm:!1,repeat:-3,pause_on_click:!1,pause_on_tab_switch:0,wrap:!1,mistype:!1,locale:"en",init:!1,typing:!1,fin:!1},a?a:b.data());t=x=!1;var d,I;b.data().t||(b.wrapInner(c("<"+a.tag+"/>",{"class":"t-container",style:"top:auto;bottom:auto;"})),/^[ar]/.test(b.css("position"))||b.css({position:"relative"}),b.css({overflow:"hidden"}));a.wrap&&!b.parent().data().t_wrap&&(b.wrap(c("
",/[.#]/.test(a.wrap[0])?"#"==a.wrap[0]?{id:a.wrap.substr(1)}:{"class":a.wrap.substr(1)}:{style:a.wrap})),b.parent().data("t_wrap",1));e(a.beep,"b")||(a.beep=!1);!0===a.beep&&e(c("html").data().__TAC,"u")&&(c("html").data("__TAC",__TAC=(window.AudioContext=window.AudioContext||window.webkitAudioContext)?new AudioContext:!1),__TAC||(a.beep=!1));!1===a.repeat&&(a.repeat=-3);!0===a.blink&&(a.blink=3*a.speed);e(a.blink)&&100>a.blink&&(a.blink=100);!0===a.caret&&(a.caret="\u258e");e(a.caret,"s")&&!c(".t-caret",b)[0]&&(!e(a.blink)&&(a.blink=!1),x=c("<"+a.tag+"/>",{"class":"t-caret",html:a.caret}).appendTo(b),a.blink&&b.append("\u200b")&&b.data("bi",setInterval(function(){if(0==r.length)return clearInterval(r.data("bi"));++D>=r.data().blink/10&&(D=0,(r.data().blinking|(v="h"==x.css("visibility")[0])||a.blink_perm)&&x.css({visibility:v?"visible":"hidden"}))},10)));a.blink||b.data().bi&&clearInterval(b.data().bi)&&b.removeData("bi");!e(a.blink_perm,"b")&&(a.blink_perm=!0);a.speed=!e(a.speed)||10>a.speed?10:a.speed;a.speed_vary&&(a.speed/=2.5);1/i.test(g=String(t||g))&&b.parent().data("kbd",j_=1)&&b.parent().data("mistype",b.parent().data("mistype")?_j=b.parent().data().mistype:_j=10)&&(a.mistype=_j)&&(a.kbd=j_?j_:!1);g=g.replace(/(.*?)[\u200b]+$/,"$1").replace(//g,"$1").replace(/([^0-9])<\/ins>/g,"$1").replace(/<(embed|command|col|wbr|img|br|input|hr|area|source|track|keygen|param)(.*?)[\/]?>/g,"<#$1$2/>").replace(/\s*(\d*[.]?\d*)\s*(<\/ins>)/g,'').replace(/([\s\S]*?)(<\/ins>)/g,function(a,b,c){return"<#ins"+b+">"+c.replace(/<(?!#)/g,"<#")+"<#/ins>"+(c?"":"")}).replace(/<(del.*?data-del=")(.*?)(".*?)><\/(del>)/g,"<#$1$2$3><#/$4$2([\s\S]*?)<\/del>/g,function(a,b,c,d){n=(n=c.match(/\s*(.*?)\s*<\/s>/i))&&n[0]?' data-s="'+(n[1]||"1")+'"':"";u=(u=c.match(/data-ins="(.*?)"/))&&u[1]?u[1]:""==n?.25:.75;c=c.replace(/(.*?<\/s>|<[\/]?.*?>)/g,"");return"'+("*"!=c?c:"")+""}).replace(/\s*(\d+)\s*<\/s>/g,'').replace(/<(\w+)(.*?)>/g,"<$1$2><#/$1>").replace(/<\/(\w+)>/g," ($1)").replace(/<[#]+/g,"<").replace(/(\/del>)\*[\s\S]*?<\/ins>|<[^<]+\/>|<\/> \(\w+\)|<[\s\S]+?><\/\w+>|&[#x]?[a-z0-9]+;|\r|\n|\t|\S|\s/ig);!e(d)&&(d=g.shift());g.push("\u200b");"de"==a.locale&&(z='12qwertzuiop\u00fc+asdfghjkl\u00f6\u00e4#=m.data("speed")/10)if(B=0,m.data("paused"))y=1;else if(!p){p=!p;if(e(d)){if(0<--d){p=!p;A(.25>=b.data().ins?0:1==y?y=-1:1);return}d=b.data().ins?"":g.shift()}else if(a.speed_vary&&~~(4*Math.random())){p=!p;return}A(0);if(b.data().del&&(!0===m.data().beep&&f.beep(),b.data().s&&!d[0]&&b.text(""),w=String(b.data().del),!e(d,"a")&&"/"==d[1]&&(d=w.replace(/\\n/g,"\n").split([])),e(d,"a"))){if(y=d.pop()){b.data().s?b.html(d.join([])+""+b.data().del.substr(d.length)+""):b.text(d.join([]));p=!p;return}"*"==w&&(G.wrapInner(c("<"+a.tag+"/>",{"class":"typing-0",style:"display:none;"})),b=b.parent(),t&&(g=c.merge(["<"+a.tag+' class="typing-add">"],g,[""]),b=b.parent()));b=b.parent();"\u200b"==w&&b.find(":last").remove();d=""}for(;"/"==d[1];)b=b.parent(),d=g.shift()||"";for(;;)if(!0===m.data().beep&&f.beep(),b.append(d),H&&a.typing(m,d,F(),K),!/[\s\S]+d.charCodeAt(0)?z[__].toUpperCase():z[__],"",d],g),d=''),d&&"/"==d[1]&&b.data().ins&&(d=~~(1E3*Number(b.data().ins)/m.data().speed)),p=!p):(clearInterval(I),m.removeData(["is_typing","paused","ti"]),e(a.repeat)&&--a.repeat,-1