diff --git a/roles/apps-fp-o/files/fedmenu-staging/js/fedmenu.js b/roles/apps-fp-o/files/fedmenu-staging/js/fedmenu.js index cc21f03422..2e36f9b3e9 100644 --- a/roles/apps-fp-o/files/fedmenu-staging/js/fedmenu.js +++ b/roles/apps-fp-o/files/fedmenu-staging/js/fedmenu.js @@ -25,7 +25,11 @@ var fedmenu = function(options) { $(document).ready(function() { var script = $("script[src$='fedmenu.js']").attr('src'); var base = script.slice(0, -13); - $('body', c).append(''); + // Add a
section if one doesn't exist. + // https://github.com/fedora-infra/fedmenu/issues/6 + if ($('head', c).length == 0) $('html', c).append(''); + $('head', c).append(''); + $('body', c).append( ' '); @@ -125,6 +129,36 @@ var fedmenu = function(options) { $(document).ready(function() { 'package': make_package_content_html, }; + // Figure out the current site that we're on, if possible, and return the + // data we have on it from the json we loaded. + var get_current_site = function() { + var found = null; + var ours = window.location.toString(); + ours = ours.slice(ours.indexOf('://') + 3) + $.each(master_data, function(i, node) { + $.each(node.children, function(j, leaf) { + var theirs = leaf.data.url; + theirs = theirs.slice(theirs.indexOf('://') + 3) + if (theirs.indexOf(ours) === 0) found = leaf; + }) + }); + return found; + } + + // Try to construct a little footer for the menus. + var add_footer_links = function() { + var site = get_current_site(); + var content = ""; + if (site != null && site.data.bugs_url != undefined && site.data.source_url != undefined) { + content = content + "Problems with " + site.name + + "? Please file bugs or check out the source."; + } + content = content + "" + content + "