Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

113 lines (97 sloc) 4.864 kB
<div data-role="page" id="page1">
<div data-theme="d" data-role="header">
<a data-role="button" data-mini="true" data-theme="c" href="">Help</a>
<a style="float:left;" data-icon="gear" data-role="button" data-mini="true" data-theme="c" href="#settings">&nbsp;</a>
<img src="/images/spectralworkbench.png" />
<a id="home" data-theme="b" href="/">SpectralWorkbench</a>
<div data-role="content" style="padding: 15px">
<% if params[:action] == "match" %>
<p><b>Click "Match" to find the closest spectrum in the set "<%= @set.title %>"</b></p>
<% end %>
<div id="graph" style="width:100%;height:100px;"></div>
<br />
<canvas style="width:100%;height:100px;" id="canvas"></canvas>
<span id="match"></span>
<% if params[:action] == "match" %>
<a data-role="button" data-theme="b" href="javascript:void()" onClick="$W.match();">Match</a>
<a data-role="button" data-transition="fade" data-theme="c" href="#page2" onClick="$W.saveSpectrum();">Save</a>
<% else %>
<a data-role="button" data-transition="fade" data-theme="b" href="#page2" onClick="$W.saveSpectrum();">Save</a>
<% end %>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="geotag-toggle">Geotag</label>
<input type="checkbox" name="geotag-toggle" id="geotag-toggle" type="checkbox" />
<label for="rgb-toggle">RGB</label>
<input type="checkbox" name="rgb-toggle" id="rgb-toggle" onChange="$W.toggle_mode()" />
<% unless logged_in? %><p><a href="/login">Log in</a> to use a recent calibration</p><% end %>
<p>Live capture currently only works on <a href="">Opera Mobile on Android</a>, the only mobile browser currently supporting the MediaStream API. For other mobile browsers (and iOS) please try the <a href="/spectrums/new">upload feature</a>. Native apps coming soon.</p>
<p><a href="?m=false">Desktop site</a> | <a href="">SpectralWorkbench is free software</a> by <a href="">Public Lab</a></p>
<div data-role="page" id="page2">
<div data-role="content" class="content" style="padding: 15px">
<h2>Save this spectrum</h2>
<% if !logged_in? %>
<p>You must be <a target="_blank" href="/login">logged in</a> to save spectra.</p>
<% else %>
<p>(logged in as <%=h current_user.login %>)</p>
<% end %>
<form action="/spectrums" method="post" id="saveForm" target="_blank" onSubmit="$W.cancelSave();window.location='#page1'">
<label for="spectrum_title">Title:</label><br />
<input name="spectrum[title]" id="spectrum_notes" type="text" /><br />
<label for="tags">Tags:</label><br />
<input name="tags" id="spectrum_tags" value="mobile," type="text" /><br />
<label for="spectrum_notes">Notes:</label>
<textarea name="spectrum[notes]" id="spectrum_notes"></textarea><br />
<input name="dataurl" type="hidden" id="dataurl" />
<input name="geotag" type="hidden" id="geotag" />
<input name="lat" type="hidden" id="lat" />
<input name="lon" type="hidden" id="lon" />
<% if logged_in? %>
<select name="spectrum[calibration_id]" id="calibration_id">
<% current_user.tag('calibration').each do |spectrum| %>
<option value="<%= %>"><%= spectrum.title %> (<%= time_ago_in_words(spectrum.created_at) %>)</option>
<option value="calibration">[+] New calibration</option>
<% end %>
<% end %>
<a data-role="button" data-transition="fade" data-theme="b" href="javascript:void(0);" onClick="$('#saveForm').submit()">Save</a>
<a data-role="button" data-transition="fade" data-theme="d" href="#page1" onClick="$W.cancelSave()">&laquo; Back</a>
<div data-role="page" id="settings">
<div style="height:40%;" id="webcam"></div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-mini="true">
<label for="sample_slider">Choose where to sample:</label>
<input type="range" name="slider" id="sample_slider" value="250" min="0" max="640" data-highlight="false" />
<a data-role="button" data-transition="fade" data-theme="d" href="#page1" onClick="$W.cancelSave()">&laquo; Back</a>
<script> (function () {
calibrated:<%= !@calibration.nil? %>,
<% if @calibration %>
$W.calibrated = true
$W.calibration_id = <%= %>
$W.start_wavelength = <%= @start_wavelength %>
$W.end_wavelength = <%= @end_wavelength %> = true
<% else %>
$W.calibrated = false
<% end %>
<% if params[:action] == "match" %>
$W.set = <%= %>
<% end %>
})() </script>
Jump to Line
Something went wrong with that request. Please try again.