intorduced smap

This commit is contained in:
zino
2021-05-06 17:57:51 +02:00
parent 51157645d6
commit 126b9be7ea
5 changed files with 67 additions and 27 deletions

View File

@@ -137,17 +137,30 @@ window.addEventListener('load', function () {
inputsWithValue = { ...inputsWithValue, ...Parser.getAdditionalInputs(content) }; inputsWithValue = { ...inputsWithValue, ...Parser.getAdditionalInputs(content) };
inputsWithValue = { ...inputsWithValue, ...Parser.getVenueImage() }; inputsWithValue = { ...inputsWithValue, ...Parser.getVenueImage() };
const importantNote = Parser.getImportantNote(); // const importantNote = Parser.getImportantNote();
if (importantNote) // if (importantNote)
inputsWithValue = { ...inputsWithValue, ...importantNote }; // inputsWithValue = { ...inputsWithValue, ...importantNote };
inputsWithValue = { ...inputsWithValue, ...Parser.getImportantNote() };
inputsWithValue["smap"] = getSMAP();
UI.injectBookingBtn(); UI.injectBookingBtn();
UI.createDialog(); UI.createDialog();
console.log(inputsWithValue); console.log(inputsWithValue);
});
// remove on production function getSMAP(): string | undefined {
jQuery("#foobarParent").on("click", () => { if (jQuery("#seating_map_url").length === 0)
Communication.sendEventToChild("parent_init_venue"); return undefined;
});
}); const str: string = jQuery("#seating_map_url a").attr("onclick");
const re = /openNewWindow\(\'(\d+)\'/;
const found: RegExpMatchArray | null = str.match(re);
if (found)
return found[1];
else
return undefined;
}

View File

@@ -57,15 +57,12 @@ export function injectBookingBtn(): void {
"width": "100%" "width": "100%"
}); });
jQuery("#flash_seat_map_box_id").append(` jQuery("#flash_seat_map_box_id").append(`
<div class="row_space"></div>
<div class="row_space"></div>
<div id="containerBookingBtn"> <div id="containerBookingBtn">
<button type="button" id="openSeatmap"> <a class="continue" id="openSeatmap">
<div> <span>Saalplanbuchung</span>
<img src="https://staging.tickets.zinomedia.de/dist/stadium.png"> </a>
</div>
Saalplanbuchung <br/><br/>
<span>Suchen Sie Ihren Platz selbst aus</span>
</button> <br/>
<button type="button" id="foobarParent">foobarParent</button> <br/>
<div id="dialogSeatmap" hidden="hidden"></div> <div id="dialogSeatmap" hidden="hidden"></div>
</div> </div>
`); `);

View File

@@ -35,7 +35,7 @@ export function getEventInfo(inVenueXML: I.VenueXML): I.EventInfo {
const eventObj: I.Event = inVenueXML.event[0]; const eventObj: I.Event = inVenueXML.event[0];
const event = inVenueXML.event[0]; const event = inVenueXML.event[0];
const venue_config = inVenueXML.venue_config[0]; const venue_config = inVenueXML.venue_config[0];
const dateObj: Date = new Date(parseInt(event.year[0]), parseInt(event.month[0])-1, parseInt(event.hour[0]), parseInt(event.minute[0])); const dateObj: Date = new Date(parseInt(event.year[0]), parseInt(event.month[0])-1, parseInt(event.day[0]), parseInt(event.hour[0]), parseInt(event.minute[0]));
const start: string[] = [ dateObj.toLocaleString(["de-DE"], { weekday: "long", day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit", timeZoneName: "short" }) ]; const start: string[] = [ dateObj.toLocaleString(["de-DE"], { weekday: "long", day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit", timeZoneName: "short" }) ];
const weekday = [ Utils.getDayName(dateObj, "de-DE") ]; const weekday = [ Utils.getDayName(dateObj, "de-DE") ];
const seats_available = sectionArr.map(item => parseInt(item.available[0])).reduce((prev, curr) => prev + curr); const seats_available = sectionArr.map(item => parseInt(item.available[0])).reduce((prev, curr) => prev + curr);

View File

@@ -87,14 +87,13 @@ function messagesHandler(inE: any) {
addTrims(); addTrims();
processSMAP();
panzoom = UI.addPanzoom("#containerSeatmapInner", ".panzoomZoomIn", ".panzoomZoomOut", "#panzoomResetZoom"); panzoom = UI.addPanzoom("#containerSeatmapInner", ".panzoomZoomIn", ".panzoomZoomOut", "#panzoomResetZoom");
UI.controlLoftloader("hide"); UI.controlLoftloader("hide");
new jBox("Tooltip", { new jBox("Tooltip", {
attach: jQuery(".seatCharts-seat"),
// title: "title",
// content: "foooobar",
onOpen: function (this: any) { onOpen: function (this: any) {
showSeatTooltip(this); showSeatTooltip(this);
}, },
@@ -130,6 +129,16 @@ function messagesHandler(inE: any) {
} }
} }
function processSMAP() {
if (!inputsWithValue.smap)
return;
const smapArr = inputsWithValue.smap.split("").map(Number);
if (!smapArr[0])
jQuery("#eventInfoCapacity").hide();
}
function addTrims() { function addTrims() {
const trimArr: I.Trim[] = seatmapXML.seatmap[0].trims[0].trim; const trimArr: I.Trim[] = seatmapXML.seatmap[0].trims[0].trim;
trimArr.forEach(arr => { trimArr.forEach(arr => {
@@ -146,22 +155,42 @@ function addTrims() {
function decodeAddTrims(textArr: string[], x: number, y: number) { function decodeAddTrims(textArr: string[], x: number, y: number) {
let i = 0; let i = 0;
const specialChar = new Map([
["&#x8e", "Ä"],
["&#x99", "Ö"],
["&#x9a", "Ü"],
["&#x84", "ä"],
["&#x94", "ö"],
["&#x81", "ü"],
["&#xe1", "ß"]
]);
textArr.forEach(element => { textArr.forEach(element => {
const charCode = element.replace(/^\&\#/, "0"); let character;
const character = String.fromCharCode(parseInt(charCode, 16));
if(!/[^a-zA-Z0-9äöüÄÖÜß$]/.test(character)) { if (specialChar.has(element))
const _x = (x - 1) + i; character = specialChar.get(element);
const _y = y - 1; else {
console.log(`${character} -> ${_x} ${_y}`); const charCode = element.replace(/^\&\#/, "0");
jQuery(".seatCharts-row")[_y].children[_x].innerHTML = `<span class="trimChar">${character}</span>` character = String.fromCharCode(parseInt(charCode, 16));
} }
if (character)
applyTrim(x, y, i, character);
i++; i++;
}); });
} }
function applyTrim(x: number, y: number, i: number, character: string) {
if(!/[^a-zA-Z0-9äöüÄÖÜß$]/.test(character)) {
const _x = (x - 1) + i;
const _y = y - 1;
console.log(`${character} -> ${_x} ${_y}`);
jQuery(".seatCharts-row")[_y].children[_x].innerHTML = `<span class="trimChar">${character}</span>`
}
}
function showSeatTooltip(jBox: any): void { function showSeatTooltip(jBox: any): void {
const seatID: string = jBox.source[0].id; const seatID: string = jBox.source[0].id;

View File

@@ -71,6 +71,7 @@ export interface InputsWithValue {
venueImageHeight: number; venueImageHeight: number;
venueImageWidth: number; venueImageWidth: number;
ticketPurchaseUrl: string; ticketPurchaseUrl: string;
smap: string | undefined;
} }
export interface Config { export interface Config {