-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipa.user.js
More file actions
24 lines (23 loc) · 831 Bytes
/
Copy pathipa.user.js
File metadata and controls
24 lines (23 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ==UserScript==
// @name IPA Webarchive Extension
// @description IPAのサイトにアクセスし、404が返された際にウェブアーカイブのサイト(https://warp.ndl.go.jp/info:ndljp/pid/12446699/)にリダイレクトしてくれます。
// @author mono0218
// @grant GM_xmlhttpRequest
// @match https://www.ipa.go.jp/*
// @version 1.1
// ==/UserScript==
(function(){
GM_xmlhttpRequest({
method: "GET",
url: location.href,
headers: {
"Content-Type": "application/json"
},
onload: function(response) {
if(response.status == 404){
const url = location.href.replace("https://", "");
location.replace("https://warp.ndl.go.jp/info:ndljp/pid/12446699/" + url);
}
},
});
})();