This repository has been archived on 2023-11-19. You can view files and clone it, but cannot push or open issues or pull requests.
goober-bb10/assets/parser.js

365 lines
14 KiB
JavaScript
Raw Normal View History

/*
* Copyright (C) 2016-2017 Morgan McMillian <gilag@monkeystew.com>
*
* This file is apart of the Goober application, a client for pnut.io
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function parsePostData(t) {
t = t.replace(/&#033;/g,"\u0021");
t = t.replace(/&#034;/g,"\u0022");
t = t.replace(/&#035;/g,"\u0023");
t = t.replace(/&#036;/g,"\u0024");
t = t.replace(/&#037;/g,"\u0025");
t = t.replace(/&#038;/g,"\u0026");
t = t.replace(/&#039;/g,"\u0027");
t = t.replace(/&#040;/g,"\u0028");
t = t.replace(/&#041;/g,"\u0029");
t = t.replace(/&#042;/g,"\u002A");
t = t.replace(/&#043;/g,"\u002B");
t = t.replace(/&#044;/g,"\u002C");
t = t.replace(/&#045;/g,"\u002D");
t = t.replace(/&#046;/g,"\u002E");
t = t.replace(/&#047;/g,"\u002F");
t = t.replace(/&#048;/g,"\u0030");
t = t.replace(/&#049;/g,"\u0031");
t = t.replace(/&#050;/g,"\u0032");
t = t.replace(/&#051;/g,"\u0033");
t = t.replace(/&#052;/g,"\u0034");
t = t.replace(/&#053;/g,"\u0035");
t = t.replace(/&#054;/g,"\u0036");
t = t.replace(/&#055;/g,"\u0037");
t = t.replace(/&#056;/g,"\u0038");
t = t.replace(/&#057;/g,"\u0039");
t = t.replace(/&#058;/g,"\u003A");
t = t.replace(/&#059;/g,"\u003B");
t = t.replace(/&#060;/g,"\u003C");
t = t.replace(/&#061;/g,"\u003D");
t = t.replace(/&#062;/g,"\u003E");
t = t.replace(/&#063;/g,"\u003F");
t = t.replace(/&#064;/g,"\u0040");
t = t.replace(/&#065;/g,"\u0041");
t = t.replace(/&#066;/g,"\u0042");
t = t.replace(/&#067;/g,"\u0043");
t = t.replace(/&#068;/g,"\u0044");
t = t.replace(/&#069;/g,"\u0045");
t = t.replace(/&#070;/g,"\u0046");
t = t.replace(/&#071;/g,"\u0047");
t = t.replace(/&#072;/g,"\u0048");
t = t.replace(/&#073;/g,"\u0049");
t = t.replace(/&#074;/g,"\u004A");
t = t.replace(/&#075;/g,"\u004B");
t = t.replace(/&#076;/g,"\u004C");
t = t.replace(/&#077;/g,"\u004D");
t = t.replace(/&#078;/g,"\u004E");
t = t.replace(/&#079;/g,"\u004F");
t = t.replace(/&#080;/g,"\u0050");
t = t.replace(/&#081;/g,"\u0051");
t = t.replace(/&#082;/g,"\u0052");
t = t.replace(/&#083;/g,"\u0053");
t = t.replace(/&#084;/g,"\u0054");
t = t.replace(/&#085;/g,"\u0055");
t = t.replace(/&#086;/g,"\u0056");
t = t.replace(/&#087;/g,"\u0057");
t = t.replace(/&#088;/g,"\u0058");
t = t.replace(/&#089;/g,"\u0059");
t = t.replace(/&#090;/g,"\u005A");
t = t.replace(/&#091;/g,"\u005B");
t = t.replace(/&#092;/g,"\u005C");
t = t.replace(/&#093;/g,"\u005D");
t = t.replace(/&#094;/g,"\u005E");
t = t.replace(/&#095;/g,"\u005F");
t = t.replace(/&#096;/g,"\u0060");
t = t.replace(/&#097;/g,"\u0061");
t = t.replace(/&#098;/g,"\u0062");
t = t.replace(/&#099;/g,"\u0063");
t = t.replace(/&#100;/g,"\u0064");
t = t.replace(/&#101;/g,"\u0065");
t = t.replace(/&#102;/g,"\u0066");
t = t.replace(/&#103;/g,"\u0067");
t = t.replace(/&#104;/g,"\u0068");
t = t.replace(/&#105;/g,"\u0069");
t = t.replace(/&#106;/g,"\u006A");
t = t.replace(/&#107;/g,"\u006B");
t = t.replace(/&#108;/g,"\u006C");
t = t.replace(/&#109;/g,"\u006D");
t = t.replace(/&#110;/g,"\u006E");
t = t.replace(/&#111;/g,"\u006F");
t = t.replace(/&#112;/g,"\u0070");
t = t.replace(/&#113;/g,"\u0071");
t = t.replace(/&#114;/g,"\u0072");
t = t.replace(/&#115;/g,"\u0073");
t = t.replace(/&#116;/g,"\u0074");
t = t.replace(/&#117;/g,"\u0075");
t = t.replace(/&#118;/g,"\u0076");
t = t.replace(/&#119;/g,"\u0077");
t = t.replace(/&#120;/g,"\u0078");
t = t.replace(/&#121;/g,"\u0079");
t = t.replace(/&#122;/g,"\u007A");
t = t.replace(/&#123;/g,"\u007B");
t = t.replace(/&#124;/g,"\u007C");
t = t.replace(/&#125;/g,"\u007D");
t = t.replace(/&#126;/g,"\u007E");
t = t.replace(/&#127;/g,"\u007F");
t = t.replace(/&#128;/g,"\u0080");
t = t.replace(/&#130;/g,"\u0082");
t = t.replace(/&#131;/g,"\u0083");
t = t.replace(/&#132;/g,"\u0084");
t = t.replace(/&#133;/g,"\u0085");
t = t.replace(/&#134;/g,"\u0086");
t = t.replace(/&#135;/g,"\u0087");
t = t.replace(/&#136;/g,"\u0088");
t = t.replace(/&#137;/g,"\u0089");
t = t.replace(/&#138;/g,"\u008A");
t = t.replace(/&#139;/g,"\u008B");
t = t.replace(/&#140;/g,"\u008C");
t = t.replace(/&#141;/g,"\u008D");
t = t.replace(/&#142;/g,"\u008E");
t = t.replace(/&#145;/g,"\u0091");
t = t.replace(/&#146;/g,"\u0092");
t = t.replace(/&#147;/g,"\u0093");
t = t.replace(/&#148;/g,"\u0094");
t = t.replace(/&#149;/g,"\u0095");
t = t.replace(/&#150;/g,"\u0096");
t = t.replace(/&#151;/g,"\u0097");
t = t.replace(/&#152;/g,"\u0098");
t = t.replace(/&#153;/g,"\u0099");
t = t.replace(/&#154;/g,"\u009A");
t = t.replace(/&#155;/g,"\u009B");
t = t.replace(/&#156;/g,"\u009C");
t = t.replace(/&#158;/g,"\u009E");
t = t.replace(/&#159;/g,"\u009F");
t = t.replace(/&#161;/g,"\u00A1");
t = t.replace(/&#162;/g,"\u00A2");
t = t.replace(/&#163;/g,"\u00A3");
t = t.replace(/&#164;/g,"\u00A4");
t = t.replace(/&#165;/g,"\u00A5");
t = t.replace(/&#166;/g,"\u00A6");
t = t.replace(/&#167;/g,"\u00A7");
t = t.replace(/&#168;/g,"\u00A8");
t = t.replace(/&#169;/g,"\u00A9");
t = t.replace(/&#170;/g,"\u00AA");
t = t.replace(/&#171;/g,"\u00AB");
t = t.replace(/&#172;/g,"\u00AC");
t = t.replace(/&#174;/g,"\u00AE");
t = t.replace(/&#175;/g,"\u00AF");
t = t.replace(/&#176;/g,"\u00B0");
t = t.replace(/&#177;/g,"\u00B1");
t = t.replace(/&#178;/g,"\u00B2");
t = t.replace(/&#179;/g,"\u00B3");
t = t.replace(/&#180;/g,"\u00B4");
t = t.replace(/&#181;/g,"\u00B5");
t = t.replace(/&#182;/g,"\u00B6");
t = t.replace(/&#183;/g,"\u00B7");
t = t.replace(/&#184;/g,"\u00B8");
t = t.replace(/&#185;/g,"\u00B9");
t = t.replace(/&#186;/g,"\u00BA");
t = t.replace(/&#187;/g,"\u00BB");
t = t.replace(/&#188;/g,"\u00BC");
t = t.replace(/&#189;/g,"\u00BD");
t = t.replace(/&#190;/g,"\u00BE");
t = t.replace(/&#191;/g,"\u00BF");
t = t.replace(/&#192;/g,"\u00C0");
t = t.replace(/&#193;/g,"\u00C1");
t = t.replace(/&#194;/g,"\u00C2");
t = t.replace(/&#195;/g,"\u00C3");
t = t.replace(/&#196;/g,"\u00C4");
t = t.replace(/&#197;/g,"\u00C5");
t = t.replace(/&#198;/g,"\u00C6");
t = t.replace(/&#199;/g,"\u00C7");
t = t.replace(/&#200;/g,"\u00C8");
t = t.replace(/&#201;/g,"\u00C9");
t = t.replace(/&#202;/g,"\u00CA");
t = t.replace(/&#203;/g,"\u00CB");
t = t.replace(/&#204;/g,"\u00CC");
t = t.replace(/&#205;/g,"\u00CD");
t = t.replace(/&#206;/g,"\u00CE");
t = t.replace(/&#207;/g,"\u00CF");
t = t.replace(/&#208;/g,"\u00D0");
t = t.replace(/&#209;/g,"\u00D1");
t = t.replace(/&#210;/g,"\u00D2");
t = t.replace(/&#211;/g,"\u00D3");
t = t.replace(/&#212;/g,"\u00D4");
t = t.replace(/&#213;/g,"\u00D5");
t = t.replace(/&#214;/g,"\u00D6");
t = t.replace(/&#215;/g,"\u00D7");
t = t.replace(/&#216;/g,"\u00D8");
t = t.replace(/&#217;/g,"\u00D9");
t = t.replace(/&#218;/g,"\u00DA");
t = t.replace(/&#219;/g,"\u00DB");
t = t.replace(/&#220;/g,"\u00DC");
t = t.replace(/&#221;/g,"\u00DD");
t = t.replace(/&#222;/g,"\u00DE");
t = t.replace(/&#223;/g,"\u00DF");
t = t.replace(/&#224;/g,"\u00E0");
t = t.replace(/&#225;/g,"\u00E1");
t = t.replace(/&#226;/g,"\u00E2");
t = t.replace(/&#227;/g,"\u00E3");
t = t.replace(/&#228;/g,"\u00E4");
t = t.replace(/&#229;/g,"\u00E5");
t = t.replace(/&#230;/g,"\u00E6");
t = t.replace(/&#231;/g,"\u00E7");
t = t.replace(/&#232;/g,"\u00E8");
t = t.replace(/&#233;/g,"\u00E9");
t = t.replace(/&#234;/g,"\u00EA");
t = t.replace(/&#235;/g,"\u00EB");
t = t.replace(/&#236;/g,"\u00EC");
t = t.replace(/&#237;/g,"\u00ED");
t = t.replace(/&#238;/g,"\u00EE");
t = t.replace(/&#239;/g,"\u00EF");
t = t.replace(/&#240;/g,"\u00F0");
t = t.replace(/&#241;/g,"\u00F1");
t = t.replace(/&#242;/g,"\u00F2");
t = t.replace(/&#243;/g,"\u00F3");
t = t.replace(/&#244;/g,"\u00F4");
t = t.replace(/&#245;/g,"\u00F5");
t = t.replace(/&#246;/g,"\u00F6");
t = t.replace(/&#247;/g,"\u00F7");
t = t.replace(/&#248;/g,"\u00F8");
t = t.replace(/&#249;/g,"\u00F9");
t = t.replace(/&#250;/g,"\u00FA");
t = t.replace(/&#251;/g,"\u00FB");
t = t.replace(/&#252;/g,"\u00FC");
t = t.replace(/&#253;/g,"\u00FD");
t = t.replace(/&#254;/g,"\u00FE");
t = t.replace(/&#255;/g,"\u00FF");
t = t.replace(/&quot;/g,"\u0022");
t = t.replace(/&lt;3/g, "\u2764");
t = t.replace(/&lt;/g,"\u02C2");
t = t.replace(/&gt;/g,"\u02C3");
t = t.replace(/&euro;/g,"\u0080");
t = t.replace(/&sbquo;/g,"\u0082");
t = t.replace(/&fnof;/g,"\u0083");
t = t.replace(/&bdquo;/g,"\u0084");
t = t.replace(/&hellip;/g,"\u0085");
t = t.replace(/&dagger;/g,"\u0086");
t = t.replace(/&Dagger;/g,"\u0087");
t = t.replace(/&circ;/g,"\u0088");
t = t.replace(/&permil;/g,"\u0089");
t = t.replace(/&Scaron;/g,"\u008A");
t = t.replace(/&lsaquo;/g,"\u008B");
t = t.replace(/&OElig;/g,"\u008C");
t = t.replace(/&lsquo;/g,"\u0091");
t = t.replace(/&rsquo;/g,"\u0092");
t = t.replace(/&ldquo;/g,"\u0093");
t = t.replace(/&rdquo;/g,"\u0094");
t = t.replace(/&bull;/g,"\u0095");
t = t.replace(/&ndash;/g,"\u0096");
t = t.replace(/&mdash;/g,"\u0097");
t = t.replace(/&tilde;/g,"\u0098");
t = t.replace(/&trade;/g,"\u0099");
t = t.replace(/&scaron;/g,"\u009A");
t = t.replace(/&rsaquo;/g,"\u009B");
t = t.replace(/&oelig;/g,"\u009C");
t = t.replace(/&yuml;/g,"\u009F");
t = t.replace(/&iexcl;/g,"\u00A1");
t = t.replace(/&cent;/g,"\u00A2");
t = t.replace(/&pound;/g,"\u00A3");
t = t.replace(/&curren;/g,"\u00A4");
t = t.replace(/&yen;/g,"\u00A5");
t = t.replace(/&brvbar;/g,"\u00A6");
t = t.replace(/&sect;/g,"\u00A7");
t = t.replace(/&uml;/g,"\u00A8");
t = t.replace(/&copy;/g,"\u00A9");
t = t.replace(/&ordf;/g,"\u00AA");
t = t.replace(/&laquo;/g,"\u00AB");
t = t.replace(/&not;/g,"\u00AC");
t = t.replace(/&reg;/g,"\u00AE");
t = t.replace(/&macr;/g,"\u00AF");
t = t.replace(/&deg;/g,"\u00B0");
t = t.replace(/&plusmn;/g,"\u00B1");
t = t.replace(/&sup2;/g,"\u00B2");
t = t.replace(/&sup3;/g,"\u00B3");
t = t.replace(/&acute;/g,"\u00B4");
t = t.replace(/&micro;/g,"\u00B5");
t = t.replace(/&para;/g,"\u00B6");
t = t.replace(/&middot;/g,"\u00B7");
t = t.replace(/&cedil;/g,"\u00B8");
t = t.replace(/&sup1;/g,"\u00B9");
t = t.replace(/&ordm;/g,"\u00BA");
t = t.replace(/&raquo;/g,"\u00BB");
t = t.replace(/&frac14;/g,"\u00BC");
t = t.replace(/&frac12;/g,"\u00BD");
t = t.replace(/&frac34;/g,"\u00BE");
t = t.replace(/&iquest;/g,"\u00BF");
t = t.replace(/&Agrave;/g,"\u00C0");
t = t.replace(/&Aacute;/g,"\u00C1");
t = t.replace(/&Acirc;/g,"\u00C2");
t = t.replace(/&Atilde;/g,"\u00C3");
t = t.replace(/&Auml;/g,"\u00C4");
t = t.replace(/&Aring;/g,"\u00C5");
t = t.replace(/&AElig;/g,"\u00C6");
t = t.replace(/&Ccedil;/g,"\u00C7");
t = t.replace(/&Egrave;/g,"\u00C8");
t = t.replace(/&Eacute;/g,"\u00C9");
t = t.replace(/&Ecirc;/g,"\u00CA");
t = t.replace(/&Euml;/g,"\u00CB");
t = t.replace(/&Igrave;/g,"\u00CC");
t = t.replace(/&Iacute;/g,"\u00CD");
t = t.replace(/&Icirc;/g,"\u00CE");
t = t.replace(/&Iuml;/g,"\u00CF");
t = t.replace(/&ETH;/g,"\u00D0");
t = t.replace(/&Ntilde;/g,"\u00D1");
t = t.replace(/&Ograve;/g,"\u00D2");
t = t.replace(/&Oacute;/g,"\u00D3");
t = t.replace(/&Ocirc;/g,"\u00D4");
t = t.replace(/&Otilde;/g,"\u00D5");
t = t.replace(/&Ouml;/g,"\u00D6");
t = t.replace(/&times;/g,"\u00D7");
t = t.replace(/&Oslash;/g,"\u00D8");
t = t.replace(/&Ugrave;/g,"\u00D9");
t = t.replace(/&Uacute;/g,"\u00DA");
t = t.replace(/&Ucirc;/g,"\u00DB");
t = t.replace(/&Uuml;/g,"\u00DC");
t = t.replace(/&Yacute;/g,"\u00DD");
t = t.replace(/&THORN;/g,"\u00DE");
t = t.replace(/&szlig;/g,"\u00DF");
t = t.replace(/&agrave;/g,"\u00E0");
t = t.replace(/&aacute;/g,"\u00E1");
t = t.replace(/&acirc;/g,"\u00E2");
t = t.replace(/&atilde;/g,"\u00E3");
t = t.replace(/&auml;/g,"\u00E4");
t = t.replace(/&aring;/g,"\u00E5");
t = t.replace(/&aelig;/g,"\u00E6");
t = t.replace(/&ccedil;/g,"\u00E7");
t = t.replace(/&egrave;/g,"\u00E8");
t = t.replace(/&eacute;/g,"\u00E9");
t = t.replace(/&ecirc;/g,"\u00EA");
t = t.replace(/&euml;/g,"\u00EB");
t = t.replace(/&igrave;/g,"\u00EC");
t = t.replace(/&iacute;/g,"\u00ED");
t = t.replace(/&icirc;/g,"\u00EE");
t = t.replace(/&iuml;/g,"\u00EF");
t = t.replace(/&eth;/g,"\u00F0");
t = t.replace(/&ntilde;/g,"\u00F1");
t = t.replace(/&ograve;/g,"\u00F2");
t = t.replace(/&oacute;/g,"\u00F3");
t = t.replace(/&ocirc;/g,"\u00F4");
t = t.replace(/&otilde;/g,"\u00F5");
t = t.replace(/&ouml;/g,"\u00F6");
t = t.replace(/&divide;/g,"\u00F7");
t = t.replace(/&oslash;/g,"\u00F8");
t = t.replace(/&ugrave;/g,"\u00F9");
t = t.replace(/&uacute;/g,"\u00FA");
t = t.replace(/&ucirc;/g,"\u00FB");
t = t.replace(/&uuml;/g,"\u00FC");
t = t.replace(/&yacute;/g,"\u00FD");
t = t.replace(/&thorn;/g,"\u00FE");
t = t.replace(/&yuml;/g,"\u00FF");
t = t.replace(/<br>/g,"<br/>");
t = t.replace(/(?!&amp;)&/g, "&amp;");
return t;
};