@@ -479,12 +479,12 @@ var idrinth = {
479
479
showTooltip : function ( element ) {
480
480
'use strict' ;
481
481
function tooltip ( set , element , pos , guilds , platform ) {
482
- idrinth . names . isHovering = false ;
483
482
if ( ! set ) {
484
- idrinth . ui . updateClassesList ( idrinth . ui . tooltip , [ 'idrinth-hide' ] , [ ] ) ;
483
+ idrinth . ui . updateClassesList ( element , [ 'idrinth-hide' ] , [ ] ) ;
485
484
return ;
486
485
}
487
486
idrinth . ui . updateClassesList ( idrinth . ui . tooltip , [ ] , [ 'idrinth-hide' ] ) ;
487
+ idrinth . ui . updateClassesList ( element , [ ] , [ 'idrinth-hide' ] ) ;
488
488
element . childNodes [ 0 ] . setAttribute ( 'href' , 'https://dotd.idrinth.de/' + platform + '/summoner/' + set . id + '/' ) ;
489
489
element . childNodes [ 0 ] . innerHTML = set . name ;
490
490
element . childNodes [ 1 ] . childNodes [ 1 ] . innerHTML = set . level + ' (' + set [ '7day' ] + '/week, ' + set [ '30day' ] + '/month)' ;
@@ -495,21 +495,19 @@ var idrinth = {
495
495
element . childNodes [ 3 ] . setAttribute ( 'style' , ( new Date ( ) ) - ( new Date ( set . updated ) ) > 86400000 ? 'color:#aa0000;' : '' ) ;
496
496
idrinth . ui . tooltip . setAttribute ( 'style' , 'left:' + Math . round ( pos . left - 200 ) + 'px;top:' + Math . round ( pos . top - 100 ) + 'px;' ) ;
497
497
}
498
- var pos = null ;
498
+ idrinth . names . isHovering = false ;
499
499
var name = idrinth . names . parse ( element ) . toLowerCase ( ) ;
500
500
if ( idrinth . settings . names && idrinth . ui . tooltip && idrinth . names . users [ name ] ) {
501
501
window . clearTimeout ( idrinth . ui . tooltipTO ) ;
502
- pos = element . getBoundingClientRect ( ) ;
502
+ var pos = element . getBoundingClientRect ( ) ;
503
503
tooltip ( idrinth . names . users [ name ] . kongregate , idrinth . ui . tooltip . firstChild , pos , idrinth . names . guilds . kongregate , 'kongregate' ) ;
504
504
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 ) ;
507
506
}
508
507
} ,
509
508
hideTooltip : function ( ) {
510
509
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 ) ;
513
511
return ;
514
512
}
515
513
idrinth . ui . updateClassesList ( idrinth . ui . tooltip , [ 'idrinth-hide' ] , [ ] ) ;
@@ -574,7 +572,7 @@ var idrinth = {
574
572
var forceToArray = function ( value ) {
575
573
return value && typeof value === 'object' && Array . isArray ( value ) ? value : [ ] ;
576
574
} ;
577
- var original = classString . split ( ' ' ) . concat ( forceToArray ( add ) ) ;
575
+ var original = classString === null ? [ ] : classString . split ( ' ' ) . concat ( forceToArray ( add ) ) ;
578
576
var list = [ ] ;
579
577
remove = forceToArray ( remove ) ;
580
578
var addUnique = function ( list , element , forbidden ) {
0 commit comments