From b583f0b3161b7ac163993b559a86515a308f50fc Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 1 Jul 2021 14:03:20 +0200
Subject: [PATCH 001/275] add auto build actions
---
.github/workflows/dev.yaml | 23 +++++++++++++++++++++++
.github/workflows/master.yaml | 23 +++++++++++++++++++++++
2 files changed, 46 insertions(+)
create mode 100644 .github/workflows/dev.yaml
create mode 100644 .github/workflows/master.yaml
diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml
new file mode 100644
index 000000000..7a581c836
--- /dev/null
+++ b/.github/workflows/dev.yaml
@@ -0,0 +1,23 @@
+name: Build and Deploy Dev
+on:
+ push:
+ branches:
+ - dev
+jobs:
+ build-and-deploy-dev:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout 🛎️
+ uses: actions/checkout@v2.3.1
+
+ - name: Build 🔧
+ run: |
+ npm install
+ npx gulp build-dev
+
+ - name: Deploy 🚀
+ uses: JamesIves/github-pages-deploy-action@4.1.1
+ with:
+ branch: dist # The branch the action should deploy to.
+ folder: releases # The folder the action should deploy.
+ clean: false # build is already clean (keep prod/dev)
diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml
new file mode 100644
index 000000000..1bfc20a6d
--- /dev/null
+++ b/.github/workflows/master.yaml
@@ -0,0 +1,23 @@
+name: Build and Deploy Prod
+on:
+ push:
+ branches:
+ - master
+jobs:
+ build-and-deploy-prod:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout 🛎️
+ uses: actions/checkout@v2.3.1
+
+ - name: Build 🔧
+ run: |
+ npm install
+ npx gulp build-prod
+
+ - name: Deploy 🚀
+ uses: JamesIves/github-pages-deploy-action@4.1.1
+ with:
+ branch: dist # The branch the action should deploy to.
+ folder: releases # The folder the action should deploy.
+ clean: false # build is already clean (keep prod/dev)
From 9f86514984f085d7d1f1b677f77d50c075f647e4 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 13:43:01 +0200
Subject: [PATCH 002/275] move data -> ./model
---
src/code/buttons/quickdrawButton.js | 2 +-
src/code/buttons/syncButton.js | 2 +-
src/code/buttons/uploadButton.js | 2 +-
src/code/buttons/wasabeeButton.js | 2 +-
src/code/crosslinks.js | 4 ++--
src/code/dialogs/agentDialog.js | 2 +-
src/code/dialogs/assignDialog.js | 10 +++++-----
src/code/dialogs/authDialog.js | 2 +-
src/code/dialogs/checklist.js | 6 +++---
src/code/dialogs/defensiveKeysDialog.js | 4 ++--
src/code/dialogs/fanfield.js | 4 ++--
src/code/dialogs/homogeneous.js | 4 ++--
src/code/dialogs/importDialog.js | 4 ++--
src/code/dialogs/keyListPortal.js | 2 +-
src/code/dialogs/keysList.js | 2 +-
src/code/dialogs/linkDialog.js | 2 +-
src/code/dialogs/madrid.js | 2 +-
src/code/dialogs/manageTeamDialog.js | 4 ++--
src/code/dialogs/markerAddDialog.js | 6 +++---
src/code/dialogs/mergeDialog.js | 4 ++--
src/code/dialogs/multimaxDialog.js | 2 +-
src/code/dialogs/newopDialog.js | 2 +-
src/code/dialogs/onionfield.js | 4 ++--
src/code/dialogs/onlineAgentList.js | 2 +-
src/code/dialogs/opPerms.js | 4 ++--
src/code/dialogs/opSettings.js | 2 +-
src/code/dialogs/opsDialog.js | 6 +++---
src/code/dialogs/saveLinks.js | 2 +-
src/code/dialogs/sendTargetDialog.js | 8 ++++----
src/code/dialogs/setCommentDialog.js | 6 +++---
src/code/dialogs/settingsDialog.js | 2 +-
src/code/dialogs/starburst.js | 2 +-
src/code/dialogs/stateDialog.js | 4 ++--
src/code/dialogs/teamListDialog.js | 2 +-
src/code/dialogs/teamMembershipList.js | 2 +-
src/code/dialogs/wasabeeDlist.js | 4 ++--
src/code/firebaseSupport.js | 4 ++--
src/code/init.js | 4 ++--
src/code/mapDrawing.js | 10 +++++-----
src/code/{ => model}/agent.js | 10 +++++-----
src/code/{ => model}/anchor.js | 14 +++++++-------
src/code/{ => model}/link.js | 10 +++++-----
src/code/{ => model}/marker.js | 18 +++++++++---------
src/code/{ => model}/me.js | 2 +-
src/code/{ => model}/operation.js | 8 ++++----
src/code/{ => model}/portal.js | 4 ++--
src/code/{ => model}/team.js | 2 +-
src/code/{ => model}/zone.js | 0
src/code/selectedOp.js | 2 +-
src/code/server.js | 6 +++---
src/code/uiCommands.js | 6 +++---
src/code/wd.js | 4 ++--
52 files changed, 114 insertions(+), 114 deletions(-)
rename src/code/{ => model}/agent.js (98%)
rename src/code/{ => model}/anchor.js (93%)
rename src/code/{ => model}/link.js (96%)
rename src/code/{ => model}/marker.js (94%)
rename src/code/{ => model}/me.js (98%)
rename src/code/{ => model}/operation.js (99%)
rename src/code/{ => model}/portal.js (98%)
rename src/code/{ => model}/team.js (97%)
rename src/code/{ => model}/zone.js (100%)
diff --git a/src/code/buttons/quickdrawButton.js b/src/code/buttons/quickdrawButton.js
index e9b93187b..32acb6917 100644
--- a/src/code/buttons/quickdrawButton.js
+++ b/src/code/buttons/quickdrawButton.js
@@ -1,6 +1,6 @@
import { WTooltip, WButton } from "../leafletClasses";
import wX from "../wX";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import { postToFirebase } from "../firebaseSupport";
diff --git a/src/code/buttons/syncButton.js b/src/code/buttons/syncButton.js
index edd85f1da..ce173247c 100644
--- a/src/code/buttons/syncButton.js
+++ b/src/code/buttons/syncButton.js
@@ -1,5 +1,5 @@
import { WButton } from "../leafletClasses";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
import { fullSync } from "../uiCommands";
import wX from "../wX";
diff --git a/src/code/buttons/uploadButton.js b/src/code/buttons/uploadButton.js
index de72c86a1..ec8f0f067 100644
--- a/src/code/buttons/uploadButton.js
+++ b/src/code/buttons/uploadButton.js
@@ -5,7 +5,7 @@ import {
GetWasabeeServer,
opPromise,
} from "../server";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
import { getSelectedOperation, makeSelectedOperation } from "../selectedOp";
import ConfirmDialog from "../dialogs/confirmDialog";
import MergeDialog from "../dialogs/mergeDialog";
diff --git a/src/code/buttons/wasabeeButton.js b/src/code/buttons/wasabeeButton.js
index 79f9855cd..1178a8620 100644
--- a/src/code/buttons/wasabeeButton.js
+++ b/src/code/buttons/wasabeeButton.js
@@ -1,5 +1,5 @@
import { WButton } from "../leafletClasses";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
import TeamListDialog from "../dialogs/teamListDialog";
import OpsDialog from "../dialogs/opsDialog";
import AuthDialog from "../dialogs/authDialog";
diff --git a/src/code/crosslinks.js b/src/code/crosslinks.js
index 3ae8b62ae..710520398 100644
--- a/src/code/crosslinks.js
+++ b/src/code/crosslinks.js
@@ -1,5 +1,5 @@
-import WasabeePortal from "./portal";
-import WasabeeLink from "./link";
+import WasabeePortal from "./model/portal";
+import WasabeeLink from "./model/link";
import { getSelectedOperation } from "./selectedOp";
const Wasabee = window.plugin.wasabee;
diff --git a/src/code/dialogs/agentDialog.js b/src/code/dialogs/agentDialog.js
index 1e8434814..7f646b1d3 100644
--- a/src/code/dialogs/agentDialog.js
+++ b/src/code/dialogs/agentDialog.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
import wX from "../wX";
-import WasabeeAgent from "../agent";
+import WasabeeAgent from "../model/agent";
const AgentDialog = WDialog.extend({
statics: {
diff --git a/src/code/dialogs/assignDialog.js b/src/code/dialogs/assignDialog.js
index cd949330d..89d10ddad 100644
--- a/src/code/dialogs/assignDialog.js
+++ b/src/code/dialogs/assignDialog.js
@@ -1,9 +1,9 @@
import { WDialog } from "../leafletClasses";
-import WasabeeLink from "../link";
-import WasabeeMarker from "../marker";
-import WasabeeAnchor from "../anchor";
-import WasabeeMe from "../me";
-import WasabeeTeam from "../team";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
+import WasabeeAnchor from "../model/anchor";
+import WasabeeMe from "../model/me";
+import WasabeeTeam from "../model/team";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
diff --git a/src/code/dialogs/authDialog.js b/src/code/dialogs/authDialog.js
index bb8e9f141..9759ecf6b 100644
--- a/src/code/dialogs/authDialog.js
+++ b/src/code/dialogs/authDialog.js
@@ -10,7 +10,7 @@ import PromptDialog from "./promptDialog";
import { sendLocation, fullSync } from "../uiCommands";
import { wX } from "../wX";
import { postToFirebase } from "../firebaseSupport";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
const AuthDialog = WDialog.extend({
statics: {
diff --git a/src/code/dialogs/checklist.js b/src/code/dialogs/checklist.js
index cc8280427..0cc20890d 100644
--- a/src/code/dialogs/checklist.js
+++ b/src/code/dialogs/checklist.js
@@ -1,7 +1,7 @@
import { WDialog } from "../leafletClasses";
-import WasabeeAgent from "../agent";
-import WasabeeLink from "../link";
-import WasabeeMarker from "../marker";
+import WasabeeAgent from "../model/agent";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
import Sortable from "../sortable";
import AssignDialog from "./assignDialog";
import StateDialog from "./stateDialog";
diff --git a/src/code/dialogs/defensiveKeysDialog.js b/src/code/dialogs/defensiveKeysDialog.js
index c71925665..8c1563013 100644
--- a/src/code/dialogs/defensiveKeysDialog.js
+++ b/src/code/dialogs/defensiveKeysDialog.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
-import WasabeeMe from "../me";
+import WasabeePortal from "../model/portal";
+import WasabeeMe from "../model/me";
import { dKeyPromise } from "../server";
import wX from "../wX";
import WasabeeDList from "./wasabeeDlist";
diff --git a/src/code/dialogs/fanfield.js b/src/code/dialogs/fanfield.js
index 8195d8850..36b8d72ed 100644
--- a/src/code/dialogs/fanfield.js
+++ b/src/code/dialogs/fanfield.js
@@ -1,8 +1,8 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import { greatCircleArcIntersect, GeodesicLine } from "../crosslinks";
-import WasabeeLink from "../link";
+import WasabeeLink from "../model/link";
import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
import wX from "../wX";
diff --git a/src/code/dialogs/homogeneous.js b/src/code/dialogs/homogeneous.js
index e3eb19064..3f9359f7b 100644
--- a/src/code/dialogs/homogeneous.js
+++ b/src/code/dialogs/homogeneous.js
@@ -1,8 +1,8 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import { greatCircleArcIntersectByLatLngs } from "../crosslinks";
-// import WasabeeLink from "../link";
+// import WasabeeLink from "../model/link";
import {
clearAllLinks,
getAllPortalsOnScreen,
diff --git a/src/code/dialogs/importDialog.js b/src/code/dialogs/importDialog.js
index ff32232e4..84f40ca5f 100644
--- a/src/code/dialogs/importDialog.js
+++ b/src/code/dialogs/importDialog.js
@@ -1,5 +1,5 @@
-import WasabeeOp from "../operation";
-import WasabeePortal from "../portal";
+import WasabeeOp from "../model/operation";
+import WasabeePortal from "../model/portal";
import { WDialog } from "../leafletClasses";
import OperationChecklistDialog from "./checklist";
import wX from "../wX";
diff --git a/src/code/dialogs/keyListPortal.js b/src/code/dialogs/keyListPortal.js
index 2a4d8e3dc..b54c258d8 100644
--- a/src/code/dialogs/keyListPortal.js
+++ b/src/code/dialogs/keyListPortal.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
import Sortable from "../sortable";
-import WasabeeAgent from "../agent";
+import WasabeeAgent from "../model/agent";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
diff --git a/src/code/dialogs/keysList.js b/src/code/dialogs/keysList.js
index b602257f1..9c35e259a 100644
--- a/src/code/dialogs/keysList.js
+++ b/src/code/dialogs/keysList.js
@@ -1,7 +1,7 @@
import { WDialog } from "../leafletClasses";
import Sortable from "../sortable";
import { opKeyPromise } from "../server";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
import KeyListPortal from "./keyListPortal";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
diff --git a/src/code/dialogs/linkDialog.js b/src/code/dialogs/linkDialog.js
index aab280908..4b05f3523 100644
--- a/src/code/dialogs/linkDialog.js
+++ b/src/code/dialogs/linkDialog.js
@@ -1,5 +1,5 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
diff --git a/src/code/dialogs/madrid.js b/src/code/dialogs/madrid.js
index c90885b1a..721380f87 100644
--- a/src/code/dialogs/madrid.js
+++ b/src/code/dialogs/madrid.js
@@ -1,5 +1,5 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import {
getAllPortalsOnScreen,
diff --git a/src/code/dialogs/manageTeamDialog.js b/src/code/dialogs/manageTeamDialog.js
index 3b0e53e3b..09175f1fd 100644
--- a/src/code/dialogs/manageTeamDialog.js
+++ b/src/code/dialogs/manageTeamDialog.js
@@ -10,8 +10,8 @@ import {
deleteJoinLinkPromise,
createJoinLinkPromise,
} from "../server";
-import WasabeeMe from "../me";
-import WasabeeTeam from "../team";
+import WasabeeMe from "../model/me";
+import WasabeeTeam from "../model/team";
import Sortable from "../sortable";
import PromptDialog from "./promptDialog";
import wX from "../wX";
diff --git a/src/code/dialogs/markerAddDialog.js b/src/code/dialogs/markerAddDialog.js
index f1ef46571..22c9746d2 100644
--- a/src/code/dialogs/markerAddDialog.js
+++ b/src/code/dialogs/markerAddDialog.js
@@ -1,7 +1,7 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
-import WasabeeMe from "../me";
-import WasabeeTeam from "../team";
+import WasabeePortal from "../model/portal";
+import WasabeeMe from "../model/me";
+import WasabeeTeam from "../model/team";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
diff --git a/src/code/dialogs/mergeDialog.js b/src/code/dialogs/mergeDialog.js
index d14a7d202..e2cc1d61e 100644
--- a/src/code/dialogs/mergeDialog.js
+++ b/src/code/dialogs/mergeDialog.js
@@ -1,7 +1,7 @@
import { WDialog } from "../leafletClasses";
import wX from "../wX";
-import WasabeeAgent from "../agent";
-import WasabeeOp from "../operation";
+import WasabeeAgent from "../model/agent";
+import WasabeeOp from "../model/operation";
import Sortable from "../sortable";
import { getSelectedOperation, makeSelectedOperation } from "../selectedOp";
import { drawBackgroundOp } from "../mapDrawing";
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index abeee322e..fcc952aac 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -1,5 +1,5 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
import {
diff --git a/src/code/dialogs/newopDialog.js b/src/code/dialogs/newopDialog.js
index 906ed4536..ea63c77aa 100644
--- a/src/code/dialogs/newopDialog.js
+++ b/src/code/dialogs/newopDialog.js
@@ -1,5 +1,5 @@
import { WDialog } from "../leafletClasses";
-import WasabeeOp from "../operation";
+import WasabeeOp from "../model/operation";
import ImportDialog from "./importDialog";
import PromptDialog from "./promptDialog";
import { makeSelectedOperation } from "../selectedOp";
diff --git a/src/code/dialogs/onionfield.js b/src/code/dialogs/onionfield.js
index d089c1a3e..26d3b4c0f 100644
--- a/src/code/dialogs/onionfield.js
+++ b/src/code/dialogs/onionfield.js
@@ -1,8 +1,8 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import { greatCircleArcIntersect } from "../crosslinks";
-import WasabeeLink from "../link";
+import WasabeeLink from "../model/link";
import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
import wX from "../wX";
diff --git a/src/code/dialogs/onlineAgentList.js b/src/code/dialogs/onlineAgentList.js
index 164ee0562..47166d1ed 100644
--- a/src/code/dialogs/onlineAgentList.js
+++ b/src/code/dialogs/onlineAgentList.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
import Sortable from "../sortable";
-import WasabeeAgent from "../agent";
+import WasabeeAgent from "../model/agent";
import wX from "../wX";
const OnlineAgentList = WDialog.extend({
diff --git a/src/code/dialogs/opPerms.js b/src/code/dialogs/opPerms.js
index 2d07067a1..83e5bb4e5 100644
--- a/src/code/dialogs/opPerms.js
+++ b/src/code/dialogs/opPerms.js
@@ -1,8 +1,8 @@
import { WDialog } from "../leafletClasses";
import Sortable from "../sortable";
import { getSelectedOperation } from "../selectedOp";
-import WasabeeTeam from "../team";
-import WasabeeMe from "../me";
+import WasabeeTeam from "../model/team";
+import WasabeeMe from "../model/me";
import { addPermPromise, delPermPromise } from "../server";
import wX from "../wX";
diff --git a/src/code/dialogs/opSettings.js b/src/code/dialogs/opSettings.js
index 65db6421c..7b3e2fe11 100644
--- a/src/code/dialogs/opSettings.js
+++ b/src/code/dialogs/opSettings.js
@@ -13,7 +13,7 @@ import {
import OpPermList from "./opPerms";
import wX from "../wX";
import { addToColorList } from "../skin";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
import { convertColorToHex } from "../auxiliar";
diff --git a/src/code/dialogs/opsDialog.js b/src/code/dialogs/opsDialog.js
index b1a2807ef..d00c4f53c 100644
--- a/src/code/dialogs/opsDialog.js
+++ b/src/code/dialogs/opsDialog.js
@@ -1,4 +1,4 @@
-import WasabeeOp from "../operation";
+import WasabeeOp from "../model/operation";
import { WDialog } from "../leafletClasses";
import {
getSelectedOperation,
@@ -12,8 +12,8 @@ import {
} from "../selectedOp";
import OpPermList from "./opPerms";
import wX from "../wX";
-import WasabeeMe from "../me";
-import WasabeeAgent from "../agent";
+import WasabeeMe from "../model/me";
+import WasabeeAgent from "../model/agent";
import { syncOp, deleteLocalOp, zoomToOperation } from "../uiCommands";
import Sortable from "../sortable";
diff --git a/src/code/dialogs/saveLinks.js b/src/code/dialogs/saveLinks.js
index 26af69fb1..97439f4b5 100644
--- a/src/code/dialogs/saveLinks.js
+++ b/src/code/dialogs/saveLinks.js
@@ -1,5 +1,5 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import { clearAllLinks, getAllPortalsLinked } from "../uiCommands";
import wX from "../wX";
diff --git a/src/code/dialogs/sendTargetDialog.js b/src/code/dialogs/sendTargetDialog.js
index 2664c8de6..d735212c5 100644
--- a/src/code/dialogs/sendTargetDialog.js
+++ b/src/code/dialogs/sendTargetDialog.js
@@ -1,8 +1,8 @@
import { WDialog } from "../leafletClasses";
-import WasabeeMarker from "../marker";
-import WasabeeAnchor from "../anchor";
-import WasabeeMe from "../me";
-import WasabeeTeam from "../team";
+import WasabeeMarker from "../model/marker";
+import WasabeeAnchor from "../model/anchor";
+import WasabeeMe from "../model/me";
+import WasabeeTeam from "../model/team";
import { targetPromise } from "../server";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
diff --git a/src/code/dialogs/setCommentDialog.js b/src/code/dialogs/setCommentDialog.js
index 7fe0e2690..68821f0e7 100644
--- a/src/code/dialogs/setCommentDialog.js
+++ b/src/code/dialogs/setCommentDialog.js
@@ -1,7 +1,7 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
-import WasabeeLink from "../link";
-import WasabeeMarker from "../marker";
+import WasabeePortal from "../model/portal";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
import wX from "../wX";
export const SetCommentDialog = WDialog.extend({
diff --git a/src/code/dialogs/settingsDialog.js b/src/code/dialogs/settingsDialog.js
index c20244945..0f69b4330 100644
--- a/src/code/dialogs/settingsDialog.js
+++ b/src/code/dialogs/settingsDialog.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
import wX from "../wX";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
import { GetWasabeeServer, SetWasabeeServer } from "../server";
import PromptDialog from "./promptDialog";
import SkinDialog from "./skinDialog";
diff --git a/src/code/dialogs/starburst.js b/src/code/dialogs/starburst.js
index bd6e148de..8eb6d69d1 100644
--- a/src/code/dialogs/starburst.js
+++ b/src/code/dialogs/starburst.js
@@ -1,5 +1,5 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../portal";
+import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
import wX from "../wX";
diff --git a/src/code/dialogs/stateDialog.js b/src/code/dialogs/stateDialog.js
index 2f0f7d4e1..7bca225c0 100644
--- a/src/code/dialogs/stateDialog.js
+++ b/src/code/dialogs/stateDialog.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
-import WasabeeLink from "../link";
-import WasabeeMarker from "../marker";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
diff --git a/src/code/dialogs/teamListDialog.js b/src/code/dialogs/teamListDialog.js
index a3f3f8720..15aadd2a9 100644
--- a/src/code/dialogs/teamListDialog.js
+++ b/src/code/dialogs/teamListDialog.js
@@ -1,5 +1,5 @@
import { WDialog } from "../leafletClasses";
-import WasabeeMe from "../me";
+import WasabeeMe from "../model/me";
import Sortable from "../sortable";
import {
SetTeamState,
diff --git a/src/code/dialogs/teamMembershipList.js b/src/code/dialogs/teamMembershipList.js
index 7a47146ce..e6723e0e3 100644
--- a/src/code/dialogs/teamMembershipList.js
+++ b/src/code/dialogs/teamMembershipList.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
import Sortable from "../sortable";
-import WasabeeTeam from "../team";
+import WasabeeTeam from "../model/team";
import wX from "../wX";
const TeamMembershipList = WDialog.extend({
diff --git a/src/code/dialogs/wasabeeDlist.js b/src/code/dialogs/wasabeeDlist.js
index 9e99bcea9..9887d98be 100644
--- a/src/code/dialogs/wasabeeDlist.js
+++ b/src/code/dialogs/wasabeeDlist.js
@@ -1,8 +1,8 @@
import { WDialog } from "../leafletClasses";
import Sortable from "../sortable";
import wX from "../wX";
-import WasabeeMe from "../me";
-import WasabeePortal from "../portal";
+import WasabeeMe from "../model/me";
+import WasabeePortal from "../model/portal";
import { getAgentWasabeeDkeys } from "../wd";
const WasabeeDList = WDialog.extend({
diff --git a/src/code/firebaseSupport.js b/src/code/firebaseSupport.js
index d9f7fcf5a..d908e4b1a 100644
--- a/src/code/firebaseSupport.js
+++ b/src/code/firebaseSupport.js
@@ -13,8 +13,8 @@ import {
loadNewDefaultOp,
} from "./selectedOp";
import { updateLocalOp } from "./uiCommands";
-import WasabeeOp from "./operation";
-import WasabeePortal from "./portal";
+import WasabeeOp from "./model/operation";
+import WasabeePortal from "./model/portal";
// TODO: use a dedicated message channel: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API/Using_channel_messaging
diff --git a/src/code/init.js b/src/code/init.js
index 62f39e9e7..3ead3d7e6 100644
--- a/src/code/init.js
+++ b/src/code/init.js
@@ -15,8 +15,8 @@ import { listenForPortalDetails, sendLocation } from "./uiCommands";
import { initSkin, changeSkin } from "./skin";
import { WPane } from "./leafletClasses";
import OperationChecklist from "./dialogs/checklist";
-import WasabeeMe from "./me";
-import WasabeeOp from "./operation";
+import WasabeeMe from "./model/me";
+import WasabeeOp from "./model/operation";
import { openDB } from "idb";
import polyfill from "./polyfill";
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index 970edd4f4..5966ca0f3 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -1,8 +1,8 @@
-import WasabeeMe from "./me";
-import WasabeeAnchor from "./anchor";
-import WasabeeTeam from "./team";
-import WasabeeAgent from "./agent";
-import WasabeeOp from "./operation";
+import WasabeeMe from "./model/me";
+import WasabeeAnchor from "./model/anchor";
+import WasabeeTeam from "./model/team";
+import WasabeeAgent from "./model/agent";
+import WasabeeOp from "./model/operation";
import { newColors } from "./auxiliar";
import { getSelectedOperation, opsList } from "./selectedOp";
diff --git a/src/code/agent.js b/src/code/model/agent.js
similarity index 98%
rename from src/code/agent.js
rename to src/code/model/agent.js
index cc70f3a8b..37f6e2bc2 100644
--- a/src/code/agent.js
+++ b/src/code/model/agent.js
@@ -1,9 +1,9 @@
import WasabeePortal from "./portal";
-import ConfirmDialog from "./dialogs/confirmDialog";
-import AgentDialog from "./dialogs/agentDialog";
-import { agentPromise, targetPromise, routePromise } from "./server";
-import { getSelectedOperation } from "./selectedOp";
-import wX from "./wX";
+import ConfirmDialog from "../dialogs/confirmDialog";
+import AgentDialog from "../dialogs/agentDialog";
+import { agentPromise, targetPromise, routePromise } from "../server";
+import { getSelectedOperation } from "../selectedOp";
+import wX from "../wX";
import WasabeeMe from "./me";
import WasabeeTeam from "./team";
diff --git a/src/code/anchor.js b/src/code/model/anchor.js
similarity index 93%
rename from src/code/anchor.js
rename to src/code/model/anchor.js
index f20261b7b..7dc3ad4b3 100644
--- a/src/code/anchor.js
+++ b/src/code/model/anchor.js
@@ -1,10 +1,10 @@
-import { swapPortal, deletePortal } from "./uiCommands";
-import { getSelectedOperation } from "./selectedOp";
-import AssignDialog from "./dialogs/assignDialog";
-import SendTargetDialog from "./dialogs/sendTargetDialog";
-import SetCommentDialog from "./dialogs/setCommentDialog";
-import LinkListDialog from "./dialogs/linkListDialog";
-import wX from "./wX";
+import { swapPortal, deletePortal } from "../uiCommands";
+import { getSelectedOperation } from "../selectedOp";
+import AssignDialog from "../dialogs/assignDialog";
+import SendTargetDialog from "../dialogs/sendTargetDialog";
+import SetCommentDialog from "../dialogs/setCommentDialog";
+import LinkListDialog from "../dialogs/linkListDialog";
+import wX from "../wX";
// this class is for the popups, and for assign menu
export default class WasabeeAnchor {
diff --git a/src/code/link.js b/src/code/model/link.js
similarity index 96%
rename from src/code/link.js
rename to src/code/model/link.js
index d51fe30cd..396c86cc8 100644
--- a/src/code/link.js
+++ b/src/code/model/link.js
@@ -1,8 +1,8 @@
-import { generateId, convertColorToHex, newColors } from "./auxiliar";
-import { getSelectedOperation } from "./selectedOp";
-import wX from "./wX";
-import AssignDialog from "./dialogs/assignDialog";
-import { addToColorList } from "./skin";
+import { generateId, convertColorToHex, newColors } from "../auxiliar";
+import { getSelectedOperation } from "../selectedOp";
+import wX from "../wX";
+import AssignDialog from "../dialogs/assignDialog";
+import { addToColorList } from "../skin";
export default class WasabeeLink {
constructor(obj) {
diff --git a/src/code/marker.js b/src/code/model/marker.js
similarity index 94%
rename from src/code/marker.js
rename to src/code/model/marker.js
index e30aa768e..ddc88ae49 100644
--- a/src/code/marker.js
+++ b/src/code/model/marker.js
@@ -1,13 +1,13 @@
-import { generateId } from "./auxiliar";
-import { deleteMarker } from "./uiCommands";
+import { generateId } from "../auxiliar";
+import { deleteMarker } from "../uiCommands";
import WasabeeAgent from "./agent";
-import AssignDialog from "./dialogs/assignDialog";
-import SendTargetDialog from "./dialogs/sendTargetDialog";
-import wX from "./wX";
-import SetCommentDialog from "./dialogs/setCommentDialog";
-import MarkerChangeDialog from "./dialogs/markerChangeDialog";
-import StateDialog from "./dialogs/stateDialog";
-import { getSelectedOperation } from "./selectedOp";
+import AssignDialog from "../dialogs/assignDialog";
+import SendTargetDialog from "../dialogs/sendTargetDialog";
+import wX from "../wX";
+import SetCommentDialog from "../dialogs/setCommentDialog";
+import MarkerChangeDialog from "../dialogs/markerChangeDialog";
+import StateDialog from "../dialogs/stateDialog";
+import { getSelectedOperation } from "../selectedOp";
const STATE_UNASSIGNED = "pending";
const STATE_ASSIGNED = "assigned";
diff --git a/src/code/me.js b/src/code/model/me.js
similarity index 98%
rename from src/code/me.js
rename to src/code/model/me.js
index 5a6bcda4d..af2c9455a 100644
--- a/src/code/me.js
+++ b/src/code/model/me.js
@@ -1,4 +1,4 @@
-import { mePromise } from "./server";
+import { mePromise } from "../server";
const Wasabee = window.plugin.wasabee;
diff --git a/src/code/operation.js b/src/code/model/operation.js
similarity index 99%
rename from src/code/operation.js
rename to src/code/model/operation.js
index 44c3a5160..dd8c19842 100644
--- a/src/code/operation.js
+++ b/src/code/model/operation.js
@@ -3,11 +3,11 @@ import WasabeePortal from "./portal";
import WasabeeMarker from "./marker";
import WasabeeMe from "./me";
import WasabeeZone from "./zone";
-import { generateId, newColors } from "./auxiliar";
-import { GetWasabeeServer } from "./server";
-import { getSelectedOperation } from "./selectedOp";
+import { generateId, newColors } from "../auxiliar";
+import { GetWasabeeServer } from "../server";
+import { getSelectedOperation } from "../selectedOp";
-import wX from "./wX";
+import wX from "../wX";
const Wasabee = window.plugin.wasabee;
diff --git a/src/code/portal.js b/src/code/model/portal.js
similarity index 98%
rename from src/code/portal.js
rename to src/code/model/portal.js
index 63db0e0d8..3323fb10f 100644
--- a/src/code/portal.js
+++ b/src/code/model/portal.js
@@ -1,5 +1,5 @@
-import { generateId } from "./auxiliar";
-import wX from "./wX";
+import { generateId } from "../auxiliar";
+import wX from "../wX";
export default class WasabeePortal {
constructor(obj) {
diff --git a/src/code/team.js b/src/code/model/team.js
similarity index 97%
rename from src/code/team.js
rename to src/code/model/team.js
index a7f3b5e30..980d276f9 100644
--- a/src/code/team.js
+++ b/src/code/model/team.js
@@ -1,6 +1,6 @@
import WasabeeAgent from "./agent";
import WasabeeMe from "./me";
-import { teamPromise } from "./server";
+import { teamPromise } from "../server";
export default class WasabeeTeam {
constructor(data) {
diff --git a/src/code/zone.js b/src/code/model/zone.js
similarity index 100%
rename from src/code/zone.js
rename to src/code/model/zone.js
diff --git a/src/code/selectedOp.js b/src/code/selectedOp.js
index b482d258f..0910c1ba7 100644
--- a/src/code/selectedOp.js
+++ b/src/code/selectedOp.js
@@ -1,4 +1,4 @@
-import WasabeeOp from "./operation";
+import WasabeeOp from "./model/operation";
import wX from "./wX";
import { generateId } from "./auxiliar";
diff --git a/src/code/server.js b/src/code/server.js
index ca4da1d3a..f4b01b3f4 100644
--- a/src/code/server.js
+++ b/src/code/server.js
@@ -1,8 +1,8 @@
-import WasabeeMe from "./me";
-import WasabeeOp from "./operation";
+import WasabeeMe from "./model/me";
+import WasabeeOp from "./model/operation";
import { getSelectedOperation, removeOperation } from "./selectedOp";
import wX from "./wX";
-import WasabeeMarker from "./marker";
+import WasabeeMarker from "./model/marker";
export default function () {
return GetWasabeeServer();
diff --git a/src/code/uiCommands.js b/src/code/uiCommands.js
index 2b0bfcf8f..83f09781e 100644
--- a/src/code/uiCommands.js
+++ b/src/code/uiCommands.js
@@ -1,8 +1,8 @@
-import WasabeeOp from "./operation";
-import WasabeePortal from "./portal";
+import WasabeeOp from "./model/operation";
+import WasabeePortal from "./model/portal";
import ConfirmDialog from "./dialogs/confirmDialog";
import MergeDialog from "./dialogs/mergeDialog";
-import WasabeeMe from "./me";
+import WasabeeMe from "./model/me";
import wX from "./wX";
import { opPromise, GetWasabeeServer, locationPromise } from "./server";
import AuthDialog from "./dialogs/authDialog";
diff --git a/src/code/wd.js b/src/code/wd.js
index ab2cc4eed..35f9ba25c 100644
--- a/src/code/wd.js
+++ b/src/code/wd.js
@@ -1,6 +1,6 @@
-import WasabeeMe from "./me";
+import WasabeeMe from "./model/me";
import { dKeylistPromise } from "./server";
-import WasabeeAgent from "./agent";
+import WasabeeAgent from "./model/agent";
import wX from "./wX";
// import { getPortalDetails } from "./uiCommands";
From 02e181264371f39bcfabddbe9855a61e1abaa8cb Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:07:53 +0200
Subject: [PATCH 003/275] add portalUI
---
src/code/buttons/quickdrawButton.js | 5 +-
src/code/crosslinks.js | 6 +-
src/code/dialogs/assignDialog.js | 14 ++--
src/code/dialogs/blockersList.js | 6 +-
src/code/dialogs/checklist.js | 4 +-
src/code/dialogs/defensiveKeysDialog.js | 7 +-
src/code/dialogs/fanfield.js | 22 +++---
src/code/dialogs/homogeneous.js | 22 +++---
src/code/dialogs/keyListPortal.js | 10 ++-
src/code/dialogs/keysList.js | 4 +-
src/code/dialogs/linkDialog.js | 20 ++---
src/code/dialogs/linkListDialog.js | 6 +-
src/code/dialogs/madrid.js | 14 ++--
src/code/dialogs/markerAddDialog.js | 9 ++-
src/code/dialogs/markerChangeDialog.js | 6 +-
src/code/dialogs/mergeDialog.js | 6 +-
src/code/dialogs/multimaxDialog.js | 14 ++--
src/code/dialogs/onionfield.js | 8 +-
src/code/dialogs/saveLinks.js | 8 +-
src/code/dialogs/sendTargetDialog.js | 6 +-
src/code/dialogs/setCommentDialog.js | 10 ++-
src/code/dialogs/starburst.js | 8 +-
src/code/dialogs/stateDialog.js | 4 +-
src/code/dialogs/wasabeeDlist.js | 4 +-
src/code/firebaseSupport.js | 4 +-
src/code/model/agent.js | 11 +--
src/code/model/anchor.js | 6 +-
src/code/model/link.js | 9 ++-
src/code/model/marker.js | 4 +-
src/code/model/portal.js | 93 -----------------------
src/code/ui/portal.js | 99 +++++++++++++++++++++++++
src/code/uiCommands.js | 18 +++--
32 files changed, 271 insertions(+), 196 deletions(-)
create mode 100644 src/code/ui/portal.js
diff --git a/src/code/buttons/quickdrawButton.js b/src/code/buttons/quickdrawButton.js
index 32acb6917..311b0d8e6 100644
--- a/src/code/buttons/quickdrawButton.js
+++ b/src/code/buttons/quickdrawButton.js
@@ -1,9 +1,10 @@
import { WTooltip, WButton } from "../leafletClasses";
import wX from "../wX";
-import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import { postToFirebase } from "../firebaseSupport";
+import PortalUI from "../ui/portal";
+
const QuickdrawButton = WButton.extend({
statics: {
TYPE: "QuickdrawButton",
@@ -253,7 +254,7 @@ const QuickDrawControl = L.Handler.extend({
},
_portalClicked: function (portal) {
- const selectedPortal = WasabeePortal.fromIITC(portal);
+ const selectedPortal = PortalUI.fromIITC(portal);
if (!selectedPortal) {
// XXX wX this
this._tooltip.updateContent({
diff --git a/src/code/crosslinks.js b/src/code/crosslinks.js
index 710520398..e84ecf5b4 100644
--- a/src/code/crosslinks.js
+++ b/src/code/crosslinks.js
@@ -2,6 +2,8 @@ import WasabeePortal from "./model/portal";
import WasabeeLink from "./model/link";
import { getSelectedOperation } from "./selectedOp";
+import PortalUI from "./ui/portal";
+
const Wasabee = window.plugin.wasabee;
// from iitc rework : https://github.com/IITC-CE/ingress-intel-total-conversion/pull/333
@@ -180,7 +182,7 @@ function testLink(link, operation) {
for (const drawnLink of operation.links) {
if (testPolyLine(drawnLink, link, operation)) {
showCrossLink(link, operation);
- let fromPortal = WasabeePortal.get(link.options.data.oGuid);
+ let fromPortal = PortalUI.get(link.options.data.oGuid);
if (!fromPortal)
fromPortal = WasabeePortal.fake(
(link.options.data.oLatE6 / 1e6).toFixed(6),
@@ -188,7 +190,7 @@ function testLink(link, operation) {
link.options.data.oGuid
);
operation._addPortal(fromPortal);
- let toPortal = WasabeePortal.get(link.options.data.dGuid);
+ let toPortal = PortalUI.get(link.options.data.dGuid);
if (!toPortal)
toPortal = WasabeePortal.fake(
(link.options.data.dLatE6 / 1e6).toFixed(6),
diff --git a/src/code/dialogs/assignDialog.js b/src/code/dialogs/assignDialog.js
index 89d10ddad..d14bddefb 100644
--- a/src/code/dialogs/assignDialog.js
+++ b/src/code/dialogs/assignDialog.js
@@ -7,6 +7,8 @@ import WasabeeTeam from "../model/team";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
+import PortalUI from "../ui/portal";
+
const AssignDialog = WDialog.extend({
statics: {
TYPE: "assignDialog",
@@ -53,7 +55,9 @@ const AssignDialog = WDialog.extend({
if (target instanceof WasabeeLink) {
const portal = operation.getPortal(target.fromPortalId);
this._type = "Link";
- this._name = wX("ASSIGN LINK PROMPT", { portalName: portal.displayName });
+ this._name = wX("ASSIGN LINK PROMPT", {
+ portalName: PortalUI.displayName(portal),
+ });
divtitle.appendChild(target.displayFormat(operation, this._smallScreen));
const t = L.DomUtil.create("label", null);
t.textContent = wX("LINK ASSIGNMENT");
@@ -64,9 +68,9 @@ const AssignDialog = WDialog.extend({
const portal = operation.getPortal(target.portalId);
this._type = "Marker";
this._name = wX("ASSIGN MARKER PROMPT", {
- portalName: portal.displayName,
+ portalName: PortalUI.displayName(portal),
});
- divtitle.appendChild(portal.displayFormat(this._smallScreen));
+ divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
const t = L.DomUtil.create("label", null);
t.textContent = wX("MARKER ASSIGNMENT");
menu.prepend(t);
@@ -76,9 +80,9 @@ const AssignDialog = WDialog.extend({
const portal = operation.getPortal(target.portalId);
this._type = "Anchor";
this._name = wX("ASSIGN OUTBOUND PROMPT", {
- portalName: portal.displayName,
+ portalName: PortalUI.displayName(portal),
});
- divtitle.appendChild(portal.displayFormat(this._smallScreen));
+ divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
const t = L.DomUtil.create("label", null);
t.textContent = wX("ANCHOR ASSIGNMENT");
menu.prepend(t);
diff --git a/src/code/dialogs/blockersList.js b/src/code/dialogs/blockersList.js
index 2bc5e841b..9816be0ab 100644
--- a/src/code/dialogs/blockersList.js
+++ b/src/code/dialogs/blockersList.js
@@ -10,6 +10,8 @@ import {
import wX from "../wX";
import TrawlDialog from "./trawl";
+import PortalUI from "../ui/portal";
+
const BlockerList = WDialog.extend({
statics: {
TYPE: "blockerList",
@@ -107,7 +109,7 @@ const BlockerList = WDialog.extend({
sort: (a, b) => a.localeCompare(b),
format: (row, value, blocker) => {
const p = operation.getPortal(blocker.fromPortalId);
- row.appendChild(p.displayFormat());
+ row.appendChild(PortalUI.displayFormat(p));
},
},
{
@@ -130,7 +132,7 @@ const BlockerList = WDialog.extend({
sort: (a, b) => a.localeCompare(b),
format: (row, value, blocker) => {
const p = operation.getPortal(blocker.toPortalId);
- row.appendChild(p.displayFormat());
+ row.appendChild(PortalUI.displayFormat(p));
},
},
{
diff --git a/src/code/dialogs/checklist.js b/src/code/dialogs/checklist.js
index 0cc20890d..6d4403a3f 100644
--- a/src/code/dialogs/checklist.js
+++ b/src/code/dialogs/checklist.js
@@ -17,6 +17,8 @@ import {
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const OperationChecklistDialog = WDialog.extend({
statics: {
TYPE: "operationChecklist",
@@ -131,7 +133,7 @@ const OperationChecklistDialog = WDialog.extend({
if (this._smallScreen) cell.colSpan = 2;
} else {
cell.appendChild(
- operation.getPortal(thing.portalId).displayFormat()
+ PortalUI.displayFormat(operation.getPortal(thing.portalId))
);
}
},
diff --git a/src/code/dialogs/defensiveKeysDialog.js b/src/code/dialogs/defensiveKeysDialog.js
index 8c1563013..246fcd0f1 100644
--- a/src/code/dialogs/defensiveKeysDialog.js
+++ b/src/code/dialogs/defensiveKeysDialog.js
@@ -1,11 +1,12 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
import WasabeeMe from "../model/me";
import { dKeyPromise } from "../server";
import wX from "../wX";
import WasabeeDList from "./wasabeeDlist";
import { getAgentPortalWasabeeDkeys } from "../wd";
+import PortalUI from "../ui/portal";
+
const DefensiveKeysDialog = WDialog.extend({
statics: {
TYPE: "defensiveKeysDialog",
@@ -28,11 +29,11 @@ const DefensiveKeysDialog = WDialog.extend({
},
_portalClickedHook: async function () {
- this._selectedPortal = WasabeePortal.getSelected();
+ this._selectedPortal = PortalUI.getSelected();
if (this._selectedPortal) {
this._portal.textContent = "";
this._portal.appendChild(
- this._selectedPortal.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._selectedPortal, this._smallScreen)
);
const mine = await getAgentPortalWasabeeDkeys(
this._me.GoogleID,
diff --git a/src/code/dialogs/fanfield.js b/src/code/dialogs/fanfield.js
index 36b8d72ed..7dc8b4d44 100644
--- a/src/code/dialogs/fanfield.js
+++ b/src/code/dialogs/fanfield.js
@@ -6,6 +6,8 @@ import WasabeeLink from "../model/link";
import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const FanfieldDialog = WDialog.extend({
statics: {
TYPE: "FanfieldDialog",
@@ -28,19 +30,19 @@ const FanfieldDialog = WDialog.extend({
this._anchorDisplay = L.DomUtil.create("span", null, container);
if (this._anchor) {
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
this._anchorDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorButton, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchor = WasabeePortal.getSelected();
+ this._anchor = PortalUI.getSelected();
if (this._anchor) {
localStorage["wasabee-anchor-1"] = JSON.stringify(this._anchor);
this._anchorDisplay.textContent = "";
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -54,19 +56,19 @@ const FanfieldDialog = WDialog.extend({
this._startDisplay = L.DomUtil.create("span", null, container);
if (this._start) {
this._startDisplay.appendChild(
- this._start.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._start, this._smallScreen)
);
} else {
this._startDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(startButton, "click", (ev) => {
L.DomEvent.stop(ev);
- this._start = WasabeePortal.getSelected();
+ this._start = PortalUI.getSelected();
if (this._start) {
localStorage["wasabee-fanfield-start"] = JSON.stringify(this._start);
this._startDisplay.textContent = "";
this._startDisplay.appendChild(
- this._start.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._start, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -79,18 +81,20 @@ const FanfieldDialog = WDialog.extend({
endButton.textContent = wX("SET");
this._endDisplay = L.DomUtil.create("span", null, container);
if (this._end) {
- this._endDisplay.appendChild(this._end.displayFormat(this._smallScreen));
+ this._endDisplay.appendChild(
+ PortalUI.displayFormat(this._end, this._smallScreen)
+ );
} else {
this._endDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(endButton, "click", (ev) => {
L.DomEvent.stop(ev);
- this._end = WasabeePortal.getSelected();
+ this._end = PortalUI.getSelected();
if (this._end) {
localStorage["wasabee-fanfield-end"] = JSON.stringify(this._end);
this._endDisplay.textContent = "";
this._endDisplay.appendChild(
- this._end.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._end, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
diff --git a/src/code/dialogs/homogeneous.js b/src/code/dialogs/homogeneous.js
index 3f9359f7b..6910ee5b6 100644
--- a/src/code/dialogs/homogeneous.js
+++ b/src/code/dialogs/homogeneous.js
@@ -10,6 +10,8 @@ import {
} from "../uiCommands";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const HomogeneousDialog = WDialog.extend({
statics: {
TYPE: "HomogeneousDialog",
@@ -40,20 +42,20 @@ const HomogeneousDialog = WDialog.extend({
this._anchorDisplayOne = L.DomUtil.create("span", "portal", container);
if (this._anchorOne) {
this._anchorDisplayOne.appendChild(
- this._anchorOne.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorOne, this._smallScreen)
);
} else {
this._anchorDisplayOne.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorButtonOne, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchorOne = WasabeePortal.getSelected();
+ this._anchorOne = PortalUI.getSelected();
if (this._anchorOne) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
JSON.stringify(this._anchorOne);
this._anchorDisplayOne.textContent = "";
this._anchorDisplayOne.appendChild(
- this._anchorOne.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorOne, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -67,20 +69,20 @@ const HomogeneousDialog = WDialog.extend({
this._anchorDisplayTwo = L.DomUtil.create("span", "portal", container);
if (this._anchorTwo) {
this._anchorDisplayTwo.appendChild(
- this._anchorTwo.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
);
} else {
this._anchorDisplayTwo.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorButtonTwo, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchorTwo = WasabeePortal.getSelected();
+ this._anchorTwo = PortalUI.getSelected();
if (this._anchorTwo) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY] =
JSON.stringify(this._anchorTwo);
this._anchorDisplayTwo.textContent = "";
this._anchorDisplayTwo.appendChild(
- this._anchorTwo.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -94,20 +96,20 @@ const HomogeneousDialog = WDialog.extend({
this._anchorDisplayThree = L.DomUtil.create("span", "portal", container);
if (this._anchorThree) {
this._anchorDisplayThree.appendChild(
- this._anchorThree.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorThree, this._smallScreen)
);
} else {
this._anchorDisplayThree.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorButtonThree, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchorThree = WasabeePortal.getSelected();
+ this._anchorThree = PortalUI.getSelected();
if (this._anchorThree) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_THREE_KEY] =
JSON.stringify(this._anchorThree);
this._anchorDisplayThree.textContent = "";
this._anchorDisplayThree.appendChild(
- this._anchorThree.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorThree, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -486,7 +488,7 @@ const HomogeneousDialog = WDialog.extend({
children: null,
};
for (const k of sorted.keys()) {
- const wp = WasabeePortal.get(k);
+ const wp = PortalUI.get(k);
const subregions = this._getSubregions(
wp,
new Array(...portalsCovered),
diff --git a/src/code/dialogs/keyListPortal.js b/src/code/dialogs/keyListPortal.js
index b54c258d8..c6f095d20 100644
--- a/src/code/dialogs/keyListPortal.js
+++ b/src/code/dialogs/keyListPortal.js
@@ -4,6 +4,8 @@ import WasabeeAgent from "../model/agent";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const KeyListPortal = WDialog.extend({
statics: {
TYPE: "keyListPortal",
@@ -41,7 +43,9 @@ const KeyListPortal = WDialog.extend({
const portal = op.getPortal(this.options.portalID);
this.createDialog({
- title: wX("PORTAL KEY LIST", { portalName: portal.displayName }),
+ title: wX("PORTAL KEY LIST", {
+ portalName: PortalUI.displayName(portal),
+ }),
html: this.getListDialogContent(this.options.portalID),
width: "auto",
dialogClass: "keylistportal",
@@ -63,7 +67,9 @@ const KeyListPortal = WDialog.extend({
const table = this.getListDialogContent(this.options.portalID);
this.setContent(table);
- this.setTitle(wX("PORTAL KEY LIST", { portalName: portal.displayName }));
+ this.setTitle(
+ wX("PORTAL KEY LIST", { portalName: PortalUI.displayName(portal) })
+ );
},
getSortable: function () {
diff --git a/src/code/dialogs/keysList.js b/src/code/dialogs/keysList.js
index 9c35e259a..cff6729a1 100644
--- a/src/code/dialogs/keysList.js
+++ b/src/code/dialogs/keysList.js
@@ -6,6 +6,8 @@ import KeyListPortal from "./keyListPortal";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const KeysList = WDialog.extend({
statics: {
TYPE: "keysList",
@@ -75,7 +77,7 @@ const KeysList = WDialog.extend({
value: (key) => operation.getPortal(key.id).name,
sort: (a, b) => a.localeCompare(b),
format: (cell, value, key) => {
- cell.appendChild(operation.getPortal(key.id).displayFormat());
+ cell.appendChild(PortalUI.displayFormat(operation.getPortal(key.id)));
},
},
{
diff --git a/src/code/dialogs/linkDialog.js b/src/code/dialogs/linkDialog.js
index 4b05f3523..076d5113d 100644
--- a/src/code/dialogs/linkDialog.js
+++ b/src/code/dialogs/linkDialog.js
@@ -3,6 +3,8 @@ import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const LinkDialog = WDialog.extend({
statics: {
TYPE: "linkDialog",
@@ -38,20 +40,20 @@ const LinkDialog = WDialog.extend({
this._sourceDisplay = L.DomUtil.create("span", "portal", container);
if (this._source) {
this._sourceDisplay.appendChild(
- this._source.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._source, this._smallScreen)
);
} else {
this._sourceDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(sourceButton, "click", (ev) => {
L.DomEvent.stop(ev);
- this._source = WasabeePortal.getSelected();
+ this._source = PortalUI.getSelected();
if (this._source) {
localStorage[window.plugin.wasabee.static.constants.LINK_SOURCE_KEY] =
JSON.stringify(this._source);
this._sourceDisplay.textContent = "";
this._sourceDisplay.appendChild(
- this._source.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._source, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -65,20 +67,20 @@ const LinkDialog = WDialog.extend({
this._anchor1Display = L.DomUtil.create("span", "portal", container);
if (this._anchor1) {
this._anchor1Display.appendChild(
- this._anchor1.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor1, this._smallScreen)
);
} else {
this._anchor1Display.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchor1Button, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchor1 = WasabeePortal.getSelected();
+ this._anchor1 = PortalUI.getSelected();
if (this._anchor1) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
JSON.stringify(this._anchor1);
this._anchor1Display.textContent = "";
this._anchor1Display.appendChild(
- this._anchor1.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor1, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -106,20 +108,20 @@ const LinkDialog = WDialog.extend({
this._anchor2Display = L.DomUtil.create("span", "portal", container);
if (this._anchor2) {
this._anchor2Display.appendChild(
- this._anchor2.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor2, this._smallScreen)
);
} else {
this._anchor2Display.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchor2Button, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchor2 = WasabeePortal.getSelected();
+ this._anchor2 = PortalUI.getSelected();
if (this._anchor2) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY] =
JSON.stringify(this._anchor2);
this._anchor2Display.textContent = "";
this._anchor2Display.appendChild(
- this._anchor2.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor2, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
diff --git a/src/code/dialogs/linkListDialog.js b/src/code/dialogs/linkListDialog.js
index 85364e2c5..9563836e7 100644
--- a/src/code/dialogs/linkListDialog.js
+++ b/src/code/dialogs/linkListDialog.js
@@ -3,6 +3,8 @@ import wX from "../wX";
import { loadFaked } from "../uiCommands";
import { getSelectedOperation } from "../selectedOp";
+import PortalUI from "../ui/portal";
+
const LinkListDialog = OperationChecklistDialog.extend({
statics: {
TYPE: "linkListDialog",
@@ -60,7 +62,7 @@ const LinkListDialog = OperationChecklistDialog.extend({
this.createDialog({
title: wX("LINKS2", {
- portalName: this.options.portal.displayName,
+ portalName: PortalUI.displayName(this.options.portal),
outgoing: fromCount,
incoming: toCount,
}),
@@ -89,7 +91,7 @@ const LinkListDialog = OperationChecklistDialog.extend({
this.setContent(this.sortable.table);
this.setTitle(
wX("LINKS2", {
- portalName: this.options.portal.displayName,
+ portalName: PortalUI.displayName(this.options.portal),
outgoing: fromCount,
incoming: toCount,
})
diff --git a/src/code/dialogs/madrid.js b/src/code/dialogs/madrid.js
index 721380f87..b7f286366 100644
--- a/src/code/dialogs/madrid.js
+++ b/src/code/dialogs/madrid.js
@@ -9,6 +9,8 @@ import {
import wX from "../wX";
import MultimaxDialog from "./multimaxDialog";
+import PortalUI from "../ui/portal";
+
// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
// to not require passing values around when we can get them from this.XXX
const MadridDialog = MultimaxDialog.extend({
@@ -31,19 +33,19 @@ const MadridDialog = MultimaxDialog.extend({
this._anchorOneDisplay = L.DomUtil.create("span", null, container);
if (this._anchorOne) {
this._anchorOneDisplay.appendChild(
- this._anchorOne.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorOne, this._smallScreen)
);
} else {
this._anchorOneDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorOneButton, "click", () => {
- this._anchorOne = WasabeePortal.getSelected();
+ this._anchorOne = PortalUI.getSelected();
if (this._anchorOne) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
JSON.stringify(this._anchorOne);
this._anchorOneDisplay.textContent = "";
this._anchorOneDisplay.appendChild(
- this._anchorOne.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorOne, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -77,19 +79,19 @@ const MadridDialog = MultimaxDialog.extend({
this._anchorTwoDisplay = L.DomUtil.create("span", null, container);
if (this._anchorTwo) {
this._anchorTwoDisplay.appendChild(
- this._anchorTwo.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
);
} else {
this._anchorTwoDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorTwoButton, "click", () => {
- this._anchorTwo = WasabeePortal.getSelected();
+ this._anchorTwo = PortalUI.getSelected();
if (this._anchorTwo) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY] =
JSON.stringify(this._anchorTwo);
this._anchorTwoDisplay.textContent = "";
this._anchorTwoDisplay.appendChild(
- this._anchorTwo.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
diff --git a/src/code/dialogs/markerAddDialog.js b/src/code/dialogs/markerAddDialog.js
index 22c9746d2..e76e2efce 100644
--- a/src/code/dialogs/markerAddDialog.js
+++ b/src/code/dialogs/markerAddDialog.js
@@ -1,10 +1,11 @@
import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
import WasabeeMe from "../model/me";
import WasabeeTeam from "../model/team";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const MarkerAddDialog = WDialog.extend({
statics: {
TYPE: "markerButton",
@@ -46,12 +47,12 @@ const MarkerAddDialog = WDialog.extend({
this._assign.innerHTML = "";
await this._getAgentMenu(this._assign);
- this._selectedPortal = WasabeePortal.getSelected();
+ this._selectedPortal = PortalUI.getSelected();
if (this._selectedPortal) {
this._portal.textContent = "";
this._portal.textContent = "";
this._portal.appendChild(
- this._selectedPortal.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._selectedPortal, this._smallScreen)
);
this._zones.value = getSelectedOperation().determineZone(
@@ -147,7 +148,7 @@ const MarkerAddDialog = WDialog.extend({
};
// XXX remove comment from args in 0.20
- operation.addMarker(selectedType, WasabeePortal.getSelected(), options);
+ operation.addMarker(selectedType, PortalUI.getSelected(), options);
await this.update();
localStorage[window.plugin.wasabee.static.constants.LAST_MARKER_KEY] =
selectedType;
diff --git a/src/code/dialogs/markerChangeDialog.js b/src/code/dialogs/markerChangeDialog.js
index aa2788ec1..c5257aacc 100644
--- a/src/code/dialogs/markerChangeDialog.js
+++ b/src/code/dialogs/markerChangeDialog.js
@@ -2,6 +2,8 @@ import { WDialog } from "../leafletClasses";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
+import PortalUI from "../ui/portal";
+
const MarkerChangeDialog = WDialog.extend({
statics: {
TYPE: "markerButton",
@@ -25,7 +27,9 @@ const MarkerChangeDialog = WDialog.extend({
const portal = operation.getPortal(this.options.marker.portalId);
const portalDisplay = L.DomUtil.create("div", "portal", content);
- portalDisplay.appendChild(portal.displayFormat(this._smallScreen));
+ portalDisplay.appendChild(
+ PortalUI.displayFormat(portal, this._smallScreen)
+ );
this._type = L.DomUtil.create("select", null, content);
diff --git a/src/code/dialogs/mergeDialog.js b/src/code/dialogs/mergeDialog.js
index e2cc1d61e..1e4dfbaa5 100644
--- a/src/code/dialogs/mergeDialog.js
+++ b/src/code/dialogs/mergeDialog.js
@@ -6,6 +6,8 @@ import Sortable from "../sortable";
import { getSelectedOperation, makeSelectedOperation } from "../selectedOp";
import { drawBackgroundOp } from "../mapDrawing";
+import PortalUI from "../ui/portal";
+
const MergeDialog = WDialog.extend({
statics: {
TYPE: "mergeDialog",
@@ -231,10 +233,10 @@ const MergeDialog = WDialog.extend({
if (e.data.type === "link") {
cell.appendChild(e.data.link.displayFormat(op));
} else if (e.data.type === "portal") {
- cell.appendChild(e.data.portal.displayFormat());
+ cell.appendChild(PortalUI.displayFormat(e.data.portal));
} else if (e.data.type === "marker") {
const portal = op.getPortal(e.data.marker.portalId);
- cell.appendChild(portal.displayFormat());
+ cell.appendChild(PortalUI.displayFormat(portal));
} else {
cell.textContent = value;
}
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index fcc952aac..483e2367e 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -9,6 +9,8 @@ import {
} from "../uiCommands";
import { greatCircleArcIntersectByLatLngs } from "../crosslinks";
+import PortalUI from "../ui/portal";
+
// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
// to not require passing values around when we can get them from this.XXX
const MultimaxDialog = WDialog.extend({
@@ -38,19 +40,19 @@ const MultimaxDialog = WDialog.extend({
this._anchorOneDisplay = L.DomUtil.create("span", null, container);
if (this._anchorOne) {
this._anchorOneDisplay.appendChild(
- this._anchorOne.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorOne, this._smallScreen)
);
} else {
this._anchorOneDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorOneButton, "click", () => {
- this._anchorOne = WasabeePortal.getSelected();
+ this._anchorOne = PortalUI.getSelected();
if (this._anchorOne) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
JSON.stringify(this._anchorOne);
this._anchorOneDisplay.textContent = "";
this._anchorOneDisplay.appendChild(
- this._anchorOne.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorOne, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
@@ -64,19 +66,19 @@ const MultimaxDialog = WDialog.extend({
this._anchorTwoDisplay = L.DomUtil.create("span", null, container);
if (this._anchorTwo) {
this._anchorTwoDisplay.appendChild(
- this._anchorTwo.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
);
} else {
this._anchorTwoDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorTwoButton, "click", () => {
- this._anchorTwo = WasabeePortal.getSelected();
+ this._anchorTwo = PortalUI.getSelected();
if (this._anchorTwo) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY] =
JSON.stringify(this._anchorTwo);
this._anchorTwoDisplay.textContent = "";
this._anchorTwoDisplay.appendChild(
- this._anchorTwo.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
diff --git a/src/code/dialogs/onionfield.js b/src/code/dialogs/onionfield.js
index 26d3b4c0f..e53514680 100644
--- a/src/code/dialogs/onionfield.js
+++ b/src/code/dialogs/onionfield.js
@@ -6,6 +6,8 @@ import WasabeeLink from "../model/link";
import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const OnionfieldDialog = WDialog.extend({
statics: {
TYPE: "OnionDialog",
@@ -35,20 +37,20 @@ const OnionfieldDialog = WDialog.extend({
this._anchorDisplay = L.DomUtil.create("span", null, container);
if (this._anchor) {
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
this._anchorDisplay.textContent = wX("NOT_SET");
}
L.DomEvent.on(anchorButton, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchor = WasabeePortal.getSelected();
+ this._anchor = PortalUI.getSelected();
if (this._anchor) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
JSON.stringify(this._anchor);
this._anchorDisplay.textContent = "";
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
diff --git a/src/code/dialogs/saveLinks.js b/src/code/dialogs/saveLinks.js
index 97439f4b5..efe8fe4f7 100644
--- a/src/code/dialogs/saveLinks.js
+++ b/src/code/dialogs/saveLinks.js
@@ -4,6 +4,8 @@ import { getSelectedOperation } from "../selectedOp";
import { clearAllLinks, getAllPortalsLinked } from "../uiCommands";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const SaveLinksDialog = WDialog.extend({
statics: {
TYPE: "SaveLinksDialog",
@@ -34,7 +36,7 @@ const SaveLinksDialog = WDialog.extend({
//do magic
if (this._anchor) {
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
this._anchorDisplay.textContent = wX("NOT_SET");
@@ -42,13 +44,13 @@ const SaveLinksDialog = WDialog.extend({
L.DomEvent.on(anchorButton, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchor = WasabeePortal.getSelected();
+ this._anchor = PortalUI.getSelected();
if (this._anchor) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
JSON.stringify(this._anchor);
this._anchorDisplay.textContent = "";
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
diff --git a/src/code/dialogs/sendTargetDialog.js b/src/code/dialogs/sendTargetDialog.js
index d735212c5..ca2aa30a9 100644
--- a/src/code/dialogs/sendTargetDialog.js
+++ b/src/code/dialogs/sendTargetDialog.js
@@ -7,6 +7,8 @@ import { targetPromise } from "../server";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
+import PortalUI from "../ui/portal";
+
const SendTargetDialog = WDialog.extend({
statics: {
TYPE: "sendTargetDialog",
@@ -50,7 +52,7 @@ const SendTargetDialog = WDialog.extend({
if (this.options.target instanceof WasabeeMarker) {
const portal = operation.getPortal(this.options.target.portalId);
this._targettype = this.options.target.type;
- divtitle.appendChild(portal.displayFormat(this._smallScreen));
+ divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
const t = L.DomUtil.create("label", null);
t.textContent = wX("SEND TARGET AGENT");
menu.prepend(t);
@@ -59,7 +61,7 @@ const SendTargetDialog = WDialog.extend({
if (this.options.target instanceof WasabeeAnchor) {
const portal = operation.getPortal(this.options.target.portalId);
this._targettype = "anchor";
- divtitle.appendChild(portal.displayFormat(this._smallScreen));
+ divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
const t = L.DomUtil.create("label", null);
t.textContent = wX("SEND TARGET AGENT");
menu.prepend(t);
diff --git a/src/code/dialogs/setCommentDialog.js b/src/code/dialogs/setCommentDialog.js
index 68821f0e7..af138ddee 100644
--- a/src/code/dialogs/setCommentDialog.js
+++ b/src/code/dialogs/setCommentDialog.js
@@ -4,6 +4,8 @@ import WasabeeLink from "../model/link";
import WasabeeMarker from "../model/marker";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
export const SetCommentDialog = WDialog.extend({
statics: {
TYPE: "setCommentDialog",
@@ -33,14 +35,14 @@ export const SetCommentDialog = WDialog.extend({
this.options.target.portalId
);
this.dialogTitle = wX("SET_MCOMMENT", {
- portalName: this.portal.displayName,
+ portalName: PortalUI.displayName(this.portal),
});
}
if (this.options.target instanceof WasabeePortal) {
this.commentType = "portal";
this.dialogTitle = wX("SET_PCOMMENT", {
- portalName: this.options.target.displayName,
+ portalName: PortalUI.displayName(this.options.target),
});
this.portal = this.options.target;
}
@@ -102,7 +104,7 @@ export const SetCommentDialog = WDialog.extend({
if (this.commentType == "marker") {
desc.textContent = wX("SET_MARKER_COMMENT");
- desc.appendChild(this.portal.displayFormat(this.options.operation));
+ desc.appendChild(PortalUI.displayFormat(this.portal));
if (this.options.target.comment)
input.value = this.options.target.comment;
@@ -120,7 +122,7 @@ export const SetCommentDialog = WDialog.extend({
if (this.commentType == "portal") {
desc.textContent = wX("SET_PORT_COMMENT");
- desc.appendChild(this.portal.displayFormat(this._smallScreen));
+ desc.appendChild(PortalUI.displayFormat(this.portal));
if (this.portal.comment) input.value = this.portal.comment;
input.addEventListener(
diff --git a/src/code/dialogs/starburst.js b/src/code/dialogs/starburst.js
index 8eb6d69d1..3eb9fb109 100644
--- a/src/code/dialogs/starburst.js
+++ b/src/code/dialogs/starburst.js
@@ -4,6 +4,8 @@ import { getSelectedOperation } from "../selectedOp";
import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
const StarburstDialog = WDialog.extend({
statics: {
TYPE: "StarburstDialog",
@@ -34,7 +36,7 @@ const StarburstDialog = WDialog.extend({
//do magic
if (this._anchor) {
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
this._anchorDisplay.textContent = wX("NOT_SET");
@@ -42,13 +44,13 @@ const StarburstDialog = WDialog.extend({
L.DomEvent.on(anchorButton, "click", (ev) => {
L.DomEvent.stop(ev);
- this._anchor = WasabeePortal.getSelected();
+ this._anchor = PortalUI.getSelected();
if (this._anchor) {
localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
JSON.stringify(this._anchor);
this._anchorDisplay.textContent = "";
this._anchorDisplay.appendChild(
- this._anchor.displayFormat(this._smallScreen)
+ PortalUI.displayFormat(this._anchor, this._smallScreen)
);
} else {
alert(wX("PLEASE_SELECT_PORTAL"));
diff --git a/src/code/dialogs/stateDialog.js b/src/code/dialogs/stateDialog.js
index 7bca225c0..07f50be74 100644
--- a/src/code/dialogs/stateDialog.js
+++ b/src/code/dialogs/stateDialog.js
@@ -4,6 +4,8 @@ import WasabeeMarker from "../model/marker";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
+import PortalUI from "../ui/portal";
+
const StateDialog = WDialog.extend({
statics: {
TYPE: "stateDialog",
@@ -68,7 +70,7 @@ const StateDialog = WDialog.extend({
const portal = operation.getPortal(this.options.target.portalId);
this._type = "Marker";
this._name = wX("MARKER STATE PROMPT", portal.name);
- divtitle.appendChild(portal.displayFormat(this._smallScreen));
+ divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
const t = L.DomUtil.create("label", null);
t.textContent = wX("MARKER STATE");
menu.prepend(t);
diff --git a/src/code/dialogs/wasabeeDlist.js b/src/code/dialogs/wasabeeDlist.js
index 9887d98be..8f90ccc63 100644
--- a/src/code/dialogs/wasabeeDlist.js
+++ b/src/code/dialogs/wasabeeDlist.js
@@ -5,6 +5,8 @@ import WasabeeMe from "../model/me";
import WasabeePortal from "../model/portal";
import { getAgentWasabeeDkeys } from "../wd";
+import PortalUI from "../ui/portal";
+
const WasabeeDList = WDialog.extend({
statics: {
TYPE: "wasabeeDList",
@@ -66,7 +68,7 @@ const WasabeeDList = WDialog.extend({
lat: n.Lat,
lng: n.Lng,
});
- cell.appendChild(p.displayFormat(this._smallScreen));
+ cell.appendChild(PortalUI.displayFormat(p, this._smallScreen));
},
},
{
diff --git a/src/code/firebaseSupport.js b/src/code/firebaseSupport.js
index d908e4b1a..0f683235e 100644
--- a/src/code/firebaseSupport.js
+++ b/src/code/firebaseSupport.js
@@ -16,6 +16,8 @@ import { updateLocalOp } from "./uiCommands";
import WasabeeOp from "./model/operation";
import WasabeePortal from "./model/portal";
+import PortalUI from "./ui/portal";
+
// TODO: use a dedicated message channel: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API/Using_channel_messaging
const frameID = "wasabeeFirebaseFrame";
@@ -107,7 +109,7 @@ export function initFirebase() {
lng: target.Lon,
};
const portal = new WasabeePortal(raw);
- const f = portal.displayFormat();
+ const f = PortalUI.displayFormat(portal);
alert(f.outerHTML + " Sent by: " + target.Sender, true);
} catch (e) {
console.error(e);
diff --git a/src/code/model/agent.js b/src/code/model/agent.js
index 37f6e2bc2..245c52dbe 100644
--- a/src/code/model/agent.js
+++ b/src/code/model/agent.js
@@ -1,4 +1,3 @@
-import WasabeePortal from "./portal";
import ConfirmDialog from "../dialogs/confirmDialog";
import AgentDialog from "../dialogs/agentDialog";
import { agentPromise, targetPromise, routePromise } from "../server";
@@ -7,6 +6,8 @@ import wX from "../wX";
import WasabeeMe from "./me";
import WasabeeTeam from "./team";
+import PortalUI from "../ui/portal";
+
export default class WasabeeAgent {
constructor(obj) {
if (typeof obj == "string") {
@@ -184,7 +185,7 @@ export default class WasabeeAgent {
sendTarget.textContent = wX("SEND TARGET");
L.DomEvent.on(sendTarget, "click", (ev) => {
L.DomEvent.stop(ev);
- const selectedPortal = WasabeePortal.getSelected();
+ const selectedPortal = PortalUI.getSelected();
if (!selectedPortal) {
alert(wX("SELECT PORTAL"));
return;
@@ -193,7 +194,7 @@ export default class WasabeeAgent {
const d = new ConfirmDialog({
title: wX("SEND TARGET"),
label: wX("SEND TARGET CONFIRM", {
- portalName: selectedPortal.displayName,
+ portalName: PortalUI.displayName(selectedPortal),
agent: this.name,
}),
type: "agent",
@@ -215,7 +216,7 @@ export default class WasabeeAgent {
requestRoute.style.display = "none"; // hide this until the server-side is ready
L.DomEvent.on(requestRoute, "click", (ev) => {
L.DomEvent.stop(ev);
- const selectedPortal = WasabeePortal.getSelected();
+ const selectedPortal = PortalUI.getSelected();
if (!selectedPortal) {
alert(wX("SELECT PORTAL"));
return;
@@ -244,7 +245,7 @@ export default class WasabeeAgent {
const a = L.DomUtil.create("li", "assignment", assignments);
const portal = op.getPortal(m.portalId);
a.textContent = `${m.order}: ${wX(m.type)} `;
- a.appendChild(portal.displayFormat());
+ a.appendChild(PortalUI.displayFormat(portal));
}
return content;
diff --git a/src/code/model/anchor.js b/src/code/model/anchor.js
index 7dc3ad4b3..b63740d00 100644
--- a/src/code/model/anchor.js
+++ b/src/code/model/anchor.js
@@ -6,6 +6,8 @@ import SetCommentDialog from "../dialogs/setCommentDialog";
import LinkListDialog from "../dialogs/linkListDialog";
import wX from "../wX";
+import PortalUI from "../ui/portal";
+
// this class is for the popups, and for assign menu
export default class WasabeeAnchor {
constructor(portalId) {
@@ -51,7 +53,7 @@ export default class WasabeeAnchor {
}
displayFormat(smallScreen = false) {
- return this._portal.displayFormat(smallScreen);
+ return PortalUI.displayFormat(this._portal, smallScreen);
}
get latLng() {
@@ -72,7 +74,7 @@ export default class WasabeeAnchor {
marker.className = "wasabee-anchor-popup";
const content = L.DomUtil.create("div", null);
const title = L.DomUtil.create("div", "desc", content);
- title.appendChild(this._portal.displayFormat());
+ title.appendChild(PortalUI.displayFormat(this._portal));
const portalComment = L.DomUtil.create(
"div",
"wasabee-portal-comment",
diff --git a/src/code/model/link.js b/src/code/model/link.js
index 396c86cc8..09858983e 100644
--- a/src/code/model/link.js
+++ b/src/code/model/link.js
@@ -4,6 +4,8 @@ import wX from "../wX";
import AssignDialog from "../dialogs/assignDialog";
import { addToColorList } from "../skin";
+import PortalUI from "../ui/portal";
+
export default class WasabeeLink {
constructor(obj) {
this.ID = obj.ID ? obj.ID : generateId();
@@ -104,7 +106,10 @@ export default class WasabeeLink {
displayFormat(operation, smallScreen = false) {
const d = L.DomUtil.create("div", null);
d.appendChild(
- operation.getPortal(this.fromPortalId).displayFormat(smallScreen)
+ PortalUI.displayFormat(
+ operation.getPortal(this.fromPortalId),
+ smallScreen
+ )
);
const arrow = L.DomUtil.create("span", "wasabee-link-seperator", d);
arrow.style.color = this.getColor(operation);
@@ -123,7 +128,7 @@ export default class WasabeeLink {
});
d.appendChild(
- operation.getPortal(this.toPortalId).displayFormat(smallScreen)
+ PortalUI.displayFormat(operation.getPortal(this.toPortalId), smallScreen)
);
return d;
}
diff --git a/src/code/model/marker.js b/src/code/model/marker.js
index ddc88ae49..dad1c67da 100644
--- a/src/code/model/marker.js
+++ b/src/code/model/marker.js
@@ -9,6 +9,8 @@ import MarkerChangeDialog from "../dialogs/markerChangeDialog";
import StateDialog from "../dialogs/stateDialog";
import { getSelectedOperation } from "../selectedOp";
+import PortalUI from "../ui/portal";
+
const STATE_UNASSIGNED = "pending";
const STATE_ASSIGNED = "assigned";
const STATE_ACKNOWLEDGED = "acknowledged";
@@ -217,7 +219,7 @@ export default class WasabeeMarker {
const kind = L.DomUtil.create("span", "wasabee-marker-popup-kind", title);
L.DomUtil.addClass(kind, this.type);
kind.textContent = wX(this.type);
- title.appendChild(portal.displayFormat());
+ title.appendChild(PortalUI.displayFormat(portal));
kind.href = "#";
L.DomEvent.on(kind, "click", (ev) => {
diff --git a/src/code/model/portal.js b/src/code/model/portal.js
index 3323fb10f..9b90c712a 100644
--- a/src/code/model/portal.js
+++ b/src/code/model/portal.js
@@ -1,5 +1,4 @@
import { generateId } from "../auxiliar";
-import wX from "../wX";
export default class WasabeePortal {
constructor(obj) {
@@ -41,96 +40,10 @@ export default class WasabeePortal {
};
}
- // create a wasabee portal from a IITC portal (leaflet marker)
- static fromIITC(p) {
- // we have all the details
- if (p && p.options && p.options.data && p.options.guid) {
- const data = p.options.data;
- const id = p.options.guid;
- if (data.title) {
- return new WasabeePortal({
- id: id,
- name: data.title,
- lat: (data.latE6 / 1e6).toFixed(6),
- lng: (data.lngE6 / 1e6).toFixed(6),
- });
- }
- // do we have enough to fake it?
- if (data.latE6) {
- return WasabeePortal.fake(
- (data.latE6 / 1e6).toFixed(6),
- (data.lngE6 / 1e6).toFixed(6),
- id
- );
- }
- }
- // nothing to get
- return null;
- }
-
get latLng() {
return this._latLng;
}
- get team() {
- if (window.portals[this.id] && window.portals[this.id].options.data)
- return window.portals[this.id].options.data.team;
- return "";
- }
-
- get displayName() {
- if (this.pureFaked) return wX("FAKED", { portalId: this.id });
- if (this.loading) return wX("LOADING1", { portalGuid: this.id });
- return this.name;
- }
-
- displayFormat(shortName = false) {
- const pt = this.latLng;
- const v = `${this.lat},${this.lng}`;
- const name = this.displayName;
- const e = L.DomUtil.create("a", "wasabee-portal");
- if (shortName === true && this.name.length > 12) {
- e.textContent = name.slice(0, 8) + "...";
- } else {
- e.textContent = name;
- }
-
- const team = this.team;
- if (team == "E") {
- e.classList.add("enl");
- }
- if (team == "R") {
- e.classList.add("res");
- }
- if (team == "N") {
- e.classList.add("unclaimed");
- }
-
- // e.title = this.name;
- e.href = `/intel?ll=${v}&pll=${v}`;
-
- L.DomEvent.on(e, "click", (event) => {
- if (window.selectedPortal != this.id && this.id.length == 35)
- window.renderPortalDetails(this.id);
- else window.map.panTo(pt);
- event.preventDefault();
- return false;
- }).on(e, "dblclick", (event) => {
- if (window.selectedPortal != this.id && this.id.length == 35)
- window.renderPortalDetails(this.id);
- if (window.map.getBounds().contains(pt))
- window.zoomToAndShowPortal(this.id, pt);
- else window.map.panTo(pt);
- event.preventDefault();
- return false;
- });
- return e;
- }
-
- static get(id) {
- return WasabeePortal.fromIITC(window.portals[id]);
- }
-
static fake(lat, lng, id, name) {
console.assert(lat && lng, "WasabeePortal.fake called w/o lat/lng");
@@ -151,10 +64,4 @@ export default class WasabeePortal {
get pureFaked() {
return this.id.length != 35;
}
-
- static getSelected() {
- return window.selectedPortal
- ? WasabeePortal.get(window.selectedPortal)
- : null;
- }
}
diff --git a/src/code/ui/portal.js b/src/code/ui/portal.js
new file mode 100644
index 000000000..cff24df2d
--- /dev/null
+++ b/src/code/ui/portal.js
@@ -0,0 +1,99 @@
+import WasabeePortal from "../model/portal";
+import wX from "../wX";
+
+export default {
+ fromIITC,
+ displayName,
+ displayFormat,
+ get,
+ getSelected,
+};
+
+function fromIITC(p) {
+ // we have all the details
+ if (p && p.options && p.options.data && p.options.guid) {
+ const data = p.options.data;
+ const id = p.options.guid;
+ if (data.title) {
+ return new WasabeePortal({
+ id: id,
+ name: data.title,
+ lat: (data.latE6 / 1e6).toFixed(6),
+ lng: (data.lngE6 / 1e6).toFixed(6),
+ });
+ }
+ // do we have enough to fake it?
+ if (data.latE6) {
+ return WasabeePortal.fake(
+ (data.latE6 / 1e6).toFixed(6),
+ (data.lngE6 / 1e6).toFixed(6),
+ id
+ );
+ }
+ }
+ // nothing to get
+ return null;
+}
+
+function team(portal) {
+ if (window.portals[portal.id] && window.portals[portal.id].options.data)
+ return window.portals[portal.id].options.data.team;
+ return "";
+}
+
+function displayName(portal) {
+ if (portal.pureFaked) return wX("FAKED", { portalId: portal.id });
+ if (portal.loading) return wX("LOADING1", { portalGuid: portal.id });
+ return portal.name;
+}
+
+function displayFormat(portal, shortName = false) {
+ const pt = portal.latLng;
+ const v = `${portal.lat},${portal.lng}`;
+ const name = displayName(portal);
+ const e = L.DomUtil.create("a", "wasabee-portal");
+ if (shortName === true && portal.name.length > 12) {
+ e.textContent = name.slice(0, 8) + "...";
+ } else {
+ e.textContent = name;
+ }
+
+ const t = team(portal);
+ if (t == "E") {
+ e.classList.add("enl");
+ }
+ if (t == "R") {
+ e.classList.add("res");
+ }
+ if (t == "N") {
+ e.classList.add("unclaimed");
+ }
+
+ // e.title = this.name;
+ e.href = `/intel?ll=${v}&pll=${v}`;
+
+ L.DomEvent.on(e, "click", (event) => {
+ if (window.selectedPortal != portal.id && portal.id.length == 35)
+ window.renderPortalDetails(portal.id);
+ else window.map.panTo(pt);
+ event.preventDefault();
+ return false;
+ }).on(e, "dblclick", (event) => {
+ if (window.selectedPortal != portal.id && portal.id.length == 35)
+ window.renderPortalDetails(portal.id);
+ if (window.map.getBounds().contains(pt))
+ window.zoomToAndShowPortal(portal.id, pt);
+ else window.map.panTo(pt);
+ event.preventDefault();
+ return false;
+ });
+ return e;
+}
+
+function get(id) {
+ return fromIITC(window.portals[id]);
+}
+
+function getSelected() {
+ return window.selectedPortal ? get(window.selectedPortal) : null;
+}
diff --git a/src/code/uiCommands.js b/src/code/uiCommands.js
index 83f09781e..4cc081ce9 100644
--- a/src/code/uiCommands.js
+++ b/src/code/uiCommands.js
@@ -15,6 +15,8 @@ import {
duplicateOperation,
} from "./selectedOp";
+import PortalUI from "./ui/portal";
+
export function addPortal(operation, portal) {
if (!portal) {
alert(wX("SELECT PORTAL"));
@@ -24,7 +26,7 @@ export function addPortal(operation, portal) {
}
export function swapPortal(operation, portal) {
- const selectedPortal = WasabeePortal.getSelected();
+ const selectedPortal = PortalUI.getSelected();
if (!selectedPortal) {
alert(wX("SELECT PORTAL"));
return;
@@ -36,9 +38,9 @@ export function swapPortal(operation, portal) {
const pr = L.DomUtil.create("div", null);
pr.textContent = wX("SWAP PROMPT");
- pr.appendChild(portal.displayFormat());
+ pr.appendChild(PortalUI.displayFormat(portal));
L.DomUtil.create("span", null, pr).textContent = wX("SWAP WITH");
- pr.appendChild(selectedPortal.displayFormat());
+ pr.appendChild(PortalUI.displayFormat(selectedPortal));
L.DomUtil.create("span", null, pr).textContent = "?";
const con = new ConfirmDialog({
title: wX("SWAP TITLE"),
@@ -54,7 +56,7 @@ export function swapPortal(operation, portal) {
export function deletePortal(operation, portal) {
const pr = L.DomUtil.create("div", null);
pr.textContent = wX("DELETE ANCHOR PROMPT");
- pr.appendChild(portal.displayFormat());
+ pr.appendChild(PortalUI.displayFormat(portal));
const con = new ConfirmDialog({
title: wX("DELETE ANCHOR TITLE"),
label: pr,
@@ -70,7 +72,7 @@ export function deletePortal(operation, portal) {
export function deleteMarker(operation, marker, portal) {
const pr = L.DomUtil.create("div", null);
pr.textContent = wX("DELETE MARKER PROMPT");
- pr.appendChild(portal.displayFormat());
+ pr.appendChild(PortalUI.displayFormat(portal));
const con = new ConfirmDialog({
title: wX("DELETE MARKER TITLE"),
label: pr,
@@ -126,7 +128,7 @@ export function listenForAddedPortals(newPortal) {
if (!newPortal.portal.options.data.title) return;
const op = getSelectedOperation();
- op.updatePortal(WasabeePortal.fromIITC(newPortal.portal));
+ op.updatePortal(PortalUI.fromIITC(newPortal.portal));
}
export function listenForPortalDetails(e) {
@@ -240,7 +242,7 @@ export function getAllPortalsOnScreen(operation) {
)
)
continue;
- const wp = WasabeePortal.fromIITC(window.portals[portal]);
+ const wp = PortalUI.fromIITC(window.portals[portal]);
if (wp) x.push(wp);
}
}
@@ -354,7 +356,7 @@ export function blockerAutomark(operation, first = true) {
// get WasabeePortal for portalId
let wportal = operation.getPortal(portalId);
- if (!wportal) wportal = WasabeePortal.get(portalId);
+ if (!wportal) wportal = PortalUI.get(portalId);
if (!wportal) {
alert(wX("AUTOMARK STOP"));
return;
From 565ea571ca22adb31088844cfd256f0346535ddf Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:15:07 +0200
Subject: [PATCH 004/275] add LinkUI
---
src/code/dialogs/assignDialog.js | 5 +-
src/code/dialogs/checklist.js | 5 +-
src/code/dialogs/linkListDialog.js | 3 +-
src/code/dialogs/mergeDialog.js | 3 +-
src/code/dialogs/setCommentDialog.js | 4 +-
src/code/dialogs/stateDialog.js | 3 +-
src/code/mapDrawing.js | 4 +-
src/code/model/link.js | 119 +--------------------------
src/code/ui/link.js | 117 ++++++++++++++++++++++++++
9 files changed, 137 insertions(+), 126 deletions(-)
create mode 100644 src/code/ui/link.js
diff --git a/src/code/dialogs/assignDialog.js b/src/code/dialogs/assignDialog.js
index d14bddefb..6fd8bc2d8 100644
--- a/src/code/dialogs/assignDialog.js
+++ b/src/code/dialogs/assignDialog.js
@@ -8,6 +8,7 @@ import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
import PortalUI from "../ui/portal";
+import LinkUI from "../ui/link";
const AssignDialog = WDialog.extend({
statics: {
@@ -58,7 +59,9 @@ const AssignDialog = WDialog.extend({
this._name = wX("ASSIGN LINK PROMPT", {
portalName: PortalUI.displayName(portal),
});
- divtitle.appendChild(target.displayFormat(operation, this._smallScreen));
+ divtitle.appendChild(
+ LinkUI.displayFormat(target, operation, this._smallScreen)
+ );
const t = L.DomUtil.create("label", null);
t.textContent = wX("LINK ASSIGNMENT");
menu.prepend(t);
diff --git a/src/code/dialogs/checklist.js b/src/code/dialogs/checklist.js
index 6d4403a3f..abb5dde1d 100644
--- a/src/code/dialogs/checklist.js
+++ b/src/code/dialogs/checklist.js
@@ -18,6 +18,7 @@ import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
import PortalUI from "../ui/portal";
+import LinkUI from "../ui/link";
const OperationChecklistDialog = WDialog.extend({
statics: {
@@ -129,7 +130,7 @@ const OperationChecklistDialog = WDialog.extend({
sort: (a, b) => a.localeCompare(b),
format: (cell, value, thing) => {
if (thing instanceof WasabeeLink) {
- cell.appendChild(thing.displayFormat(operation));
+ cell.appendChild(LinkUI.displayFormat(thing, operation));
if (this._smallScreen) cell.colSpan = 2;
} else {
cell.appendChild(
@@ -362,7 +363,7 @@ const OperationChecklistDialog = WDialog.extend({
for (const [link, c] of emptyFieldLinks) {
const li = L.DomUtil.create("li", "empty-field-link", content);
li.textContent = c;
- li.appendChild(link.displayFormat(operation));
+ li.appendChild(LinkUI.displayFormat(link, operation));
}
alert(container, true);
} else {
diff --git a/src/code/dialogs/linkListDialog.js b/src/code/dialogs/linkListDialog.js
index 9563836e7..8d384d2de 100644
--- a/src/code/dialogs/linkListDialog.js
+++ b/src/code/dialogs/linkListDialog.js
@@ -4,6 +4,7 @@ import { loadFaked } from "../uiCommands";
import { getSelectedOperation } from "../selectedOp";
import PortalUI from "../ui/portal";
+import LinkUI from "../ui/link";
const LinkListDialog = OperationChecklistDialog.extend({
statics: {
@@ -36,7 +37,7 @@ const LinkListDialog = OperationChecklistDialog.extend({
title: wX("MIN_SRC_PORT_LVL"),
value: (link) => link.length(operation),
format: (cell, data, link) => {
- cell.appendChild(link.minLevel(operation));
+ cell.appendChild(LinkUI.minLevel(link, operation));
},
smallScreenHide: true,
},
diff --git a/src/code/dialogs/mergeDialog.js b/src/code/dialogs/mergeDialog.js
index 1e4dfbaa5..fe619e7a9 100644
--- a/src/code/dialogs/mergeDialog.js
+++ b/src/code/dialogs/mergeDialog.js
@@ -7,6 +7,7 @@ import { getSelectedOperation, makeSelectedOperation } from "../selectedOp";
import { drawBackgroundOp } from "../mapDrawing";
import PortalUI from "../ui/portal";
+import LinkUI from "../ui/link";
const MergeDialog = WDialog.extend({
statics: {
@@ -231,7 +232,7 @@ const MergeDialog = WDialog.extend({
format: async (cell, value, e) => {
const op = e.type === "-" ? origin : operation;
if (e.data.type === "link") {
- cell.appendChild(e.data.link.displayFormat(op));
+ cell.appendChild(LinkUI.displayFormat(e.data.link, op));
} else if (e.data.type === "portal") {
cell.appendChild(PortalUI.displayFormat(e.data.portal));
} else if (e.data.type === "marker") {
diff --git a/src/code/dialogs/setCommentDialog.js b/src/code/dialogs/setCommentDialog.js
index af138ddee..35e892b79 100644
--- a/src/code/dialogs/setCommentDialog.js
+++ b/src/code/dialogs/setCommentDialog.js
@@ -5,6 +5,7 @@ import WasabeeMarker from "../model/marker";
import wX from "../wX";
import PortalUI from "../ui/portal";
+import LinkUI from "../ui/link";
export const SetCommentDialog = WDialog.extend({
statics: {
@@ -83,7 +84,8 @@ export const SetCommentDialog = WDialog.extend({
if (this.commentType == "link") {
desc.textContent = wX("SET_LINK_COMMENT");
desc.appendChild(
- this.options.target.displayFormat(
+ LinkUI.displayFormat(
+ this.options.target,
this.options.operation,
this._smallScreen
)
diff --git a/src/code/dialogs/stateDialog.js b/src/code/dialogs/stateDialog.js
index 07f50be74..767cbf59f 100644
--- a/src/code/dialogs/stateDialog.js
+++ b/src/code/dialogs/stateDialog.js
@@ -5,6 +5,7 @@ import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
import PortalUI from "../ui/portal";
+import LinkUI from "../ui/link";
const StateDialog = WDialog.extend({
statics: {
@@ -59,7 +60,7 @@ const StateDialog = WDialog.extend({
this._type = "Link";
this._name = wX("LINK STATE PROMPT", portal.name);
divtitle.appendChild(
- this.options.target.displayFormat(operation, this._smallScreen)
+ LinkUI.displayFormat(this.options.target, operation, this._smallScreen)
);
const t = L.DomUtil.create("label", null);
t.textContent = wX("LINK STATE");
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index 5966ca0f3..c24e294d7 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -6,6 +6,8 @@ import WasabeeOp from "./model/operation";
import { newColors } from "./auxiliar";
import { getSelectedOperation, opsList } from "./selectedOp";
+import LinkUI from "./ui/link";
+
const Wasabee = window.plugin.wasabee;
// draws all anchors, markers, and links
@@ -201,7 +203,7 @@ function addLink(wlink, operation) {
L.DomEvent.stop(ev);
if (ev.target._popup._wrapper)
ev.target._popup._wrapper.classList.add("wasabee-popup");
- const div = wlink.getPopup(operation);
+ const div = LinkUI.getPopup(wlink, operation);
ev.target.setPopupContent(div);
ev.target.openPopup(ev.latlng);
return true;
diff --git a/src/code/model/link.js b/src/code/model/link.js
index 09858983e..3d2e86e7b 100644
--- a/src/code/model/link.js
+++ b/src/code/model/link.js
@@ -1,10 +1,5 @@
-import { generateId, convertColorToHex, newColors } from "../auxiliar";
+import { generateId, newColors } from "../auxiliar";
import { getSelectedOperation } from "../selectedOp";
-import wX from "../wX";
-import AssignDialog from "../dialogs/assignDialog";
-import { addToColorList } from "../skin";
-
-import PortalUI from "../ui/portal";
export default class WasabeeLink {
constructor(obj) {
@@ -101,52 +96,16 @@ export default class WasabeeLink {
return this.getLatLngs(getSelectedOperation());
}
- // returns a DOM object appropriate for display
- // do we still need the operation here?
- displayFormat(operation, smallScreen = false) {
- const d = L.DomUtil.create("div", null);
- d.appendChild(
- PortalUI.displayFormat(
- operation.getPortal(this.fromPortalId),
- smallScreen
- )
- );
- const arrow = L.DomUtil.create("span", "wasabee-link-seperator", d);
- arrow.style.color = this.getColor(operation);
- const picker = L.DomUtil.create("input", "hidden-color-picker", arrow);
- picker.type = "color";
- picker.value = convertColorToHex(this.getColor(operation));
- picker.setAttribute("list", "wasabee-colors-datalist");
- picker.disabled = !operation.canWrite();
-
- L.DomEvent.on(arrow, "click", () => {
- picker.click();
- });
-
- L.DomEvent.on(picker, "change", (ev) => {
- this.setColor(ev.target.value, operation);
- });
-
- d.appendChild(
- PortalUI.displayFormat(operation.getPortal(this.toPortalId), smallScreen)
- );
- return d;
- }
-
setColor(color, operation) {
this.color = color;
if (this.color == operation.color) this.color = "main";
operation.update();
- addToColorList(color);
}
getColor(operation) {
- // 0.17 -- use the old names internally no matter what we are sent
let color = this.color;
if (color == "main") color = operation.color;
color = newColors(color);
- if (window.plugin.wasabee.skin.layerTypes.has(color))
- color = window.plugin.wasabee.skin.layerTypes.get(color).color;
return color;
}
@@ -154,80 +113,4 @@ export default class WasabeeLink {
const latlngs = this.getLatLngs(operation);
return L.latLng(latlngs[0]).distanceTo(latlngs[1]);
}
-
- minLevel(operation) {
- const b = this.length(operation);
- let s = wX("UNKNOWN");
- const a = L.DomUtil.create("span", null);
-
- if (b > 6881280) {
- s = wX("IMPOSSIBLE");
- } else {
- if (b > 1966080) {
- s = wX("VRLA");
- a.title = wX("VRLA DESC");
- a.classList.add("help");
- } else {
- if (b > 655360) {
- s = wX("LA");
- a.title = wX("LA DESC");
- a.classList.add("help");
- } else {
- const d = Math.max(1, Math.ceil(8 * Math.pow(b / 160, 0.25)) / 8);
- const msd = 8 * (d - Math.floor(d));
- s = "L" + d;
- if (0 != msd) {
- if (!(1 & msd)) {
- s = s + "\u2007";
- }
- if (!(1 & msd || 2 & msd)) {
- s = s + "\u2007";
- }
- s =
- s +
- (" = L" +
- Math.floor(d) +
- "0\u215b\u00bc\u215c\u00bd\u215d\u00be\u215e".charAt(msd));
- }
- }
- }
- }
- a.textContent = s;
- return a;
- }
-
- getPopup(operation) {
- const div = L.DomUtil.create("div", null);
- L.DomUtil.create("div", null, div).appendChild(
- this.displayFormat(operation, true)
- );
- if (this.description)
- L.DomUtil.create("div", "enl", div).textContent = this.description;
- L.DomUtil.create("div", "enl", div).textContent = "# " + this.throwOrderPos;
- if (operation.canWrite()) {
- const del = L.DomUtil.create("button", null, div);
- del.textContent = wX("DELETE_LINK");
- L.DomEvent.on(del, "click", (ev) => {
- L.DomEvent.stop(ev);
- operation.removeLink(this.fromPortalId, this.toPortalId);
- });
- const rev = L.DomUtil.create("button", null, div);
- rev.textContent = wX("REVERSE");
- L.DomEvent.on(rev, "click", (ev) => {
- L.DomEvent.stop(ev);
- operation.reverseLink(this.fromPortalId, this.toPortalId);
- });
- }
-
- if (operation.canWriteServer()) {
- const assignButton = L.DomUtil.create("button", null, div);
- assignButton.textContent = wX("ASSIGN");
- L.DomEvent.on(assignButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ad = new AssignDialog({ target: this });
- ad.enable();
- });
- }
- return div;
- }
}
diff --git a/src/code/ui/link.js b/src/code/ui/link.js
new file mode 100644
index 000000000..ba88b566f
--- /dev/null
+++ b/src/code/ui/link.js
@@ -0,0 +1,117 @@
+import AssignDialog from "../dialogs/assignDialog";
+import { convertColorToHex } from "../auxiliar";
+import { addToColorList } from "../skin";
+import wX from "../wX";
+
+import PortalUI from "./portal";
+
+export default {
+ displayFormat,
+ minLevel,
+ getPopup,
+};
+
+// returns a DOM object appropriate for display
+// do we still need the operation here?
+function displayFormat(link, operation, smallScreen = false) {
+ const d = L.DomUtil.create("div", null);
+ d.appendChild(
+ PortalUI.displayFormat(operation.getPortal(link.fromPortalId), smallScreen)
+ );
+ const arrow = L.DomUtil.create("span", "wasabee-link-seperator", d);
+ arrow.style.color = link.getColor(operation);
+ const picker = L.DomUtil.create("input", "hidden-color-picker", arrow);
+ picker.type = "color";
+ picker.value = convertColorToHex(link.getColor(operation));
+ picker.setAttribute("list", "wasabee-colors-datalist");
+ picker.disabled = !operation.canWrite();
+
+ L.DomEvent.on(arrow, "click", () => {
+ picker.click();
+ });
+
+ L.DomEvent.on(picker, "change", (ev) => {
+ link.setColor(ev.target.value, operation);
+ addToColorList(ev.target.value);
+ });
+
+ d.appendChild(
+ PortalUI.displayFormat(operation.getPortal(link.toPortalId), smallScreen)
+ );
+ return d;
+}
+
+function minLevel(link, operation) {
+ const b = link.length(operation);
+ let s = wX("UNKNOWN");
+ const a = L.DomUtil.create("span", null);
+
+ if (b > 6881280) {
+ s = wX("IMPOSSIBLE");
+ } else {
+ if (b > 1966080) {
+ s = wX("VRLA");
+ a.title = wX("VRLA DESC");
+ a.classList.add("help");
+ } else {
+ if (b > 655360) {
+ s = wX("LA");
+ a.title = wX("LA DESC");
+ a.classList.add("help");
+ } else {
+ const d = Math.max(1, Math.ceil(8 * Math.pow(b / 160, 0.25)) / 8);
+ const msd = 8 * (d - Math.floor(d));
+ s = "L" + d;
+ if (0 != msd) {
+ if (!(1 & msd)) {
+ s = s + "\u2007";
+ }
+ if (!(1 & msd || 2 & msd)) {
+ s = s + "\u2007";
+ }
+ s =
+ s +
+ (" = L" +
+ Math.floor(d) +
+ "0\u215b\u00bc\u215c\u00bd\u215d\u00be\u215e".charAt(msd));
+ }
+ }
+ }
+ }
+ a.textContent = s;
+ return a;
+}
+
+function getPopup(link, operation) {
+ const div = L.DomUtil.create("div", null);
+ L.DomUtil.create("div", null, div).appendChild(
+ displayFormat(link, operation, true)
+ );
+ if (link.description)
+ L.DomUtil.create("div", "enl", div).textContent = link.description;
+ L.DomUtil.create("div", "enl", div).textContent = "# " + link.throwOrderPos;
+ const del = L.DomUtil.create("button", null, div);
+ if (operation.canWrite()) {
+ del.textContent = wX("DELETE_LINK");
+ L.DomEvent.on(del, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ operation.removeLink(link.fromPortalId, link.toPortalId);
+ });
+ const rev = L.DomUtil.create("button", null, div);
+ rev.textContent = wX("REVERSE");
+ L.DomEvent.on(rev, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ operation.reverseLink(link.fromPortalId, link.toPortalId);
+ });
+ }
+ if (operation.canWriteServer()) {
+ const assignButton = L.DomUtil.create("button", null, div);
+ assignButton.textContent = wX("ASSIGN");
+ L.DomEvent.on(assignButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const ad = new AssignDialog({ target: link });
+ ad.enable();
+ });
+ }
+ return div;
+}
From af34297c94f4d16be11f95f74ad060af1776d877 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:19:15 +0200
Subject: [PATCH 005/275] add anchor ui
---
src/code/mapDrawing.js | 3 +-
src/code/model/anchor.js | 156 ---------------------------------------
src/code/ui/anchor.js | 150 +++++++++++++++++++++++++++++++++++++
3 files changed, 152 insertions(+), 157 deletions(-)
create mode 100644 src/code/ui/anchor.js
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index c24e294d7..45968bd27 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -7,6 +7,7 @@ import { newColors } from "./auxiliar";
import { getSelectedOperation, opsList } from "./selectedOp";
import LinkUI from "./ui/link";
+import AnchorUI from "./ui/anchor";
const Wasabee = window.plugin.wasabee;
@@ -440,7 +441,7 @@ function addAnchorToMap(portalId, operation) {
(ev) => {
L.DomEvent.stop(ev);
if (marker.isPopupOpen && marker.isPopupOpen()) return;
- const content = anchor.popupContent(marker);
+ const content = AnchorUI.popupContent(anchor, marker);
marker.setPopupContent(content);
if (marker._popup._wrapper)
marker._popup._wrapper.classList.add("wasabee-popup");
diff --git a/src/code/model/anchor.js b/src/code/model/anchor.js
index b63740d00..732ba0e74 100644
--- a/src/code/model/anchor.js
+++ b/src/code/model/anchor.js
@@ -1,12 +1,4 @@
-import { swapPortal, deletePortal } from "../uiCommands";
import { getSelectedOperation } from "../selectedOp";
-import AssignDialog from "../dialogs/assignDialog";
-import SendTargetDialog from "../dialogs/sendTargetDialog";
-import SetCommentDialog from "../dialogs/setCommentDialog";
-import LinkListDialog from "../dialogs/linkListDialog";
-import wX from "../wX";
-
-import PortalUI from "../ui/portal";
// this class is for the popups, and for assign menu
export default class WasabeeAnchor {
@@ -52,155 +44,7 @@ export default class WasabeeAnchor {
return this._portal.name;
}
- displayFormat(smallScreen = false) {
- return PortalUI.displayFormat(this._portal, smallScreen);
- }
-
get latLng() {
return this._portal.latLng;
}
-
- popupContent(marker) {
- // just log for now, if we see it, then we can figure out what is really going on
- const operation = getSelectedOperation();
- const canWrite = operation.canWrite();
- if (operation == null) {
- console.log("null op for anchor?");
- }
- if (this._opID != operation.ID) {
- console.log("anchor opID != selected opID");
- }
-
- marker.className = "wasabee-anchor-popup";
- const content = L.DomUtil.create("div", null);
- const title = L.DomUtil.create("div", "desc", content);
- title.appendChild(PortalUI.displayFormat(this._portal));
- const portalComment = L.DomUtil.create(
- "div",
- "wasabee-portal-comment",
- content
- );
- const pcLink = L.DomUtil.create("a", null, portalComment);
- pcLink.textContent = this._portal.comment || wX("SET_PORTAL_COMMENT");
- if (canWrite) {
- pcLink.href = "#";
- L.DomEvent.on(pcLink, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: this._portal,
- operation: operation,
- });
- scd.enable();
- marker.closePopup();
- });
- }
- if (this._portal.hardness) {
- const portalHardness = L.DomUtil.create(
- "div",
- "wasabee-portal-hardness",
- content
- );
- const phLink = L.DomUtil.create("a", null, portalHardness);
- phLink.textContent = this._portal.hardness;
- if (canWrite) {
- phLink.href = "#";
- L.DomEvent.on(phLink, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: this._portal,
- operation: operation,
- });
- scd.enable();
- marker.closePopup();
- });
- }
- }
-
- const requiredKeys = L.DomUtil.create("div", "desc", content);
- const onHand = operation.KeysOnHandForPortal(this._portal.id);
- const required = operation.KeysRequiredForPortal(this._portal.id);
- requiredKeys.textContent = "Keys: " + onHand + " / " + required;
-
- const buttonSet = L.DomUtil.create(
- "div",
- "wasabee-marker-buttonset",
- content
- );
- const linksButton = L.DomUtil.create("button", null, buttonSet);
- linksButton.textContent = wX("LINKS");
- L.DomEvent.on(linksButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const lld = new LinkListDialog({ portal: this._portal });
- lld.enable();
- marker.closePopup();
- });
- if (canWrite) {
- const swapButton = L.DomUtil.create("button", null, buttonSet);
- swapButton.textContent = wX("SWAP");
- L.DomEvent.on(swapButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- swapPortal(operation, this._portal);
- marker.closePopup();
- });
- const deleteButton = L.DomUtil.create("button", null, buttonSet);
- deleteButton.textContent = wX("DELETE_ANCHOR");
- L.DomEvent.on(deleteButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- deletePortal(operation, this._portal);
- marker.closePopup();
- });
- }
-
- const gmapButton = L.DomUtil.create("button", null, buttonSet);
- gmapButton.textContent = wX("ANCHOR_GMAP");
- L.DomEvent.on(gmapButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- marker.closePopup();
- // use intent on android
- if (
- typeof window.android !== "undefined" &&
- window.android &&
- window.android.intentPosLink
- ) {
- window.android.intentPosLink(
- +this._portal.lat,
- +this._portal.lng,
- window.map.getZoom(),
- this.name,
- true
- );
- } else {
- window.open(
- "https://www.google.com/maps/search/?api=1&query=" +
- this._portal.lat +
- "," +
- this._portal.lng
- );
- }
- });
-
- if (operation.canWriteServer()) {
- const assignButton = L.DomUtil.create("button", null, buttonSet);
- assignButton.textContent = wX("ASSIGN OUTBOUND");
- L.DomEvent.on(assignButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ad = new AssignDialog({ target: this });
- ad.enable();
- marker.closePopup();
- });
- }
-
- if (operation.isOnCurrentServer()) {
- const sendButton = L.DomUtil.create("button", null, buttonSet);
- sendButton.textContent = wX("SEND TARGET");
- L.DomEvent.on(sendButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const std = new SendTargetDialog({ target: this });
- std.enable();
- marker.closePopup();
- });
- }
-
- return content;
- }
}
diff --git a/src/code/ui/anchor.js b/src/code/ui/anchor.js
new file mode 100644
index 000000000..52273f146
--- /dev/null
+++ b/src/code/ui/anchor.js
@@ -0,0 +1,150 @@
+import AssignDialog from "../dialogs/assignDialog";
+import SendTargetDialog from "../dialogs/sendTargetDialog";
+import SetCommentDialog from "../dialogs/setCommentDialog";
+import LinkListDialog from "../dialogs/linkListDialog";
+import { getSelectedOperation } from "../selectedOp";
+import { swapPortal, deletePortal } from "../uiCommands";
+import wX from "../wX";
+
+import PortalUI from "./portal";
+
+export default {
+ popupContent,
+};
+
+function popupContent(anchor, leafletMarker) {
+ const operation = getSelectedOperation();
+ const canWrite = operation.canWrite();
+ const portal = operation.getPortal(anchor.ID);
+
+ leafletMarker.className = "wasabee-anchor-popup";
+ const content = L.DomUtil.create("div", null);
+ const title = L.DomUtil.create("div", "desc", content);
+ title.appendChild(PortalUI.displayFormat(portal));
+ const portalComment = L.DomUtil.create(
+ "div",
+ "wasabee-portal-comment",
+ content
+ );
+ const pcLink = L.DomUtil.create("a", null, portalComment);
+ pcLink.textContent = portal.comment || wX("SET_PORTAL_COMMENT");
+ if (canWrite) {
+ pcLink.href = "#";
+ L.DomEvent.on(pcLink, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const scd = new SetCommentDialog({
+ target: portal,
+ operation: operation,
+ });
+ scd.enable();
+ leafletMarker.closePopup();
+ });
+ }
+ if (portal.hardness) {
+ const portalHardness = L.DomUtil.create(
+ "div",
+ "wasabee-portal-hardness",
+ content
+ );
+ const phLink = L.DomUtil.create("a", null, portalHardness);
+ phLink.textContent = portal.hardness;
+ if (canWrite) {
+ phLink.href = "#";
+ L.DomEvent.on(phLink, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const scd = new SetCommentDialog({
+ target: portal,
+ operation: operation,
+ });
+ scd.enable();
+ leafletMarker.closePopup();
+ });
+ }
+ }
+
+ const requiredKeys = L.DomUtil.create("div", "desc", content);
+ const onHand = operation.KeysOnHandForPortal(portal.id);
+ const required = operation.KeysRequiredForPortal(portal.id);
+ requiredKeys.textContent = "Keys: " + onHand + " / " + required;
+
+ const buttonSet = L.DomUtil.create(
+ "div",
+ "wasabee-marker-buttonset",
+ content
+ );
+ const linksButton = L.DomUtil.create("button", null, buttonSet);
+ linksButton.textContent = wX("LINKS");
+ L.DomEvent.on(linksButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const lld = new LinkListDialog({ portal: portal });
+ lld.enable();
+ leafletMarker.closePopup();
+ });
+ if (canWrite) {
+ const swapButton = L.DomUtil.create("button", null, buttonSet);
+ swapButton.textContent = wX("SWAP");
+ L.DomEvent.on(swapButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ swapPortal(operation, portal);
+ leafletMarker.closePopup();
+ });
+ const deleteButton = L.DomUtil.create("button", null, buttonSet);
+ deleteButton.textContent = wX("DELETE_ANCHOR");
+ L.DomEvent.on(deleteButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ deletePortal(operation, portal);
+ leafletMarker.closePopup();
+ });
+ }
+ const gmapButton = L.DomUtil.create("button", null, buttonSet);
+ gmapButton.textContent = wX("ANCHOR_GMAP");
+ L.DomEvent.on(gmapButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ leafletMarker.closePopup();
+ // use intent on android
+ if (
+ typeof window.android !== "undefined" &&
+ window.android &&
+ window.android.intentPosLink
+ ) {
+ window.android.intentPosLink(
+ +portal.lat,
+ +portal.lng,
+ window.map.getZoom(),
+ portal.name,
+ true
+ );
+ } else {
+ window.open(
+ "https://www.google.com/maps/search/?api=1&query=" +
+ portal.lat +
+ "," +
+ portal.lng
+ );
+ }
+ });
+
+ if (operation.canWriteServer()) {
+ const assignButton = L.DomUtil.create("button", null, buttonSet);
+ assignButton.textContent = wX("ASSIGN OUTBOUND");
+ L.DomEvent.on(assignButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const ad = new AssignDialog({ target: portal });
+ ad.enable();
+ leafletMarker.closePopup();
+ });
+ }
+
+ if (operation.isOnCurrentServer()) {
+ const sendButton = L.DomUtil.create("button", null, buttonSet);
+ sendButton.textContent = wX("SEND TARGET");
+ L.DomEvent.on(sendButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const std = new SendTargetDialog({ target: portal });
+ std.enable();
+ leafletMarker.closePopup();
+ });
+ }
+
+ return content;
+}
From 558e9cf776c3917cd1c1768108342261c44195c6 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:27:49 +0200
Subject: [PATCH 006/275] add agent UI
---
src/code/dialogs/manageTeamDialog.js | 6 +-
src/code/dialogs/onlineAgentList.js | 4 +-
src/code/dialogs/opsDialog.js | 4 +-
src/code/dialogs/teamMembershipList.js | 6 +-
src/code/mapDrawing.js | 15 +-
src/code/model/agent.js | 195 +-----------------------
src/code/model/marker.js | 3 +-
src/code/ui/agent.js | 199 +++++++++++++++++++++++++
src/code/wd.js | 4 +-
9 files changed, 230 insertions(+), 206 deletions(-)
create mode 100644 src/code/ui/agent.js
diff --git a/src/code/dialogs/manageTeamDialog.js b/src/code/dialogs/manageTeamDialog.js
index 09175f1fd..23fa464a8 100644
--- a/src/code/dialogs/manageTeamDialog.js
+++ b/src/code/dialogs/manageTeamDialog.js
@@ -17,6 +17,8 @@ import PromptDialog from "./promptDialog";
import wX from "../wX";
import ConfirmDialog from "./confirmDialog";
+import AgentUI from "../ui/agent";
+
// The update method here is the best so far, bring all the others up to this one
const ManageTeamDialog = WDialog.extend({
statics: {
@@ -48,7 +50,9 @@ const ManageTeamDialog = WDialog.extend({
value: (agent) => agent.name,
sort: (a, b) => a.localeCompare(b),
format: async (cell, value, agent) =>
- cell.appendChild(await agent.formatDisplay(this.options.team.id)),
+ cell.appendChild(
+ await AgentUI.formatDisplay(agent, this.options.team.id)
+ ),
},
{
name: wX("TEAM STATE"),
diff --git a/src/code/dialogs/onlineAgentList.js b/src/code/dialogs/onlineAgentList.js
index 47166d1ed..a13469387 100644
--- a/src/code/dialogs/onlineAgentList.js
+++ b/src/code/dialogs/onlineAgentList.js
@@ -3,6 +3,8 @@ import Sortable from "../sortable";
import WasabeeAgent from "../model/agent";
import wX from "../wX";
+import AgentUI from "../ui/agent";
+
const OnlineAgentList = WDialog.extend({
statics: {
TYPE: "OnlineAgentList",
@@ -46,7 +48,7 @@ const OnlineAgentList = WDialog.extend({
value: (agent) => agent.name,
sort: (a, b) => a.localeCompare(b),
format: async (cell, value, agent) =>
- cell.appendChild(await agent.formatDisplay(0)),
+ cell.appendChild(await AgentUI.formatDisplay(agent)),
},
{
name: "Last Seen",
diff --git a/src/code/dialogs/opsDialog.js b/src/code/dialogs/opsDialog.js
index d00c4f53c..93136e810 100644
--- a/src/code/dialogs/opsDialog.js
+++ b/src/code/dialogs/opsDialog.js
@@ -17,6 +17,8 @@ import WasabeeAgent from "../model/agent";
import { syncOp, deleteLocalOp, zoomToOperation } from "../uiCommands";
import Sortable from "../sortable";
+import AgentUI from "../ui/agent";
+
const OpsDialog = WDialog.extend({
statics: {
TYPE: "opsDialog",
@@ -280,7 +282,7 @@ const OpsDialog = WDialog.extend({
if (sum.currentserver) {
const agent = await WasabeeAgent.get(tmpOp.creator);
sum.owner = agent.name;
- sum.ownerDisplay = await agent.formatDisplay();
+ sum.ownerDisplay = await AgentUI.formatDisplay(agent);
} else {
sum.owner = window.PLAYER.nickname;
}
diff --git a/src/code/dialogs/teamMembershipList.js b/src/code/dialogs/teamMembershipList.js
index e6723e0e3..a6df0068b 100644
--- a/src/code/dialogs/teamMembershipList.js
+++ b/src/code/dialogs/teamMembershipList.js
@@ -3,6 +3,8 @@ import Sortable from "../sortable";
import WasabeeTeam from "../model/team";
import wX from "../wX";
+import AgentUI from "../ui/agent";
+
const TeamMembershipList = WDialog.extend({
statics: {
TYPE: "teamMembershipList",
@@ -54,7 +56,9 @@ const TeamMembershipList = WDialog.extend({
value: (agent) => agent.name,
sort: (a, b) => a.localeCompare(b),
format: async (cell, value, agent) =>
- cell.appendChild(await agent.formatDisplay(this.options.teamID)),
+ cell.appendChild(
+ await AgentUI.formatDisplay(agent, this.options.teamID)
+ ),
},
{
name: wX("SQUAD"),
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index 45968bd27..08b5ff30b 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -8,6 +8,7 @@ import { getSelectedOperation, opsList } from "./selectedOp";
import LinkUI from "./ui/link";
import AnchorUI from "./ui/anchor";
+import AgentUI from "./ui/agent";
const Wasabee = window.plugin.wasabee;
@@ -296,10 +297,10 @@ function _drawAgent(agent, layerMap = agentLayerMap()) {
title: agent.name,
icon: L.divIcon({
className: "wasabee-agent-icon",
- iconSize: agent.iconSize(zoom),
- iconAnchor: agent.iconAnchor(zoom),
+ iconSize: AgentUI.iconSize(zoom),
+ iconAnchor: AgentUI.iconAnchor(zoom),
popupAnchor: L.point(0, -70),
- html: agent.icon(zoom),
+ html: AgentUI.icon(agent, zoom),
}),
id: agent.id,
zoom: zoom,
@@ -317,7 +318,7 @@ function _drawAgent(agent, layerMap = agentLayerMap()) {
L.DomEvent.stop(ev);
if (marker.isPopupOpen && marker.isPopupOpen()) return;
const a = await WasabeeAgent.get(agent.id);
- marker.setPopupContent(await a.getPopup());
+ marker.setPopupContent(await AgentUI.getPopup(a));
if (marker._popup._wrapper)
marker._popup._wrapper.classList.add("wasabee-popup");
marker.update();
@@ -344,10 +345,10 @@ function _drawAgent(agent, layerMap = agentLayerMap()) {
al.setIcon(
L.divIcon({
className: "wasabee-agent-icon",
- iconSize: agent.iconSize(zoom),
- iconAnchor: agent.iconAnchor(zoom),
+ iconSize: AgentUI.iconSize(zoom),
+ iconAnchor: AgentUI.iconAnchor(zoom),
popupAnchor: L.point(0, -70),
- html: agent.icon(zoom),
+ html: AgentUI.icon(agent, zoom),
})
);
al.options.zoom = zoom;
diff --git a/src/code/model/agent.js b/src/code/model/agent.js
index 245c52dbe..b85b24986 100644
--- a/src/code/model/agent.js
+++ b/src/code/model/agent.js
@@ -1,13 +1,7 @@
-import ConfirmDialog from "../dialogs/confirmDialog";
-import AgentDialog from "../dialogs/agentDialog";
-import { agentPromise, targetPromise, routePromise } from "../server";
-import { getSelectedOperation } from "../selectedOp";
-import wX from "../wX";
+import { agentPromise } from "../server";
import WasabeeMe from "./me";
import WasabeeTeam from "./team";
-import PortalUI from "../ui/portal";
-
export default class WasabeeAgent {
constructor(obj) {
if (typeof obj == "string") {
@@ -58,7 +52,7 @@ export default class WasabeeAgent {
this._updateCache();
}
- async _getDisplayName(teamID = 0) {
+ async getTeamName(teamID = 0) {
if (teamID == 0) return this.name;
const team = await WasabeeTeam.get(teamID);
@@ -156,189 +150,4 @@ export default class WasabeeAgent {
// console.debug("giving up");
return null;
}
-
- async formatDisplay(teamID = 0) {
- const display = L.DomUtil.create("a", "wasabee-agent-label");
- if (this.Vverified || this.rocks) {
- L.DomUtil.addClass(display, "enl");
- }
- if (this.blacklisted) {
- L.DomUtil.addClass(display, "res");
- }
- L.DomEvent.on(display, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ad = new AgentDialog({ gid: this.id });
- ad.enable();
- });
- display.textContent = await this._getDisplayName(teamID);
- return display;
- }
-
- async getPopup() {
- const content = L.DomUtil.create("div", "wasabee-agent-popup");
- const title = L.DomUtil.create("div", "desc", content);
- title.id = this.id;
- const fd = await this.formatDisplay(0);
- title.innerHTML = fd.outerHTML + this.timeSinceformat();
-
- const sendTarget = L.DomUtil.create("button", null, content);
- sendTarget.textContent = wX("SEND TARGET");
- L.DomEvent.on(sendTarget, "click", (ev) => {
- L.DomEvent.stop(ev);
- const selectedPortal = PortalUI.getSelected();
- if (!selectedPortal) {
- alert(wX("SELECT PORTAL"));
- return;
- }
-
- const d = new ConfirmDialog({
- title: wX("SEND TARGET"),
- label: wX("SEND TARGET CONFIRM", {
- portalName: PortalUI.displayName(selectedPortal),
- agent: this.name,
- }),
- type: "agent",
- callback: async () => {
- try {
- await targetPromise(this.id, selectedPortal);
- alert(wX("TARGET SENT"));
- } catch (e) {
- console.error(e);
- }
- },
- });
- d.enable();
- });
-
- // this needs wX
- const requestRoute = L.DomUtil.create("button", null, content);
- requestRoute.textContent = "Send Route to Target";
- requestRoute.style.display = "none"; // hide this until the server-side is ready
- L.DomEvent.on(requestRoute, "click", (ev) => {
- L.DomEvent.stop(ev);
- const selectedPortal = PortalUI.getSelected();
- if (!selectedPortal) {
- alert(wX("SELECT PORTAL"));
- return;
- }
-
- const d = new ConfirmDialog({
- title: "Send Route to Target",
- label: "Do you really want to request the route to be sent?",
- type: "agent",
- callback: async () => {
- try {
- await routePromise(this.id, selectedPortal);
- alert("Route Sent");
- } catch (e) {
- console.error(e);
- }
- },
- });
- d.enable();
- });
-
- const op = getSelectedOperation();
- const assignments = L.DomUtil.create("ul", "assignments", content);
- for (const m of op.markers) {
- if (m.assignedTo != this.id) continue;
- const a = L.DomUtil.create("li", "assignment", assignments);
- const portal = op.getPortal(m.portalId);
- a.textContent = `${m.order}: ${wX(m.type)} `;
- a.appendChild(PortalUI.displayFormat(portal));
- }
-
- return content;
- }
-
- timeSinceformat() {
- if (!this.date) return "";
- const date = Date.parse(this.date + " UTC");
- if (Number.isNaN(date)) return `(${this.date} UTC)`; // FireFox Date.parse no good
- if (date == 0) return "";
-
- const seconds = Math.floor((new Date() - date) / 1000);
- if (seconds < 0) return "";
- let interval = Math.floor(seconds / 31536000 / 2592000 / 86400);
-
- if (interval > 1) return wX("AGES");
- interval = Math.floor(seconds / 3600);
- if (interval > 1) return wX("HOURS", { hours: interval });
- interval = Math.floor(seconds / 60);
- if (interval > 1) return wX("MINUTES", { minutes: interval });
- interval = Math.floor(seconds);
- return wX("SECONDS", { seconds: interval });
- }
-
- // change this to return an L.Marker() to make the logic in mapDrawing simpler
- icon(z = 7) {
- if (z < 6) return this.globalIcon();
- if (z >= 6 && z < 9) return this.smallIcon();
- if (z >= 9 && z < 15) return this.mediumIcon();
- return this.bigIcon();
- }
-
- iconSize(z = 7) {
- if (z < 6) return [30, 30];
- if (z >= 6 && z < 9) return [36, 47];
- if (z >= 9 && z < 15) return [40, 52];
- return [46, 60];
- }
-
- iconAnchor(z = 7) {
- if (z < 6) return [15, 30];
- if (z >= 6 && z < 9) return [18, 47];
- if (z >= 9 && z < 15) return [20, 52];
- return [23, 60];
- }
-
- // XXX there has to be a way to apply the viewBox onto the paths, to get rid of that extra nonsense
- globalIcon() {
- const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
- icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
- icon.setAttribute("viewBox", "200 70 630 520");
- icon.setAttribute("height", "30");
- icon.setAttribute("width", "30");
- icon.setAttribute(
- "style",
- "fill-rule: evenodd; clip-rule: evenodd; stroke-miterlimit: 10;"
- );
- icon.innerHTML = ` `;
- return icon;
- }
-
- // XXX resize this properly
- smallIcon() {
- const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
- icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
- icon.setAttribute("viewBox", "0 0 52 68");
- icon.innerHTML = `
-
-
- `;
- return icon;
- }
-
- // XXX resize this properly
- mediumIcon() {
- const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
- icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
- icon.setAttribute("viewBox", "0 0 52 68");
- icon.innerHTML = `
-
-
- `;
- return icon;
- }
-
- bigIcon() {
- const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
- icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
- icon.setAttribute("viewBox", "0 0 52 68");
- icon.innerHTML = `
-
-
- `;
- return icon;
- }
}
diff --git a/src/code/model/marker.js b/src/code/model/marker.js
index dad1c67da..5f5a5e993 100644
--- a/src/code/model/marker.js
+++ b/src/code/model/marker.js
@@ -10,6 +10,7 @@ import StateDialog from "../dialogs/stateDialog";
import { getSelectedOperation } from "../selectedOp";
import PortalUI from "../ui/portal";
+import AgentUI from "../ui/agent";
const STATE_UNASSIGNED = "pending";
const STATE_ASSIGNED = "assigned";
@@ -118,7 +119,7 @@ export default class WasabeeMarker {
try {
const a = await WasabeeAgent.get(this.assignedTo);
assignment.textContent = wX("ASS_TO"); // FIXME convert formatDisplay to html and add as value to wX
- if (a) assignment.appendChild(await a.formatDisplay());
+ if (a) assignment.appendChild(await AgentUI.formatDisplay(a));
else assignment.textContent += " " + this.assignedTo;
} catch (err) {
console.error(err);
diff --git a/src/code/ui/agent.js b/src/code/ui/agent.js
new file mode 100644
index 000000000..6d107c31d
--- /dev/null
+++ b/src/code/ui/agent.js
@@ -0,0 +1,199 @@
+import PortalUI from "./portal";
+import ConfirmDialog from "../dialogs/confirmDialog";
+import AgentDialog from "../dialogs/agentDialog";
+import { targetPromise, routePromise } from "../server";
+import { getSelectedOperation } from "../selectedOp";
+import wX from "../wX";
+
+export default {
+ formatDisplay,
+ getPopup,
+ icon,
+ iconSize,
+ iconAnchor,
+};
+
+async function formatDisplay(agent, teamID = 0) {
+ const display = L.DomUtil.create("a", "wasabee-agent-label");
+ if (agent.Vverified || agent.rocks) {
+ L.DomUtil.addClass(display, "enl");
+ }
+ if (agent.blacklisted) {
+ L.DomUtil.addClass(display, "res");
+ }
+ L.DomEvent.on(display, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const ad = new AgentDialog({ gid: agent.id });
+ ad.enable();
+ });
+ display.textContent = await agent.getTeamName(teamID);
+ return display;
+}
+
+async function getPopup(agent) {
+ const content = L.DomUtil.create("div", "wasabee-agent-popup");
+ const title = L.DomUtil.create("div", "desc", content);
+ title.id = agent.id;
+ const fd = await formatDisplay(agent, 0);
+ title.innerHTML = fd.outerHTML + timeSinceformat(agent);
+
+ const sendTarget = L.DomUtil.create("button", null, content);
+ sendTarget.textContent = wX("SEND TARGET");
+ L.DomEvent.on(sendTarget, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const selectedPortal = PortalUI.getSelected();
+ if (!selectedPortal) {
+ alert(wX("SELECT PORTAL"));
+ return;
+ }
+
+ const d = new ConfirmDialog({
+ title: wX("SEND TARGET"),
+ label: wX("SEND TARGET CONFIRM", {
+ portalName: PortalUI.displayName(selectedPortal),
+ agent: agent.name,
+ }),
+ type: "agent",
+ callback: async () => {
+ try {
+ await targetPromise(agent.id, selectedPortal);
+ alert(wX("TARGET SENT"));
+ } catch (e) {
+ console.error(e);
+ }
+ },
+ });
+ d.enable();
+ });
+
+ // this needs wX
+ const requestRoute = L.DomUtil.create("button", null, content);
+ requestRoute.textContent = "Send Route to Target";
+ requestRoute.style.display = "none"; // hide this until the server-side is ready
+ L.DomEvent.on(requestRoute, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const selectedPortal = PortalUI.getSelected();
+ if (!selectedPortal) {
+ alert(wX("SELECT PORTAL"));
+ return;
+ }
+
+ const d = new ConfirmDialog({
+ title: "Send Route to Target",
+ label: "Do you really want to request the route to be sent?",
+ type: "agent",
+ callback: async () => {
+ try {
+ await routePromise(agent.id, selectedPortal);
+ alert("Route Sent");
+ } catch (e) {
+ console.error(e);
+ }
+ },
+ });
+ d.enable();
+ });
+
+ const op = getSelectedOperation();
+ const assignments = L.DomUtil.create("ul", "assignments", content);
+ for (const m of op.markers) {
+ if (m.assignedTo != agent.id) continue;
+ const a = L.DomUtil.create("li", "assignment", assignments);
+ const portal = op.getPortal(m.portalId);
+ a.textContent = `${m.order}: ${wX(m.type)} `;
+ a.appendChild(PortalUI.displayFormat(portal));
+ }
+
+ return content;
+}
+
+function timeSinceformat(agent) {
+ if (!agent.date) return "";
+ const date = Date.parse(agent.date + " UTC");
+ if (Number.isNaN(date)) return `(${agent.date} UTC)`; // FireFox Date.parse no good
+ if (date == 0) return "";
+
+ const seconds = Math.floor((new Date() - date) / 1000);
+ if (seconds < 0) return "";
+ let interval = Math.floor(seconds / 31536000 / 2592000 / 86400);
+
+ if (interval > 1) return wX("AGES");
+ interval = Math.floor(seconds / 3600);
+ if (interval > 1) return wX("HOURS", { hours: interval });
+ interval = Math.floor(seconds / 60);
+ if (interval > 1) return wX("MINUTES", { minutes: interval });
+ interval = Math.floor(seconds);
+ return wX("SECONDS", { seconds: interval });
+}
+
+// change this to return an L.Marker() to make the logic in mapDrawing simpler
+function icon(agent, z = 7) {
+ if (z < 6) return globalIcon();
+ if (z >= 6 && z < 9) return smallIcon(agent);
+ if (z >= 9 && z < 15) return mediumIcon(agent);
+ return bigIcon(agent);
+}
+
+function iconSize(z = 7) {
+ if (z < 6) return [30, 30];
+ if (z >= 6 && z < 9) return [36, 47];
+ if (z >= 9 && z < 15) return [40, 52];
+ return [46, 60];
+}
+
+function iconAnchor(z = 7) {
+ if (z < 6) return [15, 30];
+ if (z >= 6 && z < 9) return [18, 47];
+ if (z >= 9 && z < 15) return [20, 52];
+ return [23, 60];
+}
+
+// XXX there has to be a way to apply the viewBox onto the paths, to get rid of that extra nonsense
+function globalIcon() {
+ const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
+ icon.setAttribute("viewBox", "200 70 630 520");
+ icon.setAttribute("height", "30");
+ icon.setAttribute("width", "30");
+ icon.setAttribute(
+ "style",
+ "fill-rule: evenodd; clip-rule: evenodd; stroke-miterlimit: 10;"
+ );
+ icon.innerHTML = ` `;
+ return icon;
+}
+
+// XXX resize this properly
+function smallIcon(agent) {
+ const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
+ icon.setAttribute("viewBox", "0 0 52 68");
+ icon.innerHTML = `
+
+
+ `;
+ return icon;
+}
+
+// XXX resize this properly
+function mediumIcon(agent) {
+ const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
+ icon.setAttribute("viewBox", "0 0 52 68");
+ icon.innerHTML = `
+
+
+ `;
+ return icon;
+}
+
+function bigIcon(agent) {
+ const icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ icon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
+ icon.setAttribute("viewBox", "0 0 52 68");
+ icon.innerHTML = `
+
+
+ `;
+ return icon;
+}
diff --git a/src/code/wd.js b/src/code/wd.js
index 35f9ba25c..902e9cf99 100644
--- a/src/code/wd.js
+++ b/src/code/wd.js
@@ -4,6 +4,8 @@ import WasabeeAgent from "./model/agent";
import wX from "./wX";
// import { getPortalDetails } from "./uiCommands";
+import AgentUI from "./ui/agent";
+
// setup function
export function initWasabeeD() {
window.plugin.wasabee.defensiveLayers = new L.LayerGroup();
@@ -153,7 +155,7 @@ async function getMarkerPopup(PortalID) {
const a = await WasabeeAgent.get(dk.GID);
const li = L.DomUtil.create("li", null, ul);
if (a) {
- li.appendChild(await a.formatDisplay());
+ li.appendChild(await AgentUI.formatDisplay(a));
} else {
const fake = L.DomUtil.create("span", null, li);
fake.textContent = wX("LOADING");
From b0ab7057ea4a85aea846ade3fb220241293a5b73 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:31:02 +0200
Subject: [PATCH 007/275] add markerUI
---
src/code/mapDrawing.js | 3 +-
src/code/model/marker.js | 198 --------------------------------------
src/code/ui/marker.js | 201 +++++++++++++++++++++++++++++++++++++++
3 files changed, 203 insertions(+), 199 deletions(-)
create mode 100644 src/code/ui/marker.js
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index 08b5ff30b..a47fa49f5 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -9,6 +9,7 @@ import { getSelectedOperation, opsList } from "./selectedOp";
import LinkUI from "./ui/link";
import AnchorUI from "./ui/anchor";
import AgentUI from "./ui/agent";
+import MarkerUI from "./ui/marker";
const Wasabee = window.plugin.wasabee;
@@ -89,7 +90,7 @@ function addMarker(target, operation) {
if (this.isPopupOpen()) return;
const sop = getSelectedOperation();
const target = sop.getMarker(this.options.id);
- const c = await target.popupContent(this);
+ const c = await MarkerUI.popupContent(target, this);
this.setPopupContent(c);
this._popup._wrapper.classList.add("wasabee-popup");
this.update();
diff --git a/src/code/model/marker.js b/src/code/model/marker.js
index 5f5a5e993..258e62183 100644
--- a/src/code/model/marker.js
+++ b/src/code/model/marker.js
@@ -1,16 +1,4 @@
import { generateId } from "../auxiliar";
-import { deleteMarker } from "../uiCommands";
-import WasabeeAgent from "./agent";
-import AssignDialog from "../dialogs/assignDialog";
-import SendTargetDialog from "../dialogs/sendTargetDialog";
-import wX from "../wX";
-import SetCommentDialog from "../dialogs/setCommentDialog";
-import MarkerChangeDialog from "../dialogs/markerChangeDialog";
-import StateDialog from "../dialogs/stateDialog";
-import { getSelectedOperation } from "../selectedOp";
-
-import PortalUI from "../ui/portal";
-import AgentUI from "../ui/agent";
const STATE_UNASSIGNED = "pending";
const STATE_ASSIGNED = "assigned";
@@ -95,190 +83,4 @@ export default class WasabeeMarker {
get state() {
return this._state;
}
-
- async popupContent(marker, operation) {
- if (!operation) operation = getSelectedOperation();
- const canWrite = operation.canWrite();
-
- const portal = operation.getPortal(this.portalId);
- if (portal == null) {
- console.log("null portal getting marker popup");
- return (L.DomUtil.create("div", "wasabee-marker-popup").textContent =
- "invalid portal");
- }
-
- const content = L.DomUtil.create("div", "wasabee-marker-popup");
- content.appendChild(this._getPopupBodyWithType(portal, operation, marker));
-
- const assignment = L.DomUtil.create(
- "div",
- "wasabee-popup-assignment",
- content
- );
- if (this.state != "completed" && this.assignedTo) {
- try {
- const a = await WasabeeAgent.get(this.assignedTo);
- assignment.textContent = wX("ASS_TO"); // FIXME convert formatDisplay to html and add as value to wX
- if (a) assignment.appendChild(await AgentUI.formatDisplay(a));
- else assignment.textContent += " " + this.assignedTo;
- } catch (err) {
- console.error(err);
- }
- }
- if (this.state == "completed" && this.completedID) {
- try {
- const a = await WasabeeAgent.get(this.completedID);
- assignment.innerHTML = wX("COMPLETED BY", {
- agentName: a ? a.name : this.completedID,
- });
- } catch (e) {
- console.error(e);
- }
- }
-
- const buttonSet = L.DomUtil.create(
- "div",
- "wasabee-marker-buttonset",
- content
- );
- if (canWrite) {
- const deleteButton = L.DomUtil.create("button", null, buttonSet);
- deleteButton.textContent = wX("DELETE_ANCHOR");
- L.DomEvent.on(deleteButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- deleteMarker(operation, this, portal);
- marker.closePopup();
- });
- }
-
- if (operation.canWriteServer()) {
- const assignButton = L.DomUtil.create("button", null, buttonSet);
- assignButton.textContent = wX("ASSIGN");
- L.DomEvent.on(assignButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ad = new AssignDialog({ target: this });
- ad.enable();
- marker.closePopup();
- });
- }
-
- if (canWrite) {
- const stateButton = L.DomUtil.create("button", null, buttonSet);
- stateButton.textContent = wX("MARKER STATE");
- L.DomEvent.on(stateButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const sd = new StateDialog({ target: this, opID: operation.ID });
- sd.enable();
- marker.closePopup();
- });
- }
-
- if (operation.isOnCurrentServer()) {
- const sendTargetButton = L.DomUtil.create("button", null, buttonSet);
- sendTargetButton.textContent = wX("SEND TARGET");
- L.DomEvent.on(sendTargetButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const std = new SendTargetDialog({ target: this });
- std.enable();
- marker.closePopup();
- });
- }
-
- const gmapButton = L.DomUtil.create("button", null, buttonSet);
- gmapButton.textContent = wX("ANCHOR_GMAP");
- L.DomEvent.on(gmapButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- marker.closePopup();
- // use intent on android
- if (
- typeof window.android !== "undefined" &&
- window.android &&
- window.android.intentPosLink
- ) {
- window.android.intentPosLink(
- +portal.lat,
- +portal.lng,
- window.map.getZoom(),
- portal.name,
- true
- );
- } else {
- window.open(
- "https://www.google.com/maps/search/?api=1&query=" +
- portal.lat +
- "," +
- portal.lng
- );
- }
- });
-
- return content;
- }
-
- _getPopupBodyWithType(portal, operation, marker) {
- const title = L.DomUtil.create("div", "desc");
- const kind = L.DomUtil.create("span", "wasabee-marker-popup-kind", title);
- L.DomUtil.addClass(kind, this.type);
- kind.textContent = wX(this.type);
- title.appendChild(PortalUI.displayFormat(portal));
-
- kind.href = "#";
- L.DomEvent.on(kind, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ch = new MarkerChangeDialog({ marker: this });
- ch.enable();
- marker.closePopup();
- });
-
- if (this.comment) {
- const comment = L.DomUtil.create(
- "div",
- "wasabee-marker-popup-comment",
- title
- );
- comment.textContent = this.comment;
- L.DomEvent.on(comment, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: this,
- operation: operation,
- });
- scd.enable();
- marker.closePopup();
- });
- }
- const comment = L.DomUtil.create("div", "wasabee-portal-comment", title);
- const cl = L.DomUtil.create("a", null, comment);
- cl.textContent = portal.comment || wX("SET_PORTAL_COMMENT");
- cl.href = "#";
- L.DomEvent.on(cl, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: portal,
- operation: operation,
- });
- scd.enable();
- marker.closePopup();
- });
- if (portal.hardness) {
- const hardness = L.DomUtil.create(
- "div",
- "wasabee-portal-hardness",
- title
- );
- const hl = L.DomUtil.create("a", null, hardness);
- hl.textContent = portal.hardness;
- hl.href = "#";
- L.DomEvent.on(hl, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: portal,
- operation: operation,
- });
- scd.enable();
- marker.closePopup();
- });
- }
- return title;
- }
}
diff --git a/src/code/ui/marker.js b/src/code/ui/marker.js
new file mode 100644
index 000000000..0eabf58da
--- /dev/null
+++ b/src/code/ui/marker.js
@@ -0,0 +1,201 @@
+import WasabeeAgent from "../model/agent";
+
+import AssignDialog from "../dialogs/assignDialog";
+import SendTargetDialog from "../dialogs/sendTargetDialog";
+import SetCommentDialog from "../dialogs/setCommentDialog";
+import MarkerChangeDialog from "../dialogs/markerChangeDialog";
+import StateDialog from "../dialogs/stateDialog";
+import { getSelectedOperation } from "../selectedOp";
+import { deleteMarker } from "../uiCommands";
+
+import AgentUI from "./agent";
+import PortalUI from "./portal";
+
+import wX from "../wX";
+
+export default {
+ popupContent,
+};
+
+async function popupContent(marker, leafletMarker, operation) {
+ if (!operation) operation = getSelectedOperation();
+ const canWrite = operation.canWrite();
+
+ const portal = operation.getPortal(marker.portalId);
+ if (portal == null) {
+ console.log("null portal getting marker popup");
+ return (L.DomUtil.create("div", "wasabee-marker-popup").textContent =
+ "invalid portal");
+ }
+
+ const content = L.DomUtil.create("div", "wasabee-marker-popup");
+ content.appendChild(
+ getPopupBodyWithType(marker, portal, operation, leafletMarker)
+ );
+
+ const assignment = L.DomUtil.create(
+ "div",
+ "wasabee-popup-assignment",
+ content
+ );
+ if (marker.state != "completed" && marker.assignedTo) {
+ try {
+ const a = await WasabeeAgent.get(marker.assignedTo);
+ assignment.textContent = wX("ASS_TO"); // FIXME convert formatDisplay to html and add as value to wX
+ if (a) assignment.appendChild(await AgentUI.formatDisplay(a));
+ else assignment.textContent += " " + marker.assignedTo;
+ } catch (err) {
+ console.error(err);
+ }
+ }
+ if (marker.state == "completed" && marker.completedID) {
+ try {
+ const a = await WasabeeAgent.get(marker.completedID);
+ assignment.innerHTML = wX("COMPLETED BY", {
+ agentName: a ? a.name : marker.completedID,
+ });
+ } catch (e) {
+ console.error(e);
+ }
+ }
+
+ const buttonSet = L.DomUtil.create(
+ "div",
+ "wasabee-marker-buttonset",
+ content
+ );
+ if (canWrite) {
+ const deleteButton = L.DomUtil.create("button", null, buttonSet);
+ deleteButton.textContent = wX("DELETE_ANCHOR");
+ L.DomEvent.on(deleteButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ deleteMarker(operation, marker, portal);
+ leafletMarker.closePopup();
+ });
+ }
+ if (operation.canWriteServer()) {
+ const assignButton = L.DomUtil.create("button", null, buttonSet);
+ assignButton.textContent = wX("ASSIGN");
+ L.DomEvent.on(assignButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const ad = new AssignDialog({ target: marker });
+ ad.enable();
+ leafletMarker.closePopup();
+ });
+ }
+
+ if (canWrite) {
+ const stateButton = L.DomUtil.create("button", null, buttonSet);
+ stateButton.textContent = wX("MARKER STATE");
+ L.DomEvent.on(stateButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const sd = new StateDialog({ target: marker, opID: operation.ID });
+ sd.enable();
+ leafletMarker.closePopup();
+ });
+ }
+
+ if (operation.isOnCurrentServer()) {
+ const sendTargetButton = L.DomUtil.create("button", null, buttonSet);
+ sendTargetButton.textContent = wX("SEND TARGET");
+ L.DomEvent.on(sendTargetButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const std = new SendTargetDialog({ target: marker });
+ std.enable();
+ leafletMarker.closePopup();
+ });
+ }
+
+ const gmapButton = L.DomUtil.create("button", null, buttonSet);
+ gmapButton.textContent = wX("ANCHOR_GMAP");
+ L.DomEvent.on(gmapButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ leafletMarker.closePopup();
+ // use intent on android
+ if (
+ typeof window.android !== "undefined" &&
+ window.android &&
+ window.android.intentPosLink
+ ) {
+ window.android.intentPosLink(
+ +portal.lat,
+ +portal.lng,
+ window.map.getZoom(),
+ portal.name,
+ true
+ );
+ } else {
+ window.open(
+ "https://www.google.com/maps/search/?api=1&query=" +
+ portal.lat +
+ "," +
+ portal.lng
+ );
+ }
+ });
+
+ return content;
+}
+
+function getPopupBodyWithType(marker, portal, operation, leafletMarker) {
+ const title = L.DomUtil.create("div", "desc");
+ const kind = L.DomUtil.create("span", "wasabee-marker-popup-kind", title);
+ L.DomUtil.addClass(kind, marker.type);
+ kind.textContent = wX(marker.type);
+ title.appendChild(PortalUI.displayFormat(portal));
+
+ kind.href = "#";
+ L.DomEvent.on(kind, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const ch = new MarkerChangeDialog({ marker: marker });
+ ch.enable();
+ leafletMarker.closePopup();
+ });
+
+ if (marker.comment) {
+ const comment = L.DomUtil.create(
+ "div",
+ "wasabee-marker-popup-comment",
+ title
+ );
+ comment.textContent = marker.comment;
+ L.DomEvent.on(comment, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const scd = new SetCommentDialog({
+ target: marker,
+ operation: operation,
+ });
+ scd.enable();
+ leafletMarker.closePopup();
+ });
+ }
+ const comment = L.DomUtil.create("div", "wasabee-portal-comment", title);
+ const cl = L.DomUtil.create("a", null, comment);
+ cl.textContent = portal.comment || wX("SET_PORTAL_COMMENT");
+ cl.href = "#";
+ L.DomEvent.on(cl, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const scd = new SetCommentDialog({
+ target: portal,
+ operation: operation,
+ });
+ scd.enable();
+ leafletMarker.closePopup();
+ });
+ if (portal.hardness) {
+ const hardness = L.DomUtil.create("div", "wasabee-portal-hardness", title);
+ const hl = L.DomUtil.create("a", null, hardness);
+ hl.textContent = portal.hardness;
+ hl.href = "#";
+ L.DomEvent.on(hl, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const scd = new SetCommentDialog({
+ target: portal,
+ operation: operation,
+ });
+ scd.enable();
+ leafletMarker.closePopup();
+ });
+ }
+ return title;
+}
From 754e1a32af32d8cc1caccf6894548abfa8a5ec7a Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:43:52 +0200
Subject: [PATCH 008/275] add db.js
---
src/code/db.js | 38 ++++++++++++++++++++++++++++++++++
src/code/init.js | 41 ++-----------------------------------
src/code/model/agent.js | 9 ++++----
src/code/model/me.js | 3 ++-
src/code/model/operation.js | 9 ++++----
src/code/model/team.js | 5 +++--
6 files changed, 55 insertions(+), 50 deletions(-)
create mode 100644 src/code/db.js
diff --git a/src/code/db.js b/src/code/db.js
new file mode 100644
index 000000000..ede9a7200
--- /dev/null
+++ b/src/code/db.js
@@ -0,0 +1,38 @@
+import { openDB } from "idb";
+
+const version = 2;
+
+// XXX audit these to make sure all the various indexes are used
+const db = openDB("wasabee", version, {
+ upgrade(db, oldVersion, newVersion, tx) {
+ if (oldVersion < 1) {
+ const agents = db.createObjectStore("agents", { keyPath: "id" });
+ agents.createIndex("date", "date"); // last location change
+ agents.createIndex("fetched", "fetched"); // last pull from server
+ const teams = db.createObjectStore("teams", { keyPath: "id" });
+ teams.createIndex("fetched", "fetched"); // last pull from server
+
+ // do not set an implied key, explicitly set GID/PortalID on insert
+ // XXX we can do this with a keyPath https://stackoverflow.com/questions/33852508/how-to-create-an-indexeddb-composite-key
+ // const defensivekeys = db.createObjectStore("defensivekeys");
+ const defensivekeys = db.createObjectStore("defensivekeys", {
+ keyPath: ["GID", "PortalID"],
+ });
+ defensivekeys.createIndex("PortalID", "PortalID");
+ defensivekeys.createIndex("Count", "Count"); // To be used to remove 0-count entries
+ // defensivekeys.createIndex("pk", ["GID", "PortalID"], { unique: true });
+ }
+ if (oldVersion < 2) {
+ const ops = db.createObjectStore("operations", { keyPath: "ID" });
+ ops.createIndex("fetched", "fetched");
+ ops.createIndex("server", "server");
+ }
+ /* if (oldVersion < 3) {
+ const teams = tx.objectStore("teams");
+ teams.createIndex("_agents", "_agents[].id");
+ } */
+ console.debug(newVersion, tx);
+ },
+});
+
+export default db;
diff --git a/src/code/init.js b/src/code/init.js
index 3ead3d7e6..d3203d900 100644
--- a/src/code/init.js
+++ b/src/code/init.js
@@ -17,7 +17,7 @@ import { WPane } from "./leafletClasses";
import OperationChecklist from "./dialogs/checklist";
import WasabeeMe from "./model/me";
import WasabeeOp from "./model/operation";
-import { openDB } from "idb";
+import db from "./db";
import polyfill from "./polyfill";
const Wasabee = window.plugin.wasabee;
@@ -40,7 +40,7 @@ window.plugin.wasabee.init = async () => {
return;
}
- await initIdb();
+ Wasabee.idb = await db;
Wasabee._selectedOp = null; // the in-memory working op;
Wasabee._updateList = new Map();
Wasabee.portalDetailQueue = new Array();
@@ -241,40 +241,3 @@ function initGoogleAPI() {
script
);
}
-
-async function initIdb() {
- const version = 2;
-
- // XXX audit these to make sure all the various indexes are used
- Wasabee.idb = await openDB("wasabee", version, {
- upgrade(db, oldVersion, newVersion, tx) {
- if (oldVersion < 1) {
- const agents = db.createObjectStore("agents", { keyPath: "id" });
- agents.createIndex("date", "date"); // last location change
- agents.createIndex("fetched", "fetched"); // last pull from server
- const teams = db.createObjectStore("teams", { keyPath: "id" });
- teams.createIndex("fetched", "fetched"); // last pull from server
-
- // do not set an implied key, explicitly set GID/PortalID on insert
- // XXX we can do this with a keyPath https://stackoverflow.com/questions/33852508/how-to-create-an-indexeddb-composite-key
- // const defensivekeys = db.createObjectStore("defensivekeys");
- const defensivekeys = db.createObjectStore("defensivekeys", {
- keyPath: ["GID", "PortalID"],
- });
- defensivekeys.createIndex("PortalID", "PortalID");
- defensivekeys.createIndex("Count", "Count"); // To be used to remove 0-count entries
- // defensivekeys.createIndex("pk", ["GID", "PortalID"], { unique: true });
- }
- if (oldVersion < 2) {
- const ops = db.createObjectStore("operations", { keyPath: "ID" });
- ops.createIndex("fetched", "fetched");
- ops.createIndex("server", "server");
- }
- /* if (oldVersion < 3) {
- const teams = tx.objectStore("teams");
- teams.createIndex("_agents", "_agents[].id");
- } */
- console.debug(newVersion, tx);
- },
- });
-}
diff --git a/src/code/model/agent.js b/src/code/model/agent.js
index b85b24986..3d13ab083 100644
--- a/src/code/model/agent.js
+++ b/src/code/model/agent.js
@@ -1,6 +1,7 @@
import { agentPromise } from "../server";
import WasabeeMe from "./me";
import WasabeeTeam from "./team";
+import db from "../db";
export default class WasabeeAgent {
constructor(obj) {
@@ -67,14 +68,14 @@ export default class WasabeeAgent {
async _updateCache() {
// load anything currently cached
- const cached = await window.plugin.wasabee.idb.get("agents", this.id);
+ const cached = await (await db).get("agents", this.id);
// nothing already in the cache, just dump this in and call it good
// will contain the extras, but that's fine for now
if (cached == null) {
// console.debug("not cached, adding");
try {
- await window.plugin.wasabee.idb.put("agents", this);
+ await (await db).put("agents", this);
} catch (e) {
console.error(e);
}
@@ -114,7 +115,7 @@ export default class WasabeeAgent {
delete cached.state;
try {
- await window.plugin.wasabee.idb.put("agents", cached);
+ await (await db).put("agents", cached);
} catch (e) {
console.error(e);
}
@@ -127,7 +128,7 @@ export default class WasabeeAgent {
// hold agent data up to 24 hours by default -- don't bother the server if all we need to do is resolve GID -> name
static async get(gid, maxAgeSeconds = 86400) {
- const cached = await window.plugin.wasabee.idb.get("agents", gid);
+ const cached = await (await db).get("agents", gid);
if (cached && cached.fetched > Date.now() - 1000 * maxAgeSeconds) {
const a = new WasabeeAgent(cached);
a.cached = true;
diff --git a/src/code/model/me.js b/src/code/model/me.js
index af2c9455a..b40862c9b 100644
--- a/src/code/model/me.js
+++ b/src/code/model/me.js
@@ -1,4 +1,5 @@
import { mePromise } from "../server";
+import db from "../db";
const Wasabee = window.plugin.wasabee;
@@ -128,7 +129,7 @@ export default class WasabeeMe {
delete localStorage[Wasabee.static.constants.AGENT_INFO_KEY];
delete localStorage["sentToServer"]; // resend firebase token on login
- const tr = window.plugin.wasabee.idb.transaction(
+ const tr = (await db).transaction(
["agents", "teams", "defensivekeys"],
"readwrite"
);
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index dd8c19842..5ce4f0d8a 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -6,6 +6,7 @@ import WasabeeZone from "./zone";
import { generateId, newColors } from "../auxiliar";
import { GetWasabeeServer } from "../server";
import { getSelectedOperation } from "../selectedOp";
+import db from "../db";
import wX from "../wX";
@@ -66,7 +67,7 @@ export default class WasabeeOp {
static async load(opID) {
try {
- const raw = await window.plugin.wasabee.idb.get("operations", opID);
+ const raw = await (await db).get("operations", opID);
if (raw == null)
//throw new Error("invalid operation ID");
return null;
@@ -81,12 +82,12 @@ export default class WasabeeOp {
static async delete(opID) {
delete localStorage[opID]; // leave for now
- await window.plugin.wasabee.idb.delete("operations", opID);
+ await (await db).delete("operations", opID);
}
static async migrate(opID) {
// skip ones already completed
- const have = await window.plugin.wasabee.idb.get("operations", opID);
+ const have = await (await db).get("operations", opID);
if (have != null) {
delete localStorage[opID]; // active now
return;
@@ -128,7 +129,7 @@ export default class WasabeeOp {
// store to idb
try {
- await window.plugin.wasabee.idb.put("operations", json);
+ await (await db).put("operations", json);
} catch (e) {
console.error(e);
}
diff --git a/src/code/model/team.js b/src/code/model/team.js
index 980d276f9..b8c1b4e2b 100644
--- a/src/code/model/team.js
+++ b/src/code/model/team.js
@@ -1,6 +1,7 @@
import WasabeeAgent from "./agent";
import WasabeeMe from "./me";
import { teamPromise } from "../server";
+import db from "../db";
export default class WasabeeTeam {
constructor(data) {
@@ -41,7 +42,7 @@ export default class WasabeeTeam {
async _updateCache() {
try {
- await window.plugin.wasabee.idb.put("teams", this);
+ await (await db).put("teams", this);
} catch (e) {
console.error(e);
}
@@ -49,7 +50,7 @@ export default class WasabeeTeam {
// 60 seconds seems too short for the default here...
static async get(teamID, maxAgeSeconds = 60) {
- const cached = await window.plugin.wasabee.idb.get("teams", teamID);
+ const cached = await (await db).get("teams", teamID);
if (cached) {
const t = new WasabeeTeam(cached);
if (t.fetched > Date.now() - 1000 * maxAgeSeconds) {
From 0a404741f59106dea268a5751c93db4e105c1d40 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:48:00 +0200
Subject: [PATCH 009/275] remove plugin reference from model
---
src/code/model/me.js | 11 +++++------
src/code/model/operation.js | 14 +++++++-------
src/code/static.js | 2 ++
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/code/model/me.js b/src/code/model/me.js
index b40862c9b..15d028bd8 100644
--- a/src/code/model/me.js
+++ b/src/code/model/me.js
@@ -1,7 +1,7 @@
import { mePromise } from "../server";
import db from "../db";
-const Wasabee = window.plugin.wasabee;
+import { constants } from "../static";
export default class WasabeeMe {
constructor(data) {
@@ -54,16 +54,15 @@ export default class WasabeeMe {
}
store() {
- localStorage[Wasabee.static.constants.AGENT_INFO_KEY] =
- JSON.stringify(this);
+ localStorage[constants.AGENT_INFO_KEY] = JSON.stringify(this);
}
remove() {
- delete localStorage[Wasabee.static.constants.AGENT_INFO_KEY];
+ delete localStorage[constants.AGENT_INFO_KEY];
}
static localGet() {
- const lsme = localStorage[Wasabee.static.constants.AGENT_INFO_KEY];
+ const lsme = localStorage[constants.AGENT_INFO_KEY];
if (typeof lsme == "string") {
return new WasabeeMe(lsme); // do not store
}
@@ -126,7 +125,7 @@ export default class WasabeeMe {
}
static async purge() {
- delete localStorage[Wasabee.static.constants.AGENT_INFO_KEY];
+ delete localStorage[constants.AGENT_INFO_KEY];
delete localStorage["sentToServer"]; // resend firebase token on login
const tr = (await db).transaction(
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 5ce4f0d8a..a2fff26c3 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -8,9 +8,9 @@ import { GetWasabeeServer } from "../server";
import { getSelectedOperation } from "../selectedOp";
import db from "../db";
-import wX from "../wX";
+import { constants } from "../static";
-const Wasabee = window.plugin.wasabee;
+import wX from "../wX";
export default class WasabeeOp {
constructor(obj) {
@@ -29,7 +29,7 @@ export default class WasabeeOp {
this.anchors = obj.anchors ? obj.anchors : Array();
this.links = this.convertLinksToObjs(obj.links);
this.markers = this.convertMarkersToObjs(obj.markers);
- this.color = obj.color ? obj.color : Wasabee.skin.defaultOperationColor;
+ this.color = obj.color ? obj.color : "main";
this.color = newColors(this.color);
this.comment = obj.comment ? obj.comment : null;
this.teamlist = obj.teamlist ? obj.teamlist : Array();
@@ -237,7 +237,7 @@ export default class WasabeeOp {
getColor() {
if (this.color == null) {
- return Wasabee.skin.defaultOperationColor;
+ return "main";
} else {
return this.color;
}
@@ -810,9 +810,9 @@ export default class WasabeeOp {
// only need this for virus/destroy/decay -- this should be in the marker class
const destructMarkerTypes = [
- window.plugin.wasabee.static.constants.MARKER_TYPE_DECAY,
- window.plugin.wasabee.static.constants.MARKER_TYPE_DESTROY,
- window.plugin.wasabee.static.constants.MARKER_TYPE_VIRUS,
+ constants.MARKER_TYPE_DECAY,
+ constants.MARKER_TYPE_DESTROY,
+ constants.MARKER_TYPE_VIRUS,
];
if (destructMarkerTypes.includes(markerType)) {
// remove related blockers
diff --git a/src/code/static.js b/src/code/static.js
index f279431a6..729b77c66 100644
--- a/src/code/static.js
+++ b/src/code/static.js
@@ -206,3 +206,5 @@ W.static.layerTypes = new Map([
},
],
]);
+
+export const constants = W.static.constants;
From 46c684d8d5d4880723a3f197a6e5dbc06d8bd84c Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 14:54:30 +0200
Subject: [PATCH 010/275] remove wX from model
---
src/code/dialogs/markerAddDialog.js | 5 ++-
src/code/model/operation.js | 66 ++++++++++++++---------------
2 files changed, 34 insertions(+), 37 deletions(-)
diff --git a/src/code/dialogs/markerAddDialog.js b/src/code/dialogs/markerAddDialog.js
index e76e2efce..c775b3aff 100644
--- a/src/code/dialogs/markerAddDialog.js
+++ b/src/code/dialogs/markerAddDialog.js
@@ -148,8 +148,9 @@ const MarkerAddDialog = WDialog.extend({
};
// XXX remove comment from args in 0.20
- operation.addMarker(selectedType, PortalUI.getSelected(), options);
- await this.update();
+ if (operation.addMarker(selectedType, PortalUI.getSelected(), options))
+ await this.update();
+ else alert(wX("ALREADY_HAS_MARKER"));
localStorage[window.plugin.wasabee.static.constants.LAST_MARKER_KEY] =
selectedType;
},
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index a2fff26c3..937839a38 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -10,8 +10,6 @@ import db from "../db";
import { constants } from "../static";
-import wX from "../wX";
-
export default class WasabeeOp {
constructor(obj) {
if (typeof obj == "string") {
@@ -792,40 +790,38 @@ export default class WasabeeOp {
}
addMarker(markerType, portal, options) {
- if (!portal) return;
- if (this.containsMarker(portal, markerType)) {
- alert(wX("ALREADY_HAS_MARKER"));
- } else {
- // save a trip to update()
- this._addPortal(portal);
- const marker = new WasabeeMarker({
- type: markerType,
- portalId: portal.id,
- });
- if (options && options.comment) marker.comment = options.comment;
- if (options && options.zone) marker.zone = options.zone;
- if (options && options.assign && options.assign != 0)
- marker.assign(options.assign);
- this.markers.push(marker);
-
- // only need this for virus/destroy/decay -- this should be in the marker class
- const destructMarkerTypes = [
- constants.MARKER_TYPE_DECAY,
- constants.MARKER_TYPE_DESTROY,
- constants.MARKER_TYPE_VIRUS,
- ];
- if (destructMarkerTypes.includes(markerType)) {
- // remove related blockers
- this.blockers = this.blockers.filter(
- (b) => b.fromPortalId !== portal.id && b.toPortalId !== portal.id
- );
- }
-
- this.update(true);
- // run crosslink to update the layer
- // XXX: we don't need to check, only redraw, so we need something clever, probably in mapDraw or crosslink.js
- if (destructMarkerTypes.includes(markerType)) this.runCrosslinks();
+ if (!portal) return false;
+ if (this.containsMarker(portal, markerType)) return false;
+ // save a trip to update()
+ this._addPortal(portal);
+ const marker = new WasabeeMarker({
+ type: markerType,
+ portalId: portal.id,
+ });
+ if (options && options.comment) marker.comment = options.comment;
+ if (options && options.zone) marker.zone = options.zone;
+ if (options && options.assign && options.assign != 0)
+ marker.assign(options.assign);
+ this.markers.push(marker);
+
+ // only need this for virus/destroy/decay -- this should be in the marker class
+ const destructMarkerTypes = [
+ constants.MARKER_TYPE_DECAY,
+ constants.MARKER_TYPE_DESTROY,
+ constants.MARKER_TYPE_VIRUS,
+ ];
+ if (destructMarkerTypes.includes(markerType)) {
+ // remove related blockers
+ this.blockers = this.blockers.filter(
+ (b) => b.fromPortalId !== portal.id && b.toPortalId !== portal.id
+ );
}
+
+ this.update(true);
+ // run crosslink to update the layer
+ // XXX: we don't need to check, only redraw, so we need something clever, probably in mapDraw or crosslink.js
+ if (destructMarkerTypes.includes(markerType)) this.runCrosslinks();
+ return true;
}
assignMarker(id, gid) {
From 842c3b826ae78a54ae1c14180b3fa2dc2c813169 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 15:48:54 +0200
Subject: [PATCH 011/275] add Evented and remove window.map from model
---
src/code/model/evented.js | 51 +++++++++++++++++++++++++++++++++++++
src/code/model/operation.js | 26 ++++++++++---------
src/code/selectedOp.js | 6 +++++
3 files changed, 71 insertions(+), 12 deletions(-)
create mode 100644 src/code/model/evented.js
diff --git a/src/code/model/evented.js b/src/code/model/evented.js
new file mode 100644
index 000000000..aac98c209
--- /dev/null
+++ b/src/code/model/evented.js
@@ -0,0 +1,51 @@
+/*
+ light es6 version of L.Evented
+ current design to fail safe is:
+ - events array is increaing only, removed listeners are replaced by a null function
+ - loop are prevented by removing listeners during its call
+ - try/catch
+*/
+
+function doNothing() {}
+
+export default class Evented {
+ constructor() {
+ this._events = {};
+ }
+
+ on(event, func, context) {
+ if (!(event in this._events)) this._events[event] = [];
+ this._events[event].push({ fct: func, context: context });
+ return this;
+ }
+
+ off(event, func, context) {
+ const listeners = this._events[event].slice();
+ if (listeners) {
+ for (const listener of listeners) {
+ if (listener.fct === func && listener.context === context) {
+ listener.fct = doNothing;
+ delete listener.context;
+ }
+ }
+ }
+ return this;
+ }
+
+ fire(event, data) {
+ const listeners = this._events[event].slice();
+ if (listeners) {
+ for (const listener of listeners) {
+ const fct = listener.fct;
+ listener.fct = doNothing;
+ try {
+ fct.call(listener.context, data);
+ } catch (e) {
+ console.error(e);
+ }
+ listener.fct = fct;
+ }
+ }
+ return this;
+ }
+}
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 937839a38..fa3a428d8 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -3,6 +3,7 @@ import WasabeePortal from "./portal";
import WasabeeMarker from "./marker";
import WasabeeMe from "./me";
import WasabeeZone from "./zone";
+import Evented from "./evented";
import { generateId, newColors } from "../auxiliar";
import { GetWasabeeServer } from "../server";
import { getSelectedOperation } from "../selectedOp";
@@ -10,8 +11,9 @@ import db from "../db";
import { constants } from "../static";
-export default class WasabeeOp {
+export default class WasabeeOp extends Evented {
constructor(obj) {
+ super();
if (typeof obj == "string") {
try {
obj = JSON.parse(obj);
@@ -347,7 +349,7 @@ export default class WasabeeOp {
this.cleanAnchorList();
this.cleanPortalList();
this.update(true);
- this.runCrosslinks();
+ this.updateBlockers();
}
removeMarker(marker) {
@@ -356,7 +358,7 @@ export default class WasabeeOp {
});
this.cleanPortalList();
this.update(true);
- this.runCrosslinks();
+ this.updateBlockers();
}
setMarkerComment(marker, comment) {
@@ -451,7 +453,7 @@ export default class WasabeeOp {
this.cleanAnchorList();
this.cleanPortalList();
this.update(true);
- this.runCrosslinks();
+ this.updateBlockers();
}
reverseLink(startPortalID, endPortalID) {
@@ -673,10 +675,10 @@ export default class WasabeeOp {
if (!existingLink) {
this.links.push(link);
this.update(true);
- this.runCrosslinks();
+ this.updateBlockers();
} else if (options.replace) {
this.update(true);
- this.runCrosslinks();
+ this.updateBlockers();
} else {
console.debug(
"Link Already Exists In Operation -> " + JSON.stringify(link)
@@ -786,7 +788,7 @@ export default class WasabeeOp {
this._addPortal(newPortal);
this._swapPortal(originalPortal, newPortal);
this.update(true);
- this.runCrosslinks();
+ this.updateBlockers();
}
addMarker(markerType, portal, options) {
@@ -820,7 +822,7 @@ export default class WasabeeOp {
this.update(true);
// run crosslink to update the layer
// XXX: we don't need to check, only redraw, so we need something clever, probably in mapDraw or crosslink.js
- if (destructMarkerTypes.includes(markerType)) this.runCrosslinks();
+ if (destructMarkerTypes.includes(markerType)) this.updateBlockers();
return true;
}
@@ -877,12 +879,12 @@ export default class WasabeeOp {
}
this.store(); // no await, let it happen in the background unless we see races
- window.map.fire("wasabee:op:change");
+ this.fire("update");
}
- runCrosslinks() {
+ updateBlockers() {
if (this._batchmode === true) return;
- window.map.fire("wasabee:crosslinks");
+ this.fire("blockers");
}
startBatchMode() {
@@ -892,7 +894,7 @@ export default class WasabeeOp {
endBatchMode() {
this._batchmode = false;
this.update(true);
- this.runCrosslinks();
+ this.updateBlockers();
}
convertLinksToObjs(links) {
diff --git a/src/code/selectedOp.js b/src/code/selectedOp.js
index 0910c1ba7..ba891b706 100644
--- a/src/code/selectedOp.js
+++ b/src/code/selectedOp.js
@@ -80,7 +80,13 @@ export async function makeSelectedOperation(opID) {
if (op == null) {
console.log("makeSelectedOperation called on invalid opID");
alert("attempted to load invalid opID");
+ return;
}
+
+ // remove old listeners ? old object should never .store
+ op.on("update", () => window.map.fire("wasabee:op:change"));
+ op.on("blockers", () => window.map.fire("wasabee:crosslinks"));
+
// the only place we should change the selected op.
delete window.plugin.wasabee._selectedOp;
window.plugin.wasabee._selectedOp = op;
From 7a91c18eb249b82560b419875d32f0aeb2a6173f Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 16:12:13 +0200
Subject: [PATCH 012/275] move marker types to marker model
---
src/code/crosslinks.js | 9 ++++----
src/code/dialogs/keysList.js | 5 ++---
src/code/dialogs/markerAddDialog.js | 5 +++--
src/code/dialogs/markerChangeDialog.js | 5 +++--
src/code/dialogs/trawl.js | 5 +++--
src/code/model/marker.js | 27 ++++++++++++++++++++++++
src/code/model/operation.js | 8 +++----
src/code/static.js | 29 --------------------------
src/code/uiCommands.js | 11 +++++-----
9 files changed, 51 insertions(+), 53 deletions(-)
diff --git a/src/code/crosslinks.js b/src/code/crosslinks.js
index e84ecf5b4..c7818825f 100644
--- a/src/code/crosslinks.js
+++ b/src/code/crosslinks.js
@@ -1,11 +1,10 @@
import WasabeePortal from "./model/portal";
import WasabeeLink from "./model/link";
+import WasabeeMarker from "./model/marker";
import { getSelectedOperation } from "./selectedOp";
import PortalUI from "./ui/portal";
-const Wasabee = window.plugin.wasabee;
-
// from iitc rework : https://github.com/IITC-CE/ingress-intel-total-conversion/pull/333
const d2r = Math.PI / 180;
@@ -141,9 +140,9 @@ function testPolyLine(wasabeeLink, realLink, operation) {
for (const marker of operation.markers) {
if (
- marker.type == Wasabee.static.constants.MARKER_TYPE_DESTROY ||
- marker.type == Wasabee.static.constants.MARKER_TYPE_VIRUS ||
- marker.type == Wasabee.static.constants.MARKER_TYPE_DECAY
+ marker.type == WasabeeMarker.constants.MARKER_TYPE_DESTROY ||
+ marker.type == WasabeeMarker.constants.MARKER_TYPE_VIRUS ||
+ marker.type == WasabeeMarker.constants.MARKER_TYPE_DECAY
) {
if (
marker.portalId == realLink.options.data.dGuid ||
diff --git a/src/code/dialogs/keysList.js b/src/code/dialogs/keysList.js
index cff6729a1..1445192e2 100644
--- a/src/code/dialogs/keysList.js
+++ b/src/code/dialogs/keysList.js
@@ -2,6 +2,7 @@ import { WDialog } from "../leafletClasses";
import Sortable from "../sortable";
import { opKeyPromise } from "../server";
import WasabeeMe from "../model/me";
+import WasabeeMarker from "../model/marker";
import KeyListPortal from "./keyListPortal";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
@@ -186,9 +187,7 @@ const KeysList = WDialog.extend({
}
for (const p of operation.markers.filter(function (marker) {
- return (
- marker.type == window.plugin.wasabee.static.constants.MARKER_TYPE_KEY
- );
+ return marker.type == WasabeeMarker.constants.MARKER_TYPE_KEY;
})) {
const k = {};
k.id = p.portalId;
diff --git a/src/code/dialogs/markerAddDialog.js b/src/code/dialogs/markerAddDialog.js
index c775b3aff..7c3841e57 100644
--- a/src/code/dialogs/markerAddDialog.js
+++ b/src/code/dialogs/markerAddDialog.js
@@ -1,6 +1,7 @@
import { WDialog } from "../leafletClasses";
import WasabeeMe from "../model/me";
import WasabeeTeam from "../model/team";
+import WasabeeMarker from "../model/marker";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
@@ -74,7 +75,7 @@ const MarkerAddDialog = WDialog.extend({
}
defaultType = markers.has(defaultType) ? null : defaultType;
- for (const k of window.plugin.wasabee.static.markerTypes) {
+ for (const k of WasabeeMarker.markerTypes) {
const o = L.DomUtil.create("option", null, this._type);
o.value = k;
o.textContent = wX(k);
@@ -114,7 +115,7 @@ const MarkerAddDialog = WDialog.extend({
L.DomEvent.on(addMarkerButton, "click", (ev) => {
L.DomEvent.stop(ev);
- if (window.plugin.wasabee.static.markerTypes.has(this._type.value))
+ if (WasabeeMarker.markerTypes.has(this._type.value))
this._addMarker(
this._type.value,
this._comment.value,
diff --git a/src/code/dialogs/markerChangeDialog.js b/src/code/dialogs/markerChangeDialog.js
index c5257aacc..4f24c7062 100644
--- a/src/code/dialogs/markerChangeDialog.js
+++ b/src/code/dialogs/markerChangeDialog.js
@@ -1,6 +1,7 @@
import { WDialog } from "../leafletClasses";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
+import WasabeeMarker from "../model/marker";
import PortalUI from "../ui/portal";
@@ -34,7 +35,7 @@ const MarkerChangeDialog = WDialog.extend({
this._type = L.DomUtil.create("select", null, content);
const markers = operation.getPortalMarkers(portal);
- for (const k of window.plugin.wasabee.static.markerTypes) {
+ for (const k of WasabeeMarker.markerTypes) {
const o = L.DomUtil.create("option", null, this._type);
o.value = k;
o.textContent = wX(k);
@@ -45,7 +46,7 @@ const MarkerChangeDialog = WDialog.extend({
const buttons = {};
buttons[wX("OK")] = () => {
if (
- window.plugin.wasabee.static.markerTypes.has(this._type.value) &&
+ WasabeeMarker.markerTypes.has(this._type.value) &&
!markers.has(this._type.value)
) {
operation.removeMarker(this.options.marker);
diff --git a/src/code/dialogs/trawl.js b/src/code/dialogs/trawl.js
index 569ca5939..35a83ac32 100644
--- a/src/code/dialogs/trawl.js
+++ b/src/code/dialogs/trawl.js
@@ -3,6 +3,7 @@ import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
import { blockerAutomark } from "../uiCommands";
import VLatLon from "geodesy/latlon-ellipsoidal-vincenty";
+import WasabeeMarker from "../model/marker";
const TrawlerDialog = WDialog.extend({
statics: {
@@ -315,8 +316,8 @@ const TrawlDialog = WDialog.extend({
operation.startBatchMode();
for (const m of operation.markers) {
if (
- m.type == window.plugin.wasabee.static.constants.MARKER_TYPE_DESTROY ||
- m.type == window.plugin.wasabee.static.constants.MARKER_TYPE_VIRUS
+ m.type == WasabeeMarker.constants.MARKER_TYPE_DESTROY ||
+ m.type == WasabeeMarker.constants.MARKER_TYPE_VIRUS
)
operation.removeMarker(m);
}
diff --git a/src/code/model/marker.js b/src/code/model/marker.js
index 258e62183..0618026f3 100644
--- a/src/code/model/marker.js
+++ b/src/code/model/marker.js
@@ -1,11 +1,38 @@
import { generateId } from "../auxiliar";
+const markers = {
+ MARKER_TYPE_CAPTURE: "CapturePortalMarker",
+ MARKER_TYPE_DECAY: "LetDecayPortalAlert",
+ MARKER_TYPE_EXCLUDE: "ExcludeMarker",
+ MARKER_TYPE_DESTROY: "DestroyPortalAlert",
+ MARKER_TYPE_FARM: "FarmPortalMarker",
+ MARKER_TYPE_GOTO: "GotoPortalMarker",
+ MARKER_TYPE_KEY: "GetKeyPortalMarker",
+ MARKER_TYPE_LINK: "CreateLinkAlert",
+ MARKER_TYPE_MEETAGENT: "MeetAgentPortalMarker",
+ MARKER_TYPE_OTHER: "OtherPortalAlert",
+ MARKER_TYPE_RECHARGE: "RechargePortalAlert",
+ MARKER_TYPE_UPGRADE: "UpgradePortalAlert",
+ MARKER_TYPE_VIRUS: "UseVirusPortalAlert",
+};
+
+const markerTypes = new Set(Object.values(markers));
+
const STATE_UNASSIGNED = "pending";
const STATE_ASSIGNED = "assigned";
const STATE_ACKNOWLEDGED = "acknowledged";
const STATE_COMPLETED = "completed";
export default class WasabeeMarker {
+ // static properties is not supported by eslint yet
+ static get markerTypes() {
+ return markerTypes;
+ }
+
+ static get constants() {
+ return markers;
+ }
+
constructor(obj) {
this.ID = obj.ID ? obj.ID : generateId();
this.portalId = obj.portalId;
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index fa3a428d8..23bfe507b 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -9,8 +9,6 @@ import { GetWasabeeServer } from "../server";
import { getSelectedOperation } from "../selectedOp";
import db from "../db";
-import { constants } from "../static";
-
export default class WasabeeOp extends Evented {
constructor(obj) {
super();
@@ -808,9 +806,9 @@ export default class WasabeeOp extends Evented {
// only need this for virus/destroy/decay -- this should be in the marker class
const destructMarkerTypes = [
- constants.MARKER_TYPE_DECAY,
- constants.MARKER_TYPE_DESTROY,
- constants.MARKER_TYPE_VIRUS,
+ WasabeeMarker.constants.MARKER_TYPE_DECAY,
+ WasabeeMarker.constants.MARKER_TYPE_DESTROY,
+ WasabeeMarker.constants.MARKER_TYPE_VIRUS,
];
if (destructMarkerTypes.includes(markerType)) {
// remove related blockers
diff --git a/src/code/static.js b/src/code/static.js
index 729b77c66..db3405d73 100644
--- a/src/code/static.js
+++ b/src/code/static.js
@@ -67,19 +67,6 @@ W.static = {
SERVER_BASE_KEY: "wasabee-server",
SERVER_BASE_DEFAULT: "https://am.wasabee.rocks",
REBASE_UPDATE_KEY: "wasabee-rebase-on-update",
- MARKER_TYPE_CAPTURE: "CapturePortalMarker",
- MARKER_TYPE_DECAY: "LetDecayPortalAlert",
- MARKER_TYPE_EXCLUDE: "ExcludeMarker",
- MARKER_TYPE_DESTROY: "DestroyPortalAlert",
- MARKER_TYPE_FARM: "FarmPortalMarker",
- MARKER_TYPE_GOTO: "GotoPortalMarker",
- MARKER_TYPE_KEY: "GetKeyPortalMarker",
- MARKER_TYPE_LINK: "CreateLinkAlert",
- MARKER_TYPE_MEETAGENT: "MeetAgentPortalMarker",
- MARKER_TYPE_OTHER: "OtherPortalAlert",
- MARKER_TYPE_RECHARGE: "RechargePortalAlert",
- MARKER_TYPE_UPGRADE: "UpgradePortalAlert",
- MARKER_TYPE_VIRUS: "UseVirusPortalAlert",
DEFAULT_MARKER_TYPE: "DestroyPortalAlert",
QUICKDRAW_GUIDE_STYLE: {
color: "#0f0",
@@ -105,22 +92,6 @@ W.static.strings.Italiano = require("./translations/italian.json");
W.static.strings.Tagalog = require("./translations/filipino.json");
W.static.strings.French = require("./translations/french.json");
-W.static.markerTypes = new Set([
- W.static.constants.MARKER_TYPE_CAPTURE,
- W.static.constants.MARKER_TYPE_DECAY,
- W.static.constants.MARKER_TYPE_DESTROY,
- W.static.constants.MARKER_TYPE_FARM,
- W.static.constants.MARKER_TYPE_GOTO,
- W.static.constants.MARKER_TYPE_KEY,
- W.static.constants.MARKER_TYPE_LINK,
- W.static.constants.MARKER_TYPE_MEETAGENT,
- W.static.constants.MARKER_TYPE_OTHER,
- W.static.constants.MARKER_TYPE_RECHARGE,
- W.static.constants.MARKER_TYPE_UPGRADE,
- W.static.constants.MARKER_TYPE_VIRUS,
- W.static.constants.MARKER_TYPE_EXCLUDE,
-]);
-
W.static.defaultOperationColor = "orange";
W.static.linkStyle = {
diff --git a/src/code/uiCommands.js b/src/code/uiCommands.js
index 4cc081ce9..6cd4c0cc8 100644
--- a/src/code/uiCommands.js
+++ b/src/code/uiCommands.js
@@ -1,5 +1,6 @@
import WasabeeOp from "./model/operation";
import WasabeePortal from "./model/portal";
+import WasabeeMarker from "./model/marker";
import ConfirmDialog from "./dialogs/confirmDialog";
import MergeDialog from "./dialogs/mergeDialog";
import WasabeeMe from "./model/me";
@@ -238,7 +239,7 @@ export function getAllPortalsOnScreen(operation) {
if (
operation.containsMarkerByID(
window.portals[portal].options.guid,
- window.plugin.wasabee.static.constants.MARKER_TYPE_EXCLUDE
+ WasabeeMarker.constants.MARKER_TYPE_EXCLUDE
)
)
continue;
@@ -324,14 +325,14 @@ export function blockerAutomark(operation, first = true) {
if (
!operation.containsMarkerByID(
b.fromPortalId,
- window.plugin.wasabee.static.constants.MARKER_TYPE_EXCLUDE
+ WasabeeMarker.constants.MARKER_TYPE_EXCLUDE
)
)
portals.push(b.fromPortalId);
if (
!operation.containsMarkerByID(
b.toPortalId,
- window.plugin.wasabee.static.constants.MARKER_TYPE_EXCLUDE
+ WasabeeMarker.constants.MARKER_TYPE_EXCLUDE
)
)
portals.push(b.toPortalId);
@@ -364,9 +365,9 @@ export function blockerAutomark(operation, first = true) {
// console.log(wportal);
// add marker
- let type = window.plugin.wasabee.static.constants.MARKER_TYPE_DESTROY;
+ let type = WasabeeMarker.constants.MARKER_TYPE_DESTROY;
if (wportal.team == "E") {
- type = window.plugin.wasabee.static.constants.MARKER_TYPE_VIRUS;
+ type = WasabeeMarker.constants.MARKER_TYPE_VIRUS;
}
const zone = operation.determineZone(wportal.latLng);
operation.addMarker(type, wportal, { comment: "auto-marked", zone: zone });
From 0fa813b91cdacce3d00f59acb1b2d4ce1d2ceb4f Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 26 Jun 2021 23:56:41 +0200
Subject: [PATCH 013/275] move map object to ui class
---
src/code/mapDrawing.js | 174 +----------------------
src/code/ui/agent.js | 223 +++++++++++++++++++-----------
src/code/ui/anchor.js | 214 ++++++++++++----------------
src/code/ui/marker.js | 306 ++++++++++++++++++-----------------------
src/code/ui/portal.js | 163 ++++++++++++++++++++--
5 files changed, 524 insertions(+), 556 deletions(-)
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index a47fa49f5..b6694beed 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -1,9 +1,7 @@
import WasabeeMe from "./model/me";
-import WasabeeAnchor from "./model/anchor";
import WasabeeTeam from "./model/team";
import WasabeeAgent from "./model/agent";
import WasabeeOp from "./model/operation";
-import { newColors } from "./auxiliar";
import { getSelectedOperation, opsList } from "./selectedOp";
import LinkUI from "./ui/link";
@@ -41,14 +39,11 @@ function updateMarkers(op) {
for (const m of op.markers) {
if (layerMap.has(m.ID)) {
const ll = Wasabee.markerLayerGroup.getLayer(layerMap.get(m.ID));
- if (m.state != ll.options.state) {
- L.DomUtil.removeClass(ll._icon, `wasabee-status-${ll.options.state}`);
- L.DomUtil.addClass(ll._icon, `wasabee-status-${m.state}`);
- ll.options.state = m.state;
- }
+ ll.setState(m.state);
layerMap.delete(m.ID);
} else {
- addMarker(m, op);
+ const lMarker = new MarkerUI.WLMarker(m, op);
+ lMarker.addTo(Wasabee.markerLayerGroup);
}
}
@@ -59,49 +54,6 @@ function updateMarkers(op) {
}
}
-// adds a new marker
-function addMarker(target, operation) {
- const targetPortal = operation.getPortal(target.portalId);
- const marker = L.marker(targetPortal.latLng, {
- title: targetPortal.name,
- id: target.ID,
- state: target.state,
- icon: L.divIcon({
- className: `wasabee-marker-icon ${target.type} wasabee-status-${target.state}`,
- shadowUrl: null,
- iconSize: L.point(24, 40),
- iconAnchor: L.point(12, 40),
- popupAnchor: L.point(-1, -48),
- }),
- });
-
- // register the marker for spiderfied click
- window.registerMarkerForOMS(marker);
- marker.bindPopup("loading...", {
- className: "wasabee-popup",
- closeButton: false,
- });
- // marker.off("click", marker.openPopup, marker);
- marker.on(
- "click spiderfiedclick",
- async function (ev) {
- /* eslint-disable no-invalid-this */
- L.DomEvent.stop(ev);
- if (this.isPopupOpen()) return;
- const sop = getSelectedOperation();
- const target = sop.getMarker(this.options.id);
- const c = await MarkerUI.popupContent(target, this);
- this.setPopupContent(c);
- this._popup._wrapper.classList.add("wasabee-popup");
- this.update();
- this.openPopup();
- /* eslint-enable no-invalid-this */
- },
- marker
- );
- marker.addTo(Wasabee.markerLayerGroup);
-}
-
// resetting is consistently 1ms faster than trying to update
function resetLinks(operation) {
if (window.isLayerGroupDisplayed("Wasabee Draw Links") === false) return; // yes, === false, undefined == true
@@ -291,42 +243,9 @@ function _drawAgent(agent, layerMap = agentLayerMap()) {
return false;
}
- const zoom = window.map.getZoom();
if (!layerMap.has(agent.id)) {
// new, add to map
- const marker = L.marker(agent.latLng, {
- title: agent.name,
- icon: L.divIcon({
- className: "wasabee-agent-icon",
- iconSize: AgentUI.iconSize(zoom),
- iconAnchor: AgentUI.iconAnchor(zoom),
- popupAnchor: L.point(0, -70),
- html: AgentUI.icon(agent, zoom),
- }),
- id: agent.id,
- zoom: zoom,
- });
-
- window.registerMarkerForOMS(marker);
- marker.bindPopup("Loading...", {
- className: "wasabee-popup",
- closeButton: false,
- });
- // marker.off("click", agent.openPopup, agent);
- marker.on(
- "click spiderfiedclick",
- async (ev) => {
- L.DomEvent.stop(ev);
- if (marker.isPopupOpen && marker.isPopupOpen()) return;
- const a = await WasabeeAgent.get(agent.id);
- marker.setPopupContent(await AgentUI.getPopup(a));
- if (marker._popup._wrapper)
- marker._popup._wrapper.classList.add("wasabee-popup");
- marker.update();
- marker.openPopup();
- },
- marker
- );
+ const marker = new AgentUI.WLAgent(agent);
marker.addTo(Wasabee.agentLayerGroup);
} else {
// move existing icons, if they actually moved
@@ -337,23 +256,6 @@ function _drawAgent(agent, layerMap = agentLayerMap()) {
if (agent.lat != ll.lat || agent.lng != ll.lng) {
// console.debug("moving ", agent.name, agent.latLng, al.getLatLng());
al.setLatLng(agent.latLng);
- al.update();
- }
-
- // if the zoom factor changed, refresh the icon
- if (zoom != al.options.zoom) {
- // console.debug("changing icon zoom: ", zoom, al.options.zoom);
- al.setIcon(
- L.divIcon({
- className: "wasabee-agent-icon",
- iconSize: AgentUI.iconSize(zoom),
- iconAnchor: AgentUI.iconAnchor(zoom),
- popupAnchor: L.point(0, -70),
- html: AgentUI.icon(agent, zoom),
- })
- );
- al.options.zoom = zoom;
- al.update();
}
}
return true;
@@ -381,7 +283,8 @@ function updateAnchors(op) {
if (layerMap.has(a)) {
layerMap.delete(a);
} else {
- addAnchorToMap(a, op);
+ const lAnchor = new AnchorUI.WLAnchor(a, op);
+ lAnchor.addTo(Wasabee.portalLayerGroup);
}
}
@@ -389,68 +292,3 @@ function updateAnchors(op) {
Wasabee.portalLayerGroup.removeLayer(v);
}
}
-
-// adds a single anchor to the map
-function addAnchorToMap(portalId, operation) {
- const anchor = new WasabeeAnchor(portalId, operation);
- // use newColors(anchor.color) for 0.19
- let layer = anchor.color;
- if (newColors(layer) == layer) layer = "custom";
- let marker;
- if (layer != "custom") {
- marker = L.marker(anchor.latLng, {
- title: anchor.name,
- alt: anchor.name,
- id: portalId,
- color: anchor.color,
- icon: L.divIcon({
- className: `wasabee-anchor-icon wasabee-layer-${layer}`,
- shadowUrl: null,
- iconAnchor: [12, 41],
- iconSize: [25, 41],
- popupAnchor: [0, -35],
- }),
- });
- } else {
- const svg = L.Util.template(
- ' ',
- { color: anchor.color }
- );
- marker = L.marker(anchor.latLng, {
- title: anchor.name,
- alt: anchor.name,
- id: portalId,
- color: anchor.color,
- icon: L.divIcon({
- className: "wasabee-anchor-icon",
- shadowUrl: null,
- iconAnchor: [12, 41],
- iconSize: [25, 41],
- popupAnchor: [0, -35],
- html: svg,
- }),
- });
- }
-
- window.registerMarkerForOMS(marker);
- marker.bindPopup("loading...", {
- className: "wasabee-popup",
- closeButton: false,
- });
- // marker.off("click", marker.openPopup, marker);
- marker.on(
- "click spiderfiedclick",
- (ev) => {
- L.DomEvent.stop(ev);
- if (marker.isPopupOpen && marker.isPopupOpen()) return;
- const content = AnchorUI.popupContent(anchor, marker);
- marker.setPopupContent(content);
- if (marker._popup._wrapper)
- marker._popup._wrapper.classList.add("wasabee-popup");
- marker.update();
- marker.openPopup();
- },
- marker
- );
- marker.addTo(Wasabee.portalLayerGroup);
-}
diff --git a/src/code/ui/agent.js b/src/code/ui/agent.js
index 6d107c31d..8269bdd9d 100644
--- a/src/code/ui/agent.js
+++ b/src/code/ui/agent.js
@@ -5,13 +5,7 @@ import { targetPromise, routePromise } from "../server";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
-export default {
- formatDisplay,
- getPopup,
- icon,
- iconSize,
- iconAnchor,
-};
+import WasabeeAgent from "../model/agent";
async function formatDisplay(agent, teamID = 0) {
const display = L.DomUtil.create("a", "wasabee-agent-label");
@@ -30,83 +24,6 @@ async function formatDisplay(agent, teamID = 0) {
return display;
}
-async function getPopup(agent) {
- const content = L.DomUtil.create("div", "wasabee-agent-popup");
- const title = L.DomUtil.create("div", "desc", content);
- title.id = agent.id;
- const fd = await formatDisplay(agent, 0);
- title.innerHTML = fd.outerHTML + timeSinceformat(agent);
-
- const sendTarget = L.DomUtil.create("button", null, content);
- sendTarget.textContent = wX("SEND TARGET");
- L.DomEvent.on(sendTarget, "click", (ev) => {
- L.DomEvent.stop(ev);
- const selectedPortal = PortalUI.getSelected();
- if (!selectedPortal) {
- alert(wX("SELECT PORTAL"));
- return;
- }
-
- const d = new ConfirmDialog({
- title: wX("SEND TARGET"),
- label: wX("SEND TARGET CONFIRM", {
- portalName: PortalUI.displayName(selectedPortal),
- agent: agent.name,
- }),
- type: "agent",
- callback: async () => {
- try {
- await targetPromise(agent.id, selectedPortal);
- alert(wX("TARGET SENT"));
- } catch (e) {
- console.error(e);
- }
- },
- });
- d.enable();
- });
-
- // this needs wX
- const requestRoute = L.DomUtil.create("button", null, content);
- requestRoute.textContent = "Send Route to Target";
- requestRoute.style.display = "none"; // hide this until the server-side is ready
- L.DomEvent.on(requestRoute, "click", (ev) => {
- L.DomEvent.stop(ev);
- const selectedPortal = PortalUI.getSelected();
- if (!selectedPortal) {
- alert(wX("SELECT PORTAL"));
- return;
- }
-
- const d = new ConfirmDialog({
- title: "Send Route to Target",
- label: "Do you really want to request the route to be sent?",
- type: "agent",
- callback: async () => {
- try {
- await routePromise(agent.id, selectedPortal);
- alert("Route Sent");
- } catch (e) {
- console.error(e);
- }
- },
- });
- d.enable();
- });
-
- const op = getSelectedOperation();
- const assignments = L.DomUtil.create("ul", "assignments", content);
- for (const m of op.markers) {
- if (m.assignedTo != agent.id) continue;
- const a = L.DomUtil.create("li", "assignment", assignments);
- const portal = op.getPortal(m.portalId);
- a.textContent = `${m.order}: ${wX(m.type)} `;
- a.appendChild(PortalUI.displayFormat(portal));
- }
-
- return content;
-}
-
function timeSinceformat(agent) {
if (!agent.date) return "";
const date = Date.parse(agent.date + " UTC");
@@ -197,3 +114,141 @@ function bigIcon(agent) {
`;
return icon;
}
+
+const WLAgent = L.Marker.extend({
+ initialize: function (agent) {
+ const zoom = window.map.getZoom();
+ L.Marker.prototype.initialize.call(this, agent.latLng, {
+ title: agent.name,
+ icon: L.divIcon({
+ className: "wasabee-agent-icon",
+ iconSize: iconSize(zoom),
+ iconAnchor: iconAnchor(zoom),
+ popupAnchor: L.point(0, -70),
+ html: icon(agent, zoom),
+ }),
+ id: agent.id,
+ agent: agent,
+ zoom: zoom,
+ });
+
+ window.registerMarkerForOMS(this);
+ this.bindPopup("Loading...", {
+ className: "wasabee-popup",
+ closeButton: false,
+ });
+ // marker.off("click", agent.openPopup, agent);
+ this.on("click spiderfiedclick", this._onClick, this);
+ },
+
+ _onClick: async function (ev) {
+ L.DomEvent.stop(ev);
+ if (this.isPopupOpen && this.isPopupOpen()) return;
+ const a = await WasabeeAgent.get(this.options.id);
+ this.options.agent = a;
+ this.setPopupContent(await this._getPopup(a));
+ if (this._popup._wrapper)
+ this._popup._wrapper.classList.add("wasabee-popup");
+ this.update();
+ this.openPopup();
+ },
+
+ update: function () {
+ const zoom = window.map.getZoom();
+ if (this.options.zoom != zoom) {
+ this.options.zoom = zoom;
+ this.setIcon(
+ L.divIcon({
+ className: "wasabee-agent-icon",
+ iconSize: iconSize(zoom),
+ iconAnchor: iconAnchor(zoom),
+ popupAnchor: L.point(0, -70),
+ html: icon(this.options.agent, zoom),
+ })
+ );
+ } else L.Marker.prototype.update.call(this);
+ },
+
+ _getPopup: async function () {
+ const agent = this.options.agent;
+ const content = L.DomUtil.create("div", "wasabee-agent-popup");
+ const title = L.DomUtil.create("div", "desc", content);
+ title.id = agent.id;
+ const fd = await formatDisplay(agent, 0);
+ title.innerHTML = fd.outerHTML + timeSinceformat(agent);
+
+ const sendTarget = L.DomUtil.create("button", null, content);
+ sendTarget.textContent = wX("SEND TARGET");
+ L.DomEvent.on(sendTarget, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const selectedPortal = PortalUI.getSelected();
+ if (!selectedPortal) {
+ alert(wX("SELECT PORTAL"));
+ return;
+ }
+
+ const d = new ConfirmDialog({
+ title: wX("SEND TARGET"),
+ label: wX("SEND TARGET CONFIRM", {
+ portalName: PortalUI.displayName(selectedPortal),
+ agent: agent.name,
+ }),
+ type: "agent",
+ callback: async () => {
+ try {
+ await targetPromise(agent.id, selectedPortal);
+ alert(wX("TARGET SENT"));
+ } catch (e) {
+ console.error(e);
+ }
+ },
+ });
+ d.enable();
+ });
+
+ // this needs wX
+ const requestRoute = L.DomUtil.create("button", null, content);
+ requestRoute.textContent = "Send Route to Target";
+ requestRoute.style.display = "none"; // hide this until the server-side is ready
+ L.DomEvent.on(requestRoute, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const selectedPortal = PortalUI.getSelected();
+ if (!selectedPortal) {
+ alert(wX("SELECT PORTAL"));
+ return;
+ }
+
+ const d = new ConfirmDialog({
+ title: "Send Route to Target",
+ label: "Do you really want to request the route to be sent?",
+ type: "agent",
+ callback: async () => {
+ try {
+ await routePromise(agent.id, selectedPortal);
+ alert("Route Sent");
+ } catch (e) {
+ console.error(e);
+ }
+ },
+ });
+ d.enable();
+ });
+
+ const op = getSelectedOperation();
+ const assignments = L.DomUtil.create("ul", "assignments", content);
+ for (const m of op.markers) {
+ if (m.assignedTo != agent.id) continue;
+ const a = L.DomUtil.create("li", "assignment", assignments);
+ const portal = op.getPortal(m.portalId);
+ a.textContent = `${m.order}: ${wX(m.type)} `;
+ a.appendChild(PortalUI.displayFormat(portal));
+ }
+
+ return content;
+ },
+});
+
+export default {
+ formatDisplay,
+ WLAgent,
+};
diff --git a/src/code/ui/anchor.js b/src/code/ui/anchor.js
index 52273f146..98b4ac41d 100644
--- a/src/code/ui/anchor.js
+++ b/src/code/ui/anchor.js
@@ -1,150 +1,110 @@
-import AssignDialog from "../dialogs/assignDialog";
-import SendTargetDialog from "../dialogs/sendTargetDialog";
-import SetCommentDialog from "../dialogs/setCommentDialog";
import LinkListDialog from "../dialogs/linkListDialog";
import { getSelectedOperation } from "../selectedOp";
import { swapPortal, deletePortal } from "../uiCommands";
+import { newColors } from "../auxiliar";
import wX from "../wX";
+import WasabeeAnchor from "../model/anchor";
+
import PortalUI from "./portal";
-export default {
- popupContent,
-};
+const WLAnchor = PortalUI.WLPortal.extend({
+ initialize: function (portalId, operation) {
+ const anchor = new WasabeeAnchor(portalId, operation);
+ // use newColors(anchor.color) for 0.19
+ let layer = anchor.color;
+ if (newColors(layer) == layer) layer = "custom";
+ const icon = L.divIcon({
+ className:
+ layer != "custom"
+ ? `wasabee-anchor-icon wasabee-layer-${layer}`
+ : "wasabee-anchor-icon",
+ shadowUrl: null,
+ iconAnchor: [12, 41],
+ iconSize: [25, 41],
+ popupAnchor: [0, -35],
+ html:
+ layer != "custom"
+ ? null
+ : L.Util.template(
+ ' ',
+ { color: anchor.color }
+ ),
+ });
+ PortalUI.WLPortal.prototype.initialize.call(this, {
+ portalId: portalId,
+ id: portalId,
+ color: anchor.color,
+ icon: icon,
+ });
+ },
-function popupContent(anchor, leafletMarker) {
- const operation = getSelectedOperation();
- const canWrite = operation.canWrite();
- const portal = operation.getPortal(anchor.ID);
+ _popupContent: function () {
+ const operation = getSelectedOperation();
+ const canWrite = operation.canWrite();
+ const portal = operation.getPortal(this.options.portalId);
- leafletMarker.className = "wasabee-anchor-popup";
- const content = L.DomUtil.create("div", null);
- const title = L.DomUtil.create("div", "desc", content);
- title.appendChild(PortalUI.displayFormat(portal));
- const portalComment = L.DomUtil.create(
- "div",
- "wasabee-portal-comment",
- content
- );
- const pcLink = L.DomUtil.create("a", null, portalComment);
- pcLink.textContent = portal.comment || wX("SET_PORTAL_COMMENT");
- if (canWrite) {
- pcLink.href = "#";
- L.DomEvent.on(pcLink, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: portal,
- operation: operation,
- });
- scd.enable();
- leafletMarker.closePopup();
- });
- }
- if (portal.hardness) {
- const portalHardness = L.DomUtil.create(
+ const content = PortalUI.WLPortal.prototype._popupContent.call(this);
+ const desc = L.DomUtil.create("div", "desc", content);
+ desc.appendChild(PortalUI.displayFormat(portal));
+ this._popupPortalComments(desc, portal, canWrite);
+
+ const requiredKeys = L.DomUtil.create("div", "desc", content);
+ const onHand = operation.KeysOnHandForPortal(portal.id);
+ const required = operation.KeysRequiredForPortal(portal.id);
+ requiredKeys.textContent = "Keys: " + onHand + " / " + required;
+
+ const buttonSet = L.DomUtil.create(
"div",
- "wasabee-portal-hardness",
+ "wasabee-marker-buttonset",
content
);
- const phLink = L.DomUtil.create("a", null, portalHardness);
- phLink.textContent = portal.hardness;
+ this._linksButton(buttonSet);
if (canWrite) {
- phLink.href = "#";
- L.DomEvent.on(phLink, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: portal,
- operation: operation,
- });
- scd.enable();
- leafletMarker.closePopup();
- });
+ this._swapButton(buttonSet);
+ this._deleteButton(buttonSet, wX("DELETE_ANCHOR"));
}
- }
+ this._mapButton(buttonSet, wX("ANCHOR_GMAP"));
+ if (operation.canWriteServer())
+ this._assignButton(buttonSet, wX("ASSIGN OUTBOUND"), portal);
+ if (operation.isOnCurrentServer())
+ this._sendTargetButton(buttonSet, wX("SEND TARGET"), portal);
- const requiredKeys = L.DomUtil.create("div", "desc", content);
- const onHand = operation.KeysOnHandForPortal(portal.id);
- const required = operation.KeysRequiredForPortal(portal.id);
- requiredKeys.textContent = "Keys: " + onHand + " / " + required;
+ return content;
+ },
- const buttonSet = L.DomUtil.create(
- "div",
- "wasabee-marker-buttonset",
- content
- );
- const linksButton = L.DomUtil.create("button", null, buttonSet);
- linksButton.textContent = wX("LINKS");
- L.DomEvent.on(linksButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const lld = new LinkListDialog({ portal: portal });
- lld.enable();
- leafletMarker.closePopup();
- });
- if (canWrite) {
- const swapButton = L.DomUtil.create("button", null, buttonSet);
- swapButton.textContent = wX("SWAP");
- L.DomEvent.on(swapButton, "click", (ev) => {
+ _linksButton: function (container) {
+ const operation = getSelectedOperation();
+ const portal = operation.getPortal(this.options.portalId);
+ const linksButton = L.DomUtil.create("button", null, container);
+ linksButton.textContent = wX("LINKS");
+ L.DomEvent.on(linksButton, "click", (ev) => {
L.DomEvent.stop(ev);
- swapPortal(operation, portal);
- leafletMarker.closePopup();
- });
- const deleteButton = L.DomUtil.create("button", null, buttonSet);
- deleteButton.textContent = wX("DELETE_ANCHOR");
- L.DomEvent.on(deleteButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- deletePortal(operation, portal);
- leafletMarker.closePopup();
+ const lld = new LinkListDialog({ portal: portal });
+ lld.enable();
+ this.closePopup();
});
- }
- const gmapButton = L.DomUtil.create("button", null, buttonSet);
- gmapButton.textContent = wX("ANCHOR_GMAP");
- L.DomEvent.on(gmapButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- leafletMarker.closePopup();
- // use intent on android
- if (
- typeof window.android !== "undefined" &&
- window.android &&
- window.android.intentPosLink
- ) {
- window.android.intentPosLink(
- +portal.lat,
- +portal.lng,
- window.map.getZoom(),
- portal.name,
- true
- );
- } else {
- window.open(
- "https://www.google.com/maps/search/?api=1&query=" +
- portal.lat +
- "," +
- portal.lng
- );
- }
- });
+ },
- if (operation.canWriteServer()) {
- const assignButton = L.DomUtil.create("button", null, buttonSet);
- assignButton.textContent = wX("ASSIGN OUTBOUND");
- L.DomEvent.on(assignButton, "click", (ev) => {
+ _swapButton: function (container) {
+ const operation = getSelectedOperation();
+ const portal = operation.getPortal(this.options.portalId);
+ const swapButton = L.DomUtil.create("button", null, container);
+ swapButton.textContent = wX("SWAP");
+ L.DomEvent.on(swapButton, "click", (ev) => {
L.DomEvent.stop(ev);
- const ad = new AssignDialog({ target: portal });
- ad.enable();
- leafletMarker.closePopup();
+ swapPortal(operation, portal);
+ this.closePopup();
});
- }
+ },
- if (operation.isOnCurrentServer()) {
- const sendButton = L.DomUtil.create("button", null, buttonSet);
- sendButton.textContent = wX("SEND TARGET");
- L.DomEvent.on(sendButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const std = new SendTargetDialog({ target: portal });
- std.enable();
- leafletMarker.closePopup();
- });
- }
+ _deleteAction: function () {
+ const operation = getSelectedOperation();
+ const portal = operation.getPortal(this.options.portalId);
+ deletePortal(operation, portal);
+ },
+});
- return content;
-}
+export default {
+ WLAnchor,
+};
diff --git a/src/code/ui/marker.js b/src/code/ui/marker.js
index 0eabf58da..ea41a8e95 100644
--- a/src/code/ui/marker.js
+++ b/src/code/ui/marker.js
@@ -1,7 +1,5 @@
import WasabeeAgent from "../model/agent";
-import AssignDialog from "../dialogs/assignDialog";
-import SendTargetDialog from "../dialogs/sendTargetDialog";
import SetCommentDialog from "../dialogs/setCommentDialog";
import MarkerChangeDialog from "../dialogs/markerChangeDialog";
import StateDialog from "../dialogs/stateDialog";
@@ -13,189 +11,159 @@ import PortalUI from "./portal";
import wX from "../wX";
-export default {
- popupContent,
-};
+const WLMarker = PortalUI.WLPortal.extend({
+ initialize: function (marker) {
+ PortalUI.WLPortal.prototype.initialize.call(this, {
+ portalId: marker.portalId,
+ id: marker.ID,
+ state: marker.state,
+ icon: L.divIcon({
+ className: `wasabee-marker-icon ${marker.type} wasabee-status-${marker.state}`,
+ shadowUrl: null,
+ iconSize: L.point(24, 40),
+ iconAnchor: L.point(12, 40),
+ popupAnchor: L.point(-1, -48),
+ }),
+ });
+ },
-async function popupContent(marker, leafletMarker, operation) {
- if (!operation) operation = getSelectedOperation();
- const canWrite = operation.canWrite();
-
- const portal = operation.getPortal(marker.portalId);
- if (portal == null) {
- console.log("null portal getting marker popup");
- return (L.DomUtil.create("div", "wasabee-marker-popup").textContent =
- "invalid portal");
- }
-
- const content = L.DomUtil.create("div", "wasabee-marker-popup");
- content.appendChild(
- getPopupBodyWithType(marker, portal, operation, leafletMarker)
- );
-
- const assignment = L.DomUtil.create(
- "div",
- "wasabee-popup-assignment",
- content
- );
- if (marker.state != "completed" && marker.assignedTo) {
- try {
- const a = await WasabeeAgent.get(marker.assignedTo);
- assignment.textContent = wX("ASS_TO"); // FIXME convert formatDisplay to html and add as value to wX
- if (a) assignment.appendChild(await AgentUI.formatDisplay(a));
- else assignment.textContent += " " + marker.assignedTo;
- } catch (err) {
- console.error(err);
+ setState: function (state) {
+ if (state != this.options.state) {
+ L.DomUtil.removeClass(this._icon, `wasabee-status-${this.options.state}`);
+ L.DomUtil.addClass(this._icon, `wasabee-status-${state}`);
+ this.options.state = state;
}
- }
- if (marker.state == "completed" && marker.completedID) {
- try {
- const a = await WasabeeAgent.get(marker.completedID);
- assignment.innerHTML = wX("COMPLETED BY", {
- agentName: a ? a.name : marker.completedID,
- });
- } catch (e) {
- console.error(e);
+ },
+
+ _popupContent: function () {
+ const operation = getSelectedOperation();
+ const marker = operation.getMarker(this.options.id);
+ const portal = operation.getPortal(marker.portalId);
+
+ if (portal == null) {
+ console.log("null portal getting marker popup");
+ return (L.DomUtil.create("div", "wasabee-marker-popup").textContent =
+ "invalid portal");
}
- }
-
- const buttonSet = L.DomUtil.create(
- "div",
- "wasabee-marker-buttonset",
- content
- );
- if (canWrite) {
- const deleteButton = L.DomUtil.create("button", null, buttonSet);
- deleteButton.textContent = wX("DELETE_ANCHOR");
- L.DomEvent.on(deleteButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- deleteMarker(operation, marker, portal);
- leafletMarker.closePopup();
- });
- }
- if (operation.canWriteServer()) {
- const assignButton = L.DomUtil.create("button", null, buttonSet);
- assignButton.textContent = wX("ASSIGN");
- L.DomEvent.on(assignButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ad = new AssignDialog({ target: marker });
- ad.enable();
- leafletMarker.closePopup();
- });
- }
- if (canWrite) {
- const stateButton = L.DomUtil.create("button", null, buttonSet);
- stateButton.textContent = wX("MARKER STATE");
- L.DomEvent.on(stateButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const sd = new StateDialog({ target: marker, opID: operation.ID });
- sd.enable();
- leafletMarker.closePopup();
- });
- }
+ const canWrite = operation.canWrite();
- if (operation.isOnCurrentServer()) {
- const sendTargetButton = L.DomUtil.create("button", null, buttonSet);
- sendTargetButton.textContent = wX("SEND TARGET");
- L.DomEvent.on(sendTargetButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const std = new SendTargetDialog({ target: marker });
- std.enable();
- leafletMarker.closePopup();
- });
- }
+ const content = PortalUI.WLPortal.prototype._popupContent.call(this);
- const gmapButton = L.DomUtil.create("button", null, buttonSet);
- gmapButton.textContent = wX("ANCHOR_GMAP");
- L.DomEvent.on(gmapButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- leafletMarker.closePopup();
- // use intent on android
- if (
- typeof window.android !== "undefined" &&
- window.android &&
- window.android.intentPosLink
- ) {
- window.android.intentPosLink(
- +portal.lat,
- +portal.lng,
- window.map.getZoom(),
- portal.name,
- true
- );
- } else {
- window.open(
- "https://www.google.com/maps/search/?api=1&query=" +
- portal.lat +
- "," +
- portal.lng
- );
+ const desc = L.DomUtil.create("div", "desc", content);
+ const kind = L.DomUtil.create(
+ "span",
+ `wasabee-marker-popup-kind ${marker.type}`,
+ desc
+ );
+ kind.textContent = wX(marker.type);
+ desc.appendChild(PortalUI.displayFormat(portal));
+ if (canWrite) {
+ kind.href = "#";
+ L.DomEvent.on(kind, "click", this._setMarkerType, this);
}
- });
+ this._popupMarkerComment(desc, marker, canWrite);
+ this._popupPortalComments(desc, portal, canWrite);
- return content;
-}
+ this._popupAssignState(content, marker);
-function getPopupBodyWithType(marker, portal, operation, leafletMarker) {
- const title = L.DomUtil.create("div", "desc");
- const kind = L.DomUtil.create("span", "wasabee-marker-popup-kind", title);
- L.DomUtil.addClass(kind, marker.type);
- kind.textContent = wX(marker.type);
- title.appendChild(PortalUI.displayFormat(portal));
-
- kind.href = "#";
- L.DomEvent.on(kind, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ch = new MarkerChangeDialog({ marker: marker });
- ch.enable();
- leafletMarker.closePopup();
- });
+ const buttonSet = L.DomUtil.create(
+ "div",
+ "wasabee-marker-buttonset",
+ content
+ );
+ if (canWrite) this._deleteButton(buttonSet, wX("DELETE_ANCHOR"));
+ if (operation.canWriteServer())
+ this._assignButton(buttonSet, wX("ASSIGN"), marker);
+ if (canWrite) this._stateButton(buttonSet, marker);
+ if (operation.isOnCurrentServer())
+ this._sendTargetButton(buttonSet, wX("SEND TARGET"), marker);
+ this._mapButton(buttonSet, wX("ANCHOR_GMAP"));
+
+ return content;
+ },
+
+ _popupMarkerComment: function (container, marker, canWrite) {
+ if (marker.comment) {
+ const comment = L.DomUtil.create(
+ "div",
+ "wasabee-marker-popup-comment",
+ container
+ );
+ comment.textContent = marker.comment;
+ if (canWrite) L.DomEvent.on(comment, "click", this._setComment, this);
+ }
+ },
- if (marker.comment) {
- const comment = L.DomUtil.create(
+ _popupAssignState: async function (container, marker) {
+ const assignment = L.DomUtil.create(
"div",
- "wasabee-marker-popup-comment",
- title
+ "wasabee-popup-assignment",
+ container
);
- comment.textContent = marker.comment;
- L.DomEvent.on(comment, "click", (ev) => {
+ if (marker.state != "completed" && marker.assignedTo) {
+ try {
+ const a = await WasabeeAgent.get(marker.assignedTo);
+ assignment.textContent = wX("ASS_TO"); // FIXME convert formatDisplay to html and add as value to wX
+ if (a) assignment.appendChild(await AgentUI.formatDisplay(a));
+ else assignment.textContent += " " + marker.assignedTo;
+ } catch (err) {
+ console.error(err);
+ }
+ }
+ if (marker.state == "completed" && marker.completedID) {
+ try {
+ const a = await WasabeeAgent.get(marker.completedID);
+ assignment.innerHTML = wX("COMPLETED BY", {
+ agentName: a ? a.name : marker.completedID,
+ });
+ } catch (e) {
+ console.error(e);
+ }
+ }
+ },
+
+ _stateButton: function (container, marker) {
+ const operation = getSelectedOperation();
+ const stateButton = L.DomUtil.create("button", null, container);
+ stateButton.textContent = wX("MARKER STATE");
+ L.DomEvent.on(stateButton, "click", (ev) => {
L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: marker,
- operation: operation,
- });
- scd.enable();
- leafletMarker.closePopup();
+ const sd = new StateDialog({ target: marker, opID: operation.ID });
+ sd.enable();
+ this.closePopup();
});
- }
- const comment = L.DomUtil.create("div", "wasabee-portal-comment", title);
- const cl = L.DomUtil.create("a", null, comment);
- cl.textContent = portal.comment || wX("SET_PORTAL_COMMENT");
- cl.href = "#";
- L.DomEvent.on(cl, "click", (ev) => {
+ },
+
+ _deleteAction: function () {
+ const operation = getSelectedOperation();
+ const portal = operation.getPortal(this.options.portalId);
+ const marker = operation.getMarker(this.options.id);
+ deleteMarker(operation, marker, portal);
+ },
+
+ _setComment: function (ev) {
L.DomEvent.stop(ev);
+ const operation = getSelectedOperation();
+ const marker = operation.getMarker(this.options.id);
const scd = new SetCommentDialog({
- target: portal,
+ target: marker,
operation: operation,
});
scd.enable();
- leafletMarker.closePopup();
- });
- if (portal.hardness) {
- const hardness = L.DomUtil.create("div", "wasabee-portal-hardness", title);
- const hl = L.DomUtil.create("a", null, hardness);
- hl.textContent = portal.hardness;
- hl.href = "#";
- L.DomEvent.on(hl, "click", (ev) => {
- L.DomEvent.stop(ev);
- const scd = new SetCommentDialog({
- target: portal,
- operation: operation,
- });
- scd.enable();
- leafletMarker.closePopup();
- });
- }
- return title;
-}
+ this.closePopup();
+ },
+
+ _setMarkerType: function (ev) {
+ L.DomEvent.stop(ev);
+ const operation = getSelectedOperation();
+ const marker = operation.getMarker(this.options.id);
+ const ch = new MarkerChangeDialog({ marker: marker });
+ ch.enable();
+ this.closePopup();
+ },
+});
+
+export default {
+ WLMarker,
+};
diff --git a/src/code/ui/portal.js b/src/code/ui/portal.js
index cff24df2d..d36fe7e93 100644
--- a/src/code/ui/portal.js
+++ b/src/code/ui/portal.js
@@ -1,13 +1,10 @@
import WasabeePortal from "../model/portal";
-import wX from "../wX";
-export default {
- fromIITC,
- displayName,
- displayFormat,
- get,
- getSelected,
-};
+import { getSelectedOperation } from "../selectedOp";
+import AssignDialog from "../dialogs/assignDialog";
+import SendTargetDialog from "../dialogs/sendTargetDialog";
+import SetCommentDialog from "../dialogs/setCommentDialog";
+import wX from "../wX";
function fromIITC(p) {
// we have all the details
@@ -97,3 +94,153 @@ function get(id) {
function getSelected() {
return window.selectedPortal ? get(window.selectedPortal) : null;
}
+
+// common part for marker and anchors
+const WLPortal = L.Marker.extend({
+ initialize: function (options) {
+ const operation = getSelectedOperation();
+ const portal = operation.getPortal(options.portalId);
+ options.title = portal.name;
+ L.Marker.prototype.initialize.call(this, portal.latLng, options);
+ window.registerMarkerForOMS(this);
+ },
+
+ onAdd: function (map) {
+ L.Marker.prototype.onAdd.call(this, map);
+ this.bindPopup("loading...", {
+ className: "wasabee-popup",
+ closeButton: false,
+ });
+ // marker.off("click", marker.openPopup, marker);
+ this.on("click spiderfiedclick", this._onClick, this);
+ },
+
+ _onClick: function (ev) {
+ L.DomEvent.stop(ev);
+ if (this.isPopupOpen && this.isPopupOpen()) return;
+ const content = this._popupContent();
+ this.setPopupContent(content);
+ if (this._popup._wrapper)
+ this._popup._wrapper.classList.add("wasabee-popup");
+ this.update();
+ this.openPopup();
+ },
+
+ _popupContent: function () {
+ const div = L.DomUtil.create("div", "wasabee-marker-popup");
+ return div;
+ },
+
+ _popupPortalComments: function (container, portal, canWrite) {
+ const portalComment = L.DomUtil.create(
+ "div",
+ "wasabee-portal-comment",
+ container
+ );
+ const pcLink = L.DomUtil.create("a", null, portalComment);
+ pcLink.textContent = portal.comment || wX("SET_PORTAL_COMMENT");
+ if (canWrite) {
+ pcLink.href = "#";
+ L.DomEvent.on(pcLink, "click", this._setPortalComment, this);
+ }
+ if (portal.hardness) {
+ const portalHardness = L.DomUtil.create(
+ "div",
+ "wasabee-portal-hardness",
+ container
+ );
+ const phLink = L.DomUtil.create("a", null, portalHardness);
+ phLink.textContent = portal.hardness;
+ if (canWrite) {
+ phLink.href = "#";
+ L.DomEvent.on(phLink, "click", this._setPortalComment, this);
+ }
+ }
+ },
+
+ _setPortalComment: function (ev) {
+ L.DomEvent.stop(ev);
+ const operation = getSelectedOperation();
+ const portal = operation.getPortal(this.options.portalId);
+ const scd = new SetCommentDialog({
+ target: portal,
+ operation: operation,
+ });
+ scd.enable();
+ this.closePopup();
+ },
+
+ _assignButton: function (container, text, target) {
+ const assignButton = L.DomUtil.create("button", null, container);
+ assignButton.textContent = text;
+ L.DomEvent.on(assignButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const ad = new AssignDialog({ target: target });
+ ad.enable();
+ this.closePopup();
+ });
+ return assignButton;
+ },
+
+ _deleteButton: function (container, text) {
+ const deleteButton = L.DomUtil.create("button", null, container);
+ deleteButton.textContent = text;
+ L.DomEvent.on(deleteButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ if (this._deleteAction) this._deleteAction();
+ this.closePopup();
+ });
+ },
+
+ _sendTargetButton: function (container, text, target) {
+ const sendButton = L.DomUtil.create("button", null, container);
+ sendButton.textContent = text;
+ L.DomEvent.on(sendButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const std = new SendTargetDialog({ target: target });
+ std.enable();
+ this.closePopup();
+ });
+ return sendButton;
+ },
+
+ _mapButton: function (container, text) {
+ const gmapButton = L.DomUtil.create("button", null, container);
+ gmapButton.textContent = text;
+ L.DomEvent.on(gmapButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ this.closePopup();
+ const latLng = this.getLatLng();
+ // use intent on android
+ if (
+ typeof window.android !== "undefined" &&
+ window.android &&
+ window.android.intentPosLink
+ ) {
+ window.android.intentPosLink(
+ +latLng.lat,
+ +latLng.lng,
+ window.map.getZoom(),
+ this.options.title,
+ true
+ );
+ } else {
+ window.open(
+ "https://www.google.com/maps/search/?api=1&query=" +
+ latLng.lat +
+ "," +
+ latLng.lng
+ );
+ }
+ });
+ },
+});
+
+export default {
+ fromIITC,
+ displayName,
+ displayFormat,
+ get,
+ getSelected,
+ WLPortal,
+};
From 73200b78cca6b0b239026862172dc1a2a6560274 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sun, 27 Jun 2021 16:35:19 +0200
Subject: [PATCH 014/275] factor + move link map code
node: background ops are still treated differently
---
src/code/css/map.css | 359 +++++++++++++++++++++++++++++++++++++++
src/code/css/wasabee.css | 355 --------------------------------------
src/code/mapDrawing.js | 49 +-----
src/code/static.js | 1 +
src/code/ui/agent.js | 27 +--
src/code/ui/anchor.js | 2 +
src/code/ui/link.js | 104 +++++++-----
src/code/ui/marker.js | 2 +
src/code/ui/portal.js | 26 +--
9 files changed, 448 insertions(+), 477 deletions(-)
create mode 100644 src/code/css/map.css
diff --git a/src/code/css/map.css b/src/code/css/map.css
new file mode 100644
index 000000000..5a5bdee59
--- /dev/null
+++ b/src/code/css/map.css
@@ -0,0 +1,359 @@
+/* wasabee-tooltip is used for the quickdraw mouse follower */
+.wasabee-tooltip {
+ background: rgba(30, 130, 76, 0.66);
+ border: 1px solid transparent;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ color: #fff;
+ /* font: 12px/18px "Helvetica Neue",Arial,Helvetica,sans-serif; */
+ margin-left: 20px;
+ margin-top: -21px;
+ padding: 2px 4px;
+ position: absolute;
+ white-space: nowrap;
+ z-index: 6;
+}
+.wasabee-tooltip:before {
+ border-right: 6px solid #000;
+ border-right-color: rgba(99, 99, 88, 0.66);
+ border-top: 6px solid transparent;
+ border-bottom: 6px solid transparent;
+ content: "";
+ position: absolute;
+ top: 7px;
+ left: -7px;
+}
+.wasabee-tooltip-single {
+ margin-top: -12px;
+}
+.wasabee-error-tooltip {
+ background-color: #f2dede;
+ border: 1px solid #e6b6bd;
+ color: #b94a48;
+}
+.wasabee-error-tooltip:before {
+ border-right-color: #e6b6bd;
+}
+
+/* this class is appended to leaflet-popup so we can adjust without stepping on other plugins */
+.leaflet-popup.wasabee-popup .leaflet-popup-content-wrapper {
+ background: rgba(235, 235, 235, 0.75) !important;
+ -webkit-border-radius: 6px !important;
+ font-weight: bolder;
+}
+
+#map .wasabee-popup .leaflet-popup-content {
+ color: black;
+}
+
+.wasabee-popup a.enl {
+ color: rgb(56, 142, 60) !important;
+}
+.wasabee-popup a.res {
+ color: rgb(0, 135, 255) !important;
+}
+
+.wasabee-link-popup .buttonset {
+ display: grid;
+}
+
+.wasabee-marker-popup {
+}
+.wasabee-marker-popup div.desc {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ color: #000;
+ padding: 4px 4px;
+}
+
+.wasabee-popup-assignment {
+ padding: 0px 4px 0px 4px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: #000;
+}
+
+.wasabee-popup-assignment a.wasabee-agent-label {
+ margin-left: 4px;
+}
+
+.wasabee-marker-popup-kind {
+ margin-right: 4px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: #000;
+}
+
+.wasabee-marker-popup-comment {
+ font-weight: initial;
+}
+
+.wasabee-marker-popup-kind {
+ cursor: pointer;
+}
+
+.wasabee-marker-popup-kind:hover {
+ text-decoration: underline;
+}
+
+.wasabee-marker-buttonset {
+}
+.wasabee-marker-buttonset button {
+ display: block;
+ width: 100%;
+}
+
+.wasabee-agent-popup {
+}
+.wasabee-agent-popup div.desc {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ color: #000;
+ padding: 0px 4px;
+}
+
+.wasabee-agent-popup button {
+ display: block;
+ width: 100%;
+}
+
+.wasabee-agent-popup ul.assignments {
+ color: rgb(56, 142, 60);
+}
+
+.wasabee-agent-popup li.assignment {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+.wasabee-anchor-popup {
+}
+.wasabee-anchor-popup div.desc {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ color: #000;
+ padding: 0px 4px;
+}
+
+.wasabee-anchor-buttonset {
+}
+.wasabee-anchor-buttonset button {
+ display: block;
+ width: 100%;
+}
+
+.wasabee-wd-popup ul {
+ padding-left: 1em;
+}
+
+.wasabee-marker-icon {
+ background-size: cover;
+}
+
+.wasabee-marker-icon.CapturePortalMarker {
+ background-image: url(../images/wasabee_markers_capture_pending.svg)
+}
+.wasabee-marker-icon.CapturePortalMarker.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_capture_assigned.svg)
+}
+.wasabee-marker-icon.CapturePortalMarker.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_capture_acknowledge.svg)
+}
+.wasabee-marker-icon.CapturePortalMarker.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_capture_done.svg)
+}
+.wasabee-marker-icon.LetDecayPortalAlert {
+ background-image: url(../images/wasabee_markers_decay_pending.svg)
+}
+.wasabee-marker-icon.LetDecayPortalAlert.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_decay_assigned.svg)
+}
+.wasabee-marker-icon.LetDecayPortalAlert.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_decay_acknowledge.svg)
+}
+.wasabee-marker-icon.LetDecayPortalAlert.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_decay_done.svg)
+}
+.wasabee-marker-icon.DestroyPortalAlert {
+ background-image: url(../images/wasabee_markers_destroy_pending.svg)
+}
+.wasabee-marker-icon.DestroyPortalAlert.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_destroy_assigned.svg)
+}
+.wasabee-marker-icon.DestroyPortalAlert.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_destroy_acknowledge.svg)
+}
+.wasabee-marker-icon.DestroyPortalAlert.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_destroy_done.svg)
+}
+.wasabee-marker-icon.FarmPortalMarker {
+ background-image: url(../images/wasabee_markers_farm_pending.svg)
+}
+.wasabee-marker-icon.FarmPortalMarker.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_farm_assigned.svg)
+}
+.wasabee-marker-icon.FarmPortalMarker.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_farm_acknowledge.svg)
+}
+.wasabee-marker-icon.FarmPortalMarker.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_farm_done.svg)
+}
+.wasabee-marker-icon.GotoPortalMarker {
+ background-image: url(../images/wasabee_markers_goto_pending.svg)
+}
+.wasabee-marker-icon.GotoPortalMarker.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_goto_assigned.svg)
+}
+.wasabee-marker-icon.GotoPortalMarker.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_goto_acknowledged.svg)
+}
+.wasabee-marker-icon.GotoPortalMarker.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_goto_done.svg)
+}
+.wasabee-marker-icon.GetKeyPortalMarker {
+ background-image: url(../images/wasabee_markers_key_pending.svg)
+}
+.wasabee-marker-icon.GetKeyPortalMarker.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_key_assigned.svg)
+}
+.wasabee-marker-icon.GetKeyPortalMarker.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_key_acknowledged.svg)
+}
+.wasabee-marker-icon.GetKeyPortalMarker.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_key_done.svg)
+}
+.wasabee-marker-icon.CreateLinkAlert {
+ background-image: url(../images/wasabee_markers_link_pending.svg)
+}
+.wasabee-marker-icon.CreateLinkAlert.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_link_assigned.svg)
+}
+.wasabee-marker-icon.CreateLinkAlert.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_link_acknowledged.svg)
+}
+.wasabee-marker-icon.CreateLinkAlert.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_link_done.svg)
+}
+.wasabee-marker-icon.MeetAgentPortalMarker {
+ background-image: url(../images/wasabee_markers_meetagent_pending.svg)
+}
+.wasabee-marker-icon.MeetAgentPortalMarker.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_meetagent_assigned.svg)
+}
+.wasabee-marker-icon.MeetAgentPortalMarker.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_meetagent_acknowledge.svg)
+}
+.wasabee-marker-icon.MeetAgentPortalMarker.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_meetagent_done.svg)
+}
+.wasabee-marker-icon.OtherPortalAlert {
+ background-image: url(../images/wasabee_markers_other_pending.svg)
+}
+.wasabee-marker-icon.OtherPortalAlert.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_other_assigned.svg)
+}
+.wasabee-marker-icon.OtherPortalAlert.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_other_acknowledge.svg)
+}
+.wasabee-marker-icon.OtherPortalAlert.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_other_done.svg)
+}
+.wasabee-marker-icon.RechargePortalAlert {
+ background-image: url(../images/wasabee_markers_recharge_pending.svg)
+}
+.wasabee-marker-icon.RechargePortalAlert.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_recharge_assigned.svg)
+}
+.wasabee-marker-icon.RechargePortalAlert.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_recharge_acknowledge.svg)
+}
+.wasabee-marker-icon.RechargePortalAlert.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_recharge_done.svg)
+}
+.wasabee-marker-icon.UpgradePortalAlert {
+ background-image: url(../images/wasabee_markers_upgrade_pending.svg)
+}
+.wasabee-marker-icon.UpgradePortalAlert.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_upgrade_assigned.svg)
+}
+.wasabee-marker-icon.UpgradePortalAlert.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_upgrade_acknowledge.svg)
+}
+.wasabee-marker-icon.UpgradePortalAlert.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_upgrade_done.svg)
+}
+.wasabee-marker-icon.UseVirusPortalAlert {
+ background-image: url(../images/wasabee_markers_virus_pending.svg)
+}
+.wasabee-marker-icon.UseVirusPortalAlert.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_virus_assigned.svg)
+}
+.wasabee-marker-icon.UseVirusPortalAlert.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_virus_acknowledge.svg)
+}
+.wasabee-marker-icon.UseVirusPortalAlert.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_virus_done.svg)
+}
+.wasabee-marker-icon.ExcludeMarker {
+ background-image: url(../images/wasabee_markers_exclude_pending.svg)
+}
+.wasabee-marker-icon.ExcludeMarker.wasabee-status-assigned {
+ background-image: url(../images/wasabee_markers_exclude_assigned.svg)
+}
+.wasabee-marker-icon.ExcludeMarker.wasabee-status-acknowledged {
+ background-image: url(../images/wasabee_markers_exclude_assigned.svg)
+}
+.wasabee-marker-icon.ExcludeMarker.wasabee-status-completed {
+ background-image: url(../images/wasabee_markers_exclude_done.svg)
+}
+
+.wasabee-defense-icon {
+ background-size: cover;
+ background-image: url(../images/wasabee_markers_key_done.svg)
+}
+
+.wasabee-anchor-icon {
+ background-size: 25px 41px;
+}
+.wasabee-anchor-icon.wasabee-layer-main {
+ background-image: url(../images/pin_red.svg)
+}
+.wasabee-anchor-icon.wasabee-layer-groupa {
+ background-image: url(../images/pin_orange.svg)
+}
+.wasabee-anchor-icon.wasabee-layer-groupb {
+ background-image: url(../images/pin_yellow.svg)
+}
+.wasabee-anchor-icon.wasabee-layer-groupc {
+ background-image: url(../images/pin_tan.svg)
+}
+.wasabee-anchor-icon.wasabee-layer-groupd {
+ background-image: url(../images/pin_purple.svg)
+}
+.wasabee-anchor-icon.wasabee-layer-groupe {
+ background-image: url(../images/pin_teal.svg)
+}
+.wasabee-anchor-icon.wasabee-layer-groupf {
+ background-image: url(../images/pin_magenta.svg)
+}
+
+.wasabee-portal-comment {
+ font-size: smaller;
+ font-weight: lighter;
+ margin-left: 12px;
+}
+
+.wasabee-portal-hardness {
+ font-size: smaller;
+ font-weight: lighter;
+ margin-left: 12px;
+}
+
+.wasabee-portal-hardness a {
+ color: #f00 !important;
+}
+
diff --git a/src/code/css/wasabee.css b/src/code/css/wasabee.css
index 65347432a..f2629261c 100644
--- a/src/code/css/wasabee.css
+++ b/src/code/css/wasabee.css
@@ -1,40 +1,3 @@
-/* wasabee-tooltip is used for the quickdraw mouse follower */
-.wasabee-tooltip {
- background: rgba(30, 130, 76, 0.66);
- border: 1px solid transparent;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- color: #fff;
- /* font: 12px/18px "Helvetica Neue",Arial,Helvetica,sans-serif; */
- margin-left: 20px;
- margin-top: -21px;
- padding: 2px 4px;
- position: absolute;
- white-space: nowrap;
- z-index: 6;
-}
-.wasabee-tooltip:before {
- border-right: 6px solid #000;
- border-right-color: rgba(99, 99, 88, 0.66);
- border-top: 6px solid transparent;
- border-bottom: 6px solid transparent;
- content: "";
- position: absolute;
- top: 7px;
- left: -7px;
-}
-.wasabee-tooltip-single {
- margin-top: -12px;
-}
-.wasabee-error-tooltip {
- background-color: #f2dede;
- border: 1px solid #e6b6bd;
- color: #b94a48;
-}
-.wasabee-error-tooltip:before {
- border-right-color: #e6b6bd;
-}
-
/* used in anything that is a sortable table */
/* .wasabee-table tbody tr:nth-child(2n + 1) td { border-color: rgba(50, 0, 125, 1); } */
.wasabee-table tr {
@@ -104,308 +67,6 @@
pointer-events: none;
}
-/* this class is appended to leaflet-popup so we can adjust without stepping on other plugins */
-.wasabee-popup {
- background: rgba(235, 235, 235, 0.75) !important;
- -webkit-border-radius: 6px !important;
- font-weight: bolder;
-}
-
-#map .wasabee-popup .leaflet-popup-content {
- color: black;
-}
-
-.wasabee-popup a.enl {
- color: rgb(56, 142, 60) !important;
-}
-.wasabee-popup a.res {
- color: rgb(0, 135, 255) !important;
-}
-
-.wasabee-marker-popup {
-}
-.wasabee-marker-popup div.desc {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: #000;
- padding: 4px 4px;
-}
-
-.wasabee-popup-assignment {
- padding: 0px 4px 0px 4px;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #000;
-}
-
-.wasabee-popup-assignment a.wasabee-agent-label {
- margin-left: 4px;
-}
-
-.wasabee-marker-popup-kind {
- margin-right: 4px;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #000;
-}
-
-.wasabee-marker-popup-comment {
- font-weight: initial;
-}
-
-.wasabee-marker-popup-kind {
- cursor: pointer;
-}
-
-.wasabee-marker-popup-kind:hover {
- text-decoration: underline;
-}
-
-.wasabee-marker-buttonset {
-}
-.wasabee-marker-buttonset button {
- display: block;
- width: 100%;
-}
-
-.wasabee-agent-popup {
-}
-.wasabee-agent-popup div.desc {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: #000;
- padding: 0px 4px;
-}
-
-.wasabee-agent-popup button {
- display: block;
- width: 100%;
-}
-
-.wasabee-agent-popup ul.assignments {
- color: rgb(56, 142, 60);
-}
-
-.wasabee-agent-popup li.assignment {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-
-.wasabee-anchor-popup {
-}
-.wasabee-anchor-popup div.desc {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: #000;
- padding: 0px 4px;
-}
-
-.wasabee-anchor-buttonset {
-}
-.wasabee-anchor-buttonset button {
- display: block;
- width: 100%;
-}
-
-.wasabee-wd-popup ul {
- padding-left: 1em;
-}
-
-.wasabee-marker-icon {
- background-size: cover;
-}
-
-.wasabee-marker-icon.CapturePortalMarker {
- background-image: url(../images/wasabee_markers_capture_pending.svg)
-}
-.wasabee-marker-icon.CapturePortalMarker.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_capture_assigned.svg)
-}
-.wasabee-marker-icon.CapturePortalMarker.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_capture_acknowledge.svg)
-}
-.wasabee-marker-icon.CapturePortalMarker.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_capture_done.svg)
-}
-.wasabee-marker-icon.LetDecayPortalAlert {
- background-image: url(../images/wasabee_markers_decay_pending.svg)
-}
-.wasabee-marker-icon.LetDecayPortalAlert.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_decay_assigned.svg)
-}
-.wasabee-marker-icon.LetDecayPortalAlert.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_decay_acknowledge.svg)
-}
-.wasabee-marker-icon.LetDecayPortalAlert.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_decay_done.svg)
-}
-.wasabee-marker-icon.DestroyPortalAlert {
- background-image: url(../images/wasabee_markers_destroy_pending.svg)
-}
-.wasabee-marker-icon.DestroyPortalAlert.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_destroy_assigned.svg)
-}
-.wasabee-marker-icon.DestroyPortalAlert.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_destroy_acknowledge.svg)
-}
-.wasabee-marker-icon.DestroyPortalAlert.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_destroy_done.svg)
-}
-.wasabee-marker-icon.FarmPortalMarker {
- background-image: url(../images/wasabee_markers_farm_pending.svg)
-}
-.wasabee-marker-icon.FarmPortalMarker.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_farm_assigned.svg)
-}
-.wasabee-marker-icon.FarmPortalMarker.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_farm_acknowledge.svg)
-}
-.wasabee-marker-icon.FarmPortalMarker.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_farm_done.svg)
-}
-.wasabee-marker-icon.GotoPortalMarker {
- background-image: url(../images/wasabee_markers_goto_pending.svg)
-}
-.wasabee-marker-icon.GotoPortalMarker.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_goto_assigned.svg)
-}
-.wasabee-marker-icon.GotoPortalMarker.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_goto_acknowledged.svg)
-}
-.wasabee-marker-icon.GotoPortalMarker.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_goto_done.svg)
-}
-.wasabee-marker-icon.GetKeyPortalMarker {
- background-image: url(../images/wasabee_markers_key_pending.svg)
-}
-.wasabee-marker-icon.GetKeyPortalMarker.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_key_assigned.svg)
-}
-.wasabee-marker-icon.GetKeyPortalMarker.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_key_acknowledged.svg)
-}
-.wasabee-marker-icon.GetKeyPortalMarker.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_key_done.svg)
-}
-.wasabee-marker-icon.CreateLinkAlert {
- background-image: url(../images/wasabee_markers_link_pending.svg)
-}
-.wasabee-marker-icon.CreateLinkAlert.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_link_assigned.svg)
-}
-.wasabee-marker-icon.CreateLinkAlert.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_link_acknowledged.svg)
-}
-.wasabee-marker-icon.CreateLinkAlert.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_link_done.svg)
-}
-.wasabee-marker-icon.MeetAgentPortalMarker {
- background-image: url(../images/wasabee_markers_meetagent_pending.svg)
-}
-.wasabee-marker-icon.MeetAgentPortalMarker.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_meetagent_assigned.svg)
-}
-.wasabee-marker-icon.MeetAgentPortalMarker.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_meetagent_acknowledge.svg)
-}
-.wasabee-marker-icon.MeetAgentPortalMarker.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_meetagent_done.svg)
-}
-.wasabee-marker-icon.OtherPortalAlert {
- background-image: url(../images/wasabee_markers_other_pending.svg)
-}
-.wasabee-marker-icon.OtherPortalAlert.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_other_assigned.svg)
-}
-.wasabee-marker-icon.OtherPortalAlert.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_other_acknowledge.svg)
-}
-.wasabee-marker-icon.OtherPortalAlert.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_other_done.svg)
-}
-.wasabee-marker-icon.RechargePortalAlert {
- background-image: url(../images/wasabee_markers_recharge_pending.svg)
-}
-.wasabee-marker-icon.RechargePortalAlert.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_recharge_assigned.svg)
-}
-.wasabee-marker-icon.RechargePortalAlert.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_recharge_acknowledge.svg)
-}
-.wasabee-marker-icon.RechargePortalAlert.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_recharge_done.svg)
-}
-.wasabee-marker-icon.UpgradePortalAlert {
- background-image: url(../images/wasabee_markers_upgrade_pending.svg)
-}
-.wasabee-marker-icon.UpgradePortalAlert.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_upgrade_assigned.svg)
-}
-.wasabee-marker-icon.UpgradePortalAlert.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_upgrade_acknowledge.svg)
-}
-.wasabee-marker-icon.UpgradePortalAlert.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_upgrade_done.svg)
-}
-.wasabee-marker-icon.UseVirusPortalAlert {
- background-image: url(../images/wasabee_markers_virus_pending.svg)
-}
-.wasabee-marker-icon.UseVirusPortalAlert.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_virus_assigned.svg)
-}
-.wasabee-marker-icon.UseVirusPortalAlert.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_virus_acknowledge.svg)
-}
-.wasabee-marker-icon.UseVirusPortalAlert.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_virus_done.svg)
-}
-.wasabee-marker-icon.ExcludeMarker {
- background-image: url(../images/wasabee_markers_exclude_pending.svg)
-}
-.wasabee-marker-icon.ExcludeMarker.wasabee-status-assigned {
- background-image: url(../images/wasabee_markers_exclude_assigned.svg)
-}
-.wasabee-marker-icon.ExcludeMarker.wasabee-status-acknowledged {
- background-image: url(../images/wasabee_markers_exclude_assigned.svg)
-}
-.wasabee-marker-icon.ExcludeMarker.wasabee-status-completed {
- background-image: url(../images/wasabee_markers_exclude_done.svg)
-}
-
-.wasabee-defense-icon {
- background-size: cover;
- background-image: url(../images/wasabee_markers_key_done.svg)
-}
-
-.wasabee-anchor-icon {
- background-size: 25px 41px;
-}
-.wasabee-anchor-icon.wasabee-layer-main {
- background-image: url(../images/pin_red.svg)
-}
-.wasabee-anchor-icon.wasabee-layer-groupa {
- background-image: url(../images/pin_orange.svg)
-}
-.wasabee-anchor-icon.wasabee-layer-groupb {
- background-image: url(../images/pin_yellow.svg)
-}
-.wasabee-anchor-icon.wasabee-layer-groupc {
- background-image: url(../images/pin_tan.svg)
-}
-.wasabee-anchor-icon.wasabee-layer-groupd {
- background-image: url(../images/pin_purple.svg)
-}
-.wasabee-anchor-icon.wasabee-layer-groupe {
- background-image: url(../images/pin_teal.svg)
-}
-.wasabee-anchor-icon.wasabee-layer-groupf {
- background-image: url(../images/pin_magenta.svg)
-}
-
/* all dialogs get this class -- do global stuff with it */
/* .wasabee-dialog {
background-color: rgba(250, 250, 250, 0.9);
@@ -784,22 +445,6 @@
content: " ➾ ";
}
-.wasabee-portal-comment {
- font-size: smaller;
- font-weight: lighter;
- margin-left: 12px;
-}
-
-.wasabee-portal-hardness {
- font-size: smaller;
- font-weight: lighter;
- margin-left: 12px;
-}
-
-.wasabee-portal-hardness a {
- color: #f00 !important;
-}
-
/* in our dialogs and popups, use a darker green for ENL for better contrast */
/* .wasabee-dialog a.wasabee-portal {
color: #ff6600;
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index b6694beed..946800b3e 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -62,7 +62,8 @@ function resetLinks(operation) {
if (!operation.links || operation.links.length == 0) return;
for (const l of operation.links) {
- addLink(l, operation);
+ const link = new LinkUI.WLLink(l, operation);
+ link.addTo(Wasabee.linkLayerGroup);
}
}
@@ -126,52 +127,6 @@ function resetZones(operation) {
Wasabee.zoneLayerGroup.bringToBack();
}
-// draw a single link
-function addLink(wlink, operation) {
- const latLngs = wlink.getLatLngs(operation);
- if (!latLngs) {
- console.log("LatLngs was null: op missing portal data?");
- return;
- }
-
- const color = wlink.getColor(operation);
-
- const style = L.extend(
- {
- color: color,
- },
- Wasabee.skin.linkStyle
- );
-
- if (wlink.assignedTo) style.dashArray = style.assignedDashArray;
-
- const newlink = new L.GeodesicPolyline(latLngs, style);
-
- newlink.bindPopup("loading...", {
- className: "wasabee-popup",
- closeButton: false,
- });
-
- newlink.on(
- "click",
- (ev) => {
- L.DomEvent.stop(ev);
- if (ev.target._popup._wrapper)
- ev.target._popup._wrapper.classList.add("wasabee-popup");
- const div = LinkUI.getPopup(wlink, operation);
- ev.target.setPopupContent(div);
- ev.target.openPopup(ev.latlng);
- return true;
- },
- newlink
- );
- newlink.addTo(Wasabee.linkLayerGroup);
-
- // setText only works on polylines, not geodesic ones.
- // newlink.on("mouseover", () => { console.log(newlink); // newlink.setText(" ► ", { repeat: true, attributes: { fill: "red" } }); });
- // newlink.on("mouseout", () => { newlink.setText(null); });
-}
-
// fetch and draw agent locations
export async function drawAgents() {
if (window.isLayerGroupDisplayed("Wasabee Agents") === false) return; // yes, === false, undefined == true
diff --git a/src/code/static.js b/src/code/static.js
index db3405d73..67b1db74c 100644
--- a/src/code/static.js
+++ b/src/code/static.js
@@ -6,6 +6,7 @@ W.static = {
main: require("./css/wasabee.css"),
autodraws: require("./css/autodraws.css"),
toolbar: require("./css/toolbar.css"),
+ map: require("./css/map.css"),
panes: require("./css/panes.css"),
smallScreen: require("./css/smallscreen.css"),
// fix for dialogs on mobile from iitc dev version
diff --git a/src/code/ui/agent.js b/src/code/ui/agent.js
index 8269bdd9d..ab00db528 100644
--- a/src/code/ui/agent.js
+++ b/src/code/ui/agent.js
@@ -133,24 +133,10 @@ const WLAgent = L.Marker.extend({
});
window.registerMarkerForOMS(this);
- this.bindPopup("Loading...", {
+ this.bindPopup((layer) => layer._getPopup(), {
className: "wasabee-popup",
closeButton: false,
});
- // marker.off("click", agent.openPopup, agent);
- this.on("click spiderfiedclick", this._onClick, this);
- },
-
- _onClick: async function (ev) {
- L.DomEvent.stop(ev);
- if (this.isPopupOpen && this.isPopupOpen()) return;
- const a = await WasabeeAgent.get(this.options.id);
- this.options.agent = a;
- this.setPopupContent(await this._getPopup(a));
- if (this._popup._wrapper)
- this._popup._wrapper.classList.add("wasabee-popup");
- this.update();
- this.openPopup();
},
update: function () {
@@ -169,13 +155,18 @@ const WLAgent = L.Marker.extend({
} else L.Marker.prototype.update.call(this);
},
- _getPopup: async function () {
+ _getPopup: function () {
const agent = this.options.agent;
const content = L.DomUtil.create("div", "wasabee-agent-popup");
const title = L.DomUtil.create("div", "desc", content);
title.id = agent.id;
- const fd = await formatDisplay(agent, 0);
- title.innerHTML = fd.outerHTML + timeSinceformat(agent);
+ title.textContent = agent.name;
+
+ WasabeeAgent.get(this.options.id)
+ .then(formatDisplay)
+ .then((fd) => {
+ title.innerHTML = fd.outerHTML + timeSinceformat(agent);
+ });
const sendTarget = L.DomUtil.create("button", null, content);
sendTarget.textContent = wX("SEND TARGET");
diff --git a/src/code/ui/anchor.js b/src/code/ui/anchor.js
index 98b4ac41d..b7aad09ff 100644
--- a/src/code/ui/anchor.js
+++ b/src/code/ui/anchor.js
@@ -9,6 +9,8 @@ import WasabeeAnchor from "../model/anchor";
import PortalUI from "./portal";
const WLAnchor = PortalUI.WLPortal.extend({
+ type: "anchor",
+
initialize: function (portalId, operation) {
const anchor = new WasabeeAnchor(portalId, operation);
// use newColors(anchor.color) for 0.19
diff --git a/src/code/ui/link.js b/src/code/ui/link.js
index ba88b566f..af07ce27e 100644
--- a/src/code/ui/link.js
+++ b/src/code/ui/link.js
@@ -1,16 +1,11 @@
import AssignDialog from "../dialogs/assignDialog";
+import { getSelectedOperation } from "../selectedOp";
import { convertColorToHex } from "../auxiliar";
import { addToColorList } from "../skin";
import wX from "../wX";
import PortalUI from "./portal";
-export default {
- displayFormat,
- minLevel,
- getPopup,
-};
-
// returns a DOM object appropriate for display
// do we still need the operation here?
function displayFormat(link, operation, smallScreen = false) {
@@ -82,36 +77,69 @@ function minLevel(link, operation) {
return a;
}
-function getPopup(link, operation) {
- const div = L.DomUtil.create("div", null);
- L.DomUtil.create("div", null, div).appendChild(
- displayFormat(link, operation, true)
- );
- if (link.description)
- L.DomUtil.create("div", "enl", div).textContent = link.description;
- L.DomUtil.create("div", "enl", div).textContent = "# " + link.throwOrderPos;
- const del = L.DomUtil.create("button", null, div);
- if (operation.canWrite()) {
- del.textContent = wX("DELETE_LINK");
- L.DomEvent.on(del, "click", (ev) => {
- L.DomEvent.stop(ev);
- operation.removeLink(link.fromPortalId, link.toPortalId);
- });
- const rev = L.DomUtil.create("button", null, div);
- rev.textContent = wX("REVERSE");
- L.DomEvent.on(rev, "click", (ev) => {
- L.DomEvent.stop(ev);
- operation.reverseLink(link.fromPortalId, link.toPortalId);
- });
- }
- if (operation.canWriteServer()) {
- const assignButton = L.DomUtil.create("button", null, div);
- assignButton.textContent = wX("ASSIGN");
- L.DomEvent.on(assignButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- const ad = new AssignDialog({ target: link });
- ad.enable();
+const WLLink = L.GeodesicPolyline.extend({
+ initialize: function (link, operation) {
+ const latLngs = link.getLatLngs(operation);
+ const options = L.extend(
+ {
+ color: link.getColor(operation),
+ opID: operation.ID,
+ linkID: link.ID,
+ },
+ window.plugin.wasabee.skin.linkStyle
+ );
+ if (link.assignedTo) options.dashArray = options.assignedDashArray;
+
+ L.GeodesicPolyline.prototype.initialize.call(this, latLngs, options);
+
+ this._wlink = link;
+
+ this.bindPopup((layer) => layer._getPopup(), {
+ className: "wasabee-popup",
+ closeButton: false,
});
- }
- return div;
-}
+ },
+
+ _getPopup: function () {
+ const operation = getSelectedOperation();
+ const link = this._wlink;
+ const div = L.DomUtil.create("div", "wasabee-link-popup");
+ L.DomUtil.create("div", null, div).appendChild(
+ displayFormat(link, operation)
+ );
+ if (link.description)
+ L.DomUtil.create("div", "enl", div).textContent = link.description;
+ L.DomUtil.create("div", "enl", div).textContent = "# " + link.throwOrderPos;
+ const buttonset = L.DomUtil.create("div", "buttonset", div);
+ const del = L.DomUtil.create("button", null, buttonset);
+ if (operation.canWrite()) {
+ del.textContent = wX("DELETE_LINK");
+ L.DomEvent.on(del, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ operation.removeLink(link.fromPortalId, link.toPortalId);
+ });
+ const rev = L.DomUtil.create("button", null, buttonset);
+ rev.textContent = wX("REVERSE");
+ L.DomEvent.on(rev, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ operation.reverseLink(link.fromPortalId, link.toPortalId);
+ });
+ }
+ if (operation.canWriteServer()) {
+ const assignButton = L.DomUtil.create("button", null, buttonset);
+ assignButton.textContent = wX("ASSIGN");
+ L.DomEvent.on(assignButton, "click", (ev) => {
+ L.DomEvent.stop(ev);
+ const ad = new AssignDialog({ target: link });
+ ad.enable();
+ });
+ }
+ return div;
+ },
+});
+
+export default {
+ displayFormat,
+ minLevel,
+ WLLink,
+};
diff --git a/src/code/ui/marker.js b/src/code/ui/marker.js
index ea41a8e95..c7dd426a7 100644
--- a/src/code/ui/marker.js
+++ b/src/code/ui/marker.js
@@ -12,6 +12,8 @@ import PortalUI from "./portal";
import wX from "../wX";
const WLMarker = PortalUI.WLPortal.extend({
+ type: "marker",
+
initialize: function (marker) {
PortalUI.WLPortal.prototype.initialize.call(this, {
portalId: marker.portalId,
diff --git a/src/code/ui/portal.js b/src/code/ui/portal.js
index d36fe7e93..0d6a227ae 100644
--- a/src/code/ui/portal.js
+++ b/src/code/ui/portal.js
@@ -97,37 +97,25 @@ function getSelected() {
// common part for marker and anchors
const WLPortal = L.Marker.extend({
+ type: "portal",
+
initialize: function (options) {
const operation = getSelectedOperation();
const portal = operation.getPortal(options.portalId);
options.title = portal.name;
L.Marker.prototype.initialize.call(this, portal.latLng, options);
- window.registerMarkerForOMS(this);
- },
-
- onAdd: function (map) {
- L.Marker.prototype.onAdd.call(this, map);
- this.bindPopup("loading...", {
+ this.bindPopup((layer) => layer._popupContent(), {
className: "wasabee-popup",
closeButton: false,
});
- // marker.off("click", marker.openPopup, marker);
- this.on("click spiderfiedclick", this._onClick, this);
- },
- _onClick: function (ev) {
- L.DomEvent.stop(ev);
- if (this.isPopupOpen && this.isPopupOpen()) return;
- const content = this._popupContent();
- this.setPopupContent(content);
- if (this._popup._wrapper)
- this._popup._wrapper.classList.add("wasabee-popup");
- this.update();
- this.openPopup();
+ this.off("click", this._openPopup);
+ window.registerMarkerForOMS(this);
+ this.on("spiderfiedclick", this._openPopup);
},
_popupContent: function () {
- const div = L.DomUtil.create("div", "wasabee-marker-popup");
+ const div = L.DomUtil.create("div", `wasabee-${this.type}-popup`);
return div;
},
From 89b53d09e9cea5089e24da8aebfdcb80168fddd8 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sun, 27 Jun 2021 17:13:26 +0200
Subject: [PATCH 015/275] assume new colors and move logic to ui
---
src/code/auxiliar.js | 2 +-
src/code/dialogs/exportDialog.js | 3 ++-
src/code/model/link.js | 3 +--
src/code/model/operation.js | 3 +--
src/code/ui/anchor.js | 27 ++++++++-------------------
src/code/ui/link.js | 7 +++++--
6 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/src/code/auxiliar.js b/src/code/auxiliar.js
index c8a53fea2..4ced73101 100644
--- a/src/code/auxiliar.js
+++ b/src/code/auxiliar.js
@@ -24,7 +24,7 @@ export function newColors(incoming) {
case "groupf":
return "fuchsia";
case "main":
- return "red";
+ return window.plugin.wasabee.skin.defaultOperationColor;
default:
return incoming;
}
diff --git a/src/code/dialogs/exportDialog.js b/src/code/dialogs/exportDialog.js
index a818ab23d..f1f383ec6 100644
--- a/src/code/dialogs/exportDialog.js
+++ b/src/code/dialogs/exportDialog.js
@@ -1,5 +1,6 @@
import { WDialog } from "../leafletClasses";
import { getSelectedOperation } from "../selectedOp";
+import { convertColorToHex } from "../auxiliar";
import wX from "../wX";
// export screen
@@ -51,7 +52,7 @@ const ExportDialog = WDialog.extend({
for (const link of operation.links) {
const l = {};
l.type = "polyline";
- l.color = link.getColor(operation);
+ l.color = convertColorToHex(link.getColor(operation));
l.latLngs = link.getLatLngs(operation);
output.push(l);
}
diff --git a/src/code/model/link.js b/src/code/model/link.js
index 3d2e86e7b..e70da8ea3 100644
--- a/src/code/model/link.js
+++ b/src/code/model/link.js
@@ -1,4 +1,4 @@
-import { generateId, newColors } from "../auxiliar";
+import { generateId } from "../auxiliar";
import { getSelectedOperation } from "../selectedOp";
export default class WasabeeLink {
@@ -105,7 +105,6 @@ export default class WasabeeLink {
getColor(operation) {
let color = this.color;
if (color == "main") color = operation.color;
- color = newColors(color);
return color;
}
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 23bfe507b..69709fd17 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -4,7 +4,7 @@ import WasabeeMarker from "./marker";
import WasabeeMe from "./me";
import WasabeeZone from "./zone";
import Evented from "./evented";
-import { generateId, newColors } from "../auxiliar";
+import { generateId } from "../auxiliar";
import { GetWasabeeServer } from "../server";
import { getSelectedOperation } from "../selectedOp";
import db from "../db";
@@ -28,7 +28,6 @@ export default class WasabeeOp extends Evented {
this.links = this.convertLinksToObjs(obj.links);
this.markers = this.convertMarkersToObjs(obj.markers);
this.color = obj.color ? obj.color : "main";
- this.color = newColors(this.color);
this.comment = obj.comment ? obj.comment : null;
this.teamlist = obj.teamlist ? obj.teamlist : Array();
this.fetched = obj.fetched ? obj.fetched : null;
diff --git a/src/code/ui/anchor.js b/src/code/ui/anchor.js
index b7aad09ff..8e1ca3e99 100644
--- a/src/code/ui/anchor.js
+++ b/src/code/ui/anchor.js
@@ -1,42 +1,31 @@
import LinkListDialog from "../dialogs/linkListDialog";
import { getSelectedOperation } from "../selectedOp";
import { swapPortal, deletePortal } from "../uiCommands";
-import { newColors } from "../auxiliar";
import wX from "../wX";
-import WasabeeAnchor from "../model/anchor";
-
import PortalUI from "./portal";
const WLAnchor = PortalUI.WLPortal.extend({
type: "anchor",
initialize: function (portalId, operation) {
- const anchor = new WasabeeAnchor(portalId, operation);
- // use newColors(anchor.color) for 0.19
- let layer = anchor.color;
- if (newColors(layer) == layer) layer = "custom";
+ let color = operation.color;
+ if (color == "main")
+ color = window.plugin.wasabee.skin.defaultOperationColor;
const icon = L.divIcon({
- className:
- layer != "custom"
- ? `wasabee-anchor-icon wasabee-layer-${layer}`
- : "wasabee-anchor-icon",
+ className: "wasabee-anchor-icon",
shadowUrl: null,
iconAnchor: [12, 41],
iconSize: [25, 41],
popupAnchor: [0, -35],
- html:
- layer != "custom"
- ? null
- : L.Util.template(
- ' ',
- { color: anchor.color }
- ),
+ html: L.Util.template(
+ ' ',
+ { color: color }
+ ),
});
PortalUI.WLPortal.prototype.initialize.call(this, {
portalId: portalId,
id: portalId,
- color: anchor.color,
icon: icon,
});
},
diff --git a/src/code/ui/link.js b/src/code/ui/link.js
index af07ce27e..5587d42dc 100644
--- a/src/code/ui/link.js
+++ b/src/code/ui/link.js
@@ -14,7 +14,7 @@ function displayFormat(link, operation, smallScreen = false) {
PortalUI.displayFormat(operation.getPortal(link.fromPortalId), smallScreen)
);
const arrow = L.DomUtil.create("span", "wasabee-link-seperator", d);
- arrow.style.color = link.getColor(operation);
+ arrow.style.color = convertColorToHex(link.getColor(operation));
const picker = L.DomUtil.create("input", "hidden-color-picker", arrow);
picker.type = "color";
picker.value = convertColorToHex(link.getColor(operation));
@@ -80,9 +80,12 @@ function minLevel(link, operation) {
const WLLink = L.GeodesicPolyline.extend({
initialize: function (link, operation) {
const latLngs = link.getLatLngs(operation);
+ let color = link.getColor(operation);
+ if (color == "main")
+ color = window.plugin.wasabee.skin.defaultOperationColor;
const options = L.extend(
{
- color: link.getColor(operation),
+ color: color,
opID: operation.ID,
linkID: link.ID,
},
From be4c1c61790d4f08a55f73b07ed075ab04a96665 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 1 Jul 2021 23:00:31 +0200
Subject: [PATCH 016/275] move zone drawing to ./ui
---
src/code/mapDrawing.js | 23 +++--------------------
src/code/ui/zone.js | 31 +++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 20 deletions(-)
create mode 100644 src/code/ui/zone.js
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index 946800b3e..f307a93d9 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -8,6 +8,7 @@ import LinkUI from "./ui/link";
import AnchorUI from "./ui/anchor";
import AgentUI from "./ui/agent";
import MarkerUI from "./ui/marker";
+import ZoneUI from "./ui/zone";
const Wasabee = window.plugin.wasabee;
@@ -103,26 +104,8 @@ function resetZones(operation) {
if (!operation.zones || operation.zones.length == 0) return;
for (const z of operation.zones) {
- if (z.points.length == 1) {
- L.marker(z.points[0], { color: z.color }).addTo(Wasabee.zoneLayerGroup);
- continue;
- }
- if (z.points.length == 2) {
- L.polyline(z.points, { color: z.color }).addTo(Wasabee.zoneLayerGroup);
- continue;
- }
- z.points.sort((a, b) => {
- return a.position - b.position;
- });
- L.polygon(z.points, {
- color: z.color,
- shapeOptions: {
- stroke: false,
- opacity: 0.7,
- fill: true,
- interactive: false,
- },
- }).addTo(Wasabee.zoneLayerGroup);
+ const l = new ZoneUI.WLZone(z);
+ l.addTo(Wasabee.zoneLayerGroup);
}
Wasabee.zoneLayerGroup.bringToBack();
}
diff --git a/src/code/ui/zone.js b/src/code/ui/zone.js
new file mode 100644
index 000000000..72f204506
--- /dev/null
+++ b/src/code/ui/zone.js
@@ -0,0 +1,31 @@
+const zoneShape = {
+ stroke: false,
+ opacity: 0.7,
+ fill: true,
+ interactive: false,
+};
+
+const WLZone = L.LayerGroup.extend({
+ initialize: function (zone) {
+ zone.points.sort((a, b) => {
+ return a.position - b.position;
+ });
+ let layer;
+ if (zone.points.length == 1)
+ layer = L.marker(zone.points[0], {
+ icon: L.divIcon.coloredSvg(zone.color),
+ });
+ else if (zone.points.length == 2)
+ layer = L.polyline(zone.points, { color: zone.color });
+ else
+ layer = L.polygon(zone.points, {
+ color: zone.color,
+ shapeOptions: zoneShape,
+ });
+ L.LayerGroup.prototype.initialize.call(this, [layer]);
+ },
+});
+
+export default {
+ WLZone,
+};
From 2027f3790efd36703fc0e5d771eed6fa72a9d9ce Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Fri, 2 Jul 2021 11:13:36 +0200
Subject: [PATCH 017/275] remove anchor model
---
src/code/dialogs/assignDialog.js | 6 ++--
src/code/dialogs/sendTargetDialog.js | 6 ++--
src/code/model/anchor.js | 50 ----------------------------
3 files changed, 6 insertions(+), 56 deletions(-)
delete mode 100644 src/code/model/anchor.js
diff --git a/src/code/dialogs/assignDialog.js b/src/code/dialogs/assignDialog.js
index 6fd8bc2d8..7c3bd7e15 100644
--- a/src/code/dialogs/assignDialog.js
+++ b/src/code/dialogs/assignDialog.js
@@ -1,7 +1,7 @@
import { WDialog } from "../leafletClasses";
import WasabeeLink from "../model/link";
import WasabeeMarker from "../model/marker";
-import WasabeeAnchor from "../model/anchor";
+import WasabeePortal from "../model/portal";
import WasabeeMe from "../model/me";
import WasabeeTeam from "../model/team";
import wX from "../wX";
@@ -79,8 +79,8 @@ const AssignDialog = WDialog.extend({
menu.prepend(t);
}
- if (target instanceof WasabeeAnchor) {
- const portal = operation.getPortal(target.portalId);
+ if (target instanceof WasabeePortal) {
+ const portal = target;
this._type = "Anchor";
this._name = wX("ASSIGN OUTBOUND PROMPT", {
portalName: PortalUI.displayName(portal),
diff --git a/src/code/dialogs/sendTargetDialog.js b/src/code/dialogs/sendTargetDialog.js
index ca2aa30a9..518a7e7cc 100644
--- a/src/code/dialogs/sendTargetDialog.js
+++ b/src/code/dialogs/sendTargetDialog.js
@@ -1,6 +1,6 @@
import { WDialog } from "../leafletClasses";
import WasabeeMarker from "../model/marker";
-import WasabeeAnchor from "../model/anchor";
+import WasabeePortal from "../model/portal";
import WasabeeMe from "../model/me";
import WasabeeTeam from "../model/team";
import { targetPromise } from "../server";
@@ -58,8 +58,8 @@ const SendTargetDialog = WDialog.extend({
menu.prepend(t);
}
- if (this.options.target instanceof WasabeeAnchor) {
- const portal = operation.getPortal(this.options.target.portalId);
+ if (this.options.target instanceof WasabeePortal) {
+ const portal = this.options.target;
this._targettype = "anchor";
divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
const t = L.DomUtil.create("label", null);
diff --git a/src/code/model/anchor.js b/src/code/model/anchor.js
deleted file mode 100644
index 732ba0e74..000000000
--- a/src/code/model/anchor.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import { getSelectedOperation } from "../selectedOp";
-
-// this class is for the popups, and for assign menu
-export default class WasabeeAnchor {
- constructor(portalId) {
- const op = getSelectedOperation();
- this.ID = portalId;
- this.portalId = portalId;
- this.type = "anchor";
- this.comment = null;
- this.state = null;
- this.assignedTo = null;
- this.order = 0;
-
- this._portal = op.getPortal(this.ID);
- this.color = op.color;
- this._opID = op.ID;
- }
-
- // currently unused
- toJSON() {
- return {
- ID: this.ID,
- portalId: this.portalId,
- type: this.type,
- comment: this.coment,
- state: this.state,
- assignedTo: this.assignedTo,
- order: this.order,
- color: this.color,
- };
- }
-
- // pointless, since these are never pushed to the server
- set opOrder(o) {
- this.order = Number.parseInt(o, 10);
- }
-
- get opOrder() {
- return this.order;
- }
-
- get name() {
- return this._portal.name;
- }
-
- get latLng() {
- return this._portal.latLng;
- }
-}
From a491972995b8b71078d62d10a77c865eeb11bfa5 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Fri, 2 Jul 2021 11:14:47 +0200
Subject: [PATCH 018/275] remove unused return
---
src/code/ui/portal.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/code/ui/portal.js b/src/code/ui/portal.js
index 0d6a227ae..2a057e21c 100644
--- a/src/code/ui/portal.js
+++ b/src/code/ui/portal.js
@@ -167,7 +167,6 @@ const WLPortal = L.Marker.extend({
ad.enable();
this.closePopup();
});
- return assignButton;
},
_deleteButton: function (container, text) {
@@ -189,7 +188,6 @@ const WLPortal = L.Marker.extend({
std.enable();
this.closePopup();
});
- return sendButton;
},
_mapButton: function (container, text) {
From a63828dd6c2f6f43a88b7e21cc4bb8cfb5d5424f Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Fri, 2 Jul 2021 12:48:18 +0200
Subject: [PATCH 019/275] model default values
---
src/code/model/agent.js | 8 ++++----
src/code/model/link.js | 8 ++++++--
src/code/model/marker.js | 8 ++++----
src/code/model/operation.js | 2 +-
4 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/code/model/agent.js b/src/code/model/agent.js
index 3d13ab083..bf2332b21 100644
--- a/src/code/model/agent.js
+++ b/src/code/model/agent.js
@@ -23,11 +23,11 @@ export default class WasabeeAgent {
this.intelname = obj.intelname;
this.intelfaction = obj.intelfaction;
this.level = obj.level ? Number(obj.level) : 0;
- this.enlid = obj.enlid ? obj.enlid : 0;
+ this.enlid = obj.enlid ? obj.enlid : null;
this.pic = obj.pic ? obj.pic : null;
- this.Vverified = obj.Vverified ? obj.Vverified : false;
- this.blacklisted = obj.blacklisted ? obj.blacklisted : false;
- this.rocks = obj.rocks ? obj.rocks : false;
+ this.Vverified = !!obj.Vverified;
+ this.blacklisted = !!obj.blacklisted;
+ this.rocks = !!obj.rocks;
this.lat = obj.lat ? obj.lat : 0;
this.lng = obj.lng ? obj.lng : 0;
this.date = obj.date ? obj.date : null; // last location sub, not fetched
diff --git a/src/code/model/link.js b/src/code/model/link.js
index e70da8ea3..aa2011988 100644
--- a/src/code/model/link.js
+++ b/src/code/model/link.js
@@ -6,14 +6,18 @@ export default class WasabeeLink {
this.ID = obj.ID ? obj.ID : generateId();
this.fromPortalId = obj.fromPortalId;
this.toPortalId = obj.toPortalId;
- this.description = obj.description ? obj.description : null;
- this.assignedTo = obj.assignedTo ? obj.assignedTo : "";
+ this.description = obj.description;
+ this.assignedTo = obj.assignedTo ? obj.assignedTo : null;
this.throwOrderPos = obj.throwOrderPos ? Number(obj.throwOrderPos) : 0;
this.color = obj.color ? obj.color : "main";
this.completed = obj.completed ? !!obj.completed : false;
this.zone = obj.zone ? Number(obj.zone) : 1;
}
+ assign(gid) {
+ this.assignedTo = gid ? gid : null;
+ }
+
// build object to serialize
toJSON() {
return {
diff --git a/src/code/model/marker.js b/src/code/model/marker.js
index 0618026f3..94c181ae7 100644
--- a/src/code/model/marker.js
+++ b/src/code/model/marker.js
@@ -37,12 +37,12 @@ export default class WasabeeMarker {
this.ID = obj.ID ? obj.ID : generateId();
this.portalId = obj.portalId;
this.type = obj.type;
- this.comment = obj.comment ? obj.comment : ""; // why "" and not null? This isn't go
- this.completedID = obj.completedID ? obj.completedID : "";
+ this.comment = obj.comment;
+ this.completedID = obj.completedID ? obj.completedID : null;
this.order = obj.order ? Number(obj.order) : 0;
this.zone = obj.zone ? Number(obj.zone) : 1;
- this.assign(obj.assignedTo); // WAS this.assignedTo = obj.assignedTo ? obj.assignedTo : "";
+ this.assign(obj.assignedTo); // WAS this.assignedTo = obj.assignedTo ? obj.assignedTo : null;
// if ._state then it came from indexeddb, otherwise from server/localStorage
if (obj._state) {
this.state = obj._state;
@@ -75,7 +75,7 @@ export default class WasabeeMarker {
assign(gid) {
if (!gid || gid == "") {
this._state = STATE_UNASSIGNED;
- this.assignedTo = "";
+ this.assignedTo = null;
return;
}
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 69709fd17..c200b385b 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -835,7 +835,7 @@ export default class WasabeeOp extends Evented {
assignLink(id, gid) {
for (const v of this.links) {
if (v.ID == id) {
- v.assignedTo = gid;
+ v.assign(gid);
this.update(true);
}
}
From 6117d0e59117d3eb42faabda48e363a364a7ef02 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 10 Jul 2021 10:31:03 +0200
Subject: [PATCH 020/275] fix: portal team is part of UI
---
src/code/ui/portal.js | 1 +
src/code/uiCommands.js | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/code/ui/portal.js b/src/code/ui/portal.js
index 2a057e21c..95bbff0dd 100644
--- a/src/code/ui/portal.js
+++ b/src/code/ui/portal.js
@@ -228,5 +228,6 @@ export default {
displayFormat,
get,
getSelected,
+ team,
WLPortal,
};
diff --git a/src/code/uiCommands.js b/src/code/uiCommands.js
index 6cd4c0cc8..64947dbbd 100644
--- a/src/code/uiCommands.js
+++ b/src/code/uiCommands.js
@@ -366,7 +366,7 @@ export function blockerAutomark(operation, first = true) {
// add marker
let type = WasabeeMarker.constants.MARKER_TYPE_DESTROY;
- if (wportal.team == "E") {
+ if (PortalUI.team(wportal) == "E") {
type = WasabeeMarker.constants.MARKER_TYPE_VIRUS;
}
const zone = operation.determineZone(wportal.latLng);
From 19e9b548c29ab3f625f8a40b513ac52b07ed7c8c Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 19 Jul 2021 10:28:42 +0200
Subject: [PATCH 021/275] add blockers(_portals) to db
---
src/code/db.js | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/code/db.js b/src/code/db.js
index ede9a7200..2b2f7feff 100644
--- a/src/code/db.js
+++ b/src/code/db.js
@@ -1,6 +1,6 @@
import { openDB } from "idb";
-const version = 2;
+const version = 3;
// XXX audit these to make sure all the various indexes are used
const db = openDB("wasabee", version, {
@@ -27,6 +27,22 @@ const db = openDB("wasabee", version, {
ops.createIndex("fetched", "fetched");
ops.createIndex("server", "server");
}
+ if (oldVersion < 3) {
+ // { opID, from, to }
+ const blockers = db.createObjectStore("blockers", {
+ keyPath: ["opID", "from", "to"],
+ });
+ blockers.createIndex("opID", "opID", { unique: false });
+ blockers.createIndex("from", ["opID", "from"], { unique: false });
+ blockers.createIndex("to", ["opID", "to"], { unique: false });
+
+ // portals for blockers
+ // { id, lat, lng, name }
+ const portals = db.createObjectStore("blockers_portals", {
+ keyPath: ["opID", "id"],
+ });
+ portals.createIndex("opID", "opID", { unique: false });
+ }
/* if (oldVersion < 3) {
const teams = tx.objectStore("teams");
teams.createIndex("_agents", "_agents[].id");
From 657052f49874f4e41cc9b53a8cd8120a1dd80e15 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 10 Jul 2021 10:09:23 +0200
Subject: [PATCH 022/275] move blockers away from op object
---
src/code/dialogs/blockersList.js | 44 +++++-----
src/code/dialogs/markerChangeDialog.js | 2 +
src/code/dialogs/mergeDialog.js | 2 -
src/code/dialogs/trawl.js | 9 +-
src/code/model/blocker.js | 109 +++++++++++++++++++++++++
src/code/model/operation.js | 72 +++-------------
src/code/server.js | 2 -
src/code/uiCommands.js | 65 +++++++++------
8 files changed, 192 insertions(+), 113 deletions(-)
create mode 100644 src/code/model/blocker.js
diff --git a/src/code/dialogs/blockersList.js b/src/code/dialogs/blockersList.js
index 9816be0ab..e4fe4478a 100644
--- a/src/code/dialogs/blockersList.js
+++ b/src/code/dialogs/blockersList.js
@@ -9,6 +9,7 @@ import {
} from "../uiCommands";
import wX from "../wX";
import TrawlDialog from "./trawl";
+import WasabeeBlocker from "../model/blocker";
import PortalUI from "../ui/portal";
@@ -40,9 +41,9 @@ const BlockerList = WDialog.extend({
window.removeHook("portalDetailLoaded", listenForPortalDetails);
},
- _displayDialog: function () {
+ _displayDialog: async function () {
const operation = getSelectedOperation();
- this.sortable = this._getListDialogContent(0, false); // defaults to sorting by op order
+ this.sortable = await this._getListDialogContent(0, false); // defaults to sorting by op order
loadFaked(operation);
const buttons = {};
buttons[wX("OK")] = () => {
@@ -52,9 +53,9 @@ const BlockerList = WDialog.extend({
const operation = getSelectedOperation();
blockerAutomark(operation);
};
- buttons[wX("RESET")] = () => {
+ buttons[wX("RESET")] = async () => {
const operation = getSelectedOperation();
- operation.blockers = new Array();
+ await WasabeeBlocker.removeBlockers(operation);
this.update();
operation.update(false); // blockers do not need to be sent to server
window.map.fire("wasabee:crosslinks");
@@ -69,9 +70,11 @@ const BlockerList = WDialog.extend({
};
buttons["Clear Automark"] = () => {
const operation = getSelectedOperation();
+ operation.startBatchMode();
for (const m of operation.markers) {
if (m.comment == "auto-marked") operation.removeMarker(m);
}
+ operation.endBatchMode();
};
this.createDialog({
@@ -85,10 +88,10 @@ const BlockerList = WDialog.extend({
},
// when op changed or crosslink ended
- update: function () {
+ update: async function () {
const operation = getSelectedOperation();
if (!this._enabled) return;
- this.sortable = this._getListDialogContent(
+ this.sortable = await this._getListDialogContent(
this.sortable.sortBy,
this.sortable.sortAsc
);
@@ -97,28 +100,28 @@ const BlockerList = WDialog.extend({
},
// because the sortable values depend on the operation, we can't have it created at addHooks unless we want a lot of getSelectedOperations embedded here
- _getListDialogContent(sortBy, sortAsc) {
+ async _getListDialogContent(sortBy, sortAsc) {
const operation = getSelectedOperation();
const content = new Sortable();
+
+ const blockers = await WasabeeBlocker.getAll(operation);
+
content.fields = [
{
name: wX("FROM_PORT"),
value: (blocker) => {
- return operation.getPortal(blocker.fromPortalId).name;
+ return blocker.fromPortal.name;
},
sort: (a, b) => a.localeCompare(b),
format: (row, value, blocker) => {
- const p = operation.getPortal(blocker.fromPortalId);
- row.appendChild(PortalUI.displayFormat(p));
+ row.appendChild(PortalUI.displayFormat(blocker.fromPortal));
},
},
{
name: this._smallScreen ? "#" : wX("COUNT"),
value: (blocker) => {
- const c = operation.blockers.filter(
- (b) =>
- b.fromPortalId == blocker.fromPortalId ||
- b.toPortalID == blocker.fromPortalId
+ const c = blockers.filter(
+ (b) => b.from == blocker.from || b.to == blocker.from
);
return c.length;
},
@@ -127,21 +130,18 @@ const BlockerList = WDialog.extend({
{
name: wX("TO_PORT"),
value: (blocker) => {
- return operation.getPortal(blocker.toPortalId).name;
+ return blocker.toPortal.name;
},
sort: (a, b) => a.localeCompare(b),
format: (row, value, blocker) => {
- const p = operation.getPortal(blocker.toPortalId);
- row.appendChild(PortalUI.displayFormat(p));
+ row.appendChild(PortalUI.displayFormat(blocker.toPortal));
},
},
{
name: this._smallScreen ? "#" : wX("COUNT"),
value: (blocker) => {
- const c = operation.blockers.filter(
- (b) =>
- b.fromPortalId == blocker.toPortalId ||
- b.toPortalId == blocker.toPortalId
+ const c = blockers.filter(
+ (b) => b.from == blocker.to || b.to == blocker.to
);
return c.length;
},
@@ -150,7 +150,7 @@ const BlockerList = WDialog.extend({
];
content.sortBy = sortBy;
content.sortAsc = sortAsc;
- content.items = operation.blockers;
+ content.items = blockers;
return content;
},
});
diff --git a/src/code/dialogs/markerChangeDialog.js b/src/code/dialogs/markerChangeDialog.js
index 4f24c7062..308de782a 100644
--- a/src/code/dialogs/markerChangeDialog.js
+++ b/src/code/dialogs/markerChangeDialog.js
@@ -49,12 +49,14 @@ const MarkerChangeDialog = WDialog.extend({
WasabeeMarker.markerTypes.has(this._type.value) &&
!markers.has(this._type.value)
) {
+ operation.startBatchMode();
operation.removeMarker(this.options.marker);
operation.addMarker(this._type.value, portal, {
zone: this.options.marker.zone,
comment: this.options.marker.comment,
assign: this.options.marker.assignedTo,
});
+ operation.endBatchMode();
}
this.closeDialog();
};
diff --git a/src/code/dialogs/mergeDialog.js b/src/code/dialogs/mergeDialog.js
index fe619e7a9..3f76757a5 100644
--- a/src/code/dialogs/mergeDialog.js
+++ b/src/code/dialogs/mergeDialog.js
@@ -43,8 +43,6 @@ const MergeDialog = WDialog.extend({
},
useServer: async function () {
- // merge blockers and related portals
- this.options.opRemote.mergeBlockers(this.options.opOwn);
await this.options.opRemote.store();
if (getSelectedOperation().ID == this.options.opRemote.ID)
await makeSelectedOperation(this.options.opRemote.ID);
diff --git a/src/code/dialogs/trawl.js b/src/code/dialogs/trawl.js
index 35a83ac32..75a611b67 100644
--- a/src/code/dialogs/trawl.js
+++ b/src/code/dialogs/trawl.js
@@ -4,6 +4,7 @@ import { getSelectedOperation } from "../selectedOp";
import { blockerAutomark } from "../uiCommands";
import VLatLon from "geodesy/latlon-ellipsoidal-vincenty";
import WasabeeMarker from "../model/marker";
+import WasabeeBlocker from "../model/blocker";
const TrawlerDialog = WDialog.extend({
statics: {
@@ -227,10 +228,10 @@ const TrawlDialog = WDialog.extend({
const button = L.DomUtil.create("button", null, container);
button.textContent = wX("TRAWL");
- L.DomEvent.on(button, "click", () => {
+ L.DomEvent.on(button, "click", async () => {
const op = getSelectedOperation();
if (clearMarkers.checked == true) this._clearMarkers();
- op.blockers = Array();
+ await WasabeeBlocker.removeBlockers(op);
const points = this._getTrawlPoints();
const td = new TrawlerDialog({
points: points,
@@ -245,9 +246,9 @@ const TrawlDialog = WDialog.extend({
crazyWarning.textContent = wX("TRAWL_BULK_LOAD_WARNING");
const crazyButton = L.DomUtil.create("button", null, container);
crazyButton.textContent = wX("TRAWL_BULK_LOAD");
- L.DomEvent.on(crazyButton, "click", () => {
+ L.DomEvent.on(crazyButton, "click", async () => {
const op = getSelectedOperation();
- op.blockers = Array();
+ await WasabeeBlocker.removeBlockers(op);
if (clearMarkers.checked == true) this._clearMarkers();
const points = this._getTrawlPoints();
this._bulkLoad(points, 14);
diff --git a/src/code/model/blocker.js b/src/code/model/blocker.js
new file mode 100644
index 000000000..dabef533c
--- /dev/null
+++ b/src/code/model/blocker.js
@@ -0,0 +1,109 @@
+import db from "../db";
+
+export default class WasabeeBlocker {
+ constructor(obj) {
+ this.opID = obj.opID;
+ this.from = obj.fromPortal.id;
+ this.to = obj.toPortal.id;
+ }
+
+ static async addPortal(op, portal) {
+ const store = await (await db).transaction("blockers_portals", "readwrite")
+ .store;
+ const ent = {
+ opID: op.ID,
+ id: portal.id,
+ name: portal.name,
+ lat: portal.lat,
+ lng: portal.lng,
+ };
+ if (ent.id === ent.name) {
+ const p = await store.get([op.ID, ent.id]);
+ if (p && p.name !== p.id) ent.name = p.name;
+ }
+ await store.put(ent);
+ }
+
+ static async updatePortal(op, portal) {
+ const store = (await db).transaction("blockers_portals", "readwrite").store;
+ if (portal.name === portal.id) return;
+ const p = await store.get([op.ID, portal.id]);
+ if (!p) return;
+ await store.put({
+ opID: op.ID,
+ id: portal.id,
+ name: portal.name,
+ lat: portal.lat,
+ lng: portal.lng,
+ });
+ return true;
+ }
+
+ static async removeBlocker(op, portalId) {
+ const store = (await db).transaction("blockers", "readwrite").store;
+ let cursor = await store
+ .index("from")
+ .openKeyCursor(IDBKeyRange.only([op.ID, portalId]));
+ while (cursor) {
+ store.delete(cursor.primaryKey);
+ cursor = await cursor.continue();
+ }
+ cursor = await store
+ .index("to")
+ .openKeyCursor(IDBKeyRange.only([op.ID, portalId]));
+ while (cursor) {
+ store.delete(cursor.primaryKey);
+ cursor = await cursor.continue();
+ }
+ await (await db).delete("blockers_portals", [op.ID, portalId]);
+ }
+
+ static async removeBlockers(op) {
+ let store = (await db).transaction("blockers", "readwrite").store;
+ let cursor = await store
+ .index("opID")
+ .openKeyCursor(IDBKeyRange.only(op.ID));
+ while (cursor) {
+ store.delete(cursor.primaryKey);
+ cursor = await cursor.continue();
+ }
+ store = (await db).transaction("blockers_portals", "readwrite").store;
+ cursor = await store.index("opID").openKeyCursor(IDBKeyRange.only(op.ID));
+ while (cursor) {
+ store.delete(cursor.primaryKey);
+ cursor = await cursor.continue();
+ }
+ }
+
+ static async addBlocker(op, wlink) {
+ const fromPortal = op.getPortal(wlink.fromPortalId);
+ const toPortal = op.getPortal(wlink.toPortalId);
+ const blocker = new WasabeeBlocker({
+ opID: op.ID,
+ fromPortal: fromPortal,
+ toPortal: toPortal,
+ });
+ await (await db).put("blockers", blocker);
+ // to store portals
+ await WasabeeBlocker.addPortal(op, fromPortal);
+ await WasabeeBlocker.addPortal(op, toPortal);
+ }
+
+ static async getAll(op) {
+ const blockers = await (
+ await db
+ ).getAllFromIndex("blockers", "opID", op.ID);
+ const portals = await (
+ await db
+ ).getAllFromIndex("blockers_portals", "opID", op.ID);
+ const portalsMap = new Map();
+ for (const p of portals) {
+ portalsMap.set(p.id, p);
+ }
+ for (const b of blockers) {
+ b.fromPortal = portalsMap.get(b.from);
+ b.toPortal = portalsMap.get(b.to);
+ }
+ return blockers.filter((b) => b.fromPortal && b.toPortal);
+ }
+}
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index c200b385b..3eb4e75c4 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -1,4 +1,5 @@
import WasabeeLink from "./link";
+import WasabeeBlocker from "./blocker";
import WasabeePortal from "./portal";
import WasabeeMarker from "./marker";
import WasabeeMe from "./me";
@@ -33,7 +34,6 @@ export default class WasabeeOp extends Evented {
this.fetched = obj.fetched ? obj.fetched : null;
this.stored = obj.stored ? obj.stored : null;
this.localchanged = obj.localchanged === false ? obj.localchanged : true;
- this.blockers = this.convertBlockersToObjs(obj.blockers);
this.keysonhand = obj.keysonhand ? obj.keysonhand : Array();
this.zones = this.convertZonesToObjs(obj.zones);
// this.modified = obj.modified ? obj.modified : null;
@@ -50,7 +50,6 @@ export default class WasabeeOp extends Evented {
if (!this.links) this.links = new Array();
if (!this.markers) this.markers = new Array();
- if (!this.blockers) this.blockers = new Array();
const opportals = this.convertPortalsToObjs(obj.opportals);
this._idToOpportals = new Map();
@@ -116,7 +115,6 @@ export default class WasabeeOp extends Evented {
json.fetched = this.fetched;
json.stored = this.stored;
json.localchanged = this.localchanged;
- json.blockers = this.blockers;
json.keysonhand = this.keysonhand;
json.teamlist = this.teamlist;
json.background = this.background;
@@ -221,10 +219,6 @@ export default class WasabeeOp extends Evented {
m.portalId = rename.get(m.portalId);
}
this.anchors = this.anchors.map((a) => rename.get(a));
- for (const b of this.blockers) {
- b.fromPortalId = rename.get(b.fromPortalId);
- b.toPortalId = rename.get(b.toPortalId);
- }
for (const id of toRemove) this._idToOpportals.delete(id);
}
@@ -502,33 +496,25 @@ export default class WasabeeOp extends Evented {
for (const a of this.anchors) {
newPortals.set(a, this._idToOpportals.get(a));
}
- for (const b of this.blockers) {
- newPortals.set(b.fromPortalId, this._idToOpportals.get(b.fromPortalId));
- newPortals.set(b.toPortalId, this._idToOpportals.get(b.toPortalId));
- }
// sanitize OP if it get corrupt by my code elsewhere...
const missingPortal = new Set();
- let corrupt =
- this.links.length + this.markers.length + this.blockers.length;
+ let corrupt = this.links.length + this.markers.length;
for (const [id, v] of newPortals) {
if (v === undefined) {
this.links = this.links.filter(
(l) => l.fromPortalId != id && l.toPortalId != id
);
this.markers = this.markers.filter((m) => m.portalId != id);
- this.blockers = this.blockers.filter(
- (b) => b.fromPortalId != id && b.toPortalId != id
- );
missingPortal.add(id);
}
}
- corrupt -= this.links.length + this.markers.length + this.blockers.length;
+ corrupt -= this.links.length + this.markers.length;
if (missingPortal.size > 0) {
// leave some trace
console.trace("op corruption: missing portals");
alert(
- `Oops, something went wrong and OP ${this.name} got corrupted. Fix by removing ${missingPortal.size} missing portals and ${corrupt} links/markers/blockers. Please check your OP and report to the devs.`
+ `Oops, something went wrong and OP ${this.name} got corrupted. Fix by removing ${missingPortal.size} missing portals and ${corrupt} links/markers. Please check your OP and report to the devs.`
);
this.cleanAnchorList();
for (const id of missingPortal) newPortals.delete(id);
@@ -596,9 +582,8 @@ export default class WasabeeOp extends Evented {
if (m.portalId == old.id) m.portalId = fake.id;
}
// remove blockers on the old portal
- this.blockers = this.blockers.filter(
- (b) => b.fromPortalId != old.id && b.toPortalId != old.id
- );
+ WasabeeBlocker.removeBlocker(this, old.id);
+
this._idToOpportals.delete(old.id);
// add the new portal so any data related to the real portal (keys) still works
this._addPortal(portal);
@@ -625,10 +610,7 @@ export default class WasabeeOp extends Evented {
for (const m of this.markers) {
if (m.portalId == old.id) m.portalId = portal.id;
}
- for (const b of this.blockers) {
- if (b.fromPortalId == old.id) b.fromPortalId = portal.id;
- if (b.toPortalId == old.id) b.toPortalId = portal.id;
- }
+
this._idToOpportals.delete(old.id);
//this.opportals = Array.from(this._idToOpportals.values());
@@ -703,27 +685,9 @@ export default class WasabeeOp extends Evented {
}
}
- containsBlocker(link) {
- if (!this.blockers || this.blockers.length == 0) return false;
-
- for (const l of this.blockers) {
- if (
- l.fromPortalId == link.fromPortalId &&
- l.toPortalId == link.toPortalId
- ) {
- return true;
- }
- }
- return false;
- }
-
addBlocker(link) {
if (!link.fromPortalId || !link.toPortalId) return;
- if (!this.containsBlocker(link)) {
- this.blockers.push(link);
- // this.update(false); // can trigger a redraw-storm, just skip
- // this.store(); // do not await, let it happen in the background -- ideally now blockers should not be part of the op json, but stored independently in indexeddb
- }
+ WasabeeBlocker.addBlocker(this, link);
}
get fakedPortals() {
@@ -811,9 +775,7 @@ export default class WasabeeOp extends Evented {
];
if (destructMarkerTypes.includes(markerType)) {
// remove related blockers
- this.blockers = this.blockers.filter(
- (b) => b.fromPortalId !== portal.id && b.toPortalId !== portal.id
- );
+ WasabeeBlocker.removeBlocker(this, portal.id);
}
this.update(true);
@@ -845,7 +807,6 @@ export default class WasabeeOp extends Evented {
this.anchors = Array();
this.links = Array();
this.markers = Array();
- this.blockers = Array();
this._idToOpportals.clear();
this._coordsToOpportals.clear();
@@ -854,7 +815,6 @@ export default class WasabeeOp extends Evented {
clearAllLinks() {
this.links = Array();
- this.blockers = Array();
this.cleanAnchorList();
this.cleanPortalList();
this.update(true);
@@ -1293,14 +1253,6 @@ export default class WasabeeOp extends Evented {
return this.localchanged;
}
- mergeBlockers(op) {
- // merge portals
- for (const p of op.opportals) {
- this._addPortal(p);
- }
- for (const b of op.blockers) this.blockers.push(b); // do not use addBlocker
- }
-
mergeZones(op) {
const ids = new Set();
let count = 0;
@@ -1347,8 +1299,10 @@ export default class WasabeeOp extends Evented {
},
};
- // merge *portals* and blockers
- this.mergeBlockers(op);
+ // merge *portals*
+ for (const p of op.opportals) {
+ this._addPortal(p);
+ }
// add missing zones
summary.addition.zone = this.mergeZones(op);
diff --git a/src/code/server.js b/src/code/server.js
index f4b01b3f4..0a7d32e9b 100644
--- a/src/code/server.js
+++ b/src/code/server.js
@@ -22,8 +22,6 @@ export async function uploadOpPromise() {
const newme = new WasabeeMe(response);
newme.store();
const newop = await opPromise(operation.ID);
- // merge blockers and related portals
- newop.mergeBlockers(operation);
newop.localchanged = false;
await newop.store();
return newop;
diff --git a/src/code/uiCommands.js b/src/code/uiCommands.js
index 64947dbbd..63de31018 100644
--- a/src/code/uiCommands.js
+++ b/src/code/uiCommands.js
@@ -1,5 +1,6 @@
import WasabeeOp from "./model/operation";
import WasabeePortal from "./model/portal";
+import WasabeeBlocker from "./model/blocker";
import WasabeeMarker from "./model/marker";
import ConfirmDialog from "./dialogs/confirmDialog";
import MergeDialog from "./dialogs/mergeDialog";
@@ -134,15 +135,15 @@ export function listenForAddedPortals(newPortal) {
export function listenForPortalDetails(e) {
if (!e.success) return;
+ const portal = new WasabeePortal({
+ id: e.guid,
+ name: e.details.title,
+ lat: (e.details.latE6 / 1e6).toFixed(6),
+ lng: (e.details.lngE6 / 1e6).toFixed(6),
+ });
const op = getSelectedOperation();
- op.updatePortal(
- new WasabeePortal({
- id: e.guid,
- name: e.details.title,
- lat: (e.details.latE6 / 1e6).toFixed(6),
- lng: (e.details.lngE6 / 1e6).toFixed(6),
- })
- );
+ op.updatePortal(portal);
+ WasabeeBlocker.updatePortal(op, portal);
}
// This is what should be called to add to the queue
@@ -317,25 +318,47 @@ export function testPortal(recursed = false) {
}
// recursive function to auto-mark blockers
-export function blockerAutomark(operation, first = true) {
- if (first) operation.startBatchMode();
+export async function blockerAutomark(operation, first = true) {
+ const blockers = await WasabeeBlocker.getAll(operation);
+ if (first) {
+ operation.startBatchMode();
+ // add blocker portals
+ for (const b of blockers) {
+ operation._addPortal(
+ new WasabeePortal({
+ id: b.from,
+ name: b.fromPortal.name,
+ lat: b.fromPortal.lat,
+ lng: b.fromPortal.lng,
+ })
+ );
+ operation._addPortal(
+ new WasabeePortal({
+ id: b.to,
+ name: b.toPortal.name,
+ lat: b.toPortal.lat,
+ lng: b.toPortal.lng,
+ })
+ );
+ }
+ }
// build count list
const portals = new Array();
- for (const b of operation.blockers) {
+ for (const b of blockers) {
if (
!operation.containsMarkerByID(
- b.fromPortalId,
+ b.from,
WasabeeMarker.constants.MARKER_TYPE_EXCLUDE
)
)
- portals.push(b.fromPortalId);
+ portals.push(b.from);
if (
!operation.containsMarkerByID(
- b.toPortalId,
+ b.to,
WasabeeMarker.constants.MARKER_TYPE_EXCLUDE
)
)
- portals.push(b.toPortalId);
+ portals.push(b.to);
}
const reduced = {};
for (const p of portals) {
@@ -373,12 +396,10 @@ export function blockerAutomark(operation, first = true) {
operation.addMarker(type, wportal, { comment: "auto-marked", zone: zone });
// remove nodes from blocker list
- operation.blockers = operation.blockers.filter((b) => {
- if (b.fromPortalId == portalId || b.toPortalId == portalId) return false;
- return true;
- });
+ await WasabeeBlocker.removeBlocker(operation, portalId);
+
// recurse
- blockerAutomark(operation, false);
+ await blockerAutomark(operation, false);
if (first) operation.endBatchMode();
}
@@ -407,8 +428,6 @@ export async function updateLocalOp(local, remote) {
// no changes
if (!op.checkChanges()) {
- // merge blockers and related portals
- remote.mergeBlockers(op);
await remote.store();
// if selected op, reload from the new op
return remote.ID === so.ID;
@@ -504,8 +523,6 @@ export async function syncOp(opID) {
const remoteOp = await opPromise(opID);
if (remoteOp.lasteditid != localOp.lasteditid) {
if (!localOp.localchanged) {
- // merge blockers and related portals
- remoteOp.mergeBlockers(localOp);
await remoteOp.store();
} else {
const con = new MergeDialog({
From f6c22a634ae16221b4effe013fdc459579d5b9d3 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 10 Jul 2021 18:58:46 +0200
Subject: [PATCH 023/275] change op.addBlocker
---
src/code/crosslinks.js | 8 +-------
src/code/model/blocker.js | 4 +---
src/code/model/operation.js | 5 ++---
3 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/src/code/crosslinks.js b/src/code/crosslinks.js
index c7818825f..dd186dba1 100644
--- a/src/code/crosslinks.js
+++ b/src/code/crosslinks.js
@@ -188,7 +188,6 @@ function testLink(link, operation) {
(link.options.data.oLngE6 / 1e6).toFixed(6),
link.options.data.oGuid
);
- operation._addPortal(fromPortal);
let toPortal = PortalUI.get(link.options.data.dGuid);
if (!toPortal)
toPortal = WasabeePortal.fake(
@@ -196,12 +195,7 @@ function testLink(link, operation) {
(link.options.data.dLngE6 / 1e6).toFixed(6),
link.options.data.dGuid
);
- operation._addPortal(toPortal);
- const blocker = new WasabeeLink(
- { fromPortalId: fromPortal.id, toPortalId: toPortal.id },
- operation
- );
- operation.addBlocker(blocker); // op.update() is called here
+ operation.addBlocker(fromPortal, toPortal);
break;
}
}
diff --git a/src/code/model/blocker.js b/src/code/model/blocker.js
index dabef533c..092ef6a5b 100644
--- a/src/code/model/blocker.js
+++ b/src/code/model/blocker.js
@@ -75,9 +75,7 @@ export default class WasabeeBlocker {
}
}
- static async addBlocker(op, wlink) {
- const fromPortal = op.getPortal(wlink.fromPortalId);
- const toPortal = op.getPortal(wlink.toPortalId);
+ static async addBlocker(op, fromPortal, toPortal) {
const blocker = new WasabeeBlocker({
opID: op.ID,
fromPortal: fromPortal,
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 3eb4e75c4..70ff32399 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -685,9 +685,8 @@ export default class WasabeeOp extends Evented {
}
}
- addBlocker(link) {
- if (!link.fromPortalId || !link.toPortalId) return;
- WasabeeBlocker.addBlocker(this, link);
+ addBlocker(fromPortal, toPortal) {
+ WasabeeBlocker.addBlocker(this, fromPortal, toPortal);
}
get fakedPortals() {
From c6cdc8155dd03d5fd912bd97088daada9d3d64e7 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 10 Jul 2021 22:32:25 +0200
Subject: [PATCH 024/275] update blocker portals
---
src/code/crosslinks.js | 1 -
src/code/dialogs/blockersList.js | 18 ++++++++++--------
src/code/model/blocker.js | 14 ++++++++++----
src/code/uiCommands.js | 4 +++-
4 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/src/code/crosslinks.js b/src/code/crosslinks.js
index dd186dba1..98765f51d 100644
--- a/src/code/crosslinks.js
+++ b/src/code/crosslinks.js
@@ -1,5 +1,4 @@
import WasabeePortal from "./model/portal";
-import WasabeeLink from "./model/link";
import WasabeeMarker from "./model/marker";
import { getSelectedOperation } from "./selectedOp";
diff --git a/src/code/dialogs/blockersList.js b/src/code/dialogs/blockersList.js
index e4fe4478a..5b0fe96de 100644
--- a/src/code/dialogs/blockersList.js
+++ b/src/code/dialogs/blockersList.js
@@ -109,12 +109,13 @@ const BlockerList = WDialog.extend({
content.fields = [
{
name: wX("FROM_PORT"),
- value: (blocker) => {
- return blocker.fromPortal.name;
- },
+ value: (blocker) =>
+ blocker.fromPortal ? blocker.fromPortal.name : blocker.from,
sort: (a, b) => a.localeCompare(b),
format: (row, value, blocker) => {
- row.appendChild(PortalUI.displayFormat(blocker.fromPortal));
+ if (blocker.fromPortal)
+ row.appendChild(PortalUI.displayFormat(blocker.fromPortal));
+ else row.textContent = value;
},
},
{
@@ -129,12 +130,13 @@ const BlockerList = WDialog.extend({
},
{
name: wX("TO_PORT"),
- value: (blocker) => {
- return blocker.toPortal.name;
- },
+ value: (blocker) =>
+ blocker.toPortal ? blocker.toPortal.name : blocker.to,
sort: (a, b) => a.localeCompare(b),
format: (row, value, blocker) => {
- row.appendChild(PortalUI.displayFormat(blocker.toPortal));
+ if (blocker.toPortal)
+ row.appendChild(PortalUI.displayFormat(blocker.toPortal));
+ else row.textContent = value;
},
},
{
diff --git a/src/code/model/blocker.js b/src/code/model/blocker.js
index 092ef6a5b..c829af212 100644
--- a/src/code/model/blocker.js
+++ b/src/code/model/blocker.js
@@ -29,6 +29,7 @@ export default class WasabeeBlocker {
if (portal.name === portal.id) return;
const p = await store.get([op.ID, portal.id]);
if (!p) return;
+ if (p.name === portal.name) return;
await store.put({
opID: op.ID,
id: portal.id,
@@ -87,13 +88,18 @@ export default class WasabeeBlocker {
await WasabeeBlocker.addPortal(op, toPortal);
}
+ static async getPortals(op) {
+ const portals = await (
+ await db
+ ).getAllFromIndex("blockers_portals", "opID", op.ID);
+ return portals;
+ }
+
static async getAll(op) {
const blockers = await (
await db
).getAllFromIndex("blockers", "opID", op.ID);
- const portals = await (
- await db
- ).getAllFromIndex("blockers_portals", "opID", op.ID);
+ const portals = await WasabeeBlocker.getPortals(op);
const portalsMap = new Map();
for (const p of portals) {
portalsMap.set(p.id, p);
@@ -102,6 +108,6 @@ export default class WasabeeBlocker {
b.fromPortal = portalsMap.get(b.from);
b.toPortal = portalsMap.get(b.to);
}
- return blockers.filter((b) => b.fromPortal && b.toPortal);
+ return blockers;
}
}
diff --git a/src/code/uiCommands.js b/src/code/uiCommands.js
index 63de31018..a1e80784f 100644
--- a/src/code/uiCommands.js
+++ b/src/code/uiCommands.js
@@ -130,7 +130,9 @@ export function listenForAddedPortals(newPortal) {
if (!newPortal.portal.options.data.title) return;
const op = getSelectedOperation();
- op.updatePortal(PortalUI.fromIITC(newPortal.portal));
+ const portal = PortalUI.fromIITC(newPortal.portal);
+ op.updatePortal(portal);
+ WasabeeBlocker.updatePortal(op, portal);
}
export function listenForPortalDetails(e) {
From bcee6eff3355b0296a38c133ac21a9c3a278ff9b Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 15 Jul 2021 16:44:22 +0200
Subject: [PATCH 025/275] clean blockers with ops
---
src/code/dialogs/blockersList.js | 2 +-
src/code/dialogs/trawl.js | 4 ++--
src/code/model/blocker.js | 6 +++---
src/code/selectedOp.js | 8 +++++++-
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/code/dialogs/blockersList.js b/src/code/dialogs/blockersList.js
index 5b0fe96de..914eb98e3 100644
--- a/src/code/dialogs/blockersList.js
+++ b/src/code/dialogs/blockersList.js
@@ -55,7 +55,7 @@ const BlockerList = WDialog.extend({
};
buttons[wX("RESET")] = async () => {
const operation = getSelectedOperation();
- await WasabeeBlocker.removeBlockers(operation);
+ await WasabeeBlocker.removeBlockers(operation.ID);
this.update();
operation.update(false); // blockers do not need to be sent to server
window.map.fire("wasabee:crosslinks");
diff --git a/src/code/dialogs/trawl.js b/src/code/dialogs/trawl.js
index 75a611b67..187a3c0bc 100644
--- a/src/code/dialogs/trawl.js
+++ b/src/code/dialogs/trawl.js
@@ -231,7 +231,7 @@ const TrawlDialog = WDialog.extend({
L.DomEvent.on(button, "click", async () => {
const op = getSelectedOperation();
if (clearMarkers.checked == true) this._clearMarkers();
- await WasabeeBlocker.removeBlockers(op);
+ await WasabeeBlocker.removeBlockers(op.ID);
const points = this._getTrawlPoints();
const td = new TrawlerDialog({
points: points,
@@ -248,7 +248,7 @@ const TrawlDialog = WDialog.extend({
crazyButton.textContent = wX("TRAWL_BULK_LOAD");
L.DomEvent.on(crazyButton, "click", async () => {
const op = getSelectedOperation();
- await WasabeeBlocker.removeBlockers(op);
+ await WasabeeBlocker.removeBlockers(op.ID);
if (clearMarkers.checked == true) this._clearMarkers();
const points = this._getTrawlPoints();
this._bulkLoad(points, 14);
diff --git a/src/code/model/blocker.js b/src/code/model/blocker.js
index c829af212..414fbc8a7 100644
--- a/src/code/model/blocker.js
+++ b/src/code/model/blocker.js
@@ -59,17 +59,17 @@ export default class WasabeeBlocker {
await (await db).delete("blockers_portals", [op.ID, portalId]);
}
- static async removeBlockers(op) {
+ static async removeBlockers(opID) {
let store = (await db).transaction("blockers", "readwrite").store;
let cursor = await store
.index("opID")
- .openKeyCursor(IDBKeyRange.only(op.ID));
+ .openKeyCursor(IDBKeyRange.only(opID));
while (cursor) {
store.delete(cursor.primaryKey);
cursor = await cursor.continue();
}
store = (await db).transaction("blockers_portals", "readwrite").store;
- cursor = await store.index("opID").openKeyCursor(IDBKeyRange.only(op.ID));
+ cursor = await store.index("opID").openKeyCursor(IDBKeyRange.only(opID));
while (cursor) {
store.delete(cursor.primaryKey);
cursor = await cursor.continue();
diff --git a/src/code/selectedOp.js b/src/code/selectedOp.js
index ba891b706..e55873171 100644
--- a/src/code/selectedOp.js
+++ b/src/code/selectedOp.js
@@ -1,4 +1,5 @@
import WasabeeOp from "./model/operation";
+import WasabeeBlocker from "./model/blocker";
import wX from "./wX";
import { generateId } from "./auxiliar";
@@ -138,6 +139,7 @@ export async function setupLocalStorage() {
//** This function removes an operation from the main list */
export async function removeOperation(opID) {
await WasabeeOp.delete(opID);
+ WasabeeBlocker.removeBlockers(opID); // no need to await
window.map.fire("wasabee:op:delete", opID);
}
@@ -172,6 +174,7 @@ export async function resetOps() {
const ops = await opsList();
// don't fire event here
await Promise.all(ops.map(WasabeeOp.delete));
+ ops.map(WasabeeBlocker.removeBlockers); // no need to await
}
export function hiddenOpsList() {
@@ -245,7 +248,10 @@ export async function removeNonOwnedOps() {
for (const opID of await opsList()) {
const op = await WasabeeOp.load(opID);
// don't fire event here
- if (!op || !op.isOwnedOp()) await WasabeeOp.delete(opID);
+ if (!op || !op.isOwnedOp()) {
+ await WasabeeOp.delete(opID);
+ WasabeeBlocker.removeBlockers(opID); // no need to await
+ }
}
await changeOpIfNeeded();
}
From e7a7bc489c9e0c12ccba252f30b71b49ca995213 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sun, 18 Jul 2021 13:33:34 +0200
Subject: [PATCH 026/275] handle fake blocker portals
---
src/code/dialogs/blockersList.js | 9 +++++----
src/code/model/blocker.js | 6 +++---
src/code/uiCommands.js | 23 +++++++++++++++++++++--
3 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/src/code/dialogs/blockersList.js b/src/code/dialogs/blockersList.js
index 914eb98e3..91bb5a53a 100644
--- a/src/code/dialogs/blockersList.js
+++ b/src/code/dialogs/blockersList.js
@@ -4,7 +4,7 @@ import { getSelectedOperation } from "../selectedOp";
import {
listenForAddedPortals,
listenForPortalDetails,
- loadFaked,
+ loadBlockerFaked,
blockerAutomark,
} from "../uiCommands";
import wX from "../wX";
@@ -25,6 +25,7 @@ const BlockerList = WDialog.extend({
addHooks: function () {
WDialog.prototype.addHooks.call(this);
window.map.on("wasabee:op:select wasabee:op:change", this.update, this);
+ window.map.on("wasabee:crosslinks:update", this.update, this);
window.map.on("wasabee:crosslinks:done", this.update, this);
window.addHook("portalAdded", listenForAddedPortals);
@@ -35,6 +36,7 @@ const BlockerList = WDialog.extend({
removeHooks: function () {
WDialog.prototype.removeHooks.call(this);
window.map.off("wasabee:op:select wasabee:op:change", this.update, this);
+ window.map.off("wasabee:crosslinks:update", this.update, this);
window.map.off("wasabee:crosslinks:done", this.update, this);
window.removeHook("portalAdded", listenForAddedPortals);
@@ -44,7 +46,7 @@ const BlockerList = WDialog.extend({
_displayDialog: async function () {
const operation = getSelectedOperation();
this.sortable = await this._getListDialogContent(0, false); // defaults to sorting by op order
- loadFaked(operation);
+ loadBlockerFaked(operation);
const buttons = {};
buttons[wX("OK")] = () => {
this.closeDialog();
@@ -57,12 +59,11 @@ const BlockerList = WDialog.extend({
const operation = getSelectedOperation();
await WasabeeBlocker.removeBlockers(operation.ID);
this.update();
- operation.update(false); // blockers do not need to be sent to server
window.map.fire("wasabee:crosslinks");
};
buttons[wX("LOAD PORTALS")] = () => {
const operation = getSelectedOperation();
- loadFaked(operation, true); // force
+ loadBlockerFaked(operation, true); // force
};
buttons[wX("TRAWL TITLE")] = () => {
const td = new TrawlDialog();
diff --git a/src/code/model/blocker.js b/src/code/model/blocker.js
index 414fbc8a7..6f1a1e327 100644
--- a/src/code/model/blocker.js
+++ b/src/code/model/blocker.js
@@ -26,10 +26,10 @@ export default class WasabeeBlocker {
static async updatePortal(op, portal) {
const store = (await db).transaction("blockers_portals", "readwrite").store;
- if (portal.name === portal.id) return;
+ if (portal.name === portal.id) return false;
const p = await store.get([op.ID, portal.id]);
- if (!p) return;
- if (p.name === portal.name) return;
+ if (!p) return false;
+ if (p.name === portal.name) return false;
await store.put({
opID: op.ID,
id: portal.id,
diff --git a/src/code/uiCommands.js b/src/code/uiCommands.js
index a1e80784f..83ed65075 100644
--- a/src/code/uiCommands.js
+++ b/src/code/uiCommands.js
@@ -132,7 +132,9 @@ export function listenForAddedPortals(newPortal) {
const op = getSelectedOperation();
const portal = PortalUI.fromIITC(newPortal.portal);
op.updatePortal(portal);
- WasabeeBlocker.updatePortal(op, portal);
+ WasabeeBlocker.updatePortal(op, portal).then((r) => {
+ if (r) window.map.fire("wasabee:crosslinks:update");
+ });
}
export function listenForPortalDetails(e) {
@@ -145,7 +147,9 @@ export function listenForPortalDetails(e) {
});
const op = getSelectedOperation();
op.updatePortal(portal);
- WasabeeBlocker.updatePortal(op, portal);
+ WasabeeBlocker.updatePortal(op, portal).then((r) => {
+ if (r) window.map.fire("wasabee:crosslinks:update");
+ });
}
// This is what should be called to add to the queue
@@ -197,6 +201,7 @@ function pdqDoNext() {
window.portalDetail.request(p);
}
+// load faked op portals
export function loadFaked(operation, force = false) {
const flag =
localStorage[window.plugin.wasabee.static.constants.AUTO_LOAD_FAKED] ||
@@ -210,6 +215,20 @@ export function loadFaked(operation, force = false) {
if (f.length > 0) getPortalDetails(f);
}
+// load faked blocker portals
+export async function loadBlockerFaked(operation, force = false) {
+ const flag =
+ localStorage[window.plugin.wasabee.static.constants.AUTO_LOAD_FAKED] ||
+ false;
+
+ // local storage always returns as string
+ if (flag !== "true" && !force) return;
+
+ const bp = await WasabeeBlocker.getPortals(operation);
+ const f = bp.filter((p) => p.id === p.name).map((p) => p.id);
+ if (f.length > 0) getPortalDetails(f);
+}
+
export function sendLocation() {
if (!WasabeeMe.isLoggedIn()) return;
const sl =
From e856a887061ca8ad49067fd61d64ffdbf6e81607 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sun, 18 Jul 2021 14:10:56 +0200
Subject: [PATCH 027/275] remove blockers from op except for blockers event
---
src/code/crosslinks.js | 3 ++-
src/code/dialogs/markerAddDialog.js | 7 ++++--
src/code/dialogs/markerChangeDialog.js | 3 +++
src/code/model/blocker.js | 6 +++++
src/code/model/marker.js | 14 +++++++++++
src/code/model/operation.js | 35 +++-----------------------
6 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/src/code/crosslinks.js b/src/code/crosslinks.js
index 98765f51d..7c978b5c8 100644
--- a/src/code/crosslinks.js
+++ b/src/code/crosslinks.js
@@ -1,5 +1,6 @@
import WasabeePortal from "./model/portal";
import WasabeeMarker from "./model/marker";
+import WasabeeBlocker from "./model/blocker";
import { getSelectedOperation } from "./selectedOp";
import PortalUI from "./ui/portal";
@@ -194,7 +195,7 @@ function testLink(link, operation) {
(link.options.data.dLngE6 / 1e6).toFixed(6),
link.options.data.dGuid
);
- operation.addBlocker(fromPortal, toPortal);
+ WasabeeBlocker.addBlocker(operation, fromPortal, toPortal);
break;
}
}
diff --git a/src/code/dialogs/markerAddDialog.js b/src/code/dialogs/markerAddDialog.js
index a5da9ae1f..30fcf9e72 100644
--- a/src/code/dialogs/markerAddDialog.js
+++ b/src/code/dialogs/markerAddDialog.js
@@ -2,6 +2,7 @@ import { WDialog } from "../leafletClasses";
import WasabeeMe from "../model/me";
import WasabeeTeam from "../model/team";
import WasabeeMarker from "../model/marker";
+import WasabeeBlocker from "../model/blocker";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
@@ -149,9 +150,11 @@ const MarkerAddDialog = WDialog.extend({
};
// XXX remove comment from args in 0.20
- if (operation.addMarker(selectedType, PortalUI.getSelected(), options))
+ if (operation.addMarker(selectedType, PortalUI.getSelected(), options)) {
+ if (WasabeeMarker.isDestructMarkerType(selectedType))
+ WasabeeBlocker.removeBlocker(operation, PortalUI.getSelected().id);
await this.update();
- else alert(wX("ALREADY_HAS_MARKER"));
+ } else alert(wX("ALREADY_HAS_MARKER"));
localStorage[window.plugin.wasabee.static.constants.LAST_MARKER_KEY] =
selectedType;
},
diff --git a/src/code/dialogs/markerChangeDialog.js b/src/code/dialogs/markerChangeDialog.js
index 308de782a..27c7723a3 100644
--- a/src/code/dialogs/markerChangeDialog.js
+++ b/src/code/dialogs/markerChangeDialog.js
@@ -2,6 +2,7 @@ import { WDialog } from "../leafletClasses";
import wX from "../wX";
import { getSelectedOperation } from "../selectedOp";
import WasabeeMarker from "../model/marker";
+import WasabeeBlocker from "../model/blocker";
import PortalUI from "../ui/portal";
@@ -56,6 +57,8 @@ const MarkerChangeDialog = WDialog.extend({
comment: this.options.marker.comment,
assign: this.options.marker.assignedTo,
});
+ if (WasabeeMarker.isDestructMarkerType(this._type.value))
+ WasabeeBlocker.removeBlocker(operation, portal.id);
operation.endBatchMode();
}
this.closeDialog();
diff --git a/src/code/model/blocker.js b/src/code/model/blocker.js
index 6f1a1e327..56d6163c4 100644
--- a/src/code/model/blocker.js
+++ b/src/code/model/blocker.js
@@ -24,11 +24,17 @@ export default class WasabeeBlocker {
await store.put(ent);
}
+ // return true if a blocker portal is updated
static async updatePortal(op, portal) {
const store = (await db).transaction("blockers_portals", "readwrite").store;
if (portal.name === portal.id) return false;
const p = await store.get([op.ID, portal.id]);
if (!p) return false;
+ if (p.lat !== portal.lat || p.lng !== portal.lng) {
+ // portal move, drop blockers
+ await WasabeeBlocker.removeBlocker(op, portal.id);
+ return true;
+ }
if (p.name === portal.name) return false;
await store.put({
opID: op.ID,
diff --git a/src/code/model/marker.js b/src/code/model/marker.js
index 94c181ae7..ae7e18dea 100644
--- a/src/code/model/marker.js
+++ b/src/code/model/marker.js
@@ -16,6 +16,12 @@ const markers = {
MARKER_TYPE_VIRUS: "UseVirusPortalAlert",
};
+const destructMarkerTypes = [
+ markers.MARKER_TYPE_DECAY,
+ markers.MARKER_TYPE_DESTROY,
+ markers.MARKER_TYPE_VIRUS,
+];
+
const markerTypes = new Set(Object.values(markers));
const STATE_UNASSIGNED = "pending";
@@ -110,4 +116,12 @@ export default class WasabeeMarker {
get state() {
return this._state;
}
+
+ isDestructMarker() {
+ return destructMarkerTypes.includes(this.type);
+ }
+
+ static isDestructMarkerType(type) {
+ return destructMarkerTypes.includes(type);
+ }
}
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 70ff32399..cb0b450ab 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -1,5 +1,4 @@
import WasabeeLink from "./link";
-import WasabeeBlocker from "./blocker";
import WasabeePortal from "./portal";
import WasabeeMarker from "./marker";
import WasabeeMe from "./me";
@@ -147,7 +146,7 @@ export default class WasabeeOp extends Evented {
ID: this.ID,
name: this.name,
creator: this.creator,
- opportals: Array.from(this._idToOpportals.values()), // includes blocker portals
+ opportals: Array.from(this._idToOpportals.values()),
anchors: this.anchors,
links: this.links,
markers: this.markers,
@@ -162,6 +161,7 @@ export default class WasabeeOp extends Evented {
toExport() {
// round-trip through JSON.stringify to ensure a deep copy
const o = new WasabeeOp(JSON.stringify(this));
+ // drop +0.21
o.cleanPortalList(); // remove portals which are only relevant to blockers
return JSON.stringify(o);
}
@@ -581,8 +581,6 @@ export default class WasabeeOp extends Evented {
for (const m of this.markers) {
if (m.portalId == old.id) m.portalId = fake.id;
}
- // remove blockers on the old portal
- WasabeeBlocker.removeBlocker(this, old.id);
this._idToOpportals.delete(old.id);
// add the new portal so any data related to the real portal (keys) still works
@@ -685,10 +683,6 @@ export default class WasabeeOp extends Evented {
}
}
- addBlocker(fromPortal, toPortal) {
- WasabeeBlocker.addBlocker(this, fromPortal, toPortal);
- }
-
get fakedPortals() {
const c = Array.from(this._idToOpportals.values()).filter((p) => p.faked);
return c;
@@ -766,21 +760,10 @@ export default class WasabeeOp extends Evented {
marker.assign(options.assign);
this.markers.push(marker);
- // only need this for virus/destroy/decay -- this should be in the marker class
- const destructMarkerTypes = [
- WasabeeMarker.constants.MARKER_TYPE_DECAY,
- WasabeeMarker.constants.MARKER_TYPE_DESTROY,
- WasabeeMarker.constants.MARKER_TYPE_VIRUS,
- ];
- if (destructMarkerTypes.includes(markerType)) {
- // remove related blockers
- WasabeeBlocker.removeBlocker(this, portal.id);
- }
-
this.update(true);
// run crosslink to update the layer
// XXX: we don't need to check, only redraw, so we need something clever, probably in mapDraw or crosslink.js
- if (destructMarkerTypes.includes(markerType)) this.updateBlockers();
+ if (marker.isDestructMarker()) this.updateBlockers();
return true;
}
@@ -862,15 +845,6 @@ export default class WasabeeOp extends Evented {
return tmpLinks;
}
- convertBlockersToObjs(links) {
- const tmpLinks = new Array();
- if (!links || links.length == 0) return tmpLinks;
- for (const l of links) {
- tmpLinks.push(new WasabeeLink(l, this));
- }
- return tmpLinks;
- }
-
convertMarkersToObjs(markers) {
const tmpMarkers = new Array();
if (!markers || markers.length == 0) return tmpMarkers;
@@ -1166,7 +1140,6 @@ export default class WasabeeOp extends Evented {
if (oldOp.name != this.name) changes.name = this.name;
if (oldOp.color != this.color) changes.color = this.color;
if (oldOp.comment != this.comment) changes.comment = this.comment;
- // blockers: ignored by the server, handle them later
// zones: handle them later
for (const [id, p] of this._idToOpportals) {
@@ -1267,7 +1240,7 @@ export default class WasabeeOp extends Evented {
return count;
}
- // assume that `this` is a server OP (no blockers, teams/keys are correct)
+ // assume that `this` is a server OP (teams/keys are correct)
applyChanges(changes, op) {
const summary = {
compatibility: {
From 114f86a1b4656a344fe4effdd454a29a7d7c2210 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sun, 18 Jul 2021 16:23:57 +0200
Subject: [PATCH 028/275] sortable: handle [fulfilled] rows
Promise.all is async even if all promises are already fulfilled
---
src/code/sortable.js | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/code/sortable.js b/src/code/sortable.js
index c4b4e2bb4..30a442d0d 100644
--- a/src/code/sortable.js
+++ b/src/code/sortable.js
@@ -67,6 +67,7 @@ export default class Sortable {
// class getters and setter's can't be async,
// this lets us build each row as a promise, then resolve them all together
+ const instantValues = [];
const promises = incoming.map(async (obj) => {
const row = L.DomUtil.create("tr");
const data = {
@@ -105,23 +106,32 @@ export default class Sortable {
cell.style.display = "none";
}
}
+ instantValues.push(data);
return data;
});
// resolve all rows at once
// XXX convert to allSettled and check for individual errors rather than failing hard if any row fails
// console.log(promises);
- this._done = Promise.all(promises).then(
- (values) => {
- this._items = values;
- this.sort();
- return true;
- },
- (reject) => {
- console.log("rejected", reject);
- this._done = false;
- }
- );
+ if (instantValues.length === promises.length) {
+ // all promises are already fulfilled, dont use async Promise.all
+ this._items = instantValues;
+ this.sort();
+ this._done = true;
+ } else {
+ // always async
+ this._done = Promise.all(promises).then(
+ (values) => {
+ this._items = values;
+ this.sort();
+ return true;
+ },
+ (reject) => {
+ console.log("rejected", reject);
+ this._done = false;
+ }
+ );
+ }
}
get fields() {
From 896bc4f5dda88e080a795e7b6dae836a61edc95f Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sun, 18 Jul 2021 16:50:58 +0200
Subject: [PATCH 029/275] wait for async content before creating dialog
---
src/code/dialogs/linkListDialog.js | 4 +++-
src/code/dialogs/manageTeamDialog.js | 18 +++++++++---------
src/code/dialogs/markerList.js | 4 +++-
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/code/dialogs/linkListDialog.js b/src/code/dialogs/linkListDialog.js
index 8d384d2de..5255d9246 100644
--- a/src/code/dialogs/linkListDialog.js
+++ b/src/code/dialogs/linkListDialog.js
@@ -45,7 +45,7 @@ const LinkListDialog = OperationChecklistDialog.extend({
return fields.slice(0, 2).concat(linkFields, fields.slice(3));
},
- _displayDialog: function () {
+ _displayDialog: async function () {
const operation = getSelectedOperation();
loadFaked(operation);
const links = operation.getLinkListFromPortal(this.options.portal);
@@ -61,6 +61,8 @@ const LinkListDialog = OperationChecklistDialog.extend({
this.closeDialog();
};
+ await this.sortable.done;
+
this.createDialog({
title: wX("LINKS2", {
portalName: PortalUI.displayName(this.options.portal),
diff --git a/src/code/dialogs/manageTeamDialog.js b/src/code/dialogs/manageTeamDialog.js
index 23fa464a8..6ffee9f70 100644
--- a/src/code/dialogs/manageTeamDialog.js
+++ b/src/code/dialogs/manageTeamDialog.js
@@ -42,7 +42,7 @@ const ManageTeamDialog = WDialog.extend({
window.map.off("wasabee:logout", this.closeDialog, this);
},
- _setupTable: function () {
+ _setupTable: async function () {
const table = new Sortable();
table.fields = [
{
@@ -128,8 +128,7 @@ const ManageTeamDialog = WDialog.extend({
];
table.sortBy = 0;
- // async populate
- this._refreshTeam(table);
+ await this._refreshTeam(table);
return table;
},
@@ -147,19 +146,20 @@ const ManageTeamDialog = WDialog.extend({
}
},
- update: function () {
- const container = this._dialogContent(); // build the UI
+ update: async function () {
+ const container = await this._dialogContent(); // build the UI
// this is the correct way to change out a dialog's contents, audit the entire codebase making this change
this.setContent(container);
this.setTitle(wX("MANAGE_TEAM", { teamName: this.options.team.Name }));
},
- _dialogContent: function () {
+ _dialogContent: async function () {
const container = L.DomUtil.create("div", "container");
const list = L.DomUtil.create("div", "list", container);
- const table = this._setupTable();
+ const table = await this._setupTable();
list.appendChild(table.table);
+ await table.done;
const addlabel = L.DomUtil.create("label", null, container);
addlabel.textContent = wX("ADD_AGENT");
@@ -305,8 +305,8 @@ const ManageTeamDialog = WDialog.extend({
return container;
},
- _displayDialog: function () {
- const container = this._dialogContent();
+ _displayDialog: async function () {
+ const container = await this._dialogContent();
const buttons = {};
buttons[wX("CLOSE")] = () => {
this.closeDialog();
diff --git a/src/code/dialogs/markerList.js b/src/code/dialogs/markerList.js
index 461583125..72c0fa629 100644
--- a/src/code/dialogs/markerList.js
+++ b/src/code/dialogs/markerList.js
@@ -8,7 +8,7 @@ const MarkerList = OperationChecklistDialog.extend({
TYPE: "markerList",
},
- _displayDialog: function () {
+ _displayDialog: async function () {
const operation = getSelectedOperation();
loadFaked(operation);
this.sortable = this.getListDialogContent(
@@ -27,6 +27,8 @@ const MarkerList = OperationChecklistDialog.extend({
this.closeDialog();
};
+ await this.sortable.done;
+
this.createDialog({
title: wX("MARKER_LIST", { opName: operation.name }),
html: this.sortable.table,
From 4d9be5cb299bc95cf8f2c64e5eb0cd5bf0d0de6f Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 19 Jul 2021 11:19:43 +0200
Subject: [PATCH 030/275] report db issue (alert + iitc)
---
src/code/init.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/code/init.js b/src/code/init.js
index d3203d900..cb03ea9ae 100644
--- a/src/code/init.js
+++ b/src/code/init.js
@@ -40,7 +40,14 @@ window.plugin.wasabee.init = async () => {
return;
}
- Wasabee.idb = await db;
+ try {
+ Wasabee.idb = await db;
+ } catch (e) {
+ alert("Wasabee: unable to access the storage: " + e.toString());
+ plugin_info.error = e; //eslint-disable-line
+ return;
+ }
+
Wasabee._selectedOp = null; // the in-memory working op;
Wasabee._updateList = new Map();
Wasabee.portalDetailQueue = new Array();
From aa1b98f8d83a23e232484ea990447c1138de4cb8 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 26 Jul 2021 17:31:28 +0200
Subject: [PATCH 031/275] remove dead/incompatible code
android supports quick only
---
src/code/dialogs/authDialog.js | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/src/code/dialogs/authDialog.js b/src/code/dialogs/authDialog.js
index 9759ecf6b..ab862c5cc 100644
--- a/src/code/dialogs/authDialog.js
+++ b/src/code/dialogs/authDialog.js
@@ -97,14 +97,6 @@ const AuthDialog = WDialog.extend({
this.gapiAuth.call(this);
});
- // XXX this needs to go away
- const menus = L.DomUtil.create("div", "options", content);
- menus.innerHTML =
- "Login Settings: Prompt: Auto none (quick) select_account " +
- "Immediate : Auto (quick) true false " +
- "ux_mode : Unset Popup Redirect ";
- if (!this._android) menus.style.display = "none";
-
if (!this._android && !this._ios) {
const gapiSelectButton = L.DomUtil.create("button", "gapi", content);
gapiSelectButton.textContent = wX("AUTH_SELECT_ACCOUNT");
@@ -214,13 +206,7 @@ const AuthDialog = WDialog.extend({
scope: "email profile openid",
response_type: "id_token permission",
};
- const immediate = document.getElementById("auth-immediate");
- if (immediate && immediate.value != "unset")
- options.immediate = immediate.value;
- const uxmode = document.getElementById("ux-mode");
- if (uxmode && uxmode.value != "unset") options.ux_mode = uxmode.value;
- const gPrompt = document.getElementById("auth-prompt");
- if (gPrompt && gPrompt.value != "unset") options.prompt = gPrompt.value;
+
window.gapi.auth2.authorize(options, async (response) => {
if (response.error) {
postToFirebase({ id: "exception", error: response.error });
From 54699258ec6e34c82f77a9bed616d2e4a971347b Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 26 Jul 2021 17:32:11 +0200
Subject: [PATCH 032/275] fix: MM starts from 2
---
src/code/dialogs/multimaxDialog.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index 483e2367e..cca9b8155 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -152,7 +152,7 @@ const MultimaxDialog = WDialog.extend({
if (base)
this._operation.addLink(pOne, pTwo, {
description: commentPrefix + "base",
- oder: ++order,
+ order: ++order,
});
if (!Array.isArray(sequence) || !sequence.length) {
From 8ceb22f90f79dbe70f027ab551f780afdec155c8 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 2 Aug 2021 16:13:39 +0200
Subject: [PATCH 033/275] MM: append links
---
src/code/dialogs/multimaxDialog.js | 27 ++++++++++++++++++++++++++-
src/code/translations/english.json | 1 +
src/code/translations/filipino.json | 1 +
src/code/translations/french.json | 1 +
src/code/translations/german.json | 1 +
src/code/translations/italian.json | 1 +
src/code/translations/spanish.json | 1 +
7 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index cca9b8155..42df7f13f 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -92,6 +92,14 @@ const MultimaxDialog = WDialog.extend({
this._flcheck.type = "checkbox";
this._flcheck.id = "wasabee-multimax-backlink";
+ const orderFromEndLabel = L.DomUtil.create("label", null, container);
+ orderFromEndLabel.textContent = wX("MM_INSERT_ORDER");
+ orderFromEndLabel.htmlFor = "wasabee-multimax-insert-order";
+ this._orderFromEnd = L.DomUtil.create("input", null, container);
+ this._orderFromEnd.type = "checkbox";
+ this._orderFromEnd.id = "wasabee-multimax-insert-order";
+ this._orderFromEnd.checked = true;
+
// Go button
const button = L.DomUtil.create("button", "drawb", container);
button.textContent = wX("MULTI_M");
@@ -149,6 +157,18 @@ const MultimaxDialog = WDialog.extend({
window.map.distance(portalsMap.get(a).latLng, portalsMap.get(b).latLng)
);
+ // shift current op tasks order
+ if (order < this._operation.nextOrder) {
+ let diff = sequence.length * 2 + 1;
+ if (this._flcheck.checked) diff += sequence.length - 1;
+ for (const l of this._operation.links) {
+ if (l.opOrder >= order) l.opOrder += diff;
+ }
+ for (const m of this._operation.markers) {
+ if (m.opOrder >= order) m.opOrder += diff;
+ }
+ }
+
if (base)
this._operation.addLink(pOne, pTwo, {
description: commentPrefix + "base",
@@ -202,7 +222,12 @@ const MultimaxDialog = WDialog.extend({
this._operation.startBatchMode();
console.log("starting multimax");
- const length = this.MM(this._anchorOne, this._anchorTwo, portals)[0];
+ const length = this.MM(
+ this._anchorOne,
+ this._anchorTwo,
+ portals,
+ this._orderFromEnd.checked ? this._operation.nextOrder - 1 : 0
+ )[0];
console.log("multimax done");
this._operation.endBatchMode(); // save and run crosslinks
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index e857f71b1..dc363c9a0 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -196,6 +196,7 @@
"MIN_SRC_PORT_LVL": "Minimum level required on source portal",
"MINUTES": " ({minutes} minutes ago)",
"MM": "Multimax",
+ "MM_INSERT_ORDER": "Insert at the end",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Draw",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/filipino.json b/src/code/translations/filipino.json
index 1cbb3df65..f35b34860 100644
--- a/src/code/translations/filipino.json
+++ b/src/code/translations/filipino.json
@@ -196,6 +196,7 @@
"MIN_SRC_PORT_LVL": "Pinakamababang level kailangan sa on panimulang portal",
"MINUTES": " ({minutes} minutong nakalipas)",
"MM": "Multimax",
+ "MM_INSERT_ORDER": "Insert at the end",
"MULTI_M_TITLE": "Gumuhit ng Max Layers",
"MULTI_M": "Multimax",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/french.json b/src/code/translations/french.json
index db4872166..1e179dcba 100644
--- a/src/code/translations/french.json
+++ b/src/code/translations/french.json
@@ -196,6 +196,7 @@
"MIN_SRC_PORT_LVL": "Level minimum requis pour le portail source",
"MINUTES": "(il y a {minutes} minute(s))",
"MM": "Multimax",
+ "MM_INSERT_ORDER": "Insert at the end",
"MULTI_M_TITLE": "Dessiner le maximum de couches",
"MULTI_M": "Draw",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/german.json b/src/code/translations/german.json
index eac07999a..8b64086e2 100644
--- a/src/code/translations/german.json
+++ b/src/code/translations/german.json
@@ -196,6 +196,7 @@
"MIN_SRC_PORT_LVL": "Minimum level required on source portal",
"MINUTES": "vor ({minutes} Minuten)",
"MM": "Maximale Feldanzahl",
+ "MM_INSERT_ORDER": "Insert at the end",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Maximale Feldanzahl",
"MULTIMAX": "Maximale Feldanzahl!",
diff --git a/src/code/translations/italian.json b/src/code/translations/italian.json
index 055f43a13..215b7caaa 100644
--- a/src/code/translations/italian.json
+++ b/src/code/translations/italian.json
@@ -196,6 +196,7 @@
"MIN_SRC_PORT_LVL": "Livello minimo richiesto sul portale d'origine",
"MINUTES": " ({minutes} minuti fa)",
"MM": "Multimax",
+ "MM_INSERT_ORDER": "Insert at the end",
"MULTI_M_TITLE": "Disegna più strati possibile",
"MULTI_M": "Disegna",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/spanish.json b/src/code/translations/spanish.json
index a0efc0981..bfbaec4ce 100644
--- a/src/code/translations/spanish.json
+++ b/src/code/translations/spanish.json
@@ -196,6 +196,7 @@
"MIN_SRC_PORT_LVL": "Nivel mínimo requerido para el portal fuente",
"MINUTES": "(Hace {minutes} minutos)",
"MM": "Multimax",
+ "MM_INSERT_ORDER": "Insert at the end",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Multimax",
"MULTIMAX": "¡Multimax!",
From aa0cc5b0edbc58c4fb5581bf1ae9fb46d7feaf01 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 2 Aug 2021 16:14:51 +0200
Subject: [PATCH 034/275] add gulp task for lang key parity
---
gulpfile.js | 34 ++++++++++++++++++++++++++++++
src/code/static.js | 12 +++++------
src/code/translations/french.json | 2 +-
src/code/translations/german.json | 4 ++--
src/code/translations/spanish.json | 2 +-
5 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/gulpfile.js b/gulpfile.js
index b6c3bc8a9..adfda1f1e 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -12,6 +12,7 @@ const del = require("del");
const webpack = require("webpack");
const PluginError = require("plugin-error");
const prettier = require("gulp-prettier");
+const through2 = require("through2");
const ensureDirectoryExistence = (filePath) => {
const dirname = path.dirname(filePath);
@@ -158,6 +159,39 @@ gulp.task("buildmeta", (cb) => {
});
});
+// locales, key parity
+gulp.task("locales", (cb) => {
+ const english = require("./src/code/translations/english.json");
+ function format(buf, ref) {
+ const parsed = JSON.parse(buf.toString("utf8"));
+ const result = {};
+ for (const key in ref) result[key] = parsed[key] || ref[key];
+ return JSON.stringify(result, null, 2) + "\n";
+ }
+
+ gulp
+ .src("./src/code/translations/*.json")
+ .pipe(
+ through2.obj(function (file, enc, cb) {
+ if (file.isBuffer()) {
+ file.contents = Buffer.from(format(file.contents, english));
+ cb(null, file);
+ } else {
+ file.contents.pipe(
+ through2(function (contents) {
+ file.contents = through2();
+ cb(null, file);
+ file.contents.write(format(contents, english));
+ file.contents.end();
+ })
+ );
+ }
+ })
+ )
+ .pipe(gulp.dest("./src/code/translations/"));
+ cb();
+});
+
// ESLint
gulp.task("eslint", (cb) => {
gulp
diff --git a/src/code/static.js b/src/code/static.js
index 67b1db74c..763c1ef81 100644
--- a/src/code/static.js
+++ b/src/code/static.js
@@ -86,12 +86,12 @@ W.static = {
};
W.static.strings = {}; // empty object, fill it below
-W.static.strings.Deutsch = require("./translations/german.json");
-W.static.strings.Espanol = require("./translations/spanish.json");
-W.static.strings.English = require("./translations/english.json");
-W.static.strings.Italiano = require("./translations/italian.json");
-W.static.strings.Tagalog = require("./translations/filipino.json");
-W.static.strings.French = require("./translations/french.json");
+W.static.strings["Deutsch"] = require("./translations/german.json");
+W.static.strings["Espanol"] = require("./translations/spanish.json");
+W.static.strings["English"] = require("./translations/english.json");
+W.static.strings["Italiano"] = require("./translations/italian.json");
+W.static.strings["Tagalog"] = require("./translations/filipino.json");
+W.static.strings["Français"] = require("./translations/french.json");
W.static.defaultOperationColor = "orange";
diff --git a/src/code/translations/french.json b/src/code/translations/french.json
index 1e179dcba..6b492ab0c 100644
--- a/src/code/translations/french.json
+++ b/src/code/translations/french.json
@@ -392,7 +392,7 @@
"WASABEE_D_LIST": "Entrer le nombre de clés défensive",
"WD BUTTON TITLE": "Enregistrer des clés défensives",
"WD BUTTON": "Clés W-D",
- "WEBVIEW": "Webview Login (iOS)",
+ "WEBVIEW VERIFY": "Verify Webview",
"WEBVIEW": "Webview Log In (iOS)",
"WRITE_SHORT": "RW",
"WRITE": "modifier",
diff --git a/src/code/translations/german.json b/src/code/translations/german.json
index 8b64086e2..007a512e6 100644
--- a/src/code/translations/german.json
+++ b/src/code/translations/german.json
@@ -89,10 +89,10 @@
"DELETE MARKER TITLE": "Markierung löschen",
"DELETE PERM DENIED": "Keine Berechtigung zum löschen",
"DELETE_ANCHOR": "Löschen",
- "DELETED": "Erfolgreich gelöscht",
+ "DELETE_LINK": "Delete",
"DELETE_MARKER": "Delete",
"DELETE_OP": "Delete {opName}",
- "DELETED": "Successfully deleted.",
+ "DELETED": "Erfolgreich gelöscht.",
"DESCRIP_PLACEHOLD": "Beschreibung (optional)",
"DestroyPortalAlert": "Destroy",
"DISABLE_SYNC": "Das Standard Synchronisations Plugin ist nicht mit Wasabee kompatibel - Bitte deaktiveren",
diff --git a/src/code/translations/spanish.json b/src/code/translations/spanish.json
index bfbaec4ce..b98364179 100644
--- a/src/code/translations/spanish.json
+++ b/src/code/translations/spanish.json
@@ -291,7 +291,7 @@
"SAVELINKS": "Save Links",
"SECONDS": "(Hace {seconds} segundos)",
"SEL_PORT_FIRST": "¡Por favor, primero seleccionar portal ancla!",
- "SEL_SB_ANCHOR ": "Selecciona el área del ancla para hacer acercamiento para añadir a la supernova",
+ "SEL_SB_ANCHOR": "Selecciona el área del ancla para hacer acercamiento para añadir a la supernova.",
"SEL_SB_ANCHOR2": "Zoom out. Make sure portals have all loaded, then click draw.",
"SEL_SB_ANCHOR3": "Please be patient, it can take a bit.",
"SEL_SL_ANCHOR": "Select the portal to save the links of. Click save links button and look at checklist.",
From a17499b766ac39a5d3026a8835209415e95e0f16 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 2 Aug 2021 16:34:44 +0200
Subject: [PATCH 035/275] MM: refine order insertion
---
src/code/dialogs/multimaxDialog.js | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index 42df7f13f..e66ee7c38 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -145,7 +145,7 @@ const MultimaxDialog = WDialog.extend({
pOne,
pTwo,
portals,
- order = 0,
+ order = 0, // first link is order + 1
base = true,
commentPrefix = "multimax "
) {
@@ -158,14 +158,17 @@ const MultimaxDialog = WDialog.extend({
);
// shift current op tasks order
- if (order < this._operation.nextOrder) {
+ if (order < this._operation.nextOrder - 1) {
let diff = sequence.length * 2 + 1;
if (this._flcheck.checked) diff += sequence.length - 1;
for (const l of this._operation.links) {
- if (l.opOrder >= order) l.opOrder += diff;
+ // skip base
+ if (l.toPortalId === pOne.id && l.fromPortalId === pTwo.id) continue;
+ if (l.fromPortalId === pOne.id && l.toPortalId === pTwo.id) continue;
+ if (l.opOrder > order) l.opOrder += diff;
}
for (const m of this._operation.markers) {
- if (m.opOrder >= order) m.opOrder += diff;
+ if (m.opOrder > order) m.opOrder += diff;
}
}
From 5e43ad88706d25c04b53d9824057f0b401f43424 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 2 Aug 2021 20:14:20 +0200
Subject: [PATCH 036/275] merge: mitigate overflow dialog
---
src/code/dialogs/mergeDialog.js | 36 +++++++++++++++++----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/code/dialogs/mergeDialog.js b/src/code/dialogs/mergeDialog.js
index fe619e7a9..02c9af499 100644
--- a/src/code/dialogs/mergeDialog.js
+++ b/src/code/dialogs/mergeDialog.js
@@ -229,7 +229,7 @@ const MergeDialog = WDialog.extend({
{
name: "Entry",
value: (e) => e.data.type,
- format: async (cell, value, e) => {
+ format: (cell, value, e) => {
const op = e.type === "-" ? origin : operation;
if (e.data.type === "link") {
cell.appendChild(LinkUI.displayFormat(e.data.link, op));
@@ -243,23 +243,25 @@ const MergeDialog = WDialog.extend({
}
if (e.type === "~") {
const pre = L.DomUtil.create("code", null, cell);
- const diff = [];
- for (const [k, v] of e.data.diff) {
- let item = e.data.link || e.data.portal || e.data.marker;
- let prev = v;
- let cur = item[k];
- if (k.endsWith("ortalId")) {
- prev = origin.getPortal(prev).name;
- cur = operation.getPortal(cur).name;
- } else if (k === "assignedTo") {
- if (prev !== "") prev = await WasabeeAgent.get(prev);
- if (cur !== "") cur = await WasabeeAgent.get(cur);
- if (prev) prev = prev.name;
- if (cur) cur = cur.name;
+ (async () => {
+ const diff = [];
+ for (const [k, v] of e.data.diff) {
+ let item = e.data.link || e.data.portal || e.data.marker;
+ let prev = v;
+ let cur = item[k];
+ if (k.endsWith("ortalId")) {
+ prev = origin.getPortal(prev).name;
+ cur = operation.getPortal(cur).name;
+ } else if (k === "assignedTo") {
+ if (prev !== "") prev = await WasabeeAgent.get(prev);
+ if (cur !== "") cur = await WasabeeAgent.get(cur);
+ if (prev) prev = prev.name;
+ if (cur) cur = cur.name;
+ }
+ diff.push([k, prev, cur]);
}
- diff.push([k, prev, cur]);
- }
- pre.textContent = JSON.stringify(diff);
+ pre.textContent = JSON.stringify(diff);
+ })();
}
},
},
From af284344738bbe2ecaf0986f7ead6568375d6864 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 4 Aug 2021 10:06:29 +0200
Subject: [PATCH 037/275] fix deleted WD keys
---
src/code/wd.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/code/wd.js b/src/code/wd.js
index 902e9cf99..474810cf1 100644
--- a/src/code/wd.js
+++ b/src/code/wd.js
@@ -67,7 +67,7 @@ export async function drawWasabeeDkeys() {
const list = JSON.parse(data);
if (!list || !list.DefensiveKeys || list.DefensiveKeys.length == 0)
return;
-
+ window.plugin.wasabee.idb.clear("defensivekeys");
for (const n of list.DefensiveKeys) {
try {
await window.plugin.wasabee.idb.put("defensivekeys", n);
From 118fb3bac9aae38c2dcb66a1f672726c8f747bab Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 4 Aug 2021 10:37:44 +0200
Subject: [PATCH 038/275] fix immediate auth
---
src/code/dialogs/authDialog.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/code/dialogs/authDialog.js b/src/code/dialogs/authDialog.js
index ab862c5cc..f6f481194 100644
--- a/src/code/dialogs/authDialog.js
+++ b/src/code/dialogs/authDialog.js
@@ -205,6 +205,7 @@ const AuthDialog = WDialog.extend({
client_id: window.plugin.wasabee.static.constants.OAUTH_CLIENT_ID,
scope: "email profile openid",
response_type: "id_token permission",
+ prompt: "none",
};
window.gapi.auth2.authorize(options, async (response) => {
From 6644b1144ee1160026db685217a62c00a1e13341 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 4 Aug 2021 11:29:55 +0200
Subject: [PATCH 039/275] blocker store migration
---
src/code/model/operation.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index cb0b450ab..09450a9dc 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -9,6 +9,9 @@ import { GetWasabeeServer } from "../server";
import { getSelectedOperation } from "../selectedOp";
import db from "../db";
+// 0.20->0.21 blocker migration
+import WasabeeBlocker from "./blocker";
+
export default class WasabeeOp extends Evented {
constructor(obj) {
super();
@@ -56,6 +59,17 @@ export default class WasabeeOp extends Evented {
if (opportals) for (const p of opportals) this._idToOpportals.set(p.id, p);
this.buildCoordsLookupTable();
+ // 0.20->0.21 blocker migration
+ if (obj.blockers) {
+ for (const blocker of obj.blockers) {
+ WasabeeBlocker.addBlocker(
+ this,
+ this.getPortal(blocker.fromPortalId),
+ this.getPortal(blocker.toPortalId)
+ );
+ }
+ }
+
this.cleanAnchorList();
this.cleanPortalList();
}
From b0920be72335f9c1c9beb7c7f2d8e1972ba1f8b3 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Thu, 26 Aug 2021 02:52:57 -0600
Subject: [PATCH 040/275] Adding Portuguese language (#284)
---
src/code/static.js | 1 +
src/code/translations/portuguese.json | 410 ++++++++++++++++++++++++++
2 files changed, 411 insertions(+)
create mode 100644 src/code/translations/portuguese.json
diff --git a/src/code/static.js b/src/code/static.js
index 763c1ef81..66ec8495f 100644
--- a/src/code/static.js
+++ b/src/code/static.js
@@ -92,6 +92,7 @@ W.static.strings["English"] = require("./translations/english.json");
W.static.strings["Italiano"] = require("./translations/italian.json");
W.static.strings["Tagalog"] = require("./translations/filipino.json");
W.static.strings["Français"] = require("./translations/french.json");
+W.static.strings["Português"] = require("./translations/portuguese.json");
W.static.defaultOperationColor = "orange";
diff --git a/src/code/translations/portuguese.json b/src/code/translations/portuguese.json
new file mode 100644
index 000000000..a1b13e4a8
--- /dev/null
+++ b/src/code/translations/portuguese.json
@@ -0,0 +1,410 @@
+{
+ "acknowledged": "Reconhecido",
+ "assigned": "Atribuído",
+ "completed": "Completo",
+ "pending": "Pendente",
+ "CapturePortalMarker": "Capturado",
+ "LetDecayPortalAlert": "Deixar caír",
+ "DestroyPortalAlert": "Destroir",
+ "FarmPortalMarker": "Farmar",
+ "GotoPortalMarker": "Ir para",
+ "GetKeyPortalMarker": "Retirar Chaves",
+ "CreateLinkAlert": "Link",
+ "MeetAgentPortalMarker": "Conhecer Agente",
+ "OtherPortalAlert": "Otros",
+ "RechargePortalAlert": "Recharge",
+ "UpgradePortalAlert": "Upgrade",
+ "UseVirusPortalAlert": "Usar Virus",
+ "ExcludeMarker": "Excluir de Auto-Desenhar / Marcar",
+ "SET_PORTAL_COMMENT": "Definir comentário do portal",
+ "ABOUT WASABEE-IITC": "Sobre Wasabee-IITC",
+ "ABOUT_WASABEE": "Sobre Wasabee",
+ "ADD": "Adicionar",
+ "ADD1": "Adicionar primeiro link",
+ "ADD2": "Adicionar segundo link",
+ "ADD_AGENT": "Adicionar Agente: ",
+ "ADD_BUTTON_LINKS": "Adicionar todos os links de uma vez.",
+ "ADD_BL": "Adicionar links oara trás: ",
+ "ADD LINK TITLE": "Adicionar Links Dialogo",
+ "ADD_LINKS": "Adicionar Links",
+ "ADD MARKER TITLE": "Adicionar Marcadores de Dialogo",
+ "ADD_MARKER": "+ Marcador",
+ "ADD_MARKER2": "Adicionar Marcador",
+ "ADD_NEW_OP": "Adicionar Nova Op",
+ "ADD_SUCC_INSTR": "Adicionar agente, bem sucedido",
+ "AGENT": "Agente",
+ "AGENT_STATS": "Agente Stats",
+ "AGES": " (ages ago)",
+ "ALREADY_HAS_MARKER": "Este portal já tem um marcador. Escolha um portal diferente.",
+ "ANCHOR1": "Âncora 1 ",
+ "ANCHOR2": "Âncora 2 ",
+ "ANCHOR3": "Âncora 3 ",
+ "ANCHOR ASSIGNMENT": " Todos os links externos",
+ "ANCHOR_GMAP": "Google Map",
+ "ANCHOR_PORTAL": "Âncora Portal ",
+ "ANCHOR_PORTAL2": "Âncora Portal 2",
+ "ANCHOR_PORTAL3": "Âncora Portal 3",
+ "ANCHORS_AS_BOOKMARKS": "Âncora como bookmarks",
+ "API_KEY": " api key: ",
+ "ASSIGN": "Atribuir",
+ "ASSIGNED": "Atribuido",
+ "ASS_TO": "Atrubuir a:",
+ "ASSIGN LINK PROMPT": "Atribuir link para: ${value}",
+ "ASSIGN MARKER PROMPT": "Atrubuir marcador para: ${value}",
+ "ASSIGN OUTBOUND": "Atribuir links externos",
+ "ASSIGN OUTBOUND PROMPT": "Atribuir todos os links externos de: ${value}",
+ "ASSIGNED_ONLY": "Só Atribuir",
+ "ASSIGNED_ONLY_SHORT": "A",
+ "AUTH ANDROID": "No Android, tentar primeiro 'rápido'. Se isso falhar, tentar o login principal com 'select_account'..",
+ "AUTH INCOMPAT": "Você ativou um plugin no TamperMonkey que é incompatível com o Wasabee",
+ "AUTH IOS": "No iOS, use o 'Login' principal. se isso falhar, faça 'Webview Log in', faça o login; em seguida, use o botão 'Verificar Webview' para concluir o processo.",
+ "AUTH REQUIRED": "Autentificação Requerida",
+ "AUTH TOKEN REJECTED": "Envio de token de autenticação rejeitado pelo servidor: ${value}",
+ "AUTH_SELECT_ACCOUNT": "Selecionar conta",
+ "AUTODRAWS": "Wasabee Auto-draw Opções",
+ "AUTO_DRAWS": "Auto-draw",
+ "AUTOLOAD": "Carregar automaticamente os detalhes do portal em falta",
+ "AUTOLOAD_RATE": "Taxa de solicitação de detalhes do portal (ms)",
+ "AUTOMARK": "Auto-Marcar",
+ "AUTOMARK STOP": "Auto-Marcar interrompido devido a portais não serem carregados",
+ "AMAZ_TEAM_NAME": "Nome incrível da equipe.",
+ "BAT_TOAD": "Battle Toads",
+ "BLOCKER LIST TITLE": "Mostrar todos os blockers",
+ "BLOCKER TITLE": "Blockers",
+ "CANCEL": "Cancelar",
+ "CAPSULE": "Capsula",
+ "CHANGE SERVER": "Trocar de Servidor",
+ "CHANGE SERVER PROMPT": "Novo servidro Wasabee",
+ "CHANGE_WAS_SERVER": "Mudar servidor Wasabee",
+ "CHECKLIST BUTTON TITLE": "Checklist da Operação",
+ "CHECKLIST BUTTON": "Checklist",
+ "CLEAR": "Limpar selecção",
+ "CLEAR_EVERYTHING": "limpar Portais/Links/Marcadores",
+ "CLEAR LINKS": "Limpar Links",
+ "CLEAR MARKERS": "Limpar Markers",
+ "CLEAROPS BUTTON": "Limpar dados Wasabee",
+ "CLEAROPS BUTTON TITLE": "limpar TODOS os dados Wasabee",
+ "CLEAROPS PROMPT": "Isto limpará todas as OPS e dados relacionados a Wasabee. Tudo será restaurado apartir do servidor na próxima sincronização.",
+ "CLOSE": "Perto",
+ "COMPLETED": "Completo",
+ "COMPLETED BY": "Completo por ${value}",
+ "CON_DEL": "Confirmar Apagar: ${value}",
+ "COMMENT": "Comentario",
+ "CONFIRM_DELETE": "Desejas realmente excluir este link: ",
+ "COUNT": "Contar",
+ "CREATE_NEW_TEAM": "Criar Nova Equipa",
+ "CUR_USER_INFO": "Informações do usuário atual",
+ "DT_FORMAT": "Formato das Ferramentas de Desenho",
+ "DEFAULT OP NAME": "Nova Op: ${value}",
+ "DELETE_ANCHOR": "Apagar",
+ "DELETE ANCHOR PROMPT": "Desejas excluir esta âncora e todos os links associados: ",
+ "DELETE ANCHOR TITLE": "Apagar Âncora",
+ "DELETE_LINK": "Apagar",
+ "DELETE_MARKER": "Apagar",
+ "DELETE MARKER PROMPT": "Desejas apagar esta âncora: ",
+ "DELETE MARKER TITLE": "Apagar Marcador",
+ "DELETE_OP": "Apagar ${value}",
+ "DELETE PERM DENIED": "Permissão para excluir negada.",
+ "DELETED": "Excluído com sucesso.",
+ "DESCRIP_PLACEHOLD": "Descrição (opcional)",
+ "DISABLED": "Este recurso não está pronto para os usuários",
+ "DISABLE_SYNC": "O plugin de sincronização de stoque não é compatível com Wassabe. Desativa a sincronização.",
+ "DONE": "Feito",
+ "DRAW TOOLS FORMAT": "Formato Draw Tools",
+ "DUPE_OP": "Duplicar Operação",
+ "END_PORT": "Portal final ",
+ "EXPORT": "Exportar: ",
+ "EXPORT OP": "Exportar Op",
+ "EXPORT OP TITLE": "Exportar Op Actual",
+ "FAKED": "Falsificado: [${value}]",
+ "FANFIELD": "Desenhar",
+ "FANFIELD2": "Desenhar Fan Field",
+ "FAN_FIELD3": "Fan Field",
+ "FANFIELD TITLE": "Fanfield",
+ "FROM_DEPTH": "da profundidade",
+ "FROM_1-2": "A Partir da base 1-2",
+ "FROM_1-3": "A Partir da base 1-3",
+ "FROM_2-3": "A Partir da base 2-3",
+ "FROM_PORT": "A Partir do Portal",
+ "GET_DT_DRAW": "Importar Dezenho DrawTools",
+ "GET DT": "Obtenha o desenho existente do DrawTools",
+ "HF_DRAW_BUTTON": "Desenhar",
+ "HF_DRAW_DEEP_BUTTON": "Desenhar com recursão profunda",
+ "HF_DEEP_SEARCH": "Pesquisa exaustiva",
+ "HF_REDRAW_BUTTON": "Redesenhar",
+ "HG": "Campo Homogêneo",
+ "H-GEN_INST": "Define portais para a camada externa. Escolhe o número de divisões. Clica para desenhar",
+ "HOURS": " (${value} horas atrás)",
+ "HOW_TO_VIDS": "Vídeos de instruções: ",
+ "IMP_COMP": "Importação concluída. Encontrada ",
+ "IMP_DT_OP": "Importar OP Drawtools: ",
+ "IMPORT_OP": "Importar Operação",
+ "IMPORT_OP_TITLE": "Importar Op: ${value}",
+ "IMPORT_OP_SUCCESS": "OP Importada: ${value} successfuly.",
+ "IMP_NOPE": "A Importação Falhou.",
+ "IMP_WAS_OP": "Importar Operação Wasabee",
+ "IMPOSSIBLE": "Impossível",
+ "INGNAME_GID": "Nome de entrada ou GoogleID",
+ "INPUT_DT_KEY_COUNT": "Contagem de chaves defensivas de entrada",
+ "INPUT_SQUAD_NAME": "Insere um nome de esquadrão",
+ "INVALID REQUEST": "Pedido inválido",
+ "IOS NEED FAKE UA": "Deves definir um 'Agente de usuário personalizado para visualizações da Web' nas configurações do IITC-Mobile ou o login falhará",
+ "KEYS": "Chaves",
+ "KEY_LIST2": "Lista de chaves para operação: ${value}",
+ "KEY_LIST": "Lista chaves para portal: ${value}",
+ "KNOWN_BLOCK": "Blockers conhecidos: ${value}",
+ "LA": "L8+ alguns LA",
+ "LA DESC": "Dependendo do número e tipo de Link Amps usados, um nível de portal de origem inferior pode ser suficiente.",
+ "LANG": "Língua",
+ "LEAVE": "Deixar",
+ "LINKS": "Links",
+ "LINKS2": ": Links",
+ "LINK ASSIGNMENT": "Atribuição de Link",
+ "LINKS BUTTON TITLE": "Links",
+ "LOADING": "[a carregar]",
+ "LOADING1": "a carregar: [${value}]",
+ "LOAD PORTALS": "Carregar Portais",
+ "LOC_PROC": "localização processada",
+ "LOC_UPDATE": "Atualização de localização",
+ "LOCATION SUB": "Localização registrada",
+ "LOCFRMSER": " (localmente e do servidor)",
+ "LOG IN": "Log In",
+ "LOG_OUT": "Log Out",
+ "LOG IN QUICK": "Log In (Rápido; para Android)",
+ "MADRID_WAS_TAKEN": "Madrid Protocol",
+ "MADRID_TITLE": "Madrid Protocol",
+ "MADRID": "Desenhar",
+ "MADRID_NOTSET": "baselink não definido.",
+ "MADRID_SET_1": "Selecione a região para a ligação de base Âncora 2 à Âncora 3",
+ "MADRID_SET_2": "Selecione a região para a ligação de base Âncora 3 à Âncora 1",
+ "MADRID_SET_3": "Selecione a região para a ligação de base Âncora 1 a Âncora 2",
+ "MANAGE": "Gerenciar",
+ "MANAGE_TEAM": "Gerenciar ${value}",
+ "MARKERS BUTTON TITLE": "Marcadores",
+ "MARKER LIST TITLE": "Lista de Marcadores",
+ "MARKER LIST": "Marcadores",
+ "MARKER_LIST": "Lista de Marcadores: ${value}",
+ "MARKER ASSIGNMENT": " Atribuição de marcador",
+ "MARKER STATE PROMPT": "Status do marcador",
+ "MARKER STATE": " Definir estado do marcador",
+ "MAX": "Fan Field",
+ "MIN_SRC_PORT_LVL": "Nível mínimo exigido no portal de origem",
+ "MINUTES": " (${value} minutos atrás)",
+ "MM": "Multimax",
+ "MY_CAP_ID": "Minha Capsula ID",
+ "MY_COUNT": "Minha Conta",
+ "MULTIMAX": "Multimax!",
+ "MUST_NOT_BE_EMPTY": "Não deve estar vazio",
+ "MULTIMAX2": "Multimax",
+ "MULTI_M_TITLE": "Desenhar camadas máximas",
+ "MULTI_M": "Desenhar",
+ "NAME": "Nome: ",
+ "NAME_REQ": "Nome Requerido",
+ "NEW_OP": "Nova Operação",
+ "NEW_TEAM": "Nova Equipa",
+ "NEW_TEAM_NAME": "Novo nome de Equipa",
+ "NEW_WAS_SERVER": "Novo servidor Waasbee",
+ "NOT LOGGED IN": "Não logado: ${value}",
+ "NOT LOGGED IN SHORT": "Não logado",
+ "NO": "Não",
+ "NO_DT_ITEMS": "Nenhum item desenhado do DrawTools foi detectado",
+ "NO_DATA": "sem dados",
+ "NO_LABEL": "Nenhum rótulo definido",
+ "NOT_LOADED": "Não totalmente carregado, tente novamente.",
+ "NO_PORT_SEL": "Nenhum portal selecionado.",
+ "NO_TITLE": "Nenhum título definido",
+ "NOT_SET": "não configurado",
+ "NO_STOCK_INTEL": "Wasabee não suporta importações de desenho de inteligência de stoque",
+ "NTNAME": "Nome",
+ "OK": "OK",
+ "ON_HAND": "Na Mão",
+ "ONLY_DT_IMP": " (apenas para importações do DrawTools)",
+ "OP DELETED": "Operação removida do servidor: ${value}",
+ "OP PERM DENIED": "Permissão negada para operação: ${value}",
+ "OP_CHECKLIST": "Lista de verificação de operação: ${value}",
+ "OP_NAME_UNSET": "O nome da operação não estava definido",
+ "OP_PERMS": "Permissões de operação",
+ "OPEN_REQUEST": "[pedido aberto]",
+ "OPER_NAME": "Nome da Operação: ",
+ "OPER_COLOR": "Cor de operação: ",
+ "OPERATIONS": "Operações",
+ "OPS BUTTON": "Ops",
+ "OPS BUTTON TITLE": "Operações",
+ "OP_BUTTON": "Operação",
+ "OP_SETTINGS_BUTTON": "Op ⚙",
+ "OP_SETTINGS_TITLE": "Configurações de operação",
+ "OPTION": "opção",
+ "ORDER": "Pedido",
+ "PASTE_INSTRUCT": "Cola uma exportação de desenho Wasabee aqui.\n\nWasabee cannot import the stock intel format.\n\nThere is experimental support for importing the IITC DrawTools format.\n\nBefore importing DrawTools format, preview the areas and make sure all the portals load so IITC has them cached. Any portals that are not pre-cached will be faked.\n\nYou will need to use the 'swap' feature to move anchors from the faked portals to the real portals (they should be in the correct location, just not associated with the portal.\n\nCached portals might not be properly named.",
+ "PENDING": "Pendente",
+ "PERMS": "${value} permissões",
+ "PICK_DEST_FIRST": "Seleciona um portal de destino primeiro!",
+ "PICK_TAR_FIRST": "Seleciona um portal de destino primeiro!",
+ "PICK_TARGETDEST_Portals": "Seleciona primeiro os portais de destino e destino!",
+ "PLEASE_SELECT_PORTAL": "Seleciona um portal",
+ "PORTAL": "Portal",
+ "PORTAL_COUNT": "${value} portais",
+ "PORTAL KEY LIST": "Lista de chaves para portal ${value}",
+ "PORT_FAKE": " portais. Falsificado ",
+ "QD BUTTON END": "Clique para parar de desenhar campos",
+ "QD END": "FIM",
+ "QD TITLE": "Camadas de desenho rápido",
+ "QDBASE": "Link Base",
+ "QDCANCEL": "Cancelar campos de desenho",
+ "QDCONT": "Clica num portal espinha para desenhar um campo.",
+ "QDEND": "Clica novamente no mesmo portal para finalizar o desenho.",
+ "QDNEXT": "Clica no segundo portal de âncora.",
+ "QDSTART": "Clica no primeiro portal de âncora.",
+ "READ": "Ler",
+ "READ_SHORT": "Ler Abreviado",
+ "REM_LOC_CP": "Remover cópia local de ${value}",
+ "REMOVE": "Remover",
+ "REMOVE_TEAM": "Remover Equipe: ",
+ "REMOVE_TEAM_CONFIRM_LABEL": "Você deseja remover permanentemente ${value} do servidor Wasabee?",
+ "REMOVE_TEAM_CONFIRM_TITLE": "Remover Equipe ${value}",
+ "RENAME": "Renomear",
+ "RENAME_TEAM": "Renomear Equipe: ",
+ "REQUIRED": "Requerido",
+ "RESET": "Redefinir",
+ "REVERSE": "Inverter",
+ "ROCKS_COM": "enl.rocks comunidade: ",
+ "ROLE": "Função",
+ "SEL_SB_ANCHOR": "Seleciona a âncora.",
+ "SEL_SB_ANCHOR2": "Reduzir o zoom. Verifica se todos os portais foram carregados e clica em desenhar.",
+ "SEL_SB_ANCHOR3": "Por favor, sê paciente, pode demorar um pouco.",
+ "SELECT PORTAL": "Selecionar um portal para enviar",
+ "SECONDS": " (${value} segundos atrás)",
+ "SEND TARGET": "Enviar alvo",
+ "SEND TARGET AGENT": "Selecionar o destinatário alvo",
+ "SEL_SRC_ANC2": "Selecionar a fonte e a âncora 2",
+ "SEL_SRC_PORT": "Selecionar um portal de origem",
+ "SELECT_FAN_PORTALS": "Selecionar um portal de âncora, um portal inicial e um portal final e, em seguida, posiciona a visualização sobre a área do campo.",
+ "SELECT_FAN_PORTALS2": "Wait for all portals to load, then click draw.",
+ "SELECT_INSTRUCTIONS": "Select two anchor portals, then zoom over the spine area.",
+ "SELECT_MADRID_INSTRUCTIONS": "Selecionar três portais de âncora, amplia a área próxima à âncora selecionada, espera até que os portais sejam carregados (os portais devem aparecer na tela para serem considerados) e selecioner o botão 'definir região da coluna' para os links de base correspondentes.",
+ "SELECT PORTAL": "Seleciona um portal primeiro",
+ "SEL_PORT_FIRST": "Selecione primeiro os portais âncora!",
+ "SELF SWAP": "Não é possível trocar um portal contigo mesmo! Seleciona um portal diferente.",
+ "SEND ANALYTICS": "Enviar análises anônimas",
+ "SEND LOCATION": "Enviar localização",
+ "SEND_LOC": "Enviar localização",
+ "SEND TARGET CONFIRM": "Queres enviar ${value} alvo para ${option}?",
+ "SET": "definir",
+ "SET_3_PORT": "Defina os três portais primeiro!",
+ "SET_COMMENT": "Definir Comentário",
+ "SET_LINK_COMMENT": "Definir comentário para o link: ",
+ "SET_LCOMMENT": "Definir comentário do link",
+ "SET_MARKER_COMMENT": "Definir comentário para marcador em: ",
+ "SET_MARKER_TYPE_TITLE": "Alterar o tipo de marcador",
+ "SET_MCOMMENT": "Definir comentário do marcador: ${value}",
+ "SET_NEW_OP": "Define o novo nome da operação",
+ "SET_PORT_COMMENT": "Definir comentário para portal: ",
+ "SET_PCOMMENT": "Definir comentário do portal: ${value}",
+ "SET_PORTAL_COMMENT": "Definir comentário do portal",
+ "SETTINGS": "Configurações do Wasabee",
+ "SKINS_AVAILABLE": "Existem ${value} skins disponíveis.",
+ "SKINS_BUTTON": "Configurar Skins",
+ "SKINS_DESCRIPTION": "Gerenciar as skins disponíveis movendo o tema para a coluna da esquerda. Quanto mais baixo na coluna, maior será a prioridade para o UI.",
+ "SKINS_MANAGE_TITLE": "Gerenciar skins",
+ "SOURCE_PORT": "Portal Fonte ",
+ "SQUAD": "Esquadrão",
+ "STATE": "Estado",
+ "STARBURST": "Starburst",
+ "STARBURST_DRAW": "Desenhar",
+ "STARBURST TITLE": "Starburst",
+ "START_PORT": "Portal inicial",
+ "TEAM STATE": "Partilhar localização",
+ "SUPPORT_INSTRUCT": "Para obter suporte, por favor, junte-se ao The Wasabee User Telegram Channel ",
+ "SWAP": "Troca",
+ "SWAP PROMPT": "Queres trocar: ",
+ "SWAP TITLE": "Trocar Portais",
+ "SWAP WITH": " com ",
+ "SYNC": "Download operações disponíveis",
+ "SYNC DONE": "Download Completo",
+ "TARDEST_DIFF": "Os portais de destino e destino devem ser diferentes.",
+ "TEAMS BUTTON TITLE": "Listar equipas Wasabee",
+ "TEAMS BUTTON": "Equipas",
+ "NEWOP BUTTON TITLE": "Criar uma nova operação",
+ "NEWOP BUTTON": "Nova Op",
+ "TARGET SENT": "Alvo Enviado",
+ "TEAM": "Equipa",
+ "TEAM_CREATED": "Equipa ${value} created",
+ "TEAM_NAME": "Nome Equipa",
+ "TEAM PERM DENIED": "Permissão negada à equipa: ${value}",
+ "TITLE": "titulo",
+ "TRAWL": "Procurar por Blockers",
+ "TRAWL_AUTOMARK": "Auto-mark blockers depois da procura",
+ "TRAWL_BULK_LOAD_WARNING": "Este método carrega os dados do bloco o mais rápido possível. Usa por sua conta e risco.",
+ "TRAWL_BULK_LOAD": "Carregar rapidamente Dados do Bloco",
+ "TRAWL_CLEAR_MARKERS": "Limpa vírus / destroi marcadores antes da procura",
+ "TRAWL TITLE": "Trawl Lanes",
+ "TRAWL WARNING": "Isto carregará os dados do bloco em todos os links desenhados. Este é um processo lento.",
+ "TRAWLING": "A Varrer os links a procura de blockers, fecha esta caixa de diálogo para parar",
+ "TRAWL_REMAINING": "${value} Restantes",
+ "TO_PORT": "Para o Portal",
+ "TYPE": "Tipo",
+ "UNASSIGNED": "Não atribuído",
+ "UNKNOWN": "Desconhecido",
+ "UPDATED": "Atualizado com sucesso",
+ "UPDATE HOVER": "UPDATE ${value} no servidor",
+ "UPDATE HOVER NOT CHANGED": "${value} não mudou localmente",
+ "UPDATE_CONFLICT_TITLE": "Conflito detectado com o servidor",
+ "UPDATE_CONFLICT_DESC": "A OP foi modificada no servidor desde a última sincronização. Queres substituir a versão do servidor pela atual?",
+ "UPLOAD BUTTON HOVER": "UPLOAD ${value} (atualmente não está no servidor)",
+ "UPLOAD PERM DENIED": "Permissão para upload negada",
+ "UPLOADED": "Carregado com sucesso",
+ "USE_SWAP_INSTRUCT": ". Usa o recurso de troca para mover portais falsos para portais reais no mesmo local. Ampliar os portais 'Carregando' na lista de verificação pode forçá-los a carregar.",
+ "USE_VALID_NAME": "Usa um nome de operação válido",
+ "UPDATE_COUNT": "Contagem de atualização",
+ "VRLA": "L8+alguns VRLA",
+ "VRLA DESC": "Dependendo do número e tipo de Link Amps usados, um nível de portal de origem inferior pode ser suficiente.",
+ "WASABEE BUTTON TITLE": "Wasabee: É VERDE E FAZ SMURFS CHORAREM.",
+ "WASABEE_MODE_LABEL": "Modo",
+ "WASABEE_MODE_BATTLE": "Batalha",
+ "WASABEE_MODE_DESIGN": "Design",
+ "WASABEE_MODE_DESC": "No modo de design, as alterações devem ser enviadas manualmente para o servidor; as atribuições feitas não notificarão os agentes; atribuições enviadas do IITC substituirão seu status atual no servidor. No modo de batalha, as alterações serão enviadas automaticamente para o servidor; as atribuições serão enviadas aos agentes via Telegram (se disponível); o status do servidor para atribuições tem prioridade sobre os dados IITC.",
+ "WD BUTTON": "W-D Chaves",
+ "WD BUTTON TITLE": "Log de chaves defensivas",
+ "WEBVIEW": "Login do Webview (iOS)",
+ "WEBVIEW VERIFY": "Verificar Webview",
+ "WRITE": "escrita",
+ "WRITE_SHORT": "RW",
+ "WSERVER": "Servidor: ${value}",
+ "YES": "Sim",
+ "YESNO_DEL": "Tem certeza de que deseja excluir ${value}?",
+ "LINK STATE PROMPT": "Estado do link",
+ "LINK STATE": "Definir o status do link",
+ "D_SHOW_LIST": "Chaves de defesa de entrada",
+ "WASABEE_D_LIST": "Contagem de chaves defensivas de entrada",
+ "ONION_WAS_TAKEN": "Cebola",
+ "ONION": "Desenhar",
+ "SELECT_ONION_PORTALS": "As camadas são construídas de dentro para fora. Aumenta o zoom para o centro e seleciona o portal inicial, em seguida, diminui o zoom para a área.",
+ "MAX_SPLITS": "Divisões máximas",
+ "smallScreen": {
+ "LOG IN": "Log In",
+ "LOG_OUT": "Log Out",
+ "NEWOP BUTTON": "Nova Op",
+ "CLEAROPS BUTTON": "Limpar",
+ "TEAMS BUTTON": "Equipas",
+ "WD BUTTON": "W-D Chaves",
+ "OPS BUTTON": "Ops",
+ "CHECKLIST BUTTON": "Verificar",
+ "MARKER LIST": "Marcadores",
+ "BLOCKER TITLE": "Blockers",
+ "KEYS": "Chaves",
+ "EXPORT OP": "Exportar",
+ "QD END": "Fim",
+ "ADD_LINKS": "+ Links",
+ "MM": "Multi",
+ "MULTI_M": "Desenhar",
+ "MULTI_M_TITLE": "Desenhar Maximo de Layers",
+ "STARBURST": "Estrela",
+ "STARBURST_DRAW": "Desenhar",
+ "ADD_MARKER": "+ Marcador",
+ "MARKERS BUTTON TITLE": "Marcadores",
+ "FAN_FIELD3": "Fan",
+ "FANFIELD": "Desenhar",
+ "FANFIELD2": "Desenhar Fan Field",
+ "MAX": "Fan"
+ }
+}
From f98785c8def63815870cb58cf327aefa62f72de7 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 2 Sep 2021 18:22:33 +0200
Subject: [PATCH 041/275] Build with webpack only (#286)
---
.github/workflows/dev.yaml | 2 +-
.github/workflows/master.yaml | 2 +-
gulpfile.js | 221 +---------------------------------
package.json | 15 +--
plugin.config.json | 5 +-
src/code/init.js | 2 +
src/code/static.js | 36 +++---
src/code/wX.js | 8 +-
src/headers.js | 13 --
src/main.js | 19 ---
src/wrapper/afterWrapper.js | 19 ---
src/wrapper/pluginEnd.js | 10 --
src/wrapper/pluginStart.js | 6 -
webpack.config.js | 154 ++++++++++++++++++++++-
14 files changed, 182 insertions(+), 330 deletions(-)
delete mode 100644 src/headers.js
delete mode 100644 src/main.js
delete mode 100644 src/wrapper/afterWrapper.js
delete mode 100644 src/wrapper/pluginEnd.js
delete mode 100644 src/wrapper/pluginStart.js
diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml
index 7a581c836..d4878e233 100644
--- a/.github/workflows/dev.yaml
+++ b/.github/workflows/dev.yaml
@@ -13,7 +13,7 @@ jobs:
- name: Build 🔧
run: |
npm install
- npx gulp build-dev
+ npm run build-dev
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.1
diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml
index 1bfc20a6d..46dd26bcf 100644
--- a/.github/workflows/master.yaml
+++ b/.github/workflows/master.yaml
@@ -13,7 +13,7 @@ jobs:
- name: Build 🔧
run: |
npm install
- npx gulp build-prod
+ npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.1
diff --git a/gulpfile.js b/gulpfile.js
index adfda1f1e..4543f1d1d 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,164 +1,8 @@
// Requires
-const fs = require("fs");
-const path = require("path");
const gulp = require("gulp");
-const injectfile = require("gulp-inject-file"); // https://www.npmjs.com/package/gulp-inject-file
-const rename = require("gulp-rename"); // https://www.npmjs.com/package/gulp-rename
-const contents = require("gulp-inject-string"); // https://www.npmjs.com/package/gulp-inject-string
-const cfg = require("./plugin.config.json");
-const trimlines = require("gulp-trimlines");
-const eslint = require("gulp-eslint");
const del = require("del");
-const webpack = require("webpack");
-const PluginError = require("plugin-error");
-const prettier = require("gulp-prettier");
const through2 = require("through2");
-const ensureDirectoryExistence = (filePath) => {
- const dirname = path.dirname(filePath);
- if (fs.existsSync(dirname)) return;
-
- ensureDirectoryExistence(dirname);
- fs.mkdirSync(dirname);
-};
-
-// Config
-var status = {
- headers: null,
- mode: null,
-};
-
-// status related tasks
-gulp.task("set-mode-dev", (cb) => {
- status.mode = "dev";
- cb();
-});
-
-gulp.task("set-mode-prod", (cb) => {
- status.mode = "prod";
- cb();
-});
-
-gulp.task("clear", (cb) => {
- status.headers = null;
- status.mode = null;
- cb();
-});
-
-// build tasks
-gulp.task("buildheaders", (cb) => {
- const content = fs.readFileSync(cfg.src.meta, "utf8");
-
- let newContent = "";
- for (const l of content.split("\n")) {
- let newline = l;
- for (const k of Object.keys(cfg.headers.common)) {
- if (l.indexOf(`@${k} `) == 3) {
- const key = k.padEnd(13);
- newline = `// @${key} ${cfg.headers.common[k]}`;
- break;
- }
- }
- for (const k of Object.keys(cfg.headers[status.mode])) {
- if (l.indexOf(`@${k} `) == 3) {
- const key = k.padEnd(13);
- newline = `// @${key} ${cfg.headers[status.mode][k]}`;
- break;
- }
- }
- newContent += newline + "\n";
- }
-
- // XXX just append to the version rather than overwriting a fixed string now
- const gbd = () => {
- const d = new Date();
- let bd = d.getUTCFullYear();
- let t = ("0" + (d.getUTCMonth() + 1)).substr(-2);
- bd += t;
- t = ("0" + d.getUTCDate()).substr(-2);
- bd += t;
- t = ("0" + d.getUTCHours()).substr(-2);
- bd += t;
- t = ("0" + d.getUTCMinutes()).substr(-2);
- bd += t;
- t = ("0" + d.getUTCSeconds()).substr(-2);
- bd += t;
- return bd;
- };
- newContent = newContent.replace("BUILDDATE", gbd());
-
- status.headers = newContent;
-
- cb();
-});
-
-gulp.task("webpack", (callback) => {
- const webpackConfig = require("./webpack.config.js");
- if (status.mode === "prod") {
- webpackConfig.mode = "production";
- webpackConfig.devtool = "nosources-source-map";
- }
- if (status.mode === "dev") {
- webpackConfig.mode = "development";
- webpackConfig.devtool = "eval-source-map";
- // webpackConfig.optimization.minimize = true;
- }
- webpack(webpackConfig, function (err, stats) {
- if (err) {
- throw new PluginError({ plugin: "webpack", message: err });
- }
-
- if (stats.hasErrors()) {
- throw new PluginError({
- plugin: "webpack",
- message: stats.toString({
- // output options
- colors: true,
- }),
- });
- }
-
- console.log(
- stats.toString({
- // output options
- colors: true,
- })
- );
-
- callback();
- });
-});
-
-gulp.task("buildplugin", (cb) => {
- const destination = cfg.releaseFolder[status.mode];
-
- gulp
- .src(cfg.src.plugin)
- // prepend headers
- .pipe(contents.prepend(status.headers))
- // inject files
- .pipe(
- injectfile({
- pattern: "\\/\\*+\\s*inject:\\s*\\s*\\*+\\/",
- })
- )
- // trim leading spaces
- .pipe(trimlines({ leading: false }))
- // rename and save
- .pipe(rename(cfg.pluginName))
- .pipe(gulp.dest(destination));
- cb();
-});
-
-gulp.task("buildmeta", (cb) => {
- const p = path.join(cfg.releaseFolder[status.mode], cfg.metaName);
-
- ensureDirectoryExistence(p);
- fs.writeFile(p, status.headers, (err) => {
- cb(err);
- });
-});
-
// locales, key parity
gulp.task("locales", (cb) => {
const english = require("./src/code/translations/english.json");
@@ -192,69 +36,6 @@ gulp.task("locales", (cb) => {
cb();
});
-// ESLint
-gulp.task("eslint", (cb) => {
- gulp
- .src([
- "**/*.js",
- "!node_modules/**",
- "!dist/**",
- "!releases/**",
- "!src/lib/**",
- ])
- .pipe(eslint())
- .pipe(eslint.format())
- .pipe(eslint.failAfterError());
- cb();
-});
-
-gulp.task("eslint-fix", () => {
- return gulp
- .src([
- "**/*.js",
- "!node_modules/**",
- "!dist/**",
- "!releases/**",
- "!src/lib/**",
- ])
- .pipe(eslint({ fix: true }))
- .pipe(eslint.format())
- .pipe(gulp.dest("."))
- .pipe(eslint.failAfterError());
-});
-
-gulp.task("prettier", () => {
- return gulp
- .src([
- "**/*.js",
- "!node_modules/**",
- "!dist/**",
- "!releases/**",
- "!src/lib/**",
- ])
- .pipe(prettier())
- .pipe(gulp.dest("."));
-});
-
-gulp.task(
- "build",
- gulp.series(["buildheaders", "buildmeta", "webpack", "buildplugin"])
-);
-
-// eslint-fix already formats the file
-gulp.task("format", gulp.series(["eslint-fix"]));
-// gulp.task("format", gulp.series(["prettier"]));
-
-gulp.task(
- "build-dev",
- gulp.series(["set-mode-dev", "format", "build", "clear"])
-);
-
-gulp.task(
- "build-prod",
- gulp.series(["set-mode-prod", "format", "build", "clear"])
-);
-
-gulp.task("default", gulp.series(["build-dev"]));
+gulp.task("default", gulp.series(["locales"]));
gulp.task("clean", () => del(["releases/*"]));
diff --git a/package.json b/package.json
index 173b0f06c..e198dc833 100644
--- a/package.json
+++ b/package.json
@@ -10,28 +10,25 @@
"eslint": "^7.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
+ "eslint-webpack-plugin": "^3.0.1",
"fancy-log": "^1.3.3",
"gulp": "^4.0.2",
- "gulp-eslint": "^6.0.0",
- "gulp-inject-file": "^0.0.19",
- "gulp-inject-string": "^1.1.1",
- "gulp-prettier": "^3.0.0",
- "gulp-rename": "^2.0.0",
- "gulp-trimlines": "^1.0.1",
"html-loader": "^2.1.2",
"lodash": "^4.17.21",
- "plugin-error": "^1.0.1",
"prettier": "^2.3.1",
"pretty-quick": "^3.1.0",
"raw-loader": "^4.0.2",
"style-loader": "^2.0.0",
+ "through2": "^4.0.2",
"to-string-loader": "^1.1.6",
"url-loader": "^4.1.1",
"webpack": "^5.38.1",
- "webpack-cli": "^4.7.1"
+ "webpack-cli": "^4.8.0"
},
"scripts": {
- "test": "none"
+ "build": "webpack --progress --mode production",
+ "build-dev": "webpack --progress --mode development",
+ "locales": "gulp locales"
},
"repository": {
"type": "git",
diff --git a/plugin.config.json b/plugin.config.json
index 90a28d8ed..833280a4b 100644
--- a/plugin.config.json
+++ b/plugin.config.json
@@ -16,10 +16,7 @@
"namespace": "https://wasabee.rocks/",
"description": "Wasabee is not for dating.",
"author": "Wasabee Project Team",
- "category": "Draw",
- "include": "https://intel.ingress.com/*",
- "TESTinclude": "/https?:\\/\\/.*\\.ingress\\.com\\/?((intel|mission)?(\\/?(\\?|#).*)?)?/",
- "grant": "none"
+ "category": "Draw"
}
},
"releaseFolder": {
diff --git a/src/code/init.js b/src/code/init.js
index cb03ea9ae..59abef6b4 100644
--- a/src/code/init.js
+++ b/src/code/init.js
@@ -1,3 +1,4 @@
+import statics from "./static";
import { initCrossLinks } from "./crosslinks";
import initServer from "./server";
import { setupLocalStorage, initSelectedOperation } from "./selectedOp";
@@ -21,6 +22,7 @@ import db from "./db";
import polyfill from "./polyfill";
const Wasabee = window.plugin.wasabee;
+Wasabee.static = statics;
window.plugin.wasabee.init = async () => {
// polyfill
diff --git a/src/code/static.js b/src/code/static.js
index 66ec8495f..5d743d63e 100644
--- a/src/code/static.js
+++ b/src/code/static.js
@@ -1,7 +1,4 @@
-// this file is loaded by the build system
-const W = window.plugin.wasabee || {};
-
-W.static = {
+const statics = {
CSS: {
main: require("./css/wasabee.css"),
autodraws: require("./css/autodraws.css"),
@@ -85,32 +82,32 @@ W.static = {
],
};
-W.static.strings = {}; // empty object, fill it below
-W.static.strings["Deutsch"] = require("./translations/german.json");
-W.static.strings["Espanol"] = require("./translations/spanish.json");
-W.static.strings["English"] = require("./translations/english.json");
-W.static.strings["Italiano"] = require("./translations/italian.json");
-W.static.strings["Tagalog"] = require("./translations/filipino.json");
-W.static.strings["Français"] = require("./translations/french.json");
-W.static.strings["Português"] = require("./translations/portuguese.json");
+statics.strings = {}; // empty object, fill it below
+statics.strings["Deutsch"] = require("./translations/german.json");
+statics.strings["Espanol"] = require("./translations/spanish.json");
+statics.strings["English"] = require("./translations/english.json");
+statics.strings["Italiano"] = require("./translations/italian.json");
+statics.strings["Tagalog"] = require("./translations/filipino.json");
+statics.strings["Français"] = require("./translations/french.json");
+statics.strings["Português"] = require("./translations/portuguese.json");
-W.static.defaultOperationColor = "orange";
+statics.defaultOperationColor = "orange";
-W.static.linkStyle = {
+statics.linkStyle = {
dashArray: [5, 5, 1, 5],
assignedDashArray: [4, 2, 1],
opacity: 1,
weight: 2,
};
-W.static.selfBlockStyle = {
+statics.selfBlockStyle = {
color: "#ff1111",
dashArray: [1, 5],
opacity: 4,
weight: 3,
};
-W.static.backgroundLinkStyle = {
+statics.backgroundLinkStyle = {
dashArray: [8, 5],
opacity: 0.4,
weight: 2,
@@ -118,10 +115,10 @@ W.static.backgroundLinkStyle = {
interactive: false,
};
-W.static.anchorTemplate = require("!raw-loader?esModule=false!./images/pin_custom.svg");
+statics.anchorTemplate = require("!raw-loader?esModule=false!./images/pin_custom.svg");
// https://leafletjs.com/reference-1.0.3.html#path
-W.static.layerTypes = new Map([
+statics.layerTypes = new Map([
[
"main",
{
@@ -180,4 +177,5 @@ W.static.layerTypes = new Map([
],
]);
-export const constants = W.static.constants;
+export const constants = statics.constants;
+export default statics;
diff --git a/src/code/wX.js b/src/code/wX.js
index a400ee813..4cf9e0b58 100644
--- a/src/code/wX.js
+++ b/src/code/wX.js
@@ -1,7 +1,9 @@
+import statics from "./static";
+
// aliases to make review easier
-let strings = window.plugin.wasabee.static.strings;
-const defaultLang = window.plugin.wasabee.static.constants.DEFAULT_LANGUAGE;
-const localStoreKey = window.plugin.wasabee.static.constants.LANGUAGE_KEY;
+let strings = statics.strings;
+const defaultLang = statics.constants.DEFAULT_LANGUAGE;
+const localStoreKey = statics.constants.LANGUAGE_KEY;
const templateRe = /\{ *([\w_ -]+) *\}/g;
diff --git a/src/headers.js b/src/headers.js
deleted file mode 100644
index 1b853dbab..000000000
--- a/src/headers.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// ==UserScript==
-// @id set
-// @name set
-// @namespace set
-// @version set
-// @updateURL set
-// @downloadURL set
-// @description set
-// @author set
-// @include https://intel.ingress.com/*
-// @category set
-// @grant none
-// ==/UserScript==
diff --git a/src/main.js b/src/main.js
deleted file mode 100644
index 5c2fbd415..000000000
--- a/src/main.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/* eslint-disable */
-function wrapper(plugin_info) {
- /* inject: ./wrapper/pluginStart.js */
-
- window.plugin.Wasabee = window.plugin.wasabee = {};
- window.plugin.wasabee.info = plugin_info.script;
-
- // Code injection
- let setup = function () {
- /* inject: ../dist/static-bundle.js */
-
- /* inject: ../dist/init-bundle.js */
-
- window.plugin.wasabee.init();
- };
-
- /* inject: ./wrapper/pluginEnd.js */
-}
-/* inject: ./wrapper/afterWrapper.js */
diff --git a/src/wrapper/afterWrapper.js b/src/wrapper/afterWrapper.js
deleted file mode 100644
index 13a3eec1e..000000000
--- a/src/wrapper/afterWrapper.js
+++ /dev/null
@@ -1,19 +0,0 @@
-//wrapper end
-
-// inject code into site context
-var script = document.createElement("script");
-var info = {};
-if (typeof GM_info !== "undefined" && GM_info && GM_info.script) {
- info.script = {
- version: GM_info.script.version,
- name: GM_info.script.name,
- description: GM_info.script.description,
- };
-}
-
-script.appendChild(
- document.createTextNode("(" + wrapper + ")(" + JSON.stringify(info) + ");")
-);
-(document.body || document.head || document.documentElement).appendChild(
- script
-);
diff --git a/src/wrapper/pluginEnd.js b/src/wrapper/pluginEnd.js
deleted file mode 100644
index 4585b7e52..000000000
--- a/src/wrapper/pluginEnd.js
+++ /dev/null
@@ -1,10 +0,0 @@
-// PLUGIN END ----------------------------------------------------------
-setup.info = plugin_info; //add the script info data to the function as a property
-if (!window.bootPlugins) {
- window.bootPlugins = [];
-}
-window.bootPlugins.push(setup);
-// if IITC has already booted, immediately run the 'setup' function
-if (window.iitcLoaded && typeof setup === "function") {
- setup();
-}
diff --git a/src/wrapper/pluginStart.js b/src/wrapper/pluginStart.js
deleted file mode 100644
index e342c8a16..000000000
--- a/src/wrapper/pluginStart.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// ensure plugin framework is there, even if iitc is not yet loaded
-if (typeof window.plugin !== "function") {
- window.plugin = function () {};
-}
-
-// PLUGIN START --------------------------------------------------------
diff --git a/webpack.config.js b/webpack.config.js
index 1271d2b77..976029387 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,15 +1,141 @@
const path = require("path");
-const outputPath = path.join(__dirname, "dist");
+const outputPath = path.join(__dirname, "releases");
+const ESLintPlugin = require("eslint-webpack-plugin");
-module.exports = {
- mode: "production",
+const { ConcatSource } = require("webpack-sources");
+const Compilation = require("webpack/lib/Compilation");
+
+const wrapPrefix = `
+function wrapper(plugin_info) {
+ if (typeof window.plugin !== "function") {
+ window.plugin = function () {};
+ }
+
+ window.plugin.Wasabee = window.plugin.wasabee = {};
+ window.plugin.wasabee.info = plugin_info.script;
+
+ // Code injection
+ function setup () {
+`;
+const wrapSuffix = `
+ window.plugin.wasabee.init();
+ };
+
+ setup.info = plugin_info; //add the script info data to the function as a property
+ if (!window.bootPlugins) {
+ window.bootPlugins = [];
+ }
+ window.bootPlugins.push(setup);
+ // if IITC has already booted, immediately run the 'setup' function
+ if (window.iitcLoaded && typeof setup === "function") {
+ setup();
+ }
+}
+
+var script = document.createElement("script");
+var info = {};
+if (typeof GM_info !== "undefined" && GM_info && GM_info.script) {
+ info.script = {
+ version: GM_info.script.version,
+ name: GM_info.script.name,
+ description: GM_info.script.description,
+ };
+}
+
+script.appendChild(
+ document.createTextNode("(" + wrapper + ")(" + JSON.stringify(info) + ");")
+);
+(document.body || document.head || document.documentElement).appendChild(
+ script
+);
+`;
+
+class IITCScript {
+ constructor(options) {
+ this.options = options || {};
+ this.header = "";
+ this.header += "// ==UserScript==\n";
+ const keys = [
+ "id",
+ "name",
+ "namespace",
+ "version",
+ "updateURL",
+ "downloadURL",
+ "description",
+ "author",
+ "match",
+ "category",
+ "grant",
+ ];
+ const meta = {
+ match: "https://intel.ingress.com/*",
+ grant: "none",
+ version: "",
+ };
+ Object.assign(meta, options.meta);
+ meta.version = meta.version.replace(
+ "BUILDDATE",
+ new Date()
+ .toISOString()
+ .replace(/[^0-9]/g, "")
+ .slice(0, 14)
+ );
+ keys.forEach((key) => {
+ Array.prototype.concat
+ .apply([], meta[key] && [meta[key]])
+ .forEach((value) => {
+ if (value) this.header += `// @${key.padEnd(13)} ${value}\n`;
+ });
+ });
+ this.header += "// ==/UserScript==\n\n";
+ }
+
+ apply(compiler) {
+ compiler.hooks.compilation.tap("Userscript", (compilation) => {
+ compilation.hooks.processAssets.tap(
+ {
+ name: "Userscript",
+ stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE,
+ },
+ () => {
+ compilation.chunks.forEach((chunk) => {
+ chunk.files.forEach((file) => {
+ compilation.updateAsset(
+ file,
+ new ConcatSource(
+ this.header,
+ wrapPrefix,
+ compilation.assets[file],
+ wrapSuffix
+ )
+ );
+ });
+ });
+ if (this.options.withMeta) {
+ compilation.chunks.forEach((chunk) => {
+ chunk.files.forEach((file) => {
+ if (file.match(/user.js$/))
+ compilation.emitAsset(
+ file.replace(/user.js$/, "meta.js"),
+ new ConcatSource(this.header),
+ { minimized: true }
+ );
+ });
+ });
+ }
+ }
+ );
+ });
+ }
+}
+
+const config = {
entry: {
- static: "./src/code/static.js",
init: "./src/code/init.js",
},
output: {
- path: outputPath,
- filename: "[name]-bundle.js",
+ filename: "wasabee.user.js",
},
resolve: {
modules: ["node_modules"],
@@ -36,4 +162,20 @@ module.exports = {
},
],
},
+ plugins: [new ESLintPlugin({ fix: true })],
+};
+
+module.exports = (env, argv) => {
+ const pluginConfig = require("./plugin.config.json");
+ const meta = pluginConfig.headers.common;
+ if (argv.mode === "development") {
+ config.output.path = path.join(outputPath, "dev");
+ config.devtool = "eval-source-map";
+ Object.assign(meta, pluginConfig.headers.dev);
+ } else {
+ config.output.path = path.join(outputPath, "prod");
+ Object.assign(meta, pluginConfig.headers.prod);
+ }
+ config.plugins.push(new IITCScript({ meta: meta, withMeta: true }));
+ return config;
};
From d7af2013511204b47686ce758e8d4f0b48dd52a1 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 2 Sep 2021 18:27:30 +0200
Subject: [PATCH 042/275] protuguese: key parity/order
---
src/code/translations/portuguese.json | 317 ++++++++++++++------------
1 file changed, 169 insertions(+), 148 deletions(-)
diff --git a/src/code/translations/portuguese.json b/src/code/translations/portuguese.json
index a1b13e4a8..bc5b97fc7 100644
--- a/src/code/translations/portuguese.json
+++ b/src/code/translations/portuguese.json
@@ -1,385 +1,406 @@
{
- "acknowledged": "Reconhecido",
- "assigned": "Atribuído",
- "completed": "Completo",
- "pending": "Pendente",
- "CapturePortalMarker": "Capturado",
- "LetDecayPortalAlert": "Deixar caír",
- "DestroyPortalAlert": "Destroir",
- "FarmPortalMarker": "Farmar",
- "GotoPortalMarker": "Ir para",
- "GetKeyPortalMarker": "Retirar Chaves",
- "CreateLinkAlert": "Link",
- "MeetAgentPortalMarker": "Conhecer Agente",
- "OtherPortalAlert": "Otros",
- "RechargePortalAlert": "Recharge",
- "UpgradePortalAlert": "Upgrade",
- "UseVirusPortalAlert": "Usar Virus",
- "ExcludeMarker": "Excluir de Auto-Desenhar / Marcar",
- "SET_PORTAL_COMMENT": "Definir comentário do portal",
"ABOUT WASABEE-IITC": "Sobre Wasabee-IITC",
"ABOUT_WASABEE": "Sobre Wasabee",
- "ADD": "Adicionar",
- "ADD1": "Adicionar primeiro link",
- "ADD2": "Adicionar segundo link",
+ "acknowledged": "Reconhecido",
+ "ADD LINK TITLE": "Adicionar Links Dialogo",
+ "ADD MARKER TITLE": "Adicionar Marcadores de Dialogo",
"ADD_AGENT": "Adicionar Agente: ",
- "ADD_BUTTON_LINKS": "Adicionar todos os links de uma vez.",
"ADD_BL": "Adicionar links oara trás: ",
- "ADD LINK TITLE": "Adicionar Links Dialogo",
+ "ADD_BUTTON_LINKS": "Adicionar todos os links de uma vez.",
"ADD_LINKS": "Adicionar Links",
- "ADD MARKER TITLE": "Adicionar Marcadores de Dialogo",
"ADD_MARKER": "+ Marcador",
- "ADD_MARKER2": "Adicionar Marcador",
"ADD_NEW_OP": "Adicionar Nova Op",
"ADD_SUCC_INSTR": "Adicionar agente, bem sucedido",
- "AGENT": "Agente",
+ "ADD_ZONE": "Add Zone",
+ "ADD": "Adicionar",
+ "ADD1": "Adicionar primeiro link",
+ "ADD2": "Adicionar segundo link",
"AGENT_STATS": "Agente Stats",
+ "AGENT": "Agente",
"AGES": " (ages ago)",
"ALREADY_HAS_MARKER": "Este portal já tem um marcador. Escolha um portal diferente.",
- "ANCHOR1": "Âncora 1 ",
- "ANCHOR2": "Âncora 2 ",
- "ANCHOR3": "Âncora 3 ",
+ "AMAZ_TEAM_NAME": "Nome incrível da equipe.",
"ANCHOR ASSIGNMENT": " Todos os links externos",
"ANCHOR_GMAP": "Google Map",
"ANCHOR_PORTAL": "Âncora Portal ",
"ANCHOR_PORTAL2": "Âncora Portal 2",
"ANCHOR_PORTAL3": "Âncora Portal 3",
+ "ANCHOR1": "Âncora 1 ",
+ "ANCHOR2": "Âncora 2 ",
+ "ANCHOR3": "Âncora 3 ",
"ANCHORS_AS_BOOKMARKS": "Âncora como bookmarks",
"API_KEY": " api key: ",
- "ASSIGN": "Atribuir",
- "ASSIGNED": "Atribuido",
"ASS_TO": "Atrubuir a:",
"ASSIGN LINK PROMPT": "Atribuir link para: ${value}",
"ASSIGN MARKER PROMPT": "Atrubuir marcador para: ${value}",
- "ASSIGN OUTBOUND": "Atribuir links externos",
"ASSIGN OUTBOUND PROMPT": "Atribuir todos os links externos de: ${value}",
- "ASSIGNED_ONLY": "Só Atribuir",
+ "ASSIGN OUTBOUND": "Atribuir links externos",
+ "ASSIGN": "Atribuir",
"ASSIGNED_ONLY_SHORT": "A",
+ "ASSIGNED_ONLY": "Só Atribuir",
+ "assigned": "Atribuído",
+ "ASSIGNED": "Atribuido",
"AUTH ANDROID": "No Android, tentar primeiro 'rápido'. Se isso falhar, tentar o login principal com 'select_account'..",
"AUTH INCOMPAT": "Você ativou um plugin no TamperMonkey que é incompatível com o Wasabee",
"AUTH IOS": "No iOS, use o 'Login' principal. se isso falhar, faça 'Webview Log in', faça o login; em seguida, use o botão 'Verificar Webview' para concluir o processo.",
"AUTH REQUIRED": "Autentificação Requerida",
"AUTH TOKEN REJECTED": "Envio de token de autenticação rejeitado pelo servidor: ${value}",
"AUTH_SELECT_ACCOUNT": "Selecionar conta",
- "AUTODRAWS": "Wasabee Auto-draw Opções",
"AUTO_DRAWS": "Auto-draw",
- "AUTOLOAD": "Carregar automaticamente os detalhes do portal em falta",
+ "AUTODRAWS": "Wasabee Auto-draw Opções",
"AUTOLOAD_RATE": "Taxa de solicitação de detalhes do portal (ms)",
- "AUTOMARK": "Auto-Marcar",
+ "AUTOLOAD": "Carregar automaticamente os detalhes do portal em falta",
"AUTOMARK STOP": "Auto-Marcar interrompido devido a portais não serem carregados",
- "AMAZ_TEAM_NAME": "Nome incrível da equipe.",
+ "AUTOMARK": "Auto-Marcar",
"BAT_TOAD": "Battle Toads",
"BLOCKER LIST TITLE": "Mostrar todos os blockers",
"BLOCKER TITLE": "Blockers",
"CANCEL": "Cancelar",
"CAPSULE": "Capsula",
- "CHANGE SERVER": "Trocar de Servidor",
+ "CapturePortalMarker": "Capturado",
"CHANGE SERVER PROMPT": "Novo servidro Wasabee",
+ "CHANGE SERVER": "Trocar de Servidor",
"CHANGE_WAS_SERVER": "Mudar servidor Wasabee",
"CHECKLIST BUTTON TITLE": "Checklist da Operação",
"CHECKLIST BUTTON": "Checklist",
- "CLEAR": "Limpar selecção",
- "CLEAR_EVERYTHING": "limpar Portais/Links/Marcadores",
"CLEAR LINKS": "Limpar Links",
"CLEAR MARKERS": "Limpar Markers",
- "CLEAROPS BUTTON": "Limpar dados Wasabee",
+ "CLEAR_EVERYTHING": "limpar Portais/Links/Marcadores",
+ "CLEAR": "Limpar selecção",
"CLEAROPS BUTTON TITLE": "limpar TODOS os dados Wasabee",
+ "CLEAROPS BUTTON": "Limpar dados Wasabee",
"CLEAROPS PROMPT": "Isto limpará todas as OPS e dados relacionados a Wasabee. Tudo será restaurado apartir do servidor na próxima sincronização.",
"CLOSE": "Perto",
- "COMPLETED": "Completo",
+ "COMMENT": "Comentario",
"COMPLETED BY": "Completo por ${value}",
+ "completed": "Completo",
+ "COMPLETED": "Completo",
"CON_DEL": "Confirmar Apagar: ${value}",
- "COMMENT": "Comentario",
"CONFIRM_DELETE": "Desejas realmente excluir este link: ",
"COUNT": "Contar",
"CREATE_NEW_TEAM": "Criar Nova Equipa",
+ "CreateLinkAlert": "Link",
"CUR_USER_INFO": "Informações do usuário atual",
- "DT_FORMAT": "Formato das Ferramentas de Desenho",
+ "D_SHOW_LIST": "Chaves de defesa de entrada",
"DEFAULT OP NAME": "Nova Op: ${value}",
- "DELETE_ANCHOR": "Apagar",
"DELETE ANCHOR PROMPT": "Desejas excluir esta âncora e todos os links associados: ",
"DELETE ANCHOR TITLE": "Apagar Âncora",
- "DELETE_LINK": "Apagar",
- "DELETE_MARKER": "Apagar",
"DELETE MARKER PROMPT": "Desejas apagar esta âncora: ",
"DELETE MARKER TITLE": "Apagar Marcador",
- "DELETE_OP": "Apagar ${value}",
"DELETE PERM DENIED": "Permissão para excluir negada.",
+ "DELETE_ANCHOR": "Apagar",
+ "DELETE_LINK": "Apagar",
+ "DELETE_MARKER": "Apagar",
+ "DELETE_OP": "Apagar ${value}",
"DELETED": "Excluído com sucesso.",
"DESCRIP_PLACEHOLD": "Descrição (opcional)",
- "DISABLED": "Este recurso não está pronto para os usuários",
+ "DestroyPortalAlert": "Destroir",
"DISABLE_SYNC": "O plugin de sincronização de stoque não é compatível com Wassabe. Desativa a sincronização.",
+ "DISABLED": "Este recurso não está pronto para os usuários",
"DONE": "Feito",
"DRAW TOOLS FORMAT": "Formato Draw Tools",
+ "DT_FORMAT": "Formato das Ferramentas de Desenho",
"DUPE_OP": "Duplicar Operação",
"END_PORT": "Portal final ",
- "EXPORT": "Exportar: ",
- "EXPORT OP": "Exportar Op",
+ "ExcludeMarker": "Excluir de Auto-Desenhar / Marcar",
"EXPORT OP TITLE": "Exportar Op Actual",
+ "EXPORT OP": "Exportar Op",
+ "EXPORT": "Exportar: ",
"FAKED": "Falsificado: [${value}]",
- "FANFIELD": "Desenhar",
- "FANFIELD2": "Desenhar Fan Field",
"FAN_FIELD3": "Fan Field",
"FANFIELD TITLE": "Fanfield",
- "FROM_DEPTH": "da profundidade",
+ "FANFIELD": "Desenhar",
+ "FANFIELD2": "Desenhar Fan Field",
+ "FarmPortalMarker": "Farmar",
"FROM_1-2": "A Partir da base 1-2",
"FROM_1-3": "A Partir da base 1-3",
"FROM_2-3": "A Partir da base 2-3",
+ "FROM_DEPTH": "da profundidade",
"FROM_PORT": "A Partir do Portal",
- "GET_DT_DRAW": "Importar Dezenho DrawTools",
"GET DT": "Obtenha o desenho existente do DrawTools",
+ "GET_DT_DRAW": "Importar Dezenho DrawTools",
+ "GetKeyPortalMarker": "Retirar Chaves",
+ "GotoPortalMarker": "Ir para",
+ "H-GEN_INST": "Define portais para a camada externa. Escolhe o número de divisões. Clica para desenhar",
+ "HF_DEEP_SEARCH": "Pesquisa exaustiva",
"HF_DRAW_BUTTON": "Desenhar",
"HF_DRAW_DEEP_BUTTON": "Desenhar com recursão profunda",
- "HF_DEEP_SEARCH": "Pesquisa exaustiva",
"HF_REDRAW_BUTTON": "Redesenhar",
"HG": "Campo Homogêneo",
- "H-GEN_INST": "Define portais para a camada externa. Escolhe o número de divisões. Clica para desenhar",
"HOURS": " (${value} horas atrás)",
"HOW_TO_VIDS": "Vídeos de instruções: ",
"IMP_COMP": "Importação concluída. Encontrada ",
"IMP_DT_OP": "Importar OP Drawtools: ",
- "IMPORT_OP": "Importar Operação",
- "IMPORT_OP_TITLE": "Importar Op: ${value}",
- "IMPORT_OP_SUCCESS": "OP Importada: ${value} successfuly.",
"IMP_NOPE": "A Importação Falhou.",
"IMP_WAS_OP": "Importar Operação Wasabee",
+ "IMPORT_OP_SUCCESS": "OP Importada: ${value} successfuly.",
+ "IMPORT_OP_TITLE": "Importar Op: ${value}",
+ "IMPORT_OP": "Importar Operação",
"IMPOSSIBLE": "Impossível",
"INGNAME_GID": "Nome de entrada ou GoogleID",
"INPUT_DT_KEY_COUNT": "Contagem de chaves defensivas de entrada",
"INPUT_SQUAD_NAME": "Insere um nome de esquadrão",
"INVALID REQUEST": "Pedido inválido",
"IOS NEED FAKE UA": "Deves definir um 'Agente de usuário personalizado para visualizações da Web' nas configurações do IITC-Mobile ou o login falhará",
- "KEYS": "Chaves",
"KEY_LIST2": "Lista de chaves para operação: ${value}",
- "KEY_LIST": "Lista chaves para portal: ${value}",
+ "KEYS": "Chaves",
"KNOWN_BLOCK": "Blockers conhecidos: ${value}",
- "LA": "L8+ alguns LA",
"LA DESC": "Dependendo do número e tipo de Link Amps usados, um nível de portal de origem inferior pode ser suficiente.",
+ "LA": "L8+ alguns LA",
"LANG": "Língua",
"LEAVE": "Deixar",
- "LINKS": "Links",
- "LINKS2": ": Links",
+ "LetDecayPortalAlert": "Deixar caír",
"LINK ASSIGNMENT": "Atribuição de Link",
+ "LINK STATE PROMPT": "Estado do link",
+ "LINK STATE": "Definir o status do link",
"LINKS BUTTON TITLE": "Links",
+ "LINKS": "Links",
+ "LINKS2": ": Links",
+ "LOAD PORTALS": "Carregar Portais",
"LOADING": "[a carregar]",
"LOADING1": "a carregar: [${value}]",
- "LOAD PORTALS": "Carregar Portais",
"LOC_PROC": "localização processada",
"LOC_UPDATE": "Atualização de localização",
"LOCATION SUB": "Localização registrada",
"LOCFRMSER": " (localmente e do servidor)",
+ "LOG IN QUICK": "Log In (Rápido; para Android)",
"LOG IN": "Log In",
"LOG_OUT": "Log Out",
- "LOG IN QUICK": "Log In (Rápido; para Android)",
- "MADRID_WAS_TAKEN": "Madrid Protocol",
- "MADRID_TITLE": "Madrid Protocol",
- "MADRID": "Desenhar",
- "MADRID_NOTSET": "baselink não definido.",
"MADRID_SET_1": "Selecione a região para a ligação de base Âncora 2 à Âncora 3",
"MADRID_SET_2": "Selecione a região para a ligação de base Âncora 3 à Âncora 1",
"MADRID_SET_3": "Selecione a região para a ligação de base Âncora 1 a Âncora 2",
- "MANAGE": "Gerenciar",
+ "MADRID_TITLE": "Madrid Protocol",
+ "MADRID_WAS_TAKEN": "Madrid Protocol",
+ "MADRID": "Desenhar",
"MANAGE_TEAM": "Gerenciar ${value}",
- "MARKERS BUTTON TITLE": "Marcadores",
+ "MANAGE": "Gerenciar",
+ "MARKER ASSIGNMENT": " Atribuição de marcador",
"MARKER LIST TITLE": "Lista de Marcadores",
"MARKER LIST": "Marcadores",
- "MARKER_LIST": "Lista de Marcadores: ${value}",
- "MARKER ASSIGNMENT": " Atribuição de marcador",
"MARKER STATE PROMPT": "Status do marcador",
"MARKER STATE": " Definir estado do marcador",
+ "MARKER_LIST": "Lista de Marcadores: ${value}",
+ "MARKERS BUTTON TITLE": "Marcadores",
+ "MAX_SPLITS": "Divisões máximas",
"MAX": "Fan Field",
+ "MeetAgentPortalMarker": "Conhecer Agente",
+ "MERGE ON UPDATE": "Merge on update",
+ "MERGE_CHANGES_LOCAL": "Local changes",
+ "MERGE_CHANGES_MERGE": "Merge result",
+ "MERGE_CHANGES_REMOTE": "Remote changes",
+ "MERGE_LOCAL": "Keep local",
+ "MERGE_MESSAGE": "It seems that {opName} has local changes. Do you want to merge your modifications with the server OP, use the server version or keep the local version?",
+ "MERGE_REBASE": "Merge",
+ "MERGE_REPLACE": "Use server",
+ "MERGE_TITLE": "Merge local&remote OP",
"MIN_SRC_PORT_LVL": "Nível mínimo exigido no portal de origem",
"MINUTES": " (${value} minutos atrás)",
"MM": "Multimax",
- "MY_CAP_ID": "Minha Capsula ID",
- "MY_COUNT": "Minha Conta",
- "MULTIMAX": "Multimax!",
- "MUST_NOT_BE_EMPTY": "Não deve estar vazio",
- "MULTIMAX2": "Multimax",
+ "MM_INSERT_ORDER": "Insert at the end",
"MULTI_M_TITLE": "Desenhar camadas máximas",
"MULTI_M": "Desenhar",
- "NAME": "Nome: ",
+ "MULTIMAX": "Multimax!",
+ "MULTIMAX2": "Multimax",
+ "MUST_NOT_BE_EMPTY": "Não deve estar vazio",
+ "MY_CAP_ID": "Minha Capsula ID",
+ "MY_COUNT": "Minha Conta",
"NAME_REQ": "Nome Requerido",
+ "NAME": "Nome: ",
"NEW_OP": "Nova Operação",
- "NEW_TEAM": "Nova Equipa",
"NEW_TEAM_NAME": "Novo nome de Equipa",
+ "NEW_TEAM": "Nova Equipa",
"NEW_WAS_SERVER": "Novo servidor Waasbee",
- "NOT LOGGED IN": "Não logado: ${value}",
- "NOT LOGGED IN SHORT": "Não logado",
- "NO": "Não",
- "NO_DT_ITEMS": "Nenhum item desenhado do DrawTools foi detectado",
+ "NEWOP BUTTON TITLE": "Criar uma nova operação",
+ "NEWOP BUTTON": "Nova Op",
"NO_DATA": "sem dados",
+ "NO_DT_ITEMS": "Nenhum item desenhado do DrawTools foi detectado",
"NO_LABEL": "Nenhum rótulo definido",
- "NOT_LOADED": "Não totalmente carregado, tente novamente.",
"NO_PORT_SEL": "Nenhum portal selecionado.",
+ "NO_STOCK_INTEL": "Wasabee não suporta importações de desenho de inteligência de stoque",
"NO_TITLE": "Nenhum título definido",
+ "NO": "Não",
+ "NOT LOGGED IN SHORT": "Não logado",
+ "NOT LOGGED IN": "Não logado: ${value}",
+ "NOT_LOADED": "Não totalmente carregado, tente novamente.",
"NOT_SET": "não configurado",
- "NO_STOCK_INTEL": "Wasabee não suporta importações de desenho de inteligência de stoque",
"NTNAME": "Nome",
"OK": "OK",
"ON_HAND": "Na Mão",
+ "ONION_WAS_TAKEN": "Cebola",
+ "ONION": "Desenhar",
"ONLY_DT_IMP": " (apenas para importações do DrawTools)",
"OP DELETED": "Operação removida do servidor: ${value}",
"OP PERM DENIED": "Permissão negada para operação: ${value}",
+ "OP_BUTTON": "Operação",
"OP_CHECKLIST": "Lista de verificação de operação: ${value}",
"OP_NAME_UNSET": "O nome da operação não estava definido",
"OP_PERMS": "Permissões de operação",
+ "OP_SETTINGS_BUTTON": "Op ⚙",
+ "OP_SETTINGS_TITLE": "Configurações de operação",
"OPEN_REQUEST": "[pedido aberto]",
- "OPER_NAME": "Nome da Operação: ",
"OPER_COLOR": "Cor de operação: ",
+ "OPER_NAME": "Nome da Operação: ",
"OPERATIONS": "Operações",
- "OPS BUTTON": "Ops",
"OPS BUTTON TITLE": "Operações",
- "OP_BUTTON": "Operação",
- "OP_SETTINGS_BUTTON": "Op ⚙",
- "OP_SETTINGS_TITLE": "Configurações de operação",
- "OPTION": "opção",
+ "OPS BUTTON": "Ops",
"ORDER": "Pedido",
+ "OtherPortalAlert": "Otros",
"PASTE_INSTRUCT": "Cola uma exportação de desenho Wasabee aqui.\n\nWasabee cannot import the stock intel format.\n\nThere is experimental support for importing the IITC DrawTools format.\n\nBefore importing DrawTools format, preview the areas and make sure all the portals load so IITC has them cached. Any portals that are not pre-cached will be faked.\n\nYou will need to use the 'swap' feature to move anchors from the faked portals to the real portals (they should be in the correct location, just not associated with the portal.\n\nCached portals might not be properly named.",
+ "pending": "Pendente",
"PENDING": "Pendente",
"PERMS": "${value} permissões",
"PICK_DEST_FIRST": "Seleciona um portal de destino primeiro!",
"PICK_TAR_FIRST": "Seleciona um portal de destino primeiro!",
"PICK_TARGETDEST_Portals": "Seleciona primeiro os portais de destino e destino!",
"PLEASE_SELECT_PORTAL": "Seleciona um portal",
- "PORTAL": "Portal",
- "PORTAL_COUNT": "${value} portais",
- "PORTAL KEY LIST": "Lista de chaves para portal ${value}",
"PORT_FAKE": " portais. Falsificado ",
+ "PORTAL KEY LIST": "Lista de chaves para portal ${value}",
+ "PORTAL_COUNT": "${value} portais",
+ "PORTAL": "Portal",
+ "QD BUTTON CHANGE COLOR": "Click to change next links color",
"QD BUTTON END": "Clique para parar de desenhar campos",
+ "QD BUTTON TOGGLE MODE": "Click to change draw mode",
+ "QD CHANGE COLOR": "Change color",
"QD END": "FIM",
"QD TITLE": "Camadas de desenho rápido",
+ "QD TOGGLE MODE": "Change mode",
"QDBASE": "Link Base",
"QDCANCEL": "Cancelar campos de desenho",
"QDCONT": "Clica num portal espinha para desenhar um campo.",
"QDEND": "Clica novamente no mesmo portal para finalizar o desenho.",
"QDNEXT": "Clica no segundo portal de âncora.",
"QDSTART": "Clica no primeiro portal de âncora.",
- "READ": "Ler",
"READ_SHORT": "Ler Abreviado",
+ "READ": "Ler",
+ "RechargePortalAlert": "Recharge",
+ "REFERENCE_TIME": "Reference Time: ",
"REM_LOC_CP": "Remover cópia local de ${value}",
- "REMOVE": "Remover",
- "REMOVE_TEAM": "Remover Equipe: ",
"REMOVE_TEAM_CONFIRM_LABEL": "Você deseja remover permanentemente ${value} do servidor Wasabee?",
"REMOVE_TEAM_CONFIRM_TITLE": "Remover Equipe ${value}",
- "RENAME": "Renomear",
+ "REMOVE_TEAM": "Remover Equipe: ",
+ "REMOVE": "Remover",
"RENAME_TEAM": "Renomear Equipe: ",
+ "RENAME": "Renomear",
"REQUIRED": "Requerido",
"RESET": "Redefinir",
"REVERSE": "Inverter",
"ROCKS_COM": "enl.rocks comunidade: ",
"ROLE": "Função",
+ "SAVELINKS TITLE": "Save Links",
+ "SAVELINKS_DRAW": "Save Links",
+ "SAVELINKS": "Save Links",
+ "SECONDS": " (${value} segundos atrás)",
+ "SEL_PORT_FIRST": "Selecione primeiro os portais âncora!",
"SEL_SB_ANCHOR": "Seleciona a âncora.",
"SEL_SB_ANCHOR2": "Reduzir o zoom. Verifica se todos os portais foram carregados e clica em desenhar.",
"SEL_SB_ANCHOR3": "Por favor, sê paciente, pode demorar um pouco.",
- "SELECT PORTAL": "Selecionar um portal para enviar",
- "SECONDS": " (${value} segundos atrás)",
- "SEND TARGET": "Enviar alvo",
- "SEND TARGET AGENT": "Selecionar o destinatário alvo",
+ "SEL_SL_ANCHOR": "Select the portal to save the links of. Click save links button and look at checklist.",
"SEL_SRC_ANC2": "Selecionar a fonte e a âncora 2",
"SEL_SRC_PORT": "Selecionar um portal de origem",
+ "SELECT PORTAL": "Seleciona um portal primeiro",
"SELECT_FAN_PORTALS": "Selecionar um portal de âncora, um portal inicial e um portal final e, em seguida, posiciona a visualização sobre a área do campo.",
"SELECT_FAN_PORTALS2": "Wait for all portals to load, then click draw.",
"SELECT_INSTRUCTIONS": "Select two anchor portals, then zoom over the spine area.",
"SELECT_MADRID_INSTRUCTIONS": "Selecionar três portais de âncora, amplia a área próxima à âncora selecionada, espera até que os portais sejam carregados (os portais devem aparecer na tela para serem considerados) e selecioner o botão 'definir região da coluna' para os links de base correspondentes.",
- "SELECT PORTAL": "Seleciona um portal primeiro",
- "SEL_PORT_FIRST": "Selecione primeiro os portais âncora!",
+ "SELECT_ONION_PORTALS": "As camadas são construídas de dentro para fora. Aumenta o zoom para o centro e seleciona o portal inicial, em seguida, diminui o zoom para a área.",
"SELF SWAP": "Não é possível trocar um portal contigo mesmo! Seleciona um portal diferente.",
"SEND ANALYTICS": "Enviar análises anônimas",
"SEND LOCATION": "Enviar localização",
- "SEND_LOC": "Enviar localização",
+ "SEND TARGET AGENT": "Selecionar o destinatário alvo",
"SEND TARGET CONFIRM": "Queres enviar ${value} alvo para ${option}?",
- "SET": "definir",
+ "SEND TARGET": "Enviar alvo",
+ "SEND_LOC": "Enviar localização",
"SET_3_PORT": "Defina os três portais primeiro!",
"SET_COMMENT": "Definir Comentário",
- "SET_LINK_COMMENT": "Definir comentário para o link: ",
"SET_LCOMMENT": "Definir comentário do link",
+ "SET_LINK_COMMENT": "Definir comentário para o link: ",
+ "SET_LINKS_ZONES": "Set Links to Zones ",
"SET_MARKER_COMMENT": "Definir comentário para marcador em: ",
"SET_MARKER_TYPE_TITLE": "Alterar o tipo de marcador",
+ "SET_MARKERS_ZONES": "Set Markers to Zones",
"SET_MCOMMENT": "Definir comentário do marcador: ${value}",
"SET_NEW_OP": "Define o novo nome da operação",
- "SET_PORT_COMMENT": "Definir comentário para portal: ",
"SET_PCOMMENT": "Definir comentário do portal: ${value}",
+ "SET_PORT_COMMENT": "Definir comentário para portal: ",
"SET_PORTAL_COMMENT": "Definir comentário do portal",
+ "SET": "definir",
"SETTINGS": "Configurações do Wasabee",
"SKINS_AVAILABLE": "Existem ${value} skins disponíveis.",
"SKINS_BUTTON": "Configurar Skins",
"SKINS_DESCRIPTION": "Gerenciar as skins disponíveis movendo o tema para a coluna da esquerda. Quanto mais baixo na coluna, maior será a prioridade para o UI.",
"SKINS_MANAGE_TITLE": "Gerenciar skins",
+ "SKIP_CONFIRM_ALWAYS": "Never ask (use with caution)",
+ "SKIP_CONFIRM_ENTITY": "Only ask for team/op",
+ "SKIP_CONFIRM_NEVER": "Always ask",
+ "SKIP_CONFIRM": "Skip confirmation",
"SOURCE_PORT": "Portal Fonte ",
"SQUAD": "Esquadrão",
- "STATE": "Estado",
- "STARBURST": "Starburst",
- "STARBURST_DRAW": "Desenhar",
"STARBURST TITLE": "Starburst",
+ "STARBURST_DRAW": "Desenhar",
+ "STARBURST": "Starburst",
"START_PORT": "Portal inicial",
- "TEAM STATE": "Partilhar localização",
+ "STATE": "Estado",
"SUPPORT_INSTRUCT": "Para obter suporte, por favor, junte-se ao The Wasabee User Telegram Channel ",
- "SWAP": "Troca",
"SWAP PROMPT": "Queres trocar: ",
"SWAP TITLE": "Trocar Portais",
"SWAP WITH": " com ",
- "SYNC": "Download operações disponíveis",
+ "SWAP": "Troca",
"SYNC DONE": "Download Completo",
+ "SYNC": "Download operações disponíveis",
"TARDEST_DIFF": "Os portais de destino e destino devem ser diferentes.",
- "TEAMS BUTTON TITLE": "Listar equipas Wasabee",
- "TEAMS BUTTON": "Equipas",
- "NEWOP BUTTON TITLE": "Criar uma nova operação",
- "NEWOP BUTTON": "Nova Op",
"TARGET SENT": "Alvo Enviado",
- "TEAM": "Equipa",
+ "TEAM PERM DENIED": "Permissão negada à equipa: ${value}",
+ "TEAM STATE": "Partilhar localização",
"TEAM_CREATED": "Equipa ${value} created",
"TEAM_NAME": "Nome Equipa",
- "TEAM PERM DENIED": "Permissão negada à equipa: ${value}",
+ "TEAM": "Equipa",
+ "TEAMS BUTTON TITLE": "Listar equipas Wasabee",
+ "TEAMS BUTTON": "Equipas",
"TITLE": "titulo",
- "TRAWL": "Procurar por Blockers",
+ "TO_PORT": "Para o Portal",
+ "TRAWL SKIP TILES": "Trawl Skip Tiles",
+ "TRAWL TITLE": "Trawl Lanes",
+ "TRAWL WARNING": "Isto carregará os dados do bloco em todos os links desenhados. Este é um processo lento.",
"TRAWL_AUTOMARK": "Auto-mark blockers depois da procura",
"TRAWL_BULK_LOAD_WARNING": "Este método carrega os dados do bloco o mais rápido possível. Usa por sua conta e risco.",
"TRAWL_BULK_LOAD": "Carregar rapidamente Dados do Bloco",
"TRAWL_CLEAR_MARKERS": "Limpa vírus / destroi marcadores antes da procura",
- "TRAWL TITLE": "Trawl Lanes",
- "TRAWL WARNING": "Isto carregará os dados do bloco em todos os links desenhados. Este é um processo lento.",
- "TRAWLING": "A Varrer os links a procura de blockers, fecha esta caixa de diálogo para parar",
"TRAWL_REMAINING": "${value} Restantes",
- "TO_PORT": "Para o Portal",
+ "TRAWL": "Procurar por Blockers",
+ "TRAWLING": "A Varrer os links a procura de blockers, fecha esta caixa de diálogo para parar",
"TYPE": "Tipo",
"UNASSIGNED": "Não atribuído",
"UNKNOWN": "Desconhecido",
- "UPDATED": "Atualizado com sucesso",
- "UPDATE HOVER": "UPDATE ${value} no servidor",
"UPDATE HOVER NOT CHANGED": "${value} não mudou localmente",
- "UPDATE_CONFLICT_TITLE": "Conflito detectado com o servidor",
+ "UPDATE HOVER": "UPDATE ${value} no servidor",
+ "UPDATE PERM DENIED": "You do not have permission to update",
"UPDATE_CONFLICT_DESC": "A OP foi modificada no servidor desde a última sincronização. Queres substituir a versão do servidor pela atual?",
+ "UPDATE_CONFLICT_TITLE": "Conflito detectado com o servidor",
+ "UPDATE_COUNT": "Contagem de atualização",
+ "UPDATED": "Atualizado com sucesso",
+ "UpgradePortalAlert": "Upgrade",
"UPLOAD BUTTON HOVER": "UPLOAD ${value} (atualmente não está no servidor)",
"UPLOAD PERM DENIED": "Permissão para upload negada",
"UPLOADED": "Carregado com sucesso",
+ "USE PANES ON MOBILE": "Use panes (need reload)",
"USE_SWAP_INSTRUCT": ". Usa o recurso de troca para mover portais falsos para portais reais no mesmo local. Ampliar os portais 'Carregando' na lista de verificação pode forçá-los a carregar.",
"USE_VALID_NAME": "Usa um nome de operação válido",
- "UPDATE_COUNT": "Contagem de atualização",
- "VRLA": "L8+alguns VRLA",
+ "UseVirusPortalAlert": "Usar Virus",
"VRLA DESC": "Dependendo do número e tipo de Link Amps usados, um nível de portal de origem inferior pode ser suficiente.",
+ "VRLA": "L8+alguns VRLA",
"WASABEE BUTTON TITLE": "Wasabee: É VERDE E FAZ SMURFS CHORAREM.",
- "WASABEE_MODE_LABEL": "Modo",
- "WASABEE_MODE_BATTLE": "Batalha",
- "WASABEE_MODE_DESIGN": "Design",
- "WASABEE_MODE_DESC": "No modo de design, as alterações devem ser enviadas manualmente para o servidor; as atribuições feitas não notificarão os agentes; atribuições enviadas do IITC substituirão seu status atual no servidor. No modo de batalha, as alterações serão enviadas automaticamente para o servidor; as atribuições serão enviadas aos agentes via Telegram (se disponível); o status do servidor para atribuições tem prioridade sobre os dados IITC.",
- "WD BUTTON": "W-D Chaves",
+ "WASABEE_D_LIST": "Contagem de chaves defensivas de entrada",
"WD BUTTON TITLE": "Log de chaves defensivas",
- "WEBVIEW": "Login do Webview (iOS)",
+ "WD BUTTON": "W-D Chaves",
"WEBVIEW VERIFY": "Verificar Webview",
- "WRITE": "escrita",
+ "WEBVIEW": "Login do Webview (iOS)",
"WRITE_SHORT": "RW",
+ "WRITE": "escrita",
"WSERVER": "Servidor: ${value}",
"YES": "Sim",
"YESNO_DEL": "Tem certeza de que deseja excluir ${value}?",
- "LINK STATE PROMPT": "Estado do link",
- "LINK STATE": "Definir o status do link",
- "D_SHOW_LIST": "Chaves de defesa de entrada",
- "WASABEE_D_LIST": "Contagem de chaves defensivas de entrada",
- "ONION_WAS_TAKEN": "Cebola",
- "ONION": "Desenhar",
- "SELECT_ONION_PORTALS": "As camadas são construídas de dentro para fora. Aumenta o zoom para o centro e seleciona o portal inicial, em seguida, diminui o zoom para a área.",
- "MAX_SPLITS": "Divisões máximas",
+ "ZONE_DRAW": "Click to set the zone boundaries",
+ "ZONE": "Zone",
"smallScreen": {
"LOG IN": "Log In",
"LOG_OUT": "Log Out",
From 7be145c3a7884a925152db64f138158f45c9c2ca Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 8 Sep 2021 22:40:31 +0200
Subject: [PATCH 043/275] merge: fix users importing remote op
---
src/code/dialogs/mergeDialog.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/code/dialogs/mergeDialog.js b/src/code/dialogs/mergeDialog.js
index 02c9af499..77c25d49e 100644
--- a/src/code/dialogs/mergeDialog.js
+++ b/src/code/dialogs/mergeDialog.js
@@ -60,7 +60,13 @@ const MergeDialog = WDialog.extend({
_displayDialog: function () {
this._opRebase = new WasabeeOp(this.options.opRemote);
- const origin = new WasabeeOp(this.options.opOwn.fetchedOp);
+ const origin = new WasabeeOp(
+ // while merge should only occurs with server ops, it appears users succeed to merge
+ // with local ops. This is a failsafe for those edge-cases
+ this.options.opOwn.fetchedOp
+ ? this.options.opOwn.fetchedOp
+ : this.options.opOwn.toExport()
+ );
const changes = this.options.opOwn.changes(origin);
const summary = this._opRebase.applyChanges(changes, this.options.opOwn);
this._opRebase.cleanAll();
From 3bb6baa1777915de35635bb7793e93d738e78b26 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 8 Sep 2021 23:03:19 +0200
Subject: [PATCH 044/275] update/upload: add UI feedback
---
src/code/buttons/uploadButton.js | 4 ++++
src/code/css/toolbar.css | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/code/buttons/uploadButton.js b/src/code/buttons/uploadButton.js
index ec8f0f067..c43469f87 100644
--- a/src/code/buttons/uploadButton.js
+++ b/src/code/buttons/uploadButton.js
@@ -38,6 +38,7 @@ const UploadButton = WButton.extend({
}
try {
+ this.button.classList.add("loading");
const r = await uploadOpPromise();
// switch to the new version in local store -- uploadOpPromise stores it
await makeSelectedOperation(r.ID);
@@ -55,6 +56,7 @@ const UploadButton = WButton.extend({
console.error(e);
alert(`Upload + Update Failed: ${e.toString()}`);
}
+ this.button.classList.remove("loading");
}
},
});
@@ -122,6 +124,7 @@ const UploadButton = WButton.extend({
if (operation.isServerOp()) {
try {
if (force) delete operation.lasteditid;
+ this.button.classList.add("loading");
const success = await updateOpPromise(operation);
if (success) {
operation.localchanged = false;
@@ -158,6 +161,7 @@ const UploadButton = WButton.extend({
console.error(e);
alert(`Update Failed: ${e.toString()}`);
}
+ this.button.classList.remove("loading");
return;
}
},
diff --git a/src/code/css/toolbar.css b/src/code/css/toolbar.css
index 09a07589b..fbb5fae18 100644
--- a/src/code/css/toolbar.css
+++ b/src/code/css/toolbar.css
@@ -129,7 +129,8 @@
/*background-image: url(../images/toolbar_sync.png)*/
background-image: url(../images/toolbar_download.svg)
}
-.wasabee-toolbar-sync.loading {
+.wasabee-toolbar-sync.loading,
+.wasabee-toolbar-upload.loading {
background-image: url(../images/loading.gif)
}
From 24ab8470c53dd09191ef47e6336021c54addc505 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 8 Sep 2021 23:15:57 +0200
Subject: [PATCH 045/275] build: add scot build
---
package.json | 1 +
plugin.config.json | 7 ++++++-
webpack.config.js | 6 +++++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index e198dc833..f60d37b3d 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"scripts": {
"build": "webpack --progress --mode production",
"build-dev": "webpack --progress --mode development",
+ "build-scot": "webpack --progress --mode development --env scot",
"locales": "gulp locales"
},
"repository": {
diff --git a/plugin.config.json b/plugin.config.json
index 833280a4b..f4e05872d 100644
--- a/plugin.config.json
+++ b/plugin.config.json
@@ -6,9 +6,14 @@
"version": "0.20.BUILDDATE"
},
"dev": {
+ "downloadURL": "https://cdn2.wasabee.rocks/iitcplugin/latest/dev/wasabee.user.js",
+ "updateURL": "https://cdn2.wasabee.rocks/iitcplugin/latest/dev/wasabee.meta.js",
+ "version": "0.20.BUILDDATE-dev"
+ },
+ "scot": {
"downloadURL": "https://am.wasabee.rocks/static/dev/wasabee.user.js",
"updateURL": "https://am.wasabee.rocks/static/dev/wasabee.meta.js",
- "version": "0.20.BUILDDATE-dev"
+ "version": "0.20.BUILDDATE-scot"
},
"common": {
"id": "Wasabee.user.js",
diff --git a/webpack.config.js b/webpack.config.js
index 976029387..1635fe532 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -168,7 +168,11 @@ const config = {
module.exports = (env, argv) => {
const pluginConfig = require("./plugin.config.json");
const meta = pluginConfig.headers.common;
- if (argv.mode === "development") {
+ if (argv.mode === "development" && env.scot) {
+ config.output.path = path.join(outputPath, "scot");
+ config.devtool = "eval-source-map";
+ Object.assign(meta, pluginConfig.headers.scot);
+ } else if (argv.mode === "development") {
config.output.path = path.join(outputPath, "dev");
config.devtool = "eval-source-map";
Object.assign(meta, pluginConfig.headers.dev);
From a33a55cfed802b15d5d4241b9121546ca6ea9362 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 4 Oct 2021 20:50:55 +0200
Subject: [PATCH 046/275] don't import to duplicate
---
src/code/dialogs/importDialog.js | 18 ++++++++++++++----
src/code/translations/english.json | 2 +-
src/code/translations/filipino.json | 2 +-
src/code/translations/french.json | 2 +-
src/code/translations/german.json | 2 +-
src/code/translations/italian.json | 2 +-
src/code/translations/portuguese.json | 2 +-
src/code/translations/spanish.json | 2 +-
8 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/code/dialogs/importDialog.js b/src/code/dialogs/importDialog.js
index 84f40ca5f..3b3ee1bd9 100644
--- a/src/code/dialogs/importDialog.js
+++ b/src/code/dialogs/importDialog.js
@@ -141,12 +141,22 @@ const ImportDialog = WDialog.extend({
try {
const data = JSON.parse(string);
const importedOp = new WasabeeOp(data);
- await importedOp.store();
- await makeSelectedOperation(importedOp.ID);
- alert(wX("IMPORT_OP_SUCCESS", { opName: importedOp.name }));
+ const localOp = await WasabeeOp.load(importedOp.ID);
+ if (localOp) {
+ alert(
+ wX("IMP_NOPE", {
+ error: "op already exists, either delete it or duplicate",
+ })
+ );
+ await makeSelectedOperation(importedOp.ID);
+ } else {
+ await importedOp.store();
+ await makeSelectedOperation(importedOp.ID);
+ alert(wX("IMPORT_OP_SUCCESS", { opName: importedOp.name }));
+ }
} catch (e) {
console.error("WasabeeTools: failed to import data", e);
- alert(wX("IMP_NOPE"));
+ alert(wX("IMP_NOPE", { error: "data invalid" }));
}
},
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index dc363c9a0..ba723d58c 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -131,7 +131,7 @@
"HOW_TO_VIDS": "How-To Videos: ",
"IMP_COMP": "Import Complete. Found ",
"IMP_DT_OP": "Imported Drawtools Op: ",
- "IMP_NOPE": "Import Failed.",
+ "IMP_NOPE": "Import Failed: {error}",
"IMP_WAS_OP": "Import Wasabee Operation",
"IMPORT_OP_SUCCESS": "Imported Operation: {opName} successfuly.",
"IMPORT_OP_TITLE": "Import Op: {date}",
diff --git a/src/code/translations/filipino.json b/src/code/translations/filipino.json
index f35b34860..e225e35b9 100644
--- a/src/code/translations/filipino.json
+++ b/src/code/translations/filipino.json
@@ -131,7 +131,7 @@
"HOW_TO_VIDS": "How-To Videos: ",
"IMP_COMP": "Natapos ang Pag Import. ",
"IMP_DT_OP": "Na-Import na Drawtools Op: ",
- "IMP_NOPE": "Pag-I-Import Hindi Matagumpay.",
+ "IMP_NOPE": "Pag-I-Import Hindi Matagumpay: {error}",
"IMP_WAS_OP": "I-Import ang Wasabee operasyon",
"IMPORT_OP_SUCCESS": "Na-Import na Operasyon: {opName} Matagumpay.",
"IMPORT_OP_TITLE": "Na-Import na Op: {date}",
diff --git a/src/code/translations/french.json b/src/code/translations/french.json
index 6b492ab0c..c5f04f410 100644
--- a/src/code/translations/french.json
+++ b/src/code/translations/french.json
@@ -131,7 +131,7 @@
"HOW_TO_VIDS": "Tuto: ",
"IMP_COMP": "Importation reussi. ",
"IMP_DT_OP": "Op Drawtools: ",
- "IMP_NOPE": "Echec de l'importation",
+ "IMP_NOPE": "Echec de l'importation: {error}",
"IMP_WAS_OP": "Importer les opérations Wasabee",
"IMPORT_OP_SUCCESS": "Importer l'opération : {opName} Reussi.",
"IMPORT_OP_TITLE": "Importer l'opération : {date}",
diff --git a/src/code/translations/german.json b/src/code/translations/german.json
index 007a512e6..e04d4b99d 100644
--- a/src/code/translations/german.json
+++ b/src/code/translations/german.json
@@ -131,7 +131,7 @@
"HOW_TO_VIDS": "Erklärungsvideos: ",
"IMP_COMP": "Import Komplett. Gefunden ",
"IMP_DT_OP": "Importierte Drawtools Op: ",
- "IMP_NOPE": "Import Fehlgeschlagen.",
+ "IMP_NOPE": "Import Fehlgeschlagen: {error}",
"IMP_WAS_OP": "Importiere Wasabee Operation",
"IMPORT_OP_SUCCESS": "Importierte Operation: {opName}. Erfolgreich.",
"IMPORT_OP_TITLE": "Importierte Op: {date}",
diff --git a/src/code/translations/italian.json b/src/code/translations/italian.json
index 215b7caaa..8f4b86800 100644
--- a/src/code/translations/italian.json
+++ b/src/code/translations/italian.json
@@ -131,7 +131,7 @@
"HOW_TO_VIDS": "Video tutorial: ",
"IMP_COMP": "Importazione Completata. Trovato ",
"IMP_DT_OP": "Importata Operazione Drawtools: ",
- "IMP_NOPE": "Importazione Fallita.",
+ "IMP_NOPE": "Importazione Fallita: {error}",
"IMP_WAS_OP": "Importa Operazione Wasabee",
"IMPORT_OP_SUCCESS": "Importata Operazione: {opName} con successo.",
"IMPORT_OP_TITLE": "Importa Op: {date}",
diff --git a/src/code/translations/portuguese.json b/src/code/translations/portuguese.json
index bc5b97fc7..0ad05434f 100644
--- a/src/code/translations/portuguese.json
+++ b/src/code/translations/portuguese.json
@@ -131,7 +131,7 @@
"HOW_TO_VIDS": "Vídeos de instruções: ",
"IMP_COMP": "Importação concluída. Encontrada ",
"IMP_DT_OP": "Importar OP Drawtools: ",
- "IMP_NOPE": "A Importação Falhou.",
+ "IMP_NOPE": "A Importação Falhou: {error}",
"IMP_WAS_OP": "Importar Operação Wasabee",
"IMPORT_OP_SUCCESS": "OP Importada: ${value} successfuly.",
"IMPORT_OP_TITLE": "Importar Op: ${value}",
diff --git a/src/code/translations/spanish.json b/src/code/translations/spanish.json
index b98364179..07e069366 100644
--- a/src/code/translations/spanish.json
+++ b/src/code/translations/spanish.json
@@ -131,7 +131,7 @@
"HOW_TO_VIDS": "Videos de Cómo Se Hace: ",
"IMP_COMP": "Importación Completa. Se encontró",
"IMP_DT_OP": "Op en Drawtools Importada",
- "IMP_NOPE": "Importación Falló.",
+ "IMP_NOPE": "Importación Falló: {error}",
"IMP_WAS_OP": "Importar Operación Wasabee",
"IMPORT_OP_SUCCESS": "Operación {opName} Importada Exitosamente.",
"IMPORT_OP_TITLE": "Importar Op {date}",
From 186bce1219f2a0875890c61a96afed791f30b2db Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Fri, 10 Sep 2021 20:35:44 +0200
Subject: [PATCH 047/275] MM: factor UI part
---
src/code/dialogs/madrid.js | 189 +++++++++--------------------
src/code/dialogs/multimaxDialog.js | 161 ++++++++++++------------
2 files changed, 136 insertions(+), 214 deletions(-)
diff --git a/src/code/dialogs/madrid.js b/src/code/dialogs/madrid.js
index b7f286366..a8bdb7094 100644
--- a/src/code/dialogs/madrid.js
+++ b/src/code/dialogs/madrid.js
@@ -9,8 +9,6 @@ import {
import wX from "../wX";
import MultimaxDialog from "./multimaxDialog";
-import PortalUI from "../ui/portal";
-
// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
// to not require passing values around when we can get them from this.XXX
const MadridDialog = MultimaxDialog.extend({
@@ -20,143 +18,67 @@ const MadridDialog = MultimaxDialog.extend({
needWritePermission: true,
- // addHooks inherited from MultimaxDialog
- _displayDialog: function () {
- const container = L.DomUtil.create("div", "container");
- const description = L.DomUtil.create("div", "desc", container);
- description.textContent = wX("SELECT_INSTRUCTIONS");
-
- const anchorOneLabel = L.DomUtil.create("label", null, container);
- anchorOneLabel.textContent = wX("ANCHOR1");
- const anchorOneButton = L.DomUtil.create("button", null, container);
- anchorOneButton.textContent = wX("SET");
- this._anchorOneDisplay = L.DomUtil.create("span", null, container);
- if (this._anchorOne) {
- this._anchorOneDisplay.appendChild(
- PortalUI.displayFormat(this._anchorOne, this._smallScreen)
- );
- } else {
- this._anchorOneDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorOneButton, "click", () => {
- this._anchorOne = PortalUI.getSelected();
- if (this._anchorOne) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
- JSON.stringify(this._anchorOne);
- this._anchorOneDisplay.textContent = "";
- this._anchorOneDisplay.appendChild(
- PortalUI.displayFormat(this._anchorOne, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
-
- const setOneLabel = L.DomUtil.create("div", "set_label", container);
- setOneLabel.textContent = wX("MADRID_SET_1");
- const setOneButton = L.DomUtil.create("button", null, container);
- setOneButton.textContent = wX("SET");
- this._setOneDisplay = L.DomUtil.create("span", null, container);
- if (this._portalSetOne) {
- this._setOneDisplay.textContent = wX("PORTAL_COUNT", {
- count: this._portalSetOne.length,
+ _addSetZone: function (text, thisKey, container) {
+ const label = L.DomUtil.create("div", "set_label", container);
+ label.textContent = text;
+ const button = L.DomUtil.create("button", null, container);
+ button.textContent = wX("SET");
+ const display = L.DomUtil.create("span", null, container);
+ if (this[thisKey]) {
+ display.textContent = wX("PORTAL_COUNT", {
+ count: this[thisKey].length,
});
} else {
- this._setOneDisplay.textContent = wX("NOT_SET");
+ display.textContent = wX("NOT_SET");
}
- L.DomEvent.on(setOneButton, "click", () => {
- this._portalSetOne = getAllPortalsOnScreen(getSelectedOperation());
+ L.DomEvent.on(button, "click", () => {
+ this[thisKey] = getAllPortalsOnScreen(getSelectedOperation());
// XXX this is not enough, need to cache them in case IITC purges them
- this._setOneDisplay.textContent = wX("PORTAL_COUNT", {
- count: this._portalSetOne.length,
+ display.textContent = wX("PORTAL_COUNT", {
+ count: this[thisKey].length,
});
});
+ },
- const anchorTwoLabel = L.DomUtil.create("label", null, container);
- anchorTwoLabel.textContent = wX("ANCHOR2");
- const anchorTwoButton = L.DomUtil.create("button", null, container);
- anchorTwoButton.textContent = wX("SET");
- this._anchorTwoDisplay = L.DomUtil.create("span", null, container);
- if (this._anchorTwo) {
- this._anchorTwoDisplay.appendChild(
- PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
- );
- } else {
- this._anchorTwoDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorTwoButton, "click", () => {
- this._anchorTwo = PortalUI.getSelected();
- if (this._anchorTwo) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY] =
- JSON.stringify(this._anchorTwo);
- this._anchorTwoDisplay.textContent = "";
- this._anchorTwoDisplay.appendChild(
- PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
+ _buildContent: function () {
+ const container = L.DomUtil.create("div", "container");
+ const description = L.DomUtil.create("div", "desc", container);
+ description.textContent = wX("SELECT_INSTRUCTIONS");
- const setTwoLabel = L.DomUtil.create("div", "set_label", container);
- setTwoLabel.textContent = wX("MADRID_SET_2");
- const setTwoButton = L.DomUtil.create("button", null, container);
- setTwoButton.textContent = wX("SET");
- this._setTwoDisplay = L.DomUtil.create("span", null, container);
- if (this._portalSetTwo) {
- this._setTwoDisplay.textContent = wX("PORTAL_COUNT", {
- count: this._portalSetTwo.length,
- });
- } else {
- this._setTwoDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(setTwoButton, "click", () => {
- this._portalSetTwo = getAllPortalsOnScreen(getSelectedOperation());
- // XXX cache
- this._setTwoDisplay.textContent = wX("PORTAL_COUNT", {
- count: this._portalSetTwo.length,
- });
- });
+ this._addSetPortal(
+ wX("ANCHOR1"),
+ "_anchorOne",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
+ );
+ this._addSetZone(wX("MADRID_SET_1"), "_portalSetOne", container);
+
+ this._addSetPortal(
+ wX("ANCHOR2"),
+ "_anchorTwo",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY
+ );
+ this._addSetZone(wX("MADRID_SET_2"), "_portalSetTwo", container);
const anchorThreeLabel = L.DomUtil.create("label", null, container);
anchorThreeLabel.textContent = wX("ANCHOR3");
const anchorThreeDisplay = L.DomUtil.create("span", null, container);
anchorThreeDisplay.textContent = "Auto-determined";
+ this._addSetZone(wX("MADRID_SET_3"), "_portalSetThree", container);
- const setThreeLabel = L.DomUtil.create("div", "set_label", container);
- setThreeLabel.textContent = wX("MADRID_SET_3");
- const setThreeButton = L.DomUtil.create("button", null, container);
- setThreeButton.textContent = wX("SET");
- this._setThreeDisplay = L.DomUtil.create("span", null, container);
- if (this._portalSetThree) {
- this._setThreeDisplay.textContent = wX("PORTAL_COUNT", {
- count: this._portalSetThree.length,
- });
- } else {
- this._setThreeDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(setThreeButton, "click", () => {
- this._portalSetThree = getAllPortalsOnScreen(getSelectedOperation());
- // XXX cache
- this._setThreeDisplay.textContent = wX("PORTAL_COUNT", {
- count: this._portalSetThree.length,
- });
- });
-
- //Add backlinks after all the rest is set up
- const fllabel = L.DomUtil.create("label", null, container);
- fllabel.textContent = wX("ADD_BL");
- fllabel.htmlFor = "wasabee-madrid-backlink";
- this._flcheck = L.DomUtil.create("input", null, container);
- this._flcheck.type = "checkbox";
- this._flcheck.id = "wasabee-madrid-backlink";
-
- const balancedLabel = L.DomUtil.create("label", null, container);
- balancedLabel.textContent = "Balanced";
- balancedLabel.htmlFor = "wasabee-madrid-balanced";
- this._balancedcheck = L.DomUtil.create("input", null, container);
- this._balancedcheck.type = "checkbox";
- this._balancedcheck.id = "wasabee-madrid-balanced";
+ this._addCheckbox(
+ wX("ADD_BL"),
+ "wasabee-madrid-backlink",
+ "_flcheck",
+ container
+ );
+ this._addCheckbox(
+ "Balanced", // wX
+ "wasabee-madrid-balanced",
+ "_balancedcheck",
+ container
+ );
const newLine = L.DomUtil.create("label", "newline", container);
const dividerBeforeDraw = L.DomUtil.create("span", null, container);
@@ -178,6 +100,13 @@ const MadridDialog = MultimaxDialog.extend({
// this.closeDialog();
});
+ return container;
+ },
+
+ // addHooks inherited from MultimaxDialog
+ _displayDialog: function () {
+ const container = this._buildContent();
+
const buttons = {};
buttons[wX("CLOSE")] = () => {
this.closeDialog();
@@ -207,16 +136,6 @@ const MadridDialog = MultimaxDialog.extend({
this._urp = testPortal();
},
- getSpine: function (pOne, pTwo, portals) {
- const portalsMap = new Map(portals.map((p) => [p.id, p]));
- const poset = this.buildPOSet(pOne, pTwo, portals);
- const sequence = this.longestSequence(poset, null, (a, b) =>
- window.map.distance(portalsMap.get(a).latLng, portalsMap.get(b).latLng)
- );
-
- return sequence.map((id) => portalsMap.get(id));
- },
-
doBalancedMadrid: function () {
// Calculate the multimax
if (
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index e66ee7c38..9e3504945 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -25,80 +25,80 @@ const MultimaxDialog = WDialog.extend({
this._displayDialog();
},
- _displayDialog: function () {
- const container = L.DomUtil.create("div", "container");
- const description = L.DomUtil.create("div", "desc", container);
- description.textContent = wX("SELECT_INSTRUCTIONS");
-
- const description2 = L.DomUtil.create("div", "desc", container);
- description2.textContent = wX("SEL_SB_ANCHOR2");
-
- const anchorOneLabel = L.DomUtil.create("label", null, container);
- anchorOneLabel.textContent = wX("ANCHOR1");
- const anchorOneButton = L.DomUtil.create("button", null, container);
- anchorOneButton.textContent = wX("SET");
- this._anchorOneDisplay = L.DomUtil.create("span", null, container);
- if (this._anchorOne) {
- this._anchorOneDisplay.appendChild(
- PortalUI.displayFormat(this._anchorOne, this._smallScreen)
+ _addSetPortal: function (text, thisKey, container, storageKey) {
+ const label = L.DomUtil.create("label", null, container);
+ label.textContent = text;
+ const button = L.DomUtil.create("button", null, container);
+ button.textContent = wX("SET");
+ const display = L.DomUtil.create("span", null, container);
+ if (this[thisKey]) {
+ display.appendChild(
+ PortalUI.displayFormat(this[thisKey], this._smallScreen)
);
} else {
- this._anchorOneDisplay.textContent = wX("NOT_SET");
+ display.textContent = wX("NOT_SET");
}
- L.DomEvent.on(anchorOneButton, "click", () => {
- this._anchorOne = PortalUI.getSelected();
- if (this._anchorOne) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
- JSON.stringify(this._anchorOne);
- this._anchorOneDisplay.textContent = "";
- this._anchorOneDisplay.appendChild(
- PortalUI.displayFormat(this._anchorOne, this._smallScreen)
+ L.DomEvent.on(button, "click", () => {
+ this[thisKey] = PortalUI.getSelected();
+ if (this[thisKey]) {
+ if (storageKey)
+ localStorage[storageKey] = JSON.stringify(this[thisKey]);
+ display.textContent = "";
+ display.appendChild(
+ PortalUI.displayFormat(this[thisKey], this._smallScreen)
);
} else {
+ display.textContent = wX("NOT_SET");
alert(wX("PLEASE_SELECT_PORTAL"));
}
});
+ },
- const anchorTwoLabel = L.DomUtil.create("label", null, container);
- anchorTwoLabel.textContent = wX("ANCHOR2");
- const anchorTwoButton = L.DomUtil.create("button", null, container);
- anchorTwoButton.textContent = wX("SET");
- this._anchorTwoDisplay = L.DomUtil.create("span", null, container);
- if (this._anchorTwo) {
- this._anchorTwoDisplay.appendChild(
- PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
- );
- } else {
- this._anchorTwoDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorTwoButton, "click", () => {
- this._anchorTwo = PortalUI.getSelected();
- if (this._anchorTwo) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY] =
- JSON.stringify(this._anchorTwo);
- this._anchorTwoDisplay.textContent = "";
- this._anchorTwoDisplay.appendChild(
- PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
+ _addCheckbox: function (text, id, thisKey, container, defaultValue) {
+ const label = L.DomUtil.create("label", null, container);
+ label.textContent = text;
+ label.htmlFor = id;
+ this[thisKey] = L.DomUtil.create("input", null, container);
+ this[thisKey].type = "checkbox";
+ this[thisKey].id = id;
+ this[thisKey].checked = defaultValue;
+ },
+
+ _buildContent: function () {
+ const container = L.DomUtil.create("div", "container");
+ const description = L.DomUtil.create("div", "desc", container);
+ description.textContent = wX("SELECT_INSTRUCTIONS");
+
+ const description2 = L.DomUtil.create("div", "desc", container);
+ description2.textContent = wX("SEL_SB_ANCHOR2");
- const fllabel = L.DomUtil.create("label", null, container);
- fllabel.textContent = wX("ADD_BL");
- fllabel.htmlFor = "wasabee-multimax-backlink";
- this._flcheck = L.DomUtil.create("input", null, container);
- this._flcheck.type = "checkbox";
- this._flcheck.id = "wasabee-multimax-backlink";
-
- const orderFromEndLabel = L.DomUtil.create("label", null, container);
- orderFromEndLabel.textContent = wX("MM_INSERT_ORDER");
- orderFromEndLabel.htmlFor = "wasabee-multimax-insert-order";
- this._orderFromEnd = L.DomUtil.create("input", null, container);
- this._orderFromEnd.type = "checkbox";
- this._orderFromEnd.id = "wasabee-multimax-insert-order";
- this._orderFromEnd.checked = true;
+ this._addSetPortal(
+ wX("ANCHOR1"),
+ "_anchorOne",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
+ );
+ this._addSetPortal(
+ wX("ANCHOR2"),
+ "_anchorTwo",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY
+ );
+
+ this._addCheckbox(
+ wX("ADD_BL"),
+ "wasabee-multimax-backlink",
+ "_flcheck",
+ container
+ );
+
+ this._addCheckbox(
+ wX("MM_INSERT_ORDER"),
+ "wasabee-multimax-insert-order",
+ "_orderFromEnd",
+ container,
+ true
+ );
// Go button
const button = L.DomUtil.create("button", "drawb", container);
@@ -109,6 +109,12 @@ const MultimaxDialog = WDialog.extend({
// this.closeDialog();
});
+ return container;
+ },
+
+ _displayDialog: function () {
+ const container = this._buildContent();
+
const buttons = {};
buttons[wX("CLOSE")] = () => {
this.closeDialog();
@@ -129,8 +135,6 @@ const MultimaxDialog = WDialog.extend({
initialize: function (options) {
WDialog.prototype.initialize.call(this, options);
- this.title = wX("MULTI_M");
- this.label = wX("MULTI_M");
let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
if (p) this._anchorOne = new WasabeePortal(p);
p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY];
@@ -138,6 +142,16 @@ const MultimaxDialog = WDialog.extend({
this._urp = L.latLng(testPortal());
},
+ getSpine: function (pOne, pTwo, portals) {
+ const portalsMap = new Map(portals.map((p) => [p.id, p]));
+ const poset = this.buildPOSet(pOne, pTwo, portals);
+ const sequence = this.longestSequence(poset, null, (a, b) =>
+ window.map.distance(portalsMap.get(a).latLng, portalsMap.get(b).latLng)
+ );
+
+ return sequence.map((id) => portalsMap.get(id));
+ },
+
/*
Calculate, given two anchors and a set of portals, the deepest sequence of nested fields.
*/
@@ -149,13 +163,7 @@ const MultimaxDialog = WDialog.extend({
base = true,
commentPrefix = "multimax "
) {
- const portalsMap = new Map(portals.map((p) => [p.id, p]));
-
- const poset = this.buildPOSet(pOne, pTwo, portals);
-
- const sequence = this.longestSequence(poset, null, (a, b) =>
- window.map.distance(portalsMap.get(a).latLng, portalsMap.get(b).latLng)
- );
+ const sequence = this.getSpine(pOne, pTwo, portals);
// shift current op tasks order
if (order < this._operation.nextOrder - 1) {
@@ -185,12 +193,7 @@ const MultimaxDialog = WDialog.extend({
let prev = null;
- for (const node of sequence) {
- const p = portalsMap.get(node);
- if (!p) {
- console.log("skipping: " + node);
- continue;
- }
+ for (const p of sequence) {
this._operation.addLink(p, pOne, {
description: commentPrefix + "link",
order: ++order,
From 09e9d1cfb90d412e0759f96c3e13d66590f13e0e Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sun, 12 Sep 2021 12:20:45 +0200
Subject: [PATCH 048/275] add flipflop
---
src/code/css/autodraws.css | 7 +
src/code/dialogs/autodraws.js | 9 +
src/code/dialogs/fanfield.js | 106 +++----
src/code/dialogs/flipflop.js | 380 ++++++++++++++++++++++++++
src/code/translations/english.json | 5 +
src/code/translations/filipino.json | 5 +
src/code/translations/french.json | 5 +
src/code/translations/german.json | 5 +
src/code/translations/italian.json | 5 +
src/code/translations/portuguese.json | 5 +
src/code/translations/spanish.json | 5 +
11 files changed, 491 insertions(+), 46 deletions(-)
create mode 100644 src/code/dialogs/flipflop.js
diff --git a/src/code/css/autodraws.css b/src/code/css/autodraws.css
index 79843b2d5..2ec5e9949 100644
--- a/src/code/css/autodraws.css
+++ b/src/code/css/autodraws.css
@@ -11,6 +11,7 @@
}
.wasabee-dialog-fanfield .container,
+.wasabee-dialog-flipflop .container,
.wasabee-dialog-homogeneous .container,
.wasabee-dialog-link .container,
.wasabee-dialog-madrid .container,
@@ -22,9 +23,11 @@
grid-gap: 0.2em 0.5em;
align-items: center;
grid-template-columns: minmax(min-content, 10em) min-content auto;
+ max-width: 700px;
}
.wasabee-dialog-fanfield label,
+.wasabee-dialog-flipflop label,
.wasabee-dialog-link label,
.wasabee-dialog-madrid label,
.wasabee-dialog-multimax label,
@@ -35,6 +38,7 @@
}
.wasabee-dialog-fanfield button,
+.wasabee-dialog-flipflop button,
.wasabee-dialog-homogeneous button,
.wasabee-dialog-link button,
.wasabee-dialog-madrid button,
@@ -53,6 +57,8 @@
.wasabee-dialog-link .drawb,
.wasabee-dialog-fanfield .drawb,
+.wasabee-dialog-flipflop .drawb,
+.wasabee-dialog-onion .drawb,
.wasabee-dialog-madrid .drawb,
.wasabee-dialog-multimax .drawb,
.wasabee-dialog-onion .drawb,
@@ -62,6 +68,7 @@
}
.wasabee-dialog-fanfield .desc,
+.wasabee-dialog-flipflop .desc,
.wasabee-dialog-madrid .desc,
.wasabee-dialog-multimax .desc,
.wasabee-dialog-onion .desc,
diff --git a/src/code/dialogs/autodraws.js b/src/code/dialogs/autodraws.js
index 83999ef6e..4acb8e0b2 100644
--- a/src/code/dialogs/autodraws.js
+++ b/src/code/dialogs/autodraws.js
@@ -7,6 +7,7 @@ import SaveLinksDialog from "../dialogs/saveLinks";
import OnionfieldDialog from "../dialogs/onionfield";
import HomogeneousDialog from "../dialogs/homogeneous";
import MadridDialog from "../dialogs/madrid";
+import FlipFlopDialog from "../dialogs/flipflop";
// This file documents the minimum requirements of a dialog in wasabee
const AutodrawsDialog = WDialog.extend({
@@ -76,6 +77,14 @@ const AutodrawsDialog = WDialog.extend({
sl.enable();
},
},
+ {
+ text: wX("FLIP_FLOP_NAME"),
+ callback: () => {
+ this.closeDialog();
+ const ff = new FlipFlopDialog();
+ ff.enable();
+ },
+ },
];
},
diff --git a/src/code/dialogs/fanfield.js b/src/code/dialogs/fanfield.js
index 7dc8b4d44..6a5c2aaf7 100644
--- a/src/code/dialogs/fanfield.js
+++ b/src/code/dialogs/fanfield.js
@@ -8,6 +8,59 @@ import wX from "../wX";
import PortalUI from "../ui/portal";
+export function angle(a, p) {
+ if (a.id == p.id) throw Error("same portal");
+ if (a.latLng.lng == p.latLng.lng) {
+ if (a.latLng.lat > p.latLng.lat) return 0;
+ else return Math.PI;
+ }
+ const link = new GeodesicLine(a.latLng, p.latLng);
+ return link.bearing();
+}
+
+export function sortPortalsByAngle(anchor, portals, start, end) {
+ const startAngle = angle(anchor, start);
+ const endAngle = angle(anchor, end);
+
+ // swap start/end if more than 180°
+ let invert = false;
+ if (
+ (((endAngle - startAngle) % (2 * Math.PI)) + 2 * Math.PI) % (2 * Math.PI) >
+ Math.PI
+ ) {
+ invert = true;
+ }
+
+ const good = new Map();
+ for (const p of portals) {
+ if (p.id == anchor.id) continue;
+ const pAngle = angle(anchor, p);
+
+ good.set(pAngle, p); // what are the odds of two having EXACTLY the same angle?
+ }
+ // add start and end portals just in case
+ good.set(startAngle, start);
+ good.set(endAngle, end);
+
+ const sorted = new Array(...good.entries())
+ .sort((a, b) => a[0] - b[0])
+ .map((v) => v[1]);
+
+ if (invert) {
+ sorted.reverse();
+ }
+ // Build the sequence of portals between start/end
+ const slice = new Array();
+ let s = 0;
+ for (s = 0; sorted[s].id != start.id; s++);
+ for (; sorted[s % sorted.length].id != end.id; s++) {
+ slice.push(sorted[s % sorted.length]);
+ }
+ slice.push(end);
+
+ return slice;
+}
+
const FanfieldDialog = WDialog.extend({
statics: {
TYPE: "FanfieldDialog",
@@ -149,48 +202,14 @@ const FanfieldDialog = WDialog.extend({
return;
}
- const startAngle = this._angle(this._anchor, this._start);
- const endAngle = this._angle(this._anchor, this._end);
-
- // swap start/end if more than 180°
- this._invert = false;
- if (
- (((endAngle - startAngle) % (2 * Math.PI)) + 2 * Math.PI) %
- (2 * Math.PI) >
- Math.PI
- ) {
- this._invert = true;
- }
-
- const good = new Map();
const op = getSelectedOperation();
- for (const p of getAllPortalsOnScreen(op)) {
- if (p.id == this._anchor.id) continue;
- const pAngle = this._angle(this._anchor, p);
-
- good.set(pAngle, p); // what are the odds of two having EXACTLY the same angle?
- }
- // add start and end portals just in case
- good.set(startAngle, this._start);
- good.set(endAngle, this._end);
-
- const sorted = new Array(...good.entries())
- .sort((a, b) => a[0] - b[0])
- .map((v) => v[1]);
-
- if (this._invert) {
- sorted.reverse();
- }
- // Build the sequence of portals between start/end
- const slice = new Array();
- let start = 0;
- for (start = 0; sorted[start].id != this._start.id; start++);
- for (; sorted[start % sorted.length].id != this._end.id; start++) {
- slice.push(sorted[start % sorted.length]);
- }
- slice.push(this._end);
-
- this._draw(slice);
+ const steps = sortPortalsByAngle(
+ this._anchor,
+ getAllPortalsOnScreen(op),
+ this._start,
+ this._end
+ );
+ this._draw(steps);
},
// draw takes the sorted list of poratls and draws the links
@@ -253,11 +272,6 @@ const FanfieldDialog = WDialog.extend({
// too many parameters for wX();
alert(`Fanfield found ${order} links and ${fields} fields for ${ap} AP`);
},
-
- _angle: function (a, p) {
- const link = new GeodesicLine(a.latLng, p.latLng);
- return link.bearing();
- },
});
export default FanfieldDialog;
diff --git a/src/code/dialogs/flipflop.js b/src/code/dialogs/flipflop.js
new file mode 100644
index 000000000..bd1f34f92
--- /dev/null
+++ b/src/code/dialogs/flipflop.js
@@ -0,0 +1,380 @@
+import { WDialog } from "../leafletClasses";
+import wX from "../wX";
+import { getSelectedOperation } from "../selectedOp";
+import { getAllPortalsOnScreen, clearAllLinks } from "../uiCommands";
+
+import WasabeePortal from "../model/portal";
+import WasabeeMarker from "../model/marker";
+import PortalUI from "../ui/portal";
+
+import { angle } from "./fanfield";
+import { greatCircleArcIntersectByLatLngs } from "../crosslinks";
+
+function selectAngleInterval(anchor, portalsSorted, start, end) {
+ const startAngle = angle(anchor, start);
+ const endAngle = angle(anchor, end);
+
+ // swap start/end if more than 180°
+ if (
+ (((endAngle - startAngle) % (2 * Math.PI)) + 2 * Math.PI) % (2 * Math.PI) >
+ Math.PI
+ ) {
+ [start, end] = [end, start];
+ }
+
+ // Build the sequence of portals between start/end
+ const slice = new Array();
+ let s = 0;
+ for (s = 0; portalsSorted[s].id != start.id; s++);
+ for (; portalsSorted[s % portalsSorted.length].id != end.id; s++) {
+ slice.push(portalsSorted[s % portalsSorted.length]);
+ }
+ slice.push(end);
+
+ return slice;
+}
+
+function sortPortalsByAngle(anchor, portals) {
+ const good = new Map();
+ for (const p of portals) {
+ if (p.id == anchor.id) continue;
+ const pAngle = angle(anchor, p);
+ good.set(pAngle, p);
+ }
+
+ const sorted = new Array(...good.entries())
+ .sort((a, b) => a[0] - b[0])
+ .map((v) => v[1]);
+
+ return sorted;
+}
+
+function fastFan(anchor, two, three, portalsSorted, offset, revSortAngle) {
+ const res = [];
+ const inserted = [two, three];
+ if (revSortAngle.get(two.id) > revSortAngle.get(three.id)) inserted.reverse();
+ for (let i = offset; i < portalsSorted.length; i++) {
+ const p = portalsSorted[i];
+ if (!revSortAngle.has(p.id)) continue;
+ let prev = inserted.length - 1;
+ let next = 0;
+ while (
+ prev >= 0 &&
+ revSortAngle.get(inserted[prev].id) > revSortAngle.get(p.id)
+ )
+ prev--;
+ while (
+ next < inserted.length &&
+ revSortAngle.get(inserted[next].id) < revSortAngle.get(p.id)
+ )
+ next++;
+ if (
+ !greatCircleArcIntersectByLatLngs(
+ anchor,
+ p,
+ inserted[prev],
+ inserted[next]
+ )
+ ) {
+ res.push([p, inserted[prev], inserted[next]]);
+ inserted.splice(prev + 1, 0, p);
+ }
+ }
+ return res;
+}
+
+// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
+// to not require passing values around when we can get them from this.XXX
+const FlipFlopDialog = WDialog.extend({
+ statics: {
+ TYPE: "madridDialog",
+ },
+
+ needWritePermission: true,
+
+ initialize: function (options) {
+ WDialog.prototype.initialize.call(this, options);
+ let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
+ if (p) this._anchorOne = new WasabeePortal(p);
+ },
+
+ addHooks: function () {
+ WDialog.prototype.addHooks.call(this);
+ this._displayDialog();
+ },
+
+ _addSetPortal: function (text, thisKey, container, storageKey) {
+ const label = L.DomUtil.create("label", null, container);
+ label.textContent = text;
+ const button = L.DomUtil.create("button", null, container);
+ button.textContent = wX("SET");
+ const display = L.DomUtil.create("span", null, container);
+ if (this[thisKey]) {
+ display.appendChild(
+ PortalUI.displayFormat(this[thisKey], this._smallScreen)
+ );
+ } else {
+ display.textContent = wX("NOT_SET");
+ }
+ L.DomEvent.on(button, "click", () => {
+ this[thisKey] = PortalUI.getSelected();
+ if (this[thisKey]) {
+ if (storageKey)
+ localStorage[storageKey] = JSON.stringify(this[thisKey]);
+ display.textContent = "";
+ display.appendChild(
+ PortalUI.displayFormat(this[thisKey], this._smallScreen)
+ );
+ } else {
+ display.textContent = wX("NOT_SET");
+ alert(wX("PLEASE_SELECT_PORTAL"));
+ }
+ });
+ },
+
+ _buildContent: function () {
+ const container = L.DomUtil.create("div", "container");
+ const description = L.DomUtil.create("div", "desc", container);
+ description.textContent = wX("FLIP_FLOP_DESC");
+
+ const description2 = L.DomUtil.create("div", "desc", container);
+ description2.textContent = wX("FLIP_FLOP_INSTRUCTION");
+
+ this._addSetPortal(
+ wX("ANCHOR1"),
+ "_anchorOne",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
+ );
+
+ L.DomUtil.create("label", null, container).textContent = "#SBUL";
+ this._nbSbul = L.DomUtil.create("input", null, container);
+ this._nbSbul.type = "number";
+ this._nbSbul.value = 2;
+ this._nbSbul.size = 1;
+ this._nbSbul.min = 0;
+ this._nbSbul.max = 4;
+
+ // Go button
+ const button = L.DomUtil.create("button", "drawb", container);
+ button.textContent = wX("FANFIELD");
+ L.DomEvent.on(button, "click", () => {
+ const total = this.doFanGun();
+ alert(`Flip flop: found ${total} links`);
+ });
+
+ return container;
+ },
+
+ _displayDialog: function () {
+ const container = this._buildContent();
+
+ const buttons = {};
+ buttons[wX("CLOSE")] = () => {
+ this.closeDialog();
+ };
+ buttons[wX("FLIP_FLOP_FIND_ANCHORS")] = () => {
+ this.findOtherAnchors();
+ };
+ buttons[wX("CLEAR LINKS")] = () => {
+ clearAllLinks(getSelectedOperation());
+ };
+
+ this.createDialog({
+ title: wX("FLIP_FLOP_TITLE"),
+ html: container,
+ width: "auto",
+ dialogClass: "flipflop",
+ buttons: buttons,
+ id: "flipflop",
+ });
+ },
+
+ findOtherAnchors: function () {
+ if (!this.best) return;
+
+ this._operation = getSelectedOperation();
+ const portals = getAllPortalsOnScreen(this._operation);
+
+ const sequencePortals = this.best.steps.map((s) => s[0]);
+ const linkedPortals = sequencePortals.concat([
+ this.best.two,
+ this.best.three,
+ ]);
+ const portalsMatch = [];
+ for (const a of portals) {
+ let match = true;
+
+ // check distance order
+ for (const [p, p1, p2] of this.best.steps) {
+ if (
+ a.latLng.distanceTo(p.latLng) > a.latLng.distanceTo(p1.latLng) ||
+ a.latLng.distanceTo(p.latLng) > a.latLng.distanceTo(p2.latLng)
+ ) {
+ match = false;
+ break;
+ }
+ }
+ if (!match) continue;
+
+ // check angle order
+ const sortedAngle = sortPortalsByAngle(a, linkedPortals);
+ const interval = selectAngleInterval(
+ a,
+ sortedAngle,
+ this.best.two,
+ this.best.three
+ );
+ const angleSort = interval.map((p) => p.id);
+ let i = 0,
+ j = 0;
+ while (i < angleSort.length && j < this.best.angleSort.length) {
+ if (this.best.angleSort[j] === angleSort[i]) i++;
+ j++;
+ }
+ match = i == angleSort.length;
+
+ if (match) portalsMatch.push(a);
+ }
+ for (const a of portalsMatch) {
+ this._operation.addMarker(WasabeeMarker.constants.MARKER_TYPE_LINK, a, {
+ comment: "flipflop anchor",
+ });
+ }
+ },
+
+ getDistances: function (anchor, portals) {
+ if (this.distCache && this.distCache.has(anchor.id))
+ return this.distCache.get(anchor.id);
+ const dists = new Map(
+ portals.map((p) => [p.id, p.latLng.distanceTo(anchor.latLng)])
+ );
+ if (this.distCache) this.distCache.set(anchor.id, dists);
+ return dists;
+ },
+
+ createFanLinks: function (one, two, three, steps, order = 0) {
+ this._operation.addLink(two, three, {
+ description: "flipflop origin",
+ order: order + 1,
+ });
+ for (const [p, a, b] of steps) {
+ this._operation.addLink(p, a, {
+ description: "flipflop origin",
+ order: order + 1,
+ });
+ this._operation.addLink(p, b, {
+ description: "flipflop origin",
+ order: order + 1,
+ });
+ }
+
+ order++;
+ this._operation.addLink(one, two, {
+ description: "flipflop fire",
+ order: ++order,
+ });
+ this._operation.addLink(one, three, {
+ description: "flipflop fire",
+ order: ++order,
+ });
+ for (const s of steps) {
+ const p = s[0];
+ this._operation.addLink(one, p, {
+ description: "flipflop fire",
+ order: ++order,
+ });
+ }
+ },
+
+ doFanGun: function () {
+ // Calculate the multimax
+ if (!this._anchorOne) {
+ alert(wX("INVALID REQUEST"));
+ return 0;
+ }
+
+ this._operation = getSelectedOperation();
+ const portals = getAllPortalsOnScreen(this._operation).filter(
+ (p) => p.id != this._anchorOne.id
+ );
+
+ const nbSbul =
+ +this._nbSbul.value < 0
+ ? 0
+ : +this._nbSbul.value > 4
+ ? 4
+ : +this._nbSbul.value;
+
+ console.log("starting fastfan");
+ this.distCache = new Map();
+ const distances = this.getDistances(this._anchorOne, portals);
+ portals.sort((a, b) => distances.get(b.id) - distances.get(a.id));
+
+ const sortedAngle = sortPortalsByAngle(this._anchorOne, portals);
+
+ const best = {
+ two: null,
+ three: null,
+ steps: [],
+ };
+ const maxSteps = 8 * (nbSbul + 1) - 2;
+
+ for (let i = 0; i < portals.length; i++) {
+ const pTwo = portals[i];
+ for (let j = i + 1; j < portals.length; j++) {
+ const pThree = portals[j];
+ const interval = selectAngleInterval(
+ this._anchorOne,
+ sortedAngle,
+ pTwo,
+ pThree
+ );
+ const revAngleSort = new Map(interval.map((p, i) => [p.id, i]));
+ const res = fastFan(
+ this._anchorOne,
+ pTwo,
+ pThree,
+ portals,
+ j + 1,
+ revAngleSort
+ );
+ if (best.steps.length < res.length) {
+ best.steps = res;
+ best.two = pTwo;
+ best.three = pThree;
+ best.angleSort = interval.map((p) => p.id);
+ if (best.steps.length >= maxSteps) break;
+ }
+ }
+ if (best.steps.length >= maxSteps) break;
+ }
+
+ if (best.steps.length > maxSteps)
+ best.steps = best.steps.slice(0, maxSteps);
+
+ // Calculate the multimax
+ if (!best.steps.length) {
+ alert(wX("INVALID REQUEST"));
+ return 0;
+ }
+
+ this.best = best;
+
+ this._operation.startBatchMode();
+ this.createFanLinks(
+ this._anchorOne,
+ best.two,
+ best.three,
+ best.steps,
+ this._operation.nextOrder - 1
+ );
+ console.log("fastfan done");
+
+ this._operation.endBatchMode(); // save and run crosslinks
+
+ return best.steps.length + 2;
+ },
+});
+
+export default FlipFlopDialog;
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index ba723d58c..8194f39ab 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -112,6 +112,11 @@
"FANFIELD": "Draw",
"FANFIELD2": "Draw Fan Field",
"FarmPortalMarker": "Farm",
+ "FLIP_FLOP_NAME": "Flip flop",
+ "FLIP_FLOP_TITLE": "Flip flop",
+ "FLIP_FLOP_DESC": "From a given anchor, a set of visible portal and a number of SBUL, find a fanfield to throw links from the anchor by decreasing distance to avoid searching keys.",
+ "FLIP_FLOP_INSTRUCTION": "Select a portal, zoom to see enough portals and press Draw. Once a fanfield is found, you can search for other anchors for consecutive rethrow",
+ "FLIP_FLOP_FIND_ANCHORS": "Find other anchors",
"FROM_1-2": "from base 1-2",
"FROM_1-3": "from base 1-3",
"FROM_2-3": "from base 2-3",
diff --git a/src/code/translations/filipino.json b/src/code/translations/filipino.json
index e225e35b9..a4a0734fa 100644
--- a/src/code/translations/filipino.json
+++ b/src/code/translations/filipino.json
@@ -112,6 +112,11 @@
"FANFIELD": "Guhit",
"FANFIELD2": "Iguhit ang Fanfield",
"FarmPortalMarker": "Farm",
+ "FLIP_FLOP_NAME": "Flip flop",
+ "FLIP_FLOP_TITLE": "Flip flop",
+ "FLIP_FLOP_DESC": "From a given anchor, a set of visible portal and a number of SBUL, find a fanfield to throw links from the anchor by decreasing distance to avoid searching keys.",
+ "FLIP_FLOP_INSTRUCTION": "Select a portal, zoom to see enough portals and press Draw. Once a fanfield is found, you can search for other anchors for consecutive rethrow",
+ "FLIP_FLOP_FIND_ANCHORS": "Find other anchors",
"FROM_1-2": "from base 1-2",
"FROM_1-3": "from base 1-3",
"FROM_2-3": "from base 2-3",
diff --git a/src/code/translations/french.json b/src/code/translations/french.json
index c5f04f410..8f96253ea 100644
--- a/src/code/translations/french.json
+++ b/src/code/translations/french.json
@@ -112,6 +112,11 @@
"FANFIELD": "Draw",
"FANFIELD2": "Draw Fan Field",
"FarmPortalMarker": "Farm",
+ "FLIP_FLOP_NAME": "Flip flop",
+ "FLIP_FLOP_TITLE": "Flip flop",
+ "FLIP_FLOP_DESC": "From a given anchor, a set of visible portal and a number of SBUL, find a fanfield to throw links from the anchor by decreasing distance to avoid searching keys.",
+ "FLIP_FLOP_INSTRUCTION": "Select a portal, zoom to see enough portals and press Draw. Once a fanfield is found, you can search for other anchors for consecutive rethrow",
+ "FLIP_FLOP_FIND_ANCHORS": "Find other anchors",
"FROM_1-2": "depuis la base 1-2",
"FROM_1-3": "depuis la base 1-3",
"FROM_2-3": "depuis la base 2-3",
diff --git a/src/code/translations/german.json b/src/code/translations/german.json
index e04d4b99d..daf4d0876 100644
--- a/src/code/translations/german.json
+++ b/src/code/translations/german.json
@@ -112,6 +112,11 @@
"FANFIELD": "Fächerfeld!",
"FANFIELD2": "Fächerfeld",
"FarmPortalMarker": "Farm",
+ "FLIP_FLOP_NAME": "Flip flop",
+ "FLIP_FLOP_TITLE": "Flip flop",
+ "FLIP_FLOP_DESC": "From a given anchor, a set of visible portal and a number of SBUL, find a fanfield to throw links from the anchor by decreasing distance to avoid searching keys.",
+ "FLIP_FLOP_INSTRUCTION": "Select a portal, zoom to see enough portals and press Draw. Once a fanfield is found, you can search for other anchors for consecutive rethrow",
+ "FLIP_FLOP_FIND_ANCHORS": "Find other anchors",
"FROM_1-2": "from base 1-2",
"FROM_1-3": "from base 1-3",
"FROM_2-3": "from base 2-3",
diff --git a/src/code/translations/italian.json b/src/code/translations/italian.json
index 8f4b86800..90c46a88d 100644
--- a/src/code/translations/italian.json
+++ b/src/code/translations/italian.json
@@ -112,6 +112,11 @@
"FANFIELD": "Fanfield!",
"FANFIELD2": "Fanfield",
"FarmPortalMarker": "Farmare",
+ "FLIP_FLOP_NAME": "Flip flop",
+ "FLIP_FLOP_TITLE": "Flip flop",
+ "FLIP_FLOP_DESC": "From a given anchor, a set of visible portal and a number of SBUL, find a fanfield to throw links from the anchor by decreasing distance to avoid searching keys.",
+ "FLIP_FLOP_INSTRUCTION": "Select a portal, zoom to see enough portals and press Draw. Once a fanfield is found, you can search for other anchors for consecutive rethrow",
+ "FLIP_FLOP_FIND_ANCHORS": "Find other anchors",
"FROM_1-2": "dalla base 1-2",
"FROM_1-3": "dalla base 1-3",
"FROM_2-3": "dalla base 2-3",
diff --git a/src/code/translations/portuguese.json b/src/code/translations/portuguese.json
index 0ad05434f..a8e330757 100644
--- a/src/code/translations/portuguese.json
+++ b/src/code/translations/portuguese.json
@@ -112,6 +112,11 @@
"FANFIELD": "Desenhar",
"FANFIELD2": "Desenhar Fan Field",
"FarmPortalMarker": "Farmar",
+ "FLIP_FLOP_NAME": "Flip flop",
+ "FLIP_FLOP_TITLE": "Flip flop",
+ "FLIP_FLOP_DESC": "From a given anchor, a set of visible portal and a number of SBUL, find a fanfield to throw links from the anchor by decreasing distance to avoid searching keys.",
+ "FLIP_FLOP_INSTRUCTION": "Select a portal, zoom to see enough portals and press Draw. Once a fanfield is found, you can search for other anchors for consecutive rethrow",
+ "FLIP_FLOP_FIND_ANCHORS": "Find other anchors",
"FROM_1-2": "A Partir da base 1-2",
"FROM_1-3": "A Partir da base 1-3",
"FROM_2-3": "A Partir da base 2-3",
diff --git a/src/code/translations/spanish.json b/src/code/translations/spanish.json
index 07e069366..2cca0cb09 100644
--- a/src/code/translations/spanish.json
+++ b/src/code/translations/spanish.json
@@ -112,6 +112,11 @@
"FANFIELD": "¡Dibujar!",
"FANFIELD2": "Fanfield",
"FarmPortalMarker": "Farmear",
+ "FLIP_FLOP_NAME": "Flip flop",
+ "FLIP_FLOP_TITLE": "Flip flop",
+ "FLIP_FLOP_DESC": "From a given anchor, a set of visible portal and a number of SBUL, find a fanfield to throw links from the anchor by decreasing distance to avoid searching keys.",
+ "FLIP_FLOP_INSTRUCTION": "Select a portal, zoom to see enough portals and press Draw. Once a fanfield is found, you can search for other anchors for consecutive rethrow",
+ "FLIP_FLOP_FIND_ANCHORS": "Find other anchors",
"FROM_1-2": "from base 1-2",
"FROM_1-3": "from base 1-3",
"FROM_2-3": "from base 2-3",
From 1c4ddbe6c4f8013b06242bddb93254d2134c44c6 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Fri, 8 Oct 2021 15:23:04 +0200
Subject: [PATCH 049/275] add pr artifact
---
.github/workflows/pr.yaml | 26 ++++++++++++++++++++++++++
package.json | 1 +
plugin.config.json | 3 +++
webpack.config.js | 23 +++++++++++++++--------
4 files changed, 45 insertions(+), 8 deletions(-)
create mode 100644 .github/workflows/pr.yaml
diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
new file mode 100644
index 000000000..7e23861e7
--- /dev/null
+++ b/.github/workflows/pr.yaml
@@ -0,0 +1,26 @@
+name: Pull request artifacts
+on:
+ pull_request:
+ branches: [dev]
+jobs:
+ build-and-deploy-dev:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout 🛎️
+ uses: actions/checkout@v2.3.1
+
+ - name: Build
+ env:
+ PR_NUMBER: ${{ github.event.number }}
+ run: |
+ npm install
+ npm run build-pr
+
+ - name: Pull request artifacts
+ uses: gavv/pull-request-artifacts@v1.0.0
+ with:
+ commit: ${{ github.event.pull_request.head.sha }}
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ artifacts-branch: artifacts
+ artifacts: |
+ releases/dev/wasabee.user.js
diff --git a/package.json b/package.json
index f60d37b3d..02f67b3b8 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"build": "webpack --progress --mode production",
"build-dev": "webpack --progress --mode development",
"build-scot": "webpack --progress --mode development --env scot",
+ "build-pr": "webpack --progress --mode development --env pr=${PR_NUMBER}",
"locales": "gulp locales"
},
"repository": {
diff --git a/plugin.config.json b/plugin.config.json
index f4e05872d..22b852d52 100644
--- a/plugin.config.json
+++ b/plugin.config.json
@@ -10,6 +10,9 @@
"updateURL": "https://cdn2.wasabee.rocks/iitcplugin/latest/dev/wasabee.meta.js",
"version": "0.20.BUILDDATE-dev"
},
+ "pr": {
+ "version": "0.20-pr"
+ },
"scot": {
"downloadURL": "https://am.wasabee.rocks/static/dev/wasabee.user.js",
"updateURL": "https://am.wasabee.rocks/static/dev/wasabee.meta.js",
diff --git a/webpack.config.js b/webpack.config.js
index 1635fe532..fa7a7cb9f 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -168,14 +168,21 @@ const config = {
module.exports = (env, argv) => {
const pluginConfig = require("./plugin.config.json");
const meta = pluginConfig.headers.common;
- if (argv.mode === "development" && env.scot) {
- config.output.path = path.join(outputPath, "scot");
- config.devtool = "eval-source-map";
- Object.assign(meta, pluginConfig.headers.scot);
- } else if (argv.mode === "development") {
- config.output.path = path.join(outputPath, "dev");
- config.devtool = "eval-source-map";
- Object.assign(meta, pluginConfig.headers.dev);
+ if (argv.mode === "development") {
+ if(env.scot) {
+ config.output.path = path.join(outputPath, "scot");
+ config.devtool = "eval-source-map";
+ Object.assign(meta, pluginConfig.headers.scot);
+ } else if(env.pr) {
+ config.output.path = path.join(outputPath, "dev");
+ config.devtool = "inline-source-map";
+ Object.assign(meta, pluginConfig.headers.pr);
+ meta.version += env.pr;
+ } else if (argv.mode === "development") {
+ config.output.path = path.join(outputPath, "dev");
+ config.devtool = "eval-source-map";
+ Object.assign(meta, pluginConfig.headers.dev);
+ }
} else {
config.output.path = path.join(outputPath, "prod");
Object.assign(meta, pluginConfig.headers.prod);
From 559f3a5786746b7e8d49e6302b8aa90e8f80c1a4 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Tue, 12 Oct 2021 20:35:50 +0200
Subject: [PATCH 050/275] fix agent/link ui
---
src/code/ui/agent.js | 5 ++++-
src/code/ui/link.js | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/code/ui/agent.js b/src/code/ui/agent.js
index ab00db528..8287f7629 100644
--- a/src/code/ui/agent.js
+++ b/src/code/ui/agent.js
@@ -132,11 +132,14 @@ const WLAgent = L.Marker.extend({
zoom: zoom,
});
- window.registerMarkerForOMS(this);
this.bindPopup((layer) => layer._getPopup(), {
className: "wasabee-popup",
closeButton: false,
});
+
+ this.off("click", this._openPopup);
+ window.registerMarkerForOMS(this);
+ this.on("spiderfiedclick", this._openPopup);
},
update: function () {
diff --git a/src/code/ui/link.js b/src/code/ui/link.js
index 5587d42dc..0411d6c81 100644
--- a/src/code/ui/link.js
+++ b/src/code/ui/link.js
@@ -114,8 +114,8 @@ const WLLink = L.GeodesicPolyline.extend({
L.DomUtil.create("div", "enl", div).textContent = link.description;
L.DomUtil.create("div", "enl", div).textContent = "# " + link.throwOrderPos;
const buttonset = L.DomUtil.create("div", "buttonset", div);
- const del = L.DomUtil.create("button", null, buttonset);
if (operation.canWrite()) {
+ const del = L.DomUtil.create("button", null, buttonset);
del.textContent = wX("DELETE_LINK");
L.DomEvent.on(del, "click", (ev) => {
L.DomEvent.stop(ev);
From c75a15db28cbf38a7015da2a87ac420e11a7c51b Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 23 Oct 2021 22:18:09 +0200
Subject: [PATCH 051/275] fix: flipflop full rethrow
---
src/code/dialogs/flipflop.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/code/dialogs/flipflop.js b/src/code/dialogs/flipflop.js
index bd1f34f92..13b64b76c 100644
--- a/src/code/dialogs/flipflop.js
+++ b/src/code/dialogs/flipflop.js
@@ -225,6 +225,8 @@ const FlipFlopDialog = WDialog.extend({
this.best.two,
this.best.three
);
+ if (interval.length !== linkedPortals.length) continue;
+
const angleSort = interval.map((p) => p.id);
let i = 0,
j = 0;
From 40613e404ecf713a35945a70bb3d87e764fb578c Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 25 Oct 2021 10:09:56 +0200
Subject: [PATCH 052/275] fix build_pr
---
.github/workflows/pr.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
index 7e23861e7..ff20ad907 100644
--- a/.github/workflows/pr.yaml
+++ b/.github/workflows/pr.yaml
@@ -1,6 +1,6 @@
name: Pull request artifacts
on:
- pull_request:
+ pull_request_target:
branches: [dev]
jobs:
build-and-deploy-dev:
From b46171db22270ec0f2455fc9f730a792bc9a21d8 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 27 Oct 2021 21:03:30 +0200
Subject: [PATCH 053/275] fix: wild agent.timeSinceFormat
---
src/code/dialogs/onlineAgentList.js | 2 +-
src/code/ui/agent.js | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/code/dialogs/onlineAgentList.js b/src/code/dialogs/onlineAgentList.js
index a13469387..b681023df 100644
--- a/src/code/dialogs/onlineAgentList.js
+++ b/src/code/dialogs/onlineAgentList.js
@@ -55,7 +55,7 @@ const OnlineAgentList = WDialog.extend({
value: (agent) => agent.date,
sort: (a, b) => a.localeCompare(b),
format: (cell, value, agent) => {
- if (agent) cell.textContent = agent.timeSinceformat();
+ if (agent) cell.textContent = AgentUI.timeSinceformat(agent);
},
},
{
diff --git a/src/code/ui/agent.js b/src/code/ui/agent.js
index 8287f7629..6927d821a 100644
--- a/src/code/ui/agent.js
+++ b/src/code/ui/agent.js
@@ -245,4 +245,5 @@ const WLAgent = L.Marker.extend({
export default {
formatDisplay,
WLAgent,
+ timeSinceformat,
};
From 34b5855ea9cd938b918bf0f9f2103b972f6eb339 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 3 Nov 2021 18:44:51 +0100
Subject: [PATCH 054/275] fix: pr artifact
---
.github/workflows/pr-build.yaml | 23 +++++++++++++++++++++++
.github/workflows/pr-comment.yaml | 25 +++++++++++++++++++++++++
.github/workflows/pr.yaml | 26 --------------------------
3 files changed, 48 insertions(+), 26 deletions(-)
create mode 100644 .github/workflows/pr-build.yaml
create mode 100644 .github/workflows/pr-comment.yaml
delete mode 100644 .github/workflows/pr.yaml
diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml
new file mode 100644
index 000000000..a45f8040c
--- /dev/null
+++ b/.github/workflows/pr-build.yaml
@@ -0,0 +1,23 @@
+name: Pull request build
+on:
+ pull_request:
+ branches: [dev]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout 🛎️
+ uses: actions/checkout@v2.3.1
+
+ - name: Build
+ env:
+ PR_NUMBER: ${{ github.event.number }}
+ run: |
+ npm install
+ npm run build-pr
+
+ - uses: actions/upload-artifact@v2
+ with:
+ name: pr
+ path: releases/dev/wasabee.user.js
diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml
new file mode 100644
index 000000000..5a1b8b60d
--- /dev/null
+++ b/.github/workflows/pr-comment.yaml
@@ -0,0 +1,25 @@
+name: Pull request Comment
+on:
+ workflow_run:
+ workflows: ["Pull request build"]
+ types:
+ - completed
+jobs:
+ comment:
+ runs-on: ubuntu-latest
+ if: >
+ ${{ github.event.workflow_run.event == 'pull_request' &&
+ github.event.workflow_run.conclusion == 'success' }}
+ steps:
+ - uses: actions/download-artifact@v2
+ with:
+ name: pr
+
+ - name: Pull request artifacts
+ uses: gavv/pull-request-artifacts@v1.0.0
+ with:
+ commit: ${{ github.event.pull_request.head.sha }}
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ artifacts-branch: artifacts
+ artifacts: |
+ wasabee.user.js
diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
deleted file mode 100644
index ff20ad907..000000000
--- a/.github/workflows/pr.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Pull request artifacts
-on:
- pull_request_target:
- branches: [dev]
-jobs:
- build-and-deploy-dev:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout 🛎️
- uses: actions/checkout@v2.3.1
-
- - name: Build
- env:
- PR_NUMBER: ${{ github.event.number }}
- run: |
- npm install
- npm run build-pr
-
- - name: Pull request artifacts
- uses: gavv/pull-request-artifacts@v1.0.0
- with:
- commit: ${{ github.event.pull_request.head.sha }}
- repo-token: ${{ secrets.GITHUB_TOKEN }}
- artifacts-branch: artifacts
- artifacts: |
- releases/dev/wasabee.user.js
From beabd133935fb0e8687da7199eb0f14a51c89d32 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 9 Jun 2021 00:04:47 +0200
Subject: [PATCH 055/275] operation.getzone
---
src/code/model/operation.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 09450a9dc..75af4ece0 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -1059,6 +1059,13 @@ export default class WasabeeOp extends Evented {
return i;
}
+ getZone(zoneID) {
+ for (const z of this.zones) {
+ if (z.id == zoneID) return z;
+ }
+ return null;
+ }
+
zoneName(zoneID) {
if (zoneID == "0")
// All zone
From eafa9a373316633414385690902c6cc13b8bce99 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 9 Jun 2021 00:04:57 +0200
Subject: [PATCH 056/275] multimax: select spine from keys/zones
---
src/code/dialogs/multimaxDialog.js | 128 ++++++++++++++++++++++++++++-
1 file changed, 125 insertions(+), 3 deletions(-)
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index 9e3504945..38e764a85 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -1,5 +1,6 @@
import { WDialog } from "../leafletClasses";
import WasabeePortal from "../model/portal";
+import WasabeeMarker from "../model/marker";
import { getSelectedOperation } from "../selectedOp";
import wX from "../wX";
import {
@@ -22,7 +23,77 @@ const MultimaxDialog = WDialog.extend({
addHooks: function () {
WDialog.prototype.addHooks.call(this);
+ window.map.on("wasabee:op:select", this.closeDialog, this);
+ window.map.on("wasabee:op:change", this._opChange, this);
+ this._mapRefreshHook = this._updatePortalSet.bind(this);
+ window.addHook("mapDataRefreshEnd", this._mapRefreshHook);
+
+ this._operation = getSelectedOperation();
+
this._displayDialog();
+ this._updatePortalSet();
+ },
+
+ removeHooks: function () {
+ WDialog.prototype.removeHooks.call(this);
+ window.map.off("wasabee:op:select", this.closeDialog, this);
+ window.map.off("wasabee:op:change", this._opChange, this);
+ window.removeHook("mapDataRefreshEnd", this._mapRefreshHook);
+ },
+
+ _opChange: function () {
+ this._operation = getSelectedOperation();
+ this._updatePortalSet();
+ },
+
+ _initPortalSet: function (setKey, zone, keys) {
+ const portalSet = this._portalSets[setKey];
+ portalSet.zone = zone;
+ portalSet.keys = keys;
+ portalSet.portals = [];
+ },
+
+ _updatePortalSet: function () {
+ for (const setKey in this._portalSets) {
+ const portalSet = this._portalSets[setKey];
+ if (portalSet.keys) {
+ const keys = this._operation.markers.filter(
+ (m) => m.type === WasabeeMarker.constants.MARKER_TYPE_KEY
+ );
+ portalSet.portals = keys.map((m) =>
+ this._operation.getPortal(m.portalId)
+ );
+
+ if (portalSet.zone) {
+ const zone = this._operation.getZone(portalSet.zone);
+ if (zone) {
+ //failsafe
+ portalSet.portals = portalSet.portals.filter((p) =>
+ zone.contains(p.latLng)
+ );
+ }
+ }
+ } else {
+ const portals = getAllPortalsOnScreen(this._operation);
+ if (portalSet.zone == 0) portalSet.portals = portals;
+ else {
+ const ids = new Set(portalSet.portals.map((p) => p.id));
+ for (const p of portals) {
+ if (!ids.has(p.id)) portalSet.portals.push(p);
+ }
+ const zone = this._operation.getZone(portalSet.zone);
+ if (zone) {
+ // filter all, if zone shape changed
+ portalSet.portals = portalSet.portals.filter((p) =>
+ zone.contains(p.latLng)
+ );
+ }
+ }
+ }
+ portalSet.display.textContent = wX("PORTAL_COUNT", {
+ count: portalSet.portals.length,
+ });
+ }
},
_addSetPortal: function (text, thisKey, container, storageKey) {
@@ -64,6 +135,55 @@ const MultimaxDialog = WDialog.extend({
this[thisKey].checked = defaultValue;
},
+ _addSelectSet: function (text, setKey, container, defaultValue) {
+ const label = L.DomUtil.create("label", null, container);
+ label.textContent = text;
+ const select = L.DomUtil.create("select", null, container);
+ const display = L.DomUtil.create("span", null, container);
+ display.textContent = wX("NOT_SET");
+ {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = "All visible portals";
+ o.value = "all";
+ o.selected = defaultValue == o.value;
+ }
+ {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = "All Key Portals";
+ o.value = "keys";
+ o.selected = defaultValue == o.value;
+ }
+ for (const zone of this._operation.zones) {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = zone.name;
+ o.value = zone.id;
+ o.selected = defaultValue == o.value;
+ }
+ for (const zone of this._operation.zones) {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = "Keys in " + zone.name;
+ o.value = "keys" + zone.id;
+ o.selected = defaultValue == o.value;
+ }
+ L.DomEvent.on(select, "change", (ev) => {
+ L.DomEvent.stop(ev);
+ const keys = select.value.slice(0, 4) === "keys";
+ const zone =
+ select.value === "all" || select.value === "keys"
+ ? 0
+ : +(keys ? select.value.slice(4) : select.value);
+ this._initPortalSet(setKey, zone, keys);
+ this._updatePortalSet();
+ });
+
+ this._portalSets[setKey] = {
+ portals: [],
+ zone: 0,
+ keys: false,
+ display: display,
+ };
+ },
+
_buildContent: function () {
const container = L.DomUtil.create("div", "container");
const description = L.DomUtil.create("div", "desc", container);
@@ -100,6 +220,8 @@ const MultimaxDialog = WDialog.extend({
true
);
+ this._addSelectSet("Spine region", "spine", container, "all");
+
// Go button
const button = L.DomUtil.create("button", "drawb", container);
button.textContent = wX("MULTI_M");
@@ -140,6 +262,7 @@ const MultimaxDialog = WDialog.extend({
p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY];
if (p) this._anchorTwo = new WasabeePortal(p);
this._urp = L.latLng(testPortal());
+ this._portalSets = {};
},
getSpine: function (pOne, pTwo, portals) {
@@ -216,11 +339,10 @@ const MultimaxDialog = WDialog.extend({
doMultimax: function () {
// this._operation is OK here
- this._operation = getSelectedOperation();
- const portals = getAllPortalsOnScreen(this._operation);
+ const portals = this._portalSets.spine.portals;
// Calculate the multimax
- if (!this._anchorOne || !this._anchorTwo || !portals) {
+ if (!this._anchorOne || !this._anchorTwo || !portals.length) {
alert(wX("INVALID REQUEST"));
return 0;
}
From 751bfd7219e92f0f61d91e5ca22c087de7d8eb64 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 3 Nov 2021 14:14:51 +0100
Subject: [PATCH 057/275] fix: zone interactive
---
src/code/ui/zone.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/code/ui/zone.js b/src/code/ui/zone.js
index 72f204506..7184d5faa 100644
--- a/src/code/ui/zone.js
+++ b/src/code/ui/zone.js
@@ -2,7 +2,6 @@ const zoneShape = {
stroke: false,
opacity: 0.7,
fill: true,
- interactive: false,
};
const WLZone = L.LayerGroup.extend({
@@ -21,6 +20,7 @@ const WLZone = L.LayerGroup.extend({
layer = L.polygon(zone.points, {
color: zone.color,
shapeOptions: zoneShape,
+ interactive: false,
});
L.LayerGroup.prototype.initialize.call(this, [layer]);
},
From f1134daa8312a3071ae20dbdf28d9805fd42fae9 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 3 Nov 2021 14:15:32 +0100
Subject: [PATCH 058/275] madrid: use portals selection from multimax
---
src/code/dialogs/madrid.js | 99 ++++++++++++++------------------------
1 file changed, 36 insertions(+), 63 deletions(-)
diff --git a/src/code/dialogs/madrid.js b/src/code/dialogs/madrid.js
index a8bdb7094..fd9874b2b 100644
--- a/src/code/dialogs/madrid.js
+++ b/src/code/dialogs/madrid.js
@@ -1,11 +1,5 @@
-import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
import { getSelectedOperation } from "../selectedOp";
-import {
- getAllPortalsOnScreen,
- testPortal,
- clearAllLinks,
-} from "../uiCommands";
+import { clearAllLinks } from "../uiCommands";
import wX from "../wX";
import MultimaxDialog from "./multimaxDialog";
@@ -18,28 +12,6 @@ const MadridDialog = MultimaxDialog.extend({
needWritePermission: true,
- _addSetZone: function (text, thisKey, container) {
- const label = L.DomUtil.create("div", "set_label", container);
- label.textContent = text;
- const button = L.DomUtil.create("button", null, container);
- button.textContent = wX("SET");
- const display = L.DomUtil.create("span", null, container);
- if (this[thisKey]) {
- display.textContent = wX("PORTAL_COUNT", {
- count: this[thisKey].length,
- });
- } else {
- display.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(button, "click", () => {
- this[thisKey] = getAllPortalsOnScreen(getSelectedOperation());
- // XXX this is not enough, need to cache them in case IITC purges them
- display.textContent = wX("PORTAL_COUNT", {
- count: this[thisKey].length,
- });
- });
- },
-
_buildContent: function () {
const container = L.DomUtil.create("div", "container");
const description = L.DomUtil.create("div", "desc", container);
@@ -51,7 +23,7 @@ const MadridDialog = MultimaxDialog.extend({
container,
window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
);
- this._addSetZone(wX("MADRID_SET_1"), "_portalSetOne", container);
+ this._addSelectSet(wX("MADRID_SET_1"), "setOne", container, "all");
this._addSetPortal(
wX("ANCHOR2"),
@@ -59,13 +31,13 @@ const MadridDialog = MultimaxDialog.extend({
container,
window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY
);
- this._addSetZone(wX("MADRID_SET_2"), "_portalSetTwo", container);
+ this._addSelectSet(wX("MADRID_SET_2"), "setTwo", container, "all");
const anchorThreeLabel = L.DomUtil.create("label", null, container);
anchorThreeLabel.textContent = wX("ANCHOR3");
const anchorThreeDisplay = L.DomUtil.create("span", null, container);
anchorThreeDisplay.textContent = "Auto-determined";
- this._addSetZone(wX("MADRID_SET_3"), "_portalSetThree", container);
+ this._addSelectSet(wX("MADRID_SET_3"), "setThree", container, "all");
this._addCheckbox(
wX("ADD_BL"),
@@ -125,48 +97,43 @@ const MadridDialog = MultimaxDialog.extend({
});
},
- initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
- this.title = wX("MADRID");
- this.label = wX("MADRID");
- let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
- if (p) this._anchorOne = new WasabeePortal(p);
- p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY];
- if (p) this._anchorTwo = new WasabeePortal(p);
- this._urp = testPortal();
- },
-
doBalancedMadrid: function () {
// Calculate the multimax
if (
!this._anchorOne ||
!this._anchorTwo ||
- !this._portalSetOne ||
- !this._portalSetTwo ||
- !this._portalSetThree
+ !this._portalSets.setOne.portals.length ||
+ !this._portalSets.setTwo.portals.length ||
+ !this._portalSets.setThree.portals.length
) {
alert(wX("INVALID REQUEST"));
return 0;
}
// the set 1 must contain anchor 1 (first back link)
- if (this._portalSetOne.find((p) => this._anchorOne.id == p.id) == undefined)
- this._portalSetOne.push(this._anchorOne);
+ if (
+ this._portalSets.setOne.portals.find((p) => this._anchorOne.id == p.id) ==
+ undefined
+ )
+ this._portalSets.setOne.portals.push(this._anchorOne);
// the set 2 must contain anchor 2 (first back link)
- if (this._portalSetTwo.find((p) => this._anchorTwo.id == p.id) == undefined)
- this._portalSetTwo.push(this._anchorTwo);
+ if (
+ this._portalSets.setTwo.portals.find((p) => this._anchorTwo.id == p.id) ==
+ undefined
+ )
+ this._portalSets.setTwo.portals.push(this._anchorTwo);
const spineThree = this.getSpine(
this._anchorOne,
this._anchorTwo,
- this._portalSetThree
+ this._portalSets.setThree.portals
);
const lastThree = spineThree[spineThree.length - 1];
const spineOne = this.getSpine(
this._anchorTwo,
lastThree,
- this._portalSetOne.filter(
+ this._portalSets.setOne.portals.filter(
(p) =>
this._anchorOne.id == p.id ||
this.fieldCoversPortal(this._anchorTwo, lastThree, p, this._anchorOne)
@@ -177,7 +144,7 @@ const MadridDialog = MultimaxDialog.extend({
const spineTwo = this.getSpine(
lastThree,
lastOne,
- this._portalSetTwo.filter(
+ this._portalSets.setTwo.portals.filter(
(p) =>
this._anchorTwo.id == p.id ||
this.fieldCoversPortal(lastThree, lastOne, p, this._anchorTwo)
@@ -251,9 +218,9 @@ const MadridDialog = MultimaxDialog.extend({
if (
!this._anchorOne ||
!this._anchorTwo ||
- !this._portalSetOne ||
- !this._portalSetTwo ||
- !this._portalSetThree
+ !this._portalSets.setOne.portals.length ||
+ !this._portalSets.setTwo.portals.length ||
+ !this._portalSets.setThree.portals.length
) {
alert(wX("INVALID REQUEST"));
return 0;
@@ -268,7 +235,7 @@ const MadridDialog = MultimaxDialog.extend({
const [len1, order1, last1] = this.MM(
this._anchorOne,
this._anchorTwo,
- this._portalSetThree,
+ this._portalSets.setThree.portals,
1,
false,
"madrid protocol "
@@ -277,13 +244,16 @@ const MadridDialog = MultimaxDialog.extend({
const newThree = last1;
// the set 1 must contain anchor 1 (first back link)
- if (this._portalSetOne.find((p) => this._anchorOne.id == p.id) == undefined)
- this._portalSetOne.push(this._anchorOne);
+ if (
+ this._portalSets.setOne.portals.find((p) => this._anchorOne.id == p.id) ==
+ undefined
+ )
+ this._portalSets.setOne.portals.push(this._anchorOne);
const [len2, order2, last2] = this.MM(
this._anchorTwo,
newThree,
- this._portalSetOne.filter(
+ this._portalSets.setOne.portals.filter(
(p) =>
this._anchorOne.id == p.id ||
this.fieldCoversPortal(this._anchorTwo, newThree, p, this._anchorOne)
@@ -297,13 +267,16 @@ const MadridDialog = MultimaxDialog.extend({
// _anchorOne is no longer useful, use last2
const newOne = last2;
// the set 2 must contain anchor 2 (first back link)
- if (this._portalSetTwo.find((p) => this._anchorTwo.id == p.id) == undefined)
- this._portalSetTwo.push(this._anchorTwo);
+ if (
+ this._portalSets.setTwo.portals.find((p) => this._anchorTwo.id == p.id) ==
+ undefined
+ )
+ this._portalSets.setTwo.portals.push(this._anchorTwo);
const len3 = this.MM(
newThree,
newOne,
- this._portalSetTwo.filter(
+ this._portalSets.setTwo.portals.filter(
(p) =>
this._anchorTwo.id == p.id ||
this.fieldCoversPortal(newThree, newOne, p, this._anchorTwo)
From 008ebf5200c79ec6305e8c40e2435705b21b1641 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 3 Nov 2021 14:25:56 +0100
Subject: [PATCH 059/275] add xW
---
src/code/dialogs/multimaxDialog.js | 8 ++++----
src/code/translations/english.json | 4 ++++
src/code/translations/filipino.json | 4 ++++
src/code/translations/french.json | 4 ++++
src/code/translations/german.json | 4 ++++
src/code/translations/italian.json | 4 ++++
src/code/translations/portuguese.json | 4 ++++
src/code/translations/spanish.json | 4 ++++
8 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/multimaxDialog.js
index 38e764a85..7eb8632ac 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/multimaxDialog.js
@@ -143,13 +143,13 @@ const MultimaxDialog = WDialog.extend({
display.textContent = wX("NOT_SET");
{
const o = L.DomUtil.create("option", null, select);
- o.textContent = "All visible portals";
+ o.textContent = wX("MM_SET_ALL_PORTALS");
o.value = "all";
o.selected = defaultValue == o.value;
}
{
const o = L.DomUtil.create("option", null, select);
- o.textContent = "All Key Portals";
+ o.textContent = wX("MM_SET_ALL_KEYS");
o.value = "keys";
o.selected = defaultValue == o.value;
}
@@ -161,7 +161,7 @@ const MultimaxDialog = WDialog.extend({
}
for (const zone of this._operation.zones) {
const o = L.DomUtil.create("option", null, select);
- o.textContent = "Keys in " + zone.name;
+ o.textContent = wX("MM_SET_KEYS_ZONE", { zoneName: zone.name });
o.value = "keys" + zone.id;
o.selected = defaultValue == o.value;
}
@@ -220,7 +220,7 @@ const MultimaxDialog = WDialog.extend({
true
);
- this._addSelectSet("Spine region", "spine", container, "all");
+ this._addSelectSet(wX("MM_SPINE"), "spine", container, "all");
// Go button
const button = L.DomUtil.create("button", "drawb", container);
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index 8194f39ab..69d1e30f5 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -202,6 +202,10 @@
"MINUTES": " ({minutes} minutes ago)",
"MM": "Multimax",
"MM_INSERT_ORDER": "Insert at the end",
+ "MM_SET_ALL_PORTALS": "All visible portals",
+ "MM_SET_ALL_KEYS": "All GetKey Markers",
+ "MM_SET_KEYS_ZONE": "GetKey: {zoneName}",
+ "MM_SPINE": "Spine",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Draw",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/filipino.json b/src/code/translations/filipino.json
index a4a0734fa..2a23a89bb 100644
--- a/src/code/translations/filipino.json
+++ b/src/code/translations/filipino.json
@@ -202,6 +202,10 @@
"MINUTES": " ({minutes} minutong nakalipas)",
"MM": "Multimax",
"MM_INSERT_ORDER": "Insert at the end",
+ "MM_SET_ALL_PORTALS": "All visible portals",
+ "MM_SET_ALL_KEYS": "All GetKey Markers",
+ "MM_SET_KEYS_ZONE": "GetKey: {zoneName}",
+ "MM_SPINE": "Spine",
"MULTI_M_TITLE": "Gumuhit ng Max Layers",
"MULTI_M": "Multimax",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/french.json b/src/code/translations/french.json
index 8f96253ea..23e8eca91 100644
--- a/src/code/translations/french.json
+++ b/src/code/translations/french.json
@@ -202,6 +202,10 @@
"MINUTES": "(il y a {minutes} minute(s))",
"MM": "Multimax",
"MM_INSERT_ORDER": "Insert at the end",
+ "MM_SET_ALL_PORTALS": "All visible portals",
+ "MM_SET_ALL_KEYS": "All GetKey Markers",
+ "MM_SET_KEYS_ZONE": "GetKey: {zoneName}",
+ "MM_SPINE": "Spine",
"MULTI_M_TITLE": "Dessiner le maximum de couches",
"MULTI_M": "Draw",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/german.json b/src/code/translations/german.json
index daf4d0876..f158eeea3 100644
--- a/src/code/translations/german.json
+++ b/src/code/translations/german.json
@@ -202,6 +202,10 @@
"MINUTES": "vor ({minutes} Minuten)",
"MM": "Maximale Feldanzahl",
"MM_INSERT_ORDER": "Insert at the end",
+ "MM_SET_ALL_PORTALS": "All visible portals",
+ "MM_SET_ALL_KEYS": "All GetKey Markers",
+ "MM_SET_KEYS_ZONE": "GetKey: {zoneName}",
+ "MM_SPINE": "Spine",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Maximale Feldanzahl",
"MULTIMAX": "Maximale Feldanzahl!",
diff --git a/src/code/translations/italian.json b/src/code/translations/italian.json
index 90c46a88d..cd414aa62 100644
--- a/src/code/translations/italian.json
+++ b/src/code/translations/italian.json
@@ -202,6 +202,10 @@
"MINUTES": " ({minutes} minuti fa)",
"MM": "Multimax",
"MM_INSERT_ORDER": "Insert at the end",
+ "MM_SET_ALL_PORTALS": "All visible portals",
+ "MM_SET_ALL_KEYS": "All GetKey Markers",
+ "MM_SET_KEYS_ZONE": "GetKey: {zoneName}",
+ "MM_SPINE": "Spine",
"MULTI_M_TITLE": "Disegna più strati possibile",
"MULTI_M": "Disegna",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/portuguese.json b/src/code/translations/portuguese.json
index a8e330757..f9f0fcd96 100644
--- a/src/code/translations/portuguese.json
+++ b/src/code/translations/portuguese.json
@@ -202,6 +202,10 @@
"MINUTES": " (${value} minutos atrás)",
"MM": "Multimax",
"MM_INSERT_ORDER": "Insert at the end",
+ "MM_SET_ALL_PORTALS": "All visible portals",
+ "MM_SET_ALL_KEYS": "All GetKey Markers",
+ "MM_SET_KEYS_ZONE": "GetKey: {zoneName}",
+ "MM_SPINE": "Spine",
"MULTI_M_TITLE": "Desenhar camadas máximas",
"MULTI_M": "Desenhar",
"MULTIMAX": "Multimax!",
diff --git a/src/code/translations/spanish.json b/src/code/translations/spanish.json
index 2cca0cb09..b77b0f737 100644
--- a/src/code/translations/spanish.json
+++ b/src/code/translations/spanish.json
@@ -202,6 +202,10 @@
"MINUTES": "(Hace {minutes} minutos)",
"MM": "Multimax",
"MM_INSERT_ORDER": "Insert at the end",
+ "MM_SET_ALL_PORTALS": "All visible portals",
+ "MM_SET_ALL_KEYS": "All GetKey Markers",
+ "MM_SET_KEYS_ZONE": "GetKey: {zoneName}",
+ "MM_SPINE": "Spine",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Multimax",
"MULTIMAX": "¡Multimax!",
From 239a14749950c5692ac657c78eabf39935570f61 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 3 Nov 2021 16:43:14 +0100
Subject: [PATCH 060/275] move autodraws
---
src/code/dialogs/autodraws.js | 16 ++++++++--------
src/code/dialogs/{ => autodraws}/fanfield.js | 16 ++++++++--------
src/code/dialogs/{ => autodraws}/flipflop.js | 16 ++++++++--------
src/code/dialogs/{ => autodraws}/homogeneous.js | 14 +++++++-------
src/code/dialogs/{ => autodraws}/madrid.js | 6 +++---
.../dialogs/{ => autodraws}/multimaxDialog.js | 16 ++++++++--------
src/code/dialogs/{ => autodraws}/onionfield.js | 16 ++++++++--------
src/code/dialogs/{ => autodraws}/saveLinks.js | 12 ++++++------
src/code/dialogs/{ => autodraws}/starburst.js | 12 ++++++------
9 files changed, 62 insertions(+), 62 deletions(-)
rename src/code/dialogs/{ => autodraws}/fanfield.js (95%)
rename src/code/dialogs/{ => autodraws}/flipflop.js (96%)
rename src/code/dialogs/{ => autodraws}/homogeneous.js (98%)
rename src/code/dialogs/{ => autodraws}/madrid.js (98%)
rename src/code/dialogs/{ => autodraws}/multimaxDialog.js (97%)
rename src/code/dialogs/{ => autodraws}/onionfield.js (96%)
rename src/code/dialogs/{ => autodraws}/saveLinks.js (91%)
rename src/code/dialogs/{ => autodraws}/starburst.js (91%)
diff --git a/src/code/dialogs/autodraws.js b/src/code/dialogs/autodraws.js
index 4acb8e0b2..4403ba4e3 100644
--- a/src/code/dialogs/autodraws.js
+++ b/src/code/dialogs/autodraws.js
@@ -1,13 +1,13 @@
import { WDialog } from "../leafletClasses";
import wX from "../wX";
-import MultimaxDialog from "../dialogs/multimaxDialog";
-import FanfieldDialog from "../dialogs/fanfield";
-import StarburstDialog from "../dialogs/starburst";
-import SaveLinksDialog from "../dialogs/saveLinks";
-import OnionfieldDialog from "../dialogs/onionfield";
-import HomogeneousDialog from "../dialogs/homogeneous";
-import MadridDialog from "../dialogs/madrid";
-import FlipFlopDialog from "../dialogs/flipflop";
+import MultimaxDialog from "./autodraws/multimaxDialog";
+import FanfieldDialog from "./autodraws/fanfield";
+import StarburstDialog from "./autodraws/starburst";
+import SaveLinksDialog from "./autodraws/saveLinks";
+import OnionfieldDialog from "./autodraws/onionfield";
+import HomogeneousDialog from "./autodraws/homogeneous";
+import MadridDialog from "./autodraws/madrid";
+import FlipFlopDialog from "./autodraws/flipflop";
// This file documents the minimum requirements of a dialog in wasabee
const AutodrawsDialog = WDialog.extend({
diff --git a/src/code/dialogs/fanfield.js b/src/code/dialogs/autodraws/fanfield.js
similarity index 95%
rename from src/code/dialogs/fanfield.js
rename to src/code/dialogs/autodraws/fanfield.js
index 6a5c2aaf7..2f0124fa6 100644
--- a/src/code/dialogs/fanfield.js
+++ b/src/code/dialogs/autodraws/fanfield.js
@@ -1,12 +1,12 @@
-import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
-import { getSelectedOperation } from "../selectedOp";
-import { greatCircleArcIntersect, GeodesicLine } from "../crosslinks";
-import WasabeeLink from "../model/link";
-import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
-import wX from "../wX";
+import { WDialog } from "../../leafletClasses";
+import WasabeePortal from "../../model/portal";
+import { getSelectedOperation } from "../../selectedOp";
+import { greatCircleArcIntersect, GeodesicLine } from "../../crosslinks";
+import WasabeeLink from "../../model/link";
+import { clearAllLinks, getAllPortalsOnScreen } from "../../uiCommands";
+import wX from "../../wX";
-import PortalUI from "../ui/portal";
+import PortalUI from "../../ui/portal";
export function angle(a, p) {
if (a.id == p.id) throw Error("same portal");
diff --git a/src/code/dialogs/flipflop.js b/src/code/dialogs/autodraws/flipflop.js
similarity index 96%
rename from src/code/dialogs/flipflop.js
rename to src/code/dialogs/autodraws/flipflop.js
index 13b64b76c..e06cb92fa 100644
--- a/src/code/dialogs/flipflop.js
+++ b/src/code/dialogs/autodraws/flipflop.js
@@ -1,14 +1,14 @@
-import { WDialog } from "../leafletClasses";
-import wX from "../wX";
-import { getSelectedOperation } from "../selectedOp";
-import { getAllPortalsOnScreen, clearAllLinks } from "../uiCommands";
+import { WDialog } from "../../leafletClasses";
+import wX from "../../wX";
+import { getSelectedOperation } from "../../selectedOp";
+import { getAllPortalsOnScreen, clearAllLinks } from "../../uiCommands";
-import WasabeePortal from "../model/portal";
-import WasabeeMarker from "../model/marker";
-import PortalUI from "../ui/portal";
+import WasabeePortal from "../../model/portal";
+import WasabeeMarker from "../../model/marker";
+import PortalUI from "../../ui/portal";
import { angle } from "./fanfield";
-import { greatCircleArcIntersectByLatLngs } from "../crosslinks";
+import { greatCircleArcIntersectByLatLngs } from "../../crosslinks";
function selectAngleInterval(anchor, portalsSorted, start, end) {
const startAngle = angle(anchor, start);
diff --git a/src/code/dialogs/homogeneous.js b/src/code/dialogs/autodraws/homogeneous.js
similarity index 98%
rename from src/code/dialogs/homogeneous.js
rename to src/code/dialogs/autodraws/homogeneous.js
index 6910ee5b6..ae79ad81e 100644
--- a/src/code/dialogs/homogeneous.js
+++ b/src/code/dialogs/autodraws/homogeneous.js
@@ -1,16 +1,16 @@
-import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
-import { getSelectedOperation } from "../selectedOp";
-import { greatCircleArcIntersectByLatLngs } from "../crosslinks";
+import { WDialog } from "../../leafletClasses";
+import WasabeePortal from "../../model/portal";
+import { getSelectedOperation } from "../../selectedOp";
+import { greatCircleArcIntersectByLatLngs } from "../../crosslinks";
// import WasabeeLink from "../model/link";
import {
clearAllLinks,
getAllPortalsOnScreen,
testPortal,
-} from "../uiCommands";
-import wX from "../wX";
+} from "../../uiCommands";
+import wX from "../../wX";
-import PortalUI from "../ui/portal";
+import PortalUI from "../../ui/portal";
const HomogeneousDialog = WDialog.extend({
statics: {
diff --git a/src/code/dialogs/madrid.js b/src/code/dialogs/autodraws/madrid.js
similarity index 98%
rename from src/code/dialogs/madrid.js
rename to src/code/dialogs/autodraws/madrid.js
index fd9874b2b..4b64c9b1a 100644
--- a/src/code/dialogs/madrid.js
+++ b/src/code/dialogs/autodraws/madrid.js
@@ -1,6 +1,6 @@
-import { getSelectedOperation } from "../selectedOp";
-import { clearAllLinks } from "../uiCommands";
-import wX from "../wX";
+import { getSelectedOperation } from "../../selectedOp";
+import { clearAllLinks } from "../../uiCommands";
+import wX from "../../wX";
import MultimaxDialog from "./multimaxDialog";
// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
diff --git a/src/code/dialogs/multimaxDialog.js b/src/code/dialogs/autodraws/multimaxDialog.js
similarity index 97%
rename from src/code/dialogs/multimaxDialog.js
rename to src/code/dialogs/autodraws/multimaxDialog.js
index 7eb8632ac..5d5612686 100644
--- a/src/code/dialogs/multimaxDialog.js
+++ b/src/code/dialogs/autodraws/multimaxDialog.js
@@ -1,16 +1,16 @@
-import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
-import WasabeeMarker from "../model/marker";
-import { getSelectedOperation } from "../selectedOp";
-import wX from "../wX";
+import { WDialog } from "../../leafletClasses";
+import WasabeePortal from "../../model/portal";
+import WasabeeMarker from "../../model/marker";
+import { getSelectedOperation } from "../../selectedOp";
+import wX from "../../wX";
import {
getAllPortalsOnScreen,
testPortal,
clearAllLinks,
-} from "../uiCommands";
-import { greatCircleArcIntersectByLatLngs } from "../crosslinks";
+} from "../../uiCommands";
+import { greatCircleArcIntersectByLatLngs } from "../../crosslinks";
-import PortalUI from "../ui/portal";
+import PortalUI from "../../ui/portal";
// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
// to not require passing values around when we can get them from this.XXX
diff --git a/src/code/dialogs/onionfield.js b/src/code/dialogs/autodraws/onionfield.js
similarity index 96%
rename from src/code/dialogs/onionfield.js
rename to src/code/dialogs/autodraws/onionfield.js
index e53514680..27eb87212 100644
--- a/src/code/dialogs/onionfield.js
+++ b/src/code/dialogs/autodraws/onionfield.js
@@ -1,12 +1,12 @@
-import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
-import { getSelectedOperation } from "../selectedOp";
-import { greatCircleArcIntersect } from "../crosslinks";
-import WasabeeLink from "../model/link";
-import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
-import wX from "../wX";
+import { WDialog } from "../../leafletClasses";
+import WasabeePortal from "../../model/portal";
+import { getSelectedOperation } from "../../selectedOp";
+import { greatCircleArcIntersect } from "../../crosslinks";
+import WasabeeLink from "../../model/link";
+import { clearAllLinks, getAllPortalsOnScreen } from "../../uiCommands";
+import wX from "../../wX";
-import PortalUI from "../ui/portal";
+import PortalUI from "../../ui/portal";
const OnionfieldDialog = WDialog.extend({
statics: {
diff --git a/src/code/dialogs/saveLinks.js b/src/code/dialogs/autodraws/saveLinks.js
similarity index 91%
rename from src/code/dialogs/saveLinks.js
rename to src/code/dialogs/autodraws/saveLinks.js
index efe8fe4f7..8c03760cf 100644
--- a/src/code/dialogs/saveLinks.js
+++ b/src/code/dialogs/autodraws/saveLinks.js
@@ -1,10 +1,10 @@
-import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
-import { getSelectedOperation } from "../selectedOp";
-import { clearAllLinks, getAllPortalsLinked } from "../uiCommands";
-import wX from "../wX";
+import { WDialog } from "../../leafletClasses";
+import WasabeePortal from "../../model/portal";
+import { getSelectedOperation } from "../../selectedOp";
+import { clearAllLinks, getAllPortalsLinked } from "../../uiCommands";
+import wX from "../../wX";
-import PortalUI from "../ui/portal";
+import PortalUI from "../../ui/portal";
const SaveLinksDialog = WDialog.extend({
statics: {
diff --git a/src/code/dialogs/starburst.js b/src/code/dialogs/autodraws/starburst.js
similarity index 91%
rename from src/code/dialogs/starburst.js
rename to src/code/dialogs/autodraws/starburst.js
index 3eb9fb109..483af5eba 100644
--- a/src/code/dialogs/starburst.js
+++ b/src/code/dialogs/autodraws/starburst.js
@@ -1,10 +1,10 @@
-import { WDialog } from "../leafletClasses";
-import WasabeePortal from "../model/portal";
-import { getSelectedOperation } from "../selectedOp";
-import { clearAllLinks, getAllPortalsOnScreen } from "../uiCommands";
-import wX from "../wX";
+import { WDialog } from "../../leafletClasses";
+import WasabeePortal from "../../model/portal";
+import { getSelectedOperation } from "../../selectedOp";
+import { clearAllLinks, getAllPortalsOnScreen } from "../../uiCommands";
+import wX from "../../wX";
-import PortalUI from "../ui/portal";
+import PortalUI from "../../ui/portal";
const StarburstDialog = WDialog.extend({
statics: {
From 172b75aa456e5f8612ed685c568963be2e655b1f Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 3 Nov 2021 17:00:43 +0100
Subject: [PATCH 061/275] autodraw: factor common UI parts
---
src/code/css/autodraws.css | 15 +-
src/code/dialogs/autodraws/fanfield.js | 127 ++++---------
src/code/dialogs/autodraws/flipflop.js | 40 +---
src/code/dialogs/autodraws/homogeneous.js | 148 ++++-----------
src/code/dialogs/autodraws/madrid.js | 2 -
src/code/dialogs/autodraws/multimaxDialog.js | 190 ++-----------------
src/code/dialogs/autodraws/onionfield.js | 65 ++-----
src/code/dialogs/autodraws/saveLinks.js | 60 ++----
src/code/dialogs/autodraws/starburst.js | 62 ++----
src/code/dialogs/autodraws/tools.js | 182 ++++++++++++++++++
10 files changed, 322 insertions(+), 569 deletions(-)
create mode 100644 src/code/dialogs/autodraws/tools.js
diff --git a/src/code/css/autodraws.css b/src/code/css/autodraws.css
index 2ec5e9949..61427428b 100644
--- a/src/code/css/autodraws.css
+++ b/src/code/css/autodraws.css
@@ -77,16 +77,16 @@
grid-column: 1 / 4;
}
-.wasabee-dialog-starburst .desc2,
-.wasabee-dialog-fanfield .desc2 {
- grid-column: 1 / 3;
+.wasabee-dialog-starburst .desc.secondary,
+.wasabee-dialog-fanfield .desc.secondary {
+ color: lightgrey;
}
.wasabee-dialog-homogeneous .desc {
grid-column: 1 / 5;
}
-.wasabee-dialog-homogeneous .portal {
+.wasabee-dialog-homogeneous .set-portal-display {
grid-column: 3 / 5;
}
@@ -98,10 +98,3 @@
grid-column: 4;
}
-.wasabee-dialog-madrid .set_label {
- grid-column: 1 / 4;
-}
-
-.wasabee-dialog-starburst .desc2 {
- color: lightgrey;
-}
diff --git a/src/code/dialogs/autodraws/fanfield.js b/src/code/dialogs/autodraws/fanfield.js
index 2f0124fa6..f0a188bae 100644
--- a/src/code/dialogs/autodraws/fanfield.js
+++ b/src/code/dialogs/autodraws/fanfield.js
@@ -1,4 +1,4 @@
-import { WDialog } from "../../leafletClasses";
+import { AutoDraw } from "./tools";
import WasabeePortal from "../../model/portal";
import { getSelectedOperation } from "../../selectedOp";
import { greatCircleArcIntersect, GeodesicLine } from "../../crosslinks";
@@ -6,8 +6,6 @@ import WasabeeLink from "../../model/link";
import { clearAllLinks, getAllPortalsOnScreen } from "../../uiCommands";
import wX from "../../wX";
-import PortalUI from "../../ui/portal";
-
export function angle(a, p) {
if (a.id == p.id) throw Error("same portal");
if (a.latLng.lng == p.latLng.lng) {
@@ -61,13 +59,23 @@ export function sortPortalsByAngle(anchor, portals, start, end) {
return slice;
}
-const FanfieldDialog = WDialog.extend({
+const FanfieldDialog = AutoDraw.extend({
statics: {
TYPE: "FanfieldDialog",
},
+ initialize: function (options) {
+ AutoDraw.prototype.initialize.call(this, options);
+ let p = localStorage["wasabee-anchor-1"];
+ if (p) this._anchor = new WasabeePortal(p);
+ p = localStorage["wasabee-fanfield-start"];
+ if (p) this._start = new WasabeePortal(p);
+ p = localStorage["wasabee-fanfield-end"];
+ if (p) this._end = new WasabeePortal(p);
+ },
+
addHooks: function () {
- WDialog.prototype.addHooks.call(this);
+ AutoDraw.prototype.addHooks.call(this);
this._displayDialog();
},
@@ -76,85 +84,26 @@ const FanfieldDialog = WDialog.extend({
const description = L.DomUtil.create("div", "desc", container);
description.textContent = wX("SELECT_FAN_PORTALS");
- const anchorLabel = L.DomUtil.create("label", null, container);
- anchorLabel.textContent = wX("ANCHOR_PORTAL");
- const anchorButton = L.DomUtil.create("button", null, container);
- anchorButton.textContent = wX("SET");
- this._anchorDisplay = L.DomUtil.create("span", null, container);
- if (this._anchor) {
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- this._anchorDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._anchor = PortalUI.getSelected();
- if (this._anchor) {
- localStorage["wasabee-anchor-1"] = JSON.stringify(this._anchor);
- this._anchorDisplay.textContent = "";
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
-
- const startLabel = L.DomUtil.create("label", null, container);
- startLabel.textContent = wX("START_PORT");
- const startButton = L.DomUtil.create("button", null, container);
- startButton.textContent = wX("SET");
- this._startDisplay = L.DomUtil.create("span", null, container);
- if (this._start) {
- this._startDisplay.appendChild(
- PortalUI.displayFormat(this._start, this._smallScreen)
- );
- } else {
- this._startDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(startButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._start = PortalUI.getSelected();
- if (this._start) {
- localStorage["wasabee-fanfield-start"] = JSON.stringify(this._start);
- this._startDisplay.textContent = "";
- this._startDisplay.appendChild(
- PortalUI.displayFormat(this._start, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
-
- const endLabel = L.DomUtil.create("label", null, container);
- endLabel.textContent = wX("END_PORT");
- const endButton = L.DomUtil.create("button", null, container);
- endButton.textContent = wX("SET");
- this._endDisplay = L.DomUtil.create("span", null, container);
- if (this._end) {
- this._endDisplay.appendChild(
- PortalUI.displayFormat(this._end, this._smallScreen)
- );
- } else {
- this._endDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(endButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._end = PortalUI.getSelected();
- if (this._end) {
- localStorage["wasabee-fanfield-end"] = JSON.stringify(this._end);
- this._endDisplay.textContent = "";
- this._endDisplay.appendChild(
- PortalUI.displayFormat(this._end, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
+ this._addSetPortal(
+ wX("ANCHOR_PORTAL"),
+ "_anchor",
+ container,
+ "wasabee-anchor-1"
+ );
+ this._addSetPortal(
+ wX("START_PORT"),
+ "_start",
+ container,
+ "wasabee-fanfield-start"
+ );
+ this._addSetPortal(
+ wX("END_PORT"),
+ "_end",
+ container,
+ "wasabee-fanfield-end"
+ );
- const description2 = L.DomUtil.create("div", "desc2", container);
+ const description2 = L.DomUtil.create("div", "desc secondary", container);
description2.textContent = wX("SELECT_FAN_PORTALS2");
// Bottom buttons bar
@@ -183,18 +132,6 @@ const FanfieldDialog = WDialog.extend({
});
},
- initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
- this.title = wX("FAN_FIELD3");
- this.label = wX("FAN_FIELD3");
- let p = localStorage["wasabee-anchor-1"];
- if (p) this._anchor = new WasabeePortal(p);
- p = localStorage["wasabee-fanfield-start"];
- if (p) this._start = new WasabeePortal(p);
- p = localStorage["wasabee-fanfield-end"];
- if (p) this._end = new WasabeePortal(p);
- },
-
// fanfiled determines the portals between start/end and their angle (and order)
fanfield: function () {
if (!this._anchor || !this._start || !this._end) {
diff --git a/src/code/dialogs/autodraws/flipflop.js b/src/code/dialogs/autodraws/flipflop.js
index e06cb92fa..9eeea0531 100644
--- a/src/code/dialogs/autodraws/flipflop.js
+++ b/src/code/dialogs/autodraws/flipflop.js
@@ -1,11 +1,10 @@
-import { WDialog } from "../../leafletClasses";
+import { AutoDraw } from "./tools";
import wX from "../../wX";
import { getSelectedOperation } from "../../selectedOp";
import { getAllPortalsOnScreen, clearAllLinks } from "../../uiCommands";
import WasabeePortal from "../../model/portal";
import WasabeeMarker from "../../model/marker";
-import PortalUI from "../../ui/portal";
import { angle } from "./fanfield";
import { greatCircleArcIntersectByLatLngs } from "../../crosslinks";
@@ -85,53 +84,22 @@ function fastFan(anchor, two, three, portalsSorted, offset, revSortAngle) {
// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
// to not require passing values around when we can get them from this.XXX
-const FlipFlopDialog = WDialog.extend({
+const FlipFlopDialog = AutoDraw.extend({
statics: {
TYPE: "madridDialog",
},
- needWritePermission: true,
-
initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
+ AutoDraw.prototype.initialize.call(this, options);
let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
if (p) this._anchorOne = new WasabeePortal(p);
},
addHooks: function () {
- WDialog.prototype.addHooks.call(this);
+ AutoDraw.prototype.addHooks.call(this);
this._displayDialog();
},
- _addSetPortal: function (text, thisKey, container, storageKey) {
- const label = L.DomUtil.create("label", null, container);
- label.textContent = text;
- const button = L.DomUtil.create("button", null, container);
- button.textContent = wX("SET");
- const display = L.DomUtil.create("span", null, container);
- if (this[thisKey]) {
- display.appendChild(
- PortalUI.displayFormat(this[thisKey], this._smallScreen)
- );
- } else {
- display.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(button, "click", () => {
- this[thisKey] = PortalUI.getSelected();
- if (this[thisKey]) {
- if (storageKey)
- localStorage[storageKey] = JSON.stringify(this[thisKey]);
- display.textContent = "";
- display.appendChild(
- PortalUI.displayFormat(this[thisKey], this._smallScreen)
- );
- } else {
- display.textContent = wX("NOT_SET");
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
- },
-
_buildContent: function () {
const container = L.DomUtil.create("div", "container");
const description = L.DomUtil.create("div", "desc", container);
diff --git a/src/code/dialogs/autodraws/homogeneous.js b/src/code/dialogs/autodraws/homogeneous.js
index ae79ad81e..c6113ba9e 100644
--- a/src/code/dialogs/autodraws/homogeneous.js
+++ b/src/code/dialogs/autodraws/homogeneous.js
@@ -1,4 +1,4 @@
-import { WDialog } from "../../leafletClasses";
+import { AutoDraw } from "./tools";
import WasabeePortal from "../../model/portal";
import { getSelectedOperation } from "../../selectedOp";
import { greatCircleArcIntersectByLatLngs } from "../../crosslinks";
@@ -12,14 +12,26 @@ import wX from "../../wX";
import PortalUI from "../../ui/portal";
-const HomogeneousDialog = WDialog.extend({
+const HomogeneousDialog = AutoDraw.extend({
statics: {
TYPE: "HomogeneousDialog",
},
- needWritePermission: true,
+ initialize: function (options) {
+ AutoDraw.prototype.initialize.call(this, options);
+ let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
+ if (p) this._anchorOne = new WasabeePortal(p);
+ p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY];
+ if (p) this._anchorTwo = new WasabeePortal(p);
+ p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_THREE_KEY];
+ if (p) this._anchorThree = new WasabeePortal(p);
+
+ this._urp = L.latLng(testPortal());
+ this._failed = 0;
+ },
addHooks: function () {
+ AutoDraw.prototype.addHooks.call(this);
this._layerGroup = new L.LayerGroup();
window.addLayerGroup("Wasabee H-G Debug", this._layerGroup, true);
this._displayDialog();
@@ -27,7 +39,7 @@ const HomogeneousDialog = WDialog.extend({
removeHooks: function () {
window.removeLayerGroup(this._layerGroup);
- WDialog.prototype.removeHooks.call(this);
+ AutoDraw.prototype.removeHooks.call(this);
},
_displayDialog: function () {
@@ -35,86 +47,24 @@ const HomogeneousDialog = WDialog.extend({
const description2 = L.DomUtil.create("div", "desc", container);
description2.textContent = wX("H-GEN_INST");
- const anchorLabelOne = L.DomUtil.create("label", null, container);
- anchorLabelOne.textContent = wX("ANCHOR_PORTAL");
- const anchorButtonOne = L.DomUtil.create("button", null, container);
- anchorButtonOne.textContent = wX("SET");
- this._anchorDisplayOne = L.DomUtil.create("span", "portal", container);
- if (this._anchorOne) {
- this._anchorDisplayOne.appendChild(
- PortalUI.displayFormat(this._anchorOne, this._smallScreen)
- );
- } else {
- this._anchorDisplayOne.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorButtonOne, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._anchorOne = PortalUI.getSelected();
- if (this._anchorOne) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
- JSON.stringify(this._anchorOne);
- this._anchorDisplayOne.textContent = "";
- this._anchorDisplayOne.appendChild(
- PortalUI.displayFormat(this._anchorOne, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
-
- const anchorLabelTwo = L.DomUtil.create("label", null, container);
- anchorLabelTwo.textContent = wX("ANCHOR_PORTAL2");
- const anchorButtonTwo = L.DomUtil.create("button", null, container);
- anchorButtonTwo.textContent = wX("SET");
- this._anchorDisplayTwo = L.DomUtil.create("span", "portal", container);
- if (this._anchorTwo) {
- this._anchorDisplayTwo.appendChild(
- PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
- );
- } else {
- this._anchorDisplayTwo.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorButtonTwo, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._anchorTwo = PortalUI.getSelected();
- if (this._anchorTwo) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY] =
- JSON.stringify(this._anchorTwo);
- this._anchorDisplayTwo.textContent = "";
- this._anchorDisplayTwo.appendChild(
- PortalUI.displayFormat(this._anchorTwo, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
-
- const anchorLabelThree = L.DomUtil.create("label", null, container);
- anchorLabelThree.textContent = wX("ANCHOR_PORTAL3");
- const anchorButtonThree = L.DomUtil.create("button", null, container);
- anchorButtonThree.textContent = wX("SET");
- this._anchorDisplayThree = L.DomUtil.create("span", "portal", container);
- if (this._anchorThree) {
- this._anchorDisplayThree.appendChild(
- PortalUI.displayFormat(this._anchorThree, this._smallScreen)
- );
- } else {
- this._anchorDisplayThree.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorButtonThree, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._anchorThree = PortalUI.getSelected();
- if (this._anchorThree) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_THREE_KEY] =
- JSON.stringify(this._anchorThree);
- this._anchorDisplayThree.textContent = "";
- this._anchorDisplayThree.appendChild(
- PortalUI.displayFormat(this._anchorThree, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
+ this._addSetPortal(
+ wX("ANCHOR_PORTAL"),
+ "_anchorOne",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
+ );
+ this._addSetPortal(
+ wX("ANCHOR_PORTAL2"),
+ "_anchorTwo",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY
+ );
+ this._addSetPortal(
+ wX("ANCHOR_PORTAL3"),
+ "_anchorThree",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_THREE_KEY
+ );
const depthLabel = L.DomUtil.create("label", null, container);
depthLabel.textContent = wX("MAX_SPLITS");
@@ -141,12 +91,13 @@ const HomogeneousDialog = WDialog.extend({
orderOption.textContent = text;
}
- const fullSearchLabel = L.DomUtil.create("label", null, container);
- fullSearchLabel.textContent = wX("HF_DEEP_SEARCH");
- fullSearchLabel.htmlFor = "wasabee-homogeneous-deep";
- this._fullSearchCheck = L.DomUtil.create("input", null, container);
- this._fullSearchCheck.type = "checkbox";
- this._fullSearchCheck.id = "wasabee-homogeneous-deep";
+ this._addCheckbox(
+ wX("HF_DEEP_SEARCH"),
+ "wasabee-homogeneous-deep",
+ "_fullSearch",
+ container,
+ false
+ );
const spanRedraw = L.DomUtil.create("div", null, container);
this._redrawButton = L.DomUtil.create("button", null, spanRedraw);
@@ -164,7 +115,7 @@ const HomogeneousDialog = WDialog.extend({
L.DomEvent.on(drawButton, "click", (ev) => {
L.DomEvent.stop(ev);
this._operation = getSelectedOperation();
- if (this._fullSearchCheck.checked) this.hdeepfield.call(this);
+ if (this._fullSearch) this.hdeepfield.call(this);
else this.hfield.call(this);
});
@@ -186,21 +137,6 @@ const HomogeneousDialog = WDialog.extend({
});
},
- initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
- this.title = "Homogeneous";
- this.label = "Homogeneous";
- let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
- if (p) this._anchorOne = new WasabeePortal(p);
- p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY];
- if (p) this._anchorTwo = new WasabeePortal(p);
- p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_THREE_KEY];
- if (p) this._anchorThree = new WasabeePortal(p);
-
- this._urp = L.latLng(testPortal());
- this._failed = 0;
- },
-
hfield: function () {
this._failed = 0;
this._layerGroup.clearLayers();
diff --git a/src/code/dialogs/autodraws/madrid.js b/src/code/dialogs/autodraws/madrid.js
index 4b64c9b1a..0f1b2a82d 100644
--- a/src/code/dialogs/autodraws/madrid.js
+++ b/src/code/dialogs/autodraws/madrid.js
@@ -10,8 +10,6 @@ const MadridDialog = MultimaxDialog.extend({
TYPE: "madridDialog",
},
- needWritePermission: true,
-
_buildContent: function () {
const container = L.DomUtil.create("div", "container");
const description = L.DomUtil.create("div", "desc", container);
diff --git a/src/code/dialogs/autodraws/multimaxDialog.js b/src/code/dialogs/autodraws/multimaxDialog.js
index 5d5612686..55c60795e 100644
--- a/src/code/dialogs/autodraws/multimaxDialog.js
+++ b/src/code/dialogs/autodraws/multimaxDialog.js
@@ -1,189 +1,33 @@
-import { WDialog } from "../../leafletClasses";
+import { AutoDraw } from "./tools";
import WasabeePortal from "../../model/portal";
-import WasabeeMarker from "../../model/marker";
import { getSelectedOperation } from "../../selectedOp";
import wX from "../../wX";
-import {
- getAllPortalsOnScreen,
- testPortal,
- clearAllLinks,
-} from "../../uiCommands";
+import { testPortal, clearAllLinks } from "../../uiCommands";
import { greatCircleArcIntersectByLatLngs } from "../../crosslinks";
-import PortalUI from "../../ui/portal";
-
// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
// to not require passing values around when we can get them from this.XXX
-const MultimaxDialog = WDialog.extend({
+const MultimaxDialog = AutoDraw.extend({
statics: {
TYPE: "multimaxDialog",
},
- needWritePermission: true,
+ initialize: function (options) {
+ AutoDraw.prototype.initialize.call(this, options);
+ let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
+ if (p) this._anchorOne = new WasabeePortal(p);
+ p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY];
+ if (p) this._anchorTwo = new WasabeePortal(p);
+ this._urp = L.latLng(testPortal());
+ },
addHooks: function () {
- WDialog.prototype.addHooks.call(this);
- window.map.on("wasabee:op:select", this.closeDialog, this);
- window.map.on("wasabee:op:change", this._opChange, this);
- this._mapRefreshHook = this._updatePortalSet.bind(this);
- window.addHook("mapDataRefreshEnd", this._mapRefreshHook);
-
- this._operation = getSelectedOperation();
+ AutoDraw.prototype.addHooks.call(this);
this._displayDialog();
this._updatePortalSet();
},
- removeHooks: function () {
- WDialog.prototype.removeHooks.call(this);
- window.map.off("wasabee:op:select", this.closeDialog, this);
- window.map.off("wasabee:op:change", this._opChange, this);
- window.removeHook("mapDataRefreshEnd", this._mapRefreshHook);
- },
-
- _opChange: function () {
- this._operation = getSelectedOperation();
- this._updatePortalSet();
- },
-
- _initPortalSet: function (setKey, zone, keys) {
- const portalSet = this._portalSets[setKey];
- portalSet.zone = zone;
- portalSet.keys = keys;
- portalSet.portals = [];
- },
-
- _updatePortalSet: function () {
- for (const setKey in this._portalSets) {
- const portalSet = this._portalSets[setKey];
- if (portalSet.keys) {
- const keys = this._operation.markers.filter(
- (m) => m.type === WasabeeMarker.constants.MARKER_TYPE_KEY
- );
- portalSet.portals = keys.map((m) =>
- this._operation.getPortal(m.portalId)
- );
-
- if (portalSet.zone) {
- const zone = this._operation.getZone(portalSet.zone);
- if (zone) {
- //failsafe
- portalSet.portals = portalSet.portals.filter((p) =>
- zone.contains(p.latLng)
- );
- }
- }
- } else {
- const portals = getAllPortalsOnScreen(this._operation);
- if (portalSet.zone == 0) portalSet.portals = portals;
- else {
- const ids = new Set(portalSet.portals.map((p) => p.id));
- for (const p of portals) {
- if (!ids.has(p.id)) portalSet.portals.push(p);
- }
- const zone = this._operation.getZone(portalSet.zone);
- if (zone) {
- // filter all, if zone shape changed
- portalSet.portals = portalSet.portals.filter((p) =>
- zone.contains(p.latLng)
- );
- }
- }
- }
- portalSet.display.textContent = wX("PORTAL_COUNT", {
- count: portalSet.portals.length,
- });
- }
- },
-
- _addSetPortal: function (text, thisKey, container, storageKey) {
- const label = L.DomUtil.create("label", null, container);
- label.textContent = text;
- const button = L.DomUtil.create("button", null, container);
- button.textContent = wX("SET");
- const display = L.DomUtil.create("span", null, container);
- if (this[thisKey]) {
- display.appendChild(
- PortalUI.displayFormat(this[thisKey], this._smallScreen)
- );
- } else {
- display.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(button, "click", () => {
- this[thisKey] = PortalUI.getSelected();
- if (this[thisKey]) {
- if (storageKey)
- localStorage[storageKey] = JSON.stringify(this[thisKey]);
- display.textContent = "";
- display.appendChild(
- PortalUI.displayFormat(this[thisKey], this._smallScreen)
- );
- } else {
- display.textContent = wX("NOT_SET");
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
- },
-
- _addCheckbox: function (text, id, thisKey, container, defaultValue) {
- const label = L.DomUtil.create("label", null, container);
- label.textContent = text;
- label.htmlFor = id;
- this[thisKey] = L.DomUtil.create("input", null, container);
- this[thisKey].type = "checkbox";
- this[thisKey].id = id;
- this[thisKey].checked = defaultValue;
- },
-
- _addSelectSet: function (text, setKey, container, defaultValue) {
- const label = L.DomUtil.create("label", null, container);
- label.textContent = text;
- const select = L.DomUtil.create("select", null, container);
- const display = L.DomUtil.create("span", null, container);
- display.textContent = wX("NOT_SET");
- {
- const o = L.DomUtil.create("option", null, select);
- o.textContent = wX("MM_SET_ALL_PORTALS");
- o.value = "all";
- o.selected = defaultValue == o.value;
- }
- {
- const o = L.DomUtil.create("option", null, select);
- o.textContent = wX("MM_SET_ALL_KEYS");
- o.value = "keys";
- o.selected = defaultValue == o.value;
- }
- for (const zone of this._operation.zones) {
- const o = L.DomUtil.create("option", null, select);
- o.textContent = zone.name;
- o.value = zone.id;
- o.selected = defaultValue == o.value;
- }
- for (const zone of this._operation.zones) {
- const o = L.DomUtil.create("option", null, select);
- o.textContent = wX("MM_SET_KEYS_ZONE", { zoneName: zone.name });
- o.value = "keys" + zone.id;
- o.selected = defaultValue == o.value;
- }
- L.DomEvent.on(select, "change", (ev) => {
- L.DomEvent.stop(ev);
- const keys = select.value.slice(0, 4) === "keys";
- const zone =
- select.value === "all" || select.value === "keys"
- ? 0
- : +(keys ? select.value.slice(4) : select.value);
- this._initPortalSet(setKey, zone, keys);
- this._updatePortalSet();
- });
-
- this._portalSets[setKey] = {
- portals: [],
- zone: 0,
- keys: false,
- display: display,
- };
- },
-
_buildContent: function () {
const container = L.DomUtil.create("div", "container");
const description = L.DomUtil.create("div", "desc", container);
@@ -255,16 +99,6 @@ const MultimaxDialog = WDialog.extend({
});
},
- initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
- let p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
- if (p) this._anchorOne = new WasabeePortal(p);
- p = localStorage[window.plugin.wasabee.static.constants.ANCHOR_TWO_KEY];
- if (p) this._anchorTwo = new WasabeePortal(p);
- this._urp = L.latLng(testPortal());
- this._portalSets = {};
- },
-
getSpine: function (pOne, pTwo, portals) {
const portalsMap = new Map(portals.map((p) => [p.id, p]));
const poset = this.buildPOSet(pOne, pTwo, portals);
diff --git a/src/code/dialogs/autodraws/onionfield.js b/src/code/dialogs/autodraws/onionfield.js
index 27eb87212..42f739b71 100644
--- a/src/code/dialogs/autodraws/onionfield.js
+++ b/src/code/dialogs/autodraws/onionfield.js
@@ -1,4 +1,4 @@
-import { WDialog } from "../../leafletClasses";
+import { AutoDraw } from "./tools";
import WasabeePortal from "../../model/portal";
import { getSelectedOperation } from "../../selectedOp";
import { greatCircleArcIntersect } from "../../crosslinks";
@@ -6,17 +6,20 @@ import WasabeeLink from "../../model/link";
import { clearAllLinks, getAllPortalsOnScreen } from "../../uiCommands";
import wX from "../../wX";
-import PortalUI from "../../ui/portal";
-
-const OnionfieldDialog = WDialog.extend({
+const OnionfieldDialog = AutoDraw.extend({
statics: {
TYPE: "OnionDialog",
},
- needWritePermission: true,
+ initialize: function (options) {
+ AutoDraw.prototype.initialize.call(this, options);
+ const p =
+ localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
+ if (p) this._anchor = new WasabeePortal(p);
+ },
addHooks: function () {
- WDialog.prototype.addHooks.call(this);
+ AutoDraw.prototype.addHooks.call(this);
this._displayDialog();
},
@@ -27,41 +30,12 @@ const OnionfieldDialog = WDialog.extend({
const description3 = L.DomUtil.create("div", "desc", container);
description3.textContent = wX("SEL_SB_ANCHOR2");
- const dividerBeforePortals = L.DomUtil.create("span", null, container);
- dividerBeforePortals.textContent = "";
-
- const anchorLabel = L.DomUtil.create("label", null, container);
- anchorLabel.textContent = wX("ANCHOR_PORTAL");
- const anchorButton = L.DomUtil.create("button", null, container);
- anchorButton.textContent = wX("SET");
- this._anchorDisplay = L.DomUtil.create("span", null, container);
- if (this._anchor) {
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- this._anchorDisplay.textContent = wX("NOT_SET");
- }
- L.DomEvent.on(anchorButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._anchor = PortalUI.getSelected();
- if (this._anchor) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
- JSON.stringify(this._anchor);
- this._anchorDisplay.textContent = "";
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
- const dividerBeforeDraw = L.DomUtil.create("span", null, container);
- dividerBeforeDraw.textContent = "";
-
- // Bottom buttons bar
- const placeholder = L.DomUtil.create("label", "placeholder", container);
- placeholder.textContent = "\u2063";
+ this._addSetPortal(
+ wX("ANCHOR_PORTAL"),
+ "_anchor",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
+ );
// Go button
const button = L.DomUtil.create("button", "drawb", container);
@@ -87,15 +61,6 @@ const OnionfieldDialog = WDialog.extend({
});
},
- initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
- this.title = "Onion/Rose";
- this.label = "Onion/Rose";
- const p =
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
- if (p) this._anchor = new WasabeePortal(p);
- },
-
onion: function () {
// this._operation is OK here
this._operation = getSelectedOperation();
diff --git a/src/code/dialogs/autodraws/saveLinks.js b/src/code/dialogs/autodraws/saveLinks.js
index 8c03760cf..bad5da83b 100644
--- a/src/code/dialogs/autodraws/saveLinks.js
+++ b/src/code/dialogs/autodraws/saveLinks.js
@@ -1,20 +1,23 @@
-import { WDialog } from "../../leafletClasses";
+import { AutoDraw } from "./tools";
import WasabeePortal from "../../model/portal";
import { getSelectedOperation } from "../../selectedOp";
import { clearAllLinks, getAllPortalsLinked } from "../../uiCommands";
import wX from "../../wX";
-import PortalUI from "../../ui/portal";
-
-const SaveLinksDialog = WDialog.extend({
+const SaveLinksDialog = AutoDraw.extend({
statics: {
TYPE: "SaveLinksDialog",
},
- needWritePermission: true,
+ initialize: function (options) {
+ AutoDraw.prototype.initialize.call(this, options);
+ const p =
+ localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
+ if (p) this._anchor = new WasabeePortal(p);
+ },
addHooks: function () {
- WDialog.prototype.addHooks.call(this);
+ AutoDraw.prototype.addHooks.call(this);
this._displayDialog();
},
@@ -24,38 +27,12 @@ const SaveLinksDialog = WDialog.extend({
const description = L.DomUtil.create("div", "desc", container);
description.textContent = wX("SEL_SL_ANCHOR");
- //anchor portal text
- const anchorLabel = L.DomUtil.create("label", null, container);
- anchorLabel.textContent = wX("ANCHOR_PORTAL");
-
- //Set Button
- const anchorButton = L.DomUtil.create("button", null, container);
- anchorButton.textContent = wX("SET");
- this._anchorDisplay = L.DomUtil.create("div", "anchor", container);
-
- //do magic
- if (this._anchor) {
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- this._anchorDisplay.textContent = wX("NOT_SET");
- }
-
- L.DomEvent.on(anchorButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._anchor = PortalUI.getSelected();
- if (this._anchor) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
- JSON.stringify(this._anchor);
- this._anchorDisplay.textContent = "";
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
+ this._addSetPortal(
+ wX("ANCHOR_PORTAL"),
+ "_anchor",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
+ );
const button = L.DomUtil.create("button", "drawb", container);
button.textContent = wX("SAVELINKS_DRAW");
@@ -82,13 +59,6 @@ const SaveLinksDialog = WDialog.extend({
});
},
- initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
- const p =
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
- if (p) this._anchor = new WasabeePortal(p);
- },
-
saveLinks: function () {
if (!this._anchor) {
alert("Select an anchor portal");
diff --git a/src/code/dialogs/autodraws/starburst.js b/src/code/dialogs/autodraws/starburst.js
index 483af5eba..503e7d0ab 100644
--- a/src/code/dialogs/autodraws/starburst.js
+++ b/src/code/dialogs/autodraws/starburst.js
@@ -1,20 +1,23 @@
-import { WDialog } from "../../leafletClasses";
+import { AutoDraw } from "./tools";
import WasabeePortal from "../../model/portal";
import { getSelectedOperation } from "../../selectedOp";
import { clearAllLinks, getAllPortalsOnScreen } from "../../uiCommands";
import wX from "../../wX";
-import PortalUI from "../../ui/portal";
-
-const StarburstDialog = WDialog.extend({
+const StarburstDialog = AutoDraw.extend({
statics: {
TYPE: "StarburstDialog",
},
- needWritePermission: true,
+ initialize: function (options) {
+ AutoDraw.prototype.initialize.call(this, options);
+ const p =
+ localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
+ if (p) this._anchor = new WasabeePortal(p);
+ },
addHooks: function () {
- WDialog.prototype.addHooks.call(this);
+ AutoDraw.prototype.addHooks.call(this);
this._displayDialog();
},
@@ -24,40 +27,14 @@ const StarburstDialog = WDialog.extend({
const description = L.DomUtil.create("div", "desc", container);
description.textContent = wX("SEL_SB_ANCHOR");
- //anchor portal text
- const anchorLabel = L.DomUtil.create("label", null, container);
- anchorLabel.textContent = wX("ANCHOR_PORTAL");
-
- //Set Button
- const anchorButton = L.DomUtil.create("button", null, container);
- anchorButton.textContent = wX("SET");
- this._anchorDisplay = L.DomUtil.create("div", "anchor", container);
-
- //do magic
- if (this._anchor) {
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- this._anchorDisplay.textContent = wX("NOT_SET");
- }
-
- L.DomEvent.on(anchorButton, "click", (ev) => {
- L.DomEvent.stop(ev);
- this._anchor = PortalUI.getSelected();
- if (this._anchor) {
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY] =
- JSON.stringify(this._anchor);
- this._anchorDisplay.textContent = "";
- this._anchorDisplay.appendChild(
- PortalUI.displayFormat(this._anchor, this._smallScreen)
- );
- } else {
- alert(wX("PLEASE_SELECT_PORTAL"));
- }
- });
+ this._addSetPortal(
+ wX("ANCHOR_PORTAL"),
+ "_anchor",
+ container,
+ window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
+ );
- const description2 = L.DomUtil.create("div", "desc2", container);
+ const description2 = L.DomUtil.create("div", "desc secondary", container);
description2.textContent = wX("SEL_SB_ANCHOR2");
const button = L.DomUtil.create("button", "drawb", container);
@@ -85,13 +62,6 @@ const StarburstDialog = WDialog.extend({
});
},
- initialize: function (options) {
- WDialog.prototype.initialize.call(this, options);
- const p =
- localStorage[window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY];
- if (p) this._anchor = new WasabeePortal(p);
- },
-
starburst: function () {
if (!this._anchor) {
alert("Select an anchor portal");
diff --git a/src/code/dialogs/autodraws/tools.js b/src/code/dialogs/autodraws/tools.js
new file mode 100644
index 000000000..2460798c2
--- /dev/null
+++ b/src/code/dialogs/autodraws/tools.js
@@ -0,0 +1,182 @@
+import { WDialog } from "../../leafletClasses";
+import WasabeeMarker from "../../model/marker";
+import { getSelectedOperation } from "../../selectedOp";
+import wX from "../../wX";
+import { getAllPortalsOnScreen } from "../../uiCommands";
+
+import PortalUI from "../../ui/portal";
+
+// now that the formerly external mm functions are in the class, some of the logic can be cleaned up
+// to not require passing values around when we can get them from this.XXX
+export const AutoDraw = WDialog.extend({
+ statics: {
+ TYPE: "autodraw",
+ },
+
+ needWritePermission: true,
+
+ initialize: function (options) {
+ WDialog.prototype.initialize.call(this, options);
+ this._portalSets = {};
+ },
+
+ addHooks: function () {
+ WDialog.prototype.addHooks.call(this);
+ window.map.on("wasabee:op:select wasabee:op:change", this._opChange, this);
+
+ this._mapRefreshHook = this._updatePortalSet.bind(this);
+ window.addHook("mapDataRefreshEnd", this._mapRefreshHook);
+
+ this._operation = getSelectedOperation();
+ },
+
+ removeHooks: function () {
+ WDialog.prototype.removeHooks.call(this);
+ window.map.off("wasabee:op:select wasabee:op:change", this._opChange, this);
+
+ window.removeHook("mapDataRefreshEnd", this._mapRefreshHook);
+ },
+
+ _opChange: function () {
+ this._operation = getSelectedOperation();
+ this._updatePortalSet();
+ },
+
+ _initPortalSet: function (setKey, zone, keys) {
+ const portalSet = this._portalSets[setKey];
+ portalSet.zone = zone;
+ portalSet.keys = keys;
+ portalSet.portals = [];
+ },
+
+ _updatePortalSet: function () {
+ for (const setKey in this._portalSets) {
+ const portalSet = this._portalSets[setKey];
+ if (portalSet.keys) {
+ const keys = this._operation.markers.filter(
+ (m) => m.type === WasabeeMarker.constants.MARKER_TYPE_KEY
+ );
+ portalSet.portals = keys.map((m) =>
+ this._operation.getPortal(m.portalId)
+ );
+
+ if (portalSet.zone) {
+ const zone = this._operation.getZone(portalSet.zone);
+ if (zone) {
+ //failsafe
+ portalSet.portals = portalSet.portals.filter((p) =>
+ zone.contains(p.latLng)
+ );
+ }
+ }
+ } else {
+ const portals = getAllPortalsOnScreen(this._operation);
+ if (portalSet.zone == 0) portalSet.portals = portals;
+ else {
+ const ids = new Set(portalSet.portals.map((p) => p.id));
+ for (const p of portals) {
+ if (!ids.has(p.id)) portalSet.portals.push(p);
+ }
+ const zone = this._operation.getZone(portalSet.zone);
+ if (zone) {
+ // filter all, if zone shape changed
+ portalSet.portals = portalSet.portals.filter((p) =>
+ zone.contains(p.latLng)
+ );
+ }
+ }
+ }
+ portalSet.display.textContent = wX("PORTAL_COUNT", {
+ count: portalSet.portals.length,
+ });
+ }
+ },
+
+ _addSetPortal: function (text, thisKey, container, storageKey) {
+ const label = L.DomUtil.create("label", "set-portal-label", container);
+ label.textContent = text;
+ const button = L.DomUtil.create("button", "set-portal-button", container);
+ button.textContent = wX("SET");
+ const display = L.DomUtil.create("span", "set-portal-display", container);
+ if (this[thisKey]) {
+ display.appendChild(
+ PortalUI.displayFormat(this[thisKey], this._smallScreen)
+ );
+ } else {
+ display.textContent = wX("NOT_SET");
+ }
+ L.DomEvent.on(button, "click", () => {
+ this[thisKey] = PortalUI.getSelected();
+ if (this[thisKey]) {
+ if (storageKey)
+ localStorage[storageKey] = JSON.stringify(this[thisKey]);
+ display.textContent = "";
+ display.appendChild(
+ PortalUI.displayFormat(this[thisKey], this._smallScreen)
+ );
+ } else {
+ display.textContent = wX("NOT_SET");
+ alert(wX("PLEASE_SELECT_PORTAL"));
+ }
+ });
+ },
+
+ _addCheckbox: function (text, id, thisKey, container, defaultValue) {
+ const label = L.DomUtil.create("label", "checkbox-label", container);
+ label.textContent = text;
+ label.htmlFor = id;
+ this[thisKey] = L.DomUtil.create("input", "checkbox-input", container);
+ this[thisKey].type = "checkbox";
+ this[thisKey].id = id;
+ this[thisKey].checked = defaultValue;
+ },
+
+ _addSelectSet: function (text, setKey, container, defaultValue) {
+ const label = L.DomUtil.create("label", "select-set-label", container);
+ label.textContent = text;
+ const select = L.DomUtil.create("select", "select-set-input", container);
+ const display = L.DomUtil.create("span", "select-set-display", container);
+ display.textContent = wX("NOT_SET");
+ {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = wX("MM_SET_ALL_PORTALS");
+ o.value = "all";
+ o.selected = defaultValue == o.value;
+ }
+ {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = wX("MM_SET_ALL_KEYS");
+ o.value = "keys";
+ o.selected = defaultValue == o.value;
+ }
+ for (const zone of this._operation.zones) {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = zone.name;
+ o.value = zone.id;
+ o.selected = defaultValue == o.value;
+ }
+ for (const zone of this._operation.zones) {
+ const o = L.DomUtil.create("option", null, select);
+ o.textContent = wX("MM_SET_KEYS_ZONE", { zoneName: zone.name });
+ o.value = "keys" + zone.id;
+ o.selected = defaultValue == o.value;
+ }
+ L.DomEvent.on(select, "change", (ev) => {
+ L.DomEvent.stop(ev);
+ const keys = select.value.slice(0, 4) === "keys";
+ const zone =
+ select.value === "all" || select.value === "keys"
+ ? 0
+ : +(keys ? select.value.slice(4) : select.value);
+ this._initPortalSet(setKey, zone, keys);
+ this._updatePortalSet();
+ });
+
+ this._portalSets[setKey] = {
+ portals: [],
+ zone: 0,
+ keys: false,
+ display: display,
+ };
+ },
+});
From 856d4eff753decdbb694494f89a0b286be5ea71a Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 3 Nov 2021 18:00:19 +0100
Subject: [PATCH 062/275] fanfield/flipflop: select portals
---
src/code/dialogs/autodraws/fanfield.js | 8 +++++---
src/code/dialogs/autodraws/flipflop.js | 9 +++++----
src/code/translations/english.json | 1 +
src/code/translations/filipino.json | 1 +
src/code/translations/french.json | 1 +
src/code/translations/german.json | 1 +
src/code/translations/italian.json | 1 +
src/code/translations/portuguese.json | 1 +
src/code/translations/spanish.json | 1 +
9 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/code/dialogs/autodraws/fanfield.js b/src/code/dialogs/autodraws/fanfield.js
index f0a188bae..a50b42db4 100644
--- a/src/code/dialogs/autodraws/fanfield.js
+++ b/src/code/dialogs/autodraws/fanfield.js
@@ -3,7 +3,7 @@ import WasabeePortal from "../../model/portal";
import { getSelectedOperation } from "../../selectedOp";
import { greatCircleArcIntersect, GeodesicLine } from "../../crosslinks";
import WasabeeLink from "../../model/link";
-import { clearAllLinks, getAllPortalsOnScreen } from "../../uiCommands";
+import { clearAllLinks } from "../../uiCommands";
import wX from "../../wX";
export function angle(a, p) {
@@ -77,6 +77,7 @@ const FanfieldDialog = AutoDraw.extend({
addHooks: function () {
AutoDraw.prototype.addHooks.call(this);
this._displayDialog();
+ this._updatePortalSet();
},
_displayDialog: function () {
@@ -103,6 +104,8 @@ const FanfieldDialog = AutoDraw.extend({
"wasabee-fanfield-end"
);
+ this._addSelectSet(wX("AUTODRAW_PORTALS_SET"), "set", container, "all");
+
const description2 = L.DomUtil.create("div", "desc secondary", container);
description2.textContent = wX("SELECT_FAN_PORTALS2");
@@ -139,10 +142,9 @@ const FanfieldDialog = AutoDraw.extend({
return;
}
- const op = getSelectedOperation();
const steps = sortPortalsByAngle(
this._anchor,
- getAllPortalsOnScreen(op),
+ this._portalSets["set"].portals,
this._start,
this._end
);
diff --git a/src/code/dialogs/autodraws/flipflop.js b/src/code/dialogs/autodraws/flipflop.js
index 9eeea0531..b2021c6f3 100644
--- a/src/code/dialogs/autodraws/flipflop.js
+++ b/src/code/dialogs/autodraws/flipflop.js
@@ -115,6 +115,8 @@ const FlipFlopDialog = AutoDraw.extend({
window.plugin.wasabee.static.constants.ANCHOR_ONE_KEY
);
+ this._addSelectSet(wX("AUTODRAW_PORTALS_SET"), "set", container, "all");
+
L.DomUtil.create("label", null, container).textContent = "#SBUL";
this._nbSbul = L.DomUtil.create("input", null, container);
this._nbSbul.type = "number";
@@ -265,7 +267,7 @@ const FlipFlopDialog = AutoDraw.extend({
}
this._operation = getSelectedOperation();
- const portals = getAllPortalsOnScreen(this._operation).filter(
+ const portals = this._portalSets["set"].portals.filter(
(p) => p.id != this._anchorOne.id
);
@@ -309,7 +311,7 @@ const FlipFlopDialog = AutoDraw.extend({
j + 1,
revAngleSort
);
- if (best.steps.length < res.length) {
+ if (!best.two || best.steps.length < res.length) {
best.steps = res;
best.two = pTwo;
best.three = pThree;
@@ -323,8 +325,7 @@ const FlipFlopDialog = AutoDraw.extend({
if (best.steps.length > maxSteps)
best.steps = best.steps.slice(0, maxSteps);
- // Calculate the multimax
- if (!best.steps.length) {
+ if (!best.two) {
alert(wX("INVALID REQUEST"));
return 0;
}
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index 69d1e30f5..2dbfa9f53 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -48,6 +48,7 @@
"AUTH_SELECT_ACCOUNT": "Select account",
"AUTO_DRAWS": "Auto-draw",
"AUTODRAWS": "Wasabee Auto-draw Options",
+ "AUTODRAW_PORTALS_SET": "Portals",
"AUTOLOAD_RATE": "Portal Detail Request Rate (ms)",
"AUTOLOAD": "Automatically Load Missing Portal Details",
"AUTOMARK STOP": "Auto-Mark stopped due to portals not being loaded",
diff --git a/src/code/translations/filipino.json b/src/code/translations/filipino.json
index 2a23a89bb..789b5763c 100644
--- a/src/code/translations/filipino.json
+++ b/src/code/translations/filipino.json
@@ -48,6 +48,7 @@
"AUTH_SELECT_ACCOUNT": "Select account",
"AUTO_DRAWS": "Auto-draw",
"AUTODRAWS": "Wasabee Auto-draw Options",
+ "AUTODRAW_PORTALS_SET": "Portals",
"AUTOLOAD_RATE": "Portal Detail Request Rate (ms)",
"AUTOLOAD": "Automatically Load Missing Portal Details",
"AUTOMARK STOP": "Itinigil ang pag Auto-Mark dahil hindi maiload ang mga portals",
diff --git a/src/code/translations/french.json b/src/code/translations/french.json
index 23e8eca91..c8effcc06 100644
--- a/src/code/translations/french.json
+++ b/src/code/translations/french.json
@@ -48,6 +48,7 @@
"AUTH_SELECT_ACCOUNT": "Sélectionner le compte",
"AUTO_DRAWS": "Auto-Draw",
"AUTODRAWS": "Choix d'Auto-draw",
+ "AUTODRAW_PORTALS_SET": "Portals",
"AUTOLOAD_RATE": "Délai entre deux requêtes",
"AUTOLOAD": "Charger automatiquement les données manquantes de portails",
"AUTOMARK STOP": "Le processus d'Auto-Mark s'est arrêté suite à l'absence de donnée pour certains portails.",
diff --git a/src/code/translations/german.json b/src/code/translations/german.json
index f158eeea3..2cf6eae59 100644
--- a/src/code/translations/german.json
+++ b/src/code/translations/german.json
@@ -48,6 +48,7 @@
"AUTH_SELECT_ACCOUNT": "Select account",
"AUTO_DRAWS": "Auto-draw",
"AUTODRAWS": "Wasabee Auto-draw Options",
+ "AUTODRAW_PORTALS_SET": "Portals",
"AUTOLOAD_RATE": "Portal Detail Request Rate (ms)",
"AUTOLOAD": "Automatically Load Missing Portal Details",
"AUTOMARK STOP": "Automatische Markierung gestoppt - Portale nicht vollständig geladen.",
diff --git a/src/code/translations/italian.json b/src/code/translations/italian.json
index cd414aa62..01dafd9f8 100644
--- a/src/code/translations/italian.json
+++ b/src/code/translations/italian.json
@@ -48,6 +48,7 @@
"AUTH_SELECT_ACCOUNT": "Seleziona account",
"AUTO_DRAWS": "Auto-draw",
"AUTODRAWS": "Opzioni Wasabee Auto-draw",
+ "AUTODRAW_PORTALS_SET": "Portals",
"AUTOLOAD_RATE": "Frequenza Richiesta dettagli Portali (ms)",
"AUTOLOAD": "Carica Automaticamente Dettagli dei Portali Mancanti",
"AUTOMARK STOP": "Auto-Mark interrotto, i portali non sono caricati",
diff --git a/src/code/translations/portuguese.json b/src/code/translations/portuguese.json
index f9f0fcd96..67b0bcf1b 100644
--- a/src/code/translations/portuguese.json
+++ b/src/code/translations/portuguese.json
@@ -48,6 +48,7 @@
"AUTH_SELECT_ACCOUNT": "Selecionar conta",
"AUTO_DRAWS": "Auto-draw",
"AUTODRAWS": "Wasabee Auto-draw Opções",
+ "AUTODRAW_PORTALS_SET": "Portals",
"AUTOLOAD_RATE": "Taxa de solicitação de detalhes do portal (ms)",
"AUTOLOAD": "Carregar automaticamente os detalhes do portal em falta",
"AUTOMARK STOP": "Auto-Marcar interrompido devido a portais não serem carregados",
diff --git a/src/code/translations/spanish.json b/src/code/translations/spanish.json
index b77b0f737..c204d713a 100644
--- a/src/code/translations/spanish.json
+++ b/src/code/translations/spanish.json
@@ -48,6 +48,7 @@
"AUTH_SELECT_ACCOUNT": "Select account",
"AUTO_DRAWS": "Auto-draw",
"AUTODRAWS": "Wasabee Auto-draw Options",
+ "AUTODRAW_PORTALS_SET": "Portals",
"AUTOLOAD_RATE": "Portal Detail Request Rate (ms)",
"AUTOLOAD": "Automatically Load Missing Portal Details",
"AUTOMARK STOP": "El Marcado-Automático se detuvo debido a que los portales no estaban cargado",
From a740804233fc160bc18647f509ed1ce84b4ff796 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Mon, 25 Oct 2021 09:43:33 +0200
Subject: [PATCH 063/275] agent: use intelname when available
+ display name origin (intel/rocks/V)
---
src/code/css/wasabee.css | 8 +++++++
src/code/dialogs/agentDialog.js | 30 ++++++++++++++++----------
src/code/dialogs/assignDialog.js | 2 +-
src/code/dialogs/checklist.js | 2 +-
src/code/dialogs/keyListPortal.js | 2 +-
src/code/dialogs/manageTeamDialog.js | 8 +++----
src/code/dialogs/markerAddDialog.js | 2 +-
src/code/dialogs/onlineAgentList.js | 6 +++---
src/code/dialogs/opsDialog.js | 4 ++--
src/code/dialogs/sendTargetDialog.js | 2 +-
src/code/dialogs/teamMembershipList.js | 8 +++----
src/code/model/agent.js | 10 ++++++++-
src/code/ui/agent.js | 30 +++++++++++++++++++++-----
src/code/ui/marker.js | 4 ++--
src/code/wd.js | 2 +-
15 files changed, 80 insertions(+), 40 deletions(-)
diff --git a/src/code/css/wasabee.css b/src/code/css/wasabee.css
index f2629261c..dad395df9 100644
--- a/src/code/css/wasabee.css
+++ b/src/code/css/wasabee.css
@@ -52,6 +52,14 @@
}
// .wasabee-table td.menu { position: relative; min-height: 20px; min-width: 24px; }
+.wasabee-dialog-agent ul {
+ padding-left: 0;
+}
+
+.wasabee-dialog-agent li {
+ list-style: none;
+}
+
/* defined in agent.js, always on an -- can this be pruned ? */
.wasabee-agent-label a {
text-shadow: 1px 1px #000, 1px -1px #000, -1px 1px #000, -1px -1px #000,
diff --git a/src/code/dialogs/agentDialog.js b/src/code/dialogs/agentDialog.js
index 7f646b1d3..c6afdd01d 100644
--- a/src/code/dialogs/agentDialog.js
+++ b/src/code/dialogs/agentDialog.js
@@ -18,23 +18,31 @@ const AgentDialog = WDialog.extend({
_displayDialog: async function () {
const html = L.DomUtil.create("div", null);
- const agent = L.DomUtil.create("div", null, html);
try {
const data = await WasabeeAgent.get(this.options.gid);
- const name = L.DomUtil.create("h2", "enl, wasabee-agent-label", agent);
- name.textContent = data.name;
- const vLabel = L.DomUtil.create("label", null, agent);
- vLabel.textContent = "V Verified: ";
- L.DomUtil.create("div", null, vLabel).textContent = data.Vverified;
- const rocksLabel = L.DomUtil.create("label", null, agent);
- rocksLabel.textContent = "Rocks Verified: ";
- L.DomUtil.create("div", null, rocksLabel).textContent = data.rocks;
- const img = L.DomUtil.create("img", null, agent);
+ L.DomUtil.create("h2", "wasabee-agent-label", html).textContent =
+ data.getName();
+
+ const ul = L.DomUtil.create("ul", "", html);
+ const rows = [
+ ["Server name: ", data.name],
+ ["V name: ", data.vname],
+ ["V verified: ", data.Vverified],
+ ["Rocks name: ", data.rocksname],
+ ["Rocks Verified: ", data.rocks],
+ ];
+ for (const [label, value] of rows) {
+ const li = L.DomUtil.create("li", "", ul);
+ L.DomUtil.create("label", null, li).textContent = label;
+ L.DomUtil.create("span", null, li).textContent = value;
+ }
+
+ const img = L.DomUtil.create("img", null, html);
img.src = data.pic;
} catch (e) {
console.error(e);
- agent.innerHTML = e.toString();
+ html.innerHTML = e.toString();
}
const buttons = {};
diff --git a/src/code/dialogs/assignDialog.js b/src/code/dialogs/assignDialog.js
index 7c3bd7e15..9d66bf8a2 100644
--- a/src/code/dialogs/assignDialog.js
+++ b/src/code/dialogs/assignDialog.js
@@ -128,7 +128,7 @@ const AssignDialog = WDialog.extend({
alreadyAdded.push(a.id);
option = L.DomUtil.create("option");
option.value = a.id;
- option.textContent = a.name;
+ option.textContent = a.getName();
if (a.id == current) option.selected = true;
menu.appendChild(option);
}
diff --git a/src/code/dialogs/checklist.js b/src/code/dialogs/checklist.js
index abb5dde1d..63e5c6cc3 100644
--- a/src/code/dialogs/checklist.js
+++ b/src/code/dialogs/checklist.js
@@ -212,7 +212,7 @@ const OperationChecklistDialog = WDialog.extend({
value: async (thing) => {
if (thing.assignedTo != null && thing.assignedTo != "") {
const agent = await WasabeeAgent.get(thing.assignedTo);
- if (agent != null) return agent.name;
+ if (agent != null) return agent.getName();
return "GID: [" + thing.assignedTo + "]";
}
return ". . .";
diff --git a/src/code/dialogs/keyListPortal.js b/src/code/dialogs/keyListPortal.js
index c6f095d20..f32c9ec2d 100644
--- a/src/code/dialogs/keyListPortal.js
+++ b/src/code/dialogs/keyListPortal.js
@@ -81,7 +81,7 @@ const KeyListPortal = WDialog.extend({
sort: (a, b) => a.localeCompare(b),
format: async (cell, value, key) => {
const agent = await WasabeeAgent.get(key.gid);
- cell.textContent = agent ? agent.name : key.gid;
+ cell.textContent = agent ? agent.getName() : key.gid;
},
},
{
diff --git a/src/code/dialogs/manageTeamDialog.js b/src/code/dialogs/manageTeamDialog.js
index 6ffee9f70..c26301122 100644
--- a/src/code/dialogs/manageTeamDialog.js
+++ b/src/code/dialogs/manageTeamDialog.js
@@ -47,12 +47,10 @@ const ManageTeamDialog = WDialog.extend({
table.fields = [
{
name: wX("AGENT"),
- value: (agent) => agent.name,
+ value: (agent) => agent.getName(),
sort: (a, b) => a.localeCompare(b),
- format: async (cell, value, agent) =>
- cell.appendChild(
- await AgentUI.formatDisplay(agent, this.options.team.id)
- ),
+ format: (cell, value, agent) =>
+ cell.appendChild(AgentUI.formatDisplay(agent)),
},
{
name: wX("TEAM STATE"),
diff --git a/src/code/dialogs/markerAddDialog.js b/src/code/dialogs/markerAddDialog.js
index 30fcf9e72..25dc3375b 100644
--- a/src/code/dialogs/markerAddDialog.js
+++ b/src/code/dialogs/markerAddDialog.js
@@ -182,7 +182,7 @@ const MarkerAddDialog = WDialog.extend({
alreadyAdded.add(a.id);
option = L.DomUtil.create("option");
option.value = a.id;
- option.textContent = a.name;
+ option.textContent = a.getName();
menu.appendChild(option);
}
}
diff --git a/src/code/dialogs/onlineAgentList.js b/src/code/dialogs/onlineAgentList.js
index b681023df..10eb12295 100644
--- a/src/code/dialogs/onlineAgentList.js
+++ b/src/code/dialogs/onlineAgentList.js
@@ -45,10 +45,10 @@ const OnlineAgentList = WDialog.extend({
this._table.fields = [
{
name: wX("AGENT"),
- value: (agent) => agent.name,
+ value: (agent) => agent.getName(),
sort: (a, b) => a.localeCompare(b),
- format: async (cell, value, agent) =>
- cell.appendChild(await AgentUI.formatDisplay(agent)),
+ format: (cell, value, agent) =>
+ cell.appendChild(AgentUI.formatDisplay(agent)),
},
{
name: "Last Seen",
diff --git a/src/code/dialogs/opsDialog.js b/src/code/dialogs/opsDialog.js
index 93136e810..5cdfc4e38 100644
--- a/src/code/dialogs/opsDialog.js
+++ b/src/code/dialogs/opsDialog.js
@@ -281,8 +281,8 @@ const OpsDialog = WDialog.extend({
};
if (sum.currentserver) {
const agent = await WasabeeAgent.get(tmpOp.creator);
- sum.owner = agent.name;
- sum.ownerDisplay = await AgentUI.formatDisplay(agent);
+ sum.owner = agent.getName();
+ sum.ownerDisplay = AgentUI.formatDisplay(agent);
} else {
sum.owner = window.PLAYER.nickname;
}
diff --git a/src/code/dialogs/sendTargetDialog.js b/src/code/dialogs/sendTargetDialog.js
index 518a7e7cc..1e3937dfb 100644
--- a/src/code/dialogs/sendTargetDialog.js
+++ b/src/code/dialogs/sendTargetDialog.js
@@ -106,7 +106,7 @@ const SendTargetDialog = WDialog.extend({
alreadyAdded.push(a.id);
option = L.DomUtil.create("option");
option.value = a.id;
- option.textContent = a.name;
+ option.textContent = a.getName();
if (a.id == current) option.selected = true;
menu.appendChild(option);
}
diff --git a/src/code/dialogs/teamMembershipList.js b/src/code/dialogs/teamMembershipList.js
index a6df0068b..69aa80628 100644
--- a/src/code/dialogs/teamMembershipList.js
+++ b/src/code/dialogs/teamMembershipList.js
@@ -53,12 +53,10 @@ const TeamMembershipList = WDialog.extend({
table.fields = [
{
name: wX("AGENT"),
- value: (agent) => agent.name,
+ value: (agent) => agent.getName(),
sort: (a, b) => a.localeCompare(b),
- format: async (cell, value, agent) =>
- cell.appendChild(
- await AgentUI.formatDisplay(agent, this.options.teamID)
- ),
+ format: (cell, value, agent) =>
+ cell.appendChild(AgentUI.formatDisplay(agent)),
},
{
name: wX("SQUAD"),
diff --git a/src/code/model/agent.js b/src/code/model/agent.js
index bf2332b21..92b63beda 100644
--- a/src/code/model/agent.js
+++ b/src/code/model/agent.js
@@ -20,7 +20,7 @@ export default class WasabeeAgent {
this.name = obj.name;
this.vname = obj.vname;
this.rocksname = obj.rocksname;
- this.intelname = obj.intelname;
+ this.intelname = obj.intelname !== "unset" ? obj.intelname : null;
this.intelfaction = obj.intelfaction;
this.level = obj.level ? Number(obj.level) : 0;
this.enlid = obj.enlid ? obj.enlid : null;
@@ -53,6 +53,14 @@ export default class WasabeeAgent {
this._updateCache();
}
+ getName() {
+ if (this.Vverified && this.vname) return this.vname;
+ if (this.rocks && this.rocksname) return this.rocksname;
+ if (this.intelname) return this.intelname;
+ return this.name;
+ }
+
+ // deprecated
async getTeamName(teamID = 0) {
if (teamID == 0) return this.name;
diff --git a/src/code/ui/agent.js b/src/code/ui/agent.js
index 6927d821a..bfbad6584 100644
--- a/src/code/ui/agent.js
+++ b/src/code/ui/agent.js
@@ -7,7 +7,7 @@ import wX from "../wX";
import WasabeeAgent from "../model/agent";
-async function formatDisplay(agent, teamID = 0) {
+function formatDisplay(agent) {
const display = L.DomUtil.create("a", "wasabee-agent-label");
if (agent.Vverified || agent.rocks) {
L.DomUtil.addClass(display, "enl");
@@ -20,7 +20,27 @@ async function formatDisplay(agent, teamID = 0) {
const ad = new AgentDialog({ gid: agent.id });
ad.enable();
});
- display.textContent = await agent.getTeamName(teamID);
+
+ let prefix = "";
+ if (agent.Vverified) prefix += "V";
+ else if (agent.vname === agent.name) prefix += "v";
+ if (agent.rocks) prefix += "R";
+ else if (agent.rocksname === agent.name) prefix += "r";
+ if (agent.intelname) {
+ // no identity source exept intel
+ if (!agent.rocksname && !agent.vname) prefix += "I";
+ // no verified source
+ else if (!agent.rocks && !agent.Vverified) prefix += "I";
+ // match server preference
+ else if (agent.intelname === agent.name) prefix += "I";
+ // match server preference, in lower case
+ else if (agent.intelname.toLowerCase() === agent.name.toLowerCase())
+ prefix += "i";
+ }
+
+ display.textContent = prefix
+ ? `[${prefix}] ` + agent.getName()
+ : agent.getName();
return display;
}
@@ -119,7 +139,7 @@ const WLAgent = L.Marker.extend({
initialize: function (agent) {
const zoom = window.map.getZoom();
L.Marker.prototype.initialize.call(this, agent.latLng, {
- title: agent.name,
+ title: agent.getName(),
icon: L.divIcon({
className: "wasabee-agent-icon",
iconSize: iconSize(zoom),
@@ -163,7 +183,7 @@ const WLAgent = L.Marker.extend({
const content = L.DomUtil.create("div", "wasabee-agent-popup");
const title = L.DomUtil.create("div", "desc", content);
title.id = agent.id;
- title.textContent = agent.name;
+ title.textContent = agent.getName();
WasabeeAgent.get(this.options.id)
.then(formatDisplay)
@@ -185,7 +205,7 @@ const WLAgent = L.Marker.extend({
title: wX("SEND TARGET"),
label: wX("SEND TARGET CONFIRM", {
portalName: PortalUI.displayName(selectedPortal),
- agent: agent.name,
+ agent: agent.getName(),
}),
type: "agent",
callback: async () => {
diff --git a/src/code/ui/marker.js b/src/code/ui/marker.js
index c7dd426a7..7a1158776 100644
--- a/src/code/ui/marker.js
+++ b/src/code/ui/marker.js
@@ -107,7 +107,7 @@ const WLMarker = PortalUI.WLPortal.extend({
try {
const a = await WasabeeAgent.get(marker.assignedTo);
assignment.textContent = wX("ASS_TO"); // FIXME convert formatDisplay to html and add as value to wX
- if (a) assignment.appendChild(await AgentUI.formatDisplay(a));
+ if (a) assignment.appendChild(AgentUI.formatDisplay(a));
else assignment.textContent += " " + marker.assignedTo;
} catch (err) {
console.error(err);
@@ -117,7 +117,7 @@ const WLMarker = PortalUI.WLPortal.extend({
try {
const a = await WasabeeAgent.get(marker.completedID);
assignment.innerHTML = wX("COMPLETED BY", {
- agentName: a ? a.name : marker.completedID,
+ agentName: a ? a.getName() : marker.completedID,
});
} catch (e) {
console.error(e);
diff --git a/src/code/wd.js b/src/code/wd.js
index 474810cf1..c4b9b5498 100644
--- a/src/code/wd.js
+++ b/src/code/wd.js
@@ -155,7 +155,7 @@ async function getMarkerPopup(PortalID) {
const a = await WasabeeAgent.get(dk.GID);
const li = L.DomUtil.create("li", null, ul);
if (a) {
- li.appendChild(await AgentUI.formatDisplay(a));
+ li.appendChild(AgentUI.formatDisplay(a));
} else {
const fake = L.DomUtil.create("span", null, li);
fake.textContent = wX("LOADING");
From e9979c690eb103fb7c48bea1148a62c24722c6d0 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 11 Nov 2021 10:32:15 +0100
Subject: [PATCH 064/275] fix: send target broken on anchor
---
src/code/dialogs/sendTargetDialog.js | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/code/dialogs/sendTargetDialog.js b/src/code/dialogs/sendTargetDialog.js
index 518a7e7cc..4f723d07e 100644
--- a/src/code/dialogs/sendTargetDialog.js
+++ b/src/code/dialogs/sendTargetDialog.js
@@ -50,18 +50,22 @@ const SendTargetDialog = WDialog.extend({
const operation = getSelectedOperation();
if (this.options.target instanceof WasabeeMarker) {
- const portal = operation.getPortal(this.options.target.portalId);
+ this._portal = operation.getPortal(this.options.target.portalId);
this._targettype = this.options.target.type;
- divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
+ divtitle.appendChild(
+ PortalUI.displayFormat(this._portal, this._smallScreen)
+ );
const t = L.DomUtil.create("label", null);
t.textContent = wX("SEND TARGET AGENT");
menu.prepend(t);
}
if (this.options.target instanceof WasabeePortal) {
- const portal = this.options.target;
+ this._portal = this.options.target;
this._targettype = "anchor";
- divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
+ divtitle.appendChild(
+ PortalUI.displayFormat(this._portal, this._smallScreen)
+ );
const t = L.DomUtil.create("label", null);
t.textContent = wX("SEND TARGET AGENT");
menu.prepend(t);
@@ -120,13 +124,11 @@ const SendTargetDialog = WDialog.extend({
},
_sendTarget: function () {
- if (!this._value) {
+ if (!this._value || !this._portal) {
this.closeDialog();
return;
}
- const operation = getSelectedOperation();
- const portal = operation.getPortal(this.options.target.portalId);
- targetPromise(this._value, portal, this._targettype)
+ targetPromise(this._value, this._portal, this._targettype)
.then(() => {
alert(wX("TARGET SENT"));
this.closeDialog();
From d9a519d553058844095e1fa48bf433078935ca5c Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Tue, 16 Nov 2021 20:40:26 +0100
Subject: [PATCH 065/275] fix: assign dialog without title
---
src/code/dialogs/assignDialog.js | 59 +++++++++++++-------------------
1 file changed, 23 insertions(+), 36 deletions(-)
diff --git a/src/code/dialogs/assignDialog.js b/src/code/dialogs/assignDialog.js
index 9d66bf8a2..003e67dad 100644
--- a/src/code/dialogs/assignDialog.js
+++ b/src/code/dialogs/assignDialog.js
@@ -32,13 +32,11 @@ const AssignDialog = WDialog.extend({
this.closeDialog();
};
- // create container then setup asynchronously
- this._html = L.DomUtil.create("div", "container");
- this._setup();
+ const html = this._buildContent();
this.createDialog({
title: this._name,
- html: this._html,
+ html: html,
width: "auto",
dialogClass: "assign",
buttons: buttons,
@@ -46,12 +44,15 @@ const AssignDialog = WDialog.extend({
});
},
- _setup: async function () {
+ _buildContent: function () {
+ const html = L.DomUtil.create("div", "container");
+
const target = this.options.target;
const operation = getSelectedOperation();
this._targetID = target.ID;
- const divtitle = L.DomUtil.create("div", "desc", this._html);
- const menu = await this._getAgentMenu(target.assignedTo);
+
+ const divtitle = L.DomUtil.create("div", "desc", html);
+ const menu = L.DomUtil.create("div", "wasabee-agent-menu", html);
if (target instanceof WasabeeLink) {
const portal = operation.getPortal(target.fromPortalId);
@@ -62,9 +63,8 @@ const AssignDialog = WDialog.extend({
divtitle.appendChild(
LinkUI.displayFormat(target, operation, this._smallScreen)
);
- const t = L.DomUtil.create("label", null);
+ const t = L.DomUtil.create("label", null, menu);
t.textContent = wX("LINK ASSIGNMENT");
- menu.prepend(t);
}
if (target instanceof WasabeeMarker) {
@@ -74,9 +74,8 @@ const AssignDialog = WDialog.extend({
portalName: PortalUI.displayName(portal),
});
divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
- const t = L.DomUtil.create("label", null);
+ const t = L.DomUtil.create("label", null, menu);
t.textContent = wX("MARKER ASSIGNMENT");
- menu.prepend(t);
}
if (target instanceof WasabeePortal) {
@@ -86,36 +85,27 @@ const AssignDialog = WDialog.extend({
portalName: PortalUI.displayName(portal),
});
divtitle.appendChild(PortalUI.displayFormat(portal, this._smallScreen));
- const t = L.DomUtil.create("label", null);
+ const t = L.DomUtil.create("label", null, menu);
t.textContent = wX("ANCHOR ASSIGNMENT");
- menu.prepend(t);
- }
-
- this._html.appendChild(menu);
- },
-
- _buildContent: function () {
- const content = L.DomUtil.create("div");
- if (typeof this._label == "string") {
- content.textContent = this._label;
- } else {
- content.appendChild(this._label);
}
- return content;
- },
- _getAgentMenu: async function (current) {
- const container = L.DomUtil.create("div", "wasabee-agent-menu");
- const menu = L.DomUtil.create("select", null, container);
- let option = menu.appendChild(L.DomUtil.create("option", null));
+ const select = L.DomUtil.create("select", null, menu);
+ const option = L.DomUtil.create("option", null, select);
option.value = "";
option.textContent = wX("UNASSIGNED");
- const alreadyAdded = new Array();
- menu.addEventListener("change", (value) => {
+ L.DomEvent.on(select, "change", (value) => {
this.localAssign(value);
});
+ this._populateAgentSelect(select, target.assignedTo);
+
+ return html;
+ },
+
+ _populateAgentSelect: async function (select, current) {
+ const alreadyAdded = new Array();
+
const me = await WasabeeMe.waitGet();
for (const t of getSelectedOperation().teamlist) {
if (me.teamJoined(t.teamid) == false) continue;
@@ -126,19 +116,16 @@ const AssignDialog = WDialog.extend({
for (const a of agents) {
if (!alreadyAdded.includes(a.id)) {
alreadyAdded.push(a.id);
- option = L.DomUtil.create("option");
+ const option = L.DomUtil.create("option", "", select);
option.value = a.id;
option.textContent = a.getName();
if (a.id == current) option.selected = true;
- menu.appendChild(option);
}
}
} catch (e) {
console.error(e);
}
}
-
- return container;
},
localAssign: function (value) {
From 72ec58688bae0af711989dcd1dda218b39c861ea Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Sat, 20 Nov 2021 15:49:12 +0100
Subject: [PATCH 066/275] fix: assign all outbound links
---
src/code/dialogs/assignDialog.js | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/code/dialogs/assignDialog.js b/src/code/dialogs/assignDialog.js
index 003e67dad..7cd1bbb92 100644
--- a/src/code/dialogs/assignDialog.js
+++ b/src/code/dialogs/assignDialog.js
@@ -137,11 +137,9 @@ const AssignDialog = WDialog.extend({
operation.assignLink(this._targetID, value.srcElement.value);
}
if (this._type == "Anchor") {
- const links = operation.getLinkListFromPortal(
- operation.getPortal(this._targetID)
- );
+ const links = operation.getLinkListFromPortal(this.options.target);
for (const l of links) {
- if (l.fromPortalId == this._targetID) {
+ if (l.fromPortalId == this.options.target.id) {
operation.assignLink(l.ID, value.srcElement.value);
}
}
From 049016346bac7ad87f39998f173922c44d08828b Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Tue, 9 Nov 2021 22:42:05 +0100
Subject: [PATCH 067/275] types
---
package.json | 11 +-
src/code/addButtons.d.ts | 2 +
src/code/auxiliar.d.ts | 3 +
src/code/buttons/linkButton.d.ts | 6 +
src/code/buttons/markerButton.d.ts | 4 +
src/code/buttons/opButton.d.ts | 4 +
src/code/buttons/quickdrawButton.d.ts | 6 +
src/code/buttons/syncButton.d.ts | 4 +
src/code/buttons/uploadButton.d.ts | 6 +
src/code/buttons/wasabeeButton.d.ts | 4 +
src/code/crosslinks.d.ts | 22 ++
src/code/db.d.ts | 58 ++++
src/code/dialogs/about.d.ts | 3 +
src/code/dialogs/agentDialog.d.ts | 9 +
src/code/dialogs/assignDialog.d.ts | 13 +
src/code/dialogs/authDialog.d.ts | 3 +
src/code/dialogs/autodraws.d.ts | 7 +
src/code/dialogs/autodraws/fanfield.d.ts | 11 +
src/code/dialogs/autodraws/flipflop.d.ts | 8 +
src/code/dialogs/autodraws/homogeneous.d.ts | 14 +
src/code/dialogs/autodraws/madrid.d.ts | 6 +
.../dialogs/autodraws/multimaxDialog.d.ts | 26 ++
src/code/dialogs/autodraws/onionfield.d.ts | 10 +
src/code/dialogs/autodraws/saveLinks.d.ts | 7 +
src/code/dialogs/autodraws/starburst.d.ts | 7 +
src/code/dialogs/autodraws/tools.d.ts | 43 +++
src/code/dialogs/blockersList.d.ts | 4 +
src/code/dialogs/checklist.d.ts | 16 +
src/code/dialogs/confirmDialog.d.ts | 13 +
src/code/dialogs/defensiveKeysDialog.d.ts | 4 +
src/code/dialogs/exportDialog.d.ts | 4 +
src/code/dialogs/importDialog.d.ts | 4 +
src/code/dialogs/keyListPortal.d.ts | 10 +
src/code/dialogs/keysList.d.ts | 4 +
src/code/dialogs/linkDialog.d.ts | 4 +
src/code/dialogs/linkListDialog.d.ts | 12 +
src/code/dialogs/manageTeamDialog.d.ts | 11 +
src/code/dialogs/markerAddDialog.d.ts | 4 +
src/code/dialogs/markerChangeDialog.d.ts | 11 +
src/code/dialogs/markerList.d.ts | 4 +
src/code/dialogs/mergeDialog.d.ts | 13 +
src/code/dialogs/newopDialog.d.ts | 4 +
src/code/dialogs/onlineAgentList.d.ts | 4 +
src/code/dialogs/opPerms.d.ts | 4 +
src/code/dialogs/opSettings.d.ts | 4 +
src/code/dialogs/opsDialog.d.ts | 4 +
src/code/dialogs/promptDialog.d.ts | 20 ++
src/code/dialogs/sendTargetDialog.d.ts | 12 +
src/code/dialogs/setCommentDialog.d.ts | 14 +
src/code/dialogs/settingsDialog.d.ts | 4 +
src/code/dialogs/skinDialog.d.ts | 3 +
src/code/dialogs/stateDialog.d.ts | 12 +
src/code/dialogs/teamListDialog.d.ts | 4 +
src/code/dialogs/teamMembershipList.d.ts | 10 +
src/code/dialogs/trawl.d.ts | 4 +
src/code/dialogs/wasabeeDlist.d.ts | 4 +
src/code/dialogs/zoneDialog.d.ts | 14 +
src/code/dialogs/zoneSetColor.d.ts | 11 +
src/code/firebaseSupport.d.ts | 2 +
src/code/index.d.ts | 13 +
src/code/init.d.ts | 1 +
src/code/leafletClasses.d.ts | 95 ++++++
src/code/mapDrawing.d.ts | 7 +
src/code/model/agent.d.ts | 29 ++
src/code/model/blocker.d.ts | 24 ++
src/code/model/evented.d.ts | 12 +
src/code/model/index.d.ts | 10 +
src/code/model/link.d.ts | 38 +++
src/code/model/marker.d.ts | 47 +++
src/code/model/me.d.ts | 48 +++
src/code/model/operation.d.ts | 202 +++++++++++++
src/code/model/portal.d.ts | 24 ++
src/code/model/team.d.ts | 15 +
src/code/model/team.js | 7 +-
src/code/model/zone.d.ts | 21 ++
src/code/polyfill.d.ts | 1 +
src/code/selectedOp.d.ts | 17 ++
src/code/server.d.ts | 68 +++++
src/code/skin.d.ts | 3 +
src/code/sortable.d.ts | 41 +++
src/code/static.d.ts | 3 +
src/code/toolbox.d.ts | 1 +
src/code/ui/agent.d.ts | 25 ++
src/code/ui/anchor.d.ts | 14 +
src/code/ui/link.d.ts | 22 ++
src/code/ui/marker.d.ts | 18 ++
src/code/ui/portal.d.ts | 40 +++
src/code/ui/zone.d.ts | 8 +
src/code/uiCommands.d.ts | 25 ++
src/code/wX.d.ts | 3 +
src/code/wd.d.ts | 15 +
src/types/iitc/LICENSE | 21 ++
src/types/iitc/README.md | 21 ++
src/types/iitc/core/android.d.ts | 57 ++++
src/types/iitc/core/artifact.d.ts | 44 +++
src/types/iitc/core/boot.d.ts | 46 +++
src/types/iitc/core/chat.d.ts | 138 +++++++++
src/types/iitc/core/constants.d.ts | 115 ++++++++
src/types/iitc/core/data_cache.d.ts | 30 ++
src/types/iitc/core/dialog.d.ts | 105 +++++++
src/types/iitc/core/entity_decode.d.ts | 25 ++
src/types/iitc/core/entity_info.d.ts | 9 +
.../iitc/core/extract_niantic_parameters.d.ts | 10 +
src/types/iitc/core/game_status.d.ts | 6 +
src/types/iitc/core/hooks.d.ts | 279 ++++++++++++++++++
src/types/iitc/core/idle.d.ts | 20 ++
src/types/iitc/core/iitctypes.d.ts | 148 ++++++++++
src/types/iitc/core/inteltypes.d.ts | 58 ++++
src/types/iitc/core/location.d.ts | 13 +
src/types/iitc/core/main.d.ts | 87 ++++++
src/types/iitc/core/map_data_calc_tools.d.ts | 59 ++++
src/types/iitc/core/map_data_debug.d.ts | 36 +++
src/types/iitc/core/map_data_render.d.ts | 66 +++++
src/types/iitc/core/map_data_request.d.ts | 159 ++++++++++
src/types/iitc/core/ornaments.d.ts | 36 +++
src/types/iitc/core/panes.d.ts | 8 +
src/types/iitc/core/player_names.d.ts | 8 +
src/types/iitc/core/portal_data.d.ts | 61 ++++
src/types/iitc/core/portal_detail.d.ts | 23 ++
.../iitc/core/portal_detail_display.d.ts | 26 ++
.../core/portal_detail_display_tools.d.ts | 57 ++++
src/types/iitc/core/portal_highlighter.d.ts | 29 ++
src/types/iitc/core/portal_info.d.ts | 93 ++++++
src/types/iitc/core/portal_marker.d.ts | 16 +
src/types/iitc/core/redeeming.d.ts | 25 ++
src/types/iitc/core/region_scoreboard.d.ts | 15 +
src/types/iitc/core/request_handling.d.ts | 37 +++
src/types/iitc/core/search.d.ts | 72 +++++
src/types/iitc/core/send_request.d.ts | 28 ++
src/types/iitc/core/smartphone.d.ts | 24 ++
src/types/iitc/core/utils_file.d.ts | 11 +
src/types/iitc/core/utils_misc.d.ts | 146 +++++++++
src/types/iitc/index.d.ts | 58 ++++
src/types/iitc/package.json | 26 ++
src/types/leafletExtentions/index.d.ts | 39 +++
tsconfig.json | 28 ++
136 files changed, 3857 insertions(+), 7 deletions(-)
create mode 100644 src/code/addButtons.d.ts
create mode 100644 src/code/auxiliar.d.ts
create mode 100644 src/code/buttons/linkButton.d.ts
create mode 100644 src/code/buttons/markerButton.d.ts
create mode 100644 src/code/buttons/opButton.d.ts
create mode 100644 src/code/buttons/quickdrawButton.d.ts
create mode 100644 src/code/buttons/syncButton.d.ts
create mode 100644 src/code/buttons/uploadButton.d.ts
create mode 100644 src/code/buttons/wasabeeButton.d.ts
create mode 100644 src/code/crosslinks.d.ts
create mode 100644 src/code/db.d.ts
create mode 100644 src/code/dialogs/about.d.ts
create mode 100644 src/code/dialogs/agentDialog.d.ts
create mode 100644 src/code/dialogs/assignDialog.d.ts
create mode 100644 src/code/dialogs/authDialog.d.ts
create mode 100644 src/code/dialogs/autodraws.d.ts
create mode 100644 src/code/dialogs/autodraws/fanfield.d.ts
create mode 100644 src/code/dialogs/autodraws/flipflop.d.ts
create mode 100644 src/code/dialogs/autodraws/homogeneous.d.ts
create mode 100644 src/code/dialogs/autodraws/madrid.d.ts
create mode 100644 src/code/dialogs/autodraws/multimaxDialog.d.ts
create mode 100644 src/code/dialogs/autodraws/onionfield.d.ts
create mode 100644 src/code/dialogs/autodraws/saveLinks.d.ts
create mode 100644 src/code/dialogs/autodraws/starburst.d.ts
create mode 100644 src/code/dialogs/autodraws/tools.d.ts
create mode 100644 src/code/dialogs/blockersList.d.ts
create mode 100644 src/code/dialogs/checklist.d.ts
create mode 100644 src/code/dialogs/confirmDialog.d.ts
create mode 100644 src/code/dialogs/defensiveKeysDialog.d.ts
create mode 100644 src/code/dialogs/exportDialog.d.ts
create mode 100644 src/code/dialogs/importDialog.d.ts
create mode 100644 src/code/dialogs/keyListPortal.d.ts
create mode 100644 src/code/dialogs/keysList.d.ts
create mode 100644 src/code/dialogs/linkDialog.d.ts
create mode 100644 src/code/dialogs/linkListDialog.d.ts
create mode 100644 src/code/dialogs/manageTeamDialog.d.ts
create mode 100644 src/code/dialogs/markerAddDialog.d.ts
create mode 100644 src/code/dialogs/markerChangeDialog.d.ts
create mode 100644 src/code/dialogs/markerList.d.ts
create mode 100644 src/code/dialogs/mergeDialog.d.ts
create mode 100644 src/code/dialogs/newopDialog.d.ts
create mode 100644 src/code/dialogs/onlineAgentList.d.ts
create mode 100644 src/code/dialogs/opPerms.d.ts
create mode 100644 src/code/dialogs/opSettings.d.ts
create mode 100644 src/code/dialogs/opsDialog.d.ts
create mode 100644 src/code/dialogs/promptDialog.d.ts
create mode 100644 src/code/dialogs/sendTargetDialog.d.ts
create mode 100644 src/code/dialogs/setCommentDialog.d.ts
create mode 100644 src/code/dialogs/settingsDialog.d.ts
create mode 100644 src/code/dialogs/skinDialog.d.ts
create mode 100644 src/code/dialogs/stateDialog.d.ts
create mode 100644 src/code/dialogs/teamListDialog.d.ts
create mode 100644 src/code/dialogs/teamMembershipList.d.ts
create mode 100644 src/code/dialogs/trawl.d.ts
create mode 100644 src/code/dialogs/wasabeeDlist.d.ts
create mode 100644 src/code/dialogs/zoneDialog.d.ts
create mode 100644 src/code/dialogs/zoneSetColor.d.ts
create mode 100644 src/code/firebaseSupport.d.ts
create mode 100644 src/code/index.d.ts
create mode 100644 src/code/init.d.ts
create mode 100644 src/code/leafletClasses.d.ts
create mode 100644 src/code/mapDrawing.d.ts
create mode 100644 src/code/model/agent.d.ts
create mode 100644 src/code/model/blocker.d.ts
create mode 100644 src/code/model/evented.d.ts
create mode 100644 src/code/model/index.d.ts
create mode 100644 src/code/model/link.d.ts
create mode 100644 src/code/model/marker.d.ts
create mode 100644 src/code/model/me.d.ts
create mode 100644 src/code/model/operation.d.ts
create mode 100644 src/code/model/portal.d.ts
create mode 100644 src/code/model/team.d.ts
create mode 100644 src/code/model/zone.d.ts
create mode 100644 src/code/polyfill.d.ts
create mode 100644 src/code/selectedOp.d.ts
create mode 100644 src/code/server.d.ts
create mode 100644 src/code/skin.d.ts
create mode 100644 src/code/sortable.d.ts
create mode 100644 src/code/static.d.ts
create mode 100644 src/code/toolbox.d.ts
create mode 100644 src/code/ui/agent.d.ts
create mode 100644 src/code/ui/anchor.d.ts
create mode 100644 src/code/ui/link.d.ts
create mode 100644 src/code/ui/marker.d.ts
create mode 100644 src/code/ui/portal.d.ts
create mode 100644 src/code/ui/zone.d.ts
create mode 100644 src/code/uiCommands.d.ts
create mode 100644 src/code/wX.d.ts
create mode 100644 src/code/wd.d.ts
create mode 100755 src/types/iitc/LICENSE
create mode 100755 src/types/iitc/README.md
create mode 100755 src/types/iitc/core/android.d.ts
create mode 100755 src/types/iitc/core/artifact.d.ts
create mode 100755 src/types/iitc/core/boot.d.ts
create mode 100755 src/types/iitc/core/chat.d.ts
create mode 100755 src/types/iitc/core/constants.d.ts
create mode 100755 src/types/iitc/core/data_cache.d.ts
create mode 100755 src/types/iitc/core/dialog.d.ts
create mode 100755 src/types/iitc/core/entity_decode.d.ts
create mode 100755 src/types/iitc/core/entity_info.d.ts
create mode 100755 src/types/iitc/core/extract_niantic_parameters.d.ts
create mode 100755 src/types/iitc/core/game_status.d.ts
create mode 100755 src/types/iitc/core/hooks.d.ts
create mode 100755 src/types/iitc/core/idle.d.ts
create mode 100755 src/types/iitc/core/iitctypes.d.ts
create mode 100755 src/types/iitc/core/inteltypes.d.ts
create mode 100755 src/types/iitc/core/location.d.ts
create mode 100755 src/types/iitc/core/main.d.ts
create mode 100755 src/types/iitc/core/map_data_calc_tools.d.ts
create mode 100755 src/types/iitc/core/map_data_debug.d.ts
create mode 100755 src/types/iitc/core/map_data_render.d.ts
create mode 100755 src/types/iitc/core/map_data_request.d.ts
create mode 100755 src/types/iitc/core/ornaments.d.ts
create mode 100755 src/types/iitc/core/panes.d.ts
create mode 100755 src/types/iitc/core/player_names.d.ts
create mode 100755 src/types/iitc/core/portal_data.d.ts
create mode 100755 src/types/iitc/core/portal_detail.d.ts
create mode 100755 src/types/iitc/core/portal_detail_display.d.ts
create mode 100755 src/types/iitc/core/portal_detail_display_tools.d.ts
create mode 100755 src/types/iitc/core/portal_highlighter.d.ts
create mode 100755 src/types/iitc/core/portal_info.d.ts
create mode 100755 src/types/iitc/core/portal_marker.d.ts
create mode 100755 src/types/iitc/core/redeeming.d.ts
create mode 100755 src/types/iitc/core/region_scoreboard.d.ts
create mode 100755 src/types/iitc/core/request_handling.d.ts
create mode 100755 src/types/iitc/core/search.d.ts
create mode 100755 src/types/iitc/core/send_request.d.ts
create mode 100755 src/types/iitc/core/smartphone.d.ts
create mode 100755 src/types/iitc/core/utils_file.d.ts
create mode 100755 src/types/iitc/core/utils_misc.d.ts
create mode 100755 src/types/iitc/index.d.ts
create mode 100755 src/types/iitc/package.json
create mode 100755 src/types/leafletExtentions/index.d.ts
create mode 100644 tsconfig.json
diff --git a/package.json b/package.json
index 02f67b3b8..e41f0dd41 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,10 @@
"main": "gulpfile.js",
"private": true,
"devDependencies": {
+ "@types/jquery": "^3.5.8",
+ "@types/jqueryui": "^1.12.16",
+ "@types/leaflet": "^1.7.5",
+ "@types/spectrum": "^1.8.2",
"css-loader": "^5.2.6",
"del": "^6.0.0",
"eslint": "^7.28.0",
@@ -21,6 +25,8 @@
"style-loader": "^2.0.0",
"through2": "^4.0.2",
"to-string-loader": "^1.1.6",
+ "tslib": "^2.3.1",
+ "typescript": "^4.4.4",
"url-loader": "^4.1.1",
"webpack": "^5.38.1",
"webpack-cli": "^4.8.0"
@@ -48,5 +54,6 @@
"geodesy": "^2.2.1",
"idb": "^6.1.2",
"sortablejs": "^1.12.0"
- }
-}
+ },
+ "typings": "src/code/index.d.ts"
+}
\ No newline at end of file
diff --git a/src/code/addButtons.d.ts b/src/code/addButtons.d.ts
new file mode 100644
index 000000000..e091ae441
--- /dev/null
+++ b/src/code/addButtons.d.ts
@@ -0,0 +1,2 @@
+export declare function addButtons(): void;
+export default addButtons;
diff --git a/src/code/auxiliar.d.ts b/src/code/auxiliar.d.ts
new file mode 100644
index 000000000..9054b1b9c
--- /dev/null
+++ b/src/code/auxiliar.d.ts
@@ -0,0 +1,3 @@
+export declare function generateId(len?: number): string;
+export declare function newColors(incoming: any): any;
+export declare function convertColorToHex(color: any, on_error?: string): any;
diff --git a/src/code/buttons/linkButton.d.ts b/src/code/buttons/linkButton.d.ts
new file mode 100644
index 000000000..d351c36ae
--- /dev/null
+++ b/src/code/buttons/linkButton.d.ts
@@ -0,0 +1,6 @@
+import { WButton } from "../leafletClasses";
+
+declare class LinkButton extends WButton {
+ needWritePermission: true;
+}
+export default LinkButton;
diff --git a/src/code/buttons/markerButton.d.ts b/src/code/buttons/markerButton.d.ts
new file mode 100644
index 000000000..f69f25a78
--- /dev/null
+++ b/src/code/buttons/markerButton.d.ts
@@ -0,0 +1,4 @@
+import { WButton } from "../leafletClasses";
+
+declare class MarkerButton extends WButton {}
+export default MarkerButton;
diff --git a/src/code/buttons/opButton.d.ts b/src/code/buttons/opButton.d.ts
new file mode 100644
index 000000000..8f8cc2859
--- /dev/null
+++ b/src/code/buttons/opButton.d.ts
@@ -0,0 +1,4 @@
+import { WButton } from "../leafletClasses";
+
+declare class OpButton extends WButton {}
+export default OpButton;
diff --git a/src/code/buttons/quickdrawButton.d.ts b/src/code/buttons/quickdrawButton.d.ts
new file mode 100644
index 000000000..afbd5f109
--- /dev/null
+++ b/src/code/buttons/quickdrawButton.d.ts
@@ -0,0 +1,6 @@
+import { WButton } from "../leafletClasses";
+
+declare class QuickdrawButton extends WButton {
+ needWritePermission: true;
+}
+export default QuickdrawButton;
diff --git a/src/code/buttons/syncButton.d.ts b/src/code/buttons/syncButton.d.ts
new file mode 100644
index 000000000..c18959463
--- /dev/null
+++ b/src/code/buttons/syncButton.d.ts
@@ -0,0 +1,4 @@
+import { WButton } from "../leafletClasses";
+
+declare class SyncButton extends WButton {}
+export default SyncButton;
diff --git a/src/code/buttons/uploadButton.d.ts b/src/code/buttons/uploadButton.d.ts
new file mode 100644
index 000000000..41205bbe2
--- /dev/null
+++ b/src/code/buttons/uploadButton.d.ts
@@ -0,0 +1,6 @@
+import { WButton } from "../leafletClasses";
+
+declare class UploadButton extends WButton {
+ needWritePermission: true;
+}
+export default UploadButton;
diff --git a/src/code/buttons/wasabeeButton.d.ts b/src/code/buttons/wasabeeButton.d.ts
new file mode 100644
index 000000000..31db031db
--- /dev/null
+++ b/src/code/buttons/wasabeeButton.d.ts
@@ -0,0 +1,4 @@
+import { WButton } from "../leafletClasses";
+
+declare class WasabeeButton extends WButton {}
+export default WasabeeButton;
diff --git a/src/code/crosslinks.d.ts b/src/code/crosslinks.d.ts
new file mode 100644
index 000000000..859fa8b9d
--- /dev/null
+++ b/src/code/crosslinks.d.ts
@@ -0,0 +1,22 @@
+import * as L from "leaflet";
+interface LLC extends L.LatLng {
+ _cartesian?: [number, number, number];
+}
+export declare function greatCircleArcIntersectByLatLngs(a0: LLC, a1: LLC, b0: LLC, b1: LLC): boolean;
+export declare function greatCircleArcIntersect(existing: any, drawn: any): boolean;
+export declare function checkAllLinks(): void;
+export declare function initCrossLinks(): void;
+export declare class GeodesicLine {
+ lat1: number;
+ lat2: number;
+ lng1: number;
+ lng2: number;
+ sinLat1CosLat2: number;
+ sinLat2CosLat1: number;
+ cosLat1CosLat2SinDLng: number;
+ constructor(start: L.LatLng, end: L.LatLng);
+ isMeridian(): boolean;
+ latAtLng(lng: any): number;
+ bearing(): number;
+}
+export {};
diff --git a/src/code/db.d.ts b/src/code/db.d.ts
new file mode 100644
index 000000000..a0c64d7ef
--- /dev/null
+++ b/src/code/db.d.ts
@@ -0,0 +1,58 @@
+import { DBSchema } from "idb";
+import type WasabeeAgent from "./model/agent";
+import type { IBlockerPortal } from "./model/blocker";
+import type WasabeeBlocker from "./model/blocker";
+import type { ILocalOp } from "./model/operation";
+import type WasabeeTeam from "./model/team";
+import type { WDKey } from "./wd";
+interface WasabeeDB extends DBSchema {
+ agents: {
+ key: GoogleID;
+ value: WasabeeAgent;
+ indexes: {
+ date: string;
+ fetched: string;
+ };
+ };
+ teams: {
+ key: TeamID;
+ value: WasabeeTeam;
+ indexes: {
+ fetched: string;
+ };
+ };
+ defensivekeys: {
+ key: [GoogleID, PortalID];
+ value: WDKey;
+ indexes: {
+ PortalID: string;
+ Count: number;
+ };
+ };
+ operations: {
+ key: OpID;
+ value: ILocalOp;
+ indexes: {
+ fetched: string;
+ server: string;
+ };
+ };
+ blockers: {
+ key: [OpID, PortalID, PortalID];
+ value: WasabeeBlocker;
+ indexes: {
+ opID: OpID;
+ from: PortalID;
+ to: PortalID;
+ };
+ };
+ blockers_portals: {
+ key: [OpID, PortalID];
+ value: IBlockerPortal;
+ indexes: {
+ opID: OpID;
+ };
+ };
+}
+declare const db: Promise>;
+export default db;
diff --git a/src/code/dialogs/about.d.ts b/src/code/dialogs/about.d.ts
new file mode 100644
index 000000000..30c9f0e60
--- /dev/null
+++ b/src/code/dialogs/about.d.ts
@@ -0,0 +1,3 @@
+import { WDialog } from "../leafletClasses";
+declare class AboutDialog extends WDialog {}
+export default AboutDialog;
diff --git a/src/code/dialogs/agentDialog.d.ts b/src/code/dialogs/agentDialog.d.ts
new file mode 100644
index 000000000..c6872b750
--- /dev/null
+++ b/src/code/dialogs/agentDialog.d.ts
@@ -0,0 +1,9 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+interface AgentDialogOptions extends WDialogOptions {
+ gid: string;
+}
+declare class AgentDialog extends WDialog {
+ options: AgentDialogOptions;
+ constructor(options: AgentDialogOptions);
+}
+export default AgentDialog;
diff --git a/src/code/dialogs/assignDialog.d.ts b/src/code/dialogs/assignDialog.d.ts
new file mode 100644
index 000000000..39240323c
--- /dev/null
+++ b/src/code/dialogs/assignDialog.d.ts
@@ -0,0 +1,13 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
+import WasabeePortal from "../model/portal";
+interface AssignDialogOptions extends WDialogOptions {
+ target: WasabeeLink | WasabeeMarker | WasabeePortal;
+}
+declare class AssignDialog extends WDialog {
+ needWritePermission: true;
+ options: AssignDialogOptions;
+ constructor(options: AssignDialogOptions);
+}
+export default AssignDialog;
diff --git a/src/code/dialogs/authDialog.d.ts b/src/code/dialogs/authDialog.d.ts
new file mode 100644
index 000000000..16459ee4a
--- /dev/null
+++ b/src/code/dialogs/authDialog.d.ts
@@ -0,0 +1,3 @@
+import { WDialog } from "../leafletClasses";
+declare class AuthDialog extends WDialog {}
+export default AuthDialog;
diff --git a/src/code/dialogs/autodraws.d.ts b/src/code/dialogs/autodraws.d.ts
new file mode 100644
index 000000000..2571cf38c
--- /dev/null
+++ b/src/code/dialogs/autodraws.d.ts
@@ -0,0 +1,7 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+
+declare class AutodrawsDialog extends WDialog {
+ needWritePermission: true;
+ constructor(options?: WDialogOptions);
+}
+export default AutodrawsDialog;
diff --git a/src/code/dialogs/autodraws/fanfield.d.ts b/src/code/dialogs/autodraws/fanfield.d.ts
new file mode 100644
index 000000000..e8602aaa2
--- /dev/null
+++ b/src/code/dialogs/autodraws/fanfield.d.ts
@@ -0,0 +1,11 @@
+import type WasabeePortal from "../../model/portal";
+import type { AutoDraw } from "./tools";
+
+export function angle(a: WasabeePortal, p: WasabeePortal): number;
+
+export default class FanfieldDialog extends AutoDraw {
+ _anchor: WasabeePortal;
+ _start: WasabeePortal;
+ _end: WasabeePortal;
+ constructor();
+}
diff --git a/src/code/dialogs/autodraws/flipflop.d.ts b/src/code/dialogs/autodraws/flipflop.d.ts
new file mode 100644
index 000000000..14908f7f2
--- /dev/null
+++ b/src/code/dialogs/autodraws/flipflop.d.ts
@@ -0,0 +1,8 @@
+import type WasabeePortal from "../../model/portal";
+import type { AutoDraw } from "./tools";
+
+export default class FlipFlopDialog extends AutoDraw {
+ _anchorOne: WasabeePortal;
+ _nbSbul: HTMLInputElement;
+ constructor();
+}
diff --git a/src/code/dialogs/autodraws/homogeneous.d.ts b/src/code/dialogs/autodraws/homogeneous.d.ts
new file mode 100644
index 000000000..b219dddb0
--- /dev/null
+++ b/src/code/dialogs/autodraws/homogeneous.d.ts
@@ -0,0 +1,14 @@
+import { AutoDraw } from "./tools";
+import WasabeePortal from "../../model/portal";
+
+export default class HomogeneousDialog extends AutoDraw {
+ _anchorOne: WasabeePortal;
+ _anchorTwo: WasabeePortal;
+ _anchorThree: WasabeePortal;
+ depthMenu: HTMLSelectElement;
+ orderMenu: HTMLSelectElement;
+ _fullSearch: boolean;
+ _urp: L.LatLng;
+
+ constructor();
+}
diff --git a/src/code/dialogs/autodraws/madrid.d.ts b/src/code/dialogs/autodraws/madrid.d.ts
new file mode 100644
index 000000000..0b59c490a
--- /dev/null
+++ b/src/code/dialogs/autodraws/madrid.d.ts
@@ -0,0 +1,6 @@
+import MultimaxDialog from "./multimaxDialog";
+
+export default class MadridDialog extends MultimaxDialog {
+ _balancedcheck: boolean;
+ constructor();
+}
diff --git a/src/code/dialogs/autodraws/multimaxDialog.d.ts b/src/code/dialogs/autodraws/multimaxDialog.d.ts
new file mode 100644
index 000000000..fa8064003
--- /dev/null
+++ b/src/code/dialogs/autodraws/multimaxDialog.d.ts
@@ -0,0 +1,26 @@
+import { AutoDraw } from "./tools";
+import WasabeePortal from "../../model/portal";
+
+export default class MultimaxDialog extends AutoDraw {
+ _anchorOne: WasabeePortal;
+ _anchorTwo: WasabeePortal;
+ _flcheck: boolean;
+ _orderFromEnd: boolean;
+ _urp: L.LatLng;
+
+ constructor();
+ MM(
+ pOne: WasabeePortal,
+ pTwo: WasabeePortal,
+ portals: WasabeePortal[],
+ order?: number,
+ base?: boolean,
+ commentPrefix?: string
+ ): any[];
+ fieldCoversPortal(a: any, b: any, c: any, p: any): boolean;
+ getSpine(
+ one: WasabeePortal,
+ two: WasabeePortal,
+ portals: WasabeePortal[]
+ ): WasabeePortal[];
+}
diff --git a/src/code/dialogs/autodraws/onionfield.d.ts b/src/code/dialogs/autodraws/onionfield.d.ts
new file mode 100644
index 000000000..22aeefdb8
--- /dev/null
+++ b/src/code/dialogs/autodraws/onionfield.d.ts
@@ -0,0 +1,10 @@
+import { AutoDraw } from "./tools";
+import WasabeePortal from "../../model/portal";
+
+export default class OnionfieldDialog extends AutoDraw {
+ _anchor: WasabeePortal;
+ _colors: string[];
+ _colorIterator: number;
+ _color: string;
+ constructor();
+}
diff --git a/src/code/dialogs/autodraws/saveLinks.d.ts b/src/code/dialogs/autodraws/saveLinks.d.ts
new file mode 100644
index 000000000..edc63c92e
--- /dev/null
+++ b/src/code/dialogs/autodraws/saveLinks.d.ts
@@ -0,0 +1,7 @@
+import { AutoDraw } from "./tools";
+import WasabeePortal from "../../model/portal";
+
+export default class SaveLinksDialog extends AutoDraw {
+ _anchor: WasabeePortal;
+ constructor();
+}
diff --git a/src/code/dialogs/autodraws/starburst.d.ts b/src/code/dialogs/autodraws/starburst.d.ts
new file mode 100644
index 000000000..e8db36576
--- /dev/null
+++ b/src/code/dialogs/autodraws/starburst.d.ts
@@ -0,0 +1,7 @@
+import { AutoDraw } from "./tools";
+import WasabeePortal from "../../model/portal";
+
+export default class StarburstDialog extends AutoDraw {
+ _anchor: WasabeePortal;
+ constructor();
+}
diff --git a/src/code/dialogs/autodraws/tools.d.ts b/src/code/dialogs/autodraws/tools.d.ts
new file mode 100644
index 000000000..55f257d89
--- /dev/null
+++ b/src/code/dialogs/autodraws/tools.d.ts
@@ -0,0 +1,43 @@
+import { WDialog, WDialogOptions } from "../../leafletClasses";
+import WasabeeOp from "../../model/operation";
+import WasabeePortal from "../../model/portal";
+
+export class AutoDraw extends WDialog {
+ needWritePermission: true;
+ _operation: WasabeeOp;
+ _portalSets: {
+ [name: string]: {
+ zone: ZoneID;
+ keys: boolean;
+ portals: WasabeePortal[];
+ display: HTMLSpanElement;
+ };
+ };
+ _mapRefreshHook: () => void;
+
+ constructor(options?: WDialogOptions);
+ initialize(options?: WDialogOptions): void;
+
+ _opChange(): void;
+ _initPortalSet(setKey: string, zone: ZoneID, keys: boolean): void;
+ _updatePortalSet(): void;
+ _addSetPortal(
+ text: string,
+ thisKey: string,
+ container: HTMLDivElement,
+ storageKey: string
+ ): void;
+ _addCheckbox(
+ text: string,
+ id: string,
+ thisKey: string,
+ container: HTMLDivElement,
+ defaultValue: boolean
+ ): void;
+ _addSelectSet(
+ text: string,
+ setKey: string,
+ container: HTMLDivElement,
+ defaultValue: string
+ ): void;
+}
diff --git a/src/code/dialogs/blockersList.d.ts b/src/code/dialogs/blockersList.d.ts
new file mode 100644
index 000000000..b766b0455
--- /dev/null
+++ b/src/code/dialogs/blockersList.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class BlockerList extends WDialog {}
+export default BlockerList;
diff --git a/src/code/dialogs/checklist.d.ts b/src/code/dialogs/checklist.d.ts
new file mode 100644
index 000000000..566dbb037
--- /dev/null
+++ b/src/code/dialogs/checklist.d.ts
@@ -0,0 +1,16 @@
+import { WDialog } from "../leafletClasses";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
+import Sortable, { SortableField } from "../sortable";
+import type WasabeeOp from "../model/operation";
+
+declare class OperationChecklistDialog extends WDialog {
+ getFields(operation: WasabeeOp): SortableField[];
+ getListDialogContent(
+ operation: WasabeeOp,
+ items: Array,
+ sortBy: number,
+ sortAsc: boolean
+ ): Sortable;
+}
+export default OperationChecklistDialog;
diff --git a/src/code/dialogs/confirmDialog.d.ts b/src/code/dialogs/confirmDialog.d.ts
new file mode 100644
index 000000000..19bf3be6f
--- /dev/null
+++ b/src/code/dialogs/confirmDialog.d.ts
@@ -0,0 +1,13 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+interface ConfirmDialogOptions extends WDialogOptions {
+ title: string;
+ label: string | HTMLElement;
+ type?: "agent" | "anchor" | "link" | "marker" | "zone" | "operation" | "team";
+ callback?: () => void;
+ cancelCallback?: () => void;
+}
+declare class ConfirmDialog extends WDialog {
+ options: ConfirmDialogOptions;
+ constructor(options: ConfirmDialogOptions);
+}
+export default ConfirmDialog;
diff --git a/src/code/dialogs/defensiveKeysDialog.d.ts b/src/code/dialogs/defensiveKeysDialog.d.ts
new file mode 100644
index 000000000..fefb41941
--- /dev/null
+++ b/src/code/dialogs/defensiveKeysDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class DefensiveKeysDialog extends WDialog {}
+export default DefensiveKeysDialog;
diff --git a/src/code/dialogs/exportDialog.d.ts b/src/code/dialogs/exportDialog.d.ts
new file mode 100644
index 000000000..dc569b067
--- /dev/null
+++ b/src/code/dialogs/exportDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class ExportDialog extends WDialog {}
+export default ExportDialog;
diff --git a/src/code/dialogs/importDialog.d.ts b/src/code/dialogs/importDialog.d.ts
new file mode 100644
index 000000000..c958e3577
--- /dev/null
+++ b/src/code/dialogs/importDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class ImportDialog extends WDialog {}
+export default ImportDialog;
diff --git a/src/code/dialogs/keyListPortal.d.ts b/src/code/dialogs/keyListPortal.d.ts
new file mode 100644
index 000000000..929aa196b
--- /dev/null
+++ b/src/code/dialogs/keyListPortal.d.ts
@@ -0,0 +1,10 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+
+interface KeyListPortalOptions extends WDialogOptions {
+ portalID: string;
+}
+declare class KeyListPortal extends WDialog {
+ options: KeyListPortalOptions;
+ constructor(options: KeyListPortalOptions);
+}
+export default KeyListPortal;
diff --git a/src/code/dialogs/keysList.d.ts b/src/code/dialogs/keysList.d.ts
new file mode 100644
index 000000000..7a2e890cb
--- /dev/null
+++ b/src/code/dialogs/keysList.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class KeysList extends WDialog {}
+export default KeysList;
diff --git a/src/code/dialogs/linkDialog.d.ts b/src/code/dialogs/linkDialog.d.ts
new file mode 100644
index 000000000..52647e178
--- /dev/null
+++ b/src/code/dialogs/linkDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+
+declare class LinkDialog extends WDialog {}
+export default LinkDialog;
diff --git a/src/code/dialogs/linkListDialog.d.ts b/src/code/dialogs/linkListDialog.d.ts
new file mode 100644
index 000000000..23f07fd47
--- /dev/null
+++ b/src/code/dialogs/linkListDialog.d.ts
@@ -0,0 +1,12 @@
+import OperationChecklistDialog from "./checklist";
+import type { WDialogOptions } from "../leafletClasses";
+import type WasabeePortal from "../model/portal";
+
+interface LinkListDialogOptions extends WDialogOptions {
+ portal: WasabeePortal;
+}
+declare class LinkListDialog extends OperationChecklistDialog {
+ options: LinkListDialogOptions;
+ constructor(options: LinkListDialogOptions);
+}
+export default LinkListDialog;
diff --git a/src/code/dialogs/manageTeamDialog.d.ts b/src/code/dialogs/manageTeamDialog.d.ts
new file mode 100644
index 000000000..71c9d1a55
--- /dev/null
+++ b/src/code/dialogs/manageTeamDialog.d.ts
@@ -0,0 +1,11 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import { MeTeam } from "../model/me";
+
+interface ManageTeamDialogOptions extends WDialogOptions {
+ team: MeTeam;
+}
+declare class ManageTeamDialog extends WDialog {
+ options: ManageTeamDialogOptions;
+ constructor(options: ManageTeamDialogOptions);
+}
+export default ManageTeamDialog;
diff --git a/src/code/dialogs/markerAddDialog.d.ts b/src/code/dialogs/markerAddDialog.d.ts
new file mode 100644
index 000000000..7d6b926d5
--- /dev/null
+++ b/src/code/dialogs/markerAddDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class MarkerAddDialog extends WDialog {}
+export default MarkerAddDialog;
diff --git a/src/code/dialogs/markerChangeDialog.d.ts b/src/code/dialogs/markerChangeDialog.d.ts
new file mode 100644
index 000000000..773648b1b
--- /dev/null
+++ b/src/code/dialogs/markerChangeDialog.d.ts
@@ -0,0 +1,11 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import WasabeeMarker from "../model/marker";
+
+interface MarkerChangeDialogOptions extends WDialogOptions {
+ marker: WasabeeMarker;
+}
+declare class MarkerChangeDialog extends WDialog {
+ options: MarkerChangeDialogOptions;
+ constructor(options: MarkerChangeDialogOptions);
+}
+export default MarkerChangeDialog;
diff --git a/src/code/dialogs/markerList.d.ts b/src/code/dialogs/markerList.d.ts
new file mode 100644
index 000000000..01f8fd582
--- /dev/null
+++ b/src/code/dialogs/markerList.d.ts
@@ -0,0 +1,4 @@
+import OperationChecklistDialog from "./checklist";
+
+declare class MarkerList extends OperationChecklistDialog {}
+export default MarkerList;
diff --git a/src/code/dialogs/mergeDialog.d.ts b/src/code/dialogs/mergeDialog.d.ts
new file mode 100644
index 000000000..1f786d89a
--- /dev/null
+++ b/src/code/dialogs/mergeDialog.d.ts
@@ -0,0 +1,13 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import WasabeeOp from "../model/operation";
+interface MergeDialogOptions extends WDialogOptions {
+ title?: string;
+ opOwn: WasabeeOp;
+ opRemote: WasabeeOp;
+ updateCallback?: (op: WasabeeOp) => void;
+}
+declare class MergeDialog extends WDialog {
+ options: MergeDialogOptions;
+ constructor(options: MergeDialogOptions);
+}
+export default MergeDialog;
diff --git a/src/code/dialogs/newopDialog.d.ts b/src/code/dialogs/newopDialog.d.ts
new file mode 100644
index 000000000..a60fd39b2
--- /dev/null
+++ b/src/code/dialogs/newopDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class NewopDialog extends WDialog {}
+export default NewopDialog;
diff --git a/src/code/dialogs/onlineAgentList.d.ts b/src/code/dialogs/onlineAgentList.d.ts
new file mode 100644
index 000000000..9dae4a871
--- /dev/null
+++ b/src/code/dialogs/onlineAgentList.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class OnlineAgentList extends WDialog {}
+export default OnlineAgentList;
diff --git a/src/code/dialogs/opPerms.d.ts b/src/code/dialogs/opPerms.d.ts
new file mode 100644
index 000000000..0afac860c
--- /dev/null
+++ b/src/code/dialogs/opPerms.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class OpPermList extends WDialog {}
+export default OpPermList;
diff --git a/src/code/dialogs/opSettings.d.ts b/src/code/dialogs/opSettings.d.ts
new file mode 100644
index 000000000..9c1678786
--- /dev/null
+++ b/src/code/dialogs/opSettings.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class OpSettingDialog extends WDialog {}
+export default OpSettingDialog;
diff --git a/src/code/dialogs/opsDialog.d.ts b/src/code/dialogs/opsDialog.d.ts
new file mode 100644
index 000000000..2bb768d25
--- /dev/null
+++ b/src/code/dialogs/opsDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class OpsDialog extends WDialog {}
+export default OpsDialog;
diff --git a/src/code/dialogs/promptDialog.d.ts b/src/code/dialogs/promptDialog.d.ts
new file mode 100644
index 000000000..9255f6d07
--- /dev/null
+++ b/src/code/dialogs/promptDialog.d.ts
@@ -0,0 +1,20 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+
+interface PromptDialogOptions extends WDialogOptions {
+ title: string;
+ label: string;
+ placeholder?: string;
+ current?: string;
+ suggestions?: {
+ text: string;
+ value: string;
+ }[];
+ callback?: () => void;
+ cancelCallback?: () => void;
+}
+declare class PromptDialog extends WDialog {
+ inputField: HTMLInputElement;
+ options: PromptDialogOptions;
+ constructor(options: PromptDialogOptions);
+}
+export default PromptDialog;
diff --git a/src/code/dialogs/sendTargetDialog.d.ts b/src/code/dialogs/sendTargetDialog.d.ts
new file mode 100644
index 000000000..2bddfa7ad
--- /dev/null
+++ b/src/code/dialogs/sendTargetDialog.d.ts
@@ -0,0 +1,12 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import WasabeeMarker from "../model/marker";
+import WasabeePortal from "../model/portal";
+
+interface SendTargetDialogOptions extends WDialogOptions {
+ target: WasabeeMarker | WasabeePortal;
+}
+declare class SendTargetDialog extends WDialog {
+ options: SendTargetDialogOptions;
+ constructor(options: SendTargetDialogOptions);
+}
+export default SendTargetDialog;
diff --git a/src/code/dialogs/setCommentDialog.d.ts b/src/code/dialogs/setCommentDialog.d.ts
new file mode 100644
index 000000000..066928b55
--- /dev/null
+++ b/src/code/dialogs/setCommentDialog.d.ts
@@ -0,0 +1,14 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import WasabeePortal from "../model/portal";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
+import type WasabeeOp from "../model/operation";
+interface SetCommentDialogOptions extends WDialogOptions {
+ target: WasabeeMarker | WasabeeLink | WasabeePortal;
+ operation: WasabeeOp;
+}
+export declare class SetCommentDialog extends WDialog {
+ options: SetCommentDialogOptions;
+ constructor(options: SetCommentDialogOptions);
+}
+export default SetCommentDialog;
diff --git a/src/code/dialogs/settingsDialog.d.ts b/src/code/dialogs/settingsDialog.d.ts
new file mode 100644
index 000000000..c52b9dd9a
--- /dev/null
+++ b/src/code/dialogs/settingsDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class SettingsDialog extends WDialog {}
+export default SettingsDialog;
diff --git a/src/code/dialogs/skinDialog.d.ts b/src/code/dialogs/skinDialog.d.ts
new file mode 100644
index 000000000..02bdeb001
--- /dev/null
+++ b/src/code/dialogs/skinDialog.d.ts
@@ -0,0 +1,3 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+declare class SkinDialog extends WDialog {}
+export default SkinDialog;
diff --git a/src/code/dialogs/stateDialog.d.ts b/src/code/dialogs/stateDialog.d.ts
new file mode 100644
index 000000000..4310debff
--- /dev/null
+++ b/src/code/dialogs/stateDialog.d.ts
@@ -0,0 +1,12 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import WasabeeLink from "../model/link";
+import WasabeeMarker from "../model/marker";
+interface StateDialogOptions extends WDialogOptions {
+ target: WasabeeMarker | WasabeeLink;
+ opID: string;
+}
+declare class StateDialog extends WDialog {
+ options: StateDialogOptions;
+ constructor(options: StateDialogOptions);
+}
+export default StateDialog;
diff --git a/src/code/dialogs/teamListDialog.d.ts b/src/code/dialogs/teamListDialog.d.ts
new file mode 100644
index 000000000..883317201
--- /dev/null
+++ b/src/code/dialogs/teamListDialog.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class TeamListDialog extends WDialog {}
+export default TeamListDialog;
diff --git a/src/code/dialogs/teamMembershipList.d.ts b/src/code/dialogs/teamMembershipList.d.ts
new file mode 100644
index 000000000..ce212b909
--- /dev/null
+++ b/src/code/dialogs/teamMembershipList.d.ts
@@ -0,0 +1,10 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+
+interface TeamMembershipListOptions extends WDialogOptions {
+ teamID: string;
+}
+declare class TeamMembershipList extends WDialog {
+ options: TeamMembershipListOptions;
+ constructor(options: TeamMembershipListOptions);
+}
+export default TeamMembershipList;
diff --git a/src/code/dialogs/trawl.d.ts b/src/code/dialogs/trawl.d.ts
new file mode 100644
index 000000000..617a8332c
--- /dev/null
+++ b/src/code/dialogs/trawl.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class TrawlDialog extends WDialog {}
+export default TrawlDialog;
diff --git a/src/code/dialogs/wasabeeDlist.d.ts b/src/code/dialogs/wasabeeDlist.d.ts
new file mode 100644
index 000000000..8b6520f10
--- /dev/null
+++ b/src/code/dialogs/wasabeeDlist.d.ts
@@ -0,0 +1,4 @@
+import { WDialog } from "../leafletClasses";
+
+declare class WasabeeDList extends WDialog {}
+export default WasabeeDList;
diff --git a/src/code/dialogs/zoneDialog.d.ts b/src/code/dialogs/zoneDialog.d.ts
new file mode 100644
index 000000000..d625cd983
--- /dev/null
+++ b/src/code/dialogs/zoneDialog.d.ts
@@ -0,0 +1,14 @@
+import { WDialog } from "../leafletClasses";
+
+declare class ZoneDialog extends WDialog {
+ ZonedrawHandler: ZonedrawHandler;
+}
+export default ZoneDialog;
+
+interface ZonedrawHandlerOptions {
+ parent: ZoneDialog;
+}
+declare class ZonedrawHandler extends L.Handler {
+ zoneID: number;
+ constructor(options: ZonedrawHandlerOptions);
+}
diff --git a/src/code/dialogs/zoneSetColor.d.ts b/src/code/dialogs/zoneSetColor.d.ts
new file mode 100644
index 000000000..efaeb6905
--- /dev/null
+++ b/src/code/dialogs/zoneSetColor.d.ts
@@ -0,0 +1,11 @@
+import { WDialog, WDialogOptions } from "../leafletClasses";
+import type WasabeeZone from "../model/zone";
+
+interface ZoneSetColorDialogOptions extends WDialogOptions {
+ zone: WasabeeZone;
+}
+declare class ZoneSetColorDialog extends WDialog {
+ options: ZoneSetColorDialogOptions;
+ constructor(options: ZoneSetColorDialogOptions);
+}
+export default ZoneSetColorDialog;
diff --git a/src/code/firebaseSupport.d.ts b/src/code/firebaseSupport.d.ts
new file mode 100644
index 000000000..466c320fb
--- /dev/null
+++ b/src/code/firebaseSupport.d.ts
@@ -0,0 +1,2 @@
+export declare function initFirebase(): void;
+export declare function postToFirebase(message: any): void;
diff --git a/src/code/index.d.ts b/src/code/index.d.ts
new file mode 100644
index 000000000..d0439ddfc
--- /dev/null
+++ b/src/code/index.d.ts
@@ -0,0 +1,13 @@
+///
+
+export {};
+
+declare global {
+ type OpID = string;
+ type PortalID = string;
+ type TeamID = string;
+ type LinkID = string;
+ type MarkerID = string;
+ type GoogleID = string;
+ type ZoneID = number;
+}
diff --git a/src/code/init.d.ts b/src/code/init.d.ts
new file mode 100644
index 000000000..cb0ff5c3b
--- /dev/null
+++ b/src/code/init.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/src/code/leafletClasses.d.ts b/src/code/leafletClasses.d.ts
new file mode 100644
index 000000000..0442203eb
--- /dev/null
+++ b/src/code/leafletClasses.d.ts
@@ -0,0 +1,95 @@
+///
+///
+
+export declare class WTooltip extends L.Class {
+ _pane: HTMLElement;
+ _container: HTMLDivElement;
+ constructor();
+ dispose(): void;
+ updateContent(labelText: any): this;
+ updatePosition(latlng: L.LatLngExpression): this;
+ showAsError(): this;
+ removeError(): this;
+}
+declare type WPaneOptions = {
+ paneId: string;
+ paneName: string;
+ default?: () => WDialog;
+};
+export declare class WPane extends L.Handler {
+ options: WPaneOptions;
+ _dialog: WDialog;
+ _container: HTMLDivElement;
+ constructor(options: WPaneOptions);
+ addHooks(): void;
+ removeHooks(): void;
+}
+export interface WDialogOptions {
+ [propName: string]: unknown;
+}
+export declare class WDialog extends L.Handler {
+ needWritePermission: boolean; // todo: set static
+ usePane: boolean;
+ paneId: string;
+ options: WDialogOptions;
+ _smallScreen: boolean;
+ _dialog: JQuery | null;
+ _container: HTMLDivElement;
+ _header: HTMLDivElement;
+ _content: HTMLDivElement;
+ _buttons: HTMLDivElement;
+ constructor(options?: WDialogOptions);
+ initialize(options?: WDialogOptions);
+ addHooks(): void;
+ removeHooks(): void;
+ onOpChange(): void;
+ enable(): any;
+ update(): void;
+ createDialog(options: DialogOptions): void;
+ setTitle(title: string): void;
+ setContent(content: HTMLElement | string): void;
+ closeDialog(): void;
+ _isMobile(): boolean;
+}
+export interface ButtonsControlOptions extends L.ControlOptions {
+ buttons: Map;
+ container: HTMLElement;
+}
+export declare class ButtonsControl extends L.Control {
+ options: ButtonsControlOptions;
+ constructor(options: ButtonsControlOptions);
+ onAdd(): HTMLDivElement;
+ onRemove(): void;
+ update(): void;
+ disableAllExcept(name: any): void;
+}
+export declare type ButtonOptions = {
+ text?: string;
+ html?: HTMLElement;
+ title?: string;
+ container?: HTMLElement;
+ callback: () => void;
+ context: unknown;
+ buttonImage?: string;
+ className?: string;
+ img?: string;
+};
+export declare class WButton extends L.Class {
+ title: string;
+ type: string;
+ needWritePermission: boolean;
+ _enabled: boolean;
+ actionsContainer: HTMLElement;
+ control: ButtonsControl;
+ button: HTMLAnchorElement;
+ _container: HTMLElement;
+ constructor(container: HTMLElement);
+ update(): void;
+ _toggleActions(): void;
+ setControl(control: any): void;
+ disable(): void;
+ enable(): void;
+ _createButton(options: ButtonOptions): HTMLAnchorElement;
+ _createSubActions(buttons: ButtonOptions[]): HTMLUListElement;
+}
+export {};
diff --git a/src/code/mapDrawing.d.ts b/src/code/mapDrawing.d.ts
new file mode 100644
index 000000000..01953e7f1
--- /dev/null
+++ b/src/code/mapDrawing.d.ts
@@ -0,0 +1,7 @@
+import * as L from "leaflet";
+export declare function drawMap(): void;
+export declare function drawBackgroundOps(opIDs?: string[]): Promise;
+export declare function drawBackgroundOp(operation: any, layerGroup?: L.LayerGroup, style?: L.PathOptions): void;
+export declare function drawAgents(): Promise;
+export declare function drawSingleTeam(teamID: string, layerMap?: Map, alreadyDone?: string[]): Promise;
+export declare function drawSingleAgent(gid: any): Promise;
diff --git a/src/code/model/agent.d.ts b/src/code/model/agent.d.ts
new file mode 100644
index 000000000..40b3b92d8
--- /dev/null
+++ b/src/code/model/agent.d.ts
@@ -0,0 +1,29 @@
+import * as L from "leaflet";
+export default class WasabeeAgent {
+ id: string;
+ name: string;
+ vname: string;
+ rocksname: string;
+ intelname: string;
+ intelfaction: string;
+ level: number;
+ enlid: string;
+ pic: string;
+ Vverified: boolean;
+ blacklisted: boolean;
+ rocks: boolean;
+ lat: number;
+ lng: number;
+ date: string;
+ ShareWD?: boolean;
+ LoadWD?: boolean;
+ squad?: string;
+ state?: boolean;
+ fetched: number;
+ cached?: boolean;
+ constructor(obj: any);
+ getTeamName(teamID?: number): Promise;
+ _updateCache(): Promise;
+ get latLng(): L.LatLng;
+ static get(gid: string, maxAgeSeconds?: number): Promise;
+}
diff --git a/src/code/model/blocker.d.ts b/src/code/model/blocker.d.ts
new file mode 100644
index 000000000..ec8ade609
--- /dev/null
+++ b/src/code/model/blocker.d.ts
@@ -0,0 +1,24 @@
+import type WasabeeOp from "./operation";
+import type WasabeePortal from "./portal";
+export interface IBlockerPortal {
+ opID: OpID;
+ id: PortalID;
+ name: string;
+ lat: string;
+ lng: string;
+}
+export default class WasabeeBlocker {
+ opID: string;
+ from: string;
+ to: string;
+ fromPortal?: IBlockerPortal;
+ toPortal?: IBlockerPortal;
+ constructor(obj: any);
+ static addPortal(op: WasabeeOp, portal: WasabeePortal): Promise;
+ static updatePortal(op: WasabeeOp, portal: WasabeePortal): Promise;
+ static removeBlocker(op: WasabeeOp, portalId: string): Promise;
+ static removeBlockers(opID: string): Promise;
+ static addBlocker(op: WasabeeOp, fromPortal: WasabeePortal, toPortal: WasabeePortal): Promise;
+ static getPortals(op: WasabeeOp): Promise;
+ static getAll(op: WasabeeOp): Promise;
+}
diff --git a/src/code/model/evented.d.ts b/src/code/model/evented.d.ts
new file mode 100644
index 000000000..889d79964
--- /dev/null
+++ b/src/code/model/evented.d.ts
@@ -0,0 +1,12 @@
+export default class Evented {
+ _events: {
+ [propName: string]: Array<{
+ fct: (data: unknown) => void;
+ context: unknown;
+ }>;
+ };
+ constructor();
+ on(event: string, func: (data: unknown) => void, context?: unknown): this;
+ off(event: string, func: (data: unknown) => void, context?: unknown): this;
+ fire(event: string, data?: unknown): this;
+}
diff --git a/src/code/model/index.d.ts b/src/code/model/index.d.ts
new file mode 100644
index 000000000..a1fa7fb2a
--- /dev/null
+++ b/src/code/model/index.d.ts
@@ -0,0 +1,10 @@
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
diff --git a/src/code/model/link.d.ts b/src/code/model/link.d.ts
new file mode 100644
index 000000000..430485bf2
--- /dev/null
+++ b/src/code/model/link.d.ts
@@ -0,0 +1,38 @@
+import type WasabeeOp from "./operation";
+export default class WasabeeLink {
+ ID: string;
+ fromPortalId: string;
+ toPortalId: string;
+ description?: string;
+ assignedTo?: string;
+ throwOrderPos: number;
+ color: string;
+ completed: boolean;
+ zone: number;
+ constructor(obj: any);
+ assign(gid: any): void;
+ toJSON(): {
+ ID: string;
+ fromPortalId: string;
+ toPortalId: string;
+ description: string;
+ assignedTo: string;
+ throwOrderPos: number;
+ color: string;
+ completed: boolean;
+ zone: number;
+ };
+ get comment(): string;
+ set comment(c: string);
+ get opOrder(): number;
+ set opOrder(o: number);
+ setOrder(o: number | string): void;
+ get state(): "pending" | "completed" | "assigned";
+ set state(s: string);
+ get portalId(): string;
+ getLatLngs(operation: WasabeeOp): any[];
+ get latLngs(): any[];
+ setColor(color: string, operation: WasabeeOp): void;
+ getColor(operation: WasabeeOp): string;
+ length(operation: WasabeeOp): number;
+}
diff --git a/src/code/model/marker.d.ts b/src/code/model/marker.d.ts
new file mode 100644
index 000000000..f688b712a
--- /dev/null
+++ b/src/code/model/marker.d.ts
@@ -0,0 +1,47 @@
+export default class WasabeeMarker {
+ ID: string;
+ portalId: string;
+ type: string;
+ comment?: string;
+ order: number;
+ completedID: boolean;
+ assignedTo: string;
+ zone: number;
+ _state: "pending" | "assigned" | "acknowledged" | "completed";
+ static get markerTypes(): Set;
+ static get constants(): {
+ MARKER_TYPE_CAPTURE: string;
+ MARKER_TYPE_DECAY: string;
+ MARKER_TYPE_EXCLUDE: string;
+ MARKER_TYPE_DESTROY: string;
+ MARKER_TYPE_FARM: string;
+ MARKER_TYPE_GOTO: string;
+ MARKER_TYPE_KEY: string;
+ MARKER_TYPE_LINK: string;
+ MARKER_TYPE_MEETAGENT: string;
+ MARKER_TYPE_OTHER: string;
+ MARKER_TYPE_RECHARGE: string;
+ MARKER_TYPE_UPGRADE: string;
+ MARKER_TYPE_VIRUS: string;
+ };
+ constructor(obj: any);
+ toJSON(): {
+ ID: string;
+ portalId: string;
+ type: string;
+ comment: string;
+ state: "pending" | "completed" | "assigned" | "acknowledged";
+ completedID: boolean;
+ assignedTo: string;
+ order: number;
+ zone: number;
+ };
+ get opOrder(): number;
+ set opOrder(o: number);
+ setOrder(o: number | string): void;
+ assign(gid: any): void;
+ set state(state: "pending" | "completed" | "assigned" | "acknowledged");
+ get state(): "pending" | "completed" | "assigned" | "acknowledged";
+ isDestructMarker(): boolean;
+ static isDestructMarkerType(type: any): boolean;
+}
diff --git a/src/code/model/me.d.ts b/src/code/model/me.d.ts
new file mode 100644
index 000000000..443c8c926
--- /dev/null
+++ b/src/code/model/me.d.ts
@@ -0,0 +1,48 @@
+export interface MeTeam {
+ ID: string;
+ Name: string;
+ RocksComm: string;
+ RocksKey: string;
+ JoinLinkToken: string;
+ ShareWD: "On" | "Off";
+ LoadWD: "On" | "Off";
+ State: "On" | "Off";
+ Owner: string;
+ VTeam: string;
+ VTeamRole: string;
+}
+interface MeOp {
+ ID: string;
+}
+export default class WasabeeMe {
+ GoogleID: string;
+ name: string;
+ vname: string;
+ rocksname: string;
+ intelname: string;
+ level: number;
+ Teams: Array;
+ Ops: Array;
+ fetched: number;
+ Vverified: boolean;
+ blacklisted: boolean;
+ enlid: string;
+ pic: string;
+ intelfaction: string;
+ querytoken: string;
+ _teamMap: Map;
+ constructor(data: any);
+ static maxCacheAge(): number;
+ toJSON(): this;
+ store(): void;
+ remove(): void;
+ static localGet(): WasabeeMe;
+ static isLoggedIn(): boolean;
+ static cacheGet(): WasabeeMe;
+ static waitGet(force?: boolean): Promise;
+ static purge(): Promise;
+ teamJoined(teamID: any): boolean;
+ teamEnabled(teamID: any): boolean;
+ makeTeamMap(): void;
+}
+export {};
diff --git a/src/code/model/operation.d.ts b/src/code/model/operation.d.ts
new file mode 100644
index 000000000..ddde21a5b
--- /dev/null
+++ b/src/code/model/operation.d.ts
@@ -0,0 +1,202 @@
+import * as L from "leaflet";
+import WasabeeLink from "./link";
+import WasabeePortal from "./portal";
+import WasabeeMarker from "./marker";
+import WasabeeZone from "./zone";
+import Evented from "./evented";
+export declare type KeyOnHand = {
+ portalId: PortalID;
+ gid: GoogleID;
+ capsule: string;
+ onhand: number;
+};
+export declare type OpPermItem = {
+ role: "read" | "write" | "assignonly";
+ teamid: string;
+ zone: number;
+};
+interface IOperation {
+ ID: OpID;
+ name: string;
+ creator: string | GoogleID;
+ opportals: WasabeePortal[];
+ anchors: string[];
+ links: WasabeeLink[];
+ markers: WasabeeMarker[];
+ color: string;
+ comment: string;
+ zones: WasabeeZone[];
+ referencetime: string;
+}
+export interface IServerOp extends IOperation {
+ creator: GoogleID;
+ teamlist: OpPermItem[];
+ keysonhand: KeyOnHand[];
+ lasteditid: string;
+ fetched: string;
+ modified: string;
+}
+export interface ILocalOp extends IOperation {
+ teamlist: OpPermItem[];
+ keysonhand: KeyOnHand[];
+ lasteditid: string;
+ fetched: string;
+ fetchedOp: string;
+ server: string;
+ localchanged: boolean;
+ remoteChanged: boolean;
+ background: boolean;
+ stored: number;
+}
+export default class WasabeeOp extends Evented implements IOperation {
+ ID: string;
+ name: string;
+ creator: string;
+ anchors: string[];
+ links: WasabeeLink[];
+ markers: WasabeeMarker[];
+ color: string;
+ comment: string;
+ zones: WasabeeZone[];
+ referencetime: string;
+ teamlist: OpPermItem[];
+ keysonhand: KeyOnHand[];
+ lasteditid: string;
+ fetched: string;
+ fetchedOp: string;
+ localchanged: boolean;
+ remoteChanged: boolean;
+ server: string;
+ blockers: WasabeeLink[];
+ background: boolean;
+ stored: number;
+ _idToOpportals: Map;
+ _coordsToOpportals: Map;
+ _dirtyCoordsTable: boolean;
+ _batchmode: boolean;
+ constructor(obj: any);
+ static load(opID: any): Promise;
+ static delete(opID: any): Promise;
+ static migrate(opID: any): Promise;
+ store(): Promise;
+ toJSON(): IOperation;
+ toExport(): string;
+ get opportals(): WasabeePortal[];
+ buildCoordsLookupTable(): void;
+ getColor(): string;
+ containsPortal(portal: any): boolean;
+ getPortalByLatLng(lat: any, lng: any): WasabeePortal;
+ containsLinkFromTo(fromPortalId: any, toPortalId: any): boolean;
+ containsLink(link: any): boolean;
+ containsMarker(portal: any, markerType: any): boolean;
+ containsMarkerByID(portalID: any, markerType: any): boolean;
+ getPortalMarkers(portal: any): Map;
+ getLinkByPortalIDs(portalId1: any, portalId2: any): WasabeeLink;
+ getLink(portal1: any, portal2: any): WasabeeLink;
+ getLinkListFromPortal(portal: any): WasabeeLink[];
+ getPortal(portalID: any): WasabeePortal;
+ getMarker(markerID: any): WasabeeMarker;
+ removeAnchor(portalId: any): void;
+ removeMarker(marker: any): void;
+ setMarkerComment(marker: any, comment: any): void;
+ setMarkerState(markerID: any, state: any): void;
+ setLinkComment(link: any, comment: any): void;
+ setLinkState(linkID: any, state: any): void;
+ setLinkColor(linkID: any, color: any): void;
+ setLinkOrder(linkID: any, order: any): void;
+ setMarkerOrder(markerID: any, order: any): void;
+ setPortalComment(portal: any, comment: any): void;
+ setPortalHardness(portal: any, hardness: any): void;
+ removeLink(startPortal: any, endPortal: any): void;
+ reverseLink(startPortalID: any, endPortalID: any): void;
+ cleanAll(): void;
+ cleanAnchorList(): void;
+ cleanPortalList(): void;
+ addPortal(portal: any): void;
+ _addPortal(portal: any): boolean;
+ updatePortal(portal: any): boolean;
+ _updatePortal(portal: any): boolean;
+ addLink(fromPortal: WasabeePortal, toPortal: WasabeePortal, options?: {
+ description?: string;
+ order?: number;
+ color?: string;
+ replace?: boolean;
+ }): WasabeeLink;
+ containsAnchor(portalId: string): boolean;
+ addAnchor(portal: WasabeePortal): void;
+ get fakedPortals(): WasabeePortal[];
+ _swapPortal(originalPortal: WasabeePortal, newPortal: WasabeePortal): void;
+ swapPortal(originalPortal: WasabeePortal, newPortal: WasabeePortal): void;
+ addMarker(markerType: string, portal: WasabeePortal, options: any): boolean;
+ assignMarker(id: any, gid: any): void;
+ assignLink(id: any, gid: any): void;
+ clearAllItems(): void;
+ clearAllLinks(): void;
+ clearAllMarkers(): void;
+ update(updateLocalchanged?: boolean): void;
+ updateBlockers(): void;
+ startBatchMode(): void;
+ endBatchMode(): void;
+ convertLinksToObjs(links: any): any[];
+ convertMarkersToObjs(markers: any): any[];
+ convertPortalsToObjs(portals: any): any[];
+ convertZonesToObjs(zones: any): any[];
+ get mbr(): L.LatLngBounds;
+ canWriteServer(): boolean;
+ canWrite(): boolean;
+ getPermission(): "write" | "read" | "assignonly";
+ isOnCurrentServer(): boolean;
+ isServerOp(): boolean;
+ isOwnedOp(): boolean;
+ get nextOrder(): number;
+ keyOnHand(portalId: any, gid: any, onhand: any, capsule: any): void;
+ KeysOnHandForPortal(portalId: any): number;
+ KeysRequiredForPortal(portalId: any): number;
+ zoneName(zoneID: any): any;
+ setZone(thing: any, zoneID: any): void;
+ removeZone(zoneID: any): void;
+ removeZonePoints(zoneID: any): void;
+ renameZone(zoneID: any, name: any): void;
+ addZone(): number;
+ addZonePoint(zoneID: number, latlng: L.LatLng): void;
+ changes(origin?: WasabeeOp): {
+ addition: any[];
+ edition: any[];
+ deletion: any[];
+ name: any;
+ color: any;
+ comment: any;
+ };
+ checkChanges(): boolean;
+ mergeZones(op: any): number;
+ applyChanges(changes: any, op: any): {
+ compatibility: {
+ ok: boolean;
+ rewrite: {
+ link: number;
+ marker: number;
+ };
+ };
+ addition: {
+ link: number;
+ marker: number;
+ zone: number;
+ ignored: number;
+ };
+ deletion: {
+ link: number;
+ marker: number;
+ };
+ edition: {
+ portal: number;
+ link: number;
+ marker: number;
+ assignment: number;
+ duplicate: number;
+ singlePortalLink: number;
+ removed: number;
+ };
+ };
+ determineZone(latlng: any): number;
+}
+export { };
diff --git a/src/code/model/portal.d.ts b/src/code/model/portal.d.ts
new file mode 100644
index 000000000..349ecff92
--- /dev/null
+++ b/src/code/model/portal.d.ts
@@ -0,0 +1,24 @@
+import * as L from "leaflet";
+export default class WasabeePortal {
+ id: string;
+ name: string;
+ lat: string;
+ lng: string;
+ comment: string;
+ hardness: string;
+ _latLng: L.LatLng;
+ constructor(obj: any);
+ toJSON(): {
+ id: string;
+ name: string;
+ lat: string;
+ lng: string;
+ comment: string;
+ hardness: string;
+ };
+ get latLng(): L.LatLng;
+ static fake(lat: string | number, lng: string | number, id?: string, name?: string): WasabeePortal;
+ get faked(): boolean;
+ get loading(): boolean;
+ get pureFaked(): boolean;
+}
diff --git a/src/code/model/team.d.ts b/src/code/model/team.d.ts
new file mode 100644
index 000000000..e7c6fcd33
--- /dev/null
+++ b/src/code/model/team.d.ts
@@ -0,0 +1,15 @@
+import WasabeeAgent from "./agent";
+export default class WasabeeTeam {
+ fetched: number;
+ id: string;
+ name: string;
+ rc: string;
+ rk: string;
+ jlt: string;
+ agents: Array;
+ _a: Array;
+ constructor(data: any);
+ getAgents(): WasabeeAgent[];
+ _updateCache(): Promise;
+ static get(teamID: any, maxAgeSeconds?: number): Promise;
+}
diff --git a/src/code/model/team.js b/src/code/model/team.js
index b8c1b4e2b..7a0c7747b 100644
--- a/src/code/model/team.js
+++ b/src/code/model/team.js
@@ -52,11 +52,8 @@ export default class WasabeeTeam {
static async get(teamID, maxAgeSeconds = 60) {
const cached = await (await db).get("teams", teamID);
if (cached) {
- const t = new WasabeeTeam(cached);
- if (t.fetched > Date.now() - 1000 * maxAgeSeconds) {
- t.cached = true;
- return t;
- }
+ if (cached.fetched + maxAgeSeconds * 1000 > Date.now())
+ return new WasabeeTeam(cached);
}
if (!WasabeeMe.isLoggedIn()) return null;
diff --git a/src/code/model/zone.d.ts b/src/code/model/zone.d.ts
new file mode 100644
index 000000000..911650855
--- /dev/null
+++ b/src/code/model/zone.d.ts
@@ -0,0 +1,21 @@
+export default class WasabeeZone {
+ id: number;
+ name: string;
+ color: string;
+ points: Array;
+ constructor(obj: any);
+ toJSON(): {
+ id: number;
+ name: string;
+ color: string;
+ points: zonePoint[];
+ };
+ contains(latlng: any): boolean;
+}
+declare class zonePoint {
+ position: number;
+ lat: number;
+ lng: number;
+ constructor(obj: any);
+}
+export {};
diff --git a/src/code/polyfill.d.ts b/src/code/polyfill.d.ts
new file mode 100644
index 000000000..5fcaa65e1
--- /dev/null
+++ b/src/code/polyfill.d.ts
@@ -0,0 +1 @@
+export default function polyfill(): void;
diff --git a/src/code/selectedOp.d.ts b/src/code/selectedOp.d.ts
new file mode 100644
index 000000000..b4fb3d92a
--- /dev/null
+++ b/src/code/selectedOp.d.ts
@@ -0,0 +1,17 @@
+import WasabeeOp from "./model/operation";
+export declare function getSelectedOperation(): WasabeeOp;
+export declare function initSelectedOperation(): Promise;
+export declare function changeOpIfNeeded(): Promise;
+export declare function loadNewDefaultOp(): Promise;
+export declare function makeSelectedOperation(opID: any): Promise;
+export declare function setupLocalStorage(): Promise;
+export declare function removeOperation(opID: any): Promise;
+export declare function showOperation(opID: any): void;
+export declare function hideOperation(opID: any): void;
+export declare function resetHiddenOps(): void;
+export declare function resetOps(): Promise;
+export declare function hiddenOpsList(): any;
+export declare function setOpBackground(opID: any, background: any): Promise;
+export declare function opsList(hidden?: boolean): Promise;
+export declare function duplicateOperation(opID: any): Promise;
+export declare function removeNonOwnedOps(): Promise;
diff --git a/src/code/server.d.ts b/src/code/server.d.ts
new file mode 100644
index 000000000..ad7e1ea57
--- /dev/null
+++ b/src/code/server.d.ts
@@ -0,0 +1,68 @@
+import WasabeeOp from "./model/operation";
+import WasabeeMarker from "./model/marker";
+import type WasabeeLink from "./model/link";
+import type WasabeePortal from "./model/portal";
+import type { WDKey } from "./wd";
+interface IServerUpdate {
+ updateID?: string;
+}
+export default function (): any;
+export declare function uploadOpPromise(): Promise;
+export declare function updateOpPromise(operation: WasabeeOp): Promise;
+export declare function deleteOpPromise(opID: OpID): Promise;
+export declare function statOpPromise(opID: OpID): Promise;
+export declare function teamPromise(teamid: TeamID): Promise;
+export declare function opPromise(opID: OpID): Promise;
+export declare function mePromise(): Promise;
+export declare function agentPromise(GID: GoogleID): Promise;
+export declare function assignMarkerPromise(opID: OpID, markerID: MarkerID, agentID: GoogleID): Promise;
+export declare function assignLinkPromise(opID: OpID, linkID: LinkID, agentID: GoogleID): Promise;
+export declare function targetPromise(agentID: GoogleID, portal: WasabeePortal, type?: string): Promise;
+export declare function routePromise(agentID: GoogleID, portal: WasabeePortal): Promise;
+export declare function SendAccessTokenAsync(accessToken: string): Promise;
+export declare function SetTeamState(teamID: TeamID, state: "On" | "Off"): Promise;
+export declare function SetTeamShareWD(teamID: TeamID, state: "On" | "Off"): Promise;
+export declare function SetTeamLoadWD(teamID: TeamID, state: "On" | "Off"): Promise;
+export declare function SetMarkerState(opID: OpID, markerID: MarkerID, state: string): Promise;
+export declare function SetLinkState(opID: OpID, linkID: LinkID, state: string): Promise;
+export declare function opKeyPromise(opID: OpID, portalID: PortalID, onhand: number, capsule: string): Promise;
+export declare function dKeyPromise(json: string): Promise;
+export declare function dKeyBulkPromise(json: string): Promise;
+export declare function dKeylistPromise(): Promise<{
+ DefensiveKeys: WDKey[];
+}>;
+export declare function locationPromise(lat: number, lng: number): Promise;
+export declare function logoutPromise(): Promise;
+export declare function addPermPromise(opID: OpID, teamID: TeamID, role: string, zone: ZoneID): Promise;
+export declare function delPermPromise(opID: OpID, teamID: TeamID, role: string, zone: ZoneID): Promise;
+export declare function leaveTeamPromise(teamID: TeamID): Promise;
+export declare function removeAgentFromTeamPromise(agentID: GoogleID, teamID: TeamID): Promise;
+export declare function setAgentTeamSquadPromise(agentID: GoogleID, teamID: TeamID, squad: string): Promise;
+export declare function addAgentToTeamPromise(agentID: GoogleID, teamID: TeamID): Promise;
+export declare function renameTeamPromise(teamID: TeamID, name: string): Promise;
+export declare function rocksPromise(teamID: TeamID, community: string, apikey: string): Promise;
+export declare function newTeamPromise(name: string): Promise;
+export declare function deleteTeamPromise(teamID: TeamID): Promise;
+export declare function oneTimeToken(token: string): Promise;
+export declare function GetWasabeeServer(): any;
+export declare function GetUpdateList(): any;
+export declare function SetWasabeeServer(server: string): void;
+export declare function sendTokenToWasabee(token: string): Promise;
+export declare function getCustomTokenFromServer(): Promise;
+export declare function loadConfig(): Promise;
+export declare function changeTeamOwnerPromise(teamID: TeamID, newOwner: GoogleID): Promise;
+export declare function createJoinLinkPromise(teamID: TeamID): Promise<{
+ Key: string;
+}>;
+export declare function deleteJoinLinkPromise(teamID: TeamID): Promise;
+export declare function setAssignmentStatus(op: WasabeeOp, object: WasabeeLink | WasabeeMarker, completed: boolean): Promise;
+export declare function sendAnnounce(teamID: TeamID, message: string): Promise;
+export declare function pullRocks(teamID: TeamID): Promise;
+export declare function reverseLinkDirection(opID: OpID, linkID: LinkID): Promise;
+export declare function setOpInfo(opID: OpID, info: any): Promise;
+export declare function setMarkerComment(opID: OpID, markerID: MarkerID, comment: string): Promise;
+export declare function setLinkComment(opID: OpID, linkID: LinkID, desc: string): Promise;
+export declare function setLinkZone(opID: OpID, linkID: LinkID, zone: ZoneID): Promise;
+export declare function setMarkerZone(opID: OpID, markerID: MarkerID, zone: ZoneID): Promise;
+export declare function setIntelID(name: string, faction: string, querytoken: string): Promise;
+export { };
diff --git a/src/code/skin.d.ts b/src/code/skin.d.ts
new file mode 100644
index 000000000..aea4270eb
--- /dev/null
+++ b/src/code/skin.d.ts
@@ -0,0 +1,3 @@
+export declare function initSkin(): void;
+export declare function changeSkin(names: any): boolean;
+export declare function addToColorList(color: any): void;
diff --git a/src/code/sortable.d.ts b/src/code/sortable.d.ts
new file mode 100644
index 000000000..d51f3ea87
--- /dev/null
+++ b/src/code/sortable.d.ts
@@ -0,0 +1,41 @@
+interface SortableItem {
+ obj: T;
+ row: HTMLTableRowElement;
+ index: number;
+ values: unknown[];
+ sortValues: unknown[];
+}
+export interface SortableField {
+ name: string;
+ className?: string;
+ value: (thing: T) => unknown;
+ sortValue?: (value: unknown, thing: T) => unknown;
+ sort?: (a: unknown, b: unknown, aobj?: T, bobj?: T) => number;
+ format?: (cell: HTMLTableCellElement, value: unknown, thing?: T) => void;
+ smallScreenHide?: boolean;
+}
+export default class Sortable {
+ _items: Array>;
+ _fields: Array>;
+ _sortBy: number;
+ _sortAsc: boolean;
+ _table: HTMLTableElement;
+ _head: HTMLTableSectionElement;
+ _body: HTMLTableSectionElement;
+ _smallScreen: boolean;
+ _done: Promise | boolean;
+ constructor();
+ get sortBy(): number;
+ set sortBy(property: number);
+ get sortAsc(): boolean;
+ set sortAsc(b: boolean);
+ get table(): HTMLTableElement;
+ get items(): T[];
+ set items(incoming: T[]);
+ get fields(): SortableField[];
+ set fields(value: SortableField[]);
+ get done(): boolean | Promise;
+ renderHead(): void;
+ sort(): void;
+}
+export {};
diff --git a/src/code/static.d.ts b/src/code/static.d.ts
new file mode 100644
index 000000000..683a3dd8d
--- /dev/null
+++ b/src/code/static.d.ts
@@ -0,0 +1,3 @@
+declare const statics: any;
+export declare const constants: any;
+export default statics;
diff --git a/src/code/toolbox.d.ts b/src/code/toolbox.d.ts
new file mode 100644
index 000000000..1a0053459
--- /dev/null
+++ b/src/code/toolbox.d.ts
@@ -0,0 +1 @@
+export declare function setupToolbox(): void;
diff --git a/src/code/ui/agent.d.ts b/src/code/ui/agent.d.ts
new file mode 100644
index 000000000..40d8b0f32
--- /dev/null
+++ b/src/code/ui/agent.d.ts
@@ -0,0 +1,25 @@
+import WasabeeAgent from "../model/agent";
+
+declare function formatDisplay(
+ agent: WasabeeAgent,
+ teamID?: number | string
+): HTMLAnchorElement;
+declare function timeSinceformat(agent: WasabeeAgent): string;
+
+interface WLAgentOptions extends L.MarkerOptions {
+ agent: WasabeeAgent;
+ id: string;
+ zoom: number;
+}
+declare class WLAgent extends L.Marker {
+ options: WLAgentOptions;
+ constructor(agent: WasabeeAgent);
+ update(): this;
+ _getPopup(): HTMLDivElement;
+}
+declare const _default: {
+ formatDisplay: typeof formatDisplay;
+ timeSinceformat: typeof timeSinceformat;
+ WLAgent: typeof WLAgent;
+};
+export default _default;
diff --git a/src/code/ui/anchor.d.ts b/src/code/ui/anchor.d.ts
new file mode 100644
index 000000000..246d0391e
--- /dev/null
+++ b/src/code/ui/anchor.d.ts
@@ -0,0 +1,14 @@
+import type WasabeeOp from "../model/operation";
+import PortalUI from "./portal";
+
+declare class WLAnchor extends PortalUI.WLPortal {
+ constructor(portalId: string, operation: WasabeeOp);
+ _popupContent(): any;
+ _linksButton(container: any): void;
+ _swapButton(container: any): void;
+ _deleteAction(): void;
+}
+declare const _default: {
+ WLAnchor: typeof WLAnchor;
+};
+export default _default;
diff --git a/src/code/ui/link.d.ts b/src/code/ui/link.d.ts
new file mode 100644
index 000000000..b866e9184
--- /dev/null
+++ b/src/code/ui/link.d.ts
@@ -0,0 +1,22 @@
+import type WasabeeOp from "../model/operation";
+import type WasabeeLink from "../model/link";
+declare function displayFormat(
+ link: WasabeeLink,
+ operation: WasabeeOp,
+ smallScreen?: boolean
+): HTMLDivElement;
+declare function minLevel(
+ link: WasabeeLink,
+ operation: WasabeeOp
+): HTMLSpanElement;
+declare class WLLink extends L.GeodesicPolyline {
+ _wlink: WasabeeLink;
+ constructor(link: WasabeeLink, operation: WasabeeOp);
+ _getPopup(): HTMLDivElement;
+}
+declare const _default: {
+ displayFormat: typeof displayFormat;
+ minLevel: typeof minLevel;
+ WLLink: typeof WLLink;
+};
+export default _default;
diff --git a/src/code/ui/marker.d.ts b/src/code/ui/marker.d.ts
new file mode 100644
index 000000000..51fee7a00
--- /dev/null
+++ b/src/code/ui/marker.d.ts
@@ -0,0 +1,18 @@
+import PortalUI from "./portal";
+import type WasabeeMarker from "../model/marker";
+declare class WLMarker extends PortalUI.WLPortal {
+ state: string;
+ constructor(marker: WasabeeMarker);
+ setState(state: string): void;
+ _popupContent(): any;
+ _popupMarkerComment(container: any, marker: any, canWrite: any): void;
+ _popupAssignState(container: any, marker: any): Promise;
+ _stateButton(container: any, marker: any): void;
+ _deleteAction(): void;
+ _setComment(ev: any): void;
+ _setMarkerType(ev: any): void;
+}
+declare const _default: {
+ WLMarker: typeof WLMarker;
+};
+export default _default;
diff --git a/src/code/ui/portal.d.ts b/src/code/ui/portal.d.ts
new file mode 100644
index 000000000..14f5530f2
--- /dev/null
+++ b/src/code/ui/portal.d.ts
@@ -0,0 +1,40 @@
+import WasabeePortal from "../model/portal";
+import { IITC } from "../../types/iitc";
+
+declare function fromIITC(p: IITC.Portal): WasabeePortal;
+declare function team(portal: any): string;
+declare function displayName(portal: any): any;
+declare function displayFormat(
+ portal: any,
+ shortName?: boolean
+): HTMLAnchorElement;
+declare function get(id: any): WasabeePortal;
+declare function getSelected(): WasabeePortal;
+interface WLPortalOptions extends L.MarkerOptions {
+ portalId: string;
+ title?: string;
+ id: string;
+}
+declare class WLPortal extends L.Marker {
+ type: string;
+ options: WLPortalOptions;
+ constructor(options: WLPortalOptions);
+ _popupContent(): HTMLDivElement;
+ _popupPortalComments(container: any, portal: any, canWrite: any): void;
+ _setPortalComment(ev: any): void;
+ _assignButton(container: any, text: any, target: any): void;
+ _deleteAction(): void;
+ _deleteButton(container: any, text: any): void;
+ _sendTargetButton(container: any, text: any, target: any): void;
+ _mapButton(container: any, text: any): void;
+}
+declare const _default: {
+ fromIITC: typeof fromIITC;
+ displayName: typeof displayName;
+ displayFormat: typeof displayFormat;
+ get: typeof get;
+ getSelected: typeof getSelected;
+ team: typeof team;
+ WLPortal: typeof WLPortal;
+};
+export default _default;
diff --git a/src/code/ui/zone.d.ts b/src/code/ui/zone.d.ts
new file mode 100644
index 000000000..124d69c35
--- /dev/null
+++ b/src/code/ui/zone.d.ts
@@ -0,0 +1,8 @@
+import type WasabeeZone from "../model/zone";
+declare class WLZone extends L.LayerGroup {
+ constructor(zone: WasabeeZone);
+}
+declare const _default: {
+ WLZone: typeof WLZone;
+};
+export default _default;
diff --git a/src/code/uiCommands.d.ts b/src/code/uiCommands.d.ts
new file mode 100644
index 000000000..b62d1ae10
--- /dev/null
+++ b/src/code/uiCommands.d.ts
@@ -0,0 +1,25 @@
+export declare function addPortal(operation: any, portal: any): void;
+export declare function swapPortal(operation: any, portal: any): void;
+export declare function deletePortal(operation: any, portal: any): void;
+export declare function deleteMarker(operation: any, marker: any, portal: any): void;
+export declare function clearAllItems(operation: any): void;
+export declare function clearAllLinks(operation: any): void;
+export declare function clearAllMarkers(operation: any): void;
+export declare function listenForAddedPortals(newPortal: any): void;
+export declare function listenForPortalDetails(e: any): void;
+export declare function getPortalDetails(guid: any): void;
+export declare function loadFaked(operation: any, force?: boolean): void;
+export declare function loadBlockerFaked(operation: any, force?: boolean): Promise;
+export declare function sendLocation(): void;
+export declare function getAllPortalsOnScreen(operation: any): any[];
+export declare function getAllPortalsLinked(operation: any, originPortal: any): any[];
+export declare function testPortal(recursed?: boolean): any;
+export declare function blockerAutomark(operation: any, first?: boolean): Promise;
+export declare function zoomToOperation(operation: any): void;
+export declare function updateLocalOp(local: any, remote: any): Promise;
+export declare function fullSync(): Promise;
+export declare function syncOp(opID: any): Promise;
+export declare function deleteLocalOp(opname: any, opid: any): void;
+export declare function resetCaches(): Promise;
+export declare function setMarkersToZones(): void;
+export declare function setLinksToZones(): void;
diff --git a/src/code/wX.d.ts b/src/code/wX.d.ts
new file mode 100644
index 000000000..49bf52ccf
--- /dev/null
+++ b/src/code/wX.d.ts
@@ -0,0 +1,3 @@
+export declare function wX(key: string, data?: object): any;
+export declare function getLanguage(): any;
+export default wX;
diff --git a/src/code/wd.d.ts b/src/code/wd.d.ts
new file mode 100644
index 000000000..6e961e1ee
--- /dev/null
+++ b/src/code/wd.d.ts
@@ -0,0 +1,15 @@
+export declare type WDKey = {
+ Name: string;
+ PortalID: string;
+ GID: string;
+ Lat: string;
+ Lng: string;
+ Count: number;
+ CapID: string;
+};
+export declare function initWasabeeD(): void;
+export declare function getAllWasabeeDkeys(): Promise;
+export declare function getAgentWasabeeDkeys(gid: string): Promise;
+export declare function getAllPortalWasabeeDkeys(portalid: string): Promise;
+export declare function getAgentPortalWasabeeDkeys(gid: string, portalid: string): Promise;
+export declare function drawWasabeeDkeys(): Promise;
diff --git a/src/types/iitc/LICENSE b/src/types/iitc/LICENSE
new file mode 100755
index 000000000..9e841e7a2
--- /dev/null
+++ b/src/types/iitc/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
diff --git a/src/types/iitc/README.md b/src/types/iitc/README.md
new file mode 100755
index 000000000..b54336725
--- /dev/null
+++ b/src/types/iitc/README.md
@@ -0,0 +1,21 @@
+# Installation
+
+> `npm install --save @types/iitc`
+
+# Summary
+
+This package contains type definitions for IITC (Ingress Intel Total Conversation) (https://github.com/IITC-CE/ingress-intel-total-conversion).
+
+# Details
+
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/iitc.
+
+### Additional Details
+
+- Last updated: Tue, 07 Sep 2021 07:31:40 GMT
+- Dependencies: [@types/leaflet](https://npmjs.com/package/@types/leaflet), [@types/spectrum](https://npmjs.com/package/@types/spectrum), [@types/jquery](https://npmjs.com/package/@types/jquery), [@types/jqueryui](https://npmjs.com/package/@types/jqueryui)
+- Global values: none
+
+# Credits
+
+These definitions were written by [McBen](https://github.com/McBen).
diff --git a/src/types/iitc/core/android.d.ts b/src/types/iitc/core/android.d.ts
new file mode 100755
index 000000000..cd471b666
--- /dev/null
+++ b/src/types/iitc/core/android.d.ts
@@ -0,0 +1,57 @@
+export {};
+
+declare global {
+ class Android {
+ saveFile(filename: string, mime: string, content: string): void;
+
+ // open dialog to send geo intent for navigation apps like gmaps or waze etc...
+ intentPosLink(
+ lat: number,
+ lng: number,
+ zoom: number,
+ title: string,
+ isPortal: boolean
+ ): void;
+
+ // share a string to the IITC share activity. only uses the share tab.
+ shareString(text: string): void;
+
+ // disable javascript injection while spinner is enabled prevent the spinner from closing automatically
+ spinnerEnabled(enable: boolean): void;
+
+ copy(text: string): void;
+
+ getVersionCode(): number;
+ getVersionName(): string;
+
+ addPane(
+ id: string,
+ label: string,
+ icon?: string /*= "ic_action_new_event"*/
+ ): void;
+ switchToPane(id: string): void;
+
+ dialogFocused(id: string): void;
+ dialogOpened(id: string, open: boolean): void;
+
+ setLayers(base_layer: string, overlay_layer: string): void;
+
+ addPortalHighlighter(name: string): void;
+ setActiveHighlighter(name: string): void;
+
+ // IITC-Version check plugin
+ updateIitc(fileUrl: string): void;
+
+ showZoom(): boolean;
+ setFollowMode(follow: boolean): void;
+
+ setProgress(progress: number): void;
+
+ getFileRequestUrlPrefix(): string;
+ setPermalink(href: string): void;
+
+ reloadIITC(clearCache?: boolean /*= false*/): void;
+ }
+
+ var android: Android;
+}
diff --git a/src/types/iitc/core/artifact.d.ts b/src/types/iitc/core/artifact.d.ts
new file mode 100755
index 000000000..a3e9ceb00
--- /dev/null
+++ b/src/types/iitc/core/artifact.d.ts
@@ -0,0 +1,44 @@
+import * as L from "leaflet";
+
+export {};
+
+declare global {
+ class Artifact {
+ // private _layer: L.LayerGroup;
+ REFRESH_JITTER: number; // 2 minute random period so not all users refresh at once
+ REFRESH_SUCCESS: number; // 60 minutes on success
+ REFRESH_FAILURE: number; // 2 minute retry on failure
+ portalInfo: {};
+ artifactTypes: { [type: string]: any };
+ entities: [];
+
+ setup(): void;
+ requestData(): void;
+ idleResume(): void;
+ // private handleSuccess(data): void;
+ // private handleFailure(data): void;
+ // private processData(data): void;
+ // private processResult(portals): void;
+ clearData(): void;
+
+ getArtifactTypes(): string[];
+ isArtifact(type: string): boolean;
+
+ /** used to render portals that would otherwise be below the visible level */
+ getArtifactEntities(): [];
+ getInterestingPortals(): string[];
+
+ /** quick test for portal being relevant to artifacts - of any type */
+ isInterestingPortal(guid: string): boolean;
+
+ /** get the artifact data for a specified artifact id (e.g. 'jarvis'), if it exists - otherwise returns something 'false' */
+ getPortalData(guid: string, artifactId: any): any;
+
+ updateLayer(): void;
+
+ /** show artifact dialog */
+ showArtifactList(): void;
+ }
+
+ var artifact: Artifact;
+}
diff --git a/src/types/iitc/core/boot.d.ts b/src/types/iitc/core/boot.d.ts
new file mode 100755
index 000000000..d643d0dae
--- /dev/null
+++ b/src/types/iitc/core/boot.d.ts
@@ -0,0 +1,46 @@
+export {};
+
+declare global {
+ function setupLargeImagePreview(): void;
+
+ /**
+ * adds listeners to the layer chooser such that a long press hides
+ * all custom layers except the long pressed one.
+ */
+ function setupLayerChooserSelectOne(): void;
+
+ /** Setup the function to record the on/off status of overlay layerGroups */
+ function setupLayerChooserStatusRecorder(): void;
+
+ function setupStyles(): void;
+ function setupIcons(): void;
+ function createDefaultBaseMapLayers(): void;
+ function setupMap(): void;
+
+ /** adds a base layer to the map. done separately from the above, so that plugins that add base layers can be the default */
+ function setMapBaseLayer(): void;
+
+ /**
+ * renders player details into the website. Since the player info is
+ * included as inline script in the original site, the data is static
+ * and cannot be updated.
+ */
+ function setupPlayerStat(): void;
+
+ function setupSidebarToggle(): void;
+ function setupTooltips(): void;
+ function setupLayerChooserApi(): void;
+ function extendLeaflet(): void;
+
+ // BOOTING ///////////////////////////////////////////////////////////
+ function prepPluginsToLoad(): void;
+ function boot(): void;
+
+ /**
+ * OMS doesn't cancel the original click event, so the topmost marker will get a click event while spiderfying.
+ * Also, OMS only supports a global callback for all managed markers. Therefore, we will use a custom event that gets fired
+ * for each marker.
+ */
+ function setupOMS(): void;
+ function registerMarkerForOMS(marker: L.Marker): void;
+}
diff --git a/src/types/iitc/core/chat.d.ts b/src/types/iitc/core/chat.d.ts
new file mode 100755
index 000000000..e6e96c987
--- /dev/null
+++ b/src/types/iitc/core/chat.d.ts
@@ -0,0 +1,138 @@
+import { Intel } from "./inteltypes";
+
+export {};
+
+declare global {
+ type ChatChannels = "all" | "faction" | "alerts";
+
+ class Chat {
+ /** @return name of active tab */
+ getActive(): string;
+
+ /** Expand or collapse chat window */
+ toggle(): void;
+
+ handleTabCompletion(): void;
+
+ genPostData(
+ channel: ChatChannels,
+ storageHash: chatStorage,
+ getOlderMsgs: boolean
+ ): any;
+
+ // faction
+ _faction: chatStorage;
+ _requestFactionRunning: boolean;
+ requestFaction(getOlderMsgs: boolean, isRetry: boolean): void;
+ handleFaction(data: any, olderMsgs: boolean): void;
+ renderFaction(oldMsgsWereAdded: boolean): void;
+
+ // all
+ _public: chatStorage;
+ _requestPublicRunning: boolean;
+ requestPublic(getOlderMsgs: boolean, isRetry: boolean): void;
+ handlePublic(data: any, olderMsgs: boolean): void;
+ renderPublic(oldMsgsWereAdded: boolean): void;
+
+ // alerts
+ _alerts: chatStorage;
+ _requestAlertsRunning: boolean;
+ requestAlerts(getOlderMsgs: boolean, isRetry: boolean): void;
+ handleAlerts(data: any, olderMsgs: boolean): void;
+ renderAlerts(oldMsgsWereAdded: boolean): void;
+
+ /** if user clicked a agent name */
+ nicknameClicked(event: MouseEvent, nickname: string): void;
+
+ /** store incoming data */
+ writeDataToHash(
+ newData: any,
+ storageHash: chatStorage,
+ isPublicChannel: boolean,
+ isOlderMsgs: boolean
+ ): void;
+
+ /** Override portal names that are used over and over, such as 'US Post Office' */
+ getChatPortalName(markup: Intel.MarkUpPortalType): string;
+
+ /**
+ * renders data from the data-hash to the element defined by the given
+ * ID. Set 3rd argument to true if it is likely that old data has been
+ * added. Latter is only required for scrolling.
+ */
+ renderData(
+ data: any,
+ element: "chatfaction" | "chatall" | "chatalerts",
+ likelyWereOldMsgs: boolean
+ ): void;
+
+ renderDivider(text: string): string;
+
+ renderMsg(
+ msg: string,
+ nick: string,
+ time: number,
+ team: 0 | 1 | 2,
+ msgToPlayer: boolean,
+ systemNarrowcast: boolean
+ ): string;
+
+ /** add nickname to chat-input line */
+ addNickname(nick: string): void;
+
+ tabToChannel(tab: ChatChannels | string): ChatChannels;
+
+ /**
+ * called by plugins (or other things?) that need to monitor COMM data streams when the user is not viewing them
+ * instance: a unique string identifying the plugin requesting background COMM
+ * channel: either 'all', 'faction' or (soon) 'alerts' - others possible in the future
+ * flag: true for data wanted, false for not wanted
+ */
+ backgroundChannelData(
+ instance: string,
+ channel: ChatChannels,
+ flag: boolean
+ ): void;
+
+ backgroundInstanceChannel: {}; // [instance][channel] = flag;
+
+ request(): void;
+
+ /**
+ * checks if there are enough messages in the selected chat tab and
+ * loads more if not.
+ */
+ needMoreMessages(): void;
+
+ /** activate a chat tab */
+ show(tab: ChatChannels): void;
+
+ chooseTab(tab: ChatChannels): void;
+
+ /** mouse event handler */
+ chooser(event: MouseEvent): void;
+
+ /** contains the logic to keep the correct scroll position. */
+ keepScrollPosition(
+ box: JQuery,
+ scrollBefore: number,
+ isOldMsgs: boolean
+ ): void;
+
+ /** init */
+ setup(): void;
+ setupTime(): void;
+ setupPosting(): void;
+
+ /** send current message of current chat to server */
+ postMsg(): void;
+ }
+
+ interface chatStorage {
+ data: {};
+ oldestTimestamp: number;
+ newestTimestamp: number;
+ }
+
+ var chat: Chat;
+}
diff --git a/src/types/iitc/core/constants.d.ts b/src/types/iitc/core/constants.d.ts
new file mode 100755
index 000000000..86be064d6
--- /dev/null
+++ b/src/types/iitc/core/constants.d.ts
@@ -0,0 +1,115 @@
+import { IITC, PortalGUID } from "./iitctypes";
+
+export {};
+
+declare global {
+ const script_info: any;
+ const iitcBuildDate: string;
+
+ // CONFIG OPTIONS ////////////////////////////////////////////////////
+ const REFRESH: number; /** @default = 30; // refresh view every 30s (base time) */
+ const ZOOM_LEVEL_ADJ: number; /** @default = 5; // add 5 seconds per zoom level */
+ const ON_MOVE_REFRESH: number; /** @default = 2.5; //refresh time to use after a movement event */
+ const MINIMUM_OVERRIDE_REFRESH: number; /** @default = 10; //limit on refresh time since previous refresh, limiting repeated move refresh rate */
+ const REFRESH_GAME_SCORE: number; /** @default = 15 * 60; // refresh game score every 15 minutes */
+ const MAX_IDLE_TIME: number; /** @default = 15 * 60; // stop updating map after 15min idling */
+ const HIDDEN_SCROLLBAR_ASSUMED_WIDTH: number; /** @default = 20; */
+ const SIDEBAR_WIDTH: number; /** @default = 300; */
+
+ // how many pixels to the top before requesting new data
+ const CHAT_REQUEST_SCROLL_TOP: number; /** @default = 200; */
+ const CHAT_SHRINKED: number; /** @default = 60; */
+
+ // Minimum area to zoom ratio that field MU's will display
+ const FIELD_MU_DISPLAY_AREA_ZOOM_RATIO: number; /** @default 0.001; */
+
+ // Point tolerance for displaying MU's
+ const FIELD_MU_DISPLAY_POINT_TOLERANCE: number; /** @default = 60 */
+
+ const COLOR_SELECTED_PORTAL: string; /** @default '#f0f' */
+
+ /**
+ * Team colors
+ * @default ['#FF6600','#0088FF','#03DC03']
+ */
+ const COLORS: [string, string, string];
+ const COLORS_LVL: string[]; /** @default ['#000',...,'#9627F4'] */
+ const COLORS_MOD: {}; /** @default {VERY_RARE:'#b08cff',RARE:'#73a8ff',COMMON:'#8cffbf'} */
+
+ const MOD_TYPE: {}; // { RES_SHIELD: 'Shield', MULTIHACK: 'Multi-hack', FORCE_AMP: 'Force Amp', HEATSINK: 'Heat Sink', TURRET: 'Turret', LINK_AMPLIFIER: 'Link Amp' };
+
+ // circles around a selected portal that show from where you can hack
+ // it and how far the portal reaches (i.e. how far links may be made
+ // from this portal)
+ const ACCESS_INDICATOR_COLOR: string; // = 'orange';
+ const RANGE_INDICATOR_COLOR: string; // = 'red'
+
+ // min zoom for intel map - should match that used by stock intel
+ const MIN_ZOOM: number; // = 3;
+
+ // used when zoom level is not specified explicitly (must contain all the portals)
+ const DEFAULT_ZOOM: number; // = 15;
+
+ const DEFAULT_PORTAL_IMG: string; // '//commondatastorage.googleapis.com/ingress.com/img/default-portal-image.png';
+ const NOMINATIM: string; // '//nominatim.openstreetmap.org/search?format=json&polygon_geojson=1&q=';
+
+ // INGRESS CONSTANTS /////////////////////////////////////////////////
+ // http://decodeingress.me/2012/11/18/ingress-portal-levels-and-link-range/
+ const RESO_NRG: number[]; /** @default [0,1000,1500,2000,2500,3000,4000,5000,6000] */
+ const HACK_RANGE: number; /** @default 40 in meters, max. distance from portal to be able to access it */
+ const OCTANTS: string[]; /** @default ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE'] */
+ const OCTANTS_ARROW: string[]; /** @default ['→', '↗', '↑', '↖', '←', '↙', '↓', '↘'] */
+ const DESTROY_RESONATOR: number; /** @default 75 AP for destroying portal */
+ const DESTROY_LINK: number; /** @default 187 AP for destroying link */
+ const DESTROY_FIELD: number; /** @default 750 AP for destroying field */
+ const CAPTURE_PORTAL: number; /** @default 500 AP for capturing a portal */
+ const DEPLOY_RESONATOR: number; /** @default 125 AP for deploying a resonator */
+ const COMPLETION_BONUS: number; /** @default 250; AP for deploying all resonators on portal */
+ const UPGRADE_ANOTHERS_RESONATOR: number; /** @default 65; AP for upgrading another's resonator */
+ const MAX_PORTAL_LEVEL: number; /** @default 8 */
+ const MAX_RESO_PER_PLAYER: number[]; /** @default [0, 8, 4, 4, 4, 2, 2, 1, 1] */
+
+ // OTHER MORE-OR-LESS CONSTANTS //////////////////////////////////////
+ /** Team constants */
+ const TEAM_ENL: number; /** @default 2 */
+ const TEAM_RES: number; /** @default 1 */
+ const TEAM_NONE: number; /** @default 0 */
+
+ /** Team CSS = ['none', 'res', 'enl'] */
+ const TEAM_TO_CSS: [string, string, string];
+
+ /** ['Neutral', 'Resistance', 'Enlightened'] */
+ const TEAM_NAMES: [string, string, string];
+
+ // STORAGE ///////////////////////////////////////////////////////////
+ // global constiables used for storage. Most likely READ ONLY. Proper
+ // way would be to encapsulate them in an anonymous function and write
+ // getters/setters, but if you are careful enough, this works.
+ var refreshTimeout: any; // = undefined;
+ var urlPortal: any; // = null;
+ var urlPortalLL: any; // = null;
+
+ /** guid of current selected portal */
+ var selectedPortal: PortalGUID | null;
+
+ var portalRangeIndicator: any; // = null;
+ var portalAccessIndicator: any; // = null;
+ var mapRunsUserAction: any; // = false;
+
+ const portalsFactionLayers: L.LayerGroup;
+ const linksFactionLayers: L.LayerGroup;
+ const fieldsFactionLayers: L.LayerGroup;
+
+ /** list of all loaded portals */
+ var portals: { [guid: string /* PortalGUID */]: IITC.Portal };
+
+ /** list of all loaded links */
+ var links: { [guid: string /* LinkGUID */]: IITC.Link };
+
+ /** list of all fields */
+ var fields: { [guid: string /* FieldGUID */]: IITC.Field };
+
+ // contain current status(on/off) of overlay layerGroups.
+ // But you should use isLayerGroupDisplayed(name) to check the status
+ var overlayStatus: {};
+}
diff --git a/src/types/iitc/core/data_cache.d.ts b/src/types/iitc/core/data_cache.d.ts
new file mode 100755
index 000000000..bf74866f2
--- /dev/null
+++ b/src/types/iitc/core/data_cache.d.ts
@@ -0,0 +1,30 @@
+/** cache for map data tiles. */
+export class DataCache {
+ /**
+ * if younger than this, use data in the cache rather than fetching from the server
+ * @default 180
+ */
+ REQUEST_CACHE_FRESH_AGE: number;
+
+ /**
+ * maximum cache age. entries are deleted from the cache after this time
+ * @default 300
+ */
+ REQUEST_CACHE_MAX_AGE: number;
+
+ /** if more than this many entries, expire early */
+ REQUEST_CACHE_MAX_ITEMS: number;
+ /** or more than this total size */
+ REQUEST_CACHE_MAX_CHARS: number;
+
+ store(key: string, data: any, freshTime?: number): void;
+ remove(key: string): void;
+ get(key: string): any;
+ getTime(key: string): number;
+ getFresh(key: string): boolean | undefined;
+ startExpireInterval(periodInSecond: number): void;
+ stopExpireInterval(): void;
+ private runExpire(): void;
+
+ debug(): string;
+}
diff --git a/src/types/iitc/core/dialog.d.ts b/src/types/iitc/core/dialog.d.ts
new file mode 100755
index 000000000..0a4993b0b
--- /dev/null
+++ b/src/types/iitc/core/dialog.d.ts
@@ -0,0 +1,105 @@
+import "jqueryui";
+
+declare global {
+ /** The global ID of onscreen dialogs. */
+ var DIALOG_ID: number;
+
+ /** All onscreen dialogs, keyed by their ID. */
+ var DIALOGS: {};
+
+ /** The number of dialogs on screen. */
+ var DIALOG_COUNT: number;
+
+ /** The dialog that has focus. */
+ var DIALOG_FOCUS: any;
+
+ /**
+ * Controls how quickly the slide toggle animation
+ * should play for dialog collapsing and expanding.
+ * @default 100
+ */
+ var DIALOG_SLIDE_DURATION: number;
+
+ /** Create and show dialog */
+ function dialog(data: DialogOptions): JQuery;
+
+ // see https://jqueryui.com/dialog/
+ interface DialogOptions {
+ /** If set only one dialog can be open */
+ id?: string | undefined;
+
+ /** Dialog title */
+ title?: string | undefined;
+
+ /**
+ * Dialog contents - converted by convertTextToTableMagic
+ * \n will be line breaks \t will be table fields
+ */
+ text?: string | undefined;
+
+ /** Dialog contents (if no text) */
+ html?: string | HTMLElement | JQuery | undefined;
+
+ dialogClass?: string | undefined;
+ classes?: any;
+
+ /**
+ * single dialog
+ * default: false
+ */
+ modal?: boolean | undefined;
+
+ /**
+ * moveable dialog
+ * default: true
+ */
+ draggable?: boolean | undefined;
+
+ /**
+ * resizeable dialog (won't work in iitc out-of-the-box)
+ * default: false
+ */
+ resizable?: boolean | undefined;
+
+ /** position, see: https://api.jqueryui.com/position/ */
+ position?: any;
+
+ /** size */
+ height?: string | number | undefined;
+ width?: string | number | undefined;
+ maxHeight?: string | undefined;
+ maxWidth?: string | undefined;
+ minHeight?: string | undefined;
+ minWidth?: string | undefined;
+
+ autoOpen?: boolean | undefined;
+ closeOnEscape?: boolean | undefined;
+ hide?: any;
+ appendTo?: any;
+
+ /** Specifies the text for the close button */
+ closeText?: string | undefined;
+
+ closeCallback?: any;
+ collapseCallback?: any;
+ expandCallback?: any;
+ collapseExpandCallback?: any;
+ focusCallback?: any;
+ blurCallback?: any;
+
+ buttons?:
+ | JQueryUI.ButtonOptions[]
+ | { [key: string]: () => void }
+ | undefined;
+ }
+
+ /** custom alert box */
+ function alert(
+ text: string | HTMLElement,
+ isHTML?: boolean,
+ closeCallback?: any
+ ): JQuery;
+
+ /** init */
+ function setupDialogs(): void;
+}
diff --git a/src/types/iitc/core/entity_decode.d.ts b/src/types/iitc/core/entity_decode.d.ts
new file mode 100755
index 000000000..9873be997
--- /dev/null
+++ b/src/types/iitc/core/entity_decode.d.ts
@@ -0,0 +1,25 @@
+import { IITC } from "./iitctypes";
+
+export {};
+
+declare global {
+ /**
+ * decode the on-network array entity format into an object format closer to that used before
+ * makes much more sense as an object, means that existing code didn't need to change, and it's what the
+ * stock intel site does internally too (the array format is only on the network)
+ */
+ class DecodeArray {
+ portalSummary(
+ data: any[]
+ ): IITC.PortalData | IITC.PortalDataCore | undefined;
+ portalDetail(data: any[]): IITC.PortalDataDetail | undefined;
+ }
+
+ // private but exposed:
+ // function parseMod(arr: null | any[]): IITC.Mod | null;
+ // function parseResonator(arr: null | any[]): IITC.Resonator | null;
+ // function parseArtifactBrief(arr: null | any[]): { fragment: any, target: any };
+ // function parseArtifactDetail(arr: null | any[]): IITC.ArtifactDetail | null;
+
+ var decodeArray: DecodeArray;
+}
diff --git a/src/types/iitc/core/entity_info.d.ts b/src/types/iitc/core/entity_info.d.ts
new file mode 100755
index 000000000..5ee1681ac
--- /dev/null
+++ b/src/types/iitc/core/entity_info.d.ts
@@ -0,0 +1,9 @@
+import { IITC } from "./iitctypes";
+
+declare global {
+ /**
+ * given the entity detail data, returns the team the entity belongs to. Uses TEAM_* enum values.
+ */
+ function getTeam(details: IITC.PortalData): 0 | 1 | 2;
+ function teamStringToId(teamStr: string): 0 | 1 | 2;
+}
diff --git a/src/types/iitc/core/extract_niantic_parameters.d.ts b/src/types/iitc/core/extract_niantic_parameters.d.ts
new file mode 100755
index 000000000..586044e78
--- /dev/null
+++ b/src/types/iitc/core/extract_niantic_parameters.d.ts
@@ -0,0 +1,10 @@
+export {};
+
+declare global {
+ /**
+ * as of 2014-08-14, Niantic have returned to minifying the javascript. This means we no longer get the nemesis object
+ * and it's various member objects, functions, etc.
+ * so we need to extract some essential parameters from the code for IITC to use
+ */
+ function extractFromStock(): void;
+}
diff --git a/src/types/iitc/core/game_status.d.ts b/src/types/iitc/core/game_status.d.ts
new file mode 100755
index 000000000..644e7a6ff
--- /dev/null
+++ b/src/types/iitc/core/game_status.d.ts
@@ -0,0 +1,6 @@
+export {};
+
+declare global {
+ /** MindUnit display */
+ function updateGameScore(data?: JQuery.jqXHR): void;
+}
diff --git a/src/types/iitc/core/hooks.d.ts b/src/types/iitc/core/hooks.d.ts
new file mode 100755
index 000000000..cb483b2c1
--- /dev/null
+++ b/src/types/iitc/core/hooks.d.ts
@@ -0,0 +1,279 @@
+import { IITC } from "./iitctypes";
+import { Intel } from "./inteltypes";
+
+declare global {
+ /**
+ * register a callback for an event
+ * called when portal on map is selected/unselected
+ */
+ function addHook(
+ event: "portalSelected",
+ callback: (e: EventPortalSelected) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * this hook runs after data for any of the public chats has been received and processed, but not
+ * yet been displayed. The data hash contains both the unprocessed raw ajax response as well as the processed
+ * chat data that is going to be used for display.
+ */
+ function addHook(
+ event: "publicChatDataAvailable",
+ callback: (e: EventPublicChatDataAvailable) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * this hook runs after data for the faction chat has been received and processed, but not yet been
+ * displayed. The data hash contains both the unprocessed raw ajax response as well as the processed chat data
+ * that is going to be used for display.
+ */
+ function addHook(
+ event: "factionChatDataAvailable",
+ callback: (e: EventFactionChatDataAvailable) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * fired after the details in the sidebar have been (re-)rendered Provides data about the portal
+ * that has been selected.
+ */
+ function addHook(
+ event: "portalDetailsUpdated",
+ callback: (e: EventPortalDetailsUpdated) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when the set of artifacts (including targets) has changed.
+ */
+ function addHook(
+ event: "artifactsUpdated",
+ callback: (e: EventArtifactsUpdated) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when we start refreshing map data
+ */
+ function addHook(
+ event: "mapDataRefreshStart",
+ callback: (e: EventMapDataRefreshStart) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called just as we start to render data. has callback to inject cached entities into the map render
+ */
+ function addHook(
+ event: "mapDataEntityInject",
+ callback: (e: EventMapDataEntityInject) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when we complete the map data load
+ */
+ function addHook(
+ event: "mapDataRefreshEnd",
+ callback: (e: EventMapDataRefreshEnd) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when a portal has been received and is about to be added to its layer group.
+ * Note that this does NOT mean it is already visible or will be, shortly after.
+ * If a portal is added to a hidden layer it may never be shown at all.
+ */
+ function addHook(
+ event: "portalAdded",
+ callback: (e: EventPortalAdded) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when a link is about to be added to the map
+ */
+ function addHook(
+ event: "linkAdded",
+ callback: (e: EventLinkAdded) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when a field is about to be added to the map
+ */
+ function addHook(
+ event: "fieldAdded",
+ callback: (e: EventFieldAdded) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when a portal has been removed
+ */
+ function addHook(
+ event: "portalRemoved",
+ callback: (e: EventPortalRemoved) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when a link has been removed
+ */
+ function addHook(
+ event: "linkRemoved",
+ callback: (e: EventLinkRemoved) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when a field has been removed
+ */
+ function addHook(
+ event: "fieldRemoved",
+ callback: (e: EventFieldRemoved) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called after each map data request finished.
+ */
+ function addHook(
+ event: "requestFinished",
+ callback: (e: EventRequestFinished) => void
+ ): void;
+ function addHook(
+ event: "nicknameClicked",
+ callback: (e: EventNicknameClicked) => boolean
+ ): void;
+ function addHook(event: "search", callback: (e: EventSearch) => void): void;
+
+ /**
+ * register a callback for an event
+ * called after IITC and all plugins loaded
+ * NOTE: if iitc is already loaded this event never happens. Check the @see iitcLoaded flag
+ */
+ function addHook(event: "iitcLoaded", callback: () => void): void;
+
+ /**
+ * register a callback for an event
+ * alled when a request to load full portal detail completes.
+ */
+ function addHook(
+ event: "portalDetailLoaded",
+ callback: (e: EventPortalDetailLoaded) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * called when the current pane has changed. On desktop, this only selects the current chat pane; on mobile, it
+ * also switches between map, info and other panes defined by plugins
+ */
+ function addHook(
+ event: "paneChanged",
+ callback: (e: EventPaneChanged) => void
+ ): void;
+
+ /**
+ * register a callback for an event
+ * (user defined hooks)
+ */
+ function addHook(event: string, callback: HookCallback): void;
+
+ /** remove a registered a callback */
+ function removeHook(event: string, callback: HookCallback): void;
+
+ /** trigger event */
+ function runHooks(event: string, data: any): boolean;
+
+ /** register a custom event */
+ function pluginCreateHook(event: string): void;
+
+ /** private hook table */
+ var _hooks: { [event: string]: HookCallback[] };
+
+ type HookCallback = (data: any) => boolean | void;
+
+ interface EventPortalSelected {
+ selectedPortalGuid: string;
+ unselectedPortalGuid: string;
+ }
+ interface EventPublicChatDataAvailable {
+ raw: any;
+ result: Intel.ChatLine[];
+ processed: any;
+ }
+ interface EventFactionChatDataAvailable {
+ raw: any;
+ result: Intel.ChatLine[];
+ processed: any;
+ }
+ interface EventPortalDetailsUpdated {
+ guid: string;
+ portal: IITC.Portal;
+ portalDetails: any /* class portalDetail */;
+ portalData: IITC.PortalData;
+ }
+ interface EventArtifactsUpdated {
+ old: any;
+ new: any;
+ }
+ interface EventMapDataRefreshStart {
+ bounds: L.LatLngBounds;
+ mapZoom: number;
+ dataZoom: number;
+ minPortalLevel: number;
+ tileBounds: L.LatLngBounds;
+ }
+ interface EventMapDataEntityInject {
+ callback: (ents: any) => void;
+ } // TODO: ents = portalDetailLoaded.ent
+ // tslint:disable-next-line:no-empty-interface
+ interface EventMapDataRefreshEnd {}
+ interface EventPortalAdded {
+ portal: IITC.Portal;
+ previousData: IITC.PortalData;
+ }
+ interface EventLinkAdded {
+ link: IITC.Link;
+ }
+ interface EventFieldAdded {
+ field: IITC.Field;
+ }
+ interface EventPortalRemoved {
+ portal: IITC.Portal;
+ data: IITC.PortalData;
+ }
+ interface EventLinkRemoved {
+ link: IITC.Link;
+ data: IITC.LinkData;
+ }
+ interface EventFieldRemoved {
+ field: IITC.Field;
+ data: IITC.FieldData;
+ }
+ interface EventRequestFinished {
+ success: boolean;
+ }
+ interface EventNicknameClicked {
+ event: MouseEvent;
+ nickname: string;
+ }
+ type EventSearch = any; /* class search.Query */
+ type EventPaneChanged = string;
+
+ type PortalDetailEnt = [
+ /*guid*/ string,
+ /*dict.timestamp*/ number,
+ /*data.result*/ Intel.PortalDetails
+ ];
+ type EventPortalDetailLoaded =
+ | {
+ guid: string;
+ success: true;
+ details: IITC.PortalDataDetail;
+ ent: PortalDetailEnt;
+ }
+ | { guid: string; success: false; details: never; ent: never };
+}
diff --git a/src/types/iitc/core/idle.d.ts b/src/types/iitc/core/idle.d.ts
new file mode 100755
index 000000000..c24a4932b
--- /dev/null
+++ b/src/types/iitc/core/idle.d.ts
@@ -0,0 +1,20 @@
+export {};
+
+declare global {
+ var idleTime: number; // in seconds
+
+ /** default MAX_IDLE_TIME */
+ var _idleTimeLimit: number;
+ var IDLE_POLL_TIME: number;
+
+ function idlePoll(): void;
+ function idleReset(): void;
+ function idleSet(): void;
+ function setupIdle(): void;
+
+ /**
+ * add your function here if you want to be notified when the user
+ * resumes from being idle
+ */
+ function addResumeFunction(fct: () => void): void;
+}
diff --git a/src/types/iitc/core/iitctypes.d.ts b/src/types/iitc/core/iitctypes.d.ts
new file mode 100755
index 000000000..1e8bdc2e3
--- /dev/null
+++ b/src/types/iitc/core/iitctypes.d.ts
@@ -0,0 +1,148 @@
+import * as L from "leaflet";
+import "leafletExtension";
+import * as jQuery from "jquery";
+
+export type PortalGUID = string;
+export type LinkGUID = string;
+export type FieldGUID = string;
+
+export namespace IITC {
+ /** Portal-Marker */
+ class Portal extends L.CircleMarker {
+ options: PortalOptions;
+ }
+
+ interface PortalOptions extends L.PathOptions {
+ guid: PortalGUID;
+ ent: any;
+ level: number;
+ team: number;
+ timestamp: number;
+ data: PortalDataDetail;
+ }
+
+ interface PortalDataCore {
+ team: string;
+ latE6: number;
+ lngE6: number;
+ }
+
+ interface PortalData extends PortalDataCore {
+ artifactBrief: { fragment: any; target: any } | null;
+ health: number;
+ image: string; // url
+ level: number;
+ mission: boolean;
+ mission50plus: boolean;
+ ornaments: string[];
+ resCount: number;
+ timestamp: number;
+ title: string;
+ }
+
+ interface PortalDataDetail extends PortalData {
+ artifactDetail: ArtifactDetail;
+ mods: [Mod | null, Mod | null, Mod | null, Mod | null];
+ owner: string;
+ resonators: Resonator[];
+ history: PortalHistory;
+ }
+
+ interface PortalHistory {
+ _raw: number;
+ visited: boolean;
+ captured: boolean;
+ scoutControlled: boolean;
+ }
+
+ interface Mod {
+ owner: string;
+ name: string;
+ rarity: ModRarity;
+ stats: { [k: string /*ModStats*/]: string };
+ }
+ type ModStats =
+ | "REMOVAL_STICKNESS" /* all */
+ /* Shield */
+ | "MIGRATION"
+ /* Turret */
+ | "ATTACK_FREQUENCY"
+ | "HIT_BONUS"
+ /* Forceamp */
+ | "FORCE_AMPLIFIER"
+ /* ito- */
+ | "XM_SPIN"
+ /* Multihack */
+ | "BURNOUT_INSULATION"
+ /* Heat sink */
+ | "HACK_SPEED"
+ /* Linkamp */
+ | "LINK_RANGE_MULTIPLIER"
+ /* sbul */
+ | "LINK_DEFENSE_BOOST"
+ | string; /* dummy for future stuff */
+ type ModRarity = "COMMON" | "RARE" | "VERY_RARE";
+
+ type ModType =
+ | "RES_SHIELD"
+ | "MULTIHACK"
+ | "FORCE_AMP"
+ | "HEATSINK"
+ | "TURRET"
+ | "LINK_AMPLIFIER";
+
+ interface Resonator {
+ energy: number;
+ level: number;
+ owner: string;
+ }
+
+ interface ArtifactDetail {
+ type: string;
+ displayName: string;
+ fragments: any[];
+ }
+
+ /** Link-Marker */
+ class Link extends L.GeodesicPolyline {
+ options: LinkOptions;
+ }
+
+ interface LinkOptions extends L.PathOptions {
+ team: number;
+ guid: string;
+ timestamp: number;
+ data: LinkData;
+ }
+
+ interface LinkData {
+ dGuid: string;
+ dLatE6: number;
+ dLngE6: number;
+ oGuid: string;
+ oLatE6: number;
+ oLngE6: number;
+ team: string;
+ }
+
+ /** Field-Polygon */
+ class Field extends L.GeodesicPolygon {
+ options: FieldOptions;
+ }
+
+ interface FieldOptions extends L.PathOptions {
+ team: number;
+ guid: string;
+ timestamp: number;
+ data: FieldData;
+ }
+
+ interface FieldData {
+ team: string;
+ points: Array<{
+ guid: string;
+ latE6: number;
+ lngE6: number;
+ }>;
+ }
+}
diff --git a/src/types/iitc/core/inteltypes.d.ts b/src/types/iitc/core/inteltypes.d.ts
new file mode 100755
index 000000000..0619db71e
--- /dev/null
+++ b/src/types/iitc/core/inteltypes.d.ts
@@ -0,0 +1,58 @@
+export namespace Intel {
+ // PLAYER
+ interface PlayerInfo {
+ nickname: string;
+ team: string;
+ ap: string;
+ available_invites: number;
+ energy: number;
+ level: number;
+ min_ap_for_current_level: string;
+ min_ap_for_next_level: string;
+ nickMatcher: RegExp;
+ verified_level: number;
+ xm_capacity: string;
+ }
+
+ // ENTITY
+ type PortalDetails = [];
+ type FieldDetails = [];
+ type LinkDetails = [];
+
+ // CHAT
+ interface ChatCallback {
+ result: ChatLine[];
+ }
+
+ type ChatLine = [/*guid*/ string, /*time*/ number, PlextContainer];
+
+ interface PlextContainer {
+ plext: {
+ plextType: "SYSTEM_BROADCAST" | "SYSTEM_NARROWCAST" | "PLAYER_GENERATED";
+ markup: Array;
+ team: "RESISTANCE" | "ENLIGHTENED";
+ text: string;
+ };
+ }
+
+ type MarkUpPlayer = ["PLAYER", MarkUpPlayerType];
+ interface MarkUpPlayerType {
+ team: string;
+ plain: string;
+ }
+
+ type MarkUpText = ["TEXT", MarkUpTextType];
+ interface MarkUpTextType {
+ plain: string;
+ }
+
+ type MarkUpPortal = ["PORTAL", MarkUpPortalType];
+ interface MarkUpPortalType {
+ latE6: number;
+ lngE6: number;
+ team: string;
+ plain: string;
+ name: string;
+ address: string;
+ }
+}
diff --git a/src/types/iitc/core/location.d.ts b/src/types/iitc/core/location.d.ts
new file mode 100755
index 000000000..14dc3088c
--- /dev/null
+++ b/src/types/iitc/core/location.d.ts
@@ -0,0 +1,13 @@
+export {};
+
+declare global {
+ /** retrieves current position from map and stores it cookies */
+ function storeMapPosition(): void;
+
+ /**
+ * either retrieves the last shown position from a cookie, from the
+ * URL or if neither is present, via Geolocation. If that fails, it
+ * returns a map that shows the whole world.
+ */
+ function getPosition(): void;
+}
diff --git a/src/types/iitc/core/main.d.ts b/src/types/iitc/core/main.d.ts
new file mode 100755
index 000000000..49a1db7da
--- /dev/null
+++ b/src/types/iitc/core/main.d.ts
@@ -0,0 +1,87 @@
+import { FieldGUID, IITC, LinkGUID, PortalGUID } from "./iitctypes";
+import * as jQuery from "jquery";
+import { Intel } from "./inteltypes";
+import { MapDataRequest } from "./map_data_request";
+
+declare global {
+ /** All iitc Pluigns */
+ var plugin: any;
+
+ /** iitc-Pluigns setup/initialize function */
+ var bootPlugins: BootCallback[];
+ type BootCallback = () => void;
+
+ /** if true iitc main script was already loaded (plugin need to trigger setup on iths own) */
+ var iitcLoaded: boolean;
+
+ /** the Leaflet Map */
+ var map: L.Map;
+
+ /** google-api */
+ var gapi: any;
+
+ /** Layer visibilty control */
+ var layerChooser: L.Control.Layers;
+
+ /** Info about current player/agent */
+ var PLAYER: Intel.PlayerInfo;
+
+ /** Request handler */
+ var mapDataRequest: MapDataRequest;
+ var DEFAULT_MAX_IDLE_TIME: number;
+ var DEFAULT_REFRESH: number;
+
+ function startRefreshTimeout(): void;
+
+ /** Load & show Portal Details Window */
+ function renderPortalDetails(guid: PortalGUID | null): void;
+
+ /** Make sure Portal is visible in Window */
+ function zoomToAndShowPortal(guid: PortalGUID, position: L.LatLng): void;
+
+ /** Create Portal-Marker */
+ function createMarker(
+ position: L.LatLng,
+ options: IITC.PortalOptions
+ ): L.CircleMarker;
+
+ // Map Stuff
+ function selectPortalByLatLng(lat: number, lng: number): void;
+
+ /** add Layergroup to leaflets layer-chooser */
+ function addLayerGroup(
+ name: string,
+ layer: L.LayerGroup,
+ defaultVisibile: boolean,
+ groupname?: string
+ ): void;
+
+ /** remove a layer */
+ function removeLayerGroup(layer: L.LayerGroup): void;
+
+ /** get layer visiblity */
+ function isLayerGroupDisplayed(
+ name: string,
+ defaultDisplay?: boolean
+ ): boolean;
+
+ /** set layer visiblity */
+ function updateDisplayedLayerGroup(name: string, display: boolean): void;
+
+ /** escape Html string */
+ function escapeHtmlSpecialChars(name: string): string;
+
+ /** prepare marker for OverlappingMarkerSpiderfier */
+ function registerMarkerForOMS(marker: L.Marker): void;
+
+ /** convert team string to id */
+ function teamStringToId(team: string): number;
+
+ // Android
+ function useAndroidPanes(): boolean;
+ var currentPane: string;
+ function show(paneID: string): void;
+
+ /** update status bar */
+ function renderUpdateStatus(): void;
+}
diff --git a/src/types/iitc/core/map_data_calc_tools.d.ts b/src/types/iitc/core/map_data_calc_tools.d.ts
new file mode 100755
index 000000000..30243d0ab
--- /dev/null
+++ b/src/types/iitc/core/map_data_calc_tools.d.ts
@@ -0,0 +1,59 @@
+export {};
+
+declare global {
+ var TILE_PARAMS: {
+ /**
+ * @default [200000,200000,200000,200000,200000,60000,60000,10000,5000,2500,2500,800,300,0,0];
+ */
+ ZOOM_TO_LINK_LENGTH: number[];
+
+ /**
+ * @default [8,8,8,8,7,7,7,6,6,5,4,4,3,2,2,1,1];
+ */
+ ZOOM_TO_LEVEL: number[];
+
+ /**
+ * @default [1,1,1,40,40,80,80,320,1000,2000,2000,4000,8000,16000,16000,32000];
+ */
+ TILES_PER_EDGE: number[];
+ };
+
+ /**
+ * Ingress Intel splits up requests for map data (portals, links,fields) into tiles. To get data for the current viewport
+ * (i.e. what is currently visible) it first calculates which tiles intersect.
+ * For all those tiles, it then calculates the lat/lng bounds of that tile and a quadkey.
+ * Both the bounds and the quadkey are “somewhat” required to get complete data.
+ *
+ * Conversion functions courtesy of @link http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
+ */
+ function setupDataTileParams(): void;
+
+ interface MapZoomTileParameters {
+ level: number;
+ tilesPerEdge: number;
+ minLinkLength: number;
+ hasPortals: boolean;
+ zoom: number;
+ }
+
+ function getMapZoomTileParameters(zoom: number): MapZoomTileParameters;
+
+ /**
+ * we can fetch data at a zoom level different to the map zoom.
+ * To improve the cacheing performance, we try and limit the number of zoom levels we retrieve data for
+ * to avoid impacting server load, we keep ourselves restricted to a zoom level with the sane number
+ * of tilesPerEdge and portal levels visible
+ */
+ function getDataZoomForMapZoom(mapZoom: number): number;
+
+ function lngToTile(lng: number, params: MapZoomTileParameters): number;
+ function latToTile(lat: number, params: MapZoomTileParameters): number;
+ function tileToLng(x: number, params: MapZoomTileParameters): number;
+ function tileToLat(y: number, params: MapZoomTileParameters): number;
+
+ function pointToTileId(
+ params: MapZoomTileParameters,
+ x: number,
+ y: number
+ ): string;
+}
diff --git a/src/types/iitc/core/map_data_debug.d.ts b/src/types/iitc/core/map_data_debug.d.ts
new file mode 100755
index 000000000..6dc788b0f
--- /dev/null
+++ b/src/types/iitc/core/map_data_debug.d.ts
@@ -0,0 +1,36 @@
+/** useful bits to assist debugging map data tiles */
+export type DebugTileState =
+ | "ok"
+ | "error"
+ | "cache-fresh"
+ | "cache-stale"
+ | "requested"
+ | "retrying"
+ | "request-fail"
+ | "tile-fail"
+ | "tile-timeout"
+ | "render-queue";
+
+declare global {
+ export class RenderDebugTiles {
+ CLEAR_CHECK_TIME: number; // = 0.1;
+ FADE_TIME: number; // = 1.0;
+
+ private debugTileLayer: L.LayerGroup;
+ private debugTileToRectangle: {};
+ private debugTileClearTimes: {};
+ private timer?: number | undefined;
+
+ reset(): void;
+ create(id: string, bounds: L.LatLngBounds): void;
+ setColour(id: string, borercol: string, fillcol: string): void;
+ setState(id: string, state: DebugTileState): void;
+
+ /**
+ * @param waitTime in msec
+ */
+ startTimer(waitTime: number): void;
+
+ runClearPass(): void;
+ }
+}
diff --git a/src/types/iitc/core/map_data_render.d.ts b/src/types/iitc/core/map_data_render.d.ts
new file mode 100755
index 000000000..302633d11
--- /dev/null
+++ b/src/types/iitc/core/map_data_render.d.ts
@@ -0,0 +1,66 @@
+import * as L from "leaflet";
+import { IITC } from "./iitctypes";
+import { Intel } from "./inteltypes";
+
+/** class to handle rendering into leaflet the JSON data from the servers */
+export class Render {
+ portalMarkerScale?: number | undefined;
+
+ private isRendering: boolean;
+
+ /** object - represents the set of all deleted game entity GUIDs seen in a render pass */
+ private deletedGuid: {};
+ private seenPortalsGuid: {};
+ private seenLinksGuid: {};
+ private seenFieldsGuid: {};
+ private bounds: L.LatLngBounds;
+ private level: number;
+
+ /** start a render pass. called as we start to make the batch of data requests to the servers */
+ startRenderPass(level: number, bounds: L.LatLngBounds): void;
+
+ clearPortalsOutsideBounds(bounds: L.LatLngBounds): void;
+ clearFieldsOutsideBounds(bounds: L.LatLngBounds): void;
+
+ /** process deleted entity list and entity data */
+ processTileData(tiledata: any): void;
+
+ processDeletedGameEntityGuids(deleted: {}): void;
+ processGameEntities(entities: {}): void;
+
+ /**
+ * End a render pass. does any cleaning up required, postponed processing of data, etc. called when the render
+ * is considered complete
+ */
+ endRenderPass(): void;
+
+ bringPortalsToFront(): void;
+ deleteEntity(guid: string): void;
+ deletePortalEntity(guid: string): void;
+ deleteLinkEntity(guid: string): void;
+ deleteFieldEntity(guid: string): void;
+
+ /**
+ * intel no longer returns portals at anything but the closest zoom
+ * stock intel creates 'placeholder' portals from the data in links/fields - IITC needs to do the same
+ * we only have the portal guid, lat/lng coords, and the faction - no other data
+ * having the guid, at least, allows the portal details to be loaded once it's selected. however,
+ * no highlighters, portal level numbers, portal names, useful counts of portals, etc are possible
+ */
+ createPlaceholderPortalEntity(
+ guid: string,
+ latE6: number,
+ lngE6: number,
+ team: "E" | "R" | "N"
+ ): void;
+
+ createPortalEntity(ent: Intel.PortalDetails): void;
+ createFieldEntity(ent: Intel.FieldDetails): void;
+ createLinkEntity(ent: Intel.LinkDetails): void;
+
+ rescalePortalMarkers(): void;
+
+ /** add the portal to the visible map layer */
+ addPortalToMapLayer(portal: IITC.Portal): void;
+ removePortalFromMapLayer(portal: IITC.Portal): void;
+}
diff --git a/src/types/iitc/core/map_data_request.d.ts b/src/types/iitc/core/map_data_request.d.ts
new file mode 100755
index 000000000..cf8111484
--- /dev/null
+++ b/src/types/iitc/core/map_data_request.d.ts
@@ -0,0 +1,159 @@
+import { DataCache } from "./data_cache";
+//import { RenderDebugTiles } from './map_data_debug';
+import { Render } from "./map_data_render";
+
+export interface MapDataRequestStatus {
+ short: string;
+ long?: string | undefined;
+ progress?: number | undefined;
+}
+
+/**
+ * class to request the map data tiles from the Ingress servers
+ * and then pass it on to the render class for display purposes
+ * Uses the map data cache class to reduce network requests
+ */
+export class MapDataRequest {
+ cache: DataCache;
+ render: Render;
+ debugTiles: RenderDebugTiles;
+
+ activeRequestCount: number;
+ requestedTiles: {};
+ renderQueue: [];
+ renderQueueTimer?: number | undefined;
+ renderQueuePaused: boolean;
+ idle: boolean;
+
+ cachedTileCount: number;
+ requestedTileCount: number;
+ successTileCount: number;
+ failedTileCount: number;
+ staleTileCount: number;
+
+ private status: MapDataRequestStatus;
+
+ /** a 'set' to keep track of hard failures for tiles */
+ tileErrorCount: {};
+
+ /**
+ * the 'set' of requested tile QKs
+ */
+ queuedTiles: {};
+
+ /** store the parameters used for fetching the data. used to prevent unneeded refreshes after move/zoom */
+ private fetchedDataParams: any;
+
+ /**
+ * no more than this many requests in parallel. stock site seems to rely on browser limits (6, usually), sending
+ * many requests at once.
+ * using our own queue limit ensures that other requests (e.g. chat, portal details) don't get delayed
+ * @default 5
+ */
+ MAX_REQUESTS: number;
+
+ /**
+ * this many tiles in one request
+ * @default 25
+ */
+ NUM_TILES_PER_REQUEST: number;
+
+ /**
+ * number of times to retry a tile after an error (including "error: TIMEOUT" now - as stock intel does)
+ * TODO? different retry counters for TIMEOUT vs other errors..?
+ * @default 5
+ */
+ MAX_TILE_RETRIES: number;
+
+ // refresh timers
+ MOVE_REFRESH: number; // = 3; //time, after a map move (pan/zoom) before starting the refresh processing
+ STARTUP_REFRESH: number; // = 3; //refresh time used on first load of IITC
+ IDLE_RESUME_REFRESH: number; // = 5; //refresh time used after resuming from idle
+
+ /**
+ * after one of the above, there's an additional delay between preparing the refresh (clearing out of bounds,
+ * processing cache, etc) and actually sending the first network requests
+ * delay after preparing the data download before tile requests are sent
+ * @default 1
+ */
+ DOWNLOAD_DELAY: number;
+
+ /**
+ * a short delay between one request finishing and the queue being run for the next request.
+ * @default 0
+ */
+ RUN_QUEUE_DELAY: number;
+
+ /**
+ * delay before processing the queue after failed requests
+ * longer delay before doing anything after errors (other than TIMEOUT)
+ * @default 5
+ */
+ BAD_REQUEST_RUN_QUEUE_DELAY: number;
+
+ /**
+ * delay before processing the queue after empty responses
+ * also long delay - empty responses are likely due to some server issues
+ * @default 5
+ */
+ EMPTY_RESPONSE_RUN_QUEUE_DELAY: number;
+
+ /**
+ * delay before processing the queue after error==TIMEOUT requests. this is 'expected', so minimal extra delay over the regular RUN_QUEUE_DELAY
+ * @default 0
+ */
+ TIMEOUT_REQUEST_RUN_QUEUE_DELAY: number;
+
+ /**
+ * render queue
+ * number of items to process in each render pass. there are pros and cons to smaller and larger values
+ * (however, if using leaflet canvas rendering, it makes sense to push as much as possible through every time)
+ */
+ RENDER_BATCH_SIZE: number;
+
+ /**
+ * delay before repeating the render loop. this gives a better chance for user interaction
+ * 0.1sec desktop, 0.2sec mobile
+ */
+ RENDER_PAUSE: number;
+
+ /**
+ * refresh time to use for close views z>12 when not idle and not moving
+ * @default 300
+ */
+ REFRESH_CLOSE: number;
+
+ /**
+ * refresh time for far views z <= 12
+ * @default 900
+ */
+ REFRESH_FAR: number;
+
+ /**
+ * minimum refresh time is based on the time to complete a data fetch, times this value
+ * @default 2
+ */
+ FETCH_TO_REFRESH_FACTOR: number;
+
+ start(): void;
+ mapMoveStart(): void;
+ mapMoveEnd(): void;
+ idleResume(): void;
+ clearTimeout(): void;
+ refreshOnTimeout(delayInSeconds: number): void;
+ setStatus(short: string, long?: string, progress?: number): void;
+ getStatus(): MapDataRequestStatus;
+ refresh(): void;
+
+ delayProcessRequestQueue(delayInSeconds: number): void;
+ processRequestQueue(boolean): void;
+ sendTileRequest(tiles: string[]): void;
+ requeueTile(id: string, error: boolean): void;
+ private handleResponse(data: any, tiles: string[], success: boolean): void;
+ resetRenderQueue(): void;
+ pushRenderQueue(id: string, data: any, status: any): void;
+
+ startQueueTimer(delayInSecond: number): void;
+ pauseRenderQueue(pause: boolean): void;
+ processRenderQueue(): void;
+}
diff --git a/src/types/iitc/core/ornaments.d.ts b/src/types/iitc/core/ornaments.d.ts
new file mode 100755
index 000000000..afe1d9748
--- /dev/null
+++ b/src/types/iitc/core/ornaments.d.ts
@@ -0,0 +1,36 @@
+import { IITC } from "./iitctypes";
+
+export {};
+
+declare global {
+ /**
+ * Added as part of the Ingress #Helios in 2014, ornaments
+ * are additional image overlays for portals.
+ *
+ * currently there are 6 known types of ornaments: ap$x$suffix
+ * - cluster portals (without suffix)
+ * - volatile portals (_v)
+ * - meeting points (_start)
+ * - finish points (_end)
+ *
+ * Beacons and Frackers were introduced at the launch of the Ingress
+ * ingame store on November 1st, 2015
+ * - Beacons (pe$TAG - $NAME) ie: 'peNIA - NIANTIC'
+ * - Frackers ('peFRACK')
+ * (there are 7 different colors for each of them)
+ */
+ class Ornaments {
+ _portals: {};
+ _layer: L.LayerGroup;
+ _beacons: L.LayerGroup;
+ _frackers: L.LayerGroup;
+ OVERLAY_SIZE: number; // 60,
+ OVERLAY_OPACITY: number; // 0.6,
+
+ setup(): void;
+ addPortal(portal: IITC.Portal): void;
+ removePortal(portal: IITC.Portal): void;
+ }
+
+ const ornaments: Ornaments;
+}
diff --git a/src/types/iitc/core/panes.d.ts b/src/types/iitc/core/panes.d.ts
new file mode 100755
index 000000000..127b598fb
--- /dev/null
+++ b/src/types/iitc/core/panes.d.ts
@@ -0,0 +1,8 @@
+export {};
+
+declare global {
+ var currentPane: string;
+
+ function show(id: string): void;
+ function hideall(): void;
+}
diff --git a/src/types/iitc/core/player_names.d.ts b/src/types/iitc/core/player_names.d.ts
new file mode 100755
index 000000000..b2317402c
--- /dev/null
+++ b/src/types/iitc/core/player_names.d.ts
@@ -0,0 +1,8 @@
+export {};
+
+declare global {
+ /**
+ * test to see if a specific player GUID is a special system account (e.g. __JARVIS__, __ADA__) that shouldn't be listed as a player
+ */
+ function isSystemPlayer(name: string): boolean;
+}
diff --git a/src/types/iitc/core/portal_data.d.ts b/src/types/iitc/core/portal_data.d.ts
new file mode 100755
index 000000000..76857b6b7
--- /dev/null
+++ b/src/types/iitc/core/portal_data.d.ts
@@ -0,0 +1,61 @@
+import { FieldGUID, LinkGUID, PortalGUID } from "./iitctypes";
+export {};
+
+declare global {
+ /**
+ * Get Links of portal
+ * search through the links data for all that link from or to a portal. returns an object with separate lists of in
+ * and out links. may or may not be as accurate as the portal details, depending on how much data the API returns
+ */
+ function getPortalLinks(guid: PortalGUID): {
+ in: LinkGUID[];
+ out: LinkGUID[];
+ };
+ function getPortalLinksCount(guid: PortalGUID): number;
+
+ /**
+ * Get Fields of portal
+ * search through the fields for all that reference a portal
+ */
+ function getPortalFields(guid: PortalGUID): FieldGUID[];
+ function getPortalFields(guid: PortalGUID): number;
+
+ /**
+ * find the lat/lon for a portal, using any and all available data
+ * (we have the list of portals, the cached portal details, plus links and fields as sources of portal locations)
+ */
+ function findPortalLatLng(guid: PortalGUID): L.LatLng | undefined;
+
+ /** find guid by position E6 */
+ function findPortalGuidByPositionE6(
+ latE6: number,
+ lngE6: number
+ ): PortalGUID | null;
+ function pushPortalGuidPositionCache(
+ guid: PortalGUID,
+ latE6: number,
+ lngE6: number
+ ): void;
+
+ /**
+ * get the AP gains from a portal, based only on the brief summary data from portals, links and fields
+ * not entirely accurate - but available for all portals on the screen
+ */
+ function getPortalApGain(guid: PortalGUID): number | undefined;
+
+ /**
+ * given counts of resonators, links and fields, calculate the available AP
+ * doesn't take account AP for resonator upgrades or AP for adding mods
+ */
+ function portalApGainMaths(
+ resCount: number,
+ linkCount: number,
+ fieldCount: number
+ ): {
+ friendlyAp: number;
+ enemyAp: number;
+ destroyAp: number;
+ destroyResoAp: number;
+ captureAp: number;
+ };
+}
diff --git a/src/types/iitc/core/portal_detail.d.ts b/src/types/iitc/core/portal_detail.d.ts
new file mode 100755
index 000000000..af0710095
--- /dev/null
+++ b/src/types/iitc/core/portal_detail.d.ts
@@ -0,0 +1,23 @@
+import { IITC } from "./iitctypes";
+
+export {};
+
+declare global {
+ class PortalDetail {
+ setup(): void;
+
+ /** Get portal detail from cache */
+ get(guid: string): IITC.PortalDataDetail | undefined;
+
+ /** Get portal detail from cache */
+ isFresh(guid: string): boolean | undefined;
+
+ /**
+ * Request Portal details from server
+ * NB: you shouldn't use it.
+ */
+ request(guid: string): JQuery.Promise;
+ }
+
+ var portalDetail: PortalDetail;
+}
diff --git a/src/types/iitc/core/portal_detail_display.d.ts b/src/types/iitc/core/portal_detail_display.d.ts
new file mode 100755
index 000000000..c0170e59c
--- /dev/null
+++ b/src/types/iitc/core/portal_detail_display.d.ts
@@ -0,0 +1,26 @@
+import { IITC, PortalGUID } from "./iitctypes";
+
+export {};
+
+declare global {
+ function resetScrollOnNewPortal(): void;
+
+ function renderPortalDetails(guid: PortalGUID): void;
+ function getPortalMiscDetails(
+ guid: PortalGUID,
+ details?: IITC.PortalDataDetail
+ ): string;
+
+ /**
+ * draws link-range and hack-range circles around the portal with the
+ * given details. Clear them if parameter 'd' is null.
+ */
+ function setPortalIndicators(p: IITC.Portal): void;
+
+ /**
+ * highlights portal with given GUID. Automatically clears highlights
+ * on old selection. Returns false if the selected portal changed.
+ * @returns true if it's still the same portal that just needs an update.
+ */
+ function selectPortal(guid: PortalGUID): boolean;
+}
diff --git a/src/types/iitc/core/portal_detail_display_tools.d.ts b/src/types/iitc/core/portal_detail_display_tools.d.ts
new file mode 100755
index 000000000..9ec72598a
--- /dev/null
+++ b/src/types/iitc/core/portal_detail_display_tools.d.ts
@@ -0,0 +1,57 @@
+import { IITC } from "./iitctypes";
+
+export {};
+
+declare global {
+ /**
+ * returns displayable text+link about portal range
+ */
+ function getRangeText(d: IITC.PortalDataDetail): string[];
+
+ /**
+ * given portal details, returns html code to display mod details.
+ */
+ function getModDetails(d: IITC.PortalDataDetail): string;
+
+ function getEnergyText(d: IITC.PortalDataDetail): string[];
+
+ /**
+ * octant=slot: 0=E, 1=NE, 2=N, 3=NW, 4=W, 5=SW, 6=S, SE=7
+ * resos in the display should be ordered like this:
+ * N NE Since the view is displayed in rows, they
+ * NW E need to be ordered like this: N NE NW E W SE SW S
+ * W SE i.e. 2 1 3 0 4 7 5 6
+ * SW S
+ * note: as of 2014-05-23 update, this is not true for portals with empty slots!
+ */
+ function getResonatorDetails(d: IITC.PortalDataDetail): string;
+
+ /**
+ * helper function that renders the HTML for a given resonator. Does
+ * not work with raw details-hash. Needs digested infos instead:
+ * slot: which slot this resonator occupies. Starts with 0 (east) and
+ * rotates clockwise. So, last one is 7 (southeast).
+ */
+ function renderResonatorDetails(
+ slot: number,
+ level: number,
+ nrg: string,
+ nick: string
+ ): string[];
+
+ /**
+ * calculate AP gain from destroying portal and then capturing it by deploying resonators
+ */
+ function getAttackApGainText(
+ d: IITC.PortalDataDetail,
+ fieldCount: number,
+ linkCount: number
+ ): string[];
+
+ function getHackDetailsText(d: IITC.PortalDataDetail): string[];
+
+ function getMitigationText(
+ d: IITC.PortalDataDetail,
+ linkCount: number
+ ): string[];
+}
diff --git a/src/types/iitc/core/portal_highlighter.d.ts b/src/types/iitc/core/portal_highlighter.d.ts
new file mode 100755
index 000000000..a9597f5e6
--- /dev/null
+++ b/src/types/iitc/core/portal_highlighter.d.ts
@@ -0,0 +1,29 @@
+import { IITC } from "./iitctypes";
+
+export {};
+
+declare global {
+ interface Hightligher {
+ hightlight: (portal: IITC.Portal) => void;
+ }
+
+ /** an object mapping highlighter names to the object containing callback functions */
+ var _highlighters: { [name: string]: Hightligher } | null;
+
+ /** the name of the current highlighter */
+ var _current_highlighter: string;
+
+ /**
+ * = "No Highlights"
+ */
+ var _no_highlighter: string;
+
+ function addPortalHighlighter(name: string, data: Hightligher): void;
+
+ // (re)creates the highlighter dropdown list
+ function updatePortalHighlighterControl(): void;
+ function changePortalHighlights(name: string): void;
+
+ function highlightPortal(p: IITC.Portal): void;
+ function resetHighlightedPortals(): void;
+}
diff --git a/src/types/iitc/core/portal_info.d.ts b/src/types/iitc/core/portal_info.d.ts
new file mode 100755
index 000000000..f0084749d
--- /dev/null
+++ b/src/types/iitc/core/portal_info.d.ts
@@ -0,0 +1,93 @@
+import { IITC } from "./iitctypes";
+
+export {};
+
+declare global {
+ /**
+ * returns a float. Displayed portal level is always rounded down from that value.
+ */
+ function getPortalLevel(d: IITC.PortalDataDetail): number;
+
+ function getTotalPortalEnergy(d: IITC.PortalDataDetail): number;
+
+ /**
+ * @deprecated use getTotalPortalEnergy (just renamed)
+ */
+ function getPortalEnergy(d: IITC.PortalDataDetail): number;
+
+ function getCurrentPortalEnergy(d: IITC.PortalDataDetail): number;
+
+ /**
+ * formula by the great gals and guys at
+ * @link http://decodeingress.me/2012/11/18/ingress-portal-levels-and-link-range/
+ */
+ function getPortalRange(d: IITC.PortalDataDetail): number;
+
+ /** additional range boost calculation */
+ function getLinkAmpRangeBoost(d: IITC.PortalDataDetail): number;
+
+ function getAttackApGain(
+ d: IITC.PortalDataDetail,
+ fieldCount: number,
+ linkCount: number
+ ): {
+ friendlyAp: number;
+ deployCount: number;
+ upgradeCount: number;
+ enemyAp: number;
+ destroyAp: number;
+ resoAp: number;
+ captureAp: number;
+ };
+
+ /** This function will return the potential level a player can upgrade it to */
+ function potentialPortalLevel(d: IITC.PortalDataDetail): number;
+
+ function fixPortalImageUrl(url: string): string;
+
+ function getPortalModsByType(
+ d: IITC.PortalDataDetail,
+ type: IITC.ModType
+ ): IITC.Mod[];
+
+ function getPortalShieldMitigation(d: IITC.PortalDataDetail): number;
+ function getPortalLinkDefenseBoost(d: IITC.PortalDataDetail): number;
+ function getPortalLinksMitigation(linkCount: number): number;
+ function getPortalMitigationDetails(
+ d: IITC.PortalDataDetail,
+ linkCount: number
+ ): {
+ shields: number;
+ links: number;
+ linkDefenseBoost: number;
+ excess: number;
+ };
+ function getMaxOutgoingLinks(d: IITC.PortalDataDetail): number;
+
+ function getPortalHackDetails(d: IITC.PortalDataDetail): {
+ cooldown: number;
+ hacks: number;
+ burnout: number;
+ };
+
+ /**
+ * given a detailed portal structure, return summary portal data, as seen in the map tile data
+ */
+ function getPortalSummaryData(d: IITC.PortalDataDetail): {
+ level: number;
+ title: string;
+ image: string;
+ resCount: number;
+ latE6: number;
+ health: number;
+ team: number;
+ lngE6: number;
+ type: "portal";
+ };
+
+ function getPortalAttackValues(d: IITC.PortalDataDetail): {
+ hit_bonus: number;
+ force_amplifier: number;
+ attack_frequency: number;
+ };
+}
diff --git a/src/types/iitc/core/portal_marker.d.ts b/src/types/iitc/core/portal_marker.d.ts
new file mode 100755
index 000000000..bb9fc4f2c
--- /dev/null
+++ b/src/types/iitc/core/portal_marker.d.ts
@@ -0,0 +1,16 @@
+import { IITC } from "./iitctypes";
+
+export {};
+
+declare global {
+ function portalMarkerScale(): number;
+
+ /**
+ * create a new marker. 'data' contain the IITC-specific entity data to be stored in the object options
+ */
+ function createMarker(latlng: L.LatLng, data: IITC.PortalData): IITC.Portal;
+
+ function setMarkerStyle(marker: IITC.Portal, selected: boolean): void;
+
+ function getMarkerStyleOptions(details: IITC.PortalOptions): L.PathOptions;
+}
diff --git a/src/types/iitc/core/redeeming.d.ts b/src/types/iitc/core/redeeming.d.ts
new file mode 100755
index 000000000..e7dfadd1a
--- /dev/null
+++ b/src/types/iitc/core/redeeming.d.ts
@@ -0,0 +1,25 @@
+export {};
+
+declare global {
+ interface ResultData {
+ other: string[];
+ xm: string;
+ ap: string;
+ inventory: any;
+ }
+ var REDEEM_SHORT_NAMES: { [key: string]: string };
+
+ /** These are HTTP status codes returned by the redemption API. */
+ var REDEEM_STATUSES: { [key: number]: string };
+
+ function handleRedeemResponse(
+ data: ResultData,
+ textStatus: any,
+ jqXHR: JQuery.jqXHR
+ ): void;
+
+ function formatPasscodeLong(data: ResultData): void;
+ function formatPasscodeShort(data: ResultData): void;
+
+ function setupRedeem(): void;
+}
diff --git a/src/types/iitc/core/region_scoreboard.d.ts b/src/types/iitc/core/region_scoreboard.d.ts
new file mode 100755
index 000000000..460ae644c
--- /dev/null
+++ b/src/types/iitc/core/region_scoreboard.d.ts
@@ -0,0 +1,15 @@
+export {};
+
+declare global {
+ class RegionScoreboard_ {
+ HistoryChart: HistoryChart_;
+ setup(): void;
+ shwoDialog(): void;
+ }
+
+ class HistoryChart_ {
+ create(_regionScore: RegionScoreboard_, logscale: boolean): void;
+ }
+
+ var RegionScoreboard: RegionScoreboard_;
+}
diff --git a/src/types/iitc/core/request_handling.d.ts b/src/types/iitc/core/request_handling.d.ts
new file mode 100755
index 000000000..0654b6e25
--- /dev/null
+++ b/src/types/iitc/core/request_handling.d.ts
@@ -0,0 +1,37 @@
+export {};
+
+declare global {
+ var activeRequests: JQuery.jqXHR[];
+
+ /** failed data requests calls */
+ var failedRequestCount: number;
+
+ var statusTotalMapTiles: number;
+ var statusCachedMapTiles: number;
+ var statusSuccessMapTiles: number;
+ var statusStaleMapTiles: number;
+ var statusErrorMapTiles: number;
+
+ class Requests {
+ add(ajax: JQuery.jqXHR): void;
+ remove(ajax: JQuery.jqXHR): void;
+ abort(): void;
+
+ /**
+ * sets the timer for the next auto refresh. Ensures only one timeout
+ * is queued. May be given 'override' in milliseconds if time should
+ * not be guessed automatically. Especially useful if a little delay
+ * is required, for example when zooming.
+ */
+ startRefreshTimeout(override: number): void;
+
+ /**
+ * add method here to be notified of auto-refreshes
+ */
+ addRefreshFunction(fct: () => void): void;
+
+ isLastRequest(ajax: JQuery.jqXHR): boolean;
+ }
+
+ var requests: Requests;
+}
diff --git a/src/types/iitc/core/search.d.ts b/src/types/iitc/core/search.d.ts
new file mode 100755
index 000000000..b2f55a1b1
--- /dev/null
+++ b/src/types/iitc/core/search.d.ts
@@ -0,0 +1,72 @@
+export {};
+
+declare global {
+ /**
+ * you can implement your own result provider by listing to the search @see hook:
+ * addHook('search', function(query: SearchQuery) {});
+ */
+ class SearchQuery {
+ /** the term for which the user has searched */
+ term: string;
+
+ /**
+ * indicating if the user has pressed enter after searching. You should not search online or
+ * do heavy processing unless the user has confirmed the search term
+ */
+ confirmed: boolean;
+
+ /** called to add a result to the query */
+ addResult(result: SearchResult): void;
+
+ private init(): void;
+ private show(): void;
+ private hide(): void;
+ private resultLayer(result: SearchResult): L.LayerGroup;
+ private onResultSelected(result: SearchResult, event: any): void;
+ private removeSelectedResult(): void;
+ private onResultHoverStart(result: SearchResult, event: any): void;
+ private removeHoverResult(): void;
+ private onResultHoverEnd(result: SearchResult, event: any): void;
+ }
+
+ type SearchResult = SearchResultPosition | SearchResultBounds;
+ interface SearchResultPosition extends SearchResultBase {
+ position: L.LatLngExpression;
+ }
+
+ interface SearchResultBounds extends SearchResultBase {
+ bounds: L.LatLngBoundsExpression;
+ }
+
+ interface SearchResultBase {
+ /** Will be interpreted as HTML, so make sure to escape properly. */
+ title: string;
+ /** secondary information for this result.Will be interpreted as HTML, so make sure to escape properly. */
+ description: JQuery | any[] | Element | Text | string;
+ /** a ILayer to be added to the map when the user selects this search result. Will be generated if not set. Set to `null` to prevent the result from being added to the map. */
+ layer?: L.Layer | undefined;
+ /** a URL to a icon to display in the result list. Should be 12x12. */
+ icon?: string | undefined;
+ /**
+ * a handler to be called when the result is selected. May return `true` to prevent the map from being repositioned.
+ * You may reposition the map yourself or do other work.
+ */
+ onSelected?:
+ | ((result: SearchResult, event: UIEvent) => boolean | undefined)
+ | undefined;
+ /**
+ * a handler to be called when the result is removed from the map(because another result has been
+ * selected or the search was cancelled by the user).
+ */
+ onRemove?: ((result: SearchResult) => void) | undefined;
+ }
+
+ class Search {
+ lastSearch: SearchQuery | null;
+
+ doSearch(term: string, confirmed: boolean): void;
+ setup(): void;
+ }
+
+ var search: Search;
+}
diff --git a/src/types/iitc/core/send_request.d.ts b/src/types/iitc/core/send_request.d.ts
new file mode 100755
index 000000000..770ad839e
--- /dev/null
+++ b/src/types/iitc/core/send_request.d.ts
@@ -0,0 +1,28 @@
+export {};
+
+declare global {
+ /**
+ * posts AJAX request to Ingress API.
+ * @param action last part of the actual URL, the rpc/dashboard. is added automatically
+ * @param data JSON data to post. method will be derived automatically from action, but may
+ * be overridden. Expects to be given Hash. Strings are not supported.
+ * @param successCallback method to call on success. See jQuery API docs for available arguments: http://api.jquery.com/jQuery.ajax/
+ * @param errorCallback see above. Additionally it is logged if the request failed.
+ */
+ function postAjax(
+ action: string,
+ data: any,
+ successCallback: (
+ data: any,
+ textStatus: string,
+ jqXHR: JQuery.jqXHR
+ ) => void,
+ errorCallback: (
+ jqXHR: JQuery.jqXHR,
+ textStatus: string,
+ errorThrown: string
+ ) => void
+ ): any;
+
+ function outOfDateUserPrompt(): void;
+}
diff --git a/src/types/iitc/core/smartphone.d.ts b/src/types/iitc/core/smartphone.d.ts
new file mode 100755
index 000000000..ec70241be
--- /dev/null
+++ b/src/types/iitc/core/smartphone.d.ts
@@ -0,0 +1,24 @@
+import { PortalGUID } from "./iitctypes";
+
+export {};
+
+declare global {
+ /**
+ * this check is also used in main.js. Note it should not detect
+ * tablets because their display is large enough to use the desktop version.
+ *
+ * The stock intel site allows forcing mobile/full sites with a vp=m or vp=f
+ * parameter - let's support the same. (stock only allows this for some
+ * browsers - e.g. android phone/tablet. let's allow it for all, but
+ * no promises it'll work right)
+ */
+ function isSmartphone(): boolean;
+
+ function runOnSmartphonesBeforeBoot(): void;
+ function runOnSmartphonesAfterBoot(): void;
+
+ function smartphoneInfo(data: { selectedPortalGuid: PortalGUID }): void;
+
+ function setAndroidPermalink(): void;
+ function useAndroidPanes(): boolean;
+}
diff --git a/src/types/iitc/core/utils_file.d.ts b/src/types/iitc/core/utils_file.d.ts
new file mode 100755
index 000000000..649d8a619
--- /dev/null
+++ b/src/types/iitc/core/utils_file.d.ts
@@ -0,0 +1,11 @@
+export {};
+
+declare global {
+ function saveAs(data: any, filename: string, dataType: string): void;
+
+ /**
+ * Save data to file with given filename, using IITCm file chooser, or generic browser routine.
+ * `dataType` can be set to filter IITCm file chooser filetypes.
+ */
+ function saveFile(data: string, filename?: string, dataType?: string): void;
+}
diff --git a/src/types/iitc/core/utils_misc.d.ts b/src/types/iitc/core/utils_misc.d.ts
new file mode 100755
index 000000000..dcd76bd97
--- /dev/null
+++ b/src/types/iitc/core/utils_misc.d.ts
@@ -0,0 +1,146 @@
+import * as L from "leaflet";
+
+declare global {
+ /**
+ * Show about dialog
+ *
+ * Plugins metadata come from 2 sources:
+ * - buildName, pluginId, dateTimeVersion: inserted in plugin body by build script
+ * (only standard plugins)
+ * - script.name/version/description: from GM_info object, passed to wrapper
+ * `script` may be not available if userscript manager does not provede GM_info
+ * (atm: IITC-Mobile for iOS)
+ */
+ function aboutIITC(): void;
+
+ function layerGroupLength(layerGroup: L.LayerGroup): number;
+
+ /** retrieves parameter from the URL?query=string. */
+ function getURLParam(param: string): string;
+
+ /**
+ * read cookie by name.
+ * https://stackoverflow.com/a/5639455/1684530 by cwolves
+ */
+ function readCookie(name: string): string;
+
+ function writeCookie(name: string, val: string): void;
+
+ function eraseCookie(name: string): void;
+
+ /**
+ * certain values were stored in cookies, but we're better off using localStorage instead - make it easy to convert
+ */
+ function convertCookieToLocalStorage(name: string): void;
+
+ /**
+ * add thousand separators to given number.
+ * https://stackoverflow.com/a/1990590/1684530 by Doug Neiner.
+ */
+ function digits(d: number | string): string;
+
+ function zeroPad(num: number, pad: number): string;
+
+ function unixTimeToString(
+ time?: string | number | Date,
+ full?: boolean
+ ): string;
+
+ /**
+ * convert time to string
+ * converts a javascript time to a precise date and time (optionally with millisecond precision)
+ * formatted in ISO-style YYYY-MM-DD hh:mm:ss.mmm - but using local timezone
+ */
+ function unixTimeToDateTimeString(
+ ticks: number | string | Date,
+ millisecond?: boolean
+ ): string;
+
+ /** convert time to string */
+ function unixTimeToHHmm(time: number | string | Date): string;
+
+ /** format time difference */
+ function formatInterval(seconds: number, maxTerms?: number): string;
+
+ function rangeLinkClick(): void;
+ function showPortalPosLinks(lat: number, lng: number, name?: string): void;
+
+ function isTouchDevice(): boolean;
+
+ function androidCopy(text: string): boolean;
+
+ function getCurrentZoomTileParameters(): any; // return getMapZoomTileParameters()
+
+ /** returns number of pixels left to scroll down before reaching the bottom. */
+ function scrollBottom(element: string | JQuery): number;
+
+ function zoomToAndShowPortal(guid: string, latlng: L.LatLng): void;
+
+ function selectPortalByLatLng(
+ lat: number | L.LatLng | [number, number],
+ lng?: number
+ ): void;
+
+ /**
+ * escape a javascript string, so quotes and backslashes are escaped with a backslash
+ * (for strings passed as parameters to html onclick="..." for example)
+ */
+ function escapeJavascriptString(str: string): string;
+
+ /** escape special characters, such as tags */
+ function escapeHtmlSpecialChars(str: string): string;
+
+ function prettyEnergy(nrg: number): string;
+
+ function uniqueArray(arr: any[]): any[];
+
+ function genFourColumnTable(blocks: any[]): string;
+
+ /** converts given text with newlines (\n) and tabs (\t) to a HTML table automatically. */
+ function convertTextToTableMagic(text: string): string;
+
+ /**
+ * Given 3 sets of points in an array[3]{lat, lng} returns the area of the triangle
+ * NOTE: not geodesic area!
+ */
+ function calcTriArea(p: [L.LatLng, L.LatLng, L.LatLng]): number;
+
+ /** Update layerGroups display status to window.overlayStatus and localStorage 'ingress.intelmap.layergroupdisplayed' */
+ function updateDisplayedLayerGroup(name: string, display: boolean): void;
+
+ /**
+ * Read layerGroup status from window.overlayStatus if it was added to map,
+ * read from cookie if it has not added to map yet.
+ * @return 'defaultDisplay' if both overlayStatus and cookie didn't have the record
+ */
+ function isLayerGroupDisplayed(
+ name: string,
+ defaultDisplay: boolean
+ ): boolean;
+
+ function addLayerGroup(
+ name: string,
+ layerGroup: L.LayerGroup,
+ defaultDisplay?: boolean
+ ): void;
+
+ function removeLayerGroup(layerGroup: L.LayerGroup): void;
+
+ function clampLatLng(latlng: L.LatLng): L.LatLng;
+
+ function clampLatLngBounds(bounds: L.LatLngBounds): L.LatLngBounds;
+
+ /**
+ * Makes the permalink for the portal with specified latlng, possibly including current map view.
+ * Portal latlng can be omitted to create mapview-only permalink.
+ * @param option:
+ * - includeMapView: Boolean = null
+ * Use to add zoom level and latlng of current map center.
+ * - fullURL: Boolean = null
+ * Use to make absolute fully qualified URL (default: relative link).
+ */
+ function makePermalink(latlng: L.LatLng, options?: {}): string;
+
+ // TODO: String.prototype.capitalize = (): string;
+ // TODO: String.prototype.startsWith = (string): boolean;
+}
diff --git a/src/types/iitc/index.d.ts b/src/types/iitc/index.d.ts
new file mode 100755
index 000000000..abe0215de
--- /dev/null
+++ b/src/types/iitc/index.d.ts
@@ -0,0 +1,58 @@
+// Type definitions for IITC (Ingress Intel Total Conversation) 0.30
+// Project: https://github.com/IITC-CE/ingress-intel-total-conversion
+// Definitions by: McBen
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// Minimum TypeScript Version: 3.6
+
+// generate docs: npx typedoc --mode file --includeDeclarations --excludeExternals core/
+
+// dependencies FIXME: triggers error
+// export * as L from "leaflet";
+import * as L from "leaflet";
+import "leafletExtentions";
+
+import "spectrum";
+
+// base
+export * from "./core/main";
+export * from "./core/constants";
+export * from "./core/iitctypes";
+export * from "./core/inteltypes";
+
+// direct file conversation
+export * from "./core/android"; // from mobile
+export * from "./core/artifact";
+export * from "./core/dialog";
+export * from "./core/hooks";
+export * from "./core/chat";
+export * from "./core/utils_misc";
+export * from "./core/data_cache";
+export * from "./core/map_data_request";
+export * from "./core/map_data_render";
+export * from "./core/map_data_debug";
+export * from "./core/player_names";
+export * from "./core/entity_info";
+export * from "./core/region_scoreboard";
+export * from "./core/map_data_calc_tools";
+export * from "./core/search";
+export * from "./core/game_status";
+export * from "./core/entity_decode";
+export * from "./core/portal_data";
+export * from "./core/portal_highlighter";
+export * from "./core/portal_detail";
+export * from "./core/portal_info";
+export * from "./core/send_request";
+export * from "./core/portal_marker";
+export * from "./core/portal_detail_display";
+export * from "./core/portal_detail_display_tools";
+export * from "./core/smartphone";
+export * from "./core/panes";
+export * from "./core/extract_niantic_parameters";
+export * from "./core/idle";
+export * from "./core/utils_file";
+export * from "./core/request_handling";
+export * from "./core/redeeming";
+export * from "./core/ornaments";
+export * from "./core/location";
+export * from "./core/boot";
+export * from "./core/constants";
diff --git a/src/types/iitc/package.json b/src/types/iitc/package.json
new file mode 100755
index 000000000..259f31817
--- /dev/null
+++ b/src/types/iitc/package.json
@@ -0,0 +1,26 @@
+{
+ "contributors": [
+ {
+ "name": "McBen",
+ "url": "https://github.com/McBen"
+ }
+ ],
+ "dependencies": {
+ "@types/jquery": "*",
+ "@types/jqueryui": "*",
+ "@types/leaflet": "*",
+ "@types/spectrum": "*"
+ },
+ "description": "TypeScript definitions for IITC (Ingress Intel Total Conversation)",
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/iitc",
+ "license": "MIT",
+ "main": "",
+ "name": "iitc",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
+ "directory": "types/iitc"
+ },
+ "types": "index.d.ts",
+ "version": "0.30.2"
+}
\ No newline at end of file
diff --git a/src/types/leafletExtentions/index.d.ts b/src/types/leafletExtentions/index.d.ts
new file mode 100755
index 000000000..d74861522
--- /dev/null
+++ b/src/types/leafletExtentions/index.d.ts
@@ -0,0 +1,39 @@
+import * as L from "leaflet";
+
+declare module "leaflet" {
+ // geodesic
+ function geodesicPolyline(
+ latlngs: LatLng[],
+ options?: PolylineOptions
+ ): GeodesicPolyline;
+ function geodesicPolygon(
+ latlngs: LatLng[],
+ options?: PolylineOptions
+ ): GeodesicPolygon;
+
+ class GeodesicPolyline extends Polyline {
+ getLatLngs(): LatLng[];
+ }
+
+ // tslint:disable-next-line:no-empty-interface
+ class GeodesicPolygon extends GeodesicPolyline { }
+
+ // tslint:disable-next-line:no-empty-interface
+ class GeodesicCircle extends Polyline { }
+
+ // extends PolynineOption to any prop
+ interface PolylineOptions {
+ /* guid: string */
+ [propName: string]: any;
+ }
+
+ interface LeafletEvent {
+ /* opID: string */
+ /* background: boolean */
+ [propName: string]: any;
+ }
+
+ interface Marker {
+ update(): this;
+ }
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 000000000..1dcd591e6
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,28 @@
+{
+ "compilerOptions": {
+ "outDir": "./built",
+ "sourceMap": true,
+ "target": "ES6",
+ "moduleResolution": "node",
+ "importsNotUsedAsValues": "error",
+ "esModuleInterop": true,
+ "isolatedModules": true,
+ "strict": false,
+ "typeRoots": [
+ "./src/types",
+ "node_modules/@types"
+ ],
+ "skipLibCheck": false,
+ "forceConsistentCasingInFileNames": true,
+ "downlevelIteration": true,
+ "allowJs": true,
+ "checkJs": true,
+ "allowUmdGlobalAccess": true
+ },
+ "include": [
+ "src/**/*"
+ ],
+ "exclude": [
+ "node_modules/*"
+ ]
+}
\ No newline at end of file
From 001dba30c566c47fc774eb1ae360535c2a88cdc0 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 21:20:02 +0100
Subject: [PATCH 068/275] add ts-loader
---
package.json | 3 ++-
tsconfig.json | 2 +-
webpack.config.js | 10 ++++++++--
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/package.json b/package.json
index e41f0dd41..d213086c0 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"style-loader": "^2.0.0",
"through2": "^4.0.2",
"to-string-loader": "^1.1.6",
+ "ts-loader": "^9.2.6",
"tslib": "^2.3.1",
"typescript": "^4.4.4",
"url-loader": "^4.1.1",
@@ -56,4 +57,4 @@
"sortablejs": "^1.12.0"
},
"typings": "src/code/index.d.ts"
-}
\ No newline at end of file
+}
diff --git a/tsconfig.json b/tsconfig.json
index 1dcd591e6..1c2aae52a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,7 +16,7 @@
"forceConsistentCasingInFileNames": true,
"downlevelIteration": true,
"allowJs": true,
- "checkJs": true,
+ "checkJs": false,
"allowUmdGlobalAccess": true
},
"include": [
diff --git a/webpack.config.js b/webpack.config.js
index fa7a7cb9f..6f6493d4d 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -139,9 +139,15 @@ const config = {
},
resolve: {
modules: ["node_modules"],
+ extensions: ['.ts', '.js'],
},
module: {
rules: [
+ {
+ test: /\.tsx?$/,
+ use: 'ts-loader',
+ exclude: /node_modules/,
+ },
{
test: /\.(png|gif|svg)$/,
use: "url-loader",
@@ -169,11 +175,11 @@ module.exports = (env, argv) => {
const pluginConfig = require("./plugin.config.json");
const meta = pluginConfig.headers.common;
if (argv.mode === "development") {
- if(env.scot) {
+ if (env.scot) {
config.output.path = path.join(outputPath, "scot");
config.devtool = "eval-source-map";
Object.assign(meta, pluginConfig.headers.scot);
- } else if(env.pr) {
+ } else if (env.pr) {
config.output.path = path.join(outputPath, "dev");
config.devtool = "inline-source-map";
Object.assign(meta, pluginConfig.headers.pr);
From 0ad3db22fc76087cd10338b09e47ee702450389d Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 21:20:30 +0100
Subject: [PATCH 069/275] zone.ts
---
src/code/model/zone.d.ts | 21 ---------------------
src/code/model/{zone.js => zone.ts} | 17 +++++++++++++----
2 files changed, 13 insertions(+), 25 deletions(-)
delete mode 100644 src/code/model/zone.d.ts
rename src/code/model/{zone.js => zone.ts} (81%)
diff --git a/src/code/model/zone.d.ts b/src/code/model/zone.d.ts
deleted file mode 100644
index 911650855..000000000
--- a/src/code/model/zone.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-export default class WasabeeZone {
- id: number;
- name: string;
- color: string;
- points: Array;
- constructor(obj: any);
- toJSON(): {
- id: number;
- name: string;
- color: string;
- points: zonePoint[];
- };
- contains(latlng: any): boolean;
-}
-declare class zonePoint {
- position: number;
- lat: number;
- lng: number;
- constructor(obj: any);
-}
-export {};
diff --git a/src/code/model/zone.js b/src/code/model/zone.ts
similarity index 81%
rename from src/code/model/zone.js
rename to src/code/model/zone.ts
index 9d5a9a5a8..18a52c6b9 100644
--- a/src/code/model/zone.js
+++ b/src/code/model/zone.ts
@@ -1,4 +1,9 @@
export default class WasabeeZone {
+ id: ZoneID;
+ name: string;
+ color: string;
+ points: zonePoint[];
+
constructor(obj) {
this.id = Number(obj.id);
this.name = obj.name;
@@ -14,7 +19,7 @@ export default class WasabeeZone {
toJSON() {
return {
- id: Number(this.id),
+ id: +this.id,
name: `${this.name}`,
color: this.color,
points: this.points,
@@ -22,7 +27,7 @@ export default class WasabeeZone {
}
//ray casting algo
- contains(latlng) {
+ contains(latlng: { lat: number; lng: number }) {
this.points.sort((a, b) => {
return a.position - b.position;
});
@@ -51,9 +56,13 @@ export default class WasabeeZone {
}
class zonePoint {
+ position: number;
+ lat: number;
+ lng: number;
+
constructor(obj) {
this.position = Number(obj.position);
- this.lat = Number(obj.lat);
- this.lng = Number(obj.lng);
+ this.lat = +obj.lat;
+ this.lng = +obj.lng;
}
}
From 1b7d09b26bc48a7aa695e5b10ff2d9cb437aa963 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 21:53:47 +0100
Subject: [PATCH 070/275] blockers
---
src/code/model/blocker.d.ts | 24 --------
src/code/model/{blocker.js => blocker.ts} | 74 ++++++++++++++---------
2 files changed, 46 insertions(+), 52 deletions(-)
delete mode 100644 src/code/model/blocker.d.ts
rename src/code/model/{blocker.js => blocker.ts} (61%)
diff --git a/src/code/model/blocker.d.ts b/src/code/model/blocker.d.ts
deleted file mode 100644
index ec8ade609..000000000
--- a/src/code/model/blocker.d.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import type WasabeeOp from "./operation";
-import type WasabeePortal from "./portal";
-export interface IBlockerPortal {
- opID: OpID;
- id: PortalID;
- name: string;
- lat: string;
- lng: string;
-}
-export default class WasabeeBlocker {
- opID: string;
- from: string;
- to: string;
- fromPortal?: IBlockerPortal;
- toPortal?: IBlockerPortal;
- constructor(obj: any);
- static addPortal(op: WasabeeOp, portal: WasabeePortal): Promise;
- static updatePortal(op: WasabeeOp, portal: WasabeePortal): Promise;
- static removeBlocker(op: WasabeeOp, portalId: string): Promise;
- static removeBlockers(opID: string): Promise;
- static addBlocker(op: WasabeeOp, fromPortal: WasabeePortal, toPortal: WasabeePortal): Promise;
- static getPortals(op: WasabeeOp): Promise;
- static getAll(op: WasabeeOp): Promise;
-}
diff --git a/src/code/model/blocker.js b/src/code/model/blocker.ts
similarity index 61%
rename from src/code/model/blocker.js
rename to src/code/model/blocker.ts
index 56d6163c4..b9ea9f82c 100644
--- a/src/code/model/blocker.js
+++ b/src/code/model/blocker.ts
@@ -1,15 +1,31 @@
import db from "../db";
+import type WasabeeOp from "./operation";
+import type WasabeePortal from "./portal";
+
+export interface IBlockerPortal {
+ opID: OpID;
+ id: PortalID;
+ name: string;
+ lat: string;
+ lng: string;
+}
export default class WasabeeBlocker {
+ opID: OpID;
+ from: PortalID;
+ to: PortalID;
+
+ fromPortal?: WasabeePortal;
+ toPortal?: WasabeePortal;
+
constructor(obj) {
this.opID = obj.opID;
this.from = obj.fromPortal.id;
this.to = obj.toPortal.id;
}
- static async addPortal(op, portal) {
- const store = await (await db).transaction("blockers_portals", "readwrite")
- .store;
+ static async addPortal(op: WasabeeOp, portal: WasabeePortal) {
+ const store = (await db).transaction("blockers_portals", "readwrite").store;
const ent = {
opID: op.ID,
id: portal.id,
@@ -25,7 +41,7 @@ export default class WasabeeBlocker {
}
// return true if a blocker portal is updated
- static async updatePortal(op, portal) {
+ static async updatePortal(op: WasabeeOp, portal: WasabeePortal) {
const store = (await db).transaction("blockers_portals", "readwrite").store;
if (portal.name === portal.id) return false;
const p = await store.get([op.ID, portal.id]);
@@ -48,41 +64,43 @@ export default class WasabeeBlocker {
static async removeBlocker(op, portalId) {
const store = (await db).transaction("blockers", "readwrite").store;
- let cursor = await store
+ let cfrom = await store
.index("from")
.openKeyCursor(IDBKeyRange.only([op.ID, portalId]));
- while (cursor) {
- store.delete(cursor.primaryKey);
- cursor = await cursor.continue();
+ while (cfrom) {
+ store.delete(cfrom.primaryKey);
+ cfrom = await cfrom.continue();
}
- cursor = await store
+ let cto = await store
.index("to")
.openKeyCursor(IDBKeyRange.only([op.ID, portalId]));
- while (cursor) {
- store.delete(cursor.primaryKey);
- cursor = await cursor.continue();
+ while (cto) {
+ store.delete(cto.primaryKey);
+ cto = await cto.continue();
}
await (await db).delete("blockers_portals", [op.ID, portalId]);
}
- static async removeBlockers(opID) {
- let store = (await db).transaction("blockers", "readwrite").store;
- let cursor = await store
- .index("opID")
- .openKeyCursor(IDBKeyRange.only(opID));
- while (cursor) {
- store.delete(cursor.primaryKey);
- cursor = await cursor.continue();
+ static async removeBlockers(opID: string) {
+ const sb = (await db).transaction("blockers", "readwrite").store;
+ let co = await sb.index("opID").openKeyCursor(IDBKeyRange.only(opID));
+ while (co) {
+ sb.delete(co.primaryKey);
+ co = await co.continue();
}
- store = (await db).transaction("blockers_portals", "readwrite").store;
- cursor = await store.index("opID").openKeyCursor(IDBKeyRange.only(opID));
- while (cursor) {
- store.delete(cursor.primaryKey);
- cursor = await cursor.continue();
+ const sp = (await db).transaction("blockers_portals", "readwrite").store;
+ let cp = await sp.index("opID").openKeyCursor(IDBKeyRange.only(opID));
+ while (cp) {
+ sp.delete(cp.primaryKey);
+ cp = await cp.continue();
}
}
- static async addBlocker(op, fromPortal, toPortal) {
+ static async addBlocker(
+ op: WasabeeOp,
+ fromPortal: WasabeePortal,
+ toPortal: WasabeePortal
+ ) {
const blocker = new WasabeeBlocker({
opID: op.ID,
fromPortal: fromPortal,
@@ -94,14 +112,14 @@ export default class WasabeeBlocker {
await WasabeeBlocker.addPortal(op, toPortal);
}
- static async getPortals(op) {
+ static async getPortals(op: WasabeeOp) {
const portals = await (
await db
).getAllFromIndex("blockers_portals", "opID", op.ID);
return portals;
}
- static async getAll(op) {
+ static async getAll(op: WasabeeOp) {
const blockers = await (
await db
).getAllFromIndex("blockers", "opID", op.ID);
From 6c9b05795b3afac6c3fdcec3606d0d8b9f0f1821 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 21:54:05 +0100
Subject: [PATCH 071/275] evented.ts
---
src/code/model/evented.d.ts | 12 ------------
src/code/model/{evented.js => evented.ts} | 13 ++++++++++---
2 files changed, 10 insertions(+), 15 deletions(-)
delete mode 100644 src/code/model/evented.d.ts
rename src/code/model/{evented.js => evented.ts} (79%)
diff --git a/src/code/model/evented.d.ts b/src/code/model/evented.d.ts
deleted file mode 100644
index 889d79964..000000000
--- a/src/code/model/evented.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export default class Evented {
- _events: {
- [propName: string]: Array<{
- fct: (data: unknown) => void;
- context: unknown;
- }>;
- };
- constructor();
- on(event: string, func: (data: unknown) => void, context?: unknown): this;
- off(event: string, func: (data: unknown) => void, context?: unknown): this;
- fire(event: string, data?: unknown): this;
-}
diff --git a/src/code/model/evented.js b/src/code/model/evented.ts
similarity index 79%
rename from src/code/model/evented.js
rename to src/code/model/evented.ts
index aac98c209..1a7075687 100644
--- a/src/code/model/evented.js
+++ b/src/code/model/evented.ts
@@ -9,17 +9,24 @@
function doNothing() {}
export default class Evented {
+ _events: {
+ [event: string]: {
+ fct: (data: unknown) => void;
+ context: unknown;
+ }[];
+ };
+
constructor() {
this._events = {};
}
- on(event, func, context) {
+ on(event: string, func: (data: unknown) => void, context?: unknown) {
if (!(event in this._events)) this._events[event] = [];
this._events[event].push({ fct: func, context: context });
return this;
}
- off(event, func, context) {
+ off(event: string, func: (data: unknown) => void, context?: unknown) {
const listeners = this._events[event].slice();
if (listeners) {
for (const listener of listeners) {
@@ -32,7 +39,7 @@ export default class Evented {
return this;
}
- fire(event, data) {
+ fire(event: string, data?: unknown) {
const listeners = this._events[event].slice();
if (listeners) {
for (const listener of listeners) {
From 8c33bca9b2ed865742f551fcc0608d848a825837 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 21:54:28 +0100
Subject: [PATCH 072/275] portal.ts
---
src/code/model/portal.d.ts | 24 ------------------------
src/code/model/{portal.js => portal.ts} | 17 ++++++++++++++++-
2 files changed, 16 insertions(+), 25 deletions(-)
delete mode 100644 src/code/model/portal.d.ts
rename src/code/model/{portal.js => portal.ts} (85%)
diff --git a/src/code/model/portal.d.ts b/src/code/model/portal.d.ts
deleted file mode 100644
index 349ecff92..000000000
--- a/src/code/model/portal.d.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import * as L from "leaflet";
-export default class WasabeePortal {
- id: string;
- name: string;
- lat: string;
- lng: string;
- comment: string;
- hardness: string;
- _latLng: L.LatLng;
- constructor(obj: any);
- toJSON(): {
- id: string;
- name: string;
- lat: string;
- lng: string;
- comment: string;
- hardness: string;
- };
- get latLng(): L.LatLng;
- static fake(lat: string | number, lng: string | number, id?: string, name?: string): WasabeePortal;
- get faked(): boolean;
- get loading(): boolean;
- get pureFaked(): boolean;
-}
diff --git a/src/code/model/portal.js b/src/code/model/portal.ts
similarity index 85%
rename from src/code/model/portal.js
rename to src/code/model/portal.ts
index 9b90c712a..4e61c73c2 100644
--- a/src/code/model/portal.js
+++ b/src/code/model/portal.ts
@@ -1,6 +1,16 @@
+import type { LatLng } from "leaflet";
import { generateId } from "../auxiliar";
export default class WasabeePortal {
+ id: PortalID;
+ name: string;
+ lat: string;
+ lng: string;
+ comment: string;
+ hardness: string;
+
+ _latLng: LatLng;
+
constructor(obj) {
if (typeof obj == "string") {
try {
@@ -44,7 +54,12 @@ export default class WasabeePortal {
return this._latLng;
}
- static fake(lat, lng, id, name) {
+ static fake(
+ lat: number | string,
+ lng: number | string,
+ id?: string,
+ name?: string
+ ) {
console.assert(lat && lng, "WasabeePortal.fake called w/o lat/lng");
if (!id) id = generateId();
From 272c32c097a37967385bdcdf81a2392be70b41ce Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 17:17:43 -0600
Subject: [PATCH 073/275] Change donate link
https://www.patreon.com/wasabee
---
src/code/dialogs/about.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/code/dialogs/about.js b/src/code/dialogs/about.js
index 2f0d6bdb7..aa9223491 100644
--- a/src/code/dialogs/about.js
+++ b/src/code/dialogs/about.js
@@ -31,7 +31,7 @@ const AboutDialog = WDialog.extend({
const tips = L.DomUtil.create("div", null, html);
tips.innerHTML =
- "Show your love Tip Jar@paypal ";
+ "Show your love Patreon ";
const about = L.DomUtil.create("div", null, html);
about.innerHTML =
"About Wasabee-IITC " +
From 5c50a5178b01a69a3cca0a6ef559e9573ed3b9ac Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:16:51 -0600
Subject: [PATCH 074/275] Add Patreon
Changed the PayPal link to the new Patreon link.
---
src/code/dialogs/about.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/code/dialogs/about.js b/src/code/dialogs/about.js
index 2f0d6bdb7..aa9223491 100644
--- a/src/code/dialogs/about.js
+++ b/src/code/dialogs/about.js
@@ -31,7 +31,7 @@ const AboutDialog = WDialog.extend({
const tips = L.DomUtil.create("div", null, html);
tips.innerHTML =
- "Show your love Tip Jar@paypal ";
+ "Show your love Patreon ";
const about = L.DomUtil.create("div", null, html);
about.innerHTML =
"About Wasabee-IITC " +
From 5c39a24d25cf0ad0caa80348f93296f647595bcf Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:20:03 -0600
Subject: [PATCH 075/275] Add Danish language
---
src/code/translations/danish.json | 391 ++++++++++++++++++++++++++++++
1 file changed, 391 insertions(+)
create mode 100644 src/code/translations/danish.json
diff --git a/src/code/translations/danish.json b/src/code/translations/danish.json
new file mode 100644
index 000000000..a59f0bccc
--- /dev/null
+++ b/src/code/translations/danish.json
@@ -0,0 +1,391 @@
+{
+ "ABOUT_WASABEE": "Om Wasabee",
+ "acknowledged": "Anerkendt",
+ "ADD LINK TITLE": "Tilføj Links",
+ "ADD MARKER TITLE": "Tilføj Markøre",
+ "ADD_AGENT": "Tilføj Agent: ",
+ "ADD_BL": "Tilføj baglinie: ",
+ "ADD_BUTTON_LINKS": "Tilføj alle links med det samme.",
+ "ADD_LINKS": "Tilføj Links",
+ "ADD_MARKER": "+ Markør",
+ "ADD_NEW_OP": "Tilføj Ny Op",
+ "ADD_SUCC_INSTR": "Agent tilføjet",
+ "ADD_ZONE": "Tilføj Zone",
+ "ADD": "Tilføj",
+ "ADD1": "Tilføj første link",
+ "ADD2": "Tilføj andet link",
+ "AGENT_STATS": "Agent Stats",
+ "AGENT": "Agent",
+ "AGES": " (for længe siden)",
+ "ALREADY_HAS_MARKER": "Denne portal har allerede en markør, vælg en anden Portal.",
+ "AMAZ_TEAM_NAME": "Fantastisk holdnavn.",
+ "ANCHOR ASSIGNMENT": " Alle udgående links",
+ "ANCHOR_GMAP": "Google Map",
+ "ANCHOR_PORTAL": "Anker Portal ",
+ "ANCHOR_PORTAL2": "Anker Portal 2",
+ "ANCHOR_PORTAL3": "Anker Portal 3",
+ "ANCHOR1": "Anker 1 ",
+ "ANCHOR2": "Anker 2 ",
+ "ANCHOR3": "Anker 3 ",
+ "ANCHORS_AS_BOOKMARKS": "Ankere som bookmarks",
+ "API_KEY": " api key: ",
+ "ASS_TO": "Tildelt",
+ "ASSIGN LINK PROMPT": "Tilføj link fra: {portalName}",
+ "ASSIGN MARKER PROMPT": "Tildel markør fra: {portalName}",
+ "ASSIGN OUTBOUND PROMPT": "Tildel alle udgående links fra: {portalName}",
+ "ASSIGN OUTBOUND": "Tildel udgående links",
+ "ASSIGN": "Tildel",
+ "ASSIGNED_ONLY_SHORT": "KT",
+ "ASSIGNED_ONLY": "Kun tildelt",
+ "assigned": "Tildelt",
+ "AUTH ANDROID": "På Android, prøv 'hurtigt' først. Hvis det mislykkes, prøv hovedlogin med 'vælg_konto'.",
+ "AUTH INCOMPAT": "Du har aktiveret et plugin i TamperMonkey, der er inkompatibelt med Wasabee",
+ "AUTH IOS": "På iOS skal du bruge "Log ind". Hvis det mislykkes, skal du bruge 'Webview-login' og derefter bruge 'Verify Webview'-knappen for at fuldføre processen.",
+ "AUTH REQUIRED": "Godkendelse påkrævet",
+ "AUTH TOKEN REJECTED": "Afsendelse af godkendelsestoken til serveren blev afvist: {error}",
+ "AUTH_SELECT_ACCOUNT": "Vælg konto",
+ "AUTO_DRAWS": "Auto-tegne",
+ "AUTODRAWS": "Wasabee Indstillinger for automatisk tegning",
+ "AUTOLOAD_RATE": "Rate for anmodning om portaldetaljer (ms)",
+ "AUTOLOAD": "Indlæs automatisk manglende portaloplysninger",
+ "AUTOMARK STOP": "Auto-markering stoppede på grund af, at portaler ikke blev indlæst",
+ "AUTOMARK": "Auto-mærke",
+ "BAT_TOAD": "Battle Toads/manglende oversættelse",
+ "BLOCKER LIST TITLE": "Vis alle blokkere",
+ "BLOCKER TITLE": "Blokere",
+ "CANCEL": "Annuller",
+ "CAPSULE": "Kapsel",
+ "CapturePortalMarker": "erobre",
+ "CHANGE SERVER PROMPT": "Ny Wasabee Server",
+ "CHANGE SERVER": "Skift Server",
+ "CHANGE_WAS_SERVER": "Skift Wasabee Server",
+ "CHECKLIST BUTTON TITLE": "Operation Tjekliste",
+ "CHECKLIST BUTTON": "Tjekliste",
+ "CLEAR LINKS": "Ryd links",
+ "CLEAR MARKERS": "Ryd markører",
+ "CLEAR_EVERYTHING": "Ryd portaler/links/markører for aktuel OP",
+ "CLEAROPS BUTTON TITLE": "Ryd Data",
+ "CLEAROPS BUTTON": "Ryd Data",
+ "CLEAROPS PROMPT": "Ryd alle lokale OPS. Ops vil blive gendannet ved næste download.",
+ "CLOSE": "Luk",
+ "COMMENT": "Kommentar",
+ "COMPLETED BY": "Færdiggjort af {agentName}",
+ "completed": "Færdiggjort",
+ "CON_DEL": "Bekræft sletning: {opName}",
+ "COUNT": "Optælling",
+ "CREATE_NEW_TEAM": "Opret nyt team",
+ "CreateLinkAlert": "Link",
+ "CUR_USER_INFO": "Aktuelle brugeroplysninger",
+ "D_SHOW_LIST": "Input defensive nøgler",
+ "DEFAULT OP NAME": "Ny Op: {date}",
+ "DELETE ANCHOR PROMPT": "Ønsker du at slette dette anker og alle tilhørende links: ",
+ "DELETE ANCHOR TITLE": "Slet anker",
+ "DELETE MARKER PROMPT": "Vil du slette denne markør: ",
+ "DELETE MARKER TITLE": "Slet markør",
+ "DELETE_ANCHOR": "Slet",
+ "DELETE_LINK": "Slet",
+ "DELETE_OP": "Slet {opName}",
+ "DESCRIP_PLACEHOLD": "Beskrivelse (valgfri)",
+ "DestroyPortalAlert": "Ødelæg/Skyd",
+ "DRAW TOOLS FORMAT": "Draw Tools Format",
+ "DUPE_OP": "Duplikere Operation",
+ "END_PORT": "Slut Portal ",
+ "ExcludeMarker": "Udelad fra Auto-Tegn/Marker",
+ "EXPORT OP TITLE": "Eksporter aktuel Op",
+ "EXPORT OP": "Eksporter Op",
+ "EXPORT": "Eksporter: ",
+ "FAKED": "forfalsket: [{portalId}]",
+ "FANFIELD": "Tegn",
+ "FANFIELD2": "Tegne Fan Field",
+ "FarmPortalMarker": "Farm",
+ "FROM_1-2": "fra basislinie 1-2",
+ "FROM_1-3": "fra basislinie 1-3",
+ "FROM_2-3": "fra basislinie 2-3",
+ "FROM_DEPTH": "fra center",
+ "FROM_PORT": "Fra Portal",
+ "GET DT": "Få eksisterende DrawTools-tegning",
+ "GetKeyPortalMarker": "Hent nøgler",
+ "GotoPortalMarker": "Gå Til",
+ "H-GEN_INST": "Sæt portaler til det ydre lag. Vælg antal opdelinger. Klik på tegn",
+ "HF_DEEP_SEARCH": "Omfattende søgning",
+ "HF_DRAW_BUTTON": "Tegn",
+ "HF_REDRAW_BUTTON": "Gentegn",
+ "HG": "Homogent felt",
+ "HOURS": " ({hours} timer siden)",
+ "HOW_TO_VIDS": "Sådan gør du videoer: ",
+ "IMP_COMP": "Import fuldført. Fundet",
+ "IMP_NOPE": "Import mislykkedes.",
+ "IMP_WAS_OP": "Importer Wasabee Operation",
+ "IMPORT_OP_SUCCESS": "Importeret Operation: {opName} lykkedes.",
+ "IMPORT_OP_TITLE": "Import Op: {date}",
+ "IMPORT_OP": "Importer Operation",
+ "IMPOSSIBLE": "Umulig",
+ "INGNAME_GID": "Ingress navn eller GoogleID",
+ "INPUT_DT_KEY_COUNT": "Input antal defensiv nøgler",
+ "INPUT_SQUAD_NAME": "Indtast et holdnavn",
+ "INVALID REQUEST": "Ugyldig forespørgsel",
+ "IOS NEED FAKE UA": "Du skal indstille en 'Custom UserAgent for Webviews' i IITC-Mobile-indstillingerne, ellers mislykkes login",
+ "KEY_LIST2": "Nøgleliste til Operationen: {opName}",
+ "KEYS": "Nøgler",
+ "KNOWN_BLOCK": "Kendte blokkere: {opName}",
+ "LA DESC": "Afhængigt af antallet og typen af anvendte Link Amps, kan et lavere kildeportal level være tilstrækkeligt.",
+ "LA": "L8+ nogle LA",
+ "LANG": "Sprog",
+ "LEAVE": "Forlad",
+ "LetDecayPortalAlert": "Lad forfalde",
+ "LINK ASSIGNMENT": "Link opgave",
+ "LINK STATE PROMPT": "Link tilstand",
+ "LINK STATE": "Indstil linkstatus",
+ "LINKS BUTTON TITLE": "Links",
+ "LINKS": "Links",
+ "LINKS2": "{portalName} : Links ({outgoing}↑/{incoming}↓)",
+ "LOAD PORTALS": "Load Portaler",
+ "LOADING": "[loader]",
+ "LOADING1": "Loader: [{portalGuid}]",
+ "LOC_PROC": "Beliggenhed behandlet",
+ "LOCATION SUB": "Lokation registreret",
+ "LOCFRMSER": " (lokal og fra server)",
+ "LOG IN": "Log In",
+ "LOG_OUT": "Log Ud",
+ "MADRID_SET_1": "Vælg regionen for basislinket Anker 2 til Anker 3",
+ "MADRID_SET_2": "Vælg regionen for basislinket Anker 3 til Anker 1",
+ "MADRID_SET_3": "Vælg regionen for basislinket Anker 1 til Anker 2",
+ "MADRID_TITLE": "Madrid Protocol",
+ "MADRID_WAS_TAKEN": "Madrid Protocol",
+ "MADRID": "Tegn",
+ "MANAGE_TEAM": "Administrer {teamName}",
+ "MANAGE": "Administrer",
+ "MARKER ASSIGNMENT": "Markør Opgave",
+ "MARKER LIST TITLE": "Markør Liste",
+ "MARKER LIST": "Markører",
+ "MARKER STATE PROMPT": "Markør Status",
+ "MARKER STATE": "Indstil markørtilstand",
+ "MARKER_LIST": "Markør Liste: {opName}",
+ "MARKERS BUTTON TITLE": "Markører",
+ "MAX_SPLITS": "Max Delinger",
+ "MAX": "Fan Field",
+ "MeetAgentPortalMarker": "Mød Agent",
+ "MERGE ON UPDATE": "Flet ved opdatering",
+ "MERGE_CHANGES_LOCAL": "Lokale ændringer",
+ "MERGE_CHANGES_MERGE": "Flet resultat",
+ "MERGE_CHANGES_REMOTE": "Fjernændringer",
+ "MERGE_LOCAL": "Behold lokale",
+ "MERGE_MESSAGE": "Det ser ud til, at {opName} har lokale ændringer. Vil du flette dine ændringer med server-OP'en, bruge serverversionen eller beholde den lokale version?",
+ "MERGE_REBASE": "Flet",
+ "MERGE_REPLACE": "Brug server",
+ "MERGE_TITLE": "Flet lokal&fjern OP",
+ "MIN_SRC_PORT_LVL": "Minimums level påkrævet på kildeportalen",
+ "MINUTES": " ({minutes} minutter siden)",
+ "MM": "Multimax",
+ "MULTI_M_TITLE": "Tegn Max Lag",
+ "MULTI_M": "Tegn",
+ "MUST_NOT_BE_EMPTY": "Må ikke være tom",
+ "MY_CAP_ID": "Mit kapsel ID",
+ "MY_COUNT": "Mit Antal",
+ "NAME_REQ": "Navn påkrævet",
+ "NAME": "Navn: ",
+ "NEW_OP": "Ny operation",
+ "NEW_TEAM_NAME": "Nyt holdnavn",
+ "NEW_TEAM": "Nyt hold",
+ "NEW_WAS_SERVER": "Ny Wasabee Server",
+ "NEWOP BUTTON TITLE": "Opret en ny operation",
+ "NEWOP BUTTON": "Ny Op",
+ "NO_DT_ITEMS": "Ingen DrawTools tegnede elementer fundet",
+ "NO_LABEL": "Ingen etiket sat",
+ "NO_STOCK_INTEL": "Wasabee understøtter ikke stock intel tegninger",
+ "NO_TITLE": "Ingen titel angivet",
+ "NOT LOGGED IN SHORT": "Ikke logget ind",
+ "NOT LOGGED IN": "Ikke logget ind: {error}",
+ "NOT_SET": "ikke indstillet",
+ "NTNAME": "Navn",
+ "OK": "OK",
+ "ON_HAND": "Har Allerede",
+ "ONION_WAS_TAKEN": "Onion",
+ "ONION": "Draw",
+ "ONLY_DT_IMP": " (kun for DrawTools-import)",
+ "OP DELETED": "Operationen fjernet fra serveren: {opID}",
+ "OP PERM DENIED": "Tilladelse nægtet til operationen: {opID}",
+ "OP_BUTTON": "Operation",
+ "OP_CHECKLIST": "Operation Checklist: {opName}",
+ "OP_NAME_UNSET": "Operationsnavn blev deaktiveret",
+ "OP_PERMS": "Op Tilladelser",
+ "OP_SETTINGS_BUTTON": "Op ⚙",
+ "OP_SETTINGS_TITLE": "Op Indstillinger",
+ "OPEN_REQUEST": "[åbn anmodning]",
+ "OPER_COLOR": "Operation Farve: ",
+ "OPER_NAME": "Operation Navn: ",
+ "OPERATIONS": "Operationer",
+ "OPS BUTTON TITLE": "Operations Liste",
+ "OPS BUTTON": "Vælg OP",
+ "ORDER": "Sorter",
+ "OtherPortalAlert": "Andet",
+ "PASTE_INSTRUCT": "Indsæt en Wasabee draw-eksport her.\n\nWasabee kan ikke importere stock intel-formatet.\n\nDer er eksperimentel understøttelse af import af IITC DrawTools-formatet.\n\nFør du importerer DrawTools-formatet, skal du forhåndsvise områderne og sørge for, at alle portalerne indlæses så IITC har dem cachelagret. Alle portaler, der ikke er pre-cached, vil blive forfalsket.\n\nDu bliver nødt til at bruge 'swap'-funktionen til at flytte ankre fra de falske portaler til de rigtige portaler (de bør være på den korrekte placering, bare ikke forbundet med portal.\n\nCachede portaler er muligvis ikke korrekt navngivet.",
+ "pending": "Afventer",
+ "PERMS": "{opName} tilladelser",
+ "PLEASE_SELECT_PORTAL": "Vælg venligst en portal",
+ "PORT_FAKE": " portaler. Forfalsket ",
+ "PORTAL KEY LIST": "Nøgleliste for portal {portalName}",
+ "PORTAL_COUNT": "{count} portaler",
+ "PORTAL": "Portal",
+ "QD BUTTON CHANGE COLOR": "Klik for at ændre farve på næste link",
+ "QD BUTTON END": "Klik for at stoppe med at tegne felter",
+ "QD BUTTON TOGGLE MODE": "Klik for at ændre tegnetilstand",
+ "QD CHANGE COLOR": "Skift farve",
+ "QD END": "Slut",
+ "QD TITLE": "Hurtig tegn lag",
+ "QD TOGGLE MODE": "Skift tilstand",
+ "QDBASE": "Base Link",
+ "QDCONT": "Klik på en baglinieportal for at tegne et felt.",
+ "QDNEXT": "Klik på den anden ankerportal.",
+ "QDSTART": "Klik på den første ankerportal.",
+ "READ_SHORT": "L",
+ "READ": "Læs",
+ "RechargePortalAlert": "Recharge",
+ "REFERENCE_TIME": "Referencetid: ",
+ "REM_LOC_CP": "Fjern lokal kopi af {opName}",
+ "REMOVE_TEAM_CONFIRM_LABEL": "Vil du permanent fjerne {team Name} fra Wasabi-serveren?",
+ "REMOVE_TEAM_CONFIRM_TITLE": "Fjern hold {teamName}",
+ "REMOVE_TEAM": "Fjern hold: ",
+ "REMOVE": "Fjern",
+ "RENAME_TEAM": "Omdøb hold: ",
+ "RENAME": "Omdøb",
+ "REQUIRED": "Påkrævet",
+ "RESET": "Nulstil",
+ "REVERSE": "Endevend",
+ "ROCKS_COM": "enl.rocks community: ",
+ "ROLE": "Rolle",
+ "SAVELINKS TITLE": "Gem Links",
+ "SAVELINKS_DRAW": "Gem Links",
+ "SAVELINKS": "Gem Links",
+ "SECONDS": " ({seconds} sekunder siden)",
+ "SEL_SB_ANCHOR": "Vælg ankerportal.",
+ "SEL_SB_ANCHOR2": "Zoom out. Make sure portals have all loaded, then click draw.",
+ "SEL_SL_ANCHOR": "Vælg den portal, du vil gemme links til. Klik på knappen Gem links og se på tjeklisten.",
+ "SEL_SRC_ANC2": "Vælg både Kilde og Anker 2",
+ "SEL_SRC_PORT": "Vælg en kildeportal",
+ "SELECT PORTAL": "Vælg venligst en portal først",
+ "SELECT_FAN_PORTALS": "Vælg en ankerportal, en startportal og en slutportal, og fokuser over markområdet.",
+ "SELECT_FAN_PORTALS2": "Vent på, at alle portaler er indlæst, og klik derefter på tegn.",
+ "SELECT_INSTRUCTIONS": "Vælg to ankerportaler, og zoom derefter over rygsøjlen.",
+ "SELECT_ONION_PORTALS": "Layers build from the inside out. Zoom in to center and select starting portal, then zoom out to area.",
+ "SELF SWAP": "Kan ikke bytte en portal med sig selv! Vælg en anden portal.",
+ "SEND ANALYTICS": "Send anonyme analysedata",
+ "SEND LOCATION": "Send placering",
+ "SEND TARGET AGENT": "Vælg modtager agent",
+ "SEND TARGET CONFIRM": "Vil du sende {portalName}-målet til {agent}?",
+ "SEND TARGET": "Send mål",
+ "SEND_LOC": "Send placering",
+ "SET_3_PORT": "Indstil venligst de tre portaler først!",
+ "SET_COMMENT": "Indstil kommentar",
+ "SET_LCOMMENT": "Indstil linkkommentar",
+ "SET_LINK_COMMENT": "Indstil kommentar til link: ",
+ "SET_LINKS_ZONES": "Indstil links til zoner ",
+ "SET_MARKER_COMMENT": "Sæt kommentar til markør på: ",
+ "SET_MARKER_TYPE_TITLE": "Skift markørtype",
+ "SET_MARKERS_ZONES": "Indstil markører til zoner",
+ "SET_MCOMMENT": "Indstil markørkommentar: {portalName}",
+ "SET_NEW_OP": "Indstil venligst det nye operationsnavn",
+ "SET_PCOMMENT": "Indstil portalkommentar: {portalName}",
+ "SET_PORT_COMMENT": "Indstil kommentar til portal: ",
+ "SET_PORTAL_COMMENT": "Indstil portalkommentar",
+ "SET": "set",
+ "SETTINGS": "Wasabee Indstillinger",
+ "SKINS_AVAILABLE": "Der er {count} tilgængelige skins.",
+ "SKINS_BUTTON": "Konfigurer skins",
+ "SKINS_DESCRIPTION": "Tilgængelige skin packs er placeret i højre kolonner. Flyt skins, du ønsker at bruge, til venstre kolonne.",
+ "SKINS_MANAGE_TITLE": "Administrer skins",
+ "SKIP_CONFIRM_ALWAYS": "Spørg aldrig (brug med forsigtighed)",
+ "SKIP_CONFIRM_ENTITY": "Spørg kun for hold/op",
+ "SKIP_CONFIRM_NEVER": "Spørg altid",
+ "SKIP_CONFIRM": "Spring bekræftelse over",
+ "SOURCE_PORT": "Kildeportal ",
+ "SQUAD": "hold",
+ "STARBURST TITLE": "Starburst",
+ "STARBURST_DRAW": "Tegn",
+ "STARBURST": "Starburst",
+ "START_PORT": "Start Portal ",
+ "STATE": "Status",
+ "SUPPORT_INSTRUCT": "For at få support, tilmeld dig Wasabee bruger Telegram kanal ",
+ "SWAP PROMPT": "Vil du bytte: ",
+ "SWAP TITLE": "Byt portaler",
+ "SWAP WITH": " med ",
+ "SWAP": "Byt",
+ "SYNC DONE": "Download Complete Click HERE for hints, tips, and documentation. ",
+ "SYNC": "Download tilgængelige operationer",
+ "TARGET SENT": "Mål sendt",
+ "TEAM STATE": "Del placering",
+ "TEAM_CREATED": "Hold {teamName} oprettet",
+ "TEAM_NAME": "Hold navn",
+ "TEAM": "Hold",
+ "TEAMS BUTTON TITLE": "Liste over Wasabee-holdene",
+ "TEAMS BUTTON": "Hold",
+ "TO_PORT": "Til Portal",
+ "TRAWL SKIP TILES": "Trawl Skip fliser",
+ "TRAWL TITLE": "Trawl baner",
+ "TRAWL WARNING": "Dette vil indlæse flisedataene under alle tegnede links. Dette er en langsom proces.",
+ "TRAWL_AUTOMARK": "Automærke blokere efter trawl",
+ "TRAWL_BULK_LOAD_WARNING": "Denne metode indlæser flisedataene så hurtigt som muligt. Brug på eget ansvar.",
+ "TRAWL_BULK_LOAD": "Masseindlæsning af flisedata",
+ "TRAWL_CLEAR_MARKERS": "Ryd virus/ødelæggelsesmarkører før trawl",
+ "TRAWL_REMAINING": "{count} fliser tilbage",
+ "TRAWL": "Trawl efter blokere",
+ "TRAWLING": "Når du trawler banerne efter blokeringer, luk denne dialog for at stoppe",
+ "TYPE": "Type",
+ "UNASSIGNED": "Ikke tildelt",
+ "UNKNOWN": "Ukendt",
+ "UPDATE HOVER NOT CHANGED": "{opName} ikke ændret lokalt",
+ "UPDATE HOVER": "OPDATER {opName} på serveren",
+ "UPDATE_CONFLICT_DESC": "OP er blevet ændret på serveren siden sidste synkronisering. Ønsker du at erstatte serverversionen med den nuværende?",
+ "UPDATE_CONFLICT_TITLE": "Konflikt opdaget med server",
+ "UPDATE_COUNT": "Opdater optælling",
+ "UPDATED": "Opdateret",
+ "UpgradePortalAlert": "Upgrader",
+ "UPLOAD BUTTON HOVER": "UPLOAD {opName} (ikke på serveren i øjeblikket)",
+ "UPLOAD PERM DENIED": "Tilladelse til at uploade nægtet",
+ "UPLOADED": "Uploadet",
+ "USE PANES ON MOBILE": "Brug rammer (skal genindlæses)",
+ "USE_SWAP_INSTRUCT": ". Brug venligst swap-funktionen til at flytte falske portaler til de rigtige portaler på samme sted. Zoom ind på 'Loading'-portalerne i tjeklisten kan tvinge dem til at indlæse.",
+ "USE_VALID_NAME": "Brug venligst et gyldigt operationsnavn",
+ "UseVirusPortalAlert": "Brug Virus",
+ "VRLA DESC": "Afhængigt af antallet og typen af anvendte linkforstærkere kan et lavere kildeportal level være tilstrækkeligt.",
+ "VRLA": "L8+nogle VRLA",
+ "WASABEE BUTTON TITLE": "Wasabee: den er grøn og får smølfer til at græde.",
+ "WASABEE_D_LIST": "Input antal forsvarsnøgler",
+ "WD BUTTON TITLE": "Log forsvarsnøgler",
+ "WD BUTTON": "W-D Nøgler",
+ "WEBVIEW VERIFY": "Bekræft webvisning",
+ "WEBVIEW": "Webview Log på (iOS)",
+ "WRITE_SHORT": "S",
+ "WRITE": "Skrive",
+ "WSERVER": "Server: {url}",
+ "YESNO_DEL": "Er du sikker på, at du vil slette {opName}?",
+ "ZONE_DRAW": "Klik for at indstille zonegrænserne",
+ "ZONE": "Zone",
+ "smallScreen": {
+ "ADD_LINKS": "+ Links",
+ "ADD_MARKER": "+ Markør",
+ "BLOCKER TITLE": "Blokere",
+ "CHECKLIST BUTTON": "Kontrollere",
+ "CLEAROPS BUTTON": "Klar",
+ "EXPORT OP": "Eksporter",
+ "FAN_FIELD3": "Fan",
+ "FANFIELD": "Tegn",
+ "FANFIELD2": "Tegn Fan Field",
+ "KEYS": "Nøgler",
+ "LOG IN": "Log Ind",
+ "LOG_OUT": "Log Ud",
+ "MARKER LIST": "Markørere",
+ "MARKERS BUTTON TITLE": "Markørere",
+ "MAX": "Fan",
+ "MM": "Multi",
+ "MULTI_M_TITLE": "Tegn Max Lag",
+ "MULTI_M": "Tegn",
+ "NEWOP BUTTON": "Ny Op",
+ "OPS BUTTON": "Vælg OP",
+ "QD END": "Stop",
+ "STARBURST_DRAW": "Tegn",
+ "STARBURST": "Star",
+ "TEAMS BUTTON": "Hold",
+ "WD BUTTON": "W-D Nøgler"
+ }
+}
From f54dc8c6baf4db00f565c7d7380c41c72aa58441 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:22:23 -0600
Subject: [PATCH 076/275] Add Danish and Russian languages
From 70416ae412864e3fb3cfe239e012c4c8a8976f13 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:23:00 -0600
Subject: [PATCH 077/275] Remove 39 unused keys
---
src/code/translations/english.json | 38 ------------------------------
1 file changed, 38 deletions(-)
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index 2dbfa9f53..d81ac5896 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -1,5 +1,4 @@
{
- "ABOUT WASABEE-IITC": "About Wasabee-IITC",
"ABOUT_WASABEE": "About Wasabee",
"acknowledged": "Acknowledged",
"ADD LINK TITLE": "Add Links",
@@ -39,7 +38,6 @@
"ASSIGNED_ONLY_SHORT": "AO",
"ASSIGNED_ONLY": "Assigned Only",
"assigned": "Assigned",
- "ASSIGNED": "Assigned",
"AUTH ANDROID": "On Android, try 'quick' first. If that fails, try the main login with 'select_account'.",
"AUTH INCOMPAT": "You have activated a plugin in TamperMonkey that is incompatable with Wasabee",
"AUTH IOS": "On iOS, use the main 'Log In' option. If that fails, use 'Webview Login' then use the 'Verify Webview' button to complete the process.",
@@ -75,9 +73,7 @@
"COMMENT": "Comment",
"COMPLETED BY": "Completed by {agentName}",
"completed": "Completed",
- "COMPLETED": "Completed",
"CON_DEL": "Confirm Delete: {opName}",
- "CONFIRM_DELETE": "Do you really want to delete this link: ",
"COUNT": "Count",
"CREATE_NEW_TEAM": "Create New Team",
"CreateLinkAlert": "Link",
@@ -88,19 +84,12 @@
"DELETE ANCHOR TITLE": "Delete Anchor",
"DELETE MARKER PROMPT": "Do you want to delete this marker: ",
"DELETE MARKER TITLE": "Delete Marker",
- "DELETE PERM DENIED": "Permission to delete denied.",
"DELETE_ANCHOR": "Delete",
"DELETE_LINK": "Delete",
- "DELETE_MARKER": "Delete",
"DELETE_OP": "Delete {opName}",
- "DELETED": "Successfully deleted.",
"DESCRIP_PLACEHOLD": "Description (optional)",
"DestroyPortalAlert": "Destroy",
- "DISABLE_SYNC": "The IITC Sync plugin is not compatible with Wasabee. Please disable Sync.",
- "DISABLED": "This feature is not ready for users",
- "DONE": "Done",
"DRAW TOOLS FORMAT": "Draw Tools Format",
- "DT_FORMAT": "Draw Tools Format",
"DUPE_OP": "Duplicate Operation",
"END_PORT": "End Portal ",
"ExcludeMarker": "Exclude from Auto-Draw/Mark",
@@ -108,8 +97,6 @@
"EXPORT OP": "Export Op",
"EXPORT": "Export: ",
"FAKED": "Faked: [{portalId}]",
- "FAN_FIELD3": "Fan Field",
- "FANFIELD TITLE": "Fanfield",
"FANFIELD": "Draw",
"FANFIELD2": "Draw Fan Field",
"FarmPortalMarker": "Farm",
@@ -124,19 +111,16 @@
"FROM_DEPTH": "from the depth",
"FROM_PORT": "From Portal",
"GET DT": "Get existing DrawTools draw",
- "GET_DT_DRAW": "Import draw from IITC Draw Tools",
"GetKeyPortalMarker": "Get Keys",
"GotoPortalMarker": "Go To",
"H-GEN_INST": "Set portals for the outside layer. Choose number of splits. Click draw",
"HF_DEEP_SEARCH": "Exhaustive search",
"HF_DRAW_BUTTON": "Draw",
- "HF_DRAW_DEEP_BUTTON": "Draw with deep recursion",
"HF_REDRAW_BUTTON": "Redraw",
"HG": "Homogeneous Field",
"HOURS": " ({hours} hours ago)",
"HOW_TO_VIDS": "How-To Videos: ",
"IMP_COMP": "Import Complete. Found ",
- "IMP_DT_OP": "Imported Drawtools Op: ",
"IMP_NOPE": "Import Failed: {error}",
"IMP_WAS_OP": "Import Wasabee Operation",
"IMPORT_OP_SUCCESS": "Imported Operation: {opName} successfuly.",
@@ -166,10 +150,8 @@
"LOADING": "[loading]",
"LOADING1": "Loading: [{portalGuid}]",
"LOC_PROC": "location processed",
- "LOC_UPDATE": "Location Update",
"LOCATION SUB": "Location registered",
"LOCFRMSER": " (locally and from server)",
- "LOG IN QUICK": "Log In (quick; for Android)",
"LOG IN": "Log In",
"LOG_OUT": "Log Out",
"MADRID_SET_1": "Select the region for baselink Anchor 2 to Anchor 3",
@@ -209,8 +191,6 @@
"MM_SPINE": "Spine",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Draw",
- "MULTIMAX": "Multimax!",
- "MULTIMAX2": "Multimax",
"MUST_NOT_BE_EMPTY": "Must Not Be Empty",
"MY_CAP_ID": "My Capsule ID",
"MY_COUNT": "My Count",
@@ -222,16 +202,12 @@
"NEW_WAS_SERVER": "New Wasabee Server",
"NEWOP BUTTON TITLE": "Create a new Operation",
"NEWOP BUTTON": "New Op",
- "NO_DATA": "No data",
"NO_DT_ITEMS": "No DrawTools drawn items detected",
"NO_LABEL": "No label set",
- "NO_PORT_SEL": "No Portal Selected.",
"NO_STOCK_INTEL": "Wasabee doesn't support stock intel draw imports",
"NO_TITLE": "No title set",
- "NO": "No",
"NOT LOGGED IN SHORT": "Not Logged in",
"NOT LOGGED IN": "Not Logged in: {error}",
- "NOT_LOADED": "Not fully loaded, try again.",
"NOT_SET": "not set",
"NTNAME": "Name",
"OK": "OK",
@@ -257,11 +233,7 @@
"OtherPortalAlert": "Other",
"PASTE_INSTRUCT": "Paste a Wasabee draw export here.\n\nWasabee cannot import the stock intel format.\n\nThere is experimental support for importing the IITC DrawTools format.\n\nBefore importing DrawTools format, preview the areas and make sure all the portals load so IITC has them cached. Any portals that are not pre-cached will be faked.\n\nYou will need to use the 'swap' feature to move anchors from the faked portals to the real portals (they should be in the correct location, just not associated with the portal.\n\nCached portals might not be properly named.",
"pending": "Pending",
- "PENDING": "Pending",
"PERMS": "{opName} permissions",
- "PICK_DEST_FIRST": "Please select a destination portal first!",
- "PICK_TAR_FIRST": "Please select a target portal first!",
- "PICK_TARGETDEST_Portals": "Please select target and destination portals first!",
"PLEASE_SELECT_PORTAL": "Please select a portal",
"PORT_FAKE": " portals. Faked ",
"PORTAL KEY LIST": "Key list for portal {portalName}",
@@ -275,9 +247,7 @@
"QD TITLE": "Quick Draw Layers",
"QD TOGGLE MODE": "Change mode",
"QDBASE": "Base Link",
- "QDCANCEL": "Cancel Drawing Fields",
"QDCONT": "Click a spine portal to draw a field.",
- "QDEND": "Click again on the same portal to finish drawing.",
"QDNEXT": "Click the second anchor portal.",
"QDSTART": "Click the first anchor portal.",
"READ_SHORT": "RO",
@@ -300,10 +270,8 @@
"SAVELINKS_DRAW": "Save Links",
"SAVELINKS": "Save Links",
"SECONDS": " ({seconds} seconds ago)",
- "SEL_PORT_FIRST": "Please select anchor portals first!",
"SEL_SB_ANCHOR": "Select the anchor.",
"SEL_SB_ANCHOR2": "Zoom out. Make sure portals have all loaded, then click draw.",
- "SEL_SB_ANCHOR3": "Please be patient, it can take a bit.",
"SEL_SL_ANCHOR": "Select the portal to save the links of. Click save links button and look at checklist.",
"SEL_SRC_ANC2": "Select both Source and Anchor 2",
"SEL_SRC_PORT": "Select a source portal",
@@ -311,7 +279,6 @@
"SELECT_FAN_PORTALS": "Select an anchor portal, a start portal, and an end portal, then position the view over the field area.",
"SELECT_FAN_PORTALS2": "Wait for all portals to load, then click draw.",
"SELECT_INSTRUCTIONS": "Select two anchor portals, then zoom over the spine area.",
- "SELECT_MADRID_INSTRUCTIONS": "Select three anchor portals, zoom in on the area near the selected anchor, wait until the portals are loaded (portals must be on screen to be considered) then select the 'define spine region' button for the corresponding base links.",
"SELECT_ONION_PORTALS": "Layers build from the inside out. Zoom in to center and select starting portal, then zoom out to area.",
"SELF SWAP": "Cannot swap a portal with itself! Select a different portal.",
"SEND ANALYTICS": "Send Anonymous Analytics",
@@ -357,16 +324,13 @@
"SWAP": "Swap",
"SYNC DONE": "Download Complete Click HERE for hints, tips, and documentation. ",
"SYNC": "Download Available Operations",
- "TARDEST_DIFF": "Target and destination portals must be different.",
"TARGET SENT": "Target sent",
- "TEAM PERM DENIED": "Permission denied to team: {error}",
"TEAM STATE": "Share Location",
"TEAM_CREATED": "Team {teamName} created",
"TEAM_NAME": "Team Name",
"TEAM": "Team",
"TEAMS BUTTON TITLE": "List Wasabee Teams",
"TEAMS BUTTON": "Teams",
- "TITLE": "title",
"TO_PORT": "To Portal",
"TRAWL SKIP TILES": "Trawl Skip Tiles",
"TRAWL TITLE": "Trawl Lanes",
@@ -390,7 +354,6 @@
"UPDATED": "Successfully updated",
"UpgradePortalAlert": "Upgrade",
"UPLOAD BUTTON HOVER": "UPLOAD {opName} (not currently on server)",
- "UPLOAD PERM DENIED": "Permission to upload denied",
"UPLOADED": "Successfully uploaded",
"USE PANES ON MOBILE": "Use panes (need reload)",
"USE_SWAP_INSTRUCT": ". Please use the swap feature to move faked portals to the real portals at the same location. Zooming in on the 'Loading' portals in the checklist might force them to load.",
@@ -407,7 +370,6 @@
"WRITE_SHORT": "RW",
"WRITE": "write",
"WSERVER": "Server: {url}",
- "YES": "Yes",
"YESNO_DEL": "Are you sure you want to delete {opName}?",
"ZONE_DRAW": "Click to set the zone boundaries",
"ZONE": "Zone",
From a2b2413a4b07cfedb64f866cb937538d4663e784 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:23:57 -0600
Subject: [PATCH 078/275] Remove 39 unused keys
---
src/code/translations/filipino.json | 39 -----------------------------
1 file changed, 39 deletions(-)
diff --git a/src/code/translations/filipino.json b/src/code/translations/filipino.json
index 789b5763c..3c71f260f 100644
--- a/src/code/translations/filipino.json
+++ b/src/code/translations/filipino.json
@@ -1,5 +1,4 @@
{
- "ABOUT WASABEE-IITC": "Tungkol sa Wasabee-IITC",
"ABOUT_WASABEE": "Tungkol sa Wasabee",
"acknowledged": "Natanggap",
"ADD LINK TITLE": "Magdagdag ng Links",
@@ -39,7 +38,6 @@
"ASSIGNED_ONLY_SHORT": "AO",
"ASSIGNED_ONLY": "Assigned Only",
"assigned": "Naitalaga",
- "ASSIGNED": "Naitalaga",
"AUTH ANDROID": "Sa Android, subukan muna ang 'quick'. Kung hindi gumana, subukan ang main login gamit ang 'select_account'.",
"AUTH INCOMPAT": "May ginagamit kang plugin sa TamperMonkey na hindi angkop sa Wasabee",
"AUTH IOS": "Sa iOS, subukan muna ang 'Log In'. Kung hindi gumana, gawin ang 'Webview Log in', mag-log in, tapos gamitin ang 'Verify Webview' button para makumpleto ang proseso.",
@@ -67,7 +65,6 @@
"CLEAR LINKS": "Clear Links",
"CLEAR MARKERS": "Clear Markers",
"CLEAR_EVERYTHING": "Burahin Portals/Links/Markers",
- "CLEAR": "Burahin ang Pinili",
"CLEAROPS BUTTON TITLE": "Burahin lahat ng locally stored na operasyon",
"CLEAROPS BUTTON": "Burahin Local Ops",
"CLEAROPS PROMPT": "Nais mo bang tangalin ang lahat ng opersyon sa local storage? Ang mga Ops na nakalagay sa server ay mababawi sa susunod na sync.",
@@ -75,9 +72,7 @@
"COMMENT": "Komentaryo",
"COMPLETED BY": "Nakumpleto ni {agentName}",
"completed": "Naikumpleto",
- "COMPLETED": "Naikumpleto",
"CON_DEL": "Kumpirmahin ang Pagtangal: {opName}",
- "CONFIRM_DELETE": "Gusto mo bang tangalin ang link: ",
"COUNT": "Bilang",
"CREATE_NEW_TEAM": "Magbuo ng bagong Pangkat",
"CreateLinkAlert": "Link",
@@ -88,19 +83,12 @@
"DELETE ANCHOR TITLE": "Tanggalin ang Anchor",
"DELETE MARKER PROMPT": "Gusto mo bang tangalin ang marker na ito: ",
"DELETE MARKER TITLE": "Tanggalin ang Marker",
- "DELETE PERM DENIED": "Walang pahintulot para mag tangal",
"DELETE_ANCHOR": "Tangalin",
"DELETE_LINK": "Tangalin",
- "DELETE_MARKER": "Tangalin",
"DELETE_OP": "Tangalin {opName}",
- "DELETED": "Matagumpay na naitangal",
"DESCRIP_PLACEHOLD": "Description (opsyonal)",
"DestroyPortalAlert": "Sirain",
- "DISABLE_SYNC": "Ang Wasabee at stock sync plugin ay hindi compatible. Paki disable sync para gamitin ang Wasabee",
- "DISABLED": "Hindi pa handa ang feature na ito",
- "DONE": "Tapos",
"DRAW TOOLS FORMAT": "Draw Tools Format",
- "DT_FORMAT": "Draw Tools Format",
"DUPE_OP": "Kopyahin ang Operasyon",
"END_PORT": "End Portal ",
"ExcludeMarker": "Ibukod sa Auto-Draw/Pag-marka",
@@ -108,8 +96,6 @@
"EXPORT OP": "I-Export ang Op",
"EXPORT": "Export: ",
"FAKED": "Faked: [{portalId}]",
- "FAN_FIELD3": "Fan Field",
- "FANFIELD TITLE": "Fanfield",
"FANFIELD": "Guhit",
"FANFIELD2": "Iguhit ang Fanfield",
"FarmPortalMarker": "Farm",
@@ -124,19 +110,16 @@
"FROM_DEPTH": "from the depth",
"FROM_PORT": "Mula sa Portal",
"GET DT": "Get existing DrawTools draw",
- "GET_DT_DRAW": "Kunin ang current DrawTools draw",
"GetKeyPortalMarker": "Kunin ang Keys",
"GotoPortalMarker": "Pumunta",
"H-GEN_INST": "Set portals for the outside layer. Choose number of splits. Click draw",
"HF_DEEP_SEARCH": "Exhaustive search",
"HF_DRAW_BUTTON": "Draw",
- "HF_DRAW_DEEP_BUTTON": "Draw with deep recursion",
"HF_REDRAW_BUTTON": "Redraw",
"HG": "Homogeneous Field",
"HOURS": " ({hours} oras nakalipas)",
"HOW_TO_VIDS": "How-To Videos: ",
"IMP_COMP": "Natapos ang Pag Import. ",
- "IMP_DT_OP": "Na-Import na Drawtools Op: ",
"IMP_NOPE": "Pag-I-Import Hindi Matagumpay: {error}",
"IMP_WAS_OP": "I-Import ang Wasabee operasyon",
"IMPORT_OP_SUCCESS": "Na-Import na Operasyon: {opName} Matagumpay.",
@@ -166,10 +149,8 @@
"LOADING": "[loading]",
"LOADING1": "Loading: [{portalGuid}]",
"LOC_PROC": "Lokasyon nai-proseso",
- "LOC_UPDATE": "Pag-update ng Lokasyon",
"LOCATION SUB": "Nairehistro ang lokasyon",
"LOCFRMSER": " (locally at sa server)",
- "LOG IN QUICK": "Log In (quick; for Android)",
"LOG IN": "Mag Log In",
"LOG_OUT": "Log Out",
"MADRID_SET_1": "Select the region for baselink Anchor 2 to Anchor 3",
@@ -209,8 +190,6 @@
"MM_SPINE": "Spine",
"MULTI_M_TITLE": "Gumuhit ng Max Layers",
"MULTI_M": "Multimax",
- "MULTIMAX": "Multimax!",
- "MULTIMAX2": "Multimax",
"MUST_NOT_BE_EMPTY": "Hindi maari na walang laman",
"MY_CAP_ID": "Aking Capsule ID",
"MY_COUNT": "Aking Bilang",
@@ -222,16 +201,12 @@
"NEW_WAS_SERVER": "Bagong Waasbee Server",
"NEWOP BUTTON TITLE": "Bumuo ng bagong Operasyon",
"NEWOP BUTTON": "Bagong Op",
- "NO_DATA": "Walang Data",
"NO_DT_ITEMS": "Walang DrawTools drawn items na nakita",
"NO_LABEL": "Walang tatak",
- "NO_PORT_SEL": "Walang napili na Portal.",
"NO_STOCK_INTEL": "Hindi suportado ng Wasabee ang stock intel draw imports",
"NO_TITLE": "Walang Pamagat",
- "NO": "Hindi",
"NOT LOGGED IN SHORT": "Hindi naka-Logged in",
"NOT LOGGED IN": "Hindi naka-Logged in {error}",
- "NOT_LOADED": "Hindi nai-load, ulitin muli.",
"NOT_SET": "hindi naitalaga",
"NTNAME": "Pangalan",
"OK": "OK",
@@ -257,11 +232,7 @@
"OtherPortalAlert": "Iba",
"PASTE_INSTRUCT": "I-Paste ang Wasabee draw export dito.\n\nHindi ma-import ng Wasabee ang stock intel format.\n\nMerong experimental na suporta para sa pag-import ng IITC DrawTools format.\n\nBago i-import ang DrawTools format, tignan ang mga areas at siguraduhing lahat ng portals naka-load para naka-cached ito sa IITC. Ang mga portals na hindi pre-cached ay that are not pre-cached ay ipapalit ng 'fake' portal.\n\nKailangan mong gamitin ang 'Ipagpalit' feature para ipatlit ang mga anchor mula sa fake portal sa tamang portal. (ang portal ay dapat nasa tamang lokasyon.\n\nAng mga pangalan ng naka-Cached na portals ay hindi maaring nakapangalan ng tama.)",
"pending": "Nakabinbin",
- "PENDING": "Nakabinbin",
"PERMS": "{opName} permisyo",
- "PICK_DEST_FIRST": "Pumili muna ng destinasyon na portal!",
- "PICK_TAR_FIRST": "Pumili muna ng simulang portal!",
- "PICK_TARGETDEST_Portals": "Pumili muna ng simula and destinasyon na portals!",
"PLEASE_SELECT_PORTAL": "Pumili ng portal",
"PORT_FAKE": " portals ang nakita. Faked ",
"PORTAL KEY LIST": "Listahan ng Key para sa Portal {portalName}",
@@ -275,9 +246,7 @@
"QD TITLE": "Mabilisang Pagukit ng Layers",
"QD TOGGLE MODE": "Change mode",
"QDBASE": "Base Link",
- "QDCANCEL": "Kanselahin Pagukit ng Fields",
"QDCONT": "I-Click ang mga spine portal para I-drawing ang field.",
- "QDEND": "I-Click muli ang kaparehong portal para tapusin ang pagukit.",
"QDNEXT": "I-Click ang pangalawang anchor portal.",
"QDSTART": "I-Click ang unang anchor portal.",
"READ_SHORT": "RO",
@@ -300,10 +269,8 @@
"SAVELINKS_DRAW": "Save Links",
"SAVELINKS": "Save Links",
"SECONDS": " ({seconds} segundong nakalipas)",
- "SEL_PORT_FIRST": "Pumili muna ng anchor portals!",
"SEL_SB_ANCHOR": "Pillin ang anchor, I-zoom sa area para dagdagan sa starburst",
"SEL_SB_ANCHOR2": "Zoom out. Make sure portals have all loaded, then click draw.",
- "SEL_SB_ANCHOR3": "Please be patient, it can take a bit.",
"SEL_SL_ANCHOR": "Select the portal to save the links of. Click save links button and look at checklist.",
"SEL_SRC_ANC2": "Piliin ang Panimula at Anchor 2",
"SEL_SRC_PORT": "Pumili ng panimulang portal",
@@ -311,7 +278,6 @@
"SELECT_FAN_PORTALS": "Pumili ng mga anchor portals, (isang panimulang portal at panghuling portal) tapos i-zoom in sa lugar na i-fan field, hintayin na mag load ang mga portals (dapat nasa screen ang mga portals) at pindutin ang Fanfield button.",
"SELECT_FAN_PORTALS2": "Wait for all portals to load, then click draw.",
"SELECT_INSTRUCTIONS": "Pumili ng dalawang anchor portals, tapos i-zoom in sa lugar para sa spine, hintayin mag-load ang mga portals (dapat nasa screen ang mga portals para gumana) tapos pindutin ang Multimax button.",
- "SELECT_MADRID_INSTRUCTIONS": "Select three anchor portals, zoom in on the area near the selected anchor, wait until the portals are loaded (portals must be on screen to be considered) then select the 'define spine region' button for the corresponding base links.",
"SELECT_ONION_PORTALS": "Layers build from the inside out. Zoom in to center and select starting portal, then zoom out to area.",
"SELF SWAP": "Hindi maaari ipagpalit ang portal sa sarili! Pumili ng ibang portal.",
"SEND ANALYTICS": "Send Anonymous Analytics",
@@ -357,16 +323,13 @@
"SWAP": "Ipagpalit",
"SYNC DONE": "Matagumpay na i-Download Mag-click DITO para sa mga pahiwatig, tip, at dokumentasyon. ",
"SYNC": "I-Download ang Matatamo na mga Operasyon",
- "TARDEST_DIFF": "Dapat magkaiba ang simula at destinasyon na portals.",
"TARGET SENT": "Naipadala ang Target",
- "TEAM PERM DENIED": "Walang pahintulot sa pangkat {error}",
"TEAM STATE": "Share Location",
"TEAM_CREATED": "Pangkat {teamName} nabuo",
"TEAM_NAME": "Pangalan ng Pangkat",
"TEAM": "Pangkat",
"TEAMS BUTTON TITLE": "I-Lista mga Wasabee Pangkat",
"TEAMS BUTTON": "Pangkat",
- "TITLE": "Pamagat",
"TO_PORT": "Papunta sa Portal",
"TRAWL SKIP TILES": "Trawl Skip Tiles",
"TRAWL TITLE": "Trawl Lanes",
@@ -390,7 +353,6 @@
"UPDATED": "Matagumpay na i-update",
"UpgradePortalAlert": "Upgrade",
"UPLOAD BUTTON HOVER": "UPLOAD {opName} (kasalukuyang wala sa server)",
- "UPLOAD PERM DENIED": "Walang pahintulot para sa pag-upload",
"UPLOADED": "Matagumpay na i-upload",
"USE PANES ON MOBILE": "Use panes (need reload)",
"USE_SWAP_INSTRUCT": ". Gamitin ang 'Ipagpalit' na feature para ipalit ang 'faked' portals sa totoong portals. Ang pag zoom sa 'Loading' portals sa listahan ay posibleng ma-'force load' ito.",
@@ -407,7 +369,6 @@
"WRITE_SHORT": "RW",
"WRITE": "isulat",
"WSERVER": "Server: {url}",
- "YES": "Oo",
"YESNO_DEL": "Sigurado ka na gusto mo burahin ang {opName}?",
"ZONE_DRAW": "Click to set the zone boundaries",
"ZONE": "Zoned",
From f10ea5b2e13678832bd5069ae8e69bbdfcf29b1b Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:25:24 -0600
Subject: [PATCH 079/275] Remove 39 unused keys
---
src/code/translations/french.json | 39 -------------------------------
1 file changed, 39 deletions(-)
diff --git a/src/code/translations/french.json b/src/code/translations/french.json
index c8effcc06..4d751943e 100644
--- a/src/code/translations/french.json
+++ b/src/code/translations/french.json
@@ -1,5 +1,4 @@
{
- "ABOUT WASABEE-IITC": "À propos de Wasabee-IITC",
"ABOUT_WASABEE": "Au sujet de Wasabee",
"acknowledged": "Noté",
"ADD LINK TITLE": "Ajouter des liens",
@@ -39,7 +38,6 @@
"ASSIGNED_ONLY_SHORT": "AO",
"ASSIGNED_ONLY": "Seulement les affectations",
"assigned": "Assigné",
- "ASSIGNED": "Assigné",
"AUTH ANDROID": "On Android, try 'quick' first. If that fails, try the main login with 'select_account'.",
"AUTH INCOMPAT": "You have activated a plugin in TamperMonkey that is incompatable with Wasabee",
"AUTH IOS": "On iOS, use the main 'Log In' option. If that fails, use 'Webview Login' then use the 'Verify Webview' button to complete the process.",
@@ -67,7 +65,6 @@
"CLEAR LINKS": "Supprimer les liens",
"CLEAR MARKERS": "Supprimer les marqueurs",
"CLEAR_EVERYTHING": "Supprimer Portails/Links et Marquers",
- "CLEAR": "Effacer",
"CLEAROPS BUTTON TITLE": "Supprimer TOUTES les données Wasabee",
"CLEAROPS BUTTON": "Supprimer les données Wasabee",
"CLEAROPS PROMPT": "Toutes les opérations et données relatives à Wasabee seront supprimées de cet appareil. Seules les données présentes sur le/les serveurs seront récupérées à la prochaine synchronisation.",
@@ -75,9 +72,7 @@
"COMMENT": "Commentaire",
"COMPLETED BY": "Fait par {agentName}",
"completed": "Completée",
- "COMPLETED": "Completée",
"CON_DEL": "Confirmer la suppression : {opName}",
- "CONFIRM_DELETE": "Voulez-vous vraiment supprimer ce lien :",
"COUNT": "Nombre",
"CREATE_NEW_TEAM": "Créer une équipe",
"CreateLinkAlert": "Lien",
@@ -88,19 +83,12 @@
"DELETE ANCHOR TITLE": "Supprimer une ancre",
"DELETE MARKER PROMPT": "Voulez vous supprimer le marqueur :",
"DELETE MARKER TITLE": "Supprimer un marqueur",
- "DELETE PERM DENIED": "Suppression interdite",
"DELETE_ANCHOR": "Supprimer",
"DELETE_LINK": "Supprimer",
- "DELETE_MARKER": "Supprimer",
"DELETE_OP": "Supprimer {opName}",
- "DELETED": "Suppression faite.",
"DESCRIP_PLACEHOLD": "Description (optionnelle)",
"DestroyPortalAlert": "Casse",
- "DISABLE_SYNC": "Le plugin \"Sync\" n'est pas compatible avec Wassabe. Désactiver le pour continuer",
- "DISABLED": "Cette fonction n'est pas encore disponible",
- "DONE": "Fait",
"DRAW TOOLS FORMAT": "Format DrawTools",
- "DT_FORMAT": "Format DrawTools",
"DUPE_OP": "Dupliquer l'opération",
"END_PORT": "Portail de fin",
"ExcludeMarker": "Exclure d'Auto-Draw/Mark",
@@ -108,8 +96,6 @@
"EXPORT OP": "Exporter",
"EXPORT": "Exporter : ",
"FAKED": "Faux [{portalId}]",
- "FAN_FIELD3": "Fan Field",
- "FANFIELD TITLE": "Fanfield",
"FANFIELD": "Draw",
"FANFIELD2": "Draw Fan Field",
"FarmPortalMarker": "Farm",
@@ -124,19 +110,16 @@
"FROM_DEPTH": "depuis l'intérieur vers l'extérieur",
"FROM_PORT": "Depuis le Portail",
"GET DT": "Récupérer le dessin actuel",
- "GET_DT_DRAW": "Importer une dessin de DrawTools",
"GetKeyPortalMarker": "Clés",
"GotoPortalMarker": "Aller à",
"H-GEN_INST": "Choisissez les 3 portails du field englobant, le nombre de couches et cliquez sur Draw.",
"HF_DEEP_SEARCH": "Recherche exhaustive",
"HF_DRAW_BUTTON": "Draw",
- "HF_DRAW_DEEP_BUTTON": "Draw with deep recursion",
"HF_REDRAW_BUTTON": "Re-Draw",
"HG": "Field homogène",
"HOURS": "(il y a {hours} heures)",
"HOW_TO_VIDS": "Tuto: ",
"IMP_COMP": "Importation reussi. ",
- "IMP_DT_OP": "Op Drawtools: ",
"IMP_NOPE": "Echec de l'importation: {error}",
"IMP_WAS_OP": "Importer les opérations Wasabee",
"IMPORT_OP_SUCCESS": "Importer l'opération : {opName} Reussi.",
@@ -166,10 +149,8 @@
"LOADING": "[chargement]",
"LOADING1": "Chargement: {portalGuid}",
"LOC_PROC": "Emplacement traité",
- "LOC_UPDATE": "Emplacement mis à jour",
"LOCATION SUB": "Location registered",
"LOCFRMSER": "(Localement et sur le serveur)",
- "LOG IN QUICK": "Log In (quick; for Android)",
"LOG IN": "Connexion",
"LOG_OUT": "Déconnexion",
"MADRID_SET_1": "Définir la zone pour le multifield de base 2-3",
@@ -209,8 +190,6 @@
"MM_SPINE": "Spine",
"MULTI_M_TITLE": "Dessiner le maximum de couches",
"MULTI_M": "Draw",
- "MULTIMAX": "Multimax!",
- "MULTIMAX2": "Multimax",
"MUST_NOT_BE_EMPTY": "Ne dois pas être vide",
"MY_CAP_ID": "ID de ma capsule",
"MY_COUNT": "Mon nombre de clés",
@@ -222,16 +201,12 @@
"NEW_WAS_SERVER": "Nouveau serveur Wasabee",
"NEWOP BUTTON TITLE": "Créer une opération",
"NEWOP BUTTON": "+ Op",
- "NO_DATA": "Pas de données",
"NO_DT_ITEMS": "Pas de Draw détecté",
"NO_LABEL": "Pas de nom donné",
- "NO_PORT_SEL": "Aucun portail sélectionné",
"NO_STOCK_INTEL": "Wasabee ne supporte pas les draws de l'intel stock.",
"NO_TITLE": "Titre non défini",
- "NO": "Non",
"NOT LOGGED IN SHORT": "Déconnecté",
"NOT LOGGED IN": "Déconnecté : {error}",
- "NOT_LOADED": "N'a pas chargé entierement, essayer à nouveau",
"NOT_SET": "non défini",
"NTNAME": "Nom",
"OK": "OK",
@@ -257,11 +232,7 @@
"OtherPortalAlert": "Autre",
"PASTE_INSTRUCT": "Paste a Wasabee draw export here.\n\nWasabee cannot import the stock intel format.\n\nThere is experimental support for importing the IITC DrawTools format.\n\nBefore importing DrawTools format, preview the areas and make sure all the portals load so IITC has them cached. Any portals that are not pre-cached will be faked.\n\nYou will need to use the 'swap' feature to move anchors from the faked portals to the real portals (they should be in the correct location, just not associated with the portal.\n\nCached portals might not be properly named.",
"pending": "En attente",
- "PENDING": "En attente",
"PERMS": "Permissions de {opName}",
- "PICK_DEST_FIRST": "Vous devez d'abord sélectionner un portail de destination!",
- "PICK_TAR_FIRST": "Vous devez d'abord sélectionner un portail cible!",
- "PICK_TARGETDEST_Portals": "Please select target and destination portals first!",
"PLEASE_SELECT_PORTAL": "Selectionner un portail",
"PORT_FAKE": "portails trouvés. ",
"PORTAL KEY LIST": "Clés du portail {portalName}",
@@ -275,9 +246,7 @@
"QD TITLE": "Quick Draw",
"QD TOGGLE MODE": "Changer de mode",
"QDBASE": "Base",
- "QDCANCEL": "Annuler le draw du field",
"QDCONT": "Cliquez sur un portail pour faire un field",
- "QDEND": "Click again on the same portal to finish drawing.",
"QDNEXT": "Cliquez sur la seconde ancre",
"QDSTART": "Cliquez sur la première ancre",
"READ_SHORT": "RO",
@@ -300,10 +269,8 @@
"SAVELINKS_DRAW": "Copier les liens",
"SAVELINKS": "Copie de liens intel",
"SECONDS": "(il y a {seconds} secondes)",
- "SEL_PORT_FIRST": "Selectionnez d'abord les ancres !",
"SEL_SB_ANCHOR": "Sélectionner l'ancre.",
"SEL_SB_ANCHOR2": "Dézoomer en laissant charger les portails de la zone puis cliquer sur Draw.",
- "SEL_SB_ANCHOR3": "Patience, cela peut prendre du temps",
"SEL_SL_ANCHOR": "Sélectionner le portail dont vous voulez copier les liens vers l'opération courante.",
"SEL_SRC_ANC2": "Selectionnez le portail source ET la seconde ancre",
"SEL_SRC_PORT": "Selectionnez le portail source.",
@@ -311,7 +278,6 @@
"SELECT_FAN_PORTALS": "Selectionner une ancre, le premier portail et le dernier portail du Fanfield. Le reste sera calculé à partir des portails visibles.",
"SELECT_FAN_PORTALS2": "Attendez le chargement des portails et cliquer sur Draw.",
"SELECT_INSTRUCTIONS": "Selectionner deux ancres, puis zoomer sur la zone contenant l'alignement.",
- "SELECT_MADRID_INSTRUCTIONS": "Selectionner les trois zones contenant les alignements ainsi que le premier portail chacun des deux premiers alignements.",
"SELECT_ONION_PORTALS": "Les couches sont construites de la plus petite à la plus grande, avec au plus trois fields par portail en commençant par le portal défini, puis en utilisant les portails visibles.",
"SELF SWAP": "Le portail selectionné est le même. Selectionnez un autre portail.",
"SEND ANALYTICS": "Envoyer des statistiques anonymes",
@@ -357,16 +323,13 @@
"SWAP": "Déplacer",
"SYNC DONE": "Téléchargement terminé Cliquez ICI pour obtenir des conseils, des astuces et de la documentation. ",
"SYNC": "Telecharger les opérations disponibles",
- "TARDEST_DIFF": "La source et la cible doivent etre differentes.",
"TARGET SENT": "Cible transmise",
- "TEAM PERM DENIED": "Permission refusée pour l'équipe : {error}",
"TEAM STATE": "Partage de position",
"TEAM_CREATED": "Équipe {teamName} créée",
"TEAM_NAME": "Nom d'équipe",
"TEAM": "Équipe",
"TEAMS BUTTON TITLE": "Liste des équipes",
"TEAMS BUTTON": "Équipes",
- "TITLE": "titre",
"TO_PORT": "Vers le portail",
"TRAWL SKIP TILES": "Trawl Skip Tiles",
"TRAWL TITLE": "Fouille des bloquants",
@@ -383,7 +346,6 @@
"UNKNOWN": "Inconnu",
"UPDATE HOVER NOT CHANGED": "{opName} n'a pas changé localement",
"UPDATE HOVER": "Mettre à jour {opName} sur le serveur",
- "UPDATE PERM DENIED": "You do not have permission to update",
"UPDATE_CONFLICT_DESC": "L'opération a été modifié sur le serveur depuis la dernière synchronisation. Voulez-vous écraser la version du serveur par la votre ?",
"UPDATE_CONFLICT_TITLE": "Conflit avec le serveur",
"UPDATE_COUNT": "Nombre mis un jour",
@@ -407,7 +369,6 @@
"WRITE_SHORT": "RW",
"WRITE": "modifier",
"WSERVER": "Serveur: {url}",
- "YES": "Oui",
"YESNO_DEL": "Voulez vous vraiment supprimer {opName} ?",
"ZONE_DRAW": "Click to set the zone boundaries",
"ZONE": "Zone",
From f3055a0c6c8ce3aa7c203d6151ea20664060ded1 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:26:06 -0600
Subject: [PATCH 080/275] Remove 39 unused keys
---
src/code/translations/german.json | 39 -------------------------------
1 file changed, 39 deletions(-)
diff --git a/src/code/translations/german.json b/src/code/translations/german.json
index 2cf6eae59..7a926631c 100644
--- a/src/code/translations/german.json
+++ b/src/code/translations/german.json
@@ -1,5 +1,4 @@
{
- "ABOUT WASABEE-IITC": "Über Wasabee-IITC",
"ABOUT_WASABEE": "Über Wasabee",
"acknowledged": "Acknowledged",
"ADD LINK TITLE": "Dialog - Links hinzufügen",
@@ -39,7 +38,6 @@
"ASSIGNED_ONLY_SHORT": "AO",
"ASSIGNED_ONLY": "Assigned Only",
"assigned": "Zugewiesen",
- "ASSIGNED": "Zugewiesen",
"AUTH ANDROID": "Mit Android versuche 'quick' zuerst. Wenn das fehlschlägt, versuche es mit 'select_account' ",
"AUTH INCOMPAT": "Du hast ein Plugin aktiviert welches inkompatibel zu Wasabee ist.",
"AUTH IOS": "Mit IOS nutze 'Log in'. Wenn das fehlschlägt nutze 'Webview Log in'; Danach nutze den 'Verify Webview' Knopf um den Prozess abzuschließen",
@@ -67,7 +65,6 @@
"CLEAR LINKS": "Clear Links",
"CLEAR MARKERS": "Clear Markers",
"CLEAR_EVERYTHING": "Clear Portals/Links/Markers for current OP",
- "CLEAR": "Clear selection",
"CLEAROPS BUTTON TITLE": "Lösche alle Wasabee Daten",
"CLEAROPS BUTTON": "Lösche Wasabee Daten",
"CLEAROPS PROMPT": "Das wird alle Wasabee Daten Löschen. Bei dem nächsten Sync wird alles wiederhergestellt.",
@@ -75,9 +72,7 @@
"COMMENT": "Kommentar",
"COMPLETED BY": "Abgeschlossen von {agentName}",
"completed": "Abgeschlossen",
- "COMPLETED": "Abgeschlossen",
"CON_DEL": "Bestätige Löschen: {opName}",
- "CONFIRM_DELETE": "Do you really want to delete this link: ",
"COUNT": "Anzahl",
"CREATE_NEW_TEAM": "Erstelle neues Team",
"CreateLinkAlert": "Link",
@@ -88,19 +83,12 @@
"DELETE ANCHOR TITLE": "Anker löschen",
"DELETE MARKER PROMPT": "Möchtest du die Markierung löschen? : ",
"DELETE MARKER TITLE": "Markierung löschen",
- "DELETE PERM DENIED": "Keine Berechtigung zum löschen",
"DELETE_ANCHOR": "Löschen",
"DELETE_LINK": "Delete",
- "DELETE_MARKER": "Delete",
"DELETE_OP": "Delete {opName}",
- "DELETED": "Erfolgreich gelöscht.",
"DESCRIP_PLACEHOLD": "Beschreibung (optional)",
"DestroyPortalAlert": "Destroy",
- "DISABLE_SYNC": "Das Standard Synchronisations Plugin ist nicht mit Wasabee kompatibel - Bitte deaktiveren",
- "DISABLED": "Diese Eigenschaft steht den Nutzern nicht zu verfügung",
- "DONE": "Fertig",
"DRAW TOOLS FORMAT": "Draw Tools Format",
- "DT_FORMAT": "Draw Tools Format",
"DUPE_OP": "Duplicate Operation",
"END_PORT": "Endportal",
"ExcludeMarker": "Exclude from Auto-Draw/Mark",
@@ -108,8 +96,6 @@
"EXPORT OP": "Exportiere Op",
"EXPORT": "Exportieren: ",
"FAKED": "Faked: [{portalId}]",
- "FAN_FIELD3": "Fan Field",
- "FANFIELD TITLE": "Fächerfeld",
"FANFIELD": "Fächerfeld!",
"FANFIELD2": "Fächerfeld",
"FarmPortalMarker": "Farm",
@@ -124,19 +110,16 @@
"FROM_DEPTH": "from the depth",
"FROM_PORT": "Von Portal",
"GET DT": "Get existing DrawTools draw",
- "GET_DT_DRAW": "Erhalte aktuelle DrawTools Zeichnung",
"GetKeyPortalMarker": "Get Keys",
"GotoPortalMarker": "Go To",
"H-GEN_INST": "Set portals for the outside layer. Choose number of splits. Click draw",
"HF_DEEP_SEARCH": "Exhaustive search",
"HF_DRAW_BUTTON": "Draw",
- "HF_DRAW_DEEP_BUTTON": "Draw with deep recursion",
"HF_REDRAW_BUTTON": "Redraw",
"HG": "Homogeneous Field",
"HOURS": "vor ({hours} Stunden)",
"HOW_TO_VIDS": "Erklärungsvideos: ",
"IMP_COMP": "Import Komplett. Gefunden ",
- "IMP_DT_OP": "Importierte Drawtools Op: ",
"IMP_NOPE": "Import Fehlgeschlagen: {error}",
"IMP_WAS_OP": "Importiere Wasabee Operation",
"IMPORT_OP_SUCCESS": "Importierte Operation: {opName}. Erfolgreich.",
@@ -166,10 +149,8 @@
"LOADING": "[laden]",
"LOADING1": "Lade: [{portalGuid}]",
"LOC_PROC": "Standort verarbeitet",
- "LOC_UPDATE": "Standort aktualisieren",
"LOCATION SUB": "Standort registriert",
"LOCFRMSER": " (locally and from server)",
- "LOG IN QUICK": "Einloggen (quick; für Android)",
"LOG IN": "Einloggen",
"LOG_OUT": "Log Out",
"MADRID_SET_1": "Select the region for baselink Anchor 2 to Anchor 3",
@@ -209,8 +190,6 @@
"MM_SPINE": "Spine",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Maximale Feldanzahl",
- "MULTIMAX": "Maximale Feldanzahl!",
- "MULTIMAX2": "Multimax",
"MUST_NOT_BE_EMPTY": "Darf nicht leer sein.",
"MY_CAP_ID": "Kapsel ID",
"MY_COUNT": "Meine Anzahl",
@@ -222,16 +201,12 @@
"NEW_WAS_SERVER": "Neuer Wasabee Server",
"NEWOP BUTTON TITLE": "Neue Operation erstellen",
"NEWOP BUTTON": "Neue Op",
- "NO_DATA": "Keine Daten",
"NO_DT_ITEMS": "Keine DrawTools Daten erkannt",
"NO_LABEL": "No label set",
- "NO_PORT_SEL": "Keine Portale ausgewählt.",
"NO_STOCK_INTEL": "Wasabee unterstützt keine Standard Intel imports",
"NO_TITLE": "No title set",
- "NO": "Nein",
"NOT LOGGED IN SHORT": "Nicht eingeloggt.",
"NOT LOGGED IN": "Nicht eingeloggt: {error}",
- "NOT_LOADED": "Nicht vollständig geladen - bitte erneut probieren.",
"NOT_SET": "nicht gesetzt",
"NTNAME": "Name",
"OK": "OK",
@@ -257,11 +232,7 @@
"OtherPortalAlert": "Other",
"PASTE_INSTRUCT": "Füge einen Wasabee Drawtools export hier ein.\n\nWasabee kann nicht mit dem Standard intel format umgehen.\n\nEs gibt einen Experimentellen Import vom IITC-DrawTools format.\n\n Vor dem Importieren bitte sicherstellen das alles geladen ist und die IITC es zwischengespeichert hat. Jedes nicht zwischengespeicherte Portal wird verfälscht. \n\nDu musst die 'Wechsel' Funktion verwenden um die verfälschten Portale zu korrigieren. (Sie sollten bereits an der richtigen Position sein - aber dem falschen Portal zugeordnet).",
"pending": "Ausstehend",
- "PENDING": "Ausstehend",
"PERMS": "{opName} permissions",
- "PICK_DEST_FIRST": "Bitte wähle zuerst ein Zielportal!",
- "PICK_TAR_FIRST": "Bitte wähle zuerst ein Startportal!",
- "PICK_TARGETDEST_Portals": "Bitte wähle zuerst Startportal und Endportal!",
"PLEASE_SELECT_PORTAL": "Bitte wähle ein Portal",
"PORT_FAKE": " Portale. Verfälscht ",
"PORTAL KEY LIST": "Key list for portal {portalName}",
@@ -275,9 +246,7 @@
"QD TITLE": "Schnelle Layer Zeichnung",
"QD TOGGLE MODE": "Change mode",
"QDBASE": "Basis Link",
- "QDCANCEL": "Zeichnen von Feld abbrechen",
"QDCONT": "Klicke auf ein Portal der Kette.",
- "QDEND": "Erneut auf das Portal klicken, um die Zeichnung zu beenden.",
"QDNEXT": "Klicke auf das zweite Ankerportal.",
"QDSTART": "Klicke auf das erste Ankerportal.",
"READ_SHORT": "RO",
@@ -300,10 +269,8 @@
"SAVELINKS_DRAW": "Save Links",
"SAVELINKS": "Save Links",
"SECONDS": "vor ({seconds} Sekunden)",
- "SEL_PORT_FIRST": "Bitte wähle zuerst die Ankerportale aus!",
"SEL_SB_ANCHOR": "Wähle einen Anker, Zomme in das Areal und füge es zum Starburst hinzu.",
"SEL_SB_ANCHOR2": "Zoom out. Make sure portals have all loaded, then click draw.",
- "SEL_SB_ANCHOR3": "Please be patient, it can take a bit.",
"SEL_SL_ANCHOR": "Select the portal to save the links of. Click save links button and look at checklist.",
"SEL_SRC_ANC2": "Lege Quelle und Anker 2 fest",
"SEL_SRC_PORT": "Wähle ein Quellportal",
@@ -311,7 +278,6 @@
"SELECT_FAN_PORTALS": "Wähle ein Ankerportal, wähle ein Startportal und ein Endportal, danach zoome in die Gegend des Fächers. Warte bis alle Portale geladen sind. Drücke anschließend den 'Fächerfeld' Knopf.",
"SELECT_FAN_PORTALS2": "Wait for all portals to load, then click draw.",
"SELECT_INSTRUCTIONS": "Wähle zwei Ankerportale. Zoome in die Gegend der Portalkette - warte bis die Portale geladen sind und drücke den 'Maximale Feldanzahl' Knopf.",
- "SELECT_MADRID_INSTRUCTIONS": "Select three anchor portals, zoom in on the area near the selected anchor, wait until the portals are loaded (portals must be on screen to be considered) then select the 'define spine region' button for the corresponding base links.",
"SELECT_ONION_PORTALS": "Layers build from the inside out. Zoom in to center and select starting portal, then zoom out to area.",
"SELF SWAP": "Du kannst das Portal nicht mit sich selbst tauschen - Wähle ein anderes.",
"SEND ANALYTICS": "Send Anonymous Analytics",
@@ -357,16 +323,13 @@
"SWAP": "Wechseln",
"SYNC DONE": "Download abgeschlossen Klicken Sie HIER für Hinweise, Tipps und Dokumentation. ",
"SYNC": "Download verfügbarer Operationen",
- "TARDEST_DIFF": "Start und Ziel müssen sich unterscheiden.",
"TARGET SENT": "Ziel gesendet",
- "TEAM PERM DENIED": "Keine Berechtigung für Team: {error}",
"TEAM STATE": "Share Location",
"TEAM_CREATED": "Team {teamName} erstellt.",
"TEAM_NAME": "Team Name",
"TEAM": "Team",
"TEAMS BUTTON TITLE": "Auflistung Wasabee Teams",
"TEAMS BUTTON": "Teams",
- "TITLE": "title",
"TO_PORT": "zu Portal",
"TRAWL SKIP TILES": "Trawl Skip Tiles",
"TRAWL TITLE": "Trawl Lanes",
@@ -383,7 +346,6 @@
"UNKNOWN": "Unbekannt",
"UPDATE HOVER NOT CHANGED": "{opName} lokal nicht verändert",
"UPDATE HOVER": "UPDATE {opName} auf dem Server",
- "UPDATE PERM DENIED": "Keine Berechtigung zum aktualisieren",
"UPDATE_CONFLICT_DESC": "The OP has been modified on server since last sync. Do you want to replace the server version by the current one?",
"UPDATE_CONFLICT_TITLE": "Conflict detected with server",
"UPDATE_COUNT": "Aktualisiere Anzahl",
@@ -407,7 +369,6 @@
"WRITE_SHORT": "RW",
"WRITE": "schreiben",
"WSERVER": "Server: {url}",
- "YES": "Ja",
"YESNO_DEL": "Bist du dir sicher das du {opName} löschen willst?",
"ZONE_DRAW": "Click to set the zone boundaries",
"ZONE": "Zoniert",
From beb75d55d8a95b07ed9a1a2f05391499ce6cd7f7 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:27:02 -0600
Subject: [PATCH 081/275] Remove 39 unused keys
---
src/code/translations/italian.json | 39 ------------------------------
1 file changed, 39 deletions(-)
diff --git a/src/code/translations/italian.json b/src/code/translations/italian.json
index 01dafd9f8..d4f418842 100644
--- a/src/code/translations/italian.json
+++ b/src/code/translations/italian.json
@@ -1,5 +1,4 @@
{
- "ABOUT WASABEE-IITC": "Info su Wasabee-IITC",
"ABOUT_WASABEE": "Info su Wasabee",
"acknowledged": "Ricevuto",
"ADD LINK TITLE": "Aggiunta Link",
@@ -39,7 +38,6 @@
"ASSIGNED_ONLY_SHORT": "AO",
"ASSIGNED_ONLY": "Solo Assegnati",
"assigned": "Assegnato",
- "ASSIGNED": "Assegnato",
"AUTH ANDROID": "Su Android, prova prima il login 'rapido'. Se fallisce, prova ad accedere con 'select_account'.",
"AUTH INCOMPAT": "Hai attivato un plugin in TamperMonkey incompatibile con Wasabee",
"AUTH IOS": "Su iOS, usa 'Log In'. Se fallisce, prova 'Webview Log in'; poi premi 'Verify Webview' per completare il processo.",
@@ -67,7 +65,6 @@
"CLEAR LINKS": "Elimina Link",
"CLEAR MARKERS": "Elimina Marker",
"CLEAR_EVERYTHING": "Elimina tutti i Portali/Link/Marker",
- "CLEAR": "Deseleziona",
"CLEAROPS BUTTON TITLE": "Elimina TUTTI i dati di Wasabee",
"CLEAROPS BUTTON": "Elimina i dati di Wasabee",
"CLEAROPS PROMPT": "Questo eliminerà tutte le OP e i dati relativi a Wasabee. Saranno ripristinati alla prossima sincronizzazione.",
@@ -75,9 +72,7 @@
"COMMENT": "Commento",
"COMPLETED BY": "Completato da {agentName}",
"completed": "Completato",
- "COMPLETED": "Completato",
"CON_DEL": "Conferma eliminazione: {opName}",
- "CONFIRM_DELETE": "Vuoi davvero eliminare questo link: ",
"COUNT": "Conteggio",
"CREATE_NEW_TEAM": "Crea Nuovo Team",
"CreateLinkAlert": "Linkare",
@@ -88,19 +83,12 @@
"DELETE ANCHOR TITLE": "Elimina Ancora",
"DELETE MARKER PROMPT": "Vuoi eliminare questo Marker: ",
"DELETE MARKER TITLE": "Elimina Marker",
- "DELETE PERM DENIED": "Permesso di eliminare negato.",
"DELETE_ANCHOR": "Elimina",
"DELETE_LINK": "Elimina",
- "DELETE_MARKER": "Elimina",
"DELETE_OP": "Eliminare {opName}",
- "DELETED": "Eliminato con successo.",
"DESCRIP_PLACEHOLD": "Descrizione (facoltativo)",
"DestroyPortalAlert": "Distruggere",
- "DISABLE_SYNC": "Il plugin Sync stock non è compatibile con Wasabee. Per favore disabilita Sync.",
- "DISABLED": "Questa funzione non è pronta per gli utenti",
- "DONE": "Fatto",
"DRAW TOOLS FORMAT": "Formato Draw Tools",
- "DT_FORMAT": "Formato Draw Tools",
"DUPE_OP": "Duplica Operazione",
"END_PORT": "Portale di fine ",
"ExcludeMarker": "Escludi da Auto-Draw/Mark",
@@ -108,8 +96,6 @@
"EXPORT OP": "Esporta Op",
"EXPORT": "Esporta: ",
"FAKED": "Simulato: [{portalId}]",
- "FAN_FIELD3": "Fan Field",
- "FANFIELD TITLE": "Fanfield",
"FANFIELD": "Fanfield!",
"FANFIELD2": "Fanfield",
"FarmPortalMarker": "Farmare",
@@ -124,19 +110,16 @@
"FROM_DEPTH": "dalla profondità",
"FROM_PORT": "Portale di origine",
"GET DT": "Usa disegno DrawTools esistente",
- "GET_DT_DRAW": "Importa disegno DrawTools",
"GetKeyPortalMarker": "Ottienere Chiavi",
"GotoPortalMarker": "Andare A",
"H-GEN_INST": "Seleziona Portali per lo strato esterno. Scegli il numero di split. Clicca Disegna",
"HF_DEEP_SEARCH": "Ricerca esaustiva",
"HF_DRAW_BUTTON": "Disegna",
- "HF_DRAW_DEEP_BUTTON": "Disegna con ricorsione profonda",
"HF_REDRAW_BUTTON": "Ridisegna",
"HG": "Field Omogeneo",
"HOURS": " ({hours} ore fa)",
"HOW_TO_VIDS": "Video tutorial: ",
"IMP_COMP": "Importazione Completata. Trovato ",
- "IMP_DT_OP": "Importata Operazione Drawtools: ",
"IMP_NOPE": "Importazione Fallita: {error}",
"IMP_WAS_OP": "Importa Operazione Wasabee",
"IMPORT_OP_SUCCESS": "Importata Operazione: {opName} con successo.",
@@ -166,10 +149,8 @@
"LOADING": "[caricamento]",
"LOADING1": "Caricamento: [{portalGuid}]",
"LOC_PROC": "posizione processata",
- "LOC_UPDATE": "Aggiornamento posizione",
"LOCATION SUB": "Posizione registrata",
"LOCFRMSER": " (locale e dal server)",
- "LOG IN QUICK": "Accedi (rapido; per Android)",
"LOG IN": "Accedi",
"LOG_OUT": "Logout",
"MADRID_SET_1": "Seleziona l'area per la base da Ancora 2 a Ancora 3",
@@ -209,8 +190,6 @@
"MM_SPINE": "Spine",
"MULTI_M_TITLE": "Disegna più strati possibile",
"MULTI_M": "Disegna",
- "MULTIMAX": "Multimax!",
- "MULTIMAX2": "Multimax",
"MUST_NOT_BE_EMPTY": "Non può essere vuoto",
"MY_CAP_ID": "ID Capsula",
"MY_COUNT": "Conteggio",
@@ -222,16 +201,12 @@
"NEW_WAS_SERVER": "Nuovo Server Wasabee",
"NEWOP BUTTON TITLE": "Crea una nuova Operazione",
"NEWOP BUTTON": "Nuova Op",
- "NO_DATA": "Dati mancanti",
"NO_DT_ITEMS": "Disegni DrawTools non rilevati",
"NO_LABEL": "Etichetta non impostata",
- "NO_PORT_SEL": "Portale non selezionato.",
"NO_STOCK_INTEL": "Wasabee non supporta importazioni di disegni dalla intel stock",
"NO_TITLE": "Titolo non impostato",
- "NO": "No",
"NOT LOGGED IN SHORT": "Non loggato",
"NOT LOGGED IN": "Non loggato: {error}",
- "NOT_LOADED": "Caricamento incompleto, riprova.",
"NOT_SET": "non impostato",
"NTNAME": "Nome",
"OK": "OK",
@@ -257,11 +232,7 @@
"OtherPortalAlert": "Altro",
"PASTE_INSTRUCT": "Incolla un disegno esportato da Wasabee qui.\n\nWasabee non può importare il formato intel stock.\n\nL'importazione di disegni in formato IITC DrawTools è supportata in modo sperimentale.\n\nPrima di importare in formato DrawTools, controlla l'area e fai in modo che tutti i portali carichino, così da essere nella cache di IITC. Ogni Portale non nella cache sarà 'finto'.\n\nDovrete usare la funzione 'swap' per spostare le ancore dai portali 'finti' a quelli veri (dovrebbero essere al posto giusto, solo non associate al Portale).\n\nI Portali nella cache potrebbero non avere il giusto nome.",
"pending": "In corso",
- "PENDING": "In corso",
"PERMS": "{opName} permessi",
- "PICK_DEST_FIRST": "Seleziona prima un Portale di destinazione!",
- "PICK_TAR_FIRST": "Seleziona prima un portale target!",
- "PICK_TARGETDEST_Portals": "Seleziona prima i Portali target e destinazione!",
"PLEASE_SELECT_PORTAL": "Seleziona un portale",
"PORT_FAKE": " portali. Simulati ",
"PORTAL KEY LIST": "Lista Chiavi per Portale: {portalName}",
@@ -275,9 +246,7 @@
"QD TITLE": "Disegno Rapido Strati",
"QD TOGGLE MODE": "Change mode",
"QDBASE": "Link Base",
- "QDCANCEL": "Annulla disegno Field",
"QDCONT": "Clicca su un portale del filotto per disegnare un field.",
- "QDEND": "Clicca di nuovo sullo stesso portale per terminare il disegno.",
"QDNEXT": "Clicca il secondo Portale Ancora.",
"QDSTART": "Clicca il primo Portale Ancora.",
"READ_SHORT": "RO",
@@ -300,10 +269,8 @@
"SAVELINKS_DRAW": "Salva Link",
"SAVELINKS": "Salva Link",
"SECONDS": " ({seconds} secondi fa)",
- "SEL_PORT_FIRST": "Seleziona un portale prima!",
"SEL_SB_ANCHOR": "Imposta l'ancora.",
"SEL_SB_ANCHOR2": "Zooma indietro. Assicurati che tutti i Portali siano caricati, poi clicca Disegna.",
- "SEL_SB_ANCHOR3": "Sii paziente. Ci vorrà un po'.",
"SEL_SL_ANCHOR": "Seleziona il portale di cui salvare il link. Clicca il pulsante Salva Link e guarda la checklist.",
"SEL_SRC_ANC2": "Seleziona Origine e Ancora 2",
"SEL_SRC_PORT": "Seleziona un Portale di Origine",
@@ -311,7 +278,6 @@
"SELECT_FAN_PORTALS": "Seleziona un'ancora, un Portale di inizio e uno di fine, poi zooma su un'area per il fanfield.",
"SELECT_FAN_PORTALS2": "Aspetta che i Portali siano caricati, poi clicca Disegna.",
"SELECT_INSTRUCTIONS": "Seleziona due ancore, poi zooma sul filotto",
- "SELECT_MADRID_INSTRUCTIONS": "Seleziona tre Portali Ancora, zoomma sull'area vicino all'ancora selezionata, aspetta finchè i portali siano caricati (devono essere sullo schermo per essere considerati) poi seleziona il pulsante 'imposta area filotto' per il link base corrispondente.",
"SELECT_ONION_PORTALS": "Strati creati da dentro a fuori. Zooma sul centro e seleziona il portale di inizio, poi zooma indietro sull'area.",
"SELF SWAP": "Non si può scambiare un portale con se stesso! Seleziona un altro portale.",
"SEND ANALYTICS": "Invia dati di utilizzo anonimi",
@@ -357,16 +323,13 @@
"SWAP": "Scambia",
"SYNC DONE": "Download Completato Fare clic QUI per suggerimenti, suggerimenti e documentazione. ",
"SYNC": "Scarica Operazioni disponibili",
- "TARDEST_DIFF": "I Portali Target e Destinazione devono essere diversi.",
"TARGET SENT": "Target inviato",
- "TEAM PERM DENIED": "Accesso negato al team: {error}",
"TEAM STATE": "Condividi Posizione",
"TEAM_CREATED": "Team {teamName} creato",
"TEAM_NAME": "Nome Team",
"TEAM": "Team",
"TEAMS BUTTON TITLE": "Lista Team Wasabee",
"TEAMS BUTTON": "Team",
- "TITLE": "titolo",
"TO_PORT": "Al Portale",
"TRAWL SKIP TILES": "Trawl Skip Tiles",
"TRAWL TITLE": "Controllo corridoi",
@@ -390,7 +353,6 @@
"UPDATED": "Aggiornato con successo",
"UpgradePortalAlert": "Upgradare",
"UPLOAD BUTTON HOVER": "CARICA {opName} (al momento non sul server)",
- "UPLOAD PERM DENIED": "Accesso negato all'upload",
"UPLOADED": "Caricato con successo",
"USE PANES ON MOBILE": "Use panes (need reload)",
"USE_SWAP_INSTRUCT": ". Usare la funzione Scambio per spostare i Portali finti sui Portali veri nella stessa posizione. Zoomare sui Portali 'in caricamento' nella checklist potrebbe forzarli al caricamento.",
@@ -407,7 +369,6 @@
"WRITE_SHORT": "RW",
"WRITE": "scrittura",
"WSERVER": "Server: {url}",
- "YES": "Sì",
"YESNO_DEL": "Sei sicuro di voler eliminare {opName}?",
"ZONE_DRAW": "Click to set the zone boundaries",
"ZONE": "Area",
From 212ea5db6a5505b96a5fc419b448bfb66bdc2bb8 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:27:48 -0600
Subject: [PATCH 082/275] Remove 39 unused keys
---
src/code/translations/portuguese.json | 39 ---------------------------
1 file changed, 39 deletions(-)
diff --git a/src/code/translations/portuguese.json b/src/code/translations/portuguese.json
index 67b0bcf1b..3168c5d3f 100644
--- a/src/code/translations/portuguese.json
+++ b/src/code/translations/portuguese.json
@@ -1,5 +1,4 @@
{
- "ABOUT WASABEE-IITC": "Sobre Wasabee-IITC",
"ABOUT_WASABEE": "Sobre Wasabee",
"acknowledged": "Reconhecido",
"ADD LINK TITLE": "Adicionar Links Dialogo",
@@ -39,7 +38,6 @@
"ASSIGNED_ONLY_SHORT": "A",
"ASSIGNED_ONLY": "Só Atribuir",
"assigned": "Atribuído",
- "ASSIGNED": "Atribuido",
"AUTH ANDROID": "No Android, tentar primeiro 'rápido'. Se isso falhar, tentar o login principal com 'select_account'..",
"AUTH INCOMPAT": "Você ativou um plugin no TamperMonkey que é incompatível com o Wasabee",
"AUTH IOS": "No iOS, use o 'Login' principal. se isso falhar, faça 'Webview Log in', faça o login; em seguida, use o botão 'Verificar Webview' para concluir o processo.",
@@ -67,7 +65,6 @@
"CLEAR LINKS": "Limpar Links",
"CLEAR MARKERS": "Limpar Markers",
"CLEAR_EVERYTHING": "limpar Portais/Links/Marcadores",
- "CLEAR": "Limpar selecção",
"CLEAROPS BUTTON TITLE": "limpar TODOS os dados Wasabee",
"CLEAROPS BUTTON": "Limpar dados Wasabee",
"CLEAROPS PROMPT": "Isto limpará todas as OPS e dados relacionados a Wasabee. Tudo será restaurado apartir do servidor na próxima sincronização.",
@@ -75,9 +72,7 @@
"COMMENT": "Comentario",
"COMPLETED BY": "Completo por ${value}",
"completed": "Completo",
- "COMPLETED": "Completo",
"CON_DEL": "Confirmar Apagar: ${value}",
- "CONFIRM_DELETE": "Desejas realmente excluir este link: ",
"COUNT": "Contar",
"CREATE_NEW_TEAM": "Criar Nova Equipa",
"CreateLinkAlert": "Link",
@@ -88,19 +83,12 @@
"DELETE ANCHOR TITLE": "Apagar Âncora",
"DELETE MARKER PROMPT": "Desejas apagar esta âncora: ",
"DELETE MARKER TITLE": "Apagar Marcador",
- "DELETE PERM DENIED": "Permissão para excluir negada.",
"DELETE_ANCHOR": "Apagar",
"DELETE_LINK": "Apagar",
- "DELETE_MARKER": "Apagar",
"DELETE_OP": "Apagar ${value}",
- "DELETED": "Excluído com sucesso.",
"DESCRIP_PLACEHOLD": "Descrição (opcional)",
"DestroyPortalAlert": "Destroir",
- "DISABLE_SYNC": "O plugin de sincronização de stoque não é compatível com Wassabe. Desativa a sincronização.",
- "DISABLED": "Este recurso não está pronto para os usuários",
- "DONE": "Feito",
"DRAW TOOLS FORMAT": "Formato Draw Tools",
- "DT_FORMAT": "Formato das Ferramentas de Desenho",
"DUPE_OP": "Duplicar Operação",
"END_PORT": "Portal final ",
"ExcludeMarker": "Excluir de Auto-Desenhar / Marcar",
@@ -108,8 +96,6 @@
"EXPORT OP": "Exportar Op",
"EXPORT": "Exportar: ",
"FAKED": "Falsificado: [${value}]",
- "FAN_FIELD3": "Fan Field",
- "FANFIELD TITLE": "Fanfield",
"FANFIELD": "Desenhar",
"FANFIELD2": "Desenhar Fan Field",
"FarmPortalMarker": "Farmar",
@@ -124,19 +110,16 @@
"FROM_DEPTH": "da profundidade",
"FROM_PORT": "A Partir do Portal",
"GET DT": "Obtenha o desenho existente do DrawTools",
- "GET_DT_DRAW": "Importar Dezenho DrawTools",
"GetKeyPortalMarker": "Retirar Chaves",
"GotoPortalMarker": "Ir para",
"H-GEN_INST": "Define portais para a camada externa. Escolhe o número de divisões. Clica para desenhar",
"HF_DEEP_SEARCH": "Pesquisa exaustiva",
"HF_DRAW_BUTTON": "Desenhar",
- "HF_DRAW_DEEP_BUTTON": "Desenhar com recursão profunda",
"HF_REDRAW_BUTTON": "Redesenhar",
"HG": "Campo Homogêneo",
"HOURS": " (${value} horas atrás)",
"HOW_TO_VIDS": "Vídeos de instruções: ",
"IMP_COMP": "Importação concluída. Encontrada ",
- "IMP_DT_OP": "Importar OP Drawtools: ",
"IMP_NOPE": "A Importação Falhou: {error}",
"IMP_WAS_OP": "Importar Operação Wasabee",
"IMPORT_OP_SUCCESS": "OP Importada: ${value} successfuly.",
@@ -166,10 +149,8 @@
"LOADING": "[a carregar]",
"LOADING1": "a carregar: [${value}]",
"LOC_PROC": "localização processada",
- "LOC_UPDATE": "Atualização de localização",
"LOCATION SUB": "Localização registrada",
"LOCFRMSER": " (localmente e do servidor)",
- "LOG IN QUICK": "Log In (Rápido; para Android)",
"LOG IN": "Log In",
"LOG_OUT": "Log Out",
"MADRID_SET_1": "Selecione a região para a ligação de base Âncora 2 à Âncora 3",
@@ -209,8 +190,6 @@
"MM_SPINE": "Spine",
"MULTI_M_TITLE": "Desenhar camadas máximas",
"MULTI_M": "Desenhar",
- "MULTIMAX": "Multimax!",
- "MULTIMAX2": "Multimax",
"MUST_NOT_BE_EMPTY": "Não deve estar vazio",
"MY_CAP_ID": "Minha Capsula ID",
"MY_COUNT": "Minha Conta",
@@ -222,16 +201,12 @@
"NEW_WAS_SERVER": "Novo servidor Waasbee",
"NEWOP BUTTON TITLE": "Criar uma nova operação",
"NEWOP BUTTON": "Nova Op",
- "NO_DATA": "sem dados",
"NO_DT_ITEMS": "Nenhum item desenhado do DrawTools foi detectado",
"NO_LABEL": "Nenhum rótulo definido",
- "NO_PORT_SEL": "Nenhum portal selecionado.",
"NO_STOCK_INTEL": "Wasabee não suporta importações de desenho de inteligência de stoque",
"NO_TITLE": "Nenhum título definido",
- "NO": "Não",
"NOT LOGGED IN SHORT": "Não logado",
"NOT LOGGED IN": "Não logado: ${value}",
- "NOT_LOADED": "Não totalmente carregado, tente novamente.",
"NOT_SET": "não configurado",
"NTNAME": "Nome",
"OK": "OK",
@@ -257,11 +232,7 @@
"OtherPortalAlert": "Otros",
"PASTE_INSTRUCT": "Cola uma exportação de desenho Wasabee aqui.\n\nWasabee cannot import the stock intel format.\n\nThere is experimental support for importing the IITC DrawTools format.\n\nBefore importing DrawTools format, preview the areas and make sure all the portals load so IITC has them cached. Any portals that are not pre-cached will be faked.\n\nYou will need to use the 'swap' feature to move anchors from the faked portals to the real portals (they should be in the correct location, just not associated with the portal.\n\nCached portals might not be properly named.",
"pending": "Pendente",
- "PENDING": "Pendente",
"PERMS": "${value} permissões",
- "PICK_DEST_FIRST": "Seleciona um portal de destino primeiro!",
- "PICK_TAR_FIRST": "Seleciona um portal de destino primeiro!",
- "PICK_TARGETDEST_Portals": "Seleciona primeiro os portais de destino e destino!",
"PLEASE_SELECT_PORTAL": "Seleciona um portal",
"PORT_FAKE": " portais. Falsificado ",
"PORTAL KEY LIST": "Lista de chaves para portal ${value}",
@@ -275,9 +246,7 @@
"QD TITLE": "Camadas de desenho rápido",
"QD TOGGLE MODE": "Change mode",
"QDBASE": "Link Base",
- "QDCANCEL": "Cancelar campos de desenho",
"QDCONT": "Clica num portal espinha para desenhar um campo.",
- "QDEND": "Clica novamente no mesmo portal para finalizar o desenho.",
"QDNEXT": "Clica no segundo portal de âncora.",
"QDSTART": "Clica no primeiro portal de âncora.",
"READ_SHORT": "Ler Abreviado",
@@ -300,10 +269,8 @@
"SAVELINKS_DRAW": "Save Links",
"SAVELINKS": "Save Links",
"SECONDS": " (${value} segundos atrás)",
- "SEL_PORT_FIRST": "Selecione primeiro os portais âncora!",
"SEL_SB_ANCHOR": "Seleciona a âncora.",
"SEL_SB_ANCHOR2": "Reduzir o zoom. Verifica se todos os portais foram carregados e clica em desenhar.",
- "SEL_SB_ANCHOR3": "Por favor, sê paciente, pode demorar um pouco.",
"SEL_SL_ANCHOR": "Select the portal to save the links of. Click save links button and look at checklist.",
"SEL_SRC_ANC2": "Selecionar a fonte e a âncora 2",
"SEL_SRC_PORT": "Selecionar um portal de origem",
@@ -311,7 +278,6 @@
"SELECT_FAN_PORTALS": "Selecionar um portal de âncora, um portal inicial e um portal final e, em seguida, posiciona a visualização sobre a área do campo.",
"SELECT_FAN_PORTALS2": "Wait for all portals to load, then click draw.",
"SELECT_INSTRUCTIONS": "Select two anchor portals, then zoom over the spine area.",
- "SELECT_MADRID_INSTRUCTIONS": "Selecionar três portais de âncora, amplia a área próxima à âncora selecionada, espera até que os portais sejam carregados (os portais devem aparecer na tela para serem considerados) e selecioner o botão 'definir região da coluna' para os links de base correspondentes.",
"SELECT_ONION_PORTALS": "As camadas são construídas de dentro para fora. Aumenta o zoom para o centro e seleciona o portal inicial, em seguida, diminui o zoom para a área.",
"SELF SWAP": "Não é possível trocar um portal contigo mesmo! Seleciona um portal diferente.",
"SEND ANALYTICS": "Enviar análises anônimas",
@@ -357,16 +323,13 @@
"SWAP": "Troca",
"SYNC DONE": "Download Completo",
"SYNC": "Download operações disponíveis",
- "TARDEST_DIFF": "Os portais de destino e destino devem ser diferentes.",
"TARGET SENT": "Alvo Enviado",
- "TEAM PERM DENIED": "Permissão negada à equipa: ${value}",
"TEAM STATE": "Partilhar localização",
"TEAM_CREATED": "Equipa ${value} created",
"TEAM_NAME": "Nome Equipa",
"TEAM": "Equipa",
"TEAMS BUTTON TITLE": "Listar equipas Wasabee",
"TEAMS BUTTON": "Equipas",
- "TITLE": "titulo",
"TO_PORT": "Para o Portal",
"TRAWL SKIP TILES": "Trawl Skip Tiles",
"TRAWL TITLE": "Trawl Lanes",
@@ -383,7 +346,6 @@
"UNKNOWN": "Desconhecido",
"UPDATE HOVER NOT CHANGED": "${value} não mudou localmente",
"UPDATE HOVER": "UPDATE ${value} no servidor",
- "UPDATE PERM DENIED": "You do not have permission to update",
"UPDATE_CONFLICT_DESC": "A OP foi modificada no servidor desde a última sincronização. Queres substituir a versão do servidor pela atual?",
"UPDATE_CONFLICT_TITLE": "Conflito detectado com o servidor",
"UPDATE_COUNT": "Contagem de atualização",
@@ -407,7 +369,6 @@
"WRITE_SHORT": "RW",
"WRITE": "escrita",
"WSERVER": "Servidor: ${value}",
- "YES": "Sim",
"YESNO_DEL": "Tem certeza de que deseja excluir ${value}?",
"ZONE_DRAW": "Click to set the zone boundaries",
"ZONE": "Zone",
From a3c568f443472970354a0f7258285588ddc2fe75 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:28:32 -0600
Subject: [PATCH 083/275] Add russian language file
---
src/code/translations/russian.json | 391 +++++++++++++++++++++++++++++
1 file changed, 391 insertions(+)
create mode 100644 src/code/translations/russian.json
diff --git a/src/code/translations/russian.json b/src/code/translations/russian.json
new file mode 100644
index 000000000..08d4f9cd0
--- /dev/null
+++ b/src/code/translations/russian.json
@@ -0,0 +1,391 @@
+{
+ "ABOUT_WASABEE": "О Wasabee",
+ "acknowledged": "цель получена",
+ "ADD LINK TITLE": "Добавление линков",
+ "ADD MARKER TITLE": "Добавление маркеров",
+ "ADD_AGENT": "Добавить агента: ",
+ "ADD_BL": "Добавить перемычки: ",
+ "ADD_BUTTON_LINKS": "Добавить все линки сразу.",
+ "ADD_LINKS": "Добавить линки",
+ "ADD_MARKER": "+ маркер",
+ "ADD_NEW_OP": "Добавить новую ОПРЦ",
+ "ADD_SUCC_INSTR": "Агент добавлен",
+ "ADD_ZONE": "Добавить зону",
+ "ADD": "Добавить",
+ "ADD1": "Добавить первый линк",
+ "ADD2": "Добавить второй линк",
+ "AGENT_STATS": "Данные агента",
+ "AGENT": "Агент",
+ "AGES": " (давно)",
+ "ALREADY_HAS_MARKER": "У этого портала уже есть маркер. Выбери другой портал.",
+ "AMAZ_TEAM_NAME": "Отличное название.",
+ "ANCHOR ASSIGNMENT": " все исходящие линки",
+ "ANCHOR_GMAP": "Google Map",
+ "ANCHOR_PORTAL": "Опорный портал ",
+ "ANCHOR_PORTAL2": "Опорный портал 2",
+ "ANCHOR_PORTAL3": "Опорный портал 3",
+ "ANCHOR1": "Опорник 1 ",
+ "ANCHOR2": "Опорник 2 ",
+ "ANCHOR3": "Опорник 3 ",
+ "ANCHORS_AS_BOOKMARKS": "Опорники в закладки",
+ "API_KEY": " ключ api: ",
+ "ASS_TO": "Назначено агенту",
+ "ASSIGN LINK PROMPT": "Назначить линк с портала: {portalName}",
+ "ASSIGN MARKER PROMPT": "Назначить маркер с {portalName}",
+ "ASSIGN OUTBOUND PROMPT": "Назначить все исходящие линки с {portalName}",
+ "ASSIGN OUTBOUND": "Назначить исходящие линки",
+ "ASSIGN": "Назначить",
+ "ASSIGNED_ONLY_SHORT": "AO",
+ "ASSIGNED_ONLY": "Только назначенные",
+ "assigned": "Назначено",
+ "AUTH ANDROID": "На Android, попробуй сначала 'быстрый логин'. Если не получится, попробуй обычный логин через 'выбери аккаунт'.",
+ "AUTH INCOMPAT": "Ты активировал в TamperMonkey плагин, который несовместим с Wasabee",
+ "AUTH IOS": "На iOS, используй основную опцию 'Логин'. Если не получится, используй 'Логин Webview', а затем кнопку 'Подтвердить Webview' для завершения процесса.",
+ "AUTH REQUIRED": "Необходима аутентификация",
+ "AUTH TOKEN REJECTED": "Отправка аутентификационного токена на сервер отклонена: {error}",
+ "AUTH_SELECT_ACCOUNT": "Выбери аккаунт",
+ "AUTO_DRAWS": "Авто-рисовка",
+ "AUTODRAWS": "Опции авто-рисовки Wasabee",
+ "AUTOLOAD_RATE": "Скорость запроса данных портала (ms)",
+ "AUTOLOAD": "Автоматически загружать недостающие данные портала",
+ "AUTOMARK STOP": "Авто-маркировка остановлена, т.к. порталы не были загружены",
+ "AUTOMARK": "Авто-маркировка",
+ "BAT_TOAD": "Боевые жабы",
+ "BLOCKER LIST TITLE": "Показать все кроссы",
+ "BLOCKER TITLE": "кроссы",
+ "CANCEL": "Отменить",
+ "CAPSULE": "Капсула",
+ "CapturePortalMarker": "Захватить",
+ "CHANGE SERVER PROMPT": "Новый сервер Wasabee",
+ "CHANGE SERVER": "Сменить сервер",
+ "CHANGE_WAS_SERVER": "Сменить сервер Wasabee",
+ "CHECKLIST BUTTON TITLE": "Чек-лист операции",
+ "CHECKLIST BUTTON": "Чек-лист",
+ "CLEAR LINKS": "Удалить линки",
+ "CLEAR MARKERS": "Удалить маркеры",
+ "CLEAR_EVERYTHING": "Удалить порталы/линки/маркеры для текущей ОПРЦ",
+ "CLEAROPS BUTTON TITLE": "Удалить данные",
+ "CLEAROPS BUTTON": "Удалить данные",
+ "CLEAROPS PROMPT": "Удалить все локальные ОПРЦ. ОПРЦ будут восстановлены при следующей загрузке.",
+ "CLOSE": "Закрыть",
+ "COMMENT": "Комментарий",
+ "COMPLETED BY": "Выполнено агентом {agentName}",
+ "completed": "Выполнено",
+ "CON_DEL": "Подтверди удаление: {opName}",
+ "COUNT": "Количество",
+ "CREATE_NEW_TEAM": "Создать новую команду",
+ "CreateLinkAlert": "Линк",
+ "CUR_USER_INFO": "Информация о пользователе",
+ "D_SHOW_LIST": "Ввести ключи на руках",
+ "DEFAULT OP NAME": "Новая ОПРЦ: {date}",
+ "DELETE ANCHOR PROMPT": "Хочешь удалить этот портал и все связанные линки: ",
+ "DELETE ANCHOR TITLE": "Удалить портал",
+ "DELETE MARKER PROMPT": "Хочешь удалить этот маркер: ",
+ "DELETE MARKER TITLE": "Удалить маркер",
+ "DELETE_ANCHOR": "Удалить",
+ "DELETE_LINK": "Удалить",
+ "DELETE_OP": "Удалить {opName}",
+ "DESCRIP_PLACEHOLD": "Описание (опционально)",
+ "DestroyPortalAlert": "Снести",
+ "DRAW TOOLS FORMAT": "Формат ДТ",
+ "DUPE_OP": "Дублировать операцию",
+ "END_PORT": "Конечный портал ",
+ "ExcludeMarker": "Исключить из авто-рисовки/маркировки",
+ "EXPORT OP TITLE": "Экспортировать текущую ОПРЦ",
+ "EXPORT OP": "Экспортировать ОПРЦ",
+ "EXPORT": "Экспортировать: ",
+ "FAKED": "Неподгружен: [{portalId}]",
+ "FANFIELD": "Нарисовать",
+ "FANFIELD2": "Нарисовать Fan Field",
+ "FarmPortalMarker": "Отфармить",
+ "FROM_1-2": "от опорного линка 1-2",
+ "FROM_1-3": "от опорного линка 1-3",
+ "FROM_2-3": "от опорного линка 2-3",
+ "FROM_DEPTH": "из глубины",
+ "FROM_PORT": "С портала",
+ "GET DT": "Получить существующее ДТ",
+ "GetKeyPortalMarker": "Получить ключи",
+ "GotoPortalMarker": "Перейти к",
+ "H-GEN_INST": "Выбери порталы для внешнего слоя. Выбери порядок гомогенности. Нажми 'рисовать'.",
+ "HF_DEEP_SEARCH": "Инсчерпывающий поиск",
+ "HF_DRAW_BUTTON": "Рисовать",
+ "HF_REDRAW_BUTTON": "Перерисовать",
+ "HG": "Гомогенное поле",
+ "HOURS": " ({hours} часов назад)",
+ "HOW_TO_VIDS": "Обучающие видео: ",
+ "IMP_COMP": "Импорт завершён. Найдено ",
+ "IMP_NOPE": "Ошибка импорта.",
+ "IMP_WAS_OP": "Импортировать ОПРЦ Wasabee",
+ "IMPORT_OP_SUCCESS": "ОПРЦ: {opName} импортирована успешно.",
+ "IMPORT_OP_TITLE": "Импортировать ОПРЦ: {date}",
+ "IMPORT_OP": "Импортировать операцию",
+ "IMPOSSIBLE": "Невозможно",
+ "INGNAME_GID": "Ник Ingress или GoogleID",
+ "INPUT_DT_KEY_COUNT": "Введи количество ключей на руках",
+ "INPUT_SQUAD_NAME": "Введи имя отряда",
+ "INVALID REQUEST": "Неверный запрос",
+ "IOS NEED FAKE UA": "Нужно установить 'Custom UserAgent for Webviews' в настройках IITC-Mobile, чтобы вход удался",
+ "KEY_LIST2": "Список ключей для операции: {opName}",
+ "KEYS": "Ключи",
+ "KNOWN_BLOCK": "Известные кроссы: {opName}",
+ "LA DESC": "В зависимости от количества и типа использованных ламп для линковки может быть достаточно более низкого уровня портала.",
+ "LA": "П8 с несколькими LA",
+ "LANG": "Язык",
+ "LEAVE": "Выйти",
+ "LetDecayPortalAlert": "Просадить",
+ "LINK ASSIGNMENT": " Назначение линка",
+ "LINK STATE PROMPT": "Статус линка",
+ "LINK STATE": "Установить статус линка",
+ "LINKS BUTTON TITLE": "Линки",
+ "LINKS": "Линки",
+ "LINKS2": "{portalName} : Линки ({outgoing}↑/{incoming}↓)",
+ "LOAD PORTALS": "Загрузить порталы",
+ "LOADING": "[загрузка]",
+ "LOADING1": "Загрузка: [{portalGuid}]",
+ "LOC_PROC": "Местоположение обработано",
+ "LOCATION SUB": "Местоположение зарегистрировано",
+ "LOCFRMSER": " (локально и с сервера)",
+ "LOG IN": "Логин",
+ "LOG_OUT": "Выход",
+ "MADRID_SET_1": "Выбери область для опорного линка сопорника 2 на опорник 3",
+ "MADRID_SET_2": "Выбери область для опорного линка сопорника 3 на опорник 1",
+ "MADRID_SET_3": "Выбери область для опорного линка сопорника 1 на опорник 2",
+ "MADRID_TITLE": "Мадридский протокол",
+ "MADRID_WAS_TAKEN": "Мадридский протокол",
+ "MADRID": "Нарисовать",
+ "MANAGE_TEAM": "Редактировать {teamName}",
+ "MANAGE": "Редактировать",
+ "MARKER ASSIGNMENT": " Назначение маркера",
+ "MARKER LIST TITLE": "Список маркеров",
+ "MARKER LIST": "Маркеры",
+ "MARKER STATE PROMPT": "Статус маркера",
+ "MARKER STATE": " Установить статус маркера",
+ "MARKER_LIST": "Список маркеров: {opName}",
+ "MARKERS BUTTON TITLE": "Маркеры",
+ "MAX_SPLITS": "Максимальный уровень",
+ "MAX": "Fan Field",
+ "MeetAgentPortalMarker": "Встретить агента",
+ "MERGE ON UPDATE": "Объединить при обновлении",
+ "MERGE_CHANGES_LOCAL": "Изменения на устройстве",
+ "MERGE_CHANGES_MERGE": "Объединить результат",
+ "MERGE_CHANGES_REMOTE": "Изменения на сервере",
+ "MERGE_LOCAL": "Сохранить версию с устройства",
+ "MERGE_MESSAGE": "Похоже, что в ОПРЦ{opName} внесены изменения на устройстве. Хочешь объединить изменения с ОПРЦ на сервере, использовать версию с сервера или сохранить версию с устройства?",
+ "MERGE_REBASE": "Объединить",
+ "MERGE_REPLACE": "Использовать версию с сервера",
+ "MERGE_TITLE": "Объединение версий ОПРЦ на устройстве и на сервере",
+ "MIN_SRC_PORT_LVL": "Минимальный требуемый уровень портала для линковки",
+ "MINUTES": " ({minutes} минут назад)",
+ "MM": "Multimax",
+ "MULTI_M_TITLE": "Нарисовать максимальное количество слоёв",
+ "MULTI_M": "Нарисовать",
+ "MUST_NOT_BE_EMPTY": "Не должно быть пустым",
+ "MY_CAP_ID": "ID моей капсулы",
+ "MY_COUNT": "Моё количество",
+ "NAME_REQ": "Требуется имя",
+ "NAME": "Название: ",
+ "NEW_OP": "Новая операция",
+ "NEW_TEAM_NAME": "Новое имя команды",
+ "NEW_TEAM": "Новая команда",
+ "NEW_WAS_SERVER": "Новый сервер Wasabee",
+ "NEWOP BUTTON TITLE": "Создать новую операцию",
+ "NEWOP BUTTON": "Новая ОПРЦ",
+ "NO_DT_ITEMS": "Не обнаружено элементов ДТ",
+ "NO_LABEL": "Метка не установлена",
+ "NO_STOCK_INTEL": "Wasabee не поддерживает импорт из Intel",
+ "NO_TITLE": "Название не установлено",
+ "NOT LOGGED IN SHORT": "Не залогинен",
+ "NOT LOGGED IN": "Не залогинен: {error}",
+ "NOT_SET": "не установлено",
+ "NTNAME": "Название",
+ "OK": "OK",
+ "ON_HAND": "На руках",
+ "ONION_WAS_TAKEN": "Onion",
+ "ONION": "Нарисовать",
+ "ONLY_DT_IMP": " (только для импорта ДТ)",
+ "OP DELETED": "Операция удалена с сервера: {opID}",
+ "OP PERM DENIED": "Отказано в доступе к операции: {opID}",
+ "OP_BUTTON": "Операция",
+ "OP_CHECKLIST": "Чек-лист операции: {opName}",
+ "OP_NAME_UNSET": "Название операции не задано",
+ "OP_PERMS": "Разрешения ОПРЦ",
+ "OP_SETTINGS_BUTTON": "ОПРЦ ⚙",
+ "OP_SETTINGS_TITLE": "Настройки операции",
+ "OPEN_REQUEST": "[открытый запрос]",
+ "OPER_COLOR": "Цвет операции: ",
+ "OPER_NAME": "Название операции: ",
+ "OPERATIONS": "Операции",
+ "OPS BUTTON TITLE": "Список операций",
+ "OPS BUTTON": "Выбери ОПРЦ",
+ "ORDER": "Порядок",
+ "OtherPortalAlert": "Другое",
+ "PASTE_INSTRUCT": "Вставь экспортируемые данные Wasabee здесь.\n\nWasabee не может импортировать данные в формате интела.\n\nЕсть эксперементальная поддержка ДТ формата IITC.\n\nПрежде чем импортировать ДТ в формате IITC, просмотрите область ДТ и убедитесь, что все порталы загружены и кэшированы в IITC. Любой неподгруженный портал будет неподгружен.\n\nНужно будет использовать функцию 'замена', чтобы переместить порталы со неподгруженных на настоящие (местоположение порталов будет корректным, однако неподгруженные порталы не будут связаны с реальными).\n\nКэшированные порталы могут некорректно называться.",
+ "pending": "Ожидается",
+ "PERMS": "Разрешения {opName}",
+ "PLEASE_SELECT_PORTAL": "Выбери портал",
+ "PORT_FAKE": " порталов. Неподгружены ",
+ "PORTAL KEY LIST": "Список ключей для портала {portalName}",
+ "PORTAL_COUNT": "{count} порталов",
+ "PORTAL": "Портал",
+ "QD BUTTON CHANGE COLOR": "Кликни, чтобы изменить цвет следующего линка",
+ "QD BUTTON END": "Кликни, чтобы остановить прорисовку полей",
+ "QD BUTTON TOGGLE MODE": "Кликни, чтобы поменять режим рисовки",
+ "QD CHANGE COLOR": "Изменить цвет",
+ "QD END": "Стоп",
+ "QD TITLE": "Слои быстрой рисовки",
+ "QD TOGGLE MODE": "Изменить режим",
+ "QDBASE": "Опорный линк",
+ "QDCONT": "Кликни портал в грядке, чтобы нарисовать поле.",
+ "QDNEXT": "Кликни на второй опорный портал.",
+ "QDSTART": "Кликни на первый опорный портал.",
+ "READ_SHORT": "RO",
+ "READ": "только чтение",
+ "RechargePortalAlert": "Зарядить",
+ "REFERENCE_TIME": "Reference time: ",
+ "REM_LOC_CP": "Удалить локальную копию {opName}",
+ "REMOVE_TEAM_CONFIRM_LABEL": "Хочешь навсегда удалить {teamName} с сервера Wasabee?",
+ "REMOVE_TEAM_CONFIRM_TITLE": "Удаление команды {teamName}",
+ "REMOVE_TEAM": "Удалить команду: ",
+ "REMOVE": "Удалить",
+ "RENAME_TEAM": "Переименовать команду: ",
+ "RENAME": "Переименовать",
+ "REQUIRED": "Требуется",
+ "RESET": "Сброс",
+ "REVERSE": "Обратить",
+ "ROCKS_COM": "Сообщество enl.rocks: ",
+ "ROLE": "Роль",
+ "SAVELINKS TITLE": "Сохранить линки",
+ "SAVELINKS_DRAW": "Сохранить линки",
+ "SAVELINKS": "Сохранить линки",
+ "SECONDS": " ({seconds} секунд назад)",
+ "SEL_SB_ANCHOR": "Выбери опорник.",
+ "SEL_SB_ANCHOR2": "Уменьши масштаб. Убедись, что порталы полностью загрузились, затем кликни рисовку.",
+ "SEL_SL_ANCHOR": "Выбери портал, линки которого нужно сохранить. Кликни на кнопку сохранения линков и посмотри в чек-лист.",
+ "SEL_SRC_ANC2": "Выбери оба портала: начальный и опорник 2",
+ "SEL_SRC_PORT": "Выбери начальный портал",
+ "SELECT PORTAL": "Сначала выбери портал",
+ "SELECT_FAN_PORTALS": "Выбери опорный портал, стартовый портал и конечный портал, а затем позиционируйте карту над областью полей.",
+ "SELECT_FAN_PORTALS2": "Подожди, пока все порталы загрузятся, затем кликни рисовку.",
+ "SELECT_INSTRUCTIONS": "Выбери два опорных портала, затем увеличь область грядки.",
+ "SELECT_ONION_PORTALS": "Слои строятся изнутри наружу. Приблизь масштаб в центр и выбери начальный портал, затем отдали масштаб на всю область.",
+ "SELF SWAP": "Нельзя заменить портал на тот же самый! Выбери другой портал.",
+ "SEND ANALYTICS": "Отправить аналитику анонимно",
+ "SEND LOCATION": "Отправить местоположение",
+ "SEND TARGET AGENT": "Выбрать получателя цели",
+ "SEND TARGET CONFIRM": "Хочешь отправить цель {portalName} агенту {agent}?",
+ "SEND TARGET": "Отправить цель",
+ "SEND_LOC": "Отправить местоположение",
+ "SET_3_PORT": "Сначала задай три портала!",
+ "SET_COMMENT": "Задать комментарий",
+ "SET_LCOMMENT": "Задать комментарий к линку",
+ "SET_LINK_COMMENT": "Задать комментарий для линка: ",
+ "SET_LINKS_ZONES": "Задать линкам зоны ",
+ "SET_MARKER_COMMENT": "Задать комментарий для маркера на: ",
+ "SET_MARKER_TYPE_TITLE": "Изменить тип маркера",
+ "SET_MARKERS_ZONES": "Задать маркеры в зоны",
+ "SET_MCOMMENT": "Задать комментария маркеру: {portalName}",
+ "SET_NEW_OP": "Задай имя для новой операции",
+ "SET_PCOMMENT": "Задать комментарий порталу: {portalName}",
+ "SET_PORT_COMMENT": "Задать комментарий порталу: ",
+ "SET_PORTAL_COMMENT": "Задать комментарий порталу",
+ "SET": "задать",
+ "SETTINGS": "Настройки Wasabee",
+ "SKINS_AVAILABLE": "Есть {count} доступных скинов.",
+ "SKINS_BUTTON": "Настроить скины",
+ "SKINS_DESCRIPTION": "Пакеты доступных скинов размещены в правой колонке. Перемести в левую колонку те, которые хочешь использовать.",
+ "SKINS_MANAGE_TITLE": "Управление скинами",
+ "SKIP_CONFIRM_ALWAYS": "Никогда не спрашивать (используй осторожно)",
+ "SKIP_CONFIRM_ENTITY": "Спрашивать только для команд/ОПРЦ",
+ "SKIP_CONFIRM_NEVER": "Всегда спрашивать",
+ "SKIP_CONFIRM": "Подтверждение пропуска",
+ "SOURCE_PORT": "Начальный портал ",
+ "SQUAD": "Отряд",
+ "STARBURST TITLE": "Звезда",
+ "STARBURST_DRAW": "Рисовка",
+ "STARBURST": "Звезда",
+ "START_PORT": "Стартовый портал ",
+ "STATE": "Статус",
+ "SUPPORT_INSTRUCT": "Для поддержки, присоединяйся к The Wasabee User Telegram Channel ",
+ "SWAP PROMPT": "Хочешь заменить: ",
+ "SWAP TITLE": "Замена порталов",
+ "SWAP WITH": " на ",
+ "SWAP": "Замена",
+ "SYNC DONE": "Загрузка завершена Кликни ЗДЕСЬ для подсказок, советов и документации. ",
+ "SYNC": "Загрузить доступные операции",
+ "TARGET SENT": "Цель отправлена",
+ "TEAM STATE": "Делиться местоположением",
+ "TEAM_CREATED": "Команда {teamName} создана",
+ "TEAM_NAME": "Название команды",
+ "TEAM": "Команда",
+ "TEAMS BUTTON TITLE": "Список команд Wasabee",
+ "TEAMS BUTTON": "Команды",
+ "TO_PORT": "На портал",
+ "TRAWL SKIP TILES": "Шаг тайлов для выверки",
+ "TRAWL TITLE": "Выверка трасс",
+ "TRAWL WARNING": "Этот метод загрузит данные тайлов под всеми нарисованными линками. Это медленный процесс.",
+ "TRAWL_AUTOMARK": "Автоматически маркировать кроссы после выверки",
+ "TRAWL_BULK_LOAD_WARNING": "Этот метод загрузит данные тайлов так быстро, как это возможно. Используй его на свой страх и риск.",
+ "TRAWL_BULK_LOAD": "Массово загрузить данные тайлов",
+ "TRAWL_CLEAR_MARKERS": "Очистить маркеры вирусов и сноса перед выверкой",
+ "TRAWL_REMAINING": "{count} тайлов осталось",
+ "TRAWL": "Выверка для поиска кроссов",
+ "TRAWLING": "Выверка трасс для поиска кроссов, закрой этот диалог, чтобы остановить процесс",
+ "TYPE": "Тип",
+ "UNASSIGNED": "Не назначен",
+ "UNKNOWN": "Неизвестен",
+ "UPDATE HOVER NOT CHANGED": "{opName} не изменилась локально",
+ "UPDATE HOVER": "ОБНОВИТЬ {opName} на сервере",
+ "UPDATE PERM DENIED": "У тебя недостаточно прав для обновления",
+ "UPDATE_CONFLICT_DESC": "ОПРЦ изменилась на сервере с момента последней синхронизации. Хочешь заменить версию на сервере текущей?",
+ "UPDATE_CONFLICT_TITLE": "Обнаружен конфликт с сервером",
+ "UPDATE_COUNT": "Количество обновлений",
+ "UPDATED": "Успешно обновлено",
+ "UpgradePortalAlert": "Апнуть",
+ "UPLOAD BUTTON HOVER": "ЗАГРУЗИТЬ {opName} на сервер (пока что её там нет)",
+ "UPLOADED": "Успешно загружено на сервер",
+ "USE PANES ON MOBILE": "Использовать панели (нужна перезагрузка)",
+ "USE_SWAP_INSTRUCT": ". Используй функцию замены, чтобы заменить неподгруженные порталы на настоящие на тех же местах. Увеличение масштаба на порталах чек-листа с меткой 'загрузка' может заставить их загрузиться.",
+ "USE_VALID_NAME": "Используй действительное название операции",
+ "UseVirusPortalAlert": "Использовать вирус",
+ "VRLA DESC": "В зависимости от количества и типа использованных ламп может быть достаточно более низкого уровня портала для линковки.",
+ "VRLA": "П8 с несколькими VRLA",
+ "WASABEE BUTTON TITLE": "Wasabee: зелёный и заставляет смурфов плакать.",
+ "WASABEE_D_LIST": "Ввод количества ключей на руках",
+ "WD BUTTON TITLE": "Список ключей на руках",
+ "WD BUTTON": "Ключи на руках",
+ "WEBVIEW VERIFY": "Подтвердить Webview",
+ "WEBVIEW": "Логин Webview (iOS)",
+ "WRITE_SHORT": "RW",
+ "WRITE": "чтение и запись",
+ "WSERVER": "Сервер: {url}",
+ "YESNO_DEL": "Уверен, что хочешь удалить {opName}?",
+ "ZONE_DRAW": "Кликни, чтобы задать границы зоны",
+ "ZONE": "Зона",
+ "smallScreen": {
+ "ADD_LINKS": "+ Линки",
+ "ADD_MARKER": "+ Маркер",
+ "BLOCKER TITLE": "кроссы",
+ "CHECKLIST BUTTON": "Чек-лист",
+ "CLEAROPS BUTTON": "Очистить",
+ "EXPORT OP": "Экспортировать",
+ "FAN_FIELD3": "Fan",
+ "FANFIELD": "Рисовка",
+ "FANFIELD2": "Нарисовать Fan Field",
+ "KEYS": "Ключи",
+ "LOG IN": "Логин",
+ "LOG_OUT": "Выход",
+ "MARKER LIST": "Маркеры",
+ "MARKERS BUTTON TITLE": "Маркеры",
+ "MAX": "Fan",
+ "MM": "Multi",
+ "MULTI_M_TITLE": "Рисовать максимальное количество слоёв",
+ "MULTI_M": "Рисовать",
+ "NEWOP BUTTON": "Новая ОПРЦ",
+ "OPS BUTTON": "Выбрать ОПРЦ",
+ "QD END": "Конец",
+ "STARBURST_DRAW": "Рисовать",
+ "STARBURST": "Звезда",
+ "TEAMS BUTTON": "Команды",
+ "WD BUTTON": "Ключи на руках"
+ }
+}
From 804b9e7e149d3da0eaf7ff5b4034cc9c7f589211 Mon Sep 17 00:00:00 2001
From: TheMitch2 <62919690+TheMitch2@users.noreply.github.com>
Date: Wed, 1 Dec 2021 20:29:00 -0600
Subject: [PATCH 084/275] Remove 39 unused keys
---
src/code/translations/spanish.json | 39 ------------------------------
1 file changed, 39 deletions(-)
diff --git a/src/code/translations/spanish.json b/src/code/translations/spanish.json
index c204d713a..0c80f0a60 100644
--- a/src/code/translations/spanish.json
+++ b/src/code/translations/spanish.json
@@ -1,5 +1,4 @@
{
- "ABOUT WASABEE-IITC": "Sobre Wasabee-IITC",
"ABOUT_WASABEE": "Sobre Wasabee",
"acknowledged": "Acknowledged",
"ADD LINK TITLE": "Texto de Agregar Links",
@@ -39,7 +38,6 @@
"ASSIGNED_ONLY_SHORT": "AO",
"ASSIGNED_ONLY": "Assigned Only",
"assigned": "Asignado",
- "ASSIGNED": "Asignado",
"AUTH ANDROID": "On En Android, prueba 'rápido' primero. Si eso falla, intenta el inicio de sesión principal con 'select_account'.",
"AUTH INCOMPAT": "Has activado un plugin en TamperMonkey que es incompatible con Wasabee",
"AUTH IOS": "En iOS, usa el 'Iniciar Sesión' principal. Si eso falla intenta usar 'Inicio de Sesión Vista Web'; luego usa el botón 'Verificar Vista Web' para completar el proceso.",
@@ -67,7 +65,6 @@
"CLEAR LINKS": "Clear Links",
"CLEAR MARKERS": "Clear Markers",
"CLEAR_EVERYTHING": "Borrar Portales/Links/Marcadores",
- "CLEAR": "Borrar selección",
"CLEAROPS BUTTON TITLE": "Borrar TODOS los Datos de Wasabee",
"CLEAROPS BUTTON": "Borrar Datos de Wasabee",
"CLEAROPS PROMPT": "Esta opción borrará todas las OPS y datos relacionados a Wasabee. Todo será restaurado desde el servidor en la próxima sincronización.",
@@ -75,9 +72,7 @@
"COMMENT": "Comentario",
"COMPLETED BY": "Completado por {agentName}",
"completed": "Completo",
- "COMPLETED": "Completo",
"CON_DEL": "Confirmar Borrado {opName}",
- "CONFIRM_DELETE": "Estás seguro de querer borrar este link",
"COUNT": "Contar",
"CREATE_NEW_TEAM": "Crear Nuevo Equipo",
"CreateLinkAlert": "Linkear",
@@ -88,19 +83,12 @@
"DELETE ANCHOR TITLE": "Borrar Ancla",
"DELETE MARKER PROMPT": "Quisieras borrar este marcador",
"DELETE MARKER TITLE": "Borrar Marcador",
- "DELETE PERM DENIED": "Permiso para borrar denegado",
"DELETE_ANCHOR": "Borrar",
"DELETE_LINK": "Borrar",
- "DELETE_MARKER": "Borrar",
"DELETE_OP": "Borrar {opName}",
- "DELETED": "Borrado exitosamente",
"DESCRIP_PLACEHOLD": "Descripción (opcional)",
"DestroyPortalAlert": "Destruir",
- "DISABLE_SYNC": "El plugin estándar de Sincronización no es compatible con Wassabe. Por favor, deshabilitar Sync.",
- "DISABLED": "Esta opción no está lista para los usuarios",
- "DONE": "Hecho",
"DRAW TOOLS FORMAT": "Draw Tools Format",
- "DT_FORMAT": "Formato Draw Tools",
"DUPE_OP": "Duplicar Operación",
"END_PORT": "Portal de Fin",
"ExcludeMarker": "Excluir del Dibujo/Marcado Automático",
@@ -108,8 +96,6 @@
"EXPORT OP": "Exportar Op",
"EXPORT": "Exportar",
"FAKED": "Faked: [{portalId}]",
- "FAN_FIELD3": "Fan Field",
- "FANFIELD TITLE": "Fanfield",
"FANFIELD": "¡Dibujar!",
"FANFIELD2": "Fanfield",
"FarmPortalMarker": "Farmear",
@@ -124,19 +110,16 @@
"FROM_DEPTH": "from the depth",
"FROM_PORT": "Desde el Portal",
"GET DT": "Get existing DrawTools draw",
- "GET_DT_DRAW": "Obtener dibujo existente de DrawTools",
"GetKeyPortalMarker": "Obtener Keys",
"GotoPortalMarker": "Ir A",
"H-GEN_INST": "Set portals for the outside layer. Choose number of splits. Click draw",
"HF_DEEP_SEARCH": "Exhaustive search",
"HF_DRAW_BUTTON": "Draw",
- "HF_DRAW_DEEP_BUTTON": "Draw with deep recursion",
"HF_REDRAW_BUTTON": "Redraw",
"HG": "Homogeneous Field",
"HOURS": "(Hace {hours} horas)",
"HOW_TO_VIDS": "Videos de Cómo Se Hace: ",
"IMP_COMP": "Importación Completa. Se encontró",
- "IMP_DT_OP": "Op en Drawtools Importada",
"IMP_NOPE": "Importación Falló: {error}",
"IMP_WAS_OP": "Importar Operación Wasabee",
"IMPORT_OP_SUCCESS": "Operación {opName} Importada Exitosamente.",
@@ -166,10 +149,8 @@
"LOADING": "[cargando]",
"LOADING1": "Cargando: [{portalGuid}]",
"LOC_PROC": "ubicación procesada",
- "LOC_UPDATE": "Actualización de Ubicación",
"LOCATION SUB": "Ubicación registrada",
"LOCFRMSER": "(localmente y del servidor)",
- "LOG IN QUICK": "Iniciar Sesión (rápido; para Android)",
"LOG IN": "Iniciar Sesión",
"LOG_OUT": "Cerrar sesión",
"MADRID_SET_1": "Select the region for baselink Anchor 2 to Anchor 3",
@@ -209,8 +190,6 @@
"MM_SPINE": "Spine",
"MULTI_M_TITLE": "Draw Max Layers",
"MULTI_M": "Multimax",
- "MULTIMAX": "¡Multimax!",
- "MULTIMAX2": "Multimax",
"MUST_NOT_BE_EMPTY": "No Debe Quedar Vacío",
"MY_CAP_ID": "ID de Mi Cápsula",
"MY_COUNT": "Mi Conteo",
@@ -222,16 +201,12 @@
"NEW_WAS_SERVER": "Nuevo Servidor de Wasabee",
"NEWOP BUTTON TITLE": "Crear una nueva Operación",
"NEWOP BUTTON": "Nueva Op",
- "NO_DATA": "Sin data",
"NO_DT_ITEMS": "No se detectó elementos dibujados con DrawTools",
"NO_LABEL": "Sin etiqueta definida",
- "NO_PORT_SEL": "Ningún Portal Portal Seleccionado.",
"NO_STOCK_INTEL": "Wasabee no soporta la importación de dibujos trazados en intel regular",
"NO_TITLE": "Sin título definido",
- "NO": "No",
"NOT LOGGED IN SHORT": "Sesión No Iniciada",
"NOT LOGGED IN": "Sesión No Iniciada: {error}",
- "NOT_LOADED": "No está cargado completamente, intentar de nuevo.",
"NOT_SET": "no definido",
"NTNAME": "Nombre",
"OK": "OK",
@@ -257,11 +232,7 @@
"OtherPortalAlert": "Otro",
"PASTE_INSTRUCT": "Pega un dibujo exportado de Wasabee aquí.\n\nWasabee no puede importar del formato normal de intel.\n\nHay soporte experimental para importar del formato DrawTools de IITC.\n\nAntes de importar del formato DrawTools, revise las áreas y asegúrese que todos los portales carguen para que estén en la caché de IITC. Cualquier portal que no haya estado pre-cargado será falsificado. Tendrás que usar la opción 'intercambiar' para mover las anclas de los portales falsos a los portales reales (estarán en la ubicación correcta, pero no asociados con el portal.\n\nPortales en la caché puede que no estén nombrados correctamente.",
"pending": "Pendiente",
- "PENDING": "Pendiente",
"PERMS": "{opName} permisos",
- "PICK_DEST_FIRST": "¡Por favor, primero elige un portal de destino!",
- "PICK_TAR_FIRST": "¡Por favor, primero elige un portal objetivo!",
- "PICK_TARGETDEST_Portals": "¡Por favor, primero selecciona portales de origen y de destino!",
"PLEASE_SELECT_PORTAL": "Por favor, seleccionar un portal",
"PORT_FAKE": "portales. Falsificados",
"PORTAL KEY LIST": "Lista de Llaves del Portal {portalName}",
@@ -271,11 +242,9 @@
"QD BUTTON END": "Dar click para detener dibujo de campos",
"QD BUTTON TOGGLE MODE": "Click to change draw mode",
"QD CHANGE COLOR": "Change color",
- "QD END": "Fin",
"QD TITLE": "Dibujar Capas Rápido",
"QD TOGGLE MODE": "Change mode",
"QDBASE": "Link Base",
- "QDCANCEL": "Cancelar Dibujar Campos",
"QDCONT": "Dar click a un portal anidado para dibujar el campo.",
"QDEND": "Dar click nuevamente al mismo portal para finalizar el dibujo.",
"QDNEXT": "Dar click al segundo portal ancla.",
@@ -300,10 +269,8 @@
"SAVELINKS_DRAW": "Save Links",
"SAVELINKS": "Save Links",
"SECONDS": "(Hace {seconds} segundos)",
- "SEL_PORT_FIRST": "¡Por favor, primero seleccionar portal ancla!",
"SEL_SB_ANCHOR": "Selecciona el área del ancla para hacer acercamiento para añadir a la supernova.",
"SEL_SB_ANCHOR2": "Zoom out. Make sure portals have all loaded, then click draw.",
- "SEL_SB_ANCHOR3": "Please be patient, it can take a bit.",
"SEL_SL_ANCHOR": "Select the portal to save the links of. Click save links button and look at checklist.",
"SEL_SRC_ANC2": "Selecciona tanto la Fuente como el Ancla 2",
"SEL_SRC_PORT": "Selecciona un portal fuente",
@@ -311,7 +278,6 @@
"SELECT_FAN_PORTALS": "Selecciona un portal ancla, un portal de inicio y un portal de fin, luego haz un acercamiento en el área para el fan field. Espera hasta que los portales hayan cargado (los portales deben estar en la pantalla para ser considerados) y presiona el botón Fanfield.",
"SELECT_FAN_PORTALS2": "Wait for all portals to load, then click draw.",
"SELECT_INSTRUCTIONS": "Selecciona dos portales ancla, luego luego haz un acercamiento en el área para los nodos de las capas. Espera hasta que los portales hayan cargado (los portales deben estar en la pantalla para ser considerados) y presiona el botón Multimax.",
- "SELECT_MADRID_INSTRUCTIONS": "Select three anchor portals, zoom in on the area near the selected anchor, wait until the portals are loaded (portals must be on screen to be considered) then select the 'define spine region' button for the corresponding base links.",
"SELECT_ONION_PORTALS": "Layers build from the inside out. Zoom in to center and select starting portal, then zoom out to area.",
"SELF SWAP": "¡No se puede intercambiar un portal consigo mismo! Selecciona un portal diferente.",
"SEND ANALYTICS": "Send Anonymous Analytics",
@@ -357,16 +323,13 @@
"SWAP": "Intercambiar",
"SYNC DONE": "Descarga Completa Haga clic AQUÍ para obtener sugerencias, consejos y documentación. ",
"SYNC": "Descargar Operaciones Disponibles",
- "TARDEST_DIFF": "Los portales objetivo y de destino deben ser diferentes.",
"TARGET SENT": "Objetivo enviado",
- "TEAM PERM DENIED": "Permiso denegeado al equipo: {error}",
"TEAM STATE": "Share Location",
"TEAM_CREATED": "Equipo {teamName} creado",
"TEAM_NAME": "Nombre de Equipo",
"TEAM": "Equipo",
"TEAMS BUTTON TITLE": "Listar Equipos Wasabee",
"TEAMS BUTTON": "Equipos",
- "TITLE": "título",
"TO_PORT": "Hacia el Portal",
"TRAWL SKIP TILES": "Trawl Skip Tiles",
"TRAWL TITLE": "Trawl Lanes",
@@ -390,7 +353,6 @@
"UPDATED": "Actualizado exitosamente",
"UpgradePortalAlert": "Actualizar",
"UPLOAD BUTTON HOVER": "CARGAR {opName} (no se encuentra actualmente en el servidor)",
- "UPLOAD PERM DENIED": "Permiso para cargar denegado",
"UPLOADED": "Cargado exitosamente",
"USE PANES ON MOBILE": "Use panes (need reload)",
"USE_SWAP_INSTRUCT": "Por favor, usa la opción de intercambiar portales para mover los portales falsificados hacia los portales reales en la misma ubicación. Hacer un acercamiento en los portales que están 'Cargando' en la lista de verificación puede forzarlos a cargar.",
@@ -407,7 +369,6 @@
"WRITE_SHORT": "RW",
"WRITE": "escribir",
"WSERVER": "Servidor {url}",
- "YES": "Sí",
"YESNO_DEL": "Estás seguro de querer borrar {opName}",
"ZONE_DRAW": "Click to set the zone boundaries",
"ZONE": "Zona",
From 52dc9cd0471922f3802536918be303f33744c9dc Mon Sep 17 00:00:00 2001
From: TheMitch2
Date: Thu, 2 Dec 2021 17:06:59 -0600
Subject: [PATCH 085/275] Update english.json
---
src/code/translations/english.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index d81ac5896..c886c43d5 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -317,7 +317,7 @@
"STARBURST": "Starburst",
"START_PORT": "Start Portal ",
"STATE": "State",
- "SUPPORT_INSTRUCT": "For support, please join the The Wasabee User Telegram Channel ",
+ "SUPPORT_INSTRUCT": "For support, please join the Wasabee User Telegram Channel ",
"SWAP PROMPT": "Do you want to swap: ",
"SWAP TITLE": "Swap Portals",
"SWAP WITH": " with ",
@@ -400,4 +400,4 @@
"TEAMS BUTTON": "Teams",
"WD BUTTON": "W-D Keys"
}
-}
+}
\ No newline at end of file
From b1b9af114d0009a4ddb73d3744eb6df297402e0a Mon Sep 17 00:00:00 2001
From: TheMitch2
Date: Thu, 2 Dec 2021 17:26:20 -0600
Subject: [PATCH 086/275] Update english.json
---
src/code/translations/english.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/code/translations/english.json b/src/code/translations/english.json
index c886c43d5..b367c0fbb 100644
--- a/src/code/translations/english.json
+++ b/src/code/translations/english.json
@@ -91,7 +91,7 @@
"DestroyPortalAlert": "Destroy",
"DRAW TOOLS FORMAT": "Draw Tools Format",
"DUPE_OP": "Duplicate Operation",
- "END_PORT": "End Portal ",
+ "END_PORT": "End Portal",
"ExcludeMarker": "Exclude from Auto-Draw/Mark",
"EXPORT OP TITLE": "Export current Op",
"EXPORT OP": "Export Op",
@@ -119,7 +119,7 @@
"HF_REDRAW_BUTTON": "Redraw",
"HG": "Homogeneous Field",
"HOURS": " ({hours} hours ago)",
- "HOW_TO_VIDS": "How-To Videos: ",
+ "HOW_TO_VIDS": "How-To Videos: ",
"IMP_COMP": "Import Complete. Found ",
"IMP_NOPE": "Import Failed: {error}",
"IMP_WAS_OP": "Import Wasabee Operation",
@@ -177,7 +177,7 @@
"MERGE_CHANGES_MERGE": "Merge result",
"MERGE_CHANGES_REMOTE": "Remote changes",
"MERGE_LOCAL": "Keep local",
- "MERGE_MESSAGE": "It seems that {opName} has local changes. Do you want to merge your modifications with the server OP, use the server version or keep the local version?",
+ "MERGE_MESSAGE": "It seems that {opName} has local changes. Do you want to merge your modifications with the server, use the server version, or keep the local version?",
"MERGE_REBASE": "Merge",
"MERGE_REPLACE": "Use server",
"MERGE_TITLE": "Merge local&remote OP",
@@ -315,7 +315,7 @@
"STARBURST TITLE": "Starburst",
"STARBURST_DRAW": "Draw",
"STARBURST": "Starburst",
- "START_PORT": "Start Portal ",
+ "START_PORT": "Start Portal",
"STATE": "State",
"SUPPORT_INSTRUCT": "For support, please join the Wasabee User Telegram Channel ",
"SWAP PROMPT": "Do you want to swap: ",
@@ -348,7 +348,7 @@
"UPDATE HOVER NOT CHANGED": "{opName} not changed locally",
"UPDATE HOVER": "UPDATE {opName} on the server",
"UPDATE PERM DENIED": "You do not have permission to update",
- "UPDATE_CONFLICT_DESC": "The OP has been modified on server since last sync. Do you want to replace the server version by the current one?",
+ "UPDATE_CONFLICT_DESC": "The OP has been modified on the server since last sync. Do you want to replace the server version with the current one?",
"UPDATE_CONFLICT_TITLE": "Conflict detected with server",
"UPDATE_COUNT": "Update Count",
"UPDATED": "Successfully updated",
@@ -361,7 +361,7 @@
"UseVirusPortalAlert": "Use Virus",
"VRLA DESC": "Depending on the number and type of Link Amps used, a lower source portal level might suffice.",
"VRLA": "L8+some VRLA",
- "WASABEE BUTTON TITLE": "Wasabee: it is green and makes smurfs cry.",
+ "WASABEE BUTTON TITLE": "Wasabee: It is green and makes smurfs cry.",
"WASABEE_D_LIST": "Input Defensive Key Count",
"WD BUTTON TITLE": "Log Defensive Keys",
"WD BUTTON": "W-D Keys",
From 1e8a1e0258701f5d1d425fcf4fae04fe2ec44eb3 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 22:22:29 +0100
Subject: [PATCH 087/275] task.ts
---
src/code/dialogs/autodraws/multimaxDialog.js | 4 +-
src/code/dialogs/checklist.js | 10 +-
src/code/index.d.ts | 7 +-
src/code/model/link.d.ts | 38 ------
src/code/model/link.js | 119 -----------------
src/code/model/link.ts | 88 +++++++++++++
src/code/model/marker.d.ts | 47 -------
src/code/model/marker.js | 127 -------------------
src/code/model/marker.ts | 88 +++++++++++++
src/code/model/operation.js | 10 +-
src/code/model/task.ts | 89 +++++++++++++
src/code/ui/link.js | 6 +-
12 files changed, 283 insertions(+), 350 deletions(-)
delete mode 100644 src/code/model/link.d.ts
delete mode 100644 src/code/model/link.js
create mode 100644 src/code/model/link.ts
delete mode 100644 src/code/model/marker.d.ts
delete mode 100644 src/code/model/marker.js
create mode 100644 src/code/model/marker.ts
create mode 100644 src/code/model/task.ts
diff --git a/src/code/dialogs/autodraws/multimaxDialog.js b/src/code/dialogs/autodraws/multimaxDialog.js
index 55c60795e..0b1d51933 100644
--- a/src/code/dialogs/autodraws/multimaxDialog.js
+++ b/src/code/dialogs/autodraws/multimaxDialog.js
@@ -130,10 +130,10 @@ const MultimaxDialog = AutoDraw.extend({
// skip base
if (l.toPortalId === pOne.id && l.fromPortalId === pTwo.id) continue;
if (l.fromPortalId === pOne.id && l.toPortalId === pTwo.id) continue;
- if (l.opOrder > order) l.opOrder += diff;
+ if (l.order > order) l.order += diff;
}
for (const m of this._operation.markers) {
- if (m.opOrder > order) m.opOrder += diff;
+ if (m.order > order) m.order += diff;
}
}
diff --git a/src/code/dialogs/checklist.js b/src/code/dialogs/checklist.js
index 63e5c6cc3..507694a87 100644
--- a/src/code/dialogs/checklist.js
+++ b/src/code/dialogs/checklist.js
@@ -104,7 +104,7 @@ const OperationChecklistDialog = WDialog.extend({
const columns = [
{
name: this._smallScreen ? "#" : wX("ORDER"),
- value: (thing) => thing.opOrder,
+ value: (thing) => thing.order,
// sort: (a, b) => a - b,
format: (cell, value, thing) => {
const oif = L.DomUtil.create("input");
@@ -114,9 +114,9 @@ const OperationChecklistDialog = WDialog.extend({
L.DomEvent.on(oif, "change", (ev) => {
L.DomEvent.stop(ev);
if (thing instanceof WasabeeLink) {
- operation.setLinkOrder(thing.ID, oif.value);
+ operation.setLinkOrder(thing.ID, +oif.value);
} else {
- operation.setMarkerOrder(thing.ID, oif.value);
+ operation.setMarkerOrder(thing.ID, +oif.value);
}
});
cell.appendChild(oif);
@@ -302,7 +302,7 @@ const OperationChecklistDialog = WDialog.extend({
countFields: function (operation, doAlert) {
const links = Array.from(operation.links);
- links.sort((a, b) => a.opOrder - b.opOrder);
+ links.sort((a, b) => a.order - b.order);
let fieldCount = 0;
let emptyCount = 0;
@@ -327,7 +327,7 @@ const OperationChecklistDialog = WDialog.extend({
b.add(link.fromPortalId);
// ignore link with order 0
- if (link.opOrder > 0) {
+ if (link.order > 0) {
// the link closes at least one field
const p1 = operation.getPortal(link.fromPortalId);
const p2 = operation.getPortal(link.toPortalId);
diff --git a/src/code/index.d.ts b/src/code/index.d.ts
index d0439ddfc..48d8c0a8c 100644
--- a/src/code/index.d.ts
+++ b/src/code/index.d.ts
@@ -1,13 +1,12 @@
-///
-
export {};
declare global {
type OpID = string;
type PortalID = string;
type TeamID = string;
- type LinkID = string;
- type MarkerID = string;
+ type TaskID = string;
+ type LinkID = TaskID;
+ type MarkerID = TaskID;
type GoogleID = string;
type ZoneID = number;
}
diff --git a/src/code/model/link.d.ts b/src/code/model/link.d.ts
deleted file mode 100644
index 430485bf2..000000000
--- a/src/code/model/link.d.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import type WasabeeOp from "./operation";
-export default class WasabeeLink {
- ID: string;
- fromPortalId: string;
- toPortalId: string;
- description?: string;
- assignedTo?: string;
- throwOrderPos: number;
- color: string;
- completed: boolean;
- zone: number;
- constructor(obj: any);
- assign(gid: any): void;
- toJSON(): {
- ID: string;
- fromPortalId: string;
- toPortalId: string;
- description: string;
- assignedTo: string;
- throwOrderPos: number;
- color: string;
- completed: boolean;
- zone: number;
- };
- get comment(): string;
- set comment(c: string);
- get opOrder(): number;
- set opOrder(o: number);
- setOrder(o: number | string): void;
- get state(): "pending" | "completed" | "assigned";
- set state(s: string);
- get portalId(): string;
- getLatLngs(operation: WasabeeOp): any[];
- get latLngs(): any[];
- setColor(color: string, operation: WasabeeOp): void;
- getColor(operation: WasabeeOp): string;
- length(operation: WasabeeOp): number;
-}
diff --git a/src/code/model/link.js b/src/code/model/link.js
deleted file mode 100644
index aa2011988..000000000
--- a/src/code/model/link.js
+++ /dev/null
@@ -1,119 +0,0 @@
-import { generateId } from "../auxiliar";
-import { getSelectedOperation } from "../selectedOp";
-
-export default class WasabeeLink {
- constructor(obj) {
- this.ID = obj.ID ? obj.ID : generateId();
- this.fromPortalId = obj.fromPortalId;
- this.toPortalId = obj.toPortalId;
- this.description = obj.description;
- this.assignedTo = obj.assignedTo ? obj.assignedTo : null;
- this.throwOrderPos = obj.throwOrderPos ? Number(obj.throwOrderPos) : 0;
- this.color = obj.color ? obj.color : "main";
- this.completed = obj.completed ? !!obj.completed : false;
- this.zone = obj.zone ? Number(obj.zone) : 1;
- }
-
- assign(gid) {
- this.assignedTo = gid ? gid : null;
- }
-
- // build object to serialize
- toJSON() {
- return {
- ID: this.ID,
- fromPortalId: this.fromPortalId,
- toPortalId: this.toPortalId,
- description: this.description,
- assignedTo: this.assignedTo,
- throwOrderPos: Number(this.throwOrderPos),
- color: this.color,
- completed: !!this.completed, // !! forces a boolean value
- zone: Number(this.zone),
- };
- }
-
- // for interface consistency, the other types use comment
- // we can't rename them here w/o making the corresponding changes on the server
- get comment() {
- return this.description;
- }
-
- set comment(c) {
- this.description = c;
- }
-
- // for interface consistency, other types use order
- get opOrder() {
- return this.throwOrderPos;
- }
-
- set opOrder(o) {
- this.throwOrderPos = Number.parseInt(o, 10);
- }
-
- // make the interface match (kinda) what markers do
- // 'pending','assigned','acknowledged','completed'
- // THESE ARE INTERNAL VALUES AND SHOULD NOT BE wX'd!!!
- get state() {
- if (this.completed) return "completed";
- if (this.assignedTo) return "assigned";
- return "pending";
- }
-
- set state(s) {
- if (s == "completed") {
- this.completed = true;
- } else {
- this.completed = false;
- }
- }
-
- // kludge to make the interface work
- get portalId() {
- return this.fromPortalId;
- }
-
- getLatLngs(operation) {
- if (!operation) operation = getSelectedOperation();
-
- const returnArray = Array();
-
- const fromPortal = operation.getPortal(this.fromPortalId);
- if (!fromPortal || !fromPortal.lat) {
- console.log("unable to get source portal");
- return null;
- }
- returnArray.push(fromPortal.latLng);
-
- const toPortal = operation.getPortal(this.toPortalId);
- if (!toPortal || !toPortal.lat) {
- console.log("unable to get destination portal");
- return null;
- }
- returnArray.push(toPortal.latLng);
-
- return returnArray;
- }
-
- get latLngs() {
- return this.getLatLngs(getSelectedOperation());
- }
-
- setColor(color, operation) {
- this.color = color;
- if (this.color == operation.color) this.color = "main";
- operation.update();
- }
-
- getColor(operation) {
- let color = this.color;
- if (color == "main") color = operation.color;
- return color;
- }
-
- length(operation) {
- const latlngs = this.getLatLngs(operation);
- return L.latLng(latlngs[0]).distanceTo(latlngs[1]);
- }
-}
diff --git a/src/code/model/link.ts b/src/code/model/link.ts
new file mode 100644
index 000000000..ee01efa82
--- /dev/null
+++ b/src/code/model/link.ts
@@ -0,0 +1,88 @@
+import { getSelectedOperation } from "../selectedOp";
+import type WasabeeOp from "./operation";
+
+import Task from "./task";
+
+function fromServer(obj: any) {
+ // convert link task
+ obj.order = +obj.throwOrderPos || 0;
+ obj.state = "pending";
+ obj.completedID = obj.completed ? obj.assignedTo : null;
+ if (obj.completedID) obj.state = "completed";
+ else if (obj.assignedTo) obj.state = "assigned";
+ if (obj.description) obj.comment = obj.description;
+ return obj;
+}
+
+export default class WasabeeLink extends Task {
+ fromPortalId: PortalID;
+ toPortalId: PortalID;
+ color: string;
+
+ constructor(obj: any) {
+ if (obj.throwOrderPos !== undefined) {
+ obj = fromServer(obj);
+ }
+ super(obj);
+ this.fromPortalId = obj.fromPortalId;
+ this.toPortalId = obj.toPortalId;
+ this.color = obj.color ? obj.color : "main";
+ }
+
+ // build object to serialize
+ toJSON() {
+ return {
+ ID: this.ID,
+ throwOrderPos: this.order,
+ zone: this.zone,
+ assignedTo: this.assignedTo,
+ completed: !!this.completedID, // !! forces a boolean value
+ fromPortalId: this.fromPortalId,
+ toPortalId: this.toPortalId,
+ color: this.color,
+ description: this.comment,
+ };
+ }
+
+ // kludge to make the interface work
+ get portalId() {
+ return this.fromPortalId;
+ }
+
+ getLatLngs(operation: WasabeeOp) {
+ operation = operation || getSelectedOperation();
+ const returnArray = Array();
+
+ const fromPortal = operation.getPortal(this.fromPortalId);
+ if (!fromPortal || !fromPortal.lat) {
+ console.log("unable to get source portal");
+ return null;
+ }
+ returnArray.push(fromPortal.latLng);
+
+ const toPortal = operation.getPortal(this.toPortalId);
+ if (!toPortal || !toPortal.lat) {
+ console.log("unable to get destination portal");
+ return null;
+ }
+ returnArray.push(toPortal.latLng);
+
+ return returnArray;
+ }
+
+ setColor(color: string, operation: WasabeeOp) {
+ this.color = color;
+ if (this.color == operation.color) this.color = "main";
+ }
+
+ getColor(operation: WasabeeOp) {
+ let color = this.color;
+ if (color == "main") color = operation.color;
+ return color;
+ }
+
+ length(operation: WasabeeOp) {
+ const latlngs = this.getLatLngs(operation);
+ return L.latLng(latlngs[0]).distanceTo(latlngs[1]);
+ }
+}
diff --git a/src/code/model/marker.d.ts b/src/code/model/marker.d.ts
deleted file mode 100644
index f688b712a..000000000
--- a/src/code/model/marker.d.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-export default class WasabeeMarker {
- ID: string;
- portalId: string;
- type: string;
- comment?: string;
- order: number;
- completedID: boolean;
- assignedTo: string;
- zone: number;
- _state: "pending" | "assigned" | "acknowledged" | "completed";
- static get markerTypes(): Set;
- static get constants(): {
- MARKER_TYPE_CAPTURE: string;
- MARKER_TYPE_DECAY: string;
- MARKER_TYPE_EXCLUDE: string;
- MARKER_TYPE_DESTROY: string;
- MARKER_TYPE_FARM: string;
- MARKER_TYPE_GOTO: string;
- MARKER_TYPE_KEY: string;
- MARKER_TYPE_LINK: string;
- MARKER_TYPE_MEETAGENT: string;
- MARKER_TYPE_OTHER: string;
- MARKER_TYPE_RECHARGE: string;
- MARKER_TYPE_UPGRADE: string;
- MARKER_TYPE_VIRUS: string;
- };
- constructor(obj: any);
- toJSON(): {
- ID: string;
- portalId: string;
- type: string;
- comment: string;
- state: "pending" | "completed" | "assigned" | "acknowledged";
- completedID: boolean;
- assignedTo: string;
- order: number;
- zone: number;
- };
- get opOrder(): number;
- set opOrder(o: number);
- setOrder(o: number | string): void;
- assign(gid: any): void;
- set state(state: "pending" | "completed" | "assigned" | "acknowledged");
- get state(): "pending" | "completed" | "assigned" | "acknowledged";
- isDestructMarker(): boolean;
- static isDestructMarkerType(type: any): boolean;
-}
diff --git a/src/code/model/marker.js b/src/code/model/marker.js
deleted file mode 100644
index ae7e18dea..000000000
--- a/src/code/model/marker.js
+++ /dev/null
@@ -1,127 +0,0 @@
-import { generateId } from "../auxiliar";
-
-const markers = {
- MARKER_TYPE_CAPTURE: "CapturePortalMarker",
- MARKER_TYPE_DECAY: "LetDecayPortalAlert",
- MARKER_TYPE_EXCLUDE: "ExcludeMarker",
- MARKER_TYPE_DESTROY: "DestroyPortalAlert",
- MARKER_TYPE_FARM: "FarmPortalMarker",
- MARKER_TYPE_GOTO: "GotoPortalMarker",
- MARKER_TYPE_KEY: "GetKeyPortalMarker",
- MARKER_TYPE_LINK: "CreateLinkAlert",
- MARKER_TYPE_MEETAGENT: "MeetAgentPortalMarker",
- MARKER_TYPE_OTHER: "OtherPortalAlert",
- MARKER_TYPE_RECHARGE: "RechargePortalAlert",
- MARKER_TYPE_UPGRADE: "UpgradePortalAlert",
- MARKER_TYPE_VIRUS: "UseVirusPortalAlert",
-};
-
-const destructMarkerTypes = [
- markers.MARKER_TYPE_DECAY,
- markers.MARKER_TYPE_DESTROY,
- markers.MARKER_TYPE_VIRUS,
-];
-
-const markerTypes = new Set(Object.values(markers));
-
-const STATE_UNASSIGNED = "pending";
-const STATE_ASSIGNED = "assigned";
-const STATE_ACKNOWLEDGED = "acknowledged";
-const STATE_COMPLETED = "completed";
-
-export default class WasabeeMarker {
- // static properties is not supported by eslint yet
- static get markerTypes() {
- return markerTypes;
- }
-
- static get constants() {
- return markers;
- }
-
- constructor(obj) {
- this.ID = obj.ID ? obj.ID : generateId();
- this.portalId = obj.portalId;
- this.type = obj.type;
- this.comment = obj.comment;
- this.completedID = obj.completedID ? obj.completedID : null;
- this.order = obj.order ? Number(obj.order) : 0;
- this.zone = obj.zone ? Number(obj.zone) : 1;
-
- this.assign(obj.assignedTo); // WAS this.assignedTo = obj.assignedTo ? obj.assignedTo : null;
- // if ._state then it came from indexeddb, otherwise from server/localStorage
- if (obj._state) {
- this.state = obj._state;
- } else this.state = obj.state ? obj.state : null;
- }
-
- // not called when pushing to indexeddb, but used when sending to server
- toJSON() {
- return {
- ID: this.ID,
- portalId: this.portalId,
- type: this.type,
- comment: this.comment,
- state: this._state, // no need to validate here
- completedID: this.completedID,
- assignedTo: this.assignedTo,
- order: Number(this.order),
- zone: Number(this.zone),
- };
- }
-
- get opOrder() {
- return this.order;
- }
-
- set opOrder(o) {
- this.order = Number.parseInt(o, 10);
- }
-
- assign(gid) {
- if (!gid || gid == "") {
- this._state = STATE_UNASSIGNED;
- this.assignedTo = null;
- return;
- }
-
- this.assignedTo = gid;
- this._state = STATE_ASSIGNED;
- return;
- }
-
- set state(state) {
- switch (state) {
- case STATE_UNASSIGNED:
- this.assignedTo = null;
- this._state = STATE_UNASSIGNED;
- break;
- case STATE_ASSIGNED: // fall-through
- case STATE_ACKNOWLEDGED:
- if (!this.assignedTo || this.assignedTo == "") {
- this._state = STATE_UNASSIGNED;
- break;
- }
- this._state = state;
- break;
- case STATE_COMPLETED:
- this._state = STATE_COMPLETED;
- break;
- default:
- this._state = STATE_UNASSIGNED;
- break;
- }
- }
-
- get state() {
- return this._state;
- }
-
- isDestructMarker() {
- return destructMarkerTypes.includes(this.type);
- }
-
- static isDestructMarkerType(type) {
- return destructMarkerTypes.includes(type);
- }
-}
diff --git a/src/code/model/marker.ts b/src/code/model/marker.ts
new file mode 100644
index 000000000..2c1a6a230
--- /dev/null
+++ b/src/code/model/marker.ts
@@ -0,0 +1,88 @@
+import Task from "./task";
+
+const markers = {
+ MARKER_TYPE_CAPTURE: "CapturePortalMarker",
+ MARKER_TYPE_DECAY: "LetDecayPortalAlert",
+ MARKER_TYPE_EXCLUDE: "ExcludeMarker",
+ MARKER_TYPE_DESTROY: "DestroyPortalAlert",
+ MARKER_TYPE_FARM: "FarmPortalMarker",
+ MARKER_TYPE_GOTO: "GotoPortalMarker",
+ MARKER_TYPE_KEY: "GetKeyPortalMarker",
+ MARKER_TYPE_LINK: "CreateLinkAlert",
+ MARKER_TYPE_MEETAGENT: "MeetAgentPortalMarker",
+ MARKER_TYPE_OTHER: "OtherPortalAlert",
+ MARKER_TYPE_RECHARGE: "RechargePortalAlert",
+ MARKER_TYPE_UPGRADE: "UpgradePortalAlert",
+ MARKER_TYPE_VIRUS: "UseVirusPortalAlert",
+};
+
+const destructMarkerTypes = [
+ markers.MARKER_TYPE_DECAY,
+ markers.MARKER_TYPE_DESTROY,
+ markers.MARKER_TYPE_VIRUS,
+];
+
+const markerTypes = new Set(Object.values(markers));
+
+const iconTypes = {
+ CapturePortalMarker: "capture",
+ LetDecayPortalAlert: "decay",
+ ExcludeMarker: "exclude",
+ DestroyPortalAlert: "destroy",
+ FarmPortalMarker: "farm",
+ GotoPortalMarker: "goto",
+ GetKeyPortalMarker: "key",
+ CreateLinkAlert: "link",
+ MeetAgentPortalMarker: "meetagent",
+ OtherPortalAlert: "other",
+ RechargePortalAlert: "recharge",
+ UpgradePortalAlert: "upgrade",
+ UseVirusPortalAlert: "virus",
+};
+
+export default class WasabeeMarker extends Task {
+ portalId: PortalID;
+ type: string;
+
+ // static properties is not supported by eslint yet
+ static get markerTypes() {
+ return markerTypes;
+ }
+
+ static get constants() {
+ return markers;
+ }
+
+ constructor(obj: any) {
+ super(obj);
+ this.portalId = obj.portalId;
+ this.type = obj.type;
+ }
+
+ toJSON(): any {
+ return {
+ ID: this.ID,
+ zone: Number(this.zone),
+ order: Number(this.order),
+ completedID: this.completedID,
+ assignedTo: this.assignedTo,
+ state: this._state,
+
+ portalId: this.portalId,
+ type: this.type,
+ comment: this.comment,
+ };
+ }
+
+ get friendlyType() {
+ return iconTypes[this.type];
+ }
+
+ isDestructMarker() {
+ return destructMarkerTypes.includes(this.type);
+ }
+
+ static isDestructMarkerType(type) {
+ return destructMarkerTypes.includes(type);
+ }
+}
diff --git a/src/code/model/operation.js b/src/code/model/operation.js
index 75af4ece0..3a6b31007 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.js
@@ -415,7 +415,7 @@ export default class WasabeeOp extends Evented {
setLinkOrder(linkID, order) {
for (const v of this.links) {
if (v.ID == linkID) {
- v.opOrder = Number(order);
+ v.setOrder(order);
}
}
this.update(true);
@@ -424,7 +424,7 @@ export default class WasabeeOp extends Evented {
setMarkerOrder(markerID, order) {
for (const v of this.markers) {
if (v.ID == markerID) {
- v.opOrder = Number(order);
+ v.setOrder(order);
}
}
this.update(true);
@@ -660,7 +660,7 @@ export default class WasabeeOp extends Evented {
this
);
if (options.description) link.description = options.description;
- if (options.order) link.opOrder = options.order;
+ if (options.order) link.setOrder(options.order);
if (options.color) link.color = options.color;
if (!existingLink) {
@@ -1007,10 +1007,10 @@ export default class WasabeeOp extends Evented {
get nextOrder() {
let o = 0;
for (const l of this.links) {
- o = Math.max(o, l.opOrder);
+ o = Math.max(o, l.order);
}
for (const m of this.markers) {
- o = Math.max(o, m.opOrder);
+ o = Math.max(o, m.order);
}
return ++o;
}
diff --git a/src/code/model/task.ts b/src/code/model/task.ts
new file mode 100644
index 000000000..67c6eb6c5
--- /dev/null
+++ b/src/code/model/task.ts
@@ -0,0 +1,89 @@
+import { generateId } from "../auxiliar";
+
+export default class Task {
+ ID: TaskID;
+ order: number;
+ zone: ZoneID;
+ assignedTo?: GoogleID;
+ completedID?: GoogleID;
+ comment?: string;
+
+ _state: "pending" | "assigned" | "acknowledged" | "completed";
+
+ constructor(obj: any) {
+ this.ID = obj.ID || generateId();
+ this.zone = +obj.zone || 1;
+ this.order = +obj.order || 0;
+ this.assignedTo = obj.assignedTo ? obj.assignedTo : null;
+ this.completedID = obj.completedID ? obj.completedID : null;
+ this.comment = obj.comment ? obj.comment : "";
+ this.state = obj._state || obj.state;
+ }
+
+ toServer() {
+ return this.toJSON();
+ }
+
+ toJSON(): any {
+ return {
+ ID: this.ID,
+ zone: Number(this.zone),
+ order: Number(this.order),
+ completedID: this.completedID,
+ assignedTo: this.assignedTo,
+ state: this._state,
+ };
+ }
+
+ get state() {
+ return this._state;
+ }
+
+ set state(state) {
+ switch (state) {
+ case "assigned": // fall-through
+ case "acknowledged":
+ if (!this.assignedTo || this.assignedTo == "") {
+ this._state = "pending";
+ break;
+ }
+ this._state = state;
+ break;
+ case "completed":
+ this.complete();
+ break;
+ case "pending":
+ default:
+ this.assignedTo = null;
+ this._state = "pending";
+ break;
+ }
+ }
+
+ setOrder(o: number | string) {
+ this.order = +o || 0;
+ }
+
+ assign(gid?: GoogleID) {
+ if (gid !== this.assignedTo) this._state = gid ? "pending" : "assigned";
+ this.assignedTo = gid ? gid : null;
+ }
+
+ complete(gid?: GoogleID) {
+ if (!this.completedID || gid)
+ this.completedID = gid ? gid : this.assignedTo;
+ this._state = "completed";
+ }
+
+ get completed() {
+ return this._state == "completed";
+ }
+
+ set completed(v) {
+ if (v) this.complete();
+ else {
+ delete this.completedID;
+ this.state = "assigned";
+ }
+ }
+}
diff --git a/src/code/ui/link.js b/src/code/ui/link.js
index 0411d6c81..d132f6384 100644
--- a/src/code/ui/link.js
+++ b/src/code/ui/link.js
@@ -110,9 +110,9 @@ const WLLink = L.GeodesicPolyline.extend({
L.DomUtil.create("div", null, div).appendChild(
displayFormat(link, operation)
);
- if (link.description)
- L.DomUtil.create("div", "enl", div).textContent = link.description;
- L.DomUtil.create("div", "enl", div).textContent = "# " + link.throwOrderPos;
+ if (link.comment)
+ L.DomUtil.create("div", "enl", div).textContent = link.comment;
+ L.DomUtil.create("div", "enl", div).textContent = "# " + link.order;
const buttonset = L.DomUtil.create("div", "buttonset", div);
if (operation.canWrite()) {
const del = L.DomUtil.create("button", null, buttonset);
From 4e6e038fe544231192ae5cecc9a81f19c385a78a Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 22:24:30 +0100
Subject: [PATCH 088/275] db.ts
---
src/code/db.d.ts | 58 -------------------------------------
src/code/{db.js => db.ts} | 60 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 59 insertions(+), 59 deletions(-)
delete mode 100644 src/code/db.d.ts
rename src/code/{db.js => db.ts} (64%)
diff --git a/src/code/db.d.ts b/src/code/db.d.ts
deleted file mode 100644
index a0c64d7ef..000000000
--- a/src/code/db.d.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { DBSchema } from "idb";
-import type WasabeeAgent from "./model/agent";
-import type { IBlockerPortal } from "./model/blocker";
-import type WasabeeBlocker from "./model/blocker";
-import type { ILocalOp } from "./model/operation";
-import type WasabeeTeam from "./model/team";
-import type { WDKey } from "./wd";
-interface WasabeeDB extends DBSchema {
- agents: {
- key: GoogleID;
- value: WasabeeAgent;
- indexes: {
- date: string;
- fetched: string;
- };
- };
- teams: {
- key: TeamID;
- value: WasabeeTeam;
- indexes: {
- fetched: string;
- };
- };
- defensivekeys: {
- key: [GoogleID, PortalID];
- value: WDKey;
- indexes: {
- PortalID: string;
- Count: number;
- };
- };
- operations: {
- key: OpID;
- value: ILocalOp;
- indexes: {
- fetched: string;
- server: string;
- };
- };
- blockers: {
- key: [OpID, PortalID, PortalID];
- value: WasabeeBlocker;
- indexes: {
- opID: OpID;
- from: PortalID;
- to: PortalID;
- };
- };
- blockers_portals: {
- key: [OpID, PortalID];
- value: IBlockerPortal;
- indexes: {
- opID: OpID;
- };
- };
-}
-declare const db: Promise>;
-export default db;
diff --git a/src/code/db.js b/src/code/db.ts
similarity index 64%
rename from src/code/db.js
rename to src/code/db.ts
index 2b2f7feff..741477c2c 100644
--- a/src/code/db.js
+++ b/src/code/db.ts
@@ -1,9 +1,67 @@
import { openDB } from "idb";
+import type { DBSchema } from "idb";
+import type WasabeeAgent from "./model/agent";
+import type { IBlockerPortal } from "./model/blocker";
+import type WasabeeBlocker from "./model/blocker";
+import type { ILocalOp } from "./model/operation";
+import type WasabeeTeam from "./model/team";
+import type { WDKey } from "./wd";
+
const version = 3;
+interface WasabeeDB extends DBSchema {
+ agents: {
+ key: GoogleID;
+ value: WasabeeAgent;
+ indexes: {
+ date: string;
+ fetched: string;
+ };
+ };
+ teams: {
+ key: TeamID;
+ value: WasabeeTeam;
+ indexes: {
+ fetched: string;
+ };
+ };
+ defensivekeys: {
+ key: [GoogleID, PortalID];
+ value: WDKey;
+ indexes: {
+ PortalID: string;
+ Count: number;
+ };
+ };
+ operations: {
+ key: OpID;
+ value: ILocalOp;
+ indexes: {
+ fetched: string;
+ server: string;
+ };
+ };
+ blockers: {
+ key: [OpID, PortalID, PortalID];
+ value: WasabeeBlocker;
+ indexes: {
+ opID: OpID;
+ from: PortalID;
+ to: PortalID;
+ };
+ };
+ blockers_portals: {
+ key: [OpID, PortalID];
+ value: IBlockerPortal;
+ indexes: {
+ opID: OpID;
+ };
+ };
+}
+
// XXX audit these to make sure all the various indexes are used
-const db = openDB("wasabee", version, {
+const db = openDB("wasabee", version, {
upgrade(db, oldVersion, newVersion, tx) {
if (oldVersion < 1) {
const agents = db.createObjectStore("agents", { keyPath: "id" });
From 8b5519e7c16bfb24d6df4a658055b419209c7547 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 22:27:46 +0100
Subject: [PATCH 089/275] wX.ts
---
src/code/wX.d.ts | 3 ---
src/code/{wX.js => wX.ts} | 5 ++---
2 files changed, 2 insertions(+), 6 deletions(-)
delete mode 100644 src/code/wX.d.ts
rename src/code/{wX.js => wX.ts} (95%)
diff --git a/src/code/wX.d.ts b/src/code/wX.d.ts
deleted file mode 100644
index 49bf52ccf..000000000
--- a/src/code/wX.d.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export declare function wX(key: string, data?: object): any;
-export declare function getLanguage(): any;
-export default wX;
diff --git a/src/code/wX.js b/src/code/wX.ts
similarity index 95%
rename from src/code/wX.js
rename to src/code/wX.ts
index 4cf9e0b58..a784dedb2 100644
--- a/src/code/wX.js
+++ b/src/code/wX.ts
@@ -1,13 +1,12 @@
import statics from "./static";
-// aliases to make review easier
let strings = statics.strings;
const defaultLang = statics.constants.DEFAULT_LANGUAGE;
const localStoreKey = statics.constants.LANGUAGE_KEY;
const templateRe = /\{ *([\w_ -]+) *\}/g;
-export function wX(key, data) {
+export function wX(key: string, data?: object) {
const lang = getLanguage();
// if the skin system is initialized, switch to it
@@ -62,4 +61,4 @@ export function getLanguage() {
return lang;
}
-export default wX;
+export default wX;
\ No newline at end of file
From 8e8e75b6c8dd6defd6d2383a96a010fcaf4953b4 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 22:31:12 +0100
Subject: [PATCH 090/275] crosslink.ts
---
src/code/crosslinks.d.ts | 22 ------------------
src/code/{crosslinks.js => crosslinks.ts} | 28 ++++++++++++++++-------
2 files changed, 20 insertions(+), 30 deletions(-)
delete mode 100644 src/code/crosslinks.d.ts
rename src/code/{crosslinks.js => crosslinks.ts} (93%)
diff --git a/src/code/crosslinks.d.ts b/src/code/crosslinks.d.ts
deleted file mode 100644
index 859fa8b9d..000000000
--- a/src/code/crosslinks.d.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import * as L from "leaflet";
-interface LLC extends L.LatLng {
- _cartesian?: [number, number, number];
-}
-export declare function greatCircleArcIntersectByLatLngs(a0: LLC, a1: LLC, b0: LLC, b1: LLC): boolean;
-export declare function greatCircleArcIntersect(existing: any, drawn: any): boolean;
-export declare function checkAllLinks(): void;
-export declare function initCrossLinks(): void;
-export declare class GeodesicLine {
- lat1: number;
- lat2: number;
- lng1: number;
- lng2: number;
- sinLat1CosLat2: number;
- sinLat2CosLat1: number;
- cosLat1CosLat2SinDLng: number;
- constructor(start: L.LatLng, end: L.LatLng);
- isMeridian(): boolean;
- latAtLng(lng: any): number;
- bearing(): number;
-}
-export {};
diff --git a/src/code/crosslinks.js b/src/code/crosslinks.ts
similarity index 93%
rename from src/code/crosslinks.js
rename to src/code/crosslinks.ts
index 7c978b5c8..d8e0e6bba 100644
--- a/src/code/crosslinks.js
+++ b/src/code/crosslinks.ts
@@ -8,14 +8,14 @@ import PortalUI from "./ui/portal";
// from iitc rework : https://github.com/IITC-CE/ingress-intel-total-conversion/pull/333
const d2r = Math.PI / 180;
-function toCartesian(lat, lng) {
+function toCartesian(lat: number, lng: number): [number, number, number] {
lat *= d2r;
lng *= d2r;
var o = Math.cos(lat);
return [o * Math.cos(lng), o * Math.sin(lng), Math.sin(lat)];
}
-function cross(t, n) {
+function cross(t: [number, number, number], n: [number, number, number]): [number, number, number] {
return [
t[1] * n[2] - t[2] * n[1],
t[2] * n[0] - t[0] * n[2],
@@ -23,17 +23,21 @@ function cross(t, n) {
];
}
-function dot(t, n) {
+function dot(t: [number, number, number], n: [number, number, number]) {
return t[0] * n[0] + t[1] * n[1] + t[2] * n[2];
}
-function equals(a, b) {
+function equals(a: L.LatLng, b: L.LatLng) {
return a.lat === b.lat && a.lng === b.lng;
}
// take L.LatLng
// note: cache cos/sin calls in the object, in order to be efficient, try using same LatLng objects across calls, like using latLng from WasabeePortal attached to an op
-export function greatCircleArcIntersectByLatLngs(a0, a1, b0, b1) {
+interface LLC extends L.LatLng {
+ _cartesian?: [number, number, number],
+}
+
+export function greatCircleArcIntersectByLatLngs(a0: LLC, a1: LLC, b0: LLC, b1: LLC) {
// 0) quick checks
// zero length line
if (equals(a0, a1)) return false;
@@ -295,7 +299,15 @@ export function initCrossLinks() {
}
export class GeodesicLine {
- constructor(start, end) {
+ lat1: number;
+ lat2: number;
+ lng1: number;
+ lng2: number;
+ sinLat1CosLat2: number;
+ sinLat2CosLat1: number;
+ cosLat1CosLat2SinDLng: number;
+
+ constructor(start: L.LatLng, end: L.LatLng) {
let d2r = Math.PI / 180.0;
// let r2d = 180.0 / Math.PI; //eslint-disable-line
// maths based on http://williams.best.vwh.net/avform.htm#Int
@@ -335,7 +347,7 @@ export class GeodesicLine {
lat = Math.atan(
(this.sinLat1CosLat2 * Math.sin(lng - this.lng2) -
this.sinLat2CosLat1 * Math.sin(lng - this.lng1)) /
- this.cosLat1CosLat2SinDLng
+ this.cosLat1CosLat2SinDLng
);
}
return (lat * 180) / Math.PI; // return value in degrees
@@ -349,4 +361,4 @@ export class GeodesicLine {
const x = this.sinLat2CosLat1 - this.sinLat1CosLat2 * Math.cos(dLng);
return Math.atan2(y, x);
}
-}
+}
\ No newline at end of file
From 460af0d858d61f729ca4938ad584057f5bec96a2 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 22:48:01 +0100
Subject: [PATCH 091/275] team.ts
---
src/code/mapDrawing.js | 2 --
src/code/model/team.d.ts | 15 ---------------
src/code/model/{team.js => team.ts} | 18 +++++++++++++++---
3 files changed, 15 insertions(+), 20 deletions(-)
delete mode 100644 src/code/model/team.d.ts
rename src/code/model/{team.js => team.ts} (85%)
diff --git a/src/code/mapDrawing.js b/src/code/mapDrawing.js
index f307a93d9..631993405 100644
--- a/src/code/mapDrawing.js
+++ b/src/code/mapDrawing.js
@@ -153,8 +153,6 @@ export async function drawSingleTeam(teamID, layerMap, alreadyDone) {
const team = await WasabeeTeam.get(teamID, 15); // hold time is 15 seconds here, probably too aggressive now that firebase works well
// common case: team was enabled here, but was since disabled in another client and the pull returned an error
if (team == null) return done;
- // we don't need to draw if pulled from cache
- if (team.cached === true) return done;
const agents = team.getAgents();
for (const agent of agents) {
diff --git a/src/code/model/team.d.ts b/src/code/model/team.d.ts
deleted file mode 100644
index e7c6fcd33..000000000
--- a/src/code/model/team.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import WasabeeAgent from "./agent";
-export default class WasabeeTeam {
- fetched: number;
- id: string;
- name: string;
- rc: string;
- rk: string;
- jlt: string;
- agents: Array;
- _a: Array;
- constructor(data: any);
- getAgents(): WasabeeAgent[];
- _updateCache(): Promise;
- static get(teamID: any, maxAgeSeconds?: number): Promise;
-}
diff --git a/src/code/model/team.js b/src/code/model/team.ts
similarity index 85%
rename from src/code/model/team.js
rename to src/code/model/team.ts
index 7a0c7747b..c4523b807 100644
--- a/src/code/model/team.js
+++ b/src/code/model/team.ts
@@ -4,6 +4,16 @@ import { teamPromise } from "../server";
import db from "../db";
export default class WasabeeTeam {
+ fetched: number;
+ id: string;
+ name: string;
+ rc: string;
+ rk: string;
+ jlt: string;
+ agents: Array;
+
+ _a: Array;
+
constructor(data) {
if (typeof data == "string") {
try {
@@ -52,8 +62,10 @@ export default class WasabeeTeam {
static async get(teamID, maxAgeSeconds = 60) {
const cached = await (await db).get("teams", teamID);
if (cached) {
- if (cached.fetched + maxAgeSeconds * 1000 > Date.now())
- return new WasabeeTeam(cached);
+ const t = new WasabeeTeam(cached);
+ if (t.fetched > Date.now() - 1000 * maxAgeSeconds) {
+ return t;
+ }
}
if (!WasabeeMe.isLoggedIn()) return null;
@@ -66,4 +78,4 @@ export default class WasabeeTeam {
}
return null;
}
-}
+}
\ No newline at end of file
From 8eea3082de646f8daee6c7152601b3984da093e6 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 22:53:58 +0100
Subject: [PATCH 092/275] agent.ts
---
src/code/model/agent.d.ts | 29 ---------------------------
src/code/model/{agent.js => agent.ts} | 27 +++++++++++++++++++++++--
2 files changed, 25 insertions(+), 31 deletions(-)
delete mode 100644 src/code/model/agent.d.ts
rename src/code/model/{agent.js => agent.ts} (91%)
diff --git a/src/code/model/agent.d.ts b/src/code/model/agent.d.ts
deleted file mode 100644
index 40b3b92d8..000000000
--- a/src/code/model/agent.d.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import * as L from "leaflet";
-export default class WasabeeAgent {
- id: string;
- name: string;
- vname: string;
- rocksname: string;
- intelname: string;
- intelfaction: string;
- level: number;
- enlid: string;
- pic: string;
- Vverified: boolean;
- blacklisted: boolean;
- rocks: boolean;
- lat: number;
- lng: number;
- date: string;
- ShareWD?: boolean;
- LoadWD?: boolean;
- squad?: string;
- state?: boolean;
- fetched: number;
- cached?: boolean;
- constructor(obj: any);
- getTeamName(teamID?: number): Promise;
- _updateCache(): Promise;
- get latLng(): L.LatLng;
- static get(gid: string, maxAgeSeconds?: number): Promise;
-}
diff --git a/src/code/model/agent.js b/src/code/model/agent.ts
similarity index 91%
rename from src/code/model/agent.js
rename to src/code/model/agent.ts
index 92b63beda..b717240bf 100644
--- a/src/code/model/agent.js
+++ b/src/code/model/agent.ts
@@ -3,7 +3,31 @@ import WasabeeMe from "./me";
import WasabeeTeam from "./team";
import db from "../db";
+
export default class WasabeeAgent {
+ id: string;
+ name: string;
+ vname: string;
+ rocksname: string;
+ intelname: string;
+ intelfaction: string;
+ level: number;
+ enlid: string;
+ pic: string;
+ Vverified: boolean;
+ blacklisted: boolean;
+ rocks: boolean;
+ lat: number;
+ lng: number;
+ date: string;
+
+ ShareWD?: boolean;
+ LoadWD?: boolean;
+ squad?: string;
+ state?: boolean;
+
+ fetched: number;
+
constructor(obj) {
if (typeof obj == "string") {
try {
@@ -135,11 +159,10 @@ export default class WasabeeAgent {
}
// hold agent data up to 24 hours by default -- don't bother the server if all we need to do is resolve GID -> name
- static async get(gid, maxAgeSeconds = 86400) {
+ static async get(gid: string, maxAgeSeconds = 86400) {
const cached = await (await db).get("agents", gid);
if (cached && cached.fetched > Date.now() - 1000 * maxAgeSeconds) {
const a = new WasabeeAgent(cached);
- a.cached = true;
// console.debug("returning from cache", a);
return a;
}
From c35c6cd6145d71672d4ea4d4d18a69be062c486b Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 22:57:00 +0100
Subject: [PATCH 093/275] me.ts
---
src/code/model/me.d.ts | 48 ---------------------------------
src/code/model/{me.js => me.ts} | 38 +++++++++++++++++++++++++-
2 files changed, 37 insertions(+), 49 deletions(-)
delete mode 100644 src/code/model/me.d.ts
rename src/code/model/{me.js => me.ts} (85%)
diff --git a/src/code/model/me.d.ts b/src/code/model/me.d.ts
deleted file mode 100644
index 443c8c926..000000000
--- a/src/code/model/me.d.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-export interface MeTeam {
- ID: string;
- Name: string;
- RocksComm: string;
- RocksKey: string;
- JoinLinkToken: string;
- ShareWD: "On" | "Off";
- LoadWD: "On" | "Off";
- State: "On" | "Off";
- Owner: string;
- VTeam: string;
- VTeamRole: string;
-}
-interface MeOp {
- ID: string;
-}
-export default class WasabeeMe {
- GoogleID: string;
- name: string;
- vname: string;
- rocksname: string;
- intelname: string;
- level: number;
- Teams: Array;
- Ops: Array;
- fetched: number;
- Vverified: boolean;
- blacklisted: boolean;
- enlid: string;
- pic: string;
- intelfaction: string;
- querytoken: string;
- _teamMap: Map;
- constructor(data: any);
- static maxCacheAge(): number;
- toJSON(): this;
- store(): void;
- remove(): void;
- static localGet(): WasabeeMe;
- static isLoggedIn(): boolean;
- static cacheGet(): WasabeeMe;
- static waitGet(force?: boolean): Promise;
- static purge(): Promise;
- teamJoined(teamID: any): boolean;
- teamEnabled(teamID: any): boolean;
- makeTeamMap(): void;
-}
-export {};
diff --git a/src/code/model/me.js b/src/code/model/me.ts
similarity index 85%
rename from src/code/model/me.js
rename to src/code/model/me.ts
index 15d028bd8..00fdc2d9d 100644
--- a/src/code/model/me.js
+++ b/src/code/model/me.ts
@@ -3,7 +3,43 @@ import db from "../db";
import { constants } from "../static";
+export interface MeTeam {
+ ID: string,
+ Name: string,
+ RocksComm: string,
+ RocksKey: string,
+ JoinLinkToken: string,
+ ShareWD: "On" | "Off",
+ LoadWD: "On" | "Off",
+ State: "On" | "Off",
+ Owner: string,
+ VTeam: string,
+ VTeamRole: string,
+}
+
+interface MeOp {
+ ID: string,
+}
+
export default class WasabeeMe {
+ GoogleID: string;
+ name: string;
+ vname: string;
+ rocksname: string;
+ intelname: string;
+ level: number;
+ Teams: Array;
+ Ops: Array;
+ fetched: number;
+ Vverified: boolean;
+ blacklisted: boolean;
+ enlid: string;
+ pic: string;
+ intelfaction: string;
+ querytoken: string;
+
+ _teamMap: Map;
+
constructor(data) {
if (typeof data == "string") {
try {
@@ -100,7 +136,7 @@ export default class WasabeeMe {
}
// use waitGet with "force == true" if you want a fresh value now
- static async waitGet(force) {
+ static async waitGet(force?: boolean) {
let me = WasabeeMe.localGet();
if (
From 2dac6375811423f3a69b31388c3aa2e8d1b06e72 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Wed, 10 Nov 2021 23:16:42 +0100
Subject: [PATCH 094/275] operation.ts
---
src/code/model/operation.d.ts | 202 -------------
src/code/model/{operation.js => operation.ts} | 279 ++++++++++++------
2 files changed, 182 insertions(+), 299 deletions(-)
delete mode 100644 src/code/model/operation.d.ts
rename src/code/model/{operation.js => operation.ts} (87%)
diff --git a/src/code/model/operation.d.ts b/src/code/model/operation.d.ts
deleted file mode 100644
index ddde21a5b..000000000
--- a/src/code/model/operation.d.ts
+++ /dev/null
@@ -1,202 +0,0 @@
-import * as L from "leaflet";
-import WasabeeLink from "./link";
-import WasabeePortal from "./portal";
-import WasabeeMarker from "./marker";
-import WasabeeZone from "./zone";
-import Evented from "./evented";
-export declare type KeyOnHand = {
- portalId: PortalID;
- gid: GoogleID;
- capsule: string;
- onhand: number;
-};
-export declare type OpPermItem = {
- role: "read" | "write" | "assignonly";
- teamid: string;
- zone: number;
-};
-interface IOperation {
- ID: OpID;
- name: string;
- creator: string | GoogleID;
- opportals: WasabeePortal[];
- anchors: string[];
- links: WasabeeLink[];
- markers: WasabeeMarker[];
- color: string;
- comment: string;
- zones: WasabeeZone[];
- referencetime: string;
-}
-export interface IServerOp extends IOperation {
- creator: GoogleID;
- teamlist: OpPermItem[];
- keysonhand: KeyOnHand[];
- lasteditid: string;
- fetched: string;
- modified: string;
-}
-export interface ILocalOp extends IOperation {
- teamlist: OpPermItem[];
- keysonhand: KeyOnHand[];
- lasteditid: string;
- fetched: string;
- fetchedOp: string;
- server: string;
- localchanged: boolean;
- remoteChanged: boolean;
- background: boolean;
- stored: number;
-}
-export default class WasabeeOp extends Evented implements IOperation {
- ID: string;
- name: string;
- creator: string;
- anchors: string[];
- links: WasabeeLink[];
- markers: WasabeeMarker[];
- color: string;
- comment: string;
- zones: WasabeeZone[];
- referencetime: string;
- teamlist: OpPermItem[];
- keysonhand: KeyOnHand[];
- lasteditid: string;
- fetched: string;
- fetchedOp: string;
- localchanged: boolean;
- remoteChanged: boolean;
- server: string;
- blockers: WasabeeLink[];
- background: boolean;
- stored: number;
- _idToOpportals: Map;
- _coordsToOpportals: Map;
- _dirtyCoordsTable: boolean;
- _batchmode: boolean;
- constructor(obj: any);
- static load(opID: any): Promise;
- static delete(opID: any): Promise;
- static migrate(opID: any): Promise;
- store(): Promise;
- toJSON(): IOperation;
- toExport(): string;
- get opportals(): WasabeePortal[];
- buildCoordsLookupTable(): void;
- getColor(): string;
- containsPortal(portal: any): boolean;
- getPortalByLatLng(lat: any, lng: any): WasabeePortal;
- containsLinkFromTo(fromPortalId: any, toPortalId: any): boolean;
- containsLink(link: any): boolean;
- containsMarker(portal: any, markerType: any): boolean;
- containsMarkerByID(portalID: any, markerType: any): boolean;
- getPortalMarkers(portal: any): Map;
- getLinkByPortalIDs(portalId1: any, portalId2: any): WasabeeLink;
- getLink(portal1: any, portal2: any): WasabeeLink;
- getLinkListFromPortal(portal: any): WasabeeLink[];
- getPortal(portalID: any): WasabeePortal;
- getMarker(markerID: any): WasabeeMarker;
- removeAnchor(portalId: any): void;
- removeMarker(marker: any): void;
- setMarkerComment(marker: any, comment: any): void;
- setMarkerState(markerID: any, state: any): void;
- setLinkComment(link: any, comment: any): void;
- setLinkState(linkID: any, state: any): void;
- setLinkColor(linkID: any, color: any): void;
- setLinkOrder(linkID: any, order: any): void;
- setMarkerOrder(markerID: any, order: any): void;
- setPortalComment(portal: any, comment: any): void;
- setPortalHardness(portal: any, hardness: any): void;
- removeLink(startPortal: any, endPortal: any): void;
- reverseLink(startPortalID: any, endPortalID: any): void;
- cleanAll(): void;
- cleanAnchorList(): void;
- cleanPortalList(): void;
- addPortal(portal: any): void;
- _addPortal(portal: any): boolean;
- updatePortal(portal: any): boolean;
- _updatePortal(portal: any): boolean;
- addLink(fromPortal: WasabeePortal, toPortal: WasabeePortal, options?: {
- description?: string;
- order?: number;
- color?: string;
- replace?: boolean;
- }): WasabeeLink;
- containsAnchor(portalId: string): boolean;
- addAnchor(portal: WasabeePortal): void;
- get fakedPortals(): WasabeePortal[];
- _swapPortal(originalPortal: WasabeePortal, newPortal: WasabeePortal): void;
- swapPortal(originalPortal: WasabeePortal, newPortal: WasabeePortal): void;
- addMarker(markerType: string, portal: WasabeePortal, options: any): boolean;
- assignMarker(id: any, gid: any): void;
- assignLink(id: any, gid: any): void;
- clearAllItems(): void;
- clearAllLinks(): void;
- clearAllMarkers(): void;
- update(updateLocalchanged?: boolean): void;
- updateBlockers(): void;
- startBatchMode(): void;
- endBatchMode(): void;
- convertLinksToObjs(links: any): any[];
- convertMarkersToObjs(markers: any): any[];
- convertPortalsToObjs(portals: any): any[];
- convertZonesToObjs(zones: any): any[];
- get mbr(): L.LatLngBounds;
- canWriteServer(): boolean;
- canWrite(): boolean;
- getPermission(): "write" | "read" | "assignonly";
- isOnCurrentServer(): boolean;
- isServerOp(): boolean;
- isOwnedOp(): boolean;
- get nextOrder(): number;
- keyOnHand(portalId: any, gid: any, onhand: any, capsule: any): void;
- KeysOnHandForPortal(portalId: any): number;
- KeysRequiredForPortal(portalId: any): number;
- zoneName(zoneID: any): any;
- setZone(thing: any, zoneID: any): void;
- removeZone(zoneID: any): void;
- removeZonePoints(zoneID: any): void;
- renameZone(zoneID: any, name: any): void;
- addZone(): number;
- addZonePoint(zoneID: number, latlng: L.LatLng): void;
- changes(origin?: WasabeeOp): {
- addition: any[];
- edition: any[];
- deletion: any[];
- name: any;
- color: any;
- comment: any;
- };
- checkChanges(): boolean;
- mergeZones(op: any): number;
- applyChanges(changes: any, op: any): {
- compatibility: {
- ok: boolean;
- rewrite: {
- link: number;
- marker: number;
- };
- };
- addition: {
- link: number;
- marker: number;
- zone: number;
- ignored: number;
- };
- deletion: {
- link: number;
- marker: number;
- };
- edition: {
- portal: number;
- link: number;
- marker: number;
- assignment: number;
- duplicate: number;
- singlePortalLink: number;
- removed: number;
- };
- };
- determineZone(latlng: any): number;
-}
-export { };
diff --git a/src/code/model/operation.js b/src/code/model/operation.ts
similarity index 87%
rename from src/code/model/operation.js
rename to src/code/model/operation.ts
index 3a6b31007..e11d6d3bb 100644
--- a/src/code/model/operation.js
+++ b/src/code/model/operation.ts
@@ -11,8 +11,88 @@ import db from "../db";
// 0.20->0.21 blocker migration
import WasabeeBlocker from "./blocker";
+import type Task from "./task";
+import type { LatLngExpression } from "leaflet";
+
+export type KeyOnHand = {
+ portalId: string;
+ gid: string;
+ capsule: string;
+ onhand: number;
+};
+
+export type OpPermItem = {
+ role: "read" | "write" | "assignonly";
+ teamid: string;
+ zone: number;
+};
+
+interface IOperation {
+ ID: OpID;
+ name: string;
+ creator: string | GoogleID;
+ opportals: WasabeePortal[];
+ anchors: string[];
+ links: WasabeeLink[];
+ markers: WasabeeMarker[];
+ color: string;
+ comment: string;
+ zones: WasabeeZone[];
+ referencetime: string;
+}
+
+export interface IServerOp extends IOperation {
+ creator: GoogleID;
+ teamlist: OpPermItem[];
+ keysonhand: KeyOnHand[];
+ lasteditid: string;
+ fetched: string;
+ modified: string;
+}
+
+export interface ILocalOp extends IOperation {
+ teamlist: OpPermItem[];
+ keysonhand: KeyOnHand[];
+ lasteditid: string;
+ fetched: string;
+ fetchedOp: string;
+ server: string;
+ localchanged: boolean;
+ remoteChanged: boolean;
+ background: boolean;
+ stored: number;
+}
+
+export default class WasabeeOp extends Evented implements IOperation {
+ ID: string;
+ name: string;
+ creator: string;
+ anchors: Array;
+ links: Array;
+ markers: Array;
+ color: string;
+ comment: string;
+ teamlist: Array;
+ fetched: string;
+ stored: number;
+ localchanged: boolean;
+ blockers: Array;
+ keysonhand: Array;
+ zones: Array;
+
+ referencetime: string;
+ lasteditid: string;
+ remoteChanged: boolean;
+ server: string;
+ fetchedOp: string;
+ background: boolean;
+
+ _idToOpportals: Map;
+ _coordsToOpportals: Map;
+
+ _dirtyCoordsTable: boolean = false;
+ _batchmode: boolean = false;
-export default class WasabeeOp extends Evented {
constructor(obj) {
super();
if (typeof obj == "string") {
@@ -74,7 +154,7 @@ export default class WasabeeOp extends Evented {
this.cleanPortalList();
}
- static async load(opID) {
+ static async load(opID: OpID) {
try {
const raw = await (await db).get("operations", opID);
if (raw == null)
@@ -89,12 +169,12 @@ export default class WasabeeOp extends Evented {
return null;
}
- static async delete(opID) {
+ static async delete(opID: OpID) {
delete localStorage[opID]; // leave for now
await (await db).delete("operations", opID);
}
- static async migrate(opID) {
+ static async migrate(opID: OpID) {
// skip ones already completed
const have = await (await db).get("operations", opID);
if (have != null) {
@@ -155,7 +235,7 @@ export default class WasabeeOp extends Evented {
}
// build object to serialize, shallow copy, local-only values excluded
- toJSON() {
+ toJSON(): any {
return {
ID: this.ID,
name: this.name,
@@ -248,19 +328,19 @@ export default class WasabeeOp extends Evented {
}
}
- containsPortal(portal) {
+ containsPortal(portal: WasabeePortal) {
return this._idToOpportals.has(portal.id);
}
// assume lat and lng are strings from .toFixed(6)
- getPortalByLatLng(lat, lng) {
+ getPortalByLatLng(lat: string, lng: string) {
if (this._dirtyCoordsTable) {
this.buildCoordsLookupTable();
}
return this._coordsToOpportals.get(lat + "/" + lng);
}
- containsLinkFromTo(fromPortalId, toPortalId) {
+ containsLinkFromTo(fromPortalId: PortalID, toPortalId: PortalID) {
if (this.links.length == 0) return false;
for (const l of this.links) {
@@ -274,15 +354,15 @@ export default class WasabeeOp extends Evented {
return false;
}
- containsLink(link) {
+ containsLink(link: WasabeeLink) {
return this.containsLinkFromTo(link.fromPortalId, link.toPortalId);
}
- containsMarker(portal, markerType) {
+ containsMarker(portal: WasabeePortal, markerType: string) {
return this.containsMarkerByID(portal.id, markerType);
}
- containsMarkerByID(portalID, markerType) {
+ containsMarkerByID(portalID: PortalID, markerType: string) {
if (this.markers.length == 0) return false;
for (const m of this.markers) {
if (m.portalId == portalID && m.type == markerType) {
@@ -292,8 +372,8 @@ export default class WasabeeOp extends Evented {
return false;
}
- getPortalMarkers(portal) {
- const markers = new Map();
+ getPortalMarkers(portal: WasabeePortal) {
+ const markers = new Map();
if (!portal) return markers;
for (const m of this.markers) {
if (m.portalId == portal.id) {
@@ -303,7 +383,7 @@ export default class WasabeeOp extends Evented {
return markers;
}
- getLinkByPortalIDs(portalId1, portalId2) {
+ getLinkByPortalIDs(portalId1: PortalID, portalId2: PortalID) {
for (const l of this.links) {
if (
(l.fromPortalId == portalId1 && l.toPortalId == portalId2) ||
@@ -315,11 +395,11 @@ export default class WasabeeOp extends Evented {
return null;
}
- getLink(portal1, portal2) {
+ getLink(portal1: WasabeePortal, portal2: WasabeePortal) {
return this.getLinkByPortalIDs(portal1.id, portal2.id);
}
- getLinkListFromPortal(portal) {
+ getLinkListFromPortal(portal: WasabeePortal) {
const links = this.links.filter(function (listLink) {
return (
listLink.fromPortalId == portal.id || listLink.toPortalId == portal.id
@@ -328,11 +408,11 @@ export default class WasabeeOp extends Evented {
return links;
}
- getPortal(portalID) {
+ getPortal(portalID: PortalID) {
return this._idToOpportals.get(portalID);
}
- getMarker(markerID) {
+ getMarker(markerID: MarkerID) {
for (const m of this.markers) {
if (m.ID == markerID) {
return m;
@@ -341,7 +421,7 @@ export default class WasabeeOp extends Evented {
return null;
}
- removeAnchor(portalId) {
+ removeAnchor(portalId: PortalID) {
this.anchors = this.anchors.filter(function (anchor) {
return anchor !== portalId;
});
@@ -357,7 +437,7 @@ export default class WasabeeOp extends Evented {
this.updateBlockers();
}
- removeMarker(marker) {
+ removeMarker(marker: WasabeeMarker) {
this.markers = this.markers.filter(function (listMarker) {
return listMarker.ID !== marker.ID;
});
@@ -366,7 +446,7 @@ export default class WasabeeOp extends Evented {
this.updateBlockers();
}
- setMarkerComment(marker, comment) {
+ setMarkerComment(marker: WasabeeMarker, comment: string) {
for (const v of this.markers) {
if (v.ID == marker.ID) {
v.comment = comment;
@@ -375,7 +455,7 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- setMarkerState(markerID, state) {
+ setMarkerState(markerID: MarkerID, state: Task["state"]) {
for (const v of this.markers) {
if (v.ID == markerID) {
// validation happens in the marker class
@@ -385,16 +465,16 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- setLinkComment(link, comment) {
+ setLinkComment(link: WasabeeLink, comment: string) {
for (const v of this.links) {
if (v.ID == link.ID) {
- v.description = comment;
+ v.comment = comment;
}
}
this.update(true);
}
- setLinkState(linkID, state) {
+ setLinkState(linkID: LinkID, state: Task["state"]) {
for (const v of this.links) {
if (v.ID == linkID) {
v.state = state;
@@ -403,7 +483,7 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- setLinkColor(linkID, color) {
+ setLinkColor(linkID: LinkID, color: string) {
for (const v of this.links) {
if (v.ID == linkID) {
v.color = color;
@@ -412,7 +492,7 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- setLinkOrder(linkID, order) {
+ setLinkOrder(linkID: LinkID, order: string | number) {
for (const v of this.links) {
if (v.ID == linkID) {
v.setOrder(order);
@@ -421,7 +501,7 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- setMarkerOrder(markerID, order) {
+ setMarkerOrder(markerID: MarkerID, order: string | number) {
for (const v of this.markers) {
if (v.ID == markerID) {
v.setOrder(order);
@@ -430,7 +510,7 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- setPortalComment(portal, comment) {
+ setPortalComment(portal: WasabeePortal, comment: string) {
const p = this.getPortal(portal.id);
if (p) {
p.comment = comment;
@@ -438,7 +518,7 @@ export default class WasabeeOp extends Evented {
}
}
- setPortalHardness(portal, hardness) {
+ setPortalHardness(portal: WasabeePortal, hardness: string) {
const p = this.getPortal(portal.id);
if (p) {
p.hardness = hardness;
@@ -447,7 +527,7 @@ export default class WasabeeOp extends Evented {
}
//Passed in are the start, end, and portal the link is being removed from(so the other portal can be removed if no more links exist to it)
- removeLink(startPortal, endPortal) {
+ removeLink(startPortal: PortalID, endPortal: PortalID) {
const newLinks = [];
for (const l of this.links) {
if (!(l.fromPortalId == startPortal && l.toPortalId == endPortal)) {
@@ -461,7 +541,7 @@ export default class WasabeeOp extends Evented {
this.updateBlockers();
}
- reverseLink(startPortalID, endPortalID) {
+ reverseLink(startPortalID: PortalID, endPortalID: PortalID) {
const newLinks = [];
for (const l of this.links) {
if (l.fromPortalId == startPortalID && l.toPortalId == endPortalID) {
@@ -480,11 +560,7 @@ export default class WasabeeOp extends Evented {
this.cleanCaches();
}
- cleanCaches() {
- for (const l of this.links) {
- delete l._crosslinksGL;
- }
- }
+ cleanCaches() {}
cleanAnchorList() {
const newAnchorList = [];
@@ -499,7 +575,7 @@ export default class WasabeeOp extends Evented {
//This removes opportals with no links and removes duplicates
cleanPortalList() {
- const newPortals = new Map();
+ const newPortals = new Map();
for (const l of this.links) {
newPortals.set(l.fromPortalId, this._idToOpportals.get(l.fromPortalId));
newPortals.set(l.toPortalId, this._idToOpportals.get(l.toPortalId));
@@ -512,7 +588,7 @@ export default class WasabeeOp extends Evented {
}
// sanitize OP if it get corrupt by my code elsewhere...
- const missingPortal = new Set();
+ const missingPortal = new Set();
let corrupt = this.links.length + this.markers.length;
for (const [id, v] of newPortals) {
if (v === undefined) {
@@ -537,13 +613,13 @@ export default class WasabeeOp extends Evented {
this.buildCoordsLookupTable();
}
- addPortal(portal) {
+ addPortal(portal: WasabeePortal) {
if (!this.updatePortal(portal) && this._addPortal(portal)) {
this.update(false); // adding a portal may just be due to a blocker
}
}
- _addPortal(portal) {
+ _addPortal(portal: WasabeePortal) {
if (!this.containsPortal(portal)) {
const key = portal.lat + "/" + portal.lng;
if (this._coordsToOpportals.has(key)) {
@@ -566,7 +642,7 @@ export default class WasabeeOp extends Evented {
return false;
}
- updatePortal(portal) {
+ updatePortal(portal: WasabeePortal) {
if (this._updatePortal(portal)) {
this.update(true);
return true;
@@ -576,7 +652,7 @@ export default class WasabeeOp extends Evented {
// update portal silently if one with mathching ID or with matching position
// return true if this update a portal data
- _updatePortal(portal) {
+ _updatePortal(portal: WasabeePortal) {
const old = this.getPortal(portal.id);
if (old) {
if (!portal.faked) {
@@ -635,7 +711,16 @@ export default class WasabeeOp extends Evented {
}
// options: {description,order,color,replace}
- addLink(fromPortal, toPortal, options = {}) {
+ addLink(
+ fromPortal: WasabeePortal,
+ toPortal: WasabeePortal,
+ options: {
+ description?: string;
+ order?: number;
+ color?: string;
+ replace?: boolean;
+ } = {}
+ ) {
console.assert(fromPortal && toPortal, "missing portal for link");
if (fromPortal.id === toPortal.id) {
console.debug(
@@ -652,14 +737,11 @@ export default class WasabeeOp extends Evented {
const link =
existingLink && options.replace
? existingLink
- : new WasabeeLink(
- {
- fromPortalId: fromPortal.id,
- toPortalId: toPortal.id,
- },
- this
- );
- if (options.description) link.description = options.description;
+ : new WasabeeLink({
+ fromPortalId: fromPortal.id,
+ toPortalId: toPortal.id,
+ });
+ if (options.description) link.comment = options.description;
if (options.order) link.setOrder(options.order);
if (options.color) link.color = options.color;
@@ -679,7 +761,7 @@ export default class WasabeeOp extends Evented {
return link;
}
- containsAnchor(portalId) {
+ containsAnchor(portalId: string) {
if (this.anchors.length == 0) return false;
for (const a of this.anchors) {
if (a == portalId) {
@@ -689,7 +771,7 @@ export default class WasabeeOp extends Evented {
return false;
}
- addAnchor(portal) {
+ addAnchor(portal: WasabeePortal) {
// doing this ourselves saves a trip to update();
this._addPortal(portal);
if (!this.containsAnchor(portal.id)) {
@@ -703,7 +785,7 @@ export default class WasabeeOp extends Evented {
}
// silently swap two anchors
- _swapPortal(originalPortal, newPortal) {
+ _swapPortal(originalPortal: WasabeePortal, newPortal: WasabeePortal) {
this.anchors = this.anchors.filter(function (listAnchor) {
return listAnchor !== originalPortal.id;
});
@@ -711,11 +793,6 @@ export default class WasabeeOp extends Evented {
const linksToRemove = [];
for (const l of this.links) {
- // purge any crosslink check cache
- if (l._crosslinksGL) {
- delete l._crosslinksGL;
- }
-
if (l.fromPortalId == originalPortal.id) {
if (l.toPortalId === newPortal.id) {
console.debug(
@@ -752,14 +829,14 @@ export default class WasabeeOp extends Evented {
);
}
- swapPortal(originalPortal, newPortal) {
+ swapPortal(originalPortal: WasabeePortal, newPortal: WasabeePortal) {
this._addPortal(newPortal);
this._swapPortal(originalPortal, newPortal);
this.update(true);
this.updateBlockers();
}
- addMarker(markerType, portal, options) {
+ addMarker(markerType: string, portal: WasabeePortal, options) {
if (!portal) return false;
if (this.containsMarker(portal, markerType)) return false;
// save a trip to update()
@@ -781,7 +858,7 @@ export default class WasabeeOp extends Evented {
return true;
}
- assignMarker(id, gid) {
+ assignMarker(id: MarkerID, gid: GoogleID) {
for (const v of this.markers) {
if (v.ID == id) {
v.assign(gid);
@@ -790,7 +867,7 @@ export default class WasabeeOp extends Evented {
}
}
- assignLink(id, gid) {
+ assignLink(id: LinkID, gid: GoogleID) {
for (const v of this.links) {
if (v.ID == id) {
v.assign(gid);
@@ -800,9 +877,9 @@ export default class WasabeeOp extends Evented {
}
clearAllItems() {
- this.anchors = Array();
- this.links = Array();
- this.markers = Array();
+ this.anchors = [];
+ this.links = [];
+ this.markers = [];
this._idToOpportals.clear();
this._coordsToOpportals.clear();
@@ -810,14 +887,14 @@ export default class WasabeeOp extends Evented {
}
clearAllLinks() {
- this.links = Array();
+ this.links = [];
this.cleanAnchorList();
this.cleanPortalList();
this.update(true);
}
clearAllMarkers() {
- this.markers = Array();
+ this.markers = [];
this.cleanPortalList();
this.update(true);
}
@@ -850,16 +927,16 @@ export default class WasabeeOp extends Evented {
this.updateBlockers();
}
- convertLinksToObjs(links) {
+ convertLinksToObjs(links: any[]) {
const tmpLinks = new Array();
if (!links || links.length == 0) return tmpLinks;
for (const l of links) {
- tmpLinks.push(new WasabeeLink(l, this));
+ tmpLinks.push(new WasabeeLink(l));
}
return tmpLinks;
}
- convertMarkersToObjs(markers) {
+ convertMarkersToObjs(markers: any[]) {
const tmpMarkers = new Array();
if (!markers || markers.length == 0) return tmpMarkers;
if (markers) {
@@ -870,7 +947,7 @@ export default class WasabeeOp extends Evented {
return tmpMarkers;
}
- convertPortalsToObjs(portals) {
+ convertPortalsToObjs(portals: any[]) {
const tmpPortals = Array();
if (!portals || portals.length == 0) return tmpPortals;
for (const p of portals) {
@@ -884,7 +961,7 @@ export default class WasabeeOp extends Evented {
return tmpPortals;
}
- convertZonesToObjs(zones) {
+ convertZonesToObjs(zones: any[]) {
if (!zones || zones.length == 0) {
// if not set, use the defaults
return [
@@ -1018,7 +1095,12 @@ export default class WasabeeOp extends Evented {
// this is only for local display if FireBase doesn't trigger a refresh
// KOH always takes place on the server because non-write-access
// agents need to make changes & sync
- keyOnHand(portalId, gid, onhand, capsule) {
+ keyOnHand(
+ portalId: PortalID,
+ gid: GoogleID,
+ onhand: number,
+ capsule: string
+ ) {
if (typeof onhand == "string") {
onhand = Number.parseInt(onhand, 10);
}
@@ -1037,7 +1119,7 @@ export default class WasabeeOp extends Evented {
}
}
- const k = {
+ const k: KeyOnHand = {
portalId: portalId,
gid: gid,
onhand: onhand,
@@ -1047,27 +1129,20 @@ export default class WasabeeOp extends Evented {
this.update(false);
}
- KeysOnHandForPortal(portalId) {
+ KeysOnHandForPortal(portalId: PortalID) {
let i = 0;
for (const k of this.keysonhand) if (k.portalId == portalId) i += k.onhand;
return i;
}
- KeysRequiredForPortal(portalId) {
+ KeysRequiredForPortal(portalId: PortalID) {
let i = 0;
for (const l of this.links) if (l.toPortalId == portalId) i++;
return i;
}
- getZone(zoneID) {
- for (const z of this.zones) {
- if (z.id == zoneID) return z;
- }
- return null;
- }
-
- zoneName(zoneID) {
- if (zoneID == "0")
+ zoneName(zoneID: ZoneID) {
+ if (zoneID == 0)
// All zone
return "All";
for (const z of this.zones) {
@@ -1076,13 +1151,20 @@ export default class WasabeeOp extends Evented {
return zoneID;
}
+ getZone(zoneID: ZoneID) {
+ for (const z of this.zones) {
+ if (z.id == zoneID) return z;
+ }
+ return null;
+ }
+
// a wrapper to set WasabeePortal or WasabeeLink zone and update
- setZone(thing, zoneID) {
+ setZone(thing: Task, zoneID: ZoneID) {
thing.zone = Number(zoneID);
this.update(true);
}
- removeZone(zoneID) {
+ removeZone(zoneID: ZoneID) {
if (zoneID == 1) {
console.log("cannot remove zone 1");
return;
@@ -1099,7 +1181,7 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- removeZonePoints(zoneID) {
+ removeZonePoints(zoneID: ZoneID) {
for (const z of this.zones) {
if (z.id == zoneID) {
z.points = [];
@@ -1108,7 +1190,7 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- renameZone(zoneID, name) {
+ renameZone(zoneID: ZoneID, name: string) {
for (const z of this.zones) {
if (z.id == zoneID) {
z.name = name;
@@ -1119,7 +1201,7 @@ export default class WasabeeOp extends Evented {
}
addZone() {
- const ids = new Set();
+ const ids = new Set();
for (const z of this.zones) {
ids.add(z.id);
}
@@ -1129,7 +1211,7 @@ export default class WasabeeOp extends Evented {
return newid;
}
- addZonePoint(zoneID, latlng) {
+ addZonePoint(zoneID: number, latlng: L.LatLng) {
for (const z of this.zones) {
if (z.id == zoneID) {
z.points.push({
@@ -1143,11 +1225,14 @@ export default class WasabeeOp extends Evented {
this.update(true);
}
- changes(origin) {
+ changes(origin?: WasabeeOp) {
const changes = {
addition: new Array(),
edition: new Array(),
deletion: new Array(),
+ name: null,
+ color: null,
+ comment: null,
};
// empty op if old OP (or local OP)
const oldOp = new WasabeeOp(origin ? origin : this.fetchedOp || {});
@@ -1246,7 +1331,7 @@ export default class WasabeeOp extends Evented {
return this.localchanged;
}
- mergeZones(op) {
+ mergeZones(op: WasabeeOp) {
const ids = new Set();
let count = 0;
for (const z of this.zones) {
@@ -1262,7 +1347,7 @@ export default class WasabeeOp extends Evented {
}
// assume that `this` is a server OP (teams/keys are correct)
- applyChanges(changes, op) {
+ applyChanges(changes, op: WasabeeOp) {
const summary = {
compatibility: {
ok: true,
@@ -1461,7 +1546,7 @@ export default class WasabeeOp extends Evented {
return summary;
}
- determineZone(latlng) {
+ determineZone(latlng: { lat: number; lng: number }) {
// sort first, lowest ID wins if a marker is in 2 overlapping zones
this.zones.sort((a, b) => {
return a.id - b.id;
From 7c8a8408861506d1330a8281befd80e5960da7d1 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 11 Nov 2021 10:10:26 +0100
Subject: [PATCH 095/275] fix some types
---
src/code/global.d.ts | 14 ++++++++++++++
src/code/model/index.d.ts | 10 ----------
src/code/ui/zone.js | 2 +-
src/types/leafletExtentions/index.d.ts | 22 ++++++++++++++++++++++
4 files changed, 37 insertions(+), 11 deletions(-)
create mode 100644 src/code/global.d.ts
delete mode 100644 src/code/model/index.d.ts
diff --git a/src/code/global.d.ts b/src/code/global.d.ts
new file mode 100644
index 000000000..1bc7a680a
--- /dev/null
+++ b/src/code/global.d.ts
@@ -0,0 +1,14 @@
+declare module "*.css" {
+ const content: string;
+ export default content;
+}
+
+declare module "*.json" {
+ const content: any;
+ export default content;
+}
+
+declare module "*.svg" {
+ const content: string;
+ export default content;
+}
diff --git a/src/code/model/index.d.ts b/src/code/model/index.d.ts
deleted file mode 100644
index a1fa7fb2a..000000000
--- a/src/code/model/index.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
diff --git a/src/code/ui/zone.js b/src/code/ui/zone.js
index 7184d5faa..a74c60d7e 100644
--- a/src/code/ui/zone.js
+++ b/src/code/ui/zone.js
@@ -12,7 +12,7 @@ const WLZone = L.LayerGroup.extend({
let layer;
if (zone.points.length == 1)
layer = L.marker(zone.points[0], {
- icon: L.divIcon.coloredSvg(zone.color),
+ icon: new L.DivIcon.ColoredSvg(zone.color),
});
else if (zone.points.length == 2)
layer = L.polyline(zone.points, { color: zone.color });
diff --git a/src/types/leafletExtentions/index.d.ts b/src/types/leafletExtentions/index.d.ts
index d74861522..272eb58f3 100755
--- a/src/types/leafletExtentions/index.d.ts
+++ b/src/types/leafletExtentions/index.d.ts
@@ -21,6 +21,22 @@ declare module "leaflet" {
// tslint:disable-next-line:no-empty-interface
class GeodesicCircle extends Polyline { }
+ interface Polyline {
+ initialize: typeof L.Polyline.prototype.constructor;
+ }
+ interface Marker {
+ initialize: typeof L.Marker.prototype.constructor;
+ }
+ interface LayerGroup {
+ initialize: typeof L.LayerGroup.prototype.constructor;
+ }
+ interface Layer {
+ _popup: Popup;
+ }
+ interface Popup {
+ _wrapper: HTMLDivElement;
+ }
+
// extends PolynineOption to any prop
interface PolylineOptions {
/* guid: string */
@@ -36,4 +52,10 @@ declare module "leaflet" {
interface Marker {
update(): this;
}
+
+ namespace DivIcon {
+ class ColoredSvg extends DivIcon {
+ constructor(color: string, options?: MarkerOptions);
+ }
+ }
}
From 2fe05bfadda4984798ba4f8a2c5c69bbb288a154 Mon Sep 17 00:00:00 2001
From: LeJeu <64744459+le-jeu@users.noreply.github.com>
Date: Thu, 11 Nov 2021 11:43:39 +0100
Subject: [PATCH 096/275] server: promise returns object
---
src/code/dialogs/mergeDialog.js | 4 +-
src/code/model/agent.ts | 11 ++-
src/code/model/me.ts | 10 +--
src/code/model/operation.ts | 26 +++---
src/code/model/team.ts | 8 +-
src/code/server.d.ts | 135 +++++++++++++++++++-------------
src/code/server.js | 32 ++------
src/code/ui/agent.js | 32 +-------
src/code/wd.js | 3 +-
9 files changed, 118 insertions(+), 143 deletions(-)
diff --git a/src/code/dialogs/mergeDialog.js b/src/code/dialogs/mergeDialog.js
index 8633859ca..3f027807d 100644
--- a/src/code/dialogs/mergeDialog.js
+++ b/src/code/dialogs/mergeDialog.js
@@ -61,9 +61,7 @@ const MergeDialog = WDialog.extend({
const origin = new WasabeeOp(
// while merge should only occurs with server ops, it appears users succeed to merge
// with local ops. This is a failsafe for those edge-cases
- this.options.opOwn.fetchedOp
- ? this.options.opOwn.fetchedOp
- : this.options.opOwn.toExport()
+ this.options.opOwn.getFetchedOp() || this.options.opOwn.toExport()
);
const changes = this.options.opOwn.changes(origin);
const summary = this._opRebase.applyChanges(changes, this.options.opOwn);
diff --git a/src/code/model/agent.ts b/src/code/model/agent.ts
index b717240bf..dadf032fd 100644
--- a/src/code/model/agent.ts
+++ b/src/code/model/agent.ts
@@ -30,12 +30,11 @@ export default class WasabeeAgent {
constructor(obj) {
if (typeof obj == "string") {
- try {
- obj = JSON.parse(obj);
- } catch (e) {
- console.error(e);
- obj = {};
- }
+ console.trace('agent waits for an object');
+ obj = {
+ id: "00000",
+ name: 'invalid agent',
+ };
}
// console.debug("passed to constructor", obj);
diff --git a/src/code/model/me.ts b/src/code/model/me.ts
index 00fdc2d9d..eedf2cb73 100644
--- a/src/code/model/me.ts
+++ b/src/code/model/me.ts
@@ -42,12 +42,8 @@ export default class WasabeeMe {
constructor(data) {
if (typeof data == "string") {
- try {
- data = JSON.parse(data);
- } catch (e) {
- console.error(e);
- return null;
- }
+ console.trace('me waits for an object');
+ return null;
}
this.GoogleID = data.GoogleID;
this.name = data.name;
@@ -100,7 +96,7 @@ export default class WasabeeMe {
static localGet() {
const lsme = localStorage[constants.AGENT_INFO_KEY];
if (typeof lsme == "string") {
- return new WasabeeMe(lsme); // do not store
+ return new WasabeeMe(JSON.parse(lsme)); // do not store
}
return null;
}
diff --git a/src/code/model/operation.ts b/src/code/model/operation.ts
index e11d6d3bb..9b0353f44 100644
--- a/src/code/model/operation.ts
+++ b/src/code/model/operation.ts
@@ -12,7 +12,6 @@ import db from "../db";
// 0.20->0.21 blocker migration
import WasabeeBlocker from "./blocker";
import type Task from "./task";
-import type { LatLngExpression } from "leaflet";
export type KeyOnHand = {
portalId: string;
@@ -96,12 +95,8 @@ export default class WasabeeOp extends Evented implements IOperation {
constructor(obj) {
super();
if (typeof obj == "string") {
- try {
- obj = JSON.parse(obj);
- } catch (e) {
- console.error("corrupted operation", e);
- return null;
- }
+ console.trace("op waits for an object");
+ return null;
}
this.ID = obj.ID ? obj.ID : generateId();
@@ -254,12 +249,21 @@ export default class WasabeeOp extends Evented implements IOperation {
// JSON with everything optional removed -- inception grade logic here
toExport() {
// round-trip through JSON.stringify to ensure a deep copy
- const o = new WasabeeOp(JSON.stringify(this));
- // drop +0.21
- o.cleanPortalList(); // remove portals which are only relevant to blockers
+ const o = new WasabeeOp(JSON.parse(JSON.stringify(this)));
return JSON.stringify(o);
}
+ getFetchedOp() {
+ if (!this.fetchedOp) return null;
+ try {
+ const json = JSON.parse(this.fetchedOp);
+ return new WasabeeOp(json);
+ } catch (e) {
+ console.error("corrupted fetched op", e);
+ return null;
+ }
+ }
+
// read only (for inspection)
get opportals() {
return Array.from(this._idToOpportals.values());
@@ -1235,7 +1239,7 @@ export default class WasabeeOp extends Evented implements IOperation {
comment: null,
};
// empty op if old OP (or local OP)
- const oldOp = new WasabeeOp(origin ? origin : this.fetchedOp || {});
+ const oldOp = new WasabeeOp(origin ? origin : this.getFetchedOp() || {});
const oldLinks = new Map(oldOp.links.map((l) => [l.ID, l]));
const oldMarkers = new Map(oldOp.markers.map((m) => [m.ID, m]));
diff --git a/src/code/model/team.ts b/src/code/model/team.ts
index c4523b807..78583bfd3 100644
--- a/src/code/model/team.ts
+++ b/src/code/model/team.ts
@@ -16,12 +16,8 @@ export default class WasabeeTeam {
constructor(data) {
if (typeof data == "string") {
- try {
- data = JSON.parse(data);
- } catch (e) {
- console.error(e);
- return;
- }
+ console.trace("team waits for an object");
+ return;
}
let fromServer = false;
diff --git a/src/code/server.d.ts b/src/code/server.d.ts
index ad7e1ea57..f01f78cd3 100644
--- a/src/code/server.d.ts
+++ b/src/code/server.d.ts
@@ -3,66 +3,93 @@ import WasabeeMarker from "./model/marker";
import type WasabeeLink from "./model/link";
import type WasabeePortal from "./model/portal";
import type { WDKey } from "./wd";
-interface IServerUpdate {
- updateID?: string;
+import WasabeeMe from "./model/me";
+import WasabeeTeam from "./model/team";
+import WasabeeAgent from "./model/agent";
+
+interface IServerStatus {
+ status: string;
}
-export default function (): any;
-export declare function uploadOpPromise(): Promise;
-export declare function updateOpPromise(operation: WasabeeOp): Promise;
-export declare function deleteOpPromise(opID: OpID): Promise;
-export declare function statOpPromise(opID: OpID): Promise;
-export declare function teamPromise(teamid: TeamID): Promise;
+interface IServerUpdate extends IServerStatus {
+ updateID: string;
+}
+
+export default function (): string;
+export declare function GetWasabeeServer(): string;
+export declare function SetWasabeeServer(server: string): void;
+export declare function GetUpdateList(): any;
+
+declare function genericGet(url: string, formData: FormData | string, contentType?: string): Promise;
+declare function genericPost(url: string, formData: FormData | string, contentType?: string): Promise;
+declare function genericPut(url: string, formData: FormData | string, contentType?: string): Promise;
+declare function genericDelete(url: string, formData: FormData | string, contentType?: string): Promise;
+
+// query data
+export declare function mePromise(): Promise;
export declare function opPromise(opID: OpID): Promise;
-export declare function mePromise(): Promise;
-export declare function agentPromise(GID: GoogleID): Promise;
-export declare function assignMarkerPromise(opID: OpID, markerID: MarkerID, agentID: GoogleID): Promise;
-export declare function assignLinkPromise(opID: OpID, linkID: LinkID, agentID: GoogleID): Promise;
-export declare function targetPromise(agentID: GoogleID, portal: WasabeePortal, type?: string): Promise;
-export declare function routePromise(agentID: GoogleID, portal: WasabeePortal): Promise;
-export declare function SendAccessTokenAsync(accessToken: string): Promise;
-export declare function SetTeamState(teamID: TeamID, state: "On" | "Off"): Promise;
-export declare function SetTeamShareWD(teamID: TeamID, state: "On" | "Off"): Promise;
-export declare function SetTeamLoadWD(teamID: TeamID, state: "On" | "Off"): Promise;
-export declare function SetMarkerState(opID: OpID, markerID: MarkerID, state: string): Promise;
-export declare function SetLinkState(opID: OpID, linkID: LinkID, state: string): Promise;
-export declare function opKeyPromise(opID: OpID, portalID: PortalID, onhand: number, capsule: string): Promise;
-export declare function dKeyPromise(json: string): Promise;
-export declare function dKeyBulkPromise(json: string): Promise;
+export declare function teamPromise(teamid: TeamID): Promise;
+export declare function agentPromise(GID: GoogleID): Promise;
export declare function dKeylistPromise(): Promise<{
DefensiveKeys: WDKey[];
}>;
-export declare function locationPromise(lat: number, lng: number): Promise;
-export declare function logoutPromise(): Promise;
-export declare function addPermPromise(opID: OpID, teamID: TeamID, role: string, zone: ZoneID): Promise;
-export declare function delPermPromise(opID: OpID, teamID: TeamID, role: string, zone: ZoneID): Promise;
-export declare function leaveTeamPromise(teamID: TeamID): Promise;
-export declare function removeAgentFromTeamPromise(agentID: GoogleID, teamID: TeamID): Promise;
-export declare function setAgentTeamSquadPromise(agentID: GoogleID, teamID: TeamID, squad: string): Promise;
-export declare function addAgentToTeamPromise(agentID: GoogleID, teamID: TeamID): Promise;
-export declare function renameTeamPromise(teamID: TeamID, name: string): Promise;
-export declare function rocksPromise(teamID: TeamID, community: string, apikey: string): Promise;
-export declare function newTeamPromise(name: string): Promise;
-export declare function deleteTeamPromise(teamID: TeamID): Promise;
-export declare function oneTimeToken(token: string): Promise;
-export declare function GetWasabeeServer(): any;
-export declare function GetUpdateList(): any;
-export declare function SetWasabeeServer(server: string): void;
-export declare function sendTokenToWasabee(token: string): Promise;
-export declare function getCustomTokenFromServer(): Promise;
export declare function loadConfig(): Promise;
-export declare function changeTeamOwnerPromise(teamID: TeamID, newOwner: GoogleID): Promise;
export declare function createJoinLinkPromise(teamID: TeamID): Promise<{
Key: string;
}>;
-export declare function deleteJoinLinkPromise(teamID: TeamID): Promise;
-export declare function setAssignmentStatus(op: WasabeeOp, object: WasabeeLink | WasabeeMarker, completed: boolean): Promise;
-export declare function sendAnnounce(teamID: TeamID, message: string): Promise;
-export declare function pullRocks(teamID: TeamID): Promise;
-export declare function reverseLinkDirection(opID: OpID, linkID: LinkID): Promise;
-export declare function setOpInfo(opID: OpID, info: any): Promise;
-export declare function setMarkerComment(opID: OpID, markerID: MarkerID, comment: string): Promise;
-export declare function setLinkComment(opID: OpID, linkID: LinkID, desc: string): Promise;
-export declare function setLinkZone(opID: OpID, linkID: LinkID, zone: ZoneID): Promise;
-export declare function setMarkerZone(opID: OpID, markerID: MarkerID, zone: ZoneID): Promise;
-export declare function setIntelID(name: string, faction: string, querytoken: string): Promise;
-export { };
+
+// query action
+export declare function targetPromise(agentID: GoogleID, portal: WasabeePortal, type?: string): Promise;
+export declare function sendAnnounce(teamID: TeamID, message: string): Promise;
+export declare function pullRocks(teamID: TeamID): Promise;
+
+// special case
+export declare function uploadOpPromise(): Promise;
+export declare function updateOpPromise(operation: WasabeeOp): Promise;
+
+// login/out
+export declare function SendAccessTokenAsync(accessToken: string): Promise;
+export declare function logoutPromise(): Promise;
+export declare function oneTimeToken(token: string): Promise;
+export declare function sendTokenToWasabee(token: string): Promise;
+export declare function getCustomTokenFromServer(): Promise;
+// me
+export declare function leaveTeamPromise(teamID: TeamID): Promise;
+export declare function dKeyPromise(json: string): Promise;
+export declare function dKeyBulkPromise(json: string): Promise;
+export declare function locationPromise(lat: number, lng: number): Promise;
+export declare function setIntelID(name: string, faction: string, querytoken: string): Promise;
+export declare function SetTeamState(teamID: TeamID, state: "On" | "Off"): Promise;
+export declare function SetTeamShareWD(teamID: TeamID, state: "On" | "Off"): Promise;
+export declare function SetTeamLoadWD(teamID: TeamID, state: "On" | "Off"): Promise;
+
+// update data
+// team
+export declare function newTeamPromise(name: string): Promise;
+export declare function renameTeamPromise(teamID: TeamID, name: string): Promise;
+export declare function deleteTeamPromise(teamID: TeamID): Promise;
+export declare function changeTeamOwnerPromise(teamID: TeamID, newOwner: GoogleID): Promise