사용자:Hsl0/연구소: 두 판 사이의 차이
< 사용자:Hsl0
imported>Hsl0 (→낙서장) |
imported>Hsl0 (→낙서장) |
||
9번째 줄: | 9번째 줄: | ||
data = { | data = { | ||
progress: data.progress === ""? null : data.progress, | progress: data.progress === ""? null : data.progress, | ||
openness: data.edit === ""? null : data.edit, | |||
tech: data.tech === ""? null : data.tech, | tech: data.tech === ""? null : data.tech, | ||
rating: data.rating === ""? null : data.rating | rating: data.rating === ""? null : data.rating | ||
30번째 줄: | 30번째 줄: | ||
}).toArray(); | }).toArray(); | ||
if(data.maker.length === 1) data.maker = data.maker[0]; | if(data.maker.length === 1) data.maker = data.maker[0]; | ||
switch(data.openness) { | |||
case 0: data.openness = false; break; | |||
case 1: data.openness = "partial"; break; | |||
case 2: data.openness = true; break; | |||
case 3: | |||
data.openness = null; | |||
data.abandon = true; | |||
break; | |||
} | |||
return data; | return data; | ||
}); | }); | ||
</source> | </source> |
2021년 12월 13일 (월) 16:37 판
낙서장
$('#gamelist-liv li').map(function() {
var data = $(this).find('.old-gameicon-status').data();
data = {
progress: data.progress === ""? null : data.progress,
openness: 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];
switch(data.openness) {
case 0: data.openness = false; break;
case 1: data.openness = "partial"; break;
case 2: data.openness = true; break;
case 3:
data.openness = null;
data.abandon = true;
break;
}
return data;
});