Skip to content

Instantly share code, notes, and snippets.

@RyanCopley
Created February 15, 2013 20:49
Show Gist options
  • Save RyanCopley/4963425 to your computer and use it in GitHub Desktop.
Save RyanCopley/4963425 to your computer and use it in GitHub Desktop.
//Standard row data
var std_seats = [
{
"section_name": "A",
"row_name": "1",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "A",
"row_name": "2",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "A",
"row_name": "3",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "A",
"row_name": "4",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "A",
"row_name": "5",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "A",
"row_name": "6",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "A",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "12",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "13",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "14",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "15",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "16",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "17",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "18",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "A",
"row_name": "19",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "B",
"row_name": "1",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "B",
"row_name": "2",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "B",
"row_name": "3",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "B",
"row_name": "4",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "B",
"row_name": "5",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "B",
"row_name": "6",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "B",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "B",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "B",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "B",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "B",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "B",
"row_name": "12",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "B",
"row_name": "13",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "B",
"row_name": "14",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "B",
"row_name": "15",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "B",
"row_name": "16",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "B",
"row_name": "17",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "B",
"row_name": "18",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "B",
"row_name": "19",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "BB",
"row_name": "1",
"seat_num": "1",
"last_seat": "10",
"num_seats": "10"
},
{
"section_name": "BB",
"row_name": "2",
"seat_num": "1",
"last_seat": "10",
"num_seats": "10"
},
{
"section_name": "BB",
"row_name": "3",
"seat_num": "1",
"last_seat": "10",
"num_seats": "10"
},
{
"section_name": "C",
"row_name": "1",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "C",
"row_name": "2",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "C",
"row_name": "3",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "C",
"row_name": "4",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "C",
"row_name": "5",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "C",
"row_name": "6",
"seat_num": "1",
"last_seat": "12",
"num_seats": "12"
},
{
"section_name": "C",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "C",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "C",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "C",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "C",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "C",
"row_name": "12",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "C",
"row_name": "13",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "C",
"row_name": "14",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "C",
"row_name": "15",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "C",
"row_name": "16",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "C",
"row_name": "17",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "C",
"row_name": "18",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "C",
"row_name": "19",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "CC",
"row_name": "1",
"seat_num": "1",
"last_seat": "10",
"num_seats": "10"
},
{
"section_name": "CC",
"row_name": "2",
"seat_num": "1",
"last_seat": "10",
"num_seats": "10"
},
{
"section_name": "CC",
"row_name": "3",
"seat_num": "1",
"last_seat": "10",
"num_seats": "10"
},
{
"section_name": "D",
"row_name": "1",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "D",
"row_name": "2",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "D",
"row_name": "3",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "D",
"row_name": "4",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "D",
"row_name": "5",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "D",
"row_name": "6",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "D",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "D",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "D",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "D",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "D",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "D",
"row_name": "12",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "D",
"row_name": "13",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "D",
"row_name": "14",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "D",
"row_name": "15",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "D",
"row_name": "16",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "D",
"row_name": "17",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "D",
"row_name": "18",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "D",
"row_name": "19",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "1",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "E",
"row_name": "2",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "E",
"row_name": "3",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "E",
"row_name": "4",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "E",
"row_name": "5",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "E",
"row_name": "6",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "E",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "E",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "E",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "E",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "E",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "E",
"row_name": "12",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "13",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "14",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "15",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "16",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "17",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "18",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "E",
"row_name": "19",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "3",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "4",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "5",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "6",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "F",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "F",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "F",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "F",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "F",
"row_name": "12",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "13",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "14",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "15",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "16",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "F",
"row_name": "17",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "3",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "4",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "5",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "6",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "G",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "G",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "G",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "G",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "G",
"row_name": "12",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "13",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "14",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "15",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "16",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "G",
"row_name": "17",
"seat_num": "1",
"last_seat": "24",
"num_seats": "24"
},
{
"section_name": "H",
"row_name": "1",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "H",
"row_name": "2",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "H",
"row_name": "3",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "H",
"row_name": "4",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "H",
"row_name": "5",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "H",
"row_name": "6",
"seat_num": "1",
"last_seat": "20",
"num_seats": "20"
},
{
"section_name": "H",
"row_name": "7",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "8",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "9",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "10",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "11",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "12",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "13",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "14",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "15",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "16",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "17",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "18",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
},
{
"section_name": "H",
"row_name": "19",
"seat_num": "1",
"last_seat": "16",
"num_seats": "16"
}
];
//<Section><num_seats>
/*
{
"xstart":0.657, Percentage of where on the image it starts on the X
"ystart":0.813, //Ditty, but on the Y
"xdir":(124/12), Where it should move, positive or negative based on which direction the rows and seats go.
"ydir":(55/6), (% / (seats | rows))
"seats":12, //How many wide
"rows":6 //How many tall
}
*/
var section_profile = {
"B12":{
"xstart":0.657,
"ystart":0.813,
"xdir":0.092,
"ydir":0.04,
"seats":12,
"rows":6,
"lowrow":1
},
"B16":{
"xstart":0.601,
"ystart":0.872,
"xdir":0.117,
"ydir":0.035,
"seats":16,
"rows":5,
"lowrow":7
},
"B24":{
"xstart":0.601,
"ystart":0.907,
"xdir":0.175,
"ydir":0.063,
"seats":24,
"rows":8,
"lowrow":12
},
"C12":{
"xstart":0.473,
"ystart":0.813,
"xdir":-0.089,
"ydir":0.041,
"seats":12,
"rows":6,
"lowrow":1
},
"C16":{
"xstart":0.533,
"ystart":0.872,
"xdir":-0.11,
"ydir":0.034,
"seats":16,
"rows":5,
"lowrow":7
},
"C24":{
"xstart":0.597,
"ystart":0.91,
"xdir":-0.179,
"ydir":0.063,
"seats":24,
"rows":8,
"lowrow":12
},
"D12":{
"xstart":0.383,
"ystart":0.811,
"xdir":-0.157,
"ydir":0.044,
"seats":20,
"rows":6,
"lowrow":1
},
"D16":{
"xstart":0.350,
"ystart":0.872,
"xdir":-0.126,
"ydir":0.034,
"seats":10,
"rows":5,
"lowrow":7
},
"D24":{
"xstart":0.416,
"ystart":0.913,
"xdir":-0.191,
"ydir":0.060,
"seats":24,
"rows":8,
"lowrow":12
},
"F12":{
"xstart":0.383,
"ystart":0.811,
"xdir":-0.157,
"ydir":0.044,
"seats":20,
"rows":6,
"lowrow":1
},
"F16":{
"xstart":0.350,
"ystart":0.872,
"xdir":-0.126,
"ydir":0.034,
"seats":10,
"rows":5,
"lowrow":7
},
"F24":{
"xstart":0.416,
"ystart":0.913,
"xdir":-0.191,
"ydir":0.060,
"seats":24,
"rows":8,
"lowrow":12
},
};
function fetch_seat(section, row, seat){
var profile = {};
console.log("In fetch seat");
var profile = {};
for (var index in std_seats){
var obj = std_seats[index];
if (obj.section_name == section && obj.row_name == row){
//Grab the profile
profile = section_profile[obj.section_name+obj.num_seats]
console.log(profile);
}
}
var howFarUpRowsInSection = row - profile.lowrow;
console.log("Rows up: "+howFarUpRowsInSection);
return {
"x": profile.xstart + (profile.xdir/profile.seats * (seat)),
"y": profile.ystart + (profile.ydir/profile.rows * howFarUpRowsInSection)
}
console.log("Out of fetch seat");
}
$(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