$.ajax({ url: "https://longpaddock.qld.gov.au/qld-future-climate/index.html", type: "GET", success: function(result) { var $root = $('
', { html: result }); var $items = $root.find('.navbar-static-top'); $items.find('a').each(function() { var href = $(this).attr('href'); if (!href.includes('http')) { href = "https://longpaddock.qld.gov.au" + href; $(this).attr('href', href); } }); var $loc = location.pathname.replace(/\//g, ''); var $sidebaritems = $root.find('#sidebar>ul'); $sidebaritems.find('a').each(function() { var href = $(this).attr('href'); if (!href.includes('http')) { href = "https://longpaddock.qld.gov.au" + href; $(this).attr('href', href); } else if (href.includes($loc)) { var $spans = $(this).find('span'); if ($spans.length > 0) $spans.addClass('active'); else $(this).wrapInner(""); $(this).addClass('active'); if ($loc == 'CCCS') { $('
  • User Guide
  • ').insertAfter($(this).parent()); } } }); var $sidebar = $sidebaritems.get(0).innerHTML; var $nav = $('.lp-navigation'); if ($nav.length > 0) { if ($nav.get(0).hasAttribute('data-adddrop')) { $last = $items.find('#nav-bottom>li:contains("Queensland Future Climate"):last'); if ($last.length <= 0) { $last = $items.find('#nav-bottom>li:contains("Climate Adaptation"):last'); } if ($last.length > 0) { $last.addClass('active dropdown'); $last.html('Queensland Future Climate' + ''); } } $nav.append($items); } var $foot = $root.find('.footer>div'); $('.footer').append($foot); $('.last-updated').html(' Last updated: 31 October 2018' + '
    ' + '' + 'Creative Commons Attribution 4.0 International (CC BY 4.0)' + '
    '); $('#lp-dropdown').html($sidebar); }, failure: function(errMsg) { alert(errMsg); } });