ModeButton.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: Content Explorer
  6. *| (C) Copyright IBM Corp. 2017
  7. *|
  8. *| US Government Users Restricted Rights - Use, duplication or disclosure
  9. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *+------------------------------------------------------------------------+
  11. */
  12. define(['../../lib/@waca/baglass/js/baglass/app/plugins/Button', '../../app/nls/StringResources'], function (BaseClass, resources) {
  13. var ModeButton = BaseClass.extend({
  14. init: function init() {
  15. ModeButton.inherited('init', this, arguments);
  16. this.pressedTitle = resources.get('togglePreviewModeLabel');
  17. this.unpressedTitle = resources.get('toggleEditModeLabel');
  18. },
  19. setPressed: function setPressed() {
  20. ModeButton.inherited('setPressed', this, arguments);
  21. this.$el.attr('title', this.pressedTitle);
  22. this.getIcon().attr('aria-label', this.pressedTitle);
  23. },
  24. setUnpressed: function setUnpressed() {
  25. ModeButton.inherited('setUnpressed', this, arguments);
  26. this.$el.attr('title', this.unpressedTitle);
  27. this.getIcon().attr('aria-label', this.unpressedTitle);
  28. },
  29. getIcon: function getIcon() {
  30. if (!this.$icon) {
  31. this.$icon = this.$el.find('*[role=img],img');
  32. }
  33. return this.$icon;
  34. }
  35. });
  36. return ModeButton;
  37. });
  38. //# sourceMappingURL=ModeButton.js.map