// use this to isolate the scope (function () { var SHOW_HIDE_ANIMATION_DURATION = 0; $(document).ready(function () { $axure.player.createPluginHost({ id: 'sitemapHost', context: 'interface', title: 'Sitemap' }); generateSitemap(); $('.sitemapPlusMinusLink').toggle(collapse_click, expand_click); $('.sitemapPageLink').click(node_click); $('#sitemapLinksAndOptionsContainer').hide(); $('#sitemapToggleLinks').click(links_click); $('.sitemapLinkField').click(function () { this.select() }); // $('#sitemapHost').parent().resize(function () { // $('#sitemapHost').height($(this).height()); // }); // bind to the page load $axure.page.bind('load.sitemap', function () { var pageLoc = $axure.page.location.split("#")[0]; var decodedPageLoc = decodeURI(pageLoc); var nodeUrl = decodedPageLoc.substr(decodedPageLoc.lastIndexOf('/') ? decodedPageLoc.lastIndexOf('/') + 1 : 0); $('.sitemapPageLink').removeClass('sitemapHighlight'); $('.sitemapPageLink[nodeUrl="' + nodeUrl + '"]').addClass('sitemapHighlight'); $('#sitemapLinksPageName').html('Links to ' + $('.sitemapHighlight > .sitemapPageName').html()); var playerLoc = $(location).attr('href').split("#")[0].split("?")[0]; var qString = "?Page=" + nodeUrl.substr(0, nodeUrl.lastIndexOf('.')); $('#sitemapLinkWithPlayer').val(playerLoc + qString); $('#sitemapLinkWithoutPlayer').val(pageLoc); $('#sitemapClosePlayer').unbind('click'); $('#sitemapClosePlayer').click(function () { window.location.href = pageLoc; }); return false; }); }); function collapse_click(event) { $(this) .children('.sitemapMinus').removeClass('sitemapMinus').addClass('sitemapPlus').end() .closest('li').children('ul').hide(SHOW_HIDE_ANIMATION_DURATION); } function expand_click(event) { $(this) .children('.sitemapPlus').removeClass('sitemapPlus').addClass('sitemapMinus').end() .closest('li').children('ul').show(SHOW_HIDE_ANIMATION_DURATION); } function node_click(event) { var preserveVars = !$('#sitemapVariableOption').is(':checked'); $axure.page.navigate(this.getAttribute('nodeUrl'), preserveVars); } function links_click(event) { $('#sitemapLinksAndOptionsContainer').toggle(); if ($('#sitemapLinksAndOptionsContainer').is(":visible")) { $('#sitemapToggleLinks').html('Hide Links and Options'); } else { $('#sitemapToggleLinks').html('Show Links and Options'); } } function generateSitemap() { var treeUl = "