Last active
August 23, 2021 19:31
-
-
Save uguisu-an/c903cda6b5f4f8b6e7860489052fc9e1 to your computer and use it in GitHub Desktop.
開いているなろう小説のページをランダムで一話開く。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var%20ncode%20=%20/https:\/\/ncode.syosetu.com\/([^\/]+)/.exec(location.href)[1];%20var%20callback%20=%20(data)%20=>%20{%20%20%20if%20(data[0].allcount%20<%201)%20throw%20"no%20data";%20%20%20var%20page%20=%20Math.floor(Math.random()%20*%20data[1].general_all_no)%20+%201;%20%20%20location.href%20=%20`https://ncode.syosetu.com/${ncode}/${page}`;%20};%20%20var%20st%20=%20document.createElement("script");%20st.src%20=%20`https://api.syosetu.com/novelapi/api/?out=jsonp&callback=callback&ncode=${ncode}&of=t-n-w-s-gl-ga`;%20document.head.appendChild(st); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ncode = /https:\/\/ncode.syosetu.com\/([^\/]+)/.exec(location.href)[1]; | |
var callback = (data) => { | |
if (data[0].allcount < 1) throw "no data"; | |
var page = Math.floor(Math.random() * data[1].general_all_no) + 1; | |
location.href = `https://ncode.syosetu.com/${ncode}/${page}`; | |
}; | |
var st = document.createElement("script"); | |
st.src = `https://api.syosetu.com/novelapi/api/?out=jsonp&callback=callback&ncode=${ncode}&of=t-n-w-s-gl-ga`; | |
document.head.appendChild(st); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment