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