fixed umlauts using iconv-lite
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import { config } from "./config";
|
||||
import * as I from "../types/types";
|
||||
import Utils from "./utils";
|
||||
|
||||
export function convertLegendToDropdown(inID: string): void {
|
||||
jQuery('ul.seatCharts-legendList').each(function () {
|
||||
let select: JQuery<HTMLSelectElement> = jQuery(document.createElement('select'))
|
||||
@@ -11,29 +15,6 @@ export function convertLegendToDropdown(inID: string): void {
|
||||
});
|
||||
}
|
||||
|
||||
function appendLegendOptions(element: HTMLElement, inSelect: JQuery<HTMLSelectElement>) {
|
||||
jQuery('>li', element).each(function () {
|
||||
const className: string = jQuery(this)[0].children[0].classList[3];
|
||||
const val: string = className.substring(1);
|
||||
const text: string = (<HTMLElement>jQuery(this)[0].children[1]).innerText;
|
||||
|
||||
appendLegendOption(inSelect, className, val, text);
|
||||
});
|
||||
}
|
||||
|
||||
function appendLegendOption(inSelect: JQuery<HTMLSelectElement>, className: string, val: string, text: string): void {
|
||||
let option: JQuery<HTMLOptionElement> = jQuery('<option/>');
|
||||
option.attr({ 'value': val, 'class': className }).text(text);
|
||||
inSelect.append(option);
|
||||
}
|
||||
|
||||
function appendFirstLegendOption(inSelect: JQuery<HTMLSelectElement>): void {
|
||||
let option: JQuery<HTMLOptionElement> = jQuery('<option/>');
|
||||
option.attr({ 'value': 'all' }).text('Alle Preiskategorien');
|
||||
option.css("color", "#5c5c5c");
|
||||
inSelect.append(option);
|
||||
}
|
||||
|
||||
export function changeDropdownLegendBGColor(inSelector: string, inValue: string, inClassName: string): void {
|
||||
let bgColor: string = "#fafafa";
|
||||
let color: string = "#5c5c5c";
|
||||
@@ -46,4 +27,50 @@ export function changeDropdownLegendBGColor(inSelector: string, inValue: string,
|
||||
jQuery(inSelector).css("color", color);
|
||||
jQuery(inSelector).css("background-color", bgColor);
|
||||
jQuery(`${inSelector} option[value="all"]`).css("color", color);
|
||||
}
|
||||
|
||||
export function generateLegend(inNode: string): I.JSCLegend {
|
||||
const seatmapXML: any = config.state.seatmapXML;
|
||||
const venueXML: I.VenueXML = config.state.inVenueXML!;
|
||||
const pricescaleArr: I.SeatmapPricescale[] = seatmapXML.seatmap[0].pricescale_config[0].pricescale;
|
||||
const venuePricescaleArr: I.Pricescale2[] = venueXML.venue[0].pricescales[0].pricescale;
|
||||
|
||||
return <I.JSCLegend>{
|
||||
node: jQuery(inNode),
|
||||
items: createLegendItems(pricescaleArr, venuePricescaleArr)
|
||||
}
|
||||
}
|
||||
|
||||
function appendLegendOptions(inElement: HTMLElement, inSelect: JQuery<HTMLSelectElement>): void {
|
||||
jQuery('>li', inElement).each(function () {
|
||||
const className: string = jQuery(this)[0].children[0].classList[3];
|
||||
const val: string = className.substring(1);
|
||||
const text: string = (<HTMLElement>jQuery(this)[0].children[1]).innerText;
|
||||
|
||||
appendLegendOption(inSelect, className, val, text);
|
||||
});
|
||||
}
|
||||
|
||||
function appendLegendOption(inSelect: JQuery<HTMLSelectElement>, inClassName: string, inVal: string, inText: string): void {
|
||||
let option: JQuery<HTMLOptionElement> = jQuery('<option/>');
|
||||
option.attr({ 'value': inVal, 'class': inClassName }).text(inText);
|
||||
inSelect.append(option);
|
||||
}
|
||||
|
||||
function appendFirstLegendOption(inSelect: JQuery<HTMLSelectElement>): void {
|
||||
let option: JQuery<HTMLOptionElement> = jQuery('<option/>');
|
||||
option.attr({ 'value': 'all' }).text('Alle Preiskategorien');
|
||||
option.css("color", "#5c5c5c");
|
||||
inSelect.append(option);
|
||||
}
|
||||
|
||||
function createLegendItems(pricescaleArr: I.SeatmapPricescale[], venuePricescaleArr: I.Pricescale2[]): string[][] {
|
||||
return pricescaleArr.map((arr, index: number) => {
|
||||
const id: string = arr.id[0];
|
||||
const seatsKey: string = String.fromCharCode(97 + index).toLocaleUpperCase();
|
||||
const desc: string | undefined = Utils.encodeCP850DecodeUTF8( venuePricescaleArr.find(obj => obj.id[0] === id)?.desc[0]! );
|
||||
const price: string = pricescaleArr[index].ref_price[0];
|
||||
const description: string = `${desc} €${price}`;
|
||||
return [seatsKey, "available", description];
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user