Skip to content
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

Fix chaimpeck/spray#3 #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ Spray is an open-source speed-reading application written in Javascript. It was

## Demo

The demo is hosted by the project's [GitHub Pages](http://the-happy-hippo.github.io/spray).

To view the demo, click on the following link: http://the-happy-hippo.github.io/spray/content
Fully functional demo: http://the-happy-hippo.github.io/spray/content

## Installation

Expand All @@ -30,4 +28,5 @@ Please contribute bug reports, feature requests, etc.

* [@chaimpeck](https://github.com/chaimpeck)
* [@the-happy-hippo](https://github.com/the-happy-hippo)
* [@maddes](https://github.com/maddes)

28 changes: 14 additions & 14 deletions content/js/spray-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ SprayReader.prototype = {
words: null,
isRunning: false,
timers: [],

setInput: function(input) {
this.input = input;

// Split on spaces
var allWords = input.split(/\s+/);

var word = '';
var result = '';

// Preprocess words
var tmpWords = allWords.slice(0); // copy Array
var t = 0;
Expand Down Expand Up @@ -53,35 +53,35 @@ SprayReader.prototype = {
this.words = tmpWords.slice(0);
this.wordIdx = 0;
},

setWpm: function(wpm) {
this.wpm = parseInt(wpm, 10);
this.msPerWord = 60000/wpm;
},

start: function() {
this.isRunning = true;

thisObj = this;

this.timers.push(setInterval(function() {
thisObj.displayWordAndIncrement();
}, this.msPerWord));
},

stop: function() {
this.isRunning = false;

for(var i = 0; i < this.timers.length; i++) {
clearTimeout(this.timers[i]);
}
},

displayWordAndIncrement: function() {
var pivotedWord = pivot(this.words[this.wordIdx]);

this.container.html(pivotedWord);

this.wordIdx++;
if (thisObj.wordIdx >= thisObj.words.length) {
this.wordIdx = 0;
Expand Down Expand Up @@ -153,5 +153,5 @@ function pivot(word){
// Let strings repeat themselves,
// because JavaScript isn't as awesome as Python.
String.prototype.repeat = function( num ){
return new Array( num + 1 ).join( this );
return (num<=0) ? "" : new Array( num + 1 ).join( this );
}
88 changes: 12 additions & 76 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,86 +1,22 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Spray</title>

<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="wrapper">
<header>
<h1>Spray</h1>
<p>An open-source speed-reading application written in Javascript</p>

<p class="view"><a href="https://github.com/the-happy-hippo/spray">View the Project on GitHub <small>the-happy-hippo/spray</small></a></p>


<ul>
<li><a href="https://github.com/the-happy-hippo/spray/zipball/master">Download <strong>ZIP File</strong></a></li>
<li><a href="https://github.com/the-happy-hippo/spray/tarball/master">Download <strong>TAR Ball</strong></a></li>
<li><a href="https://github.com/the-happy-hippo/spray">View On <strong>GitHub</strong></a></li>
</ul>
</header>
<section>
<h1>
<a name="spray-speed-reader" class="anchor" href="#spray-speed-reader"><span class="octicon octicon-link"></span></a>Spray Speed-Reader</h1>

<!DOCTYPE html><html><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="chrome=1"/><title>Spray</title><link rel="stylesheet" href="stylesheets/styles.css"/><link rel="stylesheet" href="stylesheets/pygment_trac.css"/><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/><!--if lt IE 9script(src='//html5shiv.googlecode.com/svn/trunk/html5.js')--></head><body><div class="wrapper"><header><h1>Spray</h1><p>An open-source speed-reading application written in Javascript</p><p class="view"><a href="https://github.com/the-happy-hippo/spray">View the Project on GitHub<small>the-happy-hippo/spray</small></a></p><ul><li><a href="https://github.com/the-happy-hippo/spray/zipball/master">Download<strong>ZIP File</strong></a></li><li><a href="https://github.com/the-happy-hippo/spray/tarball/master">Download<strong>TAR Ball</strong></a></li><li><a href="https://github.com/the-happy-hippo/spray">View On<strong>GitHub</strong></a></li></ul></header><section><h1 id="spray-speed-reader">Spray Speed-Reader</h1>
<p>An open-source speed-reading application written in Javascript.</p>

<h1>
<a name="about" class="anchor" href="#about"><span class="octicon octicon-link"></span></a>About</h1>

<h1 id="about">About</h1>
<p>Spray is an open-source speed-reading application written in Javascript. It was inspired by <a href="https://raw.github.com/Miserlou/OpenSpritz/">OpenSpritz</a> and currently contains the algorithm from that project, as well as the same styles.</p>

<h2>
<a name="demo" class="anchor" href="#demo"><span class="octicon octicon-link"></span></a>Demo</h2>

<p>The demo is hosted by the project's <a href="http://the-happy-hippo.github.io/spray">GitHub Pages</a>.</p>

<p>
To view the demo, click on the following link:

<a href="http://the-happy-hippo.github.io/spray/content/index.html" target="_blank">http://the-happy-hippo.github.io/spray/content</a></p>

<h2>
<a name="installation" class="anchor" href="#installation"><span class="octicon octicon-link"></span></a>Installation</h2>

<h2 id="demo">Demo</h2>
<p>Fully functional demo: <a href="http://the-happy-hippo.github.io/spray/content">http://the-happy-hippo.github.io/spray/content</a></p>
<h2 id="installation">Installation</h2>
<ol>
<li>Copy all files in <code>content/</code> to some directory on your webserver.</li>
<li>Enjoy speed-reading.</li>
<li>Copy all files in <code>content/</code> to some directory on your webserver.</li>
<li>Enjoy speed-reading.</li>
</ol>

<h2>
<a name="features" class="anchor" href="#features"><span class="octicon octicon-link"></span></a>Features</h2>

<h2 id="features">Features</h2>
<p>Coming soon...</p>

<h2>
<a name="contributing" class="anchor" href="#contributing"><span class="octicon octicon-link"></span></a>Contributing</h2>

<h2 id="contributing">Contributing</h2>
<p>Please contribute bug reports, feature requests, etc.</p>

<h3>
<a name="contributors" class="anchor" href="#contributors"><span class="octicon octicon-link"></span></a>Contributors</h3>

<h3 id="contributors">Contributors</h3>
<ul>
<li><a href="https://github.com/chaimpeck">@chaimpeck</a></li>
<li><a href="https://github.com/the-happy-hippo">@the-happy-hippo</a></li>
<li><a href="https://github.com/maddes">@maddes</a></li>
</ul>
</section>
<footer>
<p>This project is maintained by <a href="https://github.com/the-happy-hippo">the-happy-hippo</a></p>
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<script src="javascripts/scale.fix.js"></script>

</body>
</html>

</section><footer><p>This project is maintained by<a href="https://github.com/the-happy-hippo">the-happy-hippo</a></p><p><small>Hosted on GitHub Pages — Theme by<a href="https://github.com/orderedlist">orderedlist</a></small></p></footer></div><script src="javascripts/scale.fix.js"></script></body></html>
46 changes: 46 additions & 0 deletions index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
html
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='chrome=1')
title Spray
link(rel='stylesheet', href='stylesheets/styles.css')
link(rel='stylesheet', href='stylesheets/pygment_trac.css')
meta(name='viewport', content='width=device-width, initial-scale=1, user-scalable=no')
//if lt IE 9
script(src='//html5shiv.googlecode.com/svn/trunk/html5.js')
body
.wrapper
header
h1 Spray
p An open-source speed-reading application written in Javascript
p.view
a(href='https://github.com/the-happy-hippo/spray')
| View the Project on GitHub
small the-happy-hippo/spray
ul
li
a(href='https://github.com/the-happy-hippo/spray/zipball/master')
| Download
strong ZIP File
li
a(href='https://github.com/the-happy-hippo/spray/tarball/master')
| Download
strong TAR Ball
li
a(href='https://github.com/the-happy-hippo/spray')
| View On
strong GitHub
section
include:md README.md

footer
p
| This project is maintained by
a(href='https://github.com/the-happy-hippo') the-happy-hippo
p
small
| Hosted on GitHub Pages — Theme by
a(href='https://github.com/orderedlist') orderedlist
script(src='javascripts/scale.fix.js')