MediaWiki:RecentActivities.js:修订间差异
来自东方活动维基
无编辑摘要 |
无编辑摘要 |
||
第6行: | 第6行: | ||
let data = JSON.parse(xhr.responseText); | let data = JSON.parse(xhr.responseText); | ||
//console.log(data); | //console.log(data); | ||
let divBlock = document.getElementById('RecentActivities'); | |||
data.forEach(ele => { | data.forEach(ele => { | ||
let name = ele["name"]; | let name = ele["name"]; | ||
let id = ele["id"]; | let id = ele["id"]; | ||
let url = "https://touhou.market/main/events/" + id | let img = ele["images"]; | ||
let list_image_clip = ele["list_image_clip"]; | |||
let url = "https://touhou.market/main/events/" + id; | |||
let imgUrl = `https://thonly.cc/proxy_thmarket/api/v1/images/${img}?format=webp&q=60&size=m&clip=${list_image_clip[0]},${list_image_clip[1]},${list_image_clip[2]},${list_image_clip[3]}`; | |||
if(divBlock) { | |||
} | |||
}); | }); | ||
} else { | } else { |
2024年6月3日 (一) 12:28的版本
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://thonly.cc/proxy_thmarket/api/v1/events?include_pending=true&utf8=1', true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
let data = JSON.parse(xhr.responseText);
//console.log(data);
let divBlock = document.getElementById('RecentActivities');
data.forEach(ele => {
let name = ele["name"];
let id = ele["id"];
let img = ele["images"];
let list_image_clip = ele["list_image_clip"];
let url = "https://touhou.market/main/events/" + id;
let imgUrl = `https://thonly.cc/proxy_thmarket/api/v1/images/${img}?format=webp&q=60&size=m&clip=${list_image_clip[0]},${list_image_clip[1]},${list_image_clip[2]},${list_image_clip[3]}`;
if(divBlock) {
}
});
} else {
console.error('Network response was not ok ' + xhr.statusText);
}
}
};
xhr.send();