kopia lustrzana https://gitlab.com/gridtracker.org/gridtracker
Visual alerts in own window
rodzic
545c44177e
commit
21ee54be69
|
@ -3078,26 +3078,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="alertsPopDiv" style="
|
||||
margin: 0 auto;
|
||||
top: 2px;
|
||||
min-height: 80px;
|
||||
max-height: 80%;
|
||||
left: 2px;
|
||||
display: none;
|
||||
background-color: white;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
position: absolute;
|
||||
z-index: 650;
|
||||
border: 3px groove red;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;" class="roundBorder">
|
||||
<div data-i18n="alertPopup.title" id="alertPopTextDiv"><b></b>New Alerts!!!</b></div>
|
||||
<div id="alertPopListDiv" style="margin: 2px; padding: 2px"></div>
|
||||
<div data-i18n="alertPopup.dismiss" class="button" onclick="ackAlerts();">DISMISS</div>
|
||||
</div>
|
||||
<div id="versionDiv" style="
|
||||
margin: 0 auto;
|
||||
left: 0;
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
<!--
|
||||
This file is part of GridTracker.
|
||||
|
||||
GridTracker is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
GridTracker is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GridTracker. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<html lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Alerts</title>
|
||||
<link rel="stylesheet" href="./lib/style.css" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
-webkit-appearance: none;
|
||||
-webkit-user-select: none;
|
||||
height: 98%;
|
||||
overflow: auto;
|
||||
}
|
||||
table,
|
||||
th,
|
||||
td,
|
||||
body {
|
||||
color: #fff;
|
||||
white-space: nowrap;
|
||||
font-family: Sans-Serif;
|
||||
font-size: 12px;
|
||||
text-align: auto;
|
||||
}
|
||||
</style>
|
||||
<script src="./lib/protos.js" type="text/javascript"></script>
|
||||
<script src="./lib/screens.js" type="text/javascript"></script>
|
||||
<script>
|
||||
document.addEventListener("contextmenu", function (ev) {
|
||||
if (process.versions["nw-flavor"] != "sdk") {
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="mainBody" onload="window.opener.GT.alertWindowInitialized = true">
|
||||
<div
|
||||
id="main"
|
||||
style="
|
||||
margin: 0;
|
||||
top: 0;
|
||||
min-height: 60px;
|
||||
width: auto;
|
||||
background-color: black;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
"
|
||||
>
|
||||
<div id="alertsPopDiv" style="
|
||||
background-color: rgb(0, 0, 0);
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
border: 3px groove red;"
|
||||
class="roundBorder">
|
||||
<div id="alertPopListDiv" style="margin: 2px; padding: 2px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -729,13 +729,12 @@ function speakAlertString(what, message, target)
|
|||
}
|
||||
}
|
||||
|
||||
GT.alertFlasher = null;
|
||||
|
||||
function unflashAlertPopUp()
|
||||
function displayAlertPopUp(what, message, target)
|
||||
{
|
||||
if (GT.alertWindowInitialized == false) return;
|
||||
|
||||
var worker = "";
|
||||
var acount = 0;
|
||||
alertsPopDiv.style.backgroundColor = "#000";
|
||||
|
||||
if (Object.keys(GT.alerts).length > 0)
|
||||
{
|
||||
|
@ -745,9 +744,7 @@ function unflashAlertPopUp()
|
|||
}
|
||||
|
||||
worker +=
|
||||
"<div style='padding-right:8px;overflow:auto;overflow-x:hidden;height:" +
|
||||
Math.min(acount * 24 + 23, 500) +
|
||||
"px;'>";
|
||||
"<div id='tableDiv' style='overflow:hidden;'>";
|
||||
|
||||
worker += "<table align='center' class='darkTable' >";
|
||||
|
||||
|
@ -804,25 +801,16 @@ function unflashAlertPopUp()
|
|||
worker += "</table>";
|
||||
worker += "</div>";
|
||||
}
|
||||
alertPopListDiv.style.height = "auto";
|
||||
alertPopListDiv.innerHTML = worker;
|
||||
GT.alertFlasher = null;
|
||||
}
|
||||
|
||||
function displayAlertPopUp(what, message, target)
|
||||
{
|
||||
if (GT.alertFlasher) nodeTimers.clearTimeout(GT.alertFlasher);
|
||||
GT.alertWindowHandle.window.alertPopListDiv.innerHTML = worker;
|
||||
|
||||
alertPopListDiv.innerHTML =
|
||||
"<font color='red'><h2>Gathering Alerts<h2></font>";
|
||||
alertsPopDiv.style.backgroundColor = "#FFF";
|
||||
alertsPopDiv.style.display = "inline-block";
|
||||
GT.alertFlasher = nodeTimers.setTimeout(unflashAlertPopUp, 100);
|
||||
GT.alertWindowHandle.width = parseInt(GT.alertWindowHandle.window.alertsPopDiv.offsetWidth) + 20;
|
||||
GT.alertWindowHandle.height = parseInt(GT.alertWindowHandle.window.alertsPopDiv.offsetHeight) + 44;
|
||||
openAlertWindow(true);
|
||||
}
|
||||
|
||||
function ackAlerts()
|
||||
{
|
||||
alertsPopDiv.style.display = "none";
|
||||
for (var key in GT.alerts)
|
||||
{
|
||||
GT.alerts[key].needAck = 0;
|
||||
|
|
|
@ -58,6 +58,8 @@ GT.lookupWindowHandle = null;
|
|||
GT.lookupWindowInitialized = false;
|
||||
GT.baWindowHandle = null;
|
||||
GT.baWindowInitialized = false;
|
||||
GT.alertWindowHandle = null;
|
||||
GT.alertWindowInitialized = false;
|
||||
GT.myDXGrid = "";
|
||||
GT.appSettings = {};
|
||||
GT.mapSettings = {};
|
||||
|
@ -273,6 +275,7 @@ function saveAndCloseApp()
|
|||
GT.callRosterWindowHandle.window.saveScreenSettings();
|
||||
GT.statsWindowHandle.window.saveScreenSettings();
|
||||
GT.baWindowHandle.window.saveScreenSettings();
|
||||
GT.alertWindowHandle.window.saveScreenSettings();
|
||||
GT.lookupWindowHandle.window.saveScreenSettings();
|
||||
GT.chatWindowHandle.window.saveScreenSettings();
|
||||
}
|
||||
|
@ -327,6 +330,9 @@ function saveAndCloseApp()
|
|||
GT.statsWindowHandle.window.close(true);
|
||||
GT.lookupWindowHandle.window.close(true);
|
||||
GT.baWindowHandle.window.close(true);
|
||||
GT.alertWindowHandle.window.isShowing = false;
|
||||
GT.alertWindowHandle.window.saveScreenSettings();
|
||||
GT.alertWindowHandle.window.close(true);
|
||||
GT.callRosterWindowHandle.window.close(true);
|
||||
}
|
||||
catch (e)
|
||||
|
@ -2844,17 +2850,12 @@ function onMyKeyDown(event)
|
|||
|
||||
if (event.keyCode == 27)
|
||||
{
|
||||
alertsPopDiv.style.display = "none";
|
||||
rootSettingsDiv.style.display = "none";
|
||||
|
||||
helpDiv.style.display = "none";
|
||||
GT.helpShow = false;
|
||||
}
|
||||
|
||||
if (
|
||||
alertsPopDiv.style.display == "none" &&
|
||||
rootSettingsDiv.style.display == "none"
|
||||
)
|
||||
if (rootSettingsDiv.style.display == "none")
|
||||
{
|
||||
if (event.code in GT.hotKeys)
|
||||
{
|
||||
|
@ -8763,6 +8764,63 @@ function openBaWindow(show = true)
|
|||
}
|
||||
}
|
||||
|
||||
function openAlertWindow(show = true)
|
||||
{
|
||||
if (GT.alertWindowHandle == null)
|
||||
{
|
||||
popupNewWindows();
|
||||
var gui = require("nw.gui");
|
||||
gui.Window.open(
|
||||
"gt_alert.html",
|
||||
{
|
||||
show: false,
|
||||
id: "GT-alert",
|
||||
always_on_top: true
|
||||
},
|
||||
function (new_win)
|
||||
{
|
||||
GT.alertWindowHandle = new_win;
|
||||
new_win.on("loaded", function ()
|
||||
{
|
||||
GT.alertWindowHandle.window.isShowing = false;
|
||||
GT.alertWindowHandle.window.saveScreenSettings();
|
||||
GT.alertWindowHandle.hide();
|
||||
});
|
||||
new_win.on("close", function ()
|
||||
{
|
||||
ackAlerts();
|
||||
GT.alertWindowHandle.window.isShowing = false;
|
||||
GT.alertWindowHandle.window.saveScreenSettings();
|
||||
GT.alertWindowHandle.hide();
|
||||
});
|
||||
}
|
||||
);
|
||||
lockNewWindows();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if (show == true)
|
||||
{
|
||||
GT.alertWindowHandle.show();
|
||||
GT.alertWindowHandle.window.isShowing = true;
|
||||
GT.alertWindowHandle.window.saveScreenSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
GT.alertWindowHandle.window.isShowing = false;
|
||||
GT.alertWindowHandle.window.saveScreenSettings();
|
||||
GT.alertWindowHandle.hide();
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function openLookupWindow(show = false)
|
||||
{
|
||||
if (GT.lookupWindowHandle == null)
|
||||
|
@ -13149,6 +13207,7 @@ function postInit()
|
|||
|
||||
openLookupWindow(false);
|
||||
openBaWindow(false);
|
||||
openAlertWindow(false);
|
||||
openCallRosterWindow(false);
|
||||
openConditionsWindow(false);
|
||||
showMessaging(false);
|
||||
|
|
Ładowanie…
Reference in New Issue