From e37d19d9aca4e59f939cc9c1c0dcc2689cb4754c Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Tue, 12 Jul 2016 09:15:14 -0700 Subject: [PATCH] Move kbps and khz to redux These are the last text nodes, so we can finally remove the old Font file. --- js/Kbps.jsx | 16 ++++++++++++++++ js/Khz.jsx | 16 ++++++++++++++++ js/font.js | 28 ---------------------------- js/main-window-dom.js | 4 ++-- js/main-window.js | 6 ++++-- js/reducers.js | 8 +++++++- js/skin.js | 2 -- js/winamp.js | 4 ++-- 8 files changed, 47 insertions(+), 37 deletions(-) create mode 100644 js/Kbps.jsx create mode 100644 js/Khz.jsx delete mode 100644 js/font.js diff --git a/js/Kbps.jsx b/js/Kbps.jsx new file mode 100644 index 00000000..1b8dde37 --- /dev/null +++ b/js/Kbps.jsx @@ -0,0 +1,16 @@ +// Single line text display that can animate and hold multiple registers +import React from 'react'; +import {connect} from 'react-redux'; + +import CharacterString from './CharacterString.jsx'; + + +class Kbps extends React.Component { + render() { + return + {this.props.kbps} + ; + } +} + +module.exports = connect(state => state.media)(Kbps); diff --git a/js/Khz.jsx b/js/Khz.jsx new file mode 100644 index 00000000..3663a6bd --- /dev/null +++ b/js/Khz.jsx @@ -0,0 +1,16 @@ +// Single line text display that can animate and hold multiple registers +import React from 'react'; +import {connect} from 'react-redux'; + +import CharacterString from './CharacterString.jsx'; + + +class Khz extends React.Component { + render() { + return + {this.props.khz} + ; + } +} + +module.exports = connect(state => state.media)(Khz); diff --git a/js/font.js b/js/font.js deleted file mode 100644 index 0019ada7..00000000 --- a/js/font.js +++ /dev/null @@ -1,28 +0,0 @@ -// Manage rendering text from this skin's text.bmp file -module.exports = function() { - - // Fill a node with a
containing character
s - this.setNodeToString = function(node, string) { - var stringElement = document.createElement('div'); - for (var i = 0, len = string.length; i < len; i++) { - var char = string[i].toLowerCase(); - stringElement.appendChild(this.characterNode(char)); - } - node.innerHTML = ''; - node.appendChild(stringElement); - }; - - // Get a
containing char - this.characterNode = function(char) { - return this.displayCharacterInNode(char, document.createElement('div')); - }; - - // Style/populate a
to display a character - this.displayCharacterInNode = function(character, node) { - character = character.toString(); - var className = 'character-' + character.charCodeAt(0); - node.classList.add('character'); - node.classList.add(className); - return node; - }; -}; diff --git a/js/main-window-dom.js b/js/main-window-dom.js index c715e1f1..fddbe670 100644 --- a/js/main-window-dom.js +++ b/js/main-window-dom.js @@ -45,8 +45,8 @@ module.exports = el('div', {id: 'main-window', class: 'loading stop'}, [ ]), el('div', {class: 'media-info'}, [ el('div', {id: 'song-title', class: 'text'}), - el('div', {id: 'kbps'}), - el('div', {id: 'khz'}), + el('div', {id: 'kbps-holder'}), + el('div', {id: 'khz-holder'}), el('div', {class: 'mono-stereo'}, [ el('div', {id: 'mono'}), el('div', {id: 'stereo'}) diff --git a/js/main-window.js b/js/main-window.js index 85026f17..f3f5d1c4 100644 --- a/js/main-window.js +++ b/js/main-window.js @@ -3,6 +3,8 @@ import Marquee from './Marquee.jsx'; import Actions from './Actions.jsx'; import Time from './Time.jsx'; import ShadeTime from './ShadeTime.jsx'; +import Kbps from './Kbps.jsx'; +import Khz from './Khz.jsx'; import '../css/main-window.css'; @@ -22,8 +24,6 @@ module.exports = { repeat: document.getElementById('repeat'), shuffle: document.getElementById('shuffle'), volume: document.getElementById('volume'), - kbps: document.getElementById('kbps'), - khz: document.getElementById('khz'), mono: document.getElementById('mono'), stereo: document.getElementById('stereo'), balance: document.getElementById('balance'), @@ -39,6 +39,8 @@ module.exports = { this.winamp.renderTo(, document.getElementById('actions-holder')); this.winamp.renderTo(