-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved mobile experience? #16
Open
pkienzle
wants to merge
8
commits into
master
Choose a base branch
from
mobile
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bd52b88
Improved mobile experience?
c2b9bf6
more css tweaks
177efc2
use smaller font on narrow screens
ce28733
add timestamp for the calculation
8c2514b
fix layout for 'Last modified', using html header rather than php to …
a25219d
Add installation docs
b9d9a24
remove timestamp for calculation; test with NCNR banner; use standard…
4292888
hide unused scrollbars in IE and Edge
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
|
||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<!--- | ||
Setting viewport makes for a worse experience on iPhone SE but a | ||
better experience on android chrome. Android is worser than | ||
iPhone is better so set it. | ||
--> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Neutron Activation and Scattering Calculator</title> | ||
<link rel="shortcut icon" href="favicon.ico"> | ||
|
||
<script type="text/javascript" src="jquery-1.9.1.min.js"></script> | ||
<script type="text/javascript" src="jquery.tablesorter-2.0.5b.min.js"></script> | ||
|
||
<style type="text/css"> | ||
body { position: absolute; } | ||
@media screen and (max-width: 10cm) { | ||
body { font-size: 9pt; } | ||
} | ||
/*body { font-size: 16pt; }*/ | ||
input, select, textarea, button { | ||
font-family: inherit; | ||
font-size: inherit; | ||
} | ||
@media print | ||
{ | ||
body { font-size: 10pt !important; } | ||
|
@@ -17,22 +32,28 @@ | |
/* border: 0.1pt solid lightgray !important; */ | ||
border: none !important; | ||
} | ||
.no-print { display: none !important; height: 0; } | ||
.no-print *{ display: none !important; height: 0; } | ||
.print-only { display: block !important; } | ||
.print-only *{ display: block !important; } | ||
/* Suppress screen-only when printing */ | ||
.screen-only { display: none !important; height: 0; } | ||
.screen-only *{ display: none !important; height: 0; } | ||
} | ||
@media screen | ||
{ | ||
/* Suppress print-only when displaying on screen */ | ||
.print-only { display: none; } | ||
.print-only *{ display: none; } | ||
} | ||
.print-only { display: none; } | ||
.print-only *{ display: none; } | ||
|
||
p { margin-bottom: 0; } | ||
.footer p { margin-top: 0; } | ||
#footer p { margin-top: 0; } | ||
#footer { width: 100%; } | ||
#footer-left { float: left; } | ||
#footer-right { float: right; } | ||
/* body { font-size: 0.9em; } */ | ||
.disabled { opacity: 0.3; } | ||
label { font-weight: inherit; } | ||
.controls input { width: 100%; } | ||
table { margin: 0; padding: 0; border-spacing: 0; border-color: lightgray; } | ||
caption, td, th { padding: 0 0.5em 0 0.5em; } | ||
caption, td, th { padding: 0.2ex 0.5em 0.2ex 0.5em; } | ||
th { vertical-align: baseline; } | ||
tbody tr:nth-child(2n) th, tbody tr.even th, | ||
tbody tr:nth-child(2n) td, tbody tr.even td, | ||
|
@@ -50,11 +71,17 @@ | |
background-image: url(resonance-theme/desc.gif); | ||
} | ||
|
||
/* Cleaner time help table when space is limited. */ | ||
#help_time_off th { text-align: left; } | ||
#help_time_off caption, td, th { padding: 0.2ex 0.5em 0.2ex 0.0em; } | ||
#help_time_off .timecol { min-width: 9.1em; } | ||
|
||
/* output markup */ | ||
.error { color: red; } | ||
p.disclaimer { color: darkred; font-size:1.2em; } | ||
|
||
#id_chemical_formula { width: 30em; } | ||
/* Make the formula box expand to the available width. */ | ||
#material-panel table { display: table; width: 100%; } | ||
|
||
div.cutoff { display: block; } | ||
div.nocutoff { display: none; } | ||
|
@@ -76,8 +103,9 @@ | |
-ms-grid-column:2; -ms-grid-row:1; | ||
grid-column:2; grid-row:1; | ||
overflow:hidden; | ||
margin-left:0.5em; | ||
margin-right:0em; | ||
/* min-width:10em; max-width:40em; */ | ||
min-width:16em; max-width:40em; | ||
padding-right:0.5em; | ||
overflow-y:scroll; | ||
height:35ex; /* will be replaced by activation-frame height in js */ | ||
|
@@ -210,8 +238,10 @@ | |
else if (v >= 1e-9) return (1e9*v).toFixed(3)+' ng'; | ||
else return v.toExponential(4)+' ng'; | ||
} | ||
// standard year for activation calculations is 365, not 365.2425 | ||
var HOURS_PER_YEAR = 365*24; // = 365.2425*24; | ||
function format_time(v) { | ||
if (v >= 365.2425*24) return nice_number(v/365.2425/24)+' yrs'; | ||
if (v >= HOURS_PER_YEAR) return nice_number(v/HOURS_PER_YEAR)+' yrs'; | ||
else if (v >= 48 || v == 24) return nice_number(v/24)+' days'; | ||
else if (v >= 2 || v == 1) return nice_number(v)+' hrs'; | ||
else if (v >= 2/60. | v == 1/60.) return nice_number(v*60)+' min'; | ||
|
@@ -381,10 +411,10 @@ | |
var activity_header, activity_button; | ||
if (cutoff>0) { | ||
activity_header = 'Activity (μCi) above ' + cutoff.toExponential(4) + ' μCi'; | ||
activity_button = '<button class="activity_button no-print" onClick="show_cutoff(false);event.stopPropagation();">All</button>'; | ||
activity_button = '<button class="activity_button screen-only" onClick="show_cutoff(false);event.stopPropagation();">All</button>'; | ||
} else if (CUTOFF>0) { | ||
activity_header = 'Activity (μCi)'; | ||
activity_button = '<button class="activity_button no-print" onClick="show_cutoff(true);event.stopPropagation();">>'+CUTOFF.toExponential(4)+' μCi</button>'; | ||
activity_button = '<button class="activity_button screen-only" onClick="show_cutoff(true);event.stopPropagation();">>'+CUTOFF.toExponential(4)+' μCi</button>'; | ||
} else { | ||
activity_header = 'Activity (μCi)'; | ||
activity_button = ''; | ||
|
@@ -463,7 +493,34 @@ | |
|
||
// Decay time | ||
if (act.decay_time > 0) { | ||
content += '<br>Time to decay below '+act.decay_level.toExponential(4)+' μCi is '+format_time(act.decay_time)+'.\n'; | ||
content += '<br>Time to decay below '+act.decay_level.toExponential(4)+' μCi is '+format_time(act.decay_time); | ||
/* TODO: show cool-off date. | ||
The implementation below will confuse users since cool-off date is relative | ||
to the time off beam rather than the current time. This is okay when the | ||
"Decay" field is set for an existing sample, but the common case is to | ||
estimate activation for a sample you are planning to put on the beam not | ||
one that you have already measured and removed. We could tweak the interface | ||
so that we only display the cool-off date when decay time is negative or | ||
decay time is a time stamp, or we could just live with the confusion. | ||
I'm going to punt on this for now. | ||
// Add the "cool" date/time as the current time minus off beam time plus decay time. | ||
var decay_delta = act.decay_time - act.rest[4]; // in hours | ||
if (decay_delta < 0) { | ||
// Already past, print nothing. | ||
} else if (decay_delta < 7*24) { | ||
// Cool within one week: print date and time | ||
var decay_date = new Date(Date.now() + 1000*3600*decay_delta); // js timestamp is in ms | ||
content += ' [date: ' + decay_date.toLocaleString() + ']'; | ||
} else if (decay_delta < HOURS_PER_YEAR*100) { | ||
// Cool within one century, print date | ||
decay_delta += 26; // Force anything after 6AM into the next day | ||
var decay_date = new Date(Date.now() + 1000*3600*decay_delta); // js timestamp is in ms | ||
content += ' [date: ' + decay_date.toLocaleDateString() + ']'; | ||
} else { | ||
// More than a century in the future; print nothing. | ||
} | ||
*/ | ||
content += "\n"; | ||
} | ||
content += '</p>\n' | ||
|
||
|
@@ -564,14 +621,18 @@ | |
} | ||
} | ||
|
||
|
||
// End of div | ||
content += '</div>\n'; | ||
|
||
$(content).prependTo('div[id=results]'); //add to the dom | ||
$("table").tablesorter({sortList: [[8,1]]}); | ||
scroll_to_result(); | ||
} | ||
|
||
function scroll_to_result(){ | ||
var opt = {behavior: "smooth", block: "nearest"}; | ||
document.getElementById("results").firstChild.scrollIntoView(opt); | ||
} | ||
// Dynamic help support. Clicking an input field jumps to the | ||
// corresponding section of the help. Input "gork" uses: | ||
// <input id="id_gork" ...> | ||
|
@@ -598,24 +659,78 @@ | |
parse_url_parameters(); | ||
enable_forms(); | ||
setup_help(); | ||
var timestamp = (new Date(Date.parse(document.lastModified))).toLocaleDateString(); | ||
document.getElementById("lastmod-timestamp").innerHTML = timestamp; | ||
}); | ||
</script> | ||
|
||
</head> | ||
<body> | ||
|
||
<div class="screen-only"> | ||
<?php | ||
include("/var/www/include/navigation.inc"); | ||
include("/var/www/include/utility.inc"); | ||
?> | ||
<!-- Snapshot of navigation.inc and utility.inc from 2022-05-18. Move the | ||
ENDCOMMENT line above the table to show the banner from the local server. | ||
<table width="100%" border="0" cellpadding="0" cellspacing="0"> | ||
<tbody><tr align="center" valign="bottom"> | ||
<td background="https://www.ncnr.nist.gov/images/ncnr_banner_tile_2.png"> | ||
<table width="90%" border="0" cellpadding="0" cellspacing="0" height="66"> | ||
<tbody><tr valign="middle"> | ||
<td align="left"> | ||
<a href="#MainContent" tabindex="-1"><img src="https://www.ncnr.nist.gov/Hidden.gif" width="1" height="1" alt="skip to main content" align="left" border="0"></a> | ||
<img src="https://www.ncnr.nist.gov/images/ncnr_banner_title_2.gif" alt="NIST Center for Neutron Research" ismap="" border="0" usemap="#ncnrmap"> | ||
<map name="ncnrmap"> | ||
<area shape="rect" coords="0,19,355,40" href="http://www.ncnr.nist.gov/" alt="NIST Center for Neutron Research"> | ||
</map> | ||
</td> | ||
<td align="right"> | ||
<a href="http://www.nist.gov/" tabindex="-1"> | ||
<img src="https://www.ncnr.nist.gov/images/ncnr_banner_nist_name.gif" alt="National Institute of Standards and Technology" border="0"> | ||
</a> | ||
</td> | ||
</tr> | ||
</tbody></table> | ||
</td> | ||
</tr> | ||
</tbody></table> | ||
<table width="100%" cellpadding="0" cellspacing="0" border="0"> | ||
<tbody><tr align="center"> | ||
<td bgcolor="#ccccff"> | ||
<a href="https://nist.gov/ncnr" tabindex="-1"> | ||
<font face="arial, helvetica, sans-serif" color="#663399" size="3"><b>Home | ||
</b></font></a></td> | ||
<td bgcolor="#ccccff"> | ||
<a href="https://www.ncnr.nist.gov/ipeek" tabindex="-1"> | ||
<font face="arial, helvetica, sans-serif" color="#663399" size="3"><b>Live Data | ||
</b></font></a></td> | ||
<td bgcolor="#ccccff"> | ||
<a href="https://nist.gov/ncnr/neutron-instruments" tabindex="-1"> | ||
<font face="arial, helvetica, sans-serif" color="#663399" size="3"><b>Instruments | ||
</b></font></a></td> | ||
<td bgcolor="#ccccff"> | ||
<a href="https://nist.gov/ncnr/chrns" tabindex="-1"> | ||
<font face="arial, helvetica, sans-serif" color="#663399" size="3"><b>CHRNS | ||
</b></font></a></td> | ||
<td bgcolor="#ccccff"> | ||
<a href="https://nist.gov/ncnr/call-proposals" tabindex="-1"> | ||
<font face="arial, helvetica, sans-serif" color="#663399" size="3"><b>Proposals | ||
</b></font></a></td> | ||
</tr> | ||
</tbody></table> | ||
ENDCOMMENT --> | ||
<!-- end snapshot --> | ||
</div> | ||
|
||
<noscript> | ||
<h3>Enable javascript to run the activation calculator.</h3><hr /> | ||
</noscript> | ||
|
||
<div id="content-frame" class="container disabled"> | ||
|
||
<div id="activation-frame" class="no-print"> | ||
<div id="activation-frame" class="screen-only"> | ||
|
||
<form id="id-activationForm" class="blueForms" method="post"> | ||
|
||
|
@@ -686,11 +801,11 @@ <h3><span class="text">Neutron Activation</span></h3> | |
<div class="panel" id="scattering-panel"> | ||
<h3><span class="text">Absorption and Scattering</span></h3> | ||
<table><tbody><tr> | ||
<td> | ||
<td width="40%"> | ||
<label for="id_density" class="control-label">Density</label> | ||
</td><td> | ||
</td><td width="40%"> | ||
<label for="id_thickness" class="control-label">Thickness</label> | ||
</td> | ||
</td><td width="20%"></td> | ||
</tr><tr> | ||
<td> | ||
<div class="controls"><input id="id_density" type="text" class="textinput textInput" name="density" value="" title="Mass density as val or a:val b:val c:val (Å) alpha:val beta:val gamma:val (°)."></div> | ||
|
@@ -723,7 +838,7 @@ <h3><span class="text">Absorption and Scattering</span></h3> | |
</form> | ||
|
||
</div> | ||
<div id="help-frame" class="no-print"> | ||
<div id="help-frame" class="screen-only"> | ||
<div id="help_initial" class="help"> | ||
<h3>Neutron activation and scattering calculator</h3> | ||
<p> | ||
|
@@ -1056,19 +1171,19 @@ <h3>Decay</h3> | |
as "+01" for +1 hours in France in winter, when daylight savings time is | ||
not in effect. | ||
</p> | ||
<h4>Examples</h4> | ||
<p /> | ||
<table> | ||
<tr><th>If you type:</th><th>This is equivalent to:</th></tr> | ||
<tr><td>2 m</td><td>2 minutes ago</td></tr> | ||
<tr><td>1</td><td>1 hour ago</td></tr> | ||
<tr><td>2.5w</td><td>2 and a half weeks ago</td></tr> | ||
<tr><td>3 y</td><td>3 years ago</td></tr> | ||
<tr><td>2015-01-02 21:45:00</td><td>January 2, 2015 at 9:45 PM US/Eastern</td></tr> | ||
<tr><td>2010-03</td><td>March 31, 2010 at 11:59:59 PM US/Eastern</td></tr> | ||
<tr><td>2010-7-5 12:23</td><td>July 5, 2010 at 12:23:59 PM US/Eastern</td></tr> | ||
<tr><td>2015-01-02 21:45:00Z</td><td>January 2, 2015 at 9:45 PM UTC</td></tr> | ||
<tr><td>2015-01-02 21:45:00-0600</td><td>January 2, 2015 at 9:45 PM US/Central</td></tr> | ||
<tr><td>2015-08-02 21:45:00-0500</td><td>August 2, 2015 at 9:45 PM US/Central</td></tr> | ||
<tr><th class="timecol">If you type:</th><th>This is equivalent to:</th></tr> | ||
<tr><td class="timecol">2 m</td><td>2 minutes ago</td></tr> | ||
<tr><td class="timecol">1</td><td>1 hour ago</td></tr> | ||
<tr><td class="timecol">2.5w</td><td>2 and a half weeks ago</td></tr> | ||
<tr><td class="timecol">3 y</td><td>3 years ago</td></tr> | ||
<tr><td class="timecol">2015-01-02 21:45:00</td><td>January 2, 2015 at 9:45 PM US/Eastern</td></tr> | ||
<tr><td class="timecol">2010-03</td><td>March 31, 2010 at 11:59:59 PM US/Eastern</td></tr> | ||
<tr><td class="timecol">2010-7-5 12:23</td><td>July 5, 2010 at 12:23:59 PM US/Eastern</td></tr> | ||
<tr><td class="timecol">2015-01-02 21:45:00Z</td><td>January 2, 2015 at 9:45 PM UTC</td></tr> | ||
<tr><td class="timecol">2015-01-02 21:45:00-0600</td><td>January 2, 2015 at 9:45 PM US/Central</td></tr> | ||
<tr><td class="timecol">2015-08-02 21:45:00-0500</td><td>August 2, 2015 at 9:45 PM US/Central</td></tr> | ||
<tr><td></td><td></td></tr> | ||
</table> | ||
</div> | ||
|
@@ -1243,6 +1358,11 @@ <h3>References</h3> | |
<div id="help_history" class="help"> | ||
<h3>History</h3> | ||
<dl class="inline"> | ||
<dt>2022-05-18</dt><dd>Fix decay time calculation for long-lived isotopes and activation calculation for Eu. | ||
<br />Use standard year as 365 days when reporting activation times. | ||
<br />Improve style sheets for mobile and print. | ||
<br />Remove possible cross-site scripting attack vector. | ||
</dd> | ||
<dt>2021-04-21</dt><dd>Support energy-dependent rare earth elements. | ||
<br />Use complex scattering length b<sub>c</sub> when computing | ||
σ<sub>c</sub> = 4π |b<sub>c</sub>|<sup>2</sup>/100 and | ||
|
@@ -1284,13 +1404,16 @@ <h3 class="print-only">Activation and Scattering Results</h3> | |
</div> | ||
|
||
<hr> | ||
<div class="footer"> | ||
<div style="float:left;"><p> | ||
<em>Questions?</em><br> | ||
Neutron activation: NCNR Health Physics <<a href="mailto:[email protected]">[email protected]</a>><br> | ||
Scattering calculations: Paul Kienzle <<a href="mailto:[email protected]">[email protected]</a>> | ||
</p></div> | ||
<div style="float:right;"><p><?php lastmod(); ?></p></div> | ||
<div id="footer"> | ||
<div id="footer-left"><p> | ||
<em>Questions?</em><br> | ||
Neutron activation: NCNR Health Physics <<a href="mailto:[email protected]">[email protected]</a>><br> | ||
Scattering calculations: Paul Kienzle <<a href="mailto:[email protected]">[email protected]</a>> | ||
</p></div> | ||
<!-- <div id="footer-right"><p><?php lastmod(); ?></p></div> --> | ||
<div id="footer-right"> | ||
<p>Last modified <span id="lastmod-timestamp"></span> by website owner: NCNR</p> | ||
</div> | ||
</div> | ||
|
||
</body></html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These includes are likely to be abandoned in the future.