// use this to isolate the scope (function () { if(!$axure.document.configuration.showConsole) { return; } $(document).ready(function () { $axure.player.createPluginHost({ id: 'debugHost', context: 'interface', title: 'CONSOLE', gid: 3 }); generateDebug(); $('#variablesClearLink').click(clearvars_click); $('#traceClearLink').click(cleartrace_click); $(document).on('ContainerHeightChange', function () { updateContainerHeight(); }); //$('#traceContainer').hide(); //$('#debugTraceLink').click(function () { // $('#variablesContainer').hide(); // $('#traceContainer').show(); //}); //$('#debugVariablesLink').click(function () { // $('#variablesContainer').show(); // $('#traceContainer').hide(); //}); var currentStack= []; var finishedStack = []; $axure.messageCenter.addMessageListener(function (message, data) { if(message == 'globalVariableValues') { //If variables container isn't visible, then ignore //if(!$('#variablesContainer').is(":visible")) { // return; //} $('#variablesDiv').empty(); for(var key in data) { var value = data[key] == '' ? '(blank)' : data[key]; $('#variablesDiv').append('
' + key + '
' + value + '
'); } } if(message == 'setGlobalVar') { //$('#variablesContainer').html(""); //for (var variable in $axure.globalVariableProvider.getDefinedVariables) { // $('#variablesContainer').append("
" + variable + "
"); // $('#variablesContainer').append("
" + $axure.globalVariableProvider.getVariableValue(variable) + "
"); //} } else if(message == 'axEvent') { var addToStack = "
"; addToStack += "
" + new Date().toLocaleTimeString() + "
"; addToStack += "
" + data.label + " (" + data.type + ")
"; addToStack += "
" + data.event.description + "
"; currentStack.push(addToStack); } else if (message == 'axEventComplete') { currentStack[currentStack.length - 1] += "
"; finishedStack.push(currentStack.pop()); if(currentStack.length == 0) { $('#traceClearLinkContainer').show(); $('#traceEmptyState').hide(); $('.lastAxEvent').removeClass('lastAxEvent'); for(var i = finishedStack.length - 1; i >= 0; i--) { if($('#traceDiv').children().length > 99) $('#traceDiv').children().last().remove(); $('#traceDiv').prepend(finishedStack[i]); if(i == finishedStack.length - 1) $('#traceDiv').children().first().addClass('lastAxEvent'); } finishedStack = []; } } else if (message == 'axCase') { currentStack[currentStack.length - 1] += "
" + data.description + "
"; } else if (message == 'axAction') { currentStack[currentStack.length - 1] += "
" + data.description + "
"; } }); // bind to the page load $axure.page.bind('load.debug', function () { $axure.messageCenter.postMessage('getGlobalVariables', ''); return false; }); function clearvars_click(event) { $axure.messageCenter.postMessage('resetGlobalVariables', ''); } function cleartrace_click(event) { $('#traceDiv').html(''); $('#traceClearLinkContainer').hide(); $('#traceEmptyState').show(); } }); function updateContainerHeight() { $('#debugScrollContainer').height($('#debugHost').height() - $('#debugHeader').outerHeight()); } function generateDebug() { var pageNotesUi = "
"; pageNotesUi += "
"; pageNotesUi += "
CONSOLE
"; pageNotesUi += "
"; //pageNotesUi += "
"; //pageNotesUi += ""; //pageNotesUi += ""; //pageNotesUi += ""; //pageNotesUi += "
"; pageNotesUi += "
"; pageNotesUi += "
"; //var pageNotesUi = "
Variables | Trace
"; pageNotesUi += "
"; pageNotesUi += "
"; pageNotesUi += "
"; pageNotesUi += ""; pageNotesUi += "
"; pageNotesUi += "
"; pageNotesUi += "
"; pageNotesUi += ""; pageNotesUi += "
No interactions in the trace.
Triggered interactions will appear here.
"; pageNotesUi += "
"; pageNotesUi += "
"; $('#debugHost').html(pageNotesUi); updateContainerHeight(); $('#traceClearLinkContainer').hide(); $('#traceEmptyState').show(); } })();