Commit d548f3ee authored by Jack Davison's avatar Jack Davison

Replace resetTooltip with bootstrap's fixTitle

* resetTooltip totally destroyed and regenerated the
  tooltip while fixTitle simply replaces the text in
  the existing element.

* resetTooltip also called an asyncronous function
  with no suitable callback resulting in a messy
  setTimout workaround. fixTitle is syncronous.
parent 9250953a
...@@ -220,13 +220,13 @@ ...@@ -220,13 +220,13 @@
originalTitle = this.getAwardTooltip(awardBlock); originalTitle = this.getAwardTooltip(awardBlock);
authors = originalTitle.split(FROM_SENTENCE_REGEX); authors = originalTitle.split(FROM_SENTENCE_REGEX);
authors.splice(authors.indexOf('You'), 1); authors.splice(authors.indexOf('You'), 1);
awardBlock return awardBlock
.closest('.js-emoji-btn') .closest('.js-emoji-btn')
.removeData('title') .removeData('title')
.removeAttr('data-title') .removeAttr('data-title')
.removeAttr('data-original-title') .removeAttr('data-original-title')
.attr('title', this.toSentence(authors)); .attr('title', this.toSentence(authors))
return this.resetTooltip(awardBlock); .tooltip('fixTitle');
}; };
AwardsHandler.prototype.addYouToUserList = function(votesBlock, emoji) { AwardsHandler.prototype.addYouToUserList = function(votesBlock, emoji) {
...@@ -238,17 +238,9 @@ ...@@ -238,17 +238,9 @@
users = origTitle.trim().split(FROM_SENTENCE_REGEX); users = origTitle.trim().split(FROM_SENTENCE_REGEX);
} }
users.unshift('You'); users.unshift('You');
awardBlock.attr('title', this.toSentence(users)); return awardBlock
return this.resetTooltip(awardBlock); .attr('title', this.toSentence(users))
}; .tooltip('fixTitle');
AwardsHandler.prototype.resetTooltip = function(award) {
var cb;
award.tooltip('destroy');
cb = function() {
return award.tooltip();
};
return setTimeout(cb, 200);
}; };
AwardsHandler.prototype.createEmoji_ = function(votesBlock, emoji) { AwardsHandler.prototype.createEmoji_ = function(votesBlock, emoji) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment