-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: h5p core & editor files copied into repo
- Loading branch information
Showing
482 changed files
with
43,571 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* @class | ||
* @augments H5P.EventDispatcher | ||
* @param {Object} displayOptions | ||
* @param {boolean} displayOptions.export Triggers the display of the 'Download' button | ||
* @param {boolean} displayOptions.copyright Triggers the display of the 'Copyright' button | ||
* @param {boolean} displayOptions.embed Triggers the display of the 'Embed' button | ||
* @param {boolean} displayOptions.icon Triggers the display of the 'H5P icon' link | ||
*/ | ||
H5P.ActionBar = (function ($, EventDispatcher) { | ||
"use strict"; | ||
|
||
function ActionBar(displayOptions) { | ||
EventDispatcher.call(this); | ||
|
||
/** @alias H5P.ActionBar# */ | ||
var self = this; | ||
|
||
var hasActions = false; | ||
|
||
// Create action bar | ||
var $actions = H5P.jQuery('<ul class="h5p-actions"></ul>'); | ||
|
||
/** | ||
* Helper for creating action bar buttons. | ||
* | ||
* @private | ||
* @param {string} type | ||
* @param {string} customClass Instead of type class | ||
*/ | ||
var addActionButton = function (type, customClass) { | ||
/** | ||
* Handles selection of action | ||
*/ | ||
var handler = function () { | ||
self.trigger(type); | ||
}; | ||
H5P.jQuery('<li/>', { | ||
'class': 'h5p-button h5p-noselect h5p-' + (customClass ? customClass : type), | ||
role: 'button', | ||
tabindex: 0, | ||
title: H5P.t(type + 'Description'), | ||
html: H5P.t(type), | ||
on: { | ||
click: handler, | ||
keypress: function (e) { | ||
if (e.which === 32) { | ||
handler(); | ||
e.preventDefault(); // (since return false will block other inputs) | ||
} | ||
} | ||
}, | ||
appendTo: $actions | ||
}); | ||
|
||
hasActions = true; | ||
}; | ||
|
||
// Register action bar buttons | ||
if (displayOptions.export || displayOptions.copy) { | ||
// Add export button | ||
addActionButton('reuse', 'export'); | ||
} | ||
if (displayOptions.copyright) { | ||
addActionButton('copyrights'); | ||
} | ||
if (displayOptions.embed) { | ||
addActionButton('embed'); | ||
} | ||
if (displayOptions.icon) { | ||
// Add about H5P button icon | ||
H5P.jQuery('<li><a class="h5p-link" href="http://h5p.org" target="_blank" title="' + H5P.t('h5pDescription') + '"></a></li>').appendTo($actions); | ||
hasActions = true; | ||
} | ||
|
||
/** | ||
* Returns a reference to the dom element | ||
* | ||
* @return {H5P.jQuery} | ||
*/ | ||
self.getDOMElement = function () { | ||
return $actions; | ||
}; | ||
|
||
/** | ||
* Does the actionbar contain actions? | ||
* | ||
* @return {Boolean} | ||
*/ | ||
self.hasActions = function () { | ||
return hasActions; | ||
}; | ||
} | ||
|
||
ActionBar.prototype = Object.create(EventDispatcher.prototype); | ||
ActionBar.prototype.constructor = ActionBar; | ||
|
||
return ActionBar; | ||
|
||
})(H5P.jQuery, H5P.EventDispatcher); |
Oops, something went wrong.