// use this to isolate the scope (function() { var SHOW_HIDE_ANIMATION_DURATION = 0; var HIGHLIGHT_INTERACTIVE_VAR_NAME = 'hi'; var FOOTNOTES_VAR_NAME = 'fn'; var SITEMAP_COLLAPSE_VAR_NAME = 'c'; var ADAPTIVE_VIEW_VAR_NAME = 'view'; var currentPageLoc = ''; var currentPlayerLoc = ''; var currentPageHashString = ''; $(window.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(); $('#searchDiv').hide(); $('#linksButton').click(links_click); $('#adaptiveButton').click(adaptive_click); $('#footnotesButton').click(footnotes_click).addClass('sitemapToolbarButtonSelected'); $('#highlightInteractiveButton').click(highlight_interactive); $('#variablesButton').click(showvars_click); $('#variablesClearLink').click(clearvars_click); $('#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, #footnotesBox, #highlightBox').change(sitemapUrlOptions_change); $('#viewSelect').change(sitemapUrlViewSelect_change); // $('#sitemapHost').parent().resize(function () { // $('#sitemapHost').height($(this).height()); // }); // bind to the page load $axure.page.bind('load.sitemap', function() { currentPageLoc = $axure.page.location.split("#")[0]; var decodedPageLoc = decodeURI(currentPageLoc); var nodeUrl = decodedPageLoc.substr(decodedPageLoc.lastIndexOf('/') ? decodedPageLoc.lastIndexOf('/') + 1 : 0); var nextPlayerLoc = $(location).attr('href').split("#")[0].split("?")[0]; var nextPageHashString = '#p=' + nodeUrl.substr(0, nodeUrl.lastIndexOf('.')); if(nextPlayerLoc == currentPlayerLoc && nextPageHashString == currentPageHashString) return; currentPlayerLoc = nextPlayerLoc; currentPageHashString = nextPageHashString; setVarInCurrentUrlHash('p', nodeUrl.substring(0, nodeUrl.lastIndexOf('.html'))); $('.sitemapPageLink').parent().parent().removeClass('sitemapHighlight'); $('.sitemapPageLink[nodeUrl="' + nodeUrl + '"]').parent().parent().addClass('sitemapHighlight'); $('#sitemapLinksPageName').html($('.sitemapHighlight > .sitemapPageLinkContainer > .sitemapPageLink > .sitemapPageName').html()); //Click the "With sitemap" radio button so that it's selected by default $('input[value="withmap"]').click(); //Update variable div with latest global variable values after page has loaded $axure.messageCenter.postMessage('getGlobalVariables', ''); //If footnotes enabled for this prototype... if($axure.document.configuration.showAnnotations == true) { //If the fn var is defined and set to 0, hide footnotes //else if hide-footnotes button selected, hide them var fnVal = getHashStringVar(FOOTNOTES_VAR_NAME); if(fnVal.length > 0 && fnVal == 0) { $('#footnotesButton').removeClass('sitemapToolbarButtonSelected'); $axure.messageCenter.postMessage('annotationToggle', false); } else if(!$('#footnotesButton').is('.sitemapToolbarButtonSelected')) { //If the footnotes button isn't selected, hide them on this loaded page $axure.messageCenter.postMessage('annotationToggle', false); } } //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 { setVarInCurrentUrlHash(ADAPTIVE_VIEW_VAR_NAME, 'auto'); } } else if($('.checkedAdaptive').length > 0) { var $viewOption = $('.checkedAdaptive').parents('.adaptiveViewOption'); if($viewOption.attr('val') != 'auto') { $viewOption.click(); } } var main = $('#mainFrame'); if(document.activeElement != main[0]) main.focus(); 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('