evesquare
https://scrapbox.io/files/67c4c1a2c3cff7f3806f480d.png
📘ここについて
https://scrapbox.io/files/645ce9704f2bce001c574f84.jpg
メール: evesquare@protonmail.ch
evesquareがみた映画: /evesquare-movie
evesquareの積読本: /evesquare-tsundoku
https://me.evesq.com
覚えている範囲で見た本などを載せます。読んだ時系列はバラバラ
適当感想を書いてみたり書いてみなかったり。あくまで個人の感想。メモ。
ネタバレが含まれる可能性があります。
表紙が無いものは全部読んで無いまたは部分的に読んだもの。
好きな著者は角田光代さんです
table:現段階トップ6
1 夏の花火と私の死体 衝撃
2 ターン 世界観
3 プシュケの涙 印象的
4 Zoo 描写
5 つめたいよるに 雰囲気
6 ライオンのおやつ 印象的
table:エッセイ
1 いつも旅のなか 海外に行きたくなる
table:漫画は
1 まじめな時間 世界観
2 なるたる 衝撃
3 あせとせっけん 恋愛
4 SLAM_DUNK 情熱
5 ブランクスペース 世界観
印象的別枠
プリズムの夏
code:script.js
// Scrapbox.io 年間読書数表示カスタマイズ
// この関数は現在のページがユーザーの読書記録かどうかを判断します
function isBookPage() {
// ここでは例として「book/」タグがついているページを読書記録と判断します
// 実際の判断条件は自分の記録方法に合わせて変更してください
return scrapbox.Page.lines.some(line => line.text.includes('#book/'));
}
// この関数は現在の年を取得します
function getCurrentYear() {
return new Date().getFullYear();
}
// この関数は指定された年の読書記録の数を取得します
async function countBooksInYear(year) {
try {
// Scrapbox APIから読書データを取得
const url = 'https://scrapbox.io/api/pages/evesquare-read-books/search/titles';
const response = await fetch(url);
// レスポンスエラーをチェック
if (!response.ok) {
console.error(データ取得エラー: ${response.status});
return 0;
}
const data = await response.json();
// updatedが今年のものだけカウント
return data.filter(item => {
const updatedDate = new Date(item.updated * 1000);
return updatedDate.getFullYear() === year;
}).length;
} catch (error) {
console.error('読書データの取得中にエラーが発生しました💦:', error);
return 0; // エラー時は0を返す
}
}
// ヘッダーの.navbar-menuに年間読書数を表示する関数
async function displayBookCountInHeader() {
const year = new Date().getFullYear();
const count = await countBooksInYear(year);
// すでに表示要素がある場合は削除(再表示防止)
const existingElement = document.querySelector('.book-count-display');
if (existingElement) {
existingElement.remove();
}
// 読書カウント表示用の要素を作成
const bookCountElement = document.createElement('li');
bookCountElement.className = 'book-count-display';
// liの中に表示用のaタグを作成(Scrapboxのヘッダーのスタイルに合わせる)
const linkElement = document.createElement('a');
linkElement.href = "#"; // リンクは機能しないけどスタイルのため
linkElement.innerHTML = 📚 ${year}年: ${count}冊;
linkElement.style.fontSize = '14px';
linkElement.style.fontWeight = 'bold';
linkElement.style.color = 'gray';
// liにaタグを追加
bookCountElement.appendChild(linkElement);
// .navbar-menuを取得して、その最初の子要素の前に挿入
const navbarMenu = document.querySelector('.navbar-menu');
if (navbarMenu) {
// 既存のメニュー項目の前に挿入
if (navbarMenu.firstChild) {
navbarMenu.insertBefore(bookCountElement, navbarMenu.firstChild);
} else {
navbarMenu.appendChild(bookCountElement);
}
console.log('読書カウントを.navbar-menuに表示しました✨');
} else {
console.error('navbar-menu要素が見つかりませんでした💦');
}
}
function initBookCounter() {
setTimeout(async () => {
await displayBookCountInHeader();
}, 500);
}
(async () => await initBookCounter())();
#member