| Server IP : 104.21.21.239 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/banners/public_html/bway/ |
Upload File : |
(function () {
if (window.contestWidgetLoaded) {
console.log("Contest widget already loaded, skipping...");
return;
}
window.contestWidgetLoaded = true;
const currentScript = document.currentScript;
const scriptSrc = new URL(currentScript.src);
const contestId = scriptSrc.searchParams.get("id");
// Get source parameter from page URL, not script URL
const pageUrl = new URL(window.location.href);
const sourceParam = pageUrl.searchParams.get("source");
if (!contestId || isNaN(contestId)) {
const errorMsg = document.createElement("p");
errorMsg.textContent = "Invalid contest ID.";
currentScript.insertAdjacentElement("afterend", errorMsg);
return;
}
const container = document.createElement("div");
container.style.padding = "0px";
container.innerHTML = "Loading contest...";
currentScript.insertAdjacentElement("afterend", container);
// Inject styles
const style = document.createElement("style");
style.innerHTML = `
#contest-form {
font-family: system-ui, sans-serif;
max-width: 100%;
background: #f8f8f8;
padding: 20px;
border-radius: 8px;
border: 1px solid #ccc;
position: relative;
}
#contest-form label {
display: block;
margin-bottom: 10px;
font-weight: 600;
}
#contest-form input[type="text"],
#contest-form input[type="email"] {
width: 100%;
padding: 10px;
border-radius: 4px;
border: 1px solid #aaa;
box-sizing: border-box;
}
#contest-form button[type="submit"] {
background-color: #a40221;
color: #fff;
font-weight: bold;
padding: 12px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
#contest-form button[type="submit"]:hover {
background-color: #87001a;
}
.contest-confirmation {
font-family: system-ui, sans-serif;
max-width: 600px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background: #eaf7ea;
}
.contest-confirmation h3 {
margin-top: 0;
}
.contest-terms-link {
font-size: 12px;
display: block;
text-decoration: underline;
color: #555;
cursor: pointer;
}
.contest-terms-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.contest-terms-box {
background: #fff;
padding: 20px;
border-radius: 8px;
max-width: 600px;
max-height: 80vh;
overflow-y: auto;
}
.contest-terms-close {
margin-top: 10px;
display: inline-block;
cursor: pointer;
color: #a40221;
font-weight: bold;
}
.contesttext-wrapper {
max-height: 150px;
overflow: hidden;
position: relative;
transition: max-height 0.3s ease;
}
.contesttext-wrapper::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 50px;
background: linear-gradient(to bottom, rgba(255,255,255,0), #f8f8f8);
pointer-events: none;
}
.contesttext-toggle {
display: inline-block;
margin-top: 10px;
margin-bottom: 20px;
padding: 8px;
background-color: #a40221;
color: #fff;
border-radius: 4px;
font-size: 8px;
font-weight: bold;
text-transform: uppercase;
cursor: pointer;
border: none;
text-align: center;
transition: background-color 0.2s ease;
}
.contesttext-toggle:hover {
background-color: #87001a;
}
.contesttext-expanded {
max-height: none !important;
}
.contesttext-expanded::after {
display: none;
}
#contest-form .form-row {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
#contest-form .form-group {
flex: 1;
min-width: 200px;
}
@media (max-width: 600px) {
#contest-form .form-row {
flex-direction: column;
}
}
`;
document.head.appendChild(style);
// Load Turnstile script
function loadTurnstileScript(callback) {
if (window.turnstile) {
if (callback) callback();
return;
}
if (document.getElementById("cf-turnstile-script")) {
// Script is loading, wait for it
const checkInterval = setInterval(() => {
if (window.turnstile) {
clearInterval(checkInterval);
if (callback) callback();
}
}, 100);
return;
}
const turnstileScript = document.createElement("script");
turnstileScript.id = "cf-turnstile-script";
turnstileScript.src = "https://challenges.cloudflare.com/turnstile/v0/api.js";
turnstileScript.async = true;
turnstileScript.defer = true;
turnstileScript.onload = function() {
if (callback) callback();
};
document.head.appendChild(turnstileScript);
}
fetch(`https://data.broadwayworld.com/contestajax-small.php?action=load&id=${contestId}`)
.then((response) => response.text())
.then((html) => {
container.innerHTML = html;
loadTurnstileScript(function() {
addTurnstileWidget();
});
attachFormHandler();
attachTermsHandler();
waitForContestText();
});
function waitForContestText(retries = 10) {
const contestText = container.querySelector(".contesttext");
if (contestText) {
const wrapper = document.createElement("div");
wrapper.className = "contesttext-wrapper";
contestText.parentNode.insertBefore(wrapper, contestText);
wrapper.appendChild(contestText);
const toggle = document.createElement("span");
toggle.className = "contesttext-toggle";
toggle.textContent = "Show more";
wrapper.insertAdjacentElement("afterend", toggle);
toggle.addEventListener("click", () => {
wrapper.classList.toggle("contesttext-expanded");
toggle.textContent = wrapper.classList.contains("contesttext-expanded")
? "Show less"
: "Show more";
});
} else if (retries > 0) {
setTimeout(() => waitForContestText(retries - 1), 100); // retry if not ready
}
}
function addTurnstileWidget() {
const form = container.querySelector("#contest-form");
if (!form) return;
const submitButton = form.querySelector('button[type="submit"]');
if (!submitButton) return;
// Check if Turnstile widget already exists
if (form.querySelector(".cf-turnstile") || form.querySelector("[data-turnstile-widget-id]")) return;
const turnstileDiv = document.createElement("div");
submitButton.parentNode.insertBefore(turnstileDiv, submitButton);
// Use programmatic rendering to ensure single render
// This is called after Turnstile script has loaded (via callback)
if (window.turnstile && typeof window.turnstile.render === 'function') {
window.turnstile.render(turnstileDiv, {
sitekey: "0x4AAAAAAAxc6vmin0rUL241",
theme: "light"
});
}
}
function attachFormHandler() {
const form = container.querySelector("#contest-form");
if (!form) return;
form.addEventListener("submit", function (e) {
e.preventDefault();
// Get Turnstile token - Turnstile automatically creates this hidden input
const turnstileResponse = form.querySelector('input[name="cf-turnstile-response"]');
if (!turnstileResponse || !turnstileResponse.value) {
alert("Please complete the verification challenge.");
return;
}
const formData = new FormData(form);
formData.append("contestid", contestId);
// Include source parameter if it was provided in the page URL
if (sourceParam) {
formData.append("source", sourceParam);
}
fetch(`https://data.broadwayworld.com/contestajax-small.php?action=submit`, {
method: "POST",
body: formData,
})
.then((response) => response.text())
.then((result) => {
container.innerHTML = result;
reloadTwitterWidgets();
reloadFacebookSDK();
})
.catch((error) => {
console.error("Form submission error:", error);
alert("An error occurred. Please try again.");
});
});
}
function attachTermsHandler() {
const termsLink = container.querySelector(".contest-terms-link");
if (!termsLink) return;
termsLink.addEventListener("click", function () {
fetch(`https://data.broadwayworld.com/contestajax-small.php?action=terms&id=${contestId}`)
.then((res) => res.text())
.then((termsHTML) => {
const overlay = document.createElement("div");
overlay.className = "contest-terms-overlay";
const box = document.createElement("div");
box.className = "contest-terms-box";
box.innerHTML = termsHTML + '<br><span class="contest-terms-close">Close</span>';
overlay.appendChild(box);
document.body.appendChild(overlay);
box.querySelector(".contest-terms-close").addEventListener("click", () => {
document.body.removeChild(overlay);
});
});
});
}
function reloadTwitterWidgets() {
if (window.twttr && window.twttr.widgets && typeof window.twttr.widgets.load === "function") {
window.twttr.widgets.load();
} else {
const script = document.createElement("script");
script.src = "https://platform.twitter.com/widgets.js";
script.async = true;
script.charset = "utf-8";
document.head.appendChild(script);
}
}
function reloadFacebookSDK() {
if (window.FB && typeof FB.XFBML === "object" && typeof FB.XFBML.parse === "function") {
FB.XFBML.parse();
} else if (!document.getElementById("facebook-jssdk")) {
const fbRoot = document.createElement("div");
fbRoot.id = "fb-root";
document.body.appendChild(fbRoot);
const fbScript = document.createElement("script");
fbScript.id = "facebook-jssdk";
fbScript.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v16.0";
fbScript.async = true;
document.head.appendChild(fbScript);
}
}
})();