whisper.cat/weboasis/text/js/add-line-numbers.js
2023-10-05 23:28:32 +11:00

1 line
8.8 KiB
JavaScript

var _$_acf0=["\x23\x69\x6E\x70\x75\x74\x5F\x6F\x75\x74\x70\x75\x74","\x74\x61\x5F\x65\x78\x61\x6D\x70\x6C\x65\x73","","\x43","\x43\x43","\x43\x43\x43","\x43\x44","\x44","\x44\x43","\x44\x43\x43","\x44\x43\x43\x43","\x43\x4D","\x58","\x58\x58","\x58\x58\x58","\x58\x4C","\x4C","\x4C\x58","\x4C\x58\x58","\x4C\x58\x58\x58","\x58\x43","\x49","\x49\x49","\x49\x49\x49","\x49\x56","\x56","\x56\x49","\x56\x49\x49","\x56\x49\x49\x49","\x49\x58","\x4D","\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A","\x67\x65\x74","\x23\x66\x69\x6C\x65\x5F\x75\x70\x6C\x6F\x61\x64","\x55\x54\x46\x2D\x38","\x4E\x6F\x20\x62\x6C\x6F\x62\x73\x20\x6F\x6E\x20\x49\x45\x20\x76\x65\x72\x3C\x31\x30","\x0D\x0A","\x69\x6E\x70\x75\x74\x5F\x6F\x75\x74\x70\x75\x74","\x74\x65\x78\x74\x2F\x70\x6C\x61\x69\x6E","\x6E\x75\x6C\x6C\x2E\x74\x78\x74","\x46\x69\x6C\x65\x20\x6E\x61\x6D\x65\x3A","\x4E\x65\x77\x20\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x2E\x74\x78\x74","\x61","\x6E\x6F\x6E\x65","\x63\x68\x69\x6C\x64\x57\x69\x6E\x64\x6F\x77","\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x3D\x79\x65\x73\x2C\x20\x6D\x65\x6E\x75\x62\x61\x72\x3D\x79\x65\x73\x2C\x20\x74\x6F\x6F\x6C\x62\x61\x72\x3D\x79\x65\x73","\x3C\x68\x74\x6D\x6C\x3E\x3C\x68\x65\x61\x64\x3E\x3C\x2F\x68\x65\x61\x64\x3E\x3C\x62\x6F\x64\x79\x3E","\x3C\x62\x72\x3E","\x3C\x2F\x62\x6F\x64\x79\x3E\x3C\x2F\x68\x74\x6D\x6C\x3E","\x54\x68\x65\x20\x71\x75\x69\x63\x6B\x20\x62\x72\x6F\x77\x6E\x20\x66\x6F\x78\x20\x6A\x75\x6D\x70\x73\x20\x6F\x76\x65\x72\x20\x74\x68\x65\x20\x6C\x61\x7A\x79\x20\x64\x6F\x67\x2E\x0A\x54\x68\x65\x20\x71\x75\x69\x63\x6B\x20\x62\x72\x6F\x77\x6E\x20\x66\x6F\x78\x20\x6A\x75\x6D\x70\x73\x20\x6F\x76\x65\x72\x20\x74\x68\x65\x20\x6C\x61\x7A\x79\x20\x64\x6F\x67\x2E\x0A\x54\x68\x65\x20\x71\x75\x69\x63\x6B\x20\x62\x72\x6F\x77\x6E\x20\x66\x6F\x78\x20\x6A\x75\x6D\x70\x73\x20\x6F\x76\x65\x72\x20\x74\x68\x65\x20\x6C\x61\x7A\x79\x20\x64\x6F\x67\x2E\x0A\x54\x68\x65\x20\x71\x75\x69\x63\x6B\x20\x62\x72\x6F\x77\x6E\x20\x66\x6F\x78\x20\x6A\x75\x6D\x70\x73\x20\x6F\x76\x65\x72\x20\x74\x68\x65\x20\x6C\x61\x7A\x79\x20\x64\x6F\x67\x2E","\x23\x73\x65\x74\x74\x69\x6E\x67\x73","\x23\x6E\x75\x6D\x50\x72\x65\x66\x69\x78","\x23\x6E\x75\x6D\x53\x75\x66\x66\x69\x78","\x23\x6E\x75\x6D\x53\x74\x61\x72\x74","\x2E\x61\x6C\x65\x72\x74","\x0A","\x63\x68\x65\x63\x6B\x65\x64","\x23\x75\x70\x70\x65\x72\x43\x61\x73\x65","\x45\x72\x72\x6F\x72\x3A\x20\x22","\x22\x20\x69\x73\x20\x6E\x6F\x74\x20\x61\x20\x76\x61\x6C\x69\x64\x20\x72\x6F\x6D\x61\x6E\x20\x6E\x75\x6D\x65\x72\x61\x6C\x2E","\x22\x20\x69\x73\x20\x6E\x6F\x74\x20\x61\x20\x76\x61\x6C\x69\x64\x20\x73\x74\x61\x72\x74\x69\x6E\x67\x20\x6C\x65\x74\x74\x65\x72\x2E","\x41\x70\x70\x6C\x69\x65\x64","\x23\x61\x64\x64\x4C\x69\x6E\x65\x4E\x75\x6D","\x63\x68\x61\x6E\x67\x65","\x76\x61\x6C\x75\x65","\x31","\x74\x79\x70\x65","\x6E\x75\x6D\x62\x65\x72","\x23\x75\x70\x70\x65\x72\x2D\x63\x61\x73\x65","\x74\x65\x78\x74","\x69","\x41","\x2E\x63\x6C\x69\x70\x62\x6F\x61\x72\x64","\x23\x63\x6C\x65\x61\x72\x41\x6C\x6C\x2C\x20\x23\x65\x64\x69\x74\x5F\x64\x65\x6C\x65\x74\x65\x2C\x20\x23\x66\x69\x6C\x65\x5F\x6E\x65\x77","\x23\x66\x69\x6C\x65\x5F\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x23\x66\x69\x6C\x65\x5F\x70\x72\x69\x6E\x74","\x23\x65\x64\x69\x74\x5F\x75\x6E\x64\x6F","\x23\x65\x64\x69\x74\x5F\x72\x65\x64\x6F","\x23\x65\x64\x69\x74\x5F\x63\x6F\x70\x79","\x23\x65\x64\x69\x74\x5F\x73\x65\x6C\x65\x63\x74"];var area=$(_$_acf0[0]),examples=JSON.parse(localStorage.getItem(_$_acf0[1]));function Romanize(b){if(!+b){return !1};for(var g=String(+b).split(_$_acf0[2]),a=[_$_acf0[2],_$_acf0[3],_$_acf0[4],_$_acf0[5],_$_acf0[6],_$_acf0[7],_$_acf0[8],_$_acf0[9],_$_acf0[10],_$_acf0[11],_$_acf0[2],_$_acf0[12],_$_acf0[13],_$_acf0[14],_$_acf0[15],_$_acf0[16],_$_acf0[17],_$_acf0[18],_$_acf0[19],_$_acf0[20],_$_acf0[2],_$_acf0[21],_$_acf0[22],_$_acf0[23],_$_acf0[24],_$_acf0[25],_$_acf0[26],_$_acf0[27],_$_acf0[28],_$_acf0[29]],f=_$_acf0[2],c=3;c--;){f= (a[+g.pop()+ 10* c] || _$_acf0[2]) + f};return Array(+g.join(_$_acf0[2])+ 1).join(_$_acf0[30])+ f}function Deromanize(b){var g,a=/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,f={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},c=0;if(!(b= b.toUpperCase())|| !/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(b)){return !1};for(;g= a.exec(b);){c+= f[g[0]]};return c}function LettertoNum(b){var g,a,f=_$_acf0[31],c=0;for(g= 0,a= b.length- 1;g< b.length;g+= 1,a-= 1){c+= Math.pow(f.length,a)* (f.indexOf(b[g])+ 1)};return c}function NumtoLetter(b){for(var g,a=_$_acf0[2];b> 0;){g= (b- 1)% 26,a= String.fromCharCode(65+ g)+ a,b= (b- g)/ 26| 0};return a|| void(0)}function loadText(){var b=$(_$_acf0[33])[_$_acf0[32]](0).files[0],g= new FileReader;g.onload= function(b){var g=b.target.result;area.val(g)},g.readAsText(b,_$_acf0[34])}function saveText(b,g){var a=navigator.userAgent.match(/MSIE\s([\d.]+)/),f=navigator.userAgent.match(/Trident\/7.0/)&& navigator.userAgent.match(/rv:11/),c=navigator.userAgent.match(/Edge/g),d=a?a[1]:f?11:c?12:-1;if(a&& d< 10){console.log(_$_acf0[35])}else {g= (g= document.getElementById(_$_acf0[37]).value).replace(/\r?\n/g,_$_acf0[36]);var h= new Blob([g],{type:_$_acf0[38]});if(_$_acf0[39]!= (b= prompt(_$_acf0[40],_$_acf0[41])+ _$_acf0[42])){if(d> -1){window.navigator.msSaveBlob(h,b)}else {var j=document.createElement(_$_acf0[43]);j.download= b,j.href= window.URL.createObjectURL(h),j.onclick= function(b){document.body.removeChild(b.target)},j.style.display= _$_acf0[44],document.body.appendChild(j),j.click()}}}}function printTextArea(){childWindow= window.open(_$_acf0[2],_$_acf0[45],_$_acf0[46]),childWindow.document.open(),childWindow.document.write(_$_acf0[47]),childWindow.document.write(document.getElementById(_$_acf0[37]).value.replace(/\n/gi,_$_acf0[48])),childWindow.document.write(_$_acf0[49]),childWindow.print(),childWindow.document.close(),childWindow.close()}1== examples&& area.val(_$_acf0[50]),$(_$_acf0[63]).click(function(){Remember();var b=area.val(),g=$(_$_acf0[51]).val(),a=$(_$_acf0[52]).val(),f=$(_$_acf0[53]).val(),c=$(_$_acf0[54]).val().replace(/\s/g,_$_acf0[2]);$(_$_acf0[55]).hide(),b= b.replace(/\r\n|\r|\n/gm,_$_acf0[56]).split(_$_acf0[56]);var d=0;if(1== g){for(d= 0;d< b.length;d++){1== g?b[d]= a+ c+ f+ b[d]:2== g&& (b[d]= a+ Romanize(c)+ f+ b[d]),c++}}else {if(2== g){if((c= c.toUpperCase()).match(/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/)){for(c= Deromanize(c),d= 0;d< b.length;d++){$(_$_acf0[58]).prop(_$_acf0[57])?b[d]= a+ Romanize(c).toUpperCase()+ f+ b[d]:b[d]= a+ Romanize(c).toLowerCase()+ f+ b[d],c++};$(_$_acf0[55]).hide()}else {Alert(_$_acf0[59]+ c+ _$_acf0[60])}}else {if(3== g){if(c.match(/[a-zA-Z]/)){for(c= LettertoNum(c= c.toUpperCase()),d= 0;d< b.length;d++){$(_$_acf0[58]).prop(_$_acf0[57])?b[d]= a+ NumtoLetter(c).toUpperCase()+ f+ b[d]:b[d]= a+ NumtoLetter(c).toLowerCase()+ f+ b[d],c++};$(_$_acf0[55]).hide()}else {Alert(_$_acf0[59]+ c+ _$_acf0[61])}}}};b= b.join(_$_acf0[56]),Toast(_$_acf0[62]),area.val(b),Remember()}),$(_$_acf0[51]).on(_$_acf0[64],function(){var b=$(_$_acf0[51]).val();1== b?($(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[68]).attr(_$_acf0[65],_$_acf0[66]).val(1),$(_$_acf0[69]).hide()):2== b?($(_$_acf0[58]).prop(_$_acf0[57])?$(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[21]).val(_$_acf0[21]):$(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[71]).val(_$_acf0[71]),$(_$_acf0[69]).show()):3== b&& ($(_$_acf0[58]).prop(_$_acf0[57])?$(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[72]).val(_$_acf0[72]):$(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[43]).val(_$_acf0[43]),$(_$_acf0[69]).show())}),$(_$_acf0[58]).change(function(){var b=$(_$_acf0[51]).val();this.checked?2== b?$(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[21]).val(_$_acf0[21]):3== b&& $(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[72]).val(_$_acf0[72]):2== b?$(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[71]).val(_$_acf0[71]):3== b&& $(_$_acf0[54]).attr(_$_acf0[67],_$_acf0[70]).attr(_$_acf0[65],_$_acf0[43]).val(_$_acf0[43])}),$(_$_acf0[73]).click(function(){Clipboard(area)}),$(_$_acf0[74]).click(function(){area.val(_$_acf0[2]),Remember()}),$(_$_acf0[33]).on(_$_acf0[64],function(){loadText()}),$(_$_acf0[75]).click(function(){saveText()}),$(_$_acf0[76]).click(function(){printTextArea()}),$(_$_acf0[77]).click(function(){var b=History.undo();void(0)!== b&& area.val(b)}),$(_$_acf0[78]).click(function(){var b=History.redo();void(0)!== b&& area.val(b)}),$(_$_acf0[79]).click(function(){Clipboard(area)}),$(_$_acf0[80]).click(function(){area.select().focus()});var History=function(){var b=[],g=0;return {remember:function(a){b[g- 1]!== a&& (b.splice(g,10),b.push(a),b.splice(0,b.length- 10),g= b.length)},undo:function(){if(g> 1){return b[--g- 1]}},redo:function(){if(g< b.length){return b[g++]}}}}();function Remember(){var b=area.val();History.remember(b)}Remember()