Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ChangelogAssistant(changelog)
- {
- this.justChangelog = changelog;
- // on first start, this message is displayed, along with the current version message from below
- this.firstMessage = $L('Welcome, and thank you for downloading Your Radio, the only radio for webOS that lets you decide what you play!');
- this.secondMessage = $L('Thank you for updating Your Radio, please read the changelog below.');
- // on new version start
- this.newMessages =
- [
- // Don't forget the comma on all but the last entry
- { version: '0.0.33',log: [ 'Added Changelog scene' ] }
- ];
- // setup command menu
- this.cmdMenuModel =
- {
- visible: false,
- items:
- [
- {},
- {
- label: $L("Ok, I've read this. Let's continue ..."),
- command: 'do-continue'
- },
- {}
- ]
- };
- }
- ChangelogAssistant.prototype.setup = function() {
- // set title
- if (this.justChangelog)
- {
- this.titleContainer.innerHTML = $L('Changelog');
- }
- else
- {
- if (vers.isFirst) {
- this.titleContainer.innerHTML = $L('Welcome To Your Radio');
- }
- else if (vers.isNew) {
- this.titleContainer.innerHTML = $L('Your Radio Changelog');
- }
- }
- // build data
- var html = '';
- if (this.justChangelog)
- {
- for (var m = 0; m < this.newMessages.length; m++)
- {
- html += Mojo.View.render({object: {title: 'v' + this.newMessages[m].version}, template: 'changelog/changeLog'});
- html += '<ul>';
- for (var l = 0; l < this.newMessages[m].log.length; l++)
- {
- html += '<li>' + this.newMessages[m].log[l] + '</li>';
- }
- html += '</ul>';
- }
- }
- else
- {
- if (vers.isFirst)
- {
- html += '<div class="text">' + this.firstMessage + '</div>';
- }
- if (vers.isNew)
- {
- if (!this.justChangelog)
- {
- html += '<div class="text">' + this.secondMessage + '</div>';
- }
- for (var m = 0; m < this.newMessages.length; m++)
- {
- html += Mojo.View.render({object: {title: 'v' + this.newMessages[m].version}, template: 'changelog/changeLog'});
- html += '<ul>';
- for (var l = 0; l < this.newMessages[m].log.length; l++)
- {
- html += '<li>' + this.newMessages[m].log[l] + '</li>';
- }
- html += '</ul>';
- }
- }
- }
- // set data
- this.dataContainer.innerHTML = html;
- };
- ChangelogAssistant.prototype.activate = function(event) {
- if (!this.justChangelog) {
- // start continue button timer
- this.timer = this.controller.window.setTimeout(this.showContinue.bind(this), 5 * 1000);
- }
- };
- ChangelogAssistant.prototype.showContinue = function() {
- // show the command menu
- this.controller.setMenuVisible(Mojo.Menu.commandMenu, true);
- };
- ChangelogAssistant.prototype.handleCommand = function(event) {
- if (event.type == Mojo.Event.command) {
- switch (event.command) {
- case 'do-continue':
- this.controller.stageController.swapScene({name: 'main', transition: Mojo.Transition.crossFade});
- break;
- }
- }
- }
- ChangelogAssistant.prototype.deactivate = function(event) {
- /* remove any event handlers you added in activate and do any other cleanup that should happen before
- this scene is popped or another scene is pushed on top */
- };
- ChangelogAssistant.prototype.cleanup = function(event) {
- /* this function should do any cleanup needed before the scene is destroyed as
- a result of being popped off the scene stack */
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement