not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.4 KiB

  1. define(["sugar-web/activity/activity","sugar-web/env","filterpalette"], function (activity, env, filterpalette) {
  2. var isFavorite = false;
  3. // Manipulate the DOM only when it is ready.
  4. requirejs(['domReady!'], function (doc) {
  5. // Initialize the activity.
  6. activity.setup();
  7. // Create palette
  8. var filterButton = document.getElementById("filter-button");
  9. filterpalette = new filterpalette.FilterPalette(filterButton, undefined);
  10. filterpalette.addEventListener('filter', function() {
  11. app.setFilter({category: filterpalette.getFilter()});
  12. Util.saveContext();
  13. filterpalette.popDown();
  14. });
  15. document.getElementById("favorite-button").onclick = function(s, e) {
  16. var invoker = s.toElement || s.explicitOriginalTarget || s.currentTarget;
  17. isFavorite = !isFavorite;
  18. if (isFavorite)
  19. invoker.style.backgroundImage = 'url(icons/favorite.svg)';
  20. else
  21. invoker.style.backgroundImage = 'url(icons/notfavorite.svg)';
  22. app.setFilter({favorite: isFavorite});
  23. };
  24. document.getElementById("library-button").onclick = function(s, e) {
  25. app.showLibraries();
  26. };
  27. // Launch main screen
  28. app = new VideoViewer.App({activity: activity, filter: filterpalette});
  29. app.renderInto(document.getElementById("viewer"));
  30. var search = new Sugar.SearchField();
  31. search.renderInto(document.getElementById("search"));
  32. // Load context
  33. Util.loadContext(function() {
  34. app.draw();
  35. });
  36. });
  37. });