『 时间是件无价的易耗品,不管你愿不愿意,它总是被消耗着 』
导出localStorage的脚本 2025-10-15
const textArea = document.createElement("textarea");
textArea.value = "// LocalStorage 导入代码\n";

textArea.value += "// 将此代码粘贴到浏览器控制台中执行\n";
textArea.value += "// 然后你的剪贴板就拥有了导入的代码\n\n";

for (let i = 0; i < localStorage.length; i++) {
  const key = localStorage.key(i);
  const value = localStorage.getItem(key);
  // 使用JSON.stringify确保转义字符正确处理
  const escapedValue = JSON.stringify(value);
  textArea.value += `localStorage.setItem(${JSON.stringify(key)}, ${escapedValue});\n`;
}

document.body.appendChild(textArea);
textArea.select();

try {
  document.execCommand("copy");
} catch (err) {
  alert("复制失败,请手动复制代码");
}

document.body.removeChild(textArea);
蝴蝶 2024-09-11

看见一只蝴蝶飞过废墟
是那么的美丽
就像一个奇迹
让我从倒下的地方站起...