whisper.cat/weboasis/text/js/replace-smart-straight-quotes.js

1 line
5.2 KiB
JavaScript
Raw Normal View History

2023-10-05 23:28:32 +11:00
var _$_5f68=["\x23\x69\x6E\x70\x75\x74\x5F\x6F\x75\x74\x70\x75\x74","\x74\x61\x5F\x65\x78\x61\x6D\x70\x6C\x65\x73","\x27\x27\x27","\x22","\x27","\u2032","\u2033","\u2034","\x24\x31\u2019","\u2019\x24\x32\x24\x33","\x24\x31\u2019\x24\x33","\x24\x31\u2019\x24\x32","\x24\x31\u2018\x24\x32","\x24\x31\u201D","\x24\x31\u201D\x24\x32","\x24\x31\u201C\x24\x32","\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","\x22\x42\x65\x20\x74\x68\x65\x72\x65\x20\x61\x74\x20\x32\x20\x6F\x27\x63\x6C\x6F\x63\x6B\x20\x62\x79\x20\x74\x68\x65\x20\x66\x6F\x75\x6E\x74\x61\x69\x6E\x20\x64\x6F\x77\x6E\x20\x74\x68\x65\x20\x72\x6F\x61\x64\x2E\x22","\x0A","\x23\x73\x65\x74\x74\x69\x6E\x67\x73","\x53\x6D\x61\x72\x74\x20\x71\x75\x6F\x74\x65\x73\x20\x72\x65\x70\x6C\x61\x63\x65\x64","\x53\x74\x72\x61\x69\x67\x68\x74\x20\x71\x75\x6F\x74\x65\x73\x20\x72\x65\x70\x6C\x61\x63\x65\x64","\x23\x72\x65\x70\x6C\x61\x63\x65\x51\x75\x6F\x74\x65\x73","\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","\x63\x68\x61\x6E\x67\x65","\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=$(_$_5f68[0]),examples=JSON.parse(localStorage.getItem(_$_5f68[1]));function StraightenQuotes(a){return a.replace(/|/g,_$_5f68[4]).replace(/“|”/g,_$_5f68[3]).replace(//g,_$_5f68[4]).replace(/″/g,_$_5f68[3]).replace(/‴/g,_$_5f68[2])}function SmartenQuotes(a){return a.replace(/(\W|^)"(\S)/g,_$_5f68[15]).replace(/(“[^"]*)"([^"]*$|[^“"]*“)/g,_$_5f68[14]).replace(/([^0-9])"/g,_$_5f68[13]).replace(/(\W|^)'(\S)/g,_$_5f68[12]).replace(/([a-z])'([a-z])/gi,_$_5f68[11]).replace(/(([^']*)|[a-z])'([^0-9]|$)/gi,_$_5f68[10]).replace(/()([0-9]{2}[^]*)(([^0-9]|$)|$|[a-z])/gi,_$_5f68[9]).replace(/(\B|^)(?=([^]*\b)*([^]*\W[]\b|[^]*$))/gi,_$_5f68[8]).replace(/'''/g,_$_5f68[7]).replace(/("|'')/g,_$_5f68[6]).replace(/'/g,_$_5f68[5])}function loadText(){var a=$(_$_5f68[17])[_$_5f68[16]](0).files[0],b= new FileReader;b.onload= function(a){var b=a.target.result;area.val(b)},b.readAsText(a,_$_5f68[18])}function saveText(a,b){var c=navigator.userAgent.match(/MSIE\s([\d.]+)/),g=navigator.userAgent.match(/Trident\/7.0/)&& navigator.userAgent.match(/rv:11/),j=navigator.userAgent.match(/Edge/g),h=c?c[1]:g?11:j?12:-1;if(c&& h< 10){console.log(_$_5f68[19])}else {b= (b= document.getElementById(_$_5f68[21]).value).replace(/\r?\n/g,_$_5f68[20]);var d= new Blob([b],{type:_$_5f68[22]});if(_$_5f68[23]!= (a= prompt(_$_5f68[24],_$_5f68[25])+ _$_5f68[26])){if(h> -1){window.navigator.msSaveBlob(d,a)}else {var f=document.createElement(_$_5f68[27]);f.download= a,f.href= window.URL.createObjectURL(d),f.onclick= function(a){document.body.removeChild(a.target)},f.style.display= _$_5f68[28],document.body.appendChild(f),f.click()}}}}function printTextArea(){childWindow= window.open(_$_5f68[29],_$_5f68[30],_$_5f68[31]),childWindow.document.open(),childWindow.document.write(_$_5f68[32]),childWindow.document.write(document.getElementById(_