var woo_appProperties = (function() {
var woo_appProperties_Global = {};
var self = document.getElementById('woo_appProperties');
self.classList.add("woo-ui-gadget");
woo_appProperties_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded woo_appProperties");
}
return woo_appProperties_Global;
})();var gkxwvsqf_202382832611_482 = (function() {
var self = document.getElementById('gkxwvsqf_202382832611_482');
var gkxwvsqf_202382832611_482_Global = {};
gkxwvsqf_202382832611_482_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382832611_482");
}
return gkxwvsqf_202382832611_482_Global;
})();var gkxwvsqf_202382815548_61 = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_61');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_61_Global = {};
gkxwvsqf_202382815548_61_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_61");
}
return gkxwvsqf_202382815548_61_Global;
})();var gkxwvsqf_202442913326_160 = (function() {
var self = document.getElementById('gkxwvsqf_202442913326_160');
var gkxwvsqf_202442913326_160_Global = {};
gkxwvsqf_202442913326_160_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202442913326_160");
}
var pageData = {};
var subPages = document.querySelector("#gkxwvsqf_202442913326_160subPages");
var isSelected = false;
var subPageLimit = 10000;
gkxwvsqf_202442913326_160_Global.selected = () => {
//console.log("gadget selected");
gadgetSelected();
isSelected = true;
}
function gadgetSelected(){
console.log("running select");
document.querySelectorAll(".woo_childPageP").forEach(function(element){
//console.log(element.id);
element.contentEditable = 'true';
element.addEventListener("focusout", function(){
if (pageData[element.id]) {
pageData[element.id].description = element.innerHTML;
} else {
pageData[element.id] = { "description" : element.innerHTML };
}
savePageData();
});
});
document.querySelectorAll(".woo_childPageSpan").forEach(function(element){
var imgProps = document.createElement('span');
imgProps.className = "pageChildren-material-symbols-outlined";
imgProps.classList.add("woo_childPageImgProp");
imgProps.append("settings");
element.appendChild(imgProps);
var pageId = element.getAttribute("pageid");
imgProps.addEventListener("click", imageSelector.bind(this, pageId));
});
}
function updateImage(pageId, image){
if (pageData[pageId]) {
pageData[pageId].image = image;
} else {
pageData[pageId] = { "image" : image };
}
savePageData();
}
gkxwvsqf_202442913326_160_Global.unselect = () => {
//console.log("gadget unselected");
isSelected = false;
document.querySelectorAll(".woo_childPageP").forEach(function(element){
element.contentEditable = 'false';
})
document.querySelectorAll(".woo_childPageImgProp").forEach(function(element){
element.remove();
});
}
//var dateBeingSaved = false;
function savePageData(){
//dateBeingSaved = true;
woo.updateGadgetProperty("gkxwvsqf_202442913326_160", woo.instanceDB, "pageData", pageData, woo.getCurrentPage()).then(() => {
console.log("Page Data Updated");
woo.showGadget("gkxwvsqf_202442913326_160").then(() => {
var gadgetID = $("#gkxwvsqf_202442913326_160").attr('class').split(' ')[0];
property_toolbar.getProperties(gadgetID, "gkxwvsqf_202442913326_160");
});
}).catch((err) => {
console.error(err);
alert("Value not saved!");
});
}
function loadSubPages() {
return new Promise((resolve, reject) => { // Ensure this promise is returned
var parentPage = woo.getCurrentPage();
if ("" != ""){
parentPage = "";
}
woo.getDoc(woo.appDB, parentPage).then((doc) => {
var childIDs = doc.childPageIDs;
//console.log(childIDs);
var subPageLimitCount = 1;
var promises = Object.entries(childIDs).map((child) => {
if (subPageLimitCount <= subPageLimit){
subPageLimitCount = subPageLimitCount + 1;
return woo.getDoc(woo.appDB, child[1]).then((docChild) => {
//console.log(docChild);
if (docChild.hidden == false) {
var pageName = docChild.pageName;
var description = "Edit this description...";
if (docChild.metaDescription) {
description = docChild.metaDescription.replaceAll(".", ". ").replaceAll(". ", ". ").replaceAll(". . . ", "...");
}
if (pageData[docChild._id]) {
if (pageData[docChild._id].description){
description = pageData[docChild._id].description;
}
}
var url = docChild._id;
if (docChild.linked == true) {
if (docChild.linkURL != "") {
url = docChild.linkURL;
} else {
url = docChild.linkID;
}
}
var childSpan = document.createElement('span');
childSpan.id = docChild._id + "_span";
childSpan.setAttribute('pageid', docChild._id);
childSpan.className = "woo_childPageSpan";
if (pageData[docChild._id]) {
if (pageData[docChild._id].image) {
var childImg = document.createElement('div');
childImg.className = "woo_childPageImg";
childImg.style.backgroundImage = "url('" + pageData[docChild._id].image + "')";
childSpan.appendChild(childImg);
}
}
var childH2 = document.createElement('h2');
childH2.className = "woo_childPageH2";
childH2.addEventListener('click', function() {
if (docChild.linked == "true") {
if (docChild.linkID != "") {
Promise.all([woo.updateCurrentPage(url)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
} else {
window.location = url;
}
} else {
Promise.all([woo.updateCurrentPage(url)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
}
});
childH2.innerHTML = pageName;
childSpan.appendChild(childH2);
var childP = document.createElement('div');
childP.id = docChild._id;
childP.className = "woo_childPageP";
childP.innerHTML = description;
childSpan.appendChild(childP);
if ("true" == "true") {
var childButton = document.createElement('span');
childButton.className = "woo_childPageButton";
childButton.innerHTML = "Find Out More";
childButton.addEventListener('click', function() {
if (docChild.linked == "true") {
if (docChild.linkID != "") {
//woo.updateCurrentPage(url);
Promise.all([woo.updateCurrentPage(url)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
} else {
window.location = url;
}
} else {
//woo.updateCurrentPage(url);
Promise.all([woo.updateCurrentPage(url)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
}
});
childSpan.appendChild(childButton);
}
subPages.appendChild(childSpan);
}
});
}
});
// Ensure all promises from the map are resolved before resolving the main promise
Promise.all(promises).then(() => {
resolve("done");
}).catch(reject);
}).catch(reject);
});
}
function getSubPages() {
woo.getGadgetProperty("gkxwvsqf_202442913326_160", woo.instanceDB, "pageData").then((results) => {
if (results) {
pageData = results;
//console.log(pageData);
loadSubPages().then((results) => {
if (isSelected){
gadgetSelected();
}
}).catch((error) => {
console.error("Error loading sub pages:", error);
});
} else {
loadSubPages().then((results) => {
if (isSelected){
gadgetSelected();
}
}).catch((error) => {
console.error("Error loading sub pages:", error);
});
}
}).catch((error) => {
console.error("Error getting gadget property:", error);
});
}
getSubPages();
function closeButtonPressed(){
$(".woo-dialogBox").remove();
}
function makeModal(content){
var dialogBox = document.createElement('div');
dialogBox.className = "woo-dialogBox";
document.getElementsByClassName("wooMainContent")[0].appendChild(dialogBox);
var closeBox = document.createElement('button');
closeBox.className = 'woo-dialogClose';
closeBox.classList.add('prop-tb-material-symbols-outlined');
closeBox.addEventListener('click', closeButtonPressed);
var dialogContent = document.createElement('div');
dialogContent.className = "woo-dialogContent";
dialogContent.appendChild(closeBox);
dialogContent.appendChild(content);
dialogBox.appendChild(dialogContent);
}
function imageSelector(pageId){
//console.log("got here");
$(".woo-dialogBox").remove();
var form = document.createElement('div');
var title = document.createElement('span');
title.className = "dialog_title";
title.textContent = "Upload Image";
form.appendChild(title);;
var span1 = document.createElement('span');
form.appendChild(span1);
var label1 = document.createElement('label');
label1.textContent = "Select Image:";
span1.appendChild(label1);
var idInput = document.createElement('input');
idInput.className = "file_upload_input";
idInput.type = "file";
//idInput.setAttribute("multiple","");
idInput.required = "true";
span1.appendChild(idInput);
var span2 = document.createElement('span');
form.appendChild(span2);
var submitInput = document.createElement('input');
submitInput.type = "button";
submitInput.value = "Upload";
submitInput.addEventListener('click', uploadImage.bind(this, form, idInput, pageId));
form.appendChild(submitInput);
makeModal(form);
}
function uploadImage(form, idInput, pageId){
var imageFile = "";
var formData = new FormData();
formData.append("name", "Images");
for(let i=0; i < idInput.files.length; i++) {
formData.append("files", idInput.files[i]);
imageFile = idInput.files[i].name;
}
uploadFiles(formData).then((response) => {
console.log(response);
updateImage(pageId, "/resources/squashnz/uploads/" + imageFile);
alert(response);
$(".woo-dialogBox").remove();
}).catch((error) => {
console.log(error);
alert("Something went wrong");
});
}
function uploadFiles(formData) {
return $.ajax({
type: "POST",
url: woo.getAuthServer() + "/app/upload_Files",
headers: {
//"Content-Type": "multipart/form-data",
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
processData: false,
contentType: false,
crossDomain: true,
cache: false,
data: formData,
timeout: 10000
});
}
return gkxwvsqf_202442913326_160_Global;
})();var gkxwvsqf_202382802446_71146n = (function() {
var self = document.getElementById('gkxwvsqf_202382802446_71146n');
var gkxwvsqf_202382802446_71146n_Global = {};
var unloadPromise;
gkxwvsqf_202382802446_71146n_Global.unload = () => {
return new Promise((resolve, reject) => {
//Unload callbacks here
if (unloadPromise){
unloadPromise.then(() => {
resolve("done");
}).catch((error) => {
reject(error);
});
} else {
resolve("done");
}
woo.events.off("Page Added", recreate);
woo.events.off("Page Deleted", recreate);
woo.events.off("Page Hidden", recreate);
woo.events.off("Page Unhidden", recreate);
woo.events.off("Page Linked", recreate);
woo.events.off("Page Unlinked", recreate);
woo.events.off("Page Order Updated", recreate);
woo.events.off("Page Parent Updated", recreate);
woo.events.off("Page pageName Updated", recreate);
console.log("Unloaded gkxwvsqf_202382802446_71146n");
});
}
woo.events.on("Page Added", recreate);
woo.events.on("Page Deleted", recreate);
woo.events.on("Page Hidden", recreate);
woo.events.on("Page Unhidden", recreate);
woo.events.on("Page Linked", recreate);
woo.events.on("Page Unlinked", recreate);
woo.events.on("Page Order Updated", recreate);
woo.events.on("Page Parent Updated", recreate);
woo.events.on("Page pageName Updated", recreate);
function recreate(){
unloadPromise = createFullULMenu().then(() => {
console.log("boy oh boy a lincoln toy!");
createFullULMenu();
}).catch((error) => {
console.log("Menu not created! " + error);
});
}
$("#mob_icon_gkxwvsqf_202382802446_71146n").on("click", function(){
$("#mainMenuContent_gkxwvsqf_202382802446_71146n").toggle();
});
checkBuild();
gkxwvsqf_202382802446_71146n_Global.createMenu = () => {
createFullULMenu().then(() => {
}).catch((error) => {
console.error(error);
});
}
function checkBuild(){
return new Promise((resolve, reject) => {
woo.getGadgetProperty("gkxwvsqf_202382802446_71146n", woo.instanceDB, "toolbarBuild").then((propValue) => {
if (!propValue){
createFullULMenu();
}
resolve("done");
}).catch((error) => {
reject(error);
});
}).catch((error) => {
console.error(error);
});
}
var showPage ='home';
var pageCount = 0;
function getChildrenByKey(obj, key) {
if (obj[key]) {
return obj[key].children || {};
}
for (let k in obj) {
if (obj[k] && typeof obj[k] === 'object') {
const result = getChildrenByKey(obj[k].children || {}, key);
if (result) {
return result;
}
}
}
return null; // Key not found
}
function createFullULMenu(){
return new Promise((resolve, reject) => {
$("#mainMenuContent_gkxwvsqf_202382802446_71146n").empty();
var form = document.querySelector("#mainMenuContent_gkxwvsqf_202382802446_71146n");
var allHtml = {};
var pages = {};
var rootPage = "";
woo.getFullPageStructure().then((response) => {
//console.log(response);
if ("home" == "home"){
rootPage = Object.keys(response)[0];
pages = response[rootPage].children;
} else {
rootPage = Object.keys(response)[0];
pages = getChildrenByKey(response, "home");
//pages = response[rootPage].children["home"].children;
}
//console.log(pages);
var promises = Object.entries(pages).map((node) => {
if (node[1]["props"].hidden == false){
return createPageNode(node, 1).then((gadgetHtml) => {
allHtml[node[0]] = gadgetHtml;
});
}
});
return Promise.all(promises);
}).then(() => {
var pageListUL = document.createElement('ul');
pageListUL.className = "menuUl1";
if (Object.keys(allHtml).length != 0) {
Object.entries(pages).forEach((entry) => {
if (allHtml[entry[0]]){
pageListUL.appendChild(allHtml[entry[0]]);
}
});
}
form.appendChild(pageListUL);
var str = form.innerHTML;
woo.updateGadgetProperty("gkxwvsqf_202382802446_71146n", woo.instanceDB, "toolbarBuild", str, woo.getCurrentPage()).then(() => {
$(".menuClick_gkxwvsqf_202382802446_71146n").unbind();
$(".menuClick_gkxwvsqf_202382802446_71146n").on("click", function(){
if ($(this).attr("linked") == "true"){
if ($(this).attr("linkID") != ""){
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("linkID");
setTimeout(animatePageIn, 0);
} else {
window.location = $(this).attr("linkURL");
}
} else {
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("showPage");
setTimeout(animatePageIn, 0);
}
});
resolve("done");
}).catch((err) => {
//alert("Gadget value not saved! " + err);
reject(error);
});
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
function createPageNode(page, level){
return new Promise((resolve) => {
//create li
var pageLI = document.createElement('li');
if (level == 1){
pageLI.className = "menuLi1";
} else if (level == 2){
pageLI.className = "menuLi2";
} else {
pageLI.className = "menuLi3";
}
pageLI.classList.add("menuLlX");
var menuMouseOverID = page[0];
pageLI.id = menuMouseOverID;
if (level == 1){
var nameSpanOuter = document.createElement('span');
nameSpanOuter.className = "woo_menuName_outer";
var nameUnderLineSpan = document.createElement('span');
nameUnderLineSpan.className = "woo_menuName_underline";
nameUnderLineSpan.id = "woo_menuName_underline_" + page[0];
}
var nameSpan = document.createElement('button');
if (level == 1){
nameSpan.className = "woo_menuName";
} else {
nameSpan.className = "woo_subMenuName";
}
nameSpan.classList.add("menuClick_gkxwvsqf_202382802446_71146n");
console.log("pageCount: " + pageCount + ", odd/even: " + (pageCount % 2));
if ((pageCount % 2) != 1) {
nameSpan.classList.add("oddPage");
}
pageCount++;
nameSpan.innerText = page[1]["props"].name;
console.log(page[1]["props"].name + " : " + page[1]["props"].linked);
if (page[1]["props"].linked == "true" || page[1]["props"].linked == true){
nameSpan.setAttribute("linked", page[1]["props"].linked);
nameSpan.setAttribute("linkID", page[1]["props"].linkID);
nameSpan.setAttribute("linkURL", page[1]["props"].linkURL);
} else {
nameSpan.setAttribute("showPage", page[0]);
}
nameSpan.setAttribute("menuid", page[0]);
if (level == 1){
nameSpanOuter.appendChild(nameSpan);
nameSpanOuter.appendChild(nameUnderLineSpan);
pageLI.appendChild(nameSpanOuter);
} else {
pageLI.appendChild(nameSpan);
}
var childPagesHtml = {};
var children = page[1].children;
var subLevel = level + 1;
var promises = Object.entries(children).map((childNode) => {
if (subLevel <= 3){
if (childNode[1]["props"].hidden == false){
return createPageNode(childNode, subLevel).then((childHtml) => {
childPagesHtml[childNode[0]] = childHtml;
});
}
}
});
Promise.all(promises).then(() => {
if (Object.keys(page[1]["children"]).length != 0){
var pageListULNext = document.createElement('ul');
if (level == 1){
pageListULNext.className = "menuUl2";
} else {
pageListULNext.className = "menuUl3";
}
pageListULNext.classList.add("menuUlX");
var childCount = 0;
Object.entries(children).forEach((entry) => {
if (childPagesHtml[entry[0]]){
childCount++;
pageListULNext.appendChild(childPagesHtml[entry[0]]);
}
});
if (childCount > 0){
pageLI.appendChild(pageListULNext);
pageLI.classList.add("parentPage_gkxwvsqf_202382802446_71146n");
var chevronSpan = document.createElement('span');
chevronSpan.className = "material-symbols-outlined";
chevronSpan.classList.add("woo_chevron_span");
chevronSpan.append("arrow_forward_ios");
var newNameSpan = document.createElement('span');
newNameSpan.className = "woo_newName_span";
newNameSpan.append(nameSpan.innerText);
nameSpan.innerText = "";
nameSpan.append(newNameSpan);
nameSpan.appendChild(chevronSpan);
}
}
resolve(pageLI);
});
});
}
function cleanPageNameForUrl(pageName) {
// Convert to lowercase
let url = pageName.toLowerCase();
// Replace spaces with dashes
url = url.replace(/\s+/g, '-');
// Remove all special characters except dashes and alphanumeric characters
url = url.replace(/[^a-z0-9-]/g, '');
// Remove multiple consecutive dashes
url = url.replace(/-+/g, '-');
// Remove leading and trailing dashes
url = url.replace(/^-|-$/g, '');
return url;
}
var currentPageId = woo.getCurrentPage();
$("#gkxwvsqf_202382802446_71146n .woo_menuName").each(function(){
if (currentPageId == cleanPageNameForUrl($(this).text())){
$(this).css({"background-color": "#ffffff", "color" : "#b41c2e"});
}
});
$(".menuClick_gkxwvsqf_202382802446_71146n").on("click", function(){
if ($(this).attr("linked")){
if ($(this).attr("linkID") != ""){
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("linkID");
setTimeout(animatePageIn, 0);
} else {
window.location = $(this).attr("linkURL");
}
} else {
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("showPage");
setTimeout(animatePageIn, 0);
}
});
$("#gkxwvsqf_202382802446_71146n .parentPage_gkxwvsqf_202382802446_71146n .menuClick_gkxwvsqf_202382802446_71146n").unbind();
$("#gkxwvsqf_202382802446_71146n .parentPage_gkxwvsqf_202382802446_71146n").on("click", function(){
var burgerMenuId = $("#gkxwvsqf_202382802446_71146n").parents(".burger_menu").attr("id");
//var subMenuNode = $(this).children("li > ul");
var subMenu = this.querySelector("li > ul").cloneNode(true);
//var subMenu = subMenuNode.cloneNode(true);
console.log(burgerMenuId);
window[burgerMenuId].changeSubPage($(this).attr("id"), 'gkxwvsqf_202382802446_71146n', subMenu, 0, 0);
});
function animatePageIn() {
Promise.all([woo.updateCurrentPage(showPage)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
$('body').removeClass("pageAnimateIn").addClass("pageAnimateOut");
});
}
gkxwvsqf_202382802446_71146n_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202382802446_71146n .woo_menuName").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202382802446_71146n_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202382802446_71146n .woo_menuName").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202382802446_71146n_Global;
})();var gkxwvsqf_202392093827_711zkq = (function() {
var self = document.getElementById('gkxwvsqf_202392093827_711zkq');
var gkxwvsqf_202392093827_711zkq_Global = {};
gkxwvsqf_202392093827_711zkq_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("scroll", gkxwvsqf_202392093827_711zkqReveal);
console.log("Unloaded gkxwvsqf_202392093827_711zkq");
}
function gkxwvsqf_202392093827_711zkqReveal() {
var reveals = document.querySelector("#gkxwvsqf_202392093827_711zkq .reveal");
var windowHeight = window.innerHeight;
var elementTop = reveals.getBoundingClientRect().top;
var elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
reveals.classList.add("active");
self.classList.add("gkxwvsqf_202392093827_711zkqShadowReveal");
self.classList.remove("gkxwvsqf_202392093827_711zkqShadowRevealOff");
} else {
reveals.classList.remove("active");
self.classList.remove("gkxwvsqf_202392093827_711zkqShadowReveal");
self.classList.add("gkxwvsqf_202392093827_711zkqShadowRevealOff");
}
}
if ("home" != "" || "Change_Page" == "Open_Image_in_New_Window"){
$("#gkxwvsqf_202392093827_711zkq .mainImage").css("cursor", "pointer");
$("#gkxwvsqf_202392093827_711zkq .mainImage").on("click", function(){
switch ("Change_Page"){
case "Change_Page":
woo.updateCurrentPage("home");
break;
case "External_Link":
window.location("home");
break;
case "Open_Image_in_New_Window":
window.open("/resources/squashnz/squash-nz-logo-2023.jpg");
break;
default:
console.error("No link option selected");
}
});
}
gkxwvsqf_202392093827_711zkq_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202392093827_711zkq .imageWrapper").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202392093827_711zkq_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202392093827_711zkq .imageWrapper").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202392093827_711zkq_Global;
})();var gkxwvsqf_202401714329_711bf0 = (function() {
var self = document.getElementById('gkxwvsqf_202401714329_711bf0');
var gkxwvsqf_202401714329_711bf0_Global = {};
gkxwvsqf_202401714329_711bf0_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202401714329_711bf0");
}
$("#mob_icon_gkxwvsqf_202401714329_711bf0").on("click", function(){
$("#mainContent_gkxwvsqf_202401714329_711bf0").toggle();
});
gkxwvsqf_202401714329_711bf0_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202401714329_711bf0 .icon").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202401714329_711bf0_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202401714329_711bf0 .icon").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202401714329_711bf0_Global;
})();var gkxwvsqf_202382815548_882_561_190 = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_882_561_190');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_882_561_190_Global = {};
gkxwvsqf_202382815548_882_561_190_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_882_561_190");
}
return gkxwvsqf_202382815548_882_561_190_Global;
})();var gkxwvsqf_2023101413940_576_146_479 = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_576_146_479');
var gkxwvsqf_2023101413940_576_146_479_Global = {};
gkxwvsqf_2023101413940_576_146_479_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_576_146_479");
}
return gkxwvsqf_2023101413940_576_146_479_Global;
})();var gkxwvsqf_2023101413940_576_146_334 = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_576_146_334');
var gkxwvsqf_2023101413940_576_146_334_Global = {};
gkxwvsqf_2023101413940_576_146_334_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_576_146_334");
}
return gkxwvsqf_2023101413940_576_146_334_Global;
})();var gkxwvsqf_202382815548_8419ru = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_8419ru');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_8419ru_Global = {};
gkxwvsqf_202382815548_8419ru_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_8419ru");
}
return gkxwvsqf_202382815548_8419ru_Global;
})();var gkxwvsqf_2023101413940_576_146_788 = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_576_146_788');
var gkxwvsqf_2023101413940_576_146_788_Global = {};
gkxwvsqf_2023101413940_576_146_788_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_576_146_788");
}
return gkxwvsqf_2023101413940_576_146_788_Global;
})();var gkxwvsqf_2023101413940_841w6g = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_841w6g');
var gkxwvsqf_2023101413940_841w6g_Global = {};
gkxwvsqf_2023101413940_841w6g_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_841w6g");
}
return gkxwvsqf_2023101413940_841w6g_Global;
})();var gkxwvsqf_2023101413940_8419s8 = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_8419s8');
var gkxwvsqf_2023101413940_8419s8_Global = {};
gkxwvsqf_2023101413940_8419s8_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_8419s8");
}
return gkxwvsqf_2023101413940_8419s8_Global;
})();var gkxwvsqf_202382815548_592f1u = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_592f1u');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_592f1u_Global = {};
gkxwvsqf_202382815548_592f1u_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_592f1u");
}
return gkxwvsqf_202382815548_592f1u_Global;
})();var gkxwvsqf_2023101413940_593l9z = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_593l9z');
var gkxwvsqf_2023101413940_593l9z_Global = {};
gkxwvsqf_2023101413940_593l9z_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_593l9z");
}
return gkxwvsqf_2023101413940_593l9z_Global;
})();var gkxwvsqf_2023101413940_576_146_380 = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_576_146_380');
var gkxwvsqf_2023101413940_576_146_380_Global = {};
gkxwvsqf_2023101413940_576_146_380_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_576_146_380");
}
return gkxwvsqf_2023101413940_576_146_380_Global;
})();var gkxwvsqf_2023101413940_576_146_835 = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_576_146_835');
var gkxwvsqf_2023101413940_576_146_835_Global = {};
gkxwvsqf_2023101413940_576_146_835_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_576_146_835");
}
return gkxwvsqf_2023101413940_576_146_835_Global;
})();var gkxwvsqf_2023101413940_5939pb = (function() {
var self = document.getElementById('gkxwvsqf_2023101413940_5939pb');
var gkxwvsqf_2023101413940_5939pb_Global = {};
gkxwvsqf_2023101413940_5939pb_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023101413940_5939pb");
}
return gkxwvsqf_2023101413940_5939pb_Global;
})();var gkxwvsqf_202392093827_186 = (function() {
var self = document.getElementById('gkxwvsqf_202392093827_186');
var gkxwvsqf_202392093827_186_Global = {};
gkxwvsqf_202392093827_186_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("scroll", gkxwvsqf_202392093827_186Reveal);
console.log("Unloaded gkxwvsqf_202392093827_186");
}
function gkxwvsqf_202392093827_186Reveal() {
var reveals = document.querySelector("#gkxwvsqf_202392093827_186 .reveal");
var windowHeight = window.innerHeight;
var elementTop = reveals.getBoundingClientRect().top;
var elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
reveals.classList.add("active");
self.classList.add("gkxwvsqf_202392093827_186ShadowReveal");
self.classList.remove("gkxwvsqf_202392093827_186ShadowRevealOff");
} else {
reveals.classList.remove("active");
self.classList.remove("gkxwvsqf_202392093827_186ShadowReveal");
self.classList.add("gkxwvsqf_202392093827_186ShadowRevealOff");
}
}
if ("" != "" || "Change_Page" == "Open_Image_in_New_Window"){
$("#gkxwvsqf_202392093827_186 .mainImage").css("cursor", "pointer");
$("#gkxwvsqf_202392093827_186 .mainImage").on("click", function(){
switch ("Change_Page"){
case "Change_Page":
woo.updateCurrentPage("");
break;
case "External_Link":
window.location("");
break;
case "Open_Image_in_New_Window":
window.open("/resources/squashnz/footer-top.png");
break;
default:
console.error("No link option selected");
}
});
}
gkxwvsqf_202392093827_186_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202392093827_186 .imageWrapper").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202392093827_186_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202392093827_186 .imageWrapper").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202392093827_186_Global;
})();var box_container_848 = (function() {
var box_container_848_Global = {};
var self = $("#box_container_848");
box_container_848_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("resize", setLeftOnPercent);
console.log("Unloaded box_container_848");
}
setLeftOnPercent();
window.addEventListener("resize", setLeftOnPercent);
var currentTop = parseInt($(self).css("top"));
function fixDiv() {
var scrollTop = parseInt($(window).scrollTop());
var newTop = currentTop;
if ($("#property_toolbar").length > 0) {
var elemToolBar = $("#property_toolbar");
var elemHeight = window.getComputedStyle(elemToolBar[0]).height;
var elemPosition = elemToolBar.position();
var elemTop = elemPosition.top;
var elemBottom = parseInt(elemTop) + parseInt(elemHeight);
newTop = elemBottom + currentTop;
}
var currentPosition = ((parseInt($(self).css("top")) - newTop) + parseInt($(self).css("min-height")));
if (!isNaN(currentPosition) && !isNaN(scrollTop) && (newTop => 0)){
//console.log("scrollTop: " + scrollTop);
//console.log("currentPosition: " + currentPosition);
//console.log("newTop: " + newTop);
if (scrollTop > (currentPosition + 100)) {
$(self).css({'position': 'fixed', 'top': newTop}).slideDown('slow');
} else {
$(self).css({'position': 'absolute', 'top': '0px'});
}
}
}
//$(window).scroll(fixDiv);
function setLeftOnPercent(){
var container = $(self).parent();
var containerWidth = container.css("width");
var boxWidth = "100%";
var mainWrapper = document.querySelector("#woo_ui_wrapper");
if (mainWrapper){
var docWidth = $("#woo_ui_wrapper").width();
}else{
var docWidth = $(window).width();
}
if (boxWidth.indexOf("%") > -1){
if ((parseInt(containerWidth) < docWidth) && (containerWidth != "100%")){
//if ((parseInt(containerWidth) < docWidth)){
var intWidth = parseInt(boxWidth);
var newWidth = parseInt((docWidth * (intWidth/100)));
var leftSide1 =((docWidth - newWidth)/2);
var leftSide2 = ((docWidth - parseInt(container.css("width")))/2);
leftValue = leftSide2 - leftSide1;
$(self).css({"width": newWidth + "px", "margin-left": "0px", "margin-right": "0px", "left": -leftValue + "px"});
}
}
}
return box_container_848_Global;
})();var gkxwvsqf_2024220111953__710_633 = (function() {
var self = document.getElementById('gkxwvsqf_2024220111953__710_633');
$(self).addClass("burger_menu");
var gkxwvsqf_2024220111953__710_633_Global = {};
gkxwvsqf_2024220111953__710_633_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2024220111953__710_633");
}
var coverState = "closed";
//var menuGadgetID = $("#gkxwvsqf_2024220111953__710_633 > .wooChildGadgets > .gkxwvsqf_202382802446").attr("id");
var menuGadgetIDs = $('#gkxwvsqf_2024220111953__710_633 > .wooChildGadgets > .wooGadget').map(function(){
return $(this).attr('id');
}).get();
//menuGadgetIDs.forEach(function(idValue) {
// $("#" + idValue).hide();
//});
//console.log(menuGadgetIDs);
$("#burgerTriggergkxwvsqf_2024220111953__710_633").on("click", function(){
if (coverState == "closed"){
$("#gkxwvsqf_2024220111953__710_633 .wooChildGadgets").css("left", "0px");
$("#gkxwvsqf_2024220111953__710_633 .burger_subPage").remove();
openCover();
} else {
closeCover();
$("#gkxwvsqf_2024220111953__710_633 .wooChildGadgets").css("left", "0px");
$("#gkxwvsqf_2024220111953__710_633 .burger_subPage").remove();
}
});
function openCover(){
menuGadgetIDs.forEach(function(idValue) {
if (window[idValue]){
window[idValue].animateMenuIn();
}
});
$("#gkxwvsqf_2024220111953__710_633").css("height", "100vh");
coverState = "open";
var tl = gsap.timeline({repeat: 0});
var t2 = gsap.timeline({repeat: 0});
var t3 = gsap.timeline({repeat: 0});
var t4 = gsap.timeline({repeat: 0});
var t5 = gsap.timeline({repeat: 0});
/* var t6 = gsap.timeline({repeat: 0});
t6.to("gkxwvsqf_2024220111953__710_633", {
});*/
tl.to("#gkxwvsqf_2024220111953__710_633 #burgerPath", {
attr:{d:"M0,0H745.45V481.82s-133,112.45-372.72,111.36C122.73,592.05,0,481.27,0,481.27Z"}
});
tl.to("#gkxwvsqf_2024220111953__710_633 #burgerCover", {
duration: 0,
top: 0
});
tl.to("#gkxwvsqf_2024220111953__710_633 #burgerCover", {
duration: 1.2,
ease: "expo.inOut",
height: "100vh"
});
tl.to("#gkxwvsqf_2024220111953__710_633 #burgerPath", {
attr:{d:"M0,0H745.45V593.18s-133,3.36-372.72,2.27C122.73,594.32,0,593.18,0,593.18Z"}
}, "-=0.5");
t2.to("#gkxwvsqf_2024220111953__710_633 #triggerPath", {
duration: 2,
ease: "expo.inOut",
scale: 1.2,
stroke: "#000000",
fillOpacity: 0
});
t3.to("#gkxwvsqf_2024220111953__710_633 #triggerPath2", {
duration: 2,
ease: "expo.inOut",
scale: 1.2,
transformOrigin: "50% 50%",
stroke: "#000000"
});
t4.to("#gkxwvsqf_2024220111953__710_633 .triggerLine", {
duration: 2,
ease: "expo.inOut",
scale: 1.2,
opacity: 0
});
t5.to("#gkxwvsqf_2024220111953__710_633 .triggerLine2", {
duration: 2,
ease: "expo.inOut",
scale: 1.2,
opacity: 1
});
}
function closeCover(){
menuGadgetIDs.forEach(function(idValue) {
if (window[idValue]){
window[idValue].animateMenuOut();
}
});
coverState = "closed";
var tl = gsap.timeline({repeat: 0});
var t2 = gsap.timeline({repeat: 0});
var t3 = gsap.timeline({repeat: 0});
var t4 = gsap.timeline({repeat: 0});
var t5 = gsap.timeline({repeat: 0});
tl.to("#gkxwvsqf_2024220111953__710_633 #burgerPath", {
attr:{d:"M0,0H745.45V593.18s-133-80.73-372.72-81.82C122.73,510.23,0,593.18,0,593.18Z"}
}, "+=1");
tl.to("#gkxwvsqf_2024220111953__710_633 #burgerCover", {
duration: 1.2,
ease: "expo.inOut",
height: "0vh",
onComplete: function() {
$("#gkxwvsqf_2024220111953__710_633 #burgerCover").css("top", "-100vh");
$("#gkxwvsqf_2024220111953__710_633").css("height", "80px");
}
}, "-=0.5");
t2.to("#gkxwvsqf_2024220111953__710_633 #triggerPath", {
duration: 3,
ease: "expo.inOut",
scale: 1,
stroke: "#ffffff",
fillOpacity: 1
});
t3.to("#gkxwvsqf_2024220111953__710_633 #triggerPath2", {
duration: 3,
ease: "expo.inOut",
scale: 1,
stroke: "#ffffff"
});
t4.to("#gkxwvsqf_2024220111953__710_633 .triggerLine", {
duration: 2,
ease: "expo.inOut",
scale: 1,
opacity: 1
});
t5.to("#gkxwvsqf_2024220111953__710_633 .triggerLine2", {
duration: 2,
ease: "expo.inOut",
scale: 1,
opacity: 0
});
}
var svgTrigger = document.getElementById("burgerTriggergkxwvsqf_2024220111953__710_633");
var s = Snap(svgTrigger);
var shapePath = s.select('#gkxwvsqf_2024220111953__710_633 #triggerPath');
var shapePath2 = s.select('#gkxwvsqf_2024220111953__710_633 #triggerPath2');
function animatePath(){
shapePath.animate({ d: "M52.94,9.73C118.34-.5,189.24-13.61,213.17,40.41c34.09,77,8,83,5.68,121.59-3.24,55.17-71.59,74.18-146.59,67C14.91,223.59,1.81,199.5,7.69,123.36,11.46,74.61-30.3,22.74,52.94,9.73Z" }, 1000, mina.easeinout, resetPath);
//shapePath2.animate({ d: "M67.89,19.88c42.34-22.85,115.68-33,153.4,12.5C251.13,68.34,243.71,121,227,154c-25,49.27-87.21,86.53-146.59,67C34.56,206-3.52,159.14.84,108.51,5.58,53.5,57.71,25.36,67.89,19.88Z" }, 1000, mina.easeinout, resetPath);
}
function resetPath(){
shapePath.animate({ d: "M67.89,19.88c42.34-22.85,115.68-33,153.4,12.5C251.13,68.34,243.71,121,227,154c-25,49.27-87.21,86.53-146.59,67C34.56,206-3.52,159.14.84,108.51,5.58,53.5,57.71,25.36,67.89,19.88Z" }, 1000, mina.easeinout, animatePath);
//shapePath2.animate({ d: "M52.94,9.73C118.34-.5,189.24-13.61,213.17,40.41c34.09,77,8,83,5.68,121.59-3.24,55.17-71.59,74.18-146.59,67C14.91,223.59,1.81,199.5,7.69,123.36,11.46,74.61-30.3,22.74,52.94,9.73Z" }, 1000, mina.easeinout, resetPath);
}
function rotateTrigger() {
gsap.to('#gkxwvsqf_2024220111953__710_633 #triggerPath', {
duration: 8,
rotation: 360,
transformOrigin: "50% 50%",
repeat:-1,
ease: "none"
});
}
animatePath(); // start loop
rotateTrigger();
gkxwvsqf_2024220111953__710_633_Global.changeSubPage = (pageId, gadgetID, subMenu, transitionTime, pageNo) => {
changeSubPagegkxwvsqf_2024220111953__710_633(pageId, gadgetID, subMenu, transitionTime, pageNo);
};
function changeSubPagegkxwvsqf_2024220111953__710_633(pageId, gadgetID, subMenu, transitionTime, pageNo){
console.log(pageNo);
$("#subpage_" + pageId).remove();
$(".burger_subPage_" + (parseInt(pageNo) + 1)).remove();
$(subMenu).addClass("topLayer");
$(subMenu).show();
var backButton = document.createElement('li');
backButton.className= "menuLlX";
backButton.classList.add("subPage_backButton");
var nameSpan = document.createElement('button');
nameSpan.className = "woo_subMenuName";
var chevronSpan = document.createElement('span');
chevronSpan.className = "material-symbols-outlined";
chevronSpan.classList.add("woo_chevron_span");
chevronSpan.append("arrow_back_ios");
var newNameSpan = document.createElement('span');
newNameSpan.className = "woo_newName_span";
newNameSpan.append("Back");
nameSpan.append(chevronSpan);
nameSpan.appendChild(newNameSpan);
backButton.append(nameSpan);
subMenu.prepend(backButton);
var burgerSubPage = document.createElement('div');
burgerSubPage.id = "subpage_" + pageId;
burgerSubPage.className = "burger_subPage";
burgerSubPage.classList.add("burger_subPage_" + (parseInt(pageNo) + 1));
burgerSubPage.classList.add("burger_Page_" + gadgetID);
var parentPage = ".burger_subPage_" + pageNo;
var thisPage = ".burger_subPage_" + (parseInt(pageNo) + 1);
burgerSubPage.append(subMenu);
self.appendChild(burgerSubPage);
var thisPageId = "#subpage_" + pageId;
$(".topLayer > li > ul").hide();
$("#subpage_" + pageId + " .menuClick_" + gadgetID).on("click", function(){
if ($(this).attr("linked")){
if ($(this).attr("linkID") != ""){
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("linkID");
setTimeout(animatePageIn, transitionTime);
} else {
window.location = $(this).attr("linkURL");
}
} else {
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("showPage");
setTimeout(animatePageIn, transitionTime);
}
});
$("#subpage_" + pageId + " .parentPage_" + gadgetID + " .menuClick_" + gadgetID).unbind();
$("#subpage_" + pageId + " .parentPage_" + gadgetID).on("click", function(){
var subMenu = this.querySelector("li > ul").cloneNode(true);
//console.log(subMenu);
changeSubPagegkxwvsqf_2024220111953__710_633($(this).attr("id"), gadgetID, subMenu, transitionTime, parseInt(pageNo) + 1);
});
$(".subPage_backButton").unbind();
$(".subPage_backButton").on("click", function(){
console.log(parentPage + " : " + thisPage);
var t1 = gsap.timeline({repeat: 0});
var t2 = gsap.timeline({repeat: 0});
t1.to('#gkxwvsqf_2024220111953__710_633 > ' + parentPage, {
duration: 0.5,
left: "0vw",
ease: "none"
});
t2.to(thisPage, {
duration: 0.5,
left: "100vw",
ease: "none"
});
parentPage = ".burger_subPage_" + (parseInt(pageNo) - 1);
thisPage = ".burger_subPage_" + pageNo;
});
var t1 = gsap.timeline({repeat: 0});
var t2 = gsap.timeline({repeat: 0});
t1.to('#gkxwvsqf_2024220111953__710_633 > ' + parentPage, {
duration: 0.5,
left: "-100vw",
ease: "none"
});
t2.to(thisPage, {
duration: 0.5,
left: "0vw",
ease: "none"
});
}
function animatePageIn() {
Promise.all([woo.updateCurrentPage(showPage)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
$('body').removeClass("pageAnimateIn").addClass("pageAnimateOut");
});
}
return gkxwvsqf_2024220111953__710_633_Global;
})();
var gkxwvsqf_202382802446_686zqi = (function() {
var self = document.getElementById('gkxwvsqf_202382802446_686zqi');
var gkxwvsqf_202382802446_686zqi_Global = {};
var unloadPromise;
gkxwvsqf_202382802446_686zqi_Global.unload = () => {
return new Promise((resolve, reject) => {
//Unload callbacks here
if (unloadPromise){
unloadPromise.then(() => {
resolve("done");
}).catch((error) => {
reject(error);
});
} else {
resolve("done");
}
woo.events.off("Page Added", recreate);
woo.events.off("Page Deleted", recreate);
woo.events.off("Page Hidden", recreate);
woo.events.off("Page Unhidden", recreate);
woo.events.off("Page Linked", recreate);
woo.events.off("Page Unlinked", recreate);
woo.events.off("Page Order Updated", recreate);
woo.events.off("Page Parent Updated", recreate);
woo.events.off("Page pageName Updated", recreate);
console.log("Unloaded gkxwvsqf_202382802446_686zqi");
});
}
woo.events.on("Page Added", recreate);
woo.events.on("Page Deleted", recreate);
woo.events.on("Page Hidden", recreate);
woo.events.on("Page Unhidden", recreate);
woo.events.on("Page Linked", recreate);
woo.events.on("Page Unlinked", recreate);
woo.events.on("Page Order Updated", recreate);
woo.events.on("Page Parent Updated", recreate);
woo.events.on("Page pageName Updated", recreate);
function recreate(){
unloadPromise = createFullULMenu().then(() => {
console.log("boy oh boy a lincoln toy!");
createFullULMenu();
}).catch((error) => {
console.log("Menu not created! " + error);
});
}
$("#mob_icon_gkxwvsqf_202382802446_686zqi").on("click", function(){
$("#mainMenuContent_gkxwvsqf_202382802446_686zqi").toggle();
});
checkBuild();
gkxwvsqf_202382802446_686zqi_Global.createMenu = () => {
createFullULMenu().then(() => {
}).catch((error) => {
console.error(error);
});
}
function checkBuild(){
return new Promise((resolve, reject) => {
woo.getGadgetProperty("gkxwvsqf_202382802446_686zqi", woo.instanceDB, "toolbarBuild").then((propValue) => {
if (!propValue){
createFullULMenu();
}
resolve("done");
}).catch((error) => {
reject(error);
});
}).catch((error) => {
console.error(error);
});
}
var showPage ='home';
var pageCount = 0;
function getChildrenByKey(obj, key) {
if (obj[key]) {
return obj[key].children || {};
}
for (let k in obj) {
if (obj[k] && typeof obj[k] === 'object') {
const result = getChildrenByKey(obj[k].children || {}, key);
if (result) {
return result;
}
}
}
return null; // Key not found
}
function createFullULMenu(){
return new Promise((resolve, reject) => {
$("#mainMenuContent_gkxwvsqf_202382802446_686zqi").empty();
var form = document.querySelector("#mainMenuContent_gkxwvsqf_202382802446_686zqi");
var allHtml = {};
var pages = {};
var rootPage = "";
woo.getFullPageStructure().then((response) => {
//console.log(response);
if ("home" == "home"){
rootPage = Object.keys(response)[0];
pages = response[rootPage].children;
} else {
rootPage = Object.keys(response)[0];
pages = getChildrenByKey(response, "home");
//pages = response[rootPage].children["home"].children;
}
//console.log(pages);
var promises = Object.entries(pages).map((node) => {
if (node[1]["props"].hidden == false){
return createPageNode(node, 1).then((gadgetHtml) => {
allHtml[node[0]] = gadgetHtml;
});
}
});
return Promise.all(promises);
}).then(() => {
var pageListUL = document.createElement('ul');
pageListUL.className = "menuUl1";
if (Object.keys(allHtml).length != 0) {
Object.entries(pages).forEach((entry) => {
if (allHtml[entry[0]]){
pageListUL.appendChild(allHtml[entry[0]]);
}
});
}
form.appendChild(pageListUL);
var str = form.innerHTML;
woo.updateGadgetProperty("gkxwvsqf_202382802446_686zqi", woo.instanceDB, "toolbarBuild", str, woo.getCurrentPage()).then(() => {
$(".menuClick_gkxwvsqf_202382802446_686zqi").unbind();
$(".menuClick_gkxwvsqf_202382802446_686zqi").on("click", function(){
if ($(this).attr("linked") == "true"){
if ($(this).attr("linkID") != ""){
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("linkID");
setTimeout(animatePageIn, 0);
} else {
window.location = $(this).attr("linkURL");
}
} else {
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("showPage");
setTimeout(animatePageIn, 0);
}
});
resolve("done");
}).catch((err) => {
//alert("Gadget value not saved! " + err);
reject(error);
});
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
function createPageNode(page, level){
return new Promise((resolve) => {
//create li
var pageLI = document.createElement('li');
if (level == 1){
pageLI.className = "menuLi1";
} else if (level == 2){
pageLI.className = "menuLi2";
} else {
pageLI.className = "menuLi3";
}
pageLI.classList.add("menuLlX");
var menuMouseOverID = page[0];
pageLI.id = menuMouseOverID;
if (level == 1){
var nameSpanOuter = document.createElement('span');
nameSpanOuter.className = "woo_menuName_outer";
var nameUnderLineSpan = document.createElement('span');
nameUnderLineSpan.className = "woo_menuName_underline";
nameUnderLineSpan.id = "woo_menuName_underline_" + page[0];
}
var nameSpan = document.createElement('button');
if (level == 1){
nameSpan.className = "woo_menuName";
} else {
nameSpan.className = "woo_subMenuName";
}
nameSpan.classList.add("menuClick_gkxwvsqf_202382802446_686zqi");
console.log("pageCount: " + pageCount + ", odd/even: " + (pageCount % 2));
if ((pageCount % 2) != 1) {
nameSpan.classList.add("oddPage");
}
pageCount++;
nameSpan.innerText = page[1]["props"].name;
console.log(page[1]["props"].name + " : " + page[1]["props"].linked);
if (page[1]["props"].linked == "true" || page[1]["props"].linked == true){
nameSpan.setAttribute("linked", page[1]["props"].linked);
nameSpan.setAttribute("linkID", page[1]["props"].linkID);
nameSpan.setAttribute("linkURL", page[1]["props"].linkURL);
} else {
nameSpan.setAttribute("showPage", page[0]);
}
nameSpan.setAttribute("menuid", page[0]);
if (level == 1){
nameSpanOuter.appendChild(nameSpan);
nameSpanOuter.appendChild(nameUnderLineSpan);
pageLI.appendChild(nameSpanOuter);
} else {
pageLI.appendChild(nameSpan);
}
var childPagesHtml = {};
var children = page[1].children;
var subLevel = level + 1;
var promises = Object.entries(children).map((childNode) => {
if (subLevel <= 10){
if (childNode[1]["props"].hidden == false){
return createPageNode(childNode, subLevel).then((childHtml) => {
childPagesHtml[childNode[0]] = childHtml;
});
}
}
});
Promise.all(promises).then(() => {
if (Object.keys(page[1]["children"]).length != 0){
var pageListULNext = document.createElement('ul');
if (level == 1){
pageListULNext.className = "menuUl2";
} else {
pageListULNext.className = "menuUl3";
}
pageListULNext.classList.add("menuUlX");
var childCount = 0;
Object.entries(children).forEach((entry) => {
if (childPagesHtml[entry[0]]){
childCount++;
pageListULNext.appendChild(childPagesHtml[entry[0]]);
}
});
if (childCount > 0){
pageLI.appendChild(pageListULNext);
}
}
resolve(pageLI);
});
});
}
function cleanPageNameForUrl(pageName) {
// Convert to lowercase
let url = pageName.toLowerCase();
// Replace spaces with dashes
url = url.replace(/\s+/g, '-');
// Remove all special characters except dashes and alphanumeric characters
url = url.replace(/[^a-z0-9-]/g, '');
// Remove multiple consecutive dashes
url = url.replace(/-+/g, '-');
// Remove leading and trailing dashes
url = url.replace(/^-|-$/g, '');
return url;
}
var currentPageId = woo.getCurrentPage();
$("#gkxwvsqf_202382802446_686zqi .woo_menuName").each(function(){
if (currentPageId == cleanPageNameForUrl($(this).text())){
$(this).css({"background-color": "#931826", "color" : "#ffffff"});
}
});
$(".menuClick_gkxwvsqf_202382802446_686zqi").on("click", function(){
if ($(this).attr("linked")){
if ($(this).attr("linkID") != ""){
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("linkID");
setTimeout(animatePageIn, 0);
} else {
window.location = $(this).attr("linkURL");
}
} else {
$('body').removeClass("pageAnimateOut").addClass("pageAnimateIn");
showPage = $(this).attr("showPage");
setTimeout(animatePageIn, 0);
}
});
$("#gkxwvsqf_202382802446_686zqi .parentPage_gkxwvsqf_202382802446_686zqi .menuClick_gkxwvsqf_202382802446_686zqi").unbind();
$("#gkxwvsqf_202382802446_686zqi .parentPage_gkxwvsqf_202382802446_686zqi").on("click", function(){
var burgerMenuId = $("#gkxwvsqf_202382802446_686zqi").parents(".burger_menu").attr("id");
//var subMenuNode = $(this).children("li > ul");
var subMenu = this.querySelector("li > ul").cloneNode(true);
//var subMenu = subMenuNode.cloneNode(true);
console.log(burgerMenuId);
window[burgerMenuId].changeSubPage($(this).attr("id"), 'gkxwvsqf_202382802446_686zqi', subMenu, 0, 0);
});
function animatePageIn() {
Promise.all([woo.updateCurrentPage(showPage)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
$('body').removeClass("pageAnimateIn").addClass("pageAnimateOut");
});
}
gkxwvsqf_202382802446_686zqi_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202382802446_686zqi .woo_menuName").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202382802446_686zqi_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202382802446_686zqi .woo_menuName").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202382802446_686zqi_Global;
})();var gkxwvsqf_202392093827_687m3v = (function() {
var self = document.getElementById('gkxwvsqf_202392093827_687m3v');
var gkxwvsqf_202392093827_687m3v_Global = {};
gkxwvsqf_202392093827_687m3v_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("scroll", gkxwvsqf_202392093827_687m3vReveal);
console.log("Unloaded gkxwvsqf_202392093827_687m3v");
}
function gkxwvsqf_202392093827_687m3vReveal() {
var reveals = document.querySelector("#gkxwvsqf_202392093827_687m3v .reveal");
var windowHeight = window.innerHeight;
var elementTop = reveals.getBoundingClientRect().top;
var elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
reveals.classList.add("active");
self.classList.add("gkxwvsqf_202392093827_687m3vShadowReveal");
self.classList.remove("gkxwvsqf_202392093827_687m3vShadowRevealOff");
} else {
reveals.classList.remove("active");
self.classList.remove("gkxwvsqf_202392093827_687m3vShadowReveal");
self.classList.add("gkxwvsqf_202392093827_687m3vShadowRevealOff");
}
}
if ("home" != "" || "Change_Page" == "Open_Image_in_New_Window"){
$("#gkxwvsqf_202392093827_687m3v .mainImage").css("cursor", "pointer");
$("#gkxwvsqf_202392093827_687m3v .mainImage").on("click", function(){
switch ("Change_Page"){
case "Change_Page":
woo.updateCurrentPage("home");
break;
case "External_Link":
window.location("home");
break;
case "Open_Image_in_New_Window":
window.open("/resources/squashnz/logo-snz-white.png");
break;
default:
console.error("No link option selected");
}
});
}
gkxwvsqf_202392093827_687m3v_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202392093827_687m3v .imageWrapper").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202392093827_687m3v_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202392093827_687m3v .imageWrapper").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202392093827_687m3v_Global;
})();var gkxwvsqf_202401714329_654 = (function() {
var self = document.getElementById('gkxwvsqf_202401714329_654');
var gkxwvsqf_202401714329_654_Global = {};
gkxwvsqf_202401714329_654_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202401714329_654");
}
$("#mob_icon_gkxwvsqf_202401714329_654").on("click", function(){
$("#mainContent_gkxwvsqf_202401714329_654").toggle();
});
gkxwvsqf_202401714329_654_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202401714329_654 .icon").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202401714329_654_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202401714329_654 .icon").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202401714329_654_Global;
})();var gkxwvsqf_202382815548_418 = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_418');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_418_Global = {};
gkxwvsqf_202382815548_418_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_418");
}
return gkxwvsqf_202382815548_418_Global;
})();var gkxwvsqf_2023913213116_972_568_10 = (function() {
var self = document.getElementById('gkxwvsqf_2023913213116_972_568_10');
var gkxwvsqf_2023913213116_972_568_10_Global = {};
gkxwvsqf_2023913213116_972_568_10_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023913213116_972_568_10");
}
return gkxwvsqf_2023913213116_972_568_10_Global;
})();var gkxwvsqf_2024514152942__11_641 = (function() {
var self = document.getElementById('gkxwvsqf_2024514152942__11_641');
var gkxwvsqf_2024514152942__11_641_Global = {};
gkxwvsqf_2024514152942__11_641_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2024514152942__11_641");
}
return gkxwvsqf_2024514152942__11_641_Global;
})();var gkxwvsqf_2024514152942__11_402 = (function() {
var self = document.getElementById('gkxwvsqf_2024514152942__11_402');
var gkxwvsqf_2024514152942__11_402_Global = {};
gkxwvsqf_2024514152942__11_402_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2024514152942__11_402");
}
return gkxwvsqf_2024514152942__11_402_Global;
})();var login_393_663 = (function() {
var login_393_663_Global = {};
var loginDom = document.getElementById('login-text_login_393_663');
var loginDomMob = document.getElementById('mob_icon_login_393_663');
var loggedIn = false;
var loggingInOrOut = false;
var openModal = false;
var whatIs = document.querySelector(".woo_whatIsWooID_login_393_663");
var forgotPass = document.querySelector(".forgot_pass_login_393_663");
function getAppData(){
return new Promise((resolve) => {
var url = woo.getRemoteCouch() + "/squashnz$public/squashnz-invoice-settings";
var data = {}
resolve(woo.queryCouch(url, "GET", data));
}).catch((error) => {
return null;
});
}
getAppData().then((data) => {
if (data){
$("#login_393_663 .website_name").html(data.brandName);
$("#login_393_663 #fullLogoImage").attr("src", "/resources/squashnz/uploads/" + data.logoImage);
}
})
function forgotPass_login_393_663(){
woo.updateCurrentPage("forgot-password");
}
function whatIsClick_login_393_663(){
var note = "
What is the Woo ID?
With a growing awareness of on-line privacy and security issues, further tightening of the spam laws worldwide and the need for businesses to have more robust collection of data systems in place, Woo has risen to the challenge by creating a universal ID for users on the platform - called a Woo ID.
The Woo ID provides you with the security that Woo is dedicated, and bound by law, to ensure your information is kept private and that all anti-spam laws are adhered to. Every user added to a Woo website gets to verify their email address. This ensures issues with data entry and out-of-date email accounts are spotted early.
The Woo ID universal ID is the market leader: creating a safe and spam free environment for you.