Skip to content

Commit

Permalink
#27 fix history diff with colour=* tag
Browse files Browse the repository at this point in the history
  • Loading branch information
deevroman committed Dec 6, 2024
1 parent 09c33e0 commit ab91c68
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion better-osm-org.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,7 @@ function setupViewRedactions() {
// https://www.openstreetmap.org/node/10173297169/history
// https://www.openstreetmap.org/relation/16022751/history
// https://www.openstreetmap.org/node/12084992837/history
// https://www.openstreetmap.org/way/1329437422/history
function addDiffInHistory() {
addHistoryLink();
if (document.querySelector("#sidebar_content table")) {
Expand Down Expand Up @@ -3145,6 +3146,11 @@ function addDiffInHistory() {
// Human-readable Wikidata extension compatibility
return
}
if (k.includes("colour")) {
const tmpV = i.querySelector("td").cloneNode(true)
tmpV.querySelector("svg")?.remove()
v = tmpV.textContent
}
tags.push([k, v])

let lastTags = versions.slice(-1)[0].tags
Expand Down Expand Up @@ -3239,7 +3245,13 @@ function addDiffInHistory() {
th.textContent = k
th.classList.add("history-diff-deleted-tag", "py-1", "border-grey", "table-light", "fw-normal")
let td = document.createElement("td")
td.textContent = v
if (k.includes("colour")) {
td.innerHTML = `<svg width="14" height="14" class="float-end m-1"><title></title><rect x="0.5" y="0.5" width="13" height="13" fill="" stroke="#2222"></rect></svg>`
td.querySelector("svg rect").setAttribute("fill", v)
td.appendChild(document.createTextNode(v))
} else {
td.textContent = v
}
td.classList.add("history-diff-deleted-tag", "py-1", "border-grey", "table-light", "fw-normal")
tr.appendChild(th)
tr.appendChild(td)
Expand Down

0 comments on commit ab91c68

Please sign in to comment.