1
- /// <reference path="../jquery/jquery.d.ts" />
2
- /// <reference path="foundation.d.ts" />
3
-
4
- function test_orbit ( ) {
5
- $ ( "#featured" ) . orbit ( ) ;
6
- $ ( '#featured' ) . orbit ( {
7
- animation : 'fade' ,
8
- animationSpeed : 800 ,
9
- timer : true ,
10
- resetTimerOnClick : false ,
11
- advanceSpeed : 4000 ,
12
- pauseOnHover : false ,
13
- startClockOnMouseOut : false ,
14
- startClockOnMouseOutAfter : 1000 ,
15
- directionalNav : true ,
16
- captions : true ,
17
- captionAnimation : 'fade' ,
18
- captionAnimationSpeed : 800 ,
19
- bullets : false ,
20
- bulletThumbs : false ,
21
- bulletThumbLocation : '' ,
22
- afterSlideChange : function ( ) { } ,
23
- fluid : true
24
- } ) ;
25
- }
26
-
27
- function test_fluid ( ) {
28
- $ ( "#myModal" ) . reveal ( ) ;
29
- }
30
-
31
- function test_joyride ( ) {
32
- $ ( "#chooseID" ) . joyride ( ) ;
33
- }
1
+ /// <reference path="../jquery/jquery.d.ts" />
2
+ /// <reference path="foundation.d.ts" />
3
+
4
+ function empty_callback ( ) : void { }
5
+
6
+ function plugin_list ( ) {
7
+ return [
8
+ "abide" ,
9
+ "accordion" ,
10
+ "alert" ,
11
+ "clearing" ,
12
+ "dropdown" ,
13
+ "interchange" ,
14
+ "joyride" ,
15
+ "magellan" ,
16
+ "offcanvas" ,
17
+ "orbit" ,
18
+ "reveal" ,
19
+ "slider" ,
20
+ "tab" ,
21
+ "tooltip" ,
22
+ "topbar"
23
+ ] ;
24
+ }
25
+
26
+ function abide_patterns ( ) {
27
+ var patterns : Foundation . AbidePatterns = { } ;
28
+ patterns . alpha = / ^ [ a - z A - Z ] + $ / ;
29
+ patterns . alpha_numeric = / ^ [ a - z A - Z 0 - 9 ] + $ / ;
30
+ patterns . integer = / ^ [ - + ] ? \d + $ / ;
31
+ patterns . number = / ^ [ - + ] ? [ 1 - 9 ] \d * $ / ;
32
+ patterns . card = / ^ [ 0 - 9 ] { 8 } $ / ;
33
+ patterns . cvv = / ^ ( [ 0 - 9 ] ) { 3 , 4 } $ / ;
34
+ patterns . email = / ^ t e s t @ e x a m p l e \. o r g $ / ;
35
+ patterns . url = / h t t p : \/ \/ w w w \. g o o g l e \. c o m \/ / ;
36
+ patterns . domain = / d e f i n i t e l y t y p e d \. o r g / ;
37
+ patterns . datetime = / ( [ 0 - 2 ] [ 0 - 9 ] { 3 } ) \- ( [ 0 - 1 ] [ 0 - 9 ] ) \- ( [ 0 - 3 ] [ 0 - 9 ] ) T ( [ 0 - 5 ] [ 0 - 9 ] ) \: ( [ 0 - 5 ] [ 0 - 9 ] ) \: ( [ 0 - 5 ] [ 0 - 9 ] ) ( Z | ( [ \- \+ ] ( [ 0 - 1 ] [ 0 - 9 ] ) \: 0 0 ) ) / ;
38
+ patterns . date = / (?: 1 9 | 2 0 ) [ 0 - 9 ] { 2 } - (?: (?: 0 [ 1 - 9 ] | 1 [ 0 - 2 ] ) - (?: 0 [ 1 - 9 ] | 1 [ 0 - 9 ] | 2 [ 0 - 9 ] ) | (?: (? ! 0 2 ) (?: 0 [ 1 - 9 ] | 1 [ 0 - 2 ] ) - (?: 3 0 ) ) | (?: (?: 0 [ 1 3 5 7 8 ] | 1 [ 0 2 ] ) - 3 1 ) ) / ;
39
+ patterns . time = / ( 0 [ 0 - 9 ] | 1 [ 0 - 9 ] | 2 [ 0 - 3 ] ) ( : [ 0 - 5 ] [ 0 - 9 ] ) { 2 } / ;
40
+ patterns . dateISO = / \d { 4 } [ \/ \- ] \d { 1 , 2 } [ \/ \- ] \d { 1 , 2 } / ;
41
+ patterns . month_day_year = / ( 0 [ 1 - 9 ] | 1 [ 0 1 2 ] ) [ - \/ . ] ( 0 [ 1 - 9 ] | [ 1 2 ] [ 0 - 9 ] | 3 [ 0 1 ] ) [ - \/ . ] ( 1 9 | 2 0 ) \d \d / ;
42
+ patterns . color = / ^ # ? ( [ a - f A - F 0 - 9 ] { 6 } | [ a - f A - F 0 - 9 ] { 3 } ) $ / ;
43
+ return patterns ;
44
+ }
45
+
46
+ function abide_options ( ) {
47
+ var opts : Foundation . AbideOptions = { } ;
48
+ opts . live_validate = false ;
49
+ opts . validate_on_blur = true ;
50
+ opts . focus_on_invalid = true ;
51
+ opts . error_labels = true ;
52
+ opts . timeout = 500 ;
53
+ opts . patterns = abide_patterns ( ) ;
54
+ opts . validators = {
55
+ diceRoll : function ( el : HTMLInputElement , required : boolean , parent : HTMLElement ) {
56
+ var possibilities = [ true , false ] ;
57
+ return possibilities [ Math . round ( Math . random ( ) ) ] ;
58
+ } ,
59
+ isAllowed : function ( el : HTMLInputElement , required : boolean , parent : HTMLElement ) {
60
+ var possibilities = [ "[email protected] " , "b.zurb.com" ] ;
61
+ return possibilities . indexOf ( el . value ) > - 1 ;
62
+ }
63
+ }
64
+ return opts ;
65
+ }
66
+
67
+ function accordion_options ( ) {
68
+ var opts : Foundation . AccordionOptions = { } ;
69
+ opts . content_class = "content" ;
70
+ opts . active_class = "class-name" ;
71
+ opts . multi_expand = false ;
72
+ opts . toggleable = true ;
73
+ opts . callback = empty_callback ;
74
+ return opts ;
75
+ }
76
+
77
+ function alert_options ( ) {
78
+ var opts : Foundation . AlertOptions = { } ;
79
+ opts . callback = empty_callback ;
80
+ return opts ;
81
+ }
82
+
83
+ function clearing_options ( ) {
84
+ var opts : Foundation . ClearingOptions = { } ;
85
+ opts . templates = {
86
+ viewing : '<div>Some HTML</div>'
87
+ } ;
88
+ opts . close_selectors = "#id-value, .class-name" ;
89
+ opts . open_selectors = "li#id-value" ;
90
+ opts . skip_selector = ".skip-class" ;
91
+ opts . touch_label = "Display string" ;
92
+ opts . init = true ;
93
+ opts . locked = false ;
94
+ return opts ;
95
+ }
96
+
97
+ function dropdown_options ( ) {
98
+ var opts : Foundation . DropdownOptions = { } ;
99
+ opts . active_class = "class-name" ;
100
+ opts . disabled_class = "disabled-class" ;
101
+ opts . mega_class = "big" ;
102
+ opts . align = "top" ;
103
+ opts . is_hover = false ;
104
+ opts . hover_timeout = 250 ;
105
+ opts . opened = empty_callback ;
106
+ opts . closed = empty_callback ;
107
+ return opts ;
108
+ }
109
+
110
+ function equalizer_options ( ) {
111
+ var opts : Foundation . EqualizerOptions = { } ;
112
+ opts . use_tallest = true ;
113
+ opts . equalize_on_stack = false ;
114
+ return opts ;
115
+ }
116
+
117
+ function interchange_options ( ) {
118
+ var opts : Foundation . InterchangeOptions = { } ;
119
+ opts . load_attr = "interchange" ;
120
+ opts . named_queries = {
121
+ my_custom_query : "only screen and (max-width: 200px)"
122
+ } ;
123
+ opts . directives = {
124
+ replace : empty_callback
125
+ } ;
126
+ return opts ;
127
+ }
128
+
129
+ function joyride_options ( ) {
130
+ var opts : Foundation . JoyrideOptions = { } ;
131
+ opts . expose = false ;
132
+ opts . modal = true ;
133
+ opts . keyboard = true ;
134
+ opts . tip_location = "bottom" ;
135
+ opts . nub_position = "left" ;
136
+ opts . scroll_speed = 2500 ;
137
+ opts . scroll_animation = "lineaer" ;
138
+ opts . timer = 100 ;
139
+ opts . start_timer_on_click = true ;
140
+ opts . start_offset = 3 ;
141
+ opts . next_button = false ;
142
+ opts . prev_button = false ;
143
+ opts . tip_animation = "pulse" ;
144
+ opts . pause_after = [ 4 , 7 , 10 , 14 ] ;
145
+ opts . exposed = [ "#elm-id-one" , "#elm-id-two" ] ;
146
+ opts . tip_animation_fade_speed = 100 ;
147
+ opts . cookie_monster = true ;
148
+ opts . cookie_name = "ts_joyride" ;
149
+ opts . cookie_domain = false ;
150
+ opts . cookie_expires = 7 ;
151
+ opts . tip_container = '#header' ;
152
+ opts . tip_location_patterns = {
153
+ top : [ 'botom' ] ,
154
+ bottom : [ ] ,
155
+ left : [ 'right' , 'top' , 'bottom' ] ,
156
+ right : [ 'left' , 'top' , 'bottom' ]
157
+ } ;
158
+ opts . post_ride_callback = empty_callback ;
159
+ opts . post_step_callback = empty_callback ;
160
+ opts . pre_step_callback = empty_callback ;
161
+ opts . pre_ride_callback = empty_callback ;
162
+ opts . post_expose_callback = empty_callback ;
163
+ opts . template = {
164
+ link : '<a href="#close" class="joyride-close-tip">×</a>' ,
165
+ timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>' ,
166
+ tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>' ,
167
+ wrapper : '<div class="joyride-content-wrapper"></div>' ,
168
+ button : '<a href="#" class="small button joyride-next-tip"></a>' ,
169
+ prev_button : '<a href="#" class="small button joyride-prev-tip"></a>' ,
170
+ modal : '<div class="joyride-modal-bg"></div>' ,
171
+ expose : '<div class="joyride-expose-wrapper"></div>' ,
172
+ expose_cover : '<div class="joyride-expose-cover"></div>'
173
+ } ;
174
+ opts . expose_add_class = ".expose .class-name" ;
175
+ return opts ;
176
+ }
177
+
178
+ function magellan_options ( ) {
179
+ var opts : Foundation . MagellanOptions = { } ;
180
+ opts . active_class = ".active-element" ;
181
+ opts . threshold = 20 ;
182
+ opts . destination_threshold = 30 ;
183
+ opts . throttle_delay = 24 ;
184
+ opts . fixed_top = 0 ;
185
+ opts . offset_by_height = false ;
186
+ opts . duration = 1000 ;
187
+ opts . easing = "linear" ;
188
+ return opts ;
189
+ }
190
+
191
+ function offcanvas_options ( ) {
192
+ var opts : Foundation . OffCanvasOptions = { } ;
193
+ opts . open_method = "overlap_single" ;
194
+ opts . close_on_click = true ;
195
+ return opts ;
196
+ }
197
+
198
+ function orbit_options ( ) {
199
+ var opts : Foundation . OrbitOptions = { } ;
200
+ opts . animation = 'slide' ;
201
+ opts . timer_speed = 10000 ;
202
+ opts . pause_on_hover = true ;
203
+ opts . resume_on_mouseout = false ;
204
+ opts . next_on_click = true ;
205
+ opts . animation_speed = 500 ;
206
+ opts . stack_on_small = false ;
207
+ opts . navigation_arrows = true ;
208
+ opts . slide_number = true ;
209
+ opts . slide_number_text = 'of' ;
210
+ opts . container_class = 'orbit-container' ;
211
+ opts . stack_on_small_class = 'orbit-stack-on-small' ;
212
+ opts . next_class = 'orbit-next' ;
213
+ opts . prev_class = 'orbit-prev' ;
214
+ opts . timer_container_class = 'orbit-timer' ;
215
+ opts . timer_paused_class = 'paused' ;
216
+ opts . timer_progress_class = 'orbit-progress' ;
217
+ opts . slides_container_class = 'orbit-slides-container' ;
218
+ opts . preloader_class = 'preloader' ;
219
+ opts . slide_selector = 'li' ;
220
+ opts . bullets_container_class = 'orbit-bullets' ;
221
+ opts . bullets_active_class = 'active' ;
222
+ opts . slide_number_class = 'orbit-slide-number' ;
223
+ opts . caption_class = 'orbit-caption' ;
224
+ opts . active_slide_class = 'active' ;
225
+ opts . orbit_transition_class = 'orbit-transitioning' ;
226
+ opts . bullets = true ;
227
+ opts . circular = true ;
228
+ opts . timer = true ;
229
+ opts . variable_height = false ;
230
+ opts . swipe = true ;
231
+ opts . before_slide_change = empty_callback ;
232
+ opts . after_slide_change = empty_callback ;
233
+ return opts ;
234
+ }
235
+
236
+ function reveal_css_options ( ) {
237
+ var opts : Foundation . RevealCSSOptions = { } ;
238
+ opts . opacity = 0 ;
239
+ opts . visibility = 'hidden' ;
240
+ opts . display = "inline-block" ;
241
+ return opts ;
242
+ }
243
+
244
+ function reveal_options ( ) {
245
+ var opts : Foundation . RevealOptions = { } ;
246
+ opts . animation = "linear" ;
247
+ opts . animation_speed = 500 ;
248
+ opts . close_on_background_click = false ;
249
+ opts . dismiss_modal_class = ".modal-bye-bye" ;
250
+ opts . multiple_opened = true ;
251
+ opts . bg_class = ".modal-background" ;
252
+ opts . root_element = "#element-id.element-class" ;
253
+ opts . on_ajax_error = empty_callback ;
254
+ opts . open = empty_callback ;
255
+ opts . opened = empty_callback ;
256
+ opts . close = empty_callback ;
257
+ opts . close = empty_callback ;
258
+ opts . bg = $ ( "#my-modal-id .background" ) ;
259
+ opts . css = {
260
+ open : reveal_css_options ( ) ,
261
+ close : reveal_css_options ( )
262
+ } ;
263
+ return opts ;
264
+ }
265
+
266
+ function slider_options ( ) {
267
+ var opts : Foundation . SliderOptions = { } ;
268
+ opts . start = - 1000 ;
269
+ opts . end = 1000 ;
270
+ opts . step = 50 ;
271
+ opts . precision = 4 ;
272
+ opts . initial = 0 ;
273
+ opts . vertical = false ;
274
+ opts . trigger_input_change = true ;
275
+ opts . on_change = empty_callback ;
276
+ return opts ;
277
+ }
278
+
279
+ function tab_options ( ) {
280
+ var opts : Foundation . TabOptions = { } ;
281
+ opts . active_class = "class-name" ;
282
+ opts . callback = empty_callback ;
283
+ opts . deep_linking = false ;
284
+ opts . scroll_to_content = true ;
285
+ opts . is_hover = false ;
286
+ return opts ;
287
+ }
288
+
289
+ function tooltip_options ( ) {
290
+ var opts : Foundation . TooltipOptions = { } ;
291
+ opts . additional_inheritable_classes = [ "class1" , "class2" ] ;
292
+ opts . tooltip_class = "tooltip" ;
293
+ opts . append_to = "append-class" ;
294
+ opts . touch_close_text = "Close" ;
295
+ opts . disable_for_touch = true ;
296
+ opts . hover_delay = 100 ;
297
+ opts . show_on = "all" ;
298
+ opts . tip_template = function ( selector , content ) {
299
+ return '<span data-selector="' + selector + '" id="' + selector + '" class="' +
300
+ Foundation . libs . tooltip . settings . tooltip_class . substring ( 1 ) +
301
+ '" role="tooltip">' + content + '<span class="nub"></span></span>' ;
302
+ } ;
303
+ return opts ;
304
+ }
305
+
306
+ function topbar_options ( ) {
307
+ var opts : Foundation . TopbarOptions = { } ;
308
+ opts . index = 1 ;
309
+ opts . sticky_class = "top-bar" ;
310
+ opts . custom_back_text = true ;
311
+ opts . back_text = "Return" ;
312
+ opts . is_hover = false ;
313
+ opts . mobile_show_parent_link = true ;
314
+ opts . scrolltop = true ;
315
+ opts . sticky_on = "all" ;
316
+ return opts ;
317
+ }
318
+
319
+ function foundation_options ( ) {
320
+ var opts : Foundation . Options = { } ;
321
+ opts . abide = abide_options ( ) ;
322
+ opts . accordion = accordion_options ( ) ;
323
+ opts . alert = alert_options ( ) ;
324
+ opts . clearing = clearing_options ( ) ;
325
+ opts . dropdown = dropdown_options ( ) ;
326
+ opts . equalizer = equalizer_options ( ) ;
327
+ opts . joyride = joyride_options ( ) ;
328
+ opts . magellan = magellan_options ( ) ;
329
+ opts . offcanvas = offcanvas_options ( ) ;
330
+ opts . orbit = orbit_options ( ) ;
331
+ opts . reveal = reveal_options ( ) ;
332
+ opts . slider = slider_options ( ) ;
333
+ opts . tab = tab_options ( ) ;
334
+ opts . tooltip = tooltip_options ( ) ;
335
+ opts . topbar = topbar_options ( ) ;
336
+ return opts ;
337
+ }
338
+
339
+ $ ( document ) . foundation ( ) ;
340
+
341
+ $ ( document ) . foundation ( foundation_options ( ) ) ;
342
+
343
+ $ ( document ) . foundation ( "reflow" ) ;
344
+ plugin_list ( ) . forEach ( ( plugin ) => $ ( document ) . foundation ( plugin , "reflow" ) ) ;
345
+
346
+ $ ( document ) . foundation ( "slider" , "set_value" , 100 ) ;
0 commit comments