function sortContent() { isM3U=true; //下载为.txt var inputText = document.getElementById('myInput').value; var lines = inputText.split('\n'); lines = lines.filter(line => line.trim()!== ''); // 去除空行 lines.sort(); // 对行进行排序 var sortedText = lines.join('\n'); // 重新组合成 document.getElementById('myOutput').value = sortedText; // 输出文本 } function convertToBase64() { isM3U=true; //下载为.txt var sortedText = document.getElementById('myInput').value; var encoded = btoa(unescape(encodeURIComponent(sortedText))); document.getElementById('myOutput').value = encoded; } function decodeBase64() { isM3U=true; //下载为.txt var base64Text = document.getElementById('myInput').value; try { var decoded = decodeURIComponent(escape(atob(base64Text))); document.getElementById('myOutput').value = decoded; } catch (error) { document.getElementById('myOutput').value = '解码失败,请检查输入的 Base64 编码是否正确'; } }