今天有佬告诉我有一篇关于CSS的教程,来自大河内老师的发布的一篇,确实给了我很大的启发
然后今天终于搞懂了HTML、XML和转URL之间的关系,也明白直接用CSS是不可取的,毕竟你都不知道里面(XML)有什么东西,你就像凭空造出来(CSS),所以就把空间HTML的下载,然后用AI解读有什么容器,我在把想要的容器和部件保留,其他省略,再把XML转成URL,发送,成功布局
以为是成功连连,没想到是失败的开始:就是怎么样CSS样式都保留不成功在服务器
利用claude写的注入代码:
// 单栏个人空间配置注入代码(去除默认CSS)
// 1. 布局比例(单栏布局)
const currentlayout = "0%3A1%3A0"; // 0:1:0 只有中栏
// 2. URL编码后的XML布局数据(包含6个模块)
const layoutdata = "XML转URL";
// 3. 弹窗输入 CSS(默认空)
const customCSS = prompt("请输入自定义CSS(可留空):", "");
// 4. 获取formhash并提交
const formhash = document.querySelector('input[name=formhash]').value;
if (!formhash) {
console.error('未找到formhash,请确保在DIY页面执行');
} else {
console.log('formhash找到:', formhash);
// 发送配置
fetch("/home.php?mod=spacecp&ac=index", {
"credentials": "include",
"headers": { "content-type": "application/x-www-form-urlencoded" },
"body": `layoutdata=${layoutdata}¤tlayout=${currentlayout}&style=t8&spacecss=${encodeURIComponent(customCSS)}&diysubmit=true&formhash=${formhash}`,
"method": "POST",
"mode": "cors"
})
.then(response => {
console.log(' 提交状态:', response.status);
if (response.status === 200) {
console.log(' 布局配置提交成功!');
console.log(' 请刷新页面查看效果');
}
return response.text();
})
.then(data => {
console.log(' 服务器响应长度:', data.length);
})
.catch(error => {
console.error(' 提交失败:', error);
});
}
就已经能够注入CSS在本地显示,也已经能够获取formhash和response.status ,甚至还是获取服务器响应时长,但就是更新不了()
如果有佬能够指点或提供一份完整的POST格式,特别是模板化的CSS的格式,特别的感激不尽了