Daniel@0
|
1 "use strict";
|
Daniel@0
|
2
|
Daniel@0
|
3 /* =========================================================================
|
Daniel@0
|
4 * Methods that should be initialized after modules
|
Daniel@0
|
5 */
|
Daniel@0
|
6 App.addInitializer(function(options){
|
Daniel@0
|
7
|
Daniel@0
|
8 // help
|
Daniel@0
|
9 App.showHelp = function(options){
|
Daniel@0
|
10 App.HelpModule.show(options);
|
Daniel@0
|
11 App.MainMenuModule.flashItem("help");
|
Daniel@0
|
12 };
|
Daniel@0
|
13 App.hideHelp = function(options) {
|
Daniel@0
|
14 App.HelpModule.hide(options);
|
Daniel@0
|
15 };
|
Daniel@0
|
16 App.helpIsShowing = function() {
|
Daniel@0
|
17 return App.HelpModule.isShowing();
|
Daniel@0
|
18 };
|
Daniel@0
|
19
|
Daniel@0
|
20 // notifications
|
Daniel@0
|
21 App.showNotification = function(options){
|
Daniel@0
|
22 App.NotificationsModule.show(options);
|
Daniel@0
|
23 };
|
Daniel@0
|
24 App.hideNotification = function(id){
|
Daniel@0
|
25 return App.NotificationsModule.hide(id);
|
Daniel@0
|
26 };
|
Daniel@0
|
27
|
Daniel@0
|
28 // undo / redo
|
Daniel@0
|
29 var stateHistory = App.context.get("stateHistory");
|
Daniel@0
|
30 App.undo = function() {
|
Daniel@0
|
31 if (stateHistory.canUndo()) {
|
Daniel@0
|
32 stateHistory.undo();
|
Daniel@0
|
33 App.hideNotification("undo_redo");
|
Daniel@0
|
34 } else {
|
Daniel@0
|
35 App.showNotification({id: "undo_redo", content: Backbone.Marionette.TemplateCache.get("#notification-content_undo_na")});
|
Daniel@0
|
36 }
|
Daniel@0
|
37 App.MainMenuModule.flashItem("undo");
|
Daniel@0
|
38 };
|
Daniel@0
|
39 App.redo = function() {
|
Daniel@0
|
40 if (stateHistory.canRedo()) {
|
Daniel@0
|
41 stateHistory.redo();
|
Daniel@0
|
42 App.hideNotification("undo_redo");
|
Daniel@0
|
43 } else {
|
Daniel@0
|
44 App.showNotification({id: "undo_redo", content: Backbone.Marionette.TemplateCache.get("#notification-content_redo_na")});
|
Daniel@0
|
45 }
|
Daniel@0
|
46 App.MainMenuModule.flashItem("redo");
|
Daniel@0
|
47 };
|
Daniel@0
|
48
|
Daniel@0
|
49 stateHistory.on("change", function() {
|
Daniel@0
|
50 App.hideNotification("undo_redo");
|
Daniel@0
|
51 });
|
Daniel@0
|
52
|
Daniel@0
|
53 //
|
Daniel@0
|
54 App.showStateSharing = function() {
|
Daniel@0
|
55 App.showNotification({id: "states", modifiers: ["ttl_20"], content: Backbone.Marionette.TemplateCache.get("#notification-content_states_na")});
|
Daniel@0
|
56 App.MainMenuModule.flashItem("share");
|
Daniel@0
|
57 },
|
Daniel@0
|
58
|
Daniel@0
|
59 App.showStateBookmarks = function() {
|
Daniel@0
|
60 App.showNotification({id: "states", modifiers: ["ttl_20"], content: Backbone.Marionette.TemplateCache.get("#notification-content_states_na")});
|
Daniel@0
|
61 App.MainMenuModule.flashItem("bookmarks");
|
Daniel@0
|
62 },
|
Daniel@0
|
63
|
Daniel@0
|
64 // player
|
Daniel@0
|
65 App.play = function(recordingURI, time) {
|
Daniel@0
|
66 App.PlayerModule.play(recordingURI, time);
|
Daniel@0
|
67 };
|
Daniel@0
|
68 });
|