Skip to content

Commit 0e0f688

Browse files
committed
add hashing / location jumping to these slides
1 parent 7722173 commit 0e0f688

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ For this course, I've suggested your company set up the following tools:
388388

389389
.. class:: incremental
390390

391-
* **Python 3.3**: the latest ang greatest version of Python
391+
* **Python 2.7**: the widely used Python version
392392
* **IPython**: an interactive Python shell
393393
* **pip**: python's package manager
394394
* **IPython Notebook**: a browser-based Python REPL and interactive environment

monitor.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/bin/bash
2+
python -mSimpleHTTPServer &
3+
proc_pid="$!"
4+
trap "echo 'killing server' && kill $proc_pid" SIGINT
25
./autocompile.py . .rst "bash build.sh"

ui/small-black/slides.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ function go(step) {
170170
ce.style.visibility = 'hidden';
171171
ne.style.visibility = 'visible';
172172
jl.selectedIndex = snum;
173+
location.hash = "(" + snum + ")";
173174
currentSlide();
174175
number = 0;
175176
}
@@ -250,7 +251,7 @@ function keys(key) {
250251
case 13: // enter
251252
if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
252253
if (key.target && isParentOrSelf(key.target, 'controls')) return;
253-
if(number != undef) {
254+
if(number != undef && number != 0) {
254255
goTo(number);
255256
break;
256257
}
@@ -278,7 +279,7 @@ function keys(key) {
278279
}
279280
break;
280281
case 36: // home
281-
goTo(0);
282+
//goTo(0);
282283
break;
283284
case 35: // end
284285
goTo(smax-1);
@@ -316,12 +317,20 @@ function clicker(e) {
316317
}
317318

318319
function findSlide(hash) {
319-
var target = document.getElementById(hash);
320-
if (target) {
321-
for (var i = 0; i < slideIDs.length; i++) {
322-
if (target.id == slideIDs[i]) return i;
323-
}
324-
}
320+
if (hash.indexOf("(") === 0) {
321+
var jumpSlide = hash.replace("(", "").replace(")", "");
322+
jumpSlide = parseInt(jumpSlide);
323+
if (jumpSlide > 0) {
324+
return jumpSlide;
325+
}
326+
} else {
327+
var target = document.getElementById(hash);
328+
if (target) {
329+
for (var i = 0; i < slideIDs.length; i++) {
330+
if (target.id == slideIDs[i]) return i;
331+
}
332+
}
333+
}
325334
return null;
326335
}
327336

@@ -404,8 +413,8 @@ function createControls() {
404413

405414
function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
406415
if (!s5mode) return false;
407-
var vScale = 22; // both yield 32 (after rounding) at 1024x768
408-
var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
416+
var vScale = 23; // both yield 32 (after rounding) at 1024x768
417+
var hScale = 33; // perhaps should auto-calculate based on theme's declared value?
409418
if (window.innerHeight) {
410419
var vSize = window.innerHeight;
411420
var hSize = window.innerWidth;
@@ -550,10 +559,9 @@ function startup() {
550559
}
551560
document.onkeyup = keys;
552561
document.onkeypress = trap;
553-
document.onclick = clicker;
554-
document.oncontextmenu = function() {
555-
go(-1);
556-
return false;
562+
// document.onclick = clicker;
563+
window.onhashchange = function() {
564+
slideJump();
557565
};
558566
}
559567
}

0 commit comments

Comments
 (0)