kopia lustrzana https://gitlab.com/gridtracker.org/gridtracker
Merge branch 'dev-context-menu' into 'master'
Improve developer experience by enabling context menus when possible See merge request gridtracker.org/gridtracker!6Canadian-Provinces-Territories-Award-Layer
commit
65449aec2e
|
@ -0,0 +1,25 @@
|
||||||
|
# About GridTracker
|
||||||
|
|
||||||
|
# Developing GridTracker
|
||||||
|
|
||||||
|
GridTracker runs using [NWJS](https://nwjs.io/), a tools that wraps both Chrome windows and node processes into a native application.
|
||||||
|
|
||||||
|
To work on GridTracker you need to clone this git repository and then invoke NWJS with the contents of `package.nw`.
|
||||||
|
|
||||||
|
NWJS comes in two flavors, "normal" and "sdk". GridTracker is distributed with the normal flavor, but for development work
|
||||||
|
we recommend the SDK flavor because it provides access to Chrome's Developer Tools, among other things.
|
||||||
|
|
||||||
|
## Developing on Windows
|
||||||
|
|
||||||
|
To access the Developer Tools, right-click on an unused area of a window, or press F12.
|
||||||
|
|
||||||
|
## Developing on Linux
|
||||||
|
|
||||||
|
To access the Developer Tools, right-click on an unused area of a window, or press F12.
|
||||||
|
|
||||||
|
## Developing on Mac
|
||||||
|
|
||||||
|
We suggest using the `macos/run.sh` script to launch GridTracker while developing. It will download the sdk flavor of NWJS if needed,
|
||||||
|
and use it to run the app.
|
||||||
|
|
||||||
|
To access the Developer Tools, right-click on an unused area of a window, or press F12.
|
17
macos/run.sh
17
macos/run.sh
|
@ -1,16 +1,21 @@
|
||||||
NWJS_VERSION=0.49.0
|
NWJS_VERSION=0.49.0
|
||||||
|
NWJS_FULL_NAME=nwjs-sdk-v$NWJS_VERSION-osx-x64
|
||||||
|
|
||||||
if [ ! -e build/macos/nwjs-v$NWJS_VERSION-osx-x64/nwjs.app ]; then
|
if [ ! -e build/macos/$NWJS_FULL_NAME/nwjs.app ]; then
|
||||||
echo "Downloading NWJS $NWJS_VERSION"
|
echo "Downloading NWJS $NWJS_VERSION ($NWJS_FULL_NAME)"
|
||||||
mkdir -p build/macos
|
mkdir -p build/macos
|
||||||
cd build/macos
|
cd build/macos
|
||||||
curl -O https://dl.nwjs.io/v$NWJS_VERSION/nwjs-v$NWJS_VERSION-osx-x64.zip
|
curl -O https://dl.nwjs.io/v$NWJS_VERSION/$NWJS_FULL_NAME.zip
|
||||||
unzip nwjs-v$NWJS_VERSION-osx-x64.zip
|
unzip $NWJS_FULL_NAME.zip
|
||||||
cd ../..
|
cd ../..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Disable `product_string` before running nwjs (see https://github.com/nwjs/nw.js/issues/7253)
|
||||||
sed -i "" -e s/\"product_string\"/\"ignore_product_string\"/g package.nw/package.json
|
sed -i "" -e s/\"product_string\"/\"ignore_product_string\"/g package.nw/package.json
|
||||||
|
|
||||||
build/macos/nwjs-v$NWJS_VERSION-osx-x64/nwjs.app/Contents/MacOS/nwjs ./package.nw
|
# Give time (15 seconds) for nwjs to start and then restore `product_string`
|
||||||
|
( sleep 15 ; sed -i "" -e s/\"ignore_product_string\"/\"product_string\"/g package.nw/package.json ) &
|
||||||
|
|
||||||
|
build/macos/$NWJS_FULL_NAME/nwjs.app/Contents/MacOS/nwjs ./package.nw
|
||||||
|
|
||||||
|
|
||||||
sed -i "" -e s/\"ignore_product_string\"/\"product_string\"/g package.nw/package.json
|
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
<div id="txrxdec" style="background-color:Green;border-style:outset;border-color:yellow;border-width:3px" class="roundBorder">waiting for message</div>
|
<div id="txrxdec" style="background-color:Green;border-style:outset;border-color:yellow;border-width:3px" class="roundBorder">waiting for message</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="pskReporterBandActivityDiv" class="roundBorder" style="position:relative;background-color:#000;border:1px solid purple;margin:1px;height:49px;margin-bottom:1px;padding:0px" title="PSK-Reporter Band Activity" oncontextmenu="toggleBaWindow()" >
|
<div id="pskReporterBandActivityDiv" class="roundBorder" style="position:relative;background-color:#000;border:1px solid purple;margin:1px;height:49px;margin-bottom:1px;padding:0px" title="PSK-Reporter Band Activity" oncontextmenu="toggleBaWindow(event)" >
|
||||||
<div id="graphDiv" style="bottom:0;position: absolute;width:100%;padding:0px;margin-bottom:2px">
|
<div id="graphDiv" style="bottom:0;position: absolute;width:100%;padding:0px;margin-bottom:2px">
|
||||||
<br />...no data yet...<br />
|
<br />...no data yet...<br />
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,10 @@ document.addEventListener("drop", function (event) {
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('contextmenu', function(ev) {
|
document.addEventListener('contextmenu', function(ev) {
|
||||||
window.opener.openBaWindow(false);
|
window.opener.toggleBaWindow(ev);
|
||||||
|
if (process.versions['nw-flavor'] != "sdk") {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ document.addEventListener('contextmenu', function(ev) {
|
||||||
<script src="./lib/screens.js"></script>
|
<script src="./lib/screens.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id='mainBody' style="-webkit-app-region:drag;margin:0px;right:0px;left:0px;bottom:0px;top:0px;display:block;background-color:#000000FF;padding:0px;text-align:center;vertical-align:middle;position:absolute;z-index:600;" oncontextmenu="window.opener.showBaWindow(false)" >
|
<body id='mainBody' style="-webkit-app-region:drag;margin:0px;right:0px;left:0px;bottom:0px;top:0px;display:block;background-color:#000000FF;padding:0px;text-align:center;vertical-align:middle;position:absolute;z-index:600;">
|
||||||
<div id="pskReporterBandActivityDiv" style="position:relative;background-color:#000;border:1px solid purple;margin:1px;height:49px;margin-bottom:1px;padding:0px" title="PSK-Reporter Band Activity">
|
<div id="pskReporterBandActivityDiv" style="position:relative;background-color:#000;border:1px solid purple;margin:1px;height:49px;margin-bottom:1px;padding:0px" title="PSK-Reporter Band Activity">
|
||||||
<div id="graphDiv" style="bottom:0;position: absolute;width:100%;padding:0px;margin-bottom:2px">
|
<div id="graphDiv" style="bottom:0;position: absolute;width:100%;padding:0px;margin-bottom:2px">
|
||||||
<br />...no data yet...<br />
|
<br />...no data yet...<br />
|
||||||
|
|
|
@ -262,6 +262,8 @@ function openIdCid( from )
|
||||||
|
|
||||||
function openLookupCid( from )
|
function openLookupCid( from )
|
||||||
{
|
{
|
||||||
|
from.preventDefault();
|
||||||
|
|
||||||
if ( typeof window.opener.g_gtFlagPins[from.currentTarget.id] != "undefined" )
|
if ( typeof window.opener.g_gtFlagPins[from.currentTarget.id] != "undefined" )
|
||||||
{
|
{
|
||||||
doLookup(window.opener.g_gtFlagPins[from.currentTarget.id].call);
|
doLookup(window.opener.g_gtFlagPins[from.currentTarget.id].call);
|
||||||
|
|
|
@ -37,8 +37,10 @@ table, th, td {
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
document.oncontextmenu = function() {
|
document.oncontextmenu = function(event) {
|
||||||
return false;
|
if (process.versions['nw-flavor'] != "sdk") {
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("dragover", function (event) {
|
document.addEventListener("dragover", function (event) {
|
||||||
|
|
|
@ -66,8 +66,10 @@ function onMyKeyDown(event)
|
||||||
window.opener.onMyKeyDown(event);
|
window.opener.onMyKeyDown(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.oncontextmenu = function() {
|
document.oncontextmenu = function(event) {
|
||||||
return false;
|
if (process.versions['nw-flavor'] != "sdk") {
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -212,8 +212,10 @@
|
||||||
<div id="instancesDiv" style="display:none;" ></div>
|
<div id="instancesDiv" style="display:none;" ></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div oncontextmenu="handleContextMenu(event);">
|
||||||
<div id="rosterTable" style="overflow:auto;overflow-x:hidden;"></div>
|
<div id="rosterTable" style="overflow:auto;overflow-x:hidden;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div id="editView" class="roundBorder" style="height:100%;border:3px solid #066;padding:10px;margin:10px;display:none;">
|
<div id="editView" class="roundBorder" style="height:100%;border:3px solid #066;padding:10px;margin:10px;display:none;">
|
||||||
<div style='display:block;font-size:larger'>Callsign, CQ and DXCC Ignores</div><br/>
|
<div style='display:block;font-size:larger'>Callsign, CQ and DXCC Ignores</div><br/>
|
||||||
<div id="editTables">
|
<div id="editTables">
|
||||||
|
|
|
@ -39,6 +39,8 @@ if (g_platform == "windows")
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
var win = gui.Window.get();
|
var win = gui.Window.get();
|
||||||
|
|
||||||
|
var g_developerMode = (process.versions['nw-flavor'] == "sdk");
|
||||||
|
|
||||||
var g_popupWindowHandle = null;
|
var g_popupWindowHandle = null;
|
||||||
var g_callRosterWindowHandle = null;
|
var g_callRosterWindowHandle = null;
|
||||||
var g_conditionsWindowHandle = null;
|
var g_conditionsWindowHandle = null;
|
||||||
|
@ -4789,6 +4791,7 @@ function initMap() {
|
||||||
|
|
||||||
//mapDiv.addEventListener('mouseout', mapLoseFocus, false);
|
//mapDiv.addEventListener('mouseout', mapLoseFocus, false);
|
||||||
mapDiv.addEventListener('mouseleave', mapLoseFocus, false);
|
mapDiv.addEventListener('mouseleave', mapLoseFocus, false);
|
||||||
|
mapDiv.addEventListener('contextmenu', function(event) { event.preventDefault(); })
|
||||||
|
|
||||||
g_map.on('pointerdown', function (event) {
|
g_map.on('pointerdown', function (event) {
|
||||||
|
|
||||||
|
@ -4836,7 +4839,6 @@ function initMap() {
|
||||||
mouseOutOfDataItem();
|
mouseOutOfDataItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
document.getElementById("menuDiv").style.display = "block";
|
document.getElementById("menuDiv").style.display = "block";
|
||||||
|
|
||||||
dayNight.init(g_map);
|
dayNight.init(g_map);
|
||||||
|
@ -6720,12 +6722,13 @@ function resetSearch()
|
||||||
|
|
||||||
function showWorkedByCall(callsign, evt)
|
function showWorkedByCall(callsign, evt)
|
||||||
{
|
{
|
||||||
|
evt.preventDefault();
|
||||||
|
|
||||||
resetSearch();
|
resetSearch();
|
||||||
g_searchWB = callsign;
|
g_searchWB = callsign;
|
||||||
if ( event.shiftKey == true )
|
if ( event.shiftKey == true )
|
||||||
g_filterQSL = "true";
|
g_filterQSL = "true";
|
||||||
openInfoTab('qsobox', 'workedBoxDiv', showWorkedBox);
|
openInfoTab('qsobox', 'workedBoxDiv', showWorkedBox);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showWorkedSearchChanged(object, index) {
|
function showWorkedSearchChanged(object, index) {
|
||||||
|
@ -7546,8 +7549,9 @@ function showSettingsBox() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleBaWindow()
|
function toggleBaWindow(event) {
|
||||||
{
|
event.preventDefault();
|
||||||
|
|
||||||
if (g_baWindowHandle == null)
|
if (g_baWindowHandle == null)
|
||||||
{
|
{
|
||||||
openBaWindow(true);
|
openBaWindow(true);
|
||||||
|
@ -11199,9 +11203,11 @@ function loadAdifSettings()
|
||||||
|
|
||||||
function startupVersionInit() {
|
function startupVersionInit() {
|
||||||
|
|
||||||
|
if (!g_developerMode) {
|
||||||
document.body.addEventListener('contextmenu', function(ev) {
|
document.body.addEventListener('contextmenu', function(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
imSureCheck.checked = false;
|
imSureCheck.checked = false;
|
||||||
stopAskingCheckbox.checked = g_appSettings.stopAskingVersion;
|
stopAskingCheckbox.checked = g_appSettings.stopAskingVersion;
|
||||||
|
|
|
@ -42,6 +42,7 @@ var g_callsignDatabaseDXCC = {};
|
||||||
var g_callsignDatabaseUS = {}
|
var g_callsignDatabaseUS = {}
|
||||||
var g_callsignDatabaseUSplus = {};
|
var g_callsignDatabaseUSplus = {};
|
||||||
|
|
||||||
|
var g_developerMode = (process.versions['nw-flavor'] == "sdk");
|
||||||
|
|
||||||
var g_modeColors = {};
|
var g_modeColors = {};
|
||||||
g_modeColors["FT4"] = '1111FF';
|
g_modeColors["FT4"] = '1111FF';
|
||||||
|
@ -3036,10 +3037,59 @@ function init()
|
||||||
});
|
});
|
||||||
g_dxccMenu.append(item);
|
g_dxccMenu.append(item);
|
||||||
|
|
||||||
document.body.addEventListener('contextmenu', function(ev) {
|
callsignNeed.value = g_rosterSettings.callsign;
|
||||||
ev.preventDefault();
|
huntMode.value = g_rosterSettings.hunting;
|
||||||
|
huntNeed.value = g_rosterSettings.huntNeed;
|
||||||
|
wantGrid.checked = g_rosterSettings.requireGrid;
|
||||||
|
|
||||||
|
wantMaxDT.checked = g_rosterSettings.wantMaxDT;
|
||||||
|
wantMinDB.checked = g_rosterSettings.wantMinDB;
|
||||||
|
wantMinFreq.checked = g_rosterSettings.wantMinFreq;
|
||||||
|
wantMaxFreq.checked = g_rosterSettings.wantMaxFreq;
|
||||||
|
|
||||||
|
maxDTView.innerHTML = maxDT.value = g_rosterSettings.maxDT;
|
||||||
|
minDbView.innerHTML = minDb.value = g_rosterSettings.minDb;
|
||||||
|
minFreqView.innerHTML = minFreq.value = g_rosterSettings.minFreq;
|
||||||
|
maxFreqView.innerHTML = maxFreq.value = g_rosterSettings.maxFreq;
|
||||||
|
|
||||||
|
maxLoTW.value = g_rosterSettings.maxLoTW;
|
||||||
|
maxLoTWView.innerHTML = (maxLoTW.value < 27)? Number(maxLoTW.value).toYM() : "<b>∞</b>";
|
||||||
|
|
||||||
|
cqOnly.checked = g_rosterSettings.cqOnly ;
|
||||||
|
noMyDxcc.checked = g_rosterSettings.noMyDxcc ;
|
||||||
|
onlyMyDxcc.checked = g_rosterSettings.onlyMyDxcc ;
|
||||||
|
|
||||||
|
|
||||||
|
noMsg.checked = g_rosterSettings.noMsg;
|
||||||
|
onlyMsg.checked = g_rosterSettings.onlyMsg;
|
||||||
|
noMsgValue.value = g_rosterSettings.noMsgValue;
|
||||||
|
onlyMsgValue.value = g_rosterSettings.onlyMsgValue;
|
||||||
|
|
||||||
|
usesLoTW.checked = g_rosterSettings.usesLoTW;
|
||||||
|
useseQSL.checked = g_rosterSettings.useseQSL;
|
||||||
|
onlySpot.checked = g_rosterSettings.onlySpot;
|
||||||
|
usesOQRS.checked = g_rosterSettings.usesOQRS;
|
||||||
|
|
||||||
|
referenceNeed.value = g_rosterSettings.reference;
|
||||||
|
allOnlyNew.checked = g_rosterSettings.allOnlyNew;
|
||||||
|
useRegex.checked = g_rosterSettings.useRegex;
|
||||||
|
callsignRegex.value = g_rosterSettings.callsignRegex;
|
||||||
|
|
||||||
|
setVisual();
|
||||||
|
document.addEventListener('keydown', onMyKeyDown, false);
|
||||||
|
|
||||||
|
initDXCCSelector();
|
||||||
|
|
||||||
|
g_timerInterval = setInterval(realtimeRoster,1000);
|
||||||
|
|
||||||
|
updateInstances();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleContextMenu(ev) {
|
||||||
if ( editView.style.display == "inline-block" )
|
if ( editView.style.display == "inline-block" )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var len = Object.keys(g_blockedCalls).length;
|
var len = Object.keys(g_blockedCalls).length;
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
{
|
{
|
||||||
|
@ -3137,59 +3187,11 @@ function init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!g_developerMode) {
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
callsignNeed.value = g_rosterSettings.callsign;
|
|
||||||
huntMode.value = g_rosterSettings.hunting;
|
|
||||||
huntNeed.value = g_rosterSettings.huntNeed;
|
|
||||||
wantGrid.checked = g_rosterSettings.requireGrid;
|
|
||||||
|
|
||||||
wantMaxDT.checked = g_rosterSettings.wantMaxDT;
|
|
||||||
wantMinDB.checked = g_rosterSettings.wantMinDB;
|
|
||||||
wantMinFreq.checked = g_rosterSettings.wantMinFreq;
|
|
||||||
wantMaxFreq.checked = g_rosterSettings.wantMaxFreq;
|
|
||||||
|
|
||||||
maxDTView.innerHTML = maxDT.value = g_rosterSettings.maxDT;
|
|
||||||
minDbView.innerHTML = minDb.value = g_rosterSettings.minDb;
|
|
||||||
minFreqView.innerHTML = minFreq.value = g_rosterSettings.minFreq;
|
|
||||||
maxFreqView.innerHTML = maxFreq.value = g_rosterSettings.maxFreq;
|
|
||||||
|
|
||||||
maxLoTW.value = g_rosterSettings.maxLoTW;
|
|
||||||
maxLoTWView.innerHTML = (maxLoTW.value < 27)? Number(maxLoTW.value).toYM() : "<b>∞</b>";
|
|
||||||
|
|
||||||
cqOnly.checked = g_rosterSettings.cqOnly ;
|
|
||||||
noMyDxcc.checked = g_rosterSettings.noMyDxcc ;
|
|
||||||
onlyMyDxcc.checked = g_rosterSettings.onlyMyDxcc ;
|
|
||||||
|
|
||||||
|
|
||||||
noMsg.checked = g_rosterSettings.noMsg;
|
|
||||||
onlyMsg.checked = g_rosterSettings.onlyMsg;
|
|
||||||
noMsgValue.value = g_rosterSettings.noMsgValue;
|
|
||||||
onlyMsgValue.value = g_rosterSettings.onlyMsgValue;
|
|
||||||
|
|
||||||
usesLoTW.checked = g_rosterSettings.usesLoTW;
|
|
||||||
useseQSL.checked = g_rosterSettings.useseQSL;
|
|
||||||
onlySpot.checked = g_rosterSettings.onlySpot;
|
|
||||||
usesOQRS.checked = g_rosterSettings.usesOQRS;
|
|
||||||
|
|
||||||
referenceNeed.value = g_rosterSettings.reference;
|
|
||||||
allOnlyNew.checked = g_rosterSettings.allOnlyNew;
|
|
||||||
useRegex.checked = g_rosterSettings.useRegex;
|
|
||||||
callsignRegex.value = g_rosterSettings.callsignRegex;
|
|
||||||
|
|
||||||
setVisual();
|
|
||||||
document.addEventListener('keydown', onMyKeyDown, false);
|
|
||||||
|
|
||||||
initDXCCSelector();
|
|
||||||
|
|
||||||
g_timerInterval = setInterval(realtimeRoster,1000);
|
|
||||||
|
|
||||||
updateInstances();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTypeFromMode(mode)
|
function getTypeFromMode(mode)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// GridTracker ©2020 N0TTL
|
// GridTracker ©2020 N0TTL
|
||||||
|
|
||||||
|
|
||||||
document.oncontextmenu = function() {
|
document.oncontextmenu = function(event) {
|
||||||
return false;
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("dragover", function (event) {
|
document.addEventListener("dragover", function (event) {
|
||||||
|
|
Ładowanie…
Reference in New Issue