Skip to content

Instantly share code, notes, and snippets.

@desgano
Last active March 22, 2022 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desgano/64aa29a0312b6f7ca4468b728bc30e4c to your computer and use it in GitHub Desktop.
Save desgano/64aa29a0312b6f7ca4468b728bc30e4c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="../lib/style.css">
<title>nnlist v0.10</title>
</head>
<body>
<div id="main">
<h1>■nnlist v0.10</h1>
<p>
NicoNicoLister、略してnnlist。<br>
ニコ動マイリストから
<a href="./nnplay.html">NicoNicoPlayer</a>
の動画リストを作るツールです。<br>
</p>
<h2>●実行サンプル</h2>
<!-- ★ nnlist スタイル: サイズやマージン等は適当に調整を -->
<style>
textarea#nico_result {
width: 480px;
height: 200px;
font-size: 9pt;
}
</style>
<!-- ★ nnlist 結果表示エリア -->
<p>
<textarea id="nico_result"></textarea>
</p>
<!-- ★ nnlist 入力エリア -->
<p>
ニコ動マイリスト番号:
<input id="nico_id">
<button id="b_get" type="button" onclick="get_result();">データ作成</button>
<button id="b_copy" type="button" onclick="copy_result();">コピー</button>
</p>
<!-- ★ nnlist スクリプト -->
<script>
function get_result()
{
const match = nico_id.value.match(/mylist\/(\d+)/);
if (!match) {
nico_result.value =
"マイリスト番号は「mylist/数字」形式で指定してください。";
}
else {
const id = match[1];
const url = "./nnlist.php?id=" + id;
nico_result.value = "";
nico_id.value = "mylist/" + id;
fetch(url)
.then(responce => responce.text())
.then(text => { nico_result.value = text; })
.catch(ex => { nico_result.value = ex.message; });
}
}
function copy_result()
{
if (!navigator.clipboard) {
alert(
"JavaScriptのクリップボード機能が使えません。\n" +
"手作業(Ctrl+[A]、Ctrl+[C])でコピーしてください。\n\n" +
"JavaScriptのクリップボードは次の環境で利用できます。\n" +
"(1) https://~ (SSL接続したサイト)\n" +
"(2) http://localhost/~ (ローカルホスト)\n" +
"(3) file://~ (ローカルファイル)\n"
);
}
else {
navigator.clipboard.writeText(nico_result.value)
.then(() => alert("クリップボードにコピーしました"))
.catch(ex => alert(ex.message));
}
}
nico_result.value = "";
nico_id.value = "";
</script>
<!-- ★ nnlist ここまで -->
<h2>●使い方</h2>
<ul>
<li>ニコニコ動画のマイリスト番号を入力し「データ作成」を押してください。
<li>マイリスト番号は「mylist/数字」を含む文字列で指定してください。
<li>マイリストのURLをそのままコピー&ペーストするのが簡単です。
</ul>
<ul>
<li>「コピー」を押すと、結果をクリップボードにコピーします。
<li>「シリーズ」形式の動画リストは、RSSが取得できないので未対応です。
</ul>
<div id="footer">
powered by <a href="./">desga/nanika</a>
/ last modified 2022/03/22
</div>
<p style="height:100px;">
</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment