Skip to content

Instantly share code, notes, and snippets.

@ahornerr
Created February 21, 2013 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahornerr/5008588 to your computer and use it in GitHub Desktop.
Save ahornerr/5008588 to your computer and use it in GitHub Desktop.
//Standard row data
var std_seats = {
"A":1,
"B":2,
"C":3,
"D":4,
"E":5,
"F":6,
"G":7,
"H":8,
"J":9,
"K":10,
"L":11,
"M":12,
"N":13,
"P":14,
"Q":15,
"R":16,
"S":17,
"T":18,
"U":19
};
//The actual array of map data
var seat_data = {};
//Returns an array of the low and the high seat number
//Fuck this shit.
//STROH CENTER.
//MOTHAFUCKIN STROH CENTER
//Return: Array.
//Add some type of return for the general admission
//[low seats, high seats, start pos x (f), strt pos y (f), xadd (-1/1), yadd (-1/1)]
function fetch_seat(section, row, seat) {
var profile = {};
//console.log(section);
switch (section){
case "GA": //This may be different
case "GA2":
//General admission, not sure what to do here yet.
//101: TODO
//Starting top left, in percentages of image
//118: (2.1, 49.2), (12.3,49.2), (12.3, 54.7), (9.1, 54.7), (9.1, 58.2), (2.1, 58.2)
//119: (2.1, 40.2), (12.3, 40.2) (12.3, 48.4), (2.1, 48.4)
//120: (2.1, 29.1), (9.1, 29.1), (9.1, 34.1), (12.3, 34.1), (12.3, 39.3), (2.1, 39.3)
return 0;
break;
//Each row in section 102 has 14 seats.
case 102:
profile = {low: 1, high: 14, xstart: 0.3171, ystart: 0.2942, seatwidth: -0.00825, seatheight: -0.01040};
break;
case 103:
profile = {low: 1, high: 16, xstart: 0.4845, ystart: 0.2942, seatwidth: -0.00825, seatheight: -0.01040};
break;
case 104:
profile.xstart = 0.6318;
profile.ystart = 0.2942;
profile.seatwidth = -0.00825;
profile.seatheight = -0.01040;
profile.high = 14;
if (isBetweenRows(row, "A", "A")){
profile.low = 9;
} else {
profile.low = 1;
}
break;
case 105:
profile.xstart = 0.7876;
profile.ystart = 0.2942;
profile.seatwidth = -0.00825;
profile.seatheight = -0.01040;
profile.high = 16;
if (isBetweenRows(row, "B", "D")){
profile.low = 13;
}else if (isBetweenRows(row, "E", "H")){
profile.low = 10;
}else if (isBetweenRows(row, "J", "U")){
profile.low = 1;
}
break;
case 106:
case 112:
if (section == 106) {
profile.xstart = 0.9566;
profile.ystart = 0.2942;
profile.seatwidth = -0.00825;
profile.seatheight = -0.01040;
} else {
profile.xstart = 0.8101;
profile.ystart = 0.5896;
profile.seatwidth = 0.00825;
profile.seatheight = 0.01040;
}
profile.high = 18;
var seats_low = {
"J":15,
"K":14,
"L":12,
"M":11,
"N":10,
"P":8,
"Q":7,
"R":6,
"S":4,
"T":3,
"U":1
};
profile.low = seats_low[row];
break;
//TODO
case 107:
case 111:
profile.low = 1;
profile.lefttoright = true;
if (section == 107) {
profile.xstart = 0.7202;
profile.ystart = 0.2248;
profile.seatwidth = -0.00636;
profile.seatheight = 0.01354;
var seats_high = {
"J":2,
"K":4,
"L":5,
"M":7,
"N":10,
"P":10,
"Q":11,
"R":13,
"S":15,
"T":16,
"U":18
};
profile.high = seats_high[row];
} else {
profile.xstart = 0.7202;
profile.ystart = 0.7699;
profile.seatwidth = -0.00636;
profile.seatheight = 0.01354;
profile.high = 18;
var seats_low = {
"J":16,
"K":14,
"L":13,
"M":11,
"N":8,
"P":8,
"Q":7,
"R":5,
"S":3,
"T":2,
"U":1
};
profile.low = seats_low[row];
}
break;
case 108:
profile.lefttoright = true;
profile.xstart = 0.7202;
profile.ystart = 0.3630;
profile.seatwidth = -0.00636;
profile.seatheight = 0.01354;
profile.low = 1;
if (isBetweenRows(row, "A", "C")) {
profile.high = 8;
} else if (isBetweenRows(row, "D", "H")) {
profile.high = 12;
} else {
profile.high = 18;
}
break;
case 109:
profile.lefttoright = true;
profile.xstart = 0.7202;
profile.ystart = 0.5000;
profile.seatwidth = -0.00636;
profile.seatheight = 0.01354;
profile.low = 1;
profile.high = 18;
break;
case 110:
profile.lefttoright = true;
profile.xstart = 0.7202;
profile.ystart = 0.5225;
profile.seatwidth = -0.00636;
profile.seatheight = 0.01354;
profile.high = 18;
if (isBetweenRows(row, "A", "C")) {
profile.low = 12;
} else if (isBetweenRows(row, "D", "H")) {
profile.low = 7;
} else {
profile.low = 1;
}
break;
case 113:
profile.xstart = 0.6636;
profile.ystart = 0.5896;
profile.seatwidth = 0.00825;
profile.seatheight = 0.01040;
profile.low = 1;
if (isBetweenRows(row, "B", "D")){
profile.high = 4;
}else if (isBetweenRows(row, "E", "H")){
profile.high = 9;
}else if (isBetweenRows(row, "J", "U")){
profile.high = 16;
}
break;
case 114:
profile = {low: 1, high: 10, xstart: 0.5574, ystart: 0.5896, seatwidth: 0.00825, seatheight: 0.01040};
break;
case "115A":
case "115 A":
profile = {low: 1, high: 4, xstart: 0.5140, ystart: 0.5896, seatwidth: 0.00825, seatheight: 0.01040};
break;
case "115B":
case "115 B":
profile = {low: 1, high: 16, xstart: 0.3496, ystart: 0.5896, seatwidth: 0.00825, seatheight: 0.01040};
break;
case "115C":
case "115 C":
profile = {low: 1, high: 4, xstart: 0.2907, ystart: 0.5896, seatwidth: 0.00825, seatheight: 0.01040};
break;
case 116:
profile = {low: 1, high: 16, xstart: 0.3496, ystart: 0.5896, seatwidth: 0.00825, seatheight: 0.01040};
break;
case 117:
profile.xstart = 0.0457;
profile.ystart = 0.5896;
profile.seatwidth = 0.00825;
profile.seatheight = 0.01040;
profile.high = 16;
if (isBetweenRows(row, "A", "D")){
profile.low = 14;
}else if (isBetweenRows(row, "E", "H")){
profile.low = 9;
}else if (isBetweenRows(row, "J", "U")){
profile.low = 1;
}
break;
case 118:
profile.lefttoright = true;
profile.xstart = .123;
profile.ystart = .492;
profile.seatwidth = 0.009;
profile.seatheight = -0.0102;
profile.low = 1;
if (isBetweenRows(row, "A", "C")){
profile.high = 4;
}else if (isBetweenRows(row, "D", "K")){
profile.high = 10;
}
break;
case 119:
profile.lefttoright = true;
profile.xstart = .123;
profile.ystart = .402;
profile.seatwidth = 0.0041;
profile.seatheight = -0.0102;
profile.low = 1;
profile.high = 20;
break;
case 120:
profile.lefttoright = true;
profile.xstart = .123;
profile.ystart = .291;
profile.seatwidth = 0.009;
profile.seatheight = -0.0102;
profile.high = 11;
if (isBetweenRows(row, "A", "C")){
profile.low = 9;
}else if (isBetweenRows(row, "D", "K")){
profile.low = 1;
}
break;
//Starting top left, in percentages of image
//118: (2.1, 49.2), (12.3,49.2), (12.3, 54.7), (9.1, 54.7), (9.1, 58.2), (2.1, 58.2)
//119: (2.1, 40.2), (12.3, 40.2) (12.3, 48.4), (2.1, 48.4)
//120: (2.1, 29.1), (9.1, 29.1), (9.1, 34.1), (12.3, 34.1), (12.3, 39.3), (2.1, 39.3)
}
if (seat >= profile.low && seat <= profile.high){
console.log(profile);
console.log("Low: " + profile.low + " High: " + profile.high);
// -.5 puts it more towards the middle of the seat width
// instead of being on the edges
if (profile.lefttoright) {
return {
x: profile.xstart + ((std_seats[row] - .5) * profile.seatheight),
y: profile.ystart + ((seat - .5 ) * profile.seatwidth)};
} else {
return {
x: profile.xstart + ((seat - .5 ) * profile.seatwidth),
y: profile.ystart + ((std_seats[row] - .5) * profile.seatheight)};
}
} else {
//alert("That seat is invalid");
}
}
function isBetweenRows(stat, begin, end){
return (std_seats[stat] >= std_seats[begin] && std_seats[stat] <= std_seats[end]);
}
/*$(document).ready(function(){
$(".send").on('click', function() {
//Test if the section contains a number, becaose of 115A, etc
if (isNaN($('.section').val())) {
var section = $('.section').val(); //Contains numbers
} else {
var section = parseInt($('.section').val(), 10); //Radux 10
}
var row = $('.row').val();
var seat = parseInt($('.seat').val(), 10); //Radux 10
console.log(section + "," + row + "," + seat);
var val = fetch_seat(section,row,seat);
console.log(val);
var leftpx = (val.x * $('.fuckandy').width())+"px";
var toppx = (val.y * $('.fuckandy').height())+"px";
console.log('left: ' + leftpx + ' toppx:' + toppx);
$(".pointer").css("left", leftpx);
$(".pointer").css("top", toppx);
});
});*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment