forked from microsoft/playwright
-
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.
- Loading branch information
Showing
12 changed files
with
273 additions
and
2 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 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 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 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,62 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Interstitial test</title> | ||
</head> | ||
<body> | ||
<style> | ||
body { | ||
position: relative; | ||
} | ||
#interstitial { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 300px; | ||
height: 300px; | ||
border: 1px solid black; | ||
background: rgba(255, 180, 180); | ||
display: none; | ||
} | ||
#interstitial.visible { | ||
display: block; | ||
} | ||
#close { | ||
margin: 50px; | ||
} | ||
</style> | ||
<div><button id="target">Click me</button></div> | ||
<div id="aside">A place on the side to hover</div> | ||
<div id="interstitial"> | ||
<div>This interstitial covers the button</div> | ||
<button id="close">Close the interstitial</button> | ||
</div> | ||
<script> | ||
const target = document.querySelector('#target'); | ||
const interstitial = document.querySelector('#interstitial'); | ||
const close = document.querySelector('#close'); | ||
|
||
target.addEventListener('click', () => { | ||
window.clicked = (window.clicked ?? 0) + 1; | ||
}, false); | ||
|
||
close.addEventListener('click', () => interstitial.classList.remove('visible')); | ||
|
||
let timesToShow = 0; | ||
function setupAnnoyingInterstitial(event, capture, times) { | ||
timesToShow = times; | ||
const listener = () => { | ||
timesToShow--; | ||
interstitial.classList.add('visible'); | ||
interstitial.getBoundingClientRect(); | ||
if (!timesToShow && event !== 'none') | ||
target.removeEventListener(event, listener, capture === 'capture'); | ||
}; | ||
if (event === 'none') | ||
listener(); | ||
else | ||
target.addEventListener(event, listener, capture === 'capture'); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.