Make it easy to disable generic content features.
parent
cc8bfa4b98
commit
2636ddc393
78
js/h5p.js
78
js/h5p.js
|
@ -30,7 +30,29 @@ else if (document.documentElement.msRequestFullscreen) {
|
||||||
H5P.fullScreenBrowserPrefix = 'ms';
|
H5P.fullScreenBrowserPrefix = 'ms';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep track of when the H5Ps where started
|
/** @const {Number} */
|
||||||
|
H5P.DISABLE_NONE = 0;
|
||||||
|
|
||||||
|
/** @const {Number} */
|
||||||
|
H5P.DISABLE_FRAME = 1;
|
||||||
|
|
||||||
|
/** @const {Number} */
|
||||||
|
H5P.DISABLE_DOWNLOAD = 2;
|
||||||
|
|
||||||
|
/** @const {Number} */
|
||||||
|
H5P.DISABLE_EMBED = 4;
|
||||||
|
|
||||||
|
/** @const {Number} */
|
||||||
|
H5P.DISABLE_COPYRIGHT = 8;
|
||||||
|
|
||||||
|
/** @const {Number} */
|
||||||
|
H5P.DISABLE_ABOUT = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keep track of when the H5Ps where started.
|
||||||
|
*
|
||||||
|
* @type {Array}
|
||||||
|
*/
|
||||||
H5P.opened = {};
|
H5P.opened = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,29 +90,41 @@ H5P.init = function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var $actions = H5P.jQuery('<ul class="h5p-actions"></ul>');
|
if (contentData.disable & H5P.DISABLE_FRAME) {
|
||||||
if (contentData.exportUrl !== '') {
|
$element.addClass('h5p-no-frame');
|
||||||
// Display export button
|
|
||||||
H5P.jQuery('<li class="h5p-button h5p-export" role="button" tabindex="1" title="' + H5P.t('downloadDescription') + '">' + H5P.t('download') + '</li>').appendTo($actions).click(function () {
|
|
||||||
window.location.href = contentData.exportUrl;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (instance.getCopyrights !== undefined) {
|
else {
|
||||||
// Display copyrights button
|
// Create action bar
|
||||||
H5P.jQuery('<li class="h5p-button h5p-copyrights" role="button" tabindex="1" title="' + H5P.t('copyrightsDescription') + '">' + H5P.t('copyrights') + '</li>').appendTo($actions).click(function () {
|
var $actions = H5P.jQuery('<ul class="h5p-actions"></ul>');
|
||||||
H5P.openCopyrightsDialog($actions, instance);
|
|
||||||
});
|
if (!(contentData.disable & H5P.DISABLE_DOWNLOAD)) {
|
||||||
|
// Add export button
|
||||||
|
H5P.jQuery('<li class="h5p-button h5p-export" role="button" tabindex="1" title="' + H5P.t('downloadDescription') + '">' + H5P.t('download') + '</li>').appendTo($actions).click(function () {
|
||||||
|
window.location.href = contentData.exportUrl;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!(contentData.disable & H5P.DISABLE_COPYRIGHT) && instance.getCopyrights !== undefined) {
|
||||||
|
// Add copyrights button
|
||||||
|
H5P.jQuery('<li class="h5p-button h5p-copyrights" role="button" tabindex="1" title="' + H5P.t('copyrightsDescription') + '">' + H5P.t('copyrights') + '</li>').appendTo($actions).click(function () {
|
||||||
|
H5P.openCopyrightsDialog($actions, instance);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!(contentData.disable & H5P.DISABLE_EMBED)) {
|
||||||
|
// Add embed button
|
||||||
|
H5P.jQuery('<li class="h5p-button h5p-embed" role="button" tabindex="1" title="' + H5P.t('embedDescription') + '">' + H5P.t('embed') + '</li>').appendTo($actions).click(function () {
|
||||||
|
H5P.openEmbedDialog($actions, contentData.embedCode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!(contentData.disable & H5P.DISABLE_ABOUT)) {
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert action bar if it has any content
|
||||||
|
if ($actions.children().length) {
|
||||||
|
$actions.insertAfter($container);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (contentData.embedCode !== undefined) {
|
|
||||||
// Display embed button
|
|
||||||
H5P.jQuery('<li class="h5p-button h5p-embed" role="button" tabindex="1" title="' + H5P.t('embedDescription') + '">' + H5P.t('embed') + '</li>').appendTo($actions).click(function () {
|
|
||||||
H5P.openEmbedDialog($actions, contentData.embedCode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (H5PIntegration.showH5PIconInActionBar()) {
|
|
||||||
H5P.jQuery('<li><a class="h5p-link" href="http://h5p.org" target="_blank" title="' + H5P.t('h5pDescription') + '"></a></li>').appendTo($actions);
|
|
||||||
}
|
|
||||||
$actions.insertAfter($container);
|
|
||||||
|
|
||||||
// Keep track of when we started
|
// Keep track of when we started
|
||||||
H5P.opened[contentId] = new Date();
|
H5P.opened[contentId] = new Date();
|
||||||
|
|
|
@ -36,6 +36,9 @@ html.h5p-iframe .h5p-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.h5p-content.h5p-no-frame {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
.h5p-container {
|
.h5p-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
Loading…
Reference in New Issue