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

@@ -1,76 +1,122 @@
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);
if (!jQuery.isEmptyObject(inputsWithValue)) {
if (inputsWithValue.hasOwnProperty("trxstate") && inputsWithValue["trxstate"].value == 20) {
if (config['DEBUG']) console.log("trxstate 20 identified");
manipulateDocument();
var note = important_note();
param = getPosturl(content);
if (jQuery('#flash_seat_map_box_id').length) {
url = generateUrl(param, inputsWithValue, note);
if (config['DEBUG']) console.log(url);
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;
}
else if (config['BRANCH'] === 'seatmap_main') {
window.location.href = 'https://purchase.tickets.zinomedia.de/?' + "posturl=" + url;
}
else {
throw new Error('Die: Branch not defined.');
}
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");
// jQuery(".jq_replace")[0].text = 'Abbrechen';
// jQuery('.jq_add').css('display', 'none');
}
}
else {
if (config['DEBUG']) console.log("No action set: trxstate: " + inputsWithValue["trxstate"].value);
}
}
}
function generateUrl(param, inputsWithValue, note) {
function inject_seatmap(inputsWithValue, content) {
if (config['DEBUG']) console.log(getFuncName('ready'));
manipulateDocument();
let note = important_note();
let param = getPosturl(content);
let request_switch = 'seatmapWorkflow';
if (jQuery('#flash_seat_map_box_id').length) {
var url = generateUrl(param, inputsWithValue, note, request_switch);
jQuery("#viewSeatFlashMapButton").unbind();
jQuery('#viewSeatFlashMapButton').click(function() {
if (config['BRANCH'] === 'seatmap_testing') {
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/seatmap-client?' + "posturl=" + encodeURIComponent(url);
}
else {
throw new Error('Die: Branch not defined.');
}
});
}
}
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;