kemono.user.js を更新
このコミットが含まれているのは:
コミット
86cf47c5e8
|
@ -116,6 +116,31 @@
|
|||
}
|
||||
}
|
||||
|
||||
class KemonoUrl {
|
||||
static check(href) {
|
||||
return !!href.match(/https:\/\/kemono.{su,party}/i);
|
||||
}
|
||||
|
||||
constructor(href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
extract_user_id() {
|
||||
const re = /https:\/\/kemono.{su,party}\/(?<platform>\w)\/user\/(?<userid>\d+)/i;
|
||||
const match = href.match(re);
|
||||
if(match) {
|
||||
return {ok: {userid: match.groups.userid, platform: match.groups.platform}};
|
||||
}
|
||||
else {
|
||||
return {err: '?'};
|
||||
}
|
||||
}
|
||||
|
||||
generate_kemono_url(user_id) {
|
||||
return 'https://kemono.su/' + user_id.platform + '/user/' + user_id.userid;
|
||||
}
|
||||
}
|
||||
|
||||
const href = location.href;
|
||||
|
||||
let url;
|
||||
|
@ -131,6 +156,9 @@
|
|||
else if(PatreonUrl.check(href)) {
|
||||
url = new PatreonUrl(href);
|
||||
}
|
||||
else if(KemonoUrl.check(href)) {
|
||||
url = new KemonoUrl(href);
|
||||
}
|
||||
else {
|
||||
url = undefined;
|
||||
}
|
||||
|
|
読み込み中…
新しいイシューから参照