From c9926802097059594cd298c5b69f9819718a6627 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 11 Oct 2014 15:35:56 +0200 Subject: [PATCH] Meta and Middle click not triggering new tab --- couchpotato/static/scripts/couchpotato.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index 19b9f455..2da96a7c 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -54,16 +54,22 @@ }, pushState: function(e){ - if((!e.meta && Browser.platform.mac) || (!e.control && !Browser.platform.mac)){ + var self = this; + + if((!e.meta && self.isMac()) || (!e.control && !self.isMac())){ (e).preventDefault(); var url = e.target.get('href'); - if(History.getPath() != url) + + // Middle click + if(e.event && e.event.button == 1) + window.open(url); + else if(History.getPath() != url) History.push(url); } }, isMac: function(){ - return Browser.platform.mac + return Browser.platform == 'mac' }, createLayout: function(){ @@ -325,11 +331,12 @@ }, openDerefered: function(e, el){ + var self = this; (e).stop(); var url = 'http://www.dereferer.org/?' + el.get('href'); - if(el.get('target') == '_blank' || (e.meta && Browser.platform.mac) || (e.control && !Browser.platform.mac)) + if(el.get('target') == '_blank' || (e.meta && self.isMac()) || (e.control && !self.isMac())) window.open(url); else window.location = url;