dash_class.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. define([
  2. 'lodash',
  3. 'jquery',
  4. '../core_module',
  5. ],
  6. function (_, $, coreModule) {
  7. 'use strict';
  8. coreModule.default.directive('dashClass', function() {
  9. return {
  10. link: function($scope, elem) {
  11. $scope.onAppEvent('panel-fullscreen-enter', function() {
  12. elem.toggleClass('panel-in-fullscreen', true);
  13. });
  14. $scope.onAppEvent('panel-fullscreen-exit', function() {
  15. elem.toggleClass('panel-in-fullscreen', false);
  16. });
  17. var lastHideControlsVal;
  18. $scope.$watch('dashboard.hideControls', function() {
  19. if (!$scope.dashboard) {
  20. return;
  21. }
  22. var hideControls = $scope.dashboard.hideControls;
  23. if (lastHideControlsVal !== hideControls) {
  24. elem.toggleClass('hide-controls', hideControls);
  25. lastHideControlsVal = hideControls;
  26. }
  27. });
  28. $scope.$watch('playlistSrv.isPlaying', function(newValue) {
  29. elem.toggleClass('playlist-active', newValue);
  30. });
  31. }
  32. };
  33. });
  34. });