Skip to content

Commit

Permalink
mapp.user; alert; plugin.title
Browse files Browse the repository at this point in the history
  • Loading branch information
dbauszus-glx committed May 21, 2024
1 parent 91d2ecb commit 2c6aec1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/plugins/userIDB.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
export function userIDB(plugin, mapview) {

if (!mapp.user?.email) {

console.warn(`The userIDB plugin requires a mapp.user`)
return;
}

// Find the btnColumn element.
const btnColumn = document.getElementById('mapButton');

if (!btnColumn) return;

plugin.title ??= "Update userIDB locale"

// Append the plugin btn to the btnColumn.
btnColumn.append(mapp.utils.html.node`
<button
title="Update userIDB locale"
title=${plugin.title}
onclick=${()=>{
mapview.locale.layers.forEach(layer => {
Expand All @@ -20,6 +28,8 @@ export function userIDB(plugin, mapview) {
mapp.utils.userIndexedDB.put('locales', mapview.locale)
alert(`User ${mapp.user.email} IndexedDB updated.`)
}}>
<div class="mask-icon" style="mask-image:url(https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/rule_settings/default/24px.svg)">`);
}
Expand Down

0 comments on commit 2c6aec1

Please sign in to comment.