Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function ($) {
- Drupal.game_status_request = function () {
- $.post(Drupal.settings.basePath + "game/status", Drupal.game_status_proceed, "json");
- }
- Drupal.game_status_proceed = function (data, status) {
- $(document).stopTime()
- .oneTime(Drupal.settings.game.request_frequency * 1000, Drupal.game_status_request)
- .trigger("game_update", data);
- if (data.status == "error") {
- alert(data.status + ": " + data.message);
- }
- }
- $(document).bind("game_update", function (event, data) {
- if (data.tokens)
- Drupal.theme('showMyTokens', data.tokens)
- });
- Drupal.theme.prototype.showMyTokens = function (tokens) {
- $("#block-block-1 .utokens").text(tokens).show();
- };
- $(function () {
- $(document).trigger("game_prepare");
- Drupal.game_status_request();
- });
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement