2024-10-23 10:07:45 +09:00
|
|
|
|
2024-10-23 17:06:27 +09:00
|
|
|
var currentLat = 0.0
|
|
|
|
|
var currentLon = 0.0
|
|
|
|
|
|
|
|
|
|
let baseData = {
|
2024-10-24 18:04:29 +09:00
|
|
|
'id' : "",
|
2024-10-23 17:06:27 +09:00
|
|
|
'title': "",
|
|
|
|
|
'content': "",
|
2024-10-24 18:04:29 +09:00
|
|
|
'firstPostLat': 0.0,
|
|
|
|
|
'firstPostLon': 0.0,
|
2024-10-23 17:06:27 +09:00
|
|
|
'category' : "none",
|
|
|
|
|
'hashTags' : "#none",
|
2024-10-24 18:04:29 +09:00
|
|
|
'modifyLat' : 0.0,
|
|
|
|
|
'modifyLon' : 0.0,
|
|
|
|
|
'originId' : "",
|
|
|
|
|
'writeTime' : 0,
|
2024-10-23 17:06:27 +09:00
|
|
|
}
|
2024-10-24 18:04:29 +09:00
|
|
|
|
|
|
|
|
function goToEditor(path,id,sk) {
|
|
|
|
|
location.href = path + id+"?token="+sk;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-23 10:07:45 +09:00
|
|
|
function onclickWrite(type, keyword, html) {
|
|
|
|
|
let title_field = document.getElementById('title_field')
|
|
|
|
|
var hasValues = true
|
|
|
|
|
if (hasValues) {
|
2024-10-23 17:06:27 +09:00
|
|
|
baseData.title = encodeURIComponent(title_field.value)
|
|
|
|
|
baseData.content = encodeURIComponent(html)
|
|
|
|
|
baseData.firstPostLat = encodeURIComponent(currentLat)
|
|
|
|
|
baseData.firstPostLon = encodeURIComponent(currentLon)
|
|
|
|
|
}
|
|
|
|
|
let uploadUrl = getMainPath() + "/blog/post.ajax";
|
|
|
|
|
if(confirm(JSON.stringify(baseData) + "\n해당 내용으로\n유저 등록 하실??")) {
|
|
|
|
|
post(uploadUrl,type,JSON.stringify(baseData),keyword, function (resultData) {
|
|
|
|
|
alert(resultData)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function getLocation() {
|
|
|
|
|
if (navigator.geolocation) {
|
|
|
|
|
navigator.geolocation.getCurrentPosition(showPosition);
|
|
|
|
|
} else {
|
|
|
|
|
x.innerHTML = "Geolocation is not supported by this browser.";
|
2024-10-23 10:07:45 +09:00
|
|
|
}
|
2024-10-23 17:06:27 +09:00
|
|
|
}
|
|
|
|
|
function showPosition(position) {
|
|
|
|
|
currentLat = position.coords.latitude
|
|
|
|
|
currentLon = position.coords.longitude
|
2024-10-24 18:04:29 +09:00
|
|
|
if(baseData.firstPostLat !== 0.0) {
|
|
|
|
|
baseData.modifyLat = encodeURIComponent(currentLat)
|
|
|
|
|
} else {
|
|
|
|
|
baseData.firstPostLat = encodeURIComponent(currentLat)
|
|
|
|
|
}
|
|
|
|
|
if(baseData.firstPostLon !== 0.0 ) {
|
|
|
|
|
baseData.modifyLon = encodeURIComponent(currentLon)
|
|
|
|
|
} else {
|
|
|
|
|
baseData.firstPostLon = encodeURIComponent(currentLon)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-11-07 14:01:21 +09:00
|
|
|
document.getElementById('location_field').textContent = "Lat: " + position.coords.latitude + ", Lon: " + position.coords.longitude;
|
2024-10-23 10:07:45 +09:00
|
|
|
}
|