Total Complexity | 5 |
Complexity/F | 1.67 |
Lines of Code | 33 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | (function($) { |
||
2 | 'use strict'; |
||
3 | |||
4 | $(function() { |
||
5 | /* Code for attribute data-custom-class for adding custom class to tooltip */ |
||
6 | if (typeof $.fn.tooltip.Constructor === 'undefined') { |
||
7 | throw new Error('Bootstrap Tooltip must be included first!'); |
||
8 | } |
||
9 | |||
10 | var Tooltip = $.fn.tooltip.Constructor; |
||
11 | |||
12 | // add customClass option to Bootstrap Tooltip |
||
13 | $.extend(Tooltip.Default, { |
||
14 | customClass: '' |
||
15 | }); |
||
16 | |||
17 | var _show = Tooltip.prototype.show; |
||
18 | |||
19 | Tooltip.prototype.show = function() { |
||
20 | |||
21 | // invoke parent method |
||
22 | _show.apply(this, Array.prototype.slice.apply(arguments)); |
||
23 | |||
24 | if (this.config.customClass) { |
||
25 | var tip = this.getTipElement(); |
||
26 | $(tip).addClass(this.config.customClass); |
||
27 | } |
||
28 | |||
29 | }; |
||
30 | $('[data-toggle="tooltip"]').tooltip(); |
||
31 | |||
32 | }); |
||
33 | })(jQuery); |