Mercurial > hg > Members > atton > slideshow-s6cr
annotate s6/js/jquery.slideshow.autoplay.js @ 10:e5301b055cea
Delete letter-spacing setting
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 04 Aug 2016 13:27:27 +0900 |
parents | 05d802167c0c |
children |
rev | line source |
---|---|
1
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 /*********** |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 * |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 * autoplay addon: |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 * |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 * - use key-a/p/s to toggle autoplay (in projection mode) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 */ |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 Slideshow.playInit = function() |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 this.debug( 'calling playInit()' ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 this.playInterval = null; |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 Slideshow.playStart = function() |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 this.debug( 'calling playStart()' ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 if( this.settings.mode == 'autoplay' ) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 this.playToggle(); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 Slideshow.playKeys = function( event, key ) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 this.debug( 'calling playKeys()' ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 switch( key.which ) { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 case 65: //a |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 case 80: //p |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 case 83: //s |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 this.playToggle(); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 break; |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 // ------------------------------------------------ |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 Slideshow.playWorker = function() |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 this.debug( 'calling playWorker()' ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 // suspend autoplay in outline view (just slideshow view) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 if( !this.isProjection ) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 return; |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 // next slide/step, please |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 var csteps = this.steps[this.snum-1]; // current slide steps array |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 if( !csteps || this.incpos >= csteps.length ) { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 if( this.snum >= this.smax ) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 this.goTo( 1 ); // reached end of show? start with 1st slide again (for endless cycle) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 else |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 this.go(1); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 else { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 this.subgo(1); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 Slideshow.playToggle = function() |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 this.debug( 'calling playToggle()' ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 if( this.playInterval ) |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 this.debug( 'stopping autoplay' ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 clearInterval( this.playInterval ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 this.playInterval = null; |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75 else |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 this.debug( 'starting autoplay' ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78 this.playInterval = setInterval( $.proxy( Slideshow.playWorker, this), 2000 ); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 // ------------------------------------------------ |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 Slideshow.playAddEvents = function() |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 { |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86 $( document ).on( 'slideshow.init', $.proxy( Slideshow.playInit, this )); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 $( document ).on( 'slideshow.start', $.proxy( Slideshow.playStart, this )); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 $( document ).on( 'slideshow.keys', $.proxy( Slideshow.playKeys, this )); |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 } |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 |
05d802167c0c
Apply cr-style from Members/kaito/slides
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 Slideshow.playAddEvents(); |