1. 删除本地临时调试文件、工作流模板、闲置脚本与脑暴记录 2. 新增极简在线记事本API部署文件 3. 修复Flutter端拾光Sheet布局与状态更新问题 4. 完善句子来源后端API与前端导入逻辑 5. 修复macOS平台secure存储插件引用
47 lines
1.4 KiB
JavaScript
Executable File
47 lines
1.4 KiB
JavaScript
Executable File
/*! Minimalist Web Notepad | https://github.com/pereorga/minimalist-web-notepad */
|
|
|
|
function uploadContent() {
|
|
|
|
// If textarea value changes.
|
|
if (content !== textarea.value) {
|
|
var temp = textarea.value;
|
|
var request = new XMLHttpRequest();
|
|
|
|
request.open('POST', window.location.href, true);
|
|
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
|
request.onload = function() {
|
|
if (request.readyState === 4) {
|
|
|
|
// Request has ended, check again after 1 second.
|
|
content = temp;
|
|
setTimeout(uploadContent, 1000);
|
|
}
|
|
}
|
|
request.onerror = function() {
|
|
|
|
// Try again after 1 second.
|
|
setTimeout(uploadContent, 1000);
|
|
}
|
|
request.send('text=' + encodeURIComponent(temp));
|
|
|
|
// Make the content available to print.
|
|
printable.removeChild(printable.firstChild);
|
|
printable.appendChild(document.createTextNode(temp));
|
|
}
|
|
else {
|
|
|
|
// Content has not changed, check again after 1 second.
|
|
setTimeout(uploadContent, 1000);
|
|
}
|
|
}
|
|
|
|
var textarea = document.getElementById('content');
|
|
var printable = document.getElementById('printable');
|
|
var content = textarea.value;
|
|
|
|
// Make the content available to print.
|
|
printable.appendChild(document.createTextNode(content));
|
|
|
|
textarea.focus();
|
|
uploadContent();
|