Skip to content

Commit 74cd394

Browse files
author
javiercordero
committed
Fully implemented rewind and fast forwarding.
1 parent c37bb83 commit 74cd394

File tree

3 files changed

+83
-6
lines changed

3 files changed

+83
-6
lines changed

index.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,17 @@ <h3>Welcome to Imaginary Teleprompter!</h3>
193193
<h3>Here are some of our features:</h3>
194194
<ol>
195195
<li>Control the speed and text-size with the 'Up' and 'Down' arrow keys, the 'W' and 'S' keys or the mouse wheel. You may press 'Spacebar' to pause at anytime.</li>
196+
<li>Move half a screen backwards or forwards by pressing the 'PageUp' and 'PageDown' keys.</li>
196197
<li>Dynamically change the font-size by pressing 'Left' and 'Right' or the 'A' and 'D' keys.</li>
197198
<li>Flip modes allow <em>mirroring</em> the prompter in every possible way.</li>
198199
<li>You can use one or two instances. Mirror one, monitor on the other one.</li>
199200
<li><a id="5" name="5">Set almost any key as a <em>marker</em> and instantly jump to any part of the script. Try pressing '5' now!</a></li>
200201
<li>Different focus areas allow you to easily use Teleprompter with a webcam, a tablet, or professional teleprompter equipment.</li>
201202
<li>Time your segments with the built in <em>timer</em>. Press 'Backspace' to reset the timer.</li>
202-
<li><a>You can also set nameless <em>markers</em> and move accross them using the Home and End buttons.</a></li>
203+
<li><a name data-cke-saved-name>You can also set nameless <em>markers</em> and move accross them using the Home and End buttons.</a></li>
203204
<li>Tweak the <em>Speed</em>, <em>Acceleration Curve</em> and <em>Font Size</em> settings to fit your hosts' needs.</li>
205+
<li>Press 'F11' to enter and leave fullscreen.
206+
You may fullscreen the text editor for greater concentration.</li>
204207
<li>The Rich Text Editor, derived from the highly customizable CKeditor, gives unlimited possibilities on what you can prompt.</li>
205208
<ul>
206209
<!--
@@ -223,8 +226,6 @@ <h3>Here are some of our features:</h3>
223226
<img alt="Picture: Arecibo Sky" src="img/arecibo-sky.jpg">
224227
</li>
225228
</ul>
226-
<li>Press 'F11' to enter and leave fullscreen.
227-
You may fullscreen the text editor for greater concentration.</li>
228229
<li>There are various <em>Prompter Styles</em> to choose from. You may also create your own.</li>
229230
<!-- <li>Download our mobile app, <em>Teleprompter X</em>, to remote control Teleprompter instalations.</li> -->
230231
<li>Run the "External prompter" on a second screen, add new contents into the editor, then "Update" your prompter in realtime without having to halt your script.</li>

js/editor.js

+20-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/teleprompter.js

+59-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/onversionchange
6363
"restoreEditor":15,
6464
"resetTimer":16,
6565
"nextAnchor":17,
66-
"previousAnchor":18
66+
"previousAnchor":18,
67+
"fastForward":19,
68+
"rewind":20
6769
});
6870

6971
// Global constants
@@ -729,6 +731,40 @@ https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/onversionchange
729731
resumeAnimation();
730732
}
731733

734+
function internalFastForward() {
735+
const currPos = getCurrPos();
736+
if (flipV) {
737+
if (currPos < 0 - screenHeight * 0.5) {
738+
const nextPos = currPos + screenHeight/2;
739+
animate(0, nextPos);
740+
resumeAnimation();
741+
}
742+
}
743+
else
744+
if (currPos > -promptHeight + screenHeight*1.5) { // < 0 || flipV && jump > -promptHeight + screenHeight || !flipV && !next || flipV && !next ) {
745+
const nextPos = currPos - screenHeight/2;
746+
animate(0, nextPos);
747+
resumeAnimation();
748+
}
749+
}
750+
751+
function internalRewind() {
752+
const currPos = getCurrPos();
753+
if (flipV) {
754+
if (currPos > -promptHeight + screenHeight*1.5) { // < 0 || flipV && jump > -promptHeight + screenHeight || !flipV && !next || flipV && !next ) {
755+
const nextPos = currPos - screenHeight/2;
756+
animate(0, nextPos);
757+
resumeAnimation();
758+
}
759+
}
760+
else
761+
if (currPos < 0 - screenHeight * 0.5) { // < 0 || flipV && jump > -promptHeight + screenHeight || !flipV && !next || flipV && !next ) {
762+
const nextPos = currPos + screenHeight/2;
763+
animate(0, nextPos);
764+
resumeAnimation();
765+
}
766+
}
767+
732768
// Update unit and unit related measurements
733769
function updateUnit() {
734770
unit = focusHeight/80;
@@ -1061,6 +1097,12 @@ https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/onversionchange
10611097
case command.previousAnchor :
10621098
internalMoveToNextAnchor(false);
10631099
break;
1100+
case command.fastForward :
1101+
internalFastForward();
1102+
break;
1103+
case command.rewind :
1104+
internalRewind();
1105+
break;
10641106
default :
10651107
// Notify unknown message received.
10661108
if (debug) console.log("Unknown post message received: "+message.request) && false;
@@ -1170,6 +1212,22 @@ https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/onversionchange
11701212
}
11711213
});
11721214
break;
1215+
case 34 :
1216+
case "PageDown" :
1217+
listener({
1218+
data: {
1219+
request: command.fastForward
1220+
}
1221+
});
1222+
break;
1223+
case 33 :
1224+
case "PageUp" :
1225+
listener({
1226+
data: {
1227+
request: command.rewind
1228+
}
1229+
});
1230+
break;
11731231
default: // Move to anchor.
11741232
// If key is not a string
11751233
if(!isFunction(event.key.indexOf))

0 commit comments

Comments
 (0)