diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2018-03-09 13:38:22 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2018-03-09 13:38:22 +0100 |
commit | 493b116f73ec3912ca7af3d6ece3434279cbcfb5 (patch) | |
tree | b6955491311fb0d810e9de9a7dd9b8059d04a10c | |
parent | 735bc5af0929392f27386aa3fa0c26d39f300672 (diff) |
renamed the project SwiftStory
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | bower.json | 2 | ||||
-rw-r--r-- | setup.py | 8 | ||||
-rw-r--r-- | swiftstory/Board.py (renamed from CAO/Board.py) | 0 | ||||
-rw-r--r-- | swiftstory/Cards.py (renamed from CAO/Cards.py) | 4 | ||||
-rw-r--r-- | swiftstory/Client.py (renamed from CAO/Client.py) | 22 | ||||
-rw-r--r-- | swiftstory/Game.py (renamed from CAO/Game.py) | 48 | ||||
-rw-r--r-- | swiftstory/GameManager.py (renamed from CAO/GameManager.py) | 6 | ||||
-rw-r--r-- | swiftstory/Player.py (renamed from CAO/Player.py) | 0 | ||||
-rw-r--r-- | swiftstory/Status.py (renamed from CAO/Status.py) | 4 | ||||
-rw-r--r-- | swiftstory/__init__.py (renamed from CAO/__init__.py) | 0 | ||||
-rwxr-xr-x | swiftstoryd (renamed from cao-server) | 36 | ||||
-rw-r--r-- | usr/share/swiftstory/lang/en/cards/black (renamed from usr/share/cao/lang/en/cards/black) | 0 | ||||
-rw-r--r-- | usr/share/swiftstory/lang/en/cards/white (renamed from usr/share/cao/lang/en/cards/white) | 0 | ||||
-rw-r--r-- | usr/share/swiftstory/lang/fr/cards/black (renamed from usr/share/cao/lang/fr/cards/black) | 0 | ||||
-rw-r--r-- | usr/share/swiftstory/lang/fr/cards/white (renamed from usr/share/cao/lang/fr/cards/white) | 0 | ||||
l--------- | webapp/index.html | 2 | ||||
-rw-r--r-- | webapp/swiftstory-common.css (renamed from webapp/cao-common.css) | 0 | ||||
-rw-r--r-- | webapp/swiftstory-common.js (renamed from webapp/cao-common.js) | 6 | ||||
-rw-r--r-- | webapp/swiftstory-config.js (renamed from webapp/cao-config.js) | 2 | ||||
-rw-r--r-- | webapp/swiftstory-desktop.html (renamed from webapp/cao-desktop.html) | 8 | ||||
-rw-r--r-- | webapp/swiftstory-desktop.js (renamed from webapp/cao-desktop.js) | 32 | ||||
-rw-r--r-- | webapp/swiftstory-mobile.css (renamed from webapp/cao-mobile.css) | 0 | ||||
-rw-r--r-- | webapp/swiftstory-mobile.html (renamed from webapp/cao-mobile.html) | 16 | ||||
-rw-r--r-- | webapp/swiftstory-mobile.js (renamed from webapp/cao-mobile.js) | 38 |
25 files changed, 118 insertions, 118 deletions
@@ -15,7 +15,7 @@ Execution Start the python server (it will listen to any connection on port 1236) - $ chdir / && cao-server & + $ chdir / && swiftstoryd & Installation of the web application =================================== @@ -1,5 +1,5 @@ { - "name": "CAO", + "name": "SwiftStory", "version": "0.0.0", "authors": [ "Jeremie Taboada <taboada.jeremie@gmail.com>" @@ -1,11 +1,11 @@ from distutils.core import setup packages = [ - 'CAO', + 'SwiftStory', ] prefix = '/' -share_dir = 'usr/share/cao/' +share_dir = 'usr/share/swiftstory/' data_files = list() @@ -24,11 +24,11 @@ for n in os.walk('usr'): print(data_files) scripts = [ - 'cao-server', + 'swiftstoryd', ] setup( - name='cao', + name='swiftstory', version='0.1', packages=packages, data_files=data_files, diff --git a/CAO/Board.py b/swiftstory/Board.py index 4f4e7c6..4f4e7c6 100644 --- a/CAO/Board.py +++ b/swiftstory/Board.py diff --git a/CAO/Cards.py b/swiftstory/Cards.py index 01909fb..78dd64a 100644 --- a/CAO/Cards.py +++ b/swiftstory/Cards.py @@ -2,12 +2,12 @@ class Cards(): @staticmethod def get_white_cards(lang): ''' Read the file containing the white cards and return a list of cards ''' - with open('usr/share/cao/lang/' + lang + '/cards/white') as fd: + with open('usr/share/swiftstory/lang/' + lang + '/cards/white') as fd: return [line.strip() for line in fd] @staticmethod def get_black_cards(lang): ''' Read the file containing the black cards and return a list of cards ''' - with open('usr/share/cao/lang/' + lang + '/cards/black') as fd: + with open('usr/share/swiftstory/lang/' + lang + '/cards/black') as fd: return [line.strip() for line in fd] diff --git a/CAO/Client.py b/swiftstory/Client.py index 2d0bbac..33b8e4b 100644 --- a/CAO/Client.py +++ b/swiftstory/Client.py @@ -1,5 +1,5 @@ -from CAO.Status import cao_error -from CAO.Game import Game +from swiftstory.Status import error +from swiftstory.Game import Game class Client(): def __init__(self, socket, handler, game_manager): @@ -12,7 +12,7 @@ class Client(): def join_game(self, game_name, lang): if self.game is not None: - return cao_error('You are already in a game') + return error('You are already in a game') if lang is None: lang = 'en' @@ -21,7 +21,7 @@ class Client(): # XXX self.game will be assigned by game.try_join() if game is None: - return cao_error('Invalid language') + return error('Invalid language') return game.try_join(self) @@ -32,37 +32,37 @@ class Client(): def play_white_card(self, card_id): if self.game is None: - return cao_error('You have to join a game first') + return error('You have to join a game first') return self.game.try_play_card(self.player, card_id) def pick_black_card(self): if self.game is None: - return cao_error('You have to join a game first') + return error('You have to join a game first') return self.game.try_become_judge(self.player) def collect_cards(self): if self.game is None: - cao_error('You have to join a game first') + error('You have to join a game first') return self.game.try_collect_cards(self.player) def designate_card(self, card_id): if self.game is None: - return cao_error('You have to join a game first') + return error('You have to join a game first') return self.game.try_designate_card(self.player, card_id) def view_player_cards(self): if self.game is None: - return cao_error('You have to join a game first') + return error('You have to join a game first') return self.game.try_view_player_cards(self.player) def view_played_cards(self): if self.game is None: - return cao_error('You have to join a game first') + return error('You have to join a game first') return self.game.try_view_played_cards(self.player) def view_black_card(self): if self.game is None: - return cao_error('You have to join a game first') + return error('You have to join a game first') return self.game.try_view_black_card(self.player) def send_notification(self, message): diff --git a/CAO/Game.py b/swiftstory/Game.py index 63f52eb..5e0961c 100644 --- a/CAO/Game.py +++ b/swiftstory/Game.py @@ -1,7 +1,7 @@ -from CAO.Player import Player -from CAO.Board import Board +from swiftstory.Player import Player +from swiftstory.Board import Board -from CAO.Status import cao_error, cao_success +from swiftstory.Status import error, success import json @@ -28,7 +28,7 @@ class Game(): def try_join(self, client): if len(self.players) >= 10: - return cao_error('too many players in this game') + return error('too many players in this game') cards = [] @@ -36,7 +36,7 @@ class Game(): for i in range(10): cards.append(self.board.pick_white_card()) except IndexError: - return cao_error('no enough white cards for player') + return error('no enough white cards for player') player = Player(client) @@ -61,13 +61,13 @@ class Game(): else: state = 'waiting_designation' - return cao_success({'cards': cards, 'game_state': state}) + return success({'cards': cards, 'game_state': state}) def try_become_judge(self, player): if self.state is not self.WAITING_NEW_JUDGE: # TODO what if the judge has quit ? - return cao_error('Someone is judge already') + return error('Someone is judge already') self.judge = player self.board.reveal_black_card() @@ -83,17 +83,17 @@ class Game(): def try_play_card(self, player, card_id): if self.state is not self.WAITING_COLLECTION: - return cao_error('Who asked you to play now ?!') + return error('Who asked you to play now ?!') if self.judge is player: - return cao_error('You\'re the judge, you silly') + return error('You\'re the judge, you silly') elif player.get_has_played(): - return cao_error('You already played, you dumb ass') + return error('You already played, you dumb ass') try: card = player.pop_card(card_id) except IndexError: - return cao_error('Invalid card id') + return error('Invalid card id') player.set_has_played() @@ -101,15 +101,15 @@ class Game(): self.judge.send_notification({'op': 'card_played'}) - return cao_success({'card_id': card_id}) + return success({'card_id': card_id}) def try_collect_cards(self, player): if self.state is not self.WAITING_COLLECTION: - return cao_error('Do you think it\'s the moment for colletion !?') + return error('Do you think it\'s the moment for colletion !?') if self.judge is not player: - return cao_error('You\'re not the judge, you fool!') + return error('You\'re not the judge, you fool!') self.board.shuffle_played_cards() @@ -125,13 +125,13 @@ class Game(): def try_designate_card(self, player, card_id): if self.state is not self.WAITING_DESIGNATION: - return cao_error('Not now, moron !') + return error('Not now, moron !') if self.judge is not player: - return cao_error('Who do you think you are !?') + return error('Who do you think you are !?') if card_id is None and len(self.board.played_cards) > 0: - return cao_error('There are cards on the board, pick one !') + return error('There are cards on the board, pick one !') if card_id is not None or len(self.board.played_cards) > 0: # if there are cards on the board @@ -139,7 +139,7 @@ class Game(): try: card, winner = self.board.played_cards[card_id] except IndexError: - return cao_error('Invalid card') + return error('Invalid card') winner.inc_score() @@ -173,7 +173,7 @@ class Game(): self.state = self.WAITING_NEW_JUDGE - return cao_success(None) + return success(None) def __view_player_cards(self, player): cards = [] @@ -184,26 +184,26 @@ class Game(): return cards def try_view_player_cards(self, player): - return cao_success(self.__view_player_cards(player)) + return success(self.__view_player_cards(player)) def try_view_played_cards(self, player): if self.state is not self.WAITING_DESIGNATION: - return cao_error('Not now, moron !') + return error('Not now, moron !') cards = [] for card, unused in self.board.played_cards: cards.append(self.white_desc[card]) - return cao_success(cards) + return success(cards) def try_view_black_card(self, player): card = self.board.current_black_card if card is not None: - return cao_success(self.black_desc[card]) + return success(self.black_desc[card]) - return cao_error('The black card has not been revealed yet') + return error('The black card has not been revealed yet') def disconnect(self, player): player.client = None diff --git a/CAO/GameManager.py b/swiftstory/GameManager.py index 6e0d956..7cdb5da 100644 --- a/CAO/GameManager.py +++ b/swiftstory/GameManager.py @@ -1,5 +1,5 @@ -from CAO.Game import Game -from CAO.Cards import Cards +from swiftstory.Game import Game +from swiftstory.Cards import Cards import os @@ -7,7 +7,7 @@ class GameManager(): def __init__(self): self.langs = {} - for filename in next(os.walk('usr/share/cao/lang'))[1]: + for filename in next(os.walk('usr/share/swiftstory/lang'))[1]: self.langs[filename] = {} for lang in self.langs: diff --git a/CAO/Player.py b/swiftstory/Player.py index cc64d17..cc64d17 100644 --- a/CAO/Player.py +++ b/swiftstory/Player.py diff --git a/CAO/Status.py b/swiftstory/Status.py index 782a0b4..4e8c84d 100644 --- a/CAO/Status.py +++ b/swiftstory/Status.py @@ -1,7 +1,7 @@ import json -def cao_error(msg, code=255): +def error(msg, code=255): return json.dumps({'type': 'response', 'content': {'status': code, 'info': msg}}) -def cao_success(obj): +def success(obj): return json.dumps({'type': 'response', 'content': {'status': 0, 'result': obj}}) diff --git a/CAO/__init__.py b/swiftstory/__init__.py index e69de29..e69de29 100644 --- a/CAO/__init__.py +++ b/swiftstory/__init__.py @@ -1,43 +1,43 @@ #!/usr/bin/env python from websocket_server import WebsocketServer -import CAO.GameManager -import CAO.Client -from CAO.Status import cao_error +import swiftstory.GameManager +import swiftstory.Client +from swiftstory.Status import error import json -game_manager = CAO.GameManager.GameManager() +game_manager = swiftstory.GameManager.GameManager() def new_client_handler(client, server): - client['cao_client'] = CAO.Client.Client(server, client, game_manager) + client['client'] = swiftstory.Client.Client(server, client, game_manager) def client_left_handler(client, server): - client['cao_client'].disconnect(); + client['client'].disconnect(); def message_received_handler(client, server, message): try: json_msg = json.loads(message) except: - res = cao_error('badly formatted json') + res = error('badly formatted json') else: op = json_msg['op'] if op == 'join_game': try: game_name = json_msg['game_name'] except KeyError: - res = cao_error('field `game_name\' is required') + res = error('field `game_name\' is required') else: lang = json_msg.get('lang') - res = client['cao_client'].join_game(game_name, lang) + res = client['client'].join_game(game_name, lang) elif op == 'view_player_cards': - res = client['cao_client'].view_player_cards() + res = client['client'].view_player_cards() elif op == 'view_black_card': - res = client['cao_client'].view_black_card() + res = client['client'].view_black_card() elif op == 'view_played_cards': - res = client['cao_client'].view_played_cards() + res = client['client'].view_played_cards() elif op == 'pick_black_card': - res = client['cao_client'].pick_black_card() + res = client['client'].pick_black_card() elif op == 'designate_card': card_id = None try: @@ -45,18 +45,18 @@ def message_received_handler(client, server, message): except (KeyError, TypeError): pass finally: - res = client['cao_client'].designate_card(card_id) + res = client['client'].designate_card(card_id) elif op == 'play_white_card': try: card_id = int(json_msg['card_id']) except KeyError: - res = cao_error('field `card_id\' is required') + res = error('field `card_id\' is required') else: - res = client['cao_client'].play_white_card(card_id) + res = client['client'].play_white_card(card_id) elif op == 'collect_cards': - res = client['cao_client'].collect_cards() + res = client['client'].collect_cards() else: - res = cao_error('invalid command') + res = error('invalid command') server.send_message(client, res) diff --git a/usr/share/cao/lang/en/cards/black b/usr/share/swiftstory/lang/en/cards/black index 9519bb7..9519bb7 100644 --- a/usr/share/cao/lang/en/cards/black +++ b/usr/share/swiftstory/lang/en/cards/black diff --git a/usr/share/cao/lang/en/cards/white b/usr/share/swiftstory/lang/en/cards/white index 1c15a42..1c15a42 100644 --- a/usr/share/cao/lang/en/cards/white +++ b/usr/share/swiftstory/lang/en/cards/white diff --git a/usr/share/cao/lang/fr/cards/black b/usr/share/swiftstory/lang/fr/cards/black index 1298307..1298307 100644 --- a/usr/share/cao/lang/fr/cards/black +++ b/usr/share/swiftstory/lang/fr/cards/black diff --git a/usr/share/cao/lang/fr/cards/white b/usr/share/swiftstory/lang/fr/cards/white index b3766a7..b3766a7 100644 --- a/usr/share/cao/lang/fr/cards/white +++ b/usr/share/swiftstory/lang/fr/cards/white diff --git a/webapp/index.html b/webapp/index.html index 8ffec2d..36c43de 120000 --- a/webapp/index.html +++ b/webapp/index.html @@ -1 +1 @@ -cao-mobile.html
\ No newline at end of file +swiftstory-mobile.html
\ No newline at end of file diff --git a/webapp/cao-common.css b/webapp/swiftstory-common.css index c574b6d..c574b6d 100644 --- a/webapp/cao-common.css +++ b/webapp/swiftstory-common.css diff --git a/webapp/cao-common.js b/webapp/swiftstory-common.js index 0ec516d..174b473 100644 --- a/webapp/cao-common.js +++ b/webapp/swiftstory-common.js @@ -1,4 +1,4 @@ -var CAO = function() { +var SwiftStory = function() { this.on_socket_open = function() { /* to override */ }; this.on_socket_close = function() { /* to override */ }; this.on_socket_error = function(evt) { /* to override */}; @@ -341,8 +341,8 @@ var CAO = function() { }; }; -var cao; +var swst; $(document).ready(function() { - cao = new CAO(); + swst = new SwiftStory(); }); diff --git a/webapp/cao-config.js b/webapp/swiftstory-config.js index ddfe0fc..9a6be3c 100644 --- a/webapp/cao-config.js +++ b/webapp/swiftstory-config.js @@ -9,5 +9,5 @@ $(document).ready(function() { lang = 'en'; } - cao.set_lang(lang); + swst.set_lang(lang); }); diff --git a/webapp/cao-desktop.html b/webapp/swiftstory-desktop.html index 34f4721..10706af 100644 --- a/webapp/cao-desktop.html +++ b/webapp/swiftstory-desktop.html @@ -2,11 +2,11 @@ <html lang="en"> <head> <meta charset="utf-8"> - <title>CAO</title> - <link rel="stylesheet" href="cao-common.css"> + <title>SwiftStory</title> + <link rel="stylesheet" href="swiftstory-common.css"> <script src="jquery.js"></script> - <script src="cao-common.js"></script> - <script src="cao-desktop.js"></script> + <script src="swiftstory-common.js"></script> + <script src="swiftstory-desktop.js"></script> </head> <body> <button type="button" id="btn_join">Join a Game !</button> diff --git a/webapp/cao-desktop.js b/webapp/swiftstory-desktop.js index faa864b..af86e83 100644 --- a/webapp/cao-desktop.js +++ b/webapp/swiftstory-desktop.js @@ -2,28 +2,28 @@ $(document).ready(function() { $('#btn_join').click(function() { var game_name = prompt('Name of the game'); - cao.join_game(game_name); + swst.join_game(game_name); }); $('#btn_pick_black').click(function() { - cao.pick_black_card(); + swst.pick_black_card(); }); $('#btn_collect').click(function() { - cao.collect_cards(); + swst.collect_cards(); }); - cao.on_socket_open = function() { + swst.on_socket_open = function() { $('#btn_join').show(); }; - cao.on_join_game_ok = function(state) { + swst.on_join_game_ok = function(state) { $('#btn_join').hide(); $('#btn_pick_black').show(); $('#white_cards').show(); }; - cao.on_show_white_card = function(idx, desc) { + swst.on_show_white_card = function(idx, desc) { identifier = 'white_card_' + idx; content = '<li id="' + identifier + '">' + desc + '</li>'; @@ -32,7 +32,7 @@ $(document).ready(function() { $('#' + identifier).dblclick(this.gen_callback_white_card(idx)); }; - cao.on_show_played_card = function(idx, desc) { + swst.on_show_played_card = function(idx, desc) { identifier = 'played_card_' + idx; content = '<li id="' + identifier + '">' + desc + '</li>'; @@ -43,23 +43,23 @@ $(document).ready(function() { }; - cao.on_pick_black_card_ok = function() { + swst.on_pick_black_card_ok = function() { $('#btn_collect').show(); $('#btn_pick_black').hide(); }; - cao.on_show_black_card = function(desc) { + swst.on_show_black_card = function(desc) { $('#black_card').show(); $('#black_card').html(desc); }; - cao.on_play_white_card_ok = function(idx) { + swst.on_play_white_card_ok = function(idx) { identifier = 'white_card_' + idx; $('#' + identifier).remove(); }; - cao.on_designate_card_ok = function() { + swst.on_designate_card_ok = function() { $('#played_cards').empty(); $('#played_cards').hide(); $('#black_card').hide(); @@ -67,22 +67,22 @@ $(document).ready(function() { $('#btn_pick_black').show(); }; - cao.on_collect_cards_ok = function() { + swst.on_collect_cards_ok = function() { $('#btn_collect').hide(); $('#played_cards').show(); }; - cao.on_judge_designed = function() { + swst.on_judge_designed = function() { $('#btn_pick_black').hide(); }; - cao.on_judge_needed = function() { + swst.on_judge_needed = function() { $('#btn_pick_black').show(); }; - cao.on_updated_score = function(score) { + swst.on_updated_score = function(score) { console.log('new score: ' + score); }; - cao.run(); + swst.run(); }); diff --git a/webapp/cao-mobile.css b/webapp/swiftstory-mobile.css index 796f190..796f190 100644 --- a/webapp/cao-mobile.css +++ b/webapp/swiftstory-mobile.css diff --git a/webapp/cao-mobile.html b/webapp/swiftstory-mobile.html index 7aa619d..a0407d4 100644 --- a/webapp/cao-mobile.html +++ b/webapp/swiftstory-mobile.html @@ -3,13 +3,13 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" /> - <title>CAO</title> - <link rel="stylesheet" href="cao-common.css"> - <link rel="stylesheet" href="cao-mobile.css"> + <title>SwiftStory</title> + <link rel="stylesheet" href="swiftstory-common.css"> + <link rel="stylesheet" href="swiftstory-mobile.css"> <script src="jquery.js"></script> - <script src="cao-common.js"></script> - <script src="cao-config.js"></script> - <script src="cao-mobile.js"></script> + <script src="swiftstory-common.js"></script> + <script src="swiftstory-config.js"></script> + <script src="swiftstory-mobile.js"></script> </head> <body> <div data-role="page"> @@ -18,8 +18,8 @@ <span id="score">Your score is <span id="score-value">0</span></span> </header> <div id="home" class="page current"> - <h1>Cards Against Humanity</h1> - <h2>A party game for horrible people.</h2> + <h1>SwiftStory</h1> + <h2>We're not out of the woods yet.</h2> <button id="join-btn" class="bottom" hidden>Join game!</button> </div> <div id="game" class="page"> diff --git a/webapp/cao-mobile.js b/webapp/swiftstory-mobile.js index acac68e..b05193c 100644 --- a/webapp/cao-mobile.js +++ b/webapp/swiftstory-mobile.js @@ -23,29 +23,29 @@ $(document).ready(function() { }); $become_judge_btn.click(function() { - cao.pick_black_card(); + swst.pick_black_card(); }); $join_btn.click(function () { - cao.join_game(prompt('Name of the game')); + swst.join_game(prompt('Name of the game')); }); $judge_collect_btn.click(function() { - cao.collect_cards(); + swst.collect_cards(); }); - cao.on_socket_open = function() { + swst.on_socket_open = function() { $join_btn.show(); }; - cao.on_join_game_ok = function() { + swst.on_join_game_ok = function() { $header.show(); $home.removeClass("current"); $game.addClass("current"); $all.hide(); }; - cao.on_change_state = function(state) { + swst.on_change_state = function(state) { $all.hide(); switch (state) { @@ -55,7 +55,7 @@ $(document).ready(function() { $white_cards.addClass('read-only'); break; case 'waiting_designation': - if (cao.is_judge()) { + if (swst.is_judge()) { $judge_choose.show(); $played_cards.removeAttr('disabled'); $played_cards.removeClass('read-only'); @@ -66,7 +66,7 @@ $(document).ready(function() { } break; case 'waiting_collection': - if (cao.is_judge()) { + if (swst.is_judge()) { $judge_collect.show(); $white_cards.attr('disabled', true); $white_cards.addClass('read-only'); @@ -82,7 +82,7 @@ $(document).ready(function() { } }; - cao.on_show_white_card = function(idx, desc) { + swst.on_show_white_card = function(idx, desc) { var identifier = 'white-card-' + idx; var content = '<button name="' + idx + '" class="read-only card" id="' + identifier + '">' + desc + '</button>'; $white_cards.append(content); @@ -91,7 +91,7 @@ $(document).ready(function() { var $this = $(this); if (!$white_cards.attr('disabled')) { if ($this.hasClass("active")) { - cao.get_white_card_event($this.prop('name'))(); + swst.get_white_card_event($this.prop('name'))(); } else { $white_cards.find("> .card").removeClass("active"); $this.addClass("active"); @@ -100,7 +100,7 @@ $(document).ready(function() { }); }; - cao.on_show_played_card = function(idx, desc) { + swst.on_show_played_card = function(idx, desc) { var identifier = 'played-card-' + idx; var content = '<button name="' + idx + '" class="read-only card" id="' + identifier + '">' + desc + '</button>'; $played_cards.append(content); @@ -109,7 +109,7 @@ $(document).ready(function() { var $this = $(this); if (!$played_cards.attr('disabled')) { if ($this.hasClass("active")) { - cao.get_played_card_event($this.prop('name'))(); + swst.get_played_card_event($this.prop('name'))(); } else { $played_cards.find("> .card").removeClass("active"); $this.addClass("active"); @@ -118,11 +118,11 @@ $(document).ready(function() { }); }; - cao.on_show_black_card = function(desc) { + swst.on_show_black_card = function(desc) { $('#black-card').html(desc); }; - cao.on_play_white_card_ok = function(idx) { + swst.on_play_white_card_ok = function(idx) { $white_cards.attr('disabled', true); $white_cards.addClass('read-only'); @@ -131,25 +131,25 @@ $(document).ready(function() { $('#white-card-' + idx).remove(); }; - cao.on_updated_score = function(score) { + swst.on_updated_score = function(score) { $score_value.text(score); }; - cao.on_change_nbr_played_cards = function(nbr) { + swst.on_change_nbr_played_cards = function(nbr) { $played_card_number.text(nbr); }; - cao.on_collect_cards_ok = function() { + swst.on_collect_cards_ok = function() { $white_cards.hide(); $played_cards.show(); }; - cao.on_designate_card_ok = function(idx) { + swst.on_designate_card_ok = function(idx) { $played_cards.empty(); $played_cards.hide(); $white_cards.show(); }; - cao.run(); + swst.run(); }); |