|
| 1 | +export default async function () { |
| 2 | + let alertedBefore = await ScratchTools.storage.get("steBlAlert"); |
| 3 | + await ScratchTools.storage.set({ key: "steBlAlert", value: false }); |
| 4 | + await ScratchTools.waitForElement("script.blocklive-ext"); |
| 5 | + if (!alertedBefore) { |
| 6 | + let div = document.createElement("div") |
| 7 | + div.className = "ste-bl-together-bg" |
| 8 | + |
| 9 | + let innerDiv = document.createElement("div") |
| 10 | + innerDiv.className = "ste-bl-together" |
| 11 | + div.appendChild(innerDiv) |
| 12 | + |
| 13 | + let img = document.createElement("img") |
| 14 | + img.src = ScratchTools.dir + "/api/blocklive-detection/extensions.svg" |
| 15 | + |
| 16 | + let h3 = document.createElement("h3") |
| 17 | + let span1 = document.createElement("span") |
| 18 | + span1.textContent = "You're Using" |
| 19 | + let span2 = document.createElement("span") |
| 20 | + span2.style.color = "#ff9f00" |
| 21 | + span2.style.fontWeight = "800" |
| 22 | + span2.textContent = " ScratchTools " |
| 23 | + let span3 = document.createElement("span") |
| 24 | + span3.textContent = "and" |
| 25 | + let span4 = document.createElement("span") |
| 26 | + span4.style.color = "#cf63cf" |
| 27 | + span4.style.fontWeight = "800" |
| 28 | + span4.textContent = " Blocklive " |
| 29 | + let span5 = document.createElement("span") |
| 30 | + span5.textContent = "Together!" |
| 31 | + h3.append(span1, span2, span3, span4, span5) |
| 32 | + |
| 33 | + let p = document.createElement("p") |
| 34 | + p.textContent = "Thanks for using both extensions! If you experience any issues, please do reach out!" |
| 35 | + |
| 36 | + innerDiv.appendChild(img) |
| 37 | + innerDiv.appendChild(h3) |
| 38 | + innerDiv.appendChild(p) |
| 39 | + document.body.appendChild(div) |
| 40 | + |
| 41 | + let button = document.createElement("button") |
| 42 | + button.addEventListener("click", async function() { |
| 43 | + div.remove() |
| 44 | + await ScratchTools.storage.set({ key: "steBlAlert", value: true }); |
| 45 | + }) |
| 46 | + button.textContent = "Close" |
| 47 | + innerDiv.appendChild(button) |
| 48 | + |
| 49 | + let link = document.createElement("link") |
| 50 | + link.rel = "stylesheet" |
| 51 | + link.href = ScratchTools.dir + "/api/blocklive-detection/style.css" |
| 52 | + document.head.appendChild(link) |
| 53 | + |
| 54 | + setInterval(function() { |
| 55 | + div.style.backgroundImage = `linear-gradient(${Math.round(Date.now() / 10) - (Math.floor(Math.round(Date.now() / 10) / 360) * 360).toString()}deg, #cf63cf, #cf63cf20, #ff9f00, #ff9f0020)` |
| 56 | + }, 10) |
| 57 | + } |
| 58 | +} |
0 commit comments