body_class.js 814 B

1234567891011121314151617181920212223242526272829303132333435
  1. define([
  2. 'lodash',
  3. 'jquery',
  4. '../core_module',
  5. ],
  6. function (_, $, coreModule) {
  7. 'use strict';
  8. coreModule.default.directive('bodyClass', function() {
  9. return {
  10. link: function($scope, elem) {
  11. var lastHideControlsVal;
  12. $scope.$watch('dashboard.hideControls', function() {
  13. if (!$scope.dashboard) {
  14. return;
  15. }
  16. var hideControls = $scope.dashboard.hideControls || $scope.playlist_active;
  17. if (lastHideControlsVal !== hideControls) {
  18. elem.toggleClass('hide-controls', hideControls);
  19. lastHideControlsVal = hideControls;
  20. }
  21. });
  22. $scope.$watch('playlistSrv', function(newValue) {
  23. elem.toggleClass('playlist-active', _.isObject(newValue));
  24. });
  25. }
  26. };
  27. });
  28. });