Cleanup
This commit is contained in:
parent
696049aa76
commit
195a6a4043
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
var app = { };
|
var app = { };
|
||||||
|
|
||||||
|
|
||||||
function outputResults(results, maxResults) {
|
function outputResults(results, maxResults) {
|
||||||
$('#results').empty();
|
$('#results').empty();
|
||||||
$('#count').text(results.length);
|
$('#count').text(results.length);
|
||||||
@ -51,14 +52,13 @@ function onSearch() {
|
|||||||
app.hintSteps = params.hintSteps;
|
app.hintSteps = params.hintSteps;
|
||||||
app.maxResults = params.maxResults;
|
app.maxResults = params.maxResults;
|
||||||
|
|
||||||
app.grapher = new Grapher('grapher', new goog.math.Range(-1.0, 1.0), true, true);
|
app.grapher = new Grapher('grapher', app.searchRange, true, true);
|
||||||
app.grapher.setColumns(results.columns);
|
app.grapher.setColumns(results.columns);
|
||||||
app.grapher.setValueChangedListener(onAdjust);
|
app.grapher.setValueChangedListener(onAdjust);
|
||||||
|
|
||||||
outputResults(results.items, params.maxResults);
|
outputResults(results.items, params.maxResults);
|
||||||
|
|
||||||
$('#query').text(params.keyword);
|
$('#query').text(params.keyword);
|
||||||
|
|
||||||
$('#useLocalScale').click(function() {
|
$('#useLocalScale').click(function() {
|
||||||
var useLocalScale = $('#useLocalScale').is(':checked');
|
var useLocalScale = $('#useLocalScale').is(':checked');
|
||||||
app.grapher.setUseLocalScale(useLocalScale);
|
app.grapher.setUseLocalScale(useLocalScale);
|
||||||
@ -67,7 +67,6 @@ function onSearch() {
|
|||||||
var useRelativeScale = $('#useRelativeScale').is(':checked');
|
var useRelativeScale = $('#useRelativeScale').is(':checked');
|
||||||
app.grapher.setUseRelativeScale(useRelativeScale);
|
app.grapher.setUseRelativeScale(useRelativeScale);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#input').fadeOut(function() {
|
$('#input').fadeOut(function() {
|
||||||
$('#output').fadeIn();
|
$('#output').fadeIn();
|
||||||
});
|
});
|
||||||
|
@ -543,7 +543,7 @@ function Grapher(canvas, range, useLocalScale, useRelativeScale) {
|
|||||||
this.useLocalScale = useLocalScale;
|
this.useLocalScale = useLocalScale;
|
||||||
this.useRelativeScale = useRelativeScale;
|
this.useRelativeScale = useRelativeScale;
|
||||||
this.canvas = new fabric.StaticCanvas(canvas);
|
this.canvas = new fabric.StaticCanvas(canvas);
|
||||||
this.range = range;
|
this.range = new goog.math.Range(range.min, range.max);
|
||||||
this.padding = 10;
|
this.padding = 10;
|
||||||
this.indexMap = {};
|
this.indexMap = {};
|
||||||
this.columns = [];
|
this.columns = [];
|
||||||
|
@ -55,10 +55,10 @@
|
|||||||
<div class="row" style="padding: 10px;">
|
<div class="row" style="padding: 10px;">
|
||||||
<canvas id="grapher" width="500" height="550"></canvas><br>
|
<canvas id="grapher" width="500" height="550"></canvas><br>
|
||||||
<label class="checkbox-inline">
|
<label class="checkbox-inline">
|
||||||
<input type="checkbox" id="useLocalScale" name="useLocalScale"> Use local scale
|
<input type="checkbox" id="useLocalScale" name="useLocalScale" checked="checked"> Use local scale
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox-inline">
|
<label class="checkbox-inline">
|
||||||
<input type="checkbox" id="useRelativeScale" name="useRelativeScale"> Use relative scale
|
<input type="checkbox" id="useRelativeScale" name="useRelativeScale" checked="checked"> Use relative scale
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,7 @@ var _ = require('underscore');
|
|||||||
var db_keywords = require('./keywords.json');
|
var db_keywords = require('./keywords.json');
|
||||||
var db_data = require('./data.json');
|
var db_data = require('./data.json');
|
||||||
|
|
||||||
|
|
||||||
function innerProduct(values1, values2) {
|
function innerProduct(values1, values2) {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
var search = require('./db/search.js');
|
var search = require('./db/search.js');
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user