Skip to content

Commit

Permalink
Add context menu to the active stream item view
Browse files Browse the repository at this point in the history
  • Loading branch information
jcme committed May 4, 2015
1 parent 6ddda20 commit ade1cb6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/js/foreground/view/stream/activeStreamItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@
};
},

events: {
'contextmenu': '_onContextMenu'
},

behaviors: {
Tooltip: {
behaviorClass: Tooltip
}
},

instant: false,
player: null,

initialize: function(options) {
this.instant = options.instant;
this.player = Streamus.backgroundPage.player;
},

onRender: function() {
Expand Down Expand Up @@ -75,6 +81,32 @@
Streamus.channels.activeStreamItemArea.vent.trigger('hidden');
this.destroy();
}
},

_onContextMenu: function () {
event.preventDefault();

Streamus.channels.contextMenu.commands.trigger('reset:items', [{
text: chrome.i18n.getMessage('copyUrl'),
onClick: this._copyUrl.bind(this)
}, {
text: chrome.i18n.getMessage('copyTitleAndUrl'),
onClick: this._copyTitleAndUrl.bind(this)
}, {
text: chrome.i18n.getMessage('watchOnYouTube'),
onClick: this._watchOnYouTube.bind(this)
}]);
},

_copyUrl: function () {
this.model.get('song').copyUrl();
},

_copyTitleAndUrl: function () {
this.model.get('song').copyTitleAndUrl();
},
_watchOnYouTube: function () {
this.player.watchInTab(this.model.get('song'));
}
});

Expand Down

0 comments on commit ade1cb6

Please sign in to comment.