사용자:Hsl0/연구소: 두 판 사이의 차이
< 사용자:Hsl0
imported>Hsl0 (새 문서: {{특수:접두어찾기/사용자:hsl0/연구소/|stripprefix=1}} = 낙서장 = <source lang="js"> $('.gameicon').map(function() { var data = $(this).find('.gameicon-status').da...) |
imported>Hsl0 (→낙서장) |
||
3번째 줄: | 3번째 줄: | ||
= 낙서장 = | = 낙서장 = | ||
<source lang="js"> | <source lang="js"> | ||
$(' | $('#gamelist-liv li').map(function() { | ||
var data = $(this).find('.gameicon-status').data(); | var data = $(this).find('.old-gameicon-status').data(); | ||
data = { | data = { | ||
progress: | progress: data.progress === ""? null : data.progress, | ||
edit: | edit: data.edit === ""? null : data.edit, | ||
tech: | tech: data.tech === ""? null : data.tech, | ||
rating: | rating: data.rating === ""? null : data.rating | ||
}; | }; | ||
var nameElement = this.querySelector('.gameicon-name a'); | var nameElement = this.querySelector('.old-gameicon-name a'); | ||
var title = decodeURI(new URL(nameElement.href).pathname.slice(6)); | var title = decodeURI(new URL(nameElement.href).pathname.slice(6)); | ||
data.name = nameElement.innerText; | data.name = nameElement.innerText; | ||
var maker = $(this).find('.gameicon-maker'); | var maker = $(this).find('.old-gameicon-maker'); | ||
data.helper = maker.find('.gameicon-helper a').map(function() { | data.helper = maker.find('.old-gameicon-helper a').map(function() { | ||
var url = new URL(this.href); | var url = new URL(this.href); | ||
if(url.searchParams.has('title')) return url.searchParams.get('title').slice(4).split('/')[0]; | 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]; | else return decodeURI(url.pathname.slice(6)).slice(4).split('/')[0].replace(/_/g, ' '); | ||
}).toArray(); | }).toArray(); | ||
data.maker = maker.find('a:not(.gameicon-helper a)').map(function() { | 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); | var url = new URL(this.href); | ||
if(url.searchParams.has('title')) return url.searchParams.get('title').slice(4).split('/')[0]; | 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]; | else return decodeURI(url.pathname.slice(6)).slice(4).split('/')[0].replace(/_/g, ' '); | ||
}).toArray(); | }).toArray(); | ||
if(data.maker.length === 1) data.maker = data.maker[0]; | |||
return data; | return data; | ||
}); | }); | ||
</source> | </source> |
2020년 12월 22일 (화) 23:41 판
낙서장
$('#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;
});