Created
April 10, 2019 12:21
-
-
Save dowmeister/50f0d95bdf001c9fe893af71d6d262b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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