mirror of
https://github.com/pldubouilh/gossa.git
synced 2026-08-28 04:46:58 -04:00
notification connection issues
This commit is contained in:
+10
-5
@@ -18,6 +18,7 @@ const picsHolder = document.getElementById('picsHolder')
|
|||||||
const icHolder = document.getElementById('icHolder')
|
const icHolder = document.getElementById('icHolder')
|
||||||
const manualUpload = document.getElementById('clickupload')
|
const manualUpload = document.getElementById('clickupload')
|
||||||
const okBadge = document.getElementById('ok')
|
const okBadge = document.getElementById('ok')
|
||||||
|
const sadBadge = document.getElementById('sad')
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
let allA
|
let allA
|
||||||
@@ -28,9 +29,8 @@ const getArrowSelected = () => document.querySelector('.arrow-selected')
|
|||||||
const getASelected = () => !getArrowSelected() ? false : getArrowSelected().parentElement.parentElement.querySelectorAll('a')[0]
|
const getASelected = () => !getArrowSelected() ? false : getArrowSelected().parentElement.parentElement.querySelectorAll('a')[0]
|
||||||
const prependPath = a => a.startsWith('/') ? a : decodeURI(location.pathname) + a
|
const prependPath = a => a.startsWith('/') ? a : decodeURI(location.pathname) + a
|
||||||
const prevent = e => e.preventDefault()
|
const prevent = e => e.preventDefault()
|
||||||
const okBageFlicker = () => okBadge.classList.remove('runFade') || void okBadge.offsetWidth || okBadge.classList.add('runFade')
|
const flicker = w => w.classList.remove('runFade') || void w.offsetWidth || w.classList.add('runFade')
|
||||||
|
|
||||||
window.ok = okBageFlicker
|
|
||||||
// Add upload icon on phones
|
// Add upload icon on phones
|
||||||
if (typeof window.orientation !== 'undefined') {
|
if (typeof window.orientation !== 'undefined') {
|
||||||
icHolder.innerHTML = '<div onclick="document.getElementById(\'clickupload\').click()" class="ic icon-large-upload"></div>' + icHolder.innerHTML
|
icHolder.innerHTML = '<div onclick="document.getElementById(\'clickupload\').click()" class="ic icon-large-upload"></div>' + icHolder.innerHTML
|
||||||
@@ -40,7 +40,7 @@ if (typeof window.orientation !== 'undefined') {
|
|||||||
manualUpload.addEventListener('change', () => Array.from(manualUpload.files).forEach(f => postFile(f, '/' + f.name)), false)
|
manualUpload.addEventListener('change', () => Array.from(manualUpload.files).forEach(f => postFile(f, '/' + f.name)), false)
|
||||||
|
|
||||||
// Soft nav
|
// Soft nav
|
||||||
function browseTo (href) {
|
function browseTo (href, flickerDone) {
|
||||||
fetch(href, { credentials: 'include' }).then(r => r.text().then(t => {
|
fetch(href, { credentials: 'include' }).then(r => r.text().then(t => {
|
||||||
const parsed = new DOMParser().parseFromString(t, 'text/html')
|
const parsed = new DOMParser().parseFromString(t, 'text/html')
|
||||||
const table = parsed.querySelectorAll('table')[0].innerHTML
|
const table = parsed.querySelectorAll('table')[0].innerHTML
|
||||||
@@ -54,8 +54,12 @@ function browseTo (href) {
|
|||||||
history.replaceState({}, '', encodeURI(title))
|
history.replaceState({}, '', encodeURI(title))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flickerDone) {
|
||||||
|
flicker(okBadge)
|
||||||
|
}
|
||||||
|
|
||||||
init()
|
init()
|
||||||
}))
|
})).catch(() => flicker(sadBadge))
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onClickLink = e => {
|
window.onClickLink = e => {
|
||||||
@@ -69,7 +73,7 @@ window.onClickLink = e => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const refresh = () => browseTo(location.href) || okBageFlicker()
|
const refresh = () => browseTo(location.href, true)
|
||||||
const prevPage = (url) => picsOff() || browseTo(url || (location.href + '../'))
|
const prevPage = (url) => picsOff() || browseTo(url || (location.href + '../'))
|
||||||
window.onpopstate = () => prevPage(location.href)
|
window.onpopstate = () => prevPage(location.href)
|
||||||
|
|
||||||
@@ -81,6 +85,7 @@ function rpcFs (call, args, cb) {
|
|||||||
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')
|
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')
|
||||||
xhr.send(JSON.stringify({ call, args }))
|
xhr.send(JSON.stringify({ call, args }))
|
||||||
xhr.onload = cb
|
xhr.onload = cb
|
||||||
|
xhr.onerror = () => flicker(sadBadge)
|
||||||
}
|
}
|
||||||
|
|
||||||
const mkdirCall = (path, cb) => rpcFs('mkdirp', [prependPath(path)], cb)
|
const mkdirCall = (path, cb) => rpcFs('mkdirp', [prependPath(path)], cb)
|
||||||
|
|||||||
+6
-3
@@ -11,6 +11,9 @@
|
|||||||
td.display-name {
|
td.display-name {
|
||||||
padding-left: 1em !important;
|
padding-left: 1em !important;
|
||||||
}
|
}
|
||||||
|
#icHolder {
|
||||||
|
top: 20px !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@@ -199,10 +202,10 @@ h1 {
|
|||||||
animation: fade 3s 1;
|
animation: fade 3s 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ok {
|
.notif {
|
||||||
opacity:0;
|
opacity:0;
|
||||||
width: 60px;
|
width: 80px;
|
||||||
height: 60px;
|
height: 80px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
right: 30px;
|
right: 30px;
|
||||||
|
|||||||
+2
-1
@@ -55,5 +55,6 @@
|
|||||||
<span id="dlBarName"></span>
|
<span id="dlBarName"></span>
|
||||||
<div id="dlBarPc">1%</div>
|
<div id="dlBarPc">1%</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="ok" class="icon-large-ok"></div>
|
<div id="ok" class="notif icon-large-ok"></div>
|
||||||
|
<div id="sad" class="notif icon-large-sad-server"></div>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user