kopia lustrzana https://gitlab.com/gridtracker.org/gridtracker
Dev update to mh-root-prefixed.json
rodzic
119bf4cf77
commit
fe1abd656a
|
@ -1474,7 +1474,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
<div id="devPanel" class="mapItem" style="display:none;" >
|
||||||
|
<div class="button" onclick="downloadCtyDat()">Update from ctydat</div>
|
||||||
|
<div id="ctyDatStatus"></div>
|
||||||
|
<div id="ctyDatFinal"></div>
|
||||||
|
</div>
|
||||||
<div id="callsignDatabaseDiv" class="mapItem">
|
<div id="callsignDatabaseDiv" class="mapItem">
|
||||||
<table align="center" class="darkTable">
|
<table align="center" class="darkTable">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -824,3 +824,58 @@ function lookupUsCallsign(object, writeState = false)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function downloadCtyDat()
|
||||||
|
{
|
||||||
|
ctyDatStatus.innerHTML = "<b><i>Downloading...</i></b>";
|
||||||
|
getBuffer(
|
||||||
|
"https://storage.googleapis.com/gt_app/ctydat.json",
|
||||||
|
processCtyDat,
|
||||||
|
null,
|
||||||
|
"https",
|
||||||
|
443
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function processCtyDat(buffer)
|
||||||
|
{
|
||||||
|
let data = String(buffer);
|
||||||
|
ctyDatStatus.innerHTML = "Update: " + data.length + " bytes read";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
let ctydata = JSON.parse(data);
|
||||||
|
let file = "./data/mh-root-prefixed.json";
|
||||||
|
if (fs.existsSync(file))
|
||||||
|
{
|
||||||
|
let fileBuf = fs.readFileSync(file, "UTF-8");
|
||||||
|
let worldGeoData = JSON.parse(fileBuf);
|
||||||
|
for (const key in worldGeoData)
|
||||||
|
{
|
||||||
|
if (worldGeoData[key].dxcc in ctydata)
|
||||||
|
{
|
||||||
|
// Skip Guantanamo Bay, hand crafted with love
|
||||||
|
if (worldGeoData[key].dxcc != "105")
|
||||||
|
{
|
||||||
|
worldGeoData[key].prefix = [];
|
||||||
|
|
||||||
|
let arr = ctydata[worldGeoData[key].dxcc].prefix.substr(0, ctydata[worldGeoData[key].dxcc].prefix.length - 1).split(" ");
|
||||||
|
for (const x in arr)
|
||||||
|
{
|
||||||
|
if (!(arr[x].includes("(")) && !(arr[x].includes("[")) && !(arr[x].includes("<")) && !(arr[x].includes("{")) && !(arr[x].includes("~")))
|
||||||
|
{
|
||||||
|
worldGeoData[key].prefix.push(arr[x]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
worldGeoData[key].prefix.sort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs.writeFileSync(file, JSON.stringify(worldGeoData));
|
||||||
|
ctyDatFinal.innerHTML = file + " updated!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13599,6 +13599,11 @@ function postInit()
|
||||||
openCallRosterWindow(false);
|
openCallRosterWindow(false);
|
||||||
openConditionsWindow(false);
|
openConditionsWindow(false);
|
||||||
showMessaging(false);
|
showMessaging(false);
|
||||||
|
|
||||||
|
if (g_developerMode)
|
||||||
|
{
|
||||||
|
devPanel.style.display = "inline-block";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("dragover", function (event)
|
document.addEventListener("dragover", function (event)
|
||||||
|
|
Ładowanie…
Reference in New Issue