translations.js 810 B

123456789101112131415161718192021222324252627282930313233
  1. import App from '../base'
  2. App.controller('TranslationsPopupController', function(
  3. $scope,
  4. ipCookie,
  5. localStorage
  6. ) {
  7. function getStoredDismissal() {
  8. let localStore = localStorage('hide-i18n-notification')
  9. if (localStore === null) {
  10. // Not stored in localStorage, check cookie
  11. let cookieStore = ipCookie('hidei18nNotification')
  12. // If stored in cookie, set on localStorage for forwards compat
  13. if (cookieStore) {
  14. localStorage('hide-i18n-notification', cookieStore)
  15. ipCookie.remove('hidei18nNotification')
  16. }
  17. return cookieStore
  18. }
  19. return localStore
  20. }
  21. $scope.hidei18nNotification = getStoredDismissal()
  22. $scope.dismiss = function() {
  23. localStorage('hide-i18n-notification', true)
  24. $scope.hidei18nNotification = true
  25. }
  26. })