Daniel@0: "use strict"; Daniel@0: Daniel@0: /* ========================================================================= Daniel@0: * Methods that should be initialized after modules Daniel@0: */ Daniel@0: App.addInitializer(function(options){ Daniel@0: Daniel@0: // help Daniel@0: App.showHelp = function(options){ Daniel@0: App.HelpModule.show(options); Daniel@0: App.MainMenuModule.flashItem("help"); Daniel@0: }; Daniel@0: App.hideHelp = function(options) { Daniel@0: App.HelpModule.hide(options); Daniel@0: }; Daniel@0: App.helpIsShowing = function() { Daniel@0: return App.HelpModule.isShowing(); Daniel@0: }; Daniel@0: Daniel@0: // notifications Daniel@0: App.showNotification = function(options){ Daniel@0: App.NotificationsModule.show(options); Daniel@0: }; Daniel@0: App.hideNotification = function(id){ Daniel@0: return App.NotificationsModule.hide(id); Daniel@0: }; Daniel@0: Daniel@0: // undo / redo Daniel@0: var stateHistory = App.context.get("stateHistory"); Daniel@0: App.undo = function() { Daniel@0: if (stateHistory.canUndo()) { Daniel@0: stateHistory.undo(); Daniel@0: App.hideNotification("undo_redo"); Daniel@0: } else { Daniel@0: App.showNotification({id: "undo_redo", content: Backbone.Marionette.TemplateCache.get("#notification-content_undo_na")}); Daniel@0: } Daniel@0: App.MainMenuModule.flashItem("undo"); Daniel@0: }; Daniel@0: App.redo = function() { Daniel@0: if (stateHistory.canRedo()) { Daniel@0: stateHistory.redo(); Daniel@0: App.hideNotification("undo_redo"); Daniel@0: } else { Daniel@0: App.showNotification({id: "undo_redo", content: Backbone.Marionette.TemplateCache.get("#notification-content_redo_na")}); Daniel@0: } Daniel@0: App.MainMenuModule.flashItem("redo"); Daniel@0: }; Daniel@0: Daniel@0: stateHistory.on("change", function() { Daniel@0: App.hideNotification("undo_redo"); Daniel@0: }); Daniel@0: Daniel@0: // Daniel@0: App.showStateSharing = function() { Daniel@0: App.showNotification({id: "states", modifiers: ["ttl_20"], content: Backbone.Marionette.TemplateCache.get("#notification-content_states_na")}); Daniel@0: App.MainMenuModule.flashItem("share"); Daniel@0: }, Daniel@0: Daniel@0: App.showStateBookmarks = function() { Daniel@0: App.showNotification({id: "states", modifiers: ["ttl_20"], content: Backbone.Marionette.TemplateCache.get("#notification-content_states_na")}); Daniel@0: App.MainMenuModule.flashItem("bookmarks"); Daniel@0: }, Daniel@0: Daniel@0: // player Daniel@0: App.play = function(recordingURI, time) { Daniel@0: App.PlayerModule.play(recordingURI, time); Daniel@0: }; Daniel@0: });