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.

48 lines
1.6 KiB

  1. // On Sugar, don't need a toolbar, will be handle by Python side
  2. if (Util.onSugar()) {
  3. // Remove toolbar
  4. var toolbar = document.getElementById("main-toolbar");
  5. document.getElementById("body").removeChild(toolbar);
  6. // Handle palette event from Python
  7. Util.sugar = new Sugar();
  8. Util.sugar.connect('filter_clicked', function(text) {
  9. app.setFilter({category: text});
  10. Util.saveContext();
  11. });
  12. Util.sugar.connect('settings_clicked', function(isFavorite) {
  13. app.remotePopUp();
  14. });
  15. Util.sugar.connect('favorite_clicked', function(isFavorite) {
  16. app.setFilter({favorite: isFavorite});
  17. });
  18. Util.sugar.connect('text_typed', function(textfilter) {
  19. app.setFilter({text: textfilter});
  20. });
  21. var filterpalette = {};
  22. filterpalette.setCategories = function(categories) {
  23. Util.sugar.sendMessage("set_categories", categories);
  24. };
  25. Util.sugar.connect('library_clicked', function() {
  26. app.showLibraries();
  27. });
  28. // Handle context event from Python
  29. Util.sugar.connect('load-context', function(context) {
  30. //console.log("#JS LOAD CONTEXT "+JSON.stringify(context));
  31. Util.loadContext(null, context);
  32. });
  33. Util.sugar.connect('save-context', function() {
  34. //console.log("#JS SAVE CONTEXT "+JSON.stringify(Util.context));
  35. Util.sugar.sendMessage("save-context", Util.context);
  36. });
  37. // Launch main screen
  38. app = new VideoViewer.App({activity: null, filter: filterpalette});
  39. constant.videoType = "ogv";
  40. app.renderInto(document.getElementById("viewer"));
  41. Util.sugar.sendMessage("ready");
  42. } else {
  43. // Show toolbar
  44. document.getElementById("main-toolbar").style.visibility = "visible";
  45. }