Merge branch 'text-editor' of https://github.com/h5p/h5p-php-library into text-editor

namespaces
Svein-Tore Griff With 2015-01-14 09:55:48 +01:00
commit 43e98afe4b
2 changed files with 30 additions and 10 deletions

View File

@ -105,6 +105,22 @@ H5P.EventDispatcher = (function () {
} }
}; };
/**
* Creates a copy of the arguments list. Skips the given number of arguments.
*
* @private
* @param {Array} args List of arguments
* @param {Number} skip Number of arguments to skip
* @param {Array} Copy og arguments list
*/
var getArgs = function (args, skip) {
var left = [];
for (var i = skip; i < args.length; i++) {
left.push(args[i]);
}
return left;
};
/** /**
* Dispatch event. * Dispatch event.
* *
@ -112,20 +128,21 @@ H5P.EventDispatcher = (function () {
* @param {String} type Event type * @param {String} type Event type
* @param {...*} args * @param {...*} args
*/ */
self.trigger = function (type, args) { self.trigger = function (type) {
if (self.debug !== undefined) {
// Class has debug enabled. Log events.
console.log(self.debug + ' - Firing event "' + type + '", ' + (events[type] === undefined ? 0 : events[type].length) + ' listeners.', getArgs(arguments, 1));
}
if (events[type] === undefined) { if (events[type] === undefined) {
return; return;
} }
// Copy all arguments except the first // Copy all arguments except the first
args = []; var args = getArgs(arguments, 1);
var i;
for (i = 1; i < arguments.length; i++) {
args.push(arguments[i]);
}
// Call all listeners // Call all listeners
for (i = 0; i < events[type].length; i++) { for (var i = 0; i < events[type].length; i++) {
events[type][i].apply(self, args); events[type][i].apply(self, args);
} }
}; };

View File

@ -36,6 +36,9 @@ html.h5p-iframe .h5p-content {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.h5p-fullscreen .h5p-content, .h5p-semi-fullscreen .h5p-content {
border: 0;
}
.h5p-container { .h5p-container {
position: relative; position: relative;
z-index: 1; z-index: 1;