-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookmarklet.js
32 lines (31 loc) · 1.37 KB
/
bookmarklet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// This code is used to create the tooltip bookmarklet to show the mapping of
// salesforce fields => fields displayed on the listing page
// http://ted.mielczarek.org/code/mozilla/bookmarklet.html
addTooltipsToChildren = function(children) { angular.forEach(children, function(e) {
el = angular.element(e);
if (el.data().$binding) bind = el.data().$binding;
else bind = null;
if (!bind && el.attr('ng-text-truncate')) {
bind = el.attr('ng-text-truncate');
if (el.children().length) el = angular.element(el.children()[0]);
}
if (bind && bind != 'heading') {
if (/^\s+$/.test(el.text()) || !el.text()) {
el.text('<No value provided>');
el.css('display', 'block').removeClass('ng-hide');
}
bind = bind.toString();
bind = bind.split(' | ')[0];
if (bind.indexOf('listing.') == 0) bind = bind.slice('listing.'.length);
el.css({'text-decoration': 'underline', 'cursor': 'help', 'color': '#DB790F' });
el.after('<span class="tooltip tip-left" style="left:0"><span>'+bind+'</span></span>');
el.bind('click', function(ev) {
ev.stopPropagation();
tip = angular.element(ev.target).next();
if (tip.css('display') != 'block') tip.css({display: 'block'});
else tip.css({display: 'none'});
})
}
if (el.children()) addTooltipsToChildren(el.children());
}) };
addTooltipsToChildren(angular.element(document).children());