forked from plainblack/Lacuna-Web-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout.js
117 lines (107 loc) · 3.98 KB
/
about.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
YAHOO.namespace("lacuna");
if (typeof YAHOO.lacuna.About == "undefined" || !YAHOO.lacuna.About) {
(function(){
var Lang = YAHOO.lang,
Util = YAHOO.util,
Dom = Util.Dom,
Event = Util.Event,
Sel = Util.Selector,
Lacuna = YAHOO.lacuna,
Game = Lacuna.Game,
Lib = Lacuna.Library;
var About = function() {
this.id = "about";
this.createEvent("onShow");
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:true,
visible:false,
draggable:true,
effect:Game.GetContainerEffect(),
underlay:false,
modal:true,
close:true,
width:"450px",
zIndex:9999
});
this.Panel.renderEvent.subscribe(function(){
this.elCreditsList = Dom.get("aboutCredits");
this.elVersion = Dom.get("aboutVersion");
Dom.removeClass(this.id, Lib.Styles.HIDDEN);
}, this, true);
this.Panel.render();
Game.OverlayManager.register(this.Panel);
};
About.prototype = {
_getHtml : function() {
return [
' <div class="hd">About</div>',
' <div class="bd">',
' <div style="overflow:auto;height:400px">',
' The Lacuna Expanse',
' <ul>',
' <li>© 2011 by Lacuna Expanse Corp.</li>',
' <li>Server Version: <span id="aboutVersion"></span></li>',
' </ul><br/>',
' Credits',
' <ul id="aboutCredits">',
' </ul>',
' </div>',
' </div>'
].join('');
},
show : function() {
if(!this.hasCredits) {
Game.Services.Stats.credits({},{
success : function(o){
YAHOO.log(o, "info", "Stats");
this.populateCredits(o.result);
},
scope:this
});
}
this.elVersion.innerHTML = Game.ServerData.version;
Game.OverlayManager.hideAll();
this.Panel.show();
},
hide : function() {
this.Panel.hide();
},
populateCredits : function(results) {
if(!this.hasCredits) {
var list = this.elCreditsList,
li = document.createElement("li");
for(var i=0; i<results.length; i++) {
var obj = results[i];
for(var prop in obj) {
if(obj.hasOwnProperty(prop)){
var nLi = li.cloneNode(false),
html = ["<label>",prop,"</label><ul>"];
for(var x=0; x<obj[prop].length; x++) {
html.push("<li>");
html.push(obj[prop][x]);
html.push("</li>");
}
html.push("</ul>");
nLi.innerHTML = html.join('');
list.appendChild(nLi);
}
}
}
this.hasCredits = true;
this.Panel.center();
}
}
};
Lang.augmentProto(About, Util.EventProvider);
Lacuna.About = new About();
})();
YAHOO.register("about", YAHOO.lacuna.About, {version: "1", build: "0"});
}
// vim: noet:ts=4:sw=4