var currentNodeUrl = '';
var allNodeUrls = [];
function openNextPage() {
var index = allNodeUrls.indexOf(currentNodeUrl) + 1;
if(index >= allNodeUrls.length) return;
var nextNodeUrl = allNodeUrls[index];
$('.sitemapPageLink[nodeUrl="' + nextNodeUrl + '"]').click();
}
function openPreviousPage() {
var index = allNodeUrls.indexOf(currentNodeUrl) - 1;
if(index < 0) return;
var nextNodeUrl = allNodeUrls[index];
$('.sitemapPageLink[nodeUrl="' + nextNodeUrl + '"]').click();
}
// use this to isolate the scope
(function() {
var SHOW_HIDE_ANIMATION_DURATION = 0;
var HIGHLIGHT_INTERACTIVE_VAR_NAME = 'hi';
var currentPageLoc = '';
var currentPlayerLoc = '';
var currentPageHashString = '';
$(window.document).ready(function() {
$axure.player.createPluginHost({
id: 'sitemapHost',
context: 'interface',
title: 'PAGES',
gid: 1
});
generateSitemap();
$('.sitemapPlusMinusLink').toggle(collapse_click, expand_click);
$('.sitemapPageLink').click(node_click);
$('#sitemapLinksContainer').hide();
$('#linksButton').click(links_click);
$('#adaptiveButton').click(adaptive_click);
$('#adaptiveViewsContainer').hide();
$('#highlightInteractiveButton').click(highlight_interactive);
$('#searchButton').click(search_click);
$('#searchBox').keyup(search_input_keyup);
$('.sitemapLinkField').click(function() { this.select(); });
$('input[value="withoutmap"]').click(withoutSitemapRadio_click);
$('input[value="withmap"]').click(withSitemapRadio_click);
$('#minimizeBox, #collapseBox, #footnotesBox, #highlightBox').change(sitemapUrlOptions_change);
$('#viewSelect').change(sitemapUrlViewSelect_change);
$(document).on('ContainerHeightChange', function() {
updateContainerHeight();
});
// bind to the page load
$axure.page.bind('load.sitemap', function() {
currentPageLoc = $axure.page.location.split("#")[0];
var decodedPageLoc = decodeURI(currentPageLoc);
currentNodeUrl = decodedPageLoc.substr(decodedPageLoc.lastIndexOf('/') ? decodedPageLoc.lastIndexOf('/') + 1 : 0);
currentPlayerLoc = $(location).attr('href').split("#")[0].split("?")[0];
currentPageHashString = '#p=' + currentNodeUrl.substr(0, currentNodeUrl.lastIndexOf('.'));
setVarInCurrentUrlHash('p', currentNodeUrl.substring(0, currentNodeUrl.lastIndexOf('.html')));
$('.sitemapPageLink').parent().parent().removeClass('sitemapHighlight');
$('.sitemapPageLink[nodeUrl="' + currentNodeUrl + '"]').parent().parent().addClass('sitemapHighlight');
var pageName = $axure.page.pageName;
$('.pageNameHeader').html(pageName);
$('#sitemapLinksPageName').html($('.sitemapHighlight > .sitemapPageLinkContainer > .sitemapPageLink > .sitemapPageName').html());
//Click the "Without sitemap" radio button so that it's selected by default
$('input[value="withoutmap"]').click();
//If highlight var is present and set to 1 or else if
//sitemap highlight button is selected then highlight interactive elements
var hiVal = getHashStringVar(HIGHLIGHT_INTERACTIVE_VAR_NAME);
if(hiVal.length > 0 && hiVal == 1) {
$('#highlightInteractiveButton').addClass('sitemapToolbarButtonSelected');
$axure.messageCenter.postMessage('highlightInteractive', true);
} else if($('#highlightInteractiveButton').is('.sitemapToolbarButtonSelected')) {
$axure.messageCenter.postMessage('highlightInteractive', true);
}
//Set the current view if it is defined in the hash string
//If the view is invalid, set it to 'auto' in the string
//ELSE set the view based on the currently selected view in the toolbar menu
var viewStr = getHashStringVar(ADAPTIVE_VIEW_VAR_NAME);
if(viewStr.length > 0) {
var $view = $('.adaptiveViewOption[val="' + viewStr + '"]');
if($view.length > 0) $view.click();
else $('.adaptiveViewOption[val="auto"]').click();
} else if($('.checkedAdaptive').length > 0) {
var $viewOption = $('.checkedAdaptive').parents('.adaptiveViewOption');
if($viewOption.attr('val') != 'auto') $viewOption.click();
}
$axure.messageCenter.postMessage('finishInit');
return false;
});
var $adaptiveViewsContainer = $('#adaptiveViewsContainer');
var $viewSelect = $('#viewSelect');
//Fill out adaptive view container with prototype's defined adaptive views, as well as the default, and Auto
$adaptiveViewsContainer.append('
Auto
');
$viewSelect.append('');
if(typeof $axure.document.defaultAdaptiveView.name != 'undefined') {
//If the name is a blank string, make the view name the width if non-zero, else 'any'
var defaultViewName = $axure.document.defaultAdaptiveView.name;
$adaptiveViewsContainer.append('