diff --git a/radiant-player-mac/AppDelegate.m b/radiant-player-mac/AppDelegate.m index f74aec37..5da860e5 100644 --- a/radiant-player-mac/AppDelegate.m +++ b/radiant-player-mac/AppDelegate.m @@ -652,9 +652,13 @@ - (void)webView:(WebView *)webView didClearWindowObject:(WebScriptObject *)windo - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { + // Only apply the main script file when the player is ready. + if ([[webView mainFrameDocument] querySelector:@"#playerSongInfo"]) { + [self evaluateJavaScriptFile:@"main"]; + } + [self evaluateJavaScriptFile:@"keyboard"]; [self evaluateJavaScriptFile:@"mouse"]; - [self evaluateJavaScriptFile:@"main"]; [self evaluateJavaScriptFile:@"styles"]; // Apply the navigation styles.