reupload latest seatmap main

This commit is contained in:
zino
2021-01-20 15:45:04 +01:00
parent 30e837697d
commit 5b03beae1f
14 changed files with 13403 additions and 11444 deletions

View File

@@ -55,7 +55,7 @@ cors_proxy.createServer({
key: fs.readFileSync('/etc/letsencrypt/live/zinomedia.de/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/zinomedia.de/fullchain.pem')
},
// originWhitelist: ['https://heise.de'],
//originWhitelist: [],
originWhitelist: ['https://zinomedia.de' , 'https://purchase.tickets.com', 'http://purchase.tickets.com', 'http://zinomedia.de', 'https://purchase.tickets.zinomedia.de', 'http://purchase.tickets.zinomedia.de', 'http://seatmap-testing.zinomedia.de', 'https://seatmap-testing.zinomedia.de'],
// requireHeader: ['origin', 'x-requested-with'],
requireHeader: [],

View File

@@ -1,54 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SeatmapClose</title>
<style>
body {
background-color: #e9e9e9;
}
.container {
position: absolute;
text-align: center;
font-size: 1.2vw;
top: 50%;
left: 50%;
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.button {
background-color: grey;
border: none;
color: white;
padding: 0.5vw 1vw;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.2vw;
-webkit-transition-duration: 0.4s;
/* Safari */
transition-duration: 0.4s;
}
.button:hover {
background-color: #4CAF50;
color: white;
}
</style>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://zinomedia.de/seatmap_main/seatmap-inject/seatmap-inject.js"></script>
</head>
<body>
<div class="container">
<!--<span>Buchung abgebrochen. Sie können dieses Fenster nun schließen oder die<br><br><button id="Saalplanbuchung" class="button">Saalplanbuchung erneut laden.</button></span>-->
<span>Buchung abgebrochen. Sie können dieses Fenster nun schließen.</button></span>
</div>
</body>
</html>

View File

@@ -32,15 +32,14 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-141047190-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-141047190-1');
</script>
</head>
<body>
@@ -90,9 +89,11 @@
var $body = $("body");
$(document).on({
ajaxStart: function() { $body.addClass("loading"); },
ajaxStop: function() { $body.removeClass("loading");
ajaxStop: function() {
$body.removeClass("loading");
$('.modal').css("background-image", "url()");
$('head').append('<style type="text/css">.modal:before{display: none;}</style>'); }
$('head').append('<style type="text/css">.modal:before{display: none;}</style>');
}
});
</script>
<script language="javascript" type="text/javascript" src="seatmap.js"></script>

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@ var idCartModal;
var ProductManager;
var seatmapWorkflowURL;
const branch = 'seatmap_main'; // seatmap_testing or seatmap_main
const branch = 'seatmap_testing'; // seatmap_testing or seatmap_main
var DATA = {
'CONFIG': {},
};
@@ -27,10 +27,11 @@ function set_predefined_config(DATA) {
if (typeof DATA.CONFIG['SEATMAP_VERSION'] != 'undefined') {
DATA.CONFIG["SEATMAP_VERSION"] = DATA.CONFIG["SEATMAP_VERSION"] + ' (testing)';
}
DATA.CONFIG['SEATMAP-SERVER']['ROOT_URL'] = 'https://seatmap-testing.zinomedia.de/seatmap-server/seatmap-server.pl';
DATA.CONFIG['SEATMAP-SERVER']['ROOT_URL'] = 'https://staging.purchase.tickets.zinomedia.de/seatmap-server/seatmap-server.pl';
}
else if (branch === 'seatmap_main') {
DATA.CONFIG['SEATMAP-SERVER']['ROOT_URL'] = 'https://zinomedia.de/seatmap_main/seatmap-server/seatmap-server.pl';
DATA.CONFIG["SEATMAP_VERSION"] = DATA.CONFIG["SEATMAP_VERSION"];
}
}
@@ -83,8 +84,6 @@ if (!String.prototype.repeat) {
document.addEventListener("DOMContentLoaded", ready);
window.onload = function() {
if (DATA.CONFIG['DEBUG']) console.log(getFuncName());
checkDebug();
};
// EVENT CONTAINER VISIBLE
@@ -93,13 +92,20 @@ if ($('.container-fluid').is(':visible')) {
detect_die_IE();
// PARSE PARAM FROM POSTURL, CREATES param and extra_param
var decoded_uri = decodeURIComponent(getParamValue('posturl'));
let posturl = getParamValue('posturl');
console.log('POSTURL: ' + posturl);
var decoded_uri = decodeURIComponent(posturl);
getParamsFromPosturl(decoded_uri);
if (DATA.CONFIG['DEBUG']) console.log(param);
if (DATA.CONFIG['DEBUG']) console.log(extra_param);
// REMOVE PARAM FROM URL
//window.history.replaceState(null, null, window.location.pathname);
// GET DATA FROM SERVER AND BUILD SEATMAP
seatmapWorkflow(decoded_uri);
//seatmapWorkflow(decoded_uri);
seatmapWorkflow(posturl);
}
function detect_die_IE() {
@@ -118,7 +124,7 @@ function getParamsFromPosturl(decoded_uri) {
var checkoutParam = [
'APPTE', 'age_consent_is_checked', 'agency', 'cancelAndRedirectTrxState', 'cogid', 'coids', 'discount=A=IE', 'discount=A=IV', 'discountdesc=A=IE', 'discountdesc=A=IV', 'discountfees=A=IE', 'discountfees=A=IV', 'discountprice=A=IE', 'discountprice=A=IV', 'dpa_selection', 'etpgcode', 'flashDetected', 'gid', 'hbx_discount_prices', 'hbx_discounts', 'hbx_offered_pg', 'hbx_perf_codes', 'hbx_perf_sub_codes', 'hbx_pids', 'hbx_requested_pg', 'hbx_selected_tixx', 'hbx_upsell_flag', 'request_type', 'invalid_seats', 'inventory_filtering_action', 'inventory_month', 'inventory_year', 'isCapEnabled', 'is_availability_switch_from_map', 'is_ticket_exchange_request', 'ism_map_current_state_json_data', 'jcarousel_auto_off_val', 'listing_type', 'mainEventPID', 'map_coupon_code', 'mlbamsp', 'oid', 'ooids', 'orderkey', 'orgid', 'p_orgid', 'package_pids', 'parent_offer_id', 'pay_pal_token', 'pid', 'prevtrxstate', 'recapToken', 'redeem_voucher_data_event_mapping', 'replay_request', 'request_action', 's_mem_tkt_ren_retrieval', 'schedule', 'secure_trxn_enabled', 'selected_seat_indexes', 'selected_upsell_option', 'supplierCode', 'supplier_code', 'target_name_value', 'target_prev_trxstate', 'target_trxstate', 'target_url', 'timeout_seconds', 'trxstate', 'upsell_selected', 'user_context', 'valid_coupon_code_message',
];
var extraParam = ['note'];
var extraParam = ['note', 'request_switch'];
for (var i = 0; i < checkoutParam.length; i++) {
let value = getParamValue(checkoutParam[i], decoded_uri);
@@ -695,15 +701,6 @@ function getParamValue(paramName, url) {
}
}
function checkDebug() {
if (DATA.CONFIG['DEBUG']) console.log(getFuncName());
// if (DATA.CONFIG["DEBUG"]) {
// }
// else if (!DATA.CONFIG["DEBUG"]) {
// }
}
function checkMobile() {
console.log(getFuncName());
@@ -785,17 +782,18 @@ function getFuncName(arg) {
}
// SEATMAP
function seatmapWorkflow(decodedURI) {
function seatmapWorkflow(URI) {
if (DATA.CONFIG['DEBUG']) console.log(getFuncName());
seatmapWorkflowURL = DATA.CONFIG["SEATMAP-SERVER"]["ROOT_URL"] + "?url=" + decodedURI;
if (DATA.CONFIG['DEBUG']) console.log("Get: " + seatmapWorkflowURL);
//seatmapWorkflowURL = DATA.CONFIG["SEATMAP-SERVER"]["ROOT_URL"] + "?url=" + decodedURI;
//if (DATA.CONFIG['DEBUG']) console.log("Get: " + seatmapWorkflowURL);
//let seatmapWorkflowURLEncoded = DATA.CONFIG["SEATMAP-SERVER"]["ROOT_URL"] + "?url=" + encodeURIComponent(URI);
let seatmapWorkflowURLEncoded = DATA.CONFIG["SEATMAP-SERVER"]["ROOT_URL"] + "?url=" + URI;
if (DATA.CONFIG['DEBUG']) console.log("Get: " + seatmapWorkflowURLEncoded);
jqxhr = $.getJSON(seatmapWorkflowURL, function(DATA) {
jqxhr = $.getJSON(seatmapWorkflowURLEncoded, function(DATA) {
if (DATA.CONFIG['DEBUG']) console.log("success");
//replaceUmlautsDATA(DATA);
// MERGE PREDEFINED AND SERVER SETTINGS
set_predefined_config(DATA);
if (DATA.CONFIG['DEBUG']) console.log(DATA);
@@ -809,9 +807,7 @@ function seatmapWorkflow(decodedURI) {
.done(function(DATA) {
if (DATA.CONFIG['DEBUG']) console.log("second success");
// MERGE PREDEFINED AND SERVER SETTINGS
//set_predefined_config(DATA);
console.log(DATA);
if (DATA.CONFIG['DEBUG']) console.log(DATA);
manipulateHTML(DATA);
})
@@ -834,22 +830,15 @@ function replaceUmlautsDATA(DATA) {
}
function fillSeatObjData(id, DATA) {
console.log(DATA);
if (DATA.CONFIG['DEBUG']) console.log(getFuncName());
// Seat Object
var seatObj = sc.get(id);
if (DATA.CONFIG['DEBUG']) {
console.log(DATA);
console.log(seatObj);
console.log(seatObj.settings.status);
// RETURN IF ALREADY FILLED
// if (seatObj.data().filled == true) {
// console.log("seatObj already filled -> Return.");
// return;
// }
}
// GET SECTION ID, ROW AND SEATNR FOR IDENTIFICATION
var arrID = id.split('_'),
@@ -871,13 +860,8 @@ function fillSeatObjData(id, DATA) {
// console.log(buyerTypesObj);
// ROW AND PRODUCT TITLE
// var jQueryRow = seatObj.settings.row + 1;
// var product = seatObjJSON['SECTIONID_DESC'] + ' Reihe ' + jQueryRow + ' Platz ' + seatObjJSON.SEATNR_PARSED; // SHOWS IN CART
var product = seatObjJSON['SECTIONID_DESC'] + ' Reihe ' + seatObjJSON['ROW_PARSED'] + ' Platz ' + seatObjJSON.SEATNR_PARSED; // SHOWS IN CART
var productJBox = seatObjJSON['SECTIONID_DESC'] + ' Reihe ' + seatObjJSON['ROW_PARSED'] + ' Platz ' + seatObjJSON.SEATNR_PARSED + ' | ' + seatObj.data().price + DATA.CONFIG["CURRENCY_SYMBOL"]; // SHOWS IN JBOX
// var product = seatObjJSON['SECTIONID_DESC'] + ' Reihe ' + jQueryRow + ' Platz ' + seatNr; // SHOWS IN CART
// var productJBox = seatObjJSON['SECTIONID_DESC'] + ' Reihe ' + jQueryRow + ' Platz ' + seatNr + ' | ' + seatObj.data().price + DATA.CONFIG["CURRENCY_SYMBOL"]; // SHOWS IN JBOX
// var productJBox = seatObjJSON['SECTIONID_DESC'] + ' Reihe ' + seatObjJSON['ROW_PARSED'] + ' Platz ' + seatNr + ' | ' + seatObj.data().price + DATA.CONFIG["CURRENCY_SYMBOL"]; // SHOWS IN JBOX
// SEAT COLOR
var seatColor = pricescalesObj.COLOR;
@@ -952,7 +936,7 @@ function manipulateHTML(DATA) {
document.getElementById("eventDesc").innerHTML = DATA.EVENT.DESC;
document.getElementById("datetime_DE").innerHTML = 'Beginn: ' + DATA.EVENT.DATETIME_DE;
document.getElementById("venueDesc").innerHTML = 'Ort: ' + DATA.VENUE.DESC;
document.getElementById("venueDesc").innerHTML = 'Ort: ' + DATA.VENUE.DESC.toUpperCase();
document.getElementById("seatmap_version").innerHTML = 'Version ' + DATA.CONFIG["SEATMAP_VERSION"];
$('.container-fluid').css('visibility', 'visible');
@@ -998,36 +982,18 @@ function generateSeats(DATA, mappingPricescalesSections) {
// LOOP PRICESCALES
for (var pricescalesID in DATA.VENUE.PRICESCALES) {
// SECTION_CONFIG OBJECT
// OBJECTS
var sectionID = mappingPricescalesSections[pricescalesID];
var sectionObj = DATA.VENUE.SECTION_CONFIG[sectionID];
var pricescalesObj = DATA.VENUE.PRICESCALES[pricescalesID];
// if (DATA.CONFIG.hasOwnProperty("CUSTOM_PRICESCALES_COLOR")) {
// console.log(DATA.CONFIG);
// var venueCode = DATA.VENUE.CODE;
// venueCode.toString();
// console.log('venueCode: ' + venueCode);
// console.log(DATA["CONFIG"][venueCode]["CUSTOM_PRICESCALES_COLOR"]);
// var resolve2 = resolve(DATA.VENUE.CODE, DATA.CONFIG);
// console.log(resolve2);
//resolve(['object', 'a.property.name.with.periods'], DATA.CONFIG) // returns 42
//console.log(Object.byString(DATA, 'CONFIG["INT_TH_3"].MAX_TICKETS_PER_USER'));
//console.log(DATA.CONFIG["INT_TH3_"]);
//console.log(DATA.CONFIG["venue_code"]);
if (typeof DATA.CONFIG[DATA.VENUE.CODE]["CUSTOM_PRICESCALES_COLOR"] != "undefined") {
console.log("Applying custom colors");
if (DATA.CONFIG['DEBUG']) console.log("Applying custom colors");
cssProperties = '{' +
'background-color: #' + DATA.CONFIG[DATA.VENUE.CODE]["CUSTOM_PRICESCALES_COLOR"][pricescalesObj.ID] + ' !important;' +
'}';
}
else {
console.log("Applying colors from XML");
if (DATA.CONFIG['DEBUG']) console.log("Applying colors from XML");
cssProperties = '{' +
'background-color: #' + pricescalesObj.COLOR + ' !important;' +
'}';
@@ -1320,24 +1286,22 @@ function generateMapMatrix(DATA) {
var overallMinMaxXY = getOverallMaxXY(DATA); // return [xMax, xMin, yMax, yMin, rowMax, maxSeats];
var sortedSections = sortSeatmaps(DATA);
var [mapping, matrixBIG] = bigMatrixDim(sortedSections);
if (DATA.CONFIG['DEBUG']) {
console.log('mapping: ');
console.log(mapping);
console.log('mapping.length: ' + Object.keys(mapping).length);
console.log('matrixBIG:');
console.log(matrixBIG);
console.log('overallMinMaxXY:');
console.log(overallMinMaxXY);
console.log("Overall maxmimum seats per row: " + overallMinMaxXY[5]);
}
// var matrixBIG = [
// [],
// []
// ];
var seatsUnavailable = new Array();
var mappingPricescalesSections = new Array();
var jQuerySeatID;
if (DATA.CONFIG['DEBUG']) console.log('overallMinMaxXY:');
if (DATA.CONFIG['DEBUG']) console.log(overallMinMaxXY);
if (DATA.CONFIG['DEBUG']) console.log("Overall maxmimum seats per row: " + overallMinMaxXY[5]);
// LOOP THROUGH SORTED SECTIONS
for (var k in sortedSections) {
// SECTION OBJ
@@ -1363,33 +1327,32 @@ function generateMapMatrix(DATA) {
var seatDiff;
if (maxSectionSeats != overallMaxSectionSeats) {
seatDiff = overallMaxSectionSeats - maxSectionSeats;
console.log("seatDiff: " + seatDiff);
if (DATA.CONFIG['DEBUG']) console.log("seatDiff: " + seatDiff);
if (seatDiff > 0) {
if (seatDiff & 1) { // ODD
console.log("Odd");
offsetLeft = Math.floor(seatDiff / 2);
offsetRight = Math.floor((seatDiff / 2)) + (seatDiff % 2);
var remainder = seatDiff % 2;
console.log("Remainder: " + remainder);
if (DATA.CONFIG['DEBUG']) console.log("Odd & Remainder: " + remainder);
}
else { // EVEN
console.log("Even");
offsetRight = seatDiff / 2;
offsetLeft = seatDiff / 2;
if (DATA.CONFIG['DEBUG']) console.log('Even');
}
console.log("offsetLeft: " + offsetLeft + " offsetRight: " + offsetRight);
if (DATA.CONFIG['DEBUG']) console.log("offsetLeft: " + offsetLeft + " offsetRight: " + offsetRight);
}
}
else {
seatDiff = 0;
}
console.log('overallMaxSectionSeats ' + overallMaxSectionSeats + " | maxSectionSeats " + maxSectionSeats + " | seatDiff: " + seatDiff);
if (DATA.CONFIG['DEBUG']) console.log('overallMaxSectionSeats ' + overallMaxSectionSeats + " | maxSectionSeats " + maxSectionSeats + " | seatDiff: " + seatDiff);
// LOOP THROUGH ROWS
var rowSection = 0;
for (var i in sectionObj.ROWS) {
console.log("ROW: " + i);
rowSection++;
// LOOP THROUGH ROW SEATS
@@ -1454,14 +1417,14 @@ function generateMapMatrix(DATA) {
}
}
console.log('mapping y: ' + mapping[sectionObj.ID]['y']);
console.log('mapping x: ' + mapping[sectionObj.ID]['x']);
// console.log('matrix: ' + matrix);
// console.log('matrixBIG: ' + matrixBIG);
var y = mapping[sectionObj.ID]['y'];
var x = mapping[sectionObj.ID]['x'];
matrixBIG[y][x] = matrix;
if (DATA.CONFIG['DEBUG']) {
console.log('mapping y: ' + mapping[sectionObj.ID]['y']);
console.log('mapping x: ' + mapping[sectionObj.ID]['x']);
}
}
if (DATA.CONFIG['DEBUG']) console.log(matrixBIG);
@@ -1483,10 +1446,13 @@ function generateMapMatrix(DATA) {
}
}
if (DATA.CONFIG['DEBUG']) console.log(map1d);
if (DATA.CONFIG['DEBUG']) console.log(seatsUnavailable);
if (DATA.CONFIG['DEBUG']) console.log(mappingPricescalesSections);
if (DATA.CONFIG['DEBUG']) console.log(rows);
if (DATA.CONFIG['DEBUG']) {
console.log(map1d);
console.log(seatsUnavailable);
console.log(mappingPricescalesSections);
console.log(rows);
}
return [map1d, seatsUnavailable, mappingPricescalesSections, rows];
}
@@ -1495,16 +1461,12 @@ function seperateSeatmapsCSS(DATA) {
// ROW NODES OBJECT
var nodes = document.getElementById('seat-map').childNodes;
console.log(nodes);
console.log(nodes.length);
var sortedSections = sortSeatmaps(DATA);
// IF ONLY 1 SECTION
console.log(Object.keys(DATA.VENUE.SEATMAP_CONFIG).length);
if (Object.keys(DATA.VENUE.SEATMAP_CONFIG).length == 1) {
if (DATA.CONFIG['DEBUG']) console.log("NOT MORE THAN 1 SECTION AVAILABLE. RETURN.");
var sectionObj = sortedSections[0][1];
console.log(sortedSections);
// INSERT INDICATOR
if (DATA.CONFIG[DATA.VENUE.CODE]["BUEHNE"] === "TOP") {
@@ -1624,10 +1586,9 @@ function checkoutGenerateURL(selected_seat_indexes) {
function checkoutCheckResponse(selected_seat_indexes, DATA) {
if (DATA.CONFIG['DEBUG']) console.log(getFuncName());
console.log(DATA);
var rootURL = 'https://purchase.tickets.com/buy/TicketPurchase';
var rootURLNoSlash = 'purchase.tickets.com/buy/TicketPurchase';
var successful;
var parameter = '';
for (var property in param) {
@@ -1638,55 +1599,61 @@ function checkoutCheckResponse(selected_seat_indexes, DATA) {
parameter = parameter.substring(0, parameter.length - 1);
parameter = parameter + "&trxstate=148&selected_seat_indexes=" + selected_seat_indexes;
// console.log(parameter);
// var parameter_proxy = "trxstate=148&pid=" + param["pid"] + "&user_context=" + param["user_context"] + "&selected_seat_indexes=" + selected_seat_indexes;
// var checkoutURLNoSlash = decodeURIComponent(rootURLNoSlash + '?' + parameter_proxy);
var checkoutURLNoSlash = decodeURIComponent(rootURLNoSlash + '?' + parameter);
var proxyCheckoutURL = DATA.CONFIG["CORS-ANYWHERE"]["ROOT_URL"] + checkoutURLNoSlash;
if (DATA.CONFIG['DEBUG']) console.log('Get: ' + proxyCheckoutURL);
// PROXY CHECKOUT URL
//var rootURLNoSlash = 'purchase.tickets.com:443/buy/TicketPurchase';
let rootURLNoSlash = 'https://purchase.tickets.com/buy/TicketPurchase';
//var checkoutURLNoSlash = decodeURIComponent(rootURLNoSlash + '?' + parameter);
//var proxyCheckoutURL = DATA.CONFIG["CORS-ANYWHERE"]["ROOT_URL"] + checkoutURLNoSlash;
var checkoutURLNoSlash = encodeURIComponent(rootURLNoSlash + '?' + parameter + '&request_switch=checkoutCheckResponse');
let checkoutCheckResponseURI = DATA.CONFIG["SEATMAP-SERVER"]["ROOT_URL"] + "?url=" + checkoutURLNoSlash;
var checkoutURL;
if (param.hasOwnProperty("orderkey")) {
console.log("ADD ANOTHER TICKET DETECTED");
if (DATA.CONFIG['DEBUG']) console.log("ADD ANOTHER TICKET DETECTED");
var parameter_30 = 'user_context=' + param['user_context'] + '&orderkey=' + param['orderkey'] + '&orgid=' + param['orgid'] + '&trxstate=30';
checkoutURL = decodeURIComponent(rootURL + '?' + parameter_30);
}
else {
console.log("FIRST TICKET DETECTED");
if (DATA.CONFIG['DEBUG']) console.log("FIRST TICKET DETECTED");
checkoutURL = decodeURIComponent(rootURL + '?' + parameter);
}
var successful;
$.ajax({
url: proxyCheckoutURL,
// headers: { 'X-Requested-With': 'XMLHttpRequest' },
method: 'GET',
dataType: 'html',
success: function(data) {
// if (DATA.CONFIG['DEBUG']) console.log(data);
if (DATA.CONFIG['DEBUG']) {
console.log(DATA);
//console.log('proxyCheckoutURL: ' + proxyCheckoutURL);
//console.log('checkoutURL:' + checkoutURL);
console.log('checkoutCheckResponseURI: ' + checkoutCheckResponseURI);
}
data = data.replace(/(?:\r\n|\r|\n|\t| {2,})/g, '');
// console.log(data);
var errorMsg = data.match(/<input type="hidden" name="no_timeout_error_msg" id="no_timeout_error_msg" value="(.*?)" \/>/)[1];
console.log(errorMsg);
if (DATA.CONFIG['DEBUG']) console.log("DATA['CONFIG']['CHECKOUT-AVAILABILITY-CHECK']: " + DATA['CONFIG']['CHECKOUT-AVAILABILITY-CHECK']);
if (errorMsg === '') {
successful = true;
if( DATA['CONFIG']['CHECKOUT-AVAILABILITY-CHECK'] == 'enabled' ) {
if (DATA.CONFIG['DEBUG']) console.log('CHECKOUT-AVAILABILITY-CHECK enabled');
$.getJSON(checkoutCheckResponseURI,
function(data) {
if (DATA.CONFIG['DEBUG']) console.log(data);
if( data['no_timeout_error_msg']['value'] === '' ) {
console.log('Good to go');
successful = 1;
ProductManager.clearProduct();
$cartBadge.text(ProductManager.getTotalQuantity());
$("#" + idCartModal).modal("hide");
// REDIRECT TO TICKET PURCHASE
console.log('successfull, now going to: ' + checkoutURL);
window.location.replace(checkoutURL);
// window.open(checkoutURL, '_blank');
// window.location.replace(proxyCheckoutURL);
if (DATA.CONFIG['DEBUG']) console.log('successfull, now going to: ' + checkoutURL);
//window.location.replace(checkoutURL);
}
else {
successful = false;
errorMsg = errorMsg.replace(/\<br\>/g, ' ');
else if( data['no_timeout_error_msg']['value'] !== '' ) {
console.log('We have an error');
successful = 0;
let errorMsg = data['no_timeout_error_msg']['value'].replace(/\<br\>/g, ' ');
new jBox('Notice', {
content: errorMsg,
color: 'red',
@@ -1697,18 +1664,58 @@ function checkoutCheckResponse(selected_seat_indexes, DATA) {
closeButton: 'box',
});
}
}
});
}
else if( DATA['CONFIG']['CHECKOUT-AVAILABILITY-CHECK'] == 'disabled' ) {
if (DATA.CONFIG['DEBUG']) console.log('CHECKOUT-AVAILABILITY-CHECK disabled');
if (DATA.CONFIG['DEBUG']) console.log('Now going to: ' + checkoutURL);
window.location.replace(checkoutURL);
}
// var successful;
// $.ajax({
// url: checkoutCheckResponseURI,
// method: 'GET',
// dataType: 'html',
// //headers: { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'de,en-US;q=0.7,en;q=0.3', 'Host': 'purchase.tickets.com' },
// headers: { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'de,en-US;q=0.7,en;q=0.3' },
// success: function(data) {
// // CORS PROXY RESPONSE
// data = data.replace(/(?:\r\n|\r|\n|\t| {2,})/g, '');
// var errorMsg = data.match(/<input type="hidden" name="no_timeout_error_msg" id="no_timeout_error_msg" value="(.*?)" \/>/)[1];
// if (DATA.CONFIG['DEBUG']) console.log('errorMsg: ' + errorMsg);
// if (errorMsg === '') {
// successful = true;
// ProductManager.clearProduct();
// $cartBadge.text(ProductManager.getTotalQuantity());
// $("#" + idCartModal).modal("hide");
// // REDIRECT TO TICKET PURCHASE
// if (DATA.CONFIG['DEBUG']) console.log('successfull, now going to: ' + checkoutURL);
// window.location.replace(checkoutURL);
// }
// else {
// successful = false;
// errorMsg = errorMsg.replace(/\<br\>/g, ' ');
// new jBox('Notice', {
// content: errorMsg,
// color: 'red',
// width: '100vw',
// responsiveWidth: true,
// position: { x: 'center', y: 'top' },
// autoClose: 10000,
// closeButton: 'box',
// });
// }
// }
// });
return successful;
}
function untickSeat(id) {
if (DATA.CONFIG['DEBUG']) console.log(getFuncName());
console.log(id);
document.getElementById(id).click(); // Click on the checkbox
}
function selectRefreshPrice(select) {
if (DATA.CONFIG['DEBUG']) console.log(getFuncName());
@@ -1817,8 +1824,7 @@ function generateSeatmap(DATA) {
return 'available';
}
else if (this.status() == 'unavailable') {
//seat has been already booked
console.log('unavailable');
// SEAT ALREADY BOOKED
return 'unavailable';
}
else {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -100,24 +100,6 @@ div.seatCharts-seat.unavailable {
opacity: 0.3;
}
/*div.seatCharts-seat.unavailable:before {*/
/* background: #037CA9;*/
/* content: "";*/
/* width: 10px;*/
/* height: 5px;*/
/* position: absolute;*/
/* top: 5px;*/
/* left: -5px;*/
/*}*/
div.seatCharts-container {
/*border-right: 1px dotted #adadad;*/
width: auto;
@@ -125,9 +107,6 @@ div.seatCharts-container {
}
div.seatCharts-legend {
/*padding-left: 0px;*/
/*position: absolute;*/
/*bottom: 16px;*/
padding-top: 0px;
}
@@ -140,7 +119,6 @@ ul.seatCharts-legendList {
span.seatCharts-legendDescription {
margin-left: 0.5vw;
line-height: 1.2vw;
/*font-size: 1vw;*/
}
.checkout-button {
@@ -157,7 +135,6 @@ span.seatCharts-legendDescription {
}
#spacer {
/*margin: 40px 0px 0px 0px;*/
margin: 2vw 0vw 0vw 0vw;
}
@@ -193,39 +170,12 @@ div.seatCharts-cell {
visibility: hidden;
margin: 0;
padding: 0;
/*padding-right: 1vw;*/
/*padding-left: 1vw;*/
/*margin-right: auto;*/
/*margin-left: auto;*/
}
h4 {
font-size: 1.2vw;
}
/*.row {*/
/* display: -webkit-box;*/
/* display: -webkit-flex;*/
/* display: -ms-flexbox;*/
/* display: flex;*/
/* flex-wrap: wrap;*/
/*}*/
/*.row > [class*='col-'] {*/
/* display: flex;*/
/* flex-direction: column;*/
/*}*/
.centered {
position: fixed;
/* or absolute */
@@ -235,28 +185,6 @@ h4 {
transform: translate(-50%, -50%);
}
/*SHOPPING CART*/
/*.badge-notify{*/
/* background:red;*/
/* position:relative;*/
/* top: -20px;*/
/* right: 10px;*/
/*}*/
/*.my-cart-icon-affix {*/
/* position: fixed;*/
/* z-index: 999;*/
/*}*/
.glyphicon {
font-size: 2vw;
top: -.2vw;
@@ -457,30 +385,3 @@ h5 {
width: 60%;
margin: auto;
}
/*ONLY IE < 10*/
/*@media all and (-ms-high-contrast: none),*/
/*(-ms-high-contrast: active) {*/
/* div.seatCharts-cell {*/
/* height: 1.36vw;*/
/* width: 1.36vw;*/
/* }*/
/*}*/
/*@media (min-width: 531px) and (max-width:770px) {*/
/* div.seatCharts-cell {*/
/* height: 1.33vw;*/
/* width: 1.33vw;*/
/* }*/
/*}*/
/*@media (min-width: 400px) and (max-width:530px) {*/
/* div.seatCharts-cell {*/
/* height: 1.301vw;*/
/* width: 1.301vw;*/
/* }*/
/* .glyphicon {*/
/* display: none;*/
/* }*/
/*}*/

View File

@@ -1,39 +1,64 @@
var config = {
'DEBUG': true,
'BRANCH': 'seatmap_main',
'BRANCH': 'seatmap_testing',
};
if (config['BRANCH'] === 'seatmap_testing') {
config['SEATMAP_WEBAPI_URL'] = 'https://seatmap-testing.zinomedia.de/seatmap-webapi/api.php';
config['SEATMAP_WEBAPI_URL'] = 'https://staging.purchase.tickets.zinomedia.de/seatmap-webapi/api.php';
}
else if (config['BRANCH'] === 'seatmap_main') {
config['SEATMAP_WEBAPI_URL'] = 'https://zinomedia.de/seatmap_main/seatmap-webapi/api.php';
}
if (!String.prototype.repeat) {
String.prototype.repeat = function(count) {
'use strict';
if (this == null)
throw new TypeError('can\'t convert ' + this + ' to object');
var str = '' + this;
// To convert string to integer.
count = +count;
// Check NaN
if (count != count)
count = 0;
if (count < 0)
throw new RangeError('repeat count must be non-negative');
if (count == Infinity)
throw new RangeError('repeat count must be less than infinity');
count = Math.floor(count);
if (str.length == 0 || count == 0)
return '';
// Ensuring count is a 31-bit integer allows us to heavily optimize the
// main part. But anyway, most current (August 2014) browsers can't handle
// strings 1 << 28 chars or longer, so:
if (str.length * count >= 1 << 28)
throw new RangeError('repeat count must not overflow maximum string size');
var maxCount = str.length * count;
count = Math.floor(Math.log(count) / Math.log(2));
while (count) {
str += str;
count--;
}
str += str.substring(0, maxCount - str.length);
return str;
}
}
jQuery(document).ready(function() {
if (config['DEBUG']) console.log(getFuncName('ready'));
check_inject();
});
function check_inject() {
if (config['DEBUG']) console.log(getFuncName());
var pvo_venue_name = jQuery('.venue span')[0].textContent.toUpperCase();
var url = config['SEATMAP_WEBAPI_URL'] + '/records/halls?filter=PVO_VENUE_NAME,eq,' + pvo_venue_name + '&include=INJECT';
var result = jQuery.get(url, function(data) {})
.done(function(data) {
if (data['records'][0]['INJECT']) {
if (config['DEBUG']) console.log('Starting inject...');
inject_seatmap();
}
else {
if (config['DEBUG']) console.log('Not injecting.');
}
});
}
function inject_seatmap() {
var url, param;
var content = document.getElementsByTagName('html')[0].innerHTML;
var inputsWithValue = getInputs(content);
if (config['DEBUG']) console.log(inputsWithValue);
@@ -42,19 +67,47 @@ function inject_seatmap() {
if (inputsWithValue.hasOwnProperty("trxstate") && inputsWithValue["trxstate"].value == 20) {
if (config['DEBUG']) console.log("trxstate 20 identified");
var pvo_venue_name = jQuery('.venue span')[0].textContent.toUpperCase();
var url = config['SEATMAP_WEBAPI_URL'] + '/records/halls?filter=PVO_VENUE_NAME,eq,' + pvo_venue_name + '&include=INJECT';
if (config['DEBUG']) console.log('Get: ' + url);
var result = jQuery.get(url, function(data) {})
.done(function(data) {
if (config['DEBUG']) console.log(data);
if (data['records'][0]['INJECT']) {
if (config['DEBUG']) console.log('Starting inject...');
inject_seatmap(inputsWithValue, content);
}
else {
if (config['DEBUG']) console.log('Not injecting.');
}
});
}
else if (inputsWithValue.hasOwnProperty("prevtrxstate") && inputsWithValue["prevtrxstate"].value == 30) {
if (config['DEBUG']) console.log("prevtrxstate 30 identified");
}
else {
if (config['DEBUG']) console.log("No action set: trxstate: " + inputsWithValue["trxstate"].value);
}
}
}
function inject_seatmap(inputsWithValue, content) {
if (config['DEBUG']) console.log(getFuncName('ready'));
manipulateDocument();
var note = important_note();
param = getPosturl(content);
let note = important_note();
let param = getPosturl(content);
let request_switch = 'seatmapWorkflow';
if (jQuery('#flash_seat_map_box_id').length) {
url = generateUrl(param, inputsWithValue, note);
if (config['DEBUG']) console.log(url);
var url = generateUrl(param, inputsWithValue, note, request_switch);
jQuery("#viewSeatFlashMapButton").unbind();
jQuery('#viewSeatFlashMapButton').click(function() {
if (config['BRANCH'] === 'seatmap_testing') {
window.location.href = 'https://seatmap-testing.zinomedia.de/seatmap-client/index.html?' + "posturl=" + url;
window.location.href = 'https://staging.purchase.tickets.zinomedia.de/seatmap-client/index.html?' + "posturl=" + encodeURIComponent(url);
}
else if (config['BRANCH'] === 'seatmap_main') {
window.location.href = 'https://purchase.tickets.zinomedia.de/?' + "posturl=" + url;
window.location.href = 'https://purchase.tickets.zinomedia.de/seatmap-client?' + "posturl=" + encodeURIComponent(url);
}
else {
throw new Error('Die: Branch not defined.');
@@ -62,15 +115,8 @@ function inject_seatmap() {
});
}
}
else if (inputsWithValue.hasOwnProperty("prevtrxstate") && inputsWithValue["prevtrxstate"].value == 30) {
if (config['DEBUG']) console.log("prevtrxstate 30 identified");
// jQuery(".jq_replace")[0].text = 'Abbrechen';
// jQuery('.jq_add').css('display', 'none');
}
}
}
function generateUrl(param, inputsWithValue, note) {
function generateUrl(param, inputsWithValue, note, request_switch) {
if (config['DEBUG']) console.log(getFuncName());
var url = param[0];
@@ -86,10 +132,18 @@ function generateUrl(param, inputsWithValue, note) {
parameter = parameter.substring(0, parameter.length - 1);
url = url + "&holdcode=" + holdcode + "&event=" + event + '&nocache=0&inclpkg=Y&incloffer=Y&inclcartdetails=Y&inclCart=Y&inclvenue=Y' + parameter;
if (typeof note !== 'undefined') {
url = url + '&note=' + note;
}
url = encodeURIComponent(url);
if (typeof request_switch !== 'undefined') {
url = url + '&request_switch=' + request_switch;
}
if (config['DEBUG']) console.log('URI before decode: ' + url);
url = decodeURIComponent(url);
if (config['DEBUG']) console.log('URI after decode: ' + url);
return url;
}
@@ -131,8 +185,15 @@ function important_note() {
if (config['DEBUG']) console.log(getFuncName());
var element = document.getElementsByClassName('important_note');
//console.log(element);
if (element.length > 0) {
var important_note = element[0].textContent;
// Replace newlines so we can decode it later
//important_note = important_note.replace(/(\r\n|\n|\r)/gm, " ");
// Fix: Encode component so we can pass it within url
important_note = encodeURIComponent(important_note);
if (config['DEBUG']) console.log(important_note);
return important_note;

View File

@@ -15,6 +15,9 @@ use feature qw/say/;
use Encode::Deep;
use DBD::mysql;
use URI::Encode qw(uri_encode uri_decode);
use URI::Split qw(uri_split uri_join);
use Data::Dumper;
use HTML::TreeBuilder::XPath;
# LWP
my $ua = LWP::UserAgent->new(keep_alive => 1);
@@ -31,6 +34,7 @@ my %CONFIG =
'DEBUG' => 0,
'DEBUG_PRINT_DATA' => 0,
'ONLINE' => 1,
'USE_CORSANYWHERE' => 0,
'OFFLINE_XML' => '../seatmap-client/offline/MapTicketSales.xml',
'OFFLINE_XML_PARKETT' => '../seatmap-client/offline/MapTicketSales_Parkett.xml',
'OFFLINE_XML_RANG' => '../seatmap-client/offline/MapTicketSales_Rang.xml',
@@ -47,16 +51,20 @@ my $connection;
# WORKFLOW
my $t0 = Benchmark->new if $CONFIG{'DEBUG'};
&getParameter();
print Dumper $DATA{'PARAMETER'} if $CONFIG{'DEBUG'};
&checkHost();
if( $DATA{'PARAMETER'}{'request_switch'} eq 'seatmapWorkflow' ) {
say 'Switch seatmapWorkflow' if ($CONFIG{'DEBUG'});
&generateVenueUrl();
my $xml;
if ($CONFIG{'ONLINE'}) {
print "SET AS ONLINE\n" if $CONFIG{'DEBUG'};
$xml = get($DATA{'PARAMETER'}{'urlVenue'});
$xml = &get($DATA{'PARAMETER'}{'urlVenue'});
&loadXML($xml, \$DATA{'DOM'});
&parseXML();
&getSeatmaps();
@@ -72,14 +80,54 @@ elsif (!$CONFIG{'ONLINE'}) {
&loadXML($CONFIG{'OFFLINE_XML_RANG'}, \$DATA{'DOM'});
parxeXML_section();
}
my $config_ref = &getVenueConfig();
&benchmarkEnd();
&printOutput($config_ref);
}
elsif( $DATA{'PARAMETER'}{'request_switch'} eq 'checkoutCheckResponse' ) {
say 'Switch checkoutCheckResponse' if ($CONFIG{'DEBUG'});
my $decoded_content = &get($DATA{'PARAMETER'}{'url'});
#print Dumper $decoded_content;
my $tree = HTML::TreeBuilder::XPath->new_from_content($decoded_content);
my $xpath_alert = '//input[@id="no_timeout_error_msg"]/@value';
if ($tree->exists($xpath_alert)) {
#my $alert = decode('utf-8', trim($tree->findvalue($xpath_alert)));
my %alert;
$alert{'no_timeout_error_msg'}{'value'} = trim($tree->findvalue($xpath_alert));
$alert{'no_timeout_error_msg'}{'id'} = 'no_timeout_error_msg';
if (!$CONFIG{'DEBUG'}) {
print header(
-type => 'application/json',
-access_control_allow_origin => '*',
-charset => 'utf-8',
);
# OUTPUT JSON
print encode_json \%alert;
}
elsif ($CONFIG{'DEBUG'}) {
print Dumper \%alert;
}
}
}
&benchmarkEnd() if ($CONFIG{'DEBUG'});
# SUBS
sub trim {
my $string = shift;
$string =~ s/^\s+|\s+$//g;
return $string;
}
sub db_getVenueConfig {
&Delimiter((caller(0))[3]);
@@ -340,12 +388,10 @@ sub checkHost() {
sub benchmarkEnd() {
&Delimiter((caller(0))[3]);
if ($CONFIG{'DEBUG'}) {
my $t1 = Benchmark->new;
my $td = timediff($t1, $t0);
print "BENCHMARK: ",timestr($td),"\n" if $CONFIG{'DEBUG'};
}
}
sub generateVenueUrl() {
&Delimiter((caller(0))[3]);
@@ -581,19 +627,44 @@ sub getParameter {
my $url = $ENV{QUERY_STRING};
my $decoded = uri_decode($url);
say "decoded: " . $decoded if ($CONFIG{'DEBUG'});
my $uri = URI->new($decoded);
%{$DATA{'PARAMETER'}} = $uri->query_form;
$DATA{'PARAMETER'}{'url'} = url_param('url');
#$DATA{'PARAMETER'}{'url'} = url_param('url');
$DATA{'PARAMETER'}{'url'} = $decoded;
$DATA{'PARAMETER'}{'url'} =~ s/^url=//;
# Remove note, request_switch from decoded uri
$DATA{'PARAMETER'}{'url'} =~ s/&note(=[^&]*)?|^note(=[^&]*)?&?//;
$DATA{'PARAMETER'}{'url'} =~ s/&request_switch(=[^&]*)?|^request_switch(=[^&]*)?&?//;
}
sub get {
&Delimiter((caller(0))[3]);
my $url = shift;
if ($CONFIG{'USE_CORSANYWHERE'}) {
say 'Generating url for cors-anywhere...';
my ($scheme, $auth, $path, $query, $frag) = uri_split($url);
#say "scheme: $scheme\nauth: $auth\npath: $path\nquery: $query\nfrag: $frag";
$url = 'https://cors.zinomedia.de/purchase.tickets.com:443' . $path . '?' . $query;
say "cors-anywhere URL: $url";
}
if ($CONFIG{'ONLINE'}) {
print "GET:\n$url\n" if $CONFIG{'DEBUG'};
my $response = $ua->get($url);
#my $response = $ua->get($url);
my $response = $ua->get($url,
'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language' => 'de,en-US;q=0.7,en;q=0.3',
'Host' => 'purchase.tickets.com',
);
print 'STATUS_LINE: ' . $response->status_line . "\n" if $CONFIG{'DEBUG'};
if ($response->is_success) {
return $response->decoded_content;
@@ -602,6 +673,8 @@ sub get {
$response->code();
$response->message();
$response->status_line();
say 'Get unsuccessful' if $CONFIG{'DEBUG'};
die;
}
}
elsif (!$CONFIG{'ONLINE'}) {

13035
seatmap-webapi/tmp_api.php Normal file

File diff suppressed because it is too large Load Diff

BIN
seatmap_main.zip Normal file

Binary file not shown.