Skip to content

Instantly share code, notes, and snippets.

@vgrem

vgrem/sharevideoribbon.js

Last active Dec 23, 2015
Embed
What would you like to do?
Sharing Video Page Component
Type.registerNamespace('MediaExtensions.Ribbon.RTE');
//Page Component for Sharing Video
MediaExtensions.Ribbon.RTE.VideoPageComponent = function () {
MediaExtensions.Ribbon.RTE.VideoPageComponent.initializeBase(this);
}
MediaExtensions.Ribbon.RTE.VideoPageComponent.prototype = {
mediaCommands: ['VideoGroup', 'ShareVideo', 'ShareVideoMenuOpen', 'ShareVideoMenuClose', 'EmbedVideo', 'InsertVideoWeb'],
registerWithPageManager: function () {
CUI.Page.PageManager.get_instance().addPageComponent(this);
}, getFocusedCommands: function () {
return this.mediaCommands;
}, getGlobalCommands: function () {
return this.mediaCommands;
}, canHandleCommand: function (commandId) {
return true;
}, handleCommand: function (commandId, properties, sequence) {
if (commandId === 'ShareVideo') {
this.invokeVideoCommand(commandId);
return true;
}
if (commandId === 'InsertVideoWeb') {
this.invokeVideoCommand(commandId);
return true;
}
return true;
}, isFocusable: function () {
return true
}, receiveFocus: function () {
return true;
}, yieldFocus: function () {
return true;
}, invokeVideoCommand: function (commandId) {
RTE.SnapshotManager.takeSnapshot();
var range = RTE.Cursor.get_range();
if (!range.get_isEditable()) {
return;
}
var dlg = new MediaExtensions.Ribbon.RTE.ShareVideoDialog();
dlg.show(commandId);
RTE.SnapshotManager.takeSnapshot();
}
}
MediaExtensions.Ribbon.RTE.VideoPageComponent.registerClass('MediaExtensions.Ribbon.RTE.VideoPageComponent', CUI.Page.PageComponent);
//Register Page Component for Sharing Video
NotifyScriptLoadedAndExecuteWaitingJobs("sharevideoribbon.js");
function ShareVideoInit() {
var currentPageManager = SP.Ribbon.PageManager.get_instance();
currentPageManager.addPageComponent(new MediaExtensions.Ribbon.RTE.VideoPageComponent());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.