diff --git a/README.md b/README.md index 4b2b00e3..8cfb6170 100755 --- a/README.md +++ b/README.md @@ -23,6 +23,12 @@ supported](http://caniuse.com/#feat=audio-api). Open `index.html` in your browser. +## Development + + npm run serve + +Open `http://localhost:8080/webpack-dev-server/` in your browser. + ## Reference - [skinspecs.pdf](http://members.xoom.it/skinart/tutorial/skinspecs..pdf) @@ -56,7 +62,7 @@ for Winamp which inspired so many of us. ## License -While the Winamp name, interface, sample audio file and surely property of +While the Winamp name, interface, and, sample audio file are surely property of Nullsoft, the code within this project is released under the [MIT License](LICENSE.txt). That being said, if you do anything interesting with this code, please let me know. I'd love to see it. diff --git a/css/main-window.css b/css/main-window.css index a2f64c4c..bc53e21b 100755 --- a/css/main-window.css +++ b/css/main-window.css @@ -3,7 +3,7 @@ position: absolute; height: 116px; width: 275px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/MAINMENU.PNG'), auto; + cursor:url('../cursors/MAINMENU.PNG'), auto; /* Ask the browser to scale showing large pixels if possible */ image-rendering: -moz-crisp-edges; /* Firefox */ image-rendering: -o-crisp-edges; /* Opera */ @@ -59,7 +59,7 @@ left: 0; height: 14px; width: 275px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/TITLEBAR.PNG'), auto; + cursor:url('../cursors/TITLEBAR.PNG'), auto; } #winamp2-js #option, @@ -70,7 +70,7 @@ height: 9px; width: 9px; top: 3px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/MAINMENU.PNG'), auto; + cursor:url('../cursors/MAINMENU.PNG'), auto; } #winamp2-js #title-bar #option { @@ -94,7 +94,7 @@ } #winamp2-js #title-bar #close { left: 264px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/CLOSE.PNG'), auto; + cursor:url('../cursors/CLOSE.PNG'), auto; } #winamp2-js #clutter-bar { position: absolute; @@ -161,6 +161,7 @@ } #winamp2-js .status #time #minus-sign { + /* Note that this get's augmented by the skin CSS if NUM_EX.BMP is present */ position: absolute; top: 6px; left: -1px; @@ -168,13 +169,6 @@ height: 1px; } -/* Alternate format for minus sign, when skin supports it */ -#winamp2-js .status #time.ex #minus-sign { - top: 0px; - left: -1px; - width: 9px; - height: 13px; -} #winamp2-js .status #time #minute-first-digit { position: absolute; @@ -279,19 +273,19 @@ height: 13px; width: 68px; background-position: 0 0; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } #winamp2-js #volume::-webkit-slider-thumb { top: 1px; height: 11px; width: 14px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } #winamp2-js #volume::-moz-range-thumb { top: 1px; height: 11px; width: 14px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } #winamp2-js #balance { @@ -301,20 +295,20 @@ height: 13px; width: 38px; background-position: 0 0; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } #winamp2-js #balance::-webkit-slider-thumb { top: 1px; height: 11px; width: 14px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } #winamp2-js #balance::-moz-range-thumb { top: 1px; height: 11px; width: 14px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } #winamp2-js .windows { @@ -345,13 +339,13 @@ top: 72px; width: 248px; height: 10px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } #winamp2-js #position::-webkit-slider-thumb { height: 10px; width: 29px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; /* * Fix the strange bug in Safair/mobile-chrome * http://stackoverflow.com/questions/26727769/rendering-glitch-when-manipulating-range-input-value-via-javascript-in-webkit @@ -363,7 +357,7 @@ #winamp2-js #position::-moz-range-thumb { height: 10px; width: 29px; - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/POSBAR.PNG'), auto; + cursor:url('../cursors/POSBAR.PNG'), auto; } /* For some reason, we can't use display: none here */ @@ -450,7 +444,7 @@ } #winamp2-js #shade-time { - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/MAINMENU.PNG'), auto; + cursor:url('../cursors/MAINMENU.PNG'), auto; } @@ -463,7 +457,7 @@ display: none; } #winamp2-js .shade #title-bar { - cursor:url('https://jordaneldredge.com/projects/winamp2-js/cursors/MAINMENU.PNG'), auto; + cursor:url('../cursors/MAINMENU.PNG'), auto; } #winamp2-js .shade .actions div { diff --git a/html/main-window.html b/html/main-window.html deleted file mode 100644 index d898b76e..00000000 --- a/html/main-window.html +++ /dev/null @@ -1,85 +0,0 @@ -
-
Loading...
-
-
-
    -
  • Winamp2-js...
  • -

  • -
  • Play File...
  • -
  • -
      -
    • Load Skin...
    • -

    • -
    • <Base Skin>
    • -
    • Mac OSX v1.5 (Aqua)
    • -
    • TopazAmp
    • -
    • Vizor
    • -
    • XMMS Turquoise
    • -
    • Zaxon Remake
    • -
    - Skins -
  • -

  • -
  • Exit
  • -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- - -
-
-
-
- -
- -
-
-
- -
-
-
-
-
-
- -
diff --git a/js/Actions.jsx b/js/Actions.jsx new file mode 100644 index 00000000..11227591 --- /dev/null +++ b/js/Actions.jsx @@ -0,0 +1,32 @@ +import React from 'react'; +import {connect} from 'react-redux'; + + +class Actions extends React.Component { + constructor(props) { + super(props); + this.play = this.play.bind(this); + this.pause = this.pause.bind(this); + this.stop = this.stop.bind(this); + } + play() { + this.props.dispatch({type: 'PLAY'}); + } + pause() { + this.props.dispatch({type: 'PAUSE'}); + } + stop() { + this.props.dispatch({type: 'STOP'}); + } + render() { + return
+ +
+
+
+ +
; + } +} + +module.exports = connect(state => state.media)(Actions); diff --git a/js/Character.jsx b/js/Character.jsx new file mode 100644 index 00000000..965d10e1 --- /dev/null +++ b/js/Character.jsx @@ -0,0 +1,9 @@ +import React from 'react'; + +module.exports = (props) => { + const char = '' + props.children; + const className = 'character character-' + char.toLowerCase().charCodeAt(0); + return
{props.children}
; +}; + +// TODO: Require that props.children be a string diff --git a/js/CharacterString.jsx b/js/CharacterString.jsx new file mode 100644 index 00000000..faa57133 --- /dev/null +++ b/js/CharacterString.jsx @@ -0,0 +1,14 @@ +import React from 'react'; +import Character from './Character.jsx'; + +module.exports = (props) => { + const text = '' + props.children; + const chars = text.split(''); + return
+ {chars.map(character => { + return {character}; + })}; +
; +}; + +// TODO: Require that props.children be a string diff --git a/js/ContextMenu.jsx b/js/ContextMenu.jsx index 5589e055..74e9cac8 100644 --- a/js/ContextMenu.jsx +++ b/js/ContextMenu.jsx @@ -1,15 +1,11 @@ import React from 'react'; -import MyFile from './my-file'; +import {connect} from 'react-redux'; import '../css/context-menu.css'; class ContextMenu extends React.Component { constructor(props) { super(props); - this.state = { - selected: false - }; - this.openFileDialog = this.openFileDialog.bind(this); this.close = this.close.bind(this); this.toggleMenu = this.toggleMenu.bind(this); @@ -27,34 +23,30 @@ class ContextMenu extends React.Component { } openFileDialog() { - this.props.winamp.openFileDialog(); + this.props.dispatch({type: 'OPEN_FILE_DIALOG'}); } close() { - // Close all of Winamp - this.props.winamp.close(); + this.props.dispatch({type: 'CLOSE_WINAMP'}); } closeMenu() { - this.setState({selected: false}); + this.props.dispatch({type: 'CLOSE_CONTEXT_MENU'}); } toggleMenu(event) { - this.setState({selected: !this.state.selected}); + this.props.dispatch({type: 'TOGGLE_CONTEXT_MENU'}); event.stopPropagation(); } setSkin(e) { const filename = e.target.dataset.filename; const url = 'https://cdn.rawgit.com/captbaritone/winamp-skins/master/v2/' + filename; - const skinFile = new MyFile(); - skinFile.setUrl(url); - this.props.winamp.setSkin(skinFile); + this.props.dispatch({type: 'SET_SKIN_FROM_URL', url: url}); } - render() { - var classes = this.state.selected ? 'selected' : ''; + var classes = this.props.selected ? 'selected' : ''; return