└── git-talk
├── img
├── .DS_Store
├── git.jpg
├── linus.jpg
├── git-cmd.png
├── git-log.png
├── git-pro.jpg
├── git-qa.jpg
├── git-branch.jpg
├── git-cmd-2.jpg
├── git-flow-2.jpg
├── git-flow.gif
├── git-index.png
├── git-remote.png
├── git-reset.jpg
├── git-status.png
├── os-linux.jpg
├── git-advance.jpg
├── git-objects.png
├── git-overview.jpg
├── git_big_jb51.jpg
├── just-for-fun.jpg
├── git-cheatsheet.png
├── git-juche-server.png
└── nodeschool-git-it.png
├── apple-touch-icon.png
├── extensions
├── status
│ ├── deck.status.css
│ └── deck.status.js
├── hash
│ ├── deck.hash.css
│ └── deck.hash.js
├── scale
│ ├── deck.scale.css
│ └── deck.scale.js
├── goto
│ ├── deck.goto.css
│ └── deck.goto.js
├── menu
│ ├── deck.menu.css
│ └── deck.menu.js
└── navigation
│ ├── deck.navigation.css
│ └── deck.navigation.js
├── s6
├── print.css
├── jquery.microsoft.js
├── screen.css
├── projection.css
└── jquery.slideshow.js
├── themes
├── transition
│ ├── fade.css
│ ├── horizontal-slide.css
│ └── vertical-slide.css
└── style
│ ├── swiss.css
│ ├── neon.css
│ └── web-2.0.css
├── git.css
├── git.md
├── core
├── deck.core.css
└── deck.core.js
├── lib
└── modernizr.custom.js
├── git.pdf.html
├── git.html
└── js
└── impress.js
/git-talk/img/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/.DS_Store
--------------------------------------------------------------------------------
/git-talk/img/git.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git.jpg
--------------------------------------------------------------------------------
/git-talk/img/linus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/linus.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-cmd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-cmd.png
--------------------------------------------------------------------------------
/git-talk/img/git-log.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-log.png
--------------------------------------------------------------------------------
/git-talk/img/git-pro.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-pro.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-qa.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-qa.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-branch.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-branch.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-cmd-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-cmd-2.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-flow-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-flow-2.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-flow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-flow.gif
--------------------------------------------------------------------------------
/git-talk/img/git-index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-index.png
--------------------------------------------------------------------------------
/git-talk/img/git-remote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-remote.png
--------------------------------------------------------------------------------
/git-talk/img/git-reset.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-reset.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-status.png
--------------------------------------------------------------------------------
/git-talk/img/os-linux.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/os-linux.jpg
--------------------------------------------------------------------------------
/git-talk/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/apple-touch-icon.png
--------------------------------------------------------------------------------
/git-talk/img/git-advance.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-advance.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-objects.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-objects.png
--------------------------------------------------------------------------------
/git-talk/img/git-overview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-overview.jpg
--------------------------------------------------------------------------------
/git-talk/img/git_big_jb51.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git_big_jb51.jpg
--------------------------------------------------------------------------------
/git-talk/img/just-for-fun.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/just-for-fun.jpg
--------------------------------------------------------------------------------
/git-talk/img/git-cheatsheet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-cheatsheet.png
--------------------------------------------------------------------------------
/git-talk/img/git-juche-server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/git-juche-server.png
--------------------------------------------------------------------------------
/git-talk/img/nodeschool-git-it.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/git-talk-md/master/git-talk/img/nodeschool-git-it.png
--------------------------------------------------------------------------------
/git-talk/extensions/status/deck.status.css:
--------------------------------------------------------------------------------
1 | .deck-container .deck-status {
2 | position: absolute;
3 | bottom: 10px;
4 | right: 5px;
5 | color: #888;
6 | z-index: 3;
7 | margin: 0;
8 | }
9 |
10 | @media print {
11 | .deck-status {
12 | display: none;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/git-talk/extensions/hash/deck.hash.css:
--------------------------------------------------------------------------------
1 | .deck-container .deck-permalink {
2 | display: none;
3 | position: absolute;
4 | z-index: 4;
5 | bottom: 30px;
6 | right: 0;
7 | width: 48px;
8 | text-align: center;
9 | }
10 |
11 | .no-history .deck-container:hover .deck-permalink {
12 | display: block;
13 | }
14 |
--------------------------------------------------------------------------------
/git-talk/extensions/scale/deck.scale.css:
--------------------------------------------------------------------------------
1 | .csstransforms .deck-container.deck-scale {
2 | width: auto;
3 | -webkit-transform-origin: 50% 0;
4 | -moz-transform-origin: 50% 0;
5 | -o-transform-origin: 50% 0;
6 | -ms-transform-origin: 50% 0;
7 | transform-origin: 50% 0;
8 | }
9 | .csstransforms .deck-container.deck-scale.deck-menu {
10 | width: 70%;
11 | -webkit-transform: none !important;
12 | -moz-transform: none !important;
13 | -o-transform: none !important;
14 | -ms-transform: none !important;
15 | transform: none !important;
16 | }
17 |
--------------------------------------------------------------------------------
/git-talk/extensions/goto/deck.goto.css:
--------------------------------------------------------------------------------
1 | .deck-container .goto-form {
2 | position: absolute;
3 | z-index: 3;
4 | bottom: 10px;
5 | left: 50%;
6 | height: 1.75em;
7 | margin: 0 0 0 -7.125em;
8 | line-height: 1.75em;
9 | padding: 0.625em;
10 | display: none;
11 | background: #ccc;
12 | overflow: hidden;
13 | }
14 | .borderradius .deck-container .goto-form {
15 | -webkit-border-radius: 10px;
16 | -moz-border-radius: 10px;
17 | border-radius: 10px;
18 | }
19 | .deck-container .goto-form label {
20 | font-weight: bold;
21 | }
22 | .deck-container .goto-form label, .deck-container .goto-form input {
23 | display: inline-block;
24 | font-family: inherit;
25 | }
26 |
27 | .deck-goto .goto-form {
28 | display: block;
29 | }
30 |
31 | #goto-slide {
32 | width: 4.375em;
33 | margin: 0 0.625em;
34 | height: 1.4375em;
35 | }
36 |
37 | @media print {
38 | .goto-form, #goto-slide {
39 | display: none !important;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/git-talk/s6/print.css:
--------------------------------------------------------------------------------
1 | /*********************************
* CSS @media print rules (not projection or screen)
*/
/*************
* Make sure all slides are visible (to make them all appear in prin)
*/
.slide { page-break-inside: avoid;
display: block !important;
}
h1 { page-break-after: avoid; }
ul { page-break-inside: avoid; }
body { font-size: 12pt; }
/********************
* Extra styling for first slide (title slide)
*/
#slide1 h1 { font-size: 200%; border: none; margin: 0.5em 0 0.25em; }
#slide1 h3 { margin: 0; padding: 0;}
#slide1 h4 { margin: 0 0 0.5em; padding: 0;}
#slide1 { margin-bottom: 3em; }
h1 { border-top: 2pt solid gray;
border-bottom: 1px dotted silver;
}
/******
* Turn on print-specific stuff/classes
*/
.extra { background: transparent !important; }
div.extra, pre.extra, .example { font-size: 10pt; color: #333; }
ul.extra a { font-weight: bold; }
/*****
* Turn off online (screen/projection)-specific stuff/classes
*/
p.example { display: none; }
/*****************
* The following rule keeps the layout stuff out of print.
* Remove at your own risk!
*/
.layout,
.layout * {display: none !important;}
.projection { display: none; }
--------------------------------------------------------------------------------
/git-talk/s6/jquery.microsoft.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | $(document).ready( function() {
4 |
5 | // 1) remove all content
6 | $( 'body > *' ).remove();
7 |
8 | // 2) show banner
9 | $( "
" ).html(
10 | "
"
11 | + "Microsoft's Internet Explorer browser has no built-in vector graphics machinery "
12 | + "required for 'loss-free' gradient background themes."
13 | + "
"
14 | + "
"
15 | + "Please upgrade to a better browser "
16 | + "such as Firefox , Opera , "
17 | + "Chrome , Safari or others "
18 | + "with built-in vector graphics machinery and much more. "
19 | + "(Learn more or post questions or comments "
20 | + "at the Slide Show (S9) project site. Thanks!)"
21 | + "
"
22 | )
23 | .css( {
24 | border: 'red solid thick',
25 | padding: '1em',
26 | fontFamily: 'sans-serif',
27 | fontWeight: 'bold' } )
28 | .prependTo( 'body' );
29 | }
30 | );
31 |
32 |
--------------------------------------------------------------------------------
/git-talk/extensions/menu/deck.menu.css:
--------------------------------------------------------------------------------
1 | .deck-menu .slide {
2 | background: #eee;
3 | position: relative;
4 | left: 0;
5 | top: 0;
6 | visibility: visible;
7 | cursor: pointer;
8 | }
9 | .no-csstransforms .deck-menu > .slide {
10 | float: left;
11 | width: 22%;
12 | height: 22%;
13 | min-height: 0;
14 | margin: 1%;
15 | font-size: 0.22em;
16 | overflow: hidden;
17 | padding: 0 0.5%;
18 | }
19 | .csstransforms .deck-menu > .slide {
20 | -webkit-transform: scale(0.22);
21 | -moz-transform: scale(0.22);
22 | -o-transform: scale(0.22);
23 | -ms-transform: scale(0.22);
24 | transform: scale(0.22);
25 | -webkit-transform-origin: 0 0;
26 | -moz-transform-origin: 0 0;
27 | -o-transform-origin: 0 0;
28 | -ms-transform-origin: 0 0;
29 | transform-origin: 0 0;
30 | -webkit-box-sizing: border-box;
31 | -moz-box-sizing: border-box;
32 | box-sizing: border-box;
33 | width: 100%;
34 | height: 100%;
35 | overflow: hidden;
36 | padding: 0 48px;
37 | }
38 | .deck-menu iframe, .deck-menu img, .deck-menu video {
39 | max-width: 100%;
40 | }
41 | .deck-menu .deck-current, .no-touch .deck-menu .slide:hover {
42 | background: #ddf;
43 | }
44 | .deck-menu.deck-container:hover .deck-prev-link, .deck-menu.deck-container:hover .deck-next-link {
45 | display: none;
46 | }
47 |
--------------------------------------------------------------------------------
/git-talk/s6/screen.css:
--------------------------------------------------------------------------------
1 | /*********************************
2 | * CSS @media screen (not projection or print)
3 | *
4 | * 1) projection -> slideshow mode (display one slide at-a-time; hide all others)
5 | * 2) screen -> outline mode (display all slides-at-once on screen)
6 | * 3) print -> print (and print preview)
7 | *
8 | * toogle between slideshow/outline mode using t-key
9 | */
10 |
11 |
12 | /****
13 | * hide layout stuff (header, footer, navLinks, navList etc.)
14 | */
15 |
16 | .layout * { display: none; }
17 |
18 | .projection { display: none; }
19 |
20 | /*************
21 | * make toggle button visible and reposition to upper right corner *
22 | * note: toogle button is nested inside #controls > #navLinks > #toogle
23 | */
24 |
25 | #controls,
26 | #navLinks,
27 | #toggle { display: block;
28 | visibility: visible;
29 | margin: 0; padding: 0;
30 | }
31 |
32 | #toggle { position: fixed;
33 | top: 0; right: 0;
34 | padding: 0.5em;
35 | border-left: 1px solid;
36 | border-bottom: 1px solid;
37 | background: white;
38 | }
39 |
40 |
41 | /*************
42 | * making the outline look pretty-ish
43 | */
44 |
45 | #slide1, #slide1 h1, #slide1 h2, #slide1 h3, #slide1 h4 {border: none; margin: 0;}
46 | #slide1 h1 {padding-top: 1.5em;}
47 |
48 | .slide { margin: 1.5em 0 0; border-top: 1px solid #888; }
49 | .slide h1 { border-bottom: 1px solid #AAA; }
50 |
51 |
--------------------------------------------------------------------------------
/git-talk/extensions/navigation/deck.navigation.css:
--------------------------------------------------------------------------------
1 | .deck-container .deck-prev-link, .deck-container .deck-next-link {
2 | display: none;
3 | position: absolute;
4 | z-index: 3;
5 | top: 50%;
6 | width: 32px;
7 | height: 32px;
8 | margin-top: -16px;
9 | font-size: 20px;
10 | font-weight: bold;
11 | line-height: 32px;
12 | vertical-align: middle;
13 | text-align: center;
14 | text-decoration: none;
15 | color: #fff;
16 | background: #888;
17 | }
18 | .borderradius .deck-container .deck-prev-link, .borderradius .deck-container .deck-next-link {
19 | -webkit-border-radius: 16px;
20 | -moz-border-radius: 16px;
21 | border-radius: 16px;
22 | }
23 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited {
24 | color: #fff;
25 | }
26 | .deck-container .deck-prev-link {
27 | left: 8px;
28 | }
29 | .deck-container .deck-next-link {
30 | right: 8px;
31 | }
32 | .deck-container:hover .deck-prev-link, .deck-container:hover .deck-next-link {
33 | display: block;
34 | }
35 | .deck-container:hover .deck-prev-link.deck-nav-disabled, .touch .deck-container:hover .deck-prev-link, .deck-container:hover .deck-next-link.deck-nav-disabled, .touch .deck-container:hover .deck-next-link {
36 | display: none;
37 | }
38 |
39 | @media print {
40 | .deck-prev-link, .deck-next-link {
41 | display: none !important;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/git-talk/themes/transition/fade.css:
--------------------------------------------------------------------------------
1 | .csstransitions.csstransforms .deck-container .slide {
2 | -webkit-transition: opacity 500ms ease-in-out 0ms;
3 | -moz-transition: opacity 500ms ease-in-out 0ms;
4 | -ms-transition: opacity 500ms ease-in-out 0ms;
5 | -o-transition: opacity 500ms ease-in-out 0ms;
6 | transition: opacity 500ms ease-in-out 0ms;
7 | }
8 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide {
9 | position: absolute;
10 | top: 0;
11 | left: 0;
12 | -webkit-box-sizing: border-box;
13 | -moz-box-sizing: border-box;
14 | box-sizing: border-box;
15 | width: 100%;
16 | padding: 0 48px;
17 | }
18 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .slide {
19 | position: relative;
20 | left: 0;
21 | top: 0;
22 | opacity: 0;
23 | }
24 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-previous {
25 | opacity: 0.4;
26 | }
27 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-current {
28 | opacity: 1;
29 | }
30 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-after {
31 | opacity: 0;
32 | pointer-events: none;
33 | }
34 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before .slide, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous .slide {
35 | visibility: visible;
36 | }
37 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current {
38 | opacity: 1;
39 | visibility: visible;
40 | pointer-events: auto;
41 | }
42 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current .deck-after {
43 | visibility: hidden;
44 | }
45 |
--------------------------------------------------------------------------------
/git-talk/git.css:
--------------------------------------------------------------------------------
1 | @import url(s6/projection.css); /* required to make the slide show run at all */
2 |
3 | body { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; }
4 |
5 | a:link, a:visited { color: black; }
6 |
7 | .slide h1 { font-size: 30pt; }
8 |
9 | .slide h1 { text-align: center; }
10 |
11 | .slide h1.fullscreen { position: absolute;
12 | top: 40%;
13 | width: 100%; }
14 |
15 | /* lets you create slides with no heading (because heading is hidden but gets included in toc) */
16 | .slide h1.hidden { display: none; }
17 |
18 |
19 | .slide h2 { font-size: 28pt; }
20 |
21 | h3 { font-size: 25pt; }
22 |
23 | /* todo: add special formating for .cover slide
24 | lets you use h1(cover). for title/cover slide (a la S5 slide0) but more generic (not bound to 1st slide)
25 | */
26 |
27 | .cover h1 { /* tbd */ }
28 | .cover h2 { /* tbd */ }
29 |
30 | /* todo: add special formating for h1, h2 in footer */
31 |
32 | #footer h1 { /* tbd */ }
33 | #footer h2 { /* tbd */ }
34 |
35 |
36 | p, li, dt, dd, td, th { font-size: 18pt; }
37 |
38 | ul { list-style-type: square; }
39 |
40 | /**********************************/
41 | /* general text-alignment classes */
42 |
43 | .left { text-align: left; }
44 | .center { text-align: center; }
45 | .right { text-align: right; }
46 |
47 | /**********************************/
48 | /* general font-size classes */
49 |
50 | .small { font-size: 97%; }
51 |
52 | .x-small,
53 | .smaller { font-size: 88%; }
54 |
55 | .xx-small,
56 | .smallest,
57 | .tiny { font-size: 82%; }
58 |
59 |
60 |
61 | pre { font-size: 16pt; }
62 |
63 | .code {
64 | background-color: azure;
65 | padding: 5px;
66 | }
67 |
68 | .footnote a:first-of-type { text-decoration: none; }
69 |
70 |
71 | p.small { font-size: 97%; }
72 |
73 | p.x-small,
74 | p.smaller,
75 | p.footnote { font-size: 88%; }
76 |
77 | p.xx-small,
78 | p.smallest,
79 | p.tiny { font-size: 82%; }
80 |
81 |
82 | .help p,
83 | .help td { font-size: 88%; }
84 |
85 |
86 | .step { color: silver; }
87 | /* or hide next steps e.g. .step { visibility: hidden; } */
88 | .stepcurrent { color: black; }
89 |
90 |
91 |
--------------------------------------------------------------------------------
/git-talk/themes/style/swiss.css:
--------------------------------------------------------------------------------
1 | .deck-container {
2 | font-family: "Helvetica Neue", sans-serif;
3 | font-size: 1.25em;
4 | background: #fff;
5 | }
6 | .deck-container .slide {
7 | background: #fff;
8 | }
9 | .deck-container h1 {
10 | color: #000;
11 | }
12 | .deck-container h2 {
13 | color: #c00;
14 | border-bottom-color: #ccc;
15 | }
16 | .deck-container h3 {
17 | color: #888;
18 | }
19 | .deck-container pre {
20 | border-color: #ccc;
21 | }
22 | .deck-container code {
23 | color: #888;
24 | }
25 | .deck-container blockquote {
26 | font-size: 2em;
27 | font-style: italic;
28 | padding: 1em 2em;
29 | color: #000;
30 | border-left: 5px solid #ccc;
31 | }
32 | .deck-container blockquote p {
33 | margin: 0;
34 | }
35 | .deck-container blockquote cite {
36 | font-size: .5em;
37 | font-style: normal;
38 | font-weight: bold;
39 | color: #888;
40 | }
41 | .deck-container ::-moz-selection {
42 | background: #c00;
43 | color: #fff;
44 | }
45 | .deck-container ::selection {
46 | background: #c00;
47 | color: #fff;
48 | }
49 | .deck-container a, .deck-container a:hover, .deck-container a:focus, .deck-container a:active, .deck-container a:visited {
50 | color: #c00;
51 | text-decoration: none;
52 | }
53 | .deck-container a:hover, .deck-container a:focus {
54 | text-decoration: underline;
55 | }
56 | .deck-container .deck-prev-link, .deck-container .deck-next-link {
57 | background: #ccc;
58 | font-family: serif;
59 | }
60 | .deck-container .deck-prev-link, .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited {
61 | color: #fff;
62 | }
63 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus {
64 | background: #c00;
65 | text-decoration: none;
66 | }
67 | .deck-container .deck-status {
68 | font-size: 0.6666em;
69 | }
70 | .deck-container.deck-menu .slide {
71 | background: #eee;
72 | }
73 | .deck-container.deck-menu .deck-current, .no-touch .deck-container.deck-menu .slide:hover {
74 | background: #ddf;
75 | }
76 |
--------------------------------------------------------------------------------
/git-talk/extensions/status/deck.status.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Deck JS - deck.status
3 | Copyright (c) 2011 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7 | */
8 |
9 | /*
10 | This module adds a (current)/(total) style status indicator to the deck.
11 | */
12 | (function($, deck, undefined) {
13 | var $d = $(document);
14 |
15 | /*
16 | Extends defaults/options.
17 |
18 | options.selectors.statusCurrent
19 | The element matching this selector displays the current slide number.
20 |
21 | options.selectors.statusTotal
22 | The element matching this selector displays the total number of slides.
23 |
24 | options.countNested
25 | If false, only top level slides will be counted in the current and
26 | total numbers.
27 | */
28 | $.extend(true, $[deck].defaults, {
29 | selectors: {
30 | statusCurrent: '.deck-status-current',
31 | statusTotal: '.deck-status-total'
32 | },
33 |
34 | countNested: true
35 | });
36 |
37 | $d.bind('deck.init', function() {
38 | var opts = $[deck]('getOptions');
39 |
40 | // Start on first slide
41 | $(opts.selectors.statusCurrent).text(1);
42 | // Set total slides once
43 | if (opts.countNested) {
44 | $(opts.selectors.statusTotal).text($[deck]('getSlides').length);
45 | }
46 | else {
47 | /* Determine root slides by checking each slide's ancestor tree for
48 | any of the slide classes. */
49 | var rootIndex = 1,
50 | slideTest = $.map([
51 | opts.classes.before,
52 | opts.classes.previous,
53 | opts.classes.current,
54 | opts.classes.next,
55 | opts.classes.after
56 | ], function(el, i) {
57 | return '.' + el;
58 | }).join(', ');
59 |
60 | /* Store the 'real' root slide number for use during slide changes. */
61 | $.each($[deck]('getSlides'), function(i, $el) {
62 | var $parentSlides = $el.parentsUntil(opts.selectors.container, slideTest);
63 |
64 | $el.data('rootSlide', $parentSlides.length ?
65 | $parentSlides.last().data('rootSlide') :
66 | rootIndex++
67 | );
68 | });
69 |
70 | $(opts.selectors.statusTotal).text(rootIndex - 1);
71 | }
72 | })
73 | /* Update current slide number with each change event */
74 | .bind('deck.change', function(e, from, to) {
75 | var opts = $[deck]('getOptions');
76 |
77 | $(opts.selectors.statusCurrent).text(opts.countNested ?
78 | to + 1 :
79 | $[deck]('getSlide', to).data('rootSlide')
80 | );
81 | });
82 | })(jQuery, 'deck');
83 |
84 |
--------------------------------------------------------------------------------
/git-talk/extensions/navigation/deck.navigation.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Deck JS - deck.navigation
3 | Copyright (c) 2011 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7 | */
8 |
9 | /*
10 | This module adds clickable previous and next links to the deck.
11 | */
12 | (function($, deck, undefined) {
13 | var $d = $(document);
14 |
15 | /*
16 | Extends defaults/options.
17 |
18 | options.classes.navDisabled
19 | This class is added to a navigation link when that action is disabled.
20 | It is added to the previous link when on the first slide, and to the
21 | next link when on the last slide.
22 |
23 | options.selectors.nextLink
24 | The elements that match this selector will move the deck to the next
25 | slide when clicked.
26 |
27 | options.selectors.previousLink
28 | The elements that match this selector will move to deck to the previous
29 | slide when clicked.
30 | */
31 | $.extend(true, $[deck].defaults, {
32 | classes: {
33 | navDisabled: 'deck-nav-disabled'
34 | },
35 |
36 | selectors: {
37 | nextLink: '.deck-next-link',
38 | previousLink: '.deck-prev-link'
39 | }
40 | });
41 |
42 | $d.bind('deck.init', function() {
43 | var opts = $[deck]('getOptions'),
44 | nextSlide = $[deck]('getSlide', 1),
45 | nextId = nextSlide ? nextSlide.attr('id') : undefined;
46 |
47 | // Setup prev/next link events
48 | $(opts.selectors.previousLink)
49 | .unbind('click.decknavigation')
50 | .bind('click.decknavigation', function(e) {
51 | $[deck]('prev');
52 | e.preventDefault();
53 | });
54 |
55 | $(opts.selectors.nextLink)
56 | .unbind('click.decknavigation')
57 | .bind('click.decknavigation', function(e) {
58 | $[deck]('next');
59 | e.preventDefault();
60 | });
61 |
62 | // Start on first slide, previous link is disabled, set next link href
63 | $(opts.selectors.previousLink).addClass(opts.classes.navDisabled);
64 | $(opts.selectors.nextLink).attr('href', '#' + (nextId ? nextId : ''));
65 | })
66 | /* Updates link hrefs, and disabled states if last/first slide */
67 | .bind('deck.change', function(e, from, to) {
68 | var opts = $[deck]('getOptions'),
69 | last = $[deck]('getSlides').length - 1,
70 | prevSlide = $[deck]('getSlide', to - 1),
71 | nextSlide = $[deck]('getSlide', to + 1),
72 | prevId = prevSlide ? prevSlide.attr('id') : undefined;
73 | nextId = nextSlide ? nextSlide.attr('id') : undefined;
74 |
75 | $(opts.selectors.previousLink)
76 | .toggleClass(opts.classes.navDisabled, !to)
77 | .attr('href', '#' + (prevId ? prevId : ''));
78 | $(opts.selectors.nextLink)
79 | .toggleClass(opts.classes.navDisabled, to === last)
80 | .attr('href', '#' + (nextId ? nextId : ''));
81 | });
82 | })(jQuery, 'deck');
83 |
84 |
--------------------------------------------------------------------------------
/git-talk/s6/projection.css:
--------------------------------------------------------------------------------
1 | /*********************************
2 | * CSS @media projection rules (not print or screen)
3 | *
4 | * 1) projection -> slideshow mode (display one slide at-a-time; hide all others)
5 | * 2) screen -> outline mode (display all slides-at-once on screen)
6 | * 3) print -> print (and print preview)
7 | *
8 | * toogle between slideshow/outline mode using t-key
9 | */
10 |
11 | html,
12 | body,
13 | .presentation { margin: 0; padding: 0; }
14 |
15 |
16 | .slide { display: none;
17 | position: absolute;
18 | top: 0; left: 0;
19 | margin: 0;
20 | padding: 2% 4% 0% 4%; /* css note: order is => top right bottom left */
21 | width: 92%; height: 95%; /* css note: to get to 100% add padding/border/margin */
22 | overflow-x: hidden; overflow-y: auto;
23 | z-index: 2;
24 | }
25 |
26 | #slide1 { display: block; }
27 |
28 | .notes { display: none; } /* handout notes/note (use note? handout? notes? */
29 |
30 |
31 | /********* format layout block
32 | *
33 | * .layout
34 | * > #header
35 | * > #footer
36 | * > #controls (holding navigation controls)
37 | * > #navLinks
38 | * > #toggle
39 | * > #navList
40 | * > #jumplist
41 | * > #currentSlide (e.g. 1/7)
42 | *
43 | */
44 |
45 | .layout { display: block; }
46 |
47 | #header { position: fixed;
48 | top: 0; left: 0;
49 | width: 100%; height: 0.5em;
50 | z-index: 1;
51 | }
52 |
53 | #footer { position: fixed;
54 | top: auto; bottom: 0;
55 | padding: 1em 0; /* css note: order is => 1st top,bottom; 2nd right,left */
56 | width: 100%; height: 1em;
57 | z-index: 5;
58 |
59 | /* todo: move font-size and font-style to blank.css */
60 | font-size: 100%; font-weight: bold;
61 | }
62 |
63 | /* todo: move font-size and font-style to blank.css */
64 |
65 | #footer h1 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; }
66 | #footer h2 { display: block; margin: 0; padding: 0 1em; font-size: 0.5em; font-style: italic; }
67 |
68 |
69 | /*************************
70 | * format for navigation controls
71 | */
72 |
73 |
74 | #controls { position: fixed;
75 | left: 60%; bottom: 0;
76 | width: 40%;
77 | z-index: 100;
78 | text-align: right;
79 | font: bold 1.2em Verdana, Helvetica, sans-serif;
80 | }
81 |
82 | #controls :focus { outline: 1px dotted white;}
83 |
84 | #controls #navLinks { text-align: right; margin: 0; visibility: hidden; }
85 |
86 | #controls #navLinks a { padding: 0; margin: 0 0.5em; cursor: pointer; border: none; }
87 |
88 | #controls #navLinks :link,
89 | #controls #navLinks :visited {text-decoration: none; }
90 |
91 | #controls #navList #jumplist { background: white; color: black; }
92 |
93 | /*************************
94 | * format for
95 | * currentSlide block ( e.g. 2/20 )
96 | */
97 |
98 | #currentSlide { position: fixed;
99 | left: 45%; bottom: 1em;
100 | width: 10%;
101 | z-index: 10;
102 | text-align: center;
103 | font-size: 0.8em;
104 | }
105 |
106 | #currentSlide :link,
107 | #currentSlide :visited { text-decoration: none; }
108 |
109 |
110 |
--------------------------------------------------------------------------------
/git-talk/themes/transition/horizontal-slide.css:
--------------------------------------------------------------------------------
1 | .csstransitions.csstransforms {
2 | overflow-x: hidden;
3 | }
4 | .csstransitions.csstransforms .deck-container > .slide {
5 | -webkit-transition: -webkit-transform 500ms ease-in-out;
6 | -moz-transition: -moz-transform 500ms ease-in-out;
7 | -ms-transition: -ms-transform 500ms ease-in-out;
8 | -o-transition: -o-transform 500ms ease-in-out;
9 | transition: transform 500ms ease-in-out;
10 | }
11 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide {
12 | position: absolute;
13 | top: 0;
14 | left: 0;
15 | -webkit-box-sizing: border-box;
16 | -moz-box-sizing: border-box;
17 | box-sizing: border-box;
18 | width: 100%;
19 | padding: 0 48px;
20 | }
21 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .slide {
22 | position: relative;
23 | left: 0;
24 | top: 0;
25 | -webkit-transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out;
26 | -moz-transition: -moz-transform 500ms ease-in-out, opacity 500ms ease-in-out;
27 | -ms-transition: -ms-transform 500ms ease-in-out, opacity 500ms ease-in-out;
28 | -o-transition: -o-transform 500ms ease-in-out, opacity 500ms ease-in-out;
29 | transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out;
30 | }
31 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-after {
32 | visibility: visible;
33 | -webkit-transform: translate3d(200%, 0, 0);
34 | -moz-transform: translate(200%, 0);
35 | -ms-transform: translate(200%, 0);
36 | -o-transform: translate(200%, 0);
37 | transform: translate3d(200%, 0, 0);
38 | }
39 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-previous {
40 | opacity: 0.4;
41 | }
42 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous {
43 | -webkit-transform: translate3d(-200%, 0, 0);
44 | -moz-transform: translate(-200%, 0);
45 | -ms-transform: translate(-200%, 0);
46 | -o-transform: translate(-200%, 0);
47 | transform: translate3d(-200%, 0, 0);
48 | }
49 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before {
50 | -webkit-transform: translate3d(-400%, 0, 0);
51 | -moz-transform: translate(-400%, 0);
52 | -ms-transform: translate(-400%, 0);
53 | -o-transform: translate(-400%, 0);
54 | transform: translate3d(-400%, 0, 0);
55 | }
56 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-next {
57 | -webkit-transform: translate3d(200%, 0, 0);
58 | -moz-transform: translate(200%, 0);
59 | -ms-transform: translate(200%, 0);
60 | -o-transform: translate(200%, 0);
61 | transform: translate3d(200%, 0, 0);
62 | }
63 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-after {
64 | -webkit-transform: translate3d(400%, 0, 0);
65 | -moz-transform: translate(400%, 0);
66 | -ms-transform: translate(400%, 0);
67 | -o-transform: translate(400%, 0);
68 | transform: translate3d(400%, 0, 0);
69 | }
70 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before .slide, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous .slide {
71 | visibility: visible;
72 | }
73 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current {
74 | -webkit-transform: none;
75 | -moz-transform: none;
76 | -ms-transform: none;
77 | -o-transform: none;
78 | transform: none;
79 | }
80 |
--------------------------------------------------------------------------------
/git-talk/extensions/goto/deck.goto.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Deck JS - deck.goto
3 | Copyright (c) 2011 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7 | */
8 |
9 | /*
10 | This module adds the necessary methods and key bindings to show and hide a form
11 | for jumping to any slide number in the deck (and processes that form
12 | accordingly). The form-showing state is indicated by the presence of a class on
13 | the deck container.
14 | */
15 | (function($, deck, undefined) {
16 | var $d = $(document);
17 |
18 | /*
19 | Extends defaults/options.
20 |
21 | options.classes.goto
22 | This class is added to the deck container when showing the Go To Slide
23 | form.
24 |
25 | options.selectors.gotoForm
26 | The element that matches this selector is the form that is submitted
27 | when a user hits enter after typing a slide number in the gotoInput
28 | element.
29 |
30 | options.selectors.gotoInput
31 | The element that matches this selector is the text input field for
32 | entering a slide number in the Go To Slide form.
33 |
34 | options.keys.goto
35 | The numeric keycode used to toggle between showing and hiding the Go To
36 | Slide form.
37 | */
38 | $.extend(true, $[deck].defaults, {
39 | classes: {
40 | goto: 'deck-goto'
41 | },
42 |
43 | selectors: {
44 | gotoForm: '.goto-form',
45 | gotoInput: '#goto-slide'
46 | },
47 |
48 | keys: {
49 | goto: 71 // g
50 | }
51 | });
52 |
53 | /*
54 | jQuery.deck('showGoTo')
55 |
56 | Shows the Go To Slide form by adding the class specified by the goto class
57 | option to the deck container.
58 | */
59 | $[deck]('extend', 'showGoTo', function() {
60 | $[deck]('getContainer').addClass($[deck]('getOptions').classes.goto);
61 | $($[deck]('getOptions').selectors.gotoInput).focus();
62 | });
63 |
64 | /*
65 | jQuery.deck('hideGoTo')
66 |
67 | Hides the Go To Slide form by removing the class specified by the goto class
68 | option from the deck container.
69 | */
70 | $[deck]('extend', 'hideGoTo', function() {
71 | $[deck]('getContainer').removeClass($[deck]('getOptions').classes.goto);
72 | $($[deck]('getOptions').selectors.gotoInput).blur();
73 | });
74 |
75 | /*
76 | jQuery.deck('toggleGoTo')
77 |
78 | Toggles between showing and hiding the Go To Slide form.
79 | */
80 | $[deck]('extend', 'toggleGoTo', function() {
81 | $[deck]($[deck]('getContainer').hasClass($[deck]('getOptions').classes.goto) ? 'hideGoTo' : 'showGoTo');
82 | });
83 |
84 | $d.bind('deck.init', function() {
85 | // Bind key events
86 | $d.unbind('keydown.deckgoto').bind('keydown.deckgoto', function(e) {
87 | var key = $[deck]('getOptions').keys.goto;
88 |
89 | if (e.which === key ||$.inArray(e.which, key) > -1) {
90 | e.preventDefault();
91 | $[deck]('toggleGoTo');
92 | }
93 | });
94 |
95 | // Process form submittal, go to the slide entered
96 | $($[deck]('getOptions').selectors.gotoForm)
97 | .unbind('submit.deckgoto')
98 | .bind('submit.deckgoto', function(e) {
99 | var $field = ($($[deck]('getOptions').selectors.gotoInput)),
100 | i = parseInt($field.val(), 10);
101 |
102 | if (!($.isNaN(i) || i < 1 || i > $[deck]('getSlides').length)) {
103 | $[deck]('go', i - 1);
104 | $[deck]('hideGoTo');
105 | $field.val('');
106 | }
107 |
108 | e.preventDefault();
109 | });
110 |
111 | $($[deck]('getOptions').selectors.gotoInput)
112 | .unbind('keydown.deckgoto')
113 | .bind('keydown.deckgoto', function(e) {
114 | e.stopPropagation();
115 | });
116 | });
117 | })(jQuery, 'deck');
118 |
119 |
--------------------------------------------------------------------------------
/git-talk/themes/style/neon.css:
--------------------------------------------------------------------------------
1 | .deck-container {
2 | font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
3 | font-size: 1.25em;
4 | color: #aaa;
5 | background: #000;
6 | }
7 | .deck-container .slide {
8 | background: #000;
9 | }
10 | .deck-container h1 {
11 | color: #0af;
12 | font-weight: normal;
13 | font-weight: 100;
14 | text-shadow: 0 0 50px #0af, 0 0 3px #fff;
15 | }
16 | .deck-container h2 {
17 | color: #af0;
18 | border-bottom-color: #ccc;
19 | font-weight: normal;
20 | font-weight: 100;
21 | text-shadow: 0 0 15px #af0, 0 0 2px #fff;
22 | border-bottom: 1px solid #333;
23 | }
24 | .deck-container h3 {
25 | color: #fff;
26 | font-weight: normal;
27 | font-weight: 100;
28 | text-shadow: 0 0 10px #fff, 0 0 2px #fff;
29 | }
30 | .deck-container pre {
31 | border-color: #333;
32 | }
33 | .deck-container pre code {
34 | color: #fff;
35 | }
36 | .deck-container code {
37 | color: #f0a;
38 | }
39 | .deck-container blockquote {
40 | font-size: 2em;
41 | padding: 1em 2em;
42 | color: #fff;
43 | border-left: 5px solid #fff;
44 | }
45 | .deck-container blockquote p {
46 | margin: 0;
47 | }
48 | .deck-container blockquote cite {
49 | font-size: .5em;
50 | font-style: normal;
51 | font-weight: normal;
52 | font-weight: 100;
53 | color: #aaa;
54 | text-shadow: 0 0 15px #fff, 0 0 2px #fff;
55 | }
56 | .deck-container ::-moz-selection {
57 | background: #a0f;
58 | }
59 | .deck-container ::selection {
60 | background: #a0f;
61 | }
62 | .deck-container a, .deck-container a:hover, .deck-container a:focus, .deck-container a:active, .deck-container a:visited {
63 | color: #f0a;
64 | text-decoration: none;
65 | }
66 | .deck-container a:hover, .deck-container a:focus {
67 | text-decoration: underline;
68 | }
69 | .deck-container .deck-prev-link, .deck-container .deck-next-link {
70 | background: #f0a;
71 | text-shadow: 0 0 3px #fff;
72 | }
73 | .deck-container .deck-prev-link, .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited {
74 | color: #fff;
75 | }
76 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus {
77 | text-decoration: none;
78 | }
79 | .boxshadow .deck-container .deck-prev-link:hover, .boxshadow .deck-container .deck-prev-link:focus, .boxshadow .deck-container .deck-next-link:hover, .boxshadow .deck-container .deck-next-link:focus {
80 | -webkit-box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
81 | -moz-box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
82 | box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
83 | }
84 | .deck-container .deck-status {
85 | font-size: 0.6666em;
86 | }
87 | .deck-container .goto-form {
88 | background: #000;
89 | border: 1px solid #f0a;
90 | }
91 | .deck-container .goto-form label {
92 | color: #fff;
93 | }
94 | .deck-container.deck-menu .slide {
95 | background: #333;
96 | }
97 | .deck-container.deck-menu .deck-current {
98 | background: #444;
99 | }
100 | .boxshadow .deck-container.deck-menu .deck-current {
101 | background: #000;
102 | -webkit-box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
103 | -moz-box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
104 | box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
105 | }
106 | .no-touch .deck-container.deck-menu .slide:hover {
107 | background: #444;
108 | }
109 | .no-touch.boxshadow .deck-container.deck-menu .slide:hover {
110 | background: #000;
111 | -webkit-box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
112 | -moz-box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
113 | box-shadow: 0 0 20px #f0a, 0 0 5px #fff;
114 | }
115 |
--------------------------------------------------------------------------------
/git-talk/themes/transition/vertical-slide.css:
--------------------------------------------------------------------------------
1 | .csstransitions.csstransforms .deck-container {
2 | overflow-y: hidden;
3 | }
4 | .csstransitions.csstransforms .deck-container > .slide {
5 | -webkit-transition: -webkit-transform 500ms ease-in-out;
6 | -moz-transition: -moz-transform 500ms ease-in-out;
7 | -ms-transition: -ms-transform 500ms ease-in-out;
8 | -o-transition: -o-transform 500ms ease-in-out;
9 | transition: transform 500ms ease-in-out;
10 | }
11 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide {
12 | position: absolute;
13 | top: 0;
14 | left: 0;
15 | -webkit-box-sizing: border-box;
16 | -moz-box-sizing: border-box;
17 | box-sizing: border-box;
18 | width: 100%;
19 | padding: 0 48px;
20 | }
21 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .slide {
22 | position: relative;
23 | left: 0;
24 | top: 0;
25 | -webkit-transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out;
26 | -moz-transition: -moz-transform 500ms ease-in-out, opacity 500ms ease-in-out;
27 | -ms-transition: -ms-transform 500ms ease-in-out, opacity 500ms ease-in-out;
28 | -o-transition: -o-transform 500ms ease-in-out, opacity 500ms ease-in-out;
29 | transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out;
30 | }
31 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-after {
32 | visibility: visible;
33 | -webkit-transform: translate3d(0, 1600px, 0);
34 | -moz-transform: translate(0, 1600px);
35 | -ms-transform: translate(0, 1600px);
36 | -o-transform: translate(0, 1600px);
37 | transform: translate3d(0, 1600px, 0);
38 | }
39 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-previous {
40 | opacity: 0.4;
41 | }
42 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous {
43 | -webkit-transform: translate3d(0, -200%, 0);
44 | -moz-transform: translate(0, -200%);
45 | -ms-transform: translate(0, -200%);
46 | -o-transform: translate(0, -200%);
47 | transform: translate3d(0, -200%, 0);
48 | }
49 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before {
50 | -webkit-transform: translate3d(0, -400%, 0);
51 | -moz-transform: translate(0, -400%);
52 | -ms-transform: translate(0, -400%);
53 | -o-transform: translate(0, -400%);
54 | transform: translate3d(0, -400%, 0);
55 | }
56 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-next {
57 | -webkit-transform: translate3d(0, 200%, 0);
58 | -moz-transform: translate(0, 200%);
59 | -ms-transform: translate(0, 200%);
60 | -o-transform: translate(0, 200%);
61 | transform: translate3d(0, 200%, 0);
62 | }
63 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-after {
64 | -webkit-transform: translate3d(0, 400%, 0);
65 | -moz-transform: translate(0, 400%);
66 | -ms-transform: translate(0, 400%);
67 | -o-transform: translate(0, 400%);
68 | transform: translate3d(0, 400%, 0);
69 | }
70 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before .slide, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous .slide {
71 | visibility: visible;
72 | }
73 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current {
74 | -webkit-transform: none;
75 | -moz-transform: none;
76 | -ms-transform: none;
77 | -o-transform: none;
78 | transform: none;
79 | }
80 | .csstransitions.csstransforms .deck-prev-link {
81 | left: auto;
82 | right: 8px;
83 | top: 59px;
84 | -webkit-transform: rotate(90deg);
85 | -moz-transform: rotate(90deg);
86 | -ms-transform: rotate(90deg);
87 | -o-transform: rotate(90deg);
88 | transform: rotate(90deg);
89 | }
90 | .csstransitions.csstransforms .deck-next-link {
91 | top: 99px;
92 | -webkit-transform: rotate(90deg);
93 | -moz-transform: rotate(90deg);
94 | -ms-transform: rotate(90deg);
95 | -o-transform: rotate(90deg);
96 | transform: rotate(90deg);
97 | }
98 |
--------------------------------------------------------------------------------
/git-talk/extensions/hash/deck.hash.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Deck JS - deck.hash
3 | Copyright (c) 2011 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7 | */
8 |
9 | /*
10 | This module adds deep linking to individual slides, enables internal links
11 | to slides within decks, and updates the address bar with the hash as the user
12 | moves through the deck. A permalink anchor is also updated. Standard themes
13 | hide this link in browsers that support the History API, and show it for
14 | those that do not. Slides that do not have an id are assigned one according to
15 | the hashPrefix option. In addition to the on-slide container state class
16 | kept by core, this module adds an on-slide state class that uses the id of each
17 | slide.
18 | */
19 | (function ($, deck, window, undefined) {
20 | var $d = $(document),
21 | $window = $(window),
22 |
23 | /* Collection of internal fragment links in the deck */
24 | $internals,
25 |
26 | /*
27 | Internal only function. Given a string, extracts the id from the hash,
28 | matches it to the appropriate slide, and navigates there.
29 | */
30 | goByHash = function(str) {
31 | var id = str.substr(str.indexOf("#") + 1),
32 | slides = $[deck]('getSlides');
33 |
34 | $.each(slides, function(i, $el) {
35 | if ($el.attr('id') === id) {
36 | $[deck]('go', i);
37 | return false;
38 | }
39 | });
40 |
41 | // If we don't set these to 0 the container scrolls due to hashchange
42 | $[deck]('getContainer').scrollLeft(0).scrollTop(0);
43 | };
44 |
45 | /*
46 | Extends defaults/options.
47 |
48 | options.selectors.hashLink
49 | The element matching this selector has its href attribute updated to
50 | the hash of the current slide as the user navigates through the deck.
51 |
52 | options.hashPrefix
53 | Every slide that does not have an id is assigned one at initialization.
54 | Assigned ids take the form of hashPrefix + slideIndex, e.g., slide-0,
55 | slide-12, etc.
56 | */
57 | $.extend(true, $[deck].defaults, {
58 | selectors: {
59 | hashLink: '.deck-permalink'
60 | },
61 |
62 | hashPrefix: 'slide-'
63 | });
64 |
65 |
66 | $d.bind('deck.init', function() {
67 | var opts = $[deck]('getOptions');
68 | $internals = $();
69 |
70 | $.each($[deck]('getSlides'), function(i, $el) {
71 | var hash;
72 |
73 | /* Hand out ids to the unfortunate slides born without them */
74 | if (!$el.attr('id') || $el.data('deckAssignedId') === $el.attr('id')) {
75 | $el.attr('id', opts.hashPrefix + i);
76 | $el.data('deckAssignedId', opts.hashPrefix + i);
77 | }
78 |
79 | hash ='#' + $el.attr('id');
80 |
81 | /* Deep link to slides on init */
82 | if (hash === window.location.hash) {
83 | $[deck]('go', i);
84 | }
85 |
86 | /* Add internal links to this slide */
87 | $internals = $internals.add('a[href="' + hash + '"]');
88 | });
89 |
90 | if (!Modernizr.hashchange) {
91 | /* Set up internal links using click for the poor browsers
92 | without a hashchange event. */
93 | $internals.unbind('click.deckhash').bind('click.deckhash', function(e) {
94 | goByHash($(this).attr('href'));
95 | });
96 | }
97 |
98 | /* Set up first id container state class */
99 | $[deck]('getContainer').addClass(opts.classes.onPrefix + $[deck]('getSlide').attr('id'));
100 | })
101 | /* Update permalink, address bar, and state class on a slide change */
102 | .bind('deck.change', function(e, from, to) {
103 | var hash = '#' + $[deck]('getSlide', to).attr('id'),
104 | opts = $[deck]('getOptions'),
105 | osp = opts.classes.onPrefix,
106 | $c = $[deck]('getContainer');
107 |
108 | $c.removeClass(osp + $[deck]('getSlide', from).attr('id'));
109 | $c.addClass(osp + $[deck]('getSlide', to).attr('id'));
110 |
111 | $(opts.selectors.hashLink).attr('href', hash);
112 | if (Modernizr.history) {
113 | window.history.replaceState({}, "", hash);
114 | }
115 | });
116 |
117 | /* Deals with internal links in modern browsers */
118 | $window.bind('hashchange.deckhash', function(e) {
119 | if (e.originalEvent && e.originalEvent.newURL) {
120 | goByHash(e.originalEvent.newURL);
121 | }
122 | else {
123 | goByHash(window.location.hash);
124 | }
125 | });
126 | })(jQuery, 'deck', this);
--------------------------------------------------------------------------------
/git-talk/extensions/scale/deck.scale.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Deck JS - deck.scale
3 | Copyright (c) 2011 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7 | */
8 |
9 | /*
10 | This module adds automatic scaling to the deck. It should only be used on
11 | standalone decks where the body is the deck container. Slides are scaled down
12 | using CSS transforms to fit within the browser window. If the browser window
13 | is big enough to hold the slides without scaling, no scaling occurs. The user
14 | can disable and enable scaling with a keyboard shortcut.
15 |
16 | Note: CSS transforms make Flash videos render incorrectly. Presenters that
17 | need to use video will want to disable scaling to play them. HTML5 video
18 | works fine.
19 | */
20 | (function($, deck, window, undefined) {
21 | var $d = $(document),
22 | $w = $(window),
23 | baseHeight, // Value to scale against
24 | timer, // Timeout id for debouncing
25 |
26 | /*
27 | Internal function to do all the dirty work of scaling the deck container.
28 | */
29 | scaleDeck = function() {
30 | var obh = $[deck]('getOptions').baseHeight,
31 | $container = $[deck]('getContainer'),
32 | height = $w.height(),
33 | slides = $[deck]('getSlides'),
34 | scale,
35 | transform;
36 |
37 | // Don't scale if scaling disabled
38 | if (!$container.hasClass($[deck]('getOptions').classes.scale)) {
39 | scale = 1;
40 | }
41 | else {
42 | // Use tallest slide as base height if not set manually
43 | baseHeight = obh ? obh : (function() {
44 | var greatest = 0;
45 |
46 | $.each(slides, function(i, $slide) {
47 | greatest = Math.max(greatest, $slide.outerHeight());
48 | });
49 |
50 | return greatest;
51 | })();
52 |
53 | scale = height / baseHeight;
54 | }
55 |
56 | // Scale, but don't scale up
57 | transform = scale >= 1 ? 'none' : 'scale(' + scale + ')';
58 | $.each('Webkit Moz O ms Khtml'.split(' '), function(i, prefix) {
59 | $container.css(prefix + 'Transform', transform);
60 | });
61 | };
62 |
63 | /*
64 | Extends defaults/options.
65 |
66 | options.classes.scale
67 | This class is added to the deck container when scaling is enabled.
68 | It is enabled by default when the module is included.
69 |
70 | options.keys.scale
71 | The numeric keycode used to toggle enabling and disabling scaling.
72 |
73 | options.baseHeight
74 | When baseheight is falsy, as it is by default, the deck is scaled
75 | in proportion to the height of the slides. You may instead specify
76 | a height, and the deck will be scaled against this height regardless
77 | of the actual content height.
78 |
79 | options.scaleDebounce
80 | Scaling on the browser resize event is debounced. This number is the
81 | threshold in milliseconds. You can learn more about debouncing here:
82 | http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
83 |
84 | */
85 | $.extend(true, $[deck].defaults, {
86 | classes: {
87 | scale: 'deck-scale'
88 | },
89 |
90 | keys: {
91 | scale: 83 // s
92 | },
93 |
94 | baseHeight: null,
95 | scaleDebounce: 200
96 | });
97 |
98 | /*
99 | jQuery.deck('disableScale')
100 |
101 | Disables scaling and removes the scale class from the deck container.
102 | */
103 | $[deck]('extend', 'disableScale', function() {
104 | $[deck]('getContainer').removeClass($[deck]('getOptions').classes.scale);
105 | scaleDeck();
106 | });
107 |
108 | /*
109 | jQuery.deck('enableScale')
110 |
111 | Enables scaling and adds the scale class to the deck container.
112 | */
113 | $[deck]('extend', 'enableScale', function() {
114 | $[deck]('getContainer').addClass($[deck]('getOptions').classes.scale);
115 | scaleDeck();
116 | });
117 |
118 | /*
119 | jQuery.deck('toggleScale')
120 |
121 | Toggles between enabling and disabling scaling.
122 | */
123 | $[deck]('extend', 'toggleScale', function() {
124 | var $c = $[deck]('getContainer');
125 | $[deck]($c.hasClass($[deck]('getOptions').classes.scale) ?
126 | 'disableScale' : 'enableScale');
127 | });
128 |
129 | $d.bind('deck.init', function() {
130 | var opts = $[deck]('getOptions');
131 |
132 | // Scaling enabled at start
133 | $[deck]('getContainer').addClass(opts.classes.scale);
134 |
135 | // Debounce the resize scaling
136 | $w.unbind('resize.deckscale').bind('resize.deckscale', function() {
137 | window.clearTimeout(timer);
138 | timer = window.setTimeout(scaleDeck, opts.scaleDebounce);
139 | })
140 | // Scale once on load, in case images or something change layout
141 | .unbind('load.deckscale').bind('load.deckscale', scaleDeck);
142 |
143 | // Bind key events
144 | $d.unbind('keydown.deckscale').bind('keydown.deckscale', function(e) {
145 | if (e.which === opts.keys.scale || $.inArray(e.which, opts.keys.scale) > -1) {
146 | $[deck]('toggleScale');
147 | e.preventDefault();
148 | }
149 | });
150 |
151 | // Scale once on init
152 | scaleDeck();
153 | });
154 | })(jQuery, 'deck', this);
155 |
156 |
--------------------------------------------------------------------------------
/git-talk/extensions/menu/deck.menu.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Deck JS - deck.menu
3 | Copyright (c) 2011 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7 | */
8 |
9 | /*
10 | This module adds the methods and key binding to show and hide a menu of all
11 | slides in the deck. The deck menu state is indicated by the presence of a class
12 | on the deck container.
13 | */
14 | (function($, deck, undefined) {
15 | var $d = $(document),
16 | rootSlides, // Array of top level slides
17 | $placeholder; // Holds the place of the deck container during detachment
18 |
19 | /*
20 | Extends defaults/options.
21 |
22 | options.classes.menu
23 | This class is added to the deck container when showing the slide menu.
24 |
25 | options.keys.menu
26 | The numeric keycode used to toggle between showing and hiding the slide
27 | menu.
28 |
29 | options.touch.doubletapWindow
30 | Two consecutive touch events within this number of milliseconds will
31 | be considered a double tap, and will toggle the menu on touch devices.
32 | */
33 | $.extend(true, $[deck].defaults, {
34 | classes: {
35 | menu: 'deck-menu'
36 | },
37 |
38 | keys: {
39 | menu: 77 // m
40 | },
41 |
42 | touch: {
43 | doubletapWindow: 400
44 | }
45 | });
46 |
47 | /*
48 | jQuery.deck('showMenu')
49 |
50 | Shows the slide menu by adding the class specified by the menu class option
51 | to the deck container.
52 | */
53 | $[deck]('extend', 'showMenu', function() {
54 | var $c = $[deck]('getContainer');
55 |
56 | // Detaching for this big style change for performance (no transitions!)
57 | $c.replaceWith($placeholder);
58 | $c.addClass($[deck]('getOptions').classes.menu);
59 |
60 | /* Forced to do this in JS until CSS learns second-grade math. Save old
61 | style value for restoration when menu is hidden. */
62 | if (Modernizr.csstransforms) {
63 | $.each(rootSlides, function(i, $slide) {
64 | $slide.data('oldStyle', $slide.attr('style'));
65 | $slide.css({
66 | 'position': 'absolute',
67 | 'left': ((i % 4) * 25) + '%',
68 | 'top': (Math.floor(i / 4) * 25) + '%'
69 | });
70 | });
71 | }
72 |
73 | $placeholder.replaceWith($c);
74 | $c.scrollTop($[deck]('getSlide').offset().top);
75 | });
76 |
77 | /*
78 | jQuery.deck('hideMenu')
79 |
80 | Hides the slide menu by removing the class specified by the menu class
81 | option from the deck container.
82 | */
83 | $[deck]('extend', 'hideMenu', function() {
84 | var $c = $[deck]('getContainer');
85 |
86 | $c.replaceWith($placeholder);
87 | $c.removeClass($[deck]('getOptions').classes.menu);
88 |
89 | /* Restore old style value */
90 | if (Modernizr.csstransforms) {
91 | $.each(rootSlides, function(i, $slide) {
92 | var oldStyle = $slide.data('oldStyle');
93 |
94 | $slide.attr('style', oldStyle ? oldStyle : '');
95 | });
96 | }
97 |
98 | $placeholder.replaceWith($c);
99 | $c.scrollTop(0);
100 | });
101 |
102 | /*
103 | jQuery.deck('toggleMenu')
104 |
105 | Toggles between showing and hiding the slide menu.
106 | */
107 | $[deck]('extend', 'toggleMenu', function() {
108 | $[deck]('getContainer').hasClass($[deck]('getOptions').classes.menu) ?
109 | $[deck]('hideMenu') : $[deck]('showMenu');
110 | });
111 |
112 | $d.bind('deck.init', function() {
113 | var opts = $[deck]('getOptions'),
114 | touchEndTime = 0,
115 | currentSlide,
116 | slideTest = $.map([
117 | opts.classes.before,
118 | opts.classes.previous,
119 | opts.classes.current,
120 | opts.classes.next,
121 | opts.classes.after
122 | ], function(el, i) {
123 | return '.' + el;
124 | }).join(', ');
125 |
126 | // Create placeholder element
127 | $placeholder = $('<' + $[deck]('getContainer').get(0).tagName + '>');
128 |
129 | // Build top level slides array
130 | rootSlides = [];
131 | $.each($[deck]('getSlides'), function(i, $el) {
132 | if (!$el.parentsUntil(opts.selectors.container, slideTest).length) {
133 | rootSlides.push($el);
134 | }
135 | });
136 |
137 | // Bind key events
138 | $d.unbind('keydown.deckmenu').bind('keydown.deckmenu', function(e) {
139 | if (e.which === opts.keys.menu || $.inArray(e.which, opts.keys.menu) > -1) {
140 | $[deck]('toggleMenu');
141 | e.preventDefault();
142 | }
143 | });
144 |
145 | // Double tap to toggle slide menu for touch devices
146 | $[deck]('getContainer').unbind('touchstart.deckmenu').bind('touchstart.deckmenu', function(e) {
147 | currentSlide = $[deck]('getSlide');
148 | })
149 | .unbind('touchend.deckmenu').bind('touchend.deckmenu', function(e) {
150 | var now = Date.now();
151 |
152 | // Ignore this touch event if it caused a nav change (swipe)
153 | if (currentSlide !== $[deck]('getSlide')) return;
154 |
155 | if (now - touchEndTime < opts.touch.doubletapWindow) {
156 | $[deck]('toggleMenu');
157 | e.preventDefault();
158 | }
159 | touchEndTime = now;
160 | });
161 |
162 | // Selecting slides from the menu
163 | $.each($[deck]('getSlides'), function(i, $s) {
164 | $s.unbind('click.deckmenu').bind('click.deckmenu', function(e) {
165 | if (!$[deck]('getContainer').hasClass(opts.classes.menu)) return;
166 |
167 | $[deck]('go', i);
168 | $[deck]('hideMenu');
169 | e.stopPropagation();
170 | e.preventDefault();
171 | });
172 | });
173 | })
174 | .bind('deck.change', function(e, from, to) {
175 | var container = $[deck]('getContainer');
176 |
177 | if (container.hasClass($[deck]('getOptions').classes.menu)) {
178 | container.scrollTop($[deck]('getSlide', to).offset().top);
179 | }
180 | });
181 | })(jQuery, 'deck');
182 |
183 |
--------------------------------------------------------------------------------
/git-talk/git.md:
--------------------------------------------------------------------------------
1 | # Git入门 #
2 |
3 | 
4 |
5 | 源代码管理的最佳选择
6 |
7 | # 闲扯 #
8 |
9 | 
10 |
11 | 
12 | 
13 |
14 | # Git命令 #
15 |
16 | 30多个命令
17 |
18 | 
19 |
20 | # 入门 #
21 |
22 | * git branch
23 | * git status
24 | * git add
25 | * git commit -m "message"
26 | * git push origin master
27 | * git remote add origin
28 | * git clone
29 | * git init
30 |
31 | # 基础 #
32 |
33 | * git pull origin master
34 | * git merge develop
35 | * git checkout
36 | * git reset HEAD^
37 | * git log --graph --oneline
38 | * git tag
39 | * git stash
40 | * git fetch origin master
41 |
42 | # 高级 #
43 |
44 | 啥?
45 |
46 | # 入门 #
47 |
48 | 
49 |
50 | * git branch -a
51 | * git status
52 | * git add
53 | * git commit -m "message"
54 | * git push origin master
55 |
56 | # 分支 #
57 |
58 | git branch -a
59 |
60 | 
61 |
62 | # 文件状态 #
63 |
64 | git status
65 |
66 | * untracked 未追踪
67 | * unmodified 未修改
68 | * modified 已修改
69 | * staged
70 |
71 | 
72 |
73 | # 入门实践 #
74 |
75 | 
76 |
77 | # 入门实践 #
78 |
79 | * 添加
80 |
81 | ```
82 | git add
83 | git add *
84 | ```
85 |
86 | * 提交
87 |
88 | ```
89 | git commit -m "代码提交信息"
90 | ```
91 |
92 | * 推送改动
93 |
94 | 除非你将分支推送到远端仓库,不然该分支就是 不为他人所见的:
95 |
96 | ```
97 | git push origin
98 | ```
99 |
100 | 如果还没有克隆现有仓库,并欲将你的仓库连接到某个远程服务器,使用如下命令添加:
101 |
102 | ```
103 | git remote add origin
104 | ```
105 |
106 | # 新建本地仓库 #
107 |
108 | * 复制远端仓库到本地
109 |
110 | ```
111 | git clone
112 | ```
113 |
114 | * 为已有代码新建仓库
115 |
116 | ```
117 | git init
118 | ```
119 |
120 | # 分支 #
121 |
122 | 删掉新建的分支:
123 |
124 | ```
125 | git branch -d
126 | git push origin :
127 | ```
128 |
129 | # 基础 ##
130 |
131 | * git pull origin master
132 | * git merge develop
133 | * git checkout
134 | * git reset HEAD^
135 | * git log --graph --oneline
136 |
137 | # HEAD #
138 |
139 | * HEAD [ HEAD-3, HEAD^3 ]
140 |
141 | 
142 |
143 | # 基础实践 #
144 |
145 | 
146 |
147 | # 更新与合并 #
148 |
149 | ```
150 | git pull
151 | ```
152 |
153 | 以在你的工作目录中 获取(fetch) 并 合并(merge) 远端的改动。 要合并其他分支到你的当前分支(例如 master),执行:
154 |
155 | ```
156 | git fetch origin master
157 | git merge
158 | ```
159 |
160 | git 会尝试去自动合并改动。不幸的是,自动合并并非次次都能成功,并可能导致 冲突(conflicts)。 这时候就需要你修改这些文件来人肉合并这些 冲突(conflicts)
161 |
162 | ```
163 | git diff
164 | ```
165 |
166 | # 替换本地改动 #
167 |
168 | * 假如你做错事(自然,这是不可能的),你可以使用如下命令替换掉本地改动:
169 |
170 | ```
171 | git checkout --
172 | ```
173 |
174 | 此命令会使用 HEAD 中的最新内容替换掉你的工作目录中的文件。已添加到缓存区的改动,以及新文件,都不受影响。
175 |
176 | * 创建一个叫做“feature_x”的分支,并切换过去:
177 |
178 | ```
179 | git checkout -b feature_x
180 | ```
181 |
182 | * 切换回主分支:
183 |
184 | ```
185 | git checkout master
186 | ```
187 |
188 | # 丢弃本地改动与提交 #
189 |
190 | 假如你想要丢弃你所有的本地改动与提交,可以到服务器上获取最新的版本并将你本地主分支指向到它:
191 |
192 | ```
193 | git reset [--soft] origin/master
194 | git reset --hard origin/master
195 | ```
196 |
197 | 
198 |
199 | # 查看提交日志 #
200 |
201 | ```
202 | git log --graph --oneline
203 | ```
204 |
205 | 
206 |
207 | # 储藏(Stashing) #
208 |
209 | 放入stash
210 |
211 | ```
212 | git stash
213 | ```
214 |
215 | * git stash show
216 | * git stash pop
217 | * git stash list
218 |
219 | # 标签 #
220 |
221 | 在软件发布时创建标签,是被推荐的。这是个旧有概念,在 SVN 中也有。可以执行如下命令以创建一个叫做 1.0.0 的标签:
222 |
223 | ```
224 | git tag 1.0.0
225 | ```
226 |
227 | # 高级 #
228 |
229 | 超大型项目
230 |
231 | 
232 |
233 | # 实践 git-flow #
234 |
235 | 
236 |
237 | **5**个主分支
238 |
239 | * master
240 | * develop
241 | * release
242 | * hotfix
243 | * feature
244 |
245 |
246 | # 实践 juche_server #
247 |
248 | 
249 |
250 | **3**个主分支
251 |
252 | * master 线上服务器
253 | * staging 测试服务器
254 | * develop ci服务器
255 |
256 | # 内部结构 #
257 |
258 | 
259 |
260 | # 相关文件 #
261 |
262 | * .gitignore
263 | * .git/config
264 | * HEAD
265 | * index
266 | * objects/
267 | * refs/
268 |
269 | # Git对象 #
270 |
271 | * commit
272 | * tree
273 | * blob
274 |
275 | 
276 |
277 | # Git Reference #
278 |
279 | [Git 内部原理](http://git.oschina.net/progit/9-Git-%E5%86%85%E9%83%A8%E5%8E%9F%E7%90%86.html#9.3-Git-References)
280 |
281 | * **HEAD**
282 | * **tags**
283 | * **remotes**
284 | * packfiles
285 | * refspec
286 |
287 | 
288 |
289 | # 回顾-文件状态 #
290 |
291 | 
292 |
293 | # 回顾-入门 #
294 |
295 | 
296 |
297 | # 回顾-基础 #
298 |
299 | 
300 |
301 | # 回顾 #
302 |
303 | 
304 |
305 | # 提问 #
306 |
307 | 
308 |
309 | # 参考资料 #
310 |
311 | * 书籍pro-git
312 | * git-it练习
313 | * 速查表
314 |
315 | # 书籍pro-git #
316 |
317 | * [中文](http://git.oschina.net/progit/)
318 | * [英文](http://git-scm.com/book/en/v2)
319 |
320 | 
321 |
322 | # git-it练习 #
323 |
324 | * [git-it练习](https://github.com/jlord/git-it)
325 |
326 | 
327 |
328 | * [nodeschool](http://nodeschool.io/)
329 |
330 | # 速查表 #
331 |
332 | * 
333 |
334 | # 中文速查表 #
335 |
336 | * 
337 |
338 | # 作业 #
339 |
340 | * pro git
341 | * git-it
342 | * git rebase
343 | * git revert
344 | * git show
345 | * git shortlog
346 | * git blame
347 | * git am
348 |
349 | # 谢谢 #
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
--------------------------------------------------------------------------------
/git-talk/themes/style/web-2.0.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 | .deck-container {
3 | font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
4 | font-size: 1.25em;
5 | background: #f4fafe;
6 | /* Old browsers */
7 | background: -moz-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%);
8 | /* FF3.6+ */
9 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4fafe), color-stop(100%, #ccf0f0));
10 | /* Chrome,Safari4+ */
11 | background: -webkit-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%);
12 | /* Chrome10+,Safari5.1+ */
13 | background: -o-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%);
14 | /* Opera11.10+ */
15 | background: -ms-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%);
16 | /* IE10+ */
17 | background: linear-gradient(top, #f4fafe 0%, #ccf0f0 100%);
18 | /* W3C */
19 | background-attachment: fixed;
20 | }
21 | .deck-container > .slide {
22 | text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.5);
23 | }
24 | .deck-container h1, .deck-container h2, .deck-container h3, .deck-container h4, .deck-container h5, .deck-container h6 {
25 | font-family: "Hoefler Text", Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
26 | }
27 | .deck-container h1 {
28 | color: #08455f;
29 | }
30 | .deck-container h2 {
31 | color: #0b7495;
32 | border-bottom: 0;
33 | }
34 | .cssreflections .deck-container h2 {
35 | line-height: 1;
36 | -webkit-box-reflect: below -0.556em -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.3, transparent), color-stop(0.7, rgba(255, 255, 255, 0.1)), to(transparent));
37 | -moz-box-reflect: below -0.556em -moz-linear-gradient(top, transparent 0%, transparent 30%, rgba(255, 255, 255, 0.3) 100%);
38 | }
39 | .deck-container h3 {
40 | color: #000;
41 | }
42 | .deck-container pre {
43 | border-color: #cde;
44 | background: #fff;
45 | position: relative;
46 | z-index: auto;
47 | /* http://nicolasgallagher.com/css-drop-shadows-without-images/ */
48 | }
49 | .borderradius .deck-container pre {
50 | -webkit-border-radius: 5px;
51 | -moz-border-radius: 5px;
52 | border-radius: 5px;
53 | }
54 | .csstransforms.boxshadow .deck-container pre > :first-child:before {
55 | content: "";
56 | position: absolute;
57 | z-index: -1;
58 | background: #fff;
59 | top: 0;
60 | bottom: 0;
61 | left: 0;
62 | right: 0;
63 | }
64 | .csstransforms.boxshadow .deck-container pre:before, .csstransforms.boxshadow .deck-container pre:after {
65 | content: "";
66 | position: absolute;
67 | z-index: -2;
68 | bottom: 15px;
69 | width: 50%;
70 | height: 20%;
71 | max-width: 300px;
72 | -webkit-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
73 | -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
74 | box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
75 | }
76 | .csstransforms.boxshadow .deck-container pre:before {
77 | left: 10px;
78 | -webkit-transform: rotate(-3deg);
79 | -moz-transform: rotate(-3deg);
80 | -ms-transform: rotate(-3deg);
81 | -o-transform: rotate(-3deg);
82 | transform: rotate(-3deg);
83 | }
84 | .csstransforms.boxshadow .deck-container pre:after {
85 | right: 10px;
86 | -webkit-transform: rotate(3deg);
87 | -moz-transform: rotate(3deg);
88 | -ms-transform: rotate(3deg);
89 | -o-transform: rotate(3deg);
90 | transform: rotate(3deg);
91 | }
92 | .deck-container code {
93 | color: #789;
94 | }
95 | .deck-container blockquote {
96 | font-family: "Hoefler Text", Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
97 | font-size: 2em;
98 | padding: 1em 2em .5em 2em;
99 | color: #000;
100 | background: #fff;
101 | position: relative;
102 | border: 1px solid #cde;
103 | z-index: auto;
104 | }
105 | .borderradius .deck-container blockquote {
106 | -webkit-border-radius: 5px;
107 | -moz-border-radius: 5px;
108 | border-radius: 5px;
109 | }
110 | .boxshadow .deck-container blockquote > :first-child:before {
111 | content: "";
112 | position: absolute;
113 | z-index: -1;
114 | background: #fff;
115 | top: 0;
116 | bottom: 0;
117 | left: 0;
118 | right: 0;
119 | }
120 | .boxshadow .deck-container blockquote:after {
121 | content: "";
122 | position: absolute;
123 | z-index: -2;
124 | top: 10px;
125 | bottom: 10px;
126 | left: 0;
127 | right: 50%;
128 | -moz-border-radius: 10px/100px;
129 | border-radius: 10px/100px;
130 | -webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
131 | -moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
132 | box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
133 | }
134 | .deck-container blockquote p {
135 | margin: 0;
136 | }
137 | .deck-container blockquote cite {
138 | font-size: .5em;
139 | font-style: normal;
140 | font-weight: bold;
141 | color: #888;
142 | }
143 | .deck-container blockquote:before {
144 | content: "“";
145 | position: absolute;
146 | top: 0;
147 | left: 0;
148 | font-size: 5em;
149 | line-height: 1;
150 | color: #ccf0f0;
151 | z-index: 1;
152 | }
153 | .deck-container .borderradius img {
154 | -webkit-border-radius: 5px;
155 | -moz-border-radius: 5px;
156 | border-radius: 5px;
157 | }
158 | .deck-container ::-moz-selection {
159 | background: #08455f;
160 | color: #fff;
161 | }
162 | .deck-container ::selection {
163 | background: #08455f;
164 | color: #fff;
165 | }
166 | .deck-container a, .deck-container a:hover, .deck-container a:focus, .deck-container a:active, .deck-container a:visited {
167 | color: #599;
168 | text-decoration: none;
169 | }
170 | .deck-container a:hover, .deck-container a:focus {
171 | text-decoration: underline;
172 | }
173 | .deck-container .deck-prev-link, .deck-container .deck-next-link {
174 | background: #fff;
175 | opacity: 0.5;
176 | }
177 | .deck-container .deck-prev-link, .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited {
178 | color: #599;
179 | }
180 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus {
181 | opacity: 1;
182 | text-decoration: none;
183 | }
184 | .deck-container .deck-status {
185 | font-size: 0.6666em;
186 | }
187 | .deck-container.deck-menu .slide {
188 | background: transparent;
189 | -webkit-border-radius: 5px;
190 | -moz-border-radius: 5px;
191 | border-radius: 5px;
192 | }
193 | .rgba .deck-container.deck-menu .slide {
194 | background: rgba(0, 0, 0, 0.1);
195 | }
196 | .deck-container.deck-menu .slide.deck-current, .rgba .deck-container.deck-menu .slide.deck-current, .no-touch .deck-container.deck-menu .slide:hover {
197 | background: #fff;
198 | }
199 | .deck-container .goto-form {
200 | background: #fff;
201 | border: 1px solid #cde;
202 | -webkit-border-radius: 5px;
203 | -moz-border-radius: 5px;
204 | border-radius: 5px;
205 | }
206 | .boxshadow .deck-container .goto-form {
207 | -webkit-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
208 | -moz-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
209 | box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
210 | }
211 |
--------------------------------------------------------------------------------
/git-talk/core/deck.core.css:
--------------------------------------------------------------------------------
1 | html {
2 | height: 100%;
3 | }
4 |
5 | .deck-container {
6 | position: relative;
7 | height: 100%;
8 | width: 70%;
9 | margin: 0 auto;
10 | padding: 0 48px;
11 | font-size: 16px;
12 | line-height: 1.25;
13 | overflow: hidden;
14 | /* Resets and base styles from HTML5 Boilerplate */
15 | /* End HTML5 Boilerplate adaptations */
16 | }
17 | .js .deck-container {
18 | visibility: hidden;
19 | }
20 | .ready .deck-container {
21 | visibility: visible;
22 | }
23 | .touch .deck-container {
24 | -webkit-text-size-adjust: none;
25 | }
26 | .deck-container div, .deck-container span, .deck-container object, .deck-container iframe,
27 | .deck-container h1, .deck-container h2, .deck-container h3, .deck-container h4, .deck-container h5, .deck-container h6, .deck-container p, .deck-container blockquote, .deck-container pre,
28 | .deck-container abbr, .deck-container address, .deck-container cite, .deck-container code, .deck-container del, .deck-container dfn, .deck-container em, .deck-container img, .deck-container ins, .deck-container kbd, .deck-container q, .deck-container samp,
29 | .deck-container small, .deck-container strong, .deck-container sub, .deck-container sup, .deck-container var, .deck-container b, .deck-container i, .deck-container dl, .deck-container dt, .deck-container dd, .deck-container ol, .deck-container ul, .deck-container li,
30 | .deck-container fieldset, .deck-container form, .deck-container label, .deck-container legend,
31 | .deck-container table, .deck-container caption, .deck-container tbody, .deck-container tfoot, .deck-container thead, .deck-container tr, .deck-container th, .deck-container td,
32 | .deck-container article, .deck-container aside, .deck-container canvas, .deck-container details, .deck-container figcaption, .deck-container figure,
33 | .deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section, .deck-container summary,
34 | .deck-container time, .deck-container mark, .deck-container audio, .deck-container video {
35 | margin: 0;
36 | padding: 0;
37 | border: 0;
38 | font-size: 100%;
39 | font: inherit;
40 | vertical-align: baseline;
41 | }
42 | .deck-container article, .deck-container aside, .deck-container details, .deck-container figcaption, .deck-container figure,
43 | .deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section {
44 | display: block;
45 | }
46 | .deck-container blockquote, .deck-container q {
47 | quotes: none;
48 | }
49 | .deck-container blockquote:before, .deck-container blockquote:after, .deck-container q:before, .deck-container q:after {
50 | content: "";
51 | content: none;
52 | }
53 | .deck-container ins {
54 | background-color: #ff9;
55 | color: #000;
56 | text-decoration: none;
57 | }
58 | .deck-container mark {
59 | background-color: #ff9;
60 | color: #000;
61 | font-style: italic;
62 | font-weight: bold;
63 | }
64 | .deck-container del {
65 | text-decoration: line-through;
66 | }
67 | .deck-container abbr[title], .deck-container dfn[title] {
68 | border-bottom: 1px dotted;
69 | cursor: help;
70 | }
71 | .deck-container table {
72 | border-collapse: collapse;
73 | border-spacing: 0;
74 | }
75 | .deck-container hr {
76 | display: block;
77 | height: 1px;
78 | border: 0;
79 | border-top: 1px solid #ccc;
80 | margin: 1em 0;
81 | padding: 0;
82 | }
83 | .deck-container input, .deck-container select {
84 | vertical-align: middle;
85 | }
86 | .deck-container select, .deck-container input, .deck-container textarea, .deck-container button {
87 | font: 99% sans-serif;
88 | }
89 | .deck-container pre, .deck-container code, .deck-container kbd, .deck-container samp {
90 | font-family: monospace, sans-serif;
91 | }
92 | .deck-container a {
93 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
94 | }
95 | .deck-container a:hover, .deck-container a:active {
96 | outline: none;
97 | }
98 | .deck-container ul, .deck-container ol {
99 | margin-left: 2em;
100 | vertical-align: top;
101 | }
102 | .deck-container ol {
103 | list-style-type: decimal;
104 | }
105 | .deck-container nav ul, .deck-container nav li {
106 | margin: 0;
107 | list-style: none;
108 | list-style-image: none;
109 | }
110 | .deck-container small {
111 | font-size: 85%;
112 | }
113 | .deck-container strong, .deck-container th {
114 | font-weight: bold;
115 | }
116 | .deck-container td {
117 | vertical-align: top;
118 | }
119 | .deck-container sub, .deck-container sup {
120 | font-size: 75%;
121 | line-height: 0;
122 | position: relative;
123 | }
124 | .deck-container sup {
125 | top: -0.5em;
126 | }
127 | .deck-container sub {
128 | bottom: -0.25em;
129 | }
130 | .deck-container textarea {
131 | overflow: auto;
132 | }
133 | .ie6 .deck-container legend, .ie7 .deck-container legend {
134 | margin-left: -7px;
135 | }
136 | .deck-container input[type="radio"] {
137 | vertical-align: text-bottom;
138 | }
139 | .deck-container input[type="checkbox"] {
140 | vertical-align: bottom;
141 | }
142 | .deck-container .ie7 input[type="checkbox"] {
143 | vertical-align: baseline;
144 | }
145 | .deck-container .ie6 input {
146 | vertical-align: text-bottom;
147 | }
148 | .deck-container label, .deck-container input[type="button"], .deck-container input[type="submit"], .deck-container input[type="image"], .deck-container button {
149 | cursor: pointer;
150 | }
151 | .deck-container button, .deck-container input, .deck-container select, .deck-container textarea {
152 | margin: 0;
153 | }
154 | .deck-container input:invalid, .deck-container textarea:invalid {
155 | border-radius: 1px;
156 | -moz-box-shadow: 0px 0px 5px red;
157 | -webkit-box-shadow: 0px 0px 5px red;
158 | box-shadow: 0px 0px 5px red;
159 | }
160 | .deck-container input:invalid .no-boxshadow, .deck-container textarea:invalid .no-boxshadow {
161 | background-color: #f0dddd;
162 | }
163 | .deck-container button {
164 | width: auto;
165 | overflow: visible;
166 | }
167 | .ie7 .deck-container img {
168 | -ms-interpolation-mode: bicubic;
169 | }
170 | .deck-container, .deck-container select, .deck-container input, .deck-container textarea {
171 | color: #444;
172 | }
173 | .deck-container a {
174 | color: #607890;
175 | }
176 | .deck-container a:hover, .deck-container a:focus {
177 | color: #036;
178 | }
179 | .deck-container a:link {
180 | -webkit-tap-highlight-color: #fff;
181 | }
182 | .deck-container h1 {
183 | font-size: 4.5em;
184 | font-weight: bold;
185 | text-align: center;
186 | padding-top: 1em;
187 | }
188 | .csstransforms .deck-container h1 {
189 | padding: 0 48px;
190 | position: absolute;
191 | left: 0;
192 | right: 0;
193 | top: 50%;
194 | -webkit-transform: translate(0, -50%);
195 | -moz-transform: translate(0, -50%);
196 | -ms-transform: translate(0, -50%);
197 | -o-transform: translate(0, -50%);
198 | transform: translate(0, -50%);
199 | }
200 | .deck-container h2 {
201 | font-size: 2.25em;
202 | font-weight: bold;
203 | padding-top: .5em;
204 | margin: 0 0 .66666em 0;
205 | border-bottom: 3px solid #888;
206 | }
207 | .deck-container h3 {
208 | font-size: 1.4375em;
209 | font-weight: bold;
210 | margin-bottom: .30435em;
211 | }
212 | .deck-container h4 {
213 | font-size: 1.25em;
214 | font-weight: bold;
215 | margin-bottom: .25em;
216 | }
217 | .deck-container h5 {
218 | font-size: 1.125em;
219 | font-weight: bold;
220 | margin-bottom: .2222em;
221 | }
222 | .deck-container h6 {
223 | font-size: 1em;
224 | font-weight: bold;
225 | }
226 | .deck-container img, .deck-container iframe, .deck-container video {
227 | display: block;
228 | max-width: 100%;
229 | }
230 | .deck-container video, .deck-container iframe, .deck-container img {
231 | display: block;
232 | margin: 0 auto;
233 | }
234 | .deck-container p, .deck-container blockquote, .deck-container iframe, .deck-container img, .deck-container ul, .deck-container ol, .deck-container pre, .deck-container video {
235 | margin-bottom: 1em;
236 | }
237 | .deck-container pre {
238 | white-space: pre;
239 | white-space: pre-wrap;
240 | word-wrap: break-word;
241 | padding: 1em;
242 | border: 1px solid #888;
243 | }
244 | .deck-container em {
245 | font-style: italic;
246 | }
247 | .deck-container li {
248 | padding: .25em 0;
249 | vertical-align: middle;
250 | }
251 | .deck-container.deck-loading {
252 | display: none;
253 | }
254 |
255 | .slide {
256 | width: auto;
257 | min-height: 100%;
258 | position: relative;
259 | }
260 |
261 | .deck-before, .deck-previous, .deck-next, .deck-after {
262 | position: absolute;
263 | left: -999em;
264 | top: -999em;
265 | }
266 |
267 | .deck-current {
268 | z-index: 2;
269 | }
270 |
271 | .slide .slide {
272 | visibility: hidden;
273 | position: static;
274 | min-height: 0;
275 | }
276 |
277 | .deck-child-current {
278 | position: static;
279 | z-index: 2;
280 | }
281 | .deck-child-current .slide {
282 | visibility: hidden;
283 | }
284 | .deck-child-current .deck-previous, .deck-child-current .deck-before, .deck-child-current .deck-current {
285 | visibility: visible;
286 | }
287 |
288 | body.deck-container {
289 | overflow: visible;
290 | }
291 |
292 | @media screen and (max-device-width: 480px) {
293 | /* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */
294 | }
295 | @media print {
296 | * {
297 | background: transparent !important;
298 | color: black !important;
299 | text-shadow: none !important;
300 | filter: none !important;
301 | -ms-filter: none !important;
302 | -webkit-box-reflect: none !important;
303 | -moz-box-reflect: none !important;
304 | -webkit-box-shadow: none !important;
305 | -moz-box-shadow: none !important;
306 | box-shadow: none !important;
307 | }
308 | * :before, * :after {
309 | display: none !important;
310 | }
311 |
312 | a, a:visited {
313 | color: #444 !important;
314 | text-decoration: underline;
315 | }
316 |
317 | a[href]:after {
318 | content: " (" attr(href) ")";
319 | }
320 |
321 | abbr[title]:after {
322 | content: " (" attr(title) ")";
323 | }
324 |
325 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after {
326 | content: "";
327 | }
328 |
329 | pre, blockquote {
330 | border: 1px solid #999;
331 | page-break-inside: avoid;
332 | }
333 |
334 | thead {
335 | display: table-header-group;
336 | }
337 |
338 | tr, img {
339 | page-break-inside: avoid;
340 | }
341 |
342 | @page {
343 | margin: 0.5cm;
344 | }
345 |
346 | p, h2, h3 {
347 | orphans: 3;
348 | widows: 3;
349 | }
350 |
351 | h2, h3 {
352 | page-break-after: avoid;
353 | }
354 |
355 | .slide {
356 | position: static !important;
357 | visibility: visible !important;
358 | display: block !important;
359 | -webkit-transform: none !important;
360 | -moz-transform: none !important;
361 | -o-transform: none !important;
362 | -ms-transform: none !important;
363 | transform: none !important;
364 | opacity: 1 !important;
365 | }
366 |
367 | h1 {
368 | -webkit-transform: none !important;
369 | -moz-transform: none !important;
370 | -o-transform: none !important;
371 | -ms-transform: none !important;
372 | transform: none !important;
373 | padding: 0 !important;
374 | position: static !important;
375 | }
376 |
377 | .deck-container > .slide {
378 | page-break-after: always;
379 | }
380 |
381 | .deck-container {
382 | width: 100% !important;
383 | height: auto !important;
384 | padding: 0 !important;
385 | display: block !important;
386 | }
387 |
388 | script {
389 | display: none;
390 | }
391 | }
392 |
--------------------------------------------------------------------------------
/git-talk/lib/modernizr.custom.js:
--------------------------------------------------------------------------------
1 | /* Modernizr 2.0.6 (Custom Build) | MIT & BSD
2 | * Contains: fontface | backgroundsize | borderimage | borderradius | boxshadow | flexbox | hsla | multiplebgs | opacity | rgba | textshadow | cssanimations | csscolumns | generatedcontent | cssgradients | cssreflections | csstransforms | csstransforms3d | csstransitions | applicationcache | canvas | canvastext | draganddrop | hashchange | history | audio | video | indexeddb | input | inputtypes | localstorage | postmessage | sessionstorage | websockets | websqldatabase | webworkers | geolocation | inlinesvg | smil | svg | svgclippaths | touch | webgl | iepp | cssclasses | addtest | teststyles | testprop | testallprops | hasevent | prefixes | domprefixes | load
3 | */
4 | ;window.Modernizr=function(a,b,c){function H(){e.input=function(a){for(var b=0,c=a.length;b",a,""].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},w=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),x,y={}.hasOwnProperty,z;!C(y,c)&&!C(y.call,c)?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)};var G=function(c,d){var f=c.join(""),g=d.length;v(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9,e.csstransforms3d=j.csstransforms3d.offsetLeft===9,e.generatedcontent=j.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!C(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return e.touch},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){return w("dragstart")&&w("drop")},r.websockets=function(){for(var b=-1,c=p.length;++b";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var I in r)z(r,I)&&(x=I.toLowerCase(),e[x]=r[I](),u.push((e[x]?"":"no-")+x));e.input||H(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)z(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return;b=typeof b=="boolean"?b:!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b}return e},A(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML=" ";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b
2 |
3 |
4 |
5 | Your Title Here
6 |
7 |
8 |
9 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
64 |
65 |
66 |
Git入门
67 |
68 |
69 |
70 |
源代码管理的最佳选择
71 |
72 |
73 |
74 |
75 |
76 |
77 |
闲扯
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
Git命令
89 |
90 |
30多个命令
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
入门
100 |
101 |
102 | git branch
103 | git status
104 | git add
105 | git commit -m “message”
106 | git push origin master
107 | git remote add origin
108 | git clone
109 | git init
110 |
111 |
112 |
113 |
114 |
115 |
116 |
基础
117 |
118 |
119 | git pull origin master
120 | git merge develop
121 | git checkout
122 | git reset HEAD^
123 | git log –graph –oneline
124 | git tag
125 | git stash
126 | git fetch origin master
127 |
128 |
129 |
130 |
131 |
132 |
133 |
高级
134 |
135 |
啥?
136 |
137 |
138 |
139 |
140 |
141 |
入门
142 |
143 |
144 |
145 |
146 | git branch -a
147 | git status
148 | git add
149 | git commit -m “message”
150 | git push origin master
151 |
152 |
153 |
154 |
155 |
156 |
157 |
分支
158 |
159 |
git branch -a
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
文件状态
169 |
170 |
git status
171 |
172 |
173 |
174 | untracked 未追踪
175 | unmodified 未修改
176 | modified 已修改
177 | staged
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
入门实践
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
入门实践
195 |
196 |
197 |
198 | 添加
199 |
200 |
201 | git add <filename>
202 | git add *
203 |
204 |
205 |
206 | 提交
207 |
208 |
209 | git commit -m "代码提交信息"
210 |
211 |
212 |
213 | 推送改动
214 |
215 | 除非你将分支推送到远端仓库,不然该分支就是 不为他人所见的:
216 |
217 |
218 | git push origin <branch>
219 |
220 |
221 | 如果还没有克隆现有仓库,并欲将你的仓库连接到某个远程服务器,使用如下命令添加:
222 |
223 |
224 | git remote add origin <server>
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
新建本地仓库
234 |
235 |
251 |
252 |
253 |
254 |
255 |
256 |
分支
257 |
258 |
删掉新建的分支:
259 |
260 | ```
261 | git branch -d <branch>
262 | git push origin :<branch>
263 | ```
264 |
265 |
266 |
267 |
268 |
269 |
270 |
基础
271 |
272 |
273 | git pull origin master
274 | git merge develop
275 | git checkout
276 | git reset HEAD^
277 | git log –graph –oneline
278 |
279 |
280 |
281 |
282 |
283 |
284 |
HEAD
285 |
286 |
287 | HEAD [ HEAD-3, HEAD^3 ]
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
基础实践
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
更新与合并
305 |
306 |
git pull
307 |
308 |
309 |
以在你的工作目录中 获取(fetch) 并 合并(merge) 远端的改动。 要合并其他分支到你的当前分支(例如 master),执行:
310 |
311 |
git fetch origin master
312 | git merge <branch>
313 |
314 |
315 |
git 会尝试去自动合并改动。不幸的是,自动合并并非次次都能成功,并可能导致 冲突(conflicts)。 这时候就需要你修改这些文件来人肉合并这些 冲突(conflicts)
316 |
317 |
git diff <source_branch> <target_branch>
318 |
319 |
320 |
321 |
322 |
323 |
324 |
替换本地改动
325 |
326 |
327 | 假如你做错事(自然,这是不可能的),你可以使用如下命令替换掉本地改动:
328 |
329 |
330 |
git checkout -- <filename>
331 |
332 |
333 |
此命令会使用 HEAD 中的最新内容替换掉你的工作目录中的文件。已添加到缓存区的改动,以及新文件,都不受影响。
334 |
335 |
336 | 创建一个叫做“feature_x”的分支,并切换过去:
337 |
338 |
339 |
git checkout -b feature_x
340 |
341 |
342 |
345 |
346 |
git checkout master
347 |
348 |
349 |
350 |
351 |
352 |
353 |
丢弃本地改动与提交
354 |
355 |
假如你想要丢弃你所有的本地改动与提交,可以到服务器上获取最新的版本并将你本地主分支指向到它:
356 |
357 |
git reset [--soft] origin/master
358 | git reset --hard origin/master
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
查看提交日志
368 |
369 |
git log --graph --oneline
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
储藏(Stashing)
379 |
380 |
放入stash
381 |
382 |
git stash
383 |
384 |
385 |
386 | git stash show
387 | git stash pop
388 | git stash list
389 |
390 |
391 |
392 |
393 |
394 |
395 |
标签
396 |
397 |
在软件发布时创建标签,是被推荐的。这是个旧有概念,在 SVN 中也有。可以执行如下命令以创建一个叫做 1.0.0 的标签:
398 |
399 |
git tag 1.0.0 <commit>
400 |
401 |
402 |
403 |
404 |
405 |
406 |
高级
407 |
408 |
超大型项目
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
实践 git-flow
417 |
418 |
419 |
420 |
5 个主分支
421 |
422 |
423 | master
424 | develop
425 | release
426 | hotfix
427 | feature
428 |
429 |
430 |
431 |
432 |
433 |
434 |
实践 juche_server
435 |
436 |
437 |
438 |
3 个主分支
439 |
440 |
441 | master 线上服务器
442 | staging 测试服务器
443 | develop ci服务器
444 |
445 |
446 |
447 |
448 |
449 |
450 |
内部结构
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
相关文件
459 |
460 |
461 | .gitignore
462 | .git/config
463 | HEAD
464 | index
465 | objects/
466 | refs/
467 |
468 |
469 |
470 |
471 |
472 |
473 |
Git对象
474 |
475 |
476 | commit
477 | tree
478 | blob
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
Git Reference
488 |
489 |
Git 内部原理
490 |
491 |
492 | HEAD
493 | tags
494 | remotes
495 | packfiles
496 | refspec
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
回顾-文件状态
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
回顾-入门
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
回顾-基础
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
回顾
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
提问
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
参考资料
546 |
547 |
548 | 书籍pro-git
549 | git-it练习
550 | 速查表
551 |
552 |
553 |
554 |
555 |
556 |
557 |
书籍pro-git
558 |
559 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
git-it练习
571 |
572 |
575 |
576 |
577 |
578 |
581 |
582 |
583 |
584 |
585 |
586 |
速查表
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
中文速查表
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
作业
607 |
608 |
609 | pro git
610 | git-it
611 | git rebase
612 | git revert
613 | git show
614 | git shortlog
615 | git blame
616 | git am
617 |
618 |
619 |
620 |
621 |
622 |
623 |
谢谢
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
--------------------------------------------------------------------------------
/git-talk/git.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Your Title Here
6 |
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
30 |
31 |
32 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
58 |
59 |
60 |
Git入门
61 |
62 |
63 |
64 |
源代码管理的最佳选择
65 |
66 |
67 |
68 |
69 |
70 |
71 |
闲扯
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
Git命令
83 |
84 |
30多个命令
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
入门
94 |
95 |
96 | git branch
97 | git status
98 | git add
99 | git commit -m “message”
100 | git push origin master
101 | git remote add origin
102 | git clone
103 | git init
104 |
105 |
106 |
107 |
108 |
109 |
110 |
基础
111 |
112 |
113 | git pull origin master
114 | git merge develop
115 | git checkout
116 | git reset HEAD^
117 | git log –graph –oneline
118 | git tag
119 | git stash
120 | git fetch origin master
121 |
122 |
123 |
124 |
125 |
126 |
127 |
高级
128 |
129 |
啥?
130 |
131 |
132 |
133 |
134 |
135 |
入门
136 |
137 |
138 |
139 |
140 | git branch -a
141 | git status
142 | git add
143 | git commit -m “message”
144 | git push origin master
145 |
146 |
147 |
148 |
149 |
150 |
151 |
分支
152 |
153 |
git branch -a
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
文件状态
163 |
164 |
git status
165 |
166 |
167 |
168 | untracked 未追踪
169 | unmodified 未修改
170 | modified 已修改
171 | staged
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
入门实践
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
入门实践
189 |
190 |
191 |
192 | 添加
193 |
194 |
195 | git add <filename>
196 | git add *
197 |
198 |
199 |
200 | 提交
201 |
202 |
203 | git commit -m "代码提交信息"
204 |
205 |
206 |
207 | 推送改动
208 |
209 | 除非你将分支推送到远端仓库,不然该分支就是 不为他人所见的:
210 |
211 |
212 | git push origin <branch>
213 |
214 |
215 | 如果还没有克隆现有仓库,并欲将你的仓库连接到某个远程服务器,使用如下命令添加:
216 |
217 |
218 | git remote add origin <server>
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
新建本地仓库
228 |
229 |
245 |
246 |
247 |
248 |
249 |
250 |
分支
251 |
252 |
删掉新建的分支:
253 |
254 | ```
255 | git branch -d <branch>
256 | git push origin :<branch>
257 | ```
258 |
259 |
260 |
261 |
262 |
263 |
264 |
基础
265 |
266 |
267 | git pull origin master
268 | git merge develop
269 | git checkout
270 | git reset HEAD^
271 | git log –graph –oneline
272 |
273 |
274 |
275 |
276 |
277 |
278 |
HEAD
279 |
280 |
281 | HEAD [ HEAD-3, HEAD^3 ]
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
基础实践
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
更新与合并
299 |
300 |
git pull
301 |
302 |
303 |
以在你的工作目录中 获取(fetch) 并 合并(merge) 远端的改动。 要合并其他分支到你的当前分支(例如 master),执行:
304 |
305 |
git fetch origin master
306 | git merge <branch>
307 |
308 |
309 |
git 会尝试去自动合并改动。不幸的是,自动合并并非次次都能成功,并可能导致 冲突(conflicts)。 这时候就需要你修改这些文件来人肉合并这些 冲突(conflicts)
310 |
311 |
git diff <source_branch> <target_branch>
312 |
313 |
314 |
315 |
316 |
317 |
318 |
替换本地改动
319 |
320 |
321 | 假如你做错事(自然,这是不可能的),你可以使用如下命令替换掉本地改动:
322 |
323 |
324 |
git checkout -- <filename>
325 |
326 |
327 |
此命令会使用 HEAD 中的最新内容替换掉你的工作目录中的文件。已添加到缓存区的改动,以及新文件,都不受影响。
328 |
329 |
330 | 创建一个叫做“feature_x”的分支,并切换过去:
331 |
332 |
333 |
git checkout -b feature_x
334 |
335 |
336 |
339 |
340 |
git checkout master
341 |
342 |
343 |
344 |
345 |
346 |
347 |
丢弃本地改动与提交
348 |
349 |
假如你想要丢弃你所有的本地改动与提交,可以到服务器上获取最新的版本并将你本地主分支指向到它:
350 |
351 |
git reset [--soft] origin/master
352 | git reset --hard origin/master
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
查看提交日志
362 |
363 |
git log --graph --oneline
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
储藏(Stashing)
373 |
374 |
放入stash
375 |
376 |
git stash
377 |
378 |
379 |
380 | git stash show
381 | git stash pop
382 | git stash list
383 |
384 |
385 |
386 |
387 |
388 |
389 |
标签
390 |
391 |
在软件发布时创建标签,是被推荐的。这是个旧有概念,在 SVN 中也有。可以执行如下命令以创建一个叫做 1.0.0 的标签:
392 |
393 |
git tag 1.0.0 <commit>
394 |
395 |
396 |
397 |
398 |
399 |
400 |
高级
401 |
402 |
超大型项目
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
实践 git-flow
411 |
412 |
413 |
414 |
5 个主分支
415 |
416 |
417 | master
418 | develop
419 | release
420 | hotfix
421 | feature
422 |
423 |
424 |
425 |
426 |
427 |
428 |
实践 juche_server
429 |
430 |
431 |
432 |
3 个主分支
433 |
434 |
435 | master 线上服务器
436 | staging 测试服务器
437 | develop ci服务器
438 |
439 |
440 |
441 |
442 |
443 |
444 |
内部结构
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
相关文件
453 |
454 |
455 | .gitignore
456 | .git/config
457 | HEAD
458 | index
459 | objects/
460 | refs/
461 |
462 |
463 |
464 |
465 |
466 |
467 |
Git对象
468 |
469 |
470 | commit
471 | tree
472 | blob
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
Git Reference
482 |
483 |
Git 内部原理
484 |
485 |
486 | HEAD
487 | tags
488 | remotes
489 | packfiles
490 | refspec
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
回顾-文件状态
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
回顾-入门
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
回顾-基础
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
回顾
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
提问
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
参考资料
540 |
541 |
542 | 书籍pro-git
543 | git-it练习
544 | 速查表
545 |
546 |
547 |
548 |
549 |
550 |
551 |
书籍pro-git
552 |
553 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
git-it练习
565 |
566 |
569 |
570 |
571 |
572 |
575 |
576 |
577 |
578 |
579 |
580 |
速查表
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
中文速查表
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
作业
601 |
602 |
603 | pro git
604 | git-it
605 | git rebase
606 | git revert
607 | git show
608 | git shortlog
609 | git blame
610 | git am
611 |
612 |
613 |
614 |
615 |
616 |
617 |
谢谢
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
--------------------------------------------------------------------------------
/git-talk/core/deck.core.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Deck JS - deck.core
3 | Copyright (c) 2011 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7 | */
8 |
9 | /*
10 | The deck.core module provides all the basic functionality for creating and
11 | moving through a deck. It does so by applying classes to indicate the state of
12 | the deck and its slides, allowing CSS to take care of the visual representation
13 | of each state. It also provides methods for navigating the deck and inspecting
14 | its state, as well as basic key bindings for going to the next and previous
15 | slides. More functionality is provided by wholly separate extension modules
16 | that use the API provided by core.
17 | */
18 | (function($, deck, document, undefined) {
19 | var slides, // Array of all the uh, slides...
20 | current, // Array index of the current slide
21 | $container, // Keeping this cached
22 |
23 | events = {
24 | /*
25 | This event fires whenever the current slide changes, whether by way of
26 | next, prev, or go. The callback function is passed two parameters, from
27 | and to, equal to the indices of the old slide and the new slide
28 | respectively.
29 |
30 | $(document).bind('deck.change', function(event, from, to) {
31 | alert('Moving from slide ' + from + ' to ' + to);
32 | });
33 | */
34 | change: 'deck.change',
35 |
36 | /*
37 | This event fires at the end of deck initialization. Extensions should
38 | implement any code that relies on user extensible options (key bindings,
39 | element selectors, classes) within a handler for this event. Native
40 | events associated with Deck JS should be scoped under a .deck event
41 | namespace, as with the example below:
42 |
43 | var $d = $(document);
44 | $.deck.defaults.keys.myExtensionKeycode = 70; // 'h'
45 | $d.bind('deck.init', function() {
46 | $d.bind('keydown.deck', function(event) {
47 | if (event.which === $.deck.getOptions().keys.myExtensionKeycode) {
48 | // Rock out
49 | }
50 | });
51 | });
52 | */
53 | initialize: 'deck.init'
54 | },
55 |
56 | options = {},
57 | $d = $(document),
58 |
59 | /*
60 | Internal function. Updates slide and container classes based on which
61 | slide is the current slide.
62 | */
63 | updateStates = function() {
64 | var oc = options.classes,
65 | osc = options.selectors.container,
66 | old = $container.data('onSlide'),
67 | $all = $();
68 |
69 | // Container state
70 | $container.removeClass(oc.onPrefix + old)
71 | .addClass(oc.onPrefix + current)
72 | .data('onSlide', current);
73 |
74 | // Remove and re-add child-current classes for nesting
75 | $('.' + oc.current).parentsUntil(osc).removeClass(oc.childCurrent);
76 | slides[current].parentsUntil(osc).addClass(oc.childCurrent);
77 |
78 | // Remove previous states
79 | $.each(slides, function(i, el) {
80 | $all = $all.add(el);
81 | });
82 | $all.removeClass([
83 | oc.before,
84 | oc.previous,
85 | oc.current,
86 | oc.next,
87 | oc.after
88 | ].join(" "));
89 |
90 | // Add new states back in
91 | slides[current].addClass(oc.current);
92 | if (current > 0) {
93 | slides[current-1].addClass(oc.previous);
94 | }
95 | if (current + 1 < slides.length) {
96 | slides[current+1].addClass(oc.next);
97 | }
98 | if (current > 1) {
99 | $.each(slides.slice(0, current - 1), function(i, el) {
100 | el.addClass(oc.before);
101 | });
102 | }
103 | if (current + 2 < slides.length) {
104 | $.each(slides.slice(current+2), function(i, el) {
105 | el.addClass(oc.after);
106 | });
107 | }
108 | },
109 |
110 | /* Methods exposed in the jQuery.deck namespace */
111 | methods = {
112 |
113 | /*
114 | jQuery.deck(selector, options)
115 |
116 | selector: string | jQuery | array
117 | options: object, optional
118 |
119 | Initializes the deck, using each element matched by selector as a slide.
120 | May also be passed an array of string selectors or jQuery objects, in
121 | which case each selector in the array is considered a slide. The second
122 | parameter is an optional options object which will extend the default
123 | values.
124 |
125 | $.deck('.slide');
126 |
127 | or
128 |
129 | $.deck([
130 | '#first-slide',
131 | '#second-slide',
132 | '#etc'
133 | ]);
134 | */
135 | init: function(elements, opts) {
136 | var startTouch,
137 | tolerance,
138 | esp = function(e) {
139 | e.stopPropagation();
140 | };
141 |
142 | options = $.extend(true, {}, $[deck].defaults, opts);
143 | slides = [];
144 | current = 0;
145 | $container = $(options.selectors.container);
146 | tolerance = options.touch.swipeTolerance;
147 |
148 | // Hide the deck while states are being applied to kill transitions
149 | $container.addClass(options.classes.loading);
150 |
151 | // Fill slides array depending on parameter type
152 | if ($.isArray(elements)) {
153 | $.each(elements, function(i, e) {
154 | slides.push($(e));
155 | });
156 | }
157 | else {
158 | $(elements).each(function(i, e) {
159 | slides.push($(e));
160 | });
161 | }
162 |
163 | /* Remove any previous bindings, and rebind key events */
164 | $d.unbind('keydown.deck').bind('keydown.deck', function(e) {
165 | if (e.which === options.keys.next || $.inArray(e.which, options.keys.next) > -1) {
166 | methods.next();
167 | e.preventDefault();
168 | }
169 | else if (e.which === options.keys.previous || $.inArray(e.which, options.keys.previous) > -1) {
170 | methods.prev();
171 | e.preventDefault();
172 | }
173 | });
174 |
175 | /* Bind touch events for swiping between slides on touch devices */
176 | $container.unbind('touchstart.deck').bind('touchstart.deck', function(e) {
177 | if (!startTouch) {
178 | startTouch = $.extend({}, e.originalEvent.targetTouches[0]);
179 | }
180 | })
181 | .unbind('touchmove.deck').bind('touchmove.deck', function(e) {
182 | $.each(e.originalEvent.changedTouches, function(i, t) {
183 | if (startTouch && t.identifier === startTouch.identifier) {
184 | if (t.screenX - startTouch.screenX > tolerance || t.screenY - startTouch.screenY > tolerance) {
185 | $[deck]('prev');
186 | startTouch = undefined;
187 | }
188 | else if (t.screenX - startTouch.screenX < -1 * tolerance || t.screenY - startTouch.screenY < -1 * tolerance) {
189 | $[deck]('next');
190 | startTouch = undefined;
191 | }
192 | return false;
193 | }
194 | });
195 | e.preventDefault();
196 | })
197 | .unbind('touchend.deck').bind('touchend.deck', function(t) {
198 | $.each(t.originalEvent.changedTouches, function(i, t) {
199 | if (startTouch && t.identifier === startTouch.identifier) {
200 | startTouch = undefined;
201 | }
202 | });
203 | })
204 | .scrollLeft(0).scrollTop(0)
205 | /* Stop propagation of key events within editable elements of slides */
206 | .undelegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp)
207 | .delegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp);
208 |
209 | /*
210 | Kick iframe videos, which dont like to redraw w/ transforms.
211 | Remove this if Webkit ever fixes it.
212 | */
213 | $.each(slides, function(i, $el) {
214 | $el.unbind('webkitTransitionEnd.deck').bind('webkitTransitionEnd.deck',
215 | function(event) {
216 | if ($el.hasClass($[deck]('getOptions').classes.current)) {
217 | var embeds = $(this).find('iframe').css('opacity', 0);
218 | window.setTimeout(function() {
219 | embeds.css('opacity', 1);
220 | }, 100);
221 | }
222 | });
223 | });
224 |
225 | updateStates();
226 |
227 | // Show deck again now that slides are in place
228 | $container.removeClass(options.classes.loading);
229 | $d.trigger(events.initialize);
230 | },
231 |
232 | /*
233 | jQuery.deck('go', index)
234 |
235 | index: integer
236 |
237 | Moves to the slide at the specified index. Index is 0-based, so
238 | $.deck('go', 0); will move to the first slide. If index is out of bounds
239 | or not a number the call is ignored.
240 | */
241 | go: function(index) {
242 | if (typeof index != 'number' || index < 0 || index >= slides.length) return;
243 |
244 | $d.trigger(events.change, [current, index]);
245 | current = index;
246 | updateStates();
247 | },
248 |
249 | /*
250 | jQuery.deck('next')
251 |
252 | Moves to the next slide. If the last slide is already active, the call
253 | is ignored.
254 | */
255 | next: function() {
256 | methods.go(current+1);
257 | },
258 |
259 | /*
260 | jQuery.deck('prev')
261 |
262 | Moves to the previous slide. If the first slide is already active, the
263 | call is ignored.
264 | */
265 | prev: function() {
266 | methods.go(current-1);
267 | },
268 |
269 | /*
270 | jQuery.deck('getSlide', index)
271 |
272 | index: integer, optional
273 |
274 | Returns a jQuery object containing the slide at index. If index is not
275 | specified, the current slide is returned.
276 | */
277 | getSlide: function(index) {
278 | var i = typeof index !== 'undefined' ? index : current;
279 | if (typeof i != 'number' || i < 0 || i >= slides.length) return null;
280 | return slides[i];
281 | },
282 |
283 | /*
284 | jQuery.deck('getSlides')
285 |
286 | Returns all slides as an array of jQuery objects.
287 | */
288 | getSlides: function() {
289 | return slides;
290 | },
291 |
292 | /*
293 | jQuery.deck('getContainer')
294 |
295 | Returns a jQuery object containing the deck container as defined by the
296 | container option.
297 | */
298 | getContainer: function() {
299 | return $container;
300 | },
301 |
302 | /*
303 | jQuery.deck('getOptions')
304 |
305 | Returns the options object for the deck, including any overrides that
306 | were defined at initialization.
307 | */
308 | getOptions: function() {
309 | return options;
310 | },
311 |
312 | /*
313 | jQuery.deck('extend', name, method)
314 |
315 | name: string
316 | method: function
317 |
318 | Adds method to the deck namespace with the key of name. This doesn’t
319 | give access to any private member data — public methods must still be
320 | used within method — but lets extension authors piggyback on the deck
321 | namespace rather than pollute jQuery.
322 |
323 | $.deck('extend', 'alert', function(msg) {
324 | alert(msg);
325 | });
326 |
327 | // Alerts 'boom'
328 | $.deck('alert', 'boom');
329 | */
330 | extend: function(name, method) {
331 | methods[name] = method;
332 | }
333 | };
334 |
335 | /* jQuery extension */
336 | $[deck] = function(method, arg) {
337 | if (methods[method]) {
338 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
339 | }
340 | else {
341 | return methods.init(method, arg);
342 | }
343 | };
344 |
345 | /*
346 | The default settings object for a deck. All deck extensions should extend
347 | this object to add defaults for any of their options.
348 |
349 | options.classes.after
350 | This class is added to all slides that appear after the 'next' slide.
351 |
352 | options.classes.before
353 | This class is added to all slides that appear before the 'previous'
354 | slide.
355 |
356 | options.classes.childCurrent
357 | This class is added to all elements in the DOM tree between the
358 | 'current' slide and the deck container. For standard slides, this is
359 | mostly seen and used for nested slides.
360 |
361 | options.classes.current
362 | This class is added to the current slide.
363 |
364 | options.classes.loading
365 | This class is applied to the deck container during loading phases and is
366 | primarily used as a way to short circuit transitions between states
367 | where such transitions are distracting or unwanted. For example, this
368 | class is applied during deck initialization and then removed to prevent
369 | all the slides from appearing stacked and transitioning into place
370 | on load.
371 |
372 | options.classes.next
373 | This class is added to the slide immediately following the 'current'
374 | slide.
375 |
376 | options.classes.onPrefix
377 | This prefix, concatenated with the current slide index, is added to the
378 | deck container as you change slides.
379 |
380 | options.classes.previous
381 | This class is added to the slide immediately preceding the 'current'
382 | slide.
383 |
384 | options.selectors.container
385 | Elements matched by this CSS selector will be considered the deck
386 | container. The deck container is used to scope certain states of the
387 | deck, as with the onPrefix option, or with extensions such as deck.goto
388 | and deck.menu.
389 |
390 | options.keys.next
391 | The numeric keycode used to go to the next slide.
392 |
393 | options.keys.previous
394 | The numeric keycode used to go to the previous slide.
395 |
396 | options.touch.swipeTolerance
397 | The number of pixels the users finger must travel to produce a swipe
398 | gesture.
399 | */
400 | $[deck].defaults = {
401 | classes: {
402 | after: 'deck-after',
403 | before: 'deck-before',
404 | childCurrent: 'deck-child-current',
405 | current: 'deck-current',
406 | loading: 'deck-loading',
407 | next: 'deck-next',
408 | onPrefix: 'on-slide-',
409 | previous: 'deck-previous'
410 | },
411 |
412 | selectors: {
413 | container: '.deck-container'
414 | },
415 |
416 | keys: {
417 | // enter, space, page down, right arrow, down arrow,
418 | next: [13, 32, 34, 39, 40],
419 | // backspace, page up, left arrow, up arrow
420 | previous: [8, 33, 37, 38]
421 | },
422 |
423 | touch: {
424 | swipeTolerance: 60
425 | }
426 | };
427 |
428 | $d.ready(function() {
429 | $('html').addClass('ready');
430 | });
431 |
432 | /*
433 | FF + Transforms + Flash video don't get along...
434 | Firefox will reload and start playing certain videos after a
435 | transform. Blanking the src when a previously shown slide goes out
436 | of view prevents this.
437 | */
438 | $d.bind('deck.change', function(e, from, to) {
439 | var oldFrames = $[deck]('getSlide', from).find('iframe'),
440 | newFrames = $[deck]('getSlide', to).find('iframe');
441 |
442 | oldFrames.each(function() {
443 | var $this = $(this),
444 | curSrc = $this.attr('src');
445 |
446 | if(curSrc) {
447 | $this.data('deck-src', curSrc).attr('src', '');
448 | }
449 | });
450 |
451 | newFrames.each(function() {
452 | var $this = $(this),
453 | originalSrc = $this.data('deck-src');
454 |
455 | if (originalSrc) {
456 | $this.attr('src', originalSrc);
457 | }
458 | });
459 | });
460 | })(jQuery, 'deck', document);
461 |
--------------------------------------------------------------------------------
/git-talk/s6/jquery.slideshow.js:
--------------------------------------------------------------------------------
1 |
2 | var Slideshow = {};
3 |
4 |
5 | /************************************
6 | * lets you define your own "global" transition function
7 | * passes in a reference to from and to slide wrapped in jQuery wrapper
8 | */
9 |
10 | Slideshow.transition = function( $from, $to ) {
11 | // $from.hide();
12 | // $to.show();
13 |
14 | $from.hide('fast');
15 | $to.show('fast');
16 | }
17 |
18 | /***********************
19 | * sample custom transition using scrollUp effect
20 | * inspired by Karl Swedberg's Scroll Up Headline Reader jQuery Tutorial[1]
21 | * [1] http://docs.jquery.com/Tutorials:Scroll_Up_Headline_Reader
22 | */
23 |
24 | function transitionSlideUpSlideDown( $from, $to ) {
25 | $from.slideUp( 500, function() { $to.slideDown( 1000 ); } );
26 | }
27 |
28 | function transitionFadeOutFadeIn( $from, $to ) {
29 | $from.fadeOut( 500 );
30 | $to.fadeIn( 500 );
31 | }
32 |
33 | function transitionScrollUp( $from, $to ) {
34 | var cheight = $from.outerHeight();
35 |
36 | // hide scrollbar during animation
37 | $( 'body' ).css( 'overflow-y', 'hidden' );
38 |
39 | $to.css( 'top', cheight+'px' );
40 | $to.show();
41 |
42 | $from.animate( {top: -cheight}, 'slow' );
43 | $to.animate( {top: 0}, 'slow', function() {
44 | $from.hide().css( 'top', '0px');
45 |
46 | // restore possible scrollbar
47 | $( 'body' ).css( 'overflow-y', 'auto' );
48 | });
49 | }
50 |
51 | Slideshow.init = function( options ) {
52 |
53 | var settings = $.extend({
54 | mode : 'slideshow', // slideshow | outline | autoplay
55 | projectionStyleId : '#styleProjection',
56 | screenStyleId : '#styleScreen',
57 | titleSelector : 'h1',
58 | slideSelector : '.slide', // dummy (not yet working)
59 | stepSelector : '.step', // dummy (not yet working)
60 | debug : false,
61 | change : null // todo: change to use a custom event and trigger
62 | }, options || {});
63 |
64 | settings.isProjection = true; // are we in projection (slideshow) mode (in contrast to screen (outline) mode)?
65 | settings.snum = 1; // current slide # (non-zero based index e.g. starting with 1)
66 | settings.smax = 1; // max number of slides
67 | settings.incpos = 0; // current step in slide
68 | settings.steps = null;
69 | settings.autoplayInterval = null;
70 |
71 | function debug( msg )
72 | {
73 | if( settings.debug && window.console && window.console.log )
74 | window.console.log( '[debug] ' + msg );
75 | }
76 |
77 | function showHide( action )
78 | {
79 | var $navLinks = $( '#navLinks' )
80 |
81 | switch( action ) {
82 | case 's': $navLinks.css( 'visibility', 'visible' ); break;
83 | case 'h': $navLinks.css( 'visibility', 'hidden' ); break;
84 | case 'c': /* toggle control panel */
85 | if( $navLinks.css( 'visibility' ) != 'visible' )
86 | $navLinks.css( 'visibility', 'visible' );
87 | else
88 | $navLinks.css( 'visibility', 'hidden' );
89 | break;
90 | }
91 | }
92 |
93 | function updateCurrentSlideCounter()
94 | {
95 | $( '#currentSlide' ).html( settings.snum + '/' + settings.smax );
96 | }
97 |
98 | function updateJumpList()
99 | {
100 | $('#jumplist').get(0).selectedIndex = (settings.snum-1);
101 | }
102 |
103 | function updatePermaLink()
104 | {
105 | // todo: unify hash marks??; use #1 for div ids instead of #slide1?
106 | window.location.hash = '#'+settings.snum;
107 | }
108 |
109 | function goTo( target )
110 | {
111 | if( target > settings.smax || target == settings.snum ) return;
112 | go( target - settings.snum );
113 | }
114 |
115 | function go( dir )
116 | {
117 | debug( 'go: ' + dir );
118 |
119 | if( dir == 0 ) return; /* same slide; nothing to do */
120 |
121 | var cid = '#slide' + settings.snum; /* current slide (selector) id */
122 | var csteps = settings.steps[settings.snum-1]; /* current slide steps array */
123 |
124 | /* remove all step and stepcurrent classes from current slide */
125 | if( csteps.length > 0) {
126 | $( csteps ).each( function() {
127 | $(this).removeClass( 'step' ).removeClass( 'stepcurrent' );
128 | } );
129 | }
130 |
131 | /* set snum to next slide */
132 | settings.snum += dir;
133 | if( settings.snum > settings.smax ) settings.snum = settings.smax;
134 | if( settings.snum < 1 ) settings.snum = 1;
135 |
136 | var nid = '#slide' + settings.snum; /* next slide (selector) id */
137 | var nsteps = settings.steps[settings.snum-1]; /* next slide steps array */
138 |
139 | if( dir < 0 ) /* go backwards? */
140 | {
141 | settings.incpos = nsteps.length;
142 | /* mark last step as current step */
143 | if( nsteps.length > 0 )
144 | $( nsteps[settings.incpos-1] ).addClass( 'stepcurrent' );
145 | }
146 | else /* go forwards? */
147 | {
148 | settings.incpos = 0;
149 | if( nsteps.length > 0 ) {
150 | $( nsteps ).each( function() {
151 | $(this).addClass( 'step' ).removeClass( 'stepcurrent' );
152 | } );
153 | }
154 | }
155 |
156 | if( !(cid == nid) ) {
157 | debug( "transition from " + cid + " to " + nid );
158 | Slideshow.transition( $( cid ), $( nid ) );
159 | }
160 |
161 | updateJumpList();
162 | updateCurrentSlideCounter();
163 | updatePermaLink();
164 |
165 | if (settings.change) { settings.change(); }
166 | }
167 |
168 | function subgo( dir )
169 | {
170 | debug( 'subgo: ' + dir + ', incpos before: ' + settings.incpos + ', after: ' + (settings.incpos+dir) );
171 |
172 | var csteps = settings.steps[settings.snum-1]; /* current slide steps array */
173 |
174 | if( dir > 0)
175 | { /* go forward? */
176 | if( settings.incpos > 0 )
177 | $( csteps[settings.incpos-1] ).removeClass( 'stepcurrent' );
178 | $( csteps[settings.incpos] ).removeClass( 'step').addClass( 'stepcurrent' );
179 | settings.incpos++;
180 | }
181 | else
182 | { /* go backwards? */
183 | settings.incpos--;
184 | $( csteps[settings.incpos] ).removeClass( 'stepcurrent' ).addClass( 'step' );
185 | if( settings.incpos > 0 )
186 | $( csteps[settings.incpos-1] ).addClass( 'stepcurrent' );
187 | }
188 | }
189 |
190 |
191 | function notOperaFix()
192 | {
193 | $( settings.projectionStyleId ).attr( 'media','screen' );
194 |
195 | var styleScreen = $( settings.screenStyleId ).get(0);
196 | styleScreen.disabled = true;
197 | }
198 |
199 |
200 | function toggle()
201 | {
202 | // toggle between projection (slide show) mode
203 | // and screen (outline) mode
204 |
205 | // get stylesheets
206 | var styleProjection = $( settings.projectionStyleId ).get(0);
207 | var styleScreen = $( settings.screenStyleId ).get(0);
208 |
209 | if( !styleProjection.disabled )
210 | {
211 | styleProjection.disabled = true;
212 | styleScreen.disabled = false;
213 | settings.isProjection = false;
214 | $('.slide').each( function() { $(this).show(); } );
215 | }
216 | else
217 | {
218 | styleProjection.disabled = false;
219 | styleScreen.disabled = true;
220 | settings.isProjection = true;
221 | $('.slide').each( function(i) {
222 | if( i == (settings.snum-1) )
223 | $(this).show();
224 | else
225 | $(this).hide();
226 | });
227 | }
228 | }
229 |
230 | function populateJumpList() {
231 |
232 | var list = $('#jumplist').get(0);
233 |
234 | $( '.slide' ).each( function(i) {
235 | var text = $(this).find( settings.titleSelector ).text();
236 | list.options[list.length] = new Option( (i+1)+' : '+ text, (i+1) );
237 | });
238 | }
239 |
240 | function createControls()
241 | {
242 | // todo: make layout into an id (not class?)
243 | // do we need or allow more than one element?
244 |
245 |
246 | // if no div.layout exists, create one
247 | if( $( '.layout' ).length == 0 )
248 | $( "
").appendTo( 'body' );
249 |
250 | $( '.layout' )
251 | .append( "" )
252 | .append( "
" );
253 |
254 | var $controls = $( '#controls' )
255 |
256 | $controls.html( '
'
257 | + '
Ø<\/a>'
258 | + ' «<\/a>'
259 | + ' »<\/a>'
260 | + ' <\/div>'
261 | + '<\/div>' );
262 |
263 | $controls.hover( function() { showHide('s') }, function() { showHide('h') });
264 | $('#toggle').click( function() { toggle(); } );
265 | $('#prev').click( function() { go(-1); } );
266 | $('#next').click( function() { go(1); } );
267 |
268 | $('#jumplist').change( function() { goTo( parseInt( $( '#jumplist' ).val() )); } );
269 |
270 | populateJumpList();
271 | updateCurrentSlideCounter();
272 | updatePermaLink();
273 | }
274 |
275 | function toggleSlideNumber()
276 | {
277 | // toggle slide number/counter
278 | $( '#currentSlide' ).toggle();
279 | }
280 |
281 | function toggleFooter()
282 | {
283 | $( '#footer').toggle();
284 | }
285 |
286 |
287 | function keys(key)
288 | {
289 | if (!key) {
290 | key = event;
291 | key.which = key.keyCode;
292 | }
293 | if (key.which == 84) {
294 | toggle(); // toggle between project and screen css media mode
295 | return;
296 | }
297 | if( settings.isProjection ) {
298 | switch (key.which) {
299 | case 32: // spacebar
300 | case 34: // page down
301 | case 39: // rightkey
302 | case 40: // downkey
303 |
304 | var csteps = settings.steps[settings.snum-1]; /* current slide steps array */
305 |
306 | if ( !csteps || settings.incpos >= csteps.length ) {
307 | go(1);
308 | } else {
309 | subgo(1);
310 | }
311 | break;
312 | case 33: // page up
313 | case 37: // leftkey
314 | case 38: // upkey
315 |
316 | if( !settings.steps[settings.snum-1] || settings.incpos <= 0 ) {
317 | go(-1);
318 | } else {
319 | subgo(-1);
320 | }
321 | break;
322 | case 36: // home
323 | goTo(1);
324 | break;
325 | case 35: // end
326 | goTo(settings.smax);
327 | break;
328 | case 67: // c
329 | showHide('c'); // toggle controls (navlinks,navlist)
330 | break;
331 | case 65: //a
332 | case 80: //p
333 | case 83: //s
334 | toggleAutoplay();
335 | break;
336 | case 70: //f
337 | toggleFooter();
338 | break;
339 | case 78: // n
340 | toggleSlideNumber();
341 | break;
342 | case 68: // d
343 | toggleDebug();
344 | break;
345 | }
346 | }
347 | }
348 |
349 | function autoplay()
350 | {
351 | // suspend autoplay in outline view (just slideshow view)
352 | if( !settings.isProjection )
353 | return;
354 |
355 | // next slide/step, please
356 | var csteps = settings.steps[settings.snum-1]; // current slide steps array
357 | if( !csteps || settings.incpos >= csteps.length ) {
358 | if( settings.snum >= settings.smax )
359 | goTo( 1 ); // reached end of show? start with 1st slide again (for endless cycle)
360 | else
361 | go(1);
362 | }
363 | else {
364 | subgo(1);
365 | }
366 | }
367 |
368 | function toggleDebug()
369 | {
370 | settings.debug = !settings.debug;
371 | doDebug();
372 | }
373 |
374 | function doDebug()
375 | {
376 | // fix/todo: save background into oldbackground
377 | // so we can restore later
378 |
379 | if( settings.debug == true )
380 | {
381 | $( '#header' ).css( 'background', '#FCC' );
382 | $( '#footer' ).css( 'background', '#CCF' );
383 | $( '#controls' ).css( 'background', '#BBD' );
384 | $( '#currentSlide' ).css( 'background', '#FFC' );
385 | }
386 | else
387 | {
388 | $( '#header' ).css( 'background', 'transparent' );
389 | $( '#footer' ).css( 'background', 'transparent' );
390 | $( '#controls' ).css( 'background', 'transparent' );
391 | $( '#currentSlide' ).css( 'background', 'transparent' );
392 | }
393 | }
394 |
395 |
396 | function toggleAutoplay()
397 | {
398 | if( settings.autoplayInterval )
399 | {
400 | clearInterval( settings.autoplayInterval );
401 | settings.autoplayInterval = null;
402 | }
403 | else
404 | {
405 | settings.autoplayInterval = setInterval ( autoplay, 2000 );
406 | }
407 | }
408 |
409 |
410 |
411 | function collectStepsWorker(obj) {
412 |
413 | var steps = new Array();
414 | if( !obj )
415 | return steps;
416 |
417 | $(obj).children().each( function() {
418 | if( $(this).hasClass( 'step' ) ) {
419 |
420 | debug( 'step found for ' + this.tagName );
421 | $(this).removeClass( 'step' );
422 |
423 | /* don't add enclosing list; instead add step class to all list items/children */
424 | if( $(this).is( 'ol,ul' ) ) {
425 | debug( ' ol or ul found; adding auto steps' );
426 | $(this).children().addClass( 'step' );
427 | }
428 | else
429 | {
430 | steps.push( this )
431 | }
432 | }
433 |
434 | steps = steps.concat( collectStepsWorker(this) );
435 | });
436 |
437 | return steps;
438 | }
439 |
440 | function collectSteps() {
441 |
442 | var steps = new Array();
443 |
444 | $slides.each( function(i) {
445 | debug ( 'collectSteps for ' + this.id + ':' );
446 | steps[i] = collectStepsWorker( this );
447 | });
448 |
449 | $( steps ).each( function(i) {
450 | debug( 'slide ' + (i+1) + ': found ' + this.length + ' steps' );
451 | });
452 |
453 | return steps;
454 | }
455 |
456 |
457 | function addClicker() {
458 | // if you click on heading of slide -> go to next slide (or next step)
459 |
460 | $( settings.titleSelector, $slides ).click( function( ev ) {
461 | if(ev.which != 1) return; // only process left clicks (e.g 1; middle and rightclick use 2 and 3)
462 |
463 | if( !settings.isProjection ) // suspend clicker in outline view (just slideshow view)
464 | return;
465 |
466 | var csteps = settings.steps[settings.snum-1]; // current slide steps array
467 | if ( !csteps || settings.incpos >= csteps.length )
468 | go(1);
469 | else
470 | subgo(1);
471 | } );
472 |
473 |
474 | $( settings.titleSelector, $slides ).bind('contextmenu', function() {
475 | if( !settings.isProjection ) // suspend clicker in outline view (just slideshow view)
476 | return;
477 |
478 | var csteps = settings.steps[settings.snum-1]; // current slide steps array
479 | if ( !csteps || settings.incpos >= csteps.length )
480 | go(-1);
481 | else
482 | subgo(-1);
483 |
484 | return false;
485 | } );
486 | }
487 |
488 | function addSlideIds() {
489 | $slides.each( function(i) {
490 | this.id = 'slide'+(i+1);
491 | });
492 | }
493 |
494 | // init code here
495 |
496 | // store possible slidenumber from hash */
497 | // todo: use regex to extract number
498 | // might be #slide1 or just #1
499 |
500 | var gotoSlideNum = parseInt( window.location.hash.substring(1) );
501 | debug( "gotoSlideNum=" + gotoSlideNum );
502 |
503 | var $slides = $( '.slide' );
504 | settings.smax = $slides.length;
505 |
506 | addSlideIds();
507 | settings.steps = collectSteps();
508 |
509 | createControls();
510 |
511 | addClicker();
512 |
513 | /* opera is the only browser currently supporting css projection mode */
514 | /* if( !$.browser.opera ) */
515 | notOperaFix();
516 |
517 | if( !isNaN( gotoSlideNum ))
518 | {
519 | debug( "restoring slide on (re)load #: " + gotoSlideNum );
520 | goTo( gotoSlideNum );
521 | }
522 |
523 | if( settings.mode == 'outline' )
524 | toggle();
525 | else if( settings.mode == 'autoplay' )
526 | toggleAutoplay();
527 |
528 |
529 | if( settings.debug == true )
530 | doDebug();
531 |
532 | document.onkeyup = keys;
533 |
534 | } // end Slideshow
535 |
--------------------------------------------------------------------------------
/git-talk/js/impress.js:
--------------------------------------------------------------------------------
1 | /**
2 | * impress.js
3 | *
4 | * impress.js is a presentation tool based on the power of CSS3 transforms and transitions
5 | * in modern browsers and inspired by the idea behind prezi.com.
6 | *
7 | *
8 | * Copyright 2011-2012 Bartek Szopka (@bartaz)
9 | *
10 | * Released under the MIT and GPL Licenses.
11 | *
12 | * ------------------------------------------------
13 | * author: Bartek Szopka
14 | * version: 0.5.3
15 | * url: http://bartaz.github.com/impress.js/
16 | * source: http://github.com/bartaz/impress.js/
17 | */
18 |
19 | /*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, latedef:true, newcap:true,
20 | noarg:true, noempty:true, undef:true, strict:true, browser:true */
21 |
22 | // You are one of those who like to know how thing work inside?
23 | // Let me show you the cogs that make impress.js run...
24 | (function ( document, window ) {
25 | 'use strict';
26 |
27 | // HELPER FUNCTIONS
28 |
29 | // `pfx` is a function that takes a standard CSS property name as a parameter
30 | // and returns it's prefixed version valid for current browser it runs in.
31 | // The code is heavily inspired by Modernizr http://www.modernizr.com/
32 | var pfx = (function () {
33 |
34 | var style = document.createElement('dummy').style,
35 | prefixes = 'Webkit Moz O ms Khtml'.split(' '),
36 | memory = {};
37 |
38 | return function ( prop ) {
39 | if ( typeof memory[ prop ] === "undefined" ) {
40 |
41 | var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1),
42 | props = (prop + ' ' + prefixes.join(ucProp + ' ') + ucProp).split(' ');
43 |
44 | memory[ prop ] = null;
45 | for ( var i in props ) {
46 | if ( style[ props[i] ] !== undefined ) {
47 | memory[ prop ] = props[i];
48 | break;
49 | }
50 | }
51 |
52 | }
53 |
54 | return memory[ prop ];
55 | };
56 |
57 | })();
58 |
59 | // `arraify` takes an array-like object and turns it into real Array
60 | // to make all the Array.prototype goodness available.
61 | var arrayify = function ( a ) {
62 | return [].slice.call( a );
63 | };
64 |
65 | // `css` function applies the styles given in `props` object to the element
66 | // given as `el`. It runs all property names through `pfx` function to make
67 | // sure proper prefixed version of the property is used.
68 | var css = function ( el, props ) {
69 | var key, pkey;
70 | for ( key in props ) {
71 | if ( props.hasOwnProperty(key) ) {
72 | pkey = pfx(key);
73 | if ( pkey !== null ) {
74 | el.style[pkey] = props[key];
75 | }
76 | }
77 | }
78 | return el;
79 | };
80 |
81 | // `toNumber` takes a value given as `numeric` parameter and tries to turn
82 | // it into a number. If it is not possible it returns 0 (or other value
83 | // given as `fallback`).
84 | var toNumber = function (numeric, fallback) {
85 | return isNaN(numeric) ? (fallback || 0) : Number(numeric);
86 | };
87 |
88 | // `byId` returns element with given `id` - you probably have guessed that ;)
89 | var byId = function ( id ) {
90 | return document.getElementById(id);
91 | };
92 |
93 | // `$` returns first element for given CSS `selector` in the `context` of
94 | // the given element or whole document.
95 | var $ = function ( selector, context ) {
96 | context = context || document;
97 | return context.querySelector(selector);
98 | };
99 |
100 | // `$$` return an array of elements for given CSS `selector` in the `context` of
101 | // the given element or whole document.
102 | var $$ = function ( selector, context ) {
103 | context = context || document;
104 | return arrayify( context.querySelectorAll(selector) );
105 | };
106 |
107 | // `triggerEvent` builds a custom DOM event with given `eventName` and `detail` data
108 | // and triggers it on element given as `el`.
109 | var triggerEvent = function (el, eventName, detail) {
110 | var event = document.createEvent("CustomEvent");
111 | event.initCustomEvent(eventName, true, true, detail);
112 | el.dispatchEvent(event);
113 | };
114 |
115 | // `translate` builds a translate transform string for given data.
116 | var translate = function ( t ) {
117 | return " translate3d(" + t.x + "px," + t.y + "px," + t.z + "px) ";
118 | };
119 |
120 | // `rotate` builds a rotate transform string for given data.
121 | // By default the rotations are in X Y Z order that can be reverted by passing `true`
122 | // as second parameter.
123 | var rotate = function ( r, revert ) {
124 | var rX = " rotateX(" + r.x + "deg) ",
125 | rY = " rotateY(" + r.y + "deg) ",
126 | rZ = " rotateZ(" + r.z + "deg) ";
127 |
128 | return revert ? rZ+rY+rX : rX+rY+rZ;
129 | };
130 |
131 | // `scale` builds a scale transform string for given data.
132 | var scale = function ( s ) {
133 | return " scale(" + s + ") ";
134 | };
135 |
136 | // `perspective` builds a perspective transform string for given data.
137 | var perspective = function ( p ) {
138 | return " perspective(" + p + "px) ";
139 | };
140 |
141 | // `getElementFromHash` returns an element located by id from hash part of
142 | // window location.
143 | var getElementFromHash = function () {
144 | // get id from url # by removing `#` or `#/` from the beginning,
145 | // so both "fallback" `#slide-id` and "enhanced" `#/slide-id` will work
146 | return byId( window.location.hash.replace(/^#\/?/,"") );
147 | };
148 |
149 | // `computeWindowScale` counts the scale factor between window size and size
150 | // defined for the presentation in the config.
151 | var computeWindowScale = function ( config ) {
152 | var hScale = window.innerHeight / config.height,
153 | wScale = window.innerWidth / config.width,
154 | scale = hScale > wScale ? wScale : hScale;
155 |
156 | if (config.maxScale && scale > config.maxScale) {
157 | scale = config.maxScale;
158 | }
159 |
160 | if (config.minScale && scale < config.minScale) {
161 | scale = config.minScale;
162 | }
163 |
164 | return scale;
165 | };
166 |
167 | // CHECK SUPPORT
168 | var body = document.body;
169 |
170 | var ua = navigator.userAgent.toLowerCase();
171 | var impressSupported =
172 | // browser should support CSS 3D transtorms
173 | ( pfx("perspective") !== null ) &&
174 |
175 | // and `classList` and `dataset` APIs
176 | ( body.classList ) &&
177 | ( body.dataset ) &&
178 |
179 | // but some mobile devices need to be blacklisted,
180 | // because their CSS 3D support or hardware is not
181 | // good enough to run impress.js properly, sorry...
182 | ( ua.search(/(iphone)|(ipod)|(android)/) === -1 );
183 |
184 | if (!impressSupported) {
185 | // we can't be sure that `classList` is supported
186 | body.className += " impress-not-supported ";
187 | } else {
188 | body.classList.remove("impress-not-supported");
189 | body.classList.add("impress-supported");
190 | }
191 |
192 | // GLOBALS AND DEFAULTS
193 |
194 | // This is were the root elements of all impress.js instances will be kept.
195 | // Yes, this means you can have more than one instance on a page, but I'm not
196 | // sure if it makes any sense in practice ;)
197 | var roots = {};
198 |
199 | // some default config values.
200 | var defaults = {
201 | width: 1024,
202 | height: 768,
203 | maxScale: 1,
204 | minScale: 0,
205 |
206 | perspective: 1000,
207 |
208 | transitionDuration: 1000
209 | };
210 |
211 | // it's just an empty function ... and a useless comment.
212 | var empty = function () { return false; };
213 |
214 | // IMPRESS.JS API
215 |
216 | // And that's where interesting things will start to happen.
217 | // It's the core `impress` function that returns the impress.js API
218 | // for a presentation based on the element with given id ('impress'
219 | // by default).
220 | var impress = window.impress = function ( rootId ) {
221 |
222 | // If impress.js is not supported by the browser return a dummy API
223 | // it may not be a perfect solution but we return early and avoid
224 | // running code that may use features not implemented in the browser.
225 | if (!impressSupported) {
226 | return {
227 | init: empty,
228 | goto: empty,
229 | prev: empty,
230 | next: empty
231 | };
232 | }
233 |
234 | rootId = rootId || "impress";
235 |
236 | // if given root is already initialized just return the API
237 | if (roots["impress-root-" + rootId]) {
238 | return roots["impress-root-" + rootId];
239 | }
240 |
241 | // data of all presentation steps
242 | var stepsData = {};
243 |
244 | // element of currently active step
245 | var activeStep = null;
246 |
247 | // current state (position, rotation and scale) of the presentation
248 | var currentState = null;
249 |
250 | // array of step elements
251 | var steps = null;
252 |
253 | // configuration options
254 | var config = null;
255 |
256 | // scale factor of the browser window
257 | var windowScale = null;
258 |
259 | // root presentation elements
260 | var root = byId( rootId );
261 | var canvas = document.createElement("div");
262 |
263 | var initialized = false;
264 |
265 | // STEP EVENTS
266 | //
267 | // There are currently two step events triggered by impress.js
268 | // `impress:stepenter` is triggered when the step is shown on the
269 | // screen (the transition from the previous one is finished) and
270 | // `impress:stepleave` is triggered when the step is left (the
271 | // transition to next step just starts).
272 |
273 | // reference to last entered step
274 | var lastEntered = null;
275 |
276 | // `onStepEnter` is called whenever the step element is entered
277 | // but the event is triggered only if the step is different than
278 | // last entered step.
279 | var onStepEnter = function (step) {
280 | if (lastEntered !== step) {
281 | triggerEvent(step, "impress:stepenter");
282 | lastEntered = step;
283 | }
284 | };
285 |
286 | // `onStepLeave` is called whenever the step element is left
287 | // but the event is triggered only if the step is the same as
288 | // last entered step.
289 | var onStepLeave = function (step) {
290 | if (lastEntered === step) {
291 | triggerEvent(step, "impress:stepleave");
292 | lastEntered = null;
293 | }
294 | };
295 |
296 | // `initStep` initializes given step element by reading data from its
297 | // data attributes and setting correct styles.
298 | var initStep = function ( el, idx ) {
299 | var data = el.dataset,
300 | step = {
301 | translate: {
302 | x: toNumber(data.x),
303 | y: toNumber(data.y),
304 | z: toNumber(data.z)
305 | },
306 | rotate: {
307 | x: toNumber(data.rotateX),
308 | y: toNumber(data.rotateY),
309 | z: toNumber(data.rotateZ || data.rotate)
310 | },
311 | scale: toNumber(data.scale, 1),
312 | el: el
313 | };
314 |
315 | if ( !el.id ) {
316 | el.id = "step-" + (idx + 1);
317 | }
318 |
319 | stepsData["impress-" + el.id] = step;
320 |
321 | css(el, {
322 | position: "absolute",
323 | transform: "translate(-50%,-50%)" +
324 | translate(step.translate) +
325 | rotate(step.rotate) +
326 | scale(step.scale),
327 | transformStyle: "preserve-3d"
328 | });
329 | };
330 |
331 | // `init` API function that initializes (and runs) the presentation.
332 | var init = function () {
333 | if (initialized) { return; }
334 |
335 | // First we set up the viewport for mobile devices.
336 | // For some reason iPad goes nuts when it is not done properly.
337 | var meta = $("meta[name='viewport']") || document.createElement("meta");
338 | meta.content = "width=device-width, minimum-scale=1, maximum-scale=1, user-scalable=no";
339 | if (meta.parentNode !== document.head) {
340 | meta.name = 'viewport';
341 | document.head.appendChild(meta);
342 | }
343 |
344 | // initialize configuration object
345 | var rootData = root.dataset;
346 | config = {
347 | width: toNumber( rootData.width, defaults.width ),
348 | height: toNumber( rootData.height, defaults.height ),
349 | maxScale: toNumber( rootData.maxScale, defaults.maxScale ),
350 | minScale: toNumber( rootData.minScale, defaults.minScale ),
351 | perspective: toNumber( rootData.perspective, defaults.perspective ),
352 | transitionDuration: toNumber( rootData.transitionDuration, defaults.transitionDuration )
353 | };
354 |
355 | windowScale = computeWindowScale( config );
356 |
357 | // wrap steps with "canvas" element
358 | arrayify( root.childNodes ).forEach(function ( el ) {
359 | canvas.appendChild( el );
360 | });
361 | root.appendChild(canvas);
362 |
363 | // set initial styles
364 | document.documentElement.style.height = "100%";
365 |
366 | css(body, {
367 | height: "100%",
368 | overflow: "hidden"
369 | });
370 |
371 | var rootStyles = {
372 | position: "absolute",
373 | transformOrigin: "top left",
374 | transition: "all 0s ease-in-out",
375 | transformStyle: "preserve-3d"
376 | };
377 |
378 | css(root, rootStyles);
379 | css(root, {
380 | top: "50%",
381 | left: "50%",
382 | transform: perspective( config.perspective/windowScale ) + scale( windowScale )
383 | });
384 | css(canvas, rootStyles);
385 |
386 | body.classList.remove("impress-disabled");
387 | body.classList.add("impress-enabled");
388 |
389 | // get and init steps
390 | steps = $$(".step", root);
391 | steps.forEach( initStep );
392 |
393 | // set a default initial state of the canvas
394 | currentState = {
395 | translate: { x: 0, y: 0, z: 0 },
396 | rotate: { x: 0, y: 0, z: 0 },
397 | scale: 1
398 | };
399 |
400 | initialized = true;
401 |
402 | triggerEvent(root, "impress:init", { api: roots[ "impress-root-" + rootId ] });
403 | };
404 |
405 | // `getStep` is a helper function that returns a step element defined by parameter.
406 | // If a number is given, step with index given by the number is returned, if a string
407 | // is given step element with such id is returned, if DOM element is given it is returned
408 | // if it is a correct step element.
409 | var getStep = function ( step ) {
410 | if (typeof step === "number") {
411 | step = step < 0 ? steps[ steps.length + step] : steps[ step ];
412 | } else if (typeof step === "string") {
413 | step = byId(step);
414 | }
415 | return (step && step.id && stepsData["impress-" + step.id]) ? step : null;
416 | };
417 |
418 | // used to reset timeout for `impress:stepenter` event
419 | var stepEnterTimeout = null;
420 |
421 | // `goto` API function that moves to step given with `el` parameter (by index, id or element),
422 | // with a transition `duration` optionally given as second parameter.
423 | var goto = function ( el, duration ) {
424 |
425 | if ( !initialized || !(el = getStep(el)) ) {
426 | // presentation not initialized or given element is not a step
427 | return false;
428 | }
429 |
430 | // Sometimes it's possible to trigger focus on first link with some keyboard action.
431 | // Browser in such a case tries to scroll the page to make this element visible
432 | // (even that body overflow is set to hidden) and it breaks our careful positioning.
433 | //
434 | // So, as a lousy (and lazy) workaround we will make the page scroll back to the top
435 | // whenever slide is selected
436 | //
437 | // If you are reading this and know any better way to handle it, I'll be glad to hear about it!
438 | window.scrollTo(0, 0);
439 |
440 | var step = stepsData["impress-" + el.id];
441 |
442 | if ( activeStep ) {
443 | activeStep.classList.remove("active");
444 | body.classList.remove("impress-on-" + activeStep.id);
445 | }
446 | el.classList.add("active");
447 |
448 | body.classList.add("impress-on-" + el.id);
449 |
450 | // compute target state of the canvas based on given step
451 | var target = {
452 | rotate: {
453 | x: -step.rotate.x,
454 | y: -step.rotate.y,
455 | z: -step.rotate.z
456 | },
457 | translate: {
458 | x: -step.translate.x,
459 | y: -step.translate.y,
460 | z: -step.translate.z
461 | },
462 | scale: 1 / step.scale
463 | };
464 |
465 | // Check if the transition is zooming in or not.
466 | //
467 | // This information is used to alter the transition style:
468 | // when we are zooming in - we start with move and rotate transition
469 | // and the scaling is delayed, but when we are zooming out we start
470 | // with scaling down and move and rotation are delayed.
471 | var zoomin = target.scale >= currentState.scale;
472 |
473 | duration = toNumber(duration, config.transitionDuration);
474 | var delay = (duration / 2);
475 |
476 | // if the same step is re-selected, force computing window scaling,
477 | // because it is likely to be caused by window resize
478 | if (el === activeStep) {
479 | windowScale = computeWindowScale(config);
480 | }
481 |
482 | var targetScale = target.scale * windowScale;
483 |
484 | // trigger leave of currently active element (if it's not the same step again)
485 | if (activeStep && activeStep !== el) {
486 | onStepLeave(activeStep);
487 | }
488 |
489 | // Now we alter transforms of `root` and `canvas` to trigger transitions.
490 | //
491 | // And here is why there are two elements: `root` and `canvas` - they are
492 | // being animated separately:
493 | // `root` is used for scaling and `canvas` for translate and rotations.
494 | // Transitions on them are triggered with different delays (to make
495 | // visually nice and 'natural' looking transitions), so we need to know
496 | // that both of them are finished.
497 | css(root, {
498 | // to keep the perspective look similar for different scales
499 | // we need to 'scale' the perspective, too
500 | transform: perspective( config.perspective / targetScale ) + scale( targetScale ),
501 | transitionDuration: duration + "ms",
502 | transitionDelay: (zoomin ? delay : 0) + "ms"
503 | });
504 |
505 | css(canvas, {
506 | transform: rotate(target.rotate, true) + translate(target.translate),
507 | transitionDuration: duration + "ms",
508 | transitionDelay: (zoomin ? 0 : delay) + "ms"
509 | });
510 |
511 | // Here is a tricky part...
512 | //
513 | // If there is no change in scale or no change in rotation and translation, it means there was actually
514 | // no delay - because there was no transition on `root` or `canvas` elements.
515 | // We want to trigger `impress:stepenter` event in the correct moment, so here we compare the current
516 | // and target values to check if delay should be taken into account.
517 | //
518 | // I know that this `if` statement looks scary, but it's pretty simple when you know what is going on
519 | // - it's simply comparing all the values.
520 | if ( currentState.scale === target.scale ||
521 | (currentState.rotate.x === target.rotate.x && currentState.rotate.y === target.rotate.y &&
522 | currentState.rotate.z === target.rotate.z && currentState.translate.x === target.translate.x &&
523 | currentState.translate.y === target.translate.y && currentState.translate.z === target.translate.z) ) {
524 | delay = 0;
525 | }
526 |
527 | // store current state
528 | currentState = target;
529 | activeStep = el;
530 |
531 | // And here is where we trigger `impress:stepenter` event.
532 | // We simply set up a timeout to fire it taking transition duration (and possible delay) into account.
533 | //
534 | // I really wanted to make it in more elegant way. The `transitionend` event seemed to be the best way
535 | // to do it, but the fact that I'm using transitions on two separate elements and that the `transitionend`
536 | // event is only triggered when there was a transition (change in the values) caused some bugs and
537 | // made the code really complicated, cause I had to handle all the conditions separately. And it still
538 | // needed a `setTimeout` fallback for the situations when there is no transition at all.
539 | // So I decided that I'd rather make the code simpler than use shiny new `transitionend`.
540 | //
541 | // If you want learn something interesting and see how it was done with `transitionend` go back to
542 | // version 0.5.2 of impress.js: http://github.com/bartaz/impress.js/blob/0.5.2/js/impress.js
543 | window.clearTimeout(stepEnterTimeout);
544 | stepEnterTimeout = window.setTimeout(function() {
545 | onStepEnter(activeStep);
546 | }, duration + delay);
547 |
548 | return el;
549 | };
550 |
551 | // `prev` API function goes to previous step (in document order)
552 | var prev = function () {
553 | var prev = steps.indexOf( activeStep ) - 1;
554 | prev = prev >= 0 ? steps[ prev ] : steps[ steps.length-1 ];
555 |
556 | return goto(prev);
557 | };
558 |
559 | // `next` API function goes to next step (in document order)
560 | var next = function () {
561 | var next = steps.indexOf( activeStep ) + 1;
562 | next = next < steps.length ? steps[ next ] : steps[ 0 ];
563 |
564 | return goto(next);
565 | };
566 |
567 | // Adding some useful classes to step elements.
568 | //
569 | // All the steps that have not been shown yet are given `future` class.
570 | // When the step is entered the `future` class is removed and the `present`
571 | // class is given. When the step is left `present` class is replaced with
572 | // `past` class.
573 | //
574 | // So every step element is always in one of three possible states:
575 | // `future`, `present` and `past`.
576 | //
577 | // There classes can be used in CSS to style different types of steps.
578 | // For example the `present` class can be used to trigger some custom
579 | // animations when step is shown.
580 | root.addEventListener("impress:init", function(){
581 | // STEP CLASSES
582 | steps.forEach(function (step) {
583 | step.classList.add("future");
584 | });
585 |
586 | root.addEventListener("impress:stepenter", function (event) {
587 | event.target.classList.remove("past");
588 | event.target.classList.remove("future");
589 | event.target.classList.add("present");
590 | }, false);
591 |
592 | root.addEventListener("impress:stepleave", function (event) {
593 | event.target.classList.remove("present");
594 | event.target.classList.add("past");
595 | }, false);
596 |
597 | }, false);
598 |
599 | // Adding hash change support.
600 | root.addEventListener("impress:init", function(){
601 |
602 | // last hash detected
603 | var lastHash = "";
604 |
605 | // `#/step-id` is used instead of `#step-id` to prevent default browser
606 | // scrolling to element in hash.
607 | //
608 | // And it has to be set after animation finishes, because in Chrome it
609 | // makes transtion laggy.
610 | // BUG: http://code.google.com/p/chromium/issues/detail?id=62820
611 | root.addEventListener("impress:stepenter", function (event) {
612 | window.location.hash = lastHash = "#/" + event.target.id;
613 | }, false);
614 |
615 | window.addEventListener("hashchange", function () {
616 | // When the step is entered hash in the location is updated
617 | // (just few lines above from here), so the hash change is
618 | // triggered and we would call `goto` again on the same element.
619 | //
620 | // To avoid this we store last entered hash and compare.
621 | if (window.location.hash !== lastHash) {
622 | goto( getElementFromHash() );
623 | }
624 | }, false);
625 |
626 | // START
627 | // by selecting step defined in url or first step of the presentation
628 | goto(getElementFromHash() || steps[0], 0);
629 | }, false);
630 |
631 | body.classList.add("impress-disabled");
632 |
633 | // store and return API for given impress.js root element
634 | return (roots[ "impress-root-" + rootId ] = {
635 | init: init,
636 | goto: goto,
637 | next: next,
638 | prev: prev
639 | });
640 |
641 | };
642 |
643 | // flag that can be used in JS to check if browser have passed the support test
644 | impress.supported = impressSupported;
645 |
646 | })(document, window);
647 |
648 | // NAVIGATION EVENTS
649 |
650 | // As you can see this part is separate from the impress.js core code.
651 | // It's because these navigation actions only need what impress.js provides with
652 | // its simple API.
653 | //
654 | // In future I think about moving it to make them optional, move to separate files
655 | // and treat more like a 'plugins'.
656 | (function ( document, window ) {
657 | 'use strict';
658 |
659 | // throttling function calls, by Remy Sharp
660 | // http://remysharp.com/2010/07/21/throttling-function-calls/
661 | var throttle = function (fn, delay) {
662 | var timer = null;
663 | return function () {
664 | var context = this, args = arguments;
665 | clearTimeout(timer);
666 | timer = setTimeout(function () {
667 | fn.apply(context, args);
668 | }, delay);
669 | };
670 | };
671 |
672 | // wait for impress.js to be initialized
673 | document.addEventListener("impress:init", function (event) {
674 | // Getting API from event data.
675 | // So you don't event need to know what is the id of the root element
676 | // or anything. `impress:init` event data gives you everything you
677 | // need to control the presentation that was just initialized.
678 | var api = event.detail.api;
679 |
680 | // KEYBOARD NAVIGATION HANDLERS
681 |
682 | // Prevent default keydown action when one of supported key is pressed.
683 | document.addEventListener("keydown", function ( event ) {
684 | if ( event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) {
685 | event.preventDefault();
686 | }
687 | }, false);
688 |
689 | // Trigger impress action (next or prev) on keyup.
690 |
691 | // Supported keys are:
692 | // [space] - quite common in presentation software to move forward
693 | // [up] [right] / [down] [left] - again common and natural addition,
694 | // [pgdown] / [pgup] - often triggered by remote controllers,
695 | // [tab] - this one is quite controversial, but the reason it ended up on
696 | // this list is quite an interesting story... Remember that strange part
697 | // in the impress.js code where window is scrolled to 0,0 on every presentation
698 | // step, because sometimes browser scrolls viewport because of the focused element?
699 | // Well, the [tab] key by default navigates around focusable elements, so clicking
700 | // it very often caused scrolling to focused element and breaking impress.js
701 | // positioning. I didn't want to just prevent this default action, so I used [tab]
702 | // as another way to moving to next step... And yes, I know that for the sake of
703 | // consistency I should add [shift+tab] as opposite action...
704 | document.addEventListener("keyup", function ( event ) {
705 | if ( event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) {
706 | switch( event.keyCode ) {
707 | case 33: // pg up
708 | case 37: // left
709 | case 38: // up
710 | api.prev();
711 | break;
712 | case 9: // tab
713 | case 32: // space
714 | case 34: // pg down
715 | case 39: // right
716 | case 40: // down
717 | api.next();
718 | break;
719 | }
720 |
721 | event.preventDefault();
722 | }
723 | }, false);
724 |
725 | // delegated handler for clicking on the links to presentation steps
726 | document.addEventListener("click", function ( event ) {
727 | // event delegation with "bubbling"
728 | // check if event target (or any of its parents is a link)
729 | var target = event.target;
730 | while ( (target.tagName !== "A") &&
731 | (target !== document.documentElement) ) {
732 | target = target.parentNode;
733 | }
734 |
735 | if ( target.tagName === "A" ) {
736 | var href = target.getAttribute("href");
737 |
738 | // if it's a link to presentation step, target this step
739 | if ( href && href[0] === '#' ) {
740 | target = document.getElementById( href.slice(1) );
741 | }
742 | }
743 |
744 | if ( api.goto(target) ) {
745 | event.stopImmediatePropagation();
746 | event.preventDefault();
747 | }
748 | }, false);
749 |
750 | // delegated handler for clicking on step elements
751 | document.addEventListener("click", function ( event ) {
752 | var target = event.target;
753 | // find closest step element that is not active
754 | while ( !(target.classList.contains("step") && !target.classList.contains("active")) &&
755 | (target !== document.documentElement) ) {
756 | target = target.parentNode;
757 | }
758 |
759 | if ( api.goto(target) ) {
760 | event.preventDefault();
761 | }
762 | }, false);
763 |
764 | // touch handler to detect taps on the left and right side of the screen
765 | // based on awesome work of @hakimel: https://github.com/hakimel/reveal.js
766 | document.addEventListener("touchstart", function ( event ) {
767 | if (event.touches.length === 1) {
768 | var x = event.touches[0].clientX,
769 | width = window.innerWidth * 0.3,
770 | result = null;
771 |
772 | if ( x < width ) {
773 | result = api.prev();
774 | } else if ( x > window.innerWidth - width ) {
775 | result = api.next();
776 | }
777 |
778 | if (result) {
779 | event.preventDefault();
780 | }
781 | }
782 | }, false);
783 |
784 | // rescale presentation when window is resized
785 | window.addEventListener("resize", throttle(function () {
786 | // force going to active step again, to trigger rescaling
787 | api.goto( document.querySelector(".active"), 500 );
788 | }, 250), false);
789 |
790 | }, false);
791 |
792 | })(document, window);
793 |
794 | // THAT'S ALL FOLKS!
795 | //
796 | // Thanks for reading it all.
797 | // Or thanks for scrolling down and reading the last part.
798 | //
799 | // I've learnt a lot when building impress.js and I hope this code and comments
800 | // will help somebody learn at least some part of it.
--------------------------------------------------------------------------------