H5P.ActionBar=(function ($, EventDispatcher){
"use strict";
function ActionBar(displayOptions){
EventDispatcher.call(this);
var self=this;
var hasActions=false;
var $actions=H5P.jQuery('<ul class="h5p-actions"></ul>');
var addActionButton=function (type, customClass){
var handler=function (){
self.trigger(type);
};
const $actionList=H5P.jQuery('<li/>', {
'class': 'h5p-button h5p-noselect h5p-' + (customClass ? customClass:type),
appendTo: $actions
});
const $actionButton=H5P.jQuery('<button/>', {
tabindex: 0,
'aria-label': H5P.t(type + 'Description'),
html: H5P.t(type),
on: {
click: handler,
keypress: function (e){
if(e.which===32){
handler();
e.preventDefault();
}}
},
appendTo: $actionList
});
H5P.Tooltip($actionButton.get(0));
hasActions=true;
};
if(displayOptions.export||displayOptions.copy){
addActionButton('reuse', 'export');
}
if(displayOptions.copyright){
addActionButton('copyrights');
}
if(displayOptions.embed){
addActionButton('embed');
}
if(displayOptions.icon){
const $h5pLogo=H5P.jQuery('<li><a class="h5p-link" href="http://h5p.org" target="_blank" aria-label="' + H5P.t('h5pDescription') + '"></a></li>').appendTo($actions);
H5P.Tooltip($h5pLogo.find('.h5p-link').get(0));
hasActions=true;
}
self.getDOMElement=function (){
return $actions;
};
self.hasActions=function (){
return hasActions;
};}
ActionBar.prototype=Object.create(EventDispatcher.prototype);
ActionBar.prototype.constructor=ActionBar;
return ActionBar;
})(H5P.jQuery, H5P.EventDispatcher);