diff --git a/public/css/style.scss b/public/css/style.scss index 0162037b6..926757af6 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -75,6 +75,31 @@ a:hover { top: -5rem; } +#backgroundLoader{ + height: 3px; + position: fixed; + width: 100%; + background: var(--main-color); + animation-name: loader; + animation-iteration-count: infinite; + animation-duration: 2s; + animation-timing-function: cubic-bezier(0.38, 0.16, 0.57, 0.82); +} + +@keyframes loader{ + 0%{ + width: 0; + left: 0; + } + 50%{ + width:100%; + left: 0; + } + 100%{ + width: 0; + left: 100%; + } +} #tagsWrapper{ width: 100%; diff --git a/public/index.html b/public/index.html index 8eaa177a1..90c539a1c 100644 --- a/public/index.html +++ b/public/index.html @@ -28,6 +28,7 @@ + diff --git a/public/js/script.js b/public/js/script.js index a9937b1a1..99f11d8ab 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1315,6 +1315,14 @@ function hideEditTags(){ } } +function showBackgroundLoader(){ + $("#backgroundLoader").stop(true,true).fadeIn(125); +} + +function hideBackgroundLoader(){ + $("#backgroundLoader").stop(true,true).fadeOut(125); +} + $("#tagsWrapper").click(e => { if($(e.target).attr('id') === "tagsWrapper"){ hideEditTags(); @@ -1327,7 +1335,9 @@ $("#tagsWrapper #tagsEdit .button").click(e => { let tagid = $("#tagsWrapper #tagsEdit").attr('tagid'); hideEditTags(); if(action === "add"){ + showBackgroundLoader(); addTag({uid:firebase.auth().currentUser.uid,name:inputVal}).then(e => { + hideBackgroundLoader(); let status = e.data.resultCode; if(status === 1){ showNotification('Tag added',2000); @@ -1344,7 +1354,9 @@ $("#tagsWrapper #tagsEdit .button").click(e => { } }) }else if(action === "edit"){ + showBackgroundLoader(); editTag({uid:firebase.auth().currentUser.uid,name:inputVal,tagid:tagid}).then(e => { + hideBackgroundLoader(); let status = e.data.resultCode; if(status === 1){ showNotification('Tag updated',2000); @@ -1362,7 +1374,9 @@ $("#tagsWrapper #tagsEdit .button").click(e => { } }) }else if(action === "remove"){ + showBackgroundLoader(); removeTag({uid:firebase.auth().currentUser.uid,tagid:tagid}).then(e => { + hideBackgroundLoader(); let status = e.data.resultCode; if(status === 1){ showNotification('Tag removed',2000);