... | ... |
@@ -4,10 +4,10 @@ require "stringex" |
4 | 4 |
|
5 | 5 |
## -- Rsync Deploy config -- ## |
6 | 6 |
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file |
7 |
-ssh_user = "user@domain.com" |
|
7 |
+ssh_user = "deployer@cinan.remote" |
|
8 | 8 |
ssh_port = "22" |
9 |
-document_root = "~/website.com/" |
|
10 |
-rsync_delete = false |
|
9 |
+document_root = "/srv/http/blog.cinan.sk/" |
|
10 |
+rsync_delete = true |
|
11 | 11 |
rsync_args = "" # Any extra arguments to pass to rsync |
12 | 12 |
deploy_default = "rsync" |
13 | 13 |
|
... | ... |
@@ -25,7 +25,7 @@ posts_dir = "_posts" # directory for blog files |
25 | 25 |
themes_dir = ".themes" # directory for blog files |
26 | 26 |
new_post_ext = "markdown" # default new post file extension when using the new_post task |
27 | 27 |
new_page_ext = "markdown" # default new page file extension when using the new_page task |
28 |
-server_port = "4000" # port for preview server eg. localhost:4000 |
|
28 |
+server_port = "80" # port for preview server eg. localhost:4000 |
|
29 | 29 |
|
30 | 30 |
|
31 | 31 |
desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]" |
0 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,192 @@ |
0 |
+$max-width: 1200px !default; |
|
1 |
+ |
|
2 |
+// Padding used for layout margins |
|
3 |
+$pad-min: 18px !default; |
|
4 |
+$pad-narrow: 25px !default; |
|
5 |
+$pad-medium: 35px !default; |
|
6 |
+$pad-wide: 55px !default; |
|
7 |
+ |
|
8 |
+// Sidebar widths used in media queries |
|
9 |
+$sidebar-width-medium: 240px !default; |
|
10 |
+$sidebar-pad-medium: 15px !default; |
|
11 |
+$sidebar-pad-wide: 20px !default; |
|
12 |
+$sidebar-width-wide: 300px !default; |
|
13 |
+ |
|
14 |
+$indented-lists: false !default; |
|
15 |
+ |
|
16 |
+$header-font-size: 1em !default; |
|
17 |
+$header-padding-top: 1.5em !default; |
|
18 |
+$header-padding-bottom: 1.5em !default; |
|
19 |
+ |
|
20 |
+.group { @include pie-clearfix; } |
|
21 |
+ |
|
22 |
+@mixin collapse-sidebar { |
|
23 |
+ float: none; |
|
24 |
+ width: auto; |
|
25 |
+ clear: left; |
|
26 |
+ margin: 0; |
|
27 |
+ padding: 0 $pad-medium 1px; |
|
28 |
+ background-color: lighten($sidebar-bg, 2); |
|
29 |
+ border-top: 1px solid lighten($sidebar-border, 4); |
|
30 |
+ section { |
|
31 |
+ &.odd, &.even { float: left; width: 48%; } |
|
32 |
+ &.odd { margin-left: 0; } |
|
33 |
+ &.even { margin-left: 4%; } |
|
34 |
+ } |
|
35 |
+ &.thirds section { |
|
36 |
+ width: 30%; |
|
37 |
+ margin-left: 5%; |
|
38 |
+ &.first { |
|
39 |
+ margin-left: 0; |
|
40 |
+ clear: both; |
|
41 |
+ } |
|
42 |
+ } |
|
43 |
+} |
|
44 |
+ |
|
45 |
+body { |
|
46 |
+ -webkit-text-size-adjust: none; |
|
47 |
+ max-width: $max-width; |
|
48 |
+ position: relative; |
|
49 |
+ margin: 0 auto; |
|
50 |
+ > header, > nav, > footer, #content > article, #content > div > article, #content > div > section { |
|
51 |
+ @extend .group; |
|
52 |
+ padding-left: $pad-min; |
|
53 |
+ padding-right: $pad-min; |
|
54 |
+ @media only screen and (min-width: 480px) { |
|
55 |
+ padding-left: $pad-narrow; |
|
56 |
+ padding-right: $pad-narrow; |
|
57 |
+ } |
|
58 |
+ @media only screen and (min-width: 768px) { |
|
59 |
+ padding-left: $pad-medium; |
|
60 |
+ padding-right: $pad-medium; |
|
61 |
+ } |
|
62 |
+ @media only screen and (min-width: 992px) { |
|
63 |
+ padding-left: $pad-wide; |
|
64 |
+ padding-right: $pad-wide; |
|
65 |
+ } |
|
66 |
+ } |
|
67 |
+ div.pagination { |
|
68 |
+ @extend .group; |
|
69 |
+ margin-left: $pad-min; |
|
70 |
+ margin-right: $pad-min; |
|
71 |
+ @media only screen and (min-width: 480px) { |
|
72 |
+ margin-left: $pad-narrow; |
|
73 |
+ margin-right: $pad-narrow; |
|
74 |
+ } |
|
75 |
+ @media only screen and (min-width: 768px) { |
|
76 |
+ margin-left: $pad-medium; |
|
77 |
+ margin-right: $pad-medium; |
|
78 |
+ } |
|
79 |
+ @media only screen and (min-width: 992px) { |
|
80 |
+ margin-left: $pad-wide; |
|
81 |
+ margin-right: $pad-wide; |
|
82 |
+ } |
|
83 |
+ } |
|
84 |
+ > header { |
|
85 |
+ font-size: $header-font-size; |
|
86 |
+ padding-top: $header-padding-top; |
|
87 |
+ padding-bottom: $header-padding-bottom; |
|
88 |
+ } |
|
89 |
+} |
|
90 |
+ |
|
91 |
+#content { |
|
92 |
+ overflow: hidden; |
|
93 |
+ > div, > article { width: 100%; } |
|
94 |
+} |
|
95 |
+ |
|
96 |
+aside.sidebar { |
|
97 |
+ float: none; |
|
98 |
+ padding: 0 $pad-min 1px; |
|
99 |
+ background-color: lighten($sidebar-bg, 2); |
|
100 |
+ border-top: 1px solid $sidebar-border; |
|
101 |
+ @extend .group; |
|
102 |
+} |
|
103 |
+ |
|
104 |
+.flex-content { max-width: 100%; height: auto; } |
|
105 |
+ |
|
106 |
+.basic-alignment { |
|
107 |
+ &.left { float: left; margin-right: 1.5em; } |
|
108 |
+ &.right { float: right; margin-left: 1.5em; } |
|
109 |
+ &.center { display:block; margin: 0 auto 1.5em; } |
|
110 |
+ &.left, &.right { margin-bottom: .8em; } |
|
111 |
+} |
|
112 |
+ |
|
113 |
+.toggle-sidebar { &, .no-sidebar & { display: none; }} |
|
114 |
+ |
|
115 |
+body.sidebar-footer { |
|
116 |
+ @media only screen and (min-width: 750px) { |
|
117 |
+ aside.sidebar{ @include collapse-sidebar; } |
|
118 |
+ } |
|
119 |
+ #content { margin-right: 0px; } |
|
120 |
+ .toggle-sidebar { display: none; } |
|
121 |
+} |
|
122 |
+ |
|
123 |
+@media only screen and (min-width: 550px) { |
|
124 |
+ body > header { font-size: $header-font-size; } |
|
125 |
+} |
|
126 |
+@media only screen and (min-width: 750px) { |
|
127 |
+ aside.sidebar { @include collapse-sidebar; } |
|
128 |
+} |
|
129 |
+#main, #content, .sidebar { |
|
130 |
+ @extend .group; |
|
131 |
+} |
|
132 |
+@media only screen and (min-width: 768px) { |
|
133 |
+ body { -webkit-text-size-adjust: auto; } |
|
134 |
+ body > header { font-size: $header-font-size * 1.2; } |
|
135 |
+ #main { |
|
136 |
+ padding: 0; |
|
137 |
+ margin: 0 auto; |
|
138 |
+ } |
|
139 |
+ #content { |
|
140 |
+ overflow: visible; |
|
141 |
+ margin-right: $sidebar-width-medium; |
|
142 |
+ position: relative; |
|
143 |
+ .no-sidebar & { margin-right: 0; border-right: 0; } |
|
144 |
+ .collapse-sidebar & { margin-right: 20px; } |
|
145 |
+ > div, > article { |
|
146 |
+ padding-top: $pad-medium/2; |
|
147 |
+ padding-bottom: $pad-medium/2; |
|
148 |
+ float: left; |
|
149 |
+ } |
|
150 |
+ } |
|
151 |
+ aside.sidebar { |
|
152 |
+ width: $sidebar-width-medium - $sidebar-pad-medium*2; |
|
153 |
+ padding: 0 $sidebar-pad-medium $sidebar-pad-medium; |
|
154 |
+ background: none; |
|
155 |
+ clear: none; |
|
156 |
+ float: left; |
|
157 |
+ margin: 0 -100% 0 0; |
|
158 |
+ section { |
|
159 |
+ width: auto; margin-left: 0; |
|
160 |
+ &.odd, &.even { float: none; width: auto; margin-left: 0; } |
|
161 |
+ } |
|
162 |
+ .collapse-sidebar & { |
|
163 |
+ @include collapse-sidebar; |
|
164 |
+ } |
|
165 |
+ } |
|
166 |
+} |
|
167 |
+ |
|
168 |
+@media only screen and (min-width: 992px) { |
|
169 |
+ body > header { font-size: $header-font-size * 1.3; } |
|
170 |
+ #content { margin-right: $sidebar-width-wide; } |
|
171 |
+ #content { |
|
172 |
+ > div, > article { |
|
173 |
+ padding-top: $pad-wide/2; |
|
174 |
+ padding-bottom: $pad-wide/2; |
|
175 |
+ } |
|
176 |
+ } |
|
177 |
+ aside.sidebar { |
|
178 |
+ width: $sidebar-width-wide - $sidebar-pad-wide*2; |
|
179 |
+ padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide; |
|
180 |
+ .collapse-sidebar & { |
|
181 |
+ padding: { left: $pad-wide; right: $pad-wide; } |
|
182 |
+ } |
|
183 |
+ } |
|
184 |
+} |
|
185 |
+ |
|
186 |
+@if $indented-lists == false { |
|
187 |
+ @media only screen and (min-width: 768px) { |
|
188 |
+ ul, ol { margin-left: 0; } |
|
189 |
+ } |
|
190 |
+} |
|
191 |
+ |
0 | 192 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,46 @@ |
0 |
+$base03: #002b36 !default; //darkest blue |
|
1 |
+$base02: #073642 !default; //dark blue |
|
2 |
+$base01: #586e75 !default; //darkest gray |
|
3 |
+$base00: #657b83 !default; //dark gray |
|
4 |
+$base0: #839496 !default; //medium gray |
|
5 |
+$base1: #93a1a1 !default; //medium light gray |
|
6 |
+$base2: #eee8d5 !default; //cream |
|
7 |
+$base3: #fdf6e3 !default; //white |
|
8 |
+$solar-yellow: #b58900 !default; |
|
9 |
+$solar-orange: #cb4b16 !default; |
|
10 |
+$solar-red: #dc322f !default; |
|
11 |
+$solar-magenta: #d33682 !default; |
|
12 |
+$solar-violet: #6c71c4 !default; |
|
13 |
+$solar-blue: #268bd2 !default; |
|
14 |
+$solar-cyan: #2aa198 !default; |
|
15 |
+$solar-green: #859900 !default; |
|
16 |
+ |
|
17 |
+$solarized: dark !default; |
|
18 |
+ |
|
19 |
+@if $solarized == light { |
|
20 |
+ |
|
21 |
+ $_base03: $base03; |
|
22 |
+ $_base02: $base02; |
|
23 |
+ $_base01: $base01; |
|
24 |
+ $_base00: $base00; |
|
25 |
+ $_base0: $base0; |
|
26 |
+ $_base1: $base1; |
|
27 |
+ $_base2: $base2; |
|
28 |
+ $_base3: $base3; |
|
29 |
+ |
|
30 |
+ $base03: $_base3; |
|
31 |
+ $base02: $_base2; |
|
32 |
+ $base01: $_base1; |
|
33 |
+ $base00: $_base0; |
|
34 |
+ $base0: $_base00; |
|
35 |
+ $base1: $_base01; |
|
36 |
+ $base2: $_base02; |
|
37 |
+ $base3: $_base03; |
|
38 |
+} |
|
39 |
+ |
|
40 |
+/* non highlighted code colors */ |
|
41 |
+$pre-bg: $base03 !default; |
|
42 |
+$pre-border: darken($base02, 5) !default; |
|
43 |
+$pre-color: $base1 !default; |
|
44 |
+ |
|
45 |
+ |
0 | 46 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,86 @@ |
0 |
+$noise-bg: image-url('noise.png') top left !default; |
|
1 |
+$img-border: inline-image('dotted-border.png'); |
|
2 |
+ |
|
3 |
+// Main Link Colors |
|
4 |
+$link-color: lighten(#165b94, 3) !default; |
|
5 |
+$link-color-hover: adjust-color($link-color, $lightness: 10, $saturation: 25) !default; |
|
6 |
+$link-color-visited: adjust-color($link-color, $hue: 80, $lightness: -4) !default; |
|
7 |
+$link-color-active: adjust-color($link-color-hover, $lightness: -15) !default; |
|
8 |
+ |
|
9 |
+// Main Section Colors |
|
10 |
+$main-bg: #f8f8f8 !default; |
|
11 |
+$page-bg: #252525 !default; |
|
12 |
+$article-border: #eeeeee !default; |
|
13 |
+ |
|
14 |
+$header-bg: #333 !default; |
|
15 |
+$header-border: lighten($header-bg, 15) !default; |
|
16 |
+$title-color: #f2f2f2 !default; |
|
17 |
+$subtitle-color: #aaa !default; |
|
18 |
+ |
|
19 |
+$text-color: #222 !default; |
|
20 |
+$text-color-light: #aaa !default; |
|
21 |
+$type-border: #ddd !default; |
|
22 |
+ |
|
23 |
+/* Navigation */ |
|
24 |
+$nav-bg: #ccc !default; |
|
25 |
+$nav-bg-front: image-url('noise.png') !default; |
|
26 |
+$nav-bg-back: linear-gradient(lighten($nav-bg, 8), $nav-bg, darken($nav-bg, 11)) !default; |
|
27 |
+$nav-color: darken($nav-bg, 38) !default; |
|
28 |
+$nav-color-hover: darken($nav-color, 25) !default; |
|
29 |
+$nav-placeholder: desaturate(darken($nav-bg, 10), 15) !default; |
|
30 |
+$nav-border: darken($nav-bg, 10) !default; |
|
31 |
+$nav-border-top: lighten($nav-bg, 15) !default; |
|
32 |
+$nav-border-bottom: darken($nav-bg, 25) !default; |
|
33 |
+$nav-border-left: darken($nav-bg, 11) !default; |
|
34 |
+$nav-border-right: lighten($nav-bg, 7) !default; |
|
35 |
+ |
|
36 |
+/* Sidebar colors */ |
|
37 |
+$sidebar-bg: #f2f2f2 !default; |
|
38 |
+$sidebar-link-color: $link-color !default; |
|
39 |
+$sidebar-link-color-hover: $link-color-hover !default; |
|
40 |
+$sidebar-link-color-active: $link-color-active !default; |
|
41 |
+$sidebar-color: change-color(mix($text-color, $sidebar-bg, 80), $hue: hue($sidebar-bg), $saturation: saturation($sidebar-bg)/2) !default; |
|
42 |
+$sidebar-border: desaturate(darken($sidebar-bg, 7), 10) !default; |
|
43 |
+$sidebar-border-hover: darken($sidebar-bg, 7) !default; |
|
44 |
+$sidebar-link-color-subdued: lighten($sidebar-color, 20) !default; |
|
45 |
+$sidebar-link-color-subdued-hover: $sidebar-link-color-hover !default; |
|
46 |
+$twitter-status-link: lighten($sidebar-link-color-subdued, 15) !default; |
|
47 |
+ |
|
48 |
+$footer-color: #888 !default; |
|
49 |
+$footer-bg: #ccc !default; |
|
50 |
+$footer-bg-front: image-url('noise.png') !default; |
|
51 |
+$footer-bg-back: linear-gradient(lighten($footer-bg, 8), $footer-bg, darken($footer-bg, 11)) !default; |
|
52 |
+$footer-color: darken($footer-bg, 38) !default; |
|
53 |
+$footer-color-hover: darken($footer-color, 10) !default; |
|
54 |
+$footer-border-top: lighten($footer-bg, 15) !default; |
|
55 |
+$footer-border-bottom: darken($footer-bg, 15) !default; |
|
56 |
+$footer-link-color: darken($footer-bg, 38) !default; |
|
57 |
+$footer-link-color-hover: darken($footer-color, 25) !default; |
|
58 |
+$page-border-bottom: darken($footer-bg, 5) !default; |
|
59 |
+ |
|
60 |
+ |
|
61 |
+/* Core theme application */ |
|
62 |
+ |
|
63 |
+a { |
|
64 |
+ @include link-colors($link-color, $hover: $link-color-hover, $focus: $link-color-hover, $visited: $link-color-visited, $active: $link-color-active); |
|
65 |
+} |
|
66 |
+aside.sidebar a { |
|
67 |
+ @include link-colors($sidebar-link-color, $hover: $sidebar-link-color-hover, $focus: $sidebar-link-color-hover, $active: $sidebar-link-color-active); |
|
68 |
+} |
|
69 |
+a { |
|
70 |
+ @include transition(color .3s); |
|
71 |
+} |
|
72 |
+ |
|
73 |
+html { |
|
74 |
+ background: $page-bg image-url('line-tile.png') top left; |
|
75 |
+} |
|
76 |
+body { |
|
77 |
+ > div { |
|
78 |
+ background: $sidebar-bg $noise-bg; |
|
79 |
+ border-bottom: 1px solid $page-border-bottom; |
|
80 |
+ > div { |
|
81 |
+ background: $main-bg $noise-bg; |
|
82 |
+ border-right: 1px solid $sidebar-border; |
|
83 |
+ } |
|
84 |
+ } |
|
85 |
+} |
0 | 86 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,161 @@ |
0 |
+$blockquote: $type-border !default; |
|
1 |
+$sans: "PT Sans", "Helvetica Neue", Arial, sans-serif !default; |
|
2 |
+$serif: "PT Serif", Georgia, Times, "Times New Roman", serif !default; |
|
3 |
+$mono: Menlo, Monaco, "Andale Mono", "lucida console", "Courier New", monospace !default; |
|
4 |
+$heading-font-family: "PT Serif", "Georgia", "Helvetica Neue", Arial, sans-serif !default; |
|
5 |
+$header-title-font-family: $heading-font-family !default; |
|
6 |
+$header-subtitle-font-family: $heading-font-family !default; |
|
7 |
+ |
|
8 |
+// Fonts |
|
9 |
+.heading { |
|
10 |
+ font-family: $heading-font-family; |
|
11 |
+} |
|
12 |
+.sans { font-family: $sans; } |
|
13 |
+.serif { font-family: $serif; } |
|
14 |
+.mono { font-family: $mono; } |
|
15 |
+ |
|
16 |
+body > header h1 { |
|
17 |
+ font-size: 2.2em; |
|
18 |
+ @extend .heading; |
|
19 |
+ font-family: $header-title-font-family; |
|
20 |
+ font-weight: normal; |
|
21 |
+ line-height: 1.2em; |
|
22 |
+ margin-bottom: 0.6667em; |
|
23 |
+} |
|
24 |
+body > header h2 { |
|
25 |
+ font-family: $header-subtitle-font-family; |
|
26 |
+} |
|
27 |
+ |
|
28 |
+body { |
|
29 |
+ line-height: 1.5em; |
|
30 |
+ color: $text-color; |
|
31 |
+ @extend .serif; |
|
32 |
+} |
|
33 |
+h1 { |
|
34 |
+ font-size: 2.2em; |
|
35 |
+ line-height: 1.2em; |
|
36 |
+} |
|
37 |
+ |
|
38 |
+@media only screen and (min-width: 992px) { |
|
39 |
+ body { font-size: 1.15em; } |
|
40 |
+ h1 { font-size: 2.6em; line-height: 1.2em; } |
|
41 |
+} |
|
42 |
+ |
|
43 |
+#{headings()}{ |
|
44 |
+ @extend .heading; |
|
45 |
+ text-rendering: optimizelegibility; |
|
46 |
+ margin-bottom: 1em; |
|
47 |
+ font-weight: bold; |
|
48 |
+} |
|
49 |
+h2, section h1 { |
|
50 |
+ font-size: 1.5em; |
|
51 |
+} |
|
52 |
+h3, section h2, section section h1 { |
|
53 |
+ font-size: 1.3em; |
|
54 |
+} |
|
55 |
+h4, section h3, section section h2, section section section h1 { |
|
56 |
+ font-size: 1em; |
|
57 |
+} |
|
58 |
+h5, section h4, section section h3 { |
|
59 |
+ font-size: .9em; |
|
60 |
+} |
|
61 |
+h6, section h5, section section h4, section section section h3 { |
|
62 |
+ font-size: .8em; |
|
63 |
+} |
|
64 |
+p, blockquote, ul, ol { margin-bottom: 1.5em; } |
|
65 |
+ |
|
66 |
+ul { list-style-type: disc; |
|
67 |
+ ul { list-style-type: circle; margin-bottom: 0px; |
|
68 |
+ ul { list-style-type: square; margin-bottom: 0px; }}} |
|
69 |
+ |
|
70 |
+ol { list-style-type: decimal; |
|
71 |
+ ol { list-style-type: lower-alpha; margin-bottom: 0px; |
|
72 |
+ ol { list-style-type: lower-roman; margin-bottom: 0px; }}} |
|
73 |
+ |
|
74 |
+ul, ol { &, ul, ol { margin-left: 1.3em; }} |
|
75 |
+ |
|
76 |
+strong { font-weight: bold; } |
|
77 |
+ |
|
78 |
+em { font-style: italic; } |
|
79 |
+ |
|
80 |
+sup, sub { font-size: 0.8em; position: relative; display: inline-block; } |
|
81 |
+sup { top: -.5em; } |
|
82 |
+sub { bottom: -.5em; } |
|
83 |
+ |
|
84 |
+q { font-style: italic; |
|
85 |
+ &:before { content: "\201C"; } |
|
86 |
+ &:after { content: "\201D"; } |
|
87 |
+} |
|
88 |
+ |
|
89 |
+em, dfn { font-style: italic; } |
|
90 |
+ |
|
91 |
+strong, dfn { font-weight: bold; } |
|
92 |
+ |
|
93 |
+del, s { text-decoration: line-through; } |
|
94 |
+ |
|
95 |
+abbr, acronym { border-bottom: 1px dotted; cursor: help; } |
|
96 |
+ |
|
97 |
+pre, code, tt { @extend .mono; } |
|
98 |
+ |
|
99 |
+sub, sup { line-height: 0; } |
|
100 |
+ |
|
101 |
+hr { margin-bottom: 0.2em; } |
|
102 |
+ |
|
103 |
+small { font-size: .8em; } |
|
104 |
+ |
|
105 |
+big { font-size: 1.2em; } |
|
106 |
+ |
|
107 |
+blockquote { |
|
108 |
+ $bq-margin: 1.2em; |
|
109 |
+ font-style: italic; |
|
110 |
+ position: relative; |
|
111 |
+ font-size: 1.2em; |
|
112 |
+ line-height: 1.5em; |
|
113 |
+ padding-left: 1em; |
|
114 |
+ border-left: 4px solid rgba($text-color-light, .5); |
|
115 |
+ cite { |
|
116 |
+ font-style: italic; |
|
117 |
+ a { color: $text-color-light !important; word-wrap: break-word; } |
|
118 |
+ &:before { content: '\2014'; padding:{right: .3em; left: .3em;} color: $text-color-light; } |
|
119 |
+ } |
|
120 |
+ @media only screen and (min-width: 992px) { |
|
121 |
+ padding-left: 1.5em; |
|
122 |
+ border-left-width: 4px; |
|
123 |
+ } |
|
124 |
+} |
|
125 |
+ |
|
126 |
+.pullquote-right:before, |
|
127 |
+.pullquote-left:before { |
|
128 |
+ /* Reset metrics. */ |
|
129 |
+ padding: 0; |
|
130 |
+ border: none; |
|
131 |
+ |
|
132 |
+ /* Content */ |
|
133 |
+ content: attr(data-pullquote); |
|
134 |
+ |
|
135 |
+ /* Pull out to the right, modular scale based margins. */ |
|
136 |
+ float: right; |
|
137 |
+ width: 45%; |
|
138 |
+ margin: .5em 0 1em 1.5em; |
|
139 |
+ |
|
140 |
+ /* Baseline correction */ |
|
141 |
+ position: relative; |
|
142 |
+ top: 7px; |
|
143 |
+ font-size: 1.4em; |
|
144 |
+ line-height: 1.45em; |
|
145 |
+} |
|
146 |
+ |
|
147 |
+.pullquote-left:before { |
|
148 |
+ /* Make left pullquotes align properly. */ |
|
149 |
+ float: left; |
|
150 |
+ margin: .5em 1.5em 1em 0; |
|
151 |
+} |
|
152 |
+ |
|
153 |
+/* @extend this to force long lines of continuous text to wrap */ |
|
154 |
+.force-wrap { |
|
155 |
+ white-space: -moz-pre-wrap; |
|
156 |
+ white-space: -pre-wrap; |
|
157 |
+ white-space: -o-pre-wrap; |
|
158 |
+ white-space: pre-wrap; |
|
159 |
+ word-wrap: break-word; |
|
160 |
+} |
0 | 161 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
0 |
+@mixin mask-image($img, $repeat: no-repeat){ |
|
1 |
+ @include experimental(mask-image, image-url($img), -webkit, -moz, -o, -ms); |
|
2 |
+ @include experimental(mask-repeat, $repeat, -webkit, -moz, -o, -ms); |
|
3 |
+ width: image-width($img); |
|
4 |
+ height: image-height($img); |
|
5 |
+} |
|
6 |
+ |
|
7 |
+@mixin shadow-box($border: #fff .5em solid, $shadow: rgba(#000, .15) 0 1px 4px, $border-radius: .3em) { |
|
8 |
+ @include border-radius($border-radius); |
|
9 |
+ @include box-shadow($shadow); |
|
10 |
+ @include box-sizing(border-box); |
|
11 |
+ border: $border; |
|
12 |
+} |
|
13 |
+ |
|
14 |
+@mixin selection($bg, $color: inherit, $text-shadow: none){ |
|
15 |
+ * { |
|
16 |
+ &::-moz-selection { background: $bg; color: $color; text-shadow: $text-shadow; } |
|
17 |
+ &::-webkit-selection { background: $bg; color: $color; text-shadow: $text-shadow; } |
|
18 |
+ &::selection { background: $bg; color: $color; text-shadow: $text-shadow; } |
|
19 |
+ } |
|
20 |
+} |
|
21 |
+ |
|
22 |
+@function text-color($color, $dark: dark, $light: light){ |
|
23 |
+ $text-color: ( (red($color)*299) + (green($color)*587) + (blue($color)*114) ) / 1000; |
|
24 |
+ $text-color: if($text-color >= 150, $dark, $light); |
|
25 |
+ @return $text-color; |
|
26 |
+} |
|
27 |
+ |
0 | 28 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,43 @@ |
0 |
+// Here you can easily change your sites's color scheme. |
|
1 |
+// To give it a try, uncomment some of the lines below rebuild your blog, and see how it works. |
|
2 |
+// If you need a handy color picker try http://hslpicker.com |
|
3 |
+ |
|
4 |
+//$header-bg: #263347; |
|
5 |
+//$subtitle-color: lighten($header-bg, 58); |
|
6 |
+//$nav-bg: desaturate(lighten(#8fc17a, 18), 5); |
|
7 |
+//$nav-bg-front: image-url('noise.png'); |
|
8 |
+//$nav-bg-back: linear-gradient(lighten($nav-bg, 8), $nav-bg, darken($nav-bg, 11)); |
|
9 |
+//$sidebar-bg: desaturate(#eceff5, 8); |
|
10 |
+//$sidebar-link-color: saturate(#526f9a, 10); |
|
11 |
+//$sidebar-link-color-hover: darken(#7ab662, 9); |
|
12 |
+//$footer-bg: #ccc !default; |
|
13 |
+//$footer-bg-front: image-url('noise.png'); |
|
14 |
+//$footer-bg-back: linear-gradient(lighten($footer-bg, 8), $footer-bg, darken($footer-bg, 11)); |
|
15 |
+ |
|
16 |
+ |
|
17 |
+/* To use the light Solarized highlighting theme uncomment the following line */ |
|
18 |
+//$solarized: light; |
|
19 |
+ |
|
20 |
+/* If you want to tweak the Solarized colors you can do that here */ |
|
21 |
+//$base03: #002b36; //darkest blue |
|
22 |
+//$base02: #073642; //dark blue |
|
23 |
+//$base01: #586e75; //darkest gray |
|
24 |
+//$base00: #657b83; //dark gray |
|
25 |
+//$base0: #839496; //medium gray |
|
26 |
+//$base1: #93a1a1; //medium light gray |
|
27 |
+//$base2: #eee8d5; //cream |
|
28 |
+//$base3: #fdf6e3; //white |
|
29 |
+//$solar-yellow: #b58900; |
|
30 |
+//$solar-orange: #cb4b16; |
|
31 |
+//$solar-red: #dc322f; |
|
32 |
+//$solar-magenta: #d33682; |
|
33 |
+//$solar-violet: #6c71c4; |
|
34 |
+//$solar-blue: #268bd2; |
|
35 |
+//$solar-cyan: #2aa198; |
|
36 |
+//$solar-green: #859900; |
|
37 |
+ |
|
38 |
+ |
|
39 |
+/* Non highlighted code colors */ |
|
40 |
+//$pre-bg: $base03; |
|
41 |
+//$pre-border: darken($base02, 5); |
|
42 |
+//$pre-color: $base1; |
0 | 43 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,10 @@ |
0 |
+// Here you can easily change font faces which are used in your site. |
|
1 |
+// To give it a try, uncomment some of the lines below rebuild your blog, and see how it works. your sites's. |
|
2 |
+// If you love to use Web Fonts, you also need to add some lines to source/_includes/custom/head.html |
|
3 |
+ |
|
4 |
+//$sans: "Optima", sans-serif; |
|
5 |
+//$serif: "Baskerville", serif; |
|
6 |
+//$mono: "Courier", monospace; |
|
7 |
+//$heading-font-family: "Verdana", sans-serif; |
|
8 |
+//$header-title-font-family: "Futura", sans-serif; |
|
9 |
+//$header-subtitle-font-family: "Futura", sans-serif; |
0 | 10 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
0 |
+// Here you can easily change your sites's layout. |
|
1 |
+// To give it a try, uncomment some of the lines below, make changes, rebuild your blog, and see how it works. |
|
2 |
+ |
|
3 |
+//$header-font-size: 1em; |
|
4 |
+//$header-padding-top: 1.5em; |
|
5 |
+//$header-padding-bottom: 1.5em; |
|
6 |
+ |
|
7 |
+//$max-width: 1350px; |
|
8 |
+//$indented-lists: true; |
|
9 |
+ |
|
10 |
+// Padding used for layout margins |
|
11 |
+//$pad-min: 18px; |
|
12 |
+//$pad-narrow: 25px; |
|
13 |
+//$pad-medium: 35px; |
|
14 |
+//$pad-wide: 55px; |
|
15 |
+ |
|
16 |
+// Sidebar widths used in media queries |
|
17 |
+//$sidebar-width-medium: 240px; |
|
18 |
+//$sidebar-pad-medium: 15px; |
|
19 |
+//$sidebar-pad-wide: 20px; |
|
20 |
+//$sidebar-width-wide: 300px; |
0 | 2 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,72 @@ |
0 |
+#archive { |
|
1 |
+ #content > div { &, > article { padding-top: 0; } } |
|
2 |
+} |
|
3 |
+#blog-archives { |
|
4 |
+ article { |
|
5 |
+ padding: 1em 0 1em; |
|
6 |
+ position: relative; |
|
7 |
+ background: $img-border bottom left repeat-x; |
|
8 |
+ &:last-child { |
|
9 |
+ background: none; |
|
10 |
+ } |
|
11 |
+ footer { padding: 0; margin: 0;} |
|
12 |
+ } |
|
13 |
+ h1 { color: $text-color; margin-bottom: .3em; } |
|
14 |
+ h2 { display: none; } |
|
15 |
+ h1 { |
|
16 |
+ font-size: 1.5em; |
|
17 |
+ a { |
|
18 |
+ @include hover-link; |
|
19 |
+ color: inherit; |
|
20 |
+ &:hover { color: $link-color-hover; } |
|
21 |
+ font-weight: normal; |
|
22 |
+ display: inline-block; |
|
23 |
+ } |
|
24 |
+ } |
|
25 |
+ a.category, time { |
|
26 |
+ @extend .sans; |
|
27 |
+ color: $text-color-light; |
|
28 |
+ } |
|
29 |
+ color: $text-color-light; |
|
30 |
+ .entry-content { display: none; } |
|
31 |
+ time { |
|
32 |
+ font-size: .9em; |
|
33 |
+ line-height: 1.2em; |
|
34 |
+ .month, .day { display: inline-block; } |
|
35 |
+ .month { text-transform: uppercase; } |
|
36 |
+ } |
|
37 |
+ p { margin-bottom: 1em; } |
|
38 |
+ &, .entry-content { a { @include link-colors(inherit, $link-color-hover); }} |
|
39 |
+ a:hover { color: $link-color-hover; } |
|
40 |
+ @media only screen and (min-width: 550px) { |
|
41 |
+ article { margin-left: 5em; } |
|
42 |
+ h2 { |
|
43 |
+ margin-bottom: .3em; |
|
44 |
+ font-weight: normal; |
|
45 |
+ display: inline-block; |
|
46 |
+ position: relative; top: -1px; |
|
47 |
+ float: left; |
|
48 |
+ &:first-child { padding-top: .75em; } |
|
49 |
+ } |
|
50 |
+ time { |
|
51 |
+ position: absolute; |
|
52 |
+ text-align: right; |
|
53 |
+ left: 0em; |
|
54 |
+ top: 1.8em; |
|
55 |
+ } |
|
56 |
+ .year { display: none; } |
|
57 |
+ article { |
|
58 |
+ padding:{left: 4.5em; bottom: .7em;} |
|
59 |
+ } |
|
60 |
+ a.category { |
|
61 |
+ line-height: 1.1em; |
|
62 |
+ } |
|
63 |
+ } |
|
64 |
+} |
|
65 |
+#content > .category { |
|
66 |
+ article { |
|
67 |
+ margin-left: 0; |
|
68 |
+ padding-left: 6.8em; |
|
69 |
+ } |
|
70 |
+ .year { display: inline; } |
|
71 |
+} |
0 | 72 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,141 @@ |
0 |
+article { |
|
1 |
+ padding-top: 1em; |
|
2 |
+ a { @extend .force-wrap; } |
|
3 |
+ header { |
|
4 |
+ position: relative; |
|
5 |
+ padding-top: 2em; |
|
6 |
+ padding-bottom: 1em; |
|
7 |
+ margin-bottom: 1em; |
|
8 |
+ background: $img-border bottom left repeat-x; |
|
9 |
+ h1 { |
|
10 |
+ margin: 0; |
|
11 |
+ a { text-decoration: none; |
|
12 |
+ &:hover { text-decoration: underline; } } |
|
13 |
+ } |
|
14 |
+ p { |
|
15 |
+ font-size: .9em; |
|
16 |
+ color: $text-color-light; |
|
17 |
+ margin: 0; |
|
18 |
+ &.meta { |
|
19 |
+ @extend .sans; |
|
20 |
+ text-transform: uppercase; |
|
21 |
+ position: absolute; top: 0; |
|
22 |
+ } |
|
23 |
+ } |
|
24 |
+ @media only screen and (min-width: 768px) { |
|
25 |
+ margin-bottom: 1.5em; |
|
26 |
+ padding-bottom: 1em; |
|
27 |
+ background: $img-border bottom left repeat-x; |
|
28 |
+ } |
|
29 |
+ } |
|
30 |
+ h2 { |
|
31 |
+ padding-top: 0.8em; |
|
32 |
+ background: $img-border top left repeat-x; |
|
33 |
+ } |
|
34 |
+ .entry-content & h2:first-child, header + h2 { padding-top: 0; } |
|
35 |
+ h2:first-child, header + h2 { background: none; } |
|
36 |
+ .feature { |
|
37 |
+ padding-top: .5em; |
|
38 |
+ margin-bottom: 1em; |
|
39 |
+ padding-bottom: 1em; |
|
40 |
+ background: $img-border bottom left repeat-x; |
|
41 |
+ font-size: 2.0em; font-style: italic; |
|
42 |
+ line-height: 1.3em; |
|
43 |
+ } |
|
44 |
+ img, video, .flash-video { |
|
45 |
+ @extend .flex-content; |
|
46 |
+ @extend .basic-alignment; |
|
47 |
+ @include shadow-box; |
|
48 |
+ } |
|
49 |
+ video, .flash-video { margin: 0 auto 1.5em; } |
|
50 |
+ video { display: block; width: 100%; } |
|
51 |
+ .flash-video { |
|
52 |
+ > div { |
|
53 |
+ position: relative; |
|
54 |
+ display: block; |
|
55 |
+ padding-bottom: 56.25%; |
|
56 |
+ padding-top: 1px; |
|
57 |
+ height: 0; |
|
58 |
+ overflow: hidden; |
|
59 |
+ iframe, object, embed { |
|
60 |
+ position: absolute; |
|
61 |
+ top: 0; |
|
62 |
+ left: 0; |
|
63 |
+ width: 100%; |
|
64 |
+ height: 100%; |
|
65 |
+ } |
|
66 |
+ } |
|
67 |
+ } |
|
68 |
+ > footer { |
|
69 |
+ padding-bottom: 2.5em; |
|
70 |
+ margin-top: 2em; |
|
71 |
+ @extend .sans; |
|
72 |
+ p.meta { |
|
73 |
+ margin-bottom: .8em; |
|
74 |
+ font-size: .85em; |
|
75 |
+ clear: both; |
|
76 |
+ overflow: hidden; |
|
77 |
+ } |
|
78 |
+ .byline + time:before, time +time:before, .comments:before, .byline ~ .categories:before { |
|
79 |
+ @extend .separator; |
|
80 |
+ } |
|
81 |
+ } |
|
82 |
+ |
|
83 |
+} |
|
84 |
+article + article { |
|
85 |
+ .blog-index & { |
|
86 |
+ background: $img-border top left repeat-x; |
|
87 |
+ } |
|
88 |
+} |
|
89 |
+#content .blog-index { |
|
90 |
+ padding: { top: 0; bottom: 0; } |
|
91 |
+ article { padding-top: 2em; } |
|
92 |
+ article header { background: none; padding-bottom: 0; } |
|
93 |
+ article h1 { |
|
94 |
+ font-size: 2.2em; |
|
95 |
+ a { color: inherit; &:hover { color: $link-color-hover; } } |
|
96 |
+ } |
|
97 |
+ a[rel=full-article] { |
|
98 |
+ background: darken($main-bg, 5); |
|
99 |
+ display: inline-block; |
|
100 |
+ padding: .4em .8em; |
|
101 |
+ margin-right: .5em; |
|
102 |
+ text-decoration: none; |
|
103 |
+ color: mix($text-color, $text-color-light); |
|
104 |
+ @extend .serif; |
|
105 |
+ @include transition(background-color .5s); |
|
106 |
+ &:hover { |
|
107 |
+ background: $link-color-hover; |
|
108 |
+ text-shadow: none; |
|
109 |
+ color: $main-bg; |
|
110 |
+ } |
|
111 |
+ } |
|
112 |
+ footer { |
|
113 |
+ @extend .sans; |
|
114 |
+ margin-top: 1em; |
|
115 |
+ } |
|
116 |
+} |
|
117 |
+ |
|
118 |
+.separator { |
|
119 |
+ content: "\2022 "; |
|
120 |
+ padding: 0 .4em 0 .2em; |
|
121 |
+ display: inline-block; |
|
122 |
+} |
|
123 |
+ |
|
124 |
+#content div.pagination { |
|
125 |
+ text-align: center; |
|
126 |
+ font-size: .95em; |
|
127 |
+ position: relative; |
|
128 |
+ background: $img-border top left repeat-x; |
|
129 |
+ padding: {top: 1.5em; bottom: 1.5em;} |
|
130 |
+ a { |
|
131 |
+ text-decoration: none; |
|
132 |
+ color: $text-color-light; |
|
133 |
+ &.prev { position: absolute; left: 0; } |
|
134 |
+ &.next { position: absolute; right: 0; } |
|
135 |
+ &:hover { color: $link-color-hover; } |
|
136 |
+ &[href*=archive] { |
|
137 |
+ &:before, &:after { content: '\2014'; padding: 0 .3em; } |
|
138 |
+ } |
|
139 |
+ } |
|
140 |
+} |
0 | 141 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
0 |
+body > footer { |
|
1 |
+ @extend .sans; |
|
2 |
+ font-size: .8em; |
|
3 |
+ color: $footer-color; |
|
4 |
+ text-shadow: lighten($footer-bg, 5) 0 1px; |
|
5 |
+ background-color: $footer-bg; |
|
6 |
+ @include background($footer-bg-front, $footer-bg-back); |
|
7 |
+ border-top: 1px solid $footer-border-top; |
|
8 |
+ position: relative; |
|
9 |
+ padding-top: 1em; |
|
10 |
+ padding-bottom: 1em; |
|
11 |
+ margin-bottom: 3em; |
|
12 |
+ @include border-bottom-radius(.4em); |
|
13 |
+ z-index: 1; |
|
14 |
+ a { |
|
15 |
+ @include link-colors($footer-link-color, $footer-link-color-hover, $visited: $footer-link-color); |
|
16 |
+ } |
|
17 |
+ p:last-child { margin-bottom: 0; } |
|
18 |
+} |
0 | 19 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
0 |
+body > header { |
|
1 |
+ background: $header-bg; |
|
2 |
+ h1 { |
|
3 |
+ display: inline-block; |
|
4 |
+ margin: 0; |
|
5 |
+ a, a:visited, a:hover { |
|
6 |
+ color: $title_color; |
|
7 |
+ text-decoration: none; |
|
8 |
+ } |
|
9 |
+ } |
|
10 |
+ h2 { |
|
11 |
+ margin: .2em 0 0; |
|
12 |
+ @extend .sans; |
|
13 |
+ font-size: 1em; |
|
14 |
+ color: $subtitle-color; |
|
15 |
+ font-weight: normal; |
|
16 |
+ } |
|
17 |
+} |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,137 @@ |
0 |
+body > nav { |
|
1 |
+ position: relative; |
|
2 |
+ background-color: $nav-bg; |
|
3 |
+ @include background($nav-bg-front, $nav-bg-back); |
|
4 |
+ border: { |
|
5 |
+ top: 1px solid $nav-border-top; |
|
6 |
+ bottom: 1px solid $nav-border-bottom; } |
|
7 |
+ padding-top: .35em; |
|
8 |
+ padding-bottom: .35em; |
|
9 |
+ form { |
|
10 |
+ @include background-clip(padding-box); |
|
11 |
+ margin: 0; padding: 0; |
|
12 |
+ .search { |
|
13 |
+ padding: .3em .5em 0; |
|
14 |
+ font-size: .85em; |
|
15 |
+ font-family: $sans; |
|
16 |
+ line-height: 1.1em; |
|
17 |
+ width: 95%; |
|
18 |
+ @include border-radius(.5em); |
|
19 |
+ @include background-clip(padding-box); |
|
20 |
+ @include box-shadow(lighten($nav-bg, 2) 0 1px); |
|
21 |
+ background-color: lighten($nav-bg, 15); |
|
22 |
+ border: 1px solid $nav-border; |
|
23 |
+ color: #888; |
|
24 |
+ &:focus { |
|
25 |
+ color: #444; |
|
26 |
+ border-color: #80b1df; |
|
27 |
+ @include box-shadow(#80b1df 0 0 4px, #80b1df 0 0 3px inset); |
|
28 |
+ background-color: #fff; |
|
29 |
+ outline: none; |
|
30 |
+ } |
|
31 |
+ } |
|
32 |
+ } |
|
33 |
+ fieldset[role=search]{ float: right; width: 48%; } |
|
34 |
+ fieldset.mobile-nav{ float: left; width: 48%; |
|
35 |
+ select{ width: 100%; font-size: .8em; border: 1px solid #888;} |
|
36 |
+ } |
|
37 |
+ ul { display: none; } |
|
38 |
+ @media only screen and (min-width: 550px) { |
|
39 |
+ font-size: .9em; |
|
40 |
+ ul { |
|
41 |
+ @include horizontal-list(0); |
|
42 |
+ float: left; |
|
43 |
+ display: block; |
|
44 |
+ padding-top: .15em; |
|
45 |
+ } |
|
46 |
+ ul.subscription { |
|
47 |
+ margin-left: .8em; |
|
48 |
+ float: right; |
|
49 |
+ li:last-child a { padding-right: 0; } |
|
50 |
+ } |
|
51 |
+ ul li { |
|
52 |
+ margin: 0; |
|
53 |
+ } |
|
54 |
+ a { |
|
55 |
+ @include link-colors($nav-color, $nav-color-hover, $visited: $nav-color); |
|
56 |
+ font-family: $sans; |
|
57 |
+ text-shadow: lighten($nav-bg, 12) 0 1px; |
|
58 |
+ float: left; |
|
59 |
+ text-decoration: none; |
|
60 |
+ font-size: 1.1em; |
|
61 |
+ padding: .1em 0; |
|
62 |
+ line-height: 1.5em; |
|
63 |
+ } |
|
64 |
+ li + li { |
|
65 |
+ border-left: 1px solid $nav-border-left; |
|
66 |
+ margin-left: .8em; |
|
67 |
+ a { |
|
68 |
+ padding-left: .8em; |
|
69 |
+ border-left: 1px solid $nav-border-right; |
|
70 |
+ } |
|
71 |
+ } |
|
72 |
+ form { |
|
73 |
+ float: right; |
|
74 |
+ text-align: left; |
|
75 |
+ padding-left: .8em; |
|
76 |
+ width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium + 20px; |
|
77 |
+ .search { |
|
78 |
+ width: 93%; |
|
79 |
+ font-size: .95em; |
|
80 |
+ line-height: 1.2em; |
|
81 |
+ } |
|
82 |
+ } |
|
83 |
+ ul[data-subscription$=email] + form { |
|
84 |
+ width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium - 58px; |
|
85 |
+ .search { width: 91%; } |
|
86 |
+ } |
|
87 |
+ fieldset.mobile-nav { display: none; } |
|
88 |
+ fieldset[role=search]{ width: 99%; } |
|
89 |
+ } |
|
90 |
+ @media only screen and (min-width: 992px) { |
|
91 |
+ form { |
|
92 |
+ width: $sidebar-width-wide - $pad-wide - $sidebar-pad-wide*2 + 10px; |
|
93 |
+ } |
|
94 |
+ ul[data-subscription$=email] + form { |
|
95 |
+ width: $sidebar-width-wide - $pad-wide - $sidebar-pad-wide*2 - 58px; |
|
96 |
+ } |
|
97 |
+ } |
|
98 |
+} |
|
99 |
+.no-placeholder { |
|
100 |
+ body > nav .search { |
|
101 |
+ background: lighten($nav-bg, 15) image-url('search.png') .3em .25em no-repeat; |
|
102 |
+ text-indent: 1.3em; |
|
103 |
+ } |
|
104 |
+} |
|
105 |
+@mixin mask-subscription-nav($feed: 'rss.png'){ |
|
106 |
+ position: relative; top: 0px; |
|
107 |
+ text-indent: -999999em; |
|
108 |
+ background-color: $nav-border-right; |
|
109 |
+ border: 0; |
|
110 |
+ padding: 0; |
|
111 |
+ &,&:after { @include mask-image($feed); } |
|
112 |
+ &:after { |
|
113 |
+ content: ""; |
|
114 |
+ position: absolute; top: -1px; left: 0; |
|
115 |
+ background-color: lighten($nav-color, 25); |
|
116 |
+ } |
|
117 |
+ &:hover:after { background-color: lighten($nav-color, 20); } |
|
118 |
+} |
|
119 |
+.maskImage { |
|
120 |
+ body > nav { |
|
121 |
+ @media only screen and (min-width: 550px) { |
|
122 |
+ ul[data-subscription$=email] + form { |
|
123 |
+ width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium - 32px; |
|
124 |
+ } |
|
125 |
+ } |
|
126 |
+ @media only screen and (min-width: 992px) { |
|
127 |
+ ul[data-subscription$=email] + form { |
|
128 |
+ width: $sidebar-width-wide - $pad-wide - $sidebar-pad-wide*2 - 32px; |
|
129 |
+ } |
|
130 |
+ } |
|
131 |
+ } |
|
132 |
+ ul.subscription { position: relative; top: .2em; li, a { border: 0; padding: 0; }} |
|
133 |
+ a[rel=subscribe-rss]{ @include mask-subscription-nav('rss.png'); } |
|
134 |
+ a[rel=subscribe-email]{ @include mask-subscription-nav('email.png'); } |
|
135 |
+} |
|
136 |
+ |
0 | 5 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,261 @@ |
0 |
+.highlight, html .gist .gist-file .gist-syntax .gist-highlight { |
|
1 |
+ table td.code { width: 100%; } |
|
2 |
+ border: 1px solid $pre-border !important; |
|
3 |
+} |
|
4 |
+.highlight .line-numbers, html .gist .gist-file .gist-syntax .highlight .line_numbers { |
|
5 |
+ text-align: right; |
|
6 |
+ font-size: 13px; |
|
7 |
+ line-height: 1.45em; |
|
8 |
+ @if $solarized == light { |
|
9 |
+ background: lighten($base03, 1) $noise-bg !important; |
|
10 |
+ border-right: 1px solid darken($base02, 2) !important; |
|
11 |
+ @include box-shadow(lighten($base03, 2) -1px 0 inset); |
|
12 |
+ text-shadow: lighten($base02, 2) 0 -1px; |
|
13 |
+ } @else { |
|
14 |
+ background: $base02 $noise-bg !important; |
|
15 |
+ border-right: 1px solid darken($base03, 2) !important; |
|
16 |
+ @include box-shadow(lighten($base02, 2) -1px 0 inset); |
|
17 |
+ text-shadow: darken($base02, 10) 0 -1px; |
|
18 |
+ } |
|
19 |
+ span { color: $base01 !important; } |
|
20 |
+ padding: .8em !important; |
|
21 |
+ @include border-radius(0); |
|
22 |
+} |
|
23 |
+ |
|
24 |
+figure.code, .gist-file, pre { |
|
25 |
+ @include box-shadow(rgba(#000, .06) 0 0 10px); |
|
26 |
+ .highlight pre { @include box-shadow(none); } |
|
27 |
+} |
|
28 |
+ |
|
29 |
+.gist .highlight, figure.code .highlight { |
|
30 |
+ @include selection(adjust-color($base03, $lightness: 23%, $saturation: -65%), $text-shadow: $base03 0 1px); |
|
31 |
+} |
|
32 |
+html .gist .gist-file { |
|
33 |
+ margin-bottom: 1.8em; |
|
34 |
+ position: relative; |
|
35 |
+ border: none; |
|
36 |
+ padding-top: image-height("code_bg.png") !important; |
|
37 |
+ .highlight { |
|
38 |
+ margin-bottom: 0; |
|
39 |
+ } |
|
40 |
+ .gist-syntax { |
|
41 |
+ border-bottom: 0 !important; |
|
42 |
+ background: none !important; |
|
43 |
+ .gist-highlight { |
|
44 |
+ background: $base03 !important; |
|
45 |
+ } |
|
46 |
+ .highlight pre { |
|
47 |
+ @extend .pre-code; |
|
48 |
+ padding: 0; |
|
49 |
+ } |
|
50 |
+ } |
|
51 |
+ .gist-meta { |
|
52 |
+ padding: .6em 0.8em; |
|
53 |
+ border: 1px solid lighten($base02, 2) !important; |
|
54 |
+ color: $base01; |
|
55 |
+ font-size: .7em !important; |
|
56 |
+ @if $solarized == light { |
|
57 |
+ background: lighten($base03, 2) $noise-bg; |
|
58 |
+ border: 1px solid $pre-border !important; |
|
59 |
+ border-top: 1px solid lighten($base03, 2) !important; |
|
60 |
+ } @else { |
|
61 |
+ background: $base02 $noise-bg; |
|
62 |
+ } |
|
63 |
+ @extend .sans; |
|
64 |
+ line-height: 1.5em; |
|
65 |
+ a { |
|
66 |
+ color: mix($base1, $base01) !important; |
|
67 |
+ @include hover-link; |
|
68 |
+ &:hover { color: $base1 !important; } |
|
69 |
+ } |
|
70 |
+ a[href*='#file'] { |
|
71 |
+ position: absolute; top: 0; left:0; right:-10px; |
|
72 |
+ color: #474747 !important; |
|
73 |
+ @extend .code-title; |
|
74 |
+ &:hover { color: $link-color !important; } |
|
75 |
+ } |
|
76 |
+ a[href*=raw]{ |
|
77 |
+ @extend .download-source; |
|
78 |
+ top: .4em; |
|
79 |
+ } |
|
80 |
+ } |
|
81 |
+} |
|
82 |
+pre { |
|
83 |
+ background: $pre-bg $noise-bg; |
|
84 |
+ @include border-radius(.4em); |
|
85 |
+ @extend .mono; |
|
86 |
+ border: 1px solid $pre-border; |
|
87 |
+ line-height: 1.45em; |
|
88 |
+ font-size: 13px; |
|
89 |
+ margin-bottom: 2.1em; |
|
90 |
+ padding: .8em 1em; |
|
91 |
+ color: $pre-color; |
|
92 |
+ overflow: auto; |
|
93 |
+} |
|
94 |
+h3.filename { |
|
95 |
+ @extend .code-title; |
|
96 |
+ + pre { @include border-top-radius(0px); } |
|
97 |
+} |
|
98 |
+ |
|
99 |
+p, li { |
|
100 |
+ code { |
|
101 |
+ @extend .mono; |
|
102 |
+ display: inline-block; |
|
103 |
+ white-space: no-wrap; |
|
104 |
+ background: #fff; |
|
105 |
+ font-size: .8em; |
|
106 |
+ line-height: 1.5em; |
|
107 |
+ color: #555; |
|
108 |
+ border: 1px solid #ddd; |
|
109 |
+ @include border-radius(.4em); |
|
110 |
+ padding: 0 .3em; |
|
111 |
+ margin: -1px 0; |
|
112 |
+ } |
|
113 |
+ pre code { font-size: 1em !important; background: none; border: none; } |
|
114 |
+} |
|
115 |
+ |
|
116 |
+.pre-code { |
|
117 |
+ font-family: $mono !important; |
|
118 |
+ overflow: scroll; |
|
119 |
+ overflow-y: hidden; |
|
120 |
+ display: block; |
|
121 |
+ padding: .8em; |
|
122 |
+ overflow-x: auto; |
|
123 |
+ line-height: 1.45em; |
|
124 |
+ background: $base03 $noise-bg !important; |
|
125 |
+ color: $base1 !important; |
|
126 |
+ span { color: $base1 !important; } |
|
127 |
+ span { font-style: normal !important; font-weight: normal !important; } |
|
128 |
+ |
|
129 |
+ .c { color: $base01 !important; font-style: italic !important; } /* Comment */ |
|
130 |
+ .cm { color: $base01 !important; font-style: italic !important; } /* Comment.Multiline */ |
|
131 |
+ .cp { color: $base01 !important; font-style: italic !important; } /* Comment.Preproc */ |
|
132 |
+ .c1 { color: $base01 !important; font-style: italic !important; } /* Comment.Single */ |
|
133 |
+ .cs { color: $base01 !important; font-weight: bold !important; font-style: italic !important; } /* Comment.Special */ |
|
134 |
+ .err { color: $solar-red !important; background: none !important; } /* Error */ |
|
135 |
+ .k { color: $solar-orange !important; } /* Keyword */ |
|
136 |
+ .o { color: $base1 !important; font-weight: bold !important; } /* Operator */ |
|
137 |
+ .p { color: $base1 !important; } /* Operator */ |
|
138 |
+ .ow { color: $solar-cyan !important; font-weight: bold !important; } /* Operator.Word */ |
|
139 |
+ .gd { color: $base1 !important; background-color: mix($solar-red, $base03, 25%) !important; display: inline-block; } /* Generic.Deleted */ |
|
140 |
+ .gd .x { color: $base1 !important; background-color: mix($solar-red, $base03, 35%) !important; display: inline-block; } /* Generic.Deleted.Specific */ |
|
141 |
+ .ge { color: $base1 !important; font-style: italic !important; } /* Generic.Emph */ |
|
142 |
+ //.gr { color: #aa0000 } /* Generic.Error */ |
|
143 |
+ .gh { color: $base01 !important; } /* Generic.Heading */ |
|
144 |
+ .gi { color: $base1 !important; background-color: mix($solar-green, $base03, 20%) !important; display: inline-block; } /* Generic.Inserted */ |
|
145 |
+ .gi .x { color: $base1 !important; background-color: mix($solar-green, $base03, 40%) !important; display: inline-block; } /* Generic.Inserted.Specific */ |
|
146 |
+ //.go { color: #888888 } /* Generic.Output */ |
|
147 |
+ //.gp { color: #555555 } /* Generic.Prompt */ |
|
148 |
+ .gs { color: $base1 !important; font-weight: bold !important; } /* Generic.Strong */ |
|
149 |
+ .gu { color: $solar-violet !important; } /* Generic.Subheading */ |
|
150 |
+ //.gt { color: #aa0000 } /* Generic.Traceback */ |
|
151 |
+ .kc { color: $solar-green !important; font-weight: bold !important; } /* Keyword.Constant */ |
|
152 |
+ .kd { color: $solar-blue !important; } /* Keyword.Declaration */ |
|
153 |
+ .kp { color: $solar-orange !important; font-weight: bold !important; } /* Keyword.Pseudo */ |
|
154 |
+ .kr { color: $solar-magenta !important; font-weight: bold !important; } /* Keyword.Reserved */ |
|
155 |
+ .kt { color: $solar-cyan !important; } /* Keyword.Type */ |
|
156 |
+ .n { color: $solar-blue !important; } |
|
157 |
+ .na { color: $solar-blue !important; } /* Name.Attribute */ |
|
158 |
+ .nb { color: $solar-green !important; } /* Name.Builtin */ |
|
159 |
+ .nc { color: $solar-magenta !important;} /* Name.Class */ |
|
160 |
+ .no { color: $solar-yellow !important; } /* Name.Constant */ |
|
161 |
+ //.ni { color: #800080 } /* Name.Entity */ |
|
162 |
+ .nl { color: $solar-green !important; } |
|
163 |
+ .ne { color: $solar-blue !important; font-weight: bold !important; } /* Name.Exception */ |
|
164 |
+ .nf { color: $solar-blue !important; font-weight: bold !important; } /* Name.Function */ |
|
165 |
+ .nn { color: $solar-yellow !important; } /* Name.Namespace */ |
|
166 |
+ .nt { color: $solar-blue !important; font-weight: bold !important; } /* Name.Tag */ |
|
167 |
+ .nx { color: $solar-yellow !Important; } |
|
168 |
+ //.bp { color: #999999 } /* Name.Builtin.Pseudo */ |
|
169 |
+ //.vc { color: #008080 } /* Name.Variable.Class */ |
|
170 |
+ .vg { color: $solar-blue !important; } /* Name.Variable.Global */ |
|
171 |
+ .vi { color: $solar-blue !important; } /* Name.Variable.Instance */ |
|
172 |
+ .nv { color: $solar-blue !important; } /* Name.Variable */ |
|
173 |
+ //.w { color: #bbbbbb } /* Text.Whitespace */ |
|
174 |
+ .mf { color: $solar-cyan !important; } /* Literal.Number.Float */ |
|
175 |
+ .m { color: $solar-cyan !important; } /* Literal.Number */ |
|
176 |
+ .mh { color: $solar-cyan !important; } /* Literal.Number.Hex */ |
|
177 |
+ .mi { color: $solar-cyan !important; } /* Literal.Number.Integer */ |
|
178 |
+ //.mo { color: #009999 } /* Literal.Number.Oct */ |
|
179 |
+ .s { color: $solar-cyan !important; } /* Literal.String */ |
|
180 |
+ //.sb { color: #d14 } /* Literal.String.Backtick */ |
|
181 |
+ //.sc { color: #d14 } /* Literal.String.Char */ |
|
182 |
+ .sd { color: $solar-cyan !important; } /* Literal.String.Doc */ |
|
183 |
+ .s2 { color: $solar-cyan !important; } /* Literal.String.Double */ |
|
184 |
+ .se { color: $solar-red !important; } /* Literal.String.Escape */ |
|
185 |
+ //.sh { color: #d14 } /* Literal.String.Heredoc */ |
|
186 |
+ .si { color: $solar-blue !important; } /* Literal.String.Interpol */ |
|
187 |
+ //.sx { color: #d14 } /* Literal.String.Other */ |
|
188 |
+ .sr { color: $solar-cyan !important; } /* Literal.String.Regex */ |
|
189 |
+ .s1 { color: $solar-cyan !important; } /* Literal.String.Single */ |
|
190 |
+ //.ss { color: #990073 } /* Literal.String.Symbol */ |
|
191 |
+ //.il { color: #009999 } /* Literal.Number.Integer.Long */ |
|
192 |
+ div { .gd, .gd .x, .gi, .gi .x { display: inline-block; width: 100%; }} |
|
193 |
+} |
|
194 |
+ |
|
195 |
+.highlight, .gist-highlight { |
|
196 |
+ pre { background: none; @include border-radius(0px); border: none; padding: 0; margin-bottom: 0; } |
|
197 |
+ margin-bottom: 1.8em; |
|
198 |
+ background: $base03; |
|
199 |
+ overflow-y: hidden; |
|
200 |
+ overflow-x: auto; |
|
201 |
+} |
|
202 |
+ |
|
203 |
+$solar-scroll-bg: rgba(#fff, .15); |
|
204 |
+$solar-scroll-thumb: rgba(#fff, .2); |
|
205 |
+@if $solarized == light { |
|
206 |
+ $solar-scroll-bg: rgba(#000, .15); |
|
207 |
+ $solar-scroll-thumb: rgba(#000, .15); |
|
208 |
+} |
|
209 |
+ |
|
210 |
+pre, .highlight, .gist-highlight { |
|
211 |
+ &::-webkit-scrollbar { height: .5em; background: $solar-scroll-bg; } |
|
212 |
+ &::-webkit-scrollbar-thumb:horizontal { background: $solar-scroll-thumb; -webkit-border-radius: 4px; border-radius: 4px } |
|
213 |
+} |
|
214 |
+ |
|
215 |
+.highlight code { |
|
216 |
+ @extend .pre-code; background: #000; |
|
217 |
+} |
|
218 |
+figure.code { |
|
219 |
+ background: none; |
|
220 |
+ padding: 0; |
|
221 |
+ border: 0; |
|
222 |
+ margin-bottom: 1.5em; |
|
223 |
+ pre { margin-bottom: 0; } |
|
224 |
+ figcaption { |
|
225 |
+ position: relative; |
|
226 |
+ @extend .code-title; |
|
227 |
+ a { @extend .download-source; } |
|
228 |
+ } |
|
229 |
+ .highlight { |
|
230 |
+ margin-bottom: 0; |
|
231 |
+ } |
|
232 |
+} |
|
233 |
+ |
|
234 |
+.code-title { |
|
235 |
+ text-align: center; |
|
236 |
+ font-size: 13px; |
|
237 |
+ line-height: 2em; |
|
238 |
+ text-shadow: #cbcccc 0 1px 0; |
|
239 |
+ color: #474747; |
|
240 |
+ font-weight: normal; |
|
241 |
+ margin-bottom: 0; |
|
242 |
+ @include border-top-radius(5px); |
|
243 |
+ font-family: "Helvetica Neue", Arial, "Lucida Grande", "Lucida Sans Unicode", Lucida, sans-serif; |
|
244 |
+ background: #aaaaaa image-url("code_bg.png") top repeat-x; |
|
245 |
+ border: 1px solid #565656; |
|
246 |
+ border-top-color: #cbcbcb; |
|
247 |
+ border-left-color: #a5a5a5; |
|
248 |
+ border-right-color: #a5a5a5; |
|
249 |
+ border-bottom: 0; |
|
250 |
+} |
|
251 |
+ |
|
252 |
+.download-source { |
|
253 |
+ position: absolute; right: .8em; |
|
254 |
+ @include hover-link; |
|
255 |
+ color: #666 !important; |
|
256 |
+ z-index: 1; |
|
257 |
+ font-size: 13px; |
|
258 |
+ text-shadow: #cbcccc 0 1px 0; |
|
259 |
+ padding-left: 3em; |
|
260 |
+} |
0 | 261 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,106 @@ |
0 |
+.side-shadow-border { |
|
1 |
+ @include box-shadow(lighten($sidebar-bg, 5) 0 1px); |
|
2 |
+} |
|
3 |
+aside.sidebar { |
|
4 |
+ overflow: hidden; |
|
5 |
+ color: $sidebar-color; |
|
6 |
+ text-shadow: lighten($sidebar-bg, 8) 0 1px; |
|
7 |
+ a { @extend .force-wrap; } |
|
8 |
+ section { |
|
9 |
+ @extend .sans; |
|
10 |
+ font-size: .8em; |
|
11 |
+ line-height: 1.4em; |
|
12 |
+ margin-bottom: 1.5em; |
|
13 |
+ h1 { |
|
14 |
+ margin: 1.5em 0 0; |
|
15 |
+ padding-bottom: .2em; |
|
16 |
+ border-bottom: 1px solid $sidebar-border; |
|
17 |
+ @extend .side-shadow-border; |
|
18 |
+ + p { |
|
19 |
+ padding-top: .4em; |
|
20 |
+ } |
|
21 |
+ } |
|
22 |
+ } |
|
23 |
+ img { |
|
24 |
+ @extend .flex-content; |
|
25 |
+ @extend .basic-alignment; |
|
26 |
+ @include shadow-box($border: #fff .3em solid); |
|
27 |
+ } |
|
28 |
+ ul { |
|
29 |
+ margin-bottom: 0.5em; |
|
30 |
+ margin-left: 0; |
|
31 |
+ } |
|
32 |
+ li { |
|
33 |
+ list-style: none; |
|
34 |
+ padding: .5em 0; |
|
35 |
+ margin: 0; |
|
36 |
+ border-bottom: 1px solid $sidebar-border; |
|
37 |
+ @extend .side-shadow-border; |
|
38 |
+ p:last-child { |
|
39 |
+ margin-bottom: 0; |
|
40 |
+ } |
|
41 |
+ } |
|
42 |
+ a { |
|
43 |
+ color: inherit; |
|
44 |
+ @include transition(color .5s); |
|
45 |
+ } |
|
46 |
+ &:hover a { |
|
47 |
+ color: $sidebar-link-color; |
|
48 |
+ &:hover { color: $sidebar-link-color-hover; } |
|
49 |
+ } |
|
50 |
+} |
|
51 |
+.aside-alt-link { |
|
52 |
+ color: $sidebar-link-color-subdued; |
|
53 |
+ &:hover { |
|
54 |
+ color: $sidebar-link-color-subdued-hover; |
|
55 |
+ } |
|
56 |
+} |
|
57 |
+ |
|
58 |
+@media only screen and (min-width: 768px) { |
|
59 |
+ .toggle-sidebar { |
|
60 |
+ outline: none; |
|
61 |
+ position: absolute; right: -10px; top: 0; bottom: 0; |
|
62 |
+ display: inline-block; |
|
63 |
+ text-decoration: none; |
|
64 |
+ color: mix($text-color-light, $sidebar-bg); |
|
65 |
+ width: 9px; |
|
66 |
+ cursor: pointer; |
|
67 |
+ &:hover { |
|
68 |
+ background: mix($sidebar-border, $sidebar-bg); |
|
69 |
+ @include background(linear-gradient(left, rgba($sidebar-border, .5), rgba($sidebar-border, 0))); |
|
70 |
+ } |
|
71 |
+ &:after { |
|
72 |
+ position: absolute; right: -11px; top: 0; |
|
73 |
+ width: 20px; |
|
74 |
+ font-size: 1.2em; |
|
75 |
+ line-height: 1.1em; |
|
76 |
+ padding-bottom: .15em; |
|
77 |
+ @include border-bottom-right-radius(.3em); |
|
78 |
+ text-align: center; |
|
79 |
+ background: $main-bg $noise-bg; |
|
80 |
+ border-bottom: 1px solid $sidebar-border; |
|
81 |
+ border-right: 1px solid $sidebar-border; |
|
82 |
+ content: "\00BB"; |
|
83 |
+ text-indent: -1px; |
|
84 |
+ } |
|
85 |
+ .collapse-sidebar & { |
|
86 |
+ text-indent: 0px; |
|
87 |
+ right: -20px; |
|
88 |
+ width: 19px; |
|
89 |
+ &:hover { |
|
90 |
+ background: mix($sidebar-border, $sidebar-bg); |
|
91 |
+ } |
|
92 |
+ &:after { |
|
93 |
+ border-left: 1px solid $sidebar-border; |
|
94 |
+ text-shadow: #fff 0 1px; |
|
95 |
+ content: "\00AB"; |
|
96 |
+ left: 0px; right: 0; |
|
97 |
+ text-align: center; |
|
98 |
+ text-indent: 0; |
|
99 |
+ border: 0; |
|
100 |
+ border-right-width: 0; |
|
101 |
+ background: none; |
|
102 |
+ } |
|
103 |
+ } |
|
104 |
+ } |
|
105 |
+} |
0 | 4 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,26 @@ |
0 |
+.googleplus { |
|
1 |
+ h1 { |
|
2 |
+ -moz-box-shadow: none !important; |
|
3 |
+ -webkit-box-shadow: none !important; |
|
4 |
+ -o-box-shadow: none !important; |
|
5 |
+ box-shadow: none !important; |
|
6 |
+ border-bottom: 0px none !important; |
|
7 |
+ } |
|
8 |
+ a { |
|
9 |
+ text-decoration: none; |
|
10 |
+ white-space: normal !important; |
|
11 |
+ line-height: 32px; |
|
12 |
+ |
|
13 |
+ img { |
|
14 |
+ float: left; |
|
15 |
+ margin-right: 0.5em; |
|
16 |
+ border: 0 none; |
|
17 |
+ } |
|
18 |
+ } |
|
19 |
+} |
|
20 |
+ |
|
21 |
+.googleplus-hidden { |
|
22 |
+ position: absolute; |
|
23 |
+ top: -1000em; |
|
24 |
+ left: -1000em; |
|
25 |
+} |
0 | 26 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,12 @@ |
0 |
+#pinboard_linkroll { |
|
1 |
+ .pin-title, .pin-description { |
|
2 |
+ display: block; |
|
3 |
+ margin-bottom: .5em; |
|
4 |
+ } |
|
5 |
+ .pin-tag { |
|
6 |
+ @include hover-link; |
|
7 |
+ @extend .aside-alt-link; |
|
8 |
+ &:after { content: ','; } |
|
9 |
+ &:last-child:after { content: ''; } |
|
10 |
+ } |
|
11 |
+} |
0 | 12 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,34 @@ |
0 |
+#tweets { |
|
1 |
+ .loading { |
|
2 |
+ background: inline-image('bird_32_gray.png') no-repeat center .5em; |
|
3 |
+ color: darken($sidebar-bg, 18); |
|
4 |
+ text-shadow: $main-bg 0 1px; |
|
5 |
+ text-align: center; |
|
6 |
+ padding: 2.5em 0 .5em; |
|
7 |
+ &.error { |
|
8 |
+ background: inline-image('bird_32_gray_fail.png') no-repeat center .5em; |
|
9 |
+ } |
|
10 |
+ } |
|
11 |
+ p { |
|
12 |
+ position: relative; |
|
13 |
+ padding-right: 1em; |
|
14 |
+ } |
|
15 |
+ a[href*=status]:first-child { |
|
16 |
+ color: $twitter-status-link; |
|
17 |
+ float: right; |
|
18 |
+ padding: 0 0 .1em 1em; |
|
19 |
+ position: relative; right: -1.3em; |
|
20 |
+ text-shadow: #fff 0 1px; |
|
21 |
+ font-size: .7em; |
|
22 |
+ span { font-size: 1.5em; } |
|
23 |
+ text-decoration: none; |
|
24 |
+ &:hover { |
|
25 |
+ color: $sidebar-link-color-subdued-hover; |
|
26 |
+ text-decoration: none; |
|
27 |
+ } |
|
28 |
+ } |
|
29 |
+ a[href*='twitter.com/search']{ |
|
30 |
+ @extend .aside-alt-link; |
|
31 |
+ @include hover-link; |
|
32 |
+ } |
|
33 |
+} |
0 | 5 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,8 @@ |
0 |
+{% capture category %}{{ post.categories | size }}{% endcapture %} |
|
1 |
+<h1><a href="{{ root_url }}{{ post.url }}">{{post.title}}</a></h1> |
|
2 |
+<time datetime="{{ post.date | datetime | date_to_xmlschema }}" pubdate>{{ post.date | date: "<span class='month'>%b</span> <span class='day'>%d</span> <span class='year'>%Y</span>"}}</time> |
|
3 |
+{% if category != '0' %} |
|
4 |
+<footer> |
|
5 |
+ <span class="categories">posted in {{ post.categories | category_links }}</span> |
|
6 |
+</footer> |
|
7 |
+{% endif %} |
0 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
0 |
+{% unless page.no_header %} |
|
1 |
+ <header> |
|
2 |
+ {% if index %} |
|
3 |
+ <h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}</a></h1> |
|
4 |
+ {% else %} |
|
5 |
+ <h1 class="entry-title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1> |
|
6 |
+ {% endif %} |
|
7 |
+ {% unless page.meta == false %} |
|
8 |
+ <p class="meta"> |
|
9 |
+ {% include post/date.html %}{{ time }} |
|
10 |
+ {% if site.disqus_short_name and page.comments != false and post.comments != false and site.disqus_show_comment_count == true %} |
|
11 |
+ | <a href="{% if index %}{{ root_url }}{{ post.url }}{% endif %}#disqus_thread">Comments</a> |
|
12 |
+ {% endif %} |
|
13 |
+ </p> |
|
14 |
+ {% endunless %} |
|
15 |
+ </header> |
|
16 |
+{% endunless %} |
|
17 |
+{% if index %} |
|
18 |
+ <div class="entry-content">{{ content | excerpt }}</div> |
|
19 |
+ {% capture excerpted %}{{ content | has_excerpt }}{% endcapture %} |
|
20 |
+ {% if excerpted == 'true' %} |
|
21 |
+ <footer> |
|
22 |
+ <a rel="full-article" href="{{ root_url }}{{ post.url }}">{{ site.excerpt_link }}</a> |
|
23 |
+ </footer> |
|
24 |
+ {% endif %} |
|
25 |
+{% else %} |
|
26 |
+<div class="entry-content">{{ content }}</div> |
|
27 |
+{% endif %} |
0 | 28 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,8 @@ |
0 |
+{% if site.delicious_user %} |
|
1 |
+<section> |
|
2 |
+ <h1>On Delicious</h1> |
|
3 |
+ <div id="delicious"></div> |
|
4 |
+ <script type="text/javascript" src="http://feeds.delicious.com/v2/json/{{ site.delicious_user }}?count={{ site.delicious_count }}&sort=date&callback=renderDeliciousLinks"></script> |
|
5 |
+ <p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks »</a></p> |
|
6 |
+</section> |
|
7 |
+{% endif %} |
|
0 | 8 |
\ No newline at end of file |
1 | 9 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,30 @@ |
0 |
+{% if site.github_user %} |
|
1 |
+<section> |
|
2 |
+ <h1>GitHub Repos</h1> |
|
3 |
+ <ul id="gh_repos"> |
|
4 |
+ <li class="loading">Status updating...</li> |
|
5 |
+ </ul> |
|
6 |
+ {% if site.github_show_profile_link %} |
|
7 |
+ <a href="https://github.com/{{site.github_user}}">@{{site.github_user}}</a> on GitHub |
|
8 |
+ {% endif %} |
|
9 |
+ <script type="text/javascript"> |
|
10 |
+ $.domReady(function(){ |
|
11 |
+ if (!window.jXHR){ |
|
12 |
+ var jxhr = document.createElement('script'); |
|
13 |
+ jxhr.type = 'text/javascript'; |
|
14 |
+ jxhr.src = '{{ root_url}}/javascripts/libs/jXHR.js'; |
|
15 |
+ var s = document.getElementsByTagName('script')[0]; |
|
16 |
+ s.parentNode.insertBefore(jxhr, s); |
|
17 |
+ } |
|
18 |
+ |
|
19 |
+ github.showRepos({ |
|
20 |
+ user: '{{site.github_user}}', |
|
21 |
+ count: {{site.github_repo_count}}, |
|
22 |
+ skip_forks: {{site.github_skip_forks}}, |
|
23 |
+ target: '#gh_repos' |
|
24 |
+ }); |
|
25 |
+ }); |
|
26 |
+ </script> |
|
27 |
+ <script src="{{ root_url }}/javascripts/github.js" type="text/javascript"> </script> |
|
28 |
+</section> |
|
29 |
+{% endif %} |
0 | 30 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,11 @@ |
0 |
+{% if site.googleplus_user %} |
|
1 |
+<section class="googleplus{% if site.googleplus_hidden %} googleplus-hidden{% endif %}"> |
|
2 |
+ <h1> |
|
3 |
+ <a href="https://plus.google.com/{{ site.googleplus_user }}?rel=author"> |
|
4 |
+ <img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32"> |
|
5 |
+ Google+ |
|
6 |
+ </a> |
|
7 |
+ </h1> |
|
8 |
+</section> |
|
9 |
+{% endif %} |
|
10 |
+ |
0 | 11 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
0 |
+{% if site.pinboard_user %} |
|
1 |
+<section> |
|
2 |
+ <h1>My Pinboard</h1> |
|
3 |
+ <ul id="pinboard_linkroll">Fetching linkroll...</ul> |
|
4 |
+ <p><a href="http://pinboard.in/u:{{ site.pinboard_user }}">My Pinboard Bookmarks »</a></p> |
|
5 |
+</section> |
|
6 |
+<script type="text/javascript"> |
|
7 |
+ var linkroll = 'pinboard_linkroll'; //id target for pinboard list |
|
8 |
+ var pinboard_user = "{{ site.pinboard_user }}"; //id target for pinboard list |
|
9 |
+ var pinboard_count = {{ site.pinboard_count }}; //id target for pinboard list |
|
10 |
+ (function(){ |
|
11 |
+ var pinboardInit = document.createElement('script'); |
|
12 |
+ pinboardInit.type = 'text/javascript'; |
|
13 |
+ pinboardInit.async = true; |
|
14 |
+ pinboardInit.src = '{{ root_url }}/javascripts/pinboard.js'; |
|
15 |
+ document.getElementsByTagName('head')[0].appendChild(pinboardInit); |
|
16 |
+ })(); |
|
17 |
+</script> |
|
18 |
+{% endif %} |
0 | 19 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,10 @@ |
0 |
+<section> |
|
1 |
+ <h1>Recent Posts</h1> |
|
2 |
+ <ul id="recent_posts"> |
|
3 |
+ {% for post in site.posts limit: site.recent_posts %} |
|
4 |
+ <li class="post"> |
|
5 |
+ <a href="{{ root_url }}{{ post.url }}">{{ post.title }}</a> |
|
6 |
+ </li> |
|
7 |
+ {% endfor %} |
|
8 |
+ </ul> |
|
9 |
+</section> |
0 | 10 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
0 |
+{% if site.twitter_user %} |
|
1 |
+<section> |
|
2 |
+ <h1>Latest Tweets</h1> |
|
3 |
+ <ul id="tweets"> |
|
4 |
+ <li class="loading">Status updating...</li> |
|
5 |
+ </ul> |
|
6 |
+ <script type="text/javascript"> |
|
7 |
+ $.domReady(function(){ |
|
8 |
+ getTwitterFeed("{{site.twitter_user}}", {{site.twitter_tweet_count}}, {{site.twitter_show_replies}}); |
|
9 |
+ }); |
|
10 |
+ </script> |
|
11 |
+ <script src="{{ root_url }}/javascripts/twitter.js" type="text/javascript"> </script> |
|
12 |
+ {% if site.twitter_follow_button %} |
|
13 |
+ <a href="http://twitter.com/{{ site.twitter_user }}" class="twitter-follow-button" data-show-count="{{ site.twitter_show_follower_count }}">Follow @{{ site.twitter_user }}</a> |
|
14 |
+ {% else %} |
|
15 |
+ <p>Follow <a href="http://twitter.com/{{site.twitter_user}}">@{{ site.twitter_user }}</a></p> |
|
16 |
+ {% endif %} |
|
17 |
+</section> |
|
18 |
+{% endif %} |
0 | 4 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
0 |
+--- |
|
1 |
+layout: nil |
|
2 |
+--- |
|
3 |
+<?xml version="1.0" encoding="utf-8"?> |
|
4 |
+<feed xmlns="http://www.w3.org/2005/Atom"> |
|
5 |
+ |
|
6 |
+ <title><![CDATA[{{ page.title }} | {{ site.title }}]]></title> |
|
7 |
+ <link href="{{ site.url }}/{{ page.feed_url }}" rel="self"/> |
|
8 |
+ <link href="{{ site.url }}/"/> |
|
9 |
+ <updated>{{ site.time | date_to_xmlschema }}</updated> |
|
10 |
+ <id>{{ site.url }}/</id> |
|
11 |
+ <author> |
|
12 |
+ <name><![CDATA[{{ site.author | strip_html }}]]></name> |
|
13 |
+ {% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %} |
|
14 |
+ </author> |
|
15 |
+ <generator uri="http://octopress.org/">Octopress</generator> |
|
16 |
+ |
|
17 |
+ {% for post in site.categories[page.category] limit: 5 %} |
|
18 |
+ <entry> |
|
19 |
+ <title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title> |
|
20 |
+ <link href="{{ site.url }}{{ post.url }}"/> |
|
21 |
+ <updated>{{ post.date | date_to_xmlschema }}</updated> |
|
22 |
+ <id>{{ site.url }}{{ post.id }}</id> |
|
23 |
+ <content type="html"><![CDATA[{{ post.content | expand_urls: site.url | markdownify | cdata_escape }}]]></content> |
|
24 |
+ </entry> |
|
25 |
+ {% endfor %} |
|
26 |
+</feed> |
0 | 4 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,3 @@ |
0 |
+<!--Fonts from Google"s Web font directory at http://google.com/webfonts --> |
|
1 |
+<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css"> |
|
2 |
+<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css"> |
0 | 4 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
0 |
+{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} |
|
1 |
+{% if site.disqus_short_name and page.comments != false %} |
|
2 |
+<script type="text/javascript"> |
|
3 |
+ var disqus_shortname = '{{ site.disqus_short_name }}'; |
|
4 |
+ {% if page.comments == true %} |
|
5 |
+ {% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} |
|
6 |
+ // var disqus_developer = 1; |
|
7 |
+ var disqus_identifier = '{{ site.url }}{{ page.url }}'; |
|
8 |
+ var disqus_url = '{{ site.url }}{{ page.url }}'; |
|
9 |
+ var disqus_script = 'embed.js'; |
|
10 |
+ {% else %} |
|
11 |
+ {% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %} |
|
12 |
+ var disqus_script = 'count.js'; |
|
13 |
+ {% endif %} |
|
14 |
+ (function () { |
|
15 |
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; |
|
16 |
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script; |
|
17 |
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); |
|
18 |
+ }()); |
|
19 |
+</script> |
|
20 |
+{% endif %} |
0 | 21 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,10 @@ |
0 |
+{% if site.facebook_like %} |
|
1 |
+<div id="fb-root"></div> |
|
2 |
+<script>(function(d, s, id) { |
|
3 |
+ var js, fjs = d.getElementsByTagName(s)[0]; |
|
4 |
+ if (d.getElementById(id)) {return;} |
|
5 |
+ js = d.createElement(s); js.id = id; |
|
6 |
+ js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1"; |
|
7 |
+ fjs.parentNode.insertBefore(js, fjs); |
|
8 |
+}(document, 'script', 'facebook-jssdk'));</script> |
|
9 |
+{% endif %} |
0 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,13 @@ |
0 |
+{% if site.google_analytics_tracking_id %} |
|
1 |
+ <script type="text/javascript"> |
|
2 |
+ var _gaq = _gaq || []; |
|
3 |
+ _gaq.push(['_setAccount', '{{ site.google_analytics_tracking_id }}']); |
|
4 |
+ _gaq.push(['_trackPageview']); |
|
5 |
+ |
|
6 |
+ (function() { |
|
7 |
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
|
8 |
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
|
9 |
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
|
10 |
+ })(); |
|
11 |
+ </script> |
|
12 |
+{% endif %} |
0 | 13 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,9 @@ |
0 |
+{% if site.google_plus_one %} |
|
1 |
+ <script type="text/javascript"> |
|
2 |
+ (function() { |
|
3 |
+ var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; |
|
4 |
+ script.src = 'https://apis.google.com/js/plusone.js'; |
|
5 |
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s); |
|
6 |
+ })(); |
|
7 |
+ </script> |
|
8 |
+{% endif %} |
0 | 9 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,29 @@ |
0 |
+<!DOCTYPE html> |
|
1 |
+<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]--> |
|
2 |
+<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]--> |
|
3 |
+<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]--> |
|
4 |
+<head> |
|
5 |
+ <meta charset="utf-8"> |
|
6 |
+ <title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title> |
|
7 |
+ <meta name="author" content="{{ site.author }}"> |
|
8 |
+ |
|
9 |
+ {% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %} |
|
10 |
+ <meta name="description" content="{{ description | strip_html | condense_spaces | truncate:150 }}"> |
|
11 |
+ {% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{% endif %} |
|
12 |
+ |
|
13 |
+ <!-- http://t.co/dKP3o1e --> |
|
14 |
+ <meta name="HandheldFriendly" content="True"> |
|
15 |
+ <meta name="MobileOptimized" content="320"> |
|
16 |
+ <meta name="viewport" content="width=device-width, initial-scale=1"> |
|
17 |
+ |
|
18 |
+ {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{% if page.url contains site.category_dir %}/{% endif %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %} |
|
19 |
+ <link rel="canonical" href="{{ canonical }}"> |
|
20 |
+ <link href="{{ root_url }}/favicon.png" rel="icon"> |
|
21 |
+ <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> |
|
22 |
+ <script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script> |
|
23 |
+ <script src="{{ root_url }}/javascripts/ender.js"></script> |
|
24 |
+ <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script> |
|
25 |
+ <link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml"> |
|
26 |
+ {% include custom/head.html %} |
|
27 |
+ {% include google_analytics.html %} |
|
28 |
+</head> |
0 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
0 |
+<ul class="subscription" data-subscription="rss{% if site.subscribe_email %} email{% endif %}"> |
|
1 |
+ <li><a href="{{ site.subscribe_rss }}" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li> |
|
2 |
+ {% if site.subscribe_email %} |
|
3 |
+ <li><a href="{{ site.subscribe_email }}" rel="subscribe-email" title="subscribe via email">Email</a></li> |
|
4 |
+ {% endif %} |
|
5 |
+</ul> |
|
6 |
+ {% if site.simple_search %} |
|
7 |
+<form action="{{ site.simple_search }}" method="get"> |
|
8 |
+ <fieldset role="search"> |
|
9 |
+ <input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" /> |
|
10 |
+ <input class="search" type="text" name="q" results="0" placeholder="Search"/> |
|
11 |
+ </fieldset> |
|
12 |
+</form> |
|
13 |
+ {% endif %} |
|
14 |
+{% include custom/navigation.html %} |
0 | 15 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,8 @@ |
0 |
+{% if post.author %} |
|
1 |
+ {% assign author = post.author %} |
|
2 |
+{% elsif page.author %} |
|
3 |
+ {% assign author = page.author %} |
|
4 |
+{% else %} |
|
5 |
+ {% assign author = site.author %} |
|
6 |
+{% endif %} |
|
7 |
+{% if author %}<span class="byline author vcard">Posted by <span class="fn">{{ author }}</span></span>{% endif %} |
0 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,10 @@ |
0 |
+{% capture category %}{% if post %}{{ post.categories | category_links | size }}{% else %}{{ page.categories | category_links | size }}{% endif %}{% endcapture %} |
|
1 |
+{% unless category == '0' %} |
|
2 |
+<span class="categories"> |
|
3 |
+ {% if post %} |
|
4 |
+ {{ post.categories | category_links }} |
|
5 |
+ {% else %} |
|
6 |
+ {{ page.categories | category_links }} |
|
7 |
+ {% endif %} |
|
8 |
+</span> |
|
9 |
+{% endunless %} |
0 | 10 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
0 |
+{% capture date %}{{ page.date }}{{ post.date }}{% endcapture %} |
|
1 |
+{% capture date_formatted %}{{ page.date_formatted }}{{ post.date_formatted }}{% endcapture %} |
|
2 |
+{% capture has_date %}{{ date | size }}{% endcapture %} |
|
3 |
+ |
|
4 |
+{% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %} |
|
5 |
+{% capture updated_formatted %}{{ page.updated_formatted }}{{ post.updated_formatted }}{% endcapture %} |
|
6 |
+{% capture was_updated %}{{ updated | size }}{% endcapture %} |
|
7 |
+ |
|
8 |
+{% if has_date != '0' %} |
|
9 |
+ {% capture time %}<time datetime="{{ date | datetime | date_to_xmlschema }}" pubdate{% if updated %} data-updated="true"{% endif %}>{{ date_formatted }}</time>{% endcapture %} |
|
10 |
+{% endif %} |
|
11 |
+ |
|
12 |
+{% if was_updated != '0' %} |
|
13 |
+ {% capture updated %}<time datetime="{{ updated | datetime | date_to_xmlschema }}" class="updated">Updated {{ updated_formatted }}</time>{% endcapture %} |
|
14 |
+{% else %}{% assign updated = false %}{% endif %} |
|
0 | 15 |
\ No newline at end of file |
0 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,11 @@ |
0 |
+<div class="sharing"> |
|
1 |
+ {% if site.twitter_tweet_button %} |
|
2 |
+ <a href="http://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}{{ page.url }}" data-via="{{ site.twitter_user }}" data-counturl="{{ site.url }}{{ page.url }}" >Tweet</a> |
|
3 |
+ {% endif %} |
|
4 |
+ {% if site.google_plus_one %} |
|
5 |
+ <div class="g-plusone" data-size="{{ site.google_plus_one_size }}"></div> |
|
6 |
+ {% endif %} |
|
7 |
+ {% if site.facebook_like %} |
|
8 |
+ <div class="fb-like" data-send="true" data-width="450" data-show-faces="false"></div> |
|
9 |
+ {% endif %} |
|
10 |
+</div> |
0 | 11 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,11 @@ |
0 |
+{% if site.twitter_follow_button or site.twitter_tweet_button %} |
|
1 |
+ <script type="text/javascript"> |
|
2 |
+ (function(){ |
|
3 |
+ var twitterWidgets = document.createElement('script'); |
|
4 |
+ twitterWidgets.type = 'text/javascript'; |
|
5 |
+ twitterWidgets.async = true; |
|
6 |
+ twitterWidgets.src = 'http://platform.twitter.com/widgets.js'; |
|
7 |
+ document.getElementsByTagName('head')[0].appendChild(twitterWidgets); |
|
8 |
+ })(); |
|
9 |
+ </script> |
|
10 |
+{% endif %} |
0 | 11 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
0 |
+--- |
|
1 |
+layout: page |
|
2 |
+footer: false |
|
3 |
+--- |
|
4 |
+ |
|
5 |
+<div id="blog-archives" class="category"> |
|
6 |
+{% for post in site.categories[page.category] %} |
|
7 |
+{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} |
|
8 |
+{% unless year == this_year %} |
|
9 |
+ {% assign year = this_year %} |
|
10 |
+ <h2>{{ year }}</h2> |
|
11 |
+{% endunless %} |
|
12 |
+<article> |
|
13 |
+ {% include archive_post.html %} |
|
14 |
+</article> |
|
15 |
+{% endfor %} |
|
16 |
+</div> |
0 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,14 @@ |
0 |
+{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %} |
|
1 |
+{% include head.html %} |
|
2 |
+<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %} {% if page.sidebar == 'collapse' or site.sidebar == 'collapse' %} class="collapse-sidebar sidebar-footer" {% endif %}> |
|
3 |
+ <header role="banner">{% include header.html %}</header> |
|
4 |
+ <nav role="navigation">{% include navigation.html %}</nav> |
|
5 |
+ <div id="main"> |
|
6 |
+ <div id="content"> |
|
7 |
+ {{ content | expand_urls: root_url }} |
|
8 |
+ </div> |
|
9 |
+ </div> |
|
10 |
+ <footer role="contentinfo">{% include footer.html %}</footer> |
|
11 |
+ {% include after_footer.html %} |
|
12 |
+</body> |
|
13 |
+</html> |
0 | 14 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,42 @@ |
0 |
+--- |
|
1 |
+layout: default |
|
2 |
+--- |
|
3 |
+ |
|
4 |
+<div> |
|
5 |
+<article role="article"> |
|
6 |
+ {% if page.title %} |
|
7 |
+ <header> |
|
8 |
+ <h1 class="entry-title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1> |
|
9 |
+ {% if page.date %}<p class="meta">{% include post/date.html %}{{ time }}</p>{% endif %} |
|
10 |
+ </header> |
|
11 |
+ {% endif %} |
|
12 |
+ {{ content }} |
|
13 |
+ {% unless page.footer == false %} |
|
14 |
+ <footer> |
|
15 |
+ {% if page.date or page.author %}<p class="meta"> |
|
16 |
+ {% if page.author %}{% include post/author.html %}{% endif %} |
|
17 |
+ {% include post/date.html %}{% if updated %}{{ updated }}{% else %}{{ time }}{% endif %} |
|
18 |
+ {% if page.categories %}{% include post/categories.html %}{% endif %} |
|
19 |
+ </p>{% endif %} |
|
20 |
+ {% unless page.sharing == false %} |
|
21 |
+ {% include post/sharing.html %} |
|
22 |
+ {% endunless %} |
|
23 |
+ </footer> |
|
24 |
+ {% endunless %} |
|
25 |
+</article> |
|
26 |
+{% if site.disqus_short_name and page.comments == true %} |
|
27 |
+ <section> |
|
28 |
+ <h1>Comments</h1> |
|
29 |
+ <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div> |
|
30 |
+ </section> |
|
31 |
+{% endif %} |
|
32 |
+</div> |
|
33 |
+{% unless page.sidebar == false %} |
|
34 |
+<aside class="sidebar"> |
|
35 |
+ {% if site.page_asides.size %} |
|
36 |
+ {% include_array page_asides %} |
|
37 |
+ {% else %} |
|
38 |
+ {% include_array default_asides %} |
|
39 |
+ {% endif %} |
|
40 |
+</aside> |
|
41 |
+{% endunless %} |
0 | 42 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,43 @@ |
0 |
+--- |
|
1 |
+layout: default |
|
2 |
+single: true |
|
3 |
+--- |
|
4 |
+ |
|
5 |
+<div> |
|
6 |
+<article class="hentry" role="article"> |
|
7 |
+ {% include article.html %} |
|
8 |
+ <footer> |
|
9 |
+ <p class="meta"> |
|
10 |
+ {% include post/author.html %} |
|
11 |
+ {% include post/date.html %}{% if updated %}{{ updated }}{% else %}{{ time }}{% endif %} |
|
12 |
+ {% include post/categories.html %} |
|
13 |
+ </p> |
|
14 |
+ {% unless page.sharing == false %} |
|
15 |
+ {% include post/sharing.html %} |
|
16 |
+ {% endunless %} |
|
17 |
+ <p class="meta"> |
|
18 |
+ {% if page.previous.url %} |
|
19 |
+ <a class="basic-alignment left" href="{{page.previous.url}}" title="Previous Post: {{page.previous.title}}">« {{page.previous.title}}</a> |
|
20 |
+ {% endif %} |
|
21 |
+ {% if page.next.url %} |
|
22 |
+ <a class="basic-alignment right" href="{{page.next.url}}" title="Next Post: {{page.next.title}}">{{page.next.title}} »</a> |
|
23 |
+ {% endif %} |
|
24 |
+ </p> |
|
25 |
+ </footer> |
|
26 |
+</article> |
|
27 |
+{% if site.disqus_short_name and page.comments == true %} |
|
28 |
+ <section> |
|
29 |
+ <h1>Comments</h1> |
|
30 |
+ <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div> |
|
31 |
+ </section> |
|
32 |
+{% endif %} |
|
33 |
+</div> |
|
34 |
+{% unless page.sidebar == false %} |
|
35 |
+<aside class="sidebar"> |
|
36 |
+ {% if site.post_asides.size %} |
|
37 |
+ {% include_array post_asides %} |
|
38 |
+ {% else %} |
|
39 |
+ {% include_array default_asides %} |
|
40 |
+ {% endif %} |
|
41 |
+</aside> |
|
42 |
+{% endunless %} |
50 | 93 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,115 @@ |
0 |
+<?xml version="1.0"?> |
|
1 |
+<skin version="1.1" name="Glow" author="LongTail Video"> |
|
2 |
+ |
|
3 |
+ <settings> |
|
4 |
+ <setting name="backcolor" value="0x000000" /> |
|
5 |
+ <setting name="frontcolor" value="0xeeeeee" /> |
|
6 |
+ <setting name="lightcolor" value="0xeeeeee" /> |
|
7 |
+ <setting name="screencolor" value="0x000000" /> |
|
8 |
+ </settings> |
|
9 |
+ |
|
10 |
+ <components> |
|
11 |
+ <component name="controlbar"> |
|
12 |
+ <settings> |
|
13 |
+ <setting name="margin" value="0" /> |
|
14 |
+ <setting name="fontsize" value="11" /> |
|
15 |
+ <setting name="fontcolor" value="0xEEEEEE" /> |
|
16 |
+ <setting name="buttoncolor" value="0xEEEEEE" /> |
|
17 |
+ </settings> |
|
18 |
+ |
|
19 |
+ <layout> |
|
20 |
+ <group position="left"> |
|
21 |
+ <button name="play" /> |
|
22 |
+ <text name="elapsed" /> |
|
23 |
+ </group> |
|
24 |
+ <group position="center"> |
|
25 |
+ <slider name="time" /> |
|
26 |
+ </group> |
|
27 |
+ <group position="right"> |
|
28 |
+ <text name="duration" /> |
|
29 |
+ <button name="blank" /> |
|
30 |
+ <button name="mute" /> |
|
31 |
+ <button name="fullscreen" /> |
|
32 |
+ </group> |
|
33 |
+ </layout> |
|
34 |
+ |
|
35 |
+ <elements> |
|
36 |
+ <element name="background" src="background.png" /> |
|
37 |
+ <element name="capLeft" src="divider.png" /> |
|
38 |
+ <element name="capRight" src="divider.png" /> |
|
39 |
+ <element name="divider" src="divider.png" /> |
|
40 |
+ <element name="blankButton" src="blankButton.png" /> |
|
41 |
+ <element name="fullscreenButton" src="fullscreenButton.png" /> |
|
42 |
+ <element name="fullscreenButtonOver" src="fullscreenButtonOver.png" /> |
|
43 |
+ <element name="muteButton" src="muteButton.png" /> |
|
44 |
+ <element name="muteButtonOver" src="muteButtonOver.png" /> |
|
45 |
+ <element name="pauseButton" src="pauseButton.png" /> |
|
46 |
+ <element name="pauseButtonOver" src="pauseButtonOver.png" /> |
|
47 |
+ <element name="playButton" src="playButton.png" /> |
|
48 |
+ <element name="playButtonOver" src="playButtonOver.png" /> |
|
49 |
+ <element name="timeSliderBuffer" src="timeSliderBuffer.png" /> |
|
50 |
+ <element name="timeSliderCapLeft" src="timeSliderCapLeft.png" /> |
|
51 |
+ <element name="timeSliderCapRight" src="timeSliderCapRight.png" /> |
|
52 |
+ <element name="timeSliderProgress" src="timeSliderProgress.png" /> |
|
53 |
+ <element name="timeSliderRail" src="timeSliderRail.png" /> |
|
54 |
+ <element name="normalscreenButton" src="normalscreenButton.png" /> |
|
55 |
+ <element name="normalscreenButtonOver" src="normalscreenButtonOver.png" /> |
|
56 |
+ <element name="unmuteButton" src="unmuteButton.png" /> |
|
57 |
+ <element name="unmuteButtonOver" src="unmuteButtonOver.png" /> |
|
58 |
+ <element name="volumeSliderRail" src="divider.png" /> |
|
59 |
+ <element name="volumeSliderProgress" src="divider.png" /> |
|
60 |
+ </elements> |
|
61 |
+ </component> |
|
62 |
+ |
|
63 |
+ <component name="display"> |
|
64 |
+ <settings> |
|
65 |
+ <setting name="bufferinterval" value="250" /> |
|
66 |
+ <setting name="bufferrotation" value="90" /> |
|
67 |
+ </settings> |
|
68 |
+ <elements> |
|
69 |
+ <element name="background" src="background.png" /> |
|
70 |
+ <element name="playIcon" src="playIcon.png" /> |
|
71 |
+ <element name="muteIcon" src="muteIcon.png" /> |
|
72 |
+ <element name="errorIcon" src="bufferIcon.png" /> |
|
73 |
+ <element name="bufferIcon" src="bufferIcon.png" /> |
|
74 |
+ </elements> |
|
75 |
+ </component> |
|
76 |
+ |
|
77 |
+ <component name="dock"> |
|
78 |
+ <settings> |
|
79 |
+ <setting name="fontcolor" value="0xFFFFFF" /> |
|
80 |
+ </settings> |
|
81 |
+ <elements> |
|
82 |
+ <element name="button" src="button.png" /> |
|
83 |
+ </elements> |
|
84 |
+ </component> |
|
85 |
+ |
|
86 |
+ <component name="playlist"> |
|
87 |
+ <settings> |
|
88 |
+ <setting name="fontcolor" value="0xEEEEEE" /> |
|
89 |
+ <setting name="overcolor" value="0xFFFFFF" /> |
|
90 |
+ <setting name="activecolor" value="0xFFFFFF" /> |
|
91 |
+ <setting name="backgroundcolor" value="0x333333" /> |
|
92 |
+ </settings> |
|
93 |
+ <elements> |
|
94 |
+ <element name="item" src="item.png" /> |
|
95 |
+ <element name="itemOver" src="itemOver.png" /> |
|
96 |
+ <element name="sliderCapBottom" src="sliderCapBottom.png" /> |
|
97 |
+ <element name="sliderCapTop" src="sliderCapTop.png" /> |
|
98 |
+ <element name="sliderRail" src="sliderRail.png" /> |
|
99 |
+ <element name="sliderThumb" src="sliderThumb.png" /> |
|
100 |
+ </elements> |
|
101 |
+ </component> |
|
102 |
+ |
|
103 |
+ <component name="sharing"> |
|
104 |
+ <elements> |
|
105 |
+ <element name="embedIcon" src="embedIcon.png" /> |
|
106 |
+ <element name="embedScreen" src="embedScreen.png" /> |
|
107 |
+ <element name="shareIcon" src="shareIcon.png" /> |
|
108 |
+ <element name="shareScreen" src="shareScreen.png" /> |
|
109 |
+ </elements> |
|
110 |
+ </component> |
|
111 |
+ |
|
112 |
+ </components> |
|
113 |
+ |
|
114 |
+</skin> |
|
0 | 115 |
\ No newline at end of file |
23 | 138 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
0 |
+--- |
|
1 |
+layout: nil |
|
2 |
+--- |
|
3 |
+<?xml version="1.0" encoding="utf-8"?> |
|
4 |
+<feed xmlns="http://www.w3.org/2005/Atom"> |
|
5 |
+ |
|
6 |
+ <title><![CDATA[{{ site.title }}]]></title> |
|
7 |
+ <link href="{{ site.url }}/atom.xml" rel="self"/> |
|
8 |
+ <link href="{{ site.url }}/"/> |
|
9 |
+ <updated>{{ site.time | date_to_xmlschema }}</updated> |
|
10 |
+ <id>{{ site.url }}/</id> |
|
11 |
+ <author> |
|
12 |
+ <name><![CDATA[{{ site.author | strip_html }}]]></name> |
|
13 |
+ {% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %} |
|
14 |
+ </author> |
|
15 |
+ <generator uri="http://octopress.org/">Octopress</generator> |
|
16 |
+ |
|
17 |
+ {% for post in site.posts limit: 20 %} |
|
18 |
+ <entry> |
|
19 |
+ <title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title> |
|
20 |
+ <link href="{{ site.url }}{{ post.url }}"/> |
|
21 |
+ <updated>{{ post.date | date_to_xmlschema }}</updated> |
|
22 |
+ <id>{{ site.url }}{{ post.id }}</id> |
|
23 |
+ <content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}]]></content> |
|
24 |
+ </entry> |
|
25 |
+ {% endfor %} |
|
26 |
+</feed> |
0 | 27 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
0 |
+--- |
|
1 |
+layout: page |
|
2 |
+title: Blog Archive |
|
3 |
+footer: false |
|
4 |
+--- |
|
5 |
+ |
|
6 |
+<div id="blog-archives"> |
|
7 |
+{% for post in site.posts reverse %} |
|
8 |
+{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} |
|
9 |
+{% unless year == this_year %} |
|
10 |
+ {% assign year = this_year %} |
|
11 |
+ <h2>{{ year }}</h2> |
|
12 |
+{% endunless %} |
|
13 |
+<article> |
|
14 |
+ {% include archive_post.html %} |
|
15 |
+</article> |
|
16 |
+{% endfor %} |
|
17 |
+</div> |
20 | 38 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,29 @@ |
0 |
+--- |
|
1 |
+layout: default |
|
2 |
+--- |
|
3 |
+ |
|
4 |
+<div class="blog-index"> |
|
5 |
+ {% assign index = true %} |
|
6 |
+ {% for post in paginator.posts %} |
|
7 |
+ {% assign content = post.content %} |
|
8 |
+ <article> |
|
9 |
+ {% include article.html %} |
|
10 |
+ </article> |
|
11 |
+ {% endfor %} |
|
12 |
+ <div class="pagination"> |
|
13 |
+ {% if paginator.next_page %} |
|
14 |
+ <a class="prev" href="{{paginator.next_page}}">← Older</a> |
|
15 |
+ {% endif %} |
|
16 |
+ <a href="/blog/archives">Blog Archives</a> |
|
17 |
+ {% if paginator.previous_page %} |
|
18 |
+ <a class="next" href="{{paginator.previous_page}}">Newer →</a> |
|
19 |
+ {% endif %} |
|
20 |
+ </div> |
|
21 |
+</div> |
|
22 |
+<aside class="sidebar"> |
|
23 |
+ {% if site.blog_index_asides.size %} |
|
24 |
+ {% include_array blog_index_asides %} |
|
25 |
+ {% else %} |
|
26 |
+ {% include_array default_asides %} |
|
27 |
+ {% endif %} |
|
28 |
+</aside> |
0 | 29 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,45 @@ |
0 |
+/*! |
|
1 |
+ * ============================================================= |
|
2 |
+ * Ender: open module JavaScript framework (https://ender.no.de) |
|
3 |
+ * Build: ender build jeesh reqwest |
|
4 |
+ * ============================================================= |
|
5 |
+ */ |
|
6 |
+ |
|
7 |
+ |
|
8 |
+/*! |
|
9 |
+ * Ender: open module JavaScript framework (client-lib) |
|
10 |
+ * copyright Dustin Diaz & Jacob Thornton 2011-2012 (@ded @fat) |
|
11 |
+ * http://ender.jit.su |
|
12 |
+ * License MIT |
|
13 |
+ */ |
|
14 |
+(function(context){function require(identifier){var module=modules["$"+identifier]||window[identifier];if(!module)throw new Error("Ender Error: Requested module '"+identifier+"' has not been defined.");return module}function provide(name,what){return modules["$"+name]=what}function aug(o,o2){for(var k in o2)k!="noConflict"&&k!="_VERSION"&&(o[k]=o2[k]);return o}function Ender(s,r){var elements,i;this.selector=s;if(typeof s=="undefined"){elements=[];this.selector=""}else typeof s=="string"||s.nodeName||s.length&&"item"in s||s==window?elements=ender._select(s,r):elements=isFinite(s.length)?s:[s];this.length=elements.length;for(i=this.length;i--;)this[i]=elements[i]}function ender(s,r){return new Ender(s,r)}context.global=context;var modules={},old=context.$,oldEnder=context.ender,oldRequire=context.require,oldProvide=context.provide;context.provide=provide;context.require=require;Ender.prototype.forEach=function(fn,opt_scope){var i,l;for(i=0,l=this.length;i<l;++i)i in this&&fn.call(opt_scope||this[i],this[i],i,this);return this};Ender.prototype.$=ender;ender._VERSION="0.4.3-dev";ender.fn=Ender.prototype;ender.ender=function(o,chain){aug(chain?Ender.prototype:ender,o)};ender._select=function(s,r){return typeof s=="string"?(r||document).querySelectorAll(s):s.nodeName?[s]:s};ender.noConflict=function(callback){context.$=old;if(callback){context.provide=oldProvide;context.require=oldRequire;context.ender=oldEnder;typeof callback=="function"&&callback(require,provide,this)}return this};typeof module!="undefined"&&module.exports&&(module.exports=ender);context.ender=context.$=ender}(this));(function(){var module={exports:{}},exports=module.exports; |
|
15 |
+/*! |
|
16 |
+ * Reqwest! A general purpose XHR connection manager |
|
17 |
+ * (c) Dustin Diaz 2012 |
|
18 |
+ * https://github.com/ded/reqwest |
|
19 |
+ * license MIT |
|
20 |
+ */ |
|
21 |
+;!function(name,definition){typeof module!="undefined"?module.exports=definition():typeof define=="function"&&define.amd?define(definition):this[name]=definition()}("reqwest",function(){function handleReadyState(o,success,error){return function(){o&&o[readyState]==4&&(twoHundo.test(o.status)?success(o):error(o))}}function setHeaders(http,o){var headers=o.headers||{},h;headers.Accept=headers.Accept||defaultHeaders.accept[o.type]||defaultHeaders.accept["*"];!o.crossOrigin&&!headers[requestedWith]&&(headers[requestedWith]=defaultHeaders.requestedWith);headers[contentType]||(headers[contentType]=o.contentType||defaultHeaders.contentType);for(h in headers)headers.hasOwnProperty(h)&&http.setRequestHeader(h,headers[h])}function setCredentials(http,o){typeof o.withCredentials!="undefined"&&typeof http.withCredentials!="undefined"&&(http.withCredentials=!!o.withCredentials)}function generalCallback(data){lastValue=data}function urlappend(url,s){return url+(/\?/.test(url)?"&":"?")+s}function handleJsonp(o,fn,err,url){var reqId=uniqid++,cbkey=o.jsonpCallback||"callback",cbval=o.jsonpCallbackName||reqwest.getcallbackPrefix(reqId),cbreg=new RegExp("((^|\\?|&)"+cbkey+")=([^&]+)"),match=url.match(cbreg),script=doc.createElement("script"),loaded=0;match?match[3]==="?"?url=url.replace(cbreg,"$1="+cbval):cbval=match[3]:url=urlappend(url,cbkey+"="+cbval);win[cbval]=generalCallback;script.type="text/javascript";script.src=url;script.async=!0;if(typeof script.onreadystatechange!="undefined"){script.event="onclick";script.htmlFor=script.id="_reqwest_"+reqId}script.onload=script.onreadystatechange=function(){if(script[readyState]&&script[readyState]!=="complete"&&script[readyState]!=="loaded"||loaded)return!1;script.onload=script.onreadystatechange=null;script.onclick&&script.onclick();o.success&&o.success(lastValue);lastValue=undefined;head.removeChild(script);loaded=1};head.appendChild(script)}function getRequest(o,fn,err){var method=(o.method||"GET").toUpperCase(),url=typeof o=="string"?o:o.url,data=o.processData!==!1&&o.data&&typeof o.data!="string"?reqwest.toQueryString(o.data):o.data||null,http;if((o.type=="jsonp"||method=="GET")&&data){url=urlappend(url,data);data=null}if(o.type=="jsonp")return handleJsonp(o,fn,err,url);http=xhr();http.open(method,url,!0);setHeaders(http,o);setCredentials(http,o);http.onreadystatechange=handleReadyState(http,fn,err);o.before&&o.before(http);http.send(data);return http}function Reqwest(o,fn){this.o=o;this.fn=fn;init.apply(this,arguments)}function setType(url){var m=url.match(/\.(json|jsonp|html|xml)(\?|$)/);return m?m[1]:"js"}function init(o,fn){function complete(resp){o.timeout&&clearTimeout(self.timeout);self.timeout=null;while(self._completeHandlers.length>0)self._completeHandlers.shift()(resp)}function success(resp){var r=resp.responseText;if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML}self._responseArgs.resp=resp;self._fulfilled=!0;fn(resp);while(self._fulfillmentHandlers.length>0)self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(resp,msg,t){self._responseArgs.resp=resp;self._responseArgs.msg=msg;self._responseArgs.t=t;self._erred=!0;while(self._errorHandlers.length>0)self._errorHandlers.shift()(resp,msg,t);complete(resp)}this.url=typeof o=="string"?o:o.url;this.timeout=null;this._fulfilled=!1;this._fulfillmentHandlers=[];this._errorHandlers=[];this._completeHandlers=[];this._erred=!1;this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){};o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout));o.success&&this._fulfillmentHandlers.push(function(){o.success.apply(o,arguments)});o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)});o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)});this.request=getRequest(o,success,error)}function reqwest(o,fn){return new Reqwest(o,fn)}function normalize(s){return s?s.replace(/\r?\n/g,"\r\n"):""}function serial(el,cb){var n=el.name,t=el.tagName.toLowerCase(),optCb=function(o){o&&!o.disabled&&cb(n,normalize(o.attributes.value&&o.attributes.value.specified?o.value:o.text))};if(el.disabled||!n)return;switch(t){case"input":if(!/reset|button|image|file/i.test(el.type)){var ch=/checkbox/i.test(el.type),ra=/radio/i.test(el.type),val=el.value;(!ch&&!ra||el.checked)&&cb(n,normalize(ch&&val===""?"on":val))}break;case"textarea":cb(n,normalize(el.value));break;case"select":if(el.type.toLowerCase()==="select-one")optCb(el.selectedIndex>=0?el.options[el.selectedIndex]:null);else for(var i=0;el.length&&i<el.length;i++)el.options[i].selected&&optCb(el.options[i])}}function eachFormElement(){var cb=this,e,i,j,serializeSubtags=function(e,tags){for(var i=0;i<tags.length;i++){var fa=e[byTag](tags[i]);for(j=0;j<fa.length;j++)serial(fa[j],cb)}};for(i=0;i<arguments.length;i++){e=arguments[i];/input|select|textarea/i.test(e.tagName)&&serial(e,cb);serializeSubtags(e,["input","select","textarea"])}}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var hash={};eachFormElement.apply(function(name,value){if(name in hash){hash[name]&&!isArray(hash[name])&&(hash[name]=[hash[name]]);hash[name].push(value)}else hash[name]=value},arguments);return hash}var win=window,doc=document,twoHundo=/^20\d$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +(new Date),lastValue,xmlHttpRequest="XMLHttpRequest",isArray=typeof Array.isArray=="function"?Array.isArray:function(a){return a instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=win[xmlHttpRequest]?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(success,fail){if(this._fulfilled)success(this._responseArgs.resp);else if(this._erred)fail(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t);else{this._fulfillmentHandlers.push(success);this._errorHandlers.push(fail)}return this},always:function(fn){this._fulfilled||this._erred?fn(this._responseArgs.resp):this._completeHandlers.push(fn);return this},fail:function(fn){this._erred?fn(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(fn);return this}};reqwest.serializeArray=function(){var arr=[];eachFormElement.apply(function(name,value){arr.push({name:name,value:value})},arguments);return arr};reqwest.serialize=function(){if(arguments.length===0)return"";var opt,fn,args=Array.prototype.slice.call(arguments,0);opt=args.pop();opt&&opt.nodeType&&args.push(opt)&&(opt=null);opt&&(opt=opt.type);opt=="map"?fn=serializeHash:opt=="array"?fn=reqwest.serializeArray:fn=serializeQueryString;return fn.apply(null,args)};reqwest.toQueryString=function(o){var qs="",i,enc=encodeURIComponent,push=function(k,v){qs+=enc(k)+"="+enc(v)+"&"};if(isArray(o))for(i=0;o&&i<o.length;i++)push(o[i].name,o[i].value);else for(var k in o){if(!Object.hasOwnProperty.call(o,k))continue;var v=o[k];if(isArray(v))for(i=0;i<v.length;i++)push(k,v[i]);else push(k,o[k])}return qs.replace(/&$/,"").replace(/%20/g,"+")};reqwest.getcallbackPrefix=function(reqId){return callbackPrefix};reqwest.compat=function(o,fn){if(o){o.type&&(o.method=o.type)&&delete o.type;o.dataType&&(o.type=o.dataType);o.jsonpCallback&&(o.jsonpCallbackName=o.jsonpCallback)&&delete o.jsonpCallback;o.jsonp&&(o.jsonpCallback=o.jsonp)}return new Reqwest(o,fn)};return reqwest});provide("reqwest",module.exports);!function($){var r=require("reqwest"),integrate=function(method){return function(){var args=Array.prototype.slice.call(arguments,0),i=this&&this.length||0;while(i--)args.unshift(this[i]);return r[method].apply(null,args)}},s=integrate("serialize"),sa=integrate("serializeArray");$.ender({ajax:r,serialize:r.serialize,serializeArray:r.serializeArray,toQueryString:r.toQueryString});$.ender({serialize:s,serializeArray:sa},!0)}(ender)})();(function(){var module={exports:{}},exports=module.exports; |
|
22 |
+/*! |
|
23 |
+ * Bean - copyright (c) Jacob Thornton 2011-2012 |
|
24 |
+ * https://github.com/fat/bean |
|
25 |
+ * MIT license |
|
26 |
+ */ |
|
27 |
+;!function(name,context,definition){typeof module!="undefined"&&module.exports?module.exports=definition(name,context):typeof define=="function"&&typeof define.amd=="object"?define(definition):context[name]=definition(name,context)}("bean",this,function(name,context){var win=window,old=context[name],namespaceRegex=/[^\.]*(?=\..*)\.|.*/,nameRegex=/\..*/,addEvent="addEventListener",removeEvent="removeEventListener",doc=document||{},root=doc.documentElement||{},W3C_MODEL=root[addEvent],eventSupport=W3C_MODEL?addEvent:"attachEvent",ONE={},slice=Array.prototype.slice,str2arr=function(s,d){return s.split(d||" ")},isString=function(o){return typeof o=="string"},isFunction=function(o){return typeof o=="function"},standardNativeEvents="click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange message error abort scroll ",w3cNativeEvents="show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend textinputreadystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ",nativeEvents=function(hash,events,i){for(i=0;i<events.length;i++)events[i]&&(hash[events[i]]=1);return hash}({},str2arr(standardNativeEvents+(W3C_MODEL?w3cNativeEvents:""))),customEvents=function(){var isAncestor="compareDocumentPosition"in root?function(element,container){return container.compareDocumentPosition&&(container.compareDocumentPosition(element)&16)===16}:"contains"in root?function(element,container){container=container.nodeType===9||container===window?root:container;return container!==element&&container.contains(element)}:function(element,container){while(element=element.parentNode)if(element===container)return 1;return 0},check=function(event){var related=event.relatedTarget;return related?related!==this&&related.prefix!=="xul"&&!/document/.test(this.toString())&&!isAncestor(related,this):related==null};return{mouseenter:{base:"mouseover",condition:check},mouseleave:{base:"mouseout",condition:check},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),Event=function(){var commonProps=str2arr("altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which propertyName"),mouseProps=commonProps.concat(str2arr("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement")),mouseWheelProps=mouseProps.concat(str2arr("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis")),keyProps=commonProps.concat(str2arr("char charCode key keyCode keyIdentifier keyLocation location")),textProps=commonProps.concat(str2arr("data")),touchProps=commonProps.concat(str2arr("touches targetTouches changedTouches scale rotation")),messageProps=commonProps.concat(str2arr("data origin source")),stateProps=commonProps.concat(str2arr("state")),overOutRegex=/over|out/,typeFixers=[{reg:/key/i,fix:function(event,newEvent){newEvent.keyCode=event.keyCode||event.which;return keyProps}},{reg:/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,fix:function(event,newEvent,type){newEvent.rightClick=event.which===3||event.button===2;newEvent.pos={x:0,y:0};if(event.pageX||event.pageY){newEvent.clientX=event.pageX;newEvent.clientY=event.pageY}else if(event.clientX||event.clientY){newEvent.clientX=event.clientX+doc.body.scrollLeft+root.scrollLeft;newEvent.clientY=event.clientY+doc.body.scrollTop+root.scrollTop}overOutRegex.test(type)&&(newEvent.relatedTarget=event.relatedTarget||event[(type=="mouseover"?"from":"to")+"Element"]);return mouseProps}},{reg:/mouse.*(wheel|scroll)/i,fix:function(){return mouseWheelProps}},{reg:/^text/i,fix:function(){return textProps}},{reg:/^touch|^gesture/i,fix:function(){return touchProps}},{reg:/^message$/i,fix:function(){return messageProps}},{reg:/^popstate$/i,fix:function(){return stateProps}},{reg:/.*/,fix:function(){return commonProps}}],typeFixerMap={},Event=function(event,element,isNative){if(!arguments.length)return;event=event||((element.ownerDocument||element.document||element).parentWindow||win).event;this.originalEvent=event;this.isNative=isNative;this.isBean=!0;if(!event)return;var type=event.type,target=event.target||event.srcElement,i,l,p,props,fixer;this.target=target&&target.nodeType===3?target.parentNode:target;if(isNative){fixer=typeFixerMap[type];if(!fixer)for(i=0,l=typeFixers.length;i<l;i++)if(typeFixers[i].reg.test(type)){typeFixerMap[type]=fixer=typeFixers[i].fix;break}props=fixer(event,this,type);for(i=props.length;i--;)!((p=props[i])in this)&&p in event&&(this[p]=event[p])}};Event.prototype.preventDefault=function(){this.originalEvent.preventDefault?this.originalEvent.preventDefault():this.originalEvent.returnValue=!1};Event.prototype.stopPropagation=function(){this.originalEvent.stopPropagation?this.originalEvent.stopPropagation():this.originalEvent.cancelBubble=!0};Event.prototype.stop=function(){this.preventDefault();this.stopPropagation();this.stopped=!0};Event.prototype.stopImmediatePropagation=function(){this.originalEvent.stopImmediatePropagation&&this.originalEvent.stopImmediatePropagation();this.isImmediatePropagationStopped=function(){return!0}};Event.prototype.isImmediatePropagationStopped=function(){return this.originalEvent.isImmediatePropagationStopped&&this.originalEvent.isImmediatePropagationStopped()};Event.prototype.clone=function(currentTarget){var ne=new Event(this,this.element,this.isNative);ne.currentTarget=currentTarget;return ne};return Event}(),targetElement=function(element,isNative){return!W3C_MODEL&&!isNative&&(element===doc||element===win)?root:element},RegEntry=function(){var wrappedHandler=function(element,fn,condition,args){var call=function(event,eargs){return fn.apply(element,args?slice.call(eargs,event?0:1).concat(args):eargs)},findTarget=function(event,eventElement){return fn.__beanDel?fn.__beanDel.ft(event.target,element):eventElement},handler=condition?function(event){var target=findTarget(event,this);if(condition.apply(target,arguments)){event&&(event.currentTarget=target);return call(event,arguments)}}:function(event){fn.__beanDel&&(event=event.clone(findTarget(event)));return call(event,arguments)};handler.__beanDel=fn.__beanDel;return handler},RegEntry=function(element,type,handler,original,namespaces,args,root){var customType=customEvents[type],isNative;type=="unload"&&(handler=once(removeListener,element,type,handler,original));if(customType){customType.condition&&(handler=wrappedHandler(element,handler,customType.condition,args));type=customType.base||type}this.isNative=isNative=nativeEvents[type]&&!!element[eventSupport];this.customType=!W3C_MODEL&&!isNative&&type;this.element=element;this.type=type;this.original=original;this.namespaces=namespaces;this.eventType=W3C_MODEL||isNative?type:"propertychange";this.target=targetElement(element,isNative);this[eventSupport]=!!this.target[eventSupport];this.root=root;this.handler=wrappedHandler(element,handler,null,args)};RegEntry.prototype.inNamespaces=function(checkNamespaces){var i,j,c=0;if(!checkNamespaces)return!0;if(!this.namespaces)return!1;for(i=checkNamespaces.length;i--;)for(j=this.namespaces.length;j--;)checkNamespaces[i]==this.namespaces[j]&&c++;return checkNamespaces.length===c};RegEntry.prototype.matches=function(checkElement,checkOriginal,checkHandler){return this.element===checkElement&&(!checkOriginal||this.original===checkOriginal)&&(!checkHandler||this.handler===checkHandler)};return RegEntry}(),registry=function(){var map={},forAll=function(element,type,original,handler,root,fn){var pfx=root?"r":"$";if(!type||type=="*")for(var t in map)t.charAt(0)==pfx&&forAll(element,t.substr(1),original,handler,root,fn);else{var i=0,l,list=map[pfx+type],all=element=="*";if(!list)return;for(l=list.length;i<l;i++)if((all||list[i].matches(element,original,handler))&&!fn(list[i],list,i,type))return}},has=function(element,type,original,root){var i,list=map[(root?"r":"$")+type];if(list)for(i=list.length;i--;)if(!list[i].root&&list[i].matches(element,original,null))return!0;return!1},get=function(element,type,original,root){var entries=[];forAll(element,type,original,null,root,function(entry){return entries.push(entry)});return entries},put=function(entry){var has=!entry.root&&!this.has(entry.element,entry.type,null,!1),key=(entry.root?"r":"$")+entry.type;(map[key]||(map[key]=[])).push(entry);return has},del=function(entry){forAll(entry.element,entry.type,null,entry.handler,entry.root,function(entry,list,i){list.splice(i,1);entry.removed=!0;list.length===0&&delete map[(entry.root?"r":"$")+entry.type];return!1})},entries=function(){var t,entries=[];for(t in map)t.charAt(0)=="$"&&(entries=entries.concat(map[t]));return entries};return{has:has,get:get,put:put,del:del,entries:entries}}(),selectorEngine,setSelectorEngine=function(e){arguments.length?selectorEngine=e:selectorEngine=doc.querySelectorAll?function(s,r){return r.querySelectorAll(s)}:function(){throw new Error("Bean: No selector engine installed")}},rootListener=function(event,type){if(!W3C_MODEL&&type&&event&&event.propertyName!="_on"+type)return;var listeners=registry.get(this,type||event.type,null,!1),l=listeners.length,i=0;event=new Event(event,this,!0);type&&(event.type=type);for(;i<l&&!event.isImmediatePropagationStopped();i++)listeners[i].removed||listeners[i].handler.call(this,event)},listener=W3C_MODEL?function(element,type,add){element[add?addEvent:removeEvent](type,rootListener,!1)}:function(element,type,add,custom){var entry;if(add){registry.put(entry=new RegEntry(element,custom||type,function(event){rootListener.call(element,event,custom)},rootListener,null,null,!0));custom&&element["_on"+custom]==null&&(element["_on"+custom]=0);entry.target.attachEvent("on"+entry.eventType,entry.handler)}else{entry=registry.get(element,custom||type,rootListener,!0)[0];if(entry){entry.target.detachEvent("on"+entry.eventType,entry.handler);registry.del(entry)}}},once=function(rm,element,type,fn,originalFn){return function(){fn.apply(this,arguments);rm(element,type,originalFn)}},removeListener=function(element,orgType,handler,namespaces){var type=orgType&&orgType.replace(nameRegex,""),handlers=registry.get(element,type,null,!1),removed={},i,l;for(i=0,l=handlers.length;i<l;i++)if((!handler||handlers[i].original===handler)&&handlers[i].inNamespaces(namespaces)){registry.del(handlers[i]);!removed[handlers[i].eventType]&&handlers[i][eventSupport]&&(removed[handlers[i].eventType]={t:handlers[i].eventType,c:handlers[i].type})}for(i in removed)registry.has(element,removed[i].t,null,!1)||listener(element,removed[i].t,!1,removed[i].c)},delegate=function(selector,fn){var findTarget=function(target,root){var i,array=isString(selector)?selectorEngine(selector,root):selector;for(;target&&target!==root;target=target.parentNode)for(i=array.length;i--;)if(array[i]===target)return target},handler=function(e){var match=findTarget(e.target,this);match&&fn.apply(match,arguments)};handler.__beanDel={ft:findTarget,selector:selector};return handler},fireListener=W3C_MODEL?function(isNative,type,element){var evt=doc.createEvent(isNative?"HTMLEvents":"UIEvents");evt[isNative?"initEvent":"initUIEvent"](type,!0,!0,win,1);element.dispatchEvent(evt)}:function(isNative,type,element){element=targetElement(element,isNative);isNative?element.fireEvent("on"+type,doc.createEventObject()):element["_on"+type]++},off=function(element,typeSpec,fn){var isTypeStr=isString(typeSpec),k,type,namespaces,i;if(isTypeStr&&typeSpec.indexOf(" ")>0){typeSpec=str2arr(typeSpec);for(i=typeSpec.length;i--;)off(element,typeSpec[i],fn);return element}type=isTypeStr&&typeSpec.replace(nameRegex,"");type&&customEvents[type]&&(type=customEvents[type].base);if(!typeSpec||isTypeStr){if(namespaces=isTypeStr&&typeSpec.replace(namespaceRegex,""))namespaces=str2arr(namespaces,".");removeListener(element,type,fn,namespaces)}else if(isFunction(typeSpec))removeListener(element,null,typeSpec);else for(k in typeSpec)typeSpec.hasOwnProperty(k)&&off(element,k,typeSpec[k]);return element},on=function(element,events,selector,fn){var originalFn,type,types,i,args,entry,first;if(selector===undefined&&typeof events=="object"){for(type in events)events.hasOwnProperty(type)&&on.call(this,element,type,events[type]);return}if(!isFunction(selector)){originalFn=fn;args=slice.call(arguments,4);fn=delegate(selector,originalFn,selectorEngine)}else{args=slice.call(arguments,3);fn=originalFn=selector}types=str2arr(events);this===ONE&&(fn=once(off,element,events,fn,originalFn));for(i=types.length;i--;){first=registry.put(entry=new RegEntry(element,types[i].replace(nameRegex,""),fn,originalFn,str2arr(types[i].replace(namespaceRegex,""),"."),args,!1));entry[eventSupport]&&first&&listener(element,entry.eventType,!0,entry.customType)}return element},add=function(element,events,fn,delfn){return on.apply(null,isString(fn)?[element,fn,events,delfn].concat(arguments.length>3?slice.call(arguments,5):[]):slice.call(arguments))},one=function(){return on.apply(ONE,arguments)},fire=function(element,type,args){var types=str2arr(type),i,j,l,names,handlers;for(i=types.length;i--;){type=types[i].replace(nameRegex,"");if(names=types[i].replace(namespaceRegex,""))names=str2arr(names,".");if(!names&&!args&&element[eventSupport])fireListener(nativeEvents[type],type,element);else{handlers=registry.get(element,type,null,!1);args=[!1].concat(args);for(j=0,l=handlers.length;j<l;j++)handlers[j].inNamespaces(names)&&handlers[j].handler.apply(element,args)}}return element},clone=function(element,from,type){var handlers=registry.get(from,type,null,!1),l=handlers.length,i=0,args,beanDel;for(;i<l;i++)if(handlers[i].original){args=[element,handlers[i].type];(beanDel=handlers[i].handler.__beanDel)&&args.push(beanDel.selector);args.push(handlers[i].original);on.apply(null,args)}return element},bean={on:on,add:add,one:one,off:off,remove:off,clone:clone,fire:fire,setSelectorEngine:setSelectorEngine,noConflict:function(){context[name]=old;return this}};if(win.attachEvent){var cleanup=function(){var i,entries=registry.entries();for(i in entries)entries[i].type&&entries[i].type!=="unload"&&off(entries[i].element,entries[i].type);win.detachEvent("onunload",cleanup);win.CollectGarbage&&win.CollectGarbage()};win.attachEvent("onunload",cleanup)}setSelectorEngine();return bean});provide("bean",module.exports);!function($){var b=require("bean"),integrate=function(method,type,method2){var _args=type?[type]:[];return function(){for(var i=0,l=this.length;i<l;i++){!arguments.length&&method=="on"&&type&&(method="fire");b[method].apply(this,[this[i]].concat(_args,Array.prototype.slice.call(arguments,0)))}return this}},add=integrate("add"),on=integrate("on"),one=integrate("one"),off=integrate("off"),fire=integrate("fire"),clone=integrate("clone"),hover=function(enter,leave,i){for(i=this.length;i--;){b.on.call(this,this[i],"mouseenter",enter);b.on.call(this,this[i],"mouseleave",leave)}return this},methods={on:on,addListener:on,bind:on,listen:on,delegate:add,one:one,off:off,unbind:off,unlisten:off,removeListener:off,undelegate:off,emit:fire,trigger:fire,cloneEvents:clone,hover:hover},shortcuts="blur change click dblclick error focus focusin focusout keydown keypress keyup load mousedown mouseenter mouseleave mouseout mouseover mouseup mousemove resize scroll select submit unload".split(" ");for(var i=shortcuts.length;i--;)methods[shortcuts[i]]=integrate("on",shortcuts[i]);b.setSelectorEngine($);$.ender(methods,!0)}(ender)})();(function(){var module={exports:{}},exports=module.exports; |
|
28 |
+/*! |
|
29 |
+ * Bonzo: DOM Utility (c) Dustin Diaz 2012 |
|
30 |
+ * https://github.com/ded/bonzo |
|
31 |
+ * License MIT |
|
32 |
+ */ |
|
33 |
+(function(name,context,definition){typeof module!="undefined"&&module.exports?module.exports=definition():typeof context["define"]=="function"&&context.define.amd?define(definition):context[name]=definition()})("bonzo",this,function(){function isNode(node){return node&&node.nodeName&&(node.nodeType==1||node.nodeType==11)}function normalize(node,host,clone){var i,l,ret;if(typeof node=="string")return bonzo.create(node);isNode(node)&&(node=[node]);if(clone){ret=[];for(i=0,l=node.length;i<l;i++)ret[i]=cloneNode(host,node[i]);return ret}return node}function classReg(c){return new RegExp("(^|\\s+)"+c+"(\\s+|$)")}function each(ar,fn,opt_scope,opt_rev){var ind,i=0,l=ar.length;for(;i<l;i++){ind=opt_rev?ar.length-i-1:i;fn.call(opt_scope||ar[ind],ar[ind],ind,ar)}return ar}function deepEach(ar,fn,opt_scope){for(var i=0,l=ar.length;i<l;i++)if(isNode(ar[i])){deepEach(ar[i].childNodes,fn,opt_scope);fn.call(opt_scope||ar[i],ar[i],i,ar)}return ar}function camelize(s){return s.replace(/-(.)/g,function(m,m1){return m1.toUpperCase()})}function decamelize(s){return s?s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase():s}function data(el){el[getAttribute]("data-node-uid")||el[setAttribute]("data-node-uid",++uuids);var uid=el[getAttribute]("data-node-uid");return uidMap[uid]||(uidMap[uid]={})}function clearData(el){var uid=el[getAttribute]("data-node-uid");uid&&delete uidMap[uid]}function dataValue(d){var f;try{return d===null||d===undefined?undefined:d==="true"?!0:d==="false"?!1:d==="null"?null:(f=parseFloat(d))==d?f:d}catch(e){}return undefined}function some(ar,fn,opt_scope){for(var i=0,j=ar.length;i<j;++i)if(fn.call(opt_scope||null,ar[i],i,ar))return!0;return!1}function styleProperty(p){p=="transform"&&(p=features.transform)||/^transform-?[Oo]rigin$/.test(p)&&(p=features.transform+"Origin")||p=="float"&&(p=features.cssFloat);return p?camelize(p):null}function insert(target,host,fn,rev){var i=0,self=host||this,r=[],nodes=query&&typeof target=="string"&&target.charAt(0)!="<"?query(target):target;each(normalize(nodes),function(t,j){each(self,function(el){fn(t,r[i++]=j>0?cloneNode(self,el):el)},null,rev)},this,rev);self.length=i;each(r,function(e){self[--i]=e},null,!rev);return self}function xy(el,x,y){var $el=bonzo(el),style=$el.css("position"),offset=$el.offset(),rel="relative",isRel=style==rel,delta=[parseInt($el.css("left"),10),parseInt($el.css("top"),10)];if(style=="static"){$el.css("position",rel);style=rel}isNaN(delta[0])&&(delta[0]=isRel?0:el.offsetLeft);isNaN(delta[1])&&(delta[1]=isRel?0:el.offsetTop);x!=null&&(el.style.left=x-offset.left+delta[0]+px);y!=null&&(el.style.top=y-offset.top+delta[1]+px)}function setter(el,v){return typeof v=="function"?v(el):v}function Bonzo(elements){this.length=0;if(elements){elements=typeof elements!="string"&&!elements.nodeType&&typeof elements.length!="undefined"?elements:[elements];this.length=elements.length;for(var i=0;i<elements.length;i++)this[i]=elements[i]}}function cloneNode(host,el){var c=el.cloneNode(!0),cloneElems,elElems;if(host.$&&typeof host.cloneEvents=="function"){host.$(c).cloneEvents(el);cloneElems=host.$(c).find("*");elElems=host.$(el).find("*");for(var i=0;i<elElems.length;i++)host.$(cloneElems[i]).cloneEvents(elElems[i])}return c}function scroll(x,y,type){var el=this[0];if(!el)return this;if(x==null&&y==null)return(isBody(el)?getWindowScroll():{x:el.scrollLeft,y:el.scrollTop})[type];if(isBody(el))win.scrollTo(x,y);else{x!=null&&(el.scrollLeft=x);y!=null&&(el.scrollTop=y)}return this}function isBody(element){return element===win||/^(?:body|html)$/i.test(element.tagName)}function getWindowScroll(){return{x:win.pageXOffset||html.scrollLeft,y:win.pageYOffset||html.scrollTop}}function createScriptFromHtml(html){var scriptEl=document.createElement("script"),matches=html.match(simpleScriptTagRe);scriptEl.src=matches[1];return scriptEl}function bonzo(els){return new Bonzo(els)}var win=window,doc=win.document,html=doc.documentElement,parentNode="parentNode",specialAttributes=/^(checked|value|selected|disabled)$/i,specialTags=/^(select|fieldset|table|tbody|tfoot|td|tr|colgroup)$/i,simpleScriptTagRe=/\s*<script +src=['"]([^'"]+)['"]>/,table=["<table>","</table>",1],td=["<table><tbody><tr>","</tr></tbody></table>",3],option=["<select>","</select>",1],noscope=["_","",0,1],tagMap={thead:table,tbody:table,tfoot:table,colgroup:table,caption:table,tr:["<table><tbody>","</tbody></table>",2],th:td,td:td,col:["<table><colgroup>","</colgroup></table>",2],fieldset:["<form>","</form>",1],legend:["<form><fieldset>","</fieldset></form>",2],option:option,optgroup:option,script:noscope,style:noscope,link:noscope,param:noscope,base:noscope},stateAttributes=/^(checked|selected|disabled)$/,ie=/msie/i.test(navigator.userAgent),hasClass,addClass,removeClass,uidMap={},uuids=0,digit=/^-?[\d\.]+$/,dattr=/^data-(.+)$/,px="px",setAttribute="setAttribute",getAttribute="getAttribute",byTag="getElementsByTagName",features=function(){var e=doc.createElement("p");e.innerHTML='<a href="#x">x</a><table style="float:left;"></table>';return{hrefExtended:e[byTag]("a")[0][getAttribute]("href")!="#x",autoTbody:e[byTag]("tbody").length!==0,computedStyle:doc.defaultView&&doc.defaultView.getComputedStyle,cssFloat:e[byTag]("table")[0].style.styleFloat?"styleFloat":"cssFloat",transform:function(){var props=["transform","webkitTransform","MozTransform","OTransform","msTransform"],i;for(i=0;i<props.length;i++)if(props[i]in e.style)return props[i]}(),classList:"classList"in e,opasity:function(){return typeof doc.createElement("a").style.opacity!="undefined"}()}}(),trimReplace=/(^\s*|\s*$)/g,whitespaceRegex=/\s+/,toString=String.prototype.toString,unitless={lineHeight:1,zoom:1,zIndex:1,opacity:1,boxFlex:1,WebkitBoxFlex:1,MozBoxFlex:1},query=doc.querySelectorAll&&function(selector){return doc.querySelectorAll(selector)},trim=String.prototype.trim?function(s){return s.trim()}:function(s){return s.replace(trimReplace,"")},getStyle=features.computedStyle?function(el,property){var value=null,computed=doc.defaultView.getComputedStyle(el,"");computed&&(value=computed[property]);return el.style[property]||value}:ie&&html.currentStyle?function(el,property){if(property=="opacity"&&!features.opasity){var val=100;try{val=el.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(e1){try{val=el.filters("alpha").opacity}catch(e2){}}return val/100}var value=el.currentStyle?el.currentStyle[property]:null;return el.style[property]||value}:function(el,property){return el.style[property]};if(features.classList){hasClass=function(el,c){return el.classList.contains(c)};addClass=function(el,c){el.classList.add(c)};removeClass=function(el,c){el.classList.remove(c)}}else{hasClass=function(el,c){return classReg(c).test(el.className)};addClass=function(el,c){el.className=trim(el.className+" "+c)};removeClass=function(el,c){el.className=trim(el.className.replace(classReg(c)," "))}}Bonzo.prototype={get:function(index){return this[index]||null},each:function(fn,opt_scope){return each(this,fn,opt_scope)},deepEach:function(fn,opt_scope){return deepEach(this,fn,opt_scope)},map:function(fn,opt_reject){var m=[],n,i;for(i=0;i<this.length;i++){n=fn.call(this,this[i],i);opt_reject?opt_reject(n)&&m.push(n):m.push(n)}return m},html:function(h,opt_text){var method=opt_text?html.textContent===undefined?"innerText":"textContent":"innerHTML",that=this,append=function(el,i){each(normalize(h,that,i),function(node){el.appendChild(node)})},updateElement=function(el,i){try{if(opt_text||typeof h=="string"&&!specialTags.test(el.tagName))return el[method]=h}catch(e){}append(el,i)};return typeof h!="undefined"?this.empty().each(updateElement):this[0]?this[0][method]:""},text:function(opt_text){return this.html(opt_text,!0)},append:function(node){var that=this;return this.each(function(el,i){each(normalize(node,that,i),function(i){el.appendChild(i)})})},prepend:function(node){var that=this;return this.each(function(el,i){var first=el.firstChild;each(normalize(node,that,i),function(i){el.insertBefore(i,first)})})},appendTo:function(target,opt_host){return insert.call(this,target,opt_host,function(t,el){t.appendChild(el)})},prependTo:function(target,opt_host){return insert.call(this,target,opt_host,function(t,el){t.insertBefore(el,t.firstChild)},1)},before:function(node){var that=this;return this.each(function(el,i){each(normalize(node,that,i),function(i){el[parentNode].insertBefore(i,el)})})},after:function(node){var that=this;return this.each(function(el,i){each(normalize(node,that,i),function(i){el[parentNode].insertBefore(i,el.nextSibling)},null,1)})},insertBefore:function(target,opt_host){return insert.call(this,target,opt_host,function(t,el){t[parentNode].insertBefore(el,t)})},insertAfter:function(target,opt_host){return insert.call(this,target,opt_host,function(t,el){var sibling=t.nextSibling;sibling?t[parentNode].insertBefore(el,sibling):t[parentNode].appendChild(el)},1)},replaceWith:function(node){bonzo(normalize(node)).insertAfter(this);return this.remove()},addClass:function(c){c=toString.call(c).split(whitespaceRegex);return this.each(function(el){each(c,function(c){c&&!hasClass(el,setter(el,c))&&addClass(el,setter(el,c))})})},removeClass:function(c){c=toString.call(c).split(whitespaceRegex);return this.each(function(el){each(c,function(c){c&&hasClass(el,setter(el,c))&&removeClass(el,setter(el,c))})})},hasClass:function(c){c=toString.call(c).split(whitespaceRegex);return some(this,function(el){return some(c,function(c){return c&&hasClass(el,c)})})},toggleClass:function(c,opt_condition){c=toString.call(c).split(whitespaceRegex);return this.each(function(el){each(c,function(c){c&&(typeof opt_condition!="undefined"?opt_condition?addClass(el,c):removeClass(el,c):hasClass(el,c)?removeClass(el,c):addClass(el,c))})})},show:function(opt_type){opt_type=typeof opt_type=="string"?opt_type:"";return this.each(function(el){el.style.display=opt_type})},hide:function(){return this.each(function(el){el.style.display="none"})},toggle:function(opt_callback,opt_type){opt_type=typeof opt_type=="string"?opt_type:"";typeof opt_callback!="function"&&(opt_callback=null);return this.each(function(el){el.style.display=el.offsetWidth||el.offsetHeight?"none":opt_type;opt_callback&&opt_callback.call(el)})},first:function(){return bonzo(this.length?this[0]:[])},last:function(){return bonzo(this.length?this[this.length-1]:[])},next:function(){return this.related("nextSibling")},previous:function(){return this.related("previousSibling")},parent:function(){return this.related(parentNode)},related:function(method){return this.map(function(el){el=el[method];while(el&&el.nodeType!==1)el=el[method];return el||0},function(el){return el})},focus:function(){this.length&&this[0].focus();return this},blur:function(){this.length&&this[0].blur();return this},css:function(o,opt_v){function fn(el,p,v){for(var k in iter)if(iter.hasOwnProperty(k)){v=iter[k];(p=styleProperty(k))&&digit.test(v)&&!(p in unitless)&&(v+=px);try{el.style[p]=setter(el,v)}catch(e){}}}var p,iter=o;if(opt_v===undefined&&typeof o=="string"){opt_v=this[0];if(!opt_v)return null;if(opt_v===doc||opt_v===win){p=opt_v===doc?bonzo.doc():bonzo.viewport();return o=="width"?p.width:o=="height"?p.height:""}return(o=styleProperty(o))?getStyle(opt_v,o):null}if(typeof o=="string"){iter={};iter[o]=opt_v}if(ie&&iter.opacity){iter.filter="alpha(opacity="+iter.opacity*100+")";iter.zoom=o.zoom||1;delete iter.opacity}return this.each(fn)},offset:function(opt_x,opt_y){if(!opt_x||typeof opt_x!="object"||typeof opt_x.top!="number"&&typeof opt_x.left!="number"){if(typeof opt_x=="number"||typeof opt_y=="number")return this.each(function(el){xy(el,opt_x,opt_y)});if(!this[0])return{top:0,left:0,height:0,width:0};var el=this[0],de=el.ownerDocument.documentElement,bcr=el.getBoundingClientRect(),scroll=getWindowScroll(),width=el.offsetWidth,height=el.offsetHeight,top=bcr.top+scroll.y-Math.max(0,de&&de.clientTop,doc.body.clientTop),left=bcr.left+scroll.x-Math.max(0,de&&de.clientLeft,doc.body.clientLeft);return{top:top,left:left,height:height,width:width}}return this.each(function(el){xy(el,opt_x.left,opt_x.top)})},dim:function(){if(!this.length)return{height:0,width:0};var el=this[0],de=el.nodeType==9&&el.documentElement,orig=!de&&!!el.style&&!el.offsetWidth&&!el.offsetHeight?function(t){var s={position:el.style.position||"",visibility:el.style.visibility||"",display:el.style.display||""};t.first().css({position:"absolute",visibility:"hidden",display:"block"});return s}(this):null,width=de?Math.max(el.body.scrollWidth,el.body.offsetWidth,de.scrollWidth,de.offsetWidth,de.clientWidth):el.offsetWidth,height=de?Math.max(el.body.scrollHeight,el.body.offsetHeight,de.scrollWidth,de.offsetWidth,de.clientHeight):el.offsetHeight;orig&&this.first().css(orig);return{height:height,width:width}},attr:function(k,opt_v){var el=this[0];if(typeof k=="string"||k instanceof String)return typeof opt_v=="undefined"?el?specialAttributes.test(k)?stateAttributes.test(k)&&typeof el[k]=="string"?!0:el[k]:k!="href"&&k!="src"||!features.hrefExtended?el[getAttribute](k):el[getAttribute](k,2):null:this.each(function(el){specialAttributes.test(k)?el[k]=setter(el,opt_v):el[setAttribute](k,setter(el,opt_v))});for(var n in k)k.hasOwnProperty(n)&&this.attr(n,k[n]);return this},removeAttr:function(k){return this.each(function(el){stateAttributes.test(k)?el[k]=!1:el.removeAttribute(k)})},val:function(s){return typeof s=="string"?this.attr("value",s):this.length?this[0].value:null},data:function(opt_k,opt_v){var el=this[0],o,m;if(typeof opt_v=="undefined"){if(!el)return null;o=data(el);if(typeof opt_k=="undefined"){each(el.attributes,function(a){(m=(""+a.name).match(dattr))&&(o[camelize(m[1])]=dataValue(a.value))});return o}typeof o[opt_k]=="undefined"&&(o[opt_k]=dataValue(this.attr("data-"+decamelize(opt_k))));return o[opt_k]}return this.each(function(el){data(el)[opt_k]=opt_v})},remove:function(){this.deepEach(clearData);return this.detach()},empty:function(){return this.each(function(el){deepEach(el.childNodes,clearData);while(el.firstChild)el.removeChild(el.firstChild)})},detach:function(){return this.each(function(el){el[parentNode]&&el[parentNode].removeChild(el)})},scrollTop:function(y){return scroll.call(this,null,y,"y")},scrollLeft:function(x){return scroll.call(this,x,null,"x")}};bonzo.setQueryEngine=function(q){query=q;delete bonzo.setQueryEngine};bonzo.aug=function(o,target){for(var k in o)o.hasOwnProperty(k)&&((target||Bonzo.prototype)[k]=o[k])};bonzo.create=function(node){return typeof node=="string"&&node!==""?function(){if(simpleScriptTagRe.test(node))return[createScriptFromHtml(node)];var tag=node.match(/^\s*<([^\s>]+)/),el=doc.createElement("div"),els=[],p=tag?tagMap[tag[1].toLowerCase()]:null,dep=p?p[2]+1:1,ns=p&&p[3],pn=parentNode,tb=features.autoTbody&&p&&p[0]=="<table>"&&!/<tbody/i.test(node);el.innerHTML=p?p[0]+node+p[1]:node;while(dep--)el=el.firstChild;ns&&el&&el.nodeType!==1&&(el=el.nextSibling);do(!tag||el.nodeType==1)&&(!tb||el.tagName.toLowerCase()!="tbody")&&els.push(el);while(el=el.nextSibling);each(els,function(el){el[pn]&&el[pn].removeChild(el)});return els}():isNode(node)?[node.cloneNode(!0)]:[]};bonzo.doc=function(){var vp=bonzo.viewport();return{width:Math.max(doc.body.scrollWidth,html.scrollWidth,vp.width),height:Math.max(doc.body.scrollHeight,html.scrollHeight,vp.height)}};bonzo.firstChild=function(el){for(var c=el.childNodes,i=0,j=c&&c.length||0,e;i<j;i++)c[i].nodeType===1&&(e=c[j=i]);return e};bonzo.viewport=function(){return{width:ie?html.clientWidth:self.innerWidth,height:ie?html.clientHeight:self.innerHeight}};bonzo.isAncestor="compareDocumentPosition"in html?function(container,element){return(container.compareDocumentPosition(element)&16)==16}:"contains"in html?function(container,element){return container!==element&&container.contains(element)}:function(container,element){while(element=element[parentNode])if(element===container)return!0;return!1};return bonzo});provide("bonzo",module.exports);(function($){function indexOf(ar,val){for(var i=0;i<ar.length;i++)if(ar[i]===val)return i;return-1}function uniq(ar){var r=[],i=0,j=0,k,item,inIt;for(;item=ar[i];++i){inIt=!1;for(k=0;k<r.length;++k)if(r[k]===item){inIt=!0;break}inIt||(r[j++]=item)}return r}function dimension(type,opt_v){return typeof opt_v=="undefined"?b(this).dim()[type]:this.css(type,opt_v)}var b=require("bonzo");b.setQueryEngine($);$.ender(b);$.ender(b(),!0);$.ender({create:function(node){return $(b.create(node))}});$.id=function(id){return $([document.getElementById(id)])};$.ender({parents:function(selector,closest){if(!this.length)return this;selector||(selector="*");var collection=$(selector),j,k,p,r=[];for(j=0,k=this.length;j<k;j++){p=this[j];while(p=p.parentNode)if(~indexOf(collection,p)){r.push(p);if(closest)break}}return $(uniq(r))},parent:function(){return $(uniq(b(this).parent()))},closest:function(selector){return this.parents(selector,!0)},first:function(){return $(this.length?this[0]:this)},last:function(){return $(this.length?this[this.length-1]:[])},next:function(){return $(b(this).next())},previous:function(){return $(b(this).previous())},appendTo:function(t){return b(this.selector).appendTo(t,this)},prependTo:function(t){return b(this.selector).prependTo(t,this)},insertAfter:function(t){return b(this.selector).insertAfter(t,this)},insertBefore:function(t){return b(this.selector).insertBefore(t,this)},siblings:function(){var i,l,p,r=[];for(i=0,l=this.length;i<l;i++){p=this[i];while(p=p.previousSibling)p.nodeType==1&&r.push(p);p=this[i];while(p=p.nextSibling)p.nodeType==1&&r.push(p)}return $(r)},children:function(){var i,l,el,r=[];for(i=0,l=this.length;i<l;i++){if(!(el=b.firstChild(this[i])))continue;r.push(el);while(el=el.nextSibling)el.nodeType==1&&r.push(el)}return $(uniq(r))},height:function(v){return dimension.call(this,"height",v)},width:function(v){return dimension.call(this,"width",v)}},!0)})(ender)})();(function(){var module={exports:{}},exports=module.exports; |
|
34 |
+/*! |
|
35 |
+ * domready (c) Dustin Diaz 2012 - License MIT |
|
36 |
+ */ |
|
37 |
+;!function(name,definition){typeof module!="undefined"?module.exports=definition():typeof define=="function"&&typeof define.amd=="object"?define(definition):this[name]=definition()}("domready",function(ready){function flush(f){loaded=1;while(f=fns.shift())f()}var fns=[],fn,f=!1,doc=document,testEl=doc.documentElement,hack=testEl.doScroll,domContentLoaded="DOMContentLoaded",addEventListener="addEventListener",onreadystatechange="onreadystatechange",readyState="readyState",loaded=/^loade|c/.test(doc[readyState]);doc[addEventListener]&&doc[addEventListener](domContentLoaded,fn=function(){doc.removeEventListener(domContentLoaded,fn,f);flush()},f);hack&&doc.attachEvent(onreadystatechange,fn=function(){if(/^c/.test(doc[readyState])){doc.detachEvent(onreadystatechange,fn);flush()}});return ready=hack?function(fn){self!=top?loaded?fn():fns.push(fn):function(){try{testEl.doScroll("left")}catch(e){return setTimeout(function(){ready(fn)},50)}fn()}()}:function(fn){loaded?fn():fns.push(fn)}});provide("domready",module.exports);!function($){var ready=require("domready");$.ender({domReady:ready});$.ender({ready:function(f){ready(f);return this}},!0)}(ender)})();(function(){var module={exports:{}},exports=module.exports; |
|
38 |
+/*! |
|
39 |
+ * @preserve Qwery - A Blazing Fast query selector engine |
|
40 |
+ * https://github.com/ded/qwery |
|
41 |
+ * copyright Dustin Diaz 2012 |
|
42 |
+ * MIT License |
|
43 |
+ */ |
|
44 |
+(function(name,context,definition){typeof module!="undefined"&&module.exports?module.exports=definition():typeof context["define"]=="function"&&context.define.amd?define(definition):context[name]=definition()})("qwery",this,function(){function cache(){this.c={}}function classRegex(c){return classCache.g(c)||classCache.s(c,"(^|\\s+)"+c+"(\\s+|$)",1)}function each(a,fn){var i=0,l=a.length;for(;i<l;i++)fn(a[i])}function flatten(ar){for(var r=[],i=0,l=ar.length;i<l;++i)arrayLike(ar[i])?r=r.concat(ar[i]):r[r.length]=ar[i];return r}function arrayify(ar){var i=0,l=ar.length,r=[];for(;i<l;i++)r[i]=ar[i];return r}function previous(n){while(n=n.previousSibling)if(n[nodeType]==1)break;return n}function q(query){return query.match(chunker)}function interpret(whole,tag,idsAndClasses,wholeAttribute,attribute,qualifier,value,wholePseudo,pseudo,wholePseudoVal,pseudoVal){var i,m,k,o,classes;if(this[nodeType]!==1)return!1;if(tag&&tag!=="*"&&this[tagName]&&this[tagName].toLowerCase()!==tag)return!1;if(idsAndClasses&&(m=idsAndClasses.match(id))&&m[1]!==this.id)return!1;if(idsAndClasses&&(classes=idsAndClasses.match(clas)))for(i=classes.length;i--;)if(!classRegex(classes[i].slice(1)).test(this.className))return!1;if(pseudo&&qwery.pseudos[pseudo]&&!qwery.pseudos[pseudo](this,pseudoVal))return!1;if(wholeAttribute&&!value){o=this.attributes;for(k in o)if(Object.prototype.hasOwnProperty.call(o,k)&&(o[k].name||k)==attribute)return this}return wholeAttribute&&!checkAttr(qualifier,getAttr(this,attribute)||"",value)?!1:this}function clean(s){return cleanCache.g(s)||cleanCache.s(s,s.replace(specialChars,"\\$1"))}function checkAttr(qualify,actual,val){switch(qualify){case"=":return actual==val;case"^=":return actual.match(attrCache.g("^="+val)||attrCache.s("^="+val,"^"+clean(val),1));case"$=":return actual.match(attrCache.g("$="+val)||attrCache.s("$="+val,clean(val)+"$",1));case"*=":return actual.match(attrCache.g(val)||attrCache.s(val,clean(val),1));case"~=":return actual.match(attrCache.g("~="+val)||attrCache.s("~="+val,"(?:^|\\s+)"+clean(val)+"(?:\\s+|$)",1));case"|=":return actual.match(attrCache.g("|="+val)||attrCache.s("|="+val,"^"+clean(val)+"(-|$)",1))}return 0}function _qwery(selector,_root){var r=[],ret=[],i,l,m,token,tag,els,intr,item,root=_root,tokens=tokenCache.g(selector)||tokenCache.s(selector,selector.split(tokenizr)),dividedTokens=selector.match(dividers);if(!tokens.length)return r;token=(tokens=tokens.slice(0)).pop();tokens.length&&(m=tokens[tokens.length-1].match(idOnly))&&(root=byId(_root,m[1]));if(!root)return r;intr=q(token);els=root!==_root&&root[nodeType]!==9&÷dTokens&&/^[+~]$/.test(dividedTokens[dividedTokens.length-1])?function(r){while(root=root.nextSibling)root[nodeType]==1&&(intr[1]?intr[1]==root[tagName].toLowerCase():1)&&(r[r.length]=root);return r}([]):root[byTag](intr[1]||"*");for(i=0,l=els.length;i<l;i++)if(item=interpret.apply(els[i],intr))r[r.length]=item;if(!tokens.length)return r;each(r,function(e){ancestorMatch(e,tokens,dividedTokens)&&(ret[ret.length]=e)});return ret}function is(el,selector,root){if(isNode(selector))return el==selector;if(arrayLike(selector))return!!~flatten(selector).indexOf(el);var selectors=selector.split(","),tokens,dividedTokens;while(selector=selectors.pop()){tokens=tokenCache.g(selector)||tokenCache.s(selector,selector.split(tokenizr));dividedTokens=selector.match(dividers);tokens=tokens.slice(0);if(interpret.apply(el,q(tokens.pop()))&&(!tokens.length||ancestorMatch(el,tokens,dividedTokens,root)))return!0}return!1}function ancestorMatch(el,tokens,dividedTokens,root){function crawl(e,i,p){while(p=walker[dividedTokens[i]](p,e))if(isNode(p)&&interpret.apply(p,q(tokens[i]))){if(!i)return p;if(cand=crawl(p,i-1,p))return cand}}var cand;return(cand=crawl(el,tokens.length-1,el))&&(!root||isAncestor(cand,root))}function isNode(el,t){return el&&typeof el=="object"&&(t=el[nodeType])&&(t==1||t==9)}function uniq(ar){var a=[],i,j;e:for(i=0;i<ar.length;++i){for(j=0;j<a.length;++j)if(a[j]==ar[i])continue e;a[a.length]=ar[i]}return a}function arrayLike(o){return typeof o=="object"&&isFinite(o.length)}function normalizeRoot(root){return root?typeof root=="string"?qwery(root)[0]:!root[nodeType]&&arrayLike(root)?root[0]:root:doc}function byId(root,id,el){return root[nodeType]===9?root.getElementById(id):root.ownerDocument&&((el=root.ownerDocument.getElementById(id))&&isAncestor(el,root)&&el||!isAncestor(root,root.ownerDocument)&&select('[id="'+id+'"]',root)[0])}function qwery(selector,_root){var m,el,root=normalizeRoot(_root);if(!root||!selector)return[];if(selector===window||isNode(selector))return!_root||selector!==window&&isNode(root)&&isAncestor(selector,root)?[selector]:[];if(selector&&arrayLike(selector))return flatten(selector);if(m=selector.match(easy)){if(m[1])return(el=byId(root,m[1]))?[el]:[];if(m[2])return arrayify(root[byTag](m[2]));if(hasByClass&&m[3])return arrayify(root[byClass](m[3]))}return select(selector,root)}function collectSelector(root,collector){return function(s){var oid,nid;if(splittable.test(s)){if(root[nodeType]!==9){(nid=oid=root.getAttribute("id"))||root.setAttribute("id",nid="__qwerymeupscotty");s='[id="'+nid+'"]'+s;collector(root.parentNode||root,s,!0);oid||root.removeAttribute("id")}return}s.length&&collector(root,s,!1)}}var doc=document,html=doc.documentElement,byClass="getElementsByClassName",byTag="getElementsByTagName",qSA="querySelectorAll",useNativeQSA="useNativeQSA",tagName="tagName",nodeType="nodeType",select,id=/#([\w\-]+)/,clas=/\.[\w\-]+/g,idOnly=/^#([\w\-]+)$/,classOnly=/^\.([\w\-]+)$/,tagOnly=/^([\w\-]+)$/,tagAndOrClass=/^([\w]+)?\.([\w\-]+)$/,splittable=/(^|,)\s*[>~+]/,normalizr=/^\s+|\s*([,\s\+\~>]|$)\s*/g,splitters=/[\s\>\+\~]/,splittersMore=/(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\]|[\s\w\+\-]*\))/,specialChars=/([.*+?\^=!:${}()|\[\]\/\\])/g,simple=/^(\*|[a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,attr=/\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,pseudo=/:([\w\-]+)(\(['"]?([^()]+)['"]?\))?/,easy=new RegExp(idOnly.source+"|"+tagOnly.source+"|"+classOnly.source),dividers=new RegExp("("+splitters.source+")"+splittersMore.source,"g"),tokenizr=new RegExp(splitters.source+splittersMore.source),chunker=new RegExp(simple.source+"("+attr.source+")?"+"("+pseudo.source+")?"),walker={" ":function(node){return node&&node!==html&&node.parentNode},">":function(node,contestant){return node&&node.parentNode==contestant.parentNode&&node.parentNode},"~":function(node){return node&&node.previousSibling},"+":function(node,contestant,p1,p2){return node?(p1=previous(node))&&(p2=previous(contestant))&&p1==p2&&p1:!1}};cache.prototype={g:function(k){return this.c[k]||undefined},s:function(k,v,r){v=r?new RegExp(v):v;return this.c[k]=v}};var classCache=new cache,cleanCache=new cache,attrCache=new cache,tokenCache=new cache,isAncestor="compareDocumentPosition"in html?function(element,container){return(container.compareDocumentPosition(element)&16)==16}:"contains"in html?function(element,container){container=container[nodeType]===9||container==window?html:container;return container!==element&&container.contains(element)}:function(element,container){while(element=element.parentNode)if(element===container)return 1;return 0},getAttr=function(){var e=doc.createElement("p");return(e.innerHTML='<a href="#x">x</a>')&&e.firstChild.getAttribute("href")!="#x"?function(e,a){return a==="class"?e.className:a==="href"||a==="src"?e.getAttribute(a,2):e.getAttribute(a)}:function(e,a){return e.getAttribute(a)}}(),hasByClass=!!doc[byClass],hasQSA=doc.querySelector&&doc[qSA],selectQSA=function(selector,root){var result=[],ss,e;try{if(root[nodeType]===9||!splittable.test(selector))return arrayify(root[qSA](selector));each(ss=selector.split(","),collectSelector(root,function(ctx,s){e=ctx[qSA](s);e.length==1?result[result.length]=e.item(0):e.length&&(result=result.concat(arrayify(e)))}));return ss.length>1&&result.length>1?uniq(result):result}catch(ex){}return selectNonNative(selector,root)},selectNonNative=function(selector,root){var result=[],items,m,i,l,r,ss;selector=selector.replace(normalizr,"$1");if(m=selector.match(tagAndOrClass)){r=classRegex(m[2]);items=root[byTag](m[1]||"*");for(i=0,l=items.length;i<l;i++)r.test(items[i].className)&&(result[result.length]=items[i]);return result}each(ss=selector.split(","),collectSelector(root,function(ctx,s,rewrite){r=_qwery(s,ctx);for(i=0,l=r.length;i<l;i++)if(ctx[nodeType]===9||rewrite||isAncestor(r[i],root))result[result.length]=r[i]}));return ss.length>1&&result.length>1?uniq(result):result},configure=function(options){typeof options[useNativeQSA]!="undefined"&&(select=options[useNativeQSA]?hasQSA?selectQSA:selectNonNative:selectNonNative)};configure({useNativeQSA:!0});qwery.configure=configure;qwery.uniq=uniq;qwery.is=is;qwery.pseudos={};return qwery});provide("qwery",module.exports);(function($){var q=function(){var r;try{r=require("qwery")}catch(ex){r=require("qwery-mobile")}finally{return r}}();$.pseudos=q.pseudos;$._select=function(s,r){return($._select=function(){var b;if(typeof $.create=="function")return function(s,r){return/^\s*</.test(s)?$.create(s,r):q(s,r)};try{b=require("bonzo");return function(s,r){return/^\s*</.test(s)?b.create(s,r):q(s,r)}}catch(e){}return q}())(s,r)};$.ender({find:function(s){var r=[],i,l,j,k,els;for(i=0,l=this.length;i<l;i++){els=q(s,this[i]);for(j=0,k=els.length;j<k;j++)r.push(els[j])}return $(q.uniq(r))},and:function(s){var plus=$(s);for(var i=this.length,j=0,l=this.length+plus.length;i<l;i++,j++)this[i]=plus[j];this.length+=plus.length;return this},is:function(s,r){var i,l;for(i=0,l=this.length;i<l;i++)if(q.is(this[i],s,r))return!0;return!1}},!0)})(ender)})() |
|
0 | 45 |
\ No newline at end of file |
1 | 46 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,40 @@ |
0 |
+var github = (function(){ |
|
1 |
+ function escapeHtml(str) { |
|
2 |
+ return $('<div/>').text(str).html(); |
|
3 |
+ } |
|
4 |
+ function render(target, repos){ |
|
5 |
+ var i = 0, fragment = '', t = $(target)[0]; |
|
6 |
+ |
|
7 |
+ for(i = 0; i < repos.length; i++) { |
|
8 |
+ fragment += '<li><a href="'+repos[i].html_url+'">'+repos[i].name+'</a><p>'+escapeHtml(repos[i].description||'')+'</p></li>'; |
|
9 |
+ } |
|
10 |
+ t.innerHTML = fragment; |
|
11 |
+ } |
|
12 |
+ return { |
|
13 |
+ showRepos: function(options){ |
|
14 |
+ $.ajax({ |
|
15 |
+ url: "https://api.github.com/users/"+options.user+"/repos?callback=?" |
|
16 |
+ , type: 'jsonp' |
|
17 |
+ , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); } |
|
18 |
+ , success: function(data) { |
|
19 |
+ var repos = []; |
|
20 |
+ if (!data || !data.data) { return; } |
|
21 |
+ for (var i = 0; i < data.data.length; i++) { |
|
22 |
+ if (options.skip_forks && data.data[i].fork) { continue; } |
|
23 |
+ repos.push(data.data[i]); |
|
24 |
+ } |
|
25 |
+ repos.sort(function(a, b) { |
|
26 |
+ var aDate = new Date(a.pushed_at).valueOf(), |
|
27 |
+ bDate = new Date(b.pushed_at).valueOf(); |
|
28 |
+ |
|
29 |
+ if (aDate === bDate) { return 0; } |
|
30 |
+ return aDate > bDate ? -1 : 1; |
|
31 |
+ }); |
|
32 |
+ |
|
33 |
+ if (options.count) { repos.splice(options.count); } |
|
34 |
+ render(options.target, repos); |
|
35 |
+ } |
|
36 |
+ }); |
|
37 |
+ } |
|
38 |
+ }; |
|
39 |
+})(); |
0 | 40 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,3256 @@ |
0 |
+/*! |
|
1 |
+ * ============================================================= |
|
2 |
+ * Ender: open module JavaScript framework (https://ender.no.de) |
|
3 |
+ * Build: ender build jeesh reqwest |
|
4 |
+ * ============================================================= |
|
5 |
+ */ |
|
6 |
+ |
|
7 |
+/*! |
|
8 |
+ * Ender: open module JavaScript framework (client-lib) |
|
9 |
+ * copyright Dustin Diaz & Jacob Thornton 2011-2012 (@ded @fat) |
|
10 |
+ * http://ender.jit.su |
|
11 |
+ * License MIT |
|
12 |
+ */ |
|
13 |
+(function (context) { |
|
14 |
+ |
|
15 |
+ // a global object for node.js module compatiblity |
|
16 |
+ // ============================================ |
|
17 |
+ |
|
18 |
+ context['global'] = context |
|
19 |
+ |
|
20 |
+ // Implements simple module system |
|
21 |
+ // losely based on CommonJS Modules spec v1.1.1 |
|
22 |
+ // ============================================ |
|
23 |
+ |
|
24 |
+ var modules = {} |
|
25 |
+ , old = context['$'] |
|
26 |
+ , oldEnder = context['ender'] |
|
27 |
+ , oldRequire = context['require'] |
|
28 |
+ , oldProvide = context['provide'] |
|
29 |
+ |
|
30 |
+ function require (identifier) { |
|
31 |
+ // modules can be required from ender's build system, or found on the window |
|
32 |
+ var module = modules['$' + identifier] || window[identifier] |
|
33 |
+ if (!module) throw new Error("Ender Error: Requested module '" + identifier + "' has not been defined.") |
|
34 |
+ return module |
|
35 |
+ } |
|
36 |
+ |
|
37 |
+ function provide (name, what) { |
|
38 |
+ return (modules['$' + name] = what) |
|
39 |
+ } |
|
40 |
+ |
|
41 |
+ context['provide'] = provide |
|
42 |
+ context['require'] = require |
|
43 |
+ |
|
44 |
+ function aug(o, o2) { |
|
45 |
+ for (var k in o2) k != 'noConflict' && k != '_VERSION' && (o[k] = o2[k]) |
|
46 |
+ return o |
|
47 |
+ } |
|
48 |
+ |
|
49 |
+ /** |
|
50 |
+ * main Ender return object |
|
51 |
+ * @constructor |
|
52 |
+ * @param {Array|Node|string} s a CSS selector or DOM node(s) |
|
53 |
+ * @param {Array.|Node} r a root node(s) |
|
54 |
+ */ |
|
55 |
+ function Ender(s, r) { |
|
56 |
+ var elements |
|
57 |
+ , i |
|
58 |
+ |
|
59 |
+ this.selector = s |
|
60 |
+ // string || node || nodelist || window |
|
61 |
+ if (typeof s == 'undefined') { |
|
62 |
+ elements = [] |
|
63 |
+ this.selector = '' |
|
64 |
+ } else if (typeof s == 'string' || s.nodeName || (s.length && 'item' in s) || s == window) { |
|
65 |
+ elements = ender._select(s, r) |
|
66 |
+ } else { |
|
67 |
+ elements = isFinite(s.length) ? s : [s] |
|
68 |
+ } |
|
69 |
+ this.length = elements.length |
|
70 |
+ for (i = this.length; i--;) this[i] = elements[i] |
|
71 |
+ } |
|
72 |
+ |
|
73 |
+ /** |
|
74 |
+ * @param {function(el, i, inst)} fn |
|
75 |
+ * @param {Object} opt_scope |
|
76 |
+ * @returns {Ender} |
|
77 |
+ */ |
|
78 |
+ Ender.prototype['forEach'] = function (fn, opt_scope) { |
|
79 |
+ var i, l |
|
80 |
+ // opt out of native forEach so we can intentionally call our own scope |
|
81 |
+ // defaulting to the current item and be able to return self |
|
82 |
+ for (i = 0, l = this.length; i < l; ++i) i in this && fn.call(opt_scope || this[i], this[i], i, this) |
|
83 |
+ // return self for chaining |
|
84 |
+ return this |
|
85 |
+ } |
|
86 |
+ |
|
87 |
+ Ender.prototype.$ = ender // handy reference to self |
|
88 |
+ |
|
89 |
+ |
|
90 |
+ function ender(s, r) { |
|
91 |
+ return new Ender(s, r) |
|
92 |
+ } |
|
93 |
+ |
|
94 |
+ ender['_VERSION'] = '0.4.3-dev' |
|
95 |
+ |
|
96 |
+ ender.fn = Ender.prototype // for easy compat to jQuery plugins |
|
97 |
+ |
|
98 |
+ ender.ender = function (o, chain) { |
|
99 |
+ aug(chain ? Ender.prototype : ender, o) |
|
100 |
+ } |
|
101 |
+ |
|
102 |
+ ender._select = function (s, r) { |
|
103 |
+ if (typeof s == 'string') return (r || document).querySelectorAll(s) |
|
104 |
+ if (s.nodeName) return [s] |
|
105 |
+ return s |
|
106 |
+ } |
|
107 |
+ |
|
108 |
+ |
|
109 |
+ // use callback to receive Ender's require & provide and remove them from global |
|
110 |
+ ender.noConflict = function (callback) { |
|
111 |
+ context['$'] = old |
|
112 |
+ if (callback) { |
|
113 |
+ context['provide'] = oldProvide |
|
114 |
+ context['require'] = oldRequire |
|
115 |
+ context['ender'] = oldEnder |
|
116 |
+ if (typeof callback == 'function') callback(require, provide, this) |
|
117 |
+ } |
|
118 |
+ return this |
|
119 |
+ } |
|
120 |
+ |
|
121 |
+ if (typeof module !== 'undefined' && module.exports) module.exports = ender |
|
122 |
+ // use subscript notation as extern for Closure compilation |
|
123 |
+ context['ender'] = context['$'] = ender |
|
124 |
+ |
|
125 |
+}(this)); |
|
126 |
+ |
|
127 |
+(function () { |
|
128 |
+ |
|
129 |
+ var module = { exports: {} }, exports = module.exports; |
|
130 |
+ |
|
131 |
+ /*! |
|
132 |
+ * Reqwest! A general purpose XHR connection manager |
|
133 |
+ * (c) Dustin Diaz 2012 |
|
134 |
+ * https://github.com/ded/reqwest |
|
135 |
+ * license MIT |
|
136 |
+ */ |
|
137 |
+ !function (name, definition) { |
|
138 |
+ if (typeof module != 'undefined') module.exports = definition() |
|
139 |
+ else if (typeof define == 'function' && define.amd) define(definition) |
|
140 |
+ else this[name] = definition() |
|
141 |
+ }('reqwest', function () { |
|
142 |
+ |
|
143 |
+ var win = window |
|
144 |
+ , doc = document |
|
145 |
+ , twoHundo = /^20\d$/ |
|
146 |
+ , byTag = 'getElementsByTagName' |
|
147 |
+ , readyState = 'readyState' |
|
148 |
+ , contentType = 'Content-Type' |
|
149 |
+ , requestedWith = 'X-Requested-With' |
|
150 |
+ , head = doc[byTag]('head')[0] |
|
151 |
+ , uniqid = 0 |
|
152 |
+ , callbackPrefix = 'reqwest_' + (+new Date()) |
|
153 |
+ , lastValue // data stored by the most recent JSONP callback |
|
154 |
+ , xmlHttpRequest = 'XMLHttpRequest' |
|
155 |
+ |
|
156 |
+ var isArray = typeof Array.isArray == 'function' ? Array.isArray : function (a) { |
|
157 |
+ return a instanceof Array |
|
158 |
+ } |
|
159 |
+ var defaultHeaders = { |
|
160 |
+ contentType: 'application/x-www-form-urlencoded' |
|
161 |
+ , requestedWith: xmlHttpRequest |
|
162 |
+ , accept: { |
|
163 |
+ '*': 'text/javascript, text/html, application/xml, text/xml, */*' |
|
164 |
+ , xml: 'application/xml, text/xml' |
|
165 |
+ , html: 'text/html' |
|
166 |
+ , text: 'text/plain' |
|
167 |
+ , json: 'application/json, text/javascript' |
|
168 |
+ , js: 'application/javascript, text/javascript' |
|
169 |
+ } |
|
170 |
+ } |
|
171 |
+ var xhr = win[xmlHttpRequest] ? |
|
172 |
+ function () { |
|
173 |
+ return new XMLHttpRequest() |
|
174 |
+ } : |
|
175 |
+ function () { |
|
176 |
+ return new ActiveXObject('Microsoft.XMLHTTP') |
|
177 |
+ } |
|
178 |
+ |
|
179 |
+ function handleReadyState(o, success, error) { |
|
180 |
+ return function () { |
|
181 |
+ if (o && o[readyState] == 4) { |
|
182 |
+ if (twoHundo.test(o.status)) { |
|
183 |
+ success(o) |
|
184 |
+ } else { |
|
185 |
+ error(o) |
|
186 |
+ } |
|
187 |
+ } |
|
188 |
+ } |
|
189 |
+ } |
|
190 |
+ |
|
191 |
+ function setHeaders(http, o) { |
|
192 |
+ var headers = o.headers || {}, h |
|
193 |
+ headers.Accept = headers.Accept || defaultHeaders.accept[o.type] || defaultHeaders.accept['*'] |
|
194 |
+ // breaks cross-origin requests with legacy browsers |
|
195 |
+ if (!o.crossOrigin && !headers[requestedWith]) headers[requestedWith] = defaultHeaders.requestedWith |
|
196 |
+ if (!headers[contentType]) headers[contentType] = o.contentType || defaultHeaders.contentType |
|
197 |
+ for (h in headers) { |
|
198 |
+ headers.hasOwnProperty(h) && http.setRequestHeader(h, headers[h]) |
|
199 |
+ } |
|
200 |
+ } |
|
201 |
+ |
|
202 |
+ function setCredentials(http, o) { |
|
203 |
+ if (typeof o.withCredentials !== "undefined" && typeof http.withCredentials !== "undefined") { |
|
204 |
+ http.withCredentials = !!o.withCredentials |
|
205 |
+ } |
|
206 |
+ } |
|
207 |
+ |
|
208 |
+ function generalCallback(data) { |
|
209 |
+ lastValue = data |
|
210 |
+ } |
|
211 |
+ |
|
212 |
+ function urlappend(url, s) { |
|
213 |
+ return url + (/\?/.test(url) ? '&' : '?') + s |
|
214 |
+ } |
|
215 |
+ |
|
216 |
+ function handleJsonp(o, fn, err, url) { |
|
217 |
+ var reqId = uniqid++ |
|
218 |
+ , cbkey = o.jsonpCallback || 'callback' // the 'callback' key |
|
219 |
+ , cbval = o.jsonpCallbackName || reqwest.getcallbackPrefix(reqId) |
|
220 |
+ // , cbval = o.jsonpCallbackName || ('reqwest_' + reqId) // the 'callback' value |
|
221 |
+ , cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)') |
|
222 |
+ , match = url.match(cbreg) |
|
223 |
+ , script = doc.createElement('script') |
|
224 |
+ , loaded = 0 |
|
225 |
+ |
|
226 |
+ if (match) { |
|
227 |
+ if (match[3] === '?') { |
|
228 |
+ url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name |
|
229 |
+ } else { |
|
230 |
+ cbval = match[3] // provided callback func name |
|
231 |
+ } |
|
232 |
+ } else { |
|
233 |
+ url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em |
|
234 |
+ } |
|
235 |
+ |
|
236 |
+ win[cbval] = generalCallback |
|
237 |
+ |
|
238 |
+ script.type = 'text/javascript' |
|
239 |
+ script.src = url |
|
240 |
+ script.async = true |
|
241 |
+ if (typeof script.onreadystatechange !== 'undefined') { |
|
242 |
+ // need this for IE due to out-of-order onreadystatechange(), binding script |
|
243 |
+ // execution to an event listener gives us control over when the script |
|
244 |
+ // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html |
|
245 |
+ script.event = 'onclick' |
|
246 |
+ script.htmlFor = script.id = '_reqwest_' + reqId |
|
247 |
+ } |
|
248 |
+ |
|
249 |
+ script.onload = script.onreadystatechange = function () { |
|
250 |
+ if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) { |
|
251 |
+ return false |
|
252 |
+ } |
|
253 |
+ script.onload = script.onreadystatechange = null |
|
254 |
+ script.onclick && script.onclick() |
|
255 |
+ // Call the user callback with the last value stored and clean up values and scripts. |
|
256 |
+ o.success && o.success(lastValue) |
|
257 |
+ lastValue = undefined |
|
258 |
+ head.removeChild(script) |
|
259 |
+ loaded = 1 |
|
260 |
+ } |
|
261 |
+ |
|
262 |
+ // Add the script to the DOM head |
|
263 |
+ head.appendChild(script) |
|
264 |
+ } |
|
265 |
+ |
|
266 |
+ function getRequest(o, fn, err) { |
|
267 |
+ var method = (o.method || 'GET').toUpperCase() |
|
268 |
+ , url = typeof o === 'string' ? o : o.url |
|
269 |
+ // convert non-string objects to query-string form unless o.processData is false |
|
270 |
+ , data = (o.processData !== false && o.data && typeof o.data !== 'string') |
|
271 |
+ ? reqwest.toQueryString(o.data) |
|
272 |
+ : (o.data || null) |
|
273 |
+ , http |
|
274 |
+ |
|
275 |
+ // if we're working on a GET request and we have data then we should append |
|
276 |
+ // query string to end of URL and not post data |
|
277 |
+ if ((o.type == 'jsonp' || method == 'GET') && data) { |
|
278 |
+ url = urlappend(url, data) |
|
279 |
+ data = null |
|
280 |
+ } |
|
281 |
+ |
|
282 |
+ if (o.type == 'jsonp') return handleJsonp(o, fn, err, url) |
|
283 |
+ |
|
284 |
+ http = xhr() |
|
285 |
+ http.open(method, url, true) |
|
286 |
+ setHeaders(http, o) |
|
287 |
+ setCredentials(http, o) |
|
288 |
+ http.onreadystatechange = handleReadyState(http, fn, err) |
|
289 |
+ o.before && o.before(http) |
|
290 |
+ http.send(data) |
|
291 |
+ return http |
|
292 |
+ } |
|
293 |
+ |
|
294 |
+ function Reqwest(o, fn) { |
|
295 |
+ this.o = o |
|
296 |
+ this.fn = fn |
|
297 |
+ |
|
298 |
+ init.apply(this, arguments) |
|
299 |
+ } |
|
300 |
+ |
|
301 |
+ function setType(url) { |
|
302 |
+ var m = url.match(/\.(json|jsonp|html|xml)(\?|$)/) |
|
303 |
+ return m ? m[1] : 'js' |
|
304 |
+ } |
|
305 |
+ |
|
306 |
+ function init(o, fn) { |
|
307 |
+ |
|
308 |
+ this.url = typeof o == 'string' ? o : o.url |
|
309 |
+ this.timeout = null |
|
310 |
+ |
|
311 |
+ // whether request has been fulfilled for purpose |
|
312 |
+ // of tracking the Promises |
|
313 |
+ this._fulfilled = false |
|
314 |
+ // success handlers |
|
315 |
+ this._fulfillmentHandlers = [] |
|
316 |
+ // error handlers |
|
317 |
+ this._errorHandlers = [] |
|
318 |
+ // complete (both success and fail) handlers |
|
319 |
+ this._completeHandlers = [] |
|
320 |
+ this._erred = false |
|
321 |
+ this._responseArgs = {} |
|
322 |
+ |
|
323 |
+ var self = this |
|
324 |
+ , type = o.type || setType(this.url) |
|
325 |
+ |
|
326 |
+ fn = fn || function () {} |
|
327 |
+ |
|
328 |
+ if (o.timeout) { |
|
329 |
+ this.timeout = setTimeout(function () { |
|
330 |
+ self.abort() |
|
331 |
+ }, o.timeout) |
|
332 |
+ } |
|
333 |
+ |
|
334 |
+ if (o.success) { |
|
335 |
+ this._fulfillmentHandlers.push(function () { |
|
336 |
+ o.success.apply(o, arguments) |
|
337 |
+ }) |
|
338 |
+ } |
|
339 |
+ |
|
340 |
+ if (o.error) { |
|
341 |
+ this._errorHandlers.push(function () { |
|
342 |
+ o.error.apply(o, arguments) |
|
343 |
+ }) |
|
344 |
+ } |
|
345 |
+ |
|
346 |
+ if (o.complete) { |
|
347 |
+ this._completeHandlers.push(function () { |
|
348 |
+ o.complete.apply(o, arguments) |
|
349 |
+ }) |
|
350 |
+ } |
|
351 |
+ |
|
352 |
+ function complete(resp) { |
|
353 |
+ o.timeout && clearTimeout(self.timeout) |
|
354 |
+ self.timeout = null |
|
355 |
+ while (self._completeHandlers.length > 0) { |
|
356 |
+ self._completeHandlers.shift()(resp) |
|
357 |
+ } |
|
358 |
+ } |
|
359 |
+ |
|
360 |
+ function success(resp) { |
|
361 |
+ var r = resp.responseText |
|
362 |
+ if (r) { |
|
363 |
+ switch (type) { |
|
364 |
+ case 'json': |
|
365 |
+ try { |
|
366 |
+ resp = win.JSON ? win.JSON.parse(r) : eval('(' + r + ')') |
|
367 |
+ } catch (err) { |
|
368 |
+ return error(resp, 'Could not parse JSON in response', err) |
|
369 |
+ } |
|
370 |
+ break; |
|
371 |
+ case 'js': |
|
372 |
+ resp = eval(r) |
|
373 |
+ break; |
|
374 |
+ case 'html': |
|
375 |
+ resp = r |
|
376 |
+ break; |
|
377 |
+ case 'xml': |
|
378 |
+ resp = resp.responseXML; |
|
379 |
+ break; |
|
380 |
+ } |
|
381 |
+ } |
|
382 |
+ |
|
383 |
+ self._responseArgs.resp = resp |
|
384 |
+ self._fulfilled = true |
|
385 |
+ fn(resp) |
|
386 |
+ while (self._fulfillmentHandlers.length > 0) { |
|
387 |
+ self._fulfillmentHandlers.shift()(resp) |
|
388 |
+ } |
|
389 |
+ |
|
390 |
+ complete(resp) |
|
391 |
+ } |
|
392 |
+ |
|
393 |
+ function error(resp, msg, t) { |
|
394 |
+ self._responseArgs.resp = resp |
|
395 |
+ self._responseArgs.msg = msg |
|
396 |
+ self._responseArgs.t = t |
|
397 |
+ self._erred = true |
|
398 |
+ while (self._errorHandlers.length > 0) { |
|
399 |
+ self._errorHandlers.shift()(resp, msg, t) |
|
400 |
+ } |
|
401 |
+ complete(resp) |
|
402 |
+ } |
|
403 |
+ |
|
404 |
+ this.request = getRequest(o, success, error) |
|
405 |
+ } |
|
406 |
+ |
|
407 |
+ Reqwest.prototype = { |
|
408 |
+ abort: function () { |
|
409 |
+ this.request.abort() |
|
410 |
+ } |
|
411 |
+ |
|
412 |
+ , retry: function () { |
|
413 |
+ init.call(this, this.o, this.fn) |
|
414 |
+ } |
|
415 |
+ |
|
416 |
+ /** |
|
417 |
+ * Small deviation from the Promises A CommonJs specification |
|
418 |
+ * http://wiki.commonjs.org/wiki/Promises/A |
|
419 |
+ */ |
|
420 |
+ |
|
421 |
+ /** |
|
422 |
+ * `then` will execute upon successful requests |
|
423 |
+ */ |
|
424 |
+ , then: function (success, fail) { |
|
425 |
+ if (this._fulfilled) { |
|
426 |
+ success(this._responseArgs.resp) |
|
427 |
+ } else if (this._erred) { |
|
428 |
+ fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) |
|
429 |
+ } else { |
|
430 |
+ this._fulfillmentHandlers.push(success) |
|
431 |
+ this._errorHandlers.push(fail) |
|
432 |
+ } |
|
433 |
+ return this |
|
434 |
+ } |
|
435 |
+ |
|
436 |
+ /** |
|
437 |
+ * `always` will execute whether the request succeeds or fails |
|
438 |
+ */ |
|
439 |
+ , always: function (fn) { |
|
440 |
+ if (this._fulfilled || this._erred) { |
|
441 |
+ fn(this._responseArgs.resp) |
|
442 |
+ } else { |
|
443 |
+ this._completeHandlers.push(fn) |
|
444 |
+ } |
|
445 |
+ return this |
|
446 |
+ } |
|
447 |
+ |
|
448 |
+ /** |
|
449 |
+ * `fail` will execute when the request fails |
|
450 |
+ */ |
|
451 |
+ , fail: function (fn) { |
|
452 |
+ if (this._erred) { |
|
453 |
+ fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) |
|
454 |
+ } else { |
|
455 |
+ this._errorHandlers.push(fn) |
|
456 |
+ } |
|
457 |
+ return this |
|
458 |
+ } |
|
459 |
+ } |
|
460 |
+ |
|
461 |
+ function reqwest(o, fn) { |
|
462 |
+ return new Reqwest(o, fn) |
|
463 |
+ } |
|
464 |
+ |
|
465 |
+ // normalize newline variants according to spec -> CRLF |
|
466 |
+ function normalize(s) { |
|
467 |
+ return s ? s.replace(/\r?\n/g, '\r\n') : '' |
|
468 |
+ } |
|
469 |
+ |
|
470 |
+ function serial(el, cb) { |
|
471 |
+ var n = el.name |
|
472 |
+ , t = el.tagName.toLowerCase() |
|
473 |
+ , optCb = function (o) { |
|
474 |
+ // IE gives value="" even where there is no value attribute |
|
475 |
+ // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273 |
|
476 |
+ if (o && !o.disabled) |
|
477 |
+ cb(n, normalize(o.attributes.value && o.attributes.value.specified ? o.value : o.text)) |
|
478 |
+ } |
|
479 |
+ |
|
480 |
+ // don't serialize elements that are disabled or without a name |
|
481 |
+ if (el.disabled || !n) return; |
|
482 |
+ |
|
483 |
+ switch (t) { |
|
484 |
+ case 'input': |
|
485 |
+ if (!/reset|button|image|file/i.test(el.type)) { |
|
486 |
+ var ch = /checkbox/i.test(el.type) |
|
487 |
+ , ra = /radio/i.test(el.type) |
|
488 |
+ , val = el.value; |
|
489 |
+ // WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here |
|
490 |
+ (!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val)) |
|
491 |
+ } |
|
492 |
+ break; |
|
493 |
+ case 'textarea': |
|
494 |
+ cb(n, normalize(el.value)) |
|
495 |
+ break; |
|
496 |
+ case 'select': |
|
497 |
+ if (el.type.toLowerCase() === 'select-one') { |
|
498 |
+ optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null) |
|
499 |
+ } else { |
|
500 |
+ for (var i = 0; el.length && i < el.length; i++) { |
|
501 |
+ el.options[i].selected && optCb(el.options[i]) |
|
502 |
+ } |
|
503 |
+ } |
|
504 |
+ break; |
|
505 |
+ } |
|
506 |
+ } |
|
507 |
+ |
|
508 |
+ // collect up all form elements found from the passed argument elements all |
|
509 |
+ // the way down to child elements; pass a '<form>' or form fields. |
|
510 |
+ // called with 'this'=callback to use for serial() on each element |
|
511 |
+ function eachFormElement() { |
|
512 |
+ var cb = this |
|
513 |
+ , e, i, j |
|
514 |
+ , serializeSubtags = function (e, tags) { |
|
515 |
+ for (var i = 0; i < tags.length; i++) { |
|
516 |
+ var fa = e[byTag](tags[i]) |
|
517 |
+ for (j = 0; j < fa.length; j++) serial(fa[j], cb) |
|
518 |
+ } |
|
519 |
+ } |
|
520 |
+ |
|
521 |
+ for (i = 0; i < arguments.length; i++) { |
|
522 |
+ e = arguments[i] |
|
523 |
+ if (/input|select|textarea/i.test(e.tagName)) serial(e, cb) |
|
524 |
+ serializeSubtags(e, [ 'input', 'select', 'textarea' ]) |
|
525 |
+ } |
|
526 |
+ } |
|
527 |
+ |
|
528 |
+ // standard query string style serialization |
|
529 |
+ function serializeQueryString() { |
|
530 |
+ return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments)) |
|
531 |
+ } |
|
532 |
+ |
|
533 |
+ // { 'name': 'value', ... } style serialization |
|
534 |
+ function serializeHash() { |
|
535 |
+ var hash = {} |
|
536 |
+ eachFormElement.apply(function (name, value) { |
|
537 |
+ if (name in hash) { |
|
538 |
+ hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]]) |
|
539 |
+ hash[name].push(value) |
|
540 |
+ } else hash[name] = value |
|
541 |
+ }, arguments) |
|
542 |
+ return hash |
|
543 |
+ } |
|
544 |
+ |
|
545 |
+ // [ { name: 'name', value: 'value' }, ... ] style serialization |
|
546 |
+ reqwest.serializeArray = function () { |
|
547 |
+ var arr = [] |
|
548 |
+ eachFormElement.apply(function (name, value) { |
|
549 |
+ arr.push({name: name, value: value}) |
|
550 |
+ }, arguments) |
|
551 |
+ return arr |
|
552 |
+ } |
|
553 |
+ |
|
554 |
+ reqwest.serialize = function () { |
|
555 |
+ if (arguments.length === 0) return '' |
|
556 |
+ var opt, fn |
|
557 |
+ , args = Array.prototype.slice.call(arguments, 0) |
|
558 |
+ |
|
559 |
+ opt = args.pop() |
|
560 |
+ opt && opt.nodeType && args.push(opt) && (opt = null) |
|
561 |
+ opt && (opt = opt.type) |
|
562 |
+ |
|
563 |
+ if (opt == 'map') fn = serializeHash |
|
564 |
+ else if (opt == 'array') fn = reqwest.serializeArray |
|
565 |
+ else fn = serializeQueryString |
|
566 |
+ |
|
567 |
+ return fn.apply(null, args) |
|
568 |
+ } |
|
569 |
+ |
|
570 |
+ reqwest.toQueryString = function (o) { |
|
571 |
+ var qs = '', i |
|
572 |
+ , enc = encodeURIComponent |
|
573 |
+ , push = function (k, v) { |
|
574 |
+ qs += enc(k) + '=' + enc(v) + '&' |
|
575 |
+ } |
|
576 |
+ |
|
577 |
+ if (isArray(o)) { |
|
578 |
+ for (i = 0; o && i < o.length; i++) push(o[i].name, o[i].value) |
|
579 |
+ } else { |
|
580 |
+ for (var k in o) { |
|
581 |
+ if (!Object.hasOwnProperty.call(o, k)) continue; |
|
582 |
+ var v = o[k] |
|
583 |
+ if (isArray(v)) { |
|
584 |
+ for (i = 0; i < v.length; i++) push(k, v[i]) |
|
585 |
+ } else push(k, o[k]) |
|
586 |
+ } |
|
587 |
+ } |
|
588 |
+ |
|
589 |
+ // spaces should be + according to spec |
|
590 |
+ return qs.replace(/&$/, '').replace(/%20/g, '+') |
|
591 |
+ } |
|
592 |
+ |
|
593 |
+ reqwest.getcallbackPrefix = function (reqId) { |
|
594 |
+ return callbackPrefix |
|
595 |
+ } |
|
596 |
+ |
|
597 |
+ // jQuery and Zepto compatibility, differences can be remapped here so you can call |
|
598 |
+ // .ajax.compat(options, callback) |
|
599 |
+ reqwest.compat = function (o, fn) { |
|
600 |
+ if (o) { |
|
601 |
+ o.type && (o.method = o.type) && delete o.type |
|
602 |
+ o.dataType && (o.type = o.dataType) |
|
603 |
+ o.jsonpCallback && (o.jsonpCallbackName = o.jsonpCallback) && delete o.jsonpCallback |
|
604 |
+ o.jsonp && (o.jsonpCallback = o.jsonp) |
|
605 |
+ } |
|
606 |
+ return new Reqwest(o, fn) |
|
607 |
+ } |
|
608 |
+ |
|
609 |
+ return reqwest |
|
610 |
+ }); |
|
611 |
+ |
|
612 |
+ |
|
613 |
+ provide("reqwest", module.exports); |
|
614 |
+ |
|
615 |
+ !function ($) { |
|
616 |
+ var r = require('reqwest') |
|
617 |
+ , integrate = function(method) { |
|
618 |
+ return function() { |
|
619 |
+ var args = Array.prototype.slice.call(arguments, 0) |
|
620 |
+ , i = (this && this.length) || 0 |
|
621 |
+ while (i--) args.unshift(this[i]) |
|
622 |
+ return r[method].apply(null, args) |
|
623 |
+ } |
|
624 |
+ } |
|
625 |
+ , s = integrate('serialize') |
|
626 |
+ , sa = integrate('serializeArray') |
|
627 |
+ |
|
628 |
+ $.ender({ |
|
629 |
+ ajax: r |
|
630 |
+ , serialize: r.serialize |
|
631 |
+ , serializeArray: r.serializeArray |
|
632 |
+ , toQueryString: r.toQueryString |
|
633 |
+ }) |
|
634 |
+ |
|
635 |
+ $.ender({ |
|
636 |
+ serialize: s |
|
637 |
+ , serializeArray: sa |
|
638 |
+ }, true) |
|
639 |
+ }(ender); |
|
640 |
+ |
|
641 |
+ |
|
642 |
+}()); |
|
643 |
+ |
|
644 |
+(function () { |
|
645 |
+ |
|
646 |
+ var module = { exports: {} }, exports = module.exports; |
|
647 |
+ |
|
648 |
+ /*! |
|
649 |
+ * Bean - copyright (c) Jacob Thornton 2011-2012 |
|
650 |
+ * https://github.com/fat/bean |
|
651 |
+ * MIT license |
|
652 |
+ */ |
|
653 |
+ !(function (name, context, definition) { |
|
654 |
+ if (typeof module != 'undefined' && module.exports) module.exports = definition(name, context); |
|
655 |
+ else if (typeof define == 'function' && typeof define.amd == 'object') define(definition); |
|
656 |
+ else context[name] = definition(name, context); |
|
657 |
+ }('bean', this, function (name, context) { |
|
658 |
+ var win = window |
|
659 |
+ , old = context[name] |
|
660 |
+ , namespaceRegex = /[^\.]*(?=\..*)\.|.*/ |
|
661 |
+ , nameRegex = /\..*/ |
|
662 |
+ , addEvent = 'addEventListener' |
|
663 |
+ , removeEvent = 'removeEventListener' |
|
664 |
+ , doc = document || {} |
|
665 |
+ , root = doc.documentElement || {} |
|
666 |
+ , W3C_MODEL = root[addEvent] |
|
667 |
+ , eventSupport = W3C_MODEL ? addEvent : 'attachEvent' |
|
668 |
+ , ONE = {} // singleton for quick matching making add() do one() |
|
669 |
+ |
|
670 |
+ , slice = Array.prototype.slice |
|
671 |
+ , str2arr = function (s, d) { return s.split(d || ' ') } |
|
672 |
+ , isString = function (o) { return typeof o == 'string' } |
|
673 |
+ , isFunction = function (o) { return typeof o == 'function' } |
|
674 |
+ |
|
675 |
+ // events that we consider to be 'native', anything not in this list will |
|
676 |
+ // be treated as a custom event |
|
677 |
+ , standardNativeEvents = |
|
678 |
+ 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons |
|
679 |
+ 'mousewheel mousemultiwheel DOMMouseScroll ' + // mouse wheel |
|
680 |
+ 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement |
|
681 |
+ 'keydown keypress keyup ' + // keyboard |
|
682 |
+ 'orientationchange ' + // mobile |
|
683 |
+ 'focus blur change reset select submit ' + // form elements |
|
684 |
+ 'load unload beforeunload resize move DOMContentLoaded ' + // window |
|
685 |
+ 'readystatechange message ' + // window |
|
686 |
+ 'error abort scroll ' // misc |
|
687 |
+ // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event |
|
688 |
+ // that doesn't actually exist, so make sure we only do these on newer browsers |
|
689 |
+ , w3cNativeEvents = |
|
690 |
+ 'show ' + // mouse buttons |
|
691 |
+ 'input invalid ' + // form elements |
|
692 |
+ 'touchstart touchmove touchend touchcancel ' + // touch |
|
693 |
+ 'gesturestart gesturechange gestureend ' + // gesture |
|
694 |
+ 'textinput' + // TextEvent |
|
695 |
+ 'readystatechange pageshow pagehide popstate ' + // window |
|
696 |
+ 'hashchange offline online ' + // window |
|
697 |
+ 'afterprint beforeprint ' + // printing |
|
698 |
+ 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd |
|
699 |
+ 'loadstart progress suspend emptied stalled loadmetadata ' + // media |
|
700 |
+ 'loadeddata canplay canplaythrough playing waiting seeking ' + // media |
|
701 |
+ 'seeked ended durationchange timeupdate play pause ratechange ' + // media |
|
702 |
+ 'volumechange cuechange ' + // media |
|
703 |
+ 'checking noupdate downloading cached updateready obsolete ' // appcache |
|
704 |
+ |
|
705 |
+ // convert to a hash for quick lookups |
|
706 |
+ , nativeEvents = (function (hash, events, i) { |
|
707 |
+ for (i = 0; i < events.length; i++) events[i] && (hash[events[i]] = 1) |
|
708 |
+ return hash |
|
709 |
+ }({}, str2arr(standardNativeEvents + (W3C_MODEL ? w3cNativeEvents : '')))) |
|
710 |
+ |
|
711 |
+ // custom events are events that we *fake*, they are not provided natively but |
|
712 |
+ // we can use native events to generate them |
|
713 |
+ , customEvents = (function () { |
|
714 |
+ var isAncestor = 'compareDocumentPosition' in root |
|
715 |
+ ? function (element, container) { |
|
716 |
+ return container.compareDocumentPosition && (container.compareDocumentPosition(element) & 16) === 16 |
|
717 |
+ } |
|
718 |
+ : 'contains' in root |
|
719 |
+ ? function (element, container) { |
|
720 |
+ container = container.nodeType === 9 || container === window ? root : container |
|
721 |
+ return container !== element && container.contains(element) |
|
722 |
+ } |
|
723 |
+ : function (element, container) { |
|
724 |
+ while (element = element.parentNode) if (element === container) return 1 |
|
725 |
+ return 0 |
|
726 |
+ } |
|
727 |
+ , check = function (event) { |
|
728 |
+ var related = event.relatedTarget |
|
729 |
+ return !related |
|
730 |
+ ? related == null |
|
731 |
+ : (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString()) |
|
732 |
+ && !isAncestor(related, this)) |
|
733 |
+ } |
|
734 |
+ |
|
735 |
+ return { |
|
736 |
+ mouseenter: { base: 'mouseover', condition: check } |
|
737 |
+ , mouseleave: { base: 'mouseout', condition: check } |
|
738 |
+ , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' } |
|
739 |
+ } |
|
740 |
+ }()) |
|
741 |
+ |
|
742 |
+ // we provide a consistent Event object across browsers by taking the actual DOM |
|
743 |
+ // event object and generating a new one from its properties. |
|
744 |
+ , Event = (function () { |
|
745 |
+ // a whitelist of properties (for different event types) tells us what to check for and copy |
|
746 |
+ var commonProps = str2arr('altKey attrChange attrName bubbles cancelable ctrlKey currentTarget ' + |
|
747 |
+ 'detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey ' + |
|
748 |
+ 'srcElement target timeStamp type view which propertyName') |
|
749 |
+ , mouseProps = commonProps.concat(str2arr('button buttons clientX clientY dataTransfer ' + |
|
750 |
+ 'fromElement offsetX offsetY pageX pageY screenX screenY toElement')) |
|
751 |
+ , mouseWheelProps = mouseProps.concat(str2arr('wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ ' + |
|
752 |
+ 'axis')) // 'axis' is FF specific |
|
753 |
+ , keyProps = commonProps.concat(str2arr('char charCode key keyCode keyIdentifier ' + |
|
754 |
+ 'keyLocation location')) |
|
755 |
+ , textProps = commonProps.concat(str2arr('data')) |
|
756 |
+ , touchProps = commonProps.concat(str2arr('touches targetTouches changedTouches scale rotation')) |
|
757 |
+ , messageProps = commonProps.concat(str2arr('data origin source')) |
|
758 |
+ , stateProps = commonProps.concat(str2arr('state')) |
|
759 |
+ , overOutRegex = /over|out/ |
|
760 |
+ // some event types need special handling and some need special properties, do that all here |
|
761 |
+ , typeFixers = [ |
|
762 |
+ { // key events |
|
763 |
+ reg: /key/i |
|
764 |
+ , fix: function (event, newEvent) { |
|
765 |
+ newEvent.keyCode = event.keyCode || event.which |
|
766 |
+ return keyProps |
|
767 |
+ } |
|
768 |
+ } |
|
769 |
+ , { // mouse events |
|
770 |
+ reg: /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i |
|
771 |
+ , fix: function (event, newEvent, type) { |
|
772 |
+ newEvent.rightClick = event.which === 3 || event.button === 2 |
|
773 |
+ newEvent.pos = { x: 0, y: 0 } |
|
774 |
+ if (event.pageX || event.pageY) { |
|
775 |
+ newEvent.clientX = event.pageX |
|
776 |
+ newEvent.clientY = event.pageY |
|
777 |
+ } else if (event.clientX || event.clientY) { |
|
778 |
+ newEvent.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft |
|
779 |
+ newEvent.clientY = event.clientY + doc.body.scrollTop + root.scrollTop |
|
780 |
+ } |
|
781 |
+ if (overOutRegex.test(type)) { |
|
782 |
+ newEvent.relatedTarget = event.relatedTarget |
|
783 |
+ || event[(type == 'mouseover' ? 'from' : 'to') + 'Element'] |
|
784 |
+ } |
|
785 |
+ return mouseProps |
|
786 |
+ } |
|
787 |
+ } |
|
788 |
+ , { // mouse wheel events |
|
789 |
+ reg: /mouse.*(wheel|scroll)/i |
|
790 |
+ , fix: function () { return mouseWheelProps } |
|
791 |
+ } |
|
792 |
+ , { // TextEvent |
|
793 |
+ reg: /^text/i |
|
794 |
+ , fix: function () { return textProps } |
|
795 |
+ } |
|
796 |
+ , { // touch and gesture events |
|
797 |
+ reg: /^touch|^gesture/i |
|
798 |
+ , fix: function () { return touchProps } |
|
799 |
+ } |
|
800 |
+ , { // message events |
|
801 |
+ reg: /^message$/i |
|
802 |
+ , fix: function () { return messageProps } |
|
803 |
+ } |
|
804 |
+ , { // popstate events |
|
805 |
+ reg: /^popstate$/i |
|
806 |
+ , fix: function () { return stateProps } |
|
807 |
+ } |
|
808 |
+ , { // everything else |
|
809 |
+ reg: /.*/ |
|
810 |
+ , fix: function () { return commonProps } |
|
811 |
+ } |
|
812 |
+ ] |
|
813 |
+ , typeFixerMap = {} // used to map event types to fixer functions (above), a basic cache mechanism |
|
814 |
+ |
|
815 |
+ , Event = function (event, element, isNative) { |
|
816 |
+ if (!arguments.length) return |
|
817 |
+ event = event || ((element.ownerDocument || element.document || element).parentWindow || win).event |
|
818 |
+ this.originalEvent = event |
|
819 |
+ this.isNative = isNative |
|
820 |
+ this.isBean = true |
|
821 |
+ |
|
822 |
+ if (!event) return |
|
823 |
+ |
|
824 |
+ var type = event.type |
|
825 |
+ , target = event.target || event.srcElement |
|
826 |
+ , i, l, p, props, fixer |
|
827 |
+ |
|
828 |
+ this.target = target && target.nodeType === 3 ? target.parentNode : target |
|
829 |
+ |
|
830 |
+ if (isNative) { // we only need basic augmentation on custom events, the rest expensive & pointless |
|
831 |
+ fixer = typeFixerMap[type] |
|
832 |
+ if (!fixer) { // haven't encountered this event type before, map a fixer function for it |
|
833 |
+ for (i = 0, l = typeFixers.length; i < l; i++) { |
|
834 |
+ if (typeFixers[i].reg.test(type)) { // guaranteed to match at least one, last is .* |
|
835 |
+ typeFixerMap[type] = fixer = typeFixers[i].fix |
|
836 |
+ break |
|
837 |
+ } |
|
838 |
+ } |
|
839 |
+ } |
|
840 |
+ |
|
841 |
+ props = fixer(event, this, type) |
|
842 |
+ for (i = props.length; i--;) { |
|
843 |
+ if (!((p = props[i]) in this) && p in event) this[p] = event[p] |
|
844 |
+ } |
|
845 |
+ } |
|
846 |
+ } |
|
847 |
+ |
|
848 |
+ // preventDefault() and stopPropagation() are a consistent interface to those functions |
|
849 |
+ // on the DOM, stop() is an alias for both of them together |
|
850 |
+ Event.prototype.preventDefault = function () { |
|
851 |
+ if (this.originalEvent.preventDefault) this.originalEvent.preventDefault() |
|
852 |
+ else this.originalEvent.returnValue = false |
|
853 |
+ } |
|
854 |
+ Event.prototype.stopPropagation = function () { |
|
855 |
+ if (this.originalEvent.stopPropagation) this.originalEvent.stopPropagation() |
|
856 |
+ else this.originalEvent.cancelBubble = true |
|
857 |
+ } |
|
858 |
+ Event.prototype.stop = function () { |
|
859 |
+ this.preventDefault() |
|
860 |
+ this.stopPropagation() |
|
861 |
+ this.stopped = true |
|
862 |
+ } |
|
863 |
+ // stopImmediatePropagation() has to be handled internally because we manage the event list for |
|
864 |
+ // each element |
|
865 |
+ // note that originalElement may be a Bean#Event object in some situations |
|
866 |
+ Event.prototype.stopImmediatePropagation = function () { |
|
867 |
+ if (this.originalEvent.stopImmediatePropagation) this.originalEvent.stopImmediatePropagation() |
|
868 |
+ this.isImmediatePropagationStopped = function () { return true } |
|
869 |
+ } |
|
870 |
+ Event.prototype.isImmediatePropagationStopped = function () { |
|
871 |
+ return this.originalEvent.isImmediatePropagationStopped && this.originalEvent.isImmediatePropagationStopped() |
|
872 |
+ } |
|
873 |
+ Event.prototype.clone = function (currentTarget) { |
|
874 |
+ //TODO: this is ripe for optimisation, new events are *expensive* |
|
875 |
+ // improving this will speed up delegated events |
|
876 |
+ var ne = new Event(this, this.element, this.isNative) |
|
877 |
+ ne.currentTarget = currentTarget |
|
878 |
+ return ne |
|
879 |
+ } |
|
880 |
+ |
|
881 |
+ return Event |
|
882 |
+ }()) |
|
883 |
+ |
|
884 |
+ // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both |
|
885 |
+ , targetElement = function (element, isNative) { |
|
886 |
+ return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element |
|
887 |
+ } |
|
888 |
+ |
|
889 |
+ /** |
|
890 |
+ * Bean maintains an internal registry for event listeners. We don't touch elements, objects |
|
891 |
+ * or functions to identify them, instead we store everything in the registry. |
|
892 |
+ * Each event listener has a RegEntry object, we have one 'registry' for the whole instance. |
|
893 |
+ */ |
|
894 |
+ , RegEntry = (function () { |
|
895 |
+ // each handler is wrapped so we can handle delegation and custom events |
|
896 |
+ var wrappedHandler = function (element, fn, condition, args) { |
|
897 |
+ var call = function (event, eargs) { |
|
898 |
+ return fn.apply(element, args ? slice.call(eargs, event ? 0 : 1).concat(args) : eargs) |
|
899 |
+ } |
|
900 |
+ , findTarget = function (event, eventElement) { |
|
901 |
+ return fn.__beanDel ? fn.__beanDel.ft(event.target, element) : eventElement |
|
902 |
+ } |
|
903 |
+ , handler = condition |
|
904 |
+ ? function (event) { |
|
905 |
+ var target = findTarget(event, this) // deleated event |
|
906 |
+ if (condition.apply(target, arguments)) { |
|
907 |
+ if (event) event.currentTarget = target |
|
908 |
+ return call(event, arguments) |
|
909 |
+ } |
|
910 |
+ } |
|
911 |
+ : function (event) { |
|
912 |
+ if (fn.__beanDel) event = event.clone(findTarget(event)) // delegated event, fix the fix |
|
913 |
+ return call(event, arguments) |
|
914 |
+ } |
|
915 |
+ handler.__beanDel = fn.__beanDel |
|
916 |
+ return handler |
|
917 |
+ } |
|
918 |
+ |
|
919 |
+ , RegEntry = function (element, type, handler, original, namespaces, args, root) { |
|
920 |
+ var customType = customEvents[type] |
|
921 |
+ , isNative |
|
922 |
+ |
|
923 |
+ if (type == 'unload') { |
|
924 |
+ // self clean-up |
|
925 |
+ handler = once(removeListener, element, type, handler, original) |
|
926 |
+ } |
|
927 |
+ |
|
928 |
+ if (customType) { |
|
929 |
+ if (customType.condition) { |
|
930 |
+ handler = wrappedHandler(element, handler, customType.condition, args) |
|
931 |
+ } |
|
932 |
+ type = customType.base || type |
|
933 |
+ } |
|
934 |
+ |
|
935 |
+ this.isNative = isNative = nativeEvents[type] && !!element[eventSupport] |
|
936 |
+ this.customType = !W3C_MODEL && !isNative && type |
|
937 |
+ this.element = element |
|
938 |
+ this.type = type |
|
939 |
+ this.original = original |
|
940 |
+ this.namespaces = namespaces |
|
941 |
+ this.eventType = W3C_MODEL || isNative ? type : 'propertychange' |
|
942 |
+ this.target = targetElement(element, isNative) |
|
943 |
+ this[eventSupport] = !!this.target[eventSupport] |
|
944 |
+ this.root = root |
|
945 |
+ this.handler = wrappedHandler(element, handler, null, args) |
|
946 |
+ } |
|
947 |
+ |
|
948 |
+ // given a list of namespaces, is our entry in any of them? |
|
949 |
+ RegEntry.prototype.inNamespaces = function (checkNamespaces) { |
|
950 |
+ var i, j, c = 0 |
|
951 |
+ if (!checkNamespaces) return true |
|
952 |
+ if (!this.namespaces) return false |
|
953 |
+ for (i = checkNamespaces.length; i--;) { |
|
954 |
+ for (j = this.namespaces.length; j--;) { |
|
955 |
+ if (checkNamespaces[i] == this.namespaces[j]) c++ |
|
956 |
+ } |
|
957 |
+ } |
|
958 |
+ return checkNamespaces.length === c |
|
959 |
+ } |
|
960 |
+ |
|
961 |
+ // match by element, original fn (opt), handler fn (opt) |
|
962 |
+ RegEntry.prototype.matches = function (checkElement, checkOriginal, checkHandler) { |
|
963 |
+ return this.element === checkElement && |
|
964 |
+ (!checkOriginal || this.original === checkOriginal) && |
|
965 |
+ (!checkHandler || this.handler === checkHandler) |
|
966 |
+ } |
|
967 |
+ |
|
968 |
+ return RegEntry |
|
969 |
+ }()) |
|
970 |
+ |
|
971 |
+ , registry = (function () { |
|
972 |
+ // our map stores arrays by event type, just because it's better than storing |
|
973 |
+ // everything in a single array. |
|
974 |
+ // uses '$' as a prefix for the keys for safety and 'r' as a special prefix for |
|
975 |
+ // rootListeners so we can look them up fast |
|
976 |
+ var map = {} |
|
977 |
+ |
|
978 |
+ // generic functional search of our registry for matching listeners, |
|
979 |
+ // `fn` returns false to break out of the loop |
|
980 |
+ , forAll = function (element, type, original, handler, root, fn) { |
|
981 |
+ var pfx = root ? 'r' : '$' |
|
982 |
+ if (!type || type == '*') { |
|
983 |
+ // search the whole registry |
|
984 |
+ for (var t in map) { |
|
985 |
+ if (t.charAt(0) == pfx) { |
|
986 |
+ forAll(element, t.substr(1), original, handler, root, fn) |
|
987 |
+ } |
|
988 |
+ } |
|
989 |
+ } else { |
|
990 |
+ var i = 0, l, list = map[pfx + type], all = element == '*' |
|
991 |
+ if (!list) return |
|
992 |
+ for (l = list.length; i < l; i++) { |
|
993 |
+ if ((all || list[i].matches(element, original, handler)) && !fn(list[i], list, i, type)) return |
|
994 |
+ } |
|
995 |
+ } |
|
996 |
+ } |
|
997 |
+ |
|
998 |
+ , has = function (element, type, original, root) { |
|
999 |
+ // we're not using forAll here simply because it's a bit slower and this |
|
1000 |
+ // needs to be fast |
|
1001 |
+ var i, list = map[(root ? 'r' : '$') + type] |
|
1002 |
+ if (list) { |
|
1003 |
+ for (i = list.length; i--;) { |
|
1004 |
+ if (!list[i].root && list[i].matches(element, original, null)) return true |
|
1005 |
+ } |
|
1006 |
+ } |
|
1007 |
+ return false |
|
1008 |
+ } |
|
1009 |
+ |
|
1010 |
+ , get = function (element, type, original, root) { |
|
1011 |
+ var entries = [] |
|
1012 |
+ forAll(element, type, original, null, root, function (entry) { |
|
1013 |
+ return entries.push(entry) |
|
1014 |
+ }) |
|
1015 |
+ return entries |
|
1016 |
+ } |
|
1017 |
+ |
|
1018 |
+ , put = function (entry) { |
|
1019 |
+ var has = !entry.root && !this.has(entry.element, entry.type, null, false) |
|
1020 |
+ , key = (entry.root ? 'r' : '$') + entry.type |
|
1021 |
+ ;(map[key] || (map[key] = [])).push(entry) |
|
1022 |
+ return has |
|
1023 |
+ } |
|
1024 |
+ |
|
1025 |
+ , del = function (entry) { |
|
1026 |
+ forAll(entry.element, entry.type, null, entry.handler, entry.root, function (entry, list, i) { |
|
1027 |
+ list.splice(i, 1) |
|
1028 |
+ entry.removed = true |
|
1029 |
+ if (list.length === 0) delete map[(entry.root ? 'r' : '$') + entry.type] |
|
1030 |
+ return false |
|
1031 |
+ }) |
|
1032 |
+ } |
|
1033 |
+ |
|
1034 |
+ // dump all entries, used for onunload |
|
1035 |
+ , entries = function () { |
|
1036 |
+ var t, entries = [] |
|
1037 |
+ for (t in map) { |
|
1038 |
+ if (t.charAt(0) == '$') entries = entries.concat(map[t]) |
|
1039 |
+ } |
|
1040 |
+ return entries |
|
1041 |
+ } |
|
1042 |
+ |
|
1043 |
+ return { has: has, get: get, put: put, del: del, entries: entries } |
|
1044 |
+ }()) |
|
1045 |
+ |
|
1046 |
+ // we need a selector engine for delegated events, use querySelectorAll if it exists |
|
1047 |
+ // but for older browsers we need Qwery, Sizzle or similar |
|
1048 |
+ , selectorEngine |
|
1049 |
+ , setSelectorEngine = function (e) { |
|
1050 |
+ if (!arguments.length) { |
|
1051 |
+ selectorEngine = doc.querySelectorAll |
|
1052 |
+ ? function (s, r) { |
|
1053 |
+ return r.querySelectorAll(s) |
|
1054 |
+ } |
|
1055 |
+ : function () { |
|
1056 |
+ throw new Error('Bean: No selector engine installed') // eeek |
|
1057 |
+ } |
|
1058 |
+ } else { |
|
1059 |
+ selectorEngine = e |
|
1060 |
+ } |
|
1061 |
+ } |
|
1062 |
+ |
|
1063 |
+ // we attach this listener to each DOM event that we need to listen to, only once |
|
1064 |
+ // per event type per DOM element |
|
1065 |
+ , rootListener = function (event, type) { |
|
1066 |
+ if (!W3C_MODEL && type && event && event.propertyName != '_on' + type) return |
|
1067 |
+ |
|
1068 |
+ var listeners = registry.get(this, type || event.type, null, false) |
|
1069 |
+ , l = listeners.length |
|
1070 |
+ , i = 0 |
|
1071 |
+ |
|
1072 |
+ event = new Event(event, this, true) |
|
1073 |
+ if (type) event.type = type |
|
1074 |
+ |
|
1075 |
+ // iterate through all handlers registered for this type, calling them unless they have |
|
1076 |
+ // been removed by a previous handler or stopImmediatePropagation() has been called |
|
1077 |
+ for (; i < l && !event.isImmediatePropagationStopped(); i++) { |
|
1078 |
+ if (!listeners[i].removed) listeners[i].handler.call(this, event) |
|
1079 |
+ } |
|
1080 |
+ } |
|
1081 |
+ |
|
1082 |
+ // add and remove listeners to DOM elements |
|
1083 |
+ , listener = W3C_MODEL |
|
1084 |
+ ? function (element, type, add) { |
|
1085 |
+ // new browsers |
|
1086 |
+ element[add ? addEvent : removeEvent](type, rootListener, false) |
|
1087 |
+ } |
|
1088 |
+ : function (element, type, add, custom) { |
|
1089 |
+ // IE8 and below, use attachEvent/detachEvent and we have to piggy-back propertychange events |
|
1090 |
+ // to simulate event bubbling etc. |
|
1091 |
+ var entry |
|
1092 |
+ if (add) { |
|
1093 |
+ registry.put(entry = new RegEntry( |
|
1094 |
+ element |
|
1095 |
+ , custom || type |
|
1096 |
+ , function (event) { // handler |
|
1097 |
+ rootListener.call(element, event, custom) |
|
1098 |
+ } |
|
1099 |
+ , rootListener |
|
1100 |
+ , null |
|
1101 |
+ , null |
|
1102 |
+ , true // is root |
|
1103 |
+ )) |
|
1104 |
+ if (custom && element['_on' + custom] == null) element['_on' + custom] = 0 |
|
1105 |
+ entry.target.attachEvent('on' + entry.eventType, entry.handler) |
|
1106 |
+ } else { |
|
1107 |
+ entry = registry.get(element, custom || type, rootListener, true)[0] |
|
1108 |
+ if (entry) { |
|
1109 |
+ entry.target.detachEvent('on' + entry.eventType, entry.handler) |
|
1110 |
+ registry.del(entry) |
|
1111 |
+ } |
|
1112 |
+ } |
|
1113 |
+ } |
|
1114 |
+ |
|
1115 |
+ , once = function (rm, element, type, fn, originalFn) { |
|
1116 |
+ // wrap the handler in a handler that does a remove as well |
|
1117 |
+ return function () { |
|
1118 |
+ fn.apply(this, arguments) |
|
1119 |
+ rm(element, type, originalFn) |
|
1120 |
+ } |
|
1121 |
+ } |
|
1122 |
+ |
|
1123 |
+ , removeListener = function (element, orgType, handler, namespaces) { |
|
1124 |
+ var type = orgType && orgType.replace(nameRegex, '') |
|
1125 |
+ , handlers = registry.get(element, type, null, false) |
|
1126 |
+ , removed = {} |
|
1127 |
+ , i, l |
|
1128 |
+ |
|
1129 |
+ for (i = 0, l = handlers.length; i < l; i++) { |
|
1130 |
+ if ((!handler || handlers[i].original === handler) && handlers[i].inNamespaces(namespaces)) { |
|
1131 |
+ // TODO: this is problematic, we have a registry.get() and registry.del() that |
|
1132 |
+ // both do registry searches so we waste cycles doing this. Needs to be rolled into |
|
1133 |
+ // a single registry.forAll(fn) that removes while finding, but the catch is that |
|
1134 |
+ // we'll be splicing the arrays that we're iterating over. Needs extra tests to |
|
1135 |
+ // make sure we don't screw it up. @rvagg |
|
1136 |
+ registry.del(handlers[i]) |
|
1137 |
+ if (!removed[handlers[i].eventType] && handlers[i][eventSupport]) |
|
1138 |
+ removed[handlers[i].eventType] = { t: handlers[i].eventType, c: handlers[i].type } |
|
1139 |
+ } |
|
1140 |
+ } |
|
1141 |
+ // check each type/element for removed listeners and remove the rootListener where it's no longer needed |
|
1142 |
+ for (i in removed) { |
|
1143 |
+ if (!registry.has(element, removed[i].t, null, false)) { |
|
1144 |
+ // last listener of this type, remove the rootListener |
|
1145 |
+ listener(element, removed[i].t, false, removed[i].c) |
|
1146 |
+ } |
|
1147 |
+ } |
|
1148 |
+ } |
|
1149 |
+ |
|
1150 |
+ // set up a delegate helper using the given selector, wrap the handler function |
|
1151 |
+ , delegate = function (selector, fn) { |
|
1152 |
+ //TODO: findTarget (therefore $) is called twice, once for match and once for |
|
1153 |
+ // setting e.currentTarget, fix this so it's only needed once |
|
1154 |
+ var findTarget = function (target, root) { |
|
1155 |
+ var i, array = isString(selector) ? selectorEngine(selector, root) : selector |
|
1156 |
+ for (; target && target !== root; target = target.parentNode) { |
|
1157 |
+ for (i = array.length; i--;) { |
|
1158 |
+ if (array[i] === target) return target |
|
1159 |
+ } |
|
1160 |
+ } |
|
1161 |
+ } |
|
1162 |
+ , handler = function (e) { |
|
1163 |
+ var match = findTarget(e.target, this) |
|
1164 |
+ if (match) fn.apply(match, arguments) |
|
1165 |
+ } |
|
1166 |
+ |
|
1167 |
+ // __beanDel isn't pleasant but it's a private function, not exposed outside of Bean |
|
1168 |
+ handler.__beanDel = { |
|
1169 |
+ ft : findTarget // attach it here for customEvents to use too |
|
1170 |
+ , selector : selector |
|
1171 |
+ } |
|
1172 |
+ return handler |
|
1173 |
+ } |
|
1174 |
+ |
|
1175 |
+ , fireListener = W3C_MODEL ? function (isNative, type, element) { |
|
1176 |
+ // modern browsers, do a proper dispatchEvent() |
|
1177 |
+ var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents') |
|
1178 |
+ evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1) |
|
1179 |
+ element.dispatchEvent(evt) |
|
1180 |
+ } : function (isNative, type, element) { |
|
1181 |
+ // old browser use onpropertychange, just increment a custom property to trigger the event |
|
1182 |
+ element = targetElement(element, isNative) |
|
1183 |
+ isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++ |
|
1184 |
+ } |
|
1185 |
+ |
|
1186 |
+ /** |
|
1187 |
+ * Public API: off(), on(), add(), (remove()), one(), fire(), clone() |
|
1188 |
+ */ |
|
1189 |
+ |
|
1190 |
+ /** |
|
1191 |
+ * off(element[, eventType(s)[, handler ]]) |
|
1192 |
+ */ |
|
1193 |
+ , off = function (element, typeSpec, fn) { |
|
1194 |
+ var isTypeStr = isString(typeSpec) |
|
1195 |
+ , k, type, namespaces, i |
|
1196 |
+ |
|
1197 |
+ if (isTypeStr && typeSpec.indexOf(' ') > 0) { |
|
1198 |
+ // off(el, 't1 t2 t3', fn) or off(el, 't1 t2 t3') |
|
1199 |
+ typeSpec = str2arr(typeSpec) |
|
1200 |
+ for (i = typeSpec.length; i--;) |
|
1201 |
+ off(element, typeSpec[i], fn) |
|
1202 |
+ return element |
|
1203 |
+ } |
|
1204 |
+ |
|
1205 |
+ type = isTypeStr && typeSpec.replace(nameRegex, '') |
|
1206 |
+ if (type && customEvents[type]) type = customEvents[type].base |
|
1207 |
+ |
|
1208 |
+ if (!typeSpec || isTypeStr) { |
|
1209 |
+ // off(el) or off(el, t1.ns) or off(el, .ns) or off(el, .ns1.ns2.ns3) |
|
1210 |
+ if (namespaces = isTypeStr && typeSpec.replace(namespaceRegex, '')) namespaces = str2arr(namespaces, '.') |
|
1211 |
+ removeListener(element, type, fn, namespaces) |
|
1212 |
+ } else if (isFunction(typeSpec)) { |
|
1213 |
+ // off(el, fn) |
|
1214 |
+ removeListener(element, null, typeSpec) |
|
1215 |
+ } else { |
|
1216 |
+ // off(el, { t1: fn1, t2, fn2 }) |
|
1217 |
+ for (k in typeSpec) { |
|
1218 |
+ if (typeSpec.hasOwnProperty(k)) off(element, k, typeSpec[k]) |
|
1219 |
+ } |
|
1220 |
+ } |
|
1221 |
+ |
|
1222 |
+ return element |
|
1223 |
+ } |
|
1224 |
+ |
|
1225 |
+ /** |
|
1226 |
+ * on(element, eventType(s)[, selector], handler[, args ]) |
|
1227 |
+ */ |
|
1228 |
+ , on = function(element, events, selector, fn) { |
|
1229 |
+ var originalFn, type, types, i, args, entry, first |
|
1230 |
+ |
|
1231 |
+ //TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps? |
|
1232 |
+ if (selector === undefined && typeof events == 'object') { |
|
1233 |
+ //TODO: this can't handle delegated events |
|
1234 |
+ for (type in events) { |
|
1235 |
+ if (events.hasOwnProperty(type)) { |
|
1236 |
+ on.call(this, element, type, events[type]) |
|
1237 |
+ } |
|
1238 |
+ } |
|
1239 |
+ return |
|
1240 |
+ } |
|
1241 |
+ |
|
1242 |
+ if (!isFunction(selector)) { |
|
1243 |
+ // delegated event |
|
1244 |
+ originalFn = fn |
|
1245 |
+ args = slice.call(arguments, 4) |
|
1246 |
+ fn = delegate(selector, originalFn, selectorEngine) |
|
1247 |
+ } else { |
|
1248 |
+ args = slice.call(arguments, 3) |
|
1249 |
+ fn = originalFn = selector |
|
1250 |
+ } |
|
1251 |
+ |
|
1252 |
+ types = str2arr(events) |
|
1253 |
+ |
|
1254 |
+ // special case for one(), wrap in a self-removing handler |
|
1255 |
+ if (this === ONE) { |
|
1256 |
+ fn = once(off, element, events, fn, originalFn) |
|
1257 |
+ } |
|
1258 |
+ |
|
1259 |
+ for (i = types.length; i--;) { |
|
1260 |
+ // add new handler to the registry and check if it's the first for this element/type |
|
1261 |
+ first = registry.put(entry = new RegEntry( |
|
1262 |
+ element |
|
1263 |
+ , types[i].replace(nameRegex, '') // event type |
|
1264 |
+ , fn |
|
1265 |
+ , originalFn |
|
1266 |
+ , str2arr(types[i].replace(namespaceRegex, ''), '.') // namespaces |
|
1267 |
+ , args |
|
1268 |
+ , false // not root |
|
1269 |
+ )) |
|
1270 |
+ if (entry[eventSupport] && first) { |
|
1271 |
+ // first event of this type on this element, add root listener |
|
1272 |
+ listener(element, entry.eventType, true, entry.customType) |
|
1273 |
+ } |
|
1274 |
+ } |
|
1275 |
+ |
|
1276 |
+ return element |
|
1277 |
+ } |
|
1278 |
+ |
|
1279 |
+ /** |
|
1280 |
+ * add(element[, selector], eventType(s), handler[, args ]) |
|
1281 |
+ * |
|
1282 |
+ * Deprecated: kept (for now) for backward-compatibility |
|
1283 |
+ */ |
|
1284 |
+ , add = function (element, events, fn, delfn) { |
|
1285 |
+ return on.apply( |
|
1286 |
+ null |
|
1287 |
+ , !isString(fn) |
|
1288 |
+ ? slice.call(arguments) |
|
1289 |
+ : [ element, fn, events, delfn ].concat(arguments.length > 3 ? slice.call(arguments, 5) : []) |
|
1290 |
+ ) |
|
1291 |
+ } |
|
1292 |
+ |
|
1293 |
+ /** |
|
1294 |
+ * one(element, eventType(s)[, selector], handler[, args ]) |
|
1295 |
+ */ |
|
1296 |
+ , one = function () { |
|
1297 |
+ return on.apply(ONE, arguments) |
|
1298 |
+ } |
|
1299 |
+ |
|
1300 |
+ /** |
|
1301 |
+ * fire(element, eventType(s)[, args ]) |
|
1302 |
+ * |
|
1303 |
+ * The optional 'args' argument must be an array, if no 'args' argument is provided |
|
1304 |
+ * then we can use the browser's DOM event system, otherwise we trigger handlers manually |
|
1305 |
+ */ |
|
1306 |
+ , fire = function (element, type, args) { |
|
1307 |
+ var types = str2arr(type) |
|
1308 |
+ , i, j, l, names, handlers |
|
1309 |
+ |
|
1310 |
+ for (i = types.length; i--;) { |
|
1311 |
+ type = types[i].replace(nameRegex, '') |
|
1312 |
+ if (names = types[i].replace(namespaceRegex, '')) names = str2arr(names, '.') |
|
1313 |
+ if (!names && !args && element[eventSupport]) { |
|
1314 |
+ fireListener(nativeEvents[type], type, element) |
|
1315 |
+ } else { |
|
1316 |
+ // non-native event, either because of a namespace, arguments or a non DOM element |
|
1317 |
+ // iterate over all listeners and manually 'fire' |
|
1318 |
+ handlers = registry.get(element, type, null, false) |
|
1319 |
+ args = [false].concat(args) |
|
1320 |
+ for (j = 0, l = handlers.length; j < l; j++) { |
|
1321 |
+ if (handlers[j].inNamespaces(names)) { |
|
1322 |
+ handlers[j].handler.apply(element, args) |
|
1323 |
+ } |
|
1324 |
+ } |
|
1325 |
+ } |
|
1326 |
+ } |
|
1327 |
+ return element |
|
1328 |
+ } |
|
1329 |
+ |
|
1330 |
+ /** |
|
1331 |
+ * clone(dstElement, srcElement[, eventType ]) |
|
1332 |
+ * |
|
1333 |
+ * TODO: perhaps for consistency we should allow the same flexibility in type specifiers? |
|
1334 |
+ */ |
|
1335 |
+ , clone = function (element, from, type) { |
|
1336 |
+ var handlers = registry.get(from, type, null, false) |
|
1337 |
+ , l = handlers.length |
|
1338 |
+ , i = 0 |
|
1339 |
+ , args, beanDel |
|
1340 |
+ |
|
1341 |
+ for (; i < l; i++) { |
|
1342 |
+ if (handlers[i].original) { |
|
1343 |
+ args = [ element, handlers[i].type ] |
|
1344 |
+ if (beanDel = handlers[i].handler.__beanDel) args.push(beanDel.selector) |
|
1345 |
+ args.push(handlers[i].original) |
|
1346 |
+ on.apply(null, args) |
|
1347 |
+ } |
|
1348 |
+ } |
|
1349 |
+ return element |
|
1350 |
+ } |
|
1351 |
+ |
|
1352 |
+ , bean = { |
|
1353 |
+ on : on |
|
1354 |
+ , add : add |
|
1355 |
+ , one : one |
|
1356 |
+ , off : off |
|
1357 |
+ , remove : off |
|
1358 |
+ , clone : clone |
|
1359 |
+ , fire : fire |
|
1360 |
+ , setSelectorEngine : setSelectorEngine |
|
1361 |
+ , noConflict : function () { |
|
1362 |
+ context[name] = old |
|
1363 |
+ return this |
|
1364 |
+ } |
|
1365 |
+ } |
|
1366 |
+ |
|
1367 |
+ // for IE, clean up on unload to avoid leaks |
|
1368 |
+ if (win.attachEvent) { |
|
1369 |
+ var cleanup = function () { |
|
1370 |
+ var i, entries = registry.entries() |
|
1371 |
+ for (i in entries) { |
|
1372 |
+ if (entries[i].type && entries[i].type !== 'unload') off(entries[i].element, entries[i].type) |
|
1373 |
+ } |
|
1374 |
+ win.detachEvent('onunload', cleanup) |
|
1375 |
+ win.CollectGarbage && win.CollectGarbage() |
|
1376 |
+ } |
|
1377 |
+ win.attachEvent('onunload', cleanup) |
|
1378 |
+ } |
|
1379 |
+ |
|
1380 |
+ // initialize selector engine to internal default (qSA or throw Error) |
|
1381 |
+ setSelectorEngine() |
|
1382 |
+ |
|
1383 |
+ return bean |
|
1384 |
+ })); |
|
1385 |
+ |
|
1386 |
+ |
|
1387 |
+ provide("bean", module.exports); |
|
1388 |
+ |
|
1389 |
+ !function ($) { |
|
1390 |
+ var b = require('bean') |
|
1391 |
+ |
|
1392 |
+ , integrate = function (method, type, method2) { |
|
1393 |
+ var _args = type ? [type] : [] |
|
1394 |
+ return function () { |
|
1395 |
+ for (var i = 0, l = this.length; i < l; i++) { |
|
1396 |
+ if (!arguments.length && method == 'on' && type) method = 'fire' |
|
1397 |
+ b[method].apply(this, [this[i]].concat(_args, Array.prototype.slice.call(arguments, 0))) |
|
1398 |
+ } |
|
1399 |
+ return this |
|
1400 |
+ } |
|
1401 |
+ } |
|
1402 |
+ |
|
1403 |
+ , add = integrate('add') |
|
1404 |
+ , on = integrate('on') |
|
1405 |
+ , one = integrate('one') |
|
1406 |
+ , off = integrate('off') |
|
1407 |
+ , fire = integrate('fire') |
|
1408 |
+ , clone = integrate('clone') |
|
1409 |
+ |
|
1410 |
+ , hover = function (enter, leave, i) { // i for internal |
|
1411 |
+ for (i = this.length; i--;) { |
|
1412 |
+ b.on.call(this, this[i], 'mouseenter', enter) |
|
1413 |
+ b.on.call(this, this[i], 'mouseleave', leave) |
|
1414 |
+ } |
|
1415 |
+ return this |
|
1416 |
+ } |
|
1417 |
+ |
|
1418 |
+ , methods = { |
|
1419 |
+ on : on |
|
1420 |
+ , addListener : on |
|
1421 |
+ , bind : on |
|
1422 |
+ , listen : on |
|
1423 |
+ , delegate : add // jQuery compat, same arg order as add() |
|
1424 |
+ |
|
1425 |
+ , one : one |
|
1426 |
+ |
|
1427 |
+ , off : off |
|
1428 |
+ , unbind : off |
|
1429 |
+ , unlisten : off |
|
1430 |
+ , removeListener : off |
|
1431 |
+ , undelegate : off |
|
1432 |
+ |
|
1433 |
+ , emit : fire |
|
1434 |
+ , trigger : fire |
|
1435 |
+ |
|
1436 |
+ , cloneEvents : clone |
|
1437 |
+ |
|
1438 |
+ , hover : hover |
|
1439 |
+ } |
|
1440 |
+ |
|
1441 |
+ , shortcuts = |
|
1442 |
+ ('blur change click dblclick error focus focusin focusout keydown keypress ' |
|
1443 |
+ + 'keyup load mousedown mouseenter mouseleave mouseout mouseover mouseup ' |
|
1444 |
+ + 'mousemove resize scroll select submit unload').split(' ') |
|
1445 |
+ |
|
1446 |
+ for (var i = shortcuts.length; i--;) { |
|
1447 |
+ methods[shortcuts[i]] = integrate('on', shortcuts[i]) |
|
1448 |
+ } |
|
1449 |
+ |
|
1450 |
+ b.setSelectorEngine($) |
|
1451 |
+ |
|
1452 |
+ $.ender(methods, true) |
|
1453 |
+ }(ender); |
|
1454 |
+ |
|
1455 |
+}()); |
|
1456 |
+ |
|
1457 |
+(function () { |
|
1458 |
+ |
|
1459 |
+ var module = { exports: {} }, exports = module.exports; |
|
1460 |
+ |
|
1461 |
+ /*! |
|
1462 |
+ * Bonzo: DOM Utility (c) Dustin Diaz 2012 |
|
1463 |
+ * https://github.com/ded/bonzo |
|
1464 |
+ * License MIT |
|
1465 |
+ */ |
|
1466 |
+ (function (name, context, definition) { |
|
1467 |
+ if (typeof module != 'undefined' && module.exports) module.exports = definition() |
|
1468 |
+ else if (typeof context['define'] == 'function' && context['define']['amd']) define(definition) |
|
1469 |
+ else context[name] = definition() |
|
1470 |
+ })('bonzo', this, function() { |
|
1471 |
+ var win = window |
|
1472 |
+ , doc = win.document |
|
1473 |
+ , html = doc.documentElement |
|
1474 |
+ , parentNode = 'parentNode' |
|
1475 |
+ , specialAttributes = /^(checked|value|selected|disabled)$/i |
|
1476 |
+ , specialTags = /^(select|fieldset|table|tbody|tfoot|td|tr|colgroup)$/i // tags that we have trouble inserting *into* |
|
1477 |
+ , simpleScriptTagRe = /\s*<script +src=['"]([^'"]+)['"]>/ |
|
1478 |
+ , table = ['<table>', '</table>', 1] |
|
1479 |
+ , td = ['<table><tbody><tr>', '</tr></tbody></table>', 3] |
|
1480 |
+ , option = ['<select>', '</select>', 1] |
|
1481 |
+ , noscope = ['_', '', 0, 1] |
|
1482 |
+ , tagMap = { // tags that we have trouble *inserting* |
|
1483 |
+ thead: table, tbody: table, tfoot: table, colgroup: table, caption: table |
|
1484 |
+ , tr: ['<table><tbody>', '</tbody></table>', 2] |
|
1485 |
+ , th: td , td: td |
|
1486 |
+ , col: ['<table><colgroup>', '</colgroup></table>', 2] |
|
1487 |
+ , fieldset: ['<form>', '</form>', 1] |
|
1488 |
+ , legend: ['<form><fieldset>', '</fieldset></form>', 2] |
|
1489 |
+ , option: option, optgroup: option |
|
1490 |
+ , script: noscope, style: noscope, link: noscope, param: noscope, base: noscope |
|
1491 |
+ } |
|
1492 |
+ , stateAttributes = /^(checked|selected|disabled)$/ |
|
1493 |
+ , ie = /msie/i.test(navigator.userAgent) |
|
1494 |
+ , hasClass, addClass, removeClass |
|
1495 |
+ , uidMap = {} |
|
1496 |
+ , uuids = 0 |
|
1497 |
+ , digit = /^-?[\d\.]+$/ |
|
1498 |
+ , dattr = /^data-(.+)$/ |
|
1499 |
+ , px = 'px' |
|
1500 |
+ , setAttribute = 'setAttribute' |
|
1501 |
+ , getAttribute = 'getAttribute' |
|
1502 |
+ , byTag = 'getElementsByTagName' |
|
1503 |
+ , features = function() { |
|
1504 |
+ var e = doc.createElement('p') |
|
1505 |
+ e.innerHTML = '<a href="#x">x</a><table style="float:left;"></table>' |
|
1506 |
+ return { |
|
1507 |
+ hrefExtended: e[byTag]('a')[0][getAttribute]('href') != '#x' // IE < 8 |
|
1508 |
+ , autoTbody: e[byTag]('tbody').length !== 0 // IE < 8 |
|
1509 |
+ , computedStyle: doc.defaultView && doc.defaultView.getComputedStyle |
|
1510 |
+ , cssFloat: e[byTag]('table')[0].style.styleFloat ? 'styleFloat' : 'cssFloat' |
|
1511 |
+ , transform: function () { |
|
1512 |
+ var props = ['transform', 'webkitTransform', 'MozTransform', 'OTransform', 'msTransform'], i |
|
1513 |
+ for (i = 0; i < props.length; i++) { |
|
1514 |
+ if (props[i] in e.style) return props[i] |
|
1515 |
+ } |
|
1516 |
+ }() |
|
1517 |
+ , classList: 'classList' in e |
|
1518 |
+ , opasity: function () { |
|
1519 |
+ return typeof doc.createElement('a').style.opacity !== 'undefined' |
|
1520 |
+ }() |
|
1521 |
+ } |
|
1522 |
+ }() |
|
1523 |
+ , trimReplace = /(^\s*|\s*$)/g |
|
1524 |
+ , whitespaceRegex = /\s+/ |
|
1525 |
+ , toString = String.prototype.toString |
|
1526 |
+ , unitless = { lineHeight: 1, zoom: 1, zIndex: 1, opacity: 1, boxFlex: 1, WebkitBoxFlex: 1, MozBoxFlex: 1 } |
|
1527 |
+ , query = doc.querySelectorAll && function (selector) { return doc.querySelectorAll(selector) } |
|
1528 |
+ , trim = String.prototype.trim ? |
|
1529 |
+ function (s) { |
|
1530 |
+ return s.trim() |
|
1531 |
+ } : |
|
1532 |
+ function (s) { |
|
1533 |
+ return s.replace(trimReplace, '') |
|
1534 |
+ } |
|
1535 |
+ |
|
1536 |
+ |
|
1537 |
+ function isNode(node) { |
|
1538 |
+ return node && node.nodeName && (node.nodeType == 1 || node.nodeType == 11) |
|
1539 |
+ } |
|
1540 |
+ |
|
1541 |
+ |
|
1542 |
+ function normalize(node, host, clone) { |
|
1543 |
+ var i, l, ret |
|
1544 |
+ if (typeof node == 'string') return bonzo.create(node) |
|
1545 |
+ if (isNode(node)) node = [ node ] |
|
1546 |
+ if (clone) { |
|
1547 |
+ ret = [] // don't change original array |
|
1548 |
+ for (i = 0, l = node.length; i < l; i++) ret[i] = cloneNode(host, node[i]) |
|
1549 |
+ return ret |
|
1550 |
+ } |
|
1551 |
+ return node |
|
1552 |
+ } |
|
1553 |
+ |
|
1554 |
+ |
|
1555 |
+ /** |
|
1556 |
+ * @param {string} c a class name to test |
|
1557 |
+ * @return {boolean} |
|
1558 |
+ */ |
|
1559 |
+ function classReg(c) { |
|
1560 |
+ return new RegExp("(^|\\s+)" + c + "(\\s+|$)") |
|
1561 |
+ } |
|
1562 |
+ |
|
1563 |
+ |
|
1564 |
+ /** |
|
1565 |
+ * @param {Bonzo|Array} ar |
|
1566 |
+ * @param {function(Object, number, (Bonzo|Array))} fn |
|
1567 |
+ * @param {Object=} opt_scope |
|
1568 |
+ * @param {boolean=} opt_rev |
|
1569 |
+ * @return {Bonzo|Array} |
|
1570 |
+ */ |
|
1571 |
+ function each(ar, fn, opt_scope, opt_rev) { |
|
1572 |
+ var ind, i = 0, l = ar.length |
|
1573 |
+ for (; i < l; i++) { |
|
1574 |
+ ind = opt_rev ? ar.length - i - 1 : i |
|
1575 |
+ fn.call(opt_scope || ar[ind], ar[ind], ind, ar) |
|
1576 |
+ } |
|
1577 |
+ return ar |
|
1578 |
+ } |
|
1579 |
+ |
|
1580 |
+ |
|
1581 |
+ /** |
|
1582 |
+ * @param {Bonzo|Array} ar |
|
1583 |
+ * @param {function(Object, number, (Bonzo|Array))} fn |
|
1584 |
+ * @param {Object=} opt_scope |
|
1585 |
+ * @return {Bonzo|Array} |
|
1586 |
+ */ |
|
1587 |
+ function deepEach(ar, fn, opt_scope) { |
|
1588 |
+ for (var i = 0, l = ar.length; i < l; i++) { |
|
1589 |
+ if (isNode(ar[i])) { |
|
1590 |
+ deepEach(ar[i].childNodes, fn, opt_scope) |
|
1591 |
+ fn.call(opt_scope || ar[i], ar[i], i, ar) |
|
1592 |
+ } |
|
1593 |
+ } |
|
1594 |
+ return ar |
|
1595 |
+ } |
|
1596 |
+ |
|
1597 |
+ |
|
1598 |
+ /** |
|
1599 |
+ * @param {string} s |
|
1600 |
+ * @return {string} |
|
1601 |
+ */ |
|
1602 |
+ function camelize(s) { |
|
1603 |
+ return s.replace(/-(.)/g, function (m, m1) { |
|
1604 |
+ return m1.toUpperCase() |
|
1605 |
+ }) |
|
1606 |
+ } |
|
1607 |
+ |
|
1608 |
+ |
|
1609 |
+ /** |
|
1610 |
+ * @param {string} s |
|
1611 |
+ * @return {string} |
|
1612 |
+ */ |
|
1613 |
+ function decamelize(s) { |
|
1614 |
+ return s ? s.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() : s |
|
1615 |
+ } |
|
1616 |
+ |
|
1617 |
+ |
|
1618 |
+ /** |
|
1619 |
+ * @param {Element} el |
|
1620 |
+ * @return {*} |
|
1621 |
+ */ |
|
1622 |
+ function data(el) { |
|
1623 |
+ el[getAttribute]('data-node-uid') || el[setAttribute]('data-node-uid', ++uuids) |
|
1624 |
+ var uid = el[getAttribute]('data-node-uid') |
|
1625 |
+ return uidMap[uid] || (uidMap[uid] = {}) |
|
1626 |
+ } |
|
1627 |
+ |
|
1628 |
+ |
|
1629 |
+ /** |
|
1630 |
+ * removes the data associated with an element |
|
1631 |
+ * @param {Element} el |
|
1632 |
+ */ |
|
1633 |
+ function clearData(el) { |
|
1634 |
+ var uid = el[getAttribute]('data-node-uid') |
|
1635 |
+ if (uid) delete uidMap[uid] |
|
1636 |
+ } |
|
1637 |
+ |
|
1638 |
+ |
|
1639 |
+ function dataValue(d) { |
|
1640 |
+ var f |
|
1641 |
+ try { |
|
1642 |
+ return (d === null || d === undefined) ? undefined : |
|
1643 |
+ d === 'true' ? true : |
|
1644 |
+ d === 'false' ? false : |
|
1645 |
+ d === 'null' ? null : |
|
1646 |
+ (f = parseFloat(d)) == d ? f : d; |
|
1647 |
+ } catch(e) {} |
|
1648 |
+ return undefined |
|
1649 |
+ } |
|
1650 |
+ |
|
1651 |
+ |
|
1652 |
+ /** |
|
1653 |
+ * @param {Bonzo|Array} ar |
|
1654 |
+ * @param {function(Object, number, (Bonzo|Array))} fn |
|
1655 |
+ * @param {Object=} opt_scope |
|
1656 |
+ * @return {boolean} whether `some`thing was found |
|
1657 |
+ */ |
|
1658 |
+ function some(ar, fn, opt_scope) { |
|
1659 |
+ for (var i = 0, j = ar.length; i < j; ++i) if (fn.call(opt_scope || null, ar[i], i, ar)) return true |
|
1660 |
+ return false |
|
1661 |
+ } |
|
1662 |
+ |
|
1663 |
+ |
|
1664 |
+ /** |
|
1665 |
+ * this could be a giant enum of CSS properties |
|
1666 |
+ * but in favor of file size sans-closure deadcode optimizations |
|
1667 |
+ * we're just asking for any ol string |
|
1668 |
+ * then it gets transformed into the appropriate style property for JS access |
|
1669 |
+ * @param {string} p |
|
1670 |
+ * @return {string} |
|
1671 |
+ */ |
|
1672 |
+ function styleProperty(p) { |
|
1673 |
+ (p == 'transform' && (p = features.transform)) || |
|
1674 |
+ (/^transform-?[Oo]rigin$/.test(p) && (p = features.transform + 'Origin')) || |
|
1675 |
+ (p == 'float' && (p = features.cssFloat)) |
|
1676 |
+ return p ? camelize(p) : null |
|
1677 |
+ } |
|
1678 |
+ |
|
1679 |
+ var getStyle = features.computedStyle ? |
|
1680 |
+ function (el, property) { |
|
1681 |
+ var value = null |
|
1682 |
+ , computed = doc.defaultView.getComputedStyle(el, '') |
|
1683 |
+ computed && (value = computed[property]) |
|
1684 |
+ return el.style[property] || value |
|
1685 |
+ } : |
|
1686 |
+ |
|
1687 |
+ (ie && html.currentStyle) ? |
|
1688 |
+ |
|
1689 |
+ /** |
|
1690 |
+ * @param {Element} el |
|
1691 |
+ * @param {string} property |
|
1692 |
+ * @return {string|number} |
|
1693 |
+ */ |
|
1694 |
+ function (el, property) { |
|
1695 |
+ if (property == 'opacity' && !features.opasity) { |
|
1696 |
+ var val = 100 |
|
1697 |
+ try { |
|
1698 |
+ val = el['filters']['DXImageTransform.Microsoft.Alpha'].opacity |
|
1699 |
+ } catch (e1) { |
|
1700 |
+ try { |
|
1701 |
+ val = el['filters']('alpha').opacity |
|
1702 |
+ } catch (e2) {} |
|
1703 |
+ } |
|
1704 |
+ return val / 100 |
|
1705 |
+ } |
|
1706 |
+ var value = el.currentStyle ? el.currentStyle[property] : null |
|
1707 |
+ return el.style[property] || value |
|
1708 |
+ } : |
|
1709 |
+ |
|
1710 |
+ function (el, property) { |
|
1711 |
+ return el.style[property] |
|
1712 |
+ } |
|
1713 |
+ |
|
1714 |
+ // this insert method is intense |
|
1715 |
+ function insert(target, host, fn, rev) { |
|
1716 |
+ var i = 0, self = host || this, r = [] |
|
1717 |
+ // target nodes could be a css selector if it's a string and a selector engine is present |
|
1718 |
+ // otherwise, just use target |
|
1719 |
+ , nodes = query && typeof target == 'string' && target.charAt(0) != '<' ? query(target) : target |
|
1720 |
+ // normalize each node in case it's still a string and we need to create nodes on the fly |
|
1721 |
+ each(normalize(nodes), function (t, j) { |
|
1722 |
+ each(self, function (el) { |
|
1723 |
+ fn(t, r[i++] = j > 0 ? cloneNode(self, el) : el) |
|
1724 |
+ }, null, rev) |
|
1725 |
+ }, this, rev) |
|
1726 |
+ self.length = i |
|
1727 |
+ each(r, function (e) { |
|
1728 |
+ self[--i] = e |
|
1729 |
+ }, null, !rev) |
|
1730 |
+ return self |
|
1731 |
+ } |
|
1732 |
+ |
|
1733 |
+ |
|
1734 |
+ /** |
|
1735 |
+ * sets an element to an explicit x/y position on the page |
|
1736 |
+ * @param {Element} el |
|
1737 |
+ * @param {?number} x |
|
1738 |
+ * @param {?number} y |
|
1739 |
+ */ |
|
1740 |
+ function xy(el, x, y) { |
|
1741 |
+ var $el = bonzo(el) |
|
1742 |
+ , style = $el.css('position') |
|
1743 |
+ , offset = $el.offset() |
|
1744 |
+ , rel = 'relative' |
|
1745 |
+ , isRel = style == rel |
|
1746 |
+ , delta = [parseInt($el.css('left'), 10), parseInt($el.css('top'), 10)] |
|
1747 |
+ |
|
1748 |
+ if (style == 'static') { |
|
1749 |
+ $el.css('position', rel) |
|
1750 |
+ style = rel |
|
1751 |
+ } |
|
1752 |
+ |
|
1753 |
+ isNaN(delta[0]) && (delta[0] = isRel ? 0 : el.offsetLeft) |
|
1754 |
+ isNaN(delta[1]) && (delta[1] = isRel ? 0 : el.offsetTop) |
|
1755 |
+ |
|
1756 |
+ x != null && (el.style.left = x - offset.left + delta[0] + px) |
|
1757 |
+ y != null && (el.style.top = y - offset.top + delta[1] + px) |
|
1758 |
+ |
|
1759 |
+ } |
|
1760 |
+ |
|
1761 |
+ // classList support for class management |
|
1762 |
+ // altho to be fair, the api sucks because it won't accept multiple classes at once |
|
1763 |
+ if (features.classList) { |
|
1764 |
+ hasClass = function (el, c) { |
|
1765 |
+ return el.classList.contains(c) |
|
1766 |
+ } |
|
1767 |
+ addClass = function (el, c) { |
|
1768 |
+ el.classList.add(c) |
|
1769 |
+ } |
|
1770 |
+ removeClass = function (el, c) { |
|
1771 |
+ el.classList.remove(c) |
|
1772 |
+ } |
|
1773 |
+ } |
|
1774 |
+ else { |
|
1775 |
+ hasClass = function (el, c) { |
|
1776 |
+ return classReg(c).test(el.className) |
|
1777 |
+ } |
|
1778 |
+ addClass = function (el, c) { |
|
1779 |
+ el.className = trim(el.className + ' ' + c) |
|
1780 |
+ } |
|
1781 |
+ removeClass = function (el, c) { |
|
1782 |
+ el.className = trim(el.className.replace(classReg(c), ' ')) |
|
1783 |
+ } |
|
1784 |
+ } |
|
1785 |
+ |
|
1786 |
+ |
|
1787 |
+ /** |
|
1788 |
+ * this allows method calling for setting values |
|
1789 |
+ * |
|
1790 |
+ * @example |
|
1791 |
+ * bonzo(elements).css('color', function (el) { |
|
1792 |
+ * return el.getAttribute('data-original-color') |
|
1793 |
+ * }) |
|
1794 |
+ * |
|
1795 |
+ * @param {Element} el |
|
1796 |
+ * @param {function (Element)|string} |
|
1797 |
+ * @return {string} |
|
1798 |
+ */ |
|
1799 |
+ function setter(el, v) { |
|
1800 |
+ return typeof v == 'function' ? v(el) : v |
|
1801 |
+ } |
|
1802 |
+ |
|
1803 |
+ /** |
|
1804 |
+ * @constructor |
|
1805 |
+ * @param {Array.<Element>|Element|Node|string} elements |
|
1806 |
+ */ |
|
1807 |
+ function Bonzo(elements) { |
|
1808 |
+ this.length = 0 |
|
1809 |
+ if (elements) { |
|
1810 |
+ elements = typeof elements !== 'string' && |
|
1811 |
+ !elements.nodeType && |
|
1812 |
+ typeof elements.length !== 'undefined' ? |
|
1813 |
+ elements : |
|
1814 |
+ [elements] |
|
1815 |
+ this.length = elements.length |
|
1816 |
+ for (var i = 0; i < elements.length; i++) this[i] = elements[i] |
|
1817 |
+ } |
|
1818 |
+ } |
|
1819 |
+ |
|
1820 |
+ Bonzo.prototype = { |
|
1821 |
+ |
|
1822 |
+ /** |
|
1823 |
+ * @param {number} index |
|
1824 |
+ * @return {Element|Node} |
|
1825 |
+ */ |
|
1826 |
+ get: function (index) { |
|
1827 |
+ return this[index] || null |
|
1828 |
+ } |
|
1829 |
+ |
|
1830 |
+ // itetators |
|
1831 |
+ /** |
|
1832 |
+ * @param {function(Element|Node)} fn |
|
1833 |
+ * @param {Object=} opt_scope |
|
1834 |
+ * @return {Bonzo} |
|
1835 |
+ */ |
|
1836 |
+ , each: function (fn, opt_scope) { |
|
1837 |
+ return each(this, fn, opt_scope) |
|
1838 |
+ } |
|
1839 |
+ |
|
1840 |
+ /** |
|
1841 |
+ * @param {Function} fn |
|
1842 |
+ * @param {Object=} opt_scope |
|
1843 |
+ * @return {Bonzo} |
|
1844 |
+ */ |
|
1845 |
+ , deepEach: function (fn, opt_scope) { |
|
1846 |
+ return deepEach(this, fn, opt_scope) |
|
1847 |
+ } |
|
1848 |
+ |
|
1849 |
+ |
|
1850 |
+ /** |
|
1851 |
+ * @param {Function} fn |
|
1852 |
+ * @param {Function=} opt_reject |
|
1853 |
+ * @return {Array} |
|
1854 |
+ */ |
|
1855 |
+ , map: function (fn, opt_reject) { |
|
1856 |
+ var m = [], n, i |
|
1857 |
+ for (i = 0; i < this.length; i++) { |
|
1858 |
+ n = fn.call(this, this[i], i) |
|
1859 |
+ opt_reject ? (opt_reject(n) && m.push(n)) : m.push(n) |
|
1860 |
+ } |
|
1861 |
+ return m |
|
1862 |
+ } |
|
1863 |
+ |
|
1864 |
+ // text and html inserters! |
|
1865 |
+ |
|
1866 |
+ /** |
|
1867 |
+ * @param {string} h the HTML to insert |
|
1868 |
+ * @param {boolean=} opt_text whether to set or get text content |
|
1869 |
+ * @return {Bonzo|string} |
|
1870 |
+ */ |
|
1871 |
+ , html: function (h, opt_text) { |
|
1872 |
+ var method = opt_text |
|
1873 |
+ ? html.textContent === undefined ? 'innerText' : 'textContent' |
|
1874 |
+ : 'innerHTML' |
|
1875 |
+ , that = this |
|
1876 |
+ , append = function (el, i) { |
|
1877 |
+ each(normalize(h, that, i), function (node) { |
|
1878 |
+ el.appendChild(node) |
|
1879 |
+ }) |
|
1880 |
+ } |
|
1881 |
+ , updateElement = function (el, i) { |
|
1882 |
+ try { |
|
1883 |
+ if (opt_text || (typeof h == 'string' && !specialTags.test(el.tagName))) { |
|
1884 |
+ return el[method] = h |
|
1885 |
+ } |
|
1886 |
+ } catch (e) {} |
|
1887 |
+ append(el, i) |
|
1888 |
+ } |
|
1889 |
+ return typeof h != 'undefined' |
|
1890 |
+ ? this.empty().each(updateElement) |
|
1891 |
+ : this[0] ? this[0][method] : '' |
|
1892 |
+ } |
|
1893 |
+ |
|
1894 |
+ /** |
|
1895 |
+ * @param {string=} opt_text the text to set, otherwise this is a getter |
|
1896 |
+ * @return {Bonzo|string} |
|
1897 |
+ */ |
|
1898 |
+ , text: function (opt_text) { |
|
1899 |
+ return this.html(opt_text, true) |
|
1900 |
+ } |
|
1901 |
+ |
|
1902 |
+ // more related insertion methods |
|
1903 |
+ |
|
1904 |
+ /** |
|
1905 |
+ * @param {Bonzo|string|Element|Array} node |
|
1906 |
+ * @return {Bonzo} |
|
1907 |
+ */ |
|
1908 |
+ , append: function (node) { |
|
1909 |
+ var that = this |
|
1910 |
+ return this.each(function (el, i) { |
|
1911 |
+ each(normalize(node, that, i), function (i) { |
|
1912 |
+ el.appendChild(i) |
|
1913 |
+ }) |
|
1914 |
+ }) |
|
1915 |
+ } |
|
1916 |
+ |
|
1917 |
+ |
|
1918 |
+ /** |
|
1919 |
+ * @param {Bonzo|string|Element|Array} node |
|
1920 |
+ * @return {Bonzo} |
|
1921 |
+ */ |
|
1922 |
+ , prepend: function (node) { |
|
1923 |
+ var that = this |
|
1924 |
+ return this.each(function (el, i) { |
|
1925 |
+ var first = el.firstChild |
|
1926 |
+ each(normalize(node, that, i), function (i) { |
|
1927 |
+ el.insertBefore(i, first) |
|
1928 |
+ }) |
|
1929 |
+ }) |
|
1930 |
+ } |
|
1931 |
+ |
|
1932 |
+ |
|
1933 |
+ /** |
|
1934 |
+ * @param {Bonzo|string|Element|Array} target the location for which you'll insert your new content |
|
1935 |
+ * @param {Object=} opt_host an optional host scope (primarily used when integrated with Ender) |
|
1936 |
+ * @return {Bonzo} |
|
1937 |
+ */ |
|
1938 |
+ , appendTo: function (target, opt_host) { |
|
1939 |
+ return insert.call(this, target, opt_host, function (t, el) { |
|
1940 |
+ t.appendChild(el) |
|
1941 |
+ }) |
|
1942 |
+ } |
|
1943 |
+ |
|
1944 |
+ |
|
1945 |
+ /** |
|
1946 |
+ * @param {Bonzo|string|Element|Array} target the location for which you'll insert your new content |
|
1947 |
+ * @param {Object=} opt_host an optional host scope (primarily used when integrated with Ender) |
|
1948 |
+ * @return {Bonzo} |
|
1949 |
+ */ |
|
1950 |
+ , prependTo: function (target, opt_host) { |
|
1951 |
+ return insert.call(this, target, opt_host, function (t, el) { |
|
1952 |
+ t.insertBefore(el, t.firstChild) |
|
1953 |
+ }, 1) |
|
1954 |
+ } |
|
1955 |
+ |
|
1956 |
+ |
|
1957 |
+ /** |
|
1958 |
+ * @param {Bonzo|string|Element|Array} node |
|
1959 |
+ * @return {Bonzo} |
|
1960 |
+ */ |
|
1961 |
+ , before: function (node) { |
|
1962 |
+ var that = this |
|
1963 |
+ return this.each(function (el, i) { |
|
1964 |
+ each(normalize(node, that, i), function (i) { |
|
1965 |
+ el[parentNode].insertBefore(i, el) |
|
1966 |
+ }) |
|
1967 |
+ }) |
|
1968 |
+ } |
|
1969 |
+ |
|
1970 |
+ |
|
1971 |
+ /** |
|
1972 |
+ * @param {Bonzo|string|Element|Array} node |
|
1973 |
+ * @return {Bonzo} |
|
1974 |
+ */ |
|
1975 |
+ , after: function (node) { |
|
1976 |
+ var that = this |
|
1977 |
+ return this.each(function (el, i) { |
|
1978 |
+ each(normalize(node, that, i), function (i) { |
|
1979 |
+ el[parentNode].insertBefore(i, el.nextSibling) |
|
1980 |
+ }, null, 1) |
|
1981 |
+ }) |
|
1982 |
+ } |
|
1983 |
+ |
|
1984 |
+ |
|
1985 |
+ /** |
|
1986 |
+ * @param {Bonzo|string|Element|Array} target the location for which you'll insert your new content |
|
1987 |
+ * @param {Object=} opt_host an optional host scope (primarily used when integrated with Ender) |
|
1988 |
+ * @return {Bonzo} |
|
1989 |
+ */ |
|
1990 |
+ , insertBefore: function (target, opt_host) { |
|
1991 |
+ return insert.call(this, target, opt_host, function (t, el) { |
|
1992 |
+ t[parentNode].insertBefore(el, t) |
|
1993 |
+ }) |
|
1994 |
+ } |
|
1995 |
+ |
|
1996 |
+ |
|
1997 |
+ /** |
|
1998 |
+ * @param {Bonzo|string|Element|Array} target the location for which you'll insert your new content |
|
1999 |
+ * @param {Object=} opt_host an optional host scope (primarily used when integrated with Ender) |
|
2000 |
+ * @return {Bonzo} |
|
2001 |
+ */ |
|
2002 |
+ , insertAfter: function (target, opt_host) { |
|
2003 |
+ return insert.call(this, target, opt_host, function (t, el) { |
|
2004 |
+ var sibling = t.nextSibling |
|
2005 |
+ sibling ? |
|
2006 |
+ t[parentNode].insertBefore(el, sibling) : |
|
2007 |
+ t[parentNode].appendChild(el) |
|
2008 |
+ }, 1) |
|
2009 |
+ } |
|
2010 |
+ |
|
2011 |
+ |
|
2012 |
+ /** |
|
2013 |
+ * @param {Bonzo|string|Element|Array} node |
|
2014 |
+ * @return {Bonzo} |
|
2015 |
+ */ |
|
2016 |
+ , replaceWith: function (node) { |
|
2017 |
+ bonzo(normalize(node)).insertAfter(this) |
|
2018 |
+ return this.remove() |
|
2019 |
+ } |
|
2020 |
+ |
|
2021 |
+ // class management |
|
2022 |
+ |
|
2023 |
+ /** |
|
2024 |
+ * @param {string} c |
|
2025 |
+ * @return {Bonzo} |
|
2026 |
+ */ |
|
2027 |
+ , addClass: function (c) { |
|
2028 |
+ c = toString.call(c).split(whitespaceRegex) |
|
2029 |
+ return this.each(function (el) { |
|
2030 |
+ // we `each` here so you can do $el.addClass('foo bar') |
|
2031 |
+ each(c, function (c) { |
|
2032 |
+ if (c && !hasClass(el, setter(el, c))) |
|
2033 |
+ addClass(el, setter(el, c)) |
|
2034 |
+ }) |
|
2035 |
+ }) |
|
2036 |
+ } |
|
2037 |
+ |
|
2038 |
+ |
|
2039 |
+ /** |
|
2040 |
+ * @param {string} c |
|
2041 |
+ * @return {Bonzo} |
|
2042 |
+ */ |
|
2043 |
+ , removeClass: function (c) { |
|
2044 |
+ c = toString.call(c).split(whitespaceRegex) |
|
2045 |
+ return this.each(function (el) { |
|
2046 |
+ each(c, function (c) { |
|
2047 |
+ if (c && hasClass(el, setter(el, c))) |
|
2048 |
+ removeClass(el, setter(el, c)) |
|
2049 |
+ }) |
|
2050 |
+ }) |
|
2051 |
+ } |
|
2052 |
+ |
|
2053 |
+ |
|
2054 |
+ /** |
|
2055 |
+ * @param {string} c |
|
2056 |
+ * @return {boolean} |
|
2057 |
+ */ |
|
2058 |
+ , hasClass: function (c) { |
|
2059 |
+ c = toString.call(c).split(whitespaceRegex) |
|
2060 |
+ return some(this, function (el) { |
|
2061 |
+ return some(c, function (c) { |
|
2062 |
+ return c && hasClass(el, c) |
|
2063 |
+ }) |
|
2064 |
+ }) |
|
2065 |
+ } |
|
2066 |
+ |
|
2067 |
+ |
|
2068 |
+ /** |
|
2069 |
+ * @param {string} c classname to toggle |
|
2070 |
+ * @param {boolean=} opt_condition whether to add or remove the class straight away |
|
2071 |
+ * @return {Bonzo} |
|
2072 |
+ */ |
|
2073 |
+ , toggleClass: function (c, opt_condition) { |
|
2074 |
+ c = toString.call(c).split(whitespaceRegex) |
|
2075 |
+ return this.each(function (el) { |
|
2076 |
+ each(c, function (c) { |
|
2077 |
+ if (c) { |
|
2078 |
+ typeof opt_condition !== 'undefined' ? |
|
2079 |
+ opt_condition ? addClass(el, c) : removeClass(el, c) : |
|
2080 |
+ hasClass(el, c) ? removeClass(el, c) : addClass(el, c) |
|
2081 |
+ } |
|
2082 |
+ }) |
|
2083 |
+ }) |
|
2084 |
+ } |
|
2085 |
+ |
|
2086 |
+ // display togglers |
|
2087 |
+ |
|
2088 |
+ /** |
|
2089 |
+ * @param {string=} opt_type useful to set back to anything other than an empty string |
|
2090 |
+ * @return {Bonzo} |
|
2091 |
+ */ |
|
2092 |
+ , show: function (opt_type) { |
|
2093 |
+ opt_type = typeof opt_type == 'string' ? opt_type : '' |
|
2094 |
+ return this.each(function (el) { |
|
2095 |
+ el.style.display = opt_type |
|
2096 |
+ }) |
|
2097 |
+ } |
|
2098 |
+ |
|
2099 |
+ |
|
2100 |
+ /** |
|
2101 |
+ * @return {Bonzo} |
|
2102 |
+ */ |
|
2103 |
+ , hide: function () { |
|
2104 |
+ return this.each(function (el) { |
|
2105 |
+ el.style.display = 'none' |
|
2106 |
+ }) |
|
2107 |
+ } |
|
2108 |
+ |
|
2109 |
+ |
|
2110 |
+ /** |
|
2111 |
+ * @param {Function=} opt_callback |
|
2112 |
+ * @param {string=} opt_type |
|
2113 |
+ * @return {Bonzo} |
|
2114 |
+ */ |
|
2115 |
+ , toggle: function (opt_callback, opt_type) { |
|
2116 |
+ opt_type = typeof opt_type == 'string' ? opt_type : ''; |
|
2117 |
+ typeof opt_callback != 'function' && (opt_callback = null) |
|
2118 |
+ return this.each(function (el) { |
|
2119 |
+ el.style.display = (el.offsetWidth || el.offsetHeight) ? 'none' : opt_type; |
|
2120 |
+ opt_callback && opt_callback.call(el) |
|
2121 |
+ }) |
|
2122 |
+ } |
|
2123 |
+ |
|
2124 |
+ |
|
2125 |
+ // DOM Walkers & getters |
|
2126 |
+ |
|
2127 |
+ /** |
|
2128 |
+ * @return {Element|Node} |
|
2129 |
+ */ |
|
2130 |
+ , first: function () { |
|
2131 |
+ return bonzo(this.length ? this[0] : []) |
|
2132 |
+ } |
|
2133 |
+ |
|
2134 |
+ |
|
2135 |
+ /** |
|
2136 |
+ * @return {Element|Node} |
|
2137 |
+ */ |
|
2138 |
+ , last: function () { |
|
2139 |
+ return bonzo(this.length ? this[this.length - 1] : []) |
|
2140 |
+ } |
|
2141 |
+ |
|
2142 |
+ |
|
2143 |
+ /** |
|
2144 |
+ * @return {Element|Node} |
|
2145 |
+ */ |
|
2146 |
+ , next: function () { |
|
2147 |
+ return this.related('nextSibling') |
|
2148 |
+ } |
|
2149 |
+ |
|
2150 |
+ |
|
2151 |
+ /** |
|
2152 |
+ * @return {Element|Node} |
|
2153 |
+ */ |
|
2154 |
+ , previous: function () { |
|
2155 |
+ return this.related('previousSibling') |
|
2156 |
+ } |
|
2157 |
+ |
|
2158 |
+ |
|
2159 |
+ /** |
|
2160 |
+ * @return {Element|Node} |
|
2161 |
+ */ |
|
2162 |
+ , parent: function() { |
|
2163 |
+ return this.related(parentNode) |
|
2164 |
+ } |
|
2165 |
+ |
|
2166 |
+ |
|
2167 |
+ /** |
|
2168 |
+ * @private |
|
2169 |
+ * @param {string} method the directional DOM method |
|
2170 |
+ * @return {Element|Node} |
|
2171 |
+ */ |
|
2172 |
+ , related: function (method) { |
|
2173 |
+ return this.map( |
|
2174 |
+ function (el) { |
|
2175 |
+ el = el[method] |
|
2176 |
+ while (el && el.nodeType !== 1) { |
|
2177 |
+ el = el[method] |
|
2178 |
+ } |
|
2179 |
+ return el || 0 |
|
2180 |
+ }, |
|
2181 |
+ function (el) { |
|
2182 |
+ return el |
|
2183 |
+ } |
|
2184 |
+ ) |
|
2185 |
+ } |
|
2186 |
+ |
|
2187 |
+ |
|
2188 |
+ /** |
|
2189 |
+ * @return {Bonzo} |
|
2190 |
+ */ |
|
2191 |
+ , focus: function () { |
|
2192 |
+ this.length && this[0].focus() |
|
2193 |
+ return this |
|
2194 |
+ } |
|
2195 |
+ |
|
2196 |
+ |
|
2197 |
+ /** |
|
2198 |
+ * @return {Bonzo} |
|
2199 |
+ */ |
|
2200 |
+ , blur: function () { |
|
2201 |
+ this.length && this[0].blur() |
|
2202 |
+ return this |
|
2203 |
+ } |
|
2204 |
+ |
|
2205 |
+ // style getter setter & related methods |
|
2206 |
+ |
|
2207 |
+ /** |
|
2208 |
+ * @param {Object|string} o |
|
2209 |
+ * @param {string=} opt_v |
|
2210 |
+ * @return {Bonzo|string} |
|
2211 |
+ */ |
|
2212 |
+ , css: function (o, opt_v) { |
|
2213 |
+ var p, iter = o |
|
2214 |
+ // is this a request for just getting a style? |
|
2215 |
+ if (opt_v === undefined && typeof o == 'string') { |
|
2216 |
+ // repurpose 'v' |
|
2217 |
+ opt_v = this[0] |
|
2218 |
+ if (!opt_v) return null |
|
2219 |
+ if (opt_v === doc || opt_v === win) { |
|
2220 |
+ p = (opt_v === doc) ? bonzo.doc() : bonzo.viewport() |
|
2221 |
+ return o == 'width' ? p.width : o == 'height' ? p.height : '' |
|
2222 |
+ } |
|
2223 |
+ return (o = styleProperty(o)) ? getStyle(opt_v, o) : null |
|
2224 |
+ } |
|
2225 |
+ |
|
2226 |
+ if (typeof o == 'string') { |
|
2227 |
+ iter = {} |
|
2228 |
+ iter[o] = opt_v |
|
2229 |
+ } |
|
2230 |
+ |
|
2231 |
+ if (ie && iter.opacity) { |
|
2232 |
+ // oh this 'ol gamut |
|
2233 |
+ iter.filter = 'alpha(opacity=' + (iter.opacity * 100) + ')' |
|
2234 |
+ // give it layout |
|
2235 |
+ iter.zoom = o.zoom || 1; |
|
2236 |
+ delete iter.opacity; |
|
2237 |
+ } |
|
2238 |
+ |
|
2239 |
+ function fn(el, p, v) { |
|
2240 |
+ for (var k in iter) { |
|
2241 |
+ if (iter.hasOwnProperty(k)) { |
|
2242 |
+ v = iter[k]; |
|
2243 |
+ // change "5" to "5px" - unless you're line-height, which is allowed |
|
2244 |
+ (p = styleProperty(k)) && digit.test(v) && !(p in unitless) && (v += px) |
|
2245 |
+ try { el.style[p] = setter(el, v) } catch(e) {} |
|
2246 |
+ } |
|
2247 |
+ } |
|
2248 |
+ } |
|
2249 |
+ return this.each(fn) |
|
2250 |
+ } |
|
2251 |
+ |
|
2252 |
+ |
|
2253 |
+ /** |
|
2254 |
+ * @param {number=} opt_x |
|
2255 |
+ * @param {number=} opt_y |
|
2256 |
+ * @return {Bonzo|number} |
|
2257 |
+ */ |
|
2258 |
+ , offset: function (opt_x, opt_y) { |
|
2259 |
+ if (opt_x && typeof opt_x == 'object' && (typeof opt_x.top == 'number' || typeof opt_x.left == 'number')) { |
|
2260 |
+ return this.each(function (el) { |
|
2261 |
+ xy(el, opt_x.left, opt_x.top) |
|
2262 |
+ }) |
|
2263 |
+ } else if (typeof opt_x == 'number' || typeof opt_y == 'number') { |
|
2264 |
+ return this.each(function (el) { |
|
2265 |
+ xy(el, opt_x, opt_y) |
|
2266 |
+ }) |
|
2267 |
+ } |
|
2268 |
+ if (!this[0]) return { |
|
2269 |
+ top: 0 |
|
2270 |
+ , left: 0 |
|
2271 |
+ , height: 0 |
|
2272 |
+ , width: 0 |
|
2273 |
+ } |
|
2274 |
+ var el = this[0] |
|
2275 |
+ , de = el.ownerDocument.documentElement |
|
2276 |
+ , bcr = el.getBoundingClientRect() |
|
2277 |
+ , scroll = getWindowScroll() |
|
2278 |
+ , width = el.offsetWidth |
|
2279 |
+ , height = el.offsetHeight |
|
2280 |
+ , top = bcr.top + scroll.y - Math.max(0, de && de.clientTop, doc.body.clientTop) |
|
2281 |
+ , left = bcr.left + scroll.x - Math.max(0, de && de.clientLeft, doc.body.clientLeft) |
|
2282 |
+ |
|
2283 |
+ return { |
|
2284 |
+ top: top |
|
2285 |
+ , left: left |
|
2286 |
+ , height: height |
|
2287 |
+ , width: width |
|
2288 |
+ } |
|
2289 |
+ } |
|
2290 |
+ |
|
2291 |
+ |
|
2292 |
+ /** |
|
2293 |
+ * @return {number} |
|
2294 |
+ */ |
|
2295 |
+ , dim: function () { |
|
2296 |
+ if (!this.length) return { height: 0, width: 0 } |
|
2297 |
+ var el = this[0] |
|
2298 |
+ , de = el.nodeType == 9 && el.documentElement // document |
|
2299 |
+ , orig = !de && !!el.style && !el.offsetWidth && !el.offsetHeight ? |
|
2300 |
+ // el isn't visible, can't be measured properly, so fix that |
|
2301 |
+ function (t) { |
|
2302 |
+ var s = { |
|
2303 |
+ position: el.style.position || '' |
|
2304 |
+ , visibility: el.style.visibility || '' |
|
2305 |
+ , display: el.style.display || '' |
|
2306 |
+ } |
|
2307 |
+ t.first().css({ |
|
2308 |
+ position: 'absolute' |
|
2309 |
+ , visibility: 'hidden' |
|
2310 |
+ , display: 'block' |
|
2311 |
+ }) |
|
2312 |
+ return s |
|
2313 |
+ }(this) : null |
|
2314 |
+ , width = de |
|
2315 |
+ ? Math.max(el.body.scrollWidth, el.body.offsetWidth, de.scrollWidth, de.offsetWidth, de.clientWidth) |
|
2316 |
+ : el.offsetWidth |
|
2317 |
+ , height = de |
|
2318 |
+ ? Math.max(el.body.scrollHeight, el.body.offsetHeight, de.scrollWidth, de.offsetWidth, de.clientHeight) |
|
2319 |
+ : el.offsetHeight |
|
2320 |
+ |
|
2321 |
+ orig && this.first().css(orig) |
|
2322 |
+ return { |
|
2323 |
+ height: height |
|
2324 |
+ , width: width |
|
2325 |
+ } |
|
2326 |
+ } |
|
2327 |
+ |
|
2328 |
+ // attributes are hard. go shopping |
|
2329 |
+ |
|
2330 |
+ /** |
|
2331 |
+ * @param {string} k an attribute to get or set |
|
2332 |
+ * @param {string=} opt_v the value to set |
|
2333 |
+ * @return {Bonzo|string} |
|
2334 |
+ */ |
|
2335 |
+ , attr: function (k, opt_v) { |
|
2336 |
+ var el = this[0] |
|
2337 |
+ if (typeof k != 'string' && !(k instanceof String)) { |
|
2338 |
+ for (var n in k) { |
|
2339 |
+ k.hasOwnProperty(n) && this.attr(n, k[n]) |
|
2340 |
+ } |
|
2341 |
+ return this |
|
2342 |
+ } |
|
2343 |
+ return typeof opt_v == 'undefined' ? |
|
2344 |
+ !el ? null : specialAttributes.test(k) ? |
|
2345 |
+ stateAttributes.test(k) && typeof el[k] == 'string' ? |
|
2346 |
+ true : el[k] : (k == 'href' || k =='src') && features.hrefExtended ? |
|
2347 |
+ el[getAttribute](k, 2) : el[getAttribute](k) : |
|
2348 |
+ this.each(function (el) { |
|
2349 |
+ specialAttributes.test(k) ? (el[k] = setter(el, opt_v)) : el[setAttribute](k, setter(el, opt_v)) |
|
2350 |
+ }) |
|
2351 |
+ } |
|
2352 |
+ |
|
2353 |
+ |
|
2354 |
+ /** |
|
2355 |
+ * @param {string} k |
|
2356 |
+ * @return {Bonzo} |
|
2357 |
+ */ |
|
2358 |
+ , removeAttr: function (k) { |
|
2359 |
+ return this.each(function (el) { |
|
2360 |
+ stateAttributes.test(k) ? (el[k] = false) : el.removeAttribute(k) |
|
2361 |
+ }) |
|
2362 |
+ } |
|
2363 |
+ |
|
2364 |
+ |
|
2365 |
+ /** |
|
2366 |
+ * @param {string=} opt_s |
|
2367 |
+ * @return {Bonzo|string} |
|
2368 |
+ */ |
|
2369 |
+ , val: function (s) { |
|
2370 |
+ return (typeof s == 'string') ? |
|
2371 |
+ this.attr('value', s) : |
|
2372 |
+ this.length ? this[0].value : null |
|
2373 |
+ } |
|
2374 |
+ |
|
2375 |
+ // use with care and knowledge. this data() method uses data attributes on the DOM nodes |
|
2376 |
+ // to do this differently costs a lot more code. c'est la vie |
|
2377 |
+ /** |
|
2378 |
+ * @param {string|Object=} opt_k the key for which to get or set data |
|
2379 |
+ * @param {Object=} opt_v |
|
2380 |
+ * @return {Bonzo|Object} |
|
2381 |
+ */ |
|
2382 |
+ , data: function (opt_k, opt_v) { |
|
2383 |
+ var el = this[0], o, m |
|
2384 |
+ if (typeof opt_v === 'undefined') { |
|
2385 |
+ if (!el) return null |
|
2386 |
+ o = data(el) |
|
2387 |
+ if (typeof opt_k === 'undefined') { |
|
2388 |
+ each(el.attributes, function (a) { |
|
2389 |
+ (m = ('' + a.name).match(dattr)) && (o[camelize(m[1])] = dataValue(a.value)) |
|
2390 |
+ }) |
|
2391 |
+ return o |
|
2392 |
+ } else { |
|
2393 |
+ if (typeof o[opt_k] === 'undefined') |
|
2394 |
+ o[opt_k] = dataValue(this.attr('data-' + decamelize(opt_k))) |
|
2395 |
+ return o[opt_k] |
|
2396 |
+ } |
|
2397 |
+ } else { |
|
2398 |
+ return this.each(function (el) { data(el)[opt_k] = opt_v }) |
|
2399 |
+ } |
|
2400 |
+ } |
|
2401 |
+ |
|
2402 |
+ // DOM detachment & related |
|
2403 |
+ |
|
2404 |
+ /** |
|
2405 |
+ * @return {Bonzo} |
|
2406 |
+ */ |
|
2407 |
+ , remove: function () { |
|
2408 |
+ this.deepEach(clearData) |
|
2409 |
+ return this.detach() |
|
2410 |
+ } |
|
2411 |
+ |
|
2412 |
+ |
|
2413 |
+ /** |
|
2414 |
+ * @return {Bonzo} |
|
2415 |
+ */ |
|
2416 |
+ , empty: function () { |
|
2417 |
+ return this.each(function (el) { |
|
2418 |
+ deepEach(el.childNodes, clearData) |
|
2419 |
+ |
|
2420 |
+ while (el.firstChild) { |
|
2421 |
+ el.removeChild(el.firstChild) |
|
2422 |
+ } |
|
2423 |
+ }) |
|
2424 |
+ } |
|
2425 |
+ |
|
2426 |
+ |
|
2427 |
+ /** |
|
2428 |
+ * @return {Bonzo} |
|
2429 |
+ */ |
|
2430 |
+ , detach: function () { |
|
2431 |
+ return this.each(function (el) { |
|
2432 |
+ el[parentNode] && el[parentNode].removeChild(el) |
|
2433 |
+ }) |
|
2434 |
+ } |
|
2435 |
+ |
|
2436 |
+ // who uses a mouse anyway? oh right. |
|
2437 |
+ |
|
2438 |
+ /** |
|
2439 |
+ * @param {number} y |
|
2440 |
+ */ |
|
2441 |
+ , scrollTop: function (y) { |
|
2442 |
+ return scroll.call(this, null, y, 'y') |
|
2443 |
+ } |
|
2444 |
+ |
|
2445 |
+ |
|
2446 |
+ /** |
|
2447 |
+ * @param {number} x |
|
2448 |
+ */ |
|
2449 |
+ , scrollLeft: function (x) { |
|
2450 |
+ return scroll.call(this, x, null, 'x') |
|
2451 |
+ } |
|
2452 |
+ |
|
2453 |
+ } |
|
2454 |
+ |
|
2455 |
+ |
|
2456 |
+ function cloneNode(host, el) { |
|
2457 |
+ var c = el.cloneNode(true) |
|
2458 |
+ , cloneElems |
|
2459 |
+ , elElems |
|
2460 |
+ |
|
2461 |
+ // check for existence of an event cloner |
|
2462 |
+ // preferably https://github.com/fat/bean |
|
2463 |
+ // otherwise Bonzo won't do this for you |
|
2464 |
+ if (host.$ && typeof host.cloneEvents == 'function') { |
|
2465 |
+ host.$(c).cloneEvents(el) |
|
2466 |
+ |
|
2467 |
+ // clone events from every child node |
|
2468 |
+ cloneElems = host.$(c).find('*') |
|
2469 |
+ elElems = host.$(el).find('*') |
|
2470 |
+ |
|
2471 |
+ for (var i = 0; i < elElems.length; i++) |
|
2472 |
+ host.$(cloneElems[i]).cloneEvents(elElems[i]) |
|
2473 |
+ } |
|
2474 |
+ return c |
|
2475 |
+ } |
|
2476 |
+ |
|
2477 |
+ function scroll(x, y, type) { |
|
2478 |
+ var el = this[0] |
|
2479 |
+ if (!el) return this |
|
2480 |
+ if (x == null && y == null) { |
|
2481 |
+ return (isBody(el) ? getWindowScroll() : { x: el.scrollLeft, y: el.scrollTop })[type] |
|
2482 |
+ } |
|
2483 |
+ if (isBody(el)) { |
|
2484 |
+ win.scrollTo(x, y) |
|
2485 |
+ } else { |
|
2486 |
+ x != null && (el.scrollLeft = x) |
|
2487 |
+ y != null && (el.scrollTop = y) |
|
2488 |
+ } |
|
2489 |
+ return this |
|
2490 |
+ } |
|
2491 |
+ |
|
2492 |
+ function isBody(element) { |
|
2493 |
+ return element === win || (/^(?:body|html)$/i).test(element.tagName) |
|
2494 |
+ } |
|
2495 |
+ |
|
2496 |
+ function getWindowScroll() { |
|
2497 |
+ return { x: win.pageXOffset || html.scrollLeft, y: win.pageYOffset || html.scrollTop } |
|
2498 |
+ } |
|
2499 |
+ |
|
2500 |
+ function createScriptFromHtml(html) { |
|
2501 |
+ var scriptEl = document.createElement('script') |
|
2502 |
+ , matches = html.match(simpleScriptTagRe) |
|
2503 |
+ scriptEl.src = matches[1] |
|
2504 |
+ return scriptEl |
|
2505 |
+ } |
|
2506 |
+ |
|
2507 |
+ /** |
|
2508 |
+ * @param {Array.<Element>|Element|Node|string} els |
|
2509 |
+ * @return {Bonzo} |
|
2510 |
+ */ |
|
2511 |
+ function bonzo(els) { |
|
2512 |
+ return new Bonzo(els) |
|
2513 |
+ } |
|
2514 |
+ |
|
2515 |
+ bonzo.setQueryEngine = function (q) { |
|
2516 |
+ query = q; |
|
2517 |
+ delete bonzo.setQueryEngine |
|
2518 |
+ } |
|
2519 |
+ |
|
2520 |
+ bonzo.aug = function (o, target) { |
|
2521 |
+ // for those standalone bonzo users. this love is for you. |
|
2522 |
+ for (var k in o) { |
|
2523 |
+ o.hasOwnProperty(k) && ((target || Bonzo.prototype)[k] = o[k]) |
|
2524 |
+ } |
|
2525 |
+ } |
|
2526 |
+ |
|
2527 |
+ bonzo.create = function (node) { |
|
2528 |
+ // hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh |
|
2529 |
+ return typeof node == 'string' && node !== '' ? |
|
2530 |
+ function () { |
|
2531 |
+ if (simpleScriptTagRe.test(node)) return [createScriptFromHtml(node)] |
|
2532 |
+ var tag = node.match(/^\s*<([^\s>]+)/) |
|
2533 |
+ , el = doc.createElement('div') |
|
2534 |
+ , els = [] |
|
2535 |
+ , p = tag ? tagMap[tag[1].toLowerCase()] : null |
|
2536 |
+ , dep = p ? p[2] + 1 : 1 |
|
2537 |
+ , ns = p && p[3] |
|
2538 |
+ , pn = parentNode |
|
2539 |
+ , tb = features.autoTbody && p && p[0] == '<table>' && !(/<tbody/i).test(node) |
|
2540 |
+ |
|
2541 |
+ el.innerHTML = p ? (p[0] + node + p[1]) : node |
|
2542 |
+ while (dep--) el = el.firstChild |
|
2543 |
+ // for IE NoScope, we may insert cruft at the begining just to get it to work |
|
2544 |
+ if (ns && el && el.nodeType !== 1) el = el.nextSibling |
|
2545 |
+ do { |
|
2546 |
+ // tbody special case for IE<8, creates tbody on any empty table |
|
2547 |
+ // we don't want it if we're just after a <thead>, <caption>, etc. |
|
2548 |
+ if ((!tag || el.nodeType == 1) && (!tb || el.tagName.toLowerCase() != 'tbody')) { |
|
2549 |
+ els.push(el) |
|
2550 |
+ } |
|
2551 |
+ } while (el = el.nextSibling) |
|
2552 |
+ // IE < 9 gives us a parentNode which messes up insert() check for cloning |
|
2553 |
+ // `dep` > 1 can also cause problems with the insert() check (must do this last) |
|
2554 |
+ each(els, function(el) { el[pn] && el[pn].removeChild(el) }) |
|
2555 |
+ return els |
|
2556 |
+ }() : isNode(node) ? [node.cloneNode(true)] : [] |
|
2557 |
+ } |
|
2558 |
+ |
|
2559 |
+ bonzo.doc = function () { |
|
2560 |
+ var vp = bonzo.viewport() |
|
2561 |
+ return { |
|
2562 |
+ width: Math.max(doc.body.scrollWidth, html.scrollWidth, vp.width) |
|
2563 |
+ , height: Math.max(doc.body.scrollHeight, html.scrollHeight, vp.height) |
|
2564 |
+ } |
|
2565 |
+ } |
|
2566 |
+ |
|
2567 |
+ bonzo.firstChild = function (el) { |
|
2568 |
+ for (var c = el.childNodes, i = 0, j = (c && c.length) || 0, e; i < j; i++) { |
|
2569 |
+ if (c[i].nodeType === 1) e = c[j = i] |
|
2570 |
+ } |
|
2571 |
+ return e |
|
2572 |
+ } |
|
2573 |
+ |
|
2574 |
+ bonzo.viewport = function () { |
|
2575 |
+ return { |
|
2576 |
+ width: ie ? html.clientWidth : self.innerWidth |
|
2577 |
+ , height: ie ? html.clientHeight : self.innerHeight |
|
2578 |
+ } |
|
2579 |
+ } |
|
2580 |
+ |
|
2581 |
+ bonzo.isAncestor = 'compareDocumentPosition' in html ? |
|
2582 |
+ function (container, element) { |
|
2583 |
+ return (container.compareDocumentPosition(element) & 16) == 16 |
|
2584 |
+ } : 'contains' in html ? |
|
2585 |
+ function (container, element) { |
|
2586 |
+ return container !== element && container.contains(element); |
|
2587 |
+ } : |
|
2588 |
+ function (container, element) { |
|
2589 |
+ while (element = element[parentNode]) { |
|
2590 |
+ if (element === container) { |
|
2591 |
+ return true |
|
2592 |
+ } |
|
2593 |
+ } |
|
2594 |
+ return false |
|
2595 |
+ } |
|
2596 |
+ |
|
2597 |
+ return bonzo |
|
2598 |
+ }); // the only line we care about using a semi-colon. placed here for concatenation tools |
|
2599 |
+ |
|
2600 |
+ |
|
2601 |
+ provide("bonzo", module.exports); |
|
2602 |
+ |
|
2603 |
+ (function ($) { |
|
2604 |
+ |
|
2605 |
+ var b = require('bonzo') |
|
2606 |
+ b.setQueryEngine($) |
|
2607 |
+ $.ender(b) |
|
2608 |
+ $.ender(b(), true) |
|
2609 |
+ $.ender({ |
|
2610 |
+ create: function (node) { |
|
2611 |
+ return $(b.create(node)) |
|
2612 |
+ } |
|
2613 |
+ }) |
|
2614 |
+ |
|
2615 |
+ $.id = function (id) { |
|
2616 |
+ return $([document.getElementById(id)]) |
|
2617 |
+ } |
|
2618 |
+ |
|
2619 |
+ function indexOf(ar, val) { |
|
2620 |
+ for (var i = 0; i < ar.length; i++) if (ar[i] === val) return i |
|
2621 |
+ return -1 |
|
2622 |
+ } |
|
2623 |
+ |
|
2624 |
+ function uniq(ar) { |
|
2625 |
+ var r = [], i = 0, j = 0, k, item, inIt |
|
2626 |
+ for (; item = ar[i]; ++i) { |
|
2627 |
+ inIt = false |
|
2628 |
+ for (k = 0; k < r.length; ++k) { |
|
2629 |
+ if (r[k] === item) { |
|
2630 |
+ inIt = true; break |
|
2631 |
+ } |
|
2632 |
+ } |
|
2633 |
+ if (!inIt) r[j++] = item |
|
2634 |
+ } |
|
2635 |
+ return r |
|
2636 |
+ } |
|
2637 |
+ |
|
2638 |
+ $.ender({ |
|
2639 |
+ parents: function (selector, closest) { |
|
2640 |
+ if (!this.length) return this |
|
2641 |
+ if (!selector) selector = '*' |
|
2642 |
+ var collection = $(selector), j, k, p, r = [] |
|
2643 |
+ for (j = 0, k = this.length; j < k; j++) { |
|
2644 |
+ p = this[j] |
|
2645 |
+ while (p = p.parentNode) { |
|
2646 |
+ if (~indexOf(collection, p)) { |
|
2647 |
+ r.push(p) |
|
2648 |
+ if (closest) break; |
|
2649 |
+ } |
|
2650 |
+ } |
|
2651 |
+ } |
|
2652 |
+ return $(uniq(r)) |
|
2653 |
+ } |
|
2654 |
+ |
|
2655 |
+ , parent: function() { |
|
2656 |
+ return $(uniq(b(this).parent())) |
|
2657 |
+ } |
|
2658 |
+ |
|
2659 |
+ , closest: function (selector) { |
|
2660 |
+ return this.parents(selector, true) |
|
2661 |
+ } |
|
2662 |
+ |
|
2663 |
+ , first: function () { |
|
2664 |
+ return $(this.length ? this[0] : this) |
|
2665 |
+ } |
|
2666 |
+ |
|
2667 |
+ , last: function () { |
|
2668 |
+ return $(this.length ? this[this.length - 1] : []) |
|
2669 |
+ } |
|
2670 |
+ |
|
2671 |
+ , next: function () { |
|
2672 |
+ return $(b(this).next()) |
|
2673 |
+ } |
|
2674 |
+ |
|
2675 |
+ , previous: function () { |
|
2676 |
+ return $(b(this).previous()) |
|
2677 |
+ } |
|
2678 |
+ |
|
2679 |
+ , appendTo: function (t) { |
|
2680 |
+ return b(this.selector).appendTo(t, this) |
|
2681 |
+ } |
|
2682 |
+ |
|
2683 |
+ , prependTo: function (t) { |
|
2684 |
+ return b(this.selector).prependTo(t, this) |
|
2685 |
+ } |
|
2686 |
+ |
|
2687 |
+ , insertAfter: function (t) { |
|
2688 |
+ return b(this.selector).insertAfter(t, this) |
|
2689 |
+ } |
|
2690 |
+ |
|
2691 |
+ , insertBefore: function (t) { |
|
2692 |
+ return b(this.selector).insertBefore(t, this) |
|
2693 |
+ } |
|
2694 |
+ |
|
2695 |
+ , siblings: function () { |
|
2696 |
+ var i, l, p, r = [] |
|
2697 |
+ for (i = 0, l = this.length; i < l; i++) { |
|
2698 |
+ p = this[i] |
|
2699 |
+ while (p = p.previousSibling) p.nodeType == 1 && r.push(p) |
|
2700 |
+ p = this[i] |
|
2701 |
+ while (p = p.nextSibling) p.nodeType == 1 && r.push(p) |
|
2702 |
+ } |
|
2703 |
+ return $(r) |
|
2704 |
+ } |
|
2705 |
+ |
|
2706 |
+ , children: function () { |
|
2707 |
+ var i, l, el, r = [] |
|
2708 |
+ for (i = 0, l = this.length; i < l; i++) { |
|
2709 |
+ if (!(el = b.firstChild(this[i]))) continue; |
|
2710 |
+ r.push(el) |
|
2711 |
+ while (el = el.nextSibling) el.nodeType == 1 && r.push(el) |
|
2712 |
+ } |
|
2713 |
+ return $(uniq(r)) |
|
2714 |
+ } |
|
2715 |
+ |
|
2716 |
+ , height: function (v) { |
|
2717 |
+ return dimension.call(this, 'height', v) |
|
2718 |
+ } |
|
2719 |
+ |
|
2720 |
+ , width: function (v) { |
|
2721 |
+ return dimension.call(this, 'width', v) |
|
2722 |
+ } |
|
2723 |
+ }, true) |
|
2724 |
+ |
|
2725 |
+ /** |
|
2726 |
+ * @param {string} type either width or height |
|
2727 |
+ * @param {number=} opt_v becomes a setter instead of a getter |
|
2728 |
+ * @return {number} |
|
2729 |
+ */ |
|
2730 |
+ function dimension(type, opt_v) { |
|
2731 |
+ return typeof opt_v == 'undefined' |
|
2732 |
+ ? b(this).dim()[type] |
|
2733 |
+ : this.css(type, opt_v) |
|
2734 |
+ } |
|
2735 |
+ }(ender)); |
|
2736 |
+ |
|
2737 |
+}()); |
|
2738 |
+ |
|
2739 |
+(function () { |
|
2740 |
+ |
|
2741 |
+ var module = { exports: {} }, exports = module.exports; |
|
2742 |
+ |
|
2743 |
+ /*! |
|
2744 |
+ * domready (c) Dustin Diaz 2012 - License MIT |
|
2745 |
+ */ |
|
2746 |
+ !function (name, definition) { |
|
2747 |
+ if (typeof module != 'undefined') module.exports = definition() |
|
2748 |
+ else if (typeof define == 'function' && typeof define.amd == 'object') define(definition) |
|
2749 |
+ else this[name] = definition() |
|
2750 |
+ }('domready', function (ready) { |
|
2751 |
+ |
|
2752 |
+ var fns = [], fn, f = false |
|
2753 |
+ , doc = document |
|
2754 |
+ , testEl = doc.documentElement |
|
2755 |
+ , hack = testEl.doScroll |
|
2756 |
+ , domContentLoaded = 'DOMContentLoaded' |
|
2757 |
+ , addEventListener = 'addEventListener' |
|
2758 |
+ , onreadystatechange = 'onreadystatechange' |
|
2759 |
+ , readyState = 'readyState' |
|
2760 |
+ , loaded = /^loade|c/.test(doc[readyState]) |
|
2761 |
+ |
|
2762 |
+ function flush(f) { |
|
2763 |
+ loaded = 1 |
|
2764 |
+ while (f = fns.shift()) f() |
|
2765 |
+ } |
|
2766 |
+ |
|
2767 |
+ doc[addEventListener] && doc[addEventListener](domContentLoaded, fn = function () { |
|
2768 |
+ doc.removeEventListener(domContentLoaded, fn, f) |
|
2769 |
+ flush() |
|
2770 |
+ }, f) |
|
2771 |
+ |
|
2772 |
+ |
|
2773 |
+ hack && doc.attachEvent(onreadystatechange, fn = function () { |
|
2774 |
+ if (/^c/.test(doc[readyState])) { |
|
2775 |
+ doc.detachEvent(onreadystatechange, fn) |
|
2776 |
+ flush() |
|
2777 |
+ } |
|
2778 |
+ }) |
|
2779 |
+ |
|
2780 |
+ return (ready = hack ? |
|
2781 |
+ function (fn) { |
|
2782 |
+ self != top ? |
|
2783 |
+ loaded ? fn() : fns.push(fn) : |
|
2784 |
+ function () { |
|
2785 |
+ try { |
|
2786 |
+ testEl.doScroll('left') |
|
2787 |
+ } catch (e) { |
|
2788 |
+ return setTimeout(function() { ready(fn) }, 50) |
|
2789 |
+ } |
|
2790 |
+ fn() |
|
2791 |
+ }() |
|
2792 |
+ } : |
|
2793 |
+ function (fn) { |
|
2794 |
+ loaded ? fn() : fns.push(fn) |
|
2795 |
+ }) |
|
2796 |
+ }) |
|
2797 |
+ |
|
2798 |
+ provide("domready", module.exports); |
|
2799 |
+ |
|
2800 |
+ !function ($) { |
|
2801 |
+ var ready = require('domready') |
|
2802 |
+ $.ender({domReady: ready}) |
|
2803 |
+ $.ender({ |
|
2804 |
+ ready: function (f) { |
|
2805 |
+ ready(f) |
|
2806 |
+ return this |
|
2807 |
+ } |
|
2808 |
+ }, true) |
|
2809 |
+ }(ender); |
|
2810 |
+ |
|
2811 |
+}()); |
|
2812 |
+ |
|
2813 |
+(function () { |
|
2814 |
+ |
|
2815 |
+ var module = { exports: {} }, exports = module.exports; |
|
2816 |
+ |
|
2817 |
+ /*! |
|
2818 |
+ * @preserve Qwery - A Blazing Fast query selector engine |
|
2819 |
+ * https://github.com/ded/qwery |
|
2820 |
+ * copyright Dustin Diaz 2012 |
|
2821 |
+ * MIT License |
|
2822 |
+ */ |
|
2823 |
+ |
|
2824 |
+ (function (name, context, definition) { |
|
2825 |
+ if (typeof module != 'undefined' && module.exports) module.exports = definition() |
|
2826 |
+ else if (typeof context['define'] == 'function' && context['define']['amd']) define(definition) |
|
2827 |
+ else context[name] = definition() |
|
2828 |
+ })('qwery', this, function () { |
|
2829 |
+ var doc = document |
|
2830 |
+ , html = doc.documentElement |
|
2831 |
+ , byClass = 'getElementsByClassName' |
|
2832 |
+ , byTag = 'getElementsByTagName' |
|
2833 |
+ , qSA = 'querySelectorAll' |
|
2834 |
+ , useNativeQSA = 'useNativeQSA' |
|
2835 |
+ , tagName = 'tagName' |
|
2836 |
+ , nodeType = 'nodeType' |
|
2837 |
+ , select // main select() method, assign later |
|
2838 |
+ |
|
2839 |
+ , id = /#([\w\-]+)/ |
|
2840 |
+ , clas = /\.[\w\-]+/g |
|
2841 |
+ , idOnly = /^#([\w\-]+)$/ |
|
2842 |
+ , classOnly = /^\.([\w\-]+)$/ |
|
2843 |
+ , tagOnly = /^([\w\-]+)$/ |
|
2844 |
+ , tagAndOrClass = /^([\w]+)?\.([\w\-]+)$/ |
|
2845 |
+ , splittable = /(^|,)\s*[>~+]/ |
|
2846 |
+ , normalizr = /^\s+|\s*([,\s\+\~>]|$)\s*/g |
|
2847 |
+ , splitters = /[\s\>\+\~]/ |
|
2848 |
+ , splittersMore = /(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\]|[\s\w\+\-]*\))/ |
|
2849 |
+ , specialChars = /([.*+?\^=!:${}()|\[\]\/\\])/g |
|
2850 |
+ , simple = /^(\*|[a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/ |
|
2851 |
+ , attr = /\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/ |
|
2852 |
+ , pseudo = /:([\w\-]+)(\(['"]?([^()]+)['"]?\))?/ |
|
2853 |
+ , easy = new RegExp(idOnly.source + '|' + tagOnly.source + '|' + classOnly.source) |
|
2854 |
+ , dividers = new RegExp('(' + splitters.source + ')' + splittersMore.source, 'g') |
|
2855 |
+ , tokenizr = new RegExp(splitters.source + splittersMore.source) |
|
2856 |
+ , chunker = new RegExp(simple.source + '(' + attr.source + ')?' + '(' + pseudo.source + ')?') |
|
2857 |
+ |
|
2858 |
+ var walker = { |
|
2859 |
+ ' ': function (node) { |
|
2860 |
+ return node && node !== html && node.parentNode |
|
2861 |
+ } |
|
2862 |
+ , '>': function (node, contestant) { |
|
2863 |
+ return node && node.parentNode == contestant.parentNode && node.parentNode |
|
2864 |
+ } |
|
2865 |
+ , '~': function (node) { |
|
2866 |
+ return node && node.previousSibling |
|
2867 |
+ } |
|
2868 |
+ , '+': function (node, contestant, p1, p2) { |
|
2869 |
+ if (!node) return false |
|
2870 |
+ return (p1 = previous(node)) && (p2 = previous(contestant)) && p1 == p2 && p1 |
|
2871 |
+ } |
|
2872 |
+ } |
|
2873 |
+ |
|
2874 |
+ function cache() { |
|
2875 |
+ this.c = {} |
|
2876 |
+ } |
|
2877 |
+ cache.prototype = { |
|
2878 |
+ g: function (k) { |
|
2879 |
+ return this.c[k] || undefined |
|
2880 |
+ } |
|
2881 |
+ , s: function (k, v, r) { |
|
2882 |
+ v = r ? new RegExp(v) : v |
|
2883 |
+ return (this.c[k] = v) |
|
2884 |
+ } |
|
2885 |
+ } |
|
2886 |
+ |
|
2887 |
+ var classCache = new cache() |
|
2888 |
+ , cleanCache = new cache() |
|
2889 |
+ , attrCache = new cache() |
|
2890 |
+ , tokenCache = new cache() |
|
2891 |
+ |
|
2892 |
+ function classRegex(c) { |
|
2893 |
+ return classCache.g(c) || classCache.s(c, '(^|\\s+)' + c + '(\\s+|$)', 1) |
|
2894 |
+ } |
|
2895 |
+ |
|
2896 |
+ // not quite as fast as inline loops in older browsers so don't use liberally |
|
2897 |
+ function each(a, fn) { |
|
2898 |
+ var i = 0, l = a.length |
|
2899 |
+ for (; i < l; i++) fn(a[i]) |
|
2900 |
+ } |
|
2901 |
+ |
|
2902 |
+ function flatten(ar) { |
|
2903 |
+ for (var r = [], i = 0, l = ar.length; i < l; ++i) arrayLike(ar[i]) ? (r = r.concat(ar[i])) : (r[r.length] = ar[i]) |
|
2904 |
+ return r |
|
2905 |
+ } |
|
2906 |
+ |
|
2907 |
+ function arrayify(ar) { |
|
2908 |
+ var i = 0, l = ar.length, r = [] |
|
2909 |
+ for (; i < l; i++) r[i] = ar[i] |
|
2910 |
+ return r |
|
2911 |
+ } |
|
2912 |
+ |
|
2913 |
+ function previous(n) { |
|
2914 |
+ while (n = n.previousSibling) if (n[nodeType] == 1) break; |
|
2915 |
+ return n |
|
2916 |
+ } |
|
2917 |
+ |
|
2918 |
+ function q(query) { |
|
2919 |
+ return query.match(chunker) |
|
2920 |
+ } |
|
2921 |
+ |
|
2922 |
+ // called using `this` as element and arguments from regex group results. |
|
2923 |
+ // given => div.hello[title="world"]:foo('bar') |
|
2924 |
+ // div.hello[title="world"]:foo('bar'), div, .hello, [title="world"], title, =, world, :foo('bar'), foo, ('bar'), bar] |
|
2925 |
+ function interpret(whole, tag, idsAndClasses, wholeAttribute, attribute, qualifier, value, wholePseudo, pseudo, wholePseudoVal, pseudoVal) { |
|
2926 |
+ var i, m, k, o, classes |
|
2927 |
+ if (this[nodeType] !== 1) return false |
|
2928 |
+ if (tag && tag !== '*' && this[tagName] && this[tagName].toLowerCase() !== tag) return false |
|
2929 |
+ if (idsAndClasses && (m = idsAndClasses.match(id)) && m[1] !== this.id) return false |
|
2930 |
+ if (idsAndClasses && (classes = idsAndClasses.match(clas))) { |
|
2931 |
+ for (i = classes.length; i--;) if (!classRegex(classes[i].slice(1)).test(this.className)) return false |
|
2932 |
+ } |
|
2933 |
+ if (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) return false |
|
2934 |
+ if (wholeAttribute && !value) { // select is just for existance of attrib |
|
2935 |
+ o = this.attributes |
|
2936 |
+ for (k in o) { |
|
2937 |
+ if (Object.prototype.hasOwnProperty.call(o, k) && (o[k].name || k) == attribute) { |
|
2938 |
+ return this |
|
2939 |
+ } |
|
2940 |
+ } |
|
2941 |
+ } |
|
2942 |
+ if (wholeAttribute && !checkAttr(qualifier, getAttr(this, attribute) || '', value)) { |
|
2943 |
+ // select is for attrib equality |
|
2944 |
+ return false |
|
2945 |
+ } |
|
2946 |
+ return this |
|
2947 |
+ } |
|
2948 |
+ |
|
2949 |
+ function clean(s) { |
|
2950 |
+ return cleanCache.g(s) || cleanCache.s(s, s.replace(specialChars, '\\$1')) |
|
2951 |
+ } |
|
2952 |
+ |
|
2953 |
+ function checkAttr(qualify, actual, val) { |
|
2954 |
+ switch (qualify) { |
|
2955 |
+ case '=': |
|
2956 |
+ return actual == val |
|
2957 |
+ case '^=': |
|
2958 |
+ return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, '^' + clean(val), 1)) |
|
2959 |
+ case '$=': |
|
2960 |
+ return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, clean(val) + '$', 1)) |
|
2961 |
+ case '*=': |
|
2962 |
+ return actual.match(attrCache.g(val) || attrCache.s(val, clean(val), 1)) |
|
2963 |
+ case '~=': |
|
2964 |
+ return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, '(?:^|\\s+)' + clean(val) + '(?:\\s+|$)', 1)) |
|
2965 |
+ case '|=': |
|
2966 |
+ return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, '^' + clean(val) + '(-|$)', 1)) |
|
2967 |
+ } |
|
2968 |
+ return 0 |
|
2969 |
+ } |
|
2970 |
+ |
|
2971 |
+ // given a selector, first check for simple cases then collect all base candidate matches and filter |
|
2972 |
+ function _qwery(selector, _root) { |
|
2973 |
+ var r = [], ret = [], i, l, m, token, tag, els, intr, item, root = _root |
|
2974 |
+ , tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr)) |
|
2975 |
+ , dividedTokens = selector.match(dividers) |
|
2976 |
+ |
|
2977 |
+ if (!tokens.length) return r |
|
2978 |
+ |
|
2979 |
+ token = (tokens = tokens.slice(0)).pop() // copy cached tokens, take the last one |
|
2980 |
+ if (tokens.length && (m = tokens[tokens.length - 1].match(idOnly))) root = byId(_root, m[1]) |
|
2981 |
+ if (!root) return r |
|
2982 |
+ |
|
2983 |
+ intr = q(token) |
|
2984 |
+ // collect base candidates to filter |
|
2985 |
+ els = root !== _root && root[nodeType] !== 9 && dividedTokens && /^[+~]$/.test(dividedTokens[dividedTokens.length - 1]) ? |
|
2986 |
+ function (r) { |
|
2987 |
+ while (root = root.nextSibling) { |
|
2988 |
+ root[nodeType] == 1 && (intr[1] ? intr[1] == root[tagName].toLowerCase() : 1) && (r[r.length] = root) |
|
2989 |
+ } |
|
2990 |
+ return r |
|
2991 |
+ }([]) : |
|
2992 |
+ root[byTag](intr[1] || '*') |
|
2993 |
+ // filter elements according to the right-most part of the selector |
|
2994 |
+ for (i = 0, l = els.length; i < l; i++) { |
|
2995 |
+ if (item = interpret.apply(els[i], intr)) r[r.length] = item |
|
2996 |
+ } |
|
2997 |
+ if (!tokens.length) return r |
|
2998 |
+ |
|
2999 |
+ // filter further according to the rest of the selector (the left side) |
|
3000 |
+ each(r, function (e) { if (ancestorMatch(e, tokens, dividedTokens)) ret[ret.length] = e }) |
|
3001 |
+ return ret |
|
3002 |
+ } |
|
3003 |
+ |
|
3004 |
+ // compare element to a selector |
|
3005 |
+ function is(el, selector, root) { |
|
3006 |
+ if (isNode(selector)) return el == selector |
|
3007 |
+ if (arrayLike(selector)) return !!~flatten(selector).indexOf(el) // if selector is an array, is el a member? |
|
3008 |
+ |
|
3009 |
+ var selectors = selector.split(','), tokens, dividedTokens |
|
3010 |
+ while (selector = selectors.pop()) { |
|
3011 |
+ tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr)) |
|
3012 |
+ dividedTokens = selector.match(dividers) |
|
3013 |
+ tokens = tokens.slice(0) // copy array |
|
3014 |
+ if (interpret.apply(el, q(tokens.pop())) && (!tokens.length || ancestorMatch(el, tokens, dividedTokens, root))) { |
|
3015 |
+ return true |
|
3016 |
+ } |
|
3017 |
+ } |
|
3018 |
+ return false |
|
3019 |
+ } |
|
3020 |
+ |
|
3021 |
+ // given elements matching the right-most part of a selector, filter out any that don't match the rest |
|
3022 |
+ function ancestorMatch(el, tokens, dividedTokens, root) { |
|
3023 |
+ var cand |
|
3024 |
+ // recursively work backwards through the tokens and up the dom, covering all options |
|
3025 |
+ function crawl(e, i, p) { |
|
3026 |
+ while (p = walker[dividedTokens[i]](p, e)) { |
|
3027 |
+ if (isNode(p) && (interpret.apply(p, q(tokens[i])))) { |
|
3028 |
+ if (i) { |
|
3029 |
+ if (cand = crawl(p, i - 1, p)) return cand |
|
3030 |
+ } else return p |
|
3031 |
+ } |
|
3032 |
+ } |
|
3033 |
+ } |
|
3034 |
+ return (cand = crawl(el, tokens.length - 1, el)) && (!root || isAncestor(cand, root)) |
|
3035 |
+ } |
|
3036 |
+ |
|
3037 |
+ function isNode(el, t) { |
|
3038 |
+ return el && typeof el === 'object' && (t = el[nodeType]) && (t == 1 || t == 9) |
|
3039 |
+ } |
|
3040 |
+ |
|
3041 |
+ function uniq(ar) { |
|
3042 |
+ var a = [], i, j; |
|
3043 |
+ o: |
|
3044 |
+ for (i = 0; i < ar.length; ++i) { |
|
3045 |
+ for (j = 0; j < a.length; ++j) if (a[j] == ar[i]) continue o |
|
3046 |
+ a[a.length] = ar[i] |
|
3047 |
+ } |
|
3048 |
+ return a |
|
3049 |
+ } |
|
3050 |
+ |
|
3051 |
+ function arrayLike(o) { |
|
3052 |
+ return (typeof o === 'object' && isFinite(o.length)) |
|
3053 |
+ } |
|
3054 |
+ |
|
3055 |
+ function normalizeRoot(root) { |
|
3056 |
+ if (!root) return doc |
|
3057 |
+ if (typeof root == 'string') return qwery(root)[0] |
|
3058 |
+ if (!root[nodeType] && arrayLike(root)) return root[0] |
|
3059 |
+ return root |
|
3060 |
+ } |
|
3061 |
+ |
|
3062 |
+ function byId(root, id, el) { |
|
3063 |
+ // if doc, query on it, else query the parent doc or if a detached fragment rewrite the query and run on the fragment |
|
3064 |
+ return root[nodeType] === 9 ? root.getElementById(id) : |
|
3065 |
+ root.ownerDocument && |
|
3066 |
+ (((el = root.ownerDocument.getElementById(id)) && isAncestor(el, root) && el) || |
|
3067 |
+ (!isAncestor(root, root.ownerDocument) && select('[id="' + id + '"]', root)[0])) |
|
3068 |
+ } |
|
3069 |
+ |
|
3070 |
+ function qwery(selector, _root) { |
|
3071 |
+ var m, el, root = normalizeRoot(_root) |
|
3072 |
+ |
|
3073 |
+ // easy, fast cases that we can dispatch with simple DOM calls |
|
3074 |
+ if (!root || !selector) return [] |
|
3075 |
+ if (selector === window || isNode(selector)) { |
|
3076 |
+ return !_root || (selector !== window && isNode(root) && isAncestor(selector, root)) ? [selector] : [] |
|
3077 |
+ } |
|
3078 |
+ if (selector && arrayLike(selector)) return flatten(selector) |
|
3079 |
+ if (m = selector.match(easy)) { |
|
3080 |
+ if (m[1]) return (el = byId(root, m[1])) ? [el] : [] |
|
3081 |
+ if (m[2]) return arrayify(root[byTag](m[2])) |
|
3082 |
+ if (hasByClass && m[3]) return arrayify(root[byClass](m[3])) |
|
3083 |
+ } |
|
3084 |
+ |
|
3085 |
+ return select(selector, root) |
|
3086 |
+ } |
|
3087 |
+ |
|
3088 |
+ // where the root is not document and a relationship selector is first we have to |
|
3089 |
+ // do some awkward adjustments to get it to work, even with qSA |
|
3090 |
+ function collectSelector(root, collector) { |
|
3091 |
+ return function (s) { |
|
3092 |
+ var oid, nid |
|
3093 |
+ if (splittable.test(s)) { |
|
3094 |
+ if (root[nodeType] !== 9) { |
|
3095 |
+ // make sure the el has an id, rewrite the query, set root to doc and run it |
|
3096 |
+ if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty') |
|
3097 |
+ s = '[id="' + nid + '"]' + s // avoid byId and allow us to match context element |
|
3098 |
+ collector(root.parentNode || root, s, true) |
|
3099 |
+ oid || root.removeAttribute('id') |
|
3100 |
+ } |
|
3101 |
+ return; |
|
3102 |
+ } |
|
3103 |
+ s.length && collector(root, s, false) |
|
3104 |
+ } |
|
3105 |
+ } |
|
3106 |
+ |
|
3107 |
+ var isAncestor = 'compareDocumentPosition' in html ? |
|
3108 |
+ function (element, container) { |
|
3109 |
+ return (container.compareDocumentPosition(element) & 16) == 16 |
|
3110 |
+ } : 'contains' in html ? |
|
3111 |
+ function (element, container) { |
|
3112 |
+ container = container[nodeType] === 9 || container == window ? html : container |
|
3113 |
+ return container !== element && container.contains(element) |
|
3114 |
+ } : |
|
3115 |
+ function (element, container) { |
|
3116 |
+ while (element = element.parentNode) if (element === container) return 1 |
|
3117 |
+ return 0 |
|
3118 |
+ } |
|
3119 |
+ , getAttr = function () { |
|
3120 |
+ // detect buggy IE src/href getAttribute() call |
|
3121 |
+ var e = doc.createElement('p') |
|
3122 |
+ return ((e.innerHTML = '<a href="#x">x</a>') && e.firstChild.getAttribute('href') != '#x') ? |
|
3123 |
+ function (e, a) { |
|
3124 |
+ return a === 'class' ? e.className : (a === 'href' || a === 'src') ? |
|
3125 |
+ e.getAttribute(a, 2) : e.getAttribute(a) |
|
3126 |
+ } : |
|
3127 |
+ function (e, a) { return e.getAttribute(a) } |
|
3128 |
+ }() |
|
3129 |
+ , hasByClass = !!doc[byClass] |
|
3130 |
+ // has native qSA support |
|
3131 |
+ , hasQSA = doc.querySelector && doc[qSA] |
|
3132 |
+ // use native qSA |
|
3133 |
+ , selectQSA = function (selector, root) { |
|
3134 |
+ var result = [], ss, e |
|
3135 |
+ try { |
|
3136 |
+ if (root[nodeType] === 9 || !splittable.test(selector)) { |
|
3137 |
+ // most work is done right here, defer to qSA |
|
3138 |
+ return arrayify(root[qSA](selector)) |
|
3139 |
+ } |
|
3140 |
+ // special case where we need the services of `collectSelector()` |
|
3141 |
+ each(ss = selector.split(','), collectSelector(root, function (ctx, s) { |
|
3142 |
+ e = ctx[qSA](s) |
|
3143 |
+ if (e.length == 1) result[result.length] = e.item(0) |
|
3144 |
+ else if (e.length) result = result.concat(arrayify(e)) |
|
3145 |
+ })) |
|
3146 |
+ return ss.length > 1 && result.length > 1 ? uniq(result) : result |
|
3147 |
+ } catch (ex) { } |
|
3148 |
+ return selectNonNative(selector, root) |
|
3149 |
+ } |
|
3150 |
+ // no native selector support |
|
3151 |
+ , selectNonNative = function (selector, root) { |
|
3152 |
+ var result = [], items, m, i, l, r, ss |
|
3153 |
+ selector = selector.replace(normalizr, '$1') |
|
3154 |
+ if (m = selector.match(tagAndOrClass)) { |
|
3155 |
+ r = classRegex(m[2]) |
|
3156 |
+ items = root[byTag](m[1] || '*') |
|
3157 |
+ for (i = 0, l = items.length; i < l; i++) { |
|
3158 |
+ if (r.test(items[i].className)) result[result.length] = items[i] |
|
3159 |
+ } |
|
3160 |
+ return result |
|
3161 |
+ } |
|
3162 |
+ // more complex selector, get `_qwery()` to do the work for us |
|
3163 |
+ each(ss = selector.split(','), collectSelector(root, function (ctx, s, rewrite) { |
|
3164 |
+ r = _qwery(s, ctx) |
|
3165 |
+ for (i = 0, l = r.length; i < l; i++) { |
|
3166 |
+ if (ctx[nodeType] === 9 || rewrite || isAncestor(r[i], root)) result[result.length] = r[i] |
|
3167 |
+ } |
|
3168 |
+ })) |
|
3169 |
+ return ss.length > 1 && result.length > 1 ? uniq(result) : result |
|
3170 |
+ } |
|
3171 |
+ , configure = function (options) { |
|
3172 |
+ // configNativeQSA: use fully-internal selector or native qSA where present |
|
3173 |
+ if (typeof options[useNativeQSA] !== 'undefined') |
|
3174 |
+ select = !options[useNativeQSA] ? selectNonNative : hasQSA ? selectQSA : selectNonNative |
|
3175 |
+ } |
|
3176 |
+ |
|
3177 |
+ configure({ useNativeQSA: true }) |
|
3178 |
+ |
|
3179 |
+ qwery.configure = configure |
|
3180 |
+ qwery.uniq = uniq |
|
3181 |
+ qwery.is = is |
|
3182 |
+ qwery.pseudos = {} |
|
3183 |
+ |
|
3184 |
+ return qwery |
|
3185 |
+ }); |
|
3186 |
+ |
|
3187 |
+ |
|
3188 |
+ provide("qwery", module.exports); |
|
3189 |
+ |
|
3190 |
+ (function ($) { |
|
3191 |
+ var q = function () { |
|
3192 |
+ var r |
|
3193 |
+ try { |
|
3194 |
+ r = require('qwery') |
|
3195 |
+ } catch (ex) { |
|
3196 |
+ r = require('qwery-mobile') |
|
3197 |
+ } finally { |
|
3198 |
+ return r |
|
3199 |
+ } |
|
3200 |
+ }() |
|
3201 |
+ |
|
3202 |
+ $.pseudos = q.pseudos |
|
3203 |
+ |
|
3204 |
+ $._select = function (s, r) { |
|
3205 |
+ // detect if sibling module 'bonzo' is available at run-time |
|
3206 |
+ // rather than load-time since technically it's not a dependency and |
|
3207 |
+ // can be loaded in any order |
|
3208 |
+ // hence the lazy function re-definition |
|
3209 |
+ return ($._select = (function () { |
|
3210 |
+ var b |
|
3211 |
+ if (typeof $.create == 'function') return function (s, r) { |
|
3212 |
+ return /^\s*</.test(s) ? $.create(s, r) : q(s, r) |
|
3213 |
+ } |
|
3214 |
+ try { |
|
3215 |
+ b = require('bonzo') |
|
3216 |
+ return function (s, r) { |
|
3217 |
+ return /^\s*</.test(s) ? b.create(s, r) : q(s, r) |
|
3218 |
+ } |
|
3219 |
+ } catch (e) { } |
|
3220 |
+ return q |
|
3221 |
+ })())(s, r) |
|
3222 |
+ } |
|
3223 |
+ |
|
3224 |
+ $.ender({ |
|
3225 |
+ find: function (s) { |
|
3226 |
+ var r = [], i, l, j, k, els |
|
3227 |
+ for (i = 0, l = this.length; i < l; i++) { |
|
3228 |
+ els = q(s, this[i]) |
|
3229 |
+ for (j = 0, k = els.length; j < k; j++) r.push(els[j]) |
|
3230 |
+ } |
|
3231 |
+ return $(q.uniq(r)) |
|
3232 |
+ } |
|
3233 |
+ , and: function (s) { |
|
3234 |
+ var plus = $(s) |
|
3235 |
+ for (var i = this.length, j = 0, l = this.length + plus.length; i < l; i++, j++) { |
|
3236 |
+ this[i] = plus[j] |
|
3237 |
+ } |
|
3238 |
+ this.length += plus.length |
|
3239 |
+ return this |
|
3240 |
+ } |
|
3241 |
+ , is: function(s, r) { |
|
3242 |
+ var i, l |
|
3243 |
+ for (i = 0, l = this.length; i < l; i++) { |
|
3244 |
+ if (q.is(this[i], s, r)) { |
|
3245 |
+ return true |
|
3246 |
+ } |
|
3247 |
+ } |
|
3248 |
+ return false |
|
3249 |
+ } |
|
3250 |
+ }, true) |
|
3251 |
+ }(ender)); |
|
3252 |
+ |
|
3253 |
+ |
|
3254 |
+}()); |
|
3255 |
+ |
0 | 3256 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,85 @@ |
0 |
+// jXHR.js (JSON-P XHR) |
|
1 |
+// v0.1 (c) Kyle Simpson |
|
2 |
+// MIT License |
|
3 |
+ |
|
4 |
+(function(global){ |
|
5 |
+ var SETTIMEOUT = global.setTimeout, // for better compression |
|
6 |
+ doc = global.document, |
|
7 |
+ callback_counter = 0; |
|
8 |
+ |
|
9 |
+ global.jXHR = function() { |
|
10 |
+ var script_url, |
|
11 |
+ script_loaded, |
|
12 |
+ jsonp_callback, |
|
13 |
+ scriptElem, |
|
14 |
+ publicAPI = null; |
|
15 |
+ |
|
16 |
+ function removeScript() { try { scriptElem.parentNode.removeChild(scriptElem); } catch (err) { } } |
|
17 |
+ |
|
18 |
+ function reset() { |
|
19 |
+ script_loaded = false; |
|
20 |
+ script_url = ""; |
|
21 |
+ removeScript(); |
|
22 |
+ scriptElem = null; |
|
23 |
+ fireReadyStateChange(0); |
|
24 |
+ } |
|
25 |
+ |
|
26 |
+ function ThrowError(msg) { |
|
27 |
+ try { publicAPI.onerror.call(publicAPI,msg,script_url); } catch (err) { throw new Error(msg); } |
|
28 |
+ } |
|
29 |
+ |
|
30 |
+ function handleScriptLoad() { |
|
31 |
+ if ((this.readyState && this.readyState!=="complete" && this.readyState!=="loaded") || script_loaded) { return; } |
|
32 |
+ this.onload = this.onreadystatechange = null; // prevent memory leak |
|
33 |
+ script_loaded = true; |
|
34 |
+ if (publicAPI.readyState !== 4) ThrowError("Script failed to load ["+script_url+"]."); |
|
35 |
+ removeScript(); |
|
36 |
+ } |
|
37 |
+ |
|
38 |
+ function fireReadyStateChange(rs,args) { |
|
39 |
+ args = args || []; |
|
40 |
+ publicAPI.readyState = rs; |
|
41 |
+ if (typeof publicAPI.onreadystatechange === "function") publicAPI.onreadystatechange.apply(publicAPI,args); |
|
42 |
+ } |
|
43 |
+ |
|
44 |
+ publicAPI = { |
|
45 |
+ onerror:null, |
|
46 |
+ onreadystatechange:null, |
|
47 |
+ readyState:0, |
|
48 |
+ open:function(method,url){ |
|
49 |
+ reset(); |
|
50 |
+ internal_callback = "cb"+(callback_counter++); |
|
51 |
+ (function(icb){ |
|
52 |
+ global.jXHR[icb] = function() { |
|
53 |
+ try { fireReadyStateChange.call(publicAPI,4,arguments); } |
|
54 |
+ catch(err) { |
|
55 |
+ publicAPI.readyState = -1; |
|
56 |
+ ThrowError("Script failed to run ["+script_url+"]."); |
|
57 |
+ } |
|
58 |
+ global.jXHR[icb] = null; |
|
59 |
+ }; |
|
60 |
+ })(internal_callback); |
|
61 |
+ script_url = url.replace(/=\?/,"=jXHR."+internal_callback); |
|
62 |
+ fireReadyStateChange(1); |
|
63 |
+ }, |
|
64 |
+ send:function(){ |
|
65 |
+ SETTIMEOUT(function(){ |
|
66 |
+ scriptElem = doc.createElement("script"); |
|
67 |
+ scriptElem.setAttribute("type","text/javascript"); |
|
68 |
+ scriptElem.onload = scriptElem.onreadystatechange = function(){handleScriptLoad.call(scriptElem);}; |
|
69 |
+ scriptElem.setAttribute("src",script_url); |
|
70 |
+ doc.getElementsByTagName("head")[0].appendChild(scriptElem); |
|
71 |
+ },0); |
|
72 |
+ fireReadyStateChange(2); |
|
73 |
+ }, |
|
74 |
+ setRequestHeader:function(){}, // noop |
|
75 |
+ getResponseHeader:function(){return "";}, // basically noop |
|
76 |
+ getAllResponseHeaders:function(){return [];} // ditto |
|
77 |
+ }; |
|
78 |
+ |
|
79 |
+ reset(); |
|
80 |
+ |
|
81 |
+ return publicAPI; |
|
82 |
+ }; |
|
83 |
+})(window); |
|
84 |
+ |
0 | 85 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,298 @@ |
0 |
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> |
|
1 |
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> |
|
2 |
+*/ |
|
3 |
+ |
|
4 |
+var swfobject = function() { |
|
5 |
+ |
|
6 |
+ var UNDEF = "undefined", |
|
7 |
+ OBJECT = "object", |
|
8 |
+ SHOCKWAVE_FLASH = "Shockwave Flash", |
|
9 |
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", |
|
10 |
+ FLASH_MIME_TYPE = "application/x-shockwave-flash", |
|
11 |
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst", |
|
12 |
+ |
|
13 |
+ win = window, |
|
14 |
+ doc = document, |
|
15 |
+ nav = navigator, |
|
16 |
+ |
|
17 |
+ plugin = false, |
|
18 |
+ regObjArr = [], |
|
19 |
+ objIdArr = [], |
|
20 |
+ storedAltContent, |
|
21 |
+ storedAltContentId, |
|
22 |
+ storedCallbackFn, |
|
23 |
+ storedCallbackObj, |
|
24 |
+ autoHideShow = true, |
|
25 |
+ |
|
26 |
+ /* Centralized function for browser feature detection |
|
27 |
+ - User agent string detection is only used when no good alternative is possible |
|
28 |
+ - Is executed directly for optimal performance |
|
29 |
+ */ |
|
30 |
+ ua = function() { |
|
31 |
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, |
|
32 |
+ u = nav.userAgent.toLowerCase(), |
|
33 |
+ p = nav.platform.toLowerCase(), |
|
34 |
+ windows = p ? /win/.test(p) : /win/.test(u), |
|
35 |
+ mac = p ? /mac/.test(p) : /mac/.test(u), |
|
36 |
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit |
|
37 |
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html |
|
38 |
+ playerVersion = [0,0,0], |
|
39 |
+ d = null; |
|
40 |
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { |
|
41 |
+ d = nav.plugins[SHOCKWAVE_FLASH].description; |
|
42 |
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ |
|
43 |
+ plugin = true; |
|
44 |
+ ie = false; // cascaded feature detection for Internet Explorer |
|
45 |
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); |
|
46 |
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); |
|
47 |
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); |
|
48 |
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; |
|
49 |
+ } |
|
50 |
+ } |
|
51 |
+ else if (typeof win.ActiveXObject != UNDEF) { |
|
52 |
+ try { |
|
53 |
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); |
|
54 |
+ if (a) { // a will return null when ActiveX is disabled |
|
55 |
+ d = a.GetVariable("$version"); |
|
56 |
+ if (d) { |
|
57 |
+ ie = true; // cascaded feature detection for Internet Explorer |
|
58 |
+ d = d.split(" ")[1].split(","); |
|
59 |
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; |
|
60 |
+ } |
|
61 |
+ } |
|
62 |
+ } |
|
63 |
+ catch(e) {} |
|
64 |
+ } |
|
65 |
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; |
|
66 |
+ }() |
|
67 |
+ |
|
68 |
+ |
|
69 |
+ /* Main function |
|
70 |
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback) |
|
71 |
+ */ |
|
72 |
+ function main() { |
|
73 |
+ if (plugin) { testPlayerVersion(); } |
|
74 |
+ else { matchVersions(); } |
|
75 |
+ } |
|
76 |
+ |
|
77 |
+ /* Detect the Flash Player version for non-Internet Explorer browsers |
|
78 |
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: |
|
79 |
+ a. Both release and build numbers can be detected |
|
80 |
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe |
|
81 |
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports |
|
82 |
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available |
|
83 |
+ */ |
|
84 |
+ function testPlayerVersion() { |
|
85 |
+ var b = doc.getElementsByTagName("body")[0]; |
|
86 |
+ var o = createElement(OBJECT); |
|
87 |
+ o.setAttribute("type", FLASH_MIME_TYPE); |
|
88 |
+ var t = b.appendChild(o); |
|
89 |
+ if (t) { |
|
90 |
+ var counter = 0; |
|
91 |
+ (function(){ |
|
92 |
+ if (typeof t.GetVariable != UNDEF) { |
|
93 |
+ var d = t.GetVariable("$version"); |
|
94 |
+ if (d) { |
|
95 |
+ d = d.split(" ")[1].split(","); |
|
96 |
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; |
|
97 |
+ } |
|
98 |
+ } |
|
99 |
+ else if (counter < 10) { |
|
100 |
+ counter++; |
|
101 |
+ setTimeout(arguments.callee, 10); |
|
102 |
+ return; |
|
103 |
+ } |
|
104 |
+ b.removeChild(o); |
|
105 |
+ t = null; |
|
106 |
+ matchVersions(); |
|
107 |
+ })(); |
|
108 |
+ } |
|
109 |
+ else { |
|
110 |
+ matchVersions(); |
|
111 |
+ } |
|
112 |
+ } |
|
113 |
+ |
|
114 |
+ |
|
115 |
+ /* Cross-browser dynamic SWF creation |
|
116 |
+ */ |
|
117 |
+ function createSWF(attObj, parObj, id) { |
|
118 |
+ var r, el = getElementById(id); |
|
119 |
+ if (ua.wk && ua.wk < 312) { return r; } |
|
120 |
+ if (el) { |
|
121 |
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content |
|
122 |
+ attObj.id = id; |
|
123 |
+ } |
|
124 |
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML |
|
125 |
+ var att = ""; |
|
126 |
+ for (var i in attObj) { |
|
127 |
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries |
|
128 |
+ if (i.toLowerCase() == "data") { |
|
129 |
+ parObj.movie = attObj[i]; |
|
130 |
+ } |
|
131 |
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
|
132 |
+ att += ' class="' + attObj[i] + '"'; |
|
133 |
+ } |
|
134 |
+ else if (i.toLowerCase() != "classid") { |
|
135 |
+ att += ' ' + i + '="' + attObj[i] + '"'; |
|
136 |
+ } |
|
137 |
+ } |
|
138 |
+ } |
|
139 |
+ var par = ""; |
|
140 |
+ for (var j in parObj) { |
|
141 |
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries |
|
142 |
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />'; |
|
143 |
+ } |
|
144 |
+ } |
|
145 |
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; |
|
146 |
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) |
|
147 |
+ r = getElementById(attObj.id); |
|
148 |
+ } |
|
149 |
+ else { // well-behaving browsers |
|
150 |
+ var o = createElement(OBJECT); |
|
151 |
+ o.setAttribute("type", FLASH_MIME_TYPE); |
|
152 |
+ for (var m in attObj) { |
|
153 |
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries |
|
154 |
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
|
155 |
+ o.setAttribute("class", attObj[m]); |
|
156 |
+ } |
|
157 |
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute |
|
158 |
+ o.setAttribute(m, attObj[m]); |
|
159 |
+ } |
|
160 |
+ } |
|
161 |
+ } |
|
162 |
+ for (var n in parObj) { |
|
163 |
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element |
|
164 |
+ createObjParam(o, n, parObj[n]); |
|
165 |
+ } |
|
166 |
+ } |
|
167 |
+ el.parentNode.replaceChild(o, el); |
|
168 |
+ r = o; |
|
169 |
+ } |
|
170 |
+ } |
|
171 |
+ return r; |
|
172 |
+ } |
|
173 |
+ |
|
174 |
+ function createObjParam(el, pName, pValue) { |
|
175 |
+ var p = createElement("param"); |
|
176 |
+ p.setAttribute("name", pName); |
|
177 |
+ p.setAttribute("value", pValue); |
|
178 |
+ el.appendChild(p); |
|
179 |
+ } |
|
180 |
+ |
|
181 |
+ /* Cross-browser SWF removal |
|
182 |
+ - Especially needed to safely and completely remove a SWF in Internet Explorer |
|
183 |
+ */ |
|
184 |
+ /* Functions to optimize JavaScript compression |
|
185 |
+ */ |
|
186 |
+ function getElementById(id) { |
|
187 |
+ var el = null; |
|
188 |
+ try { |
|
189 |
+ el = doc.getElementById(id); |
|
190 |
+ } |
|
191 |
+ catch (e) {} |
|
192 |
+ return el; |
|
193 |
+ } |
|
194 |
+ |
|
195 |
+ function createElement(el) { |
|
196 |
+ return doc.createElement(el); |
|
197 |
+ } |
|
198 |
+ |
|
199 |
+ /* Flash Player and SWF content version matching |
|
200 |
+ */ |
|
201 |
+ function hasPlayerVersion(rv) { |
|
202 |
+ var pv = ua.pv, v = rv.split("."); |
|
203 |
+ v[0] = parseInt(v[0], 10); |
|
204 |
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" |
|
205 |
+ v[2] = parseInt(v[2], 10) || 0; |
|
206 |
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; |
|
207 |
+ } |
|
208 |
+ |
|
209 |
+ |
|
210 |
+ /* Filter to avoid XSS attacks |
|
211 |
+ */ |
|
212 |
+ function urlEncodeIfNecessary(s) { |
|
213 |
+ var regex = /[\\\"<>\.;]/; |
|
214 |
+ var hasBadChars = regex.exec(s) != null; |
|
215 |
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; |
|
216 |
+ } |
|
217 |
+ |
|
218 |
+ return { |
|
219 |
+ /* Public API |
|
220 |
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation |
|
221 |
+ */ |
|
222 |
+ |
|
223 |
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, flashvarsObj, parObj, attObj, callbackFn) { |
|
224 |
+ var callbackObj = {success:false, id:replaceElemIdStr}; |
|
225 |
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { |
|
226 |
+ widthStr += ""; // auto-convert to string |
|
227 |
+ heightStr += ""; |
|
228 |
+ var att = {}; |
|
229 |
+ if (attObj && typeof attObj === OBJECT) { |
|
230 |
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs |
|
231 |
+ att[i] = attObj[i]; |
|
232 |
+ } |
|
233 |
+ } |
|
234 |
+ att.data = swfUrlStr; |
|
235 |
+ att.width = widthStr; |
|
236 |
+ att.height = heightStr; |
|
237 |
+ var par = {}; |
|
238 |
+ if (parObj && typeof parObj === OBJECT) { |
|
239 |
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs |
|
240 |
+ par[j] = parObj[j]; |
|
241 |
+ } |
|
242 |
+ } |
|
243 |
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) { |
|
244 |
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs |
|
245 |
+ if (typeof par.flashvars != UNDEF) { |
|
246 |
+ par.flashvars += "&" + k + "=" + flashvarsObj[k]; |
|
247 |
+ } |
|
248 |
+ else { |
|
249 |
+ par.flashvars = k + "=" + flashvarsObj[k]; |
|
250 |
+ } |
|
251 |
+ } |
|
252 |
+ } |
|
253 |
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF |
|
254 |
+ var obj = createSWF(att, par, replaceElemIdStr); |
|
255 |
+ callbackObj.success = true; |
|
256 |
+ callbackObj.ref = obj; |
|
257 |
+ } |
|
258 |
+ if (callbackFn) { callbackFn(callbackObj); } |
|
259 |
+ } |
|
260 |
+ else if (callbackFn) { callbackFn(callbackObj); } |
|
261 |
+ }, |
|
262 |
+ |
|
263 |
+ ua: ua, |
|
264 |
+ |
|
265 |
+ getFlashPlayerVersion: function() { |
|
266 |
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; |
|
267 |
+ }, |
|
268 |
+ |
|
269 |
+ hasFlashPlayerVersion: hasPlayerVersion, |
|
270 |
+ |
|
271 |
+ createSWF: function(attObj, parObj, replaceElemIdStr) { |
|
272 |
+ if (ua.w3) { |
|
273 |
+ return createSWF(attObj, parObj, replaceElemIdStr); |
|
274 |
+ } |
|
275 |
+ else { |
|
276 |
+ return undefined; |
|
277 |
+ } |
|
278 |
+ }, |
|
279 |
+ |
|
280 |
+ getQueryParamValue: function(param) { |
|
281 |
+ var q = doc.location.search || doc.location.hash; |
|
282 |
+ if (q) { |
|
283 |
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark |
|
284 |
+ if (param == null) { |
|
285 |
+ return urlEncodeIfNecessary(q); |
|
286 |
+ } |
|
287 |
+ var pairs = q.split("&"); |
|
288 |
+ for (var i = 0; i < pairs.length; i++) { |
|
289 |
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { |
|
290 |
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); |
|
291 |
+ } |
|
292 |
+ } |
|
293 |
+ } |
|
294 |
+ return ""; |
|
295 |
+ } |
|
296 |
+ }; |
|
297 |
+}(); |
0 | 298 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,5 @@ |
0 |
+/* Modernizr 2.0.4 (Custom Build) | MIT & BSD |
|
1 |
+ * Contains: video | iepp | respond | mq | cssclasses | teststyles | testprop | testallprops | prefixes | domprefixes | load |
|
2 |
+ * Build URL: http://j.mp/m1H1Y1 |
|
3 |
+ */ |
|
4 |
+;window.Modernizr=function(a,b,c){function D(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+o.join(c+" ")+c).split(" ");return C(d,b)}function C(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function B(a,b){return!!~(""+a).indexOf(b)}function A(a,b){return typeof a===b}function z(a,b){return y(n.join(a+";")+(b||""))}function y(a){k.cssText=a}var d="2.0.4",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o="Webkit Moz O ms Khtml".split(" "),p={},q={},r={},s=[],t=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["­","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},u=function(b){if(a.matchMedia)return matchMedia(b).matches;var c;t("@media "+b+" { #"+i+" { position: absolute; } }",function(b){c=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).position=="absolute"});return c},v,w={}.hasOwnProperty,x;!A(w,c)&&!A(w.call,c)?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],c)},p.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType){c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(e){}return c};for(var E in p)x(p,E)&&(v=E.toLowerCase(),e[v]=p[E](),s.push((e[v]?"":"no-")+v));y(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e._prefixes=n,e._domPrefixes=o,e.mq=u,e.testProp=function(a){return C([a])},e.testAllProps=D,e.testStyles=t,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+s.join(" "):"");return e}(this,this.document),function(a,b){function u(){r(!0)}a.respond={},respond.update=function(){},respond.mediaQueriesSupported=b;if(!b){var c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=j.getElementsByTagName("link"),l=[],m=function(){var b=k,c=b.length,d=0,e,f,g,i;for(;d<c;d++)e=b[d],f=e.href,g=e.media,i=e.rel&&e.rel.toLowerCase()==="stylesheet",!!f&&i&&!h[f]&&(!/^([a-zA-Z]+?:(\/\/)?(www\.)?)/.test(f)||f.replace(RegExp.$1,"").split("/")[0]===a.location.host?l.push({href:f,media:g}):h[f]=!0);n()},n=function(){if(l.length){var a=l.shift();s(a.href,function(b){o(b,a.href,a.media),h[a.href]=!0,n()})}},o=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]+\{[^\}\{]+\})+/gi),g=d&&d.length||0,b=b.substring(0,b.lastIndexOf("/")),h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c,j=0,k,l,m,n,o;b.length&&(b+="/"),i&&(g=1);for(;j<g;j++){k=0,i?(l=c,f.push(h(a))):(l=d[j].match(/@media ([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),n=l.split(","),o=n.length;for(;k<o;k++)m=n[k],e.push({media:m.match(/(only\s+)?([a-zA-Z]+)(\sand)?/)&&RegExp.$2,rules:f.length-1,minw:m.match(/\(min\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1),maxw:m.match(/\(max\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1)})}r()},p,q,r=function(a){var b="clientWidth",h=d[b],l=c.compatMode==="CSS1Compat"&&h||c.body[b]||h,m={},n=c.createDocumentFragment(),o=k[k.length-1],s=(new Date).getTime();if(a&&p&&s-p<i)clearTimeout(q),q=setTimeout(r,i);else{p=s;for(var t in e){var u=e[t];if(!u.minw&&!u.maxw||(!u.minw||u.minw&&l>=u.minw)&&(!u.maxw||u.maxw&&l<=u.maxw))m[u.media]||(m[u.media]=[]),m[u.media].push(f[u.rules])}for(var t in g)g[t]&&g[t].parentNode===j&&j.removeChild(g[t]);for(var t in m){var v=c.createElement("style"),w=m[t].join("\n");v.type="text/css",v.media=t,v.styleSheet?v.styleSheet.cssText=w:v.appendChild(c.createTextNode(w)),n.appendChild(v),g.push(v)}j.insertBefore(n,o.nextSibling)}},s=function(a,b){var c=t();if(!!c){c.open("GET",a,!0),c.onreadystatechange=function(){c.readyState==4&&(c.status==200||c.status==304)&&b(c.responseText)};if(c.readyState==4)return;c.send()}},t=function(){var a=!1,b=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest}],c=b.length;while(c--){try{a=b[c]()}catch(d){continue}break}return function(){return a}}();m(),respond.update=m,a.addEventListener?a.addEventListener("resize",u,!1):a.attachEvent&&a.attachEvent("onresize",u)}}(this,Modernizr.mq("only all")),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css",!a.e&&(w||r)?function a(b){m(function(){if(!d)try{b.sheet.cssRules.length?(d=1,j()):a(b)}catch(c){c.code==1e3||c.message=="security"||c.message=="denied"?(d=1,m(function(){j()},0)):a(b)}},0)}(c):(c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload()),m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return typeof a=="object"},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))}; |
0 | 5 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,161 @@ |
0 |
+function getNav() { |
|
1 |
+ var mobileNav = $('nav[role=navigation] fieldset[role=search]').after('<fieldset class="mobile-nav"></fieldset>').next().append('<select></select>'); |
|
2 |
+ mobileNav.children('select').append('<option value="">Navigate…</option>'); |
|
3 |
+ $('ul[role=main-navigation]').addClass('main-navigation'); |
|
4 |
+ $('ul.main-navigation a').each(function(link) { |
|
5 |
+ mobileNav.children('select').append('<option value="'+link.href+'">» '+link.text+'</option>'); |
|
6 |
+ }); |
|
7 |
+ $('ul.subscription a').each(function(link) { |
|
8 |
+ mobileNav.children('select').append('<option value="'+link.href+'">» '+link.text+'</option>'); |
|
9 |
+ }); |
|
10 |
+ mobileNav.children('select').bind('change', function(event) { |
|
11 |
+ if (event.target.value) { window.location.href = event.target.value; } |
|
12 |
+ }); |
|
13 |
+} |
|
14 |
+ |
|
15 |
+function addSidebarToggler() { |
|
16 |
+ if(!$('body').hasClass('sidebar-footer')) { |
|
17 |
+ $('#content').append('<span class="toggle-sidebar"></span>'); |
|
18 |
+ $('.toggle-sidebar').bind('click', function(e) { |
|
19 |
+ e.preventDefault(); |
|
20 |
+ if ($('body').hasClass('collapse-sidebar')) { |
|
21 |
+ $('body').removeClass('collapse-sidebar'); |
|
22 |
+ } else { |
|
23 |
+ $('body').addClass('collapse-sidebar'); |
|
24 |
+ } |
|
25 |
+ }); |
|
26 |
+ } |
|
27 |
+ var sections = $('aside.sidebar > section'); |
|
28 |
+ if (sections.length > 1) { |
|
29 |
+ sections.each(function(section, index){ |
|
30 |
+ if ((sections.length >= 3) && index % 3 === 0) { |
|
31 |
+ $(section).addClass("first"); |
|
32 |
+ } |
|
33 |
+ var count = ((index +1) % 2) ? "odd" : "even"; |
|
34 |
+ $(section).addClass(count); |
|
35 |
+ }); |
|
36 |
+ } |
|
37 |
+ if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); } |
|
38 |
+} |
|
39 |
+ |
|
40 |
+function testFeatures() { |
|
41 |
+ var features = ['maskImage']; |
|
42 |
+ $(features).map(function(feature) { |
|
43 |
+ if (Modernizr.testAllProps(feature)) { |
|
44 |
+ $('html').addClass(feature); |
|
45 |
+ } else { |
|
46 |
+ $('html').addClass('no-'+feature); |
|
47 |
+ } |
|
48 |
+ }); |
|
49 |
+ if ("placeholder" in document.createElement("input")) { |
|
50 |
+ $('html').addClass('placeholder'); |
|
51 |
+ } else { |
|
52 |
+ $('html').addClass('no-placeholder'); |
|
53 |
+ } |
|
54 |
+} |
|
55 |
+ |
|
56 |
+function addCodeLineNumbers() { |
|
57 |
+ if (navigator.appName === 'Microsoft Internet Explorer') { return; } |
|
58 |
+ $('div.gist-highlight').each(function(code) { |
|
59 |
+ var tableStart = '<table><tbody><tr><td class="gutter">', |
|
60 |
+ lineNumbers = '<pre class="line-numbers">', |
|
61 |
+ tableMiddle = '</pre></td><td class="code">', |
|
62 |
+ tableEnd = '</td></tr></tbody></table>', |
|
63 |
+ count = $('.line', code).length; |
|
64 |
+ for (var i=1;i<=count; i++) { |
|
65 |
+ lineNumbers += '<span class="line-number">'+i+'</span>\n'; |
|
66 |
+ } |
|
67 |
+ var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd; |
|
68 |
+ $(code).html(table); |
|
69 |
+ }); |
|
70 |
+} |
|
71 |
+ |
|
72 |
+function flashVideoFallback(){ |
|
73 |
+ var flashplayerlocation = "/assets/jwplayer/player.swf", |
|
74 |
+ flashplayerskin = "/assets/jwplayer/glow/glow.xml"; |
|
75 |
+ $('video').each(function(video){ |
|
76 |
+ video = $(video); |
|
77 |
+ if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") !== -1){ |
|
78 |
+ video.children('source[src$=mp4]').first().map(function(source){ |
|
79 |
+ var src = $(source).attr('src'), |
|
80 |
+ id = 'video_'+Math.round(1 + Math.random()*(100000)), |
|
81 |
+ width = video.attr('width'), |
|
82 |
+ height = parseInt(video.attr('height'), 10) + 30; |
|
83 |
+ video.after('<div class="flash-video"><div><div id='+id+'>'); |
|
84 |
+ swfobject.embedSWF(flashplayerlocation, id, width, height + 30, "9.0.0", |
|
85 |
+ { file : src, image : video.attr('poster'), skin : flashplayerskin } , |
|
86 |
+ { movie : src, wmode : "opaque", allowfullscreen : "true" } |
|
87 |
+ ); |
|
88 |
+ }); |
|
89 |
+ video.remove(); |
|
90 |
+ } |
|
91 |
+ }); |
|
92 |
+} |
|
93 |
+ |
|
94 |
+function wrapFlashVideos() { |
|
95 |
+ $('object').each(function(object) { |
|
96 |
+ object = $(object); |
|
97 |
+ if ( $('param[name=movie]', object).length ) { |
|
98 |
+ var wrapper = object.before('<div class="flash-video"><div>').previous(); |
|
99 |
+ $(wrapper).children().append(object); |
|
100 |
+ } |
|
101 |
+ }); |
|
102 |
+ $('iframe[src*=vimeo],iframe[src*=youtube]').each(function(iframe) { |
|
103 |
+ iframe = $(iframe); |
|
104 |
+ var wrapper = iframe.before('<div class="flash-video"><div>').previous(); |
|
105 |
+ $(wrapper).children().append(iframe); |
|
106 |
+ }); |
|
107 |
+} |
|
108 |
+ |
|
109 |
+function renderDeliciousLinks(items) { |
|
110 |
+ var output = "<ul>"; |
|
111 |
+ for (var i=0,l=items.length; i<l; i++) { |
|
112 |
+ output += '<li><a href="' + items[i].u + '" title="Tags: ' + (items[i].t == "" ? "" : items[i].t.join(', ')) + '">' + items[i].d + '</a></li>'; |
|
113 |
+ } |
|
114 |
+ output += "</ul>"; |
|
115 |
+ $('#delicious').html(output); |
|
116 |
+} |
|
117 |
+ |
|
118 |
+$.domReady(function() { |
|
119 |
+ testFeatures(); |
|
120 |
+ wrapFlashVideos(); |
|
121 |
+ flashVideoFallback(); |
|
122 |
+ addCodeLineNumbers(); |
|
123 |
+ getNav(); |
|
124 |
+ addSidebarToggler(); |
|
125 |
+}); |
|
126 |
+ |
|
127 |
+// iOS scaling bug fix |
|
128 |
+// Rewritten version |
|
129 |
+// By @mathias, @cheeaun and @jdalton |
|
130 |
+// Source url: https://gist.github.com/901295 |
|
131 |
+(function(doc) { |
|
132 |
+ var addEvent = 'addEventListener', |
|
133 |
+ type = 'gesturestart', |
|
134 |
+ qsa = 'querySelectorAll', |
|
135 |
+ scales = [1, 1], |
|
136 |
+ meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : []; |
|
137 |
+ function fix() { |
|
138 |
+ meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1]; |
|
139 |
+ doc.removeEventListener(type, fix, true); |
|
140 |
+ } |
|
141 |
+ if ((meta = meta[meta.length - 1]) && addEvent in doc) { |
|
142 |
+ fix(); |
|
143 |
+ scales = [0.25, 1.6]; |
|
144 |
+ doc[addEvent](type, fix, true); |
|
145 |
+ } |
|
146 |
+}(document)); |
|
147 |
+ |
|
148 |
+/*! SWFObject v2.2 modified by Brandon Mathis to contain only what is necessary to dynamically embed flash objects |
|
149 |
+ * Uncompressed source in javascripts/libs/swfobject-dynamic.js |
|
150 |
+ * <http://code.google.com/p/swfobject/> |
|
151 |
+ released under the MIT License <http://www.opensource.org/licenses/mit-license.php> |
|
152 |
+*/ |
|
153 |
+var swfobject=function(){function s(a,b,d){var q,k=n(d);if(g.wk&&g.wk<312)return q;if(k){if(typeof a.id==l)a.id=d;if(g.ie&&g.win){var e="",c;for(c in a)if(a[c]!=Object.prototype[c])c.toLowerCase()=="data"?b.movie=a[c]:c.toLowerCase()=="styleclass"?e+=' class="'+a[c]+'"':c.toLowerCase()!="classid"&&(e+=" "+c+'="'+a[c]+'"');c="";for(var f in b)b[f]!=Object.prototype[f]&&(c+='<param name="'+f+'" value="'+b[f]+'" />');k.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+e+">"+c+ |
|
154 |
+"</object>";q=n(a.id)}else{f=i.createElement(o);f.setAttribute("type",m);for(var h in a)a[h]!=Object.prototype[h]&&(h.toLowerCase()=="styleclass"?f.setAttribute("class",a[h]):h.toLowerCase()!="classid"&&f.setAttribute(h,a[h]));for(e in b)b[e]!=Object.prototype[e]&&e.toLowerCase()!="movie"&&(a=f,c=e,h=b[e],d=i.createElement("param"),d.setAttribute("name",c),d.setAttribute("value",h),a.appendChild(d));k.parentNode.replaceChild(f,k);q=f}}return q}function n(a){var b=null;try{b=i.getElementById(a)}catch(d){}return b} |
|
155 |
+function t(a){var b=g.pv,a=a.split(".");a[0]=parseInt(a[0],10);a[1]=parseInt(a[1],10)||0;a[2]=parseInt(a[2],10)||0;return b[0]>a[0]||b[0]==a[0]&&b[1]>a[1]||b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]?!0:!1}function u(a){return/[\\\"<>\.;]/.exec(a)!=null&&typeof encodeURIComponent!=l?encodeURIComponent(a):a}var l="undefined",o="object",m="application/x-shockwave-flash",v=window,i=document,j=navigator,g=function(){var a=typeof i.getElementById!=l&&typeof i.getElementsByTagName!=l&&typeof i.createElement!=l, |
|
156 |
+b=j.userAgent.toLowerCase(),d=j.platform.toLowerCase(),g=d?/win/.test(d):/win/.test(b),d=d?/mac/.test(d):/mac/.test(b),b=/webkit/.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,k=!+"\u000b1",e=[0,0,0],c=null;if(typeof j.plugins!=l&&typeof j.plugins["Shockwave Flash"]==o){if((c=j.plugins["Shockwave Flash"].description)&&!(typeof j.mimeTypes!=l&&j.mimeTypes[m]&&!j.mimeTypes[m].enabledPlugin))k=!1,c=c.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),e[0]=parseInt(c.replace(/^(.*)\..*$/,"$1"), |
|
157 |
+10),e[1]=parseInt(c.replace(/^.*\.(.*)\s.*$/,"$1"),10),e[2]=/[a-zA-Z]/.test(c)?parseInt(c.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}else if(typeof v.ActiveXObject!=l)try{var f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(f&&(c=f.GetVariable("$version")))k=!0,c=c.split(" ")[1].split(","),e=[parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)]}catch(h){}return{w3:a,pv:e,wk:b,ie:k,win:g,mac:d}}();return{embedSWF:function(a,b,d,i,k,e,c,f,h){var j={success:!1,id:b};if(g.w3&&!(g.wk&&g.wk<312)&& |
|
158 |
+a&&b&&d&&i&&k){d+="";i+="";var p={};if(f&&typeof f===o)for(var m in f)p[m]=f[m];p.data=a;p.width=d;p.height=i;a={};if(c&&typeof c===o)for(var n in c)a[n]=c[n];if(e&&typeof e===o)for(var r in e)typeof a.flashvars!=l?a.flashvars+="&"+r+"="+e[r]:a.flashvars=r+"="+e[r];if(t(k))b=s(p,a,b),j.success=!0,j.ref=b}h&&h(j)},ua:g,getFlashPlayerVersion:function(){return{major:g.pv[0],minor:g.pv[1],release:g.pv[2]}},hasFlashPlayerVersion:t,createSWF:function(a,b,d){if(g.w3)return s(a,b,d)},getQueryParamValue:function(a){var b= |
|
159 |
+i.location.search||i.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);if(a==null)return u(b);for(var b=b.split("&"),d=0;d<b.length;d++)if(b[d].substring(0,b[d].indexOf("="))==a)return u(b[d].substring(b[d].indexOf("=")+1))}return""}}}(); |
|
160 |
+ |
0 | 161 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,56 @@ |
0 |
+function pinboardNS_fetch_script(url) { |
|
1 |
+ //document.writeln('<s'+'cript type="text/javascript" src="' + url + '"></s'+'cript>'); |
|
2 |
+ (function(){ |
|
3 |
+ var pinboardLinkroll = document.createElement('script'); |
|
4 |
+ pinboardLinkroll.type = 'text/javascript'; |
|
5 |
+ pinboardLinkroll.async = true; |
|
6 |
+ pinboardLinkroll.src = url; |
|
7 |
+ document.getElementsByTagName('head')[0].appendChild(pinboardLinkroll); |
|
8 |
+ })(); |
|
9 |
+} |
|
10 |
+ |
|
11 |
+function pinboardNS_show_bmarks(r) { |
|
12 |
+ var lr = new Pinboard_Linkroll(); |
|
13 |
+ lr.set_items(r); |
|
14 |
+ lr.show_bmarks(); |
|
15 |
+} |
|
16 |
+ |
|
17 |
+function Pinboard_Linkroll() { |
|
18 |
+ var items; |
|
19 |
+ |
|
20 |
+ this.set_items = function(i) { |
|
21 |
+ this.items = i; |
|
22 |
+ } |
|
23 |
+ this.show_bmarks = function() { |
|
24 |
+ var lines = []; |
|
25 |
+ for (var i = 0; i < this.items.length; i++) { |
|
26 |
+ var item = this.items[i]; |
|
27 |
+ var str = this.format_item(item); |
|
28 |
+ lines.push(str); |
|
29 |
+ } |
|
30 |
+ document.getElementById(linkroll).innerHTML = lines.join("\n"); |
|
31 |
+ } |
|
32 |
+ this.cook = function(v) { |
|
33 |
+ return v.replace('<', '<').replace('>', '>>'); |
|
34 |
+ } |
|
35 |
+ |
|
36 |
+ this.format_item = function(it) { |
|
37 |
+ var str = "<li class=\"pin-item\">"; |
|
38 |
+ if (!it.d) { return; } |
|
39 |
+ str += "<p><a class=\"pin-title\" href=\"" + this.cook(it.u) + "\">" + this.cook(it.d) + "</a>"; |
|
40 |
+ if (it.n) { |
|
41 |
+ str += "<span class=\"pin-description\">" + this.cook(it.n) + "</span>\n"; |
|
42 |
+ } |
|
43 |
+ if (it.t.length > 0) { |
|
44 |
+ for (var i = 0; i < it.t.length; i++) { |
|
45 |
+ var tag = it.t[i]; |
|
46 |
+ str += " <a class=\"pin-tag\" href=\"https://pinboard.in/u:"+ this.cook(it.a) + "/t:" + this.cook(tag) + "\">" + this.cook(tag).replace(/^\s+|\s+$/g, '') + "</a> "; |
|
47 |
+ } |
|
48 |
+ } |
|
49 |
+ str += "</p></li>\n"; |
|
50 |
+ return str; |
|
51 |
+ } |
|
52 |
+} |
|
53 |
+Pinboard_Linkroll.prototype = new Pinboard_Linkroll(); |
|
54 |
+pinboardNS_fetch_script("https://feeds.pinboard.in/json/v1/u:"+pinboard_user+"/?cb=pinboardNS_show_bmarks\&count="+pinboard_count); |
|
55 |
+ |
0 | 56 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,78 @@ |
0 |
+// JSON-P Twitter fetcher for Octopress |
|
1 |
+// (c) Brandon Mathis // MIT License |
|
2 |
+ |
|
3 |
+/* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */ |
|
4 |
+function prettyDate(time) { |
|
5 |
+ if (navigator.appName === 'Microsoft Internet Explorer') { |
|
6 |
+ return "<span>∞</span>"; // because IE date parsing isn't fun. |
|
7 |
+ } |
|
8 |
+ var say = { |
|
9 |
+ just_now: " now", |
|
10 |
+ minute_ago: "1m", |
|
11 |
+ minutes_ago: "m", |
|
12 |
+ hour_ago: "1h", |
|
13 |
+ hours_ago: "h", |
|
14 |
+ yesterday: "1d", |
|
15 |
+ days_ago: "d", |
|
16 |
+ last_week: "1w", |
|
17 |
+ weeks_ago: "w" |
|
18 |
+ }; |
|
19 |
+ |
|
20 |
+ var current_date = new Date(), |
|
21 |
+ current_date_time = current_date.getTime(), |
|
22 |
+ current_date_full = current_date_time + (1 * 60000), |
|
23 |
+ date = new Date(time), |
|
24 |
+ diff = ((current_date_full - date.getTime()) / 1000), |
|
25 |
+ day_diff = Math.floor(diff / 86400); |
|
26 |
+ |
|
27 |
+ if (isNaN(day_diff) || day_diff < 0) { return "<span>∞</span>"; } |
|
28 |
+ |
|
29 |
+ return day_diff === 0 && ( |
|
30 |
+ diff < 60 && say.just_now || |
|
31 |
+ diff < 120 && say.minute_ago || |
|
32 |
+ diff < 3600 && Math.floor(diff / 60) + say.minutes_ago || |
|
33 |
+ diff < 7200 && say.hour_ago || |
|
34 |
+ diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) || |
|
35 |
+ day_diff === 1 && say.yesterday || |
|
36 |
+ day_diff < 7 && day_diff + say.days_ago || |
|
37 |
+ day_diff === 7 && say.last_week || |
|
38 |
+ day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago; |
|
39 |
+} |
|
40 |
+ |
|
41 |
+function linkifyTweet(text, url) { |
|
42 |
+ // Linkify urls, usernames, hashtags |
|
43 |
+ text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>') |
|
44 |
+ .replace(/(^|\W)@(\w+)/g, '$1<a href="https://twitter.com/$2">@$2</a>') |
|
45 |
+ .replace(/(^|\W)#(\w+)/g, '$1<a href="https://search.twitter.com/search?q=%23$2">#$2</a>'); |
|
46 |
+ |
|
47 |
+ // Use twitter's api to replace t.co shortened urls with expanded ones. |
|
48 |
+ for (var u in url) { |
|
49 |
+ if(url[u].expanded_url != null){ |
|
50 |
+ var shortUrl = new RegExp(url[u].url, 'g'); |
|
51 |
+ text = text.replace(shortUrl, url[u].expanded_url); |
|
52 |
+ var shortUrl = new RegExp(">"+(url[u].url.replace(/https?:\/\//, '')), 'g'); |
|
53 |
+ text = text.replace(shortUrl, ">"+url[u].display_url); |
|
54 |
+ } |
|
55 |
+ } |
|
56 |
+ return text |
|
57 |
+} |
|
58 |
+ |
|
59 |
+function showTwitterFeed(tweets, twitter_user) { |
|
60 |
+ var timeline = document.getElementById('tweets'), |
|
61 |
+ content = ''; |
|
62 |
+ |
|
63 |
+ for (var t in tweets) { |
|
64 |
+ content += '<li>'+'<p>'+'<a href="https://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>'; |
|
65 |
+ } |
|
66 |
+ timeline.innerHTML = content; |
|
67 |
+} |
|
68 |
+ |
|
69 |
+function getTwitterFeed(user, count, replies) { |
|
70 |
+ count = parseInt(count, 10); |
|
71 |
+ $.ajax({ |
|
72 |
+ url: "https://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?" |
|
73 |
+ , type: 'jsonp' |
|
74 |
+ , error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); } |
|
75 |
+ , success: function(data) { showTwitterFeed(data.slice(0, count), user); } |
|
76 |
+ }) |
|
77 |
+} |