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 formater
= new euphorik
.Formater();
29 var util
= new euphorik
.Util(formater
);
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 // FIXME : doesn't work under Opera
44 // see : http://dev.jquery.com/ticket/2892#preview
45 $(window
).unload(function() { client
.flush(); });
47 $("#menu .minichat").click(function() { pages
.displayPage("minichat"); });
48 $("#menu .admin").click(function() { pages
.displayPage("admin"); });
49 $("#menu .profile").click(function() { pages
.displayPage("profile"); });
50 $("#menu .logout").click(function() {
51 util
.messageDialog("Are you sure you want to log out?", euphorik
.Util
.messageType
.question
,
55 pages
.displayPage("minichat", true);
61 $("#menu .register").click(function(){ pages
.displayPage("register"); });
62 $("#menu .about").click(function(){ pages
.displayPage("about"); });
64 // TODO : simplification : such link[1] should be created and automatically open the right page without
65 // explicitly add a page.
66 // [1] : <a class="pageLink" href="termes_of_use">Terms of use</a>
67 $("#footer .termsOfUse").click(function(){ pages
.displayPage("terms_of_use"); });
69 pages
.addPage(new euphorik
.PageMinichat(client
, formater
, util
, communication
), true);
70 pages
.addPage(new euphorik
.PageAdmin(client
, formater
, util
, communication
));
71 pages
.addPage(new euphorik
.PageProfile(client
, formater
, util
));
72 pages
.addPage(new euphorik
.PageRegister(client
, formater
, util
));
73 pages
.addPage(new euphorik
.PageAbout(client
, formater
, util
, communication
));
74 pages
.addPage("terms_of_use");
76 pages
.displayPage(); // display the default page