Skip to content

Commit

Permalink
#7 Styling improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
badsgahhl committed May 25, 2020
1 parent d68a47c commit 4f28dc7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/module/popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ body {
}

.card:nth-child(2) {
margin-bottom: 5px;
margin-top: 5px;
}

#current_url {
-webkit-transition: background-color 500ms ease;
}

.card-body {
Expand Down
30 changes: 28 additions & 2 deletions src/module/popup/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,34 @@ async function list_domain(mode: ApiListMode, buttonElement: HTMLButtonElement):
{
chrome.webRequest.onBeforeSendHeaders.removeListener(get_web_request_origin_modifier_callback);
}
// We wait 12 Seconds until we can assume that the pihole is back online.
setTimeout(() => toggle_list_button(buttonElement), 12000);

const response: string = this.response;
const current_url_element = document.getElementById('current_url');

/**
* Changing the background color depending on the status of adding the url.
* Orange: Url was skipped by PIHOLE
* Green: URL was added to the list.
*/
if (response.includes('skipped'))
{
toggle_list_button(buttonElement);
current_url_element.classList.add('bg-warning')
setTimeout(() => {
current_url_element.classList.remove('bg-warning');
}, 1500)
}
else if (response.includes('added'))
{
// We wait 3.5 Seconds until we can assume that the pihole is back online.
current_url_element.classList.add('bg-success')
setTimeout(function() {
current_url_element.classList.remove('bg-success');
}, 1500)
setTimeout(() => {
toggle_list_button(buttonElement);
}, 3500);
}
}
}
api_request.send().then();
Expand Down

0 comments on commit 4f28dc7

Please sign in to comment.