body_class.js 949 B

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