restructured inject.js
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import jQuery = require("jquery");
|
||||
import * as xml from "./xml";
|
||||
import * as communication from "./communication";
|
||||
import * as I from "./types";
|
||||
import * as ui from "./ui";
|
||||
import { config } from "./inject";
|
||||
import Utils from './utils';
|
||||
import * as XMLHelper from "./modules/xml";
|
||||
import * as Communication from "./modules/communication";
|
||||
import * as I from "./types/types";
|
||||
import * as UI from "./modules/ui";
|
||||
import { config } from "./modules/config";
|
||||
import Utils from './modules/utils';
|
||||
import Panzoom from '@panzoom/panzoom';
|
||||
// var sc = require("../libs/jQuery-Seat-Charts/jquery.seat-charts.js");
|
||||
// var parseString = require('xml2js').parseString;
|
||||
@@ -20,7 +20,7 @@ let seatmap: any;
|
||||
window.addEventListener('load', function () {
|
||||
|
||||
jQuery("#foobar").on("click", () => {
|
||||
communication.sendMessage(<I.Message>{
|
||||
Communication.sendMessage(<I.Message>{
|
||||
message: "Hello from child",
|
||||
from: "child",
|
||||
event: "foobar",
|
||||
@@ -31,7 +31,7 @@ window.addEventListener('load', function () {
|
||||
Utils.inject(config.urlJSCStaging, "js", "head");
|
||||
Utils.inject(config.urlCSSJSCStaging, "css", "body");
|
||||
Utils.inject(config.urlCSSChildStaging, "css", "body");
|
||||
communication.listenToMessages(messagesHandler);
|
||||
Communication.listenToMessages(messagesHandler);
|
||||
Utils.waitForSeatmap(showBookingBtnParent);
|
||||
|
||||
const dropdownSeatmap: HTMLElement | null = document.getElementById("dropdownSeatmap");
|
||||
@@ -40,7 +40,7 @@ window.addEventListener('load', function () {
|
||||
controlLoftloader("show");
|
||||
const value: string = this.value;
|
||||
destroyCurrentSeatmap();
|
||||
communication.needSeatmapXML(value);
|
||||
Communication.needSeatmapXML(value);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ function showBookingBtnParent(): void {
|
||||
event: "child_seatmap_ready",
|
||||
date: Date.now()
|
||||
};
|
||||
communication.sendMessage(message, "parent");
|
||||
Communication.sendMessage(message, "parent");
|
||||
}
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ function messagesHandler(inE: any) {
|
||||
switch (data.event) {
|
||||
case "RefreshDropdown": {
|
||||
const venueXML: I.VenueXML = data.message.map_response;
|
||||
const seatmapListing: I.Seatmap[] = xml.getSeatmapListing(venueXML);
|
||||
ui.setOptionSelect(seatmapListing, "dropdownSeatmap");
|
||||
const seatmapListing: I.Seatmap[] = XMLHelper.getSeatmapListing(venueXML);
|
||||
UI.setOptionSelect(seatmapListing, "dropdownSeatmap");
|
||||
break;
|
||||
}
|
||||
case "addDropdown": {
|
||||
@@ -171,31 +171,31 @@ function messagesHandler(inE: any) {
|
||||
}
|
||||
case "parent_init_venue": {
|
||||
controlLoftloader("show");
|
||||
communication.sendEventToParent("child_init_needInputsWithValue");
|
||||
Communication.sendEventToParent("child_init_needInputsWithValue");
|
||||
break;
|
||||
}
|
||||
case "parent_init_sendVenueXML": {
|
||||
const XML: I.VenueXML = data.message.map_response;
|
||||
|
||||
// fill event info
|
||||
const eventInfo = xml.getEventInfo(XML);
|
||||
ui.setEventInfo(eventInfo, inputsWithValue);
|
||||
const eventInfo = XMLHelper.getEventInfo(XML);
|
||||
UI.setEventInfo(eventInfo, inputsWithValue);
|
||||
|
||||
// fill select dropdown
|
||||
const seatmapListing: I.Seatmap[] = xml.getSeatmapListing(XML);
|
||||
const seatmapListing: I.Seatmap[] = XMLHelper.getSeatmapListing(XML);
|
||||
console.log(seatmapListing);
|
||||
ui.setOptionSelect(seatmapListing, "dropdownSeatmap");
|
||||
UI.setOptionSelect(seatmapListing, "dropdownSeatmap");
|
||||
|
||||
// display first seatmapXML
|
||||
const id: string = seatmapListing[0].id[0];
|
||||
jQuery("#dropdownSeatmap").val(id);
|
||||
communication.needSeatmapXML(id);
|
||||
Communication.needSeatmapXML(id);
|
||||
|
||||
break;
|
||||
}
|
||||
case "parent_init_sendInputsWithValue": {
|
||||
inputsWithValue = data.message;
|
||||
communication.sendEventToParent("child_init_needVenueXML");
|
||||
Communication.sendEventToParent("child_init_needVenueXML");
|
||||
break;
|
||||
}
|
||||
case "parent_sendSeatmapXML": {
|
||||
|
||||
Reference in New Issue
Block a user