Skip to content

Commit

Permalink
minor fix to preserve userbar toggle height
Browse files Browse the repository at this point in the history
  • Loading branch information
honestbleeps committed Jun 22, 2012
1 parent baea20d commit 0651a5e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/reddit_enhancement_suite.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -11312,23 +11312,27 @@ modules['styleTweaks'] = {
// RESUtils.addCSS(".userbarHide { background-position: 0px -137px; }");
RESUtils.addCSS("#userbarToggle.userbarShow { left: -12px; top:-13px }");
RESUtils.addCSS(".res-navTop #userbarToggle.userbarShow { top:0 }");
var userbar = document.getElementById('header-bottom-right');
if (userbar) {
this.userbar = document.getElementById('header-bottom-right');
if (this.userbar) {
this.userbarToggle = createElementWithID('div','userbarToggle');
this.userbarToggle.innerHTML = '»';
this.userbarToggle.setAttribute('title','Toggle Userbar');
addClass(this.userbarToggle, 'userbarHide');
this.userbarToggle.addEventListener('click', function(e) {
modules['styleTweaks'].toggleUserBar();
}, false);
userbar.insertBefore(this.userbarToggle, userbar.firstChild);
this.userbar.insertBefore(this.userbarToggle, this.userbar.firstChild);
var currHeight = $(this.userbar).height();
$(this.userbarToggle).css('height',currHeight+'px');
console.log('woop');
if (RESStorage.getItem('RESmodules.styleTweaks.userbarState') == 'hidden') {
this.toggleUserBar();
}
}
},
toggleUserBar: function() {
var nextEle = this.userbarToggle.nextSibling;
// hide userbar.
if (hasClass(this.userbarToggle,'userbarHide')) {
removeClass(this.userbarToggle,'userbarHide');
addClass(this.userbarToggle,'userbarShow');
Expand All @@ -11339,6 +11343,7 @@ modules['styleTweaks'] = {
nextEle.style.display = 'none';
nextEle = nextEle.nextSibling;
}
// show userbar.
} else {
removeClass(this.userbarToggle,'userbarShow');
addClass(this.userbarToggle,'userbarHide');
Expand Down

0 comments on commit 0651a5e

Please sign in to comment.