Switch to Koa, more es6
This commit is contained in:
parent
1090affc9c
commit
b3abff99ae
36 changed files with 25573 additions and 928 deletions
|
@ -6,6 +6,7 @@
|
|||
"react"
|
||||
],
|
||||
"env": {
|
||||
"browser": true
|
||||
"browser": true,
|
||||
"es6": true
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var React = require("react");
|
||||
var Router = require("react-router");
|
||||
var Route = require("react-router").Route;
|
||||
var DefaultRoute = require("react-router").DefaultRoute;
|
||||
var NotFoundRoute = require("react-router").NotFoundRoute;
|
||||
var RouteHandler = require("react-router").RouteHandler;
|
||||
var Home = require("./home.jsx");
|
||||
var Share = require("./share.jsx");
|
||||
var Head = require("./head.jsx");
|
||||
var ga = require("react-google-analytics");
|
||||
var React = require('react');
|
||||
var Router = require('react-router');
|
||||
var Route = require('react-router').Route;
|
||||
var DefaultRoute = require('react-router').DefaultRoute;
|
||||
var NotFoundRoute = require('react-router').NotFoundRoute;
|
||||
var RouteHandler = require('react-router').RouteHandler;
|
||||
var Home = require('./home.jsx');
|
||||
var Share = require('./share.jsx');
|
||||
var Head = require('./head.jsx');
|
||||
var ga = require('react-google-analytics');
|
||||
var GAInitiailizer = ga.Initializer;
|
||||
|
||||
var App = React.createClass({
|
||||
|
@ -17,42 +17,36 @@ var App = React.createClass({
|
|||
return (
|
||||
<html>
|
||||
<Head {...this.props} />
|
||||
<body className="home">
|
||||
<body className='home'>
|
||||
<RouteHandler {...this.props} />
|
||||
<GAInitiailizer />
|
||||
<script src="/javascript/bundle.js" />
|
||||
<script src='/javascript/bundle.js' />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var NotFound = React.createClass({
|
||||
render: function () {
|
||||
return <h2>Not found</h2>;
|
||||
}
|
||||
});
|
||||
|
||||
var routes = (
|
||||
<Route name="home" handler={App} path="/">
|
||||
<Route name='home' handler={App} path='/'>
|
||||
<DefaultRoute handler={Home} />
|
||||
<Route name="share" path=":service/:type/:id" handler={Share}/>
|
||||
<NotFoundRoute handler={NotFound}/>
|
||||
<Route name='share' path=':service/:type/:id' handler={Share}/>
|
||||
<NotFoundRoute handler={Error}/>
|
||||
</Route>
|
||||
);
|
||||
|
||||
module.exports.routes = routes;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.onload = function() {
|
||||
Router.run(routes, Router.HistoryLocation, function (Handler) {
|
||||
if (typeof window.recents !== "undefined") {
|
||||
if (typeof window.recents !== 'undefined') {
|
||||
React.render(<Handler recents={window.recents} />, document);
|
||||
} else if (typeof shares !== "undefined") {
|
||||
} else if (typeof shares !== 'undefined') {
|
||||
React.render(<Handler shares={window.shares} />, document);
|
||||
}
|
||||
});
|
||||
ga("create", "UA-66209-8", "auto");
|
||||
ga("send", "pageview");
|
||||
ga('create', 'UA-66209-8', 'auto');
|
||||
ga('send', 'pageview');
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var React = require("react");
|
||||
var React = require('react');
|
||||
|
||||
module.exports = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div className="row faq">
|
||||
<div className="col-md-6 col-md-offset-3">
|
||||
<div className='row faq'>
|
||||
<div className='col-md-6 col-md-offset-3'>
|
||||
<h2>Questions?</h2>
|
||||
<ul>
|
||||
<li>
|
||||
|
@ -20,11 +20,11 @@ module.exports = React.createClass({
|
|||
</li>
|
||||
<li>
|
||||
<h3>Where do I find a link to paste in the box?</h3>
|
||||
<p>Most music services have a "share" dialog for albums and tracks in their interface. If you have them open in a web browser instead of an app, you can simply copy and paste the address bar and we'll work out the rest.</p>
|
||||
<p>Most music services have a 'share' dialog for albums and tracks in their interface. If you have them open in a web browser instead of an app, you can simply copy and paste the address bar and we'll work out the rest.</p>
|
||||
</li>
|
||||
<li>
|
||||
<h3>Why don't you guys support Bandcamp, Amazon Music, Sony Music Unlimited… ?</h3>
|
||||
<p>Let me stop you there. <a href="https://github.com/kudos/match.audio">Match Audio is open source</a>, that means any capable programmer who wants to add other music services can look at our code and submit changes. If you're not a programmer, you can always <a href="https://github.com/kudos/match.audio/issues">submit a request</a> and maybe we'll do it for you.</p>
|
||||
<p>Let me stop you there. <a href='https://github.com/kudos/match.audio'>Match Audio is open source</a>, that means any capable programmer who wants to add other music services can look at our code and submit changes. If you're not a programmer, you can always <a href='https://github.com/kudos/match.audio/issues'>submit a request</a> and maybe we'll do it for you.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -65,7 +65,7 @@ var SearchForm = React.createClass({
|
|||
});
|
||||
return;
|
||||
}
|
||||
request.post("/search").send({url: url}).end(function(res) {
|
||||
request.post("/search").send({url: url}).end(function(req, res) {
|
||||
that.setState({
|
||||
submitting: false
|
||||
});
|
||||
|
@ -118,7 +118,7 @@ module.exports = React.createClass({
|
|||
|
||||
componentDidMount: function () {
|
||||
if (!this.props.recents) {
|
||||
request.get("/recent").set("Accept", "application/json").end(function(res) {
|
||||
request.get("/recent").set("Accept", "application/json").end(function(err, res) {
|
||||
this.setState({
|
||||
recents: res.body.recents
|
||||
});
|
||||
|
|
|
@ -100,7 +100,7 @@ module.exports = React.createClass({
|
|||
});
|
||||
|
||||
var getShares = function() {
|
||||
request.get(this.getPathname() + ".json").end(function(res) {
|
||||
request.get(this.getPathname() + ".json").end(function(err, res) {
|
||||
var shares = res.body.shares;
|
||||
complete = true;
|
||||
shares.forEach(function(share) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue