-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d8f9a3
commit e2b9681
Showing
8 changed files
with
159 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const s = (el) => document.querySelector(el); | ||
|
||
const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html); | ||
|
||
const getLang = () => | ||
(localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang) | ||
.slice(0, 2) | ||
.toLowerCase(); | ||
|
||
const main = () => { | ||
const Translate = { | ||
Data: { | ||
['page-not-found']: { | ||
en: 'Page not found', | ||
es: 'Página no encontrada', | ||
}, | ||
['page-broken']: { | ||
es: 'Algo salio mal', | ||
en: 'Something went wrong', | ||
}, | ||
['back']: { | ||
en: 'Back to <br> homepage', | ||
es: 'Volver a <br> la pagina principal', | ||
}, | ||
}, | ||
Render: function (id) { | ||
return this.Data[id][getLang()] ? this.Data[id][getLang()] : this.Data[id]['en']; | ||
}, | ||
}; | ||
const icon = html` | ||
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24"> | ||
<path | ||
fill="currentColor" | ||
d="M15.097 5.904A6.5 6.5 0 0 0 4 10.504l.001 1h-2v-1a8.5 8.5 0 1 1 15.176 5.258l5.344 5.345l-1.414 1.414l-5.344-5.345A8.48 8.48 0 0 1 10.5 19h-1v-2h1a6.5 6.5 0 0 0 4.596-11.096M1.672 13.257L4.5 16.086l2.829-2.829l1.414 1.415L5.915 17.5l2.828 2.828l-1.414 1.415L4.5 18.914l-2.828 2.829l-1.414-1.415L3.086 17.5L.258 14.672z" | ||
/> | ||
</svg> | ||
`; | ||
append( | ||
'body', | ||
html` <style> | ||
body { | ||
font-family: arial; | ||
font-size: 20px; | ||
background-color: #d8d8d8; | ||
color: #333; | ||
} | ||
a { | ||
color: black; | ||
} | ||
</style> | ||
<div class="abs center" style="top: 45%"> | ||
${icon} | ||
<br /> | ||
<br /> | ||
<span class="bold">404</span> | ||
<br /> | ||
<br />${Translate.Render('page-not-found')} <br /> | ||
<br /> | ||
<a href="${location.origin}">${Translate.Render('back')}</a> | ||
</div>`, | ||
); | ||
}; | ||
|
||
SrrComponent = () => html`<script> | ||
{ | ||
const s = ${s}; | ||
const append = ${append}; | ||
const getLang = ${getLang}; | ||
const main = ${main}; | ||
window.onload = main; | ||
} | ||
</script>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
const s = (el) => document.querySelector(el); | ||
|
||
const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html); | ||
|
||
const getLang = () => | ||
(localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang) | ||
.slice(0, 2) | ||
.toLowerCase(); | ||
|
||
const main = () => { | ||
const Translate = { | ||
Data: { | ||
['page-not-found']: { | ||
en: 'Page not found', | ||
es: 'Página no encontrada', | ||
}, | ||
['page-broken']: { | ||
es: 'Algo salio mal', | ||
en: 'Something went wrong', | ||
}, | ||
['back']: { | ||
en: 'Back to <br> homepage', | ||
es: 'Volver a <br> la pagina principal', | ||
}, | ||
}, | ||
Render: function (id) { | ||
return this.Data[id][getLang()] ? this.Data[id][getLang()] : this.Data[id]['en']; | ||
}, | ||
}; | ||
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20"> | ||
<path | ||
fill="currentColor" | ||
d="M6 2a2 2 0 0 0-2 2v5.207a5.5 5.5 0 0 1 1-.185V4a1 1 0 0 1 1-1h4v3.5A1.5 1.5 0 0 0 11.5 8H15v8a1 1 0 0 1-1 1h-3.6a5.5 5.5 0 0 1-.657 1H14a2 2 0 0 0 2-2V7.414a1.5 1.5 0 0 0-.44-1.06l-3.914-3.915A1.5 1.5 0 0 0 10.586 2zm8.793 5H11.5a.5.5 0 0 1-.5-.5V3.207zM10 14.5a4.5 4.5 0 1 1-9 0a4.5 4.5 0 0 1 9 0M5.5 12a.5.5 0 0 0-.5.5v2a.5.5 0 0 0 1 0v-2a.5.5 0 0 0-.5-.5m0 5.125a.625.625 0 1 0 0-1.25a.625.625 0 0 0 0 1.25" | ||
/> | ||
</svg>`; | ||
|
||
append( | ||
'body', | ||
html` <style> | ||
body { | ||
font-family: arial; | ||
font-size: 20px; | ||
background-color: #d8d8d8; | ||
color: #333; | ||
} | ||
a { | ||
color: black; | ||
} | ||
</style> | ||
<div class="abs center" style="top: 45%"> | ||
${icon} | ||
<br /> | ||
<br /> | ||
<span class="bold">500</span> | ||
<br /> | ||
<br />${Translate.Render('page-broken')} <br /> | ||
<br /> | ||
<a href="${location.origin}">${Translate.Render('back')}</a> | ||
</div>`, | ||
); | ||
}; | ||
|
||
SrrComponent = () => html`<script> | ||
{ | ||
const s = ${s}; | ||
const append = ${append}; | ||
const getLang = ${getLang}; | ||
const main = ${main}; | ||
window.onload = main; | ||
} | ||
</script>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters