changelog shortlog tags manifest raw

changeset: implement spawntable and setlocale stub

changeset 1950: b9333d617fa1
parent 1949:e62307121b5d
child 1951:112053e78745
author: loic@dachary.org
date: Mon Jun 21 21:38:04 2010 +0200 (2 months ago)
files: jpoker/sites/pokersource.eu/index.html jpoker/themes/pokersource.eu/css/images/footer.png jpoker/themes/pokersource.eu/css/images/logo.png jpoker/themes/pokersource.eu/css/jpoker.css jpoker/themes/pokersource.eu/css/jpoker_copyright.css jpoker/themes/pokersource.eu/css/jpoker_login.css jpoker/themes/pokersource.eu/css/jpoker_page.css jpoker/themes/pokersource.eu/js/jpoker.js jpoker/themes/pokersource.eu/js/test-jpoker.js
description: implement spawntable and setlocale stub
Binary file jpoker/themes/pokersource.eu/css/images/logo.png has changed
--- a/jpoker/themes/pokersource.eu/css/jpoker.css	Tue Jun 08 22:01:12 2010 +0200
+++ b/jpoker/themes/pokersource.eu/css/jpoker.css	Mon Jun 21 21:38:04 2010 +0200
@@ -1,3 +1,4 @@
+@import "jpoker_page.css";
 @import "jpoker_common.css";
 @import "jpoker_table_layout.css";
 @import "jpoker_table.css";
@@ -8,7 +9,6 @@
 @import "jpoker_tourney_placeholder.css";
 @import "jpoker_login.css";
 @import "jpoker_server_status.css";
-@import "jpoker_copyright.css";
 @import "jpoker_user_info.css";
 @import "jpoker_chat.css";
 @import "jpoker_timeout.css";
--- a/jpoker/themes/pokersource.eu/css/jpoker_login.css	Tue Jun 08 22:01:12 2010 +0200
+++ b/jpoker/themes/pokersource.eu/css/jpoker_login.css	Mon Jun 21 21:38:04 2010 +0200
@@ -4,16 +4,15 @@
     font-weight: bold;
     color: #FFF;
     overflow: hidden;
-    padding: 0px 10px;
-    line-height: 32px;
+    line-height: 27px;
 }
 
 .jpoker_login_login {
-    height: 32px;
+    height: 27px;
 }
 
 .jpoker_login_login:hover {
-    height: 64px;
+    height: 54px;
 }
 
 .jpoker_login ul {
@@ -29,9 +28,9 @@
 }
 
 .jpoker_login li div {
-    height: 22px;
+    height: 20px;
     line-height: 20px;
-    padding: 5px 0px;
+    padding: 2px 0px;
 }
 
 .jpoker_login input {
--- a/jpoker/themes/pokersource.eu/js/jpoker.js	Tue Jun 08 22:01:12 2010 +0200
+++ b/jpoker/themes/pokersource.eu/js/jpoker.js	Mon Jun 21 21:38:04 2010 +0200
@@ -17,7 +17,36 @@
 (function($) {
     var jpoker = $.jpoker;
 
+    jpoker.selectors = {
+        'table': '#table'
+    };
+
     jpoker.main = function() {
+        this.setTemplates();
+        this.setSpawnTable();
+        this.setLocale();
+    };
+
+    jpoker.setSpawnTable = function() {
+        jpoker.server.defaults.spawnTable = function(server, packet) {
+            server.setLocale(jpoker.global_preferences.lang, packet.game_id);
+            $($.jpoker.selectors.table).jpoker('table', server.url, packet.game_id, packet.name);
+        };
+    };
+
+    jpoker.reload = function() { document.location.href = ''; };
+
+    jpoker.setLocale = function() {
+        jpoker.preferences.prototype.lang = $("html").attr("lang");
+        this.global_preferences = new jpoker.preferences('global');
+    };
+
+    jpoker.changeLocale = function(lang) {
+        this.global_preferences.extend({ lang: lang });
+        this.reload();
+    };
+
+    jpoker.setTemplates = function() {
         jpoker.plugins.login.templates.login = 
         '<ul class=\'jpoker_login_login\'>' +
         ' <li class=\'jpoker_login_label\'>' +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jpoker/sites/pokersource.eu/index.html	Mon Jun 21 21:38:04 2010 +0200
@@ -0,0 +1,168 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+//
+//     Copyright (C) 2010 Loic Dachary <loic@dachary.org>
+//
+//     This program is free software: you can redistribute it and/or modify
+//     it under the terms of the GNU General Public License as published by
+//     the Free Software Foundation, either version 3 of the License, or
+//     (at your option) any later version.
+//
+//     This program is distributed in the hope that it will be useful,
+//     but WITHOUT ANY WARRANTY; without even the implied warranty of
+//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//     GNU General Public License for more details.
+//
+//     You should have received a copy of the GNU General Public License
+//     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+    <title>pokersource javascript poker and server software</title>
+    <link rel="shortcut icon" href="../../themes/pokersource.eu/css/images/favicon.ico" type="image/x-icon" />
+    <link href="../../l10n/jpoker-da.json" lang="da" rel="gettext"/>
+    <link href="../../l10n/jpoker-de.json" lang="de" rel="gettext"/>
+    <link href="../../l10n/jpoker-en.json" lang="en" rel="gettext"/>
+    <link href="../../l10n/jpoker-en_CA.json" lang="en_CA" rel="gettext"/>
+    <link href="../../l10n/jpoker-en_US.json" lang="en_US" rel="gettext"/>
+    <link href="../../l10n/jpoker-es.json" lang="es" rel="gettext"/>
+    <link href="../../l10n/jpoker-fi.json" lang="fi" rel="gettext"/>
+    <link href="../../l10n/jpoker-fr.json" lang="fr" rel="gettext"/>
+    <link href="../../themes/pokersource.eu/l10n/jpoker-fr.json" lang="fr" rel="gettext"/>
+    <link href="../../l10n/jpoker-fr_BE.json" lang="fr_BE" rel="gettext"/>
+    <link href="../../l10n/jpoker-fr_CA.json" lang="fr_CA" rel="gettext"/>
+    <link href="../../l10n/jpoker-fr_FX.json" lang="fr_FX" rel="gettext"/>
+    <link href="../../l10n/jpoker-it.json" lang="it" rel="gettext"/>
+    <link href="../../l10n/jpoker-ja.json" lang="ja" rel="gettext"/>
+    <link href="../../l10n/jpoker-nb.json" lang="nb" rel="gettext"/>
+    <link href="../../l10n/jpoker-nl.json" lang="nl" rel="gettext"/>
+    <link href="../../l10n/jpoker-pt.json" lang="pt" rel="gettext"/>
+    <link href="../../l10n/jpoker-sv.json" lang="sv" rel="gettext"/>
+    <link href="../../themes/pokersource.eu/css/jpoker.css" rel="stylesheet" type="text/css" />
+    <script language="JavaScript" type="text/javascript" src="../../jquery/jquery-1.2.6.js"></script>
+    <script language="JavaScript" type="text/javascript" src="../../jquery/ui/ui.core.js"></script>
+    <script language="JavaScript" type="text/javascript" src="../../jquery/ui/ui.draggable.js"></script>
+    <script language="JavaScript" type="text/javascript" src="../../jquery/ui/ui.resizable.js"></script>
+    <script language="JavaScript" type="text/javascript" src="../../jquery/ui/ui.dialog.js"></script>
+    <script language="JavaScript" type="text/javascript" src="../../jquery/ui/ui.slider.js"></script>
+    <script src="../../js/json2.js" type="text/javascript"></script>
+    <script src="../../js/printstacktrace.js" type="text/javascript"></script>
+    <script src="../../js/jquery.gettext.js" type="text/javascript"></script>
+    <script src="../../js/jquery.strftime.js" type="text/javascript"></script>
+    <script src="../../js/jquery.ajaxQueue.js" type="text/javascript"></script>
+    <script src="../../js/jquery.tablesorter.js" type="text/javascript"></script>
+    <script src="../../js/jquery.tablesorter.pager.js" type="text/javascript"></script>
+    <script src="../../js/jquery.form.js" type="text/javascript"></script>
+    <script src="../../js/jquery.cookie.js" type="text/javascript"></script>
+    <script src="../../js/jquery.jpoker.js" type="text/javascript"></script>
+    <script src="../../js/mockup.js" type="text/javascript"></script>
+    <script src="../../themes/pokersource.eu/js/jpoker.js" type="text/javascript"></script>
+    <script type="text/javascript">
+      $(document).ready(function() {
+      var url = '/POKER_REST';
+      $.jpoker.sound_directory = '../../themes/pokersource.eu/sounds/';
+      $.jpoker.main();
+      $('#login').jpoker('login', url);
+      $('#table).jpoker('featuredTable', url);
+      });
+    </script>
+  </head>
+
+  <body>
+    <div>
+      <div id='header'>
+        <div class="jpoker_logo"></div>
+      </div>
+      <div id='menu_header'>
+        <div id='menu'>
+          <ul>
+            <li><div class="jpoker_label">Lobby</div>
+              <ul>
+                <li><a href="javascript://">Cash games</a></li>
+                <li><a href="javascript://">Tournaments</a></li>
+                <li><a href="javascript://">Sit and Go</a></li>
+                <li><a href="javascript://">Quit</a></li>
+              </ul>
+            </li>
+            <li><div class="jpoker_label">User</div>
+              <ul>
+                <li><a href="javascript://">Info</a></li>
+                <li><a href="javascript://">Places</a></li>
+                <li><a href="javascript://">Lookup</a></li>
+                <li><a href="javascript://">Cashier</a></li>
+              </ul>
+            </li>
+            <li><div class="jpoker_label"><a href="javascript://">Feedback</a></div></li>
+            <li><div class="jpoker_label"><a href="javascript://">Copyright</a></div></li>
+          </ul>
+        </div>
+        <div id='login'></div>
+      </div>
+      <div id='content'>
+        <div id='table'>
+        </div>
+      </div>
+      <div id='footer'>
+      <ul id='footer'>
+        <li id='i18n'>
+          <dl>
+            <dt>Language</dt>
+            <dd>
+              <li>
+                <ul>
+                  <li><a href='javascript://' class='da'>Danish</a></li>
+                  <li><a href='javascript://' class='de'>German</a></li>
+                  <li><a href='javascript://' class='en'>English</a></li>
+                  <li><a href='javascript://' class='en_CA'>English (Canadian)</a></li>
+                  <li><a href='javascript://' class='en_US'>English (US)</a></li>
+                  <li><a href='javascript://' class='es'>Spanish</a></li>
+                  <li><a href='javascript://' class='fi'>Finish</a></li>
+                  <li><a href='$.jpoker.setLocale("fr")' class='fr'>French</a></li>
+                  <li><a href='javascript://' class='fr_BE'>French (Belgium)</a></li>
+                  <li><a href='javascript://' class='fr_CA>French (Canada)</a></li>
+                </ul>
+              </li>
+            </dd>
+            <dt></dt>
+            <dd>
+              <li>
+                <ul>
+                  <li><a href='javascript://' class='it'>Italian</a></li>
+                  <li><a href='javascript://' class='ja'>Japanese</a></li>
+                  <li><a href='javascript://' class='nb'>?? nb ??</a></li>
+                  <li><a href='javascript://' class='nl'>Deutsh ??</a></li>
+                  <li><a href='javascript://' class='pt'>Portugese</a></li>
+                  <li><a href='javascript://' class='sv'>?? sv ??</a></li>
+                </ul>
+              </li>
+            </dd>
+          </dl>
+        </li>
+        <li id='support'>
+          <dl>
+            <dt>Support</dt>
+            <dd>
+              <div class='jpoker_outflop'>OutFlop provides services and software to create and operate multiplayer online poker rooms. OutFlop expertise ranges from web based solutions well suited to local businesses up to large scale, international operations. Learn more about <a onclick='window.open(this.href); return false' href='http://outflop.me'>OutFlop poker software</a></div>
+            </dd>
+          </dl>
+        </li>
+        <li id='legal'>
+          <dl>
+            <dt>Authors and Software</dt>
+            <dd class='jpoker_authors'>jpoker-<span class='jpoker_version'>2.0</span> and poker-network-<span class='jpoker_poker_network_version'>2.0</span> are copyright 1993-2010 <a href="mailto:loic@dachary.org">Loic Dachary</a>, Johan Euphrosine and <a href="javascript://">al.</a>
+            </dd>
+            <dt>Copyright notice</dt>
+            <dd class='jpoker_license'>This web site is free software: you can redistribute it and/or modify it under the terms of the <a onclick='window.open(this.href); return false' href='http://www.fsf.org/licensing/licenses/gpl.txt'>GNU General Public License</a> and <a onclick='window.open(this.href); return false' href='http://www.fsf.org/licensing/licenses/agpl.txt'>GNU Affero General Public License</a> as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+            </dd>
+            <dt>Download</dt>
+            <dd class='jpoker_download'>Download <a onclick='window.open(this.href); return false' href='jpoker.tar.gz'>jpoker sources</a> and <a onclick='window.open(this.href); return false' href='poker-network.tar.gz'>poker-network sources</a>
+            </dd>
+          </dl>
+        </li>
+      </ul>
+    </div>
+  </body>
+
+</html>
Binary file jpoker/themes/pokersource.eu/css/images/footer.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jpoker/themes/pokersource.eu/css/jpoker_page.css	Mon Jun 21 21:38:04 2010 +0200
@@ -0,0 +1,136 @@
+body {
+	background: #e8ecd1 url(images/body-background.gif) repeat-y scroll center top;
+	font-family: arial,helvetica,sans-serif;
+        margin: 0;
+}
+
+body > div {
+    width: 840px;
+    margin: 0 auto;
+}
+
+#header {
+    height: 50px;
+    color: #fff;
+    padding: 5px 10px;
+}
+
+#header .jpoker_logo {
+    background: #e8ecd1 url(images/logo.png) no-repeat left top;
+    width: 145px;
+    height: 50px;
+}
+
+#menu_header {
+    border-bottom: 1px solid white;
+    border-top: 1px solid white;
+    background-color: #81ac00;
+    color: #fff;
+    font-weight: bold;
+    font-size: 16px;
+    height: 27px;
+}
+
+#menu ul {
+    margin: 0;
+    padding: 0;
+    list-style: none;
+}
+
+#menu > ul > li {
+    display: block;
+    float: left;
+}
+
+#menu > ul > li > .jpoker_label {
+    width: 7em;
+    height: 20px;
+    border-right: 1px solid white;
+    padding: 5px 5px 2px 10px;
+}
+
+#menu > ul > li > ul > li {
+    border-right: 1px solid white;
+    padding: 0px 0px 0px 20px;
+}
+
+#menu li {
+    background-color: #81ac00;
+}
+
+#menu li:hover {
+    background-color: #567300;
+}
+
+#menu > ul > li > ul {
+    display: none;
+}
+
+#menu > ul > li:hover > ul {
+    display: block;
+}
+
+#menu a {
+    text-decoration: none;
+    color: #fff;
+}
+
+#menu_header #login {
+    float: right;
+}
+
+#content {
+    height: 100px;
+}
+
+#footer {
+    background: #e8ecd1 url(images/footer.png) repeat-x left top;
+    height: 220px;
+    color: #000;
+    font-size: 11px;
+}
+
+ul#footer {
+    margin: 0;
+    padding: 0;
+    list-style: none;
+}
+
+ul#footer > li {
+    display: block;
+    float: left;
+    width: 33%;
+}
+
+ul#footer > li > * {
+    padding: 0px 10px;
+}
+
+#footer dt {
+    font-weight: bold;
+    padding-top: 5px;
+}
+
+#footer dd {
+    margin-left: 10px;
+}
+
+#footer a {
+    color: #FFF;
+    text-decoration: none;
+}
+
+#footer #i18n ul {
+    padding: 15px;
+}
+
+#footer #i18n ul {
+    list-style: none;
+}
+
+#footer #i18n ul > li {
+    display: block;
+    float: left;
+    width: 50%;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jpoker/themes/pokersource.eu/js/test-jpoker.js	Mon Jun 21 21:38:04 2010 +0200
@@ -0,0 +1,119 @@
+//
+//     Copyright (C) 2010 Loic Dachary <loic@dachary.org>
+//
+//     This program is free software: you can redistribute it and/or modify
+//     it under the terms of the GNU General Public License as published by
+//     the Free Software Foundation, either version 3 of the License, or
+//     (at your option) any later version.
+//
+//     This program is distributed in the hope that it will be useful,
+//     but WITHOUT ANY WARRANTY; without even the implied warranty of
+//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//     GNU General Public License for more details.
+//
+//     You should have received a copy of the GNU General Public License
+//     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+module("jpoker");
+
+if(!window.ActiveXObject) {
+    window.ActiveXObject = true;
+}
+
+var ActiveXObject = function(options) {
+    //    window.console.log('activeXobject');
+    $.extend(this, ActiveXObject.defaults, options);
+    this.headers = [];
+};
+
+ActiveXObject.defaults = {
+    readyState: 4,
+    timeout: false,
+    status: 200
+};
+
+ActiveXObject.prototype = {
+
+    responseText: "[]",
+
+    open: function(type, url, async) {
+//        window.console.log('ActiveXObject ' + url);
+    },
+    
+    setRequestHeader: function(header) {
+        this.headers.push(header);
+    },
+    
+    getResponseHeader: function(header) {
+        if(header == "content-type") {
+            return "text/plain";
+        } else {
+            return null;
+        }
+    },
+
+    abort: function() {
+    },
+
+    send: function(data) {
+        if('server' in this && this.server && !this.timeout && this.status == 200) {
+            this.server.handle(data);
+            this.responseText = this.server.outgoing;
+        }
+    }
+};
+
+test("jpoker: main", function() {
+        expect(0);
+    });
+
+test("jpoker: setTemplates", function() {
+        expect(1);
+        var login = $.jpoker.plugins.login.templates.login;
+        $.jpoker.setTemplates();
+        ok(login != $.jpoker.plugins.login.templates.login);
+    });
+
+test("jpoker: setLocale", function() {
+        expect(3);
+
+	$.cookie('jpoker_preferences_global', null);
+        ok($.jpoker.global_preferences === undefined, 'global is undefined');
+        $.jpoker.setLocale();
+        equals($.jpoker.global_preferences.lang, 'en');
+        ok($.cookie('jpoker_preferences_global') === null, 'cookie global is null');
+    });
+
+function reset_locale() {
+    $.cookie('jpoker_preferences_global', null);
+    $.jpoker.global_preferences = null;
+}
+
+test("jpoker: changeLocale", function() {
+        expect(2);
+        var reloaded = false;
+        reset_locale();
+        $.jpoker.setLocale();
+        $.jpoker.reload = function() { reloaded = true; };
+        $.jpoker.changeLocale('fr');
+	equals($.cookie('jpoker_preferences_global'), '{"lang":"fr"}', 'global cookie');
+        equals($.jpoker.global_preferences.lang, 'fr');
+        reset_locale();
+    });
+
+test("jpoker: setSpawnTable", function() {
+        expect(1);
+        
+        $.jpoker.setLocale();
+        $.jpoker.setSpawnTable();
+        var server = $.jpoker.url2server('url');
+        var game_id = 10;
+        var name = 'TABLE NAME';
+        var packet = { "type": 'PacketPokerTable',
+                       "game_id": game_id,
+                       "id": game_id,
+                       "name": name };
+        server.handler(server, game_id, packet);
+        var t = $($.jpoker.selectors.table).text();
+        ok(t.indexOf(name) >= 0, 'looking for ' + name + ' in ' + t);
+    });
--- a/jpoker/themes/pokersource.eu/css/jpoker_copyright.css	Tue Jun 08 22:01:12 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-
-/* copyright notice dialog box */
-
-#jpoker_copyright {
-	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
-	font-size: 12px;
-    background-color: #81AC00;
-    color: #000;
-    width: 400px;
-    padding: 2em;
-    text-align: center;
-}
-
-#jpoker_copyright a {
-	color: #FFF;
-	outline: none;
-}
-
-#jpoker_copyright .jpoker_software,
-#jpoker_copyright .jpoker_authors,
-#jpoker_copyright .jpoker_download {
-    font-weight: bolder;
-}
-
-#jpoker_copyright .jpoker_license,
-#jpoker_copyright .jpoker_explain,
-#jpoker_copyright .jpoker_full_copyright {
-    margin: 1em;
-    text-align: justify;
-}
-
-#jpoker_copyright .jpoker_download {
-    margin: 1em;
-}
-
-#jpoker_copyright .jpoker_dismiss a {
-    border: 2px solid #567300;
-    font-weight: bolder;
-	display: block;
-	text-decoration: none;
-}
-