diff --git a/public/js/controllers/tasksCtrl.js b/public/js/controllers/tasksCtrl.js index b3142b5a69..5b599e9473 100644 --- a/public/js/controllers/tasksCtrl.js +++ b/public/js/controllers/tasksCtrl.js @@ -38,12 +38,6 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User', ' /* TODO this should be somewhere else, but fits the html location better here */ - // uhoh! our first name conflict with habitrpg-shared/helpers, we gotta resovle that soon. - $rootScope.clickRevive = function() { - window.habitrpgShared.algos.revive(User.user); - User.log({ op: "revive" }); - }; - $scope.removeTask = function(list, $index) { if (!confirm("Are you sure you want to delete this task?")) return; User.log({ op: "delTask", data: list[$index] }); diff --git a/public/js/services/userServices.js b/public/js/services/userServices.js index 78cb54fb08..4498f53c28 100644 --- a/public/js/services/userServices.js +++ b/public/js/services/userServices.js @@ -21,7 +21,7 @@ angular.module('userServices', []). user = {}; // this is stored as a reference accessible to all controllers, that way updates propagate //first we populate user with schema - _.extend(user, window.habitrpgShared.helpers.newUser()); + _.extend(user, $window.habitrpgShared.helpers.newUser()); user.apiToken = user._id = ''; // we use id / apitoken to determine if registered //than we try to load localStorage @@ -168,6 +168,11 @@ angular.module('userServices', []). userServices.log(log); }, + revive: function(){ + $window.habitrpgShared.algos.revive(user); + userServices.log({ op: "revive" }); + }, + /** * For gem-unlockable preferences, (a) if owned, select preference (b) else, purchase * @param path: User.preferences <-> User.purchased maps like User.preferences.skin=abc <-> User.purchased.skin.abc. @@ -181,7 +186,7 @@ angular.module('userServices', []). if (user.balance < 1.25) return $rootScope.modals.buyGems = true; path = path.join(','); } else { - if (window.habitrpgShared.helpers.dotGet('purchased.' + path, user)) { + if ($window.habitrpgShared.helpers.dotGet('purchased.' + path, user)) { var pref = path.split('.')[0], val = path.split('.')[1]; return self.set('preferences.' + pref, val); diff --git a/views/shared/modals/death.jade b/views/shared/modals/death.jade index 0d19d36a65..6947b49947 100644 --- a/views/shared/modals/death.jade +++ b/views/shared/modals/death.jade @@ -9,7 +9,7 @@ div(modal='user.stats.hp <= 0', options='{backdrop:true, keyboard:false, backdro .row-fluid .span4 p - a.btn.btn-danger.btn-large.notification-action(ng-click='clickRevive()') Continue + a.btn.btn-danger.btn-large.notification-action(ng-click='User.revive()') Continue .span8 p | You've lost a level, all your gold, and a random piece of equipment. Arise, Habiteer, and try again! Curb those negative Habits, be vigilant in completion of Dailies, and hold death at arm's length with a Potion if you falter!