diff options
author | sternenseemann <git@lukasepple.de> | 2017-09-23 18:14:04 +0200 |
---|---|---|
committer | sternenseemann <git@lukasepple.de> | 2017-09-23 18:14:04 +0200 |
commit | 880f836881b96d3616d6ffb82dadb94b78ef1524 (patch) | |
tree | f5431c7a43d73bd51121c922b7cbdb79fe965f16 /web | |
parent | 51a1039c926ea8bcb3981f23564c8fbf800999de (diff) |
Minor fixes for production of the frontend
Diffstat (limited to 'web')
-rw-r--r-- | web/package.json | 4 | ||||
-rw-r--r-- | web/source/main.js | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/web/package.json b/web/package.json index a5db4f4..eabd87c 100644 --- a/web/package.json +++ b/web/package.json @@ -1,7 +1,7 @@ { "scripts": { - "build:dev": "cp -R node_modules/vis/dist/{vis.min.css,img} dist; cp source/custom.css dist; cp source/index.html dist; browserify source/main.js -t babelify -d -o dist/main.js", - "build:prod": "cp -R node_modules/vis/dist/{vis.min.css,img} dist; cp source/custom.css dist; cp source/index.html dist; cross-env NODE_ENV=production browserify source/main.js -t babelify | uglifyjs -c -m > dist/main.js" + "build:dev": "mkdir -p dist; cp -R node_modules/vis/dist/{vis.min.css,img} dist; cp source/custom.css dist; cp source/index.html dist; browserify source/main.js -t babelify -d -o dist/main.js", + "build:prod": "mkdir -p dist; cp -R node_modules/vis/dist/{vis.min.css,img} dist; cp source/custom.css dist; cp source/index.html dist; cross-env NODE_ENV=production browserify source/main.js -t babelify | uglifyjs -c -m > dist/main.js" }, "devDependencies": { "babel-cli": "^6.26.0", diff --git a/web/source/main.js b/web/source/main.js index 362cc98..a12be2f 100644 --- a/web/source/main.js +++ b/web/source/main.js @@ -117,11 +117,27 @@ function standard_notes(dur) { } } +function compute_dot_times(dur, denominator) { + let baseLog = (b, x) => Math.log(x) / Math.log(b); + let term = (dur.numerator * Math.pow(2, denominator)) / dur.denominator; + return baseLog(1.5, term); +} + function musical_symbol(lookup, dur) { const dot = '𝅭𝅭 '; + let isNat = n => { + if (typeof n !== 'number') + return false; + return (n >= 0.0) && (Math.floor(n) === n) && n !== Infinity; + }; var standard_symbol = lookup(dur); + var dots = [0, 1, 2, 3, 4, 5, 6, 7 ].map(compute_dot_times.bind(dur)).filter(isNat); if(standard_symbol !== null) { return standard_symbol; + } else if (dots.length !== 0) { + for(var i = dots[0]; i > 0; i--) { + + } } else { return dur.toString(); } @@ -422,7 +438,7 @@ function fetchInterpretation(params, format) { body: jsonRequest }; - var myRequest = new Request(`http://localhost:8081/interpretation/${format}`, myInit); + var myRequest = new Request(`/interpretation/${format}`, myInit); return fetch(myRequest).then(res => res.blob()); } |