Add errDialog function

This commit is contained in:
calzoneman 2013-10-16 23:22:37 -05:00
parent f8fcc0d2d7
commit 152e46ab15
3 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,7 @@
Wed Oct 16 23:21 2013 CDT
* www/assets/js/util.js: Add an errDialog function that shows an
error message over the chatbox (instead of alert())
Wed Oct 16 23:09 2013 CDT Wed Oct 16 23:09 2013 CDT
* www/assets/js/util.js: Add a special handler so that clicking * www/assets/js/util.js: Add a special handler so that clicking
anywhere on the page clears a userlist dropdown, not just right anywhere on the page clears a userlist dropdown, not just right

View File

@ -75,7 +75,7 @@ Callbacks = {
}, },
errorMsg: function(data) { errorMsg: function(data) {
alert(data.msg); errDialog(data.msg);
}, },
costanza: function (data) { costanza: function (data) {

View File

@ -1716,3 +1716,24 @@ function unhidePlayer() {
$("#ytapiplayer").attr("width", PLAYER.size.width) $("#ytapiplayer").attr("width", PLAYER.size.width)
.attr("height", PLAYER.size.height); .attr("height", PLAYER.size.height);
} }
function errDialog(err) {
var div = $("<div/>").addClass("profile-box")
.css("padding", "10px")
.text(err)
.appendTo($("body"));
$("<br/>").appendTo(div);
$("<button/>").addClass("btn btn-mini")
.css("width", "100%")
.text("OK")
.click(function () { div.remove(); })
.appendTo(div);
var cw = $("#chatwrap").width();
var ch = $("#chatwrap").height();
var cp = $("#chatwrap").offset();
var x = cp.left + cw/2 - div.width()/2;
var y = cp.top + ch/2 - div.height()/2;
div.css("left", x + "px");
div.css("top", y + "px");
}