Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Keeps the topbar open, also opens on hover
$('.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
You can’t perform that action at this time.