Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dowmeister/50f0d95bdf001c9fe893af71d6d262b7 to your computer and use it in GitHub Desktop.
Save dowmeister/50f0d95bdf001c9fe893af71d6d262b7 to your computer and use it in GitHub Desktop.
overwolf.windows.openAlert = function(content, autoCloseTimeout = 0) {
overwolf.windows.openWindow("Alert", function(res) {
overwolf.windows.getOpenWindows(function(openWindows) {
var window_id = res.window_id;
debugger;
var w = openWindows['Alert'];
//debugger;
overwolf.utils.getMonitorsList(function(monitors) {
var primaryMonitor = monitors.displays.find(d => {
return d.is_primary;
});
if (primaryMonitor != undefined) {
var x = primaryMonitor.width / 2 - 300;
var y = 10;
overwolf.windows.changePosition(window_id, x, y, function(ch) {
if (ch.status == "success") {
//setTimeout(function() {
w.document.getElementsByTagName("main")[0].innerHTML = content;
//}, 2*1000);
if (autoCloseTimeout != 0)
{
setTimeout(() => {
overwolf.windows.close(window_id);
}, autoCloseTimeout);
}
}
});
}
});
});
});
};
overwolf.windows.updateAlert = function(content) {
overwolf.windows.getWindow("Alert", function(w) {
if (w) w.document.getElementsByTagName("main")[0].innerHTML = content;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment