<html>
<!--
UCAS Personal Statement Word Counter
-Copyright (c) 2014-2016 Adrian Iain Lam
+Copyright (c) 2014-2018 Adrian Iain Lam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
(For readability purpose only. Will NOT be present in the UCAS
submission)
</span>
+ <br />
+ <input id="teacher" type="checkbox" onclick="analyse()">
+ Teacher Training
+ <br />
+ <span class="note">
+ (UCAS Teacher Training uses a different counting method. Check
+ this box if you are applying for Teacher Training. Leave blank
+ for undergraduate application.)
+ </span>
<div id="stats" class="topPadding">
<div id="statLines">Lines: 0/47</div>
<div id="statChars">Characters: 0/4000</div>
<<a href="mailto:ail30@cam.ac.uk">ail30@cam.ac.uk</a>>.
</address>
<footer>
- <p>Copyright © 2014-2016 Adrian Iain Lam</p>
+ <p>Copyright © 2014-2018 Adrian Iain Lam</p>
<p>
This program is free software, and you are welcome to redistribute it
under the terms of the GNU GPL. This program comes with ABSOLUTELY NO
printStats(lines, 0, 0, parasWithExtraSpace, parasLines);
return;
}
+
+ var maxlinelen = 94;
+ if($("teacher").checked) maxlinelen = 80;
+
for(var i=0; i<paras.length; i++) {
if(paras[i][paras[i].length-1]==' ') parasWithExtraSpace.push(i+1);
do {
- if(paras[i][0]==' ') paras[i]=paras[i].substring(1); //remove preceding space
- line=paras[i].substring(0, paras[i].length>94?94:paras[i].length); //extract line of 94 chars or fewer
- var lastidx=line.lastIndexOf(' ');
- if(lastidx>=0) { //if there is a space in line
- if(line.length<94) lastidx=line.length; //if it can contain whole line
- } else lastidx=line.length;
- if(paras[i][94]==' ') lastidx=94; //if extracted right before a space
- paras[i] = line.substring(lastidx+1)+paras[i].substring(94); //remove extracted string (up to lastidx) from paras
+ if(paras[i][0]==' ') {
+ paras[i] = paras[i].substring(1); //remove preceding space
+ }
+
+ /* extract line of maxlinelen chars or fewer */
+ if(paras[i].length > maxlinelen) {
+ line = paras[i].substring(0, maxlinelen);
+ } else {
+ line = paras[i].substring(0, paras[i].length);
+ }
+
+ var lastidx = line.lastIndexOf(' ');
+ if(lastidx >= 0) { //if there is a space in line
+ if(line.length < maxlinelen) {
+ lastidx = line.length; //if it can contain whole line
+ }
+ } else {
+ lastidx = line.length; //cutoff line if line has maxlinelen
+ } // chars without spaces
+
+ if(paras[i][maxlinelen] == ' ') { //if extracted right before a space
+ lastidx = maxlinelen;
+ }
+ paras[i] = line.substring(lastidx+1)+paras[i].substring(maxlinelen); //remove extracted string (up to lastidx) from paras
line=line.substring(0, lastidx);
lines.push(line);
} while(paras[i]!="");