infobox/location: show uci in one box
This commit is contained in:
parent
8758c04a29
commit
273d0d5d23
@ -9,27 +9,33 @@ define(function () {
|
|||||||
h2.textContent = result.display_name
|
h2.textContent = result.display_name
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var latDiv = document.createElement("div")
|
||||||
var h3lat = document.createElement("h3")
|
var h3lat = document.createElement("h3")
|
||||||
h3lat.textContent = "Breitengrad"
|
h3lat.textContent = "Breitengrad"
|
||||||
el.appendChild(h3lat)
|
h3lat.id = "h3-latitude"
|
||||||
|
latDiv.appendChild(h3lat)
|
||||||
var txt1 = document.createElement("textarea")
|
var txt1 = document.createElement("textarea")
|
||||||
txt1.id = "location-latitude"
|
txt1.id = "location-latitude"
|
||||||
txt1.value = d.lat.toFixed(9)
|
txt1.value = d.lat.toFixed(9)
|
||||||
var p = document.createElement("p")
|
var p = document.createElement("p")
|
||||||
p.appendChild(txt1)
|
p.appendChild(txt1)
|
||||||
p.appendChild(createCopyButton(txt1.id))
|
p.appendChild(createCopyButton(txt1.id))
|
||||||
el.appendChild(p)
|
latDiv.appendChild(p)
|
||||||
|
el.appendChild(latDiv)
|
||||||
|
|
||||||
|
var longDiv = document.createElement("div")
|
||||||
var h3lng = document.createElement("h3")
|
var h3lng = document.createElement("h3")
|
||||||
h3lng.textContent = "Längengrad"
|
h3lng.textContent = "Längengrad"
|
||||||
el.appendChild(h3lng)
|
longDiv.appendChild(h3lng)
|
||||||
var txt2 = document.createElement("textarea")
|
var txt2 = document.createElement("textarea")
|
||||||
txt2.id = "location-longitude"
|
txt2.id = "location-longitude"
|
||||||
txt2.value = d.lng.toFixed(9)
|
txt2.value = d.lng.toFixed(9)
|
||||||
var p2 = document.createElement("p")
|
var p2 = document.createElement("p")
|
||||||
p2.appendChild(txt2)
|
p2.appendChild(txt2)
|
||||||
p2.appendChild(createCopyButton(txt2.id))
|
p2.appendChild(createCopyButton(txt2.id))
|
||||||
el.appendChild(p2)
|
longDiv.appendChild(p2)
|
||||||
|
longDiv.id = "div-longitude"
|
||||||
|
el.appendChild(longDiv)
|
||||||
|
|
||||||
var a1 = document.createElement("a")
|
var a1 = document.createElement("a")
|
||||||
a1.textContent = "plain"
|
a1.textContent = "plain"
|
||||||
@ -44,7 +50,7 @@ define(function () {
|
|||||||
switch2uci()
|
switch2uci()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
a2.href = config.siteURL
|
a2.href = "#"
|
||||||
|
|
||||||
var p3 = document.createElement("p")
|
var p3 = document.createElement("p")
|
||||||
p3.textContent = "Du kannst zwischen "
|
p3.textContent = "Du kannst zwischen "
|
||||||
@ -59,34 +65,36 @@ define(function () {
|
|||||||
function createCopyButton(id) {
|
function createCopyButton(id) {
|
||||||
var btn = document.createElement("button")
|
var btn = document.createElement("button")
|
||||||
btn.className = "ion-ios-copy"
|
btn.className = "ion-ios-copy"
|
||||||
btn.title = "Kopiere"
|
btn.title = "Kopieren"
|
||||||
btn.onclick = function() {
|
btn.onclick = function() {
|
||||||
copy2clip(id)
|
copy2clip(id)
|
||||||
}
|
}
|
||||||
return btn
|
return btn
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy2clip(id) {
|
function copy2clip(id) {
|
||||||
var copyTextarea = document.querySelector("#" + id)
|
var copyTextarea = document.querySelector("#" + id)
|
||||||
copyTextarea.select()
|
copyTextarea.select()
|
||||||
try {
|
try {
|
||||||
var successful = document.execCommand("copy")
|
document.execCommand("copy")
|
||||||
var msg = successful ? "successful" : "unsuccessful"
|
|
||||||
console.log("Copying text command was " + msg)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Oops, unable to copy")
|
console.log(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function switch2plain() {
|
function switch2plain() {
|
||||||
var box1 = document.getElementById("location-latitude")
|
var box1 = document.getElementById("location-latitude")
|
||||||
box1.value = d.lat.toFixed(9)
|
box1.value = d.lat.toFixed(9)
|
||||||
var box2 = document.getElementById("location-longitude")
|
var box2 = document.getElementById("location-longitude")
|
||||||
box2.value = d.lng.toFixed(9)
|
box2.value = d.lng.toFixed(9)
|
||||||
|
document.getElementById("h3-latitude").textContent = "Breitengrad"
|
||||||
|
document.getElementById("div-longitude").style.display = "block"
|
||||||
}
|
}
|
||||||
|
|
||||||
function switch2uci() {
|
function switch2uci() {
|
||||||
var box1 = document.getElementById("location-latitude")
|
document.getElementById("location-latitude").value = "uci set gluon-node-info.@location[0].latitude='" + d.lat.toFixed(9) + "'; uci set gluon-node-info.@location[0].longitude='" + d.lng.toFixed(9) + "'"
|
||||||
box1.value = "uci set gluon-node-info.@location[0].latitude='" + d.lat.toFixed(9) + "'"
|
document.getElementById("h3-latitude").textContent = "Befehl"
|
||||||
var box2 = document.getElementById("location-longitude")
|
document.getElementById("div-longitude").style.display = "none"
|
||||||
box2.value = "uci set gluon-node-info.@location[0].longitude='" + d.lng.toFixed(9) + "'"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user