vitorgalvao / fog

Unofficial overcast.fm podcast app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Start playing current open Podcast episode on space

maicki opened this issue · comments

Just started using fog and came over this :)

To align with other music players I think it would make sense that hitting Space should start the current open Podcast episode.

Oh I just looked at the code it seems it's supposed doing that. For some reason it does not work for me on macOS High Sierra latest version.

Mousetrap.bind('space', function(event) {
  event.preventDefault();

  if (page_type() === 'episode') {
    document.getElementById('playpausebutton').click();
  }
});

Fixed in the latest version.

The website now does it natively, so that piece of code was acting in conflict.

Enjoy the app!

@vitorgalvao Should it be fixed on master?. I checked out latest master and tried out locally and it's not fixed. The thing I find out though is that we have to return false in Mousetrap handler to prevent the default handling (if wanted). This would fix it for me:

// Non-global shortcuts
Mousetrap.bind('backspace', function() {
  window.location.href = 'https://overcast.fm/podcasts/';
  return false;
});

Mousetrap.bind('command+backspace', function() {
  if (page_type() === 'episode') {
    document.getElementById('delete_episode_button').click();
  } else if (page_type() === 'list') {
    document.getElementsByClassName('destructivebutton')[0].click();
  }
  return false;
});

Mousetrap.bind('command+return', function() {
  if (page_type() === 'episode') {
    document.getElementById('save_episode_button').click();
  }
  return false;
});

Mousetrap.bind('space', function(event) {
  if (page_type() === 'episode') {
    document.getElementById('playpausebutton').click();
  }
  return false;
});

// Navigate episode cells
Mousetrap.bind(['down', 'j'], function() {
  navigate_cells('down');
  return false;
});

I forgot to push! The app in the release was fixed, though. Rereleased with the correct master.

Nice! Thanks!