Skip to content

Commit

Permalink
Added legacy check for options objects that follow the format of 0.8.…
Browse files Browse the repository at this point in the history
…4 and earlier.
  • Loading branch information
Roundaround committed May 11, 2015
1 parent ef3916f commit db8723c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/jquery.flot.tooltip.source.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
}
};

// dummy default options object for legacy code (<0.8.5) - is deleted later
defaultOptions.tooltipOpts = defaultOptions.tooltip;

// object
var FlotTooltip = function (plot) {
// variables
Expand Down Expand Up @@ -59,6 +62,13 @@
// get plot options
that.plotOptions = plot.getOptions();

// for legacy (<0.8.5) implementations
if (typeof(that.plotOptions.tooltip) === 'boolean') {
that.plotOptions.tooltipOpts.show = that.plotOptions.tooltip;
that.plotOptions.tooltip = that.plotOptions.tooltipOpts;
delete that.plotOptions.tooltipOpts;
}

// if not enabled return
if (that.plotOptions.tooltip.show === false || typeof that.plotOptions.tooltip.show === 'undefined') return;

Expand Down

0 comments on commit db8723c

Please sign in to comment.