-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #663 from grafana/feat/655-dismiss-dialog
undefined
- Loading branch information
Showing
3 changed files
with
109 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html lang="en"> | ||
<head></head> | ||
<body> | ||
<div id='textField'>Hello World</div> | ||
<br /> | ||
<button id="clickHere" onclick="window.location.reload();">click here</button> | ||
|
||
<script> | ||
const queryString = window.location.search; | ||
const urlParams = new URLSearchParams(queryString); | ||
const dialogType = urlParams.get('dialogType'); | ||
const div = document.getElementById('textField'); | ||
|
||
switch(dialogType) { | ||
case "alert": | ||
alert("Click accept"); | ||
div.textContent = 'alert dismissed'; | ||
break; | ||
case "confirm": | ||
confirm("Click accept"); | ||
div.textContent = 'confirm dismissed'; | ||
break; | ||
case "prompt": | ||
prompt("Add text and then click accept"); | ||
div.textContent = 'prompt dismissed'; | ||
break; | ||
case "beforeunload": | ||
window.addEventListener('beforeunload', (event) => { | ||
event.returnValue = "Are you sure you want to leave?"; | ||
}); | ||
div.textContent = 'beforeunload dismissed'; | ||
break; | ||
} | ||
</script> | ||
</body> | ||
</html> |