66 lines
1.9 KiB
JavaScript
Raw Normal View History

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
2025-03-21 17:15:55 +09:00
function goToEditor(id) {
location.href = getMainPath() + '/blog/editor/' + id;
2024-10-24 18:04:29 +09:00
}
2025-03-19 18:27:39 +09:00
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)
}
2025-08-04 16:35:49 +09:00
let uploadUrl = getMainPath() + "/blog/post.bjx";
2024-10-23 17:06:27 +09:00
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
}