Skip to content

Commit

Permalink
refactor: h5p core & editor files copied into repo
Browse files Browse the repository at this point in the history
  • Loading branch information
sr258 committed Nov 23, 2021
1 parent 4eef55f commit a2d0766
Show file tree
Hide file tree
Showing 482 changed files with 43,571 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ microsoft.gpg

# Dependency directory
node_modules
/h5p
/h5p/libraries

h5p_libs
google_translate.json
Expand Down
674 changes: 674 additions & 0 deletions h5p/core/LICENSE.txt

Large diffs are not rendered by default.

Binary file added h5p/core/fonts/h5p-core-27.eot
Binary file not shown.
113 changes: 113 additions & 0 deletions h5p/core/fonts/h5p-core-27.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added h5p/core/fonts/h5p-core-27.ttf
Binary file not shown.
Binary file added h5p/core/fonts/h5p-core-27.woff
Binary file not shown.
Binary file added h5p/core/fonts/h5p-hub-publish.eot
Binary file not shown.
38 changes: 38 additions & 0 deletions h5p/core/fonts/h5p-hub-publish.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added h5p/core/fonts/h5p-hub-publish.ttf
Binary file not shown.
Binary file added h5p/core/fonts/h5p-hub-publish.woff
Binary file not shown.
16 changes: 16 additions & 0 deletions h5p/core/images/h5p.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added h5p/core/images/throbber.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions h5p/core/js/h5p-action-bar.js
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);
Loading

0 comments on commit a2d0766

Please sign in to comment.