feat: persist footer text in localStorage so it auto-populates on return visits
This commit is contained in:
+7
-1
@@ -1300,7 +1300,8 @@ function makeFitsPlaceholderImage(meta) {
|
|||||||
|
|
||||||
function populateEditFields(meta, isFits) {
|
function populateEditFields(meta, isFits) {
|
||||||
fitsNotice.style.display = 'none';
|
fitsNotice.style.display = 'none';
|
||||||
if (!meta.footer) meta.footer = '@FateOfAstrophilia';
|
const savedFooter = localStorage.getItem('speccard_footer');
|
||||||
|
if (!meta.footer) meta.footer = savedFooter || '@FateOfAstrophilia';
|
||||||
if (!meta.header) meta.header = 'SPEC CARD';
|
if (!meta.header) meta.header = 'SPEC CARD';
|
||||||
currentMeta = meta;
|
currentMeta = meta;
|
||||||
Object.entries(editFields).forEach(([key, input]) => {
|
Object.entries(editFields).forEach(([key, input]) => {
|
||||||
@@ -1309,6 +1310,11 @@ function populateEditFields(meta, isFits) {
|
|||||||
input.classList.toggle('has-value', !!val);
|
input.classList.toggle('has-value', !!val);
|
||||||
input.addEventListener('input', () => {
|
input.addEventListener('input', () => {
|
||||||
input.classList.toggle('has-value', !!input.value);
|
input.classList.toggle('has-value', !!input.value);
|
||||||
|
if (key === 'footer') {
|
||||||
|
const footerVal = input.value.trim();
|
||||||
|
if (footerVal) localStorage.setItem('speccard_footer', footerVal);
|
||||||
|
else localStorage.removeItem('speccard_footer');
|
||||||
|
}
|
||||||
if (currentImg) renderCard(currentImg, readEditFields());
|
if (currentImg) renderCard(currentImg, readEditFields());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user