diff --git a/js/h5p-library-details.js b/js/h5p-library-details.js
index e274d22..73a996f 100644
--- a/js/h5p-library-details.js
+++ b/js/h5p-library-details.js
@@ -39,20 +39,6 @@ var H5PLibraryDetails= H5PLibraryDetails || {};
$libraryInfo.append(H5PUtils.createLabeledField(title, value));
});
- var count;
- if (H5PLibraryDetails.library.notCached !== undefined) {
- count = H5PIntegration.i18n.H5P.NA;
- }
- else if (H5PLibraryDetails.library.content === undefined) {
- count = 0;
- }
- else {
- count = H5PLibraryDetails.library.content.length;
- }
-
- // List counter:
- $libraryInfo.append(H5PUtils.createLabeledField(H5PLibraryDetails.library.translations.contentCount, count));
-
return $libraryInfo;
};
diff --git a/js/h5p-library-list.js b/js/h5p-library-list.js
index a238d39..5b485f9 100644
--- a/js/h5p-library-list.js
+++ b/js/h5p-library-list.js
@@ -38,7 +38,7 @@ var H5PLibraryList= H5PLibraryList || {};
var $libraryRow = H5PUtils.createTableRow([
library.title,
library.numContent,
- library.numContentDependencies === -1 ? t.NA : library.numContentDependencies,
+ library.numContentDependencies,
library.numLibraryDependencies,
'
\
\
@@ -62,7 +62,7 @@ var H5PLibraryList= H5PLibraryList || {};
});
var $deleteButton = $('.h5p-admin-delete-library', $libraryRow);
- if (library.numContent !== 0 || library.numContentDependencies !== 0 || library.numLibraryDependencies !== 0) {
+ if (library.numContent !== '0' || library.numContentDependencies !== '' || library.numLibraryDependencies !== '') {
// Disabled delete if content.
$deleteButton.attr('disabled', true).attr('title', t.deleteLibrary);
}
diff --git a/js/h5p-utils.js b/js/h5p-utils.js
index d8faf68..3004c95 100644
--- a/js/h5p-utils.js
+++ b/js/h5p-utils.js
@@ -7,14 +7,20 @@ var H5PUtils = H5PUtils || {};
* @param {array} headers List of headers
*/
H5PUtils.createTable = function (headers) {
- var $table = $('
');
-
+ var $table = $('');
+
if(headers) {
var $thead = $('
');
var $tr = $('
|
');
$.each(headers, function (index, value) {
- $tr.append('
' + value + ' | ');
+ if (!(value instanceof Object)) {
+ value = {
+ text: value
+ };
+ }
+
+ $('
| ', value).appendTo($tr);
});
$table.append($thead.append($tr));
@@ -85,7 +91,7 @@ var H5PUtils = H5PUtils || {};
* @returns {$}
*/
H5PUtils.getRebuildCache = function (notCached) {
- var $container = $('
' + notCached.message + '
');
+ var $container = $('
' + notCached.message + '
' + notCached.progress + '
');
var $button = $('
').appendTo($container).click(function () {
var $spinner = $('
', {class: 'h5p-spinner'}).replaceAll($button);
var parts = ['|', '/', '-', '\\'];
@@ -96,7 +102,7 @@ var H5PUtils = H5PUtils || {};
if (current === parts.length) current = 0;
}, 100);
- var $counter = $container.find('.placeholder');
+ var $counter = $container.find('.progress');
var build = function () {
$.post(notCached.url, function (left) {
if (left === '0') {
@@ -105,8 +111,9 @@ var H5PUtils = H5PUtils || {};
location.reload();
}
else {
- var counter = $counter.text().split(' ', 2);
- $counter.text(left + ' ' + counter[1]);
+ var counter = $counter.text().split(' ');
+ counter[0] = left;
+ $counter.text(counter.join(' '));
build();
}
});