[Express] 'turn' pages using arrow keys?

hello all
I am building a site that is, in essence, a book
and I am wondering if Freeway (Express) supports ‘flipping’ web pages forward and back by hitting right/left arrow keys
is there a name for this? can we do it?
I’m using 5.5
thanks!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You’ll need to write some JavaScript for this, and you’ll need to also make your filenames something “guessable” if you don’t want to have to write the same code over and over with different variables.

Include Prototype first, then listen on the keydown event:

Event.observe(window, 'keydown', function(evt){
    var code = evt.keyCode;
    switch (code){
        case 37:
        // left
        break;
        case 39:
        // right
        break;
        default:
        break;
    }
});

Where I have left and right, you’ll have to add your code to jump to a different page. You could write all of your pages separately, with a different value for

window.location.href = 'next_page.html';

Or you could name your pages predictably and figure out the next and previous pages with math, and use one script page on all of your pages.

This isn’t simple, but it’s not impossible.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

thanks very much, Walter - I am a complete noob with code - (no, worse than a noob; I’m a boob, or a rube, or something) - anyway, I’m not sure where this code would go, or how to modify page-by-page, etc - there are 300+ pages to this ‘book’, and I was hoping I could just select something in a menu somewhere that said ‘Advance Pages With Key Command’, or something - sigh - no dice, huh? - is there a name for that feature, though? Flash makes something called PageFlipper, but I thought there was some new web protocol, similar to CSS, that incorporated that ability - oh well - I’ll try to steel myself for the task - thanks again - Rolf in MA


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Good lord. Are they all named something predictable, like
chapter001.html, chapter002.html, etc? If so, you could automate this
quite easily. I’ll write something up.

Walter

On Mar 22, 2011, at 7:26 PM, rbpspc wrote:

thanks very much, Walter - I am a complete noob with code - (no,
worse than a noob; I’m a boob, or a rube, or something) - anyway,
I’m not sure where this code would go, or how to modify page-by-
page, etc - there are 300+ pages to this ‘book’, and I was hoping I
could just select something in a menu somewhere that said ‘Advance
Pages With Key Command’, or something - sigh - no dice, huh? - is
there a name for that feature, though? Flash makes something called
PageFlipper, but I thought there was some new web protocol, similar
to CSS, that incorporated that ability - oh well - I’ll try to steel
myself for the task - thanks again - Rolf in MA


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just to prove that this could work, I made a folder with 100 pages in
it, each named page1.html, page2.html, etc. (I wrote a little 5-line
Ruby script to make them – I am not one for busy-work!) Each one of
the pages had this script declaration in its head:

To duplicate this in Freeway Express, move to the Master Page for all
of your content pages. Choose Page / HTML Markup from the main menu,
Using the picker on the lower-left side of the resulting dialog,
choose Before /head. Paste in all of the script from the preceding Gist.

Now, the contents of the arrows.js script:

Use a programmer’s text editor, like the lovely and free TextWrangler
from http://barebones.com to create this file. Click on the Raw link
to see a completely unadorned version of the script – you don’t want
to use TextEdit or Word or anything that makes “pretty” text files,
only a real programming editor will do for this. Save the file as
arrows.js, and use an FTP application to upload it into the same
folder on your server as all of the pages.

This script has a couple of assumptions built into it, one of them is
easy to change, but the other may be more challenging depending on
your actual filenames.

The first is that I stuck to 100 pages, so on line 15 of the Gist,
you’ll see a test to see if we’ve gone over 100. Change this to
reflect your actual number of pages.

The second has to do with how the pages are named. I used a very
predictable numeric sequence. This made for a very compact solution,
using nothing but arithmetic to arrive at the name of the next page.
If this doesn’t reflect your personal reality, then I may be able to
suggest another approach, so just let me know what your filenames look
like.

Walter

On Mar 22, 2011, at 9:08 PM, Walter Lee Davis wrote:

Good lord. Are they all named something predictable, like
chapter001.html, chapter002.html, etc? If so, you could automate
this quite easily. I’ll write something up.

Walter

On Mar 22, 2011, at 7:26 PM, rbpspc wrote:

thanks very much, Walter - I am a complete noob with code - (no,
worse than a noob; I’m a boob, or a rube, or something) - anyway,
I’m not sure where this code would go, or how to modify page-by-
page, etc - there are 300+ pages to this ‘book’, and I was hoping I
could just select something in a menu somewhere that said ‘Advance
Pages With Key Command’, or something - sigh - no dice, huh? - is
there a name for that feature, though? Flash makes something called
PageFlipper, but I thought there was some new web protocol, similar
to CSS, that incorporated that ability - oh well - I’ll try to
steel myself for the task - thanks again - Rolf in MA


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

wow - thanks, Walter - I will try this ASAP - thanks again!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options