diff --git a/src/css/wikidot.css b/src/css/wikidot.css index c8464b6..978d135 100644 --- a/src/css/wikidot.css +++ b/src/css/wikidot.css @@ -129,4 +129,11 @@ a#account-topbutton:focus + div#account-options { code, .code { background-color: unset; +} + +#page-index { + background-color: #F3F3F3; + border: 1px solid #CCC; + padding: 0.5em 1em; + margin: 1em 0; } \ No newline at end of file diff --git a/src/index.html b/src/index.html index be32f83..af3973d 100644 --- a/src/index.html +++ b/src/index.html @@ -113,6 +113,12 @@

Edit Page

  • The display of Sidebar can be changed from Advanced Settings.
  • +
    +

    作成履歴

    + +
    diff --git a/src/main.ts b/src/main.ts index 9976973..010e52a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -327,6 +327,7 @@ const handleDOMContentLoaded = async () => { } else { loadlocales(); } + populatePageIndexList(); const url = new URL(window.location.href); const pathname = url.pathname; @@ -589,6 +590,39 @@ function formatDateForRevisionData(dateString) { } +function populatePageIndexList() { + // ページのリストを表示する要素を取得 + const pageIndexList = document.getElementById('page-index-list'); + + if (!pageIndexList) { + console.error('page-index-list element not found.'); + return; + } + + // ローカルストレージのすべてのキーを走査 + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if (key && key.startsWith('FtmlStorage[')) { + // shortId を抽出 + const shortId = key.match(/\[([^\]]+)\]/)[1]; + + const data = JSON.parse(localStorage.getItem(key)); + const title = data.title || 'Untitled'; // タイトルがない場合のデフォルト値 + + // 新しいリンク要素を作成 + const linkElem = document.createElement('a'); + linkElem.href = `/share/${shortId}`; + linkElem.textContent = title; + linkElem.target = "_blank"; // 新しいタブで開く + + // リンク要素をリスト要素に追加 + const listItem = document.createElement('li'); + listItem.appendChild(linkElem); + pageIndexList.appendChild(listItem); + } + } +} + // Event listeners... document.addEventListener('DOMContentLoaded', handleDOMContentLoaded); if (editpageField) editpageField.addEventListener('input', handleEditpageInput);