-
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.
#3 Add notifcation to inform injection init
- Loading branch information
1 parent
c4b1370
commit 013218b
Showing
3 changed files
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
htmlSnippetName: 'htmlSnippetName', | ||
positionGroupName: 'whereToInsertRB', | ||
loadAfterLoadCB: 'loadAfterLoadCB', | ||
toast: 'toast', | ||
}; | ||
const ELEMENTS_CLASSES = { | ||
urlInput: 'url-input', | ||
|
@@ -77,6 +78,9 @@ | |
'<script type="text/javascript" data-cubx-startevent="cubblesInjectionReady" src="https://cubbles.world/shared/[email protected]/crc-loader/js/main.js" data-crcinit-loadcif="true"></script>', | ||
}, | ||
]; | ||
const MESSAGES = { | ||
performingInjection: 'Performing injection' | ||
}; | ||
const DEFAULT_POSITION = 'end'; | ||
|
||
let currentAction = ''; | ||
|
@@ -98,6 +102,7 @@ | |
} | ||
|
||
function startInjection() { | ||
showNotification(MESSAGES.performingInjection); | ||
window.postMessageToBackgroundScript(MESSAGES_IDS.injectionPending); | ||
chrome.devtools.inspectedWindow.reload(); | ||
} | ||
|
@@ -544,6 +549,16 @@ | |
document.getElementById(ELEMENTS_IDS.loadAfterLoadCB).checked = shouldAutoInject(); | ||
} | ||
|
||
function showNotification(message) { | ||
const DURATION = 4000; // ms | ||
let toast = document.getElementById(ELEMENTS_IDS.toast); | ||
toast.classList.add('show'); | ||
toast.innerText = message; | ||
setTimeout(function(){ | ||
toast.classList.remove('show'); | ||
}, DURATION); | ||
} | ||
|
||
function addListeners () { | ||
document.getElementById(ELEMENTS_IDS.addScriptBtn).addEventListener('click', addNewScript); | ||
|
||
|