<LanguageMap> CR fixes

This commit is contained in:
Andrea Vos 2024-05-26 14:26:01 +02:00
parent b2d28794c6
commit 48e0565d86
2 changed files with 9 additions and 11 deletions

View File

@ -33,19 +33,19 @@ export default dark.extend({
'https://tinyworldmap.com/dist/v3/tiny-world-borders.js',
);
var map = L.map('map').setView([45, 15], 3);
var map = window.L.map('map').setView([45, 15], 3);
// alternatively, for full-width map:
// typeof(window) !== 'undefined' && window.innerWidth < MOBILE_BREAKPOINT
// ? [45, 15]
// : [40, 65],
L.control.attribution({ position: 'bottomright' })
.addAttribution('&copy; <a href="https://doi.org/10.5281/zenodo.7385533" title="Dryer, Matthew S. & Haspelmath, Martin (eds.) 2013. The World Atlas of Language Structures Online. Leipzig: Max Planck Institute for Evolutionary Anthropology.">WALS</a>')
.addAttribution('<a href="https://wals.info">wals.info</a>')
window.L.control.attribution({ position: 'bottomright' })
.addAttribution('&copy; <a href="https://doi.org/10.5281/zenodo.7385533" target="_blank" title="Dryer, Matthew S. & Haspelmath, Martin (eds.) 2013. The World Atlas of Language Structures Online. Leipzig: Max Planck Institute for Evolutionary Anthropology.">WALS</a>')
.addAttribution('<a href="https://wals.info" target="_blank">wals.info</a>')
.addTo(map);
new L.GridLayer.TinyWorld({ maxZoom: 19 }).addTo(map);
new window.L.GridLayer.TinyWorld({ maxZoom: 19 }).addTo(map);
for (const walsLanguage of walsLanguages) {
if (!localesByWalsCode.hasOwnProperty(walsLanguage.id)) {
@ -53,7 +53,7 @@ export default dark.extend({
}
const locale = localesByWalsCode[walsLanguage.id];
const circle = L.circle([walsLanguage.latitude, walsLanguage.longitude], {
const circle = window.L.circle([walsLanguage.latitude, walsLanguage.longitude], {
color: '#971064',
fillColor: '#c71585',
fillOpacity: 0.5,
@ -61,7 +61,7 @@ export default dark.extend({
}).addTo(map);
circle.bindTooltip(`<strong>${locale.name}</strong><br/>${clearUrl(locale.url)}`);
circle.on('click', () => {
window.open(locale.url, '_blank');
window.open(locale.url);
});
}

View File

@ -103,9 +103,7 @@ const plugin: Plugin = ({ app, store }, inject) => {
});
});
inject('loadStylesheet', (name: string, src: string, nonce: string | undefined = undefined): Promise<void> => {
// <link rel="stylesheet" href="h"
inject('loadStylesheet', (name: string, src: string): Promise<void> => {
if (!process.client || document.querySelectorAll(`link.${name}-stylesheet`).length > 0) {
return new Promise((resolve) => {
resolve();
@ -117,7 +115,7 @@ const plugin: Plugin = ({ app, store }, inject) => {
link.setAttribute('rel', 'stylesheet');
link.setAttribute('href', src);
link.classList.add(`${name}-stylesheet`);
// script.crossOrigin = 'true'; TODO proper fix (adding it breaks publift)
script.crossOrigin = 'true';
link.addEventListener('load', () => resolve());
link.addEventListener('error', (event) => {
reject(new LoadScriptError(name, src, typeof event === 'string' ? event : event.type));