/* * Copyright (C) 2016-2017 Morgan McMillian * * 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 . */ function parsePostText(data) { var t = data.text; data.entities.links.forEach(function(link, indx) { var ltext = t.substring(link.pos, link.pos + link.len); var pretext = t.substring(0, link.pos); var postext = t.substring(link.pos + link.len); pretext = convert(pretext); ltext = convert(ltext); postext = convert(postext); t = pretext + "" + ltext + "" + postext; }); return t; } function convert(t) { if (t.indexOf('