implemented check tick selected seat

This commit is contained in:
zino
2021-03-24 21:37:06 +01:00
parent c7a6267975
commit 04cf55e4fe
10 changed files with 252 additions and 78 deletions

View File

@@ -1,7 +1,7 @@
export default class Utils {
static waitForElement(selector: any, callback: Function, type: string = "selector", checkFrequencyInMs: number = 1000, timeoutInMs: number = 10000) {
let startTimeInMs: number = Date.now();
let startTimeInMs: number = Date.now();
(function loopSearch(): void {
let value: boolean;
console.log(selector);
@@ -16,7 +16,7 @@ export default class Utils {
if (value) {
console.log("defined");
callback();
}
}
else {
setTimeout(function (): void {
console.log("repeating");
@@ -24,18 +24,18 @@ export default class Utils {
return;
loopSearch();
}, checkFrequencyInMs);
}
}
})();
}
static waitForSeatmap(callback: Function, checkFrequencyInMs: number = 100, timeoutInMs: number = 10000) {
const seatCharts: any = (<any>window).jQuery("#containerSeatmap").seatCharts;
let startTimeInMs: number = Date.now();
let startTimeInMs: number = Date.now();
if (Utils.isFunction(seatCharts)) {
console.log("defined");
callback();
}
}
else {
setTimeout(function (): void {
console.log("repeating");
@@ -50,7 +50,7 @@ export default class Utils {
if (document.querySelector(selector) != null)
return true;
else
return false;
return false;
}
static isFunction(selector: string): boolean {
@@ -64,21 +64,26 @@ export default class Utils {
return new Promise(resolve => setTimeout(resolve, ms));
}
static inject(content: string, type: string = "js", loc: string = "head") {
var script: HTMLLinkElement | HTMLScriptElement;
static inject(content: string, inType: string = "js", inLoc: string = "head") {
var script: HTMLLinkElement | HTMLScriptElement | HTMLStyleElement;
if (type === "js") {
if (inType === "js") {
script = document.createElement('script');
script.type = 'text/javascript';
script.src = content;
}
else if (type === "css") {
else if (inType === "css") {
script = document.createElement('link');
script.type = 'text/css';
script.rel = "stylesheet"
script.href = content;
(<HTMLLinkElement>script).rel = "stylesheet";
(<HTMLLinkElement>script).href = content;
}
else if (type === "script") {
else if (inType === "cssCustom") {
script = document.createElement('style');
script.type = 'text/css';
script.innerHTML = content;
}
else if (inType === "script") {
script = document.createElement('script');
script.type = 'text/javascript';
script.innerHTML = content;
@@ -86,15 +91,20 @@ export default class Utils {
else
return;
if (loc === "body")
if (inLoc === "body")
document.body.appendChild(script);
else if (loc === "head")
else if (inLoc === "head")
document.head.appendChild(script);
}
static getDayName(date: Date, locale: string) {
return date.toLocaleDateString(locale, { weekday: 'long' });
return date.toLocaleDateString(locale, { weekday: 'long' });
}
static generateRandomColor(): string {
const randomNumber: number = Math.floor((Math.random() * 10000) + 1);
const hue = randomNumber * 137.508; // use golden angle approximation
return `hsl(${hue},100%,75%)`;
}
}