Skip to content

Commit da3ad00

Browse files
committed
Replace Tipsy by Bootstrap's tooltips
Signed-off-by: Rémy Coutable <[email protected]>
1 parent 4705445 commit da3ad00

File tree

4 files changed

+10
-55
lines changed

4 files changed

+10
-55
lines changed

app/assets/javascripts/peek.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'vendor/jquery.tipsy';
21
import 'vendor/peek';
32
import 'vendor/peek.performance_bar';
43
import 'vendor/peek.rblineprof';

vendor/assets/javascripts/peek.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var requestId;
33
requestId = null;
44

55
(function($) {
6-
var fetchRequestResults, getRequestId, initializeTipsy, peekEnabled, toggleBar, updatePerformanceBar;
6+
var fetchRequestResults, getRequestId, peekEnabled, toggleBar, updatePerformanceBar;
77
getRequestId = function() {
88
if (requestId != null) {
99
return requestId;
@@ -42,16 +42,6 @@ requestId = null;
4242
}
4343
return $(document).trigger('peek:render', [getRequestId(), results]);
4444
};
45-
initializeTipsy = function() {
46-
return $('#peek .peek-tooltip, #peek .tooltip').each(function() {
47-
var el, gravity;
48-
el = $(this);
49-
gravity = el.hasClass('rightwards') || el.hasClass('leftwards') ? $.fn.tipsy.autoWE : $.fn.tipsy.autoNS;
50-
return el.tipsy({
51-
gravity: gravity
52-
});
53-
});
54-
};
5545
toggleBar = function(event) {
5646
var wrapper;
5747
if ($(event.target).is(':input')) {
@@ -80,7 +70,6 @@ requestId = null;
8070
});
8171
};
8272
$(document).on('keypress', toggleBar);
83-
$(document).on('peek:update', initializeTipsy);
8473
$(document).on('peek:update', fetchRequestResults);
8574
$(document).on('pjax:end', function(event, xhr, options) {
8675
if (xhr != null) {

vendor/assets/javascripts/peek.performance_bar.js

+9-18
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,15 @@ PerformanceBar = (function() {
8585
width = this.mapH(time);
8686
title = name + ": " + (PerformanceBar.formatTime(time));
8787
bar = $('<li></li>', {
88-
title: title,
89-
"class": 'peek-tooltip'
88+
'data-title': title,
89+
'data-toggle': 'tooltip',
90+
'data-container': 'body'
9091
});
9192
bar.css({
9293
width: width + "px",
9394
left: left + "px",
9495
background: color
9596
});
96-
bar.tipsy({
97-
gravity: $.fn.tipsy.autoNS
98-
});
9997
return this.el.append(bar);
10098
};
10199

@@ -114,12 +112,10 @@ renderPerformanceBar = function() {
114112
bar = new PerformanceBar;
115113
bar.render(time);
116114
span = $('<span>', {
117-
'class': 'peek-tooltip',
118-
title: 'Total navigation time for this page.'
115+
'data-toggle': 'tooltip',
116+
'data-title': 'Total navigation time for this page.',
117+
'data-container': 'body'
119118
}).text(PerformanceBar.formatTime(bar.total()));
120-
span.tipsy({
121-
gravity: $.fn.tipsy.autoNS
122-
});
123119
return updateStatus(span);
124120
};
125121

@@ -168,12 +164,10 @@ $(document).on('pjax:end page:load turbolinks:load', function(event, xhr) {
168164
tech = 'Turbolinks';
169165
}
170166
span = $('<span>', {
171-
'class': 'peek-tooltip',
172-
title: tech + " navigation time"
167+
'data-toggle': 'tooltip',
168+
'data-title': tech + " navigation time",
169+
'data-container': 'body'
173170
}).text(PerformanceBar.formatTime(total));
174-
span.tipsy({
175-
gravity: $.fn.tipsy.autoNS
176-
});
177171
updateStatus(span);
178172
return ajaxStart = null;
179173
}, 0);
@@ -186,6 +180,3 @@ $(function() {
186180
return $('#peek-view-performance-bar').remove();
187181
}
188182
});
189-
190-
// ---
191-
// generated by coffee-script 1.9.2

vendor/assets/stylesheets/peek.scss

-24
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,5 @@
8686
}
8787

8888
#modal-peek-pg-queries-content {
89-
// background: #999;
9089
color: #000;
9190
}
92-
93-
.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; }
94-
.tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; }
95-
96-
/* Rounded corners */
97-
.tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
98-
99-
.tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
100-
101-
/* Rules to colour arrows */
102-
.tipsy-arrow-n { border-bottom-color: #000; }
103-
.tipsy-arrow-s { border-top-color: #000; }
104-
.tipsy-arrow-e { border-left-color: #000; }
105-
.tipsy-arrow-w { border-right-color: #000; }
106-
107-
.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
108-
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
109-
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
110-
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
111-
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
112-
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
113-
.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
114-
.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }

0 commit comments

Comments
 (0)