2 // Copyright 2008 Grégory Burri
4 // This file is part of Euphorik.
6 // Euphorik is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // Euphorik is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
19 /*jslint laxbreak:true */
21 // all euphorik is contained in this object
27 var fragment
= new Fragment();
28 var formatter
= new euphorik
.Formatter();
29 var util
= new euphorik
.Util(formatter
);
30 var communication
= new euphorik
.Communication(
31 function(data
) { util
.messageDialog(data
.error_message
); },
32 function() { util
.showWaitBar(); },
33 function() { util
.hideWaitBar(); }
35 var client
= new euphorik
.Client(util
, communication
);
36 var pages
= new euphorik
.Pages(fragment
, communication
);
38 // Client authentification with the cookie information (if it exists).
39 client
.connectionCookie();
41 $("#menuCss").change(function() { client
.setCss("styles/" + $("option:selected", this).attr("value") + "/euphorik.css"); });
43 $(window
).unload(function() { client
.flush(); });
45 $("#menu .minichat").click(function() { pages
.displayPage("minichat"); });
46 $("#menu .admin").click(function() { pages
.displayPage("admin"); });
47 $("#menu .profile").click(function() { pages
.displayPage("profile"); });
48 $("#menu .logout").click(function() {
49 util
.messageDialog("Are you sure you want to log out?", euphorik
.Util
.messageType
.question
,
53 pages
.displayPage("minichat", true);
59 $("#menu .register").click(function(){ pages
.displayPage("register"); });
60 $("#menu .about").click(function(){ pages
.displayPage("about"); });
62 // TODO : simplification : such link[1] should be created and automatically open the right page without
63 // explicitly add a page.
64 // [1] : <a class="pageLink" href="termes_of_use">Terms of use</a>
65 $("#footer .termsOfUse").click(function(){ pages
.displayPage("terms_of_use"); });
67 pages
.addPage(new euphorik
.PageMinichat(client
, formatter
, util
, communication
), true);
68 pages
.addPage(new euphorik
.PageAdmin(client
, formatter
, util
, communication
));
69 pages
.addPage(new euphorik
.PageProfile(client
, formatter
, util
));
70 pages
.addPage(new euphorik
.PageRegister(client
, formatter
, util
));
71 pages
.addPage(new euphorik
.PageAbout(client
, formatter
, util
, communication
));
72 pages
.addPage("terms_of_use");
74 pages
.displayPage(); // display the default page