-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 06731d7 🚀
- Loading branch information
1 parent
4e36ec3
commit b0b61b3
Showing
6 changed files
with
114 additions
and
73 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 was deleted.
Oops, something went wrong.
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,49 @@ | ||
function setRole(role) { | ||
chrome.runtime.sendMessage({ | ||
action: "setRole", | ||
role: role | ||
|
||
}, function (response) { | ||
console.log("Response:", response); | ||
}); | ||
} | ||
|
||
// Select the radio buttons | ||
var radio1 = document.getElementById('set-role-1'); | ||
var radio2 = document.getElementById('set-role-2'); | ||
|
||
// Add event listener to the first radio button | ||
radio1.addEventListener('change', function () { | ||
if (this.checked) { | ||
console.log('Decision maker selected'); | ||
setRole(this.value); | ||
console.log('this.value: ', this.value); | ||
appendAlert('Role is set!', 'success'); | ||
} | ||
}); | ||
|
||
// Add event listener to the second radio button | ||
radio2.addEventListener('change', function () { | ||
if (this.checked) { | ||
console.log('Normal user selected'); | ||
setRole(this.value); | ||
console.log('this.value: ', this.value); | ||
appendAlert('Role is set!', 'success'); | ||
} | ||
}); | ||
|
||
const alertPlaceholder = document.getElementById('liveAlertPlaceholder') | ||
const appendAlert = (message, type) => { | ||
const wrapper = document.createElement('div') | ||
wrapper.innerHTML = [ | ||
`<div class="alert alert-${type} alert-dismissible mt-5" role="alert">`, | ||
` <div>${message}</div>`, | ||
'</div>' | ||
].join('') | ||
|
||
alertPlaceholder.append(wrapper); | ||
|
||
setTimeout(() => { | ||
wrapper.remove() | ||
}, 5000) | ||
} |
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