kopia lustrzana https://github.com/drastus/sejm-calculator
Add viewport and description meta tags
rodzic
379776dafb
commit
b64ca765d4
|
@ -5,6 +5,8 @@ import constituencyTemplate from './templates/constituency.pug';
|
||||||
import tableTemplate from './templates/table.pug';
|
import tableTemplate from './templates/table.pug';
|
||||||
import './styles/styles.css';
|
import './styles/styles.css';
|
||||||
|
|
||||||
|
const {location} = window;
|
||||||
|
|
||||||
let barChart: ChartistStatic['Bar'];
|
let barChart: ChartistStatic['Bar'];
|
||||||
let pieChart: ChartistStatic['Pie'];
|
let pieChart: ChartistStatic['Pie'];
|
||||||
|
|
||||||
|
@ -25,8 +27,8 @@ export const clearResults = (): void => {
|
||||||
document.getElementById('support-bar-chart')!.innerHTML = '';
|
document.getElementById('support-bar-chart')!.innerHTML = '';
|
||||||
document.getElementById('division-pie-chart')!.innerHTML = '';
|
document.getElementById('division-pie-chart')!.innerHTML = '';
|
||||||
document.getElementById('constituency-results')!.innerHTML = '';
|
document.getElementById('constituency-results')!.innerHTML = '';
|
||||||
if (window.location.search) {
|
if (location.search) {
|
||||||
const urlWithoutSearchString = window.location.href.split('?')[0];
|
const urlWithoutSearchString = location.href.split('?')[0];
|
||||||
window.history.pushState('', '', urlWithoutSearchString);
|
window.history.pushState('', '', urlWithoutSearchString);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -44,7 +46,7 @@ const displayUrl = (support: number[]) => {
|
||||||
support.forEach((s, i) => {
|
support.forEach((s, i) => {
|
||||||
if (s > 0) searchParams.append(committees[i].id, s.toString());
|
if (s > 0) searchParams.append(committees[i].id, s.toString());
|
||||||
});
|
});
|
||||||
const urlWithoutSearchString = window.location.href.split('?')[0];
|
const urlWithoutSearchString = location.href.split('?')[0];
|
||||||
const url = `${urlWithoutSearchString}?${searchParams}`;
|
const url = `${urlWithoutSearchString}?${searchParams}`;
|
||||||
document.getElementById('url')!.innerHTML = `Link do wyników: ${url.link(url)}`;
|
document.getElementById('url')!.innerHTML = `Link do wyników: ${url.link(url)}`;
|
||||||
};
|
};
|
||||||
|
@ -167,8 +169,8 @@ export const generateTable = (): void => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const loadResultsFromUrl = (): void => {
|
export const loadResultsFromUrl = (): void => {
|
||||||
if (window.location.search) {
|
if (location.search) {
|
||||||
const searchParams = new URLSearchParams(window.location.search);
|
const searchParams = new URLSearchParams(location.search);
|
||||||
searchParams.forEach((value, key) => {
|
searchParams.forEach((value, key) => {
|
||||||
const input = document.querySelector<HTMLInputElement>(`tr.${key} td:nth-child(2) input`);
|
const input = document.querySelector<HTMLInputElement>(`tr.${key} td:nth-child(2) input`);
|
||||||
if (input) input.value = value;
|
if (input) input.value = value;
|
||||||
|
|
|
@ -3,6 +3,8 @@ html(lang='pl')
|
||||||
head
|
head
|
||||||
title Kalkulator mandatów w wyborach do Sejmu
|
title Kalkulator mandatów w wyborach do Sejmu
|
||||||
meta(charset="UTF-8")
|
meta(charset="UTF-8")
|
||||||
|
meta(name="viewport" content="width=device-width, initial-scale=1")
|
||||||
|
meta(name="description" content="Kalkulator przeliczający sondażowe wyniki poparcia dla ugrupowań na przewidywany rozkład mandatów w Sejmie z uwzględnieniem obowiązujących okręgów wyborczych.")
|
||||||
script(async src="https://www.googletagmanager.com/gtag/js?id=UA-151698411-1")
|
script(async src="https://www.googletagmanager.com/gtag/js?id=UA-151698411-1")
|
||||||
script.
|
script.
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
|
Ładowanie…
Reference in New Issue