コミットを比較
14 コミット
作成者 | SHA1 | 日付 |
---|---|---|
skscript | 5760b084af | |
skscript | c9df55de39 | |
skscript | d36a2384b2 | |
skscript | 41c74f2b04 | |
skscript | a86e660b5e | |
skscript | 356e8dfedd | |
skscript | 8649698104 | |
skscript | 0943e18b8f | |
skscript | 2b896fd9e1 | |
skscript | 2f89e44374 | |
skscript | 7e33bdf4a6 | |
skscript | 86cf47c5e8 | |
skscript | 354c1fe31d | |
skscript | 4f0273c9c1 |
|
@ -1,5 +1,5 @@
|
|||
# redirect2kemono
|
||||
|
||||
Go to kemono.party from an artist's page. Supports Patreon, Pixiv, Fanbox and Fantia
|
||||
Go to the corresponding kemono.su page from an artist's page. Supports Patreon, Pixiv, Fanbox and Fantia
|
||||
|
||||
You can install the script from [https://greasyfork.org/ja/scripts/470828-go-to-kemono-party](https://greasyfork.org/ja/scripts/470828-go-to-kemono-party)
|
||||
You can install the script from [https://greasyfork.org/scripts/470828-go-to-kemono-su](https://greasyfork.org/scripts/470828-go-to-kemono-su)
|
|
@ -1,18 +1,20 @@
|
|||
// ==UserScript==
|
||||
// @name Go to kemono.party
|
||||
// @name:ja kemono.partyへ移動
|
||||
// @name Go to kemono.su
|
||||
// @name:ja kemono.suへ移動
|
||||
// @namespace https://greasyfork.org/ja/users/1126644-s-k-script
|
||||
// @version 0.1.2
|
||||
// @description Go to kemono.party from an artist's page. Supports Patreon, Pixiv, Fanbox and Fantia
|
||||
// @description:ja アーティストのページから対応するkemono.partyのページへ移動します。Pixiv, Fanbox, Fantia, Patreonをサポートしています。
|
||||
// @version 0.2.2
|
||||
// @description Go to the corresponding kemono.su page from an artist's page. Supports Patreon, Pixiv, Fanbox and Fantia
|
||||
// @description:ja アーティストのページから対応するkemono.suのページへ移動します。Pixiv, Fanbox, Fantia, Patreonをサポートしています。
|
||||
// @author S.K.Script
|
||||
// @homepage https://greasyfork.org/ja/users/1126644-s-k-script
|
||||
// @homepage https://gitler.moe/skscript/redirect2kemono
|
||||
// @license GPL-3.0-only
|
||||
// @match https://fantia.jp/*
|
||||
// @match https://*.fanbox.cc/*
|
||||
// @match https://www.pixiv.net/*
|
||||
// @match https://www.patreon.com/*
|
||||
// @icon https://www.google.com/s2/favicons?sz=64&domain=kemono.party
|
||||
// @match https://kemono.su/*
|
||||
// @match https://kemono.party/*
|
||||
// @icon https://www.google.com/s2/favicons?sz=64&domain=kemono.su
|
||||
// @grant none
|
||||
// @run-at context-menu
|
||||
// ==/UserScript==
|
||||
|
@ -29,19 +31,28 @@
|
|||
this.href = href;
|
||||
}
|
||||
|
||||
extract_user_id() {
|
||||
extract_metadata() {
|
||||
const re = /https:\/\/fantia.jp\/fanclubs\/(?<userid>\d+)/i;
|
||||
const match = this.href.match(re);
|
||||
if(match) {
|
||||
return {ok: match.groups.userid};
|
||||
}
|
||||
else {
|
||||
let result = undefined;
|
||||
document.querySelectorAll(".fanclub-name > a").forEach(element => {
|
||||
console.log(element, element.href);
|
||||
const match = element.href.match(re);
|
||||
if(match) {
|
||||
result = {ok: match.groups.userid};
|
||||
}
|
||||
});
|
||||
if (result) { return result };
|
||||
return {err: 'Try again in the top page of this fanclub.\nファンクラブのトップページに移動してからもう一度実行してください'};
|
||||
}
|
||||
}
|
||||
|
||||
generate_kemono_url(user_id) {
|
||||
return 'https://kemono.party/fantia/user/' + user_id;
|
||||
return 'https://kemono.su/fantia/user/' + user_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,12 +65,12 @@
|
|||
this.href = href;
|
||||
}
|
||||
|
||||
extract_user_id() {
|
||||
extract_metadata() {
|
||||
return {err: 'Try again in the Pixiv user page of this person. Note: Pixiv and Fanbox are run by the same company.\nこの人のPixiv(Fanboxではなく)のユーザーページへ移動してからもう一度実行してください'};
|
||||
}
|
||||
|
||||
generate_kemono_url(user_id) {
|
||||
return 'https://kemono.party/fanbox/user/' + user_id;
|
||||
return 'https://kemono.su/fanbox/user/' + user_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +83,7 @@
|
|||
this.href = href;
|
||||
}
|
||||
|
||||
extract_user_id() {
|
||||
extract_metadata() {
|
||||
const re = /https:\/\/www.pixiv.net\/users\/(?<userid>\d+)/i;
|
||||
const match = href.match(re);
|
||||
if(match) {
|
||||
|
@ -84,7 +95,7 @@
|
|||
}
|
||||
|
||||
generate_kemono_url(user_id) {
|
||||
return 'https://kemono.party/fanbox/user/' + user_id;
|
||||
return 'https://kemono.su/fanbox/user/' + user_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +108,7 @@
|
|||
this.href = href;
|
||||
}
|
||||
|
||||
extract_user_id() {
|
||||
extract_metadata() {
|
||||
// https://www.patreon.com/user?u=35870453
|
||||
const re = /https:\/\/www.patreon.com\/user\?u=(?<userid>\d+)/i;
|
||||
const match = href.match(re);
|
||||
|
@ -110,7 +121,32 @@
|
|||
}
|
||||
|
||||
generate_kemono_url(user_id) {
|
||||
return 'https://kemono.party/patreon/user/' + user_id;
|
||||
return 'https://kemono.su/patreon/user/' + user_id;
|
||||
}
|
||||
}
|
||||
|
||||
class KemonoUrl {
|
||||
static check(href) {
|
||||
return !!href.match(/https:\/\/kemono.(su|party)/i);
|
||||
}
|
||||
|
||||
constructor(href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
extract_metadata() {
|
||||
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(metadata) {
|
||||
return 'https://kemono.su/' + metadata.platform + '/user/' + metadata.userid;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,6 +165,9 @@
|
|||
else if(PatreonUrl.check(href)) {
|
||||
url = new PatreonUrl(href);
|
||||
}
|
||||
else if(KemonoUrl.check(href)) {
|
||||
url = new KemonoUrl(href);
|
||||
}
|
||||
else {
|
||||
url = undefined;
|
||||
}
|
||||
|
@ -138,10 +177,10 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const result = url.extract_user_id();
|
||||
const result = url.extract_metadata();
|
||||
if(result.ok) {
|
||||
const user_id = result.ok;
|
||||
const kemono_url = url.generate_kemono_url(user_id);
|
||||
const metadata = result.ok;
|
||||
const kemono_url = url.generate_kemono_url(metadata);
|
||||
window.open(kemono_url, '_blank');
|
||||
}
|
||||
else {
|
||||
|
|
読み込み中…
新しいイシューから参照