]> gitweb @ CieloNegro.org - Rakka.git/blob - js/screen.js
a850104252716f3832bb072401f75996f7c49d97
[Rakka.git] / js / screen.js
1 (function () {
2
3     var switchedArea = null;
4
5     Rakka.switchScreen = function () {
6         if (switchedArea == null) {
7             switchedArea = $.DIV({});
8
9             $("div.sideBar div.outline").hide();
10
11             $("p.redirection").hide();
12
13             $("div.body")
14                 .children()
15                     .hide()
16                 .end()
17                 .append(switchedArea);
18
19             $("body").append(
20                 $.DIV({className: "left sideBarMask"}));
21
22             var btnClose
23                 = $.INPUT({type     : "button",
24                            className: "closeButton",
25                            value    : "Close"});
26             $("body").append(
27                 $.DIV({className: "right sideBarMask"},
28                       $.DIV({className: "content"},
29                             btnClose)));
30
31             $(btnClose).click(function () {
32                 Rakka.restoreScreen();
33             });
34         }
35         else {
36             $(switchedArea).empty();
37         }
38
39         return $(switchedArea);
40     };
41
42     Rakka.restoreScreen = function () {
43         if (switchedArea != null) {
44             $("div.sideBar div.outline").show();
45
46             $("p.redirection").show();
47
48             $(switchedArea).remove();
49             switchedArea = null;
50
51             $("div.sideBarMask").remove();
52
53             $("div.body").children().show();
54         }
55         return null;
56     };
57
58     Rakka.getSwitchedScreen = function () {
59         return switchedArea;
60     };
61
62     Rakka.scrollToTopLeft = function () {
63         $("div.center").each(function () {
64             this.scrollTop  = 0;
65             this.scrollLeft = 0;
66         });
67     };
68
69     var waitingMessageBoard = null;
70
71     Rakka.displayWaitingMessage = function (msg) {
72         Rakka.hideWaitingMessage();
73
74         waitingMessageBoard
75             = $.P({className: "waitingMessageBoard"},
76                   $.P({}, msg));
77
78         $("body").append(waitingMessageBoard);
79     };
80
81     Rakka.hideWaitingMessage = function () {
82         if (waitingMessageBoard != null) {
83             $(waitingMessageBoard).remove();
84             waitingMessageBoard = null;
85         }
86     };
87
88 })();