forked from plainblack/Lacuna-Web-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
announce.js
67 lines (59 loc) · 2.11 KB
/
announce.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
YAHOO.namespace("lacuna");
if (typeof YAHOO.lacuna.Announce == "undefined" || !YAHOO.lacuna.Announce) {
(function(){
var Lang = YAHOO.lang,
Util = YAHOO.util,
Dom = Util.Dom,
Lacuna = YAHOO.lacuna,
Game = Lacuna.Game,
Lib = Lacuna.Library;
var Announce = function() {
this.id = "Announce";
var container = document.createElement("div");
container.id = this.id;
Dom.addClass(container, "nofooter");
Dom.addClass(container, Lib.Styles.HIDDEN);
container.innerHTML = this._getHtml();
document.body.insertBefore(container, document.body.firstChild);
this.Panel = new YAHOO.widget.Panel(this.id, {
constraintoviewport:true,
fixedcenter:false,
visible:false,
draggable:true,
effect:Game.GetContainerEffect(),
underlay:false,
modal:false,
close:true,
width:"350px",
zIndex:19999,
context:["header","tr","br", ["beforeShow", "windowResize"], [0,20]]
});
this.Panel.renderEvent.subscribe(function(){
this.iFrame = Dom.get("announceFrame");
Dom.removeClass(this.id, Lib.Styles.HIDDEN);
}, this, true);
this.Panel.render();
};
Announce.prototype = {
_getHtml : function() {
return [
' <div class="hd">Announcements</div>',
' <div class="bd">',
' <iframe id="announceFrame" style="width:100%;height:200px;background-color:white;border:0;"></iframe>',
' </div>'
].join('');
},
show : function() {
this.iFrame.src = "/announcement?session_id=" + Game.GetSession();
this.Panel.show();
},
hide : function() {
this.Panel.hide();
}
};
Lang.augmentProto(Announce, Util.EventProvider);
Lacuna.Announce = new Announce();
})();
YAHOO.register("Announce", YAHOO.lacuna.Announce, {version: "1", build: "0"});
}
// vim: noet:ts=4:sw=4