Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit 40f79c2

Browse files
authored
Merge pull request #114 from Idrinth/idrinth
Fixes #113
2 parents 52b9439 + 456b343 commit 40f79c2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

stable.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,12 @@ var idrinth = {
479479
showTooltip: function ( element ) {
480480
'use strict';
481481
function tooltip ( set, element, pos, guilds, platform ) {
482-
idrinth.names.isHovering = false;
483482
if ( !set ) {
484-
idrinth.ui.updateClassesList ( idrinth.ui.tooltip, [ 'idrinth-hide' ], [ ] );
483+
idrinth.ui.updateClassesList ( element, [ 'idrinth-hide' ], [ ] );
485484
return;
486485
}
487486
idrinth.ui.updateClassesList ( idrinth.ui.tooltip, [ ], [ 'idrinth-hide' ] );
487+
idrinth.ui.updateClassesList ( element, [ ], [ 'idrinth-hide' ] );
488488
element.childNodes[0].setAttribute ( 'href', 'https://dotd.idrinth.de/' + platform + '/summoner/' + set.id + '/' );
489489
element.childNodes[0].innerHTML = set.name;
490490
element.childNodes[1].childNodes[1].innerHTML = set.level + ' (' + set['7day'] + '/week, ' + set['30day'] + '/month)';
@@ -495,21 +495,19 @@ var idrinth = {
495495
element.childNodes[3].setAttribute ( 'style', ( new Date () ) - ( new Date ( set.updated ) ) > 86400000 ? 'color:#aa0000;' : '' );
496496
idrinth.ui.tooltip.setAttribute ( 'style', 'left:' + Math.round ( pos.left - 200 ) + 'px;top:' + Math.round ( pos.top - 100 ) + 'px;' );
497497
}
498-
var pos = null;
498+
idrinth.names.isHovering = false;
499499
var name = idrinth.names.parse ( element ).toLowerCase ( );
500500
if ( idrinth.settings.names && idrinth.ui.tooltip && idrinth.names.users[name] ) {
501501
window.clearTimeout ( idrinth.ui.tooltipTO );
502-
pos = element.getBoundingClientRect ( );
502+
var pos = element.getBoundingClientRect ( );
503503
tooltip ( idrinth.names.users[name].kongregate, idrinth.ui.tooltip.firstChild, pos, idrinth.names.guilds.kongregate, 'kongregate' );
504504
tooltip ( idrinth.names.users[name].world, idrinth.ui.tooltip.lastChild, pos, idrinth.names.guilds.world, 'world-kongregate' );
505-
var delay = idrinth.settings.timeout ? idrinth.settings.timeout : 5000;
506-
idrinth.ui.tooltipTO = window.setTimeout ( idrinth.ui.hideTooltip, delay );
505+
idrinth.ui.tooltipTO = window.setTimeout ( idrinth.ui.hideTooltip, idrinth.settings.timeout ? idrinth.settings.timeout : 5000 );
507506
}
508507
},
509508
hideTooltip: function () {
510509
if ( idrinth.names.isHovering ) {
511-
var delay = idrinth.settings.timeout ? idrinth.settings.timeout : 5000;
512-
idrinth.ui.tooltipTO = window.setTimeout ( idrinth.ui.hideTooltip, delay );
510+
idrinth.ui.tooltipTO = window.setTimeout ( idrinth.ui.hideTooltip, idrinth.settings.timeout ? idrinth.settings.timeout : 5000 );
513511
return;
514512
}
515513
idrinth.ui.updateClassesList ( idrinth.ui.tooltip, [ 'idrinth-hide' ], [ ] );
@@ -574,7 +572,7 @@ var idrinth = {
574572
var forceToArray = function ( value ) {
575573
return value && typeof value === 'object' && Array.isArray ( value ) ? value : [ ];
576574
};
577-
var original = classString.split ( ' ' ).concat ( forceToArray ( add ) );
575+
var original = classString === null ? [ ] : classString.split ( ' ' ).concat ( forceToArray ( add ) );
578576
var list = [ ];
579577
remove = forceToArray ( remove );
580578
var addUnique = function ( list, element, forbidden ) {

0 commit comments

Comments
 (0)