Devel-hdb
view release on metacpan or search on metacpan
lib/Devel/hdb/html/debugger.js view on Meta::CPAN
function Debugger(sel) {
var dbg = this;
var $elt = this.$elt = $(sel);
var perlVarPopoverDelay = 400; // Time in ms the mouse has to rest over a variable before it gets the value
this.filewindowDiv = $elt.find('div#filewindow');
this.stackDiv = $elt.find('div#stack');
this.watchDiv = $elt.find('div#watch-expressions');
// templates
Handlebars.registerHelper('ifDefined', function(val, options) {
if ((val !== undefined) && (val !== null) && (val !== '')) {
return options.fn(this)
} else {
return options.inverse(this);
}
});
Handlebars.registerPartial('breakpoint-code-template', $('#breakpoint-code-template').html() );
Handlebars.registerPartial('action-code-template', $('#action-code-template').html() );
Handlebars.registerPartial('breakpoint-right-click-template', $('#breakpoint-right-click-template').html() );
this.templates = {
fileTab: Handlebars.compile( $('#file-tab-template').html() ),
navTab: Handlebars.compile( $('#nav-tab-template').html() ),
navPane: Handlebars.compile( $('#nav-pane-template').html() ),
currentSubAndArgs: Handlebars.compile( $('#current-sub-and-args-template').html() ),
breakpointRightClickMenu: Handlebars.compile( $('#breakpoint-right-click-template').html() ),
saveLoadBreakpointsModal: Handlebars.compile($('#save-load-breakpoints-modal-template').html() ),
subPickerTemplate: Handlebars.compile($('#sub-picker-template').html() ),
quickBreakpointModal: Handlebars.compile($('#quick-breakpoint-entry-template').html() ),
};
// The step in, over, run buttons
var $control_buttons = this.$control_buttons = $('.control-button').attr('disabled',true);
var restInterface = this.restInterface = new RestInterface('');
function whenStackTabIsShown($elt, cb) {
var stackId = $elt.closest('.tab-pane').attr('id'),
relatedTab = $('#stack-tabs a[href="#'+stackId+'"]');
relatedTab.on('shown.whenStackTabIsShown', function(e) {
// This cb is fired both when the active tab is switched, and during
// mouseover of the tab - the latter may be a bug in Bootstrap
// relatedTarget is true when the anchor was actually clicked, and
// refers to what was previously the active tab.
// relatedTarget is undefined during mouseover of the anchor
if (e.relatedTarget) {
relatedTab.off('shown.whenStackTabIsShown');
cb();
}
});
}
// Called for each .managed-height element when the window resizes
// Set the height so the the bottom of the element is the bottom of the
// window. This makes the scroll bar work for that element
function setElementHeight() {
var $elt = $(this),
offset = $elt.offset(),
height;
if ($elt.hasClass('program-code-container') && offset && offset.top === 0) {
// This one is invisible. Find which code pane is visible and copy it's height
height = $('.program-code-container')
.filter(function() { return $(this).css('display') === 'block' })
.css('height');
} else {
// setting the element's height does not account for any padding
// .css('padding-top') returns a string like "14px", so we need to slice off
// the last 2 chars
var padding = parseInt( $elt.css('padding-top').slice(0, -2))
+
parseInt( $elt.css('padding-bottom').slice(0, -2));
height = ( $(window).height() - $elt.offset().top - padding ) + 'px';
}
$elt.css({'height': height});
};
function _tab_mapper(a) { return [ a, parseInt(a.getAttribute('data-frameno')) ]; }
function _tab_sorter(a,b) { return ( a[1] - b[1] ) }
function _tab_unmapper(a) { return a[0] }
this.stackFrameChanged = function(frame_obj, old_frameno, new_frameno) {
var $tabs = this.stackDiv.find('ul.nav'),
$tab = $tabs.find('#tab-' + frame_obj.serial),
$panes = this.stackDiv.find('div.tab-content'),
$codePane = $panes.find('#pane-' + frame_obj.serial);
( run in 1.857 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )