사용자:Hsl0/연구소
< 사용자:Hsl0
낙서장
$('#gamelist-liv li').map(function() {
var data = $(this).find('.old-gameicon-status').data();
data = {
progress: data.progress === ""? null : data.progress,
edit: data.edit === ""? null : data.edit,
tech: data.tech === ""? null : data.tech,
rating: data.rating === ""? null : data.rating
};
var nameElement = this.querySelector('.old-gameicon-name a');
var title = decodeURI(new URL(nameElement.href).pathname.slice(6));
data.name = nameElement.innerText;
var maker = $(this).find('.old-gameicon-maker');
data.helper = maker.find('.old-gameicon-helper a').map(function() {
var url = new URL(this.href);
if(url.searchParams.has('title')) return url.searchParams.get('title').slice(4).split('/')[0].replace(/_/g, ' ');
else return decodeURI(url.pathname.slice(6)).slice(4).split('/')[0].replace(/_/g, ' ');
}).toArray();
if(!data.helper.length) data.helper = null;
else if(data.helper.length === 1) data.helper = data.helper[0];
data.maker = maker.find('a:not(.old-gameicon-helper a)').map(function() {
var url = new URL(this.href);
if(url.searchParams.has('title')) return url.searchParams.get('title').slice(4).split('/')[0].replace(/_/g, ' ');
else return decodeURI(url.pathname.slice(6)).slice(4).split('/')[0].replace(/_/g, ' ');
}).toArray();
if(data.maker.length === 1) data.maker = data.maker[0];
return data;
});