Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. export default class UserClientController
  2. {
  3. constructor(AppConstants, SessionService, $translate, $localStorage, $window, $stickyState, $mdDialog, $mdToast, $state, $rootScope, $scope)
  4. {
  5. 'ngInject';
  6.  
  7. this.AppConstants = AppConstants;
  8. this.SessionService = SessionService;
  9. this.$translate = $translate;
  10. this.$localStorage = $localStorage;
  11. this.$window = $window;
  12. this.$stickyState = $stickyState;
  13. this.$mdDialog = $mdDialog;
  14. this.$mdToast = $mdToast;
  15. this.$state = $state;
  16. this.$rootScope = $rootScope;
  17. this.$scope = $scope;
  18.  
  19. this.$scope.flashvarsString = '';
  20.  
  21. this.$scope.flashVars = {
  22. "connection.info.host": this.AppConstants.client.clientHost,
  23. "connection.info.port": this.AppConstants.client.clientPort,
  24. "external.texts.txt": this.AppConstants.client.clientTexts,
  25. "external.variables.txt": this.AppConstants.client.clientVariables,
  26. "external.figurepartlist.txt": this.AppConstants.client.clientFigureList,
  27. "furnidata.load.url": this.AppConstants.client.clientFurniData,
  28. "productdata.load.url": this.AppConstants.client.clientProductData,
  29. "avatareditor.promohabbos": this.AppConstants.client.clientPromoHabbos,
  30. "client.allow.cross.domain": 1,
  31. "client.notify.cross.domain": 0,
  32. "client.starting": this.AppConstants.siteName,
  33. "client.starting.revolving": this.$translate.instant('client.revolving'),
  34. "flash.client.url": this.AppConstants.client.clientBase,
  35. "flash.client.origin": "popup",
  36. "url.prefix": this.AppConstants.siteLink + '/',
  37. "processlog.enabled": 1,
  38. "has.identity": 1,
  39. "spaweb": 1,
  40. "sso.ticket": this.$localStorage.currentUser.usersession,
  41. "accountid": this.$localStorage.currentUser.userid,
  42. "uniquehabboid": this.$localStorage.currentUser.usersession
  43. };
  44.  
  45. angular.forEach(this.$scope.flashVars, (value, key) =>
  46. {
  47. this.$scope.flashvarsString += key + '=' + value + '&';
  48. });
  49.  
  50. this.$scope.reloadClient = () =>
  51. {
  52. this.$stickyState.reset('client');
  53. }
  54.  
  55. this.$window.HabboFlashClient = {
  56. started: !1,
  57. init: () =>
  58. {
  59. setTimeout(() =>
  60. {
  61. this.$window.HabboFlashClient.flashInterface = document.getElementById('flash-container');
  62. }, 1000);
  63. }
  64. };
  65.  
  66. this.$window.addEventListener("load", this.$window.HabboFlashClient.init());
  67.  
  68. this.$window.FlashExternalInterface = {};
  69.  
  70. this.$window.FlashExternalInterface.logout = () =>
  71. {
  72. return this.$translate(['generic.messages.title', 'generic.buttons.logout', 'generic.dialogs.logout', 'generic.dialogs.cancel'])
  73.  
  74. .then((text) =>
  75. {
  76. return this.$mdDialog.show(
  77. this.$mdDialog.confirm({
  78. title: text['generic.messages.title'],
  79. textContent: text['generic.buttons.logout'],
  80. ok: text['generic.buttons.logout'],
  81. cancel: text['generic.buttons.cancel']
  82. }));
  83. })
  84.  
  85. .then(() =>
  86. {
  87. return this.SessionService.destroySession();
  88. })
  89.  
  90. .then(() =>
  91. {
  92. return this.$state.go('login');
  93. })
  94.  
  95. .catch(() =>
  96. {
  97. return;
  98. })
  99. };
  100.  
  101. this.$window.FlashExternalInterface.disconnect = () =>
  102. {
  103. return this.$translate(['generic.messages.disconnected'])
  104.  
  105. .then((text) =>
  106. {
  107. this.$mdToast.show(
  108. $mdToast.simple({
  109. textContent: text['generic.messages.disconnected'],
  110. hideDelay: 3000,
  111. position: 'top right'
  112. }));
  113.  
  114. this.$stickyState.reset('client');
  115.  
  116. if(this.$state.includes('client')) return this.$state.reload();
  117.  
  118. return this.$state.go('client');
  119. });
  120. };
  121.  
  122. this.$window.FlashExternalInterface.openAvatars = () =>
  123. {
  124. return this.$state.go('settings');
  125. };
  126.  
  127. this.$window.FlashExternalInterface.openMinimail = () =>
  128. {
  129. return this.$state.go('messages');
  130. };
  131.  
  132. this.$window.FlashExternalInterface.openNews = () =>
  133. {
  134. return this.$state.go('news');
  135. };
  136.  
  137. this.$window.FlashExternalInterface.track = (action, label, value) =>
  138. {
  139. console.log('action = [' + action + '], label = [' + label + '], value = [' + value + ']');
  140. };
  141. }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement