]> gitweb @ CieloNegro.org - Rakka.git/blob - js/screen.js
improved the page editor
[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         else {
20             $(switchedArea).empty();
21         }
22         
23         return $(switchedArea);
24     };
25
26     Rakka.restoreScreen = function () {
27         if (switchedArea == null) {
28             throw new Error("Rakka.restoreScreen(): not switched");
29         }
30
31         $("div.sideBar div.outline").show();
32
33         $("p.redirection").show();
34
35         $(switchedArea).remove();
36         switchedArea = null;
37
38         $("div.body").children().show();
39         return null;
40     };
41
42     Rakka.getSwitchedScreen = function () {
43         return switchedArea;
44     };
45
46     Rakka.scrollToTopLeft = function () {
47         $("div.center").each(function () {
48             this.scrollTop  = 0;
49             this.scrollLeft = 0;
50         });
51     };
52
53     var waitingMessageBoard = null;
54
55     Rakka.displayWaitingMessage = function (msg) {
56         Rakka.hideWaitingMessage();
57
58         waitingMessageBoard
59             = $.P({className: "waitingMessageBoard"},
60                   $.P({}, msg));
61         
62         $("body").append(waitingMessageBoard);
63     };
64
65     Rakka.hideWaitingMessage = function () {
66         if (waitingMessageBoard != null) {
67             $(waitingMessageBoard).remove();
68             waitingMessageBoard = null;
69         }
70     };
71     
72 })();