Created
February 9, 2017 20:38
-
-
Save travisjj/3c50be52ce4da566867c624e8777d0a8 to your computer and use it in GitHub Desktop.
Keeps the topbar open, also opens on hover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.secondary-nav a.-link').each(function(){this.removeAttribute("title");}); | |
var btns = []; | |
var achieve = { btn: 'a.-link.js-achievements-button', mod: '.topbar-dialog.achievements-dialog.dno' }; | |
btns.push(achieve); | |
var inbox = { btn: 'a.-link.js-inbox-button', mod: '.topbar-dialog.inbox-dialog.dno' }; | |
btns.push(inbox); | |
var se = { btn: 'a.-link.js-site-switcher-button.js-gps-track', mod: '.topbar-dialog.siteSwitcher-dialog.dno' }; | |
btns.push(se); | |
for( var ind in btns ){ | |
var tar = btns[ind].btn; | |
var mod = btns[ind].mod; | |
var $ach = $(tar); | |
(function($ach,mod){ | |
var d = StackExchange.helpers.DelayedReaction(function () { | |
if( $(mod).is(':visible') )return; | |
$ach.click(); | |
}, 450, { always: function () { | |
j.cancel() } | |
}); | |
var j = StackExchange.helpers.DelayedReaction(function () { | |
if( !$(mod).is(':visible') )return; | |
$ach.click(); | |
}, 1E3, { always: function () { | |
d.cancel() } | |
}); | |
var a = StackExchange.helpers.DelayedReaction(function () { | |
}, 450, { always: function () { | |
j.cancel(); d.cancel(); } | |
}); | |
var b = StackExchange.helpers.DelayedReaction(function () { | |
if( !$(mod).is(':visible') )return; | |
$ach.click(); | |
}, 450, { always: function () { | |
j.cancel(); a.cancel(); } | |
}); | |
$ach.mouseenter(d.trigger); | |
$ach.mouseleave(j.trigger); | |
$ach.click(function(){ | |
a.cancel(); | |
d.cancel(); | |
}); | |
$('body').on('mouseenter',mod,a.trigger); | |
$('body').on('mouseleave',mod,b.trigger); | |
})($ach,mod) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment