From 06561f95804442a0f3488d0e0f5087c3e71e76b2 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 25 Aug 2017 19:41:34 -0400 Subject: [PATCH] Implement {Pause,Resume} all buttons --- src/actions/selection.js | 8 -------- src/index.js | 1 + src/polyfills.js | 10 ++++++++++ src/ui/torrent_details.js | 16 ++++++++++++---- 4 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 src/polyfills.js diff --git a/src/actions/selection.js b/src/actions/selection.js index b709c85..09e88a1 100644 --- a/src/actions/selection.js +++ b/src/actions/selection.js @@ -7,14 +7,6 @@ export const SUBTRACT = 'SUBTRACT'; export const EXCLUSIVE = 'EXCLUSIVE'; export const NONE = 'NONE'; -Set.prototype.difference = function(set) { - var diff = new Set(this); - for (var v of set) { - diff.delete(v); - } - return diff; -} - export default function selectTorrent(id, action) { return (dispatch, getState) => { const previous = new Set(getState().selection); diff --git a/src/index.js b/src/index.js index b0cee8d..1e08329 100644 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,7 @@ import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { ConnectedRouter } from 'react-router-redux'; import 'preact/devtools'; +import './polyfills'; import store, { history } from './store'; import scss from '../scss/main.scss'; diff --git a/src/polyfills.js b/src/polyfills.js new file mode 100644 index 0000000..be7686b --- /dev/null +++ b/src/polyfills.js @@ -0,0 +1,10 @@ +Set.prototype.difference = function(set) { + var diff = new Set(this); + for (var v of set) { + diff.delete(v); + } + return diff; +} + +// Required by ES6 spec +export const _ = null; diff --git a/src/ui/torrent_details.js b/src/ui/torrent_details.js index 47ed021..abc6514 100644 --- a/src/ui/torrent_details.js +++ b/src/ui/torrent_details.js @@ -15,8 +15,6 @@ import { import ws_send from '../socket'; import selectTorrent, { UNION, NONE } from '../actions/selection'; -// TODO: fix navigating directly to torrent pages - function File({ file }) { // TODO: show progress bar // TODO: edit priority @@ -168,8 +166,18 @@ class TorrentDetails extends Component {

{selection.length} torrents

- - + + this.setState({ removeDropdown: !this.state.removeDropdown })}