Improve developer experience by enabling context menus when possible

merge-requests/31/head
Sebastian Delmont 2020-10-24 08:03:15 -04:00
rodzic c48e927834
commit 5e73a8964c
11 zmienionych plików z 182 dodań i 135 usunięć

25
README.md 100644
Wyświetl plik

@ -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.

Wyświetl plik

@ -1,16 +1,21 @@
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
echo "Downloading NWJS $NWJS_VERSION"
if [ ! -e build/macos/$NWJS_FULL_NAME/nwjs.app ]; then
echo "Downloading NWJS $NWJS_VERSION ($NWJS_FULL_NAME)"
mkdir -p build/macos
cd build/macos
curl -O https://dl.nwjs.io/v$NWJS_VERSION/nwjs-v$NWJS_VERSION-osx-x64.zip
unzip nwjs-v$NWJS_VERSION-osx-x64.zip
curl -O https://dl.nwjs.io/v$NWJS_VERSION/$NWJS_FULL_NAME.zip
unzip $NWJS_FULL_NAME.zip
cd ../..
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
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

Wyświetl plik

@ -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>
<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">
<br />...no data yet...<br />
&nbsp;

Wyświetl plik

@ -33,9 +33,10 @@ document.addEventListener("drop", function (event) {
});
document.addEventListener('contextmenu', function(ev) {
window.opener.openBaWindow(false);
window.opener.toggleBaWindow(ev);
if (process.versions['nw-flavor'] != "sdk") {
ev.preventDefault();
}
});
@ -43,7 +44,7 @@ document.addEventListener('contextmenu', function(ev) {
<script src="./lib/screens.js"></script>
</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="graphDiv" style="bottom:0;position: absolute;width:100%;padding:0px;margin-bottom:2px">
<br />...no data yet...<br />

Wyświetl plik

@ -262,6 +262,8 @@ function openIdCid( from )
function openLookupCid( from )
{
from.preventDefault();
if ( typeof window.opener.g_gtFlagPins[from.currentTarget.id] != "undefined" )
{
doLookup(window.opener.g_gtFlagPins[from.currentTarget.id].call);

Wyświetl plik

@ -37,8 +37,10 @@ table, th, td {
</style>
<script>
document.oncontextmenu = function() {
return false;
document.oncontextmenu = function(event) {
if (process.versions['nw-flavor'] != "sdk") {
ev.preventDefault();
}
}
document.addEventListener("dragover", function (event) {

Wyświetl plik

@ -66,8 +66,10 @@ function onMyKeyDown(event)
window.opener.onMyKeyDown(event);
}
document.oncontextmenu = function() {
return false;
document.oncontextmenu = function(event) {
if (process.versions['nw-flavor'] != "sdk") {
ev.preventDefault();
}
}
</script>

Wyświetl plik

@ -212,8 +212,10 @@
<div id="instancesDiv" style="display:none;" ></div>
</div>
<div oncontextmenu="handleContextMenu(event);">
<div id="rosterTable" style="overflow:auto;overflow-x:hidden;"></div>
</div>
</div>
<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 id="editTables">

Wyświetl plik

@ -39,6 +39,8 @@ if (g_platform == "windows")
var gui = require('nw.gui');
var win = gui.Window.get();
var g_developerMode = (process.versions['nw-flavor'] == "sdk");
var g_popupWindowHandle = null;
var g_callRosterWindowHandle = null;
var g_conditionsWindowHandle = null;
@ -4789,6 +4791,7 @@ function initMap() {
//mapDiv.addEventListener('mouseout', mapLoseFocus, false);
mapDiv.addEventListener('mouseleave', mapLoseFocus, false);
mapDiv.addEventListener('contextmenu', function(event) { event.preventDefault(); })
g_map.on('pointerdown', function (event) {
@ -4836,7 +4839,6 @@ function initMap() {
mouseOutOfDataItem();
});
document.getElementById("menuDiv").style.display = "block";
dayNight.init(g_map);
@ -6720,12 +6722,13 @@ function resetSearch()
function showWorkedByCall(callsign, evt)
{
evt.preventDefault();
resetSearch();
g_searchWB = callsign;
if ( event.shiftKey == true )
g_filterQSL = "true";
openInfoTab('qsobox', 'workedBoxDiv', showWorkedBox);
}
function showWorkedSearchChanged(object, index) {
@ -7546,8 +7549,9 @@ function showSettingsBox() {
}
}
function toggleBaWindow()
{
function toggleBaWindow(event) {
event.preventDefault();
if (g_baWindowHandle == null)
{
openBaWindow(true);
@ -11199,9 +11203,11 @@ function loadAdifSettings()
function startupVersionInit() {
if (!g_developerMode) {
document.body.addEventListener('contextmenu', function(ev) {
ev.preventDefault();
});
}
imSureCheck.checked = false;
stopAskingCheckbox.checked = g_appSettings.stopAskingVersion;

Wyświetl plik

@ -42,6 +42,7 @@ var g_callsignDatabaseDXCC = {};
var g_callsignDatabaseUS = {}
var g_callsignDatabaseUSplus = {};
var g_developerMode = (process.versions['nw-flavor'] == "sdk");
var g_modeColors = {};
g_modeColors["FT4"] = '1111FF';
@ -3036,10 +3037,59 @@ function init()
});
g_dxccMenu.append(item);
document.body.addEventListener('contextmenu', function(ev) {
ev.preventDefault();
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>&infin;</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" )
return false;
var len = Object.keys(g_blockedCalls).length;
if ( len > 0 )
{
@ -3137,59 +3187,11 @@ function init()
}
}
if (!g_developerMode) {
ev.preventDefault();
}
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>&infin;</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)

Wyświetl plik

@ -1,8 +1,8 @@
// GridTracker ©2020 N0TTL
document.oncontextmenu = function() {
return false;
document.oncontextmenu = function(event) {
event.preventDefault();
}
document.addEventListener("dragover", function (event) {