From fad4bfeb9b560cf2404e050c716cf10e772a409e Mon Sep 17 00:00:00 2001 From: bat Date: Sun, 2 Apr 2023 00:49:49 +0000 Subject: [PATCH 1/3] Fix display on iOS by not relying on default button padding --- components/header.js | 47 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/components/header.js b/components/header.js index 93ebe1e..78e6d67 100644 --- a/components/header.js +++ b/components/header.js @@ -77,8 +77,8 @@ export class Header extends HTMLElement { :host { background: #111; color: #ddd; - display: flex; - flex-direction: row; + display: grid; + grid-template-columns: min-content min-content 1fr min-content min-content; padding: 0 4px; } button { @@ -86,10 +86,7 @@ export class Header extends HTMLElement { background: inherit; color: inherit; font-size: 30px; - width: 32px; - } - div.divider { - flex-grow: 1; + padding: 0 8px; } div.menu { position: fixed; @@ -230,26 +227,21 @@ export class Header extends HTMLElement { const confirmBtn = document.createElement('button') confirmBtn.innerText = this.text.rename confirmBtn.style.marginLeft = '3px' - let errorEl confirmBtn.addEventListener('click', () => { const newPath = input.value - const v = localStorage.getItem(newPath) - if (v !== null || newPath === this.path) { - if (!errorEl) { - errorEl = document.createElement('p') - errorEl.style.color = 'red' - errorEl.innerText = this.text.alreadyExists - dialog.bodyEl.appendChild(errorEl) - } + const exists = localStorage.getItem(newPath) + if (exists ?? true === true) { return } - localStorage.setItem( - newPath, - localStorage.getItem(this.path) - ) - localStorage.removeItem(this.path) - dialog.close() - location.hash = newPath + if (newPath !== this.path) { + localStorage.setItem( + newPath, + localStorage.getItem(this.path) + ) + localStorage.removeItem(this.path) + dialog.close() + vlocation.hash = newPath + } }) dialog.footerEl.replaceChildren( cancelBtn, confirmBtn @@ -274,7 +266,7 @@ export class Header extends HTMLElement { confirmBtn.style.marginLeft = '3px' confirmBtn.addEventListener('click', () => { localStorage.removeItem(this.path) - location.hash = '/' + vlocation.hash = '/' dialog.close() }) dialog.footerEl.replaceChildren( @@ -338,8 +330,15 @@ export class Header extends HTMLElement { confirmBtn.style.marginLeft = '3px' confirmBtn.addEventListener('click', () => { const newPath = this.encodePath(input.value) - location.hash = newPath + const exists = localStorage.getItem(newPath) + if (exists ?? true === true) { + return + } + if (newPath !== this.path) { + localStorage.setItem(newPath, '') + } dialog.close() + vlocation.hash = newPath }) dialog.footerEl.replaceChildren( cancelBtn, confirmBtn From 81e31fafe723357285293f97b80e0c5b906f0b49 Mon Sep 17 00:00:00 2001 From: bat Date: Sun, 2 Apr 2023 00:52:59 +0000 Subject: [PATCH 2/3] Subir archivos a '' --- sw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw.js b/sw.js index e95294d..e1ebfac 100644 --- a/sw.js +++ b/sw.js @@ -10,7 +10,7 @@ async function initCache() { '/components/nav-menu.js', '/components/page-menu.js', '/components/dialog.js', - ]) //6 + ]) //7 } self.addEventListener("install", event => { From f699f2a3f7ed28180c14569e0015f5efcd292101 Mon Sep 17 00:00:00 2001 From: bat Date: Sun, 2 Apr 2023 00:59:49 +0000 Subject: [PATCH 3/3] Subir archivos a 'components' --- components/header.js | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/components/header.js b/components/header.js index 78e6d67..05ea93c 100644 --- a/components/header.js +++ b/components/header.js @@ -227,21 +227,26 @@ export class Header extends HTMLElement { const confirmBtn = document.createElement('button') confirmBtn.innerText = this.text.rename confirmBtn.style.marginLeft = '3px' + let errorEl confirmBtn.addEventListener('click', () => { const newPath = input.value - const exists = localStorage.getItem(newPath) - if (exists ?? true === true) { + const v = localStorage.getItem(newPath) + if (v !== null || newPath === this.path) { + if (!errorEl) { + errorEl = document.createElement('p') + errorEl.style.color = 'red' + errorEl.innerText = this.text.alreadyExists + dialog.bodyEl.appendChild(errorEl) + } return } - if (newPath !== this.path) { - localStorage.setItem( - newPath, - localStorage.getItem(this.path) - ) - localStorage.removeItem(this.path) - dialog.close() - vlocation.hash = newPath - } + localStorage.setItem( + newPath, + localStorage.getItem(this.path) + ) + localStorage.removeItem(this.path) + dialog.close() + location.hash = newPath }) dialog.footerEl.replaceChildren( cancelBtn, confirmBtn @@ -266,7 +271,7 @@ export class Header extends HTMLElement { confirmBtn.style.marginLeft = '3px' confirmBtn.addEventListener('click', () => { localStorage.removeItem(this.path) - vlocation.hash = '/' + location.hash = '/' dialog.close() }) dialog.footerEl.replaceChildren( @@ -330,15 +335,8 @@ export class Header extends HTMLElement { confirmBtn.style.marginLeft = '3px' confirmBtn.addEventListener('click', () => { const newPath = this.encodePath(input.value) - const exists = localStorage.getItem(newPath) - if (exists ?? true === true) { - return - } - if (newPath !== this.path) { - localStorage.setItem(newPath, '') - } + location.hash = newPath dialog.close() - vlocation.hash = newPath }) dialog.footerEl.replaceChildren( cancelBtn, confirmBtn