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

Can't hide navigation elements when next/back are disabled (and fix) #158

Merged
merged 1 commit into from
May 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions google-music-mac/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,8 @@ - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
[self evaluateJavaScriptFile:@"styles"];

// Apply the navigation styles.
if ([defaults boolForKey:@"navigation.buttons.enabled"])
{
[self applyCSSFile:@"navigation"];
[self evaluateJavaScriptFile:@"navigation"];
}
[self applyCSSFile:@"navigation"];
[self evaluateJavaScriptFile:@"navigation"];

// Apply the Last.fm JS and CSS.
if ([defaults boolForKey:@"lastfm.button.enabled"])
Expand Down
30 changes: 16 additions & 14 deletions google-music-mac/js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,22 @@ if (typeof window.GMNavigation === 'undefined') {
document.querySelector('#oneGoogleWrapper > div:first-child > div:first-child > div:nth-child(1)').style.webkitFlexGrow = 0;
document.querySelector('#oneGoogleWrapper > div:first-child > div:first-child > div:nth-child(3)').style.webkitFlexGrow = 1;

// Create back and forward buttons.
var backButton = document.createElement('button');
backButton.className = 'gm-nav-button';
backButton.title = 'Back';
backButton.id = 'gm-back';
backButton.addEventListener('click', function() { window.history.back(); });
if(window.GoogleMusicApp.preferenceForKey("navigation.buttons.enabled") == true) {
// Create back and forward buttons.
var backButton = document.createElement('button');
backButton.className = 'gm-nav-button';
backButton.title = 'Back';
backButton.id = 'gm-back';
backButton.addEventListener('click', function() { window.history.back(); });

var forwardButton = document.createElement('button');
forwardButton.className = 'gm-nav-button';
forwardButton.title = 'Forward';
forwardButton.id = 'gm-forward';
forwardButton.addEventListener('click', function() { window.history.forward(); });
var forwardButton = document.createElement('button');
forwardButton.className = 'gm-nav-button';
forwardButton.title = 'Forward';
forwardButton.id = 'gm-forward';
forwardButton.addEventListener('click', function() { window.history.forward(); });

// Add the back and forward buttons.
logoContainer.appendChild(backButton);
logoContainer.appendChild(forwardButton);
// Add the back and forward buttons.
logoContainer.appendChild(backButton);
logoContainer.appendChild(forwardButton);
}
}