diff --git a/.theme/template.html.temp b/.theme/template.html.temp
index 87e5a96..685ee28 100644
--- a/.theme/template.html.temp
+++ b/.theme/template.html.temp
@@ -1,26 +1,99 @@
-
-
-
-
-
- 一休github简易图床系统
-
-
-
-
-
-
图片信息
-
-
- 缩略图 |
- HTTPS 访问地址 |
- jsdelivr CDN 加速地址 |
-
-
-
-
-
-
+document.addEventListener("DOMContentLoaded", function() {
+ var githubUsername = 'GITHUB_USERNAME';
+ var githubRepository = 'GITHUB_REPOSITORY';
+
+ fetch('files.json')
+ .then(response => response.json())
+ .then(fileStructure => {
+ function populateDirectory(data, parentElement = document.getElementById('directory'), path = '') {
+ for (const key in data) {
+ if (typeof data[key] === 'object' && !data[key].https_url) {
+ const folder = document.createElement('div');
+ folder.innerHTML = ``;
+ parentElement.appendChild(folder);
+ const contentSection = document.createElement('div');
+ contentSection.className = 'content-section';
+ contentSection.style.display = 'none';
+ folder.appendChild(contentSection);
+ populateDirectory(data[key], contentSection, path + '/' + key);
+ }
+ }
+
+ var coll = document.getElementsByClassName("collapsible");
+ for (var i = 0; i < coll.length; i++) {
+ coll[i].addEventListener("click", function() {
+ var active = document.querySelector('.collapsible.active');
+ if (active && active !== this) {
+ active.classList.remove('active');
+ active.nextElementSibling.style.display = 'none';
+ }
+ this.classList.toggle("active");
+ var content = this.nextElementSibling;
+ if (content.style.display === "block") {
+ content.style.display = "none";
+ } else {
+ content.style.display = "block";
+ }
+ populateTable(this.getAttribute("data-path"));
+ });
+ }
+ }
+
+ function populateTable(directory) {
+ var imageTable = document.getElementById("image-table");
+ while (imageTable.rows.length > 1) {
+ imageTable.deleteRow(1);
+ }
+ var images = getImagesFromDirectory(fileStructure, directory);
+ images.forEach(function(item) {
+ var row = imageTable.insertRow();
+ var cell1 = row.insertCell(0);
+ var cell2 = row.insertCell(1);
+ var cell3 = row.insertCell(2);
+ cell1.innerHTML = '';
+ cell2.innerHTML = '' + item.https_url + '';
+ cell3.innerHTML = '' + item.cdn_url + '';
+ });
+ }
+
+ function getImagesFromDirectory(data, directory) {
+ var images = [];
+ var dirParts = directory.split('/').filter(part => part);
+
+ function traverse(currentData, currentPath = '') {
+ for (const key in currentData) {
+ if (typeof currentData[key] === 'object' && !currentData[key].https_url) {
+ if (dirParts[0] === key) {
+ dirParts.shift();
+ traverse(currentData[key], currentPath + '/' + key);
+ }
+ } else if (typeof currentData[key] === 'object' && currentData[key].https_url) {
+ if (currentPath === directory) {
+ images.push({
+ name: key,
+ https_url: currentData[key].https_url,
+ cdn_url: currentData[key].cdn_url
+ });
+ }
+ }
+ }
+ }
+
+ traverse(data);
+ return images;
+ }
+
+ function copyToClipboard(text) {
+ navigator.clipboard.writeText(text).then(function() {
+ alert('链接已复制: ' + text);
+ }, function(err) {
+ console.error('复制失败: ', err);
+ });
+ }
+
+ populateDirectory(fileStructure);
+ if (Object.keys(fileStructure).length > 0) {
+ populateTable(Object.keys(fileStructure)[0]);
+ }
+ });
+});
diff --git a/index.html b/index.html
index 87e5a96..685ee28 100644
--- a/index.html
+++ b/index.html
@@ -1,26 +1,99 @@
-
-
-
-
-
- 一休github简易图床系统
-
-
-
-
-
-
图片信息
-
-
- 缩略图 |
- HTTPS 访问地址 |
- jsdelivr CDN 加速地址 |
-
-
-
-
-
-
+document.addEventListener("DOMContentLoaded", function() {
+ var githubUsername = 'GITHUB_USERNAME';
+ var githubRepository = 'GITHUB_REPOSITORY';
+
+ fetch('files.json')
+ .then(response => response.json())
+ .then(fileStructure => {
+ function populateDirectory(data, parentElement = document.getElementById('directory'), path = '') {
+ for (const key in data) {
+ if (typeof data[key] === 'object' && !data[key].https_url) {
+ const folder = document.createElement('div');
+ folder.innerHTML = ``;
+ parentElement.appendChild(folder);
+ const contentSection = document.createElement('div');
+ contentSection.className = 'content-section';
+ contentSection.style.display = 'none';
+ folder.appendChild(contentSection);
+ populateDirectory(data[key], contentSection, path + '/' + key);
+ }
+ }
+
+ var coll = document.getElementsByClassName("collapsible");
+ for (var i = 0; i < coll.length; i++) {
+ coll[i].addEventListener("click", function() {
+ var active = document.querySelector('.collapsible.active');
+ if (active && active !== this) {
+ active.classList.remove('active');
+ active.nextElementSibling.style.display = 'none';
+ }
+ this.classList.toggle("active");
+ var content = this.nextElementSibling;
+ if (content.style.display === "block") {
+ content.style.display = "none";
+ } else {
+ content.style.display = "block";
+ }
+ populateTable(this.getAttribute("data-path"));
+ });
+ }
+ }
+
+ function populateTable(directory) {
+ var imageTable = document.getElementById("image-table");
+ while (imageTable.rows.length > 1) {
+ imageTable.deleteRow(1);
+ }
+ var images = getImagesFromDirectory(fileStructure, directory);
+ images.forEach(function(item) {
+ var row = imageTable.insertRow();
+ var cell1 = row.insertCell(0);
+ var cell2 = row.insertCell(1);
+ var cell3 = row.insertCell(2);
+ cell1.innerHTML = '';
+ cell2.innerHTML = '' + item.https_url + '';
+ cell3.innerHTML = '' + item.cdn_url + '';
+ });
+ }
+
+ function getImagesFromDirectory(data, directory) {
+ var images = [];
+ var dirParts = directory.split('/').filter(part => part);
+
+ function traverse(currentData, currentPath = '') {
+ for (const key in currentData) {
+ if (typeof currentData[key] === 'object' && !currentData[key].https_url) {
+ if (dirParts[0] === key) {
+ dirParts.shift();
+ traverse(currentData[key], currentPath + '/' + key);
+ }
+ } else if (typeof currentData[key] === 'object' && currentData[key].https_url) {
+ if (currentPath === directory) {
+ images.push({
+ name: key,
+ https_url: currentData[key].https_url,
+ cdn_url: currentData[key].cdn_url
+ });
+ }
+ }
+ }
+ }
+
+ traverse(data);
+ return images;
+ }
+
+ function copyToClipboard(text) {
+ navigator.clipboard.writeText(text).then(function() {
+ alert('链接已复制: ' + text);
+ }, function(err) {
+ console.error('复制失败: ', err);
+ });
+ }
+
+ populateDirectory(fileStructure);
+ if (Object.keys(fileStructure).length > 0) {
+ populateTable(Object.keys(fileStructure)[0]);
+ }
+ });
+});