summaryrefslogtreecommitdiffstats
path: root/common/html-coverpage/static/rtems/js/catalogue.js
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-01-11 17:04:02 +1100
committerChris Johns <chrisj@rtems.org>2017-01-11 17:04:02 +1100
commit2591ca639056db4f6abe294cc7a81bb831c8f7f9 (patch)
tree30ba1d0a11d4e097fe5750e2024630bdfbea8036 /common/html-coverpage/static/rtems/js/catalogue.js
parenthtml: Add support for an HTML cover page for releases. (diff)
downloadrtems-docs-2591ca639056db4f6abe294cc7a81bb831c8f7f9.tar.bz2
html: Embed the catalogue XML in JS.
The is to work around a security issue with Chrome on Windows. This patches let the cover page load on Chrome and Edge on Windows 10.
Diffstat (limited to '')
-rw-r--r--common/html-coverpage/static/rtems/js/catalogue.js81
1 files changed, 42 insertions, 39 deletions
diff --git a/common/html-coverpage/static/rtems/js/catalogue.js b/common/html-coverpage/static/rtems/js/catalogue.js
index d54def2..ae32aed 100644
--- a/common/html-coverpage/static/rtems/js/catalogue.js
+++ b/common/html-coverpage/static/rtems/js/catalogue.js
@@ -29,48 +29,51 @@ function catalogueFooter() {
'</table>\n';
}
-function loadCatalogue(path) {
+function paintCatalogue(xml) {
var el_cat_title = $('#rtems-catalogue-title');
var el_cat = $('#rtems-catalogue');
+ /*
+ * Use jquery as XMLDocument is consider not stable on Firefox's web site.
+ */
+ var pdfIcon = 'static/images/Adobe_PDF_file_icon_32x32.png';
+ var htmlIcon = 'static/images/html-xxl.png';
+ var docs = $(xml).find('rtems-docs');
+ var date = $(docs).attr('date');
+ var title = $(docs).find('catalogue');
+ var table = catalogueHeader(date);
+ $(docs).find('doc').each(function() {
+ var name = $(this).find('name').text();
+ var title = $(this).find('title').text();
+ var release = $(this).find('release').text();
+ var version = $(this).find('version').text();
+ var html = $(this).find('html').text();
+ var pdf = $(this).find('pdf').text();
+ var singlehtml = $(this).find('singlehtml').text();
+ var empty = '<td></a></td>\n';
+ table += '<tr>\n';
+ if (html)
+ table += '<td><a href="' + html + '">' + title + '</a></td>\n';
+ else
+ table += empty;
+ if (pdf)
+ table += '<td><a href="' + '/' + pdf + '">' +
+ '<img src="' + pdfIcon + '" width="20" height="20"></a></td>\n';
+ else
+ table += empty;
+ if (singlehtml)
+ table += '<td><a href="' + '/' + singlehtml + '">' +
+ '<img src="' + htmlIcon + '" width="20" height="20"></a></td>\n';
+ else
+ table += empty;
+ table += '</tr>\n';
+ });
+ table += catalogueFooter();
+ el_cat_title.html('<h3>' + $(title).text() + '</h3>');
+ el_cat.html(table);
+}
+function loadCatalogue(path) {
var f = $.get(path, function(xml) {
- /*
- * Use jquery as XMLDocument is consider not stable on Firefox's web site.
- */
- var pdfIcon = 'static/images/Adobe_PDF_file_icon_32x32.png';
- var htmlIcon = 'static/images/html-xxl.png';
- var docs = $(xml).find('rtems-docs');
- var date = $(docs).attr('date');
- var title = $(docs).find('catalogue');
- var table = catalogueHeader(date);
- $(docs).find('doc').each(function() {
- var name = $(this).find('name').text();
- var title = $(this).find('title').text();
- var release = $(this).find('release').text();
- var version = $(this).find('version').text();
- var html = $(this).find('html').text();
- var pdf = $(this).find('pdf').text();
- var singlehtml = $(this).find('singlehtml').text();
- var empty = '<td></a></td>\n';
- table += '<tr>\n';
- if (html)
- table += '<td><a href="' + html + '">' + title + '</a></td>\n';
- else
- table += empty;
- if (pdf)
- table += '<td><a href="' + '/' + pdf + '">' +
- '<img src="' + pdfIcon + '" width="20" height="20"></a></td>\n';
- else
- table += empty;
- if (singlehtml)
- table += '<td><a href="' + '/' + singlehtml + '">' +
- '<img src="' + htmlIcon + '" width="20" height="20"></a></td>\n';
- else
- table += empty;
- table += '</tr>\n';
- });
- table += catalogueFooter();
- el_cat_title.html('<h3>' + $(title).text() + '</h3>');
- el_cat.html(table);
+ paintCatalogue(xml);
}, 'xml');
}