From 3977bda0da8a71297788c7b5abd092c14c33d3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Galv=C3=A3o?= Date: Wed, 9 Mar 2016 12:07:43 -0500 Subject: [PATCH] return home after playing episode --- app/webview-script.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/webview-script.js b/app/webview-script.js index 9c02c95..ca44716 100644 --- a/app/webview-script.js +++ b/app/webview-script.js @@ -4,6 +4,10 @@ require('mousetrap'); require('sweetalert'); const clipboard = require('electron').clipboard; +function return_home() { + window.location.href = 'https://overcast.fm/podcasts/'; +} + // Which page type we are on function page_type() { if (/^\/podcasts/.test(window.location.pathname)) { return 'home' } @@ -54,7 +58,7 @@ function navigate_cells(direction) { // Non-global shortcuts Mousetrap.bind('backspace', function() { - window.location.href = 'https://overcast.fm/podcasts/'; + return_home(); }); Mousetrap.bind('command+backspace', function() { @@ -117,5 +121,10 @@ document.addEventListener('DOMContentLoaded', function() { share.addEventListener('click', function() { copy_link(event, share) }); share_with_timestamp.addEventListener('click', function() { copy_link(event, share_with_timestamp) }); + + // return home after playing episode + document.getElementById('audioplayer').addEventListener('ended', function() { + return_home(); + }); } });