/*! * Catalogue 0.1 * Copyright 2017 Chris Johns * Licensed under the MIT license */ function catalogueHeader(id, title, date) { return '' + '
' + ' ' + ' ' + ' ' + ' ' + ' \n' + ' \n' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
' + date + '' + title + '
' + '
' + ' ' + ' ' + ' '; } function catalogueFooter() { return '' + ' ' + '
OnlinePDFSingle Page
' + '
' + '
' + '
'; } function panel_handlers(tag, id, show) { $('#' + id + '1').on('shown.bs.collapse', function () { $("#" + id + " i.indicator").removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down"); var top = $('#rtems-catalogue-' + tag).offset().top; $('html, body').animate({ scrollTop: top }, 500); }); $('#' + id + '1').on('hidden.bs.collapse', function () { $("#" + id + " i.indicator").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up"); }); if (show == true) $('#' + id + '1').collapse('show'); } function paintCatalogue(xml, path, tag, doxygen, show) { var el_cat = $('#rtems-catalogue-' + tag); if (path.slice(-1) != '/') path = path + '/'; /* * Use jquery as XMLDocument is consider not stable on Firefox's web site. */ var pdfIcon = 'static/img/Adobe_PDF_file_icon_32x32.png'; var htmlIcon = 'static/img/html-xxl.png'; var docs = $(xml).find('rtems-docs'); var date = $(docs).attr('date'); var title = $(docs).find('catalogue'); var id = title.text().replace(/\.| |\(|\)|\[|\]/g, '_'); var table = catalogueHeader(id, title.text(), date); var empty = '\n'; $(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(); table += '\n'; if (html) table += '' + title + '\n'; else table += empty; if (pdf) table += '' + '\n'; else table += empty; if (singlehtml) table += '' + '\n'; else table += empty; table += '\n'; }); if (doxygen == true) { table += '\n'; table += 'RTEMS CPU Kit Doxygen\n'; table += empty; table += empty; table += '\n'; } table += catalogueFooter(); el_cat.html(table); panel_handlers(tag, id, show); } function loadCatalogue(catalogue, path, tag, show) { var f = $.get(catalogue, function(xml) { paintCatalogue(xml, path, tag, show); }, 'xml'); }