Daniel@0: "use strict"; Daniel@0: Daniel@0: App.addInitializer(function(options){ Daniel@0: Daniel@0: var $document = $(document); Daniel@0: Daniel@0: Daniel@0: var cid = 0; Daniel@0: var uniqueClientId = function() { Daniel@0: return "custom" + cid++; Daniel@0: }; Daniel@0: Daniel@0: var nextUniqueClientId = function() { Daniel@0: return "custom" + cid; Daniel@0: }; Daniel@0: Daniel@0: // Resetting a default state Daniel@0: $document.bind("keydown", "shift+0", function(event) { Daniel@0: App.context.get("state").unserialize(App.contextManager.defaultSerializedAppContexts[""].stateHistory.currentSerializedState); Daniel@0: }); Daniel@0: Daniel@0: var sharedMusicRecordingConfig = { Daniel@0: "viewConfigs": [ Daniel@0: {clientId: "def4", parameters: {kind: "properties"}}, Daniel@0: {clientId: "def5", parameters: {kind: "midi-pitch-histogram"}}, Daniel@0: ], Daniel@0: }; Daniel@0: Daniel@0: // Moving to a specific state Daniel@0: $document.bind("keydown", "shift+1", function(event) { Daniel@0: App.context.get("state").unserialize({ Daniel@0: //"musicRecordingsGridIsShown": App.context.get("state").get("musicRecordingsGridIsShown"), Daniel@0: "musicCollectionGrid": { Daniel@0: "selectedEntityConfigClientId": nextUniqueClientId(), Daniel@0: "entityConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl", composer: "Haydn", performer: "Karajan", year: "1959", title: "Symphonies;104"}}, Daniel@0: ], Daniel@0: "viewConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "list"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "tuning-stats"}}, Daniel@0: ], Daniel@0: }, Daniel@0: "musicRecordingGrid": sharedMusicRecordingConfig Daniel@0: }); Daniel@0: }); Daniel@0: Daniel@0: Daniel@0: $document.bind("keydown", "shift+2", function(event) { Daniel@0: App.context.get("state").unserialize({ Daniel@0: "musicCollectionGrid": { Daniel@0: "selectedEntityConfigClientId": nextUniqueClientId(), Daniel@0: "entityConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Haydn", title: "Symphony"}}, Daniel@0: ], Daniel@0: "viewConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "list"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "tuning-stats"}}, Daniel@0: ], Daniel@0: }, Daniel@0: "musicRecordingGrid": sharedMusicRecordingConfig Daniel@0: }); Daniel@0: }); Daniel@0: Daniel@0: $document.bind("keydown", "shift+3", function(event) { Daniel@0: App.context.get("state").unserialize({ Daniel@0: "musicCollectionGrid": { Daniel@0: "selectedEntityConfigClientId": nextUniqueClientId(), Daniel@0: "entityConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl;charm", year: "1940-1979", title: "Symphony"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "pair", "comparisonMode": "superposition"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl;charm", year: "1980-2010", title: "Symphony"}}, Daniel@0: ], Daniel@0: "viewConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "list"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "tuning-stats"}}, Daniel@0: ], Daniel@0: }, Daniel@0: "musicRecordingGrid": sharedMusicRecordingConfig Daniel@0: }); Daniel@0: }); Daniel@0: Daniel@0: $document.bind("keydown", "shift+4", function(event) { Daniel@0: App.context.get("state").unserialize({ Daniel@0: "musicCollectionGrid": { Daniel@0: "selectedEntityConfigClientId": nextUniqueClientId(), Daniel@0: "entityConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Schoenberg"}}, Daniel@0: ], Daniel@0: "viewConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "midi-pitch-histogram"}}, Daniel@0: ], Daniel@0: }, Daniel@0: "musicRecordingGrid": sharedMusicRecordingConfig Daniel@0: }); Daniel@0: }); Daniel@0: Daniel@0: Daniel@0: $document.bind("keydown", "shift+5", function(event) { Daniel@0: App.context.get("state").unserialize({ Daniel@0: "musicCollectionGrid": { Daniel@0: "selectedEntityConfigClientId": nextUniqueClientId(), Daniel@0: "entityConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl", collection: "dinka"}}, Daniel@0: ], Daniel@0: "viewConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "list"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "pitch-histogram"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "midi-pitch-histogram"}}, Daniel@0: ], Daniel@0: }, Daniel@0: "musicRecordingGrid": sharedMusicRecordingConfig Daniel@0: }); Daniel@0: }); Daniel@0: Daniel@0: $document.bind("keydown", "shift+6", function(event) { Daniel@0: App.context.get("state").unserialize({ Daniel@0: "musicCollectionGrid": { Daniel@0: "selectedEntityConfigClientId": nextUniqueClientId(), Daniel@0: "entityConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Chopin", title: "Mazurka;Op.68;no.2"}}, Daniel@0: ], Daniel@0: "viewConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "list"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "mean-tempo-curve"}}, Daniel@0: ], Daniel@0: }, Daniel@0: "musicRecordingGrid": sharedMusicRecordingConfig Daniel@0: }); Daniel@0: }); Daniel@0: Daniel@0: Daniel@0: Daniel@0: $document.bind("keydown", "shift+7", function(event) { Daniel@0: App.context.get("state").unserialize({ Daniel@0: "musicCollectionGrid": { Daniel@0: "selectedEntityConfigClientId": nextUniqueClientId(), Daniel@0: "entityConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Chopin", title: "Mazurka;Op.68;no.2"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {library: "bl;charm", composer: "Chopin"}}, Daniel@0: ], Daniel@0: "viewConfigs": [ Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "list"}}, Daniel@0: {clientId: uniqueClientId(), parameters: {kind: "mean-tempo-curve"}}, Daniel@0: ], Daniel@0: }, Daniel@0: "musicRecordingGrid": sharedMusicRecordingConfig Daniel@0: }); Daniel@0: }); Daniel@0: });