Avoid skip button conflicts
This commit is contained in:
parent
2b26fa1b2a
commit
43830fbc13
@ -136,7 +136,13 @@ introSkipper.injectCss = function () {
|
|||||||
* Calling this function is a no-op if the CSS has already been injected.
|
* Calling this function is a no-op if the CSS has already been injected.
|
||||||
*/
|
*/
|
||||||
introSkipper.injectButton = async function () {
|
introSkipper.injectButton = async function () {
|
||||||
if (introSkipper.testElement(".btnSkipIntro")) {
|
// Ensure the button we're about to inject into the page doesn't conflict with a pre-existing one
|
||||||
|
const preExistingButton = introSkipper.testElement("div.skipIntro");
|
||||||
|
if (preExistingButton) {
|
||||||
|
preExistingButton.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (introSkipper.testElement(".btnSkipIntro.injected")) {
|
||||||
introSkipper.d("Button already added");
|
introSkipper.d("Button already added");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -155,7 +161,7 @@ introSkipper.injectButton = async function () {
|
|||||||
button.classList.add("hide");
|
button.classList.add("hide");
|
||||||
button.addEventListener("click", introSkipper.doSkip);
|
button.addEventListener("click", introSkipper.doSkip);
|
||||||
button.innerHTML = `
|
button.innerHTML = `
|
||||||
<button is="paper-icon-button-light" class="btnSkipIntro paper-icon-button-light">
|
<button is="paper-icon-button-light" class="btnSkipIntro paper-icon-button-light injected">
|
||||||
<span id="btnSkipSegmentText"></span>
|
<span id="btnSkipSegmentText"></span>
|
||||||
<span class="material-icons skip_next"></span>
|
<span class="material-icons skip_next"></span>
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user