Gallery – Photo Gallery – Image Gallery - Version 1.2.0

Version Description

Download this release

Release Info

Developer machothemes
Plugin Icon wp plugin Gallery – Photo Gallery – Image Gallery
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.13 to 1.2.0

Modula.php CHANGED
@@ -1,138 +1,136 @@
1
  <?php
2
  /**
3
- Plugin Name: Gallery - A WordPress Modula Gallery
4
- Plugin URI: http://modula.greentreelabs.net
5
- Description: The Most Creative Grid Wordpress Gallery.
6
- Author: GreenTreeLabs
7
- Version: 1.1.13
8
- Author URI: http://modula.greentreelabs.net
9
- */
10
-
11
- function modula_lite_create_db_tables()
12
- {
13
- include_once (WP_PLUGIN_DIR . '/modula-best-grid-gallery/lib/install-db.php');
 
 
 
14
  modula_lite_install_db();
15
  }
16
 
17
- if (!class_exists("ModulaLite"))
18
- {
19
- class ModulaLite
20
- {
21
- private $loadedData;
22
-
23
- private $version = "1.1.13";
24
-
25
- private $defaultValues = array(
26
- 'width' => 100,
27
- 'height' => 800,
28
- 'img_size' => 500,
29
- 'margin' => 10,
30
- 'filters' => '',
31
- 'filterClick' => 'F',
32
- 'allFilterLabel' => 'All',
33
- 'lightbox' => 'lightbox2',
34
- 'shuffle' => 'F',
35
- 'captionColor' => '#ffffff',
36
- 'wp_field_caption' => 'caption',
37
- 'wp_field_title' => 'title',
38
- 'captionFontSize' => 14,
39
- 'titleFontSize' => 16,
40
- 'enableTwitter' => 'T',
41
- 'enableFacebook' => 'T',
42
- 'enableGplus' => 'T',
43
- 'enablePinterest' => 'T',
44
- 'socialIconColor' => '#ffffff',
45
- 'loadedScale' => 100,
46
- 'loadedRotate' => 0,
47
- 'loadedHSlide' => 0,
48
- 'loadedVSlide' => 0,
49
- 'borderSize' => 0,
50
- 'borderRadius' => 0,
51
- 'borderColor' => '#ffffff',
52
- 'shadowSize' => 0,
53
- 'shadowColor' => '#ffffff',
54
- 'style' => '',
55
- 'script' => '',
56
- 'randomFactor' => 50,
57
- 'hoverColor' => '#000000',
58
- 'hoverOpacity' => '50',
59
- 'hoverEffect' => 'pufrobo',
60
  'hasResizedImages' => false,
61
- 'importedFrom' => ''
62
  );
63
 
64
- public function __construct()
65
- {
66
- $this->plugin_name = plugin_basename(__FILE__);
67
- $this->plugin_url = plugins_url('', __FILE__);
68
  $this->define_constants();
69
  $this->define_db_tables();
70
  $this->define_hover_effects();
71
  $this->ModulaDB = $this->create_db_conn();
72
 
73
- add_filter('widget_text', 'do_shortcode');
74
- add_filter('mce_buttons', array($this, 'editor_button'));
75
- add_filter('mce_external_plugins', array($this, 'register_editor_plugin'));
76
 
77
- add_action('init', array($this, 'create_textdomain'));
78
 
79
- add_action('wp_enqueue_scripts', array($this, 'add_gallery_scripts'));
80
 
81
- add_action( 'admin_menu', array($this, 'add_gallery_admin_menu') );
82
 
83
- add_shortcode( 'Modula', array($this, 'gallery_shortcode_handler') );
84
 
85
- add_action('wp_ajax_modula_save_gallery', array($this,'save_gallery'));
86
- add_action('wp_ajax_modula_save_image', array($this,'save_image'));
87
- add_action('wp_ajax_modula_add_image', array($this,'add_image'));
88
- add_action('wp_ajax_modula_list_images', array($this,'list_images'));
89
- add_action('wp_ajax_modula_sort_images', array($this,'sort_images'));
90
- add_action('wp_ajax_modula_delete_image', array($this,'delete_image'));
91
- add_action('wp_ajax_modula_resize_images', array($this,'resize_images'));
92
- add_action('wp_ajax_modula_delete_gallery', array($this,'delete_gallery'));
93
- add_action('wp_ajax_modula_clone_gallery', array($this,'clone_gallery'));
94
- add_action('wp_ajax_modula_create_gallery', array($this,'create_gallery'));
95
- add_action('wp_ajax_mtg_shortcode_editor', array($this, 'mtg_shortcode_editor'));
96
- add_action('wp_ajax_modula_get_config', array($this, 'get_config'));
97
- add_action('wp_ajax_modula_update_config', array($this, 'update_config'));
98
- add_action('wp_ajax_modula_get_ext_galleries', array($this,'get_ext_galleries'));
99
- add_action('wp_ajax_modula_do_import_galleries', array($this,'do_import_galleries'));
100
 
101
- add_filter( 'plugin_row_meta',array( $this, 'register_links' ),10,2);
 
102
  }
103
 
104
  //Define textdomain
105
- public function create_textdomain()
106
- {
107
- $plugin_dir = basename(dirname(__FILE__));
108
- load_plugin_textdomain( 'modula-gallery', false, $plugin_dir.'/lib/languages' );
109
  }
110
 
111
- function define_hover_effects()
112
- {
113
- $this->hoverEffects[] = new ModulaLiteHoverEffect('None', 'none', false, false, 0);
114
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Pufrobo', 'pufrobo', true, true, 4);
115
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Fluid Up', '', true, true, 0);
116
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Hide', '', true, true, 4);
117
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Quiet', '', true, false, 4);
118
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Catinelle', '', false, false, 4);
119
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Reflex', '', true, true, 4);
120
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Curtain', '', true, false, 4);
121
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Lens', '', true, true, 4);
122
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Appear', '', true, false, 4);
123
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Crafty', '', true, true, 0);
124
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Seemo', '', true, false, 4);
125
- $this->hoverEffects[] = new ModulaLiteHoverEffect('Comodo', '', true, false, 4);
126
  }
127
 
128
- public function get_ext_galleries()
129
- {
130
- header("Content-type: application/json");
131
 
132
  global $wpdb;
133
 
134
- if(check_admin_referer("Modula","Modula"))
135
- {
136
  $res = array( "success" => 0 );
137
 
138
  $source = $_POST['source'];
@@ -143,9 +141,9 @@ if (!class_exists("ModulaLite"))
143
  switch ( $source ) {
144
  case 'Envira':
145
  $galleries = get_posts( array(
146
- 'post_type' => 'envira',
147
- 'posts_per_page' => 1000
148
- ) );
149
  foreach ( $galleries as $g ) {
150
  $item = array();
151
  $item['id'] = $g->ID;
@@ -154,7 +152,7 @@ if (!class_exists("ModulaLite"))
154
  }
155
  break;
156
  case 'NextGen':
157
- $galleries = $wpdb->get_results("SELECT title, gid FROM $wpdb->nggallery");
158
  foreach ( $galleries as $g ) {
159
  $item = array();
160
  $item['id'] = $g->gid;
@@ -170,90 +168,89 @@ if (!class_exists("ModulaLite"))
170
  die();
171
  }
172
 
173
- public function do_import_galleries()
174
- {
 
 
 
 
 
 
 
 
 
175
  global $wpdb;
176
 
177
- header("Content-type: application/json");
178
- if(check_admin_referer("Modula","Modula"))
179
- {
180
- $res = array("success" => 0);
181
  $source = $_POST['source'];
182
- $ids = explode(",", $_POST['ids']);
183
- switch ($source)
184
- {
185
  case 'Envira':
186
- foreach ($ids as $id)
187
- {
188
- $gallery = get_post($id);
189
- $meta = get_post_meta($id);
190
- $data = unserialize( $meta['_eg_gallery_data'][0] );
191
-
192
- $g = array('name' => $data['config']['title'],
193
- 'description' => 'Imported from Envira ('.$id.') on ' . date('M, d Y'),
194
- 'margin' => $data['config']['gutter'],
195
- 'hasResizedImages' => true,
196
- 'importedFrom' => 'Envira'
197
  );
198
- $gdb = array_merge($this->defaultValues, $g);
199
 
200
- $saved = $this->ModulaDB->addGallery($gdb);
201
  $newId = $this->ModulaDB->getNewGalleryId();
202
 
203
- if($newId && count($data['gallery']))
204
- {
205
  $images = array();
206
  //TODO only active images
207
- foreach ( $data['gallery'] as $item )
208
- {
209
- $toAdd = new stdClass();
210
- $toAdd->imageId = $this->ModulaDB->getIDbyGUID( $item['src'] );
211
- $toAdd->title = $item['title'];
212
  $toAdd->description = $item['caption'];
213
- $toAdd->imagePath = $item['src'];
214
 
215
- $images []= $toAdd;
216
  }
217
- $imgResult = $this->ModulaDB->addImages($newId, $images);
218
  }
219
  }
220
  $res['success'] = 1;
221
  break;
222
  case 'NextGen':
223
- foreach ($ids as $id)
224
- {
225
- $gallery = $wpdb->get_row(
226
- $wpdb->prepare( "SELECT title, gid, path FROM $wpdb->nggallery WHERE gid=%s", $id)
227
- );
228
 
229
- $dbimages = $wpdb->get_results(
230
- $wpdb->prepare( "SELECT filename, description, alttext FROM $wpdb->nggpictures WHERE exclude <> 1 AND galleryid=%s", $id )
231
- );
232
 
233
- $g = array('name' => $gallery->title,
234
- 'description' => 'Imported from NextGet ('.$id.') on ' . date('M, d Y'),
235
- 'hasResizedImages' => true,
236
- 'importedFrom' => 'NextGen'
 
237
  );
238
- $gdb = array_merge($this->defaultValues, $g);
239
 
240
- $saved = $this->ModulaDB->addGallery($gdb);
241
  $newId = $this->ModulaDB->getNewGalleryId();
242
 
243
- if($newId && count($dbimages))
244
- {
245
  $images = array();
246
- foreach ( $dbimages as $item )
247
- {
248
- $toAdd = new stdClass();
249
- $toAdd->imageId = -1;
250
- $toAdd->title = $item->alttext;
251
  $toAdd->description = $item->description;
252
- $toAdd->imagePath = plugins_url('image.php', __FILE__) . "?w=". $this->defaultValues['img_size'] ."&src=" . $gallery->path . "/" . $item->filename;
253
 
254
- $images []= $toAdd;
255
  }
256
- $imgResult = $this->ModulaDB->addImages($newId, $images);
257
 
258
  }
259
  }
@@ -261,58 +258,51 @@ if (!class_exists("ModulaLite"))
261
  break;
262
  }
263
 
264
- echo json_encode($res);
265
  }
266
  die();
267
  }
268
 
269
- public function register_links($links, $file)
270
- {
271
- $base = plugin_basename(__FILE__);
272
- if ($file == $base) {
273
- $links[] = '<a href="admin.php?page=ModulaLite-admin" title="Modula Grid Gallery Dashboard">Dashboard</a>';
274
- $links[] = '<a href="https://twitter.com/greentreelabs" title="@GreenTreeLabs on Twitter">Twitter</a>';
275
- $links[] = '<a href="https://www.facebook.com/greentreelabs" title="GreenTreeLabs on Facebook">Facebook</a>';
276
- $links[] = '<a href="https://www.google.com/+GreentreelabsNetjs" title="GreenTreeLabs on Google+">Google+</a>';
277
- }
278
- return $links;
279
 
280
  }
281
 
282
  //delete gallery
283
- function delete_gallery()
284
- {
285
- if(check_admin_referer("Modula","Modula"))
286
- {
287
- $id= intval($_POST['gid']);
288
- $this->ModulaDB->deleteGallery($id);
289
  }
290
 
291
  die();
292
  }
293
 
294
- public function update_config()
295
- {
296
- if(check_admin_referer("Modula","Modula"))
297
- {
298
- $id = $_POST['id'];
299
- $config = stripslashes($_POST['config']);
300
 
301
- $this->ModulaDB->update_config($id, $config);
302
  }
303
 
304
  die();
305
  }
306
 
307
- public function get_config()
308
- {
309
- if(check_admin_referer("Modula","Modula"))
310
- {
311
- $id = $_POST['id'];
312
 
313
- $data = $this->ModulaDB->getConfig($id);
314
 
315
- print json_encode($data);
316
 
317
  }
318
 
@@ -321,27 +311,24 @@ if (!class_exists("ModulaLite"))
321
 
322
  //add gallery
323
 
324
- function create_gallery()
325
- {
326
- if(check_admin_referer("Modula","Modula"))
327
- {
328
- $data = $this->defaultValues;
329
- $data["name"] = $_POST['name'];
330
- $data["description"] = $_POST['description'];
331
- $data["width"] = $_POST['width'];
332
- $data["height"] = $_POST['height'];
333
- $data["img_size"] = intval($_POST['img_size']);
334
  $data["hasResizedImages"] = true;
335
 
336
- $this->ModulaDB->addGallery($data);
337
  $id = $this->ModulaDB->getLastGalleryId()->Id;
338
 
339
- if($id > 0 && array_key_exists('images', $_POST) && strlen($_POST['images']))
340
- {
341
- $enc_images = stripslashes($_POST["images"]);
342
- $images = array_splice(json_decode($enc_images), 0, 11 + 9);
343
  ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
344
- $result = $this->ModulaDB->addImages($id, $images);
345
  }
346
  print $id;
347
  }
@@ -349,24 +336,21 @@ if (!class_exists("ModulaLite"))
349
  }
350
 
351
  //clone gallery
352
- function clone_gallery()
353
- {
354
- if(check_admin_referer('Modula','Modula'))
355
- {
356
- $sourceId = intval($_POST['gid']);
357
- $g = $this->ModulaDB->getGalleryById($sourceId, $this->defaultValues);
358
- $g->name .="(copy)";
359
- $this->ModulaDB->addGallery($g);
360
- $id = $this->ModulaDB->getNewGalleryId();
361
- $images = $this->ModulaDB->getImagesByGalleryId($sourceId);
362
-
363
- foreach($images as &$image)
364
- {
365
- $image->Id = null;
366
  $image->gid = $id;
367
  }
368
 
369
- $this->ModulaDB->addImages($id, $images);
370
  }
371
 
372
  die();
@@ -374,54 +358,53 @@ if (!class_exists("ModulaLite"))
374
 
375
 
376
  //Define constants
377
- public function define_constants()
378
- {
379
- if ( ! defined( 'Modula_PLUGIN_BASENAME' ) )
380
  define( 'Modula_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
 
381
 
382
- if ( ! defined( 'Modula_PLUGIN_NAME' ) )
383
  define( 'Modula_PLUGIN_NAME', trim( dirname( Modula_PLUGIN_BASENAME ), '/' ) );
 
384
 
385
- if ( ! defined( 'Modula_PLUGIN_DIR' ) )
386
  define( 'Modula_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . Modula_PLUGIN_NAME );
 
387
  }
388
 
389
  //delete Gallery
390
 
391
 
392
-
393
  //Define DB tables
394
- public function define_db_tables()
395
- {
396
  global $wpdb;
397
 
398
  $wpdb->ModulaGalleries = $wpdb->prefix . 'modula';
399
- $wpdb->ModulaImages = $wpdb->prefix . 'modula_images';
400
  }
401
 
402
 
403
- public function create_db_conn()
404
- {
405
- require('lib/db-class.php');
406
  $ModulaDB = ModulaLiteDB::getInstance();
 
407
  return $ModulaDB;
408
  }
409
 
410
- public function editor_button($buttons)
411
- {
412
- array_push($buttons, 'separator', 'mtg_shortcode_editor');
413
  return $buttons;
414
  }
415
 
416
- public function register_editor_plugin($plugin_array)
417
- {
418
- $plugin_array['mtg_shortcode_editor'] = plugins_url('/admin/scripts/editor-plugin.js',__file__);
419
  return $plugin_array;
420
  }
421
 
422
- public function mtg_shortcode_editor()
423
- {
424
- $css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
425
  $admin_url = admin_url();
426
 
427
  $galleries = $this->ModulaDB->getGalleries(); //load all galleries
@@ -431,259 +414,229 @@ if (!class_exists("ModulaLite"))
431
  }
432
 
433
  //Add gallery scripts
434
- public function add_gallery_scripts()
435
- {
436
- wp_enqueue_script('jquery');
437
 
438
- wp_register_script('modula', plugins_url().'/modula-best-grid-gallery/scripts/jquery.modula.js', array('jquery'));
439
- wp_enqueue_script('modula');
440
 
441
 
442
- wp_register_style('modula_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/modula.css');
443
- wp_enqueue_style('modula_stylesheet');
444
 
445
- wp_register_style('effects_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/effects.css', null, $this->version);
446
- wp_enqueue_style('effects_stylesheet');
447
 
448
- wp_register_script('lightbox2_script', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/js/script.js', array('jquery'));
449
- wp_register_style('lightbox2_stylesheet', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/css/style.css');
450
  }
451
 
452
  //Admin Section - register scripts and styles
453
- public function gallery_admin_init()
454
- {
455
- if(function_exists( 'wp_enqueue_media' ))
456
- {
457
  wp_enqueue_media();
458
  }
459
 
460
- wp_enqueue_script('jquery');
461
 
462
  wp_enqueue_script( 'wp-color-picker' );
463
  wp_enqueue_style( 'wp-color-picker' );
464
 
465
- wp_enqueue_script('media-upload');
466
- wp_enqueue_script('thickbox');
467
 
468
- wp_register_style('materialize', plugins_url().'/modula-best-grid-gallery/admin/css/materialize.css');
469
- wp_enqueue_style('materialize');
470
 
471
- wp_register_style('styles', plugins_url().'/modula-best-grid-gallery/admin/css/style.css');
472
- wp_enqueue_style('styles');
473
 
474
- wp_register_style('effects', plugins_url().'/modula-best-grid-gallery/scripts/effects.css');
475
- wp_enqueue_style('effects');
476
 
477
- wp_register_script('modula', plugins_url().'/modula-best-grid-gallery/admin/scripts/modula-admin.js', array('jquery','media-upload','thickbox'));
478
- wp_enqueue_script('modula');
479
 
480
- wp_register_script('materialize', plugins_url().'/modula-best-grid-gallery/admin/scripts/materialize.min.js', array('jquery'));
481
- wp_enqueue_script('materialize');
 
 
 
 
482
 
483
- wp_register_style('materialdesign-icons', plugins_url().'/modula-best-grid-gallery/admin/css/materialdesignicons.css');
484
- wp_enqueue_style('materialdesign-icons');
485
 
486
- wp_enqueue_style('thickbox');
 
 
 
487
 
488
  $tg_db_version = '1.0';
489
  $installed_ver = get_option( "Modula_db_version" );
490
 
491
- if($installed_ver != $tg_db_version )
492
- {
493
  modula_lite_create_db_tables();
494
  update_option( "Modula_db_version", $tg_db_version );
495
  }
496
  }
497
 
498
 
499
-
500
  //Create Admin Menu
501
- public function add_gallery_admin_menu()
502
- {
503
- $overview = add_menu_page('Modula', 'Modula', 'edit_posts', 'ModulaLite-admin', array($this, 'add_overview'), plugins_url().'/modula-best-grid-gallery/admin/icon.png');
 
 
504
 
505
 
506
- if(! get_option( "Modula_skip_fix" ) && get_option( "Modula_db_version" ) && count($this->ModulaDB->getGalleries()) > 0) {
507
 
508
  $imageUrl = null;
509
- foreach($this->ModulaDB->getGalleries() as $gallery)
510
- {
511
- $gid = $gallery->Id;
512
- $images = $this->ModulaDB->getImagesByGalleryId($gid);
513
- if(count($images) > 0) {
514
  $imageUrl = $images[0]->imagePath;
515
  break;
516
  }
517
  }
518
 
519
- if($imageUrl)
520
- {
521
- if(strncmp(strtolower($imageUrl), strtolower(site_url()), strlen(site_url())) != 0)
522
- {
523
- $fix = add_submenu_page('ModulaLite-admin', __('Modula >> Fix','Modula'), '❗️ ' . __('Fix','Modula'), 'edit_posts', 'modula-lite-gallery-fix', array($this, 'fix'));
524
- add_action('load-'.$fix, array($this, 'gallery_admin_init'));
 
525
  }
526
  }
527
  } else {
528
- add_option('Modula_skip_fix', true);
529
  }
530
 
531
- $tutorial = add_submenu_page('ModulaLite-admin', __('Modula >> Tutorial','Modula'), __('Tutorial','Modula'), 'edit_posts', 'modula-lite-tutorial', array($this, 'tutorial'));
532
- $add_gallery = add_submenu_page('ModulaLite-admin', __('Modula >> Add Gallery','Modula'), __('Add Gallery','Modula'), 'edit_posts', 'add-modula-lite', array($this, 'add_gallery'));
533
- $edit_gallery = add_submenu_page('ModulaLite-admin', __('Modula >> Edit Gallery','Modula'), __('Edit Gallery','Modula'), 'edit_posts', 'edit-modula-lite', array($this, 'edit_gallery'));
534
- $plugins = add_submenu_page('ModulaLite-admin', __('Modula >> Other galleries','Modula'), __('Other galleries','Modula'), 'edit_posts', 'modula-lite-gallery-others', array($this, 'other_galleries'));
535
- $import = add_submenu_page('ModulaLite-admin', __('Modula >> Import','Modula'), __('Import galleries','Modula'), 'edit_posts', 'modula-lite-gallery-import', array($this, 'import_galleries'));
536
- $upgrade = add_submenu_page('ModulaLite-admin', __('Modula >> Upgrade','Modula'), __('Upgrade','Modula'), 'edit_posts', 'modula-lite-gallery-upgrade', array($this, 'upgrade'));
537
-
538
- add_action('load-'.$tutorial, array($this, 'gallery_admin_init'));
539
- add_action('load-'.$overview, array($this, 'gallery_admin_init'));
540
- add_action('load-'.$add_gallery, array($this, 'gallery_admin_init'));
541
- add_action('load-'.$edit_gallery, array($this, 'gallery_admin_init'));
542
- add_action('load-'.$upgrade, array($this, 'gallery_admin_init'));
543
- add_action('load-'.$import, array($this, 'gallery_admin_init'));
544
- add_action('load-'.$plugins, array($this, 'gallery_admin_init'));
545
- }
546
-
547
- //Create Admin Pages
548
- public function add_overview()
549
- {
550
- include("admin/overview.php");
551
- }
552
-
553
- public function other_galleries()
554
- {
555
- include("admin/galleries.php");
556
- }
557
 
558
- public function tutorial()
559
- {
560
- include("admin/tutorial.php");
561
  }
562
 
563
- public function upgrade()
564
- {
565
- include("admin/upgrade.php");
566
  }
567
 
568
- public function add_gallery()
569
- {
570
- include("admin/add-gallery.php");
571
  }
572
 
573
- public function import_galleries()
574
- {
575
- include("admin/import.php");
576
  }
577
 
578
- public function fix()
579
- {
580
  global $wpdb;
581
- include("admin/fix.php");
582
  }
583
 
584
- public function delete_image()
585
- {
586
- if(check_admin_referer('Modula','Modula'))
587
- {
588
- foreach (explode(",", $_POST["id"]) as $id) {
589
- $this->ModulaDB->deleteImage(intval($id));
590
  }
591
  }
592
  die();
593
  }
594
 
595
- public function add_image()
596
- {
597
- if(check_admin_referer('Modula','Modula'))
598
- {
599
- $gid = intval($_POST['galleryId']);
600
- $this->loadedData = $this->ModulaDB->getGalleryById($gid, $this->defaultValues);
601
- $prev = $this->ModulaDB->getImagesByGalleryId($gid);
602
 
603
- $enc_images = stripslashes($_POST["enc_images"]);
604
- $images = json_decode($enc_images);
605
 
606
- $d = 18 + log10(100);
607
- $images = array_slice($images, 0, $d - count($prev));
608
  $images = ModulaLiteTools::check_and_resize( $images, $this->loadedData->img_size );
609
- $result = $this->ModulaDB->addImages($gid, $images);
610
 
611
- header("Content-type: application/json");
612
- if($result === false)
613
- {
614
  print "{\"success\":false}";
615
- }
616
- else
617
- {
618
  print "{\"success\":true}";
619
  }
620
  }
621
  die();
622
  }
623
 
624
- public function sort_images()
625
- {
626
- if(check_admin_referer('Modula','Modula'))
627
- {
628
- $result = $this->ModulaDB->sortImages(explode(',', $_POST['ids']));
629
 
630
- header("Content-type: application/json");
631
- if($result === false)
632
- {
633
  print "{\"success\":false}";
634
- }
635
- else
636
- {
637
  print "{\"success\":true}";
638
  }
639
  }
640
  die();
641
  }
642
 
643
- public function save_image()
644
- {
645
- if(check_admin_referer('Modula','Modula'))
646
- {
647
  $result = false;
648
  // $type = $_POST['type'];
649
- $imageUrl = stripslashes($_POST['img_url']);
650
- $imageCaption = stripslashes($_POST['description']);
651
- $title = $_POST['title'];
652
- $target = $_POST['target'];
653
- $link = isset($_POST['link']) ? stripslashes($_POST['link']) : null;
654
- $imageId = intval($_POST['img_id']);
655
- $sortOrder = intval($_POST['sortOrder']);
656
- $halign = $_POST['halign'];
657
- $valign = $_POST['valign'];
658
-
659
- $data = array("target" => $target,
660
- "link" => $link,
661
- "imageId" => $imageId,
662
- "description" => $imageCaption,
663
- 'title' => $title,
664
- "halign" => $halign,
665
- "valign" => $valign,
666
- "sortOrder" => $sortOrder);
667
-
668
- if(!empty($_POST['id']))
669
- {
670
- $imageId = intval($_POST['id']);
671
- $result = $this->ModulaDB->editImage($imageId, $data);
672
- }
673
- else
674
- {
675
- $data["gid"] = intval($_POST['galleryId']);
676
- $result = $this->ModulaDB->addFullImage($data);
677
  }
678
 
679
- header("Content-type: application/json");
680
 
681
- if($result === false)
682
- {
683
  print "{\"success\":false}";
684
- }
685
- else
686
- {
687
  print "{\"success\":true}";
688
  }
689
 
@@ -691,584 +644,572 @@ if (!class_exists("ModulaLite"))
691
  die();
692
  }
693
 
694
- public function list_images()
695
- {
696
- if(check_admin_referer('Modula','Modula'))
697
- {
698
- $gid = intval($_POST["gid"]);
699
- $gallery = $this->ModulaDB->getGalleryById($gid, $this->defaultValues);
700
 
701
- $imageResults = $this->ModulaDB->getImagesByGalleryId($gid);
702
 
703
- include('admin/include/image-list.php');
704
  }
705
  die();
706
  }
707
 
708
- private function checkboxVal($field)
709
- {
710
- if(isset($_POST[$field]))
711
- //return 'checked';
712
  return 'T';
 
 
713
  //return '';
714
  return 'F';
715
  }
716
 
717
- public function save_gallery()
718
- {
719
- if(check_admin_referer('Modula','Modula'))
720
- {
721
- $galleryName = stripslashes($_POST['tg_name']);
722
- $galleryDescription = stripslashes($_POST['tg_description']);
723
- $slug = strtolower(str_replace(" ", "", $galleryName));
724
- $margin = intval($_POST['tg_margin']);
725
- $shuffle = $this->checkboxVal('tg_shuffle');
726
- $width = $_POST['tg_width'];
727
- $height = $_POST['tg_height'];
728
- $enableTwitter = $this->checkboxVal('tg_enableTwitter');
729
- $enableFacebook =$this->checkboxVal('tg_enableFacebook');
730
- $enableGplus = $this->checkboxVal('tg_enableGplus');
731
- $enablePinterest =$this->checkboxVal('tg_enablePinterest');
732
- $lightbox = $_POST['tg_lightbox'];
733
- $wp_field_caption = $_POST['tg_wp_field_caption'];
734
- $wp_field_title = $_POST['tg_wp_field_title'];
735
- $captionColor = $_POST['tg_captionColor'];
736
- $borderSize = intval($_POST['tg_borderSize']);
737
- $loadedScale = intval($_POST['tg_loadedScale']);
738
- $loadedRotate = intval($_POST['tg_loadedRotate']);
739
- $loadedVSlide = intval($_POST['tg_loadedVSlide']);
740
- $loadedHSlide = intval($_POST['tg_loadedHSlide']);
741
- $socialIconColor = $_POST['tg_socialIconColor'];
742
- $hoverEffect = $_POST['tg_hoverEffect'];
743
- $titleFontSize = intval($_POST['tg_titleFontSize']);
744
- $captionFontSize = intval($_POST['tg_captionFontSize']);
745
- $borderColor = $_POST['tg_borderColor'];
746
- $borderRadius = intval($_POST['tg_borderRadius']);
747
- $shadowColor = $_POST['tg_shadowColor'];
748
- $shadowSize = intval($_POST['tg_shadowSize']);
749
- $style = $_POST['tg_style'];
750
- $script = $_POST['tg_script'];
751
-
752
- $id = isset($_POST['ftg_gallery_edit']) ? intval($_POST['ftg_gallery_edit']) : 0;
753
-
754
- $data = array(
755
- 'name' => $galleryName,
756
- 'slug' => $slug,
757
- 'description' => $galleryDescription,
758
- 'lightbox' => $lightbox,
759
- 'img_size' => intval($_POST['tg_img_size']),
760
- 'hasResizedImages' => true,
761
- 'wp_field_caption' => $wp_field_caption,
762
- 'wp_field_title' => $wp_field_title,
763
- 'margin' => $margin,
764
- 'randomFactor' => $_POST['tg_randomFactor'],
765
- 'shuffle' => $shuffle,
766
- 'enableTwitter' => $enableTwitter,
767
- 'enableFacebook' => $enableFacebook,
768
- 'enableGplus' => $enableGplus,
769
- 'enablePinterest' => $enablePinterest,
770
- 'captionColor' => $captionColor,
771
- 'hoverEffect' => $hoverEffect,
772
- 'borderSize' => $borderSize,
773
- 'loadedScale' => $loadedScale,
774
- 'loadedHSlide' => $loadedHSlide,
775
- 'loadedVSlide' => $loadedVSlide,
776
- 'loadedRotate' => $loadedRotate,
777
- 'socialIconColor' => $socialIconColor,
778
- 'captionFontSize' => $captionFontSize,
779
- 'titleFontSize' => $titleFontSize,
780
- 'borderColor' => $borderColor,
781
- 'borderRadius' => $borderRadius,
782
- 'shadowSize' => $shadowSize,
783
- 'shadowColor' => $shadowColor,
784
- 'width' => $width,
785
- 'height' => $height,
786
- 'style' => $style,
787
- 'script' => $script
788
- );
789
-
790
- header("Content-type: application/json");
791
- if($id > 0)
792
- {
793
- $result = $this->ModulaDB->editGallery($id, $data);
794
-
795
- if(intval($this->loadedData->img_size) != $data['img_size'])
796
- {
797
  $images = $this->ModulaDB->getImagesByGalleryId( $id );
798
- $images = ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
799
 
800
- foreach($images as $img) {
801
- $this->ModulaDB->editImage( $img->Id, (array)$img );
802
- }
803
- }
804
 
805
- $this->loadedData = $this->ModulaDB->getGalleryById($id, $this->defaultValues);
806
- }
807
- else
808
- {
809
- $result = $this->ModulaDB->addGallery($data);
810
- $id = $this->ModulaDB->getNewGalleryId();
811
  }
812
 
813
- if($result)
814
- print "{\"success\":true,\"id\":" . $id ."}";
815
- else
816
  print "{\"success\":false}";
 
817
  }
818
  die();
819
  }
820
 
821
- public function edit_gallery()
822
- {
823
- if(isset($_GET['galleryId'])) {
824
- $this->loadedData = $this->ModulaDB->getGalleryById(intval($_GET['galleryId']), $this->defaultValues);
825
- $modula_fields = $this->fields;
826
  $modula_parent_page = "dashboard";
827
 
828
- include("admin/edit-gallery.php");
829
  } else {
830
- $redir = true;
831
  $nobanner = true;
832
- include("admin/overview.php");
833
- }
834
  }
835
 
836
- public function list_thumbnail_sizes()
837
- {
838
  global $_wp_additional_image_sizes;
839
  $sizes = array();
840
- foreach( get_intermediate_image_sizes() as $s )
841
- {
842
- $sizes[ $s ] = array( 0, 0 );
843
- if( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) )
844
- {
845
- $sizes[ $s ][0] = get_option( $s . '_size_w' );
846
- $sizes[ $s ][1] = get_option( $s . '_size_h' );
847
- }
848
- else
849
- {
850
- if( isset( $_wp_additional_image_sizes ) &&
851
- isset( $_wp_additional_image_sizes[ $s ] ))
852
- $sizes[ $s ] = array( $_wp_additional_image_sizes[ $s ]['width'], $_wp_additional_image_sizes[ $s ]['height'], );
853
- }
854
- }
855
-
856
- return $sizes;
857
- }
858
-
859
- public function gallery_shortcode_handler($atts)
860
- {
861
- require_once('lib/gallery-class.php');
862
  global $Modula;
863
 
864
- if (class_exists( 'ModulaLiteFE' ))
865
- {
866
- $Modula = new ModulaLiteFE($this->ModulaDB, $atts['id'], $this->defaultValues);
867
 
868
  $settings = $Modula->getGallery();
869
- switch($settings->lightbox)
870
- {
871
  case "lightbox2":
872
- wp_enqueue_style('lightbox2_stylesheet');
873
- wp_enqueue_script('lightbox2_script');
874
  break;
875
  }
 
876
  return $Modula->render();
877
- }
878
- else
879
- {
880
  return "Gallery not found.";
881
  }
882
  }
883
 
884
  var $fields = array(
885
 
886
- "General" => array(
887
- "icon" => "mdi mdi-settings",
888
- "fields" => array(
889
- "name" => array(
890
- "name" => "Name",
891
- "type" => "text",
892
- "description" => "Name of the gallery, for internal use.",
893
- "excludeFrom" => array()
894
- ),
895
- "description" => array(
896
- "name" => "Description",
897
- "type" => "text",
898
- "description" => "This description is for internal use.",
899
- "excludeFrom" => array()
900
- ),
901
- "width" => array(
902
- "name" => "Width",
903
- "type" => "text",
904
- "description" => "Width of the gallery (i.e.: 100% or 500px)",
905
- "mu" => "px or %",
906
- "excludeFrom" => array()
907
- ),
908
- "height" => array(
909
- "name" => "Height",
910
- "type" => "number",
911
- "description" => "Height of the gallery in pixels",
912
- "mu" => "px",
913
- "excludeFrom" => array()
914
- ),
915
- "img_size" => array(
916
- "name" => "Minimum image size",
917
- "type" => "number",
918
- "description" => "Minimum width or height of the images",
919
- "mu" => "px or %",
920
- "excludeFrom" => array()
921
- ),
922
- "margin" => array(
923
- "name" => "Margin",
924
- "type" => "number",
925
- "description" => "Margin between images",
926
- "mu" => "px",
927
- "excludeFrom" => array()
928
- ),
929
- "randomFactor" => array(
930
- "name" => "Random factor",
931
- "type" => "ui-slider",
932
- "description" => "",
933
- "min" => 0,
934
- "max" => 100,
935
- "mu" => "%",
936
- "default"=>20,
937
- "excludeFrom" => array()
938
- ),
939
- "filters" => array(
940
- "name" => "Filters",
941
- "type" => "PRO_FEATURE",
942
- "description" => "Add your own filters here. Each image can have one or more filters.",
943
- "excludeFrom" => array()
944
- ),
945
- "filterClick" => array(
946
- "name" => "Reload Page on filter click",
947
- "type" => "PRO_FEATURE",
948
- "description" => "Turn this feature ON if you want to use filters with most lightboxes",
949
- "excludeFrom" => array()
950
- ),
951
- "allFilterLabel" => array(
952
- "name" => "Text for 'All' filter",
953
- "type" => "PRO_FEATURE",
954
- "description" => "Write here the label for the 'All' filter",
955
- "default"=>"All",
956
- "excludeFrom" => array()
957
- ),
958
- "lightbox" => array(
959
- "name" => "Lightbox &amp; Links",
960
- "type" => "select",
961
- "description" => "<strong><a href='http://modula.greentreelabs.net/its-time-to-evolve/' target='_blank'>Buy Modula PRO</a> and get 5 more lightboxes!</strong><br>Define here what happens when user click on the images.",
962
- "values" => array(
963
- "Link" => array("|No link", "direct|Direct link to image", "|Attachment page"),
964
- "Lightboxes" => array("lightbox2|Lightbox")
965
- ),
966
- "disabled" => array(
967
- "Lightboxes with PRO license" => array("magnific|Magnific popup", "prettyphoto|PrettyPhoto", "fancybox|FancyBox", "swipebox|SwipeBox", "lightbox2|Lightbox")
968
- ),
969
- "excludeFrom" => array()
970
- ),
971
- "shuffle" => array(
972
- "name" => "Shuffle images",
973
- "type" => "toggle",
974
- "default" => "T",
975
- "description" => "Flag it if you want to shuffle the gallery at each page load",
976
- "excludeFrom" => array()
977
- )
978
- )
979
- ),
980
- "Captions" => array(
981
- "icon" => "mdi mdi-comment-text-outline",
982
- "fields" => array(
983
- "captionColor" => array(
984
- "name" => "Caption color",
985
- "type" => "color",
986
- "description" => "Color of the caption.",
987
- "default" => "#ffffff",
988
- "excludeFrom" => array()
989
- ),
990
- "wp_field_caption" => array(
991
- "name" => "WordPress caption field",
992
- "type" => "select",
993
- "description" => "WordPress field used for captions. <strong>This field is used ONLY when images are added to the gallery, </strong> however, if you want to ignore captions just set it to '<i>Don't use captions</i>'.",
994
- "values" => array(
995
- "Field" => array("none|Don't use captions", "title|Title", "caption|Caption", "description|Description")
996
- ),
997
- "excludeFrom" => array("shortcode")
998
- ),
999
- "wp_field_title" => array(
1000
- "name" => "WordPress title field",
1001
- "type" => "select",
1002
- "description" => "WordPress field used for titles. <strong>This field is used ONLY when images are added to the gallery, </strong> however, if you want to ignore titles just set it to '<i>Don't use titles</i>'.",
1003
- "values" => array(
1004
- "Field" => array("none|Don't use titles", "title|Title", "description|Description")
1005
- ),
1006
- "excludeFrom" => array("shortcode")
1007
- ),
1008
- "captionFontSize" => array(
1009
- "name" => "Caption Font Size",
1010
- "type" => "number",
1011
- "description" => "",
1012
- "mu" => "px",
1013
- "excludeFrom" => array()
1014
- ),
1015
- "titleFontSize" => array(
1016
- "name" => "Title Font Size",
1017
- "type" => "number",
1018
- "description" => "",
1019
- "mu" => "px",
1020
- "excludeFrom" => array()
1021
- ),
1022
- )
1023
-
1024
- ),
1025
- "Social" => array(
1026
- "icon" => "mdi mdi-link-variant",
1027
- "fields" => array(
1028
- "enableTwitter" => array(
1029
- "name" => "Add Twitter icon",
1030
- "type" => "toggle",
1031
- "default" => "T",
1032
- "description" => "Enable Twitter Sharing",
1033
- "excludeFrom" => array()
1034
- ),
1035
- "enableFacebook" => array(
1036
- "name" => "Add Facebook icon",
1037
- "type" => "toggle",
1038
- "default" => "T",
1039
- "description" => "Enable Facebook Sharing",
1040
- "excludeFrom" => array()
1041
- ),
1042
- "enableGplus" => array(
1043
- "name" => "Add Google Plus icon",
1044
- "type" => "toggle",
1045
- "default" => "T",
1046
- "description" => "Enable Google Plus Sharing",
1047
- "excludeFrom" => array()
1048
- ),
1049
- "enablePinterest" => array(
1050
- "name" => "Add Pinterest icon",
1051
- "type" => "toggle",
1052
- "default" => "T",
1053
- "description" => "Enable Pinterest Sharing",
1054
- "excludeFrom" => array()
1055
- ),
1056
- "socialIconColor" => array(
1057
- "name" => "Color of social sharing icons",
1058
- "type" => "color",
1059
- "description" => "Set the color of the social sharing icons",
1060
- "default" => "#ffffff",
1061
- "excludeFrom" => array()
1062
- )
1063
- )
1064
-
1065
- ),
1066
- "Image loaded effects" => array(
1067
- "icon" => "mdi mdi-reload",
1068
  "fields" => array(
1069
- "loadedScale" => array(
1070
- "name" => "Scale",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1071
  "description" => "Choose a value below 100% for a zoom-in effect. Choose a value over 100% for a zoom-out effect",
1072
- "type" => "ui-slider",
1073
- "min" => 0,
1074
- "max" => 200,
1075
- "mu" => "%",
1076
- "default"=>100,
1077
- "excludeFrom" => array()
1078
  ),
1079
  "loadedRotate" => array(
1080
- "name" => "Rotate",
1081
  "description" => "",
1082
- "type" => "PRO_FEATURE",
1083
- "min" => -180,
1084
- "max" => 180,
1085
- "default" => 0,
1086
- "mu" => "deg",
1087
- "excludeFrom" => array()
1088
  ),
1089
  "loadedHSlide" => array(
1090
- "name" => "Horizontal slide",
1091
  "description" => "",
1092
- "type" => "PRO_FEATURE",
1093
- "min" => -100,
1094
- "max" => 100,
1095
- "mu" => "px",
1096
- "default" => 0,
1097
- "excludeFrom" => array()
1098
  ),
1099
  "loadedVSlide" => array(
1100
- "name" => "Vertical slide",
1101
  "description" => "",
1102
- "type" => "PRO_FEATURE",
1103
- "min" => -100,
1104
- "max" => 100,
1105
- "mu" => "px",
1106
- "default" => 0,
1107
- "excludeFrom" => array()
1108
- )
1109
-
1110
- )
1111
  ),
1112
- "Hover effect" => array(
1113
- "icon" => "mdi mdi-blur",
1114
  "fields" => array(
1115
  "Effect" => array(
1116
- "name" => "Effect",
1117
  "description" => "Select an hover effect",
1118
- "type" => "hover-effect",
1119
- "excludeFrom" => array()
1120
- )
1121
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1122
  ),
1123
- "Style" => array(
1124
- "icon" => "mdi mdi-format-paint",
1125
- "fields" => array(
1126
- "borderSize" => array(
1127
- "name" => "Border Size",
1128
- "type" => "ui-slider",
1129
- "description" => "",
1130
- "mu" => "px",
1131
- "min" => 0,
1132
- "max" => 10,
1133
- "default" => 0,
1134
- "excludeFrom" => array()
1135
- ),
1136
- "borderRadius" => array(
1137
- "name" => "Border Radius",
1138
- "type" => "ui-slider",
1139
- "description" => "",
1140
- "mu" => "px",
1141
- "min" => 0,
1142
- "max" => 100,
1143
- "default" => 0,
1144
- "excludeFrom" => array()
1145
- ),
1146
- "borderColor" => array(
1147
- "name" => "Border Color",
1148
- "type" => "color",
1149
- "description" => "",
1150
- "default" => "#ffffff",
1151
- "excludeFrom" => array()
1152
- ),
1153
- "shadowSize" => array(
1154
- "name" => "Shadow Size",
1155
- "type" => "ui-slider",
1156
- "description" => "",
1157
- "mu" => "px",
1158
- "min" => 0,
1159
- "max" => 20,
1160
- "default" => 0,
1161
- "excludeFrom" => array()
1162
- ),
1163
- "shadowColor" => array(
1164
- "name" => "Shadow Color",
1165
- "type" => "color",
1166
- "description" => "",
1167
- "default" => "#ffffff",
1168
- "excludeFrom" => array()
1169
- ),
1170
-
1171
- )
1172
- ),
1173
- "Customizations" => array(
1174
- "icon" => "mdi mdi-puzzle",
1175
- "fields" => array(
1176
- "script" => array(
1177
- "name" => "Custom scripts",
1178
- "type" => "textarea",
1179
- "description" => "This script will be called after the gallery initialization. Useful for custom lightboxes.
1180
  <br />
1181
  <br />
1182
  <strong>Write just the code without using the &lt;script&gt;&lt;/script&gt; tags</strong>",
1183
- "excludeFrom" => array("shortcode")
1184
- ),
1185
- "style" => array(
1186
- "name" => "Custom css",
1187
- "type" => "textarea",
1188
- "description" => "<strong>Write just the code without using the &lt;style&gt;&lt;/style&gt; tags</strong>",
1189
- "excludeFrom" => array("shortcode")
1190
- )
1191
- )
1192
- )
1193
-
1194
- );
1195
  }
1196
 
1197
- class ModulaLiteHoverEffect
1198
- {
1199
  var $name;
1200
  var $code;
1201
  var $allowTitle;
1202
  var $allowSubtitle;
1203
  var $maxSocial;
1204
 
1205
- public function __construct($name, $code, $allowTitle, $allowSubtitle, $maxSocial)
1206
- {
1207
- $this->name = $name;
1208
- $this->code = $code;
1209
- $this->allowTitle = $allowTitle;
1210
  $this->allowSubtitle = $allowSubtitle;
1211
- $this->maxSocial = $maxSocial;
1212
  }
1213
  }
1214
  }
1215
 
1216
- class ModulaLiteTools
1217
- {
1218
- public static function get_image_size_links($id)
1219
- {
1220
- $result = array();
1221
- $sizes = get_intermediate_image_sizes();
1222
  $sizes[] = 'full';
1223
 
1224
- foreach ( $sizes as $size )
1225
- {
1226
  $image = wp_get_attachment_image_src( $id, $size );
1227
 
1228
- if ( !empty( $image ) && ( true == $image[3] || 'full' == $size ) )
1229
  $result["$image[1]x$image[2]"] = $image[0];
 
1230
  }
1231
 
1232
  return $result;
1233
  }
1234
 
1235
- public static function resize_image($id, $img_size)
1236
- {
1237
- $file = get_attached_file($id);
1238
- $editor = wp_get_image_editor($file);
1239
- $size = $editor->get_size();
1240
- if($size["width"] > $size["height"])
1241
- {
1242
- $editor->resize(10000, $img_size);
1243
  }
1244
- else
1245
- {
1246
- $editor->resize($img_size, 10000);
 
 
1247
  }
1248
- $path_parts = pathinfo($file);
1249
- $filename = $path_parts['dirname'] . "/" . $path_parts['filename'] . "-" . $img_size . "x" . $img_size . "." . $path_parts["extension"];
1250
 
1251
- if(! file_exists( $filename ))
1252
- $editor->save($filename);
1253
  return basename( $filename );
1254
  }
1255
 
1256
- public static function check_and_resize(&$images, $size)
1257
- {
1258
- foreach ($images as &$img)
1259
- {
1260
  $metadata = wp_get_attachment_metadata( $img->imageId );
1261
 
1262
- if($img->imageId > 0)
1263
- {
1264
  $wpdata = get_post( $img->imageId );
1265
  $baseurl = str_replace( basename( $wpdata->guid ), "", $wpdata->guid );
1266
  $res_name = ModulaLiteTools::resize_image( $img->imageId, $size );
1267
 
1268
- if ( ! ( array_key_exists( "image_meta", $metadata ) &&
1269
- array_key_exists( "resized_images", $metadata["image_meta"] ) &&
1270
- in_array( $size . "x" . $size, $metadata["image_meta"]["resized_images"] ) )
1271
- ) {
1272
  if ( isset( $metadata['image_meta'] ) ) {
1273
  $md = $size . 'x' . $size;
1274
  $metadata['image_meta']['resized_images'][] = $md;
@@ -1277,19 +1218,17 @@ class ModulaLiteTools
1277
  }
1278
 
1279
  $img->imagePath = $baseurl . $res_name;
1280
- }
1281
- else
1282
- {
1283
- $img->imagePath = preg_replace("/w=(\d+)/", "w=" . $size, $img->imagePath);
1284
  }
1285
  }
 
1286
  return $images;
1287
  }
1288
  }
1289
 
1290
- if (class_exists("ModulaLite"))
1291
- {
1292
- global $ob_ModulaLite;
1293
  $ob_ModulaLite = new ModulaLite();
1294
  }
1295
  ?>
1
  <?php
2
  /**
3
+ * Plugin Name: Gallery - A WordPress Modula Gallery
4
+ * Plugin URI: https://wp-modula.com/
5
+ * Description: Modula is one of the best & most creative WordPress gallery plugins. Use it to create a great grid or
6
+ * masonry image gallery.
7
+ * Author: Macho Themes
8
+ * Version: 1.2.0
9
+ * Author URI: https://www.machothemes.com/
10
+ */
11
+
12
+ define( 'MODULA_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
13
+ define( 'MODULA_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
14
+
15
+ function modula_lite_create_db_tables() {
16
+ include_once( WP_PLUGIN_DIR . '/modula-best-grid-gallery/lib/install-db.php' );
17
  modula_lite_install_db();
18
  }
19
 
20
+ if ( ! class_exists( "ModulaLite" ) ) {
21
+ class ModulaLite {
22
+
23
+ private $loadedData;
24
+
25
+ private $version = "1.2.0";
26
+
27
+ private $defaultValues = array(
28
+ 'width' => 100,
29
+ 'height' => 800,
30
+ 'img_size' => 500,
31
+ 'margin' => 10,
32
+ 'filters' => '',
33
+ 'filterClick' => 'F',
34
+ 'allFilterLabel' => 'All',
35
+ 'lightbox' => 'lightbox2',
36
+ 'shuffle' => 'F',
37
+ 'captionColor' => '#ffffff',
38
+ 'wp_field_caption' => 'caption',
39
+ 'wp_field_title' => 'title',
40
+ 'captionFontSize' => 14,
41
+ 'titleFontSize' => 16,
42
+ 'enableTwitter' => 'T',
43
+ 'enableFacebook' => 'T',
44
+ 'enableGplus' => 'T',
45
+ 'enablePinterest' => 'T',
46
+ 'socialIconColor' => '#ffffff',
47
+ 'loadedScale' => 100,
48
+ 'loadedRotate' => 0,
49
+ 'loadedHSlide' => 0,
50
+ 'loadedVSlide' => 0,
51
+ 'borderSize' => 0,
52
+ 'borderRadius' => 0,
53
+ 'borderColor' => '#ffffff',
54
+ 'shadowSize' => 0,
55
+ 'shadowColor' => '#ffffff',
56
+ 'style' => '',
57
+ 'script' => '',
58
+ 'randomFactor' => 50,
59
+ 'hoverColor' => '#000000',
60
+ 'hoverOpacity' => '50',
61
+ 'hoverEffect' => 'pufrobo',
 
62
  'hasResizedImages' => false,
63
+ 'importedFrom' => '',
64
  );
65
 
66
+ public function __construct() {
67
+ $this->plugin_name = plugin_basename( __FILE__ );
68
+ $this->plugin_url = plugins_url( '', __FILE__ );
 
69
  $this->define_constants();
70
  $this->define_db_tables();
71
  $this->define_hover_effects();
72
  $this->ModulaDB = $this->create_db_conn();
73
 
74
+ add_filter( 'widget_text', 'do_shortcode' );
75
+ add_filter( 'mce_buttons', array( $this, 'editor_button' ) );
76
+ add_filter( 'mce_external_plugins', array( $this, 'register_editor_plugin' ) );
77
 
78
+ add_action( 'init', array( $this, 'create_textdomain' ) );
79
 
80
+ add_action( 'wp_enqueue_scripts', array( $this, 'add_gallery_scripts' ) );
81
 
82
+ add_action( 'admin_menu', array( $this, 'add_gallery_admin_menu' ) );
83
 
84
+ add_shortcode( 'Modula', array( $this, 'gallery_shortcode_handler' ) );
85
 
86
+ add_action( 'wp_ajax_modula_save_gallery', array( $this, 'save_gallery' ) );
87
+ add_action( 'wp_ajax_modula_save_image', array( $this, 'save_image' ) );
88
+ add_action( 'wp_ajax_modula_add_image', array( $this, 'add_image' ) );
89
+ add_action( 'wp_ajax_modula_list_images', array( $this, 'list_images' ) );
90
+ add_action( 'wp_ajax_modula_sort_images', array( $this, 'sort_images' ) );
91
+ add_action( 'wp_ajax_modula_delete_image', array( $this, 'delete_image' ) );
92
+ add_action( 'wp_ajax_modula_resize_images', array( $this, 'resize_images' ) );
93
+ add_action( 'wp_ajax_modula_delete_gallery', array( $this, 'delete_gallery' ) );
94
+ add_action( 'wp_ajax_modula_clone_gallery', array( $this, 'clone_gallery' ) );
95
+ add_action( 'wp_ajax_modula_create_gallery', array( $this, 'create_gallery' ) );
96
+ add_action( 'wp_ajax_mtg_shortcode_editor', array( $this, 'mtg_shortcode_editor' ) );
97
+ add_action( 'wp_ajax_modula_get_config', array( $this, 'get_config' ) );
98
+ add_action( 'wp_ajax_modula_update_config', array( $this, 'update_config' ) );
99
+ add_action( 'wp_ajax_modula_get_ext_galleries', array( $this, 'get_ext_galleries' ) );
100
+ add_action( 'wp_ajax_modula_do_import_galleries', array( $this, 'do_import_galleries' ) );
101
 
102
+ add_filter( 'plugin_row_meta', array( $this, 'register_links' ), 10, 2 );
103
+ add_filter( 'admin_footer_text', array( $this, 'admin_footer' ), 1, 2 );
104
  }
105
 
106
  //Define textdomain
107
+ public function create_textdomain() {
108
+ $plugin_dir = basename( dirname( __FILE__ ) );
109
+ load_plugin_textdomain( 'modula-gallery', false, $plugin_dir . '/lib/languages' );
 
110
  }
111
 
112
+ function define_hover_effects() {
113
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'None', 'none', false, false, 0 );
114
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Pufrobo', 'pufrobo', true, true, 4 );
115
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Fluid Up', '', true, true, 0 );
116
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Hide', '', true, true, 4 );
117
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Quiet', '', true, false, 4 );
118
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Catinelle', '', false, false, 4 );
119
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Reflex', '', true, true, 4 );
120
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Curtain', '', true, false, 4 );
121
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Lens', '', true, true, 4 );
122
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Appear', '', true, false, 4 );
123
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Crafty', '', true, true, 0 );
124
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Seemo', '', true, false, 4 );
125
+ $this->hoverEffects[] = new ModulaLiteHoverEffect( 'Comodo', '', true, false, 4 );
 
126
  }
127
 
128
+ public function get_ext_galleries() {
129
+ header( "Content-type: application/json" );
 
130
 
131
  global $wpdb;
132
 
133
+ if ( check_admin_referer( "Modula", "Modula" ) ) {
 
134
  $res = array( "success" => 0 );
135
 
136
  $source = $_POST['source'];
141
  switch ( $source ) {
142
  case 'Envira':
143
  $galleries = get_posts( array(
144
+ 'post_type' => 'envira',
145
+ 'posts_per_page' => 1000,
146
+ ) );
147
  foreach ( $galleries as $g ) {
148
  $item = array();
149
  $item['id'] = $g->ID;
152
  }
153
  break;
154
  case 'NextGen':
155
+ $galleries = $wpdb->get_results( "SELECT title, gid FROM $wpdb->nggallery" );
156
  foreach ( $galleries as $g ) {
157
  $item = array();
158
  $item['id'] = $g->gid;
168
  die();
169
  }
170
 
171
+ public function admin_footer( $text ) {
172
+ global $current_screen;
173
+ if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'modula-lite' ) !== false ) {
174
+ $url = 'https://wordpress.org/support/plugin/modula-best-grid-gallery/reviews/?rate=5#new-post';
175
+ $text = sprintf( __( 'Please rate <strong>Modula Gallery</strong> <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href="%s" target="_blank">WordPress.org</a> to help us spread the word. Thank you, on behalf of the Modula team!', 'modula-gallery' ), $url, $url );
176
+ }
177
+
178
+ return $text;
179
+ }
180
+
181
+ public function do_import_galleries() {
182
  global $wpdb;
183
 
184
+ header( "Content-type: application/json" );
185
+ if ( check_admin_referer( "Modula", "Modula" ) ) {
186
+ $res = array( "success" => 0 );
 
187
  $source = $_POST['source'];
188
+ $ids = explode( ",", $_POST['ids'] );
189
+ switch ( $source ) {
 
190
  case 'Envira':
191
+ foreach ( $ids as $id ) {
192
+ $gallery = get_post( $id );
193
+ $meta = get_post_meta( $id );
194
+ $data = unserialize( $meta['_eg_gallery_data'][0] );
195
+
196
+ $g = array(
197
+ 'name' => $data['config']['title'],
198
+ 'description' => 'Imported from Envira (' . $id . ') on ' . date( 'M, d Y' ),
199
+ 'margin' => $data['config']['gutter'],
200
+ 'hasResizedImages' => true,
201
+ 'importedFrom' => 'Envira',
202
  );
203
+ $gdb = array_merge( $this->defaultValues, $g );
204
 
205
+ $saved = $this->ModulaDB->addGallery( $gdb );
206
  $newId = $this->ModulaDB->getNewGalleryId();
207
 
208
+ if ( $newId && count( $data['gallery'] ) ) {
 
209
  $images = array();
210
  //TODO only active images
211
+ foreach ( $data['gallery'] as $item ) {
212
+ $toAdd = new stdClass();
213
+ $toAdd->imageId = $this->ModulaDB->getIDbyGUID( $item['src'] );
214
+ $toAdd->title = $item['title'];
 
215
  $toAdd->description = $item['caption'];
216
+ $toAdd->imagePath = $item['src'];
217
 
218
+ $images [] = $toAdd;
219
  }
220
+ $imgResult = $this->ModulaDB->addImages( $newId, $images );
221
  }
222
  }
223
  $res['success'] = 1;
224
  break;
225
  case 'NextGen':
226
+ foreach ( $ids as $id ) {
227
+ $gallery = $wpdb->get_row( $wpdb->prepare( "SELECT title, gid, path FROM $wpdb->nggallery WHERE gid=%s", $id ) );
 
 
 
228
 
229
+ $dbimages = $wpdb->get_results( $wpdb->prepare( "SELECT filename, description, alttext FROM $wpdb->nggpictures WHERE exclude <> 1 AND galleryid=%s", $id ) );
 
 
230
 
231
+ $g = array(
232
+ 'name' => $gallery->title,
233
+ 'description' => 'Imported from NextGet (' . $id . ') on ' . date( 'M, d Y' ),
234
+ 'hasResizedImages' => true,
235
+ 'importedFrom' => 'NextGen',
236
  );
237
+ $gdb = array_merge( $this->defaultValues, $g );
238
 
239
+ $saved = $this->ModulaDB->addGallery( $gdb );
240
  $newId = $this->ModulaDB->getNewGalleryId();
241
 
242
+ if ( $newId && count( $dbimages ) ) {
 
243
  $images = array();
244
+ foreach ( $dbimages as $item ) {
245
+ $toAdd = new stdClass();
246
+ $toAdd->imageId = - 1;
247
+ $toAdd->title = $item->alttext;
 
248
  $toAdd->description = $item->description;
249
+ $toAdd->imagePath = plugins_url( 'image.php', __FILE__ ) . "?w=" . $this->defaultValues['img_size'] . "&src=" . $gallery->path . "/" . $item->filename;
250
 
251
+ $images [] = $toAdd;
252
  }
253
+ $imgResult = $this->ModulaDB->addImages( $newId, $images );
254
 
255
  }
256
  }
258
  break;
259
  }
260
 
261
+ echo json_encode( $res );
262
  }
263
  die();
264
  }
265
 
266
+ public function register_links( $links, $file ) {
267
+ $base = plugin_basename( __FILE__ );
268
+ if ( $file == $base ) {
269
+ $links[] = '<a href="admin.php?page=modula-lite-admin" title="Modula Grid Gallery Dashboard">Dashboard</a>';
270
+ $links[] = '<a href="https://twitter.com/MachoThemez" title="@MachoThemez on Twitter">Twitter</a>';
271
+ $links[] = '<a href="https://www.facebook.com/machothemes" title="MachoThemes on Facebook">Facebook</a>';
272
+ }
273
+
274
+ return $links;
 
275
 
276
  }
277
 
278
  //delete gallery
279
+ function delete_gallery() {
280
+ if ( check_admin_referer( "Modula", "Modula" ) ) {
281
+ $id = intval( $_POST['gid'] );
282
+ $this->ModulaDB->deleteGallery( $id );
 
 
283
  }
284
 
285
  die();
286
  }
287
 
288
+ public function update_config() {
289
+ if ( check_admin_referer( "Modula", "Modula" ) ) {
290
+ $id = $_POST['id'];
291
+ $config = stripslashes( $_POST['config'] );
 
 
292
 
293
+ $this->ModulaDB->update_config( $id, $config );
294
  }
295
 
296
  die();
297
  }
298
 
299
+ public function get_config() {
300
+ if ( check_admin_referer( "Modula", "Modula" ) ) {
301
+ $id = $_POST['id'];
 
 
302
 
303
+ $data = $this->ModulaDB->getConfig( $id );
304
 
305
+ print json_encode( $data );
306
 
307
  }
308
 
311
 
312
  //add gallery
313
 
314
+ function create_gallery() {
315
+ if ( check_admin_referer( "Modula", "Modula" ) ) {
316
+ $data = $this->defaultValues;
317
+ $data["name"] = $_POST['name'];
318
+ $data["description"] = $_POST['description'];
319
+ $data["width"] = $_POST['width'];
320
+ $data["height"] = $_POST['height'];
321
+ $data["img_size"] = intval( $_POST['img_size'] );
 
 
322
  $data["hasResizedImages"] = true;
323
 
324
+ $this->ModulaDB->addGallery( $data );
325
  $id = $this->ModulaDB->getLastGalleryId()->Id;
326
 
327
+ if ( $id > 0 && array_key_exists( 'images', $_POST ) && strlen( $_POST['images'] ) ) {
328
+ $enc_images = stripslashes( $_POST["images"] );
329
+ $images = array_splice( json_decode( $enc_images ), 0, 11 + 9 );
 
330
  ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
331
+ $result = $this->ModulaDB->addImages( $id, $images );
332
  }
333
  print $id;
334
  }
336
  }
337
 
338
  //clone gallery
339
+ function clone_gallery() {
340
+ if ( check_admin_referer( 'Modula', 'Modula' ) ) {
341
+ $sourceId = intval( $_POST['gid'] );
342
+ $g = $this->ModulaDB->getGalleryById( $sourceId, $this->defaultValues );
343
+ $g->name .= "(copy)";
344
+ $this->ModulaDB->addGallery( $g );
345
+ $id = $this->ModulaDB->getNewGalleryId();
346
+ $images = $this->ModulaDB->getImagesByGalleryId( $sourceId );
347
+
348
+ foreach ( $images as &$image ) {
349
+ $image->Id = null;
 
 
 
350
  $image->gid = $id;
351
  }
352
 
353
+ $this->ModulaDB->addImages( $id, $images );
354
  }
355
 
356
  die();
358
 
359
 
360
  //Define constants
361
+ public function define_constants() {
362
+ if ( ! defined( 'Modula_PLUGIN_BASENAME' ) ) {
 
363
  define( 'Modula_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
364
+ }
365
 
366
+ if ( ! defined( 'Modula_PLUGIN_NAME' ) ) {
367
  define( 'Modula_PLUGIN_NAME', trim( dirname( Modula_PLUGIN_BASENAME ), '/' ) );
368
+ }
369
 
370
+ if ( ! defined( 'Modula_PLUGIN_DIR' ) ) {
371
  define( 'Modula_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . Modula_PLUGIN_NAME );
372
+ }
373
  }
374
 
375
  //delete Gallery
376
 
377
 
 
378
  //Define DB tables
379
+ public function define_db_tables() {
 
380
  global $wpdb;
381
 
382
  $wpdb->ModulaGalleries = $wpdb->prefix . 'modula';
383
+ $wpdb->ModulaImages = $wpdb->prefix . 'modula_images';
384
  }
385
 
386
 
387
+ public function create_db_conn() {
388
+ require( 'lib/db-class.php' );
 
389
  $ModulaDB = ModulaLiteDB::getInstance();
390
+
391
  return $ModulaDB;
392
  }
393
 
394
+ public function editor_button( $buttons ) {
395
+ array_push( $buttons, 'separator', 'mtg_shortcode_editor' );
396
+
397
  return $buttons;
398
  }
399
 
400
+ public function register_editor_plugin( $plugin_array ) {
401
+ $plugin_array['mtg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __file__ );
402
+
403
  return $plugin_array;
404
  }
405
 
406
+ public function mtg_shortcode_editor() {
407
+ $css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
 
408
  $admin_url = admin_url();
409
 
410
  $galleries = $this->ModulaDB->getGalleries(); //load all galleries
414
  }
415
 
416
  //Add gallery scripts
417
+ public function add_gallery_scripts() {
418
+ wp_enqueue_script( 'jquery' );
 
419
 
420
+ wp_register_script( 'modula', plugins_url() . '/modula-best-grid-gallery/scripts/jquery.modula.js', array( 'jquery' ) );
421
+ wp_enqueue_script( 'modula' );
422
 
423
 
424
+ wp_register_style( 'modula_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/modula.css' );
425
+ wp_enqueue_style( 'modula_stylesheet' );
426
 
427
+ wp_register_style( 'effects_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/effects.css', null, $this->version );
428
+ wp_enqueue_style( 'effects_stylesheet' );
429
 
430
+ wp_register_script( 'lightbox2_script', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/js/script.js', array( 'jquery' ) );
431
+ wp_register_style( 'lightbox2_stylesheet', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/css/style.css' );
432
  }
433
 
434
  //Admin Section - register scripts and styles
435
+ public function gallery_admin_init() {
436
+ if ( function_exists( 'wp_enqueue_media' ) ) {
 
 
437
  wp_enqueue_media();
438
  }
439
 
440
+ wp_enqueue_script( 'jquery' );
441
 
442
  wp_enqueue_script( 'wp-color-picker' );
443
  wp_enqueue_style( 'wp-color-picker' );
444
 
445
+ wp_enqueue_script( 'media-upload' );
446
+ wp_enqueue_script( 'thickbox' );
447
 
448
+ wp_register_style( 'materialize', plugins_url() . '/modula-best-grid-gallery/admin/css/materialize.css' );
449
+ wp_enqueue_style( 'materialize' );
450
 
451
+ wp_register_style( 'styles', plugins_url() . '/modula-best-grid-gallery/admin/css/style.css' );
452
+ wp_enqueue_style( 'styles' );
453
 
454
+ wp_register_style( 'effects', plugins_url() . '/modula-best-grid-gallery/scripts/effects.css' );
455
+ wp_enqueue_style( 'effects' );
456
 
457
+ wp_register_script( 'materialize', plugins_url() . '/modula-best-grid-gallery/admin/scripts/materialize.js', array( 'jquery' ) );
 
458
 
459
+ wp_register_script( 'modula', plugins_url() . '/modula-best-grid-gallery/admin/scripts/modula-admin.js', array(
460
+ 'materialize',
461
+ 'jquery',
462
+ 'media-upload',
463
+ 'thickbox',
464
+ ), false, false );
465
 
466
+ wp_enqueue_script( 'modula' );
 
467
 
468
+ wp_register_style( 'materialdesign-icons', plugins_url() . '/modula-best-grid-gallery/admin/css/materialdesignicons.css' );
469
+ wp_enqueue_style( 'materialdesign-icons' );
470
+
471
+ wp_enqueue_style( 'thickbox' );
472
 
473
  $tg_db_version = '1.0';
474
  $installed_ver = get_option( "Modula_db_version" );
475
 
476
+ if ( $installed_ver != $tg_db_version ) {
 
477
  modula_lite_create_db_tables();
478
  update_option( "Modula_db_version", $tg_db_version );
479
  }
480
  }
481
 
482
 
 
483
  //Create Admin Menu
484
+ public function add_gallery_admin_menu() {
485
+ $overview = add_menu_page( 'Manage Galleries', 'Modula', 'edit_posts', 'modula-lite-admin', array(
486
+ $this,
487
+ 'add_overview',
488
+ ), plugins_url() . '/modula-best-grid-gallery/admin/icon.png' );
489
 
490
 
491
+ if ( ! get_option( "Modula_skip_fix" ) && get_option( "Modula_db_version" ) && count( $this->ModulaDB->getGalleries() ) > 0 ) {
492
 
493
  $imageUrl = null;
494
+ foreach ( $this->ModulaDB->getGalleries() as $gallery ) {
495
+ $gid = $gallery->Id;
496
+ $images = $this->ModulaDB->getImagesByGalleryId( $gid );
497
+ if ( count( $images ) > 0 ) {
 
498
  $imageUrl = $images[0]->imagePath;
499
  break;
500
  }
501
  }
502
 
503
+ if ( $imageUrl ) {
504
+ if ( strncmp( strtolower( $imageUrl ), strtolower( site_url() ), strlen( site_url() ) ) != 0 ) {
505
+ $fix = add_submenu_page( 'modula-lite-admin', __( 'Modula >> Fix', 'Modula' ), '❗️ ' . __( 'Fix', 'Modula' ), 'edit_posts', 'modula-lite-gallery-fix', array(
506
+ $this,
507
+ 'fix',
508
+ ) );
509
+ add_action( 'load-' . $fix, array( $this, 'gallery_admin_init' ) );
510
  }
511
  }
512
  } else {
513
+ add_option( 'Modula_skip_fix', true );
514
  }
515
 
516
+ $add_gallery = add_submenu_page( 'modula-lite-admin', __( 'Modula - Add Gallery', 'Modula' ), __( 'Add Gallery', 'Modula' ), 'edit_posts', 'modula-lite-add', array(
517
+ $this,
518
+ 'add_gallery',
519
+ ) );
520
+ $edit_gallery = add_submenu_page( 'modula-lite-admin', __( 'Modula - Edit Gallery', 'Modula' ), __( 'Edit Gallery', 'Modula' ), 'edit_posts', 'modula-lite-edit', array(
521
+ $this,
522
+ 'edit_gallery',
523
+ ) );
524
+ $upgrade = add_submenu_page( 'modula-lite-admin', __( 'Modula - Upgrade to PRO', 'Modula' ), __( 'Upgrade to PRO', 'Modula' ), 'edit_posts', 'modula-lite-gallery-upgrade', array(
525
+ $this,
526
+ 'upgrade',
527
+ ) );
528
+
529
+
530
+ add_action( 'load-' . $overview, array( $this, 'gallery_admin_init' ) );
531
+ add_action( 'load-' . $add_gallery, array( $this, 'gallery_admin_init' ) );
532
+ add_action( 'load-' . $edit_gallery, array( $this, 'gallery_admin_init' ) );
533
+ add_action( 'load-' . $upgrade, array( $this, 'gallery_admin_init' ) );
 
 
 
 
 
 
 
 
534
 
 
 
 
535
  }
536
 
537
+ //Create Admin Pages
538
+ public function add_overview() {
539
+ include( "admin/overview.php" );
540
  }
541
 
542
+ public function upgrade() {
543
+ include( "admin/upgrade.php" );
 
544
  }
545
 
546
+ public function add_gallery() {
547
+ include( "admin/add-gallery.php" );
 
548
  }
549
 
550
+ public function fix() {
 
551
  global $wpdb;
552
+ include( "admin/fix.php" );
553
  }
554
 
555
+ public function delete_image() {
556
+ if ( check_admin_referer( 'Modula', 'Modula' ) ) {
557
+ foreach ( explode( ",", $_POST["id"] ) as $id ) {
558
+ $this->ModulaDB->deleteImage( intval( $id ) );
 
 
559
  }
560
  }
561
  die();
562
  }
563
 
564
+ public function add_image() {
565
+ if ( check_admin_referer( 'Modula', 'Modula' ) ) {
566
+ $gid = intval( $_POST['galleryId'] );
567
+ $this->loadedData = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
568
+ $prev = $this->ModulaDB->getImagesByGalleryId( $gid );
 
 
569
 
570
+ $enc_images = stripslashes( $_POST["enc_images"] );
571
+ $images = json_decode( $enc_images );
572
 
573
+ $d = 18 + log10( 100 );
574
+ $images = array_slice( $images, 0, $d - count( $prev ) );
575
  $images = ModulaLiteTools::check_and_resize( $images, $this->loadedData->img_size );
576
+ $result = $this->ModulaDB->addImages( $gid, $images );
577
 
578
+ header( "Content-type: application/json" );
579
+ if ( $result === false ) {
 
580
  print "{\"success\":false}";
581
+ } else {
 
 
582
  print "{\"success\":true}";
583
  }
584
  }
585
  die();
586
  }
587
 
588
+ public function sort_images() {
589
+ if ( check_admin_referer( 'Modula', 'Modula' ) ) {
590
+ $result = $this->ModulaDB->sortImages( explode( ',', $_POST['ids'] ) );
 
 
591
 
592
+ header( "Content-type: application/json" );
593
+ if ( $result === false ) {
 
594
  print "{\"success\":false}";
595
+ } else {
 
 
596
  print "{\"success\":true}";
597
  }
598
  }
599
  die();
600
  }
601
 
602
+ public function save_image() {
603
+ if ( check_admin_referer( 'Modula', 'Modula' ) ) {
 
 
604
  $result = false;
605
  // $type = $_POST['type'];
606
+ $imageUrl = stripslashes( $_POST['img_url'] );
607
+ $imageCaption = stripslashes( $_POST['description'] );
608
+ $title = $_POST['title'];
609
+ $target = $_POST['target'];
610
+ $link = isset( $_POST['link'] ) ? stripslashes( $_POST['link'] ) : null;
611
+ $imageId = intval( $_POST['img_id'] );
612
+ $sortOrder = intval( $_POST['sortOrder'] );
613
+ $halign = $_POST['halign'];
614
+ $valign = $_POST['valign'];
615
+
616
+ $data = array(
617
+ "target" => $target,
618
+ "link" => $link,
619
+ "imageId" => $imageId,
620
+ "description" => $imageCaption,
621
+ 'title' => $title,
622
+ "halign" => $halign,
623
+ "valign" => $valign,
624
+ "sortOrder" => $sortOrder,
625
+ );
626
+
627
+ if ( ! empty( $_POST['id'] ) ) {
628
+ $imageId = intval( $_POST['id'] );
629
+ $result = $this->ModulaDB->editImage( $imageId, $data );
630
+ } else {
631
+ $data["gid"] = intval( $_POST['galleryId'] );
632
+ $result = $this->ModulaDB->addFullImage( $data );
 
633
  }
634
 
635
+ header( "Content-type: application/json" );
636
 
637
+ if ( $result === false ) {
 
638
  print "{\"success\":false}";
639
+ } else {
 
 
640
  print "{\"success\":true}";
641
  }
642
 
644
  die();
645
  }
646
 
647
+ public function list_images() {
648
+ if ( check_admin_referer( 'Modula', 'Modula' ) ) {
649
+ $gid = intval( $_POST["gid"] );
650
+ $gallery = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
 
 
651
 
652
+ $imageResults = $this->ModulaDB->getImagesByGalleryId( $gid );
653
 
654
+ include( 'admin/include/image-list.php' );
655
  }
656
  die();
657
  }
658
 
659
+ private function checkboxVal( $field ) {
660
+ if ( isset( $_POST[ $field ] ) ) //return 'checked';
661
+ {
 
662
  return 'T';
663
+ }
664
+
665
  //return '';
666
  return 'F';
667
  }
668
 
669
+ public function save_gallery() {
670
+ if ( check_admin_referer( 'Modula', 'Modula' ) ) {
671
+ $galleryName = stripslashes( $_POST['tg_name'] );
672
+ $galleryDescription = stripslashes( $_POST['tg_description'] );
673
+ $slug = strtolower( str_replace( " ", "", $galleryName ) );
674
+ $margin = intval( $_POST['tg_margin'] );
675
+ $shuffle = $this->checkboxVal( 'tg_shuffle' );
676
+ $width = $_POST['tg_width'];
677
+ $height = $_POST['tg_height'];
678
+ $enableTwitter = $this->checkboxVal( 'tg_enableTwitter' );
679
+ $enableFacebook = $this->checkboxVal( 'tg_enableFacebook' );
680
+ $enableGplus = $this->checkboxVal( 'tg_enableGplus' );
681
+ $enablePinterest = $this->checkboxVal( 'tg_enablePinterest' );
682
+ $lightbox = $_POST['tg_lightbox'];
683
+ $wp_field_caption = $_POST['tg_wp_field_caption'];
684
+ $wp_field_title = $_POST['tg_wp_field_title'];
685
+ $captionColor = $_POST['tg_captionColor'];
686
+ $borderSize = intval( $_POST['tg_borderSize'] );
687
+ $loadedScale = intval( $_POST['tg_loadedScale'] );
688
+ $loadedRotate = intval( $_POST['tg_loadedRotate'] );
689
+ $loadedVSlide = intval( $_POST['tg_loadedVSlide'] );
690
+ $loadedHSlide = intval( $_POST['tg_loadedHSlide'] );
691
+ $socialIconColor = $_POST['tg_socialIconColor'];
692
+ $hoverEffect = $_POST['tg_hoverEffect'];
693
+ $titleFontSize = intval( $_POST['tg_titleFontSize'] );
694
+ $captionFontSize = intval( $_POST['tg_captionFontSize'] );
695
+ $borderColor = $_POST['tg_borderColor'];
696
+ $borderRadius = intval( $_POST['tg_borderRadius'] );
697
+ $shadowColor = $_POST['tg_shadowColor'];
698
+ $shadowSize = intval( $_POST['tg_shadowSize'] );
699
+ $style = $_POST['tg_style'];
700
+ $script = $_POST['tg_script'];
701
+
702
+ $id = isset( $_POST['ftg_gallery_edit'] ) ? intval( $_POST['ftg_gallery_edit'] ) : 0;
703
+
704
+ $data = array(
705
+ 'name' => $galleryName,
706
+ 'slug' => $slug,
707
+ 'description' => $galleryDescription,
708
+ 'lightbox' => $lightbox,
709
+ 'img_size' => intval( $_POST['tg_img_size'] ),
710
+ 'hasResizedImages' => true,
711
+ 'wp_field_caption' => $wp_field_caption,
712
+ 'wp_field_title' => $wp_field_title,
713
+ 'margin' => $margin,
714
+ 'randomFactor' => $_POST['tg_randomFactor'],
715
+ 'shuffle' => $shuffle,
716
+ 'enableTwitter' => $enableTwitter,
717
+ 'enableFacebook' => $enableFacebook,
718
+ 'enableGplus' => $enableGplus,
719
+ 'enablePinterest' => $enablePinterest,
720
+ 'captionColor' => $captionColor,
721
+ 'hoverEffect' => $hoverEffect,
722
+ 'borderSize' => $borderSize,
723
+ 'loadedScale' => $loadedScale,
724
+ 'loadedHSlide' => $loadedHSlide,
725
+ 'loadedVSlide' => $loadedVSlide,
726
+ 'loadedRotate' => $loadedRotate,
727
+ 'socialIconColor' => $socialIconColor,
728
+ 'captionFontSize' => $captionFontSize,
729
+ 'titleFontSize' => $titleFontSize,
730
+ 'borderColor' => $borderColor,
731
+ 'borderRadius' => $borderRadius,
732
+ 'shadowSize' => $shadowSize,
733
+ 'shadowColor' => $shadowColor,
734
+ 'width' => $width,
735
+ 'height' => $height,
736
+ 'style' => $style,
737
+ 'script' => $script,
738
+ );
739
+
740
+ header( "Content-type: application/json" );
741
+ if ( $id > 0 ) {
742
+ $result = $this->ModulaDB->editGallery( $id, $data );
743
+
744
+ if ( intval( $this->loadedData->img_size ) != $data['img_size'] ) {
 
 
 
 
745
  $images = $this->ModulaDB->getImagesByGalleryId( $id );
746
+ $images = ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
747
 
748
+ foreach ( $images as $img ) {
749
+ $this->ModulaDB->editImage( $img->Id, (array) $img );
750
+ }
751
+ }
752
 
753
+ $this->loadedData = $this->ModulaDB->getGalleryById( $id, $this->defaultValues );
754
+ } else {
755
+ $result = $this->ModulaDB->addGallery( $data );
756
+ $id = $this->ModulaDB->getNewGalleryId();
 
 
757
  }
758
 
759
+ if ( $result ) {
760
+ print "{\"success\":true,\"id\":" . $id . "}";
761
+ } else {
762
  print "{\"success\":false}";
763
+ }
764
  }
765
  die();
766
  }
767
 
768
+ public function edit_gallery() {
769
+ if ( isset( $_GET['galleryId'] ) ) {
770
+ $this->loadedData = $this->ModulaDB->getGalleryById( intval( $_GET['galleryId'] ), $this->defaultValues );
771
+ $modula_fields = $this->fields;
 
772
  $modula_parent_page = "dashboard";
773
 
774
+ include( "admin/edit-gallery.php" );
775
  } else {
776
+ $redir = true;
777
  $nobanner = true;
778
+ include( "admin/overview.php" );
779
+ }
780
  }
781
 
782
+ public function list_thumbnail_sizes() {
 
783
  global $_wp_additional_image_sizes;
784
  $sizes = array();
785
+ foreach ( get_intermediate_image_sizes() as $s ) {
786
+ $sizes[ $s ] = array( 0, 0 );
787
+ if ( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) ) {
788
+ $sizes[ $s ][0] = get_option( $s . '_size_w' );
789
+ $sizes[ $s ][1] = get_option( $s . '_size_h' );
790
+ } else {
791
+ if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[ $s ] ) ) {
792
+ $sizes[ $s ] = array(
793
+ $_wp_additional_image_sizes[ $s ]['width'],
794
+ $_wp_additional_image_sizes[ $s ]['height'],
795
+ );
796
+ }
797
+ }
798
+ }
799
+
800
+ return $sizes;
801
+ }
802
+
803
+ public function gallery_shortcode_handler( $atts ) {
804
+ require_once( 'lib/gallery-class.php' );
 
 
805
  global $Modula;
806
 
807
+ if ( class_exists( 'ModulaLiteFE' ) ) {
808
+ $Modula = new ModulaLiteFE( $this->ModulaDB, $atts['id'], $this->defaultValues );
 
809
 
810
  $settings = $Modula->getGallery();
811
+ switch ( $settings->lightbox ) {
 
812
  case "lightbox2":
813
+ wp_enqueue_style( 'lightbox2_stylesheet' );
814
+ wp_enqueue_script( 'lightbox2_script' );
815
  break;
816
  }
817
+
818
  return $Modula->render();
819
+ } else {
 
 
820
  return "Gallery not found.";
821
  }
822
  }
823
 
824
  var $fields = array(
825
 
826
+ "General" => array(
827
+ "icon" => "mdi mdi-settings",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
828
  "fields" => array(
829
+ "name" => array(
830
+ "name" => "Name",
831
+ "type" => "text",
832
+ "description" => "Name of the gallery, for internal use.",
833
+ "excludeFrom" => array(),
834
+ ),
835
+ "description" => array(
836
+ "name" => "Description",
837
+ "type" => "text",
838
+ "description" => "This description is for internal use.",
839
+ "excludeFrom" => array(),
840
+ ),
841
+ "width" => array(
842
+ "name" => "Width",
843
+ "type" => "text",
844
+ "description" => "Width of the gallery (i.e.: 100% or 500px)",
845
+ "mu" => "px or %",
846
+ "excludeFrom" => array(),
847
+ ),
848
+ "height" => array(
849
+ "name" => "Height",
850
+ "type" => "number",
851
+ "description" => "Height of the gallery in pixels",
852
+ "mu" => "px",
853
+ "excludeFrom" => array(),
854
+ ),
855
+ "img_size" => array(
856
+ "name" => "Minimum image size",
857
+ "type" => "number",
858
+ "description" => "Minimum width or height of the images",
859
+ "mu" => "px or %",
860
+ "excludeFrom" => array(),
861
+ ),
862
+ "margin" => array(
863
+ "name" => "Margin",
864
+ "type" => "number",
865
+ "description" => "Margin between images",
866
+ "mu" => "px",
867
+ "excludeFrom" => array(),
868
+ ),
869
+ "randomFactor" => array(
870
+ "name" => "Random factor",
871
+ "type" => "ui-slider",
872
+ "description" => "",
873
+ "min" => 0,
874
+ "max" => 100,
875
+ "mu" => "%",
876
+ "default" => 20,
877
+ "excludeFrom" => array(),
878
+ ),
879
+ "filters" => array(
880
+ "name" => "Filters",
881
+ "type" => "PRO_FEATURE",
882
+ "description" => "Add your own filters here. Each image can have one or more filters.",
883
+ "excludeFrom" => array(),
884
+ ),
885
+ "filterClick" => array(
886
+ "name" => "Reload Page on filter click",
887
+ "type" => "PRO_FEATURE",
888
+ "description" => "Turn this feature ON if you want to use filters with most lightboxes",
889
+ "excludeFrom" => array(),
890
+ ),
891
+ "allFilterLabel" => array(
892
+ "name" => "Text for 'All' filter",
893
+ "type" => "PRO_FEATURE",
894
+ "description" => "Write here the label for the 'All' filter",
895
+ "default" => "All",
896
+ "excludeFrom" => array(),
897
+ ),
898
+ "lightbox" => array(
899
+ "name" => "Lightbox &amp; Links",
900
+ "type" => "select",
901
+ "description" => "Define here what happens when user click on the images.",
902
+ "values" => array(
903
+ "Link" => array( "|No link", "direct|Direct link to image", "|Attachment page" ),
904
+ "Lightboxes" => array( "lightbox2|Lightbox" ),
905
+ ),
906
+ "disabled" => array(
907
+ "Lightboxes with PRO license" => array(
908
+ "magnific|Magnific popup",
909
+ "prettyphoto|PrettyPhoto",
910
+ "fancybox|FancyBox",
911
+ "swipebox|SwipeBox",
912
+ "lightbox2|Lightbox",
913
+ ),
914
+ ),
915
+ "excludeFrom" => array(),
916
+ ),
917
+ "shuffle" => array(
918
+ "name" => "Shuffle images",
919
+ "type" => "toggle",
920
+ "default" => "T",
921
+ "description" => "Flag it if you want to shuffle the gallery at each page load",
922
+ "excludeFrom" => array(),
923
+ ),
924
+ ),
925
+ ),
926
+ "Captions" => array(
927
+ "icon" => "mdi mdi-comment-text-outline",
928
+ "fields" => array(
929
+ "captionColor" => array(
930
+ "name" => "Caption color",
931
+ "type" => "color",
932
+ "description" => "Color of the caption.",
933
+ "default" => "#ffffff",
934
+ "excludeFrom" => array(),
935
+ ),
936
+ "wp_field_caption" => array(
937
+ "name" => "WordPress caption field",
938
+ "type" => "select",
939
+ "description" => "WordPress field used for captions. <strong>This field is used ONLY when images are added to the gallery, </strong> however, if you want to ignore captions just set it to '<i>Don't use captions</i>'.",
940
+ "values" => array(
941
+ "Field" => array(
942
+ "none|Don't use captions",
943
+ "title|Title",
944
+ "caption|Caption",
945
+ "description|Description",
946
+ ),
947
+ ),
948
+ "excludeFrom" => array( "shortcode" ),
949
+ ),
950
+ "wp_field_title" => array(
951
+ "name" => "WordPress title field",
952
+ "type" => "select",
953
+ "description" => "WordPress field used for titles. <strong>This field is used ONLY when images are added to the gallery, </strong> however, if you want to ignore titles just set it to '<i>Don't use titles</i>'.",
954
+ "values" => array(
955
+ "Field" => array( "none|Don't use titles", "title|Title", "description|Description" ),
956
+ ),
957
+ "excludeFrom" => array( "shortcode" ),
958
+ ),
959
+ "captionFontSize" => array(
960
+ "name" => "Caption Font Size",
961
+ "type" => "number",
962
+ "description" => "",
963
+ "mu" => "px",
964
+ "excludeFrom" => array(),
965
+ ),
966
+ "titleFontSize" => array(
967
+ "name" => "Title Font Size",
968
+ "type" => "number",
969
+ "description" => "",
970
+ "mu" => "px",
971
+ "excludeFrom" => array(),
972
+ ),
973
+ ),
974
+
975
+ ),
976
+ "Social" => array(
977
+ "icon" => "mdi mdi-link-variant",
978
+ "fields" => array(
979
+ "enableTwitter" => array(
980
+ "name" => "Add Twitter icon",
981
+ "type" => "toggle",
982
+ "default" => "T",
983
+ "description" => "Enable Twitter Sharing",
984
+ "excludeFrom" => array(),
985
+ ),
986
+ "enableFacebook" => array(
987
+ "name" => "Add Facebook icon",
988
+ "type" => "toggle",
989
+ "default" => "T",
990
+ "description" => "Enable Facebook Sharing",
991
+ "excludeFrom" => array(),
992
+ ),
993
+ "enableGplus" => array(
994
+ "name" => "Add Google Plus icon",
995
+ "type" => "toggle",
996
+ "default" => "T",
997
+ "description" => "Enable Google Plus Sharing",
998
+ "excludeFrom" => array(),
999
+ ),
1000
+ "enablePinterest" => array(
1001
+ "name" => "Add Pinterest icon",
1002
+ "type" => "toggle",
1003
+ "default" => "T",
1004
+ "description" => "Enable Pinterest Sharing",
1005
+ "excludeFrom" => array(),
1006
+ ),
1007
+ "socialIconColor" => array(
1008
+ "name" => "Color of social sharing icons",
1009
+ "type" => "color",
1010
+ "description" => "Set the color of the social sharing icons",
1011
+ "default" => "#ffffff",
1012
+ "excludeFrom" => array(),
1013
+ ),
1014
+ ),
1015
+
1016
+ ),
1017
+ "Image loaded effects" => array(
1018
+ "icon" => "mdi mdi-reload",
1019
+ "fields" => array(
1020
+ "loadedScale" => array(
1021
+ "name" => "Scale",
1022
  "description" => "Choose a value below 100% for a zoom-in effect. Choose a value over 100% for a zoom-out effect",
1023
+ "type" => "ui-slider",
1024
+ "min" => 0,
1025
+ "max" => 200,
1026
+ "mu" => "%",
1027
+ "default" => 100,
1028
+ "excludeFrom" => array(),
1029
  ),
1030
  "loadedRotate" => array(
1031
+ "name" => "Rotate",
1032
  "description" => "",
1033
+ "type" => "PRO_FEATURE",
1034
+ "min" => - 180,
1035
+ "max" => 180,
1036
+ "default" => 0,
1037
+ "mu" => "deg",
1038
+ "excludeFrom" => array(),
1039
  ),
1040
  "loadedHSlide" => array(
1041
+ "name" => "Horizontal slide",
1042
  "description" => "",
1043
+ "type" => "PRO_FEATURE",
1044
+ "min" => - 100,
1045
+ "max" => 100,
1046
+ "mu" => "px",
1047
+ "default" => 0,
1048
+ "excludeFrom" => array(),
1049
  ),
1050
  "loadedVSlide" => array(
1051
+ "name" => "Vertical slide",
1052
  "description" => "",
1053
+ "type" => "PRO_FEATURE",
1054
+ "min" => - 100,
1055
+ "max" => 100,
1056
+ "mu" => "px",
1057
+ "default" => 0,
1058
+ "excludeFrom" => array(),
1059
+ ),
1060
+
1061
+ ),
1062
  ),
1063
+ "Hover effect" => array(
1064
+ "icon" => "mdi mdi-blur",
1065
  "fields" => array(
1066
  "Effect" => array(
1067
+ "name" => "Effect",
1068
  "description" => "Select an hover effect",
1069
+ "type" => "hover-effect",
1070
+ "excludeFrom" => array(),
1071
+ ),
1072
+ ),
1073
+ ),
1074
+ "Style" => array(
1075
+ "icon" => "mdi mdi-format-paint",
1076
+ "fields" => array(
1077
+ "borderSize" => array(
1078
+ "name" => "Border Size",
1079
+ "type" => "ui-slider",
1080
+ "description" => "",
1081
+ "mu" => "px",
1082
+ "min" => 0,
1083
+ "max" => 10,
1084
+ "default" => 0,
1085
+ "excludeFrom" => array(),
1086
+ ),
1087
+ "borderRadius" => array(
1088
+ "name" => "Border Radius",
1089
+ "type" => "ui-slider",
1090
+ "description" => "",
1091
+ "mu" => "px",
1092
+ "min" => 0,
1093
+ "max" => 100,
1094
+ "default" => 0,
1095
+ "excludeFrom" => array(),
1096
+ ),
1097
+ "borderColor" => array(
1098
+ "name" => "Border Color",
1099
+ "type" => "color",
1100
+ "description" => "",
1101
+ "default" => "#ffffff",
1102
+ "excludeFrom" => array(),
1103
+ ),
1104
+ "shadowSize" => array(
1105
+ "name" => "Shadow Size",
1106
+ "type" => "ui-slider",
1107
+ "description" => "",
1108
+ "mu" => "px",
1109
+ "min" => 0,
1110
+ "max" => 20,
1111
+ "default" => 0,
1112
+ "excludeFrom" => array(),
1113
+ ),
1114
+ "shadowColor" => array(
1115
+ "name" => "Shadow Color",
1116
+ "type" => "color",
1117
+ "description" => "",
1118
+ "default" => "#ffffff",
1119
+ "excludeFrom" => array(),
1120
+ ),
1121
+
1122
+ ),
1123
  ),
1124
+ "Customizations" => array(
1125
+ "icon" => "mdi mdi-puzzle",
1126
+ "fields" => array(
1127
+ "script" => array(
1128
+ "name" => "Custom scripts",
1129
+ "type" => "textarea",
1130
+ "description" => "This script will be called after the gallery initialization. Useful for custom lightboxes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1131
  <br />
1132
  <br />
1133
  <strong>Write just the code without using the &lt;script&gt;&lt;/script&gt; tags</strong>",
1134
+ "excludeFrom" => array( "shortcode" ),
1135
+ ),
1136
+ "style" => array(
1137
+ "name" => "Custom css",
1138
+ "type" => "textarea",
1139
+ "description" => "<strong>Write just the code without using the &lt;style&gt;&lt;/style&gt; tags</strong>",
1140
+ "excludeFrom" => array( "shortcode" ),
1141
+ ),
1142
+ ),
1143
+ ),
1144
+
1145
+ );
1146
  }
1147
 
1148
+ class ModulaLiteHoverEffect {
1149
+
1150
  var $name;
1151
  var $code;
1152
  var $allowTitle;
1153
  var $allowSubtitle;
1154
  var $maxSocial;
1155
 
1156
+ public function __construct( $name, $code, $allowTitle, $allowSubtitle, $maxSocial ) {
1157
+ $this->name = $name;
1158
+ $this->code = $code;
1159
+ $this->allowTitle = $allowTitle;
 
1160
  $this->allowSubtitle = $allowSubtitle;
1161
+ $this->maxSocial = $maxSocial;
1162
  }
1163
  }
1164
  }
1165
 
1166
+ class ModulaLiteTools {
1167
+
1168
+ public static function get_image_size_links( $id ) {
1169
+ $result = array();
1170
+ $sizes = get_intermediate_image_sizes();
 
1171
  $sizes[] = 'full';
1172
 
1173
+ foreach ( $sizes as $size ) {
 
1174
  $image = wp_get_attachment_image_src( $id, $size );
1175
 
1176
+ if ( ! empty( $image ) && ( true == $image[3] || 'full' == $size ) ) {
1177
  $result["$image[1]x$image[2]"] = $image[0];
1178
+ }
1179
  }
1180
 
1181
  return $result;
1182
  }
1183
 
1184
+ public static function resize_image( $id, $img_size ) {
1185
+ $file = get_attached_file( $id );
1186
+ $editor = wp_get_image_editor( $file );
1187
+ $size = $editor->get_size();
1188
+ if ( $size["width"] > $size["height"] ) {
1189
+ $editor->resize( 10000, $img_size );
1190
+ } else {
1191
+ $editor->resize( $img_size, 10000 );
1192
  }
1193
+ $path_parts = pathinfo( $file );
1194
+ $filename = $path_parts['dirname'] . "/" . $path_parts['filename'] . "-" . $img_size . "x" . $img_size . "." . $path_parts["extension"];
1195
+
1196
+ if ( ! file_exists( $filename ) ) {
1197
+ $editor->save( $filename );
1198
  }
 
 
1199
 
 
 
1200
  return basename( $filename );
1201
  }
1202
 
1203
+ public static function check_and_resize( &$images, $size ) {
1204
+ foreach ( $images as &$img ) {
 
 
1205
  $metadata = wp_get_attachment_metadata( $img->imageId );
1206
 
1207
+ if ( $img->imageId > 0 ) {
 
1208
  $wpdata = get_post( $img->imageId );
1209
  $baseurl = str_replace( basename( $wpdata->guid ), "", $wpdata->guid );
1210
  $res_name = ModulaLiteTools::resize_image( $img->imageId, $size );
1211
 
1212
+ if ( ! ( array_key_exists( "image_meta", $metadata ) && array_key_exists( "resized_images", $metadata["image_meta"] ) && in_array( $size . "x" . $size, $metadata["image_meta"]["resized_images"] ) ) ) {
 
 
 
1213
  if ( isset( $metadata['image_meta'] ) ) {
1214
  $md = $size . 'x' . $size;
1215
  $metadata['image_meta']['resized_images'][] = $md;
1218
  }
1219
 
1220
  $img->imagePath = $baseurl . $res_name;
1221
+ } else {
1222
+ $img->imagePath = preg_replace( "/w=(\d+)/", "w=" . $size, $img->imagePath );
 
 
1223
  }
1224
  }
1225
+
1226
  return $images;
1227
  }
1228
  }
1229
 
1230
+ if ( class_exists( "ModulaLite" ) ) {
1231
+ global $ob_ModulaLite;
 
1232
  $ob_ModulaLite = new ModulaLite();
1233
  }
1234
  ?>
README.txt CHANGED
@@ -1,196 +1,252 @@
1
- === Gallery - A WordPress Modula Gallery ===
2
- Contributors: GreenTreeLabs
3
- Tags: gallery, grid gallery, lightbox, share images, masonry, masonry gallery, envira, envira gallery, nextgen, nextgen gallery
4
- Requires at least: 4.0
5
- Tested up to: 4.6.1
6
- Stable tag: trunk
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- Creative Multipurpose Grid Gallery for WordPress
11
-
12
- == Description ==
13
- Modula Grid Gallery, the best WordPress gallery plugin, is now available also in Lite version. Modula is currently the easiest and fastest gallery plugin for WordPress. With its wizard you are able to build your galleries in a few seconds, unlike many other galleries.
14
-
15
- https://www.youtube.com/watch?v=tq8yUYxgtnA
16
-
17
- = Examples: =
18
- [Modula Grid Gallery](http://modula.greentreelabs.net/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
19
- [Example: Margins](http://modula.greentreelabs.net/demo/margins/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
20
- [Example: Shuffle](http://modula.greentreelabs.net/demo/shuffle/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
21
- [Example: Social icons](http://modula.greentreelabs.net/demo/social-effect/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
22
- [Example: Custom styling](http://modula.greentreelabs.net/demo/styling/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
23
-
24
- = Applications: =
25
- [Architecture portfolio](http://modula.greentreelabs.net/demo/applications/architecture/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
26
- [Art showcase](http://modula.greentreelabs.net/demo/applications/art-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
27
- [Photography portfolio](http://modula.greentreelabs.net/demo/applications/blackwhite-photography/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
28
- [Food gallery](http://modula.greentreelabs.net/demo/applications/food/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
29
- [Pets gallery](http://modula.greentreelabs.net/demo/applications/pets-animals/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
30
- [Tattoo showcase](http://modula.greentreelabs.net/demo/applications/tattoo-attitude/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
31
- [Travel gallery](http://modula.greentreelabs.net/demo/applications/travel-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
32
- [Wedding album](http://modula.greentreelabs.net/demo/applications/wedding-album/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
33
-
34
- Do you wonder why this gallery is the best one? Look at the other galleries, see their demos, you’ll notice something weird ... THEY ALL LOOK THE SAME!
35
-
36
- Modula is creative! Modula is dynamic! Modula doesn’t always look the same. Just have fun with it! Modula uses a new concept to build its internal grid. After you set a width and a height for the gallery, Modula will create a random but smart grid inside. The result is a dynamic, creative, interesting and attractive gallery.
37
-
38
- You can control how much randomness to use in each gallery, so you can obtain a more traditional layout by switching off the “random factor,” or you can make something much more different by incrementing this factor.
39
-
40
- Modula is a justified grid gallery because YOU decide the width and the height of the gallery, and the images to put inside. Modula will think about everything else. Images will never exceed their container.
41
-
42
- To achieve such a result, images will be cropped, but that’s not a problem at all, because you can set a custom alignment for those images where the subject is not at the center of the image.
43
-
44
- Modula Grid Gallery is not only responsive but also fluid, which means you’ll see images organize themselves with an impressive animation even on mobile devices thanks to the CSS3 engine.
45
-
46
- Ease of use doesn’t mean trivial galleries, indeed!
47
- By using the Modula Admin Panel you’re able to fine tune every aspect of the gallery. Choose a gallery size, margins between images, the color and the size of captions. Each photo can have a title and a subtitle so you’re able to best describe every image.
48
-
49
- What is Modula good for? Modula is also the best WordPress portfolio plugin, as it allows you to build gorgeous, creative portfolios.
50
- Applications are: architecture, art, photography, food blogs, pets and animals, tattoos, travel and also wedding albums.
51
-
52
- If you're frustated because your current galleries looks boring and too standard then you can use the importer which is included with Modula. The importer is currently able to import Envira and NextGen galleries.
53
-
54
- == Installation ==
55
- = For automatic installation: =
56
-
57
- The simplest way to install is to click on \'Plugins\' then \'Add\' and type \'Modula\' in the search field.
58
-
59
- = For manual installation 1: =
60
-
61
- 1. Login to your website and go to the Plugins section of your admin panel.
62
- 2. Click the Add New button.
63
- 3. Under Install Plugins, click the Upload link.
64
- 4. Select the plugin zip file (modula.x.x.x.zip) from your computer then click the Install Now button.
65
- 5. You should see a message stating that the plugin was installed successfully.
66
- 6. Click the Activate Plugin link.
67
-
68
- = For manual installation 2: =
69
-
70
- 1. You should have access to the server where WordPress is installed. If you don\'t, see your system administrator.
71
- 2. Copy the plugin zip file (modula.x.x.x.zip) up to your server and unzip it somewhere on the file system.
72
- 3. Copy the \"modula-lite\" folder into the /wp-content/plugins directory of your WordPress installation.
73
- 4. Login to your website and go to the Plugins section of your admin panel.
74
- 5. Look for \"Modula\" and click Activate.
75
-
76
- == Frequently Asked Questions ==
77
-
78
- = The layout doesnt' look correct =
79
-
80
- Check the console of the browser and look if you see any error like: "Uncaught TypeError: undefined is not a function"
81
- This errors means that the browser doesn't know the Modula JavaScript plugin, most of the time the problem is caused by a wrong jQuery inclusion by the theme or another plugin.
82
-
83
- = Why does some image look blurry ? =
84
-
85
- If you get blurry and pixellated images then you need to raise the "Minimum image width" parameter inside the "General" section.
86
-
87
- = I want to use another lightbox instead of the provided one =
88
-
89
- The PRO license bundles 6 different lightboxes. However you can use any other lightbox you want also with the Lite license. If you have installed a lightbox plugin then you just need to select "Direct link to image" in the "Lightbox" settings.
90
-
91
- = How can I get support? =
92
-
93
- Free support is included only with a PRO license: http://modula.greentreelabs.net/#buy
94
-
95
- = How can I say thanks? =
96
-
97
- * Just recommend our plugin to your friends! or
98
- * Like and share our [Facebook page](https://www.facebook.com/greentreelabs "Facebook fan page")
99
-
100
-
101
- == Screenshots ==
102
-
103
- 1. Gallery with Appear effect
104
- 2. Gallery with Crafty effect and round corners
105
- 3. Gallery with Catinelle effect
106
- 4. Gallery with Appear effect
107
- 5. Gallery with Pufrobo effect
108
- 6. Lightgallery lightbox
109
- 7. Admin panel with Material design
110
-
111
- == Changelog ==
112
-
113
- = 1.1.13 =
114
- * Enhanced lightbox compatibility
115
-
116
- = 1.1.10 =
117
- * Enhancement in backend UI
118
-
119
- = 1.1.9 =
120
- * Minor change in backend UI
121
-
122
- = 1.1.8 =
123
- * Fixed broken css for backends under SSL
124
-
125
- = 1.1.7 =
126
- * Tool to fix broken images after version 1.1.0
127
-
128
- = 1.1.6 =
129
- * Bug fix (impossible to select effect "None")
130
-
131
- = 1.1.5 =
132
- * Fixed issue on admin panel when images are too tall
133
-
134
- = 1.1.4 =
135
- * Changed CSS icon prefix to avoid conflicts
136
-
137
- = 1.1.3 =
138
- * Fixed bug (linked images opening in lightbox)
139
-
140
- = 1.1.2 =
141
- * Fixed social icons bug
142
-
143
- = 1.1.1 =
144
- * Bug fix
145
-
146
- = 1.1.0 =
147
- * New image management
148
- * Import tool for Envira galleries
149
- * Import tool for NextGen galleries
150
-
151
- = 1.0.12 =
152
- * Added link to ShortPixel plugin for image optimization
153
-
154
- = 1.0.11 =
155
- * Minor bug fix: fixed missing preview effect image
156
-
157
- = 1.0.10 =
158
- * Bug fix: now Lightbox opens image at full size
159
-
160
- = 1.0.9 =
161
- * Fixed url to upgrade
162
-
163
- = 1.0.8 =
164
- * Fixed url to upgrade
165
-
166
- = 1.0.7 =
167
- * Changed call to action for the survey
168
-
169
- = 1.0.6 =
170
- * Fixed CSS issue with Lightbox and some themes. New page in admin panel to show other gallery plugins. Enhancements of the UI of admin panel.
171
-
172
- = 1.0.5 =
173
- * Added handy links on plugins page
174
-
175
- = 1.0.4 =
176
- * Updated pot file for translations
177
-
178
- = 1.0.3 =
179
- * Bug fix: now images can be sorted also in the "Add gallery" wizard
180
-
181
- = 1.0.2 =
182
- * Added link to survey to help us making a better plugin
183
-
184
- = 1.0.1 =
185
- * Fixed issue when activating the plugin
186
-
187
- = 1.0.0 =
188
- * This is the launch version. No changes yet.
189
-
190
- == Upgrade Notice ==
191
-
192
- = 1.1.8 =
193
- * This update will fix broken CSS of admin panel under SSL
194
-
195
- = 1.1.7 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  * This update contains a tool to fix broken images.
1
+ === Gallery - Photo Gallery - Image Gallery ===
2
+ Contributors: machothemes, imagegallery, xphotogallery
3
+ Tags: image gallery, photo gallery, responsive gallery, wordpress gallery plugin, wordpress portfolio plugin, lightbox gallery, masonry gallery, envira, envira gallery, nextgen, nextgen gallery, album, content gallery, fancy gallery, gallery widget, media gallery, mosaic gallery, photo album, polaroid gallery, portfolio gallery, post gallery, thumbnail gallery, video gallery, youtube gallery, filterable portfolio, portfolio gallery, responsive portfolio, wordpress portfolio plugin
4
+ Requires at least: 3.8
5
+ Tested up to: 4.8
6
+ Stable tag: 1.2.0
7
+ License: GPLv3 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
+
10
+ Photo Gallery by Modula - an advanced solution for Photo Gallery users. Create beautiful image galleries in minutes or less.
11
+
12
+ == Description ==
13
+
14
+ Modula WordPress Photo Gallery, Image Gallery & Portfolio Gallery Plugin, the creative WordPress image gallery, photo gallery, portfolio gallery & responsive gallery, is now available also in Lite version. Modula is currently the easiest and fastest photo gallery plugin for WordPress. With its wizard you are able to build an image gallery in a few seconds, unlike many other WordPress gallery plugins.
15
+
16
+ = See a 60s video of Modula in action =
17
+
18
+ https://www.youtube.com/watch?v=tq8yUYxgtnA
19
+
20
+
21
+ > **Time-saving features available in the FULL version:**
22
+ >
23
+ > * Use more than 20 images per gallery
24
+ > * Get access to gallery filters. Each image can have one or more filters.
25
+ > * Get access to 5 more lightbox libraries & effects with the PRO version.
26
+ > * Image effects on finishing image loading. Rotate or Horizontally / Vertically slide the images.
27
+ > * Get access to more than 15 hover image effects.
28
+ > * Priority email support from the developer of the plugin
29
+ > * Support and updates for 12 months
30
+ >
31
+ > **[Learn more about Modula Full version]( https://wp-modula.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite )**
32
+
33
+
34
+ = See how Modula can integrate with your website =
35
+
36
+ * [Modula Grid Gallery](http://wp-modula.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
37
+ * [Example: Margins](https://wp-modula.com/demo/margins/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
38
+ * [Example: Shuffle](https://wp-modula.com/demo/shuffle/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
39
+ * [Example: Social icons](https://wp-modula.com/demo/social-effect/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
40
+ * [Example: Custom styling](https://wp-modula.com/demo/styling/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
41
+ * [Architecture portfolio](https://wp-modula.com/demo/applications/architecture/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
42
+ * [Art showcase](https://wp-modula.com/demo/applications/art-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
43
+ * [Photography portfolio](https://wp-modula.com/demo/applications/blackwhite-photography/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
44
+ * [Food gallery](https://wp-modula.com/demo/applications/food/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
45
+ * [Pets gallery](https://wp-modula.com/demo/applications/pets-animals/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
46
+ * [Tattoo showcase](https://wp-modula.com/demo/applications/tattoo-attitude/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
47
+ * [Travel gallery](https://wp-modula.com/demo/applications/travel-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
48
+ * [Wedding album](https://wp-modula.com/demo/applications/wedding-album/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
49
+
50
+ = Shortcode Parameters =
51
+
52
+ `
53
+ * id
54
+ `
55
+
56
+
57
+ **Plugin is now using the TinyMCE API to improve UI and makes it easy to insert shortcodes!**
58
+
59
+
60
+ = Basic example =
61
+
62
+ `[Modula id="1"]`
63
+
64
+
65
+ = Some Modula demo applications / usages =
66
+
67
+ Do you wonder why this gallery is the best one? Look at the other galleries, see their demos, you’ll notice something weird ... THEY ALL LOOK THE SAME!
68
+
69
+ Modula is creative! Modula is dynamic! Modula doesn’t always look the same. Just have fun with it! Modula uses a new concept to build its internal grid. After you set a width and a height for the gallery, Modula will create a random but smart grid inside. The result is a dynamic, creative, interesting and attractive gallery.
70
+
71
+ You can control how much randomness to use in each gallery, so you can obtain a more traditional layout by switching off the “random factor,” or you can make something much more different by incrementing this factor.
72
+
73
+ Modula is a justified grid gallery because YOU decide the width and the height of the gallery, and the images to put inside. Modula will think about everything else. Images will never exceed their container.
74
+
75
+ To achieve such a result, images will be cropped, but that’s not a problem at all, because you can set a custom alignment for those images where the subject is not at the center of the image.
76
+
77
+ Modula Grid Gallery is not only responsive but also fluid, which means you’ll see images organize themselves with an impressive animation even on mobile devices thanks to the CSS3 engine.
78
+
79
+ **Ease of use doesn’t mean trivial galleries, indeed!**
80
+ By using the Modula Admin Panel you’re able to fine tune every aspect of the gallery. Choose a gallery size, margins between images, the color and the size of captions. Each photo can have a title and a subtitle so you’re able to best describe every image.
81
+
82
+ = What is Modula good for? =
83
+
84
+ Modula is also the best WordPress portfolio plugin, as it allows you to build gorgeous, creative portfolios. Applications are:
85
+
86
+ * architecture
87
+ * art
88
+ * photography
89
+ * food blogs
90
+ * pets and animals
91
+ * tattoos
92
+ * travel
93
+ * also wedding albums.
94
+
95
+ If you're frustated because your current galleries looks boring and too standard then you can use the importer which is included with Modula. The importer is currently able to import Envira and NextGen galleries.
96
+
97
+ > This plugin is maintained and supported by Macho Themes.
98
+ > Check out some of the other <a href="//machothemes.com/plugins/">WordPress plugins</a> we've developed.
99
+ > Check out some of the other <a href="//machothemes.com/themes/free/">free WordPress themes</a> we've developed.
100
+
101
+ == Installation ==
102
+ = For automatic installation: =
103
+
104
+ The simplest way to install is to click on \'Plugins\' then \'Add\' and type \'Modula\' in the search field.
105
+
106
+ = For manual installation 1: =
107
+
108
+ 1. Login to your website and go to the Plugins section of your admin panel.
109
+ 2. Click the Add New button.
110
+ 3. Under Install Plugins, click the Upload link.
111
+ 4. Select the plugin zip file (modula.x.x.x.zip) from your computer then click the Install Now button.
112
+ 5. You should see a message stating that the plugin was installed successfully.
113
+ 6. Click the Activate Plugin link.
114
+
115
+ = For manual installation 2: =
116
+
117
+ 1. You should have access to the server where WordPress is installed. If you don\'t, see your system administrator.
118
+ 2. Copy the plugin zip file (modula.x.x.x.zip) up to your server and unzip it somewhere on the file system.
119
+ 3. Copy the \"modula-lite\" folder into the /wp-content/plugins directory of your WordPress installation.
120
+ 4. Login to your website and go to the Plugins section of your admin panel.
121
+ 5. Look for \"Modula\" and click Activate.
122
+
123
+ == Frequently Asked Questions ==
124
+
125
+ = The layout doesnt' look correct =
126
+
127
+ Check the console of the browser and look if you see any error like: "Uncaught TypeError: undefined is not a function"
128
+ This errors means that the browser doesn't know the Modula JavaScript plugin, most of the time the problem is caused by a wrong jQuery inclusion by the theme or another plugin.
129
+
130
+ = Why does some image look blurry ? =
131
+
132
+ If you get blurry and pixellated images then you need to raise the "Minimum image width" parameter inside the "General" section.
133
+
134
+ = I want to use another lightbox instead of the provided one =
135
+
136
+ The PRO license bundles 6 different lightboxes. However you can use any other lightbox you want also with the Lite license. If you have installed a lightbox plugin then you just need to select "Direct link to image" in the "Lightbox" settings.
137
+
138
+ = How can I get support? =
139
+
140
+ Free support is included only with a PRO license: [Buy Modula PRO](https://wp-modula.com/#buy "Buy Modula PRO")
141
+
142
+ = How can I say thanks? =
143
+
144
+ * Just recommend our plugin to your friends! or
145
+ * Like and share our [Facebook page](https://www.facebook.com/machothemes "Facebook fan page")
146
+
147
+
148
+ == Screenshots ==
149
+
150
+ 1. Gallery with Appear effect
151
+ 2. Gallery with Crafty effect and round corners
152
+ 3. Gallery with Catinelle effect
153
+ 4. Gallery with Appear effect
154
+ 5. Gallery with Pufrobo effect
155
+ 6. Lightgallery lightbox
156
+ 7. Admin panel with Material design
157
+
158
+ == Changelog ==
159
+
160
+ = 1.2 =
161
+ * Removed sub-menu entry: Tutorial
162
+ * Removed sub-menu entry: Other Galleries
163
+ * Removed fixed action button
164
+ * Removed Modula Survey by Diego Imbriani
165
+ * Re-worked the "Upgrade" page.
166
+ * Removed the "languages" folder. We'll be using GlotPress to handle these
167
+ * Fixed an issue with WPML plugin
168
+
169
+ = 1.1.13 =
170
+ * Enhanced lightbox compatibility
171
+
172
+ = 1.1.10 =
173
+ * Enhancement in backend UI
174
+
175
+ = 1.1.9 =
176
+ * Minor change in backend UI
177
+
178
+ = 1.1.8 =
179
+ * Fixed broken css for backends under SSL
180
+
181
+ = 1.1.7 =
182
+ * Tool to fix broken images after version 1.1.0
183
+
184
+ = 1.1.6 =
185
+ * Bug fix (impossible to select effect "None")
186
+
187
+ = 1.1.5 =
188
+ * Fixed issue on admin panel when images are too tall
189
+
190
+ = 1.1.4 =
191
+ * Changed CSS icon prefix to avoid conflicts
192
+
193
+ = 1.1.3 =
194
+ * Fixed bug (linked images opening in lightbox)
195
+
196
+ = 1.1.2 =
197
+ * Fixed social icons bug
198
+
199
+ = 1.1.1 =
200
+ * Bug fix
201
+
202
+ = 1.1.0 =
203
+ * New image management
204
+ * Import tool for Envira galleries
205
+ * Import tool for NextGen galleries
206
+
207
+ = 1.0.12 =
208
+ * Added link to ShortPixel plugin for image optimization
209
+
210
+ = 1.0.11 =
211
+ * Minor bug fix: fixed missing preview effect image
212
+
213
+ = 1.0.10 =
214
+ * Bug fix: now Lightbox opens image at full size
215
+
216
+ = 1.0.9 =
217
+ * Fixed url to upgrade
218
+
219
+ = 1.0.8 =
220
+ * Fixed url to upgrade
221
+
222
+ = 1.0.7 =
223
+ * Changed call to action for the survey
224
+
225
+ = 1.0.6 =
226
+ * Fixed CSS issue with Lightbox and some themes. New page in admin panel to show other gallery plugins. Enhancements of the UI of admin panel.
227
+
228
+ = 1.0.5 =
229
+ * Added handy links on plugins page
230
+
231
+ = 1.0.4 =
232
+ * Updated pot file for translations
233
+
234
+ = 1.0.3 =
235
+ * Bug fix: now images can be sorted also in the "Add gallery" wizard
236
+
237
+ = 1.0.2 =
238
+ * Added link to survey to help us making a better plugin
239
+
240
+ = 1.0.1 =
241
+ * Fixed issue when activating the plugin
242
+
243
+ = 1.0.0 =
244
+ * This is the launch version. No changes yet.
245
+
246
+ == Upgrade Notice ==
247
+
248
+ = 1.1.8 =
249
+ * This update will fix broken CSS of admin panel under SSL
250
+
251
+ = 1.1.7 =
252
  * This update contains a tool to fix broken images.
admin/add-gallery.php CHANGED
@@ -1,116 +1,121 @@
1
  <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
3
-
4
- $tg_subtitle = "New Gallery";
 
 
5
  ?>
6
 
7
- <?php include("header.php") ?>
8
-
9
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- <div id="modula-wizard" >
12
- <h2> <?php _e('Add New Gallery','modula-gallery'); ?> </h2>
13
- <form action="#" method="post">
14
- <?php wp_nonce_field('Modula', 'Modula'); ?>
15
- <input type="hidden" name="enc_images" value="" />
16
 
17
- <fieldset data-step="1">
18
- <div class="row">
19
- <div class="input-field">
20
- <input name="tg_name" id="name" type="text" class="validate" required="required">
21
- <label for="name"><?php _e('Name of the gallery','modula-gallery')?></label>
22
- </div>
23
- </div>
24
- <div class="row">
25
- <div class="input-field">
26
- <input name="tg_description" id="description" type="text" class="validate">
27
- <label for="description"><?php _e('Description of the gallery (for internal use)','modula-gallery')?></label>
28
- </div>
29
- </div>
30
- <div class="row">
31
- <div class="input-field col s6">
32
- <input name="tg_width" id="width" type="text" value="100%">
33
- <label for="width"><?php _e('Gallery width','modula-gallery')?></label>
34
- </div>
35
- <div class="input-field col s6">
36
- <input name="tg_height" id="height" type="text" value="800">
37
- <label for="height"><?php _e('Gallery height in pixels','modula-gallery')?></label>
38
- </div>
39
- </div>
40
- </fieldset>
41
- <fieldset data-step="2" data-branch="images">
42
- <div class="field">
43
- <h5><?php _e('WordPress field for titles:','modula')?></h5>
44
- <select class="browser-default" name="ftg_wp_field_title">
45
- <option value="none">Don't use titles</option>
46
- <option value="title" selected>Title</option>
47
- <option value="description">Description</option>
48
- </select>
49
- </div>
50
- <div class="field">
51
- <h5><?php _e('WordPress field for captions:','modula')?></h5>
52
- <select class="browser-default" name="ftg_wp_field_caption">
53
- <option value="none">Don't use captions</option>
54
- <option value="title">Title</option>
55
- <option value="caption" selected>Caption</option>
56
- <option value="description">Description</option>
57
- </select>
58
- </div>
59
- </fieldset>
60
- <fieldset data-step="3" data-save="true">
61
- <div class="field">
62
- <h5><?php _e('Image size','modula-gallery')?></h5>
63
- <div class="row">
64
- <div class="input-field">
65
- <input name="tg_img_size" id="img_size" type="text" class="validate" required="required" value="500">
66
- <label for="name"><?php _e('Minimum width or height of images','modula-gallery')?></label>
67
- </div>
68
- </div>
69
- <label class="shortpixel">
70
- <img src="<?php echo plugins_url('',__file__) ?>/images/icon-shortpixel.png" alt="ShortPixel">
71
- <a target="_blank" href="https://shortpixel.com/wp/af/N8LKGGT72393"><?php _e('We suggest you to use ShortPixel image optimization plugin for best SEO results.','modula-gallery')?></a></label>
72
- </div>
73
- <div class="field select-images">
74
- <a class="waves-effect waves-light btn add-images">
75
- <i class="mdi mdi-plus left"></i> <?php _e('Add images','modula-gallery')?></a>
76
- <br>
77
- <label><?php _e('You can add images now or later.','modula-gallery')?></label>
78
-
79
- <div class="images list-group"></div>
80
- </div>
81
- </fieldset>
82
 
83
- <footer class="page-footer">
84
- <div class="progress loading hide">
85
- <div class="indeterminate"></div>
86
- </div>
87
 
88
- <a class="waves-effect waves-yellow btn-flat prev"><?php _e('Previous','modula-gallery')?></a>
89
- <a class="waves-effect waves-green btn-flat next"><?php _e('Next','modula-gallery')?></a>
90
- </footer>
91
 
92
- </form>
93
- <div id="success" class="modal">
94
- <div class="modal-content">
95
- <h4><?php _e('Success!','modula-gallery')?></h4>
96
- <p><?php _e('Your gallery','modula-gallery')?> "<span class="gallery-name"></span>" <?php _e('has been created. Copy the following shortcode:','modula-gallery')?><br>
97
- <input type="text" class="code"><br>
98
- <?php _e('and paste it inside a post or a page. Otherwise click','modula-gallery')?> <a class='customize'><?php _e('here','modula-gallery')?></a> <?php _e('to customize
99
- the gallery.','modula-gallery')?>
100
- </p>
101
- </div>
102
- <div class="modal-'footer">
103
- <a href="?page=ModulaLite-admin" id="modal-close" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
104
- </div>
105
- </div>
 
 
106
 
107
- <div id="error" class="modal">
108
- <div class="modal-content">
109
- <h4><?php _e('Error!','modula-gallery')?></h4>
110
- <p><?php _e('For some reason it was not possible to save your gallery','modula-gallery')?></p>
111
- </div>
112
- <div class="modal-footer">
113
- <a href="?page=ModulaLite-admin" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
114
- </div>
115
- </div>
116
- </div>
1
  <?php
2
+ if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
3
+ die( _e( 'You are not allowed to call this page directly.', 'modula-gallery' ) );
4
+ }
5
+
6
+ $tg_subtitle = "New Gallery";
7
  ?>
8
 
9
+ <?php include( "header.php" ) ?>
10
+
11
+
12
+ <div id="modula-wizard">
13
+ <h2> <?php _e( 'Add New Gallery', 'modula-gallery' ); ?> </h2>
14
+ <form action="#" method="post">
15
+ <?php wp_nonce_field( 'Modula', 'Modula' ); ?>
16
+ <input type="hidden" name="enc_images" value=""/>
17
+
18
+ <fieldset data-step="1">
19
+ <div class="row">
20
+ <div class="input-field">
21
+ <input name="tg_name" id="name" type="text" class="validate" required="required">
22
+ <label for="name"><?php echo esc_html__( 'Name of the gallery', 'modula-gallery' ) ?></label>
23
+ </div>
24
+ </div>
25
+ <div class="row">
26
+ <div class="input-field">
27
+ <input name="tg_description" id="description" type="text" class="validate">
28
+ <label for="description"><?php echo esc_html__( 'Description of the gallery (for internal use)', 'modula-gallery' ) ?></label>
29
+ </div>
30
+ </div>
31
+ <div class="row">
32
+ <div class="input-field col s6">
33
+ <input name="tg_width" id="width" type="text" value="100%">
34
+ <label for="width"><?php echo esc_html__( 'Gallery width', 'modula-gallery' ) ?></label>
35
+ </div>
36
+ <div class="input-field col s6">
37
+ <input name="tg_height" id="height" type="text" value="800">
38
+ <label for="height"><?php echo esc_html__( 'Gallery height in pixels', 'modula-gallery' ) ?></label>
39
+ </div>
40
+ </div>
41
+ </fieldset>
42
+ <fieldset data-step="2" data-branch="images">
43
+ <div class="field">
44
+ <h5><?php echo esc_html__( 'WordPress field for titles:', 'modula-gallery' ) ?></h5>
45
+ <select class="browser-default" name="ftg_wp_field_title">
46
+ <option value="none"><?php echo esc_html__( 'Don\'t use titles', 'modula-gallery' ); ?></option>
47
+ <option value="title" selected><?php echo esc_html__( 'Title', 'modula-gallery' ); ?></option>
48
+ <option value="description"><?php echo esc_html__( 'Description', 'modula-gallery' ); ?></option>
49
+ </select>
50
+ </div>
51
+ <div class="field">
52
+ <h5><?php echo esc_html__( 'WordPress field for captions:', 'modula-gallery' ) ?></h5>
53
+ <select class="browser-default" name="ftg_wp_field_caption">
54
+ <option value="none"><?php echo esc_html( 'Don\'t use captions', 'modula-gallery' ); ?></option>
55
+ <option value="title"><?php echo esc_html( 'Title', 'modula-gallery' ); ?></option>
56
+ <option value="caption" selected><?php echo esc_html( 'Captions', 'modula-gallery' ); ?></option>
57
+ <option value="description"><?php echo esc_html( 'Description', 'modula-gallery' ); ?></option>
58
+ </select>
59
+ </div>
60
+ </fieldset>
61
+ <fieldset data-step="3" data-save="true">
62
+ <div class="field">
63
+ <h5><?php echo esc_html__( 'Image size', 'modula-gallery' ) ?></h5>
64
+ <div class="row">
65
+ <div class="input-field">
66
+ <input name="tg_img_size" id="img_size" type="text" class="validate" required="required" value="500">
67
+ <label for="name"><?php echo esc_html__( 'Minimum width or height of images', 'modula-gallery' ) ?></label>
68
+ </div>
69
+ </div>
70
+
71
+ <label class="shortpixel">
72
+ <img src="<?php echo esc_url( plugins_url( '', __file__ ) ); ?>/images/icon-shortpixel.png" alt="ShortPixel">
73
+ <a target="_blank" href="https://shortpixel.com/h/af/HUOYEBB31472"><?php echo esc_html__( 'We suggest using the ShortPixel image optimization plugin to optimize your images and get the best possible SEO results & load speed..', 'modula-gallery' ) ?></a>
74
+ </label>
75
 
76
+ </div>
77
+ <div class="field select-images">
78
+ <a class="waves-effect waves-light btn add-images">
79
+ <i class="mdi mdi-plus left"></i> <?php echo esc_html__( 'Add images', 'modula-gallery' ) ?></a>
80
+ <br> <label><?php echo esc_html__( 'You can add images now or later.', 'modula-gallery' ) ?></label>
81
 
82
+ <div class="images list-group"></div>
83
+ </div>
84
+ </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
+ <footer class="page-footer">
87
+ <div class="progress loading hide">
88
+ <div class="indeterminate"></div>
89
+ </div>
90
 
91
+ <a class="waves-effect waves-yellow btn-flat prev"><?php echo esc_html__( 'Previous', 'modula-gallery' ) ?></a>
92
+ <a class="waves-effect waves-green btn-flat next"><?php echo esc_html__( 'Next', 'modula-gallery' ) ?></a>
93
+ </footer>
94
 
95
+ </form>
96
+ <div id="success" class="modal">
97
+ <div class="modal-content">
98
+ <h4><?php echo esc_html__( 'Success!', 'modula-gallery' ) ?></h4>
99
+ <p><?php echo esc_html__( 'Your gallery', 'modula-gallery' ) ?>
100
+ "<span class="gallery-name"></span>" <?php echo esc_html__( 'has been created. Copy the following shortcode:', 'modula-gallery' ) ?>
101
+ <br> <input type="text" class="code"><br>
102
+ <?php echo esc_html__( 'and paste it inside a post or a page. Otherwise click', 'modula-gallery' ) ?>
103
+ <a class='customize'><?php echo esc_html__( 'here', 'modula-gallery' ) ?></a> <?php echo esc_html__( 'to customize
104
+ the gallery.', 'modula-gallery' ) ?>
105
+ </p>
106
+ </div>
107
+ <div class="modal-'footer">
108
+ <a href="?page=modula-lite-admin" id="modal-close" class="waves-effect waves-green btn-flat modal-action"><?php echo esc_html__( 'Close', 'modula-gallery' ) ?></a>
109
+ </div>
110
+ </div>
111
 
112
+ <div id="error" class="modal">
113
+ <div class="modal-content">
114
+ <h4><?php echo esc_html__( 'Error!', 'modula-gallery' ) ?></h4>
115
+ <p><?php echo esc_html__( 'For some reason it was not possible to save your gallery', 'modula-gallery' ) ?></p>
116
+ </div>
117
+ <div class="modal-footer">
118
+ <a href="?page=modula-lite-admin" class="waves-effect waves-green btn-flat modal-action"><?php echo esc_html__( 'Close', 'modula-gallery' ) ?></a>
119
+ </div>
120
+ </div>
121
+ </div>
admin/css/style.css CHANGED
@@ -1,1490 +1,1487 @@
1
- @charset "UTF-8";
2
-
3
- @font-face {
4
- font-family: "modula-icons";
5
- src:url("../font/modula/modula-icons.eot");
6
- src:url("../font/modula/modula-icons.eot?#iefix") format("embedded-opentype"),
7
- url("../font/modula/modula-icons.woff") format("woff"),
8
- url("../font/modula/modula-icons.ttf") format("truetype"),
9
- url("../font/modula/modula-icons.svg#modula-icons") format("svg");
10
- font-weight: normal;
11
- font-style: normal;
12
-
13
- }
14
-
15
- @font-face {
16
- font-family: 'Roboto';
17
- src: url('../font/roboto/Roboto-Regular-webfont.eot');
18
- src: url('../font/roboto/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
19
- url('../font/roboto/Roboto-Regular-webfont.woff') format('woff'),
20
- url('../font/roboto/Roboto-Regular-webfont.ttf') format('truetype'),
21
- url('../font/roboto/Roboto-Regular-webfont.svg#robotoregular') format('svg');
22
- font-weight: normal;
23
- font-style: normal;
24
-
25
- }
26
-
27
-
28
-
29
- [data-icon]:before {
30
- font-family: "modula-icons" !important;
31
- content: attr(data-icon);
32
- font-style: normal !important;
33
- font-weight: normal !important;
34
- font-variant: normal !important;
35
- text-transform: none !important;
36
- speak: none;
37
- line-height: 1;
38
- -webkit-font-smoothing: antialiased;
39
- -moz-osx-font-smoothing: grayscale;
40
- }
41
-
42
- [class^="icon-"]:before,
43
- [class*=" icon-"]:before {
44
- font-family: "modula-icons" !important;
45
- font-style: normal !important;
46
- font-weight: normal !important;
47
- font-variant: normal !important;
48
- text-transform: none !important;
49
- speak: none;
50
- line-height: 1;
51
- -webkit-font-smoothing: antialiased;
52
- -moz-osx-font-smoothing: grayscale;
53
- }
54
-
55
- .icon-facebook:before {
56
- content: "a";
57
- }
58
- .icon-pinterest:before {
59
- content: "b";
60
- }
61
- .icon-twitter:before {
62
- content: "c";
63
- }
64
- .icon-google-plus:before {
65
- content: "d";
66
- }
67
- .icon-save-disk:before {
68
- content: "e";
69
- }
70
- .icon-angle-up:before {
71
- content: "f";
72
- }
73
- .icon-plus:before {
74
- content: "g";
75
- }
76
- .icon-check-mark-2:before {
77
- content: "h";
78
- }
79
- .icon-chevron-right:before {
80
- content: "i";
81
- }
82
- .dark-content{
83
- opacity: 0.5;
84
- }
85
- body
86
- {
87
- margin:0px;
88
- padding-bottom: 65px;
89
- float: left;
90
- width: 100%;
91
- overflow: visible!important;
92
- }
93
- .image-size-section
94
- {
95
- margin: 10px;
96
- padding: 5px;
97
- }
98
- strong {
99
- font-weight:700;
100
- }
101
-
102
- /*.shortcode-section
103
- {
104
- margin: 48px 0;
105
- padding-left: 43px;
106
- font-size: 1rem;
107
- }*/
108
-
109
- .image-size-section select{
110
- margin-top: 5px;
111
- width: 100%;
112
- }
113
- .page-footer .progress {
114
- display: none;
115
- }
116
- .hide
117
- {
118
- display: none;
119
- }
120
- .editimage-right
121
- {
122
- float:right;
123
- width:60%;
124
- display: block;
125
- margin-left:5px;
126
- }
127
- #image-panel textarea
128
- {
129
- color:black;
130
- }
131
- #image-panel select:not([name=halign]):not([name=valign])
132
- {
133
- width:100%;
134
- }
135
- #image-panel select
136
- {
137
- color:black;
138
- }
139
- .text-input
140
- {
141
- border:1px solid #aaa;
142
- width: 100%;
143
- display: block;
144
- }
145
- .label-text
146
- {
147
- color:black;
148
- font-size: 1rem;
149
- margin: 0px 5px 0px 0px;
150
- font-weight: bold;
151
- }
152
- .label-panel
153
- {
154
- width: 80px;
155
- float:left;
156
- }
157
- .shortpixel {
158
- display: block;
159
- }
160
- .shortpixel img {
161
- position:relative;
162
- top:5px;
163
- }
164
- .dropdown-menu
165
- {
166
- width: 100%;
167
- }
168
- #modula-wizard {
169
- margin: 40px auto;
170
- padding: 20px;
171
- max-width: 600px;
172
- box-shadow: #ccc 0px 0px 40px;
173
- border-radius: 4px;
174
- background: #fff;
175
- }
176
- #modula-wizard fieldset {
177
- border: 0;
178
- display: none;
179
- }
180
- #modula-wizard fieldset:first-of-type {
181
- display: block;
182
- }
183
- #modula-wizard fieldset select {
184
- height: 3rem;
185
- }
186
- #modula-wizard h1 {
187
- font-size: 32px;
188
- text-transform: uppercase;
189
- text-align: center;
190
- margin: 0;
191
- }
192
- #modula-wizard h1 small {
193
- font-size: 12px;
194
- }
195
- #modula-wizard h2 {
196
- font-size: 16px;
197
- text-transform: uppercase;
198
- text-align: center;
199
- margin: 0;
200
- margin-bottom: 50px;
201
- line-height: 1;
202
- }
203
- #modula-wizard h5 {
204
- margin-bottom: 20px;
205
- }
206
- #modula-wizard .field {
207
- margin-bottom: 40px;
208
- }
209
- #modula-wizard .images {
210
- padding: 10px;
211
- max-height: 300px;
212
- overflow: auto;
213
- }
214
- #modula-wizard .images .tile {
215
- margin: 0 10px 10px 0;
216
- width: 23%;
217
- display: inline-block;
218
- position: relative;
219
- }
220
- #modula-wizard .images .tile img {
221
- width: 100%;
222
- }
223
- #modula-wizard .images .tile a {
224
- position: absolute;
225
- top: -5px;
226
- right: -5px;
227
- z-index: 10;
228
- display: none;
229
- width: 26px;
230
- height: 26px;
231
- line-height: 26px;
232
- }
233
-
234
- #modula-wizard .images .tile a i {
235
- line-height: 26px;
236
- font-size: 1.2rem;
237
- }
238
- #modula-wizard .images .tile:hover a {
239
- display: block;
240
- }
241
- #modula-wizard .images .tile:nth-child(4n) {
242
- margin-right: 0;
243
- }
244
- #modula-wizard footer {
245
- background: transparent;
246
- text-align: right;
247
- }
248
- #modula-wizard footer .prev {
249
- visibility: hidden;
250
- }
251
- #wpcontent {
252
- padding-left: 0;
253
- }
254
- #gallery-list {
255
- margin-top: 2rem;
256
- }
257
- #gallery-list .card {
258
- background-color: #6C838B;
259
- padding: 0;
260
- border: none !important;
261
- }
262
- #gallery-list .card .data {
263
- background-size: cover;
264
- background-position: 50% 50%;
265
- }
266
-
267
- .waves-light.btn {
268
- color: #fff;
269
- }
270
- .waves-light.btn:hover {
271
- color: #fff;
272
- }
273
- .card {
274
- padding: 0;
275
- min-width: 0;
276
- max-width: 999em;
277
- }
278
- #top {
279
- padding: 1rem 0 3rem 40px;
280
- /*background-image: url('../images/colors.jpg');*/
281
- background-repeat: repeat-x;
282
- background-position: left bottom;
283
- font-family: Roboto, 'sans-serif';
284
- }
285
- #top h1 {
286
- color: #fff;
287
- font-size: 3.4rem;
288
- margin: 16px 0 25px 0;
289
- font-weight: 300;
290
- }
291
- #top h1 small {
292
- font-size: 1rem;
293
- }
294
- #top h4 {
295
- margin: 17px 0 13px 0;
296
- }
297
- #support-page {
298
- background: #fff;
299
- font-family: Roboto, 'sans-serif';
300
- padding: 40px;
301
- }
302
- .widefat .edit_image_form td {
303
- border-bottom: 0;
304
- border-top: 0;
305
- }
306
-
307
- .widefat th, .widefat td {
308
- overflow: visible;
309
- }
310
-
311
- .widefat tfoot th:first-of-type {
312
- -webkit-border-bottom-left-radius: 0;
313
- border-bottom-left-radius: 0;
314
- }
315
- .widefat tfoot th:last-of-type {
316
- -webkit-border-bottom-right-radius: 0;
317
- border-bottom-rigth-radius: 0;
318
- }
319
- .widefat thead th:first-of-type {
320
- -webkit-border-top-left-radius: 0;
321
- border-bottom-top-radius: 0;
322
- }
323
- .widefat thead th:last-of-type {
324
- -webkit-border-top-rigth-radius: 0;
325
- border-top-right-radius: 0;
326
- }
327
-
328
- #wpcontent {
329
- margin-left: 146px;
330
- padding-left: 20px;
331
- }
332
- #support-page p {
333
- font-size: 16px;
334
- color: #666;
335
- }
336
- #support-page ul {
337
- margin: 40px 20px;
338
- }
339
- #support-page ul li {
340
- list-style-type: circle;
341
- font-size: 18px;
342
- line-height: 1.5;
343
- }
344
- #support-page .buttons {
345
- margin-top: 40px;
346
- }
347
- .ui-dialog.noTitle .ui-dialog-titlebar {
348
- display: none;
349
- }
350
- .modula-header
351
- {
352
- background-color: #51AD31;
353
- margin-left:-10px;
354
- }
355
-
356
- .modula-header h1
357
- {
358
- font-weight: bolder !important;
359
- }
360
- .modula-header h4
361
- {
362
- color: white;
363
- }
364
-
365
- .ui-dialog .loading {
366
- background: url(../loading.gif) no-repeat;
367
- width: 220px;
368
- height: 19px;
369
- margin:50px auto 0 auto;
370
- }
371
- .collapsible {
372
- padding:20px 70px 0px 40px !important;
373
- border: none !important;
374
- box-shadow: none !important;
375
- }
376
- .bd .gallery-hd {
377
- margin: 60px 0;
378
- }
379
- .bd .gallery-hd code {
380
- font-size: 1rem;
381
- }
382
- .input-field {
383
- margin-bottom: 20px;
384
- }
385
- .input-field label {
386
- left: 0;
387
- }
388
- #ftg-wizard {
389
- margin: 40px auto;
390
- padding: 20px;
391
- max-width: 600px;
392
- box-shadow: #ccc 0px 0px 40px;
393
- border-radius: 4px;
394
- background: #fff;
395
- }
396
- #ftg-wizard fieldset {
397
- border: 0;
398
- display: none;
399
- }
400
- #ftg-wizard fieldset:first-of-type {
401
- display: block;
402
- }
403
- #ftg-wizard fieldset select {
404
- height: 3rem;
405
- }
406
- #ftg-wizard h1 {
407
- font-size: 32px;
408
- text-transform: uppercase;
409
- text-align: center;
410
- margin: 0;
411
- }
412
- #ftg-wizard h1 small {
413
- font-size: 12px;
414
- }
415
- #ftg-wizard h2 {
416
- font-size: 16px;
417
- text-transform: uppercase;
418
- text-align: center;
419
- margin: 0;
420
- margin-bottom: 50px;
421
- line-height: 1;
422
- }
423
- #ftg-wizard h5 {
424
- margin-bottom: 20px;
425
- }
426
- #ftg-wizard .field {
427
- margin-bottom: 40px;
428
- }
429
- #ftg-wizard .images {
430
- padding: 10px;
431
- max-height: 300px;
432
- overflow: auto;
433
- }
434
- #ftg-wizard .images .tile {
435
- margin: 0 10px 10px 0;
436
- width: 23%;
437
- display: inline-block;
438
- position: relative;
439
- }
440
- #ftg-wizard .images .tile img {
441
- width: 100%;
442
- }
443
- #ftg-wizard .images .tile a {
444
- position: absolute;
445
- top: -5px;
446
- right: -5px;
447
- z-index: 10;
448
- display: none;
449
- width: 26px;
450
- height: 26px;
451
- line-height: 26px;
452
- }
453
- #ftg-wizard .images .tile a i {
454
- line-height: 26px;
455
- font-size: 1.2rem;
456
- }
457
- #ftg-wizard .images .tile:hover a {
458
- display: block;
459
- }
460
- #ftg-wizard .images .tile:nth-child(4n) {
461
- margin-right: 0;
462
- }
463
- #ftg-wizard footer {
464
- background: transparent;
465
- text-align: right;
466
- }
467
- #ftg-wizard footer .prev {
468
- visibility: hidden;
469
- }
470
- #ftg-wizard .loading {
471
- display: none;
472
- }
473
- .modal p {
474
- font-size: 16px;
475
- }
476
- .modal #modal-close
477
- {
478
- float: right;
479
- }
480
- .modal .code {
481
- display: block;
482
- margin: 20px;
483
- padding: 10px;
484
- font-size: 16px;
485
- }
486
- .modal a {
487
- outline: 0;
488
- }
489
- .modal .modal-content,
490
- .modal .modal-footer {
491
- background: #fff;
492
- }
493
- #gallery-list .card p {
494
- height: 40px;
495
- overflow: hidden;
496
- padding: 4px 8px;
497
- border-radius: 4px;
498
- }
499
- #gallery-list .card .card-action {
500
- padding: 5px 5px;
501
- text-align: center;
502
- border:0;
503
- }
504
- #gallery-list .card.with-image .card-action a {
505
- transition:all .2s;
506
- }
507
- #gallery-list .card .card-action a {
508
- margin: 0 10px;
509
- font-size: 20px;
510
- color: #fff;
511
- padding: 4px;
512
- }
513
- #gallery-list .card .card-image {
514
- display: inline-block;
515
- width: 150px;
516
- height: 150px;
517
- overflow: hidden;
518
- }
519
- #gallery-list .card .card-content {
520
- height: 180px;
521
- cursor: pointer;
522
- letter-spacing: 0.3px;
523
- }
524
- #gallery-list .card.with-image .card-action,
525
- #gallery-list .card.with-image .card-content {
526
- background: rgba(0, 0, 0, .30);
527
- transition:background .4s;
528
- }
529
- #gallery-list .card.with-image:hover .card-action,
530
- #gallery-list .card.with-image:hover .card-content {
531
- background: rgba(0, 0, 0, .60);
532
- }
533
- #gallery-list .card .card-title {
534
- line-height: 32px;
535
- margin-bottom: 18px;
536
- display: block;
537
- font-weight: 400;
538
- padding: 4px 8px;
539
- border-radius: 4px;
540
- }
541
-
542
- #edit-gallery .tab {
543
- padding: 20px;
544
- }
545
- #edit-gallery label {
546
- color: #333;
547
- font-size: 1rem;
548
- top: 0.1rem;
549
- height: auto;
550
- }
551
- #edit-gallery .input-field {
552
- margin-bottom: 0;
553
- }
554
- #edit-gallery .input-field input[type=text],
555
- #edit-gallery .input-field input[type=password],
556
- #edit-gallery .input-field input[type=email],
557
- #edit-gallery .input-field input[type=url],
558
- #edit-gallery .input-field input[type=date],
559
- #edit-gallery .input-field input[type=tel],
560
- #edit-gallery .input-field input[type=number],
561
- #edit-gallery .input-field input[type=search],
562
- #edit-gallery .input-field textarea.materialize-textarea {
563
- font-size: 2rem;
564
- }
565
- #edit-gallery select {
566
- font-size: 1rem;
567
- background: #fff;
568
- }
569
- #edit-gallery .jump-head {
570
- border-bottom: 2px solid rgba(0, 0, 0, 0.3);
571
- padding: 20px 0;
572
- }
573
- #edit-gallery .jump-head select {
574
- height: 2rem;
575
- display: inline;
576
- }
577
- #edit-gallery .jump {
578
- width: auto;
579
- }
580
- .jump-head
581
- {
582
- padding: 40px 0px 40px 10px;
583
- }
584
- .bullet-menu {
585
- position: fixed;
586
- bottom: 20px;
587
- right: 50px;
588
- }
589
- .update-gallery {
590
- position: fixed;
591
- bottom: 20px;
592
- right: 120px;
593
- }
594
- .collapsible li {
595
- margin-bottom: 7px;
596
- margin-left:-20px;
597
- }
598
- .collapsible li .alternate {
599
- background: transparent;
600
- }
601
- .collapsible li .collapsible-header {
602
- font-size: 2rem;
603
- height: 5rem;
604
- line-height: 5rem;
605
- }
606
- .collapsible li .collapsible-header .fa-chevron-right{
607
- float: right;
608
- color: darkgray;
609
- }
610
- .collapsible li .collapsible-header i {
611
- color: #51AD31;
612
- line-height: 5rem;
613
- }
614
- .collapsible li .collapsible-header span{
615
- color: #51AD31;
616
- }
617
- .collapsible li .field .text {
618
- background: #fff;
619
- padding: 20px;
620
- }
621
- .collapsible li .field .text .pickColor {
622
- height: auto;
623
- }
624
- .collapsible li .field .text .wp-color-result {
625
- border-radius: 0;
626
- -webkit-border-radius: 0;
627
- height: 24px;
628
- }
629
- .collapsible li .field .text .wp-color-result::after {
630
- border-radius: 0;
631
- -webkit-border-radius: 0;
632
- }
633
- .collapsible li textarea {
634
- height: 100px;
635
- }
636
- .collapsible li th,
637
- .collapsible li td {
638
- vertical-align: top;
639
- }
640
- .collapsible li th {
641
- border-radius: 0;
642
- }
643
- .collapsible li th[scope=row] {
644
- width: 200px;
645
- padding-top: 30px;
646
- }
647
- .collapsible li tr.ui-slider {
648
- height: auto;
649
- }
650
- .collapsible li tr.filter {
651
- float: none;
652
- margin: 0;
653
- }
654
- .collapsible li .toggle div.help {
655
- display: none;
656
- }
657
- .collapsible li .toggle div.help strong {
658
- font-weight: bold;
659
- }
660
-
661
- .collapsible li .toggle [type="checkbox"]:not(:checked) + label:before {
662
- top: 4px;
663
- }
664
-
665
- .checkbox, .checkbox-light, .radio, .radio-light {
666
- background: url("../images/checkbox/square.png") 0 0 no-repeat;
667
- color: #dddddd;
668
- cursor: pointer;
669
- padding: 1px 0 3px 25px;
670
- position: relative; }
671
- .checkbox:hover, .checkbox-light:hover, .radio:hover, .radio-light:hover {
672
- background-position: 0 -26px;
673
- color: white; }
674
- .checkbox.checked, .checked.checkbox-light, .checked.radio, .checked.radio-light {
675
- background-position: 0 -53px; }
676
- .checkbox.checked:hover, .checked.checkbox-light:hover, .checked.radio:hover, .checked.radio-light:hover {
677
- background-position: 0 -80px; }
678
-
679
- .checkbox-light {
680
- background-image: url("../images/checkbox/square-light.png"); }
681
- .collapsible li div.help {
682
- background: rgba(255, 255, 255, 0.5);
683
- border-top-left-radius: 0;
684
- border-top-right-radius: 0;
685
- border-bottom-left-radius: 6px;
686
- border-bottom-right-radius: 6px;
687
- padding: 10px;
688
- color: #666;
689
- }
690
- .collapsible li .custom_isf td th {
691
- background: #333;
692
- color: #fff;
693
- }
694
- .collapsible li .custom_isf td td input[type=text] {
695
- background: #fff;
696
- }
697
- .collapsible li .dynamic-table tr {
698
- background: #fff;
699
- }
700
- .collapsible li .dynamic-table .btn {
701
- outline: 0;
702
- color: #fff;
703
- }
704
- .collapsible li .dynamic-table .btn:hover {
705
- color: #fff;
706
- }
707
- .collapsible li .dynamic-table .btn.add {
708
- width: 100%;
709
- }
710
- .collapsible li .dynamic-table .del {
711
- width: 50px;
712
- padding-left: 10px;
713
- padding-top: 18px;
714
- }
715
- .collapsible li td .filters .text p {
716
- padding: 0;
717
- }
718
- .collapsible li td .filters .text p a {
719
- display: inline-block;
720
- margin-right: 20px;
721
- }
722
- .collapsible li td .filters .text p input[type=text] {
723
- width: 77%;
724
- }
725
- #tutorial h5 {
726
- margin: 60px 0 20px;
727
- }
728
- #images .item
729
- {
730
- width:160px;
731
- padding:0px 10px 0px 0px;
732
- /*background:#333;*/
733
- /*border:1px solid #111;*/
734
- float:left;
735
- height:295px;
736
- margin:10px 10px 0 0;
737
- position: relative;
738
- }
739
-
740
- #images .item .size {
741
- position: absolute;
742
- bottom: 6px;
743
- left: 10px;
744
- background: #333;
745
- color: #ccc;
746
- padding: 4px;
747
- display: block;
748
- font-size: 9px;
749
- font-family: monaco,courier, monospace;
750
- }
751
- #images .item .name {
752
- position:absolute;
753
- top:35px;
754
- width:150px;
755
- background: rgba(0,0,0,.5);
756
- color: #fff;
757
- font-size:10px;
758
- left:10px;
759
- z-index:100;
760
- height:20px;
761
- overflow: hidden;
762
- }
763
- #images .item .del {
764
- position: absolute;
765
- top:4px;
766
- right:4px;
767
- width: 20px;
768
- height: 20px;
769
- text-decoration: none;
770
- color: #000;
771
- display: none;
772
- background:#111;
773
- }
774
- #images .item .icons {
775
- /*border-bottom: 1px solid #222;*/
776
- margin-bottom: 9px;
777
- }
778
- #images .item .selection {
779
- float: right;
780
- margin-top: 5px;
781
- height: 12px;
782
- }
783
-
784
- #images .figure {
785
- margin:0;
786
- padding: 0;
787
- width:90%;
788
- height: 120px;
789
- overflow: hidden;
790
- display: table-cell;
791
- vertical-align: middle;
792
- text-align: center;
793
- background-size: cover;
794
- }
795
- #images .figure img {
796
- width:160px;
797
- cursor: pointer;
798
- }
799
- #images .item .data {
800
- display: none;
801
- }
802
-
803
- #image-panel {
804
- background: white;
805
- width:700px;
806
- height:auto;
807
- margin-left: -300px;
808
- position: absolute;
809
- top: 30%;
810
- left: 50%;
811
- z-index: 1001;
812
- box-shadow: #000 0px 0px 20px;
813
- /*border:4px solid #111;*/
814
- padding: 10px;
815
- }
816
- #image-panel .filters {
817
- clear: both;
818
- margin-top: 10px;
819
- }
820
- #image-panel .filters .checkbox {
821
- float: left;
822
- margin-right: 20px;
823
- padding-left: 20px;
824
- }
825
- #image-panel .left {
826
- float:left;
827
- }
828
- #image-panel .figure {
829
- width:200px;
830
- height:200px;
831
- overflow:hidden;
832
- padding: 0;
833
- margin: 0 0 10px 0;
834
- padding: 2px;
835
- border: 1px solid #999;
836
- background: white;
837
- }
838
- #image-panel .figure img {
839
- width:100%;
840
- }
841
- #image-panel .right {
842
- float:left;
843
- margin-left:20px;
844
- }
845
- #image-panel .field {
846
- padding-bottom: 5px;
847
- color: #aaa;
848
- /*border-bottom: 1px solid #555;*/
849
- margin-bottom: 5px;
850
- }
851
- #image-panel .field:last-of-type {
852
- border-bottom: 0;
853
- }
854
- #image-panel .field label {
855
- margin-bottom: 5px;
856
- display: block;
857
- font-weight: bold;
858
- color: black;
859
- }
860
- #image-panel .field textarea {
861
- width: 100%;
862
- height: 60px;
863
- }
864
- #image-panel .actions li {
865
- height: 22px;
866
- margin:0;
867
- }
868
- #image-panel .close {
869
- position: absolute;
870
- top:0;
871
- right:0;
872
- display: block;
873
- background: white;
874
- border-bottom-left-radius: 30px;
875
- width: 30px;
876
- height: 30px;
877
- line-height: 24px;
878
- text-indent: 15px;
879
- text-decoration: none;
880
- color: #fff;
881
- font-family: arial;
882
- font-weight: bold;
883
- }
884
-
885
- #images .actions {
886
- padding: 10px 10px 10px 10px;
887
- background: #242521;
888
- }
889
- #images .bulk {
890
- padding: 10px 10px 10px 10px;
891
- /*background: #444531;*/
892
- /*border:1px solid #111;*/
893
- margin-top: 2px;
894
- }
895
- #images .bulk h4 {
896
- margin:0 0 4px 0;
897
- color: #fff;
898
- }
899
- #images .bulk .checkbox {
900
- display: inline-block;
901
- padding-left: 20px;
902
- margin-right: 15px;
903
- }
904
- #images .bulk .options a {
905
- display: inline-block;
906
- margin-right: 10px;
907
- color: #fff;
908
- text-decoration: none;
909
- }
910
- #images .bulk .options a:hover {
911
- /*color: #fff;*/
912
- }
913
- #images .bulk .panel {
914
- display: none;
915
- padding: 12px;
916
- background: transparent;
917
- margin-top: 5px;
918
- /*border: 1px solid #333222;*/
919
- }
920
- #images .bulk .panel strong {
921
- color: black;
922
- display: block;
923
- margin-bottom: 4px;
924
- }
925
-
926
- #images .bulk .panel p {
927
- padding: 10px 0px 10px 0px;
928
- margin-bottom: 0;
929
- color: black;
930
- }
931
- #images .tips {
932
- margin-bottom: 15px;
933
- }
934
- #images .tip {
935
- background: url('../images/tip.png') no-repeat;
936
- text-indent: 21px;
937
- display: block;
938
- margin: 0 0 0 15px;
939
- }
940
- #images .shortpixel {
941
-
942
- }
943
- #images .btn.action {
944
- margin-bottom: 0;
945
- }
946
-
947
- .clearfix:after {
948
- content: ".";
949
- display: block;
950
- clear: both;
951
- visibility: hidden;
952
- line-height: 0;
953
- height: 0;
954
- }
955
- #image-panel .buttons {
956
- text-align: right;
957
- margin-top: 10px;
958
- clear: both;
959
- }
960
- #image-panel .buttons a {
961
- margin-left: 10px;
962
- }
963
- #images .actions {
964
- background: rgba(255, 255, 255, 0.5);
965
- padding: 10px;
966
- margin: 10px;
967
- }
968
- #images .actions label {
969
- font-weight: bold;
970
- cursor: default;
971
- display: block;
972
- margin-bottom: 10px;
973
- }
974
- #images .actions label span {
975
- font-weight: normal;
976
- padding-left: 10px;
977
- }
978
- #images .actions .row {
979
- margin: 0 0 10px 0;
980
- }
981
- #images .actions .bulk .panel {
982
- display: none;
983
- }
984
- #images p label{
985
- display: inline-block;
986
- margin-right: 30px;
987
- padding-left: 28px;
988
- }
989
- #image-panel .filters label
990
- {
991
- margin-right: 30px;
992
- padding-left:28px;
993
- color: #333;
994
- float:left;
995
- font-size: 1rem;
996
- top: .1rem;
997
- height: auto;
998
- }
999
- .filters-bulk-label {
1000
- display: inline-block;
1001
- margin-right: 30px;
1002
- line-height: 30px;
1003
- padding-left: 28px;
1004
- }
1005
- #images .actions .bulk .panel p {
1006
- padding: 1rem 0;
1007
- }
1008
- #images .actions .tips {
1009
- font-style: italic;
1010
- color: #777;
1011
- padding: 5px 10px;
1012
- background: rgba(255, 255, 255, 0.7);
1013
- border-radius: 4px;
1014
- }
1015
- #images .actions .tips strong {
1016
- font-weight: 700;
1017
- }
1018
- #image-panel-model[data-source=posts] {
1019
- width: 300px;
1020
- }
1021
- #image-panel-model[data-source=posts] .right-side {
1022
- display: none;
1023
- }
1024
- #image-panel-model .right-side {
1025
- margin-left: 170px;
1026
- }
1027
- #image-panel-model .right-side textarea {
1028
- height: 3.75rem;
1029
- }
1030
- #image-panel-model .right-side input[type=text],
1031
- #image-panel-model .right-side textarea {
1032
- border: 1px solid #9E9E9E;
1033
- }
1034
- #image-panel-model .right-side .filters {
1035
- margin-top: 15px;
1036
- }
1037
- #image-panel-model .right-side .filters label {
1038
- margin-right: 30px;
1039
- padding-left: 28px;
1040
- }
1041
- #video-panel-model textarea {
1042
- height: 160px;
1043
- }
1044
- #image-list .card.selected {
1045
- border: 2px solid #000;
1046
- }
1047
- #image-list .card .card-image {
1048
- cursor: move;
1049
- }
1050
- #image-list .card .card-image iframe {
1051
- width: 100%;
1052
- }
1053
- #image-list .card p {
1054
- padding: 0;
1055
- min-height: 20px;
1056
- }
1057
- #image-list .card .filters {
1058
- position: absolute;
1059
- top: 10px;
1060
- left: 0px;
1061
- }
1062
- #image-list .card .filters li {
1063
- background: #fff;
1064
- color: #666;
1065
- padding: 2px 10px;
1066
- margin: 0 0 2px 0;
1067
- border-top-right-radius: 4px;
1068
- }
1069
- #delete-gallery-modal span {
1070
- color: #ff8a0b;
1071
- font-weight: bold;
1072
- }
1073
- #spinner {
1074
- display: none;
1075
- position: fixed;
1076
- top: 50px;
1077
- right: 50px;
1078
- }
1079
- #spinner.shown {
1080
- display: block;
1081
- }
1082
- .pro-cell {
1083
- background: #DAA308;
1084
- font-size: 18px;
1085
- padding: 10px;
1086
- transition: all .15s;
1087
- opacity: 1;
1088
- }
1089
- .button-bg {
1090
- background: #DAA308;
1091
- }
1092
- .btn.button-bg:hover {
1093
- background: #bc8f15;
1094
- }
1095
- .btn:hover {
1096
- color:#fff;
1097
- }
1098
- .pro-cell:hover {
1099
- opacity: .8;
1100
- }
1101
- .pro-cell a {
1102
- transition: all .3s;
1103
- color: #fff;
1104
- }
1105
- /**
1106
- * For modern browsers
1107
- * 1. The space content is one way to avoid an Opera bug when the
1108
- * contenteditable attribute is included anywhere else in the document.
1109
- * Otherwise it causes space to appear at the top and bottom of elements
1110
- * that are clearfixed.
1111
- * 2. The use of `table` rather than `block` is only necessary if using
1112
- * `:before` to contain the top-margins of child elements.
1113
- */
1114
- .cf:before,
1115
- .cf:after {
1116
- content: " ";
1117
- /* 1 */
1118
- display: table;
1119
- /* 2 */
1120
- }
1121
- .cf:after {
1122
- clear: both;
1123
- }
1124
- /**
1125
- * For IE 6/7 only
1126
- * Include this rule to trigger hasLayout and contain floats.
1127
- */
1128
- .cf {
1129
- *zoom: 1;
1130
- }
1131
-
1132
- .li
1133
- {
1134
- cursor:pointer;
1135
- font-size:16px;
1136
- display:inline;
1137
- float:left;
1138
- margin-left:7px;
1139
- }
1140
-
1141
- .listview
1142
- {
1143
- font-size:16px;
1144
- display:inline;
1145
- float:left;
1146
- margin-left:7px;
1147
- }
1148
-
1149
- .menu_activ
1150
- {
1151
- cursor: pointer;
1152
- font-size:16px;
1153
- display:inline;
1154
- float:left;
1155
- margin-left:7px;
1156
- color:red;
1157
- }
1158
- /*.hide
1159
- {
1160
- display:none;
1161
- }
1162
- .padd
1163
- {
1164
- padding:2px;
1165
- }*/
1166
-
1167
- #image-list .small .card-title
1168
- {
1169
- display: none;
1170
- }
1171
-
1172
- #image-list .small .card-content
1173
- {
1174
- display: none;
1175
- }
1176
-
1177
- #image-list .small .card-action
1178
- {
1179
- background-color:#402723;
1180
- padding:5px;
1181
- text-align: center;
1182
- }
1183
-
1184
-
1185
- #image-list .medium .card-action i
1186
- {
1187
- text-align: center;
1188
- display: none;
1189
- }
1190
-
1191
- #image-list .big .card-action i
1192
- {
1193
- text-align: center;
1194
-
1195
- display: none;
1196
- }
1197
-
1198
-
1199
- #image-list .small .card-action a span
1200
- {
1201
- display:none;
1202
- }
1203
- #image-list .small .card-action .remove span
1204
- {
1205
- display: none;
1206
- }
1207
-
1208
- {
1209
- display:none;
1210
- }
1211
- #image-list .small .card-action a i
1212
- {
1213
- color:white;
1214
- }
1215
-
1216
- .filter-list
1217
- {
1218
- border-radius: 3px;
1219
- margin-left: 10px;
1220
- margin-right: 10px;
1221
- padding: 12px;
1222
- background-color: #FFF9F0;
1223
- }
1224
-
1225
- .list-view
1226
- {
1227
- float: left;
1228
- font-size: 16px;
1229
- }
1230
-
1231
- .filter-select-control{
1232
- float: left;
1233
- }
1234
- .filter-item
1235
- {
1236
- cursor: pointer;
1237
- display: inline;
1238
- float: left;
1239
- font-size: 16px;
1240
- margin-left: 10px !important;
1241
- }
1242
-
1243
- .menu-activ
1244
- {
1245
- color: red;
1246
- }
1247
-
1248
- .import-export
1249
- {
1250
- padding-left: 42px;
1251
- margin-top: 20px;
1252
- padding-bottom: 50px;
1253
- }
1254
- .import-export a
1255
- {
1256
- display: block;
1257
- padding: 10px 21px 11px 49px;
1258
- width: 145px;
1259
- float: left;
1260
- margin-right: 15px;
1261
- color: #ADACAC;
1262
- background-color: white;
1263
- }
1264
-
1265
- .import-export a:hover
1266
- {
1267
- background-color: #51AD31;
1268
- color: white;
1269
- }
1270
-
1271
- #import-modal textarea, #export-modal textarea
1272
- {
1273
- height: 100px;
1274
- }
1275
-
1276
- .collapsible .active .collapsible-header
1277
- {
1278
- background-color: #51AD31 !important;
1279
- }
1280
- .collapsible .active .collapsible-header span,
1281
- .collapsible .active .collapsible-header i
1282
- {
1283
- color: white;
1284
- }
1285
-
1286
- .collapsible .active .collapsible-body
1287
- {
1288
- background-color: white;
1289
- }
1290
-
1291
- .backdrop
1292
- {
1293
- background: green;
1294
- }
1295
-
1296
- .select-effect
1297
- {
1298
- display: block;
1299
- width: 34%;
1300
- height: 50px !important;
1301
- border-radius: 5px;
1302
- }
1303
-
1304
-
1305
- #hover-effect th
1306
- {
1307
- display: none;
1308
- }
1309
- #hover-effect .panel {
1310
- padding: 20px;
1311
- background: #fafafa;
1312
- }
1313
- #hover-effect .effect-description
1314
- {
1315
- display: block;
1316
- color: #51AD31;
1317
- padding-bottom: 12px;
1318
- font-size: 18px;
1319
- font-weight: normal;
1320
- }
1321
-
1322
- #hover-effect .help
1323
- {
1324
- display: none;
1325
- }
1326
-
1327
- #hover-effect .effect-color
1328
- {
1329
- display: block !important;
1330
- }
1331
- #hover-effect .effect-img
1332
- {
1333
- padding: 17px 0px;
1334
- float: left;
1335
- }
1336
-
1337
- #hover-effect .effect-compatibility
1338
- {
1339
- margin-left: 430px;
1340
- }
1341
-
1342
- #hover-effect .effect-compatibility label
1343
- {
1344
- display: block;
1345
- margin-bottom: 5px;
1346
- }
1347
-
1348
- #hover-effect .effect-compatibility label span
1349
- {
1350
- display: block;
1351
- font-size: 14px;
1352
- margin: 10px;
1353
- }
1354
-
1355
- #hover-effect .jump-head
1356
- {
1357
- display: none;
1358
- }
1359
-
1360
- #hover-effect .fa-check
1361
- {
1362
- color: green;
1363
- }
1364
- #hover-effect .fa-times
1365
- {
1366
- color: red;
1367
- }
1368
- #hover-effect .preview {
1369
- float: none;
1370
- }
1371
- #hover-effect .preview .item {
1372
- width:400px;
1373
- height:267px;
1374
- overflow: hidden;
1375
- position: relative;
1376
- float: left;
1377
- }
1378
- #hover-effect .preview .item img {
1379
- position: absolute;
1380
- }
1381
- .modula .items .item .figc {
1382
- display: flex;
1383
- align-items: center;
1384
- justify-content: center;
1385
- color: #fff;
1386
- font-size: 11px;
1387
- text-align: center;
1388
- position: absolute;
1389
- left: 0;
1390
- width: 100%;
1391
- padding: 0;
1392
- }
1393
- .modula .items .item .figc {
1394
- width:400px;
1395
- height:267px;
1396
- color: #fff;
1397
- font-size: 11px;
1398
- text-align: center;
1399
- position: absolute;
1400
- left: 0;
1401
- width: 100%;
1402
- padding: 0;
1403
- }
1404
- .modula .items .item .figc h2 {
1405
- font-size: 21px;
1406
- color:#fff;
1407
- }
1408
- .modula .items .item .figc p {
1409
- color:#fff;
1410
- font-size: 15px;
1411
- font-style: normal;
1412
- }
1413
- .modula .item .jtg-social a {
1414
- font-size: 17px;
1415
- }
1416
- .all-effects {
1417
- display: inline-block;
1418
- margin: 20px 0;
1419
- color:#fff;
1420
- font-size: 16px;
1421
- background: #DAA308;
1422
- padding: 6px 12px;
1423
- transition:all .2s;
1424
- }
1425
- .all-effects:hover {
1426
- opacity: .8;
1427
- color:#fff;
1428
- }
1429
- .setting
1430
- {
1431
- color: #ADACAC;
1432
- padding-left: 45px;
1433
- margin-bottom: 15px;
1434
- }
1435
- #modula-survey {
1436
- float: none;
1437
- height: auto;
1438
- background: none;
1439
- border:0;
1440
- box-shadow: none;
1441
- position: relative;
1442
- margin-top: 14px;
1443
- }
1444
- #modula-survey img {
1445
- position: relative;
1446
- z-index: 10;
1447
- }
1448
- #modula-survey span {
1449
- position: absolute;
1450
- z-index: 1;
1451
- top: 14px;
1452
- font-size: 14px;
1453
- background-color: #fff;
1454
- padding: 10px 20px 10px 40px;
1455
- left: 60px;
1456
- box-shadow: #ccc 0px 0px 4px;
1457
- }
1458
- #other-galleries .cta {
1459
- width:170px;
1460
- text-align: right;
1461
- }
1462
- #other-galleries .text {
1463
- font-size: 17px;
1464
- width:calc(100% - 180px);
1465
- padding-right: 20px;
1466
- height: 150px;
1467
- }
1468
- #other-galleries .text h4 {
1469
- font-size: 19px;
1470
- font-weight: bold;
1471
- }
1472
- #other-galleries .text,
1473
- #other-galleries .cta {
1474
- display: inline-block;
1475
- vertical-align: top;
1476
- }
1477
- #other-galleries .cta a {
1478
- margin-right: 0;
1479
- margin-top: 69px;
1480
- }
1481
- #other-galleries * {
1482
- outline: 0;
1483
- }
1484
- #adminmenu .wp-submenu .modula-jump-pro-menu {
1485
- color:#22e34f;
1486
- font-weight: bold;
1487
- }
1488
- #external-galleries input[type=checkbox] {
1489
- position: static;
1490
  }
1
+ @charset "UTF-8";
2
+
3
+ @font-face {
4
+ font-family: "modula-icons";
5
+ src:url("../font/modula/modula-icons.eot");
6
+ src:url("../font/modula/modula-icons.eot?#iefix") format("embedded-opentype"),
7
+ url("../font/modula/modula-icons.woff") format("woff"),
8
+ url("../font/modula/modula-icons.ttf") format("truetype"),
9
+ url("../font/modula/modula-icons.svg#modula-icons") format("svg");
10
+ font-weight: normal;
11
+ font-style: normal;
12
+
13
+ }
14
+
15
+ @font-face {
16
+ font-family: 'Roboto';
17
+ src: url('../font/roboto/Roboto-Regular-webfont.eot');
18
+ src: url('../font/roboto/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
19
+ url('../font/roboto/Roboto-Regular-webfont.woff') format('woff'),
20
+ url('../font/roboto/Roboto-Regular-webfont.ttf') format('truetype'),
21
+ url('../font/roboto/Roboto-Regular-webfont.svg#robotoregular') format('svg');
22
+ font-weight: normal;
23
+ font-style: normal;
24
+
25
+ }
26
+
27
+
28
+
29
+ [data-icon]:before {
30
+ font-family: "modula-icons" !important;
31
+ content: attr(data-icon);
32
+ font-style: normal !important;
33
+ font-weight: normal !important;
34
+ font-variant: normal !important;
35
+ text-transform: none !important;
36
+ speak: none;
37
+ line-height: 1;
38
+ -webkit-font-smoothing: antialiased;
39
+ -moz-osx-font-smoothing: grayscale;
40
+ }
41
+
42
+ [class^="icon-"]:before,
43
+ [class*=" icon-"]:before {
44
+ font-family: "modula-icons" !important;
45
+ font-style: normal !important;
46
+ font-weight: normal !important;
47
+ font-variant: normal !important;
48
+ text-transform: none !important;
49
+ speak: none;
50
+ line-height: 1;
51
+ -webkit-font-smoothing: antialiased;
52
+ -moz-osx-font-smoothing: grayscale;
53
+ }
54
+
55
+ .icon-facebook:before {
56
+ content: "a";
57
+ }
58
+ .icon-pinterest:before {
59
+ content: "b";
60
+ }
61
+ .icon-twitter:before {
62
+ content: "c";
63
+ }
64
+ .icon-google-plus:before {
65
+ content: "d";
66
+ }
67
+ .icon-save-disk:before {
68
+ content: "e";
69
+ }
70
+ .icon-angle-up:before {
71
+ content: "f";
72
+ }
73
+ .icon-plus:before {
74
+ content: "g";
75
+ }
76
+ .icon-check-mark-2:before {
77
+ content: "h";
78
+ }
79
+ .icon-chevron-right:before {
80
+ content: "i";
81
+ }
82
+ .dark-content{
83
+ opacity: 0.5;
84
+ }
85
+ body
86
+ {
87
+ margin:0px;
88
+ padding-bottom: 65px;
89
+ float: left;
90
+ width: 100%;
91
+ overflow: visible!important;
92
+ }
93
+ .image-size-section
94
+ {
95
+ margin: 10px;
96
+ padding: 5px;
97
+ }
98
+ strong {
99
+ font-weight:700;
100
+ }
101
+
102
+ /*.shortcode-section
103
+ {
104
+ margin: 48px 0;
105
+ padding-left: 43px;
106
+ font-size: 1rem;
107
+ }*/
108
+
109
+ .image-size-section select{
110
+ margin-top: 5px;
111
+ width: 100%;
112
+ }
113
+ .page-footer .progress {
114
+ display: none;
115
+ }
116
+ .hide
117
+ {
118
+ display: none;
119
+ }
120
+ .editimage-right
121
+ {
122
+ float:right;
123
+ width:60%;
124
+ display: block;
125
+ margin-left:5px;
126
+ }
127
+ #image-panel textarea
128
+ {
129
+ color:black;
130
+ }
131
+ #image-panel select:not([name=halign]):not([name=valign])
132
+ {
133
+ width:100%;
134
+ }
135
+ #image-panel select
136
+ {
137
+ color:black;
138
+ }
139
+ .text-input
140
+ {
141
+ border:1px solid #aaa;
142
+ width: 100%;
143
+ display: block;
144
+ }
145
+ .label-text
146
+ {
147
+ color:black;
148
+ font-size: 1rem;
149
+ margin: 0px 5px 0px 0px;
150
+ font-weight: bold;
151
+ }
152
+ .label-panel
153
+ {
154
+ width: 80px;
155
+ float:left;
156
+ }
157
+ .shortpixel {
158
+ display: block;
159
+ }
160
+ .shortpixel img {
161
+ position:relative;
162
+ top:5px;
163
+ }
164
+ .dropdown-menu
165
+ {
166
+ width: 100%;
167
+ }
168
+ #modula-wizard {
169
+ margin: 40px auto;
170
+ padding: 20px;
171
+ max-width: 600px;
172
+ box-shadow: #ccc 0px 0px 40px;
173
+ border-radius: 4px;
174
+ background: #fff;
175
+ }
176
+ #modula-wizard fieldset {
177
+ border: 0;
178
+ display: none;
179
+ }
180
+ #modula-wizard fieldset:first-of-type {
181
+ display: block;
182
+ }
183
+ #modula-wizard fieldset select {
184
+ height: 3rem;
185
+ }
186
+ #modula-wizard h1 {
187
+ font-size: 32px;
188
+ text-transform: uppercase;
189
+ text-align: center;
190
+ margin: 0;
191
+ }
192
+ #modula-wizard h1 small {
193
+ font-size: 12px;
194
+ }
195
+ #modula-wizard h2 {
196
+ font-size: 16px;
197
+ text-transform: uppercase;
198
+ text-align: center;
199
+ margin: 0;
200
+ margin-bottom: 50px;
201
+ line-height: 1;
202
+ }
203
+ #modula-wizard h5 {
204
+ margin-bottom: 20px;
205
+ }
206
+ #modula-wizard .field {
207
+ margin-bottom: 40px;
208
+ }
209
+ #modula-wizard .images {
210
+ padding: 10px;
211
+ max-height: 300px;
212
+ overflow: auto;
213
+ }
214
+ #modula-wizard .images .tile {
215
+ margin: 0 10px 10px 0;
216
+ width: 23%;
217
+ display: inline-block;
218
+ position: relative;
219
+ }
220
+ #modula-wizard .images .tile img {
221
+ width: 100%;
222
+ }
223
+ #modula-wizard .images .tile a {
224
+ position: absolute;
225
+ top: -5px;
226
+ right: -5px;
227
+ z-index: 10;
228
+ display: none;
229
+ width: 26px;
230
+ height: 26px;
231
+ line-height: 26px;
232
+ }
233
+
234
+ #modula-wizard .images .tile a i {
235
+ line-height: 26px;
236
+ font-size: 1.2rem;
237
+ }
238
+ #modula-wizard .images .tile:hover a {
239
+ display: block;
240
+ }
241
+ #modula-wizard .images .tile:nth-child(4n) {
242
+ margin-right: 0;
243
+ }
244
+ #modula-wizard footer {
245
+ background: transparent;
246
+ text-align: right;
247
+ }
248
+ #modula-wizard footer .prev {
249
+ visibility: hidden;
250
+ }
251
+ #wpcontent {
252
+ padding-left: 0;
253
+ }
254
+ #gallery-list {
255
+ margin-top: 2rem;
256
+ }
257
+ #gallery-list .card {
258
+ background-color: #6C838B;
259
+ padding: 0;
260
+ border: none !important;
261
+ }
262
+ #gallery-list .card .data {
263
+ background-size: cover;
264
+ background-position: 50% 50%;
265
+ }
266
+
267
+ .waves-light.btn {
268
+ color: #fff;
269
+ }
270
+ .waves-light.btn:hover {
271
+ color: #fff;
272
+ }
273
+ .card {
274
+ padding: 0;
275
+ min-width: 0;
276
+ max-width: 999em;
277
+ }
278
+ #top {
279
+ padding: 1rem 0 3rem 40px;
280
+ /*background-image: url('../images/colors.jpg');*/
281
+ background-repeat: repeat-x;
282
+ background-position: left bottom;
283
+ font-family: Roboto, 'sans-serif';
284
+ }
285
+ #top h1 {
286
+ color: #fff;
287
+ font-size: 3.4rem;
288
+ margin: 16px 0 25px 0;
289
+ font-weight: 300;
290
+ }
291
+ #top h1 small {
292
+ font-size: 1rem;
293
+ }
294
+ #top h4 {
295
+ margin: 17px 0 13px 0;
296
+ }
297
+ #support-page {
298
+ background: #fff;
299
+ font-family: Roboto, 'sans-serif';
300
+ padding: 40px;
301
+ }
302
+ .widefat .edit_image_form td {
303
+ border-bottom: 0;
304
+ border-top: 0;
305
+ }
306
+
307
+ .widefat th, .widefat td {
308
+ overflow: visible;
309
+ }
310
+
311
+ .widefat tfoot th:first-of-type {
312
+ -webkit-border-bottom-left-radius: 0;
313
+ border-bottom-left-radius: 0;
314
+ }
315
+ .widefat tfoot th:last-of-type {
316
+ -webkit-border-bottom-right-radius: 0;
317
+ border-bottom-rigth-radius: 0;
318
+ }
319
+ .widefat thead th:first-of-type {
320
+ -webkit-border-top-left-radius: 0;
321
+ border-bottom-top-radius: 0;
322
+ }
323
+ .widefat thead th:last-of-type {
324
+ -webkit-border-top-rigth-radius: 0;
325
+ border-top-right-radius: 0;
326
+ }
327
+
328
+ #wpcontent {
329
+ margin-left: 146px;
330
+ padding-left: 20px;
331
+ }
332
+ #support-page p {
333
+ font-size: 16px;
334
+ color: #666;
335
+ }
336
+ #support-page ul {
337
+ margin: 40px 20px;
338
+ }
339
+ #support-page ul li {
340
+ list-style-type: circle;
341
+ font-size: 18px;
342
+ line-height: 1.5;
343
+ }
344
+ #support-page .buttons {
345
+ margin-top: 40px;
346
+ }
347
+ .ui-dialog.noTitle .ui-dialog-titlebar {
348
+ display: none;
349
+ }
350
+ .modula-header
351
+ {
352
+ background-color: #51AD31;
353
+ margin-left:-10px;
354
+ }
355
+
356
+ .modula-header h1
357
+ {
358
+ font-weight: bolder !important;
359
+ }
360
+ .modula-header h4
361
+ {
362
+ color: white;
363
+ }
364
+
365
+ .ui-dialog .loading {
366
+ background: url(../loading.gif) no-repeat;
367
+ width: 220px;
368
+ height: 19px;
369
+ margin:50px auto 0 auto;
370
+ }
371
+ .collapsible {
372
+ padding:20px 70px 0px 40px !important;
373
+ border: none !important;
374
+ box-shadow: none !important;
375
+ }
376
+ .bd .gallery-hd {
377
+ margin: 60px 0;
378
+ }
379
+ .bd .gallery-hd code {
380
+ font-size: 1rem;
381
+ }
382
+ .input-field {
383
+ margin-bottom: 20px;
384
+ }
385
+ .input-field label {
386
+ left: 0;
387
+ }
388
+ #ftg-wizard {
389
+ margin: 40px auto;
390
+ padding: 20px;
391
+ max-width: 600px;
392
+ box-shadow: #ccc 0px 0px 40px;
393
+ border-radius: 4px;
394
+ background: #fff;
395
+ }
396
+ #ftg-wizard fieldset {
397
+ border: 0;
398
+ display: none;
399
+ }
400
+ #ftg-wizard fieldset:first-of-type {
401
+ display: block;
402
+ }
403
+ #ftg-wizard fieldset select {
404
+ height: 3rem;
405
+ }
406
+ #ftg-wizard h1 {
407
+ font-size: 32px;
408
+ text-transform: uppercase;
409
+ text-align: center;
410
+ margin: 0;
411
+ }
412
+ #ftg-wizard h1 small {
413
+ font-size: 12px;
414
+ }
415
+ #ftg-wizard h2 {
416
+ font-size: 16px;
417
+ text-transform: uppercase;
418
+ text-align: center;
419
+ margin: 0;
420
+ margin-bottom: 50px;
421
+ line-height: 1;
422
+ }
423
+ #ftg-wizard h5 {
424
+ margin-bottom: 20px;
425
+ }
426
+ #ftg-wizard .field {
427
+ margin-bottom: 40px;
428
+ }
429
+ #ftg-wizard .images {
430
+ padding: 10px;
431
+ max-height: 300px;
432
+ overflow: auto;
433
+ }
434
+ #ftg-wizard .images .tile {
435
+ margin: 0 10px 10px 0;
436
+ width: 23%;
437
+ display: inline-block;
438
+ position: relative;
439
+ }
440
+ #ftg-wizard .images .tile img {
441
+ width: 100%;
442
+ }
443
+ #ftg-wizard .images .tile a {
444
+ position: absolute;
445
+ top: -5px;
446
+ right: -5px;
447
+ z-index: 10;
448
+ display: none;
449
+ width: 26px;
450
+ height: 26px;
451
+ line-height: 26px;
452
+ }
453
+ #ftg-wizard .images .tile a i {
454
+ line-height: 26px;
455
+ font-size: 1.2rem;
456
+ }
457
+ #ftg-wizard .images .tile:hover a {
458
+ display: block;
459
+ }
460
+ #ftg-wizard .images .tile:nth-child(4n) {
461
+ margin-right: 0;
462
+ }
463
+ #ftg-wizard footer {
464
+ background: transparent;
465
+ text-align: right;
466
+ }
467
+ #ftg-wizard footer .prev {
468
+ visibility: hidden;
469
+ }
470
+ #ftg-wizard .loading {
471
+ display: none;
472
+ }
473
+ .modal p {
474
+ font-size: 16px;
475
+ }
476
+ .modal #modal-close
477
+ {
478
+ float: right;
479
+ }
480
+ .modal .code {
481
+ display: block;
482
+ margin: 20px;
483
+ padding: 10px;
484
+ font-size: 16px;
485
+ }
486
+ .modal a {
487
+ outline: 0;
488
+ }
489
+ .modal .modal-content,
490
+ .modal .modal-footer {
491
+ background: #fff;
492
+ }
493
+ #gallery-list .card p {
494
+ height: 40px;
495
+ overflow: hidden;
496
+ padding: 4px 8px;
497
+ border-radius: 4px;
498
+ }
499
+ #gallery-list .card .card-action {
500
+ padding: 5px 5px;
501
+ text-align: center;
502
+ border:0;
503
+ }
504
+ #gallery-list .card.with-image .card-action a {
505
+ transition:all .2s;
506
+ }
507
+ #gallery-list .card .card-action a {
508
+ margin: 0 10px;
509
+ font-size: 20px;
510
+ color: #fff;
511
+ padding: 4px;
512
+ }
513
+ #gallery-list .card .card-image {
514
+ display: inline-block;
515
+ width: 150px;
516
+ height: 150px;
517
+ overflow: hidden;
518
+ }
519
+ #gallery-list .card .card-content {
520
+ height: 180px;
521
+ cursor: pointer;
522
+ letter-spacing: 0.3px;
523
+ }
524
+ #gallery-list .card.with-image .card-action,
525
+ #gallery-list .card.with-image .card-content {
526
+ background: rgba(0, 0, 0, .30);
527
+ transition:background .4s;
528
+ }
529
+ #gallery-list .card.with-image:hover .card-action,
530
+ #gallery-list .card.with-image:hover .card-content {
531
+ background: rgba(0, 0, 0, .60);
532
+ }
533
+ #gallery-list .card .card-title {
534
+ line-height: 32px;
535
+ margin-bottom: 18px;
536
+ display: block;
537
+ font-weight: 400;
538
+ padding: 4px 8px;
539
+ border-radius: 4px;
540
+ }
541
+
542
+ #edit-gallery .tab {
543
+ padding: 20px;
544
+ }
545
+ #edit-gallery label {
546
+ color: #333;
547
+ font-size: 1rem;
548
+ top: 0.1rem;
549
+ height: auto;
550
+ }
551
+ #edit-gallery .input-field {
552
+ margin-bottom: 0;
553
+ }
554
+ #edit-gallery .input-field input[type=text],
555
+ #edit-gallery .input-field input[type=password],
556
+ #edit-gallery .input-field input[type=email],
557
+ #edit-gallery .input-field input[type=url],
558
+ #edit-gallery .input-field input[type=date],
559
+ #edit-gallery .input-field input[type=tel],
560
+ #edit-gallery .input-field input[type=number],
561
+ #edit-gallery .input-field input[type=search],
562
+ #edit-gallery .input-field textarea.materialize-textarea {
563
+ font-size: 2rem;
564
+ }
565
+ #edit-gallery select {
566
+ font-size: 1rem;
567
+ background: #fff;
568
+ }
569
+ #edit-gallery .jump-head {
570
+ border-bottom: 2px solid rgba(0, 0, 0, 0.3);
571
+ padding: 20px 0;
572
+ }
573
+ #edit-gallery .jump-head select {
574
+ height: 2rem;
575
+ display: inline;
576
+ }
577
+ #edit-gallery .jump {
578
+ width: auto;
579
+ }
580
+ .jump-head
581
+ {
582
+ padding: 40px 0px 40px 10px;
583
+ }
584
+ .bullet-menu {
585
+ position: fixed;
586
+ bottom: 20px;
587
+ right: 50px;
588
+ }
589
+ .update-gallery {
590
+ position: fixed;
591
+ bottom: 20px;
592
+ right: 20px;
593
+ }
594
+ .collapsible li {
595
+ margin-bottom: 7px;
596
+ margin-left:-20px;
597
+ }
598
+ .collapsible li .alternate {
599
+ background: transparent;
600
+ }
601
+ .collapsible li .collapsible-header {
602
+ font-size: 2rem;
603
+ height: 5rem;
604
+ line-height: 5rem;
605
+ }
606
+ .collapsible li .collapsible-header .fa-chevron-right{
607
+ float: right;
608
+ color: darkgray;
609
+ }
610
+ .collapsible li .collapsible-header i {
611
+ color: #51AD31;
612
+ line-height: 5rem;
613
+ }
614
+ .collapsible li .collapsible-header span{
615
+ color: #51AD31;
616
+ }
617
+ .collapsible li .field .text {
618
+ background: #fff;
619
+ padding: 20px;
620
+ }
621
+ .collapsible li .field .text .pickColor {
622
+ height: auto;
623
+ }
624
+ .collapsible li .field .text .wp-color-result {
625
+ border-radius: 0;
626
+ -webkit-border-radius: 0;
627
+ height: 24px;
628
+ }
629
+ .collapsible li .field .text .wp-color-result::after {
630
+ border-radius: 0;
631
+ -webkit-border-radius: 0;
632
+ }
633
+ .collapsible li textarea {
634
+ height: 100px;
635
+ }
636
+ .collapsible li th,
637
+ .collapsible li td {
638
+ vertical-align: baseline;
639
+ }
640
+ .collapsible li th {
641
+ border-radius: 0;
642
+ }
643
+ .collapsible li th[scope=row] {
644
+ width: 200px;
645
+ }
646
+ .collapsible li tr.ui-slider {
647
+ height: auto;
648
+ }
649
+ .collapsible li tr.filter {
650
+ float: none;
651
+ margin: 0;
652
+ }
653
+ .collapsible li .toggle div.help {
654
+ display: none;
655
+ }
656
+ .collapsible li .toggle div.help strong {
657
+ font-weight: bold;
658
+ }
659
+
660
+ .collapsible li .toggle [type="checkbox"]:not(:checked) + label:before {
661
+ top: 4px;
662
+ }
663
+
664
+ .checkbox, .checkbox-light, .radio, .radio-light {
665
+ background: url("../images/checkbox/square.png") 0 0 no-repeat;
666
+ color: #dddddd;
667
+ cursor: pointer;
668
+ padding: 1px 0 3px 25px;
669
+ position: relative; }
670
+ .checkbox:hover, .checkbox-light:hover, .radio:hover, .radio-light:hover {
671
+ background-position: 0 -26px;
672
+ color: white; }
673
+ .checkbox.checked, .checked.checkbox-light, .checked.radio, .checked.radio-light {
674
+ background-position: 0 -53px; }
675
+ .checkbox.checked:hover, .checked.checkbox-light:hover, .checked.radio:hover, .checked.radio-light:hover {
676
+ background-position: 0 -80px; }
677
+
678
+ .checkbox-light {
679
+ background-image: url("../images/checkbox/square-light.png"); }
680
+ .collapsible li div.help {
681
+ background: rgba(255, 255, 255, 0.5);
682
+ border-top-left-radius: 0;
683
+ border-top-right-radius: 0;
684
+ border-bottom-left-radius: 6px;
685
+ border-bottom-right-radius: 6px;
686
+ padding: 10px;
687
+ color: #666;
688
+ }
689
+ .collapsible li .custom_isf td th {
690
+ background: #333;
691
+ color: #fff;
692
+ }
693
+ .collapsible li .custom_isf td td input[type=text] {
694
+ background: #fff;
695
+ }
696
+ .collapsible li .dynamic-table tr {
697
+ background: #fff;
698
+ }
699
+ .collapsible li .dynamic-table .btn {
700
+ outline: 0;
701
+ color: #fff;
702
+ }
703
+ .collapsible li .dynamic-table .btn:hover {
704
+ color: #fff;
705
+ }
706
+ .collapsible li .dynamic-table .btn.add {
707
+ width: 100%;
708
+ }
709
+ .collapsible li .dynamic-table .del {
710
+ width: 50px;
711
+ padding-left: 10px;
712
+ padding-top: 18px;
713
+ }
714
+ .collapsible li td .filters .text p {
715
+ padding: 0;
716
+ }
717
+ .collapsible li td .filters .text p a {
718
+ display: inline-block;
719
+ margin-right: 20px;
720
+ }
721
+ .collapsible li td .filters .text p input[type=text] {
722
+ width: 77%;
723
+ }
724
+ #tutorial h5 {
725
+ margin: 60px 0 20px;
726
+ }
727
+ #images .item
728
+ {
729
+ width:160px;
730
+ padding:0px 10px 0px 0px;
731
+ /*background:#333;*/
732
+ /*border:1px solid #111;*/
733
+ float:left;
734
+ height:295px;
735
+ margin:10px 10px 0 0;
736
+ position: relative;
737
+ }
738
+
739
+ #images .item .size {
740
+ position: absolute;
741
+ bottom: 6px;
742
+ left: 10px;
743
+ background: #333;
744
+ color: #ccc;
745
+ padding: 4px;
746
+ display: block;
747
+ font-size: 9px;
748
+ font-family: monaco,courier, monospace;
749
+ }
750
+ #images .item .name {
751
+ position:absolute;
752
+ top:35px;
753
+ width:150px;
754
+ background: rgba(0,0,0,.5);
755
+ color: #fff;
756
+ font-size:10px;
757
+ left:10px;
758
+ z-index:100;
759
+ height:20px;
760
+ overflow: hidden;
761
+ }
762
+ #images .item .del {
763
+ position: absolute;
764
+ top:4px;
765
+ right:4px;
766
+ width: 20px;
767
+ height: 20px;
768
+ text-decoration: none;
769
+ color: #000;
770
+ display: none;
771
+ background:#111;
772
+ }
773
+ #images .item .icons {
774
+ /*border-bottom: 1px solid #222;*/
775
+ margin-bottom: 9px;
776
+ }
777
+ #images .item .selection {
778
+ float: right;
779
+ margin-top: 5px;
780
+ height: 12px;
781
+ }
782
+
783
+ #images .figure {
784
+ margin:0;
785
+ padding: 0;
786
+ width:90%;
787
+ height: 120px;
788
+ overflow: hidden;
789
+ display: table-cell;
790
+ vertical-align: middle;
791
+ text-align: center;
792
+ background-size: cover;
793
+ }
794
+ #images .figure img {
795
+ width:160px;
796
+ cursor: pointer;
797
+ }
798
+ #images .item .data {
799
+ display: none;
800
+ }
801
+
802
+ #image-panel {
803
+ background: white;
804
+ width:700px;
805
+ height:auto;
806
+ margin-left: -300px;
807
+ position: absolute;
808
+ top: 30%;
809
+ left: 50%;
810
+ z-index: 1001;
811
+ box-shadow: #000 0px 0px 20px;
812
+ /*border:4px solid #111;*/
813
+ padding: 10px;
814
+ }
815
+ #image-panel .filters {
816
+ clear: both;
817
+ margin-top: 10px;
818
+ }
819
+ #image-panel .filters .checkbox {
820
+ float: left;
821
+ margin-right: 20px;
822
+ padding-left: 20px;
823
+ }
824
+ #image-panel .left {
825
+ float:left;
826
+ }
827
+ #image-panel .figure {
828
+ width:200px;
829
+ height:200px;
830
+ overflow:hidden;
831
+ padding: 0;
832
+ margin: 0 0 10px 0;
833
+ padding: 2px;
834
+ border: 1px solid #999;
835
+ background: white;
836
+ }
837
+ #image-panel .figure img {
838
+ width:100%;
839
+ }
840
+ #image-panel .right {
841
+ float:left;
842
+ margin-left:20px;
843
+ }
844
+ #image-panel .field {
845
+ padding-bottom: 5px;
846
+ color: #aaa;
847
+ /*border-bottom: 1px solid #555;*/
848
+ margin-bottom: 5px;
849
+ }
850
+ #image-panel .field:last-of-type {
851
+ border-bottom: 0;
852
+ }
853
+ #image-panel .field label {
854
+ margin-bottom: 5px;
855
+ display: block;
856
+ font-weight: bold;
857
+ color: black;
858
+ }
859
+ #image-panel .field textarea {
860
+ width: 100%;
861
+ height: 60px;
862
+ }
863
+ #image-panel .actions li {
864
+ height: 22px;
865
+ margin:0;
866
+ }
867
+ #image-panel .close {
868
+ position: absolute;
869
+ top:0;
870
+ right:0;
871
+ display: block;
872
+ background: white;
873
+ border-bottom-left-radius: 30px;
874
+ width: 30px;
875
+ height: 30px;
876
+ line-height: 24px;
877
+ text-indent: 15px;
878
+ text-decoration: none;
879
+ color: #fff;
880
+ font-family: arial;
881
+ font-weight: bold;
882
+ }
883
+
884
+ #images .actions {
885
+ padding: 10px 10px 10px 10px;
886
+ background: #242521;
887
+ }
888
+ #images .bulk ,
889
+ #images .actions {
890
+ background: #FAFAFA;
891
+ border:1px solid #EEE;
892
+ padding: 25px;
893
+ margin: 10px;
894
+ }
895
+ #images .bulk h4 {
896
+ margin:0 0 4px 0;
897
+ color: #fff;
898
+ }
899
+ #images .bulk .checkbox {
900
+ display: inline-block;
901
+ padding-left: 20px;
902
+ margin-right: 15px;
903
+ }
904
+ #images .bulk .options a {
905
+ display: inline-block;
906
+ margin-right: 10px;
907
+ color: #fff;
908
+ text-decoration: none;
909
+ }
910
+ #images .bulk .options a:hover {
911
+ /*color: #fff;*/
912
+ }
913
+ #images .bulk .panel {
914
+ display: none;
915
+ padding: 12px;
916
+ background: transparent;
917
+ margin-top: 5px;
918
+ /*border: 1px solid #333222;*/
919
+ }
920
+ #images .bulk .panel strong {
921
+ color: black;
922
+ display: block;
923
+ margin-bottom: 4px;
924
+ }
925
+
926
+ #images .bulk .panel p {
927
+ padding: 10px 0px 10px 0px;
928
+ margin-bottom: 0;
929
+ color: black;
930
+ }
931
+ #images .tips {
932
+ margin-bottom: 15px;
933
+ }
934
+ #images .tip {
935
+ background: url('../images/tip.png') no-repeat;
936
+ text-indent: 21px;
937
+ display: block;
938
+ margin: 0 0 0 15px;
939
+ }
940
+ #images .shortpixel {
941
+
942
+ }
943
+ #images .btn.action {
944
+ margin-bottom: 0;
945
+ }
946
+
947
+ .clearfix:after {
948
+ content: ".";
949
+ display: block;
950
+ clear: both;
951
+ visibility: hidden;
952
+ line-height: 0;
953
+ height: 0;
954
+ }
955
+ #image-panel .buttons {
956
+ text-align: right;
957
+ margin-top: 10px;
958
+ clear: both;
959
+ }
960
+ #image-panel .buttons a {
961
+ margin-left: 10px;
962
+ }
963
+
964
+ #images .actions label {
965
+ font-weight: bold;
966
+ cursor: default;
967
+ display: block;
968
+ margin-bottom: 10px;
969
+ }
970
+ #images .actions label span {
971
+ font-weight: normal;
972
+ padding-left: 10px;
973
+ }
974
+ #images .actions .row {
975
+ margin: 0 0 10px 0;
976
+ }
977
+ #images .actions .bulk .panel {
978
+ display: none;
979
+ }
980
+ #images p label{
981
+ display: inline-block;
982
+ margin-right: 30px;
983
+ padding-left: 28px;
984
+ }
985
+ #image-panel .filters label
986
+ {
987
+ margin-right: 30px;
988
+ padding-left:28px;
989
+ color: #333;
990
+ float:left;
991
+ font-size: 1rem;
992
+ top: .1rem;
993
+ height: auto;
994
+ }
995
+ .filters-bulk-label {
996
+ display: inline-block;
997
+ margin-right: 30px;
998
+ line-height: 30px;
999
+ padding-left: 28px;
1000
+ }
1001
+ #images .actions .bulk .panel p {
1002
+ padding: 1rem 0;
1003
+ }
1004
+ #images .actions .tips {
1005
+ font-style: italic;
1006
+ color: #777;
1007
+ padding: 5px 10px;
1008
+ background: rgba(255, 255, 255, 0.7);
1009
+ border-radius: 4px;
1010
+ }
1011
+ #images .actions .tips strong {
1012
+ font-weight: 700;
1013
+ }
1014
+ #image-panel-model[data-source=posts] {
1015
+ width: 300px;
1016
+ }
1017
+ #image-panel-model[data-source=posts] .right-side {
1018
+ display: none;
1019
+ }
1020
+ #image-panel-model .right-side {
1021
+ margin-left: 170px;
1022
+ }
1023
+ #image-panel-model .right-side textarea {
1024
+ height: 3.75rem;
1025
+ }
1026
+ #image-panel-model .right-side input[type=text],
1027
+ #image-panel-model .right-side textarea {
1028
+ border: 1px solid #9E9E9E;
1029
+ }
1030
+ #image-panel-model .right-side .filters {
1031
+ margin-top: 15px;
1032
+ }
1033
+ #image-panel-model .right-side .filters label {
1034
+ margin-right: 30px;
1035
+ padding-left: 28px;
1036
+ }
1037
+ #video-panel-model textarea {
1038
+ height: 160px;
1039
+ }
1040
+ #image-list .card.selected {
1041
+ border: 2px solid #000;
1042
+ }
1043
+ #image-list .card .card-image {
1044
+ cursor: move;
1045
+ }
1046
+ #image-list .card .card-image iframe {
1047
+ width: 100%;
1048
+ }
1049
+ #image-list .card p {
1050
+ padding: 0;
1051
+ min-height: 20px;
1052
+ }
1053
+ #image-list .card .filters {
1054
+ position: absolute;
1055
+ top: 10px;
1056
+ left: 0px;
1057
+ }
1058
+ #image-list .card .filters li {
1059
+ background: #fff;
1060
+ color: #666;
1061
+ padding: 2px 10px;
1062
+ margin: 0 0 2px 0;
1063
+ border-top-right-radius: 4px;
1064
+ }
1065
+ #delete-gallery-modal span {
1066
+ color: #ff8a0b;
1067
+ font-weight: bold;
1068
+ }
1069
+ #spinner {
1070
+ display: none;
1071
+ position: fixed;
1072
+ top: 50px;
1073
+ right: 50px;
1074
+ }
1075
+ #spinner.shown {
1076
+ display: block;
1077
+ }
1078
+ .pro-cell {
1079
+ padding: 15px 25px;
1080
+ border: 1px solid #EEE;
1081
+ background-color: #FAFAFA;
1082
+ display: inline-block;
1083
+ }
1084
+ .button-bg {
1085
+ background: #DAA308;
1086
+ }
1087
+ .btn.button-bg:hover {
1088
+ background: #bc8f15;
1089
+ }
1090
+ .btn:hover {
1091
+ color:#fff;
1092
+ }
1093
+ .pro-cell:hover {
1094
+ opacity: .8;
1095
+ }
1096
+ .pro-cell a {
1097
+ transition: all .3s;
1098
+ color: #fff;
1099
+ }
1100
+ /**
1101
+ * For modern browsers
1102
+ * 1. The space content is one way to avoid an Opera bug when the
1103
+ * contenteditable attribute is included anywhere else in the document.
1104
+ * Otherwise it causes space to appear at the top and bottom of elements
1105
+ * that are clearfixed.
1106
+ * 2. The use of `table` rather than `block` is only necessary if using
1107
+ * `:before` to contain the top-margins of child elements.
1108
+ */
1109
+ .cf:before,
1110
+ .cf:after {
1111
+ content: " ";
1112
+ /* 1 */
1113
+ display: table;
1114
+ /* 2 */
1115
+ }
1116
+ .cf:after {
1117
+ clear: both;
1118
+ }
1119
+ /**
1120
+ * For IE 6/7 only
1121
+ * Include this rule to trigger hasLayout and contain floats.
1122
+ */
1123
+ .cf {
1124
+ *zoom: 1;
1125
+ }
1126
+
1127
+ .li
1128
+ {
1129
+ cursor:pointer;
1130
+ font-size:16px;
1131
+ display:inline;
1132
+ float:left;
1133
+ margin-left:7px;
1134
+ }
1135
+
1136
+ .listview
1137
+ {
1138
+ font-size:16px;
1139
+ display:inline;
1140
+ float:left;
1141
+ margin-left:7px;
1142
+ }
1143
+
1144
+ .menu_activ
1145
+ {
1146
+ cursor: pointer;
1147
+ font-size:16px;
1148
+ display:inline;
1149
+ float:left;
1150
+ margin-left:7px;
1151
+ color:red;
1152
+ }
1153
+ /*.hide
1154
+ {
1155
+ display:none;
1156
+ }
1157
+ .padd
1158
+ {
1159
+ padding:2px;
1160
+ }*/
1161
+
1162
+ #image-list .small .card-title
1163
+ {
1164
+ display: none;
1165
+ }
1166
+
1167
+ #image-list .small .card-content
1168
+ {
1169
+ display: none;
1170
+ }
1171
+
1172
+ #image-list .small .card-action
1173
+ {
1174
+ background-color:#402723;
1175
+ padding:5px;
1176
+ text-align: center;
1177
+ }
1178
+
1179
+
1180
+ #image-list .medium .card-action i
1181
+ {
1182
+ text-align: center;
1183
+ display: none;
1184
+ }
1185
+
1186
+ #image-list .big .card-action i
1187
+ {
1188
+ text-align: center;
1189
+
1190
+ display: none;
1191
+ }
1192
+
1193
+
1194
+ #image-list .small .card-action a span
1195
+ {
1196
+ display:none;
1197
+ }
1198
+ #image-list .small .card-action .remove span
1199
+ {
1200
+ display: none;
1201
+ }
1202
+
1203
+ {
1204
+ display:none;
1205
+ }
1206
+ #image-list .small .card-action a i
1207
+ {
1208
+ color:white;
1209
+ }
1210
+
1211
+ .filter-list
1212
+ {
1213
+ border-radius: 3px;
1214
+ margin-left: 10px;
1215
+ margin-right: 10px;
1216
+ padding: 12px;
1217
+ background-color: #FFF9F0;
1218
+ }
1219
+
1220
+ .list-view
1221
+ {
1222
+ float: left;
1223
+ font-size: 16px;
1224
+ }
1225
+
1226
+ .filter-select-control{
1227
+ float: left;
1228
+ }
1229
+ .filter-item
1230
+ {
1231
+ cursor: pointer;
1232
+ display: inline;
1233
+ float: left;
1234
+ font-size: 16px;
1235
+ margin-left: 10px !important;
1236
+ }
1237
+
1238
+ .menu-activ
1239
+ {
1240
+ color: red;
1241
+ }
1242
+
1243
+ .import-export
1244
+ {
1245
+ padding-left: 42px;
1246
+ margin-top: 20px;
1247
+ padding-bottom: 50px;
1248
+ }
1249
+ .import-export a
1250
+ {
1251
+ display: block;
1252
+ padding: 10px 21px 11px 49px;
1253
+ width: 145px;
1254
+ float: left;
1255
+ margin-right: 15px;
1256
+ color: #ADACAC;
1257
+ background-color: white;
1258
+ }
1259
+
1260
+ .import-export a:hover
1261
+ {
1262
+ background-color: #51AD31;
1263
+ color: white;
1264
+ }
1265
+
1266
+ #import-modal textarea, #export-modal textarea
1267
+ {
1268
+ height: 100px;
1269
+ }
1270
+
1271
+ .collapsible .active .collapsible-header
1272
+ {
1273
+ background-color: #51AD31 !important;
1274
+ }
1275
+ .collapsible .active .collapsible-header span,
1276
+ .collapsible .active .collapsible-header i
1277
+ {
1278
+ color: white;
1279
+ }
1280
+
1281
+ .collapsible .active .collapsible-body
1282
+ {
1283
+ background-color: white;
1284
+ }
1285
+
1286
+ .backdrop
1287
+ {
1288
+ background: green;
1289
+ }
1290
+
1291
+ .select-effect
1292
+ {
1293
+ display: block;
1294
+ width: 34%;
1295
+ height: 50px !important;
1296
+ border-radius: 5px;
1297
+ }
1298
+
1299
+
1300
+ #hover-effect th
1301
+ {
1302
+ display: none;
1303
+ }
1304
+ #hover-effect .panel {
1305
+ padding: 20px;
1306
+ background: #fafafa;
1307
+ }
1308
+ #hover-effect .effect-description
1309
+ {
1310
+ display: block;
1311
+ color: #51AD31;
1312
+ padding-bottom: 12px;
1313
+ font-size: 18px;
1314
+ font-weight: normal;
1315
+ }
1316
+
1317
+ #hover-effect .help
1318
+ {
1319
+ display: none;
1320
+ }
1321
+
1322
+ #hover-effect .effect-color
1323
+ {
1324
+ display: block !important;
1325
+ }
1326
+ #hover-effect .effect-img
1327
+ {
1328
+ padding: 17px 0px;
1329
+ float: left;
1330
+ }
1331
+
1332
+ #hover-effect .effect-compatibility
1333
+ {
1334
+ margin-left: 430px;
1335
+ }
1336
+
1337
+ #hover-effect .effect-compatibility label
1338
+ {
1339
+ display: block;
1340
+ margin-bottom: 5px;
1341
+ }
1342
+
1343
+ #hover-effect .effect-compatibility label span
1344
+ {
1345
+ display: block;
1346
+ font-size: 14px;
1347
+ margin: 10px;
1348
+ }
1349
+
1350
+ #hover-effect .jump-head
1351
+ {
1352
+ display: none;
1353
+ }
1354
+
1355
+ #hover-effect .fa-check
1356
+ {
1357
+ color: green;
1358
+ }
1359
+ #hover-effect .fa-times
1360
+ {
1361
+ color: red;
1362
+ }
1363
+ #hover-effect .preview {
1364
+ float: none;
1365
+ }
1366
+ #hover-effect .preview .item {
1367
+ width:400px;
1368
+ height:267px;
1369
+ overflow: hidden;
1370
+ position: relative;
1371
+ float: left;
1372
+ }
1373
+ #hover-effect .preview .item img {
1374
+ position: absolute;
1375
+ }
1376
+ .modula .items .item .figc {
1377
+ display: flex;
1378
+ align-items: center;
1379
+ justify-content: center;
1380
+ color: #fff;
1381
+ font-size: 11px;
1382
+ text-align: center;
1383
+ position: absolute;
1384
+ left: 0;
1385
+ width: 100%;
1386
+ padding: 0;
1387
+ }
1388
+ .modula .items .item .figc {
1389
+ width:400px;
1390
+ height:267px;
1391
+ color: #fff;
1392
+ font-size: 11px;
1393
+ text-align: center;
1394
+ position: absolute;
1395
+ left: 0;
1396
+ width: 100%;
1397
+ padding: 0;
1398
+ }
1399
+ .modula .items .item .figc h2 {
1400
+ font-size: 21px;
1401
+ color:#fff;
1402
+ }
1403
+ .modula .items .item .figc p {
1404
+ color:#fff;
1405
+ font-size: 15px;
1406
+ font-style: normal;
1407
+ }
1408
+ .modula .item .jtg-social a {
1409
+ font-size: 17px;
1410
+ }
1411
+ .all-effects {
1412
+ display: inline-block;
1413
+ margin: 20px 0;
1414
+ color:#fff;
1415
+ font-size: 16px;
1416
+ background: #DAA308;
1417
+ padding: 6px 12px;
1418
+ transition:all .2s;
1419
+ }
1420
+ .all-effects:hover {
1421
+ opacity: .8;
1422
+ color:#fff;
1423
+ }
1424
+ .setting
1425
+ {
1426
+ color: #ADACAC;
1427
+ padding-left: 45px;
1428
+ margin-bottom: 15px;
1429
+ }
1430
+
1431
+ #other-galleries .cta {
1432
+ width:170px;
1433
+ text-align: right;
1434
+ }
1435
+ #other-galleries .text {
1436
+ font-size: 17px;
1437
+ width:calc(100% - 180px);
1438
+ padding-right: 20px;
1439
+ height: 150px;
1440
+ }
1441
+ #other-galleries .text h4 {
1442
+ font-size: 19px;
1443
+ font-weight: bold;
1444
+ }
1445
+ #other-galleries .text,
1446
+ #other-galleries .cta {
1447
+ display: inline-block;
1448
+ vertical-align: top;
1449
+ }
1450
+ #other-galleries .cta a {
1451
+ margin-right: 0;
1452
+ margin-top: 69px;
1453
+ }
1454
+ #other-galleries * {
1455
+ outline: 0;
1456
+ }
1457
+ #adminmenu .wp-submenu .modula-jump-pro-menu {
1458
+ color:#22e34f;
1459
+ font-weight: bold;
1460
+ }
1461
+ #external-galleries input[type=checkbox] {
1462
+ position: static;
1463
+ }
1464
+
1465
+ /* Added in 1.2.0 */
1466
+ #toplevel_page_modula-lite-admin ul li:last-of-type a {
1467
+ color: #7cc048 !important;
1468
+ }
1469
+
1470
+ #toplevel_page_modula-lite-admin ul li:nth-child(4),
1471
+ #toplevel_page_modula-lite-admin ul li:nth-child(4):hover {
1472
+ display: none;
1473
+ }
1474
+
1475
+ body .modula-wrap .wp-badge {
1476
+ background: url('../images/modula-logo.jpg') center 35px no-repeat #50ad31;
1477
+ padding-top: 160px;
1478
+ height: 0;
1479
+ background-size: 80px 80px;
1480
+ }
1481
+
1482
+ .shortpixel {
1483
+ display: block;
1484
+ background: #fafafa;
1485
+ border: 1px solid #DDD;
1486
+ padding: 20px;
 
 
 
1487
  }
admin/edit-gallery.php CHANGED
@@ -1,412 +1,403 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
3
-
4
- function modula_print_value($gallery, $field, $default = NULL)
5
- {
6
- if($gallery == NULL || $gallery->$field === NULL)
7
- {
8
- if($default === NULL)
9
- {
10
- print "";
11
- }
12
- else
13
- {
14
- print stripslashes($default);
15
- }
16
- }
17
- else
18
- {
19
- print stripslashes($gallery->$field);
20
- }
21
- }
22
-
23
- $galleryResults = $this->ModulaDB->getGalleries();
24
-
25
- $gallery = $this->loadedData;
26
- $tg_subtitle = "Edit Gallery: " . $gallery->name;
27
-
28
- include("header.php");
29
-
30
- ?>
31
-
32
- <script>
33
- var modula_wp_caption_field = '<?php modula_print_value($gallery, "wp_field_caption") ?>';
34
- </script>
35
- <div class="row collapsible">
36
- <div class="col s12 m6 l4">
37
- <div class="card-panel light-green lighten-4">
38
- <span> Shortcode: </span>
39
- <input type="text" readonly value="[Modula id='<?php print $gallery->id; ?>']"> </input>
40
- </div>
41
- </div>
42
- <div class="col s12 m6 l4">
43
- <div class="card-panel lime lighten-4">
44
- <strong>TIP</strong>: blurry images? Try using a higher <i>Minimum image size</i> value!
45
- </div>
46
- </div>
47
- </div>
48
-
49
- <span class='setting'>Settings:</span>
50
-
51
- <p class="import-export">
52
- <a id='import' href="#">Import</a>
53
- <a id='export' href="#">Export</a>
54
- </p>
55
-
56
- <ul class="collapsible" data-collapsible="accordion">
57
- <?php foreach($modula_fields as $section => $s): ?>
58
- <li id="<?php print strtolower(str_replace(' ', '-', $section)); ?>">
59
- <div class="collapsible-header white-text darken-2">
60
- <i class="<?php _e($s["icon"]) ?>"></i> <span><?php _e($section) ?> </span>
61
- <i class="icon icon-chevron-right"></i>
62
- </div>
63
-
64
- <div class="collapsible-body lighten-5 tab form-fields">
65
- <div class="jump-head">
66
- <?php
67
- $jumpFields = array();
68
- foreach($s["fields"] as $f => $data)
69
- {
70
- $jumpFields[$f] = $data;
71
- $jumpFields[$f]['_code'] = $f;
72
- }
73
- unset($f);
74
- unset($data);
75
- ?>
76
- <select class="browser-default jump">
77
- <option><?php _e('Jump to setting','modula-gallery')?></option>
78
- <?php foreach($jumpFields as $f => $data) : ?>
79
- <option value="<?php _e($data['_code']) ?>">
80
- <?php _e($data["name"]); ?>
81
- </option>
82
- <?php endforeach; ?>
83
- </select>
84
- </div>
85
- <input type="hidden" id="wp_caption" value="<?php print $gallery->wp_field_caption ?>" >
86
- <input type="hidden" id="wp_title" value="<?php print $gallery->wp_field_title ?>" >
87
-
88
- <form name="gallery_form" id="gallery_form" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="post">
89
- <?php wp_nonce_field('Modula', 'Modula'); ?>
90
- <input type="hidden" name="ftg_gallery_edit" id="gallery-id" value="<?php _e($gallery->id); ?>" />
91
- <table class="widefat post fixed" cellspacing="0">
92
- </tbody>
93
- </table>
94
- </form>
95
-
96
- <table>
97
- <tbody>
98
- <?php foreach($s["fields"] as $f => $data) : ?>
99
- <?php if(is_array($data["excludeFrom"]) && ! in_array($modula_parent_page, $data["excludeFrom"])) : ?>
100
- <tr class="row-<?php print $f ?> <?php print $data["type"] ?>">
101
- <th scope="row">
102
- <label class="label-text"><?php _e($data["name"]); ?>
103
- <?php if(isset($data["mu"])) : ?>
104
- (<?php _e($data["mu"]) ?>)
105
- <?php endif ?>
106
- </label>
107
- </th>
108
- <td>
109
- <div class="field">
110
- <?php if($data["type"] == "text") : ?>
111
- <div class="text">
112
- <input type="text" size="30" name="tg_<?php print $f ?>" value="<?php print $gallery->$f ?>" />
113
- </div>
114
- <?php elseif($data["type"] == "select") : ?>
115
-
116
- <div class="text">
117
- <select class="browser-default dropdown-menu" name="tg_<?php print $f ?>" >
118
- <?php foreach(array_keys($data["values"]) as $optgroup) : ?>
119
- <optgroup label="<?php print $optgroup ?>">
120
- <?php foreach($data["values"][$optgroup] as $option) : ?>
121
-
122
- <?php $v = explode("|", $option); ?>
123
- <option value="<?php print $v[0] ?>" <?php print $v[0] == $gallery->$f ? "selected" : "" ?> ><?php print $v[1] ?></option>
124
- <?php endforeach ?>
125
- </optgroup>
126
- <?php endforeach ?>
127
- <?php if(isset($data["disabled"])) : ?>
128
- <?php foreach(array_keys($data["disabled"]) as $optgroup) : ?>
129
- <optgroup label="<?php print $optgroup ?>">
130
- <?php foreach($data["disabled"][$optgroup] as $option) : ?>
131
-
132
- <?php $v = explode("|", $option); ?>
133
- <option disabled><?php print $v[1] ?></option>
134
- <?php endforeach ?>
135
- </optgroup>
136
- <?php endforeach ?>
137
- <?php endif ?>
138
- </select>
139
- </div>
140
- <?php elseif($data["type"] == "toggle") : ?>
141
- <div class="text">
142
- <input type="checkbox" id="ftg_<?php print $f ?>" name="tg_<?php print $f ?>" value="<?php print $gallery->$f ?>" <?php print $gallery->$f=='T' ? 'checked' : '' ?> />
143
- <label for="ftg_<?php print $f ?>"><?php _e($data["description"]); ?></label>
144
- </div>
145
-
146
- <?php elseif($data["type"] == "ui-slider") : ?>
147
- <div class="text">
148
- <label class="effect-description"><?php print $data['description'] ?></label>
149
- <p class="range-field">
150
- <input name="tg_<?php print $f ?>" value="<?php print $gallery->$f ?>" type="range" min="<?php print $data["min"] ?>" max="<?php print $data["max"] ?>" />
151
- </p>
152
- </div>
153
-
154
- <?php elseif($data["type"] == "number") : ?>
155
- <div class="text">
156
- <input type="text" name="tg_<?php print $f ?>" class="integer-only" value="<?php print $gallery->$f; ?>" >
157
- </div>
158
-
159
- <?php elseif($data["type"] == "color") : ?>
160
- <div class="text">
161
- <label class="effect-description effect-color" style="display:none;"> <?php print $data['description'] ?></label>
162
- <input type="text" size="6" data-default-color="<?php print $data["default"] ?>" name="tg_<?php print $f ?>" value="<?php print $gallery->$f ?>" class='pickColor' /> </div>
163
- <?php elseif($data["type"] == "PRO_FEATURE") : ?>
164
-
165
- <div class="pro-cell">
166
- <a href="http://modula.greentreelabs.net/?utm_source=modulalite_inst&utm_medium=banner&utm_campaign=Modula%20Lite#buy" target="_blank">Unlock this feature, buy full version <i class="mdi-content-send
167
- "></i></a>
168
- </div>
169
-
170
- <?php elseif($data["type"] == "textarea") : ?>
171
- <div class="text">
172
- <textarea name="tg_<?php print $f ?>"><?php print $gallery->$f ?></textarea>
173
- </div>
174
- <?php elseif($data["type"] == "hover-effect"): ?>
175
-
176
- <div class="text">
177
- <label class="effect-description"> <?php print $data['description']; ?> </label>
178
- <select name="tg_hoverEffect" class="select-effect">
179
- <?php $hoverEffectIdx = 0 ?>
180
- <option value="none">None</option>
181
- <optgroup label="Buy a PRO license to unlock all hover effects">
182
- <option disabled></option>
183
- <?php foreach($this->hoverEffects as $effect) : ?>
184
- <option <?php print $effect->code != "pufrobo" ? "disabled" : null ?> <?php print ($gallery->hoverEffect == strtolower($effect->code) ? "selected" : null) ?> value="<?php print $effect->code ?>"><?php print $effect->name ?></option>
185
- <?php endforeach ?>
186
- </optgroup>
187
- </select>
188
- <a class="all-effects" href="http://modula.greentreelabs.net/demo/effects/appear/?utm_source=modulalite_inst&utm_campaign=Modula%20Lite&utm_medium=banner&utm_term=all%20effects" target="_blank"><i class="mdi mdi-comment-alert-outline"></i> Click to see all available effects</a>
189
-
190
- <!-- all effects preview -->
191
- <div class="preview modula">
192
- <div class="panel panel-pufrobo items clearfix">
193
- <!-- show preview -->
194
-
195
- <div class="item effect-pufrobo" >
196
- <img src="<?php print plugins_url() ?>/modula-best-grid-gallery/admin/images/effect.jpg" class="pic">
197
- <div class="figc">
198
- <div class="figc-inner">
199
-
200
- <h2>Lorem ipsum</h2>
201
- <p class="description">Quisque diam erat, mollis vitae enim eget</p>
202
- <div class="jtg-social">
203
- <a class="icon icon-twitter" href="#"></a>
204
- <a class="icon icon-facebook" href="#"></a>
205
- <a class="icon icon-google-plus" href="#"></a>
206
- <a class="icon icon-pinterest" href="#"></a>
207
- </div>
208
- </div>
209
- </div>
210
- </div>
211
-
212
-
213
- <div class="effect-compatibility" >
214
-
215
- <label class="effect-description">This effect is compatible with:
216
- <span><i class="icon icon-check-mark-2"></i> Title </span>
217
- <span><i class="icon icon-check-mark-2"></i> Subtitle </span>
218
- <span><i class="icon icon-check-mark-2"></i> Social icons </span>
219
- </label>
220
- </div>
221
- </div>
222
- </div>
223
- <input type="hidden" name="ftg_hoverColor" value="#000">
224
- <input type="hidden" name="ftg_hoverOpacity" value="#.8">
225
- <div class="pro-cell">
226
- <a href="http://modula.greentreelabs.net/?utm_source=modulalite_inst&utm_medium=banner&utm_campaign=Modula%20Lite#buy" target="_blank">Buy a PRO license to unlock <strong>Hover background color</strong> and <strong>Hover opacity</strong> <i class="mdi-content-send
227
- "></i></a>
228
- </div>
229
- </div>
230
- <?php endif ?>
231
- <div class="help">
232
- <?php _e($data["description"]); ?>
233
- </div>
234
-
235
- </div>
236
- </td>
237
- </tr>
238
- <?php endif ?>
239
- <?php endforeach ?>
240
-
241
- </tbody>
242
- </table>
243
- </div>
244
- </li>
245
- <?php endforeach; ?>
246
-
247
- <li id="images">
248
- <div class="collapsible-header white-text white darken-2">
249
- <i class="mdi mdi-image-filter"></i> <span><?php _e('Images','Modula-gallery')?> </span>
250
- <i class="icon icon-chevron-right"></i>
251
- </div>
252
-
253
- <div class="collapsible-body white lighten-5">
254
- <div class="image-size-section">
255
- <div>
256
- <div class="tips">
257
  <span class="shortpixel">
258
- <img src="<?php echo plugins_url('',__file__) ?>/images/icon-shortpixel.png" alt="ShortPixel">
259
- <a target="_blank" href="https://shortpixel.com/wp/af/N8LKGGT72393"><?php _e('We suggest you to use ShortPixel image optimization plugin for best SEO results.','modula-gallery')?></a></span>
260
- </div>
261
- </div>
262
- </div>
263
-
264
- <div>
265
- <div class="">
266
- <span class="tip">For multiple selections: Click+CTRL.</span>
267
- </div>
268
- <div class="actions row">
269
- <a href="#" class="open-media-panel waves-effect button-bg waves-light btn action"><i class="mdi-image-photo"></i> <?php _e('Add images','Modula-gallery')?></a>
270
- </div>
271
-
272
- <div class="bulk row">
273
- <label class="label-text row"><?php _e('Bulk Actions','modula-gallery')?></label>
274
- <div class="options">
275
- <a class="btn button-bg waves-effect waves-light" href="#" data-action="select"><?php _e('Select all','modula-gallery')?></a>
276
- <a class="btn button-bg waves-effect waves-light" href="#" data-action="deselect"><?php _e('Deselect all','modula-gallery')?></a>
277
- <a class="btn button-bg waves-effect waves-light" href="#" data-action="toggle"><?php _e('Toggle selection','modula-gallery')?></a>
278
- <a class="btn button-bg waves-effect waves-light" href="#" data-action="remove"><?php _e('Remove','modula-gallery')?></a>
279
- </div>
280
- <div class="panel">
281
- <strong></strong>
282
- <p class="text"></p>
283
- <p class="buttons">
284
- <a class="btn deep-orange darken-2 mrm cancel" href="#" ><?php _e('Cancel','modula-gallery')?></a>
285
- <a class="btn green mrm proceed firm" href="#"><?php _e('Proceed','modula-gallery')?></a>
286
- </p>
287
- </div>
288
- </div>
289
- <div class="row">
290
- <span class="tip"><?php _e('Drag images to change order.','modula-gallery')?></span>
291
- </div>
292
-
293
- <div id="image-list"></div>
294
-
295
- <!-- image panel -->
296
- <div id="image-panel-model" style="display:none">
297
- <a href="#" class="close" title="Close">X</a>
298
- <h4> <?php _e('Edit Image','modula-gallery')?> </h4>
299
- <div class="clearfix">
300
- <div class="left">
301
- <div class="figure"></div>
302
- </div>
303
- <div class="editimage-right" >
304
- <div class="field">
305
- <label><?php _e('Title','modula-gallery')?></label>
306
- <div class="text">
307
- <textarea id="item-title" name="title"></textarea>
308
- </div>
309
- <label><?php _e('Caption','modula-gallery')?></label>
310
- <div class="text">
311
- <textarea id="item-description" name="description"></textarea>
312
- </div>
313
- </div>
314
-
315
- <div class="field">
316
- <label for="alignment"><?php _e('Alignment','modula-gallery')?></label>
317
- <select name="halign">
318
- <option><?php _e('left','modula-gallery')?></option>
319
- <option selected><?php _e('center','modula-gallery')?></option>
320
- <option><?php _e('right','modula-gallery')?></option>
321
- </select>
322
- <select name="valign">
323
- <option><?php _e('top','modula-gallery')?></option>
324
- <option selected><?php _e('middle','modula-gallery')?></option>
325
- <option><?php _e('bottom','modula-gallery')?></option>
326
- </select>
327
- </div>
328
- <div class="field">
329
- <label><?php _e('Link','modula-gallery')?></label>
330
- <div class="text">
331
- <!-- <input type="text" name="link" value="" class="text-input row"> -->
332
- <textarea id="item-link" name="link"></textarea>
333
- <select name="target">
334
- <option value=""><?php _e('Default target','modula-gallery')?></option>
335
- <option value="_self"><?php _e('Open in same page','modula-gallery')?></option>
336
- <option value="_blank"><?php _e('Open in _blank','modula-gallery')?></option>
337
- </select>
338
- </div>
339
- </div>
340
- <div class="field filters clearfix"></div>
341
- </div>
342
- </div>
343
- <div class="field buttons">
344
- <a href="#" data-action="cancel" class="action modal-action modal-close waves-effect waves-yellow btn-flat"><i class="mdi-content-reply"></i> <?php _e('Cancel','modula-gallery')?></a>
345
- <a href="#" data-action="save" class="action modal-action modal-close waves-effect waves-green btn-flat"><i class="icon icon-save-disk"></i> <?php _e('Save','modula-gallery')?></a>
346
- </div>
347
- </div>
348
- </div>
349
- </div>
350
- </li>
351
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
352
 
353
  <a id="edit-gallery" data-tooltip="Update gallery" data-position="top" data-delay="10" class="tooltipped btn-floating btn-large waves-effect waves-light green update-gallery">
354
- <i class="icon icon-save-disk"> </i>
355
- </a>
356
- <div class="fixed-action-btn bullet-menu">
357
- <a class="btn-floating btn-large green darken-1 right back-to-top">
358
- <i class="icon icon-angle-up"></i>
359
- </a>
360
- <ul>
361
- <?php foreach($modula_fields as $section => $s) : ?>
362
- <li>
363
- <a class="btn-floating green" rel="<?php print strtolower(str_replace(' ', '-', $section)) ?>"><i class="small <?php _e($s["icon"]) ?>"></i></a>
364
- </li>
365
- <?php endforeach ?>
366
- <li><a class="btn-floating green" rel="images"><i class="small mdi mdi-image-filter"></i></a></li>
367
- </ul>
368
- </div>
369
 
370
  <div class="preloader-wrapper big active" id="spinner">
371
- <div class="spinner-layer spinner-blue-only">
372
- <div class="circle-clipper left">
373
- <div class="circle"></div>
374
- </div><div class="gap-patch">
375
- <div class="circle"></div>
376
- </div><div class="circle-clipper right">
377
- <div class="circle"></div>
378
- </div>
379
- </div>
380
- </div>
381
-
382
- <div id="import-modal" class="modal">
383
- <div class="modal-content">
384
- <h3> Import Configuration</h3>
385
- <p> Paste here the configuration code </p>
386
- <textarea> </textarea>
387
-
388
- </div>
389
- <div class="modal-footer">
390
- <a id="save" href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e('Import','modula-gallery')?></a>
391
-
392
- <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e('Close','modula-gallery')?></a>
393
- </div>
 
 
394
  </div>
395
 
396
  <div id="export-modal" class="modal">
397
- <div class="modal-content">
398
- <h3>Export Configuration</h3>
399
- <p>Copy the configuration code</p>
400
- <textarea readonly></textarea>
401
- </div>
402
- <div class="modal-footer">
403
- <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e('OK','modula-gallery')?></a>
404
- </div>
405
  </div>
406
 
407
  <script>
408
- (function ($) {
409
- TG.load_images();
410
- TG.init_gallery();
411
- })(jQuery);
412
- </script>
1
+ <?php
2
+ if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
3
+ die( _e( 'You are not allowed to call this page directly.', 'modula-gallery' ) );
4
+ }
5
+
6
+ function modula_print_value( $gallery, $field, $default = null ) {
7
+ if ( $gallery == null || $gallery->$field === null ) {
8
+ if ( $default === null ) {
9
+ print "";
10
+ } else {
11
+ print stripslashes( $default );
12
+ }
13
+ } else {
14
+ print stripslashes( $gallery->$field );
15
+ }
16
+ }
17
+
18
+ $galleryResults = $this->ModulaDB->getGalleries();
19
+
20
+ $gallery = $this->loadedData;
21
+ $tg_subtitle = "Edit Gallery: " . $gallery->name;
22
+
23
+ include( "header.php" );
24
+
25
+ ?>
26
+
27
+ <script>
28
+ var modula_wp_caption_field = '<?php modula_print_value( $gallery, "wp_field_caption" ) ?>';
29
+ </script>
30
+ <div class="container">
31
+ <div class="row collapsible">
32
+ <div class="card-panel light-green lighten-4">
33
+ <span> Shortcode: </span>
34
+ <input type="text" readonly value="[Modula id='<?php print $gallery->id; ?>']"> </input>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="container">
40
+ <div class="row">
41
+ <ul class="collapsible" data-collapsible="accordion">
42
+ <?php foreach ( $modula_fields as $section => $s ): ?>
43
+ <li id="<?php echo strtolower( str_replace( ' ', '-', $section ) ); ?>">
44
+ <div class="collapsible-header white-text darken-2">
45
+ <i class="<?php echo esc_attr( $s["icon"] ); ?>"></i>
46
+ <span><?php echo esc_html( $section ) ?> </span> <i class="fa fa-chevron-right"></i>
47
+ </div>
48
+
49
+ <div class="collapsible-body lighten-5 tab form-fields">
50
+
51
+ <input type="hidden" id="wp_caption" value="<?php echo esc_attr( $gallery->wp_field_caption ); ?>">
52
+ <input type="hidden" id="wp_title" value="<?php echo esc_attr( $gallery->wp_field_title ); ?>">
53
+
54
+ <form name="gallery_form" id="gallery_form" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI'] ); ?>" method="post">
55
+ <?php wp_nonce_field( 'Modula', 'Modula' ); ?>
56
+ <input type="hidden" name="ftg_gallery_edit" id="gallery-id" value="<?php echo esc_attr( $gallery->id ); ?>"/>
57
+ <table class="widefat post fixed" cellspacing="0">
58
+ </tbody>
59
+ </table>
60
+ </form>
61
+
62
+ <table>
63
+ <tbody>
64
+ <?php foreach ( $s["fields"] as $f => $data ) : ?><?php if ( is_array( $data["excludeFrom"] ) && ! in_array( $modula_parent_page, $data["excludeFrom"] ) ) : ?>
65
+ <tr class="row-<?php echo esc_attr( $f ); ?> <?php echo esc_attr( $data["type"] ); ?>">
66
+ <th scope="row">
67
+ <label class="label-text"><?php echo esc_html( $data["name"] ); ?>
68
+ <?php if ( isset( $data["mu"] ) ) : ?>
69
+ (<?php echo esc_html( $data["mu"] ) ?>)
70
+ <?php endif ?>
71
+ </label>
72
+ </th>
73
+ <td>
74
+ <div class="field">
75
+ <?php if ( $data["type"] == "text" ) : ?>
76
+ <div class="text">
77
+ <input type="text" size="30" name="tg_<?php echo esc_attr( $f ); ?>" value="<?php echo esc_attr( $gallery->$f ); ?>"/>
78
+ </div>
79
+ <?php elseif ( $data["type"] == "select" ) : ?>
80
+
81
+ <div class="text">
82
+ <select class="browser-default dropdown-menu" name="tg_<?php echo esc_attr( $f ); ?>">
83
+ <?php foreach ( array_keys( $data["values"] ) as $optgroup ) : ?>
84
+ <optgroup label="<?php echo esc_attr( $optgroup ); ?>">
85
+ <?php foreach ( $data["values"][ $optgroup ] as $option ) : ?><?php $v = explode( "|", $option ); ?>
86
+ <option value="<?php echo esc_attr( $v[0] ); ?>" <?php echo $v[0] == $gallery->$f ? "selected" : "" ?> ><?php echo esc_html( $v[1] ); ?></option>
87
+ <?php endforeach ?>
88
+ </optgroup>
89
+ <?php endforeach ?>
90
+ <?php if ( isset( $data["disabled"] ) ) : ?><?php foreach ( array_keys( $data["disabled"] ) as $optgroup ) : ?>
91
+ <optgroup label="<?php echo esc_attr( $optgroup ); ?>">
92
+ <?php foreach ( $data["disabled"][ $optgroup ] as $option ) : ?>
93
+
94
+ <?php $v = explode( "|", $option ); ?>
95
+ <option disabled><?php echo esc_html( $v[1] ) ?></option>
96
+ <?php endforeach ?>
97
+ </optgroup>
98
+ <?php endforeach ?>
99
+
100
+ <?php endif ?>
101
+ </select>
102
+ </div>
103
+ <?php elseif ( $data["type"] == "toggle" ) : ?>
104
+ <div class="text">
105
+ <input type="checkbox" id="ftg_<?php echo esc_attr( $f ); ?>" name="tg_<?php echo esc_attr( $f ); ?>" value="<?php echo esc_attr( $gallery->$f ); ?>" <?php echo $gallery->$f == 'T' ? 'checked' : '' ?> />
106
+ <label for="ftg_<?php echo esc_attr( $f ); ?>"><?php echo esc_html( $data["description"] ); ?></label>
107
+ </div>
108
+
109
+ <?php elseif ( $data["type"] == "ui-slider" || $data['type'] == 'slider' ) : ?>
110
+ <div class="text">
111
+ <label class="effect-description"><?php echo esc_html( $data['description'] ); ?></label>
112
+ <p class="range-field">
113
+ <input name="tg_<?php echo esc_attr( $f ); ?>" value="<?php echo esc_attr( $gallery->$f ); ?>" type="range" min="<?php echo esc_attr( $data["min"] ); ?>" max="<?php echo esc_attr( $data["max"] ); ?>"/>
114
+ </p>
115
+ </div>
116
+
117
+ <?php elseif ( $data["type"] == "number" ) : ?>
118
+ <div class="text">
119
+ <input type="text" name="tg_<?php echo esc_attr( $f ); ?>" class="integer-only" value="<?php echo esc_attr( $gallery->$f ); ?>">
120
+ </div>
121
+
122
+ <?php elseif ( $data["type"] == "color" ) : ?>
123
+ <div class="text">
124
+ <label class="effect-description effect-color" style="display:none;"> <?php echo esc_html( $data['description'] ); ?></label>
125
+ <input type="text" size="6" data-default-color="<?php echo esc_attr( $data["default"] ); ?>" name="tg_<?php echo esc_attr( $f ); ?>" value="<?php echo esc_attr( $gallery->$f ); ?>" class='pickColor'/>
126
+ </div>
127
+ <?php elseif ( $data["type"] == "PRO_FEATURE" ) : ?>
128
+
129
+ <div class="pro-cell">
130
+ <h6><?php echo esc_html__( 'This feature is available only in the PRO version of Modula', 'modula-lite' ); ?></h6>
131
+ <br/>
132
+ <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'admin.php?page=modula-lite-gallery-upgrade&tab=comparison_table' ) ); ?>" target="_blank">
133
+ <?php echo esc_html__( 'See LITE vs PRO Differences', 'modula-gallery' ); ?></a>
134
+ <a class="button button-primary" href="https://wp-modula.com/?utm_source=modulalite_inst&utm_medium=banner&utm_campaign=Modula%20Lite#buy" target="_blank"><span class="dashicons dashicons-cart"></span>
135
+ <?php echo esc_html__( 'Get Modula Pro!', 'modula-gallery' ); ?>
136
+ </a>
137
+ </div>
138
+
139
+ <?php elseif ( $data["type"] == "textarea" ) : ?>
140
+ <div class="text">
141
+ <textarea name="tg_<?php echo esc_attr( $f ); ?>"><?php echo esc_html( $gallery->$f ); ?></textarea>
142
+ </div>
143
+ <?php elseif ( $data["type"] == "hover-effect" ): ?>
144
+
145
+ <div class="text">
146
+ <label class="effect-description"> <?php print $data['description']; ?> </label>
147
+ <select name="tg_hoverEffect" class="select-effect">
148
+ <?php $hoverEffectIdx = 0 ?>
149
+ <option value="none"><?php echo esc_html__( 'None', 'modula-gallery' ); ?></option>
150
+ <optgroup label="Buy a PRO license to unlock all hover effects">
151
+ <option disabled></option>
152
+ <?php foreach ( $this->hoverEffects as $effect ) : ?>
153
+ <option <?php echo $effect->code != "pufrobo" ? "disabled" : null ?> <?php echo( $gallery->hoverEffect == strtolower( $effect->code ) ? "selected" : null ) ?> value="<?php echo esc_attr( $effect->code ); ?>"><?php echo esc_attr( $effect->name ); ?></option>
154
+ <?php endforeach ?>
155
+ </optgroup>
156
+ </select>
157
+ <a class="all-effects" href="https://wp-modula.com/demo/effects/appear/?utm_source=modulalite_inst&utm_campaign=Modula%20Lite&utm_medium=banner&utm_term=all%20effects" target="_blank"><i class="mdi mdi-comment-alert-outline"></i>
158
+ <?php echo esc_html__( 'Click to see all available effects', 'modula-gallery' ); ?>
159
+ </a>
160
+
161
+ <!-- all effects preview -->
162
+ <div class="preview modula">
163
+ <div class="panel panel-pufrobo items clearfix">
164
+ <!-- show preview -->
165
+
166
+ <div class="item effect-pufrobo">
167
+ <img src="<?php print plugins_url() ?>/modula-best-grid-gallery/admin/images/effect.jpg" class="pic">
168
+ <div class="figc">
169
+ <div class="figc-inner">
170
+
171
+ <h2>Lorem ipsum</h2>
172
+ <p class="description">Quisque diam erat, mollis
173
+ vitae enim eget</p>
174
+ <div class="jtg-social">
175
+ <a class="fa fa-twitter" href="#"></a>
176
+ <a class="fa fa-facebook" href="#"></a>
177
+ <a class="fa fa-google-plus" href="#"></a>
178
+ <a class="fa fa-pinterest" href="#"></a>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ </div>
183
+
184
+ <div class="effect-compatibility">
185
+
186
+ <label class="effect-description"> <?php echo esc_html( 'This effect is
187
+ compatible with:', 'modula-gallery' ); ?>
188
+ <?php if ( $effect->allowTitle ): ?>
189
+ <span><i class="fa fa-check"></i> <?php echo esc_html( 'Title', 'modula-gallery' ); ?></span>
190
+ <?php endif; ?>
191
+
192
+ <?php if ( $effect->allowSubtitle ): ?>
193
+ <span><i class="fa fa-check"></i> <?php echo esc_html( 'Subtitle', 'modula-gallery' ); ?> </span>
194
+ <?php endif; ?>
195
+
196
+ <?php if ( $effect->maxSocial > 0 ): ?>
197
+ <span><i class="fa fa-check"></i> <?php echo esc_html( 'Social Icons', 'modula-gallery' ); ?> </span>
198
+ <?php endif; ?>
199
+
200
+ </label>
201
+
202
+ </div>
203
+ </div>
204
+ </div>
205
+ <input type="hidden" name="ftg_hoverColor" value="#000">
206
+ <input type="hidden" name="ftg_hoverOpacity" value="#.8"> <br/>
207
+ <div class="pro-cell">
208
+ <h6><?php echo esc_html__( 'The PRO version of Modula bundles over 12 different hover effects.', 'modula-gallery' ); ?></h6>
209
+ <br/>
210
+ <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'admin.php?page=modula-lite-gallery-upgrade&tab=comparison_table' ) ); ?>" target="_blank">
211
+ <?php echo esc_html__( 'See LITE vs PRO Differences', 'modula-gallery' ); ?>
212
+ </a>
213
+ <a class="button button-primary" href="https://wp-modula.com/?utm_source=modulalite_inst&utm_medium=banner&utm_campaign=Modula%20Lite#buy" target="_blank"><span class="dashicons dashicons-cart"></span>
214
+ <?php echo esc_html__( 'Get Modula Pro!', 'modula-gallery' ); ?>
215
+ </a>
216
+ </div>
217
+ </div>
218
+ <?php endif ?>
219
+ <div class="help">
220
+ <?php _e( $data["description"] ); ?>
221
+ </div>
222
+
223
+ </div>
224
+ </td>
225
+ </tr>
226
+ <?php endif ?><?php endforeach ?>
227
+
228
+ </tbody>
229
+ </table>
230
+ </div>
231
+ </li>
232
+ <?php endforeach; ?>
233
+
234
+ <li id="images">
235
+ <div class="collapsible-header white-text white darken-2">
236
+ <i class="mdi mdi-image-filter"></i>
237
+ <span><?php echo esc_html__( 'Images', 'Modula-gallery' ) ?> </span>
238
+ <i class="fa fa-chevron-right"></i>
239
+ </div>
240
+
241
+ <div class="collapsible-body white lighten-5">
242
+
243
+ <div class="image-size-section">
244
+ <div>
245
+ <div class="tips">
246
+
 
 
 
 
 
 
 
 
 
 
247
  <span class="shortpixel">
248
+ <img src="<?php echo plugins_url( '', __file__ ) ?>/images/icon-shortpixel.png" alt="ShortPixel">
249
+ <a target="_blank" href="https://shortpixel.com/h/af/HUOYEBB31472"><?php echo esc_html__( 'We suggest using the ShortPixel image optimization plugin to optimize your images and get the best possible SEO results & load speed..', 'modula-gallery' ) ?></a>
250
+ </span>
251
+
252
+ </div>
253
+ </div>
254
+ </div>
255
+
256
+ <div>
257
+ <div class="pro-cell">
258
+ <h6><?php echo esc_html__( 'Add more than 20 images per gallery. Upgrade to PRO', 'modula-gallery' ); ?></h6>
259
+ <br/>
260
+ <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'admin.php?page=modula-lite-gallery-upgrade&tab=comparison_table' ) ); ?>" target="_blank">See
261
+ <?php echo esc_html__( 'LITE vs PRO Differences', 'modula-gallery' ); ?></a>
262
+ <a class="button button-primary" href="https://wp-modula.com/?utm_source=modulalite_inst&utm_medium=banner&utm_campaign=Modula%20Lite#buy" target="_blank"><span class="dashicons dashicons-cart"></span>
263
+ <?php echo esc_html__( 'Get Modula Pro!', 'modula-gallery' ); ?></a>
264
+ </div>
265
+
266
+ <div class="actions row">
267
+ <label class="label-text row"><?php echo esc_html__( 'Add Images', 'modula-gallery' ) ?></label>
268
+ <a href="#" class="open-media-panel waves-effect button-bg waves-light btn action"><i class="mdi-image-photo"></i> <?php echo esc_html__( 'Add images', 'modula-gallery' ) ?>
269
+ </a>
270
+ </div>
271
+
272
+ <div class="bulk row">
273
+ <label class="label-text row"><?php echo esc_html__( 'Bulk Actions', 'modula-gallery' ) ?></label>
274
+ <div class="options">
275
+ <a class="btn button-bg waves-effect waves-light" href="#" data-action="select"><?php echo esc_html__( 'Select all', 'modula-gallery' ) ?></a>
276
+ <a class="btn button-bg waves-effect waves-light" href="#" data-action="deselect"><?php echo esc_html__( 'Deselect all', 'modula-gallery' ) ?></a>
277
+ <a class="btn button-bg waves-effect waves-light" href="#" data-action="toggle"><?php echo esc_html__( 'Toggle selection', 'modula-gallery' ) ?></a>
278
+ <a class="btn button-bg waves-effect waves-light" href="#" data-action="remove"><?php echo esc_html__( 'Remove', 'modula-gallery' ) ?></a>
279
+ </div>
280
+ <div class="panel">
281
+ <strong></strong>
282
+ <p class="text"></p>
283
+ <p class="buttons">
284
+ <a class="btn deep-orange darken-2 mrm cancel" href="#"><?php echo esc_html__( 'Cancel', 'modula-gallery' ) ?></a>
285
+ <a class="btn green mrm proceed firm" href="#"><?php echo esc_html__( 'Proceed', 'modula-gallery' ) ?></a>
286
+ </p>
287
+ </div>
288
+ </div>
289
+
290
+ <div class="row">
291
+ <span class="tip"><?php echo esc_html__( 'Drag images to change order.', 'modula-gallery' ) ?></span>
292
+ </div>
293
+
294
+ <div id="image-list"></div>
295
+
296
+ <!-- image panel -->
297
+ <div id="image-panel-model" style="display:none">
298
+ <a href="#" class="close" title="Close">X</a>
299
+ <h4> <?php _e( 'Edit Image', 'modula-gallery' ) ?> </h4>
300
+ <div class="clearfix">
301
+ <div class="left">
302
+ <div class="figure"></div>
303
+ </div>
304
+ <div class="editimage-right">
305
+ <div class="field">
306
+ <label><?php echo esc_html__( 'Title', 'modula-gallery' ) ?></label>
307
+ <div class="text">
308
+ <textarea id="item-title" name="title"></textarea>
309
+ </div>
310
+ <label><?php echo esc_html__( 'Caption', 'modula-gallery' ) ?></label>
311
+ <div class="text">
312
+ <textarea id="item-description" name="description"></textarea>
313
+ </div>
314
+ </div>
315
+
316
+ <div class="field">
317
+ <label for="alignment"><?php echo esc_html__( 'Alignment', 'modula-gallery' ) ?></label>
318
+ <select name="halign">
319
+ <option><?php _e( 'left', 'modula-gallery' ) ?></option>
320
+ <option selected><?php _e( 'center', 'modula-gallery' ) ?></option>
321
+ <option><?php _e( 'right', 'modula-gallery' ) ?></option>
322
+ </select> <select name="valign">
323
+ <option><?php _e( 'top', 'modula-gallery' ) ?></option>
324
+ <option selected><?php _e( 'middle', 'modula-gallery' ) ?></option>
325
+ <option><?php _e( 'bottom', 'modula-gallery' ) ?></option>
326
+ </select>
327
+ </div>
328
+ <div class="field">
329
+ <label><?php _e( 'Link', 'modula-gallery' ) ?></label>
330
+ <div class="text">
331
+ <!-- <input type="text" name="link" value="" class="text-input row"> -->
332
+ <textarea id="item-link" name="link"></textarea> <select name="target">
333
+ <option value=""><?php echo esc_html__( 'Default target', 'modula-gallery' ) ?></option>
334
+ <option value="_self"><?php echo esc_html__( 'Open in same page', 'modula-gallery' ) ?></option>
335
+ <option value="_blank"><?php echo esc_html__( 'Open in new page', 'modula-gallery' ) ?></option>
336
+ </select>
337
+ </div>
338
+ </div>
339
+ <div class="field filters clearfix"></div>
340
+ </div>
341
+ </div>
342
+ <div class="field buttons">
343
+ <a href="#" data-action="cancel" class="action modal-action modal-close waves-effect waves-yellow btn-flat"><i class="mdi-content-reply"></i> <?php echo esc_html__( 'Cancel', 'modula-gallery' ) ?>
344
+ </a>
345
+ <a href="#" data-action="save" class="action modal-action modal-close waves-effect waves-green btn-flat"><i class="fa fa-save"></i> <?php echo esc_html__( 'Save', 'modula-gallery' ) ?>
346
+ </a>
347
+ </div>
348
+ </div>
349
+ </div>
350
+ </div>
351
+ </li>
352
+ </ul>
353
+ </div>
354
+ </div>
355
 
356
  <a id="edit-gallery" data-tooltip="Update gallery" data-position="top" data-delay="10" class="tooltipped btn-floating btn-large waves-effect waves-light green update-gallery">
357
+ <i class="icon icon-save-disk"> </i> </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
 
359
  <div class="preloader-wrapper big active" id="spinner">
360
+ <div class="spinner-layer spinner-blue-only">
361
+ <div class="circle-clipper left">
362
+ <div class="circle"></div>
363
+ </div>
364
+ <div class="gap-patch">
365
+ <div class="circle"></div>
366
+ </div>
367
+ <div class="circle-clipper right">
368
+ <div class="circle"></div>
369
+ </div>
370
+ </div>
371
+ </div>
372
+
373
+ <div id="import-modal" class="modal">
374
+ <div class="modal-content">
375
+ <h3><?php echo esc_html__( 'Import Configuration', 'modula-gallery' ); ?></h3>
376
+ <p><?php echo esc_html__( 'Paste here the configuration code', 'modula-gallery' ); ?></p>
377
+ <textarea> </textarea>
378
+
379
+ </div>
380
+ <div class="modal-footer">
381
+ <a id="save" href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e( 'Import', 'modula-gallery' ) ?></a>
382
+
383
+ <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e( 'Close', 'modula-gallery' ) ?></a>
384
+ </div>
385
  </div>
386
 
387
  <div id="export-modal" class="modal">
388
+ <div class="modal-content">
389
+ <h3><?php echo esc_html__( 'Export Configuration', 'modula-gallery' ); ?></h3>
390
+ <p><?php echo esc_html__( 'Copy the configuration code', 'modula-gallery' ); ?></p>
391
+ <textarea readonly></textarea>
392
+ </div>
393
+ <div class="modal-footer">
394
+ <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e( 'OK', 'modula-gallery' ) ?></a>
395
+ </div>
396
  </div>
397
 
398
  <script>
399
+ (function( $ ) {
400
+ TG.load_images();
401
+ TG.init_gallery();
402
+ })( jQuery );
403
+ </script>
admin/fix.php CHANGED
@@ -1,112 +1,109 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
3
-
4
- $nobanner = true;
5
- if(empty($tg_subtitle))
6
- {
7
- $tg_subtitle = "Fix images";
8
- }
9
-
10
- $imageUrl = null;
11
- foreach($this->ModulaDB->getGalleries() as $gallery)
12
- {
13
- $gid = $gallery->Id;
14
- $images = $this->ModulaDB->getImagesByGalleryId($gid);
15
- if(count($images) > 0) {
16
- $imageUrl = $images[0]->imagePath;
17
- break;
18
- }
19
- }
20
- $oldUrl = "&lt;OLD URL&gt;";
21
- if(strpos($imageUrl, '/wp-content') > 0)
22
- {
23
- $oldUrl = strtolower(substr($imageUrl, 0, strpos($imageUrl, '/wp-content')));
24
- }
25
-
26
- ?>
27
-
28
- <?php include("header.php"); ?>
29
- <style>
30
- #fix-panel h2 {
31
- font-size: 18px;
32
- font-weight:bold;
33
- margin-bottom:4px;
34
- padding-bottom: 0;
35
- line-height:1;
36
- }
37
- #fix-panel pre {
38
- background: #fff;
39
- padding:10px;
40
- }
41
- </style>
42
- <?php if(isset($_GET['fix']) && $_GET['fix'] == '1') : ?>
43
-
44
- <?php
45
-
46
- $lines = array();
47
- foreach($this->ModulaDB->getGalleries() as $gallery)
48
- {
49
- $gid = $gallery->Id;
50
- $images = $this->ModulaDB->getImagesByGalleryId($gid);
51
- foreach($images as $image)
52
- {
53
- if(strpos(strtolower($image->imagePath), $oldUrl) === 0)
54
- $lines []= $image->imagePath;
55
- }
56
- }
57
-
58
- ?>
59
- <div class="row">
60
- <div class="col">
61
- <div class="card-panel lime lighten-4" id="fix-panel">
62
- <?php echo count($lines) ?> image to be processed:
63
- <pre><?php echo implode("\n", $lines) ?></pre>
64
-
65
- <?php
66
- $dir = wp_upload_dir();
67
- file_put_contents( $dir['basedir'] . "/old-images.txt", implode("\n", $lines));
68
-
69
- $res = $wpdb->query('UPDATE ' . $wpdb->prefix . 'modula_images SET imagePath=REPLACE(imagePath, "'.$oldUrl.'", "'.site_url().'")');
70
- add_option('Modula_skip_fix', true);
71
- ?>
72
-
73
- <?php if($res > 0) : ?>
74
- <h2>Fix completed successfully!</h2>
75
- <?php else : ?>
76
- <h2>No images where updated</h2>
77
- <?php endif ?>
78
- <a class="btn" href="?page=ModulaLite-admin">Go to dashboard</a>
79
- </div>
80
- </div>
81
- </div>
82
- <?php else : ?>
83
-
84
- <div class="row">
85
- <div class="col">
86
- <div class="card-panel lime lighten-4" id="fix-panel">
87
- <strong>FIX</strong>: version 1.1.0 introduced a new way to resize images,
88
- now you can choose a custom image size for your galleries, regardless the
89
- sizes defined by your theme.<br>
90
- Although we thoroughly tested the new feature, <strong>some website may encounter
91
- an issue where images don't appear anymore</strong>.<br>
92
- <h2>For tech savvy:</h2>
93
- The cause is a wrong url inside the MySQL table <strong><?php echo $wpdb->prefix ?>modula_images</strong><br>
94
- If you know how to do it, you can easily fix the wrong urls inside the field <strong>imagePath</strong>.
95
- The query to use is:
96
- <pre>UPDATE <?php echo $wpdb->prefix ?>modula_images REPLACE(imagePath, '<?php echo $oldUrl ?>', '<?php echo site_url() ?>');</pre>
97
-
98
- <?php if($oldUrl == "&lt;OLD URL&gt;") : ?>
99
- where &lt;old URL&gt; is the previous URL of this site.
100
- <?php endif ?>
101
- <h2>For everyone:</h2>
102
- If you have updated the plugin and you have run into this issue then
103
- you can use the <strong>Fix tool</strong> by clicking the following button:
104
- <br>
105
- <br>
106
- <a href="?page=modula-lite-gallery-fix&fix=1" class="btn">Fix image paths</a>
107
- <br>
108
- <strong>If you're unsure about what to do then please contact <a href="mailto:diego@greentreelabs.net?subject=Help with Modula fix tool">diego@greentreelabs.net</a></strong>.
109
- </div>
110
- </div>
111
- </div>
112
  <?php endif ?>
1
+ <?php
2
+ if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
3
+ die( _e( 'You are not allowed to call this page directly.', 'modula-gallery' ) );
4
+ }
5
+
6
+ $nobanner = true;
7
+ if ( empty( $tg_subtitle ) ) {
8
+ $tg_subtitle = "Fix images";
9
+ }
10
+
11
+ $imageUrl = null;
12
+ foreach ( $this->ModulaDB->getGalleries() as $gallery ) {
13
+ $gid = $gallery->Id;
14
+ $images = $this->ModulaDB->getImagesByGalleryId( $gid );
15
+ if ( count( $images ) > 0 ) {
16
+ $imageUrl = $images[0]->imagePath;
17
+ break;
18
+ }
19
+ }
20
+ $oldUrl = "&lt;OLD URL&gt;";
21
+ if ( strpos( $imageUrl, '/wp-content' ) > 0 ) {
22
+ $oldUrl = strtolower( substr( $imageUrl, 0, strpos( $imageUrl, '/wp-content' ) ) );
23
+ }
24
+
25
+ ?>
26
+
27
+ <?php include( "header.php" ); ?>
28
+ <style>
29
+ #fix-panel h2 {
30
+ font-size: 18px;
31
+ font-weight: bold;
32
+ margin-bottom: 4px;
33
+ padding-bottom: 0;
34
+ line-height: 1;
35
+ }
36
+
37
+ #fix-panel pre {
38
+ background: #fff;
39
+ padding: 10px;
40
+ }
41
+ </style>
42
+ <?php if ( isset( $_GET['fix'] ) && $_GET['fix'] == '1' ) : ?>
43
+
44
+ <?php
45
+
46
+ $lines = array();
47
+ foreach ( $this->ModulaDB->getGalleries() as $gallery ) {
48
+ $gid = $gallery->Id;
49
+ $images = $this->ModulaDB->getImagesByGalleryId( $gid );
50
+ foreach ( $images as $image ) {
51
+ if ( strpos( strtolower( $image->imagePath ), $oldUrl ) === 0 ) {
52
+ $lines [] = $image->imagePath;
53
+ }
54
+ }
55
+ }
56
+
57
+ ?>
58
+ <div class="row">
59
+ <div class="col">
60
+ <div class="card-panel lime lighten-4" id="fix-panel">
61
+ <?php echo count( $lines ) ?> <?php echo esc_html__( 'image to be processed:', 'modula-gallery' ); ?>
62
+ <pre><?php echo implode( "\n", $lines ) ?></pre>
63
+
64
+ <?php
65
+ $dir = wp_upload_dir();
66
+ file_put_contents( $dir['basedir'] . "/old-images.txt", implode( "\n", $lines ) );
67
+
68
+ $res = $wpdb->query( 'UPDATE ' . $wpdb->prefix . 'modula_images SET imagePath=REPLACE(imagePath, "' . $oldUrl . '", "' . site_url() . '")' );
69
+ add_option( 'Modula_skip_fix', true );
70
+ ?>
71
+
72
+ <?php if ( $res > 0 ) : ?>
73
+ <h2><?php echo esc_html__( 'Fix completed successfully!', 'modula-gallery' ); ?></h2>
74
+ <?php else : ?>
75
+ <h2><?php echo esc_html__( 'No images where updated', 'modula-gallery' ); ?></h2>
76
+ <?php endif ?>
77
+ <a class="btn" href="?page=modula-lite-admin"><?php echo esc_html__( 'Go to dashboard', 'modula-gallery' ); ?></a>
78
+ </div>
79
+ </div>
80
+ </div>
81
+ <?php else : ?>
82
+
83
+ <div class="row">
84
+ <div class="col">
85
+ <div class="card-panel lime lighten-4" id="fix-panel">
86
+ <strong>FIX</strong>: version 1.1.0 introduced a new way to resize images, now you can choose a custom
87
+ image size for your galleries, regardless the sizes defined by your theme.<br> Although we thoroughly
88
+ tested the new feature, <strong>some website may encounter an issue where images don't appear
89
+ anymore</strong>.<br>
90
+ <h2>For tech savvy:</h2>
91
+ The cause is a wrong url inside the MySQL table <strong><?php echo $wpdb->prefix ?>
92
+ modula_images</strong><br> If you know how to do it, you can easily fix the wrong urls inside the
93
+ field <strong>imagePath</strong>. The query to use is:
94
+ <pre>UPDATE <?php echo $wpdb->prefix ?>modula_images REPLACE(imagePath, '<?php echo $oldUrl ?>
95
+ ', '<?php echo site_url() ?>');</pre>
96
+
97
+ <?php if ( $oldUrl == "&lt;OLD URL&gt;" ) : ?>
98
+ where &lt;old URL&gt; is the previous URL of this site.
99
+ <?php endif ?>
100
+ <h2>For everyone:</h2>
101
+ If you have updated the plugin and you have run into this issue then you can use the <strong>Fix
102
+ tool</strong> by clicking the following button: <br> <br>
103
+ <a href="?page=modula-lite-gallery-fix&fix=1" class="btn">Fix image paths</a> <br> <strong>If you're
104
+ unsure about what to do then please contact
105
+ <a href="mailto:diego@greentreelabs.net?subject=Help with Modula fix tool">diego@greentreelabs.net</a></strong>.
106
+ </div>
107
+ </div>
108
+ </div>
 
 
 
109
  <?php endif ?>
admin/header.php CHANGED
@@ -1,12 +1,4 @@
1
  <header id="top" class="modula-header" >
2
  <h1 class="header center-on-small-only">Modula Lite</h1>
3
  <h4 class="light text-lighten-4 center-on-small-only"><?php print $tg_subtitle ?></h4>
4
- </header>
5
-
6
- <?php if(! isset($nobanner)) : ?>
7
- <a id="modula-survey" class="typeform-share button" href="https://greentreelabs.typeform.com/to/Ieyk9T" data-mode="1" target="_blank">
8
- <img src="<?php print plugins_url('/images/survey.png',__file__) ?>" alt="Survey">
9
- <span>I'd love a feedback from you! Please complete a short survey and get a <strong>10% discount</strong> for a Modula full license!</span>
10
- </a>
11
- <script>(function(){var qs,js,q,s,d=document,gi=d.getElementById,ce=d.createElement,gt=d.getElementsByTagName,id='typef_orm',b='https://s3-eu-west-1.amazonaws.com/share.typeform.com/';if(!gi.call(d,id)){js=ce.call(d,'script');js.id=id;js.src=b+'share.js';q=gt.call(d,'script')[0];q.parentNode.insertBefore(js,q)}id=id+'_';if(!gi.call(d,id)){qs=ce.call(d,'link');qs.rel='stylesheet';qs.id=id;qs.href=b+'share-button.css';s=gt.call(d,'head')[0];s.appendChild(qs,s)}})()</script>
12
- <?php endif ?>
1
  <header id="top" class="modula-header" >
2
  <h1 class="header center-on-small-only">Modula Lite</h1>
3
  <h4 class="light text-lighten-4 center-on-small-only"><?php print $tg_subtitle ?></h4>
4
+ </header>
 
 
 
 
 
 
 
 
admin/images/material-design.gif ADDED
Binary file
admin/images/modula-logo.jpg ADDED
Binary file
admin/import.php CHANGED
@@ -1,76 +1,81 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
3
-
4
- if(empty($tg_subtitle))
5
- {
6
- $tg_subtitle = "Import galleries";
7
- }
8
-
9
- ?>
10
- <?php include("header.php"); ?>
11
-
12
- <div id="modula-wizard" >
13
- <h2> <?php _e('Import galleries','modula-gallery'); ?> </h2>
14
- <form action="#" method="post" onsubmit="return false;">
15
- <?php wp_nonce_field('Modula', 'Modula'); ?>
16
-
17
- <fieldset data-step="1">
18
- <div class="row">
19
- <div class="input-field">
20
- <p>Select an external source from which you want to import existing galleries</p>
21
- <select class="import-source">
22
- <option value=""><?php _e('Choose a source', 'modula-gallery') ?></option>
23
- <?php if(class_exists( "Envira_Gallery_Lite" ) || class_exists( "Envira_Gallery" )) : ?>
24
- <option>Envira</option>
25
- <?php endif ?>
26
- <?php if(class_exists( "nggGallery" )) : ?>
27
- <option>NextGen</option>
28
- <?php endif ?>
29
- </select>
30
- </div>
31
- </div>
32
- </fieldset>
33
- <fieldset data-step="2" data-branch="galleries">
34
- <div class="field">
35
- <h5><?php _e('List of galleries','modula-gallery')?></h5>
36
- <div id="external-galleries">
37
- <ul></ul>
38
- <button class="waves-effect button-bg green lighten-3 waves-light btn js-select-all">Select all</button>
39
- </div>
40
- </div>
41
- </fieldset>
42
- <fieldset data-step="3" data-save="true">
43
- <h5>You are going to import <strong class="galleries-count"></strong> galleries.</h5>
44
- </fieldset>
45
-
46
- <footer class="page-footer">
47
- <div class="progress loading hide">
48
- <div class="indeterminate"></div>
49
- </div>
50
-
51
- <a class="waves-effect waves-yellow btn-flat prev"><?php _e('Previous','modula-gallery')?></a>
52
- <a class="waves-effect waves-green btn-flat next"><?php _e('Next','modula-gallery')?></a>
53
- </footer>
54
-
55
- </form>
56
- <div id="success" class="modal">
57
- <div class="modal-content">
58
- <h4><?php _e('Success!','modula-gallery')?></h4>
59
- <p><?php _e('All selected galleries have been imported!','modula-gallery')?></p>
60
- <p>Go to the <a href="?page=ModulaLite-admin">dashboard page</a> and copy the shortcode to paste inside your pages and posts</p>
61
- </div>
62
- <div class="modal-'footer">
63
- <a href="?page=ModulaLite-admin" id="modal-close" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
64
- </div>
65
- </div>
66
-
67
- <div id="error" class="modal">
68
- <div class="modal-content">
69
- <h4><?php _e('Error!','modula-gallery')?></h4>
70
- <p><?php _e('For some reason it was not possible to import one or more galleries','modula-gallery')?></p>
71
- </div>
72
- <div class="modal-footer">
73
- <a href="?page=ModulaLite-admin" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
74
- </div>
75
- </div>
76
- </div>
 
 
 
 
 
1
+ <?php
2
+ if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
3
+ die( _e( 'You are not allowed to call this page directly.', 'modula-gallery' ) );
4
+ }
5
+
6
+ if ( empty( $tg_subtitle ) ) {
7
+ $tg_subtitle = "Import galleries";
8
+ }
9
+
10
+ ?>
11
+ <?php include( "header.php" ); ?>
12
+
13
+ <div id="modula-wizard">
14
+ <h2> <?php echo esc_html__( 'Import galleries', 'modula-gallery' ); ?> </h2>
15
+ <form action="#" method="post" onsubmit="return false;">
16
+ <?php wp_nonce_field( 'Modula', 'Modula' ); ?>
17
+
18
+ <fieldset data-step="1">
19
+ <div class="row">
20
+ <div class="input-field">
21
+ <p><?php echo esc_html__( 'Select an external source from which you want to import existing galleries', 'modula-gallery' ); ?></p>
22
+ <select class="import-source">
23
+ <option value=""><?php _e( 'Choose a source', 'modula-gallery' ) ?></option>
24
+ <?php if ( class_exists( "Envira_Gallery_Lite" ) || class_exists( "Envira_Gallery" ) ) : ?>
25
+ <option>Envira</option>
26
+ <?php endif ?>
27
+ <?php if ( class_exists( "nggGallery" ) ) : ?>
28
+ <option>NextGen</option>
29
+ <?php endif ?>
30
+ </select>
31
+ </div>
32
+ </div>
33
+ </fieldset>
34
+ <fieldset data-step="2" data-branch="galleries">
35
+ <div class="field">
36
+ <h5><?php echo esc_html__( 'List of galleries', 'modula-gallery' ) ?></h5>
37
+ <div id="external-galleries">
38
+ <ul></ul>
39
+ <button class="waves-effect button-bg green lighten-3 waves-light btn js-select-all"><?php echo esc_html__( 'Select all', 'modula-gallery' ); ?>
40
+ </button>
41
+ </div>
42
+ </div>
43
+ </fieldset>
44
+ <fieldset data-step="3" data-save="true">
45
+ <h5><?php echo esc_html__( 'You are going to import ', 'modula-gallery' ) ?>
46
+ <strong class="galleries-count"></strong> <?php echo esc_html__( 'galleries.', 'modula-gallery' ) ?>
47
+ </h5>
48
+ </fieldset>
49
+
50
+ <footer class="page-footer">
51
+ <div class="progress loading hide">
52
+ <div class="indeterminate"></div>
53
+ </div>
54
+
55
+ <a class="waves-effect waves-yellow btn-flat prev"><?php echo esc_html__( 'Previous', 'modula-gallery' ) ?></a>
56
+ <a class="waves-effect waves-green btn-flat next"><?php echo esc_html__( 'Next', 'modula-gallery' ) ?></a>
57
+ </footer>
58
+
59
+ </form>
60
+ <div id="success" class="modal">
61
+ <div class="modal-content">
62
+ <h4><?php echo esc_html__( 'Success!', 'modula-gallery' ) ?></h4>
63
+ <p><?php echo esc_html__( 'All selected galleries have been imported!', 'modula-gallery' ) ?></p>
64
+ <p> <?php printf( esc_html__( 'Go to the %s and copy the shortcode to paste inside your
65
+ pages and posts', 'medzone' ), '<a href="?page=ModulaLite-admin">' . esc_html__( 'dashboard page', 'modula-gallery' ) . '</a>' ); ?></p>
66
+ </div>
67
+ <div class="modal-'footer">
68
+ <a href="?page=modula-lite-admin" id="modal-close" class="waves-effect waves-green btn-flat modal-action"><?php echo esc_html__( 'Close', 'modula-gallery' ) ?></a>
69
+ </div>
70
+ </div>
71
+
72
+ <div id="error" class="modal">
73
+ <div class="modal-content">
74
+ <h4><?php echo esc_html__( 'Error!', 'modula-gallery' ) ?></h4>
75
+ <p><?php echo esc_html__( 'For some reason it was not possible to import one or more galleries', 'modula-gallery' ) ?></p>
76
+ </div>
77
+ <div class="modal-footer">
78
+ <a href="?page=modula-lite-admin" class="waves-effect waves-green btn-flat modal-action"><?php echo esc_html__( 'Close', 'modula-gallery' ) ?></a>
79
+ </div>
80
+ </div>
81
+ </div>
admin/overview.php CHANGED
@@ -1,190 +1,177 @@
1
  <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
3
-
4
- if(empty($tg_subtitle))
5
- {
6
- $tg_subtitle = "Dashboard";
7
- }
8
-
9
- $galleries = $this->ModulaDB->getGalleries();
10
-
11
- $idx = 0;
12
- ?>
13
-
14
-
15
- <?php include("header.php"); ?>
16
-
17
- <div class="bd">
18
-
19
- <?php if(isset($redir) && $redir) : ?>
20
- <div class="row ">
21
- <div class="col s12 m6 l4">
22
- <div class="card-panel light-green lighten-4">
23
- <h5 class="cyan-text text-darken-3"><?php _e('Redirecting....','modula-gallery')?></h5>
24
- <p>
25
- <?php _e('Click a gallery to edit','modula-gallery')?>.
26
- </p>
27
- </div>
28
- </div>
29
- </div>
30
- <script>location.href="?page=ModulaLite-admin";</script>
31
- <?php endif ?>
32
-
33
- <?php if(count($galleries) == 0) : ?>
34
- <div class="row ">
35
- <div class="col s12 m6 l4">
36
- <div class="card-panel light-green lighten-4">
37
- <h5 class="cyan-text text-darken-3"><?php _e('Welcome to Modula Gallery!','modula-gallery')?></h5>
38
- <p>
39
- <?php _e('Create your first awesome gallery, click','modula-gallery')?> <a href="?page=add-modula-lite"><?php _e('here','modula-gallery')?></a>.
40
- </p>
41
- </div>
42
- </div>
43
- </div>
44
- <?php else : ?>
45
- <div class="row">
46
- <div class="col s12 m6 l4">
47
- <div class="card-panel lime lighten-4">
48
- <strong>TIP</strong>: blurry images? Try using a higher <i>Minimum image size</i> value!
49
- </div>
50
- </div>
51
- </div>
52
- <div id="gallery-list" class="row">
53
- <?php foreach($galleries as $gallery) : ?>
54
- <?php
55
- $gid = $gallery->Id;
56
- $images = $this->ModulaDB->getImagesByGalleryId($gid);
57
- $bg = count($images) ? "url('" . $images[0]->imagePath . "')" : "none";
58
- $gallery = json_decode($gallery->configuration);
59
- ?>
60
- <?php wp_nonce_field('Modula', 'Modula'); ?>
61
- <div class="col s12 m6 l4">
62
- <div class="card <?php print count($images) ? "with-image" : "" ?>" id="gallery-<?php print $gid ?>" data-gid="<?php print $gid ?>">
63
-
64
- <div class="data" style="background-image:<?php print $bg ?>">
65
- <div class="card-content white-text">
66
- <span class="card-title"><?php print $gallery->name ?></span>
67
- <br>
68
- <?php if(strlen($gallery->description)) : ?>
69
- <p><?php print $gallery->description ?></p>
70
- <?php endif ?>
71
- </div>
72
- <div class="card-action darken-4">
73
- <a href="#" data-tooltip="Show shortcode" data-position="top" data-delay="10" class="tooltipped waves-effect show-shortcode" data-gid="<?php print $gid ?>"><i class="mdi mdi-code-array"></i></a>
74
- <a href="?page=edit-modula-lite&galleryId=<?php _e($gid);?>" data-tooltip="Edit gallery" data-position="top" data-delay="10" class="tooltipped waves-effect waves"><i class="mdi mdi-pencil"></i></a>
75
- <a data-tooltip="Clone gallery" data-position="top" data-delay="10" class="tooltipped waves-effect waves clone-gallery" data-gid="<?php print $gid ?>"><i class="mdi mdi-content-copy"></i></a>
76
-
77
- <a data-tooltip="Delete gallery" datacolor="red" data-position="top" data-delay="10" class="tooltipped waves-effect waves delete-gallery" data-gid="<?php print $gid ?>"><i class="mdi mdi-delete"></i></a>
78
- </div>
79
- </div>
80
- </div>
81
- </div>
82
- <?php endforeach ?>
83
- </div>
84
- <?php endif ?>
85
- <div class="fixed-action-btn" style="bottom: 15px; right: 24px;">
86
- <a href="?page=add-modula-lite" class="btn-floating btn-large green">
87
- <i class="large mdi mdi-plus"></i>
88
- </a>
89
- </div>
90
- </div>
91
-
92
- <!-- Delete gallery modal -->
93
- <div id="delete-gallery-modal" class="modal">
94
- <div class="modal-content">
95
- <h4><?php _e('Confirmation','modula-gallery')?></h4>
96
- <p><?php _e('Do you really want to delete the gallery','modula-gallery')?> <span></span> ?</p>
97
- </div>
98
- <div class="modal-footer">
99
- <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat yes"><?php _e('Yes','modula-gallery')?></a>
100
- <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e('No','modula-gallery')?></a>
101
- </div>
102
- </div>
103
-
104
- <!-- Shortcode gallery modal -->
105
- <div id="shortcode-gallery-modal" class="modal">
106
- <div class="modal-content">
107
- <h4></h4>
108
- <p><?php _e('Copy and paste the following shortcode inside a post, page or widget:','modula-gallery')?></p>
109
- <code></code>
110
- </div>
111
- <div class="modal-footer">
112
- <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php _e('Close','modula-gallery')?></a>
113
- </div>
114
- </div>
115
-
116
-
117
- <div class="preloader-wrapper big active" id="spinner">
118
- <div class="spinner-layer spinner-blue-only">
119
- <div class="circle-clipper left">
120
- <div class="circle"></div>
121
- </div><div class="gap-patch">
122
- <div class="circle"></div>
123
- </div><div class="circle-clipper right">
124
- <div class="circle"></div>
125
- </div>
126
- </div>
127
- </div>
128
-
129
-
130
- <script>
131
- (function ($){
132
  var galleryId;
133
  var galleryName;
134
-
135
- $(".card .card-content").click(function () {
136
- var id = $(this).parents(".card").data("gid");
137
- location.href = "?page=edit-modula-lite&galleryId=" + id;
138
- });
139
-
140
- $(".delete-gallery").click(function (e) {
141
- e.preventDefault();
142
- galleryId = $(this).data("gid");
143
- galleryName = $(this).parents(".data").find(".card-title").text();
144
- $("#delete-gallery-modal span").text(galleryName);
145
- $("#delete-gallery-modal").openModal();
146
- });
147
-
148
- $(".clone-gallery").click(function (e) {
149
- e.preventDefault();
150
- var id = $(this).data("gid");
151
- var name = $(this).parents(".data").find(".card-title").text();
152
-
153
- var data ={'action': 'modula_clone_gallery', 'gid': id, 'Modula': $('#Modula').val() };
154
- TG.show_loading();
155
- jQuery.post(ajaxurl, data, function(response)
156
- {
157
- toast('Gallery "'+name+'" cloned', 2000);
158
- location.reload();
159
- TG.hide_loading();
160
-
161
- });
162
-
163
- });
164
-
165
- $(".show-shortcode").click(function(e) {
166
- e.preventDefault();
167
-
168
- var id = $(this).data("gid");
169
- var name = $(this).parents(".data").find(".card-title").text();
170
- $("#shortcode-gallery-modal h4").text(name);
171
- $("#shortcode-gallery-modal code").text("[Modula id='"+id+"']");
172
- $("#shortcode-gallery-modal").openModal();
173
- });
174
-
175
- $("body").on("click", "#delete-gallery-modal .yes", function () {
176
-
177
- var data ={'action': 'modula_delete_gallery', 'gid': galleryId, 'Modula' : $('#Modula').val() };
178
- TG.show_loading();
179
-
180
- jQuery.post(ajaxurl, data, function(response)
181
- {
182
- toast('Gallery "'+ galleryName+'" deleted', 2000);
183
- $("#gallery-" + galleryId).remove();
184
- TG.hide_loading();
185
- location.reload();
186
- });
187
-
188
- });
189
- })(jQuery);
190
- </script>
1
  <?php
2
+ if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
3
+ die( _e( 'You are not allowed to call this page directly.', 'modula-gallery' ) );
4
+ }
5
+
6
+ if ( empty( $tg_subtitle ) ) {
7
+ $tg_subtitle = "Dashboard";
8
+ }
9
+
10
+ $galleries = $this->ModulaDB->getGalleries();
11
+
12
+ $idx = 0;
13
+ ?>
14
+
15
+
16
+ <?php include( "header.php" ); ?>
17
+
18
+ <div class="bd">
19
+
20
+ <?php if ( isset( $redir ) && $redir ) : ?>
21
+ <div class="row ">
22
+ <div class="col s12 m6 l4">
23
+ <div class="card-panel light-green lighten-4">
24
+ <h5 class="cyan-text text-darken-3"><?php echo esc_html__( 'Redirecting....', 'modula-gallery' ) ?></h5>
25
+ <p>
26
+ <?php echo esc_html__( 'Click a gallery to edit', 'modula-gallery' ) ?>. </p>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ <script>location.href = '?page=modula-lite-admin';</script>
31
+ <?php endif ?>
32
+
33
+ <?php if ( count( $galleries ) == 0 ) : ?>
34
+ <div class="row ">
35
+ <div class="col s12 m6 l4">
36
+ <div class="card-panel light-green lighten-4">
37
+ <h5 class="cyan-text text-darken-3"><?php echo esc_html__( 'Welcome to Modula Gallery!', 'modula-gallery' ) ?></h5>
38
+ <p>
39
+ <?php echo esc_html__( 'Create your first awesome gallery, click', 'modula-gallery' ) ?>
40
+ <a href="?page=add-modula-lite"><?php echo esc_html__( 'here', 'modula-gallery' ) ?></a>. </p>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <?php else : ?>
45
+
46
+ <div id="gallery-list" class="row">
47
+ <?php foreach ( $galleries as $gallery ) : ?><?php
48
+ $gid = $gallery->Id;
49
+ $images = $this->ModulaDB->getImagesByGalleryId( $gid );
50
+ $bg = count( $images ) ? "url('" . $images[0]->imagePath . "')" : "none";
51
+ $gallery = json_decode( $gallery->configuration );
52
+ ?><?php wp_nonce_field( 'Modula', 'Modula' ); ?>
53
+ <div class="col s12 m6 l4">
54
+ <div class="card <?php echo count( $images ) ? "with-image" : "" ?>" id="gallery-<?php echo esc_attr( $gid ); ?>" data-gid="<?php echo esc_attr( $gid ); ?>">
55
+
56
+ <div class="data" style="background-image:<?php echo esc_attr( $bg ); ?>">
57
+ <div class="card-content white-text">
58
+ <span class="card-title"><?php echo esc_html( $gallery->name ); ?></span> <br>
59
+ <?php if ( strlen( $gallery->description ) ) : ?>
60
+ <p><?php echo esc_html( $gallery->description ) ?></p>
61
+ <?php endif ?>
62
+ </div>
63
+ <div class="card-action darken-4">
64
+ <a href="#" data-tooltip="Show shortcode" data-position="top" data-delay="10" class="tooltipped waves-effect show-shortcode" data-gid="<?php echo esc_attr( $gid ); ?>"><i class="mdi mdi-code-array"></i></a>
65
+ <a href="?page=modula-lite-edit&galleryId=<?php echo absint( $gid ); ?>" data-tooltip="Edit gallery" data-position="top" data-delay="10" class="tooltipped
66
+ waves-effect waves"><i class="mdi mdi-pencil"></i></a>
67
+ <a data-tooltip="Clone gallery" data-position="top" data-delay="10" class="tooltipped waves-effect waves clone-gallery" data-gid="<?php echo esc_attr( $gid ); ?>"><i class="mdi mdi-content-copy"></i></a>
68
+
69
+ <a data-tooltip="Delete gallery" datacolor="red" data-position="top" data-delay="10" class="tooltipped waves-effect waves delete-gallery" data-gid="<?php echo esc_attr( $gid ); ?>"><i class="mdi mdi-delete"></i></a>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ <?php endforeach ?>
75
+ </div>
76
+ <?php endif ?>
77
+
78
+ <!-- Delete gallery modal -->
79
+ <div id="delete-gallery-modal" class="modal">
80
+ <div class="modal-content">
81
+ <h4><?php echo esc_html__( 'Confirmation', 'modula-gallery' ) ?></h4>
82
+ <p><?php echo esc_html__( 'Do you really want to delete the gallery', 'modula-gallery' ) ?> <span></span> ?
83
+ </p>
84
+ </div>
85
+ <div class="modal-footer">
86
+ <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat yes"><?php echo esc_html__( 'Yes', 'modula-gallery' ) ?></a>
87
+ <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php echo esc_html__( 'No', 'modula-gallery' ) ?></a>
88
+ </div>
89
+ </div>
90
+
91
+ <!-- Shortcode gallery modal -->
92
+ <div id="shortcode-gallery-modal" class="modal">
93
+ <div class="modal-content">
94
+ <h4></h4>
95
+ <p><?php echo esc_html__( 'Copy and paste the following shortcode inside a post, page or widget:', 'modula-gallery' ) ?></p>
96
+ <code></code>
97
+ </div>
98
+ <div class="modal-footer">
99
+ <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"><?php echo esc_html__( 'Close', 'modula-gallery' ) ?></a>
100
+ </div>
101
+ </div>
102
+
103
+ <div class="preloader-wrapper big active" id="spinner">
104
+ <div class="spinner-layer spinner-blue-only">
105
+ <div class="circle-clipper left">
106
+ <div class="circle"></div>
107
+ </div>
108
+ <div class="gap-patch">
109
+ <div class="circle"></div>
110
+ </div>
111
+ <div class="circle-clipper right">
112
+ <div class="circle"></div>
113
+ </div>
114
+ </div>
115
+ </div>
116
+
117
+ <script>
118
+ (function( $ ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  var galleryId;
120
  var galleryName;
121
+
122
+ $( '.card .card-content' ).click( function() {
123
+ var id = $( this ).parents( '.card' ).data( 'gid' );
124
+ location.href = '?page=modula-lite-edit&galleryId=' + id;
125
+ } );
126
+
127
+ $( '.delete-gallery' ).click( function( e ) {
128
+ e.preventDefault();
129
+ galleryId = $( this ).data( 'gid' );
130
+ galleryName = $( this ).parents( '.data' ).find( '.card-title' ).text();
131
+ $( '#delete-gallery-modal span' ).text( galleryName );
132
+ $( '#delete-gallery-modal' ).modal();
133
+ $( '#delete-gallery-modal' ).modal( 'open' );
134
+ } );
135
+
136
+ $( '.clone-gallery' ).click( function( e ) {
137
+ e.preventDefault();
138
+ var id = $( this ).data( 'gid' );
139
+ var name = $( this ).parents( '.data' ).find( '.card-title' ).text();
140
+
141
+ var data = { 'action': 'modula_clone_gallery', 'gid': id, 'Modula': $( '#Modula' ).val() };
142
+ TG.show_loading();
143
+ jQuery.post( ajaxurl, data, function( response ) {
144
+ Materialize.toast( 'Gallery "' + name + '" cloned', 2000 );
145
+ location.reload();
146
+ TG.hide_loading();
147
+
148
+ } );
149
+
150
+ } );
151
+
152
+ $( '.show-shortcode' ).click( function( e ) {
153
+ e.preventDefault();
154
+
155
+ var id = $( this ).data( 'gid' );
156
+ var name = $( this ).parents( '.data' ).find( '.card-title' ).text();
157
+ $( '#shortcode-gallery-modal h4' ).text( name );
158
+ $( '#shortcode-gallery-modal code' ).text( '[Modula id=\'' + id + '\']' );
159
+ $( '#shortcode-gallery-modal' ).modal();
160
+ $( '#shortcode-gallery-modal' ).modal( 'open' );
161
+ } );
162
+
163
+ $( 'body' ).on( 'click', '#delete-gallery-modal .yes', function() {
164
+
165
+ var data = { 'action': 'modula_delete_gallery', 'gid': galleryId, 'Modula': $( '#Modula' ).val() };
166
+ TG.show_loading();
167
+
168
+ jQuery.post( ajaxurl, data, function( response ) {
169
+ Materialize.toast( 'Gallery "' + galleryName + '" deleted', 2000 );
170
+ $( '#gallery-' + galleryId ).remove();
171
+ TG.hide_loading();
172
+ location.reload();
173
+ } );
174
+
175
+ } );
176
+ })( jQuery );
177
+ </script>
admin/scripts/materialize.js ADDED
@@ -0,0 +1,10021 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Materialize v0.100.2 (http://materializecss.com)
3
+ * Copyright 2014-2017 Materialize
4
+ * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
+ */
6
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
7
+
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+
10
+ // Check for jQuery.
11
+ if (typeof jQuery === 'undefined') {
12
+ // Check if require is a defined function.
13
+ if (typeof require === 'function') {
14
+ jQuery = $ = require('jquery');
15
+ // Else use the dollar sign alias.
16
+ } else {
17
+ jQuery = $;
18
+ }
19
+ }
20
+ ; /*
21
+ * jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
22
+ * Open source under the BSD License.
23
+ * Copyright © 2008 George McGinley Smith
24
+ * All rights reserved.
25
+ * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
26
+ */
27
+
28
+ (function (factory) {
29
+ if (typeof define === "function" && define.amd) {
30
+ define(['jquery'], function ($) {
31
+ return factory($);
32
+ });
33
+ } else if (typeof module === "object" && typeof module.exports === "object") {
34
+ exports = factory(require('jquery'));
35
+ } else {
36
+ factory(jQuery);
37
+ }
38
+ })(function ($) {
39
+
40
+ // Preserve the original jQuery "swing" easing as "jswing"
41
+ $.easing['jswing'] = $.easing['swing'];
42
+
43
+ var pow = Math.pow,
44
+ sqrt = Math.sqrt,
45
+ sin = Math.sin,
46
+ cos = Math.cos,
47
+ PI = Math.PI,
48
+ c1 = 1.70158,
49
+ c2 = c1 * 1.525,
50
+ c3 = c1 + 1,
51
+ c4 = 2 * PI / 3,
52
+ c5 = 2 * PI / 4.5;
53
+
54
+ // x is the fraction of animation progress, in the range 0..1
55
+ function bounceOut(x) {
56
+ var n1 = 7.5625,
57
+ d1 = 2.75;
58
+ if (x < 1 / d1) {
59
+ return n1 * x * x;
60
+ } else if (x < 2 / d1) {
61
+ return n1 * (x -= 1.5 / d1) * x + .75;
62
+ } else if (x < 2.5 / d1) {
63
+ return n1 * (x -= 2.25 / d1) * x + .9375;
64
+ } else {
65
+ return n1 * (x -= 2.625 / d1) * x + .984375;
66
+ }
67
+ }
68
+
69
+ $.extend($.easing, {
70
+ def: 'easeOutQuad',
71
+ swing: function (x) {
72
+ return $.easing[$.easing.def](x);
73
+ },
74
+ easeInQuad: function (x) {
75
+ return x * x;
76
+ },
77
+ easeOutQuad: function (x) {
78
+ return 1 - (1 - x) * (1 - x);
79
+ },
80
+ easeInOutQuad: function (x) {
81
+ return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
82
+ },
83
+ easeInCubic: function (x) {
84
+ return x * x * x;
85
+ },
86
+ easeOutCubic: function (x) {
87
+ return 1 - pow(1 - x, 3);
88
+ },
89
+ easeInOutCubic: function (x) {
90
+ return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2;
91
+ },
92
+ easeInQuart: function (x) {
93
+ return x * x * x * x;
94
+ },
95
+ easeOutQuart: function (x) {
96
+ return 1 - pow(1 - x, 4);
97
+ },
98
+ easeInOutQuart: function (x) {
99
+ return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2;
100
+ },
101
+ easeInQuint: function (x) {
102
+ return x * x * x * x * x;
103
+ },
104
+ easeOutQuint: function (x) {
105
+ return 1 - pow(1 - x, 5);
106
+ },
107
+ easeInOutQuint: function (x) {
108
+ return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2;
109
+ },
110
+ easeInSine: function (x) {
111
+ return 1 - cos(x * PI / 2);
112
+ },
113
+ easeOutSine: function (x) {
114
+ return sin(x * PI / 2);
115
+ },
116
+ easeInOutSine: function (x) {
117
+ return -(cos(PI * x) - 1) / 2;
118
+ },
119
+ easeInExpo: function (x) {
120
+ return x === 0 ? 0 : pow(2, 10 * x - 10);
121
+ },
122
+ easeOutExpo: function (x) {
123
+ return x === 1 ? 1 : 1 - pow(2, -10 * x);
124
+ },
125
+ easeInOutExpo: function (x) {
126
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
127
+ },
128
+ easeInCirc: function (x) {
129
+ return 1 - sqrt(1 - pow(x, 2));
130
+ },
131
+ easeOutCirc: function (x) {
132
+ return sqrt(1 - pow(x - 1, 2));
133
+ },
134
+ easeInOutCirc: function (x) {
135
+ return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
136
+ },
137
+ easeInElastic: function (x) {
138
+ return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);
139
+ },
140
+ easeOutElastic: function (x) {
141
+ return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;
142
+ },
143
+ easeInOutElastic: function (x) {
144
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 : pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1;
145
+ },
146
+ easeInBack: function (x) {
147
+ return c3 * x * x * x - c1 * x * x;
148
+ },
149
+ easeOutBack: function (x) {
150
+ return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
151
+ },
152
+ easeInOutBack: function (x) {
153
+ return x < 0.5 ? pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
154
+ },
155
+ easeInBounce: function (x) {
156
+ return 1 - bounceOut(1 - x);
157
+ },
158
+ easeOutBounce: bounceOut,
159
+ easeInOutBounce: function (x) {
160
+ return x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2;
161
+ }
162
+ });
163
+ });; // Custom Easing
164
+ jQuery.extend(jQuery.easing, {
165
+ easeInOutMaterial: function (x, t, b, c, d) {
166
+ if ((t /= d / 2) < 1) return c / 2 * t * t + b;
167
+ return c / 4 * ((t -= 2) * t * t + 2) + b;
168
+ }
169
+ });; /*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
170
+ /*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
171
+ /*! Note that this has been modified by Materialize to confirm that Velocity is not already being imported. */
172
+ jQuery.Velocity ? console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity.") : (!function (e) {
173
+ function t(e) {
174
+ var t = e.length,
175
+ a = r.type(e);return "function" === a || r.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === a || 0 === t || "number" == typeof t && t > 0 && t - 1 in e;
176
+ }if (!e.jQuery) {
177
+ var r = function (e, t) {
178
+ return new r.fn.init(e, t);
179
+ };r.isWindow = function (e) {
180
+ return null != e && e == e.window;
181
+ }, r.type = function (e) {
182
+ return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? n[i.call(e)] || "object" : typeof e;
183
+ }, r.isArray = Array.isArray || function (e) {
184
+ return "array" === r.type(e);
185
+ }, r.isPlainObject = function (e) {
186
+ var t;if (!e || "object" !== r.type(e) || e.nodeType || r.isWindow(e)) return !1;try {
187
+ if (e.constructor && !o.call(e, "constructor") && !o.call(e.constructor.prototype, "isPrototypeOf")) return !1;
188
+ } catch (a) {
189
+ return !1;
190
+ }for (t in e) {}return void 0 === t || o.call(e, t);
191
+ }, r.each = function (e, r, a) {
192
+ var n,
193
+ o = 0,
194
+ i = e.length,
195
+ s = t(e);if (a) {
196
+ if (s) for (; i > o && (n = r.apply(e[o], a), n !== !1); o++) {} else for (o in e) {
197
+ if (n = r.apply(e[o], a), n === !1) break;
198
+ }
199
+ } else if (s) for (; i > o && (n = r.call(e[o], o, e[o]), n !== !1); o++) {} else for (o in e) {
200
+ if (n = r.call(e[o], o, e[o]), n === !1) break;
201
+ }return e;
202
+ }, r.data = function (e, t, n) {
203
+ if (void 0 === n) {
204
+ var o = e[r.expando],
205
+ i = o && a[o];if (void 0 === t) return i;if (i && t in i) return i[t];
206
+ } else if (void 0 !== t) {
207
+ var o = e[r.expando] || (e[r.expando] = ++r.uuid);return a[o] = a[o] || {}, a[o][t] = n, n;
208
+ }
209
+ }, r.removeData = function (e, t) {
210
+ var n = e[r.expando],
211
+ o = n && a[n];o && r.each(t, function (e, t) {
212
+ delete o[t];
213
+ });
214
+ }, r.extend = function () {
215
+ var e,
216
+ t,
217
+ a,
218
+ n,
219
+ o,
220
+ i,
221
+ s = arguments[0] || {},
222
+ l = 1,
223
+ u = arguments.length,
224
+ c = !1;for ("boolean" == typeof s && (c = s, s = arguments[l] || {}, l++), "object" != typeof s && "function" !== r.type(s) && (s = {}), l === u && (s = this, l--); u > l; l++) {
225
+ if (null != (o = arguments[l])) for (n in o) {
226
+ e = s[n], a = o[n], s !== a && (c && a && (r.isPlainObject(a) || (t = r.isArray(a))) ? (t ? (t = !1, i = e && r.isArray(e) ? e : []) : i = e && r.isPlainObject(e) ? e : {}, s[n] = r.extend(c, i, a)) : void 0 !== a && (s[n] = a));
227
+ }
228
+ }return s;
229
+ }, r.queue = function (e, a, n) {
230
+ function o(e, r) {
231
+ var a = r || [];return null != e && (t(Object(e)) ? !function (e, t) {
232
+ for (var r = +t.length, a = 0, n = e.length; r > a;) {
233
+ e[n++] = t[a++];
234
+ }if (r !== r) for (; void 0 !== t[a];) {
235
+ e[n++] = t[a++];
236
+ }return e.length = n, e;
237
+ }(a, "string" == typeof e ? [e] : e) : [].push.call(a, e)), a;
238
+ }if (e) {
239
+ a = (a || "fx") + "queue";var i = r.data(e, a);return n ? (!i || r.isArray(n) ? i = r.data(e, a, o(n)) : i.push(n), i) : i || [];
240
+ }
241
+ }, r.dequeue = function (e, t) {
242
+ r.each(e.nodeType ? [e] : e, function (e, a) {
243
+ t = t || "fx";var n = r.queue(a, t),
244
+ o = n.shift();"inprogress" === o && (o = n.shift()), o && ("fx" === t && n.unshift("inprogress"), o.call(a, function () {
245
+ r.dequeue(a, t);
246
+ }));
247
+ });
248
+ }, r.fn = r.prototype = { init: function (e) {
249
+ if (e.nodeType) return this[0] = e, this;throw new Error("Not a DOM node.");
250
+ }, offset: function () {
251
+ var t = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { top: 0, left: 0 };return { top: t.top + (e.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), left: t.left + (e.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) };
252
+ }, position: function () {
253
+ function e() {
254
+ for (var e = this.offsetParent || document; e && "html" === !e.nodeType.toLowerCase && "static" === e.style.position;) {
255
+ e = e.offsetParent;
256
+ }return e || document;
257
+ }var t = this[0],
258
+ e = e.apply(t),
259
+ a = this.offset(),
260
+ n = /^(?:body|html)$/i.test(e.nodeName) ? { top: 0, left: 0 } : r(e).offset();return a.top -= parseFloat(t.style.marginTop) || 0, a.left -= parseFloat(t.style.marginLeft) || 0, e.style && (n.top += parseFloat(e.style.borderTopWidth) || 0, n.left += parseFloat(e.style.borderLeftWidth) || 0), { top: a.top - n.top, left: a.left - n.left };
261
+ } };var a = {};r.expando = "velocity" + new Date().getTime(), r.uuid = 0;for (var n = {}, o = n.hasOwnProperty, i = n.toString, s = "Boolean Number String Function Array Date RegExp Object Error".split(" "), l = 0; l < s.length; l++) {
262
+ n["[object " + s[l] + "]"] = s[l].toLowerCase();
263
+ }r.fn.init.prototype = r.fn, e.Velocity = { Utilities: r };
264
+ }
265
+ }(window), function (e) {
266
+ "object" == typeof module && "object" == typeof module.exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e();
267
+ }(function () {
268
+ return function (e, t, r, a) {
269
+ function n(e) {
270
+ for (var t = -1, r = e ? e.length : 0, a = []; ++t < r;) {
271
+ var n = e[t];n && a.push(n);
272
+ }return a;
273
+ }function o(e) {
274
+ return m.isWrapped(e) ? e = [].slice.call(e) : m.isNode(e) && (e = [e]), e;
275
+ }function i(e) {
276
+ var t = f.data(e, "velocity");return null === t ? a : t;
277
+ }function s(e) {
278
+ return function (t) {
279
+ return Math.round(t * e) * (1 / e);
280
+ };
281
+ }function l(e, r, a, n) {
282
+ function o(e, t) {
283
+ return 1 - 3 * t + 3 * e;
284
+ }function i(e, t) {
285
+ return 3 * t - 6 * e;
286
+ }function s(e) {
287
+ return 3 * e;
288
+ }function l(e, t, r) {
289
+ return ((o(t, r) * e + i(t, r)) * e + s(t)) * e;
290
+ }function u(e, t, r) {
291
+ return 3 * o(t, r) * e * e + 2 * i(t, r) * e + s(t);
292
+ }function c(t, r) {
293
+ for (var n = 0; m > n; ++n) {
294
+ var o = u(r, e, a);if (0 === o) return r;var i = l(r, e, a) - t;r -= i / o;
295
+ }return r;
296
+ }function p() {
297
+ for (var t = 0; b > t; ++t) {
298
+ w[t] = l(t * x, e, a);
299
+ }
300
+ }function f(t, r, n) {
301
+ var o,
302
+ i,
303
+ s = 0;do {
304
+ i = r + (n - r) / 2, o = l(i, e, a) - t, o > 0 ? n = i : r = i;
305
+ } while (Math.abs(o) > h && ++s < v);return i;
306
+ }function d(t) {
307
+ for (var r = 0, n = 1, o = b - 1; n != o && w[n] <= t; ++n) {
308
+ r += x;
309
+ }--n;var i = (t - w[n]) / (w[n + 1] - w[n]),
310
+ s = r + i * x,
311
+ l = u(s, e, a);return l >= y ? c(t, s) : 0 == l ? s : f(t, r, r + x);
312
+ }function g() {
313
+ V = !0, (e != r || a != n) && p();
314
+ }var m = 4,
315
+ y = .001,
316
+ h = 1e-7,
317
+ v = 10,
318
+ b = 11,
319
+ x = 1 / (b - 1),
320
+ S = "Float32Array" in t;if (4 !== arguments.length) return !1;for (var P = 0; 4 > P; ++P) {
321
+ if ("number" != typeof arguments[P] || isNaN(arguments[P]) || !isFinite(arguments[P])) return !1;
322
+ }e = Math.min(e, 1), a = Math.min(a, 1), e = Math.max(e, 0), a = Math.max(a, 0);var w = S ? new Float32Array(b) : new Array(b),
323
+ V = !1,
324
+ C = function (t) {
325
+ return V || g(), e === r && a === n ? t : 0 === t ? 0 : 1 === t ? 1 : l(d(t), r, n);
326
+ };C.getControlPoints = function () {
327
+ return [{ x: e, y: r }, { x: a, y: n }];
328
+ };var T = "generateBezier(" + [e, r, a, n] + ")";return C.toString = function () {
329
+ return T;
330
+ }, C;
331
+ }function u(e, t) {
332
+ var r = e;return m.isString(e) ? b.Easings[e] || (r = !1) : r = m.isArray(e) && 1 === e.length ? s.apply(null, e) : m.isArray(e) && 2 === e.length ? x.apply(null, e.concat([t])) : m.isArray(e) && 4 === e.length ? l.apply(null, e) : !1, r === !1 && (r = b.Easings[b.defaults.easing] ? b.defaults.easing : v), r;
333
+ }function c(e) {
334
+ if (e) {
335
+ var t = new Date().getTime(),
336
+ r = b.State.calls.length;r > 1e4 && (b.State.calls = n(b.State.calls));for (var o = 0; r > o; o++) {
337
+ if (b.State.calls[o]) {
338
+ var s = b.State.calls[o],
339
+ l = s[0],
340
+ u = s[2],
341
+ d = s[3],
342
+ g = !!d,
343
+ y = null;d || (d = b.State.calls[o][3] = t - 16);for (var h = Math.min((t - d) / u.duration, 1), v = 0, x = l.length; x > v; v++) {
344
+ var P = l[v],
345
+ V = P.element;if (i(V)) {
346
+ var C = !1;if (u.display !== a && null !== u.display && "none" !== u.display) {
347
+ if ("flex" === u.display) {
348
+ var T = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"];f.each(T, function (e, t) {
349
+ S.setPropertyValue(V, "display", t);
350
+ });
351
+ }S.setPropertyValue(V, "display", u.display);
352
+ }u.visibility !== a && "hidden" !== u.visibility && S.setPropertyValue(V, "visibility", u.visibility);for (var k in P) {
353
+ if ("element" !== k) {
354
+ var A,
355
+ F = P[k],
356
+ j = m.isString(F.easing) ? b.Easings[F.easing] : F.easing;if (1 === h) A = F.endValue;else {
357
+ var E = F.endValue - F.startValue;if (A = F.startValue + E * j(h, u, E), !g && A === F.currentValue) continue;
358
+ }if (F.currentValue = A, "tween" === k) y = A;else {
359
+ if (S.Hooks.registered[k]) {
360
+ var H = S.Hooks.getRoot(k),
361
+ N = i(V).rootPropertyValueCache[H];N && (F.rootPropertyValue = N);
362
+ }var L = S.setPropertyValue(V, k, F.currentValue + (0 === parseFloat(A) ? "" : F.unitType), F.rootPropertyValue, F.scrollData);S.Hooks.registered[k] && (i(V).rootPropertyValueCache[H] = S.Normalizations.registered[H] ? S.Normalizations.registered[H]("extract", null, L[1]) : L[1]), "transform" === L[0] && (C = !0);
363
+ }
364
+ }
365
+ }u.mobileHA && i(V).transformCache.translate3d === a && (i(V).transformCache.translate3d = "(0px, 0px, 0px)", C = !0), C && S.flushTransformCache(V);
366
+ }
367
+ }u.display !== a && "none" !== u.display && (b.State.calls[o][2].display = !1), u.visibility !== a && "hidden" !== u.visibility && (b.State.calls[o][2].visibility = !1), u.progress && u.progress.call(s[1], s[1], h, Math.max(0, d + u.duration - t), d, y), 1 === h && p(o);
368
+ }
369
+ }
370
+ }b.State.isTicking && w(c);
371
+ }function p(e, t) {
372
+ if (!b.State.calls[e]) return !1;for (var r = b.State.calls[e][0], n = b.State.calls[e][1], o = b.State.calls[e][2], s = b.State.calls[e][4], l = !1, u = 0, c = r.length; c > u; u++) {
373
+ var p = r[u].element;if (t || o.loop || ("none" === o.display && S.setPropertyValue(p, "display", o.display), "hidden" === o.visibility && S.setPropertyValue(p, "visibility", o.visibility)), o.loop !== !0 && (f.queue(p)[1] === a || !/\.velocityQueueEntryFlag/i.test(f.queue(p)[1])) && i(p)) {
374
+ i(p).isAnimating = !1, i(p).rootPropertyValueCache = {};var d = !1;f.each(S.Lists.transforms3D, function (e, t) {
375
+ var r = /^scale/.test(t) ? 1 : 0,
376
+ n = i(p).transformCache[t];i(p).transformCache[t] !== a && new RegExp("^\\(" + r + "[^.]").test(n) && (d = !0, delete i(p).transformCache[t]);
377
+ }), o.mobileHA && (d = !0, delete i(p).transformCache.translate3d), d && S.flushTransformCache(p), S.Values.removeClass(p, "velocity-animating");
378
+ }if (!t && o.complete && !o.loop && u === c - 1) try {
379
+ o.complete.call(n, n);
380
+ } catch (g) {
381
+ setTimeout(function () {
382
+ throw g;
383
+ }, 1);
384
+ }s && o.loop !== !0 && s(n), i(p) && o.loop === !0 && !t && (f.each(i(p).tweensContainer, function (e, t) {
385
+ /^rotate/.test(e) && 360 === parseFloat(t.endValue) && (t.endValue = 0, t.startValue = 360), /^backgroundPosition/.test(e) && 100 === parseFloat(t.endValue) && "%" === t.unitType && (t.endValue = 0, t.startValue = 100);
386
+ }), b(p, "reverse", { loop: !0, delay: o.delay })), o.queue !== !1 && f.dequeue(p, o.queue);
387
+ }b.State.calls[e] = !1;for (var m = 0, y = b.State.calls.length; y > m; m++) {
388
+ if (b.State.calls[m] !== !1) {
389
+ l = !0;break;
390
+ }
391
+ }l === !1 && (b.State.isTicking = !1, delete b.State.calls, b.State.calls = []);
392
+ }var f,
393
+ d = function () {
394
+ if (r.documentMode) return r.documentMode;for (var e = 7; e > 4; e--) {
395
+ var t = r.createElement("div");if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->", t.getElementsByTagName("span").length) return t = null, e;
396
+ }return a;
397
+ }(),
398
+ g = function () {
399
+ var e = 0;return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function (t) {
400
+ var r,
401
+ a = new Date().getTime();return r = Math.max(0, 16 - (a - e)), e = a + r, setTimeout(function () {
402
+ t(a + r);
403
+ }, r);
404
+ };
405
+ }(),
406
+ m = { isString: function (e) {
407
+ return "string" == typeof e;
408
+ }, isArray: Array.isArray || function (e) {
409
+ return "[object Array]" === Object.prototype.toString.call(e);
410
+ }, isFunction: function (e) {
411
+ return "[object Function]" === Object.prototype.toString.call(e);
412
+ }, isNode: function (e) {
413
+ return e && e.nodeType;
414
+ }, isNodeList: function (e) {
415
+ return "object" == typeof e && /^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e)) && e.length !== a && (0 === e.length || "object" == typeof e[0] && e[0].nodeType > 0);
416
+ }, isWrapped: function (e) {
417
+ return e && (e.jquery || t.Zepto && t.Zepto.zepto.isZ(e));
418
+ }, isSVG: function (e) {
419
+ return t.SVGElement && e instanceof t.SVGElement;
420
+ }, isEmptyObject: function (e) {
421
+ for (var t in e) {
422
+ return !1;
423
+ }return !0;
424
+ } },
425
+ y = !1;if (e.fn && e.fn.jquery ? (f = e, y = !0) : f = t.Velocity.Utilities, 8 >= d && !y) throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if (7 >= d) return void (jQuery.fn.velocity = jQuery.fn.animate);var h = 400,
426
+ v = "swing",
427
+ b = { State: { isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), isAndroid: /Android/i.test(navigator.userAgent), isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), isChrome: t.chrome, isFirefox: /Firefox/i.test(navigator.userAgent), prefixElement: r.createElement("div"), prefixMatches: {}, scrollAnchor: null, scrollPropertyLeft: null, scrollPropertyTop: null, isTicking: !1, calls: [] }, CSS: {}, Utilities: f, Redirects: {}, Easings: {}, Promise: t.Promise, defaults: { queue: "", duration: h, easing: v, begin: a, complete: a, progress: a, display: a, visibility: a, loop: !1, delay: !1, mobileHA: !0, _cacheValues: !0 }, init: function (e) {
428
+ f.data(e, "velocity", { isSVG: m.isSVG(e), isAnimating: !1, computedStyle: null, tweensContainer: null, rootPropertyValueCache: {}, transformCache: {} });
429
+ }, hook: null, mock: !1, version: { major: 1, minor: 2, patch: 2 }, debug: !1 };t.pageYOffset !== a ? (b.State.scrollAnchor = t, b.State.scrollPropertyLeft = "pageXOffset", b.State.scrollPropertyTop = "pageYOffset") : (b.State.scrollAnchor = r.documentElement || r.body.parentNode || r.body, b.State.scrollPropertyLeft = "scrollLeft", b.State.scrollPropertyTop = "scrollTop");var x = function () {
430
+ function e(e) {
431
+ return -e.tension * e.x - e.friction * e.v;
432
+ }function t(t, r, a) {
433
+ var n = { x: t.x + a.dx * r, v: t.v + a.dv * r, tension: t.tension, friction: t.friction };return { dx: n.v, dv: e(n) };
434
+ }function r(r, a) {
435
+ var n = { dx: r.v, dv: e(r) },
436
+ o = t(r, .5 * a, n),
437
+ i = t(r, .5 * a, o),
438
+ s = t(r, a, i),
439
+ l = 1 / 6 * (n.dx + 2 * (o.dx + i.dx) + s.dx),
440
+ u = 1 / 6 * (n.dv + 2 * (o.dv + i.dv) + s.dv);return r.x = r.x + l * a, r.v = r.v + u * a, r;
441
+ }return function a(e, t, n) {
442
+ var o,
443
+ i,
444
+ s,
445
+ l = { x: -1, v: 0, tension: null, friction: null },
446
+ u = [0],
447
+ c = 0,
448
+ p = 1e-4,
449
+ f = .016;for (e = parseFloat(e) || 500, t = parseFloat(t) || 20, n = n || null, l.tension = e, l.friction = t, o = null !== n, o ? (c = a(e, t), i = c / n * f) : i = f; s = r(s || l, i), u.push(1 + s.x), c += 16, Math.abs(s.x) > p && Math.abs(s.v) > p;) {}return o ? function (e) {
450
+ return u[e * (u.length - 1) | 0];
451
+ } : c;
452
+ };
453
+ }();b.Easings = { linear: function (e) {
454
+ return e;
455
+ }, swing: function (e) {
456
+ return .5 - Math.cos(e * Math.PI) / 2;
457
+ }, spring: function (e) {
458
+ return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6 * -e);
459
+ } }, f.each([["ease", [.25, .1, .25, 1]], ["ease-in", [.42, 0, 1, 1]], ["ease-out", [0, 0, .58, 1]], ["ease-in-out", [.42, 0, .58, 1]], ["easeInSine", [.47, 0, .745, .715]], ["easeOutSine", [.39, .575, .565, 1]], ["easeInOutSine", [.445, .05, .55, .95]], ["easeInQuad", [.55, .085, .68, .53]], ["easeOutQuad", [.25, .46, .45, .94]], ["easeInOutQuad", [.455, .03, .515, .955]], ["easeInCubic", [.55, .055, .675, .19]], ["easeOutCubic", [.215, .61, .355, 1]], ["easeInOutCubic", [.645, .045, .355, 1]], ["easeInQuart", [.895, .03, .685, .22]], ["easeOutQuart", [.165, .84, .44, 1]], ["easeInOutQuart", [.77, 0, .175, 1]], ["easeInQuint", [.755, .05, .855, .06]], ["easeOutQuint", [.23, 1, .32, 1]], ["easeInOutQuint", [.86, 0, .07, 1]], ["easeInExpo", [.95, .05, .795, .035]], ["easeOutExpo", [.19, 1, .22, 1]], ["easeInOutExpo", [1, 0, 0, 1]], ["easeInCirc", [.6, .04, .98, .335]], ["easeOutCirc", [.075, .82, .165, 1]], ["easeInOutCirc", [.785, .135, .15, .86]]], function (e, t) {
460
+ b.Easings[t[0]] = l.apply(null, t[1]);
461
+ });var S = b.CSS = { RegEx: { isHex: /^#([A-f\d]{3}){1,2}$/i, valueUnwrap: /^[A-z]+\((.*)\)$/i, wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi }, Lists: { colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"] }, Hooks: { templates: { textShadow: ["Color X Y Blur", "black 0px 0px 0px"], boxShadow: ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], clip: ["Top Right Bottom Left", "0px 0px 0px 0px"], backgroundPosition: ["X Y", "0% 0%"], transformOrigin: ["X Y Z", "50% 50% 0px"], perspectiveOrigin: ["X Y", "50% 50%"] }, registered: {}, register: function () {
462
+ for (var e = 0; e < S.Lists.colors.length; e++) {
463
+ var t = "color" === S.Lists.colors[e] ? "0 0 0 1" : "255 255 255 1";S.Hooks.templates[S.Lists.colors[e]] = ["Red Green Blue Alpha", t];
464
+ }var r, a, n;if (d) for (r in S.Hooks.templates) {
465
+ a = S.Hooks.templates[r], n = a[0].split(" ");var o = a[1].match(S.RegEx.valueSplit);"Color" === n[0] && (n.push(n.shift()), o.push(o.shift()), S.Hooks.templates[r] = [n.join(" "), o.join(" ")]);
466
+ }for (r in S.Hooks.templates) {
467
+ a = S.Hooks.templates[r], n = a[0].split(" ");for (var e in n) {
468
+ var i = r + n[e],
469
+ s = e;S.Hooks.registered[i] = [r, s];
470
+ }
471
+ }
472
+ }, getRoot: function (e) {
473
+ var t = S.Hooks.registered[e];return t ? t[0] : e;
474
+ }, cleanRootPropertyValue: function (e, t) {
475
+ return S.RegEx.valueUnwrap.test(t) && (t = t.match(S.RegEx.valueUnwrap)[1]), S.Values.isCSSNullValue(t) && (t = S.Hooks.templates[e][1]), t;
476
+ }, extractValue: function (e, t) {
477
+ var r = S.Hooks.registered[e];if (r) {
478
+ var a = r[0],
479
+ n = r[1];return t = S.Hooks.cleanRootPropertyValue(a, t), t.toString().match(S.RegEx.valueSplit)[n];
480
+ }return t;
481
+ }, injectValue: function (e, t, r) {
482
+ var a = S.Hooks.registered[e];if (a) {
483
+ var n,
484
+ o,
485
+ i = a[0],
486
+ s = a[1];return r = S.Hooks.cleanRootPropertyValue(i, r), n = r.toString().match(S.RegEx.valueSplit), n[s] = t, o = n.join(" ");
487
+ }return r;
488
+ } }, Normalizations: { registered: { clip: function (e, t, r) {
489
+ switch (e) {case "name":
490
+ return "clip";case "extract":
491
+ var a;return S.RegEx.wrappedValueAlreadyExtracted.test(r) ? a = r : (a = r.toString().match(S.RegEx.valueUnwrap), a = a ? a[1].replace(/,(\s+)?/g, " ") : r), a;case "inject":
492
+ return "rect(" + r + ")";}
493
+ }, blur: function (e, t, r) {
494
+ switch (e) {case "name":
495
+ return b.State.isFirefox ? "filter" : "-webkit-filter";case "extract":
496
+ var a = parseFloat(r);if (!a && 0 !== a) {
497
+ var n = r.toString().match(/blur\(([0-9]+[A-z]+)\)/i);a = n ? n[1] : 0;
498
+ }return a;case "inject":
499
+ return parseFloat(r) ? "blur(" + r + ")" : "none";}
500
+ }, opacity: function (e, t, r) {
501
+ if (8 >= d) switch (e) {case "name":
502
+ return "filter";case "extract":
503
+ var a = r.toString().match(/alpha\(opacity=(.*)\)/i);return r = a ? a[1] / 100 : 1;case "inject":
504
+ return t.style.zoom = 1, parseFloat(r) >= 1 ? "" : "alpha(opacity=" + parseInt(100 * parseFloat(r), 10) + ")";} else switch (e) {case "name":
505
+ return "opacity";case "extract":
506
+ return r;case "inject":
507
+ return r;}
508
+ } }, register: function () {
509
+ 9 >= d || b.State.isGingerbread || (S.Lists.transformsBase = S.Lists.transformsBase.concat(S.Lists.transforms3D));for (var e = 0; e < S.Lists.transformsBase.length; e++) {
510
+ !function () {
511
+ var t = S.Lists.transformsBase[e];S.Normalizations.registered[t] = function (e, r, n) {
512
+ switch (e) {case "name":
513
+ return "transform";case "extract":
514
+ return i(r) === a || i(r).transformCache[t] === a ? /^scale/i.test(t) ? 1 : 0 : i(r).transformCache[t].replace(/[()]/g, "");case "inject":
515
+ var o = !1;switch (t.substr(0, t.length - 1)) {case "translate":
516
+ o = !/(%|px|em|rem|vw|vh|\d)$/i.test(n);break;case "scal":case "scale":
517
+ b.State.isAndroid && i(r).transformCache[t] === a && 1 > n && (n = 1), o = !/(\d)$/i.test(n);break;case "skew":
518
+ o = !/(deg|\d)$/i.test(n);break;case "rotate":
519
+ o = !/(deg|\d)$/i.test(n);}return o || (i(r).transformCache[t] = "(" + n + ")"), i(r).transformCache[t];}
520
+ };
521
+ }();
522
+ }for (var e = 0; e < S.Lists.colors.length; e++) {
523
+ !function () {
524
+ var t = S.Lists.colors[e];S.Normalizations.registered[t] = function (e, r, n) {
525
+ switch (e) {case "name":
526
+ return t;case "extract":
527
+ var o;if (S.RegEx.wrappedValueAlreadyExtracted.test(n)) o = n;else {
528
+ var i,
529
+ s = { black: "rgb(0, 0, 0)", blue: "rgb(0, 0, 255)", gray: "rgb(128, 128, 128)", green: "rgb(0, 128, 0)", red: "rgb(255, 0, 0)", white: "rgb(255, 255, 255)" };/^[A-z]+$/i.test(n) ? i = s[n] !== a ? s[n] : s.black : S.RegEx.isHex.test(n) ? i = "rgb(" + S.Values.hexToRgb(n).join(" ") + ")" : /^rgba?\(/i.test(n) || (i = s.black), o = (i || n).toString().match(S.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " ");
530
+ }return 8 >= d || 3 !== o.split(" ").length || (o += " 1"), o;case "inject":
531
+ return 8 >= d ? 4 === n.split(" ").length && (n = n.split(/\s+/).slice(0, 3).join(" ")) : 3 === n.split(" ").length && (n += " 1"), (8 >= d ? "rgb" : "rgba") + "(" + n.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")";}
532
+ };
533
+ }();
534
+ }
535
+ } }, Names: { camelCase: function (e) {
536
+ return e.replace(/-(\w)/g, function (e, t) {
537
+ return t.toUpperCase();
538
+ });
539
+ }, SVGAttribute: function (e) {
540
+ var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return (d || b.State.isAndroid && !b.State.isChrome) && (t += "|transform"), new RegExp("^(" + t + ")$", "i").test(e);
541
+ }, prefixCheck: function (e) {
542
+ if (b.State.prefixMatches[e]) return [b.State.prefixMatches[e], !0];for (var t = ["", "Webkit", "Moz", "ms", "O"], r = 0, a = t.length; a > r; r++) {
543
+ var n;if (n = 0 === r ? e : t[r] + e.replace(/^\w/, function (e) {
544
+ return e.toUpperCase();
545
+ }), m.isString(b.State.prefixElement.style[n])) return b.State.prefixMatches[e] = n, [n, !0];
546
+ }return [e, !1];
547
+ } }, Values: { hexToRgb: function (e) {
548
+ var t,
549
+ r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i,
550
+ a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return e = e.replace(r, function (e, t, r, a) {
551
+ return t + t + r + r + a + a;
552
+ }), t = a.exec(e), t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0];
553
+ }, isCSSNullValue: function (e) {
554
+ return 0 == e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e);
555
+ }, getUnitType: function (e) {
556
+ return (/^(rotate|skew)/i.test(e) ? "deg" : /(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e) ? "" : "px"
557
+ );
558
+ }, getDisplayType: function (e) {
559
+ var t = e && e.tagName.toString().toLowerCase();return (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t) ? "inline" : /^(li)$/i.test(t) ? "list-item" : /^(tr)$/i.test(t) ? "table-row" : /^(table)$/i.test(t) ? "table" : /^(tbody)$/i.test(t) ? "table-row-group" : "block"
560
+ );
561
+ }, addClass: function (e, t) {
562
+ e.classList ? e.classList.add(t) : e.className += (e.className.length ? " " : "") + t;
563
+ }, removeClass: function (e, t) {
564
+ e.classList ? e.classList.remove(t) : e.className = e.className.toString().replace(new RegExp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " ");
565
+ } }, getPropertyValue: function (e, r, n, o) {
566
+ function s(e, r) {
567
+ function n() {
568
+ u && S.setPropertyValue(e, "display", "none");
569
+ }var l = 0;if (8 >= d) l = f.css(e, r);else {
570
+ var u = !1;if (/^(width|height)$/.test(r) && 0 === S.getPropertyValue(e, "display") && (u = !0, S.setPropertyValue(e, "display", S.Values.getDisplayType(e))), !o) {
571
+ if ("height" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
572
+ var c = e.offsetHeight - (parseFloat(S.getPropertyValue(e, "borderTopWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderBottomWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingTop")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingBottom")) || 0);return n(), c;
573
+ }if ("width" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
574
+ var p = e.offsetWidth - (parseFloat(S.getPropertyValue(e, "borderLeftWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderRightWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingLeft")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingRight")) || 0);return n(), p;
575
+ }
576
+ }var g;g = i(e) === a ? t.getComputedStyle(e, null) : i(e).computedStyle ? i(e).computedStyle : i(e).computedStyle = t.getComputedStyle(e, null), "borderColor" === r && (r = "borderTopColor"), l = 9 === d && "filter" === r ? g.getPropertyValue(r) : g[r], ("" === l || null === l) && (l = e.style[r]), n();
577
+ }if ("auto" === l && /^(top|right|bottom|left)$/i.test(r)) {
578
+ var m = s(e, "position");("fixed" === m || "absolute" === m && /top|left/i.test(r)) && (l = f(e).position()[r] + "px");
579
+ }return l;
580
+ }var l;if (S.Hooks.registered[r]) {
581
+ var u = r,
582
+ c = S.Hooks.getRoot(u);n === a && (n = S.getPropertyValue(e, S.Names.prefixCheck(c)[0])), S.Normalizations.registered[c] && (n = S.Normalizations.registered[c]("extract", e, n)), l = S.Hooks.extractValue(u, n);
583
+ } else if (S.Normalizations.registered[r]) {
584
+ var p, g;p = S.Normalizations.registered[r]("name", e), "transform" !== p && (g = s(e, S.Names.prefixCheck(p)[0]), S.Values.isCSSNullValue(g) && S.Hooks.templates[r] && (g = S.Hooks.templates[r][1])), l = S.Normalizations.registered[r]("extract", e, g);
585
+ }if (!/^[\d-]/.test(l)) if (i(e) && i(e).isSVG && S.Names.SVGAttribute(r)) {
586
+ if (/^(height|width)$/i.test(r)) try {
587
+ l = e.getBBox()[r];
588
+ } catch (m) {
589
+ l = 0;
590
+ } else l = e.getAttribute(r);
591
+ } else l = s(e, S.Names.prefixCheck(r)[0]);return S.Values.isCSSNullValue(l) && (l = 0), b.debug >= 2 && console.log("Get " + r + ": " + l), l;
592
+ }, setPropertyValue: function (e, r, a, n, o) {
593
+ var s = r;if ("scroll" === r) o.container ? o.container["scroll" + o.direction] = a : "Left" === o.direction ? t.scrollTo(a, o.alternateValue) : t.scrollTo(o.alternateValue, a);else if (S.Normalizations.registered[r] && "transform" === S.Normalizations.registered[r]("name", e)) S.Normalizations.registered[r]("inject", e, a), s = "transform", a = i(e).transformCache[r];else {
594
+ if (S.Hooks.registered[r]) {
595
+ var l = r,
596
+ u = S.Hooks.getRoot(r);n = n || S.getPropertyValue(e, u), a = S.Hooks.injectValue(l, a, n), r = u;
597
+ }if (S.Normalizations.registered[r] && (a = S.Normalizations.registered[r]("inject", e, a), r = S.Normalizations.registered[r]("name", e)), s = S.Names.prefixCheck(r)[0], 8 >= d) try {
598
+ e.style[s] = a;
599
+ } catch (c) {
600
+ b.debug && console.log("Browser does not support [" + a + "] for [" + s + "]");
601
+ } else i(e) && i(e).isSVG && S.Names.SVGAttribute(r) ? e.setAttribute(r, a) : e.style[s] = a;b.debug >= 2 && console.log("Set " + r + " (" + s + "): " + a);
602
+ }return [s, a];
603
+ }, flushTransformCache: function (e) {
604
+ function t(t) {
605
+ return parseFloat(S.getPropertyValue(e, t));
606
+ }var r = "";if ((d || b.State.isAndroid && !b.State.isChrome) && i(e).isSVG) {
607
+ var a = { translate: [t("translateX"), t("translateY")], skewX: [t("skewX")], skewY: [t("skewY")], scale: 1 !== t("scale") ? [t("scale"), t("scale")] : [t("scaleX"), t("scaleY")], rotate: [t("rotateZ"), 0, 0] };f.each(i(e).transformCache, function (e) {
608
+ /^translate/i.test(e) ? e = "translate" : /^scale/i.test(e) ? e = "scale" : /^rotate/i.test(e) && (e = "rotate"), a[e] && (r += e + "(" + a[e].join(" ") + ") ", delete a[e]);
609
+ });
610
+ } else {
611
+ var n, o;f.each(i(e).transformCache, function (t) {
612
+ return n = i(e).transformCache[t], "transformPerspective" === t ? (o = n, !0) : (9 === d && "rotateZ" === t && (t = "rotate"), void (r += t + n + " "));
613
+ }), o && (r = "perspective" + o + " " + r);
614
+ }S.setPropertyValue(e, "transform", r);
615
+ } };S.Hooks.register(), S.Normalizations.register(), b.hook = function (e, t, r) {
616
+ var n = a;return e = o(e), f.each(e, function (e, o) {
617
+ if (i(o) === a && b.init(o), r === a) n === a && (n = b.CSS.getPropertyValue(o, t));else {
618
+ var s = b.CSS.setPropertyValue(o, t, r);"transform" === s[0] && b.CSS.flushTransformCache(o), n = s;
619
+ }
620
+ }), n;
621
+ };var P = function () {
622
+ function e() {
623
+ return s ? k.promise || null : l;
624
+ }function n() {
625
+ function e(e) {
626
+ function p(e, t) {
627
+ var r = a,
628
+ n = a,
629
+ i = a;return m.isArray(e) ? (r = e[0], !m.isArray(e[1]) && /^[\d-]/.test(e[1]) || m.isFunction(e[1]) || S.RegEx.isHex.test(e[1]) ? i = e[1] : (m.isString(e[1]) && !S.RegEx.isHex.test(e[1]) || m.isArray(e[1])) && (n = t ? e[1] : u(e[1], s.duration), e[2] !== a && (i = e[2]))) : r = e, t || (n = n || s.easing), m.isFunction(r) && (r = r.call(o, V, w)), m.isFunction(i) && (i = i.call(o, V, w)), [r || 0, n, i];
630
+ }function d(e, t) {
631
+ var r, a;return a = (t || "0").toString().toLowerCase().replace(/[%A-z]+$/, function (e) {
632
+ return r = e, "";
633
+ }), r || (r = S.Values.getUnitType(e)), [a, r];
634
+ }function h() {
635
+ var e = { myParent: o.parentNode || r.body, position: S.getPropertyValue(o, "position"), fontSize: S.getPropertyValue(o, "fontSize") },
636
+ a = e.position === L.lastPosition && e.myParent === L.lastParent,
637
+ n = e.fontSize === L.lastFontSize;L.lastParent = e.myParent, L.lastPosition = e.position, L.lastFontSize = e.fontSize;var s = 100,
638
+ l = {};if (n && a) l.emToPx = L.lastEmToPx, l.percentToPxWidth = L.lastPercentToPxWidth, l.percentToPxHeight = L.lastPercentToPxHeight;else {
639
+ var u = i(o).isSVG ? r.createElementNS("http://www.w3.org/2000/svg", "rect") : r.createElement("div");b.init(u), e.myParent.appendChild(u), f.each(["overflow", "overflowX", "overflowY"], function (e, t) {
640
+ b.CSS.setPropertyValue(u, t, "hidden");
641
+ }), b.CSS.setPropertyValue(u, "position", e.position), b.CSS.setPropertyValue(u, "fontSize", e.fontSize), b.CSS.setPropertyValue(u, "boxSizing", "content-box"), f.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function (e, t) {
642
+ b.CSS.setPropertyValue(u, t, s + "%");
643
+ }), b.CSS.setPropertyValue(u, "paddingLeft", s + "em"), l.percentToPxWidth = L.lastPercentToPxWidth = (parseFloat(S.getPropertyValue(u, "width", null, !0)) || 1) / s, l.percentToPxHeight = L.lastPercentToPxHeight = (parseFloat(S.getPropertyValue(u, "height", null, !0)) || 1) / s, l.emToPx = L.lastEmToPx = (parseFloat(S.getPropertyValue(u, "paddingLeft")) || 1) / s, e.myParent.removeChild(u);
644
+ }return null === L.remToPx && (L.remToPx = parseFloat(S.getPropertyValue(r.body, "fontSize")) || 16), null === L.vwToPx && (L.vwToPx = parseFloat(t.innerWidth) / 100, L.vhToPx = parseFloat(t.innerHeight) / 100), l.remToPx = L.remToPx, l.vwToPx = L.vwToPx, l.vhToPx = L.vhToPx, b.debug >= 1 && console.log("Unit ratios: " + JSON.stringify(l), o), l;
645
+ }if (s.begin && 0 === V) try {
646
+ s.begin.call(g, g);
647
+ } catch (x) {
648
+ setTimeout(function () {
649
+ throw x;
650
+ }, 1);
651
+ }if ("scroll" === A) {
652
+ var P,
653
+ C,
654
+ T,
655
+ F = /^x$/i.test(s.axis) ? "Left" : "Top",
656
+ j = parseFloat(s.offset) || 0;s.container ? m.isWrapped(s.container) || m.isNode(s.container) ? (s.container = s.container[0] || s.container, P = s.container["scroll" + F], T = P + f(o).position()[F.toLowerCase()] + j) : s.container = null : (P = b.State.scrollAnchor[b.State["scrollProperty" + F]], C = b.State.scrollAnchor[b.State["scrollProperty" + ("Left" === F ? "Top" : "Left")]], T = f(o).offset()[F.toLowerCase()] + j), l = { scroll: { rootPropertyValue: !1, startValue: P, currentValue: P, endValue: T, unitType: "", easing: s.easing, scrollData: { container: s.container, direction: F, alternateValue: C } }, element: o }, b.debug && console.log("tweensContainer (scroll): ", l.scroll, o);
657
+ } else if ("reverse" === A) {
658
+ if (!i(o).tweensContainer) return void f.dequeue(o, s.queue);"none" === i(o).opts.display && (i(o).opts.display = "auto"), "hidden" === i(o).opts.visibility && (i(o).opts.visibility = "visible"), i(o).opts.loop = !1, i(o).opts.begin = null, i(o).opts.complete = null, v.easing || delete s.easing, v.duration || delete s.duration, s = f.extend({}, i(o).opts, s);var E = f.extend(!0, {}, i(o).tweensContainer);for (var H in E) {
659
+ if ("element" !== H) {
660
+ var N = E[H].startValue;E[H].startValue = E[H].currentValue = E[H].endValue, E[H].endValue = N, m.isEmptyObject(v) || (E[H].easing = s.easing), b.debug && console.log("reverse tweensContainer (" + H + "): " + JSON.stringify(E[H]), o);
661
+ }
662
+ }l = E;
663
+ } else if ("start" === A) {
664
+ var E;i(o).tweensContainer && i(o).isAnimating === !0 && (E = i(o).tweensContainer), f.each(y, function (e, t) {
665
+ if (RegExp("^" + S.Lists.colors.join("$|^") + "$").test(e)) {
666
+ var r = p(t, !0),
667
+ n = r[0],
668
+ o = r[1],
669
+ i = r[2];if (S.RegEx.isHex.test(n)) {
670
+ for (var s = ["Red", "Green", "Blue"], l = S.Values.hexToRgb(n), u = i ? S.Values.hexToRgb(i) : a, c = 0; c < s.length; c++) {
671
+ var f = [l[c]];o && f.push(o), u !== a && f.push(u[c]), y[e + s[c]] = f;
672
+ }delete y[e];
673
+ }
674
+ }
675
+ });for (var z in y) {
676
+ var O = p(y[z]),
677
+ q = O[0],
678
+ $ = O[1],
679
+ M = O[2];z = S.Names.camelCase(z);var I = S.Hooks.getRoot(z),
680
+ B = !1;if (i(o).isSVG || "tween" === I || S.Names.prefixCheck(I)[1] !== !1 || S.Normalizations.registered[I] !== a) {
681
+ (s.display !== a && null !== s.display && "none" !== s.display || s.visibility !== a && "hidden" !== s.visibility) && /opacity|filter/.test(z) && !M && 0 !== q && (M = 0), s._cacheValues && E && E[z] ? (M === a && (M = E[z].endValue + E[z].unitType), B = i(o).rootPropertyValueCache[I]) : S.Hooks.registered[z] ? M === a ? (B = S.getPropertyValue(o, I), M = S.getPropertyValue(o, z, B)) : B = S.Hooks.templates[I][1] : M === a && (M = S.getPropertyValue(o, z));var W,
682
+ G,
683
+ Y,
684
+ D = !1;if (W = d(z, M), M = W[0], Y = W[1], W = d(z, q), q = W[0].replace(/^([+-\/*])=/, function (e, t) {
685
+ return D = t, "";
686
+ }), G = W[1], M = parseFloat(M) || 0, q = parseFloat(q) || 0, "%" === G && (/^(fontSize|lineHeight)$/.test(z) ? (q /= 100, G = "em") : /^scale/.test(z) ? (q /= 100, G = "") : /(Red|Green|Blue)$/i.test(z) && (q = q / 100 * 255, G = "")), /[\/*]/.test(D)) G = Y;else if (Y !== G && 0 !== M) if (0 === q) G = Y;else {
687
+ n = n || h();var Q = /margin|padding|left|right|width|text|word|letter/i.test(z) || /X$/.test(z) || "x" === z ? "x" : "y";switch (Y) {case "%":
688
+ M *= "x" === Q ? n.percentToPxWidth : n.percentToPxHeight;break;case "px":
689
+ break;default:
690
+ M *= n[Y + "ToPx"];}switch (G) {case "%":
691
+ M *= 1 / ("x" === Q ? n.percentToPxWidth : n.percentToPxHeight);break;case "px":
692
+ break;default:
693
+ M *= 1 / n[G + "ToPx"];}
694
+ }switch (D) {case "+":
695
+ q = M + q;break;case "-":
696
+ q = M - q;break;case "*":
697
+ q = M * q;break;case "/":
698
+ q = M / q;}l[z] = { rootPropertyValue: B, startValue: M, currentValue: M, endValue: q, unitType: G, easing: $ }, b.debug && console.log("tweensContainer (" + z + "): " + JSON.stringify(l[z]), o);
699
+ } else b.debug && console.log("Skipping [" + I + "] due to a lack of browser support.");
700
+ }l.element = o;
701
+ }l.element && (S.Values.addClass(o, "velocity-animating"), R.push(l), "" === s.queue && (i(o).tweensContainer = l, i(o).opts = s), i(o).isAnimating = !0, V === w - 1 ? (b.State.calls.push([R, g, s, null, k.resolver]), b.State.isTicking === !1 && (b.State.isTicking = !0, c())) : V++);
702
+ }var n,
703
+ o = this,
704
+ s = f.extend({}, b.defaults, v),
705
+ l = {};switch (i(o) === a && b.init(o), parseFloat(s.delay) && s.queue !== !1 && f.queue(o, s.queue, function (e) {
706
+ b.velocityQueueEntryFlag = !0, i(o).delayTimer = { setTimeout: setTimeout(e, parseFloat(s.delay)), next: e };
707
+ }), s.duration.toString().toLowerCase()) {case "fast":
708
+ s.duration = 200;break;case "normal":
709
+ s.duration = h;break;case "slow":
710
+ s.duration = 600;break;default:
711
+ s.duration = parseFloat(s.duration) || 1;}b.mock !== !1 && (b.mock === !0 ? s.duration = s.delay = 1 : (s.duration *= parseFloat(b.mock) || 1, s.delay *= parseFloat(b.mock) || 1)), s.easing = u(s.easing, s.duration), s.begin && !m.isFunction(s.begin) && (s.begin = null), s.progress && !m.isFunction(s.progress) && (s.progress = null), s.complete && !m.isFunction(s.complete) && (s.complete = null), s.display !== a && null !== s.display && (s.display = s.display.toString().toLowerCase(), "auto" === s.display && (s.display = b.CSS.Values.getDisplayType(o))), s.visibility !== a && null !== s.visibility && (s.visibility = s.visibility.toString().toLowerCase()), s.mobileHA = s.mobileHA && b.State.isMobile && !b.State.isGingerbread, s.queue === !1 ? s.delay ? setTimeout(e, s.delay) : e() : f.queue(o, s.queue, function (t, r) {
712
+ return r === !0 ? (k.promise && k.resolver(g), !0) : (b.velocityQueueEntryFlag = !0, void e(t));
713
+ }), "" !== s.queue && "fx" !== s.queue || "inprogress" === f.queue(o)[0] || f.dequeue(o);
714
+ }var s,
715
+ l,
716
+ d,
717
+ g,
718
+ y,
719
+ v,
720
+ x = arguments[0] && (arguments[0].p || f.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || m.isString(arguments[0].properties));if (m.isWrapped(this) ? (s = !1, d = 0, g = this, l = this) : (s = !0, d = 1, g = x ? arguments[0].elements || arguments[0].e : arguments[0]), g = o(g)) {
721
+ x ? (y = arguments[0].properties || arguments[0].p, v = arguments[0].options || arguments[0].o) : (y = arguments[d], v = arguments[d + 1]);var w = g.length,
722
+ V = 0;if (!/^(stop|finish)$/i.test(y) && !f.isPlainObject(v)) {
723
+ var C = d + 1;v = {};for (var T = C; T < arguments.length; T++) {
724
+ m.isArray(arguments[T]) || !/^(fast|normal|slow)$/i.test(arguments[T]) && !/^\d/.test(arguments[T]) ? m.isString(arguments[T]) || m.isArray(arguments[T]) ? v.easing = arguments[T] : m.isFunction(arguments[T]) && (v.complete = arguments[T]) : v.duration = arguments[T];
725
+ }
726
+ }var k = { promise: null, resolver: null, rejecter: null };s && b.Promise && (k.promise = new b.Promise(function (e, t) {
727
+ k.resolver = e, k.rejecter = t;
728
+ }));var A;switch (y) {case "scroll":
729
+ A = "scroll";break;case "reverse":
730
+ A = "reverse";break;case "finish":case "stop":
731
+ f.each(g, function (e, t) {
732
+ i(t) && i(t).delayTimer && (clearTimeout(i(t).delayTimer.setTimeout), i(t).delayTimer.next && i(t).delayTimer.next(), delete i(t).delayTimer);
733
+ });var F = [];return f.each(b.State.calls, function (e, t) {
734
+ t && f.each(t[1], function (r, n) {
735
+ var o = v === a ? "" : v;return o === !0 || t[2].queue === o || v === a && t[2].queue === !1 ? void f.each(g, function (r, a) {
736
+ a === n && ((v === !0 || m.isString(v)) && (f.each(f.queue(a, m.isString(v) ? v : ""), function (e, t) {
737
+ m.isFunction(t) && t(null, !0);
738
+ }), f.queue(a, m.isString(v) ? v : "", [])), "stop" === y ? (i(a) && i(a).tweensContainer && o !== !1 && f.each(i(a).tweensContainer, function (e, t) {
739
+ t.endValue = t.currentValue;
740
+ }), F.push(e)) : "finish" === y && (t[2].duration = 1));
741
+ }) : !0;
742
+ });
743
+ }), "stop" === y && (f.each(F, function (e, t) {
744
+ p(t, !0);
745
+ }), k.promise && k.resolver(g)), e();default:
746
+ if (!f.isPlainObject(y) || m.isEmptyObject(y)) {
747
+ if (m.isString(y) && b.Redirects[y]) {
748
+ var j = f.extend({}, v),
749
+ E = j.duration,
750
+ H = j.delay || 0;return j.backwards === !0 && (g = f.extend(!0, [], g).reverse()), f.each(g, function (e, t) {
751
+ parseFloat(j.stagger) ? j.delay = H + parseFloat(j.stagger) * e : m.isFunction(j.stagger) && (j.delay = H + j.stagger.call(t, e, w)), j.drag && (j.duration = parseFloat(E) || (/^(callout|transition)/.test(y) ? 1e3 : h), j.duration = Math.max(j.duration * (j.backwards ? 1 - e / w : (e + 1) / w), .75 * j.duration, 200)), b.Redirects[y].call(t, t, j || {}, e, w, g, k.promise ? k : a);
752
+ }), e();
753
+ }var N = "Velocity: First argument (" + y + ") was not a property map, a known action, or a registered redirect. Aborting.";return k.promise ? k.rejecter(new Error(N)) : console.log(N), e();
754
+ }A = "start";}var L = { lastParent: null, lastPosition: null, lastFontSize: null, lastPercentToPxWidth: null, lastPercentToPxHeight: null, lastEmToPx: null, remToPx: null, vwToPx: null, vhToPx: null },
755
+ R = [];f.each(g, function (e, t) {
756
+ m.isNode(t) && n.call(t);
757
+ });var z,
758
+ j = f.extend({}, b.defaults, v);if (j.loop = parseInt(j.loop), z = 2 * j.loop - 1, j.loop) for (var O = 0; z > O; O++) {
759
+ var q = { delay: j.delay, progress: j.progress };O === z - 1 && (q.display = j.display, q.visibility = j.visibility, q.complete = j.complete), P(g, "reverse", q);
760
+ }return e();
761
+ }
762
+ };b = f.extend(P, b), b.animate = P;var w = t.requestAnimationFrame || g;return b.State.isMobile || r.hidden === a || r.addEventListener("visibilitychange", function () {
763
+ r.hidden ? (w = function (e) {
764
+ return setTimeout(function () {
765
+ e(!0);
766
+ }, 16);
767
+ }, c()) : w = t.requestAnimationFrame || g;
768
+ }), e.Velocity = b, e !== t && (e.fn.velocity = P, e.fn.velocity.defaults = b.defaults), f.each(["Down", "Up"], function (e, t) {
769
+ b.Redirects["slide" + t] = function (e, r, n, o, i, s) {
770
+ var l = f.extend({}, r),
771
+ u = l.begin,
772
+ c = l.complete,
773
+ p = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" },
774
+ d = {};l.display === a && (l.display = "Down" === t ? "inline" === b.CSS.Values.getDisplayType(e) ? "inline-block" : "block" : "none"), l.begin = function () {
775
+ u && u.call(i, i);for (var r in p) {
776
+ d[r] = e.style[r];var a = b.CSS.getPropertyValue(e, r);p[r] = "Down" === t ? [a, 0] : [0, a];
777
+ }d.overflow = e.style.overflow, e.style.overflow = "hidden";
778
+ }, l.complete = function () {
779
+ for (var t in d) {
780
+ e.style[t] = d[t];
781
+ }c && c.call(i, i), s && s.resolver(i);
782
+ }, b(e, p, l);
783
+ };
784
+ }), f.each(["In", "Out"], function (e, t) {
785
+ b.Redirects["fade" + t] = function (e, r, n, o, i, s) {
786
+ var l = f.extend({}, r),
787
+ u = { opacity: "In" === t ? 1 : 0 },
788
+ c = l.complete;l.complete = n !== o - 1 ? l.begin = null : function () {
789
+ c && c.call(i, i), s && s.resolver(i);
790
+ }, l.display === a && (l.display = "In" === t ? "auto" : "none"), b(this, u, l);
791
+ };
792
+ }), b;
793
+ }(window.jQuery || window.Zepto || window, window, document);
794
+ }));
795
+ ;!function (a, b, c, d) {
796
+ "use strict";
797
+ function k(a, b, c) {
798
+ return setTimeout(q(a, c), b);
799
+ }function l(a, b, c) {
800
+ return Array.isArray(a) ? (m(a, c[b], c), !0) : !1;
801
+ }function m(a, b, c) {
802
+ var e;if (a) if (a.forEach) a.forEach(b, c);else if (a.length !== d) for (e = 0; e < a.length;) {
803
+ b.call(c, a[e], e, a), e++;
804
+ } else for (e in a) {
805
+ a.hasOwnProperty(e) && b.call(c, a[e], e, a);
806
+ }
807
+ }function n(a, b, c) {
808
+ for (var e = Object.keys(b), f = 0; f < e.length;) {
809
+ (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++;
810
+ }return a;
811
+ }function o(a, b) {
812
+ return n(a, b, !0);
813
+ }function p(a, b, c) {
814
+ var e,
815
+ d = b.prototype;e = a.prototype = Object.create(d), e.constructor = a, e._super = d, c && n(e, c);
816
+ }function q(a, b) {
817
+ return function () {
818
+ return a.apply(b, arguments);
819
+ };
820
+ }function r(a, b) {
821
+ return typeof a == g ? a.apply(b ? b[0] || d : d, b) : a;
822
+ }function s(a, b) {
823
+ return a === d ? b : a;
824
+ }function t(a, b, c) {
825
+ m(x(b), function (b) {
826
+ a.addEventListener(b, c, !1);
827
+ });
828
+ }function u(a, b, c) {
829
+ m(x(b), function (b) {
830
+ a.removeEventListener(b, c, !1);
831
+ });
832
+ }function v(a, b) {
833
+ for (; a;) {
834
+ if (a == b) return !0;a = a.parentNode;
835
+ }return !1;
836
+ }function w(a, b) {
837
+ return a.indexOf(b) > -1;
838
+ }function x(a) {
839
+ return a.trim().split(/\s+/g);
840
+ }function y(a, b, c) {
841
+ if (a.indexOf && !c) return a.indexOf(b);for (var d = 0; d < a.length;) {
842
+ if (c && a[d][c] == b || !c && a[d] === b) return d;d++;
843
+ }return -1;
844
+ }function z(a) {
845
+ return Array.prototype.slice.call(a, 0);
846
+ }function A(a, b, c) {
847
+ for (var d = [], e = [], f = 0; f < a.length;) {
848
+ var g = b ? a[f][b] : a[f];y(e, g) < 0 && d.push(a[f]), e[f] = g, f++;
849
+ }return c && (d = b ? d.sort(function (a, c) {
850
+ return a[b] > c[b];
851
+ }) : d.sort()), d;
852
+ }function B(a, b) {
853
+ for (var c, f, g = b[0].toUpperCase() + b.slice(1), h = 0; h < e.length;) {
854
+ if (c = e[h], f = c ? c + g : b, f in a) return f;h++;
855
+ }return d;
856
+ }function D() {
857
+ return C++;
858
+ }function E(a) {
859
+ var b = a.ownerDocument;return b.defaultView || b.parentWindow;
860
+ }function ab(a, b) {
861
+ var c = this;this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) {
862
+ r(a.options.enable, [a]) && c.handler(b);
863
+ }, this.init();
864
+ }function bb(a) {
865
+ var b,
866
+ c = a.options.inputClass;return b = c ? c : H ? wb : I ? Eb : G ? Gb : rb, new b(a, cb);
867
+ }function cb(a, b, c) {
868
+ var d = c.pointers.length,
869
+ e = c.changedPointers.length,
870
+ f = b & O && 0 === d - e,
871
+ g = b & (Q | R) && 0 === d - e;c.isFirst = !!f, c.isFinal = !!g, f && (a.session = {}), c.eventType = b, db(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.prevInput = c;
872
+ }function db(a, b) {
873
+ var c = a.session,
874
+ d = b.pointers,
875
+ e = d.length;c.firstInput || (c.firstInput = gb(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = gb(b) : 1 === e && (c.firstMultiple = !1);var f = c.firstInput,
876
+ g = c.firstMultiple,
877
+ h = g ? g.center : f.center,
878
+ i = b.center = hb(d);b.timeStamp = j(), b.deltaTime = b.timeStamp - f.timeStamp, b.angle = lb(h, i), b.distance = kb(h, i), eb(c, b), b.offsetDirection = jb(b.deltaX, b.deltaY), b.scale = g ? nb(g.pointers, d) : 1, b.rotation = g ? mb(g.pointers, d) : 0, fb(c, b);var k = a.element;v(b.srcEvent.target, k) && (k = b.srcEvent.target), b.target = k;
879
+ }function eb(a, b) {
880
+ var c = b.center,
881
+ d = a.offsetDelta || {},
882
+ e = a.prevDelta || {},
883
+ f = a.prevInput || {};(b.eventType === O || f.eventType === Q) && (e = a.prevDelta = { x: f.deltaX || 0, y: f.deltaY || 0 }, d = a.offsetDelta = { x: c.x, y: c.y }), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y);
884
+ }function fb(a, b) {
885
+ var f,
886
+ g,
887
+ h,
888
+ j,
889
+ c = a.lastInterval || b,
890
+ e = b.timeStamp - c.timeStamp;if (b.eventType != R && (e > N || c.velocity === d)) {
891
+ var k = c.deltaX - b.deltaX,
892
+ l = c.deltaY - b.deltaY,
893
+ m = ib(e, k, l);g = m.x, h = m.y, f = i(m.x) > i(m.y) ? m.x : m.y, j = jb(k, l), a.lastInterval = b;
894
+ } else f = c.velocity, g = c.velocityX, h = c.velocityY, j = c.direction;b.velocity = f, b.velocityX = g, b.velocityY = h, b.direction = j;
895
+ }function gb(a) {
896
+ for (var b = [], c = 0; c < a.pointers.length;) {
897
+ b[c] = { clientX: h(a.pointers[c].clientX), clientY: h(a.pointers[c].clientY) }, c++;
898
+ }return { timeStamp: j(), pointers: b, center: hb(b), deltaX: a.deltaX, deltaY: a.deltaY };
899
+ }function hb(a) {
900
+ var b = a.length;if (1 === b) return { x: h(a[0].clientX), y: h(a[0].clientY) };for (var c = 0, d = 0, e = 0; b > e;) {
901
+ c += a[e].clientX, d += a[e].clientY, e++;
902
+ }return { x: h(c / b), y: h(d / b) };
903
+ }function ib(a, b, c) {
904
+ return { x: b / a || 0, y: c / a || 0 };
905
+ }function jb(a, b) {
906
+ return a === b ? S : i(a) >= i(b) ? a > 0 ? T : U : b > 0 ? V : W;
907
+ }function kb(a, b, c) {
908
+ c || (c = $);var d = b[c[0]] - a[c[0]],
909
+ e = b[c[1]] - a[c[1]];return Math.sqrt(d * d + e * e);
910
+ }function lb(a, b, c) {
911
+ c || (c = $);var d = b[c[0]] - a[c[0]],
912
+ e = b[c[1]] - a[c[1]];return 180 * Math.atan2(e, d) / Math.PI;
913
+ }function mb(a, b) {
914
+ return lb(b[1], b[0], _) - lb(a[1], a[0], _);
915
+ }function nb(a, b) {
916
+ return kb(b[0], b[1], _) / kb(a[0], a[1], _);
917
+ }function rb() {
918
+ this.evEl = pb, this.evWin = qb, this.allow = !0, this.pressed = !1, ab.apply(this, arguments);
919
+ }function wb() {
920
+ this.evEl = ub, this.evWin = vb, ab.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
921
+ }function Ab() {
922
+ this.evTarget = yb, this.evWin = zb, this.started = !1, ab.apply(this, arguments);
923
+ }function Bb(a, b) {
924
+ var c = z(a.touches),
925
+ d = z(a.changedTouches);return b & (Q | R) && (c = A(c.concat(d), "identifier", !0)), [c, d];
926
+ }function Eb() {
927
+ this.evTarget = Db, this.targetIds = {}, ab.apply(this, arguments);
928
+ }function Fb(a, b) {
929
+ var c = z(a.touches),
930
+ d = this.targetIds;if (b & (O | P) && 1 === c.length) return d[c[0].identifier] = !0, [c, c];var e,
931
+ f,
932
+ g = z(a.changedTouches),
933
+ h = [],
934
+ i = this.target;if (f = c.filter(function (a) {
935
+ return v(a.target, i);
936
+ }), b === O) for (e = 0; e < f.length;) {
937
+ d[f[e].identifier] = !0, e++;
938
+ }for (e = 0; e < g.length;) {
939
+ d[g[e].identifier] && h.push(g[e]), b & (Q | R) && delete d[g[e].identifier], e++;
940
+ }return h.length ? [A(f.concat(h), "identifier", !0), h] : void 0;
941
+ }function Gb() {
942
+ ab.apply(this, arguments);var a = q(this.handler, this);this.touch = new Eb(this.manager, a), this.mouse = new rb(this.manager, a);
943
+ }function Pb(a, b) {
944
+ this.manager = a, this.set(b);
945
+ }function Qb(a) {
946
+ if (w(a, Mb)) return Mb;var b = w(a, Nb),
947
+ c = w(a, Ob);return b && c ? Nb + " " + Ob : b || c ? b ? Nb : Ob : w(a, Lb) ? Lb : Kb;
948
+ }function Yb(a) {
949
+ this.id = D(), this.manager = null, this.options = o(a || {}, this.defaults), this.options.enable = s(this.options.enable, !0), this.state = Rb, this.simultaneous = {}, this.requireFail = [];
950
+ }function Zb(a) {
951
+ return a & Wb ? "cancel" : a & Ub ? "end" : a & Tb ? "move" : a & Sb ? "start" : "";
952
+ }function $b(a) {
953
+ return a == W ? "down" : a == V ? "up" : a == T ? "left" : a == U ? "right" : "";
954
+ }function _b(a, b) {
955
+ var c = b.manager;return c ? c.get(a) : a;
956
+ }function ac() {
957
+ Yb.apply(this, arguments);
958
+ }function bc() {
959
+ ac.apply(this, arguments), this.pX = null, this.pY = null;
960
+ }function cc() {
961
+ ac.apply(this, arguments);
962
+ }function dc() {
963
+ Yb.apply(this, arguments), this._timer = null, this._input = null;
964
+ }function ec() {
965
+ ac.apply(this, arguments);
966
+ }function fc() {
967
+ ac.apply(this, arguments);
968
+ }function gc() {
969
+ Yb.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
970
+ }function hc(a, b) {
971
+ return b = b || {}, b.recognizers = s(b.recognizers, hc.defaults.preset), new kc(a, b);
972
+ }function kc(a, b) {
973
+ b = b || {}, this.options = o(b, hc.defaults), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.element = a, this.input = bb(this), this.touchAction = new Pb(this, this.options.touchAction), lc(this, !0), m(b.recognizers, function (a) {
974
+ var b = this.add(new a[0](a[1]));a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]);
975
+ }, this);
976
+ }function lc(a, b) {
977
+ var c = a.element;m(a.options.cssProps, function (a, d) {
978
+ c.style[B(c.style, d)] = b ? a : "";
979
+ });
980
+ }function mc(a, c) {
981
+ var d = b.createEvent("Event");d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d);
982
+ }var e = ["", "webkit", "moz", "MS", "ms", "o"],
983
+ f = b.createElement("div"),
984
+ g = "function",
985
+ h = Math.round,
986
+ i = Math.abs,
987
+ j = Date.now,
988
+ C = 1,
989
+ F = /mobile|tablet|ip(ad|hone|od)|android/i,
990
+ G = "ontouchstart" in a,
991
+ H = B(a, "PointerEvent") !== d,
992
+ I = G && F.test(navigator.userAgent),
993
+ J = "touch",
994
+ K = "pen",
995
+ L = "mouse",
996
+ M = "kinect",
997
+ N = 25,
998
+ O = 1,
999
+ P = 2,
1000
+ Q = 4,
1001
+ R = 8,
1002
+ S = 1,
1003
+ T = 2,
1004
+ U = 4,
1005
+ V = 8,
1006
+ W = 16,
1007
+ X = T | U,
1008
+ Y = V | W,
1009
+ Z = X | Y,
1010
+ $ = ["x", "y"],
1011
+ _ = ["clientX", "clientY"];ab.prototype = { handler: function () {}, init: function () {
1012
+ this.evEl && t(this.element, this.evEl, this.domHandler), this.evTarget && t(this.target, this.evTarget, this.domHandler), this.evWin && t(E(this.element), this.evWin, this.domHandler);
1013
+ }, destroy: function () {
1014
+ this.evEl && u(this.element, this.evEl, this.domHandler), this.evTarget && u(this.target, this.evTarget, this.domHandler), this.evWin && u(E(this.element), this.evWin, this.domHandler);
1015
+ } };var ob = { mousedown: O, mousemove: P, mouseup: Q },
1016
+ pb = "mousedown",
1017
+ qb = "mousemove mouseup";p(rb, ab, { handler: function (a) {
1018
+ var b = ob[a.type];b & O && 0 === a.button && (this.pressed = !0), b & P && 1 !== a.which && (b = Q), this.pressed && this.allow && (b & Q && (this.pressed = !1), this.callback(this.manager, b, { pointers: [a], changedPointers: [a], pointerType: L, srcEvent: a }));
1019
+ } });var sb = { pointerdown: O, pointermove: P, pointerup: Q, pointercancel: R, pointerout: R },
1020
+ tb = { 2: J, 3: K, 4: L, 5: M },
1021
+ ub = "pointerdown",
1022
+ vb = "pointermove pointerup pointercancel";a.MSPointerEvent && (ub = "MSPointerDown", vb = "MSPointerMove MSPointerUp MSPointerCancel"), p(wb, ab, { handler: function (a) {
1023
+ var b = this.store,
1024
+ c = !1,
1025
+ d = a.type.toLowerCase().replace("ms", ""),
1026
+ e = sb[d],
1027
+ f = tb[a.pointerType] || a.pointerType,
1028
+ g = f == J,
1029
+ h = y(b, a.pointerId, "pointerId");e & O && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (Q | R) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { pointers: b, changedPointers: [a], pointerType: f, srcEvent: a }), c && b.splice(h, 1));
1030
+ } });var xb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
1031
+ yb = "touchstart",
1032
+ zb = "touchstart touchmove touchend touchcancel";p(Ab, ab, { handler: function (a) {
1033
+ var b = xb[a.type];if (b === O && (this.started = !0), this.started) {
1034
+ var c = Bb.call(this, a, b);b & (Q | R) && 0 === c[0].length - c[1].length && (this.started = !1), this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
1035
+ }
1036
+ } });var Cb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
1037
+ Db = "touchstart touchmove touchend touchcancel";p(Eb, ab, { handler: function (a) {
1038
+ var b = Cb[a.type],
1039
+ c = Fb.call(this, a, b);c && this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
1040
+ } }), p(Gb, ab, { handler: function (a, b, c) {
1041
+ var d = c.pointerType == J,
1042
+ e = c.pointerType == L;if (d) this.mouse.allow = !1;else if (e && !this.mouse.allow) return;b & (Q | R) && (this.mouse.allow = !0), this.callback(a, b, c);
1043
+ }, destroy: function () {
1044
+ this.touch.destroy(), this.mouse.destroy();
1045
+ } });var Hb = B(f.style, "touchAction"),
1046
+ Ib = Hb !== d,
1047
+ Jb = "compute",
1048
+ Kb = "auto",
1049
+ Lb = "manipulation",
1050
+ Mb = "none",
1051
+ Nb = "pan-x",
1052
+ Ob = "pan-y";Pb.prototype = { set: function (a) {
1053
+ a == Jb && (a = this.compute()), Ib && (this.manager.element.style[Hb] = a), this.actions = a.toLowerCase().trim();
1054
+ }, update: function () {
1055
+ this.set(this.manager.options.touchAction);
1056
+ }, compute: function () {
1057
+ var a = [];return m(this.manager.recognizers, function (b) {
1058
+ r(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
1059
+ }), Qb(a.join(" "));
1060
+ }, preventDefaults: function (a) {
1061
+ if (!Ib) {
1062
+ var b = a.srcEvent,
1063
+ c = a.offsetDirection;if (this.manager.session.prevented) return b.preventDefault(), void 0;var d = this.actions,
1064
+ e = w(d, Mb),
1065
+ f = w(d, Ob),
1066
+ g = w(d, Nb);return e || f && c & X || g && c & Y ? this.preventSrc(b) : void 0;
1067
+ }
1068
+ }, preventSrc: function (a) {
1069
+ this.manager.session.prevented = !0, a.preventDefault();
1070
+ } };var Rb = 1,
1071
+ Sb = 2,
1072
+ Tb = 4,
1073
+ Ub = 8,
1074
+ Vb = Ub,
1075
+ Wb = 16,
1076
+ Xb = 32;Yb.prototype = { defaults: {}, set: function (a) {
1077
+ return n(this.options, a), this.manager && this.manager.touchAction.update(), this;
1078
+ }, recognizeWith: function (a) {
1079
+ if (l(a, "recognizeWith", this)) return this;var b = this.simultaneous;return a = _b(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this;
1080
+ }, dropRecognizeWith: function (a) {
1081
+ return l(a, "dropRecognizeWith", this) ? this : (a = _b(a, this), delete this.simultaneous[a.id], this);
1082
+ }, requireFailure: function (a) {
1083
+ if (l(a, "requireFailure", this)) return this;var b = this.requireFail;return a = _b(a, this), -1 === y(b, a) && (b.push(a), a.requireFailure(this)), this;
1084
+ }, dropRequireFailure: function (a) {
1085
+ if (l(a, "dropRequireFailure", this)) return this;a = _b(a, this);var b = y(this.requireFail, a);return b > -1 && this.requireFail.splice(b, 1), this;
1086
+ }, hasRequireFailures: function () {
1087
+ return this.requireFail.length > 0;
1088
+ }, canRecognizeWith: function (a) {
1089
+ return !!this.simultaneous[a.id];
1090
+ }, emit: function (a) {
1091
+ function d(d) {
1092
+ b.manager.emit(b.options.event + (d ? Zb(c) : ""), a);
1093
+ }var b = this,
1094
+ c = this.state;Ub > c && d(!0), d(), c >= Ub && d(!0);
1095
+ }, tryEmit: function (a) {
1096
+ return this.canEmit() ? this.emit(a) : (this.state = Xb, void 0);
1097
+ }, canEmit: function () {
1098
+ for (var a = 0; a < this.requireFail.length;) {
1099
+ if (!(this.requireFail[a].state & (Xb | Rb))) return !1;a++;
1100
+ }return !0;
1101
+ }, recognize: function (a) {
1102
+ var b = n({}, a);return r(this.options.enable, [this, b]) ? (this.state & (Vb | Wb | Xb) && (this.state = Rb), this.state = this.process(b), this.state & (Sb | Tb | Ub | Wb) && this.tryEmit(b), void 0) : (this.reset(), this.state = Xb, void 0);
1103
+ }, process: function () {}, getTouchAction: function () {}, reset: function () {} }, p(ac, Yb, { defaults: { pointers: 1 }, attrTest: function (a) {
1104
+ var b = this.options.pointers;return 0 === b || a.pointers.length === b;
1105
+ }, process: function (a) {
1106
+ var b = this.state,
1107
+ c = a.eventType,
1108
+ d = b & (Sb | Tb),
1109
+ e = this.attrTest(a);return d && (c & R || !e) ? b | Wb : d || e ? c & Q ? b | Ub : b & Sb ? b | Tb : Sb : Xb;
1110
+ } }), p(bc, ac, { defaults: { event: "pan", threshold: 10, pointers: 1, direction: Z }, getTouchAction: function () {
1111
+ var a = this.options.direction,
1112
+ b = [];return a & X && b.push(Ob), a & Y && b.push(Nb), b;
1113
+ }, directionTest: function (a) {
1114
+ var b = this.options,
1115
+ c = !0,
1116
+ d = a.distance,
1117
+ e = a.direction,
1118
+ f = a.deltaX,
1119
+ g = a.deltaY;return e & b.direction || (b.direction & X ? (e = 0 === f ? S : 0 > f ? T : U, c = f != this.pX, d = Math.abs(a.deltaX)) : (e = 0 === g ? S : 0 > g ? V : W, c = g != this.pY, d = Math.abs(a.deltaY))), a.direction = e, c && d > b.threshold && e & b.direction;
1120
+ }, attrTest: function (a) {
1121
+ return ac.prototype.attrTest.call(this, a) && (this.state & Sb || !(this.state & Sb) && this.directionTest(a));
1122
+ }, emit: function (a) {
1123
+ this.pX = a.deltaX, this.pY = a.deltaY;var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a);
1124
+ } }), p(cc, ac, { defaults: { event: "pinch", threshold: 0, pointers: 2 }, getTouchAction: function () {
1125
+ return [Mb];
1126
+ }, attrTest: function (a) {
1127
+ return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & Sb);
1128
+ }, emit: function (a) {
1129
+ if (this._super.emit.call(this, a), 1 !== a.scale) {
1130
+ var b = a.scale < 1 ? "in" : "out";this.manager.emit(this.options.event + b, a);
1131
+ }
1132
+ } }), p(dc, Yb, { defaults: { event: "press", pointers: 1, time: 500, threshold: 5 }, getTouchAction: function () {
1133
+ return [Kb];
1134
+ }, process: function (a) {
1135
+ var b = this.options,
1136
+ c = a.pointers.length === b.pointers,
1137
+ d = a.distance < b.threshold,
1138
+ e = a.deltaTime > b.time;if (this._input = a, !d || !c || a.eventType & (Q | R) && !e) this.reset();else if (a.eventType & O) this.reset(), this._timer = k(function () {
1139
+ this.state = Vb, this.tryEmit();
1140
+ }, b.time, this);else if (a.eventType & Q) return Vb;return Xb;
1141
+ }, reset: function () {
1142
+ clearTimeout(this._timer);
1143
+ }, emit: function (a) {
1144
+ this.state === Vb && (a && a.eventType & Q ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = j(), this.manager.emit(this.options.event, this._input)));
1145
+ } }), p(ec, ac, { defaults: { event: "rotate", threshold: 0, pointers: 2 }, getTouchAction: function () {
1146
+ return [Mb];
1147
+ }, attrTest: function (a) {
1148
+ return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & Sb);
1149
+ } }), p(fc, ac, { defaults: { event: "swipe", threshold: 10, velocity: .65, direction: X | Y, pointers: 1 }, getTouchAction: function () {
1150
+ return bc.prototype.getTouchAction.call(this);
1151
+ }, attrTest: function (a) {
1152
+ var c,
1153
+ b = this.options.direction;return b & (X | Y) ? c = a.velocity : b & X ? c = a.velocityX : b & Y && (c = a.velocityY), this._super.attrTest.call(this, a) && b & a.direction && a.distance > this.options.threshold && i(c) > this.options.velocity && a.eventType & Q;
1154
+ }, emit: function (a) {
1155
+ var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a);
1156
+ } }), p(gc, Yb, { defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 2, posThreshold: 10 }, getTouchAction: function () {
1157
+ return [Lb];
1158
+ }, process: function (a) {
1159
+ var b = this.options,
1160
+ c = a.pointers.length === b.pointers,
1161
+ d = a.distance < b.threshold,
1162
+ e = a.deltaTime < b.time;if (this.reset(), a.eventType & O && 0 === this.count) return this.failTimeout();if (d && e && c) {
1163
+ if (a.eventType != Q) return this.failTimeout();var f = this.pTime ? a.timeStamp - this.pTime < b.interval : !0,
1164
+ g = !this.pCenter || kb(this.pCenter, a.center) < b.posThreshold;this.pTime = a.timeStamp, this.pCenter = a.center, g && f ? this.count += 1 : this.count = 1, this._input = a;var h = this.count % b.taps;if (0 === h) return this.hasRequireFailures() ? (this._timer = k(function () {
1165
+ this.state = Vb, this.tryEmit();
1166
+ }, b.interval, this), Sb) : Vb;
1167
+ }return Xb;
1168
+ }, failTimeout: function () {
1169
+ return this._timer = k(function () {
1170
+ this.state = Xb;
1171
+ }, this.options.interval, this), Xb;
1172
+ }, reset: function () {
1173
+ clearTimeout(this._timer);
1174
+ }, emit: function () {
1175
+ this.state == Vb && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
1176
+ } }), hc.VERSION = "2.0.4", hc.defaults = { domEvents: !1, touchAction: Jb, enable: !0, inputTarget: null, inputClass: null, preset: [[ec, { enable: !1 }], [cc, { enable: !1 }, ["rotate"]], [fc, { direction: X }], [bc, { direction: X }, ["swipe"]], [gc], [gc, { event: "doubletap", taps: 2 }, ["tap"]], [dc]], cssProps: { userSelect: "default", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } };var ic = 1,
1177
+ jc = 2;kc.prototype = { set: function (a) {
1178
+ return n(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this;
1179
+ }, stop: function (a) {
1180
+ this.session.stopped = a ? jc : ic;
1181
+ }, recognize: function (a) {
1182
+ var b = this.session;if (!b.stopped) {
1183
+ this.touchAction.preventDefaults(a);var c,
1184
+ d = this.recognizers,
1185
+ e = b.curRecognizer;(!e || e && e.state & Vb) && (e = b.curRecognizer = null);for (var f = 0; f < d.length;) {
1186
+ c = d[f], b.stopped === jc || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a), !e && c.state & (Sb | Tb | Ub) && (e = b.curRecognizer = c), f++;
1187
+ }
1188
+ }
1189
+ }, get: function (a) {
1190
+ if (a instanceof Yb) return a;for (var b = this.recognizers, c = 0; c < b.length; c++) {
1191
+ if (b[c].options.event == a) return b[c];
1192
+ }return null;
1193
+ }, add: function (a) {
1194
+ if (l(a, "add", this)) return this;var b = this.get(a.options.event);return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a;
1195
+ }, remove: function (a) {
1196
+ if (l(a, "remove", this)) return this;var b = this.recognizers;return a = this.get(a), b.splice(y(b, a), 1), this.touchAction.update(), this;
1197
+ }, on: function (a, b) {
1198
+ var c = this.handlers;return m(x(a), function (a) {
1199
+ c[a] = c[a] || [], c[a].push(b);
1200
+ }), this;
1201
+ }, off: function (a, b) {
1202
+ var c = this.handlers;return m(x(a), function (a) {
1203
+ b ? c[a].splice(y(c[a], b), 1) : delete c[a];
1204
+ }), this;
1205
+ }, emit: function (a, b) {
1206
+ this.options.domEvents && mc(a, b);var c = this.handlers[a] && this.handlers[a].slice();if (c && c.length) {
1207
+ b.type = a, b.preventDefault = function () {
1208
+ b.srcEvent.preventDefault();
1209
+ };for (var d = 0; d < c.length;) {
1210
+ c[d](b), d++;
1211
+ }
1212
+ }
1213
+ }, destroy: function () {
1214
+ this.element && lc(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
1215
+ } }, n(hc, { INPUT_START: O, INPUT_MOVE: P, INPUT_END: Q, INPUT_CANCEL: R, STATE_POSSIBLE: Rb, STATE_BEGAN: Sb, STATE_CHANGED: Tb, STATE_ENDED: Ub, STATE_RECOGNIZED: Vb, STATE_CANCELLED: Wb, STATE_FAILED: Xb, DIRECTION_NONE: S, DIRECTION_LEFT: T, DIRECTION_RIGHT: U, DIRECTION_UP: V, DIRECTION_DOWN: W, DIRECTION_HORIZONTAL: X, DIRECTION_VERTICAL: Y, DIRECTION_ALL: Z, Manager: kc, Input: ab, TouchAction: Pb, TouchInput: Eb, MouseInput: rb, PointerEventInput: wb, TouchMouseInput: Gb, SingleTouchInput: Ab, Recognizer: Yb, AttrRecognizer: ac, Tap: gc, Pan: bc, Swipe: fc, Pinch: cc, Rotate: ec, Press: dc, on: t, off: u, each: m, merge: o, extend: n, inherit: p, bindFn: q, prefixed: B }), typeof define == g && define.amd ? define(function () {
1216
+ return hc;
1217
+ }) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc;
1218
+ }(window, document, "Hammer");;(function (factory) {
1219
+ if (typeof define === 'function' && define.amd) {
1220
+ define(['jquery', 'hammerjs'], factory);
1221
+ } else if (typeof exports === 'object') {
1222
+ factory(require('jquery'), require('hammerjs'));
1223
+ } else {
1224
+ factory(jQuery, Hammer);
1225
+ }
1226
+ })(function ($, Hammer) {
1227
+ function hammerify(el, options) {
1228
+ var $el = $(el);
1229
+ if (!$el.data("hammer")) {
1230
+ $el.data("hammer", new Hammer($el[0], options));
1231
+ }
1232
+ }
1233
+
1234
+ $.fn.hammer = function (options) {
1235
+ return this.each(function () {
1236
+ hammerify(this, options);
1237
+ });
1238
+ };
1239
+
1240
+ // extend the emit method to also trigger jQuery events
1241
+ Hammer.Manager.prototype.emit = function (originalEmit) {
1242
+ return function (type, data) {
1243
+ originalEmit.call(this, type, data);
1244
+ $(this.element).trigger({
1245
+ type: type,
1246
+ gesture: data
1247
+ });
1248
+ };
1249
+ }(Hammer.Manager.prototype.emit);
1250
+ });
1251
+ ; // Required for Meteor package, the use of window prevents export by Meteor
1252
+ (function (window) {
1253
+ if (window.Package) {
1254
+ Materialize = {};
1255
+ } else {
1256
+ window.Materialize = {};
1257
+ }
1258
+ })(window);
1259
+
1260
+ if (typeof exports !== 'undefined' && !exports.nodeType) {
1261
+ if (typeof module !== 'undefined' && !module.nodeType && module.exports) {
1262
+ exports = module.exports = Materialize;
1263
+ }
1264
+ exports.default = Materialize;
1265
+ }
1266
+
1267
+ /*
1268
+ * raf.js
1269
+ * https://github.com/ngryman/raf.js
1270
+ *
1271
+ * original requestAnimationFrame polyfill by Erik Möller
1272
+ * inspired from paul_irish gist and post
1273
+ *
1274
+ * Copyright (c) 2013 ngryman
1275
+ * Licensed under the MIT license.
1276
+ */
1277
+ (function (window) {
1278
+ var lastTime = 0,
1279
+ vendors = ['webkit', 'moz'],
1280
+ requestAnimationFrame = window.requestAnimationFrame,
1281
+ cancelAnimationFrame = window.cancelAnimationFrame,
1282
+ i = vendors.length;
1283
+
1284
+ // try to un-prefix existing raf
1285
+ while (--i >= 0 && !requestAnimationFrame) {
1286
+ requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
1287
+ cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
1288
+ }
1289
+
1290
+ // polyfill with setTimeout fallback
1291
+ // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
1292
+ if (!requestAnimationFrame || !cancelAnimationFrame) {
1293
+ requestAnimationFrame = function (callback) {
1294
+ var now = +Date.now(),
1295
+ nextTime = Math.max(lastTime + 16, now);
1296
+ return setTimeout(function () {
1297
+ callback(lastTime = nextTime);
1298
+ }, nextTime - now);
1299
+ };
1300
+
1301
+ cancelAnimationFrame = clearTimeout;
1302
+ }
1303
+
1304
+ // export to window
1305
+ window.requestAnimationFrame = requestAnimationFrame;
1306
+ window.cancelAnimationFrame = cancelAnimationFrame;
1307
+ })(window);
1308
+
1309
+ /**
1310
+ * Generate approximated selector string for a jQuery object
1311
+ * @param {jQuery} obj jQuery object to be parsed
1312
+ * @returns {string}
1313
+ */
1314
+ Materialize.objectSelectorString = function (obj) {
1315
+ var tagStr = obj.prop('tagName') || '';
1316
+ var idStr = obj.attr('id') || '';
1317
+ var classStr = obj.attr('class') || '';
1318
+ return (tagStr + idStr + classStr).replace(/\s/g, '');
1319
+ };
1320
+
1321
+ // Unique Random ID
1322
+ Materialize.guid = function () {
1323
+ function s4() {
1324
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
1325
+ }
1326
+ return function () {
1327
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
1328
+ };
1329
+ }();
1330
+
1331
+ /**
1332
+ * Escapes hash from special characters
1333
+ * @param {string} hash String returned from this.hash
1334
+ * @returns {string}
1335
+ */
1336
+ Materialize.escapeHash = function (hash) {
1337
+ return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1");
1338
+ };
1339
+
1340
+ Materialize.elementOrParentIsFixed = function (element) {
1341
+ var $element = $(element);
1342
+ var $checkElements = $element.add($element.parents());
1343
+ var isFixed = false;
1344
+ $checkElements.each(function () {
1345
+ if ($(this).css("position") === "fixed") {
1346
+ isFixed = true;
1347
+ return false;
1348
+ }
1349
+ });
1350
+ return isFixed;
1351
+ };
1352
+
1353
+ /**
1354
+ * Get time in ms
1355
+ * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
1356
+ * @type {function}
1357
+ * @return {number}
1358
+ */
1359
+ var getTime = Date.now || function () {
1360
+ return new Date().getTime();
1361
+ };
1362
+
1363
+ /**
1364
+ * Returns a function, that, when invoked, will only be triggered at most once
1365
+ * during a given window of time. Normally, the throttled function will run
1366
+ * as much as it can, without ever going more than once per `wait` duration;
1367
+ * but if you'd like to disable the execution on the leading edge, pass
1368
+ * `{leading: false}`. To disable execution on the trailing edge, ditto.
1369
+ * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
1370
+ * @param {function} func
1371
+ * @param {number} wait
1372
+ * @param {Object=} options
1373
+ * @returns {Function}
1374
+ */
1375
+ Materialize.throttle = function (func, wait, options) {
1376
+ var context, args, result;
1377
+ var timeout = null;
1378
+ var previous = 0;
1379
+ options || (options = {});
1380
+ var later = function () {
1381
+ previous = options.leading === false ? 0 : getTime();
1382
+ timeout = null;
1383
+ result = func.apply(context, args);
1384
+ context = args = null;
1385
+ };
1386
+ return function () {
1387
+ var now = getTime();
1388
+ if (!previous && options.leading === false) previous = now;
1389
+ var remaining = wait - (now - previous);
1390
+ context = this;
1391
+ args = arguments;
1392
+ if (remaining <= 0) {
1393
+ clearTimeout(timeout);
1394
+ timeout = null;
1395
+ previous = now;
1396
+ result = func.apply(context, args);
1397
+ context = args = null;
1398
+ } else if (!timeout && options.trailing !== false) {
1399
+ timeout = setTimeout(later, remaining);
1400
+ }
1401
+ return result;
1402
+ };
1403
+ };
1404
+
1405
+ // Velocity has conflicts when loaded with jQuery, this will check for it
1406
+ // First, check if in noConflict mode
1407
+ var Vel;
1408
+ if (jQuery) {
1409
+ Vel = jQuery.Velocity;
1410
+ } else if ($) {
1411
+ Vel = $.Velocity;
1412
+ } else {
1413
+ Vel = Velocity;
1414
+ }
1415
+
1416
+ if (Vel) {
1417
+ Materialize.Vel = Vel;
1418
+ } else {
1419
+ Materialize.Vel = Velocity;
1420
+ }
1421
+ ;(function ($) {
1422
+ $.fn.collapsible = function (options, methodParam) {
1423
+ var defaults = {
1424
+ accordion: undefined,
1425
+ onOpen: undefined,
1426
+ onClose: undefined
1427
+ };
1428
+
1429
+ var methodName = options;
1430
+ options = $.extend(defaults, options);
1431
+
1432
+ return this.each(function () {
1433
+
1434
+ var $this = $(this);
1435
+
1436
+ var $panel_headers = $(this).find('> li > .collapsible-header');
1437
+
1438
+ var collapsible_type = $this.data("collapsible");
1439
+
1440
+ /****************
1441
+ Helper Functions
1442
+ ****************/
1443
+
1444
+ // Accordion Open
1445
+ function accordionOpen(object) {
1446
+ $panel_headers = $this.find('> li > .collapsible-header');
1447
+ if (object.hasClass('active')) {
1448
+ object.parent().addClass('active');
1449
+ } else {
1450
+ object.parent().removeClass('active');
1451
+ }
1452
+ if (object.parent().hasClass('active')) {
1453
+ object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1454
+ $(this).css('height', '');
1455
+ } });
1456
+ } else {
1457
+ object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1458
+ $(this).css('height', '');
1459
+ } });
1460
+ }
1461
+
1462
+ $panel_headers.not(object).removeClass('active').parent().removeClass('active');
1463
+
1464
+ // Close previously open accordion elements.
1465
+ $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () {
1466
+ if ($(this).is(':visible')) {
1467
+ $(this).slideUp({
1468
+ duration: 350,
1469
+ easing: "easeOutQuart",
1470
+ queue: false,
1471
+ complete: function () {
1472
+ $(this).css('height', '');
1473
+ execCallbacks($(this).siblings('.collapsible-header'));
1474
+ }
1475
+ });
1476
+ }
1477
+ });
1478
+ }
1479
+
1480
+ // Expandable Open
1481
+ function expandableOpen(object) {
1482
+ if (object.hasClass('active')) {
1483
+ object.parent().addClass('active');
1484
+ } else {
1485
+ object.parent().removeClass('active');
1486
+ }
1487
+ if (object.parent().hasClass('active')) {
1488
+ object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1489
+ $(this).css('height', '');
1490
+ } });
1491
+ } else {
1492
+ object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
1493
+ $(this).css('height', '');
1494
+ } });
1495
+ }
1496
+ }
1497
+
1498
+ // Open collapsible. object: .collapsible-header
1499
+ function collapsibleOpen(object, noToggle) {
1500
+ if (!noToggle) {
1501
+ object.toggleClass('active');
1502
+ }
1503
+
1504
+ if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
1505
+ // Handle Accordion
1506
+ accordionOpen(object);
1507
+ } else {
1508
+ // Handle Expandables
1509
+ expandableOpen(object);
1510
+ }
1511
+
1512
+ execCallbacks(object);
1513
+ }
1514
+
1515
+ // Handle callbacks
1516
+ function execCallbacks(object) {
1517
+ if (object.hasClass('active')) {
1518
+ if (typeof options.onOpen === "function") {
1519
+ options.onOpen.call(this, object.parent());
1520
+ }
1521
+ } else {
1522
+ if (typeof options.onClose === "function") {
1523
+ options.onClose.call(this, object.parent());
1524
+ }
1525
+ }
1526
+ }
1527
+
1528
+ /**
1529
+ * Check if object is children of panel header
1530
+ * @param {Object} object Jquery object
1531
+ * @return {Boolean} true if it is children
1532
+ */
1533
+ function isChildrenOfPanelHeader(object) {
1534
+
1535
+ var panelHeader = getPanelHeader(object);
1536
+
1537
+ return panelHeader.length > 0;
1538
+ }
1539
+
1540
+ /**
1541
+ * Get panel header from a children element
1542
+ * @param {Object} object Jquery object
1543
+ * @return {Object} panel header object
1544
+ */
1545
+ function getPanelHeader(object) {
1546
+
1547
+ return object.closest('li > .collapsible-header');
1548
+ }
1549
+
1550
+ // Turn off any existing event handlers
1551
+ function removeEventHandlers() {
1552
+ $this.off('click.collapse', '> li > .collapsible-header');
1553
+ }
1554
+
1555
+ /***** End Helper Functions *****/
1556
+
1557
+ // Methods
1558
+ if (methodName === 'destroy') {
1559
+ removeEventHandlers();
1560
+ return;
1561
+ } else if (methodParam >= 0 && methodParam < $panel_headers.length) {
1562
+ var $curr_header = $panel_headers.eq(methodParam);
1563
+ if ($curr_header.length && (methodName === 'open' || methodName === 'close' && $curr_header.hasClass('active'))) {
1564
+ collapsibleOpen($curr_header);
1565
+ }
1566
+ return;
1567
+ }
1568
+
1569
+ removeEventHandlers();
1570
+
1571
+ // Add click handler to only direct collapsible header children
1572
+ $this.on('click.collapse', '> li > .collapsible-header', function (e) {
1573
+ var element = $(e.target);
1574
+
1575
+ if (isChildrenOfPanelHeader(element)) {
1576
+ element = getPanelHeader(element);
1577
+ }
1578
+
1579
+ collapsibleOpen(element);
1580
+ });
1581
+
1582
+ // Open first active
1583
+ if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
1584
+ // Handle Accordion
1585
+ collapsibleOpen($panel_headers.filter('.active').first(), true);
1586
+ } else {
1587
+ // Handle Expandables
1588
+ $panel_headers.filter('.active').each(function () {
1589
+ collapsibleOpen($(this), true);
1590
+ });
1591
+ }
1592
+ });
1593
+ };
1594
+
1595
+ $(document).ready(function () {
1596
+ $('.collapsible').collapsible();
1597
+ });
1598
+ })(jQuery);;(function ($) {
1599
+
1600
+ // Add posibility to scroll to selected option
1601
+ // usefull for select for example
1602
+ $.fn.scrollTo = function (elem) {
1603
+ $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
1604
+ return this;
1605
+ };
1606
+
1607
+ $.fn.dropdown = function (options) {
1608
+ var defaults = {
1609
+ inDuration: 300,
1610
+ outDuration: 225,
1611
+ constrainWidth: true, // Constrains width of dropdown to the activator
1612
+ hover: false,
1613
+ gutter: 0, // Spacing from edge
1614
+ belowOrigin: false,
1615
+ alignment: 'left',
1616
+ stopPropagation: false
1617
+ };
1618
+
1619
+ // Open dropdown.
1620
+ if (options === "open") {
1621
+ this.each(function () {
1622
+ $(this).trigger('open');
1623
+ });
1624
+ return false;
1625
+ }
1626
+
1627
+ // Close dropdown.
1628
+ if (options === "close") {
1629
+ this.each(function () {
1630
+ $(this).trigger('close');
1631
+ });
1632
+ return false;
1633
+ }
1634
+
1635
+ this.each(function () {
1636
+ var origin = $(this);
1637
+ var curr_options = $.extend({}, defaults, options);
1638
+ var isFocused = false;
1639
+
1640
+ // Dropdown menu
1641
+ var activates = $("#" + origin.attr('data-activates'));
1642
+
1643
+ function updateOptions() {
1644
+ if (origin.data('induration') !== undefined) curr_options.inDuration = origin.data('induration');
1645
+ if (origin.data('outduration') !== undefined) curr_options.outDuration = origin.data('outduration');
1646
+ if (origin.data('constrainwidth') !== undefined) curr_options.constrainWidth = origin.data('constrainwidth');
1647
+ if (origin.data('hover') !== undefined) curr_options.hover = origin.data('hover');
1648
+ if (origin.data('gutter') !== undefined) curr_options.gutter = origin.data('gutter');
1649
+ if (origin.data('beloworigin') !== undefined) curr_options.belowOrigin = origin.data('beloworigin');
1650
+ if (origin.data('alignment') !== undefined) curr_options.alignment = origin.data('alignment');
1651
+ if (origin.data('stoppropagation') !== undefined) curr_options.stopPropagation = origin.data('stoppropagation');
1652
+ }
1653
+
1654
+ updateOptions();
1655
+
1656
+ // Attach dropdown to its activator
1657
+ origin.after(activates);
1658
+
1659
+ /*
1660
+ Helper function to position and resize dropdown.
1661
+ Used in hover and click handler.
1662
+ */
1663
+ function placeDropdown(eventType) {
1664
+ // Check for simultaneous focus and click events.
1665
+ if (eventType === 'focus') {
1666
+ isFocused = true;
1667
+ }
1668
+
1669
+ // Check html data attributes
1670
+ updateOptions();
1671
+
1672
+ // Set Dropdown state
1673
+ activates.addClass('active');
1674
+ origin.addClass('active');
1675
+
1676
+ var originWidth = origin[0].getBoundingClientRect().width;
1677
+
1678
+ // Constrain width
1679
+ if (curr_options.constrainWidth === true) {
1680
+ activates.css('width', originWidth);
1681
+ } else {
1682
+ activates.css('white-space', 'nowrap');
1683
+ }
1684
+
1685
+ // Offscreen detection
1686
+ var windowHeight = window.innerHeight;
1687
+ var originHeight = origin.innerHeight();
1688
+ var offsetLeft = origin.offset().left;
1689
+ var offsetTop = origin.offset().top - $(window).scrollTop();
1690
+ var currAlignment = curr_options.alignment;
1691
+ var gutterSpacing = 0;
1692
+ var leftPosition = 0;
1693
+
1694
+ // Below Origin
1695
+ var verticalOffset = 0;
1696
+ if (curr_options.belowOrigin === true) {
1697
+ verticalOffset = originHeight;
1698
+ }
1699
+
1700
+ // Check for scrolling positioned container.
1701
+ var scrollYOffset = 0;
1702
+ var scrollXOffset = 0;
1703
+ var wrapper = origin.parent();
1704
+ if (!wrapper.is('body')) {
1705
+ if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
1706
+ scrollYOffset = wrapper[0].scrollTop;
1707
+ }
1708
+ if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
1709
+ scrollXOffset = wrapper[0].scrollLeft;
1710
+ }
1711
+ }
1712
+
1713
+ if (offsetLeft + activates.innerWidth() > $(window).width()) {
1714
+ // Dropdown goes past screen on right, force right alignment
1715
+ currAlignment = 'right';
1716
+ } else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
1717
+ // Dropdown goes past screen on left, force left alignment
1718
+ currAlignment = 'left';
1719
+ }
1720
+ // Vertical bottom offscreen detection
1721
+ if (offsetTop + activates.innerHeight() > windowHeight) {
1722
+ // If going upwards still goes offscreen, just crop height of dropdown.
1723
+ if (offsetTop + originHeight - activates.innerHeight() < 0) {
1724
+ var adjustedHeight = windowHeight - offsetTop - verticalOffset;
1725
+ activates.css('max-height', adjustedHeight);
1726
+ } else {
1727
+ // Flow upwards.
1728
+ if (!verticalOffset) {
1729
+ verticalOffset += originHeight;
1730
+ }
1731
+ verticalOffset -= activates.innerHeight();
1732
+ }
1733
+ }
1734
+
1735
+ // Handle edge alignment
1736
+ if (currAlignment === 'left') {
1737
+ gutterSpacing = curr_options.gutter;
1738
+ leftPosition = origin.position().left + gutterSpacing;
1739
+ } else if (currAlignment === 'right') {
1740
+ // Material icons fix
1741
+ activates.stop(true, true).css({
1742
+ opacity: 0,
1743
+ left: 0
1744
+ });
1745
+
1746
+ var offsetRight = origin.position().left + originWidth - activates.width();
1747
+ gutterSpacing = -curr_options.gutter;
1748
+ leftPosition = offsetRight + gutterSpacing;
1749
+ }
1750
+
1751
+ // Position dropdown
1752
+ activates.css({
1753
+ position: 'absolute',
1754
+ top: origin.position().top + verticalOffset + scrollYOffset,
1755
+ left: leftPosition + scrollXOffset
1756
+ });
1757
+
1758
+ // Show dropdown
1759
+ activates.slideDown({
1760
+ queue: false,
1761
+ duration: curr_options.inDuration,
1762
+ easing: 'easeOutCubic',
1763
+ complete: function () {
1764
+ $(this).css('height', '');
1765
+ }
1766
+ }).animate({ opacity: 1 }, { queue: false, duration: curr_options.inDuration, easing: 'easeOutSine' });
1767
+
1768
+ // Add click close handler to document
1769
+ setTimeout(function () {
1770
+ $(document).on('click.' + activates.attr('id'), function (e) {
1771
+ hideDropdown();
1772
+ $(document).off('click.' + activates.attr('id'));
1773
+ });
1774
+ }, 0);
1775
+ }
1776
+
1777
+ function hideDropdown() {
1778
+ // Check for simultaneous focus and click events.
1779
+ isFocused = false;
1780
+ activates.fadeOut(curr_options.outDuration);
1781
+ activates.removeClass('active');
1782
+ origin.removeClass('active');
1783
+ $(document).off('click.' + activates.attr('id'));
1784
+ setTimeout(function () {
1785
+ activates.css('max-height', '');
1786
+ }, curr_options.outDuration);
1787
+ }
1788
+
1789
+ // Hover
1790
+ if (curr_options.hover) {
1791
+ var open = false;
1792
+ origin.off('click.' + origin.attr('id'));
1793
+ // Hover handler to show dropdown
1794
+ origin.on('mouseenter', function (e) {
1795
+ // Mouse over
1796
+ if (open === false) {
1797
+ placeDropdown();
1798
+ open = true;
1799
+ }
1800
+ });
1801
+ origin.on('mouseleave', function (e) {
1802
+ // If hover on origin then to something other than dropdown content, then close
1803
+ var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
1804
+ if (!$(toEl).closest('.dropdown-content').is(activates)) {
1805
+ activates.stop(true, true);
1806
+ hideDropdown();
1807
+ open = false;
1808
+ }
1809
+ });
1810
+
1811
+ activates.on('mouseleave', function (e) {
1812
+ // Mouse out
1813
+ var toEl = e.toElement || e.relatedTarget;
1814
+ if (!$(toEl).closest('.dropdown-button').is(origin)) {
1815
+ activates.stop(true, true);
1816
+ hideDropdown();
1817
+ open = false;
1818
+ }
1819
+ });
1820
+
1821
+ // Click
1822
+ } else {
1823
+ // Click handler to show dropdown
1824
+ origin.off('click.' + origin.attr('id'));
1825
+ origin.on('click.' + origin.attr('id'), function (e) {
1826
+ if (!isFocused) {
1827
+ if (origin[0] == e.currentTarget && !origin.hasClass('active') && $(e.target).closest('.dropdown-content').length === 0) {
1828
+ e.preventDefault(); // Prevents button click from moving window
1829
+ if (curr_options.stopPropagation) {
1830
+ e.stopPropagation();
1831
+ }
1832
+ placeDropdown('click');
1833
+ }
1834
+ // If origin is clicked and menu is open, close menu
1835
+ else if (origin.hasClass('active')) {
1836
+ hideDropdown();
1837
+ $(document).off('click.' + activates.attr('id'));
1838
+ }
1839
+ }
1840
+ });
1841
+ } // End else
1842
+
1843
+ // Listen to open and close event - useful for select component
1844
+ origin.on('open', function (e, eventType) {
1845
+ placeDropdown(eventType);
1846
+ });
1847
+ origin.on('close', hideDropdown);
1848
+ });
1849
+ }; // End dropdown plugin
1850
+
1851
+ $(document).ready(function () {
1852
+ $('.dropdown-button').dropdown();
1853
+ });
1854
+ })(jQuery);
1855
+ ;(function ($, Vel) {
1856
+ 'use strict';
1857
+
1858
+ var _defaults = {
1859
+ opacity: 0.5,
1860
+ inDuration: 250,
1861
+ outDuration: 250,
1862
+ ready: undefined,
1863
+ complete: undefined,
1864
+ dismissible: true,
1865
+ startingTop: '4%',
1866
+ endingTop: '10%'
1867
+ };
1868
+
1869
+ /**
1870
+ * @class
1871
+ *
1872
+ */
1873
+
1874
+ var Modal = function () {
1875
+ /**
1876
+ * Construct Modal instance and set up overlay
1877
+ * @constructor
1878
+ * @param {jQuery} $el
1879
+ * @param {Object} options
1880
+ */
1881
+ function Modal($el, options) {
1882
+ _classCallCheck(this, Modal);
1883
+
1884
+ // If exists, destroy and reinitialize
1885
+ if (!!$el[0].M_Modal) {
1886
+ $el[0].M_Modal.destroy();
1887
+ }
1888
+
1889
+ /**
1890
+ * The jQuery element
1891
+ * @type {jQuery}
1892
+ */
1893
+ this.$el = $el;
1894
+
1895
+ /**
1896
+ * Options for the modal
1897
+ * @member Modal#options
1898
+ * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
1899
+ * @prop {Number} [inDuration=250] - Length in ms of enter transition
1900
+ * @prop {Number} [outDuration=250] - Length in ms of exit transition
1901
+ * @prop {Function} ready - Callback function called when modal is finished entering
1902
+ * @prop {Function} complete - Callback function called when modal is finished exiting
1903
+ * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
1904
+ * @prop {String} [startingTop='4%'] - startingTop
1905
+ * @prop {String} [endingTop='10%'] - endingTop
1906
+ */
1907
+ this.options = $.extend({}, Modal.defaults, options);
1908
+
1909
+ /**
1910
+ * Describes open/close state of modal
1911
+ * @type {Boolean}
1912
+ */
1913
+ this.isOpen = false;
1914
+
1915
+ this.$el[0].M_Modal = this;
1916
+ this.id = $el.attr('id');
1917
+ this.openingTrigger = undefined;
1918
+ this.$overlay = $('<div class="modal-overlay"></div>');
1919
+
1920
+ Modal._increment++;
1921
+ Modal._count++;
1922
+ this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
1923
+ this.$el[0].style.zIndex = 1000 + Modal._increment * 2 + 1;
1924
+ this.setupEventHandlers();
1925
+ }
1926
+
1927
+ _createClass(Modal, [{
1928
+ key: 'getInstance',
1929
+
1930
+
1931
+ /**
1932
+ * Get Instance
1933
+ */
1934
+ value: function getInstance() {
1935
+ return this;
1936
+ }
1937
+
1938
+ /**
1939
+ * Teardown component
1940
+ */
1941
+
1942
+ }, {
1943
+ key: 'destroy',
1944
+ value: function destroy() {
1945
+ this.removeEventHandlers();
1946
+ this.$el[0].removeAttribute('style');
1947
+ if (!!this.$overlay[0].parentNode) {
1948
+ this.$overlay[0].parentNode.removeChild(this.$overlay[0]);
1949
+ }
1950
+ this.$el[0].M_Modal = undefined;
1951
+ Modal._count--;
1952
+ }
1953
+
1954
+ /**
1955
+ * Setup Event Handlers
1956
+ */
1957
+
1958
+ }, {
1959
+ key: 'setupEventHandlers',
1960
+ value: function setupEventHandlers() {
1961
+ this.handleOverlayClickBound = this.handleOverlayClick.bind(this);
1962
+ this.handleModalCloseClickBound = this.handleModalCloseClick.bind(this);
1963
+
1964
+ if (Modal._count === 1) {
1965
+ document.body.addEventListener('click', this.handleTriggerClick);
1966
+ }
1967
+ this.$overlay[0].addEventListener('click', this.handleOverlayClickBound);
1968
+ this.$el[0].addEventListener('click', this.handleModalCloseClickBound);
1969
+ }
1970
+
1971
+ /**
1972
+ * Remove Event Handlers
1973
+ */
1974
+
1975
+ }, {
1976
+ key: 'removeEventHandlers',
1977
+ value: function removeEventHandlers() {
1978
+ if (Modal._count === 0) {
1979
+ document.body.removeEventListener('click', this.handleTriggerClick);
1980
+ }
1981
+ this.$overlay[0].removeEventListener('click', this.handleOverlayClickBound);
1982
+ this.$el[0].removeEventListener('click', this.handleModalCloseClickBound);
1983
+ }
1984
+
1985
+ /**
1986
+ * Handle Trigger Click
1987
+ * @param {Event} e
1988
+ */
1989
+
1990
+ }, {
1991
+ key: 'handleTriggerClick',
1992
+ value: function handleTriggerClick(e) {
1993
+ var $trigger = $(e.target).closest('.modal-trigger');
1994
+ if (e.target && $trigger.length) {
1995
+ var modalId = $trigger[0].getAttribute('href');
1996
+ if (modalId) {
1997
+ modalId = modalId.slice(1);
1998
+ } else {
1999
+ modalId = $trigger[0].getAttribute('data-target');
2000
+ }
2001
+ var modalInstance = document.getElementById(modalId).M_Modal;
2002
+ if (modalInstance) {
2003
+ modalInstance.open($trigger);
2004
+ }
2005
+ e.preventDefault();
2006
+ }
2007
+ }
2008
+
2009
+ /**
2010
+ * Handle Overlay Click
2011
+ */
2012
+
2013
+ }, {
2014
+ key: 'handleOverlayClick',
2015
+ value: function handleOverlayClick() {
2016
+ if (this.options.dismissible) {
2017
+ this.close();
2018
+ }
2019
+ }
2020
+
2021
+ /**
2022
+ * Handle Modal Close Click
2023
+ * @param {Event} e
2024
+ */
2025
+
2026
+ }, {
2027
+ key: 'handleModalCloseClick',
2028
+ value: function handleModalCloseClick(e) {
2029
+ var $closeTrigger = $(e.target).closest('.modal-close');
2030
+ if (e.target && $closeTrigger.length) {
2031
+ this.close();
2032
+ }
2033
+ }
2034
+
2035
+ /**
2036
+ * Handle Keydown
2037
+ * @param {Event} e
2038
+ */
2039
+
2040
+ }, {
2041
+ key: 'handleKeydown',
2042
+ value: function handleKeydown(e) {
2043
+ // ESC key
2044
+ if (e.keyCode === 27 && this.options.dismissible) {
2045
+ this.close();
2046
+ }
2047
+ }
2048
+
2049
+ /**
2050
+ * Animate in modal
2051
+ */
2052
+
2053
+ }, {
2054
+ key: 'animateIn',
2055
+ value: function animateIn() {
2056
+ var _this = this;
2057
+
2058
+ // Set initial styles
2059
+ $.extend(this.$el[0].style, {
2060
+ display: 'block',
2061
+ opacity: 0
2062
+ });
2063
+ $.extend(this.$overlay[0].style, {
2064
+ display: 'block',
2065
+ opacity: 0
2066
+ });
2067
+
2068
+ // Animate overlay
2069
+ Vel(this.$overlay[0], { opacity: this.options.opacity }, { duration: this.options.inDuration, queue: false, ease: 'easeOutCubic' });
2070
+
2071
+ // Define modal animation options
2072
+ var enterVelocityOptions = {
2073
+ duration: this.options.inDuration,
2074
+ queue: false,
2075
+ ease: 'easeOutCubic',
2076
+ // Handle modal ready callback
2077
+ complete: function () {
2078
+ if (typeof _this.options.ready === 'function') {
2079
+ _this.options.ready.call(_this, _this.$el, _this.openingTrigger);
2080
+ }
2081
+ }
2082
+ };
2083
+
2084
+ // Bottom sheet animation
2085
+ if (this.$el[0].classList.contains('bottom-sheet')) {
2086
+ Vel(this.$el[0], { bottom: 0, opacity: 1 }, enterVelocityOptions);
2087
+
2088
+ // Normal modal animation
2089
+ } else {
2090
+ Vel.hook(this.$el[0], 'scaleX', 0.7);
2091
+ this.$el[0].style.top = this.options.startingTop;
2092
+ Vel(this.$el[0], { top: this.options.endingTop, opacity: 1, scaleX: 1 }, enterVelocityOptions);
2093
+ }
2094
+ }
2095
+
2096
+ /**
2097
+ * Animate out modal
2098
+ */
2099
+
2100
+ }, {
2101
+ key: 'animateOut',
2102
+ value: function animateOut() {
2103
+ var _this2 = this;
2104
+
2105
+ // Animate overlay
2106
+ Vel(this.$overlay[0], { opacity: 0 }, { duration: this.options.outDuration, queue: false, ease: 'easeOutQuart' });
2107
+
2108
+ // Define modal animation options
2109
+ var exitVelocityOptions = {
2110
+ duration: this.options.outDuration,
2111
+ queue: false,
2112
+ ease: 'easeOutCubic',
2113
+ // Handle modal ready callback
2114
+ complete: function () {
2115
+ _this2.$el[0].style.display = 'none';
2116
+ // Call complete callback
2117
+ if (typeof _this2.options.complete === 'function') {
2118
+ _this2.options.complete.call(_this2, _this2.$el);
2119
+ }
2120
+ _this2.$overlay[0].parentNode.removeChild(_this2.$overlay[0]);
2121
+ }
2122
+ };
2123
+
2124
+ // Bottom sheet animation
2125
+ if (this.$el[0].classList.contains('bottom-sheet')) {
2126
+ Vel(this.$el[0], { bottom: '-100%', opacity: 0 }, exitVelocityOptions);
2127
+
2128
+ // Normal modal animation
2129
+ } else {
2130
+ Vel(this.$el[0], { top: this.options.startingTop, opacity: 0, scaleX: 0.7 }, exitVelocityOptions);
2131
+ }
2132
+ }
2133
+
2134
+ /**
2135
+ * Open Modal
2136
+ * @param {jQuery} [$trigger]
2137
+ */
2138
+
2139
+ }, {
2140
+ key: 'open',
2141
+ value: function open($trigger) {
2142
+ if (this.isOpen) {
2143
+ return;
2144
+ }
2145
+
2146
+ this.isOpen = true;
2147
+ var body = document.body;
2148
+ body.style.overflow = 'hidden';
2149
+ this.$el[0].classList.add('open');
2150
+ body.appendChild(this.$overlay[0]);
2151
+
2152
+ // Set opening trigger, undefined indicates modal was opened by javascript
2153
+ this.openingTrigger = !!$trigger ? $trigger : undefined;
2154
+
2155
+ if (this.options.dismissible) {
2156
+ this.handleKeydownBound = this.handleKeydown.bind(this);
2157
+ document.addEventListener('keydown', this.handleKeydownBound);
2158
+ }
2159
+
2160
+ this.animateIn();
2161
+
2162
+ return this;
2163
+ }
2164
+
2165
+ /**
2166
+ * Close Modal
2167
+ */
2168
+
2169
+ }, {
2170
+ key: 'close',
2171
+ value: function close() {
2172
+ if (!this.isOpen) {
2173
+ return;
2174
+ }
2175
+
2176
+ this.isOpen = false;
2177
+ this.$el[0].classList.remove('open');
2178
+ document.body.style.overflow = '';
2179
+
2180
+ if (this.options.dismissible) {
2181
+ document.removeEventListener('keydown', this.handleKeydownBound);
2182
+ }
2183
+
2184
+ this.animateOut();
2185
+
2186
+ return this;
2187
+ }
2188
+ }], [{
2189
+ key: 'init',
2190
+ value: function init($els, options) {
2191
+ var arr = [];
2192
+ $els.each(function () {
2193
+ arr.push(new Modal($(this), options));
2194
+ });
2195
+ return arr;
2196
+ }
2197
+ }, {
2198
+ key: 'defaults',
2199
+ get: function () {
2200
+ return _defaults;
2201
+ }
2202
+ }]);
2203
+
2204
+ return Modal;
2205
+ }();
2206
+
2207
+ /**
2208
+ * @static
2209
+ * @memberof Modal
2210
+ */
2211
+
2212
+
2213
+ Modal._increment = 0;
2214
+
2215
+ /**
2216
+ * @static
2217
+ * @memberof Modal
2218
+ */
2219
+ Modal._count = 0;
2220
+
2221
+ Materialize.Modal = Modal;
2222
+
2223
+ $.fn.modal = function (methodOrOptions) {
2224
+ // Call plugin method if valid method name is passed in
2225
+ if (Modal.prototype[methodOrOptions]) {
2226
+ // Getter methods
2227
+ if (methodOrOptions.slice(0, 3) === 'get') {
2228
+ return this.first()[0].M_Modal[methodOrOptions]();
2229
+
2230
+ // Void methods
2231
+ } else {
2232
+ return this.each(function () {
2233
+ this.M_Modal[methodOrOptions]();
2234
+ });
2235
+ }
2236
+
2237
+ // Initialize plugin if options or no argument is passed in
2238
+ } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
2239
+ Modal.init(this, arguments[0]);
2240
+ return this;
2241
+
2242
+ // Return error if an unrecognized method name is passed in
2243
+ } else {
2244
+ $.error('Method ' + methodOrOptions + ' does not exist on jQuery.modal');
2245
+ }
2246
+ };
2247
+ })(jQuery, Materialize.Vel);
2248
+ ;(function ($) {
2249
+
2250
+ $.fn.materialbox = function () {
2251
+
2252
+ return this.each(function () {
2253
+
2254
+ if ($(this).hasClass('initialized')) {
2255
+ return;
2256
+ }
2257
+
2258
+ $(this).addClass('initialized');
2259
+
2260
+ var overlayActive = false;
2261
+ var doneAnimating = true;
2262
+ var inDuration = 275;
2263
+ var outDuration = 200;
2264
+ var origin = $(this);
2265
+ var placeholder = $('<div></div>').addClass('material-placeholder');
2266
+ var originalWidth = 0;
2267
+ var originalHeight = 0;
2268
+ var ancestorsChanged;
2269
+ var ancestor;
2270
+ var originInlineStyles = origin.attr('style');
2271
+ origin.wrap(placeholder);
2272
+
2273
+ // Start click handler
2274
+ origin.on('click', function () {
2275
+ var placeholder = origin.parent('.material-placeholder');
2276
+ var windowWidth = window.innerWidth;
2277
+ var windowHeight = window.innerHeight;
2278
+ var originalWidth = origin.width();
2279
+ var originalHeight = origin.height();
2280
+
2281
+ // If already modal, return to original
2282
+ if (doneAnimating === false) {
2283
+ returnToOriginal();
2284
+ return false;
2285
+ } else if (overlayActive && doneAnimating === true) {
2286
+ returnToOriginal();
2287
+ return false;
2288
+ }
2289
+
2290
+ // Set states
2291
+ doneAnimating = false;
2292
+ origin.addClass('active');
2293
+ overlayActive = true;
2294
+
2295
+ // Set positioning for placeholder
2296
+ placeholder.css({
2297
+ width: placeholder[0].getBoundingClientRect().width,
2298
+ height: placeholder[0].getBoundingClientRect().height,
2299
+ position: 'relative',
2300
+ top: 0,
2301
+ left: 0
2302
+ });
2303
+
2304
+ // Find ancestor with overflow: hidden; and remove it
2305
+ ancestorsChanged = undefined;
2306
+ ancestor = placeholder[0].parentNode;
2307
+ var count = 0;
2308
+ while (ancestor !== null && !$(ancestor).is(document)) {
2309
+ var curr = $(ancestor);
2310
+ if (curr.css('overflow') !== 'visible') {
2311
+ curr.css('overflow', 'visible');
2312
+ if (ancestorsChanged === undefined) {
2313
+ ancestorsChanged = curr;
2314
+ } else {
2315
+ ancestorsChanged = ancestorsChanged.add(curr);
2316
+ }
2317
+ }
2318
+ ancestor = ancestor.parentNode;
2319
+ }
2320
+
2321
+ // Set css on origin
2322
+ origin.css({
2323
+ position: 'absolute',
2324
+ 'z-index': 1000,
2325
+ 'will-change': 'left, top, width, height'
2326
+ }).data('width', originalWidth).data('height', originalHeight);
2327
+
2328
+ // Add overlay
2329
+ var overlay = $('<div id="materialbox-overlay"></div>').css({
2330
+ opacity: 0
2331
+ }).click(function () {
2332
+ if (doneAnimating === true) returnToOriginal();
2333
+ });
2334
+
2335
+ // Put before in origin image to preserve z-index layering.
2336
+ origin.before(overlay);
2337
+
2338
+ // Set dimensions if needed
2339
+ var overlayOffset = overlay[0].getBoundingClientRect();
2340
+ overlay.css({
2341
+ width: windowWidth,
2342
+ height: windowHeight,
2343
+ left: -1 * overlayOffset.left,
2344
+ top: -1 * overlayOffset.top
2345
+ });
2346
+
2347
+ // Animate Overlay
2348
+ overlay.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
2349
+
2350
+ // Add and animate caption if it exists
2351
+ if (origin.data('caption') !== "") {
2352
+ var $photo_caption = $('<div class="materialbox-caption"></div>');
2353
+ $photo_caption.text(origin.data('caption'));
2354
+ $('body').append($photo_caption);
2355
+ $photo_caption.css({ "display": "inline" });
2356
+ $photo_caption.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
2357
+ }
2358
+
2359
+ // Resize Image
2360
+ var ratio = 0;
2361
+ var widthPercent = originalWidth / windowWidth;
2362
+ var heightPercent = originalHeight / windowHeight;
2363
+ var newWidth = 0;
2364
+ var newHeight = 0;
2365
+
2366
+ if (widthPercent > heightPercent) {
2367
+ ratio = originalHeight / originalWidth;
2368
+ newWidth = windowWidth * 0.9;
2369
+ newHeight = windowWidth * 0.9 * ratio;
2370
+ } else {
2371
+ ratio = originalWidth / originalHeight;
2372
+ newWidth = windowHeight * 0.9 * ratio;
2373
+ newHeight = windowHeight * 0.9;
2374
+ }
2375
+
2376
+ // Animate image + set z-index
2377
+ if (origin.hasClass('responsive-img')) {
2378
+ origin.velocity({ 'max-width': newWidth, 'width': originalWidth }, { duration: 0, queue: false,
2379
+ complete: function () {
2380
+ origin.css({ left: 0, top: 0 }).velocity({
2381
+ height: newHeight,
2382
+ width: newWidth,
2383
+ left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
2384
+ top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
2385
+ }, {
2386
+ duration: inDuration,
2387
+ queue: false,
2388
+ easing: 'easeOutQuad',
2389
+ complete: function () {
2390
+ doneAnimating = true;
2391
+ }
2392
+ });
2393
+ } // End Complete
2394
+ }); // End Velocity
2395
+ } else {
2396
+ origin.css('left', 0).css('top', 0).velocity({
2397
+ height: newHeight,
2398
+ width: newWidth,
2399
+ left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
2400
+ top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
2401
+ }, {
2402
+ duration: inDuration,
2403
+ queue: false,
2404
+ easing: 'easeOutQuad',
2405
+ complete: function () {
2406
+ doneAnimating = true;
2407
+ }
2408
+ }); // End Velocity
2409
+ }
2410
+
2411
+ // Handle Exit triggers
2412
+ $(window).on('scroll.materialbox', function () {
2413
+ if (overlayActive) {
2414
+ returnToOriginal();
2415
+ }
2416
+ });
2417
+
2418
+ $(window).on('resize.materialbox', function () {
2419
+ if (overlayActive) {
2420
+ returnToOriginal();
2421
+ }
2422
+ });
2423
+
2424
+ $(document).on('keyup.materialbox', function (e) {
2425
+ // ESC key
2426
+ if (e.keyCode === 27 && doneAnimating === true && overlayActive) {
2427
+ returnToOriginal();
2428
+ }
2429
+ });
2430
+ }); // End click handler
2431
+
2432
+
2433
+ // This function returns the modaled image to the original spot
2434
+ function returnToOriginal() {
2435
+
2436
+ doneAnimating = false;
2437
+
2438
+ var placeholder = origin.parent('.material-placeholder');
2439
+ var windowWidth = window.innerWidth;
2440
+ var windowHeight = window.innerHeight;
2441
+ var originalWidth = origin.data('width');
2442
+ var originalHeight = origin.data('height');
2443
+
2444
+ origin.velocity("stop", true);
2445
+ $('#materialbox-overlay').velocity("stop", true);
2446
+ $('.materialbox-caption').velocity("stop", true);
2447
+
2448
+ // disable exit handlers
2449
+ $(window).off('scroll.materialbox');
2450
+ $(document).off('keyup.materialbox');
2451
+ $(window).off('resize.materialbox');
2452
+
2453
+ $('#materialbox-overlay').velocity({ opacity: 0 }, {
2454
+ duration: outDuration, // Delay prevents animation overlapping
2455
+ queue: false, easing: 'easeOutQuad',
2456
+ complete: function () {
2457
+ // Remove Overlay
2458
+ overlayActive = false;
2459
+ $(this).remove();
2460
+ }
2461
+ });
2462
+
2463
+ // Resize Image
2464
+ origin.velocity({
2465
+ width: originalWidth,
2466
+ height: originalHeight,
2467
+ left: 0,
2468
+ top: 0
2469
+ }, {
2470
+ duration: outDuration,
2471
+ queue: false, easing: 'easeOutQuad',
2472
+ complete: function () {
2473
+ placeholder.css({
2474
+ height: '',
2475
+ width: '',
2476
+ position: '',
2477
+ top: '',
2478
+ left: ''
2479
+ });
2480
+
2481
+ origin.removeAttr('style');
2482
+ origin.attr('style', originInlineStyles);
2483
+
2484
+ // Remove class
2485
+ origin.removeClass('active');
2486
+ doneAnimating = true;
2487
+
2488
+ // Remove overflow overrides on ancestors
2489
+ if (ancestorsChanged) {
2490
+ ancestorsChanged.css('overflow', '');
2491
+ }
2492
+ }
2493
+ });
2494
+
2495
+ // Remove Caption + reset css settings on image
2496
+ $('.materialbox-caption').velocity({ opacity: 0 }, {
2497
+ duration: outDuration, // Delay prevents animation overlapping
2498
+ queue: false, easing: 'easeOutQuad',
2499
+ complete: function () {
2500
+ $(this).remove();
2501
+ }
2502
+ });
2503
+ }
2504
+ });
2505
+ };
2506
+
2507
+ $(document).ready(function () {
2508
+ $('.materialboxed').materialbox();
2509
+ });
2510
+ })(jQuery);
2511
+ ;(function ($) {
2512
+
2513
+ $.fn.parallax = function () {
2514
+ var window_width = $(window).width();
2515
+ // Parallax Scripts
2516
+ return this.each(function (i) {
2517
+ var $this = $(this);
2518
+ $this.addClass('parallax');
2519
+
2520
+ function updateParallax(initial) {
2521
+ var container_height;
2522
+ if (window_width < 601) {
2523
+ container_height = $this.height() > 0 ? $this.height() : $this.children("img").height();
2524
+ } else {
2525
+ container_height = $this.height() > 0 ? $this.height() : 500;
2526
+ }
2527
+ var $img = $this.children("img").first();
2528
+ var img_height = $img.height();
2529
+ var parallax_dist = img_height - container_height;
2530
+ var bottom = $this.offset().top + container_height;
2531
+ var top = $this.offset().top;
2532
+ var scrollTop = $(window).scrollTop();
2533
+ var windowHeight = window.innerHeight;
2534
+ var windowBottom = scrollTop + windowHeight;
2535
+ var percentScrolled = (windowBottom - top) / (container_height + windowHeight);
2536
+ var parallax = Math.round(parallax_dist * percentScrolled);
2537
+
2538
+ if (initial) {
2539
+ $img.css('display', 'block');
2540
+ }
2541
+ if (bottom > scrollTop && top < scrollTop + windowHeight) {
2542
+ $img.css('transform', "translate3D(-50%," + parallax + "px, 0)");
2543
+ }
2544
+ }
2545
+
2546
+ // Wait for image load
2547
+ $this.children("img").one("load", function () {
2548
+ updateParallax(true);
2549
+ }).each(function () {
2550
+ if (this.complete) $(this).trigger("load");
2551
+ });
2552
+
2553
+ $(window).scroll(function () {
2554
+ window_width = $(window).width();
2555
+ updateParallax(false);
2556
+ });
2557
+
2558
+ $(window).resize(function () {
2559
+ window_width = $(window).width();
2560
+ updateParallax(false);
2561
+ });
2562
+ });
2563
+ };
2564
+ })(jQuery);
2565
+ ;(function ($) {
2566
+
2567
+ var methods = {
2568
+ init: function (options) {
2569
+ var defaults = {
2570
+ onShow: null,
2571
+ swipeable: false,
2572
+ responsiveThreshold: Infinity // breakpoint for swipeable
2573
+ };
2574
+ options = $.extend(defaults, options);
2575
+ var namespace = Materialize.objectSelectorString($(this));
2576
+
2577
+ return this.each(function (i) {
2578
+
2579
+ var uniqueNamespace = namespace + i;
2580
+
2581
+ // For each set of tabs, we want to keep track of
2582
+ // which tab is active and its associated content
2583
+ var $this = $(this),
2584
+ window_width = $(window).width();
2585
+
2586
+ var $active,
2587
+ $content,
2588
+ $links = $this.find('li.tab a'),
2589
+ $tabs_width = $this.width(),
2590
+ $tabs_content = $(),
2591
+ $tabs_wrapper,
2592
+ $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length,
2593
+ $indicator,
2594
+ index = 0,
2595
+ prev_index = 0,
2596
+ clicked = false,
2597
+ clickedTimeout,
2598
+ transition = 300;
2599
+
2600
+ // Finds right attribute for indicator based on active tab.
2601
+ // el: jQuery Object
2602
+ var calcRightPos = function (el) {
2603
+ return Math.ceil($tabs_width - el.position().left - el[0].getBoundingClientRect().width - $this.scrollLeft());
2604
+ };
2605
+
2606
+ // Finds left attribute for indicator based on active tab.
2607
+ // el: jQuery Object
2608
+ var calcLeftPos = function (el) {
2609
+ return Math.floor(el.position().left + $this.scrollLeft());
2610
+ };
2611
+
2612
+ // Animates Indicator to active tab.
2613
+ // prev_index: Number
2614
+ var animateIndicator = function (prev_index) {
2615
+ if (index - prev_index >= 0) {
2616
+ $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
2617
+ $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
2618
+ } else {
2619
+ $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
2620
+ $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
2621
+ }
2622
+ };
2623
+
2624
+ // Change swipeable according to responsive threshold
2625
+ if (options.swipeable) {
2626
+ if (window_width > options.responsiveThreshold) {
2627
+ options.swipeable = false;
2628
+ }
2629
+ }
2630
+
2631
+ // If the location.hash matches one of the links, use that as the active tab.
2632
+ $active = $($links.filter('[href="' + location.hash + '"]'));
2633
+
2634
+ // If no match is found, use the first link or any with class 'active' as the initial active tab.
2635
+ if ($active.length === 0) {
2636
+ $active = $(this).find('li.tab a.active').first();
2637
+ }
2638
+ if ($active.length === 0) {
2639
+ $active = $(this).find('li.tab a').first();
2640
+ }
2641
+
2642
+ $active.addClass('active');
2643
+ index = $links.index($active);
2644
+ if (index < 0) {
2645
+ index = 0;
2646
+ }
2647
+
2648
+ if ($active[0] !== undefined) {
2649
+ $content = $($active[0].hash);
2650
+ $content.addClass('active');
2651
+ }
2652
+
2653
+ // append indicator then set indicator width to tab width
2654
+ if (!$this.find('.indicator').length) {
2655
+ $this.append('<li class="indicator"></li>');
2656
+ }
2657
+ $indicator = $this.find('.indicator');
2658
+
2659
+ // we make sure that the indicator is at the end of the tabs
2660
+ $this.append($indicator);
2661
+
2662
+ if ($this.is(":visible")) {
2663
+ // $indicator.css({"right": $tabs_width - ((index + 1) * $tab_width)});
2664
+ // $indicator.css({"left": index * $tab_width});
2665
+ setTimeout(function () {
2666
+ $indicator.css({ "right": calcRightPos($active) });
2667
+ $indicator.css({ "left": calcLeftPos($active) });
2668
+ }, 0);
2669
+ }
2670
+ $(window).off('resize.tabs-' + uniqueNamespace).on('resize.tabs-' + uniqueNamespace, function () {
2671
+ $tabs_width = $this.width();
2672
+ $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
2673
+ if (index < 0) {
2674
+ index = 0;
2675
+ }
2676
+ if ($tab_width !== 0 && $tabs_width !== 0) {
2677
+ $indicator.css({ "right": calcRightPos($active) });
2678
+ $indicator.css({ "left": calcLeftPos($active) });
2679
+ }
2680
+ });
2681
+
2682
+ // Initialize Tabs Content.
2683
+ if (options.swipeable) {
2684
+ // TODO: Duplicate calls with swipeable? handle multiple div wrapping.
2685
+ $links.each(function () {
2686
+ var $curr_content = $(Materialize.escapeHash(this.hash));
2687
+ $curr_content.addClass('carousel-item');
2688
+ $tabs_content = $tabs_content.add($curr_content);
2689
+ });
2690
+ $tabs_wrapper = $tabs_content.wrapAll('<div class="tabs-content carousel"></div>');
2691
+ $tabs_content.css('display', '');
2692
+ $('.tabs-content.carousel').carousel({
2693
+ fullWidth: true,
2694
+ noWrap: true,
2695
+ onCycleTo: function (item) {
2696
+ if (!clicked) {
2697
+ var prev_index = index;
2698
+ index = $tabs_wrapper.index(item);
2699
+ $active.removeClass('active');
2700
+ $active = $links.eq(index);
2701
+ $active.addClass('active');
2702
+ animateIndicator(prev_index);
2703
+ if (typeof options.onShow === "function") {
2704
+ options.onShow.call($this[0], $content);
2705
+ }
2706
+ }
2707
+ }
2708
+ });
2709
+ } else {
2710
+ // Hide the remaining content
2711
+ $links.not($active).each(function () {
2712
+ $(Materialize.escapeHash(this.hash)).hide();
2713
+ });
2714
+ }
2715
+
2716
+ // Bind the click event handler
2717
+ $this.off('click.tabs').on('click.tabs', 'a', function (e) {
2718
+ if ($(this).parent().hasClass('disabled')) {
2719
+ e.preventDefault();
2720
+ return;
2721
+ }
2722
+
2723
+ // Act as regular link if target attribute is specified.
2724
+ if (!!$(this).attr("target")) {
2725
+ return;
2726
+ }
2727
+
2728
+ clicked = true;
2729
+ $tabs_width = $this.width();
2730
+ $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
2731
+
2732
+ // Make the old tab inactive.
2733
+ $active.removeClass('active');
2734
+ var $oldContent = $content;
2735
+
2736
+ // Update the variables with the new link and content
2737
+ $active = $(this);
2738
+ $content = $(Materialize.escapeHash(this.hash));
2739
+ $links = $this.find('li.tab a');
2740
+ var activeRect = $active.position();
2741
+
2742
+ // Make the tab active.
2743
+ $active.addClass('active');
2744
+ prev_index = index;
2745
+ index = $links.index($(this));
2746
+ if (index < 0) {
2747
+ index = 0;
2748
+ }
2749
+ // Change url to current tab
2750
+ // window.location.hash = $active.attr('href');
2751
+
2752
+ // Swap content
2753
+ if (options.swipeable) {
2754
+ if ($tabs_content.length) {
2755
+ $tabs_content.carousel('set', index, function () {
2756
+ if (typeof options.onShow === "function") {
2757
+ options.onShow.call($this[0], $content);
2758
+ }
2759
+ });
2760
+ }
2761
+ } else {
2762
+ if ($content !== undefined) {
2763
+ $content.show();
2764
+ $content.addClass('active');
2765
+ if (typeof options.onShow === "function") {
2766
+ options.onShow.call(this, $content);
2767
+ }
2768
+ }
2769
+
2770
+ if ($oldContent !== undefined && !$oldContent.is($content)) {
2771
+ $oldContent.hide();
2772
+ $oldContent.removeClass('active');
2773
+ }
2774
+ }
2775
+
2776
+ // Reset clicked state
2777
+ clickedTimeout = setTimeout(function () {
2778
+ clicked = false;
2779
+ }, transition);
2780
+
2781
+ // Update indicator
2782
+ animateIndicator(prev_index);
2783
+
2784
+ // Prevent the anchor's default click action
2785
+ e.preventDefault();
2786
+ });
2787
+ });
2788
+ },
2789
+ select_tab: function (id) {
2790
+ this.find('a[href="#' + id + '"]').trigger('click');
2791
+ }
2792
+ };
2793
+
2794
+ $.fn.tabs = function (methodOrOptions) {
2795
+ if (methods[methodOrOptions]) {
2796
+ return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
2797
+ } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
2798
+ // Default to "init"
2799
+ return methods.init.apply(this, arguments);
2800
+ } else {
2801
+ $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tabs');
2802
+ }
2803
+ };
2804
+
2805
+ $(document).ready(function () {
2806
+ $('ul.tabs').tabs();
2807
+ });
2808
+ })(jQuery);
2809
+ ;(function ($) {
2810
+ $.fn.tooptipZ = function (options) {
2811
+ var timeout = null,
2812
+ margin = 5;
2813
+
2814
+ // Defaults
2815
+ var defaults = {
2816
+ delay: 350,
2817
+ tooltip: '',
2818
+ position: 'bottom',
2819
+ html: false
2820
+ };
2821
+
2822
+ // Remove tooltip from the activator
2823
+ if (options === "remove") {
2824
+ this.each(function () {
2825
+ $('#' + $(this).attr('data-tooltip-id')).remove();
2826
+ $(this).removeAttr('data-tooltip-id');
2827
+ $(this).off('mouseenter.tooltip mouseleave.tooltip');
2828
+ });
2829
+ return false;
2830
+ }
2831
+
2832
+ options = $.extend(defaults, options);
2833
+
2834
+ return this.each(function () {
2835
+ var tooltipId = Materialize.guid();
2836
+ var origin = $(this);
2837
+
2838
+ // Destroy old tooltip
2839
+ if (origin.attr('data-tooltip-id')) {
2840
+ $('#' + origin.attr('data-tooltip-id')).remove();
2841
+ }
2842
+
2843
+ origin.attr('data-tooltip-id', tooltipId);
2844
+
2845
+ // Get attributes.
2846
+ var allowHtml, tooltipDelay, tooltipPosition, tooltipText, tooltipEl, backdrop;
2847
+ var setAttributes = function () {
2848
+ allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
2849
+ tooltipDelay = origin.attr('data-delay');
2850
+ tooltipDelay = tooltipDelay === undefined || tooltipDelay === '' ? options.delay : tooltipDelay;
2851
+ tooltipPosition = origin.attr('data-position');
2852
+ tooltipPosition = tooltipPosition === undefined || tooltipPosition === '' ? options.position : tooltipPosition;
2853
+ tooltipText = origin.attr('data-tooltip');
2854
+ tooltipText = tooltipText === undefined || tooltipText === '' ? options.tooltip : tooltipText;
2855
+ };
2856
+ setAttributes();
2857
+
2858
+ var renderTooltipEl = function () {
2859
+ var tooltip = $('<div class="material-tooltip"></div>');
2860
+
2861
+ // Create Text span
2862
+ if (allowHtml) {
2863
+ tooltipText = $('<span></span>').html(tooltipText);
2864
+ } else {
2865
+ tooltipText = $('<span></span>').text(tooltipText);
2866
+ }
2867
+
2868
+ // Create tooltip
2869
+ tooltip.append(tooltipText).appendTo($('body')).attr('id', tooltipId);
2870
+
2871
+ // Create backdrop
2872
+ backdrop = $('<div class="backdrop"></div>');
2873
+ backdrop.appendTo(tooltip);
2874
+ return tooltip;
2875
+ };
2876
+ tooltipEl = renderTooltipEl();
2877
+
2878
+ // Destroy previously binded events
2879
+ origin.off('mouseenter.tooltip mouseleave.tooltip');
2880
+ // Mouse In
2881
+ var started = false,
2882
+ timeoutRef;
2883
+ origin.on({ 'mouseenter.tooltip': function (e) {
2884
+ var showTooltip = function () {
2885
+ setAttributes();
2886
+ started = true;
2887
+ tooltipEl.velocity('stop');
2888
+ backdrop.velocity('stop');
2889
+ tooltipEl.css({ visibility: 'visible', left: '0px', top: '0px' });
2890
+
2891
+ // Tooltip positioning
2892
+ var originWidth = origin.outerWidth();
2893
+ var originHeight = origin.outerHeight();
2894
+ var tooltipHeight = tooltipEl.outerHeight();
2895
+ var tooltipWidth = tooltipEl.outerWidth();
2896
+ var tooltipVerticalMovement = '0px';
2897
+ var tooltipHorizontalMovement = '0px';
2898
+ var backdropOffsetWidth = backdrop[0].offsetWidth;
2899
+ var backdropOffsetHeight = backdrop[0].offsetHeight;
2900
+ var scaleXFactor = 8;
2901
+ var scaleYFactor = 8;
2902
+ var scaleFactor = 0;
2903
+ var targetTop, targetLeft, newCoordinates;
2904
+
2905
+ if (tooltipPosition === "top") {
2906
+ // Top Position
2907
+ targetTop = origin.offset().top - tooltipHeight - margin;
2908
+ targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
2909
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2910
+ tooltipVerticalMovement = '-10px';
2911
+ backdrop.css({
2912
+ bottom: 0,
2913
+ left: 0,
2914
+ borderRadius: '14px 14px 0 0',
2915
+ transformOrigin: '50% 100%',
2916
+ marginTop: tooltipHeight,
2917
+ marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
2918
+ });
2919
+ }
2920
+ // Left Position
2921
+ else if (tooltipPosition === "left") {
2922
+ targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
2923
+ targetLeft = origin.offset().left - tooltipWidth - margin;
2924
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2925
+
2926
+ tooltipHorizontalMovement = '-10px';
2927
+ backdrop.css({
2928
+ top: '-7px',
2929
+ right: 0,
2930
+ width: '14px',
2931
+ height: '14px',
2932
+ borderRadius: '14px 0 0 14px',
2933
+ transformOrigin: '95% 50%',
2934
+ marginTop: tooltipHeight / 2,
2935
+ marginLeft: tooltipWidth
2936
+ });
2937
+ }
2938
+ // Right Position
2939
+ else if (tooltipPosition === "right") {
2940
+ targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
2941
+ targetLeft = origin.offset().left + originWidth + margin;
2942
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2943
+
2944
+ tooltipHorizontalMovement = '+10px';
2945
+ backdrop.css({
2946
+ top: '-7px',
2947
+ left: 0,
2948
+ width: '14px',
2949
+ height: '14px',
2950
+ borderRadius: '0 14px 14px 0',
2951
+ transformOrigin: '5% 50%',
2952
+ marginTop: tooltipHeight / 2,
2953
+ marginLeft: '0px'
2954
+ });
2955
+ } else {
2956
+ // Bottom Position
2957
+ targetTop = origin.offset().top + origin.outerHeight() + margin;
2958
+ targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
2959
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
2960
+ tooltipVerticalMovement = '+10px';
2961
+ backdrop.css({
2962
+ top: 0,
2963
+ left: 0,
2964
+ marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
2965
+ });
2966
+ }
2967
+
2968
+ // Set tooptip css placement
2969
+ tooltipEl.css({
2970
+ top: newCoordinates.y,
2971
+ left: newCoordinates.x
2972
+ });
2973
+
2974
+ // Calculate Scale to fill
2975
+ scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdropOffsetWidth);
2976
+ scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdropOffsetHeight);
2977
+ scaleFactor = Math.max(scaleXFactor, scaleYFactor);
2978
+
2979
+ tooltipEl.velocity({ translateY: tooltipVerticalMovement, translateX: tooltipHorizontalMovement }, { duration: 350, queue: false }).velocity({ opacity: 1 }, { duration: 300, delay: 50, queue: false });
2980
+ backdrop.css({ visibility: 'visible' }).velocity({ opacity: 1 }, { duration: 55, delay: 0, queue: false }).velocity({ scaleX: scaleFactor, scaleY: scaleFactor }, { duration: 300, delay: 0, queue: false, easing: 'easeInOutQuad' });
2981
+ };
2982
+
2983
+ timeoutRef = setTimeout(showTooltip, tooltipDelay); // End Interval
2984
+
2985
+ // Mouse Out
2986
+ },
2987
+ 'mouseleave.tooltip': function () {
2988
+ // Reset State
2989
+ started = false;
2990
+ clearTimeout(timeoutRef);
2991
+
2992
+ // Animate back
2993
+ setTimeout(function () {
2994
+ if (started !== true) {
2995
+ tooltipEl.velocity({
2996
+ opacity: 0, translateY: 0, translateX: 0 }, { duration: 225, queue: false });
2997
+ backdrop.velocity({ opacity: 0, scaleX: 1, scaleY: 1 }, {
2998
+ duration: 225,
2999
+ queue: false,
3000
+ complete: function () {
3001
+ backdrop.css({ visibility: 'hidden' });
3002
+ tooltipEl.css({ visibility: 'hidden' });
3003
+ started = false;
3004
+ }
3005
+ });
3006
+ }
3007
+ }, 225);
3008
+ }
3009
+ });
3010
+ });
3011
+ };
3012
+
3013
+ var repositionWithinScreen = function (x, y, width, height) {
3014
+ var newX = x;
3015
+ var newY = y;
3016
+
3017
+ if (newX < 0) {
3018
+ newX = 4;
3019
+ } else if (newX + width > window.innerWidth) {
3020
+ newX -= newX + width - window.innerWidth;
3021
+ }
3022
+
3023
+ if (newY < 0) {
3024
+ newY = 4;
3025
+ } else if (newY + height > window.innerHeight + $(window).scrollTop) {
3026
+ newY -= newY + height - window.innerHeight;
3027
+ }
3028
+
3029
+ return { x: newX, y: newY };
3030
+ };
3031
+
3032
+ $(document).ready(function () {
3033
+ $('.tooltipped').tooptipZ();
3034
+ });
3035
+ })(jQuery);
3036
+ ; /*!
3037
+ * Waves v0.6.4
3038
+ * http://fian.my.id/Waves
3039
+ *
3040
+ * Copyright 2014 Alfiana E. Sibuea and other contributors
3041
+ * Released under the MIT license
3042
+ * https://github.com/fians/Waves/blob/master/LICENSE
3043
+ */
3044
+
3045
+ ;(function (window) {
3046
+ 'use strict';
3047
+
3048
+ var Waves = Waves || {};
3049
+ var $$ = document.querySelectorAll.bind(document);
3050
+
3051
+ // Find exact position of element
3052
+ function isWindow(obj) {
3053
+ return obj !== null && obj === obj.window;
3054
+ }
3055
+
3056
+ function getWindow(elem) {
3057
+ return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
3058
+ }
3059
+
3060
+ function offset(elem) {
3061
+ var docElem,
3062
+ win,
3063
+ box = { top: 0, left: 0 },
3064
+ doc = elem && elem.ownerDocument;
3065
+
3066
+ docElem = doc.documentElement;
3067
+
3068
+ if (typeof elem.getBoundingClientRect !== typeof undefined) {
3069
+ box = elem.getBoundingClientRect();
3070
+ }
3071
+ win = getWindow(doc);
3072
+ return {
3073
+ top: box.top + win.pageYOffset - docElem.clientTop,
3074
+ left: box.left + win.pageXOffset - docElem.clientLeft
3075
+ };
3076
+ }
3077
+
3078
+ function convertStyle(obj) {
3079
+ var style = '';
3080
+
3081
+ for (var a in obj) {
3082
+ if (obj.hasOwnProperty(a)) {
3083
+ style += a + ':' + obj[a] + ';';
3084
+ }
3085
+ }
3086
+
3087
+ return style;
3088
+ }
3089
+
3090
+ var Effect = {
3091
+
3092
+ // Effect delay
3093
+ duration: 750,
3094
+
3095
+ show: function (e, element) {
3096
+
3097
+ // Disable right click
3098
+ if (e.button === 2) {
3099
+ return false;
3100
+ }
3101
+
3102
+ var el = element || this;
3103
+
3104
+ // Create ripple
3105
+ var ripple = document.createElement('div');
3106
+ ripple.className = 'waves-ripple';
3107
+ el.appendChild(ripple);
3108
+
3109
+ // Get click coordinate and element witdh
3110
+ var pos = offset(el);
3111
+ var relativeY = e.pageY - pos.top;
3112
+ var relativeX = e.pageX - pos.left;
3113
+ var scale = 'scale(' + el.clientWidth / 100 * 10 + ')';
3114
+
3115
+ // Support for touch devices
3116
+ if ('touches' in e) {
3117
+ relativeY = e.touches[0].pageY - pos.top;
3118
+ relativeX = e.touches[0].pageX - pos.left;
3119
+ }
3120
+
3121
+ // Attach data to element
3122
+ ripple.setAttribute('data-hold', Date.now());
3123
+ ripple.setAttribute('data-scale', scale);
3124
+ ripple.setAttribute('data-x', relativeX);
3125
+ ripple.setAttribute('data-y', relativeY);
3126
+
3127
+ // Set ripple position
3128
+ var rippleStyle = {
3129
+ 'top': relativeY + 'px',
3130
+ 'left': relativeX + 'px'
3131
+ };
3132
+
3133
+ ripple.className = ripple.className + ' waves-notransition';
3134
+ ripple.setAttribute('style', convertStyle(rippleStyle));
3135
+ ripple.className = ripple.className.replace('waves-notransition', '');
3136
+
3137
+ // Scale the ripple
3138
+ rippleStyle['-webkit-transform'] = scale;
3139
+ rippleStyle['-moz-transform'] = scale;
3140
+ rippleStyle['-ms-transform'] = scale;
3141
+ rippleStyle['-o-transform'] = scale;
3142
+ rippleStyle.transform = scale;
3143
+ rippleStyle.opacity = '1';
3144
+
3145
+ rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
3146
+ rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
3147
+ rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
3148
+ rippleStyle['transition-duration'] = Effect.duration + 'ms';
3149
+
3150
+ rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3151
+ rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3152
+ rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3153
+ rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
3154
+
3155
+ ripple.setAttribute('style', convertStyle(rippleStyle));
3156
+ },
3157
+
3158
+ hide: function (e) {
3159
+ TouchHandler.touchup(e);
3160
+
3161
+ var el = this;
3162
+ var width = el.clientWidth * 1.4;
3163
+
3164
+ // Get first ripple
3165
+ var ripple = null;
3166
+ var ripples = el.getElementsByClassName('waves-ripple');
3167
+ if (ripples.length > 0) {
3168
+ ripple = ripples[ripples.length - 1];
3169
+ } else {
3170
+ return false;
3171
+ }
3172
+
3173
+ var relativeX = ripple.getAttribute('data-x');
3174
+ var relativeY = ripple.getAttribute('data-y');
3175
+ var scale = ripple.getAttribute('data-scale');
3176
+
3177
+ // Get delay beetween mousedown and mouse leave
3178
+ var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
3179
+ var delay = 350 - diff;
3180
+
3181
+ if (delay < 0) {
3182
+ delay = 0;
3183
+ }
3184
+
3185
+ // Fade out ripple after delay
3186
+ setTimeout(function () {
3187
+ var style = {
3188
+ 'top': relativeY + 'px',
3189
+ 'left': relativeX + 'px',
3190
+ 'opacity': '0',
3191
+
3192
+ // Duration
3193
+ '-webkit-transition-duration': Effect.duration + 'ms',
3194
+ '-moz-transition-duration': Effect.duration + 'ms',
3195
+ '-o-transition-duration': Effect.duration + 'ms',
3196
+ 'transition-duration': Effect.duration + 'ms',
3197
+ '-webkit-transform': scale,
3198
+ '-moz-transform': scale,
3199
+ '-ms-transform': scale,
3200
+ '-o-transform': scale,
3201
+ 'transform': scale
3202
+ };
3203
+
3204
+ ripple.setAttribute('style', convertStyle(style));
3205
+
3206
+ setTimeout(function () {
3207
+ try {
3208
+ el.removeChild(ripple);
3209
+ } catch (e) {
3210
+ return false;
3211
+ }
3212
+ }, Effect.duration);
3213
+ }, delay);
3214
+ },
3215
+
3216
+ // Little hack to make <input> can perform waves effect
3217
+ wrapInput: function (elements) {
3218
+ for (var a = 0; a < elements.length; a++) {
3219
+ var el = elements[a];
3220
+
3221
+ if (el.tagName.toLowerCase() === 'input') {
3222
+ var parent = el.parentNode;
3223
+
3224
+ // If input already have parent just pass through
3225
+ if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
3226
+ continue;
3227
+ }
3228
+
3229
+ // Put element class and style to the specified parent
3230
+ var wrapper = document.createElement('i');
3231
+ wrapper.className = el.className + ' waves-input-wrapper';
3232
+
3233
+ var elementStyle = el.getAttribute('style');
3234
+
3235
+ if (!elementStyle) {
3236
+ elementStyle = '';
3237
+ }
3238
+
3239
+ wrapper.setAttribute('style', elementStyle);
3240
+
3241
+ el.className = 'waves-button-input';
3242
+ el.removeAttribute('style');
3243
+
3244
+ // Put element as child
3245
+ parent.replaceChild(wrapper, el);
3246
+ wrapper.appendChild(el);
3247
+ }
3248
+ }
3249
+ }
3250
+ };
3251
+
3252
+ /**
3253
+ * Disable mousedown event for 500ms during and after touch
3254
+ */
3255
+ var TouchHandler = {
3256
+ /* uses an integer rather than bool so there's no issues with
3257
+ * needing to clear timeouts if another touch event occurred
3258
+ * within the 500ms. Cannot mouseup between touchstart and
3259
+ * touchend, nor in the 500ms after touchend. */
3260
+ touches: 0,
3261
+ allowEvent: function (e) {
3262
+ var allow = true;
3263
+
3264
+ if (e.type === 'touchstart') {
3265
+ TouchHandler.touches += 1; //push
3266
+ } else if (e.type === 'touchend' || e.type === 'touchcancel') {
3267
+ setTimeout(function () {
3268
+ if (TouchHandler.touches > 0) {
3269
+ TouchHandler.touches -= 1; //pop after 500ms
3270
+ }
3271
+ }, 500);
3272
+ } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
3273
+ allow = false;
3274
+ }
3275
+
3276
+ return allow;
3277
+ },
3278
+ touchup: function (e) {
3279
+ TouchHandler.allowEvent(e);
3280
+ }
3281
+ };
3282
+
3283
+ /**
3284
+ * Delegated click handler for .waves-effect element.
3285
+ * returns null when .waves-effect element not in "click tree"
3286
+ */
3287
+ function getWavesEffectElement(e) {
3288
+ if (TouchHandler.allowEvent(e) === false) {
3289
+ return null;
3290
+ }
3291
+
3292
+ var element = null;
3293
+ var target = e.target || e.srcElement;
3294
+
3295
+ while (target.parentNode !== null) {
3296
+ if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
3297
+ element = target;
3298
+ break;
3299
+ }
3300
+ target = target.parentNode;
3301
+ }
3302
+ return element;
3303
+ }
3304
+
3305
+ /**
3306
+ * Bubble the click and show effect if .waves-effect elem was found
3307
+ */
3308
+ function showEffect(e) {
3309
+ var element = getWavesEffectElement(e);
3310
+
3311
+ if (element !== null) {
3312
+ Effect.show(e, element);
3313
+
3314
+ if ('ontouchstart' in window) {
3315
+ element.addEventListener('touchend', Effect.hide, false);
3316
+ element.addEventListener('touchcancel', Effect.hide, false);
3317
+ }
3318
+
3319
+ element.addEventListener('mouseup', Effect.hide, false);
3320
+ element.addEventListener('mouseleave', Effect.hide, false);
3321
+ element.addEventListener('dragend', Effect.hide, false);
3322
+ }
3323
+ }
3324
+
3325
+ Waves.displayEffect = function (options) {
3326
+ options = options || {};
3327
+
3328
+ if ('duration' in options) {
3329
+ Effect.duration = options.duration;
3330
+ }
3331
+
3332
+ //Wrap input inside <i> tag
3333
+ Effect.wrapInput($$('.waves-effect'));
3334
+
3335
+ if ('ontouchstart' in window) {
3336
+ document.body.addEventListener('touchstart', showEffect, false);
3337
+ }
3338
+
3339
+ document.body.addEventListener('mousedown', showEffect, false);
3340
+ };
3341
+
3342
+ /**
3343
+ * Attach Waves to an input element (or any element which doesn't
3344
+ * bubble mouseup/mousedown events).
3345
+ * Intended to be used with dynamically loaded forms/inputs, or
3346
+ * where the user doesn't want a delegated click handler.
3347
+ */
3348
+ Waves.attach = function (element) {
3349
+ //FUTURE: automatically add waves classes and allow users
3350
+ // to specify them with an options param? Eg. light/classic/button
3351
+ if (element.tagName.toLowerCase() === 'input') {
3352
+ Effect.wrapInput([element]);
3353
+ element = element.parentNode;
3354
+ }
3355
+
3356
+ if ('ontouchstart' in window) {
3357
+ element.addEventListener('touchstart', showEffect, false);
3358
+ }
3359
+
3360
+ element.addEventListener('mousedown', showEffect, false);
3361
+ };
3362
+
3363
+ window.Waves = Waves;
3364
+
3365
+ document.addEventListener('DOMContentLoaded', function () {
3366
+ Waves.displayEffect();
3367
+ }, false);
3368
+ })(window);
3369
+ ;(function ($, Vel) {
3370
+ 'use strict';
3371
+
3372
+ var _defaults = {
3373
+ displayLength: Infinity,
3374
+ inDuration: 300,
3375
+ outDuration: 375,
3376
+ className: undefined,
3377
+ completeCallback: undefined,
3378
+ activationPercent: 0.8
3379
+ };
3380
+
3381
+ var Toast = function () {
3382
+ function Toast(message, displayLength, className, completeCallback) {
3383
+ _classCallCheck(this, Toast);
3384
+
3385
+ if (!message) {
3386
+ return;
3387
+ }
3388
+
3389
+ /**
3390
+ * Options for the toast
3391
+ * @member Toast#options
3392
+ */
3393
+ this.options = {
3394
+ displayLength: displayLength,
3395
+ className: className,
3396
+ completeCallback: completeCallback
3397
+ };
3398
+
3399
+ this.options = $.extend({}, Toast.defaults, this.options);
3400
+ this.message = message;
3401
+
3402
+ /**
3403
+ * Describes current pan state toast
3404
+ * @type {Boolean}
3405
+ */
3406
+ this.panning = false;
3407
+
3408
+ /**
3409
+ * Time remaining until toast is removed
3410
+ */
3411
+ this.timeRemaining = this.options.displayLength;
3412
+
3413
+ if (Toast._toasts.length === 0) {
3414
+ Toast._createContainer();
3415
+ }
3416
+
3417
+ // Create new toast
3418
+ Toast._toasts.push(this);
3419
+ var toastElement = this.createToast();
3420
+ toastElement.M_Toast = this;
3421
+ this.el = toastElement;
3422
+ this._animateIn();
3423
+ this.setTimer();
3424
+ }
3425
+
3426
+ _createClass(Toast, [{
3427
+ key: 'createToast',
3428
+
3429
+
3430
+ /**
3431
+ * Create toast and append it to toast container
3432
+ */
3433
+ value: function createToast() {
3434
+ var toast = document.createElement('div');
3435
+ toast.classList.add('toast');
3436
+
3437
+ // Add custom classes onto toast
3438
+ if (this.options.className) {
3439
+ var classes = this.options.className.split(' ');
3440
+ var i = void 0,
3441
+ count = void 0;
3442
+ for (i = 0, count = classes.length; i < count; i++) {
3443
+ toast.classList.add(classes[i]);
3444
+ }
3445
+ }
3446
+
3447
+ // Set content
3448
+ if (typeof HTMLElement === 'object' ? this.message instanceof HTMLElement : this.message && typeof this.message === 'object' && this.message !== null && this.message.nodeType === 1 && typeof this.message.nodeName === 'string') {
3449
+ toast.appendChild(this.message);
3450
+
3451
+ // Check if it is jQuery object
3452
+ } else if (this.message instanceof jQuery) {
3453
+ $(toast).append(this.message);
3454
+
3455
+ // Insert as text;
3456
+ } else {
3457
+ toast.innerHTML = this.message;
3458
+ }
3459
+
3460
+ // Append toasft
3461
+ Toast._container.appendChild(toast);
3462
+ return toast;
3463
+ }
3464
+
3465
+ /**
3466
+ * Animate in toast
3467
+ */
3468
+
3469
+ }, {
3470
+ key: '_animateIn',
3471
+ value: function _animateIn() {
3472
+ // Animate toast in
3473
+ Vel(this.el, { top: 0, opacity: 1 }, {
3474
+ duration: 300,
3475
+ easing: 'easeOutCubic',
3476
+ queue: false
3477
+ });
3478
+ }
3479
+
3480
+ /**
3481
+ * Create setInterval which automatically removes toast when timeRemaining >= 0
3482
+ * has been reached
3483
+ */
3484
+
3485
+ }, {
3486
+ key: 'setTimer',
3487
+ value: function setTimer() {
3488
+ var _this3 = this;
3489
+
3490
+ if (this.timeRemaining !== Infinity) {
3491
+ this.counterInterval = setInterval(function () {
3492
+ // If toast is not being dragged, decrease its time remaining
3493
+ if (!_this3.panning) {
3494
+ _this3.timeRemaining -= 20;
3495
+ }
3496
+
3497
+ // Animate toast out
3498
+ if (_this3.timeRemaining <= 0) {
3499
+ _this3.remove();
3500
+ }
3501
+ }, 20);
3502
+ }
3503
+ }
3504
+
3505
+ /**
3506
+ * Dismiss toast with animation
3507
+ */
3508
+
3509
+ }, {
3510
+ key: 'remove',
3511
+ value: function remove() {
3512
+ var _this4 = this;
3513
+
3514
+ window.clearInterval(this.counterInterval);
3515
+ var activationDistance = this.el.offsetWidth * this.options.activationPercent;
3516
+
3517
+ if (this.wasSwiped) {
3518
+ this.el.style.transition = 'transform .05s, opacity .05s';
3519
+ this.el.style.transform = 'translateX(' + activationDistance + 'px)';
3520
+ this.el.style.opacity = 0;
3521
+ }
3522
+
3523
+ Vel(this.el, { opacity: 0, marginTop: '-40px' }, {
3524
+ duration: this.options.outDuration,
3525
+ easing: 'easeOutExpo',
3526
+ queue: false,
3527
+ complete: function () {
3528
+ // Call the optional callback
3529
+ if (typeof _this4.options.completeCallback === 'function') {
3530
+ _this4.options.completeCallback();
3531
+ }
3532
+ // Remove toast from DOM
3533
+ _this4.el.parentNode.removeChild(_this4.el);
3534
+ Toast._toasts.splice(Toast._toasts.indexOf(_this4), 1);
3535
+ if (Toast._toasts.length === 0) {
3536
+ Toast._removeContainer();
3537
+ }
3538
+ }
3539
+ });
3540
+ }
3541
+ }], [{
3542
+ key: '_createContainer',
3543
+
3544
+
3545
+ /**
3546
+ * Append toast container and add event handlers
3547
+ */
3548
+ value: function _createContainer() {
3549
+ var container = document.createElement('div');
3550
+ container.setAttribute('id', 'toast-container');
3551
+
3552
+ // Add event handler
3553
+ container.addEventListener('touchstart', Toast._onDragStart);
3554
+ container.addEventListener('touchmove', Toast._onDragMove);
3555
+ container.addEventListener('touchend', Toast._onDragEnd);
3556
+
3557
+ container.addEventListener('mousedown', Toast._onDragStart);
3558
+ document.addEventListener('mousemove', Toast._onDragMove);
3559
+ document.addEventListener('mouseup', Toast._onDragEnd);
3560
+
3561
+ document.body.appendChild(container);
3562
+ Toast._container = container;
3563
+ }
3564
+
3565
+ /**
3566
+ * Remove toast container and event handlers
3567
+ */
3568
+
3569
+ }, {
3570
+ key: '_removeContainer',
3571
+ value: function _removeContainer() {
3572
+ // Add event handler
3573
+ document.removeEventListener('mousemove', Toast._onDragMove);
3574
+ document.removeEventListener('mouseup', Toast._onDragEnd);
3575
+
3576
+ Toast._container.parentNode.removeChild(Toast._container);
3577
+ Toast._container = null;
3578
+ }
3579
+
3580
+ /**
3581
+ * Begin drag handler
3582
+ * @param {Event} e
3583
+ */
3584
+
3585
+ }, {
3586
+ key: '_onDragStart',
3587
+ value: function _onDragStart(e) {
3588
+ if (e.target && $(e.target).closest('.toast').length) {
3589
+ var $toast = $(e.target).closest('.toast');
3590
+ var toast = $toast[0].M_Toast;
3591
+ toast.panning = true;
3592
+ Toast._draggedToast = toast;
3593
+ toast.el.classList.add('panning');
3594
+ toast.el.style.transition = '';
3595
+ toast.startingXPos = Toast._xPos(e);
3596
+ toast.time = Date.now();
3597
+ toast.xPos = Toast._xPos(e);
3598
+ }
3599
+ }
3600
+
3601
+ /**
3602
+ * Drag move handler
3603
+ * @param {Event} e
3604
+ */
3605
+
3606
+ }, {
3607
+ key: '_onDragMove',
3608
+ value: function _onDragMove(e) {
3609
+ if (!!Toast._draggedToast) {
3610
+ e.preventDefault();
3611
+ var toast = Toast._draggedToast;
3612
+ toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
3613
+ toast.xPos = Toast._xPos(e);
3614
+ toast.velocityX = toast.deltaX / (Date.now() - toast.time);
3615
+ toast.time = Date.now();
3616
+
3617
+ var totalDeltaX = toast.xPos - toast.startingXPos;
3618
+ var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
3619
+ toast.el.style.transform = 'translateX(' + totalDeltaX + 'px)';
3620
+ toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
3621
+ }
3622
+ }
3623
+
3624
+ /**
3625
+ * End drag handler
3626
+ * @param {Event} e
3627
+ */
3628
+
3629
+ }, {
3630
+ key: '_onDragEnd',
3631
+ value: function _onDragEnd(e) {
3632
+ if (!!Toast._draggedToast) {
3633
+ var toast = Toast._draggedToast;
3634
+ toast.panning = false;
3635
+ toast.el.classList.remove('panning');
3636
+
3637
+ var totalDeltaX = toast.xPos - toast.startingXPos;
3638
+ var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
3639
+ var shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1;
3640
+
3641
+ // Remove toast
3642
+ if (shouldBeDismissed) {
3643
+ toast.wasSwiped = true;
3644
+ toast.remove();
3645
+
3646
+ // Animate toast back to original position
3647
+ } else {
3648
+ toast.el.style.transition = 'transform .2s, opacity .2s';
3649
+ toast.el.style.transform = '';
3650
+ toast.el.style.opacity = '';
3651
+ }
3652
+ Toast._draggedToast = null;
3653
+ }
3654
+ }
3655
+
3656
+ /**
3657
+ * Get x position of mouse or touch event
3658
+ * @param {Event} e
3659
+ */
3660
+
3661
+ }, {
3662
+ key: '_xPos',
3663
+ value: function _xPos(e) {
3664
+ if (e.targetTouches && e.targetTouches.length >= 1) {
3665
+ return e.targetTouches[0].clientX;
3666
+ }
3667
+ // mouse event
3668
+ return e.clientX;
3669
+ }
3670
+
3671
+ /**
3672
+ * Remove all toasts
3673
+ */
3674
+
3675
+ }, {
3676
+ key: 'removeAll',
3677
+ value: function removeAll() {
3678
+ for (var toastIndex in Toast._toasts) {
3679
+ Toast._toasts[toastIndex].remove();
3680
+ }
3681
+ }
3682
+ }, {
3683
+ key: 'defaults',
3684
+ get: function () {
3685
+ return _defaults;
3686
+ }
3687
+ }]);
3688
+
3689
+ return Toast;
3690
+ }();
3691
+
3692
+ /**
3693
+ * @static
3694
+ * @memberof Toast
3695
+ * @type {Array.<Toast>}
3696
+ */
3697
+
3698
+
3699
+ Toast._toasts = [];
3700
+
3701
+ /**
3702
+ * @static
3703
+ * @memberof Toast
3704
+ */
3705
+ Toast._container = null;
3706
+
3707
+ /**
3708
+ * @static
3709
+ * @memberof Toast
3710
+ * @type {Toast}
3711
+ */
3712
+ Toast._draggedToast = null;
3713
+
3714
+ Materialize.Toast = Toast;
3715
+ Materialize.toast = function (message, displayLength, className, completeCallback) {
3716
+ return new Toast(message, displayLength, className, completeCallback);
3717
+ };
3718
+ })(jQuery, Materialize.Vel);
3719
+ ;(function ($) {
3720
+
3721
+ var methods = {
3722
+ init: function (options) {
3723
+ var defaults = {
3724
+ menuWidth: 300,
3725
+ edge: 'left',
3726
+ closeOnClick: false,
3727
+ draggable: true,
3728
+ onOpen: null,
3729
+ onClose: null
3730
+ };
3731
+ options = $.extend(defaults, options);
3732
+
3733
+ $(this).each(function () {
3734
+ var $this = $(this);
3735
+ var menuId = $this.attr('data-activates');
3736
+ var menu = $("#" + menuId);
3737
+
3738
+ // Set to width
3739
+ if (options.menuWidth != 300) {
3740
+ menu.css('width', options.menuWidth);
3741
+ }
3742
+
3743
+ // Add Touch Area
3744
+ var $dragTarget = $('.drag-target[data-sidenav="' + menuId + '"]');
3745
+ if (options.draggable) {
3746
+ // Regenerate dragTarget
3747
+ if ($dragTarget.length) {
3748
+ $dragTarget.remove();
3749
+ }
3750
+
3751
+ $dragTarget = $('<div class="drag-target"></div>').attr('data-sidenav', menuId);
3752
+ $('body').append($dragTarget);
3753
+ } else {
3754
+ $dragTarget = $();
3755
+ }
3756
+
3757
+ if (options.edge == 'left') {
3758
+ menu.css('transform', 'translateX(-100%)');
3759
+ $dragTarget.css({ 'left': 0 }); // Add Touch Area
3760
+ } else {
3761
+ menu.addClass('right-aligned') // Change text-alignment to right
3762
+ .css('transform', 'translateX(100%)');
3763
+ $dragTarget.css({ 'right': 0 }); // Add Touch Area
3764
+ }
3765
+
3766
+ // If fixed sidenav, bring menu out
3767
+ if (menu.hasClass('fixed')) {
3768
+ if (window.innerWidth > 992) {
3769
+ menu.css('transform', 'translateX(0)');
3770
+ }
3771
+ }
3772
+
3773
+ // Window resize to reset on large screens fixed
3774
+ if (menu.hasClass('fixed')) {
3775
+ $(window).resize(function () {
3776
+ if (window.innerWidth > 992) {
3777
+ // Close menu if window is resized bigger than 992 and user has fixed sidenav
3778
+ if ($('#sidenav-overlay').length !== 0 && menuOut) {
3779
+ removeMenu(true);
3780
+ } else {
3781
+ // menu.removeAttr('style');
3782
+ menu.css('transform', 'translateX(0%)');
3783
+ // menu.css('width', options.menuWidth);
3784
+ }
3785
+ } else if (menuOut === false) {
3786
+ if (options.edge === 'left') {
3787
+ menu.css('transform', 'translateX(-100%)');
3788
+ } else {
3789
+ menu.css('transform', 'translateX(100%)');
3790
+ }
3791
+ }
3792
+ });
3793
+ }
3794
+
3795
+ // if closeOnClick, then add close event for all a tags in side sideNav
3796
+ if (options.closeOnClick === true) {
3797
+ menu.on("click.itemclick", "a:not(.collapsible-header)", function () {
3798
+ if (!(window.innerWidth > 992 && menu.hasClass('fixed'))) {
3799
+ removeMenu();
3800
+ }
3801
+ });
3802
+ }
3803
+
3804
+ var removeMenu = function (restoreNav) {
3805
+ panning = false;
3806
+ menuOut = false;
3807
+ // Reenable scrolling
3808
+ $('body').css({
3809
+ overflow: '',
3810
+ width: ''
3811
+ });
3812
+
3813
+ $('#sidenav-overlay').velocity({ opacity: 0 }, { duration: 200,
3814
+ queue: false, easing: 'easeOutQuad',
3815
+ complete: function () {
3816
+ $(this).remove();
3817
+ } });
3818
+ if (options.edge === 'left') {
3819
+ // Reset phantom div
3820
+ $dragTarget.css({ width: '', right: '', left: '0' });
3821
+ menu.velocity({ 'translateX': '-100%' }, { duration: 200,
3822
+ queue: false,
3823
+ easing: 'easeOutCubic',
3824
+ complete: function () {
3825
+ if (restoreNav === true) {
3826
+ // Restore Fixed sidenav
3827
+ menu.removeAttr('style');
3828
+ menu.css('width', options.menuWidth);
3829
+ }
3830
+ }
3831
+
3832
+ });
3833
+ } else {
3834
+ // Reset phantom div
3835
+ $dragTarget.css({ width: '', right: '0', left: '' });
3836
+ menu.velocity({ 'translateX': '100%' }, { duration: 200,
3837
+ queue: false,
3838
+ easing: 'easeOutCubic',
3839
+ complete: function () {
3840
+ if (restoreNav === true) {
3841
+ // Restore Fixed sidenav
3842
+ menu.removeAttr('style');
3843
+ menu.css('width', options.menuWidth);
3844
+ }
3845
+ }
3846
+ });
3847
+ }
3848
+
3849
+ // Callback
3850
+ if (typeof options.onClose === 'function') {
3851
+ options.onClose.call(this, menu);
3852
+ }
3853
+ };
3854
+
3855
+ // Touch Event
3856
+ var panning = false;
3857
+ var menuOut = false;
3858
+
3859
+ if (options.draggable) {
3860
+ $dragTarget.on('click', function () {
3861
+ if (menuOut) {
3862
+ removeMenu();
3863
+ }
3864
+ });
3865
+
3866
+ $dragTarget.hammer({
3867
+ prevent_default: false
3868
+ }).on('pan', function (e) {
3869
+
3870
+ if (e.gesture.pointerType == "touch") {
3871
+
3872
+ var direction = e.gesture.direction;
3873
+ var x = e.gesture.center.x;
3874
+ var y = e.gesture.center.y;
3875
+ var velocityX = e.gesture.velocityX;
3876
+
3877
+ // Vertical scroll bugfix
3878
+ if (x === 0 && y === 0) {
3879
+ return;
3880
+ }
3881
+
3882
+ // Disable Scrolling
3883
+ var $body = $('body');
3884
+ var $overlay = $('#sidenav-overlay');
3885
+ var oldWidth = $body.innerWidth();
3886
+ $body.css('overflow', 'hidden');
3887
+ $body.width(oldWidth);
3888
+
3889
+ // If overlay does not exist, create one and if it is clicked, close menu
3890
+ if ($overlay.length === 0) {
3891
+ $overlay = $('<div id="sidenav-overlay"></div>');
3892
+ $overlay.css('opacity', 0).click(function () {
3893
+ removeMenu();
3894
+ });
3895
+
3896
+ // Run 'onOpen' when sidenav is opened via touch/swipe if applicable
3897
+ if (typeof options.onOpen === 'function') {
3898
+ options.onOpen.call(this, menu);
3899
+ }
3900
+
3901
+ $('body').append($overlay);
3902
+ }
3903
+
3904
+ // Keep within boundaries
3905
+ if (options.edge === 'left') {
3906
+ if (x > options.menuWidth) {
3907
+ x = options.menuWidth;
3908
+ } else if (x < 0) {
3909
+ x = 0;
3910
+ }
3911
+ }
3912
+
3913
+ if (options.edge === 'left') {
3914
+ // Left Direction
3915
+ if (x < options.menuWidth / 2) {
3916
+ menuOut = false;
3917
+ }
3918
+ // Right Direction
3919
+ else if (x >= options.menuWidth / 2) {
3920
+ menuOut = true;
3921
+ }
3922
+ menu.css('transform', 'translateX(' + (x - options.menuWidth) + 'px)');
3923
+ } else {
3924
+ // Left Direction
3925
+ if (x < window.innerWidth - options.menuWidth / 2) {
3926
+ menuOut = true;
3927
+ }
3928
+ // Right Direction
3929
+ else if (x >= window.innerWidth - options.menuWidth / 2) {
3930
+ menuOut = false;
3931
+ }
3932
+ var rightPos = x - options.menuWidth / 2;
3933
+ if (rightPos < 0) {
3934
+ rightPos = 0;
3935
+ }
3936
+
3937
+ menu.css('transform', 'translateX(' + rightPos + 'px)');
3938
+ }
3939
+
3940
+ // Percentage overlay
3941
+ var overlayPerc;
3942
+ if (options.edge === 'left') {
3943
+ overlayPerc = x / options.menuWidth;
3944
+ $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
3945
+ } else {
3946
+ overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
3947
+ $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
3948
+ }
3949
+ }
3950
+ }).on('panend', function (e) {
3951
+
3952
+ if (e.gesture.pointerType == "touch") {
3953
+ var $overlay = $('#sidenav-overlay');
3954
+ var velocityX = e.gesture.velocityX;
3955
+ var x = e.gesture.center.x;
3956
+ var leftPos = x - options.menuWidth;
3957
+ var rightPos = x - options.menuWidth / 2;
3958
+ if (leftPos > 0) {
3959
+ leftPos = 0;
3960
+ }
3961
+ if (rightPos < 0) {
3962
+ rightPos = 0;
3963
+ }
3964
+ panning = false;
3965
+
3966
+ if (options.edge === 'left') {
3967
+ // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
3968
+ if (menuOut && velocityX <= 0.3 || velocityX < -0.5) {
3969
+ // Return menu to open
3970
+ if (leftPos !== 0) {
3971
+ menu.velocity({ 'translateX': [0, leftPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
3972
+ }
3973
+
3974
+ $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
3975
+ $dragTarget.css({ width: '50%', right: 0, left: '' });
3976
+ menuOut = true;
3977
+ } else if (!menuOut || velocityX > 0.3) {
3978
+ // Enable Scrolling
3979
+ $('body').css({
3980
+ overflow: '',
3981
+ width: ''
3982
+ });
3983
+ // Slide menu closed
3984
+ menu.velocity({ 'translateX': [-1 * options.menuWidth - 10, leftPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
3985
+ $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeOutQuad',
3986
+ complete: function () {
3987
+ // Run 'onClose' when sidenav is closed via touch/swipe if applicable
3988
+ if (typeof options.onClose === 'function') {
3989
+ options.onClose.call(this, menu);
3990
+ }
3991
+
3992
+ $(this).remove();
3993
+ } });
3994
+ $dragTarget.css({ width: '10px', right: '', left: 0 });
3995
+ }
3996
+ } else {
3997
+ if (menuOut && velocityX >= -0.3 || velocityX > 0.5) {
3998
+ // Return menu to open
3999
+ if (rightPos !== 0) {
4000
+ menu.velocity({ 'translateX': [0, rightPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
4001
+ }
4002
+
4003
+ $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
4004
+ $dragTarget.css({ width: '50%', right: '', left: 0 });
4005
+ menuOut = true;
4006
+ } else if (!menuOut || velocityX < -0.3) {
4007
+ // Enable Scrolling
4008
+ $('body').css({
4009
+ overflow: '',
4010
+ width: ''
4011
+ });
4012
+
4013
+ // Slide menu closed
4014
+ menu.velocity({ 'translateX': [options.menuWidth + 10, rightPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
4015
+ $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeOutQuad',
4016
+ complete: function () {
4017
+ // Run 'onClose' when sidenav is closed via touch/swipe if applicable
4018
+ if (typeof options.onClose === 'function') {
4019
+ options.onClose.call(this, menu);
4020
+ }
4021
+
4022
+ $(this).remove();
4023
+ } });
4024
+ $dragTarget.css({ width: '10px', right: 0, left: '' });
4025
+ }
4026
+ }
4027
+ }
4028
+ });
4029
+ }
4030
+
4031
+ $this.off('click.sidenav').on('click.sidenav', function () {
4032
+ if (menuOut === true) {
4033
+ menuOut = false;
4034
+ panning = false;
4035
+ removeMenu();
4036
+ } else {
4037
+
4038
+ // Disable Scrolling
4039
+ var $body = $('body');
4040
+ var $overlay = $('<div id="sidenav-overlay"></div>');
4041
+ var oldWidth = $body.innerWidth();
4042
+ $body.css('overflow', 'hidden');
4043
+ $body.width(oldWidth);
4044
+
4045
+ // Push current drag target on top of DOM tree
4046
+ $('body').append($dragTarget);
4047
+
4048
+ if (options.edge === 'left') {
4049
+ $dragTarget.css({ width: '50%', right: 0, left: '' });
4050
+ menu.velocity({ 'translateX': [0, -1 * options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
4051
+ } else {
4052
+ $dragTarget.css({ width: '50%', right: '', left: 0 });
4053
+ menu.velocity({ 'translateX': [0, options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
4054
+ }
4055
+
4056
+ // Overlay close on click
4057
+ $overlay.css('opacity', 0).click(function () {
4058
+ menuOut = false;
4059
+ panning = false;
4060
+ removeMenu();
4061
+ $overlay.velocity({ opacity: 0 }, { duration: 300, queue: false, easing: 'easeOutQuad',
4062
+ complete: function () {
4063
+ $(this).remove();
4064
+ }
4065
+ });
4066
+ });
4067
+
4068
+ // Append body
4069
+ $('body').append($overlay);
4070
+ $overlay.velocity({ opacity: 1 }, { duration: 300, queue: false, easing: 'easeOutQuad',
4071
+ complete: function () {
4072
+ menuOut = true;
4073
+ panning = false;
4074
+ }
4075
+ });
4076
+
4077
+ // Callback
4078
+ if (typeof options.onOpen === 'function') {
4079
+ options.onOpen.call(this, menu);
4080
+ }
4081
+ }
4082
+
4083
+ return false;
4084
+ });
4085
+ });
4086
+ },
4087
+ destroy: function () {
4088
+ var $overlay = $('#sidenav-overlay');
4089
+ var $dragTarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]');
4090
+ $overlay.trigger('click');
4091
+ $dragTarget.remove();
4092
+ $(this).off('click');
4093
+ $overlay.remove();
4094
+ },
4095
+ show: function () {
4096
+ this.trigger('click');
4097
+ },
4098
+ hide: function () {
4099
+ $('#sidenav-overlay').trigger('click');
4100
+ }
4101
+ };
4102
+
4103
+ $.fn.sideNav = function (methodOrOptions) {
4104
+ if (methods[methodOrOptions]) {
4105
+ return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
4106
+ } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
4107
+ // Default to "init"
4108
+ return methods.init.apply(this, arguments);
4109
+ } else {
4110
+ $.error('Method ' + methodOrOptions + ' does not exist on jQuery.sideNav');
4111
+ }
4112
+ }; // Plugin end
4113
+ })(jQuery);
4114
+ ; /**
4115
+ * Extend jquery with a scrollspy plugin.
4116
+ * This watches the window scroll and fires events when elements are scrolled into viewport.
4117
+ *
4118
+ * throttle() and getTime() taken from Underscore.js
4119
+ * https://github.com/jashkenas/underscore
4120
+ *
4121
+ * @author Copyright 2013 John Smart
4122
+ * @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
4123
+ * @see https://github.com/thesmart
4124
+ * @version 0.1.2
4125
+ */
4126
+ (function ($) {
4127
+
4128
+ var jWindow = $(window);
4129
+ var elements = [];
4130
+ var elementsInView = [];
4131
+ var isSpying = false;
4132
+ var ticks = 0;
4133
+ var unique_id = 1;
4134
+ var offset = {
4135
+ top: 0,
4136
+ right: 0,
4137
+ bottom: 0,
4138
+ left: 0
4139
+
4140
+ /**
4141
+ * Find elements that are within the boundary
4142
+ * @param {number} top
4143
+ * @param {number} right
4144
+ * @param {number} bottom
4145
+ * @param {number} left
4146
+ * @return {jQuery} A collection of elements
4147
+ */
4148
+ };function findElements(top, right, bottom, left) {
4149
+ var hits = $();
4150
+ $.each(elements, function (i, element) {
4151
+ if (element.height() > 0) {
4152
+ var elTop = element.offset().top,
4153
+ elLeft = element.offset().left,
4154
+ elRight = elLeft + element.width(),
4155
+ elBottom = elTop + element.height();
4156
+
4157
+ var isIntersect = !(elLeft > right || elRight < left || elTop > bottom || elBottom < top);
4158
+
4159
+ if (isIntersect) {
4160
+ hits.push(element);
4161
+ }
4162
+ }
4163
+ });
4164
+
4165
+ return hits;
4166
+ }
4167
+
4168
+ /**
4169
+ * Called when the user scrolls the window
4170
+ */
4171
+ function onScroll(scrollOffset) {
4172
+ // unique tick id
4173
+ ++ticks;
4174
+
4175
+ // viewport rectangle
4176
+ var top = jWindow.scrollTop(),
4177
+ left = jWindow.scrollLeft(),
4178
+ right = left + jWindow.width(),
4179
+ bottom = top + jWindow.height();
4180
+
4181
+ // determine which elements are in view
4182
+ var intersections = findElements(top + offset.top + scrollOffset || 200, right + offset.right, bottom + offset.bottom, left + offset.left);
4183
+ $.each(intersections, function (i, element) {
4184
+
4185
+ var lastTick = element.data('scrollSpy:ticks');
4186
+ if (typeof lastTick != 'number') {
4187
+ // entered into view
4188
+ element.triggerHandler('scrollSpy:enter');
4189
+ }
4190
+
4191
+ // update tick id
4192
+ element.data('scrollSpy:ticks', ticks);
4193
+ });
4194
+
4195
+ // determine which elements are no longer in view
4196
+ $.each(elementsInView, function (i, element) {
4197
+ var lastTick = element.data('scrollSpy:ticks');
4198
+ if (typeof lastTick == 'number' && lastTick !== ticks) {
4199
+ // exited from view
4200
+ element.triggerHandler('scrollSpy:exit');
4201
+ element.data('scrollSpy:ticks', null);
4202
+ }
4203
+ });
4204
+
4205
+ // remember elements in view for next tick
4206
+ elementsInView = intersections;
4207
+ }
4208
+
4209
+ /**
4210
+ * Called when window is resized
4211
+ */
4212
+ function onWinSize() {
4213
+ jWindow.trigger('scrollSpy:winSize');
4214
+ }
4215
+
4216
+ /**
4217
+ * Enables ScrollSpy using a selector
4218
+ * @param {jQuery|string} selector The elements collection, or a selector
4219
+ * @param {Object=} options Optional.
4220
+ throttle : number -> scrollspy throttling. Default: 100 ms
4221
+ offsetTop : number -> offset from top. Default: 0
4222
+ offsetRight : number -> offset from right. Default: 0
4223
+ offsetBottom : number -> offset from bottom. Default: 0
4224
+ offsetLeft : number -> offset from left. Default: 0
4225
+ activeClass : string -> Class name to be added to the active link. Default: active
4226
+ * @returns {jQuery}
4227
+ */
4228
+ $.scrollSpy = function (selector, options) {
4229
+ var defaults = {
4230
+ throttle: 100,
4231
+ scrollOffset: 200, // offset - 200 allows elements near bottom of page to scroll
4232
+ activeClass: 'active',
4233
+ getActiveElement: function (id) {
4234
+ return 'a[href="#' + id + '"]';
4235
+ }
4236
+ };
4237
+ options = $.extend(defaults, options);
4238
+
4239
+ var visible = [];
4240
+ selector = $(selector);
4241
+ selector.each(function (i, element) {
4242
+ elements.push($(element));
4243
+ $(element).data("scrollSpy:id", i);
4244
+ // Smooth scroll to section
4245
+ $('a[href="#' + $(element).attr('id') + '"]').click(function (e) {
4246
+ e.preventDefault();
4247
+ var offset = $(Materialize.escapeHash(this.hash)).offset().top + 1;
4248
+ $('html, body').animate({ scrollTop: offset - options.scrollOffset }, { duration: 400, queue: false, easing: 'easeOutCubic' });
4249
+ });
4250
+ });
4251
+
4252
+ offset.top = options.offsetTop || 0;
4253
+ offset.right = options.offsetRight || 0;
4254
+ offset.bottom = options.offsetBottom || 0;
4255
+ offset.left = options.offsetLeft || 0;
4256
+
4257
+ var throttledScroll = Materialize.throttle(function () {
4258
+ onScroll(options.scrollOffset);
4259
+ }, options.throttle || 100);
4260
+ var readyScroll = function () {
4261
+ $(document).ready(throttledScroll);
4262
+ };
4263
+
4264
+ if (!isSpying) {
4265
+ jWindow.on('scroll', readyScroll);
4266
+ jWindow.on('resize', readyScroll);
4267
+ isSpying = true;
4268
+ }
4269
+
4270
+ // perform a scan once, after current execution context, and after dom is ready
4271
+ setTimeout(readyScroll, 0);
4272
+
4273
+ selector.on('scrollSpy:enter', function () {
4274
+ visible = $.grep(visible, function (value) {
4275
+ return value.height() != 0;
4276
+ });
4277
+
4278
+ var $this = $(this);
4279
+
4280
+ if (visible[0]) {
4281
+ $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
4282
+ if ($this.data('scrollSpy:id') < visible[0].data('scrollSpy:id')) {
4283
+ visible.unshift($(this));
4284
+ } else {
4285
+ visible.push($(this));
4286
+ }
4287
+ } else {
4288
+ visible.push($(this));
4289
+ }
4290
+
4291
+ $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
4292
+ });
4293
+ selector.on('scrollSpy:exit', function () {
4294
+ visible = $.grep(visible, function (value) {
4295
+ return value.height() != 0;
4296
+ });
4297
+
4298
+ if (visible[0]) {
4299
+ $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
4300
+ var $this = $(this);
4301
+ visible = $.grep(visible, function (value) {
4302
+ return value.attr('id') != $this.attr('id');
4303
+ });
4304
+ if (visible[0]) {
4305
+ // Check if empty
4306
+ $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
4307
+ }
4308
+ }
4309
+ });
4310
+
4311
+ return selector;
4312
+ };
4313
+
4314
+ /**
4315
+ * Listen for window resize events
4316
+ * @param {Object=} options Optional. Set { throttle: number } to change throttling. Default: 100 ms
4317
+ * @returns {jQuery} $(window)
4318
+ */
4319
+ $.winSizeSpy = function (options) {
4320
+ $.winSizeSpy = function () {
4321
+ return jWindow;
4322
+ }; // lock from multiple calls
4323
+ options = options || {
4324
+ throttle: 100
4325
+ };
4326
+ return jWindow.on('resize', Materialize.throttle(onWinSize, options.throttle || 100));
4327
+ };
4328
+
4329
+ /**
4330
+ * Enables ScrollSpy on a collection of elements
4331
+ * e.g. $('.scrollSpy').scrollSpy()
4332
+ * @param {Object=} options Optional.
4333
+ throttle : number -> scrollspy throttling. Default: 100 ms
4334
+ offsetTop : number -> offset from top. Default: 0
4335
+ offsetRight : number -> offset from right. Default: 0
4336
+ offsetBottom : number -> offset from bottom. Default: 0
4337
+ offsetLeft : number -> offset from left. Default: 0
4338
+ * @returns {jQuery}
4339
+ */
4340
+ $.fn.scrollSpy = function (options) {
4341
+ return $.scrollSpy($(this), options);
4342
+ };
4343
+ })(jQuery);
4344
+ ;(function ($) {
4345
+ $(document).ready(function () {
4346
+
4347
+ // Function to update labels of text fields
4348
+ Materialize.updateTextFields = function () {
4349
+ var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
4350
+ $(input_selector).each(function (index, element) {
4351
+ var $this = $(this);
4352
+ if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) {
4353
+ $this.siblings('label').addClass('active');
4354
+ } else if ($(element)[0].validity) {
4355
+ $this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
4356
+ } else {
4357
+ $this.siblings('label').removeClass('active');
4358
+ }
4359
+ });
4360
+ };
4361
+
4362
+ // Text based inputs
4363
+ var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
4364
+
4365
+ // Add active if form auto complete
4366
+ $(document).on('change', input_selector, function () {
4367
+ if ($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
4368
+ $(this).siblings('label').addClass('active');
4369
+ }
4370
+ validate_field($(this));
4371
+ });
4372
+
4373
+ // Add active if input element has been pre-populated on document ready
4374
+ $(document).ready(function () {
4375
+ Materialize.updateTextFields();
4376
+ });
4377
+
4378
+ // HTML DOM FORM RESET handling
4379
+ $(document).on('reset', function (e) {
4380
+ var formReset = $(e.target);
4381
+ if (formReset.is('form')) {
4382
+ formReset.find(input_selector).removeClass('valid').removeClass('invalid');
4383
+ formReset.find(input_selector).each(function () {
4384
+ if ($(this).attr('value') === '') {
4385
+ $(this).siblings('label').removeClass('active');
4386
+ }
4387
+ });
4388
+
4389
+ // Reset select
4390
+ formReset.find('select.initialized').each(function () {
4391
+ var reset_text = formReset.find('option[selected]').text();
4392
+ formReset.siblings('input.select-dropdown').val(reset_text);
4393
+ });
4394
+ }
4395
+ });
4396
+
4397
+ // Add active when element has focus
4398
+ $(document).on('focus', input_selector, function () {
4399
+ $(this).siblings('label, .prefix').addClass('active');
4400
+ });
4401
+
4402
+ $(document).on('blur', input_selector, function () {
4403
+ var $inputElement = $(this);
4404
+ var selector = ".prefix";
4405
+
4406
+ if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
4407
+ selector += ", label";
4408
+ }
4409
+
4410
+ $inputElement.siblings(selector).removeClass('active');
4411
+
4412
+ validate_field($inputElement);
4413
+ });
4414
+
4415
+ window.validate_field = function (object) {
4416
+ var hasLength = object.attr('data-length') !== undefined;
4417
+ var lenAttr = parseInt(object.attr('data-length'));
4418
+ var len = object.val().length;
4419
+
4420
+ if (object.val().length === 0 && object[0].validity.badInput === false && !object.is(':required')) {
4421
+ if (object.hasClass('validate')) {
4422
+ object.removeClass('valid');
4423
+ object.removeClass('invalid');
4424
+ }
4425
+ } else {
4426
+ if (object.hasClass('validate')) {
4427
+ // Check for character counter attributes
4428
+ if (object.is(':valid') && hasLength && len <= lenAttr || object.is(':valid') && !hasLength) {
4429
+ object.removeClass('invalid');
4430
+ object.addClass('valid');
4431
+ } else {
4432
+ object.removeClass('valid');
4433
+ object.addClass('invalid');
4434
+ }
4435
+ }
4436
+ }
4437
+ };
4438
+
4439
+ // Radio and Checkbox focus class
4440
+ var radio_checkbox = 'input[type=radio], input[type=checkbox]';
4441
+ $(document).on('keyup.radio', radio_checkbox, function (e) {
4442
+ // TAB, check if tabbing to radio or checkbox.
4443
+ if (e.which === 9) {
4444
+ $(this).addClass('tabbed');
4445
+ var $this = $(this);
4446
+ $this.one('blur', function (e) {
4447
+
4448
+ $(this).removeClass('tabbed');
4449
+ });
4450
+ return;
4451
+ }
4452
+ });
4453
+
4454
+ // Textarea Auto Resize
4455
+ var hiddenDiv = $('.hiddendiv').first();
4456
+ if (!hiddenDiv.length) {
4457
+ hiddenDiv = $('<div class="hiddendiv common"></div>');
4458
+ $('body').append(hiddenDiv);
4459
+ }
4460
+ var text_area_selector = '.materialize-textarea';
4461
+
4462
+ function textareaAutoResize($textarea) {
4463
+ // Set font properties of hiddenDiv
4464
+
4465
+ var fontFamily = $textarea.css('font-family');
4466
+ var fontSize = $textarea.css('font-size');
4467
+ var lineHeight = $textarea.css('line-height');
4468
+ var padding = $textarea.css('padding');
4469
+
4470
+ if (fontSize) {
4471
+ hiddenDiv.css('font-size', fontSize);
4472
+ }
4473
+ if (fontFamily) {
4474
+ hiddenDiv.css('font-family', fontFamily);
4475
+ }
4476
+ if (lineHeight) {
4477
+ hiddenDiv.css('line-height', lineHeight);
4478
+ }
4479
+ if (padding) {
4480
+ hiddenDiv.css('padding', padding);
4481
+ }
4482
+
4483
+ // Set original-height, if none
4484
+ if (!$textarea.data('original-height')) {
4485
+ $textarea.data('original-height', $textarea.height());
4486
+ }
4487
+
4488
+ if ($textarea.attr('wrap') === 'off') {
4489
+ hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
4490
+ }
4491
+
4492
+ hiddenDiv.text($textarea.val() + '\n');
4493
+ var content = hiddenDiv.html().replace(/\n/g, '<br>');
4494
+ hiddenDiv.html(content);
4495
+
4496
+ // When textarea is hidden, width goes crazy.
4497
+ // Approximate with half of window size
4498
+
4499
+ if ($textarea.is(':visible')) {
4500
+ hiddenDiv.css('width', $textarea.width());
4501
+ } else {
4502
+ hiddenDiv.css('width', $(window).width() / 2);
4503
+ }
4504
+
4505
+ /**
4506
+ * Resize if the new height is greater than the
4507
+ * original height of the textarea
4508
+ */
4509
+ if ($textarea.data('original-height') <= hiddenDiv.height()) {
4510
+ $textarea.css('height', hiddenDiv.height());
4511
+ } else if ($textarea.val().length < $textarea.data('previous-length')) {
4512
+ /**
4513
+ * In case the new height is less than original height, it
4514
+ * means the textarea has less text than before
4515
+ * So we set the height to the original one
4516
+ */
4517
+ $textarea.css('height', $textarea.data('original-height'));
4518
+ }
4519
+ $textarea.data('previous-length', $textarea.val().length);
4520
+ }
4521
+
4522
+ $(text_area_selector).each(function () {
4523
+ var $textarea = $(this);
4524
+ /**
4525
+ * Instead of resizing textarea on document load,
4526
+ * store the original height and the original length
4527
+ */
4528
+ $textarea.data('original-height', $textarea.height());
4529
+ $textarea.data('previous-length', $textarea.val().length);
4530
+ });
4531
+
4532
+ $('body').on('keyup keydown autoresize', text_area_selector, function () {
4533
+ textareaAutoResize($(this));
4534
+ });
4535
+
4536
+ // File Input Path
4537
+ $(document).on('change', '.file-field input[type="file"]', function () {
4538
+ var file_field = $(this).closest('.file-field');
4539
+ var path_input = file_field.find('input.file-path');
4540
+ var files = $(this)[0].files;
4541
+ var file_names = [];
4542
+ for (var i = 0; i < files.length; i++) {
4543
+ file_names.push(files[i].name);
4544
+ }
4545
+ path_input.val(file_names.join(", "));
4546
+ path_input.trigger('change');
4547
+ });
4548
+
4549
+ /****************
4550
+ * Range Input *
4551
+ ****************/
4552
+
4553
+ var range_type = 'input[type=range]';
4554
+ var range_mousedown = false;
4555
+ var left;
4556
+
4557
+ $(range_type).each(function () {
4558
+ var thumb = $('<span class="thumb"><span class="value"></span></span>');
4559
+ $(this).after(thumb);
4560
+ });
4561
+
4562
+ var showRangeBubble = function (thumb) {
4563
+ var paddingLeft = parseInt(thumb.parent().css('padding-left'));
4564
+ var marginLeft = -7 + paddingLeft + 'px';
4565
+ thumb.velocity({ height: "30px", width: "30px", top: "-30px", marginLeft: marginLeft }, { duration: 300, easing: 'easeOutExpo' });
4566
+ };
4567
+
4568
+ var calcRangeOffset = function (range) {
4569
+ var width = range.width() - 15;
4570
+ var max = parseFloat(range.attr('max'));
4571
+ var min = parseFloat(range.attr('min'));
4572
+ var percent = (parseFloat(range.val()) - min) / (max - min);
4573
+ return percent * width;
4574
+ };
4575
+
4576
+ var range_wrapper = '.range-field';
4577
+ $(document).on('change', range_type, function (e) {
4578
+ var thumb = $(this).siblings('.thumb');
4579
+ thumb.find('.value').html($(this).val());
4580
+
4581
+ if (!thumb.hasClass('active')) {
4582
+ showRangeBubble(thumb);
4583
+ }
4584
+
4585
+ var offsetLeft = calcRangeOffset($(this));
4586
+ thumb.addClass('active').css('left', offsetLeft);
4587
+ });
4588
+
4589
+ $(document).on('mousedown touchstart', range_type, function (e) {
4590
+ var thumb = $(this).siblings('.thumb');
4591
+
4592
+ // If thumb indicator does not exist yet, create it
4593
+ if (thumb.length <= 0) {
4594
+ thumb = $('<span class="thumb"><span class="value"></span></span>');
4595
+ $(this).after(thumb);
4596
+ }
4597
+
4598
+ // Set indicator value
4599
+ thumb.find('.value').html($(this).val());
4600
+
4601
+ range_mousedown = true;
4602
+ $(this).addClass('active');
4603
+
4604
+ if (!thumb.hasClass('active')) {
4605
+ showRangeBubble(thumb);
4606
+ }
4607
+
4608
+ if (e.type !== 'input') {
4609
+ var offsetLeft = calcRangeOffset($(this));
4610
+ thumb.addClass('active').css('left', offsetLeft);
4611
+ }
4612
+ });
4613
+
4614
+ $(document).on('mouseup touchend', range_wrapper, function () {
4615
+ range_mousedown = false;
4616
+ $(this).removeClass('active');
4617
+ });
4618
+
4619
+ $(document).on('input mousemove touchmove', range_wrapper, function (e) {
4620
+ var thumb = $(this).children('.thumb');
4621
+ var left;
4622
+ var input = $(this).find(range_type);
4623
+
4624
+ if (range_mousedown) {
4625
+ if (!thumb.hasClass('active')) {
4626
+ showRangeBubble(thumb);
4627
+ }
4628
+
4629
+ var offsetLeft = calcRangeOffset(input);
4630
+ thumb.addClass('active').css('left', offsetLeft);
4631
+ thumb.find('.value').html(thumb.siblings(range_type).val());
4632
+ }
4633
+ });
4634
+
4635
+ $(document).on('mouseout touchleave', range_wrapper, function () {
4636
+ if (!range_mousedown) {
4637
+
4638
+ var thumb = $(this).children('.thumb');
4639
+ var paddingLeft = parseInt($(this).css('padding-left'));
4640
+ var marginLeft = 7 + paddingLeft + 'px';
4641
+
4642
+ if (thumb.hasClass('active')) {
4643
+ thumb.velocity({ height: '0', width: '0', top: '10px', marginLeft: marginLeft }, { duration: 100 });
4644
+ }
4645
+ thumb.removeClass('active');
4646
+ }
4647
+ });
4648
+
4649
+ /**************************
4650
+ * Auto complete plugin *
4651
+ *************************/
4652
+ $.fn.autocomplete = function (options) {
4653
+ // Defaults
4654
+ var defaults = {
4655
+ data: {},
4656
+ limit: Infinity,
4657
+ onAutocomplete: null,
4658
+ minLength: 1
4659
+ };
4660
+
4661
+ options = $.extend(defaults, options);
4662
+
4663
+ return this.each(function () {
4664
+ var $input = $(this);
4665
+ var data = options.data,
4666
+ count = 0,
4667
+ activeIndex = -1,
4668
+ oldVal,
4669
+ $inputDiv = $input.closest('.input-field'); // Div to append on
4670
+
4671
+ // Check if data isn't empty
4672
+ if (!$.isEmptyObject(data)) {
4673
+ var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
4674
+ var $oldAutocomplete;
4675
+
4676
+ // Append autocomplete element.
4677
+ // Prevent double structure init.
4678
+ if ($inputDiv.length) {
4679
+ $oldAutocomplete = $inputDiv.children('.autocomplete-content.dropdown-content').first();
4680
+ if (!$oldAutocomplete.length) {
4681
+ $inputDiv.append($autocomplete); // Set ul in body
4682
+ }
4683
+ } else {
4684
+ $oldAutocomplete = $input.next('.autocomplete-content.dropdown-content');
4685
+ if (!$oldAutocomplete.length) {
4686
+ $input.after($autocomplete);
4687
+ }
4688
+ }
4689
+ if ($oldAutocomplete.length) {
4690
+ $autocomplete = $oldAutocomplete;
4691
+ }
4692
+
4693
+ // Highlight partial match.
4694
+ var highlight = function (string, $el) {
4695
+ var img = $el.find('img');
4696
+ var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
4697
+ matchEnd = matchStart + string.length - 1,
4698
+ beforeMatch = $el.text().slice(0, matchStart),
4699
+ matchText = $el.text().slice(matchStart, matchEnd + 1),
4700
+ afterMatch = $el.text().slice(matchEnd + 1);
4701
+ $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
4702
+ if (img.length) {
4703
+ $el.prepend(img);
4704
+ }
4705
+ };
4706
+
4707
+ // Reset current element position
4708
+ var resetCurrentElement = function () {
4709
+ activeIndex = -1;
4710
+ $autocomplete.find('.active').removeClass('active');
4711
+ };
4712
+
4713
+ // Remove autocomplete elements
4714
+ var removeAutocomplete = function () {
4715
+ $autocomplete.empty();
4716
+ resetCurrentElement();
4717
+ oldVal = undefined;
4718
+ };
4719
+
4720
+ $input.off('blur.autocomplete').on('blur.autocomplete', function () {
4721
+ removeAutocomplete();
4722
+ });
4723
+
4724
+ // Perform search
4725
+ $input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) {
4726
+ // Reset count.
4727
+ count = 0;
4728
+ var val = $input.val().toLowerCase();
4729
+
4730
+ // Don't capture enter or arrow key usage.
4731
+ if (e.which === 13 || e.which === 38 || e.which === 40) {
4732
+ return;
4733
+ }
4734
+
4735
+ // Check if the input isn't empty
4736
+ if (oldVal !== val) {
4737
+ removeAutocomplete();
4738
+
4739
+ if (val.length >= options.minLength) {
4740
+ for (var key in data) {
4741
+ if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
4742
+ // Break if past limit
4743
+ if (count >= options.limit) {
4744
+ break;
4745
+ }
4746
+
4747
+ var autocompleteOption = $('<li></li>');
4748
+ if (!!data[key]) {
4749
+ autocompleteOption.append('<img src="' + data[key] + '" class="right circle"><span>' + key + '</span>');
4750
+ } else {
4751
+ autocompleteOption.append('<span>' + key + '</span>');
4752
+ }
4753
+
4754
+ $autocomplete.append(autocompleteOption);
4755
+ highlight(val, autocompleteOption);
4756
+ count++;
4757
+ }
4758
+ }
4759
+ }
4760
+ }
4761
+
4762
+ // Update oldVal
4763
+ oldVal = val;
4764
+ });
4765
+
4766
+ $input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) {
4767
+ // Arrow keys and enter key usage
4768
+ var keyCode = e.which,
4769
+ liElement,
4770
+ numItems = $autocomplete.children('li').length,
4771
+ $active = $autocomplete.children('.active').first();
4772
+
4773
+ // select element on Enter
4774
+ if (keyCode === 13 && activeIndex >= 0) {
4775
+ liElement = $autocomplete.children('li').eq(activeIndex);
4776
+ if (liElement.length) {
4777
+ liElement.trigger('mousedown.autocomplete');
4778
+ e.preventDefault();
4779
+ }
4780
+ return;
4781
+ }
4782
+
4783
+ // Capture up and down key
4784
+ if (keyCode === 38 || keyCode === 40) {
4785
+ e.preventDefault();
4786
+
4787
+ if (keyCode === 38 && activeIndex > 0) {
4788
+ activeIndex--;
4789
+ }
4790
+
4791
+ if (keyCode === 40 && activeIndex < numItems - 1) {
4792
+ activeIndex++;
4793
+ }
4794
+
4795
+ $active.removeClass('active');
4796
+ if (activeIndex >= 0) {
4797
+ $autocomplete.children('li').eq(activeIndex).addClass('active');
4798
+ }
4799
+ }
4800
+ });
4801
+
4802
+ // Set input value
4803
+ $autocomplete.off('mousedown.autocomplete touchstart.autocomplete').on('mousedown.autocomplete touchstart.autocomplete', 'li', function () {
4804
+ var text = $(this).text().trim();
4805
+ $input.val(text);
4806
+ $input.trigger('change');
4807
+ removeAutocomplete();
4808
+
4809
+ // Handle onAutocomplete callback.
4810
+ if (typeof options.onAutocomplete === "function") {
4811
+ options.onAutocomplete.call(this, text);
4812
+ }
4813
+ });
4814
+
4815
+ // Empty data
4816
+ } else {
4817
+ $input.off('keyup.autocomplete focus.autocomplete');
4818
+ }
4819
+ });
4820
+ };
4821
+ }); // End of $(document).ready
4822
+
4823
+ /*******************
4824
+ * Select Plugin *
4825
+ ******************/
4826
+ $.fn.material_select = function (callback) {
4827
+ $(this).each(function () {
4828
+ var $select = $(this);
4829
+
4830
+ if ($select.hasClass('browser-default')) {
4831
+ return; // Continue to next (return false breaks out of entire loop)
4832
+ }
4833
+
4834
+ var multiple = $select.attr('multiple') ? true : false,
4835
+ lastID = $select.attr('data-select-id'); // Tear down structure if Select needs to be rebuilt
4836
+
4837
+ if (lastID) {
4838
+ $select.parent().find('span.caret').remove();
4839
+ $select.parent().find('input').remove();
4840
+
4841
+ $select.unwrap();
4842
+ $('ul#select-options-' + lastID).remove();
4843
+ }
4844
+
4845
+ // If destroying the select, remove the selelct-id and reset it to it's uninitialized state.
4846
+ if (callback === 'destroy') {
4847
+ $select.removeAttr('data-select-id').removeClass('initialized');
4848
+ $(window).off('click.select');
4849
+ return;
4850
+ }
4851
+
4852
+ var uniqueID = Materialize.guid();
4853
+ $select.attr('data-select-id', uniqueID);
4854
+ var wrapper = $('<div class="select-wrapper"></div>');
4855
+ wrapper.addClass($select.attr('class'));
4856
+ if ($select.is(':disabled')) wrapper.addClass('disabled');
4857
+ var options = $('<ul id="select-options-' + uniqueID + '" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>'),
4858
+ selectChildren = $select.children('option, optgroup'),
4859
+ valuesSelected = [],
4860
+ optionsHover = false;
4861
+
4862
+ var label = $select.find('option:selected').html() || $select.find('option:first').html() || "";
4863
+
4864
+ // Function that renders and appends the option taking into
4865
+ // account type and possible image icon.
4866
+ var appendOptionWithIcon = function (select, option, type) {
4867
+ // Add disabled attr if disabled
4868
+ var disabledClass = option.is(':disabled') ? 'disabled ' : '';
4869
+ var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : '';
4870
+ var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : '';
4871
+
4872
+ // add icons
4873
+ var icon_url = option.data('icon');
4874
+ var classes = option.attr('class');
4875
+ if (!!icon_url) {
4876
+ var classString = '';
4877
+ if (!!classes) classString = ' class="' + classes + '"';
4878
+
4879
+ // Check for multiple type.
4880
+ options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
4881
+ return true;
4882
+ }
4883
+
4884
+ // Check for multiple type.
4885
+ options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
4886
+ };
4887
+
4888
+ /* Create dropdown structure. */
4889
+ if (selectChildren.length) {
4890
+ selectChildren.each(function () {
4891
+ if ($(this).is('option')) {
4892
+ // Direct descendant option.
4893
+ if (multiple) {
4894
+ appendOptionWithIcon($select, $(this), 'multiple');
4895
+ } else {
4896
+ appendOptionWithIcon($select, $(this));
4897
+ }
4898
+ } else if ($(this).is('optgroup')) {
4899
+ // Optgroup.
4900
+ var selectOptions = $(this).children('option');
4901
+ options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
4902
+
4903
+ selectOptions.each(function () {
4904
+ appendOptionWithIcon($select, $(this), 'optgroup-option');
4905
+ });
4906
+ }
4907
+ });
4908
+ }
4909
+
4910
+ options.find('li:not(.optgroup)').each(function (i) {
4911
+ $(this).click(function (e) {
4912
+ // Check if option element is disabled
4913
+ if (!$(this).hasClass('disabled') && !$(this).hasClass('optgroup')) {
4914
+ var selected = true;
4915
+
4916
+ if (multiple) {
4917
+ $('input[type="checkbox"]', this).prop('checked', function (i, v) {
4918
+ return !v;
4919
+ });
4920
+ selected = toggleEntryFromArray(valuesSelected, i, $select);
4921
+ $newSelect.trigger('focus');
4922
+ } else {
4923
+ options.find('li').removeClass('active');
4924
+ $(this).toggleClass('active');
4925
+ $newSelect.val($(this).text());
4926
+ }
4927
+
4928
+ activateOption(options, $(this));
4929
+ $select.find('option').eq(i).prop('selected', selected);
4930
+ // Trigger onchange() event
4931
+ $select.trigger('change');
4932
+ if (typeof callback !== 'undefined') callback();
4933
+ }
4934
+
4935
+ e.stopPropagation();
4936
+ });
4937
+ });
4938
+
4939
+ // Wrap Elements
4940
+ $select.wrap(wrapper);
4941
+ // Add Select Display Element
4942
+ var dropdownIcon = $('<span class="caret">&#9660;</span>');
4943
+
4944
+ // escape double quotes
4945
+ var sanitizedLabelHtml = label.replace(/"/g, '&quot;');
4946
+
4947
+ var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + ($select.is(':disabled') ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID + '" value="' + sanitizedLabelHtml + '"/>');
4948
+ $select.before($newSelect);
4949
+ $newSelect.before(dropdownIcon);
4950
+
4951
+ $newSelect.after(options);
4952
+ // Check if section element is disabled
4953
+ if (!$select.is(':disabled')) {
4954
+ $newSelect.dropdown({ 'hover': false });
4955
+ }
4956
+
4957
+ // Copy tabindex
4958
+ if ($select.attr('tabindex')) {
4959
+ $($newSelect[0]).attr('tabindex', $select.attr('tabindex'));
4960
+ }
4961
+
4962
+ $select.addClass('initialized');
4963
+
4964
+ $newSelect.on({
4965
+ 'focus': function () {
4966
+ if ($('ul.select-dropdown').not(options[0]).is(':visible')) {
4967
+ $('input.select-dropdown').trigger('close');
4968
+ $(window).off('click.select');
4969
+ }
4970
+ if (!options.is(':visible')) {
4971
+ $(this).trigger('open', ['focus']);
4972
+ var label = $(this).val();
4973
+ if (multiple && label.indexOf(',') >= 0) {
4974
+ label = label.split(',')[0];
4975
+ }
4976
+
4977
+ var selectedOption = options.find('li').filter(function () {
4978
+ return $(this).text().toLowerCase() === label.toLowerCase();
4979
+ })[0];
4980
+ activateOption(options, selectedOption, true);
4981
+
4982
+ $(window).off('click.select').on('click.select', function () {
4983
+ multiple && (optionsHover || $newSelect.trigger('close'));
4984
+ $(window).off('click.select');
4985
+ });
4986
+ }
4987
+ },
4988
+ 'click': function (e) {
4989
+ e.stopPropagation();
4990
+ }
4991
+ });
4992
+
4993
+ $newSelect.on('blur', function () {
4994
+ if (!multiple) {
4995
+ $(this).trigger('close');
4996
+ $(window).off('click.select');
4997
+ }
4998
+ options.find('li.selected').removeClass('selected');
4999
+ });
5000
+
5001
+ options.hover(function () {
5002
+ optionsHover = true;
5003
+ }, function () {
5004
+ optionsHover = false;
5005
+ });
5006
+
5007
+ // Add initial multiple selections.
5008
+ if (multiple) {
5009
+ $select.find("option:selected:not(:disabled)").each(function () {
5010
+ var index = this.index;
5011
+
5012
+ toggleEntryFromArray(valuesSelected, index, $select);
5013
+ options.find("li:not(.optgroup)").eq(index).find(":checkbox").prop("checked", true);
5014
+ });
5015
+ }
5016
+
5017
+ /**
5018
+ * Make option as selected and scroll to selected position
5019
+ * @param {jQuery} collection Select options jQuery element
5020
+ * @param {Element} newOption element of the new option
5021
+ * @param {Boolean} firstActivation If on first activation of select
5022
+ */
5023
+ var activateOption = function (collection, newOption, firstActivation) {
5024
+ if (newOption) {
5025
+ collection.find('li.selected').removeClass('selected');
5026
+ var option = $(newOption);
5027
+ option.addClass('selected');
5028
+ if (!multiple || !!firstActivation) {
5029
+ options.scrollTo(option);
5030
+ }
5031
+ }
5032
+ };
5033
+
5034
+ // Allow user to search by typing
5035
+ // this array is cleared after 1 second
5036
+ var filterQuery = [],
5037
+ onKeyDown = function (e) {
5038
+ // TAB - switch to another input
5039
+ if (e.which == 9) {
5040
+ $newSelect.trigger('close');
5041
+ return;
5042
+ }
5043
+
5044
+ // ARROW DOWN WHEN SELECT IS CLOSED - open select options
5045
+ if (e.which == 40 && !options.is(':visible')) {
5046
+ $newSelect.trigger('open');
5047
+ return;
5048
+ }
5049
+
5050
+ // ENTER WHEN SELECT IS CLOSED - submit form
5051
+ if (e.which == 13 && !options.is(':visible')) {
5052
+ return;
5053
+ }
5054
+
5055
+ e.preventDefault();
5056
+
5057
+ // CASE WHEN USER TYPE LETTERS
5058
+ var letter = String.fromCharCode(e.which).toLowerCase(),
5059
+ nonLetters = [9, 13, 27, 38, 40];
5060
+ if (letter && nonLetters.indexOf(e.which) === -1) {
5061
+ filterQuery.push(letter);
5062
+
5063
+ var string = filterQuery.join(''),
5064
+ newOption = options.find('li').filter(function () {
5065
+ return $(this).text().toLowerCase().indexOf(string) === 0;
5066
+ })[0];
5067
+
5068
+ if (newOption) {
5069
+ activateOption(options, newOption);
5070
+ }
5071
+ }
5072
+
5073
+ // ENTER - select option and close when select options are opened
5074
+ if (e.which == 13) {
5075
+ var activeOption = options.find('li.selected:not(.disabled)')[0];
5076
+ if (activeOption) {
5077
+ $(activeOption).trigger('click');
5078
+ if (!multiple) {
5079
+ $newSelect.trigger('close');
5080
+ }
5081
+ }
5082
+ }
5083
+
5084
+ // ARROW DOWN - move to next not disabled option
5085
+ if (e.which == 40) {
5086
+ if (options.find('li.selected').length) {
5087
+ newOption = options.find('li.selected').next('li:not(.disabled)')[0];
5088
+ } else {
5089
+ newOption = options.find('li:not(.disabled)')[0];
5090
+ }
5091
+ activateOption(options, newOption);
5092
+ }
5093
+
5094
+ // ESC - close options
5095
+ if (e.which == 27) {
5096
+ $newSelect.trigger('close');
5097
+ }
5098
+
5099
+ // ARROW UP - move to previous not disabled option
5100
+ if (e.which == 38) {
5101
+ newOption = options.find('li.selected').prev('li:not(.disabled)')[0];
5102
+ if (newOption) activateOption(options, newOption);
5103
+ }
5104
+
5105
+ // Automaticaly clean filter query so user can search again by starting letters
5106
+ setTimeout(function () {
5107
+ filterQuery = [];
5108
+ }, 1000);
5109
+ };
5110
+
5111
+ $newSelect.on('keydown', onKeyDown);
5112
+ });
5113
+
5114
+ function toggleEntryFromArray(entriesArray, entryIndex, select) {
5115
+ var index = entriesArray.indexOf(entryIndex),
5116
+ notAdded = index === -1;
5117
+
5118
+ if (notAdded) {
5119
+ entriesArray.push(entryIndex);
5120
+ } else {
5121
+ entriesArray.splice(index, 1);
5122
+ }
5123
+
5124
+ select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryIndex).toggleClass('active');
5125
+
5126
+ // use notAdded instead of true (to detect if the option is selected or not)
5127
+ select.find('option').eq(entryIndex).prop('selected', notAdded);
5128
+ setValueToInput(entriesArray, select);
5129
+
5130
+ return notAdded;
5131
+ }
5132
+
5133
+ function setValueToInput(entriesArray, select) {
5134
+ var value = '';
5135
+
5136
+ for (var i = 0, count = entriesArray.length; i < count; i++) {
5137
+ var text = select.find('option').eq(entriesArray[i]).text();
5138
+
5139
+ i === 0 ? value += text : value += ', ' + text;
5140
+ }
5141
+
5142
+ if (value === '') {
5143
+ value = select.find('option:disabled').eq(0).text();
5144
+ }
5145
+
5146
+ select.siblings('input.select-dropdown').val(value);
5147
+ }
5148
+ };
5149
+ })(jQuery);
5150
+ ;(function ($) {
5151
+
5152
+ var methods = {
5153
+
5154
+ init: function (options) {
5155
+ var defaults = {
5156
+ indicators: true,
5157
+ height: 400,
5158
+ transition: 500,
5159
+ interval: 6000
5160
+ };
5161
+ options = $.extend(defaults, options);
5162
+
5163
+ return this.each(function () {
5164
+
5165
+ // For each slider, we want to keep track of
5166
+ // which slide is active and its associated content
5167
+ var $this = $(this);
5168
+ var $slider = $this.find('ul.slides').first();
5169
+ var $slides = $slider.find('> li');
5170
+ var $active_index = $slider.find('.active').index();
5171
+ var $active, $indicators, $interval;
5172
+ if ($active_index != -1) {
5173
+ $active = $slides.eq($active_index);
5174
+ }
5175
+
5176
+ // Transitions the caption depending on alignment
5177
+ function captionTransition(caption, duration) {
5178
+ if (caption.hasClass("center-align")) {
5179
+ caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });
5180
+ } else if (caption.hasClass("right-align")) {
5181
+ caption.velocity({ opacity: 0, translateX: 100 }, { duration: duration, queue: false });
5182
+ } else if (caption.hasClass("left-align")) {
5183
+ caption.velocity({ opacity: 0, translateX: -100 }, { duration: duration, queue: false });
5184
+ }
5185
+ }
5186
+
5187
+ // This function will transition the slide to any index of the next slide
5188
+ function moveToSlide(index) {
5189
+ // Wrap around indices.
5190
+ if (index >= $slides.length) index = 0;else if (index < 0) index = $slides.length - 1;
5191
+
5192
+ $active_index = $slider.find('.active').index();
5193
+
5194
+ // Only do if index changes
5195
+ if ($active_index != index) {
5196
+ $active = $slides.eq($active_index);
5197
+ $caption = $active.find('.caption');
5198
+
5199
+ $active.removeClass('active');
5200
+ $active.velocity({ opacity: 0 }, { duration: options.transition, queue: false, easing: 'easeOutQuad',
5201
+ complete: function () {
5202
+ $slides.not('.active').velocity({ opacity: 0, translateX: 0, translateY: 0 }, { duration: 0, queue: false });
5203
+ } });
5204
+ captionTransition($caption, options.transition);
5205
+
5206
+ // Update indicators
5207
+ if (options.indicators) {
5208
+ $indicators.eq($active_index).removeClass('active');
5209
+ }
5210
+
5211
+ $slides.eq(index).velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
5212
+ $slides.eq(index).find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad' });
5213
+ $slides.eq(index).addClass('active');
5214
+
5215
+ // Update indicators
5216
+ if (options.indicators) {
5217
+ $indicators.eq(index).addClass('active');
5218
+ }
5219
+ }
5220
+ }
5221
+
5222
+ // Set height of slider
5223
+ // If fullscreen, do nothing
5224
+ if (!$this.hasClass('fullscreen')) {
5225
+ if (options.indicators) {
5226
+ // Add height if indicators are present
5227
+ $this.height(options.height + 40);
5228
+ } else {
5229
+ $this.height(options.height);
5230
+ }
5231
+ $slider.height(options.height);
5232
+ }
5233
+
5234
+ // Set initial positions of captions
5235
+ $slides.find('.caption').each(function () {
5236
+ captionTransition($(this), 0);
5237
+ });
5238
+
5239
+ // Move img src into background-image
5240
+ $slides.find('img').each(function () {
5241
+ var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
5242
+ if ($(this).attr('src') !== placeholderBase64) {
5243
+ $(this).css('background-image', 'url("' + $(this).attr('src') + '")');
5244
+ $(this).attr('src', placeholderBase64);
5245
+ }
5246
+ });
5247
+
5248
+ // dynamically add indicators
5249
+ if (options.indicators) {
5250
+ $indicators = $('<ul class="indicators"></ul>');
5251
+ $slides.each(function (index) {
5252
+ var $indicator = $('<li class="indicator-item"></li>');
5253
+
5254
+ // Handle clicks on indicators
5255
+ $indicator.click(function () {
5256
+ var $parent = $slider.parent();
5257
+ var curr_index = $parent.find($(this)).index();
5258
+ moveToSlide(curr_index);
5259
+
5260
+ // reset interval
5261
+ clearInterval($interval);
5262
+ $interval = setInterval(function () {
5263
+ $active_index = $slider.find('.active').index();
5264
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
5265
+ else $active_index += 1;
5266
+
5267
+ moveToSlide($active_index);
5268
+ }, options.transition + options.interval);
5269
+ });
5270
+ $indicators.append($indicator);
5271
+ });
5272
+ $this.append($indicators);
5273
+ $indicators = $this.find('ul.indicators').find('li.indicator-item');
5274
+ }
5275
+
5276
+ if ($active) {
5277
+ $active.show();
5278
+ } else {
5279
+ $slides.first().addClass('active').velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
5280
+
5281
+ $active_index = 0;
5282
+ $active = $slides.eq($active_index);
5283
+
5284
+ // Update indicators
5285
+ if (options.indicators) {
5286
+ $indicators.eq($active_index).addClass('active');
5287
+ }
5288
+ }
5289
+
5290
+ // Adjust height to current slide
5291
+ $active.find('img').each(function () {
5292
+ $active.find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
5293
+ });
5294
+
5295
+ // auto scroll
5296
+ $interval = setInterval(function () {
5297
+ $active_index = $slider.find('.active').index();
5298
+ moveToSlide($active_index + 1);
5299
+ }, options.transition + options.interval);
5300
+
5301
+ // HammerJS, Swipe navigation
5302
+
5303
+ // Touch Event
5304
+ var panning = false;
5305
+ var swipeLeft = false;
5306
+ var swipeRight = false;
5307
+
5308
+ $this.hammer({
5309
+ prevent_default: false
5310
+ }).on('pan', function (e) {
5311
+ if (e.gesture.pointerType === "touch") {
5312
+
5313
+ // reset interval
5314
+ clearInterval($interval);
5315
+
5316
+ var direction = e.gesture.direction;
5317
+ var x = e.gesture.deltaX;
5318
+ var velocityX = e.gesture.velocityX;
5319
+ var velocityY = e.gesture.velocityY;
5320
+
5321
+ $curr_slide = $slider.find('.active');
5322
+ if (Math.abs(velocityX) > Math.abs(velocityY)) {
5323
+ $curr_slide.velocity({ translateX: x
5324
+ }, { duration: 50, queue: false, easing: 'easeOutQuad' });
5325
+ }
5326
+
5327
+ // Swipe Left
5328
+ if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.65)) {
5329
+ swipeRight = true;
5330
+ }
5331
+ // Swipe Right
5332
+ else if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.65)) {
5333
+ swipeLeft = true;
5334
+ }
5335
+
5336
+ // Make Slide Behind active slide visible
5337
+ var next_slide;
5338
+ if (swipeLeft) {
5339
+ next_slide = $curr_slide.next();
5340
+ if (next_slide.length === 0) {
5341
+ next_slide = $slides.first();
5342
+ }
5343
+ next_slide.velocity({ opacity: 1
5344
+ }, { duration: 300, queue: false, easing: 'easeOutQuad' });
5345
+ }
5346
+ if (swipeRight) {
5347
+ next_slide = $curr_slide.prev();
5348
+ if (next_slide.length === 0) {
5349
+ next_slide = $slides.last();
5350
+ }
5351
+ next_slide.velocity({ opacity: 1
5352
+ }, { duration: 300, queue: false, easing: 'easeOutQuad' });
5353
+ }
5354
+ }
5355
+ }).on('panend', function (e) {
5356
+ if (e.gesture.pointerType === "touch") {
5357
+
5358
+ $curr_slide = $slider.find('.active');
5359
+ panning = false;
5360
+ curr_index = $slider.find('.active').index();
5361
+
5362
+ if (!swipeRight && !swipeLeft || $slides.length <= 1) {
5363
+ // Return to original spot
5364
+ $curr_slide.velocity({ translateX: 0
5365
+ }, { duration: 300, queue: false, easing: 'easeOutQuad' });
5366
+ } else if (swipeLeft) {
5367
+ moveToSlide(curr_index + 1);
5368
+ $curr_slide.velocity({ translateX: -1 * $this.innerWidth() }, { duration: 300, queue: false, easing: 'easeOutQuad',
5369
+ complete: function () {
5370
+ $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
5371
+ } });
5372
+ } else if (swipeRight) {
5373
+ moveToSlide(curr_index - 1);
5374
+ $curr_slide.velocity({ translateX: $this.innerWidth() }, { duration: 300, queue: false, easing: 'easeOutQuad',
5375
+ complete: function () {
5376
+ $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
5377
+ } });
5378
+ }
5379
+ swipeLeft = false;
5380
+ swipeRight = false;
5381
+
5382
+ // Restart interval
5383
+ clearInterval($interval);
5384
+ $interval = setInterval(function () {
5385
+ $active_index = $slider.find('.active').index();
5386
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
5387
+ else $active_index += 1;
5388
+
5389
+ moveToSlide($active_index);
5390
+ }, options.transition + options.interval);
5391
+ }
5392
+ });
5393
+
5394
+ $this.on('sliderPause', function () {
5395
+ clearInterval($interval);
5396
+ });
5397
+
5398
+ $this.on('sliderStart', function () {
5399
+ clearInterval($interval);
5400
+ $interval = setInterval(function () {
5401
+ $active_index = $slider.find('.active').index();
5402
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
5403
+ else $active_index += 1;
5404
+
5405
+ moveToSlide($active_index);
5406
+ }, options.transition + options.interval);
5407
+ });
5408
+
5409
+ $this.on('sliderNext', function () {
5410
+ $active_index = $slider.find('.active').index();
5411
+ moveToSlide($active_index + 1);
5412
+ });
5413
+
5414
+ $this.on('sliderPrev', function () {
5415
+ $active_index = $slider.find('.active').index();
5416
+ moveToSlide($active_index - 1);
5417
+ });
5418
+ });
5419
+ },
5420
+ pause: function () {
5421
+ $(this).trigger('sliderPause');
5422
+ },
5423
+ start: function () {
5424
+ $(this).trigger('sliderStart');
5425
+ },
5426
+ next: function () {
5427
+ $(this).trigger('sliderNext');
5428
+ },
5429
+ prev: function () {
5430
+ $(this).trigger('sliderPrev');
5431
+ }
5432
+ };
5433
+
5434
+ $.fn.sliderZ = function (methodOrOptions) {
5435
+ if (methods[methodOrOptions]) {
5436
+ return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
5437
+ } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
5438
+ // Default to "init"
5439
+ return methods.init.apply(this, arguments);
5440
+ } else {
5441
+ $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tooltip');
5442
+ }
5443
+ }; // Plugin end
5444
+ })(jQuery);
5445
+ ;(function ($) {
5446
+ $(document).ready(function () {
5447
+
5448
+ $(document).on('click.card', '.card', function (e) {
5449
+ if ($(this).find('> .card-reveal').length) {
5450
+ var $card = $(e.target).closest('.card');
5451
+ if ($card.data('initialOverflow') === undefined) {
5452
+ $card.data('initialOverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow'));
5453
+ }
5454
+ if ($(e.target).is($('.card-reveal .card-title')) || $(e.target).is($('.card-reveal .card-title i'))) {
5455
+ // Make Reveal animate down and display none
5456
+ $(this).find('.card-reveal').velocity({ translateY: 0 }, {
5457
+ duration: 225,
5458
+ queue: false,
5459
+ easing: 'easeInOutQuad',
5460
+ complete: function () {
5461
+ $(this).css({ display: 'none' });
5462
+ $card.css('overflow', $card.data('initialOverflow'));
5463
+ }
5464
+ });
5465
+ } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) {
5466
+ $card.css('overflow', 'hidden');
5467
+ $(this).find('.card-reveal').css({ display: 'block' }).velocity("stop", false).velocity({ translateY: '-100%' }, { duration: 300, queue: false, easing: 'easeInOutQuad' });
5468
+ }
5469
+ }
5470
+ });
5471
+ });
5472
+ })(jQuery);
5473
+ ;(function ($) {
5474
+ var materialChipsDefaults = {
5475
+ data: [],
5476
+ placeholder: '',
5477
+ secondaryPlaceholder: '',
5478
+ autocompleteOptions: {}
5479
+ };
5480
+
5481
+ $(document).ready(function () {
5482
+ // Handle removal of static chips.
5483
+ $(document).on('click', '.chip .close', function (e) {
5484
+ var $chips = $(this).closest('.chips');
5485
+ if ($chips.attr('data-initialized')) {
5486
+ return;
5487
+ }
5488
+ $(this).closest('.chip').remove();
5489
+ });
5490
+ });
5491
+
5492
+ $.fn.material_chip = function (options) {
5493
+ var self = this;
5494
+ this.$el = $(this);
5495
+ this.$document = $(document);
5496
+ this.SELS = {
5497
+ CHIPS: '.chips',
5498
+ CHIP: '.chip',
5499
+ INPUT: 'input',
5500
+ DELETE: '.material-icons',
5501
+ SELECTED_CHIP: '.selected'
5502
+ };
5503
+
5504
+ if ('data' === options) {
5505
+ return this.$el.data('chips');
5506
+ }
5507
+
5508
+ var curr_options = $.extend({}, materialChipsDefaults, options);
5509
+ self.hasAutocomplete = !$.isEmptyObject(curr_options.autocompleteOptions.data);
5510
+
5511
+ // Initialize
5512
+ this.init = function () {
5513
+ var i = 0;
5514
+ var chips;
5515
+ self.$el.each(function () {
5516
+ var $chips = $(this);
5517
+ var chipId = Materialize.guid();
5518
+ self.chipId = chipId;
5519
+
5520
+ if (!curr_options.data || !(curr_options.data instanceof Array)) {
5521
+ curr_options.data = [];
5522
+ }
5523
+ $chips.data('chips', curr_options.data);
5524
+ $chips.attr('data-index', i);
5525
+ $chips.attr('data-initialized', true);
5526
+
5527
+ if (!$chips.hasClass(self.SELS.CHIPS)) {
5528
+ $chips.addClass('chips');
5529
+ }
5530
+
5531
+ self.chips($chips, chipId);
5532
+ i++;
5533
+ });
5534
+ };
5535
+
5536
+ this.handleEvents = function () {
5537
+ var SELS = self.SELS;
5538
+
5539
+ self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function (e) {
5540
+ $(e.target).find(SELS.INPUT).focus();
5541
+ });
5542
+
5543
+ self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function (e) {
5544
+ var $chip = $(e.target);
5545
+ if ($chip.length) {
5546
+ var wasSelected = $chip.hasClass('selected');
5547
+ var $chips = $chip.closest(SELS.CHIPS);
5548
+ $(SELS.CHIP).removeClass('selected');
5549
+
5550
+ if (!wasSelected) {
5551
+ self.selectChip($chip.index(), $chips);
5552
+ }
5553
+ }
5554
+ });
5555
+
5556
+ self.$document.off('keydown.chips').on('keydown.chips', function (e) {
5557
+ if ($(e.target).is('input, textarea')) {
5558
+ return;
5559
+ }
5560
+
5561
+ // delete
5562
+ var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
5563
+ var $chips = $chip.closest(SELS.CHIPS);
5564
+ var length = $chip.siblings(SELS.CHIP).length;
5565
+ var index;
5566
+
5567
+ if (!$chip.length) {
5568
+ return;
5569
+ }
5570
+
5571
+ if (e.which === 8 || e.which === 46) {
5572
+ e.preventDefault();
5573
+
5574
+ index = $chip.index();
5575
+ self.deleteChip(index, $chips);
5576
+
5577
+ var selectIndex = null;
5578
+ if (index + 1 < length) {
5579
+ selectIndex = index;
5580
+ } else if (index === length || index + 1 === length) {
5581
+ selectIndex = length - 1;
5582
+ }
5583
+
5584
+ if (selectIndex < 0) selectIndex = null;
5585
+
5586
+ if (null !== selectIndex) {
5587
+ self.selectChip(selectIndex, $chips);
5588
+ }
5589
+ if (!length) $chips.find('input').focus();
5590
+
5591
+ // left
5592
+ } else if (e.which === 37) {
5593
+ index = $chip.index() - 1;
5594
+ if (index < 0) {
5595
+ return;
5596
+ }
5597
+ $(SELS.CHIP).removeClass('selected');
5598
+ self.selectChip(index, $chips);
5599
+
5600
+ // right
5601
+ } else if (e.which === 39) {
5602
+ index = $chip.index() + 1;
5603
+ $(SELS.CHIP).removeClass('selected');
5604
+ if (index > length) {
5605
+ $chips.find('input').focus();
5606
+ return;
5607
+ }
5608
+ self.selectChip(index, $chips);
5609
+ }
5610
+ });
5611
+
5612
+ self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
5613
+ var $currChips = $(e.target).closest(SELS.CHIPS);
5614
+ $currChips.addClass('focus');
5615
+ $currChips.siblings('label, .prefix').addClass('active');
5616
+ $(SELS.CHIP).removeClass('selected');
5617
+ });
5618
+
5619
+ self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
5620
+ var $currChips = $(e.target).closest(SELS.CHIPS);
5621
+ $currChips.removeClass('focus');
5622
+
5623
+ // Remove active if empty
5624
+ if ($currChips.data('chips') === undefined || !$currChips.data('chips').length) {
5625
+ $currChips.siblings('label').removeClass('active');
5626
+ }
5627
+ $currChips.siblings('.prefix').removeClass('active');
5628
+ });
5629
+
5630
+ self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
5631
+ var $target = $(e.target);
5632
+ var $chips = $target.closest(SELS.CHIPS);
5633
+ var chipsLength = $chips.children(SELS.CHIP).length;
5634
+
5635
+ // enter
5636
+ if (13 === e.which) {
5637
+ // Override enter if autocompleting.
5638
+ if (self.hasAutocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) {
5639
+ return;
5640
+ }
5641
+
5642
+ e.preventDefault();
5643
+ self.addChip({ tag: $target.val() }, $chips);
5644
+ $target.val('');
5645
+ return;
5646
+ }
5647
+
5648
+ // delete or left
5649
+ if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
5650
+ e.preventDefault();
5651
+ self.selectChip(chipsLength - 1, $chips);
5652
+ $target.blur();
5653
+ return;
5654
+ }
5655
+ });
5656
+
5657
+ // Click on delete icon in chip.
5658
+ self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function (e) {
5659
+ var $target = $(e.target);
5660
+ var $chips = $target.closest(SELS.CHIPS);
5661
+ var $chip = $target.closest(SELS.CHIP);
5662
+ e.stopPropagation();
5663
+ self.deleteChip($chip.index(), $chips);
5664
+ $chips.find('input').focus();
5665
+ });
5666
+ };
5667
+
5668
+ this.chips = function ($chips, chipId) {
5669
+ $chips.empty();
5670
+ $chips.data('chips').forEach(function (elem) {
5671
+ $chips.append(self.renderChip(elem));
5672
+ });
5673
+ $chips.append($('<input id="' + chipId + '" class="input" placeholder="">'));
5674
+ self.setPlaceholder($chips);
5675
+
5676
+ // Set for attribute for label
5677
+ var label = $chips.next('label');
5678
+ if (label.length) {
5679
+ label.attr('for', chipId);
5680
+
5681
+ if ($chips.data('chips') !== undefined && $chips.data('chips').length) {
5682
+ label.addClass('active');
5683
+ }
5684
+ }
5685
+
5686
+ // Setup autocomplete if needed.
5687
+ var input = $('#' + chipId);
5688
+ if (self.hasAutocomplete) {
5689
+ curr_options.autocompleteOptions.onAutocomplete = function (val) {
5690
+ self.addChip({ tag: val }, $chips);
5691
+ input.val('');
5692
+ input.focus();
5693
+ };
5694
+ input.autocomplete(curr_options.autocompleteOptions);
5695
+ }
5696
+ };
5697
+
5698
+ /**
5699
+ * Render chip jQuery element.
5700
+ * @param {Object} elem
5701
+ * @return {jQuery}
5702
+ */
5703
+ this.renderChip = function (elem) {
5704
+ if (!elem.tag) return;
5705
+
5706
+ var $renderedChip = $('<div class="chip"></div>');
5707
+ $renderedChip.text(elem.tag);
5708
+ if (elem.image) {
5709
+ $renderedChip.prepend($('<img />').attr('src', elem.image));
5710
+ }
5711
+ $renderedChip.append($('<i class="material-icons close">close</i>'));
5712
+ return $renderedChip;
5713
+ };
5714
+
5715
+ this.setPlaceholder = function ($chips) {
5716
+ if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) {
5717
+ $chips.find('input').prop('placeholder', curr_options.placeholder);
5718
+ } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
5719
+ $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
5720
+ }
5721
+ };
5722
+
5723
+ this.isValid = function ($chips, elem) {
5724
+ var chips = $chips.data('chips');
5725
+ var exists = false;
5726
+ for (var i = 0; i < chips.length; i++) {
5727
+ if (chips[i].tag === elem.tag) {
5728
+ exists = true;
5729
+ return;
5730
+ }
5731
+ }
5732
+ return '' !== elem.tag && !exists;
5733
+ };
5734
+
5735
+ this.addChip = function (elem, $chips) {
5736
+ if (!self.isValid($chips, elem)) {
5737
+ return;
5738
+ }
5739
+ var $renderedChip = self.renderChip(elem);
5740
+ var newData = [];
5741
+ var oldData = $chips.data('chips');
5742
+ for (var i = 0; i < oldData.length; i++) {
5743
+ newData.push(oldData[i]);
5744
+ }
5745
+ newData.push(elem);
5746
+
5747
+ $chips.data('chips', newData);
5748
+ $renderedChip.insertBefore($chips.find('input'));
5749
+ $chips.trigger('chip.add', elem);
5750
+ self.setPlaceholder($chips);
5751
+ };
5752
+
5753
+ this.deleteChip = function (chipIndex, $chips) {
5754
+ var chip = $chips.data('chips')[chipIndex];
5755
+ $chips.find('.chip').eq(chipIndex).remove();
5756
+
5757
+ var newData = [];
5758
+ var oldData = $chips.data('chips');
5759
+ for (var i = 0; i < oldData.length; i++) {
5760
+ if (i !== chipIndex) {
5761
+ newData.push(oldData[i]);
5762
+ }
5763
+ }
5764
+
5765
+ $chips.data('chips', newData);
5766
+ $chips.trigger('chip.delete', chip);
5767
+ self.setPlaceholder($chips);
5768
+ };
5769
+
5770
+ this.selectChip = function (chipIndex, $chips) {
5771
+ var $chip = $chips.find('.chip').eq(chipIndex);
5772
+ if ($chip && false === $chip.hasClass('selected')) {
5773
+ $chip.addClass('selected');
5774
+ $chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
5775
+ }
5776
+ };
5777
+
5778
+ this.getChipsElement = function (index, $chips) {
5779
+ return $chips.eq(index);
5780
+ };
5781
+
5782
+ // init
5783
+ this.init();
5784
+
5785
+ this.handleEvents();
5786
+ };
5787
+ })(jQuery);
5788
+ ;(function ($) {
5789
+ $.fn.pushpin = function (options) {
5790
+ // Defaults
5791
+ var defaults = {
5792
+ top: 0,
5793
+ bottom: Infinity,
5794
+ offset: 0
5795
+ };
5796
+
5797
+ // Remove pushpin event and classes
5798
+ if (options === "remove") {
5799
+ this.each(function () {
5800
+ if (id = $(this).data('pushpin-id')) {
5801
+ $(window).off('scroll.' + id);
5802
+ $(this).removeData('pushpin-id').removeClass('pin-top pinned pin-bottom').removeAttr('style');
5803
+ }
5804
+ });
5805
+ return false;
5806
+ }
5807
+
5808
+ options = $.extend(defaults, options);
5809
+
5810
+ $index = 0;
5811
+ return this.each(function () {
5812
+ var $uniqueId = Materialize.guid(),
5813
+ $this = $(this),
5814
+ $original_offset = $(this).offset().top;
5815
+
5816
+ function removePinClasses(object) {
5817
+ object.removeClass('pin-top');
5818
+ object.removeClass('pinned');
5819
+ object.removeClass('pin-bottom');
5820
+ }
5821
+
5822
+ function updateElements(objects, scrolled) {
5823
+ objects.each(function () {
5824
+ // Add position fixed (because its between top and bottom)
5825
+ if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasClass('pinned')) {
5826
+ removePinClasses($(this));
5827
+ $(this).css('top', options.offset);
5828
+ $(this).addClass('pinned');
5829
+ }
5830
+
5831
+ // Add pin-top (when scrolled position is above top)
5832
+ if (scrolled < options.top && !$(this).hasClass('pin-top')) {
5833
+ removePinClasses($(this));
5834
+ $(this).css('top', 0);
5835
+ $(this).addClass('pin-top');
5836
+ }
5837
+
5838
+ // Add pin-bottom (when scrolled position is below bottom)
5839
+ if (scrolled > options.bottom && !$(this).hasClass('pin-bottom')) {
5840
+ removePinClasses($(this));
5841
+ $(this).addClass('pin-bottom');
5842
+ $(this).css('top', options.bottom - $original_offset);
5843
+ }
5844
+ });
5845
+ }
5846
+
5847
+ $(this).data('pushpin-id', $uniqueId);
5848
+ updateElements($this, $(window).scrollTop());
5849
+ $(window).on('scroll.' + $uniqueId, function () {
5850
+ var $scrolled = $(window).scrollTop() + options.offset;
5851
+ updateElements($this, $scrolled);
5852
+ });
5853
+ });
5854
+ };
5855
+ })(jQuery);;(function ($) {
5856
+ $(document).ready(function () {
5857
+
5858
+ // jQuery reverse
5859
+ $.fn.reverse = [].reverse;
5860
+
5861
+ // Hover behaviour: make sure this doesn't work on .click-to-toggle FABs!
5862
+ $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
5863
+ var $this = $(this);
5864
+ openFABMenu($this);
5865
+ });
5866
+ $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
5867
+ var $this = $(this);
5868
+ closeFABMenu($this);
5869
+ });
5870
+
5871
+ // Toggle-on-click behaviour.
5872
+ $(document).on('click.fabClickToggle', '.fixed-action-btn.click-to-toggle > a', function (e) {
5873
+ var $this = $(this);
5874
+ var $menu = $this.parent();
5875
+ if ($menu.hasClass('active')) {
5876
+ closeFABMenu($menu);
5877
+ } else {
5878
+ openFABMenu($menu);
5879
+ }
5880
+ });
5881
+
5882
+ // Toolbar transition behaviour.
5883
+ $(document).on('click.fabToolbar', '.fixed-action-btn.toolbar > a', function (e) {
5884
+ var $this = $(this);
5885
+ var $menu = $this.parent();
5886
+ FABtoToolbar($menu);
5887
+ });
5888
+ });
5889
+
5890
+ $.fn.extend({
5891
+ openFAB: function () {
5892
+ openFABMenu($(this));
5893
+ },
5894
+ closeFAB: function () {
5895
+ closeFABMenu($(this));
5896
+ },
5897
+ openToolbar: function () {
5898
+ FABtoToolbar($(this));
5899
+ },
5900
+ closeToolbar: function () {
5901
+ toolbarToFAB($(this));
5902
+ }
5903
+ });
5904
+
5905
+ var openFABMenu = function (btn) {
5906
+ var $this = btn;
5907
+ if ($this.hasClass('active') === false) {
5908
+
5909
+ // Get direction option
5910
+ var horizontal = $this.hasClass('horizontal');
5911
+ var offsetY, offsetX;
5912
+
5913
+ if (horizontal === true) {
5914
+ offsetX = 40;
5915
+ } else {
5916
+ offsetY = 40;
5917
+ }
5918
+
5919
+ $this.addClass('active');
5920
+ $this.find('ul .btn-floating').velocity({ scaleY: ".4", scaleX: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 0 });
5921
+
5922
+ var time = 0;
5923
+ $this.find('ul .btn-floating').reverse().each(function () {
5924
+ $(this).velocity({ opacity: "1", scaleX: "1", scaleY: "1", translateY: "0", translateX: '0' }, { duration: 80, delay: time });
5925
+ time += 40;
5926
+ });
5927
+ }
5928
+ };
5929
+
5930
+ var closeFABMenu = function (btn) {
5931
+ var $this = btn;
5932
+ // Get direction option
5933
+ var horizontal = $this.hasClass('horizontal');
5934
+ var offsetY, offsetX;
5935
+
5936
+ if (horizontal === true) {
5937
+ offsetX = 40;
5938
+ } else {
5939
+ offsetY = 40;
5940
+ }
5941
+
5942
+ $this.removeClass('active');
5943
+ var time = 0;
5944
+ $this.find('ul .btn-floating').velocity("stop", true);
5945
+ $this.find('ul .btn-floating').velocity({ opacity: "0", scaleX: ".4", scaleY: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 80 });
5946
+ };
5947
+
5948
+ /**
5949
+ * Transform FAB into toolbar
5950
+ * @param {Object} object jQuery object
5951
+ */
5952
+ var FABtoToolbar = function (btn) {
5953
+ if (btn.attr('data-open') === "true") {
5954
+ return;
5955
+ }
5956
+
5957
+ var offsetX, offsetY, scaleFactor;
5958
+ var windowWidth = window.innerWidth;
5959
+ var windowHeight = window.innerHeight;
5960
+ var btnRect = btn[0].getBoundingClientRect();
5961
+ var anchor = btn.find('> a').first();
5962
+ var menu = btn.find('> ul').first();
5963
+ var backdrop = $('<div class="fab-backdrop"></div>');
5964
+ var fabColor = anchor.css('background-color');
5965
+ anchor.append(backdrop);
5966
+
5967
+ offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
5968
+ offsetY = windowHeight - btnRect.bottom;
5969
+ scaleFactor = windowWidth / backdrop.width();
5970
+ btn.attr('data-origin-bottom', btnRect.bottom);
5971
+ btn.attr('data-origin-left', btnRect.left);
5972
+ btn.attr('data-origin-width', btnRect.width);
5973
+
5974
+ // Set initial state
5975
+ btn.addClass('active');
5976
+ btn.attr('data-open', true);
5977
+ btn.css({
5978
+ 'text-align': 'center',
5979
+ width: '100%',
5980
+ bottom: 0,
5981
+ left: 0,
5982
+ transform: 'translateX(' + offsetX + 'px)',
5983
+ transition: 'none'
5984
+ });
5985
+ anchor.css({
5986
+ transform: 'translateY(' + -offsetY + 'px)',
5987
+ transition: 'none'
5988
+ });
5989
+ backdrop.css({
5990
+ 'background-color': fabColor
5991
+ });
5992
+
5993
+ setTimeout(function () {
5994
+ btn.css({
5995
+ transform: '',
5996
+ transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
5997
+ });
5998
+ anchor.css({
5999
+ overflow: 'visible',
6000
+ transform: '',
6001
+ transition: 'transform .2s'
6002
+ });
6003
+
6004
+ setTimeout(function () {
6005
+ btn.css({
6006
+ overflow: 'hidden',
6007
+ 'background-color': fabColor
6008
+ });
6009
+ backdrop.css({
6010
+ transform: 'scale(' + scaleFactor + ')',
6011
+ transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
6012
+ });
6013
+ menu.find('> li > a').css({
6014
+ opacity: 1
6015
+ });
6016
+
6017
+ // Scroll to close.
6018
+ $(window).on('scroll.fabToolbarClose', function () {
6019
+ toolbarToFAB(btn);
6020
+ $(window).off('scroll.fabToolbarClose');
6021
+ $(document).off('click.fabToolbarClose');
6022
+ });
6023
+
6024
+ $(document).on('click.fabToolbarClose', function (e) {
6025
+ if (!$(e.target).closest(menu).length) {
6026
+ toolbarToFAB(btn);
6027
+ $(window).off('scroll.fabToolbarClose');
6028
+ $(document).off('click.fabToolbarClose');
6029
+ }
6030
+ });
6031
+ }, 100);
6032
+ }, 0);
6033
+ };
6034
+
6035
+ /**
6036
+ * Transform toolbar back into FAB
6037
+ * @param {Object} object jQuery object
6038
+ */
6039
+ var toolbarToFAB = function (btn) {
6040
+ if (btn.attr('data-open') !== "true") {
6041
+ return;
6042
+ }
6043
+
6044
+ var offsetX, offsetY, scaleFactor;
6045
+ var windowWidth = window.innerWidth;
6046
+ var windowHeight = window.innerHeight;
6047
+ var btnWidth = btn.attr('data-origin-width');
6048
+ var btnBottom = btn.attr('data-origin-bottom');
6049
+ var btnLeft = btn.attr('data-origin-left');
6050
+ var anchor = btn.find('> .btn-floating').first();
6051
+ var menu = btn.find('> ul').first();
6052
+ var backdrop = btn.find('.fab-backdrop');
6053
+ var fabColor = anchor.css('background-color');
6054
+
6055
+ offsetX = btnLeft - windowWidth / 2 + btnWidth / 2;
6056
+ offsetY = windowHeight - btnBottom;
6057
+ scaleFactor = windowWidth / backdrop.width();
6058
+
6059
+ // Hide backdrop
6060
+ btn.removeClass('active');
6061
+ btn.attr('data-open', false);
6062
+ btn.css({
6063
+ 'background-color': 'transparent',
6064
+ transition: 'none'
6065
+ });
6066
+ anchor.css({
6067
+ transition: 'none'
6068
+ });
6069
+ backdrop.css({
6070
+ transform: 'scale(0)',
6071
+ 'background-color': fabColor
6072
+ });
6073
+ menu.find('> li > a').css({
6074
+ opacity: ''
6075
+ });
6076
+
6077
+ setTimeout(function () {
6078
+ backdrop.remove();
6079
+
6080
+ // Set initial state.
6081
+ btn.css({
6082
+ 'text-align': '',
6083
+ width: '',
6084
+ bottom: '',
6085
+ left: '',
6086
+ overflow: '',
6087
+ 'background-color': '',
6088
+ transform: 'translate3d(' + -offsetX + 'px,0,0)'
6089
+ });
6090
+ anchor.css({
6091
+ overflow: '',
6092
+ transform: 'translate3d(0,' + offsetY + 'px,0)'
6093
+ });
6094
+
6095
+ setTimeout(function () {
6096
+ btn.css({
6097
+ transform: 'translate3d(0,0,0)',
6098
+ transition: 'transform .2s'
6099
+ });
6100
+ anchor.css({
6101
+ transform: 'translate3d(0,0,0)',
6102
+ transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
6103
+ });
6104
+ }, 20);
6105
+ }, 200);
6106
+ };
6107
+ })(jQuery);
6108
+ ;(function ($) {
6109
+ // Image transition function
6110
+ Materialize.fadeInImage = function (selectorOrEl) {
6111
+ var element;
6112
+ if (typeof selectorOrEl === 'string') {
6113
+ element = $(selectorOrEl);
6114
+ } else if (typeof selectorOrEl === 'object') {
6115
+ element = selectorOrEl;
6116
+ } else {
6117
+ return;
6118
+ }
6119
+ element.css({ opacity: 0 });
6120
+ $(element).velocity({ opacity: 1 }, {
6121
+ duration: 650,
6122
+ queue: false,
6123
+ easing: 'easeOutSine'
6124
+ });
6125
+ $(element).velocity({ opacity: 1 }, {
6126
+ duration: 1300,
6127
+ queue: false,
6128
+ easing: 'swing',
6129
+ step: function (now, fx) {
6130
+ fx.start = 100;
6131
+ var grayscale_setting = now / 100;
6132
+ var brightness_setting = 150 - (100 - now) / 1.75;
6133
+
6134
+ if (brightness_setting < 100) {
6135
+ brightness_setting = 100;
6136
+ }
6137
+ if (now >= 0) {
6138
+ $(this).css({
6139
+ "-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)",
6140
+ "filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)"
6141
+ });
6142
+ }
6143
+ }
6144
+ });
6145
+ };
6146
+
6147
+ // Horizontal staggered list
6148
+ Materialize.showStaggeredList = function (selectorOrEl) {
6149
+ var element;
6150
+ if (typeof selectorOrEl === 'string') {
6151
+ element = $(selectorOrEl);
6152
+ } else if (typeof selectorOrEl === 'object') {
6153
+ element = selectorOrEl;
6154
+ } else {
6155
+ return;
6156
+ }
6157
+ var time = 0;
6158
+ element.find('li').velocity({ translateX: "-100px" }, { duration: 0 });
6159
+
6160
+ element.find('li').each(function () {
6161
+ $(this).velocity({ opacity: "1", translateX: "0" }, { duration: 800, delay: time, easing: [60, 10] });
6162
+ time += 120;
6163
+ });
6164
+ };
6165
+
6166
+ $(document).ready(function () {
6167
+ // Hardcoded .staggered-list scrollFire
6168
+ // var staggeredListOptions = [];
6169
+ // $('ul.staggered-list').each(function (i) {
6170
+
6171
+ // var label = 'scrollFire-' + i;
6172
+ // $(this).addClass(label);
6173
+ // staggeredListOptions.push(
6174
+ // {selector: 'ul.staggered-list.' + label,
6175
+ // offset: 200,
6176
+ // callback: 'showStaggeredList("ul.staggered-list.' + label + '")'});
6177
+ // });
6178
+ // scrollFire(staggeredListOptions);
6179
+
6180
+ // HammerJS, Swipe navigation
6181
+
6182
+ // Touch Event
6183
+ var swipeLeft = false;
6184
+ var swipeRight = false;
6185
+
6186
+ // Dismissible Collections
6187
+ $('.dismissable').each(function () {
6188
+ $(this).hammer({
6189
+ prevent_default: false
6190
+ }).on('pan', function (e) {
6191
+ if (e.gesture.pointerType === "touch") {
6192
+ var $this = $(this);
6193
+ var direction = e.gesture.direction;
6194
+ var x = e.gesture.deltaX;
6195
+ var velocityX = e.gesture.velocityX;
6196
+
6197
+ $this.velocity({ translateX: x
6198
+ }, { duration: 50, queue: false, easing: 'easeOutQuad' });
6199
+
6200
+ // Swipe Left
6201
+ if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.75)) {
6202
+ swipeLeft = true;
6203
+ }
6204
+
6205
+ // Swipe Right
6206
+ if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.75)) {
6207
+ swipeRight = true;
6208
+ }
6209
+ }
6210
+ }).on('panend', function (e) {
6211
+ // Reset if collection is moved back into original position
6212
+ if (Math.abs(e.gesture.deltaX) < $(this).innerWidth() / 2) {
6213
+ swipeRight = false;
6214
+ swipeLeft = false;
6215
+ }
6216
+
6217
+ if (e.gesture.pointerType === "touch") {
6218
+ var $this = $(this);
6219
+ if (swipeLeft || swipeRight) {
6220
+ var fullWidth;
6221
+ if (swipeLeft) {
6222
+ fullWidth = $this.innerWidth();
6223
+ } else {
6224
+ fullWidth = -1 * $this.innerWidth();
6225
+ }
6226
+
6227
+ $this.velocity({ translateX: fullWidth
6228
+ }, { duration: 100, queue: false, easing: 'easeOutQuad', complete: function () {
6229
+ $this.css('border', 'none');
6230
+ $this.velocity({ height: 0, padding: 0
6231
+ }, { duration: 200, queue: false, easing: 'easeOutQuad', complete: function () {
6232
+ $this.remove();
6233
+ }
6234
+ });
6235
+ }
6236
+ });
6237
+ } else {
6238
+ $this.velocity({ translateX: 0
6239
+ }, { duration: 100, queue: false, easing: 'easeOutQuad' });
6240
+ }
6241
+ swipeLeft = false;
6242
+ swipeRight = false;
6243
+ }
6244
+ });
6245
+ });
6246
+
6247
+ // time = 0
6248
+ // // Vertical Staggered list
6249
+ // $('ul.staggered-list.vertical li').velocity(
6250
+ // { translateY: "100px"},
6251
+ // { duration: 0 });
6252
+
6253
+ // $('ul.staggered-list.vertical li').each(function() {
6254
+ // $(this).velocity(
6255
+ // { opacity: "1", translateY: "0"},
6256
+ // { duration: 800, delay: time, easing: [60, 25] });
6257
+ // time += 120;
6258
+ // });
6259
+
6260
+ // // Fade in and Scale
6261
+ // $('.fade-in.scale').velocity(
6262
+ // { scaleX: .4, scaleY: .4, translateX: -600},
6263
+ // { duration: 0});
6264
+ // $('.fade-in').each(function() {
6265
+ // $(this).velocity(
6266
+ // { opacity: "1", scaleX: 1, scaleY: 1, translateX: 0},
6267
+ // { duration: 800, easing: [60, 10] });
6268
+ // });
6269
+ });
6270
+ })(jQuery);
6271
+ ;(function ($) {
6272
+
6273
+ var scrollFireEventsHandled = false;
6274
+
6275
+ // Input: Array of JSON objects {selector, offset, callback}
6276
+ Materialize.scrollFire = function (options) {
6277
+ var onScroll = function () {
6278
+ var windowScroll = window.pageYOffset + window.innerHeight;
6279
+
6280
+ for (var i = 0; i < options.length; i++) {
6281
+ // Get options from each line
6282
+ var value = options[i];
6283
+ var selector = value.selector,
6284
+ offset = value.offset,
6285
+ callback = value.callback;
6286
+
6287
+ var currentElement = document.querySelector(selector);
6288
+ if (currentElement !== null) {
6289
+ var elementOffset = currentElement.getBoundingClientRect().top + window.pageYOffset;
6290
+
6291
+ if (windowScroll > elementOffset + offset) {
6292
+ if (value.done !== true) {
6293
+ if (typeof callback === 'function') {
6294
+ callback.call(this, currentElement);
6295
+ } else if (typeof callback === 'string') {
6296
+ var callbackFunc = new Function(callback);
6297
+ callbackFunc(currentElement);
6298
+ }
6299
+ value.done = true;
6300
+ }
6301
+ }
6302
+ }
6303
+ }
6304
+ };
6305
+
6306
+ var throttledScroll = Materialize.throttle(function () {
6307
+ onScroll();
6308
+ }, options.throttle || 100);
6309
+
6310
+ if (!scrollFireEventsHandled) {
6311
+ window.addEventListener("scroll", throttledScroll);
6312
+ window.addEventListener("resize", throttledScroll);
6313
+ scrollFireEventsHandled = true;
6314
+ }
6315
+
6316
+ // perform a scan once, after current execution context, and after dom is ready
6317
+ setTimeout(throttledScroll, 0);
6318
+ };
6319
+ })(jQuery);
6320
+ ; /*!
6321
+ * pickadate.js v3.5.0, 2014/04/13
6322
+ * By Amsul, http://amsul.ca
6323
+ * Hosted on http://amsul.github.io/pickadate.js
6324
+ * Licensed under MIT
6325
+ */
6326
+
6327
+ (function (factory) {
6328
+
6329
+ Materialize.Picker = factory(jQuery);
6330
+ })(function ($) {
6331
+
6332
+ var $window = $(window);
6333
+ var $document = $(document);
6334
+ var $html = $(document.documentElement);
6335
+
6336
+ /**
6337
+ * The picker constructor that creates a blank picker.
6338
+ */
6339
+ function PickerConstructor(ELEMENT, NAME, COMPONENT, OPTIONS) {
6340
+
6341
+ // If there’s no element, return the picker constructor.
6342
+ if (!ELEMENT) return PickerConstructor;
6343
+
6344
+ var IS_DEFAULT_THEME = false,
6345
+
6346
+
6347
+ // The state of the picker.
6348
+ STATE = {
6349
+ id: ELEMENT.id || 'P' + Math.abs(~~(Math.random() * new Date()))
6350
+ },
6351
+
6352
+
6353
+ // Merge the defaults and options passed.
6354
+ SETTINGS = COMPONENT ? $.extend(true, {}, COMPONENT.defaults, OPTIONS) : OPTIONS || {},
6355
+
6356
+
6357
+ // Merge the default classes with the settings classes.
6358
+ CLASSES = $.extend({}, PickerConstructor.klasses(), SETTINGS.klass),
6359
+
6360
+
6361
+ // The element node wrapper into a jQuery object.
6362
+ $ELEMENT = $(ELEMENT),
6363
+
6364
+
6365
+ // Pseudo picker constructor.
6366
+ PickerInstance = function () {
6367
+ return this.start();
6368
+ },
6369
+
6370
+
6371
+ // The picker prototype.
6372
+ P = PickerInstance.prototype = {
6373
+
6374
+ constructor: PickerInstance,
6375
+
6376
+ $node: $ELEMENT,
6377
+
6378
+ /**
6379
+ * Initialize everything
6380
+ */
6381
+ start: function () {
6382
+
6383
+ // If it’s already started, do nothing.
6384
+ if (STATE && STATE.start) return P;
6385
+
6386
+ // Update the picker states.
6387
+ STATE.methods = {};
6388
+ STATE.start = true;
6389
+ STATE.open = false;
6390
+ STATE.type = ELEMENT.type;
6391
+
6392
+ // Confirm focus state, convert into text input to remove UA stylings,
6393
+ // and set as readonly to prevent keyboard popup.
6394
+ ELEMENT.autofocus = ELEMENT == getActiveElement();
6395
+ ELEMENT.readOnly = !SETTINGS.editable;
6396
+ ELEMENT.id = ELEMENT.id || STATE.id;
6397
+ if (ELEMENT.type != 'text') {
6398
+ ELEMENT.type = 'text';
6399
+ }
6400
+
6401
+ // Create a new picker component with the settings.
6402
+ P.component = new COMPONENT(P, SETTINGS);
6403
+
6404
+ // Create the picker root with a holder and then prepare it.
6405
+ P.$root = $(PickerConstructor._.node('div', createWrappedComponent(), CLASSES.picker, 'id="' + ELEMENT.id + '_root" tabindex="0"'));
6406
+ prepareElementRoot();
6407
+
6408
+ // If there’s a format for the hidden input element, create the element.
6409
+ if (SETTINGS.formatSubmit) {
6410
+ prepareElementHidden();
6411
+ }
6412
+
6413
+ // Prepare the input element.
6414
+ prepareElement();
6415
+
6416
+ // Insert the root as specified in the settings.
6417
+ if (SETTINGS.container) $(SETTINGS.container).append(P.$root);else $ELEMENT.before(P.$root);
6418
+
6419
+ // Bind the default component and settings events.
6420
+ P.on({
6421
+ start: P.component.onStart,
6422
+ render: P.component.onRender,
6423
+ stop: P.component.onStop,
6424
+ open: P.component.onOpen,
6425
+ close: P.component.onClose,
6426
+ set: P.component.onSet
6427
+ }).on({
6428
+ start: SETTINGS.onStart,
6429
+ render: SETTINGS.onRender,
6430
+ stop: SETTINGS.onStop,
6431
+ open: SETTINGS.onOpen,
6432
+ close: SETTINGS.onClose,
6433
+ set: SETTINGS.onSet
6434
+ });
6435
+
6436
+ // Once we’re all set, check the theme in use.
6437
+ IS_DEFAULT_THEME = isUsingDefaultTheme(P.$root.children()[0]);
6438
+
6439
+ // If the element has autofocus, open the picker.
6440
+ if (ELEMENT.autofocus) {
6441
+ P.open();
6442
+ }
6443
+
6444
+ // Trigger queued the “start” and “render” events.
6445
+ return P.trigger('start').trigger('render');
6446
+ }, //start
6447
+
6448
+
6449
+ /**
6450
+ * Render a new picker
6451
+ */
6452
+ render: function (entireComponent) {
6453
+
6454
+ // Insert a new component holder in the root or box.
6455
+ if (entireComponent) P.$root.html(createWrappedComponent());else P.$root.find('.' + CLASSES.box).html(P.component.nodes(STATE.open));
6456
+
6457
+ // Trigger the queued “render” events.
6458
+ return P.trigger('render');
6459
+ }, //render
6460
+
6461
+
6462
+ /**
6463
+ * Destroy everything
6464
+ */
6465
+ stop: function () {
6466
+
6467
+ // If it’s already stopped, do nothing.
6468
+ if (!STATE.start) return P;
6469
+
6470
+ // Then close the picker.
6471
+ P.close();
6472
+
6473
+ // Remove the hidden field.
6474
+ if (P._hidden) {
6475
+ P._hidden.parentNode.removeChild(P._hidden);
6476
+ }
6477
+
6478
+ // Remove the root.
6479
+ P.$root.remove();
6480
+
6481
+ // Remove the input class, remove the stored data, and unbind
6482
+ // the events (after a tick for IE - see `P.close`).
6483
+ $ELEMENT.removeClass(CLASSES.input).removeData(NAME);
6484
+ setTimeout(function () {
6485
+ $ELEMENT.off('.' + STATE.id);
6486
+ }, 0);
6487
+
6488
+ // Restore the element state
6489
+ ELEMENT.type = STATE.type;
6490
+ ELEMENT.readOnly = false;
6491
+
6492
+ // Trigger the queued “stop” events.
6493
+ P.trigger('stop');
6494
+
6495
+ // Reset the picker states.
6496
+ STATE.methods = {};
6497
+ STATE.start = false;
6498
+
6499
+ return P;
6500
+ }, //stop
6501
+
6502
+
6503
+ /**
6504
+ * Open up the picker
6505
+ */
6506
+ open: function (dontGiveFocus) {
6507
+
6508
+ // If it’s already open, do nothing.
6509
+ if (STATE.open) return P;
6510
+
6511
+ // Add the “active” class.
6512
+ $ELEMENT.addClass(CLASSES.active);
6513
+ aria(ELEMENT, 'expanded', true);
6514
+
6515
+ // * A Firefox bug, when `html` has `overflow:hidden`, results in
6516
+ // killing transitions :(. So add the “opened” state on the next tick.
6517
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
6518
+ setTimeout(function () {
6519
+
6520
+ // Add the “opened” class to the picker root.
6521
+ P.$root.addClass(CLASSES.opened);
6522
+ aria(P.$root[0], 'hidden', false);
6523
+ }, 0);
6524
+
6525
+ // If we have to give focus, bind the element and doc events.
6526
+ if (dontGiveFocus !== false) {
6527
+
6528
+ // Set it as open.
6529
+ STATE.open = true;
6530
+
6531
+ // Prevent the page from scrolling.
6532
+ if (IS_DEFAULT_THEME) {
6533
+ $html.css('overflow', 'hidden').css('padding-right', '+=' + getScrollbarWidth());
6534
+ }
6535
+
6536
+ // Pass focus to the root element’s jQuery object.
6537
+ // * Workaround for iOS8 to bring the picker’s root into view.
6538
+ P.$root.eq(0).focus();
6539
+
6540
+ // Bind the document events.
6541
+ $document.on('click.' + STATE.id + ' focusin.' + STATE.id, function (event) {
6542
+
6543
+ var target = event.target;
6544
+
6545
+ // If the target of the event is not the element, close the picker picker.
6546
+ // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
6547
+ // Also, for Firefox, a click on an `option` element bubbles up directly
6548
+ // to the doc. So make sure the target wasn't the doc.
6549
+ // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
6550
+ // which causes the picker to unexpectedly close when right-clicking it. So make
6551
+ // sure the event wasn’t a right-click.
6552
+ if (target != ELEMENT && target != document && event.which != 3) {
6553
+
6554
+ // If the target was the holder that covers the screen,
6555
+ // keep the element focused to maintain tabindex.
6556
+ P.close(target === P.$root.children()[0]);
6557
+ }
6558
+ }).on('keydown.' + STATE.id, function (event) {
6559
+
6560
+ var
6561
+ // Get the keycode.
6562
+ keycode = event.keyCode,
6563
+
6564
+
6565
+ // Translate that to a selection change.
6566
+ keycodeToMove = P.component.key[keycode],
6567
+
6568
+
6569
+ // Grab the target.
6570
+ target = event.target;
6571
+
6572
+ // On escape, close the picker and give focus.
6573
+ if (keycode == 27) {
6574
+ P.close(true);
6575
+ }
6576
+
6577
+ // Check if there is a key movement or “enter” keypress on the element.
6578
+ else if (target == P.$root[0] && (keycodeToMove || keycode == 13)) {
6579
+
6580
+ // Prevent the default action to stop page movement.
6581
+ event.preventDefault();
6582
+
6583
+ // Trigger the key movement action.
6584
+ if (keycodeToMove) {
6585
+ PickerConstructor._.trigger(P.component.key.go, P, [PickerConstructor._.trigger(keycodeToMove)]);
6586
+ }
6587
+
6588
+ // On “enter”, if the highlighted item isn’t disabled, set the value and close.
6589
+ else if (!P.$root.find('.' + CLASSES.highlighted).hasClass(CLASSES.disabled)) {
6590
+ P.set('select', P.component.item.highlight);
6591
+ if (SETTINGS.closeOnSelect) {
6592
+ P.close(true);
6593
+ }
6594
+ }
6595
+ }
6596
+
6597
+ // If the target is within the root and “enter” is pressed,
6598
+ // prevent the default action and trigger a click on the target instead.
6599
+ else if ($.contains(P.$root[0], target) && keycode == 13) {
6600
+ event.preventDefault();
6601
+ target.click();
6602
+ }
6603
+ });
6604
+ }
6605
+
6606
+ // Trigger the queued “open” events.
6607
+ return P.trigger('open');
6608
+ }, //open
6609
+
6610
+
6611
+ /**
6612
+ * Close the picker
6613
+ */
6614
+ close: function (giveFocus) {
6615
+
6616
+ // If we need to give focus, do it before changing states.
6617
+ if (giveFocus) {
6618
+ // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
6619
+ // The focus is triggered *after* the close has completed - causing it
6620
+ // to open again. So unbind and rebind the event at the next tick.
6621
+ P.$root.off('focus.toOpen').eq(0).focus();
6622
+ setTimeout(function () {
6623
+ P.$root.on('focus.toOpen', handleFocusToOpenEvent);
6624
+ }, 0);
6625
+ }
6626
+
6627
+ // Remove the “active” class.
6628
+ $ELEMENT.removeClass(CLASSES.active);
6629
+ aria(ELEMENT, 'expanded', false);
6630
+
6631
+ // * A Firefox bug, when `html` has `overflow:hidden`, results in
6632
+ // killing transitions :(. So remove the “opened” state on the next tick.
6633
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
6634
+ setTimeout(function () {
6635
+
6636
+ // Remove the “opened” and “focused” class from the picker root.
6637
+ P.$root.removeClass(CLASSES.opened + ' ' + CLASSES.focused);
6638
+ aria(P.$root[0], 'hidden', true);
6639
+ }, 0);
6640
+
6641
+ // If it’s already closed, do nothing more.
6642
+ if (!STATE.open) return P;
6643
+
6644
+ // Set it as closed.
6645
+ STATE.open = false;
6646
+
6647
+ // Allow the page to scroll.
6648
+ if (IS_DEFAULT_THEME) {
6649
+ $html.css('overflow', '').css('padding-right', '-=' + getScrollbarWidth());
6650
+ }
6651
+
6652
+ // Unbind the document events.
6653
+ $document.off('.' + STATE.id);
6654
+
6655
+ // Trigger the queued “close” events.
6656
+ return P.trigger('close');
6657
+ }, //close
6658
+
6659
+
6660
+ /**
6661
+ * Clear the values
6662
+ */
6663
+ clear: function (options) {
6664
+ return P.set('clear', null, options);
6665
+ }, //clear
6666
+
6667
+
6668
+ /**
6669
+ * Set something
6670
+ */
6671
+ set: function (thing, value, options) {
6672
+
6673
+ var thingItem,
6674
+ thingValue,
6675
+ thingIsObject = $.isPlainObject(thing),
6676
+ thingObject = thingIsObject ? thing : {};
6677
+
6678
+ // Make sure we have usable options.
6679
+ options = thingIsObject && $.isPlainObject(value) ? value : options || {};
6680
+
6681
+ if (thing) {
6682
+
6683
+ // If the thing isn’t an object, make it one.
6684
+ if (!thingIsObject) {
6685
+ thingObject[thing] = value;
6686
+ }
6687
+
6688
+ // Go through the things of items to set.
6689
+ for (thingItem in thingObject) {
6690
+
6691
+ // Grab the value of the thing.
6692
+ thingValue = thingObject[thingItem];
6693
+
6694
+ // First, if the item exists and there’s a value, set it.
6695
+ if (thingItem in P.component.item) {
6696
+ if (thingValue === undefined) thingValue = null;
6697
+ P.component.set(thingItem, thingValue, options);
6698
+ }
6699
+
6700
+ // Then, check to update the element value and broadcast a change.
6701
+ if (thingItem == 'select' || thingItem == 'clear') {
6702
+ $ELEMENT.val(thingItem == 'clear' ? '' : P.get(thingItem, SETTINGS.format)).trigger('change');
6703
+ }
6704
+ }
6705
+
6706
+ // Render a new picker.
6707
+ P.render();
6708
+ }
6709
+
6710
+ // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
6711
+ return options.muted ? P : P.trigger('set', thingObject);
6712
+ }, //set
6713
+
6714
+
6715
+ /**
6716
+ * Get something
6717
+ */
6718
+ get: function (thing, format) {
6719
+
6720
+ // Make sure there’s something to get.
6721
+ thing = thing || 'value';
6722
+
6723
+ // If a picker state exists, return that.
6724
+ if (STATE[thing] != null) {
6725
+ return STATE[thing];
6726
+ }
6727
+
6728
+ // Return the submission value, if that.
6729
+ if (thing == 'valueSubmit') {
6730
+ if (P._hidden) {
6731
+ return P._hidden.value;
6732
+ }
6733
+ thing = 'value';
6734
+ }
6735
+
6736
+ // Return the value, if that.
6737
+ if (thing == 'value') {
6738
+ return ELEMENT.value;
6739
+ }
6740
+
6741
+ // Check if a component item exists, return that.
6742
+ if (thing in P.component.item) {
6743
+ if (typeof format == 'string') {
6744
+ var thingValue = P.component.get(thing);
6745
+ return thingValue ? PickerConstructor._.trigger(P.component.formats.toString, P.component, [format, thingValue]) : '';
6746
+ }
6747
+ return P.component.get(thing);
6748
+ }
6749
+ }, //get
6750
+
6751
+
6752
+ /**
6753
+ * Bind events on the things.
6754
+ */
6755
+ on: function (thing, method, internal) {
6756
+
6757
+ var thingName,
6758
+ thingMethod,
6759
+ thingIsObject = $.isPlainObject(thing),
6760
+ thingObject = thingIsObject ? thing : {};
6761
+
6762
+ if (thing) {
6763
+
6764
+ // If the thing isn’t an object, make it one.
6765
+ if (!thingIsObject) {
6766
+ thingObject[thing] = method;
6767
+ }
6768
+
6769
+ // Go through the things to bind to.
6770
+ for (thingName in thingObject) {
6771
+
6772
+ // Grab the method of the thing.
6773
+ thingMethod = thingObject[thingName];
6774
+
6775
+ // If it was an internal binding, prefix it.
6776
+ if (internal) {
6777
+ thingName = '_' + thingName;
6778
+ }
6779
+
6780
+ // Make sure the thing methods collection exists.
6781
+ STATE.methods[thingName] = STATE.methods[thingName] || [];
6782
+
6783
+ // Add the method to the relative method collection.
6784
+ STATE.methods[thingName].push(thingMethod);
6785
+ }
6786
+ }
6787
+
6788
+ return P;
6789
+ }, //on
6790
+
6791
+
6792
+ /**
6793
+ * Unbind events on the things.
6794
+ */
6795
+ off: function () {
6796
+ var i,
6797
+ thingName,
6798
+ names = arguments;
6799
+ for (i = 0, namesCount = names.length; i < namesCount; i += 1) {
6800
+ thingName = names[i];
6801
+ if (thingName in STATE.methods) {
6802
+ delete STATE.methods[thingName];
6803
+ }
6804
+ }
6805
+ return P;
6806
+ },
6807
+
6808
+ /**
6809
+ * Fire off method events.
6810
+ */
6811
+ trigger: function (name, data) {
6812
+ var _trigger = function (name) {
6813
+ var methodList = STATE.methods[name];
6814
+ if (methodList) {
6815
+ methodList.map(function (method) {
6816
+ PickerConstructor._.trigger(method, P, [data]);
6817
+ });
6818
+ }
6819
+ };
6820
+ _trigger('_' + name);
6821
+ _trigger(name);
6822
+ return P;
6823
+ } //trigger
6824
+ //PickerInstance.prototype
6825
+
6826
+
6827
+ /**
6828
+ * Wrap the picker holder components together.
6829
+ */
6830
+ };function createWrappedComponent() {
6831
+
6832
+ // Create a picker wrapper holder
6833
+ return PickerConstructor._.node('div',
6834
+
6835
+ // Create a picker wrapper node
6836
+ PickerConstructor._.node('div',
6837
+
6838
+ // Create a picker frame
6839
+ PickerConstructor._.node('div',
6840
+
6841
+ // Create a picker box node
6842
+ PickerConstructor._.node('div',
6843
+
6844
+ // Create the components nodes.
6845
+ P.component.nodes(STATE.open),
6846
+
6847
+ // The picker box class
6848
+ CLASSES.box),
6849
+
6850
+ // Picker wrap class
6851
+ CLASSES.wrap),
6852
+
6853
+ // Picker frame class
6854
+ CLASSES.frame),
6855
+
6856
+ // Picker holder class
6857
+ CLASSES.holder); //endreturn
6858
+ } //createWrappedComponent
6859
+
6860
+
6861
+ /**
6862
+ * Prepare the input element with all bindings.
6863
+ */
6864
+ function prepareElement() {
6865
+
6866
+ $ELEMENT.
6867
+
6868
+ // Store the picker data by component name.
6869
+ data(NAME, P).
6870
+
6871
+ // Add the “input” class name.
6872
+ addClass(CLASSES.input).
6873
+
6874
+ // Remove the tabindex.
6875
+ attr('tabindex', -1).
6876
+
6877
+ // If there’s a `data-value`, update the value of the element.
6878
+ val($ELEMENT.data('value') ? P.get('select', SETTINGS.format) : ELEMENT.value);
6879
+
6880
+ // Only bind keydown events if the element isn’t editable.
6881
+ if (!SETTINGS.editable) {
6882
+
6883
+ $ELEMENT.
6884
+
6885
+ // On focus/click, focus onto the root to open it up.
6886
+ on('focus.' + STATE.id + ' click.' + STATE.id, function (event) {
6887
+ event.preventDefault();
6888
+ P.$root.eq(0).focus();
6889
+ }).
6890
+
6891
+ // Handle keyboard event based on the picker being opened or not.
6892
+ on('keydown.' + STATE.id, handleKeydownEvent);
6893
+ }
6894
+
6895
+ // Update the aria attributes.
6896
+ aria(ELEMENT, {
6897
+ haspopup: true,
6898
+ expanded: false,
6899
+ readonly: false,
6900
+ owns: ELEMENT.id + '_root'
6901
+ });
6902
+ }
6903
+
6904
+ /**
6905
+ * Prepare the root picker element with all bindings.
6906
+ */
6907
+ function prepareElementRoot() {
6908
+
6909
+ P.$root.on({
6910
+
6911
+ // For iOS8.
6912
+ keydown: handleKeydownEvent,
6913
+
6914
+ // When something within the root is focused, stop from bubbling
6915
+ // to the doc and remove the “focused” state from the root.
6916
+ focusin: function (event) {
6917
+ P.$root.removeClass(CLASSES.focused);
6918
+ event.stopPropagation();
6919
+ },
6920
+
6921
+ // When something within the root holder is clicked, stop it
6922
+ // from bubbling to the doc.
6923
+ 'mousedown click': function (event) {
6924
+
6925
+ var target = event.target;
6926
+
6927
+ // Make sure the target isn’t the root holder so it can bubble up.
6928
+ if (target != P.$root.children()[0]) {
6929
+
6930
+ event.stopPropagation();
6931
+
6932
+ // * For mousedown events, cancel the default action in order to
6933
+ // prevent cases where focus is shifted onto external elements
6934
+ // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
6935
+ // Also, for Firefox, don’t prevent action on the `option` element.
6936
+ if (event.type == 'mousedown' && !$(target).is('input, select, textarea, button, option')) {
6937
+
6938
+ event.preventDefault();
6939
+
6940
+ // Re-focus onto the root so that users can click away
6941
+ // from elements focused within the picker.
6942
+ P.$root.eq(0).focus();
6943
+ }
6944
+ }
6945
+ }
6946
+ }).
6947
+
6948
+ // Add/remove the “target” class on focus and blur.
6949
+ on({
6950
+ focus: function () {
6951
+ $ELEMENT.addClass(CLASSES.target);
6952
+ },
6953
+ blur: function () {
6954
+ $ELEMENT.removeClass(CLASSES.target);
6955
+ }
6956
+ }).
6957
+
6958
+ // Open the picker and adjust the root “focused” state
6959
+ on('focus.toOpen', handleFocusToOpenEvent).
6960
+
6961
+ // If there’s a click on an actionable element, carry out the actions.
6962
+ on('click', '[data-pick], [data-nav], [data-clear], [data-close]', function () {
6963
+
6964
+ var $target = $(this),
6965
+ targetData = $target.data(),
6966
+ targetDisabled = $target.hasClass(CLASSES.navDisabled) || $target.hasClass(CLASSES.disabled),
6967
+
6968
+
6969
+ // * For IE, non-focusable elements can be active elements as well
6970
+ // (http://stackoverflow.com/a/2684561).
6971
+ activeElement = getActiveElement();
6972
+ activeElement = activeElement && (activeElement.type || activeElement.href) && activeElement;
6973
+
6974
+ // If it’s disabled or nothing inside is actively focused, re-focus the element.
6975
+ if (targetDisabled || activeElement && !$.contains(P.$root[0], activeElement)) {
6976
+ P.$root.eq(0).focus();
6977
+ }
6978
+
6979
+ // If something is superficially changed, update the `highlight` based on the `nav`.
6980
+ if (!targetDisabled && targetData.nav) {
6981
+ P.set('highlight', P.component.item.highlight, { nav: targetData.nav });
6982
+ }
6983
+
6984
+ // If something is picked, set `select` then close with focus.
6985
+ else if (!targetDisabled && 'pick' in targetData) {
6986
+ P.set('select', targetData.pick);
6987
+ if (SETTINGS.closeOnSelect) {
6988
+ P.close(true);
6989
+ }
6990
+ }
6991
+
6992
+ // If a “clear” button is pressed, empty the values and close with focus.
6993
+ else if (targetData.clear) {
6994
+ P.clear();
6995
+ if (SETTINGS.closeOnSelect) {
6996
+ P.close(true);
6997
+ }
6998
+ } else if (targetData.close) {
6999
+ P.close(true);
7000
+ }
7001
+ }); //P.$root
7002
+
7003
+ aria(P.$root[0], 'hidden', true);
7004
+ }
7005
+
7006
+ /**
7007
+ * Prepare the hidden input element along with all bindings.
7008
+ */
7009
+ function prepareElementHidden() {
7010
+
7011
+ var name;
7012
+
7013
+ if (SETTINGS.hiddenName === true) {
7014
+ name = ELEMENT.name;
7015
+ ELEMENT.name = '';
7016
+ } else {
7017
+ name = [typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '', typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'];
7018
+ name = name[0] + ELEMENT.name + name[1];
7019
+ }
7020
+
7021
+ P._hidden = $('<input ' + 'type=hidden ' +
7022
+
7023
+ // Create the name using the original input’s with a prefix and suffix.
7024
+ 'name="' + name + '"' + (
7025
+
7026
+ // If the element has a value, set the hidden value as well.
7027
+ $ELEMENT.data('value') || ELEMENT.value ? ' value="' + P.get('select', SETTINGS.formatSubmit) + '"' : '') + '>')[0];
7028
+
7029
+ $ELEMENT.
7030
+
7031
+ // If the value changes, update the hidden input with the correct format.
7032
+ on('change.' + STATE.id, function () {
7033
+ P._hidden.value = ELEMENT.value ? P.get('select', SETTINGS.formatSubmit) : '';
7034
+ });
7035
+
7036
+ // Insert the hidden input as specified in the settings.
7037
+ if (SETTINGS.container) $(SETTINGS.container).append(P._hidden);else $ELEMENT.before(P._hidden);
7038
+ }
7039
+
7040
+ // For iOS8.
7041
+ function handleKeydownEvent(event) {
7042
+
7043
+ var keycode = event.keyCode,
7044
+
7045
+
7046
+ // Check if one of the delete keys was pressed.
7047
+ isKeycodeDelete = /^(8|46)$/.test(keycode);
7048
+
7049
+ // For some reason IE clears the input value on “escape”.
7050
+ if (keycode == 27) {
7051
+ P.close();
7052
+ return false;
7053
+ }
7054
+
7055
+ // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
7056
+ if (keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode]) {
7057
+
7058
+ // Prevent it from moving the page and bubbling to doc.
7059
+ event.preventDefault();
7060
+ event.stopPropagation();
7061
+
7062
+ // If `delete` was pressed, clear the values and close the picker.
7063
+ // Otherwise open the picker.
7064
+ if (isKeycodeDelete) {
7065
+ P.clear().close();
7066
+ } else {
7067
+ P.open();
7068
+ }
7069
+ }
7070
+ }
7071
+
7072
+ // Separated for IE
7073
+ function handleFocusToOpenEvent(event) {
7074
+
7075
+ // Stop the event from propagating to the doc.
7076
+ event.stopPropagation();
7077
+
7078
+ // If it’s a focus event, add the “focused” class to the root.
7079
+ if (event.type == 'focus') {
7080
+ P.$root.addClass(CLASSES.focused);
7081
+ }
7082
+
7083
+ // And then finally open the picker.
7084
+ P.open();
7085
+ }
7086
+
7087
+ // Return a new picker instance.
7088
+ return new PickerInstance();
7089
+ } //PickerConstructor
7090
+
7091
+
7092
+ /**
7093
+ * The default classes and prefix to use for the HTML classes.
7094
+ */
7095
+ PickerConstructor.klasses = function (prefix) {
7096
+ prefix = prefix || 'picker';
7097
+ return {
7098
+
7099
+ picker: prefix,
7100
+ opened: prefix + '--opened',
7101
+ focused: prefix + '--focused',
7102
+
7103
+ input: prefix + '__input',
7104
+ active: prefix + '__input--active',
7105
+ target: prefix + '__input--target',
7106
+
7107
+ holder: prefix + '__holder',
7108
+
7109
+ frame: prefix + '__frame',
7110
+ wrap: prefix + '__wrap',
7111
+
7112
+ box: prefix + '__box'
7113
+ };
7114
+ }; //PickerConstructor.klasses
7115
+
7116
+
7117
+ /**
7118
+ * Check if the default theme is being used.
7119
+ */
7120
+ function isUsingDefaultTheme(element) {
7121
+
7122
+ var theme,
7123
+ prop = 'position';
7124
+
7125
+ // For IE.
7126
+ if (element.currentStyle) {
7127
+ theme = element.currentStyle[prop];
7128
+ }
7129
+
7130
+ // For normal browsers.
7131
+ else if (window.getComputedStyle) {
7132
+ theme = getComputedStyle(element)[prop];
7133
+ }
7134
+
7135
+ return theme == 'fixed';
7136
+ }
7137
+
7138
+ /**
7139
+ * Get the width of the browser’s scrollbar.
7140
+ * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
7141
+ */
7142
+ function getScrollbarWidth() {
7143
+
7144
+ if ($html.height() <= $window.height()) {
7145
+ return 0;
7146
+ }
7147
+
7148
+ var $outer = $('<div style="visibility:hidden;width:100px" />').appendTo('body');
7149
+
7150
+ // Get the width without scrollbars.
7151
+ var widthWithoutScroll = $outer[0].offsetWidth;
7152
+
7153
+ // Force adding scrollbars.
7154
+ $outer.css('overflow', 'scroll');
7155
+
7156
+ // Add the inner div.
7157
+ var $inner = $('<div style="width:100%" />').appendTo($outer);
7158
+
7159
+ // Get the width with scrollbars.
7160
+ var widthWithScroll = $inner[0].offsetWidth;
7161
+
7162
+ // Remove the divs.
7163
+ $outer.remove();
7164
+
7165
+ // Return the difference between the widths.
7166
+ return widthWithoutScroll - widthWithScroll;
7167
+ }
7168
+
7169
+ /**
7170
+ * PickerConstructor helper methods.
7171
+ */
7172
+ PickerConstructor._ = {
7173
+
7174
+ /**
7175
+ * Create a group of nodes. Expects:
7176
+ * `
7177
+ {
7178
+ min: {Integer},
7179
+ max: {Integer},
7180
+ i: {Integer},
7181
+ node: {String},
7182
+ item: {Function}
7183
+ }
7184
+ * `
7185
+ */
7186
+ group: function (groupObject) {
7187
+
7188
+ var
7189
+ // Scope for the looped object
7190
+ loopObjectScope,
7191
+
7192
+
7193
+ // Create the nodes list
7194
+ nodesList = '',
7195
+
7196
+
7197
+ // The counter starts from the `min`
7198
+ counter = PickerConstructor._.trigger(groupObject.min, groupObject);
7199
+
7200
+ // Loop from the `min` to `max`, incrementing by `i`
7201
+ for (; counter <= PickerConstructor._.trigger(groupObject.max, groupObject, [counter]); counter += groupObject.i) {
7202
+
7203
+ // Trigger the `item` function within scope of the object
7204
+ loopObjectScope = PickerConstructor._.trigger(groupObject.item, groupObject, [counter]);
7205
+
7206
+ // Splice the subgroup and create nodes out of the sub nodes
7207
+ nodesList += PickerConstructor._.node(groupObject.node, loopObjectScope[0], // the node
7208
+ loopObjectScope[1], // the classes
7209
+ loopObjectScope[2] // the attributes
7210
+ );
7211
+ }
7212
+
7213
+ // Return the list of nodes
7214
+ return nodesList;
7215
+ }, //group
7216
+
7217
+
7218
+ /**
7219
+ * Create a dom node string
7220
+ */
7221
+ node: function (wrapper, item, klass, attribute) {
7222
+
7223
+ // If the item is false-y, just return an empty string
7224
+ if (!item) return '';
7225
+
7226
+ // If the item is an array, do a join
7227
+ item = $.isArray(item) ? item.join('') : item;
7228
+
7229
+ // Check for the class
7230
+ klass = klass ? ' class="' + klass + '"' : '';
7231
+
7232
+ // Check for any attributes
7233
+ attribute = attribute ? ' ' + attribute : '';
7234
+
7235
+ // Return the wrapped item
7236
+ return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>';
7237
+ }, //node
7238
+
7239
+
7240
+ /**
7241
+ * Lead numbers below 10 with a zero.
7242
+ */
7243
+ lead: function (number) {
7244
+ return (number < 10 ? '0' : '') + number;
7245
+ },
7246
+
7247
+ /**
7248
+ * Trigger a function otherwise return the value.
7249
+ */
7250
+ trigger: function (callback, scope, args) {
7251
+ return typeof callback == 'function' ? callback.apply(scope, args || []) : callback;
7252
+ },
7253
+
7254
+ /**
7255
+ * If the second character is a digit, length is 2 otherwise 1.
7256
+ */
7257
+ digits: function (string) {
7258
+ return (/\d/.test(string[1]) ? 2 : 1
7259
+ );
7260
+ },
7261
+
7262
+ /**
7263
+ * Tell if something is a date object.
7264
+ */
7265
+ isDate: function (value) {
7266
+ return {}.toString.call(value).indexOf('Date') > -1 && this.isInteger(value.getDate());
7267
+ },
7268
+
7269
+ /**
7270
+ * Tell if something is an integer.
7271
+ */
7272
+ isInteger: function (value) {
7273
+ return {}.toString.call(value).indexOf('Number') > -1 && value % 1 === 0;
7274
+ },
7275
+
7276
+ /**
7277
+ * Create ARIA attribute strings.
7278
+ */
7279
+ ariaAttr: ariaAttr //PickerConstructor._
7280
+
7281
+
7282
+ /**
7283
+ * Extend the picker with a component and defaults.
7284
+ */
7285
+ };PickerConstructor.extend = function (name, Component) {
7286
+
7287
+ // Extend jQuery.
7288
+ $.fn[name] = function (options, action) {
7289
+
7290
+ // Grab the component data.
7291
+ var componentData = this.data(name);
7292
+
7293
+ // If the picker is requested, return the data object.
7294
+ if (options == 'picker') {
7295
+ return componentData;
7296
+ }
7297
+
7298
+ // If the component data exists and `options` is a string, carry out the action.
7299
+ if (componentData && typeof options == 'string') {
7300
+ return PickerConstructor._.trigger(componentData[options], componentData, [action]);
7301
+ }
7302
+
7303
+ // Otherwise go through each matched element and if the component
7304
+ // doesn’t exist, create a new picker using `this` element
7305
+ // and merging the defaults and options with a deep copy.
7306
+ return this.each(function () {
7307
+ var $this = $(this);
7308
+ if (!$this.data(name)) {
7309
+ new PickerConstructor(this, name, Component, options);
7310
+ }
7311
+ });
7312
+ };
7313
+
7314
+ // Set the defaults.
7315
+ $.fn[name].defaults = Component.defaults;
7316
+ }; //PickerConstructor.extend
7317
+
7318
+
7319
+ function aria(element, attribute, value) {
7320
+ if ($.isPlainObject(attribute)) {
7321
+ for (var key in attribute) {
7322
+ ariaSet(element, key, attribute[key]);
7323
+ }
7324
+ } else {
7325
+ ariaSet(element, attribute, value);
7326
+ }
7327
+ }
7328
+ function ariaSet(element, attribute, value) {
7329
+ element.setAttribute((attribute == 'role' ? '' : 'aria-') + attribute, value);
7330
+ }
7331
+ function ariaAttr(attribute, data) {
7332
+ if (!$.isPlainObject(attribute)) {
7333
+ attribute = { attribute: data };
7334
+ }
7335
+ data = '';
7336
+ for (var key in attribute) {
7337
+ var attr = (key == 'role' ? '' : 'aria-') + key,
7338
+ attrVal = attribute[key];
7339
+ data += attrVal == null ? '' : attr + '="' + attribute[key] + '"';
7340
+ }
7341
+ return data;
7342
+ }
7343
+
7344
+ // IE8 bug throws an error for activeElements within iframes.
7345
+ function getActiveElement() {
7346
+ try {
7347
+ return document.activeElement;
7348
+ } catch (err) {}
7349
+ }
7350
+
7351
+ // Expose the picker constructor.
7352
+ return PickerConstructor;
7353
+ });
7354
+ ; /*!
7355
+ * Date picker for pickadate.js v3.5.0
7356
+ * http://amsul.github.io/pickadate.js/date.htm
7357
+ */
7358
+
7359
+ (function (factory) {
7360
+ factory(Materialize.Picker, jQuery);
7361
+ })(function (Picker, $) {
7362
+
7363
+ /**
7364
+ * Globals and constants
7365
+ */
7366
+ var DAYS_IN_WEEK = 7,
7367
+ WEEKS_IN_CALENDAR = 6,
7368
+ _ = Picker._;
7369
+
7370
+ /**
7371
+ * The date picker constructor
7372
+ */
7373
+ function DatePicker(picker, settings) {
7374
+
7375
+ var calendar = this,
7376
+ element = picker.$node[0],
7377
+ elementValue = element.value,
7378
+ elementDataValue = picker.$node.data('value'),
7379
+ valueString = elementDataValue || elementValue,
7380
+ formatString = elementDataValue ? settings.formatSubmit : settings.format,
7381
+ isRTL = function () {
7382
+
7383
+ return element.currentStyle ?
7384
+
7385
+ // For IE.
7386
+ element.currentStyle.direction == 'rtl' :
7387
+
7388
+ // For normal browsers.
7389
+ getComputedStyle(picker.$root[0]).direction == 'rtl';
7390
+ };
7391
+
7392
+ calendar.settings = settings;
7393
+ calendar.$node = picker.$node;
7394
+
7395
+ // The queue of methods that will be used to build item objects.
7396
+ calendar.queue = {
7397
+ min: 'measure create',
7398
+ max: 'measure create',
7399
+ now: 'now create',
7400
+ select: 'parse create validate',
7401
+ highlight: 'parse navigate create validate',
7402
+ view: 'parse create validate viewset',
7403
+ disable: 'deactivate',
7404
+ enable: 'activate'
7405
+
7406
+ // The component's item object.
7407
+ };calendar.item = {};
7408
+
7409
+ calendar.item.clear = null;
7410
+ calendar.item.disable = (settings.disable || []).slice(0);
7411
+ calendar.item.enable = -function (collectionDisabled) {
7412
+ return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;
7413
+ }(calendar.item.disable);
7414
+
7415
+ calendar.set('min', settings.min).set('max', settings.max).set('now');
7416
+
7417
+ // When there’s a value, set the `select`, which in turn
7418
+ // also sets the `highlight` and `view`.
7419
+ if (valueString) {
7420
+ calendar.set('select', valueString, { format: formatString });
7421
+ }
7422
+
7423
+ // If there’s no value, default to highlighting “today”.
7424
+ else {
7425
+ calendar.set('select', null).set('highlight', calendar.item.now);
7426
+ }
7427
+
7428
+ // The keycode to movement mapping.
7429
+ calendar.key = {
7430
+ 40: 7, // Down
7431
+ 38: -7, // Up
7432
+ 39: function () {
7433
+ return isRTL() ? -1 : 1;
7434
+ }, // Right
7435
+ 37: function () {
7436
+ return isRTL() ? 1 : -1;
7437
+ }, // Left
7438
+ go: function (timeChange) {
7439
+ var highlightedObject = calendar.item.highlight,
7440
+ targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);
7441
+ calendar.set('highlight', targetDate, { interval: timeChange });
7442
+ this.render();
7443
+ }
7444
+
7445
+ // Bind some picker events.
7446
+ };picker.on('render', function () {
7447
+ picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {
7448
+ var value = this.value;
7449
+ if (value) {
7450
+ picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);
7451
+ picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');
7452
+ }
7453
+ });
7454
+ picker.$root.find('.' + settings.klass.selectYear).on('change', function () {
7455
+ var value = this.value;
7456
+ if (value) {
7457
+ picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);
7458
+ picker.$root.find('.' + settings.klass.selectYear).trigger('focus');
7459
+ }
7460
+ });
7461
+ }, 1).on('open', function () {
7462
+ var includeToday = '';
7463
+ if (calendar.disabled(calendar.get('now'))) {
7464
+ includeToday = ':not(.' + settings.klass.buttonToday + ')';
7465
+ }
7466
+ picker.$root.find('button' + includeToday + ', select').attr('disabled', false);
7467
+ }, 1).on('close', function () {
7468
+ picker.$root.find('button, select').attr('disabled', true);
7469
+ }, 1);
7470
+ } //DatePicker
7471
+
7472
+
7473
+ /**
7474
+ * Set a datepicker item object.
7475
+ */
7476
+ DatePicker.prototype.set = function (type, value, options) {
7477
+
7478
+ var calendar = this,
7479
+ calendarItem = calendar.item;
7480
+
7481
+ // If the value is `null` just set it immediately.
7482
+ if (value === null) {
7483
+ if (type == 'clear') type = 'select';
7484
+ calendarItem[type] = value;
7485
+ return calendar;
7486
+ }
7487
+
7488
+ // Otherwise go through the queue of methods, and invoke the functions.
7489
+ // Update this as the time unit, and set the final value as this item.
7490
+ // * In the case of `enable`, keep the queue but set `disable` instead.
7491
+ // And in the case of `flip`, keep the queue but set `enable` instead.
7492
+ calendarItem[type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type] = calendar.queue[type].split(' ').map(function (method) {
7493
+ value = calendar[method](type, value, options);
7494
+ return value;
7495
+ }).pop();
7496
+
7497
+ // Check if we need to cascade through more updates.
7498
+ if (type == 'select') {
7499
+ calendar.set('highlight', calendarItem.select, options);
7500
+ } else if (type == 'highlight') {
7501
+ calendar.set('view', calendarItem.highlight, options);
7502
+ } else if (type.match(/^(flip|min|max|disable|enable)$/)) {
7503
+ if (calendarItem.select && calendar.disabled(calendarItem.select)) {
7504
+ calendar.set('select', calendarItem.select, options);
7505
+ }
7506
+ if (calendarItem.highlight && calendar.disabled(calendarItem.highlight)) {
7507
+ calendar.set('highlight', calendarItem.highlight, options);
7508
+ }
7509
+ }
7510
+
7511
+ return calendar;
7512
+ }; //DatePicker.prototype.set
7513
+
7514
+
7515
+ /**
7516
+ * Get a datepicker item object.
7517
+ */
7518
+ DatePicker.prototype.get = function (type) {
7519
+ return this.item[type];
7520
+ }; //DatePicker.prototype.get
7521
+
7522
+
7523
+ /**
7524
+ * Create a picker date object.
7525
+ */
7526
+ DatePicker.prototype.create = function (type, value, options) {
7527
+
7528
+ var isInfiniteValue,
7529
+ calendar = this;
7530
+
7531
+ // If there’s no value, use the type as the value.
7532
+ value = value === undefined ? type : value;
7533
+
7534
+ // If it’s infinity, update the value.
7535
+ if (value == -Infinity || value == Infinity) {
7536
+ isInfiniteValue = value;
7537
+ }
7538
+
7539
+ // If it’s an object, use the native date object.
7540
+ else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
7541
+ value = value.obj;
7542
+ }
7543
+
7544
+ // If it’s an array, convert it into a date and make sure
7545
+ // that it’s a valid date – otherwise default to today.
7546
+ else if ($.isArray(value)) {
7547
+ value = new Date(value[0], value[1], value[2]);
7548
+ value = _.isDate(value) ? value : calendar.create().obj;
7549
+ }
7550
+
7551
+ // If it’s a number or date object, make a normalized date.
7552
+ else if (_.isInteger(value) || _.isDate(value)) {
7553
+ value = calendar.normalize(new Date(value), options);
7554
+ }
7555
+
7556
+ // If it’s a literal true or any other case, set it to now.
7557
+ else /*if ( value === true )*/{
7558
+ value = calendar.now(type, value, options);
7559
+ }
7560
+
7561
+ // Return the compiled object.
7562
+ return {
7563
+ year: isInfiniteValue || value.getFullYear(),
7564
+ month: isInfiniteValue || value.getMonth(),
7565
+ date: isInfiniteValue || value.getDate(),
7566
+ day: isInfiniteValue || value.getDay(),
7567
+ obj: isInfiniteValue || value,
7568
+ pick: isInfiniteValue || value.getTime()
7569
+ };
7570
+ }; //DatePicker.prototype.create
7571
+
7572
+
7573
+ /**
7574
+ * Create a range limit object using an array, date object,
7575
+ * literal “true”, or integer relative to another time.
7576
+ */
7577
+ DatePicker.prototype.createRange = function (from, to) {
7578
+
7579
+ var calendar = this,
7580
+ createDate = function (date) {
7581
+ if (date === true || $.isArray(date) || _.isDate(date)) {
7582
+ return calendar.create(date);
7583
+ }
7584
+ return date;
7585
+ };
7586
+
7587
+ // Create objects if possible.
7588
+ if (!_.isInteger(from)) {
7589
+ from = createDate(from);
7590
+ }
7591
+ if (!_.isInteger(to)) {
7592
+ to = createDate(to);
7593
+ }
7594
+
7595
+ // Create relative dates.
7596
+ if (_.isInteger(from) && $.isPlainObject(to)) {
7597
+ from = [to.year, to.month, to.date + from];
7598
+ } else if (_.isInteger(to) && $.isPlainObject(from)) {
7599
+ to = [from.year, from.month, from.date + to];
7600
+ }
7601
+
7602
+ return {
7603
+ from: createDate(from),
7604
+ to: createDate(to)
7605
+ };
7606
+ }; //DatePicker.prototype.createRange
7607
+
7608
+
7609
+ /**
7610
+ * Check if a date unit falls within a date range object.
7611
+ */
7612
+ DatePicker.prototype.withinRange = function (range, dateUnit) {
7613
+ range = this.createRange(range.from, range.to);
7614
+ return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick;
7615
+ };
7616
+
7617
+ /**
7618
+ * Check if two date range objects overlap.
7619
+ */
7620
+ DatePicker.prototype.overlapRanges = function (one, two) {
7621
+
7622
+ var calendar = this;
7623
+
7624
+ // Convert the ranges into comparable dates.
7625
+ one = calendar.createRange(one.from, one.to);
7626
+ two = calendar.createRange(two.from, two.to);
7627
+
7628
+ return calendar.withinRange(one, two.from) || calendar.withinRange(one, two.to) || calendar.withinRange(two, one.from) || calendar.withinRange(two, one.to);
7629
+ };
7630
+
7631
+ /**
7632
+ * Get the date today.
7633
+ */
7634
+ DatePicker.prototype.now = function (type, value, options) {
7635
+ value = new Date();
7636
+ if (options && options.rel) {
7637
+ value.setDate(value.getDate() + options.rel);
7638
+ }
7639
+ return this.normalize(value, options);
7640
+ };
7641
+
7642
+ /**
7643
+ * Navigate to next/prev month.
7644
+ */
7645
+ DatePicker.prototype.navigate = function (type, value, options) {
7646
+
7647
+ var targetDateObject,
7648
+ targetYear,
7649
+ targetMonth,
7650
+ targetDate,
7651
+ isTargetArray = $.isArray(value),
7652
+ isTargetObject = $.isPlainObject(value),
7653
+ viewsetObject = this.item.view; /*,
7654
+ safety = 100*/
7655
+
7656
+ if (isTargetArray || isTargetObject) {
7657
+
7658
+ if (isTargetObject) {
7659
+ targetYear = value.year;
7660
+ targetMonth = value.month;
7661
+ targetDate = value.date;
7662
+ } else {
7663
+ targetYear = +value[0];
7664
+ targetMonth = +value[1];
7665
+ targetDate = +value[2];
7666
+ }
7667
+
7668
+ // If we’re navigating months but the view is in a different
7669
+ // month, navigate to the view’s year and month.
7670
+ if (options && options.nav && viewsetObject && viewsetObject.month !== targetMonth) {
7671
+ targetYear = viewsetObject.year;
7672
+ targetMonth = viewsetObject.month;
7673
+ }
7674
+
7675
+ // Figure out the expected target year and month.
7676
+ targetDateObject = new Date(targetYear, targetMonth + (options && options.nav ? options.nav : 0), 1);
7677
+ targetYear = targetDateObject.getFullYear();
7678
+ targetMonth = targetDateObject.getMonth();
7679
+
7680
+ // If the month we’re going to doesn’t have enough days,
7681
+ // keep decreasing the date until we reach the month’s last date.
7682
+ while ( /*safety &&*/new Date(targetYear, targetMonth, targetDate).getMonth() !== targetMonth) {
7683
+ targetDate -= 1;
7684
+ /*safety -= 1
7685
+ if ( !safety ) {
7686
+ throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
7687
+ }*/
7688
+ }
7689
+
7690
+ value = [targetYear, targetMonth, targetDate];
7691
+ }
7692
+
7693
+ return value;
7694
+ }; //DatePicker.prototype.navigate
7695
+
7696
+
7697
+ /**
7698
+ * Normalize a date by setting the hours to midnight.
7699
+ */
7700
+ DatePicker.prototype.normalize = function (value /*, options*/) {
7701
+ value.setHours(0, 0, 0, 0);
7702
+ return value;
7703
+ };
7704
+
7705
+ /**
7706
+ * Measure the range of dates.
7707
+ */
7708
+ DatePicker.prototype.measure = function (type, value /*, options*/) {
7709
+
7710
+ var calendar = this;
7711
+
7712
+ // If it’s anything false-y, remove the limits.
7713
+ if (!value) {
7714
+ value = type == 'min' ? -Infinity : Infinity;
7715
+ }
7716
+
7717
+ // If it’s a string, parse it.
7718
+ else if (typeof value == 'string') {
7719
+ value = calendar.parse(type, value);
7720
+ }
7721
+
7722
+ // If it's an integer, get a date relative to today.
7723
+ else if (_.isInteger(value)) {
7724
+ value = calendar.now(type, value, { rel: value });
7725
+ }
7726
+
7727
+ return value;
7728
+ }; ///DatePicker.prototype.measure
7729
+
7730
+
7731
+ /**
7732
+ * Create a viewset object based on navigation.
7733
+ */
7734
+ DatePicker.prototype.viewset = function (type, dateObject /*, options*/) {
7735
+ return this.create([dateObject.year, dateObject.month, 1]);
7736
+ };
7737
+
7738
+ /**
7739
+ * Validate a date as enabled and shift if needed.
7740
+ */
7741
+ DatePicker.prototype.validate = function (type, dateObject, options) {
7742
+
7743
+ var calendar = this,
7744
+
7745
+
7746
+ // Keep a reference to the original date.
7747
+ originalDateObject = dateObject,
7748
+
7749
+
7750
+ // Make sure we have an interval.
7751
+ interval = options && options.interval ? options.interval : 1,
7752
+
7753
+
7754
+ // Check if the calendar enabled dates are inverted.
7755
+ isFlippedBase = calendar.item.enable === -1,
7756
+
7757
+
7758
+ // Check if we have any enabled dates after/before now.
7759
+ hasEnabledBeforeTarget,
7760
+ hasEnabledAfterTarget,
7761
+
7762
+
7763
+ // The min & max limits.
7764
+ minLimitObject = calendar.item.min,
7765
+ maxLimitObject = calendar.item.max,
7766
+
7767
+
7768
+ // Check if we’ve reached the limit during shifting.
7769
+ reachedMin,
7770
+ reachedMax,
7771
+
7772
+
7773
+ // Check if the calendar is inverted and at least one weekday is enabled.
7774
+ hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter(function (value) {
7775
+
7776
+ // If there’s a date, check where it is relative to the target.
7777
+ if ($.isArray(value)) {
7778
+ var dateTime = calendar.create(value).pick;
7779
+ if (dateTime < dateObject.pick) hasEnabledBeforeTarget = true;else if (dateTime > dateObject.pick) hasEnabledAfterTarget = true;
7780
+ }
7781
+
7782
+ // Return only integers for enabled weekdays.
7783
+ return _.isInteger(value);
7784
+ }).length; /*,
7785
+ safety = 100*/
7786
+
7787
+ // Cases to validate for:
7788
+ // [1] Not inverted and date disabled.
7789
+ // [2] Inverted and some dates enabled.
7790
+ // [3] Not inverted and out of range.
7791
+ //
7792
+ // Cases to **not** validate for:
7793
+ // • Navigating months.
7794
+ // • Not inverted and date enabled.
7795
+ // • Inverted and all dates disabled.
7796
+ // • ..and anything else.
7797
+ if (!options || !options.nav) if (
7798
+ /* 1 */!isFlippedBase && calendar.disabled(dateObject) ||
7799
+ /* 2 */isFlippedBase && calendar.disabled(dateObject) && (hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget) ||
7800
+ /* 3 */!isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick)) {
7801
+
7802
+ // When inverted, flip the direction if there aren’t any enabled weekdays
7803
+ // and there are no enabled dates in the direction of the interval.
7804
+ if (isFlippedBase && !hasEnabledWeekdays && (!hasEnabledAfterTarget && interval > 0 || !hasEnabledBeforeTarget && interval < 0)) {
7805
+ interval *= -1;
7806
+ }
7807
+
7808
+ // Keep looping until we reach an enabled date.
7809
+ while ( /*safety &&*/calendar.disabled(dateObject)) {
7810
+
7811
+ /*safety -= 1
7812
+ if ( !safety ) {
7813
+ throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
7814
+ }*/
7815
+
7816
+ // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
7817
+ if (Math.abs(interval) > 1 && (dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month)) {
7818
+ dateObject = originalDateObject;
7819
+ interval = interval > 0 ? 1 : -1;
7820
+ }
7821
+
7822
+ // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
7823
+ if (dateObject.pick <= minLimitObject.pick) {
7824
+ reachedMin = true;
7825
+ interval = 1;
7826
+ dateObject = calendar.create([minLimitObject.year, minLimitObject.month, minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)]);
7827
+ } else if (dateObject.pick >= maxLimitObject.pick) {
7828
+ reachedMax = true;
7829
+ interval = -1;
7830
+ dateObject = calendar.create([maxLimitObject.year, maxLimitObject.month, maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)]);
7831
+ }
7832
+
7833
+ // If we’ve reached both limits, just break out of the loop.
7834
+ if (reachedMin && reachedMax) {
7835
+ break;
7836
+ }
7837
+
7838
+ // Finally, create the shifted date using the interval and keep looping.
7839
+ dateObject = calendar.create([dateObject.year, dateObject.month, dateObject.date + interval]);
7840
+ }
7841
+ } //endif
7842
+
7843
+
7844
+ // Return the date object settled on.
7845
+ return dateObject;
7846
+ }; //DatePicker.prototype.validate
7847
+
7848
+
7849
+ /**
7850
+ * Check if a date is disabled.
7851
+ */
7852
+ DatePicker.prototype.disabled = function (dateToVerify) {
7853
+
7854
+ var calendar = this,
7855
+
7856
+
7857
+ // Filter through the disabled dates to check if this is one.
7858
+ isDisabledMatch = calendar.item.disable.filter(function (dateToDisable) {
7859
+
7860
+ // If the date is a number, match the weekday with 0index and `firstDay` check.
7861
+ if (_.isInteger(dateToDisable)) {
7862
+ return dateToVerify.day === (calendar.settings.firstDay ? dateToDisable : dateToDisable - 1) % 7;
7863
+ }
7864
+
7865
+ // If it’s an array or a native JS date, create and match the exact date.
7866
+ if ($.isArray(dateToDisable) || _.isDate(dateToDisable)) {
7867
+ return dateToVerify.pick === calendar.create(dateToDisable).pick;
7868
+ }
7869
+
7870
+ // If it’s an object, match a date within the “from” and “to” range.
7871
+ if ($.isPlainObject(dateToDisable)) {
7872
+ return calendar.withinRange(dateToDisable, dateToVerify);
7873
+ }
7874
+ });
7875
+
7876
+ // If this date matches a disabled date, confirm it’s not inverted.
7877
+ isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (dateToDisable) {
7878
+ return $.isArray(dateToDisable) && dateToDisable[3] == 'inverted' || $.isPlainObject(dateToDisable) && dateToDisable.inverted;
7879
+ }).length;
7880
+
7881
+ // Check the calendar “enabled” flag and respectively flip the
7882
+ // disabled state. Then also check if it’s beyond the min/max limits.
7883
+ return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch || dateToVerify.pick < calendar.item.min.pick || dateToVerify.pick > calendar.item.max.pick;
7884
+ }; //DatePicker.prototype.disabled
7885
+
7886
+
7887
+ /**
7888
+ * Parse a string into a usable type.
7889
+ */
7890
+ DatePicker.prototype.parse = function (type, value, options) {
7891
+
7892
+ var calendar = this,
7893
+ parsingObject = {};
7894
+
7895
+ // If it’s already parsed, we’re good.
7896
+ if (!value || typeof value != 'string') {
7897
+ return value;
7898
+ }
7899
+
7900
+ // We need a `.format` to parse the value with.
7901
+ if (!(options && options.format)) {
7902
+ options = options || {};
7903
+ options.format = calendar.settings.format;
7904
+ }
7905
+
7906
+ // Convert the format into an array and then map through it.
7907
+ calendar.formats.toArray(options.format).map(function (label) {
7908
+
7909
+ var
7910
+ // Grab the formatting label.
7911
+ formattingLabel = calendar.formats[label],
7912
+
7913
+
7914
+ // The format length is from the formatting label function or the
7915
+ // label length without the escaping exclamation (!) mark.
7916
+ formatLength = formattingLabel ? _.trigger(formattingLabel, calendar, [value, parsingObject]) : label.replace(/^!/, '').length;
7917
+
7918
+ // If there's a format label, split the value up to the format length.
7919
+ // Then add it to the parsing object with appropriate label.
7920
+ if (formattingLabel) {
7921
+ parsingObject[label] = value.substr(0, formatLength);
7922
+ }
7923
+
7924
+ // Update the value as the substring from format length to end.
7925
+ value = value.substr(formatLength);
7926
+ });
7927
+
7928
+ // Compensate for month 0index.
7929
+ return [parsingObject.yyyy || parsingObject.yy, +(parsingObject.mm || parsingObject.m) - 1, parsingObject.dd || parsingObject.d];
7930
+ }; //DatePicker.prototype.parse
7931
+
7932
+
7933
+ /**
7934
+ * Various formats to display the object in.
7935
+ */
7936
+ DatePicker.prototype.formats = function () {
7937
+
7938
+ // Return the length of the first word in a collection.
7939
+ function getWordLengthFromCollection(string, collection, dateObject) {
7940
+
7941
+ // Grab the first word from the string.
7942
+ var word = string.match(/\w+/)[0];
7943
+
7944
+ // If there's no month index, add it to the date object
7945
+ if (!dateObject.mm && !dateObject.m) {
7946
+ dateObject.m = collection.indexOf(word) + 1;
7947
+ }
7948
+
7949
+ // Return the length of the word.
7950
+ return word.length;
7951
+ }
7952
+
7953
+ // Get the length of the first word in a string.
7954
+ function getFirstWordLength(string) {
7955
+ return string.match(/\w+/)[0].length;
7956
+ }
7957
+
7958
+ return {
7959
+
7960
+ d: function (string, dateObject) {
7961
+
7962
+ // If there's string, then get the digits length.
7963
+ // Otherwise return the selected date.
7964
+ return string ? _.digits(string) : dateObject.date;
7965
+ },
7966
+ dd: function (string, dateObject) {
7967
+
7968
+ // If there's a string, then the length is always 2.
7969
+ // Otherwise return the selected date with a leading zero.
7970
+ return string ? 2 : _.lead(dateObject.date);
7971
+ },
7972
+ ddd: function (string, dateObject) {
7973
+
7974
+ // If there's a string, then get the length of the first word.
7975
+ // Otherwise return the short selected weekday.
7976
+ return string ? getFirstWordLength(string) : this.settings.weekdaysShort[dateObject.day];
7977
+ },
7978
+ dddd: function (string, dateObject) {
7979
+
7980
+ // If there's a string, then get the length of the first word.
7981
+ // Otherwise return the full selected weekday.
7982
+ return string ? getFirstWordLength(string) : this.settings.weekdaysFull[dateObject.day];
7983
+ },
7984
+ m: function (string, dateObject) {
7985
+
7986
+ // If there's a string, then get the length of the digits
7987
+ // Otherwise return the selected month with 0index compensation.
7988
+ return string ? _.digits(string) : dateObject.month + 1;
7989
+ },
7990
+ mm: function (string, dateObject) {
7991
+
7992
+ // If there's a string, then the length is always 2.
7993
+ // Otherwise return the selected month with 0index and leading zero.
7994
+ return string ? 2 : _.lead(dateObject.month + 1);
7995
+ },
7996
+ mmm: function (string, dateObject) {
7997
+
7998
+ var collection = this.settings.monthsShort;
7999
+
8000
+ // If there's a string, get length of the relevant month from the short
8001
+ // months collection. Otherwise return the selected month from that collection.
8002
+ return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
8003
+ },
8004
+ mmmm: function (string, dateObject) {
8005
+
8006
+ var collection = this.settings.monthsFull;
8007
+
8008
+ // If there's a string, get length of the relevant month from the full
8009
+ // months collection. Otherwise return the selected month from that collection.
8010
+ return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
8011
+ },
8012
+ yy: function (string, dateObject) {
8013
+
8014
+ // If there's a string, then the length is always 2.
8015
+ // Otherwise return the selected year by slicing out the first 2 digits.
8016
+ return string ? 2 : ('' + dateObject.year).slice(2);
8017
+ },
8018
+ yyyy: function (string, dateObject) {
8019
+
8020
+ // If there's a string, then the length is always 4.
8021
+ // Otherwise return the selected year.
8022
+ return string ? 4 : dateObject.year;
8023
+ },
8024
+
8025
+ // Create an array by splitting the formatting string passed.
8026
+ toArray: function (formatString) {
8027
+ return formatString.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
8028
+ },
8029
+
8030
+ // Format an object into a string using the formatting options.
8031
+ toString: function (formatString, itemObject) {
8032
+ var calendar = this;
8033
+ return calendar.formats.toArray(formatString).map(function (label) {
8034
+ return _.trigger(calendar.formats[label], calendar, [0, itemObject]) || label.replace(/^!/, '');
8035
+ }).join('');
8036
+ }
8037
+ };
8038
+ }(); //DatePicker.prototype.formats
8039
+
8040
+
8041
+ /**
8042
+ * Check if two date units are the exact.
8043
+ */
8044
+ DatePicker.prototype.isDateExact = function (one, two) {
8045
+
8046
+ var calendar = this;
8047
+
8048
+ // When we’re working with weekdays, do a direct comparison.
8049
+ if (_.isInteger(one) && _.isInteger(two) || typeof one == 'boolean' && typeof two == 'boolean') {
8050
+ return one === two;
8051
+ }
8052
+
8053
+ // When we’re working with date representations, compare the “pick” value.
8054
+ if ((_.isDate(one) || $.isArray(one)) && (_.isDate(two) || $.isArray(two))) {
8055
+ return calendar.create(one).pick === calendar.create(two).pick;
8056
+ }
8057
+
8058
+ // When we’re working with range objects, compare the “from” and “to”.
8059
+ if ($.isPlainObject(one) && $.isPlainObject(two)) {
8060
+ return calendar.isDateExact(one.from, two.from) && calendar.isDateExact(one.to, two.to);
8061
+ }
8062
+
8063
+ return false;
8064
+ };
8065
+
8066
+ /**
8067
+ * Check if two date units overlap.
8068
+ */
8069
+ DatePicker.prototype.isDateOverlap = function (one, two) {
8070
+
8071
+ var calendar = this,
8072
+ firstDay = calendar.settings.firstDay ? 1 : 0;
8073
+
8074
+ // When we’re working with a weekday index, compare the days.
8075
+ if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
8076
+ one = one % 7 + firstDay;
8077
+ return one === calendar.create(two).day + 1;
8078
+ }
8079
+ if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
8080
+ two = two % 7 + firstDay;
8081
+ return two === calendar.create(one).day + 1;
8082
+ }
8083
+
8084
+ // When we’re working with range objects, check if the ranges overlap.
8085
+ if ($.isPlainObject(one) && $.isPlainObject(two)) {
8086
+ return calendar.overlapRanges(one, two);
8087
+ }
8088
+
8089
+ return false;
8090
+ };
8091
+
8092
+ /**
8093
+ * Flip the “enabled” state.
8094
+ */
8095
+ DatePicker.prototype.flipEnable = function (val) {
8096
+ var itemObject = this.item;
8097
+ itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1);
8098
+ };
8099
+
8100
+ /**
8101
+ * Mark a collection of dates as “disabled”.
8102
+ */
8103
+ DatePicker.prototype.deactivate = function (type, datesToDisable) {
8104
+
8105
+ var calendar = this,
8106
+ disabledItems = calendar.item.disable.slice(0);
8107
+
8108
+ // If we’re flipping, that’s all we need to do.
8109
+ if (datesToDisable == 'flip') {
8110
+ calendar.flipEnable();
8111
+ } else if (datesToDisable === false) {
8112
+ calendar.flipEnable(1);
8113
+ disabledItems = [];
8114
+ } else if (datesToDisable === true) {
8115
+ calendar.flipEnable(-1);
8116
+ disabledItems = [];
8117
+ }
8118
+
8119
+ // Otherwise go through the dates to disable.
8120
+ else {
8121
+
8122
+ datesToDisable.map(function (unitToDisable) {
8123
+
8124
+ var matchFound;
8125
+
8126
+ // When we have disabled items, check for matches.
8127
+ // If something is matched, immediately break out.
8128
+ for (var index = 0; index < disabledItems.length; index += 1) {
8129
+ if (calendar.isDateExact(unitToDisable, disabledItems[index])) {
8130
+ matchFound = true;
8131
+ break;
8132
+ }
8133
+ }
8134
+
8135
+ // If nothing was found, add the validated unit to the collection.
8136
+ if (!matchFound) {
8137
+ if (_.isInteger(unitToDisable) || _.isDate(unitToDisable) || $.isArray(unitToDisable) || $.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to) {
8138
+ disabledItems.push(unitToDisable);
8139
+ }
8140
+ }
8141
+ });
8142
+ }
8143
+
8144
+ // Return the updated collection.
8145
+ return disabledItems;
8146
+ }; //DatePicker.prototype.deactivate
8147
+
8148
+
8149
+ /**
8150
+ * Mark a collection of dates as “enabled”.
8151
+ */
8152
+ DatePicker.prototype.activate = function (type, datesToEnable) {
8153
+
8154
+ var calendar = this,
8155
+ disabledItems = calendar.item.disable,
8156
+ disabledItemsCount = disabledItems.length;
8157
+
8158
+ // If we’re flipping, that’s all we need to do.
8159
+ if (datesToEnable == 'flip') {
8160
+ calendar.flipEnable();
8161
+ } else if (datesToEnable === true) {
8162
+ calendar.flipEnable(1);
8163
+ disabledItems = [];
8164
+ } else if (datesToEnable === false) {
8165
+ calendar.flipEnable(-1);
8166
+ disabledItems = [];
8167
+ }
8168
+
8169
+ // Otherwise go through the disabled dates.
8170
+ else {
8171
+
8172
+ datesToEnable.map(function (unitToEnable) {
8173
+
8174
+ var matchFound, disabledUnit, index, isExactRange;
8175
+
8176
+ // Go through the disabled items and try to find a match.
8177
+ for (index = 0; index < disabledItemsCount; index += 1) {
8178
+
8179
+ disabledUnit = disabledItems[index];
8180
+
8181
+ // When an exact match is found, remove it from the collection.
8182
+ if (calendar.isDateExact(disabledUnit, unitToEnable)) {
8183
+ matchFound = disabledItems[index] = null;
8184
+ isExactRange = true;
8185
+ break;
8186
+ }
8187
+
8188
+ // When an overlapped match is found, add the “inverted” state to it.
8189
+ else if (calendar.isDateOverlap(disabledUnit, unitToEnable)) {
8190
+ if ($.isPlainObject(unitToEnable)) {
8191
+ unitToEnable.inverted = true;
8192
+ matchFound = unitToEnable;
8193
+ } else if ($.isArray(unitToEnable)) {
8194
+ matchFound = unitToEnable;
8195
+ if (!matchFound[3]) matchFound.push('inverted');
8196
+ } else if (_.isDate(unitToEnable)) {
8197
+ matchFound = [unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted'];
8198
+ }
8199
+ break;
8200
+ }
8201
+ }
8202
+
8203
+ // If a match was found, remove a previous duplicate entry.
8204
+ if (matchFound) for (index = 0; index < disabledItemsCount; index += 1) {
8205
+ if (calendar.isDateExact(disabledItems[index], unitToEnable)) {
8206
+ disabledItems[index] = null;
8207
+ break;
8208
+ }
8209
+ }
8210
+
8211
+ // In the event that we’re dealing with an exact range of dates,
8212
+ // make sure there are no “inverted” dates because of it.
8213
+ if (isExactRange) for (index = 0; index < disabledItemsCount; index += 1) {
8214
+ if (calendar.isDateOverlap(disabledItems[index], unitToEnable)) {
8215
+ disabledItems[index] = null;
8216
+ break;
8217
+ }
8218
+ }
8219
+
8220
+ // If something is still matched, add it into the collection.
8221
+ if (matchFound) {
8222
+ disabledItems.push(matchFound);
8223
+ }
8224
+ });
8225
+ }
8226
+
8227
+ // Return the updated collection.
8228
+ return disabledItems.filter(function (val) {
8229
+ return val != null;
8230
+ });
8231
+ }; //DatePicker.prototype.activate
8232
+
8233
+
8234
+ /**
8235
+ * Create a string for the nodes in the picker.
8236
+ */
8237
+ DatePicker.prototype.nodes = function (isOpen) {
8238
+
8239
+ var calendar = this,
8240
+ settings = calendar.settings,
8241
+ calendarItem = calendar.item,
8242
+ nowObject = calendarItem.now,
8243
+ selectedObject = calendarItem.select,
8244
+ highlightedObject = calendarItem.highlight,
8245
+ viewsetObject = calendarItem.view,
8246
+ disabledCollection = calendarItem.disable,
8247
+ minLimitObject = calendarItem.min,
8248
+ maxLimitObject = calendarItem.max,
8249
+
8250
+
8251
+ // Create the calendar table head using a copy of weekday labels collection.
8252
+ // * We do a copy so we don't mutate the original array.
8253
+ tableHead = function (collection, fullCollection) {
8254
+
8255
+ // If the first day should be Monday, move Sunday to the end.
8256
+ if (settings.firstDay) {
8257
+ collection.push(collection.shift());
8258
+ fullCollection.push(fullCollection.shift());
8259
+ }
8260
+
8261
+ // Create and return the table head group.
8262
+ return _.node('thead', _.node('tr', _.group({
8263
+ min: 0,
8264
+ max: DAYS_IN_WEEK - 1,
8265
+ i: 1,
8266
+ node: 'th',
8267
+ item: function (counter) {
8268
+ return [collection[counter], settings.klass.weekdays, 'scope=col title="' + fullCollection[counter] + '"'];
8269
+ }
8270
+ }))); //endreturn
8271
+
8272
+ // Materialize modified
8273
+ }((settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysLetter).slice(0), settings.weekdaysFull.slice(0)),
8274
+ //tableHead
8275
+
8276
+
8277
+ // Create the nav for next/prev month.
8278
+ createMonthNav = function (next) {
8279
+
8280
+ // Otherwise, return the created month tag.
8281
+ return _.node('div', ' ', settings.klass['nav' + (next ? 'Next' : 'Prev')] + (
8282
+
8283
+ // If the focused month is outside the range, disabled the button.
8284
+ next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month || !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ? ' ' + settings.klass.navDisabled : ''), 'data-nav=' + (next || -1) + ' ' + _.ariaAttr({
8285
+ role: 'button',
8286
+ controls: calendar.$node[0].id + '_table'
8287
+ }) + ' ' + 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev) + '"'); //endreturn
8288
+ },
8289
+ //createMonthNav
8290
+
8291
+
8292
+ // Create the month label.
8293
+ //Materialize modified
8294
+ createMonthLabel = function (override) {
8295
+
8296
+ var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull;
8297
+
8298
+ // Materialize modified
8299
+ if (override == "short_months") {
8300
+ monthsCollection = settings.monthsShort;
8301
+ }
8302
+
8303
+ // If there are months to select, add a dropdown menu.
8304
+ if (settings.selectMonths && override == undefined) {
8305
+
8306
+ return _.node('select', _.group({
8307
+ min: 0,
8308
+ max: 11,
8309
+ i: 1,
8310
+ node: 'option',
8311
+ item: function (loopedMonth) {
8312
+
8313
+ return [
8314
+
8315
+ // The looped month and no classes.
8316
+ monthsCollection[loopedMonth], 0,
8317
+
8318
+ // Set the value and selected index.
8319
+ 'value=' + loopedMonth + (viewsetObject.month == loopedMonth ? ' selected' : '') + (viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month || viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month ? ' disabled' : '')];
8320
+ }
8321
+ }), settings.klass.selectMonth + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelMonthSelect + '"');
8322
+ }
8323
+
8324
+ // Materialize modified
8325
+ if (override == "short_months") if (selectedObject != null) return monthsCollection[selectedObject.month];else return monthsCollection[viewsetObject.month];
8326
+
8327
+ // If there's a need for a month selector
8328
+ return _.node('div', monthsCollection[viewsetObject.month], settings.klass.month);
8329
+ },
8330
+ //createMonthLabel
8331
+
8332
+
8333
+ // Create the year label.
8334
+ // Materialize modified
8335
+ createYearLabel = function (override) {
8336
+
8337
+ var focusedYear = viewsetObject.year,
8338
+
8339
+
8340
+ // If years selector is set to a literal "true", set it to 5. Otherwise
8341
+ // divide in half to get half before and half after focused year.
8342
+ numberYears = settings.selectYears === true ? 5 : ~~(settings.selectYears / 2);
8343
+
8344
+ // If there are years to select, add a dropdown menu.
8345
+ if (numberYears) {
8346
+
8347
+ var minYear = minLimitObject.year,
8348
+ maxYear = maxLimitObject.year,
8349
+ lowestYear = focusedYear - numberYears,
8350
+ highestYear = focusedYear + numberYears;
8351
+
8352
+ // If the min year is greater than the lowest year, increase the highest year
8353
+ // by the difference and set the lowest year to the min year.
8354
+ if (minYear > lowestYear) {
8355
+ highestYear += minYear - lowestYear;
8356
+ lowestYear = minYear;
8357
+ }
8358
+
8359
+ // If the max year is less than the highest year, decrease the lowest year
8360
+ // by the lower of the two: available and needed years. Then set the
8361
+ // highest year to the max year.
8362
+ if (maxYear < highestYear) {
8363
+
8364
+ var availableYears = lowestYear - minYear,
8365
+ neededYears = highestYear - maxYear;
8366
+
8367
+ lowestYear -= availableYears > neededYears ? neededYears : availableYears;
8368
+ highestYear = maxYear;
8369
+ }
8370
+
8371
+ if (settings.selectYears && override == undefined) {
8372
+ return _.node('select', _.group({
8373
+ min: lowestYear,
8374
+ max: highestYear,
8375
+ i: 1,
8376
+ node: 'option',
8377
+ item: function (loopedYear) {
8378
+ return [
8379
+
8380
+ // The looped year and no classes.
8381
+ loopedYear, 0,
8382
+
8383
+ // Set the value and selected index.
8384
+ 'value=' + loopedYear + (focusedYear == loopedYear ? ' selected' : '')];
8385
+ }
8386
+ }), settings.klass.selectYear + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelYearSelect + '"');
8387
+ }
8388
+ }
8389
+
8390
+ // Materialize modified
8391
+ if (override === 'raw' && selectedObject != null) {
8392
+ return _.node('div', selectedObject.year);
8393
+ }
8394
+
8395
+ // Otherwise just return the year focused
8396
+ return _.node('div', focusedYear, settings.klass.year);
8397
+ }; //createYearLabel
8398
+
8399
+
8400
+ // Materialize modified
8401
+ createDayLabel = function () {
8402
+ if (selectedObject != null) return selectedObject.date;else return nowObject.date;
8403
+ };
8404
+ createWeekdayLabel = function () {
8405
+ var display_day;
8406
+
8407
+ if (selectedObject != null) display_day = selectedObject.day;else display_day = nowObject.day;
8408
+ var weekday = settings.weekdaysShort[display_day];
8409
+ return weekday;
8410
+ };
8411
+
8412
+ // Create and return the entire calendar.
8413
+
8414
+ return _.node(
8415
+ // Date presentation View
8416
+ 'div', _.node(
8417
+ // Div for Year
8418
+ 'div', createYearLabel("raw"), settings.klass.year_display) + _.node('span', createWeekdayLabel() + ', ', "picker__weekday-display") + _.node(
8419
+ // Div for short Month
8420
+ 'span', createMonthLabel("short_months") + ' ', settings.klass.month_display) + _.node(
8421
+ // Div for Day
8422
+ 'span', createDayLabel(), settings.klass.day_display), settings.klass.date_display) +
8423
+ // Calendar container
8424
+ _.node('div', _.node('div', _.node('div', (settings.selectYears ? createMonthLabel() + createYearLabel() : createMonthLabel() + createYearLabel()) + createMonthNav() + createMonthNav(1), settings.klass.header) + _.node('table', tableHead + _.node('tbody', _.group({
8425
+ min: 0,
8426
+ max: WEEKS_IN_CALENDAR - 1,
8427
+ i: 1,
8428
+ node: 'tr',
8429
+ item: function (rowCounter) {
8430
+
8431
+ // If Monday is the first day and the month starts on Sunday, shift the date back a week.
8432
+ var shiftDateBy = settings.firstDay && calendar.create([viewsetObject.year, viewsetObject.month, 1]).day === 0 ? -7 : 0;
8433
+
8434
+ return [_.group({
8435
+ min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
8436
+ max: function () {
8437
+ return this.min + DAYS_IN_WEEK - 1;
8438
+ },
8439
+ i: 1,
8440
+ node: 'td',
8441
+ item: function (targetDate) {
8442
+
8443
+ // Convert the time date from a relative date to a target date.
8444
+ targetDate = calendar.create([viewsetObject.year, viewsetObject.month, targetDate + (settings.firstDay ? 1 : 0)]);
8445
+
8446
+ var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
8447
+ isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
8448
+ isDisabled = disabledCollection && calendar.disabled(targetDate) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
8449
+ formattedDate = _.trigger(calendar.formats.toString, calendar, [settings.format, targetDate]);
8450
+
8451
+ return [_.node('div', targetDate.date, function (klasses) {
8452
+
8453
+ // Add the `infocus` or `outfocus` classes based on month in view.
8454
+ klasses.push(viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus);
8455
+
8456
+ // Add the `today` class if needed.
8457
+ if (nowObject.pick == targetDate.pick) {
8458
+ klasses.push(settings.klass.now);
8459
+ }
8460
+
8461
+ // Add the `selected` class if something's selected and the time matches.
8462
+ if (isSelected) {
8463
+ klasses.push(settings.klass.selected);
8464
+ }
8465
+
8466
+ // Add the `highlighted` class if something's highlighted and the time matches.
8467
+ if (isHighlighted) {
8468
+ klasses.push(settings.klass.highlighted);
8469
+ }
8470
+
8471
+ // Add the `disabled` class if something's disabled and the object matches.
8472
+ if (isDisabled) {
8473
+ klasses.push(settings.klass.disabled);
8474
+ }
8475
+
8476
+ return klasses.join(' ');
8477
+ }([settings.klass.day]), 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
8478
+ role: 'gridcell',
8479
+ label: formattedDate,
8480
+ selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
8481
+ activedescendant: isHighlighted ? true : null,
8482
+ disabled: isDisabled ? true : null
8483
+ }) + ' ' + (isDisabled ? '' : 'tabindex="0"')), '', _.ariaAttr({ role: 'presentation' })]; //endreturn
8484
+ }
8485
+ })]; //endreturn
8486
+ }
8487
+ })), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
8488
+ role: 'grid',
8489
+ controls: calendar.$node[0].id,
8490
+ readonly: true
8491
+ })), settings.klass.calendar_container) // end calendar
8492
+
8493
+ +
8494
+
8495
+ // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
8496
+ _.node('div', _.node('button', settings.today, "btn-flat picker__today waves-effect", 'type=button data-pick=' + nowObject.pick + (isOpen && !calendar.disabled(nowObject) ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.clear, "btn-flat picker__clear waves-effect", 'type=button data-clear=1' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.close, "btn-flat picker__close waves-effect", 'type=button data-close=true ' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })), settings.klass.footer), 'picker__container__wrapper'); //endreturn
8497
+ }; //DatePicker.prototype.nodes
8498
+
8499
+
8500
+ /**
8501
+ * The date picker defaults.
8502
+ */
8503
+ DatePicker.defaults = function (prefix) {
8504
+
8505
+ return {
8506
+
8507
+ // The title label to use for the month nav buttons
8508
+ labelMonthNext: 'Next month',
8509
+ labelMonthPrev: 'Previous month',
8510
+
8511
+ // The title label to use for the dropdown selectors
8512
+ labelMonthSelect: 'Select a month',
8513
+ labelYearSelect: 'Select a year',
8514
+
8515
+ // Months and weekdays
8516
+ monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
8517
+ monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
8518
+ weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
8519
+ weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
8520
+
8521
+ // Materialize modified
8522
+ weekdaysLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
8523
+
8524
+ // Today and clear
8525
+ today: 'Today',
8526
+ clear: 'Clear',
8527
+ close: 'Ok',
8528
+
8529
+ // Picker close behavior (Prevent a change in behaviour for backwards compatibility)
8530
+ closeOnSelect: false,
8531
+
8532
+ // The format to show on the `input` element
8533
+ format: 'd mmmm, yyyy',
8534
+
8535
+ // Classes
8536
+ klass: {
8537
+
8538
+ table: prefix + 'table',
8539
+
8540
+ header: prefix + 'header',
8541
+
8542
+ // Materialize Added klasses
8543
+ date_display: prefix + 'date-display',
8544
+ day_display: prefix + 'day-display',
8545
+ month_display: prefix + 'month-display',
8546
+ year_display: prefix + 'year-display',
8547
+ calendar_container: prefix + 'calendar-container',
8548
+ // end
8549
+
8550
+
8551
+ navPrev: prefix + 'nav--prev',
8552
+ navNext: prefix + 'nav--next',
8553
+ navDisabled: prefix + 'nav--disabled',
8554
+
8555
+ month: prefix + 'month',
8556
+ year: prefix + 'year',
8557
+
8558
+ selectMonth: prefix + 'select--month',
8559
+ selectYear: prefix + 'select--year',
8560
+
8561
+ weekdays: prefix + 'weekday',
8562
+
8563
+ day: prefix + 'day',
8564
+ disabled: prefix + 'day--disabled',
8565
+ selected: prefix + 'day--selected',
8566
+ highlighted: prefix + 'day--highlighted',
8567
+ now: prefix + 'day--today',
8568
+ infocus: prefix + 'day--infocus',
8569
+ outfocus: prefix + 'day--outfocus',
8570
+
8571
+ footer: prefix + 'footer',
8572
+
8573
+ buttonClear: prefix + 'button--clear',
8574
+ buttonToday: prefix + 'button--today',
8575
+ buttonClose: prefix + 'button--close'
8576
+ }
8577
+ };
8578
+ }(Picker.klasses().picker + '__');
8579
+
8580
+ /**
8581
+ * Extend the picker to add the date picker.
8582
+ */
8583
+ Picker.extend('pickadate', DatePicker);
8584
+ });
8585
+ ; /*!
8586
+ * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
8587
+ * Copyright 2014 Wang Shenwei.
8588
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
8589
+ *
8590
+ * Further modified
8591
+ * Copyright 2015 Ching Yaw Hao.
8592
+ */
8593
+
8594
+ (function ($) {
8595
+ var $win = $(window),
8596
+ $doc = $(document);
8597
+
8598
+ // Can I use inline svg ?
8599
+ var svgNS = 'http://www.w3.org/2000/svg',
8600
+ svgSupported = 'SVGAngle' in window && function () {
8601
+ var supported,
8602
+ el = document.createElement('div');
8603
+ el.innerHTML = '<svg/>';
8604
+ supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
8605
+ el.innerHTML = '';
8606
+ return supported;
8607
+ }();
8608
+
8609
+ // Can I use transition ?
8610
+ var transitionSupported = function () {
8611
+ var style = document.createElement('div').style;
8612
+ return 'transition' in style || 'WebkitTransition' in style || 'MozTransition' in style || 'msTransition' in style || 'OTransition' in style;
8613
+ }();
8614
+
8615
+ // Listen touch events in touch screen device, instead of mouse events in desktop.
8616
+ var touchSupported = 'ontouchstart' in window,
8617
+ mousedownEvent = 'mousedown' + (touchSupported ? ' touchstart' : ''),
8618
+ mousemoveEvent = 'mousemove.clockpicker' + (touchSupported ? ' touchmove.clockpicker' : ''),
8619
+ mouseupEvent = 'mouseup.clockpicker' + (touchSupported ? ' touchend.clockpicker' : '');
8620
+
8621
+ // Vibrate the device if supported
8622
+ var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
8623
+
8624
+ function createSvgElement(name) {
8625
+ return document.createElementNS(svgNS, name);
8626
+ }
8627
+
8628
+ function leadingZero(num) {
8629
+ return (num < 10 ? '0' : '') + num;
8630
+ }
8631
+
8632
+ // Get a unique id
8633
+ var idCounter = 0;
8634
+ function uniqueId(prefix) {
8635
+ var id = ++idCounter + '';
8636
+ return prefix ? prefix + id : id;
8637
+ }
8638
+
8639
+ // Clock size
8640
+ var dialRadius = 135,
8641
+ outerRadius = 105,
8642
+
8643
+ // innerRadius = 80 on 12 hour clock
8644
+ innerRadius = 70,
8645
+ tickRadius = 20,
8646
+ diameter = dialRadius * 2,
8647
+ duration = transitionSupported ? 350 : 1;
8648
+
8649
+ // Popover template
8650
+ var tpl = ['<div class="clockpicker picker">', '<div class="picker__holder">', '<div class="picker__frame">', '<div class="picker__wrap">', '<div class="picker__box">', '<div class="picker__date-display">', '<div class="clockpicker-display">', '<div class="clockpicker-display-column">', '<span class="clockpicker-span-hours text-primary"></span>', ':', '<span class="clockpicker-span-minutes"></span>', '</div>', '<div class="clockpicker-display-column clockpicker-display-am-pm">', '<div class="clockpicker-span-am-pm"></div>', '</div>', '</div>', '</div>', '<div class="picker__container__wrapper">', '<div class="picker__calendar-container">', '<div class="clockpicker-plate">', '<div class="clockpicker-canvas"></div>', '<div class="clockpicker-dial clockpicker-hours"></div>', '<div class="clockpicker-dial clockpicker-minutes clockpicker-dial-out"></div>', '</div>', '<div class="clockpicker-am-pm-block">', '</div>', '</div>', '<div class="picker__footer">', '</div>', '</div>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
8651
+
8652
+ // ClockPicker
8653
+ function ClockPicker(element, options) {
8654
+ var popover = $(tpl),
8655
+ plate = popover.find('.clockpicker-plate'),
8656
+ holder = popover.find('.picker__holder'),
8657
+ hoursView = popover.find('.clockpicker-hours'),
8658
+ minutesView = popover.find('.clockpicker-minutes'),
8659
+ amPmBlock = popover.find('.clockpicker-am-pm-block'),
8660
+ isInput = element.prop('tagName') === 'INPUT',
8661
+ input = isInput ? element : element.find('input'),
8662
+ label = $("label[for=" + input.attr("id") + "]"),
8663
+ self = this;
8664
+
8665
+ this.id = uniqueId('cp');
8666
+ this.element = element;
8667
+ this.holder = holder;
8668
+ this.options = options;
8669
+ this.isAppended = false;
8670
+ this.isShown = false;
8671
+ this.currentView = 'hours';
8672
+ this.isInput = isInput;
8673
+ this.input = input;
8674
+ this.label = label;
8675
+ this.popover = popover;
8676
+ this.plate = plate;
8677
+ this.hoursView = hoursView;
8678
+ this.minutesView = minutesView;
8679
+ this.amPmBlock = amPmBlock;
8680
+ this.spanHours = popover.find('.clockpicker-span-hours');
8681
+ this.spanMinutes = popover.find('.clockpicker-span-minutes');
8682
+ this.spanAmPm = popover.find('.clockpicker-span-am-pm');
8683
+ this.footer = popover.find('.picker__footer');
8684
+ this.amOrPm = "PM";
8685
+
8686
+ // Setup for for 12 hour clock if option is selected
8687
+ if (options.twelvehour) {
8688
+ if (!options.ampmclickable) {
8689
+ this.spanAmPm.empty();
8690
+ $('<div id="click-am">AM</div>').appendTo(this.spanAmPm);
8691
+ $('<div id="click-pm">PM</div>').appendTo(this.spanAmPm);
8692
+ } else {
8693
+ this.spanAmPm.empty();
8694
+ $('<div id="click-am">AM</div>').on("click", function () {
8695
+ self.spanAmPm.children('#click-am').addClass("text-primary");
8696
+ self.spanAmPm.children('#click-pm').removeClass("text-primary");
8697
+ self.amOrPm = "AM";
8698
+ }).appendTo(this.spanAmPm);
8699
+ $('<div id="click-pm">PM</div>').on("click", function () {
8700
+ self.spanAmPm.children('#click-pm').addClass("text-primary");
8701
+ self.spanAmPm.children('#click-am').removeClass("text-primary");
8702
+ self.amOrPm = 'PM';
8703
+ }).appendTo(this.spanAmPm);
8704
+ }
8705
+ }
8706
+
8707
+ // Add buttons to footer
8708
+ $('<button type="button" class="btn-flat picker__clear" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.cleartext + '</button>').click($.proxy(this.clear, this)).appendTo(this.footer);
8709
+ $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.canceltext + '</button>').click($.proxy(this.hide, this)).appendTo(this.footer);
8710
+ $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.donetext + '</button>').click($.proxy(this.done, this)).appendTo(this.footer);
8711
+
8712
+ this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
8713
+ this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
8714
+
8715
+ // Show or toggle
8716
+ input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
8717
+
8718
+ // Build ticks
8719
+ var tickTpl = $('<div class="clockpicker-tick"></div>'),
8720
+ i,
8721
+ tick,
8722
+ radian,
8723
+ radius;
8724
+
8725
+ // Hours view
8726
+ if (options.twelvehour) {
8727
+ for (i = 1; i < 13; i += 1) {
8728
+ tick = tickTpl.clone();
8729
+ radian = i / 6 * Math.PI;
8730
+ radius = outerRadius;
8731
+ tick.css({
8732
+ left: dialRadius + Math.sin(radian) * radius - tickRadius,
8733
+ top: dialRadius - Math.cos(radian) * radius - tickRadius
8734
+ });
8735
+ tick.html(i === 0 ? '00' : i);
8736
+ hoursView.append(tick);
8737
+ tick.on(mousedownEvent, mousedown);
8738
+ }
8739
+ } else {
8740
+ for (i = 0; i < 24; i += 1) {
8741
+ tick = tickTpl.clone();
8742
+ radian = i / 6 * Math.PI;
8743
+ var inner = i > 0 && i < 13;
8744
+ radius = inner ? innerRadius : outerRadius;
8745
+ tick.css({
8746
+ left: dialRadius + Math.sin(radian) * radius - tickRadius,
8747
+ top: dialRadius - Math.cos(radian) * radius - tickRadius
8748
+ });
8749
+ tick.html(i === 0 ? '00' : i);
8750
+ hoursView.append(tick);
8751
+ tick.on(mousedownEvent, mousedown);
8752
+ }
8753
+ }
8754
+
8755
+ // Minutes view
8756
+ for (i = 0; i < 60; i += 5) {
8757
+ tick = tickTpl.clone();
8758
+ radian = i / 30 * Math.PI;
8759
+ tick.css({
8760
+ left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
8761
+ top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
8762
+ });
8763
+ tick.html(leadingZero(i));
8764
+ minutesView.append(tick);
8765
+ tick.on(mousedownEvent, mousedown);
8766
+ }
8767
+
8768
+ // Clicking on minutes view space
8769
+ plate.on(mousedownEvent, function (e) {
8770
+ if ($(e.target).closest('.clockpicker-tick').length === 0) {
8771
+ mousedown(e, true);
8772
+ }
8773
+ });
8774
+
8775
+ // Mousedown or touchstart
8776
+ function mousedown(e, space) {
8777
+ var offset = plate.offset(),
8778
+ isTouch = /^touch/.test(e.type),
8779
+ x0 = offset.left + dialRadius,
8780
+ y0 = offset.top + dialRadius,
8781
+ dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
8782
+ dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
8783
+ z = Math.sqrt(dx * dx + dy * dy),
8784
+ moved = false;
8785
+
8786
+ // When clicking on minutes view space, check the mouse position
8787
+ if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
8788
+ return;
8789
+ }
8790
+ e.preventDefault();
8791
+
8792
+ // Set cursor style of body after 200ms
8793
+ var movingTimer = setTimeout(function () {
8794
+ self.popover.addClass('clockpicker-moving');
8795
+ }, 200);
8796
+
8797
+ // Clock
8798
+ self.setHand(dx, dy, !space, true);
8799
+
8800
+ // Mousemove on document
8801
+ $doc.off(mousemoveEvent).on(mousemoveEvent, function (e) {
8802
+ e.preventDefault();
8803
+ var isTouch = /^touch/.test(e.type),
8804
+ x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
8805
+ y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
8806
+ if (!moved && x === dx && y === dy) {
8807
+ // Clicking in chrome on windows will trigger a mousemove event
8808
+ return;
8809
+ }
8810
+ moved = true;
8811
+ self.setHand(x, y, false, true);
8812
+ });
8813
+
8814
+ // Mouseup on document
8815
+ $doc.off(mouseupEvent).on(mouseupEvent, function (e) {
8816
+ $doc.off(mouseupEvent);
8817
+ e.preventDefault();
8818
+ var isTouch = /^touch/.test(e.type),
8819
+ x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
8820
+ y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
8821
+ if ((space || moved) && x === dx && y === dy) {
8822
+ self.setHand(x, y);
8823
+ }
8824
+
8825
+ if (self.currentView === 'hours') {
8826
+ self.toggleView('minutes', duration / 2);
8827
+ } else if (options.autoclose) {
8828
+ self.minutesView.addClass('clockpicker-dial-out');
8829
+ setTimeout(function () {
8830
+ self.done();
8831
+ }, duration / 2);
8832
+ }
8833
+ plate.prepend(canvas);
8834
+
8835
+ // Reset cursor style of body
8836
+ clearTimeout(movingTimer);
8837
+ self.popover.removeClass('clockpicker-moving');
8838
+
8839
+ // Unbind mousemove event
8840
+ $doc.off(mousemoveEvent);
8841
+ });
8842
+ }
8843
+
8844
+ if (svgSupported) {
8845
+ // Draw clock hands and others
8846
+ var canvas = popover.find('.clockpicker-canvas'),
8847
+ svg = createSvgElement('svg');
8848
+ svg.setAttribute('class', 'clockpicker-svg');
8849
+ svg.setAttribute('width', diameter);
8850
+ svg.setAttribute('height', diameter);
8851
+ var g = createSvgElement('g');
8852
+ g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
8853
+ var bearing = createSvgElement('circle');
8854
+ bearing.setAttribute('class', 'clockpicker-canvas-bearing');
8855
+ bearing.setAttribute('cx', 0);
8856
+ bearing.setAttribute('cy', 0);
8857
+ bearing.setAttribute('r', 4);
8858
+ var hand = createSvgElement('line');
8859
+ hand.setAttribute('x1', 0);
8860
+ hand.setAttribute('y1', 0);
8861
+ var bg = createSvgElement('circle');
8862
+ bg.setAttribute('class', 'clockpicker-canvas-bg');
8863
+ bg.setAttribute('r', tickRadius);
8864
+ g.appendChild(hand);
8865
+ g.appendChild(bg);
8866
+ g.appendChild(bearing);
8867
+ svg.appendChild(g);
8868
+ canvas.append(svg);
8869
+
8870
+ this.hand = hand;
8871
+ this.bg = bg;
8872
+ this.bearing = bearing;
8873
+ this.g = g;
8874
+ this.canvas = canvas;
8875
+ }
8876
+
8877
+ raiseCallback(this.options.init);
8878
+ }
8879
+
8880
+ function raiseCallback(callbackFunction) {
8881
+ if (callbackFunction && typeof callbackFunction === "function") callbackFunction();
8882
+ }
8883
+
8884
+ // Default options
8885
+ ClockPicker.DEFAULTS = {
8886
+ 'default': '', // default time, 'now' or '13:14' e.g.
8887
+ fromnow: 0, // set default time to * milliseconds from now (using with default = 'now')
8888
+ donetext: 'Ok', // done button text
8889
+ cleartext: 'Clear',
8890
+ canceltext: 'Cancel',
8891
+ autoclose: false, // auto close when minute is selected
8892
+ ampmclickable: true, // set am/pm button on itself
8893
+ darktheme: false, // set to dark theme
8894
+ twelvehour: true, // change to 12 hour AM/PM clock from 24 hour
8895
+ vibrate: true // vibrate the device when dragging clock hand
8896
+ };
8897
+
8898
+ // Show or hide popover
8899
+ ClockPicker.prototype.toggle = function () {
8900
+ this[this.isShown ? 'hide' : 'show']();
8901
+ };
8902
+
8903
+ // Set popover position
8904
+ ClockPicker.prototype.locate = function () {
8905
+ var element = this.element,
8906
+ popover = this.popover,
8907
+ offset = element.offset(),
8908
+ width = element.outerWidth(),
8909
+ height = element.outerHeight(),
8910
+ align = this.options.align,
8911
+ self = this;
8912
+
8913
+ popover.show();
8914
+ };
8915
+
8916
+ // Show popover
8917
+ ClockPicker.prototype.show = function (e) {
8918
+ // Not show again
8919
+ if (this.isShown) {
8920
+ return;
8921
+ }
8922
+ raiseCallback(this.options.beforeShow);
8923
+ $(':input').each(function () {
8924
+ $(this).attr('tabindex', -1);
8925
+ });
8926
+ var self = this;
8927
+ // Initialize
8928
+ this.input.blur();
8929
+ this.popover.addClass('picker--opened');
8930
+ this.input.addClass('picker__input picker__input--active');
8931
+ $(document.body).css('overflow', 'hidden');
8932
+ // Get the time
8933
+ var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
8934
+ if (this.options.twelvehour && !(typeof value[1] === 'undefined')) {
8935
+ if (value[1].indexOf("AM") > 0) {
8936
+ this.amOrPm = 'AM';
8937
+ } else {
8938
+ this.amOrPm = 'PM';
8939
+ }
8940
+ value[1] = value[1].replace("AM", "").replace("PM", "");
8941
+ }
8942
+ if (value[0] === 'now') {
8943
+ var now = new Date(+new Date() + this.options.fromnow);
8944
+ value = [now.getHours(), now.getMinutes()];
8945
+ if (this.options.twelvehour) {
8946
+ this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
8947
+ }
8948
+ }
8949
+ this.hours = +value[0] || 0;
8950
+ this.minutes = +value[1] || 0;
8951
+ this.spanHours.html(this.hours);
8952
+ this.spanMinutes.html(leadingZero(this.minutes));
8953
+ if (!this.isAppended) {
8954
+
8955
+ // Append popover to input by default
8956
+ var containerEl = document.querySelector(this.options.container);
8957
+ if (this.options.container && containerEl) {
8958
+ containerEl.appendChild(this.popover[0]);
8959
+ } else {
8960
+ this.popover.insertAfter(this.input);
8961
+ }
8962
+
8963
+ if (this.options.twelvehour) {
8964
+ if (this.amOrPm === 'PM') {
8965
+ this.spanAmPm.children('#click-pm').addClass("text-primary");
8966
+ this.spanAmPm.children('#click-am').removeClass("text-primary");
8967
+ } else {
8968
+ this.spanAmPm.children('#click-am').addClass("text-primary");
8969
+ this.spanAmPm.children('#click-pm').removeClass("text-primary");
8970
+ }
8971
+ }
8972
+ // Reset position when resize
8973
+ $win.on('resize.clockpicker' + this.id, function () {
8974
+ if (self.isShown) {
8975
+ self.locate();
8976
+ }
8977
+ });
8978
+ this.isAppended = true;
8979
+ }
8980
+ // Toggle to hours view
8981
+ this.toggleView('hours');
8982
+ // Set position
8983
+ this.locate();
8984
+ this.isShown = true;
8985
+ // Hide when clicking or tabbing on any element except the clock and input
8986
+ $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function (e) {
8987
+ var target = $(e.target);
8988
+ if (target.closest(self.popover.find('.picker__wrap')).length === 0 && target.closest(self.input).length === 0) {
8989
+ self.hide();
8990
+ }
8991
+ });
8992
+ // Hide when ESC is pressed
8993
+ $doc.on('keyup.clockpicker.' + this.id, function (e) {
8994
+ if (e.keyCode === 27) {
8995
+ self.hide();
8996
+ }
8997
+ });
8998
+ raiseCallback(this.options.afterShow);
8999
+ };
9000
+ // Hide popover
9001
+ ClockPicker.prototype.hide = function () {
9002
+ raiseCallback(this.options.beforeHide);
9003
+ this.input.removeClass('picker__input picker__input--active');
9004
+ this.popover.removeClass('picker--opened');
9005
+ $(document.body).css('overflow', 'visible');
9006
+ this.isShown = false;
9007
+ $(':input').each(function (index) {
9008
+ $(this).attr('tabindex', index + 1);
9009
+ });
9010
+ // Unbinding events on document
9011
+ $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
9012
+ $doc.off('keyup.clockpicker.' + this.id);
9013
+ this.popover.hide();
9014
+ raiseCallback(this.options.afterHide);
9015
+ };
9016
+ // Toggle to hours or minutes view
9017
+ ClockPicker.prototype.toggleView = function (view, delay) {
9018
+ var raiseAfterHourSelect = false;
9019
+ if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
9020
+ raiseCallback(this.options.beforeHourSelect);
9021
+ raiseAfterHourSelect = true;
9022
+ }
9023
+ var isHours = view === 'hours',
9024
+ nextView = isHours ? this.hoursView : this.minutesView,
9025
+ hideView = isHours ? this.minutesView : this.hoursView;
9026
+ this.currentView = view;
9027
+
9028
+ this.spanHours.toggleClass('text-primary', isHours);
9029
+ this.spanMinutes.toggleClass('text-primary', !isHours);
9030
+
9031
+ // Let's make transitions
9032
+ hideView.addClass('clockpicker-dial-out');
9033
+ nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
9034
+
9035
+ // Reset clock hand
9036
+ this.resetClock(delay);
9037
+
9038
+ // After transitions ended
9039
+ clearTimeout(this.toggleViewTimer);
9040
+ this.toggleViewTimer = setTimeout(function () {
9041
+ hideView.css('visibility', 'hidden');
9042
+ }, duration);
9043
+
9044
+ if (raiseAfterHourSelect) {
9045
+ raiseCallback(this.options.afterHourSelect);
9046
+ }
9047
+ };
9048
+
9049
+ // Reset clock hand
9050
+ ClockPicker.prototype.resetClock = function (delay) {
9051
+ var view = this.currentView,
9052
+ value = this[view],
9053
+ isHours = view === 'hours',
9054
+ unit = Math.PI / (isHours ? 6 : 30),
9055
+ radian = value * unit,
9056
+ radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
9057
+ x = Math.sin(radian) * radius,
9058
+ y = -Math.cos(radian) * radius,
9059
+ self = this;
9060
+
9061
+ if (svgSupported && delay) {
9062
+ self.canvas.addClass('clockpicker-canvas-out');
9063
+ setTimeout(function () {
9064
+ self.canvas.removeClass('clockpicker-canvas-out');
9065
+ self.setHand(x, y);
9066
+ }, delay);
9067
+ } else this.setHand(x, y);
9068
+ };
9069
+
9070
+ // Set clock hand to (x, y)
9071
+ ClockPicker.prototype.setHand = function (x, y, roundBy5, dragging) {
9072
+ var radian = Math.atan2(x, -y),
9073
+ isHours = this.currentView === 'hours',
9074
+ unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
9075
+ z = Math.sqrt(x * x + y * y),
9076
+ options = this.options,
9077
+ inner = isHours && z < (outerRadius + innerRadius) / 2,
9078
+ radius = inner ? innerRadius : outerRadius,
9079
+ value;
9080
+
9081
+ if (options.twelvehour) {
9082
+ radius = outerRadius;
9083
+ }
9084
+
9085
+ // Radian should in range [0, 2PI]
9086
+ if (radian < 0) {
9087
+ radian = Math.PI * 2 + radian;
9088
+ }
9089
+
9090
+ // Get the round value
9091
+ value = Math.round(radian / unit);
9092
+
9093
+ // Get the round radian
9094
+ radian = value * unit;
9095
+
9096
+ // Correct the hours or minutes
9097
+ if (options.twelvehour) {
9098
+ if (isHours) {
9099
+ if (value === 0) value = 12;
9100
+ } else {
9101
+ if (roundBy5) value *= 5;
9102
+ if (value === 60) value = 0;
9103
+ }
9104
+ } else {
9105
+ if (isHours) {
9106
+ if (value === 12) value = 0;
9107
+ value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
9108
+ } else {
9109
+ if (roundBy5) value *= 5;
9110
+ if (value === 60) value = 0;
9111
+ }
9112
+ }
9113
+
9114
+ // Once hours or minutes changed, vibrate the device
9115
+ if (this[this.currentView] !== value) {
9116
+ if (vibrate && this.options.vibrate) {
9117
+ // Do not vibrate too frequently
9118
+ if (!this.vibrateTimer) {
9119
+ navigator[vibrate](10);
9120
+ this.vibrateTimer = setTimeout($.proxy(function () {
9121
+ this.vibrateTimer = null;
9122
+ }, this), 100);
9123
+ }
9124
+ }
9125
+ }
9126
+
9127
+ this[this.currentView] = value;
9128
+ if (isHours) {
9129
+ this['spanHours'].html(value);
9130
+ } else {
9131
+ this['spanMinutes'].html(leadingZero(value));
9132
+ }
9133
+
9134
+ // If svg is not supported, just add an active class to the tick
9135
+ if (!svgSupported) {
9136
+ this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function () {
9137
+ var tick = $(this);
9138
+ tick.toggleClass('active', value === +tick.html());
9139
+ });
9140
+ return;
9141
+ }
9142
+
9143
+ // Set clock hand and others' position
9144
+ var cx1 = Math.sin(radian) * (radius - tickRadius),
9145
+ cy1 = -Math.cos(radian) * (radius - tickRadius),
9146
+ cx2 = Math.sin(radian) * radius,
9147
+ cy2 = -Math.cos(radian) * radius;
9148
+ this.hand.setAttribute('x2', cx1);
9149
+ this.hand.setAttribute('y2', cy1);
9150
+ this.bg.setAttribute('cx', cx2);
9151
+ this.bg.setAttribute('cy', cy2);
9152
+ };
9153
+
9154
+ // Hours and minutes are selected
9155
+ ClockPicker.prototype.done = function () {
9156
+ raiseCallback(this.options.beforeDone);
9157
+ this.hide();
9158
+ this.label.addClass('active');
9159
+
9160
+ var last = this.input.prop('value'),
9161
+ value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
9162
+ if (this.options.twelvehour) {
9163
+ value = value + this.amOrPm;
9164
+ }
9165
+
9166
+ this.input.prop('value', value);
9167
+ if (value !== last) {
9168
+ this.input.triggerHandler('change');
9169
+ if (!this.isInput) {
9170
+ this.element.trigger('change');
9171
+ }
9172
+ }
9173
+
9174
+ if (this.options.autoclose) this.input.trigger('blur');
9175
+
9176
+ raiseCallback(this.options.afterDone);
9177
+ };
9178
+
9179
+ // Clear input field
9180
+ ClockPicker.prototype.clear = function () {
9181
+ this.hide();
9182
+ this.label.removeClass('active');
9183
+
9184
+ var last = this.input.prop('value'),
9185
+ value = '';
9186
+
9187
+ this.input.prop('value', value);
9188
+ if (value !== last) {
9189
+ this.input.triggerHandler('change');
9190
+ if (!this.isInput) {
9191
+ this.element.trigger('change');
9192
+ }
9193
+ }
9194
+
9195
+ if (this.options.autoclose) {
9196
+ this.input.trigger('blur');
9197
+ }
9198
+ };
9199
+
9200
+ // Remove clockpicker from input
9201
+ ClockPicker.prototype.remove = function () {
9202
+ this.element.removeData('clockpicker');
9203
+ this.input.off('focus.clockpicker click.clockpicker');
9204
+ if (this.isShown) {
9205
+ this.hide();
9206
+ }
9207
+ if (this.isAppended) {
9208
+ $win.off('resize.clockpicker' + this.id);
9209
+ this.popover.remove();
9210
+ }
9211
+ };
9212
+
9213
+ // Extends $.fn.clockpicker
9214
+ $.fn.pickatime = function (option) {
9215
+ var args = Array.prototype.slice.call(arguments, 1);
9216
+ return this.each(function () {
9217
+ var $this = $(this),
9218
+ data = $this.data('clockpicker');
9219
+ if (!data) {
9220
+ var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
9221
+ $this.data('clockpicker', new ClockPicker($this, options));
9222
+ } else {
9223
+ // Manual operatsions. show, hide, remove, e.g.
9224
+ if (typeof data[option] === 'function') {
9225
+ data[option].apply(data, args);
9226
+ }
9227
+ }
9228
+ });
9229
+ };
9230
+ })(jQuery);
9231
+ ;(function ($) {
9232
+
9233
+ $.fn.characterCounter = function () {
9234
+ return this.each(function () {
9235
+ var $input = $(this);
9236
+ var $counterElement = $input.parent().find('span[class="character-counter"]');
9237
+
9238
+ // character counter has already been added appended to the parent container
9239
+ if ($counterElement.length) {
9240
+ return;
9241
+ }
9242
+
9243
+ var itHasLengthAttribute = $input.attr('data-length') !== undefined;
9244
+
9245
+ if (itHasLengthAttribute) {
9246
+ $input.on('input', updateCounter);
9247
+ $input.on('focus', updateCounter);
9248
+ $input.on('blur', removeCounterElement);
9249
+
9250
+ addCounterElement($input);
9251
+ }
9252
+ });
9253
+ };
9254
+
9255
+ function updateCounter() {
9256
+ var maxLength = +$(this).attr('data-length'),
9257
+ actualLength = +$(this).val().length,
9258
+ isValidLength = actualLength <= maxLength;
9259
+
9260
+ $(this).parent().find('span[class="character-counter"]').html(actualLength + '/' + maxLength);
9261
+
9262
+ addInputStyle(isValidLength, $(this));
9263
+ }
9264
+
9265
+ function addCounterElement($input) {
9266
+ var $counterElement = $input.parent().find('span[class="character-counter"]');
9267
+
9268
+ if ($counterElement.length) {
9269
+ return;
9270
+ }
9271
+
9272
+ $counterElement = $('<span/>').addClass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1);
9273
+
9274
+ $input.parent().append($counterElement);
9275
+ }
9276
+
9277
+ function removeCounterElement() {
9278
+ $(this).parent().find('span[class="character-counter"]').html('');
9279
+ }
9280
+
9281
+ function addInputStyle(isValidLength, $input) {
9282
+ var inputHasInvalidClass = $input.hasClass('invalid');
9283
+ if (isValidLength && inputHasInvalidClass) {
9284
+ $input.removeClass('invalid');
9285
+ } else if (!isValidLength && !inputHasInvalidClass) {
9286
+ $input.removeClass('valid');
9287
+ $input.addClass('invalid');
9288
+ }
9289
+ }
9290
+
9291
+ $(document).ready(function () {
9292
+ $('input, textarea').characterCounter();
9293
+ });
9294
+ })(jQuery);
9295
+ ;(function ($) {
9296
+
9297
+ var methods = {
9298
+
9299
+ init: function (options) {
9300
+ var defaults = {
9301
+ duration: 200, // ms
9302
+ dist: -100, // zoom scale TODO: make this more intuitive as an option
9303
+ shift: 0, // spacing for center image
9304
+ padding: 0, // Padding between non center items
9305
+ fullWidth: false, // Change to full width styles
9306
+ indicators: false, // Toggle indicators
9307
+ noWrap: false, // Don't wrap around and cycle through items.
9308
+ onCycleTo: null // Callback for when a new slide is cycled to.
9309
+ };
9310
+ options = $.extend(defaults, options);
9311
+ var namespace = Materialize.objectSelectorString($(this));
9312
+
9313
+ return this.each(function (i) {
9314
+
9315
+ var images, item_width, item_height, offset, center, pressed, dim, count, reference, referenceY, amplitude, target, velocity, scrolling, xform, frame, timestamp, ticker, dragged, vertical_dragged;
9316
+ var $indicators = $('<ul class="indicators"></ul>');
9317
+ var scrollingTimeout = null;
9318
+ var oneTimeCallback = null;
9319
+
9320
+ // Initialize
9321
+ var view = $(this);
9322
+ var hasMultipleSlides = view.find('.carousel-item').length > 1;
9323
+ var showIndicators = (view.attr('data-indicators') || options.indicators) && hasMultipleSlides;
9324
+ var noWrap = view.attr('data-no-wrap') || options.noWrap || !hasMultipleSlides;
9325
+ var uniqueNamespace = view.attr('data-namespace') || namespace + i;
9326
+ view.attr('data-namespace', uniqueNamespace);
9327
+
9328
+ // Options
9329
+ var setCarouselHeight = function (imageOnly) {
9330
+ var firstSlide = view.find('.carousel-item.active').length ? view.find('.carousel-item.active').first() : view.find('.carousel-item').first();
9331
+ var firstImage = firstSlide.find('img').first();
9332
+ if (firstImage.length) {
9333
+ if (firstImage[0].complete) {
9334
+ // If image won't trigger the load event
9335
+ var imageHeight = firstImage.height();
9336
+ if (imageHeight > 0) {
9337
+ view.css('height', firstImage.height());
9338
+ } else {
9339
+ // If image still has no height, use the natural dimensions to calculate
9340
+ var naturalWidth = firstImage[0].naturalWidth;
9341
+ var naturalHeight = firstImage[0].naturalHeight;
9342
+ var adjustedHeight = view.width() / naturalWidth * naturalHeight;
9343
+ view.css('height', adjustedHeight);
9344
+ }
9345
+ } else {
9346
+ // Get height when image is loaded normally
9347
+ firstImage.on('load', function () {
9348
+ view.css('height', $(this).height());
9349
+ });
9350
+ }
9351
+ } else if (!imageOnly) {
9352
+ var slideHeight = firstSlide.height();
9353
+ view.css('height', slideHeight);
9354
+ }
9355
+ };
9356
+
9357
+ if (options.fullWidth) {
9358
+ options.dist = 0;
9359
+ setCarouselHeight();
9360
+
9361
+ // Offset fixed items when indicators.
9362
+ if (showIndicators) {
9363
+ view.find('.carousel-fixed-item').addClass('with-indicators');
9364
+ }
9365
+ }
9366
+
9367
+ // Don't double initialize.
9368
+ if (view.hasClass('initialized')) {
9369
+ // Recalculate variables
9370
+ $(window).trigger('resize');
9371
+
9372
+ // Redraw carousel.
9373
+ view.trigger('carouselNext', [0.000001]);
9374
+ return true;
9375
+ }
9376
+
9377
+ view.addClass('initialized');
9378
+ pressed = false;
9379
+ offset = target = 0;
9380
+ images = [];
9381
+ item_width = view.find('.carousel-item').first().innerWidth();
9382
+ item_height = view.find('.carousel-item').first().innerHeight();
9383
+ dim = item_width * 2 + options.padding;
9384
+
9385
+ view.find('.carousel-item').each(function (i) {
9386
+ images.push($(this)[0]);
9387
+ if (showIndicators) {
9388
+ var $indicator = $('<li class="indicator-item"></li>');
9389
+
9390
+ // Add active to first by default.
9391
+ if (i === 0) {
9392
+ $indicator.addClass('active');
9393
+ }
9394
+
9395
+ // Handle clicks on indicators.
9396
+ $indicator.click(function (e) {
9397
+ e.stopPropagation();
9398
+
9399
+ var index = $(this).index();
9400
+ cycleTo(index);
9401
+ });
9402
+ $indicators.append($indicator);
9403
+ }
9404
+ });
9405
+
9406
+ if (showIndicators) {
9407
+ view.append($indicators);
9408
+ }
9409
+ count = images.length;
9410
+
9411
+ function setupEvents() {
9412
+ if (typeof window.ontouchstart !== 'undefined') {
9413
+ view.on('touchstart.carousel', tap);
9414
+ view.on('touchmove.carousel', drag);
9415
+ view.on('touchend.carousel', release);
9416
+ }
9417
+ view.on('mousedown.carousel', tap);
9418
+ view.on('mousemove.carousel', drag);
9419
+ view.on('mouseup.carousel', release);
9420
+ view.on('mouseleave.carousel', release);
9421
+ view.on('click.carousel', click);
9422
+ }
9423
+
9424
+ function xpos(e) {
9425
+ // touch event
9426
+ if (e.targetTouches && e.targetTouches.length >= 1) {
9427
+ return e.targetTouches[0].clientX;
9428
+ }
9429
+
9430
+ // mouse event
9431
+ return e.clientX;
9432
+ }
9433
+
9434
+ function ypos(e) {
9435
+ // touch event
9436
+ if (e.targetTouches && e.targetTouches.length >= 1) {
9437
+ return e.targetTouches[0].clientY;
9438
+ }
9439
+
9440
+ // mouse event
9441
+ return e.clientY;
9442
+ }
9443
+
9444
+ function wrap(x) {
9445
+ return x >= count ? x % count : x < 0 ? wrap(count + x % count) : x;
9446
+ }
9447
+
9448
+ function scroll(x) {
9449
+ // Track scrolling state
9450
+ scrolling = true;
9451
+ if (!view.hasClass('scrolling')) {
9452
+ view.addClass('scrolling');
9453
+ }
9454
+ if (scrollingTimeout != null) {
9455
+ window.clearTimeout(scrollingTimeout);
9456
+ }
9457
+ scrollingTimeout = window.setTimeout(function () {
9458
+ scrolling = false;
9459
+ view.removeClass('scrolling');
9460
+ }, options.duration);
9461
+
9462
+ // Start actual scroll
9463
+ var i, half, delta, dir, tween, el, alignment, xTranslation;
9464
+ var lastCenter = center;
9465
+
9466
+ offset = typeof x === 'number' ? x : offset;
9467
+ center = Math.floor((offset + dim / 2) / dim);
9468
+ delta = offset - center * dim;
9469
+ dir = delta < 0 ? 1 : -1;
9470
+ tween = -dir * delta * 2 / dim;
9471
+ half = count >> 1;
9472
+
9473
+ if (!options.fullWidth) {
9474
+ alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
9475
+ alignment += 'translateY(' + (view[0].clientHeight - item_height) / 2 + 'px)';
9476
+ } else {
9477
+ alignment = 'translateX(0)';
9478
+ }
9479
+
9480
+ // Set indicator active
9481
+ if (showIndicators) {
9482
+ var diff = center % count;
9483
+ var activeIndicator = $indicators.find('.indicator-item.active');
9484
+ if (activeIndicator.index() !== diff) {
9485
+ activeIndicator.removeClass('active');
9486
+ $indicators.find('.indicator-item').eq(diff).addClass('active');
9487
+ }
9488
+ }
9489
+
9490
+ // center
9491
+ // Don't show wrapped items.
9492
+ if (!noWrap || center >= 0 && center < count) {
9493
+ el = images[wrap(center)];
9494
+
9495
+ // Add active class to center item.
9496
+ if (!$(el).hasClass('active')) {
9497
+ view.find('.carousel-item').removeClass('active');
9498
+ $(el).addClass('active');
9499
+ }
9500
+ el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween * i + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
9501
+ el.style.zIndex = 0;
9502
+ if (options.fullWidth) {
9503
+ tweenedOpacity = 1;
9504
+ } else {
9505
+ tweenedOpacity = 1 - 0.2 * tween;
9506
+ }
9507
+ el.style.opacity = tweenedOpacity;
9508
+ el.style.display = 'block';
9509
+ }
9510
+
9511
+ for (i = 1; i <= half; ++i) {
9512
+ // right side
9513
+ if (options.fullWidth) {
9514
+ zTranslation = options.dist;
9515
+ tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
9516
+ } else {
9517
+ zTranslation = options.dist * (i * 2 + tween * dir);
9518
+ tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
9519
+ }
9520
+ // Don't show wrapped items.
9521
+ if (!noWrap || center + i < count) {
9522
+ el = images[wrap(center + i)];
9523
+ el.style[xform] = alignment + ' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
9524
+ el.style.zIndex = -i;
9525
+ el.style.opacity = tweenedOpacity;
9526
+ el.style.display = 'block';
9527
+ }
9528
+
9529
+ // left side
9530
+ if (options.fullWidth) {
9531
+ zTranslation = options.dist;
9532
+ tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
9533
+ } else {
9534
+ zTranslation = options.dist * (i * 2 - tween * dir);
9535
+ tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
9536
+ }
9537
+ // Don't show wrapped items.
9538
+ if (!noWrap || center - i >= 0) {
9539
+ el = images[wrap(center - i)];
9540
+ el.style[xform] = alignment + ' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
9541
+ el.style.zIndex = -i;
9542
+ el.style.opacity = tweenedOpacity;
9543
+ el.style.display = 'block';
9544
+ }
9545
+ }
9546
+
9547
+ // center
9548
+ // Don't show wrapped items.
9549
+ if (!noWrap || center >= 0 && center < count) {
9550
+ el = images[wrap(center)];
9551
+ el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
9552
+ el.style.zIndex = 0;
9553
+ if (options.fullWidth) {
9554
+ tweenedOpacity = 1;
9555
+ } else {
9556
+ tweenedOpacity = 1 - 0.2 * tween;
9557
+ }
9558
+ el.style.opacity = tweenedOpacity;
9559
+ el.style.display = 'block';
9560
+ }
9561
+
9562
+ // onCycleTo callback
9563
+ if (lastCenter !== center && typeof options.onCycleTo === "function") {
9564
+ var $curr_item = view.find('.carousel-item').eq(wrap(center));
9565
+ options.onCycleTo.call(this, $curr_item, dragged);
9566
+ }
9567
+
9568
+ // One time callback
9569
+ if (typeof oneTimeCallback === "function") {
9570
+ oneTimeCallback.call(this, $curr_item, dragged);
9571
+ oneTimeCallback = null;
9572
+ }
9573
+ }
9574
+
9575
+ function track() {
9576
+ var now, elapsed, delta, v;
9577
+
9578
+ now = Date.now();
9579
+ elapsed = now - timestamp;
9580
+ timestamp = now;
9581
+ delta = offset - frame;
9582
+ frame = offset;
9583
+
9584
+ v = 1000 * delta / (1 + elapsed);
9585
+ velocity = 0.8 * v + 0.2 * velocity;
9586
+ }
9587
+
9588
+ function autoScroll() {
9589
+ var elapsed, delta;
9590
+
9591
+ if (amplitude) {
9592
+ elapsed = Date.now() - timestamp;
9593
+ delta = amplitude * Math.exp(-elapsed / options.duration);
9594
+ if (delta > 2 || delta < -2) {
9595
+ scroll(target - delta);
9596
+ requestAnimationFrame(autoScroll);
9597
+ } else {
9598
+ scroll(target);
9599
+ }
9600
+ }
9601
+ }
9602
+
9603
+ function click(e) {
9604
+ // Disable clicks if carousel was dragged.
9605
+ if (dragged) {
9606
+ e.preventDefault();
9607
+ e.stopPropagation();
9608
+ return false;
9609
+ } else if (!options.fullWidth) {
9610
+ var clickedIndex = $(e.target).closest('.carousel-item').index();
9611
+ var diff = wrap(center) - clickedIndex;
9612
+
9613
+ // Disable clicks if carousel was shifted by click
9614
+ if (diff !== 0) {
9615
+ e.preventDefault();
9616
+ e.stopPropagation();
9617
+ }
9618
+ cycleTo(clickedIndex);
9619
+ }
9620
+ }
9621
+
9622
+ function cycleTo(n) {
9623
+ var diff = center % count - n;
9624
+
9625
+ // Account for wraparound.
9626
+ if (!noWrap) {
9627
+ if (diff < 0) {
9628
+ if (Math.abs(diff + count) < Math.abs(diff)) {
9629
+ diff += count;
9630
+ }
9631
+ } else if (diff > 0) {
9632
+ if (Math.abs(diff - count) < diff) {
9633
+ diff -= count;
9634
+ }
9635
+ }
9636
+ }
9637
+
9638
+ // Call prev or next accordingly.
9639
+ if (diff < 0) {
9640
+ view.trigger('carouselNext', [Math.abs(diff)]);
9641
+ } else if (diff > 0) {
9642
+ view.trigger('carouselPrev', [diff]);
9643
+ }
9644
+ }
9645
+
9646
+ function tap(e) {
9647
+ // Fixes firefox draggable image bug
9648
+ if (e.type === 'mousedown' && $(e.target).is('img')) {
9649
+ e.preventDefault();
9650
+ }
9651
+ pressed = true;
9652
+ dragged = false;
9653
+ vertical_dragged = false;
9654
+ reference = xpos(e);
9655
+ referenceY = ypos(e);
9656
+
9657
+ velocity = amplitude = 0;
9658
+ frame = offset;
9659
+ timestamp = Date.now();
9660
+ clearInterval(ticker);
9661
+ ticker = setInterval(track, 100);
9662
+ }
9663
+
9664
+ function drag(e) {
9665
+ var x, delta, deltaY;
9666
+ if (pressed) {
9667
+ x = xpos(e);
9668
+ y = ypos(e);
9669
+ delta = reference - x;
9670
+ deltaY = Math.abs(referenceY - y);
9671
+ if (deltaY < 30 && !vertical_dragged) {
9672
+ // If vertical scrolling don't allow dragging.
9673
+ if (delta > 2 || delta < -2) {
9674
+ dragged = true;
9675
+ reference = x;
9676
+ scroll(offset + delta);
9677
+ }
9678
+ } else if (dragged) {
9679
+ // If dragging don't allow vertical scroll.
9680
+ e.preventDefault();
9681
+ e.stopPropagation();
9682
+ return false;
9683
+ } else {
9684
+ // Vertical scrolling.
9685
+ vertical_dragged = true;
9686
+ }
9687
+ }
9688
+
9689
+ if (dragged) {
9690
+ // If dragging don't allow vertical scroll.
9691
+ e.preventDefault();
9692
+ e.stopPropagation();
9693
+ return false;
9694
+ }
9695
+ }
9696
+
9697
+ function release(e) {
9698
+ if (pressed) {
9699
+ pressed = false;
9700
+ } else {
9701
+ return;
9702
+ }
9703
+
9704
+ clearInterval(ticker);
9705
+ target = offset;
9706
+ if (velocity > 10 || velocity < -10) {
9707
+ amplitude = 0.9 * velocity;
9708
+ target = offset + amplitude;
9709
+ }
9710
+ target = Math.round(target / dim) * dim;
9711
+
9712
+ // No wrap of items.
9713
+ if (noWrap) {
9714
+ if (target >= dim * (count - 1)) {
9715
+ target = dim * (count - 1);
9716
+ } else if (target < 0) {
9717
+ target = 0;
9718
+ }
9719
+ }
9720
+ amplitude = target - offset;
9721
+ timestamp = Date.now();
9722
+ requestAnimationFrame(autoScroll);
9723
+
9724
+ if (dragged) {
9725
+ e.preventDefault();
9726
+ e.stopPropagation();
9727
+ }
9728
+ return false;
9729
+ }
9730
+
9731
+ xform = 'transform';
9732
+ ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
9733
+ var e = prefix + 'Transform';
9734
+ if (typeof document.body.style[e] !== 'undefined') {
9735
+ xform = e;
9736
+ return false;
9737
+ }
9738
+ return true;
9739
+ });
9740
+
9741
+ var throttledResize = Materialize.throttle(function () {
9742
+ if (options.fullWidth) {
9743
+ item_width = view.find('.carousel-item').first().innerWidth();
9744
+ var imageHeight = view.find('.carousel-item.active').height();
9745
+ dim = item_width * 2 + options.padding;
9746
+ offset = center * 2 * item_width;
9747
+ target = offset;
9748
+ setCarouselHeight(true);
9749
+ } else {
9750
+ scroll();
9751
+ }
9752
+ }, 200);
9753
+ $(window).off('resize.carousel-' + uniqueNamespace).on('resize.carousel-' + uniqueNamespace, throttledResize);
9754
+
9755
+ setupEvents();
9756
+ scroll(offset);
9757
+
9758
+ $(this).on('carouselNext', function (e, n, callback) {
9759
+ if (n === undefined) {
9760
+ n = 1;
9761
+ }
9762
+ if (typeof callback === "function") {
9763
+ oneTimeCallback = callback;
9764
+ }
9765
+
9766
+ target = dim * Math.round(offset / dim) + dim * n;
9767
+ if (offset !== target) {
9768
+ amplitude = target - offset;
9769
+ timestamp = Date.now();
9770
+ requestAnimationFrame(autoScroll);
9771
+ }
9772
+ });
9773
+
9774
+ $(this).on('carouselPrev', function (e, n, callback) {
9775
+ if (n === undefined) {
9776
+ n = 1;
9777
+ }
9778
+ if (typeof callback === "function") {
9779
+ oneTimeCallback = callback;
9780
+ }
9781
+
9782
+ target = dim * Math.round(offset / dim) - dim * n;
9783
+ if (offset !== target) {
9784
+ amplitude = target - offset;
9785
+ timestamp = Date.now();
9786
+ requestAnimationFrame(autoScroll);
9787
+ }
9788
+ });
9789
+
9790
+ $(this).on('carouselSet', function (e, n, callback) {
9791
+ if (n === undefined) {
9792
+ n = 0;
9793
+ }
9794
+ if (typeof callback === "function") {
9795
+ oneTimeCallback = callback;
9796
+ }
9797
+
9798
+ cycleTo(n);
9799
+ });
9800
+ });
9801
+ },
9802
+ next: function (n, callback) {
9803
+ $(this).trigger('carouselNext', [n, callback]);
9804
+ },
9805
+ prev: function (n, callback) {
9806
+ $(this).trigger('carouselPrev', [n, callback]);
9807
+ },
9808
+ set: function (n, callback) {
9809
+ $(this).trigger('carouselSet', [n, callback]);
9810
+ },
9811
+ destroy: function () {
9812
+ var uniqueNamespace = $(this).attr('data-namespace');
9813
+ $(this).removeAttr('data-namespace');
9814
+ $(this).removeClass('initialized');
9815
+ $(this).find('.indicators').remove();
9816
+
9817
+ // Remove event handlers
9818
+ $(this).off('carouselNext carouselPrev carouselSet');
9819
+ $(window).off('resize.carousel-' + uniqueNamespace);
9820
+ if (typeof window.ontouchstart !== 'undefined') {
9821
+ $(this).off('touchstart.carousel touchmove.carousel touchend.carousel');
9822
+ }
9823
+ $(this).off('mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel');
9824
+ }
9825
+ };
9826
+
9827
+ $.fn.carousel = function (methodOrOptions) {
9828
+ if (methods[methodOrOptions]) {
9829
+ return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
9830
+ } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
9831
+ // Default to "init"
9832
+ return methods.init.apply(this, arguments);
9833
+ } else {
9834
+ $.error('Method ' + methodOrOptions + ' does not exist on jQuery.carousel');
9835
+ }
9836
+ }; // Plugin end
9837
+ })(jQuery);
9838
+ ;(function ($) {
9839
+
9840
+ var methods = {
9841
+ init: function (options) {
9842
+ return this.each(function () {
9843
+ var origin = $('#' + $(this).attr('data-activates'));
9844
+ var screen = $('body');
9845
+
9846
+ // Creating tap target
9847
+ var tapTargetEl = $(this);
9848
+ var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
9849
+ var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
9850
+ var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
9851
+ var tapTargetContentEl = tapTargetEl.find('.tap-target-content');
9852
+
9853
+ // Creating wrapper
9854
+ if (!tapTargetWrapper.length) {
9855
+ tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
9856
+ }
9857
+
9858
+ // Creating content
9859
+ if (!tapTargetContentEl.length) {
9860
+ tapTargetContentEl = $('<div class="tap-target-content"></div>');
9861
+ tapTargetEl.append(tapTargetContentEl);
9862
+ }
9863
+
9864
+ // Creating foreground wave
9865
+ if (!tapTargetWave.length) {
9866
+ tapTargetWave = $('<div class="tap-target-wave"></div>');
9867
+
9868
+ // Creating origin
9869
+ if (!tapTargetOriginEl.length) {
9870
+ tapTargetOriginEl = origin.clone(true, true);
9871
+ tapTargetOriginEl.addClass('tap-target-origin');
9872
+ tapTargetOriginEl.removeAttr('id');
9873
+ tapTargetOriginEl.removeAttr('style');
9874
+ tapTargetWave.append(tapTargetOriginEl);
9875
+ }
9876
+
9877
+ tapTargetWrapper.append(tapTargetWave);
9878
+ }
9879
+
9880
+ // Open
9881
+ var openTapTarget = function () {
9882
+ if (tapTargetWrapper.is('.open')) {
9883
+ return;
9884
+ }
9885
+
9886
+ // Adding open class
9887
+ tapTargetWrapper.addClass('open');
9888
+
9889
+ setTimeout(function () {
9890
+ tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function (e) {
9891
+ closeTapTarget();
9892
+ tapTargetOriginEl.off('click.tapTarget');
9893
+ });
9894
+
9895
+ $(document).off('click.tapTarget').on('click.tapTarget', function (e) {
9896
+ closeTapTarget();
9897
+ $(document).off('click.tapTarget');
9898
+ });
9899
+
9900
+ var throttledCalc = Materialize.throttle(function () {
9901
+ calculateTapTarget();
9902
+ }, 200);
9903
+ $(window).off('resize.tapTarget').on('resize.tapTarget', throttledCalc);
9904
+ }, 0);
9905
+ };
9906
+
9907
+ // Close
9908
+ var closeTapTarget = function () {
9909
+ if (!tapTargetWrapper.is('.open')) {
9910
+ return;
9911
+ }
9912
+
9913
+ tapTargetWrapper.removeClass('open');
9914
+ tapTargetOriginEl.off('click.tapTarget');
9915
+ $(document).off('click.tapTarget');
9916
+ $(window).off('resize.tapTarget');
9917
+ };
9918
+
9919
+ // Pre calculate
9920
+ var calculateTapTarget = function () {
9921
+ // Element or parent is fixed position?
9922
+ var isFixed = origin.css('position') === 'fixed';
9923
+ if (!isFixed) {
9924
+ var parents = origin.parents();
9925
+ for (var i = 0; i < parents.length; i++) {
9926
+ isFixed = $(parents[i]).css('position') == 'fixed';
9927
+ if (isFixed) {
9928
+ break;
9929
+ }
9930
+ }
9931
+ }
9932
+
9933
+ // Calculating origin
9934
+ var originWidth = origin.outerWidth();
9935
+ var originHeight = origin.outerHeight();
9936
+ var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
9937
+ var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left;
9938
+
9939
+ // Calculating screen
9940
+ var windowWidth = $(window).width();
9941
+ var windowHeight = $(window).height();
9942
+ var centerX = windowWidth / 2;
9943
+ var centerY = windowHeight / 2;
9944
+ var isLeft = originLeft <= centerX;
9945
+ var isRight = originLeft > centerX;
9946
+ var isTop = originTop <= centerY;
9947
+ var isBottom = originTop > centerY;
9948
+ var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
9949
+ var isCenterY = originTop >= windowHeight * 0.25 && originTop <= windowHeight * 0.75;
9950
+
9951
+ // Calculating tap target
9952
+ var tapTargetWidth = tapTargetEl.outerWidth();
9953
+ var tapTargetHeight = tapTargetEl.outerHeight();
9954
+ var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
9955
+ var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
9956
+ var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
9957
+
9958
+ // Calculating content
9959
+ var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
9960
+ var tapTargetTextHeight = tapTargetHeight / 2;
9961
+ var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
9962
+ var tapTargetTextBottom = 0;
9963
+ var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
9964
+ var tapTargetTextRight = 0;
9965
+ var tapTargetTextPadding = originWidth;
9966
+ var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
9967
+
9968
+ // Calculating wave
9969
+ var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
9970
+ var tapTargetWaveHeight = tapTargetWaveWidth;
9971
+ var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
9972
+ var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
9973
+
9974
+ // Setting tap target
9975
+ var tapTargetWrapperCssObj = {};
9976
+ tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
9977
+ tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
9978
+ tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
9979
+ tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
9980
+ tapTargetWrapperCssObj.position = tapTargetPosition;
9981
+ tapTargetWrapper.css(tapTargetWrapperCssObj);
9982
+
9983
+ // Setting content
9984
+ tapTargetContentEl.css({
9985
+ width: tapTargetTextWidth,
9986
+ height: tapTargetTextHeight,
9987
+ top: tapTargetTextTop,
9988
+ right: tapTargetTextRight,
9989
+ bottom: tapTargetTextBottom,
9990
+ left: tapTargetTextLeft,
9991
+ padding: tapTargetTextPadding,
9992
+ verticalAlign: tapTargetTextAlign
9993
+ });
9994
+
9995
+ // Setting wave
9996
+ tapTargetWave.css({
9997
+ top: tapTargetWaveTop,
9998
+ left: tapTargetWaveLeft,
9999
+ width: tapTargetWaveWidth,
10000
+ height: tapTargetWaveHeight
10001
+ });
10002
+ };
10003
+
10004
+ if (options == 'open') {
10005
+ calculateTapTarget();
10006
+ openTapTarget();
10007
+ }
10008
+
10009
+ if (options == 'close') closeTapTarget();
10010
+ });
10011
+ },
10012
+ open: function () {},
10013
+ close: function () {}
10014
+ };
10015
+
10016
+ $.fn.tapTarget = function (methodOrOptions) {
10017
+ if (methods[methodOrOptions] || typeof methodOrOptions === 'object') return methods.init.apply(this, arguments);
10018
+
10019
+ $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tap-target');
10020
+ };
10021
+ })(jQuery);
admin/scripts/materialize.min.js CHANGED
@@ -1,9 +1,6 @@
1
- /*!
2
- * Materialize v0.95.3 (http://materializecss.com)
3
- * Copyright 2014-2015 Materialize
4
- * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
- */
6
- function toast(a,b,c,d){function e(a){var b=jQuery("<div class='toast'></div>").addClass(c).html(a);return b.hammer({prevent_default:!1}).bind("pan",function(a){var c=a.gesture.deltaX,d=80;b.hasClass("panning")||b.addClass("panning");var e=1-Math.abs(c/d);0>e&&(e=0),b.velocity({left:c,opacity:e},{duration:50,queue:!1,easing:"easeOutQuad"})}).bind("panend",function(a){var c=a.gesture.deltaX,e=80;Math.abs(c)>e?b.velocity({marginTop:"-40px"},{duration:375,easing:"easeOutExpo",queue:!1,complete:function(){"function"==typeof d&&d(),b.remove()}}):(b.removeClass("panning"),b.velocity({left:0,opacity:1},{duration:300,easing:"easeOutExpo",queue:!1}))}),b}if(c=c||"",0==jQuery("#toast-container").length){var f=jQuery("<div></div>").attr("id","toast-container");jQuery("body").append(f)}var f=jQuery("#toast-container"),g=e(a);f.append(g),g.css({top:parseFloat(g.css("top"))+35+"px",opacity:0}),g.velocity({top:"0px",opacity:1},{duration:300,easing:"easeOutCubic",queue:!1});var h=b,i=setInterval(function(){0===g.parent().length&&window.clearInterval(i),g.hasClass("panning")||(h-=100),0>=h&&(g.velocity({opacity:0,marginTop:"-40px"},{duration:375,easing:"easeOutExpo",queue:!1,complete:function(){"function"==typeof d&&d(),$(this).remove()}}),window.clearInterval(i))},100)}jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return 0==b?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return 0==b?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(0==b)return c;if(1==(b/=e))return c+d;if(g||(g=.3*e),h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin(2*(b*e-f)*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(0==b)return c;if(1==(b/=e))return c+d;if(g||(g=.3*e),h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin(2*(b*e-f)*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(0==b)return c;if(2==(b/=e/2))return c+d;if(g||(g=.3*e*1.5),h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return 1>b?-.5*h*Math.pow(2,10*(b-=1))*Math.sin(2*(b*e-f)*Math.PI/g)+c:h*Math.pow(2,-10*(b-=1))*Math.sin(2*(b*e-f)*Math.PI/g)*.5+d+c},easeInBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),(b/=e/2)<1?d/2*b*b*(((f*=1.525)+1)*b-f)+c:d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-jQuery.easing.easeOutBounce(a,e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?7.5625*d*b*b+c:2/2.75>b?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:2.5/2.75>b?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c},easeInOutBounce:function(a,b,c,d,e){return e/2>b?.5*jQuery.easing.easeInBounce(a,2*b,0,d,e)+c:.5*jQuery.easing.easeOutBounce(a,2*b-e,0,d,e)+.5*d+c}}),jQuery.extend(jQuery.easing,{easeInOutMaterial:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:d/4*((b-=2)*b*b+2)+c}}),!function(a){function b(a){var b=a.length,d=c.type(a);return"function"===d||c.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===d||0===b||"number"==typeof b&&b>0&&b-1 in a}if(!a.jQuery){var c=function(a,b){return new c.fn.init(a,b)};c.isWindow=function(a){return null!=a&&a==a.window},c.type=function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?e[g.call(a)]||"object":typeof a},c.isArray=Array.isArray||function(a){return"array"===c.type(a)},c.isPlainObject=function(a){var b;if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!f.call(a,"constructor")&&!f.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}for(b in a);return void 0===b||f.call(a,b)},c.each=function(a,c,d){var e,f=0,g=a.length,h=b(a);if(d){if(h)for(;g>f&&(e=c.apply(a[f],d),e!==!1);f++);else for(f in a)if(e=c.apply(a[f],d),e===!1)break}else if(h)for(;g>f&&(e=c.call(a[f],f,a[f]),e!==!1);f++);else for(f in a)if(e=c.call(a[f],f,a[f]),e===!1)break;return a},c.data=function(a,b,e){if(void 0===e){var f=a[c.expando],g=f&&d[f];if(void 0===b)return g;if(g&&b in g)return g[b]}else if(void 0!==b){var f=a[c.expando]||(a[c.expando]=++c.uuid);return d[f]=d[f]||{},d[f][b]=e,e}},c.removeData=function(a,b){var e=a[c.expando],f=e&&d[e];f&&c.each(b,function(a,b){delete f[b]})},c.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[i]||{},i++),"object"!=typeof h&&"function"!==c.type(h)&&(h={}),i===j&&(h=this,i--);j>i;i++)if(null!=(f=arguments[i]))for(e in f)a=h[e],d=f[e],h!==d&&(k&&d&&(c.isPlainObject(d)||(b=c.isArray(d)))?(b?(b=!1,g=a&&c.isArray(a)?a:[]):g=a&&c.isPlainObject(a)?a:{},h[e]=c.extend(k,g,d)):void 0!==d&&(h[e]=d));return h},c.queue=function(a,d,e){function f(a,c){var d=c||[];return null!=a&&(b(Object(a))?!function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;)a[e++]=b[d++];if(c!==c)for(;void 0!==b[d];)a[e++]=b[d++];return a.length=e,a}(d,"string"==typeof a?[a]:a):[].push.call(d,a)),d}if(a){d=(d||"fx")+"queue";var g=c.data(a,d);return e?(!g||c.isArray(e)?g=c.data(a,d,f(e)):g.push(e),g):g||[]}},c.dequeue=function(a,b){c.each(a.nodeType?[a]:a,function(a,d){b=b||"fx";var e=c.queue(d,b),f=e.shift();"inprogress"===f&&(f=e.shift()),f&&("fx"===b&&e.unshift("inprogress"),f.call(d,function(){c.dequeue(d,b)}))})},c.fn=c.prototype={init:function(a){if(a.nodeType)return this[0]=a,this;throw new Error("Not a DOM node.")},offset:function(){var b=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:b.top+(a.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:b.left+(a.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function a(){for(var a=this.offsetParent||document;a&&"html"===!a.nodeType.toLowerCase&&"static"===a.style.position;)a=a.offsetParent;return a||document}var b=this[0],a=a.apply(b),d=this.offset(),e=/^(?:body|html)$/i.test(a.nodeName)?{top:0,left:0}:c(a).offset();return d.top-=parseFloat(b.style.marginTop)||0,d.left-=parseFloat(b.style.marginLeft)||0,a.style&&(e.top+=parseFloat(a.style.borderTopWidth)||0,e.left+=parseFloat(a.style.borderLeftWidth)||0),{top:d.top-e.top,left:d.left-e.left}}};var d={};c.expando="velocity"+(new Date).getTime(),c.uuid=0;for(var e={},f=e.hasOwnProperty,g=e.toString,h="Boolean Number String Function Array Date RegExp Object Error".split(" "),i=0;i<h.length;i++)e["[object "+h[i]+"]"]=h[i].toLowerCase();c.fn.init.prototype=c.fn,a.Velocity={Utilities:c}}}(window),function(a){"object"==typeof module&&"object"==typeof module.exports?module.exports=a():"function"==typeof define&&define.amd?define(a):a()}(function(){return function(a,b,c,d){function e(a){for(var b=-1,c=a?a.length:0,d=[];++b<c;){var e=a[b];e&&d.push(e)}return d}function f(a){return p.isWrapped(a)?a=[].slice.call(a):p.isNode(a)&&(a=[a]),a}function g(a){var b=m.data(a,"velocity");return null===b?d:b}function h(a){return function(b){return Math.round(b*a)*(1/a)}}function i(a,c,d,e){function f(a,b){return 1-3*b+3*a}function g(a,b){return 3*b-6*a}function h(a){return 3*a}function i(a,b,c){return((f(b,c)*a+g(b,c))*a+h(b))*a}function j(a,b,c){return 3*f(b,c)*a*a+2*g(b,c)*a+h(b)}function k(b,c){for(var e=0;p>e;++e){var f=j(c,a,d);if(0===f)return c;var g=i(c,a,d)-b;c-=g/f}return c}function l(){for(var b=0;t>b;++b)x[b]=i(b*u,a,d)}function m(b,c,e){var f,g,h=0;do g=c+(e-c)/2,f=i(g,a,d)-b,f>0?e=g:c=g;while(Math.abs(f)>r&&++h<s);return g}function n(b){for(var c=0,e=1,f=t-1;e!=f&&x[e]<=b;++e)c+=u;--e;var g=(b-x[e])/(x[e+1]-x[e]),h=c+g*u,i=j(h,a,d);return i>=q?k(b,h):0==i?h:m(b,c,c+u)}function o(){y=!0,(a!=c||d!=e)&&l()}var p=4,q=.001,r=1e-7,s=10,t=11,u=1/(t-1),v="Float32Array"in b;if(4!==arguments.length)return!1;for(var w=0;4>w;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))return!1;a=Math.min(a,1),d=Math.min(d,1),a=Math.max(a,0),d=Math.max(d,0);var x=v?new Float32Array(t):new Array(t),y=!1,z=function(b){return y||o(),a===c&&d===e?b:0===b?0:1===b?1:i(n(b),c,e)};z.getControlPoints=function(){return[{x:a,y:c},{x:d,y:e}]};var A="generateBezier("+[a,c,d,e]+")";return z.toString=function(){return A},z}function j(a,b){var c=a;return p.isString(a)?t.Easings[a]||(c=!1):c=p.isArray(a)&&1===a.length?h.apply(null,a):p.isArray(a)&&2===a.length?u.apply(null,a.concat([b])):p.isArray(a)&&4===a.length?i.apply(null,a):!1,c===!1&&(c=t.Easings[t.defaults.easing]?t.defaults.easing:s),c}function k(a){if(a)for(var b=(new Date).getTime(),c=0,e=t.State.calls.length;e>c;c++)if(t.State.calls[c]){var f=t.State.calls[c],h=f[0],i=f[2],j=f[3],n=!!j;j||(j=t.State.calls[c][3]=b-16);for(var o=Math.min((b-j)/i.duration,1),q=0,r=h.length;r>q;q++){var s=h[q],u=s.element;if(g(u)){var w=!1;if(i.display!==d&&null!==i.display&&"none"!==i.display){if("flex"===i.display){var y=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];m.each(y,function(a,b){v.setPropertyValue(u,"display",b)})}v.setPropertyValue(u,"display",i.display)}i.visibility!==d&&"hidden"!==i.visibility&&v.setPropertyValue(u,"visibility",i.visibility);for(var z in s)if("element"!==z){var A,B=s[z],C=p.isString(B.easing)?t.Easings[B.easing]:B.easing;if(1===o)A=B.endValue;else if(A=B.startValue+(B.endValue-B.startValue)*C(o),!n&&A===B.currentValue)continue;if(B.currentValue=A,v.Hooks.registered[z]){var D=v.Hooks.getRoot(z),E=g(u).rootPropertyValueCache[D];E&&(B.rootPropertyValue=E)}var F=v.setPropertyValue(u,z,B.currentValue+(0===parseFloat(A)?"":B.unitType),B.rootPropertyValue,B.scrollData);v.Hooks.registered[z]&&(g(u).rootPropertyValueCache[D]=v.Normalizations.registered[D]?v.Normalizations.registered[D]("extract",null,F[1]):F[1]),"transform"===F[0]&&(w=!0)}i.mobileHA&&g(u).transformCache.translate3d===d&&(g(u).transformCache.translate3d="(0px, 0px, 0px)",w=!0),w&&v.flushTransformCache(u)}}i.display!==d&&"none"!==i.display&&(t.State.calls[c][2].display=!1),i.visibility!==d&&"hidden"!==i.visibility&&(t.State.calls[c][2].visibility=!1),i.progress&&i.progress.call(f[1],f[1],o,Math.max(0,j+i.duration-b),j),1===o&&l(c)}t.State.isTicking&&x(k)}function l(a,b){if(!t.State.calls[a])return!1;for(var c=t.State.calls[a][0],e=t.State.calls[a][1],f=t.State.calls[a][2],h=t.State.calls[a][4],i=!1,j=0,k=c.length;k>j;j++){var l=c[j].element;if(b||f.loop||("none"===f.display&&v.setPropertyValue(l,"display",f.display),"hidden"===f.visibility&&v.setPropertyValue(l,"visibility",f.visibility)),f.loop!==!0&&(m.queue(l)[1]===d||!/\.velocityQueueEntryFlag/i.test(m.queue(l)[1]))&&g(l)){g(l).isAnimating=!1,g(l).rootPropertyValueCache={};var n=!1;m.each(v.Lists.transforms3D,function(a,b){var c=/^scale/.test(b)?1:0,e=g(l).transformCache[b];g(l).transformCache[b]!==d&&new RegExp("^\\("+c+"[^.]").test(e)&&(n=!0,delete g(l).transformCache[b])}),f.mobileHA&&(n=!0,delete g(l).transformCache.translate3d),n&&v.flushTransformCache(l),v.Values.removeClass(l,"velocity-animating")}if(!b&&f.complete&&!f.loop&&j===k-1)try{f.complete.call(e,e)}catch(o){setTimeout(function(){throw o},1)}h&&f.loop!==!0&&h(e),f.loop!==!0||b||(m.each(g(l).tweensContainer,function(a,b){/^rotate/.test(a)&&360===parseFloat(b.endValue)&&(b.endValue=0,b.startValue=360)}),t(l,"reverse",{loop:!0,delay:f.delay})),f.queue!==!1&&m.dequeue(l,f.queue)}t.State.calls[a]=!1;for(var p=0,q=t.State.calls.length;q>p;p++)if(t.State.calls[p]!==!1){i=!0;break}i===!1&&(t.State.isTicking=!1,delete t.State.calls,t.State.calls=[])}var m,n=function(){if(c.documentMode)return c.documentMode;for(var a=7;a>4;a--){var b=c.createElement("div");if(b.innerHTML="<!--[if IE "+a+"]><span></span><![endif]-->",b.getElementsByTagName("span").length)return b=null,a}return d}(),o=function(){var a=0;return b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||function(b){var c,d=(new Date).getTime();return c=Math.max(0,16-(d-a)),a=d+c,setTimeout(function(){b(d+c)},c)}}(),p={isString:function(a){return"string"==typeof a},isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},isFunction:function(a){return"[object Function]"===Object.prototype.toString.call(a)},isNode:function(a){return a&&a.nodeType},isNodeList:function(a){return"object"==typeof a&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(a))&&a.length!==d&&(0===a.length||"object"==typeof a[0]&&a[0].nodeType>0)},isWrapped:function(a){return a&&(a.jquery||b.Zepto&&b.Zepto.zepto.isZ(a))},isSVG:function(a){return b.SVGElement&&a instanceof b.SVGElement},isEmptyObject:function(a){for(var b in a)return!1;return!0}},q=!1;if(a.fn&&a.fn.jquery?(m=a,q=!0):m=b.Velocity.Utilities,8>=n&&!q)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(7>=n)return void(jQuery.fn.velocity=jQuery.fn.animate);var r=400,s="swing",t={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:b.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:c.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:m,Redirects:{},Easings:{},Promise:b.Promise,defaults:{queue:"",duration:r,easing:s,begin:d,complete:d,progress:d,display:d,visibility:d,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(a){m.data(a,"velocity",{isSVG:p.isSVG(a),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:1,patch:0},debug:!1};b.pageYOffset!==d?(t.State.scrollAnchor=b,t.State.scrollPropertyLeft="pageXOffset",t.State.scrollPropertyTop="pageYOffset"):(t.State.scrollAnchor=c.documentElement||c.body.parentNode||c.body,t.State.scrollPropertyLeft="scrollLeft",t.State.scrollPropertyTop="scrollTop");var u=function(){function a(a){return-a.tension*a.x-a.friction*a.v}function b(b,c,d){var e={x:b.x+d.dx*c,v:b.v+d.dv*c,tension:b.tension,friction:b.friction};return{dx:e.v,dv:a(e)}}function c(c,d){var e={dx:c.v,dv:a(c)},f=b(c,.5*d,e),g=b(c,.5*d,f),h=b(c,d,g),i=1/6*(e.dx+2*(f.dx+g.dx)+h.dx),j=1/6*(e.dv+2*(f.dv+g.dv)+h.dv);return c.x=c.x+i*d,c.v=c.v+j*d,c}return function d(a,b,e){var f,g,h,i={x:-1,v:0,tension:null,friction:null},j=[0],k=0,l=1e-4,m=.016;for(a=parseFloat(a)||500,b=parseFloat(b)||20,e=e||null,i.tension=a,i.friction=b,f=null!==e,f?(k=d(a,b),g=k/e*m):g=m;h=c(h||i,g),j.push(1+h.x),k+=16,Math.abs(h.x)>l&&Math.abs(h.v)>l;);return f?function(a){return j[a*(j.length-1)|0]}:k}}();t.Easings={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},spring:function(a){return 1-Math.cos(4.5*a*Math.PI)*Math.exp(6*-a)}},m.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(a,b){t.Easings[b[0]]=i.apply(null,b[1])});var v=t.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var a=0;a<v.Lists.colors.length;a++){var b="color"===v.Lists.colors[a]?"0 0 0 1":"255 255 255 1";v.Hooks.templates[v.Lists.colors[a]]=["Red Green Blue Alpha",b]}var c,d,e;if(n)for(c in v.Hooks.templates){d=v.Hooks.templates[c],e=d[0].split(" ");var f=d[1].match(v.RegEx.valueSplit);"Color"===e[0]&&(e.push(e.shift()),f.push(f.shift()),v.Hooks.templates[c]=[e.join(" "),f.join(" ")])}for(c in v.Hooks.templates){d=v.Hooks.templates[c],e=d[0].split(" ");for(var a in e){var g=c+e[a],h=a;v.Hooks.registered[g]=[c,h]}}},getRoot:function(a){var b=v.Hooks.registered[a];return b?b[0]:a},cleanRootPropertyValue:function(a,b){return v.RegEx.valueUnwrap.test(b)&&(b=b.match(v.RegEx.valueUnwrap)[1]),v.Values.isCSSNullValue(b)&&(b=v.Hooks.templates[a][1]),b},extractValue:function(a,b){var c=v.Hooks.registered[a];if(c){var d=c[0],e=c[1];return b=v.Hooks.cleanRootPropertyValue(d,b),b.toString().match(v.RegEx.valueSplit)[e]}return b},injectValue:function(a,b,c){var d=v.Hooks.registered[a];if(d){var e,f,g=d[0],h=d[1];return c=v.Hooks.cleanRootPropertyValue(g,c),e=c.toString().match(v.RegEx.valueSplit),e[h]=b,f=e.join(" ")}return c}},Normalizations:{registered:{clip:function(a,b,c){switch(a){case"name":return"clip";case"extract":var d;return v.RegEx.wrappedValueAlreadyExtracted.test(c)?d=c:(d=c.toString().match(v.RegEx.valueUnwrap),d=d?d[1].replace(/,(\s+)?/g," "):c),d;case"inject":return"rect("+c+")"}},blur:function(a,b,c){switch(a){case"name":return"-webkit-filter";case"extract":var d=parseFloat(c);if(!d&&0!==d){var e=c.toString().match(/blur\(([0-9]+[A-z]+)\)/i);d=e?e[1]:0}return d;case"inject":return parseFloat(c)?"blur("+c+")":"none"}},opacity:function(a,b,c){if(8>=n)switch(a){case"name":return"filter";case"extract":var d=c.toString().match(/alpha\(opacity=(.*)\)/i);return c=d?d[1]/100:1;case"inject":return b.style.zoom=1,parseFloat(c)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(c),10)+")"}else switch(a){case"name":return"opacity";case"extract":return c;case"inject":return c}}},register:function(){9>=n||t.State.isGingerbread||(v.Lists.transformsBase=v.Lists.transformsBase.concat(v.Lists.transforms3D));for(var a=0;a<v.Lists.transformsBase.length;a++)!function(){var b=v.Lists.transformsBase[a];v.Normalizations.registered[b]=function(a,c,e){switch(a){case"name":return"transform";case"extract":return g(c)===d||g(c).transformCache[b]===d?/^scale/i.test(b)?1:0:g(c).transformCache[b].replace(/[()]/g,"");case"inject":var f=!1;switch(b.substr(0,b.length-1)){case"translate":f=!/(%|px|em|rem|vw|vh|\d)$/i.test(e);break;case"scal":case"scale":t.State.isAndroid&&g(c).transformCache[b]===d&&1>e&&(e=1),f=!/(\d)$/i.test(e);break;case"skew":f=!/(deg|\d)$/i.test(e);break;case"rotate":f=!/(deg|\d)$/i.test(e)}return f||(g(c).transformCache[b]="("+e+")"),g(c).transformCache[b]}}}();for(var a=0;a<v.Lists.colors.length;a++)!function(){var b=v.Lists.colors[a];v.Normalizations.registered[b]=function(a,c,e){switch(a){case"name":return b;case"extract":var f;if(v.RegEx.wrappedValueAlreadyExtracted.test(e))f=e;else{var g,h={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(e)?g=h[e]!==d?h[e]:h.black:v.RegEx.isHex.test(e)?g="rgb("+v.Values.hexToRgb(e).join(" ")+")":/^rgba?\(/i.test(e)||(g=h.black),f=(g||e).toString().match(v.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return 8>=n||3!==f.split(" ").length||(f+=" 1"),f;case"inject":return 8>=n?4===e.split(" ").length&&(e=e.split(/\s+/).slice(0,3).join(" ")):3===e.split(" ").length&&(e+=" 1"),(8>=n?"rgb":"rgba")+"("+e.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(a){return a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()})},SVGAttribute:function(a){var b="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(n||t.State.isAndroid&&!t.State.isChrome)&&(b+="|transform"),new RegExp("^("+b+")$","i").test(a)},prefixCheck:function(a){if(t.State.prefixMatches[a])return[t.State.prefixMatches[a],!0];for(var b=["","Webkit","Moz","ms","O"],c=0,d=b.length;d>c;c++){var e;if(e=0===c?a:b[c]+a.replace(/^\w/,function(a){return a.toUpperCase()}),p.isString(t.State.prefixElement.style[e]))return t.State.prefixMatches[a]=e,[e,!0]}return[a,!1]}},Values:{hexToRgb:function(a){var b,c=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,d=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return a=a.replace(c,function(a,b,c,d){return b+b+c+c+d+d}),b=d.exec(a),b?[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]:[0,0,0]},isCSSNullValue:function(a){return 0==a||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(a)},getUnitType:function(a){return/^(rotate|skew)/i.test(a)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(a)?"":"px"},getDisplayType:function(a){var b=a&&a.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(b)?"inline":/^(li)$/i.test(b)?"list-item":/^(tr)$/i.test(b)?"table-row":"block"},addClass:function(a,b){a.classList?a.classList.add(b):a.className+=(a.className.length?" ":"")+b},removeClass:function(a,b){a.classList?a.classList.remove(b):a.className=a.className.toString().replace(new RegExp("(^|\\s)"+b.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(a,c,e,f){function h(a,c){function e(){j&&v.setPropertyValue(a,"display","none")}var i=0;if(8>=n)i=m.css(a,c);else{var j=!1;if(/^(width|height)$/.test(c)&&0===v.getPropertyValue(a,"display")&&(j=!0,v.setPropertyValue(a,"display",v.Values.getDisplayType(a))),!f){if("height"===c&&"border-box"!==v.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var k=a.offsetHeight-(parseFloat(v.getPropertyValue(a,"borderTopWidth"))||0)-(parseFloat(v.getPropertyValue(a,"borderBottomWidth"))||0)-(parseFloat(v.getPropertyValue(a,"paddingTop"))||0)-(parseFloat(v.getPropertyValue(a,"paddingBottom"))||0);return e(),k}if("width"===c&&"border-box"!==v.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var l=a.offsetWidth-(parseFloat(v.getPropertyValue(a,"borderLeftWidth"))||0)-(parseFloat(v.getPropertyValue(a,"borderRightWidth"))||0)-(parseFloat(v.getPropertyValue(a,"paddingLeft"))||0)-(parseFloat(v.getPropertyValue(a,"paddingRight"))||0);return e(),l}}var o;o=g(a)===d?b.getComputedStyle(a,null):g(a).computedStyle?g(a).computedStyle:g(a).computedStyle=b.getComputedStyle(a,null),(n||t.State.isFirefox)&&"borderColor"===c&&(c="borderTopColor"),i=9===n&&"filter"===c?o.getPropertyValue(c):o[c],(""===i||null===i)&&(i=a.style[c]),e()}if("auto"===i&&/^(top|right|bottom|left)$/i.test(c)){var p=h(a,"position");("fixed"===p||"absolute"===p&&/top|left/i.test(c))&&(i=m(a).position()[c]+"px")}return i}var i;if(v.Hooks.registered[c]){var j=c,k=v.Hooks.getRoot(j);e===d&&(e=v.getPropertyValue(a,v.Names.prefixCheck(k)[0])),v.Normalizations.registered[k]&&(e=v.Normalizations.registered[k]("extract",a,e)),i=v.Hooks.extractValue(j,e)}else if(v.Normalizations.registered[c]){var l,o;l=v.Normalizations.registered[c]("name",a),"transform"!==l&&(o=h(a,v.Names.prefixCheck(l)[0]),v.Values.isCSSNullValue(o)&&v.Hooks.templates[c]&&(o=v.Hooks.templates[c][1])),i=v.Normalizations.registered[c]("extract",a,o)}return/^[\d-]/.test(i)||(i=g(a)&&g(a).isSVG&&v.Names.SVGAttribute(c)?/^(height|width)$/i.test(c)?a.getBBox()[c]:a.getAttribute(c):h(a,v.Names.prefixCheck(c)[0])),v.Values.isCSSNullValue(i)&&(i=0),t.debug>=2&&console.log("Get "+c+": "+i),i},setPropertyValue:function(a,c,d,e,f){var h=c;if("scroll"===c)f.container?f.container["scroll"+f.direction]=d:"Left"===f.direction?b.scrollTo(d,f.alternateValue):b.scrollTo(f.alternateValue,d);else if(v.Normalizations.registered[c]&&"transform"===v.Normalizations.registered[c]("name",a))v.Normalizations.registered[c]("inject",a,d),h="transform",d=g(a).transformCache[c];else{if(v.Hooks.registered[c]){var i=c,j=v.Hooks.getRoot(c);e=e||v.getPropertyValue(a,j),d=v.Hooks.injectValue(i,d,e),c=j}if(v.Normalizations.registered[c]&&(d=v.Normalizations.registered[c]("inject",a,d),c=v.Normalizations.registered[c]("name",a)),h=v.Names.prefixCheck(c)[0],8>=n)try{a.style[h]=d}catch(k){t.debug&&console.log("Browser does not support ["+d+"] for ["+h+"]")}else g(a)&&g(a).isSVG&&v.Names.SVGAttribute(c)?a.setAttribute(c,d):a.style[h]=d;t.debug>=2&&console.log("Set "+c+" ("+h+"): "+d)}return[h,d]},flushTransformCache:function(a){function b(b){return parseFloat(v.getPropertyValue(a,b))}var c="";if((n||t.State.isAndroid&&!t.State.isChrome)&&g(a).isSVG){var d={translate:[b("translateX"),b("translateY")],skewX:[b("skewX")],skewY:[b("skewY")],scale:1!==b("scale")?[b("scale"),b("scale")]:[b("scaleX"),b("scaleY")],rotate:[b("rotateZ"),0,0]};m.each(g(a).transformCache,function(a){/^translate/i.test(a)?a="translate":/^scale/i.test(a)?a="scale":/^rotate/i.test(a)&&(a="rotate"),d[a]&&(c+=a+"("+d[a].join(" ")+") ",delete d[a])})}else{var e,f;m.each(g(a).transformCache,function(b){return e=g(a).transformCache[b],"transformPerspective"===b?(f=e,!0):(9===n&&"rotateZ"===b&&(b="rotate"),void(c+=b+e+" "))}),f&&(c="perspective"+f+" "+c)}v.setPropertyValue(a,"transform",c)}};v.Hooks.register(),v.Normalizations.register(),t.hook=function(a,b,c){var e=d;return a=f(a),m.each(a,function(a,f){if(g(f)===d&&t.init(f),c===d)e===d&&(e=t.CSS.getPropertyValue(f,b));else{var h=t.CSS.setPropertyValue(f,b,c);"transform"===h[0]&&t.CSS.flushTransformCache(f),e=h}}),e};var w=function(){function a(){return i?C.promise||null:n}function h(){function a(){function a(a,b){var c=d,e=d,f=d;return p.isArray(a)?(c=a[0],!p.isArray(a[1])&&/^[\d-]/.test(a[1])||p.isFunction(a[1])||v.RegEx.isHex.test(a[1])?f=a[1]:(p.isString(a[1])&&!v.RegEx.isHex.test(a[1])||p.isArray(a[1]))&&(e=b?a[1]:j(a[1],i.duration),a[2]!==d&&(f=a[2]))):c=a,b||(e=e||i.easing),p.isFunction(c)&&(c=c.call(h,z,y)),p.isFunction(f)&&(f=f.call(h,z,y)),[c||0,e,f]}function n(a,b){var c,d;return d=(b||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(a){return c=a,""}),c||(c=v.Values.getUnitType(a)),[d,c]}function o(){var a={myParent:h.parentNode||c.body,position:v.getPropertyValue(h,"position"),fontSize:v.getPropertyValue(h,"fontSize")},d=a.position===J.lastPosition&&a.myParent===J.lastParent,e=a.fontSize===J.lastFontSize;J.lastParent=a.myParent,J.lastPosition=a.position,J.lastFontSize=a.fontSize;var f=100,i={};if(e&&d)i.emToPx=J.lastEmToPx,i.percentToPxWidth=J.lastPercentToPxWidth,i.percentToPxHeight=J.lastPercentToPxHeight;else{var j=g(h).isSVG?c.createElementNS("http://www.w3.org/2000/svg","rect"):c.createElement("div");t.init(j),a.myParent.appendChild(j),m.each(["overflow","overflowX","overflowY"],function(a,b){t.CSS.setPropertyValue(j,b,"hidden")}),t.CSS.setPropertyValue(j,"position",a.position),t.CSS.setPropertyValue(j,"fontSize",a.fontSize),t.CSS.setPropertyValue(j,"boxSizing","content-box"),m.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(a,b){t.CSS.setPropertyValue(j,b,f+"%")}),t.CSS.setPropertyValue(j,"paddingLeft",f+"em"),i.percentToPxWidth=J.lastPercentToPxWidth=(parseFloat(v.getPropertyValue(j,"width",null,!0))||1)/f,i.percentToPxHeight=J.lastPercentToPxHeight=(parseFloat(v.getPropertyValue(j,"height",null,!0))||1)/f,i.emToPx=J.lastEmToPx=(parseFloat(v.getPropertyValue(j,"paddingLeft"))||1)/f,a.myParent.removeChild(j)}return null===J.remToPx&&(J.remToPx=parseFloat(v.getPropertyValue(c.body,"fontSize"))||16),null===J.vwToPx&&(J.vwToPx=parseFloat(b.innerWidth)/100,J.vhToPx=parseFloat(b.innerHeight)/100),i.remToPx=J.remToPx,i.vwToPx=J.vwToPx,i.vhToPx=J.vhToPx,t.debug>=1&&console.log("Unit ratios: "+JSON.stringify(i),h),i}if(i.begin&&0===z)try{i.begin.call(q,q)}catch(r){setTimeout(function(){throw r},1)}if("scroll"===D){var w,x,A,B=/^x$/i.test(i.axis)?"Left":"Top",E=parseFloat(i.offset)||0;i.container?p.isWrapped(i.container)||p.isNode(i.container)?(i.container=i.container[0]||i.container,w=i.container["scroll"+B],A=w+m(h).position()[B.toLowerCase()]+E):i.container=null:(w=t.State.scrollAnchor[t.State["scrollProperty"+B]],x=t.State.scrollAnchor[t.State["scrollProperty"+("Left"===B?"Top":"Left")]],A=m(h).offset()[B.toLowerCase()]+E),l={scroll:{rootPropertyValue:!1,startValue:w,currentValue:w,endValue:A,unitType:"",easing:i.easing,scrollData:{container:i.container,direction:B,alternateValue:x}},element:h},t.debug&&console.log("tweensContainer (scroll): ",l.scroll,h)}else if("reverse"===D){if(!g(h).tweensContainer)return void m.dequeue(h,i.queue);"none"===g(h).opts.display&&(g(h).opts.display="auto"),"hidden"===g(h).opts.visibility&&(g(h).opts.visibility="visible"),g(h).opts.loop=!1,g(h).opts.begin=null,g(h).opts.complete=null,u.easing||delete i.easing,u.duration||delete i.duration,i=m.extend({},g(h).opts,i);var F=m.extend(!0,{},g(h).tweensContainer);for(var G in F)if("element"!==G){var H=F[G].startValue;F[G].startValue=F[G].currentValue=F[G].endValue,F[G].endValue=H,p.isEmptyObject(u)||(F[G].easing=i.easing),t.debug&&console.log("reverse tweensContainer ("+G+"): "+JSON.stringify(F[G]),h)}l=F}else if("start"===D){var F;g(h).tweensContainer&&g(h).isAnimating===!0&&(F=g(h).tweensContainer),m.each(s,function(b,c){if(RegExp("^"+v.Lists.colors.join("$|^")+"$").test(b)){var e=a(c,!0),f=e[0],g=e[1],h=e[2];if(v.RegEx.isHex.test(f)){for(var i=["Red","Green","Blue"],j=v.Values.hexToRgb(f),k=h?v.Values.hexToRgb(h):d,l=0;l<i.length;l++){var m=[j[l]];g&&m.push(g),k!==d&&m.push(k[l]),s[b+i[l]]=m}delete s[b]}}});for(var I in s){var L=a(s[I]),M=L[0],N=L[1],O=L[2];I=v.Names.camelCase(I);var P=v.Hooks.getRoot(I),Q=!1;if(g(h).isSVG||v.Names.prefixCheck(P)[1]!==!1||v.Normalizations.registered[P]!==d){(i.display!==d&&null!==i.display&&"none"!==i.display||i.visibility!==d&&"hidden"!==i.visibility)&&/opacity|filter/.test(I)&&!O&&0!==M&&(O=0),i._cacheValues&&F&&F[I]?(O===d&&(O=F[I].endValue+F[I].unitType),Q=g(h).rootPropertyValueCache[P]):v.Hooks.registered[I]?O===d?(Q=v.getPropertyValue(h,P),O=v.getPropertyValue(h,I,Q)):Q=v.Hooks.templates[P][1]:O===d&&(O=v.getPropertyValue(h,I));
7
- var R,S,T,U=!1;if(R=n(I,O),O=R[0],T=R[1],R=n(I,M),M=R[0].replace(/^([+-\/*])=/,function(a,b){return U=b,""}),S=R[1],O=parseFloat(O)||0,M=parseFloat(M)||0,"%"===S&&(/^(fontSize|lineHeight)$/.test(I)?(M/=100,S="em"):/^scale/.test(I)?(M/=100,S=""):/(Red|Green|Blue)$/i.test(I)&&(M=M/100*255,S="")),/[\/*]/.test(U))S=T;else if(T!==S&&0!==O)if(0===M)S=T;else{f=f||o();var V=/margin|padding|left|right|width|text|word|letter/i.test(I)||/X$/.test(I)||"x"===I?"x":"y";switch(T){case"%":O*="x"===V?f.percentToPxWidth:f.percentToPxHeight;break;case"px":break;default:O*=f[T+"ToPx"]}switch(S){case"%":O*=1/("x"===V?f.percentToPxWidth:f.percentToPxHeight);break;case"px":break;default:O*=1/f[S+"ToPx"]}}switch(U){case"+":M=O+M;break;case"-":M=O-M;break;case"*":M=O*M;break;case"/":M=O/M}l[I]={rootPropertyValue:Q,startValue:O,currentValue:O,endValue:M,unitType:S,easing:N},t.debug&&console.log("tweensContainer ("+I+"): "+JSON.stringify(l[I]),h)}else t.debug&&console.log("Skipping ["+P+"] due to a lack of browser support.")}l.element=h}l.element&&(v.Values.addClass(h,"velocity-animating"),K.push(l),""===i.queue&&(g(h).tweensContainer=l,g(h).opts=i),g(h).isAnimating=!0,z===y-1?(t.State.calls.length>1e4&&(t.State.calls=e(t.State.calls)),t.State.calls.push([K,q,i,null,C.resolver]),t.State.isTicking===!1&&(t.State.isTicking=!0,k())):z++)}var f,h=this,i=m.extend({},t.defaults,u),l={};switch(g(h)===d&&t.init(h),parseFloat(i.delay)&&i.queue!==!1&&m.queue(h,i.queue,function(a){t.velocityQueueEntryFlag=!0,g(h).delayTimer={setTimeout:setTimeout(a,parseFloat(i.delay)),next:a}}),i.duration.toString().toLowerCase()){case"fast":i.duration=200;break;case"normal":i.duration=r;break;case"slow":i.duration=600;break;default:i.duration=parseFloat(i.duration)||1}t.mock!==!1&&(t.mock===!0?i.duration=i.delay=1:(i.duration*=parseFloat(t.mock)||1,i.delay*=parseFloat(t.mock)||1)),i.easing=j(i.easing,i.duration),i.begin&&!p.isFunction(i.begin)&&(i.begin=null),i.progress&&!p.isFunction(i.progress)&&(i.progress=null),i.complete&&!p.isFunction(i.complete)&&(i.complete=null),i.display!==d&&null!==i.display&&(i.display=i.display.toString().toLowerCase(),"auto"===i.display&&(i.display=t.CSS.Values.getDisplayType(h))),i.visibility!==d&&null!==i.visibility&&(i.visibility=i.visibility.toString().toLowerCase()),i.mobileHA=i.mobileHA&&t.State.isMobile&&!t.State.isGingerbread,i.queue===!1?i.delay?setTimeout(a,i.delay):a():m.queue(h,i.queue,function(b,c){return c===!0?(C.promise&&C.resolver(q),!0):(t.velocityQueueEntryFlag=!0,void a(b))}),""!==i.queue&&"fx"!==i.queue||"inprogress"===m.queue(h)[0]||m.dequeue(h)}var i,n,o,q,s,u,x=arguments[0]&&(m.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||p.isString(arguments[0].properties));if(p.isWrapped(this)?(i=!1,o=0,q=this,n=this):(i=!0,o=1,q=x?arguments[0].elements:arguments[0]),q=f(q)){x?(s=arguments[0].properties,u=arguments[0].options):(s=arguments[o],u=arguments[o+1]);var y=q.length,z=0;if("stop"!==s&&!m.isPlainObject(u)){var A=o+1;u={};for(var B=A;B<arguments.length;B++)p.isArray(arguments[B])||!/^(fast|normal|slow)$/i.test(arguments[B])&&!/^\d/.test(arguments[B])?p.isString(arguments[B])||p.isArray(arguments[B])?u.easing=arguments[B]:p.isFunction(arguments[B])&&(u.complete=arguments[B]):u.duration=arguments[B]}var C={promise:null,resolver:null,rejecter:null};i&&t.Promise&&(C.promise=new t.Promise(function(a,b){C.resolver=a,C.rejecter=b}));var D;switch(s){case"scroll":D="scroll";break;case"reverse":D="reverse";break;case"stop":m.each(q,function(a,b){g(b)&&g(b).delayTimer&&(clearTimeout(g(b).delayTimer.setTimeout),g(b).delayTimer.next&&g(b).delayTimer.next(),delete g(b).delayTimer)});var E=[];return m.each(t.State.calls,function(a,b){b&&m.each(b[1],function(c,e){var f=p.isString(u)?u:"";return u!==d&&b[2].queue!==f?!0:void m.each(q,function(b,c){c===e&&(u!==d&&(m.each(m.queue(c,f),function(a,b){p.isFunction(b)&&b(null,!0)}),m.queue(c,f,[])),g(c)&&""===f&&m.each(g(c).tweensContainer,function(a,b){b.endValue=b.currentValue}),E.push(a))})})}),m.each(E,function(a,b){l(b,!0)}),C.promise&&C.resolver(q),a();default:if(!m.isPlainObject(s)||p.isEmptyObject(s)){if(p.isString(s)&&t.Redirects[s]){var F=m.extend({},u),G=F.duration,H=F.delay||0;return F.backwards===!0&&(q=m.extend(!0,[],q).reverse()),m.each(q,function(a,b){parseFloat(F.stagger)?F.delay=H+parseFloat(F.stagger)*a:p.isFunction(F.stagger)&&(F.delay=H+F.stagger.call(b,a,y)),F.drag&&(F.duration=parseFloat(G)||(/^(callout|transition)/.test(s)?1e3:r),F.duration=Math.max(F.duration*(F.backwards?1-a/y:(a+1)/y),.75*F.duration,200)),t.Redirects[s].call(b,b,F||{},a,y,q,C.promise?C:d)}),a()}var I="Velocity: First argument ("+s+") was not a property map, a known action, or a registered redirect. Aborting.";return C.promise?C.rejecter(new Error(I)):console.log(I),a()}D="start"}var J={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},K=[];m.each(q,function(a,b){p.isNode(b)&&h.call(b)});var L,F=m.extend({},t.defaults,u);if(F.loop=parseInt(F.loop),L=2*F.loop-1,F.loop)for(var M=0;L>M;M++){var N={delay:F.delay,progress:F.progress};M===L-1&&(N.display=F.display,N.visibility=F.visibility,N.complete=F.complete),w(q,"reverse",N)}return a()}};t=m.extend(w,t),t.animate=w;var x=b.requestAnimationFrame||o;return t.State.isMobile||c.hidden===d||c.addEventListener("visibilitychange",function(){c.hidden?(x=function(a){return setTimeout(function(){a(!0)},16)},k()):x=b.requestAnimationFrame||o}),a.Velocity=t,a!==b&&(a.fn.velocity=w,a.fn.velocity.defaults=t.defaults),m.each(["Down","Up"],function(a,b){t.Redirects["slide"+b]=function(a,c,e,f,g,h){var i=m.extend({},c),j=i.begin,k=i.complete,l={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},n={};i.display===d&&(i.display="Down"===b?"inline"===t.CSS.Values.getDisplayType(a)?"inline-block":"block":"none"),i.begin=function(){j&&j.call(g,g);for(var c in l){n[c]=a.style[c];var d=t.CSS.getPropertyValue(a,c);l[c]="Down"===b?[d,0]:[0,d]}n.overflow=a.style.overflow,a.style.overflow="hidden"},i.complete=function(){for(var b in n)a.style[b]=n[b];k&&k.call(g,g),h&&h.resolver(g)},t(a,l,i)}}),m.each(["In","Out"],function(a,b){t.Redirects["fade"+b]=function(a,c,e,f,g,h){var i=m.extend({},c),j={opacity:"In"===b?1:0},k=i.complete;i.complete=e!==f-1?i.begin=null:function(){k&&k.call(g,g),h&&h.resolver(g)},i.display===d&&(i.display="In"===b?"auto":"none"),t(this,j,i)}}),t}(window.jQuery||window.Zepto||window,window,document)}),!function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(k(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a}function i(a,b){return h(a,b,!0)}function j(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&h(d,c)}function k(a,b){return function(){return a.apply(b,arguments)}}function l(a,b){return typeof a==kb?a.apply(b?b[0]||d:d,b):a}function m(a,b){return a===d?b:a}function n(a,b,c){g(r(b),function(b){a.addEventListener(b,c,!1)})}function o(a,b,c){g(r(b),function(b){a.removeEventListener(b,c,!1)})}function p(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function q(a,b){return a.indexOf(b)>-1}function r(a){return a.trim().split(/\s+/g)}function s(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function t(a){return Array.prototype.slice.call(a,0)}function u(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];s(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function v(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ib.length;){if(c=ib[g],e=c?c+f:b,e in a)return e;g++}return d}function w(){return ob++}function x(a){var b=a.ownerDocument;return b.defaultView||b.parentWindow}function y(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){l(a.options.enable,[a])&&c.handler(b)},this.init()}function z(a){var b,c=a.options.inputClass;return new(b=c?c:rb?N:sb?Q:qb?S:M)(a,A)}function A(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&yb&&0===d-e,g=b&(Ab|Bb)&&0===d-e;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,B(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function B(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=E(b)),e>1&&!c.firstMultiple?c.firstMultiple=E(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=F(d);b.timeStamp=nb(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=J(h,i),b.distance=I(h,i),C(c,b),b.offsetDirection=H(b.deltaX,b.deltaY),b.scale=g?L(g.pointers,d):1,b.rotation=g?K(g.pointers,d):0,D(c,b);var j=a.element;p(b.srcEvent.target,j)&&(j=b.srcEvent.target),b.target=j}function C(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(b.eventType===yb||f.eventType===Ab)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function D(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Bb&&(i>xb||h.velocity===d)){var j=h.deltaX-b.deltaX,k=h.deltaY-b.deltaY,l=G(i,j,k);e=l.x,f=l.y,c=mb(l.x)>mb(l.y)?l.x:l.y,g=H(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function E(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:lb(a.pointers[c].clientX),clientY:lb(a.pointers[c].clientY)},c++;return{timeStamp:nb(),pointers:b,center:F(b),deltaX:a.deltaX,deltaY:a.deltaY}}function F(a){var b=a.length;if(1===b)return{x:lb(a[0].clientX),y:lb(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:lb(c/b),y:lb(d/b)}}function G(a,b,c){return{x:b/a||0,y:c/a||0}}function H(a,b){return a===b?Cb:mb(a)>=mb(b)?a>0?Db:Eb:b>0?Fb:Gb}function I(a,b,c){c||(c=Kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function J(a,b,c){c||(c=Kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function K(a,b){return J(b[1],b[0],Lb)-J(a[1],a[0],Lb)}function L(a,b){return I(b[0],b[1],Lb)/I(a[0],a[1],Lb)}function M(){this.evEl=Nb,this.evWin=Ob,this.allow=!0,this.pressed=!1,y.apply(this,arguments)}function N(){this.evEl=Rb,this.evWin=Sb,y.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function O(){this.evTarget=Ub,this.evWin=Vb,this.started=!1,y.apply(this,arguments)}function P(a,b){var c=t(a.touches),d=t(a.changedTouches);return b&(Ab|Bb)&&(c=u(c.concat(d),"identifier",!0)),[c,d]}function Q(){this.evTarget=Xb,this.targetIds={},y.apply(this,arguments)}function R(a,b){var c=t(a.touches),d=this.targetIds;if(b&(yb|zb)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=t(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return p(a.target,i)}),b===yb)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Ab|Bb)&&delete d[g[e].identifier],e++;return h.length?[u(f.concat(h),"identifier",!0),h]:void 0}function S(){y.apply(this,arguments);var a=k(this.handler,this);this.touch=new Q(this.manager,a),this.mouse=new M(this.manager,a)}function T(a,b){this.manager=a,this.set(b)}function U(a){if(q(a,bc))return bc;var b=q(a,cc),c=q(a,dc);return b&&c?cc+" "+dc:b||c?b?cc:dc:q(a,ac)?ac:_b}function V(a){this.id=w(),this.manager=null,this.options=i(a||{},this.defaults),this.options.enable=m(this.options.enable,!0),this.state=ec,this.simultaneous={},this.requireFail=[]}function W(a){return a&jc?"cancel":a&hc?"end":a&gc?"move":a&fc?"start":""}function X(a){return a==Gb?"down":a==Fb?"up":a==Db?"left":a==Eb?"right":""}function Y(a,b){var c=b.manager;return c?c.get(a):a}function Z(){V.apply(this,arguments)}function $(){Z.apply(this,arguments),this.pX=null,this.pY=null}function _(){Z.apply(this,arguments)}function ab(){V.apply(this,arguments),this._timer=null,this._input=null}function bb(){Z.apply(this,arguments)}function cb(){Z.apply(this,arguments)}function db(){V.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function eb(a,b){return b=b||{},b.recognizers=m(b.recognizers,eb.defaults.preset),new fb(a,b)}function fb(a,b){b=b||{},this.options=i(b,eb.defaults),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.element=a,this.input=z(this),this.touchAction=new T(this,this.options.touchAction),gb(this,!0),g(b.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function gb(a,b){var c=a.element;g(a.options.cssProps,function(a,d){c.style[v(c.style,d)]=b?a:""})}function hb(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var ib=["","webkit","moz","MS","ms","o"],jb=b.createElement("div"),kb="function",lb=Math.round,mb=Math.abs,nb=Date.now,ob=1,pb=/mobile|tablet|ip(ad|hone|od)|android/i,qb="ontouchstart"in a,rb=v(a,"PointerEvent")!==d,sb=qb&&pb.test(navigator.userAgent),tb="touch",ub="pen",vb="mouse",wb="kinect",xb=25,yb=1,zb=2,Ab=4,Bb=8,Cb=1,Db=2,Eb=4,Fb=8,Gb=16,Hb=Db|Eb,Ib=Fb|Gb,Jb=Hb|Ib,Kb=["x","y"],Lb=["clientX","clientY"];y.prototype={handler:function(){},init:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(x(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&o(this.element,this.evEl,this.domHandler),this.evTarget&&o(this.target,this.evTarget,this.domHandler),this.evWin&&o(x(this.element),this.evWin,this.domHandler)}};var Mb={mousedown:yb,mousemove:zb,mouseup:Ab},Nb="mousedown",Ob="mousemove mouseup";j(M,y,{handler:function(a){var b=Mb[a.type];b&yb&&0===a.button&&(this.pressed=!0),b&zb&&1!==a.which&&(b=Ab),this.pressed&&this.allow&&(b&Ab&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:vb,srcEvent:a}))}});var Pb={pointerdown:yb,pointermove:zb,pointerup:Ab,pointercancel:Bb,pointerout:Bb},Qb={2:tb,3:ub,4:vb,5:wb},Rb="pointerdown",Sb="pointermove pointerup pointercancel";a.MSPointerEvent&&(Rb="MSPointerDown",Sb="MSPointerMove MSPointerUp MSPointerCancel"),j(N,y,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Pb[d],f=Qb[a.pointerType]||a.pointerType,g=f==tb,h=s(b,a.pointerId,"pointerId");e&yb&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Ab|Bb)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Tb={touchstart:yb,touchmove:zb,touchend:Ab,touchcancel:Bb},Ub="touchstart",Vb="touchstart touchmove touchend touchcancel";j(O,y,{handler:function(a){var b=Tb[a.type];if(b===yb&&(this.started=!0),this.started){var c=P.call(this,a,b);b&(Ab|Bb)&&0===c[0].length-c[1].length&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:tb,srcEvent:a})}}});var Wb={touchstart:yb,touchmove:zb,touchend:Ab,touchcancel:Bb},Xb="touchstart touchmove touchend touchcancel";j(Q,y,{handler:function(a){var b=Wb[a.type],c=R.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:tb,srcEvent:a})}}),j(S,y,{handler:function(a,b,c){var d=c.pointerType==tb,e=c.pointerType==vb;if(d)this.mouse.allow=!1;else if(e&&!this.mouse.allow)return;b&(Ab|Bb)&&(this.mouse.allow=!0),this.callback(a,b,c)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Yb=v(jb.style,"touchAction"),Zb=Yb!==d,$b="compute",_b="auto",ac="manipulation",bc="none",cc="pan-x",dc="pan-y";T.prototype={set:function(a){a==$b&&(a=this.compute()),Zb&&(this.manager.element.style[Yb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){l(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),U(a.join(" "))},preventDefaults:function(a){if(!Zb){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=q(d,bc),f=q(d,dc),g=q(d,cc);return e||f&&c&Hb||g&&c&Ib?this.preventSrc(b):void 0}},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var ec=1,fc=2,gc=4,hc=8,ic=hc,jc=16,kc=32;V.prototype={defaults:{},set:function(a){return h(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=Y(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=Y(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=Y(a,this),-1===s(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=Y(a,this);var b=s(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(c.options.event+(b?W(d):""),a)}var c=this,d=this.state;hc>d&&b(!0),b(),d>=hc&&b(!0)},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=kc)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(kc|ec)))return!1;a++}return!0},recognize:function(a){var b=h({},a);return l(this.options.enable,[this,b])?(this.state&(ic|jc|kc)&&(this.state=ec),this.state=this.process(b),void(this.state&(fc|gc|hc|jc)&&this.tryEmit(b))):(this.reset(),void(this.state=kc))},process:function(){},getTouchAction:function(){},reset:function(){}},j(Z,V,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(fc|gc),e=this.attrTest(a);return d&&(c&Bb||!e)?b|jc:d||e?c&Ab?b|hc:b&fc?b|gc:fc:kc}}),j($,Z,{defaults:{event:"pan",threshold:10,pointers:1,direction:Jb},getTouchAction:function(){var a=this.options.direction,b=[];return a&Hb&&b.push(dc),a&Ib&&b.push(cc),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Hb?(e=0===f?Cb:0>f?Db:Eb,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Cb:0>g?Fb:Gb,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return Z.prototype.attrTest.call(this,a)&&(this.state&fc||!(this.state&fc)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=X(a.direction);b&&this.manager.emit(this.options.event+b,a),this._super.emit.call(this,a)}}),j(_,Z,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[bc]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&fc)},emit:function(a){if(this._super.emit.call(this,a),1!==a.scale){var b=a.scale<1?"in":"out";this.manager.emit(this.options.event+b,a)}}}),j(ab,V,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[_b]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Ab|Bb)&&!f)this.reset();else if(a.eventType&yb)this.reset(),this._timer=e(function(){this.state=ic,this.tryEmit()},b.time,this);else if(a.eventType&Ab)return ic;return kc},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===ic&&(a&&a.eventType&Ab?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=nb(),this.manager.emit(this.options.event,this._input)))}}),j(bb,Z,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[bc]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&fc)}}),j(cb,Z,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:Hb|Ib,pointers:1},getTouchAction:function(){return $.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Hb|Ib)?b=a.velocity:c&Hb?b=a.velocityX:c&Ib&&(b=a.velocityY),this._super.attrTest.call(this,a)&&c&a.direction&&a.distance>this.options.threshold&&mb(b)>this.options.velocity&&a.eventType&Ab},emit:function(a){var b=X(a.direction);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),j(db,V,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[ac]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&yb&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=Ab)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||I(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e(function(){this.state=ic,this.tryEmit()},b.interval,this),fc):ic}return kc},failTimeout:function(){return this._timer=e(function(){this.state=kc},this.options.interval,this),kc},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ic&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),eb.VERSION="2.0.4",eb.defaults={domEvents:!1,touchAction:$b,enable:!0,inputTarget:null,inputClass:null,preset:[[bb,{enable:!1}],[_,{enable:!1},["rotate"]],[cb,{direction:Hb}],[$,{direction:Hb},["swipe"]],[db],[db,{event:"doubletap",taps:2},["tap"]],[ab]],cssProps:{userSelect:"default",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var lc=1,mc=2;fb.prototype={set:function(a){return h(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?mc:lc},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&ic)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===mc||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(fc|gc|hc)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof V)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;var b=this.recognizers;return a=this.get(a),b.splice(s(b,a),1),this.touchAction.update(),this},on:function(a,b){var c=this.handlers;return g(r(a),function(a){c[a]=c[a]||[],c[a].push(b)}),this},off:function(a,b){var c=this.handlers;return g(r(a),function(a){b?c[a].splice(s(c[a],b),1):delete c[a]}),this},emit:function(a,b){this.options.domEvents&&hb(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&gb(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},h(eb,{INPUT_START:yb,INPUT_MOVE:zb,INPUT_END:Ab,INPUT_CANCEL:Bb,STATE_POSSIBLE:ec,STATE_BEGAN:fc,STATE_CHANGED:gc,STATE_ENDED:hc,STATE_RECOGNIZED:ic,STATE_CANCELLED:jc,STATE_FAILED:kc,DIRECTION_NONE:Cb,DIRECTION_LEFT:Db,DIRECTION_RIGHT:Eb,DIRECTION_UP:Fb,DIRECTION_DOWN:Gb,DIRECTION_HORIZONTAL:Hb,DIRECTION_VERTICAL:Ib,DIRECTION_ALL:Jb,Manager:fb,Input:y,TouchAction:T,TouchInput:Q,MouseInput:M,PointerEventInput:N,TouchMouseInput:S,SingleTouchInput:O,Recognizer:V,AttrRecognizer:Z,Tap:db,Pan:$,Swipe:cb,Pinch:_,Rotate:bb,Press:ab,on:n,off:o,each:g,merge:i,extend:h,inherit:j,bindFn:k,prefixed:v}),typeof define==kb&&define.amd?define(function(){return eb}):"undefined"!=typeof module&&module.exports?module.exports=eb:a[c]=eb}(window,document,"Hammer"),function(a){"function"==typeof define&&define.amd?define(["jquery","hammerjs"],a):"object"==typeof exports?a(require("jquery"),require("hammerjs")):a(jQuery,Hammer)}(function(a,b){function c(c,d){var e=a(c);e.data("hammer")||e.data("hammer",new b(e[0],d))}a.fn.hammer=function(a){return this.each(function(){c(this,a)})},b.Manager.prototype.emit=function(b){return function(c,d){b.call(this,c,d),a(this.element).trigger({type:c,gesture:d})}}(b.Manager.prototype.emit)}),function(a){a.fn.collapsible=function(b){var c={accordion:void 0};return b=a.extend(c,b),this.each(function(){function c(a){f=e.find(".collapsible-header"),a.parent().toggleClass("active"),a.parent().hasClass("active")?a.siblings(".collapsible-body").stop(!0,!1).slideDown({duration:350,easing:"easeOutQuart",queue:!1}):a.siblings(".collapsible-body").stop(!0,!1).slideUp({duration:350,easing:"easeOutQuart",queue:!1}),f.not(a).parent().removeClass("active"),f.not(a).parent().children(".collapsible-body").stop(!0,!1).slideUp({duration:350,easing:"easeOutQuart",queue:!1})}function d(a){a.parent().toggleClass("active"),a.parent().hasClass("active")?a.siblings(".collapsible-body").stop(!0,!1).slideDown({duration:350,easing:"easeOutQuart",queue:!1}):a.siblings(".collapsible-body").stop(!0,!1).slideUp({duration:350,easing:"easeOutQuart",queue:!1})}var e=a(this),f=a(this).find(".collapsible-header"),g=e.data("collapsible");e.off("click.collapse",".collapsible-header"),f.off("click.collapse"),b.accordion||"accordion"==g||void 0==g?(e.on("click.collapse",".collapsible-header",function(b){c(a(b.currentTarget))}),c(f.filter(".active").first())):f.each(function(){a(this).on("click.collapse",function(b){d(a(b.currentTarget))}),a(this).hasClass("active")&&d(a(this))})})},a(document).ready(function(){a(".collapsible").collapsible()})}(jQuery),function(a){a.fn.scrollTo=function(b){return a(this).scrollTop(a(this).scrollTop()-a(this).offset().top+a(b).offset().top),this},a.fn.dropdown=function(b){var c={inDuration:300,outDuration:225,constrain_width:!0,hover:!0,alignment:"left",gutter:0,belowOrigin:!1};b=a.extend(c,b),this.each(function(){function c(){void 0!=g.data("inDuration")&&(b.inDuration=g.data("inDuration")),void 0!=g.data("outDuration")&&(b.outDuration=g.data("outDuration")),void 0!=g.data("constrainwidth")&&(b.constrain_width=g.data("constrainwidth")),void 0!=g.data("hover")&&(b.hover=g.data("hover")),void 0!=g.data("alignment")&&(b.alignment=g.data("alignment")),void 0!=g.data("gutter")&&(b.gutter=g.data("gutter")),void 0!=g.data("beloworigin")&&(b.belowOrigin=g.data("beloworigin"))}function d(){c(),1==b.constrain_width&&h.css("width",g.outerWidth());var d=0;1==b.belowOrigin&&(d=g.height());var f=0,j=b.gutter;"right"==b.alignment&&(f=g.innerWidth()-h.innerWidth(),j=-1*j),h.css(e(g[0])?{display:"block",position:"fixed",height:0,top:g.offset().top-a(window).scrollTop()+d,left:g.offset().left+f+j}:{display:"block",top:g.offset().top+d,left:g.offset().left+f+j,height:0}),h.velocity({opacity:1},{duration:b.inDuration,queue:!1,easing:"easeOutQuad"}).velocity({height:i},{duration:b.inDuration,queue:!1,easing:"easeOutCubic",complete:function(){h.css("overflow-y","auto")}})}function e(b){var c=a(b),d=c.add(c.parents()),e=!1;return d.each(function(){return"fixed"===a(this).css("position")?(e=!0,!1):void 0}),e}function f(){h.velocity({opacity:0},{duration:b.outDuration,easing:"easeOutQuad",complete:function(){h.css({display:"none","overflow-y":""})}})}var g=a(this),h=a("#"+g.attr("data-activates"));c(),h.parent().is(a("body"))||(h.detach(),a("body").append(h));var i=h.height();if(b.hover)g.on("mouseover",function(){d()}),h.on("mouseleave",function(){f()});else{g.unbind("click."+g.attr("id")),g.bind("click."+g.attr("id"),function(b){g[0]==b.currentTarget&&(b.preventDefault(),d()),a(document).bind("click."+h.attr("id"),function(b){!h.is(b.target)&&!g.is(b.target)&&!g.find(b.target).length>0&&(f(),a(document).unbind("click."+h.attr("id")))})})}g.on("open",d),g.on("close",f)})}}(jQuery),function(a){a.fn.extend({openModal:function(b){var c=this,d=a('<div id="lean-overlay"></div>');a("body").append(d);var e={opacity:.5,in_duration:300,out_duration:200,ready:void 0,complete:void 0,dismissible:!0};b=a.extend(e,b),b.dismissible&&(a("#lean-overlay").click(function(){a(c).closeModal(b)}),a(document).keyup(function(d){27===d.keyCode&&(a(c).closeModal(b),a(this).off())})),a(c).find(".modal-close").click(function(d){d.preventDefault(),a(c).closeModal(b)}),a("#lean-overlay").css({display:"block",opacity:0}),a(c).css({display:"block",top:"4%",opacity:0}),a("#lean-overlay").velocity({opacity:b.opacity},{duration:b.in_duration,queue:!1,ease:"easeOutCubic"}),a(c).velocity({top:"10%",opacity:1},{duration:b.in_duration,queue:!1,ease:"easeOutCubic",complete:function(){"function"==typeof b.ready&&b.ready()}})}}),a.fn.extend({closeModal:function(b){var c={out_duration:200,complete:void 0},b=a.extend(c,b);a(".modal-close").off(),a("#lean-overlay").velocity({opacity:0},{duration:b.out_duration,queue:!1,ease:"easeOutQuart"}),a(this).fadeOut(b.out_duration,function(){a(this).css({top:0}),a("#lean-overlay").css({display:"none"}),"function"==typeof b.complete&&b.complete(),a("#lean-overlay").remove()})}}),a.fn.extend({leanModal:function(b){return this.each(function(){a(this).click(function(c){var d=a(this).attr("href");a(d).openModal(b),c.preventDefault()})})}})}(jQuery),function(a){a.fn.materialbox=function(){return this.each(function(){function b(){d=!1;var b=g.parent(".material-placeholder"),e=(window.innerWidth,window.innerHeight,g.data("width")),h=g.data("height");a("#materialbox-overlay").fadeOut(f,function(){c=!1,a(this).remove()}),g.velocity({width:e,height:h,left:0,top:0},{duration:f,queue:!1,easing:"easeOutQuad"}),a(".materialbox-caption").velocity({opacity:0},{duration:f+200,queue:!1,easing:"easeOutQuad",complete:function(){b.css({height:"",width:"",position:"",top:"",left:""}),g.css({height:"",top:"",left:"",width:"","max-width":"",position:"","z-index":""}),g.removeClass("active"),d=!0,a(this).remove()}})}if(!a(this).hasClass("intialized")){a(this).addClass("intialized");var c=!1,d=!0,e=275,f=200,g=a(this),h=a("<div></div>").addClass("material-placeholder");g.wrap(h),g.on("click",function(){var f=g.parent(".material-placeholder"),h=window.innerWidth,i=window.innerHeight,j=g.width(),k=g.height();if(d===!1)return!1;if(c&&d===!0)return b(),!1;d=!1,g.addClass("active"),c=!0,f.css({width:f[0].getBoundingClientRect().width,height:f[0].getBoundingClientRect().height,position:"relative",top:0,left:0}),g.css({position:"absolute","z-index":1e3}).data("width",j).data("height",k);var l=a('<div id="materialbox-overlay"></div>').css({opacity:0}).click(function(){d===!0&&b()});if(a("body").append(l),l.velocity({opacity:1},{duration:e,queue:!1,easing:"easeOutQuad"}),""!==g.data("caption")){var m=a('<div class="materialbox-caption"></div>');m.text(g.data("caption")),a("body").append(m),m.css({display:"inline"}),m.velocity({opacity:1},{duration:e,queue:!1,easing:"easeOutQuad"})}var n=0,o=j/h,p=k/i,q=0,r=0;o>p?(n=k/j,q=.9*h,r=.9*h*n):(n=j/k,q=.9*i*n,r=.9*i),g.hasClass("responsive-img")?g.velocity({"max-width":q,width:j},{duration:0,queue:!1,complete:function(){g.css({left:0,top:0}).velocity({height:r,width:q,left:a(document).scrollLeft()+h/2-g.parent(".material-placeholder").offset().left-q/2,top:a(document).scrollTop()+i/2-g.parent(".material-placeholder").offset().top-r/2},{duration:e,queue:!1,easing:"easeOutQuad",complete:function(){d=!0
8
- }})}}):g.css("left",0).css("top",0).velocity({height:r,width:q,left:a(document).scrollLeft()+h/2-g.parent(".material-placeholder").offset().left-q/2,top:a(document).scrollTop()+i/2-g.parent(".material-placeholder").offset().top-r/2},{duration:e,queue:!1,easing:"easeOutQuad",complete:function(){d=!0}})}),a(window).scroll(function(){c&&b()}),a(document).keyup(function(a){27===a.keyCode&&d===!0&&c&&b()})}})},a(document).ready(function(){a(".materialboxed").materialbox()})}(jQuery),function(a){a.fn.parallax=function(){var b=a(window).width();return this.each(function(){function c(c){var e;e=992>b?d.height()>0?d.height():d.children("img").height():d.height()>0?d.height():500;var f=d.children("img").height(),g=f-e,h=d.offset().top+e,i=d.offset().top,j=a(window).scrollTop(),k=window.innerHeight,l=j+k,m=(l-i)/(e+k),n=-1*g*m;h>j&&j+k>i&&d.children("img").first().css("bottom",n+"px"),c&&d.children("img").first().css("display","block")}var d=a(this);d.addClass("parallax"),d.find("img").each(function(){a(this).css("background-image","url("+a(this).attr("src")+")"),a(this).attr("src","data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")}),d.children("img").one("load",function(){c(!0)}).each(function(){this.complete&&a(this).load()}),a(window).scroll(function(){b=a(window).width(),c(!1)}),a(window).resize(function(){b=a(window).width(),c(!1)})})}}(jQuery),function(a){var b={init:function(){return this.each(function(){{var b=a(this);a(window).width()}b.width("100%");var c=a(this).children("li").length;b.children("li").each(function(){a(this).width(100/c+"%")});var d,e,f=b.find("li.tab a"),g=b.width(),h=b.find("li").first().outerWidth(),i=0;d=a(f.filter('[href="'+location.hash+'"]')),0===d.length&&(d=a(this).find("li.tab a.active").first()),0===d.length&&(d=a(this).find("li.tab a").first()),d.addClass("active"),i=f.index(d),0>i&&(i=0),e=a(d[0].hash),b.append('<div class="indicator"></div>');var j=b.find(".indicator");b.is(":visible")&&(j.css({right:g-(i+1)*h}),j.css({left:i*h})),a(window).resize(function(){g=b.width(),h=b.find("li").first().outerWidth(),0>i&&(i=0),0!==h&&0!==g&&(j.css({right:g-(i+1)*h}),j.css({left:i*h}))}),f.not(d).each(function(){a(this.hash).hide()}),b.on("click","a",function(c){g=b.width(),h=b.find("li").first().outerWidth(),d.removeClass("active"),e.hide(),d=a(this),e=a(this.hash),f=b.find("li.tab a"),d.addClass("active");var k=i;i=f.index(a(this)),0>i&&(i=0),e.show(),i-k>=0?(j.velocity({right:g-(i+1)*h},{duration:300,queue:!1,easing:"easeOutQuad"}),j.velocity({left:i*h},{duration:300,queue:!1,easing:"easeOutQuad",delay:90})):(j.velocity({left:i*h},{duration:300,queue:!1,easing:"easeOutQuad"}),j.velocity({right:g-(i+1)*h},{duration:300,queue:!1,easing:"easeOutQuad",delay:90})),c.preventDefault()})})},select_tab:function(a){this.find('a[href="#'+a+'"]').trigger("click")}};a.fn.tabs=function(c){return b[c]?b[c].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof c&&c?void a.error("Method "+c+" does not exist on jQuery.tooltip"):b.init.apply(this,arguments)},a(document).ready(function(){a("ul.tabs").tabs()})}(jQuery),function(a){a.fn.tooltip=function(b){var c=null,d=!1,e=null,f=5,g={delay:350};return b=a.extend(g,b),a(".material-tooltip").remove(),this.each(function(){var g=a(this),h=a("<span></span>").text(g.attr("data-tooltip")),i=a("<div></div>");i.addClass("material-tooltip").append(h),i.appendTo(a("body"));var j=a("<div></div>").addClass("backdrop");j.appendTo(i),j.css({top:0,left:0}),a(this).off("mouseenter mouseleave"),a(this).on({mouseenter:function(){var a=g.data("delay");a=void 0==a||""==a?b.delay:a,c=0,e=setInterval(function(){if(c+=10,c>=a&&0==d){d=!0,i.css({display:"block",left:"0px",top:"0px"}),i.children("span").text(g.attr("data-tooltip"));var b=g.outerWidth(),e=g.outerHeight(),h=g.attr("data-position"),k=i.outerHeight(),l=i.outerWidth(),m="0px",n="0px",o=8;"top"===h?(i.css({top:g.offset().top-k-f,left:g.offset().left+b/2-l/2}),m="-10px",j.css({borderRadius:"14px 14px 0 0",transformOrigin:"50% 90%",marginTop:k,marginLeft:l/2-j.width()/2})):"left"===h?(i.css({top:g.offset().top+e/2-k/2,left:g.offset().left-l-f}),n="-10px",j.css({width:"14px",height:"14px",borderRadius:"14px 0 0 14px",transformOrigin:"95% 50%",marginTop:k/2,marginLeft:l})):"right"===h?(i.css({top:g.offset().top+e/2-k/2,left:g.offset().left+b+f}),n="+10px",j.css({width:"14px",height:"14px",borderRadius:"0 14px 14px 0",transformOrigin:"5% 50%",marginTop:k/2,marginLeft:"0px"})):(i.css({top:g.offset().top+g.outerHeight()+f,left:g.offset().left+b/2-l/2}),m="+10px",j.css({marginLeft:l/2-j.width()/2})),o=l/8,8>o&&(o=8),("right"===h||"left"===h)&&(o=l/10,6>o&&(o=6)),i.velocity({opacity:1,marginTop:m,marginLeft:n},{duration:350,queue:!1}),j.css({display:"block"}).velocity({opacity:1},{duration:55,delay:0,queue:!1}).velocity({scale:o},{duration:300,delay:0,queue:!1,easing:"easeInOutQuad"})}},10)},mouseleave:function(){clearInterval(e),c=0,i.velocity({opacity:0,marginTop:0,marginLeft:0},{duration:225,queue:!1,delay:275}),j.velocity({opacity:0,scale:1},{duration:225,delay:275,queue:!1,complete:function(){j.css("display","none"),i.css("display","none"),d=!1}})}})})},a(document).ready(function(){a(".tooltipped").tooltip()})}(jQuery),function(a){"use strict";function b(a){return null!==a&&a===a.window}function c(a){return b(a)?a:9===a.nodeType&&a.defaultView}function d(a){var b,d,e={top:0,left:0},f=a&&a.ownerDocument;return b=f.documentElement,"undefined"!=typeof a.getBoundingClientRect&&(e=a.getBoundingClientRect()),d=c(f),{top:e.top+d.pageYOffset-b.clientTop,left:e.left+d.pageXOffset-b.clientLeft}}function e(a){var b="";for(var c in a)a.hasOwnProperty(c)&&(b+=c+":"+a[c]+";");return b}function f(a){if(k.allowEvent(a)===!1)return null;for(var b=null,c=a.target||a.srcElement;null!==c.parentElement;){if(-1!==c.className.indexOf("waves-effect")){b=c;break}c=c.parentElement}return b}function g(b){var c=f(b);null!==c&&(j.show(b,c),"ontouchstart"in a&&(c.addEventListener("touchend",j.hide,!1),c.addEventListener("touchcancel",j.hide,!1)),c.addEventListener("mouseup",j.hide,!1),c.addEventListener("mouseleave",j.hide,!1))}var h=h||{},i=document.querySelectorAll.bind(document),j={duration:750,show:function(a,b){if(2===a.button)return!1;var c=b||this,f=document.createElement("div");f.className="waves-ripple",c.appendChild(f);var g=d(c),h=a.pageY-g.top,i=a.pageX-g.left,k="scale("+c.clientWidth/100*10+")";"touches"in a&&(h=a.touches[0].pageY-g.top,i=a.touches[0].pageX-g.left),f.setAttribute("data-hold",Date.now()),f.setAttribute("data-scale",k),f.setAttribute("data-x",i),f.setAttribute("data-y",h);var l={top:h+"px",left:i+"px"};f.className=f.className+" waves-notransition",f.setAttribute("style",e(l)),f.className=f.className.replace("waves-notransition",""),l["-webkit-transform"]=k,l["-moz-transform"]=k,l["-ms-transform"]=k,l["-o-transform"]=k,l.transform=k,l.opacity="1",l["-webkit-transition-duration"]=j.duration+"ms",l["-moz-transition-duration"]=j.duration+"ms",l["-o-transition-duration"]=j.duration+"ms",l["transition-duration"]=j.duration+"ms",l["-webkit-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",l["-moz-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",l["-o-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",l["transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",f.setAttribute("style",e(l))},hide:function(a){k.touchup(a);var b=this,c=(1.4*b.clientWidth,null),d=b.getElementsByClassName("waves-ripple");if(!(d.length>0))return!1;c=d[d.length-1];var f=c.getAttribute("data-x"),g=c.getAttribute("data-y"),h=c.getAttribute("data-scale"),i=Date.now()-Number(c.getAttribute("data-hold")),l=350-i;0>l&&(l=0),setTimeout(function(){var a={top:g+"px",left:f+"px",opacity:"0","-webkit-transition-duration":j.duration+"ms","-moz-transition-duration":j.duration+"ms","-o-transition-duration":j.duration+"ms","transition-duration":j.duration+"ms","-webkit-transform":h,"-moz-transform":h,"-ms-transform":h,"-o-transform":h,transform:h};c.setAttribute("style",e(a)),setTimeout(function(){try{b.removeChild(c)}catch(a){return!1}},j.duration)},l)},wrapInput:function(a){for(var b=0;b<a.length;b++){var c=a[b];if("input"===c.tagName.toLowerCase()){var d=c.parentNode;if("i"===d.tagName.toLowerCase()&&-1!==d.className.indexOf("waves-effect"))continue;var e=document.createElement("i");e.className=c.className+" waves-input-wrapper";var f=c.getAttribute("style");f||(f=""),e.setAttribute("style",f),c.className="waves-button-input",c.removeAttribute("style"),d.replaceChild(e,c),e.appendChild(c)}}}},k={touches:0,allowEvent:function(a){var b=!0;return"touchstart"===a.type?k.touches+=1:"touchend"===a.type||"touchcancel"===a.type?setTimeout(function(){k.touches>0&&(k.touches-=1)},500):"mousedown"===a.type&&k.touches>0&&(b=!1),b},touchup:function(a){k.allowEvent(a)}};h.displayEffect=function(b){b=b||{},"duration"in b&&(j.duration=b.duration),j.wrapInput(i(".waves-effect")),"ontouchstart"in a&&document.body.addEventListener("touchstart",g,!1),document.body.addEventListener("mousedown",g,!1)},h.attach=function(b){"input"===b.tagName.toLowerCase()&&(j.wrapInput([b]),b=b.parentElement),"ontouchstart"in a&&b.addEventListener("touchstart",g,!1),b.addEventListener("mousedown",g,!1)},a.Waves=h,document.addEventListener("DOMContentLoaded",function(){h.displayEffect()},!1)}(window),function(a){var b={init:function(b){var c={menuWidth:240,edge:"left",closeOnClick:!1};b=a.extend(c,b),a(this).each(function(){function c(){f=!1,g=!1,a("#sidenav-overlay").velocity({opacity:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){a(this).remove()}}),"left"===b.edge?(a(".drag-target").css({width:"",right:"",left:"0"}),e.velocity({left:-1*(b.menuWidth+10)},{duration:200,queue:!1,easing:"easeOutCubic"})):(a(".drag-target").css({width:"",right:"0",left:""}),e.velocity({right:-1*(b.menuWidth+10)},{duration:200,queue:!1,easing:"easeOutCubic"}))}var d=a(this),e=a("#"+d.attr("data-activates"));240!=b.menuWidth&&(e.css("width",b.menuWidth),e.hasClass("fixed")||e.css("left",-1*(b.menuWidth+10))),"left"!=b.edge&&e.addClass("right-aligned"),a("body").append(a('<div class="drag-target"></div>')),a(".drag-target").css("left"===b.edge?{left:0}:{right:0}),e.hasClass("fixed")&&a(window).resize(function(){a(window).width()>1200&&e.attr("style")&&(e.removeAttr("style"),e.css("width",b.menuWidth)),0!=a("#sidenav-overlay").css("opacity")&&g&&a("#sidenav-overlay").trigger("click")}),1==b.closeOnClick&&e.on("click.itemclick","a:not(.collapsible-header)",function(){c()});var f=!1,g=!1;a(".drag-target").hammer({prevent_default:!1}).bind("tap",function(){a("#sidenav-overlay").trigger("click")}).bind("pan",function(d){if("touch"===d.gesture.pointerType){{var f=(d.gesture.direction,d.gesture.center.x);d.gesture.center.y,d.gesture.velocityX}if(!a("#sidenav-overlay").length){var h=a('<div id="sidenav-overlay"></div>');h.css("opacity",0).click(function(){c()}),a("body").append(h)}if("left"===b.edge?f>b.menuWidth?f=b.menuWidth:0>f&&(f=0):f<a(window).width()-b.menuWidth&&(f=a(window).width()-b.menuWidth),"left"===b.edge?(f<b.menuWidth/2?g=!1:f>=b.menuWidth/2&&(g=!0),e.css("left",f-b.menuWidth)):(f<a(window).width()-b.menuWidth/2?g=!0:f>=a(window).width()-b.menuWidth/2&&(g=!1),e.css("right",-1*(f-b.menuWidth/2))),"left"===b.edge){var i=f/b.menuWidth;a("#sidenav-overlay").velocity({opacity:i},{duration:50,queue:!1,easing:"easeOutQuad"})}else{var i=Math.abs((f-a(window).width())/b.menuWidth);a("#sidenav-overlay").velocity({opacity:i},{duration:50,queue:!1,easing:"easeOutQuad"})}}}).bind("panend",function(c){if("touch"===c.gesture.pointerType){var d=c.gesture.velocityX;f=!1,"left"===b.edge?g&&.3>=d||-.5>d?(e.velocity({left:0},{duration:300,queue:!1,easing:"easeOutQuad"}),a("#sidenav-overlay").velocity({opacity:1},{duration:50,queue:!1,easing:"easeOutQuad"}),a(".drag-target").css({width:"50%",right:0,left:""})):(!g||d>.3)&&(e.velocity({left:-240},{duration:300,queue:!1,easing:"easeOutQuad"}),a("#sidenav-overlay").velocity({opacity:0},{duration:50,queue:!1,easing:"easeOutQuad",complete:function(){a(this).remove()}}),a(".drag-target").css({width:"10%",right:"",left:0})):g&&d>=-.3||d>.5?(e.velocity({right:0},{duration:300,queue:!1,easing:"easeOutQuad"}),a("#sidenav-overlay").velocity({opacity:1},{duration:50,queue:!1,easing:"easeOutQuad"}),a(".drag-target").css({width:"50%",right:"",left:0})):(!g||-.3>d)&&(e.velocity({right:-240},{duration:300,queue:!1,easing:"easeOutQuad"}),a("#sidenav-overlay").velocity({opacity:0},{duration:50,queue:!1,easing:"easeOutQuad",complete:function(){a(this).remove()}}),a(".drag-target").css({width:"10%",right:0,left:""}))}}),d.click(function(){if(1==g)g=!1,f=!1,c();else{"left"===b.edge?(a(".drag-target").css({width:"50%",right:0,left:""}),e.velocity({left:0},{duration:300,queue:!1,easing:"easeOutQuad"})):(a(".drag-target").css({width:"50%",right:"",left:0}),e.velocity({right:0},{duration:300,queue:!1,easing:"easeOutQuad"}),e.css("left",""));var d=a('<div id="sidenav-overlay"></div>');d.css("opacity",0).click(function(){g=!1,f=!1,c(),d.animate({opacity:0},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){a(this).remove()}})}),a("body").append(d),d.animate({opacity:1},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){g=!0,f=!1}})}return!1})})},show:function(){this.trigger("click")},hide:function(){a("#sidenav-overlay").trigger("click")}};a.fn.sideNav=function(c){return b[c]?b[c].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof c&&c?void a.error("Method "+c+" does not exist on jQuery.tooltip"):b.init.apply(this,arguments)}}(jQuery),function(a){function b(b,c,d,e){var f=a();return a.each(g,function(a,g){if(g.height()>0){var h=g.offset().top,i=g.offset().left,j=i+g.width(),k=h+g.height(),l=!(i>c||e>j||h>d||b>k);l&&f.push(g)}}),f}function c(){++j;var c=f.scrollTop(),d=f.scrollLeft(),e=d+f.width(),g=c+f.height(),i=b(c+k.top+200,e+k.right,g+k.bottom,d+k.left);a.each(i,function(a,b){var c=b.data("scrollSpy:ticks");"number"!=typeof c&&b.triggerHandler("scrollSpy:enter"),b.data("scrollSpy:ticks",j)}),a.each(h,function(a,b){var c=b.data("scrollSpy:ticks");"number"==typeof c&&c!==j&&(b.triggerHandler("scrollSpy:exit"),b.data("scrollSpy:ticks",null))}),h=i}function d(){f.trigger("scrollSpy:winSize")}function e(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:l(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=l();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}}var f=a(window),g=[],h=[],i=!1,j=0,k={top:0,right:0,bottom:0,left:0},l=Date.now||function(){return(new Date).getTime()};a.scrollSpy=function(b,d){var h=[];b=a(b),b.each(function(b,c){g.push(a(c)),a(c).data("scrollSpy:id",b),a("a[href=#"+a(c).attr("id")+"]").click(function(b){b.preventDefault();var c=a(this.hash).offset().top+1;a(".tabs-wrapper").length?a("html, body").animate({scrollTop:c-60},{duration:400,easing:"easeOutCubic"}):a("html, body").animate({scrollTop:c},{duration:400,easing:"easeOutCubic"})})}),d=d||{throttle:100},k.top=d.offsetTop||0,k.right=d.offsetRight||0,k.bottom=d.offsetBottom||0,k.left=d.offsetLeft||0;var j=e(c,d.throttle||100),l=function(){a(document).ready(j)};return i||(f.on("scroll",l),f.on("resize",l),i=!0),setTimeout(l,0),b.on("scrollSpy:enter",function(){h=a.grep(h,function(a){return 0!=a.height()});var b=a(this);h[0]?(a("a[href=#"+h[0].attr("id")+"]").removeClass("active"),b.data("scrollSpy:id")<h[0].data("scrollSpy:id")?h.unshift(a(this)):h.push(a(this))):h.push(a(this)),a("a[href=#"+h[0].attr("id")+"]").addClass("active")}),b.on("scrollSpy:exit",function(){if(h=a.grep(h,function(a){return 0!=a.height()}),h[0]){a("a[href=#"+h[0].attr("id")+"]").removeClass("active");var b=a(this);h=a.grep(h,function(a){return a.attr("id")!=b.attr("id")}),h[0]&&a("a[href=#"+h[0].attr("id")+"]").addClass("active")}}),b},a.winSizeSpy=function(b){return a.winSizeSpy=function(){return f},b=b||{throttle:100},f.on("resize",e(d,b.throttle||100))},a.fn.scrollSpy=function(b){return a.scrollSpy(a(this),b)}}(jQuery),function(a){a(document).ready(function(){var b="input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea";if(a(document).on("change",b,function(){0!==a(this).val().length&&a(this).siblings("label, i").addClass("active"),validate_field(a(this))}),a(document).ready(function(){a(b).each(function(b,c){a(c).val().length>0&&a(this).siblings("label, i").addClass("active")})}),a(document).on("reset",function(c){a(c.target).is("form")&&(a(this).find(b).removeClass("valid").removeClass("invalid"),a(this).find("select.initialized").each(function(){var b=a(this).find("option[selected]").text();a(this).siblings("input.select-dropdown").val(b)}))}),a(document).on("focus",b,function(){a(this).siblings("label, i").addClass("active")}),a(document).on("blur",b,function(){0===a(this).val().length&&a(this).siblings("label, i").removeClass("active"),validate_field(a(this))}),validate_field=function(a){0===a.val().length?a.hasClass("validate")&&(a.removeClass("valid"),a.removeClass("invalid")):a.hasClass("validate")&&(a.is(":valid")?(a.removeClass("invalid"),a.addClass("valid")):(a.removeClass("valid"),a.addClass("invalid")))},0===a(".hiddendiv").length){var c=a('<div class="hiddendiv common"></div>'),d=null;a("body").append(c)}var e=".materialize-textarea";a(".hiddendiv").css("width",a(e).width()),a(e).each(function(){a(this).val().length&&(d=a(this).val(),d=d.replace(/\n/g,"<br>"),c.html(d+"<br>"),a(this).css("height",c.height()))}),a("body").on("keyup keydown",e,function(){d=a(this).val(),d=d.replace(/\n/g,"<br>"),c.html(d+"<br>"),a(this).css("height",c.height())}),a(".file-field").each(function(){var b=a(this).find("input.file-path");a(this).find('input[type="file"]').change(function(){b.val(a(this).val()),b.trigger("change")})});var f="input[type=range]",g=!1;a(f).each(function(){var b=a('<span class="thumb"><span class="value"></span></span>');a(this).after(b)});var h=".range-field";a(document).on("mousedown",h,function(b){var c=a(this).children(".thumb");c.length<=0&&(c=a('<span class="thumb"><span class="value"></span></span>'),a(this).append(c)),g=!0,a(this).addClass("active"),c.hasClass("active")||c.velocity({height:"30px",width:"30px",top:"-20px",marginLeft:"-15px"},{duration:300,easing:"easeOutExpo"});var d=b.pageX-a(this).offset().left,e=a(this).outerWidth();0>d?d=0:d>e&&(d=e),c.addClass("active").css("left",d),c.find(".value").html(a(this).children("input[type=range]").val())}),a(document).on("mouseup",h,function(){g=!1,a(this).removeClass("active")}),a(document).on("mousemove",h,function(b){var c=a(this).children(".thumb");if(g){c.hasClass("active")||c.velocity({height:"30px",width:"30px",top:"-20px",marginLeft:"-15px"},{duration:300,easing:"easeOutExpo"});var d=b.pageX-a(this).offset().left,e=a(this).outerWidth();0>d?d=0:d>e&&(d=e),c.addClass("active").css("left",d),c.find(".value").html(a(this).children("input[type=range]").val())}}),a(document).on("mouseout",h,function(){if(!g){var b=a(this).children(".thumb");b.hasClass("active")&&b.velocity({height:"0",width:"0",top:"10px",marginLeft:"-6px"},{duration:100}),b.removeClass("active")}}),a.fn.material_select=function(b){a(this).each(function(){if($select=a(this),!$select.hasClass("browser-default")&&!$select.hasClass("initialized")){var c=i(),d=a('<div class="select-wrapper"></div>'),e=a('<ul id="select-options-'+c+'" class="dropdown-content select-dropdown"></ul>'),f=$select.children("option");if(void 0!==$select.find("option:selected"))var g=$select.find("option:selected");else var g=e.first();f.each(function(){e.append(a('<li class="'+(a(this).is(":disabled")?"disabled":"")+'"><span>'+a(this).html()+"</span></li>"))}),e.find("li").each(function(c){var d=$select;a(this).click(function(){a(this).hasClass("disabled")||(d.find("option").eq(c).prop("selected",!0),d.trigger("change"),d.siblings("input.select-dropdown").val(a(this).text()),"undefined"!=typeof b&&b())})}),$select.wrap(d);var h=a('<input type="text" class="select-dropdown" readonly="true" '+($select.is(":disabled")?"disabled":"")+' data-activates="select-options-'+c+'" value="'+g.html()+'"/><i class="mdi-navigation-arrow-drop-down">');$select.before(h),a("body").append(e),$select.is(":disabled")||h.dropdown({hover:!1}),$select.addClass("initialized"),h.on("focus",function(){a(this).trigger("open"),g=a(this).val(),selectedOption=e.find("li").filter(function(){return a(this).text().toLowerCase()===g.toLowerCase()})[0],activateOption(e,selectedOption)}),h.on("blur",function(){a(this).trigger("close")}),activateOption=function(b,c){b.find("li.active").removeClass("active"),a(c).addClass("active"),b.scrollTo(c)},filterQuery=[],onKeyDown=function(b){return 9==b.which?void h.trigger("close"):40!=b.which||e.is(":visible")?void((13!=b.which||e.is(":visible"))&&(b.preventDefault(),letter=String.fromCharCode(b.which).toLowerCase(),letter&&(filterQuery.push(letter),string=filterQuery.join(""),newOption=e.find("li").filter(function(){return 0===a(this).text().toLowerCase().indexOf(string)})[0],newOption&&activateOption(e,newOption)),13==b.which&&(activeOption=e.find("li.active:not(.disabled)")[0],activeOption&&(a(activeOption).trigger("click"),h.trigger("close"))),40==b.which&&(newOption=e.find("li.active").next("li:not(.disabled)")[0],newOption&&activateOption(e,newOption)),27==b.which&&h.trigger("close"),38==b.which&&(newOption=e.find("li.active").prev("li:not(.disabled)")[0],newOption&&activateOption(e,newOption)),setTimeout(function(){filterQuery=[]},1e3))):void h.trigger("open")},h.on("keydown",onKeyDown)}})};var i=function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}}()})}(jQuery),function(a){a.fn.slider=function(b){var c={indicators:!0,height:400,transition:500,interval:6e4};return b=a.extend(c,b),this.each(function(){function c(a,b){a.hasClass("center-align")?a.velocity({opacity:0,translateY:-100},{duration:b,queue:!1}):a.hasClass("right-align")?a.velocity({opacity:0,translateX:100},{duration:b,queue:!1}):a.hasClass("left-align")&&a.velocity({opacity:0,translateX:-100},{duration:b,queue:!1})}function d(a){a>=h.length?a=0:0>a&&(a=h.length-1),i=g.find(".active").index(),i!=a&&(e=h.eq(i),$caption=e.find(".caption"),e.removeClass("active"),e.velocity({opacity:0},{duration:b.transition,queue:!1,easing:"easeOutQuad",complete:function(){h.not(".active").velocity({opacity:0,translateX:0,translateY:0},{duration:0,queue:!1})}}),c($caption,b.transition),b.indicators&&j.eq(i).removeClass("active"),h.eq(a).velocity({opacity:1},{duration:b.transition,queue:!1,easing:"easeOutQuad"}),h.eq(a).find(".caption").velocity({opacity:1,translateX:0,translateY:0},{duration:b.transition,delay:b.transition,queue:!1,easing:"easeOutQuad"}),h.eq(a).addClass("active"),b.indicators&&j.eq(a).addClass("active"))}var e,f=a(this),g=f.find("ul.slides").first(),h=g.find("li"),i=g.find(".active").index();if(-1!=i&&(e=h.eq(i)),400!=b.height&&(f.height(b.height+40),g.height(b.height)),h.find(".caption").each(function(){c(a(this),0)}),h.find("img").each(function(){a(this).css("background-image","url("+a(this).attr("src")+")"),a(this).attr("src","data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")}),b.indicators){var j=a('<ul class="indicators"></ul>');h.each(function(){var c=a('<li class="indicator-item"></li>');c.click(function(){var c=g.parent(),e=c.find(a(this)).index();d(e),clearInterval($interval),$interval=setInterval(function(){i=g.find(".active").index(),h.length==i+1?i=0:i+=1,d(i)},b.transition+b.interval)}),j.append(c)}),f.append(j),j=f.find("ul.indicators").find("li.indicator-item")}e?e.show():(h.first().addClass("active").velocity({opacity:1},{duration:b.transition,queue:!1,easing:"easeOutQuad"}),i=0,e=h.eq(i),b.indicators&&j.eq(i).addClass("active")),e.find("img").each(function(){e.find(".caption").velocity({opacity:1,translateX:0,translateY:0},{duration:b.transition,queue:!1,easing:"easeOutQuad"})}),$interval=setInterval(function(){i=g.find(".active").index(),d(i+1)},b.transition+b.interval);var k=!1,l=!1,m=!1;f.hammer({prevent_default:!1}).bind("pan",function(a){if("touch"===a.gesture.pointerType){clearInterval($interval);var b=a.gesture.direction,c=a.gesture.deltaX,d=a.gesture.velocityX;$curr_slide=g.find(".active"),$curr_slide.velocity({translateX:c},{duration:50,queue:!1,easing:"easeOutQuad"}),4===b&&(c>f.innerWidth()/2||-.65>d)?m=!0:2===b&&(c<-1*f.innerWidth()/2||d>.65)&&(l=!0);var e;l&&(e=$curr_slide.next(),0===e.length&&(e=h.first()),e.velocity({opacity:1},{duration:300,queue:!1,easing:"easeOutQuad"})),m&&(e=$curr_slide.prev(),0===e.length&&(e=h.last()),e.velocity({opacity:1},{duration:300,queue:!1,easing:"easeOutQuad"}))}}).bind("panend",function(a){"touch"===a.gesture.pointerType&&($curr_slide=g.find(".active"),k=!1,curr_index=g.find(".active").index(),m||l?l?(d(curr_index+1),$curr_slide.velocity({translateX:-1*f.innerWidth()},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){$curr_slide.velocity({opacity:0,translateX:0},{duration:0,queue:!1})}})):m&&(d(curr_index-1),$curr_slide.velocity({translateX:f.innerWidth()},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){$curr_slide.velocity({opacity:0,translateX:0},{duration:0,queue:!1})}})):$curr_slide.velocity({translateX:0},{duration:300,queue:!1,easing:"easeOutQuad"}),l=!1,m=!1,clearInterval($interval),$interval=setInterval(function(){i=g.find(".active").index(),h.length==i+1?i=0:i+=1,d(i)},b.transition+b.interval))})})}}(jQuery),function(a){a(document).ready(function(){a(document).on("click.card",".card",function(b){a(this).find(".card-reveal").length&&(a(b.target).is(a(".card-reveal .card-title"))||a(b.target).is(a(".card-reveal .card-title i"))?a(this).find(".card-reveal").velocity({translateY:0},{duration:225,queue:!1,easing:"easeInOutQuad"}):(a(b.target).is(a(".card .activator"))||a(b.target).is(a(".card .activator i")))&&a(this).find(".card-reveal").velocity({translateY:"-100%"},{duration:300,queue:!1,easing:"easeInOutQuad"}))})})}(jQuery),function(a){a(document).ready(function(){var b=function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}}();a.fn.pushpin=function(c){var d={top:0,bottom:1/0,offset:0};return c=a.extend(d,c),$index=0,this.each(function(){function d(a){a.removeClass("pin-top"),a.removeClass("pinned"),a.removeClass("pin-bottom")}function e(b,e){b.each(function(){c.top<=e&&c.bottom>=e&&!a(this).hasClass("pinned")&&(d(a(this)),a(this).css("top",c.offset),a(this).addClass("pinned")),e<c.top&&!a(this).hasClass("pin-top")&&(d(a(this)),a(this).css("top",0),a(this).addClass("pin-top")),e>c.bottom&&!a(this).hasClass("pin-bottom")&&(d(a(this)),a(this).addClass("pin-bottom"),a(this).css("top",c.bottom-h))})}var f=b(),g=a(this),h=a(this).offset().top;e(g,a(window).scrollTop()),a(window).on("scroll."+f,function(){var b=a(window).scrollTop()+c.offset;e(g,b)})})}})}(jQuery),function(a){a(document).ready(function(){a.fn.reverse=[].reverse,a(document).on("mouseenter.fixedActionBtn",".fixed-action-btn",function(){var b=a(this);b.find("ul a.btn-floating").velocity({scaleY:".4",scaleX:".4",translateY:"40px"},{duration:0});var c=0;b.find("ul a.btn-floating").reverse().each(function(){a(this).velocity({opacity:"1",scaleX:"1",scaleY:"1",translateY:"0"},{duration:80,delay:c}),c+=40})}),a(document).on("mouseleave.fixedActionBtn",".fixed-action-btn",function(){var b=a(this);b.find("ul a.btn-floating").velocity("stop",!0),b.find("ul a.btn-floating").velocity({opacity:"0",scaleX:".4",scaleY:".4",translateY:"40px"},{duration:80})})})}(jQuery),function(a){a(document).ready(function(){showStaggeredList=function(b){var c=0;a(b).find("li").velocity({translateX:"-100px"},{duration:0}),a(b).find("li").each(function(){a(this).velocity({opacity:"1",translateX:"0"},{duration:800,delay:c,easing:[60,10]}),c+=120})};var b=[];a("ul.staggered-list").each(function(c){var d="scrollFire-"+c;a(this).addClass(d),b.push({selector:"ul.staggered-list."+d,offset:200,callback:'showStaggeredList("ul.staggered-list.'+d+'")'})}),scrollFire(b);var c=!1,d=!1;a(".dismissable").each(function(){a(this).hammer({prevent_default:!1}).bind("pan",function(b){if("touch"===b.gesture.pointerType){var e=a(this),f=b.gesture.direction,g=b.gesture.deltaX,h=b.gesture.velocityX;e.velocity({translateX:g},{duration:50,queue:!1,easing:"easeOutQuad"}),4===f&&(g>e.innerWidth()/2||-.75>h)?c=!0:2===f&&(g<-1*e.innerWidth()/2||h>.75)&&(d=!0)}}).bind("panend",function(b){if("touch"===b.gesture.pointerType){var e=a(this);if(c||d){var f;f=c?e.innerWidth():-1*e.innerWidth(),e.velocity({translateX:f},{duration:100,queue:!1,easing:"easeOutQuad",complete:function(){e.css("border","none"),e.velocity({height:0,padding:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){e.remove()}})}})}else e.velocity({translateX:0},{duration:100,queue:!1,easing:"easeOutQuad"});c=!1,d=!1}})}),fadeInImage=function(b){var c=a(b);c.css({opacity:0}),a(c).velocity({opacity:1},{duration:650,queue:!1,easing:"easeOutSine"}),a(c).animate({opacity:1},{duration:1300,queue:!1,easing:"swing",step:function(b,c){c.start=100;var d=b/100,e=150-(100-b)/1.75;100>e&&(e=100),b>=0&&a(this).css({"-webkit-filter":"grayscale("+d+")brightness("+e+"%)",filter:"grayscale("+d+")brightness("+e+"%)"})}})}})}(jQuery),function(a){scrollFire=function(b){a(window).scroll(function(){var c=a(window).scrollTop()+a(window).height();a.each(b,function(b,d){var e=d.selector,f=d.offset,g=d.callback,h=a(e).offset().top;if(c>h+f&&1!=d.done){var i=new Function(g);i(),d.done=!0}})})}}(jQuery),function(a){"function"==typeof define&&define.amd?define("picker",["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):this.Picker=a(jQuery)}(function(a){function b(f,g,i,l){function m(){return b._.node("div",b._.node("div",b._.node("div",b._.node("div",y.component.nodes(t.open),v.box),v.wrap),v.frame),v.holder)}function n(){w.data(g,y).addClass(v.input).attr("tabindex",-1).val(w.data("value")?y.get("select",u.format):f.value),u.editable||w.on("focus."+t.id+" click."+t.id,function(a){a.preventDefault(),y.$root[0].focus()}).on("keydown."+t.id,q),e(f,{haspopup:!0,expanded:!1,readonly:!1,owns:f.id+"_root"})}function o(){y.$root.on({keydown:q,focusin:function(a){y.$root.removeClass(v.focused),a.stopPropagation()},"mousedown click":function(b){var c=b.target;c!=y.$root.children()[0]&&(b.stopPropagation(),"mousedown"!=b.type||a(c).is("input, select, textarea, button, option")||(b.preventDefault(),y.$root[0].focus()))}}).on({focus:function(){w.addClass(v.target)},blur:function(){w.removeClass(v.target)}}).on("focus.toOpen",r).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var b=a(this),c=b.data(),d=b.hasClass(v.navDisabled)||b.hasClass(v.disabled),e=h();e=e&&(e.type||e.href),(d||e&&!a.contains(y.$root[0],e))&&y.$root[0].focus(),!d&&c.nav?y.set("highlight",y.component.item.highlight,{nav:c.nav}):!d&&"pick"in c?y.set("select",c.pick):c.clear?y.clear().close(!0):c.close&&y.close(!0)}),e(y.$root[0],"hidden",!0)}function p(){var b;u.hiddenName===!0?(b=f.name,f.name=""):(b=["string"==typeof u.hiddenPrefix?u.hiddenPrefix:"","string"==typeof u.hiddenSuffix?u.hiddenSuffix:"_submit"],b=b[0]+f.name+b[1]),y._hidden=a('<input type=hidden name="'+b+'"'+(w.data("value")||f.value?' value="'+y.get("select",u.formatSubmit)+'"':"")+">")[0],w.on("change."+t.id,function(){y._hidden.value=f.value?y.get("select",u.formatSubmit):""}),u.container?a(u.container).append(y._hidden):w.after(y._hidden)}function q(a){var b=a.keyCode,c=/^(8|46)$/.test(b);return 27==b?(y.close(),!1):void((32==b||c||!t.open&&y.component.key[b])&&(a.preventDefault(),a.stopPropagation(),c?y.clear().close():y.open()))
9
- }function r(a){a.stopPropagation(),"focus"==a.type&&y.$root.addClass(v.focused),y.open()}if(!f)return b;var s=!1,t={id:f.id||"P"+Math.abs(~~(Math.random()*new Date))},u=i?a.extend(!0,{},i.defaults,l):l||{},v=a.extend({},b.klasses(),u.klass),w=a(f),x=function(){return this.start()},y=x.prototype={constructor:x,$node:w,start:function(){return t&&t.start?y:(t.methods={},t.start=!0,t.open=!1,t.type=f.type,f.autofocus=f==h(),f.readOnly=!u.editable,f.id=f.id||t.id,"text"!=f.type&&(f.type="text"),y.component=new i(y,u),y.$root=a(b._.node("div",m(),v.picker,'id="'+f.id+'_root" tabindex="0"')),o(),u.formatSubmit&&p(),n(),u.container?a(u.container).append(y.$root):w.after(y.$root),y.on({start:y.component.onStart,render:y.component.onRender,stop:y.component.onStop,open:y.component.onOpen,close:y.component.onClose,set:y.component.onSet}).on({start:u.onStart,render:u.onRender,stop:u.onStop,open:u.onOpen,close:u.onClose,set:u.onSet}),s=c(y.$root.children()[0]),f.autofocus&&y.open(),y.trigger("start").trigger("render"))},render:function(a){return a?y.$root.html(m()):y.$root.find("."+v.box).html(y.component.nodes(t.open)),y.trigger("render")},stop:function(){return t.start?(y.close(),y._hidden&&y._hidden.parentNode.removeChild(y._hidden),y.$root.remove(),w.removeClass(v.input).removeData(g),setTimeout(function(){w.off("."+t.id)},0),f.type=t.type,f.readOnly=!1,y.trigger("stop"),t.methods={},t.start=!1,y):y},open:function(c){return t.open?y:(w.addClass(v.active),e(f,"expanded",!0),setTimeout(function(){y.$root.addClass(v.opened),e(y.$root[0],"hidden",!1)},0),c!==!1&&(t.open=!0,s&&k.css("overflow","hidden").css("padding-right","+="+d()),y.$root[0].focus(),j.on("click."+t.id+" focusin."+t.id,function(a){var b=a.target;b!=f&&b!=document&&3!=a.which&&y.close(b===y.$root.children()[0])}).on("keydown."+t.id,function(c){var d=c.keyCode,e=y.component.key[d],f=c.target;27==d?y.close(!0):f!=y.$root[0]||!e&&13!=d?a.contains(y.$root[0],f)&&13==d&&(c.preventDefault(),f.click()):(c.preventDefault(),e?b._.trigger(y.component.key.go,y,[b._.trigger(e)]):y.$root.find("."+v.highlighted).hasClass(v.disabled)||y.set("select",y.component.item.highlight).close())})),y.trigger("open"))},close:function(a){return a&&(y.$root.off("focus.toOpen")[0].focus(),setTimeout(function(){y.$root.on("focus.toOpen",r)},0)),w.removeClass(v.active),e(f,"expanded",!1),setTimeout(function(){y.$root.removeClass(v.opened+" "+v.focused),e(y.$root[0],"hidden",!0)},0),t.open?(t.open=!1,s&&k.css("overflow","").css("padding-right","-="+d()),j.off("."+t.id),y.trigger("close")):y},clear:function(a){return y.set("clear",null,a)},set:function(b,c,d){var e,f,g=a.isPlainObject(b),h=g?b:{};if(d=g&&a.isPlainObject(c)?c:d||{},b){g||(h[b]=c);for(e in h)f=h[e],e in y.component.item&&(void 0===f&&(f=null),y.component.set(e,f,d)),("select"==e||"clear"==e)&&w.val("clear"==e?"":y.get(e,u.format)).trigger("change");y.render()}return d.muted?y:y.trigger("set",h)},get:function(a,c){if(a=a||"value",null!=t[a])return t[a];if("valueSubmit"==a){if(y._hidden)return y._hidden.value;a="value"}if("value"==a)return f.value;if(a in y.component.item){if("string"==typeof c){var d=y.component.get(a);return d?b._.trigger(y.component.formats.toString,y.component,[c,d]):""}return y.component.get(a)}},on:function(b,c,d){var e,f,g=a.isPlainObject(b),h=g?b:{};if(b){g||(h[b]=c);for(e in h)f=h[e],d&&(e="_"+e),t.methods[e]=t.methods[e]||[],t.methods[e].push(f)}return y},off:function(){var a,b,c=arguments;for(a=0,namesCount=c.length;a<namesCount;a+=1)b=c[a],b in t.methods&&delete t.methods[b];return y},trigger:function(a,c){var d=function(a){var d=t.methods[a];d&&d.map(function(a){b._.trigger(a,y,[c])})};return d("_"+a),d(a),y}};return new x}function c(a){var b,c="position";return a.currentStyle?b=a.currentStyle[c]:window.getComputedStyle&&(b=getComputedStyle(a)[c]),"fixed"==b}function d(){if(k.height()<=i.height())return 0;var b=a('<div style="visibility:hidden;width:100px" />').appendTo("body"),c=b[0].offsetWidth;b.css("overflow","scroll");var d=a('<div style="width:100%" />').appendTo(b),e=d[0].offsetWidth;return b.remove(),c-e}function e(b,c,d){if(a.isPlainObject(c))for(var e in c)f(b,e,c[e]);else f(b,c,d)}function f(a,b,c){a.setAttribute(("role"==b?"":"aria-")+b,c)}function g(b,c){a.isPlainObject(b)||(b={attribute:c}),c="";for(var d in b){var e=("role"==d?"":"aria-")+d,f=b[d];c+=null==f?"":e+'="'+b[d]+'"'}return c}function h(){try{return document.activeElement}catch(a){}}var i=a(window),j=a(document),k=a(document.documentElement);return b.klasses=function(a){return a=a||"picker",{picker:a,opened:a+"--opened",focused:a+"--focused",input:a+"__input",active:a+"__input--active",target:a+"__input--target",holder:a+"__holder",frame:a+"__frame",wrap:a+"__wrap",box:a+"__box"}},b._={group:function(a){for(var c,d="",e=b._.trigger(a.min,a);e<=b._.trigger(a.max,a,[e]);e+=a.i)c=b._.trigger(a.item,a,[e]),d+=b._.node(a.node,c[0],c[1],c[2]);return d},node:function(b,c,d,e){return c?(c=a.isArray(c)?c.join(""):c,d=d?' class="'+d+'"':"",e=e?" "+e:"","<"+b+d+e+">"+c+"</"+b+">"):""},lead:function(a){return(10>a?"0":"")+a},trigger:function(a,b,c){return"function"==typeof a?a.apply(b,c||[]):a},digits:function(a){return/\d/.test(a[1])?2:1},isDate:function(a){return{}.toString.call(a).indexOf("Date")>-1&&this.isInteger(a.getDate())},isInteger:function(a){return{}.toString.call(a).indexOf("Number")>-1&&a%1===0},ariaAttr:g},b.extend=function(c,d){a.fn[c]=function(e,f){var g=this.data(c);return"picker"==e?g:g&&"string"==typeof e?b._.trigger(g[e],g,[f]):this.each(function(){var f=a(this);f.data(c)||new b(this,c,d,e)})},a.fn[c].defaults=d.defaults},b}),function(a){"function"==typeof define&&define.amd?define(["picker","jquery"],a):"object"==typeof exports?module.exports=a(require("./picker.js"),require("jquery")):a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0],e=d.value,f=a.$node.data("value"),g=f||e,h=f?b.formatSubmit:b.format,i=function(){return d.currentStyle?"rtl"==d.currentStyle.direction:"rtl"==getComputedStyle(a.$root[0]).direction};c.settings=b,c.$node=a.$node,c.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return a[0]===!0?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),g?c.set("select",g,{format:h}):c.set("select",null).set("highlight",c.item.now),c.key={40:7,38:-7,39:function(){return i()?-1:1},37:function(){return i()?1:-1},go:function(a){var b=c.item.highlight,d=new Date(b.year,b.month,b.date+a);c.set("highlight",d,{interval:a}),this.render()}},a.on("render",function(){a.$root.find("."+b.klass.selectMonth).on("change",function(){var c=this.value;c&&(a.set("highlight",[a.get("view").year,c,a.get("highlight").date]),a.$root.find("."+b.klass.selectMonth).trigger("focus"))}),a.$root.find("."+b.klass.selectYear).on("change",function(){var c=this.value;c&&(a.set("highlight",[c,a.get("view").month,a.get("highlight").date]),a.$root.find("."+b.klass.selectYear).trigger("focus"))})},1).on("open",function(){var d="";c.disabled(c.get("now"))&&(d=":not(."+b.klass.buttonToday+")"),a.$root.find("button"+d+", select").attr("disabled",!1)},1).on("close",function(){a.$root.find("button, select").attr("disabled",!0)},1)}var d=7,e=6,f=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",e.select,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",e.highlight,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,d){var e,g=this;return c=void 0===c?a:c,c==-1/0||1/0==c?e=c:b.isPlainObject(c)&&f.isInteger(c.pick)?c=c.obj:b.isArray(c)?(c=new Date(c[0],c[1],c[2]),c=f.isDate(c)?c:g.create().obj):c=f.isInteger(c)||f.isDate(c)?g.normalize(new Date(c),d):g.now(a,c,d),{year:e||c.getFullYear(),month:e||c.getMonth(),date:e||c.getDate(),day:e||c.getDay(),obj:e||c,pick:e||c.getTime()}},c.prototype.createRange=function(a,c){var d=this,e=function(a){return a===!0||b.isArray(a)||f.isDate(a)?d.create(a):a};return f.isInteger(a)||(a=e(a)),f.isInteger(c)||(c=e(c)),f.isInteger(a)&&b.isPlainObject(c)?a=[c.year,c.month,c.date+a]:f.isInteger(c)&&b.isPlainObject(a)&&(c=[a.year,a.month,a.date+c]),{from:e(a),to:e(c)}},c.prototype.withinRange=function(a,b){return a=this.createRange(a.from,a.to),b.pick>=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b,c){return b=new Date,c&&c.rel&&b.setDate(b.getDate()+c.rel),this.normalize(b,c)},c.prototype.navigate=function(a,c,d){var e,f,g,h,i=b.isArray(c),j=b.isPlainObject(c),k=this.item.view;if(i||j){for(j?(f=c.year,g=c.month,h=c.date):(f=+c[0],g=+c[1],h=+c[2]),d&&d.nav&&k&&k.month!==g&&(f=k.year,g=k.month),e=new Date(f,g+(d&&d.nav?d.nav:0),1),f=e.getFullYear(),g=e.getMonth();new Date(f,g,h).getMonth()!==g;)h-=1;c=[f,g,h]}return c},c.prototype.normalize=function(a){return a.setHours(0,0,0,0),a},c.prototype.measure=function(a,b){var c=this;return b?"string"==typeof b?b=c.parse(a,b):f.isInteger(b)&&(b=c.now(a,b,{rel:b})):b="min"==a?-1/0:1/0,b},c.prototype.viewset=function(a,b){return this.create([b.year,b.month,1])},c.prototype.validate=function(a,c,d){var e,g,h,i,j=this,k=c,l=d&&d.interval?d.interval:1,m=-1===j.item.enable,n=j.item.min,o=j.item.max,p=m&&j.item.disable.filter(function(a){if(b.isArray(a)){var d=j.create(a).pick;d<c.pick?e=!0:d>c.pick&&(g=!0)}return f.isInteger(a)}).length;if((!d||!d.nav)&&(!m&&j.disabled(c)||m&&j.disabled(c)&&(p||e||g)||!m&&(c.pick<=n.pick||c.pick>=o.pick)))for(m&&!p&&(!g&&l>0||!e&&0>l)&&(l*=-1);j.disabled(c)&&(Math.abs(l)>1&&(c.month<k.month||c.month>k.month)&&(c=k,l=l>0?1:-1),c.pick<=n.pick?(h=!0,l=1,c=j.create([n.year,n.month,n.date+(c.pick===n.pick?0:-1)])):c.pick>=o.pick&&(i=!0,l=-1,c=j.create([o.year,o.month,o.date+(c.pick===o.pick?0:1)])),!h||!i);)c=j.create([c.year,c.month,c.date+l]);return c},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return f.isInteger(d)?a.day===(c.settings.firstDay?d:d-1)%7:b.isArray(d)||f.isDate(d)?a.pick===c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[3]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pick<c.item.min.pick||a.pick>c.item.max.pick},c.prototype.parse=function(a,b,c){var d=this,e={};return b&&"string"==typeof b?(c&&c.format||(c=c||{},c.format=d.settings.format),d.formats.toArray(c.format).map(function(a){var c=d.formats[a],g=c?f.trigger(c,d,[b,e]):a.replace(/^!/,"").length;c&&(e[a]=b.substr(0,g)),b=b.substr(g)}),[e.yyyy||e.yy,+(e.mm||e.m)-1,e.dd||e.d]):b},c.prototype.formats=function(){function a(a,b,c){var d=a.match(/\w+/)[0];return c.mm||c.m||(c.m=b.indexOf(d)+1),d.length}function b(a){return a.match(/\w+/)[0].length}return{d:function(a,b){return a?f.digits(a):b.date},dd:function(a,b){return a?2:f.lead(b.date)},ddd:function(a,c){return a?b(a):this.settings.weekdaysShort[c.day]},dddd:function(a,c){return a?b(a):this.settings.weekdaysFull[c.day]},m:function(a,b){return a?f.digits(a):b.month+1},mm:function(a,b){return a?2:f.lead(b.month+1)},mmm:function(b,c){var d=this.settings.monthsShort;return b?a(b,d,c):d[c.month]},mmmm:function(b,c){var d=this.settings.monthsFull;return b?a(b,d,c):d[c.month]},yy:function(a,b){return a?2:(""+b.year).slice(2)},yyyy:function(a,b){return a?4:b.year},toArray:function(a){return a.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return f.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}}}(),c.prototype.isDateExact=function(a,c){var d=this;return f.isInteger(a)&&f.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(f.isDate(a)||b.isArray(a))&&(f.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:b.isPlainObject(a)&&b.isPlainObject(c)?d.isDateExact(a.from,c.from)&&d.isDateExact(a.to,c.to):!1},c.prototype.isDateOverlap=function(a,c){var d=this,e=d.settings.firstDay?1:0;return f.isInteger(a)&&(f.isDate(c)||b.isArray(c))?(a=a%7+e,a===d.create(c).day+1):f.isInteger(c)&&(f.isDate(a)||b.isArray(a))?(c=c%7+e,c===d.create(a).day+1):b.isPlainObject(a)&&b.isPlainObject(c)?d.overlapRanges(a,c):!1},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,e=d.item.disable.slice(0);return"flip"==c?d.flipEnable():c===!1?(d.flipEnable(1),e=[]):c===!0?(d.flipEnable(-1),e=[]):c.map(function(a){for(var c,g=0;g<e.length;g+=1)if(d.isDateExact(a,e[g])){c=!0;break}c||(f.isInteger(a)||f.isDate(a)||b.isArray(a)||b.isPlainObject(a)&&a.from&&a.to)&&e.push(a)}),e},c.prototype.activate=function(a,c){var d=this,e=d.item.disable,g=e.length;return"flip"==c?d.flipEnable():c===!0?(d.flipEnable(1),e=[]):c===!1?(d.flipEnable(-1),e=[]):c.map(function(a){var c,h,i,j;for(i=0;g>i;i+=1){if(h=e[i],d.isDateExact(h,a)){c=e[i]=null,j=!0;break}if(d.isDateOverlap(h,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[3]||c.push("inverted")):f.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;g>i;i+=1)if(d.isDateExact(e[i],a)){e[i]=null;break}if(j)for(i=0;g>i;i+=1)if(d.isDateOverlap(e[i],a)){e[i]=null;break}c&&e.push(c)}),e.filter(function(a){return null!=a})},c.prototype.nodes=function(a){var b=this,c=b.settings,g=b.item,h=g.now,i=g.select,j=g.highlight,k=g.view,l=g.disable,m=g.min,n=g.max,o=function(a,b){return c.firstDay&&(a.push(a.shift()),b.push(b.shift())),f.node("thead",f.node("tr",f.group({min:0,max:d-1,i:1,node:"th",item:function(d){return[a[d],c.klass.weekdays,'scope=col title="'+b[d]+'"']}})))}((c.showWeekdaysFull?c.weekdaysFull:c.weekdaysLetter).slice(0),c.weekdaysFull.slice(0)),p=function(a){return f.node("div"," ",c.klass["nav"+(a?"Next":"Prev")]+(a&&k.year>=n.year&&k.month>=n.month||!a&&k.year<=m.year&&k.month<=m.month?" "+c.klass.navDisabled:""),"data-nav="+(a||-1)+" "+f.ariaAttr({role:"button",controls:b.$node[0].id+"_table"})+' title="'+(a?c.labelMonthNext:c.labelMonthPrev)+'"')},q=function(d){var e=c.showMonthsShort?c.monthsShort:c.monthsFull;return"short_months"==d&&(e=c.monthsShort),c.selectMonths&&void 0==d?f.node("select",f.group({min:0,max:11,i:1,node:"option",item:function(a){return[e[a],0,"value="+a+(k.month==a?" selected":"")+(k.year==m.year&&a<m.month||k.year==n.year&&a>n.month?" disabled":"")]}}),c.klass.selectMonth+" browser-default",(a?"":"disabled")+" "+f.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelMonthSelect+'"'):"short_months"==d?null!=i?f.node("div",e[i.month]):f.node("div",e[k.month]):f.node("div",e[k.month],c.klass.month)},r=function(d){var e=k.year,g=c.selectYears===!0?5:~~(c.selectYears/2);if(g){var h=m.year,i=n.year,j=e-g,l=e+g;if(h>j&&(l+=h-j,j=h),l>i){var o=j-h,p=l-i;j-=o>p?p:o,l=i}if(c.selectYears&&void 0==d)return f.node("select",f.group({min:j,max:l,i:1,node:"option",item:function(a){return[a,0,"value="+a+(e==a?" selected":"")]}}),c.klass.selectYear+" browser-default",(a?"":"disabled")+" "+f.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelYearSelect+'"')}return"raw"==d?f.node("div",e):f.node("div",e,c.klass.year)};return createDayLabel=function(){return null!=i?f.node("div",i.date):f.node("div",h.date)},createWeekdayLabel=function(){var a;a=null!=i?i.day:h.day;var b=c.weekdaysFull[a];return b},f.node("div",f.node("div",createWeekdayLabel(),"picker__weekday-display")+f.node("div",q("short_months"),c.klass.month_display)+f.node("div",createDayLabel(),c.klass.day_display)+f.node("div",r("raw"),c.klass.year_display),c.klass.date_display)+f.node("div",f.node("div",(c.selectYears?q()+r():q()+r())+p()+p(1),c.klass.header)+f.node("table",o+f.node("tbody",f.group({min:0,max:e-1,i:1,node:"tr",item:function(a){var e=c.firstDay&&0===b.create([k.year,k.month,1]).day?-7:0;return[f.group({min:d*a-k.day+e+1,max:function(){return this.min+d-1},i:1,node:"td",item:function(a){a=b.create([k.year,k.month,a+(c.firstDay?1:0)]);var d=i&&i.pick==a.pick,e=j&&j.pick==a.pick,g=l&&b.disabled(a)||a.pick<m.pick||a.pick>n.pick,o=f.trigger(b.formats.toString,b,[c.format,a]);return[f.node("div",a.date,function(b){return b.push(k.month==a.month?c.klass.infocus:c.klass.outfocus),h.pick==a.pick&&b.push(c.klass.now),d&&b.push(c.klass.selected),e&&b.push(c.klass.highlighted),g&&b.push(c.klass.disabled),b.join(" ")}([c.klass.day]),"data-pick="+a.pick+" "+f.ariaAttr({role:"gridcell",label:o,selected:d&&b.$node.val()===o?!0:null,activedescendant:e?!0:null,disabled:g?!0:null})),"",f.ariaAttr({role:"presentation"})]}})]}})),c.klass.table,'id="'+b.$node[0].id+'_table" '+f.ariaAttr({role:"grid",controls:b.$node[0].id,readonly:!0})),c.klass.calendar_container)+f.node("div",f.node("button",c.today,"btn-flat picker__today","type=button data-pick="+h.pick+(a&&!b.disabled(h)?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id}))+f.node("button",c.clear,"btn-flat picker__clear","type=button data-clear=1"+(a?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id}))+f.node("button",c.close,"btn-flat picker__close","type=button data-close=true "+(a?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id})),c.klass.footer)},c.defaults=function(a){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysLetter:["S","M","T","W","T","F","S"],today:"Today",clear:"Clear",close:"Close",format:"d mmmm, yyyy",klass:{table:a+"table",header:a+"header",date_display:a+"date-display",day_display:a+"day-display",month_display:a+"month-display",year_display:a+"year-display",calendar_container:a+"calendar-container",navPrev:a+"nav--prev",navNext:a+"nav--next",navDisabled:a+"nav--disabled",month:a+"month",year:a+"year",selectMonth:a+"select--month",selectYear:a+"select--year",weekdays:a+"weekday",day:a+"day",disabled:a+"day--disabled",selected:a+"day--selected",highlighted:a+"day--highlighted",now:a+"day--today",infocus:a+"day--infocus",outfocus:a+"day--outfocus",footer:a+"footer",buttonClear:a+"button--clear",buttonToday:a+"button--today",buttonClose:a+"button--close"}}}(a.klasses().picker+"__"),a.extend("pickadate",c)});
1
+ /*!
2
+ * Materialize v0.100.2 (http://materializecss.com)
3
+ * Copyright 2014-2017 Materialize
4
+ * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
+ */
6
+ function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}();"undefined"==typeof jQuery&&("function"==typeof require?jQuery=$=require("jquery"):jQuery=$),function(t){"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&"object"==typeof module.exports?exports=t(require("jquery")):t(jQuery)}(function(t){function e(t){var e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375}t.easing.jswing=t.easing.swing;var i=Math.pow,n=Math.sqrt,o=Math.sin,a=Math.cos,r=Math.PI,s=1.70158,l=1.525*s,c=2*r/3,u=2*r/4.5;t.extend(t.easing,{def:"easeOutQuad",swing:function(e){return t.easing[t.easing.def](e)},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-i(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-i(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-i(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-i(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-i(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-i(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-i(-2*t+2,5)/2},easeInSine:function(t){return 1-a(t*r/2)},easeOutSine:function(t){return o(t*r/2)},easeInOutSine:function(t){return-(a(r*t)-1)/2},easeInExpo:function(t){return 0===t?0:i(2,10*t-10)},easeOutExpo:function(t){return 1===t?1:1-i(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:t<.5?i(2,20*t-10)/2:(2-i(2,-20*t+10))/2},easeInCirc:function(t){return 1-n(1-i(t,2))},easeOutCirc:function(t){return n(1-i(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-n(1-i(2*t,2)))/2:(n(1-i(-2*t+2,2))+1)/2},easeInElastic:function(t){return 0===t?0:1===t?1:-i(2,10*t-10)*o((10*t-10.75)*c)},easeOutElastic:function(t){return 0===t?0:1===t?1:i(2,-10*t)*o((10*t-.75)*c)+1},easeInOutElastic:function(t){return 0===t?0:1===t?1:t<.5?-i(2,20*t-10)*o((20*t-11.125)*u)/2:i(2,-20*t+10)*o((20*t-11.125)*u)/2+1},easeInBack:function(t){return 2.70158*t*t*t-s*t*t},easeOutBack:function(t){return 1+2.70158*i(t-1,3)+s*i(t-1,2)},easeInOutBack:function(t){return t<.5?i(2*t,2)*(7.189819*t-l)/2:(i(2*t-2,2)*((l+1)*(2*t-2)+l)+2)/2},easeInBounce:function(t){return 1-e(1-t)},easeOutBounce:e,easeInOutBounce:function(t){return t<.5?(1-e(1-2*t))/2:(1+e(2*t-1))/2}})}),jQuery.extend(jQuery.easing,{easeInOutMaterial:function(t,e,i,n,o){return(e/=o/2)<1?n/2*e*e+i:n/4*((e-=2)*e*e+2)+i}}),jQuery.Velocity?console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity."):(function(t){function e(t){var e=t.length,n=i.type(t);return"function"!==n&&!i.isWindow(t)&&(!(1!==t.nodeType||!e)||("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t))}if(!t.jQuery){var i=function(t,e){return new i.fn.init(t,e)};i.isWindow=function(t){return null!=t&&t==t.window},i.type=function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?o[r.call(t)]||"object":typeof t},i.isArray=Array.isArray||function(t){return"array"===i.type(t)},i.isPlainObject=function(t){var e;if(!t||"object"!==i.type(t)||t.nodeType||i.isWindow(t))return!1;try{if(t.constructor&&!a.call(t,"constructor")&&!a.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}for(e in t);return void 0===e||a.call(t,e)},i.each=function(t,i,n){var o=0,a=t.length,r=e(t);if(n){if(r)for(;a>o&&!1!==i.apply(t[o],n);o++);else for(o in t)if(!1===i.apply(t[o],n))break}else if(r)for(;a>o&&!1!==i.call(t[o],o,t[o]);o++);else for(o in t)if(!1===i.call(t[o],o,t[o]))break;return t},i.data=function(t,e,o){if(void 0===o){var a=(r=t[i.expando])&&n[r];if(void 0===e)return a;if(a&&e in a)return a[e]}else if(void 0!==e){var r=t[i.expando]||(t[i.expando]=++i.uuid);return n[r]=n[r]||{},n[r][e]=o,o}},i.removeData=function(t,e){var o=t[i.expando],a=o&&n[o];a&&i.each(e,function(t,e){delete a[e]})},i.extend=function(){var t,e,n,o,a,r,s=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[l]||{},l++),"object"!=typeof s&&"function"!==i.type(s)&&(s={}),l===c&&(s=this,l--);c>l;l++)if(null!=(a=arguments[l]))for(o in a)t=s[o],s!==(n=a[o])&&(u&&n&&(i.isPlainObject(n)||(e=i.isArray(n)))?(e?(e=!1,r=t&&i.isArray(t)?t:[]):r=t&&i.isPlainObject(t)?t:{},s[o]=i.extend(u,r,n)):void 0!==n&&(s[o]=n));return s},i.queue=function(t,n,o){if(t){n=(n||"fx")+"queue";var a=i.data(t,n);return o?(!a||i.isArray(o)?a=i.data(t,n,function(t,i){var n=i||[];return null!=t&&(e(Object(t))?function(t,e){for(var i=+e.length,n=0,o=t.length;i>n;)t[o++]=e[n++];if(i!==i)for(;void 0!==e[n];)t[o++]=e[n++];t.length=o}(n,"string"==typeof t?[t]:t):[].push.call(n,t)),n}(o)):a.push(o),a):a||[]}},i.dequeue=function(t,e){i.each(t.nodeType?[t]:t,function(t,n){e=e||"fx";var o=i.queue(n,e),a=o.shift();"inprogress"===a&&(a=o.shift()),a&&("fx"===e&&o.unshift("inprogress"),a.call(n,function(){i.dequeue(n,e)}))})},i.fn=i.prototype={init:function(t){if(t.nodeType)return this[0]=t,this;throw new Error("Not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:e.top+(t.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:e.left+(t.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function t(){for(var t=this.offsetParent||document;t&&"html"===!t.nodeType.toLowerCase&&"static"===t.style.position;)t=t.offsetParent;return t||document}var e=this[0],t=t.apply(e),n=this.offset(),o=/^(?:body|html)$/i.test(t.nodeName)?{top:0,left:0}:i(t).offset();return n.top-=parseFloat(e.style.marginTop)||0,n.left-=parseFloat(e.style.marginLeft)||0,t.style&&(o.top+=parseFloat(t.style.borderTopWidth)||0,o.left+=parseFloat(t.style.borderLeftWidth)||0),{top:n.top-o.top,left:n.left-o.left}}};var n={};i.expando="velocity"+(new Date).getTime(),i.uuid=0;for(var o={},a=o.hasOwnProperty,r=o.toString,s="Boolean Number String Function Array Date RegExp Object Error".split(" "),l=0;l<s.length;l++)o["[object "+s[l]+"]"]=s[l].toLowerCase();i.fn.init.prototype=i.fn,t.Velocity={Utilities:i}}}(window),function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t():"function"==typeof define&&define.amd?define(t):t()}(function(){return function(t,e,i,n){function o(t){for(var e=-1,i=t?t.length:0,n=[];++e<i;){var o=t[e];o&&n.push(o)}return n}function a(t){return v.isWrapped(t)?t=[].slice.call(t):v.isNode(t)&&(t=[t]),t}function r(t){var e=p.data(t,"velocity");return null===e?n:e}function s(t){return function(e){return Math.round(e*t)*(1/t)}}function l(t,i,n,o){function a(t,e){return 1-3*e+3*t}function r(t,e){return 3*e-6*t}function s(t){return 3*t}function l(t,e,i){return((a(e,i)*t+r(e,i))*t+s(e))*t}function c(t,e,i){return 3*a(e,i)*t*t+2*r(e,i)*t+s(e)}function u(e,i){for(var o=0;v>o;++o){var a=c(i,t,n);if(0===a)return i;i-=(l(i,t,n)-e)/a}return i}function d(){for(var e=0;b>e;++e)C[e]=l(e*w,t,n)}function p(e,i,o){var a,r,s=0;do{(a=l(r=i+(o-i)/2,t,n)-e)>0?o=r:i=r}while(Math.abs(a)>g&&++s<y);return r}function h(e){for(var i=0,o=1,a=b-1;o!=a&&C[o]<=e;++o)i+=w;var r=i+(e-C[--o])/(C[o+1]-C[o])*w,s=c(r,t,n);return s>=m?u(e,r):0==s?r:p(e,i,i+w)}function f(){T=!0,(t!=i||n!=o)&&d()}var v=4,m=.001,g=1e-7,y=10,b=11,w=1/(b-1),k="Float32Array"in e;if(4!==arguments.length)return!1;for(var x=0;4>x;++x)if("number"!=typeof arguments[x]||isNaN(arguments[x])||!isFinite(arguments[x]))return!1;t=Math.min(t,1),n=Math.min(n,1),t=Math.max(t,0),n=Math.max(n,0);var C=k?new Float32Array(b):new Array(b),T=!1,S=function(e){return T||f(),t===i&&n===o?e:0===e?0:1===e?1:l(h(e),i,o)};S.getControlPoints=function(){return[{x:t,y:i},{x:n,y:o}]};var P="generateBezier("+[t,i,n,o]+")";return S.toString=function(){return P},S}function c(t,e){var i=t;return v.isString(t)?b.Easings[t]||(i=!1):i=v.isArray(t)&&1===t.length?s.apply(null,t):v.isArray(t)&&2===t.length?w.apply(null,t.concat([e])):!(!v.isArray(t)||4!==t.length)&&l.apply(null,t),!1===i&&(i=b.Easings[b.defaults.easing]?b.defaults.easing:y),i}function u(t){if(t){var e=(new Date).getTime(),i=b.State.calls.length;i>1e4&&(b.State.calls=o(b.State.calls));for(var a=0;i>a;a++)if(b.State.calls[a]){var s=b.State.calls[a],l=s[0],c=s[2],h=s[3],f=!!h,m=null;h||(h=b.State.calls[a][3]=e-16);for(var g=Math.min((e-h)/c.duration,1),y=0,w=l.length;w>y;y++){var x=l[y],T=x.element;if(r(T)){var S=!1;if(c.display!==n&&null!==c.display&&"none"!==c.display){if("flex"===c.display){var P=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];p.each(P,function(t,e){k.setPropertyValue(T,"display",e)})}k.setPropertyValue(T,"display",c.display)}c.visibility!==n&&"hidden"!==c.visibility&&k.setPropertyValue(T,"visibility",c.visibility);for(var A in x)if("element"!==A){var O,E=x[A],_=v.isString(E.easing)?b.Easings[E.easing]:E.easing;if(1===g)O=E.endValue;else{var M=E.endValue-E.startValue;if(O=E.startValue+M*_(g,c,M),!f&&O===E.currentValue)continue}if(E.currentValue=O,"tween"===A)m=O;else{if(k.Hooks.registered[A]){var I=k.Hooks.getRoot(A),D=r(T).rootPropertyValueCache[I];D&&(E.rootPropertyValue=D)}var q=k.setPropertyValue(T,A,E.currentValue+(0===parseFloat(O)?"":E.unitType),E.rootPropertyValue,E.scrollData);k.Hooks.registered[A]&&(r(T).rootPropertyValueCache[I]=k.Normalizations.registered[I]?k.Normalizations.registered[I]("extract",null,q[1]):q[1]),"transform"===q[0]&&(S=!0)}}c.mobileHA&&r(T).transformCache.translate3d===n&&(r(T).transformCache.translate3d="(0px, 0px, 0px)",S=!0),S&&k.flushTransformCache(T)}}c.display!==n&&"none"!==c.display&&(b.State.calls[a][2].display=!1),c.visibility!==n&&"hidden"!==c.visibility&&(b.State.calls[a][2].visibility=!1),c.progress&&c.progress.call(s[1],s[1],g,Math.max(0,h+c.duration-e),h,m),1===g&&d(a)}}b.State.isTicking&&C(u)}function d(t,e){if(!b.State.calls[t])return!1;for(var i=b.State.calls[t][0],o=b.State.calls[t][1],a=b.State.calls[t][2],s=b.State.calls[t][4],l=!1,c=0,u=i.length;u>c;c++){var d=i[c].element;if(e||a.loop||("none"===a.display&&k.setPropertyValue(d,"display",a.display),"hidden"===a.visibility&&k.setPropertyValue(d,"visibility",a.visibility)),!0!==a.loop&&(p.queue(d)[1]===n||!/\.velocityQueueEntryFlag/i.test(p.queue(d)[1]))&&r(d)){r(d).isAnimating=!1,r(d).rootPropertyValueCache={};var h=!1;p.each(k.Lists.transforms3D,function(t,e){var i=/^scale/.test(e)?1:0,o=r(d).transformCache[e];r(d).transformCache[e]!==n&&new RegExp("^\\("+i+"[^.]").test(o)&&(h=!0,delete r(d).transformCache[e])}),a.mobileHA&&(h=!0,delete r(d).transformCache.translate3d),h&&k.flushTransformCache(d),k.Values.removeClass(d,"velocity-animating")}if(!e&&a.complete&&!a.loop&&c===u-1)try{a.complete.call(o,o)}catch(t){setTimeout(function(){throw t},1)}s&&!0!==a.loop&&s(o),r(d)&&!0===a.loop&&!e&&(p.each(r(d).tweensContainer,function(t,e){/^rotate/.test(t)&&360===parseFloat(e.endValue)&&(e.endValue=0,e.startValue=360),/^backgroundPosition/.test(t)&&100===parseFloat(e.endValue)&&"%"===e.unitType&&(e.endValue=0,e.startValue=100)}),b(d,"reverse",{loop:!0,delay:a.delay})),!1!==a.queue&&p.dequeue(d,a.queue)}b.State.calls[t]=!1;for(var f=0,v=b.State.calls.length;v>f;f++)if(!1!==b.State.calls[f]){l=!0;break}!1===l&&(b.State.isTicking=!1,delete b.State.calls,b.State.calls=[])}var p,h=function(){if(i.documentMode)return i.documentMode;for(var t=7;t>4;t--){var e=i.createElement("div");if(e.innerHTML="\x3c!--[if IE "+t+"]><span></span><![endif]--\x3e",e.getElementsByTagName("span").length)return e=null,t}return n}(),f=function(){var t=0;return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(e){var i,n=(new Date).getTime();return i=Math.max(0,16-(n-t)),t=n+i,setTimeout(function(){e(n+i)},i)}}(),v={isString:function(t){return"string"==typeof t},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)},isNode:function(t){return t&&t.nodeType},isNodeList:function(t){return"object"==typeof t&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&t.length!==n&&(0===t.length||"object"==typeof t[0]&&t[0].nodeType>0)},isWrapped:function(t){return t&&(t.jquery||e.Zepto&&e.Zepto.zepto.isZ(t))},isSVG:function(t){return e.SVGElement&&t instanceof e.SVGElement},isEmptyObject:function(t){for(var e in t)return!1;return!0}},m=!1;if(t.fn&&t.fn.jquery?(p=t,m=!0):p=e.Velocity.Utilities,8>=h&&!m)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");{if(!(7>=h)){var g=400,y="swing",b={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:e.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:p,Redirects:{},Easings:{},Promise:e.Promise,defaults:{queue:"",duration:g,easing:y,begin:n,complete:n,progress:n,display:n,visibility:n,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(t){p.data(t,"velocity",{isSVG:v.isSVG(t),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};e.pageYOffset!==n?(b.State.scrollAnchor=e,b.State.scrollPropertyLeft="pageXOffset",b.State.scrollPropertyTop="pageYOffset"):(b.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,b.State.scrollPropertyLeft="scrollLeft",b.State.scrollPropertyTop="scrollTop");var w=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,i,n){var o={x:e.x+n.dx*i,v:e.v+n.dv*i,tension:e.tension,friction:e.friction};return{dx:o.v,dv:t(o)}}function i(i,n){var o={dx:i.v,dv:t(i)},a=e(i,.5*n,o),r=e(i,.5*n,a),s=e(i,n,r),l=1/6*(o.dx+2*(a.dx+r.dx)+s.dx),c=1/6*(o.dv+2*(a.dv+r.dv)+s.dv);return i.x=i.x+l*n,i.v=i.v+c*n,i}return function t(e,n,o){var a,r,s,l={x:-1,v:0,tension:null,friction:null},c=[0],u=0;for(e=parseFloat(e)||500,n=parseFloat(n)||20,o=o||null,l.tension=e,l.friction=n,(a=null!==o)?(u=t(e,n),r=u/o*.016):r=.016;s=i(s||l,r),c.push(1+s.x),u+=16,Math.abs(s.x)>1e-4&&Math.abs(s.v)>1e-4;);return a?function(t){return c[t*(c.length-1)|0]}:u}}();b.Easings={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},spring:function(t){return 1-Math.cos(4.5*t*Math.PI)*Math.exp(6*-t)}},p.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(t,e){b.Easings[e[0]]=l.apply(null,e[1])});var k=b.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(a=0;a<k.Lists.colors.length;a++){var t="color"===k.Lists.colors[a]?"0 0 0 1":"255 255 255 1";k.Hooks.templates[k.Lists.colors[a]]=["Red Green Blue Alpha",t]}var e,i,n;if(h)for(e in k.Hooks.templates){n=(i=k.Hooks.templates[e])[0].split(" ");var o=i[1].match(k.RegEx.valueSplit);"Color"===n[0]&&(n.push(n.shift()),o.push(o.shift()),k.Hooks.templates[e]=[n.join(" "),o.join(" ")])}for(e in k.Hooks.templates){n=(i=k.Hooks.templates[e])[0].split(" ");for(var a in n){var r=e+n[a],s=a;k.Hooks.registered[r]=[e,s]}}},getRoot:function(t){var e=k.Hooks.registered[t];return e?e[0]:t},cleanRootPropertyValue:function(t,e){return k.RegEx.valueUnwrap.test(e)&&(e=e.match(k.RegEx.valueUnwrap)[1]),k.Values.isCSSNullValue(e)&&(e=k.Hooks.templates[t][1]),e},extractValue:function(t,e){var i=k.Hooks.registered[t];if(i){var n=i[0],o=i[1];return(e=k.Hooks.cleanRootPropertyValue(n,e)).toString().match(k.RegEx.valueSplit)[o]}return e},injectValue:function(t,e,i){var n=k.Hooks.registered[t];if(n){var o,a=n[0],r=n[1];return i=k.Hooks.cleanRootPropertyValue(a,i),o=i.toString().match(k.RegEx.valueSplit),o[r]=e,o.join(" ")}return i}},Normalizations:{registered:{clip:function(t,e,i){switch(t){case"name":return"clip";case"extract":var n;return k.RegEx.wrappedValueAlreadyExtracted.test(i)?n=i:(n=i.toString().match(k.RegEx.valueUnwrap),n=n?n[1].replace(/,(\s+)?/g," "):i),n;case"inject":return"rect("+i+")"}},blur:function(t,e,i){switch(t){case"name":return b.State.isFirefox?"filter":"-webkit-filter";case"extract":var n=parseFloat(i);if(!n&&0!==n){var o=i.toString().match(/blur\(([0-9]+[A-z]+)\)/i);n=o?o[1]:0}return n;case"inject":return parseFloat(i)?"blur("+i+")":"none"}},opacity:function(t,e,i){if(8>=h)switch(t){case"name":return"filter";case"extract":var n=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=n?n[1]/100:1;case"inject":return e.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(t){case"name":return"opacity";case"extract":case"inject":return i}}},register:function(){9>=h||b.State.isGingerbread||(k.Lists.transformsBase=k.Lists.transformsBase.concat(k.Lists.transforms3D));for(t=0;t<k.Lists.transformsBase.length;t++)!function(){var e=k.Lists.transformsBase[t];k.Normalizations.registered[e]=function(t,i,o){switch(t){case"name":return"transform";case"extract":return r(i)===n||r(i).transformCache[e]===n?/^scale/i.test(e)?1:0:r(i).transformCache[e].replace(/[()]/g,"");case"inject":var a=!1;switch(e.substr(0,e.length-1)){case"translate":a=!/(%|px|em|rem|vw|vh|\d)$/i.test(o);break;case"scal":case"scale":b.State.isAndroid&&r(i).transformCache[e]===n&&1>o&&(o=1),a=!/(\d)$/i.test(o);break;case"skew":a=!/(deg|\d)$/i.test(o);break;case"rotate":a=!/(deg|\d)$/i.test(o)}return a||(r(i).transformCache[e]="("+o+")"),r(i).transformCache[e]}}}();for(var t=0;t<k.Lists.colors.length;t++)!function(){var e=k.Lists.colors[t];k.Normalizations.registered[e]=function(t,i,o){switch(t){case"name":return e;case"extract":var a;if(k.RegEx.wrappedValueAlreadyExtracted.test(o))a=o;else{var r,s={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(o)?r=s[o]!==n?s[o]:s.black:k.RegEx.isHex.test(o)?r="rgb("+k.Values.hexToRgb(o).join(" ")+")":/^rgba?\(/i.test(o)||(r=s.black),a=(r||o).toString().match(k.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return 8>=h||3!==a.split(" ").length||(a+=" 1"),a;case"inject":return 8>=h?4===o.split(" ").length&&(o=o.split(/\s+/).slice(0,3).join(" ")):3===o.split(" ").length&&(o+=" 1"),(8>=h?"rgb":"rgba")+"("+o.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},SVGAttribute:function(t){var e="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(h||b.State.isAndroid&&!b.State.isChrome)&&(e+="|transform"),new RegExp("^("+e+")$","i").test(t)},prefixCheck:function(t){if(b.State.prefixMatches[t])return[b.State.prefixMatches[t],!0];for(var e=["","Webkit","Moz","ms","O"],i=0,n=e.length;n>i;i++){var o;if(o=0===i?t:e[i]+t.replace(/^\w/,function(t){return t.toUpperCase()}),v.isString(b.State.prefixElement.style[o]))return b.State.prefixMatches[t]=o,[o,!0]}return[t,!1]}},Values:{hexToRgb:function(t){var e,i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return t=t.replace(i,function(t,e,i,n){return e+e+i+i+n+n}),e=n.exec(t),e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]},isCSSNullValue:function(t){return 0==t||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(t)},getUnitType:function(t){return/^(rotate|skew)/i.test(t)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(t)?"":"px"},getDisplayType:function(t){var e=t&&t.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(e)?"inline":/^(li)$/i.test(e)?"list-item":/^(tr)$/i.test(e)?"table-row":/^(table)$/i.test(e)?"table":/^(tbody)$/i.test(e)?"table-row-group":"block"},addClass:function(t,e){t.classList?t.classList.add(e):t.className+=(t.className.length?" ":"")+e},removeClass:function(t,e){t.classList?t.classList.remove(e):t.className=t.className.toString().replace(new RegExp("(^|\\s)"+e.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(t,i,o,a){function s(t,i){function o(){c&&k.setPropertyValue(t,"display","none")}var l=0;if(8>=h)l=p.css(t,i);else{var c=!1;if(/^(width|height)$/.test(i)&&0===k.getPropertyValue(t,"display")&&(c=!0,k.setPropertyValue(t,"display",k.Values.getDisplayType(t))),!a){if("height"===i&&"border-box"!==k.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var u=t.offsetHeight-(parseFloat(k.getPropertyValue(t,"borderTopWidth"))||0)-(parseFloat(k.getPropertyValue(t,"borderBottomWidth"))||0)-(parseFloat(k.getPropertyValue(t,"paddingTop"))||0)-(parseFloat(k.getPropertyValue(t,"paddingBottom"))||0);return o(),u}if("width"===i&&"border-box"!==k.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var d=t.offsetWidth-(parseFloat(k.getPropertyValue(t,"borderLeftWidth"))||0)-(parseFloat(k.getPropertyValue(t,"borderRightWidth"))||0)-(parseFloat(k.getPropertyValue(t,"paddingLeft"))||0)-(parseFloat(k.getPropertyValue(t,"paddingRight"))||0);return o(),d}}var f;f=r(t)===n?e.getComputedStyle(t,null):r(t).computedStyle?r(t).computedStyle:r(t).computedStyle=e.getComputedStyle(t,null),"borderColor"===i&&(i="borderTopColor"),(""===(l=9===h&&"filter"===i?f.getPropertyValue(i):f[i])||null===l)&&(l=t.style[i]),o()}if("auto"===l&&/^(top|right|bottom|left)$/i.test(i)){var v=s(t,"position");("fixed"===v||"absolute"===v&&/top|left/i.test(i))&&(l=p(t).position()[i]+"px")}return l}var l;if(k.Hooks.registered[i]){var c=i,u=k.Hooks.getRoot(c);o===n&&(o=k.getPropertyValue(t,k.Names.prefixCheck(u)[0])),k.Normalizations.registered[u]&&(o=k.Normalizations.registered[u]("extract",t,o)),l=k.Hooks.extractValue(c,o)}else if(k.Normalizations.registered[i]){var d,f;"transform"!==(d=k.Normalizations.registered[i]("name",t))&&(f=s(t,k.Names.prefixCheck(d)[0]),k.Values.isCSSNullValue(f)&&k.Hooks.templates[i]&&(f=k.Hooks.templates[i][1])),l=k.Normalizations.registered[i]("extract",t,f)}if(!/^[\d-]/.test(l))if(r(t)&&r(t).isSVG&&k.Names.SVGAttribute(i))if(/^(height|width)$/i.test(i))try{l=t.getBBox()[i]}catch(t){l=0}else l=t.getAttribute(i);else l=s(t,k.Names.prefixCheck(i)[0]);return k.Values.isCSSNullValue(l)&&(l=0),b.debug>=2&&console.log("Get "+i+": "+l),l},setPropertyValue:function(t,i,n,o,a){var s=i;if("scroll"===i)a.container?a.container["scroll"+a.direction]=n:"Left"===a.direction?e.scrollTo(n,a.alternateValue):e.scrollTo(a.alternateValue,n);else if(k.Normalizations.registered[i]&&"transform"===k.Normalizations.registered[i]("name",t))k.Normalizations.registered[i]("inject",t,n),s="transform",n=r(t).transformCache[i];else{if(k.Hooks.registered[i]){var l=i,c=k.Hooks.getRoot(i);o=o||k.getPropertyValue(t,c),n=k.Hooks.injectValue(l,n,o),i=c}if(k.Normalizations.registered[i]&&(n=k.Normalizations.registered[i]("inject",t,n),i=k.Normalizations.registered[i]("name",t)),s=k.Names.prefixCheck(i)[0],8>=h)try{t.style[s]=n}catch(t){b.debug&&console.log("Browser does not support ["+n+"] for ["+s+"]")}else r(t)&&r(t).isSVG&&k.Names.SVGAttribute(i)?t.setAttribute(i,n):t.style[s]=n;b.debug>=2&&console.log("Set "+i+" ("+s+"): "+n)}return[s,n]},flushTransformCache:function(t){function e(e){return parseFloat(k.getPropertyValue(t,e))}var i="";if((h||b.State.isAndroid&&!b.State.isChrome)&&r(t).isSVG){var n={translate:[e("translateX"),e("translateY")],skewX:[e("skewX")],skewY:[e("skewY")],scale:1!==e("scale")?[e("scale"),e("scale")]:[e("scaleX"),e("scaleY")],rotate:[e("rotateZ"),0,0]};p.each(r(t).transformCache,function(t){/^translate/i.test(t)?t="translate":/^scale/i.test(t)?t="scale":/^rotate/i.test(t)&&(t="rotate"),n[t]&&(i+=t+"("+n[t].join(" ")+") ",delete n[t])})}else{var o,a;p.each(r(t).transformCache,function(e){return o=r(t).transformCache[e],"transformPerspective"===e?(a=o,!0):(9===h&&"rotateZ"===e&&(e="rotate"),void(i+=e+o+" "))}),a&&(i="perspective"+a+" "+i)}k.setPropertyValue(t,"transform",i)}};k.Hooks.register(),k.Normalizations.register(),b.hook=function(t,e,i){var o=n;return t=a(t),p.each(t,function(t,a){if(r(a)===n&&b.init(a),i===n)o===n&&(o=b.CSS.getPropertyValue(a,e));else{var s=b.CSS.setPropertyValue(a,e,i);"transform"===s[0]&&b.CSS.flushTransformCache(a),o=s}}),o};var x=function(){function t(){return s?P.promise||null:l}function o(){function t(t){function d(t,e){var i=n,o=n,r=n;return v.isArray(t)?(i=t[0],!v.isArray(t[1])&&/^[\d-]/.test(t[1])||v.isFunction(t[1])||k.RegEx.isHex.test(t[1])?r=t[1]:(v.isString(t[1])&&!k.RegEx.isHex.test(t[1])||v.isArray(t[1]))&&(o=e?t[1]:c(t[1],s.duration),t[2]!==n&&(r=t[2]))):i=t,e||(o=o||s.easing),v.isFunction(i)&&(i=i.call(a,T,C)),v.isFunction(r)&&(r=r.call(a,T,C)),[i||0,o,r]}function h(t,e){var i,n;return n=(e||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(t){return i=t,""}),i||(i=k.Values.getUnitType(t)),[n,i]}if(s.begin&&0===T)try{s.begin.call(f,f)}catch(t){setTimeout(function(){throw t},1)}if("scroll"===A){var g,w,x,S=/^x$/i.test(s.axis)?"Left":"Top",O=parseFloat(s.offset)||0;s.container?v.isWrapped(s.container)||v.isNode(s.container)?(s.container=s.container[0]||s.container,g=s.container["scroll"+S],x=g+p(a).position()[S.toLowerCase()]+O):s.container=null:(g=b.State.scrollAnchor[b.State["scrollProperty"+S]],w=b.State.scrollAnchor[b.State["scrollProperty"+("Left"===S?"Top":"Left")]],x=p(a).offset()[S.toLowerCase()]+O),l={scroll:{rootPropertyValue:!1,startValue:g,currentValue:g,endValue:x,unitType:"",easing:s.easing,scrollData:{container:s.container,direction:S,alternateValue:w}},element:a},b.debug&&console.log("tweensContainer (scroll): ",l.scroll,a)}else if("reverse"===A){if(!r(a).tweensContainer)return void p.dequeue(a,s.queue);"none"===r(a).opts.display&&(r(a).opts.display="auto"),"hidden"===r(a).opts.visibility&&(r(a).opts.visibility="visible"),r(a).opts.loop=!1,r(a).opts.begin=null,r(a).opts.complete=null,y.easing||delete s.easing,y.duration||delete s.duration,s=p.extend({},r(a).opts,s);M=p.extend(!0,{},r(a).tweensContainer);for(var E in M)if("element"!==E){var _=M[E].startValue;M[E].startValue=M[E].currentValue=M[E].endValue,M[E].endValue=_,v.isEmptyObject(y)||(M[E].easing=s.easing),b.debug&&console.log("reverse tweensContainer ("+E+"): "+JSON.stringify(M[E]),a)}l=M}else if("start"===A){var M;r(a).tweensContainer&&!0===r(a).isAnimating&&(M=r(a).tweensContainer),p.each(m,function(t,e){if(RegExp("^"+k.Lists.colors.join("$|^")+"$").test(t)){var i=d(e,!0),o=i[0],a=i[1],r=i[2];if(k.RegEx.isHex.test(o)){for(var s=["Red","Green","Blue"],l=k.Values.hexToRgb(o),c=r?k.Values.hexToRgb(r):n,u=0;u<s.length;u++){var p=[l[u]];a&&p.push(a),c!==n&&p.push(c[u]),m[t+s[u]]=p}delete m[t]}}});for(var q in m){var z=d(m[q]),V=z[0],H=z[1],L=z[2];q=k.Names.camelCase(q);var j=k.Hooks.getRoot(q),$=!1;if(r(a).isSVG||"tween"===j||!1!==k.Names.prefixCheck(j)[1]||k.Normalizations.registered[j]!==n){(s.display!==n&&null!==s.display&&"none"!==s.display||s.visibility!==n&&"hidden"!==s.visibility)&&/opacity|filter/.test(q)&&!L&&0!==V&&(L=0),s._cacheValues&&M&&M[q]?(L===n&&(L=M[q].endValue+M[q].unitType),$=r(a).rootPropertyValueCache[j]):k.Hooks.registered[q]?L===n?($=k.getPropertyValue(a,j),L=k.getPropertyValue(a,q,$)):$=k.Hooks.templates[j][1]:L===n&&(L=k.getPropertyValue(a,q));var N,W,F,Q=!1;if(N=h(q,L),L=N[0],F=N[1],N=h(q,V),V=N[0].replace(/^([+-\/*])=/,function(t,e){return Q=e,""}),W=N[1],L=parseFloat(L)||0,V=parseFloat(V)||0,"%"===W&&(/^(fontSize|lineHeight)$/.test(q)?(V/=100,W="em"):/^scale/.test(q)?(V/=100,W=""):/(Red|Green|Blue)$/i.test(q)&&(V=V/100*255,W="")),/[\/*]/.test(Q))W=F;else if(F!==W&&0!==L)if(0===V)W=F;else{o=o||function(){var t={myParent:a.parentNode||i.body,position:k.getPropertyValue(a,"position"),fontSize:k.getPropertyValue(a,"fontSize")},n=t.position===I.lastPosition&&t.myParent===I.lastParent,o=t.fontSize===I.lastFontSize;I.lastParent=t.myParent,I.lastPosition=t.position,I.lastFontSize=t.fontSize;var s=100,l={};if(o&&n)l.emToPx=I.lastEmToPx,l.percentToPxWidth=I.lastPercentToPxWidth,l.percentToPxHeight=I.lastPercentToPxHeight;else{var c=r(a).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");b.init(c),t.myParent.appendChild(c),p.each(["overflow","overflowX","overflowY"],function(t,e){b.CSS.setPropertyValue(c,e,"hidden")}),b.CSS.setPropertyValue(c,"position",t.position),b.CSS.setPropertyValue(c,"fontSize",t.fontSize),b.CSS.setPropertyValue(c,"boxSizing","content-box"),p.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(t,e){b.CSS.setPropertyValue(c,e,s+"%")}),b.CSS.setPropertyValue(c,"paddingLeft",s+"em"),l.percentToPxWidth=I.lastPercentToPxWidth=(parseFloat(k.getPropertyValue(c,"width",null,!0))||1)/s,l.percentToPxHeight=I.lastPercentToPxHeight=(parseFloat(k.getPropertyValue(c,"height",null,!0))||1)/s,l.emToPx=I.lastEmToPx=(parseFloat(k.getPropertyValue(c,"paddingLeft"))||1)/s,t.myParent.removeChild(c)}return null===I.remToPx&&(I.remToPx=parseFloat(k.getPropertyValue(i.body,"fontSize"))||16),null===I.vwToPx&&(I.vwToPx=parseFloat(e.innerWidth)/100,I.vhToPx=parseFloat(e.innerHeight)/100),l.remToPx=I.remToPx,l.vwToPx=I.vwToPx,l.vhToPx=I.vhToPx,b.debug>=1&&console.log("Unit ratios: "+JSON.stringify(l),a),l}();var X=/margin|padding|left|right|width|text|word|letter/i.test(q)||/X$/.test(q)||"x"===q?"x":"y";switch(F){case"%":L*="x"===X?o.percentToPxWidth:o.percentToPxHeight;break;case"px":break;default:L*=o[F+"ToPx"]}switch(W){case"%":L*=1/("x"===X?o.percentToPxWidth:o.percentToPxHeight);break;case"px":break;default:L*=1/o[W+"ToPx"]}}switch(Q){case"+":V=L+V;break;case"-":V=L-V;break;case"*":V*=L;break;case"/":V=L/V}l[q]={rootPropertyValue:$,startValue:L,currentValue:L,endValue:V,unitType:W,easing:H},b.debug&&console.log("tweensContainer ("+q+"): "+JSON.stringify(l[q]),a)}else b.debug&&console.log("Skipping ["+j+"] due to a lack of browser support.")}l.element=a}l.element&&(k.Values.addClass(a,"velocity-animating"),D.push(l),""===s.queue&&(r(a).tweensContainer=l,r(a).opts=s),r(a).isAnimating=!0,T===C-1?(b.State.calls.push([D,f,s,null,P.resolver]),!1===b.State.isTicking&&(b.State.isTicking=!0,u())):T++)}var o,a=this,s=p.extend({},b.defaults,y),l={};switch(r(a)===n&&b.init(a),parseFloat(s.delay)&&!1!==s.queue&&p.queue(a,s.queue,function(t){b.velocityQueueEntryFlag=!0,r(a).delayTimer={setTimeout:setTimeout(t,parseFloat(s.delay)),next:t}}),s.duration.toString().toLowerCase()){case"fast":s.duration=200;break;case"normal":s.duration=g;break;case"slow":s.duration=600;break;default:s.duration=parseFloat(s.duration)||1}!1!==b.mock&&(!0===b.mock?s.duration=s.delay=1:(s.duration*=parseFloat(b.mock)||1,s.delay*=parseFloat(b.mock)||1)),s.easing=c(s.easing,s.duration),s.begin&&!v.isFunction(s.begin)&&(s.begin=null),s.progress&&!v.isFunction(s.progress)&&(s.progress=null),s.complete&&!v.isFunction(s.complete)&&(s.complete=null),s.display!==n&&null!==s.display&&(s.display=s.display.toString().toLowerCase(),"auto"===s.display&&(s.display=b.CSS.Values.getDisplayType(a))),s.visibility!==n&&null!==s.visibility&&(s.visibility=s.visibility.toString().toLowerCase()),s.mobileHA=s.mobileHA&&b.State.isMobile&&!b.State.isGingerbread,!1===s.queue?s.delay?setTimeout(t,s.delay):t():p.queue(a,s.queue,function(e,i){return!0===i?(P.promise&&P.resolver(f),!0):(b.velocityQueueEntryFlag=!0,void t(e))}),""!==s.queue&&"fx"!==s.queue||"inprogress"===p.queue(a)[0]||p.dequeue(a)}var s,l,h,f,m,y,w=arguments[0]&&(arguments[0].p||p.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||v.isString(arguments[0].properties));if(v.isWrapped(this)?(s=!1,h=0,f=this,l=this):(s=!0,h=1,f=w?arguments[0].elements||arguments[0].e:arguments[0]),f=a(f)){w?(m=arguments[0].properties||arguments[0].p,y=arguments[0].options||arguments[0].o):(m=arguments[h],y=arguments[h+1]);var C=f.length,T=0;if(!/^(stop|finish)$/i.test(m)&&!p.isPlainObject(y)){y={};for(var S=h+1;S<arguments.length;S++)v.isArray(arguments[S])||!/^(fast|normal|slow)$/i.test(arguments[S])&&!/^\d/.test(arguments[S])?v.isString(arguments[S])||v.isArray(arguments[S])?y.easing=arguments[S]:v.isFunction(arguments[S])&&(y.complete=arguments[S]):y.duration=arguments[S]}var P={promise:null,resolver:null,rejecter:null};s&&b.Promise&&(P.promise=new b.Promise(function(t,e){P.resolver=t,P.rejecter=e}));var A;switch(m){case"scroll":A="scroll";break;case"reverse":A="reverse";break;case"finish":case"stop":p.each(f,function(t,e){r(e)&&r(e).delayTimer&&(clearTimeout(r(e).delayTimer.setTimeout),r(e).delayTimer.next&&r(e).delayTimer.next(),delete r(e).delayTimer)});var O=[];return p.each(b.State.calls,function(t,e){e&&p.each(e[1],function(i,o){var a=y===n?"":y;return!0!==a&&e[2].queue!==a&&(y!==n||!1!==e[2].queue)||void p.each(f,function(i,n){n===o&&((!0===y||v.isString(y))&&(p.each(p.queue(n,v.isString(y)?y:""),function(t,e){v.isFunction(e)&&e(null,!0)}),p.queue(n,v.isString(y)?y:"",[])),"stop"===m?(r(n)&&r(n).tweensContainer&&!1!==a&&p.each(r(n).tweensContainer,function(t,e){e.endValue=e.currentValue}),O.push(t)):"finish"===m&&(e[2].duration=1))})})}),"stop"===m&&(p.each(O,function(t,e){d(e,!0)}),P.promise&&P.resolver(f)),t();default:if(!p.isPlainObject(m)||v.isEmptyObject(m)){if(v.isString(m)&&b.Redirects[m]){var E=(z=p.extend({},y)).duration,_=z.delay||0;return!0===z.backwards&&(f=p.extend(!0,[],f).reverse()),p.each(f,function(t,e){parseFloat(z.stagger)?z.delay=_+parseFloat(z.stagger)*t:v.isFunction(z.stagger)&&(z.delay=_+z.stagger.call(e,t,C)),z.drag&&(z.duration=parseFloat(E)||(/^(callout|transition)/.test(m)?1e3:g),z.duration=Math.max(z.duration*(z.backwards?1-t/C:(t+1)/C),.75*z.duration,200)),b.Redirects[m].call(e,e,z||{},t,C,f,P.promise?P:n)}),t()}var M="Velocity: First argument ("+m+") was not a property map, a known action, or a registered redirect. Aborting.";return P.promise?P.rejecter(new Error(M)):console.log(M),t()}A="start"}var I={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},D=[];p.each(f,function(t,e){v.isNode(e)&&o.call(e)});var q,z=p.extend({},b.defaults,y);if(z.loop=parseInt(z.loop),q=2*z.loop-1,z.loop)for(var V=0;q>V;V++){var H={delay:z.delay,progress:z.progress};V===q-1&&(H.display=z.display,H.visibility=z.visibility,H.complete=z.complete),x(f,"reverse",H)}return t()}};(b=p.extend(x,b)).animate=x;var C=e.requestAnimationFrame||f;return b.State.isMobile||i.hidden===n||i.addEventListener("visibilitychange",function(){i.hidden?(C=function(t){return setTimeout(function(){t(!0)},16)},u()):C=e.requestAnimationFrame||f}),t.Velocity=b,t!==e&&(t.fn.velocity=x,t.fn.velocity.defaults=b.defaults),p.each(["Down","Up"],function(t,e){b.Redirects["slide"+e]=function(t,i,o,a,r,s){var l=p.extend({},i),c=l.begin,u=l.complete,d={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},h={};l.display===n&&(l.display="Down"===e?"inline"===b.CSS.Values.getDisplayType(t)?"inline-block":"block":"none"),l.begin=function(){c&&c.call(r,r);for(var i in d){h[i]=t.style[i];var n=b.CSS.getPropertyValue(t,i);d[i]="Down"===e?[n,0]:[0,n]}h.overflow=t.style.overflow,t.style.overflow="hidden"},l.complete=function(){for(var e in h)t.style[e]=h[e];u&&u.call(r,r),s&&s.resolver(r)},b(t,d,l)}}),p.each(["In","Out"],function(t,e){b.Redirects["fade"+e]=function(t,i,o,a,r,s){var l=p.extend({},i),c={opacity:"In"===e?1:0},u=l.complete;l.complete=o!==a-1?l.begin=null:function(){u&&u.call(r,r),s&&s.resolver(r)},l.display===n&&(l.display="In"===e?"auto":"none"),b(this,c,l)}}),b}jQuery.fn.velocity=jQuery.fn.animate}}(window.jQuery||window.Zepto||window,window,document)})),function(t,e,i,n){"use strict";function o(t,e,i){return setTimeout(u(t,i),e)}function a(t,e,i){return!!Array.isArray(t)&&(r(t,i[e],i),!0)}function r(t,e,i){var o;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==n)for(o=0;o<t.length;)e.call(i,t[o],o,t),o++;else for(o in t)t.hasOwnProperty(o)&&e.call(i,t[o],o,t)}function s(t,e,i){for(var o=Object.keys(e),a=0;a<o.length;)(!i||i&&t[o[a]]===n)&&(t[o[a]]=e[o[a]]),a++;return t}function l(t,e){return s(t,e,!0)}function c(t,e,i){var n,o=e.prototype;(n=t.prototype=Object.create(o)).constructor=t,n._super=o,i&&s(n,i)}function u(t,e){return function(){return t.apply(e,arguments)}}function d(t,e){return typeof t==ut?t.apply(e?e[0]||n:n,e):t}function p(t,e){return t===n?e:t}function h(t,e,i){r(g(e),function(e){t.addEventListener(e,i,!1)})}function f(t,e,i){r(g(e),function(e){t.removeEventListener(e,i,!1)})}function v(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function m(t,e){return t.indexOf(e)>-1}function g(t){return t.trim().split(/\s+/g)}function y(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;n<t.length;){if(i&&t[n][i]==e||!i&&t[n]===e)return n;n++}return-1}function b(t){return Array.prototype.slice.call(t,0)}function w(t,e,i){for(var n=[],o=[],a=0;a<t.length;){var r=e?t[a][e]:t[a];y(o,r)<0&&n.push(t[a]),o[a]=r,a++}return i&&(n=e?n.sort(function(t,i){return t[e]>i[e]}):n.sort()),n}function k(t,e){for(var i,o,a=e[0].toUpperCase()+e.slice(1),r=0;r<lt.length;){if(i=lt[r],(o=i?i+a:e)in t)return o;r++}return n}function x(){return ft++}function C(t){var e=t.ownerDocument;return e.defaultView||e.parentWindow}function T(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){d(t.options.enable,[t])&&i.handler(e)},this.init()}function S(t){var e=t.options.inputClass;return new(e||(gt?j:yt?W:mt?Q:L))(t,P)}function P(t,e,i){var n=i.pointers.length,o=i.changedPointers.length,a=e&xt&&0==n-o,r=e&(Tt|St)&&0==n-o;i.isFirst=!!a,i.isFinal=!!r,a&&(t.session={}),i.eventType=e,A(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function A(t,e){var i=t.session,n=e.pointers,o=n.length;i.firstInput||(i.firstInput=_(e)),o>1&&!i.firstMultiple?i.firstMultiple=_(e):1===o&&(i.firstMultiple=!1);var a=i.firstInput,r=i.firstMultiple,s=r?r.center:a.center,l=e.center=M(n);e.timeStamp=ht(),e.deltaTime=e.timeStamp-a.timeStamp,e.angle=z(s,l),e.distance=q(s,l),O(i,e),e.offsetDirection=D(e.deltaX,e.deltaY),e.scale=r?H(r.pointers,n):1,e.rotation=r?V(r.pointers,n):0,E(i,e);var c=t.element;v(e.srcEvent.target,c)&&(c=e.srcEvent.target),e.target=c}function O(t,e){var i=e.center,n=t.offsetDelta||{},o=t.prevDelta||{},a=t.prevInput||{};(e.eventType===xt||a.eventType===Tt)&&(o=t.prevDelta={x:a.deltaX||0,y:a.deltaY||0},n=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=o.x+(i.x-n.x),e.deltaY=o.y+(i.y-n.y)}function E(t,e){var i,o,a,r,s=t.lastInterval||e,l=e.timeStamp-s.timeStamp;if(e.eventType!=St&&(l>kt||s.velocity===n)){var c=s.deltaX-e.deltaX,u=s.deltaY-e.deltaY,d=I(l,c,u);o=d.x,a=d.y,i=pt(d.x)>pt(d.y)?d.x:d.y,r=D(c,u),t.lastInterval=e}else i=s.velocity,o=s.velocityX,a=s.velocityY,r=s.direction;e.velocity=i,e.velocityX=o,e.velocityY=a,e.direction=r}function _(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:dt(t.pointers[i].clientX),clientY:dt(t.pointers[i].clientY)},i++;return{timeStamp:ht(),pointers:e,center:M(e),deltaX:t.deltaX,deltaY:t.deltaY}}function M(t){var e=t.length;if(1===e)return{x:dt(t[0].clientX),y:dt(t[0].clientY)};for(var i=0,n=0,o=0;e>o;)i+=t[o].clientX,n+=t[o].clientY,o++;return{x:dt(i/e),y:dt(n/e)}}function I(t,e,i){return{x:e/t||0,y:i/t||0}}function D(t,e){return t===e?Pt:pt(t)>=pt(e)?t>0?At:Ot:e>0?Et:_t}function q(t,e,i){i||(i=qt);var n=e[i[0]]-t[i[0]],o=e[i[1]]-t[i[1]];return Math.sqrt(n*n+o*o)}function z(t,e,i){i||(i=qt);var n=e[i[0]]-t[i[0]],o=e[i[1]]-t[i[1]];return 180*Math.atan2(o,n)/Math.PI}function V(t,e){return z(e[1],e[0],zt)-z(t[1],t[0],zt)}function H(t,e){return q(e[0],e[1],zt)/q(t[0],t[1],zt)}function L(){this.evEl=Ht,this.evWin=Lt,this.allow=!0,this.pressed=!1,T.apply(this,arguments)}function j(){this.evEl=Nt,this.evWin=Wt,T.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function $(){this.evTarget=Qt,this.evWin=Xt,this.started=!1,T.apply(this,arguments)}function N(t,e){var i=b(t.touches),n=b(t.changedTouches);return e&(Tt|St)&&(i=w(i.concat(n),"identifier",!0)),[i,n]}function W(){this.evTarget=Yt,this.targetIds={},T.apply(this,arguments)}function F(t,e){var i=b(t.touches),n=this.targetIds;if(e&(xt|Ct)&&1===i.length)return n[i[0].identifier]=!0,[i,i];var o,a,r=b(t.changedTouches),s=[],l=this.target;if(a=i.filter(function(t){return v(t.target,l)}),e===xt)for(o=0;o<a.length;)n[a[o].identifier]=!0,o++;for(o=0;o<r.length;)n[r[o].identifier]&&s.push(r[o]),e&(Tt|St)&&delete n[r[o].identifier],o++;return s.length?[w(a.concat(s),"identifier",!0),s]:void 0}function Q(){T.apply(this,arguments);var t=u(this.handler,this);this.touch=new W(this.manager,t),this.mouse=new L(this.manager,t)}function X(t,e){this.manager=t,this.set(e)}function R(t){if(m(t,Kt))return Kt;var e=m(t,te),i=m(t,ee);return e&&i?te+" "+ee:e||i?e?te:ee:m(t,Jt)?Jt:Zt}function Y(t){this.id=x(),this.manager=null,this.options=l(t||{},this.defaults),this.options.enable=p(this.options.enable,!0),this.state=ie,this.simultaneous={},this.requireFail=[]}function B(t){return t&se?"cancel":t&ae?"end":t&oe?"move":t&ne?"start":""}function U(t){return t==_t?"down":t==Et?"up":t==At?"left":t==Ot?"right":""}function G(t,e){var i=e.manager;return i?i.get(t):t}function Z(){Y.apply(this,arguments)}function J(){Z.apply(this,arguments),this.pX=null,this.pY=null}function K(){Z.apply(this,arguments)}function tt(){Y.apply(this,arguments),this._timer=null,this._input=null}function et(){Z.apply(this,arguments)}function it(){Z.apply(this,arguments)}function nt(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ot(t,e){return e=e||{},e.recognizers=p(e.recognizers,ot.defaults.preset),new at(t,e)}function at(t,e){e=e||{},this.options=l(e,ot.defaults),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.element=t,this.input=S(this),this.touchAction=new X(this,this.options.touchAction),rt(this,!0),r(e.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function rt(t,e){var i=t.element;r(t.options.cssProps,function(t,n){i.style[k(i.style,n)]=e?t:""})}function st(t,i){var n=e.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}var lt=["","webkit","moz","MS","ms","o"],ct=e.createElement("div"),ut="function",dt=Math.round,pt=Math.abs,ht=Date.now,ft=1,vt=/mobile|tablet|ip(ad|hone|od)|android/i,mt="ontouchstart"in t,gt=k(t,"PointerEvent")!==n,yt=mt&&vt.test(navigator.userAgent),bt="touch",wt="mouse",kt=25,xt=1,Ct=2,Tt=4,St=8,Pt=1,At=2,Ot=4,Et=8,_t=16,Mt=At|Ot,It=Et|_t,Dt=Mt|It,qt=["x","y"],zt=["clientX","clientY"];T.prototype={handler:function(){},init:function(){this.evEl&&h(this.element,this.evEl,this.domHandler),this.evTarget&&h(this.target,this.evTarget,this.domHandler),this.evWin&&h(C(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&f(this.element,this.evEl,this.domHandler),this.evTarget&&f(this.target,this.evTarget,this.domHandler),this.evWin&&f(C(this.element),this.evWin,this.domHandler)}};var Vt={mousedown:xt,mousemove:Ct,mouseup:Tt},Ht="mousedown",Lt="mousemove mouseup";c(L,T,{handler:function(t){var e=Vt[t.type];e&xt&&0===t.button&&(this.pressed=!0),e&Ct&&1!==t.which&&(e=Tt),this.pressed&&this.allow&&(e&Tt&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:wt,srcEvent:t}))}});var jt={pointerdown:xt,pointermove:Ct,pointerup:Tt,pointercancel:St,pointerout:St},$t={2:bt,3:"pen",4:wt,5:"kinect"},Nt="pointerdown",Wt="pointermove pointerup pointercancel";t.MSPointerEvent&&(Nt="MSPointerDown",Wt="MSPointerMove MSPointerUp MSPointerCancel"),c(j,T,{handler:function(t){var e=this.store,i=!1,n=t.type.toLowerCase().replace("ms",""),o=jt[n],a=$t[t.pointerType]||t.pointerType,r=a==bt,s=y(e,t.pointerId,"pointerId");o&xt&&(0===t.button||r)?0>s&&(e.push(t),s=e.length-1):o&(Tt|St)&&(i=!0),0>s||(e[s]=t,this.callback(this.manager,o,{pointers:e,changedPointers:[t],pointerType:a,srcEvent:t}),i&&e.splice(s,1))}});var Ft={touchstart:xt,touchmove:Ct,touchend:Tt,touchcancel:St},Qt="touchstart",Xt="touchstart touchmove touchend touchcancel";c($,T,{handler:function(t){var e=Ft[t.type];if(e===xt&&(this.started=!0),this.started){var i=N.call(this,t,e);e&(Tt|St)&&0==i[0].length-i[1].length&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:bt,srcEvent:t})}}});var Rt={touchstart:xt,touchmove:Ct,touchend:Tt,touchcancel:St},Yt="touchstart touchmove touchend touchcancel";c(W,T,{handler:function(t){var e=Rt[t.type],i=F.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:bt,srcEvent:t})}}),c(Q,T,{handler:function(t,e,i){var n=i.pointerType==bt,o=i.pointerType==wt;if(n)this.mouse.allow=!1;else if(o&&!this.mouse.allow)return;e&(Tt|St)&&(this.mouse.allow=!0),this.callback(t,e,i)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Bt=k(ct.style,"touchAction"),Ut=Bt!==n,Gt="compute",Zt="auto",Jt="manipulation",Kt="none",te="pan-x",ee="pan-y";X.prototype={set:function(t){t==Gt&&(t=this.compute()),Ut&&(this.manager.element.style[Bt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return r(this.manager.recognizers,function(e){d(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),R(t.join(" "))},preventDefaults:function(t){if(!Ut){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var n=this.actions,o=m(n,Kt),a=m(n,ee),r=m(n,te);return o||a&&i&Mt||r&&i&It?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ie=1,ne=2,oe=4,ae=8,re=ae,se=16;Y.prototype={defaults:{},set:function(t){return s(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(a(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=G(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return a(t,"dropRecognizeWith",this)?this:(t=G(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(a(t,"requireFailure",this))return this;var e=this.requireFail;return t=G(t,this),-1===y(e,t)&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(a(t,"dropRequireFailure",this))return this;t=G(t,this);var e=y(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){i.manager.emit(i.options.event+(e?B(n):""),t)}var i=this,n=this.state;ae>n&&e(!0),e(),n>=ae&&e(!0)},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=32)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(32|ie)))return!1;t++}return!0},recognize:function(t){var e=s({},t);return d(this.options.enable,[this,e])?(this.state&(re|se|32)&&(this.state=ie),this.state=this.process(e),void(this.state&(ne|oe|ae|se)&&this.tryEmit(e))):(this.reset(),void(this.state=32))},process:function(){},getTouchAction:function(){},reset:function(){}},c(Z,Y,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,n=e&(ne|oe),o=this.attrTest(t);return n&&(i&St||!o)?e|se:n||o?i&Tt?e|ae:e&ne?e|oe:ne:32}}),c(J,Z,{defaults:{event:"pan",threshold:10,pointers:1,direction:Dt},getTouchAction:function(){var t=this.options.direction,e=[];return t&Mt&&e.push(ee),t&It&&e.push(te),e},directionTest:function(t){var e=this.options,i=!0,n=t.distance,o=t.direction,a=t.deltaX,r=t.deltaY;return o&e.direction||(e.direction&Mt?(o=0===a?Pt:0>a?At:Ot,i=a!=this.pX,n=Math.abs(t.deltaX)):(o=0===r?Pt:0>r?Et:_t,i=r!=this.pY,n=Math.abs(t.deltaY))),t.direction=o,i&&n>e.threshold&&o&e.direction},attrTest:function(t){return Z.prototype.attrTest.call(this,t)&&(this.state&ne||!(this.state&ne)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=U(t.direction);e&&this.manager.emit(this.options.event+e,t),this._super.emit.call(this,t)}}),c(K,Z,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Kt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ne)},emit:function(t){if(this._super.emit.call(this,t),1!==t.scale){var e=t.scale<1?"in":"out";this.manager.emit(this.options.event+e,t)}}}),c(tt,Y,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[Zt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,a=t.deltaTime>e.time;if(this._input=t,!n||!i||t.eventType&(Tt|St)&&!a)this.reset();else if(t.eventType&xt)this.reset(),this._timer=o(function(){this.state=re,this.tryEmit()},e.time,this);else if(t.eventType&Tt)return re;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===re&&(t&&t.eventType&Tt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=ht(),this.manager.emit(this.options.event,this._input)))}}),c(et,Z,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Kt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ne)}}),c(it,Z,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:Mt|It,pointers:1},getTouchAction:function(){return J.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(Mt|It)?e=t.velocity:i&Mt?e=t.velocityX:i&It&&(e=t.velocityY),this._super.attrTest.call(this,t)&&i&t.direction&&t.distance>this.options.threshold&&pt(e)>this.options.velocity&&t.eventType&Tt},emit:function(t){var e=U(t.direction);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),c(nt,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[Jt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,a=t.deltaTime<e.time;if(this.reset(),t.eventType&xt&&0===this.count)return this.failTimeout();if(n&&a&&i){if(t.eventType!=Tt)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||q(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,s&&r?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=o(function(){this.state=re,this.tryEmit()},e.interval,this),ne):re}return 32},failTimeout:function(){return this._timer=o(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==re&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ot.VERSION="2.0.4",ot.defaults={domEvents:!1,touchAction:Gt,enable:!0,inputTarget:null,inputClass:null,preset:[[et,{enable:!1}],[K,{enable:!1},["rotate"]],[it,{direction:Mt}],[J,{direction:Mt},["swipe"]],[nt],[nt,{event:"doubletap",taps:2},["tap"]],[tt]],cssProps:{userSelect:"default",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};at.prototype={set:function(t){return s(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var i,n=this.recognizers,o=e.curRecognizer;(!o||o&&o.state&re)&&(o=e.curRecognizer=null);for(var a=0;a<n.length;)i=n[a],2===e.stopped||o&&i!=o&&!i.canRecognizeWith(o)?i.reset():i.recognize(t),!o&&i.state&(ne|oe|ae)&&(o=e.curRecognizer=i),a++}},get:function(t){if(t instanceof Y)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(a(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(a(t,"remove",this))return this;var e=this.recognizers;return t=this.get(t),e.splice(y(e,t),1),this.touchAction.update(),this},on:function(t,e){var i=this.handlers;return r(g(t),function(t){i[t]=i[t]||[],i[t].push(e)}),this},off:function(t,e){var i=this.handlers;return r(g(t),function(t){e?i[t].splice(y(i[t],e),1):delete i[t]}),this},emit:function(t,e){this.options.domEvents&&st(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var n=0;n<i.length;)i[n](e),n++}},destroy:function(){this.element&&rt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},s(ot,{INPUT_START:xt,INPUT_MOVE:Ct,INPUT_END:Tt,INPUT_CANCEL:St,STATE_POSSIBLE:ie,STATE_BEGAN:ne,STATE_CHANGED:oe,STATE_ENDED:ae,STATE_RECOGNIZED:re,STATE_CANCELLED:se,STATE_FAILED:32,DIRECTION_NONE:Pt,DIRECTION_LEFT:At,DIRECTION_RIGHT:Ot,DIRECTION_UP:Et,DIRECTION_DOWN:_t,DIRECTION_HORIZONTAL:Mt,DIRECTION_VERTICAL:It,DIRECTION_ALL:Dt,Manager:at,Input:T,TouchAction:X,TouchInput:W,MouseInput:L,PointerEventInput:j,TouchMouseInput:Q,SingleTouchInput:$,Recognizer:Y,AttrRecognizer:Z,Tap:nt,Pan:J,Swipe:it,Pinch:K,Rotate:et,Press:tt,on:h,off:f,each:r,merge:l,extend:s,inherit:c,bindFn:u,prefixed:k}),typeof define==ut&&define.amd?define(function(){return ot}):"undefined"!=typeof module&&module.exports?module.exports=ot:t.Hammer=ot}(window,document),function(t){"function"==typeof define&&define.amd?define(["jquery","hammerjs"],t):"object"==typeof exports?t(require("jquery"),require("hammerjs")):t(jQuery,Hammer)}(function(t,e){function i(i,n){var o=t(i);o.data("hammer")||o.data("hammer",new e(o[0],n))}t.fn.hammer=function(t){return this.each(function(){i(this,t)})},e.Manager.prototype.emit=function(e){return function(i,n){e.call(this,i,n),t(this.element).trigger({type:i,gesture:n})}}(e.Manager.prototype.emit)}),function(t){t.Package?Materialize={}:t.Materialize={}}(window),"undefined"==typeof exports||exports.nodeType||("undefined"!=typeof module&&!module.nodeType&&module.exports&&(exports=module.exports=Materialize),exports.default=Materialize),function(t){for(var e=0,i=["webkit","moz"],n=t.requestAnimationFrame,o=t.cancelAnimationFrame,a=i.length;--a>=0&&!n;)n=t[i[a]+"RequestAnimationFrame"],o=t[i[a]+"CancelRequestAnimationFrame"];n&&o||(n=function(t){var i=+Date.now(),n=Math.max(e+16,i);return setTimeout(function(){t(e=n)},n-i)},o=clearTimeout),t.requestAnimationFrame=n,t.cancelAnimationFrame=o}(window),Materialize.objectSelectorString=function(t){return((t.prop("tagName")||"")+(t.attr("id")||"")+(t.attr("class")||"")).replace(/\s/g,"")},Materialize.guid=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}(),Materialize.escapeHash=function(t){return t.replace(/(:|\.|\[|\]|,|=)/g,"\\$1")},Materialize.elementOrParentIsFixed=function(t){var e=$(t),i=!1;return e.add(e.parents()).each(function(){if("fixed"===$(this).css("position"))return i=!0,!1}),i};var getTime=Date.now||function(){return(new Date).getTime()};Materialize.throttle=function(t,e,i){var n,o,a,r=null,s=0;i||(i={});var l=function(){s=!1===i.leading?0:getTime(),r=null,a=t.apply(n,o),n=o=null};return function(){var c=getTime();s||!1!==i.leading||(s=c);var u=e-(c-s);return n=this,o=arguments,u<=0?(clearTimeout(r),r=null,s=c,a=t.apply(n,o),n=o=null):r||!1===i.trailing||(r=setTimeout(l,u)),a}};var Vel;Vel=jQuery?jQuery.Velocity:$?$.Velocity:Velocity,Materialize.Vel=Vel||Velocity,function(t){t.fn.collapsible=function(e,i){var n={accordion:void 0,onOpen:void 0,onClose:void 0},o=e;return e=t.extend(n,e),this.each(function(){function n(e){p=d.find("> li > .collapsible-header"),e.hasClass("active")?e.parent().addClass("active"):e.parent().removeClass("active"),e.parent().hasClass("active")?e.siblings(".collapsible-body").stop(!0,!1).slideDown({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}}):e.siblings(".collapsible-body").stop(!0,!1).slideUp({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}}),p.not(e).removeClass("active").parent().removeClass("active"),p.not(e).parent().children(".collapsible-body").stop(!0,!1).each(function(){t(this).is(":visible")&&t(this).slideUp({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height",""),s(t(this).siblings(".collapsible-header"))}})})}function a(e){e.hasClass("active")?e.parent().addClass("active"):e.parent().removeClass("active"),e.parent().hasClass("active")?e.siblings(".collapsible-body").stop(!0,!1).slideDown({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}}):e.siblings(".collapsible-body").stop(!0,!1).slideUp({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}})}function r(t,i){i||t.toggleClass("active"),e.accordion||"accordion"===h||void 0===h?n(t):a(t),s(t)}function s(t){t.hasClass("active")?"function"==typeof e.onOpen&&e.onOpen.call(this,t.parent()):"function"==typeof e.onClose&&e.onClose.call(this,t.parent())}function l(t){return c(t).length>0}function c(t){return t.closest("li > .collapsible-header")}function u(){d.off("click.collapse","> li > .collapsible-header")}var d=t(this),p=t(this).find("> li > .collapsible-header"),h=d.data("collapsible");if("destroy"!==o)if(i>=0&&i<p.length){var f=p.eq(i);f.length&&("open"===o||"close"===o&&f.hasClass("active"))&&r(f)}else u(),d.on("click.collapse","> li > .collapsible-header",function(e){var i=t(e.target);l(i)&&(i=c(i)),r(i)}),e.accordion||"accordion"===h||void 0===h?r(p.filter(".active").first(),!0):p.filter(".active").each(function(){r(t(this),!0)});else u()})},t(document).ready(function(){t(".collapsible").collapsible()})}(jQuery),function(t){t.fn.scrollTo=function(e){return t(this).scrollTop(t(this).scrollTop()-t(this).offset().top+t(e).offset().top),this},t.fn.dropdown=function(e){var i={inDuration:300,outDuration:225,constrainWidth:!0,hover:!1,gutter:0,belowOrigin:!1,alignment:"left",stopPropagation:!1};return"open"===e?(this.each(function(){t(this).trigger("open")}),!1):"close"===e?(this.each(function(){t(this).trigger("close")}),!1):void this.each(function(){function n(){void 0!==r.data("induration")&&(s.inDuration=r.data("induration")),void 0!==r.data("outduration")&&(s.outDuration=r.data("outduration")),void 0!==r.data("constrainwidth")&&(s.constrainWidth=r.data("constrainwidth")),void 0!==r.data("hover")&&(s.hover=r.data("hover")),void 0!==r.data("gutter")&&(s.gutter=r.data("gutter")),void 0!==r.data("beloworigin")&&(s.belowOrigin=r.data("beloworigin")),void 0!==r.data("alignment")&&(s.alignment=r.data("alignment")),void 0!==r.data("stoppropagation")&&(s.stopPropagation=r.data("stoppropagation"))}function o(e){"focus"===e&&(l=!0),n(),c.addClass("active"),r.addClass("active");var i=r[0].getBoundingClientRect().width;!0===s.constrainWidth?c.css("width",i):c.css("white-space","nowrap");var o=window.innerHeight,u=r.innerHeight(),d=r.offset().left,p=r.offset().top-t(window).scrollTop(),h=s.alignment,f=0,v=0,m=0;!0===s.belowOrigin&&(m=u);var g=0,y=0,b=r.parent();if(b.is("body")||(b[0].scrollHeight>b[0].clientHeight&&(g=b[0].scrollTop),b[0].scrollWidth>b[0].clientWidth&&(y=b[0].scrollLeft)),d+c.innerWidth()>t(window).width()?h="right":d-c.innerWidth()+r.innerWidth()<0&&(h="left"),p+c.innerHeight()>o)if(p+u-c.innerHeight()<0){var w=o-p-m;c.css("max-height",w)}else m||(m+=u),m-=c.innerHeight();"left"===h?(f=s.gutter,v=r.position().left+f):"right"===h&&(c.stop(!0,!0).css({opacity:0,left:0}),v=r.position().left+i-c.width()+(f=-s.gutter)),c.css({position:"absolute",top:r.position().top+m+g,left:v+y}),c.slideDown({queue:!1,duration:s.inDuration,easing:"easeOutCubic",complete:function(){t(this).css("height","")}}).animate({opacity:1},{queue:!1,duration:s.inDuration,easing:"easeOutSine"}),setTimeout(function(){t(document).on("click."+c.attr("id"),function(e){a(),t(document).off("click."+c.attr("id"))})},0)}function a(){l=!1,c.fadeOut(s.outDuration),c.removeClass("active"),r.removeClass("active"),t(document).off("click."+c.attr("id")),setTimeout(function(){c.css("max-height","")},s.outDuration)}var r=t(this),s=t.extend({},i,e),l=!1,c=t("#"+r.attr("data-activates"));if(n(),r.after(c),s.hover){var u=!1;r.off("click."+r.attr("id")),r.on("mouseenter",function(t){!1===u&&(o(),u=!0)}),r.on("mouseleave",function(e){var i=e.toElement||e.relatedTarget;t(i).closest(".dropdown-content").is(c)||(c.stop(!0,!0),a(),u=!1)}),c.on("mouseleave",function(e){var i=e.toElement||e.relatedTarget;t(i).closest(".dropdown-button").is(r)||(c.stop(!0,!0),a(),u=!1)})}else r.off("click."+r.attr("id")),r.on("click."+r.attr("id"),function(e){l||(r[0]!=e.currentTarget||r.hasClass("active")||0!==t(e.target).closest(".dropdown-content").length?r.hasClass("active")&&(a(),t(document).off("click."+c.attr("id"))):(e.preventDefault(),s.stopPropagation&&e.stopPropagation(),o("click")))});r.on("open",function(t,e){o(e)}),r.on("close",a)})},t(document).ready(function(){t(".dropdown-button").dropdown()})}(jQuery),function(t,e){"use strict";var i={opacity:.5,inDuration:250,outDuration:250,ready:void 0,complete:void 0,dismissible:!0,startingTop:"4%",endingTop:"10%"},n=function(){function n(e,i){_classCallCheck(this,n),e[0].M_Modal&&e[0].M_Modal.destroy(),this.$el=e,this.options=t.extend({},n.defaults,i),this.isOpen=!1,this.$el[0].M_Modal=this,this.id=e.attr("id"),this.openingTrigger=void 0,this.$overlay=t('<div class="modal-overlay"></div>'),n._increment++,n._count++,this.$overlay[0].style.zIndex=1e3+2*n._increment,this.$el[0].style.zIndex=1e3+2*n._increment+1,this.setupEventHandlers()}return _createClass(n,[{key:"getInstance",value:function(){return this}},{key:"destroy",value:function(){this.removeEventHandlers(),this.$el[0].removeAttribute("style"),this.$overlay[0].parentNode&&this.$overlay[0].parentNode.removeChild(this.$overlay[0]),this.$el[0].M_Modal=void 0,n._count--}},{key:"setupEventHandlers",value:function(){this.handleOverlayClickBound=this.handleOverlayClick.bind(this),this.handleModalCloseClickBound=this.handleModalCloseClick.bind(this),1===n._count&&document.body.addEventListener("click",this.handleTriggerClick),this.$overlay[0].addEventListener("click",this.handleOverlayClickBound),this.$el[0].addEventListener("click",this.handleModalCloseClickBound)}},{key:"removeEventHandlers",value:function(){0===n._count&&document.body.removeEventListener("click",this.handleTriggerClick),this.$overlay[0].removeEventListener("click",this.handleOverlayClickBound),this.$el[0].removeEventListener("click",this.handleModalCloseClickBound)}},{key:"handleTriggerClick",value:function(e){var i=t(e.target).closest(".modal-trigger");if(e.target&&i.length){var n=i[0].getAttribute("href");n=n?n.slice(1):i[0].getAttribute("data-target");var o=document.getElementById(n).M_Modal;o&&o.open(i),e.preventDefault()}}},{key:"handleOverlayClick",value:function(){this.options.dismissible&&this.close()}},{key:"handleModalCloseClick",value:function(e){var i=t(e.target).closest(".modal-close");e.target&&i.length&&this.close()}},{key:"handleKeydown",value:function(t){27===t.keyCode&&this.options.dismissible&&this.close()}},{key:"animateIn",value:function(){var i=this;t.extend(this.$el[0].style,{display:"block",opacity:0}),t.extend(this.$overlay[0].style,{display:"block",opacity:0}),e(this.$overlay[0],{opacity:this.options.opacity},{duration:this.options.inDuration,queue:!1,ease:"easeOutCubic"});var n={duration:this.options.inDuration,queue:!1,ease:"easeOutCubic",complete:function(){"function"==typeof i.options.ready&&i.options.ready.call(i,i.$el,i.openingTrigger)}};this.$el[0].classList.contains("bottom-sheet")?e(this.$el[0],{bottom:0,opacity:1},n):(e.hook(this.$el[0],"scaleX",.7),this.$el[0].style.top=this.options.startingTop,e(this.$el[0],{top:this.options.endingTop,opacity:1,scaleX:1},n))}},{key:"animateOut",value:function(){var t=this;e(this.$overlay[0],{opacity:0},{duration:this.options.outDuration,queue:!1,ease:"easeOutQuart"});var i={duration:this.options.outDuration,queue:!1,ease:"easeOutCubic",complete:function(){t.$el[0].style.display="none","function"==typeof t.options.complete&&t.options.complete.call(t,t.$el),t.$overlay[0].parentNode.removeChild(t.$overlay[0])}};this.$el[0].classList.contains("bottom-sheet")?e(this.$el[0],{bottom:"-100%",opacity:0},i):e(this.$el[0],{top:this.options.startingTop,opacity:0,scaleX:.7},i)}},{key:"open",value:function(t){if(!this.isOpen){this.isOpen=!0;var e=document.body;return e.style.overflow="hidden",this.$el[0].classList.add("open"),e.appendChild(this.$overlay[0]),this.openingTrigger=t||void 0,this.options.dismissible&&(this.handleKeydownBound=this.handleKeydown.bind(this),document.addEventListener("keydown",this.handleKeydownBound)),this.animateIn(),this}}},{key:"close",value:function(){if(this.isOpen)return this.isOpen=!1,this.$el[0].classList.remove("open"),document.body.style.overflow="",this.options.dismissible&&document.removeEventListener("keydown",this.handleKeydownBound),this.animateOut(),this}}],[{key:"init",value:function(e,i){var o=[];return e.each(function(){o.push(new n(t(this),i))}),o}},{key:"defaults",get:function(){return i}}]),n}();n._increment=0,n._count=0,Materialize.Modal=n,t.fn.modal=function(e){return n.prototype[e]?"get"===e.slice(0,3)?this.first()[0].M_Modal[e]():this.each(function(){this.M_Modal[e]()}):"object"!=typeof e&&e?void t.error("Method "+e+" does not exist on jQuery.modal"):(n.init(this,arguments[0]),this)}}(jQuery,Materialize.Vel),function(t){t.fn.materialbox=function(){return this.each(function(){function e(){a=!1;var e=s.parent(".material-placeholder"),n=(window.innerWidth,window.innerHeight,s.data("width")),l=s.data("height");s.velocity("stop",!0),t("#materialbox-overlay").velocity("stop",!0),t(".materialbox-caption").velocity("stop",!0),t(window).off("scroll.materialbox"),t(document).off("keyup.materialbox"),t(window).off("resize.materialbox"),t("#materialbox-overlay").velocity({opacity:0},{duration:r,queue:!1,easing:"easeOutQuad",complete:function(){o=!1,t(this).remove()}}),s.velocity({width:n,height:l,left:0,top:0},{duration:r,queue:!1,easing:"easeOutQuad",complete:function(){e.css({height:"",width:"",position:"",top:"",left:""}),s.removeAttr("style"),s.attr("style",c),s.removeClass("active"),a=!0,i&&i.css("overflow","")}}),t(".materialbox-caption").velocity({opacity:0},{duration:r,queue:!1,easing:"easeOutQuad",complete:function(){t(this).remove()}})}if(!t(this).hasClass("initialized")){t(this).addClass("initialized");var i,n,o=!1,a=!0,r=200,s=t(this),l=t("<div></div>").addClass("material-placeholder"),c=s.attr("style");s.wrap(l),s.on("click",function(){var r=s.parent(".material-placeholder"),l=window.innerWidth,c=window.innerHeight,u=s.width(),d=s.height();if(!1===a)return e(),!1;if(o&&!0===a)return e(),!1;a=!1,s.addClass("active"),o=!0,r.css({width:r[0].getBoundingClientRect().width,height:r[0].getBoundingClientRect().height,position:"relative",top:0,left:0}),i=void 0,n=r[0].parentNode;for(;null!==n&&!t(n).is(document);){var p=t(n);"visible"!==p.css("overflow")&&(p.css("overflow","visible"),i=void 0===i?p:i.add(p)),n=n.parentNode}s.css({position:"absolute","z-index":1e3,"will-change":"left, top, width, height"}).data("width",u).data("height",d);var h=t('<div id="materialbox-overlay"></div>').css({opacity:0}).click(function(){!0===a&&e()});s.before(h);var f=h[0].getBoundingClientRect();if(h.css({width:l,height:c,left:-1*f.left,top:-1*f.top}),h.velocity({opacity:1},{duration:275,queue:!1,easing:"easeOutQuad"}),""!==s.data("caption")){var v=t('<div class="materialbox-caption"></div>');v.text(s.data("caption")),t("body").append(v),v.css({display:"inline"}),v.velocity({opacity:1},{duration:275,queue:!1,easing:"easeOutQuad"})}var m=0,g=0;u/l>d/c?(m=.9*l,g=.9*l*(d/u)):(m=.9*c*(u/d),g=.9*c),s.hasClass("responsive-img")?s.velocity({"max-width":m,width:u},{duration:0,queue:!1,complete:function(){s.css({left:0,top:0}).velocity({height:g,width:m,left:t(document).scrollLeft()+l/2-s.parent(".material-placeholder").offset().left-m/2,top:t(document).scrollTop()+c/2-s.parent(".material-placeholder").offset().top-g/2},{duration:275,queue:!1,easing:"easeOutQuad",complete:function(){a=!0}})}}):s.css("left",0).css("top",0).velocity({height:g,width:m,left:t(document).scrollLeft()+l/2-s.parent(".material-placeholder").offset().left-m/2,top:t(document).scrollTop()+c/2-s.parent(".material-placeholder").offset().top-g/2},{duration:275,queue:!1,easing:"easeOutQuad",complete:function(){a=!0}}),t(window).on("scroll.materialbox",function(){o&&e()}),t(window).on("resize.materialbox",function(){o&&e()}),t(document).on("keyup.materialbox",function(t){27===t.keyCode&&!0===a&&o&&e()})})}})},t(document).ready(function(){t(".materialboxed").materialbox()})}(jQuery),function(t){t.fn.parallax=function(){var e=t(window).width();return this.each(function(i){function n(i){var n;n=e<601?o.height()>0?o.height():o.children("img").height():o.height()>0?o.height():500;var a=o.children("img").first(),r=a.height()-n,s=o.offset().top+n,l=o.offset().top,c=t(window).scrollTop(),u=window.innerHeight,d=(c+u-l)/(n+u),p=Math.round(r*d);i&&a.css("display","block"),s>c&&l<c+u&&a.css("transform","translate3D(-50%,"+p+"px, 0)")}var o=t(this);o.addClass("parallax"),o.children("img").one("load",function(){n(!0)}).each(function(){this.complete&&t(this).trigger("load")}),t(window).scroll(function(){e=t(window).width(),n(!1)}),t(window).resize(function(){e=t(window).width(),n(!1)})})}}(jQuery),function(t){var e={init:function(e){var i={onShow:null,swipeable:!1,responsiveThreshold:1/0};e=t.extend(i,e);var n=Materialize.objectSelectorString(t(this));return this.each(function(i){var o,a,r,s,l,c=n+i,u=t(this),d=t(window).width(),p=u.find("li.tab a"),h=u.width(),f=t(),v=Math.max(h,u[0].scrollWidth)/p.length,m=0,g=0,y=!1,b=function(t){return Math.ceil(h-t.position().left-t[0].getBoundingClientRect().width-u.scrollLeft())},w=function(t){return Math.floor(t.position().left+u.scrollLeft())},k=function(t){m-t>=0?(s.velocity({right:b(o)},{duration:300,queue:!1,easing:"easeOutQuad"}),s.velocity({left:w(o)},{duration:300,queue:!1,easing:"easeOutQuad",delay:90})):(s.velocity({left:w(o)},{duration:300,queue:!1,easing:"easeOutQuad"}),s.velocity({right:b(o)},{duration:300,queue:!1,easing:"easeOutQuad",delay:90}))};e.swipeable&&d>e.responsiveThreshold&&(e.swipeable=!1),0===(o=t(p.filter('[href="'+location.hash+'"]'))).length&&(o=t(this).find("li.tab a.active").first()),0===o.length&&(o=t(this).find("li.tab a").first()),o.addClass("active"),(m=p.index(o))<0&&(m=0),void 0!==o[0]&&(a=t(o[0].hash)).addClass("active"),u.find(".indicator").length||u.append('<li class="indicator"></li>'),s=u.find(".indicator"),u.append(s),u.is(":visible")&&setTimeout(function(){s.css({right:b(o)}),s.css({left:w(o)})},0),t(window).off("resize.tabs-"+c).on("resize.tabs-"+c,function(){h=u.width(),v=Math.max(h,u[0].scrollWidth)/p.length,m<0&&(m=0),0!==v&&0!==h&&(s.css({right:b(o)}),s.css({left:w(o)}))}),e.swipeable?(p.each(function(){var e=t(Materialize.escapeHash(this.hash));e.addClass("carousel-item"),f=f.add(e)}),r=f.wrapAll('<div class="tabs-content carousel"></div>'),f.css("display",""),t(".tabs-content.carousel").carousel({fullWidth:!0,noWrap:!0,onCycleTo:function(t){if(!y){var i=m;m=r.index(t),o.removeClass("active"),(o=p.eq(m)).addClass("active"),k(i),"function"==typeof e.onShow&&e.onShow.call(u[0],a)}}})):p.not(o).each(function(){t(Materialize.escapeHash(this.hash)).hide()}),u.off("click.tabs").on("click.tabs","a",function(i){if(t(this).parent().hasClass("disabled"))i.preventDefault();else if(!t(this).attr("target")){y=!0,h=u.width(),v=Math.max(h,u[0].scrollWidth)/p.length,o.removeClass("active");var n=a;o=t(this),a=t(Materialize.escapeHash(this.hash)),p=u.find("li.tab a");o.position();o.addClass("active"),g=m,(m=p.index(t(this)))<0&&(m=0),e.swipeable?f.length&&f.carousel("set",m,function(){"function"==typeof e.onShow&&e.onShow.call(u[0],a)}):(void 0!==a&&(a.show(),a.addClass("active"),"function"==typeof e.onShow&&e.onShow.call(this,a)),void 0===n||n.is(a)||(n.hide(),n.removeClass("active"))),l=setTimeout(function(){y=!1},300),k(g),i.preventDefault()}})})},select_tab:function(t){this.find('a[href="#'+t+'"]').trigger("click")}};t.fn.tabs=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.tabs"):e.init.apply(this,arguments)},t(document).ready(function(){t("ul.tabs").tabs()})}(jQuery),function(t){t.fn.tooltip=function(i){var n={delay:350,tooltip:"",position:"bottom",html:!1};return"remove"===i?(this.each(function(){t("#"+t(this).attr("data-tooltip-id")).remove(),t(this).removeAttr("data-tooltip-id"),t(this).off("mouseenter.tooltip mouseleave.tooltip")}),!1):(i=t.extend(n,i),this.each(function(){var n=Materialize.guid(),o=t(this);o.attr("data-tooltip-id")&&t("#"+o.attr("data-tooltip-id")).remove(),o.attr("data-tooltip-id",n);var a,r,s,l,c,u,d=function(){a=o.attr("data-html")?"true"===o.attr("data-html"):i.html,r=o.attr("data-delay"),r=void 0===r||""===r?i.delay:r,s=o.attr("data-position"),s=void 0===s||""===s?i.position:s,l=o.attr("data-tooltip"),l=void 0===l||""===l?i.tooltip:l};d();c=function(){var e=t('<div class="material-tooltip"></div>');return l=a?t("<span></span>").html(l):t("<span></span>").text(l),e.append(l).appendTo(t("body")).attr("id",n),(u=t('<div class="backdrop"></div>')).appendTo(e),e}(),o.off("mouseenter.tooltip mouseleave.tooltip");var p,h=!1;o.on({"mouseenter.tooltip":function(t){p=setTimeout(function(){d(),h=!0,c.velocity("stop"),u.velocity("stop"),c.css({visibility:"visible",left:"0px",top:"0px"});var t,i,n,a=o.outerWidth(),r=o.outerHeight(),l=c.outerHeight(),p=c.outerWidth(),f="0px",v="0px",m=u[0].offsetWidth,g=u[0].offsetHeight,y=8,b=8,w=0;"top"===s?(t=o.offset().top-l-5,i=o.offset().left+a/2-p/2,n=e(i,t,p,l),f="-10px",u.css({bottom:0,left:0,borderRadius:"14px 14px 0 0",transformOrigin:"50% 100%",marginTop:l,marginLeft:p/2-m/2})):"left"===s?(t=o.offset().top+r/2-l/2,i=o.offset().left-p-5,n=e(i,t,p,l),v="-10px",u.css({top:"-7px",right:0,width:"14px",height:"14px",borderRadius:"14px 0 0 14px",transformOrigin:"95% 50%",marginTop:l/2,marginLeft:p})):"right"===s?(t=o.offset().top+r/2-l/2,i=o.offset().left+a+5,n=e(i,t,p,l),v="+10px",u.css({top:"-7px",left:0,width:"14px",height:"14px",borderRadius:"0 14px 14px 0",transformOrigin:"5% 50%",marginTop:l/2,marginLeft:"0px"})):(t=o.offset().top+o.outerHeight()+5,i=o.offset().left+a/2-p/2,n=e(i,t,p,l),f="+10px",u.css({top:0,left:0,marginLeft:p/2-m/2})),c.css({top:n.y,left:n.x}),y=Math.SQRT2*p/parseInt(m),b=Math.SQRT2*l/parseInt(g),w=Math.max(y,b),c.velocity({translateY:f,translateX:v},{duration:350,queue:!1}).velocity({opacity:1},{duration:300,delay:50,queue:!1}),u.css({visibility:"visible"}).velocity({opacity:1},{duration:55,delay:0,queue:!1}).velocity({scaleX:w,scaleY:w},{duration:300,delay:0,queue:!1,easing:"easeInOutQuad"})},r)},"mouseleave.tooltip":function(){h=!1,clearTimeout(p),setTimeout(function(){!0!==h&&(c.velocity({opacity:0,translateY:0,translateX:0},{duration:225,queue:!1}),u.velocity({opacity:0,scaleX:1,scaleY:1},{duration:225,queue:!1,complete:function(){u.css({visibility:"hidden"}),c.css({visibility:"hidden"}),h=!1}}))},225)}})}))};var e=function(e,i,n,o){var a=e,r=i;return a<0?a=4:a+n>window.innerWidth&&(a-=a+n-window.innerWidth),r<0?r=4:r+o>window.innerHeight+t(window).scrollTop&&(r-=r+o-window.innerHeight),{x:a,y:r}};t(document).ready(function(){t(".tooltipped").tooltipZ()})}(jQuery),function(t){"use strict";function e(t){return null!==t&&t===t.window}function i(t){return e(t)?t:9===t.nodeType&&t.defaultView}function n(t){var e,n,o={top:0,left:0},a=t&&t.ownerDocument;return e=a.documentElement,void 0!==t.getBoundingClientRect&&(o=t.getBoundingClientRect()),n=i(a),{top:o.top+n.pageYOffset-e.clientTop,left:o.left+n.pageXOffset-e.clientLeft}}function o(t){var e="";for(var i in t)t.hasOwnProperty(i)&&(e+=i+":"+t[i]+";");return e}function a(t){if(!1===u.allowEvent(t))return null;for(var e=null,i=t.target||t.srcElement;null!==i.parentNode;){if(!(i instanceof SVGElement)&&-1!==i.className.indexOf("waves-effect")){e=i;break}i=i.parentNode}return e}function r(e){var i=a(e);null!==i&&(c.show(e,i),"ontouchstart"in t&&(i.addEventListener("touchend",c.hide,!1),i.addEventListener("touchcancel",c.hide,!1)),i.addEventListener("mouseup",c.hide,!1),i.addEventListener("mouseleave",c.hide,!1),i.addEventListener("dragend",c.hide,!1))}var s=s||{},l=document.querySelectorAll.bind(document),c={duration:750,show:function(t,e){if(2===t.button)return!1;var i=e||this,a=document.createElement("div");a.className="waves-ripple",i.appendChild(a);var r=n(i),s=t.pageY-r.top,l=t.pageX-r.left,u="scale("+i.clientWidth/100*10+")";"touches"in t&&(s=t.touches[0].pageY-r.top,l=t.touches[0].pageX-r.left),a.setAttribute("data-hold",Date.now()),a.setAttribute("data-scale",u),a.setAttribute("data-x",l),a.setAttribute("data-y",s);var d={top:s+"px",left:l+"px"};a.className=a.className+" waves-notransition",a.setAttribute("style",o(d)),a.className=a.className.replace("waves-notransition",""),d["-webkit-transform"]=u,d["-moz-transform"]=u,d["-ms-transform"]=u,d["-o-transform"]=u,d.transform=u,d.opacity="1",d["-webkit-transition-duration"]=c.duration+"ms",d["-moz-transition-duration"]=c.duration+"ms",d["-o-transition-duration"]=c.duration+"ms",d["transition-duration"]=c.duration+"ms",d["-webkit-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",d["-moz-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",d["-o-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",d["transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",a.setAttribute("style",o(d))},hide:function(t){u.touchup(t);var e=this,i=(e.clientWidth,null),n=e.getElementsByClassName("waves-ripple");if(!(n.length>0))return!1;var a=(i=n[n.length-1]).getAttribute("data-x"),r=i.getAttribute("data-y"),s=i.getAttribute("data-scale"),l=350-(Date.now()-Number(i.getAttribute("data-hold")));l<0&&(l=0),setTimeout(function(){var t={top:r+"px",left:a+"px",opacity:"0","-webkit-transition-duration":c.duration+"ms","-moz-transition-duration":c.duration+"ms","-o-transition-duration":c.duration+"ms","transition-duration":c.duration+"ms","-webkit-transform":s,"-moz-transform":s,"-ms-transform":s,"-o-transform":s,transform:s};i.setAttribute("style",o(t)),setTimeout(function(){try{e.removeChild(i)}catch(t){return!1}},c.duration)},l)},wrapInput:function(t){for(var e=0;e<t.length;e++){var i=t[e];if("input"===i.tagName.toLowerCase()){var n=i.parentNode;if("i"===n.tagName.toLowerCase()&&-1!==n.className.indexOf("waves-effect"))continue;var o=document.createElement("i");o.className=i.className+" waves-input-wrapper";var a=i.getAttribute("style");a||(a=""),o.setAttribute("style",a),i.className="waves-button-input",i.removeAttribute("style"),n.replaceChild(o,i),o.appendChild(i)}}}},u={touches:0,allowEvent:function(t){var e=!0;return"touchstart"===t.type?u.touches+=1:"touchend"===t.type||"touchcancel"===t.type?setTimeout(function(){u.touches>0&&(u.touches-=1)},500):"mousedown"===t.type&&u.touches>0&&(e=!1),e},touchup:function(t){u.allowEvent(t)}};s.displayEffect=function(e){"duration"in(e=e||{})&&(c.duration=e.duration),c.wrapInput(l(".waves-effect")),"ontouchstart"in t&&document.body.addEventListener("touchstart",r,!1),document.body.addEventListener("mousedown",r,!1)},s.attach=function(e){"input"===e.tagName.toLowerCase()&&(c.wrapInput([e]),e=e.parentNode),"ontouchstart"in t&&e.addEventListener("touchstart",r,!1),e.addEventListener("mousedown",r,!1)},t.Waves=s,document.addEventListener("DOMContentLoaded",function(){s.displayEffect()},!1)}(window),function(t,e){"use strict";var i={displayLength:1/0,inDuration:300,outDuration:375,className:void 0,completeCallback:void 0,activationPercent:.8},n=function(){function n(e,i,o,a){if(_classCallCheck(this,n),e){this.options={displayLength:i,className:o,completeCallback:a},this.options=t.extend({},n.defaults,this.options),this.message=e,this.panning=!1,this.timeRemaining=this.options.displayLength,0===n._toasts.length&&n._createContainer(),n._toasts.push(this);var r=this.createToast();r.M_Toast=this,this.el=r,this._animateIn(),this.setTimer()}}return _createClass(n,[{key:"createToast",value:function(){var e=document.createElement("div");if(e.classList.add("toast"),this.options.className){var i=this.options.className.split(" "),o=void 0,a=void 0;for(o=0,a=i.length;o<a;o++)e.classList.add(i[o])}return("object"==typeof HTMLElement?this.message instanceof HTMLElement:this.message&&"object"==typeof this.message&&null!==this.message&&1===this.message.nodeType&&"string"==typeof this.message.nodeName)?e.appendChild(this.message):this.message instanceof jQuery?t(e).append(this.message):e.innerHTML=this.message,n._container.appendChild(e),e}},{key:"_animateIn",value:function(){e(this.el,{top:0,opacity:1},{duration:300,easing:"easeOutCubic",queue:!1})}},{key:"setTimer",value:function(){var t=this;this.timeRemaining!==1/0&&(this.counterInterval=setInterval(function(){t.panning||(t.timeRemaining-=20),t.timeRemaining<=0&&t.remove()},20))}},{key:"remove",value:function(){var t=this;window.clearInterval(this.counterInterval);var i=this.el.offsetWidth*this.options.activationPercent;this.wasSwiped&&(this.el.style.transition="transform .05s, opacity .05s",this.el.style.transform="translateX("+i+"px)",this.el.style.opacity=0),e(this.el,{opacity:0,marginTop:"-40px"},{duration:this.options.outDuration,easing:"easeOutExpo",queue:!1,complete:function(){"function"==typeof t.options.completeCallback&&t.options.completeCallback(),t.el.parentNode.removeChild(t.el),n._toasts.splice(n._toasts.indexOf(t),1),0===n._toasts.length&&n._removeContainer()}})}}],[{key:"_createContainer",value:function(){var t=document.createElement("div");t.setAttribute("id","toast-container"),t.addEventListener("touchstart",n._onDragStart),t.addEventListener("touchmove",n._onDragMove),t.addEventListener("touchend",n._onDragEnd),t.addEventListener("mousedown",n._onDragStart),document.addEventListener("mousemove",n._onDragMove),document.addEventListener("mouseup",n._onDragEnd),document.body.appendChild(t),n._container=t}},{key:"_removeContainer",value:function(){document.removeEventListener("mousemove",n._onDragMove),document.removeEventListener("mouseup",n._onDragEnd),n._container.parentNode.removeChild(n._container),n._container=null}},{key:"_onDragStart",value:function(e){if(e.target&&t(e.target).closest(".toast").length){var i=t(e.target).closest(".toast")[0].M_Toast;i.panning=!0,n._draggedToast=i,i.el.classList.add("panning"),i.el.style.transition="",i.startingXPos=n._xPos(e),i.time=Date.now(),i.xPos=n._xPos(e)}}},{key:"_onDragMove",value:function(t){if(n._draggedToast){t.preventDefault();var e=n._draggedToast;e.deltaX=Math.abs(e.xPos-n._xPos(t)),e.xPos=n._xPos(t),e.velocityX=e.deltaX/(Date.now()-e.time),e.time=Date.now();var i=e.xPos-e.startingXPos,o=e.el.offsetWidth*e.options.activationPercent;e.el.style.transform="translateX("+i+"px)",e.el.style.opacity=1-Math.abs(i/o)}}},{key:"_onDragEnd",value:function(t){if(n._draggedToast){var e=n._draggedToast;e.panning=!1,e.el.classList.remove("panning");var i=e.xPos-e.startingXPos,o=e.el.offsetWidth*e.options.activationPercent;Math.abs(i)>o||e.velocityX>1?(e.wasSwiped=!0,e.remove()):(e.el.style.transition="transform .2s, opacity .2s",e.el.style.transform="",e.el.style.opacity=""),n._draggedToast=null}}},{key:"_xPos",value:function(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientX:t.clientX}},{key:"removeAll",value:function(){for(var t in n._toasts)n._toasts[t].remove()}},{key:"defaults",get:function(){return i}}]),n}();n._toasts=[],n._container=null,n._draggedToast=null,Materialize.Toast=n,Materialize.toast=function(t,e,i,o){return new n(t,e,i,o)}}(jQuery,Materialize.Vel),function(t){var e={init:function(e){var i={menuWidth:300,edge:"left",closeOnClick:!1,draggable:!0,onOpen:null,onClose:null};e=t.extend(i,e),t(this).each(function(){var i=t(this),n=i.attr("data-activates"),o=t("#"+n);300!=e.menuWidth&&o.css("width",e.menuWidth);var a=t('.drag-target[data-sidenav="'+n+'"]');e.draggable?(a.length&&a.remove(),a=t('<div class="drag-target"></div>').attr("data-sidenav",n),t("body").append(a)):a=t(),"left"==e.edge?(o.css("transform","translateX(-100%)"),a.css({left:0})):(o.addClass("right-aligned").css("transform","translateX(100%)"),a.css({right:0})),o.hasClass("fixed")&&window.innerWidth>992&&o.css("transform","translateX(0)"),o.hasClass("fixed")&&t(window).resize(function(){window.innerWidth>992?0!==t("#sidenav-overlay").length&&l?r(!0):o.css("transform","translateX(0%)"):!1===l&&("left"===e.edge?o.css("transform","translateX(-100%)"):o.css("transform","translateX(100%)"))}),!0===e.closeOnClick&&o.on("click.itemclick","a:not(.collapsible-header)",function(){window.innerWidth>992&&o.hasClass("fixed")||r()});var r=function(i){s=!1,l=!1,t("body").css({overflow:"",width:""}),t("#sidenav-overlay").velocity({opacity:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){t(this).remove()}}),"left"===e.edge?(a.css({width:"",right:"",left:"0"}),o.velocity({translateX:"-100%"},{duration:200,queue:!1,easing:"easeOutCubic",complete:function(){!0===i&&(o.removeAttr("style"),o.css("width",e.menuWidth))}})):(a.css({width:"",right:"0",left:""}),o.velocity({translateX:"100%"},{duration:200,queue:!1,easing:"easeOutCubic",complete:function(){!0===i&&(o.removeAttr("style"),o.css("width",e.menuWidth))}})),"function"==typeof e.onClose&&e.onClose.call(this,o)},s=!1,l=!1;e.draggable&&(a.on("click",function(){l&&r()}),a.hammer({prevent_default:!1}).on("pan",function(i){if("touch"==i.gesture.pointerType){i.gesture.direction;var n=i.gesture.center.x,a=i.gesture.center.y;i.gesture.velocityX;if(0===n&&0===a)return;var s=t("body"),c=t("#sidenav-overlay"),u=s.innerWidth();if(s.css("overflow","hidden"),s.width(u),0===c.length&&((c=t('<div id="sidenav-overlay"></div>')).css("opacity",0).click(function(){r()}),"function"==typeof e.onOpen&&e.onOpen.call(this,o),t("body").append(c)),"left"===e.edge&&(n>e.menuWidth?n=e.menuWidth:n<0&&(n=0)),"left"===e.edge)n<e.menuWidth/2?l=!1:n>=e.menuWidth/2&&(l=!0),o.css("transform","translateX("+(n-e.menuWidth)+"px)");else{n<window.innerWidth-e.menuWidth/2?l=!0:n>=window.innerWidth-e.menuWidth/2&&(l=!1);var d=n-e.menuWidth/2;d<0&&(d=0),o.css("transform","translateX("+d+"px)")}var p;"left"===e.edge?(p=n/e.menuWidth,c.velocity({opacity:p},{duration:10,queue:!1,easing:"easeOutQuad"})):(p=Math.abs((n-window.innerWidth)/e.menuWidth),c.velocity({opacity:p},{duration:10,queue:!1,easing:"easeOutQuad"}))}}).on("panend",function(i){if("touch"==i.gesture.pointerType){var n=t("#sidenav-overlay"),r=i.gesture.velocityX,c=i.gesture.center.x,u=c-e.menuWidth,d=c-e.menuWidth/2;u>0&&(u=0),d<0&&(d=0),s=!1,"left"===e.edge?l&&r<=.3||r<-.5?(0!==u&&o.velocity({translateX:[0,u]},{duration:300,queue:!1,easing:"easeOutQuad"}),n.velocity({opacity:1},{duration:50,queue:!1,easing:"easeOutQuad"}),a.css({width:"50%",right:0,left:""}),l=!0):(!l||r>.3)&&(t("body").css({overflow:"",width:""}),o.velocity({translateX:[-1*e.menuWidth-10,u]},{duration:200,queue:!1,easing:"easeOutQuad"}),n.velocity({opacity:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){"function"==typeof e.onClose&&e.onClose.call(this,o),t(this).remove()}}),a.css({width:"10px",right:"",left:0})):l&&r>=-.3||r>.5?(0!==d&&o.velocity({translateX:[0,d]},{duration:300,queue:!1,easing:"easeOutQuad"}),n.velocity({opacity:1},{duration:50,queue:!1,easing:"easeOutQuad"}),a.css({width:"50%",right:"",left:0}),l=!0):(!l||r<-.3)&&(t("body").css({overflow:"",width:""}),o.velocity({translateX:[e.menuWidth+10,d]},{duration:200,queue:!1,easing:"easeOutQuad"}),n.velocity({opacity:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){"function"==typeof e.onClose&&e.onClose.call(this,o),t(this).remove()}}),a.css({width:"10px",right:0,left:""}))}})),i.off("click.sidenav").on("click.sidenav",function(){if(!0===l)l=!1,s=!1,r();else{var i=t("body"),n=t('<div id="sidenav-overlay"></div>'),c=i.innerWidth();i.css("overflow","hidden"),i.width(c),t("body").append(a),"left"===e.edge?(a.css({width:"50%",right:0,left:""}),o.velocity({translateX:[0,-1*e.menuWidth]},{duration:300,queue:!1,easing:"easeOutQuad"})):(a.css({width:"50%",right:"",left:0}),o.velocity({translateX:[0,e.menuWidth]},{duration:300,queue:!1,easing:"easeOutQuad"})),n.css("opacity",0).click(function(){l=!1,s=!1,r(),n.velocity({opacity:0},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){t(this).remove()}})}),t("body").append(n),n.velocity({opacity:1},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){l=!0,s=!1}}),"function"==typeof e.onOpen&&e.onOpen.call(this,o)}return!1})})},destroy:function(){var e=t("#sidenav-overlay"),i=t('.drag-target[data-sidenav="'+t(this).attr("data-activates")+'"]');e.trigger("click"),i.remove(),t(this).off("click"),e.remove()},show:function(){this.trigger("click")},hide:function(){t("#sidenav-overlay").trigger("click")}};t.fn.sideNav=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.sideNav"):e.init.apply(this,arguments)}}(jQuery),function(t){function e(e,i,n,o){var r=t();return t.each(a,function(t,a){if(a.height()>0){var s=a.offset().top,l=a.offset().left,c=l+a.width(),u=s+a.height();!(l>i||c<o||s>n||u<e)&&r.push(a)}}),r}function i(i){++l;var n=o.scrollTop(),a=o.scrollLeft(),s=a+o.width(),u=n+o.height(),d=e(n+c.top+i||200,s+c.right,u+c.bottom,a+c.left);t.each(d,function(t,e){"number"!=typeof e.data("scrollSpy:ticks")&&e.triggerHandler("scrollSpy:enter"),e.data("scrollSpy:ticks",l)}),t.each(r,function(t,e){var i=e.data("scrollSpy:ticks");"number"==typeof i&&i!==l&&(e.triggerHandler("scrollSpy:exit"),e.data("scrollSpy:ticks",null))}),r=d}function n(){o.trigger("scrollSpy:winSize")}var o=t(window),a=[],r=[],s=!1,l=0,c={top:0,right:0,bottom:0,left:0};t.scrollSpy=function(e,n){var r={throttle:100,scrollOffset:200,activeClass:"active",getActiveElement:function(t){return'a[href="#'+t+'"]'}};n=t.extend(r,n);var l=[];(e=t(e)).each(function(e,i){a.push(t(i)),t(i).data("scrollSpy:id",e),t('a[href="#'+t(i).attr("id")+'"]').click(function(e){e.preventDefault();var i=t(Materialize.escapeHash(this.hash)).offset().top+1;t("html, body").animate({scrollTop:i-n.scrollOffset},{duration:400,queue:!1,easing:"easeOutCubic"})})}),c.top=n.offsetTop||0,c.right=n.offsetRight||0,c.bottom=n.offsetBottom||0,c.left=n.offsetLeft||0;var u=Materialize.throttle(function(){i(n.scrollOffset)},n.throttle||100),d=function(){t(document).ready(u)};return s||(o.on("scroll",d),o.on("resize",d),s=!0),setTimeout(d,0),e.on("scrollSpy:enter",function(){l=t.grep(l,function(t){return 0!=t.height()});var e=t(this);l[0]?(t(n.getActiveElement(l[0].attr("id"))).removeClass(n.activeClass),e.data("scrollSpy:id")<l[0].data("scrollSpy:id")?l.unshift(t(this)):l.push(t(this))):l.push(t(this)),t(n.getActiveElement(l[0].attr("id"))).addClass(n.activeClass)}),e.on("scrollSpy:exit",function(){if((l=t.grep(l,function(t){return 0!=t.height()}))[0]){t(n.getActiveElement(l[0].attr("id"))).removeClass(n.activeClass);var e=t(this);(l=t.grep(l,function(t){return t.attr("id")!=e.attr("id")}))[0]&&t(n.getActiveElement(l[0].attr("id"))).addClass(n.activeClass)}}),e},t.winSizeSpy=function(e){return t.winSizeSpy=function(){return o},e=e||{throttle:100},o.on("resize",Materialize.throttle(n,e.throttle||100))},t.fn.scrollSpy=function(e){return t.scrollSpy(t(this),e)}}(jQuery),function(t){t(document).ready(function(){function e(e){var i=e.css("font-family"),o=e.css("font-size"),a=e.css("line-height"),r=e.css("padding");o&&n.css("font-size",o),i&&n.css("font-family",i),a&&n.css("line-height",a),r&&n.css("padding",r),e.data("original-height")||e.data("original-height",e.height()),"off"===e.attr("wrap")&&n.css("overflow-wrap","normal").css("white-space","pre"),n.text(e.val()+"\n");var s=n.html().replace(/\n/g,"<br>");n.html(s),e.is(":visible")?n.css("width",e.width()):n.css("width",t(window).width()/2),e.data("original-height")<=n.height()?e.css("height",n.height()):e.val().length<e.data("previous-length")&&e.css("height",e.data("original-height")),e.data("previous-length",e.val().length)}Materialize.updateTextFields=function(){t("input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea").each(function(e,i){var n=t(this);t(i).val().length>0||t(i).is(":focus")||i.autofocus||void 0!==n.attr("placeholder")?n.siblings("label").addClass("active"):t(i)[0].validity?n.siblings("label").toggleClass("active",!0===t(i)[0].validity.badInput):n.siblings("label").removeClass("active")})};var i="input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea";t(document).on("change",i,function(){0===t(this).val().length&&void 0===t(this).attr("placeholder")||t(this).siblings("label").addClass("active"),validate_field(t(this))}),t(document).ready(function(){Materialize.updateTextFields()}),t(document).on("reset",function(e){var n=t(e.target);n.is("form")&&(n.find(i).removeClass("valid").removeClass("invalid"),n.find(i).each(function(){""===t(this).attr("value")&&t(this).siblings("label").removeClass("active")}),n.find("select.initialized").each(function(){var t=n.find("option[selected]").text();n.siblings("input.select-dropdown").val(t)}))}),t(document).on("focus",i,function(){t(this).siblings("label, .prefix").addClass("active")}),t(document).on("blur",i,function(){var e=t(this),i=".prefix";0===e.val().length&&!0!==e[0].validity.badInput&&void 0===e.attr("placeholder")&&(i+=", label"),e.siblings(i).removeClass("active"),validate_field(e)}),window.validate_field=function(t){var e=void 0!==t.attr("data-length"),i=parseInt(t.attr("data-length")),n=t.val().length;0!==t.val().length||!1!==t[0].validity.badInput||t.is(":required")?t.hasClass("validate")&&(t.is(":valid")&&e&&n<=i||t.is(":valid")&&!e?(t.removeClass("invalid"),t.addClass("valid")):(t.removeClass("valid"),t.addClass("invalid"))):t.hasClass("validate")&&(t.removeClass("valid"),t.removeClass("invalid"))};t(document).on("keyup.radio","input[type=radio], input[type=checkbox]",function(e){if(9===e.which)return t(this).addClass("tabbed"),void t(this).one("blur",function(e){t(this).removeClass("tabbed")})});var n=t(".hiddendiv").first();n.length||(n=t('<div class="hiddendiv common"></div>'),t("body").append(n));t(".materialize-textarea").each(function(){var e=t(this);e.data("original-height",e.height()),e.data("previous-length",e.val().length)}),t("body").on("keyup keydown autoresize",".materialize-textarea",function(){e(t(this))}),t(document).on("change",'.file-field input[type="file"]',function(){for(var e=t(this).closest(".file-field").find("input.file-path"),i=t(this)[0].files,n=[],o=0;o<i.length;o++)n.push(i[o].name);e.val(n.join(", ")),e.trigger("change")});var o="input[type=range]",a=!1;t(o).each(function(){var e=t('<span class="thumb"><span class="value"></span></span>');t(this).after(e)});var r=function(t){var e=-7+parseInt(t.parent().css("padding-left"))+"px";t.velocity({height:"30px",width:"30px",top:"-30px",marginLeft:e},{duration:300,easing:"easeOutExpo"})},s=function(t){var e=t.width()-15,i=parseFloat(t.attr("max")),n=parseFloat(t.attr("min"));return(parseFloat(t.val())-n)/(i-n)*e};t(document).on("change",o,function(e){var i=t(this).siblings(".thumb");i.find(".value").html(t(this).val()),i.hasClass("active")||r(i);var n=s(t(this));i.addClass("active").css("left",n)}),t(document).on("mousedown touchstart",o,function(e){var i=t(this).siblings(".thumb");if(i.length<=0&&(i=t('<span class="thumb"><span class="value"></span></span>'),t(this).after(i)),i.find(".value").html(t(this).val()),a=!0,t(this).addClass("active"),i.hasClass("active")||r(i),"input"!==e.type){var n=s(t(this));i.addClass("active").css("left",n)}}),t(document).on("mouseup touchend",".range-field",function(){a=!1,t(this).removeClass("active")}),t(document).on("input mousemove touchmove",".range-field",function(e){var i=t(this).children(".thumb"),n=t(this).find(o);if(a){i.hasClass("active")||r(i);var l=s(n);i.addClass("active").css("left",l),i.find(".value").html(i.siblings(o).val())}}),t(document).on("mouseout touchleave",".range-field",function(){if(!a){var e=t(this).children(".thumb"),i=7+parseInt(t(this).css("padding-left"))+"px";e.hasClass("active")&&e.velocity({height:"0",width:"0",top:"10px",marginLeft:i},{duration:100}),e.removeClass("active")}}),t.fn.autocomplete=function(e){var i={data:{},limit:1/0,onAutocomplete:null,minLength:1};return e=t.extend(i,e),this.each(function(){var i,n=t(this),o=e.data,a=0,r=-1,s=n.closest(".input-field");if(t.isEmptyObject(o))n.off("keyup.autocomplete focus.autocomplete");else{var l,c=t('<ul class="autocomplete-content dropdown-content"></ul>');s.length?(l=s.children(".autocomplete-content.dropdown-content").first()).length||s.append(c):(l=n.next(".autocomplete-content.dropdown-content")).length||n.after(c),l.length&&(c=l);var u=function(t,e){var i=e.find("img"),n=e.text().toLowerCase().indexOf(""+t.toLowerCase()),o=n+t.length-1,a=e.text().slice(0,n),r=e.text().slice(n,o+1),s=e.text().slice(o+1);e.html("<span>"+a+"<span class='highlight'>"+r+"</span>"+s+"</span>"),i.length&&e.prepend(i)},d=function(){r=-1,c.find(".active").removeClass("active")},p=function(){c.empty(),d(),i=void 0};n.off("blur.autocomplete").on("blur.autocomplete",function(){p()}),n.off("keyup.autocomplete focus.autocomplete").on("keyup.autocomplete focus.autocomplete",function(r){a=0;var s=n.val().toLowerCase();if(13!==r.which&&38!==r.which&&40!==r.which){if(i!==s&&(p(),s.length>=e.minLength))for(var l in o)if(o.hasOwnProperty(l)&&-1!==l.toLowerCase().indexOf(s)){if(a>=e.limit)break;var d=t("<li></li>");o[l]?d.append('<img src="'+o[l]+'" class="right circle"><span>'+l+"</span>"):d.append("<span>"+l+"</span>"),c.append(d),u(s,d),a++}i=s}}),n.off("keydown.autocomplete").on("keydown.autocomplete",function(t){var e,i=t.which,n=c.children("li").length,o=c.children(".active").first();13===i&&r>=0?(e=c.children("li").eq(r)).length&&(e.trigger("mousedown.autocomplete"),t.preventDefault()):38!==i&&40!==i||(t.preventDefault(),38===i&&r>0&&r--,40===i&&r<n-1&&r++,o.removeClass("active"),r>=0&&c.children("li").eq(r).addClass("active"))}),c.off("mousedown.autocomplete touchstart.autocomplete").on("mousedown.autocomplete touchstart.autocomplete","li",function(){var i=t(this).text().trim();n.val(i),n.trigger("change"),p(),"function"==typeof e.onAutocomplete&&e.onAutocomplete.call(this,i)})}})}}),t.fn.material_select=function(e){function i(t,e,i){var o=t.indexOf(e),a=-1===o;return a?t.push(e):t.splice(o,1),i.siblings("ul.dropdown-content").find("li:not(.optgroup)").eq(e).toggleClass("active"),i.find("option").eq(e).prop("selected",a),n(t,i),a}function n(t,e){for(var i="",n=0,o=t.length;n<o;n++){var a=e.find("option").eq(t[n]).text();i+=0===n?a:", "+a}""===i&&(i=e.find("option:disabled").eq(0).text()),e.siblings("input.select-dropdown").val(i)}t(this).each(function(){var n=t(this);if(!n.hasClass("browser-default")){var o=!!n.attr("multiple"),a=n.attr("data-select-id");if(a&&(n.parent().find("span.caret").remove(),n.parent().find("input").remove(),n.unwrap(),t("ul#select-options-"+a).remove()),"destroy"===e)return n.removeAttr("data-select-id").removeClass("initialized"),void t(window).off("click.select");var r=Materialize.guid();n.attr("data-select-id",r);var s=t('<div class="select-wrapper"></div>');s.addClass(n.attr("class")),n.is(":disabled")&&s.addClass("disabled");var l=t('<ul id="select-options-'+r+'" class="dropdown-content select-dropdown '+(o?"multiple-select-dropdown":"")+'"></ul>'),c=n.children("option, optgroup"),u=[],d=!1,p=n.find("option:selected").html()||n.find("option:first").html()||"",h=function(e,i,n){var a=i.is(":disabled")?"disabled ":"",r="optgroup-option"===n?"optgroup-option ":"",s=o?'<input type="checkbox"'+a+"/><label></label>":"",c=i.data("icon"),u=i.attr("class");if(c){var d="";return u&&(d=' class="'+u+'"'),l.append(t('<li class="'+a+r+'"><img alt="" src="'+c+'"'+d+"><span>"+s+i.html()+"</span></li>")),!0}l.append(t('<li class="'+a+r+'"><span>'+s+i.html()+"</span></li>"))};c.length&&c.each(function(){if(t(this).is("option"))o?h(0,t(this),"multiple"):h(0,t(this));else if(t(this).is("optgroup")){var e=t(this).children("option");l.append(t('<li class="optgroup"><span>'+t(this).attr("label")+"</span></li>")),e.each(function(){h(0,t(this),"optgroup-option")})}}),l.find("li:not(.optgroup)").each(function(a){t(this).click(function(r){if(!t(this).hasClass("disabled")&&!t(this).hasClass("optgroup")){var s=!0;o?(t('input[type="checkbox"]',this).prop("checked",function(t,e){return!e}),s=i(u,a,n),m.trigger("focus")):(l.find("li").removeClass("active"),t(this).toggleClass("active"),m.val(t(this).text())),g(l,t(this)),n.find("option").eq(a).prop("selected",s),n.trigger("change"),void 0!==e&&e()}r.stopPropagation()})}),n.wrap(s);var f=t('<span class="caret">&#9660;</span>'),v=p.replace(/"/g,"&quot;"),m=t('<input type="text" class="select-dropdown" readonly="true" '+(n.is(":disabled")?"disabled":"")+' data-activates="select-options-'+r+'" value="'+v+'"/>');n.before(m),m.before(f),m.after(l),n.is(":disabled")||m.dropdown({hover:!1}),n.attr("tabindex")&&t(m[0]).attr("tabindex",n.attr("tabindex")),n.addClass("initialized"),m.on({focus:function(){if(t("ul.select-dropdown").not(l[0]).is(":visible")&&(t("input.select-dropdown").trigger("close"),t(window).off("click.select")),!l.is(":visible")){t(this).trigger("open",["focus"]);var e=t(this).val();o&&e.indexOf(",")>=0&&(e=e.split(",")[0]);var i=l.find("li").filter(function(){return t(this).text().toLowerCase()===e.toLowerCase()})[0];g(l,i,!0),t(window).off("click.select").on("click.select",function(){o&&(d||m.trigger("close")),t(window).off("click.select")})}},click:function(t){t.stopPropagation()}}),m.on("blur",function(){o||(t(this).trigger("close"),t(window).off("click.select")),l.find("li.selected").removeClass("selected")}),l.hover(function(){d=!0},function(){d=!1}),o&&n.find("option:selected:not(:disabled)").each(function(){var t=this.index;i(u,t,n),l.find("li:not(.optgroup)").eq(t).find(":checkbox").prop("checked",!0)});var g=function(e,i,n){if(i){e.find("li.selected").removeClass("selected");var a=t(i);a.addClass("selected"),o&&!n||l.scrollTo(a)}},y=[];m.on("keydown",function(e){if(9!=e.which)if(40!=e.which||l.is(":visible")){if(13!=e.which||l.is(":visible")){e.preventDefault();var i=String.fromCharCode(e.which).toLowerCase(),n=[9,13,27,38,40];if(i&&-1===n.indexOf(e.which)){y.push(i);var a=y.join(""),r=l.find("li").filter(function(){return 0===t(this).text().toLowerCase().indexOf(a)})[0];r&&g(l,r)}if(13==e.which){var s=l.find("li.selected:not(.disabled)")[0];s&&(t(s).trigger("click"),o||m.trigger("close"))}40==e.which&&(r=l.find("li.selected").length?l.find("li.selected").next("li:not(.disabled)")[0]:l.find("li:not(.disabled)")[0],g(l,r)),27==e.which&&m.trigger("close"),38==e.which&&(r=l.find("li.selected").prev("li:not(.disabled)")[0])&&g(l,r),setTimeout(function(){y=[]},1e3)}}else m.trigger("open");else m.trigger("close")})}})}}(jQuery),function(t){var e={init:function(e){var i={indicators:!0,height:400,transition:500,interval:6e3};return e=t.extend(i,e),this.each(function(){function i(t,e){t.hasClass("center-align")?t.velocity({opacity:0,translateY:-100},{duration:e,queue:!1}):t.hasClass("right-align")?t.velocity({opacity:0,translateX:100},{duration:e,queue:!1}):t.hasClass("left-align")&&t.velocity({opacity:0,translateX:-100},{duration:e,queue:!1})}function n(t){t>=c.length?t=0:t<0&&(t=c.length-1),(u=l.find(".active").index())!=t&&(o=c.eq(u),$caption=o.find(".caption"),o.removeClass("active"),o.velocity({opacity:0},{duration:e.transition,queue:!1,easing:"easeOutQuad",complete:function(){c.not(".active").velocity({opacity:0,translateX:0,translateY:0},{duration:0,queue:!1})}}),i($caption,e.transition),e.indicators&&a.eq(u).removeClass("active"),c.eq(t).velocity({opacity:1},{duration:e.transition,queue:!1,easing:"easeOutQuad"}),c.eq(t).find(".caption").velocity({opacity:1,translateX:0,translateY:0},{duration:e.transition,delay:e.transition,queue:!1,easing:"easeOutQuad"}),c.eq(t).addClass("active"),e.indicators&&a.eq(t).addClass("active"))}var o,a,r,s=t(this),l=s.find("ul.slides").first(),c=l.find("> li"),u=l.find(".active").index();-1!=u&&(o=c.eq(u)),s.hasClass("fullscreen")||(e.indicators?s.height(e.height+40):s.height(e.height),l.height(e.height)),c.find(".caption").each(function(){i(t(this),0)}),c.find("img").each(function(){var e="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";t(this).attr("src")!==e&&(t(this).css("background-image",'url("'+t(this).attr("src")+'")'),t(this).attr("src",e))}),e.indicators&&(a=t('<ul class="indicators"></ul>'),c.each(function(i){var o=t('<li class="indicator-item"></li>');o.click(function(){n(l.parent().find(t(this)).index()),clearInterval(r),r=setInterval(function(){u=l.find(".active").index(),c.length==u+1?u=0:u+=1,n(u)},e.transition+e.interval)}),a.append(o)}),s.append(a),a=s.find("ul.indicators").find("li.indicator-item")),o?o.show():(c.first().addClass("active").velocity({opacity:1},{duration:e.transition,queue:!1,easing:"easeOutQuad"}),u=0,o=c.eq(u),e.indicators&&a.eq(u).addClass("active")),o.find("img").each(function(){o.find(".caption").velocity({opacity:1,translateX:0,translateY:0},{duration:e.transition,queue:!1,easing:"easeOutQuad"})}),r=setInterval(function(){n((u=l.find(".active").index())+1)},e.transition+e.interval);var d=!1,p=!1,h=!1;s.hammer({prevent_default:!1}).on("pan",function(t){if("touch"===t.gesture.pointerType){clearInterval(r);var e=t.gesture.direction,i=t.gesture.deltaX,n=t.gesture.velocityX,o=t.gesture.velocityY;$curr_slide=l.find(".active"),Math.abs(n)>Math.abs(o)&&$curr_slide.velocity({translateX:i},{duration:50,queue:!1,easing:"easeOutQuad"}),4===e&&(i>s.innerWidth()/2||n<-.65)?h=!0:2===e&&(i<-1*s.innerWidth()/2||n>.65)&&(p=!0);var a;p&&(0===(a=$curr_slide.next()).length&&(a=c.first()),a.velocity({opacity:1},{duration:300,queue:!1,easing:"easeOutQuad"})),h&&(0===(a=$curr_slide.prev()).length&&(a=c.last()),a.velocity({opacity:1},{duration:300,queue:!1,easing:"easeOutQuad"}))}}).on("panend",function(t){"touch"===t.gesture.pointerType&&($curr_slide=l.find(".active"),d=!1,curr_index=l.find(".active").index(),!h&&!p||c.length<=1?$curr_slide.velocity({translateX:0},{duration:300,queue:!1,easing:"easeOutQuad"}):p?(n(curr_index+1),$curr_slide.velocity({translateX:-1*s.innerWidth()},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){$curr_slide.velocity({opacity:0,translateX:0},{duration:0,queue:!1})}})):h&&(n(curr_index-1),$curr_slide.velocity({translateX:s.innerWidth()},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){$curr_slide.velocity({opacity:0,translateX:0},{duration:0,queue:!1})}})),p=!1,h=!1,clearInterval(r),r=setInterval(function(){u=l.find(".active").index(),c.length==u+1?u=0:u+=1,n(u)},e.transition+e.interval))}),s.on("sliderPause",function(){clearInterval(r)}),s.on("sliderStart",function(){clearInterval(r),r=setInterval(function(){u=l.find(".active").index(),c.length==u+1?u=0:u+=1,n(u)},e.transition+e.interval)}),s.on("sliderNext",function(){n((u=l.find(".active").index())+1)}),s.on("sliderPrev",function(){n((u=l.find(".active").index())-1)})})},pause:function(){t(this).trigger("sliderPause")},start:function(){t(this).trigger("sliderStart")},next:function(){t(this).trigger("sliderNext")},prev:function(){t(this).trigger("sliderPrev")}};t.fn.slider=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.tooltip"):e.init.apply(this,arguments)}}(jQuery),function(t){t(document).ready(function(){t(document).on("click.card",".card",function(e){if(t(this).find("> .card-reveal").length){var i=t(e.target).closest(".card");void 0===i.data("initialOverflow")&&i.data("initialOverflow",void 0===i.css("overflow")?"":i.css("overflow")),t(e.target).is(t(".card-reveal .card-title"))||t(e.target).is(t(".card-reveal .card-title i"))?t(this).find(".card-reveal").velocity({translateY:0},{duration:225,queue:!1,easing:"easeInOutQuad",complete:function(){t(this).css({display:"none"}),i.css("overflow",i.data("initialOverflow"))}}):(t(e.target).is(t(".card .activator"))||t(e.target).is(t(".card .activator i")))&&(i.css("overflow","hidden"),t(this).find(".card-reveal").css({display:"block"}).velocity("stop",!1).velocity({translateY:"-100%"},{duration:300,queue:!1,easing:"easeInOutQuad"}))}})})}(jQuery),function(t){var e={data:[],placeholder:"",secondaryPlaceholder:"",autocompleteOptions:{}};t(document).ready(function(){t(document).on("click",".chip .close",function(e){t(this).closest(".chips").attr("data-initialized")||t(this).closest(".chip").remove()})}),t.fn.material_chip=function(i){var n=this;if(this.$el=t(this),this.$document=t(document),this.SELS={CHIPS:".chips",CHIP:".chip",INPUT:"input",DELETE:".material-icons",SELECTED_CHIP:".selected"},"data"===i)return this.$el.data("chips");var o=t.extend({},e,i);n.hasAutocomplete=!t.isEmptyObject(o.autocompleteOptions.data),this.init=function(){var e=0;n.$el.each(function(){var i=t(this),a=Materialize.guid();n.chipId=a,o.data&&o.data instanceof Array||(o.data=[]),i.data("chips",o.data),i.attr("data-index",e),i.attr("data-initialized",!0),i.hasClass(n.SELS.CHIPS)||i.addClass("chips"),n.chips(i,a),e++})},this.handleEvents=function(){var e=n.SELS;n.$document.off("click.chips-focus",e.CHIPS).on("click.chips-focus",e.CHIPS,function(i){t(i.target).find(e.INPUT).focus()}),n.$document.off("click.chips-select",e.CHIP).on("click.chips-select",e.CHIP,function(i){var o=t(i.target);if(o.length){var a=o.hasClass("selected"),r=o.closest(e.CHIPS);t(e.CHIP).removeClass("selected"),a||n.selectChip(o.index(),r)}}),n.$document.off("keydown.chips").on("keydown.chips",function(i){if(!t(i.target).is("input, textarea")){var o,a=n.$document.find(e.CHIP+e.SELECTED_CHIP),r=a.closest(e.CHIPS),s=a.siblings(e.CHIP).length;if(a.length)if(8===i.which||46===i.which){i.preventDefault(),o=a.index(),n.deleteChip(o,r);var l=null;o+1<s?l=o:o!==s&&o+1!==s||(l=s-1),l<0&&(l=null),null!==l&&n.selectChip(l,r),s||r.find("input").focus()}else if(37===i.which){if((o=a.index()-1)<0)return;t(e.CHIP).removeClass("selected"),n.selectChip(o,r)}else if(39===i.which){if(o=a.index()+1,t(e.CHIP).removeClass("selected"),o>s)return void r.find("input").focus();n.selectChip(o,r)}}}),n.$document.off("focusin.chips",e.CHIPS+" "+e.INPUT).on("focusin.chips",e.CHIPS+" "+e.INPUT,function(i){var n=t(i.target).closest(e.CHIPS);n.addClass("focus"),n.siblings("label, .prefix").addClass("active"),t(e.CHIP).removeClass("selected")}),n.$document.off("focusout.chips",e.CHIPS+" "+e.INPUT).on("focusout.chips",e.CHIPS+" "+e.INPUT,function(i){var n=t(i.target).closest(e.CHIPS);n.removeClass("focus"),void 0!==n.data("chips")&&n.data("chips").length||n.siblings("label").removeClass("active"),n.siblings(".prefix").removeClass("active")}),n.$document.off("keydown.chips-add",e.CHIPS+" "+e.INPUT).on("keydown.chips-add",e.CHIPS+" "+e.INPUT,function(i){var o=t(i.target),a=o.closest(e.CHIPS),r=a.children(e.CHIP).length;if(13===i.which){if(n.hasAutocomplete&&a.find(".autocomplete-content.dropdown-content").length&&a.find(".autocomplete-content.dropdown-content").children().length)return;return i.preventDefault(),n.addChip({tag:o.val()},a),void o.val("")}if((8===i.keyCode||37===i.keyCode)&&""===o.val()&&r)return i.preventDefault(),n.selectChip(r-1,a),void o.blur()}),n.$document.off("click.chips-delete",e.CHIPS+" "+e.DELETE).on("click.chips-delete",e.CHIPS+" "+e.DELETE,function(i){var o=t(i.target),a=o.closest(e.CHIPS),r=o.closest(e.CHIP);i.stopPropagation(),n.deleteChip(r.index(),a),a.find("input").focus()})},this.chips=function(e,i){e.empty(),e.data("chips").forEach(function(t){e.append(n.renderChip(t))}),e.append(t('<input id="'+i+'" class="input" placeholder="">')),n.setPlaceholder(e);var a=e.next("label");a.length&&(a.attr("for",i),void 0!==e.data("chips")&&e.data("chips").length&&a.addClass("active"));var r=t("#"+i);n.hasAutocomplete&&(o.autocompleteOptions.onAutocomplete=function(t){n.addChip({tag:t},e),r.val(""),r.focus()},r.autocomplete(o.autocompleteOptions))},this.renderChip=function(e){if(e.tag){var i=t('<div class="chip"></div>');return i.text(e.tag),e.image&&i.prepend(t("<img />").attr("src",e.image)),i.append(t('<i class="material-icons close">close</i>')),i}},this.setPlaceholder=function(t){void 0!==t.data("chips")&&!t.data("chips").length&&o.placeholder?t.find("input").prop("placeholder",o.placeholder):(void 0===t.data("chips")||t.data("chips").length)&&o.secondaryPlaceholder&&t.find("input").prop("placeholder",o.secondaryPlaceholder)},this.isValid=function(t,e){for(var i=t.data("chips"),n=!1,o=0;o<i.length;o++)if(i[o].tag===e.tag)return void(n=!0);return""!==e.tag&&!n},this.addChip=function(t,e){if(n.isValid(e,t)){for(var i=n.renderChip(t),o=[],a=e.data("chips"),r=0;r<a.length;r++)o.push(a[r]);o.push(t),e.data("chips",o),i.insertBefore(e.find("input")),e.trigger("chip.add",t),n.setPlaceholder(e)}},this.deleteChip=function(t,e){var i=e.data("chips")[t];e.find(".chip").eq(t).remove();for(var o=[],a=e.data("chips"),r=0;r<a.length;r++)r!==t&&o.push(a[r]);e.data("chips",o),e.trigger("chip.delete",i),n.setPlaceholder(e)},this.selectChip=function(t,e){var i=e.find(".chip").eq(t);i&&!1===i.hasClass("selected")&&(i.addClass("selected"),e.trigger("chip.select",e.data("chips")[t]))},this.getChipsElement=function(t,e){return e.eq(t)},this.init(),this.handleEvents()}}(jQuery),function(t){t.fn.pushpin=function(e){var i={top:0,bottom:1/0,offset:0};return"remove"===e?(this.each(function(){(id=t(this).data("pushpin-id"))&&(t(window).off("scroll."+id),t(this).removeData("pushpin-id").removeClass("pin-top pinned pin-bottom").removeAttr("style"))}),!1):(e=t.extend(i,e),$index=0,this.each(function(){function i(t){t.removeClass("pin-top"),t.removeClass("pinned"),t.removeClass("pin-bottom")}function n(n,o){n.each(function(){e.top<=o&&e.bottom>=o&&!t(this).hasClass("pinned")&&(i(t(this)),t(this).css("top",e.offset),t(this).addClass("pinned")),o<e.top&&!t(this).hasClass("pin-top")&&(i(t(this)),t(this).css("top",0),t(this).addClass("pin-top")),o>e.bottom&&!t(this).hasClass("pin-bottom")&&(i(t(this)),t(this).addClass("pin-bottom"),t(this).css("top",e.bottom-r))})}var o=Materialize.guid(),a=t(this),r=t(this).offset().top;t(this).data("pushpin-id",o),n(a,t(window).scrollTop()),t(window).on("scroll."+o,function(){var i=t(window).scrollTop()+e.offset;n(a,i)})}))}}(jQuery),function(t){t(document).ready(function(){t.fn.reverse=[].reverse,t(document).on("mouseenter.fixedActionBtn",".fixed-action-btn:not(.click-to-toggle):not(.toolbar)",function(i){var n=t(this);e(n)}),t(document).on("mouseleave.fixedActionBtn",".fixed-action-btn:not(.click-to-toggle):not(.toolbar)",function(e){var n=t(this);i(n)}),t(document).on("click.fabClickToggle",".fixed-action-btn.click-to-toggle > a",function(n){var o=t(this).parent();o.hasClass("active")?i(o):e(o)}),t(document).on("click.fabToolbar",".fixed-action-btn.toolbar > a",function(e){var i=t(this).parent();n(i)})}),t.fn.extend({openFAB:function(){e(t(this))},closeFAB:function(){i(t(this))},openToolbar:function(){n(t(this))},closeToolbar:function(){o(t(this))}});var e=function(e){var i=e;if(!1===i.hasClass("active")){var n,o;!0===i.hasClass("horizontal")?o=40:n=40,i.addClass("active"),i.find("ul .btn-floating").velocity({scaleY:".4",scaleX:".4",translateY:n+"px",translateX:o+"px"},{duration:0});var a=0;i.find("ul .btn-floating").reverse().each(function(){t(this).velocity({opacity:"1",scaleX:"1",scaleY:"1",translateY:"0",translateX:"0"},{duration:80,delay:a}),a+=40})}},i=function(t){var e,i,n=t;!0===n.hasClass("horizontal")?i=40:e=40,n.removeClass("active");n.find("ul .btn-floating").velocity("stop",!0),n.find("ul .btn-floating").velocity({opacity:"0",scaleX:".4",scaleY:".4",translateY:e+"px",translateX:i+"px"},{duration:80})},n=function(e){if("true"!==e.attr("data-open")){var i,n,a,r=window.innerWidth,s=window.innerHeight,l=e[0].getBoundingClientRect(),c=e.find("> a").first(),u=e.find("> ul").first(),d=t('<div class="fab-backdrop"></div>'),p=c.css("background-color");c.append(d),i=l.left-r/2+l.width/2,n=s-l.bottom,a=r/d.width(),e.attr("data-origin-bottom",l.bottom),e.attr("data-origin-left",l.left),e.attr("data-origin-width",l.width),e.addClass("active"),e.attr("data-open",!0),e.css({"text-align":"center",width:"100%",bottom:0,left:0,transform:"translateX("+i+"px)",transition:"none"}),c.css({transform:"translateY("+-n+"px)",transition:"none"}),d.css({"background-color":p}),setTimeout(function(){e.css({transform:"",transition:"transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s"}),c.css({overflow:"visible",transform:"",transition:"transform .2s"}),setTimeout(function(){e.css({overflow:"hidden","background-color":p}),d.css({transform:"scale("+a+")",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"}),u.find("> li > a").css({opacity:1}),t(window).on("scroll.fabToolbarClose",function(){o(e),t(window).off("scroll.fabToolbarClose"),t(document).off("click.fabToolbarClose")}),t(document).on("click.fabToolbarClose",function(i){t(i.target).closest(u).length||(o(e),t(window).off("scroll.fabToolbarClose"),t(document).off("click.fabToolbarClose"))})},100)},0)}},o=function(t){if("true"===t.attr("data-open")){var e,i,n=window.innerWidth,o=window.innerHeight,a=t.attr("data-origin-width"),r=t.attr("data-origin-bottom"),s=t.attr("data-origin-left"),l=t.find("> .btn-floating").first(),c=t.find("> ul").first(),u=t.find(".fab-backdrop"),d=l.css("background-color");e=s-n/2+a/2,i=o-r,n/u.width(),t.removeClass("active"),t.attr("data-open",!1),t.css({"background-color":"transparent",transition:"none"}),l.css({transition:"none"}),u.css({transform:"scale(0)","background-color":d}),c.find("> li > a").css({opacity:""}),setTimeout(function(){u.remove(),t.css({"text-align":"",width:"",bottom:"",left:"",overflow:"","background-color":"",transform:"translate3d("+-e+"px,0,0)"}),l.css({overflow:"",transform:"translate3d(0,"+i+"px,0)"}),setTimeout(function(){t.css({transform:"translate3d(0,0,0)",transition:"transform .2s"}),l.css({transform:"translate3d(0,0,0)",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"})},20)},200)}}}(jQuery),function(t){Materialize.fadeInImage=function(e){var i;if("string"==typeof e)i=t(e);else{if("object"!=typeof e)return;i=e}i.css({opacity:0}),t(i).velocity({opacity:1},{duration:650,queue:!1,easing:"easeOutSine"}),t(i).velocity({opacity:1},{duration:1300,queue:!1,easing:"swing",step:function(e,i){i.start=100;var n=e/100,o=150-(100-e)/1.75;o<100&&(o=100),e>=0&&t(this).css({"-webkit-filter":"grayscale("+n+")brightness("+o+"%)",filter:"grayscale("+n+")brightness("+o+"%)"})}})},Materialize.showStaggeredList=function(e){var i;if("string"==typeof e)i=t(e);else{if("object"!=typeof e)return;i=e}var n=0;i.find("li").velocity({translateX:"-100px"},{duration:0}),i.find("li").each(function(){t(this).velocity({opacity:"1",translateX:"0"},{duration:800,delay:n,easing:[60,10]}),n+=120})},t(document).ready(function(){var e=!1,i=!1;t(".dismissable").each(function(){t(this).hammer({prevent_default:!1}).on("pan",function(n){if("touch"===n.gesture.pointerType){var o=t(this),a=n.gesture.direction,r=n.gesture.deltaX,s=n.gesture.velocityX;o.velocity({translateX:r},{duration:50,queue:!1,easing:"easeOutQuad"}),4===a&&(r>o.innerWidth()/2||s<-.75)&&(e=!0),2===a&&(r<-1*o.innerWidth()/2||s>.75)&&(i=!0)}}).on("panend",function(n){if(Math.abs(n.gesture.deltaX)<t(this).innerWidth()/2&&(i=!1,e=!1),"touch"===n.gesture.pointerType){var o=t(this);if(e||i){var a;a=e?o.innerWidth():-1*o.innerWidth(),o.velocity({translateX:a},{duration:100,queue:!1,easing:"easeOutQuad",complete:function(){o.css("border","none"),o.velocity({height:0,padding:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){o.remove()}})}})}else o.velocity({translateX:0},{duration:100,queue:!1,easing:"easeOutQuad"});e=!1,i=!1}})})})}(jQuery),function(t){var e=!1;Materialize.scrollFire=function(t){var i=function(){for(var e=window.pageYOffset+window.innerHeight,i=0;i<t.length;i++){var n=t[i],o=n.selector,a=n.offset,r=n.callback,s=document.querySelector(o);null!==s&&e>s.getBoundingClientRect().top+window.pageYOffset+a&&!0!==n.done&&("function"==typeof r?r.call(this,s):"string"==typeof r&&new Function(r)(s),n.done=!0)}},n=Materialize.throttle(function(){i()},t.throttle||100);e||(window.addEventListener("scroll",n),window.addEventListener("resize",n),e=!0),setTimeout(n,0)}}(jQuery),function(t){Materialize.Picker=t(jQuery)}(function(t){function e(a,s,u,d){function p(){return e._.node("div",e._.node("div",e._.node("div",e._.node("div",T.component.nodes(b.open),k.box),k.wrap),k.frame),k.holder)}function h(){x.data(s,T).addClass(k.input).attr("tabindex",-1).val(x.data("value")?T.get("select",w.format):a.value),w.editable||x.on("focus."+b.id+" click."+b.id,function(t){t.preventDefault(),T.$root.eq(0).focus()}).on("keydown."+b.id,m),o(a,{haspopup:!0,expanded:!1,readonly:!1,owns:a.id+"_root"})}function f(){T.$root.on({keydown:m,focusin:function(t){T.$root.removeClass(k.focused),t.stopPropagation()},"mousedown click":function(e){var i=e.target;i!=T.$root.children()[0]&&(e.stopPropagation(),"mousedown"!=e.type||t(i).is("input, select, textarea, button, option")||(e.preventDefault(),T.$root.eq(0).focus()))}}).on({focus:function(){x.addClass(k.target)},blur:function(){x.removeClass(k.target)}}).on("focus.toOpen",g).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var e=t(this),i=e.data(),n=e.hasClass(k.navDisabled)||e.hasClass(k.disabled),o=r();o=o&&(o.type||o.href)&&o,(n||o&&!t.contains(T.$root[0],o))&&T.$root.eq(0).focus(),!n&&i.nav?T.set("highlight",T.component.item.highlight,{nav:i.nav}):!n&&"pick"in i?(T.set("select",i.pick),w.closeOnSelect&&T.close(!0)):i.clear?(T.clear(),w.closeOnSelect&&T.close(!0)):i.close&&T.close(!0)}),o(T.$root[0],"hidden",!0)}function v(){var e;!0===w.hiddenName?(e=a.name,a.name=""):e=(e=["string"==typeof w.hiddenPrefix?w.hiddenPrefix:"","string"==typeof w.hiddenSuffix?w.hiddenSuffix:"_submit"])[0]+a.name+e[1],T._hidden=t('<input type=hidden name="'+e+'"'+(x.data("value")||a.value?' value="'+T.get("select",w.formatSubmit)+'"':"")+">")[0],x.on("change."+b.id,function(){T._hidden.value=a.value?T.get("select",w.formatSubmit):""}),w.container?t(w.container).append(T._hidden):x.before(T._hidden)}function m(t){var e=t.keyCode,i=/^(8|46)$/.test(e);if(27==e)return T.close(),!1;(32==e||i||!b.open&&T.component.key[e])&&(t.preventDefault(),t.stopPropagation(),i?T.clear().close():T.open())}function g(t){t.stopPropagation(),"focus"==t.type&&T.$root.addClass(k.focused),T.open()}if(!a)return e;var y=!1,b={id:a.id||"P"+Math.abs(~~(Math.random()*new Date))},w=u?t.extend(!0,{},u.defaults,d):d||{},k=t.extend({},e.klasses(),w.klass),x=t(a),C=function(){return this.start()},T=C.prototype={constructor:C,$node:x,start:function(){return b&&b.start?T:(b.methods={},b.start=!0,b.open=!1,b.type=a.type,a.autofocus=a==r(),a.readOnly=!w.editable,a.id=a.id||b.id,"text"!=a.type&&(a.type="text"),T.component=new u(T,w),T.$root=t(e._.node("div",p(),k.picker,'id="'+a.id+'_root" tabindex="0"')),f(),w.formatSubmit&&v(),h(),w.container?t(w.container).append(T.$root):x.before(T.$root),T.on({start:T.component.onStart,render:T.component.onRender,stop:T.component.onStop,open:T.component.onOpen,close:T.component.onClose,set:T.component.onSet}).on({start:w.onStart,render:w.onRender,stop:w.onStop,open:w.onOpen,close:w.onClose,set:w.onSet}),y=i(T.$root.children()[0]),a.autofocus&&T.open(),T.trigger("start").trigger("render"))},render:function(t){return t?T.$root.html(p()):T.$root.find("."+k.box).html(T.component.nodes(b.open)),T.trigger("render")},stop:function(){return b.start?(T.close(),T._hidden&&T._hidden.parentNode.removeChild(T._hidden),T.$root.remove(),x.removeClass(k.input).removeData(s),setTimeout(function(){x.off("."+b.id)},0),a.type=b.type,a.readOnly=!1,T.trigger("stop"),b.methods={},b.start=!1,T):T},open:function(i){return b.open?T:(x.addClass(k.active),o(a,"expanded",!0),setTimeout(function(){T.$root.addClass(k.opened),o(T.$root[0],"hidden",!1)},0),!1!==i&&(b.open=!0,y&&c.css("overflow","hidden").css("padding-right","+="+n()),T.$root.eq(0).focus(),l.on("click."+b.id+" focusin."+b.id,function(t){var e=t.target;e!=a&&e!=document&&3!=t.which&&T.close(e===T.$root.children()[0])}).on("keydown."+b.id,function(i){var n=i.keyCode,o=T.component.key[n],a=i.target;27==n?T.close(!0):a!=T.$root[0]||!o&&13!=n?t.contains(T.$root[0],a)&&13==n&&(i.preventDefault(),a.click()):(i.preventDefault(),o?e._.trigger(T.component.key.go,T,[e._.trigger(o)]):T.$root.find("."+k.highlighted).hasClass(k.disabled)||(T.set("select",T.component.item.highlight),w.closeOnSelect&&T.close(!0)))})),T.trigger("open"))},close:function(t){return t&&(T.$root.off("focus.toOpen").eq(0).focus(),setTimeout(function(){T.$root.on("focus.toOpen",g)},0)),x.removeClass(k.active),o(a,"expanded",!1),setTimeout(function(){T.$root.removeClass(k.opened+" "+k.focused),o(T.$root[0],"hidden",!0)},0),b.open?(b.open=!1,y&&c.css("overflow","").css("padding-right","-="+n()),l.off("."+b.id),T.trigger("close")):T},clear:function(t){return T.set("clear",null,t)},set:function(e,i,n){var o,a,r=t.isPlainObject(e),s=r?e:{};if(n=r&&t.isPlainObject(i)?i:n||{},e){r||(s[e]=i);for(o in s)a=s[o],o in T.component.item&&(void 0===a&&(a=null),T.component.set(o,a,n)),"select"!=o&&"clear"!=o||x.val("clear"==o?"":T.get(o,w.format)).trigger("change");T.render()}return n.muted?T:T.trigger("set",s)},get:function(t,i){if(t=t||"value",null!=b[t])return b[t];if("valueSubmit"==t){if(T._hidden)return T._hidden.value;t="value"}if("value"==t)return a.value;if(t in T.component.item){if("string"==typeof i){var n=T.component.get(t);return n?e._.trigger(T.component.formats.toString,T.component,[i,n]):""}return T.component.get(t)}},on:function(e,i,n){var o,a,r=t.isPlainObject(e),s=r?e:{};if(e){r||(s[e]=i);for(o in s)a=s[o],n&&(o="_"+o),b.methods[o]=b.methods[o]||[],b.methods[o].push(a)}return T},off:function(){var t,e,i=arguments;for(t=0,namesCount=i.length;t<namesCount;t+=1)(e=i[t])in b.methods&&delete b.methods[e];return T},trigger:function(t,i){var n=function(t){var n=b.methods[t];n&&n.map(function(t){e._.trigger(t,T,[i])})};return n("_"+t),n(t),T}};return new C}function i(t){var e;return t.currentStyle?e=t.currentStyle.position:window.getComputedStyle&&(e=getComputedStyle(t).position),"fixed"==e}function n(){if(c.height()<=s.height())return 0;var e=t('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=e[0].offsetWidth;e.css("overflow","scroll");var n=t('<div style="width:100%" />').appendTo(e)[0].offsetWidth;return e.remove(),i-n}function o(e,i,n){if(t.isPlainObject(i))for(var o in i)a(e,o,i[o]);else a(e,i,n)}function a(t,e,i){t.setAttribute(("role"==e?"":"aria-")+e,i)}function r(){try{return document.activeElement}catch(t){}}var s=t(window),l=t(document),c=t(document.documentElement);return e.klasses=function(t){return t=t||"picker",{picker:t,opened:t+"--opened",focused:t+"--focused",input:t+"__input",active:t+"__input--active",target:t+"__input--target",holder:t+"__holder",frame:t+"__frame",wrap:t+"__wrap",box:t+"__box"}},e._={group:function(t){for(var i,n="",o=e._.trigger(t.min,t);o<=e._.trigger(t.max,t,[o]);o+=t.i)i=e._.trigger(t.item,t,[o]),n+=e._.node(t.node,i[0],i[1],i[2]);return n},node:function(e,i,n,o){return i?(i=t.isArray(i)?i.join(""):i,n=n?' class="'+n+'"':"",o=o?" "+o:"","<"+e+n+o+">"+i+"</"+e+">"):""},lead:function(t){return(t<10?"0":"")+t},trigger:function(t,e,i){return"function"==typeof t?t.apply(e,i||[]):t},digits:function(t){return/\d/.test(t[1])?2:1},isDate:function(t){return{}.toString.call(t).indexOf("Date")>-1&&this.isInteger(t.getDate())},isInteger:function(t){return{}.toString.call(t).indexOf("Number")>-1&&t%1==0},ariaAttr:function(e,i){t.isPlainObject(e)||(e={attribute:i}),i="";for(var n in e){var o=("role"==n?"":"aria-")+n;i+=null==e[n]?"":o+'="'+e[n]+'"'}return i}},e.extend=function(i,n){t.fn[i]=function(o,a){var r=this.data(i);return"picker"==o?r:r&&"string"==typeof o?e._.trigger(r[o],r,[a]):this.each(function(){t(this).data(i)||new e(this,i,n,o)})},t.fn[i].defaults=n.defaults},e}),function(t){t(Materialize.Picker,jQuery)}(function(t,e){function i(t,e){var i=this,n=t.$node[0],o=n.value,a=t.$node.data("value"),r=a||o,s=a?e.formatSubmit:e.format,l=function(){return n.currentStyle?"rtl"==n.currentStyle.direction:"rtl"==getComputedStyle(t.$root[0]).direction};i.settings=e,i.$node=t.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(e.disable||[]).slice(0),i.item.enable=-function(t){return!0===t[0]?t.shift():-1}(i.item.disable),i.set("min",e.min).set("max",e.max).set("now"),r?i.set("select",r,{format:s}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(t){var e=i.item.highlight,n=new Date(e.year,e.month,e.date+t);i.set("highlight",n,{interval:t}),this.render()}},t.on("render",function(){t.$root.find("."+e.klass.selectMonth).on("change",function(){var i=this.value;i&&(t.set("highlight",[t.get("view").year,i,t.get("highlight").date]),t.$root.find("."+e.klass.selectMonth).trigger("focus"))}),t.$root.find("."+e.klass.selectYear).on("change",function(){var i=this.value;i&&(t.set("highlight",[i,t.get("view").month,t.get("highlight").date]),t.$root.find("."+e.klass.selectYear).trigger("focus"))})},1).on("open",function(){var n="";i.disabled(i.get("now"))&&(n=":not(."+e.klass.buttonToday+")"),t.$root.find("button"+n+", select").attr("disabled",!1)},1).on("close",function(){t.$root.find("button, select").attr("disabled",!0)},1)}var n=t._;i.prototype.set=function(t,e,i){var n=this,o=n.item;return null===e?("clear"==t&&(t="select"),o[t]=e,n):(o["enable"==t?"disable":"flip"==t?"enable":t]=n.queue[t].split(" ").map(function(o){return e=n[o](t,e,i)}).pop(),"select"==t?n.set("highlight",o.select,i):"highlight"==t?n.set("view",o.highlight,i):t.match(/^(flip|min|max|disable|enable)$/)&&(o.select&&n.disabled(o.select)&&n.set("select",o.select,i),o.highlight&&n.disabled(o.highlight)&&n.set("highlight",o.highlight,i)),n)},i.prototype.get=function(t){return this.item[t]},i.prototype.create=function(t,i,o){var a,r=this;return i=void 0===i?t:i,i==-1/0||i==1/0?a=i:e.isPlainObject(i)&&n.isInteger(i.pick)?i=i.obj:e.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=n.isDate(i)?i:r.create().obj):i=n.isInteger(i)||n.isDate(i)?r.normalize(new Date(i),o):r.now(t,i,o),{year:a||i.getFullYear(),month:a||i.getMonth(),date:a||i.getDate(),day:a||i.getDay(),obj:a||i,pick:a||i.getTime()}},i.prototype.createRange=function(t,i){var o=this,a=function(t){return!0===t||e.isArray(t)||n.isDate(t)?o.create(t):t};return n.isInteger(t)||(t=a(t)),n.isInteger(i)||(i=a(i)),n.isInteger(t)&&e.isPlainObject(i)?t=[i.year,i.month,i.date+t]:n.isInteger(i)&&e.isPlainObject(t)&&(i=[t.year,t.month,t.date+i]),{from:a(t),to:a(i)}},i.prototype.withinRange=function(t,e){return t=this.createRange(t.from,t.to),e.pick>=t.from.pick&&e.pick<=t.to.pick},i.prototype.overlapRanges=function(t,e){var i=this;return t=i.createRange(t.from,t.to),e=i.createRange(e.from,e.to),i.withinRange(t,e.from)||i.withinRange(t,e.to)||i.withinRange(e,t.from)||i.withinRange(e,t.to)},i.prototype.now=function(t,e,i){return e=new Date,i&&i.rel&&e.setDate(e.getDate()+i.rel),this.normalize(e,i)},i.prototype.navigate=function(t,i,n){var o,a,r,s,l=e.isArray(i),c=e.isPlainObject(i),u=this.item.view;if(l||c){for(c?(a=i.year,r=i.month,s=i.date):(a=+i[0],r=+i[1],s=+i[2]),n&&n.nav&&u&&u.month!==r&&(a=u.year,r=u.month),a=(o=new Date(a,r+(n&&n.nav?n.nav:0),1)).getFullYear(),r=o.getMonth();new Date(a,r,s).getMonth()!==r;)s-=1;i=[a,r,s]}return i},i.prototype.normalize=function(t){return t.setHours(0,0,0,0),t},i.prototype.measure=function(t,e){var i=this;return e?"string"==typeof e?e=i.parse(t,e):n.isInteger(e)&&(e=i.now(t,e,{rel:e})):e="min"==t?-1/0:1/0,e},i.prototype.viewset=function(t,e){return this.create([e.year,e.month,1])},i.prototype.validate=function(t,i,o){var a,r,s,l,c=this,u=i,d=o&&o.interval?o.interval:1,p=-1===c.item.enable,h=c.item.min,f=c.item.max,v=p&&c.item.disable.filter(function(t){if(e.isArray(t)){var o=c.create(t).pick;o<i.pick?a=!0:o>i.pick&&(r=!0)}return n.isInteger(t)}).length;if((!o||!o.nav)&&(!p&&c.disabled(i)||p&&c.disabled(i)&&(v||a||r)||!p&&(i.pick<=h.pick||i.pick>=f.pick)))for(p&&!v&&(!r&&d>0||!a&&d<0)&&(d*=-1);c.disabled(i)&&(Math.abs(d)>1&&(i.month<u.month||i.month>u.month)&&(i=u,d=d>0?1:-1),i.pick<=h.pick?(s=!0,d=1,i=c.create([h.year,h.month,h.date+(i.pick===h.pick?0:-1)])):i.pick>=f.pick&&(l=!0,d=-1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(t){var i=this,o=i.item.disable.filter(function(o){return n.isInteger(o)?t.day===(i.settings.firstDay?o:o-1)%7:e.isArray(o)||n.isDate(o)?t.pick===i.create(o).pick:e.isPlainObject(o)?i.withinRange(o,t):void 0});return o=o.length&&!o.filter(function(t){return e.isArray(t)&&"inverted"==t[3]||e.isPlainObject(t)&&t.inverted}).length,-1===i.item.enable?!o:o||t.pick<i.item.min.pick||t.pick>i.item.max.pick},i.prototype.parse=function(t,e,i){var o=this,a={};return e&&"string"==typeof e?(i&&i.format||((i=i||{}).format=o.settings.format),o.formats.toArray(i.format).map(function(t){var i=o.formats[t],r=i?n.trigger(i,o,[e,a]):t.replace(/^!/,"").length;i&&(a[t]=e.substr(0,r)),e=e.substr(r)}),[a.yyyy||a.yy,+(a.mm||a.m)-1,a.dd||a.d]):e},i.prototype.formats=function(){function t(t,e,i){var n=t.match(/\w+/)[0];return i.mm||i.m||(i.m=e.indexOf(n)+1),n.length}function e(t){return t.match(/\w+/)[0].length}return{d:function(t,e){return t?n.digits(t):e.date},dd:function(t,e){return t?2:n.lead(e.date)},ddd:function(t,i){return t?e(t):this.settings.weekdaysShort[i.day]},dddd:function(t,i){return t?e(t):this.settings.weekdaysFull[i.day]},m:function(t,e){return t?n.digits(t):e.month+1},mm:function(t,e){return t?2:n.lead(e.month+1)},mmm:function(e,i){var n=this.settings.monthsShort;return e?t(e,n,i):n[i.month]},mmmm:function(e,i){var n=this.settings.monthsFull;return e?t(e,n,i):n[i.month]},yy:function(t,e){return t?2:(""+e.year).slice(2)},yyyy:function(t,e){return t?4:e.year},toArray:function(t){return t.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(t,e){var i=this;return i.formats.toArray(t).map(function(t){return n.trigger(i.formats[t],i,[0,e])||t.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(t,i){var o=this;return n.isInteger(t)&&n.isInteger(i)||"boolean"==typeof t&&"boolean"==typeof i?t===i:(n.isDate(t)||e.isArray(t))&&(n.isDate(i)||e.isArray(i))?o.create(t).pick===o.create(i).pick:!(!e.isPlainObject(t)||!e.isPlainObject(i))&&(o.isDateExact(t.from,i.from)&&o.isDateExact(t.to,i.to))},i.prototype.isDateOverlap=function(t,i){var o=this,a=o.settings.firstDay?1:0;return n.isInteger(t)&&(n.isDate(i)||e.isArray(i))?(t=t%7+a)===o.create(i).day+1:n.isInteger(i)&&(n.isDate(t)||e.isArray(t))?(i=i%7+a)===o.create(t).day+1:!(!e.isPlainObject(t)||!e.isPlainObject(i))&&o.overlapRanges(t,i)},i.prototype.flipEnable=function(t){var e=this.item;e.enable=t||(-1==e.enable?1:-1)},i.prototype.deactivate=function(t,i){var o=this,a=o.item.disable.slice(0);return"flip"==i?o.flipEnable():!1===i?(o.flipEnable(1),a=[]):!0===i?(o.flipEnable(-1),a=[]):i.map(function(t){for(var i,r=0;r<a.length;r+=1)if(o.isDateExact(t,a[r])){i=!0;break}i||(n.isInteger(t)||n.isDate(t)||e.isArray(t)||e.isPlainObject(t)&&t.from&&t.to)&&a.push(t)}),a},i.prototype.activate=function(t,i){var o=this,a=o.item.disable,r=a.length;return"flip"==i?o.flipEnable():!0===i?(o.flipEnable(1),a=[]):!1===i?(o.flipEnable(-1),a=[]):i.map(function(t){var i,s,l,c;for(l=0;l<r;l+=1){if(s=a[l],o.isDateExact(s,t)){i=a[l]=null,c=!0;break}if(o.isDateOverlap(s,t)){e.isPlainObject(t)?(t.inverted=!0,i=t):e.isArray(t)?(i=t)[3]||i.push("inverted"):n.isDate(t)&&(i=[t.getFullYear(),t.getMonth(),t.getDate(),"inverted"]);break}}if(i)for(l=0;l<r;l+=1)if(o.isDateExact(a[l],t)){a[l]=null;break}if(c)for(l=0;l<r;l+=1)if(o.isDateOverlap(a[l],t)){a[l]=null;break}i&&a.push(i)}),a.filter(function(t){return null!=t})},i.prototype.nodes=function(t){var e=this,i=e.settings,o=e.item,a=o.now,r=o.select,s=o.highlight,l=o.view,c=o.disable,u=o.min,d=o.max,p=function(t,e){return i.firstDay&&(t.push(t.shift()),e.push(e.shift())),n.node("thead",n.node("tr",n.group({min:0,max:6,i:1,node:"th",item:function(n){return[t[n],i.klass.weekdays,'scope=col title="'+e[n]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysLetter).slice(0),i.weekdaysFull.slice(0)),h=function(t){return n.node("div"," ",i.klass["nav"+(t?"Next":"Prev")]+(t&&l.year>=d.year&&l.month>=d.month||!t&&l.year<=u.year&&l.month<=u.month?" "+i.klass.navDisabled:""),"data-nav="+(t||-1)+" "+n.ariaAttr({role:"button",controls:e.$node[0].id+"_table"})+' title="'+(t?i.labelMonthNext:i.labelMonthPrev)+'"')},f=function(o){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return"short_months"==o&&(a=i.monthsShort),i.selectMonths&&void 0==o?n.node("select",n.group({min:0,max:11,i:1,node:"option",item:function(t){return[a[t],0,"value="+t+(l.month==t?" selected":"")+(l.year==u.year&&t<u.month||l.year==d.year&&t>d.month?" disabled":"")]}}),i.klass.selectMonth+" browser-default",(t?"":"disabled")+" "+n.ariaAttr({controls:e.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):"short_months"==o?null!=r?a[r.month]:a[l.month]:n.node("div",a[l.month],i.klass.month)},v=function(o){var a=l.year,s=!0===i.selectYears?5:~~(i.selectYears/2);if(s){var c=u.year,p=d.year,h=a-s,f=a+s;if(c>h&&(f+=c-h,h=c),p<f){var v=h-c,m=f-p;h-=v>m?m:v,f=p}if(i.selectYears&&void 0==o)return n.node("select",n.group({min:h,max:f,i:1,node:"option",item:function(t){return[t,0,"value="+t+(a==t?" selected":"")]}}),i.klass.selectYear+" browser-default",(t?"":"disabled")+" "+n.ariaAttr({controls:e.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return"raw"===o&&null!=r?n.node("div",r.year):n.node("div",a,i.klass.year)};return createDayLabel=function(){return null!=r?r.date:a.date},createWeekdayLabel=function(){var t;return t=null!=r?r.day:a.day,i.weekdaysShort[t]},n.node("div",n.node("div",v("raw"),i.klass.year_display)+n.node("span",createWeekdayLabel()+", ","picker__weekday-display")+n.node("span",f("short_months")+" ",i.klass.month_display)+n.node("span",createDayLabel(),i.klass.day_display),i.klass.date_display)+n.node("div",n.node("div",n.node("div",(i.selectYears,f()+v()+h()+h(1)),i.klass.header)+n.node("table",p+n.node("tbody",n.group({min:0,max:5,i:1,node:"tr",item:function(t){var o=i.firstDay&&0===e.create([l.year,l.month,1]).day?-7:0;return[n.group({min:7*t-l.day+o+1,max:function(){return this.min+7-1},i:1,node:"td",item:function(t){t=e.create([l.year,l.month,t+(i.firstDay?1:0)]);var o=r&&r.pick==t.pick,p=s&&s.pick==t.pick,h=c&&e.disabled(t)||t.pick<u.pick||t.pick>d.pick,f=n.trigger(e.formats.toString,e,[i.format,t]);return[n.node("div",t.date,function(e){return e.push(l.month==t.month?i.klass.infocus:i.klass.outfocus),a.pick==t.pick&&e.push(i.klass.now),o&&e.push(i.klass.selected),p&&e.push(i.klass.highlighted),h&&e.push(i.klass.disabled),e.join(" ")}([i.klass.day]),"data-pick="+t.pick+" "+n.ariaAttr({role:"gridcell",label:f,selected:!(!o||e.$node.val()!==f)||null,activedescendant:!!p||null,disabled:!!h||null})+" "+(h?"":'tabindex="0"')),"",n.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+e.$node[0].id+'_table" '+n.ariaAttr({role:"grid",controls:e.$node[0].id,readonly:!0})),i.klass.calendar_container)+n.node("div",n.node("button",i.today,"btn-flat picker__today waves-effect","type=button data-pick="+a.pick+(t&&!e.disabled(a)?"":" disabled")+" "+n.ariaAttr({controls:e.$node[0].id}))+n.node("button",i.clear,"btn-flat picker__clear waves-effect","type=button data-clear=1"+(t?"":" disabled")+" "+n.ariaAttr({controls:e.$node[0].id}))+n.node("button",i.close,"btn-flat picker__close waves-effect","type=button data-close=true "+(t?"":" disabled")+" "+n.ariaAttr({controls:e.$node[0].id})),i.klass.footer),"picker__container__wrapper")},i.defaults=function(t){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysLetter:["S","M","T","W","T","F","S"],today:"Today",clear:"Clear",close:"Ok",closeOnSelect:!1,format:"d mmmm, yyyy",klass:{table:t+"table",header:t+"header",date_display:t+"date-display",day_display:t+"day-display",month_display:t+"month-display",year_display:t+"year-display",calendar_container:t+"calendar-container",navPrev:t+"nav--prev",navNext:t+"nav--next",navDisabled:t+"nav--disabled",month:t+"month",year:t+"year",selectMonth:t+"select--month",selectYear:t+"select--year",weekdays:t+"weekday",day:t+"day",disabled:t+"day--disabled",selected:t+"day--selected",highlighted:t+"day--highlighted",now:t+"day--today",infocus:t+"day--infocus",outfocus:t+"day--outfocus",footer:t+"footer",buttonClear:t+"button--clear",buttonToday:t+"button--today",buttonClose:t+"button--close"}}}(t.klasses().picker+"__"),t.extend("pickadate",i)}),function(t){function e(t){return document.createElementNS(l,t)}function i(t){return(t<10?"0":"")+t}function n(t){var e=++m+"";return t?t+e:e}function o(o,r){function l(t,e){var i=d.offset(),n=/^touch/.test(t.type),o=i.left+g,a=i.top+g,l=(n?t.originalEvent.touches[0]:t).pageX-o,c=(n?t.originalEvent.touches[0]:t).pageY-a,u=Math.sqrt(l*l+c*c),p=!1;if(!e||!(u<y-w||u>y+w)){t.preventDefault();var v=setTimeout(function(){E.popover.addClass("clockpicker-moving")},200);E.setHand(l,c,!e,!0),s.off(h).on(h,function(t){t.preventDefault();var e=/^touch/.test(t.type),i=(e?t.originalEvent.touches[0]:t).pageX-o,n=(e?t.originalEvent.touches[0]:t).pageY-a;(p||i!==l||n!==c)&&(p=!0,E.setHand(i,n,!1,!0))}),s.off(f).on(f,function(t){s.off(f),t.preventDefault();var i=/^touch/.test(t.type),n=(i?t.originalEvent.changedTouches[0]:t).pageX-o,u=(i?t.originalEvent.changedTouches[0]:t).pageY-a;(e||p)&&n===l&&u===c&&E.setHand(n,u),"hours"===E.currentView?E.toggleView("minutes",x/2):r.autoclose&&(E.minutesView.addClass("clockpicker-dial-out"),setTimeout(function(){E.done()},x/2)),d.prepend(z),clearTimeout(v),E.popover.removeClass("clockpicker-moving"),s.off(h)})}}var u=t(C),d=u.find(".clockpicker-plate"),v=u.find(".picker__holder"),m=u.find(".clockpicker-hours"),T=u.find(".clockpicker-minutes"),S=u.find(".clockpicker-am-pm-block"),P="INPUT"===o.prop("tagName"),A=P?o:o.find("input"),O=t("label[for="+A.attr("id")+"]"),E=this;this.id=n("cp"),this.element=o,this.holder=v,this.options=r,this.isAppended=!1,this.isShown=!1,this.currentView="hours",this.isInput=P,this.input=A,this.label=O,this.popover=u,this.plate=d,this.hoursView=m,this.minutesView=T,this.amPmBlock=S,this.spanHours=u.find(".clockpicker-span-hours"),this.spanMinutes=u.find(".clockpicker-span-minutes"),this.spanAmPm=u.find(".clockpicker-span-am-pm"),this.footer=u.find(".picker__footer"),this.amOrPm="PM",r.twelvehour&&(r.ampmclickable?(this.spanAmPm.empty(),t('<div id="click-am">AM</div>').on("click",function(){E.spanAmPm.children("#click-am").addClass("text-primary"),E.spanAmPm.children("#click-pm").removeClass("text-primary"),E.amOrPm="AM"}).appendTo(this.spanAmPm),t('<div id="click-pm">PM</div>').on("click",function(){E.spanAmPm.children("#click-pm").addClass("text-primary"),E.spanAmPm.children("#click-am").removeClass("text-primary"),E.amOrPm="PM"}).appendTo(this.spanAmPm)):(this.spanAmPm.empty(),t('<div id="click-am">AM</div>').appendTo(this.spanAmPm),t('<div id="click-pm">PM</div>').appendTo(this.spanAmPm))),t('<button type="button" class="btn-flat picker__clear" tabindex="'+(r.twelvehour?"3":"1")+'">'+r.cleartext+"</button>").click(t.proxy(this.clear,this)).appendTo(this.footer),t('<button type="button" class="btn-flat picker__close" tabindex="'+(r.twelvehour?"3":"1")+'">'+r.canceltext+"</button>").click(t.proxy(this.hide,this)).appendTo(this.footer),t('<button type="button" class="btn-flat picker__close" tabindex="'+(r.twelvehour?"3":"1")+'">'+r.donetext+"</button>").click(t.proxy(this.done,this)).appendTo(this.footer),this.spanHours.click(t.proxy(this.toggleView,this,"hours")),this.spanMinutes.click(t.proxy(this.toggleView,this,"minutes")),A.on("focus.clockpicker click.clockpicker",t.proxy(this.show,this));var _,M,I,D,q=t('<div class="clockpicker-tick"></div>');if(r.twelvehour)for(_=1;_<13;_+=1)M=q.clone(),I=_/6*Math.PI,D=y,M.css({left:g+Math.sin(I)*D-w,top:g-Math.cos(I)*D-w}),M.html(0===_?"00":_),m.append(M),M.on(p,l);else for(_=0;_<24;_+=1)M=q.clone(),I=_/6*Math.PI,D=_>0&&_<13?b:y,M.css({left:g+Math.sin(I)*D-w,top:g-Math.cos(I)*D-w}),M.html(0===_?"00":_),m.append(M),M.on(p,l);for(_=0;_<60;_+=5)M=q.clone(),I=_/30*Math.PI,M.css({left:g+Math.sin(I)*y-w,top:g-Math.cos(I)*y-w}),M.html(i(_)),T.append(M),M.on(p,l);if(d.on(p,function(e){0===t(e.target).closest(".clockpicker-tick").length&&l(e,!0)}),c){var z=u.find(".clockpicker-canvas"),V=e("svg");V.setAttribute("class","clockpicker-svg"),V.setAttribute("width",k),V.setAttribute("height",k);var H=e("g");H.setAttribute("transform","translate("+g+","+g+")");var L=e("circle");L.setAttribute("class","clockpicker-canvas-bearing"),L.setAttribute("cx",0),L.setAttribute("cy",0),L.setAttribute("r",4);var j=e("line");j.setAttribute("x1",0),j.setAttribute("y1",0);var $=e("circle");$.setAttribute("class","clockpicker-canvas-bg"),$.setAttribute("r",w),H.appendChild(j),H.appendChild($),H.appendChild(L),V.appendChild(H),z.append(V),this.hand=j,this.bg=$,this.bearing=L,this.g=H,this.canvas=z}a(this.options.init)}function a(t){t&&"function"==typeof t&&t()}var r=t(window),s=t(document),l="http://www.w3.org/2000/svg",c="SVGAngle"in window&&function(){var t,e=document.createElement("div");return e.innerHTML="<svg/>",t=(e.firstChild&&e.firstChild.namespaceURI)==l,e.innerHTML="",t}(),u=function(){var t=document.createElement("div").style;return"transition"in t||"WebkitTransition"in t||"MozTransition"in t||"msTransition"in t||"OTransition"in t}(),d="ontouchstart"in window,p="mousedown"+(d?" touchstart":""),h="mousemove.clockpicker"+(d?" touchmove.clockpicker":""),f="mouseup.clockpicker"+(d?" touchend.clockpicker":""),v=navigator.vibrate?"vibrate":navigator.webkitVibrate?"webkitVibrate":null,m=0,g=135,y=105,b=70,w=20,k=2*g,x=u?350:1,C=['<div class="clockpicker picker">','<div class="picker__holder">','<div class="picker__frame">','<div class="picker__wrap">','<div class="picker__box">','<div class="picker__date-display">','<div class="clockpicker-display">','<div class="clockpicker-display-column">','<span class="clockpicker-span-hours text-primary"></span>',":",'<span class="clockpicker-span-minutes"></span>',"</div>",'<div class="clockpicker-display-column clockpicker-display-am-pm">','<div class="clockpicker-span-am-pm"></div>',"</div>","</div>","</div>",'<div class="picker__container__wrapper">','<div class="picker__calendar-container">','<div class="clockpicker-plate">','<div class="clockpicker-canvas"></div>','<div class="clockpicker-dial clockpicker-hours"></div>','<div class="clockpicker-dial clockpicker-minutes clockpicker-dial-out"></div>',"</div>",'<div class="clockpicker-am-pm-block">',"</div>","</div>",'<div class="picker__footer">',"</div>","</div>","</div>","</div>","</div>","</div>","</div>"].join("");o.DEFAULTS={default:"",fromnow:0,donetext:"Ok",cleartext:"Clear",canceltext:"Cancel",autoclose:!1,ampmclickable:!0,darktheme:!1,twelvehour:!0,vibrate:!0},o.prototype.toggle=function(){this[this.isShown?"hide":"show"]()},o.prototype.locate=function(){var t=this.element,e=this.popover;t.offset(),t.outerWidth(),t.outerHeight(),this.options.align;e.show()},o.prototype.show=function(e){if(!this.isShown){a(this.options.beforeShow),t(":input").each(function(){t(this).attr("tabindex",-1)});var n=this;this.input.blur(),this.popover.addClass("picker--opened"),this.input.addClass("picker__input picker__input--active"),t(document.body).css("overflow","hidden");var o=((this.input.prop("value")||this.options.default||"")+"").split(":");if(this.options.twelvehour&&void 0!==o[1]&&(o[1].indexOf("AM")>0?this.amOrPm="AM":this.amOrPm="PM",o[1]=o[1].replace("AM","").replace("PM","")),"now"===o[0]){var l=new Date(+new Date+this.options.fromnow);o=[l.getHours(),l.getMinutes()],this.options.twelvehour&&(this.amOrPm=o[0]>=12&&o[0]<24?"PM":"AM")}if(this.hours=+o[0]||0,this.minutes=+o[1]||0,this.spanHours.html(this.hours),this.spanMinutes.html(i(this.minutes)),!this.isAppended){var c=document.querySelector(this.options.container);this.options.container&&c?c.appendChild(this.popover[0]):this.popover.insertAfter(this.input),this.options.twelvehour&&("PM"===this.amOrPm?(this.spanAmPm.children("#click-pm").addClass("text-primary"),this.spanAmPm.children("#click-am").removeClass("text-primary")):(this.spanAmPm.children("#click-am").addClass("text-primary"),this.spanAmPm.children("#click-pm").removeClass("text-primary"))),r.on("resize.clockpicker"+this.id,function(){n.isShown&&n.locate()}),this.isAppended=!0}this.toggleView("hours"),this.locate(),this.isShown=!0,s.on("click.clockpicker."+this.id+" focusin.clockpicker."+this.id,function(e){var i=t(e.target);0===i.closest(n.popover.find(".picker__wrap")).length&&0===i.closest(n.input).length&&n.hide()}),s.on("keyup.clockpicker."+this.id,function(t){27===t.keyCode&&n.hide()}),a(this.options.afterShow)}},o.prototype.hide=function(){a(this.options.beforeHide),this.input.removeClass("picker__input picker__input--active"),this.popover.removeClass("picker--opened"),t(document.body).css("overflow","visible"),this.isShown=!1,t(":input").each(function(e){t(this).attr("tabindex",e+1)}),s.off("click.clockpicker."+this.id+" focusin.clockpicker."+this.id),s.off("keyup.clockpicker."+this.id),this.popover.hide(),a(this.options.afterHide)},o.prototype.toggleView=function(e,i){var n=!1;"minutes"===e&&"visible"===t(this.hoursView).css("visibility")&&(a(this.options.beforeHourSelect),n=!0);var o="hours"===e,r=o?this.hoursView:this.minutesView,s=o?this.minutesView:this.hoursView;this.currentView=e,this.spanHours.toggleClass("text-primary",o),this.spanMinutes.toggleClass("text-primary",!o),s.addClass("clockpicker-dial-out"),r.css("visibility","visible").removeClass("clockpicker-dial-out"),this.resetClock(i),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(function(){s.css("visibility","hidden")},x),n&&a(this.options.afterHourSelect)},o.prototype.resetClock=function(t){var e=this.currentView,i=this[e],n="hours"===e,o=i*(Math.PI/(n?6:30)),a=n&&i>0&&i<13?b:y,r=Math.sin(o)*a,s=-Math.cos(o)*a,l=this;c&&t?(l.canvas.addClass("clockpicker-canvas-out"),setTimeout(function(){l.canvas.removeClass("clockpicker-canvas-out"),l.setHand(r,s)},t)):this.setHand(r,s)},o.prototype.setHand=function(e,n,o,a){var r,s=Math.atan2(e,-n),l="hours"===this.currentView,u=Math.PI/(l||o?6:30),d=Math.sqrt(e*e+n*n),p=this.options,h=l&&d<(y+b)/2,f=h?b:y;if(p.twelvehour&&(f=y),s<0&&(s=2*Math.PI+s),r=Math.round(s/u),s=r*u,p.twelvehour?l?0===r&&(r=12):(o&&(r*=5),60===r&&(r=0)):l?(12===r&&(r=0),r=h?0===r?12:r:0===r?0:r+12):(o&&(r*=5),60===r&&(r=0)),this[this.currentView]!==r&&v&&this.options.vibrate&&(this.vibrateTimer||(navigator[v](10),this.vibrateTimer=setTimeout(t.proxy(function(){this.vibrateTimer=null},this),100))),this[this.currentView]=r,l?this.spanHours.html(r):this.spanMinutes.html(i(r)),c){var m=Math.sin(s)*(f-w),g=-Math.cos(s)*(f-w),k=Math.sin(s)*f,x=-Math.cos(s)*f;this.hand.setAttribute("x2",m),this.hand.setAttribute("y2",g),this.bg.setAttribute("cx",k),this.bg.setAttribute("cy",x)}else this[l?"hoursView":"minutesView"].find(".clockpicker-tick").each(function(){var e=t(this);e.toggleClass("active",r===+e.html())})},o.prototype.done=function(){a(this.options.beforeDone),this.hide(),this.label.addClass("active");var t=this.input.prop("value"),e=i(this.hours)+":"+i(this.minutes);this.options.twelvehour&&(e+=this.amOrPm),this.input.prop("value",e),e!==t&&(this.input.triggerHandler("change"),this.isInput||this.element.trigger("change")),this.options.autoclose&&this.input.trigger("blur"),a(this.options.afterDone)},o.prototype.clear=function(){this.hide(),this.label.removeClass("active");var t=this.input.prop("value");this.input.prop("value",""),""!==t&&(this.input.triggerHandler("change"),this.isInput||this.element.trigger("change")),this.options.autoclose&&this.input.trigger("blur")},o.prototype.remove=function(){this.element.removeData("clockpicker"),this.input.off("focus.clockpicker click.clockpicker"),this.isShown&&this.hide(),this.isAppended&&(r.off("resize.clockpicker"+this.id),this.popover.remove())},t.fn.pickatime=function(e){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var n=t(this),a=n.data("clockpicker");if(a)"function"==typeof a[e]&&a[e].apply(a,i);else{var r=t.extend({},o.DEFAULTS,n.data(),"object"==typeof e&&e);n.data("clockpicker",new o(n,r))}})}}(jQuery),function(t){function e(){var e=+t(this).attr("data-length"),i=+t(this).val().length,n=i<=e;t(this).parent().find('span[class="character-counter"]').html(i+"/"+e),o(n,t(this))}function i(e){var i=e.parent().find('span[class="character-counter"]');i.length||(i=t("<span/>").addClass("character-counter").css("float","right").css("font-size","12px").css("height",1),e.parent().append(i))}function n(){t(this).parent().find('span[class="character-counter"]').html("")}function o(t,e){var i=e.hasClass("invalid");t&&i?e.removeClass("invalid"):t||i||(e.removeClass("valid"),e.addClass("invalid"))}t.fn.characterCounter=function(){return this.each(function(){var o=t(this);o.parent().find('span[class="character-counter"]').length||void 0!==o.attr("data-length")&&(o.on("input",e),o.on("focus",e),o.on("blur",n),i(o))})},t(document).ready(function(){t("input, textarea").characterCounter()})}(jQuery),function(t){var e={init:function(e){var i={duration:200,dist:-100,shift:0,padding:0,fullWidth:!1,indicators:!1,noWrap:!1,onCycleTo:null};e=t.extend(i,e);var n=Materialize.objectSelectorString(t(this));return this.each(function(i){function o(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientX:t.clientX}function a(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientY:t.clientY}function r(t){return t>=C?t%C:t<0?r(C+t%C):t}function s(i){E=!0,j.hasClass("scrolling")||j.addClass("scrolling"),null!=H&&window.clearTimeout(H),H=window.setTimeout(function(){E=!1,j.removeClass("scrolling")},e.duration);var n,o,a,s,l,c,u,d=w;if(b="number"==typeof i?i:b,w=Math.floor((b+x/2)/x),a=b-w*x,s=a<0?1:-1,l=-s*a*2/x,o=C>>1,e.fullWidth?u="translateX(0)":(u="translateX("+(j[0].clientWidth-m)/2+"px) ",u+="translateY("+(j[0].clientHeight-g)/2+"px)"),N){var p=w%C,h=V.find(".indicator-item.active");h.index()!==p&&(h.removeClass("active"),V.find(".indicator-item").eq(p).addClass("active"))}for((!W||w>=0&&w<C)&&(c=v[r(w)],t(c).hasClass("active")||(j.find(".carousel-item").removeClass("active"),t(c).addClass("active")),c.style[_]=u+" translateX("+-a/2+"px) translateX("+s*e.shift*l*n+"px) translateZ("+e.dist*l+"px)",c.style.zIndex=0,e.fullWidth?tweenedOpacity=1:tweenedOpacity=1-.2*l,c.style.opacity=tweenedOpacity,c.style.display="block"),n=1;n<=o;++n)e.fullWidth?(zTranslation=e.dist,tweenedOpacity=n===o&&a<0?1-l:1):(zTranslation=e.dist*(2*n+l*s),tweenedOpacity=1-.2*(2*n+l*s)),(!W||w+n<C)&&((c=v[r(w+n)]).style[_]=u+" translateX("+(e.shift+(x*n-a)/2)+"px) translateZ("+zTranslation+"px)",c.style.zIndex=-n,c.style.opacity=tweenedOpacity,c.style.display="block"),e.fullWidth?(zTranslation=e.dist,tweenedOpacity=n===o&&a>0?1-l:1):(zTranslation=e.dist*(2*n-l*s),tweenedOpacity=1-.2*(2*n-l*s)),(!W||w-n>=0)&&((c=v[r(w-n)]).style[_]=u+" translateX("+(-e.shift+(-x*n-a)/2)+"px) translateZ("+zTranslation+"px)",c.style.zIndex=-n,c.style.opacity=tweenedOpacity,c.style.display="block");if((!W||w>=0&&w<C)&&((c=v[r(w)]).style[_]=u+" translateX("+-a/2+"px) translateX("+s*e.shift*l+"px) translateZ("+e.dist*l+"px)",c.style.zIndex=0,e.fullWidth?tweenedOpacity=1:tweenedOpacity=1-.2*l,c.style.opacity=tweenedOpacity,c.style.display="block"),d!==w&&"function"==typeof e.onCycleTo){var f=j.find(".carousel-item").eq(r(w));e.onCycleTo.call(this,f,q)}"function"==typeof L&&(L.call(this,f,q),L=null)}function l(){var t,e,i;e=(t=Date.now())-I,I=t,i=b-M,M=b,O=.8*(1e3*i/(1+e))+.2*O}function c(){var t,i;P&&(t=Date.now()-I,(i=P*Math.exp(-t/e.duration))>2||i<-2?(s(A-i),requestAnimationFrame(c)):s(A))}function u(i){if(q)return i.preventDefault(),i.stopPropagation(),!1;if(!e.fullWidth){var n=t(i.target).closest(".carousel-item").index();0!==r(w)-n&&(i.preventDefault(),i.stopPropagation()),d(n)}}function d(t){var e=w%C-t;W||(e<0?Math.abs(e+C)<Math.abs(e)&&(e+=C):e>0&&Math.abs(e-C)<e&&(e-=C)),e<0?j.trigger("carouselNext",[Math.abs(e)]):e>0&&j.trigger("carouselPrev",[e])}function p(e){"mousedown"===e.type&&t(e.target).is("img")&&e.preventDefault(),k=!0,q=!1,z=!1,T=o(e),S=a(e),O=P=0,M=b,I=Date.now(),clearInterval(D),D=setInterval(l,100)}function h(t){var e,i;if(k)if(e=o(t),y=a(t),i=T-e,Math.abs(S-y)<30&&!z)(i>2||i<-2)&&(q=!0,T=e,s(b+i));else{if(q)return t.preventDefault(),t.stopPropagation(),!1;z=!0}if(q)return t.preventDefault(),t.stopPropagation(),!1}function f(t){if(k)return k=!1,clearInterval(D),A=b,(O>10||O<-10)&&(A=b+(P=.9*O)),A=Math.round(A/x)*x,W&&(A>=x*(C-1)?A=x*(C-1):A<0&&(A=0)),P=A-b,I=Date.now(),requestAnimationFrame(c),q&&(t.preventDefault(),t.stopPropagation()),!1}var v,m,g,b,w,k,x,C,T,S,P,A,O,E,_,M,I,D,q,z,V=t('<ul class="indicators"></ul>'),H=null,L=null,j=t(this),$=j.find(".carousel-item").length>1,N=(j.attr("data-indicators")||e.indicators)&&$,W=j.attr("data-no-wrap")||e.noWrap||!$,F=j.attr("data-namespace")||n+i;j.attr("data-namespace",F);var Q=function(e){var i=j.find(".carousel-item.active").length?j.find(".carousel-item.active").first():j.find(".carousel-item").first(),n=i.find("img").first();if(n.length)if(n[0].complete)if(n.height()>0)j.css("height",n.height());else{var o=n[0].naturalWidth,a=n[0].naturalHeight,r=j.width()/o*a;j.css("height",r)}else n.on("load",function(){j.css("height",t(this).height())});else if(!e){var s=i.height();j.css("height",s)}};if(e.fullWidth&&(e.dist=0,Q(),N&&j.find(".carousel-fixed-item").addClass("with-indicators")),j.hasClass("initialized"))return t(window).trigger("resize"),j.trigger("carouselNext",[1e-6]),!0;j.addClass("initialized"),k=!1,b=A=0,v=[],m=j.find(".carousel-item").first().innerWidth(),g=j.find(".carousel-item").first().innerHeight(),x=2*m+e.padding,j.find(".carousel-item").each(function(e){if(v.push(t(this)[0]),N){var i=t('<li class="indicator-item"></li>');0===e&&i.addClass("active"),i.click(function(e){e.stopPropagation(),d(t(this).index())}),V.append(i)}}),N&&j.append(V),C=v.length,_="transform",["webkit","Moz","O","ms"].every(function(t){var e=t+"Transform";return void 0===document.body.style[e]||(_=e,!1)});var X=Materialize.throttle(function(){if(e.fullWidth){m=j.find(".carousel-item").first().innerWidth();j.find(".carousel-item.active").height();x=2*m+e.padding,A=b=2*w*m,Q(!0)}else s()},200);t(window).off("resize.carousel-"+F).on("resize.carousel-"+F,X),void 0!==window.ontouchstart&&(j.on("touchstart.carousel",p),j.on("touchmove.carousel",h),j.on("touchend.carousel",f)),j.on("mousedown.carousel",p),j.on("mousemove.carousel",h),j.on("mouseup.carousel",f),j.on("mouseleave.carousel",f),j.on("click.carousel",u),s(b),t(this).on("carouselNext",function(t,e,i){void 0===e&&(e=1),"function"==typeof i&&(L=i),A=x*Math.round(b/x)+x*e,b!==A&&(P=A-b,I=Date.now(),requestAnimationFrame(c))}),t(this).on("carouselPrev",function(t,e,i){void 0===e&&(e=1),"function"==typeof i&&(L=i),A=x*Math.round(b/x)-x*e,b!==A&&(P=A-b,I=Date.now(),requestAnimationFrame(c))}),t(this).on("carouselSet",function(t,e,i){void 0===e&&(e=0),"function"==typeof i&&(L=i),d(e)})})},next:function(e,i){t(this).trigger("carouselNext",[e,i])},prev:function(e,i){t(this).trigger("carouselPrev",[e,i])},set:function(e,i){t(this).trigger("carouselSet",[e,i])},destroy:function(){var e=t(this).attr("data-namespace");t(this).removeAttr("data-namespace"),t(this).removeClass("initialized"),t(this).find(".indicators").remove(),t(this).off("carouselNext carouselPrev carouselSet"),t(window).off("resize.carousel-"+e),void 0!==window.ontouchstart&&t(this).off("touchstart.carousel touchmove.carousel touchend.carousel"),t(this).off("mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel")}};t.fn.carousel=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.carousel"):e.init.apply(this,arguments)}}(jQuery),function(t){var e={init:function(e){return this.each(function(){var i=t("#"+t(this).attr("data-activates")),n=(t("body"),t(this)),o=n.parent(".tap-target-wrapper"),a=o.find(".tap-target-wave"),r=o.find(".tap-target-origin"),s=n.find(".tap-target-content");o.length||(o=n.wrap(t('<div class="tap-target-wrapper"></div>')).parent()),s.length||(s=t('<div class="tap-target-content"></div>'),n.append(s)),a.length||(a=t('<div class="tap-target-wave"></div>'),r.length||((r=i.clone(!0,!0)).addClass("tap-target-origin"),r.removeAttr("id"),r.removeAttr("style"),a.append(r)),o.append(a));var l=function(){o.is(".open")&&(o.removeClass("open"),r.off("click.tapTarget"),t(document).off("click.tapTarget"),t(window).off("resize.tapTarget"))},c=function(){var e="fixed"===i.css("position");if(!e)for(var r=i.parents(),l=0;l<r.length&&!(e="fixed"==t(r[l]).css("position"));l++);var c=i.outerWidth(),u=i.outerHeight(),d=e?i.offset().top-t(document).scrollTop():i.offset().top,p=e?i.offset().left-t(document).scrollLeft():i.offset().left,h=t(window).width(),f=t(window).height(),v=h/2,m=f/2,g=p<=v,y=p>v,b=d<=m,w=d>m,k=p>=.25*h&&p<=.75*h,x=n.outerWidth(),C=n.outerHeight(),T=d+u/2-C/2,S=p+c/2-x/2,P=e?"fixed":"absolute",A=k?x:x/2+c,O=C/2,E=b?C/2:0,_=g&&!k?x/2-c:0,M=c,I=w?"bottom":"top",D=2*c,q=D,z=C/2-q/2,V=x/2-D/2,H={};H.top=b?T:"",H.right=y?h-S-x:"",H.bottom=w?f-T-C:"",H.left=g?S:"",H.position=P,o.css(H),s.css({width:A,height:O,top:E,right:0,bottom:0,left:_,padding:M,verticalAlign:I}),a.css({top:z,left:V,width:D,height:q})};"open"==e&&(c(),o.is(".open")||(o.addClass("open"),setTimeout(function(){r.off("click.tapTarget").on("click.tapTarget",function(t){l(),r.off("click.tapTarget")}),t(document).off("click.tapTarget").on("click.tapTarget",function(e){l(),t(document).off("click.tapTarget")});var e=Materialize.throttle(function(){c()},200);t(window).off("resize.tapTarget").on("resize.tapTarget",e)},0))),"close"==e&&l()})},open:function(){},close:function(){}};t.fn.tapTarget=function(i){if(e[i]||"object"==typeof i)return e.init.apply(this,arguments);t.error("Method "+i+" does not exist on jQuery.tap-target")}}(jQuery);
 
 
 
admin/scripts/modula-admin.js CHANGED
@@ -1,1046 +1,1041 @@
1
- var TG = function ($) {
2
- var _loading = null;
3
-
4
- return {
5
- choose_images: function(title_field, caption_field, callback) {
6
- tgm_media_frame = wp.media.frames.tgm_media_frame = wp.media({
7
- multiple: true,
8
- library: {
9
- type: 'image'
10
- },
11
- title: 'Add image(s)',
12
- button: {
13
- text: 'Add image(s)'
14
- },
15
- states: [
16
- new wp.media.controller.Library({
17
- library: wp.media.query({
18
- type: 'image'
19
- }),
20
- multiple: true,
21
- priority: 20,
22
- filterable: 'all'
23
- })
24
- ]
25
- });
26
-
27
- tgm_media_frame.on('select', function() {
28
- var selection = tgm_media_frame.state().get('selection');
29
- var images = [];
30
-
31
- var errors = 0;
32
- selection.map(function(attachment) {
33
- attachment = attachment.toJSON();
34
-
35
- if (!attachment.sizes) {
36
- errors++;
37
- return;
38
- }
39
-
40
- var obj = {
41
- imageId: attachment.id
42
- };
43
-
44
-
45
- if (title_field != 'none')
46
- obj.title = attachment[title_field];
47
- if (caption_field != 'none')
48
- obj.description = attachment[caption_field];
49
-
50
- obj.imagePath = attachment.url;
51
-
52
- if (attachment.sizes.thumbnail)
53
- obj.thumbnail = attachment.sizes.thumbnail.url;
54
-
55
- if (attachment.sizes.full)
56
- obj.altImagePath = attachment.sizes.full.url;
57
-
58
-
59
- images.push(obj);
60
- });
61
-
62
- if (errors) {
63
- alert(errors + " images could not be added because the selected size is not available");
64
- }
65
-
66
- callback(images);
67
- });
68
-
69
- tgm_media_frame.open();
70
  },
71
- show_loading: function () {
72
- $('#spinner').addClass("shown");
73
- },
74
- hide_loading: function () {
75
- $("#spinner").removeClass("shown");
76
- },
77
- delete_image: function (id) {
78
- TG.show_loading();
79
- $.post(ajaxurl, {
80
- action: 'modula_delete_image',
81
- Modula: $('#Modula').val(),
82
- id: id
83
- }, function () {
84
- TG.load_images();
85
- });
86
- },
87
- load_images: function () {
88
- if(!_loading)
89
- TG.show_loading();
90
-
91
- $.post(ajaxurl, {
92
- action: 'modula_list_images',
93
- Modula: $('#Modula').val(),
94
- gid: $("#gallery-id").val()
95
- }, function (html) {
96
- $("#image-list").empty().append(html).sortable({
97
- update: function () {
98
- TG.show_loading();
99
- var ids = [];
100
- $("#image-list .item").each(function () {
101
- ids.push($(this).data("id"));
102
- });
103
- var data = {
104
- action: 'modula_sort_images',
105
- Modula: $('#Modula').val(),
106
- ids: ids.join(',')
107
- };
108
- $.post(ajaxurl, data, function () {
109
- TG.hide_loading();
110
- });
111
- }
112
- });
113
-
114
- $("#image-list .remove").click(function (e) {
115
- e.preventDefault();
116
- e.stopPropagation();
117
-
118
- var $item = $(this).parents(".item:first");
119
- var id = $item.data("id");
120
-
121
- var data = {
122
- action: 'modula_delete_image',
123
- Modula: $('#Modula').val(),
124
- id: id
125
- };
126
-
127
- TG.show_loading();
128
- $.post(ajaxurl, data, function () {
129
- $item.remove();
130
- TG.hide_loading();
131
- });
132
- });
133
-
134
- $("#image-list .checkbox").click(function () {
135
- $(this).toggleClass("checked");
136
- $(this).parents(".item:first").toggleClass("selected");
137
- });
138
-
139
- TG.hide_loading();
140
- });
141
- },
142
- edit_image: function(form) {
143
- var data = {};
144
- form.find("input[type=text], input:checked, input, textarea, input[type=hidden]").each(function() {
145
- data[$(this).attr("name")] = $(this).val();
146
- });
147
- data.action = 'modula_save_image';
148
- data.type = 'edit';
149
- data.Modula = $('#Modula').val();
150
- TG.show_loading();
151
- $.ajax({
152
- url: ajaxurl,
153
- data: data,
154
- dataType: "json",
155
- type: "post",
156
- error: function(a,b,c) {
157
- TG.hide_loading();
158
- },
159
- success: function(r) {
160
- if(r.success) {
161
- TG.load_images();
162
- } else {
163
- TG.hide_loading();
164
- }
165
- }
166
- });
167
- },
168
- add_image: function () {
169
-
170
- var data = {};
171
- $("#add_image_form input[type=text], #add_image_form input:checked, #add_image_form textarea, #add_image_form input[type=hidden]").each(function() {
172
- data[$(this).attr("name")] = $(this).val();
173
- });
174
-
175
- data.action = 'modula_save_image';
176
- data.type = $(this).data("type");
177
- if(data.img_id == "") {
178
- var p = $("<div title='Attention'>Select an image to add</div>").dialog({
179
- modal: true,
180
- buttons: {
181
- Close: function () {
182
- p.dialog("destroy");
183
- }
184
- }
185
- });
186
- return false;
187
- }
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  TG.show_loading();
190
- $.ajax({
191
- url: ajaxurl,
192
- data: data,
193
- dataType: "json",
194
- type: "post",
195
- error: function(a,b,c) {
196
- TG.hide_loading();
197
- },
198
- success: function(r) {
199
- if(r.success) {
200
- TG.load_images();
201
- $("#add_image_form .img img").remove();
202
- $("[name=img_id],[name=img_url],[name=url],[name=image_caption]").val("");
203
- }
204
- }
205
- });
206
- },
207
- init_gallery: function () {
208
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  },
210
- save_gallery: function() {
211
- var data = {};
212
- data.action = 'modula_save_gallery';
213
-
214
- $(".form-fields").find("input[type=text], select, input[type=range], input:checked, input[type=hidden], textarea").each(function () {
215
- data[$(this).attr("name")] = $(this).val();
216
- });
217
-
218
- if(parseInt(data.gridCellSize) < 2)
219
- data.gridCellSize = 2;
220
-
221
- if(data.galleryName == "") {
222
- var p = $("<div title='Attention'>Insert a name for the gallery</div>").dialog({
223
- modal: true,
224
- buttons: {
225
- Close: function () {
226
- p.dialog("destroy");
227
- }
228
- }
229
- });
230
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  }
232
 
233
- TG.show_loading();
234
-
235
- $.ajax({
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  url: ajaxurl,
237
  data: data,
238
- dataType: "json",
239
- type: "post",
240
- error: function(a,b,c) {
241
- TG.hide_loading();
 
242
  },
243
- success: function (r) {
244
- if(data.ftg_gallery_edit)
245
- {
246
- toast("Gallery Saved",2000);
247
- TG.hide_loading();
248
- }
249
- else
250
- location.href = "?page=edit-modula-lite";
251
  }
252
- });
253
- },
254
- bind: function () {
255
-
256
- $('.field .text .preview .panel').hide();
257
- $('.field .text .preview .panel-' + $('.field .text .select-effect').val()).fadeIn(2000);
258
-
259
- $('.field .text .select-effect').on('change', function(){
260
- var currentEffect = $(this).val();
261
- $('.field .text .preview .panel').hide();
262
- $('.field .text .preview .panel-' + currentEffect).fadeIn(2000);
263
- })
264
-
265
- $(".bullet-menu li a").click(function (e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  e.preventDefault();
267
- var target = $(this).attr("rel").toLowerCase();
268
- $("#" + target + " .collapsible-header").click();
269
- setTimeout(function () {
270
- $('html, body').animate({
271
- scrollTop: $("#" + target).offset().top - 28
272
- }, 1000);
273
- }, 500);
274
- });
275
-
276
- $('.import-export a').click(function(){
277
-
278
- if($(this).attr('id') == 'import')
279
- {
280
- $('#import-modal').openModal();
281
- }
282
- else if($(this).attr('id') == 'export')
283
- {
284
- var data = {action: 'modula_get_config', id: $("#gallery-id").val(), Modula: $('#Modula').val() };
285
-
286
- $.ajax({
287
- type: 'POST',
288
- url: ajaxurl,
289
- data: data,
290
- success: function(r){
291
- $('#export-modal .modal-content textarea').val('');
292
- $('#export-modal .modal-content textarea').val(r);
293
-
294
- $('#export-modal').openModal();
295
- }
296
-
297
- });
298
- }
299
- });
300
-
301
- $('#import-modal .modal-footer #save').click(function(){
302
- var config = $('#import-modal textarea').val();
303
-
304
- var data = {action: 'modula_update_config', config: config, id: $("#gallery-id").val(), Modula: $('#Modula').val() };
305
- $.ajax({
306
- type: 'POST',
307
- url: ajaxurl,
308
- data: data,
309
- success: function(r)
310
- {
311
- alert('Gallery configuration has been updated');
312
- }
313
- })
314
- })
315
-
316
-
317
- $(".collapsible-header").click(function(){
318
- var target = $(this).parent().attr('id');
319
- setTimeout(function () {
320
- $('html, body').animate({
321
- scrollTop: $("#" + target).offset().top - 28
322
- }, 1000);
323
- }, 500);
324
- })
325
-
326
- $(".field .text .integer-only").keypress(function(e){
327
- var charCode = (e.which) ? e.which : e.keyCode;
328
-
329
- if (charCode != 46 && charCode > 31
330
- && (charCode < 48 || charCode > 57))
331
- return false;
332
-
333
- return true;
334
- });
335
-
336
- $('#create-gallery').click(function() {
337
- var name = $('#name').val();
338
- var description = $('#description').val();
339
-
340
- if(name == "" || description == "") return;
341
-
342
- var data = {action: 'create_gallery', name: name, description: description };
343
-
344
- jQuery.post(ajaxurl, data, function(id){
345
- $('#name').val("");
346
- $('#description').val("");
347
-
348
- $_success = $('#success');
349
-
350
- $_success.find(".code").val("[Modula id='" + id + "']");
351
- $_success.find(".gallery-name").text(name);
352
- $_success.find(".customize").attr("href", "?page=edit-modula-lite&galleryId="+id);
353
-
354
- $_success.openModal();
355
- });
356
-
357
- })
358
-
359
- $("#add-submit").click(function (e) {
360
  e.preventDefault();
361
- TG.add_image();
362
- });
363
- $("#add-gallery, #edit-gallery").click(function (e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  e.preventDefault();
365
- TG.save_gallery();
366
- });
367
-
368
- $("#image-list").on("click", ".item .thumb", function () {
369
- $(this).parents(".item").toggleClass("selected");
370
- $(this).parents(".item").find(".checkbox").toggleClass("checked");
371
- });
372
- $("#image-list").on("click", ".edit", function (e) {
373
- e.preventDefault();
374
-
375
- $('#wpbody-content').addClass('dark-content');
376
- var $item = $(this).parents(".item");
377
-
378
- var panel = $("#image-panel-model").clone().attr("id", "image-panel");
379
- panel.css({
380
- marginTop: $(window).scrollTop() - (246 / 2)
381
- });
382
-
383
- $("[name=target]", panel).val($("[name=target]", $item).val());
384
- $("#item-link", panel).val($("[name=link]", $item).val());
385
- $(".figure", panel).append($("img", $item).clone());
386
- $(".sizes", panel).append($("select", $item).clone());
387
- $('#item-title', panel).html($('#img-title', $item).val());
388
- $("#item-description", panel).val($("pre", $item).html());
389
- $(".copy", $item).clone().appendTo(panel);
390
-
391
- $("body").append("<div class='overlay' style='display:none' />");
392
- $(".overlay").fadeIn();
393
- panel.appendTo("body").fadeIn();
394
-
395
- var link = $item.find("[name=link]").val();
396
-
397
- $("[name=halign]", panel).val($("[name=halign]", $item).val());
398
- $("[name=valign]", panel).val($("[name=valign]", $item).val());
399
-
400
- $(".buttons a", panel).click(function (e) {
401
- e.preventDefault();
402
-
403
- switch($(this).data("action")) {
404
- case "save":
405
- $('#wpbody-content').removeClass('dark-content');
406
- var data = {
407
- action : 'modula_save_image',
408
- Modula : $('#Modula').val()
409
- };
410
- $("input[type=text], input[type=hidden], input[type=radio]:checked, input[type=checkbox]:checked, textarea, select", panel).each(function () {
411
- if($(this).attr("name"))
412
- data[$(this).attr("name")] = $(this).val();
413
- });
414
-
415
-
416
- $("#image-panel .close").trigger("click");
417
- TG.show_loading();
418
- $.ajax({
419
- url: ajaxurl,
420
- data: data,
421
- dataType: "json",
422
- type: "post",
423
- error: function(a,b,c) {
424
- console.log(a,b,c);
425
- TG.hide_loading();
426
- },
427
- success: function(r) {
428
- TG.hide_loading();
429
- TG.load_images();
430
- }
431
- });
432
- break;
433
- case "cancel":
434
- $('#wpbody-content').removeClass('dark-content');
435
- $("#image-panel .close").trigger("click");
436
- break;
437
- }
438
- });
439
-
440
- $("#image-panel .close, .overlay").click(function (e) {
441
- e.preventDefault();
442
- panel.fadeOut(function () {
443
- $(this).remove();
444
- });
445
- $(".overlay").fadeOut(function () {
446
- $(this).remove();
447
- });
448
- });
449
- });
450
-
451
-
452
- $(".jump").on("change", function () {
453
- var field = $(this).val();
454
- $('html, body').animate({
455
- scrollTop: $(".row-" + field).offset().top - 20
456
- }, 1000);
457
- $(this).get(0).selectedIndex = 0;
458
- });
459
-
460
- $("body").on("click", "[name=click_action]", function () {
461
- if($(this).val() == "url") {
462
- $(this).siblings("[name=url]").get(0).disabled = false;
463
- } else {
464
- $(this).siblings("[name=url]").val("").get(0).disabled = true;
465
- }
466
- });
467
 
468
- $(".bulk a").click(function (e) {
469
  e.preventDefault();
 
470
 
471
- var $bulk = $(".bulk");
472
-
473
- switch($(this).data("action"))
474
- {
475
- case "select":
476
- $("#images .item").addClass("selected");
477
- $("#images .item .checkbox").addClass("checked");
478
- break;
479
- case "deselect":
480
- $("#images .item").removeClass("selected");
481
- $("#images .item .checkbox").removeClass("checked");
482
- break;
483
- case "toggle":
484
- $("#images .item").toggleClass("selected");
485
- $("#images .item .checkbox").toggleClass("checked");
486
- break;
487
- case "resize":
488
- var selected = [];
489
- $("#images .item.selected").each(function (i, o) {
490
- selected.push($(o).data("id") + "-" + $(o).data("image-id"));
491
- });
492
- if(selected.length == 0) {
493
- alert("No images selected");
494
- } else {
495
- $(".panel", $bulk).hide();
496
- $(".panel strong", $bulk).text("Select size");
497
- $(".panel .text", $bulk).text("");
498
- var $sizes = $(".current-image-size").clone(false);
499
- $sizes.removeClass("current-image-size");
500
- $(".panel .text", $bulk).append($sizes);
501
-
502
- $(".cancel", $bulk).unbind("click").click(function (e) {
503
- e.preventDefault();
504
- $(".panel", $bulk).slideUp();
505
- });
506
-
507
- $(".proceed", $bulk).unbind("click").click(function (e) {
508
- e.preventDefault();
509
- $(".panel", $bulk).slideUp();
510
-
511
- var data = {
512
- action: 'modula_resize_images',
513
- Modula: $('#Modula').val(),
514
- size: $sizes.val(),
515
- id: selected.join(",")
516
- };
517
-
518
- TG.show_loading();
519
- $.post(ajaxurl, data, function () {
520
- TG.load_images();
521
- TG.hide_loading();
522
- });
523
- });
524
-
525
- $(".panel", $bulk).slideDown();
526
- }
527
- break;
528
- case "remove":
529
- var selected = [];
530
- $("#images .item.selected").each(function (i, o) {
531
- selected.push($(o).data("id"));
532
- });
533
- if(selected.length == 0) {
534
- alert("No images selected");
535
- } else {
536
- $(".panel", $bulk).hide();
537
- $(".panel strong", $bulk).text("Confirm");
538
- $(".panel .text", $bulk).text("You selected " + selected.length + " images to remove, proceed ?");
539
-
540
- $(".cancel", $bulk).unbind("click").click(function (e) {
541
- e.preventDefault();
542
- $(".panel", $bulk).slideUp();
543
- });
544
-
545
- $(".proceed", $bulk).unbind("click").click(function (e) {
546
- e.preventDefault();
547
- $(".panel", $bulk).slideUp();
548
-
549
- var data = {
550
- action: 'modula_delete_image',
551
- Modula: $('#Modula').val(),
552
- id: selected.join(",")
553
- };
554
-
555
- TG.show_loading();
556
- $.post(ajaxurl, data, function () {
557
- $("#images .item.selected").remove();
558
- TG.hide_loading();
559
- });
560
- });
561
-
562
- $(".panel", $bulk).slideDown();
563
- }
564
- break;
565
- }
566
- });
567
-
568
- $(".import-source").on("change", function () {
569
- var source = $(this).val();
570
- $("#external-galleries ul").empty();
571
-
572
- if(source) {
573
- var data = {
574
- action : 'modula_get_ext_galleries',
575
- source: source,
576
- Modula : $('#Modula').val()
577
- };
578
-
579
- function fill(list) {
580
- var $ul = $("#external-galleries ul");
581
- $.each(list, function(i, g) {
582
- console.log(g);
583
- $ul.append("<li><input class='js-item' type='checkbox' value='"+g.id+"'/> "+ g.title +"</li>");
584
- });
585
- }
586
- TG.show_loading();
587
- $.ajax({
588
- url: ajaxurl,
589
- data: data,
590
- dataType: "json",
591
- type: "post",
592
- error: function(a,b,c) {
593
- TG.hide_loading();
594
- alert("error loading galleries");
595
- },
596
- success: function(r) {
597
- if(r.success) {
598
- TG.hide_loading();
599
-
600
- fill(r.galleries);
601
- }
602
- }
603
- });
604
- }
605
- });
606
-
607
- $(".open-media-panel").on("click", function() {
608
-
609
- var currentImageSize = $('.current-image-size').val();
610
-
611
- tgm_media_frame = wp.media.frames.tgm_media_frame = wp.media({
612
- multiple: true,
613
- library: {
614
- type: 'image'
615
- }
616
- });
617
-
618
- modula_wp_caption_field = $('#wp_caption').val();
619
- modula_wp_title_field = $('#wp_title').val();
620
-
621
- tgm_media_frame.on('select', function() {
622
- var selection = tgm_media_frame.state().get('selection');
623
- var images = [];
624
- selection.map( function( attachment ) {
625
- attachment = attachment.toJSON();
626
-
627
- var obj = {
628
- imageId: attachment.id
629
- };
630
-
631
- if(modula_wp_caption_field == 'title')
632
- obj.description = attachment.title;
633
- if(modula_wp_caption_field == 'description')
634
- obj.description = attachment.description;
635
- if(modula_wp_caption_field == 'caption')
636
- obj.description = attachment.caption;
637
-
638
- if(modula_wp_title_field == 'title')
639
- obj.title = attachment.title;
640
- if(modula_wp_title_field == 'description')
641
- obj.title = attachment.description;
642
- if(modula_wp_title_field == "none")
643
- obj.title = "";
644
-
645
-
646
- if(attachment.sizes[TG.defaultImageSize])
647
- obj.imagePath = attachment.sizes[TG.defaultImageSize].url
648
- else
649
- obj.imagePath = attachment.url;
650
-
651
- if(attachment.sizes.full)
652
- obj.altImagePath = attachment.sizes.full.url;
653
-
654
- images.push(obj);
655
-
656
- if(typeof attachment.sizes[currentImageSize] !== "undefined")
657
- {
658
- obj.imagePath = attachment.sizes[currentImageSize].url;
659
- }
660
- else
661
- {
662
- obj.imagePath = attachment.sizes.full.url;
663
-
664
- }
665
-
666
- });
667
-
668
- var data = {
669
- action : 'modula_add_image',
670
- enc_images : JSON.stringify(images),
671
- galleryId: $("#gallery-id").val(),
672
- Modula : $('#Modula').val()
673
- };
674
-
675
-
676
- TG.show_loading();
677
- $.ajax({
678
- url: ajaxurl,
679
- data: data,
680
- dataType: "json",
681
- type: "post",
682
- error: function(a,b,c) {
683
- TG.hide_loading();
684
- alert("error adding images");
685
- },
686
- success: function(r) {
687
- if(r.success) {
688
- TG.hide_loading();
689
- TG.load_images();
690
- }
691
- }
692
- });
693
- });
694
-
695
- tgm_media_frame.open();
696
- });
697
- }
698
- }
699
- }(jQuery);
700
-
701
- var NewGalleryWizard = function($) {
702
-
703
- var _curPage = 1;
704
- var $_wizard = null;
705
- var _lock = false;
706
-
707
- return {
708
- init: function() {
709
- $_wizard = $("#modula-wizard");
710
- // $_wizard.find('select').material_select();
711
-
712
- /*! Wizard next */
713
- $_wizard.find(".next").click(function() {
714
- if ($(this).hasClass("disabled"))
715
- return;
716
-
717
- // var branch = $("[name=ftg_source]:checked").val();
718
- $(".invalid").removeClass("invalid");
719
-
720
- if (_curPage == 1) {
721
- var name = $.trim($("[name=tg_name]").val());
722
- if (name.length == 0) {
723
- $("[name=tg_name]").addClass("invalid");
724
- return false;
725
- }
726
- }
727
 
728
- /*! Wizard save */
729
- if ($_wizard.find("fieldset[data-step=" + _curPage + "]").data("save")) {
730
- NewGalleryWizard.save();
731
- return;
732
- } else {
733
- branch = "images";
734
- $_wizard.find("fieldset").hide();
735
- _curPage++;
736
-
737
- var $fs = $_wizard.find("fieldset[data-step=" + _curPage + "]");
738
- /*if (_curPage == 3) {
739
- $fs = $fs.filter("[data-branch=" + branch + "]");
740
- }*/
741
- $fs.show();
742
-
743
- if ($fs.data("save")) {
744
- $('.prev').css("visibility","visible");
745
- $(this).text("Save");
746
- if (branch == 'images') {
747
- $(".select-images").show();
748
- $("[name=post_categories]").val("");
749
- $("[name=woo_categories]").val("");
750
- $("[name=post_tags]").val("");
751
- } else if(branch == 'posts') {
752
- $(".select-images").hide();
753
- $("[name=enc_images]").val("");
754
-
755
- var categories = [];
756
- $("[name=_post_categories]:checked").each(function() {
757
- categories.push(this.value);
758
- });
759
- $("[name=post_categories]").val(categories.join(','));
760
-
761
- var tags = [];
762
- $("[name=_post_tags]:checked").each(function() {
763
- tags.push(this.value);
764
- });
765
- $("[name=post_tags]").val(tags.join(','));
766
- } else {
767
- $(".select-images").hide();
768
- $("[name=enc_images]").val("");
769
-
770
- var categories = [];
771
- $("[name=_woo_categories]:checked").each(function() {
772
- categories.push(this.value);
773
- });
774
- $("[name=woo_categories]").val(categories.join(','));
775
- }
776
- } else {
777
- $(this).text("Next");
778
- }
779
- }
780
 
781
- $_wizard.find(".prev").css({
782
- visibility: 'visible'
783
- });
784
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
 
786
- /*! Wizard prev */
787
- $_wizard.find(".prev").click(function() {
788
- if ($(this).hasClass("disabled"))
789
- return;
790
- _curPage--;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
791
 
792
- var branch = $("[name=ftg_source]:checked").val();
793
 
794
- if (_curPage == 1) {
795
- $(this).css({
796
- visibility: 'hidden'
797
- });
798
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799
 
800
- $_wizard.find("fieldset").hide();
801
- var $fs = $_wizard.find("fieldset[data-step=" + _curPage + "]");
802
- if (_curPage == 3) {
803
- $fs = $fs.filter("[data-branch=" + branch + "]");
804
- }
805
- $fs.show();
806
- $_wizard.find(".next").css({
807
- visibility: 'visible'
808
- }).text("Next");
809
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
 
812
- /*! Wizard add images */
813
- $_wizard.find(".add-images").click(function(e) {
814
- e.preventDefault();
815
- var size = $_wizard.find("[name=def_imgsize]").val();
816
- var title_field = $("[name=ftg_wp_field_title]").val();
817
- var caption_field = $("[name=ftg_wp_field_caption]").val();
818
- TG.choose_images(title_field, caption_field, function(images) {
819
- var delta = Math.pow(2, 4) + Math.pow(2, 2);
820
- var prev = [];
821
- if($("[name=enc_images]").val())
822
- JSON.parse($("[name=enc_images]").val());
823
- var curr = prev.concat(images).slice(0, delta);
824
-
825
- $("[name=enc_images]").val(JSON.stringify(curr));
826
- $_wizard.find(".images").empty();
827
- $.each(curr, function() {
828
-
829
- var $_tile = $("<div class='tile list-group-item' />");
830
- $_tile.data('img', this);
831
- $_tile.append("<a class='btn-floating waves-effect waves-light red del'><i class='mdi-content-clear'></i></a>");
832
- $_tile.append('<img src="' + this.thumbnail + '" />');
833
-
834
- $_wizard.find(".images").append($_tile);
835
-
836
- $_tile.find(".del").click(function() {
837
- $(this).parents(".tile").fadeOut(200, function() {
838
- $(this).remove();
839
- });
840
- });
841
- });
842
-
843
- });
844
- $_wizard.find(".images").sortable({
845
- update: function () {
846
- var images = [];
847
- $_wizard.find(".images .tile").each(function () {
848
- images.push($(this).data('img'));
849
- });
850
- $("[name=enc_images]").val(JSON.stringify(images));
851
- }
852
- });
853
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
  },
855
- save: function() {
856
-
857
- var name = $('#name').val();
858
- var description = $('#description').val();
859
- var images = $('[name=enc_images]').val();
860
- var width = $('#width').val();
861
- var height = $('#height').val();
862
- var img_size = $('#img_size').val();
863
-
864
- var data={ action: 'modula_create_gallery',
865
- name: name,
866
- description: description,
867
- images: images,
868
- width: width,
869
- height: height,
870
- img_size: img_size,
871
- Modula: $('#Modula').val()
872
- };
873
-
874
- $_wizard.find("footer a").addClass("disabled");
875
- $_wizard.find(".loading").show();
876
-
877
- $.ajax({
878
- url: ajaxurl,
879
- data: data,
880
- dataType: "json",
881
- type: "post",
882
- error: function(a, b, c) {
883
- $("#error").openModal();
884
- },
885
- success: function(id) {
886
- id = $.trim(id);
887
- $('#name').val("");
888
- $('#description').val("");
889
-
890
- $_success = $('#success');
891
- $_success.find(".code").val("[Modula id='" + id + "']");
892
- $_success.find(".gallery-name").text(name);
893
- $_success.find(".customize").attr("href", "?page=edit-modula-lite&galleryId="+id);
894
-
895
- $_success.openModal();
896
- }
897
- });
898
  }
 
899
  }
900
- }(jQuery);
901
- var ImportWizard = function($) {
902
-
903
- var _curPage = 1;
904
- var $_wizard = null;
905
- var _lock = false;
906
-
907
- return {
908
- init: function() {
909
- $_wizard = $("#modula-wizard");
910
- $("#external-galleries .js-select-all").on("click", function () {
911
- $("#external-galleries .js-item").each(function () {
912
- this.checked = true;
913
- });
914
- });
915
- // $_wizard.find('select').material_select();
916
-
917
- /*! Wizard next */
918
- $_wizard.find(".next").click(function() {
919
- if ($(this).hasClass("disabled"))
920
- return;
921
-
922
- // var branch = $("[name=ftg_source]:checked").val();
923
- $(".invalid").removeClass("invalid");
924
-
925
- if (_curPage == 1) {
926
- var source = $(".import-source").val();
927
- if (source.length == 0) {
928
- $(".import-source").addClass("invalid");
929
- return false;
930
- }
931
- }
 
932
 
933
- if (_curPage == 2) {
934
- var count = $("#external-galleries .js-item:checked").length;
935
- if(count == 0)
936
- return false;
937
 
938
- $_wizard.find(".galleries-count").text(count);
939
- }
940
 
941
- /*! Wizard save */
942
- if ($_wizard.find("fieldset[data-step=" + _curPage + "]").data("save")) {
943
- ImportWizard.import();
944
- return;
945
- } else {
946
- branch = "images";
947
- $_wizard.find("fieldset").hide();
948
- _curPage++;
949
-
950
- var $fs = $_wizard.find("fieldset[data-step=" + _curPage + "]");
951
- $fs.show();
952
-
953
- if ($fs.data("save")) {
954
- $('.prev').css("visibility","visible");
955
- $(this).text("Proceed");
956
-
957
- } else {
958
- $(this).text("Next");
959
- }
960
- }
961
 
962
- $_wizard.find(".prev").css({
963
- visibility: 'visible'
964
- });
965
- });
966
 
967
- /*! Wizard prev */
968
- $_wizard.find(".prev").click(function() {
969
- if ($(this).hasClass("disabled"))
970
- return;
971
- _curPage--;
972
 
973
- var branch = $("[name=ftg_source]:checked").val();
974
 
975
- if (_curPage == 1) {
976
- $(this).css({
977
- visibility: 'hidden'
978
- });
979
- }
980
 
981
- $_wizard.find("fieldset").hide();
982
- var $fs = $_wizard.find("fieldset[data-step=" + _curPage + "]");
983
- if (_curPage == 3) {
984
- $fs = $fs.filter("[data-branch=" + branch + "]");
985
- }
986
- $fs.show();
987
- $_wizard.find(".next").css({
988
- visibility: 'visible'
989
- }).text("Next");
990
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  },
992
- import: function() {
993
- var source = $('.import-source').val();
994
- var ids = [];
995
-
996
- $("#external-galleries .js-item:checked").each(function (i, e) {
997
- ids.push($(e).val());
998
- });
999
-
1000
- var data = {
1001
- action : 'modula_do_import_galleries',
1002
- source: source,
1003
- ids: ids.join(','),
1004
- Modula : $('#Modula').val()
1005
- };
1006
-
1007
- $_wizard.find("footer a").addClass("disabled");
1008
- $_wizard.find(".loading").show();
1009
-
1010
- $.ajax({
1011
- url: ajaxurl,
1012
- data: data,
1013
- dataType: "json",
1014
- type: "post",
1015
- error: function(a,b,c) {
1016
- $("#error").openModal();
1017
- },
1018
- success: function(r) {
1019
- if(r.success) {
1020
- $('#success').openModal();
1021
- } else {
1022
- $("#error").openModal();
1023
- }
1024
- }
1025
- });
1026
  }
 
1027
  }
1028
- }(jQuery);
1029
- jQuery(function () {
1030
- jQuery('.pickColor').wpColorPicker({
1031
- change: function(event, ui){},
1032
- clear: function() {},
1033
- hide: true,
1034
- palettes: true
1035
- });
1036
-
1037
- TG.bind();
1038
- NewGalleryWizard.init();
1039
- ImportWizard.init();
1040
-
1041
- jQuery("a[href$=modula-gallery-upgrade]").addClass('modula-jump-pro-menu').click(function (e) {
1042
- e.preventDefault();
1043
-
1044
- location.href = "http://modula.greentreelabs.net/#buy";
1045
- })
1046
- });
 
1
+ var TG = function( $ ) {
2
+ var _loading = null;
3
+
4
+ return {
5
+ choose_images: function( title_field, caption_field, callback ) {
6
+ tgm_media_frame = wp.media.frames.tgm_media_frame = wp.media( {
7
+ multiple: true,
8
+ library: {
9
+ type: 'image'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  },
11
+ title: 'Add image(s)',
12
+ button: {
13
+ text: 'Add image(s)'
14
+ },
15
+ states: [
16
+ new wp.media.controller.Library( {
17
+ library: wp.media.query( {
18
+ type: 'image'
19
+ } ),
20
+ multiple: true,
21
+ priority: 20,
22
+ filterable: 'all'
23
+ } )
24
+ ]
25
+ } );
26
+
27
+ tgm_media_frame.on( 'select', function() {
28
+ var selection = tgm_media_frame.state().get( 'selection' );
29
+ var images = [];
30
+
31
+ var errors = 0;
32
+ selection.map( function( attachment ) {
33
+ attachment = attachment.toJSON();
34
+
35
+ if ( ! attachment.sizes ) {
36
+ errors ++;
37
+ return;
38
+ }
39
+
40
+ var obj = {
41
+ imageId: attachment.id
42
+ };
43
+
44
+ if ( title_field != 'none' )
45
+ obj.title = attachment[ title_field ];
46
+ if ( caption_field != 'none' )
47
+ obj.description = attachment[ caption_field ];
48
+
49
+ obj.imagePath = attachment.url;
50
+
51
+ if ( attachment.sizes.thumbnail )
52
+ obj.thumbnail = attachment.sizes.thumbnail.url;
53
+
54
+ if ( attachment.sizes.full )
55
+ obj.altImagePath = attachment.sizes.full.url;
56
+
57
+ images.push( obj );
58
+ } );
59
+
60
+ if ( errors ) {
61
+ alert( errors + ' images could not be added because the selected size is not available' );
62
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
+ callback( images );
65
+ } );
66
+
67
+ tgm_media_frame.open();
68
+ },
69
+ show_loading: function() {
70
+ $( '#spinner' ).addClass( 'shown' );
71
+ },
72
+ hide_loading: function() {
73
+ $( '#spinner' ).removeClass( 'shown' );
74
+ },
75
+ delete_image: function( id ) {
76
+ TG.show_loading();
77
+ $.post( ajaxurl, {
78
+ action: 'modula_delete_image',
79
+ Modula: $( '#Modula' ).val(),
80
+ id: id
81
+ }, function() {
82
+ TG.load_images();
83
+ } );
84
+ },
85
+ load_images: function() {
86
+ if ( ! _loading )
87
+ TG.show_loading();
88
+
89
+ $.post( ajaxurl, {
90
+ action: 'modula_list_images',
91
+ Modula: $( '#Modula' ).val(),
92
+ gid: $( '#gallery-id' ).val()
93
+ }, function( html ) {
94
+ $( '#image-list' ).empty().append( html ).sortable( {
95
+ update: function() {
96
  TG.show_loading();
97
+ var ids = [];
98
+ $( '#image-list .item' ).each( function() {
99
+ ids.push( $( this ).data( 'id' ) );
100
+ } );
101
+ var data = {
102
+ action: 'modula_sort_images',
103
+ Modula: $( '#Modula' ).val(),
104
+ ids: ids.join( ',' )
105
+ };
106
+ $.post( ajaxurl, data, function() {
107
+ TG.hide_loading();
108
+ } );
109
+ }
110
+ } );
111
+
112
+ $( '#image-list .remove' ).click( function( e ) {
113
+ e.preventDefault();
114
+ e.stopPropagation();
115
+
116
+ var $item = $( this ).parents( '.item:first' );
117
+ var id = $item.data( 'id' );
118
+
119
+ var data = {
120
+ action: 'modula_delete_image',
121
+ Modula: $( '#Modula' ).val(),
122
+ id: id
123
+ };
124
+
125
+ TG.show_loading();
126
+ $.post( ajaxurl, data, function() {
127
+ $item.remove();
128
+ TG.hide_loading();
129
+ } );
130
+ } );
131
+
132
+ $( '#image-list .checkbox' ).click( function() {
133
+ $( this ).toggleClass( 'checked' );
134
+ $( this ).parents( '.item:first' ).toggleClass( 'selected' );
135
+ } );
136
+
137
+ TG.hide_loading();
138
+ } );
139
+ },
140
+ edit_image: function( form ) {
141
+ var data = {};
142
+ form.find( 'input[type=text], input:checked, input, textarea, input[type=hidden]' ).each( function() {
143
+ data[ $( this ).attr( 'name' ) ] = $( this ).val();
144
+ } );
145
+ data.action = 'modula_save_image';
146
+ data.type = 'edit';
147
+ data.Modula = $( '#Modula' ).val();
148
+ TG.show_loading();
149
+ $.ajax( {
150
+ url: ajaxurl,
151
+ data: data,
152
+ dataType: 'json',
153
+ type: 'post',
154
+ error: function( a, b, c ) {
155
+ TG.hide_loading();
156
  },
157
+ success: function( r ) {
158
+ if ( r.success ) {
159
+ TG.load_images();
160
+ } else {
161
+ TG.hide_loading();
162
+ }
163
+ }
164
+ } );
165
+ },
166
+ add_image: function() {
167
+
168
+ var data = {};
169
+ $( '#add_image_form input[type=text], #add_image_form input:checked, #add_image_form textarea, #add_image_form input[type=hidden]' ).each( function() {
170
+ data[ $( this ).attr( 'name' ) ] = $( this ).val();
171
+ } );
172
+
173
+ data.action = 'modula_save_image';
174
+ data.type = $( this ).data( 'type' );
175
+ if ( data.img_id == '' ) {
176
+ var p = $( '<div title=\'Attention\'>Select an image to add</div>' ).dialog( {
177
+ modal: true,
178
+ buttons: {
179
+ Close: function() {
180
+ p.dialog( 'destroy' );
181
+ }
182
+ }
183
+ } );
184
+ return false;
185
+ }
186
+
187
+ TG.show_loading();
188
+ $.ajax( {
189
+ url: ajaxurl,
190
+ data: data,
191
+ dataType: 'json',
192
+ type: 'post',
193
+ error: function( a, b, c ) {
194
+ TG.hide_loading();
195
+ },
196
+ success: function( r ) {
197
+ if ( r.success ) {
198
+ TG.load_images();
199
+ $( '#add_image_form .img img' ).remove();
200
+ $( '[name=img_id],[name=img_url],[name=url],[name=image_caption]' ).val( '' );
201
+ }
202
+ }
203
+ } );
204
+ },
205
+ init_gallery: function() {
206
+
207
+ },
208
+ save_gallery: function() {
209
+ var data = {};
210
+ data.action = 'modula_save_gallery';
211
+
212
+ $( '.form-fields' ).find( 'input[type=text], select, input[type=range], input:checked, input[type=hidden], textarea' ).each( function() {
213
+ data[ $( this ).attr( 'name' ) ] = $( this ).val();
214
+ } );
215
+
216
+ if ( parseInt( data.gridCellSize ) < 2 )
217
+ data.gridCellSize = 2;
218
+
219
+ if ( data.galleryName == '' ) {
220
+ var p = $( '<div title=\'Attention\'>Insert a name for the gallery</div>' ).dialog( {
221
+ modal: true,
222
+ buttons: {
223
+ Close: function() {
224
+ p.dialog( 'destroy' );
225
+ }
226
+ }
227
+ } );
228
+ return false;
229
+ }
230
+
231
+ TG.show_loading();
232
+
233
+ $.ajax( {
234
+ url: ajaxurl,
235
+ data: data,
236
+ dataType: 'json',
237
+ type: 'post',
238
+ error: function( a, b, c ) {
239
+ TG.hide_loading();
240
+ },
241
+ success: function( r ) {
242
+ if ( data.ftg_gallery_edit ) {
243
+ Materialize.toast( 'Gallery Saved', 2000 );
244
+ TG.hide_loading();
245
+ }
246
+ else
247
+ location.href = '?page=modula-lite-edit';
248
+ }
249
+ } );
250
+ },
251
+ bind: function() {
252
+
253
+ $( '.field .text .preview .panel' ).hide();
254
+ $( '.field .text .preview .panel-' + $( '.field .text .select-effect' ).val() ).fadeIn( 2000 );
255
+
256
+ $( '.field .text .select-effect' ).on( 'change', function() {
257
+ var currentEffect = $( this ).val();
258
+ $( '.field .text .preview .panel' ).hide();
259
+ $( '.field .text .preview .panel-' + currentEffect ).fadeIn( 2000 );
260
+ } );
261
+
262
+ $( '.bullet-menu li a' ).click( function( e ) {
263
+ e.preventDefault();
264
+ var target = $( this ).attr( 'rel' ).toLowerCase();
265
+ $( '#' + target + ' .collapsible-header' ).click();
266
+ setTimeout( function() {
267
+ $( 'html, body' ).animate( {
268
+ scrollTop: $( '#' + target ).offset().top - 28
269
+ }, 1000 );
270
+ }, 500 );
271
+ } );
272
+
273
+ $( '.import-export a' ).click( function() {
274
+
275
+ if ( $( this ).attr( 'id' ) == 'import' ) {
276
+ $( '#import-modal' ).modal();
277
+ $( '#import-modal' ).modal( 'open' );
278
+ }
279
+ else if ( $( this ).attr( 'id' ) == 'export' ) {
280
+ var data = { action: 'modula_get_config', id: $( '#gallery-id' ).val(), Modula: $( '#Modula' ).val() };
281
+
282
+ $.ajax( {
283
+ type: 'POST',
284
+ url: ajaxurl,
285
+ data: data,
286
+ success: function( r ) {
287
+ $( '#export-modal .modal-content textarea' ).val( '' );
288
+ $( '#export-modal .modal-content textarea' ).val( r );
289
+
290
+ $( '#export-modal' ).modal();
291
+ $( '#export-modal' ).modal( 'open' );
292
  }
293
 
294
+ } );
295
+ }
296
+ } );
297
+
298
+ $( '#import-modal .modal-footer #save' ).click( function() {
299
+ var config = $( '#import-modal textarea' ).val();
300
+
301
+ var data = { action: 'modula_update_config', config: config, id: $( '#gallery-id' ).val(), Modula: $( '#Modula' ).val() };
302
+ $.ajax( {
303
+ type: 'POST',
304
+ url: ajaxurl,
305
+ data: data,
306
+ success: function( r ) {
307
+ alert( 'Gallery configuration has been updated' );
308
+ }
309
+ } );
310
+ } );
311
+
312
+ $( '.collapsible-header' ).click( function() {
313
+ var target = $( this ).parent().attr( 'id' );
314
+ setTimeout( function() {
315
+ $( 'html, body' ).animate( {
316
+ scrollTop: $( '#' + target ).offset().top - 28
317
+ }, 1000 );
318
+ }, 500 );
319
+ } );
320
+
321
+ $( '.field .text .integer-only' ).keypress( function( e ) {
322
+ var charCode = (e.which) ? e.which : e.keyCode;
323
+
324
+ if ( charCode != 46 && charCode > 31
325
+ && (charCode < 48 || charCode > 57) )
326
+ return false;
327
+
328
+ return true;
329
+ } );
330
+
331
+ $( '#create-gallery' ).click( function() {
332
+ var name = $( '#name' ).val();
333
+ var description = $( '#description' ).val();
334
+
335
+ if ( name == '' || description == '' ) return;
336
+
337
+ var data = { action: 'create_gallery', name: name, description: description };
338
+
339
+ jQuery.post( ajaxurl, data, function( id ) {
340
+ $( '#name' ).val( '' );
341
+ $( '#description' ).val( '' );
342
+
343
+ $_success = $( '#success' );
344
+
345
+ $_success.find( '.code' ).val( '[Modula id=\'' + id + '\']' );
346
+ $_success.find( '.gallery-name' ).text( name );
347
+ $_success.find( '.customize' ).attr( 'href', '?page=modula-lite-edit&galleryId=' + id );
348
+
349
+ $_success.modal();
350
+ $_success.modal( 'open' );
351
+ } );
352
+
353
+ } );
354
+
355
+ $( '#add-submit' ).click( function( e ) {
356
+ e.preventDefault();
357
+ TG.add_image();
358
+ } );
359
+ $( '#add-gallery, #edit-gallery' ).click( function( e ) {
360
+ e.preventDefault();
361
+ TG.save_gallery();
362
+ } );
363
+
364
+ $( '#image-list' ).on( 'click', '.item .thumb', function() {
365
+ $( this ).parents( '.item' ).toggleClass( 'selected' );
366
+ $( this ).parents( '.item' ).find( '.checkbox' ).toggleClass( 'checked' );
367
+ } );
368
+ $( '#image-list' ).on( 'click', '.edit', function( e ) {
369
+ e.preventDefault();
370
+
371
+ $( '#wpbody-content' ).addClass( 'dark-content' );
372
+ var $item = $( this ).parents( '.item' );
373
+
374
+ var panel = $( '#image-panel-model' ).clone().attr( 'id', 'image-panel' );
375
+ panel.css( {
376
+ marginTop: $( window ).scrollTop() - (246 / 2)
377
+ } );
378
+
379
+ $( '[name=target]', panel ).val( $( '[name=target]', $item ).val() );
380
+ $( '#item-link', panel ).val( $( '[name=link]', $item ).val() );
381
+ $( '.figure', panel ).append( $( 'img', $item ).clone() );
382
+ $( '.sizes', panel ).append( $( 'select', $item ).clone() );
383
+ $( '#item-title', panel ).html( $( '#img-title', $item ).val() );
384
+ $( '#item-description', panel ).val( $( 'pre', $item ).html() );
385
+ $( '.copy', $item ).clone().appendTo( panel );
386
+
387
+ $( 'body' ).append( '<div class=\'overlay\' style=\'display:none\' />' );
388
+ $( '.overlay' ).fadeIn();
389
+ panel.appendTo( 'body' ).fadeIn();
390
+
391
+ var link = $item.find( '[name=link]' ).val();
392
+
393
+ $( '[name=halign]', panel ).val( $( '[name=halign]', $item ).val() );
394
+ $( '[name=valign]', panel ).val( $( '[name=valign]', $item ).val() );
395
+
396
+ $( '.buttons a', panel ).click( function( e ) {
397
+ e.preventDefault();
398
+
399
+ switch ( $( this ).data( 'action' ) ) {
400
+ case 'save':
401
+ $( '#wpbody-content' ).removeClass( 'dark-content' );
402
+ var data = {
403
+ action: 'modula_save_image',
404
+ Modula: $( '#Modula' ).val()
405
+ };
406
+ $( 'input[type=text], input[type=hidden], input[type=radio]:checked, input[type=checkbox]:checked, textarea, select', panel ).each( function() {
407
+ if ( $( this ).attr( 'name' ) )
408
+ data[ $( this ).attr( 'name' ) ] = $( this ).val();
409
+ } );
410
+
411
+ $( '#image-panel .close' ).trigger( 'click' );
412
+ TG.show_loading();
413
+ $.ajax( {
414
  url: ajaxurl,
415
  data: data,
416
+ dataType: 'json',
417
+ type: 'post',
418
+ error: function( a, b, c ) {
419
+ console.log( a, b, c );
420
+ TG.hide_loading();
421
  },
422
+ success: function( r ) {
423
+ TG.hide_loading();
424
+ TG.load_images();
 
 
 
 
 
425
  }
426
+ } );
427
+ break;
428
+ case 'cancel':
429
+ $( '#wpbody-content' ).removeClass( 'dark-content' );
430
+ $( '#image-panel .close' ).trigger( 'click' );
431
+ break;
432
+ }
433
+ } );
434
+
435
+ $( '#image-panel .close, .overlay' ).click( function( e ) {
436
+ e.preventDefault();
437
+ panel.fadeOut( function() {
438
+ $( this ).remove();
439
+ } );
440
+ $( '.overlay' ).fadeOut( function() {
441
+ $( this ).remove();
442
+ } );
443
+ } );
444
+ } );
445
+
446
+ $( '.jump' ).on( 'change', function() {
447
+ var field = $( this ).val();
448
+ $( 'html, body' ).animate( {
449
+ scrollTop: $( '.row-' + field ).offset().top - 20
450
+ }, 1000 );
451
+ $( this ).get( 0 ).selectedIndex = 0;
452
+ } );
453
+
454
+ $( 'body' ).on( 'click', '[name=click_action]', function() {
455
+ if ( $( this ).val() == 'url' ) {
456
+ $( this ).siblings( '[name=url]' ).get( 0 ).disabled = false;
457
+ } else {
458
+ $( this ).siblings( '[name=url]' ).val( '' ).get( 0 ).disabled = true;
459
+ }
460
+ } );
461
+
462
+ $( '.bulk a' ).click( function( e ) {
463
+ e.preventDefault();
464
+
465
+ var $bulk = $( '.bulk' );
466
+
467
+ switch ( $( this ).data( 'action' ) ) {
468
+ case 'select':
469
+ $( '#images .item' ).addClass( 'selected' );
470
+ $( '#images .item .checkbox' ).addClass( 'checked' );
471
+ break;
472
+ case 'deselect':
473
+ $( '#images .item' ).removeClass( 'selected' );
474
+ $( '#images .item .checkbox' ).removeClass( 'checked' );
475
+ break;
476
+ case 'toggle':
477
+ $( '#images .item' ).toggleClass( 'selected' );
478
+ $( '#images .item .checkbox' ).toggleClass( 'checked' );
479
+ break;
480
+ case 'resize':
481
+ var selected = [];
482
+ $( '#images .item.selected' ).each( function( i, o ) {
483
+ selected.push( $( o ).data( 'id' ) + '-' + $( o ).data( 'image-id' ) );
484
+ } );
485
+ if ( selected.length == 0 ) {
486
+ alert( 'No images selected' );
487
+ } else {
488
+ $( '.panel', $bulk ).hide();
489
+ $( '.panel strong', $bulk ).text( 'Select size' );
490
+ $( '.panel .text', $bulk ).text( '' );
491
+ var $sizes = $( '.current-image-size' ).clone( false );
492
+ $sizes.removeClass( 'current-image-size' );
493
+ $( '.panel .text', $bulk ).append( $sizes );
494
+
495
+ $( '.cancel', $bulk ).unbind( 'click' ).click( function( e ) {
496
  e.preventDefault();
497
+ $( '.panel', $bulk ).slideUp();
498
+ } );
499
+
500
+ $( '.proceed', $bulk ).unbind( 'click' ).click( function( e ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
  e.preventDefault();
502
+ $( '.panel', $bulk ).slideUp();
503
+
504
+ var data = {
505
+ action: 'modula_resize_images',
506
+ Modula: $( '#Modula' ).val(),
507
+ size: $sizes.val(),
508
+ id: selected.join( ',' )
509
+ };
510
+
511
+ TG.show_loading();
512
+ $.post( ajaxurl, data, function() {
513
+ TG.load_images();
514
+ TG.hide_loading();
515
+ } );
516
+ } );
517
+
518
+ $( '.panel', $bulk ).slideDown();
519
+ }
520
+ break;
521
+ case 'remove':
522
+ var selected = [];
523
+ $( '#images .item.selected' ).each( function( i, o ) {
524
+ selected.push( $( o ).data( 'id' ) );
525
+ } );
526
+ if ( selected.length == 0 ) {
527
+ alert( 'No images selected' );
528
+ } else {
529
+ $( '.panel', $bulk ).hide();
530
+ $( '.panel strong', $bulk ).text( 'Confirm' );
531
+ $( '.panel .text', $bulk ).text( 'You selected ' + selected.length + ' images to remove, proceed ?' );
532
+
533
+ $( '.cancel', $bulk ).unbind( 'click' ).click( function( e ) {
534
  e.preventDefault();
535
+ $( '.panel', $bulk ).slideUp();
536
+ } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
 
538
+ $( '.proceed', $bulk ).unbind( 'click' ).click( function( e ) {
539
  e.preventDefault();
540
+ $( '.panel', $bulk ).slideUp();
541
 
542
+ var data = {
543
+ action: 'modula_delete_image',
544
+ Modula: $( '#Modula' ).val(),
545
+ id: selected.join( ',' )
546
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
 
548
+ TG.show_loading();
549
+ $.post( ajaxurl, data, function() {
550
+ $( '#images .item.selected' ).remove();
551
+ TG.hide_loading();
552
+ } );
553
+ } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
 
555
+ $( '.panel', $bulk ).slideDown();
556
+ }
557
+ break;
558
+ }
559
+ } );
560
+
561
+ $( '.import-source' ).on( 'change', function() {
562
+ var source = $( this ).val();
563
+ $( '#external-galleries ul' ).empty();
564
+
565
+ if ( source ) {
566
+ var data = {
567
+ action: 'modula_get_ext_galleries',
568
+ source: source,
569
+ Modula: $( '#Modula' ).val()
570
+ };
571
+
572
+ function fill( list ) {
573
+ var $ul = $( '#external-galleries ul' );
574
+ $.each( list, function( i, g ) {
575
+ console.log( g );
576
+ $ul.append( '<li><input class=\'js-item\' type=\'checkbox\' value=\'' + g.id + '\'/> ' + g.title + '</li>' );
577
+ } );
578
+ }
579
+
580
+ TG.show_loading();
581
+ $.ajax( {
582
+ url: ajaxurl,
583
+ data: data,
584
+ dataType: 'json',
585
+ type: 'post',
586
+ error: function( a, b, c ) {
587
+ TG.hide_loading();
588
+ alert( 'error loading galleries' );
589
+ },
590
+ success: function( r ) {
591
+ if ( r.success ) {
592
+ TG.hide_loading();
593
 
594
+ fill( r.galleries );
595
+ }
596
+ }
597
+ } );
598
+ }
599
+ } );
600
+
601
+ $( '.open-media-panel' ).on( 'click', function() {
602
+
603
+ var currentImageSize = $( '.current-image-size' ).val();
604
+
605
+ tgm_media_frame = wp.media.frames.tgm_media_frame = wp.media( {
606
+ multiple: true,
607
+ library: {
608
+ type: 'image'
609
+ }
610
+ } );
611
+
612
+ modula_wp_caption_field = $( '#wp_caption' ).val();
613
+ modula_wp_title_field = $( '#wp_title' ).val();
614
+
615
+ tgm_media_frame.on( 'select', function() {
616
+ var selection = tgm_media_frame.state().get( 'selection' );
617
+ var images = [];
618
+ selection.map( function( attachment ) {
619
+ attachment = attachment.toJSON();
620
+
621
+ var obj = {
622
+ imageId: attachment.id
623
+ };
624
+
625
+ if ( modula_wp_caption_field == 'title' )
626
+ obj.description = attachment.title;
627
+ if ( modula_wp_caption_field == 'description' )
628
+ obj.description = attachment.description;
629
+ if ( modula_wp_caption_field == 'caption' )
630
+ obj.description = attachment.caption;
631
+
632
+ if ( modula_wp_title_field == 'title' )
633
+ obj.title = attachment.title;
634
+ if ( modula_wp_title_field == 'description' )
635
+ obj.title = attachment.description;
636
+ if ( modula_wp_title_field == 'none' )
637
+ obj.title = '';
638
+
639
+ if ( attachment.sizes[ TG.defaultImageSize ] )
640
+ obj.imagePath = attachment.sizes[ TG.defaultImageSize ].url;
641
+ else
642
+ obj.imagePath = attachment.url;
643
+
644
+ if ( attachment.sizes.full )
645
+ obj.altImagePath = attachment.sizes.full.url;
646
+
647
+ images.push( obj );
648
+
649
+ if ( typeof attachment.sizes[ currentImageSize ] !== 'undefined' ) {
650
+ obj.imagePath = attachment.sizes[ currentImageSize ].url;
651
+ }
652
+ else {
653
+ obj.imagePath = attachment.sizes.full.url;
654
 
655
+ }
656
 
657
+ } );
658
+
659
+ var data = {
660
+ action: 'modula_add_image',
661
+ enc_images: JSON.stringify( images ),
662
+ galleryId: $( '#gallery-id' ).val(),
663
+ Modula: $( '#Modula' ).val()
664
+ };
665
+
666
+ TG.show_loading();
667
+ $.ajax( {
668
+ url: ajaxurl,
669
+ data: data,
670
+ dataType: 'json',
671
+ type: 'post',
672
+ error: function( a, b, c ) {
673
+ TG.hide_loading();
674
+ alert( 'error adding images' );
675
+ },
676
+ success: function( r ) {
677
+ if ( r.success ) {
678
+ TG.hide_loading();
679
+ TG.load_images();
680
+ }
681
+ }
682
+ } );
683
+ } );
684
 
685
+ tgm_media_frame.open();
686
+ } );
687
+ }
688
+ };
689
+ }( jQuery );
690
+
691
+ var NewGalleryWizard = function( $ ) {
692
+
693
+ var _curPage = 1;
694
+ var $_wizard = null;
695
+ var _lock = false;
696
+
697
+ return {
698
+ init: function() {
699
+ $_wizard = $( '#modula-wizard' );
700
+ // $_wizard.find('select').material_select();
701
+
702
+ /*! Wizard next */
703
+ $_wizard.find( '.next' ).click( function() {
704
+ if ( $( this ).hasClass( 'disabled' ) )
705
+ return;
706
+
707
+ // var branch = $("[name=ftg_source]:checked").val();
708
+ $( '.invalid' ).removeClass( 'invalid' );
709
+
710
+ if ( _curPage == 1 ) {
711
+ var name = $.trim( $( '[name=tg_name]' ).val() );
712
+ if ( name.length == 0 ) {
713
+ $( '[name=tg_name]' ).addClass( 'invalid' );
714
+ return false;
715
+ }
716
+ }
717
 
718
+ /*! Wizard save */
719
+ if ( $_wizard.find( 'fieldset[data-step=' + _curPage + ']' ).data( 'save' ) ) {
720
+ NewGalleryWizard.save();
721
+ return;
722
+ } else {
723
+ branch = 'images';
724
+ $_wizard.find( 'fieldset' ).hide();
725
+ _curPage ++;
726
+
727
+ var $fs = $_wizard.find( 'fieldset[data-step=' + _curPage + ']' );
728
+ /*if (_curPage == 3) {
729
+ $fs = $fs.filter("[data-branch=" + branch + "]");
730
+ }*/
731
+ $fs.show();
732
+
733
+ if ( $fs.data( 'save' ) ) {
734
+ $( '.prev' ).css( 'visibility', 'visible' );
735
+ $( this ).text( 'Save' );
736
+ if ( branch == 'images' ) {
737
+ $( '.select-images' ).show();
738
+ $( '[name=post_categories]' ).val( '' );
739
+ $( '[name=woo_categories]' ).val( '' );
740
+ $( '[name=post_tags]' ).val( '' );
741
+ } else if ( branch == 'posts' ) {
742
+ $( '.select-images' ).hide();
743
+ $( '[name=enc_images]' ).val( '' );
744
+
745
+ var categories = [];
746
+ $( '[name=_post_categories]:checked' ).each( function() {
747
+ categories.push( this.value );
748
+ } );
749
+ $( '[name=post_categories]' ).val( categories.join( ',' ) );
750
+
751
+ var tags = [];
752
+ $( '[name=_post_tags]:checked' ).each( function() {
753
+ tags.push( this.value );
754
+ } );
755
+ $( '[name=post_tags]' ).val( tags.join( ',' ) );
756
+ } else {
757
+ $( '.select-images' ).hide();
758
+ $( '[name=enc_images]' ).val( '' );
759
+
760
+ var categories = [];
761
+ $( '[name=_woo_categories]:checked' ).each( function() {
762
+ categories.push( this.value );
763
+ } );
764
+ $( '[name=woo_categories]' ).val( categories.join( ',' ) );
765
+ }
766
+ } else {
767
+ $( this ).text( 'Next' );
768
+ }
769
+ }
770
 
771
+ $_wizard.find( '.prev' ).css( {
772
+ visibility: 'visible'
773
+ } );
774
+ } );
775
+
776
+ /*! Wizard prev */
777
+ $_wizard.find( '.prev' ).click( function() {
778
+ if ( $( this ).hasClass( 'disabled' ) )
779
+ return;
780
+ _curPage --;
781
+
782
+ var branch = $( '[name=ftg_source]:checked' ).val();
783
+
784
+ if ( _curPage == 1 ) {
785
+ $( this ).css( {
786
+ visibility: 'hidden'
787
+ } );
788
+ }
789
+
790
+ $_wizard.find( 'fieldset' ).hide();
791
+ var $fs = $_wizard.find( 'fieldset[data-step=' + _curPage + ']' );
792
+ if ( _curPage == 3 ) {
793
+ $fs = $fs.filter( '[data-branch=' + branch + ']' );
794
+ }
795
+ $fs.show();
796
+ $_wizard.find( '.next' ).css( {
797
+ visibility: 'visible'
798
+ } ).text( 'Next' );
799
+ } );
800
+
801
+ /*! Wizard add images */
802
+ $_wizard.find( '.add-images' ).click( function( e ) {
803
+ e.preventDefault();
804
+ var size = $_wizard.find( '[name=def_imgsize]' ).val();
805
+ var title_field = $( '[name=ftg_wp_field_title]' ).val();
806
+ var caption_field = $( '[name=ftg_wp_field_caption]' ).val();
807
+ TG.choose_images( title_field, caption_field, function( images ) {
808
+ var delta = Math.pow( 2, 4 ) + Math.pow( 2, 2 );
809
+ var prev = [];
810
+ if ( $( '[name=enc_images]' ).val() )
811
+ JSON.parse( $( '[name=enc_images]' ).val() );
812
+ var curr = prev.concat( images ).slice( 0, delta );
813
+
814
+ $( '[name=enc_images]' ).val( JSON.stringify( curr ) );
815
+ $_wizard.find( '.images' ).empty();
816
+ $.each( curr, function() {
817
+
818
+ var $_tile = $( '<div class=\'tile list-group-item\' />' );
819
+ $_tile.data( 'img', this );
820
+ $_tile.append( '<a class=\'btn-floating waves-effect waves-light red del\'><i class=\'mdi-content-clear\'></i></a>' );
821
+ $_tile.append( '<img src="' + this.thumbnail + '" />' );
822
+
823
+ $_wizard.find( '.images' ).append( $_tile );
824
+
825
+ $_tile.find( '.del' ).click( function() {
826
+ $( this ).parents( '.tile' ).fadeOut( 200, function() {
827
+ $( this ).remove();
828
+ } );
829
+ } );
830
+ } );
831
+
832
+ } );
833
+ $_wizard.find( '.images' ).sortable( {
834
+ update: function() {
835
+ var images = [];
836
+ $_wizard.find( '.images .tile' ).each( function() {
837
+ images.push( $( this ).data( 'img' ) );
838
+ } );
839
+ $( '[name=enc_images]' ).val( JSON.stringify( images ) );
840
+ }
841
+ } );
842
+ } );
843
+ },
844
+ save: function() {
845
+
846
+ var name = $( '#name' ).val();
847
+ var description = $( '#description' ).val();
848
+ var images = $( '[name=enc_images]' ).val();
849
+ var width = $( '#width' ).val();
850
+ var height = $( '#height' ).val();
851
+ var img_size = $( '#img_size' ).val();
852
+
853
+ var data = {
854
+ action: 'modula_create_gallery',
855
+ name: name,
856
+ description: description,
857
+ images: images,
858
+ width: width,
859
+ height: height,
860
+ img_size: img_size,
861
+ Modula: $( '#Modula' ).val()
862
+ };
863
+
864
+ $_wizard.find( 'footer a' ).addClass( 'disabled' );
865
+ $_wizard.find( '.loading' ).show();
866
+
867
+ $.ajax( {
868
+ url: ajaxurl,
869
+ data: data,
870
+ dataType: 'json',
871
+ type: 'post',
872
+ error: function( a, b, c ) {
873
+ $( '#error' ).modal();
874
+ $( '#error' ).modal( 'open' );
875
  },
876
+ success: function( id ) {
877
+ id = $.trim( id );
878
+ $( '#name' ).val( '' );
879
+ $( '#description' ).val( '' );
880
+
881
+ $_success = $( '#success' );
882
+ $_success.find( '.code' ).val( '[Modula id=\'' + id + '\']' );
883
+ $_success.find( '.gallery-name' ).text( name );
884
+ $_success.find( '.customize' ).attr( 'href', '?page=modula-lite-edit&galleryId=' + id );
885
+
886
+ $_success.modal();
887
+ $_success.modal( 'open' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  }
889
+ } );
890
  }
891
+ };
892
+ }( jQuery );
893
+ var ImportWizard = function( $ ) {
894
+
895
+ var _curPage = 1;
896
+ var $_wizard = null;
897
+ var _lock = false;
898
+
899
+ return {
900
+ init: function() {
901
+ $_wizard = $( '#modula-wizard' );
902
+ $( '#external-galleries .js-select-all' ).on( 'click', function() {
903
+ $( '#external-galleries .js-item' ).each( function() {
904
+ this.checked = true;
905
+ } );
906
+ } );
907
+ // $_wizard.find('select').material_select();
908
+
909
+ /*! Wizard next */
910
+ $_wizard.find( '.next' ).click( function() {
911
+ if ( $( this ).hasClass( 'disabled' ) )
912
+ return;
913
+
914
+ // var branch = $("[name=ftg_source]:checked").val();
915
+ $( '.invalid' ).removeClass( 'invalid' );
916
+
917
+ if ( _curPage == 1 ) {
918
+ var source = $( '.import-source' ).val();
919
+ if ( 'undefined' === typeof source ) {
920
+ $( '.import-source' ).addClass( 'invalid' );
921
+ return false;
922
+ }
923
+ }
924
 
925
+ if ( _curPage == 2 ) {
926
+ var count = $( '#external-galleries .js-item:checked' ).length;
927
+ if ( count == 0 )
928
+ return false;
929
 
930
+ $_wizard.find( '.galleries-count' ).text( count );
931
+ }
932
 
933
+ /*! Wizard save */
934
+ if ( $_wizard.find( 'fieldset[data-step=' + _curPage + ']' ).data( 'save' ) ) {
935
+ ImportWizard.import();
936
+ return;
937
+ } else {
938
+ branch = 'images';
939
+ $_wizard.find( 'fieldset' ).hide();
940
+ _curPage ++;
941
+
942
+ var $fs = $_wizard.find( 'fieldset[data-step=' + _curPage + ']' );
943
+ $fs.show();
944
+
945
+ if ( $fs.data( 'save' ) ) {
946
+ $( '.prev' ).css( 'visibility', 'visible' );
947
+ $( this ).text( 'Proceed' );
948
+
949
+ } else {
950
+ $( this ).text( 'Next' );
951
+ }
952
+ }
953
 
954
+ $_wizard.find( '.prev' ).css( {
955
+ visibility: 'visible'
956
+ } );
957
+ } );
958
 
959
+ /*! Wizard prev */
960
+ $_wizard.find( '.prev' ).click( function() {
961
+ if ( $( this ).hasClass( 'disabled' ) )
962
+ return;
963
+ _curPage --;
964
 
965
+ var branch = $( '[name=ftg_source]:checked' ).val();
966
 
967
+ if ( _curPage == 1 ) {
968
+ $( this ).css( {
969
+ visibility: 'hidden'
970
+ } );
971
+ }
972
 
973
+ $_wizard.find( 'fieldset' ).hide();
974
+ var $fs = $_wizard.find( 'fieldset[data-step=' + _curPage + ']' );
975
+ if ( _curPage == 3 ) {
976
+ $fs = $fs.filter( '[data-branch=' + branch + ']' );
977
+ }
978
+ $fs.show();
979
+ $_wizard.find( '.next' ).css( {
980
+ visibility: 'visible'
981
+ } ).text( 'Next' );
982
+ } );
983
+ },
984
+ import: function() {
985
+ var source = $( '.import-source' ).val();
986
+ var ids = [];
987
+
988
+ $( '#external-galleries .js-item:checked' ).each( function( i, e ) {
989
+ ids.push( $( e ).val() );
990
+ } );
991
+
992
+ var data = {
993
+ action: 'modula_do_import_galleries',
994
+ source: source,
995
+ ids: ids.join( ',' ),
996
+ Modula: $( '#Modula' ).val()
997
+ };
998
+
999
+ $_wizard.find( 'footer a' ).addClass( 'disabled' );
1000
+ $_wizard.find( '.loading' ).show();
1001
+
1002
+ $.ajax( {
1003
+ url: ajaxurl,
1004
+ data: data,
1005
+ dataType: 'json',
1006
+ type: 'post',
1007
+ error: function( a, b, c ) {
1008
+ $( '#error' ).modal();
1009
+ $( '#error' ).modal( 'open' );
1010
  },
1011
+ success: function( r ) {
1012
+ if ( r.success ) {
1013
+ $( '#success' ).modal();
1014
+ $( '#success' ).modal( 'open' );
1015
+ } else {
1016
+ $( '#error' ).modal();
1017
+ $( '#error' ).modal( 'open' );
1018
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1019
  }
1020
+ } );
1021
  }
1022
+ };
1023
+ }( jQuery );
1024
+ jQuery( function() {
1025
+ jQuery( '.pickColor' ).wpColorPicker( {
1026
+ change: function( event, ui ) {},
1027
+ clear: function() {},
1028
+ hide: true,
1029
+ palettes: true
1030
+ } );
1031
+
1032
+ TG.bind();
1033
+ NewGalleryWizard.init();
1034
+ ImportWizard.init();
1035
+
1036
+ jQuery( 'a[href$=modula-gallery-upgrade]' ).addClass( 'modula-jump-pro-menu' ).click( function( e ) {
1037
+ e.preventDefault();
1038
+
1039
+ location.href = 'http://modula.greentreelabs.net/#buy';
1040
+ } );
1041
+ } );
admin/upgrade.php CHANGED
@@ -1,4 +1,30 @@
1
- <p>Redirecting to modula.greentreelabs.net</p>
2
- <script>
3
- location.href = "http://modula.greentreelabs.net/?utm_source=modulalite_inst&utm_medium=upgradepage&utm_campaign=Modula%20Lite#buy";
4
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'getting_started';
3
+ wp_enqueue_style( 'welcome', plugin_dir_url( __FILE__ ) . 'welcome-screen/assets/welcome.css' );
4
+ ?>
5
+
6
+ <div class="wrap about-wrap modula-wrap">
7
+ <h1><?php echo esc_html__( 'Modula - Why you should be upgrading', 'modula-gallery' ); ?></h1>
8
+
9
+ <p class="about-text">
10
+ <?php echo esc_html__( 'Introducing one of the most powerful gallery system ever made for WordPress. Modula is an exquisite WordPress Gallery Plugin perfectly fit for any needs. We\'ve outlined below the PRO features.', 'modula-gallery' ) ?>
11
+ </p>
12
+ <div class="wp-badge"></div>
13
+
14
+ <h2 class="nav-tab-wrapper wp-clearfix">
15
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=modula-lite-gallery-upgrade&tab=getting_started' ) ); ?>" class="nav-tab <?php echo $active_tab == 'getting_started' ? 'nav-tab-active' : ''; ?>"><?php _e( 'What&#8217;s included with PRO' ); ?></a>
16
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=modula-lite-gallery-upgrade&tab=comparison_table' ) ); ?>" class="nav-tab <?php echo $active_tab == 'comparison_table' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Comparison Table: Lite vs PRO' ); ?></a>
17
+ </h2>
18
+
19
+ <?php
20
+ switch ( $active_tab ) {
21
+ case 'getting_started':
22
+ require_once plugin_dir_path( __FILE__ ) . 'welcome-screen/sections/getting-started.php';
23
+ break;
24
+ case 'comparison_table':
25
+ require_once plugin_dir_path( __FILE__ ) . 'welcome-screen/sections/comparison-table.php';
26
+ break;
27
+ }
28
+ ?>
29
+
30
+ </div> <!--/.about-wrap-->
admin/welcome-screen/assets/welcome.css ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .featured-section.features .row {
2
+ display: inline-block;
3
+ width: 97%;
4
+ padding: 15px;
5
+ border-bottom: 1px solid rgba(0, 0, 0, .06);
6
+ }
7
+
8
+ .featured-section.features .row .dashicons-yes {
9
+ color: #2cbe4e;
10
+ }
11
+
12
+ .featured-section.features .row .dashicons-no-alt {
13
+ color: #FF3D2E;
14
+ }
15
+
16
+ .featured-section.features .row > div {
17
+ display: inline-block;
18
+ float: left;
19
+ width: 15%;
20
+ text-align: center;
21
+ }
22
+
23
+ .featured-section.features .row > .feature {
24
+ width: 70%;
25
+ text-align: left;
26
+ }
27
+
28
+ .featured-section .free-pro-table {
29
+ border-spacing: 0;
30
+ width: 100%;
31
+ margin-top:40px;
32
+ }
33
+
34
+ .featured-section .free-pro-table th {
35
+ padding-bottom: 20px;
36
+ text-align: center;
37
+ }
38
+
39
+ .featured-section .free-pro-table td {
40
+ border-top: 1px solid #ccc;
41
+ padding: 20px 0 25px;
42
+ }
43
+
44
+ .featured-section .free-pro-table h3 {
45
+ margin: 0;
46
+ }
47
+
48
+ .featured-section .free-pro-table td p {
49
+ margin: 0;
50
+ }
51
+
52
+ .featured-section .free-pro-table .modula-feature,
53
+ .featured-section .free-pro-table .modula-pro-feature{
54
+ text-align: center;
55
+ width: 15%;
56
+ }
57
+
58
+ .featured-section .free-pro-table .dashicons-yes {
59
+ color: #00A878;
60
+ }
61
+
62
+ .featured-section .free-pro-table .dashicons-no-alt {
63
+ color: #ff3439;
64
+ }
65
+
66
+ .featured-section .free-pro-table .dashicons-before:before,
67
+ .featured-section .free-pro-table .dashicons-before:before {
68
+ font-size: 35px;
69
+ height: 35px;
70
+ width: 35px;
71
+ }
72
+ .modula-wrap .button-hero .dashicons{
73
+ font-size:16px;
74
+ vertical-align:middle;
75
+ }
76
+
77
+ .text-right {
78
+ text-align: right;
79
+ }
80
+
81
+ .text-left {
82
+ text-align: left;
83
+ }
84
+
85
+ .text-center {
86
+ text-align: center;
87
+ }
admin/welcome-screen/sections/comparison-table.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die;
4
+ }
5
+ /**
6
+ * Features
7
+ */
8
+
9
+ $features = array(
10
+ 'post-formats' => array(
11
+ 'label' => 'Images per gallery',
12
+ 'modula' => '20',
13
+ 'modula-pro' => 'Unlimited',
14
+ ),
15
+ 'slider-layouts' => array(
16
+ 'label' => 'Filters',
17
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
18
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
19
+ ),
20
+ 'news-ticker' => array(
21
+ 'label' => 'Reload page on filter click',
22
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
23
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
24
+ ),
25
+ 'banner-ads' => array(
26
+ 'label' => 'Change Filter Text',
27
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
28
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
29
+ ),
30
+ 'video-widgets' => array(
31
+ 'label' => 'Multiple Included LightBox Scripts',
32
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
33
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
34
+ ),
35
+ 'color-schemes' => array(
36
+ 'label' => 'Image Loaded Effects',
37
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
38
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
39
+ ),
40
+ 'typography' => array(
41
+ 'label' => 'Image Hoever Effects',
42
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
43
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
44
+ ),
45
+ 'updates' => array(
46
+ 'label' => 'Feature & Security Updates',
47
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
48
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
49
+ ),
50
+ 'suppoprt' => array(
51
+ 'label' => 'Priority Support',
52
+ 'modula' => '<span class="dashicons dashicons-no-alt"></span>',
53
+ 'modula-pro' => '<span class="dashicons dashicons-yes"></span>',
54
+ ),
55
+ );
56
+ ?>
57
+ <div class="featured-section features">
58
+ <table class="free-pro-table">
59
+ <thead>
60
+ <tr>
61
+ <th></th>
62
+ <th>LITE</th>
63
+ <th>PRO</th>
64
+ </tr>
65
+ </thead>
66
+ <tbody>
67
+ <?php foreach ( $features as $feature ): ?>
68
+ <tr>
69
+ <td class="feature">
70
+ <h3>
71
+ <?php echo $feature['label']; ?>
72
+ </h3>
73
+ </td>
74
+ <td class="modula-feature">
75
+ <?php echo $feature['modula']; ?>
76
+ </td>
77
+ <td class="modula-pro-feature">
78
+ <?php echo $feature['modula-pro']; ?>
79
+ </td>
80
+ </tr>
81
+ <?php endforeach; ?>
82
+ <tr>
83
+ <td></td>
84
+ <td colspan="2" class="text-right">
85
+ <a href="https://www.wp-modula.com/?utm_source=worg&utm_medium=about-page&utm_campaign=upsell" target="_blank"
86
+ class="button button-primary button-hero"><span class="dashicons dashicons-cart"></span> Get Modula Pro!</a>
87
+ </td>
88
+ </tr>
89
+ </tbody>
90
+ </table>
91
+ </div>
admin/welcome-screen/sections/getting-started.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="feature-section one-col">
2
+ <div class="col">
3
+ <h2 style="font-size: 2.5em;"><?php echo __( 'Powerful, Yet Simple, Image Gallery Plugin', 'modula-gallery' ); ?></h2>
4
+ <p class="lead-description"><?php echo __( 'Modula helps <u>casual users</u> create an image gallery in 30s or less.', 'modula-gallery' ); ?></p>
5
+ <p><?php echo __( 'Modula is a WordPress photo and image gallery plugin that makes it easy for users of all levels to build beautiful grid galleries. Modula’s <u>unique grid system</u> ensures your gallery avoids the boring square look found in many other plugins. Just give Modula a size and a list of images and it does all the work for you. If you’re a casual WordPress user, you can create a stylish gallery in seconds without digging into detailed settings pages. ', 'modula-gallery' ); ?></p>
6
+ <div class="center">
7
+ <a href="https://www.wp-modula.com/?utm_source=worg&utm_medium=about-page&utm_campaign=upsell" target="_blank" class="button button-primary button-hero"><span class="dashicons dashicons-cart"></span>
8
+ <?php echo __( 'Get Modula Pro', 'modula-gallery' ); ?>
9
+ </a>
10
+ </div>
11
+ </div>
12
+ </div>
13
+
14
+ <hr/>
15
+
16
+ <h2><?php _e( 'Modula\'s Main Features' ); ?></h2>
17
+
18
+ <div class="feature-section three-col">
19
+ <div class="col">
20
+ <h3><?php echo __( 'Stylish & Complex Layouts', 'modula-gallery' ); ?></h3>
21
+ <p><?php echo __( 'Stylish grids that go beyond the boring squares. With Modula, creating a stylish and good looking image gallery this is no longer the case. ', 'modula-gallery' ); ?></p>
22
+ </div>
23
+
24
+ <div class="col">
25
+ <h3><?php echo __( 'Gallery Filters', 'modula-gallery' ); ?></h3>
26
+ <p><?php echo __( 'Let visitors filter your gallery items with a single click. Create as many gallery filters as you want. These filters also <u>work in real-time</u> ⭐', 'modula-gallery' ); ?></p>
27
+ </div>
28
+ <div class="col">
29
+ <h3><?php echo __( 'Multiple Gallery Support', 'modula-gallery' ); ?></h3>
30
+ <p><?php echo __( 'Modula allows you to add as many galleries as you want to the same page. Modula is very versatile & flexible. You should take it our for a spin. ', 'modula-gallery' ); ?></p>
31
+ </div>
32
+
33
+ <div class="col">
34
+ <h3><?php echo __( 'Widget Support', 'modula-gallery' ); ?></h3>
35
+ <p><?php echo __( 'Display your galleries inside WordPress widgets. This makes Modula really powerful. Display your image galleries where your heart desires.', 'modula-gallery' ); ?></p>
36
+ </div>
37
+
38
+ <div class="col">
39
+ <h3><?php echo __( 'Responsive & Retina-ready', 'modula-gallery' ); ?></h3>
40
+ <p><?php echo __( 'Every gallery created with Modula is responsive, mobile ready & retina ready. <b>Your galleries will look beautiful on any device</b>, and any display.', 'modula-gallery' ); ?></p>
41
+ </div>
42
+
43
+ <div class="col">
44
+ <h3><?php echo __( 'Custom Caption Support', 'modula-gallery' ); ?></h3>
45
+ <p><?php echo __( 'This feature deserves a parade down the center of town! Spruce up your image galleries with custom captions, animations & colors.', 'modula-gallery' ); ?></p>
46
+ </div>
47
+ </div>
48
+
49
+ <div class="center">
50
+ <a href="https://www.wp-modula.com/?utm_source=worg&utm_medium=about-page&utm_campaign=upsell" target="_blank" class="button button-primary button-hero"><span class="dashicons dashicons-cart"></span>
51
+ <?php echo __( 'Get Modula Pro!', 'modula-gallery' ); ?></a>
52
+ </div>
53
+
54
+ <br/>
55
+ <hr/>
56
+
57
+ <div class="feature-section three-col">
58
+
59
+ <div class="col">
60
+ <h3><?php echo __( 'Multiple LightBox Support', 'modula-gallery' ); ?></h3>
61
+ <p><?php echo __( 'Modula <b>supports 6 different lightbox scripts</b>: <em>Lightgallery, Lightbox2, PrettyPhoto, Magnific Gallery, SwipeBox and FancyBox</em>. Showcase your image galleries with style.', 'modula-gallery' ); ?></p>
62
+ </div>
63
+
64
+ <div class="col">
65
+ <h3><?php echo __( 'Social Sharing Friendly', 'modula-gallery' ); ?></h3>
66
+ <p><?php echo __( 'Built-in social sharing buttons that will help you boost your page views. <b>Reach your audience faster and easier</b> with social tools built-in.', 'modula-gallery' ); ?></p>
67
+ </div>
68
+
69
+ <div class="col">
70
+ <h3><?php echo __( 'Multiple Image Hover Effects', 'modula-gallery' ); ?></h3>
71
+ <p><?php echo __( 'Choose from 12 different hover effects. Pick the ones that best represent your personality. Easily <u>showcase your images in style</u>.', 'modula-gallery' ); ?></p>
72
+ </div>
73
+
74
+ <div class="col">
75
+ <h3><?php echo __( 'Make It Your Own', 'modula-gallery' ); ?></h3>
76
+ <p><?php echo __( 'Build your own effects for even more control. Complex, built-in, styles will help you personalize Modula to your own liking.', 'modula-gallery' ); ?></p>
77
+ </div>
78
+
79
+ <div class="col">
80
+ <h3><?php echo __( 'Security Updates', 'modula-gallery' ); ?></h3>
81
+ <p><?php echo __( 'Modula is constantly evolving. New features & security updates are first released for PRO users.', 'modula-gallery' ); ?></p>
82
+ </div>
83
+
84
+ <div class="col">
85
+ <h3><?php echo __( 'Premium & Priority Support', 'modula-gallery' ); ?></h3>
86
+ <p><?php echo __( 'If you need help just post a ticket and our tech guys will get back to you asap. We have a stellar support team ready to help you in no time.', 'modula-gallery' ); ?></p>
87
+ </div>
88
+
89
+ </div>
90
+
91
+ <hr/>
92
+
93
+ <div class="feature-section two-col">
94
+ <div class="col">
95
+ <h3><?php echo __( 'Built on Material Design', 'modula-gallery' ); ?></h3>
96
+ <p><?php echo __( 'Modula is built entirely on Material Design principles. Starting with the code layout and finishing up with the smallest animation, Modula screams Material Design from it\'s every pore. <br \/><br \/> Based on the most popular front-end design framework of the century, we\'ve striven to create a modern, flexible and beautiful implementation of Material Design in Modula. <br \/><br \/> We believe you\'ll <b>enjoy it</b>!', 'modula-gallery' ); ?></p>
97
+ </div>
98
+ <div class="col">
99
+ <img src="<?php echo esc_url( MODULA_PLUGIN_DIR_URL ); ?>admin/images/material-design.gif" alt="Material Design GIF">
100
+ </div>
101
+ </div>
102
+
103
+ <hr/>
104
+
105
+ <hr/>
106
+
107
+ <div class="changelog">
108
+ <h2><?php
109
+ printf( /* translators: %s: smiling face with smiling eyes emoji */
110
+ __( 'Even More Plugin Flexibility %s', 'modula-gallery' ), '&#x1F60A' );
111
+ ?></h2>
112
+
113
+ <div class="under-the-hood three-col">
114
+ <div class="col">
115
+ <h3><?php echo __( 'Drag & Drop Images', 'modula-gallery' ); ?></h3>
116
+ <p><?php echo __( 'Re-ordering couldn\'t be easier. Just drag & drop your images around until you find the perfect positioning. Be done in 30s or less.', 'modula-gallery' ); ?></p>
117
+ </div>
118
+ <div class="col">
119
+ <h3><?php echo __( 'Custom Scripts & CSS Support', 'modula-gallery' ); ?></h3></h3>
120
+ <p><?php echo __( 'Modula comes with built-in custom CSS support. Want to style one of your galleries in a particular way? Add some CSS. Want to include a custom tracking script in just one of your galleries? Add away. Simplicity, at it\'s best.', 'modula-gallery' ); ?></p>
121
+ </div>
122
+ <div class="col">
123
+ <h3><?php echo __( 'Developer Friendly' ); ?></h3>
124
+ <p><?php echo __( 'Modula\'s been built with both the user & the developer in mind. Friendly code, well documented so you can easily add your changes. Filters & Hooks, included with every purchase.', 'modula-gallery' ); ?></p>
125
+ </div>
126
+
127
+ </div>
128
+ </div>
129
+
130
+ <div class="center">
131
+ <a href="https://www.wp-modula.com/?utm_source=worg&utm_medium=about-page&utm_campaign=upsell" target="_blank" class="button button-primary button-hero"><span class="dashicons dashicons-cart"></span>
132
+ <?php echo __( 'Get Modula Pro!', 'modula-gallery' ); ?></a>
133
+ </div><br/>
lib/db-class.php CHANGED
@@ -1,168 +1,193 @@
1
  <?php
 
2
  class ModulaLiteDB {
3
-
4
  private static $pInstance;
5
-
6
- private function __construct() {}
7
-
 
8
  public static function getInstance() {
9
- if(!self::$pInstance) {
10
  self::$pInstance = new ModulaLiteDB();
11
  }
12
-
13
  return self::$pInstance;
14
  }
15
-
16
  public function query() {
17
- return "Test";
18
  }
19
-
20
- public function update_config($id, $config)
21
- {
22
  global $wpdb;
23
 
24
- unset($config->Id);
 
 
25
 
26
- $wpdb->update($wpdb->ModulaGalleries, array('configuration' => $config), array('Id' => $id));
27
-
28
  }
29
 
30
- public function getConfig($id)
31
- {
32
- $data = $this->getGalleryById($id);
33
  return $data;
34
  }
35
-
36
- public function addGallery($data) {
37
- global $wpdb;
38
-
39
- $data=(array)$data;
40
 
41
- unset($data['Id']);
 
 
 
42
 
43
- $configuration = array('Id' => '', 'configuration' => json_encode($data));
44
 
45
- $galleryAdded = $wpdb->insert( $wpdb->ModulaGalleries, $configuration);
46
- return $galleryAdded;
 
 
 
47
  }
48
-
49
  public function getNewGalleryId() {
50
  global $wpdb;
 
51
  return $wpdb->insert_id;
52
  }
53
-
54
- public function deleteGallery($gid) {
55
  global $wpdb;
56
 
57
- $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->ModulaImages WHERE gid = %d", $gid));
58
- $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->ModulaGalleries WHERE Id = %d", $gid));
59
  }
60
-
61
- public function editGallery($gid, $data) {
62
  global $wpdb;
63
 
64
- $data = json_encode($data);
65
- $imageEdited = $wpdb->update( $wpdb->ModulaGalleries, array('configuration' => $data), array( 'Id' => $gid ) );
66
- print_r($wpdb->last_error);
 
67
  return $imageEdited;
68
  }
69
 
70
- public function getIDbyGUID( $guid )
71
- {
72
  global $wpdb;
 
73
  return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid=%s", $guid ) );
74
  }
75
-
76
- public function getGalleryById($id, $default=null) {
77
  global $wpdb;
78
- $gallery = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->ModulaGalleries WHERE Id = %s", $id));
79
- $data = json_decode($gallery->configuration);
80
- if($default)
81
- foreach ( $default as $k => $v )
82
- if(! isset($data->$k))
83
  $data->$k = $v;
 
 
 
84
 
85
  $data->id = $id;
 
86
  return $data;
87
  }
88
-
89
- public function getLastGalleryId()
90
- {
91
- global $wpdb;
92
- $galleryResults = $wpdb->get_results("SELECT Id FROM $wpdb->ModulaGalleries ORDER BY Id DESC LIMIT 1");
93
  return $galleryResults[0];
94
  }
 
95
  public function getGalleries() {
96
  global $wpdb;
97
- $galleryResults = $wpdb->get_results("SELECT * FROM $wpdb->ModulaGalleries");
 
98
  return $galleryResults;
99
  }
100
-
101
- public function addImage($gid, $image) {
102
- global $wpdb;
103
- $imageAdded = $wpdb->insert( $wpdb->ModulaImages, array( 'gid' => $gid, 'imagePath' => $image, 'title' => "", 'description' => "", 'sortOrder' => 0 ) );
 
 
 
 
 
 
 
104
  return $imageAdded;
105
  }
106
 
107
- public function addImages($gid, $images) {
108
- global $wpdb;
109
- foreach ($images as $image) {
110
- $imageAdded = $wpdb->insert( $wpdb->ModulaImages,
111
- array( 'gid' => $gid, 'imagePath' => $image->imagePath,
112
- 'description' => isset($image->description) ? $image->description : '',
113
- 'title' => isset($image->title) ? $image->title : '',
114
- 'imageId' => $image->imageId, 'sortOrder' => 0 ));
115
- $id = $wpdb->insert_id;
116
- $wpdb->update($wpdb->ModulaImages, array('sortOrder' => $id), array('Id' => $id));
117
- }
 
 
 
 
118
  return true;
119
  }
120
-
121
- public function addFullImage($data) {
122
- global $wpdb;
123
  $imageAdded = $wpdb->insert( $wpdb->ModulaImages, $data );
 
124
  return $imageAdded;
125
  }
126
-
127
- public function deleteImage($id) {
128
  global $wpdb;
129
- if($wpdb->query($wpdb->prepare("DELETE FROM $wpdb->ModulaImages WHERE Id = %d", $id)) === FALSE) {
130
  return false;
131
- }
132
- else {
133
  return true;
134
  }
135
  }
136
-
137
- public function editImage($id, $data) {
138
  global $wpdb;
139
  $imageEdited = $wpdb->update( $wpdb->ModulaImages, $data, array( 'Id' => $id ) );
 
140
  //print $wpdb->last_query;
141
  return $imageEdited;
142
  }
143
 
144
- public function sortImages($ids) {
145
  global $wpdb;
146
  $index = 1;
147
- foreach($ids as $id)
148
- {
149
- $data = array('sortOrder' => $index++);
150
  $wpdb->update( $wpdb->ModulaImages, $data, array( 'Id' => $id ) );
151
  }
 
152
  return true;
153
  }
154
-
155
- public function getImagesByGalleryId($gid) {
156
  global $wpdb;
157
- $e = 22 - 1 - 1;
158
- $imageResults = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->ModulaImages WHERE gid = %d ORDER BY sortOrder ASC LIMIT $e", $gid));
 
159
  return $imageResults;
160
  }
161
-
162
- public function getGalleryByGalleryId($gid) {
163
  global $wpdb;
164
- $gallery = $wpdb->get_results($wpdb->prepare("SELECT $wpdb->ModulaGalleries.*, $wpdb->ModulaImages.* FROM $wpdb->ModulaGalleries INNER JOIN $wpdb->ModulaImages ON ($wpdb->ModulaGalleries.Id = $wpdb->ModulaImages.gid) WHERE $wpdb->ModulaGalleries.Id = %d ORDER BY sortOrder ASC", $gid));
 
165
  return $gallery;
166
  }
167
  }
 
168
  ?>
1
  <?php
2
+
3
  class ModulaLiteDB {
4
+
5
  private static $pInstance;
6
+
7
+ private function __construct() {
8
+ }
9
+
10
  public static function getInstance() {
11
+ if ( ! self::$pInstance ) {
12
  self::$pInstance = new ModulaLiteDB();
13
  }
14
+
15
  return self::$pInstance;
16
  }
17
+
18
  public function query() {
19
+ return "Test";
20
  }
21
+
22
+ public function update_config( $id, $config ) {
 
23
  global $wpdb;
24
 
25
+ unset( $config->Id );
26
+
27
+ $wpdb->update( $wpdb->ModulaGalleries, array( 'configuration' => $config ), array( 'Id' => $id ) );
28
 
 
 
29
  }
30
 
31
+ public function getConfig( $id ) {
32
+ $data = $this->getGalleryById( $id );
33
+
34
  return $data;
35
  }
 
 
 
 
 
36
 
37
+ public function addGallery( $data ) {
38
+ global $wpdb;
39
+
40
+ $data = (array) $data;
41
 
42
+ unset( $data['Id'] );
43
 
44
+ $configuration = array( 'Id' => '', 'configuration' => json_encode( $data ) );
45
+
46
+ $galleryAdded = $wpdb->insert( $wpdb->ModulaGalleries, $configuration );
47
+
48
+ return $galleryAdded;
49
  }
50
+
51
  public function getNewGalleryId() {
52
  global $wpdb;
53
+
54
  return $wpdb->insert_id;
55
  }
56
+
57
+ public function deleteGallery( $gid ) {
58
  global $wpdb;
59
 
60
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->ModulaImages WHERE gid = %d", $gid ) );
61
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->ModulaGalleries WHERE Id = %d", $gid ) );
62
  }
63
+
64
+ public function editGallery( $gid, $data ) {
65
  global $wpdb;
66
 
67
+ $data = json_encode( $data );
68
+ $imageEdited = $wpdb->update( $wpdb->ModulaGalleries, array( 'configuration' => $data ), array( 'Id' => $gid ) );
69
+ print_r( $wpdb->last_error );
70
+
71
  return $imageEdited;
72
  }
73
 
74
+ public function getIDbyGUID( $guid ) {
 
75
  global $wpdb;
76
+
77
  return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid=%s", $guid ) );
78
  }
79
+
80
+ public function getGalleryById( $id, $default = null ) {
81
  global $wpdb;
82
+ $gallery = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->ModulaGalleries WHERE Id = %s", $id ) );
83
+ $data = json_decode( $gallery->configuration );
84
+ if ( $default ) {
85
+ foreach ( $default as $k => $v ) {
86
+ if ( ! isset( $data->$k ) ) {
87
  $data->$k = $v;
88
+ }
89
+ }
90
+ }
91
 
92
  $data->id = $id;
93
+
94
  return $data;
95
  }
96
+
97
+ public function getLastGalleryId() {
98
+ global $wpdb;
99
+ $galleryResults = $wpdb->get_results( "SELECT Id FROM $wpdb->ModulaGalleries ORDER BY Id DESC LIMIT 1" );
100
+
101
  return $galleryResults[0];
102
  }
103
+
104
  public function getGalleries() {
105
  global $wpdb;
106
+ $galleryResults = $wpdb->get_results( "SELECT * FROM $wpdb->ModulaGalleries" );
107
+
108
  return $galleryResults;
109
  }
110
+
111
+ public function addImage( $gid, $image ) {
112
+ global $wpdb;
113
+ $imageAdded = $wpdb->insert( $wpdb->ModulaImages, array(
114
+ 'gid' => $gid,
115
+ 'imagePath' => $image,
116
+ 'title' => "",
117
+ 'description' => "",
118
+ 'sortOrder' => 0,
119
+ ) );
120
+
121
  return $imageAdded;
122
  }
123
 
124
+ public function addImages( $gid, $images ) {
125
+ global $wpdb;
126
+ foreach ( $images as $image ) {
127
+ $imageAdded = $wpdb->insert( $wpdb->ModulaImages, array(
128
+ 'gid' => $gid,
129
+ 'imagePath' => $image->imagePath,
130
+ 'description' => isset( $image->description ) ? $image->description : '',
131
+ 'title' => isset( $image->title ) ? $image->title : '',
132
+ 'imageId' => $image->imageId,
133
+ 'sortOrder' => 0,
134
+ ) );
135
+ $id = $wpdb->insert_id;
136
+ $wpdb->update( $wpdb->ModulaImages, array( 'sortOrder' => $id ), array( 'Id' => $id ) );
137
+ }
138
+
139
  return true;
140
  }
141
+
142
+ public function addFullImage( $data ) {
143
+ global $wpdb;
144
  $imageAdded = $wpdb->insert( $wpdb->ModulaImages, $data );
145
+
146
  return $imageAdded;
147
  }
148
+
149
+ public function deleteImage( $id ) {
150
  global $wpdb;
151
+ if ( $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->ModulaImages WHERE Id = %d", $id ) ) === false ) {
152
  return false;
153
+ } else {
 
154
  return true;
155
  }
156
  }
157
+
158
+ public function editImage( $id, $data ) {
159
  global $wpdb;
160
  $imageEdited = $wpdb->update( $wpdb->ModulaImages, $data, array( 'Id' => $id ) );
161
+
162
  //print $wpdb->last_query;
163
  return $imageEdited;
164
  }
165
 
166
+ public function sortImages( $ids ) {
167
  global $wpdb;
168
  $index = 1;
169
+ foreach ( $ids as $id ) {
170
+ $data = array( 'sortOrder' => $index++ );
 
171
  $wpdb->update( $wpdb->ModulaImages, $data, array( 'Id' => $id ) );
172
  }
173
+
174
  return true;
175
  }
176
+
177
+ public function getImagesByGalleryId( $gid ) {
178
  global $wpdb;
179
+ $e = 22 - 1 - 1;
180
+ $imageResults = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->ModulaImages WHERE gid = %d ORDER BY sortOrder ASC LIMIT $e", $gid ) );
181
+
182
  return $imageResults;
183
  }
184
+
185
+ public function getGalleryByGalleryId( $gid ) {
186
  global $wpdb;
187
+ $gallery = $wpdb->get_results( $wpdb->prepare( "SELECT $wpdb->ModulaGalleries.*, $wpdb->ModulaImages.* FROM $wpdb->ModulaGalleries INNER JOIN $wpdb->ModulaImages ON ($wpdb->ModulaGalleries.Id = $wpdb->ModulaImages.gid) WHERE $wpdb->ModulaGalleries.Id = %d ORDER BY sortOrder ASC", $gid ) );
188
+
189
  return $gallery;
190
  }
191
  }
192
+
193
  ?>
lib/gallery-class.php CHANGED
@@ -1,376 +1,374 @@
1
  <?php
2
 
3
- define("MODULA_DB_MODE", 1);
4
- define("MODULA_WP_MODE", 2);
5
 
6
- if (!class_exists( "ModulaLiteFE" )) {
7
  class ModulaLiteFE {
8
 
9
  private $defaultValues;
10
 
11
- public function __construct($db, $id, $defaultValues)
12
- {
13
- $this->gallery = new stdClass();
14
- $this->db = $db;
15
- $this->wp_images = array();
16
- $this->images = array();
17
- $this->id = $id;
18
  $this->defaultValues = $defaultValues;
19
  $this->init();
20
- }
21
-
22
- public function init()
23
- {
24
- $this->gallery = $this->db->getGalleryById($this->id);
25
  foreach ( $this->defaultValues as $k => $v ) {
26
- if(! isset($this->gallery->$k))
27
  $this->gallery->$k = $v;
 
28
  }
29
 
30
  $this->gallery->mode = MODULA_DB_MODE;
31
-
32
- if(! empty($_GET["debug"]))
33
- {
34
- print "<!--\n";
35
- print "Gallery id: $this->id\n";
36
- print "settings:\n";
37
- print_r($this->gallery);
38
- print "\n-->\n";
39
- }
40
-
41
- if(! $this->gallery->hasResizedImages)
42
- {
43
  $images = $this->db->getImagesByGalleryId( $this->id );
44
  $images = ModulaLiteTools::check_and_resize( $images, $this->gallery->img_size );
45
- foreach($images as $img) {
46
- $this->db->editImage( $img->Id, (array)$img );
47
  }
48
  $this->gallery->hasResizedImages = true;
49
- $this->db->editGallery($this->id, (array)$this->gallery);
50
  }
51
-
52
- $this->images = $this->loadModulaImages();
53
 
54
- $ids = array();
 
 
55
  $idx = 0;
56
- foreach($this->images as $img)
57
- $ids[] = $img->imageId < 0 ? $img->imageId - ($idx++) : $img->imageId;
 
58
 
59
- if(count($this->images) > 0 && $this->gallery->importedFrom != 'NextGen')
60
- $this->loadWPImages($ids);
 
61
  }
62
-
63
- public function loadWPImages($ids)
64
- {
65
- $args = array(
66
- 'post_type' => 'attachment',
67
  'posts_per_page' => -1,
68
- 'include' => $ids
69
  );
70
-
71
- $this->wp_images = get_posts($args);
72
- if($this->gallery->lightbox == "attachment-page")
73
- {
74
- foreach($this->wp_images as $att)
75
- {
76
- $att->url = get_attachment_link($att->ID);
 
 
 
 
77
  }
78
  }
79
-
80
-
81
- if($this->gallery->mode == MODULA_DB_MODE)
82
- {
83
- foreach($this->wp_images as $att)
84
- {
85
-
86
- //$this->images[$att->ID]->imagePath = $att->guid;
87
- $this->images[$att->ID]->url = $att->url;
88
- $this->images[$att->ID]->alt = get_post_meta( $att->ID, '_wp_attachment_image_alt', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
 
90
  }
91
- }
92
-
93
- public function initByImageIds($ids)
94
- {
95
- $this->imageIds = $ids;
96
- $this->gallery->mode = MODULA_WP_MODE;
97
- $this->loadWPImages($ids);
98
-
99
- foreach($this->wp_images as $att)
100
- {
101
- $image = new stdClass();
102
- $image->imageId = $att->ID;
103
- $image->url = $att->url;
104
- $image->Id = $att->ID;
105
- $image->imagePath = $att->guid;
106
- $image->link = get_post_meta($att->ID, "_modula_link", true);
107
-
108
- switch($this->gallery->wp_field_caption)
109
- {
110
- case 'title':
111
- $image->description = $att->post_title;
112
- break;
113
- case 'caption':
114
- $image->description = $att->post_excerpt;
115
- break;
116
- case 'description':
117
- $image->description = $att->post_content;
118
- break;
119
- }
120
- $this->images[$image->imageId] = $image;
121
- }
122
-
123
- }
124
-
125
- public function getGallery()
126
- {
127
  return $this->gallery;
128
  }
129
-
130
- private function getLightboxClass($image)
131
- {
132
- if(! empty($image->link))
133
  return '';
134
-
135
- if(empty($this->gallery->lightbox))
 
136
  return '';
137
-
 
138
  return 'modula-lightbox';
139
  }
140
-
141
- private function getHoverEffect($code)
142
- {
143
  global $ob_ModulaLite;
144
- foreach($ob_ModulaLite->hoverEffects as $effect)
145
- if($effect->code == $code)
146
  return $effect;
 
 
147
  }
148
-
149
- private function getLink($image)
150
- {
151
- if(! empty($image->link))
152
  return "href='" . $image->link . "'";
 
153
 
154
- if(empty($this->gallery->lightbox))
155
  return '';
 
156
 
157
- if($this->gallery->lightbox == 'attachment-page')
158
  return "href='" . $image->url . "'";
 
159
 
160
  return "href='" . wp_get_attachment_url( $image->imageId ) . "'";
161
  }
162
-
163
- private function getTarget($image)
164
- {
165
- if(! empty($image->target))
166
  return "target='" . $image->target . "'";
167
-
 
168
  // if($this->gallery->blank == 'T')
169
  // return "target='_blank'";
170
-
171
  return '';
172
  }
173
-
174
- private function getdef($value, $default)
175
- {
176
- if($value == NULL || empty($value))
177
  return $default;
178
-
 
179
  return $value;
180
  }
181
-
182
- private function toRGB($Hex){
183
-
184
- if (substr($Hex,0,1) == "#")
185
- $Hex = substr($Hex,1);
186
-
187
- $R = substr($Hex,0,2);
188
- $G = substr($Hex,2,2);
189
- $B = substr($Hex,4,2);
190
-
191
- $R = hexdec($R);
192
- $G = hexdec($G);
193
- $B = hexdec($B);
194
-
195
- $RGB['R'] = $R;
196
- $RGB['G'] = $G;
197
- $RGB['B'] = $B;
198
-
199
- $RGB[0] = $R;
200
- $RGB[1] = $G;
201
- $RGB[2] = $B;
202
-
203
- return $RGB;
204
-
205
- }
206
-
207
- static public function slugify($text)
208
- {
209
- $text = preg_replace('~[^\\pL\d]+~u', '-', $text);
210
- $text = trim($text, '-');
211
- $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
212
- $text = strtolower($text);
213
- $text = preg_replace('~[^-\w]+~', '', $text);
214
-
215
- if (empty($text))
216
- {
217
- return 'n-a';
218
- }
219
-
220
- return $text;
221
  }
222
 
223
- private function v($name)
224
- {
225
- switch($this->mode)
226
- {
227
  default:
228
  case MODULA_DB_MODE:
229
  return $this->gallery->$name;
230
  break;
231
  case MODULA_WP_MODE:
232
- return $this->settings[$name];
233
  }
234
  }
235
 
236
- public function render()
237
- {
238
- $rid = rand(1, 1000);
239
-
240
- if($this->gallery->shuffle == 'T')
241
- shuffle($this->images);
242
-
243
- $gallery = $this->gallery;
244
 
245
- $html = "";
246
 
247
  $html .= "<style>\n";
248
 
249
- if($this->gallery->borderSize)
250
  $html .= "#jtg-$this->id$rid .item { border: " . $this->gallery->borderSize . "px solid " . $this->gallery->borderColor . "; }\n";
251
-
252
- if($this->gallery->borderRadius)
 
253
  $html .= "#jtg-$this->id$rid .item { border-radius: " . $this->gallery->borderRadius . "px; }\n";
 
 
 
 
 
254
 
255
- if($this->gallery->shadowSize)
256
- $html .= "#jtg-$this->id$rid .item { box-shadow: " . $this->gallery->shadowColor ." 0px 0px " . $this->gallery->shadowSize . "px; }\n";
257
-
258
- if($this->gallery->socialIconColor)
259
  $html .= "#jtg-$this->id$rid .item .jtg-social a { color: " . $this->gallery->socialIconColor . " }\n";
 
 
 
260
 
261
- $html .= "#jtg-$this->id$rid .item .caption { background-color: ".$this->gallery->captionColor."; }\n";
262
-
263
- $html .= "#jtg-$this->id$rid .item .figc { color: ".$this->gallery->captionColor."; font-size: ".$this->gallery->captionFontSize."px; }\n";
264
-
265
- $html .= "#jtg-$this->id$rid .item .figc h2.jtg-title { font-size: ".$this->gallery->titleFontSize."px; }\n";
266
-
267
- $html .= "#jtg-$this->id$rid .item { transform: scale(" .$gallery->loadedScale/100 .") translate(" . $gallery->loadedHSlide . 'px,' . $gallery->loadedVSlide . "px) rotate(" . $gallery->loadedRotate . "deg); }\n";
268
 
269
-
270
- $html .= "#jtg-$this->id$rid .items { width:".$this->gallery->width. "; height:".$this->gallery->height. "px; }\n";
271
-
272
- $html .= "#jtg-$this->id$rid .items .figc p.description { color:".$this->gallery->captionColor."; }\n";
273
 
 
274
 
275
- if(strlen($this->gallery->style))
 
 
 
 
 
 
276
  $html .= $this->gallery->style;
 
277
 
278
- $html .= "</style>\n";
279
-
280
- $id = $this->id;
281
- $html .="<a name='$id'> </a>";
282
- $html .= "<div class='modula' id='jtg-$this->id$rid'>\n";
283
-
284
- $html .= "<div class='items'>\n";
285
-
286
- foreach(array_slice($this->images, 0, 40/2) as $image)
287
- {
288
- $title = in_array($this->gallery->lightbox, array('prettyphoto', 'fancybox', 'swipebox', 'lightbox2')) ? "title" : "data-title";
289
- $rel = $this->gallery->lightbox == "prettyphoto" ? "prettyPhoto[jtg-$this->id$rid]" : "jtg-$this->id$rid";
290
-
291
- $hoverEffect = $this->getHoverEffect($this->gallery->hoverEffect);
292
-
293
- /*if(empty($image->title) && empty($image->description) &&
294
- !$this->gallery->enableTwitter && !$this->gallery->enableFacebook &&
295
- !$this->gallery->enablePinterest & !$this->gallery->enableGplus)
296
- {
297
- $hoverEffect = $this->getHoverEffect('none');
298
- }*/
299
-
300
- $hasTitle = empty($image->title) ? 'notitle' : '';
301
-
302
- $imgUrl = $image->imagePath;
303
-
304
- $html .= "\t<div class=\"item " . $hasTitle . " effect-". $hoverEffect->code ."\">\n";
305
- $html .= "<a $title='$image->description' ". ($this->gallery->lightbox == "lightbox2" && empty($image->link) ? "data-lightbox='gallery'" : "") ." rel='$rel' " . $this->getTarget($image) . " class='tile-inner " . ($this->getLightboxClass($image)) . "' " . $this->getLink($image) . ">\n";
306
- $html .= "\t\t<img data-valign='$image->valign' alt='$image->alt' data-halign='$image->halign' class='pic' src='$imgUrl' data-src='$imgUrl' />\n";
307
- $html .= "\t\t<div class=\"figc\">\n";
308
- $html .= "\t\t\t<div class=\"figc-inner\">\n";
309
- if($this->gallery->hoverEffect != 'none' && ! empty($image->title))
310
- $html .= "\t\t\t\t<h2 class='jtg-title'>".$image->title."</h2>\n";
311
-
312
- if(($hoverEffect->allowSubtitle && ! empty($image->description)) ||
313
- empty($this->gallery->hoverEffect))
314
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  $html .= "\t\t\t\t\t<p class=\"description\">";
316
- if($hoverEffect->allowSubtitle || empty($this->gallery->hoverEffect) )
317
  $html .= $image->description;
318
- $html .= "</p>\n";
319
- }
320
- $html .= "\t\t\t</div>\n";
 
321
  $html .= "\t\t</div>\n";
322
  $html .= "\t</a>\n";
323
  $html .= "\t</div>\n";
324
  }
325
 
326
 
327
- $html .= "\t</div>\n";
328
- $html .= "</div>\n";
329
-
330
- $html .= "<script type='text/javascript'>\n";
331
- $html .= "\tjQuery('#jtg-$this->id$rid').modulaGallery({\n";
332
-
333
- if(strlen($this->gallery->script))
334
- {
335
- $html .= "\t\tonComplete: function () { " . stripslashes($this->gallery->script) . "},\n";
336
- }
337
-
338
- $html .= "\t\tresizer: '". plugins_url('modula-best-grid-gallery/image.php', '') ."',\n";
339
- $html .= "\t\tmargin: ". $this->gallery->margin .",\n";
340
- // $html .= "\t\tkeepArea: " . ($this->gallery->keepArea == "T" ? "true" : "false") . ",\n";
341
- $html .= "\t\tenableTwitter: " . ($this->gallery->enableTwitter == "T" ? "true" : "false") . ",\n";
342
- $html .= "\t\tenableFacebook: " . ($this->gallery->enableFacebook == "T" ? "true" : "false") . ",\n";
343
- $html .= "\t\tenablePinterest: " . ($this->gallery->enablePinterest == "T" ? "true" : "false") . ",\n";
344
- $html .= "\t\tenableGplus: " . ($this->gallery->enableGplus == "T" ? "true" : "false") . ",\n";
345
- $html .= "\t\trandomFactor: " . ($this->gallery->randomFactor / 100) . ",\n";
346
- $html .= "\t});\n";
347
-
348
  $html .= "</script>";
349
 
350
 
351
- if(! empty($_GET["debug"]))
352
  return $html;
 
353
 
354
- return str_replace(array("\n", "\t"), "", $html);
355
  }
356
 
357
- public function useCaptions()
358
- {
359
- if($this->gallery->wp_field_caption == "none" && $this->gallery->wp_field_title == "none")
360
  return false;
 
361
 
362
  return true;
363
  }
364
-
365
- public function loadModulaImages()
366
- {
367
  $images = array();
368
- $idx = 0;
369
- foreach($this->db->getImagesByGalleryId($this->id) as $img)
370
- $images[$img->imageId < 0 ? $img->imageId - ($idx++) : $img->imageId] = $img;
371
-
 
372
  return $images;
373
- }
374
  }
375
  }
376
  ?>
1
  <?php
2
 
3
+ define( "MODULA_DB_MODE", 1 );
4
+ define( "MODULA_WP_MODE", 2 );
5
 
6
+ if ( ! class_exists( "ModulaLiteFE" ) ) {
7
  class ModulaLiteFE {
8
 
9
  private $defaultValues;
10
 
11
+ public function __construct( $db, $id, $defaultValues ) {
12
+ $this->gallery = new stdClass();
13
+ $this->db = $db;
14
+ $this->wp_images = array();
15
+ $this->images = array();
16
+ $this->id = $id;
 
17
  $this->defaultValues = $defaultValues;
18
  $this->init();
19
+ }
20
+
21
+ public function init() {
22
+ $this->gallery = $this->db->getGalleryById( $this->id );
 
23
  foreach ( $this->defaultValues as $k => $v ) {
24
+ if ( ! isset( $this->gallery->$k ) ) {
25
  $this->gallery->$k = $v;
26
+ }
27
  }
28
 
29
  $this->gallery->mode = MODULA_DB_MODE;
30
+
31
+ if ( ! empty( $_GET["debug"] ) ) {
32
+ print "<!--\n";
33
+ print "Gallery id: $this->id\n";
34
+ print "settings:\n";
35
+ print_r( $this->gallery );
36
+ print "\n-->\n";
37
+ }
38
+
39
+ if ( ! $this->gallery->hasResizedImages ) {
 
 
40
  $images = $this->db->getImagesByGalleryId( $this->id );
41
  $images = ModulaLiteTools::check_and_resize( $images, $this->gallery->img_size );
42
+ foreach ( $images as $img ) {
43
+ $this->db->editImage( $img->Id, (array) $img );
44
  }
45
  $this->gallery->hasResizedImages = true;
46
+ $this->db->editGallery( $this->id, (array) $this->gallery );
47
  }
 
 
48
 
49
+ $this->images = $this->loadModulaImages();
50
+
51
+ $ids = array();
52
  $idx = 0;
53
+ foreach ( $this->images as $img ) {
54
+ $ids[] = $img->imageId < 0 ? $img->imageId - ( $idx ++ ) : $img->imageId;
55
+ }
56
 
57
+ if ( count( $this->images ) > 0 && $this->gallery->importedFrom != 'NextGen' ) {
58
+ $this->loadWPImages( $ids );
59
+ }
60
  }
61
+
62
+ public function loadWPImages( $ids ) {
63
+ $args = array(
64
+ 'post_type' => 'attachment',
 
65
  'posts_per_page' => -1,
66
+ 'include' => $ids
67
  );
68
+
69
+ $this->wp_images = get_posts( $args );
70
+ if ( $this->gallery->lightbox == "attachment-page" ) {
71
+ foreach ( $this->wp_images as $att ) {
72
+ $att->url = get_attachment_link( $att->ID );
73
+
74
+ if ( $this->gallery->mode == MODULA_DB_MODE ) {
75
+ //$this->images[$att->ID]->imagePath = $att->guid;
76
+ $this->images[ $att->ID ]->url = $att->url;
77
+ $this->images[ $att->ID ]->alt = get_post_meta( $att->ID, '_wp_attachment_image_alt', true );
78
+ }
79
  }
80
  }
81
+ }
82
+
83
+ public function initByImageIds( $ids ) {
84
+ $this->imageIds = $ids;
85
+ $this->gallery->mode = MODULA_WP_MODE;
86
+ $this->loadWPImages( $ids );
87
+
88
+ foreach ( $this->wp_images as $att ) {
89
+ $image = new stdClass();
90
+ $image->imageId = $att->ID;
91
+ $image->url = $att->url;
92
+ $image->Id = $att->ID;
93
+ $image->imagePath = $att->guid;
94
+ $image->link = get_post_meta( $att->ID, "_modula_link", true );
95
+
96
+ switch ( $this->gallery->wp_field_caption ) {
97
+ case 'title':
98
+ $image->description = $att->post_title;
99
+ break;
100
+ case 'caption':
101
+ $image->description = $att->post_excerpt;
102
+ break;
103
+ case 'description':
104
+ $image->description = $att->post_content;
105
+ break;
106
  }
107
+ $this->images[ $image->imageId ] = $image;
108
  }
109
+
110
+ }
111
+
112
+ public function getGallery() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  return $this->gallery;
114
  }
115
+
116
+ private function getLightboxClass( $image ) {
117
+ if ( ! empty( $image->link ) ) {
 
118
  return '';
119
+ }
120
+
121
+ if ( empty( $this->gallery->lightbox ) ) {
122
  return '';
123
+ }
124
+
125
  return 'modula-lightbox';
126
  }
127
+
128
+ private function getHoverEffect( $code ) {
 
129
  global $ob_ModulaLite;
130
+ foreach ( $ob_ModulaLite->hoverEffects as $effect ) {
131
+ if ( $effect->code == $code ) {
132
  return $effect;
133
+ }
134
+ }
135
  }
136
+
137
+ private function getLink( $image ) {
138
+ if ( ! empty( $image->link ) ) {
 
139
  return "href='" . $image->link . "'";
140
+ }
141
 
142
+ if ( empty( $this->gallery->lightbox ) ) {
143
  return '';
144
+ }
145
 
146
+ if ( $this->gallery->lightbox == 'attachment-page' ) {
147
  return "href='" . $image->url . "'";
148
+ }
149
 
150
  return "href='" . wp_get_attachment_url( $image->imageId ) . "'";
151
  }
152
+
153
+ private function getTarget( $image ) {
154
+ if ( ! empty( $image->target ) ) {
 
155
  return "target='" . $image->target . "'";
156
+ }
157
+
158
  // if($this->gallery->blank == 'T')
159
  // return "target='_blank'";
160
+
161
  return '';
162
  }
163
+
164
+ private function getdef( $value, $default ) {
165
+ if ( $value == null || empty( $value ) ) {
 
166
  return $default;
167
+ }
168
+
169
  return $value;
170
  }
171
+
172
+ private function toRGB( $Hex ) {
173
+
174
+ if ( substr( $Hex, 0, 1 ) == "#" ) {
175
+ $Hex = substr( $Hex, 1 );
176
+ }
177
+
178
+ $R = substr( $Hex, 0, 2 );
179
+ $G = substr( $Hex, 2, 2 );
180
+ $B = substr( $Hex, 4, 2 );
181
+
182
+ $R = hexdec( $R );
183
+ $G = hexdec( $G );
184
+ $B = hexdec( $B );
185
+
186
+ $RGB['R'] = $R;
187
+ $RGB['G'] = $G;
188
+ $RGB['B'] = $B;
189
+
190
+ $RGB[0] = $R;
191
+ $RGB[1] = $G;
192
+ $RGB[2] = $B;
193
+
194
+ return $RGB;
195
+
196
+ }
197
+
198
+ static public function slugify( $text ) {
199
+ $text = preg_replace( '~[^\\pL\d]+~u', '-', $text );
200
+ $text = trim( $text, '-' );
201
+ $text = iconv( 'utf-8', 'us-ascii//TRANSLIT', $text );
202
+ $text = strtolower( $text );
203
+ $text = preg_replace( '~[^-\w]+~', '', $text );
204
+
205
+ if ( empty( $text ) ) {
206
+ return 'n-a';
207
+ }
208
+
209
+ return $text;
 
210
  }
211
 
212
+ private function v( $name ) {
213
+ switch ( $this->mode ) {
 
 
214
  default:
215
  case MODULA_DB_MODE:
216
  return $this->gallery->$name;
217
  break;
218
  case MODULA_WP_MODE:
219
+ return $this->settings[ $name ];
220
  }
221
  }
222
 
223
+ public function render() {
224
+ $rid = rand( 1, 1000 );
225
+
226
+ if ( $this->gallery->shuffle == 'T' ) {
227
+ shuffle( $this->images );
228
+ }
229
+
230
+ $gallery = $this->gallery;
231
 
232
+ $html = "";
233
 
234
  $html .= "<style>\n";
235
 
236
+ if ( $this->gallery->borderSize ) {
237
  $html .= "#jtg-$this->id$rid .item { border: " . $this->gallery->borderSize . "px solid " . $this->gallery->borderColor . "; }\n";
238
+ }
239
+
240
+ if ( $this->gallery->borderRadius ) {
241
  $html .= "#jtg-$this->id$rid .item { border-radius: " . $this->gallery->borderRadius . "px; }\n";
242
+ }
243
+
244
+ if ( $this->gallery->shadowSize ) {
245
+ $html .= "#jtg-$this->id$rid .item { box-shadow: " . $this->gallery->shadowColor . " 0px 0px " . $this->gallery->shadowSize . "px; }\n";
246
+ }
247
 
248
+ if ( $this->gallery->socialIconColor ) {
 
 
 
249
  $html .= "#jtg-$this->id$rid .item .jtg-social a { color: " . $this->gallery->socialIconColor . " }\n";
250
+ }
251
+
252
+ $html .= "#jtg-$this->id$rid .item .caption { background-color: " . $this->gallery->captionColor . "; }\n";
253
 
254
+ $html .= "#jtg-$this->id$rid .item .figc { color: " . $this->gallery->captionColor . "; font-size: " . $this->gallery->captionFontSize . "px; }\n";
 
 
 
 
 
 
255
 
256
+ $html .= "#jtg-$this->id$rid .item .figc h2.jtg-title { font-size: " . $this->gallery->titleFontSize . "px; }\n";
 
 
 
257
 
258
+ $html .= "#jtg-$this->id$rid .item { transform: scale(" . $gallery->loadedScale / 100 . ") translate(" . $gallery->loadedHSlide . 'px,' . $gallery->loadedVSlide . "px) rotate(" . $gallery->loadedRotate . "deg); }\n";
259
 
260
+
261
+ $html .= "#jtg-$this->id$rid .items { width:" . $this->gallery->width . "; height:" . $this->gallery->height . "px; }\n";
262
+
263
+ $html .= "#jtg-$this->id$rid .items .figc p.description { color:" . $this->gallery->captionColor . "; }\n";
264
+
265
+
266
+ if ( strlen( $this->gallery->style ) ) {
267
  $html .= $this->gallery->style;
268
+ }
269
 
270
+ $html .= "</style>\n";
271
+
272
+ $id = $this->id;
273
+ $html .= "<a name='$id'> </a>";
274
+ $html .= "<div class='modula' id='jtg-$this->id$rid'>\n";
275
+
276
+ $html .= "<div class='items'>\n";
277
+
278
+ foreach ( array_slice( $this->images, 0, 40 / 2 ) as $image ) {
279
+ $title = in_array( $this->gallery->lightbox, array(
280
+ 'prettyphoto',
281
+ 'fancybox',
282
+ 'swipebox',
283
+ 'lightbox2'
284
+ ) ) ? "title" : "data-title";
285
+ $rel = $this->gallery->lightbox == "prettyphoto" ? "prettyPhoto[jtg-$this->id$rid]" : "jtg-$this->id$rid";
286
+
287
+ $hoverEffect = $this->getHoverEffect( $this->gallery->hoverEffect );
288
+
289
+ /*if(empty($image->title) && empty($image->description) &&
290
+ !$this->gallery->enableTwitter && !$this->gallery->enableFacebook &&
291
+ !$this->gallery->enablePinterest & !$this->gallery->enableGplus)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  {
293
+ $hoverEffect = $this->getHoverEffect('none');
294
+ }*/
295
+
296
+ $hasTitle = empty( $image->title ) ? 'notitle' : '';
297
+
298
+ $imgUrl = $image->imagePath;
299
+ $image->alt = isset( $image->alt ) ? $image->alt : '';
300
+
301
+ $html .= "\t<div class=\"item " . $hasTitle . " effect-" . $hoverEffect->code . "\">\n";
302
+ $html .= "<a $title='$image->description' " . ( $this->gallery->lightbox == "lightbox2" && empty( $image->link ) ? "data-lightbox='gallery'" : "" ) . " rel='$rel' " . $this->getTarget( $image ) . " class='tile-inner " . ( $this->getLightboxClass( $image ) ) . "' " . $this->getLink( $image ) . ">\n";
303
+ $html .= "\t\t<img data-valign='$image->valign' alt='$image->alt' data-halign='$image->halign' class='pic' src='$imgUrl' data-src='$imgUrl' />\n";
304
+ $html .= "\t\t<div class=\"figc\">\n";
305
+ $html .= "\t\t\t<div class=\"figc-inner\">\n";
306
+ if ( $this->gallery->hoverEffect != 'none' && ! empty( $image->title ) ) {
307
+ $html .= "\t\t\t\t<h2 class='jtg-title'>" . $image->title . "</h2>\n";
308
+ }
309
+
310
+ if ( ( $hoverEffect->allowSubtitle && ! empty( $image->description ) ) ||
311
+ empty( $this->gallery->hoverEffect ) ) {
312
  $html .= "\t\t\t\t\t<p class=\"description\">";
313
+ if ( $hoverEffect->allowSubtitle || empty( $this->gallery->hoverEffect ) ) {
314
  $html .= $image->description;
315
+ }
316
+ $html .= "</p>\n";
317
+ }
318
+ $html .= "\t\t\t</div>\n";
319
  $html .= "\t\t</div>\n";
320
  $html .= "\t</a>\n";
321
  $html .= "\t</div>\n";
322
  }
323
 
324
 
325
+ $html .= "\t</div>\n";
326
+ $html .= "</div>\n";
327
+
328
+ $html .= "<script type='text/javascript'>\n";
329
+ $html .= "\tjQuery('#jtg-$this->id$rid').modulaGallery({\n";
330
+
331
+ if ( strlen( $this->gallery->script ) ) {
332
+ $html .= "\t\tonComplete: function () { " . stripslashes( $this->gallery->script ) . "},\n";
333
+ }
334
+
335
+ $html .= "\t\tresizer: '" . plugins_url( 'modula-best-grid-gallery/image.php', '' ) . "',\n";
336
+ $html .= "\t\tmargin: " . $this->gallery->margin . ",\n";
337
+ // $html .= "\t\tkeepArea: " . ($this->gallery->keepArea == "T" ? "true" : "false") . ",\n";
338
+ $html .= "\t\tenableTwitter: " . ( $this->gallery->enableTwitter == "T" ? "true" : "false" ) . ",\n";
339
+ $html .= "\t\tenableFacebook: " . ( $this->gallery->enableFacebook == "T" ? "true" : "false" ) . ",\n";
340
+ $html .= "\t\tenablePinterest: " . ( $this->gallery->enablePinterest == "T" ? "true" : "false" ) . ",\n";
341
+ $html .= "\t\tenableGplus: " . ( $this->gallery->enableGplus == "T" ? "true" : "false" ) . ",\n";
342
+ $html .= "\t\trandomFactor: " . ( $this->gallery->randomFactor / 100 ) . ",\n";
343
+ $html .= "\t});\n";
344
+
 
345
  $html .= "</script>";
346
 
347
 
348
+ if ( ! empty( $_GET["debug"] ) ) {
349
  return $html;
350
+ }
351
 
352
+ return str_replace( array( "\n", "\t" ), "", $html );
353
  }
354
 
355
+ public function useCaptions() {
356
+ if ( $this->gallery->wp_field_caption == "none" && $this->gallery->wp_field_title == "none" ) {
 
357
  return false;
358
+ }
359
 
360
  return true;
361
  }
362
+
363
+ public function loadModulaImages() {
 
364
  $images = array();
365
+ $idx = 0;
366
+ foreach ( $this->db->getImagesByGalleryId( $this->id ) as $img ) {
367
+ $images[ $img->imageId < 0 ? $img->imageId - ( $idx ++ ) : $img->imageId ] = $img;
368
+ }
369
+
370
  return $images;
371
+ }
372
  }
373
  }
374
  ?>
scripts/jquery.modula.js CHANGED
@@ -1,539 +1,539 @@
1
- // Place any jQuery/helper plugins in here.
2
- /*
3
- * Project: jQuery Modula 2
4
- * Version: 1.0
5
- * Description: Artistic gallery
6
- * Author: Green Tree Labs
7
- */
8
-
9
- function tg_getURLParameter(name) {
10
- return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
11
- }
12
-
13
- ; (function ($, window, document, undefined) {
14
-
15
-
16
- // Create the defaults once
17
- var pluginName = 'modulaGallery',
18
- defaults = {
19
- resizer: '/',
20
- margin: 10,
21
- keepArea: true,
22
- enableTwitter: false,
23
- enableFacebook: false,
24
- enableGplus: false,
25
- enablePinterest: false
26
- };
27
-
28
- // The actual plugin constructor
29
- function Plugin(element, options) {
30
- this.element = element;
31
- this.$element = $(element);
32
- this.$itemsCnt = this.$element.find(".items");
33
- this.$items = this.$itemsCnt.find(".item");
34
-
35
- this.options = $.extend({}, defaults, options);
36
-
37
- this._defaults = defaults;
38
- this._name = pluginName;
39
-
40
- this.tiles = [];
41
- this.$tilesCnt = null;
42
- this.completed = false;
43
- this.lastWidth = 0;
44
- this.resizeTO = 0;
45
- this.init();
46
- }
47
-
48
- Plugin.prototype.createGrid = function () {
49
- var plugin = this;
50
-
51
- for (var i = 0; i < this.$items.not(".jtg-hidden").length; i++)
52
- this.tiles.push(plugin.getSlot());
53
-
54
- this.tiles.sort(function (x, y) {
55
- return x.position - y.position;
56
- });
57
-
58
- this.$items.not(".jtg-hidden").each(function (i, item) {
59
- var slot = plugin.tiles[i];
60
-
61
- $(item)
62
- .data('size', slot)
63
- .addClass('tiled')
64
- .addClass(slot.width > slot.height ? 'tile-h' : 'tile-v')
65
- .data('position');
66
- });
67
-
68
- //apply css
69
- this.$items.each(function (i, item) {
70
- $(item).css($(item).data('size'));
71
- $(item).find(".figc").css({
72
- width: $(item).data('size').width,
73
- height: $(item).data('size').height
74
- });
75
- });
76
-
77
- this.completed = true;
78
- }
79
-
80
- Plugin.prototype.getSlot = function () {
81
-
82
- if (this.tiles.length == 0) {
83
- var tile = {
84
- top: 0,
85
- left: 0,
86
- width: this.$itemsCnt.width(),
87
- height: this.$itemsCnt.height(),
88
- area: this.$itemsCnt.width() * this.$itemsCnt.height(),
89
- position: 0
90
- };
91
- return tile;
92
- }
93
-
94
- var maxTileIdx = 0;
95
- for (var i = 0; i < this.tiles.length; i++) {
96
- var tile = this.tiles[i];
97
- if (tile.area > this.tiles[maxTileIdx].area) {
98
- maxTileIdx = i;
99
- }
100
- }
101
-
102
- var tile = {};
103
-
104
- var maxTileData = this.tiles[maxTileIdx];
105
-
106
- if (maxTileData.width > maxTileData.height) {
107
-
108
- var randomMaxDelta = maxTileData.width / 2 * this.options.randomFactor;
109
-
110
-
111
- maxTileData.prevWidth = maxTileData.width;
112
- maxTileData.width = Math.floor((maxTileData.width / 2) +
113
- (randomMaxDelta * (Math.random() - .5)));
114
-
115
- tile = {
116
- top: maxTileData.top,
117
- left: maxTileData.left + maxTileData.width + this.options.margin,
118
- width: maxTileData.prevWidth - maxTileData.width - this.options.margin,
119
- height: maxTileData.height
120
- }
121
-
122
- } else {
123
- var randomMaxDelta = maxTileData.height / 2 * this.options.randomFactor;
124
-
125
- maxTileData.prevHeight = maxTileData.height;
126
- maxTileData.height = Math.floor((maxTileData.height / 2) +
127
- (randomMaxDelta * (Math.random() - .5)));
128
-
129
- tile = {
130
- left: maxTileData.left,
131
- top: maxTileData.top + maxTileData.height + this.options.margin,
132
- width: maxTileData.width,
133
- height: maxTileData.prevHeight - maxTileData.height - this.options.margin
134
- }
135
- }
136
-
137
- tile.area = tile.width * tile.height;
138
- tile.position = tile.top * 1000 + tile.left;
139
-
140
- maxTileData.position = maxTileData.top * 1000 + maxTileData.left;
141
-
142
- this.tiles[maxTileIdx] = maxTileData;
143
- this.tiles[maxTileIdx].area = maxTileData.width * maxTileData.height;
144
-
145
- return tile;
146
- }
147
-
148
- Plugin.prototype.reset = function () {
149
- var instance = this;
150
- instance.tiles = [];
151
- instance.createGrid();
152
- instance.$itemsCnt.find('.pic').each(function (i, o) {
153
- instance.placeImage(i);
154
- });
155
- instance.lastWidth = instance.$itemsCnt.width();
156
- }
157
-
158
- Plugin.prototype.onResize = function (instance) {
159
- if (instance.lastWidth == instance.$itemsCnt.width())
160
- return;
161
-
162
- clearTimeout(instance.resizeTO);
163
- instance.resizeTO = setTimeout(function () {
164
-
165
- if (instance.options.keepArea) {
166
- var area = instance.$itemsCnt.data('area');
167
- instance.$itemsCnt.height(area / instance.$itemsCnt.width());
168
- }
169
-
170
- instance.reset();
171
-
172
- }, 100);
173
- }
174
-
175
- Plugin.prototype.placeImage = function (index) {
176
-
177
- var $tile = this.$items.eq(index);
178
- var $image = $tile.find('.pic');
179
-
180
- var tSize = $tile.data('size');
181
- var iSize = $image.data('size');
182
-
183
-
184
- var tRatio = tSize.width / tSize.height;
185
- var iRatio = iSize.width / iSize.height;
186
-
187
- var valign = $image.data('valign') ? $image.data('valign') : 'middle';
188
- var halign = $image.data('halign') ? $image.data('halign') : 'center';
189
-
190
- var cssProps = {
191
- top: 'auto',
192
- bottom: 'auto',
193
- left: 'auto',
194
- right: 'auto',
195
- width: 'auto',
196
- height: 'auto',
197
- margin: '0',
198
- maxWidth: '999em'
199
- };
200
-
201
- if (tRatio > iRatio) {
202
- cssProps.width = tSize.width;
203
- cssProps.left = 0;
204
-
205
- switch (valign) {
206
- case 'top':
207
- cssProps.top = 0;
208
- break;
209
- case 'middle':
210
- cssProps.top = 0 - (tSize.width * (1 / iRatio) - tSize.height) / 2;
211
- break;
212
- case 'bottom':
213
- cssProps.bottom = 0;
214
- break;
215
- }
216
-
217
- } else {
218
-
219
- cssProps.height = tSize.height;
220
- cssProps.top = 0;
221
-
222
- switch (halign) {
223
- case 'left':
224
- cssProps.left = 0;
225
- break;
226
- case 'center':
227
- cssProps.left = 0 - (tSize.height * iRatio - tSize.width) / 2;
228
- break;
229
- case 'right':
230
- cssProps.right = 0;
231
- break;
232
- }
233
- }
234
-
235
- $image.css(cssProps);
236
- }
237
-
238
- Plugin.prototype.loadImage = function (index) {
239
- var instance = this;
240
- var source = instance.$items.eq(index).find('.pic');
241
- var img = new Image();
242
- img.onerror = function () {
243
- console.log("error loading image [" + index + "] : " + this.src);
244
- if (index + 1 < instance.$items.length)
245
- instance.loadImage(index + 1);
246
- }
247
- img.onload = function () {
248
- source.data('size', { width: this.width, height: this.height });
249
- instance.placeImage(index);
250
-
251
- instance.$items.eq(index).addClass("tg-loaded");
252
- if (index + 1 < instance.$items.length)
253
- instance.loadImage(index + 1);
254
- }
255
-
256
- var original_src = source.data('src');
257
- img.src = original_src;
258
- source.attr("src", original_src);
259
- }
260
-
261
- Plugin.prototype.setupFilters = function () {
262
-
263
- var filterClick = $('#filterClick').val();
264
- var instance = this;
265
- instance.$element.delegate(".filters a", "click", function (e) {
266
- if(filterClick != "T")
267
- {
268
- e.preventDefault();
269
- }
270
-
271
- if($(this).hasClass("selected"))
272
- return;
273
-
274
- instance.$element.find(".filters a").removeClass("selected");
275
- $(this).addClass("selected");
276
-
277
- var filter = $(this).attr("href").substr(1);
278
- if (filter) {
279
- instance.$items.removeClass('jtg-hidden');
280
- instance.$items.show();
281
- instance.$items.not("." + filter).addClass("jtg-hidden").hide();
282
- } else {
283
- instance.$items.removeClass('jtg-hidden');
284
- instance.$items.show();
285
- }
286
-
287
- instance.reset();
288
- });
289
- };
290
-
291
- Plugin.prototype.init = function () {
292
-
293
- var instance = this;
294
-
295
- var current_filter = tg_getURLParameter('jtg-filter');
296
-
297
- if(current_filter != null)
298
- {
299
- instance.$element.find(".filters a").removeClass('selected');
300
- instance.$element.find(".filters a").each(function(){
301
-
302
- if($(this).data('filter') == current_filter)
303
- {
304
- $(this).addClass('selected');
305
- }
306
- })
307
- }
308
-
309
- var hash = window.location.hash;
310
-
311
- this.$itemsCnt.css({
312
- position: 'relative',
313
- zIndex: 1
314
- });
315
-
316
- this.$items.addClass("tile");
317
- this.$items.find(".pic").removeAttr("src");
318
-
319
- if (this.options.width) {
320
- this.$itemsCnt.width(this.options.width);
321
- }
322
-
323
- if (this.options.height) {
324
- this.$itemsCnt.height(this.options.height);
325
- }
326
-
327
- this.$itemsCnt.data('area', this.$itemsCnt.width() * this.$itemsCnt.height());
328
-
329
- this.lastWidth = this.$itemsCnt.width();
330
- this.createGrid();
331
-
332
- this.loadImage(0);
333
-
334
- var instance = this;
335
- $(window).resize(function () {
336
- instance.onResize(instance);
337
- });
338
-
339
- this.setupFilters();
340
- this.setupSocial();
341
-
342
- if(this.options.onComplete)
343
- this.options.onComplete();
344
-
345
- if(hash != "" && hash != "#" && current_filter == null) {
346
- var hash_class = hash.replace('#', '.');
347
-
348
- var filters = [];
349
-
350
- instance.$element.find(".filters a").each(function(){
351
- filters.push($(this).attr('href'));
352
- })
353
- filters.shift();
354
-
355
- $('.filters a').each(function() {
356
- $(this).removeClass('selected');
357
- if($(this).attr('href') == hash)
358
- {
359
- $(this).addClass('selected');
360
- }
361
- })
362
-
363
-
364
- if( $.inArray(hash, filters) >= 0)
365
- {
366
- instance.$items.addClass('jtg-hidden').hide();
367
- }
368
-
369
- hash_class = hash_class.replace('.','');
370
- instance.$items.each(function(){
371
- if($(this).hasClass(hash_class))
372
- {
373
- $(this).removeClass('jtg-hidden');
374
- $(this).show();
375
- }
376
- });
377
-
378
- instance.reset();
379
- }
380
- };
381
-
382
- Plugin.prototype.setupSocial = function () {
383
- if (this.options.enableTwitter || this.options.enableFacebook ||
384
- this.options.enableGplus || this.options.enablePinterest) {
385
-
386
- this.$items.each(function (i, tile) {
387
- var $tile = $(tile);
388
- $tile.append("<div class='jtg-social' />");
389
- });
390
- }
391
-
392
- if (this.options.enableTwitter)
393
- setupTwitter(this.$items, this);
394
- if (this.options.enableFacebook)
395
- setupFacebook(this.$items, this);
396
- if (this.options.enableGplus)
397
- setupGplus(this.$items, this);
398
- if (this.options.enablePinterest)
399
- setupPinterest(this.$items, this);
400
- }
401
-
402
- var addSocialIcon = function ($tiles, cssClass, name) {
403
- $tiles.find(".jtg-social").each(function (i, tile) {
404
- var $tile = $(tile);
405
-
406
- var tw = $("<a class='" + cssClass + "' href='#'></a>");
407
- $tile.append(tw);
408
- });
409
- }
410
-
411
- //credits James Padolsey http://james.padolsey.com/
412
- var qualifyURL = function (url) {
413
- var img = document.createElement('img');
414
- img.src = url; // set string url
415
- url = img.src; // get qualified url
416
- img.src = null; // no server request
417
- return url;
418
- }
419
-
420
- var setupTwitter = function ($tiles, plugin) {
421
- addSocialIcon($tiles, "icon modula-icon-twitter", "Twitter");
422
- $tiles.find(".modula-icon-twitter").click(function (e) {
423
- e.preventDefault();
424
- var $caption = $(this).parents(".tile:first").find(".caption");
425
- var text = plugin.options.twitterText || document.title;
426
- if (!plugin.options.twitterText && $caption.length == 1 && $caption.text().length > 0)
427
- text = $.trim($caption.text());
428
- var w = window.open("https://twitter.com/intent/tweet?url=" + encodeURI(location.href.split('#')[0]) + "&text=" + encodeURI(text), "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400");
429
- w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200));
430
- return false;
431
- });
432
- }
433
-
434
- var setupFacebook = function ($tiles, plugin) {
435
- addSocialIcon($tiles, "icon modula-icon-facebook", "Facebook");
436
- $tiles.find(".modula-icon-facebook").click(function (e) {
437
- e.preventDefault();
438
-
439
- var image = $(this).parents(".tile:first").find(".pic");
440
-
441
- var $caption = $(this).parents(".tile:first").find(".caption");
442
- var text = plugin.options.facebookText || document.title;
443
- if (!plugin.options.facebookText && $caption.length == 1 && $caption.text().length > 0)
444
- text = $.trim($caption.text());
445
-
446
- var src = image.attr("src");
447
- var url = "https://www.facebook.com/dialog/feed?app_id=1614610388804595&"+
448
- "link="+encodeURIComponent(location.href)+"&" +
449
- "display=popup&"+
450
- "name="+encodeURIComponent(document.title)+"&"+
451
- "caption=&"+
452
- "description="+encodeURIComponent(text)+"&"+
453
- "picture="+encodeUR