Unlimited Elements For Elementor (Free Widgets, Addons, Templates) - Version 1.5.3

Version Description

Download this release

Release Info

Developer valiano
Plugin Icon 128x128 Unlimited Elements For Elementor (Free Widgets, Addons, Templates)
Version 1.5.3
Comparing to
See all releases

Code changes from version 1.5.0 to 1.5.3

Files changed (52) hide show
  1. assets_libraries/filters/ue_filters.js +151 -65
  2. assets_libraries/owl-carousel-new/owl.carousel.js +3505 -3493
  3. assets_libraries/owl-carousel-new/owl.carousel.min.js +2 -2
  4. assets_libraries/remote/ue-remote-controls.js +102 -52
  5. assets_libraries/unitegallery/js/unitegallery.js +20 -1
  6. assets_libraries/unitegallery/js/unitegallery.min.js +2 -2
  7. inc_php/framework/functions.class.php +19 -1
  8. inc_php/unitecreator_actions.class.php +1 -0
  9. inc_php/unitecreator_dialog_param.class.php +1 -1
  10. inc_php/unitecreator_filters_process.class.php +437 -68
  11. inc_php/unitecreator_helperhtml.class.php +6 -78
  12. inc_php/unitecreator_operations.class.php +30 -0
  13. inc_php/unitecreator_params_processor.class.php +41 -2
  14. inc_php/unitecreator_template_engine.class.php +39 -7
  15. inc_php/unitecreator_unitegallery.class.php +78 -0
  16. inc_php/unitecreator_web_api.class.php +53 -2
  17. includes.php +1 -1
  18. js/unitecreator_admin.js +1 -1
  19. provider/core/plugins/unlimited_elements/elementor/assets/uc_editor_admin.js +0 -1
  20. provider/core/plugins/unlimited_elements/elementor/elementor_integrate.class.php +30 -15
  21. provider/core/plugins/unlimited_elements/elementor/elementor_widget.class.php +7 -2
  22. provider/core/plugins/unlimited_elements/elementor/pagination.class.php +97 -47
  23. provider/core/plugins/unlimited_elements/helper_provider_core.class.php +43 -11
  24. provider/freemius/includes/class-freemius.php +25 -2
  25. provider/freemius/includes/managers/class-fs-admin-notice-manager.php +7 -2
  26. provider/freemius/includes/sdk/Exceptions/ArgumentNotExistException.php +5 -1
  27. provider/freemius/includes/sdk/Exceptions/EmptyArgumentException.php +5 -1
  28. provider/freemius/includes/sdk/Exceptions/Exception.php +5 -1
  29. provider/freemius/includes/sdk/Exceptions/InvalidArgumentException.php +5 -1
  30. provider/freemius/includes/sdk/Exceptions/OAuthException.php +5 -1
  31. provider/freemius/includes/sdk/FreemiusBase.php +4 -0
  32. provider/freemius/includes/sdk/FreemiusWordPress.php +4 -1
  33. provider/freemius/require.php +5 -1
  34. provider/freemius/start.php +1 -1
  35. provider/freemius/templates/account/partials/addon.php +6 -1
  36. provider/freemius/templates/ajax-loader.php +6 -1
  37. provider/freemius/templates/debug.php +8 -2
  38. provider/freemius/templates/firewall-issues-js.php +10 -6
  39. provider/freemius/templates/partials/network-activation.php +6 -1
  40. provider/freemius/templates/sticky-admin-notice-js.php +4 -2
  41. provider/functions_wordpress.class.php +19 -1
  42. provider/provider_functions.class.php +1 -1
  43. provider/provider_globals.class.php +1 -0
  44. provider/provider_params_processor.class.php +139 -80
  45. provider/provider_settings.class.php +7 -68
  46. provider/provider_template_engine.class.php +6 -1
  47. provider/woocommerce_integrate.class.php +24 -0
  48. readme.txt +92 -58
  49. release_log.txt +36 -0
  50. settings/addon_fields.xml +10 -4
  51. unlimited_elements.php +1 -1
  52. views/troubleshooting-connectivity.php +76 -1
assets_libraries/filters/ue_filters.js CHANGED
@@ -15,7 +15,8 @@ function UEDynamicFilters(){
15
  CLASS_DIV_DEBUG:"uc-div-ajax-debug",
16
  CLASS_GRID:"uc-filterable-grid",
17
  handleTrashold:null,
18
- DEBUG_AJAX_OPTIONS: false
 
19
  };
20
 
21
  var g_options = {
@@ -424,7 +425,7 @@ function UEDynamicFilters(){
424
 
425
  var objFilter = jQuery(filter);
426
 
427
- var isMainFilter = objFilter.hasClass("uc-main-filter");
428
 
429
  if(isMainFilter == true)
430
  return(true);
@@ -482,7 +483,7 @@ function UEDynamicFilters(){
482
  var objLink = jQuery(this);
483
 
484
  var objPagination = objLink.parents(".uc-filter-pagination");
485
-
486
  var objLinkCurrent = objPagination.find(".current");
487
 
488
  objLinkCurrent.removeClass("current");
@@ -496,6 +497,9 @@ function UEDynamicFilters(){
496
 
497
  //run the ajax, prevent default
498
 
 
 
 
499
  refreshAjaxGrid(objGrid);
500
 
501
  event.preventDefault();
@@ -511,18 +515,18 @@ function UEDynamicFilters(){
511
  function getLoadMoreUrlData(objFilter){
512
 
513
  var objData = objFilter.find(".uc-filter-load-more__data");
514
-
515
- var nextPage = objData.data("nextpage");
516
- if(!nextPage)
517
- nextPage = null;
518
 
 
 
 
 
519
  var numItems = objFilter.data("numitems");
520
 
521
  if(!numItems)
522
  numItems = null;
523
 
524
  var data = {};
525
- data.page = nextPage;
526
  data.numItems = numItems;
527
 
528
  return(data);
@@ -549,7 +553,7 @@ function UEDynamicFilters(){
549
  * do the load more operation
550
  */
551
  function onLoadMoreClick(){
552
-
553
  var objLink = jQuery(this);
554
 
555
  var objLoadMore = objLink.parents(".uc-filter-load-more");
@@ -560,7 +564,7 @@ function UEDynamicFilters(){
560
 
561
  if(isMore == false)
562
  return(false);
563
-
564
  var objGrid = objLoadMore.data("grid");
565
 
566
  if(!objGrid || objGrid.length == 0)
@@ -568,6 +572,8 @@ function UEDynamicFilters(){
568
 
569
  //run the ajax, prevent default
570
 
 
 
571
  refreshAjaxGrid(objGrid, "loadmore");
572
 
573
  }
@@ -674,7 +680,7 @@ function UEDynamicFilters(){
674
  throw new Error("Grid not found");
675
 
676
  //if main filter - clear other filters
677
- var isMainFilter = objTermsFilter.hasClass("uc-main-filter");
678
 
679
  if(isMainFilter == true)
680
  clearGridFilters(objGrid);
@@ -698,6 +704,7 @@ function UEDynamicFilters(){
698
  if(objSelected.length == 0)
699
  return(null);
700
 
 
701
  var slug = objSelected.data("slug");
702
  var taxonomy = objSelected.data("taxonomy");
703
 
@@ -705,6 +712,7 @@ function UEDynamicFilters(){
705
  return(null);
706
 
707
  var objTerm = {
 
708
  "slug": slug,
709
  "taxonomy": taxonomy
710
  };
@@ -723,7 +731,7 @@ function UEDynamicFilters(){
723
  var objItems = objFilter.find(".ue_taxonomy_item");
724
 
725
  if(objItems.length == 0)
726
- return([]);
727
 
728
  jQuery.each(objItems, function(index, item){
729
 
@@ -1336,7 +1344,7 @@ function UEDynamicFilters(){
1336
  * set ajax loader
1337
  */
1338
  function showAjaxLoader(objElement){
1339
-
1340
  objElement.addClass("uc-ajax-loading");
1341
  }
1342
 
@@ -1391,11 +1399,15 @@ function UEDynamicFilters(){
1391
  return(false);
1392
 
1393
  var objAjaxOptions = getGridAjaxOptions(objFilters, objGrid, isFiltersInit);
1394
-
1395
- if(!objAjaxOptions)
 
 
1396
  return(false);
 
1397
 
1398
  var ajaxUrl = objAjaxOptions["ajax_url"];
 
1399
 
1400
  if(g_vars.DEBUG_AJAX_OPTIONS == true){
1401
 
@@ -1404,7 +1416,19 @@ function UEDynamicFilters(){
1404
  return(false);
1405
  }
1406
 
1407
- if(isLoadMore !== true)
 
 
 
 
 
 
 
 
 
 
 
 
1408
  showAjaxLoader(objGrid);
1409
 
1410
  var objFiltersToReload = objFilters.filter(function(objFilter){
@@ -1412,10 +1436,13 @@ function UEDynamicFilters(){
1412
  return objFilter.hasClass("uc-ajax-refresh-soon");
1413
  });
1414
 
 
1415
  showMultipleAjaxLoaders(objFiltersToReload, true);
1416
 
 
 
1417
  g_lastGridAjaxCall = objGrid;
1418
-
1419
  ajaxRequest(ajaxUrl,null,null, function(response){
1420
 
1421
  if(isLoadMore !== true)
@@ -1436,9 +1463,11 @@ function UEDynamicFilters(){
1436
  * get grid ajax options
1437
  */
1438
  function getGridAjaxOptions(objFilters, objGrid, isFiltersInitMode){
1439
-
1440
  if(!objFilters)
1441
- return(false);
 
 
1442
 
1443
  var urlAjax = g_urlBase;
1444
 
@@ -1446,43 +1475,76 @@ function UEDynamicFilters(){
1446
 
1447
  var isReplaceMode = false;
1448
  var page = null;
 
1449
  var numItems = null;
1450
  var arrTerms = [];
1451
  var objTaxIDs = {};
 
1452
 
 
1453
 
1454
  //get ajax options
1455
  jQuery.each(objFilters, function(index, objFilter){
1456
 
 
 
1457
  var type = getFilterType(objFilter);
1458
 
1459
  switch(type){
1460
  case g_types.PAGINATION:
1461
 
1462
- var urlPagination = getPaginationSelectedUrl(objFilter);
 
 
 
 
 
 
 
 
 
 
 
 
 
1463
 
1464
- if(urlPagination)
1465
- urlAjax = urlPagination;
1466
  break;
1467
  case g_types.LOADMORE:
1468
-
1469
- var loadMoreData = getLoadMoreUrlData(objFilter);
1470
- page = loadMoreData.page;
1471
- numItems = loadMoreData.numItems;
1472
-
1473
- if(!page)
1474
- urlAjax = null;
1475
-
 
 
 
 
 
 
 
 
 
 
1476
  break;
1477
  case g_types.TERMS_LIST:
1478
 
1479
  //if not init mode - take first item
1480
- if(isFiltersInitMode == false){
1481
-
1482
- var objTerm = getTermsListSelectedTerm(objFilter);
1483
 
1484
- if(objTerm)
1485
  arrTerms.push(objTerm);
 
 
 
 
 
 
 
1486
  }
1487
 
1488
  //replace mode
@@ -1490,6 +1552,7 @@ function UEDynamicFilters(){
1490
  var modeReplace = objFilter.data("replace-mode");
1491
  if(modeReplace === true)
1492
  isReplaceMode = true;
 
1493
  break;
1494
  case g_types.CHECKBOX:
1495
 
@@ -1500,10 +1563,7 @@ function UEDynamicFilters(){
1500
  throw new Error("Unknown filter type: "+type);
1501
  break;
1502
  }
1503
-
1504
- //add widget id of the filter to refresh
1505
-
1506
- var isNoRefresh = objFilter.data("uc_norefresh");
1507
 
1508
  //handle filters init mode
1509
 
@@ -1517,28 +1577,33 @@ function UEDynamicFilters(){
1517
 
1518
  objFilter.data("uc_norefresh",false);
1519
 
 
 
 
 
 
 
 
1520
 
1521
- if(isNoRefresh !== true){ //add to refresh mode
 
 
 
 
1522
 
1523
- var isMainFilter = objFilter.hasClass("uc-main-filter");
1524
 
1525
- if(isMainFilter == false){
1526
-
1527
- var filterWidgetID = getElementWidgetID(objFilter);
1528
-
1529
- //add test tax id's for init mode
1530
- objTaxIDs = getFilterTaxIDs(objFilter, objTaxIDs);
1531
-
1532
- if(strRefreshIDs)
1533
- strRefreshIDs += ",";
1534
-
1535
- strRefreshIDs += filterWidgetID;
1536
-
1537
- objFilter.addClass("uc-ajax-refresh-soon");
1538
- }
1539
 
 
 
 
1540
  }
1541
-
1542
 
1543
  }); //end filters iteration
1544
 
@@ -1547,13 +1612,17 @@ function UEDynamicFilters(){
1547
 
1548
  var urlAddition_filtersTest = "";
1549
  var strTaxIDs = getTermDsList(objTaxIDs);
1550
-
1551
  if(isFiltersInitMode == true){
1552
-
1553
  if(!strTaxIDs)
1554
  urlAjax = null;
1555
  else{
1556
- urlAddition_filtersTest += "&modeinit=true";
 
 
 
 
1557
  }
1558
  }
1559
 
@@ -1563,7 +1632,7 @@ function UEDynamicFilters(){
1563
 
1564
  urlAddition_filtersTest += "testtermids="+strTaxIDs;
1565
  }
1566
-
1567
 
1568
  if(urlAjax == null)
1569
  return(null);
@@ -1583,15 +1652,26 @@ function UEDynamicFilters(){
1583
  if(page)
1584
  urlAjax += "&ucpage="+page;
1585
 
 
 
 
1586
  if(numItems)
1587
  urlAjax += "&uccount="+numItems;
1588
 
1589
  if(arrTerms.length){
 
1590
  var strTerms = buildTermsQuery(arrTerms);
1591
  if(strTerms)
1592
  urlAjax += "&ucterms="+strTerms;
 
 
 
 
1593
  }
1594
 
 
 
 
1595
  //add refresh ids
1596
  if(strRefreshIDs)
1597
  urlAjax += "&addelids="+strRefreshIDs;
@@ -1599,9 +1679,9 @@ function UEDynamicFilters(){
1599
  if(isReplaceMode == true)
1600
  urlAjax += "&ucreplace=1";
1601
 
1602
-
1603
  var output = {};
1604
  output["ajax_url"] = urlAjax;
 
1605
 
1606
  return(output);
1607
  }
@@ -1672,14 +1752,20 @@ function UEDynamicFilters(){
1672
  function initFilter(objFilter){
1673
 
1674
  var objGrid = getClosestGrid(objFilter);
1675
-
1676
- if(!objGrid)
 
 
 
1677
  return(null);
 
1678
 
1679
  var isAjax = objGrid.data("ajax");
1680
 
1681
- if(isAjax == false)
 
1682
  return(false);
 
1683
 
1684
  //bind grid to filter
1685
  objFilter.data("grid", objGrid);
@@ -1770,13 +1856,13 @@ function UEDynamicFilters(){
1770
 
1771
  if(objGrids.length == 0)
1772
  return(false);
1773
-
1774
  jQuery.each(objGrids, function(index, grid){
1775
 
1776
  var objGrid = jQuery(grid);
1777
 
1778
  var objInitFilters = objGrid.data("filters_init_after");
1779
-
1780
  if(!objInitFilters || objInitFilters.length == 0)
1781
  return(true);
1782
 
15
  CLASS_DIV_DEBUG:"uc-div-ajax-debug",
16
  CLASS_GRID:"uc-filterable-grid",
17
  handleTrashold:null,
18
+ DEBUG_AJAX_OPTIONS: false,
19
+ CLASS_CLICKED:"uc-clicked"
20
  };
21
 
22
  var g_options = {
425
 
426
  var objFilter = jQuery(filter);
427
 
428
+ var isMainFilter = objFilter.data("ismain");
429
 
430
  if(isMainFilter == true)
431
  return(true);
483
  var objLink = jQuery(this);
484
 
485
  var objPagination = objLink.parents(".uc-filter-pagination");
486
+
487
  var objLinkCurrent = objPagination.find(".current");
488
 
489
  objLinkCurrent.removeClass("current");
497
 
498
  //run the ajax, prevent default
499
 
500
+ objPagination.addClass(g_vars.CLASS_CLICKED);
501
+
502
+
503
  refreshAjaxGrid(objGrid);
504
 
505
  event.preventDefault();
515
  function getLoadMoreUrlData(objFilter){
516
 
517
  var objData = objFilter.find(".uc-filter-load-more__data");
 
 
 
 
518
 
519
+ var nextOffset = objData.data("nextoffset");
520
+ if(!nextOffset)
521
+ nextOffset = null;
522
+
523
  var numItems = objFilter.data("numitems");
524
 
525
  if(!numItems)
526
  numItems = null;
527
 
528
  var data = {};
529
+ data.offset = nextOffset;
530
  data.numItems = numItems;
531
 
532
  return(data);
553
  * do the load more operation
554
  */
555
  function onLoadMoreClick(){
556
+
557
  var objLink = jQuery(this);
558
 
559
  var objLoadMore = objLink.parents(".uc-filter-load-more");
564
 
565
  if(isMore == false)
566
  return(false);
567
+
568
  var objGrid = objLoadMore.data("grid");
569
 
570
  if(!objGrid || objGrid.length == 0)
572
 
573
  //run the ajax, prevent default
574
 
575
+ objLoadMore.addClass(g_vars.CLASS_CLICKED);
576
+
577
  refreshAjaxGrid(objGrid, "loadmore");
578
 
579
  }
680
  throw new Error("Grid not found");
681
 
682
  //if main filter - clear other filters
683
+ var isMainFilter = objTermsFilter.data("ismain");
684
 
685
  if(isMainFilter == true)
686
  clearGridFilters(objGrid);
704
  if(objSelected.length == 0)
705
  return(null);
706
 
707
+ var id = objSelected.data("id");
708
  var slug = objSelected.data("slug");
709
  var taxonomy = objSelected.data("taxonomy");
710
 
712
  return(null);
713
 
714
  var objTerm = {
715
+ "id": id,
716
  "slug": slug,
717
  "taxonomy": taxonomy
718
  };
731
  var objItems = objFilter.find(".ue_taxonomy_item");
732
 
733
  if(objItems.length == 0)
734
+ return(objIDs);
735
 
736
  jQuery.each(objItems, function(index, item){
737
 
1344
  * set ajax loader
1345
  */
1346
  function showAjaxLoader(objElement){
1347
+
1348
  objElement.addClass("uc-ajax-loading");
1349
  }
1350
 
1399
  return(false);
1400
 
1401
  var objAjaxOptions = getGridAjaxOptions(objFilters, objGrid, isFiltersInit);
1402
+
1403
+ if(!objAjaxOptions){
1404
+
1405
+ trace("ajax options are null");
1406
  return(false);
1407
+ }
1408
 
1409
  var ajaxUrl = objAjaxOptions["ajax_url"];
1410
+ var urlReplace = objAjaxOptions["url_replace"];
1411
 
1412
  if(g_vars.DEBUG_AJAX_OPTIONS == true){
1413
 
1416
  return(false);
1417
  }
1418
 
1419
+ //set the url params
1420
+ var behave = objGrid.data("filterbehave");
1421
+
1422
+ var isSetUrl = (behave == "mixed");
1423
+
1424
+ if(isFiltersInit == false && isSetUrl === true){
1425
+
1426
+ history.replaceState({}, null, urlReplace);
1427
+ }
1428
+
1429
+ //set the loaders
1430
+
1431
+ if(isLoadMore !== true && isFiltersInit !== true)
1432
  showAjaxLoader(objGrid);
1433
 
1434
  var objFiltersToReload = objFilters.filter(function(objFilter){
1436
  return objFilter.hasClass("uc-ajax-refresh-soon");
1437
  });
1438
 
1439
+
1440
  showMultipleAjaxLoaders(objFiltersToReload, true);
1441
 
1442
+ //ajax reload
1443
+
1444
  g_lastGridAjaxCall = objGrid;
1445
+
1446
  ajaxRequest(ajaxUrl,null,null, function(response){
1447
 
1448
  if(isLoadMore !== true)
1463
  * get grid ajax options
1464
  */
1465
  function getGridAjaxOptions(objFilters, objGrid, isFiltersInitMode){
1466
+
1467
  if(!objFilters)
1468
+ return(null);
1469
+
1470
+ var urlReplace = g_urlBase;
1471
 
1472
  var urlAjax = g_urlBase;
1473
 
1475
 
1476
  var isReplaceMode = false;
1477
  var page = null;
1478
+ var offset = null;
1479
  var numItems = null;
1480
  var arrTerms = [];
1481
  var objTaxIDs = {};
1482
+ var strSelectedTerms = "";
1483
 
1484
+ //add widget id of the filter to refresh
1485
 
1486
  //get ajax options
1487
  jQuery.each(objFilters, function(index, objFilter){
1488
 
1489
+ var isNoRefresh = objFilter.data("uc_norefresh");
1490
+
1491
  var type = getFilterType(objFilter);
1492
 
1493
  switch(type){
1494
  case g_types.PAGINATION:
1495
 
1496
+ if(isFiltersInitMode == true)
1497
+ return(true);
1498
+
1499
+ //run pagination only if it's clicked, unless reset pagination
1500
+ var isClicked = objFilter.hasClass(g_vars.CLASS_CLICKED);
1501
+ if(isClicked == true){
1502
+
1503
+ var urlPagination = getPaginationSelectedUrl(objFilter);
1504
+
1505
+ if(urlPagination)
1506
+ urlAjax = urlPagination;
1507
+
1508
+ objFilter.removeClass(g_vars.CLASS_CLICKED);
1509
+ }
1510
 
 
 
1511
  break;
1512
  case g_types.LOADMORE:
1513
+
1514
+ if(isFiltersInitMode == true)
1515
+ return(true);
1516
+
1517
+ //run load more only if it's clicked, unless reset load more
1518
+ var isClicked = objFilter.hasClass(g_vars.CLASS_CLICKED);
1519
+ if(isClicked == true){
1520
+
1521
+ var loadMoreData = getLoadMoreUrlData(objFilter);
1522
+ offset = loadMoreData.offset;
1523
+ numItems = loadMoreData.numItems;
1524
+
1525
+ if(!offset)
1526
+ urlAjax = null;
1527
+
1528
+ objFilter.removeClass(g_vars.CLASS_CLICKED);
1529
+ }
1530
+
1531
  break;
1532
  case g_types.TERMS_LIST:
1533
 
1534
  //if not init mode - take first item
1535
+ var objTerm = getTermsListSelectedTerm(objFilter);
1536
+
1537
+ if(objTerm){
1538
 
1539
+ if(isFiltersInitMode == false)
1540
  arrTerms.push(objTerm);
1541
+ else{
1542
+ var termID = objTerm.id;
1543
+ if(strSelectedTerms)
1544
+ strSelectedTerms +=",";
1545
+
1546
+ strSelectedTerms += termID;
1547
+ }
1548
  }
1549
 
1550
  //replace mode
1552
  var modeReplace = objFilter.data("replace-mode");
1553
  if(modeReplace === true)
1554
  isReplaceMode = true;
1555
+
1556
  break;
1557
  case g_types.CHECKBOX:
1558
 
1563
  throw new Error("Unknown filter type: "+type);
1564
  break;
1565
  }
1566
+
 
 
 
1567
 
1568
  //handle filters init mode
1569
 
1577
 
1578
  objFilter.data("uc_norefresh",false);
1579
 
1580
+ var isMainFilter = objFilter.data("ismain");
1581
+
1582
+ //add to refresh filter if it's qualify
1583
+ var isRefresh = true;
1584
+
1585
+ if(isFiltersInitMode == false && isMainFilter === true)
1586
+ isRefresh = false;
1587
 
1588
+ if(isNoRefresh === true)
1589
+ isRefresh = false;
1590
+
1591
+
1592
+ if(isRefresh == true){
1593
 
1594
+ var filterWidgetID = getElementWidgetID(objFilter);
1595
 
1596
+ //add test tax id's for init mode
1597
+ objTaxIDs = getFilterTaxIDs(objFilter, objTaxIDs);
1598
+
1599
+ if(strRefreshIDs)
1600
+ strRefreshIDs += ",";
 
 
 
 
 
 
 
 
 
1601
 
1602
+ strRefreshIDs += filterWidgetID;
1603
+
1604
+ objFilter.addClass("uc-ajax-refresh-soon");
1605
  }
1606
+
1607
 
1608
  }); //end filters iteration
1609
 
1612
 
1613
  var urlAddition_filtersTest = "";
1614
  var strTaxIDs = getTermDsList(objTaxIDs);
1615
+
1616
  if(isFiltersInitMode == true){
1617
+
1618
  if(!strTaxIDs)
1619
  urlAjax = null;
1620
  else{
1621
+
1622
+ if(urlAddition_filtersTest)
1623
+ urlAddition_filtersTest += "&";
1624
+
1625
+ urlAddition_filtersTest += "modeinit=true";
1626
  }
1627
  }
1628
 
1632
 
1633
  urlAddition_filtersTest += "testtermids="+strTaxIDs;
1634
  }
1635
+
1636
 
1637
  if(urlAjax == null)
1638
  return(null);
1652
  if(page)
1653
  urlAjax += "&ucpage="+page;
1654
 
1655
+ if(offset)
1656
+ urlAjax += "&ucoffset="+offset;
1657
+
1658
  if(numItems)
1659
  urlAjax += "&uccount="+numItems;
1660
 
1661
  if(arrTerms.length){
1662
+
1663
  var strTerms = buildTermsQuery(arrTerms);
1664
  if(strTerms)
1665
  urlAjax += "&ucterms="+strTerms;
1666
+
1667
+ //set the url params as well
1668
+
1669
+ urlReplace = addUrlParam(urlReplace, "ucterms="+strTerms);
1670
  }
1671
 
1672
+ if(isFiltersInitMode && strSelectedTerms)
1673
+ urlAjax += "&ucinitselectedterms="+strSelectedTerms;
1674
+
1675
  //add refresh ids
1676
  if(strRefreshIDs)
1677
  urlAjax += "&addelids="+strRefreshIDs;
1679
  if(isReplaceMode == true)
1680
  urlAjax += "&ucreplace=1";
1681
 
 
1682
  var output = {};
1683
  output["ajax_url"] = urlAjax;
1684
+ output["url_replace"] = urlReplace;
1685
 
1686
  return(output);
1687
  }
1752
  function initFilter(objFilter){
1753
 
1754
  var objGrid = getClosestGrid(objFilter);
1755
+
1756
+ var error = "Filter Parent not found! Please put the posts element on the page, and turn on 'Enable Ajax' option on it";
1757
+
1758
+ if(!objGrid){
1759
+ showElementError(objFilter, error);
1760
  return(null);
1761
+ }
1762
 
1763
  var isAjax = objGrid.data("ajax");
1764
 
1765
+ if(isAjax == false){
1766
+ showElementError(objFilter, error);
1767
  return(false);
1768
+ }
1769
 
1770
  //bind grid to filter
1771
  objFilter.data("grid", objGrid);
1856
 
1857
  if(objGrids.length == 0)
1858
  return(false);
1859
+
1860
  jQuery.each(objGrids, function(index, grid){
1861
 
1862
  var objGrid = jQuery(grid);
1863
 
1864
  var objInitFilters = objGrid.data("filters_init_after");
1865
+
1866
  if(!objInitFilters || objInitFilters.length == 0)
1867
  return(true);
1868
 
assets_libraries/owl-carousel-new/owl.carousel.js CHANGED
@@ -1,3494 +1,3506 @@
1
- /**
2
- * Owl Carousel v2.3.5 - UE3
3
- * Copyright 2013-2018 David Deutsch
4
- * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
- */
6
- /**
7
- * Owl carousel
8
- * @version 2.3.5
9
- * @author Bartosz Wojciechowski
10
- * @author David Deutsch
11
- * @license The MIT License (MIT)
12
- * @todo Lazy Load Icon
13
- * @todo prevent animationend bubling
14
- * @todo itemsScaleUp
15
- * @todo Test Zepto
16
- * @todo stagePadding calculate wrong active classes
17
- */
18
- ;(function($, window, document, undefined) {
19
-
20
- /**
21
- * Creates a carousel.
22
- * @class The Owl Carousel.
23
- * @public
24
- * @param {HTMLElement|jQuery} element - The element to create the carousel for.
25
- * @param {Object} [options] - The options
26
- */
27
- function Owl(element, options) {
28
-
29
- /**
30
- * Current settings for the carousel.
31
- * @public
32
- */
33
- this.settings = null;
34
-
35
- /**
36
- * Current options set by the caller including defaults.
37
- * @public
38
- */
39
- this.options = $.extend({}, Owl.Defaults, options);
40
-
41
- /**
42
- * Plugin element.
43
- * @public
44
- */
45
- this.$element = $(element);
46
-
47
- /**
48
- * Proxied event handlers.
49
- * @protected
50
- */
51
- this._handlers = {};
52
-
53
- /**
54
- * References to the running plugins of this carousel.
55
- * @protected
56
- */
57
- this._plugins = {};
58
-
59
- /**
60
- * Currently suppressed events to prevent them from being retriggered.
61
- * @protected
62
- */
63
- this._supress = {};
64
-
65
- /**
66
- * Absolute current position.
67
- * @protected
68
- */
69
- this._current = null;
70
-
71
- /**
72
- * Animation speed in milliseconds.
73
- * @protected
74
- */
75
- this._speed = null;
76
-
77
- /**
78
- * Coordinates of all items in pixel.
79
- * @todo The name of this member is missleading.
80
- * @protected
81
- */
82
- this._coordinates = [];
83
-
84
- /**
85
- * Current breakpoint.
86
- * @todo Real media queries would be nice.
87
- * @protected
88
- */
89
- this._breakpoint = null;
90
-
91
- /**
92
- * Current width of the plugin element.
93
- */
94
- this._width = null;
95
-
96
- /**
97
- * All real items.
98
- * @protected
99
- */
100
- this._items = [];
101
-
102
- /**
103
- * All cloned items.
104
- * @protected
105
- */
106
- this._clones = [];
107
-
108
- /**
109
- * Merge values of all items.
110
- * @todo Maybe this could be part of a plugin.
111
- * @protected
112
- */
113
- this._mergers = [];
114
-
115
- /**
116
- * Widths of all items.
117
- */
118
- this._widths = [];
119
-
120
- /**
121
- * Invalidated parts within the update process.
122
- * @protected
123
- */
124
- this._invalidated = {};
125
-
126
- /**
127
- * Ordered list of workers for the update process.
128
- * @protected
129
- */
130
- this._pipe = [];
131
-
132
- /**
133
- * Current state information for the drag operation.
134
- * @todo #261
135
- * @protected
136
- */
137
- this._drag = {
138
- time: null,
139
- target: null,
140
- pointer: null,
141
- stage: {
142
- start: null,
143
- current: null
144
- },
145
- direction: null
146
- };
147
-
148
- /**
149
- * Current state information and their tags.
150
- * @type {Object}
151
- * @protected
152
- */
153
- this._states = {
154
- current: {},
155
- tags: {
156
- 'initializing': [ 'busy' ],
157
- 'animating': [ 'busy' ],
158
- 'dragging': [ 'interacting' ]
159
- }
160
- };
161
-
162
- $.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) {
163
- this._handlers[handler] = $.proxy(this[handler], this);
164
- }, this));
165
-
166
- $.each(Owl.Plugins, $.proxy(function(key, plugin) {
167
- this._plugins[key.charAt(0).toLowerCase() + key.slice(1)]
168
- = new plugin(this);
169
- }, this));
170
-
171
- $.each(Owl.Workers, $.proxy(function(priority, worker) {
172
- this._pipe.push({
173
- 'filter': worker.filter,
174
- 'run': $.proxy(worker.run, this)
175
- });
176
- }, this));
177
-
178
- this.setup();
179
- this.initialize();
180
- }
181
-
182
- /**
183
- * Default options for the carousel.
184
- * @public
185
- */
186
- Owl.Defaults = {
187
- items: 3,
188
- loop: false,
189
- center: false,
190
- rewind: false,
191
- checkVisibility: true,
192
- setActiveClass: true,
193
- setActiveClassOnMobile: true,
194
-
195
- mouseDrag: true,
196
- touchDrag: true,
197
- pullDrag: true,
198
- freeDrag: false,
199
-
200
- margin: 0,
201
- stagePadding: 0,
202
-
203
- merge: false,
204
- mergeFit: true,
205
- autoWidth: false,
206
-
207
- startPosition: 0,
208
- rtl: false,
209
-
210
- smartSpeed: 250,
211
- fluidSpeed: false,
212
- dragEndSpeed: false,
213
-
214
- responsive: {},
215
- responsiveRefreshRate: 200,
216
- responsiveBaseElement: window,
217
-
218
- fallbackEasing: 'swing',
219
- slideTransition: '',
220
-
221
- info: false,
222
-
223
- nestedItemSelector: false,
224
- itemElement: 'div',
225
- stageElement: 'div',
226
-
227
- refreshClass: 'owl-refresh',
228
- loadedClass: 'owl-loaded',
229
- loadingClass: 'owl-loading',
230
- rtlClass: 'owl-rtl',
231
- responsiveClass: 'owl-responsive',
232
- dragClass: 'owl-drag',
233
- itemClass: 'owl-item',
234
- stageClass: 'owl-stage',
235
- stageOuterClass: 'owl-stage-outer',
236
- grabClass: 'owl-grab'
237
- };
238
-
239
- /**
240
- * Enumeration for width.
241
- * @public
242
- * @readonly
243
- * @enum {String}
244
- */
245
- Owl.Width = {
246
- Default: 'default',
247
- Inner: 'inner',
248
- Outer: 'outer'
249
- };
250
-
251
- /**
252
- * Enumeration for types.
253
- * @public
254
- * @readonly
255
- * @enum {String}
256
- */
257
- Owl.Type = {
258
- Event: 'event',
259
- State: 'state'
260
- };
261
-
262
- /**
263
- * Contains all registered plugins.
264
- * @public
265
- */
266
- Owl.Plugins = {};
267
-
268
- /**
269
- * List of workers involved in the update process.
270
- */
271
- Owl.Workers = [ {
272
- filter: [ 'width', 'settings' ],
273
- run: function() {
274
- this._width = this.$element.width();
275
- }
276
- }, {
277
- filter: [ 'width', 'items', 'settings' ],
278
- run: function(cache) {
279
- cache.current = this._items && this._items[this.relative(this._current)];
280
- }
281
- }, {
282
- filter: [ 'items', 'settings' ],
283
- run: function() {
284
- this.$stage.children('.cloned').remove();
285
- }
286
- }, {
287
- filter: [ 'width', 'items', 'settings' ],
288
- run: function(cache) {
289
- var margin = this.settings.margin || '',
290
- grid = !this.settings.autoWidth,
291
- rtl = this.settings.rtl,
292
- css = {
293
- 'width': 'auto',
294
- 'margin-left': rtl ? margin : '',
295
- 'margin-right': rtl ? '' : margin
296
- };
297
-
298
- !grid && this.$stage.children().css(css);
299
-
300
- cache.css = css;
301
- }
302
- }, {
303
- filter: [ 'width', 'items', 'settings' ],
304
- run: function(cache) {
305
- var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
306
- merge = null,
307
- iterator = this._items.length,
308
- grid = !this.settings.autoWidth,
309
- widths = [];
310
-
311
- cache.items = {
312
- merge: false,
313
- width: width
314
- };
315
-
316
- while (iterator--) {
317
- merge = this._mergers[iterator];
318
- merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
319
-
320
- cache.items.merge = merge > 1 || cache.items.merge;
321
-
322
- widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
323
- }
324
-
325
- this._widths = widths;
326
- }
327
- }, {
328
- filter: [ 'items', 'settings' ],
329
- run: function() {
330
- var clones = [],
331
- items = this._items,
332
- settings = this.settings,
333
- // TODO: Should be computed from number of min width items in stage
334
- view = Math.max(settings.items * 2, 4),
335
- size = Math.ceil(items.length / 2) * 2,
336
- repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0,
337
- append = '',
338
- prepend = '';
339
-
340
- repeat /= 2;
341
-
342
- while (repeat > 0) {
343
- // Switch to only using appended clones
344
- clones.push(this.normalize(clones.length / 2, true));
345
- append = append + items[clones[clones.length - 1]][0].outerHTML;
346
- clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true));
347
- prepend = items[clones[clones.length - 1]][0].outerHTML + prepend;
348
- repeat -= 1;
349
- }
350
-
351
- this._clones = clones;
352
-
353
- $(append).addClass('cloned').appendTo(this.$stage);
354
- $(prepend).addClass('cloned').prependTo(this.$stage);
355
- }
356
- }, {
357
- filter: [ 'width', 'items', 'settings' ],
358
- run: function() {
359
- var rtl = this.settings.rtl ? 1 : -1,
360
- size = this._clones.length + this._items.length,
361
- iterator = -1,
362
- previous = 0,
363
- current = 0,
364
- coordinates = [];
365
-
366
- while (++iterator < size) {
367
- previous = coordinates[iterator - 1] || 0;
368
- current = this._widths[this.relative(iterator)] + this.settings.margin;
369
- coordinates.push(previous + current * rtl);
370
- }
371
-
372
- this._coordinates = coordinates;
373
- }
374
- }, {
375
- filter: [ 'width', 'items', 'settings' ],
376
- run: function() {
377
- var padding = this.settings.stagePadding,
378
- coordinates = this._coordinates,
379
- css = {
380
- 'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2,
381
- 'padding-left': padding || '',
382
- 'padding-right': padding || ''
383
- };
384
-
385
- this.$stage.css(css);
386
- }
387
- }, {
388
- filter: [ 'width', 'items', 'settings' ],
389
- run: function(cache) {
390
- var iterator = this._coordinates.length,
391
- grid = !this.settings.autoWidth,
392
- items = this.$stage.children();
393
-
394
- if (grid && cache.items.merge) {
395
- while (iterator--) {
396
- cache.css.width = this._widths[this.relative(iterator)];
397
- items.eq(iterator).css(cache.css);
398
- }
399
- } else if (grid) {
400
- cache.css.width = cache.items.width;
401
- items.css(cache.css);
402
- }
403
- }
404
- }, {
405
- filter: [ 'items' ],
406
- run: function() {
407
- this._coordinates.length < 1 && this.$stage.removeAttr('style');
408
- }
409
- }, {
410
- filter: [ 'width', 'items', 'settings' ],
411
- run: function(cache) {
412
- cache.current = cache.current ? this.$stage.children().index(cache.current) : 0;
413
- cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current));
414
- this.reset(cache.current);
415
- }
416
- }, {
417
- filter: [ 'position' ],
418
- run: function() {
419
- this.animate(this.coordinates(this._current));
420
- }
421
- }, {
422
- filter: [ 'width', 'position', 'items', 'settings' ],
423
- run: function() {
424
- var rtl = this.settings.rtl ? 1 : -1,
425
- padding = this.settings.stagePadding * 2,
426
- begin = this.coordinates(this.current()) + padding,
427
- end = begin + this.width() * rtl,
428
- inner, outer, matches = [], i, n;
429
-
430
- for (i = 0, n = this._coordinates.length; i < n; i++) {
431
- inner = this._coordinates[i - 1] || 0;
432
- outer = Math.abs(this._coordinates[i]) + padding * rtl;
433
-
434
- if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
435
- || (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
436
- matches.push(i);
437
- }
438
- }
439
-
440
- this.$stage.children('.active').removeClass('active');
441
- this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active');
442
-
443
- this.$stage.children('.center').removeClass('center');
444
- if (this.settings.center) {
445
- this.$stage.children().eq(this.current()).addClass('center');
446
- }
447
- }
448
- }, {
449
- filter: [ 'width', 'position', 'items', 'settings' ],
450
- run: function() {
451
-
452
- if(!this.settings.setActiveClass){
453
- return;
454
- }
455
-
456
- if (this.settings.setActiveClass) {
457
- var $setClass = true;
458
-
459
- if (this.settings.setActiveClassOnMobile) {
460
- if(this.$stage.children(".active").length == 1){
461
- $setClass = true;
462
- }
463
- }else if(!this.settings.setActiveClassOnMobile){
464
- if(this.$stage.children(".active").length == 1){
465
- $setClass = false;
466
- }
467
- }
468
-
469
- if($setClass == true){
470
- this.$stage.children().eq(this.current()).addClass("uc-active-item").siblings().removeClass("uc-active-item");
471
- }else if ($setClass == false){
472
- this.$stage.children().removeClass("uc-active-item");
473
- }
474
-
475
- }
476
- }
477
- }];
478
-
479
- /**
480
- * Create the stage DOM element
481
- */
482
- Owl.prototype.initializeStage = function() {
483
- this.$stage = this.$element.find('.' + this.settings.stageClass);
484
-
485
- // if the stage is already in the DOM, grab it and skip stage initialization
486
- if (this.$stage.length) {
487
- return;
488
- }
489
-
490
- this.$element.addClass(this.options.loadingClass);
491
-
492
- // create stage
493
- this.$stage = $('<' + this.settings.stageElement + '>', {
494
- "class": this.settings.stageClass
495
- }).wrap( $( '<div/>', {
496
- "class": this.settings.stageOuterClass
497
- }));
498
-
499
- // append stage
500
- this.$element.append(this.$stage.parent());
501
- };
502
-
503
- /**
504
- * Create item DOM elements
505
- */
506
- Owl.prototype.initializeItems = function() {
507
- var $items = this.$element.find('.owl-item');
508
-
509
- // if the items are already in the DOM, grab them and skip item initialization
510
- if ($items.length) {
511
- this._items = $items.get().map(function(item) {
512
- return $(item);
513
- });
514
-
515
- this._mergers = this._items.map(function() {
516
- return 1;
517
- });
518
-
519
- this.refresh();
520
-
521
- return;
522
- }
523
-
524
- // append content
525
- this.replace(this.$element.children().not(this.$stage.parent()));
526
-
527
- // check visibility
528
- if (this.isVisible()) {
529
- // update view
530
- this.refresh();
531
- } else {
532
- // invalidate width
533
- this.invalidate('width');
534
- }
535
-
536
- this.$element
537
- .removeClass(this.options.loadingClass)
538
- .addClass(this.options.loadedClass);
539
- };
540
-
541
- /**
542
- * Initializes the carousel.
543
- * @protected
544
- */
545
- Owl.prototype.initialize = function() {
546
- this.enter('initializing');
547
- this.trigger('initialize');
548
-
549
- this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
550
-
551
- if (this.settings.autoWidth && !this.is('pre-loading')) {
552
- var imgs, nestedSelector, width;
553
- imgs = this.$element.find('img');
554
- nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
555
- width = this.$element.children(nestedSelector).width();
556
-
557
- if (imgs.length && width <= 0) {
558
- this.preloadAutoWidthImages(imgs);
559
- }
560
- }
561
-
562
- this.initializeStage();
563
- this.initializeItems();
564
-
565
- // register event handlers
566
- this.registerEventHandlers();
567
-
568
- this.leave('initializing');
569
- this.trigger('initialized');
570
- };
571
-
572
- /**
573
- * @returns {Boolean} visibility of $element
574
- * if you know the carousel will always be visible you can set `checkVisibility` to `false` to
575
- * prevent the expensive browser layout forced reflow the $element.is(':visible') does
576
- */
577
- Owl.prototype.isVisible = function() {
578
- return this.settings.checkVisibility
579
- ? this.$element.is(':visible')
580
- : true;
581
- };
582
-
583
- /**
584
- * Setups the current settings.
585
- * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
586
- * @todo Support for media queries by using `matchMedia` would be nice.
587
- * @public
588
- */
589
- Owl.prototype.setup = function() {
590
- var viewport = this.viewport(),
591
- overwrites = this.options.responsive,
592
- match = -1,
593
- settings = null;
594
-
595
- if (!overwrites) {
596
- settings = $.extend({}, this.options);
597
- } else {
598
- $.each(overwrites, function(breakpoint) {
599
- if (breakpoint <= viewport && breakpoint > match) {
600
- match = Number(breakpoint);
601
- }
602
- });
603
-
604
- settings = $.extend({}, this.options, overwrites[match]);
605
- if (typeof settings.stagePadding === 'function') {
606
- settings.stagePadding = settings.stagePadding();
607
- }
608
- delete settings.responsive;
609
-
610
- // responsive class
611
- if (settings.responsiveClass) {
612
- this.$element.attr('class',
613
- this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match)
614
- );
615
- }
616
- }
617
-
618
- this.trigger('change', { property: { name: 'settings', value: settings } });
619
- this._breakpoint = match;
620
- this.settings = settings;
621
- this.invalidate('settings');
622
- this.trigger('changed', { property: { name: 'settings', value: this.settings } });
623
- };
624
-
625
- /**
626
- * Updates option logic if necessery.
627
- * @protected
628
- */
629
- Owl.prototype.optionsLogic = function() {
630
- if (this.settings.autoWidth) {
631
- this.settings.stagePadding = false;
632
- this.settings.merge = false;
633
- }
634
- };
635
-
636
- /**
637
- * Prepares an item before add.
638
- * @todo Rename event parameter `content` to `item`.
639
- * @protected
640
- * @returns {jQuery|HTMLElement} - The item container.
641
- */
642
- Owl.prototype.prepare = function(item) {
643
- var event = this.trigger('prepare', { content: item });
644
-
645
- if (!event.data) {
646
- event.data = $('<' + this.settings.itemElement + '/>')
647
- .addClass(this.options.itemClass).append(item)
648
- }
649
-
650
- this.trigger('prepared', { content: event.data });
651
-
652
- return event.data;
653
- };
654
-
655
- /**
656
- * Updates the view.
657
- * @public
658
- */
659
- Owl.prototype.update = function() {
660
- var i = 0,
661
- n = this._pipe.length,
662
- filter = $.proxy(function(p) { return this[p] }, this._invalidated),
663
- cache = {};
664
-
665
- while (i < n) {
666
- if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
667
- this._pipe[i].run(cache);
668
- }
669
- i++;
670
- }
671
-
672
- this._invalidated = {};
673
-
674
- !this.is('valid') && this.enter('valid');
675
- };
676
-
677
- /**
678
- * Gets the width of the view.
679
- * @public
680
- * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
681
- * @returns {Number} - The width of the view in pixel.
682
- */
683
- Owl.prototype.width = function(dimension) {
684
- dimension = dimension || Owl.Width.Default;
685
- switch (dimension) {
686
- case Owl.Width.Inner:
687
- case Owl.Width.Outer:
688
- return this._width;
689
- default:
690
- return this._width - this.settings.stagePadding * 2 + this.settings.margin;
691
- }
692
- };
693
-
694
- /**
695
- * Refreshes the carousel primarily for adaptive purposes.
696
- * @public
697
- */
698
- Owl.prototype.refresh = function() {
699
- this.enter('refreshing');
700
- this.trigger('refresh');
701
-
702
- this.setup();
703
-
704
- this.optionsLogic();
705
-
706
- this.$element.addClass(this.options.refreshClass);
707
-
708
- this.update();
709
-
710
- this.$element.removeClass(this.options.refreshClass);
711
-
712
- this.leave('refreshing');
713
- this.trigger('refreshed');
714
- };
715
-
716
- /**
717
- * Checks window `resize` event.
718
- * @protected
719
- */
720
- Owl.prototype.onThrottledResize = function() {
721
- window.clearTimeout(this.resizeTimer);
722
- this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate);
723
- };
724
-
725
- /**
726
- * Checks window `resize` event.
727
- * @protected
728
- */
729
- Owl.prototype.onResize = function() {
730
- if (!this._items.length) {
731
- return false;
732
- }
733
-
734
- if (this._width === this.$element.width()) {
735
- return false;
736
- }
737
-
738
- if (!this.isVisible()) {
739
- return false;
740
- }
741
-
742
- this.enter('resizing');
743
-
744
- if (this.trigger('resize').isDefaultPrevented()) {
745
- this.leave('resizing');
746
- return false;
747
- }
748
-
749
- this.invalidate('width');
750
-
751
- this.refresh();
752
-
753
- this.leave('resizing');
754
- this.trigger('resized');
755
- };
756
-
757
- /**
758
- * Registers event handlers.
759
- * @todo Check `msPointerEnabled`
760
- * @todo #261
761
- * @protected
762
- */
763
- Owl.prototype.registerEventHandlers = function() {
764
- if ($.support.transition) {
765
- this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
766
- }
767
-
768
- if (this.settings.responsive !== false) {
769
- this.on(window, 'resize', this._handlers.onThrottledResize);
770
- }
771
-
772
- if (this.settings.mouseDrag) {
773
- this.$element.addClass(this.options.dragClass);
774
- this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this));
775
- this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false });
776
- }
777
-
778
- if (this.settings.touchDrag){
779
- this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this));
780
- this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this));
781
- }
782
- };
783
-
784
- /**
785
- * Handles `touchstart` and `mousedown` events.
786
- * @todo Horizontal swipe threshold as option
787
- * @todo #261
788
- * @protected
789
- * @param {Event} event - The event arguments.
790
- */
791
- Owl.prototype.onDragStart = function(event) {
792
- var stage = null;
793
-
794
- if (event.which === 3) {
795
- return;
796
- }
797
-
798
- if ($.support.transform) {
799
- stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(',');
800
- stage = {
801
- x: stage[stage.length === 16 ? 12 : 4],
802
- y: stage[stage.length === 16 ? 13 : 5]
803
- };
804
- } else {
805
- stage = this.$stage.position();
806
- stage = {
807
- x: this.settings.rtl ?
808
- stage.left + this.$stage.width() - this.width() + this.settings.margin :
809
- stage.left,
810
- y: stage.top
811
- };
812
- }
813
-
814
- if (this.is('animating')) {
815
- $.support.transform ? this.animate(stage.x) : this.$stage.stop()
816
- this.invalidate('position');
817
- }
818
-
819
- this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown');
820
-
821
- this.speed(0);
822
-
823
- this._drag.time = new Date().getTime();
824
- this._drag.target = $(event.target);
825
- this._drag.stage.start = stage;
826
- this._drag.stage.current = stage;
827
- this._drag.pointer = this.pointer(event);
828
-
829
- $(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this));
830
-
831
- $(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) {
832
- var delta = this.difference(this._drag.pointer, this.pointer(event));
833
-
834
- $(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this));
835
-
836
- if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) {
837
- return;
838
- }
839
-
840
- event.preventDefault();
841
-
842
- this.enter('dragging');
843
- this.trigger('drag');
844
- }, this));
845
- };
846
-
847
- /**
848
- * Handles the `touchmove` and `mousemove` events.
849
- * @todo #261
850
- * @protected
851
- * @param {Event} event - The event arguments.
852
- */
853
- Owl.prototype.onDragMove = function(event) {
854
- var minimum = null,
855
- maximum = null,
856
- pull = null,
857
- delta = this.difference(this._drag.pointer, this.pointer(event)),
858
- stage = this.difference(this._drag.stage.start, delta);
859
-
860
- if (!this.is('dragging')) {
861
- return;
862
- }
863
-
864
- event.preventDefault();
865
-
866
- if (this.settings.loop) {
867
- minimum = this.coordinates(this.minimum());
868
- maximum = this.coordinates(this.maximum() + 1) - minimum;
869
- stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum;
870
- } else {
871
- minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
872
- maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
873
- pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0;
874
- stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull);
875
- }
876
-
877
- this._drag.stage.current = stage;
878
-
879
- this.animate(stage.x);
880
- };
881
-
882
- /**
883
- * Handles the `touchend` and `mouseup` events.
884
- * @todo #261
885
- * @todo Threshold for click event
886
- * @protected
887
- * @param {Event} event - The event arguments.
888
- */
889
- Owl.prototype.onDragEnd = function(event) {
890
- var delta = this.difference(this._drag.pointer, this.pointer(event)),
891
- stage = this._drag.stage.current,
892
- direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right';
893
-
894
- $(document).off('.owl.core');
895
-
896
- this.$element.removeClass(this.options.grabClass);
897
-
898
- if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) {
899
- this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
900
- this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction));
901
- this.invalidate('position');
902
- this.update();
903
-
904
- this._drag.direction = direction;
905
-
906
- if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) {
907
- this._drag.target.one('click.owl.core', function() { return false; });
908
- }
909
- }
910
-
911
- if (!this.is('dragging')) {
912
- return;
913
- }
914
-
915
- this.leave('dragging');
916
- this.trigger('dragged');
917
- };
918
-
919
- /**
920
- * Gets absolute position of the closest item for a coordinate.
921
- * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
922
- * @protected
923
- * @param {Number} coordinate - The coordinate in pixel.
924
- * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`.
925
- * @return {Number} - The absolute position of the closest item.
926
- */
927
- Owl.prototype.closest = function(coordinate, direction) {
928
- var position = -1,
929
- pull = 30,
930
- width = this.width(),
931
- coordinates = this.coordinates();
932
-
933
- if (!this.settings.freeDrag) {
934
- // check closest item
935
- $.each(coordinates, $.proxy(function(index, value) {
936
- // on a left pull, check on current index
937
- if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) {
938
- position = index;
939
- // on a right pull, check on previous index
940
- // to do so, subtract width from value and set position = index + 1
941
- } else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) {
942
- position = index + 1;
943
- } else if (this.op(coordinate, '<', value)
944
- && this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) {
945
- position = direction === 'left' ? index + 1 : index;
946
- }
947
- return position === -1;
948
- }, this));
949
- }
950
-
951
- if (!this.settings.loop) {
952
- // non loop boundries
953
- if (this.op(coordinate, '>', coordinates[this.minimum()])) {
954
- position = coordinate = this.minimum();
955
- } else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
956
- position = coordinate = this.maximum();
957
- }
958
- }
959
-
960
- return position;
961
- };
962
-
963
- /**
964
- * Animates the stage.
965
- * @todo #270
966
- * @public
967
- * @param {Number} coordinate - The coordinate in pixels.
968
- */
969
- Owl.prototype.animate = function(coordinate) {
970
- var animate = this.speed() > 0;
971
-
972
- this.is('animating') && this.onTransitionEnd();
973
-
974
- if (animate) {
975
- this.enter('animating');
976
- this.trigger('translate');
977
- }
978
-
979
- if ($.support.transform3d && $.support.transition) {
980
- this.$stage.css({
981
- transform: 'translate3d(' + coordinate + 'px,0px,0px)',
982
- transition: (this.speed() / 1000) + 's' + (
983
- this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
984
- )
985
- });
986
- } else if (animate) {
987
- this.$stage.animate({
988
- left: coordinate + 'px'
989
- }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
990
- } else {
991
- this.$stage.css({
992
- left: coordinate + 'px'
993
- });
994
- }
995
- };
996
-
997
- /**
998
- * Checks whether the carousel is in a specific state or not.
999
- * @param {String} state - The state to check.
1000
- * @returns {Boolean} - The flag which indicates if the carousel is busy.
1001
- */
1002
- Owl.prototype.is = function(state) {
1003
- return this._states.current[state] && this._states.current[state] > 0;
1004
- };
1005
-
1006
- /**
1007
- * Sets the absolute position of the current item.
1008
- * @public
1009
- * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
1010
- * @returns {Number} - The absolute position of the current item.
1011
- */
1012
- Owl.prototype.current = function(position) {
1013
- if (position === undefined) {
1014
- return this._current;
1015
- }
1016
-
1017
- if (this._items.length === 0) {
1018
- return undefined;
1019
- }
1020
-
1021
- position = this.normalize(position);
1022
-
1023
- if (this._current !== position) {
1024
- var event = this.trigger('change', { property: { name: 'position', value: position } });
1025
-
1026
- if (event.data !== undefined) {
1027
- position = this.normalize(event.data);
1028
- }
1029
-
1030
- this._current = position;
1031
-
1032
- this.invalidate('position');
1033
-
1034
- this.trigger('changed', { property: { name: 'position', value: this._current } });
1035
- }
1036
-
1037
- return this._current;
1038
- };
1039
-
1040
- /**
1041
- * Invalidates the given part of the update routine.
1042
- * @param {String} [part] - The part to invalidate.
1043
- * @returns {Array.<String>} - The invalidated parts.
1044
- */
1045
- Owl.prototype.invalidate = function(part) {
1046
- if ($.type(part) === 'string') {
1047
- this._invalidated[part] = true;
1048
- this.is('valid') && this.leave('valid');
1049
- }
1050
- return $.map(this._invalidated, function(v, i) { return i });
1051
- };
1052
-
1053
- /**
1054
- * Resets the absolute position of the current item.
1055
- * @public
1056
- * @param {Number} position - The absolute position of the new item.
1057
- */
1058
- Owl.prototype.reset = function(position) {
1059
- position = this.normalize(position);
1060
-
1061
- if (position === undefined) {
1062
- return;
1063
- }
1064
-
1065
- this._speed = 0;
1066
- this._current = position;
1067
-
1068
- this.suppress([ 'translate', 'translated' ]);
1069
-
1070
- this.animate(this.coordinates(position));
1071
-
1072
- this.release([ 'translate', 'translated' ]);
1073
- };
1074
-
1075
- /**
1076
- * Normalizes an absolute or a relative position of an item.
1077
- * @public
1078
- * @param {Number} position - The absolute or relative position to normalize.
1079
- * @param {Boolean} [relative=false] - Whether the given position is relative or not.
1080
- * @returns {Number} - The normalized position.
1081
- */
1082
- Owl.prototype.normalize = function(position, relative) {
1083
- var n = this._items.length,
1084
- m = relative ? 0 : this._clones.length;
1085
-
1086
- if (!this.isNumeric(position) || n < 1) {
1087
- position = undefined;
1088
- } else if (position < 0 || position >= n + m) {
1089
- position = ((position - m / 2) % n + n) % n + m / 2;
1090
- }
1091
-
1092
- return position;
1093
- };
1094
-
1095
- /**
1096
- * Converts an absolute position of an item into a relative one.
1097
- * @public
1098
- * @param {Number} position - The absolute position to convert.
1099
- * @returns {Number} - The converted position.
1100
- */
1101
- Owl.prototype.relative = function(position) {
1102
- position -= this._clones.length / 2;
1103
- return this.normalize(position, true);
1104
- };
1105
-
1106
- /**
1107
- * Gets the maximum position for the current item.
1108
- * @public
1109
- * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1110
- * @returns {Number}
1111
- */
1112
- Owl.prototype.maximum = function(relative) {
1113
- var settings = this.settings,
1114
- maximum = this._coordinates.length,
1115
- iterator,
1116
- reciprocalItemsWidth,
1117
- elementWidth;
1118
-
1119
- if (settings.loop) {
1120
- maximum = this._clones.length / 2 + this._items.length - 1;
1121
- } else if (settings.autoWidth || settings.merge) {
1122
- iterator = this._items.length;
1123
- if (iterator) {
1124
- reciprocalItemsWidth = this._items[--iterator].width();
1125
- elementWidth = this.$element.width();
1126
- while (iterator--) {
1127
- reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin;
1128
- if (reciprocalItemsWidth > elementWidth) {
1129
- break;
1130
- }
1131
- }
1132
- }
1133
- maximum = iterator + 1;
1134
- } else if (settings.center) {
1135
- maximum = this._items.length - 1;
1136
- } else {
1137
- maximum = this._items.length - settings.items;
1138
- }
1139
-
1140
- if (relative) {
1141
- maximum -= this._clones.length / 2;
1142
- }
1143
-
1144
- return Math.max(maximum, 0);
1145
- };
1146
-
1147
- /**
1148
- * Gets the minimum position for the current item.
1149
- * @public
1150
- * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1151
- * @returns {Number}
1152
- */
1153
- Owl.prototype.minimum = function(relative) {
1154
- return relative ? 0 : this._clones.length / 2;
1155
- };
1156
-
1157
- /**
1158
- * Gets an item at the specified relative position.
1159
- * @public
1160
- * @param {Number} [position] - The relative position of the item.
1161
- * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1162
- */
1163
- Owl.prototype.items = function(position) {
1164
- if (position === undefined) {
1165
- return this._items.slice();
1166
- }
1167
-
1168
- position = this.normalize(position, true);
1169
- return this._items[position];
1170
- };
1171
-
1172
- /**
1173
- * Gets an item at the specified relative position.
1174
- * @public
1175
- * @param {Number} [position] - The relative position of the item.
1176
- * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1177
- */
1178
- Owl.prototype.mergers = function(position) {
1179
- if (position === undefined) {
1180
- return this._mergers.slice();
1181
- }
1182
-
1183
- position = this.normalize(position, true);
1184
- return this._mergers[position];
1185
- };
1186
-
1187
- /**
1188
- * Gets the absolute positions of clones for an item.
1189
- * @public
1190
- * @param {Number} [position] - The relative position of the item.
1191
- * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
1192
- */
1193
- Owl.prototype.clones = function(position) {
1194
- var odd = this._clones.length / 2,
1195
- even = odd + this._items.length,
1196
- map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
1197
-
1198
- if (position === undefined) {
1199
- return $.map(this._clones, function(v, i) { return map(i) });
1200
- }
1201
-
1202
- return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
1203
- };
1204
-
1205
- /**
1206
- * Sets the current animation speed.
1207
- * @public
1208
- * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
1209
- * @returns {Number} - The current animation speed in milliseconds.
1210
- */
1211
- Owl.prototype.speed = function(speed) {
1212
- if (speed !== undefined) {
1213
- this._speed = speed;
1214
- }
1215
-
1216
- return this._speed;
1217
- };
1218
-
1219
- /**
1220
- * Gets the coordinate of an item.
1221
- * @todo The name of this method is missleanding.
1222
- * @public
1223
- * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
1224
- * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
1225
- */
1226
- Owl.prototype.coordinates = function(position) {
1227
- var multiplier = 1,
1228
- newPosition = position - 1,
1229
- coordinate;
1230
-
1231
- if (position === undefined) {
1232
- return $.map(this._coordinates, $.proxy(function(coordinate, index) {
1233
- return this.coordinates(index);
1234
- }, this));
1235
- }
1236
-
1237
- if (this.settings.center) {
1238
- if (this.settings.rtl) {
1239
- multiplier = -1;
1240
- newPosition = position + 1;
1241
- }
1242
-
1243
- coordinate = this._coordinates[position];
1244
- coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier;
1245
- } else {
1246
- coordinate = this._coordinates[newPosition] || 0;
1247
- }
1248
-
1249
- coordinate = Math.ceil(coordinate);
1250
-
1251
- return coordinate;
1252
- };
1253
-
1254
- /**
1255
- * Calculates the speed for a translation.
1256
- * @protected
1257
- * @param {Number} from - The absolute position of the start item.
1258
- * @param {Number} to - The absolute position of the target item.
1259
- * @param {Number} [factor=undefined] - The time factor in milliseconds.
1260
- * @returns {Number} - The time in milliseconds for the translation.
1261
- */
1262
- Owl.prototype.duration = function(from, to, factor) {
1263
- if (factor === 0) {
1264
- return 0;
1265
- }
1266
-
1267
- return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
1268
- };
1269
-
1270
- /**
1271
- * Slides to the specified item.
1272
- * @public
1273
- * @param {Number} position - The position of the item.
1274
- * @param {Number} [speed] - The time in milliseconds for the transition.
1275
- */
1276
- Owl.prototype.to = function(position, speed) {
1277
- var current = this.current(),
1278
- revert = null,
1279
- distance = position - this.relative(current),
1280
- direction = (distance > 0) - (distance < 0),
1281
- items = this._items.length,
1282
- minimum = this.minimum(),
1283
- maximum = this.maximum();
1284
-
1285
- if (this.settings.loop) {
1286
- if (!this.settings.rewind && Math.abs(distance) > items / 2) {
1287
- distance += direction * -1 * items;
1288
- }
1289
-
1290
- position = current + distance;
1291
- revert = ((position - minimum) % items + items) % items + minimum;
1292
-
1293
- if (revert !== position && revert - distance <= maximum && revert - distance > 0) {
1294
- current = revert - distance;
1295
- position = revert;
1296
- this.reset(current);
1297
- }
1298
- } else if (this.settings.rewind) {
1299
- maximum += 1;
1300
- position = (position % maximum + maximum) % maximum;
1301
- } else {
1302
- position = Math.max(minimum, Math.min(maximum, position));
1303
- }
1304
-
1305
- this.speed(this.duration(current, position, speed));
1306
- this.current(position);
1307
-
1308
- if (this.isVisible()) {
1309
- this.update();
1310
- }
1311
- };
1312
-
1313
- /**
1314
- * Slides to the next item.
1315
- * @public
1316
- * @param {Number} [speed] - The time in milliseconds for the transition.
1317
- */
1318
- Owl.prototype.next = function(speed) {
1319
- speed = speed || false;
1320
- this.to(this.relative(this.current()) + 1, speed);
1321
- };
1322
-
1323
- /**
1324
- * Slides to the previous item.
1325
- * @public
1326
- * @param {Number} [speed] - The time in milliseconds for the transition.
1327
- */
1328
- Owl.prototype.prev = function(speed) {
1329
- speed = speed || false;
1330
- this.to(this.relative(this.current()) - 1, speed);
1331
- };
1332
-
1333
- /**
1334
- * Handles the end of an animation.
1335
- * @protected
1336
- * @param {Event} event - The event arguments.
1337
- */
1338
- Owl.prototype.onTransitionEnd = function(event) {
1339
-
1340
- // if css2 animation then event object is undefined
1341
- if (event !== undefined) {
1342
- event.stopPropagation();
1343
-
1344
- // Catch only owl-stage transitionEnd event
1345
- if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
1346
- return false;
1347
- }
1348
- }
1349
-
1350
- this.leave('animating');
1351
- this.trigger('translated');
1352
- };
1353
-
1354
- /**
1355
- * Gets viewport width.
1356
- * @protected
1357
- * @return {Number} - The width in pixel.
1358
- */
1359
- Owl.prototype.viewport = function() {
1360
- var width;
1361
- if (this.options.responsiveBaseElement !== window) {
1362
- width = $(this.options.responsiveBaseElement).width();
1363
- } else if (window.innerWidth) {
1364
- width = window.innerWidth;
1365
- } else if (document.documentElement && document.documentElement.clientWidth) {
1366
- width = document.documentElement.clientWidth;
1367
- } else {
1368
- console.warn('Can not detect viewport width.');
1369
- }
1370
- return width;
1371
- };
1372
-
1373
- /**
1374
- * Replaces the current content.
1375
- * @public
1376
- * @param {HTMLElement|jQuery|String} content - The new content.
1377
- */
1378
- Owl.prototype.replace = function(content) {
1379
- this.$stage.empty();
1380
- this._items = [];
1381
-
1382
- if (content) {
1383
- content = (content instanceof jQuery) ? content : $(content);
1384
- }
1385
-
1386
- if (this.settings.nestedItemSelector) {
1387
- content = content.find('.' + this.settings.nestedItemSelector);
1388
- }
1389
-
1390
- content.filter(function() {
1391
- return this.nodeType === 1;
1392
- }).each($.proxy(function(index, item) {
1393
- item = this.prepare(item);
1394
- this.$stage.append(item);
1395
- this._items.push(item);
1396
- this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1397
- }, this));
1398
-
1399
- this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
1400
-
1401
- this.invalidate('items');
1402
- };
1403
-
1404
- /**
1405
- * Adds an item.
1406
- * @todo Use `item` instead of `content` for the event arguments.
1407
- * @public
1408
- * @param {HTMLElement|jQuery|String} content - The item content to add.
1409
- * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
1410
- */
1411
- Owl.prototype.add = function(content, position) {
1412
- var current = this.relative(this._current);
1413
-
1414
- position = position === undefined ? this._items.length : this.normalize(position, true);
1415
- content = content instanceof jQuery ? content : $(content);
1416
-
1417
- this.trigger('add', { content: content, position: position });
1418
-
1419
- content = this.prepare(content);
1420
-
1421
- if (this._items.length === 0 || position === this._items.length) {
1422
- this._items.length === 0 && this.$stage.append(content);
1423
- this._items.length !== 0 && this._items[position - 1].after(content);
1424
- this._items.push(content);
1425
- this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1426
- } else {
1427
- this._items[position].before(content);
1428
- this._items.splice(position, 0, content);
1429
- this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1430
- }
1431
-
1432
- this._items[current] && this.reset(this._items[current].index());
1433
-
1434
- this.invalidate('items');
1435
-
1436
- this.trigger('added', { content: content, position: position });
1437
- };
1438
-
1439
- /**
1440
- * Removes an item by its position.
1441
- * @todo Use `item` instead of `content` for the event arguments.
1442
- * @public
1443
- * @param {Number} position - The relative position of the item to remove.
1444
- */
1445
- Owl.prototype.remove = function(position) {
1446
- position = this.normalize(position, true);
1447
-
1448
- if (position === undefined) {
1449
- return;
1450
- }
1451
-
1452
- this.trigger('remove', { content: this._items[position], position: position });
1453
-
1454
- this._items[position].remove();
1455
- this._items.splice(position, 1);
1456
- this._mergers.splice(position, 1);
1457
-
1458
- this.invalidate('items');
1459
-
1460
- this.trigger('removed', { content: null, position: position });
1461
- };
1462
-
1463
- /**
1464
- * Preloads images with auto width.
1465
- * @todo Replace by a more generic approach
1466
- * @protected
1467
- */
1468
- Owl.prototype.preloadAutoWidthImages = function(images) {
1469
- images.each($.proxy(function(i, element) {
1470
- this.enter('pre-loading');
1471
- element = $(element);
1472
- $(new Image()).one('load', $.proxy(function(e) {
1473
- element.attr('src', e.target.src);
1474
- element.css('opacity', 1);
1475
- this.leave('pre-loading');
1476
- !this.is('pre-loading') && !this.is('initializing') && this.refresh();
1477
- }, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina'));
1478
- }, this));
1479
- };
1480
-
1481
- /**
1482
- * Destroys the carousel.
1483
- * @public
1484
- */
1485
- Owl.prototype.destroy = function() {
1486
-
1487
- this.$element.off('.owl.core');
1488
- this.$stage.off('.owl.core');
1489
- $(document).off('.owl.core');
1490
-
1491
- if (this.settings.responsive !== false) {
1492
- window.clearTimeout(this.resizeTimer);
1493
- this.off(window, 'resize', this._handlers.onThrottledResize);
1494
- }
1495
-
1496
- for (var i in this._plugins) {
1497
- this._plugins[i].destroy();
1498
- }
1499
-
1500
- this.$stage.children('.cloned').remove();
1501
-
1502
- this.$stage.unwrap();
1503
- this.$stage.children().contents().unwrap();
1504
- this.$stage.children().unwrap();
1505
- this.$stage.remove();
1506
- this.$element
1507
- .removeClass(this.options.refreshClass)
1508
- .removeClass(this.options.loadingClass)
1509
- .removeClass(this.options.loadedClass)
1510
- .removeClass(this.options.rtlClass)
1511
- .removeClass(this.options.dragClass)
1512
- .removeClass(this.options.grabClass)
1513
- .attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), ''))
1514
- .removeData('owl.carousel');
1515
- };
1516
-
1517
- /**
1518
- * Operators to calculate right-to-left and left-to-right.
1519
- * @protected
1520
- * @param {Number} [a] - The left side operand.
1521
- * @param {String} [o] - The operator.
1522
- * @param {Number} [b] - The right side operand.
1523
- */
1524
- Owl.prototype.op = function(a, o, b) {
1525
- var rtl = this.settings.rtl;
1526
- switch (o) {
1527
- case '<':
1528
- return rtl ? a > b : a < b;
1529
- case '>':
1530
- return rtl ? a < b : a > b;
1531
- case '>=':
1532
- return rtl ? a <= b : a >= b;
1533
- case '<=':
1534
- return rtl ? a >= b : a <= b;
1535
- default:
1536
- break;
1537
- }
1538
- };
1539
-
1540
- /**
1541
- * Attaches to an internal event.
1542
- * @protected
1543
- * @param {HTMLElement} element - The event source.
1544
- * @param {String} event - The event name.
1545
- * @param {Function} listener - The event handler to attach.
1546
- * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
1547
- */
1548
- Owl.prototype.on = function(element, event, listener, capture) {
1549
- if (element.addEventListener) {
1550
- element.addEventListener(event, listener, capture);
1551
- } else if (element.attachEvent) {
1552
- element.attachEvent('on' + event, listener);
1553
- }
1554
- };
1555
-
1556
- /**
1557
- * Detaches from an internal event.
1558
- * @protected
1559
- * @param {HTMLElement} element - The event source.
1560
- * @param {String} event - The event name.
1561
- * @param {Function} listener - The attached event handler to detach.
1562
- * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
1563
- */
1564
- Owl.prototype.off = function(element, event, listener, capture) {
1565
- if (element.removeEventListener) {
1566
- element.removeEventListener(event, listener, capture);
1567
- } else if (element.detachEvent) {
1568
- element.detachEvent('on' + event, listener);
1569
- }
1570
- };
1571
-
1572
- /**
1573
- * Triggers a public event.
1574
- * @todo Remove `status`, `relatedTarget` should be used instead.
1575
- * @protected
1576
- * @param {String} name - The event name.
1577
- * @param {*} [data=null] - The event data.
1578
- * @param {String} [namespace=carousel] - The event namespace.
1579
- * @param {String} [state] - The state which is associated with the event.
1580
- * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not.
1581
- * @returns {Event} - The event arguments.
1582
- */
1583
- Owl.prototype.trigger = function(name, data, namespace, state, enter) {
1584
- var status = {
1585
- item: { count: this._items.length, index: this.current() }
1586
- }, handler = $.camelCase(
1587
- $.grep([ 'on', name, namespace ], function(v) { return v })
1588
- .join('-').toLowerCase()
1589
- ), event = $.Event(
1590
- [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
1591
- $.extend({ relatedTarget: this }, status, data)
1592
- );
1593
-
1594
- if (!this._supress[name]) {
1595
- $.each(this._plugins, function(name, plugin) {
1596
- if (plugin.onTrigger) {
1597
- plugin.onTrigger(event);
1598
- }
1599
- });
1600
-
1601
- this.register({ type: Owl.Type.Event, name: name });
1602
- this.$element.trigger(event);
1603
-
1604
- if (this.settings && typeof this.settings[handler] === 'function') {
1605
- this.settings[handler].call(this, event);
1606
- }
1607
- }
1608
-
1609
- return event;
1610
- };
1611
-
1612
- /**
1613
- * Enters a state.
1614
- * @param name - The state name.
1615
- */
1616
- Owl.prototype.enter = function(name) {
1617
- $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
1618
- if (this._states.current[name] === undefined) {
1619
- this._states.current[name] = 0;
1620
- }
1621
-
1622
- this._states.current[name]++;
1623
- }, this));
1624
- };
1625
-
1626
- /**
1627
- * Leaves a state.
1628
- * @param name - The state name.
1629
- */
1630
- Owl.prototype.leave = function(name) {
1631
- $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
1632
- this._states.current[name]--;
1633
- }, this));
1634
- };
1635
-
1636
- /**
1637
- * Registers an event or state.
1638
- * @public
1639
- * @param {Object} object - The event or state to register.
1640
- */
1641
- Owl.prototype.register = function(object) {
1642
- if (object.type === Owl.Type.Event) {
1643
- if (!$.event.special[object.name]) {
1644
- $.event.special[object.name] = {};
1645
- }
1646
-
1647
- if (!$.event.special[object.name].owl) {
1648
- var _default = $.event.special[object.name]._default;
1649
- $.event.special[object.name]._default = function(e) {
1650
- if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) {
1651
- return _default.apply(this, arguments);
1652
- }
1653
- return e.namespace && e.namespace.indexOf('owl') > -1;
1654
- };
1655
- $.event.special[object.name].owl = true;
1656
- }
1657
- } else if (object.type === Owl.Type.State) {
1658
- if (!this._states.tags[object.name]) {
1659
- this._states.tags[object.name] = object.tags;
1660
- } else {
1661
- this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags);
1662
- }
1663
-
1664
- this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) {
1665
- return $.inArray(tag, this._states.tags[object.name]) === i;
1666
- }, this));
1667
- }
1668
- };
1669
-
1670
- /**
1671
- * Suppresses events.
1672
- * @protected
1673
- * @param {Array.<String>} events - The events to suppress.
1674
- */
1675
- Owl.prototype.suppress = function(events) {
1676
- $.each(events, $.proxy(function(index, event) {
1677
- this._supress[event] = true;
1678
- }, this));
1679
- };
1680
-
1681
- /**
1682
- * Releases suppressed events.
1683
- * @protected
1684
- * @param {Array.<String>} events - The events to release.
1685
- */
1686
- Owl.prototype.release = function(events) {
1687
- $.each(events, $.proxy(function(index, event) {
1688
- delete this._supress[event];
1689
- }, this));
1690
- };
1691
-
1692
- /**
1693
- * Gets unified pointer coordinates from event.
1694
- * @todo #261
1695
- * @protected
1696
- * @param {Event} - The `mousedown` or `touchstart` event.
1697
- * @returns {Object} - Contains `x` and `y` coordinates of current pointer position.
1698
- */
1699
- Owl.prototype.pointer = function(event) {
1700
- var result = { x: null, y: null };
1701
-
1702
- event = event.originalEvent || event || window.event;
1703
-
1704
- event = event.touches && event.touches.length ?
1705
- event.touches[0] : event.changedTouches && event.changedTouches.length ?
1706
- event.changedTouches[0] : event;
1707
-
1708
- if (event.pageX) {
1709
- result.x = event.pageX;
1710
- result.y = event.pageY;
1711
- } else {
1712
- result.x = event.clientX;
1713
- result.y = event.clientY;
1714
- }
1715
-
1716
- return result;
1717
- };
1718
-
1719
- /**
1720
- * Determines if the input is a Number or something that can be coerced to a Number
1721
- * @protected
1722
- * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested
1723
- * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number
1724
- */
1725
- Owl.prototype.isNumeric = function(number) {
1726
- return !isNaN(parseFloat(number));
1727
- };
1728
-
1729
- /**
1730
- * Gets the difference of two vectors.
1731
- * @todo #261
1732
- * @protected
1733
- * @param {Object} - The first vector.
1734
- * @param {Object} - The second vector.
1735
- * @returns {Object} - The difference.
1736
- */
1737
- Owl.prototype.difference = function(first, second) {
1738
- return {
1739
- x: first.x - second.x,
1740
- y: first.y - second.y
1741
- };
1742
- };
1743
-
1744
- /**
1745
- * The jQuery Plugin for the Owl Carousel
1746
- * @todo Navigation plugin `next` and `prev`
1747
- * @public
1748
- */
1749
- $.fn.owlCarousel = function(option) {
1750
- var args = Array.prototype.slice.call(arguments, 1);
1751
-
1752
- return this.each(function() {
1753
- var $this = $(this),
1754
- data = $this.data('owl.carousel');
1755
-
1756
- if (!data) {
1757
- data = new Owl(this, typeof option == 'object' && option);
1758
- $this.data('owl.carousel', data);
1759
-
1760
- $.each([
1761
- 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove'
1762
- ], function(i, event) {
1763
- data.register({ type: Owl.Type.Event, name: event });
1764
- data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) {
1765
- if (e.namespace && e.relatedTarget !== this) {
1766
- this.suppress([ event ]);
1767
- data[event].apply(this, [].slice.call(arguments, 1));
1768
- this.release([ event ]);
1769
- }
1770
- }, data));
1771
- });
1772
- }
1773
-
1774
- if (typeof option == 'string' && option.charAt(0) !== '_') {
1775
- data[option].apply(data, args);
1776
- }
1777
- });
1778
- };
1779
-
1780
- /**
1781
- * The constructor for the jQuery Plugin
1782
- * @public
1783
- */
1784
- $.fn.owlCarousel.Constructor = Owl;
1785
-
1786
- })(window.Zepto || window.jQuery, window, document);
1787
-
1788
- /**
1789
- * AutoRefresh Plugin
1790
- * @version 2.3.4
1791
- * @author Artus Kolanowski
1792
- * @author David Deutsch
1793
- * @license The MIT License (MIT)
1794
- */
1795
- ;(function($, window, document, undefined) {
1796
-
1797
- /**
1798
- * Creates the auto refresh plugin.
1799
- * @class The Auto Refresh Plugin
1800
- * @param {Owl} carousel - The Owl Carousel
1801
- */
1802
- var AutoRefresh = function(carousel) {
1803
- /**
1804
- * Reference to the core.
1805
- * @protected
1806
- * @type {Owl}
1807
- */
1808
- this._core = carousel;
1809
-
1810
- /**
1811
- * Refresh interval.
1812
- * @protected
1813
- * @type {number}
1814
- */
1815
- this._interval = null;
1816
-
1817
- /**
1818
- * Whether the element is currently visible or not.
1819
- * @protected
1820
- * @type {Boolean}
1821
- */
1822
- this._visible = null;
1823
-
1824
- /**
1825
- * All event handlers.
1826
- * @protected
1827
- * @type {Object}
1828
- */
1829
- this._handlers = {
1830
- 'initialized.owl.carousel': $.proxy(function(e) {
1831
- if (e.namespace && this._core.settings.autoRefresh) {
1832
- this.watch();
1833
- }
1834
- }, this)
1835
- };
1836
-
1837
- // set default options
1838
- this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options);
1839
-
1840
- // register event handlers
1841
- this._core.$element.on(this._handlers);
1842
- };
1843
-
1844
- /**
1845
- * Default options.
1846
- * @public
1847
- */
1848
- AutoRefresh.Defaults = {
1849
- autoRefresh: true,
1850
- autoRefreshInterval: 500
1851
- };
1852
-
1853
- /**
1854
- * Watches the element.
1855
- */
1856
- AutoRefresh.prototype.watch = function() {
1857
- if (this._interval) {
1858
- return;
1859
- }
1860
-
1861
- this._visible = this._core.isVisible();
1862
- this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval);
1863
- };
1864
-
1865
- /**
1866
- * Refreshes the element.
1867
- */
1868
- AutoRefresh.prototype.refresh = function() {
1869
- if (this._core.isVisible() === this._visible) {
1870
- return;
1871
- }
1872
-
1873
- this._visible = !this._visible;
1874
-
1875
- this._core.$element.toggleClass('owl-hidden', !this._visible);
1876
-
1877
- this._visible && (this._core.invalidate('width') && this._core.refresh());
1878
- };
1879
-
1880
- /**
1881
- * Destroys the plugin.
1882
- */
1883
- AutoRefresh.prototype.destroy = function() {
1884
- var handler, property;
1885
-
1886
- window.clearInterval(this._interval);
1887
-
1888
- for (handler in this._handlers) {
1889
- this._core.$element.off(handler, this._handlers[handler]);
1890
- }
1891
- for (property in Object.getOwnPropertyNames(this)) {
1892
- typeof this[property] != 'function' && (this[property] = null);
1893
- }
1894
- };
1895
-
1896
- $.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
1897
-
1898
- })(window.Zepto || window.jQuery, window, document);
1899
-
1900
- /**
1901
- * Lazy Plugin
1902
- * @version 2.3.4
1903
- * @author Bartosz Wojciechowski
1904
- * @author David Deutsch
1905
- * @license The MIT License (MIT)
1906
- */
1907
- ;(function($, window, document, undefined) {
1908
-
1909
- /**
1910
- * Creates the lazy plugin.
1911
- * @class The Lazy Plugin
1912
- * @param {Owl} carousel - The Owl Carousel
1913
- */
1914
- var Lazy = function(carousel) {
1915
-
1916
- /**
1917
- * Reference to the core.
1918
- * @protected
1919
- * @type {Owl}
1920
- */
1921
- this._core = carousel;
1922
-
1923
- /**
1924
- * Already loaded items.
1925
- * @protected
1926
- * @type {Array.<jQuery>}
1927
- */
1928
- this._loaded = [];
1929
-
1930
- /**
1931
- * Event handlers.
1932
- * @protected
1933
- * @type {Object}
1934
- */
1935
- this._handlers = {
1936
- 'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) {
1937
- if (!e.namespace) {
1938
- return;
1939
- }
1940
-
1941
- if (!this._core.settings || !this._core.settings.lazyLoad) {
1942
- return;
1943
- }
1944
-
1945
- if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
1946
- var settings = this._core.settings,
1947
- n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
1948
- i = ((settings.center && n * -1) || 0),
1949
- position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i,
1950
- clones = this._core.clones().length,
1951
- load = $.proxy(function(i, v) { this.load(v) }, this);
1952
- //TODO: Need documentation for this new option
1953
- if (settings.lazyLoadEager > 0) {
1954
- n += settings.lazyLoadEager;
1955
- // If the carousel is looping also preload images that are to the "left"
1956
- if (settings.loop) {
1957
- position -= settings.lazyLoadEager;
1958
- n++;
1959
- }
1960
- }
1961
-
1962
- while (i++ < n) {
1963
- this.load(clones / 2 + this._core.relative(position));
1964
- clones && $.each(this._core.clones(this._core.relative(position)), load);
1965
- position++;
1966
- }
1967
- }
1968
- }, this)
1969
- };
1970
-
1971
- // set the default options
1972
- this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
1973
-
1974
- // register event handler
1975
- this._core.$element.on(this._handlers);
1976
- };
1977
-
1978
- /**
1979
- * Default options.
1980
- * @public
1981
- */
1982
- Lazy.Defaults = {
1983
- lazyLoad: false,
1984
- lazyLoadEager: 0
1985
- };
1986
-
1987
- /**
1988
- * Loads all resources of an item at the specified position.
1989
- * @param {Number} position - The absolute position of the item.
1990
- * @protected
1991
- */
1992
- Lazy.prototype.load = function(position) {
1993
- var $item = this._core.$stage.children().eq(position),
1994
- $elements = $item && $item.find('.owl-lazy');
1995
-
1996
- if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
1997
- return;
1998
- }
1999
-
2000
- $elements.each($.proxy(function(index, element) {
2001
- var $element = $(element), image,
2002
- url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset');
2003
-
2004
- this._core.trigger('load', { element: $element, url: url }, 'lazy');
2005
-
2006
- if ($element.is('img')) {
2007
- $element.one('load.owl.lazy', $.proxy(function() {
2008
- $element.css('opacity', 1);
2009
- this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
2010
- }, this)).attr('src', url);
2011
- } else if ($element.is('source')) {
2012
- $element.one('load.owl.lazy', $.proxy(function() {
2013
- this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
2014
- }, this)).attr('srcset', url);
2015
- } else {
2016
- image = new Image();
2017
- image.onload = $.proxy(function() {
2018
- $element.css({
2019
- 'background-image': 'url("' + url + '")',
2020
- 'opacity': '1'
2021
- });
2022
- this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
2023
- }, this);
2024
- image.src = url;
2025
- }
2026
- }, this));
2027
-
2028
- this._loaded.push($item.get(0));
2029
- };
2030
-
2031
- /**
2032
- * Destroys the plugin.
2033
- * @public
2034
- */
2035
- Lazy.prototype.destroy = function() {
2036
- var handler, property;
2037
-
2038
- for (handler in this.handlers) {
2039
- this._core.$element.off(handler, this.handlers[handler]);
2040
- }
2041
- for (property in Object.getOwnPropertyNames(this)) {
2042
- typeof this[property] != 'function' && (this[property] = null);
2043
- }
2044
- };
2045
-
2046
- $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
2047
-
2048
- })(window.Zepto || window.jQuery, window, document);
2049
-
2050
- /**
2051
- * AutoHeight Plugin
2052
- * @version 2.3.4
2053
- * @author Bartosz Wojciechowski
2054
- * @author David Deutsch
2055
- * @license The MIT License (MIT)
2056
- */
2057
- ;(function($, window, document, undefined) {
2058
-
2059
- /**
2060
- * Creates the auto height plugin.
2061
- * @class The Auto Height Plugin
2062
- * @param {Owl} carousel - The Owl Carousel
2063
- */
2064
- var AutoHeight = function(carousel) {
2065
- /**
2066
- * Reference to the core.
2067
- * @protected
2068
- * @type {Owl}
2069
- */
2070
- this._core = carousel;
2071
-
2072
- this._previousHeight = null;
2073
-
2074
- /**
2075
- * All event handlers.
2076
- * @protected
2077
- * @type {Object}
2078
- */
2079
- this._handlers = {
2080
- 'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
2081
- if (e.namespace && this._core.settings.autoHeight) {
2082
- this.update();
2083
- }
2084
- }, this),
2085
- 'changed.owl.carousel': $.proxy(function(e) {
2086
- if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){
2087
- this.update();
2088
- }
2089
- }, this),
2090
- 'loaded.owl.lazy': $.proxy(function(e) {
2091
- if (e.namespace && this._core.settings.autoHeight
2092
- && e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
2093
- this.update();
2094
- }
2095
- }, this)
2096
- };
2097
-
2098
- // set default options
2099
- this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
2100
-
2101
- // register event handlers
2102
- this._core.$element.on(this._handlers);
2103
- this._intervalId = null;
2104
- var refThis = this;
2105
-
2106
- // These changes have been taken from a PR by gavrochelegnou proposed in #1575
2107
- // and have been made compatible with the latest jQuery version
2108
- $(window).on('load', function() {
2109
- if (refThis._core.settings.autoHeight) {
2110
- refThis.update();
2111
- }
2112
- });
2113
-
2114
- // Autoresize the height of the carousel when window is resized
2115
- // When carousel has images, the height is dependent on the width
2116
- // and should also change on resize
2117
- $(window).resize(function() {
2118
- if (refThis._core.settings.autoHeight) {
2119
- if (refThis._intervalId != null) {
2120
- clearTimeout(refThis._intervalId);
2121
- }
2122
-
2123
- refThis._intervalId = setTimeout(function() {
2124
- refThis.update();
2125
- }, 250);
2126
- }
2127
- });
2128
-
2129
- };
2130
-
2131
- /**
2132
- * Default options.
2133
- * @public
2134
- */
2135
- AutoHeight.Defaults = {
2136
- autoHeight: false,
2137
- autoHeightClass: 'owl-height'
2138
- };
2139
-
2140
- /**
2141
- * Updates the view.
2142
- */
2143
- AutoHeight.prototype.update = function() {
2144
- var start = this._core._current,
2145
- end = start + this._core.settings.items,
2146
- lazyLoadEnabled = this._core.settings.lazyLoad,
2147
- visible = this._core.$stage.children().toArray().slice(start, end),
2148
- heights = [],
2149
- maxheight = 0;
2150
-
2151
- $.each(visible, function(index, item) {
2152
- heights.push($(item).height());
2153
- });
2154
-
2155
- maxheight = Math.max.apply(null, heights);
2156
-
2157
- if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) {
2158
- maxheight = this._previousHeight;
2159
- }
2160
-
2161
- this._previousHeight = maxheight;
2162
-
2163
- this._core.$stage.parent()
2164
- .height(maxheight)
2165
- .addClass(this._core.settings.autoHeightClass);
2166
- };
2167
-
2168
- AutoHeight.prototype.destroy = function() {
2169
- var handler, property;
2170
-
2171
- for (handler in this._handlers) {
2172
- this._core.$element.off(handler, this._handlers[handler]);
2173
- }
2174
- for (property in Object.getOwnPropertyNames(this)) {
2175
- typeof this[property] !== 'function' && (this[property] = null);
2176
- }
2177
- };
2178
-
2179
- $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
2180
-
2181
- })(window.Zepto || window.jQuery, window, document);
2182
-
2183
- /**
2184
- * Video Plugin
2185
- * @version 2.3.4
2186
- * @author Bartosz Wojciechowski
2187
- * @author David Deutsch
2188
- * @license The MIT License (MIT)
2189
- */
2190
- ;(function($, window, document, undefined) {
2191
-
2192
- /**
2193
- * Creates the video plugin.
2194
- * @class The Video Plugin
2195
- * @param {Owl} carousel - The Owl Carousel
2196
- */
2197
- var Video = function(carousel) {
2198
- /**
2199
- * Reference to the core.
2200
- * @protected
2201
- * @type {Owl}
2202
- */
2203
- this._core = carousel;
2204
-
2205
- /**
2206
- * Cache all video URLs.
2207
- * @protected
2208
- * @type {Object}
2209
- */
2210
- this._videos = {};
2211
-
2212
- /**
2213
- * Current playing item.
2214
- * @protected
2215
- * @type {jQuery}
2216
- */
2217
- this._playing = null;
2218
-
2219
- /**
2220
- * All event handlers.
2221
- * @todo The cloned content removale is too late
2222
- * @protected
2223
- * @type {Object}
2224
- */
2225
- this._handlers = {
2226
- 'initialized.owl.carousel': $.proxy(function(e) {
2227
- if (e.namespace) {
2228
- this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
2229
- }
2230
- }, this),
2231
- 'resize.owl.carousel': $.proxy(function(e) {
2232
- if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
2233
- e.preventDefault();
2234
- }
2235
- }, this),
2236
- 'refreshed.owl.carousel': $.proxy(function(e) {
2237
- if (e.namespace && this._core.is('resizing')) {
2238
- this._core.$stage.find('.cloned .owl-video-frame').remove();
2239
- }
2240
- }, this),
2241
- 'changed.owl.carousel': $.proxy(function(e) {
2242
- if (e.namespace && e.property.name === 'position' && this._playing) {
2243
- this.stop();
2244
- }
2245
- }, this),
2246
- 'prepared.owl.carousel': $.proxy(function(e) {
2247
- if (!e.namespace) {
2248
- return;
2249
- }
2250
-
2251
- var $element = $(e.content).find('.owl-video');
2252
-
2253
- if ($element.length) {
2254
- $element.css('display', 'none');
2255
- this.fetch($element, $(e.content));
2256
- }
2257
- }, this)
2258
- };
2259
-
2260
- // set default options
2261
- this._core.options = $.extend({}, Video.Defaults, this._core.options);
2262
-
2263
- // register event handlers
2264
- this._core.$element.on(this._handlers);
2265
-
2266
- this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
2267
- this.play(e);
2268
- }, this));
2269
- };
2270
-
2271
- /**
2272
- * Default options.
2273
- * @public
2274
- */
2275
- Video.Defaults = {
2276
- video: false,
2277
- videoHeight: false,
2278
- videoWidth: false
2279
- };
2280
-
2281
- /**
2282
- * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
2283
- * @protected
2284
- * @param {jQuery} target - The target containing the video data.
2285
- * @param {jQuery} item - The item containing the video.
2286
- */
2287
- Video.prototype.fetch = function(target, item) {
2288
- var type = (function() {
2289
- if (target.attr('data-vimeo-id')) {
2290
- return 'vimeo';
2291
- } else if (target.attr('data-vzaar-id')) {
2292
- return 'vzaar'
2293
- } else {
2294
- return 'youtube';
2295
- }
2296
- })(),
2297
- id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
2298
- width = target.attr('data-width') || this._core.settings.videoWidth,
2299
- height = target.attr('data-height') || this._core.settings.videoHeight,
2300
- url = target.attr('href');
2301
-
2302
- if (url) {
2303
-
2304
- /*
2305
- Parses the id's out of the following urls (and probably more):
2306
- https://www.youtube.com/watch?v=:id
2307
- https://youtu.be/:id
2308
- https://vimeo.com/:id
2309
- https://vimeo.com/channels/:channel/:id
2310
- https://vimeo.com/groups/:group/videos/:id
2311
- https://app.vzaar.com/videos/:id
2312
-
2313
- Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F
2314
- */
2315
-
2316
- id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
2317
-
2318
- if (id[3].indexOf('youtu') > -1) {
2319
- type = 'youtube';
2320
- } else if (id[3].indexOf('vimeo') > -1) {
2321
- type = 'vimeo';
2322
- } else if (id[3].indexOf('vzaar') > -1) {
2323
- type = 'vzaar';
2324
- } else {
2325
- throw new Error('Video URL not supported.');
2326
- }
2327
- id = id[6];
2328
- } else {
2329
- throw new Error('Missing video URL.');
2330
- }
2331
-
2332
- this._videos[url] = {
2333
- type: type,
2334
- id: id,
2335
- width: width,
2336
- height: height
2337
- };
2338
-
2339
- item.attr('data-video', url);
2340
-
2341
- this.thumbnail(target, this._videos[url]);
2342
- };
2343
-
2344
- /**
2345
- * Creates video thumbnail.
2346
- * @protected
2347
- * @param {jQuery} target - The target containing the video data.
2348
- * @param {Object} info - The video info object.
2349
- * @see `fetch`
2350
- */
2351
- Video.prototype.thumbnail = function(target, video) {
2352
- var tnLink,
2353
- icon,
2354
- path,
2355
- dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '',
2356
- customTn = target.find('img'),
2357
- srcType = 'src',
2358
- lazyClass = '',
2359
- settings = this._core.settings,
2360
- create = function(path) {
2361
- icon = '<div class="owl-video-play-icon"></div>';
2362
-
2363
- if (settings.lazyLoad) {
2364
- tnLink = $('<div/>',{
2365
- "class": 'owl-video-tn ' + lazyClass,
2366
- "srcType": path
2367
- });
2368
- } else {
2369
- tnLink = $( '<div/>', {
2370
- "class": "owl-video-tn",
2371
- "style": 'opacity:1;background-image:url(' + path + ')'
2372
- });
2373
- }
2374
- target.after(tnLink);
2375
- target.after(icon);
2376
- };
2377
-
2378
- // wrap video content into owl-video-wrapper div
2379
- target.wrap( $( '<div/>', {
2380
- "class": "owl-video-wrapper",
2381
- "style": dimensions
2382
- }));
2383
-
2384
- if (this._core.settings.lazyLoad) {
2385
- srcType = 'data-src';
2386
- lazyClass = 'owl-lazy';
2387
- }
2388
-
2389
- // custom thumbnail
2390
- if (customTn.length) {
2391
- create(customTn.attr(srcType));
2392
- customTn.remove();
2393
- return false;
2394
- }
2395
-
2396
- if (video.type === 'youtube') {
2397
- path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
2398
- create(path);
2399
- } else if (video.type === 'vimeo') {
2400
- $.ajax({
2401
- type: 'GET',
2402
- url: '//vimeo.com/api/v2/video/' + video.id + '.json',
2403
- jsonp: 'callback',
2404
- dataType: 'jsonp',
2405
- success: function(data) {
2406
- path = data[0].thumbnail_large;
2407
- create(path);
2408
- }
2409
- });
2410
- } else if (video.type === 'vzaar') {
2411
- $.ajax({
2412
- type: 'GET',
2413
- url: '//vzaar.com/api/videos/' + video.id + '.json',
2414
- jsonp: 'callback',
2415
- dataType: 'jsonp',
2416
- success: function(data) {
2417
- path = data.framegrab_url;
2418
- create(path);
2419
- }
2420
- });
2421
- }
2422
- };
2423
-
2424
- /**
2425
- * Stops the current video.
2426
- * @public
2427
- */
2428
- Video.prototype.stop = function() {
2429
- this._core.trigger('stop', null, 'video');
2430
- this._playing.find('.owl-video-frame').remove();
2431
- this._playing.removeClass('owl-video-playing');
2432
- this._playing = null;
2433
- this._core.leave('playing');
2434
- this._core.trigger('stopped', null, 'video');
2435
- };
2436
-
2437
- /**
2438
- * Starts the current video.
2439
- * @public
2440
- * @param {Event} event - The event arguments.
2441
- */
2442
- Video.prototype.play = function(event) {
2443
- var target = $(event.target),
2444
- item = target.closest('.' + this._core.settings.itemClass),
2445
- video = this._videos[item.attr('data-video')],
2446
- width = video.width || '100%',
2447
- height = video.height || this._core.$stage.height(),
2448
- html,
2449
- iframe;
2450
-
2451
- if (this._playing) {
2452
- return;
2453
- }
2454
-
2455
- this._core.enter('playing');
2456
- this._core.trigger('play', null, 'video');
2457
-
2458
- item = this._core.items(this._core.relative(item.index()));
2459
-
2460
- this._core.reset(item.index());
2461
-
2462
- html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' );
2463
- html.attr( 'height', height );
2464
- html.attr( 'width', width );
2465
- if (video.type === 'youtube') {
2466
- html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id );
2467
- } else if (video.type === 'vimeo') {
2468
- html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' );
2469
- } else if (video.type === 'vzaar') {
2470
- html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' );
2471
- }
2472
-
2473
- iframe = $(html).wrap( '<div class="owl-video-frame" />' ).insertAfter(item.find('.owl-video'));
2474
-
2475
- this._playing = item.addClass('owl-video-playing');
2476
- };
2477
-
2478
- /**
2479
- * Checks whether an video is currently in full screen mode or not.
2480
- * @todo Bad style because looks like a readonly method but changes members.
2481
- * @protected
2482
- * @returns {Boolean}
2483
- */
2484
- Video.prototype.isInFullScreen = function() {
2485
- var element = document.fullscreenElement || document.mozFullScreenElement ||
2486
- document.webkitFullscreenElement;
2487
-
2488
- return element && $(element).parent().hasClass('owl-video-frame');
2489
- };
2490
-
2491
- /**
2492
- * Destroys the plugin.
2493
- */
2494
- Video.prototype.destroy = function() {
2495
- var handler, property;
2496
-
2497
- this._core.$element.off('click.owl.video');
2498
-
2499
- for (handler in this._handlers) {
2500
- this._core.$element.off(handler, this._handlers[handler]);
2501
- }
2502
- for (property in Object.getOwnPropertyNames(this)) {
2503
- typeof this[property] != 'function' && (this[property] = null);
2504
- }
2505
- };
2506
-
2507
- $.fn.owlCarousel.Constructor.Plugins.Video = Video;
2508
-
2509
- })(window.Zepto || window.jQuery, window, document);
2510
-
2511
- /**
2512
- * Animate Plugin
2513
- * @version 2.3.4
2514
- * @author Bartosz Wojciechowski
2515
- * @author David Deutsch
2516
- * @license The MIT License (MIT)
2517
- */
2518
- ;(function($, window, document, undefined) {
2519
-
2520
- /**
2521
- * Creates the animate plugin.
2522
- * @class The Navigation Plugin
2523
- * @param {Owl} scope - The Owl Carousel
2524
- */
2525
- var Animate = function(scope) {
2526
- this.core = scope;
2527
- this.core.options = $.extend({}, Animate.Defaults, this.core.options);
2528
- this.swapping = true;
2529
- this.previous = undefined;
2530
- this.next = undefined;
2531
-
2532
- this.handlers = {
2533
- 'change.owl.carousel': $.proxy(function(e) {
2534
- if (e.namespace && e.property.name == 'position') {
2535
- this.previous = this.core.current();
2536
- this.next = e.property.value;
2537
- }
2538
- }, this),
2539
- 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
2540
- if (e.namespace) {
2541
- this.swapping = e.type == 'translated';
2542
- }
2543
- }, this),
2544
- 'translate.owl.carousel': $.proxy(function(e) {
2545
- if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
2546
- this.swap();
2547
- }
2548
- }, this)
2549
- };
2550
-
2551
- this.core.$element.on(this.handlers);
2552
- };
2553
-
2554
- /**
2555
- * Default options.
2556
- * @public
2557
- */
2558
- Animate.Defaults = {
2559
- animateOut: false,
2560
- animateIn: false
2561
- };
2562
-
2563
- /**
2564
- * Toggles the animation classes whenever an translations starts.
2565
- * @protected
2566
- * @returns {Boolean|undefined}
2567
- */
2568
- Animate.prototype.swap = function() {
2569
-
2570
- if (this.core.settings.items !== 1) {
2571
- return;
2572
- }
2573
-
2574
- if (!$.support.animation || !$.support.transition) {
2575
- return;
2576
- }
2577
-
2578
- this.core.speed(0);
2579
-
2580
- var left,
2581
- clear = $.proxy(this.clear, this),
2582
- previous = this.core.$stage.children().eq(this.previous),
2583
- next = this.core.$stage.children().eq(this.next),
2584
- incoming = this.core.settings.animateIn,
2585
- outgoing = this.core.settings.animateOut;
2586
-
2587
- if (this.core.current() === this.previous) {
2588
- return;
2589
- }
2590
-
2591
- if (outgoing) {
2592
- left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
2593
- previous.one($.support.animation.end, clear)
2594
- .css( { 'left': left + 'px' } )
2595
- .addClass('animated owl-animated-out')
2596
- .addClass(outgoing);
2597
- }
2598
-
2599
- if (incoming) {
2600
- next.one($.support.animation.end, clear)
2601
- .addClass('animated owl-animated-in')
2602
- .addClass(incoming);
2603
- }
2604
- };
2605
-
2606
- Animate.prototype.clear = function(e) {
2607
- $(e.target).css( { 'left': '' } )
2608
- .removeClass('animated owl-animated-out owl-animated-in')
2609
- .removeClass(this.core.settings.animateIn)
2610
- .removeClass(this.core.settings.animateOut);
2611
- this.core.onTransitionEnd();
2612
- };
2613
-
2614
- /**
2615
- * Destroys the plugin.
2616
- * @public
2617
- */
2618
- Animate.prototype.destroy = function() {
2619
- var handler, property;
2620
-
2621
- for (handler in this.handlers) {
2622
- this.core.$element.off(handler, this.handlers[handler]);
2623
- }
2624
- for (property in Object.getOwnPropertyNames(this)) {
2625
- typeof this[property] != 'function' && (this[property] = null);
2626
- }
2627
- };
2628
-
2629
- $.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
2630
-
2631
- })(window.Zepto || window.jQuery, window, document);
2632
-
2633
- /**
2634
- * Autoplay Plugin
2635
- * @version 2.3.4
2636
- * @author Bartosz Wojciechowski
2637
- * @author Artus Kolanowski
2638
- * @author David Deutsch
2639
- * @author Tom De Caluwé
2640
- * @license The MIT License (MIT)
2641
- */
2642
- ;(function($, window, document, undefined) {
2643
-
2644
- /**
2645
- * Creates the autoplay plugin.
2646
- * @class The Autoplay Plugin
2647
- * @param {Owl} scope - The Owl Carousel
2648
- */
2649
- var Autoplay = function(carousel) {
2650
- /**
2651
- * Reference to the core.
2652
- * @protected
2653
- * @type {Owl}
2654
- */
2655
- this._core = carousel;
2656
-
2657
- /**
2658
- * The autoplay timeout id.
2659
- * @type {Number}
2660
- */
2661
- this._call = null;
2662
-
2663
- /**
2664
- * Depending on the state of the plugin, this variable contains either
2665
- * the start time of the timer or the current timer value if it's
2666
- * paused. Since we start in a paused state we initialize the timer
2667
- * value.
2668
- * @type {Number}
2669
- */
2670
- this._time = 0;
2671
-
2672
- /**
2673
- * Stores the timeout currently used.
2674
- * @type {Number}
2675
- */
2676
- this._timeout = 0;
2677
-
2678
- /**
2679
- * Indicates whenever the autoplay is paused.
2680
- * @type {Boolean}
2681
- */
2682
- this._paused = true;
2683
-
2684
- /**
2685
- * All event handlers.
2686
- * @protected
2687
- * @type {Object}
2688
- */
2689
- this._handlers = {
2690
- 'changed.owl.carousel': $.proxy(function(e) {
2691
- if (e.namespace && e.property.name === 'settings') {
2692
- if (this._core.settings.autoplay) {
2693
- this.play();
2694
- } else {
2695
- this.stop();
2696
- }
2697
- } else if (e.namespace && e.property.name === 'position' && this._paused) {
2698
- // Reset the timer. This code is triggered when the position
2699
- // of the carousel was changed through user interaction.
2700
- this._time = 0;
2701
- }
2702
- }, this),
2703
- 'initialized.owl.carousel': $.proxy(function(e) {
2704
- if (e.namespace && this._core.settings.autoplay) {
2705
- this.play();
2706
- }
2707
- }, this),
2708
- 'play.owl.autoplay': $.proxy(function(e, t, s) {
2709
- if (e.namespace) {
2710
- this.play(t, s);
2711
- }
2712
- }, this),
2713
- 'stop.owl.autoplay': $.proxy(function(e) {
2714
- if (e.namespace) {
2715
- this.stop();
2716
- }
2717
- }, this),
2718
- 'mouseover.owl.autoplay': $.proxy(function() {
2719
- if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2720
- this.pause();
2721
- }
2722
- }, this),
2723
- 'mouseleave.owl.autoplay': $.proxy(function() {
2724
- if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2725
- this.play();
2726
- }
2727
- }, this),
2728
- 'touchstart.owl.core': $.proxy(function() {
2729
- if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2730
- this.pause();
2731
- }
2732
- }, this),
2733
- 'touchend.owl.core': $.proxy(function() {
2734
- if (this._core.settings.autoplayHoverPause) {
2735
- this.play();
2736
- }
2737
- }, this)
2738
- };
2739
-
2740
- // register event handlers
2741
- this._core.$element.on(this._handlers);
2742
-
2743
- // set default options
2744
- this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
2745
- };
2746
-
2747
- /**
2748
- * Default options.
2749
- * @public
2750
- */
2751
- Autoplay.Defaults = {
2752
- autoplay: false,
2753
- autoplayTimeout: 5000,
2754
- autoplayHoverPause: false,
2755
- autoplaySpeed: false
2756
- };
2757
-
2758
- /**
2759
- * Transition to the next slide and set a timeout for the next transition.
2760
- * @private
2761
- * @param {Number} [speed] - The animation speed for the animations.
2762
- */
2763
- Autoplay.prototype._next = function(speed) {
2764
- this._call = window.setTimeout(
2765
- $.proxy(this._next, this, speed),
2766
- this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read()
2767
- );
2768
-
2769
- if (this._core.is('interacting') || document.hidden) {
2770
- return;
2771
- }
2772
- this._core.next(speed || this._core.settings.autoplaySpeed);
2773
- }
2774
-
2775
- /**
2776
- * Reads the current timer value when the timer is playing.
2777
- * @public
2778
- */
2779
- Autoplay.prototype.read = function() {
2780
- return new Date().getTime() - this._time;
2781
- };
2782
-
2783
- /**
2784
- * Starts the autoplay.
2785
- * @public
2786
- * @param {Number} [timeout] - The interval before the next animation starts.
2787
- * @param {Number} [speed] - The animation speed for the animations.
2788
- */
2789
- Autoplay.prototype.play = function(timeout, speed) {
2790
- var elapsed;
2791
-
2792
- if (!this._core.is('rotating')) {
2793
- this._core.enter('rotating');
2794
- }
2795
-
2796
- timeout = timeout || this._core.settings.autoplayTimeout;
2797
-
2798
- // Calculate the elapsed time since the last transition. If the carousel
2799
- // wasn't playing this calculation will yield zero.
2800
- elapsed = Math.min(this._time % (this._timeout || timeout), timeout);
2801
-
2802
- if (this._paused) {
2803
- // Start the clock.
2804
- this._time = this.read();
2805
- this._paused = false;
2806
- } else {
2807
- // Clear the active timeout to allow replacement.
2808
- window.clearTimeout(this._call);
2809
- }
2810
-
2811
- // Adjust the origin of the timer to match the new timeout value.
2812
- this._time += this.read() % timeout - elapsed;
2813
-
2814
- this._timeout = timeout;
2815
- this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed);
2816
- };
2817
-
2818
- /**
2819
- * Stops the autoplay.
2820
- * @public
2821
- */
2822
- Autoplay.prototype.stop = function() {
2823
- if (this._core.is('rotating')) {
2824
- // Reset the clock.
2825
- this._time = 0;
2826
- this._paused = true;
2827
-
2828
- window.clearTimeout(this._call);
2829
- this._core.leave('rotating');
2830
- }
2831
- };
2832
-
2833
- /**
2834
- * Pauses the autoplay.
2835
- * @public
2836
- */
2837
- Autoplay.prototype.pause = function() {
2838
- if (this._core.is('rotating') && !this._paused) {
2839
- // Pause the clock.
2840
- this._time = this.read();
2841
- this._paused = true;
2842
-
2843
- window.clearTimeout(this._call);
2844
- }
2845
- };
2846
-
2847
- /**
2848
- * Destroys the plugin.
2849
- */
2850
- Autoplay.prototype.destroy = function() {
2851
- var handler, property;
2852
-
2853
- this.stop();
2854
-
2855
- for (handler in this._handlers) {
2856
- this._core.$element.off(handler, this._handlers[handler]);
2857
- }
2858
- for (property in Object.getOwnPropertyNames(this)) {
2859
- typeof this[property] != 'function' && (this[property] = null);
2860
- }
2861
- };
2862
-
2863
- $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
2864
-
2865
- })(window.Zepto || window.jQuery, window, document);
2866
-
2867
- /**
2868
- * Navigation Plugin
2869
- * @version 2.3.4
2870
- * @author Artus Kolanowski
2871
- * @author David Deutsch
2872
- * @license The MIT License (MIT)
2873
- */
2874
- ;(function($, window, document, undefined) {
2875
- 'use strict';
2876
-
2877
- /**
2878
- * Creates the navigation plugin.
2879
- * @class The Navigation Plugin
2880
- * @param {Owl} carousel - The Owl Carousel.
2881
- */
2882
- var Navigation = function(carousel) {
2883
- /**
2884
- * Reference to the core.
2885
- * @protected
2886
- * @type {Owl}
2887
- */
2888
- this._core = carousel;
2889
-
2890
- /**
2891
- * Indicates whether the plugin is initialized or not.
2892
- * @protected
2893
- * @type {Boolean}
2894
- */
2895
- this._initialized = false;
2896
-
2897
- /**
2898
- * The current paging indexes.
2899
- * @protected
2900
- * @type {Array}
2901
- */
2902
- this._pages = [];
2903
-
2904
- /**
2905
- * All DOM elements of the user interface.
2906
- * @protected
2907
- * @type {Object}
2908
- */
2909
- this._controls = {};
2910
-
2911
- /**
2912
- * Markup for an indicator.
2913
- * @protected
2914
- * @type {Array.<String>}
2915
- */
2916
- this._templates = [];
2917
-
2918
- /**
2919
- * The carousel element.
2920
- * @type {jQuery}
2921
- */
2922
- this.$element = this._core.$element;
2923
-
2924
- /**
2925
- * Overridden methods of the carousel.
2926
- * @protected
2927
- * @type {Object}
2928
- */
2929
- this._overrides = {
2930
- next: this._core.next,
2931
- prev: this._core.prev,
2932
- to: this._core.to
2933
- };
2934
-
2935
- /**
2936
- * All event handlers.
2937
- * @protected
2938
- * @type {Object}
2939
- */
2940
- this._handlers = {
2941
- 'prepared.owl.carousel': $.proxy(function(e) {
2942
- if (e.namespace && this._core.settings.dotsData) {
2943
- this._templates.push('<div class="' + this._core.settings.dotClass + '">' +
2944
- $(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>');
2945
- }
2946
- }, this),
2947
- 'added.owl.carousel': $.proxy(function(e) {
2948
- if (e.namespace && this._core.settings.dotsData) {
2949
- this._templates.splice(e.position, 0, this._templates.pop());
2950
- }
2951
- }, this),
2952
- 'remove.owl.carousel': $.proxy(function(e) {
2953
- if (e.namespace && this._core.settings.dotsData) {
2954
- this._templates.splice(e.position, 1);
2955
- }
2956
- }, this),
2957
- 'changed.owl.carousel': $.proxy(function(e) {
2958
- if (e.namespace && e.property.name == 'position') {
2959
- this.draw();
2960
- }
2961
- }, this),
2962
- 'initialized.owl.carousel': $.proxy(function(e) {
2963
- if (e.namespace && !this._initialized) {
2964
- this._core.trigger('initialize', null, 'navigation');
2965
- this.initialize();
2966
- this.update();
2967
- this.draw();
2968
- this._initialized = true;
2969
- this._core.trigger('initialized', null, 'navigation');
2970
- }
2971
- }, this),
2972
- 'refreshed.owl.carousel': $.proxy(function(e) {
2973
- if (e.namespace && this._initialized) {
2974
- this._core.trigger('refresh', null, 'navigation');
2975
- this.update();
2976
- this.draw();
2977
- this._core.trigger('refreshed', null, 'navigation');
2978
- }
2979
- }, this)
2980
- };
2981
-
2982
- // set default options
2983
- this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
2984
-
2985
- // register event handlers
2986
- this.$element.on(this._handlers);
2987
- };
2988
-
2989
- /**
2990
- * Default options.
2991
- * @public
2992
- * @todo Rename `slideBy` to `navBy`
2993
- */
2994
- Navigation.Defaults = {
2995
- nav: false,
2996
- navText: [
2997
- '<span aria-label="' + 'Previous' + '">&#x2039;</span>',
2998
- '<span aria-label="' + 'Next' + '">&#x203a;</span>'
2999
- ],
3000
- navSpeed: false,
3001
- navElement: 'button type="button" role="presentation"',
3002
- navContainer: false,
3003
- navContainerClass: 'owl-nav',
3004
- navClass: [
3005
- 'owl-prev',
3006
- 'owl-next'
3007
- ],
3008
- slideBy: 1,
3009
- changeItemOnClick:false,
3010
- dotClass: 'owl-dot',
3011
- dotsClass: 'owl-dots',
3012
- dots: true,
3013
- dotsEach: false,
3014
- dotsData: false,
3015
- dotsSpeed: false,
3016
- dotsContainer: false
3017
- };
3018
-
3019
- /**
3020
- * Initializes the layout of the plugin and extends the carousel.
3021
- * @protected
3022
- */
3023
- Navigation.prototype.initialize = function() {
3024
- var override,
3025
- settings = this._core.settings;
3026
-
3027
- // create DOM structure for relative navigation
3028
- this._controls.$relative = (settings.navContainer ? $(settings.navContainer)
3029
- : $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled');
3030
-
3031
- this._controls.$previous = $('<' + settings.navElement + ' value="previous item">')
3032
- .addClass(settings.navClass[0])
3033
- .html(settings.navText[0])
3034
- .prependTo(this._controls.$relative)
3035
- .on('click', $.proxy(function(e) {
3036
- this.prev(settings.navSpeed);
3037
- }, this));
3038
- this._controls.$next = $('<' + settings.navElement + ' value="next item">')
3039
- .addClass(settings.navClass[1])
3040
- .html(settings.navText[1])
3041
- .appendTo(this._controls.$relative)
3042
- .on('click', $.proxy(function(e) {
3043
- this.next(settings.navSpeed);
3044
- }, this));
3045
-
3046
- // scroll on item-click function
3047
- if(settings.changeItemOnClick){
3048
- var owlItem = this._core.$stage.children();
3049
- var clonedItems = this._core.clones().length / 2;
3050
-
3051
- owlItem.on('click', $.proxy(function(e){
3052
- var index = $(e.currentTarget).index();
3053
- this.to(index - clonedItems, settings.navSpeed, true);
3054
- }, this));
3055
- }
3056
-
3057
-
3058
-
3059
- // create DOM structure for absolute navigation
3060
- if (!settings.dotsData) {
3061
- this._templates = [ $('<button role="button">')
3062
- .addClass(settings.dotClass)
3063
- .append($('<span>'))
3064
- .prop('outerHTML') ];
3065
- }
3066
-
3067
- this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer)
3068
- : $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled');
3069
-
3070
- this._controls.$absolute.on('click', 'button', $.proxy(function(e) {
3071
- var index = $(e.target).parent().is(this._controls.$absolute)
3072
- ? $(e.target).index() : $(e.target).parent().index();
3073
- console.log($(e.target).index());
3074
- e.preventDefault();
3075
-
3076
- this.to(index, settings.dotsSpeed);
3077
- }, this));
3078
-
3079
- /*$el.on('focusin', function() {
3080
- $(document).off(".carousel");
3081
-
3082
- $(document).on('keydown.carousel', function(e) {
3083
- if(e.keyCode == 37) {
3084
- $el.trigger('prev.owl')
3085
- }
3086
- if(e.keyCode == 39) {
3087
- $el.trigger('next.owl')
3088
- }
3089
- });
3090
- });*/
3091
-
3092
- // override public methods of the carousel
3093
- for (override in this._overrides) {
3094
- this._core[override] = $.proxy(this[override], this);
3095
- }
3096
- };
3097
-
3098
- /**
3099
- * Destroys the plugin.
3100
- * @protected
3101
- */
3102
- Navigation.prototype.destroy = function() {
3103
- var handler, control, property, override, settings;
3104
- settings = this._core.settings;
3105
-
3106
- for (handler in this._handlers) {
3107
- this.$element.off(handler, this._handlers[handler]);
3108
- }
3109
- for (control in this._controls) {
3110
- if (control === '$relative' && settings.navContainer) {
3111
- this._controls[control].html('');
3112
- } else {
3113
- this._controls[control].remove();
3114
- }
3115
- }
3116
- for (override in this.overides) {
3117
- this._core[override] = this._overrides[override];
3118
- }
3119
- for (property in Object.getOwnPropertyNames(this)) {
3120
- typeof this[property] != 'function' && (this[property] = null);
3121
- }
3122
- };
3123
-
3124
- /**
3125
- * Updates the internal state.
3126
- * @protected
3127
- */
3128
- Navigation.prototype.update = function() {
3129
- var i, j, k,
3130
- lower = this._core.clones().length / 2,
3131
- upper = lower + this._core.items().length,
3132
- maximum = this._core.maximum(true),
3133
- settings = this._core.settings,
3134
- size = settings.center || settings.autoWidth || settings.dotsData
3135
- ? 1 : settings.dotsEach || settings.items;
3136
-
3137
- if (settings.slideBy !== 'page') {
3138
- settings.slideBy = Math.min(settings.slideBy, settings.items);
3139
- }
3140
-
3141
- if (settings.dots || settings.slideBy == 'page') {
3142
- this._pages = [];
3143
-
3144
- for (i = lower, j = 0, k = 0; i < upper; i++) {
3145
- if (j >= size || j === 0) {
3146
- this._pages.push({
3147
- start: Math.min(maximum, i - lower),
3148
- end: i - lower + size - 1
3149
- });
3150
- if (Math.min(maximum, i - lower) === maximum) {
3151
- break;
3152
- }
3153
- j = 0, ++k;
3154
- }
3155
- j += this._core.mergers(this._core.relative(i));
3156
- }
3157
- }
3158
- };
3159
-
3160
- /**
3161
- * Draws the user interface.
3162
- * @todo The option `dotsData` wont work.
3163
- * @protected
3164
- */
3165
- Navigation.prototype.draw = function() {
3166
- var difference,
3167
- settings = this._core.settings,
3168
- disabled = this._core.items().length <= settings.items,
3169
- index = this._core.relative(this._core.current()),
3170
- loop = settings.loop || settings.rewind;
3171
-
3172
- this._controls.$relative.toggleClass('disabled', !settings.nav || disabled);
3173
-
3174
- if (settings.nav) {
3175
- this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true));
3176
- this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true));
3177
- }
3178
-
3179
- this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled);
3180
-
3181
- if (settings.dots) {
3182
- difference = this._pages.length - this._controls.$absolute.children().length;
3183
-
3184
- if (settings.dotsData && difference !== 0) {
3185
- this._controls.$absolute.html(this._templates.join(''));
3186
- } else if (difference > 0) {
3187
- this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0]));
3188
- } else if (difference < 0) {
3189
- this._controls.$absolute.children().slice(difference).remove();
3190
- }
3191
-
3192
- this._controls.$absolute.find('.active').removeClass('active');
3193
- this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active');
3194
- }
3195
- };
3196
-
3197
- /**
3198
- * Extends event data.
3199
- * @protected
3200
- * @param {Event} event - The event object which gets thrown.
3201
- */
3202
- Navigation.prototype.onTrigger = function(event) {
3203
- var settings = this._core.settings;
3204
-
3205
- event.page = {
3206
- index: $.inArray(this.current(), this._pages),
3207
- count: this._pages.length,
3208
- size: settings && (settings.center || settings.autoWidth || settings.dotsData
3209
- ? 1 : settings.dotsEach || settings.items)
3210
- };
3211
- };
3212
-
3213
- /**
3214
- * Gets the current page position of the carousel.
3215
- * @protected
3216
- * @returns {Number}
3217
- */
3218
- Navigation.prototype.current = function() {
3219
- var current = this._core.relative(this._core.current());
3220
- return $.grep(this._pages, $.proxy(function(page, index) {
3221
- return page.start <= current && page.end >= current;
3222
- }, this)).pop();
3223
- };
3224
-
3225
- /**
3226
- * Gets the current succesor/predecessor position.
3227
- * @protected
3228
- * @returns {Number}
3229
- */
3230
- Navigation.prototype.getPosition = function(successor) {
3231
- var position, length,
3232
- settings = this._core.settings;
3233
-
3234
- if (settings.slideBy == 'page') {
3235
- position = $.inArray(this.current(), this._pages);
3236
- length = this._pages.length;
3237
- successor ? ++position : --position;
3238
- position = this._pages[((position % length) + length) % length].start;
3239
- } else {
3240
- position = this._core.relative(this._core.current());
3241
- length = this._core.items().length;
3242
- successor ? position += settings.slideBy : position -= settings.slideBy;
3243
- }
3244
-
3245
- return position;
3246
- };
3247
-
3248
- /**
3249
- * Slides to the next item or page.
3250
- * @public
3251
- * @param {Number} [speed=false] - The time in milliseconds for the transition.
3252
- */
3253
- Navigation.prototype.next = function(speed) {
3254
- $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
3255
- };
3256
-
3257
- /**
3258
- * Slides to the previous item or page.
3259
- * @public
3260
- * @param {Number} [speed=false] - The time in milliseconds for the transition.
3261
- */
3262
- Navigation.prototype.prev = function(speed) {
3263
- $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
3264
- };
3265
-
3266
- /**
3267
- * Slides to the specified item or page.
3268
- * @public
3269
- * @param {Number} position - The position of the item or page.
3270
- * @param {Number} [speed] - The time in milliseconds for the transition.
3271
- * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
3272
- */
3273
- Navigation.prototype.to = function(position, speed, standard) {
3274
- var length;
3275
-
3276
- if (!standard && this._pages.length) {
3277
- length = this._pages.length;
3278
- $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
3279
- } else {
3280
- $.proxy(this._overrides.to, this._core)(position, speed);
3281
- }
3282
- };
3283
-
3284
- $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
3285
-
3286
- })(window.Zepto || window.jQuery, window, document);
3287
-
3288
- /**
3289
- * Hash Plugin
3290
- * @version 2.3.4
3291
- * @author Artus Kolanowski
3292
- * @author David Deutsch
3293
- * @license The MIT License (MIT)
3294
- */
3295
- ;(function($, window, document, undefined) {
3296
- 'use strict';
3297
-
3298
- /**
3299
- * Creates the hash plugin.
3300
- * @class The Hash Plugin
3301
- * @param {Owl} carousel - The Owl Carousel
3302
- */
3303
- var Hash = function(carousel) {
3304
- /**
3305
- * Reference to the core.
3306
- * @protected
3307
- * @type {Owl}
3308
- */
3309
- this._core = carousel;
3310
-
3311
- /**
3312
- * Hash index for the items.
3313
- * @protected
3314
- * @type {Object}
3315
- */
3316
- this._hashes = {};
3317
-
3318
- /**
3319
- * The carousel element.
3320
- * @type {jQuery}
3321
- */
3322
- this.$element = this._core.$element;
3323
-
3324
- /**
3325
- * All event handlers.
3326
- * @protected
3327
- * @type {Object}
3328
- */
3329
- this._handlers = {
3330
- 'initialized.owl.carousel': $.proxy(function(e) {
3331
- if (e.namespace && this._core.settings.startPosition === 'URLHash') {
3332
- $(window).trigger('hashchange.owl.navigation');
3333
- }
3334
- }, this),
3335
- 'prepared.owl.carousel': $.proxy(function(e) {
3336
- if (e.namespace) {
3337
- var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash');
3338
-
3339
- if (!hash) {
3340
- return;
3341
- }
3342
-
3343
- this._hashes[hash] = e.content;
3344
- }
3345
- }, this),
3346
- 'changed.owl.carousel': $.proxy(function(e) {
3347
- if (e.namespace && e.property.name === 'position') {
3348
- var current = this._core.items(this._core.relative(this._core.current())),
3349
- hash = $.map(this._hashes, function(item, hash) {
3350
- return item === current ? hash : null;
3351
- }).join();
3352
-
3353
- if (!hash || window.location.hash.slice(1) === hash) {
3354
- return;
3355
- }
3356
-
3357
- window.location.hash = hash;
3358
- }
3359
- }, this)
3360
- };
3361
-
3362
- // set default options
3363
- this._core.options = $.extend({}, Hash.Defaults, this._core.options);
3364
-
3365
- // register the event handlers
3366
- this.$element.on(this._handlers);
3367
-
3368
- // register event listener for hash navigation
3369
- $(window).on('hashchange.owl.navigation', $.proxy(function(e) {
3370
- var hash = window.location.hash.substring(1),
3371
- items = this._core.$stage.children(),
3372
- position = this._hashes[hash] && items.index(this._hashes[hash]);
3373
-
3374
- if (position === undefined || position === this._core.current()) {
3375
- return;
3376
- }
3377
-
3378
- this._core.to(this._core.relative(position), false, true);
3379
- }, this));
3380
- };
3381
-
3382
- /**
3383
- * Default options.
3384
- * @public
3385
- */
3386
- Hash.Defaults = {
3387
- URLhashListener: false
3388
- };
3389
-
3390
- /**
3391
- * Destroys the plugin.
3392
- * @public
3393
- */
3394
- Hash.prototype.destroy = function() {
3395
- var handler, property;
3396
-
3397
- $(window).off('hashchange.owl.navigation');
3398
-
3399
- for (handler in this._handlers) {
3400
- this._core.$element.off(handler, this._handlers[handler]);
3401
- }
3402
- for (property in Object.getOwnPropertyNames(this)) {
3403
- typeof this[property] != 'function' && (this[property] = null);
3404
- }
3405
- };
3406
-
3407
- $.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
3408
-
3409
- })(window.Zepto || window.jQuery, window, document);
3410
-
3411
- /**
3412
- * Support Plugin
3413
- *
3414
- * @version 2.3.4
3415
- * @author Vivid Planet Software GmbH
3416
- * @author Artus Kolanowski
3417
- * @author David Deutsch
3418
- * @license The MIT License (MIT)
3419
- */
3420
- ;(function($, window, document, undefined) {
3421
-
3422
- var style = $('<support>').get(0).style,
3423
- prefixes = 'Webkit Moz O ms'.split(' '),
3424
- events = {
3425
- transition: {
3426
- end: {
3427
- WebkitTransition: 'webkitTransitionEnd',
3428
- MozTransition: 'transitionend',
3429
- OTransition: 'oTransitionEnd',
3430
- transition: 'transitionend'
3431
- }
3432
- },
3433
- animation: {
3434
- end: {
3435
- WebkitAnimation: 'webkitAnimationEnd',
3436
- MozAnimation: 'animationend',
3437
- OAnimation: 'oAnimationEnd',
3438
- animation: 'animationend'
3439
- }
3440
- }
3441
- },
3442
- tests = {
3443
- csstransforms: function() {
3444
- return !!test('transform');
3445
- },
3446
- csstransforms3d: function() {
3447
- return !!test('perspective');
3448
- },
3449
- csstransitions: function() {
3450
- return !!test('transition');
3451
- },
3452
- cssanimations: function() {
3453
- return !!test('animation');
3454
- }
3455
- };
3456
-
3457
- function test(property, prefixed) {
3458
- var result = false,
3459
- upper = property.charAt(0).toUpperCase() + property.slice(1);
3460
-
3461
- $.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) {
3462
- if (style[property] !== undefined) {
3463
- result = prefixed ? property : true;
3464
- return false;
3465
- }
3466
- });
3467
-
3468
- return result;
3469
- }
3470
-
3471
- function prefixed(property) {
3472
- return test(property, true);
3473
- }
3474
-
3475
- if (tests.csstransitions()) {
3476
- /* jshint -W053 */
3477
- $.support.transition = new String(prefixed('transition'))
3478
- $.support.transition.end = events.transition.end[ $.support.transition ];
3479
- }
3480
-
3481
- if (tests.cssanimations()) {
3482
- /* jshint -W053 */
3483
- $.support.animation = new String(prefixed('animation'))
3484
- $.support.animation.end = events.animation.end[ $.support.animation ];
3485
- }
3486
-
3487
- if (tests.csstransforms()) {
3488
- /* jshint -W053 */
3489
- $.support.transform = new String(prefixed('transform'));
3490
- $.support.transform3d = tests.csstransforms3d();
3491
- }
3492
-
3493
- })(window.Zepto || window.jQuery, window, document);
 
 
 
 
 
 
 
 
 
 
 
 
3494
 
1
+ /**
2
+ * Owl Carousel v2.3.6 - UE4
3
+ * Copyright 2013-2018 David Deutsch
4
+ * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
+ */
6
+ /**
7
+ * Owl carousel
8
+ * @version 2.3.5
9
+ * @author Bartosz Wojciechowski
10
+ * @author David Deutsch
11
+ * @license The MIT License (MIT)
12
+ * @todo Lazy Load Icon
13
+ * @todo prevent animationend bubling
14
+ * @todo itemsScaleUp
15
+ * @todo Test Zepto
16
+ * @todo stagePadding calculate wrong active classes
17
+ */
18
+ ;(function($, window, document, undefined) {
19
+
20
+ /**
21
+ * Creates a carousel.
22
+ * @class The Owl Carousel.
23
+ * @public
24
+ * @param {HTMLElement|jQuery} element - The element to create the carousel for.
25
+ * @param {Object} [options] - The options
26
+ */
27
+ function Owl(element, options) {
28
+
29
+ /**
30
+ * Current settings for the carousel.
31
+ * @public
32
+ */
33
+ this.settings = null;
34
+
35
+ /**
36
+ * Current options set by the caller including defaults.
37
+ * @public
38
+ */
39
+ this.options = $.extend({}, Owl.Defaults, options);
40
+
41
+ /**
42
+ * Plugin element.
43
+ * @public
44
+ */
45
+ this.$element = $(element);
46
+
47
+ /**
48
+ * Proxied event handlers.
49
+ * @protected
50
+ */
51
+ this._handlers = {};
52
+
53
+ /**
54
+ * References to the running plugins of this carousel.
55
+ * @protected
56
+ */
57
+ this._plugins = {};
58
+
59
+ /**
60
+ * Currently suppressed events to prevent them from being retriggered.
61
+ * @protected
62
+ */
63
+ this._supress = {};
64
+
65
+ /**
66
+ * Absolute current position.
67
+ * @protected
68
+ */
69
+ this._current = null;
70
+
71
+ /**
72
+ * Animation speed in milliseconds.
73
+ * @protected
74
+ */
75
+ this._speed = null;
76
+
77
+ /**
78
+ * Coordinates of all items in pixel.
79
+ * @todo The name of this member is missleading.
80
+ * @protected
81
+ */
82
+ this._coordinates = [];
83
+
84
+ /**
85
+ * Current breakpoint.
86
+ * @todo Real media queries would be nice.
87
+ * @protected
88
+ */
89
+ this._breakpoint = null;
90
+
91
+ /**
92
+ * Current width of the plugin element.
93
+ */
94
+ this._width = null;
95
+
96
+ /**
97
+ * All real items.
98
+ * @protected
99
+ */
100
+ this._items = [];
101
+
102
+ /**
103
+ * All cloned items.
104
+ * @protected
105
+ */
106
+ this._clones = [];
107
+
108
+ /**
109
+ * Merge values of all items.
110
+ * @todo Maybe this could be part of a plugin.
111
+ * @protected
112
+ */
113
+ this._mergers = [];
114
+
115
+ /**
116
+ * Widths of all items.
117
+ */
118
+ this._widths = [];
119
+
120
+ /**
121
+ * Invalidated parts within the update process.
122
+ * @protected
123
+ */
124
+ this._invalidated = {};
125
+
126
+ /**
127
+ * Ordered list of workers for the update process.
128
+ * @protected
129
+ */
130
+ this._pipe = [];
131
+
132
+ /**
133
+ * Current state information for the drag operation.
134
+ * @todo #261
135
+ * @protected
136
+ */
137
+ this._drag = {
138
+ time: null,
139
+ target: null,
140
+ pointer: null,
141
+ stage: {
142
+ start: null,
143
+ current: null
144
+ },
145
+ direction: null
146
+ };
147
+
148
+ /**
149
+ * Current state information and their tags.
150
+ * @type {Object}
151
+ * @protected
152
+ */
153
+ this._states = {
154
+ current: {},
155
+ tags: {
156
+ 'initializing': [ 'busy' ],
157
+ 'animating': [ 'busy' ],
158
+ 'dragging': [ 'interacting' ]
159
+ }
160
+ };
161
+
162
+ $.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) {
163
+ this._handlers[handler] = $.proxy(this[handler], this);
164
+ }, this));
165
+
166
+ $.each(Owl.Plugins, $.proxy(function(key, plugin) {
167
+ this._plugins[key.charAt(0).toLowerCase() + key.slice(1)]
168
+ = new plugin(this);
169
+ }, this));
170
+
171
+ $.each(Owl.Workers, $.proxy(function(priority, worker) {
172
+ this._pipe.push({
173
+ 'filter': worker.filter,
174
+ 'run': $.proxy(worker.run, this)
175
+ });
176
+ }, this));
177
+
178
+ this.setup();
179
+ this.initialize();
180
+ }
181
+
182
+ /**
183
+ * Default options for the carousel.
184
+ * @public
185
+ */
186
+ Owl.Defaults = {
187
+ items: 3,
188
+ loop: false,
189
+ center: false,
190
+ rewind: false,
191
+ checkVisibility: true,
192
+ setActiveClass: true,
193
+ setActiveClassOnMobile: true,
194
+
195
+ mouseDrag: true,
196
+ touchDrag: true,
197
+ pullDrag: true,
198
+ freeDrag: false,
199
+
200
+ margin: 0,
201
+ stagePadding: 0,
202
+
203
+ merge: false,
204
+ mergeFit: true,
205
+ autoWidth: false,
206
+
207
+ startPosition: 0,
208
+ rtl: false,
209
+
210
+ smartSpeed: 250,
211
+ fluidSpeed: false,
212
+ dragEndSpeed: false,
213
+
214
+ responsive: {},
215
+ responsiveRefreshRate: 200,
216
+ responsiveBaseElement: window,
217
+
218
+ fallbackEasing: 'swing',
219
+ slideTransition: '',
220
+
221
+ info: false,
222
+
223
+ nestedItemSelector: false,
224
+ itemElement: 'div',
225
+ stageElement: 'div',
226
+
227
+ refreshClass: 'owl-refresh',
228
+ loadedClass: 'owl-loaded',
229
+ loadingClass: 'owl-loading',
230
+ rtlClass: 'owl-rtl',
231
+ responsiveClass: 'owl-responsive',
232
+ dragClass: 'owl-drag',
233
+ itemClass: 'owl-item',
234
+ stageClass: 'owl-stage',
235
+ stageOuterClass: 'owl-stage-outer',
236
+ grabClass: 'owl-grab',
237
+ shuffle: false
238
+ };
239
+
240
+ /**
241
+ * Enumeration for width.
242
+ * @public
243
+ * @readonly
244
+ * @enum {String}
245
+ */
246
+ Owl.Width = {
247
+ Default: 'default',
248
+ Inner: 'inner',
249
+ Outer: 'outer'
250
+ };
251
+
252
+ /**
253
+ * Enumeration for types.
254
+ * @public
255
+ * @readonly
256
+ * @enum {String}
257
+ */
258
+ Owl.Type = {
259
+ Event: 'event',
260
+ State: 'state'
261
+ };
262
+
263
+ /**
264
+ * Contains all registered plugins.
265
+ * @public
266
+ */
267
+ Owl.Plugins = {};
268
+
269
+ /**
270
+ * List of workers involved in the update process.
271
+ */
272
+ Owl.Workers = [ {
273
+ filter: [ 'width', 'settings' ],
274
+ run: function() {
275
+ this._width = this.$element.width();
276
+ }
277
+ }, {
278
+ filter: [ 'width', 'items', 'settings' ],
279
+ run: function(cache) {
280
+ cache.current = this._items && this._items[this.relative(this._current)];
281
+ }
282
+ }, {
283
+ filter: [ 'items', 'settings' ],
284
+ run: function() {
285
+ this.$stage.children('.cloned').remove();
286
+ }
287
+ }, {
288
+ filter: [ 'width', 'items', 'settings' ],
289
+ run: function(cache) {
290
+ var margin = this.settings.margin || '',
291
+ grid = !this.settings.autoWidth,
292
+ rtl = this.settings.rtl,
293
+ css = {
294
+ 'width': 'auto',
295
+ 'margin-left': rtl ? margin : '',
296
+ 'margin-right': rtl ? '' : margin
297
+ };
298
+
299
+ !grid && this.$stage.children().css(css);
300
+
301
+ cache.css = css;
302
+ }
303
+ }, {
304
+ filter: [ 'width', 'items', 'settings' ],
305
+ run: function(cache) {
306
+ var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
307
+ merge = null,
308
+ iterator = this._items.length,
309
+ grid = !this.settings.autoWidth,
310
+ widths = [];
311
+
312
+ cache.items = {
313
+ merge: false,
314
+ width: width
315
+ };
316
+
317
+ while (iterator--) {
318
+ merge = this._mergers[iterator];
319
+ merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
320
+
321
+ cache.items.merge = merge > 1 || cache.items.merge;
322
+
323
+ widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
324
+ }
325
+
326
+ this._widths = widths;
327
+ }
328
+ }, {
329
+ filter: [ 'items', 'settings' ],
330
+ run: function() {
331
+ var clones = [],
332
+ items = this._items,
333
+ settings = this.settings,
334
+ // TODO: Should be computed from number of min width items in stage
335
+ view = Math.max(settings.items * 2, 4),
336
+ size = Math.ceil(items.length / 2) * 2,
337
+ repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0,
338
+ append = '',
339
+ prepend = '';
340
+
341
+ repeat /= 2;
342
+
343
+ while (repeat > 0) {
344
+ // Switch to only using appended clones
345
+ clones.push(this.normalize(clones.length / 2, true));
346
+ append = append + items[clones[clones.length - 1]][0].outerHTML;
347
+ clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true));
348
+ prepend = items[clones[clones.length - 1]][0].outerHTML + prepend;
349
+ repeat -= 1;
350
+ }
351
+
352
+ this._clones = clones;
353
+
354
+ $(append).addClass('cloned').appendTo(this.$stage);
355
+ $(prepend).addClass('cloned').prependTo(this.$stage);
356
+ }
357
+ }, {
358
+ filter: [ 'width', 'items', 'settings' ],
359
+ run: function() {
360
+ var rtl = this.settings.rtl ? 1 : -1,
361
+ size = this._clones.length + this._items.length,
362
+ iterator = -1,
363
+ previous = 0,
364
+ current = 0,
365
+ coordinates = [];
366
+
367
+ while (++iterator < size) {
368
+ previous = coordinates[iterator - 1] || 0;
369
+ current = this._widths[this.relative(iterator)] + this.settings.margin;
370
+ coordinates.push(previous + current * rtl);
371
+ }
372
+
373
+ this._coordinates = coordinates;
374
+ }
375
+ }, {
376
+ filter: [ 'width', 'items', 'settings' ],
377
+ run: function() {
378
+ var padding = this.settings.stagePadding,
379
+ coordinates = this._coordinates,
380
+ css = {
381
+ 'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2,
382
+ 'padding-left': padding || '',
383
+ 'padding-right': padding || ''
384
+ };
385
+
386
+ this.$stage.css(css);
387
+ }
388
+ }, {
389
+ filter: [ 'width', 'items', 'settings' ],
390
+ run: function(cache) {
391
+ var iterator = this._coordinates.length,
392
+ grid = !this.settings.autoWidth,
393
+ items = this.$stage.children();
394
+
395
+ if (grid && cache.items.merge) {
396
+ while (iterator--) {
397
+ cache.css.width = this._widths[this.relative(iterator)];
398
+ items.eq(iterator).css(cache.css);
399
+ }
400
+ } else if (grid) {
401
+ cache.css.width = cache.items.width;
402
+ items.css(cache.css);
403
+ }
404
+ }
405
+ }, {
406
+ filter: [ 'items' ],
407
+ run: function() {
408
+ this._coordinates.length < 1 && this.$stage.removeAttr('style');
409
+ }
410
+ }, {
411
+ filter: [ 'width', 'items', 'settings' ],
412
+ run: function(cache) {
413
+ cache.current = cache.current ? this.$stage.children().index(cache.current) : 0;
414
+ cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current));
415
+ this.reset(cache.current);
416
+ }
417
+ }, {
418
+ filter: [ 'position' ],
419
+ run: function() {
420
+ this.animate(this.coordinates(this._current));
421
+ }
422
+ }, {
423
+ filter: [ 'width', 'position', 'items', 'settings' ],
424
+ run: function() {
425
+ var rtl = this.settings.rtl ? 1 : -1,
426
+ padding = this.settings.stagePadding * 2,
427
+ begin = this.coordinates(this.current()) + padding,
428
+ end = begin + this.width() * rtl,
429
+ inner, outer, matches = [], i, n;
430
+
431
+ for (i = 0, n = this._coordinates.length; i < n; i++) {
432
+ inner = this._coordinates[i - 1] || 0;
433
+ outer = Math.abs(this._coordinates[i]) + padding * rtl;
434
+
435
+ if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
436
+ || (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
437
+ matches.push(i);
438
+ }
439
+ }
440
+
441
+ this.$stage.children('.active').removeClass('active');
442
+ this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active');
443
+
444
+ this.$stage.children('.center').removeClass('center');
445
+ if (this.settings.center) {
446
+ this.$stage.children().eq(this.current()).addClass('center');
447
+ }
448
+ }
449
+ }, {
450
+ filter: [ 'width', 'position', 'items', 'settings' ],
451
+ run: function() {
452
+
453
+ if(!this.settings.setActiveClass){
454
+ return;
455
+ }
456
+
457
+ if (this.settings.setActiveClass) {
458
+ var $setClass = true;
459
+
460
+ if (this.settings.setActiveClassOnMobile) {
461
+ if(this.$stage.children(".active").length == 1){
462
+ $setClass = true;
463
+ }
464
+ }else if(!this.settings.setActiveClassOnMobile){
465
+ if(this.$stage.children(".active").length == 1){
466
+ $setClass = false;
467
+ }
468
+ }
469
+
470
+ if($setClass == true){
471
+ this.$stage.children().eq(this.current()).addClass("uc-active-item").siblings().removeClass("uc-active-item");
472
+ }else if ($setClass == false){
473
+ this.$stage.children().removeClass("uc-active-item");
474
+ }
475
+
476
+ }
477
+ }
478
+ }];
479
+
480
+ /**
481
+ * Create the stage DOM element
482
+ */
483
+ Owl.prototype.initializeStage = function() {
484
+ this.$stage = this.$element.find('.' + this.settings.stageClass);
485
+
486
+ // if the stage is already in the DOM, grab it and skip stage initialization
487
+ if (this.$stage.length) {
488
+ return;
489
+ }
490
+
491
+ this.$element.addClass(this.options.loadingClass);
492
+
493
+ // create stage
494
+ this.$stage = $('<' + this.settings.stageElement + '>', {
495
+ "class": this.settings.stageClass
496
+ }).wrap( $( '<div/>', {
497
+ "class": this.settings.stageOuterClass
498
+ }));
499
+
500
+ // append stage
501
+ this.$element.append(this.$stage.parent());
502
+ };
503
+
504
+ /**
505
+ * Create item DOM elements
506
+ */
507
+ Owl.prototype.initializeItems = function() {
508
+ var $items = this.$element.find('.owl-item');
509
+
510
+ // if the items are already in the DOM, grab them and skip item initialization
511
+ if ($items.length) {
512
+ this._items = $items.get().map(function(item) {
513
+ return $(item);
514
+ });
515
+
516
+ this._mergers = this._items.map(function() {
517
+ return 1;
518
+ });
519
+
520
+ this.refresh();
521
+
522
+ return;
523
+ }
524
+
525
+ // append content
526
+ this.replace(this.$element.children().not(this.$stage.parent()));
527
+
528
+ // check visibility
529
+ if (this.isVisible()) {
530
+ // update view
531
+ this.refresh();
532
+ } else {
533
+ // invalidate width
534
+ this.invalidate('width');
535
+ }
536
+
537
+
538
+ this.$element
539
+ .removeClass(this.options.loadingClass)
540
+ .addClass(this.options.loadedClass);
541
+ };
542
+
543
+ /**
544
+ * Initializes the carousel.
545
+ * @protected
546
+ */
547
+ Owl.prototype.initialize = function() {
548
+ this.enter('initializing');
549
+ this.trigger('initialize');
550
+
551
+ this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
552
+
553
+
554
+ if(this.settings.shuffle){
555
+ var carousel = this.$element;
556
+ carousel.children().sort(function(){
557
+ return Math.round(Math.random()) - 0.5;
558
+ }).each(function(){
559
+ carousel.append(this);
560
+ });
561
+ }
562
+
563
+ if (this.settings.autoWidth && !this.is('pre-loading')) {
564
+ var imgs, nestedSelector, width;
565
+ imgs = this.$element.find('img');
566
+ nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
567
+ width = this.$element.children(nestedSelector).width();
568
+
569
+ if (imgs.length && width <= 0) {
570
+ this.preloadAutoWidthImages(imgs);
571
+ }
572
+ }
573
+
574
+ this.initializeStage();
575
+ this.initializeItems();
576
+
577
+ // register event handlers
578
+ this.registerEventHandlers();
579
+
580
+ this.leave('initializing');
581
+ this.trigger('initialized');
582
+ };
583
+
584
+ /**
585
+ * @returns {Boolean} visibility of $element
586
+ * if you know the carousel will always be visible you can set `checkVisibility` to `false` to
587
+ * prevent the expensive browser layout forced reflow the $element.is(':visible') does
588
+ */
589
+ Owl.prototype.isVisible = function() {
590
+ return this.settings.checkVisibility
591
+ ? this.$element.is(':visible')
592
+ : true;
593
+ };
594
+
595
+ /**
596
+ * Setups the current settings.
597
+ * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
598
+ * @todo Support for media queries by using `matchMedia` would be nice.
599
+ * @public
600
+ */
601
+ Owl.prototype.setup = function() {
602
+ var viewport = this.viewport(),
603
+ overwrites = this.options.responsive,
604
+ match = -1,
605
+ settings = null;
606
+
607
+ if (!overwrites) {
608
+ settings = $.extend({}, this.options);
609
+ } else {
610
+ $.each(overwrites, function(breakpoint) {
611
+ if (breakpoint <= viewport && breakpoint > match) {
612
+ match = Number(breakpoint);
613
+ }
614
+ });
615
+
616
+ settings = $.extend({}, this.options, overwrites[match]);
617
+ if (typeof settings.stagePadding === 'function') {
618
+ settings.stagePadding = settings.stagePadding();
619
+ }
620
+ delete settings.responsive;
621
+
622
+ // responsive class
623
+ if (settings.responsiveClass) {
624
+ this.$element.attr('class',
625
+ this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match)
626
+ );
627
+ }
628
+ }
629
+
630
+ this.trigger('change', { property: { name: 'settings', value: settings } });
631
+ this._breakpoint = match;
632
+ this.settings = settings;
633
+ this.invalidate('settings');
634
+ this.trigger('changed', { property: { name: 'settings', value: this.settings } });
635
+ };
636
+
637
+ /**
638
+ * Updates option logic if necessery.
639
+ * @protected
640
+ */
641
+ Owl.prototype.optionsLogic = function() {
642
+ if (this.settings.autoWidth) {
643
+ this.settings.stagePadding = false;
644
+ this.settings.merge = false;
645
+ }
646
+ };
647
+
648
+ /**
649
+ * Prepares an item before add.
650
+ * @todo Rename event parameter `content` to `item`.
651
+ * @protected
652
+ * @returns {jQuery|HTMLElement} - The item container.
653
+ */
654
+ Owl.prototype.prepare = function(item) {
655
+ var event = this.trigger('prepare', { content: item });
656
+
657
+ if (!event.data) {
658
+ event.data = $('<' + this.settings.itemElement + '/>')
659
+ .addClass(this.options.itemClass).append(item)
660
+ }
661
+
662
+ this.trigger('prepared', { content: event.data });
663
+
664
+ return event.data;
665
+ };
666
+
667
+ /**
668
+ * Updates the view.
669
+ * @public
670
+ */
671
+ Owl.prototype.update = function() {
672
+ var i = 0,
673
+ n = this._pipe.length,
674
+ filter = $.proxy(function(p) { return this[p] }, this._invalidated),
675
+ cache = {};
676
+
677
+ while (i < n) {
678
+ if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
679
+ this._pipe[i].run(cache);
680
+ }
681
+ i++;
682
+ }
683
+
684
+ this._invalidated = {};
685
+
686
+ !this.is('valid') && this.enter('valid');
687
+ };
688
+
689
+ /**
690
+ * Gets the width of the view.
691
+ * @public
692
+ * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
693
+ * @returns {Number} - The width of the view in pixel.
694
+ */
695
+ Owl.prototype.width = function(dimension) {
696
+ dimension = dimension || Owl.Width.Default;
697
+ switch (dimension) {
698
+ case Owl.Width.Inner:
699
+ case Owl.Width.Outer:
700
+ return this._width;
701
+ default:
702
+ return this._width - this.settings.stagePadding * 2 + this.settings.margin;
703
+ }
704
+ };
705
+
706
+ /**
707
+ * Refreshes the carousel primarily for adaptive purposes.
708
+ * @public
709
+ */
710
+ Owl.prototype.refresh = function() {
711
+ this.enter('refreshing');
712
+ this.trigger('refresh');
713
+
714
+ this.setup();
715
+
716
+ this.optionsLogic();
717
+
718
+ this.$element.addClass(this.options.refreshClass);
719
+
720
+ this.update();
721
+
722
+ this.$element.removeClass(this.options.refreshClass);
723
+
724
+ this.leave('refreshing');
725
+ this.trigger('refreshed');
726
+ };
727
+
728
+ /**
729
+ * Checks window `resize` event.
730
+ * @protected
731
+ */
732
+ Owl.prototype.onThrottledResize = function() {
733
+ window.clearTimeout(this.resizeTimer);
734
+ this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate);
735
+ };
736
+
737
+ /**
738
+ * Checks window `resize` event.
739
+ * @protected
740
+ */
741
+ Owl.prototype.onResize = function() {
742
+ if (!this._items.length) {
743
+ return false;
744
+ }
745
+
746
+ if (this._width === this.$element.width()) {
747
+ return false;
748
+ }
749
+
750
+ if (!this.isVisible()) {
751
+ return false;
752
+ }
753
+
754
+ this.enter('resizing');
755
+
756
+ if (this.trigger('resize').isDefaultPrevented()) {
757
+ this.leave('resizing');
758
+ return false;
759
+ }
760
+
761
+ this.invalidate('width');
762
+
763
+ this.refresh();
764
+
765
+ this.leave('resizing');
766
+ this.trigger('resized');
767
+ };
768
+
769
+ /**
770
+ * Registers event handlers.
771
+ * @todo Check `msPointerEnabled`
772
+ * @todo #261
773
+ * @protected
774
+ */
775
+ Owl.prototype.registerEventHandlers = function() {
776
+ if ($.support.transition) {
777
+ this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
778
+ }
779
+
780
+ if (this.settings.responsive !== false) {
781
+ this.on(window, 'resize', this._handlers.onThrottledResize);
782
+ }
783
+
784
+ if (this.settings.mouseDrag) {
785
+ this.$element.addClass(this.options.dragClass);
786
+ this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this));
787
+ this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false });
788
+ }
789
+
790
+ if (this.settings.touchDrag){
791
+ this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this));
792
+ this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this));
793
+ }
794
+ };
795
+
796
+ /**
797
+ * Handles `touchstart` and `mousedown` events.
798
+ * @todo Horizontal swipe threshold as option
799
+ * @todo #261
800
+ * @protected
801
+ * @param {Event} event - The event arguments.
802
+ */
803
+ Owl.prototype.onDragStart = function(event) {
804
+ var stage = null;
805
+
806
+ if (event.which === 3) {
807
+ return;
808
+ }
809
+
810
+ if ($.support.transform) {
811
+ stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(',');
812
+ stage = {
813
+ x: stage[stage.length === 16 ? 12 : 4],
814
+ y: stage[stage.length === 16 ? 13 : 5]
815
+ };
816
+ } else {
817
+ stage = this.$stage.position();
818
+ stage = {
819
+ x: this.settings.rtl ?
820
+ stage.left + this.$stage.width() - this.width() + this.settings.margin :
821
+ stage.left,
822
+ y: stage.top
823
+ };
824
+ }
825
+
826
+ if (this.is('animating')) {
827
+ $.support.transform ? this.animate(stage.x) : this.$stage.stop()
828
+ this.invalidate('position');
829
+ }
830
+
831
+ this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown');
832
+
833
+ this.speed(0);
834
+
835
+ this._drag.time = new Date().getTime();
836
+ this._drag.target = $(event.target);
837
+ this._drag.stage.start = stage;
838
+ this._drag.stage.current = stage;
839
+ this._drag.pointer = this.pointer(event);
840
+
841
+ $(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this));
842
+
843
+ $(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) {
844
+ var delta = this.difference(this._drag.pointer, this.pointer(event));
845
+
846
+ $(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this));
847
+
848
+ if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) {
849
+ return;
850
+ }
851
+
852
+ event.preventDefault();
853
+
854
+ this.enter('dragging');
855
+ this.trigger('drag');
856
+ }, this));
857
+ };
858
+
859
+ /**
860
+ * Handles the `touchmove` and `mousemove` events.
861
+ * @todo #261
862
+ * @protected
863
+ * @param {Event} event - The event arguments.
864
+ */
865
+ Owl.prototype.onDragMove = function(event) {
866
+ var minimum = null,
867
+ maximum = null,
868
+ pull = null,
869
+ delta = this.difference(this._drag.pointer, this.pointer(event)),
870
+ stage = this.difference(this._drag.stage.start, delta);
871
+
872
+ if (!this.is('dragging')) {
873
+ return;
874
+ }
875
+
876
+ event.preventDefault();
877
+
878
+ if (this.settings.loop) {
879
+ minimum = this.coordinates(this.minimum());
880
+ maximum = this.coordinates(this.maximum() + 1) - minimum;
881
+ stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum;
882
+ } else {
883
+ minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
884
+ maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
885
+ pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0;
886
+ stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull);
887
+ }
888
+
889
+ this._drag.stage.current = stage;
890
+
891
+ this.animate(stage.x);
892
+ };
893
+
894
+ /**
895
+ * Handles the `touchend` and `mouseup` events.
896
+ * @todo #261
897
+ * @todo Threshold for click event
898
+ * @protected
899
+ * @param {Event} event - The event arguments.
900
+ */
901
+ Owl.prototype.onDragEnd = function(event) {
902
+ var delta = this.difference(this._drag.pointer, this.pointer(event)),
903
+ stage = this._drag.stage.current,
904
+ direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right';
905
+
906
+ $(document).off('.owl.core');
907
+
908
+ this.$element.removeClass(this.options.grabClass);
909
+
910
+ if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) {
911
+ this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
912
+ this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction));
913
+ this.invalidate('position');
914
+ this.update();
915
+
916
+ this._drag.direction = direction;
917
+
918
+ if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) {
919
+ this._drag.target.one('click.owl.core', function() { return false; });
920
+ }
921
+ }
922
+
923
+ if (!this.is('dragging')) {
924
+ return;
925
+ }
926
+
927
+ this.leave('dragging');
928
+ this.trigger('dragged');
929
+ };
930
+
931
+ /**
932
+ * Gets absolute position of the closest item for a coordinate.
933
+ * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
934
+ * @protected
935
+ * @param {Number} coordinate - The coordinate in pixel.
936
+ * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`.
937
+ * @return {Number} - The absolute position of the closest item.
938
+ */
939
+ Owl.prototype.closest = function(coordinate, direction) {
940
+ var position = -1,
941
+ pull = 30,
942
+ width = this.width(),
943
+ coordinates = this.coordinates();
944
+
945
+ if (!this.settings.freeDrag) {
946
+ // check closest item
947
+ $.each(coordinates, $.proxy(function(index, value) {
948
+ // on a left pull, check on current index
949
+ if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) {
950
+ position = index;
951
+ // on a right pull, check on previous index
952
+ // to do so, subtract width from value and set position = index + 1
953
+ } else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) {
954
+ position = index + 1;
955
+ } else if (this.op(coordinate, '<', value)
956
+ && this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) {
957
+ position = direction === 'left' ? index + 1 : index;
958
+ }
959
+ return position === -1;
960
+ }, this));
961
+ }
962
+
963
+ if (!this.settings.loop) {
964
+ // non loop boundries
965
+ if (this.op(coordinate, '>', coordinates[this.minimum()])) {
966
+ position = coordinate = this.minimum();
967
+ } else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
968
+ position = coordinate = this.maximum();
969
+ }
970
+ }
971
+
972
+ return position;
973
+ };
974
+
975
+ /**
976
+ * Animates the stage.
977
+ * @todo #270
978
+ * @public
979
+ * @param {Number} coordinate - The coordinate in pixels.
980
+ */
981
+ Owl.prototype.animate = function(coordinate) {
982
+ var animate = this.speed() > 0;
983
+
984
+ this.is('animating') && this.onTransitionEnd();
985
+
986
+ if (animate) {
987
+ this.enter('animating');
988
+ this.trigger('translate');
989
+ }
990
+
991
+ if ($.support.transform3d && $.support.transition) {
992
+ this.$stage.css({
993
+ transform: 'translate3d(' + (coordinate-1) + 'px,0px,0px)', // this line is modified (added '-1') in order to fix "one pixel problem"
994
+ transition: (this.speed() / 1000) + 's' + (
995
+ this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
996
+ )
997
+ });
998
+ } else if (animate) {
999
+ this.$stage.animate({
1000
+ left: coordinate + 'px'
1001
+ }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
1002
+ } else {
1003
+ this.$stage.css({
1004
+ left: coordinate + 'px'
1005
+ });
1006
+ }
1007
+ };
1008
+
1009
+ /**
1010
+ * Checks whether the carousel is in a specific state or not.
1011
+ * @param {String} state - The state to check.
1012
+ * @returns {Boolean} - The flag which indicates if the carousel is busy.
1013
+ */
1014
+ Owl.prototype.is = function(state) {
1015
+ return this._states.current[state] && this._states.current[state] > 0;
1016
+ };
1017
+
1018
+ /**
1019
+ * Sets the absolute position of the current item.
1020
+ * @public
1021
+ * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
1022
+ * @returns {Number} - The absolute position of the current item.
1023
+ */
1024
+ Owl.prototype.current = function(position) {
1025
+ if (position === undefined) {
1026
+ return this._current;
1027
+ }
1028
+
1029
+ if (this._items.length === 0) {
1030
+ return undefined;
1031
+ }
1032
+
1033
+ position = this.normalize(position);
1034
+
1035
+ if (this._current !== position) {
1036
+ var event = this.trigger('change', { property: { name: 'position', value: position } });
1037
+
1038
+ if (event.data !== undefined) {
1039
+ position = this.normalize(event.data);
1040
+ }
1041
+
1042
+ this._current = position;
1043
+
1044
+ this.invalidate('position');
1045
+
1046
+ this.trigger('changed', { property: { name: 'position', value: this._current } });
1047
+ }
1048
+
1049
+ return this._current;
1050
+ };
1051
+
1052
+ /**
1053
+ * Invalidates the given part of the update routine.
1054
+ * @param {String} [part] - The part to invalidate.
1055
+ * @returns {Array.<String>} - The invalidated parts.
1056
+ */
1057
+ Owl.prototype.invalidate = function(part) {
1058
+ if ($.type(part) === 'string') {
1059
+ this._invalidated[part] = true;
1060
+ this.is('valid') && this.leave('valid');
1061
+ }
1062
+ return $.map(this._invalidated, function(v, i) { return i });
1063
+ };
1064
+
1065
+ /**
1066
+ * Resets the absolute position of the current item.
1067
+ * @public
1068
+ * @param {Number} position - The absolute position of the new item.
1069
+ */
1070
+ Owl.prototype.reset = function(position) {
1071
+ position = this.normalize(position);
1072
+
1073
+ if (position === undefined) {
1074
+ return;
1075
+ }
1076
+
1077
+ this._speed = 0;
1078
+ this._current = position;
1079
+
1080
+ this.suppress([ 'translate', 'translated' ]);
1081
+
1082
+ this.animate(this.coordinates(position));
1083
+
1084
+ this.release([ 'translate', 'translated' ]);
1085
+ };
1086
+
1087
+ /**
1088
+ * Normalizes an absolute or a relative position of an item.
1089
+ * @public
1090
+ * @param {Number} position - The absolute or relative position to normalize.
1091
+ * @param {Boolean} [relative=false] - Whether the given position is relative or not.
1092
+ * @returns {Number} - The normalized position.
1093
+ */
1094
+ Owl.prototype.normalize = function(position, relative) {
1095
+ var n = this._items.length,
1096
+ m = relative ? 0 : this._clones.length;
1097
+
1098
+ if (!this.isNumeric(position) || n < 1) {
1099
+ position = undefined;
1100
+ } else if (position < 0 || position >= n + m) {
1101
+ position = ((position - m / 2) % n + n) % n + m / 2;
1102
+ }
1103
+
1104
+ return position;
1105
+ };
1106
+
1107
+ /**
1108
+ * Converts an absolute position of an item into a relative one.
1109
+ * @public
1110
+ * @param {Number} position - The absolute position to convert.
1111
+ * @returns {Number} - The converted position.
1112
+ */
1113
+ Owl.prototype.relative = function(position) {
1114
+ position -= this._clones.length / 2;
1115
+ return this.normalize(position, true);
1116
+ };
1117
+
1118
+ /**
1119
+ * Gets the maximum position for the current item.
1120
+ * @public
1121
+ * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1122
+ * @returns {Number}
1123
+ */
1124
+ Owl.prototype.maximum = function(relative) {
1125
+ var settings = this.settings,
1126
+ maximum = this._coordinates.length,
1127
+ iterator,
1128
+ reciprocalItemsWidth,
1129
+ elementWidth;
1130
+
1131
+ if (settings.loop) {
1132
+ maximum = this._clones.length / 2 + this._items.length - 1;
1133
+ } else if (settings.autoWidth || settings.merge) {
1134
+ iterator = this._items.length;
1135
+ if (iterator) {
1136
+ reciprocalItemsWidth = this._items[--iterator].width();
1137
+ elementWidth = this.$element.width();
1138
+ while (iterator--) {
1139
+ reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin;
1140
+ if (reciprocalItemsWidth > elementWidth) {
1141
+ break;
1142
+ }
1143
+ }
1144
+ }
1145
+ maximum = iterator + 1;
1146
+ } else if (settings.center) {
1147
+ maximum = this._items.length - 1;
1148
+ } else {
1149
+ maximum = this._items.length - settings.items;
1150
+ }
1151
+
1152
+ if (relative) {
1153
+ maximum -= this._clones.length / 2;
1154
+ }
1155
+
1156
+ return Math.max(maximum, 0);
1157
+ };
1158
+
1159
+ /**
1160
+ * Gets the minimum position for the current item.
1161
+ * @public
1162
+ * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1163
+ * @returns {Number}
1164
+ */
1165
+ Owl.prototype.minimum = function(relative) {
1166
+ return relative ? 0 : this._clones.length / 2;
1167
+ };
1168
+
1169
+ /**
1170
+ * Gets an item at the specified relative position.
1171
+ * @public
1172
+ * @param {Number} [position] - The relative position of the item.
1173
+ * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1174
+ */
1175
+ Owl.prototype.items = function(position) {
1176
+ if (position === undefined) {
1177
+ return this._items.slice();
1178
+ }
1179
+
1180
+ position = this.normalize(position, true);
1181
+ return this._items[position];
1182
+ };
1183
+
1184
+ /**
1185
+ * Gets an item at the specified relative position.
1186
+ * @public
1187
+ * @param {Number} [position] - The relative position of the item.
1188
+ * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1189
+ */
1190
+ Owl.prototype.mergers = function(position) {
1191
+ if (position === undefined) {
1192
+ return this._mergers.slice();
1193
+ }
1194
+
1195
+ position = this.normalize(position, true);
1196
+ return this._mergers[position];
1197
+ };
1198
+
1199
+ /**
1200
+ * Gets the absolute positions of clones for an item.
1201
+ * @public
1202
+ * @param {Number} [position] - The relative position of the item.
1203
+ * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
1204
+ */
1205
+ Owl.prototype.clones = function(position) {
1206
+ var odd = this._clones.length / 2,
1207
+ even = odd + this._items.length,
1208
+ map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
1209
+
1210
+ if (position === undefined) {
1211
+ return $.map(this._clones, function(v, i) { return map(i) });
1212
+ }
1213
+
1214
+ return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
1215
+ };
1216
+
1217
+ /**
1218
+ * Sets the current animation speed.
1219
+ * @public
1220
+ * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
1221
+ * @returns {Number} - The current animation speed in milliseconds.
1222
+ */
1223
+ Owl.prototype.speed = function(speed) {
1224
+ if (speed !== undefined) {
1225
+ this._speed = speed;
1226
+ }
1227
+
1228
+ return this._speed;
1229
+ };
1230
+
1231
+ /**
1232
+ * Gets the coordinate of an item.
1233
+ * @todo The name of this method is missleanding.
1234
+ * @public
1235
+ * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
1236
+ * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
1237
+ */
1238
+ Owl.prototype.coordinates = function(position) {
1239
+ var multiplier = 1,
1240
+ newPosition = position - 1,
1241
+ coordinate;
1242
+
1243
+ if (position === undefined) {
1244
+ return $.map(this._coordinates, $.proxy(function(coordinate, index) {
1245
+ return this.coordinates(index);
1246
+ }, this));
1247
+ }
1248
+
1249
+ if (this.settings.center) {
1250
+ if (this.settings.rtl) {
1251
+ multiplier = -1;
1252
+ newPosition = position + 1;
1253
+ }
1254
+
1255
+ coordinate = this._coordinates[position];
1256
+ coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier;
1257
+ } else {
1258
+ coordinate = this._coordinates[newPosition] || 0;
1259
+ }
1260
+
1261
+ coordinate = Math.ceil(coordinate);
1262
+
1263
+ return coordinate;
1264
+ };
1265
+
1266
+ /**
1267
+ * Calculates the speed for a translation.
1268
+ * @protected
1269
+ * @param {Number} from - The absolute position of the start item.
1270
+ * @param {Number} to - The absolute position of the target item.
1271
+ * @param {Number} [factor=undefined] - The time factor in milliseconds.
1272
+ * @returns {Number} - The time in milliseconds for the translation.
1273
+ */
1274
+ Owl.prototype.duration = function(from, to, factor) {
1275
+ if (factor === 0) {
1276
+ return 0;
1277
+ }
1278
+
1279
+ return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
1280
+ };
1281
+
1282
+ /**
1283
+ * Slides to the specified item.
1284
+ * @public
1285
+ * @param {Number} position - The position of the item.
1286
+ * @param {Number} [speed] - The time in milliseconds for the transition.
1287
+ */
1288
+ Owl.prototype.to = function(position, speed) {
1289
+ var current = this.current(),
1290
+ revert = null,
1291
+ distance = position - this.relative(current),
1292
+ direction = (distance > 0) - (distance < 0),
1293
+ items = this._items.length,
1294
+ minimum = this.minimum(),
1295
+ maximum = this.maximum();
1296
+
1297
+ if (this.settings.loop) {
1298
+ if (!this.settings.rewind && Math.abs(distance) > items / 2) {
1299
+ distance += direction * -1 * items;
1300
+ }
1301
+
1302
+ position = current + distance;
1303
+ revert = ((position - minimum) % items + items) % items + minimum;
1304
+
1305
+ if (revert !== position && revert - distance <= maximum && revert - distance > 0) {
1306
+ current = revert - distance;
1307
+ position = revert;
1308
+ this.reset(current);
1309
+ }
1310
+ } else if (this.settings.rewind) {
1311
+ maximum += 1;
1312
+ position = (position % maximum + maximum) % maximum;
1313
+ } else {
1314
+ position = Math.max(minimum, Math.min(maximum, position));
1315
+ }
1316
+
1317
+ this.speed(this.duration(current, position, speed));
1318
+ this.current(position);
1319
+
1320
+ if (this.isVisible()) {
1321
+ this.update();
1322
+ }
1323
+ };
1324
+
1325
+ /**
1326
+ * Slides to the next item.
1327
+ * @public
1328
+ * @param {Number} [speed] - The time in milliseconds for the transition.
1329
+ */
1330
+ Owl.prototype.next = function(speed) {
1331
+ speed = speed || false;
1332
+ this.to(this.relative(this.current()) + 1, speed);
1333
+ };
1334
+
1335
+ /**
1336
+ * Slides to the previous item.
1337
+ * @public
1338
+ * @param {Number} [speed] - The time in milliseconds for the transition.
1339
+ */
1340
+ Owl.prototype.prev = function(speed) {
1341
+ speed = speed || false;
1342
+ this.to(this.relative(this.current()) - 1, speed);
1343
+ };
1344
+
1345
+ /**
1346
+ * Handles the end of an animation.
1347
+ * @protected
1348
+ * @param {Event} event - The event arguments.
1349
+ */
1350
+ Owl.prototype.onTransitionEnd = function(event) {
1351
+
1352
+ // if css2 animation then event object is undefined
1353
+ if (event !== undefined) {
1354
+ event.stopPropagation();
1355
+
1356
+ // Catch only owl-stage transitionEnd event
1357
+ if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
1358
+ return false;
1359
+ }
1360
+ }
1361
+
1362
+ this.leave('animating');
1363
+ this.trigger('translated');
1364
+ };
1365
+
1366
+ /**
1367
+ * Gets viewport width.
1368
+ * @protected
1369
+ * @return {Number} - The width in pixel.
1370
+ */
1371
+ Owl.prototype.viewport = function() {
1372
+ var width;
1373
+ if (this.options.responsiveBaseElement !== window) {
1374
+ width = $(this.options.responsiveBaseElement).width();
1375
+ } else if (window.innerWidth) {
1376
+ width = window.innerWidth;
1377
+ } else if (document.documentElement && document.documentElement.clientWidth) {
1378
+ width = document.documentElement.clientWidth;
1379
+ } else {
1380
+ console.warn('Can not detect viewport width.');
1381
+ }
1382
+ return width;
1383
+ };
1384
+
1385
+ /**
1386
+ * Replaces the current content.
1387
+ * @public
1388
+ * @param {HTMLElement|jQuery|String} content - The new content.
1389
+ */
1390
+ Owl.prototype.replace = function(content) {
1391
+ this.$stage.empty();
1392
+ this._items = [];
1393
+
1394
+ if (content) {
1395
+ content = (content instanceof jQuery) ? content : $(content);
1396
+ }
1397
+
1398
+ if (this.settings.nestedItemSelector) {
1399
+ content = content.find('.' + this.settings.nestedItemSelector);
1400
+ }
1401
+
1402
+ content.filter(function() {
1403
+ return this.nodeType === 1;
1404
+ }).each($.proxy(function(index, item) {
1405
+ item = this.prepare(item);
1406
+ this.$stage.append(item);
1407
+ this._items.push(item);
1408
+ this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1409
+ }, this));
1410
+
1411
+ this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
1412
+
1413
+ this.invalidate('items');
1414
+ };
1415
+
1416
+ /**
1417
+ * Adds an item.
1418
+ * @todo Use `item` instead of `content` for the event arguments.
1419
+ * @public
1420
+ * @param {HTMLElement|jQuery|String} content - The item content to add.
1421
+ * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
1422
+ */
1423
+ Owl.prototype.add = function(content, position) {
1424
+ var current = this.relative(this._current);
1425
+
1426
+ position = position === undefined ? this._items.length : this.normalize(position, true);
1427
+ content = content instanceof jQuery ? content : $(content);
1428
+
1429
+ this.trigger('add', { content: content, position: position });
1430
+
1431
+ content = this.prepare(content);
1432
+
1433
+ if (this._items.length === 0 || position === this._items.length) {
1434
+ this._items.length === 0 && this.$stage.append(content);
1435
+ this._items.length !== 0 && this._items[position - 1].after(content);
1436
+ this._items.push(content);
1437
+ this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1438
+ } else {
1439
+ this._items[position].before(content);
1440
+ this._items.splice(position, 0, content);
1441
+ this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
1442
+ }
1443
+
1444
+ this._items[current] && this.reset(this._items[current].index());
1445
+
1446
+ this.invalidate('items');
1447
+
1448
+ this.trigger('added', { content: content, position: position });
1449
+ };
1450
+
1451
+ /**
1452
+ * Removes an item by its position.
1453
+ * @todo Use `item` instead of `content` for the event arguments.
1454
+ * @public
1455
+ * @param {Number} position - The relative position of the item to remove.
1456
+ */
1457
+ Owl.prototype.remove = function(position) {
1458
+ position = this.normalize(position, true);
1459
+
1460
+ if (position === undefined) {
1461
+ return;
1462
+ }
1463
+
1464
+ this.trigger('remove', { content: this._items[position], position: position });
1465
+
1466
+ this._items[position].remove();
1467
+ this._items.splice(position, 1);
1468
+ this._mergers.splice(position, 1);
1469
+
1470
+ this.invalidate('items');
1471
+
1472
+ this.trigger('removed', { content: null, position: position });
1473
+ };
1474
+
1475
+ /**
1476
+ * Preloads images with auto width.
1477
+ * @todo Replace by a more generic approach
1478
+ * @protected
1479
+ */
1480
+ Owl.prototype.preloadAutoWidthImages = function(images) {
1481
+ images.each($.proxy(function(i, element) {
1482
+ this.enter('pre-loading');
1483
+ element = $(element);
1484
+ $(new Image()).one('load', $.proxy(function(e) {
1485
+ element.attr('src', e.target.src);
1486
+ element.css('opacity', 1);
1487
+ this.leave('pre-loading');
1488
+ !this.is('pre-loading') && !this.is('initializing') && this.refresh();
1489
+ }, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina'));
1490
+ }, this));
1491
+ };
1492
+
1493
+ /**
1494
+ * Destroys the carousel.
1495
+ * @public
1496
+ */
1497
+ Owl.prototype.destroy = function() {
1498
+
1499
+ this.$element.off('.owl.core');
1500
+ this.$stage.off('.owl.core');
1501
+ $(document).off('.owl.core');
1502
+
1503
+ if (this.settings.responsive !== false) {
1504
+ window.clearTimeout(this.resizeTimer);
1505
+ this.off(window, 'resize', this._handlers.onThrottledResize);
1506
+ }
1507
+
1508
+ for (var i in this._plugins) {
1509
+ this._plugins[i].destroy();
1510
+ }
1511
+
1512
+ this.$stage.children('.cloned').remove();
1513
+
1514
+ this.$stage.unwrap();
1515
+ this.$stage.children().contents().unwrap();
1516
+ this.$stage.children().unwrap();
1517
+ this.$stage.remove();
1518
+ this.$element
1519
+ .removeClass(this.options.refreshClass)
1520
+ .removeClass(this.options.loadingClass)
1521
+ .removeClass(this.options.loadedClass)
1522
+ .removeClass(this.options.rtlClass)
1523
+ .removeClass(this.options.dragClass)
1524
+ .removeClass(this.options.grabClass)
1525
+ .attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), ''))
1526
+ .removeData('owl.carousel');
1527
+ };
1528
+
1529
+ /**
1530
+ * Operators to calculate right-to-left and left-to-right.
1531
+ * @protected
1532
+ * @param {Number} [a] - The left side operand.
1533
+ * @param {String} [o] - The operator.
1534
+ * @param {Number} [b] - The right side operand.
1535
+ */
1536
+ Owl.prototype.op = function(a, o, b) {
1537
+ var rtl = this.settings.rtl;
1538
+ switch (o) {
1539
+ case '<':
1540
+ return rtl ? a > b : a < b;
1541
+ case '>':
1542
+ return rtl ? a < b : a > b;
1543
+ case '>=':
1544
+ return rtl ? a <= b : a >= b;
1545
+ case '<=':
1546
+ return rtl ? a >= b : a <= b;
1547
+ default:
1548
+ break;
1549
+ }
1550
+ };
1551
+
1552
+ /**
1553
+ * Attaches to an internal event.
1554
+ * @protected
1555
+ * @param {HTMLElement} element - The event source.
1556
+ * @param {String} event - The event name.
1557
+ * @param {Function} listener - The event handler to attach.
1558
+ * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
1559
+ */
1560
+ Owl.prototype.on = function(element, event, listener, capture) {
1561
+ if (element.addEventListener) {
1562
+ element.addEventListener(event, listener, capture);
1563
+ } else if (element.attachEvent) {
1564
+ element.attachEvent('on' + event, listener);
1565
+ }
1566
+ };
1567
+
1568
+ /**
1569
+ * Detaches from an internal event.
1570
+ * @protected
1571
+ * @param {HTMLElement} element - The event source.
1572
+ * @param {String} event - The event name.
1573
+ * @param {Function} listener - The attached event handler to detach.
1574
+ * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
1575
+ */
1576
+ Owl.prototype.off = function(element, event, listener, capture) {
1577
+ if (element.removeEventListener) {
1578
+ element.removeEventListener(event, listener, capture);
1579
+ } else if (element.detachEvent) {
1580
+ element.detachEvent('on' + event, listener);
1581
+ }
1582
+ };
1583
+
1584
+ /**
1585
+ * Triggers a public event.
1586
+ * @todo Remove `status`, `relatedTarget` should be used instead.
1587
+ * @protected
1588
+ * @param {String} name - The event name.
1589
+ * @param {*} [data=null] - The event data.
1590
+ * @param {String} [namespace=carousel] - The event namespace.
1591
+ * @param {String} [state] - The state which is associated with the event.
1592
+ * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not.
1593
+ * @returns {Event} - The event arguments.
1594
+ */
1595
+ Owl.prototype.trigger = function(name, data, namespace, state, enter) {
1596
+ var status = {
1597
+ item: { count: this._items.length, index: this.current() }
1598
+ }, handler = $.camelCase(
1599
+ $.grep([ 'on', name, namespace ], function(v) { return v })
1600
+ .join('-').toLowerCase()
1601
+ ), event = $.Event(
1602
+ [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
1603
+ $.extend({ relatedTarget: this }, status, data)
1604
+ );
1605
+
1606
+ if (!this._supress[name]) {
1607
+ $.each(this._plugins, function(name, plugin) {
1608
+ if (plugin.onTrigger) {
1609
+ plugin.onTrigger(event);
1610
+ }
1611
+ });
1612
+
1613
+ this.register({ type: Owl.Type.Event, name: name });
1614
+ this.$element.trigger(event);
1615
+
1616
+ if (this.settings && typeof this.settings[handler] === 'function') {
1617
+ this.settings[handler].call(this, event);
1618
+ }
1619
+ }
1620
+
1621
+ return event;
1622
+ };
1623
+
1624
+ /**
1625
+ * Enters a state.
1626
+ * @param name - The state name.
1627
+ */
1628
+ Owl.prototype.enter = function(name) {
1629
+ $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
1630
+ if (this._states.current[name] === undefined) {
1631
+ this._states.current[name] = 0;
1632
+ }
1633
+
1634
+ this._states.current[name]++;
1635
+ }, this));
1636
+ };
1637
+
1638
+ /**
1639
+ * Leaves a state.
1640
+ * @param name - The state name.
1641
+ */
1642
+ Owl.prototype.leave = function(name) {
1643
+ $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
1644
+ this._states.current[name]--;
1645
+ }, this));
1646
+ };
1647
+
1648
+ /**
1649
+ * Registers an event or state.
1650
+ * @public
1651
+ * @param {Object} object - The event or state to register.
1652
+ */
1653
+ Owl.prototype.register = function(object) {
1654
+ if (object.type === Owl.Type.Event) {
1655
+ if (!$.event.special[object.name]) {
1656
+ $.event.special[object.name] = {};
1657
+ }
1658
+
1659
+ if (!$.event.special[object.name].owl) {
1660
+ var _default = $.event.special[object.name]._default;
1661
+ $.event.special[object.name]._default = function(e) {
1662
+ if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) {
1663
+ return _default.apply(this, arguments);
1664
+ }
1665
+ return e.namespace && e.namespace.indexOf('owl') > -1;
1666
+ };
1667
+ $.event.special[object.name].owl = true;
1668
+ }
1669
+ } else if (object.type === Owl.Type.State) {
1670
+ if (!this._states.tags[object.name]) {
1671
+ this._states.tags[object.name] = object.tags;
1672
+ } else {
1673
+ this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags);
1674
+ }
1675
+
1676
+ this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) {
1677
+ return $.inArray(tag, this._states.tags[object.name]) === i;
1678
+ }, this));
1679
+ }
1680
+ };
1681
+
1682
+ /**
1683
+ * Suppresses events.
1684
+ * @protected
1685
+ * @param {Array.<String>} events - The events to suppress.
1686
+ */
1687
+ Owl.prototype.suppress = function(events) {
1688
+ $.each(events, $.proxy(function(index, event) {
1689
+ this._supress[event] = true;
1690
+ }, this));
1691
+ };
1692
+
1693
+ /**
1694
+ * Releases suppressed events.
1695
+ * @protected
1696
+ * @param {Array.<String>} events - The events to release.
1697
+ */
1698
+ Owl.prototype.release = function(events) {
1699
+ $.each(events, $.proxy(function(index, event) {
1700
+ delete this._supress[event];
1701
+ }, this));
1702
+ };
1703
+
1704
+ /**
1705
+ * Gets unified pointer coordinates from event.
1706
+ * @todo #261
1707
+ * @protected
1708
+ * @param {Event} - The `mousedown` or `touchstart` event.
1709
+ * @returns {Object} - Contains `x` and `y` coordinates of current pointer position.
1710
+ */
1711
+ Owl.prototype.pointer = function(event) {
1712
+ var result = { x: null, y: null };
1713
+
1714
+ event = event.originalEvent || event || window.event;
1715
+
1716
+ event = event.touches && event.touches.length ?
1717
+ event.touches[0] : event.changedTouches && event.changedTouches.length ?
1718
+ event.changedTouches[0] : event;
1719
+
1720
+ if (event.pageX) {
1721
+ result.x = event.pageX;
1722
+ result.y = event.pageY;
1723
+ } else {
1724
+ result.x = event.clientX;
1725
+ result.y = event.clientY;
1726
+ }
1727
+
1728
+ return result;
1729
+ };
1730
+
1731
+ /**
1732
+ * Determines if the input is a Number or something that can be coerced to a Number
1733
+ * @protected
1734
+ * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested
1735
+ * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number
1736
+ */
1737
+ Owl.prototype.isNumeric = function(number) {
1738
+ return !isNaN(parseFloat(number));
1739
+ };
1740
+
1741
+ /**
1742
+ * Gets the difference of two vectors.
1743
+ * @todo #261
1744
+ * @protected
1745
+ * @param {Object} - The first vector.
1746
+ * @param {Object} - The second vector.
1747
+ * @returns {Object} - The difference.
1748
+ */
1749
+ Owl.prototype.difference = function(first, second) {
1750
+ return {
1751
+ x: first.x - second.x,
1752
+ y: first.y - second.y
1753
+ };
1754
+ };
1755
+
1756
+ /**
1757
+ * The jQuery Plugin for the Owl Carousel
1758
+ * @todo Navigation plugin `next` and `prev`
1759
+ * @public
1760
+ */
1761
+ $.fn.owlCarousel = function(option) {
1762
+ var args = Array.prototype.slice.call(arguments, 1);
1763
+
1764
+ return this.each(function() {
1765
+ var $this = $(this),
1766
+ data = $this.data('owl.carousel');
1767
+
1768
+ if (!data) {
1769
+ data = new Owl(this, typeof option == 'object' && option);
1770
+ $this.data('owl.carousel', data);
1771
+
1772
+ $.each([
1773
+ 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove'
1774
+ ], function(i, event) {
1775
+ data.register({ type: Owl.Type.Event, name: event });
1776
+ data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) {
1777
+ if (e.namespace && e.relatedTarget !== this) {
1778
+ this.suppress([ event ]);
1779
+ data[event].apply(this, [].slice.call(arguments, 1));
1780
+ this.release([ event ]);
1781
+ }
1782
+ }, data));
1783
+ });
1784
+ }
1785
+
1786
+ if (typeof option == 'string' && option.charAt(0) !== '_') {
1787
+ data[option].apply(data, args);
1788
+ }
1789
+ });
1790
+ };
1791
+
1792
+ /**
1793
+ * The constructor for the jQuery Plugin
1794
+ * @public
1795
+ */
1796
+ $.fn.owlCarousel.Constructor = Owl;
1797
+
1798
+ })(window.Zepto || window.jQuery, window, document);
1799
+
1800
+ /**
1801
+ * AutoRefresh Plugin
1802
+ * @version 2.3.4
1803
+ * @author Artus Kolanowski
1804
+ * @author David Deutsch
1805
+ * @license The MIT License (MIT)
1806
+ */
1807
+ ;(function($, window, document, undefined) {
1808
+
1809
+ /**
1810
+ * Creates the auto refresh plugin.
1811
+ * @class The Auto Refresh Plugin
1812
+ * @param {Owl} carousel - The Owl Carousel
1813
+ */
1814
+ var AutoRefresh = function(carousel) {
1815
+ /**
1816
+ * Reference to the core.
1817
+ * @protected
1818
+ * @type {Owl}
1819
+ */
1820
+ this._core = carousel;
1821
+
1822
+ /**
1823
+ * Refresh interval.
1824
+ * @protected
1825
+ * @type {number}
1826
+ */
1827
+ this._interval = null;
1828
+
1829
+ /**
1830
+ * Whether the element is currently visible or not.
1831
+ * @protected
1832
+ * @type {Boolean}
1833
+ */
1834
+ this._visible = null;
1835
+
1836
+ /**
1837
+ * All event handlers.
1838
+ * @protected
1839
+ * @type {Object}
1840
+ */
1841
+ this._handlers = {
1842
+ 'initialized.owl.carousel': $.proxy(function(e) {
1843
+ if (e.namespace && this._core.settings.autoRefresh) {
1844
+ this.watch();
1845
+ }
1846
+ }, this)
1847
+ };
1848
+
1849
+ // set default options
1850
+ this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options);
1851
+
1852
+ // register event handlers
1853
+ this._core.$element.on(this._handlers);
1854
+ };
1855
+
1856
+ /**
1857
+ * Default options.
1858
+ * @public
1859
+ */
1860
+ AutoRefresh.Defaults = {
1861
+ autoRefresh: true,
1862
+ autoRefreshInterval: 500
1863
+ };
1864
+
1865
+ /**
1866
+ * Watches the element.
1867
+ */
1868
+ AutoRefresh.prototype.watch = function() {
1869
+ if (this._interval) {
1870
+ return;
1871
+ }
1872
+
1873
+ this._visible = this._core.isVisible();
1874
+ this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval);
1875
+ };
1876
+
1877
+ /**
1878
+ * Refreshes the element.
1879
+ */
1880
+ AutoRefresh.prototype.refresh = function() {
1881
+ if (this._core.isVisible() === this._visible) {
1882
+ return;
1883
+ }
1884
+
1885
+ this._visible = !this._visible;
1886
+
1887
+ this._core.$element.toggleClass('owl-hidden', !this._visible);
1888
+
1889
+ this._visible && (this._core.invalidate('width') && this._core.refresh());
1890
+ };
1891
+
1892
+ /**
1893
+ * Destroys the plugin.
1894
+ */
1895
+ AutoRefresh.prototype.destroy = function() {
1896
+ var handler, property;
1897
+
1898
+ window.clearInterval(this._interval);
1899
+
1900
+ for (handler in this._handlers) {
1901
+ this._core.$element.off(handler, this._handlers[handler]);
1902
+ }
1903
+ for (property in Object.getOwnPropertyNames(this)) {
1904
+ typeof this[property] != 'function' && (this[property] = null);
1905
+ }
1906
+ };
1907
+
1908
+ $.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
1909
+
1910
+ })(window.Zepto || window.jQuery, window, document);
1911
+
1912
+ /**
1913
+ * Lazy Plugin
1914
+ * @version 2.3.4
1915
+ * @author Bartosz Wojciechowski
1916
+ * @author David Deutsch
1917
+ * @license The MIT License (MIT)
1918
+ */
1919
+ ;(function($, window, document, undefined) {
1920
+
1921
+ /**
1922
+ * Creates the lazy plugin.
1923
+ * @class The Lazy Plugin
1924
+ * @param {Owl} carousel - The Owl Carousel
1925
+ */
1926
+ var Lazy = function(carousel) {
1927
+
1928
+ /**
1929
+ * Reference to the core.
1930
+ * @protected
1931
+ * @type {Owl}
1932
+ */
1933
+ this._core = carousel;
1934
+
1935
+ /**
1936
+ * Already loaded items.
1937
+ * @protected
1938
+ * @type {Array.<jQuery>}
1939
+ */
1940
+ this._loaded = [];
1941
+
1942
+ /**
1943
+ * Event handlers.
1944
+ * @protected
1945
+ * @type {Object}
1946
+ */
1947
+ this._handlers = {
1948
+ 'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) {
1949
+ if (!e.namespace) {
1950
+ return;
1951
+ }
1952
+
1953
+ if (!this._core.settings || !this._core.settings.lazyLoad) {
1954
+ return;
1955
+ }
1956
+
1957
+ if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
1958
+ var settings = this._core.settings,
1959
+ n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
1960
+ i = ((settings.center && n * -1) || 0),
1961
+ position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i,
1962
+ clones = this._core.clones().length,
1963
+ load = $.proxy(function(i, v) { this.load(v) }, this);
1964
+ //TODO: Need documentation for this new option
1965
+ if (settings.lazyLoadEager > 0) {
1966
+ n += settings.lazyLoadEager;
1967
+ // If the carousel is looping also preload images that are to the "left"
1968
+ if (settings.loop) {
1969
+ position -= settings.lazyLoadEager;
1970
+ n++;
1971
+ }
1972
+ }
1973
+
1974
+ while (i++ < n) {
1975
+ this.load(clones / 2 + this._core.relative(position));
1976
+ clones && $.each(this._core.clones(this._core.relative(position)), load);
1977
+ position++;
1978
+ }
1979
+ }
1980
+ }, this)
1981
+ };
1982
+
1983
+ // set the default options
1984
+ this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
1985
+
1986
+ // register event handler
1987
+ this._core.$element.on(this._handlers);
1988
+ };
1989
+
1990
+ /**
1991
+ * Default options.
1992
+ * @public
1993
+ */
1994
+ Lazy.Defaults = {
1995
+ lazyLoad: false,
1996
+ lazyLoadEager: 0
1997
+ };
1998
+
1999
+ /**
2000
+ * Loads all resources of an item at the specified position.
2001
+ * @param {Number} position - The absolute position of the item.
2002
+ * @protected
2003
+ */
2004
+ Lazy.prototype.load = function(position) {
2005
+ var $item = this._core.$stage.children().eq(position),
2006
+ $elements = $item && $item.find('.owl-lazy');
2007
+
2008
+ if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
2009
+ return;
2010
+ }
2011
+
2012
+ $elements.each($.proxy(function(index, element) {
2013
+ var $element = $(element), image,
2014
+ url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset');
2015
+
2016
+ this._core.trigger('load', { element: $element, url: url }, 'lazy');
2017
+
2018
+ if ($element.is('img')) {
2019
+ $element.one('load.owl.lazy', $.proxy(function() {
2020
+ $element.css('opacity', 1);
2021
+ this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
2022
+ }, this)).attr('src', url);
2023
+ } else if ($element.is('source')) {
2024
+ $element.one('load.owl.lazy', $.proxy(function() {
2025
+ this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
2026
+ }, this)).attr('srcset', url);
2027
+ } else {
2028
+ image = new Image();
2029
+ image.onload = $.proxy(function() {
2030
+ $element.css({
2031
+ 'background-image': 'url("' + url + '")',
2032
+ 'opacity': '1'
2033
+ });
2034
+ this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
2035
+ }, this);
2036
+ image.src = url;
2037
+ }
2038
+ }, this));
2039
+
2040
+ this._loaded.push($item.get(0));
2041
+ };
2042
+
2043
+ /**
2044
+ * Destroys the plugin.
2045
+ * @public
2046
+ */
2047
+ Lazy.prototype.destroy = function() {
2048
+ var handler, property;
2049
+
2050
+ for (handler in this.handlers) {
2051
+ this._core.$element.off(handler, this.handlers[handler]);
2052
+ }
2053
+ for (property in Object.getOwnPropertyNames(this)) {
2054
+ typeof this[property] != 'function' && (this[property] = null);
2055
+ }
2056
+ };
2057
+
2058
+ $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
2059
+
2060
+ })(window.Zepto || window.jQuery, window, document);
2061
+
2062
+ /**
2063
+ * AutoHeight Plugin
2064
+ * @version 2.3.4
2065
+ * @author Bartosz Wojciechowski
2066
+ * @author David Deutsch
2067
+ * @license The MIT License (MIT)
2068
+ */
2069
+ ;(function($, window, document, undefined) {
2070
+
2071
+ /**
2072
+ * Creates the auto height plugin.
2073
+ * @class The Auto Height Plugin
2074
+ * @param {Owl} carousel - The Owl Carousel
2075
+ */
2076
+ var AutoHeight = function(carousel) {
2077
+ /**
2078
+ * Reference to the core.
2079
+ * @protected
2080
+ * @type {Owl}
2081
+ */
2082
+ this._core = carousel;
2083
+
2084
+ this._previousHeight = null;
2085
+
2086
+ /**
2087
+ * All event handlers.
2088
+ * @protected
2089
+ * @type {Object}
2090
+ */
2091
+ this._handlers = {
2092
+ 'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
2093
+ if (e.namespace && this._core.settings.autoHeight) {
2094
+ this.update();
2095
+ }
2096
+ }, this),
2097
+ 'changed.owl.carousel': $.proxy(function(e) {
2098
+ if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){
2099
+ this.update();
2100
+ }
2101
+ }, this),
2102
+ 'loaded.owl.lazy': $.proxy(function(e) {
2103
+ if (e.namespace && this._core.settings.autoHeight
2104
+ && e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
2105
+ this.update();
2106
+ }
2107
+ }, this)
2108
+ };
2109
+
2110
+ // set default options
2111
+ this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
2112
+
2113
+ // register event handlers
2114
+ this._core.$element.on(this._handlers);
2115
+ this._intervalId = null;
2116
+ var refThis = this;
2117
+
2118
+ // These changes have been taken from a PR by gavrochelegnou proposed in #1575
2119
+ // and have been made compatible with the latest jQuery version
2120
+ $(window).on('load', function() {
2121
+ if (refThis._core.settings.autoHeight) {
2122
+ refThis.update();
2123
+ }
2124
+ });
2125
+
2126
+ // Autoresize the height of the carousel when window is resized
2127
+ // When carousel has images, the height is dependent on the width
2128
+ // and should also change on resize
2129
+ $(window).resize(function() {
2130
+ if (refThis._core.settings.autoHeight) {
2131
+ if (refThis._intervalId != null) {
2132
+ clearTimeout(refThis._intervalId);
2133
+ }
2134
+
2135
+ refThis._intervalId = setTimeout(function() {
2136
+ refThis.update();
2137
+ }, 250);
2138
+ }
2139
+ });
2140
+
2141
+ };
2142
+
2143
+ /**
2144
+ * Default options.
2145
+ * @public
2146
+ */
2147
+ AutoHeight.Defaults = {
2148
+ autoHeight: false,
2149
+ autoHeightClass: 'owl-height'
2150
+ };
2151
+
2152
+ /**
2153
+ * Updates the view.
2154
+ */
2155
+ AutoHeight.prototype.update = function() {
2156
+ var start = this._core._current,
2157
+ end = start + this._core.settings.items,
2158
+ lazyLoadEnabled = this._core.settings.lazyLoad,
2159
+ visible = this._core.$stage.children().toArray().slice(start, end),
2160
+ heights = [],
2161
+ maxheight = 0;
2162
+
2163
+ $.each(visible, function(index, item) {
2164
+ heights.push($(item).height());
2165
+ });
2166
+
2167
+ maxheight = Math.max.apply(null, heights);
2168
+
2169
+ if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) {
2170
+ maxheight = this._previousHeight;
2171
+ }
2172
+
2173
+ this._previousHeight = maxheight;
2174
+
2175
+ this._core.$stage.parent()
2176
+ .height(maxheight)
2177
+ .addClass(this._core.settings.autoHeightClass);
2178
+ };
2179
+
2180
+ AutoHeight.prototype.destroy = function() {
2181
+ var handler, property;
2182
+
2183
+ for (handler in this._handlers) {
2184
+ this._core.$element.off(handler, this._handlers[handler]);
2185
+ }
2186
+ for (property in Object.getOwnPropertyNames(this)) {
2187
+ typeof this[property] !== 'function' && (this[property] = null);
2188
+ }
2189
+ };
2190
+
2191
+ $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
2192
+
2193
+ })(window.Zepto || window.jQuery, window, document);
2194
+
2195
+ /**
2196
+ * Video Plugin
2197
+ * @version 2.3.4
2198
+ * @author Bartosz Wojciechowski
2199
+ * @author David Deutsch
2200
+ * @license The MIT License (MIT)
2201
+ */
2202
+ ;(function($, window, document, undefined) {
2203
+
2204
+ /**
2205
+ * Creates the video plugin.
2206
+ * @class The Video Plugin
2207
+ * @param {Owl} carousel - The Owl Carousel
2208
+ */
2209
+ var Video = function(carousel) {
2210
+ /**
2211
+ * Reference to the core.
2212
+ * @protected
2213
+ * @type {Owl}
2214
+ */
2215
+ this._core = carousel;
2216
+
2217
+ /**
2218
+ * Cache all video URLs.
2219
+ * @protected
2220
+ * @type {Object}
2221
+ */
2222
+ this._videos = {};
2223
+
2224
+ /**
2225
+ * Current playing item.
2226
+ * @protected
2227
+ * @type {jQuery}
2228
+ */
2229
+ this._playing = null;
2230
+
2231
+ /**
2232
+ * All event handlers.
2233
+ * @todo The cloned content removale is too late
2234
+ * @protected
2235
+ * @type {Object}
2236
+ */
2237
+ this._handlers = {
2238
+ 'initialized.owl.carousel': $.proxy(function(e) {
2239
+ if (e.namespace) {
2240
+ this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
2241
+ }
2242
+ }, this),
2243
+ 'resize.owl.carousel': $.proxy(function(e) {
2244
+ if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
2245
+ e.preventDefault();
2246
+ }
2247
+ }, this),
2248
+ 'refreshed.owl.carousel': $.proxy(function(e) {
2249
+ if (e.namespace && this._core.is('resizing')) {
2250
+ this._core.$stage.find('.cloned .owl-video-frame').remove();
2251
+ }
2252
+ }, this),
2253
+ 'changed.owl.carousel': $.proxy(function(e) {
2254
+ if (e.namespace && e.property.name === 'position' && this._playing) {
2255
+ this.stop();
2256
+ }
2257
+ }, this),
2258
+ 'prepared.owl.carousel': $.proxy(function(e) {
2259
+ if (!e.namespace) {
2260
+ return;
2261
+ }
2262
+
2263
+ var $element = $(e.content).find('.owl-video');
2264
+
2265
+ if ($element.length) {
2266
+ $element.css('display', 'none');
2267
+ this.fetch($element, $(e.content));
2268
+ }
2269
+ }, this)
2270
+ };
2271
+
2272
+ // set default options
2273
+ this._core.options = $.extend({}, Video.Defaults, this._core.options);
2274
+
2275
+ // register event handlers
2276
+ this._core.$element.on(this._handlers);
2277
+
2278
+ this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
2279
+ this.play(e);
2280
+ }, this));
2281
+ };
2282
+
2283
+ /**
2284
+ * Default options.
2285
+ * @public
2286
+ */
2287
+ Video.Defaults = {
2288
+ video: false,
2289
+ videoHeight: false,
2290
+ videoWidth: false
2291
+ };
2292
+
2293
+ /**
2294
+ * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
2295
+ * @protected
2296
+ * @param {jQuery} target - The target containing the video data.
2297
+ * @param {jQuery} item - The item containing the video.
2298
+ */
2299
+ Video.prototype.fetch = function(target, item) {
2300
+ var type = (function() {
2301
+ if (target.attr('data-vimeo-id')) {
2302
+ return 'vimeo';
2303
+ } else if (target.attr('data-vzaar-id')) {
2304
+ return 'vzaar'
2305
+ } else {
2306
+ return 'youtube';
2307
+ }
2308
+ })(),
2309
+ id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
2310
+ width = target.attr('data-width') || this._core.settings.videoWidth,
2311
+ height = target.attr('data-height') || this._core.settings.videoHeight,
2312
+ url = target.attr('href');
2313
+
2314
+ if (url) {
2315
+
2316
+ /*
2317
+ Parses the id's out of the following urls (and probably more):
2318
+ https://www.youtube.com/watch?v=:id
2319
+ https://youtu.be/:id
2320
+ https://vimeo.com/:id
2321
+ https://vimeo.com/channels/:channel/:id
2322
+ https://vimeo.com/groups/:group/videos/:id
2323
+ https://app.vzaar.com/videos/:id
2324
+
2325
+ Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F
2326
+ */
2327
+
2328
+ id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
2329
+
2330
+ if (id[3].indexOf('youtu') > -1) {
2331
+ type = 'youtube';
2332
+ } else if (id[3].indexOf('vimeo') > -1) {
2333
+ type = 'vimeo';
2334
+ } else if (id[3].indexOf('vzaar') > -1) {
2335
+ type = 'vzaar';
2336
+ } else {
2337
+ throw new Error('Video URL not supported.');
2338
+ }
2339
+ id = id[6];
2340
+ } else {
2341
+ throw new Error('Missing video URL.');
2342
+ }
2343
+
2344
+ this._videos[url] = {
2345
+ type: type,
2346
+ id: id,
2347
+ width: width,
2348
+ height: height
2349
+ };
2350
+
2351
+ item.attr('data-video', url);
2352
+
2353
+ this.thumbnail(target, this._videos[url]);
2354
+ };
2355
+
2356
+ /**
2357
+ * Creates video thumbnail.
2358
+ * @protected
2359
+ * @param {jQuery} target - The target containing the video data.
2360
+ * @param {Object} info - The video info object.
2361
+ * @see `fetch`
2362
+ */
2363
+ Video.prototype.thumbnail = function(target, video) {
2364
+ var tnLink,
2365
+ icon,
2366
+ path,
2367
+ dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '',
2368
+ customTn = target.find('img'),
2369
+ srcType = 'src',
2370
+ lazyClass = '',
2371
+ settings = this._core.settings,
2372
+ create = function(path) {
2373
+ icon = '<div class="owl-video-play-icon"></div>';
2374
+
2375
+ if (settings.lazyLoad) {
2376
+ tnLink = $('<div/>',{
2377
+ "class": 'owl-video-tn ' + lazyClass,
2378
+ "srcType": path
2379
+ });
2380
+ } else {
2381
+ tnLink = $( '<div/>', {
2382
+ "class": "owl-video-tn",
2383
+ "style": 'opacity:1;background-image:url(' + path + ')'
2384
+ });
2385
+ }
2386
+ target.after(tnLink);
2387
+ target.after(icon);
2388
+ };
2389
+
2390
+ // wrap video content into owl-video-wrapper div
2391
+ target.wrap( $( '<div/>', {
2392
+ "class": "owl-video-wrapper",
2393
+ "style": dimensions
2394
+ }));
2395
+
2396
+ if (this._core.settings.lazyLoad) {
2397
+ srcType = 'data-src';
2398
+ lazyClass = 'owl-lazy';
2399
+ }
2400
+
2401
+ // custom thumbnail
2402
+ if (customTn.length) {
2403
+ create(customTn.attr(srcType));
2404
+ customTn.remove();
2405
+ return false;
2406
+ }
2407
+
2408
+ if (video.type === 'youtube') {
2409
+ path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
2410
+ create(path);
2411
+ } else if (video.type === 'vimeo') {
2412
+ $.ajax({
2413
+ type: 'GET',
2414
+ url: '//vimeo.com/api/v2/video/' + video.id + '.json',
2415
+ jsonp: 'callback',
2416
+ dataType: 'jsonp',
2417
+ success: function(data) {
2418
+ path = data[0].thumbnail_large;
2419
+ create(path);
2420
+ }
2421
+ });
2422
+ } else if (video.type === 'vzaar') {
2423
+ $.ajax({
2424
+ type: 'GET',
2425
+ url: '//vzaar.com/api/videos/' + video.id + '.json',
2426
+ jsonp: 'callback',
2427
+ dataType: 'jsonp',
2428
+ success: function(data) {
2429
+ path = data.framegrab_url;
2430
+ create(path);
2431
+ }
2432
+ });
2433
+ }
2434
+ };
2435
+
2436
+ /**
2437
+ * Stops the current video.
2438
+ * @public
2439
+ */
2440
+ Video.prototype.stop = function() {
2441
+ this._core.trigger('stop', null, 'video');
2442
+ this._playing.find('.owl-video-frame').remove();
2443
+ this._playing.removeClass('owl-video-playing');
2444
+ this._playing = null;
2445
+ this._core.leave('playing');
2446
+ this._core.trigger('stopped', null, 'video');
2447
+ };
2448
+
2449
+ /**
2450
+ * Starts the current video.
2451
+ * @public
2452
+ * @param {Event} event - The event arguments.
2453
+ */
2454
+ Video.prototype.play = function(event) {
2455
+ var target = $(event.target),
2456
+ item = target.closest('.' + this._core.settings.itemClass),
2457
+ video = this._videos[item.attr('data-video')],
2458
+ width = video.width || '100%',
2459
+ height = video.height || this._core.$stage.height(),
2460
+ html,
2461
+ iframe;
2462
+
2463
+ if (this._playing) {
2464
+ return;
2465
+ }
2466
+
2467
+ this._core.enter('playing');
2468
+ this._core.trigger('play', null, 'video');
2469
+
2470
+ item = this._core.items(this._core.relative(item.index()));
2471
+
2472
+ this._core.reset(item.index());
2473
+
2474
+ html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' );
2475
+ html.attr( 'height', height );
2476
+ html.attr( 'width', width );
2477
+ if (video.type === 'youtube') {
2478
+ html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id );
2479
+ } else if (video.type === 'vimeo') {
2480
+ html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' );
2481
+ } else if (video.type === 'vzaar') {
2482
+ html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' );
2483
+ }
2484
+
2485
+ iframe = $(html).wrap( '<div class="owl-video-frame" />' ).insertAfter(item.find('.owl-video'));
2486
+
2487
+ this._playing = item.addClass('owl-video-playing');
2488
+ };
2489
+
2490
+ /**
2491
+ * Checks whether an video is currently in full screen mode or not.
2492
+ * @todo Bad style because looks like a readonly method but changes members.
2493
+ * @protected
2494
+ * @returns {Boolean}
2495
+ */
2496
+ Video.prototype.isInFullScreen = function() {
2497
+ var element = document.fullscreenElement || document.mozFullScreenElement ||
2498
+ document.webkitFullscreenElement;
2499
+
2500
+ return element && $(element).parent().hasClass('owl-video-frame');
2501
+ };
2502
+
2503
+ /**
2504
+ * Destroys the plugin.
2505
+ */
2506
+ Video.prototype.destroy = function() {
2507
+ var handler, property;
2508
+
2509
+ this._core.$element.off('click.owl.video');
2510
+
2511
+ for (handler in this._handlers) {
2512
+ this._core.$element.off(handler, this._handlers[handler]);
2513
+ }
2514
+ for (property in Object.getOwnPropertyNames(this)) {
2515
+ typeof this[property] != 'function' && (this[property] = null);
2516
+ }
2517
+ };
2518
+
2519
+ $.fn.owlCarousel.Constructor.Plugins.Video = Video;
2520
+
2521
+ })(window.Zepto || window.jQuery, window, document);
2522
+
2523
+ /**
2524
+ * Animate Plugin
2525
+ * @version 2.3.4
2526
+ * @author Bartosz Wojciechowski
2527
+ * @author David Deutsch
2528
+ * @license The MIT License (MIT)
2529
+ */
2530
+ ;(function($, window, document, undefined) {
2531
+
2532
+ /**
2533
+ * Creates the animate plugin.
2534
+ * @class The Navigation Plugin
2535
+ * @param {Owl} scope - The Owl Carousel
2536
+ */
2537
+ var Animate = function(scope) {
2538
+ this.core = scope;
2539
+ this.core.options = $.extend({}, Animate.Defaults, this.core.options);
2540
+ this.swapping = true;
2541
+ this.previous = undefined;
2542
+ this.next = undefined;
2543
+
2544
+ this.handlers = {
2545
+ 'change.owl.carousel': $.proxy(function(e) {
2546
+ if (e.namespace && e.property.name == 'position') {
2547
+ this.previous = this.core.current();
2548
+ this.next = e.property.value;
2549
+ }
2550
+ }, this),
2551
+ 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
2552
+ if (e.namespace) {
2553
+ this.swapping = e.type == 'translated';
2554
+ }
2555
+ }, this),
2556
+ 'translate.owl.carousel': $.proxy(function(e) {
2557
+ if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
2558
+ this.swap();
2559
+ }
2560
+ }, this)
2561
+ };
2562
+
2563
+ this.core.$element.on(this.handlers);
2564
+ };
2565
+
2566
+ /**
2567
+ * Default options.
2568
+ * @public
2569
+ */
2570
+ Animate.Defaults = {
2571
+ animateOut: false,
2572
+ animateIn: false
2573
+ };
2574
+
2575
+ /**
2576
+ * Toggles the animation classes whenever an translations starts.
2577
+ * @protected
2578
+ * @returns {Boolean|undefined}
2579
+ */
2580
+ Animate.prototype.swap = function() {
2581
+
2582
+ if (this.core.settings.items !== 1) {
2583
+ return;
2584
+ }
2585
+
2586
+ if (!$.support.animation || !$.support.transition) {
2587
+ return;
2588
+ }
2589
+
2590
+ this.core.speed(0);
2591
+
2592
+ var left,
2593
+ clear = $.proxy(this.clear, this),
2594
+ previous = this.core.$stage.children().eq(this.previous),
2595
+ next = this.core.$stage.children().eq(this.next),
2596
+ incoming = this.core.settings.animateIn,
2597
+ outgoing = this.core.settings.animateOut;
2598
+
2599
+ if (this.core.current() === this.previous) {
2600
+ return;
2601
+ }
2602
+
2603
+ if (outgoing) {
2604
+ left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
2605
+ previous.one($.support.animation.end, clear)
2606
+ .css( { 'left': left + 'px' } )
2607
+ .addClass('animated owl-animated-out')
2608
+ .addClass(outgoing);
2609
+ }
2610
+
2611
+ if (incoming) {
2612
+ next.one($.support.animation.end, clear)
2613
+ .addClass('animated owl-animated-in')
2614
+ .addClass(incoming);
2615
+ }
2616
+ };
2617
+
2618
+ Animate.prototype.clear = function(e) {
2619
+ $(e.target).css( { 'left': '' } )
2620
+ .removeClass('animated owl-animated-out owl-animated-in')
2621
+ .removeClass(this.core.settings.animateIn)
2622
+ .removeClass(this.core.settings.animateOut);
2623
+ this.core.onTransitionEnd();
2624
+ };
2625
+
2626
+ /**
2627
+ * Destroys the plugin.
2628
+ * @public
2629
+ */
2630
+ Animate.prototype.destroy = function() {
2631
+ var handler, property;
2632
+
2633
+ for (handler in this.handlers) {
2634
+ this.core.$element.off(handler, this.handlers[handler]);
2635
+ }
2636
+ for (property in Object.getOwnPropertyNames(this)) {
2637
+ typeof this[property] != 'function' && (this[property] = null);
2638
+ }
2639
+ };
2640
+
2641
+ $.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
2642
+
2643
+ })(window.Zepto || window.jQuery, window, document);
2644
+
2645
+ /**
2646
+ * Autoplay Plugin
2647
+ * @version 2.3.4
2648
+ * @author Bartosz Wojciechowski
2649
+ * @author Artus Kolanowski
2650
+ * @author David Deutsch
2651
+ * @author Tom De CaluwГ©
2652
+ * @license The MIT License (MIT)
2653
+ */
2654
+ ;(function($, window, document, undefined) {
2655
+
2656
+ /**
2657
+ * Creates the autoplay plugin.
2658
+ * @class The Autoplay Plugin
2659
+ * @param {Owl} scope - The Owl Carousel
2660
+ */
2661
+ var Autoplay = function(carousel) {
2662
+ /**
2663
+ * Reference to the core.
2664
+ * @protected
2665
+ * @type {Owl}
2666
+ */
2667
+ this._core = carousel;
2668
+
2669
+ /**
2670
+ * The autoplay timeout id.
2671
+ * @type {Number}
2672
+ */
2673
+ this._call = null;
2674
+
2675
+ /**
2676
+ * Depending on the state of the plugin, this variable contains either
2677
+ * the start time of the timer or the current timer value if it's
2678
+ * paused. Since we start in a paused state we initialize the timer
2679
+ * value.
2680
+ * @type {Number}
2681
+ */
2682
+ this._time = 0;
2683
+
2684
+ /**
2685
+ * Stores the timeout currently used.
2686
+ * @type {Number}
2687
+ */
2688
+ this._timeout = 0;
2689
+
2690
+ /**
2691
+ * Indicates whenever the autoplay is paused.
2692
+ * @type {Boolean}
2693
+ */
2694
+ this._paused = true;
2695
+
2696
+ /**
2697
+ * All event handlers.
2698
+ * @protected
2699
+ * @type {Object}
2700
+ */
2701
+ this._handlers = {
2702
+ 'changed.owl.carousel': $.proxy(function(e) {
2703
+ if (e.namespace && e.property.name === 'settings') {
2704
+ if (this._core.settings.autoplay) {
2705
+ this.play();
2706
+ } else {
2707
+ this.stop();
2708
+ }
2709
+ } else if (e.namespace && e.property.name === 'position' && this._paused) {
2710
+ // Reset the timer. This code is triggered when the position
2711
+ // of the carousel was changed through user interaction.
2712
+ this._time = 0;
2713
+ }
2714
+ }, this),
2715
+ 'initialized.owl.carousel': $.proxy(function(e) {
2716
+ if (e.namespace && this._core.settings.autoplay) {
2717
+ this.play();
2718
+ }
2719
+ }, this),
2720
+ 'play.owl.autoplay': $.proxy(function(e, t, s) {
2721
+ if (e.namespace) {
2722
+ this.play(t, s);
2723
+ }
2724
+ }, this),
2725
+ 'stop.owl.autoplay': $.proxy(function(e) {
2726
+ if (e.namespace) {
2727
+ this.stop();
2728
+ }
2729
+ }, this),
2730
+ 'mouseover.owl.autoplay': $.proxy(function() {
2731
+ if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2732
+ this.pause();
2733
+ }
2734
+ }, this),
2735
+ 'mouseleave.owl.autoplay': $.proxy(function() {
2736
+ if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2737
+ this.play();
2738
+ }
2739
+ }, this),
2740
+ 'touchstart.owl.core': $.proxy(function() {
2741
+ if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
2742
+ this.pause();
2743
+ }
2744
+ }, this),
2745
+ 'touchend.owl.core': $.proxy(function() {
2746
+ if (this._core.settings.autoplayHoverPause) {
2747
+ this.play();
2748
+ }
2749
+ }, this)
2750
+ };
2751
+
2752
+ // register event handlers
2753
+ this._core.$element.on(this._handlers);
2754
+
2755
+ // set default options
2756
+ this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
2757
+ };
2758
+
2759
+ /**
2760
+ * Default options.
2761
+ * @public
2762
+ */
2763
+ Autoplay.Defaults = {
2764
+ autoplay: false,
2765
+ autoplayTimeout: 5000,
2766
+ autoplayHoverPause: false,
2767
+ autoplaySpeed: false
2768
+ };
2769
+
2770
+ /**
2771
+ * Transition to the next slide and set a timeout for the next transition.
2772
+ * @private
2773
+ * @param {Number} [speed] - The animation speed for the animations.
2774
+ */
2775
+ Autoplay.prototype._next = function(speed) {
2776
+ this._call = window.setTimeout(
2777
+ $.proxy(this._next, this, speed),
2778
+ this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read()
2779
+ );
2780
+
2781
+ if (this._core.is('interacting') || document.hidden) {
2782
+ return;
2783
+ }
2784
+ this._core.next(speed || this._core.settings.autoplaySpeed);
2785
+ }
2786
+
2787
+ /**
2788
+ * Reads the current timer value when the timer is playing.
2789
+ * @public
2790
+ */
2791
+ Autoplay.prototype.read = function() {
2792
+ return new Date().getTime() - this._time;
2793
+ };
2794
+
2795
+ /**
2796
+ * Starts the autoplay.
2797
+ * @public
2798
+ * @param {Number} [timeout] - The interval before the next animation starts.
2799
+ * @param {Number} [speed] - The animation speed for the animations.
2800
+ */
2801
+ Autoplay.prototype.play = function(timeout, speed) {
2802
+ var elapsed;
2803
+
2804
+ if (!this._core.is('rotating')) {
2805
+ this._core.enter('rotating');
2806
+ }
2807
+
2808
+ timeout = timeout || this._core.settings.autoplayTimeout;
2809
+
2810
+ // Calculate the elapsed time since the last transition. If the carousel
2811
+ // wasn't playing this calculation will yield zero.
2812
+ elapsed = Math.min(this._time % (this._timeout || timeout), timeout);
2813
+
2814
+ if (this._paused) {
2815
+ // Start the clock.
2816
+ this._time = this.read();
2817
+ this._paused = false;
2818
+ } else {
2819
+ // Clear the active timeout to allow replacement.
2820
+ window.clearTimeout(this._call);
2821
+ }
2822
+
2823
+ // Adjust the origin of the timer to match the new timeout value.
2824
+ this._time += this.read() % timeout - elapsed;
2825
+
2826
+ this._timeout = timeout;
2827
+ this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed);
2828
+ };
2829
+
2830
+ /**
2831
+ * Stops the autoplay.
2832
+ * @public
2833
+ */
2834
+ Autoplay.prototype.stop = function() {
2835
+ if (this._core.is('rotating')) {
2836
+ // Reset the clock.
2837
+ this._time = 0;
2838
+ this._paused = true;
2839
+
2840
+ window.clearTimeout(this._call);
2841
+ this._core.leave('rotating');
2842
+ }
2843
+ };
2844
+
2845
+ /**
2846
+ * Pauses the autoplay.
2847
+ * @public
2848
+ */
2849
+ Autoplay.prototype.pause = function() {
2850
+ if (this._core.is('rotating') && !this._paused) {
2851
+ // Pause the clock.
2852
+ this._time = this.read();
2853
+ this._paused = true;
2854
+
2855
+ window.clearTimeout(this._call);
2856
+ }
2857
+ };
2858
+
2859
+ /**
2860
+ * Destroys the plugin.
2861
+ */
2862
+ Autoplay.prototype.destroy = function() {
2863
+ var handler, property;
2864
+
2865
+ this.stop();
2866
+
2867
+ for (handler in this._handlers) {
2868
+ this._core.$element.off(handler, this._handlers[handler]);
2869
+ }
2870
+ for (property in Object.getOwnPropertyNames(this)) {
2871
+ typeof this[property] != 'function' && (this[property] = null);
2872
+ }
2873
+ };
2874
+
2875
+ $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
2876
+
2877
+ })(window.Zepto || window.jQuery, window, document);
2878
+
2879
+ /**
2880
+ * Navigation Plugin
2881
+ * @version 2.3.4
2882
+ * @author Artus Kolanowski
2883
+ * @author David Deutsch
2884
+ * @license The MIT License (MIT)
2885
+ */
2886
+ ;(function($, window, document, undefined) {
2887
+ 'use strict';
2888
+
2889
+ /**
2890
+ * Creates the navigation plugin.
2891
+ * @class The Navigation Plugin
2892
+ * @param {Owl} carousel - The Owl Carousel.
2893
+ */
2894
+ var Navigation = function(carousel) {
2895
+ /**
2896
+ * Reference to the core.
2897
+ * @protected
2898
+ * @type {Owl}
2899
+ */
2900
+ this._core = carousel;
2901
+
2902
+ /**
2903
+ * Indicates whether the plugin is initialized or not.
2904
+ * @protected
2905
+ * @type {Boolean}
2906
+ */
2907
+ this._initialized = false;
2908
+
2909
+ /**
2910
+ * The current paging indexes.
2911
+ * @protected
2912
+ * @type {Array}
2913
+ */
2914
+ this._pages = [];
2915
+
2916
+ /**
2917
+ * All DOM elements of the user interface.
2918
+ * @protected
2919
+ * @type {Object}
2920
+ */
2921
+ this._controls = {};
2922
+
2923
+ /**
2924
+ * Markup for an indicator.
2925
+ * @protected
2926
+ * @type {Array.<String>}
2927
+ */
2928
+ this._templates = [];
2929
+
2930
+ /**
2931
+ * The carousel element.
2932
+ * @type {jQuery}
2933
+ */
2934
+ this.$element = this._core.$element;
2935
+
2936
+ /**
2937
+ * Overridden methods of the carousel.
2938
+ * @protected
2939
+ * @type {Object}
2940
+ */
2941
+ this._overrides = {
2942
+ next: this._core.next,
2943
+ prev: this._core.prev,
2944
+ to: this._core.to
2945
+ };
2946
+
2947
+ /**
2948
+ * All event handlers.
2949
+ * @protected
2950
+ * @type {Object}
2951
+ */
2952
+ this._handlers = {
2953
+ 'prepared.owl.carousel': $.proxy(function(e) {
2954
+ if (e.namespace && this._core.settings.dotsData) {
2955
+ this._templates.push('<div class="' + this._core.settings.dotClass + '">' +
2956
+ $(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>');
2957
+ }
2958
+ }, this),
2959
+ 'added.owl.carousel': $.proxy(function(e) {
2960
+ if (e.namespace && this._core.settings.dotsData) {
2961
+ this._templates.splice(e.position, 0, this._templates.pop());
2962
+ }
2963
+ }, this),
2964
+ 'remove.owl.carousel': $.proxy(function(e) {
2965
+ if (e.namespace && this._core.settings.dotsData) {
2966
+ this._templates.splice(e.position, 1);
2967
+ }
2968
+ }, this),
2969
+ 'changed.owl.carousel': $.proxy(function(e) {
2970
+ if (e.namespace && e.property.name == 'position') {
2971
+ this.draw();
2972
+ }
2973
+ }, this),
2974
+ 'initialized.owl.carousel': $.proxy(function(e) {
2975
+ if (e.namespace && !this._initialized) {
2976
+ this._core.trigger('initialize', null, 'navigation');
2977
+ this.initialize();
2978
+ this.update();
2979
+ this.draw();
2980
+ this._initialized = true;
2981
+ this._core.trigger('initialized', null, 'navigation');
2982
+ }
2983
+ }, this),
2984
+ 'refreshed.owl.carousel': $.proxy(function(e) {
2985
+ if (e.namespace && this._initialized) {
2986
+ this._core.trigger('refresh', null, 'navigation');
2987
+ this.update();
2988
+ this.draw();
2989
+ this._core.trigger('refreshed', null, 'navigation');
2990
+ }
2991
+ }, this)
2992
+ };
2993
+
2994
+ // set default options
2995
+ this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
2996
+
2997
+ // register event handlers
2998
+ this.$element.on(this._handlers);
2999
+ };
3000
+
3001
+ /**
3002
+ * Default options.
3003
+ * @public
3004
+ * @todo Rename `slideBy` to `navBy`
3005
+ */
3006
+ Navigation.Defaults = {
3007
+ nav: false,
3008
+ navText: [
3009
+ '<span aria-label="' + 'Previous' + '">&#x2039;</span>',
3010
+ '<span aria-label="' + 'Next' + '">&#x203a;</span>'
3011
+ ],
3012
+ navSpeed: false,
3013
+ navElement: 'button type="button" role="presentation"',
3014
+ navContainer: false,
3015
+ navContainerClass: 'owl-nav',
3016
+ navClass: [
3017
+ 'owl-prev',
3018
+ 'owl-next'
3019
+ ],
3020
+ slideBy: 1,
3021
+ changeItemOnClick:false,
3022
+ dotClass: 'owl-dot',
3023
+ dotsClass: 'owl-dots',
3024
+ dots: true,
3025
+ dotsEach: false,
3026
+ dotsData: false,
3027
+ dotsSpeed: false,
3028
+ dotsContainer: false
3029
+ };
3030
+
3031
+ /**
3032
+ * Initializes the layout of the plugin and extends the carousel.
3033
+ * @protected
3034
+ */
3035
+ Navigation.prototype.initialize = function() {
3036
+ var override,
3037
+ settings = this._core.settings;
3038
+
3039
+ // create DOM structure for relative navigation
3040
+ this._controls.$relative = (settings.navContainer ? $(settings.navContainer)
3041
+ : $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled');
3042
+
3043
+ this._controls.$previous = $('<' + settings.navElement + ' value="previous item" title="previous item">')
3044
+ .addClass(settings.navClass[0])
3045
+ .html(settings.navText[0])
3046
+ .prependTo(this._controls.$relative)
3047
+ .on('click', $.proxy(function(e) {
3048
+ this.prev(settings.navSpeed);
3049
+ }, this));
3050
+ this._controls.$next = $('<' + settings.navElement + ' value="next item" title="next item">')
3051
+ .addClass(settings.navClass[1])
3052
+ .html(settings.navText[1])
3053
+ .appendTo(this._controls.$relative)
3054
+ .on('click', $.proxy(function(e) {
3055
+ this.next(settings.navSpeed);
3056
+ }, this));
3057
+
3058
+ // scroll on item-click function
3059
+ if(settings.changeItemOnClick){
3060
+ var owlItem = this._core.$stage.children();
3061
+ var clonedItems = this._core.clones().length / 2;
3062
+
3063
+ owlItem.on('click', $.proxy(function(e){
3064
+ var index = $(e.currentTarget).index();
3065
+ this.to(index - clonedItems, settings.navSpeed, true);
3066
+ }, this));
3067
+ }
3068
+
3069
+
3070
+
3071
+ // create DOM structure for absolute navigation
3072
+ if (!settings.dotsData) {
3073
+ this._templates = [ $('<button role="button">')
3074
+ .addClass(settings.dotClass)
3075
+ .append($('<span>'))
3076
+ .prop('outerHTML') ];
3077
+ }
3078
+
3079
+ this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer)
3080
+ : $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled');
3081
+
3082
+ this._controls.$absolute.on('click', 'button', $.proxy(function(e) {
3083
+ var index = $(e.target).parent().is(this._controls.$absolute)
3084
+ ? $(e.target).index() : $(e.target).parent().index();
3085
+ console.log($(e.target).index());
3086
+ e.preventDefault();
3087
+
3088
+ this.to(index, settings.dotsSpeed);
3089
+ }, this));
3090
+
3091
+ /*$el.on('focusin', function() {
3092
+ $(document).off(".carousel");
3093
+
3094
+ $(document).on('keydown.carousel', function(e) {
3095
+ if(e.keyCode == 37) {
3096
+ $el.trigger('prev.owl')
3097
+ }
3098
+ if(e.keyCode == 39) {
3099
+ $el.trigger('next.owl')
3100
+ }
3101
+ });
3102
+ });*/
3103
+
3104
+ // override public methods of the carousel
3105
+ for (override in this._overrides) {
3106
+ this._core[override] = $.proxy(this[override], this);
3107
+ }
3108
+ };
3109
+
3110
+ /**
3111
+ * Destroys the plugin.
3112
+ * @protected
3113
+ */
3114
+ Navigation.prototype.destroy = function() {
3115
+ var handler, control, property, override, settings;
3116
+ settings = this._core.settings;
3117
+
3118
+ for (handler in this._handlers) {
3119
+ this.$element.off(handler, this._handlers[handler]);
3120
+ }
3121
+ for (control in this._controls) {
3122
+ if (control === '$relative' && settings.navContainer) {
3123
+ this._controls[control].html('');
3124
+ } else {
3125
+ this._controls[control].remove();
3126
+ }
3127
+ }
3128
+ for (override in this.overides) {
3129
+ this._core[override] = this._overrides[override];
3130
+ }
3131
+ for (property in Object.getOwnPropertyNames(this)) {
3132
+ typeof this[property] != 'function' && (this[property] = null);
3133
+ }
3134
+ };
3135
+
3136
+ /**
3137
+ * Updates the internal state.
3138
+ * @protected
3139
+ */
3140
+ Navigation.prototype.update = function() {
3141
+ var i, j, k,
3142
+ lower = this._core.clones().length / 2,
3143
+ upper = lower + this._core.items().length,
3144
+ maximum = this._core.maximum(true),
3145
+ settings = this._core.settings,
3146
+ size = settings.center || settings.autoWidth || settings.dotsData
3147
+ ? 1 : settings.dotsEach || settings.items;
3148
+
3149
+ if (settings.slideBy !== 'page') {
3150
+ settings.slideBy = Math.min(settings.slideBy, settings.items);
3151
+ }
3152
+
3153
+ if (settings.dots || settings.slideBy == 'page') {
3154
+ this._pages = [];
3155
+
3156
+ for (i = lower, j = 0, k = 0; i < upper; i++) {
3157
+ if (j >= size || j === 0) {
3158
+ this._pages.push({
3159
+ start: Math.min(maximum, i - lower),
3160
+ end: i - lower + size - 1
3161
+ });
3162
+ if (Math.min(maximum, i - lower) === maximum) {
3163
+ break;
3164
+ }
3165
+ j = 0, ++k;
3166
+ }
3167
+ j += this._core.mergers(this._core.relative(i));
3168
+ }
3169
+ }
3170
+ };
3171
+
3172
+ /**
3173
+ * Draws the user interface.
3174
+ * @todo The option `dotsData` wont work.
3175
+ * @protected
3176
+ */
3177
+ Navigation.prototype.draw = function() {
3178
+ var difference,
3179
+ settings = this._core.settings,
3180
+ disabled = this._core.items().length <= settings.items,
3181
+ index = this._core.relative(this._core.current()),
3182
+ loop = settings.loop || settings.rewind;
3183
+
3184
+ this._controls.$relative.toggleClass('disabled', !settings.nav || disabled);
3185
+
3186
+ if (settings.nav) {
3187
+ this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true));
3188
+ this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true));
3189
+ }
3190
+
3191
+ this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled);
3192
+
3193
+ if (settings.dots) {
3194
+ difference = this._pages.length - this._controls.$absolute.children().length;
3195
+
3196
+ if (settings.dotsData && difference !== 0) {
3197
+ this._controls.$absolute.html(this._templates.join(''));
3198
+ } else if (difference > 0) {
3199
+ this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0]));
3200
+ } else if (difference < 0) {
3201
+ this._controls.$absolute.children().slice(difference).remove();
3202
+ }
3203
+
3204
+ this._controls.$absolute.find('.active').removeClass('active');
3205
+ this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active');
3206
+ }
3207
+ };
3208
+
3209
+ /**
3210
+ * Extends event data.
3211
+ * @protected
3212
+ * @param {Event} event - The event object which gets thrown.
3213
+ */
3214
+ Navigation.prototype.onTrigger = function(event) {
3215
+ var settings = this._core.settings;
3216
+
3217
+ event.page = {
3218
+ index: $.inArray(this.current(), this._pages),
3219
+ count: this._pages.length,
3220
+ size: settings && (settings.center || settings.autoWidth || settings.dotsData
3221
+ ? 1 : settings.dotsEach || settings.items)
3222
+ };
3223
+ };
3224
+
3225
+ /**
3226
+ * Gets the current page position of the carousel.
3227
+ * @protected
3228
+ * @returns {Number}
3229
+ */
3230
+ Navigation.prototype.current = function() {
3231
+ var current = this._core.relative(this._core.current());
3232
+ return $.grep(this._pages, $.proxy(function(page, index) {
3233
+ return page.start <= current && page.end >= current;
3234
+ }, this)).pop();
3235
+ };
3236
+
3237
+ /**
3238
+ * Gets the current succesor/predecessor position.
3239
+ * @protected
3240
+ * @returns {Number}
3241
+ */
3242
+ Navigation.prototype.getPosition = function(successor) {
3243
+ var position, length,
3244
+ settings = this._core.settings;
3245
+
3246
+ if (settings.slideBy == 'page') {
3247
+ position = $.inArray(this.current(), this._pages);
3248
+ length = this._pages.length;
3249
+ successor ? ++position : --position;
3250
+ position = this._pages[((position % length) + length) % length].start;
3251
+ } else {
3252
+ position = this._core.relative(this._core.current());
3253
+ length = this._core.items().length;
3254
+ successor ? position += settings.slideBy : position -= settings.slideBy;
3255
+ }
3256
+
3257
+ return position;
3258
+ };
3259
+
3260
+ /**
3261
+ * Slides to the next item or page.
3262
+ * @public
3263
+ * @param {Number} [speed=false] - The time in milliseconds for the transition.
3264
+ */
3265
+ Navigation.prototype.next = function(speed) {
3266
+ $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
3267
+ };
3268
+
3269
+ /**
3270
+ * Slides to the previous item or page.
3271
+ * @public
3272
+ * @param {Number} [speed=false] - The time in milliseconds for the transition.
3273
+ */
3274
+ Navigation.prototype.prev = function(speed) {
3275
+ $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
3276
+ };
3277
+
3278
+ /**
3279
+ * Slides to the specified item or page.
3280
+ * @public
3281
+ * @param {Number} position - The position of the item or page.
3282
+ * @param {Number} [speed] - The time in milliseconds for the transition.
3283
+ * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
3284
+ */
3285
+ Navigation.prototype.to = function(position, speed, standard) {
3286
+ var length;
3287
+
3288
+ if (!standard && this._pages.length) {
3289
+ length = this._pages.length;
3290
+ $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
3291
+ } else {
3292
+ $.proxy(this._overrides.to, this._core)(position, speed);
3293
+ }
3294
+ };
3295
+
3296
+ $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
3297
+
3298
+ })(window.Zepto || window.jQuery, window, document);
3299
+
3300
+ /**
3301
+ * Hash Plugin
3302
+ * @version 2.3.4
3303
+ * @author Artus Kolanowski
3304
+ * @author David Deutsch
3305
+ * @license The MIT License (MIT)
3306
+ */
3307
+ ;(function($, window, document, undefined) {
3308
+ 'use strict';
3309
+
3310
+ /**
3311
+ * Creates the hash plugin.
3312
+ * @class The Hash Plugin
3313
+ * @param {Owl} carousel - The Owl Carousel
3314
+ */
3315
+ var Hash = function(carousel) {
3316
+ /**
3317
+ * Reference to the core.
3318
+ * @protected
3319
+ * @type {Owl}
3320
+ */
3321
+ this._core = carousel;
3322
+
3323
+ /**
3324
+ * Hash index for the items.
3325
+ * @protected
3326
+ * @type {Object}
3327
+ */
3328
+ this._hashes = {};
3329
+
3330
+ /**
3331
+ * The carousel element.
3332
+ * @type {jQuery}
3333
+ */
3334
+ this.$element = this._core.$element;
3335
+
3336
+ /**
3337
+ * All event handlers.
3338
+ * @protected
3339
+ * @type {Object}
3340
+ */
3341
+ this._handlers = {
3342
+ 'initialized.owl.carousel': $.proxy(function(e) {
3343
+ if (e.namespace && this._core.settings.startPosition === 'URLHash') {
3344
+ $(window).trigger('hashchange.owl.navigation');
3345
+ }
3346
+ }, this),
3347
+ 'prepared.owl.carousel': $.proxy(function(e) {
3348
+ if (e.namespace) {
3349
+ var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash');
3350
+
3351
+ if (!hash) {
3352
+ return;
3353
+ }
3354
+
3355
+ this._hashes[hash] = e.content;
3356
+ }
3357
+ }, this),
3358
+ 'changed.owl.carousel': $.proxy(function(e) {
3359
+ if (e.namespace && e.property.name === 'position') {
3360
+ var current = this._core.items(this._core.relative(this._core.current())),
3361
+ hash = $.map(this._hashes, function(item, hash) {
3362
+ return item === current ? hash : null;
3363
+ }).join();
3364
+
3365
+ if (!hash || window.location.hash.slice(1) === hash) {
3366
+ return;
3367
+ }
3368
+
3369
+ window.location.hash = hash;
3370
+ }
3371
+ }, this)
3372
+ };
3373
+
3374
+ // set default options
3375
+ this._core.options = $.extend({}, Hash.Defaults, this._core.options);
3376
+
3377
+ // register the event handlers
3378
+ this.$element.on(this._handlers);
3379
+
3380
+ // register event listener for hash navigation
3381
+ $(window).on('hashchange.owl.navigation', $.proxy(function(e) {
3382
+ var hash = window.location.hash.substring(1),
3383
+ items = this._core.$stage.children(),
3384
+ position = this._hashes[hash] && items.index(this._hashes[hash]);
3385
+
3386
+ if (position === undefined || position === this._core.current()) {
3387
+ return;
3388
+ }
3389
+
3390
+ this._core.to(this._core.relative(position), false, true);
3391
+ }, this));
3392
+ };
3393
+
3394
+ /**
3395
+ * Default options.
3396
+ * @public
3397
+ */
3398
+ Hash.Defaults = {
3399
+ URLhashListener: false
3400
+ };
3401
+
3402
+ /**
3403
+ * Destroys the plugin.
3404
+ * @public
3405
+ */
3406
+ Hash.prototype.destroy = function() {
3407
+ var handler, property;
3408
+
3409
+ $(window).off('hashchange.owl.navigation');
3410
+
3411
+ for (handler in this._handlers) {
3412
+ this._core.$element.off(handler, this._handlers[handler]);
3413
+ }
3414
+ for (property in Object.getOwnPropertyNames(this)) {
3415
+ typeof this[property] != 'function' && (this[property] = null);
3416
+ }
3417
+ };
3418
+
3419
+ $.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
3420
+
3421
+ })(window.Zepto || window.jQuery, window, document);
3422
+
3423
+ /**
3424
+ * Support Plugin
3425
+ *
3426
+ * @version 2.3.4
3427
+ * @author Vivid Planet Software GmbH
3428
+ * @author Artus Kolanowski
3429
+ * @author David Deutsch
3430
+ * @license The MIT License (MIT)
3431
+ */
3432
+ ;(function($, window, document, undefined) {
3433
+
3434
+ var style = $('<support>').get(0).style,
3435
+ prefixes = 'Webkit Moz O ms'.split(' '),
3436
+ events = {
3437
+ transition: {
3438
+ end: {
3439
+ WebkitTransition: 'webkitTransitionEnd',
3440
+ MozTransition: 'transitionend',
3441
+ OTransition: 'oTransitionEnd',
3442
+ transition: 'transitionend'
3443
+ }
3444
+ },
3445
+ animation: {
3446
+ end: {
3447
+ WebkitAnimation: 'webkitAnimationEnd',
3448
+ MozAnimation: 'animationend',
3449
+ OAnimation: 'oAnimationEnd',
3450
+ animation: 'animationend'
3451
+ }
3452
+ }
3453
+ },
3454
+ tests = {
3455
+ csstransforms: function() {
3456
+ return !!test('transform');
3457
+ },
3458
+ csstransforms3d: function() {
3459
+ return !!test('perspective');
3460
+ },
3461
+ csstransitions: function() {
3462
+ return !!test('transition');
3463
+ },
3464
+ cssanimations: function() {
3465
+ return !!test('animation');
3466
+ }
3467
+ };
3468
+
3469
+ function test(property, prefixed) {
3470
+ var result = false,
3471
+ upper = property.charAt(0).toUpperCase() + property.slice(1);
3472
+
3473
+ $.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) {
3474
+ if (style[property] !== undefined) {
3475
+ result = prefixed ? property : true;
3476
+ return false;
3477
+ }
3478
+ });
3479
+
3480
+ return result;
3481
+ }
3482
+
3483
+ function prefixed(property) {
3484
+ return test(property, true);
3485
+ }
3486
+
3487
+ if (tests.csstransitions()) {
3488
+ /* jshint -W053 */
3489
+ $.support.transition = new String(prefixed('transition'))
3490
+ $.support.transition.end = events.transition.end[ $.support.transition ];
3491
+ }
3492
+
3493
+ if (tests.cssanimations()) {
3494
+ /* jshint -W053 */
3495
+ $.support.animation = new String(prefixed('animation'))
3496
+ $.support.animation.end = events.animation.end[ $.support.animation ];
3497
+ }
3498
+
3499
+ if (tests.csstransforms()) {
3500
+ /* jshint -W053 */
3501
+ $.support.transform = new String(prefixed('transform'));
3502
+ $.support.transform3d = tests.csstransforms3d();
3503
+ }
3504
+
3505
+ })(window.Zepto || window.jQuery, window, document);
3506
 
assets_libraries/owl-carousel-new/owl.carousel.min.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * Owl Carousel v2.3.5 - UE3
3
  * Copyright 2013-2018 David Deutsch
4
  * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
  */
@@ -16,4 +16,4 @@
16
  * @todo stagePadding calculate wrong active classes
17
  */
18
 
19
- !function(t,e,i,s){function n(e,i){this.settings=null,this.options=t.extend({},n.Defaults,i),this.$element=t(e),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},t.each(["onResize","onThrottledResize"],t.proxy(function(e,i){this._handlers[i]=t.proxy(this[i],this)},this)),t.each(n.Plugins,t.proxy(function(t,e){this._plugins[t.charAt(0).toLowerCase()+t.slice(1)]=new e(this)},this)),t.each(n.Workers,t.proxy(function(e,i){this._pipe.push({filter:i.filter,run:t.proxy(i.run,this)})},this)),this.setup(),this.initialize()}n.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,setActiveClass:!0,setActiveClassOnMobile:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:e,fallbackEasing:"swing",slideTransition:"",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},n.Width={Default:"default",Inner:"inner",Outer:"outer"},n.Type={Event:"event",State:"state"},n.Plugins={},n.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(t){t.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(t){var e=this.settings.margin||"",i=!this.settings.autoWidth,s=this.settings.rtl,n={width:"auto","margin-left":s?e:"","margin-right":s?"":e};!i&&this.$stage.children().css(n),t.css=n}},{filter:["width","items","settings"],run:function(t){var e=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,i=null,s=this._items.length,n=!this.settings.autoWidth,o=[];for(t.items={merge:!1,width:e};s--;)i=this._mergers[s],i=this.settings.mergeFit&&Math.min(i,this.settings.items)||i,t.items.merge=i>1||t.items.merge,o[s]=n?e*i:this._items[s].width();this._widths=o}},{filter:["items","settings"],run:function(){var e=[],i=this._items,s=this.settings,n=Math.max(2*s.items,4),o=2*Math.ceil(i.length/2),r=s.loop&&i.length?s.rewind?n:Math.max(n,o):0,a="",h="";for(r/=2;r>0;)e.push(this.normalize(e.length/2,!0)),a+=i[e[e.length-1]][0].outerHTML,e.push(this.normalize(i.length-1-(e.length-1)/2,!0)),h=i[e[e.length-1]][0].outerHTML+h,r-=1;this._clones=e,t(a).addClass("cloned").appendTo(this.$stage),t(h).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var t=this.settings.rtl?1:-1,e=this._clones.length+this._items.length,i=-1,s=0,n=0,o=[];++i<e;)s=o[i-1]||0,n=this._widths[this.relative(i)]+this.settings.margin,o.push(s+n*t);this._coordinates=o}},{filter:["width","items","settings"],run:function(){var t=this.settings.stagePadding,e=this._coordinates,i={width:Math.ceil(Math.abs(e[e.length-1]))+2*t,"padding-left":t||"","padding-right":t||""};this.$stage.css(i)}},{filter:["width","items","settings"],run:function(t){var e=this._coordinates.length,i=!this.settings.autoWidth,s=this.$stage.children();if(i&&t.items.merge)for(;e--;)t.css.width=this._widths[this.relative(e)],s.eq(e).css(t.css);else i&&(t.css.width=t.items.width,s.css(t.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(t){t.current=t.current?this.$stage.children().index(t.current):0,t.current=Math.max(this.minimum(),Math.min(this.maximum(),t.current)),this.reset(t.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var t,e,i,s,n=this.settings.rtl?1:-1,o=2*this.settings.stagePadding,r=this.coordinates(this.current())+o,a=r+this.width()*n,h=[];for(i=0,s=this._coordinates.length;i<s;i++)t=this._coordinates[i-1]||0,e=Math.abs(this._coordinates[i])+o*n,(this.op(t,"<=",r)&&this.op(t,">",a)||this.op(e,"<",r)&&this.op(e,">",a))&&h.push(i);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+h.join("), :eq(")+")").addClass("active"),this.$stage.children(".center").removeClass("center"),this.settings.center&&this.$stage.children().eq(this.current()).addClass("center")}},{filter:["width","position","items","settings"],run:function(){if(this.settings.setActiveClass&&this.settings.setActiveClass){var t=!0;this.settings.setActiveClassOnMobile?1==this.$stage.children(".active").length&&(t=!0):this.settings.setActiveClassOnMobile||1==this.$stage.children(".active").length&&(t=!1),1==t?this.$stage.children().eq(this.current()).addClass("uc-active-item").siblings().removeClass("uc-active-item"):0==t&&this.$stage.children().removeClass("uc-active-item")}}}],n.prototype.initializeStage=function(){this.$stage=this.$element.find("."+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=t("<"+this.settings.stageElement+">",{class:this.settings.stageClass}).wrap(t("<div/>",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},n.prototype.initializeItems=function(){var e=this.$element.find(".owl-item");if(e.length)return this._items=e.get().map(function(e){return t(e)}),this._mergers=this._items.map(function(){return 1}),void this.refresh();this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},n.prototype.initialize=function(){var t,e,i;(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading"))&&(t=this.$element.find("img"),e=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:void 0,i=this.$element.children(e).width(),t.length&&i<=0&&this.preloadAutoWidthImages(t));this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},n.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(":visible")},n.prototype.setup=function(){var e=this.viewport(),i=this.options.responsive,s=-1,n=null;i?(t.each(i,function(t){t<=e&&t>s&&(s=Number(t))}),"function"==typeof(n=t.extend({},this.options,i[s])).stagePadding&&(n.stagePadding=n.stagePadding()),delete n.responsive,n.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+s))):n=t.extend({},this.options),this.trigger("change",{property:{name:"settings",value:n}}),this._breakpoint=s,this.settings=n,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},n.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},n.prototype.prepare=function(e){var i=this.trigger("prepare",{content:e});return i.data||(i.data=t("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(e)),this.trigger("prepared",{content:i.data}),i.data},n.prototype.update=function(){for(var e=0,i=this._pipe.length,s=t.proxy(function(t){return this[t]},this._invalidated),n={};e<i;)(this._invalidated.all||t.grep(this._pipe[e].filter,s).length>0)&&this._pipe[e].run(n),e++;this._invalidated={},!this.is("valid")&&this.enter("valid")},n.prototype.width=function(t){switch(t=t||n.Width.Default){case n.Width.Inner:case n.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},n.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},n.prototype.onThrottledResize=function(){e.clearTimeout(this.resizeTimer),this.resizeTimer=e.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},n.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.isVisible()&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},n.prototype.registerEventHandlers=function(){t.support.transition&&this.$stage.on(t.support.transition.end+".owl.core",t.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&&this.on(e,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",t.proxy(this.onDragEnd,this)))},n.prototype.onDragStart=function(e){var s=null;3!==e.which&&(t.support.transform?s={x:(s=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","))[16===s.length?12:4],y:s[16===s.length?13:5]}:(s=this.$stage.position(),s={x:this.settings.rtl?s.left+this.$stage.width()-this.width()+this.settings.margin:s.left,y:s.top}),this.is("animating")&&(t.support.transform?this.animate(s.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===e.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=t(e.target),this._drag.stage.start=s,this._drag.stage.current=s,this._drag.pointer=this.pointer(e),t(i).on("mouseup.owl.core touchend.owl.core",t.proxy(this.onDragEnd,this)),t(i).one("mousemove.owl.core touchmove.owl.core",t.proxy(function(e){var s=this.difference(this._drag.pointer,this.pointer(e));t(i).on("mousemove.owl.core touchmove.owl.core",t.proxy(this.onDragMove,this)),Math.abs(s.x)<Math.abs(s.y)&&this.is("valid")||(e.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},n.prototype.onDragMove=function(t){var e=null,i=null,s=null,n=this.difference(this._drag.pointer,this.pointer(t)),o=this.difference(this._drag.stage.start,n);this.is("dragging")&&(t.preventDefault(),this.settings.loop?(e=this.coordinates(this.minimum()),i=this.coordinates(this.maximum()+1)-e,o.x=((o.x-e)%i+i)%i+e):(e=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),i=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),s=this.settings.pullDrag?-1*n.x/5:0,o.x=Math.max(Math.min(o.x,e+s),i+s)),this._drag.stage.current=o,this.animate(o.x))},n.prototype.onDragEnd=function(e){var s=this.difference(this._drag.pointer,this.pointer(e)),n=this._drag.stage.current,o=s.x>0^this.settings.rtl?"left":"right";t(i).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==s.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(n.x,0!==s.x?o:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=o,(Math.abs(s.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},n.prototype.closest=function(e,i){var s=-1,n=this.width(),o=this.coordinates();return this.settings.freeDrag||t.each(o,t.proxy(function(t,r){return"left"===i&&e>r-30&&e<r+30?s=t:"right"===i&&e>r-n-30&&e<r-n+30?s=t+1:this.op(e,"<",r)&&this.op(e,">",void 0!==o[t+1]?o[t+1]:r-n)&&(s="left"===i?t+1:t),-1===s},this)),this.settings.loop||(this.op(e,">",o[this.minimum()])?s=e=this.minimum():this.op(e,"<",o[this.maximum()])&&(s=e=this.maximum())),s},n.prototype.animate=function(e){var i=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),i&&(this.enter("animating"),this.trigger("translate")),t.support.transform3d&&t.support.transition?this.$stage.css({transform:"translate3d("+e+"px,0px,0px)",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")}):i?this.$stage.animate({left:e+"px"},this.speed(),this.settings.fallbackEasing,t.proxy(this.onTransitionEnd,this)):this.$stage.css({left:e+"px"})},n.prototype.is=function(t){return this._states.current[t]&&this._states.current[t]>0},n.prototype.current=function(t){if(void 0===t)return this._current;if(0!==this._items.length){if(t=this.normalize(t),this._current!==t){var e=this.trigger("change",{property:{name:"position",value:t}});void 0!==e.data&&(t=this.normalize(e.data)),this._current=t,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current}},n.prototype.invalidate=function(e){return"string"===t.type(e)&&(this._invalidated[e]=!0,this.is("valid")&&this.leave("valid")),t.map(this._invalidated,function(t,e){return e})},n.prototype.reset=function(t){void 0!==(t=this.normalize(t))&&(this._speed=0,this._current=t,this.suppress(["translate","translated"]),this.animate(this.coordinates(t)),this.release(["translate","translated"]))},n.prototype.normalize=function(t,e){var i=this._items.length,s=e?0:this._clones.length;return!this.isNumeric(t)||i<1?t=void 0:(t<0||t>=i+s)&&(t=((t-s/2)%i+i)%i+s/2),t},n.prototype.relative=function(t){return t-=this._clones.length/2,this.normalize(t,!0)},n.prototype.maximum=function(t){var e,i,s,n=this.settings,o=this._coordinates.length;if(n.loop)o=this._clones.length/2+this._items.length-1;else if(n.autoWidth||n.merge){if(e=this._items.length)for(i=this._items[--e].width(),s=this.$element.width();e--&&!((i+=this._items[e].width()+this.settings.margin)>s););o=e+1}else o=n.center?this._items.length-1:this._items.length-n.items;return t&&(o-=this._clones.length/2),Math.max(o,0)},n.prototype.minimum=function(t){return t?0:this._clones.length/2},n.prototype.items=function(t){return void 0===t?this._items.slice():(t=this.normalize(t,!0),this._items[t])},n.prototype.mergers=function(t){return void 0===t?this._mergers.slice():(t=this.normalize(t,!0),this._mergers[t])},n.prototype.clones=function(e){var i=this._clones.length/2,s=i+this._items.length,n=function(t){return t%2==0?s+t/2:i-(t+1)/2};return void 0===e?t.map(this._clones,function(t,e){return n(e)}):t.map(this._clones,function(t,i){return t===e?n(i):null})},n.prototype.speed=function(t){return void 0!==t&&(this._speed=t),this._speed},n.prototype.coordinates=function(e){var i,s=1,n=e-1;return void 0===e?t.map(this._coordinates,t.proxy(function(t,e){return this.coordinates(e)},this)):(this.settings.center?(this.settings.rtl&&(s=-1,n=e+1),i=this._coordinates[e],i+=(this.width()-i+(this._coordinates[n]||0))/2*s):i=this._coordinates[n]||0,i=Math.ceil(i))},n.prototype.duration=function(t,e,i){return 0===i?0:Math.min(Math.max(Math.abs(e-t),1),6)*Math.abs(i||this.settings.smartSpeed)},n.prototype.to=function(t,e){var i=this.current(),s=null,n=t-this.relative(i),o=(n>0)-(n<0),r=this._items.length,a=this.minimum(),h=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(n)>r/2&&(n+=-1*o*r),(s=(((t=i+n)-a)%r+r)%r+a)!==t&&s-n<=h&&s-n>0&&(i=s-n,t=s,this.reset(i))):t=this.settings.rewind?(t%(h+=1)+h)%h:Math.max(a,Math.min(h,t)),this.speed(this.duration(i,t,e)),this.current(t),this.isVisible()&&this.update()},n.prototype.next=function(t){t=t||!1,this.to(this.relative(this.current())+1,t)},n.prototype.prev=function(t){t=t||!1,this.to(this.relative(this.current())-1,t)},n.prototype.onTransitionEnd=function(t){if(void 0!==t&&(t.stopPropagation(),(t.target||t.srcElement||t.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},n.prototype.viewport=function(){var s;return this.options.responsiveBaseElement!==e?s=t(this.options.responsiveBaseElement).width():e.innerWidth?s=e.innerWidth:i.documentElement&&i.documentElement.clientWidth?s=i.documentElement.clientWidth:console.warn("Can not detect viewport width."),s},n.prototype.replace=function(e){this.$stage.empty(),this._items=[],e&&(e=e instanceof jQuery?e:t(e)),this.settings.nestedItemSelector&&(e=e.find("."+this.settings.nestedItemSelector)),e.filter(function(){return 1===this.nodeType}).each(t.proxy(function(t,e){e=this.prepare(e),this.$stage.append(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},n.prototype.add=function(e,i){var s=this.relative(this._current);i=void 0===i?this._items.length:this.normalize(i,!0),e=e instanceof jQuery?e:t(e),this.trigger("add",{content:e,position:i}),e=this.prepare(e),0===this._items.length||i===this._items.length?(0===this._items.length&&this.$stage.append(e),0!==this._items.length&&this._items[i-1].after(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[i].before(e),this._items.splice(i,0,e),this._mergers.splice(i,0,1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[s]&&this.reset(this._items[s].index()),this.invalidate("items"),this.trigger("added",{content:e,position:i})},n.prototype.remove=function(t){void 0!==(t=this.normalize(t,!0))&&(this.trigger("remove",{content:this._items[t],position:t}),this._items[t].remove(),this._items.splice(t,1),this._mergers.splice(t,1),this.invalidate("items"),this.trigger("removed",{content:null,position:t}))},n.prototype.preloadAutoWidthImages=function(e){e.each(t.proxy(function(e,i){this.enter("pre-loading"),i=t(i),t(new Image).one("load",t.proxy(function(t){i.attr("src",t.target.src),i.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",i.attr("src")||i.attr("data-src")||i.attr("data-src-retina"))},this))},n.prototype.destroy=function(){for(var s in this.$element.off(".owl.core"),this.$stage.off(".owl.core"),t(i).off(".owl.core"),!1!==this.settings.responsive&&(e.clearTimeout(this.resizeTimer),this.off(e,"resize",this._handlers.onThrottledResize)),this._plugins)this._plugins[s].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},n.prototype.op=function(t,e,i){var s=this.settings.rtl;switch(e){case"<":return s?t>i:t<i;case">":return s?t<i:t>i;case">=":return s?t<=i:t>=i;case"<=":return s?t>=i:t<=i}},n.prototype.on=function(t,e,i,s){t.addEventListener?t.addEventListener(e,i,s):t.attachEvent&&t.attachEvent("on"+e,i)},n.prototype.off=function(t,e,i,s){t.removeEventListener?t.removeEventListener(e,i,s):t.detachEvent&&t.detachEvent("on"+e,i)},n.prototype.trigger=function(e,i,s,o,r){var a={item:{count:this._items.length,index:this.current()}},h=t.camelCase(t.grep(["on",e,s],function(t){return t}).join("-").toLowerCase()),l=t.Event([e,"owl",s||"carousel"].join(".").toLowerCase(),t.extend({relatedTarget:this},a,i));return this._supress[e]||(t.each(this._plugins,function(t,e){e.onTrigger&&e.onTrigger(l)}),this.register({type:n.Type.Event,name:e}),this.$element.trigger(l),this.settings&&"function"==typeof this.settings[h]&&this.settings[h].call(this,l)),l},n.prototype.enter=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){void 0===this._states.current[e]&&(this._states.current[e]=0),this._states.current[e]++},this))},n.prototype.leave=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){this._states.current[e]--},this))},n.prototype.register=function(e){if(e.type===n.Type.Event){if(t.event.special[e.name]||(t.event.special[e.name]={}),!t.event.special[e.name].owl){var i=t.event.special[e.name]._default;t.event.special[e.name]._default=function(t){return!i||!i.apply||t.namespace&&-1!==t.namespace.indexOf("owl")?t.namespace&&t.namespace.indexOf("owl")>-1:i.apply(this,arguments)},t.event.special[e.name].owl=!0}}else e.type===n.Type.State&&(this._states.tags[e.name]?this._states.tags[e.name]=this._states.tags[e.name].concat(e.tags):this._states.tags[e.name]=e.tags,this._states.tags[e.name]=t.grep(this._states.tags[e.name],t.proxy(function(i,s){return t.inArray(i,this._states.tags[e.name])===s},this)))},n.prototype.suppress=function(e){t.each(e,t.proxy(function(t,e){this._supress[e]=!0},this))},n.prototype.release=function(e){t.each(e,t.proxy(function(t,e){delete this._supress[e]},this))},n.prototype.pointer=function(t){var i={x:null,y:null};return(t=(t=t.originalEvent||t||e.event).touches&&t.touches.length?t.touches[0]:t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t).pageX?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i},n.prototype.isNumeric=function(t){return!isNaN(parseFloat(t))},n.prototype.difference=function(t,e){return{x:t.x-e.x,y:t.y-e.y}},t.fn.owlCarousel=function(e){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var s=t(this),o=s.data("owl.carousel");o||(o=new n(this,"object"==typeof e&&e),s.data("owl.carousel",o),t.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(e,i){o.register({type:n.Type.Event,name:i}),o.$element.on(i+".owl.carousel.core",t.proxy(function(t){t.namespace&&t.relatedTarget!==this&&(this.suppress([i]),o[i].apply(this,[].slice.call(arguments,1)),this.release([i]))},o))})),"string"==typeof e&&"_"!==e.charAt(0)&&o[e].apply(o,i)})},t.fn.owlCarousel.Constructor=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={autoRefresh:!0,autoRefreshInterval:500},n.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=e.setInterval(t.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},n.prototype.refresh=function(){this._core.isVisible()!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},n.prototype.destroy=function(){var t,i;for(t in e.clearInterval(this._interval),this._handlers)this._core.$element.off(t,this._handlers[t]);for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoRefresh=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":t.proxy(function(e){if(e.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(e.property&&"position"==e.property.name||"initialized"==e.type)){var i=this._core.settings,s=i.center&&Math.ceil(i.items/2)||i.items,n=i.center&&-1*s||0,o=(e.property&&void 0!==e.property.value?e.property.value:this._core.current())+n,r=this._core.clones().length,a=t.proxy(function(t,e){this.load(e)},this);for(i.lazyLoadEager>0&&(s+=i.lazyLoadEager,i.loop&&(o-=i.lazyLoadEager,s++));n++<s;)this.load(r/2+this._core.relative(o)),r&&t.each(this._core.clones(this._core.relative(o)),a),o++}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={lazyLoad:!1,lazyLoadEager:0},n.prototype.load=function(i){var s=this._core.$stage.children().eq(i),n=s&&s.find(".owl-lazy");!n||t.inArray(s.get(0),this._loaded)>-1||(n.each(t.proxy(function(i,s){var n,o=t(s),r=e.devicePixelRatio>1&&o.attr("data-src-retina")||o.attr("data-src")||o.attr("data-srcset");this._core.trigger("load",{element:o,url:r},"lazy"),o.is("img")?o.one("load.owl.lazy",t.proxy(function(){o.css("opacity",1),this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("src",r):o.is("source")?o.one("load.owl.lazy",t.proxy(function(){this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("srcset",r):((n=new Image).onload=t.proxy(function(){o.css({"background-image":'url("'+r+'")',opacity:"1"}),this._core.trigger("loaded",{element:o,url:r},"lazy")},this),n.src=r)},this)),this._loaded.push(s.get(0)))},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this._core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Lazy=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(i){this._core=i,this._previousHeight=null,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&"position"===t.property.name&&this.update()},this),"loaded.owl.lazy":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&t.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var s=this;t(e).on("load",function(){s._core.settings.autoHeight&&s.update()}),t(e).resize(function(){s._core.settings.autoHeight&&(null!=s._intervalId&&clearTimeout(s._intervalId),s._intervalId=setTimeout(function(){s.update()},250))})};n.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},n.prototype.update=function(){var e=this._core._current,i=e+this._core.settings.items,s=this._core.settings.lazyLoad,n=this._core.$stage.children().toArray().slice(e,i),o=[],r=0;t.each(n,function(e,i){o.push(t(i).height())}),(r=Math.max.apply(null,o))<=1&&s&&this._previousHeight&&(r=this._previousHeight),this._previousHeight=r,this._core.$stage.parent().height(r).addClass(this._core.settings.autoHeightClass)},n.prototype.destroy=function(){var t,e;for(t in this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoHeight=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.video&&this.isInFullScreen()&&t.preventDefault()},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&"position"===t.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find(".owl-video");i.length&&(i.css("display","none"),this.fetch(i,t(e.content)))}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",t.proxy(function(t){this.play(t)},this))};n.Defaults={video:!1,videoHeight:!1,videoWidth:!1},n.prototype.fetch=function(t,e){var i=t.attr("data-vimeo-id")?"vimeo":t.attr("data-vzaar-id")?"vzaar":"youtube",s=t.attr("data-vimeo-id")||t.attr("data-youtube-id")||t.attr("data-vzaar-id"),n=t.attr("data-width")||this._core.settings.videoWidth,o=t.attr("data-height")||this._core.settings.videoHeight,r=t.attr("href");if(!r)throw new Error("Missing video URL.");if((s=r.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/))[3].indexOf("youtu")>-1)i="youtube";else if(s[3].indexOf("vimeo")>-1)i="vimeo";else{if(!(s[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");i="vzaar"}s=s[6],this._videos[r]={type:i,id:s,width:n,height:o},e.attr("data-video",r),this.thumbnail(t,this._videos[r])},n.prototype.thumbnail=function(e,i){var s,n,o=i.width&&i.height?"width:"+i.width+"px;height:"+i.height+"px;":"",r=e.find("img"),a="src",h="",l=this._core.settings,c=function(i){'<div class="owl-video-play-icon"></div>',s=l.lazyLoad?t("<div/>",{class:"owl-video-tn "+h,srcType:i}):t("<div/>",{class:"owl-video-tn",style:"opacity:1;background-image:url("+i+")"}),e.after(s),e.after('<div class="owl-video-play-icon"></div>')};if(e.wrap(t("<div/>",{class:"owl-video-wrapper",style:o})),this._core.settings.lazyLoad&&(a="data-src",h="owl-lazy"),r.length)return c(r.attr(a)),r.remove(),!1;"youtube"===i.type?(n="//img.youtube.com/vi/"+i.id+"/hqdefault.jpg",c(n)):"vimeo"===i.type?t.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){n=t[0].thumbnail_large,c(n)}}):"vzaar"===i.type&&t.ajax({type:"GET",url:"//vzaar.com/api/videos/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){n=t.framegrab_url,c(n)}})},n.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},n.prototype.play=function(e){var i,s=t(e.target).closest("."+this._core.settings.itemClass),n=this._videos[s.attr("data-video")],o=n.width||"100%",r=n.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),s=this._core.items(this._core.relative(s.index())),this._core.reset(s.index()),(i=t('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>')).attr("height",r),i.attr("width",o),"youtube"===n.type?i.attr("src","//www.youtube.com/embed/"+n.id+"?autoplay=1&rel=0&v="+n.id):"vimeo"===n.type?i.attr("src","//player.vimeo.com/video/"+n.id+"?autoplay=1"):"vzaar"===n.type&&i.attr("src","//view.vzaar.com/"+n.id+"/player?autoplay=true"),t(i).wrap('<div class="owl-video-frame" />').insertAfter(s.find(".owl-video")),this._playing=s.addClass("owl-video-playing"))},n.prototype.isInFullScreen=function(){var e=i.fullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement;return e&&t(e).parent().hasClass("owl-video-frame")},n.prototype.destroy=function(){var t,e;for(t in this._core.$element.off("click.owl.video"),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Video=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this.core=e,this.core.options=t.extend({},n.Defaults,this.core.options),this.swapping=!0,this.previous=void 0,this.next=void 0,this.handlers={"change.owl.carousel":t.proxy(function(t){t.namespace&&"position"==t.property.name&&(this.previous=this.core.current(),this.next=t.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":t.proxy(function(t){t.namespace&&(this.swapping="translated"==t.type)},this),"translate.owl.carousel":t.proxy(function(t){t.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};n.Defaults={animateOut:!1,animateIn:!1},n.prototype.swap=function(){if(1===this.core.settings.items&&t.support.animation&&t.support.transition){this.core.speed(0);var e,i=t.proxy(this.clear,this),s=this.core.$stage.children().eq(this.previous),n=this.core.$stage.children().eq(this.next),o=this.core.settings.animateIn,r=this.core.settings.animateOut;this.core.current()!==this.previous&&(r&&(e=this.core.coordinates(this.previous)-this.core.coordinates(this.next),s.one(t.support.animation.end,i).css({left:e+"px"}).addClass("animated owl-animated-out").addClass(r)),o&&n.one(t.support.animation.end,i).addClass("animated owl-animated-in").addClass(o))}},n.prototype.clear=function(e){t(e.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this.core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Animate=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={"changed.owl.carousel":t.proxy(function(t){t.namespace&&"settings"===t.property.name?this._core.settings.autoplay?this.play():this.stop():t.namespace&&"position"===t.property.name&&this._paused&&(this._time=0)},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":t.proxy(function(t,e,i){t.namespace&&this.play(e,i)},this),"stop.owl.autoplay":t.proxy(function(t){t.namespace&&this.stop()},this),"mouseover.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=t.extend({},n.Defaults,this._core.options)};n.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},n.prototype._next=function(s){this._call=e.setTimeout(t.proxy(this._next,this,s),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is("interacting")||i.hidden||this._core.next(s||this._core.settings.autoplaySpeed)},n.prototype.read=function(){return(new Date).getTime()-this._time},n.prototype.play=function(i,s){var n;this._core.is("rotating")||this._core.enter("rotating"),i=i||this._core.settings.autoplayTimeout,n=Math.min(this._time%(this._timeout||i),i),this._paused?(this._time=this.read(),this._paused=!1):e.clearTimeout(this._call),this._time+=this.read()%i-n,this._timeout=i,this._call=e.setTimeout(t.proxy(this._next,this,s),i-n)},n.prototype.stop=function(){this._core.is("rotating")&&(this._time=0,this._paused=!0,e.clearTimeout(this._call),this._core.leave("rotating"))},n.prototype.pause=function(){this._core.is("rotating")&&!this._paused&&(this._time=this.read(),this._paused=!0,e.clearTimeout(this._call))},n.prototype.destroy=function(){var t,e;for(t in this.stop(),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.autoplay=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(e){this._core=e,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":t.proxy(function(e){e.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+t(e.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,0,this._templates.pop())},this),"remove.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,1)},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&"position"==t.property.name&&this.draw()},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers)};n.Defaults={nav:!1,navText:['<span aria-label="Previous">&#x2039;</span>','<span aria-label="Next">&#x203a;</span>'],navSpeed:!1,navElement:'button type="button" role="presentation"',navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,changeItemOnClick:!1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},n.prototype.initialize=function(){var e,i=this._core.settings;if(this._controls.$relative=(i.navContainer?t(i.navContainer):t("<div>").addClass(i.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=t("<"+i.navElement+' value="previous item">').addClass(i.navClass[0]).html(i.navText[0]).prependTo(this._controls.$relative).on("click",t.proxy(function(t){this.prev(i.navSpeed)},this)),this._controls.$next=t("<"+i.navElement+' value="next item">').addClass(i.navClass[1]).html(i.navText[1]).appendTo(this._controls.$relative).on("click",t.proxy(function(t){this.next(i.navSpeed)},this)),i.changeItemOnClick){var s=this._core.$stage.children(),n=this._core.clones().length/2;s.on("click",t.proxy(function(e){var s=t(e.currentTarget).index();this.to(s-n,i.navSpeed,!0)},this))}for(e in i.dotsData||(this._templates=[t('<button role="button">').addClass(i.dotClass).append(t("<span>")).prop("outerHTML")]),this._controls.$absolute=(i.dotsContainer?t(i.dotsContainer):t("<div>").addClass(i.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","button",t.proxy(function(e){var s=t(e.target).parent().is(this._controls.$absolute)?t(e.target).index():t(e.target).parent().index();console.log(t(e.target).index()),e.preventDefault(),this.to(s,i.dotsSpeed)},this)),this._overrides)this._core[e]=t.proxy(this[e],this)},n.prototype.destroy=function(){var t,e,i,s,n;for(t in n=this._core.settings,this._handlers)this.$element.off(t,this._handlers[t]);for(e in this._controls)"$relative"===e&&n.navContainer?this._controls[e].html(""):this._controls[e].remove();for(s in this.overides)this._core[s]=this._overrides[s];for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},n.prototype.update=function(){var t,e,i=this._core.clones().length/2,s=i+this._core.items().length,n=this._core.maximum(!0),o=this._core.settings,r=o.center||o.autoWidth||o.dotsData?1:o.dotsEach||o.items;if("page"!==o.slideBy&&(o.slideBy=Math.min(o.slideBy,o.items)),o.dots||"page"==o.slideBy)for(this._pages=[],t=i,e=0,0;t<s;t++){if(e>=r||0===e){if(this._pages.push({start:Math.min(n,t-i),end:t-i+r-1}),Math.min(n,t-i)===n)break;e=0,0}e+=this._core.mergers(this._core.relative(t))}},n.prototype.draw=function(){var e,i=this._core.settings,s=this._core.items().length<=i.items,n=this._core.relative(this._core.current()),o=i.loop||i.rewind;this._controls.$relative.toggleClass("disabled",!i.nav||s),i.nav&&(this._controls.$previous.toggleClass("disabled",!o&&n<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!o&&n>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!i.dots||s),i.dots&&(e=this._pages.length-this._controls.$absolute.children().length,i.dotsData&&0!==e?this._controls.$absolute.html(this._templates.join("")):e>0?this._controls.$absolute.append(new Array(e+1).join(this._templates[0])):e<0&&this._controls.$absolute.children().slice(e).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(t.inArray(this.current(),this._pages)).addClass("active"))},n.prototype.onTrigger=function(e){var i=this._core.settings;e.page={index:t.inArray(this.current(),this._pages),count:this._pages.length,size:i&&(i.center||i.autoWidth||i.dotsData?1:i.dotsEach||i.items)}},n.prototype.current=function(){var e=this._core.relative(this._core.current());return t.grep(this._pages,t.proxy(function(t,i){return t.start<=e&&t.end>=e},this)).pop()},n.prototype.getPosition=function(e){var i,s,n=this._core.settings;return"page"==n.slideBy?(i=t.inArray(this.current(),this._pages),s=this._pages.length,e?++i:--i,i=this._pages[(i%s+s)%s].start):(i=this._core.relative(this._core.current()),s=this._core.items().length,e?i+=n.slideBy:i-=n.slideBy),i},n.prototype.next=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!0),e)},n.prototype.prev=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!1),e)},n.prototype.to=function(e,i,s){var n;!s&&this._pages.length?(n=this._pages.length,t.proxy(this._overrides.to,this._core)(this._pages[(e%n+n)%n].start,i)):t.proxy(this._overrides.to,this._core)(e,i)},t.fn.owlCarousel.Constructor.Plugins.Navigation=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(i){this._core=i,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":t.proxy(function(i){i.namespace&&"URLHash"===this._core.settings.startPosition&&t(e).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!i)return;this._hashes[i]=e.content}},this),"changed.owl.carousel":t.proxy(function(i){if(i.namespace&&"position"===i.property.name){var s=this._core.items(this._core.relative(this._core.current())),n=t.map(this._hashes,function(t,e){return t===s?e:null}).join();if(!n||e.location.hash.slice(1)===n)return;e.location.hash=n}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers),t(e).on("hashchange.owl.navigation",t.proxy(function(t){var i=e.location.hash.substring(1),s=this._core.$stage.children(),n=this._hashes[i]&&s.index(this._hashes[i]);void 0!==n&&n!==this._core.current()&&this._core.to(this._core.relative(n),!1,!0)},this))};n.Defaults={URLhashListener:!1},n.prototype.destroy=function(){var i,s;for(i in t(e).off("hashchange.owl.navigation"),this._handlers)this._core.$element.off(i,this._handlers[i]);for(s in Object.getOwnPropertyNames(this))"function"!=typeof this[s]&&(this[s]=null)},t.fn.owlCarousel.Constructor.Plugins.Hash=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=t("<support>").get(0).style,o="Webkit Moz O ms".split(" "),r={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},a=function(){return!!c("transform")},h=function(){return!!c("perspective")},l=function(){return!!c("animation")};function c(e,i){var r=!1,a=e.charAt(0).toUpperCase()+e.slice(1);return t.each((e+" "+o.join(a+" ")+a).split(" "),function(t,e){if(n[e]!==s)return r=!i||e,!1}),r}function p(t){return c(t,!0)}(function(){return!!c("transition")})()&&(t.support.transition=new String(p("transition")),t.support.transition.end=r.transition.end[t.support.transition]),l()&&(t.support.animation=new String(p("animation")),t.support.animation.end=r.animation.end[t.support.animation]),a()&&(t.support.transform=new String(p("transform")),t.support.transform3d=h())}(window.Zepto||window.jQuery,window,document);
1
  /**
2
+ * Owl Carousel v2.3.6 - UE4
3
  * Copyright 2013-2018 David Deutsch
4
  * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
  */
16
  * @todo stagePadding calculate wrong active classes
17
  */
18
 
19
+ !function(t,e,i,s){function n(e,i){this.settings=null,this.options=t.extend({},n.Defaults,i),this.$element=t(e),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},t.each(["onResize","onThrottledResize"],t.proxy(function(e,i){this._handlers[i]=t.proxy(this[i],this)},this)),t.each(n.Plugins,t.proxy(function(t,e){this._plugins[t.charAt(0).toLowerCase()+t.slice(1)]=new e(this)},this)),t.each(n.Workers,t.proxy(function(e,i){this._pipe.push({filter:i.filter,run:t.proxy(i.run,this)})},this)),this.setup(),this.initialize()}n.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,setActiveClass:!0,setActiveClassOnMobile:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:e,fallbackEasing:"swing",slideTransition:"",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab",shuffle:!1},n.Width={Default:"default",Inner:"inner",Outer:"outer"},n.Type={Event:"event",State:"state"},n.Plugins={},n.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(t){t.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(t){var e=this.settings.margin||"",i=!this.settings.autoWidth,s=this.settings.rtl,n={width:"auto","margin-left":s?e:"","margin-right":s?"":e};!i&&this.$stage.children().css(n),t.css=n}},{filter:["width","items","settings"],run:function(t){var e=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,i=null,s=this._items.length,n=!this.settings.autoWidth,o=[];for(t.items={merge:!1,width:e};s--;)i=this._mergers[s],i=this.settings.mergeFit&&Math.min(i,this.settings.items)||i,t.items.merge=i>1||t.items.merge,o[s]=n?e*i:this._items[s].width();this._widths=o}},{filter:["items","settings"],run:function(){var e=[],i=this._items,s=this.settings,n=Math.max(2*s.items,4),o=2*Math.ceil(i.length/2),r=s.loop&&i.length?s.rewind?n:Math.max(n,o):0,a="",h="";for(r/=2;r>0;)e.push(this.normalize(e.length/2,!0)),a+=i[e[e.length-1]][0].outerHTML,e.push(this.normalize(i.length-1-(e.length-1)/2,!0)),h=i[e[e.length-1]][0].outerHTML+h,r-=1;this._clones=e,t(a).addClass("cloned").appendTo(this.$stage),t(h).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var t=this.settings.rtl?1:-1,e=this._clones.length+this._items.length,i=-1,s=0,n=0,o=[];++i<e;)s=o[i-1]||0,n=this._widths[this.relative(i)]+this.settings.margin,o.push(s+n*t);this._coordinates=o}},{filter:["width","items","settings"],run:function(){var t=this.settings.stagePadding,e=this._coordinates,i={width:Math.ceil(Math.abs(e[e.length-1]))+2*t,"padding-left":t||"","padding-right":t||""};this.$stage.css(i)}},{filter:["width","items","settings"],run:function(t){var e=this._coordinates.length,i=!this.settings.autoWidth,s=this.$stage.children();if(i&&t.items.merge)for(;e--;)t.css.width=this._widths[this.relative(e)],s.eq(e).css(t.css);else i&&(t.css.width=t.items.width,s.css(t.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(t){t.current=t.current?this.$stage.children().index(t.current):0,t.current=Math.max(this.minimum(),Math.min(this.maximum(),t.current)),this.reset(t.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var t,e,i,s,n=this.settings.rtl?1:-1,o=2*this.settings.stagePadding,r=this.coordinates(this.current())+o,a=r+this.width()*n,h=[];for(i=0,s=this._coordinates.length;i<s;i++)t=this._coordinates[i-1]||0,e=Math.abs(this._coordinates[i])+o*n,(this.op(t,"<=",r)&&this.op(t,">",a)||this.op(e,"<",r)&&this.op(e,">",a))&&h.push(i);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+h.join("), :eq(")+")").addClass("active"),this.$stage.children(".center").removeClass("center"),this.settings.center&&this.$stage.children().eq(this.current()).addClass("center")}},{filter:["width","position","items","settings"],run:function(){if(this.settings.setActiveClass&&this.settings.setActiveClass){var t=!0;this.settings.setActiveClassOnMobile?1==this.$stage.children(".active").length&&(t=!0):this.settings.setActiveClassOnMobile||1==this.$stage.children(".active").length&&(t=!1),1==t?this.$stage.children().eq(this.current()).addClass("uc-active-item").siblings().removeClass("uc-active-item"):0==t&&this.$stage.children().removeClass("uc-active-item")}}}],n.prototype.initializeStage=function(){this.$stage=this.$element.find("."+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=t("<"+this.settings.stageElement+">",{class:this.settings.stageClass}).wrap(t("<div/>",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},n.prototype.initializeItems=function(){var e=this.$element.find(".owl-item");if(e.length)return this._items=e.get().map(function(e){return t(e)}),this._mergers=this._items.map(function(){return 1}),void this.refresh();this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},n.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.shuffle){var t=this.$element;t.children().sort(function(){return Math.round(Math.random())-.5}).each(function(){t.append(this)})}var e,i,s;this.settings.autoWidth&&!this.is("pre-loading")&&(e=this.$element.find("img"),i=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:void 0,s=this.$element.children(i).width(),e.length&&s<=0&&this.preloadAutoWidthImages(e));this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},n.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(":visible")},n.prototype.setup=function(){var e=this.viewport(),i=this.options.responsive,s=-1,n=null;i?(t.each(i,function(t){t<=e&&t>s&&(s=Number(t))}),"function"==typeof(n=t.extend({},this.options,i[s])).stagePadding&&(n.stagePadding=n.stagePadding()),delete n.responsive,n.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+s))):n=t.extend({},this.options),this.trigger("change",{property:{name:"settings",value:n}}),this._breakpoint=s,this.settings=n,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},n.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},n.prototype.prepare=function(e){var i=this.trigger("prepare",{content:e});return i.data||(i.data=t("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(e)),this.trigger("prepared",{content:i.data}),i.data},n.prototype.update=function(){for(var e=0,i=this._pipe.length,s=t.proxy(function(t){return this[t]},this._invalidated),n={};e<i;)(this._invalidated.all||t.grep(this._pipe[e].filter,s).length>0)&&this._pipe[e].run(n),e++;this._invalidated={},!this.is("valid")&&this.enter("valid")},n.prototype.width=function(t){switch(t=t||n.Width.Default){case n.Width.Inner:case n.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},n.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},n.prototype.onThrottledResize=function(){e.clearTimeout(this.resizeTimer),this.resizeTimer=e.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},n.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.isVisible()&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},n.prototype.registerEventHandlers=function(){t.support.transition&&this.$stage.on(t.support.transition.end+".owl.core",t.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&&this.on(e,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",t.proxy(this.onDragEnd,this)))},n.prototype.onDragStart=function(e){var s=null;3!==e.which&&(t.support.transform?s={x:(s=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","))[16===s.length?12:4],y:s[16===s.length?13:5]}:(s=this.$stage.position(),s={x:this.settings.rtl?s.left+this.$stage.width()-this.width()+this.settings.margin:s.left,y:s.top}),this.is("animating")&&(t.support.transform?this.animate(s.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===e.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=t(e.target),this._drag.stage.start=s,this._drag.stage.current=s,this._drag.pointer=this.pointer(e),t(i).on("mouseup.owl.core touchend.owl.core",t.proxy(this.onDragEnd,this)),t(i).one("mousemove.owl.core touchmove.owl.core",t.proxy(function(e){var s=this.difference(this._drag.pointer,this.pointer(e));t(i).on("mousemove.owl.core touchmove.owl.core",t.proxy(this.onDragMove,this)),Math.abs(s.x)<Math.abs(s.y)&&this.is("valid")||(e.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},n.prototype.onDragMove=function(t){var e=null,i=null,s=null,n=this.difference(this._drag.pointer,this.pointer(t)),o=this.difference(this._drag.stage.start,n);this.is("dragging")&&(t.preventDefault(),this.settings.loop?(e=this.coordinates(this.minimum()),i=this.coordinates(this.maximum()+1)-e,o.x=((o.x-e)%i+i)%i+e):(e=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),i=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),s=this.settings.pullDrag?-1*n.x/5:0,o.x=Math.max(Math.min(o.x,e+s),i+s)),this._drag.stage.current=o,this.animate(o.x))},n.prototype.onDragEnd=function(e){var s=this.difference(this._drag.pointer,this.pointer(e)),n=this._drag.stage.current,o=s.x>0^this.settings.rtl?"left":"right";t(i).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==s.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(n.x,0!==s.x?o:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=o,(Math.abs(s.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},n.prototype.closest=function(e,i){var s=-1,n=this.width(),o=this.coordinates();return this.settings.freeDrag||t.each(o,t.proxy(function(t,r){return"left"===i&&e>r-30&&e<r+30?s=t:"right"===i&&e>r-n-30&&e<r-n+30?s=t+1:this.op(e,"<",r)&&this.op(e,">",void 0!==o[t+1]?o[t+1]:r-n)&&(s="left"===i?t+1:t),-1===s},this)),this.settings.loop||(this.op(e,">",o[this.minimum()])?s=e=this.minimum():this.op(e,"<",o[this.maximum()])&&(s=e=this.maximum())),s},n.prototype.animate=function(e){var i=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),i&&(this.enter("animating"),this.trigger("translate")),t.support.transform3d&&t.support.transition?this.$stage.css({transform:"translate3d("+e+"px,0px,0px)",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")}):i?this.$stage.animate({left:e+"px"},this.speed(),this.settings.fallbackEasing,t.proxy(this.onTransitionEnd,this)):this.$stage.css({left:e+"px"})},n.prototype.is=function(t){return this._states.current[t]&&this._states.current[t]>0},n.prototype.current=function(t){if(void 0===t)return this._current;if(0!==this._items.length){if(t=this.normalize(t),this._current!==t){var e=this.trigger("change",{property:{name:"position",value:t}});void 0!==e.data&&(t=this.normalize(e.data)),this._current=t,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current}},n.prototype.invalidate=function(e){return"string"===t.type(e)&&(this._invalidated[e]=!0,this.is("valid")&&this.leave("valid")),t.map(this._invalidated,function(t,e){return e})},n.prototype.reset=function(t){void 0!==(t=this.normalize(t))&&(this._speed=0,this._current=t,this.suppress(["translate","translated"]),this.animate(this.coordinates(t)),this.release(["translate","translated"]))},n.prototype.normalize=function(t,e){var i=this._items.length,s=e?0:this._clones.length;return!this.isNumeric(t)||i<1?t=void 0:(t<0||t>=i+s)&&(t=((t-s/2)%i+i)%i+s/2),t},n.prototype.relative=function(t){return t-=this._clones.length/2,this.normalize(t,!0)},n.prototype.maximum=function(t){var e,i,s,n=this.settings,o=this._coordinates.length;if(n.loop)o=this._clones.length/2+this._items.length-1;else if(n.autoWidth||n.merge){if(e=this._items.length)for(i=this._items[--e].width(),s=this.$element.width();e--&&!((i+=this._items[e].width()+this.settings.margin)>s););o=e+1}else o=n.center?this._items.length-1:this._items.length-n.items;return t&&(o-=this._clones.length/2),Math.max(o,0)},n.prototype.minimum=function(t){return t?0:this._clones.length/2},n.prototype.items=function(t){return void 0===t?this._items.slice():(t=this.normalize(t,!0),this._items[t])},n.prototype.mergers=function(t){return void 0===t?this._mergers.slice():(t=this.normalize(t,!0),this._mergers[t])},n.prototype.clones=function(e){var i=this._clones.length/2,s=i+this._items.length,n=function(t){return t%2==0?s+t/2:i-(t+1)/2};return void 0===e?t.map(this._clones,function(t,e){return n(e)}):t.map(this._clones,function(t,i){return t===e?n(i):null})},n.prototype.speed=function(t){return void 0!==t&&(this._speed=t),this._speed},n.prototype.coordinates=function(e){var i,s=1,n=e-1;return void 0===e?t.map(this._coordinates,t.proxy(function(t,e){return this.coordinates(e)},this)):(this.settings.center?(this.settings.rtl&&(s=-1,n=e+1),i=this._coordinates[e],i+=(this.width()-i+(this._coordinates[n]||0))/2*s):i=this._coordinates[n]||0,i=Math.ceil(i))},n.prototype.duration=function(t,e,i){return 0===i?0:Math.min(Math.max(Math.abs(e-t),1),6)*Math.abs(i||this.settings.smartSpeed)},n.prototype.to=function(t,e){var i=this.current(),s=null,n=t-this.relative(i),o=(n>0)-(n<0),r=this._items.length,a=this.minimum(),h=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(n)>r/2&&(n+=-1*o*r),(s=(((t=i+n)-a)%r+r)%r+a)!==t&&s-n<=h&&s-n>0&&(i=s-n,t=s,this.reset(i))):t=this.settings.rewind?(t%(h+=1)+h)%h:Math.max(a,Math.min(h,t)),this.speed(this.duration(i,t,e)),this.current(t),this.isVisible()&&this.update()},n.prototype.next=function(t){t=t||!1,this.to(this.relative(this.current())+1,t)},n.prototype.prev=function(t){t=t||!1,this.to(this.relative(this.current())-1,t)},n.prototype.onTransitionEnd=function(t){if(void 0!==t&&(t.stopPropagation(),(t.target||t.srcElement||t.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},n.prototype.viewport=function(){var s;return this.options.responsiveBaseElement!==e?s=t(this.options.responsiveBaseElement).width():e.innerWidth?s=e.innerWidth:i.documentElement&&i.documentElement.clientWidth?s=i.documentElement.clientWidth:console.warn("Can not detect viewport width."),s},n.prototype.replace=function(e){this.$stage.empty(),this._items=[],e&&(e=e instanceof jQuery?e:t(e)),this.settings.nestedItemSelector&&(e=e.find("."+this.settings.nestedItemSelector)),e.filter(function(){return 1===this.nodeType}).each(t.proxy(function(t,e){e=this.prepare(e),this.$stage.append(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},n.prototype.add=function(e,i){var s=this.relative(this._current);i=void 0===i?this._items.length:this.normalize(i,!0),e=e instanceof jQuery?e:t(e),this.trigger("add",{content:e,position:i}),e=this.prepare(e),0===this._items.length||i===this._items.length?(0===this._items.length&&this.$stage.append(e),0!==this._items.length&&this._items[i-1].after(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[i].before(e),this._items.splice(i,0,e),this._mergers.splice(i,0,1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[s]&&this.reset(this._items[s].index()),this.invalidate("items"),this.trigger("added",{content:e,position:i})},n.prototype.remove=function(t){void 0!==(t=this.normalize(t,!0))&&(this.trigger("remove",{content:this._items[t],position:t}),this._items[t].remove(),this._items.splice(t,1),this._mergers.splice(t,1),this.invalidate("items"),this.trigger("removed",{content:null,position:t}))},n.prototype.preloadAutoWidthImages=function(e){e.each(t.proxy(function(e,i){this.enter("pre-loading"),i=t(i),t(new Image).one("load",t.proxy(function(t){i.attr("src",t.target.src),i.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",i.attr("src")||i.attr("data-src")||i.attr("data-src-retina"))},this))},n.prototype.destroy=function(){for(var s in this.$element.off(".owl.core"),this.$stage.off(".owl.core"),t(i).off(".owl.core"),!1!==this.settings.responsive&&(e.clearTimeout(this.resizeTimer),this.off(e,"resize",this._handlers.onThrottledResize)),this._plugins)this._plugins[s].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},n.prototype.op=function(t,e,i){var s=this.settings.rtl;switch(e){case"<":return s?t>i:t<i;case">":return s?t<i:t>i;case">=":return s?t<=i:t>=i;case"<=":return s?t>=i:t<=i}},n.prototype.on=function(t,e,i,s){t.addEventListener?t.addEventListener(e,i,s):t.attachEvent&&t.attachEvent("on"+e,i)},n.prototype.off=function(t,e,i,s){t.removeEventListener?t.removeEventListener(e,i,s):t.detachEvent&&t.detachEvent("on"+e,i)},n.prototype.trigger=function(e,i,s,o,r){var a={item:{count:this._items.length,index:this.current()}},h=t.camelCase(t.grep(["on",e,s],function(t){return t}).join("-").toLowerCase()),l=t.Event([e,"owl",s||"carousel"].join(".").toLowerCase(),t.extend({relatedTarget:this},a,i));return this._supress[e]||(t.each(this._plugins,function(t,e){e.onTrigger&&e.onTrigger(l)}),this.register({type:n.Type.Event,name:e}),this.$element.trigger(l),this.settings&&"function"==typeof this.settings[h]&&this.settings[h].call(this,l)),l},n.prototype.enter=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){void 0===this._states.current[e]&&(this._states.current[e]=0),this._states.current[e]++},this))},n.prototype.leave=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){this._states.current[e]--},this))},n.prototype.register=function(e){if(e.type===n.Type.Event){if(t.event.special[e.name]||(t.event.special[e.name]={}),!t.event.special[e.name].owl){var i=t.event.special[e.name]._default;t.event.special[e.name]._default=function(t){return!i||!i.apply||t.namespace&&-1!==t.namespace.indexOf("owl")?t.namespace&&t.namespace.indexOf("owl")>-1:i.apply(this,arguments)},t.event.special[e.name].owl=!0}}else e.type===n.Type.State&&(this._states.tags[e.name]?this._states.tags[e.name]=this._states.tags[e.name].concat(e.tags):this._states.tags[e.name]=e.tags,this._states.tags[e.name]=t.grep(this._states.tags[e.name],t.proxy(function(i,s){return t.inArray(i,this._states.tags[e.name])===s},this)))},n.prototype.suppress=function(e){t.each(e,t.proxy(function(t,e){this._supress[e]=!0},this))},n.prototype.release=function(e){t.each(e,t.proxy(function(t,e){delete this._supress[e]},this))},n.prototype.pointer=function(t){var i={x:null,y:null};return(t=(t=t.originalEvent||t||e.event).touches&&t.touches.length?t.touches[0]:t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t).pageX?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i},n.prototype.isNumeric=function(t){return!isNaN(parseFloat(t))},n.prototype.difference=function(t,e){return{x:t.x-e.x,y:t.y-e.y}},t.fn.owlCarousel=function(e){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var s=t(this),o=s.data("owl.carousel");o||(o=new n(this,"object"==typeof e&&e),s.data("owl.carousel",o),t.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(e,i){o.register({type:n.Type.Event,name:i}),o.$element.on(i+".owl.carousel.core",t.proxy(function(t){t.namespace&&t.relatedTarget!==this&&(this.suppress([i]),o[i].apply(this,[].slice.call(arguments,1)),this.release([i]))},o))})),"string"==typeof e&&"_"!==e.charAt(0)&&o[e].apply(o,i)})},t.fn.owlCarousel.Constructor=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={autoRefresh:!0,autoRefreshInterval:500},n.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=e.setInterval(t.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},n.prototype.refresh=function(){this._core.isVisible()!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},n.prototype.destroy=function(){var t,i;for(t in e.clearInterval(this._interval),this._handlers)this._core.$element.off(t,this._handlers[t]);for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoRefresh=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":t.proxy(function(e){if(e.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(e.property&&"position"==e.property.name||"initialized"==e.type)){var i=this._core.settings,s=i.center&&Math.ceil(i.items/2)||i.items,n=i.center&&-1*s||0,o=(e.property&&void 0!==e.property.value?e.property.value:this._core.current())+n,r=this._core.clones().length,a=t.proxy(function(t,e){this.load(e)},this);for(i.lazyLoadEager>0&&(s+=i.lazyLoadEager,i.loop&&(o-=i.lazyLoadEager,s++));n++<s;)this.load(r/2+this._core.relative(o)),r&&t.each(this._core.clones(this._core.relative(o)),a),o++}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={lazyLoad:!1,lazyLoadEager:0},n.prototype.load=function(i){var s=this._core.$stage.children().eq(i),n=s&&s.find(".owl-lazy");!n||t.inArray(s.get(0),this._loaded)>-1||(n.each(t.proxy(function(i,s){var n,o=t(s),r=e.devicePixelRatio>1&&o.attr("data-src-retina")||o.attr("data-src")||o.attr("data-srcset");this._core.trigger("load",{element:o,url:r},"lazy"),o.is("img")?o.one("load.owl.lazy",t.proxy(function(){o.css("opacity",1),this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("src",r):o.is("source")?o.one("load.owl.lazy",t.proxy(function(){this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("srcset",r):((n=new Image).onload=t.proxy(function(){o.css({"background-image":'url("'+r+'")',opacity:"1"}),this._core.trigger("loaded",{element:o,url:r},"lazy")},this),n.src=r)},this)),this._loaded.push(s.get(0)))},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this._core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Lazy=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(i){this._core=i,this._previousHeight=null,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&"position"===t.property.name&&this.update()},this),"loaded.owl.lazy":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&t.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var s=this;t(e).on("load",function(){s._core.settings.autoHeight&&s.update()}),t(e).resize(function(){s._core.settings.autoHeight&&(null!=s._intervalId&&clearTimeout(s._intervalId),s._intervalId=setTimeout(function(){s.update()},250))})};n.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},n.prototype.update=function(){var e=this._core._current,i=e+this._core.settings.items,s=this._core.settings.lazyLoad,n=this._core.$stage.children().toArray().slice(e,i),o=[],r=0;t.each(n,function(e,i){o.push(t(i).height())}),(r=Math.max.apply(null,o))<=1&&s&&this._previousHeight&&(r=this._previousHeight),this._previousHeight=r,this._core.$stage.parent().height(r).addClass(this._core.settings.autoHeightClass)},n.prototype.destroy=function(){var t,e;for(t in this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoHeight=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.video&&this.isInFullScreen()&&t.preventDefault()},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&"position"===t.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find(".owl-video");i.length&&(i.css("display","none"),this.fetch(i,t(e.content)))}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",t.proxy(function(t){this.play(t)},this))};n.Defaults={video:!1,videoHeight:!1,videoWidth:!1},n.prototype.fetch=function(t,e){var i=t.attr("data-vimeo-id")?"vimeo":t.attr("data-vzaar-id")?"vzaar":"youtube",s=t.attr("data-vimeo-id")||t.attr("data-youtube-id")||t.attr("data-vzaar-id"),n=t.attr("data-width")||this._core.settings.videoWidth,o=t.attr("data-height")||this._core.settings.videoHeight,r=t.attr("href");if(!r)throw new Error("Missing video URL.");if((s=r.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/))[3].indexOf("youtu")>-1)i="youtube";else if(s[3].indexOf("vimeo")>-1)i="vimeo";else{if(!(s[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");i="vzaar"}s=s[6],this._videos[r]={type:i,id:s,width:n,height:o},e.attr("data-video",r),this.thumbnail(t,this._videos[r])},n.prototype.thumbnail=function(e,i){var s,n,o=i.width&&i.height?"width:"+i.width+"px;height:"+i.height+"px;":"",r=e.find("img"),a="src",h="",l=this._core.settings,c=function(i){'<div class="owl-video-play-icon"></div>',s=l.lazyLoad?t("<div/>",{class:"owl-video-tn "+h,srcType:i}):t("<div/>",{class:"owl-video-tn",style:"opacity:1;background-image:url("+i+")"}),e.after(s),e.after('<div class="owl-video-play-icon"></div>')};if(e.wrap(t("<div/>",{class:"owl-video-wrapper",style:o})),this._core.settings.lazyLoad&&(a="data-src",h="owl-lazy"),r.length)return c(r.attr(a)),r.remove(),!1;"youtube"===i.type?(n="//img.youtube.com/vi/"+i.id+"/hqdefault.jpg",c(n)):"vimeo"===i.type?t.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){n=t[0].thumbnail_large,c(n)}}):"vzaar"===i.type&&t.ajax({type:"GET",url:"//vzaar.com/api/videos/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){n=t.framegrab_url,c(n)}})},n.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},n.prototype.play=function(e){var i,s=t(e.target).closest("."+this._core.settings.itemClass),n=this._videos[s.attr("data-video")],o=n.width||"100%",r=n.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),s=this._core.items(this._core.relative(s.index())),this._core.reset(s.index()),(i=t('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>')).attr("height",r),i.attr("width",o),"youtube"===n.type?i.attr("src","//www.youtube.com/embed/"+n.id+"?autoplay=1&rel=0&v="+n.id):"vimeo"===n.type?i.attr("src","//player.vimeo.com/video/"+n.id+"?autoplay=1"):"vzaar"===n.type&&i.attr("src","//view.vzaar.com/"+n.id+"/player?autoplay=true"),t(i).wrap('<div class="owl-video-frame" />').insertAfter(s.find(".owl-video")),this._playing=s.addClass("owl-video-playing"))},n.prototype.isInFullScreen=function(){var e=i.fullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement;return e&&t(e).parent().hasClass("owl-video-frame")},n.prototype.destroy=function(){var t,e;for(t in this._core.$element.off("click.owl.video"),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Video=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this.core=e,this.core.options=t.extend({},n.Defaults,this.core.options),this.swapping=!0,this.previous=void 0,this.next=void 0,this.handlers={"change.owl.carousel":t.proxy(function(t){t.namespace&&"position"==t.property.name&&(this.previous=this.core.current(),this.next=t.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":t.proxy(function(t){t.namespace&&(this.swapping="translated"==t.type)},this),"translate.owl.carousel":t.proxy(function(t){t.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};n.Defaults={animateOut:!1,animateIn:!1},n.prototype.swap=function(){if(1===this.core.settings.items&&t.support.animation&&t.support.transition){this.core.speed(0);var e,i=t.proxy(this.clear,this),s=this.core.$stage.children().eq(this.previous),n=this.core.$stage.children().eq(this.next),o=this.core.settings.animateIn,r=this.core.settings.animateOut;this.core.current()!==this.previous&&(r&&(e=this.core.coordinates(this.previous)-this.core.coordinates(this.next),s.one(t.support.animation.end,i).css({left:e+"px"}).addClass("animated owl-animated-out").addClass(r)),o&&n.one(t.support.animation.end,i).addClass("animated owl-animated-in").addClass(o))}},n.prototype.clear=function(e){t(e.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this.core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Animate=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={"changed.owl.carousel":t.proxy(function(t){t.namespace&&"settings"===t.property.name?this._core.settings.autoplay?this.play():this.stop():t.namespace&&"position"===t.property.name&&this._paused&&(this._time=0)},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":t.proxy(function(t,e,i){t.namespace&&this.play(e,i)},this),"stop.owl.autoplay":t.proxy(function(t){t.namespace&&this.stop()},this),"mouseover.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=t.extend({},n.Defaults,this._core.options)};n.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},n.prototype._next=function(s){this._call=e.setTimeout(t.proxy(this._next,this,s),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is("interacting")||i.hidden||this._core.next(s||this._core.settings.autoplaySpeed)},n.prototype.read=function(){return(new Date).getTime()-this._time},n.prototype.play=function(i,s){var n;this._core.is("rotating")||this._core.enter("rotating"),i=i||this._core.settings.autoplayTimeout,n=Math.min(this._time%(this._timeout||i),i),this._paused?(this._time=this.read(),this._paused=!1):e.clearTimeout(this._call),this._time+=this.read()%i-n,this._timeout=i,this._call=e.setTimeout(t.proxy(this._next,this,s),i-n)},n.prototype.stop=function(){this._core.is("rotating")&&(this._time=0,this._paused=!0,e.clearTimeout(this._call),this._core.leave("rotating"))},n.prototype.pause=function(){this._core.is("rotating")&&!this._paused&&(this._time=this.read(),this._paused=!0,e.clearTimeout(this._call))},n.prototype.destroy=function(){var t,e;for(t in this.stop(),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.autoplay=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(e){this._core=e,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":t.proxy(function(e){e.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+t(e.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,0,this._templates.pop())},this),"remove.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,1)},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&"position"==t.property.name&&this.draw()},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers)};n.Defaults={nav:!1,navText:['<span aria-label="Previous">&#x2039;</span>','<span aria-label="Next">&#x203a;</span>'],navSpeed:!1,navElement:'button type="button" role="presentation"',navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,changeItemOnClick:!1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},n.prototype.initialize=function(){var e,i=this._core.settings;if(this._controls.$relative=(i.navContainer?t(i.navContainer):t("<div>").addClass(i.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=t("<"+i.navElement+' value="previous item" title="previous item">').addClass(i.navClass[0]).html(i.navText[0]).prependTo(this._controls.$relative).on("click",t.proxy(function(t){this.prev(i.navSpeed)},this)),this._controls.$next=t("<"+i.navElement+' value="next item" title="next item">').addClass(i.navClass[1]).html(i.navText[1]).appendTo(this._controls.$relative).on("click",t.proxy(function(t){this.next(i.navSpeed)},this)),i.changeItemOnClick){var s=this._core.$stage.children(),n=this._core.clones().length/2;s.on("click",t.proxy(function(e){var s=t(e.currentTarget).index();this.to(s-n,i.navSpeed,!0)},this))}for(e in i.dotsData||(this._templates=[t('<button role="button">').addClass(i.dotClass).append(t("<span>")).prop("outerHTML")]),this._controls.$absolute=(i.dotsContainer?t(i.dotsContainer):t("<div>").addClass(i.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","button",t.proxy(function(e){var s=t(e.target).parent().is(this._controls.$absolute)?t(e.target).index():t(e.target).parent().index();console.log(t(e.target).index()),e.preventDefault(),this.to(s,i.dotsSpeed)},this)),this._overrides)this._core[e]=t.proxy(this[e],this)},n.prototype.destroy=function(){var t,e,i,s,n;for(t in n=this._core.settings,this._handlers)this.$element.off(t,this._handlers[t]);for(e in this._controls)"$relative"===e&&n.navContainer?this._controls[e].html(""):this._controls[e].remove();for(s in this.overides)this._core[s]=this._overrides[s];for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},n.prototype.update=function(){var t,e,i=this._core.clones().length/2,s=i+this._core.items().length,n=this._core.maximum(!0),o=this._core.settings,r=o.center||o.autoWidth||o.dotsData?1:o.dotsEach||o.items;if("page"!==o.slideBy&&(o.slideBy=Math.min(o.slideBy,o.items)),o.dots||"page"==o.slideBy)for(this._pages=[],t=i,e=0,0;t<s;t++){if(e>=r||0===e){if(this._pages.push({start:Math.min(n,t-i),end:t-i+r-1}),Math.min(n,t-i)===n)break;e=0,0}e+=this._core.mergers(this._core.relative(t))}},n.prototype.draw=function(){var e,i=this._core.settings,s=this._core.items().length<=i.items,n=this._core.relative(this._core.current()),o=i.loop||i.rewind;this._controls.$relative.toggleClass("disabled",!i.nav||s),i.nav&&(this._controls.$previous.toggleClass("disabled",!o&&n<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!o&&n>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!i.dots||s),i.dots&&(e=this._pages.length-this._controls.$absolute.children().length,i.dotsData&&0!==e?this._controls.$absolute.html(this._templates.join("")):e>0?this._controls.$absolute.append(new Array(e+1).join(this._templates[0])):e<0&&this._controls.$absolute.children().slice(e).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(t.inArray(this.current(),this._pages)).addClass("active"))},n.prototype.onTrigger=function(e){var i=this._core.settings;e.page={index:t.inArray(this.current(),this._pages),count:this._pages.length,size:i&&(i.center||i.autoWidth||i.dotsData?1:i.dotsEach||i.items)}},n.prototype.current=function(){var e=this._core.relative(this._core.current());return t.grep(this._pages,t.proxy(function(t,i){return t.start<=e&&t.end>=e},this)).pop()},n.prototype.getPosition=function(e){var i,s,n=this._core.settings;return"page"==n.slideBy?(i=t.inArray(this.current(),this._pages),s=this._pages.length,e?++i:--i,i=this._pages[(i%s+s)%s].start):(i=this._core.relative(this._core.current()),s=this._core.items().length,e?i+=n.slideBy:i-=n.slideBy),i},n.prototype.next=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!0),e)},n.prototype.prev=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!1),e)},n.prototype.to=function(e,i,s){var n;!s&&this._pages.length?(n=this._pages.length,t.proxy(this._overrides.to,this._core)(this._pages[(e%n+n)%n].start,i)):t.proxy(this._overrides.to,this._core)(e,i)},t.fn.owlCarousel.Constructor.Plugins.Navigation=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(i){this._core=i,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":t.proxy(function(i){i.namespace&&"URLHash"===this._core.settings.startPosition&&t(e).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!i)return;this._hashes[i]=e.content}},this),"changed.owl.carousel":t.proxy(function(i){if(i.namespace&&"position"===i.property.name){var s=this._core.items(this._core.relative(this._core.current())),n=t.map(this._hashes,function(t,e){return t===s?e:null}).join();if(!n||e.location.hash.slice(1)===n)return;e.location.hash=n}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers),t(e).on("hashchange.owl.navigation",t.proxy(function(t){var i=e.location.hash.substring(1),s=this._core.$stage.children(),n=this._hashes[i]&&s.index(this._hashes[i]);void 0!==n&&n!==this._core.current()&&this._core.to(this._core.relative(n),!1,!0)},this))};n.Defaults={URLhashListener:!1},n.prototype.destroy=function(){var i,s;for(i in t(e).off("hashchange.owl.navigation"),this._handlers)this._core.$element.off(i,this._handlers[i]);for(s in Object.getOwnPropertyNames(this))"function"!=typeof this[s]&&(this[s]=null)},t.fn.owlCarousel.Constructor.Plugins.Hash=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=t("<support>").get(0).style,o="Webkit Moz O ms".split(" "),r={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},a=function(){return!!c("transform")},h=function(){return!!c("perspective")},l=function(){return!!c("animation")};function c(e,i){var r=!1,a=e.charAt(0).toUpperCase()+e.slice(1);return t.each((e+" "+o.join(a+" ")+a).split(" "),function(t,e){if(n[e]!==s)return r=!i||e,!1}),r}function p(t){return c(t,!0)}(function(){return!!c("transition")})()&&(t.support.transition=new String(p("transition")),t.support.transition.end=r.transition.end[t.support.transition]),l()&&(t.support.animation=new String(p("animation")),t.support.animation.end=r.animation.end[t.support.animation]),a()&&(t.support.transform=new String(p("transform")),t.support.transform3d=h())}(window.Zepto||window.jQuery,window,document);
assets_libraries/remote/ue-remote-controls.js CHANGED
@@ -13,7 +13,10 @@ function UERemoteGeneralAPI(){
13
  class_active:"",
14
  selector_item_trigger:"",
15
  add_set_active_code:false,
16
- listen_class_change:true
 
 
 
17
  };
18
 
19
  var g_temp = {
@@ -116,7 +119,7 @@ function UERemoteGeneralAPI(){
116
  * get current item
117
  */
118
  function getNumCurrent(){
119
-
120
  var objCurrent = getObjCurrentItem();
121
 
122
  if(objCurrent.length == 0)
@@ -181,7 +184,7 @@ function UERemoteGeneralAPI(){
181
 
182
  if(!g_vars.selector_item_trigger){
183
 
184
- objItem.trigger("click");
185
  return(false);
186
  }
187
 
@@ -192,7 +195,7 @@ function UERemoteGeneralAPI(){
192
  throw new Error("Can't find inner by selector:"+g_vars.selector_item_trigger);
193
  }
194
 
195
- objInner.trigger("click");
196
 
197
  }
198
 
@@ -238,24 +241,36 @@ this.onEvent = function(name, func){
238
  return(response);
239
  }
240
 
241
-
 
 
 
242
  switch(action){
243
-
244
  case 'get_num_current':
245
 
246
  var current = getNumCurrent();
247
 
 
 
 
248
  return(current);
249
  break;
250
  case "get_total_items":
251
 
252
  var total = getNumTotal();
253
 
 
 
 
254
  return(total);
255
 
256
  break;
257
  case 'change_item':
258
 
 
 
 
259
  changeItem(arg1);
260
 
261
  break;
@@ -271,7 +286,7 @@ this.onEvent = function(name, func){
271
  * listen to class change
272
  */
273
  function initEvents_listenClassChange(){
274
-
275
  var objItems = getObjItems();
276
 
277
  jQuery.each(objItems, function(index, item){
@@ -299,7 +314,7 @@ this.onEvent = function(name, func){
299
  * add set active events
300
  */
301
  function initEvents_setActive(){
302
-
303
  var objItems = getObjItems();
304
 
305
  if(objItems.length == 0)
@@ -310,7 +325,7 @@ this.onEvent = function(name, func){
310
  var objFirstItem = getItem(0);
311
  objFirstItem.addClass(g_vars.class_active);
312
 
313
- objItems.on("click", function(){
314
 
315
  var objItem = jQuery(this);
316
  objItems.not(objItem).removeClass(g_vars.class_active);
@@ -319,6 +334,8 @@ this.onEvent = function(name, func){
319
 
320
  g_objParent.trigger("uc_change");
321
 
 
 
322
  });
323
 
324
 
@@ -389,12 +406,13 @@ this.onEvent = function(name, func){
389
  /**
390
  * init the api
391
  */
392
- this.init = function(objParent, options){
393
-
394
-
395
  //not allow to init general api without options
396
  if(!options)
397
  return(false);
 
 
398
 
399
  g_objParent = objParent;
400
 
@@ -403,7 +421,10 @@ this.onEvent = function(name, func){
403
  g_isTypeEvents = true;
404
 
405
  g_options = options;
406
-
 
 
 
407
  if(g_isTypeEvents == false)
408
  initByClasses();
409
 
@@ -431,6 +452,7 @@ this.onEvent = function(name, func){
431
  function UERemoteGalleryAPI(){
432
 
433
  var g_api, g_isInited;
 
434
  var t = this;
435
 
436
  /**
@@ -452,16 +474,27 @@ function UERemoteGalleryAPI(){
452
  /**
453
  do some action
454
  */
455
- this.doAction = function(action){
456
 
457
  validateInited();
458
 
459
  switch(action){
460
- case "next":
461
- g_api.nextItem();
 
 
 
462
  break;
463
- case "prev":
464
- g_api.prevItem();
 
 
 
 
 
 
 
 
465
  break;
466
  default:
467
  throw new Error("GALLERY API: Wrong action: "+action);
@@ -470,15 +503,48 @@ function UERemoteGalleryAPI(){
470
 
471
  }
472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  /**
474
  * init the api
475
  */
476
- this.init = function(objParent){
477
-
478
  g_api = objParent.data("unitegallery-api");
479
  if(!g_api)
480
  return(false);
481
-
 
 
482
  g_isInited = true;
483
 
484
  return(true);
@@ -1076,36 +1142,19 @@ function UERemoteWidgets(){
1076
  if(g_objParent.hasClass("owl-carousel"))
1077
  return(g_types.CAROUSEL);
1078
 
 
1079
 
1080
- return(g_types.GENERAL);
1081
-
1082
-
1083
- /* remove me
1084
- *
1085
- var remoteType = g_objParent.data("remote-type");
1086
-
1087
- if(!remoteType)
1088
- return(null);
1089
-
1090
- //check if the type valid
1091
-
1092
- switch(remoteType){
1093
- case g_types.CAROUSEL:
1094
- case g_types.TABS:
1095
- case g_types.GALLERY:
1096
-
1097
- return(remoteType);
1098
- break;
1099
- default:
1100
- throw new Error("Wrong parent remote type: "+remoteType);
1101
  break;
1102
  }
1103
 
1104
- return(null);
1105
- */
1106
 
 
1107
  }
1108
 
 
1109
  /**
1110
  * get offsets distance
1111
  */
@@ -1301,12 +1350,12 @@ function UERemoteWidgets(){
1301
  * init api variable
1302
  */
1303
  function initAPI(){
1304
-
1305
  //set type and related objects
1306
  if(!g_api){
1307
 
1308
  var parentType = getParentType();
1309
-
1310
  if(!parentType){
1311
  trace(g_objParent);
1312
  throw new Error("No parent type found");
@@ -1343,10 +1392,12 @@ function UERemoteWidgets(){
1343
 
1344
  var optionsFromData = g_objParent.data("uc-remote-options");
1345
 
 
 
1346
  if(optionsFromData)
1347
  g_vars.options_api = optionsFromData;
1348
 
1349
- var isInited = g_api.init(g_objParent, g_vars.options_api);
1350
 
1351
  return(isInited);
1352
  }
@@ -1752,7 +1803,7 @@ function UERemoteWidgets(){
1752
 
1753
 
1754
  /**
1755
- * change item by action
1756
  */
1757
  function changeItemByAction(dir){
1758
 
@@ -1925,7 +1976,6 @@ function UERemoteWidgets(){
1925
 
1926
  //disconnect
1927
  resetSettingsInsideEditor();
1928
- trace("reset all");
1929
  }
1930
 
1931
  }else{
@@ -2109,7 +2159,7 @@ function UERemoteWidgets(){
2109
 
2110
  if(optionsFromData)
2111
  optionsAPI = optionsFromData;
2112
-
2113
  if(optionsAPI)
2114
  g_vars.options_api = optionsAPI;
2115
 
@@ -2165,9 +2215,9 @@ function UERemoteWidgets(){
2165
  }
2166
 
2167
  jQuery("body").on("uc-remote-parent-init",function(event, objParent, optionsAPI){
2168
-
2169
  var objRemote = new UERemoteWidgets();
2170
-
2171
  objRemote.onParentInit(objParent, optionsAPI);
2172
 
2173
  });
13
  class_active:"",
14
  selector_item_trigger:"",
15
  add_set_active_code:false,
16
+ listen_class_change:true,
17
+ enableDebug:false,
18
+ is_editor:false,
19
+ trigger_event: "click"
20
  };
21
 
22
  var g_temp = {
119
  * get current item
120
  */
121
  function getNumCurrent(){
122
+
123
  var objCurrent = getObjCurrentItem();
124
 
125
  if(objCurrent.length == 0)
184
 
185
  if(!g_vars.selector_item_trigger){
186
 
187
+ objItem.trigger(g_vars.trigger_event);
188
  return(false);
189
  }
190
 
195
  throw new Error("Can't find inner by selector:"+g_vars.selector_item_trigger);
196
  }
197
 
198
+ objInner.trigger(g_vars.trigger_event);
199
 
200
  }
201
 
241
  return(response);
242
  }
243
 
244
+ if(g_vars.enableDebug){
245
+ trace("DEBUG - Action: " + action+" arg1: "+arg1+" arg2: "+arg2);
246
+ }
247
+
248
  switch(action){
249
+
250
  case 'get_num_current':
251
 
252
  var current = getNumCurrent();
253
 
254
+ if(g_vars.enableDebug)
255
+ trace("response: "+current);
256
+
257
  return(current);
258
  break;
259
  case "get_total_items":
260
 
261
  var total = getNumTotal();
262
 
263
+ if(g_vars.enableDebug)
264
+ trace("response: "+total);
265
+
266
  return(total);
267
 
268
  break;
269
  case 'change_item':
270
 
271
+ if(g_vars.enableDebug)
272
+ console.trace();
273
+
274
  changeItem(arg1);
275
 
276
  break;
286
  * listen to class change
287
  */
288
  function initEvents_listenClassChange(){
289
+
290
  var objItems = getObjItems();
291
 
292
  jQuery.each(objItems, function(index, item){
314
  * add set active events
315
  */
316
  function initEvents_setActive(){
317
+
318
  var objItems = getObjItems();
319
 
320
  if(objItems.length == 0)
325
  var objFirstItem = getItem(0);
326
  objFirstItem.addClass(g_vars.class_active);
327
 
328
+ objItems.on(g_vars.trigger_event, function(event){
329
 
330
  var objItem = jQuery(this);
331
  objItems.not(objItem).removeClass(g_vars.class_active);
334
 
335
  g_objParent.trigger("uc_change");
336
 
337
+ event.preventDefault();
338
+
339
  });
340
 
341
 
406
  /**
407
  * init the api
408
  */
409
+ this.init = function(objParent, options, isEditor){
410
+
 
411
  //not allow to init general api without options
412
  if(!options)
413
  return(false);
414
+
415
+ g_vars.is_editor = isEditor;
416
 
417
  g_objParent = objParent;
418
 
421
  g_isTypeEvents = true;
422
 
423
  g_options = options;
424
+
425
+ if(isEditor == true)
426
+ g_vars.trigger_event = "ucclick";
427
+
428
  if(g_isTypeEvents == false)
429
  initByClasses();
430
 
452
  function UERemoteGalleryAPI(){
453
 
454
  var g_api, g_isInited;
455
+ var g_objParent;
456
  var t = this;
457
 
458
  /**
474
  /**
475
  do some action
476
  */
477
+ this.doAction = function(action, arg1, arg2){
478
 
479
  validateInited();
480
 
481
  switch(action){
482
+ case 'get_num_current':
483
+
484
+ var current = g_api.getNumCurrent();
485
+
486
+ return(current);
487
  break;
488
+ case "get_total_items":
489
+
490
+ var total = g_api.getNumItems();
491
+
492
+ return(total);
493
+ break;
494
+ case 'change_item':
495
+
496
+ g_api.selectItem(arg1);
497
+
498
  break;
499
  default:
500
  throw new Error("GALLERY API: Wrong action: "+action);
503
 
504
  }
505
 
506
+ /*
507
+ events
508
+ */
509
+ this.onEvent = function(name, func){
510
+
511
+ validateInited();
512
+
513
+ switch(name){
514
+ case "change":
515
+
516
+ g_api.on("item_change", func);
517
+
518
+ break;
519
+ default:
520
+ throw new Error("General API: Wrong event: "+event);
521
+ break;
522
+
523
+ }
524
+ }
525
+
526
+
527
+ /**
528
+ * get element
529
+ */
530
+ this.getElement = function(){
531
+
532
+ return(g_objParent);
533
+ }
534
+
535
+
536
+
537
  /**
538
  * init the api
539
  */
540
+ this.init = function(objParent, options){
541
+
542
  g_api = objParent.data("unitegallery-api");
543
  if(!g_api)
544
  return(false);
545
+
546
+ g_objParent = objParent;
547
+
548
  g_isInited = true;
549
 
550
  return(true);
1142
  if(g_objParent.hasClass("owl-carousel"))
1143
  return(g_types.CAROUSEL);
1144
 
1145
+ var dataType = g_objParent.data("remote-type");
1146
 
1147
+ switch(dataType){
1148
+ case "gallery":
1149
+ return g_types.GALLERY;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1150
  break;
1151
  }
1152
 
 
 
1153
 
1154
+ return(g_types.GENERAL);
1155
  }
1156
 
1157
+
1158
  /**
1159
  * get offsets distance
1160
  */
1350
  * init api variable
1351
  */
1352
  function initAPI(){
1353
+
1354
  //set type and related objects
1355
  if(!g_api){
1356
 
1357
  var parentType = getParentType();
1358
+
1359
  if(!parentType){
1360
  trace(g_objParent);
1361
  throw new Error("No parent type found");
1392
 
1393
  var optionsFromData = g_objParent.data("uc-remote-options");
1394
 
1395
+ var isEditor = isInsideEditor();
1396
+
1397
  if(optionsFromData)
1398
  g_vars.options_api = optionsFromData;
1399
 
1400
+ var isInited = g_api.init(g_objParent, g_vars.options_api, isEditor);
1401
 
1402
  return(isInited);
1403
  }
1803
 
1804
 
1805
  /**
1806
+ * change item by action (0 - total-1)
1807
  */
1808
  function changeItemByAction(dir){
1809
 
1976
 
1977
  //disconnect
1978
  resetSettingsInsideEditor();
 
1979
  }
1980
 
1981
  }else{
2159
 
2160
  if(optionsFromData)
2161
  optionsAPI = optionsFromData;
2162
+
2163
  if(optionsAPI)
2164
  g_vars.options_api = optionsAPI;
2165
 
2215
  }
2216
 
2217
  jQuery("body").on("uc-remote-parent-init",function(event, objParent, optionsAPI){
2218
+
2219
  var objRemote = new UERemoteWidgets();
2220
+
2221
  objRemote.onParentInit(objParent, optionsAPI);
2222
 
2223
  });
assets_libraries/unitegallery/js/unitegallery.js CHANGED
@@ -1,4 +1,4 @@
1
- //Unite Gallery, Version: 1.7.56, released 20 January 2022
2
 
3
  //------ ug-common-libraries.js------
4
 
@@ -21840,6 +21840,14 @@ function UniteGalleryMain(){
21840
 
21841
  this.___________GENERAL_EXTERNAL___________ = function(){}
21842
 
 
 
 
 
 
 
 
 
21843
  /**
21844
  * shuffle items - usually before theme start
21845
  */
@@ -25635,6 +25643,17 @@ function UG_API(gallery){
25635
  return(numItems);
25636
  }
25637
 
 
 
 
 
 
 
 
 
 
 
 
25638
  /**
25639
  * refresh gallery with another options
25640
  */
1
+ //Unite Gallery, Version: 1.7.56, released 23 February 2022
2
 
3
  //------ ug-common-libraries.js------
4
 
21840
 
21841
  this.___________GENERAL_EXTERNAL___________ = function(){}
21842
 
21843
+ /**
21844
+ * get current number of item
21845
+ */
21846
+ this.getCurrentNumItem = function(){
21847
+
21848
+ return(g_selectedItemIndex);
21849
+ }
21850
+
21851
  /**
21852
  * shuffle items - usually before theme start
21853
  */
25643
  return(numItems);
25644
  }
25645
 
25646
+ /**
25647
+ * get number of current item
25648
+ */
25649
+ this.getNumCurrent = function(){
25650
+
25651
+ var numCurrent = g_gallery.getCurrentNumItem();
25652
+
25653
+ return(numCurrent);
25654
+ }
25655
+
25656
+
25657
  /**
25658
  * refresh gallery with another options
25659
  */
assets_libraries/unitegallery/js/unitegallery.min.js CHANGED
@@ -1,3 +1,3 @@
1
- //Unite Gallery, Version: 1.7.56, released 20 January 2022
2
 
3
- function debugLine(e,t,i){!0===e&&(e="true"),!1===e&&(e="false");var n=e;if("object"==typeof e)for(name in n="",e){var r=e[name];n+=" "+name+": "+r}if(1!=t||i||(n+=" "+Math.random()),1==i){var o=jQuery("#debug_line");o.width(200),o.height()>=500&&o.html(""),n=o.html()+"<br> -------------- <br>"+n}jQuery("#debug_line").show().html(n)}function debugSide(e){var t="";for(name in e){var i=e[name];t+=name+" : "+i+"<br>"}jQuery("#debug_side").show().html(t)}function trace(e){"undefined"!=typeof console&&console.log(e)}function UGFunctions(){var e=null,t=this,i={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};function n(e,t,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent?t.attachEvent("on"+e,i):t[e]=i}this.debugVar="",this.getvalopt={FORCE_BOOLEAN:"force_boolean",FORCE_NUMERIC:"force_numeric",TRIM:"trim"},this.z__________GENERAL___________=function(){},this.getVal=function(e,i,n,r){if(!n)n="";var o="";switch(o=e&&"object"==typeof e?0==e.hasOwnProperty(i)?n:e[i]:n,r){case t.getvalopt.FORCE_BOOLEAN:o=t.strToBool(o);break;case t.getvalopt.TRIM:o=String(o),o=jQuery.trim(o);break;case t.getvalopt.FORCE_NUMERIC:"string"==typeof(o=jQuery.trim(o))&&(o.replace("px",""),o=Number(o))}return o},this.z__________FULL_SCREEN___________=function(){},this.toFullscreen=function(e,t){if(e.requestFullscreen)e.requestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},this.exitFullscreen=function(){if(0==t.isFullScreen())return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},this.addFullScreenChangeEvent=function(e){document.webkitCancelFullScreen?n("webkitfullscreenchange",document,e):document.msExitFullscreen?n("MSFullscreenChange",document,e):document.mozCancelFullScreen?n("mozfullscreenchange",document,e):n("fullscreenchange",document,e)},this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange"),jQuery(document).unbind("mozfullscreenchange"),jQuery(document).unbind("webkitfullscreenchange"),jQuery(document).unbind("MSFullscreenChange")},this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},this.isFullScreen=function(){var e=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;return e=!!e},this.z__________GET_PROPS___________=function(){},this.getBrowserPrefix=function(){if(null!==e)return e;var t=["webkit","Moz","ms","O"],i=document.createElement("div");for(var n in t){var r=t[n];if(r+"Transform"in i.style)return r=r.toLowerCase(),e=r,r}return e="",""},this.getImageInsideParentDataByImage=function(e,i,n){var r=e.parent(),o=t.getImageOriginalSize(e);return t.getImageInsideParentData(r,o.width,o.height,i,n)},this.getImageInsideParentData=function(e,t,i,n,r,o,a){if(!r)r={};var s={};if(void 0===o)o=e.width();if(void 0===a)a=e.height();r.padding_left&&(o-=r.padding_left),r.padding_right&&(o-=r.padding_right),r.padding_top&&(a-=r.padding_top),r.padding_bottom&&(a-=r.padding_bottom);var l=null,u="100%",d=null,_=null,g="display:block;margin:0px auto;";if(t>0&&i>0){if("down"==n&&t<o&&i<a)_=(o-(l=t))/2,d=(a-(u=i))/2;else if("fill"==n){(l=(u=a)*(c=t/i))<o?(u=(l=o)/c,_=0,d=Math.round((u-a)/2*-1)):(d=0,_=Math.round((l-o)/2*-1))}else{var c;d=0,_=(o-(l=(u=a)*(c=t/i)))/2,"fitvert"!=n&&l>o&&(_=0,d=(a-(u=(l=o)/c))/2)}l=Math.floor(l),u=Math.floor(u),d=Math.floor(d),_=Math.floor(_),g="position:absolute;"}return r.padding_top&&(d+=r.padding_top),r.padding_left&&(_+=r.padding_left),s.imageWidth=l,s.imageHeight=u,s.imageTop=d,s.imageLeft=_,s.imageRight=_+l,s.imageBottom=0==d||"100%"==u?null:d+u,s.style=g,s},this.getElementCenterPosition=function(e,i){var n=e.parent(),r=t.getElementSize(e),o=t.getElementSize(n),a=o.width,s=o.height;i&&void 0!==i.padding_top&&(s-=i.padding_top),i&&void 0!==i.padding_bottom&&(s-=i.padding_bottom),i&&void 0!==i.padding_left&&(a-=i.padding_left),i&&void 0!==i.padding_right&&(a-=i.padding_right);var l={};return l.left=Math.round((a-r.width)/2),l.top=Math.round((s-r.height)/2),i&&void 0!==i.padding_top&&(l.top+=i.padding_top),i&&void 0!==i.padding_left&&(l.left+=i.padding_left),l},this.getElementCenterPoint=function(e,i){if(!i)i=!1;var n=t.getElementSize(e),r={};return r.x=n.width/2,r.y=n.height/2,1==i&&(r.x+=n.left,r.y+=n.top),r.x=Math.round(r.x),r.y=Math.round(r.y),r},this.getMousePosition=function(e,t){var i={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};if(e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(i.pageX=e.originalEvent.touches[0].pageX,i.pageY=e.originalEvent.touches[0].pageY,i.clientX=e.originalEvent.touches[0].clientX,i.clientY=e.originalEvent.touches[0].clientY),t){var n=t.offset();i.mouseX=i.pageX-n.left,i.mouseY=i.pageY-n.top}return i},this.getMouseElementPoint=function(e,i){var n={x:e.pageX,y:e.pageY};return t.getElementLocalPoint(n,i)},this.getElementLocalPoint=function(e,t){var i={},n=t.offset();return i.x=Math.round(e.x-n.left),i.y=Math.round(e.y-n.top),i},this.getImageOriginalSize=function(e,t,i){if(void 0!==t&&void 0!==i)return{width:t,height:i};var n=e[0];if(void 0===n)throw new Error("getImageOriginalSize error - Image not found");var r={};if(void 0===n.naturalWidth){if("number"==typeof e.data("naturalWidth"))return(r={}).width=e.data("naturalWidth"),r.height=e.data("naturalHeight"),r;var o=new Image;return o.src=n.src,o.complete?(r.width=o.width,r.height=o.height,e.data("naturalWidth",r.width),e.data("naturalHeight",r.height),r):{width:0,height:0}}return r.width=n.naturalWidth,r.height=n.naturalHeight,r},this.getimageRatio=function(e){var i=t.getImageOriginalSize(e);return t.getElementSize(e).width/i.width},this.isImageFitParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width<=r.width&&n.height<=r.height},this.getElementSize=function(e){if(void 0===e)throw new Error("Can't get size, empty element");var t=e.position();return t.height=e.outerHeight(),t.width=e.outerWidth(),t.left=Math.round(t.left),t.top=Math.round(t.top),t.right=t.left+t.width,t.bottom=t.top+t.height,t},this.isElementBiggerThenParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width>r.width||n.height>r.height},this.isPointInsideElement=function(e,t){return 0!=(e.x>=0&&e.x<t.width)&&0!=(e.y>=0&&e.y<t.height)},this.getElementRelativePos=function(e,i,n,r){if(!r)r=e.parent();if("number"==typeof e)var o={width:e,height:e};else o=t.getElementSize(e);var a=t.getElementSize(r);switch(i){case"top":case"left":i=0,n&&(i+=n);break;case"center":i=Math.round((a.width-o.width)/2),n&&(i+=n);break;case"right":i=a.width-o.width,n&&(i-=n);break;case"middle":i=Math.round((a.height-o.height)/2),n&&(i+=n);break;case"bottom":i=a.height-o.height,n&&(i-=n)}return i},this.getScreenVisibleSize=function(){document.body.clientWidth,document.body.clientHeight,jQuery(document).scrollTop();var e=jQuery(document),t=e.scrollLeft(),i=e.scrollTop();t=Math.round(t);var n=(i=Math.round(i))+window.innerHeight,r=t+window.innerWidth;return{top:i,left:t,height:n-i,width:r-t,right:r,bottom:n}},this.isElementsIntersect=function(e,t){return!(e.right<t.left)&&(!(e.left>t.right)&&(!(e.bottom<t.top)&&!(e.top>t.bottom)))},this.isElementInsideScreen=function(e){var i=t.getElementSize(e),n=t.getScreenVisibleSize();return t.isElementsIntersect(n,i)},this.z_________SET_ELEMENT_PROPS_______=function(){},this.zoomImageInsideParent=function(e,i,n,r,o,a,s){if(!n)n=1.2;if(!o)o="fit";var l,u,d,_,g=n,c=e.parent(),h=t.getElementSize(e),p=t.getImageOriginalSize(e),m=!1,f=0,b=0,v=0,y=0;if(r){var I=t.getMouseElementPoint(r,e);m=t.isPointInsideElement(I,h),v=I.x,y=I.y}else m=!1;if(0==m){var w=t.getElementCenterPoint(e);v=w.x,y=w.y}if(1==i)l=h.height*g,u=h.width*g,0!=v&&(f=-(v*g-v)),0!=y&&(b=-(y*g-y));else{if(l=h.height/g,(u=h.width/g)<t.getImageInsideParentData(c,p.width,p.height,o,s).imageWidth)return t.scaleImageFitParent(e,p.width,p.height,o,s),!0;1==m&&(0!=v&&(f=-(v/g-v)),0!=y&&(b=-(y/g-y)))}if(a){var E=1;if(0!=p.width&&(E=u/p.width),E>a)return!1}if(t.setElementSize(e,u,l),0==i&&0==m){var T=t.getElementCenterPosition(e);d=T.left,_=T.top}else d=h.left+f,_=h.top+b;return t.placeElement(e,d,_),!0},this.placeElement=function(e,i,n,r,o,a){if(0==jQuery.isNumeric(i)||0==jQuery.isNumeric(n)){if(!a)a=e.parent();var s=t.getElementSize(e),l=t.getElementSize(a)}if(0==jQuery.isNumeric(i))switch(i){case"left":i=0,r&&(i+=r);break;case"center":i=Math.round((l.width-s.width)/2),r&&(i+=r);break;case"right":i=l.width-s.width,r&&(i-=r)}if(0==jQuery.isNumeric(n))switch(n){case"top":n=0,o&&(n+=o);break;case"middle":case"center":n=Math.round((l.height-s.height)/2),o&&(n+=o);break;case"bottom":n=l.height-s.height,o&&(n-=o)}var u={position:"absolute",margin:"0px"};null!==i&&(u.left=i),null!==n&&(u.top=n),e.css(u)},this.placeElementInParentCenter=function(e){t.placeElement(e,"center","middle")},this.setElementSizeAndPosition=function(e,t,i,n,r){var o={width:n+"px",height:r+"px",left:t+"px",top:i+"px",position:"absolute",margin:"0px"};e.css(o)},this.setElementSize=function(e,t,i){var n={width:t+"px"};null!=i&&(n.height=i+"px"),e.css(n)},this.cloneElementSizeAndPos=function(e,i,n,r,o){var a=e.position();if(null==a)throw new Error("Can't get size, empty element");!0===n?(a.height=e.outerHeight(),a.width=e.outerWidth()):(a.height=e.height(),a.width=e.width()),a.left=Math.round(a.left),a.top=Math.round(a.top),r&&(a.left+=r),o&&(a.top+=o),t.setElementSizeAndPosition(i,a.left,a.top,a.width,a.height)},this.placeImageInsideParent=function(e,i,n,r,o,a){var s=t.getImageInsideParentData(i,n,r,o,a),l="<img";return null!==s.imageWidth&&(l+=" width = '"+s.imageWidth+"'",s.style+="width:"+s.imageWidth+";"),null!=s.imageHeight&&("100%"==s.imageHeight?(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+";"):(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+"px;")),null!==s.imageTop&&(s.style+="top:"+s.imageTop+"px;"),null!==s.imageLeft&&(s.style+="left:"+s.imageLeft+"px;"),e=t.escapeDoubleSlash(e),l+=" style='"+s.style+"'",l+=' src="'+e+'"',l+=">",i.html(l),i.children("img")},this.scaleImageCoverParent=function(e,i,n){if("number"==typeof i)var r=i,o=n;else r=i.outerWidth(),o=i.outerHeight();var a=t.getImageOriginalSize(e),s=a.width/a.height,l=o,u=l*s,d=0,_=0;u<r?(l=(u=r)/s,_=0,d=Math.round((l-o)/2*-1)):(d=0,_=Math.round((u-r)/2*-1)),u=Math.round(u),l=Math.round(l),e.css({width:u+"px",height:l+"px",left:_+"px",top:d+"px"})},this.scaleImageFitParent=function(e,i,n,r,o){var a=e.parent(),s=t.getImageInsideParentData(a,i,n,r,o),l=!1,u={};return null!==s.imageWidth&&(l=!0,e.removeAttr("width"),u.width=s.imageWidth+"px"),null!=s.imageHeight&&(l=!0,e.removeAttr("height"),u.height=s.imageHeight+"px"),null!==s.imageTop&&(l=!0,u.top=s.imageTop+"px"),null!==s.imageLeft&&(l=!0,u.left=s.imageLeft+"px"),1==l&&(u.position="absolute",u.margin="0px 0px",e.css(u)),s},this.scaleImageByHeight=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i*a);i=Math.round(i),t.setElementSize(e,s,i)},this.scaleImageByWidth=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i/a);i=Math.round(i),t.setElementSize(e,i,s)},this.scaleImageExactSizeInParent=function(e,i,n,r,o,a){var s=e.parent(),l=t.getElementSize(s);l.width<r&&(r=l.width),l.height<o&&(o=l.height);var u,d=t.getImageInsideParentData(null,i,n,a,null,r,o),_=r,g=o,c=d.imageLeft,h=d.imageLeft,p=d.imageTop,m=d.imageTop,f=Math.round((l.width-r)/2),b=Math.round((l.height-o)/2);0!=(u=r-(d.imageWidth+c+h))&&(h+=u),0!=(u=o-(d.imageHeight+p+m))&&(m+=u),e.removeAttr("width"),e.removeAttr("height");var v={position:"absolute",margin:"0px 0px"};v.width=_+"px",v.height=g+"px",v.left=f+"px",v.top=b+"px",v["padding-left"]=c+"px",v["padding-top"]=p+"px",v["padding-right"]=h+"px",v["padding-bottom"]=m+"px",e.css(v);var y={};return y.imageWidth=_,y.imageHeight=g,y},this.showElement=function(e,t,i){e.show().fadeTo(0,1),t&&t.show().fadeTo(0,1),i&&i.show().fadeTo(0,1)},this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){},this.disableButton=function(e,i){if(!i)i="ug-button-disabled";0==t.isButtonDisabled(e,i)&&e.addClass(i)},this.convertCustomPrefixOptions=function(e,t,i){if(!t)return e;var n={};return jQuery.each(e,function(e,r){if(0===e.indexOf(t+"_"+i+"_")){var o=e.replace(t+"_"+i+"_",i+"_");n[o]=r}else n[e]=r}),n},this.enableButton=function(e,i){if(!i)i="ug-button-disabled";1==t.isButtonDisabled(e,i)&&e.removeClass(i)},this.isButtonDisabled=function(e,t){if(!t)t="ug-button-disabled";return!!e.hasClass(t)},this.z_________MATH_FUNCTIONS_______=function(){},this.normalizeSetting=function(e,t,i,n,r,o){if(!o)o=!1;return r=e+(t-e)*((r-i)/(n-i)),1==o&&(r<e&&(r=e),r>t&&(r=t)),r},this.getNormalizedValue=function(e,t,i,n,r){return r=e+(n-i)*((r-e)/(t-e))},this.getDistance=function(e,t,i,n){return Math.round(Math.sqrt(Math.abs((i-e)*(i-e)+(n-t)*(n-t))))},this.getMiddlePoint=function(e,t,i,n){var r={};return r.x=e+Math.round((i-e)/2),r.y=t+Math.round((n-t)/2),r},this.getNumItemsInSpace=function(e,t,i){return Math.floor((e+i)/(t+i))},this.getNumItemsInSpaceRound=function(e,t,i){return Math.round((e+i)/(t+i))},this.getSpaceByNumItems=function(e,t,i){return e*t+(e-1)*i},this.getItemSizeInSpace=function(e,t,i){return Math.floor((e-(t-1)*i)/t)},this.getColX=function(e,t,i){return e*(t+i)},this.getColByIndex=function(e,t){return t%e},this.getColRowByIndex=function(e,t){var i=Math.floor(e/t);return{col:Math.floor(e%t),row:i}},this.getIndexByRowCol=function(e,t,i){return e<0?-1:t<0?-1:e*i+t},this.getPrevRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row-1,n.col,i)},this.getNextRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row+1,n.col,i)},this.z_________DATA_FUNCTIONS_______=function(){},this.setGlobalData=function(e,t){jQuery.data(document.body,e,t)},this.getGlobalData=function(e){return jQuery.data(document.body,e)},this.z_________EVENT_DATA_FUNCTIONS_______=function(){},this.handleScrollTop=function(e){if(0==t.isTouchDevice())return null;var n=t.getStoredEventData(e);if(null===n.scrollDir&&(Math.abs(n.diffMouseX)>15?n.scrollDir="hor":Math.abs(n.diffMouseY)>15&&Math.abs(n.diffMouseY)>Math.abs(n.diffMouseX)&&(n.scrollDir="vert",n.scrollStartY=n.lastMouseClientY,n.scrollOrigin=jQuery(document).scrollTop(),i.dataCache[e].scrollStartY=n.lastMouseClientY,i.dataCache[e].scrollOrigin=n.scrollOrigin),i.dataCache[e].scrollDir=n.scrollDir),"vert"!==n.scrollDir)return n.scrollDir;jQuery(document).scrollTop();var r=n.scrollOrigin-(n.lastMouseClientY-n.scrollStartY);return r>=0&&jQuery(document).scrollTop(r),n.scrollDir},this.wasVerticalScroll=function(e){return"vert"===t.getStoredEventData(e).scrollDir},this.storeEventData=function(e,n,r){var o=t.getMousePosition(e),a=jQuery.now(),s={startTime:a,lastTime:a,startMouseX:o.pageX,startMouseY:o.pageY,lastMouseX:o.pageX,lastMouseY:o.pageY,startMouseClientY:o.clientY,lastMouseClientY:o.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};r&&(s=jQuery.extend(s,r)),i.dataCache[n]=s},this.updateStoredEventData=function(e,n,r){if(!i.dataCache[n])throw new Error("updateEventData error: must have stored cache object");var o=i.dataCache[n],a=t.getMousePosition(e);o.lastTime=jQuery.now(),void 0!==a.pageX&&(o.lastMouseX=a.pageX,o.lastMouseY=a.pageY,o.lastMouseClientY=a.clientY),r&&(o=jQuery.extend(o,r)),i.dataCache[n]=o},this.getStoredEventData=function(e,t){if(!i.dataCache[e])throw new Error("updateEventData error: must have stored cache object");var n=i.dataCache[e];return n.diffMouseX=n.lastMouseX-n.startMouseX,n.diffMouseY=n.lastMouseY-n.startMouseY,n.diffMouseClientY=n.lastMouseClientY-n.startMouseClientY,n.diffTime=n.lastTime-n.startTime,!0===t?(n.startMousePos=n.lastMouseY,n.lastMousePos=n.lastMouseY,n.diffMousePos=n.diffMouseY):(n.startMousePos=n.lastMouseX,n.lastMousePos=n.lastMouseX,n.diffMousePos=n.diffMouseX),n},this.isApproveStoredEventClick=function(e,n){if(!i.dataCache[e])return!0;var r=t.getStoredEventData(e,n),o=Math.abs(r.diffMousePos);return!(r.diffTime>400)&&!(o>30)},this.clearStoredEventData=function(e){i.dataCache[e]=null},this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){},this.isCanvasExists=function(){return"function"==typeof jQuery('<canvas width="500" height="500" > </canvas>')[0].getContext},this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth},this.isTouchDevice=function(){if(-1!==i.isTouchDevice)return i.isTouchDevice;try{document.createEvent("TouchEvent"),i.isTouchDevice=!0}catch(e){i.isTouchDevice=!1}return i.isTouchDevice},this.isRgbaSupported=function(){if(-1!==i.isRgbaSupported)return i.isRgbaSupported;var e=document.getElementsByTagName("script")[0],t=e.style.color;try{e.style.color="rgba(1,5,13,0.44)"}catch(e){}var n=e.style.color!=t;return e.style.color=t,i.isRgbaSupported=n,n},this.z_________GENERAL_FUNCTIONS_______=function(){},this.checkMinJqueryVersion=function(e){for(var t=jQuery.fn.jquery.split("."),i=e.split("."),n=0,r=t.length;n<r;n++){var o=parseInt(t[n]),a=parseInt(i[n]);if(void 0===i[n])return!0;if(a>o)return!1;if(o>a)return!0}return!0},this.getCssSizeParam=function(e){return jQuery.isNumeric(e)?e+"px":e},this.convertHexToRGB=function(e,t){var i=e.replace("#","");return i===e?e:(r=parseInt(i.substring(0,2),16),g=parseInt(i.substring(2,4),16),b=parseInt(i.substring(4,6),16),result="rgba("+r+","+g+","+b+","+t+")",result)},this.timestampToString=function(e){var t=new Date(e),i=t.getDate()+"/"+t.getMonth();return i+=" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+":"+t.getMilliseconds()},this.getArrTouches=function(e){var t=[];return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(t=e.originalEvent.touches),t},this.getArrTouchPositions=function(e){for(var t=[],i=0;i<e.length;i++){var n={pageX:e[i].pageX,pageY:e[i].pageY};t.push(n)}return t},this.startTimeDebug=function(){i.starTime=jQuery.now()},this.showTimeDebug=function(){debugLine({"Time Passed":jQuery.now()-i.starTime},!0)},this.initProgressIndicator=function(e,i,n){switch("bar"!=e&&0==t.isCanvasExists()&&(e="bar"),e){case"bar":(r=new UGProgressBar).putHidden(n,i);break;default:case"pie":(r=new UGProgressPie).putHidden(n,i);break;case"pie2":var r;i.type_fill=!0,(r=new UGProgressPie).putHidden(n,i)}return r},this.setButtonMobileReady=function(e){e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover")}),e.on("mousedown touchend",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1})},this.registerTheme=function(e){i.arrThemes.push(e)},this.getArrThemes=function(){return i.arrThemes},this.isThemeRegistered=function(e){return-1!==jQuery.inArray(e,i.arrThemes)},this.getFirstRegisteredTheme=function(){return 0==i.arrThemes.length?"":i.arrThemes[0]},this.isTimePassed=function(e,t){if(!t)t=100;var n=jQuery.now();0==i.timeCache.hasOwnProperty(e)?lastTime=0:lastTime=i.timeCache[e];var r=n-lastTime;return i.timeCache[e]=n,!(r<=t)},this.whenContiniousEventOver=function(e,t,n){if(!n)n=300;1==i.timeCache.hasOwnProperty(e)&&null!=i.timeCache[e]&&(clearTimeout(i.timeCache[e]),i.timeCache[e]=null),i.timeCache[e]=setTimeout(t,n)},this.validateClickTouchstartEvent=function(e){var t=!0,n=jQuery.now()-i.lastEventTime;return"click"==e&&"touchstart"==i.lastEventType&&n<1e3&&(t=!1),i.lastEventTime=jQuery.now(),i.lastEventType=e,t},this.addClassOnHover=function(e,t){if(!t)t="ug-button-hover";e.hover(function(){jQuery(this).addClass(t)},function(){jQuery(this).removeClass(t)})},this.destroyButton=function(e){e.off("mouseenter"),e.off("mouseleave"),e.off("click"),e.off("touchstart"),e.off("touchend"),e.off("mousedown"),e.off("tap")},this.setButtonOnClick=function(e,i){t.setButtonMobileReady(e),e.on("click touchstart",function(e){if(objThis=jQuery(this),e.stopPropagation(),e.stopImmediatePropagation(),0==t.validateClickTouchstartEvent(e.type))return!0;i(objThis,e)})},this.setButtonOnTap=function(e,n){e.on("tap",n),0==t.isTouchDevice()?e.on("click",function(e){var i=jQuery(this);if(0==t.validateClickTouchstartEvent(e.type))return!0;i.trigger("tap")}):(e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover"),i.lastTouchStartElement=jQuery(this),i.lastEventTime=jQuery.now()}),e.on("touchend",function(e){var t=jQuery(this);return 0==t.is(i.lastTouchStartElement)||(!i.lastEventTime||(jQuery.now()-i.lastEventTime>i.touchThreshold||void t.trigger("tap")))}))},this.loadJs=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("script");i.src=e;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)},this.loadCss=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)},this.addEvent=function(e,t,i){void 0!==e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)},this.checkImagesLoaded=function(e,t,i){var n=0,r=e.length;if(0==r&&t)return t(),!1;function o(e,o){n++,"function"==typeof i&&setTimeout(function(){i(e,o)}),n==r&&"function"==typeof t&&setTimeout(function(){t()})}setTimeout(function(){for(var t=0;t<r;t++){var i=e[t];if(void 0!==i.naturalWidth&&0!==i.naturalWidth)o(e[t],!1);else{var n=jQuery("<img/>");n.data("index",t),n.on("load",function(){var t=jQuery(this).data("index");o(e[t],!1)}),n.on("error",function(){var t=jQuery(this).data("index");o(e[t],!0)}),n.attr("src",i.src)}}})},this.waitForWidth=function(e,t){var n=e.width();if(0!=n)return t(),!1;i.handle=setInterval(function(){0!=(n=e.width())&&(clearInterval(i.handle),t())},300)},this.arrayShuffle=function(e){if("object"!=typeof e)return e;for(var t,i,n=e.length;n;t=parseInt(Math.random()*n),i=e[--n],e[n]=e[t],e[t]=i);return e},this.getObjectLength=function(e){var t=0;for(var i in e)t++;return t},this.normalizePercent=function(e){return e<0&&(e=0),e>1&&(e=1),e},this.stripTags=function(e){return e.replace(/(<([^>]+)>)/gi,"")},this.escapeDoubleSlash=function(e){return e.replace('"','"')},this.htmlentitles=function(e){return jQuery("<div/>").text(e).html()},this.z_________END_GENERAL_FUNCTIONS_______=function(){}}!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var a=t||window.event,s=l.call(arguments,1),u=0,d=0,_=0,g=0;if((t=e.event.fix(a)).type="mousewheel","detail"in a&&(_=-1*a.detail),"wheelDelta"in a&&(_=a.wheelDelta),"wheelDeltaY"in a&&(_=a.wheelDeltaY),"wheelDeltaX"in a&&(d=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(d=-1*_,_=0),u=0===_?d:_,"deltaY"in a&&(u=_=-1*a.deltaY),"deltaX"in a&&(d=a.deltaX,0===_&&(u=-1*d)),0!==_||0!==d){if(1===a.deltaMode){var c=e.data(this,"mousewheel-line-height");u*=c,_*=c,d*=c}else if(2===a.deltaMode){var h=e.data(this,"mousewheel-page-height");u*=h,_*=h,d*=h}return g=Math.max(Math.abs(_),Math.abs(d)),(!o||o>g)&&(o=g,n(a,g)&&(o/=40)),n(a,g)&&(u/=40,d/=40,_/=40),u=Math[u>=1?"floor":"ceil"](u/o),d=Math[d>=1?"floor":"ceil"](d/o),_=Math[_>=1?"floor":"ceil"](_/o),t.deltaX=d,t.deltaY=_,t.deltaFactor=o,t.deltaMode=0,s.unshift(t,u,d,_),r&&clearTimeout(r),r=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){o=null}function n(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}var r,o,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var u=a.length;u;)e.event.fixHooks[a[--u]]=e.event.mouseHooks;var d=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",d.getLineHeight(this)),e.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=s.length;e;)this.removeEventListener(s[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof module&&"object"==typeof module.exports?exports=e(require("jquery")):e(jQuery)}(function(e){e.easing.jswing=e.easing.swing;var t=Math.pow,i=Math.sqrt,n=Math.sin,r=Math.cos,o=Math.PI,a=1.70158,s=1.525*a,l=2*o/3,u=2*o/4.5;function d(e){var t=7.5625,i=2.75;return e<1/i?t*e*e:e<2/i?t*(e-=1.5/i)*e+.75:e<2.5/i?t*(e-=2.25/i)*e+.9375:t*(e-=2.625/i)*e+.984375}e.extend(e.easing,{def:"easeOutQuad",swing:function(t){return e.easing[e.easing.def](t)},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-t(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-t(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-t(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-t(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-t(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-t(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-t(-2*e+2,5)/2},easeInSine:function(e){return 1-r(e*o/2)},easeOutSine:function(e){return n(e*o/2)},easeInOutSine:function(e){return-(r(o*e)-1)/2},easeInExpo:function(e){return 0===e?0:t(2,10*e-10)},easeOutExpo:function(e){return 1===e?1:1-t(2,-10*e)},easeInOutExpo:function(e){return 0===e?0:1===e?1:e<.5?t(2,20*e-10)/2:(2-t(2,-20*e+10))/2},easeInCirc:function(e){return 1-i(1-t(e,2))},easeOutCirc:function(e){return i(1-t(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-i(1-t(2*e,2)))/2:(i(1-t(-2*e+2,2))+1)/2},easeInElastic:function(e){return 0===e?0:1===e?1:-t(2,10*e-10)*n((10*e-10.75)*l)},easeOutElastic:function(e){return 0===e?0:1===e?1:t(2,-10*e)*n((10*e-.75)*l)+1},easeInOutElastic:function(e){return 0===e?0:1===e?1:e<.5?-t(2,20*e-10)*n((20*e-11.125)*u)/2:t(2,-20*e+10)*n((20*e-11.125)*u)/2+1},easeInBack:function(e){return 2.70158*e*e*e-a*e*e},easeOutBack:function(e){return 1+2.70158*t(e-1,3)+a*t(e-1,2)},easeInOutBack:function(e){return e<.5?t(2*e,2)*(7.189819*e-s)/2:(t(2*e-2,2)*((s+1)*(2*e-2)+s)+2)/2},easeInBounce:function(e){return 1-d(1-e)},easeOutBounce:d,easeInOutBounce:function(e){return e<.5?(1-d(1-2*e))/2:(1+d(2*e-1))/2}})}),function(e,t){if(void 0===e.cssHooks)return!1;function i(e,t,i){var n=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:n.max<e?n.max:e)}function n(t){var i=l(),n=i._rgba=[];return t=t.toLowerCase(),c(s,function(e,r){var o,a=r.re.exec(t),s=a&&r.parse(a),l=r.space||"rgba";return s?(o=i[l](s),i[u[l].cache]=o[u[l].cache],n=i._rgba=o._rgba,!1):void 0}),n.length?("0,0,0,0"===n.join()&&e.extend(n,o.transparent),i):o[t]}function r(e,t,i){return 1>6*(i=(i+1)%1)?e+(t-e)*i*6:1>2*i?t:2>3*i?e+(t-e)*(2/3-i)*6:e}var o,a=/^([\-+])=\s*(\d+\.?\d*)/,s=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,n,r){return new e.Color.fn.parse(t,i,n,r)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},_=l.support={},g=e("<p>")[0],c=e.each;g.style.cssText="background-color:rgba(1,1,1,.5)",_.rgba=g.style.backgroundColor.indexOf("rgba")>-1,c(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(r,a,s,d){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(a),a=t);var _=this,g=e.type(r),h=this._rgba=[];return a!==t&&(r=[r,a,s,d],g="array"),"string"===g?this.parse(n(r)||o._default):"array"===g?(c(u.rgba.props,function(e,t){h[t.idx]=i(r[t.idx],t)}),this):"object"===g?(c(u,r instanceof l?function(e,t){r[t.cache]&&(_[t.cache]=r[t.cache].slice())}:function(t,n){var o=n.cache;c(n.props,function(e,t){if(!_[o]&&n.to){if("alpha"===e||null==r[e])return;_[o]=n.to(_._rgba)}_[o][t.idx]=i(r[e],t,!0)}),_[o]&&e.inArray(null,_[o].slice(0,3))<0&&(_[o][3]=1,n.from&&(_._rgba=n.from(_[o])))}),this):void 0},is:function(e){var t=l(e),i=!0,n=this;return c(u,function(e,r){var o,a=t[r.cache];return a&&(o=n[r.cache]||r.to&&r.to(n._rgba)||[],c(r.props,function(e,t){return null!=a[t.idx]?i=a[t.idx]===o[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return c(u,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var n=l(e),r=n._space(),o=u[r],a=0===this.alpha()?l("transparent"):this,s=a[o.cache]||o.to(a._rgba),_=s.slice();return n=n[o.cache],c(o.props,function(e,r){var o=r.idx,a=s[o],l=n[o],u=d[r.type]||{};null!==l&&(null===a?_[o]=l:(u.mod&&(l-a>u.mod/2?a+=u.mod:a-l>u.mod/2&&(a-=u.mod)),_[o]=i((l-a)*t+a,r)))}),this[r](_)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),r=l(t)._rgba;return l(e.map(i,function(e,t){return(1-n)*r[t]+n*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),n=i.pop();return t&&i.push(~~(255*n)),"#"+e.map(i,function(e){return 1===(e=(e||0).toString(16)).length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,r=e[1]/255,o=e[2]/255,a=e[3],s=Math.max(n,r,o),l=Math.min(n,r,o),u=s-l,d=s+l,_=.5*d;return t=l===s?0:n===s?60*(r-o)/u+360:r===s?60*(o-n)/u+120:60*(n-r)/u+240,i=0===u?0:.5>=_?u/d:u/(2-d),[Math.round(t)%360,i,_,null==a?1:a]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],o=e[3],a=.5>=n?n*(1+i):n+i-n*i,s=2*n-a;return[Math.round(255*r(s,a,t+1/3)),Math.round(255*r(s,a,t)),Math.round(255*r(s,a,t-1/3)),o]},c(u,function(n,r){var o=r.props,s=r.cache,u=r.to,d=r.from;l.fn[n]=function(n){if(u&&!this[s]&&(this[s]=u(this._rgba)),n===t)return this[s].slice();var r,a=e.type(n),_="array"===a||"object"===a?n:arguments,g=this[s].slice();return c(o,function(e,t){var n=_["object"===a?e:t.idx];null==n&&(n=g[t.idx]),g[t.idx]=i(n,t)}),d?((r=l(d(g)))[s]=g,r):l(g)},c(o,function(t,i){l.fn[t]||(l.fn[t]=function(r){var o,s=e.type(r),l="alpha"===t?this._hsla?"hsla":"rgba":n,u=this[l](),d=u[i.idx];return"undefined"===s?d:("function"===s&&(r=r.call(this,d),s=e.type(r)),null==r&&i.empty?this:("string"===s&&((o=a.exec(r))&&(r=d+parseFloat(o[2])*("+"===o[1]?1:-1))),u[i.idx]=r,this[l](u)))})})}),l.hook=function(t){var i=t.split(" ");c(i,function(t,i){e.cssHooks[i]={set:function(t,r){var o,a,s="";if("transparent"!==r&&("string"!==e.type(r)||(o=n(r)))){if(r=l(o||r),!_.rgba&&1!==r._rgba[3]){for(a="backgroundColor"===i?t.parentNode:t;(""===s||"transparent"===s)&&a&&a.style;)try{s=e.css(a,"backgroundColor"),a=a.parentNode}catch(e){}r=r.blend(s&&"transparent"!==s?s:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(e){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),e.cssHooks.borderColor={expand:function(e){var t={};return c(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},o=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(e){e.mlp={x:0,y:0},e(function t(){try{var i=this===document?e(this):e(this).contents()}catch(e){return!1}i.mousemove(function(t){e.mlp={x:t.pageX,y:t.pageY}}),i.find("iframe").on("load",t)}),e.fn.ismouseover=function(){var t=!1;return this.eq(0).each(function(){var i=e(this).is("iframe")?e(this).contents().find("body"):e(this),n=i.offset();t=n.left<=e.mlp.x&&n.left+i.outerWidth()>e.mlp.x&&n.top<=e.mlp.y&&n.top+i.outerHeight()>e.mlp.y}),t}}(jQuery);var g_ugFunctions=new UGFunctions;function UGThumbsGeneral(){var e,t,i,n,r=this,o=jQuery(r),a=new UniteGalleryMain,s=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"},this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"};var l={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!1,thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},u={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},d="thumb_size_change";function _(e,t){var r=i[e],o="";0==u.customThumbs&&(o=" ug-thumb-generated");var a="<div class='ug-thumb-wrapper"+o+"' "+("style='z-index:"+(r.index+1)+";'")+"></div>";if(1==l.thumb_wrapper_as_link){var s=r.link;""==r.link&&(s="javascript:void(0)");var d="";1==l.thumb_link_newpage&&r.link&&(d=" target='_blank'");a="<a href='"+s+"'"+d+" class='ug-thumb-wrapper"+o+"'></a>"}var _=jQuery(a),g=r.objThumbImage;if(0==u.customThumbs){if(1==l.thumb_show_loader&&g){var c="ug-thumb-loader-dark";"bright"==l.thumb_loader_type&&(c="ug-thumb-loader-bright"),_.append("<div class='ug-thumb-loader "+c+"'></div>"),_.append("<div class='ug-thumb-error' style='display:none'></div>")}if(g){if(g.addClass("ug-thumb-image"),1==l.thumb_image_overlay_effect){var h=g.clone().appendTo(_);h.addClass("ug-thumb-image-overlay "+t).removeClass("ug-thumb-image"),h.fadeTo(0,0),r.objImageOverlay=h}_.append(g)}}return u.isEffectBorder&&_.append("<div class='ug-thumb-border-overlay'></div>"),u.isEffectOverlay&&_.append("<div class='ug-thumb-overlay'></div>"),n.append(_),u.customThumbs&&u.funcSetCustomThumbHtml(_,r),i[e].objThumbWrapper=_,_}function g(e,t,i,r){var o={width:e+"px",height:t+"px"},a={width:e-u.thumbInnerReduce+"px",height:t-u.thumbInnerReduce+"px"},s=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";i?(!0!==r&&i.css(o),i.find(s).css(a)):(n.children(".ug-thumb-wrapper").css(o),n.find(s).css(a))}function c(e,t,i,n){if(!n)n=!1;a.isFakeFullscreen()&&(n=!0);var r=e.children(".ug-thumb-border-overlay"),o={};o["border-width"]=t+"px",0!=t&&(o["border-color"]=i),n&&!0===n?(r.css(o),0==t?r.hide():r.show()):(0==t?r.stop().fadeOut(l.thumb_transition_duration):r.show().stop().fadeIn(l.thumb_transition_duration),function(e,t){e.stop(!0).animate(t,{duration:l.thumb_transition_duration,easing:l.thumb_transition_easing,queue:!1})}(r,o))}function h(e,t,i){var n=e.children(".ug-thumb-overlay"),r=l.thumb_transition_duration;i&&!0===i&&(r=0),t?n.stop(!0).fadeTo(r,u.colorOverlayOpacity):n.stop(!0).fadeTo(r,0)}function p(e,t,i){var n=e.children("img.ug-thumb-image"),r=e.children("img.ug-thumb-image-overlay"),o=l.thumb_transition_duration;i&&!0===i&&(o=0),t?r.stop(!0).fadeTo(o,1):(n.fadeTo(0,1),r.stop(!0).fadeTo(o,0))}function m(e,t){(u.isEffectBorder&&c(e,l.thumb_selected_border_width,l.thumb_selected_border_color,t),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!1,t),o.trigger(r.events.SETSELECTEDSTYLE,e)}function f(e){1==v(e)?m(e,!0):r.setThumbNormalStyle(e,!0,"redraw")}function b(e,t,i){if(1==l.thumb_fixed_size)s.scaleImageCoverParent(t,e);else{"height"==l.thumb_resize_by?s.scaleImageByHeight(t,l.thumb_height):s.scaleImageByWidth(t,l.thumb_width);var n=s.getElementSize(t);s.placeElement(t,0,0),g(n.width,n.height,e)}e.children(".ug-thumb-loader").hide(),t.show(),0==l.thumb_image_overlay_effect?t.fadeTo(0,1):(1==l.thumb_image_overlay_effect&&function(e){var t=e.siblings(".ug-thumb-image-overlay");if(0==t.length)return!1;var i=s.getElementSize(e),n={width:i.width+"px",height:i.height+"px",left:i.left+"px",top:i.top+"px"};t.css(n),0==u.customThumbs&&t.fadeTo(0,1)}(t),t.fadeTo(0,0),f(e)),o.trigger(r.events.AFTERPLACEIMAGE,e)}function v(e){return!!e.hasClass("ug-thumb-selected")}function y(e,t){t=jQuery(t);r.getItemByThumb(t);var i=s.getElementSize(t);g(i.width,i.height,t,!0),f(t)}function I(e,t){if(!t)t=!1;var i=jQuery(e),n=i.parents(".ug-thumb-wrapper");return 0!=n.parent().length&&(objItem=r.getItemByThumb(n),(1!=objItem.isLoaded||!1!==t)&&(r.triggerImageLoadedEvent(n,i),void(1==u.customThumbs?o.trigger(r.events.PLACEIMAGE,[n,i]):b(n,i,objItem))))}function w(e,t,i){objItem=r.getItemByThumb(t),objItem.isLoaded=!0,objItem.isThumbImageLoaded=!0;var n=s.getImageOriginalSize(i);objItem.thumbWidth=n.width,objItem.thumbHeight=n.height,objItem.thumbRatioByWidth=n.width/n.height,objItem.thumbRatioByHeight=n.height/n.width,t.addClass("ug-thumb-ratio-set")}this.init=function(n,r){e=n.getObjects(),a=n,jQuery(n),t=e.g_objWrapper,i=e.g_arrItems,l=jQuery.extend(l,r),u.isEffectBorder=l.thumb_border_effect,u.isEffectOverlay=l.thumb_color_overlay_effect,u.isEffectImage=l.thumb_image_overlay_effect},this._____________EXTERNAL_SETTERS__________=function(){},this.setHtmlThumbs=function(e,t){if(n=e,1==u.isEffectImage)var i=function(){var e="",t=l.thumb_image_overlay_type.split(",");for(var i in t){var n=t[i];switch(n){case"bw":e+=" ug-bw-effect";break;case"blur":e+=" ug-blur-effect";break;case"sepia":e+=" ug-sepia-effect"}}return e}();if(!0!==t)for(var o=a.getNumItems(),s=0;s<o;s++)_(s,i);else{r.getThumbs().removeClass(u.classNewThumb);var d=a.getNewAddedItemsIndexes();jQuery.each(d,function(e,t){_(t,i).addClass(u.classNewThumb)})}},this.setThumbNormalStyle=function(e,t,i){(1==u.customThumbs&&e.removeClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_border_width,l.thumb_border_color,t),u.isEffectOverlay)&&h(e,1!=l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!0,t),o.trigger(r.events.SETNORMALSTYLE,e)},this.setThumbOverStyle=function(e){(1==u.customThumbs&&e.addClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_over_border_width,l.thumb_over_border_color),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse);1==u.isEffectImage&&p(e,!1),o.trigger(r.events.SETOVERSTYLE,e)},this.setHtmlProperties=function(e){if(!e)e=r.getThumbs();if(0==u.customThumbs){1==l.thumb_fixed_size&&g(l.thumb_width,l.thumb_height,e),function(e){if(l.thumb_round_corners_radius<=0)return!1;var t={"border-radius":l.thumb_round_corners_radius+"px"};e?(e.css(t),e.find(".ug-thumb-border-overlay").css(t)):n.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(t)}(e)}if(e.each(function(){f(jQuery(this))}),u.isEffectOverlay&&l.thumb_overlay_color){var t={};if(s.isRgbaSupported()){var i=s.convertHexToRGB(l.thumb_overlay_color,l.thumb_overlay_opacity);t["background-color"]=i}else t["background-color"]=l.thumb_overlay_color,u.colorOverlayOpacity=l.thumb_overlay_opacity;e.find(".ug-thumb-overlay").css(t)}},this.setThumbSelected=function(e){if(1==u.customThumbs&&e.removeClass("ug-thumb-over"),1==v(e))return!0;e.addClass("ug-thumb-selected"),m(e)},this.setThumbUnselected=function(e){e.removeClass("ug-thumb-selected"),r.setThumbNormalStyle(e,!1,"set unselected")},this.setOptions=function(e){l=jQuery.extend(l,e)},this.setThumbInnerReduce=function(e){u.thumbInnerReduce=e},this.setCustomThumbs=function(e,t,i){if(u.customThumbs=!0,"function"!=typeof e)throw new Error("The argument should be function");u.funcSetCustomThumbHtml=e,-1==jQuery.inArray("overlay",t)&&(u.isEffectOverlay=!1),-1==jQuery.inArray("border",t)&&(u.isEffectBorder=!1),u.isEffectImage=!1,i&&!1===i.allow_onresize&&(u.allowOnResize=!1)},this._____________EXTERNAL_GETTERS__________=function(){},this.getOptions=function(){return l},this.getNumThumbs=function(){return i.length},this.getThumbImage=function(e){return e.find(".ug-thumb-image")},this.getThumbByIndex=function(e){var t=r.getThumbs();if(e>=t.length||e<0)throw new Error("Wrong thumb index");return jQuery(t[e])},this.getThumbs=function(e){switch(e){default:case r.type.GET_THUMBS_ALL:var t=n.children(".ug-thumb-wrapper");break;case r.type.GET_THUMBS_NO_RATIO:t=n.children(".ug-thumb-wrapper").not(".ug-thumb-ratio-set");break;case r.type.GET_THUMBS_RATIO:t=n.children(".ug-thumb-wrapper.ug-thumb-ratio-set");break;case r.type.GET_THUMBS_NEW:t=n.children("."+u.classNewThumb)}return t},this.getItemByThumb=function(e){var t=e.data("index");return void 0===t&&(t=e.index()),i[t]},this.isThumbLoaded=function(e){return r.getItemByThumb(e).isLoaded},this.getGlobalThumbSize=function(){return{width:l.thumb_width,height:l.thumb_height}},this._____________EXTERNAL_OTHERS__________=function(){},this.initEvents=function(){1==u.allowOnResize&&t.on(d,y),o.on(r.events.THUMB_IMAGE_LOADED,w),n.on("touchstart",".ug-thumb-wrapper",function(){u.touchEnabled=!0,n.off("mouseenter").off("mouseleave")}),n.on("mouseenter",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return objThumbs.off("mouseenter").off("mouseleave"),!0;0==v(e)&&r.setThumbOverStyle(e)}(jQuery(this))}),n.on("mouseleave",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return!0;0==v(e)&&r.setThumbNormalStyle(e,!1)}(jQuery(this))})},this.destroy=function(){n.off("touchstart",".ug-thumb-wrapper"),t.off(d),n.off("mouseenter",".ug-thumb-wrapper"),n.off("mouseleave",".ug-thumb-wrapper"),o.off(r.events.THUMB_IMAGE_LOADED)},this.loadThumbsImages=function(){var e=n.find(".ug-thumb-image");s.checkImagesLoaded(e,null,function(e,t){0==t?I(e,!0):function(e){var t=r.getItemByThumb(e);if(t.isLoaded=!0,t.isThumbImageLoaded=!1,1==u.customThumbs)return o.trigger(r.events.IMAGELOADERROR,e),!0;e.children(".ug-thumb-loader").hide(),e.children(".ug-thumb-error").show()}(jQuery(e).parent())})},this.triggerImageLoadedEvent=function(e,t){o.trigger(r.events.THUMB_IMAGE_LOADED,[e,t])},this.hideThumbs=function(){n.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){var e,t,n,r,o,a,s,l,u=this,d=new UniteGalleryMain,_=new UGFunctions,g=!1,c=new UGThumbsGeneral,h=(_=new UGFunctions,{strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0}),p={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},m={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0};this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};var f={strip_thumbs_align:"top",thumb_resize_by:"width"};function b(){var e=c.getOptions();p.isNotFixedThumbs=!1===e.thumb_fixed_size,g=h.strip_vertical_type}function v(){var t,i,n,r,_;c.setHtmlProperties(),t=a.children(".ug-thumb-wrapper"),i=jQuery(t[0]),n=i.outerWidth(),r=i.outerHeight(),_=c.getOptions(),0==g?(m.thumbSize=n,1==_.thumb_fixed_size?m.thumbSecondSize=r:m.thumbSecondSize=_.thumb_height,y(o.width()),m.stripInnerSize=a.width()):(m.thumbSize=r,1==_.thumb_fixed_size?m.thumbSecondSize=n:m.thumbSecondSize=_.thumb_width,y(o.height()),m.stripInnerSize=a.height()),function(){if(0==g){var e=m.thumbSecondSize,t={};t.height=e+"px";var i={};i.height=e+"px"}else{var n=m.thumbSecondSize,t={};t.width=n+"px";var i={};i.width=n+"px"}o.css(t),a.css(i)}(),I(),0==p.isRunOnce&&(1==h.strip_control_touch&&(l=new UGTouchThumbsControl).init(u),1==h.strip_control_avia&&(s=new UGAviaControl).init(u),P(),c.loadThumbsImages(),c.initEvents(),o.find(".ug-thumb-wrapper").on("click touchend",function(e){!function(e){if(u.isTouchMotionActive()){var t=l.isSignificantPassed();if(1==t)return!0}var i=c.getItemByThumb(e);d.selectItem(i)}(jQuery(this))}),e.on(d.events.ITEM_CHANGE,j),p.isNotFixedThumbs&&jQuery(c).on(c.events.AFTERPLACEIMAGE,x)),p.isRunOnce=!0}function y(e){m.stripSize=e,m.stripActiveSize=0==g?m.stripSize-h.strip_padding_left-h.strip_padding_right:m.stripSize-h.strip_padding_top-h.strip_padding_bottom,m.stripActiveSize<0&&(m.stripActiveSize=0)}function I(){var e,t=a.children(".ug-thumb-wrapper"),n=0,r=0;for(0==g&&(r=h.strip_padding_top),i=0;i<t.length;i++){var o=jQuery(t[i]);if(1==p.isNotFixedThumbs){if(objItem=c.getItemByThumb(o),0==objItem.isLoaded)continue;o.show()}_.placeElement(o,n,r),0==g?n+=o.outerWidth()+h.strip_space_between_thumbs:r+=o.outerHeight()+h.strip_space_between_thumbs}if(0==g)var s=n-h.strip_space_between_thumbs;else s=r-h.strip_space_between_thumbs;e=s,0==g?a.width(e):a.height(e),m.stripInnerSize=e,P(),jQuery(u).trigger(u.events.INNER_SIZE_CHANGE)}function w(e){var t=u.getInnerStripPos()+e;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function E(e){var t=-1*A(e).min;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function T(e){var t=-1*A(e).max+m.stripSize;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function S(e){if(0==C())return!1;var t,i,n=(t={},i=u.getInnerStripPos(),t.minPosThumbs=-1*i+1,t.maxPosThumbs=-1*i+m.stripSize-1,t),r=A(e);if(r.min<n.minPosThumbs){var o=e.prev();o.length?E(o):E(e)}else if(r.max>n.maxPosThumbs){var a=e.next();a.length?T(a):T(e)}}function P(){1==C()?(s&&s.enable(),l&&l.enable()):(s&&s.disable(),l&&l.disable())}function x(){clearTimeout(p.handle),p.handle=setTimeout(function(){I()},50)}function j(){var e=d.getSelectedItem();c.setThumbSelected(e.objThumbWrapper),S(e.objThumbWrapper)}function C(){return m.stripInnerSize>m.stripActiveSize}function A(e){var t={},i=e.position();return 0==g?(t.min=i.left,t.max=i.left+m.thumbSize):(t.min=i.top,t.max=i.top+m.thumbSize),t}this.setHtml=function(e){if(!e){e=n;null!=h.parent_container&&(e=h.parent_container)}e.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"),o=e.children(".ug-thumbs-strip"),a=o.children(".ug-thumbs-strip-inner"),c.setHtmlThumbs(a),1==p.isNotFixedThumbs&&c.hideThumbs()},this.destroy=function(){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.off(d.events.ITEM_CHANGE),jQuery(c).off(c.events.AFTERPLACEIMAGE),l&&l.destroy(),s&&s.destroy(),c.destroy()},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(i,o){!function(i,o){t=i.getObjects(),(d=i).attachThumbsPanel("strip",u),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,h=jQuery.extend(h,o),1==(g=h.strip_vertical_type)&&(h=jQuery.extend(h,f),h=jQuery.extend(h,o),o.thumb_resize_by="width"),c.init(i,o),b()}(i,o)},this.run=function(){v()},this.positionInnerStrip=function(e,t){if(void 0===t)t=!1;if(0==g)var i={left:e+"px"};else i={top:e+"px"};0==t?(a.css(i),u.triggerStripMoveEvent()):(u.triggerStripMoveEvent(),a.stop(!0).animate(i,{duration:h.strip_scroll_to_thumb_duration,easing:h.strip_scroll_to_thumb_easing,queue:!1,progress:function(){u.triggerStripMoveEvent()},always:function(){u.triggerStripMoveEvent()}}))},this.triggerStripMoveEvent=function(){jQuery(u).trigger(u.events.STRIP_MOVE)},this.isTouchMotionActive=function(){return!!l&&l.isTouchActive()},this.isItemThumbVisible=function(e){var t=e.objThumbWrapper,i=t.position(),n=-1*u.getInnerStripPos();if(0==g)var r=n+m.stripSize,o=i.left,a=i.left+t.width();else r=n+m.stripSize,o=i.top,a=i.top+t.height();var s=!1;return a>=n&&o<=r&&(s=!0),s},this.getInnerStripPos=function(){return 0==g?a.position().left:a.position().top},this.getInnerStripLimits=function(){var e={};return e.maxPos=0==g?h.strip_padding_left:h.strip_padding_top,e.minPos=-(m.stripInnerSize-m.stripActiveSize),e},this.fixInnerStripLimits=function(e){var t=u.getInnerStripLimits();return e>t.maxPos&&(e=t.maxPos),e<t.minPos&&(e=t.minPos),e},this.scrollForeward=function(){w(-m.stripSize)},this.scrollBack=function(){w(m.stripSize)},this.________EXTERNAL_SETTERS___________=function(){},this.setOptions=function(e){h=jQuery.extend(h,e),c.setOptions(e),b()},this.setSizeVertical=function(e){if(0==g)throw new Error("setSizeVertical error, the strip size is not vertical");var t=m.thumbSecondSize,i={};i.width=t+"px",i.height=e+"px",o.css(i),y(e);var n={};n.width=t+"px",n.left="0px",n.top="0px",a.css(n),p.is_placed=!0,P()},this.setSizeHorizontal=function(e){if(1==g)throw new Error("setSizeHorizontal error, the strip size is not horizontal");var t=m.thumbSecondSize+h.strip_padding_top+h.strip_padding_bottom,i={};i.width=e+"px",i.height=t+"px",o.css(i),y(e);var n=h.strip_padding_left,r={};r.height=t+"px",r.left=n+"px",r.top="0px",a.css(r),p.is_placed=!0,P()},this.setPosition=function(e,t,i,n){_.placeElement(o,e,t,i,n)},this.resize=function(e){0==g?(o.width(e),m.stripActiveSize=e-h.strip_padding_left-h.strip_padding_right):(o.height(e),m.stripActiveSize=e-h.strip_padding_top-h.strip_padding_bottom),y(e),P(),function(){if(0==C())return!1;var e=u.getInnerStripPos(),t=u.fixInnerStripLimits(e);e!=t&&u.positionInnerStrip(t,!0)}(),function(){if(C())return!1;0==g?_.placeElement(a,h.strip_thumbs_align,0):_.placeElement(a,0,h.strip_thumbs_align)}(),function(){var e=d.getSelectedItem();if(null==e)return!0;var t=e.objThumbWrapper;t&&S(t)}(),s&&s.onResize()},this.setThumbUnselected=function(e){c.setThumbUnselected(e)},this.setCustomThumbs=function(e){c.setCustomThumbs(e)},this.________EXTERNAL_GETTERS___________=function(){},this.getObjects=function(){var t=c.getOptions(),i=jQuery.extend(h,t);return{g_gallery:d,g_objGallery:e,g_objWrapper:n,g_arrItems:r,g_objStrip:o,g_objStripInner:a,g_aviaControl:s,g_touchThumbsControl:l,isVertical:g,g_options:i,g_thumbs:c}},this.getObjThumbs=function(){return c},this.getSelectedThumb=function(){var e=d.getSelectedItemIndex();return-1==e?null:c.getThumbByIndex(e)},this.getSizeAndPosition=function(){return _.getElementSize(o)},this.getHeight=function(){return o.outerHeight()},this.getWidth=function(){return o.outerWidth()},this.getSizes=function(){return m},this.isVertical=function(){return g},this.isPlaced=function(){return p.is_placed},this.isMoveEnabled=function(){return C()}}function UGTouchThumbsControl(){var e,t,i,n,r,o,a=new UGFunctions,s={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},l={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};function u(){var e=jQuery.now(),t={};return t.passedTime=l.lastTime-l.startTime,t.lastActiveTime=e-l.buttonReleaseTime,t.passedDistance=l.lastPos-l.startPos,t.passedDistanceAbs=Math.abs(t.passedDistance),t}function d(e){return 0==o?a.getMousePosition(e).pageX:a.getMousePosition(e).pageY}function _(){var e=jQuery.now();e-l.lastTime>=s.touch_portion_time&&(l.lastDeltaTime=e-l.lastTime,l.lastDeltaTime>s.touch_portion_time&&(l.lastDeltaTime=s.touch_portion_time),l.lastDeltaPos=l.lastPos-l.lastPortionPos,l.lastPortionPos=l.lastPos,l.lastTime=e)}function g(){l.lastPos=e.getInnerStripPos(),e.triggerStripMoveEvent()}function c(t){if(0==l.loop_active)return!0;if(t){d(t);!function(){var t=s.thumb_touch_slowFactor,i=s.minDeltaTime,r=s.minPath,a=e.getInnerStripPos(),u=jQuery.now()-l.lastTime,d=a-l.lastPortionPos;u<i&&l.lastDeltaTime>0&&(u=l.lastDeltaTime,d=l.lastDeltaPos+d),u<i&&(u=i);var _=0;u>0&&(_=d/u);var c=_*_/(2*t)*(d>0?1:-1);Math.abs(c)<=r&&(c=0);var h=e.getInnerStripPos(),p=h+c,m=e.fixInnerStripLimits(p),f=e.getInnerStripLimits(),b=s.limitsBreakAddition,v=!1,y=m;if(p>f.maxPos&&(v=!0,m=b,p<b&&(m=p)),p<f.minPos){v=!0;var I=f.minPos-b;m=I,p>I&&(m=p)}var w=m-h,E=Math.abs(Math.round(_/t));if(0!=c&&(E=E*w/c),h!=m){var T={left:m+"px"};1==o&&(T={top:m+"px"}),n.animate(T,{duration:E,easing:s.animationEasing,queue:!0,progress:g})}if(1==v){var S=s.returnAnimateSpeed,P={left:y+"px"};1==o&&(P={top:y+"px"}),n.animate(P,{duration:S,easing:s.returnAnimationEasing,queue:!0,progress:g})}}()}l.loop_active=!1,l.handle=clearInterval(l.handle)}function h(e){return 0==l.isControlEnabled||(l.buttonReleaseTime=jQuery.now(),0==l.touch_active?(c(e),!0):(e.preventDefault(),l.touch_active=!1,c(e),void i.removeClass("ug-dragging")))}function p(t){if(0==l.isControlEnabled)return!0;t.preventDefault(),l.touch_active=!0;var r=d(t);n.stop(!0),function(t){var i=e.getInnerStripPos();l.mousePos=t,l.innerPos=i,l.lastPortionPos=i,l.lastDeltaTime=0,l.lastDeltaPos=0,l.startTime=jQuery.now(),l.startPos=l.innerPos,l.lastTime=l.startTime,l.lastPos=l.startPos,l.speed=0}(r),function(){if(1==l.loop_active)return!0;l.loop_active=!0,l.handle=setInterval(_,10)}(),i.addClass("ug-dragging")}function m(t){if(0==l.isControlEnabled)return!0;if(0==l.touch_active)return!0;if(t.preventDefault(),0==t.buttons)return l.touch_active=!1,c(t),!0;var i=d(t);l.lastPos=e.getInnerStripPos(),function(t){var i=l.mousePos-t,n=l.innerPos-i,r=e.getInnerStripLimits();if(n>r.maxPos){var o=n-r.maxPos;n=r.maxPos+o/3}n<r.minPos&&(o=r.minPos-n,n=r.minPos-o/3);e.positionInnerStrip(n)}(i),_()}this.enable=function(){l.isControlEnabled=!0},this.disable=function(){l.isControlEnabled=!1},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,t.g_objGallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,s.thumb_touch_slowFactor=a.normalizeSetting(5e-5,.01,1,100,r.strip_thumb_touch_sensetivity,!0),i.bind("mousedown touchstart",p),jQuery(window).add("body").bind("mouseup touchend",h),jQuery("body").bind("mousemove touchmove",m)},this.isSignificantPassed=function(){var e=u();return e.passedTime>300||e.passedDistanceAbs>30},this.isTouchActive=function(){return 1==l.touch_active||(1==n.is(":animated")||u().lastActiveTime<50)},this.destroy=function(){i.unbind("mousedown"),i.unbind("touchstart"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){var e,t,i,n,r,o,a,s=new UniteGalleryMain,l=this,u=new UGFunctions;function d(t,n){switch(e.orientation){case"right":case"left":var r={left:t+"px"};break;case"top":case"bottom":r={top:t+"px"}}i.stop(!0).animate(r,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){n&&n()}})}function _(t){switch(e.orientation){case"right":case"left":u.placeElement(i,t,null);break;case"top":case"bottom":u.placeElement(i,null,t)}}function g(){r.trigger(t.events.FINISH_MOVE)}this.init=function(i,o,l,u,d){e=o,t=l,s=i,n=u,r=d,a=jQuery(s)},this.setHtml=function(r){if(i=r,"strip"==e.panelType)var a=n.strippanel_enable_handle;else a=n.gridpanel_enable_handle;if(1==a&&((o=new UGPanelHandle).init(t,i,n,e.panelType,s),o.setHtml()),!0===e.isDisabledAtStart){i.append("<div class='ug-overlay-disabled'></div>"),setTimeout(function(){i.children(".ug-overlay-disabled").hide()},e.disabledAtStartTimeout)}},this.placeElements=function(){o&&o.placeHandle()},this.initEvents=function(){o&&(o.initEvents(),a.on(s.events.SLIDER_ACTION_START,function(){o.hideHandle()}),a.on(s.events.SLIDER_ACTION_END,function(){o.showHandle()}))},this.destroy=function(){o&&(o.destroy(),a.off(s.events.SLIDER_ACTION_START),a.off(s.events.SLIDER_ACTION_END))},this.openPanel=function(n){if(!n)n=!1;return!i.is(":animated")&&(0!=e.isClosed&&(e.isClosed=!1,r.trigger(t.events.OPEN_PANEL),void(!1===n?d(e.originalPos,g):(_(e.originalPos),g()))))},this.closePanel=function(n){if(!n)n=!1;if(i.is(":animated"))return!1;if(1==e.isClosed)return!1;var o=l.getClosedPanelDest();e.isClosed=!0,r.trigger(t.events.CLOSE_PANEL),!1===n?d(o,g):(_(o),g())},this.setClosedState=function(i){e.originalPos=i,r.trigger(t.events.CLOSE_PANEL),e.isClosed=!0},this.setOpenedState=function(i){r.trigger(t.events.OPEN_PANEL),e.isClosed=!1},this.getClosedPanelDest=function(){var t,n=u.getElementSize(i);switch(e.orientation){case"left":e.originalPos=n.left,t=-e.panelWidth;break;case"right":e.originalPos=n.left,t=s.getSize().width;break;case"top":e.originalPos=n.top,t=-e.panelHeight;break;case"bottom":e.originalPos=n.top,t=s.getSize().height}return t},this.isPanelClosed=function(){return e.isClosed},this.setDisabledAtStart=function(t){if(t<=0)return!1;e.isDisabledAtStart=!0,e.disabledAtStartTimeout=t}}function UGPanelHandle(){var e,t,i,n=new UGFunctions,r={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0};function o(){i.removeClass("ug-button-hover")}function a(e){if(e.stopPropagation(),e.stopImmediatePropagation(),0==n.validateClickTouchstartEvent(e.type))return!0;t.isPanelClosed()?t.openPanel():t.closePanel()}this.init=function(i,n,o,a,s){switch(t=i,e=n,a){case"grid":r.panel_handle_align=o.gridpanel_handle_align,r.panel_handle_offset=o.gridpanel_handle_offset,r.panel_handle_skin=o.gridpanel_handle_skin;break;case"strip":r.panel_handle_align=o.strippanel_handle_align,r.panel_handle_offset=o.strippanel_handle_offset,r.panel_handle_skin=o.strippanel_handle_skin;break;default:throw new Error("Panel handle error: wrong panel type: "+a)}var l=s.getOptions().gallery_skin;""==r.panel_handle_skin&&(r.panel_handle_skin=l)},this.setHtml=function(){var n="ug-panel-handle-tip";switch(t.getOrientation()){case"right":n+=" ug-handle-tip-left";break;case"left":n+=" ug-handle-tip-right";break;case"bottom":n+=" ug-handle-tip-top";break;case"top":n+=" ug-handle-tip-bottom"}e.append("<div class='"+n+" ug-skin-"+r.panel_handle_skin+"'></div>"),i=e.children(".ug-panel-handle-tip")},this.initEvents=function(){n.addClassOnHover(i),i.bind("click touchstart",a),jQuery(t).on(t.events.OPEN_PANEL,function(){o(),i.removeClass("ug-button-closed")}),jQuery(t).on(t.events.CLOSE_PANEL,function(){o(),i.addClass("ug-button-closed")})},this.destroy=function(){n.destroyButton(i),jQuery(t).off(t.events.OPEN_PANEL),jQuery(t).off(t.events.CLOSE_PANEL)},this.placeHandle=function(){var e=n.getElementSize(i);!function(){switch(t.getOrientation()){case"right":case"left":"top"!=r.panel_handle_align&&"bottom"!=r.panel_handle_align&&(r.panel_handle_align="top");break;case"bottom":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="left");break;case"top":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="right")}}();var o=t.getOrientation();switch(o){case"left":n.placeElement(i,"right",r.panel_handle_align,-e.width);break;case"right":n.placeElement(i,-e.width,r.panel_handle_align,0,r.panel_handle_offset);break;case"top":n.placeElement(i,r.panel_handle_align,"bottom",r.panel_handle_offset,-e.height);break;case"bottom":n.placeElement(i,r.panel_handle_align,"top",r.panel_handle_offset,-e.height);break;default:throw new Error("Wrong panel orientation: "+o)}},this.hideHandle=function(){1==i.is(":visible")&&i.hide()},this.showHandle=function(){0==i.is(":visible")&&i.show()}}function UGStripPanel(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGThumbsStrip,d=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var _={strippanel_vertical_type:!1,strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},g={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},c={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},h={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0};function p(){if(1==h.isFirstRun&&0==function(){if(0==_.strippanel_vertical_type){if(0==h.panelWidth)throw new Error("Strip panel error: The width not set, please set width")}else if(0==h.panelHeight)throw new Error("Strip panel error: The height not set, please set height");if(null==h.orientation)throw new Error("Wrong orientation, please set panel orientation before run");return!0}())return!1;u.run(),f(),b(),function(){if(1==h.isEventsInited)return!1;if(h.isEventsInited=!0,n)if(l.addClassOnHover(n,"ug-button-hover"),l.addClassOnHover(r,"ug-button-hover"),l.setButtonOnClick(r,y),l.setButtonOnClick(n,v),"advance_item"!=_.strippanel_buttons_role)jQuery(u).on(u.events.STRIP_MOVE,w),jQuery(u).on(u.events.INNER_SIZE_CHANGE,I),e.on(s.events.SIZE_CHANGE,I);else{var t=s.getOptions();0==t.gallery_carousel&&jQuery(s).on(s.events.ITEM_CHANGE,E)}d.initEvents()}(),h.isFirstRun=!1,I()}function m(e){if(!e)e=t;if(e.append("<div class='ug-strip-panel'></div>"),i=e.children(".ug-strip-panel"),1==_.strippanel_enable_buttons){var o="ug-strip-arrow-left",a="ug-strip-arrow-right";1==_.strippanel_vertical_type&&(o="ug-strip-arrow-up",a="ug-strip-arrow-down"),i.append("<div class='ug-strip-arrow "+o+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>"),i.append("<div class='ug-strip-arrow "+a+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>")}d.setHtml(i),u.setHtml(i),1==_.strippanel_enable_buttons&&(r=i.children("."+o),n=i.children("."+a)),""!=_.strippanel_background_color&&i.css("background-color",_.strippanel_background_color)}function f(){0==_.strippanel_vertical_type?function(){var e=u.getHeight(),t=h.panelWidth;if(n){r.height(e),n.height(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_top+_.strippanel_padding_bottom;i.width(t),i.height(s),h.panelHeight=s;var d=t-_.strippanel_padding_left-_.strippanel_padding_right;n&&(d=d-2*n.outerWidth()-2*_.strippanel_padding_buttons),u.resize(d)}():function(){var e=u.getWidth(),t=h.panelHeight;if(n){r.width(e),n.width(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_left+_.strippanel_padding_right;i.width(s),i.height(t),h.panelWidth=s;var d=t-_.strippanel_padding_top-_.strippanel_padding_bottom;n&&(d=d-2*n.outerHeight()-2*_.strippanel_padding_buttons),u.resize(d)}()}function b(){0==_.strippanel_vertical_type?function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"right","top",_.strippanel_padding_right,_.strippanel_padding_top));var e=_.strippanel_padding_left;n&&(e+=n.outerWidth()+_.strippanel_padding_buttons),u.setPosition(e,_.strippanel_padding_top)}():function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"left","bottom",_.strippanel_padding_left,_.strippanel_padding_bottom));var e=_.strippanel_padding_top;n&&(e+=n.outerHeight()+_.strippanel_padding_buttons),u.setPosition(_.strippanel_padding_left,e)}(),d.placeElements()}function v(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.nextItem():u.scrollForeward()}function y(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.prevItem():u.scrollBack()}function I(){if(!n)return!0;if(0==u.isMoveEnabled())return l.disableButton(r),l.disableButton(n),!0;var e=u.getInnerStripLimits(),t=u.getInnerStripPos();t>=e.maxPos?l.disableButton(r):l.enableButton(r),t<=e.minPos?l.disableButton(n):l.enableButton(n)}function w(){I()}function E(){s.isLastItem()?l.disableButton(n):l.enableButton(n),s.isFirstItem()?l.disableButton(r):l.enableButton(r)}this.destroy=function(){n&&(l.destroyButton(n),l.destroyButton(r),jQuery(u).off(u.events.STRIP_MOVE),jQuery(s).off(s.events.ITEM_CHANGE),jQuery(s).off(s.events.SIZE_CHANGE)),d.destroy(),u.destroy()},this.getOrientation=function(){return h.orientation},this.setOrientation=function(e){h.orientation=e},this.init=function(i,n){!function(i,n){s=i,e=jQuery(s);var r=!1;1==(_=jQuery.extend(_,n)).strippanel_vertical_type&&(_=jQuery.extend(_,g),r=!0),0==_.strippanel_enable_buttons&&(_=jQuery.extend(_,c),r=!0),1==r&&(_=jQuery.extend(_,n));var l=s.getOptions().gallery_skin;""==_.strippanel_buttons_skin&&(_.strippanel_buttons_skin=l),t=s.getElement(),d.init(s,h,o,_,a),(u=new UGThumbsStrip).init(s,_)}(i,n)},this.run=function(){p()},this.setHtml=function(e){m(e)},this.getElement=function(){return i},this.getSize=function(){return l.getElementSize(i)},this.setWidth=function(e){h.panelWidth=e},this.setHeight=function(e){h.panelHeight=e},this.resize=function(e){o.setWidth(e),f(),b()},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return d.isPanelClosed()},this.getClosedPanelDest=function(){return d.getClosedPanelDest()},this.openPanel=function(e){d.openPanel(e)},this.closePanel=function(e){d.closePanel(e)},this.setOpenedState=function(e){d.setOpenedState(e)},this.setClosedState=function(e){d.setClosedState(e)},this.setCustomThumbs=function(e){u.setCustomThumbs(e)},this.setDisabledAtStart=function(e){d.setDisabledAtStart(e)}}function UGGridPanel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGThumbsGrid,u=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var d={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!1,gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},_={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},g={gridpanel_grid_align:"center"},c={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};function h(){if(null==c.orientation)throw new Error("Wrong orientation, please set panel orientation before run")}function p(){h(),"center"==d.gridpanel_grid_align&&(d.gridpanel_grid_align="middle"),l.run(),function(){var e=!1;if(1==d.gridpanel_arrows_always_on)e=!0;else{var t=l.getNumPanes();t>1&&(e=!0)}1==e?(i.show().fadeTo(0,1),n.show().fadeTo(0,1),c.arrowsVisible=!0):(i.hide(),n.hide(),c.arrowsVisible=!1)}(),function(){var e=l.getSize();1==c.isHorType?c.panelHeight=e.height+d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom:c.panelWidth=e.width+d.gridpanel_padding_border_left+d.gridpanel_padding_border_right;s.setElementSize(t,c.panelWidth,c.panelHeight)}(),function(){0==c.isHorType?1==d.gridpanel_vertical_scroll?1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"top":e=d.gridpanel_padding_border_top+a.height+d.gridpanel_arrows_padding_vert;break;case"middle":e="middle";break;case"bottom":e=c.panelHeight-u.height-a.height-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert}var _=f(),g=l.getElement();s.placeElement(g,_,e);var u=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":t=(u.top-a.height)/2,r=u.bottom+(c.panelHeight-u.bottom-a.height)/2,o=0;break;case"grid":t=u.top-a.height-d.gridpanel_arrows_padding_vert_vert,r=u.bottom+d.gridpanel_arrows_padding_vert,o=0;break;case"border":case"borders":t=d.gridpanel_padding_border_top,r="bottom",o=d.gridpanel_padding_border_bottom}s.placeElement(n,"center",t),s.placeElement(i,"center",r,0,o)}():b():1==c.arrowsVisible?function(){var e,t,r,o=s.getElementSize(n),a=l.getSize(),u=d.gridpanel_padding_border_top;switch(d.gridpanel_grid_align){case"middle":switch(d.gridpanel_arrows_align_vert){default:var _=a.height+d.gridpanel_arrows_padding_vert+o.height;u=(c.panelHeight-_)/2;break;case"border":case"borders":var g=c.panelHeight-o.height-d.gridpanel_padding_border_bottom;u=(g-a.height)/2}break;case"bottom":var _=a.height+o.height+d.gridpanel_arrows_padding_vert;u=c.panelHeight-_-d.gridpanel_padding_border_bottom}var h=l.getElement(),p=f();s.placeElement(h,p,u);var a=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":e=a.bottom+(c.panelHeight-a.bottom-o.height)/2,r=0;break;case"grid":e=a.bottom+d.gridpanel_arrows_padding_vert,r=0;break;case"border":case"borders":e="bottom",r=d.gridpanel_padding_border_bottom}t=-o.width/2-d.gridpanel_space_between_arrows/2,s.placeElement(n,"center",e,t,r);var m=Math.abs(t);s.placeElement(i,"center",e,m,r)}():b():1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left+d.gridpanel_arrows_padding_hor+a.width;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-u.width-a.width-d.gridpanel_padding_border_right-d.gridpanel_arrows_padding_hor}var _=l.getElement();switch(s.placeElement(_,e,d.gridpanel_padding_border_top),u=l.getSize(),d.gridpanel_arrows_align_vert){default:case"center":case"middle":o=(u.height-a.height)/2+u.top;break;case"top":o=d.gridpanel_padding_border_top+d.gridpanel_arrows_padding_vert;break;case"bottom":o=c.panelHeight-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert-a.height}switch(d.gridpanel_arrows_align_hor){default:case"borders":t=d.gridpanel_padding_border_left,r=c.panelWidth-d.gridpanel_padding_border_right-a.width;break;case"grid":t=u.left-d.gridpanel_arrows_padding_hor-a.width,r=u.right+d.gridpanel_arrows_padding_hor;break;case"center":t=(u.left-a.width)/2,r=u.right+(c.panelWidth-u.right-a.width)/2}s.placeElement(n,t,o),s.placeElement(i,r,o)}():function(){var e,t=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-t.width-d.gridpanel_padding_border_right}var i=l.getElement();s.placeElement(i,e,d.gridpanel_padding_border_top)}();u.placeElements()}(),function(){if(1==c.isEventsInited)return!1;c.isEventsInited=!0,n&&(s.addClassOnHover(n),l.attachPrevPaneButton(n));i&&(s.addClassOnHover(i),l.attachNextPaneButton(i));u.initEvents()}()}function m(){e.append("<div class='ug-grid-panel'></div>"),t=e.children(".ug-grid-panel"),c.isHorType?(t.append("<div class='grid-arrow grid-arrow-left-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left-hortype"),i=t.children(".grid-arrow-right-hortype")):0==d.gridpanel_vertical_scroll?(t.append("<div class='grid-arrow grid-arrow-left ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left"),i=t.children(".grid-arrow-right")):(t.append("<div class='grid-arrow grid-arrow-up ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-down ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-up"),i=t.children(".grid-arrow-down")),u.setHtml(t),n.fadeTo(0,0),i.fadeTo(0,0),l.setHtml(t),""!=d.gridpanel_background_color&&t.css("background-color",d.gridpanel_background_color)}function f(){return d.gridpanel_padding_border_left}function b(){var e=d.gridpanel_grid_align,t=0;switch(e){case"top":t=d.gridpanel_padding_border_top;break;case"bottom":t=d.gridpanel_padding_border_bottom}var i=f(),n=l.getElement();s.placeElement(n,i,e,0,t)}this.destroy=function(){n&&s.destroyButton(n),i&&s.destroyButton(i),u.destroy(),l.destroy()},this.getOrientation=function(){return c.orientation},this.setOrientation=function(e){switch(c.orientation=e,e){case"right":case"left":c.isHorType=!1;break;case"top":case"bottom":c.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+e)}},this.setHeight=function(e){if(1==c.isHorType)throw new Error("setHeight is not appliable to this orientatio ("+c.orientation+"). Please use setWidth");c.panelHeight=e;var t,n,r=(t=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByHeight(n)?n:(t=s.getElementSize(i).height+d.gridpanel_arrows_padding_vert,1==d.gridpanel_vertical_scroll&&(t*=2),t+=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t));l.setMaxHeight(r)},this.setWidth=function(e){if(0==c.isHorType)throw new Error("setWidth is not appliable to this orientatio ("+c.orientation+"). Please use setHeight");c.panelWidth=e;var t,n,r=(t=d.gridpanel_padding_border_left+d.gridpanel_padding_border_right,n=c.panelWidth-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByWidth(n)?n:(t+=2*(s.getElementSize(i).width+d.gridpanel_arrows_padding_hor),n=c.panelWidth-t));l.setMaxWidth(r)},this.init=function(t,i){!function(t,i){a=t,h(),i&&i.vertical_scroll&&(d.gridpanel_vertical_scroll=i.vertical_scroll),d=jQuery.extend(d,i),1==c.isHorType?(d=jQuery.extend(d,g),d=jQuery.extend(d,i)):1==d.gridpanel_vertical_scroll&&(d=jQuery.extend(d,_),(d=jQuery.extend(d,i)).grid_panes_direction="bottom");var n=a.getOptions().gallery_skin;""==d.gridpanel_arrows_skin&&(d.gridpanel_arrows_skin=n);var s=t.getObjects();e=s.g_objWrapper,u.init(a,c,r,d,o),(l=new UGThumbsGrid).init(a,d)}(t,i)},this.setHtml=function(){m()},this.run=function(){p()},this.getElement=function(){return t},this.getSize=function(){return s.getElementSize(t)},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return u.isPanelClosed()},this.getClosedPanelDest=function(){return u.getClosedPanelDest()},this.openPanel=function(e){u.openPanel(e)},this.closePanel=function(e){u.closePanel(e)},this.setOpenedState=function(e){u.setOpenedState(e)},this.setClosedState=function(e){u.setClosedState(e)},this.setDisabledAtStart=function(e){u.setDisabledAtStart(e)}}function UGThumbsGrid(){var e,t,n,r,o,a,s=this,l=jQuery(this),u=new UniteGalleryMain,d=new UGFunctions,_=new UGThumbsGeneral,g=new UGTileDesign,c={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1};this.events={PANE_CHANGE:"pane_change"};var h={eventSizeChange:"thumb_size_change",isHorizontal:!1,isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};function p(i,o,a){var l;if(t=i.getObjects(),(u=i).attachThumbsPanel("grid",s),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,!0===a&&(h.isTilesMode=!0),h.numThumbs=r.length,l=o,c=jQuery.extend(c,l),_.setOptions(l),h.isNavigationVertical="top"==c.grid_panes_direction||"bottom"==c.grid_panes_direction,h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows,1==h.isTilesMode){g.setFixedMode(),g.setApproveClickFunction(j),g.init(i,c);var d=g.getOptions();h.tileMaxHeight=d.tile_height,h.tileMaxWidth=d.tile_width,_=g.getObjThumbs()}else o.thumb_fixed_size=!0,_.init(i,o)}function m(){var t=u.getSelectedItem();(function(){if(0==h.isHorizontal){if(0==h.gridHeight)throw new Error("You must set height before run.")}else if(0==h.gridWidth)throw new Error("You must set width before run.")}(),1==h.isFirstTimeRun)?(!function(){if(0==h.isTilesMode){_.initEvents();var t=o.find(".ug-thumb-wrapper");t.on("click touchend",C),e.on(u.events.ITEM_CHANGE,z)}else g.initEvents();o.bind("mousedown touchstart",A),jQuery("body").bind("mousemove touchmove",M),jQuery(window).add("body").bind("mouseup touchend",O)}(),1==h.isTilesMode?(b(),v(),g.run()):(_.setHtmlProperties(),v(),_.loadThumbsImages())):1==h.isTilesMode&&1==b()&&(v(),g.run());if(0==h.isHorizontal?h.isNavigationVertical?function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(l);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t+=p+h.spaceBetweenCols;var f=n+m;f>r&&(r=f),++s>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=l,s=0),1==h.numPanes&&h.numThumbsInPane++,f=n+m;var b=u+h.gridHeight;f>b&&(1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(h.gridHeight),b=h.gridHeight),n=b+h.spaceBetweenRows,u=n,t=l=0,s=0,i<_-1&&(h.numPanes++,h.arrPanes.push(n)))}a.height(r),h.innerHeight=r,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(r))}():function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(s);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t>l&&(l=t);var f=n+m;f>u&&(u=f);var b=l+p;b>h.innerWidth&&(h.innerWidth=b),t+=p+h.spaceBetweenCols,++r>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=s,r=0),1==h.numPanes&&h.numThumbsInPane++,n+m>h.gridHeight&&(n=0,s=h.innerWidth+h.spaceBetweenCols,t=s,r=0,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(h.gridHeight)),i<_-1&&(h.numPanes++,h.arrPanes.push(s)))}a.width(h.innerWidth),1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(u))}():function(){var e=a.children(".ug-thumb-wrapper"),t=c.grid_padding,n=c.grid_padding,r=n,s=t,l=0,u=0,_=0,g=0,p=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(t-c.grid_padding);var m=e.length;for(i=0;i<m;i++){var f=jQuery(e[i]),b=f.outerWidth(),v=f.outerHeight();s-t+b>h.gridWidth&&(r=0,++p>=c.grid_num_rows?(p=0,t=s,r=n,_=0,1==h.numPanes&&(h.gridWidth=l+c.grid_padding,o.width(h.gridWidth),h.gridHeight=g+c.grid_padding,o.height(h.gridHeight)),h.numPanes++,h.arrPanes.push(t-c.grid_padding)):(s=t,r=_+h.spaceBetweenRows)),d.placeElement(f,s,r);var y=s+b;y>l&&(l=y);var I=r+v;I>_&&(_=I),I>g&&(g=I),I>u&&(u=I);var y=l+b;y>h.innerWidth&&(h.innerWidth=y),s+=b+h.spaceBetweenCols,1==h.numPanes&&h.numThumbsInPane++}h.innerWidth=l+c.grid_padding,h.innerHeight=g+c.grid_padding,a.width(h.innerWidth),a.height(h.innerHeight),1==h.numPanes&&(h.gridWidth=l+c.grid_padding,h.gridHeight=g+c.grid_padding,o.width(h.gridWidth),o.height(h.gridHeight))}(),1==h.isFirstTimeRun&&h.isTilesMode){var r=_.getThumbs();r.each(function(e,t){n.trigger(h.eventSizeChange,jQuery(t))}),r.fadeTo(0,1)}null!=t&&y(t.index),l.trigger(s.events.PANE_CHANGE,h.currentPane),h.isFirstTimeRun=!1}function f(){if(1==h.isTilesMode)var e=g.getGlobalTileSize();else e=_.getGlobalThumbSize();return e}function b(){if(0==h.isTilesMode)throw new Error("Dynamic size can be set only in tiles mode");var e=!1,t=u.isMobileMode(),i=h.spaceBetweenCols;1==t?(h.spaceBetweenCols=c.grid_space_between_mobile,h.spaceBetweenRows=c.grid_space_between_mobile):(h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows),h.spaceBetweenCols!=i&&(e=!0);var n=f().width,r=h.tileMaxWidth;return d.getNumItemsInSpace(h.gridWidth,h.tileMaxWidth,h.spaceBetweenCols)<c.grid_min_cols&&(r=d.getItemSizeInSpace(h.gridWidth,c.grid_min_cols,h.spaceBetweenCols)),g.setTileSizeOptions(r),r!=n&&(e=!0),e}function v(){var e,t,i;0==h.isHorizontal?(e=f().width,t=c.grid_num_cols*e+(c.grid_num_cols-1)*h.spaceBetweenCols+2*c.grid_padding,i=h.gridHeight,h.gridWidth=t,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i):function(){var e=f().height,t=h.gridWidth,i=c.grid_num_rows*e+(c.grid_num_rows-1)*h.spaceBetweenRows+2*c.grid_padding;h.gridHeight=i,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i}()}function y(e){var t=P(e);if(-1==t)return!1;s.gotoPane(t,"scroll")}function I(e){if(e>=h.numPanes||e<0)throw new Error("Pane "+index+" doesn't exists.");return!0}function w(e){var t=T(e);if(0==t)return!1;a.stop(!0).animate(t,{duration:c.grid_transition_duration,easing:c.grid_transition_easing,queue:!1})}function E(){w(-h.arrPanes[h.currentPane])}function T(e){var t={};return 1==h.isNavigationVertical?t.top=e+"px":t.left=e+"px",t}function S(){var e=d.getElementSize(a);return 1==h.isNavigationVertical?e.top:e.left}function P(e){return 0==function(e){if(e<0||e>=h.numThumbs)throw new Error("Thumb not exists: "+e);return!0}(e)?-1:Math.floor(e/h.numThumbsInPane)}function x(){var e=d.getStoredEventData(h.storedEventID),t=S();diffPos=Math.abs(e.startInnerPos-t);var i=1==h.isNavigationVertical?h.gridHeight:h.gridWidth,n=Math.round(3*i/8);return diffPos>=n||e.diffTime<300&&diffPos>25}function j(){return 1==h.numPanes||d.isApproveStoredEventClick(h.storedEventID,h.isNavigationVertical)}function C(e){if(1==function(){if(1==h.numPanes)return!1;var e=d.getStoredEventData(h.storedEventID),t=e.diffTime,i=S(),n=Math.abs(i-e.startInnerPos);return n>30||n>5&&t>300}())return!0;var t=jQuery(this),i=_.getItemByThumb(t);u.selectItem(i)}function A(e){if(1==h.numPanes)return!0;if(1==h.touchActive)return!0;0==h.isTilesMode&&e.preventDefault(),h.touchActive=!0;var t={startInnerPos:S()};d.storeEventData(e,h.storedEventID,t)}function M(e){if(0==h.touchActive)return!0;e.preventDefault(),d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(0!=c.grid_vertical_scroll_ondrag&&1!=h.isNavigationVertical&&"vert"===d.handleScrollTop(h.storedEventID))return!0;var i=t.diffMousePos,n=t.startInnerPos+i,r=i>0?"prev":"next",o=h.arrPanes[h.numPanes-1];0==c.grid_carousel&&n>0&&"prev"==r&&(n/=3),0==c.grid_carousel&&n<-o&&"next"==r&&(n=t.startInnerPos+i/3),function(e){var t=T(e);if(0==t)return!1;a.css(t)}(n)}function O(e){if(0==h.touchActive)return!0;d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(h.touchActive=!1,0==x())return E(),!0;"next"==(S()-t.startInnerPos>0?"prev":"next")?0==c.grid_carousel&&s.isLastPane()?E():s.nextPane():0==c.grid_carousel&&s.isFirstPane()?E():s.prevPane()}function z(){var e=u.getSelectedItem();_.setThumbSelected(e.objThumbWrapper),y(e.index)}this.destroy=function(){if(0==h.isTilesMode){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.on(u.events.ITEM_CHANGE),_.destroy()}else g.destroy();o.unbind("mousedown"),o.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("touchend"),jQuery(window).add("body").unbind("mouseup"),l.off(s.events.PANE_CHANGE)},this.__________EXTERNAL_GENERAL_________=function(){},this.setThumbUnselected=function(e){_.setThumbUnselected(e)},this.isItemThumbVisible=function(e){return P(e.index)==h.currentPane},this.__________EXTERNAL_API_________=function(){},this.getNumPanesEstimationByHeight=function(e){if(1==h.isTilesMode)var t=c.tile_height;else t=_.getOptions().thumb_height;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_cols),r=n*t+(n-1)*h.spaceBetweenRows;return Math.ceil(r/e)},this.getNumPanesEstimationByWidth=function(e){if(h.isTilesMode)var t=c.tile_width;else t=_.getOptions().thumb_width;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_rows),r=n*t+(n-1)*h.spaceBetweenCols;return Math.ceil(r/e)},this.getHeightEstimationByWidth=function(e){if(0==h.isTilesMode)throw new Error("This function works only with tiles mode");var t=_.getNumThumbs(),i=d.getNumItemsInSpace(e,c.tile_width,h.spaceBetweenCols),n=Math.ceil(t/i);n>c.grid_num_rows&&(n=c.grid_num_rows);var r=d.getSpaceByNumItems(n,c.tile_height,h.spaceBetweenRows);return r+=2*c.grid_padding},this.getElement=function(){return o},this.getSize=function(){return d.getElementSize(o)},this.getNumPanes=function(){return h.numPanes},this.isFirstPane=function(){return 0==h.currentPane},this.isLastPane=function(){return h.currentPane==h.numPanes-1},this.getPaneInfo=function(){return{pane:h.currentPane,total:h.numPanes}},this.getPane=function(){return h.currentPane},this.setWidth=function(e){h.gridWidth=e,h.isHorizontal=!0},this.setMaxWidth=function(e){h.gridWidth=e,h.isMaxWidth=!0,h.isHorizontal=!0},this.setHeight=function(e){h.gridHeight=e,h.isHorizontal=!1},this.setMaxHeight=function(e){h.gridHeight=e,h.isMaxHeight=!0,h.isHorizontal=!1},this.gotoPane=function(e,t){if(0==I(e))return!1;if(e==h.currentPane)return!1;var i=-h.arrPanes[e];h.currentPane=e,w(i),l.trigger(s.events.PANE_CHANGE,e)},this.nextPane=function(){var e=h.currentPane+1;if(e>=h.numPanes){if(0==c.grid_carousel)return!0;e=0}s.gotoPane(e,"next")},this.prevPane=function(){var e=h.currentPane-1;if(e<0&&(e=h.numPanes-1,0==c.grid_carousel))return!1;s.gotoPane(e,"prev")},this.attachNextPaneButton=function(e){if(d.setButtonOnClick(e,s.nextPane),1==c.grid_carousel)return!0;s.isLastPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isLastPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachPrevPaneButton=function(e){if(d.setButtonOnClick(e,s.prevPane),1==c.grid_carousel)return!0;s.isFirstPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isFirstPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachBullets=function(e){e.setActive(h.currentPane),jQuery(e).on(e.events.BULLET_CLICK,function(t,i){s.gotoPane(i,"theme"),e.setActive(i)}),jQuery(s).on(s.events.PANE_CHANGE,function(t,i){e.setActive(i)})},this.getObjTileDesign=function(){return g},this.init=function(e,t,i){p(e,t,i)},this.run=function(){m()},this.setHtml=function(e){!function(e){var t=n;e&&(t=e),t.append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'></div></div>"),o=t.children(".ug-thumbs-grid"),a=o.children(".ug-thumbs-grid-inner"),1==h.isTilesMode?g.setHtml(a):_.setHtmlThumbs(a)}(e)}}function UGTileDesign(){var e,t,i=this,n=jQuery(this),r=new UniteGalleryMain,o=new UGFunctions,a=new UGThumbsGeneral;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"},this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"},this.events={TILE_CLICK:"tile_click"};var s={tile_width:250,tile_height:200,tile_size_by:i.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},l={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},u={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};function d(e,n){r=e,jQuery(e);var d=r.getObjects();t=d.g_objWrapper,r.getArrItems(),s=jQuery.extend(s,l),s=jQuery.extend(s,n),function(){1==s.tile_enable_overlay?(s.thumb_overlay_opacity=s.tile_overlay_opacity,s.thumb_overlay_color=s.tile_overlay_color):0==s.tile_enable_icons?s.thumb_color_overlay_effect=!1:s.thumb_overlay_opacity=0;s.tile_as_link&&(s.thumb_wrapper_as_link=!0,s.thumb_link_newpage=s.tile_link_newpage);1==s.tile_enable_outline&&0==s.tile_enable_border&&(s.tile_enable_outline=!1);u.tileInnerReduce=0,s.tile_enable_border&&(u.tileInnerReduce=2*s.tile_border_width,a.setThumbInnerReduce(u.tileInnerReduce));if(u.isSaparateIcons=!o.isRgbaSupported(),1==s.tile_enable_textpanel){switch(s.tile_textpanel_position){case"top":s.tile_textpanel_align="top";case"bottom":u.isTextpanelOutside=!0,s.tile_textpanel_always_on=!0,s.tile_textpanel_offset=0;break;case"inside_top":s.tile_textpanel_align="top";break;case"middle":s.tile_textpanel_align="middle",s.tile_textpanel_appear_type="fade"}0==s.tile_textpanel_always_on&&(u.isSaparateIcons=!0)}0!=s.tile_textpanel_offset&&(s.tile_textpanel_appear_type="fade",s.tile_textpanel_margin=s.tile_textpanel_offset);"title_and_desc"==s.tile_textpanel_source&&(s.tile_textpanel_enable_description=!0,s.tile_textpanel_desc_style_as_title=!0)}(),a.init(e,s);var _=["overlay"];u.funcCustomTileHtml&&(_=[]),a.setCustomThumbs(g,_,{allow_onresize:!1});var c=a.getOptions();s=jQuery.extend(s,c),u.ratioByWidth=s.tile_width/s.tile_height,u.ratioByHeight=s.tile_height/s.tile_width,s.tile_size_by==i.sizeby.GLOBAL_RATIO&&u.isTextpanelOutside&&(u.hasImageContainer=!0)}function _(){var e=r.isMobileMode();switch(u.isTextPanelHidden=!1,1==e&&0==s.tile_textpanel_always_on&&(u.isTextPanelHidden=!0),u.isVideoplayIconAlwaysOn=s.tile_videoplay_icon_always_on,s.tile_videoplay_icon_always_on){case"always":u.isVideoplayIconAlwaysOn=!0;break;case"never":u.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":u.isVideoplayIconAlwaysOn=1==e;break;case"desktop_only":u.isVideoplayIconAlwaysOn=0==e}}function g(e,t){if(e.addClass("ug-tile"),u.funcCustomTileHtml)return u.funcCustomTileHtml(e,t),!1;var n="";1==u.hasImageContainer&&(n+="<div class='ug-image-container ug-trans-enabled'>");var a="ug-thumb-image";0!=s.tile_enable_image_effect&&1!=s.tile_image_effect_reverse||(a+=" ug-trans-enabled");var l=o.stripTags(t.title);l=o.htmlentitles(l),n+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+l+"' class='"+a+"'>",1==u.hasImageContainer&&(n+="</div>"),e.append(n),s.tile_size_by==i.sizeby.GLOBAL_RATIO&&e.fadeTo(0,0);var d={};if(1==s.tile_enable_background&&(d["background-color"]=s.tile_background_color),1==s.tile_enable_border&&(d["border-width"]=s.tile_border_width+"px",d["border-style"]="solid",d["border-color"]=s.tile_border_color,s.tile_border_radius&&(d["border-radius"]=s.tile_border_radius+"px")),1==s.tile_enable_outline&&(d.outline="1px solid "+s.tile_outline_color),1==s.tile_enable_shadow){var _=s.tile_shadow_h+"px ";_+=s.tile_shadow_v+"px ",_+=s.tile_shadow_blur+"px ",_+=s.tile_shadow_spread+"px ",_+=s.tile_shadow_color,d["box-shadow"]=_}e.css(d);var g="";if(s.tile_enable_icons){if(0==s.tile_as_link&&1==s.tile_enable_action){var c="ug-button-play ug-icon-zoom";"image"!=t.type&&(c="ug-button-play ug-icon-play"),g+="<div class='ug-tile-icon "+c+"' style='display:none'></div>"}if(t.link&&1==s.tile_show_link_icon||1==s.tile_as_link)if(0==s.tile_as_link){var h="";1==s.tile_link_newpage&&(h=" target='_blank'"),g+="<a href='"+t.link+"'"+h+" class='ug-tile-icon ug-icon-link'></a>"}else g+="<div class='ug-tile-icon ug-icon-link' style='display:none'></div>";var m=u.isSaparateIcons;if(0==m&&"image"!=t.type&&1==u.isVideoplayIconAlwaysOn&&(m=!0),m)var f=e;else f=e.children(".ug-thumb-overlay");f.append(g);var b=f.children("."+c);0==b.length?b=null:b.hide();var v=f.children(".ug-icon-link");0==v.length?v=null:v.hide(),v||1!=s.tile_enable_action||e.addClass("ug-tile-clickable")}else 1==s.tile_enable_action&&e.addClass("ug-tile-clickable");if(1==s.tile_enable_image_effect){var y="";0==s.tile_image_effect_reverse&&(y=" ug-trans-enabled");var I="<div class='ug-tile-image-overlay"+y+"' >",w=" ug-"+s.tile_image_effect_type+"-effect";I+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+t.title+"' class='"+w+y+"'>",I+="</div>",e.append(I),1==s.tile_image_effect_reverse&&e.children(".ug-tile-image-overlay").fadeTo(0,0)}if(1==s.tile_enable_textpanel){var E=new UGTextPanel;E.init(r,s,"tile");var T="";1!=s.tile_textpanel_always_on&&1!=u.isTextpanelOutside||(T="ug-trans-enabled"),E.appendHTML(e,T);var S=t.title,P="";switch(s.tile_textpanel_source){case"desc":case"description":S=t.description;break;case"desc_title":""!=t.description&&(S=t.description);break;case"title_and_desc":S=t.title,P=t.description}if(E.setTextPlain(S,P),0==s.tile_textpanel_always_on&&E.getElement().fadeTo(0,0),e.data("objTextPanel",E),1==s.tile_textpanel_always_on)p(e).css("z-index",2);if(1==u.isTextpanelOutside){e.append("<div class='ug-tile-cloneswrapper'></div>");var x=e.children(".ug-tile-cloneswrapper"),j=new UGTextPanel;j.init(r,s,"tile"),j.appendHTML(x),j.setTextPlain(S,P),e.data("objTextPanelClone",j)}}null!==t.addHtml&&e.append(t.addHtml)}function c(e){return e.children(".ug-tile-image-overlay")}function h(e){return e.data("objTextPanel")}function p(e){return e.children(".ug-textpanel")}function m(e){if(1==u.isTextpanelOutside)var t=function(e){var t=e.find(".ug-tile-cloneswrapper .ug-textpanel");if(0==t.length)throw new Error("text panel cloned element not found");return t}(e);else t=p(e);return t?o.getElementSize(t).height:0}function f(e){var t=e.find(".ug-icon-link");return 0==t.length?null:t}function b(e){var t=e.find(".ug-button-play");return 0==t.length?null:t}function v(e){return!!e.hasClass("ug-thumb-over")}function y(e){return e.hasClass("ug-tile-clickable")}function I(e){return 1==s.tile_enable_icons&&1==u.isVideoplayIconAlwaysOn&&"image"!=e.type}function w(e,t,n,r){var a=c(e),l=i.getTileImage(e),d=function(e){return e.find(".ug-tile-image-overlay img")}(e);t-=u.tileInnerReduce,n-=u.tileInnerReduce;var _=null;if(1==u.isTextpanelOutside){var g=m(e);if(n-=g,"top"==s.tile_textpanel_position&&(_=g),1==u.hasImageContainer){var h=function(e){return 0==u.hasImageContainer?null:e.children(".ug-image-container")}(e);o.setElementSize(h,t,n),null!==_&&o.placeElement(h,0,_)}}if(0==s.tile_enable_image_effect)o.scaleImageCoverParent(l,t,n),0==u.hasImageContainer&&null!==_&&o.placeElement(l,0,_);else{var p="nothing";!0===r&&0==u.isTextpanelOutside&&(p=1==s.tile_image_effect_reverse?"effect":"image"),"effect"!=p&&(o.setElementSize(a,t,n),null!==_&&o.placeElement(a,0,_),o.scaleImageCoverParent(d,t,n)),"image"!=p&&(1==u.hasImageContainer?o.scaleImageCoverParent(l,t,n):"effect"==p?(o.scaleImageCoverParent(l,t,n),null!==_&&o.placeElement(l,0,_)):o.cloneElementSizeAndPos(d,l,!1,null,_))}}function E(e,t,n,r){var o=null;if(n&&(o=n-u.tileInnerReduce),r&&(r-=u.tileInnerReduce),"clone"==t)return function(e){return e.data("objTextPanelClone")}(e).refresh(!0,!0,o),i.getItemByTile(e).textPanelCloneSizeSet=!0,!1;var a=h(e);if(!a)return!1;var l=null;if(1==u.isTextpanelOutside&&(l=m(e)),a.refresh(!1,!0,o,l),1==s.tile_textpanel_always_on||"fade"==s.tile_textpanel_appear_type)if(1==u.isTextpanelOutside&&r&&"bottom"==s.tile_textpanel_position){var d=r-l;a.positionPanel(d)}else a.positionPanel()}function T(e){i.getItemByTile(e);var t=b(e),n=f(e),r=o.getElementSize(e);w(e,r.width,r.height),1==s.tile_enable_textpanel&&E(e,"regular",r.width,r.height);var a=r.width-u.tileInnerReduce,l=r.height-u.tileInnerReduce,d=0;if(1==u.isTextpanelOutside){var _=m(e);l-=_,"top"==s.tile_textpanel_position&&(d=_)}var g=function(e){return e.children(".ug-thumb-overlay")}(e);if(o.setElementSizeAndPosition(g,0,d,a,l),t||n){var c=0;if(1==s.tile_enable_textpanel&&0==u.isTextPanelHidden&&0==u.isTextpanelOutside){var h=p(e),v=o.getElementSize(h);v.height>0&&(c=Math.floor(v.height/2*-1))}}if(t&&n){var y=o.getElementSize(t),I=o.getElementSize(n),T=s.tile_space_between_icons,S=y.width+T+I.width,P=Math.floor((r.width-S)/2);P<T&&(T=Math.floor((r.width-y.width-I.width)/3),S=y.width+T+I.width,P=Math.floor((r.width-S)/2)),o.placeElement(t,P,"middle",0,c),o.placeElement(n,P+y.width+T,"middle",0,c)}else t&&o.placeElement(t,"center","middle",0,c),n&&o.placeElement(n,"center","middle",0,c);t&&t.show(),n&&n.show()}function S(e,t){i.getItemByTile(e);var n=c(e),r=s.thumb_transition_duration;if(0==s.tile_image_effect_reverse){var o=i.getTileImage(e);t?(o.fadeTo(0,1),n.stop(!0).fadeTo(r,0)):n.stop(!0).fadeTo(r,1)}else t?n.stop(!0).fadeTo(r,1):n.stop(!0).fadeTo(r,0)}function P(e,t){var i=s.thumb_transition_duration,n=p(e);if(!n)return!0;if("slide"==s.tile_textpanel_appear_type){var r=o.getElementSize(n);if(0==r.width)return!1;var a=-r.height,l={},u={},d="bottom";"inside_top"==s.tile_textpanel_position&&(d="top"),l[d]=a+"px",u[d]="0px",1==t?(n.fadeTo(0,1),0==n.is(":animated")&&n.css(l),u.opacity=1,n.stop(!0).animate(u,i)):n.stop(!0).animate(l,i)}else 1==t?n.stop(!0).fadeTo(i,1):n.stop(!0).fadeTo(i,0)}function x(e,t,i){var n=s.thumb_transition_duration;i&&!0===i&&(n=0);var r=b(e),o=f(e),a=t?1:0;r&&r.stop(!0).fadeTo(n,a),o&&o.stop(!0).fadeTo(n,a)}function j(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!0),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&0==u.isTextPanelHidden&&P(t,!0),u.isSaparateIcons&&1==s.tile_enable_icons){var n=1==s.thumb_overlay_reverse;0==I(i.getItemByTile(t))&&x(t,n,!1)}}function C(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!1),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&P(t,!1),1==u.isSaparateIcons&&1==s.tile_enable_icons){var n=1!=s.thumb_overlay_reverse;0==I(i.getItemByTile(t))?x(t,n,!1):x(t,!0,!0)}}function A(e,t,i){if(t=jQuery(t),1==s.tile_visible_before_image&&!0!==t.data("image_placed")&&!0!==i)return!0;T(t),a.setThumbNormalStyle(t)}function M(e,t,i){T(t),i.fadeTo(0,1),t.data("image_placed",!0)}function O(e){if(1==y(e))return n.trigger(i.events.TILE_CLICK,e),!0;var t;0==v(e)&&(t=e,a.getThumbs().not(t).each(function(e,t){a.setThumbNormalStyle(jQuery(t))}),a.setThumbOverStyle(e))}function z(e){var t=jQuery(this),r=t.prop("tagName").toLowerCase(),o=!0;if(u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(o=!1),"a"==r)0==o&&e.preventDefault();else if(0==v(t))1==o&&O(t);else{if(0==y(t))return!0;1==o&&n.trigger(i.events.TILE_CLICK,t)}}function L(e){e.stopPropagation();var t=jQuery(this).parents(".ug-tile"),r=!0;return u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(r=!1),0==v(t)?(O(t),!0):1==r?(n.trigger(i.events.TILE_CLICK,t),!1):void 0}function N(e){var t=jQuery(this).parents(".ug-tile");u.funcParentApproveClick&&0==u.funcParentApproveClick()&&e.preventDefault(),0==v(t)&&0==s.tile_as_link&&(e.preventDefault(),O(t))}this.loadTileImage=function(e){var t=i.getTileImage(e);o.checkImagesLoaded(t,null,function(t,i){M(null,e,jQuery(t))})},this.setHtml=function(t,i){e=t,!0!==i&&_(),a.setHtmlThumbs(t,i)},this.initEvents=function(){a.initEvents(),jQuery(a).on(a.events.SETOVERSTYLE,j),jQuery(a).on(a.events.SETNORMALSTYLE,C),jQuery(a).on(a.events.PLACEIMAGE,M),t.on(u.eventSizeChange,A),e.on("click",".ug-tile",z),e.on("click",".ug-tile .ug-button-play",L),e.on("click",".ug-tile .ug-icon-link",N)},this.destroy=function(){if(e.off("click",".ug-tile"),e.off("click",".ug-tile .ug-button-play"),e.off("click",".ug-tile .ug-icon-link"),jQuery(a).off(a.events.SETOVERSTYLE),jQuery(a).off(a.events.SETNORMALSTYLE),jQuery(a).off(a.events.PLACEIMAGE),t.off(u.eventSizeChange),1==s.tile_enable_textpanel){var i=a.getThumbs();jQuery.each(i,function(e,t){var i=h(jQuery(t));i&&i.destroy()})}a.destroy()},this.init=function(e,t,i){d(e,t)},this.setFixedMode=function(){s.tile_size_by=i.sizeby.GLOBAL_RATIO,s.tile_visible_before_image=!0},this.setApproveClickFunction=function(e){u.funcParentApproveClick=e},this.resizeTile=function(e,t,n,r){if(1==u.isTextpanelOutside&&E(e,"clone",t),t){if(!n)n=i.getTileHeightByWidth(t,e)}else{t=s.tile_width;var n=s.tile_height}switch(o.setElementSize(e,t,n),r){default:case i.resizemode.FULL:i.triggerSizeChangeEvent(e,!0);break;case i.resizemode.WRAPPER_ONLY:return!0;case i.resizemode.VISIBLE_ELEMENTS:if(u.funcCustomTileHtml)return i.triggerSizeChangeEvent(e,!0),!0;w(e,t,n,!0),1==s.tile_enable_textpanel&&1==s.tile_textpanel_always_on&&t&&E(e,"regular",t,n)}},this.resizeAllTiles=function(e,t,n){_();var r=null;if(s.tile_size_by==i.sizeby.GLOBAL_RATIO&&(r=i.getTileHeightByWidth(e)),!n)n=a.getThumbs();n.each(function(n,o){i.resizeTile(jQuery(o),e,r,t)})},this.triggerSizeChangeEvent=function(e,i){if(!e)return!1;if(!i)i=!1;t.trigger(u.eventSizeChange,[e,i])},this.triggerSizeChangeEventAllTiles=function(e){a.getThumbs().each(function(){var t=jQuery(this);i.triggerSizeChangeEvent(t,e)})},this.disableEvents=function(){a.getThumbs().css("pointer-events","none")},this.enableEvents=function(){a.getThumbs().css("pointer-events","auto")},this.setOptions=function(e){s=jQuery.extend(s,e),a.setOptions(e)},this.setTileSizeOptions=function(e){if(s.tile_size_by!==i.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");s.tile_width=e,s.tile_height=Math.floor(e*u.ratioByHeight)},this.setCustomFunctions=function(e,t){u.funcCustomTileHtml=e,u.funcCustomPositionElements=t},this.run=function(e){var t=a.type.GET_THUMBS_ALL;!0===e&&(t=a.type.GET_THUMBS_NEW);var n=a.getThumbs(t);s.tile_size_by==i.sizeby.GLOBAL_RATIO&&i.resizeAllTiles(s.tile_width,i.resizemode.WRAPPER_ONLY,n),1==s.tile_enable_image_effect&&0==s.tile_image_effect_reverse&&n.children(".ug-thumb-image").fadeTo(0,0),a.setHtmlProperties(n),1==s.tile_visible_before_image&&(n.children(".ug-thumb-image").fadeTo(0,0),a.loadThumbsImages())},this._____________EXTERNAL_GETTERS____________=function(){},this.getObjThumbs=function(){return a},this.getOptions=function(){return s},this.getTileImage=function(e){return e.find("img.ug-thumb-image")},this.getItemByTile=function(e){return a.getItemByThumb(e)},this.getTileHeightByWidth=function(e,t){var n=function(e){var t=u.ratioByHeight;switch(s.tile_size_by){default:t=u.ratioByHeight;break;case i.sizeby.IMAGE_RATIO:if(!e)throw new Error("tile should be given for tile ratio");var n=i.getItemByTile(e);if(void 0!==n.thumbRatioByHeight){if(0==n.thumbRatioByHeight)throw trace(n),new Error("the item ratio not inited yet");t=n.thumbRatioByHeight}break;case i.sizeby.CUSTOM:return null}return t}(t);if(null===n)return null;var r=Math.floor((e-u.tileInnerReduce)*n)+u.tileInnerReduce;return t&&1==u.isTextpanelOutside&&s.tile_size_by==i.sizeby.IMAGE_RATIO&&(r+=m(t)),r},this.getTileImageSize=function(e){var t=i.getItemByTile(e);if(!t.thumbWidth||!t.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:t.thumbWidth,height:t.thumbHeight}},this.getGlobalTileSize=function(){if(s.tile_size_by!=i.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:s.tile_width,height:s.tile_height}}}function UGTiles(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGTileDesign,d=new UGThumbsGeneral,_={},g={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0};this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"};var c={isFirstTimeRun:!0,handle:null,isTransActive:!1,isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1},h={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};function p(i,n){g_objects=i.getObjects(),s=i,e=jQuery(i),t=g_objects.g_objWrapper,g_objects.g_arrItems,g=jQuery.extend(g,n),function(){g.tiles_min_columns<1&&(g.tiles_min_columns=1);0!=g.tiles_max_columns&&g.tiles_max_columns<g.tiles_min_columns&&(g.tiles_max_columns=g.tiles_min_columns)}(),u.init(i,g),d=u.getObjThumbs()}function m(){if(i.addClass("ug-tiles-rest-mode"),c.isTransInited=!0,1==g.tiles_enable_transition){i.addClass("ug-tiles-transit");var e=u.getOptions();1==e.tile_enable_image_effect&&0==e.tile_image_effect_reverse&&i.addClass("ug-tiles-transit-overlays"),c.isTransActive=!0}}function f(){return l.getElementSize(i).width}function b(){return 0!=c.isTransInited&&(i.addClass("ug-tiles-transition-active"),i.removeClass("ug-tiles-rest-mode"),0!=c.isTransActive&&void u.disableEvents())}function v(){if(0==c.isTransInited)return!1;i.removeClass("ug-tiles-transition-active"),i.addClass("ug-tiles-rest-mode")}function y(){1==c.isTransActive?(setTimeout(function(){u.enableEvents(),u.triggerSizeChangeEventAllTiles(),v()},800),c.handle&&clearTimeout(c.handle),c.handle=setTimeout(function(){v(),u.triggerSizeChangeEventAllTiles(),c.handle=null},2e3)):(u.triggerSizeChangeEventAllTiles(),v())}function I(){_.colWidth=(_.availWidth-_.colGap*(_.numCols-1))/_.numCols,_.colWidth=Math.floor(_.colWidth),_.totalWidth=l.getSpaceByNumItems(_.numCols,_.colWidth,_.colGap)}function w(){if(_.colWidth=g.tiles_col_width,_.minCols=g.tiles_min_columns,_.maxCols=g.tiles_max_columns,0==s.isMobileMode()?_.colGap=g.tiles_space_between_cols:_.colGap=g.tiles_space_between_cols_mobile,_.galleryWidth=f(),_.availWidth=_.galleryWidth,1==g.tiles_include_padding&&(_.availWidth=_.galleryWidth-2*_.colGap),1==g.tiles_exact_width)_.numCols=l.getNumItemsInSpace(_.availWidth,_.colWidth,_.colGap),_.maxCols>0&&_.numCols>_.maxCols&&(_.numCols=_.maxCols),_.numCols<_.minCols?(_.numCols=_.minCols,I()):_.totalWidth=_.numCols*(_.colWidth+_.colGap)-_.colGap;else{var e=l.getNumItemsInSpaceRound(_.availWidth,_.colWidth,_.colGap);e<_.minCols?e=_.minCols:0!=_.maxCols&&e>_.maxCols&&(e=_.maxCols),_.numCols=e,I()}switch(g.tiles_align){case"center":default:_.addX=Math.round((_.galleryWidth-_.totalWidth)/2);break;case"left":_.addX=0;break;case"right":_.addX=_.galleryWidth-_.totalWidth}for(_.arrPosx=[],col=0;col<_.numCols;col++){var t=l.getColX(col,_.colWidth,_.colGap);_.arrPosx[col]=t+_.addX}}function E(){_.maxColHeight=0,_.colHeights=[0]}function T(e,t,n,r){if(null==r)r=function(){var e=0,t=999999999;for(col=0;col<_.numCols;col++){if(null==_.colHeights[col]||0==_.colHeights[col])return col;_.colHeights[col]<t&&(e=col,t=_.colHeights[col])}return e}();var o=0;void 0!==_.colHeights[r]&&(o=_.colHeights[r]);var a=u.getTileHeightByWidth(_.colWidth,e);if(null===a){if(1==g.tiles_enable_transition)throw new Error("Can't know tile height, please turn off transition");a=l.getElementSize(e).height}var s=_.arrPosx[r];l.placeElement(e,s,o);var d=o+a;_.colHeights[r]=d+_.colGap,_.maxColHeight<d&&(_.maxColHeight=d),1==t&&e.show().fadeTo(0,1),1==n&&i.height(_.maxColHeight)}function S(e){e||(e=!1),w(),E();var t=d.getThumbs(d.type.GET_THUMBS_RATIO);b(),u.resizeAllTiles(_.colWidth,u.resizemode.VISIBLE_ELEMENTS,t);for(var n=0;n<t.length;n++){var r=jQuery(t[n]),o=void 0;1==g.tiles_keep_order&&(o=l.getColByIndex(_.numCols,n)),T(r,e,!1,o)}y();var a=i.height();1==c.isTransActive&&a>_.maxColHeight?setTimeout(function(){i.height(_.maxColHeight)},700):i.height(_.maxColHeight)}function P(e,t){if(!0!==t&&0==function(e){var t=e.index();if(!0===s.getItem(t).ordered_placed)return!1;var i=l.getPrevRowSameColIndex(t,_.numCols);return i<0||!0===s.getItem(i).ordered_placed}(e))return!1;var i=e.index(),n=l.getColByIndex(_.numCols,i),r=s.getItem(i);u.resizeTile(e,_.colWidth),T(e,!0,!0,n),r.ordered_placed=!0;var o=s.getNumItems(),a=l.getNextRowSameColIndex(i,_.numCols);if(a>=o)return!1;var g=d.getThumbByIndex(a),c=s.getItem(a);d.isThumbLoaded(g);d.isThumbLoaded(g)&&!c.ordered_placed&&P(g,!0)}function x(){var e=d.getThumbs(d.type.GET_THUMBS_NO_RATIO);if(!e||0==e.length)return!1;if(c.isAllLoaded=!1,1==c.isFirstPlaced){w(),E();var t=Math.abs(_.galleryWidth-_.totalWidth);if(1==g.tiles_set_initial_height&&0==l.isScrollbarExists()&&t<25){e.length;var n=Math.ceil(e.length/_.numCols)*g.tiles_col_width*.75;i.height(n),w()}}e.fadeTo(0,0);var r=e.find("img.ug-thumb-image"),h=_.numCols,p=_.galleryWidth;l.checkImagesLoaded(r,function(){w(),h==_.numCols&&p==_.galleryWidth||S(!1),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){1==c.isFirstPlaced&&s.triggerEvent(o.events.TILES_FIRST_PLACED),function(e,t){if(1==t)return!1;e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e),1==g.tiles_keep_order?P(i):(u.resizeTile(i,_.colWidth),T(i,!0,!0))}(e,t)})}function j(){var e=f(),t=d.getThumbs(!0),i=g.tiles_justified_row_height,n=[],r=0,o=g.tiles_justified_space_between,a=t.length;jQuery.each(t,function(e,t){t=jQuery(t);var o=d.getItemByThumb(t),a=o.thumbWidth;o.thumbHeight!==i&&(a=Math.floor(o.thumbRatioByWidth*i)),n[e]=a,r+=a});var s=Math.ceil(r/e);s>a&&(s=a);var l=r/s,u=[],_=0,c=[],h=[],p=0,m=0;jQuery.each(t,function(e,t){var i=n[e];p+i/2>(m+1)*l&&(c[u.length]=_,u.push(h),h=[],_=0,m++),p+=i,_+=i,h.push(t)}),c[u.length]=_,u.push(h);var b=[],v=[],y=0;return jQuery.each(u,function(t,r){r.length;var a=c[t],s=(r.length-1)*o,l=(e-s)/a,u=Math.round(i*l);y+=u,t>0&&(y+=o),v.push(u);var d=u/i,_=[],g=s;jQuery.each(r,function(e,t){var i=jQuery(t).index(),r=n[i],o=Math.round(r*d);_[e]=o,g+=o});var h=g-e;jQuery.each(_,function(e,t){if(0==h)return!1;h<0?(_[e]=t+1,h++):(_[e]=t-1,h--),e==_.length-1&&0!=h&&(_[e]-=h)}),b[t]=_}),{arrRows:u,arrRowWidths:b,arrRowHeights:v,gap:o,totalHeight:y}}function C(e){if(!e)e=!1;var t=f(),n=j();i.height(n.totalHeight),f()!=t&&(n=j()),b();var r=0,o=0;jQuery.each(n.arrRows,function(t,i){var a=n.arrRowWidths[t],s=n.arrRowHeights[t],d=0;jQuery.each(i,function(t,i){var _=jQuery(i),g=s,c=a[t];u.resizeTile(_,c,g,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(_,d,r),(d+=c)>o&&(o=d),d+=n.gap,1==e&&jQuery(i).show()}),r+=s+n.gap}),y()}function A(){var e=f();switch(h.galleryWidth=e,n={},h.colWidth=g.tiles_nested_col_width,h.optimalTileWidth=g.tiles_nested_optimal_tile_width,h.currentGap=g.tiles_space_between_cols,1==s.isMobileMode()&&(h.currentGap=g.tiles_space_between_cols_mobile),null==h.colWidth?h.colWidth=Math.floor(h.optimalTileWidth/h.nestedOptimalCols):h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.maxColumns=l.getNumItemsInSpace(e,h.colWidth,h.currentGap),h.colWidth=l.getItemSizeInSpace(e,h.maxColumns,h.currentGap),h.gridY=0,r=[],d.getThumbs(!0).each(function(){var e=function(e){var t,i,n={},r=h.colWidth,o=h.currentGap,a=u.getTileImageSize(e),s=e.index(),l=Math.ceil(function(e){return Math.abs(Math.sin(Math.abs(1e3*Math.sin(e))))}(s)*(1*h.nestedOptimalCols/3)+2*h.nestedOptimalCols/3),d=a.width,_=a.height,g=d/_;d>_?(t=l,0==(i=Math.round(t/g))&&(i=1)):(i=l,0==(t=Math.round(i*g))&&(t=1));return n.dimWidth=t,n.dimHeight=i,n.width=t*r+o*(t-1),n.height=i*r+o*(i-1),n.imgWidth=d,n.imgHeight=_,n.left=0,n.top=0,n}(jQuery(this));r.push(e)}),h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.totalWidth=h.maxColumns*(h.colWidth+h.currentGap)-h.currentGap,g.tiles_align){case"center":default:h.addX=Math.round((h.galleryWidth-h.totalWidth)/2);break;case"left":h.addX=0;break;case"right":h.addX=h.galleryWidth-h.totalWidth}h.maxGridY=0}function M(e){var t=f();A(),O();var n=h.maxGridY*(h.colWidth+h.currentGap)-h.currentGap;i.height(n),f()!=t&&(A(),O()),0==g.tiles_nested_debug&&function(e){if(!e)var e=!1;b();for(var t=0;t<r.length;t++)U(t,e);i.height(h.maxColHeight),y()}(e)}function O(e){if(1==g.tiles_nested_debug)return void 0===e&&(e=!0),function(e,t){if(0==t){for(var i=h.currentItem;i<r.length;i++)z(i,!0);h.currentItem=r.length-1}else z(h.currentItem,!0);for(i=0;i<=h.currentItem;i++)U(i,!0);h.currentItem++}(0,e),!1;for(var t=0;t<r.length;t++)z(t,!0)}function z(e,t){if(!t)t=!1;h.maxColHeight=0;for(var i=l.getObjectLength(n),r=h.gridY;r<=i+1;r++){for(var o=0;o<h.maxColumns;o++){if(0==Q(h.gridY)||0==B(h.gridY,o))return void L(e,D(o),o)}h.gridY++}}function L(e,t,i){var o=jQuery.extend(!0,{},r[e]),a=o.dimWidth,s=t-o.dimWidth,l=h.nestedOptimalCols;if(t<=o.dimWidth||s<=.33*l||t<=l)H(e,t);else if(s<=l)l>=4?1==G(Math.floor(t/2),i)?H(e,Math.floor(t/2)+1):H(e,Math.floor(t/2)):H(objImage,t);else if(1==G(a,i))switch(a>=l){case!0:H(e,a-1);break;case!1:H(e,a+1)}var u,d,_,g,c,p,m,f,b,v=function(e,t,i){var r=h.gridY-1,o=0,a=0,s=1,l=[],u=[];if(l.push(e),r>=0){for(a=0;r>=0;){if(o=n[r][i],void 0!==n[r][i-1]&&n[r][i-1]==n[r][i]||void 0!==n[r][i+t]&&n[r][i+t-1]==n[r][i+t]||n[r][i]!=n[r][i+t-1])return u.push(s),u.push(l),u;a!=o&&(s++,l.push(o)),r--,a=o}return u.push(s),u.push(l),u}return[0,[]]}(e,(o=jQuery.extend(!0,{},r[e])).dimWidth,i);if(h.columnsValueToEnableHeightResize<=v[0]&&h.maxColumns>=2*h.nestedOptimalCols){var y=function(e,t){var i=0,r=0,o=t.dimWidth,a=t.dimHeight,s=0,l=0,u=jQuery.map(n,function(e,t){return[e]});if(void 0===u[h.gridY]||void 0===u[h.gridY][e-1])r=0;else for(var d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e-1];)s=n[h.gridY+d][e-2],d++,r++;if(void 0===u[h.gridY]||void 0===u[h.gridY][e+o])i=0;else for(d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e+o];)l=n[h.gridY+d][e+o+1],d++,i++;var _=0,g=0;Math.abs(a-r)<Math.abs(a-i)&&0!=r?(_=r,g=s):0!=i?(_=i,g=l):_=a;return{newHeight:_,idToResize:g}}(i,o),I=k(e,y.newHeight,!0);r[e].dimHeight=I.dimHeight;var w=function(e,t){for(var i=0,n=0,o=[],a=0,s=0,l=0;l<e[1].length;l++){var u=e[1][l],d=r[e[1][l]];if(n+=d.dimHeight,0!=l)i+=d.dimHeight,o.push([u,d.dimHeight]);else{var _=H(u,t,!0);i+=_.dimHeight,o.push([e[1][l],_.dimHeight])}}a=d.left,s=d.top;for(var g=n,c=[],l=o.length-1;l>=0;l--){var h,u=o[l][0];0!=l?(h=Math.max(Math.round(1*n/3),Math.floor(o[l][1]*(n/i))),g-=h,(_=k(u,h,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}),s+=_.dimHeight):((_=k(u,h=g,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}))}return c}(v,I.dimWidth),E=!1;(function(e){for(var t=0,i=0,r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&h.maxColumns>o.left+o.dimWidth&&(a=n[o.top+o.dimHeight-1][o.left+o.dimWidth],s=n[o.top+o.dimHeight][o.left+o.dimWidth]),a!=s&&t++}for(var r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&o.left-1>=0&&(a=n[o.top+o.dimHeight-1][o.left-1],s=n[o.top+o.dimHeight][o.left-1]),a!=s&&i++}return Math.max(i,t)})(w)>=2&&(E=!0),y.newHeight>=o.dimHeight&&(o=k(e,y.newHeight,!0));var T=(u=y.idToResize,d=y.newHeight,_=o.dimHeight,g=r[u],c=g.dimHeight,g.dimWidth,p=g.left,m=g.top,parseInt(m/(h.colWidth+h.currentGap)),parseInt(p/(h.colWidth+h.currentGap)),f=k(u,c-d+_,!0),(b=[]).push({tileID:u,sizes:f}),b);return o.top=h.gridY,o.left=i,T.push({tileID:e,sizes:o}),R(T)<R(w)||1==E?void N(T):void N(w)}o.left=i,o.top=h.gridY,r[e]=o,W(e,o,i,h.gridY),h.maxGridY=o.top+o.dimHeight}function N(e){for(var t=0;t<e.length;t++){var i=e[t].sizes,n=e[t].tileID;r[n]=jQuery.extend(!0,{},i),W(n,i,i.left,i.top)}}function H(e,t,i){i||(i=!1);var n=h.colWidth,o=h.currentGap,a=r[e],s=a.imgWidth/a.imgHeight;if(dimWidth=t,dimHeight=Math.round(dimWidth/s),1==i){var l=jQuery.extend(!0,{},a);return l.dimWidth=dimWidth,l.dimHeight=dimHeight,l.width=dimWidth*n+o*(dimWidth-1),l.height=dimHeight*n+o*(dimHeight-1),l}a.dimWidth=dimWidth,a.dimHeight=dimHeight,a.width=dimWidth*n+o*(dimWidth-1),a.height=dimHeight*n+o*(dimHeight-1)}function k(e,t,i){i||(i=!1);var n=r[e],o=n.dimWidth,a=h.colWidth,s=h.currentGap;if(1==i){var l=jQuery.extend(!0,{},n);return l.dimHeight=t,l.width=o*a+s*(o-1),l.height=t*a+s*(t-1),l}n.dimHeight=t,n.width=o*a+s*(o-1),n.height=t*a+s*(t-1)}function R(e){for(var t=0,i=0,n=0;n<e.length;n++){var o=r[e[n].tileID];if(0==o.dimHeight||0==o.height)return;resizeVal=o.dimWidth/o.dimHeight/(o.imgWidth/o.imgHeight),resizeVal<1&&(resizeVal=1/resizeVal),t+=resizeVal,i++}return t/i}function G(e,t){var i=h.gridY-1;return!(i<=0||0==Q(i))&&n[i][t+e-1]!=n[i][t+e]}function D(e){var t=e,i=0;if(1==Q(h.gridY))for(;0==B(h.gridY,t);)i++,t++;else i=h.maxColumns;return i}function Q(e){return void 0!==n[e]}function W(e,t,i,n){for(var r=0;r<t.dimHeight;r++)for(var o=0;o<t.dimWidth;o++)0==Q(n+r)&&F(n+r),Y(n+r,i+o,e)}function F(e){n[e]=new Object;for(var t=0;t<h.maxColumns;t++)n[e][t]=-1}function B(e,t){return-1!=n[e][t]}function Y(e,t,i){n[e][t]=i}function U(e,t){var i=d.getThumbByIndex(e),n=r[e],o=n.top*(h.colWidth+h.currentGap),a=h.addX+n.left*(h.colWidth+h.currentGap);u.resizeTile(i,n.width,n.height,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(i,a,o),o+n.height>h.maxColHeight&&(h.maxColHeight=o+n.height),1==t&&i.fadeTo(0,1)}function V(){if(1==c.isFirstTimeRun)return!0;if(0==c.isAllLoaded)return!1;switch(g.tiles_type){case"columns":S(!1);break;case"justified":C(!1);break;case"nested":1==s.isMobileMode()?S(!1):M(!1)}}function X(){switch(t.children(".ug-tile").show(),1==c.isFirstTimeRun&&(a.on(o.events.ALL_TILES_LOADED,function(){c.isAllLoaded=!0}),e.on(s.events.SIZE_CHANGE,V),e.on(o.events.TILES_FIRST_PLACED,function(){c.isFirstPlaced=!1}),u.initEvents()),u.run(),g.tiles_type){default:case"columns":x();break;case"justified":i=jQuery(t).find("img.ug-thumb-image"),n=d.getThumbs(),c.isAllLoaded=!1,n.fadeTo(0,0),l.checkImagesLoaded(i,function(){setTimeout(function(){C(!0),n.fadeTo(0,1),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)})},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)});break;case"nested":!function(){var e=jQuery(t).find("img.ug-thumb-image"),i=d.getThumbs();c.isAllLoaded=!1,i.fadeTo(0,0),l.checkImagesLoaded(e,function(){1==s.isMobileMode()?S(!0):M(!0),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)})}()}var i,n;c.isFirstTimeRun=!1}this.destroy=function(){e.off(s.events.SIZE_CHANGE),u.destroy(),e.off(o.events.TILES_FIRST_PLACED)},this.init=function(e,t){p(e,t)},this.setHtml=function(e){!function(e){e||(e=i||t);i=e;var n=g.tiles_type;e.addClass("ug-tiletype-"+n),u.setHtml(e),e.children(".ug-thumb-wrapper").hide()}(e)},this.getObjTileDesign=function(){return u},this.run=function(){X()},this.runNewItems=function(){if(!i)throw new Error("Can't run new items - parent not set");switch(u.setHtml(i,!0),u.run(!0),g.tiles_type){case"columns":x();break;default:case"justified":case"nested":throw new Error("Tiles type: "+g.tiles_type+" not support load more yet")}}}function UGAviaControl(){var e,t,i,n,r,o,a={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",isStripMoving:!1,isControlEnabled:!0,maxDpos:1e3};function s(t){if(0==a.isControlEnabled)return!0;if(1==a.touchEnabled)return jQuery("body").off("mousemove"),!0;a.isMouseInsideStrip=i.ismouseover();var s=e.isTouchMotionActive();1==a.isMouseInsideStrip&&0==s?function(e){var t=function(e){return 0==o?function(e){var t=r.strip_padding_left,o=r.strip_padding_right,a=i.width()-t-o,s=n.width();if(a>s)return null;var l=i.offset().left,u=e-l-t,d=r.thumb_width,_=a-r.thumb_width;u<d&&(u=d);u>_&&(u=_);var g=(u-d)/(_-d)*(s-a);return g=-1*Math.round(g)+t}(e):function(e){var t=r.strip_padding_top,o=(r.strip_padding_bottom,i.height()),a=n.height();if(o>a)return null;var s=i.offset().top,l=e-s-t;if(l<0)return null;var u=r.thumb_height,d=o-r.thumb_height;l<u&&(l=u);l>d&&(l=d);var _=(l-u)/(d-u)*(a-o);return _=-1*Math.round(_)+t}(e)}(e);if(null===t)return!1;a.is_strip_moving=!0,a.strip_finalPos=t,function(){if(1==a.isStripMoving)return!1;a.isStripMoving=!0,a.handle_timeout=setInterval(l,10)}()}(function(e){return 0==o?e.pageX:e.pageY}(t)):u()}function l(){if(0==a.is_strip_moving)return!1;var t=a.maxDpos,i=e.getInnerStripPos();Math.floor(i)==Math.floor(a.strip_finalPos)&&u();var n,r=Math.abs(a.strip_finalPos-i);r<1?n=r:(n=r/4)>0&&n<1&&(n=1),a.strip_finalPos<i&&(n*=-1),n>t&&(n=t),n<-t&&(n=-t);var o=i+n;e.positionInnerStrip(o)}function u(){if(0==a.isStripMoving)return!1;a.isStripMoving=!1,a.handle_timeout=clearInterval(a.handle_timeout)}this.enable=function(){a.isControlEnabled=!0},this.disable=function(){a.isControlEnabled=!1},this.onResize=function(){},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,jQuery("body").on("touchstart",function(e){if(0==a.isControlEnabled)return!0;a.touchEnabled=!0}),jQuery("body").mousemove(s)},this.destroy=function(){jQuery("body").off("touchstart"),jQuery("body").off("mousemove")}}function UGSlider(){var e,t,i,n,r,o,a,s,l,u,d,_,g,c=this,h=jQuery(c),p=new UniteGalleryMain,m=null,f=null,b=null,v=new UGVideoPlayer,y=new UGFunctions,I=null,w=null;this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"};var E={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!1,slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_skin:"",slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:20,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:20,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square"},T={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},S={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};function P(i,n,r){p=i,r&&(g=r,n=y.convertCustomPrefixOptions(n,g,"slider")),e=jQuery(i);var o=p.getObjects();if(t=o.g_objWrapper,o.g_objThumbs,n.hasOwnProperty("slider_progress_indicator_type")&&(E.slider_progress_indicator_type=n.slider_progress_indicator_type),"bar"==E.slider_progress_indicator_type&&(E=jQuery.extend(E,T)),n&&c.setOptions(n),function(){var e=p.getOptions(),t=e.gallery_skin;""==E.slider_bullets_skin&&(E.slider_bullets_skin=t);""==E.slider_arrows_skin&&(E.slider_arrows_skin=t);""==E.slider_zoompanel_skin&&(E.slider_zoompanel_skin=t);""==E.slider_play_button_skin&&(E.slider_play_button_skin=t);""==E.slider_fullscreen_button_skin&&(E.slider_fullscreen_button_skin=t);E.video_enable_closebutton=E.slider_video_enable_closebutton,"zoom"!=e.gallery_mousewheel_role&&(E.slider_zoom_mousewheel=!1)}(),1==E.slider_enable_bullets){b=new UGBullets;var a={bullets_skin:E.slider_bullets_skin,bullets_space_between:E.slider_bullets_space_between};b.init(p,a)}E.slider_enable_text_panel&&(w=new UGTextPanel).init(p,E,"slider"),E.slider_enable_zoom_panel&&(_=new UGZoomButtonsPanel).init(c,E);var s=p.getGalleryID();v.init(E,!1,s)}function x(){if(1==S.isRunOnce)return!1;if(S.isRunOnce=!0,E.slider_background_color){var t=E.slider_background_color;1!=E.slider_background_opacity&&(t=y.convertHexToRGB(t,E.slider_background_opacity)),i.css("background-color",t)}else 1!=E.slider_background_opacity&&(t=y.convertHexToRGB("#000000",E.slider_background_opacity),i.css("background-color",t));1==E.slider_control_swipe&&(u=new UGTouchSliderControl).init(c,E),1==E.slider_control_zoom&&(d=new UGZoomSliderControl).init(c,E),w&&w.run(),function(){e.on(p.events.ITEM_IMAGE_UPDATED,se),e.on(p.events.ITEM_CHANGE,K),b&&jQuery(b).on(b.events.BULLET_CLICK,J);1==E.slider_enable_arrows&&(y.addClassOnHover(l,"ug-arrow-hover"),y.addClassOnHover(s,"ug-arrow-hover"),p.setNextButton(l),p.setPrevButton(s));0==E.slider_controls_always_on&&i.hover(ie,ne);i.on("touchend click",$),h.on(c.events.CLICK,ee),w&&1==S.isTextPanelSaparateHover&&i.hover(D,G);m&&(y.addClassOnHover(m,"ug-button-hover"),p.setPlayButton(m));f&&(y.addClassOnHover(f,"ug-button-hover"),p.setFullScreenToggleButton(f));d&&h.on(c.events.ZOOM_CHANGE,te);_&&_.initEvents();v.initEvents(),jQuery(v).on(v.events.SHOW,oe),jQuery(v).on(v.events.HIDE,ae),ue(r),ue(o),ue(a),h.on(c.events.AFTER_PUT_IMAGE,le),i.on("mouseenter",".ug-item-wrapper img",function(e){h.trigger(c.events.IMAGE_MOUSEENTER)}),i.on("mouseleave",".ug-item-wrapper img",function(e){var t=c.isMouseInsideSlideImage(e);0==t&&h.trigger(c.events.IMAGE_MOUSELEAVE)})}()}function j(e,t){var i="ug-type-square";"round"==E.slider_videoplay_button_type&&(i="ug-type-round");var n="";return n+="<div class='ug-slide-wrapper ug-slide"+t+"'>",n+="<div class='ug-item-wrapper'></div>",n+="<div class='ug-slider-preloader "+e+"'></div>",n+="<div class='ug-button-videoplay "+i+"' style='display:none'></div>",n+="</div>"}function C(e){e&&(t=e);var u=function(){var e;switch(E.slider_loader_type){default:case 1:e="ug-loader1";break;case 2:e="ug-loader2";break;case 3:e="ug-loader3";break;case 4:e="ug-loader4";break;case 5:e="ug-loader5";break;case 6:e="ug-loader6";break;case 7:e="ug-loader7";break;case 8:e="ug-loader8";break;case 9:e="ug-loader9"}"black"==E.slider_loader_color&&(e+=" ug-loader-black");return e}(),d=(p.getOptions(),"<div class='ug-slider-wrapper'>");(d+="<div class='ug-slider-inner'>",d+=j(u,1),d+=j(u,2),d+=j(u,3),d+="</div>",1==E.slider_enable_arrows&&(d+="<div class='ug-slider-control ug-arrow-left ug-skin-"+E.slider_arrows_skin+"'></div>",d+="<div class='ug-slider-control ug-arrow-right ug-skin-"+E.slider_arrows_skin+"'></div>"),1==E.slider_enable_play_button&&(d+="<div class='ug-slider-control ug-button-play ug-skin-"+E.slider_play_button_skin+"'></div>"),1==E.slider_enable_fullscreen_button&&(d+="<div class='ug-slider-control ug-button-fullscreen ug-skin-"+E.slider_fullscreen_button_skin+"'></div>"),d+="</div>",t.append(d),i=t.children(".ug-slider-wrapper"),n=i.children(".ug-slider-inner"),r=n.children(".ug-slide1"),o=n.children(".ug-slide2"),a=n.children(".ug-slide3"),r.data("slidenum",1),o.data("slidenum",2),a.data("slidenum",3),b&&b.appendHTML(i),1==E.slider_enable_arrows&&(s=i.children(".ug-arrow-left"),l=i.children(".ug-arrow-right")),1==E.slider_enable_play_button&&(m=i.children(".ug-button-play")),1==E.slider_enable_fullscreen_button&&(f=i.children(".ug-button-fullscreen")),1==E.slider_enable_progress_indicator)&&("bar"==(I=y.initProgressIndicator(E.slider_progress_indicator_type,E,i)).getType()&&"pie"==E.slider_progress_indicator_type&&(E.slider_progress_indicator_type="bar",E=jQuery.extend(E,T)),p.setProgressIndicator(I));1==E.slider_enable_text_panel&&(w.appendHTML(i),0==E.slider_textpanel_always_on&&(w.getElement().hide().data("isHidden",!0),S.isTextPanelSaparateHover=!0));1==E.slider_enable_zoom_panel&&_.appendHTML(i),v.setHtml(n)}function A(e){var t=_e(e);y.placeElementInParentCenter(t);var i=ge(e);y.placeElementInParentCenter(i)}function M(){if(b&&(objBullets=b.getElement(),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert)),1==E.slider_enable_arrows&&(y.placeElement(s,E.slider_arrow_left_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_left_offset_hor,E.slider_arrow_left_offset_vert),y.placeElement(l,E.slider_arrow_right_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_right_offset_hor,E.slider_arrow_right_offset_vert)),0==E.slider_controls_always_on&&X(!0),I){var e=I.getElement();if("bar"==E.slider_progress_indicator_type){var t=i.width();I.setSize(t),y.placeElement(e,"left",E.slider_progress_indicator_align_vert,0,E.slider_progress_indicator_offset_vert)}else y.placeElement(e,E.slider_progress_indicator_align_hor,E.slider_progress_indicator_align_vert,E.slider_progress_indicator_offset_hor,E.slider_progress_indicator_offset_vert)}w&&w.positionPanel(),function(){m&&y.placeElement(m,E.slider_play_button_align_hor,E.slider_play_button_align_vert,E.slider_play_button_offset_hor,E.slider_play_button_offset_vert);f&&y.placeElement(f,E.slider_fullscreen_button_align_hor,E.slider_fullscreen_button_align_vert,E.slider_fullscreen_button_offset_hor,E.slider_fullscreen_button_offset_vert);if(_){var e=_.getElement();y.placeElement(e,E.slider_zoompanel_align_hor,E.slider_zoompanel_align_vert,E.slider_zoompanel_offset_hor,E.slider_zoompanel_offset_vert)}}(),A(r),A(o),A(a),p.isMobileMode()?(1==E.slider_fullscreen_button_mobilehide&&f&&f.hide(),1==E.slider_play_button_mobilehide&&m&&m.hide(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().hide()):(1==E.slider_fullscreen_button_mobilehide&&f&&f.show(),1==E.slider_play_button_mobilehide&&m&&m.show(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().show())}function O(){var e,t,i,r,o=c.getSlidesReference(),a=0;i=c.isSlideHasItem(o.objNextSlide),(r=c.isSlideHasItem(o.objPrevSlide))?(a=o.objPrevSlide.outerWidth(),o.objPrevSlide.css("z-index",1)):o.objPrevSlide.hide(),e=t=a+o.objCurrentSlide.outerWidth(),i?(e=t+o.objNextSlide.outerWidth(),o.objPrevSlide.css("z-index",2)):o.objNextSlide.hide(),o.objCurrentSlide.css("z-index",3),y.placeElement(o.objCurrentSlide,a,0),n.css({left:-a+"px",width:e+"px"}),r&&(y.placeElement(o.objPrevSlide,0,0),y.showElement(o.objPrevSlide)),i&&(y.showElement(o.objNextSlide),y.placeElement(o.objNextSlide,t,0))}function z(e){var t=e.data("index");if(void 0===t||null==t)return!1;var i=p.getItem(t);if(!i)return!1;R(e,i)}function L(e){e.stop(!0).hide(100)}function N(e,t,i){var n={};if(1==E.slider_image_border){n["border-style"]="solid";var r=function(e,t){if((a=E.slider_image_border_width)<=10)return a;var i=y.getElementSize(e),n=i.width,r=i.height;if(t&&(t.hasOwnProperty("imageWidth")&&(n=t.imageWidth),t.hasOwnProperty("imageHeight")&&(r=t.imageHeight)),n<=0)return a;var o=n<r?n:r;if(2*a/o<E.slider_image_border_maxratio)return a;var a=o*E.slider_image_border_maxratio/2;return a=Math.round(a)}(e,i);n["border-width"]=r+"px",n["border-color"]=E.slider_image_border_color,n["border-radius"]=E.slider_image_border_radius}"image"!=t&&1==E.slider_video_constantsize&&(n["background-color"]="#000000"),1==E.slider_image_shadow&&(n["box-shadow"]="3px 3px 10px 0px #353535"),e.css(n)}function H(e,t){var i=E.slider_video_constantsize_width,n=E.slider_video_constantsize_height,r=E.slider_video_constantsize_scalemode;return y.scaleImageExactSizeInParent(e,t.imageWidth,t.imageHeight,i,n,r)}function k(e,t,i){var n=e.children(".ug-item-wrapper"),r=_e(e);if(void 0===t.urlImage||""==t.urlImage)throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");var o=t.urlImage,a=e.data("urlImage");e.data("urlImage",o);var s=c.getScaleMode(e),l=c.getSlideType(e);objPadding=c.getObjImagePadding();var u="";if("string"==typeof t.description&&(u=t.description),a==o&&!0!==i){(_=n.children("img")).attr("alt",u),0!=t.imageWidth&&0!=t.imageHeight||p.checkFillImageSize(_,t);var d={};N(_,l,d="image"!=l&&1==E.slider_video_constantsize?H(_,t):y.scaleImageFitParent(_,t.imageWidth,t.imageHeight,s,objPadding)),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else{var _;if((_=y.placeImageInsideParent(o,n,t.imageWidth,t.imageHeight,s,objPadding)).attr("alt",u),1==t.isBigImageLoaded){if(_.fadeTo(0,1),L(r),"image"!=l&&1==E.slider_video_constantsize)d=H(_,t);else d=y.getImageInsideParentData(n,t.imageWidth,t.imageHeight,s,objPadding);_.css("width",d.imageWidth+"px"),N(_,l,d),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else _.fadeTo(0,0),function(e){e.stop(!0).show(100)}(r),e.data("isLoading",!0),c.isSlideCurrent(e)&&h.trigger(c.events.CURRENTSLIDE_LOAD_START),_.data("itemIndex",t.index),_.on("load",function(){var e=jQuery(this),t=e.data("itemIndex");e.fadeTo(0,1);var i=e.parent().parent(),n=c.getSlideType(i),r=_e(i),o=c.getObjImagePadding(),a=c.getScaleMode(i);L(r),i.data("isLoading",!1),c.isSlideCurrent(i)&&h.trigger(c.events.CURRENTSLIDE_LOAD_END),p.onItemBigImageLoaded(null,e);var s=p.getItem(t),l={};"image"!=n&&1==E.slider_video_constantsize?H(e,s):l=y.scaleImageFitParent(e,s.imageWidth,s.imageHeight,a,o),e.fadeTo(0,1),N(e,n,l),h.trigger(c.events.AFTER_PUT_IMAGE,i)})}}function R(e,t){try{var i=e.children(".ug-item-wrapper");if(null==t)return i.html(""),e.removeData("index"),e.removeData("type"),e.removeData("urlImage"),!1;e.data("index");e.data("index",t.index),e.data("type",t.type),1==E.slider_enable_links&&"image"==t.type&&(t.link?e.addClass("ug-slide-clickable"):e.removeClass("ug-slide-clickable")),k(e,t);var n=ge(e);switch(t.type){case"image":n.hide();break;default:n.show()}}catch(e){throw void 0!==e.fileName&&"showbig"==e.fileName&&p.showErrorMessageReplaceGallery(e.message),i.html(""),new Error(e)}}function G(){if(!w)return!1;if(1==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(t=E.slider_controls_appear_duration),e.stop().fadeTo(t,0),e.data("isHidden",!0)}function D(){if(!w)return!1;if(0==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(e.show(),w.positionElements(),t=E.slider_controls_appear_duration),e.stop().show().fadeTo(t,1),e.data("isHidden",!1)}function Q(){return!1!==w.getElement().data("isHidden")}function W(){var e=c.getCurrentSlide(),t=c.getSlideImage(e),i=y.getElementSize(e),n=i.left,r=i.top;if(1==E.slider_video_constantsize){var o=y.getElementSize(t);n+=o.left,r+=o.top}else n+=E.slider_video_padding_left,r+=E.slider_video_padding_top;v.setPosition(n,r)}function F(){var e=E.slider_video_constantsize_width,t=E.slider_video_constantsize_height;v.setSize(e,t),N(v.getObject(),"video")}function B(e,t,i){h.trigger(c.events.TRANSITION_START);var r=E.slider_transition;switch(i&&(r=i),c.stopSlideAction(null,!0),r){default:case"fade":U(t);break;case"slide":!function e(t,i){var r=c.isAnimating();if(1==r)return S.itemWaiting=i,!0;null!=S.itemWaiting&&(S.itemWaiting=null);var o=c.getSlidesReference();switch(t){case"right":R(o.objPrevSlide,i),O();var a=y.getElementSize(o.objPrevSlide),s=-a.left;c.switchSlideNums("right");break;case"left":R(o.objNextSlide,i),O();var l=y.getElementSize(o.objNextSlide),s=-l.left;c.switchSlideNums("left");break;default:throw new Error("wrong direction: "+t)}var u=E.slider_transition_speed;var d=E.slider_transition_easing;var _={duration:u,easing:d,queue:!1,always:function(){if(c.stopSlideAction(),v.hide(),null!=S.itemWaiting){var t=function(e){var t=c.getSlidesReference().objCurrentSlide.data("index"),i=e.index,n="left";t>i&&(n="right");return n}(S.itemWaiting);e(t,S.itemWaiting)}else c.placeNabourItems(),h.trigger(c.events.TRANSITION_END)}};n.animate({left:s+"px"},_)}(e,t);break;case"lightbox_open":U(t,!1,!0)}}function Y(e,t,i){i?e.fadeTo(E.slider_transition_speed,t,i):e.fadeTo(E.slider_transition_speed,t)}function U(e,t,i){if(!t)t=!1;var n=c.getSlidesReference();R(n.objNextSlide,e);var r=y.getElementSize(n.objCurrentSlide);y.placeElement(n.objNextSlide,r.left,r.top);var o=S.numCurrent;if(S.numCurrent=S.numNext,S.numNext=o,h.trigger(c.events.ITEM_CHANGED),n.objNextSlide.stop(!0),n.objCurrentSlide.stop(!0),1==t)n.objCurrentSlide.fadeTo(0,0),n.objNextSlide.fadeTo(0,1),c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide();else{if(n.objNextSlide.fadeTo(0,0),Y(n.objCurrentSlide,0,function(){c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide()}),1==v.isVisible())Y(v.getObject(),0);Y(n.objNextSlide,1)}}function V(){return i.children(".ug-slider-control")}function X(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(0==S.isControlsVisible)return!1;if(!e)e=!1;var t=V();!0===e?t.stop().fadeTo(0,0).hide():t.stop().fadeTo(E.slider_controls_appear_duration,0,function(){t.hide()}),S.isControlsVisible=!1}function Z(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(1==S.isControlsVisible)return!0;if(!e)e=!1;var t=V();!0===e?t.stop().show():(t.stop().show().fadeTo(0,0),t.fadeTo(E.slider_controls_appear_duration,1)),S.isControlsVisible=!0}function q(e){if(e==S.currentControlsMode)return!1;switch(e){case"image":_&&_.getElement().show();break;case"video":_&&_.getElement().hide();break;default:throw new Error("wrong controld mode: "+e)}S.currentControlsMode=e}function K(e,t,i){var n=p.getSelectedItem();c.setItem(n,!1,i);var r=n.index;b&&b.setActive(r),w&&0==S.isTextPanelSaparateHover&&D(),"image"==n.type?q("image"):q("video")}function J(e,t){p.selectItem(t)}function $(e){if(u&&0==u.isTapEventOccured(e))return!0;h.trigger(c.events.CLICK,e)}function ee(){var e=c.getCurrentSlide().hasClass("ug-slide-clickable"),t=c.getCurrentItem();if(e)return 0==E.slider_links_newpage?location.href=t.link:window.open(t.link,"_blank"),!0;0==E.slider_controls_always_on&&1==E.slider_controls_appear_ontap&&1==c.isCurrentSlideType("image")&&(0==S.isControlsVisible?Z():X(),w&&1==E.slider_textpanel_always_on&&c.isCurrentSlideType("image")&&c.isCurrentSlideImageFit()&&D())}function te(e){w&&c.isCurrentSlideType("image")&&0==c.isCurrentSlideImageFit()&&G()}function ie(){Z()}function ne(){X()}function re(e){var t=e.parent();c.startSlideAction(t)}function oe(){p.isPlayMode()&&p.pausePlaying(),h.trigger(c.events.ACTION_START)}function ae(){p.isPlayMode()&&p.continuePlaying(),h.trigger(c.events.ACTION_END)}function se(e,t,i){r.data("index")==t&&(objItem=p.getItem(t),k(r,objItem,!0)),o.data("index")==t&&(objItem=p.getItem(t),k(o,objItem,!0)),a.data("index")==t&&(objItem=p.getItem(t),k(a,objItem,!0))}function le(e,t){t=jQuery(t);var i=c.getSlideImage(t),n=ge(t),r=y.getElementSize(i);y.placeElement(n,"center","middle",r.left,r.top,i)}function ue(e){var t=ge(e);y.addClassOnHover(t),y.setButtonOnClick(t,re)}function de(e){switch(e){case 1:return r;case 2:return o;case 3:return a;default:throw new Error("wrong num: "+e)}}function _e(e){if(!e)e=c.getCurrentSlide();return e.children(".ug-slider-preloader")}function ge(e){return e.children(".ug-button-videoplay")}function ce(e){if(!e)e=c.getCurrentSlide();var t=e.data("index");return null==t?null:p.getItem(t)}this.switchSlideNums=function(e){switch(h.trigger(c.events.BEFORE_SWITCH_SLIDES),e){case"left":var t=S.numCurrent;S.numCurrent=S.numNext,S.numNext=S.numPrev,S.numPrev=t;break;case"right":t=S.numCurrent;S.numCurrent=S.numPrev,S.numPrev=S.numNext,S.numNext=t;break;default:throw new Error("wrong direction: "+e)}h.trigger(c.events.ITEM_CHANGED)},this.destroy=function(){h.off(c.events.AFTER_PUT_IMAGE),e.off(p.events.ITEM_IMAGE_UPDATED),e.off(p.events.ITEM_CHANGE),b&&jQuery(b).on(b.events.BULLET_CLICK),i.off("mouseenter"),i.off("mouseleave"),i.off("touchend"),i.off("click"),h.off(c.events.CLICK),d&&h.off(c.events.ZOOM_CHANGE),h.off(c.events.BEFORE_SWITCH_SLIDES),jQuery(v).off(v.events.SHOW),jQuery(v).off(v.events.HIDE),v.destroy(),i.off("mouseenter",".ug-item-wrapper img"),i.off("mouseleave",".ug-item-wrapper img")},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(e,t,i){P(e,t,i)},this.getSlideImage=function(e){if(!e)e=c.getCurrentSlide();return e.find(".ug-item-wrapper img")},this.setHtml=function(e){C(e)},this.run=function(){x()},this.isInnerInPlace=function(){var e=c.getSlidesReference();return-y.getElementSize(e.objCurrentSlide).left==y.getElementSize(n).left},this.isAnimating=function(){return n.is(":animated")},this.isSlideCurrent=function(e){var t=e.data("slidenum");return S.numCurrent==t},this.isSlideHasItem=function(e){var t=e.data("index");return null!=t},this.getObjImagePadding=function(){return{padding_top:E.slider_image_padding_top,padding_bottom:E.slider_image_padding_bottom,padding_left:E.slider_image_padding_left,padding_right:E.slider_image_padding_right}},this.getSlidesReference=function(){return{objPrevSlide:de(S.numPrev),objNextSlide:de(S.numNext),objCurrentSlide:de(S.numCurrent)}},this.getCurrentSlide=function(){return c.getSlidesReference().objCurrentSlide},this.getCurrentItemIndex=function(){var e=c.getSlidesReference().objCurrentSlide.data("index");return null==e&&(e=-1),e},this.getCurrentItem=function(){var e=c.getCurrentItemIndex();return-1==e?null:p.getItem(e)},this.getSlideType=function(e){return null==e&&(e=c.getCurrentSlide()),e.data("type")},this.isMouseInsideSlideImage=function(e){var t=c.getSlideImage(),i=y.getMousePosition(e);void 0===i.pageX&&(i=u.getLastMousePos());var n=y.getMouseElementPoint(i,t),r=y.getElementSize(t);return isMouseInside=y.isPointInsideElement(n,r),isMouseInside},this.isCurrentSlideType=function(e){return c.getSlideType()==e},this.isCurrentSlideLoadingImage=function(){return!0===c.getCurrentSlide().data("isLoading")},this.setItem=function(e,t,i){var n=c.getSlidesReference(),r=n.objCurrentSlide.data("index"),o=e.index;if(o==r)return!0;if(null==r)R(n.objCurrentSlide,e),c.placeNabourItems();else{var a="left";p.getNumItems();"next"==i?a="left":"prev"==i||r>o?a="right":r>o&&(a="right"),B(a,e,t)}},this.placeNabourItems=function(){var e=c.getSlidesReference(),t=e.objCurrentSlide.data("index"),i=p.getPrevItem(t),n=p.getNextItem(t);R(e.objNextSlide,n),R(e.objPrevSlide,i),O()},this.________EXTERNAL_API___________=function(){},this.stopSlideAction=function(e,t){e||(e=c.getCurrentSlide()),!0===t?v.pause():v.hide()},this.startSlideAction=function(e){e||(e=c.getCurrentSlide());var t=ce(e);if("image"==t.type)return!0;switch(1==E.slider_video_constantsize&&F(),W(),v.show(),t.type){case"youtube":v.playYoutube(t.videoid,!0,t.video_start);break;case"vimeo":v.playVimeo(t.videoid);break;case"html5video":v.playHtml5Video(t.videoogv,t.videowebm,t.videomp4,t.urlImage);break;case"soundcloud":v.playSoundCloud(t.trackid);break;case"wistia":v.playWistia(t.videoid)}},this.getScaleMode=function(e){if(!e)e=c.getCurrentSlide();return"image"!=c.getSlideType(e)?E.slider_scale_mode_media:E.slider_scale_mode==E.slider_scale_mode_fullscreen?E.slider_scale_mode:1==p.isFullScreen()?E.slider_scale_mode_fullscreen:E.slider_scale_mode},this.getObjects=function(){return{g_objSlider:i,g_objInner:n,g_options:E,g_objZoomSlider:d}},this.getObjZoom=function(){return d},this.getOptions=function(){return E},this.getElement=function(){return i},this.getVideoObject=function(){return v},this.isCurrentSlideImageFit=function(){var e=c.getCurrentSlide();c.getSlideType(e);!function(e,t){null==t&&(t=c.getCurrentSlide());var i=c.getSlideType(t);if(i!=e)throw new Error("Wrong slide type: "+i+", should be: "+e)}("image",e);var t=c.getSlideImage(e);return 0!=t.length&&y.isImageFitParent(t)},this.isCurrentImageInPlace=function(){var e=c.getSlideImage();if(0==e.length)return!1;var t=c.getScaleMode(),i=c.getObjImagePadding(),n=ce(),r=e.parent(),o=y.getImageInsideParentData(r,n.imageWidth,n.imageHeight,t,i),a=y.getElementSize(e),s=!1;return o.imageWidth==a.width&&(s=!0),s},this.isSlideActionActive=function(){return v.isVisible()},this.isSwiping=function(){return!!u&&u.isTouchActive()},this.isPreloading=function(){return!!_e().is(":visible")},this.setOptions=function(e){g&&(e=y.convertCustomPrefixOptions(e,g,"slider")),E=jQuery.extend(E,e)},this.setSize=function(e,t){if(e<0||t<0)return!0;var s={};s.width=e+"px",s.height=t+"px",i.css(s);var l={};l.height=t+"px",l.top="0px",l.left="0px",n.css(l);var u={};u.height=t+"px",u.width=e+"px",r.css(u),o.css(u),a.css(u);var d=e-E.slider_item_padding_left-E.slider_item_padding_right,_=t-E.slider_item_padding_top-E.slider_item_padding_bottom,g={};if(g.width=d+"px",g.height=_+"px",g.top=E.slider_item_padding_top+"px",g.left=E.slider_item_padding_left+"px",i.find(".ug-item-wrapper").css(g),w&&w.setSizeByParent(),M(),z(r),z(o),z(a),O(),"image"!=c.getSlideType()&&1==E.slider_video_constantsize)F();else{var h=e-E.slider_video_padding_left-E.slider_video_padding_right,p=t-E.slider_video_padding_top-E.slider_video_padding_bottom;v.setSize(h,p)}W()},this.refreshSlideItems=function(){if(1==c.isAnimating())return!0;z(r),z(o),z(a),O()},this.isMouseOver=function(){return i.ismouseover()},this.setPosition=function(e,t){y.placeElement(i,e,t)},this.zoomIn=function(){if(!d)return!0;d.zoomIn()},this.zoomOut=function(){if(!d)return!0;d.zoomOut()},this.zoomBack=function(){if(!d)return!0;d.zoomBack()}}function UGTextPanel(){var e,t,i,n,r,o,a,s=this,l=new UGFunctions,u="",d={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_title_as_link:!1,textpanel_title_link_newtab:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},_={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};function g(t,a){if(!a)a=d.textpanel_padding_top;var s=a;if(i){var u=s;if(l.placeElement(i,0,u),1==i.is(":visible")){(s=l.getElementSize(i).bottom)>0&&(_.lastTitleBottom=s)}else{s=20;_.lastTitleBottom>0&&(s=_.lastTitleBottom)}}var g="";if(n&&(g=jQuery.trim(n.text())),""!=g){var c=s;if(i&&(c+=d.textpanel_padding_title_description),l.placeElement(n,0,c),1==jQuery(n).is(":visible")){var h=l.getElementSize(n);s=h.bottom,h.height>0&&(_.lastDescHeight=h.height)}else{var p=16;_.lastDescHeight>0&&(p=_.lastDescHeight),s=c+p}}d.textpanel_height||1!=_.setInternalHeight||function(t,i){if(!i)var i=!1;if(1==i){if(r){var n=r.height();t>n&&r.height(t)}var a={height:t+"px"};e.add(o).animate(a,d.textpanel_fade_duration)}else r&&r.height(t),e.add(o).height(t)}(s+d.textpanel_padding_bottom,t)}function c(){var e=0;if(i&&(e+=i.outerHeight()),n){var t="";n&&(t=jQuery.trim(n.text())),""!=t&&(i&&(e+=d.textpanel_padding_title_description),e+=n.outerHeight())}return e}function h(){if(1==d.textpanel_enable_bg){(r=e.children(".ug-textpanel-bg")).fadeTo(0,d.textpanel_bg_opacity);var t={"background-color":d.textpanel_bg_color};t=jQuery.extend(t,d.textpanel_bg_css),r.css(t)}if(1==d.textpanel_enable_title){i=o.children(".ug-textpanel-title");var a={};null!==d.textpanel_title_color&&(a.color=d.textpanel_title_color),null!==d.textpanel_title_font_family&&(a["font-family"]=d.textpanel_title_font_family),null!==d.textpanel_title_text_align&&(a["text-align"]=d.textpanel_title_text_align),null!==d.textpanel_title_font_size&&(a["font-size"]=d.textpanel_title_font_size+"px"),null!==d.textpanel_title_bold&&(!0===d.textpanel_title_bold?a["font-weight"]="bold":a["font-weight"]="normal"),d.textpanel_css_title&&(a=jQuery.extend(a,d.textpanel_css_title)),i.css(a)}if(1==d.textpanel_enable_description){n=o.children(".ug-textpanel-description");var s={};null!==d.textpanel_desc_color&&(s.color=d.textpanel_desc_color),null!==d.textpanel_desc_font_family&&(s["font-family"]=d.textpanel_desc_font_family),null!==d.textpanel_desc_text_align&&(s["text-align"]=d.textpanel_desc_text_align),null!==d.textpanel_desc_font_size&&(s["font-size"]=d.textpanel_desc_font_size+"px"),null!==d.textpanel_desc_bold&&(!0===d.textpanel_desc_bold?s["font-weight"]="bold":s["font-weight"]="normal"),d.textpanel_css_title&&(s=jQuery.extend(s,d.textpanel_css_description)),n.css(s)}}function p(){var e=a.getSelectedItem();s.setText(e.title,e.description,e.link)}this.positionElements=function(e){if(!d.textpanel_height||"top"==d.textpanel_text_valign)return g(e),!1;switch(d.textpanel_text_valign){default:case"top":g(!1);break;case"bottom":t=c(),g(!1,o.height()-t-d.textpanel_padding_bottom);break;case"center":case"middle":!function(){var e=c();g(!1,(o.height()-e)/2)}()}var t},this.init=function(e,t,i){if(a=e,i&&(u=i,t=l.convertCustomPrefixOptions(t,u,"textpanel")),t&&(d=jQuery.extend(d,t)),0==d.textpanel_enable_title&&0==d.textpanel_enable_description)throw new Error("Textpanel Error: The title or description must be enabled");d.textpanel_height&&d.textpanel_height<0&&(d.textpanel_height=null),1==d.textpanel_desc_style_as_title&&(d.textpanel_desc_color||(d.textpanel_desc_color=d.textpanel_title_color),d.textpanel_desc_bold||(d.textpanel_desc_bold=d.textpanel_title_bold),d.textpanel_desc_font_family||(d.textpanel_desc_font_family=d.textpanel_title_font_family),d.textpanel_desc_font_size||(d.textpanel_desc_font_size=d.textpanel_title_font_size),d.textpanel_desc_text_align||(d.textpanel_desc_text_align=d.textpanel_title_text_align))},this.appendHTML=function(i,n){t=i;var r="<div class='ug-textpanel"+(n=n?" "+n:"")+"'>";1==d.textpanel_enable_bg&&(r+="<div class='ug-textpanel-bg"+n+"'></div>"),r+="<div class='ug-textpanel-textwrapper"+n+"'>",1==d.textpanel_enable_title&&(r+="<div class='ug-textpanel-title"+n+"'></div>"),1==d.textpanel_enable_description&&(r+="<div class='ug-textpanel-description"+n+"'></div>"),r+="</div></div>",i.append(r),e=i.children(".ug-textpanel"),o=e.children(".ug-textpanel-textwrapper"),h()},this.destroy=function(){jQuery(a).off(a.events.ITEM_CHANGE)},this.run=function(){s.setSizeByParent(),jQuery(a).on(a.events.ITEM_CHANGE,p)},this.setPanelSize=function(t,a){if(_.setInternalHeight=!0,a)_.setInternalHeight=!1;else a=80;d.textpanel_height&&(a=d.textpanel_height),e.width(t),e.height(a),r&&(r.width(t),r.height(a));var u=t-d.textpanel_padding_left-d.textpanel_padding_right,g=d.textpanel_padding_left;l.setElementSizeAndPosition(o,g,0,u,a),i&&i.width(u),n&&n.width(u),0==_.isFirstTime&&s.positionElements(!1)},this.setSizeByParent=function(){var e=l.getElementSize(t);s.setPanelSize(e.width)},this.setTextPlain=function(e,t,r){if(1==d.textpanel_title_as_link&&e&&r){var o="";1==d.textpanel_title_link_newtab&&(o+=' target="blank"'),e='<a class="ug-textpanel-link" href="'+r+'" '+o+">"+e+"</a>"}i&&i.html(e),n&&n.html(t)},this.setText=function(e,t,i){1==_.isFirstTime?(s.setTextPlain(e,t,i),_.isFirstTime=!1,s.positionElements(!1)):o.stop().fadeTo(d.textpanel_fade_duration,0,function(){s.setTextPlain(e,t,i),s.positionElements(!0),jQuery(this).fadeTo(d.textpanel_fade_duration,1)})},this.positionPanel=function(t,i){var n={};if(null!=t)n.top=t,n.bottom="auto";else switch(d.textpanel_align){case"top":n.top=d.textpanel_margin+"px";break;case"bottom":n.top="auto",n.bottom=d.textpanel_margin+"px";break;case"middle":n.top=l.getElementRelativePos(e,"middle",d.textpanel_margin)}null!=i&&(n.left=i),e.css(n)},this.setOptions=function(e){u&&(e=l.convertCustomPrefixOptions(e,u,"textpanel")),d=jQuery.extend(d,e)},this.getElement=function(){return e},this.getSize=function(){return l.getElementSize(e)},this.refresh=function(e,t,i,n){h(),i?s.setPanelSize(i,n):s.setSizeByParent(),s.positionElements(!1),!0!==t&&s.positionPanel(),!0===e&&s.show()},this.hide=function(){e.hide()},this.show=function(){e.show()},this.getOptions=function(){return d},this.getOption=function(e){return 0==d.hasOwnProperty(e)?null:d[e]}}function UGZoomButtonsPanel(){var e,t,i,n,r=new UGSlider,o=new UGFunctions,a={slider_zoompanel_skin:""};function s(e){return!e||!!e.hasClass("ug-zoompanel-button-disabled")}function l(e){e&&e.addClass("ug-zoompanel-button-disabled")}function u(e){e&&e.removeClass("ug-zoompanel-button-disabled")}function d(){if(0==r.isCurrentSlideType("image"))return!0;1==r.isCurrentSlideImageFit()?0==s(i)&&(l(i),l(n)):1==s(i)&&(u(i),u(n))}this.init=function(e,t){r=e,t&&(a=jQuery.extend(a,t))},this.appendHTML=function(r){r;var o="<div class='ug-slider-control ug-zoompanel ug-skin-"+a.slider_zoompanel_skin+"'>";o+="<div class='ug-zoompanel-button ug-zoompanel-plus'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-minus ug-zoompanel-button-disabled'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-return ug-zoompanel-button-disabled'></div>",o+="</div>",r.append(o),e=r.children(".ug-zoompanel"),t=e.children(".ug-zoompanel-plus"),i=e.children(".ug-zoompanel-minus"),n=e.children(".ug-zoompanel-return")},this.setObjects=function(e,r,o){t=e,n=o,(i=r)&&i.addClass("ug-zoompanel-button-disabled"),n&&n.addClass("ug-zoompanel-button-disabled")},this.getElement=function(){return e},this.initEvents=function(){o.addClassOnHover(t,"ug-button-hover"),o.addClassOnHover(i,"ug-button-hover"),o.addClassOnHover(n,"ug-button-hover"),o.setButtonOnClick(t,function(){if(1==s(t))return!0;r.zoomIn()}),o.setButtonOnClick(i,function(){if(1==s(i))return!0;r.zoomOut()}),o.setButtonOnClick(n,function(){if(1==s(n))return!0;r.zoomBack()}),jQuery(r).on(r.events.ZOOM_CHANGE,d),jQuery(r).on(r.events.ITEM_CHANGED,d)}}function UGBullets(){var e,t,i=this,n=0,r=new UniteGalleryMain,o=new UGFunctions,a={isInited:!1},s={bullets_skin:"",bullets_addclass:"",bullets_space_between:-1};function l(){var i="",r="";-1!=s.bullets_space_between&&(r=" style='margin-left:"+s.bullets_space_between+"px'");for(var o=0;o<n;o++)i+=0==o?"<div class='ug-bullet'></div>":"<div class='ug-bullet'"+r+"></div>";if(e.html(i),!t){var a=e.find(".ug-bullet:first-child");a.length&&(t=a.width())}}function u(e){if(1==i.isActive(e))return!0;var t=e.index();jQuery(i).trigger(i.events.BULLET_CLICK,t)}function d(){var t=e.children(".ug-bullet");o.setButtonOnClick(t,u),t.on("mousedown mouseup",function(e){return!1})}function _(e){if(e<0||e>=n)throw new Error("wrong bullet index: "+e)}function g(){if(1==a.isInited)return!0;throw new Error("The bullets are not inited!")}this.events={BULLET_CLICK:"bullet_click"},this.init=function(e,t,i){r=e,n=i||r.getNumItems(),a.isInited=!0,""==(s=jQuery.extend(s,t)).bullets_skin&&(s.bullets_skin=s.gallery_skin)},this.getBulletsWidth=function(){return 0==n?0:t?n*t+(n-1)*s.bullets_space_between:0},this.appendHTML=function(t){t,g();var i="";""!=s.bullets_addclass&&(i=" "+s.bullets_addclass);var n="<div class='ug-slider-control ug-bullets ug-skin-"+s.bullets_skin+i+"'>";e=jQuery(n+="</div>"),t.append(e),l(),d()},this.updateNumBullets=function(e){n=e,l(),d()},this.getElement=function(){return e},this.setActive=function(t){g(),_(t);var i=e.children(".ug-bullet");i.removeClass("ug-bullet-active"),jQuery(i[t]).addClass("ug-bullet-active"),t},this.isActive=function(t){if(_(t),"number"!=typeof t)var i=t;else i=e.children(".ug-bullet")[t];return!!i.hasClass("ug-bullet-active")},this.getNumBullets=function(){return n}}function UGProgressBar(){var e,t,i=this,n=0,r=new UGFunctions,o={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(i,n){n&&(o=jQuery.extend(o,n)),i.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'></div></div>"),e=i.children(".ug-progress-bar"),(t=e.children(".ug-progress-bar-inner")).css("background-color",o.slider_progressbar_color),e.height(o.slider_progressbar_line_width),t.height(o.slider_progressbar_line_width),t.width("0%");var r=o.slider_progressbar_opacity,a=t[0];a.style.opacity=r,a.style.filter="alpha(opacity="+100*r+")"},this.putHidden=function(t,n){i.put(t,n),e.hide()},this.getElement=function(){return e},this.setSize=function(n){e.width(n),t.width(n),i.draw()},this.setPosition=function(t,i,n,o){r.placeElement(e,t,i,n,o)},this.draw=function(){var e=100*n;t.width(e+"%")},this.setProgress=function(e){n=r.normalizePercent(e),i.draw()},this.getType=function(){return"bar"}}function UGProgressPie(){var e,t=this,i=!1,n=new UGFunctions,r={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};function o(t){if(!t)t=0;var n=Math.min(r.slider_progresspie_width,r.slider_progresspie_height)/2,o=e[0].getContext("2d");0==i&&(i=!0,o.rotate(1.5*Math.PI),o.translate(-2*n,0)),o.clearRect(0,0,r.slider_progresspie_width,r.slider_progresspie_height);var a=r.slider_progresspie_width/2,s=r.slider_progresspie_height/2,l=0,u=t*Math.PI*2;if(1==r.slider_progresspie_type_fill)o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath();else{o.globalCompositeOperation="source-over",o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath(),o.globalCompositeOperation="destination-out";var d=n-r.slider_progresspie_stroke_width;o.beginPath(),o.moveTo(a,s),o.arc(a,s,d,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath()}1==r.slider_progresspie_type_fill&&(l=u,u=2*Math.PI,o.beginPath(),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color2,o.fill(),o.closePath())}this.put=function(t,i){i&&(r=jQuery.extend(r,i)),t.append("<canvas class='ug-canvas-pie' width='"+r.slider_progresspie_width+"' height='"+r.slider_progresspie_height+"'></canvas>"),e=t.children(".ug-canvas-pie")},this.putHidden=function(i,n){t.put(i,n),o(.1),e.hide()},this.getElement=function(){return e},this.setPosition=function(t,i){n.placeElement(e,t,i)},this.getSize=function(){return{width:r.slider_progresspie_width,height:r.slider_progresspie_height}},this.setProgress=function(e){e=n.normalizePercent(e),e,o(e)},this.getType=function(){return"pie"}}function UGTouchSliderControl(){var e,t,i,n=new UGSlider,r=new UGFunctions,o={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},a={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};function s(e){if(!e)e=n.getSlidesReference();return-r.getElementSize(e.objCurrentSlide).left-r.getElementSize(t).left}function l(e){if(1==n.isInnerInPlace())return!1;if(i.trigger(n.events.BEFORE_RETURN),!e)e=n.getSlidesReference();var s=-r.getElementSize(e.objCurrentSlide).left;t.animate({left:s+"px"},{duration:o.slider_transition_return_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(e,i,n){if(1==a.isDragVideo){var o=r.getElementSize(t).left-s,l=a.videoStartX+o;a.videoObject.css("left",l)}},complete:function(){i.trigger(n.events.AFTER_RETURN)}})}function u(){var e=n.getSlidesReference(),u=s(e);if(0==u)return!1;var d=u>0?"left":"right",_=!1;switch(d){case"right":if(n.isSlideHasItem(e.objPrevSlide))var g=-r.getElementSize(e.objPrevSlide).left;else _=!0;break;case"left":if(n.isSlideHasItem(e.objNextSlide))g=-r.getElementSize(e.objNextSlide).left;else _=!0}1==_?l(e):t.stop().animate({left:g+"px"},{duration:o.slider_transition_continuedrag_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(1==a.isDragVideo){var e=r.getElementSize(t).left-a.startPosx,i=a.videoStartX+e;a.videoObject.css("left",i)}},always:function(){!function(e){n.getVideoObject().hide(),n.switchSlideNums(e),n.placeNabourItems()}(d),i.trigger(n.events.AFTER_DRAG_CHANGE)}})}function d(e){var i=r.getMousePosition(e);a.startMouseX=i.pageX,a.startMouseY=i.pageY,a.lastMouseX=a.startMouseX,a.lastMouseY=a.startMouseY,a.startTime=jQuery.now();var n=r.getArrTouches(e);a.startArrTouches=r.getArrTouchPositions(n);var o=r.getElementSize(t);a.startPosx=o.left,a.isInitDataValid=!0,a.isDragVideo=!1,r.storeEventData(e,a.storedEventID)}function _(e){a.touch_active=!1}function g(e,t){a.touch_active=!0,d(t)}function c(e){return e.preventDefault(),a.isDragging=!1,1==n.isAnimating()&&t.stop(!0,!0),r.getArrTouches(e).length>1?(1==a.touch_active&&_(),!0):1==a.touch_active||void g(0,e)}function h(s){if(0==a.touch_active)return!0;if(0==s.buttons)return _(),u(),!0;r.updateStoredEventData(s,a.storedEventID),s.preventDefault();var l=r.getMousePosition(s);a.lastMouseX=l.pageX,a.lastMouseY=l.pageY;var g=null;1==o.slider_vertical_scroll_ondrag&&(g=r.handleScrollTop(a.storedEventID)),"vert"!==g&&function(r){var o=a.lastMouseX-a.startMouseX;if(0==o)return!0;var s=o<0?"left":"right",l=n.getObjZoom();if(l){if(1==l.isPanEnabled(r,s))return a.isInitDataValid=!1,!0;if(0==a.isInitDataValid)return d(r),!0}var u=a.startPosx+o;o>0&&u>0?u/=3:o<0&&u+t.width()<e.width()&&(u=a.startPosx+o/3);if(0==a.isDragging&&(a.isDragging=!0,i.trigger(n.events.START_DRAG)),t.css("left",u+"px"),1==a.isDragVideo){var _=u-a.startPosx,g=a.videoStartX+_;a.videoObject.css("left",g)}}(s)}function p(e){var t=r.getArrTouches(e).length;if(1==n.isInnerInPlace()&&0==a.touch_active&&0==t)return!0;if(0==t&&1==a.touch_active){_();var i=!1;0==r.wasVerticalScroll(a.storedEventID)&&(i=function(){var e=n.getSlidesReference(),t=s(e),i=Math.round(3*e.objCurrentSlide.width()/8);if(Math.abs(t)>=i)return!0;var r=Math.abs(a.lastMouseX-a.startMouseX);return Math.abs(a.lastMouseY-a.startMouseY),!(r<20)&&jQuery.now()-a.startTime<500}()),1==i?u():l()}else 1==t&&0==a.touch_active&&g(0,e)}this.isTapEventOccured=function(e){var t=r.getArrTouches(e).length;if(0!=t||0!=a.lastNumTouches)return a.lastNumTouches=t,!1;a.lastNumTouches=t;s(n.getSlidesReference());var i=Math.abs(a.lastMouseX-a.startMouseX),o=Math.abs(a.lastMouseY-a.startMouseY),l=jQuery.now()-a.startTime;return i<20&&o<50&&l<500},this.init=function(r,a){n=r,i=jQuery(n),g_objects=r.getObjects(),e=g_objects.g_objSlider,t=g_objects.g_objInner,o=jQuery.extend(o,a),e.bind("mousedown touchstart",c),jQuery("body").bind("mousemove touchmove",h),jQuery(window).add("body").bind("mouseup touchend",p)},this.getLastMousePos=function(){return{pageX:a.lastMouseX,pageY:a.lastMouseY}},this.isTouchActive=function(){return a.touch_active}}function UGZoomSliderControl(){var e,t,i=new UGSlider,n=new UGFunctions,r={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},o={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};function a(n,a){i=n,t=jQuery(i),g_objects=n.getObjects(),e=g_objects.g_objSlider,g_objects.g_objInner,r=jQuery.extend(r,a),e.on("mousewheel",b),e.bind("mousedown touchstart",p),jQuery("body").bind("mousemove touchmove",f),jQuery(window).add("body").bind("mouseup touchend",m),t.bind(i.events.BEFORE_RETURN,function(){h()}),t.bind(i.events.ITEM_CHANGED,function(){o.isZoomedOnce=!1}),t.bind(i.events.ZOOM_CHANGE,function(){o.isZoomedOnce=!0})}function s(){var e=i.getScaleMode();return"down"!=e&&(e="fit"),e}function l(){if((r=jQuery.now())-o.storeImageLastTime<20)return!1;var e=i.getSlidesReference();if(o.objSlide=e.objCurrentSlide,o.objImage=e.objCurrentSlide.find("img"),0==o.objImage.length)return!1;o.objImageSize=n.getElementSize(o.objImage),o.objParent=o.objImage.parent(),o.objParentSize=n.getElementSize(o.objParent);var t=s();objPadding=i.getObjImagePadding(),o.objFitImageSize=n.getImageInsideParentDataByImage(o.objImage,t,objPadding);var r=jQuery.now();return o.storeImageLastTime=r,!0}function u(e,o){var a=i.getSlidesReference().objCurrentSlide.find("img"),l=s();t.trigger(i.events.ZOOM_START);var u=!0,d=i.getObjImagePadding();if("back"==e){var _=n.getImageOriginalSize(a);n.scaleImageFitParent(a,_.width,_.height,l,d)}else{var g="in"==e;u=n.zoomImageInsideParent(a,g,r.slider_zoom_step,o,l,r.slider_zoom_max_ratio,d)}1==u&&(t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE),t.trigger(i.events.ZOOM_END))}function d(e,t,i){var r=n.getArrTouches(t);if(!0===i){if(1!=r.length)return!1}else if(r.length>1)return!1;return!!n.isElementBiggerThenParent(e)}function _(e){o.isPanActive=!0,function(e){var t=n.getMousePosition(e);o.startMouseX=t.pageX,o.startMouseY=t.pageY,o.lastMouseX=o.startMouseX,o.lastMouseY=o.startMouseY,o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height}(e)}function g(e){if(0==o.isZoomActive)return!1;2!=n.getArrTouches(e).length&&(o.isZoomActive=!1,t.trigger(i.events.ZOOM_END))}function c(e){if(1==o.isZoomActive)return!0;var r=n.getArrTouches(e);if(2!=r.length)return!0;!function(e){o.isZoomActive=!0,o.startDistance=n.getDistance(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),0==o.startDistance&&(o.startDistance=1),o.startMiddlePoint=n.getMiddlePoint(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),o.objImageSize=n.getElementSize(o.objImage),o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.imageOrientPoint=n.getElementLocalPoint(o.startMiddlePoint,o.objImage),0==n.isPointInsideElement(o.imageOrientPoint,o.objImageSize)&&(o.imageOrientPoint=n.getElementCenterPoint(o.objImage)),t.trigger(i.events.ZOOM_START)}(r)}function h(){if(null==o.objImage||0==o.objImage.length)return!0;if(n.getElementSize(o.objImage).width<o.objFitImageSize.imageWidth){o.objImage.css({position:"absolute",margin:"none"});var e={top:o.objFitImageSize.imageTop+"px",left:o.objFitImageSize.imageLeft+"px",width:o.objFitImageSize.imageWidth+"px",height:o.objFitImageSize.imageHeight+"px"};o.objImage.animate(e,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}else!function(){var e=!1,t=!1,a=0,s=0,l=n.getElementSize(o.objImage),u=i.getObjImagePadding(),d=n.getElementCenterPosition(o.objImage,u);o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height,1==o.panYActive?l.top>0?(s=0,t=!0):l.bottom<o.objParentSize.height&&(s=o.objParentSize.height-l.height,t=!0):l.top!=d.top&&(t=!0,s=d.top),1==o.panXActive?l.left>0?(a=0,e=!0):l.right<o.objParentSize.width&&(a=o.objParentSize.width-l.width,e=!0):l.left!=d.left&&(e=!0,a=d.left);var _={};1==t&&(_.top=s+"px"),1==e&&(_.left=a+"px"),1!=t&&1!=e||o.objImage.animate(_,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}()}function p(e){if(0==i.isCurrentSlideType("image"))return!0;l();if(null==o.objImage||0==o.objImage.length)return!0;e.preventDefault(),1==!(!o.objImage||!o.objImage.is(":animated"))&&o.objImage.stop(!0),1==o.isZoomActive?g(e):c(e),1==o.isZoomActive?o.isPanActive=!1:1==d(o.objImage,e)&&1==o.isZoomedOnce&&_(e)}function m(e){if(0==i.isCurrentSlideType("image"))return!0;if(1==jQuery(e.target).data("ug-button"))return!1;l();if(null==o.objImage||0==o.objImage.length)return!0;var t=o.isPanActive,n=o.isZoomActive;if(0==i.isInnerInPlace())return o.isZoomActive=!1,o.isPanActive=!1,!0;if(1==o.isZoomActive?g(e):c(e),1==o.isZoomActive)o.isPanActive=!1;else{var r=d(o.objImage,e,!0);1==o.isPanActive?o.isPanActive=!1:1==r&&_(e)}(t||n)&&0==o.isZoomActive&&0==o.isPanActive&&h()}function f(e){if(0==i.isCurrentSlideType("image"))return!0;1==o.isZoomActive?function(e){var a=n.getArrTouches(e),s=n.getDistance(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY)/o.startDistance,l=n.getMiddlePoint(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY),u=o.objImageSize.width*s,d=o.objImageSize.height*s,_=n.getImageOriginalSize(o.objImage),g=1;if(_.width>0&&(g=u/_.width),g>r.slider_zoom_max_ratio)return!0;panX=-(o.imageOrientPoint.x*s-o.imageOrientPoint.x),panY=-(o.imageOrientPoint.y*s-o.imageOrientPoint.y);var c=l.x-o.startMiddlePoint.x,h=l.y-o.startMiddlePoint.y,p=o.startImageX+panX+c,m=o.startImageY+panY+h;n.setElementSizeAndPosition(o.objImage,p,m,u,d),t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE)}(e):1==o.isPanActive&&function(e){if(null==o.objImage||0==o.objImage.length)return!0;var t=n.getMousePosition(e),r=(t.pageX,o.startMouseX,t.pageY,o.startMouseY,t.pageX-o.lastMouseX),a=t.pageY-o.lastMouseY,s=r<0?"left":"right",l=a<0?"up":"down";o.lastMouseX=t.pageX,o.lastMouseY=t.pageY;var u=n.getElementSize(o.objImage);0==o.panYActive?a=0:"down"==l&&u.top>0?a/=3:"up"==l&&u.bottom<o.objParentSize.height&&(a/=3),0==o.panXActive||0==i.isInnerInPlace()?r=0:"right"==s&&u.left>0?r/=3:"left"==s&&u.right<o.objParentSize.width&&(r/=3);var d=u.left+r,_=u.top+a;n.placeElement(o.objImage,d,_)}(e)}function b(e,t,o,a){return 0==r.slider_zoom_mousewheel||(0==i.isCurrentSlideType("image")||(e.preventDefault(),void u(1==t>0?"in":"out",n.getMousePosition(e))))}this.________EXTERNAL_____________=function(){},this.isPanEnabled=function(e,t){if(l(),null==o.objImage||0==o.objImage.length)return!1;if(0==o.isZoomedOnce)return!1;if(0==d(o.objImage,e))return!1;if(0==i.isInnerInPlace())return!1;if("left"==t){if(o.objImageSize.right<=o.objParentSize.width)return!1}else if(o.objImageSize.left>=0)return!1;return!0},this.init=function(e,t){a(e,t)},this.zoomIn=function(){u("in")},this.zoomOut=function(){u("out")},this.zoomBack=function(){u("back")}}function UGWistiaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=!1;function o(){return"undefined"!=typeof Wistia}function a(e,o,a,s,l){t=null,r=!1;var u=e+"_video",d="<div id='"+u+"' class='wistia_embed' style='width:"+a+";height:"+s+";' data-video-width='"+a+"' data-video-height='"+s+"'>&nbsp;</div>";jQuery("#"+e).html(d),t=Wistia.embed(o,{version:"v1",videoWidth:a,videoHeight:s,container:u,autoPlay:l}),r=!0,t.bind("play",function(){n.trigger(i.events.START_PLAYING)}),t.bind("pause",function(){n.trigger(i.events.STOP_PLAYING)}),t.bind("end",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugWistiaAPI.isAPILoaded||(o()?(g_ugWistiaAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0),void(g_ugWistiaAPI.isAPILoaded=!0)))},this.doCommand=function(e){if(null==t)return!1;if(0==r)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.putVideo=function(t,i,n,r,s,l){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!r||!t)}}function UGSoundCloudAPI(){this.isAPILoaded=!1;var e,t,i,n=this,r=jQuery(this);function o(){return"undefined"!=typeof SC}function a(e,o,a,s,l){t=null,g_isPlayerReady=!1;var u=e+"_iframe",d=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+o;d+="&amp;buying=false&amp;liking=false&amp;download=false&amp;sharing=false&amp;show_artwork=true&show_comments=false&amp;show_playcount=true&amp;show_user=false&amp;hide_related=true&amp;visual=true&amp;start_track=0&amp;callback=true";var _="<iframe id='"+u+"' src="+(d+=!0===l?"&amp;auto_play=true":"&amp;auto_play=false")+" width='"+a+"' height='"+s+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(_),(t=SC.Widget(u)).bind(SC.Widget.Events.READY,function(){t&&(g_isPlayerReady=!0,t.bind(SC.Widget.Events.PLAY,function(){r.trigger(n.events.START_PLAYING)}),t.bind(SC.Widget.Events.PAUSE,function(){r.trigger(n.events.STOP_PLAYING)}),t.bind(SC.Widget.Events.FINISH,function(){r.trigger(n.events.STOP_PLAYING),r.trigger(n.events.VIDEO_ENDED)}))}),i=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugSoundCloudAPI.isAPILoaded||(o()?(g_ugSoundCloudAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0),void(g_ugSoundCloudAPI.isAPILoaded=!0)))},this.putSound=function(t,i,n,r,s){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){n.doCommand("pause")},this.play=function(){n.doCommand("play")},this.destroy=function(){g_isPlayerReady=!1,t=null,i&&(jQuery("#"+i).html(""),i=null)}}function UGHtml5MediaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this);function r(){return"undefined"!=typeof mejs}function o(e,r,o,a,s){t=null,g_isPlayerReady=!1;var l=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",u=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",d=e+"_video",_="";s&&!0===s&&(_="autoplay='autoplay'");var g="";r.posterImage&&(g="poster='"+r.posterImage+"'");var c="<video id='"+d+"' width='"+o+"' height='"+a+"' controls='controls' preload='none' "+_+" "+g+">";""!=r.mp4&&(c+="<source type='video/mp4' src='"+r.mp4+"' />"),""!=r.webm&&(c+="<source type='video/webm' src='"+r.webm+"' />"),""!=r.ogv&&(c+="<source type='video/ogg' src='"+r.ogv+"' />"),c+="<object width='"+o+"' height='"+a+"' type='application/x-shockwave-flash' data='"+l+"'>",c+="<param name='movie' value='"+l+"' />",c+="<param name='flashvars' value='controls=true&file="+r.mp4+"' />",c+="</object>",c+="</video>",jQuery("#"+e).html(c),new MediaElement(d,{enablePluginDebug:!1,flashName:l,silverlightName:u,success:function(e,r){g_isPlayerReady=!0,t=e,0==s&&t.pause(),g_ugFunctions.addEvent(t,"play",function(){n.trigger(i.events.START_PLAYING)}),g_ugFunctions.addEvent(t,"pause",function(){n.trigger(i.events.STOP_PLAYING)}),g_ugFunctions.addEvent(t,"ended",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})},error:function(e){trace(e)}})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugHtml5MediaAPI.isAPILoaded||(r()?(g_ugHtml5MediaAPI.isAPILoaded=!0,!0):(!0!==e&&(g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0),g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0)),void(g_ugHtml5MediaAPI.isAPILoaded=!0)))},this.putVideo=function(t,i,n,a,s){if(r())return o(t,i,n,a,s),!0;this.loadAPI(),e=setInterval(function(){r()&&(o(t,i,n,a,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")}}function UGVimeoAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=null,o=!1,a=!1;function s(){return"undefined"!=typeof Froogaloop}function l(e,s,l,u,d){r=null,o=!1;var _=location.protocol+"//player.vimeo.com/video/"+s+"?api=1";!0===d&&(_+="&amp;byline=0&amp;autoplay=1&amp;title=0&amp;portrait=0");var g="<iframe src="+_+" width='"+l+"' height='"+u+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(g);var c=jQuery("#"+e+" iframe")[0];(r=Froogaloop(c)).addEvent("ready",function(){r&&(o=!0,function(){if(!r)return!1;r.addEvent("cuechange",function(){1==a&&i.play()}),r.addEvent("play",function(){n.trigger(i.events.START_PLAYING)}),r.addEvent("pause",function(){n.trigger(i.events.STOP_PLAYING)}),r.addEvent("finish",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}())}),t=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugVimeoAPI.isAPILoaded||(s()?(g_ugVimeoAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("f.vimeocdn.com/js/froogaloop2.min.js",!0),void(g_ugVimeoAPI.isAPILoaded=!0)))},this.doCommand=function(e){return null!=r&&(0!=o&&void r.api(e))},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.destroy=function(){r&&(r.api("unload"),r=null,o=!1),t&&jQuery("#"+t).html("")},this.putVideo=function(t,i,n,r,o){if(s())return l(t,i,n,r,o),!0;this.loadAPI(),e=setInterval(function(){s()&&(l(t,i,n,r,o),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!o||!r)},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;a=t,r.api("loadVideo",e)},this.getVideoImages=function(e,t,i){var n=location.protocol+"//vimeo.com/api/v2/video/"+e+".json";jQuery.get(n,{},function(e){var n={};n.preview=e[0].thumbnail_large,n.thumb=e[0].thumbnail_medium,i(t,n)})}}function UGYoutubeAPI(){this.isAPILoaded=!1;var e,t,i=this,n=null,r=!1,o=jQuery(this),a=-1,s=new UGFunctions,l={video_youtube_showinfo:!0};function u(e,i,o,a,u,d){n&&r&&n.destroy();var c={controls:1,showinfo:l.video_youtube_showinfo,start:0,rel:0};!0===u&&(c.autoplay=1);var h=s.getVal(d,"start");h&&jQuery.isNumeric(h)&&(c.start=h),r=!1,n=new YT.Player(e,{height:a,width:o,videoId:i,playerVars:c,events:{onReady:_,onStateChange:g}}),t=e}function d(){return"undefined"!=typeof YT&&void 0!==YT.Player}function _(){r=!0}function g(){if("function"!=typeof n.getPlayerState)return trace("Youtube API error: can't get player state"),!1;var e=n.getPlayerState();switch(e){case YT.PlayerState.PLAYING:o.trigger(i.events.START_PLAYING);break;case YT.PlayerState.ENDED:o.trigger(i.events.STOP_PLAYING),o.trigger(i.events.VIDEO_ENDED);break;default:a==YT.PlayerState.PLAYING&&o.trigger(i.events.STOP_PLAYING)}a=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.setOptions=function(e){l=jQuery.extend(l,e)},this.putVideo=function(t,i,n,r,o,a){if(d())return u(t,i,n,r,o,a),!0;this.loadAPI(),e=setInterval(function(){d()&&(u(t,i,n,r,o,a),clearInterval(e))},500)},this.loadAPI=function(e){return 1==g_ugYoutubeAPI.isAPILoaded||("undefined"!=typeof YT?(g_ugYoutubeAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1),void(g_ugYoutubeAPI.isAPILoaded=!0)))},this.doCommand=function(e,t){if(!n)return!0;if(0==r)return!1;switch(e){case"play":if("function"!=typeof n.playVideo)return!1;n.playVideo();break;case"pause":if("function"!=typeof n.pauseVideo)return!1;n.pauseVideo();break;case"seek":if("function"!=typeof n.seekTo)return!1;n.seekTo(t);break;case"stopToBeginning":var i=n.getPlayerState();switch(n.pauseVideo(),i){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:n.seekTo(0)}}},this.play=function(){i.doCommand("play")},this.pause=function(){i.doCommand("pause")},this.destroy=function(){try{n&&(r=!1,n.clearVideo(),n.destroy())}catch(e){jQuery("#"+t).html("")}},this.stopToBeginning=function(){i.doCommand("stopToBeginning")},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;t&&1==t?n.loadVideoById(e,0,"large"):n.cueVideoById(e,0,"large")},this.isPlayerReady=function(){return!(!r||!n)},this.getVideoImages=function(e){var t={};return t.preview="https://i.ytimg.com/vi/"+e+"/sddefault.jpg",t.thumb="https://i.ytimg.com/vi/"+e+"/default.jpg",t}}function UGVideoPlayer(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UGFunctions,_=new UGYoutubeAPI,g=new UGVimeoAPI,c=new UGHtml5MediaAPI,h=new UGSoundCloudAPI,p=new UGWistiaAPI,m=null,f={video_enable_closebutton:!0};this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"};var b={standAloneMode:!1,youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",soundCloudPlayerID:""};function v(){l.hide()}function y(){u.trigger(l.events.PLAY_START),o&&o.hide()}function I(){u.trigger(l.events.PLAY_STOP),o&&o.show()}function w(){u.trigger(l.events.VIDEO_ENDED)}function E(e){var t=["youtube","vimeo","html5","soundcloud","wistia"];for(var o in t){var l=t[o];if(l!=e)switch(l){case"youtube":_.pause(),_.destroy(),i.hide();break;case"vimeo":g.pause(),g.destroy(),n.hide();break;case"html5":c.pause(),r.hide();break;case"soundcloud":h.pause(),h.destroy(),a.hide();break;case"wistia":p.pause(),s.hide()}}}this.init=function(t,i,n){if(!(e=n))throw new Error("missing gallery ID for video player, it's a must!");f=jQuery.extend(f,t),_.setOptions(f),i&&1==i&&(b.standAloneMode=!0)},this.setHtml=function(l){b.youtubeInnerID=e+"_youtube_inner",b.vimeoPlayerID=e+"_videoplayer_vimeo",b.html5PlayerID=e+"_videoplayer_html5",b.wistiaPlayerID=e+"_videoplayer_wistia",b.soundCloudPlayerID=e+"_videoplayer_soundcloud";var u="<div class='ug-videoplayer' style='display:none'>";u+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+b.youtubeInnerID+"'></div></div>",u+="<div id='"+b.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'></div>",u+="<div id='"+b.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'></div>",u+="<div id='"+b.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'></div>",u+="<div id='"+b.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'></div>",0==b.standAloneMode&&1==f.video_enable_closebutton&&(u+="<div class='ug-videoplayer-button-close'></div>"),u+="</div>",l.append(u),t=l.children(".ug-videoplayer"),i=t.children(".ug-videoplayer-youtube"),n=t.children(".ug-videoplayer-vimeo"),r=t.children(".ug-videoplayer-html5"),a=t.children(".ug-videoplayer-soundcloud"),s=t.children(".ug-videoplayer-wistia"),0==b.standAloneMode&&1==f.video_enable_closebutton&&(o=t.children(".ug-videoplayer-button-close"))},this.destroy=function(){o&&(o.off("click"),o.off("touchend")),jQuery(_).off(_.events.START_PLAYING),jQuery(_).off(_.events.STOP_PLAYING),jQuery(g).off(g.events.START_PLAYING),jQuery(g).off(g.events.STOP_PLAYING),jQuery(c).off(c.events.START_PLAYING),jQuery(c).off(c.events.STOP_PLAYING),jQuery(h).off(h.events.START_PLAYING,y),jQuery(h).off(h.events.STOP_PLAYING,I),jQuery(p).off(p.events.START_PLAYING,y),jQuery(p).off(p.events.STOP_PLAYING,I),m=null},this.initEvents=function(){o&&(d.setButtonMobileReady(o),d.setButtonOnClick(o,v)),jQuery(_).on(_.events.START_PLAYING,y),jQuery(_).on(_.events.STOP_PLAYING,I),jQuery(_).on(_.events.VIDEO_ENDED,w),jQuery(g).on(g.events.START_PLAYING,y),jQuery(g).on(g.events.STOP_PLAYING,I),jQuery(g).on(g.events.VIDEO_ENDED,w),jQuery(c).on(c.events.START_PLAYING,y),jQuery(c).on(c.events.STOP_PLAYING,I),jQuery(c).on(c.events.VIDEO_ENDED,w),jQuery(h).on(h.events.START_PLAYING,y),jQuery(h).on(h.events.STOP_PLAYING,I),jQuery(h).on(h.events.VIDEO_ENDED,w),jQuery(p).on(p.events.START_PLAYING,y),jQuery(p).on(p.events.STOP_PLAYING,I),jQuery(p).on(p.events.VIDEO_ENDED,w)},this.setSize=function(e,i){d.setElementSize(t,e,i),o&&d.placeElement(o,"right","top")},this.setPosition=function(e,i){d.placeElement(t,e,i)},this.getObject=function(){return t},this.show=function(){if(1==l.isVisible())return!0;t.show(),t.fadeTo(0,1),o&&o.show(),u.trigger(l.events.SHOW)},this.hide=function(){if(0==l.isVisible())return!0;E(),m=null,t.hide(),u.trigger(l.events.HIDE)},this.getActiveAPI=function(){switch(m){case"youtube":return _;case"vimeo":return g;case"wistia":return p;case"soundcloud":return h;case"html5":return c;default:return null}},this.pause=function(){var e=l.getActiveAPI();if(null==e)return!1;"function"==typeof e.pause&&e.pause()},this.isVisible=function(){return t.is(":visible")},this.playYoutube=function(e,t,n){if(void 0===t)t=!0;if(!n)n=null;E("youtube"),i.show(),0==i.children("#"+b.youtubeInnerID).length&&i.append("<div id='"+b.youtubeInnerID+"'></div>");var r={};n&&(r.start=n),1==_.isPlayerReady()&&1==b.standAloneMode?_.changeVideo(e,t):_.putVideo(b.youtubeInnerID,e,"100%","100%",t,r),m="youtube"},this.playVimeo=function(e,t){if(void 0===t)t=!0;E("vimeo"),n.show(),g.putVideo(b.vimeoPlayerID,e,"100%","100%",t),m="vimeo"},this.playHtml5Video=function(e,t,i,n,o){if(void 0===o)o=!0;E("html5"),r.show();var a={ogv:e,webm:t,mp4:i,posterImage:n};c.putVideo(b.html5PlayerID,a,"100%","100%",o),m="html5"},this.playSoundCloud=function(e,t){if(void 0===t)t=!0;E("soundcloud"),a.show(),h.putSound(b.soundCloudPlayerID,e,"100%","100%",t),m="soundcloud"},this.playWistia=function(e,t){if(void 0===t)t=!0;E("wistia"),s.show(),p.putVideo(b.wistiaPlayerID,e,"100%","100%",t),m="wistia"}}var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI;function ugCheckForMinJQueryVersion(){if(0==g_ugFunctions.checkMinJqueryVersion("1.8.0"))throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.")}function ugCheckForErrors(e,t){try{"jquery"==t?(!function(){if("undefined"==typeof jQuery)throw new Error("jQuery library not included")}(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),function(){if("function"==typeof jQuery.fn.unitegallery)return!0;var e="You have some jquery.js library include that comes after the gallery files js include.";throw e+="<br> This include eliminates the gallery libraries, and make it not work.","cms"==t?(e+="<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Gallery Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true.",e+="<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it."):e+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.",new Error(e)}())}catch(r){var i=r.message;if(i="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+(i="Unite Gallery Error: "+i)+"</div>","jquery"==t){var n=document.getElementById(e);n.innerHTML=i,n.style.display="block"}else jQuery(e).show().html(i);return!1}return!0}function UniteGalleryMain(){var t=this,g_galleryID,g_objGallery=jQuery(t),g_objWrapper,g_objParent,g_objThumbs,g_objSlider,g_objLightbox,g_functions=new UGFunctions,g_objTabs,g_objLoadMore,g_arrItems=[],g_numItems,g_selectedItem=null,g_selectedItemIndex=-1,g_objTheme,g_objCache={};this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"};var g_options={gallery_width:900,gallery_height:500,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!1,gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:"",load_api_externally:!1},g_temp={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};function __________INIT_GALLERY_______(){}function getThemeFunction(e){var t=e;return-1==t.indexOf("UGTheme_")&&(t="UGTheme_"+t),t}function initTheme(objCustomOptions){if(objCustomOptions.hasOwnProperty("gallery_theme"))g_options.gallery_theme=objCustomOptions.gallery_theme;else{var defaultTheme=g_options.gallery_theme;0==g_ugFunctions.isThemeRegistered(defaultTheme)&&(g_options.gallery_theme=g_ugFunctions.getFirstRegisteredTheme())}var themeFunction=getThemeFunction(g_options.gallery_theme);try{g_options.gallery_theme=eval(themeFunction)}catch(e){}g_options.gallery_theme=eval(themeFunction),g_objTheme=new g_options.gallery_theme,g_objTheme.init(t,objCustomOptions)}function resetOptions(){g_options=jQuery.extend({},g_temp.originalOptions),g_selectedItemIndex=-1,g_selectedItem=null,g_objSlider=void 0,g_objThumbs=void 0,g_objLightbox=void 0}function checkForStartupErrors(){try{ugCheckForMinJQueryVersion()}catch(e){throwErrorShowMessage(e.message)}"object"==typeof g_objWrapper.outerWidth()&&throwErrorShowMessage("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version."),setTimeout(function(){ugCheckForErrors(g_galleryID,"cms")},5e3)}function runGallery(e,i,n,r){var o="object"==typeof i;if(o&&(g_temp.objCustomOptions=i),1==g_temp.isRunFirstTime){if(g_galleryID=e,0==(g_objWrapper=jQuery(g_galleryID)).length)return trace("div with id: "+g_galleryID+" not found"),!1;g_objParent=g_objWrapper.parent(),checkForStartupErrors(),g_temp.originalOptions=jQuery.extend({},g_options),o&&(g_options=jQuery.extend(g_options,i)),1==g_options.gallery_enable_cache&&g_options.gallery_initial_catid&&cacheItems(g_options.gallery_initial_catid),t.setSizeClass(),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.find("img").fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}else if(t.destroy(),resetOptions(),g_options=jQuery.extend(g_options,g_temp.objCustomOptions),n){if(r&&1==g_options.gallery_enable_cache&&cacheItems(r,n),"noitems"==n)return showErrorMessage("No items in this category",""),!1;g_objWrapper.html(n),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.children().fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_tabs&&(g_objTabs=new UGTabs).init(t,g_options),1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_loadmore&&(g_objLoadMore=new UGLoadMore).init(t,g_options),o&&modifyInitParams(g_temp.objCustomOptions),validateParams(),1==g_options.gallery_shuffle&&t.shuffleItems(),initTheme(g_temp.objCustomOptions),setGalleryHtml(),setHtmlObjectsProperties(),0==g_objWrapper.width()?g_functions.waitForWidth(g_objWrapper,runGalleryActually):runGalleryActually()}function runGalleryActually(){t.setSizeClass(),0==g_temp.isFreestyleMode&&1==g_options.gallery_preserve_ratio&&setHeightByOriginalRatio(),g_objTheme.run(),g_objTabs&&g_temp.isRunFirstTime&&g_objTabs.run(),preloadBigImages(),initEvents(),g_numItems>0&&t.selectItem(0),1==g_options.gallery_autoplay&&t.startPlayMode(),g_temp.isRunFirstTime=!1}function showErrorMessage(e,t){if(void 0===t)t="<b>Unite Gallery Error: </b>";else t="<b>"+t+": </b>";var i="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+(e=t+e)+"</div></div>";g_objWrapper.children().remove(),g_objWrapper.html(i),g_objWrapper.show()}function throwErrorShowMessage(e){throw showErrorMessage(e),new Error(e)}function modifyInitParams(){g_options.gallery_images_preload_type||(g_options.gallery_images_preload_type="minimal"),(null==g_options.gallery_min_height||g_options.gallery_height<g_options.gallery_min_height)&&(g_options.gallery_min_height=0),(null==g_options.gallery_min_width||g_options.gallery_width<g_options.gallery_min_width)&&(g_options.gallery_min_width=0)}function validateParams(){if(!g_options.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(g_options.gallery_height)&&g_options.gallery_height<g_options.gallery_min_height)throw new Error("The <b>gallery_height</b> option must be bigger then <b>gallery_min_height option</b>");if(g_options.gallery_width<g_options.gallery_min_width)throw new Error("The <b>gallery_width</b> option must be bigger then <b>gallery_min_width option</b>")}function setGalleryHtml(){g_objWrapper.addClass("ug-gallery-wrapper"),g_objWrapper.append("<div class='ug-overlay-disabled' style='display:none'></div>"),t.setSizeClass()}function clearInitData(){g_objWrapper.children().remove()}function storeLastSize(){var e=t.getSize();g_temp.lastWidth=e.width,g_temp.lastHeight=e.height}function setHeightByOriginalRatio(){var e=t.getSize();if(e.width/e.height!=e.orig_ratio){var i=e.width/e.orig_ratio;(i=Math.round(i))<g_options.gallery_min_height&&(i=g_options.gallery_min_height),g_objWrapper.height(i)}}function setHtmlObjectsProperties(){var e={"max-width":g_functions.getCssSizeParam(g_options.gallery_width),"min-width":g_functions.getCssSizeParam(g_options.gallery_min_width)};if(0==g_temp.isFreestyleMode){var t=g_functions.getCssSizeParam(g_options.gallery_height);e.height=t}else e.overflow="visible";g_options.gallery_background_color&&(e["background-color"]=g_options.gallery_background_color),g_objWrapper.css(e)}function fillItemByChild(e){var i=t.isMobileMode();if("noscript"==(a=e.prop("tagName").toLowerCase()))return null;if("picture"==a){var n=e.find("img");if(0==n.length)return null;e=n,a="img"}var r=e.data("lazy-src");r&&e.attr("src",r);var o="";if("a"==a){o=e.attr("href");var a=(e=e.children("img:first-child")).prop("tagName").toLowerCase()}var s=e.data("type");null==s&&(s="image");var l={};if(l.type=s,"img"==a){if(!(u=e.data("lazyload-src")))var u=e.data("lazy-src");u&&""!=u&&(e.attr("src",u),jQuery.removeData(e,"lazyload-src"));var d=e.data("image"),_=e.data("thumb"),g=e.data("title");void 0===d&&(d=null),void 0===_&&(_=null);var c=e.attr("src");d||(d=c),_||(_=c),_||(_=d),d||(d=_),l.urlThumb=_,l.urlImage=d,l.title=e.attr("alt"),g&&(l.title=g),l.objThumbImage=e,l.objThumbImage.attr("src",l.urlThumb)}else{if("image"==s)throw trace("Problematic gallery item found:"),trace(e),trace("Please look for some third party js script that could add this item to the gallery"),new Error("The item should not be image type");l.urlThumb=e.data("thumb"),l.title=e.data("title"),l.objThumbImage=null,l.urlImage=e.data("image")}if(1==i){var h=e.data("thumb-mobile");void 0!==h&&""!=h&&(l.urlThumb=h,"img"==a&&e.attr("src",l.urlThumb));var p=e.data("image-mobile");void 0!==p&&""!=p&&(l.urlImage=p)}l.link=o,l.description=e.attr("title"),l.description||(l.description=e.data("description")),l.description||(l.description=""),l.isNewAdded=!1,l.isLoaded=!1,l.isThumbImageLoaded=!1,l.objPreloadImage=null,l.isBigImageLoadStarted=!1,l.isBigImageLoaded=!1,l.isBigImageLoadError=!1,l.imageWidth=0,l.imageHeight=0,l.thumbWidth=0,l.thumbHeight=0,l.thumbRatioByWidth=0,l.thumbRatioByHeight=0;var m=e.data("width"),f=e.data("height");m&&"number"==typeof m&&f&&"number"==typeof f&&(l.thumbWidth=m,l.thumbHeight=f,l.thumbRatioByWidth=m/f,l.thumbRatioByHeight=f/m),l.addHtml=null;var b=null==l.urlImage||""==l.urlImage,v=null==l.urlThumb||""==l.urlThumb;switch(l.type){case"youtube":if(l.videoid=e.data("videoid"),l.video_start=e.data("start"),b||v){var y=g_ugYoutubeAPI.getVideoImages(l.videoid);b&&(l.urlImage=y.preview),v&&(l.urlThumb=y.thumb,"img"==a&&e.attr("src",l.urlThumb))}g_temp.isYoutubePresent=!0;break;case"vimeo":l.videoid=e.data("videoid"),g_temp.isVimeoPresent=!0;break;case"html5video":l.videoogv=e.data("videoogv"),l.videowebm=e.data("videowebm"),l.videomp4=e.data("videomp4"),g_temp.isHtml5VideoPresent=!0;break;case"soundcloud":l.trackid=e.data("trackid"),g_temp.isSoundCloudPresent=!0;break;case"wistia":l.videoid=e.data("videoid"),g_temp.isWistiaPresent=!0;break;case"custom":var I=e.children("img");I.length&&(I=jQuery(I[0]),l.urlThumb=I.attr("src"),l.title=I.attr("alt"),l.objThumbImage=I);var w=e.children().not("img:first-child");w.length&&(l.addHtml=w.clone())}return l.objThumbImage&&(l.objThumbImage.removeAttr("data-description",""),l.objThumbImage.removeAttr("data-image",""),l.objThumbImage.removeAttr("data-thumb",""),l.objThumbImage.removeAttr("title","")),l}function fillItemsArray(e,t){if(!0!==t)g_arrItems=[];else for(var i=0;i<g_numItems;i++)g_arrItems[i].isNewAdded=!1;for(i=0;i<e.length;i++){var n=jQuery(e[i]),r=fillItemByChild(n);null!==r?(numIndex=g_arrItems.length,r.index=numIndex,!0===t&&(r.isNewAdded=!0),g_arrItems.push(r)):n.remove()}g_numItems=g_arrItems.length}function loadAPIs(){var e=g_options.load_api_externally;g_temp.isYoutubePresent&&g_ugYoutubeAPI.loadAPI(e),g_temp.isVimeoPresent&&g_ugVimeoAPI.loadAPI(e),g_temp.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI(e),g_temp.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI(e),g_temp.isWistiaPresent&&g_ugWistiaAPI.loadAPI(e)}function preloadBigImages(){if("visible"!=g_options.gallery_images_preload_type||g_objThumbs||(g_options.gallery_images_preload_type="minimal"),1==g_temp.isAllItemsPreloaded)return!0;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":jQuery(g_arrItems).each(function(){preloadItemImage(this)});break;case"visible":jQuery(g_arrItems).each(function(){1==g_objThumbs.isItemThumbVisible(this)&&preloadItemImage(this)})}}function checkPreloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!1;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":preloadItemImage(e);break;case"visible":1==g_objThumbs.isItemThumbVisible(e)&&preloadItemImage(e)}}function preloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!0;var i=e.urlImage;if(""==i||null==i)return e.isBigImageLoadError=!0,!1;e.isBigImageLoadStarted=!0,e.objPreloadImage=jQuery("<img/>").attr("src",i),e.objPreloadImage.data("itemIndex",e.index),e.objPreloadImage.on("load",t.onItemBigImageLoaded),e.objPreloadImage.on("error",function(){var e=jQuery(this).data("itemIndex"),i=g_arrItems[e];i.isBigImageLoadError=!0,i.isBigImageLoaded=!1;var n=jQuery(this).attr("src");console.log("Can't load image: "+n),g_objGallery.trigger(t.events.ITEM_IMAGE_UPDATED,[e,i.urlImage]),i.objThumbImage.attr("src",i.urlThumb)}),checkAllItemsStartedPreloading()}function preloadNearBigImages(e){if(1==g_temp.isAllItemsPreloaded)return!1;if(!e)e=g_selectedItem;if(!e)return!0;var t=e.index,i=t-1,n=t+1;i>0&&preloadItemImage(g_arrItems[i]),n<g_numItems&&preloadItemImage(g_arrItems[n])}function checkAllItemsStartedPreloading(){if(1==g_temp.isAllItemsPreloaded)return!1;for(var e in g_arrItems)if(0==g_arrItems[e].isBigImageLoadStarted)return!1;g_temp.isAllItemsPreloaded=!0}function __________END_INIT_GALLERY_______(){}function __________EVENTS_____________(){}function onSliderMouseEnter(e){1==g_options.gallery_pause_on_mouseover&&0==t.isFullScreen()&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&t.pausePlaying()}function onSliderMouseLeave(e){1==g_options.gallery_pause_on_mouseover&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&(0==g_objSlider.isCurrentSlideLoadingImage()&&t.continuePlaying())}function isThisGalleryForKeyAction(){if(!window.ugArrGalleriesObjects)return!0;window.ugArrGalleriesObjects.length;if(1==window.ugArrGalleriesObjects.length)return!0;var e,i=0,n=t.getGalleryID();return jQuery.each(window.ugArrGalleriesObjects,function(t,r){var o=r.getGalleryID(),a=r.getKeyPressScore();a>i&&(i=a),o==n&&(e=a)}),e==i}function onKeyPress(e){var i=jQuery(e.target);if(i.is("textarea")||i.is("select")||i.is("input"))return!0;var n=e.charCode?e.charCode:e.keyCode?e.keyCode:e.which?e.which:0,r=!1;switch(n){case 39:1==isThisGalleryForKeyAction()&&(t.nextItem(),r=!0);break;case 37:1==isThisGalleryForKeyAction()&&(t.prevItem(),r=!0);break;default:r=!1}1==r&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()),g_objGallery.trigger(t.events.GALLERY_KEYPRESS,[n,e])}function onGalleryResized(){var e;if(0==(e=t.getSize()).width)return!0;if(t.setSizeClass(),(e=t.getSize()).width!=g_temp.lastWidth||0==g_temp.isFreestyleMode&&e.height!=g_temp.lastHeight){var i=!1;if(g_temp.funcCustomHeight){var n=g_temp.funcCustomHeight(e);n&&(g_objWrapper.height(n),i=!0)}0==i&&1==g_options.gallery_preserve_ratio&&0==g_temp.isFreestyleMode&&setHeightByOriginalRatio(),storeLastSize(),g_objGallery.trigger(t.events.SIZE_CHANGE)}}function onThumbsChange(e){"visible"==g_options.gallery_images_preload_type&&0==g_temp.isAllItemsPreloaded&&preloadBigImages()}function onFullScreenChange(){var e=g_functions.isFullScreen(),i=e?t.events.ENTER_FULLSCREEN:t.events.EXIT_FULLSCREEN,n=g_functions.getGlobalData("fullscreenID");if(g_galleryID!==n)return!0;e?g_objWrapper.addClass("ug-fullscreen"):g_objWrapper.removeClass("ug-fullscreen"),g_objGallery.trigger(i),onGalleryResized()}function onItemImageUpdated(e,i){checkPreloadItemImage(t.getItem(i))}function onCurrentSlideImageLoadEnd(){1==t.isPlayMode()&&t.continuePlaying()}function initEvents(){if(g_objWrapper.on("dragstart",function(e){e.preventDefault()}),g_objGallery.on(t.events.ITEM_IMAGE_UPDATED,onItemImageUpdated),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).on(g_objThumbs.events.STRIP_MOVE,onThumbsChange);break;case"grid":jQuery(g_objThumbs).on(g_objThumbs.events.PANE_CHANGE,onThumbsChange)}if("advance"==g_options.gallery_mousewheel_role&&0==g_temp.isFreestyleMode&&g_objWrapper.on("mousewheel",t.onGalleryMouseWheel),storeLastSize(),jQuery(window).resize(function(){g_objWrapper.css("width","auto"),g_functions.whenContiniousEventOver("gallery_resize",onGalleryResized,g_temp.resizeDelay)}),setTimeout(function(){setInterval(onGalleryResized,2e3)},1e4),g_functions.addFullScreenChangeEvent(onFullScreenChange),g_objSlider){if(jQuery(g_objSlider).on(g_objSlider.events.ITEM_CHANGED,function(){var e=g_objSlider.getCurrentItemIndex();-1!=e&&t.selectItem(e)}),1==g_options.gallery_pause_on_mouseover)g_objSlider.getElement().hover(onSliderMouseEnter,onSliderMouseLeave),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){onSliderMouseLeave()});retriggerEvent(g_objSlider,g_objSlider.events.ACTION_START,t.events.SLIDER_ACTION_START),retriggerEvent(g_objSlider,g_objSlider.events.ACTION_END,t.events.SLIDER_ACTION_END),jQuery(g_objSlider).on(g_objSlider.events.CURRENTSLIDE_LOAD_END,onCurrentSlideImageLoadEnd)}1==g_options.gallery_control_keyboard&&jQuery(document).keydown(onKeyPress)}function __________GENERAL_______(){}function cacheItems(e,t){if(t)"noitems"!=(i=t)&&(i=jQuery(t).clone());else var i=g_objWrapper.children().clone();g_objCache[e]=i}function removeAllSizeClasses(e){e||(e=g_objWrapper),e.removeClass("ug-under-480"),e.removeClass("ug-under-780"),e.removeClass("ug-under-960")}function retriggerEvent(e,t,i){jQuery(e).on(t,function(e){g_objGallery.trigger(i,[this])})}function advanceNextStep(){var e=jQuery.now(),i=e-g_temp.playTimeLastStep;if(g_temp.playTimeLastStep=e,0==t.isGalleryVisible())return!1;if(g_temp.playTimePassed+=i,g_temp.objProgress){var n=g_temp.playTimePassed/g_options.gallery_play_interval;g_temp.objProgress.setProgress(n)}g_temp.playTimePassed>=g_options.gallery_play_interval&&(t.nextItem(),g_temp.playTimePassed=0)}function unselectSeletedItem(){if(null==g_selectedItem)return!0;g_objThumbs&&g_objThumbs.setThumbUnselected(g_selectedItem.objThumbWrapper),g_selectedItem=null,g_selectedItemIndex=-1}function toFakeFullScreen(){jQuery("body").addClass("ug-body-fullscreen"),g_objWrapper.addClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!0,g_objGallery.trigger(t.events.ENTER_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}function exitFakeFullscreen(){jQuery("body").removeClass("ug-body-fullscreen"),g_objWrapper.removeClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!1,g_objGallery.trigger(t.events.EXIT_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}this.onItemBigImageLoaded=function(e,t){if(!t)t=jQuery(this);var i=t.data("itemIndex"),n=g_arrItems[i];n.isBigImageLoaded=!0;var r=g_functions.getImageOriginalSize(t);n.imageWidth=r.width,n.imageHeight=r.height},this.checkFillImageSize=function(e,t){if(!t){var i=e.data("itemIndex");if(void 0===i)throw new Error("Wrong image given to gallery.checkFillImageSize");t=g_arrItems[i]}var n=g_functions.getImageOriginalSize(e);t.imageWidth=n.width,t.imageHeight=n.height},this.setFreestyleMode=function(){g_temp.isFreestyleMode=!0},this.attachThumbsPanel=function(e,t){g_temp.thumbsType=e,g_objThumbs=t},this.initSlider=function(e,i){if(!e)e={};e=jQuery.extend(g_temp.objCustomOptions,e),(g_objSlider=new UGSlider).init(t,e,i)},this.onGalleryMouseWheel=function(e,i,n,r){e.preventDefault(),i>0?t.prevItem():t.nextItem()},this.getKeyPressScore=function(){if(t.isGalleryInsideScreen())return 1;if(g_objLightbox&&1==g_objLightbox.isOpened())return 2;return 0},this.getGalleryID=function(){return g_galleryID},this.destroy=function(){if(g_objWrapper.off("dragstart"),g_objGallery.off(t.events.ITEM_IMAGE_UPDATED),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).off(g_objThumbs.events.STRIP_MOVE);break;case"grid":jQuery(g_objThumbs).off(g_objThumbs.events.PANE_CHANGE)}if(g_objWrapper.off("mousewheel"),jQuery(window).off("resize"),g_functions.destroyFullScreenChangeEvent(),g_objSlider){jQuery(g_objSlider).off(g_objSlider.events.ITEM_CHANGED);var e=g_objSlider.getElement();e.off("mouseenter"),e.off("mouseleave"),g_objGallery.off(t.events.ENTER_FULLSCREEN),jQuery(g_objSlider).off(g_objSlider.events.ACTION_START),jQuery(g_objSlider).off(g_objSlider.events.ACTION_END),jQuery(g_objSlider).off(g_objSlider.events.CURRENTSLIDE_LOAD_END)}1==g_options.gallery_control_keyboard&&jQuery(document).off("keydown"),g_objTheme&&"function"==typeof g_objTheme.destroy&&g_objTheme.destroy(),g_objWrapper.html("")},this.getArrItems=function(){return g_arrItems},this.getObjects=function(){return{g_galleryID:g_galleryID,g_objWrapper:g_objWrapper,g_objThumbs:g_objThumbs,g_objSlider:g_objSlider,g_options:g_options,g_arrItems:g_arrItems,g_numItems:g_numItems}},this.getObjSlider=function(){return g_objSlider},this.getItem=function(e){if(e<0)throw new Error("item with index: "+e+" not found");if(e>=g_numItems)throw new Error("item with index: "+e+" not found");return g_arrItems[e]},this.getWidth=function(){return t.getSize().width},this.getHeight=function(){return t.getSize().height},this.getSize=function(){var e=g_functions.getElementSize(g_objWrapper);return e.orig_width=g_options.gallery_width,e.orig_height=g_options.gallery_height,e.orig_ratio=e.orig_width/e.orig_height,e},this.getGalleryID=function(){return g_galleryID.replace("#","")},this.getNextItem=function(e,t){"object"==typeof e&&(e=e.index);var i=e+1;if(!0!==t&&1==g_numItems)return null;if(i>=g_numItems){if(1!=g_options.gallery_carousel&&!0!==t)return null;i=0}return g_arrItems[i]},this.getPrevItem=function(e){"object"==typeof e&&(e=e.index);var t=e-1;if(t<0){if(1!=g_options.gallery_carousel&&!0!==forceCarousel)return null;t=g_numItems-1}return g_arrItems[t]},this.getSelectedItem=function(){return g_selectedItem},this.getSelectedItemIndex=function(){return g_selectedItemIndex},this.getNumItems=function(){return g_numItems},this.isLastItem=function(){return g_selectedItemIndex==g_numItems-1},this.isFirstItem=function(){return 0==g_selectedItemIndex},this.getOptions=function(){return g_options},this.getElement=function(){return g_objWrapper},this.___________SET_CONTROLS___________=function(){},this.setNextButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.nextItem)},this.setPrevButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.prevItem)},this.setFullScreenToggleButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnTap(e,t.toggleFullscreen),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){e.addClass("ug-fullscreenmode")}),g_objGallery.on(t.events.EXIT_FULLSCREEN,function(){e.removeClass("ug-fullscreenmode")})},this.destroyFullscreenButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.ENTER_FULLSCREEN),g_objGallery.off(t.events.EXIT_FULLSCREEN)},this.setPlayButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.togglePlayMode),g_objGallery.on(t.events.START_PLAY,function(){e.addClass("ug-stop-mode")}),g_objGallery.on(t.events.STOP_PLAY,function(){e.removeClass("ug-stop-mode")})},this.destroyPlayButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.START_PLAY),g_objGallery.off(t.events.STOP_PLAY)},this.setProgressIndicator=function(e){g_temp.objProgress=e},this.setTextContainers=function(e,i){g_objGallery.on(t.events.ITEM_CHANGE,function(){var n=t.getSelectedItem();e.html(n.title),i.html(n.description)})},this.showDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").show()},this.hideDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").hide()},this.___________END_SET_CONTROLS___________=function(){},this.___________PLAY_MODE___________=function(){},this.startPlayMode=function(){if(g_temp.isPlayMode=!0,g_temp.isPlayModePaused=!1,g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval),g_temp.objProgress){var e=g_temp.objProgress.getElement();g_temp.objProgress.setProgress(0),e.show()}g_objGallery.trigger(t.events.START_PLAY),g_objSlider&&1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying()},this.resetPlaying=function(){if(0==g_temp.isPlayMode)return!0;g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now()},this.pausePlaying=function(){if(1==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!0,clearInterval(g_temp.playHandle),g_objGallery.trigger(t.events.PAUSE_PLAYING)},this.continuePlaying=function(){if(0==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!1,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval)},this.stopPlayMode=function(){(g_temp.isPlayMode=!1,clearInterval(g_temp.playHandle),g_temp.playTimePassed=0,g_temp.objProgress)&&g_temp.objProgress.getElement().hide();g_objGallery.trigger(t.events.STOP_PLAY)},this.isPlayMode=function(){return g_temp.isPlayMode},this.togglePlayMode=function(){0==t.isPlayMode()?t.startPlayMode():t.stopPlayMode()},this.___________GENERAL_EXTERNAL___________=function(){},this.shuffleItems=function(){for(var e in g_arrItems=g_functions.arrayShuffle(g_arrItems))g_arrItems[e].index=parseInt(e)},this.setOptions=function(e){g_options=jQuery.extend(g_options,e)},this.selectItem=function(e,i){"number"==typeof e&&(e=t.getItem(e));var n=e.index;if(n==g_selectedItemIndex)return!0;(unselectSeletedItem(),g_selectedItem=e,g_selectedItemIndex=n,g_objGallery.trigger(t.events.ITEM_CHANGE,[e,i]),1==g_temp.isPlayMode)&&(t.resetPlaying(),1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying())},this.nextItem=function(){var e=g_selectedItemIndex+1;return 0==g_numItems||(0==g_options.gallery_carousel&&e>=g_numItems||(e>=g_numItems&&(e=0),void t.selectItem(e,"next")))},this.prevItem=function(){var e=g_selectedItemIndex-1;return-1==g_selectedItemIndex&&(e=0),0==g_numItems||(0==g_options.gallery_carousel&&e<0||(e<0&&(e=g_numItems-1),void t.selectItem(e,"prev")))},this.isFullScreen=function(){return 1==g_temp.isFakeFullscreen||1==g_functions.isFullScreen()},this.isFakeFullscreen=function(){return g_temp.isFakeFullscreen},this.toFullScreen=function(){g_functions.setGlobalData("fullscreenID",g_galleryID);var e=g_objWrapper.get(0);0==g_functions.toFullscreen(e)&&toFakeFullScreen()},this.exitFullScreen=function(){1==g_temp.isFakeFullscreen?exitFakeFullscreen():g_functions.exitFullscreen()},this.toggleFullscreen=function(){0==t.isFullScreen()?t.toFullScreen():t.exitFullScreen()},this.resize=function(e,t,i){g_objWrapper.css("width","auto"),g_objWrapper.css("max-width",e+"px"),t&&g_objWrapper.height(t),i||!0===i||onGalleryResized()},this.setSizeClass=function(e,i){if(!e)e=g_objWrapper;if(!i)i=t.getSize().width;if(0==i)i=jQuery(window).width();var n="";if(i<=480?n="ug-under-480":i<=780?n="ug-under-780":i<960&&(n="ug-under-960"),1==e.hasClass(n))return!0;removeAllSizeClasses(e),""!=n&&e.addClass(n)},this.isMobileMode=function(){return!!g_objWrapper.hasClass("ug-under-480")},this.isSmallWindow=function(){var e=jQuery(window).width();return!e||e<=480},this.isGalleryVisible=function(){return g_objWrapper.is(":visible")},this.isGalleryInsideScreen=function(){return 1!=g_temp.isFreestyleMode&&(!!g_objSlider&&g_functions.isElementInsideScreen(g_objWrapper))},this.changeItems=function(e,t){if(!e)e="noitems";runGallery(g_galleryID,"nochange",e,t)},this.addItems=function(e){if(!e||0==e.length)return!1;var t=g_objWrapper.children(".ug-newitems-wrapper");if(0==t.length&&g_objWrapper.append("<div class='ug-newitems-wrapper' style='display:none'></div>"),(t=g_objWrapper.children(".ug-newitems-wrapper")).append(e),fillItemsArray(jQuery(t.children()),!0),loadAPIs(),!g_objTheme||"function"!=typeof g_objTheme.addItems)throw new Error("addItems function not found in the theme");t.remove(),g_objTheme.addItems()},this.getNewAddedItemsIndexes=function(){var e=[];return jQuery.each(g_arrItems,function(t,i){1==i.isNewAdded&&e.push(t)}),e},this.showErrorMessageReplaceGallery=function(e){showErrorMessage(e)},this.setFuncCustomHeight=function(e){g_temp.funcCustomHeight=e},this.setObjLightbox=function(e){g_objLightbox=e},this.__________EXTERNAL_EVENTS_______=function(){},this.triggerEvent=function(e,t){t?("array"!=jQuery.type(t)&&(t=[t]),g_objGallery.trigger(e,t)):g_objGallery.trigger(e)},this.onEvent=function(e,t){g_objGallery.on(e,t)},this.destroyEvent=function(e){g_objGallery.off(e)},this.__________AJAX_REQUEST_______=function(){},this.ajaxRequest=function(e,t,i,n){if(!i||"function"!=typeof i)throw new Error("ajaxRequest error: success function should be passed");var r=g_options.gallery_urlajax;if(!r||""==r)throw new Error("ajaxRequest error: Ajax url don't passed");if(void 0===t)t={};var o={action:"unitegallery_ajax_action",client_action:e,galleryID:g_galleryID,data:t};jQuery.ajax({type:"post",url:g_options.gallery_urlajax,dataType:"json",data:o,success:function(e){if(!e)throw new Error("Empty ajax response!");if(-1==e||0===e)throw new Error("ajax error!!!");if(void 0===e.success)throw new Error("ajax error!!!");if(0==e.success)return showErrorMessage(e.message,"ajax error"),!1;i(e)},error:function(e,t,i){console.log("Ajax Error!!! "+t),responseText=e.responseText,n&&"function"==typeof n?n(responseText):trace(responseText)}})},this.requestNewItems=function(e,i,n){var r=g_options.gallery_enable_cache;if(n||(n=e),1==i&&(r=!1),1==r&&g_objCache.hasOwnProperty(n)){var o=g_objCache[n];t.changeItems(o,n)}else g_objGallery.trigger(t.events.GALLERY_BEFORE_REQUEST_ITEMS),t.ajaxRequest("front_get_cat_items",{catid:e},function(e){var i=e.html;t.changeItems(i,n)})},this.run=function(e,t){if(t&&t.hasOwnProperty("gallery_debug_errors")&&(g_options.gallery_debug_errors=t.gallery_debug_errors),1==g_options.gallery_debug_errors)try{runGallery(e,t)}catch(e){if("object"==typeof e){var i=e.message,n=e.lineNumber,r=e.fileName;e.stack;i+=" <br><br> in file: "+r,i+=" <b> line "+n+"</b>",trace(e)}else i=e;showErrorMessage(i=i.replace("Error:",""))}else runGallery(e,t)}}function UGLightbox(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UniteGalleryMain,_=new UGSlider,g=new UGFunctions,c=new UGTextPanel,h={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0};this.events={LIGHTBOX_INIT:"lightbox_init"};var p={topPanelHeight:44,initTextPanelHeight:26,isOpened:!1,isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},m={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:p.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:0,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},f={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};function b(){1==p.isCompact&&1==h.lightbox_show_textpanel&&(h.lightbox_slider_image_padding_bottom=p.initTextPanelHeight),1==p.isCompact&&"inside"==h.lightbox_arrows_position&&(p.isArrowsInside=!0),1==p.isArrowsInside&&0==h.lightbox_arrows_inside_alwayson&&(p.isArrowsOnHoverMode=!0),0==h.lightbox_show_textpanel&&(p.isTopPanelEnabled=!1,p.topPanelHeight=0,h.lightbox_slider_image_padding_top=0)}function v(e){if(!_)return!0;var t={slider_image_padding_top:e};_.setOptions(t),_.refreshSlideItems()}function y(e){if(!s)return!1;if(!c)return!1;var t=s.height();if(0==t)return!1;if(0==s.is(":visible"))return!1;var i=t,n=c.getSize().height;t!=p.topPanelHeight&&(i=p.topPanelHeight),n>i&&(i=n),t!=i&&(s.height(i),_&&0==_.isAnimating()&&v(i))}function I(e){if(0==p.isOpened)return!1;if(!c)return!1;if(!_)return!1;var i=g.getElementSize(t),n=c.getSize();if(0==n.width||n.height>120)return!1;if(!e){var r=_.getSlideImage();e=g.getElementSize(r)}if(0==e.height||0==e.width)return!1;if(e.bottom+n.height<i.height)return!1;var o=_.getOptions(),a=n.height;if(a!=o.slider_image_padding_bottom){var s={slider_image_padding_bottom:a};if(0==_.isAnimating())return _.setOptions(s),_.refreshSlideItems(),!0}return!1}function w(e){g.getElementSize(t);var i=_.getSlideImage(),n=g.getElementSize(i);if(0==n.width)return!1;p.textPanelLeft=n.left,p.textPanelTop=n.bottom;var r=n.width;if(a){var o=g.getElementSize(a);r-=o.width;var s=n.right-o.width;g.placeElement(a,s,p.textPanelTop)}c&&(c.show(),c.refresh(!0,!0,r),function(e,t){if(!e){var i=_.getSlideImage();e=g.getElementSize(i)}p.textPanelTop=e.bottom,!0===t&&c.positionPanel(p.textPanelTop,p.textPanelLeft)}(n)),0==I(n)&&(p.positionFrom="handleCompactTextpanelSizes",c&&(c.positionPanel(p.textPanelTop,p.textPanelLeft),!0===e&&(e(),H())))}function E(){return 0==_.isCurrentSlideType("image")||1==_.isCurrentImageInPlace()}function T(e,t){if(0==p.isArrowsInside)return!1;if(!n)return!1;var i=E();if(n.show(),r.show(),p.positionFrom="positionArrowsInside",1==p.isArrowsOnHoverMode&&1==i&&0==A()&&M(!0),0==i)var o=g.getElementRelativePos(n,"left",h.lightbox_arrows_offset),a=g.getElementRelativePos(n,"middle"),s=g.getElementRelativePos(r,"right",h.lightbox_arrows_offset),l=a;else{var u=_.getSlideImage(),d=g.getElementSize(u);g.getElementSize(_.getElement()),o=g.getElementRelativePos(n,"left",0,u)+d.left+h.lightbox_arrows_inside_offset,a=g.getElementRelativePos(n,"middle",0,u)+d.top,s=g.getElementRelativePos(n,"right",0,u)+d.left-h.lightbox_arrows_inside_offset,l=a}if(!0===t){var c={left:o,top:a},m={left:s,top:l};n.stop().animate(c,{duration:p.fadeDuration}),r.stop().animate(m,{duration:p.fadeDuration})}else n.stop(),r.stop(),g.placeElement(n,o,a),g.placeElement(r,s,l);1==e&&O(t)}function S(e,i){p.positionFrom=null;var n=E(),r=g.getElementRelativePos(o,"right",2,t);if(0==n)var a=2,s=r;else{var l=_.getSlideImage(),u=g.getElementSize(l),d=g.getElementSize(_.getElement()),c=g.getElementSize(o);d.top==d.height&&(d.top=0);s=d.left+u.right-c.width/2+h.lightbox_compact_closebutton_offsetx;(a=d.top+u.top-c.height/2-h.lightbox_compact_closebutton_offsety)<2&&(a=2),s>r&&(s=r)}if(!0===i){var m={left:s,top:a};o.stop().animate(m,{duration:p.fadeDuration})}else o.stop(),g.placeElement(o,s,a);!0===e&&function(e){!0!==e&&o.stop();o.fadeTo(p.fadeDuration,1)}(i)}function P(){o&&o.stop().fadeTo(p.fadeDuration,0),j(),C(),p.positionFrom="hideCompactElements",1==p.isArrowsInside&&M()}function x(){var e=g.getElementSize(t);s&&g.setElementSizeAndPosition(s,0,0,e.width,p.topPanelHeight),n&&0==p.isArrowsInside&&(1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show()),g.placeElement(n,"left","middle",h.lightbox_arrows_offset),g.placeElement(r,"right","middle",h.lightbox_arrows_offset)),0==p.isCompact&&g.placeElement(o,"right","top",2,2),c&&(p.positionFrom="positionElements",0==p.isCompact?function(e){var t={},i=h.lightbox_textpanel_width;i>e.width-47-40?(t.textpanel_padding_left=47,t.textpanel_padding_right=40,t.textpanel_title_text_align="center",t.textpanel_desc_text_align="center"):(t.textpanel_padding_left=Math.floor((e.width-i)/2),t.textpanel_padding_right=t.textpanel_padding_left,t.textpanel_title_text_align="left",t.textpanel_desc_text_align="left",h.lightbox_textpanel_title_text_align&&(t.textpanel_title_text_align=h.lightbox_textpanel_desc_text_align),h.lightbox_textpanel_desc_text_align&&(t.textpanel_desc_text_align=h.lightbox_textpanel_desc_text_align)),c.setOptions(t),c.refresh(!0,!0),y(),c.positionPanel()}(e):(N(),H()));var i=e.width,a=e.height;if(_){if(s){var l={slider_image_padding_top:s.height()};_.setOptions(l)}_.setSize(i,a),_.setPosition(0,0)}}function j(){c&&c.getElement().stop().fadeTo(p.fadeDuration,0)}function C(){a&&a.stop().fadeTo(p.fadeDuration,0)}function A(){if(!p.lastMouseX)return!0;var e={pageX:p.lastMouseX,pageY:p.lastMouseY};return _.isMouseInsideSlideImage(e)}function M(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!1===t?(A(),!0):void(!0===e?(n.stop().fadeTo(0,0),r.stop().fadeTo(0,0)):(n.stop().fadeTo(p.fadeDuration,0),r.stop().fadeTo(p.fadeDuration,0))))}function O(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!0!==t&&1==E()||(1==_.isSwiping()||(!0!==e&&(n.stop(),r.stop()),n.fadeTo(p.fadeDuration,1),void r.fadeTo(p.fadeDuration,1))))}function z(e){if(!c)return!1;if(!e)e=_.getCurrentItem();c.setTextPlain(e.title,e.description)}function L(e){if(!a)return!1;if(!e)e=_.getCurrentItem();var t=d.getNumItems(),i=e.index+1;a.html(i+" / "+t)}function N(){if(!c)return!1;c.getElement().show().stop().fadeTo(p.fadeDuration,1)}function H(){a&&a.stop().fadeTo(p.fadeDuration,1)}function k(){if(0==p.isCompact)return!0;P()}function R(){if(0==p.isCompact)return!0;(p.positionFrom="onZoomChange",S(!1,!0),T(!1,!0),1==p.isCompact)&&(0==(_.isCurrentSlideType("image")&&1==_.isCurrentImageInPlace())?(j(),C()):(p.positionFrom="onZoomChange",N(),H()))}function G(){if(0==p.isCompact)return!0;p.positionFrom="onSliderAfterReturn",S(!0),T(!0),0==I()&&w(),N(),H()}function D(e,t){return t=jQuery(t),0==p.isCompact||(0==_.isSlideCurrent(t)||(p.positionFrom="onSliderAfterPutImage",S(!0),T(!0),void w()))}function Q(){var e=_.getOptions().slider_image_padding_top;if(s){var t=s.height();t!=e&&v(t)}if(1==p.isCompact){if(z(),L(),p.positionFrom="onSliderTransitionEnd",S(!0),T(!0),0==_.isSlideActionActive())0==I()&&w();N(),H()}}function W(e,t){0==p.isCompact?(a&&L(t),c&&(z(t),0==p.isRightNowOpened&&(c.positionElements(!1),y(),c.positionPanel()))):0==_.isAnimating()&&(c&&z(t),a&&L(t)),0==p.isSliderChangedOnce&&(p.isSliderChangedOnce=!0,u.trigger(l.events.LIGHTBOX_INIT))}function F(e,t){if("image"!=_.getSlideType()&&0==p.isCompact&&_.isSlideActionActive())return!0;if(1==_.isPreloading())return l.close("slider"),!0;1==h.lightbox_close_on_emptyspace&&(0==_.isMouseInsideSlideImage(t)&&l.close("slider_inside"))}function B(){x()}function Y(){s?function(){if(!s)return!1;s.hide()}():a&&a.hide(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.hide(),r.hide())}function U(){s?(!function(){if(!s)return!1;s.show()}(),y()):a&&a.show(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show())}function V(e,t,i){var n=!1;switch(t){case 27:1==p.isOpened&&l.close("keypress");break;case 38:case 40:case 33:case 34:n=!0}1==p.isOpened&&1==n&&i.preventDefault()}function X(){1==p.isArrowsOnHoverMode&&O(!1,!0)}function Z(e){p.positionFrom="hideCompactElements",1==p.isArrowsOnHoverMode&&1==E()&&M(!1,!0)}function q(e){p.lastMouseX=e.pageX,p.lastMouseY=e.pageY,1==(!n||0==n.is(":visible")||1!=n.css("opacity"))&&A()&&0==_.isAnimating()&&(p.positionFrom="onMouseMove",n&&0==n.is(":animated")&&O(!1,!0))}function K(e,t,i,n){if(0==p.isOpened)return!0;switch(h.gallery_mousewheel_role){default:case"zoom":"image"!=_.getSlideType()&&e.preventDefault();break;case"none":e.preventDefault();break;case"advance":d.onGalleryMouseWheel(e,t,i,n)}}this.destroy=function(){if(jQuery(document).unbind("mousemove"),i.off("touchstart"),i.off("touchend"),o.off("click"),e.off(d.events.ITEM_CHANGE),_){jQuery(_).off(_.events.TRANSITION_END),jQuery(_).off(_.events.CLICK),jQuery(_).off(_.events.START_DRAG),jQuery(_).off(_.events.TRANSITION_START),jQuery(_).off(_.events.AFTER_DRAG_CHANGE),jQuery(_).off(_.events.AFTER_RETURN);var n=_.getVideoObject();jQuery(n).off(n.events.PLAY_START),jQuery(n).off(n.events.PLAY_STOP),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z),_.destroy()}jQuery(window).unbind("resize"),e.off(d.events.GALLERY_KEYPRESS,V),t.off("mousewheel"),t.remove()},this.isOpened=function(){return p.isOpened},this.open=function(s){var l=d.getItem(s);(p.isOpened=!0,p.isRightNowOpened=!0,setTimeout(function(){p.isRightNowOpened=!1},100),_&&_.setItem(l,"lightbox_open"),c&&c.setTextPlain(l.title,l.description),i.stop().fadeTo(0,0),t.show(),t.fadeTo(0,1),i.stop().fadeTo(p.fadeDuration,h.lightbox_overlay_opacity),x(),1==p.isCompact)&&(1==_.isPreloading()?(o&&o.hide(),n&&1==p.isArrowsInside&&(n.hide(),r.hide()),a&&a.hide(),c&&c.hide()):1==p.isArrowsInside&&(n.hide(),r.hide()));_&&_.startSlideAction(),e.trigger(d.events.OPEN_LIGHTBOX,l)},this.close=function(i){p.isOpened=!1,1==p.isCompact&&P(),_&&_.stopSlideAction(),"image"!=_.getSlideType()?t.hide():t.fadeTo(p.fadeDuration,0,function(){t.hide()}),e.trigger(d.events.CLOSE_LIGHTBOX)},this.init=function(t,i){!function(t,i){d=t,e=jQuery(t),d.setObjLightbox(l),h=jQuery.extend(h,m),h=jQuery.extend(h,i),p.originalOptions=jQuery.extend({},h),"compact"==h.lightbox_type&&(p.isCompact=!0,h=jQuery.extend(h,f),h=jQuery.extend(h,i)),b(),1==p.putSlider?(d.initSlider(h,"lightbox"),g_objects=t.getObjects(),_=g_objects.g_objSlider):_=null,1==h.lightbox_show_textpanel?c.init(d,h,"lightbox"):c=null}(t,i)},this.putHtml=function(){var e,l;d.isSmallWindow()&&1==p.isCompact&&(p.isCompact=!1,b(),p.isArrowsInside=!1,p.isArrowsOnHoverMode=!1,(h=jQuery.extend({},p.originalOptions)).lightbox_arrows_position="sides",_.setOptions(h)),e="",l="",1==p.isCompact&&(l=" ug-lightbox-compact"),e+="<div class='ug-gallery-wrapper ug-lightbox"+l+"'>",e+="<div class='ug-lightbox-overlay'></div>",0==p.isCompact&&p.isTopPanelEnabled?(e+="<div class='ug-lightbox-top-panel'>",e+="<div class='ug-lightbox-top-panel-overlay'></div>",h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="</div>"):h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="<div class='ug-lightbox-button-close'></div>",e+="<div class='ug-lightbox-arrow-left'></div>",e+="<div class='ug-lightbox-arrow-right'></div>",e+="</div>",t=jQuery(e),jQuery("body").append(t),_&&_.setHtml(t),i=t.children(".ug-lightbox-overlay"),0==p.isCompact&&1==p.isTopPanelEnabled&&0==(s=t.children(".ug-lightbox-top-panel")).length&&(s=null),o=t.find(".ug-lightbox-button-close"),h.lightbox_show_numbers&&(a=t.find(".ug-lightbox-numbers")),n=t.children(".ug-lightbox-arrow-left"),r=t.children(".ug-lightbox-arrow-right"),c&&(s?c.appendHTML(s):c.appendHTML(t))},this.run=function(){!function(){if(null!==h.lightbox_overlay_color&&i.css("background-color",h.lightbox_overlay_color),null!==h.lightbox_overlay_opacity&&i.fadeTo(0,h.lightbox_overlay_opacity),s&&null!==h.lightbox_top_panel_opacity&&s.children(".ug-lightbox-top-panel-overlay").fadeTo(0,h.lightbox_top_panel_opacity),a){var e={};null!==h.lightbox_numbers_size&&(e["font-size"]=h.lightbox_numbers_size+"px"),h.lightbox_numbers_color&&(e.color=h.lightbox_numbers_color),null!==h.lightbox_numbers_padding_right&&(e["padding-right"]=h.lightbox_numbers_padding_right+"px"),null!==h.lightbox_numbers_padding_top&&(e["padding-top"]=h.lightbox_numbers_padding_top+"px"),a.css(e)}}(),_&&_.run(),function(){if(i.on("touchstart",function(e){e.preventDefault()}),i.on("touchend",function(e){l.close("overlay")}),g.addClassOnHover(r,"ug-arrow-hover"),g.addClassOnHover(n,"ug-arrow-hover"),g.addClassOnHover(o),d.setNextButton(r),d.setPrevButton(n),o.click(function(){l.close("button")}),e.on(d.events.ITEM_CHANGE,W),_){jQuery(_).on(_.events.TRANSITION_END,Q),jQuery(_).on(_.events.CLICK,F);var a=_.getVideoObject();jQuery(a).on(a.events.PLAY_START,Y),jQuery(a).on(a.events.PLAY_STOP,U),jQuery(_).on(_.events.START_DRAG,k),jQuery(_).on(_.events.TRANSITION_START,k),jQuery(_).on(_.events.AFTER_DRAG_CHANGE,G),jQuery(_).on(_.events.AFTER_RETURN,G),jQuery(_).on(_.events.AFTER_PUT_IMAGE,D),jQuery(_).on(_.events.ZOOM_CHANGE,R),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z)}jQuery(window).resize(function(){if(0==p.isOpened)return!0;g.whenContiniousEventOver("lightbox_resize",B,100)}),e.on(d.events.GALLERY_KEYPRESS,V),1==p.isArrowsOnHoverMode&&jQuery(document).bind("mousemove",q),t.on("mousewheel",K)}()}}function UGCarousel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGTileDesign,u=new UGThumbsGeneral,d={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1};this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"};var _={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!1,startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};function g(e,t){if(!t)t=_.initTileHeight/_.initTileWidth*e;_.tileWidth=e;var i={tile_width:e,tile_height:t};l.setOptions(i),d.tile_width=e,d.tile_height=t,l.resizeAllTiles(e),I(!0)}function c(){if(null===_.carouselMaxWidth)throw new Error("The carousel width not set");if(_.tileWidth<_.initTileWidth){(a=_.carouselMaxWidth-2*d.carousel_padding)>_.initTileWidth&&(a=_.initTileWidth),g(a);var o=s.getNumItemsInSpace(_.carouselMaxWidth,a,d.carousel_space_between_tiles)}else{var a;if((o=s.getNumItemsInSpace(_.carouselMaxWidth,_.tileWidth,d.carousel_space_between_tiles))<=0)o=1,g(a=_.carouselMaxWidth-2*d.carousel_padding)}var u=s.getSpaceByNumItems(o,_.tileWidth,d.carousel_space_between_tiles);u+=2*d.carousel_padding,i.width(u),1==_.isFirstTimeRun?(l.initEvents(),i.bind("mousedown touchstart",C),jQuery("body").bind("mousemove touchmove",A),jQuery(window).add("body").bind("mouseup touchend",M),i.hover(O,z),l.run(),jQuery.each(t,function(t,i){i.objThumbWrapper.data("index",t),e.trigger(_.eventSizeChange,[i.objThumbWrapper,!0]),i.objTileOriginal=i.objThumbWrapper.clone(!0,!0)}),I(!0),1==d.carousel_autoplay&&r.startAutoplay()):(1==d.carousel_autoplay&&r.pauseAutoplay(),S(0,!1),1==d.carousel_autoplay&&r.startAutoplay()),s.placeElement(n,0,d.carousel_padding),x(),_.isFirstTimeRun=!1}function h(){return s.getElementSize(n).left}function p(e){return s.getMousePosition(e).pageX}function m(){return n.children(".ug-thumb-wrapper")}function f(e){return s.getNumItemsInSpace(e,_.tileWidth,d.carousel_space_between_tiles)}function b(){return m().length}function v(e){w(e);var t=m();return jQuery(t[e])}function y(){return f(s.getElementSize(i).width)}function I(e){if(!e)e=!1;var t,r=m(),o=0,a=0;return jQuery.each(r,function(e,i){i=jQuery(i),s.placeElement(i,o,0);var n=s.getElementSize(i);o+=n.width+d.carousel_space_between_tiles,a=Math.max(a,n.height),e==r.length-1&&(t=n.right)}),n.width(t),a+=2*d.carousel_padding,!0===e&&(n.height(a),i.height(a)),S(_.numCurrent,!1),t}function w(e){if(e>m().length-1)throw new Error("Wrogn tile number: "+e)}function E(t,i){if("left"==i)var r=n.children(".ug-thumb-wrapper").first();else r=n.children(".ug-thumb-wrapper").last();var o=function(e,t,i){var n=e.data("index");if(null==n)throw new Error("every tile should have index!");for(var r=[],o=0;o<t;o++){if("prev"==i)var s=a.getPrevItem(n,!0);else s=a.getNextItem(n,!0);if(!s)throw new Error("the item to add is empty");var l=s.objTileOriginal.clone(!0,!0);n=s.index,l.addClass("cloned"),r.push(l)}return r}(r,t,"left"==i?"prev":"next");jQuery.each(o,function(t,r){"left"==i?n.prepend(r):n.append(r),e.trigger(_.eventSizeChange,r),l.loadTileImage(r)})}function T(e,t){w(n);for(var i=m(),n=i.length,r=0;r<e;r++)"left"==t?jQuery(i[r]).remove():jQuery(i[n-1-r]).remove()}function S(e,t,i){if(void 0===t){t=!0;if(n.is(":animated"))return!0}var r=v(e),o={left:-s.getElementSize(r).left+d.carousel_padding+"px"};if(!0===t){var a=d.carousel_scroll_duration,l=d.carousel_scroll_easing;!0===i&&(a=_.scrollShortDuration,l=_.scrollShortEasing),n.stop(!0).animate(o,{duration:a,easing:l,queue:!1,complete:function(){_.numCurrent=e,x()}})}else _.numCurrent=e,n.css(o)}function P(){var e,t,i,n;S((e=-h(),t=f(e),i=s.getElementSize(v(t)).left,n=s.getElementSize(v(t+1)).left,Math.abs(i-e)<Math.abs(n-e)?t:t+1),!0,!0)}function x(){var e,t=(e=-h(),_.sideSpace-e),r=function(){var e=s.getElementSize(i),t=s.getElementSize(n),r=t.width-e.width+t.left;return _.sideSpace-r}(),o=0,a=0,l=0,u=0,d=b();if(t>_.spaceActionSize)E(o=f(t),"left"),_.numCurrent+=o;else if(t<-_.spaceActionSize){T(l=f(Math.abs(t)),"left"),_.numCurrent-=l}if(r>_.spaceActionSize?E(a=f(r),"right"):r<-_.spaceActionSize&&T(u=f(Math.abs(r)),"right"),u>d)throw new Error("Can't remove more then num tiles");var g=!1;return(o||a||l||u)&&(I(),g=!0),g}function j(){"left"==d.carousel_autoplay_direction?r.scrollRight(1):r.scrollLeft(1)}function C(e){if(1==_.touchActive)return!0;_.touchActive=!0,r.pauseAutoplay(),_.startTime=jQuery.now(),_.startMousePos=p(e),_.startInnerPos=h(),_.lastTime=_.startTime,_.lastMousePos=_.startMousePos,s.storeEventData(e,_.storedEventID)}function A(e){if(0==_.touchActive)return!0;s.updateStoredEventData(e,_.storedEventID),e.preventDefault();var t=null;if(1==d.carousel_vertical_scroll_ondrag&&(t=s.handleScrollTop(_.storedEventID)),"vert"===t)return!0;_.lastMousePos=p(e);var i,r=_.lastMousePos-_.startMousePos,o=_.startInnerPos+r,a=r>0?"prev":"next";o>0&&"prev"==a&&(o/=3),o<-s.getElementSize(n).width&&"next"==a&&(o=_.startInnerPos+r/3),i={left:o+"px"},n.css(i)}function M(e){if(0==_.touchActive)return!0;_.touchActive=!1,P(),r.unpauseAutoplay()}function O(e){if(0==d.carousel_autoplay_pause_onhover)return!0;1==_.isPlayMode&&0==_.isPaused&&r.pauseAutoplay()}function z(e){if(0==d.carousel_autoplay_pause_onhover)return!0;r.unpauseAutoplay()}function L(){var e=_.lastTime-_.startTime,t=Math.abs(_.lastMousePos-_.startMousePos);return!(e>300)&&!(t>30)}this.startAutoplay=function(){_.isPlayMode=!0,_.isPaused=!1,o.trigger(r.events.START_PLAY),_.handle&&clearInterval(_.handle),_.handle=setInterval(j,d.carousel_autoplay_timeout)},this.unpauseAutoplay=function(){return 0==_.isPlayMode||(0==_.isPaused||void r.startAutoplay())},this.pauseAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!0,_.handle&&clearInterval(_.handle),o.trigger(r.events.PAUSE_PLAY)},this.stopAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!1,_.isPlayMode=!1,_.handle&&clearInterval(_.handle),o.trigger(r.events.STOP_PLAY)},this.destroy=function(){_.handle&&clearInterval(_.handle),o.off(r.events.START_PLAY),o.off(r.events.STOP_PLAY),i.unbind("mousedown"),i.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),i.off("mouseenter").off("mouseleave"),l.destroy()},this.init=function(i,n,r){r&&this.setMaxWidth(r),function(i,n){g_objects=i.getObjects(),a=i,jQuery(i),e=g_objects.g_objWrapper,t=g_objects.g_arrItems,d=jQuery.extend(d,n),l.setFixedMode(),l.setApproveClickFunction(L),l.init(i,d),u=l.getObjThumbs(),d=l.getOptions(),_.initTileWidth=d.tile_width,_.initTileHeight=d.tile_height,_.tileWidth=d.tile_width}(i,n)},this.setMaxWidth=function(e){_.carouselMaxWidth=e},this.setHtml=function(t){!function(t){t||(t=e);e.append("<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'></div></div>"),i=e.children(".ug-carousel-wrapper"),n=i.children(".ug-carousel-inner"),l.setHtml(n),u.getThumbs().fadeTo(0,1)}(t)},this.getElement=function(){return i},this.getObjTileDesign=function(){return l},this.getEstimatedHeight=function(){return d.tile_height+2*d.carousel_padding},this.run=function(){c()},this.scrollRight=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=_.numCurrent-e;i<=0&&(i=0),S(i)},this.scrollLeft=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=b(),n=_.numCurrent+e;n>=i&&(n=i-1),S(n)},this.setScrollLeftButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollLeft)},this.setScrollRightButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollRight)},this.setPlayPauseButton=function(e){s.setButtonMobileReady(e),1==_.isPlayMode&&0==_.isPaused&&e.addClass("ug-pause-icon"),o.on(r.events.START_PLAY,function(){e.addClass("ug-pause-icon")}),o.on(r.events.STOP_PLAY,function(){e.removeClass("ug-pause-icon")}),s.setButtonOnClick(e,function(){0==_.isPlayMode||1==_.isPaused?r.startAutoplay():r.stopAutoplay()})}}function UGLoadMore(){jQuery(this);var e,t,i,n,r=new UniteGalleryMain,o=(new UGFunctions,{isInited:!1}),a={loadmore_container:"ug_loadmore_wrapper"};function s(){e.show()}function l(){t.hide(),i.show();var o={numitems:r.getNumItems()};r.ajaxRequest("front_loadmore",o,function(n){i.hide();var o=n.html_items;1==n.show_loadmore?(t.blur().show(),i.hide()):e.hide(),r.addItems(o)},function(e){e="Ajax Error!"+e,i.hide(),n.show(),n.html(e)})}this.events={},this.destroy=function(){if(0==o.isInited)return!1},this.init=function(u,d){if(r=u,jQuery(r),a=jQuery.extend(a,d),0!=(e=jQuery("#"+a.loadmore_container)).length&&0!=(t=e.find(".ug-loadmore-button")).length&&0!=(i=e.find(".ug-loadmore-loader")).length&&0!=(n=e.find(".ug-loadmore-error")).length&&(o.isInited=!0),0==o.isInited)return trace("load more not inited, something is wrong"),!1;r.onEvent("tiles_first_placed",s),t.click(l)}}function UGTabs(){jQuery(this);var e,t,i=new UniteGalleryMain,n=(new UGFunctions,{tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"});function r(){"select"==n.tabs_type?t.change(s):e.click(a)}function o(e){i.requestNewItems(e)}function a(){var t=n.tabs_class_selected,i=jQuery(this);if(i.hasClass(t))return!0;e.not(i).removeClass(t),i.addClass(t);var r=i.data("catid");if(!r)return!0;o(r)}function s(){var e=jQuery(this).val();if(!e)return!0;o(e)}this.events={},this.destroy=function(){t&&t.off("change"),e&&e.off("click")},this.init=function(r,o){!function(r,o){i=r,jQuery(i),"select"==(n=jQuery.extend(n,o)).tabs_type?t=jQuery(n.tabs_container):e=jQuery(n.tabs_container+" .ug-tab")}(r,o)},this.run=function(){r()}}function UG_API(e){var t,i=this,n=(jQuery(i),new UniteGalleryMain),r=[];function o(e){var t={index:e.index,title:e.title,description:e.description,urlImage:e.urlImage,urlThumb:e.urlThumb},i=e.objThumbImage.data();for(var n in i){switch(n){case"image":case"description":continue}t[n]=i[n]}return t}n=e,t=jQuery(e),this.events={API_INIT_FUNCTIONS:"api_init",API_ON_EVENT:"api_on_event"},this.on=function(e,a,s){switch(!0!==s&&r.push({event:e,func:a}),e){case"item_change":t.on(n.events.ITEM_CHANGE,function(){var e=o(n.getSelectedItem());a(e.index,e)});break;case"resize":t.on(n.events.SIZE_CHANGE,a);break;case"enter_fullscreen":t.on(n.events.ENTER_FULLSCREEN,a);break;case"exit_fullscreen":t.on(n.events.EXIT_FULLSCREEN,a);break;case"play":t.on(n.events.START_PLAY,a);break;case"stop":t.on(n.events.STOP_PLAY,a);break;case"pause":t.on(n.events.PAUSE_PLAYING,a);break;case"continue":t.on(n.events.CONTINUE_PLAYING,a);break;case"open_lightbox":t.on(n.events.OPEN_LIGHTBOX,a);break;case"close_lightbox":t.on(n.events.CLOSE_LIGHTBOX,a);break;default:console&&console.log("wrong api event: "+e)}t.trigger(i.events.API_ON_EVENT,[e,a])},this.play=function(){n.startPlayMode()},this.stop=function(){n.stopPlayMode()},this.togglePlay=function(){n.togglePlayMode()},this.enterFullscreen=function(){n.toFullScreen()},this.exitFullscreen=function(){n.exitFullScreen()},this.toggleFullscreen=function(){n.toggleFullscreen()},this.resetZoom=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomBack()},this.zoomIn=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomIn()},this.zoomOut=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomOut()},this.nextItem=function(){n.nextItem()},this.prevItem=function(){n.prevItem()},this.selectItem=function(e){n.selectItem(e)},this.resize=function(e,t){t?n.resize(e,t):n.resize(e)},this.getItem=function(e){return o(n.getItem(e))},this.getNumItems=function(){return n.getNumItems()},this.reloadGallery=function(e){if(!e)e={};n.run(null,e),r.map(function(e){i.on(e.event,e.func,!0)})},this.destroy=function(){n.destroy()},t.trigger(i.events.API_INIT_FUNCTIONS,i)}jQuery.fn.unitegallery=function(e){var t="#"+jQuery(this).attr("id");if(!e)e={};var i=new UniteGalleryMain;return i.run(t,e),void 0===window.ugArrGalleriesObjects&&(window.ugArrGalleriesObjects=[]),window.ugArrGalleriesObjects.push(i),new UG_API(i)};
1
+ //Unite Gallery, Version: 1.7.56, released 23 February 2022
2
 
3
+ function debugLine(e,t,i){!0===e&&(e="true"),!1===e&&(e="false");var n=e;if("object"==typeof e)for(name in n="",e){var r=e[name];n+=" "+name+": "+r}if(1!=t||i||(n+=" "+Math.random()),1==i){var o=jQuery("#debug_line");o.width(200),o.height()>=500&&o.html(""),n=o.html()+"<br> -------------- <br>"+n}jQuery("#debug_line").show().html(n)}function debugSide(e){var t="";for(name in e){var i=e[name];t+=name+" : "+i+"<br>"}jQuery("#debug_side").show().html(t)}function trace(e){"undefined"!=typeof console&&console.log(e)}function UGFunctions(){var e=null,t=this,i={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};function n(e,t,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent?t.attachEvent("on"+e,i):t[e]=i}this.debugVar="",this.getvalopt={FORCE_BOOLEAN:"force_boolean",FORCE_NUMERIC:"force_numeric",TRIM:"trim"},this.z__________GENERAL___________=function(){},this.getVal=function(e,i,n,r){if(!n)n="";var o="";switch(o=e&&"object"==typeof e?0==e.hasOwnProperty(i)?n:e[i]:n,r){case t.getvalopt.FORCE_BOOLEAN:o=t.strToBool(o);break;case t.getvalopt.TRIM:o=String(o),o=jQuery.trim(o);break;case t.getvalopt.FORCE_NUMERIC:"string"==typeof(o=jQuery.trim(o))&&(o.replace("px",""),o=Number(o))}return o},this.z__________FULL_SCREEN___________=function(){},this.toFullscreen=function(e,t){if(e.requestFullscreen)e.requestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},this.exitFullscreen=function(){if(0==t.isFullScreen())return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},this.addFullScreenChangeEvent=function(e){document.webkitCancelFullScreen?n("webkitfullscreenchange",document,e):document.msExitFullscreen?n("MSFullscreenChange",document,e):document.mozCancelFullScreen?n("mozfullscreenchange",document,e):n("fullscreenchange",document,e)},this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange"),jQuery(document).unbind("mozfullscreenchange"),jQuery(document).unbind("webkitfullscreenchange"),jQuery(document).unbind("MSFullscreenChange")},this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},this.isFullScreen=function(){var e=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;return e=!!e},this.z__________GET_PROPS___________=function(){},this.getBrowserPrefix=function(){if(null!==e)return e;var t=["webkit","Moz","ms","O"],i=document.createElement("div");for(var n in t){var r=t[n];if(r+"Transform"in i.style)return r=r.toLowerCase(),e=r,r}return e="",""},this.getImageInsideParentDataByImage=function(e,i,n){var r=e.parent(),o=t.getImageOriginalSize(e);return t.getImageInsideParentData(r,o.width,o.height,i,n)},this.getImageInsideParentData=function(e,t,i,n,r,o,a){if(!r)r={};var s={};if(void 0===o)o=e.width();if(void 0===a)a=e.height();r.padding_left&&(o-=r.padding_left),r.padding_right&&(o-=r.padding_right),r.padding_top&&(a-=r.padding_top),r.padding_bottom&&(a-=r.padding_bottom);var l=null,u="100%",d=null,_=null,g="display:block;margin:0px auto;";if(t>0&&i>0){if("down"==n&&t<o&&i<a)_=(o-(l=t))/2,d=(a-(u=i))/2;else if("fill"==n){(l=(u=a)*(c=t/i))<o?(u=(l=o)/c,_=0,d=Math.round((u-a)/2*-1)):(d=0,_=Math.round((l-o)/2*-1))}else{var c;d=0,_=(o-(l=(u=a)*(c=t/i)))/2,"fitvert"!=n&&l>o&&(_=0,d=(a-(u=(l=o)/c))/2)}l=Math.floor(l),u=Math.floor(u),d=Math.floor(d),_=Math.floor(_),g="position:absolute;"}return r.padding_top&&(d+=r.padding_top),r.padding_left&&(_+=r.padding_left),s.imageWidth=l,s.imageHeight=u,s.imageTop=d,s.imageLeft=_,s.imageRight=_+l,s.imageBottom=0==d||"100%"==u?null:d+u,s.style=g,s},this.getElementCenterPosition=function(e,i){var n=e.parent(),r=t.getElementSize(e),o=t.getElementSize(n),a=o.width,s=o.height;i&&void 0!==i.padding_top&&(s-=i.padding_top),i&&void 0!==i.padding_bottom&&(s-=i.padding_bottom),i&&void 0!==i.padding_left&&(a-=i.padding_left),i&&void 0!==i.padding_right&&(a-=i.padding_right);var l={};return l.left=Math.round((a-r.width)/2),l.top=Math.round((s-r.height)/2),i&&void 0!==i.padding_top&&(l.top+=i.padding_top),i&&void 0!==i.padding_left&&(l.left+=i.padding_left),l},this.getElementCenterPoint=function(e,i){if(!i)i=!1;var n=t.getElementSize(e),r={};return r.x=n.width/2,r.y=n.height/2,1==i&&(r.x+=n.left,r.y+=n.top),r.x=Math.round(r.x),r.y=Math.round(r.y),r},this.getMousePosition=function(e,t){var i={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};if(e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(i.pageX=e.originalEvent.touches[0].pageX,i.pageY=e.originalEvent.touches[0].pageY,i.clientX=e.originalEvent.touches[0].clientX,i.clientY=e.originalEvent.touches[0].clientY),t){var n=t.offset();i.mouseX=i.pageX-n.left,i.mouseY=i.pageY-n.top}return i},this.getMouseElementPoint=function(e,i){var n={x:e.pageX,y:e.pageY};return t.getElementLocalPoint(n,i)},this.getElementLocalPoint=function(e,t){var i={},n=t.offset();return i.x=Math.round(e.x-n.left),i.y=Math.round(e.y-n.top),i},this.getImageOriginalSize=function(e,t,i){if(void 0!==t&&void 0!==i)return{width:t,height:i};var n=e[0];if(void 0===n)throw new Error("getImageOriginalSize error - Image not found");var r={};if(void 0===n.naturalWidth){if("number"==typeof e.data("naturalWidth"))return(r={}).width=e.data("naturalWidth"),r.height=e.data("naturalHeight"),r;var o=new Image;return o.src=n.src,o.complete?(r.width=o.width,r.height=o.height,e.data("naturalWidth",r.width),e.data("naturalHeight",r.height),r):{width:0,height:0}}return r.width=n.naturalWidth,r.height=n.naturalHeight,r},this.getimageRatio=function(e){var i=t.getImageOriginalSize(e);return t.getElementSize(e).width/i.width},this.isImageFitParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width<=r.width&&n.height<=r.height},this.getElementSize=function(e){if(void 0===e)throw new Error("Can't get size, empty element");var t=e.position();return t.height=e.outerHeight(),t.width=e.outerWidth(),t.left=Math.round(t.left),t.top=Math.round(t.top),t.right=t.left+t.width,t.bottom=t.top+t.height,t},this.isElementBiggerThenParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width>r.width||n.height>r.height},this.isPointInsideElement=function(e,t){return 0!=(e.x>=0&&e.x<t.width)&&0!=(e.y>=0&&e.y<t.height)},this.getElementRelativePos=function(e,i,n,r){if(!r)r=e.parent();if("number"==typeof e)var o={width:e,height:e};else o=t.getElementSize(e);var a=t.getElementSize(r);switch(i){case"top":case"left":i=0,n&&(i+=n);break;case"center":i=Math.round((a.width-o.width)/2),n&&(i+=n);break;case"right":i=a.width-o.width,n&&(i-=n);break;case"middle":i=Math.round((a.height-o.height)/2),n&&(i+=n);break;case"bottom":i=a.height-o.height,n&&(i-=n)}return i},this.getScreenVisibleSize=function(){document.body.clientWidth,document.body.clientHeight,jQuery(document).scrollTop();var e=jQuery(document),t=e.scrollLeft(),i=e.scrollTop();t=Math.round(t);var n=(i=Math.round(i))+window.innerHeight,r=t+window.innerWidth;return{top:i,left:t,height:n-i,width:r-t,right:r,bottom:n}},this.isElementsIntersect=function(e,t){return!(e.right<t.left)&&(!(e.left>t.right)&&(!(e.bottom<t.top)&&!(e.top>t.bottom)))},this.isElementInsideScreen=function(e){var i=t.getElementSize(e),n=t.getScreenVisibleSize();return t.isElementsIntersect(n,i)},this.z_________SET_ELEMENT_PROPS_______=function(){},this.zoomImageInsideParent=function(e,i,n,r,o,a,s){if(!n)n=1.2;if(!o)o="fit";var l,u,d,_,g=n,c=e.parent(),h=t.getElementSize(e),p=t.getImageOriginalSize(e),m=!1,f=0,b=0,v=0,y=0;if(r){var I=t.getMouseElementPoint(r,e);m=t.isPointInsideElement(I,h),v=I.x,y=I.y}else m=!1;if(0==m){var w=t.getElementCenterPoint(e);v=w.x,y=w.y}if(1==i)l=h.height*g,u=h.width*g,0!=v&&(f=-(v*g-v)),0!=y&&(b=-(y*g-y));else{if(l=h.height/g,(u=h.width/g)<t.getImageInsideParentData(c,p.width,p.height,o,s).imageWidth)return t.scaleImageFitParent(e,p.width,p.height,o,s),!0;1==m&&(0!=v&&(f=-(v/g-v)),0!=y&&(b=-(y/g-y)))}if(a){var E=1;if(0!=p.width&&(E=u/p.width),E>a)return!1}if(t.setElementSize(e,u,l),0==i&&0==m){var T=t.getElementCenterPosition(e);d=T.left,_=T.top}else d=h.left+f,_=h.top+b;return t.placeElement(e,d,_),!0},this.placeElement=function(e,i,n,r,o,a){if(0==jQuery.isNumeric(i)||0==jQuery.isNumeric(n)){if(!a)a=e.parent();var s=t.getElementSize(e),l=t.getElementSize(a)}if(0==jQuery.isNumeric(i))switch(i){case"left":i=0,r&&(i+=r);break;case"center":i=Math.round((l.width-s.width)/2),r&&(i+=r);break;case"right":i=l.width-s.width,r&&(i-=r)}if(0==jQuery.isNumeric(n))switch(n){case"top":n=0,o&&(n+=o);break;case"middle":case"center":n=Math.round((l.height-s.height)/2),o&&(n+=o);break;case"bottom":n=l.height-s.height,o&&(n-=o)}var u={position:"absolute",margin:"0px"};null!==i&&(u.left=i),null!==n&&(u.top=n),e.css(u)},this.placeElementInParentCenter=function(e){t.placeElement(e,"center","middle")},this.setElementSizeAndPosition=function(e,t,i,n,r){var o={width:n+"px",height:r+"px",left:t+"px",top:i+"px",position:"absolute",margin:"0px"};e.css(o)},this.setElementSize=function(e,t,i){var n={width:t+"px"};null!=i&&(n.height=i+"px"),e.css(n)},this.cloneElementSizeAndPos=function(e,i,n,r,o){var a=e.position();if(null==a)throw new Error("Can't get size, empty element");!0===n?(a.height=e.outerHeight(),a.width=e.outerWidth()):(a.height=e.height(),a.width=e.width()),a.left=Math.round(a.left),a.top=Math.round(a.top),r&&(a.left+=r),o&&(a.top+=o),t.setElementSizeAndPosition(i,a.left,a.top,a.width,a.height)},this.placeImageInsideParent=function(e,i,n,r,o,a){var s=t.getImageInsideParentData(i,n,r,o,a),l="<img";return null!==s.imageWidth&&(l+=" width = '"+s.imageWidth+"'",s.style+="width:"+s.imageWidth+";"),null!=s.imageHeight&&("100%"==s.imageHeight?(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+";"):(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+"px;")),null!==s.imageTop&&(s.style+="top:"+s.imageTop+"px;"),null!==s.imageLeft&&(s.style+="left:"+s.imageLeft+"px;"),e=t.escapeDoubleSlash(e),l+=" style='"+s.style+"'",l+=' src="'+e+'"',l+=">",i.html(l),i.children("img")},this.scaleImageCoverParent=function(e,i,n){if("number"==typeof i)var r=i,o=n;else r=i.outerWidth(),o=i.outerHeight();var a=t.getImageOriginalSize(e),s=a.width/a.height,l=o,u=l*s,d=0,_=0;u<r?(l=(u=r)/s,_=0,d=Math.round((l-o)/2*-1)):(d=0,_=Math.round((u-r)/2*-1)),u=Math.round(u),l=Math.round(l),e.css({width:u+"px",height:l+"px",left:_+"px",top:d+"px"})},this.scaleImageFitParent=function(e,i,n,r,o){var a=e.parent(),s=t.getImageInsideParentData(a,i,n,r,o),l=!1,u={};return null!==s.imageWidth&&(l=!0,e.removeAttr("width"),u.width=s.imageWidth+"px"),null!=s.imageHeight&&(l=!0,e.removeAttr("height"),u.height=s.imageHeight+"px"),null!==s.imageTop&&(l=!0,u.top=s.imageTop+"px"),null!==s.imageLeft&&(l=!0,u.left=s.imageLeft+"px"),1==l&&(u.position="absolute",u.margin="0px 0px",e.css(u)),s},this.scaleImageByHeight=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i*a);i=Math.round(i),t.setElementSize(e,s,i)},this.scaleImageByWidth=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i/a);i=Math.round(i),t.setElementSize(e,i,s)},this.scaleImageExactSizeInParent=function(e,i,n,r,o,a){var s=e.parent(),l=t.getElementSize(s);l.width<r&&(r=l.width),l.height<o&&(o=l.height);var u,d=t.getImageInsideParentData(null,i,n,a,null,r,o),_=r,g=o,c=d.imageLeft,h=d.imageLeft,p=d.imageTop,m=d.imageTop,f=Math.round((l.width-r)/2),b=Math.round((l.height-o)/2);0!=(u=r-(d.imageWidth+c+h))&&(h+=u),0!=(u=o-(d.imageHeight+p+m))&&(m+=u),e.removeAttr("width"),e.removeAttr("height");var v={position:"absolute",margin:"0px 0px"};v.width=_+"px",v.height=g+"px",v.left=f+"px",v.top=b+"px",v["padding-left"]=c+"px",v["padding-top"]=p+"px",v["padding-right"]=h+"px",v["padding-bottom"]=m+"px",e.css(v);var y={};return y.imageWidth=_,y.imageHeight=g,y},this.showElement=function(e,t,i){e.show().fadeTo(0,1),t&&t.show().fadeTo(0,1),i&&i.show().fadeTo(0,1)},this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){},this.disableButton=function(e,i){if(!i)i="ug-button-disabled";0==t.isButtonDisabled(e,i)&&e.addClass(i)},this.convertCustomPrefixOptions=function(e,t,i){if(!t)return e;var n={};return jQuery.each(e,function(e,r){if(0===e.indexOf(t+"_"+i+"_")){var o=e.replace(t+"_"+i+"_",i+"_");n[o]=r}else n[e]=r}),n},this.enableButton=function(e,i){if(!i)i="ug-button-disabled";1==t.isButtonDisabled(e,i)&&e.removeClass(i)},this.isButtonDisabled=function(e,t){if(!t)t="ug-button-disabled";return!!e.hasClass(t)},this.z_________MATH_FUNCTIONS_______=function(){},this.normalizeSetting=function(e,t,i,n,r,o){if(!o)o=!1;return r=e+(t-e)*((r-i)/(n-i)),1==o&&(r<e&&(r=e),r>t&&(r=t)),r},this.getNormalizedValue=function(e,t,i,n,r){return r=e+(n-i)*((r-e)/(t-e))},this.getDistance=function(e,t,i,n){return Math.round(Math.sqrt(Math.abs((i-e)*(i-e)+(n-t)*(n-t))))},this.getMiddlePoint=function(e,t,i,n){var r={};return r.x=e+Math.round((i-e)/2),r.y=t+Math.round((n-t)/2),r},this.getNumItemsInSpace=function(e,t,i){return Math.floor((e+i)/(t+i))},this.getNumItemsInSpaceRound=function(e,t,i){return Math.round((e+i)/(t+i))},this.getSpaceByNumItems=function(e,t,i){return e*t+(e-1)*i},this.getItemSizeInSpace=function(e,t,i){return Math.floor((e-(t-1)*i)/t)},this.getColX=function(e,t,i){return e*(t+i)},this.getColByIndex=function(e,t){return t%e},this.getColRowByIndex=function(e,t){var i=Math.floor(e/t);return{col:Math.floor(e%t),row:i}},this.getIndexByRowCol=function(e,t,i){return e<0?-1:t<0?-1:e*i+t},this.getPrevRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row-1,n.col,i)},this.getNextRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row+1,n.col,i)},this.z_________DATA_FUNCTIONS_______=function(){},this.setGlobalData=function(e,t){jQuery.data(document.body,e,t)},this.getGlobalData=function(e){return jQuery.data(document.body,e)},this.z_________EVENT_DATA_FUNCTIONS_______=function(){},this.handleScrollTop=function(e){if(0==t.isTouchDevice())return null;var n=t.getStoredEventData(e);if(null===n.scrollDir&&(Math.abs(n.diffMouseX)>15?n.scrollDir="hor":Math.abs(n.diffMouseY)>15&&Math.abs(n.diffMouseY)>Math.abs(n.diffMouseX)&&(n.scrollDir="vert",n.scrollStartY=n.lastMouseClientY,n.scrollOrigin=jQuery(document).scrollTop(),i.dataCache[e].scrollStartY=n.lastMouseClientY,i.dataCache[e].scrollOrigin=n.scrollOrigin),i.dataCache[e].scrollDir=n.scrollDir),"vert"!==n.scrollDir)return n.scrollDir;jQuery(document).scrollTop();var r=n.scrollOrigin-(n.lastMouseClientY-n.scrollStartY);return r>=0&&jQuery(document).scrollTop(r),n.scrollDir},this.wasVerticalScroll=function(e){return"vert"===t.getStoredEventData(e).scrollDir},this.storeEventData=function(e,n,r){var o=t.getMousePosition(e),a=jQuery.now(),s={startTime:a,lastTime:a,startMouseX:o.pageX,startMouseY:o.pageY,lastMouseX:o.pageX,lastMouseY:o.pageY,startMouseClientY:o.clientY,lastMouseClientY:o.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};r&&(s=jQuery.extend(s,r)),i.dataCache[n]=s},this.updateStoredEventData=function(e,n,r){if(!i.dataCache[n])throw new Error("updateEventData error: must have stored cache object");var o=i.dataCache[n],a=t.getMousePosition(e);o.lastTime=jQuery.now(),void 0!==a.pageX&&(o.lastMouseX=a.pageX,o.lastMouseY=a.pageY,o.lastMouseClientY=a.clientY),r&&(o=jQuery.extend(o,r)),i.dataCache[n]=o},this.getStoredEventData=function(e,t){if(!i.dataCache[e])throw new Error("updateEventData error: must have stored cache object");var n=i.dataCache[e];return n.diffMouseX=n.lastMouseX-n.startMouseX,n.diffMouseY=n.lastMouseY-n.startMouseY,n.diffMouseClientY=n.lastMouseClientY-n.startMouseClientY,n.diffTime=n.lastTime-n.startTime,!0===t?(n.startMousePos=n.lastMouseY,n.lastMousePos=n.lastMouseY,n.diffMousePos=n.diffMouseY):(n.startMousePos=n.lastMouseX,n.lastMousePos=n.lastMouseX,n.diffMousePos=n.diffMouseX),n},this.isApproveStoredEventClick=function(e,n){if(!i.dataCache[e])return!0;var r=t.getStoredEventData(e,n),o=Math.abs(r.diffMousePos);return!(r.diffTime>400)&&!(o>30)},this.clearStoredEventData=function(e){i.dataCache[e]=null},this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){},this.isCanvasExists=function(){return"function"==typeof jQuery('<canvas width="500" height="500" > </canvas>')[0].getContext},this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth},this.isTouchDevice=function(){if(-1!==i.isTouchDevice)return i.isTouchDevice;try{document.createEvent("TouchEvent"),i.isTouchDevice=!0}catch(e){i.isTouchDevice=!1}return i.isTouchDevice},this.isRgbaSupported=function(){if(-1!==i.isRgbaSupported)return i.isRgbaSupported;var e=document.getElementsByTagName("script")[0],t=e.style.color;try{e.style.color="rgba(1,5,13,0.44)"}catch(e){}var n=e.style.color!=t;return e.style.color=t,i.isRgbaSupported=n,n},this.z_________GENERAL_FUNCTIONS_______=function(){},this.checkMinJqueryVersion=function(e){for(var t=jQuery.fn.jquery.split("."),i=e.split("."),n=0,r=t.length;n<r;n++){var o=parseInt(t[n]),a=parseInt(i[n]);if(void 0===i[n])return!0;if(a>o)return!1;if(o>a)return!0}return!0},this.getCssSizeParam=function(e){return jQuery.isNumeric(e)?e+"px":e},this.convertHexToRGB=function(e,t){var i=e.replace("#","");return i===e?e:(r=parseInt(i.substring(0,2),16),g=parseInt(i.substring(2,4),16),b=parseInt(i.substring(4,6),16),result="rgba("+r+","+g+","+b+","+t+")",result)},this.timestampToString=function(e){var t=new Date(e),i=t.getDate()+"/"+t.getMonth();return i+=" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+":"+t.getMilliseconds()},this.getArrTouches=function(e){var t=[];return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(t=e.originalEvent.touches),t},this.getArrTouchPositions=function(e){for(var t=[],i=0;i<e.length;i++){var n={pageX:e[i].pageX,pageY:e[i].pageY};t.push(n)}return t},this.startTimeDebug=function(){i.starTime=jQuery.now()},this.showTimeDebug=function(){debugLine({"Time Passed":jQuery.now()-i.starTime},!0)},this.initProgressIndicator=function(e,i,n){switch("bar"!=e&&0==t.isCanvasExists()&&(e="bar"),e){case"bar":(r=new UGProgressBar).putHidden(n,i);break;default:case"pie":(r=new UGProgressPie).putHidden(n,i);break;case"pie2":var r;i.type_fill=!0,(r=new UGProgressPie).putHidden(n,i)}return r},this.setButtonMobileReady=function(e){e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover")}),e.on("mousedown touchend",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1})},this.registerTheme=function(e){i.arrThemes.push(e)},this.getArrThemes=function(){return i.arrThemes},this.isThemeRegistered=function(e){return-1!==jQuery.inArray(e,i.arrThemes)},this.getFirstRegisteredTheme=function(){return 0==i.arrThemes.length?"":i.arrThemes[0]},this.isTimePassed=function(e,t){if(!t)t=100;var n=jQuery.now();0==i.timeCache.hasOwnProperty(e)?lastTime=0:lastTime=i.timeCache[e];var r=n-lastTime;return i.timeCache[e]=n,!(r<=t)},this.whenContiniousEventOver=function(e,t,n){if(!n)n=300;1==i.timeCache.hasOwnProperty(e)&&null!=i.timeCache[e]&&(clearTimeout(i.timeCache[e]),i.timeCache[e]=null),i.timeCache[e]=setTimeout(t,n)},this.validateClickTouchstartEvent=function(e){var t=!0,n=jQuery.now()-i.lastEventTime;return"click"==e&&"touchstart"==i.lastEventType&&n<1e3&&(t=!1),i.lastEventTime=jQuery.now(),i.lastEventType=e,t},this.addClassOnHover=function(e,t){if(!t)t="ug-button-hover";e.hover(function(){jQuery(this).addClass(t)},function(){jQuery(this).removeClass(t)})},this.destroyButton=function(e){e.off("mouseenter"),e.off("mouseleave"),e.off("click"),e.off("touchstart"),e.off("touchend"),e.off("mousedown"),e.off("tap")},this.setButtonOnClick=function(e,i){t.setButtonMobileReady(e),e.on("click touchstart",function(e){if(objThis=jQuery(this),e.stopPropagation(),e.stopImmediatePropagation(),0==t.validateClickTouchstartEvent(e.type))return!0;i(objThis,e)})},this.setButtonOnTap=function(e,n){e.on("tap",n),0==t.isTouchDevice()?e.on("click",function(e){var i=jQuery(this);if(0==t.validateClickTouchstartEvent(e.type))return!0;i.trigger("tap")}):(e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover"),i.lastTouchStartElement=jQuery(this),i.lastEventTime=jQuery.now()}),e.on("touchend",function(e){var t=jQuery(this);return 0==t.is(i.lastTouchStartElement)||(!i.lastEventTime||(jQuery.now()-i.lastEventTime>i.touchThreshold||void t.trigger("tap")))}))},this.loadJs=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("script");i.src=e;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)},this.loadCss=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)},this.addEvent=function(e,t,i){void 0!==e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)},this.checkImagesLoaded=function(e,t,i){var n=0,r=e.length;if(0==r&&t)return t(),!1;function o(e,o){n++,"function"==typeof i&&setTimeout(function(){i(e,o)}),n==r&&"function"==typeof t&&setTimeout(function(){t()})}setTimeout(function(){for(var t=0;t<r;t++){var i=e[t];if(void 0!==i.naturalWidth&&0!==i.naturalWidth)o(e[t],!1);else{var n=jQuery("<img/>");n.data("index",t),n.on("load",function(){var t=jQuery(this).data("index");o(e[t],!1)}),n.on("error",function(){var t=jQuery(this).data("index");o(e[t],!0)}),n.attr("src",i.src)}}})},this.waitForWidth=function(e,t){var n=e.width();if(0!=n)return t(),!1;i.handle=setInterval(function(){0!=(n=e.width())&&(clearInterval(i.handle),t())},300)},this.arrayShuffle=function(e){if("object"!=typeof e)return e;for(var t,i,n=e.length;n;t=parseInt(Math.random()*n),i=e[--n],e[n]=e[t],e[t]=i);return e},this.getObjectLength=function(e){var t=0;for(var i in e)t++;return t},this.normalizePercent=function(e){return e<0&&(e=0),e>1&&(e=1),e},this.stripTags=function(e){return e.replace(/(<([^>]+)>)/gi,"")},this.escapeDoubleSlash=function(e){return e.replace('"','"')},this.htmlentitles=function(e){return jQuery("<div/>").text(e).html()},this.z_________END_GENERAL_FUNCTIONS_______=function(){}}!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var a=t||window.event,s=l.call(arguments,1),u=0,d=0,_=0,g=0;if((t=e.event.fix(a)).type="mousewheel","detail"in a&&(_=-1*a.detail),"wheelDelta"in a&&(_=a.wheelDelta),"wheelDeltaY"in a&&(_=a.wheelDeltaY),"wheelDeltaX"in a&&(d=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(d=-1*_,_=0),u=0===_?d:_,"deltaY"in a&&(u=_=-1*a.deltaY),"deltaX"in a&&(d=a.deltaX,0===_&&(u=-1*d)),0!==_||0!==d){if(1===a.deltaMode){var c=e.data(this,"mousewheel-line-height");u*=c,_*=c,d*=c}else if(2===a.deltaMode){var h=e.data(this,"mousewheel-page-height");u*=h,_*=h,d*=h}return g=Math.max(Math.abs(_),Math.abs(d)),(!o||o>g)&&(o=g,n(a,g)&&(o/=40)),n(a,g)&&(u/=40,d/=40,_/=40),u=Math[u>=1?"floor":"ceil"](u/o),d=Math[d>=1?"floor":"ceil"](d/o),_=Math[_>=1?"floor":"ceil"](_/o),t.deltaX=d,t.deltaY=_,t.deltaFactor=o,t.deltaMode=0,s.unshift(t,u,d,_),r&&clearTimeout(r),r=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){o=null}function n(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}var r,o,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var u=a.length;u;)e.event.fixHooks[a[--u]]=e.event.mouseHooks;var d=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",d.getLineHeight(this)),e.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=s.length;e;)this.removeEventListener(s[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof module&&"object"==typeof module.exports?exports=e(require("jquery")):e(jQuery)}(function(e){e.easing.jswing=e.easing.swing;var t=Math.pow,i=Math.sqrt,n=Math.sin,r=Math.cos,o=Math.PI,a=1.70158,s=1.525*a,l=2*o/3,u=2*o/4.5;function d(e){var t=7.5625,i=2.75;return e<1/i?t*e*e:e<2/i?t*(e-=1.5/i)*e+.75:e<2.5/i?t*(e-=2.25/i)*e+.9375:t*(e-=2.625/i)*e+.984375}e.extend(e.easing,{def:"easeOutQuad",swing:function(t){return e.easing[e.easing.def](t)},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-t(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-t(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-t(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-t(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-t(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-t(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-t(-2*e+2,5)/2},easeInSine:function(e){return 1-r(e*o/2)},easeOutSine:function(e){return n(e*o/2)},easeInOutSine:function(e){return-(r(o*e)-1)/2},easeInExpo:function(e){return 0===e?0:t(2,10*e-10)},easeOutExpo:function(e){return 1===e?1:1-t(2,-10*e)},easeInOutExpo:function(e){return 0===e?0:1===e?1:e<.5?t(2,20*e-10)/2:(2-t(2,-20*e+10))/2},easeInCirc:function(e){return 1-i(1-t(e,2))},easeOutCirc:function(e){return i(1-t(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-i(1-t(2*e,2)))/2:(i(1-t(-2*e+2,2))+1)/2},easeInElastic:function(e){return 0===e?0:1===e?1:-t(2,10*e-10)*n((10*e-10.75)*l)},easeOutElastic:function(e){return 0===e?0:1===e?1:t(2,-10*e)*n((10*e-.75)*l)+1},easeInOutElastic:function(e){return 0===e?0:1===e?1:e<.5?-t(2,20*e-10)*n((20*e-11.125)*u)/2:t(2,-20*e+10)*n((20*e-11.125)*u)/2+1},easeInBack:function(e){return 2.70158*e*e*e-a*e*e},easeOutBack:function(e){return 1+2.70158*t(e-1,3)+a*t(e-1,2)},easeInOutBack:function(e){return e<.5?t(2*e,2)*(7.189819*e-s)/2:(t(2*e-2,2)*((s+1)*(2*e-2)+s)+2)/2},easeInBounce:function(e){return 1-d(1-e)},easeOutBounce:d,easeInOutBounce:function(e){return e<.5?(1-d(1-2*e))/2:(1+d(2*e-1))/2}})}),function(e,t){if(void 0===e.cssHooks)return!1;function i(e,t,i){var n=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:n.max<e?n.max:e)}function n(t){var i=l(),n=i._rgba=[];return t=t.toLowerCase(),c(s,function(e,r){var o,a=r.re.exec(t),s=a&&r.parse(a),l=r.space||"rgba";return s?(o=i[l](s),i[u[l].cache]=o[u[l].cache],n=i._rgba=o._rgba,!1):void 0}),n.length?("0,0,0,0"===n.join()&&e.extend(n,o.transparent),i):o[t]}function r(e,t,i){return 1>6*(i=(i+1)%1)?e+(t-e)*i*6:1>2*i?t:2>3*i?e+(t-e)*(2/3-i)*6:e}var o,a=/^([\-+])=\s*(\d+\.?\d*)/,s=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,n,r){return new e.Color.fn.parse(t,i,n,r)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},_=l.support={},g=e("<p>")[0],c=e.each;g.style.cssText="background-color:rgba(1,1,1,.5)",_.rgba=g.style.backgroundColor.indexOf("rgba")>-1,c(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(r,a,s,d){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(a),a=t);var _=this,g=e.type(r),h=this._rgba=[];return a!==t&&(r=[r,a,s,d],g="array"),"string"===g?this.parse(n(r)||o._default):"array"===g?(c(u.rgba.props,function(e,t){h[t.idx]=i(r[t.idx],t)}),this):"object"===g?(c(u,r instanceof l?function(e,t){r[t.cache]&&(_[t.cache]=r[t.cache].slice())}:function(t,n){var o=n.cache;c(n.props,function(e,t){if(!_[o]&&n.to){if("alpha"===e||null==r[e])return;_[o]=n.to(_._rgba)}_[o][t.idx]=i(r[e],t,!0)}),_[o]&&e.inArray(null,_[o].slice(0,3))<0&&(_[o][3]=1,n.from&&(_._rgba=n.from(_[o])))}),this):void 0},is:function(e){var t=l(e),i=!0,n=this;return c(u,function(e,r){var o,a=t[r.cache];return a&&(o=n[r.cache]||r.to&&r.to(n._rgba)||[],c(r.props,function(e,t){return null!=a[t.idx]?i=a[t.idx]===o[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return c(u,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var n=l(e),r=n._space(),o=u[r],a=0===this.alpha()?l("transparent"):this,s=a[o.cache]||o.to(a._rgba),_=s.slice();return n=n[o.cache],c(o.props,function(e,r){var o=r.idx,a=s[o],l=n[o],u=d[r.type]||{};null!==l&&(null===a?_[o]=l:(u.mod&&(l-a>u.mod/2?a+=u.mod:a-l>u.mod/2&&(a-=u.mod)),_[o]=i((l-a)*t+a,r)))}),this[r](_)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),r=l(t)._rgba;return l(e.map(i,function(e,t){return(1-n)*r[t]+n*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),n=i.pop();return t&&i.push(~~(255*n)),"#"+e.map(i,function(e){return 1===(e=(e||0).toString(16)).length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,r=e[1]/255,o=e[2]/255,a=e[3],s=Math.max(n,r,o),l=Math.min(n,r,o),u=s-l,d=s+l,_=.5*d;return t=l===s?0:n===s?60*(r-o)/u+360:r===s?60*(o-n)/u+120:60*(n-r)/u+240,i=0===u?0:.5>=_?u/d:u/(2-d),[Math.round(t)%360,i,_,null==a?1:a]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],o=e[3],a=.5>=n?n*(1+i):n+i-n*i,s=2*n-a;return[Math.round(255*r(s,a,t+1/3)),Math.round(255*r(s,a,t)),Math.round(255*r(s,a,t-1/3)),o]},c(u,function(n,r){var o=r.props,s=r.cache,u=r.to,d=r.from;l.fn[n]=function(n){if(u&&!this[s]&&(this[s]=u(this._rgba)),n===t)return this[s].slice();var r,a=e.type(n),_="array"===a||"object"===a?n:arguments,g=this[s].slice();return c(o,function(e,t){var n=_["object"===a?e:t.idx];null==n&&(n=g[t.idx]),g[t.idx]=i(n,t)}),d?((r=l(d(g)))[s]=g,r):l(g)},c(o,function(t,i){l.fn[t]||(l.fn[t]=function(r){var o,s=e.type(r),l="alpha"===t?this._hsla?"hsla":"rgba":n,u=this[l](),d=u[i.idx];return"undefined"===s?d:("function"===s&&(r=r.call(this,d),s=e.type(r)),null==r&&i.empty?this:("string"===s&&((o=a.exec(r))&&(r=d+parseFloat(o[2])*("+"===o[1]?1:-1))),u[i.idx]=r,this[l](u)))})})}),l.hook=function(t){var i=t.split(" ");c(i,function(t,i){e.cssHooks[i]={set:function(t,r){var o,a,s="";if("transparent"!==r&&("string"!==e.type(r)||(o=n(r)))){if(r=l(o||r),!_.rgba&&1!==r._rgba[3]){for(a="backgroundColor"===i?t.parentNode:t;(""===s||"transparent"===s)&&a&&a.style;)try{s=e.css(a,"backgroundColor"),a=a.parentNode}catch(e){}r=r.blend(s&&"transparent"!==s?s:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(e){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),e.cssHooks.borderColor={expand:function(e){var t={};return c(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},o=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(e){e.mlp={x:0,y:0},e(function t(){try{var i=this===document?e(this):e(this).contents()}catch(e){return!1}i.mousemove(function(t){e.mlp={x:t.pageX,y:t.pageY}}),i.find("iframe").on("load",t)}),e.fn.ismouseover=function(){var t=!1;return this.eq(0).each(function(){var i=e(this).is("iframe")?e(this).contents().find("body"):e(this),n=i.offset();t=n.left<=e.mlp.x&&n.left+i.outerWidth()>e.mlp.x&&n.top<=e.mlp.y&&n.top+i.outerHeight()>e.mlp.y}),t}}(jQuery);var g_ugFunctions=new UGFunctions;function UGThumbsGeneral(){var e,t,i,n,r=this,o=jQuery(r),a=new UniteGalleryMain,s=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"},this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"};var l={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!1,thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},u={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},d="thumb_size_change";function _(e,t){var r=i[e],o="";0==u.customThumbs&&(o=" ug-thumb-generated");var a="<div class='ug-thumb-wrapper"+o+"' "+("style='z-index:"+(r.index+1)+";'")+"></div>";if(1==l.thumb_wrapper_as_link){var s=r.link;""==r.link&&(s="javascript:void(0)");var d="";1==l.thumb_link_newpage&&r.link&&(d=" target='_blank'");a="<a href='"+s+"'"+d+" class='ug-thumb-wrapper"+o+"'></a>"}var _=jQuery(a),g=r.objThumbImage;if(0==u.customThumbs){if(1==l.thumb_show_loader&&g){var c="ug-thumb-loader-dark";"bright"==l.thumb_loader_type&&(c="ug-thumb-loader-bright"),_.append("<div class='ug-thumb-loader "+c+"'></div>"),_.append("<div class='ug-thumb-error' style='display:none'></div>")}if(g){if(g.addClass("ug-thumb-image"),1==l.thumb_image_overlay_effect){var h=g.clone().appendTo(_);h.addClass("ug-thumb-image-overlay "+t).removeClass("ug-thumb-image"),h.fadeTo(0,0),r.objImageOverlay=h}_.append(g)}}return u.isEffectBorder&&_.append("<div class='ug-thumb-border-overlay'></div>"),u.isEffectOverlay&&_.append("<div class='ug-thumb-overlay'></div>"),n.append(_),u.customThumbs&&u.funcSetCustomThumbHtml(_,r),i[e].objThumbWrapper=_,_}function g(e,t,i,r){var o={width:e+"px",height:t+"px"},a={width:e-u.thumbInnerReduce+"px",height:t-u.thumbInnerReduce+"px"},s=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";i?(!0!==r&&i.css(o),i.find(s).css(a)):(n.children(".ug-thumb-wrapper").css(o),n.find(s).css(a))}function c(e,t,i,n){if(!n)n=!1;a.isFakeFullscreen()&&(n=!0);var r=e.children(".ug-thumb-border-overlay"),o={};o["border-width"]=t+"px",0!=t&&(o["border-color"]=i),n&&!0===n?(r.css(o),0==t?r.hide():r.show()):(0==t?r.stop().fadeOut(l.thumb_transition_duration):r.show().stop().fadeIn(l.thumb_transition_duration),function(e,t){e.stop(!0).animate(t,{duration:l.thumb_transition_duration,easing:l.thumb_transition_easing,queue:!1})}(r,o))}function h(e,t,i){var n=e.children(".ug-thumb-overlay"),r=l.thumb_transition_duration;i&&!0===i&&(r=0),t?n.stop(!0).fadeTo(r,u.colorOverlayOpacity):n.stop(!0).fadeTo(r,0)}function p(e,t,i){var n=e.children("img.ug-thumb-image"),r=e.children("img.ug-thumb-image-overlay"),o=l.thumb_transition_duration;i&&!0===i&&(o=0),t?r.stop(!0).fadeTo(o,1):(n.fadeTo(0,1),r.stop(!0).fadeTo(o,0))}function m(e,t){(u.isEffectBorder&&c(e,l.thumb_selected_border_width,l.thumb_selected_border_color,t),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!1,t),o.trigger(r.events.SETSELECTEDSTYLE,e)}function f(e){1==v(e)?m(e,!0):r.setThumbNormalStyle(e,!0,"redraw")}function b(e,t,i){if(1==l.thumb_fixed_size)s.scaleImageCoverParent(t,e);else{"height"==l.thumb_resize_by?s.scaleImageByHeight(t,l.thumb_height):s.scaleImageByWidth(t,l.thumb_width);var n=s.getElementSize(t);s.placeElement(t,0,0),g(n.width,n.height,e)}e.children(".ug-thumb-loader").hide(),t.show(),0==l.thumb_image_overlay_effect?t.fadeTo(0,1):(1==l.thumb_image_overlay_effect&&function(e){var t=e.siblings(".ug-thumb-image-overlay");if(0==t.length)return!1;var i=s.getElementSize(e),n={width:i.width+"px",height:i.height+"px",left:i.left+"px",top:i.top+"px"};t.css(n),0==u.customThumbs&&t.fadeTo(0,1)}(t),t.fadeTo(0,0),f(e)),o.trigger(r.events.AFTERPLACEIMAGE,e)}function v(e){return!!e.hasClass("ug-thumb-selected")}function y(e,t){t=jQuery(t);r.getItemByThumb(t);var i=s.getElementSize(t);g(i.width,i.height,t,!0),f(t)}function I(e,t){if(!t)t=!1;var i=jQuery(e),n=i.parents(".ug-thumb-wrapper");return 0!=n.parent().length&&(objItem=r.getItemByThumb(n),(1!=objItem.isLoaded||!1!==t)&&(r.triggerImageLoadedEvent(n,i),void(1==u.customThumbs?o.trigger(r.events.PLACEIMAGE,[n,i]):b(n,i,objItem))))}function w(e,t,i){objItem=r.getItemByThumb(t),objItem.isLoaded=!0,objItem.isThumbImageLoaded=!0;var n=s.getImageOriginalSize(i);objItem.thumbWidth=n.width,objItem.thumbHeight=n.height,objItem.thumbRatioByWidth=n.width/n.height,objItem.thumbRatioByHeight=n.height/n.width,t.addClass("ug-thumb-ratio-set")}this.init=function(n,r){e=n.getObjects(),a=n,jQuery(n),t=e.g_objWrapper,i=e.g_arrItems,l=jQuery.extend(l,r),u.isEffectBorder=l.thumb_border_effect,u.isEffectOverlay=l.thumb_color_overlay_effect,u.isEffectImage=l.thumb_image_overlay_effect},this._____________EXTERNAL_SETTERS__________=function(){},this.setHtmlThumbs=function(e,t){if(n=e,1==u.isEffectImage)var i=function(){var e="",t=l.thumb_image_overlay_type.split(",");for(var i in t){var n=t[i];switch(n){case"bw":e+=" ug-bw-effect";break;case"blur":e+=" ug-blur-effect";break;case"sepia":e+=" ug-sepia-effect"}}return e}();if(!0!==t)for(var o=a.getNumItems(),s=0;s<o;s++)_(s,i);else{r.getThumbs().removeClass(u.classNewThumb);var d=a.getNewAddedItemsIndexes();jQuery.each(d,function(e,t){_(t,i).addClass(u.classNewThumb)})}},this.setThumbNormalStyle=function(e,t,i){(1==u.customThumbs&&e.removeClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_border_width,l.thumb_border_color,t),u.isEffectOverlay)&&h(e,1!=l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!0,t),o.trigger(r.events.SETNORMALSTYLE,e)},this.setThumbOverStyle=function(e){(1==u.customThumbs&&e.addClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_over_border_width,l.thumb_over_border_color),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse);1==u.isEffectImage&&p(e,!1),o.trigger(r.events.SETOVERSTYLE,e)},this.setHtmlProperties=function(e){if(!e)e=r.getThumbs();if(0==u.customThumbs){1==l.thumb_fixed_size&&g(l.thumb_width,l.thumb_height,e),function(e){if(l.thumb_round_corners_radius<=0)return!1;var t={"border-radius":l.thumb_round_corners_radius+"px"};e?(e.css(t),e.find(".ug-thumb-border-overlay").css(t)):n.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(t)}(e)}if(e.each(function(){f(jQuery(this))}),u.isEffectOverlay&&l.thumb_overlay_color){var t={};if(s.isRgbaSupported()){var i=s.convertHexToRGB(l.thumb_overlay_color,l.thumb_overlay_opacity);t["background-color"]=i}else t["background-color"]=l.thumb_overlay_color,u.colorOverlayOpacity=l.thumb_overlay_opacity;e.find(".ug-thumb-overlay").css(t)}},this.setThumbSelected=function(e){if(1==u.customThumbs&&e.removeClass("ug-thumb-over"),1==v(e))return!0;e.addClass("ug-thumb-selected"),m(e)},this.setThumbUnselected=function(e){e.removeClass("ug-thumb-selected"),r.setThumbNormalStyle(e,!1,"set unselected")},this.setOptions=function(e){l=jQuery.extend(l,e)},this.setThumbInnerReduce=function(e){u.thumbInnerReduce=e},this.setCustomThumbs=function(e,t,i){if(u.customThumbs=!0,"function"!=typeof e)throw new Error("The argument should be function");u.funcSetCustomThumbHtml=e,-1==jQuery.inArray("overlay",t)&&(u.isEffectOverlay=!1),-1==jQuery.inArray("border",t)&&(u.isEffectBorder=!1),u.isEffectImage=!1,i&&!1===i.allow_onresize&&(u.allowOnResize=!1)},this._____________EXTERNAL_GETTERS__________=function(){},this.getOptions=function(){return l},this.getNumThumbs=function(){return i.length},this.getThumbImage=function(e){return e.find(".ug-thumb-image")},this.getThumbByIndex=function(e){var t=r.getThumbs();if(e>=t.length||e<0)throw new Error("Wrong thumb index");return jQuery(t[e])},this.getThumbs=function(e){switch(e){default:case r.type.GET_THUMBS_ALL:var t=n.children(".ug-thumb-wrapper");break;case r.type.GET_THUMBS_NO_RATIO:t=n.children(".ug-thumb-wrapper").not(".ug-thumb-ratio-set");break;case r.type.GET_THUMBS_RATIO:t=n.children(".ug-thumb-wrapper.ug-thumb-ratio-set");break;case r.type.GET_THUMBS_NEW:t=n.children("."+u.classNewThumb)}return t},this.getItemByThumb=function(e){var t=e.data("index");return void 0===t&&(t=e.index()),i[t]},this.isThumbLoaded=function(e){return r.getItemByThumb(e).isLoaded},this.getGlobalThumbSize=function(){return{width:l.thumb_width,height:l.thumb_height}},this._____________EXTERNAL_OTHERS__________=function(){},this.initEvents=function(){1==u.allowOnResize&&t.on(d,y),o.on(r.events.THUMB_IMAGE_LOADED,w),n.on("touchstart",".ug-thumb-wrapper",function(){u.touchEnabled=!0,n.off("mouseenter").off("mouseleave")}),n.on("mouseenter",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return objThumbs.off("mouseenter").off("mouseleave"),!0;0==v(e)&&r.setThumbOverStyle(e)}(jQuery(this))}),n.on("mouseleave",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return!0;0==v(e)&&r.setThumbNormalStyle(e,!1)}(jQuery(this))})},this.destroy=function(){n.off("touchstart",".ug-thumb-wrapper"),t.off(d),n.off("mouseenter",".ug-thumb-wrapper"),n.off("mouseleave",".ug-thumb-wrapper"),o.off(r.events.THUMB_IMAGE_LOADED)},this.loadThumbsImages=function(){var e=n.find(".ug-thumb-image");s.checkImagesLoaded(e,null,function(e,t){0==t?I(e,!0):function(e){var t=r.getItemByThumb(e);if(t.isLoaded=!0,t.isThumbImageLoaded=!1,1==u.customThumbs)return o.trigger(r.events.IMAGELOADERROR,e),!0;e.children(".ug-thumb-loader").hide(),e.children(".ug-thumb-error").show()}(jQuery(e).parent())})},this.triggerImageLoadedEvent=function(e,t){o.trigger(r.events.THUMB_IMAGE_LOADED,[e,t])},this.hideThumbs=function(){n.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){var e,t,n,r,o,a,s,l,u=this,d=new UniteGalleryMain,_=new UGFunctions,g=!1,c=new UGThumbsGeneral,h=(_=new UGFunctions,{strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0}),p={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},m={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0};this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};var f={strip_thumbs_align:"top",thumb_resize_by:"width"};function b(){var e=c.getOptions();p.isNotFixedThumbs=!1===e.thumb_fixed_size,g=h.strip_vertical_type}function v(){var t,i,n,r,_;c.setHtmlProperties(),t=a.children(".ug-thumb-wrapper"),i=jQuery(t[0]),n=i.outerWidth(),r=i.outerHeight(),_=c.getOptions(),0==g?(m.thumbSize=n,1==_.thumb_fixed_size?m.thumbSecondSize=r:m.thumbSecondSize=_.thumb_height,y(o.width()),m.stripInnerSize=a.width()):(m.thumbSize=r,1==_.thumb_fixed_size?m.thumbSecondSize=n:m.thumbSecondSize=_.thumb_width,y(o.height()),m.stripInnerSize=a.height()),function(){if(0==g){var e=m.thumbSecondSize,t={};t.height=e+"px";var i={};i.height=e+"px"}else{var n=m.thumbSecondSize,t={};t.width=n+"px";var i={};i.width=n+"px"}o.css(t),a.css(i)}(),I(),0==p.isRunOnce&&(1==h.strip_control_touch&&(l=new UGTouchThumbsControl).init(u),1==h.strip_control_avia&&(s=new UGAviaControl).init(u),P(),c.loadThumbsImages(),c.initEvents(),o.find(".ug-thumb-wrapper").on("click touchend",function(e){!function(e){if(u.isTouchMotionActive()){var t=l.isSignificantPassed();if(1==t)return!0}var i=c.getItemByThumb(e);d.selectItem(i)}(jQuery(this))}),e.on(d.events.ITEM_CHANGE,j),p.isNotFixedThumbs&&jQuery(c).on(c.events.AFTERPLACEIMAGE,x)),p.isRunOnce=!0}function y(e){m.stripSize=e,m.stripActiveSize=0==g?m.stripSize-h.strip_padding_left-h.strip_padding_right:m.stripSize-h.strip_padding_top-h.strip_padding_bottom,m.stripActiveSize<0&&(m.stripActiveSize=0)}function I(){var e,t=a.children(".ug-thumb-wrapper"),n=0,r=0;for(0==g&&(r=h.strip_padding_top),i=0;i<t.length;i++){var o=jQuery(t[i]);if(1==p.isNotFixedThumbs){if(objItem=c.getItemByThumb(o),0==objItem.isLoaded)continue;o.show()}_.placeElement(o,n,r),0==g?n+=o.outerWidth()+h.strip_space_between_thumbs:r+=o.outerHeight()+h.strip_space_between_thumbs}if(0==g)var s=n-h.strip_space_between_thumbs;else s=r-h.strip_space_between_thumbs;e=s,0==g?a.width(e):a.height(e),m.stripInnerSize=e,P(),jQuery(u).trigger(u.events.INNER_SIZE_CHANGE)}function w(e){var t=u.getInnerStripPos()+e;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function E(e){var t=-1*A(e).min;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function T(e){var t=-1*A(e).max+m.stripSize;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function S(e){if(0==C())return!1;var t,i,n=(t={},i=u.getInnerStripPos(),t.minPosThumbs=-1*i+1,t.maxPosThumbs=-1*i+m.stripSize-1,t),r=A(e);if(r.min<n.minPosThumbs){var o=e.prev();o.length?E(o):E(e)}else if(r.max>n.maxPosThumbs){var a=e.next();a.length?T(a):T(e)}}function P(){1==C()?(s&&s.enable(),l&&l.enable()):(s&&s.disable(),l&&l.disable())}function x(){clearTimeout(p.handle),p.handle=setTimeout(function(){I()},50)}function j(){var e=d.getSelectedItem();c.setThumbSelected(e.objThumbWrapper),S(e.objThumbWrapper)}function C(){return m.stripInnerSize>m.stripActiveSize}function A(e){var t={},i=e.position();return 0==g?(t.min=i.left,t.max=i.left+m.thumbSize):(t.min=i.top,t.max=i.top+m.thumbSize),t}this.setHtml=function(e){if(!e){e=n;null!=h.parent_container&&(e=h.parent_container)}e.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"),o=e.children(".ug-thumbs-strip"),a=o.children(".ug-thumbs-strip-inner"),c.setHtmlThumbs(a),1==p.isNotFixedThumbs&&c.hideThumbs()},this.destroy=function(){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.off(d.events.ITEM_CHANGE),jQuery(c).off(c.events.AFTERPLACEIMAGE),l&&l.destroy(),s&&s.destroy(),c.destroy()},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(i,o){!function(i,o){t=i.getObjects(),(d=i).attachThumbsPanel("strip",u),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,h=jQuery.extend(h,o),1==(g=h.strip_vertical_type)&&(h=jQuery.extend(h,f),h=jQuery.extend(h,o),o.thumb_resize_by="width"),c.init(i,o),b()}(i,o)},this.run=function(){v()},this.positionInnerStrip=function(e,t){if(void 0===t)t=!1;if(0==g)var i={left:e+"px"};else i={top:e+"px"};0==t?(a.css(i),u.triggerStripMoveEvent()):(u.triggerStripMoveEvent(),a.stop(!0).animate(i,{duration:h.strip_scroll_to_thumb_duration,easing:h.strip_scroll_to_thumb_easing,queue:!1,progress:function(){u.triggerStripMoveEvent()},always:function(){u.triggerStripMoveEvent()}}))},this.triggerStripMoveEvent=function(){jQuery(u).trigger(u.events.STRIP_MOVE)},this.isTouchMotionActive=function(){return!!l&&l.isTouchActive()},this.isItemThumbVisible=function(e){var t=e.objThumbWrapper,i=t.position(),n=-1*u.getInnerStripPos();if(0==g)var r=n+m.stripSize,o=i.left,a=i.left+t.width();else r=n+m.stripSize,o=i.top,a=i.top+t.height();var s=!1;return a>=n&&o<=r&&(s=!0),s},this.getInnerStripPos=function(){return 0==g?a.position().left:a.position().top},this.getInnerStripLimits=function(){var e={};return e.maxPos=0==g?h.strip_padding_left:h.strip_padding_top,e.minPos=-(m.stripInnerSize-m.stripActiveSize),e},this.fixInnerStripLimits=function(e){var t=u.getInnerStripLimits();return e>t.maxPos&&(e=t.maxPos),e<t.minPos&&(e=t.minPos),e},this.scrollForeward=function(){w(-m.stripSize)},this.scrollBack=function(){w(m.stripSize)},this.________EXTERNAL_SETTERS___________=function(){},this.setOptions=function(e){h=jQuery.extend(h,e),c.setOptions(e),b()},this.setSizeVertical=function(e){if(0==g)throw new Error("setSizeVertical error, the strip size is not vertical");var t=m.thumbSecondSize,i={};i.width=t+"px",i.height=e+"px",o.css(i),y(e);var n={};n.width=t+"px",n.left="0px",n.top="0px",a.css(n),p.is_placed=!0,P()},this.setSizeHorizontal=function(e){if(1==g)throw new Error("setSizeHorizontal error, the strip size is not horizontal");var t=m.thumbSecondSize+h.strip_padding_top+h.strip_padding_bottom,i={};i.width=e+"px",i.height=t+"px",o.css(i),y(e);var n=h.strip_padding_left,r={};r.height=t+"px",r.left=n+"px",r.top="0px",a.css(r),p.is_placed=!0,P()},this.setPosition=function(e,t,i,n){_.placeElement(o,e,t,i,n)},this.resize=function(e){0==g?(o.width(e),m.stripActiveSize=e-h.strip_padding_left-h.strip_padding_right):(o.height(e),m.stripActiveSize=e-h.strip_padding_top-h.strip_padding_bottom),y(e),P(),function(){if(0==C())return!1;var e=u.getInnerStripPos(),t=u.fixInnerStripLimits(e);e!=t&&u.positionInnerStrip(t,!0)}(),function(){if(C())return!1;0==g?_.placeElement(a,h.strip_thumbs_align,0):_.placeElement(a,0,h.strip_thumbs_align)}(),function(){var e=d.getSelectedItem();if(null==e)return!0;var t=e.objThumbWrapper;t&&S(t)}(),s&&s.onResize()},this.setThumbUnselected=function(e){c.setThumbUnselected(e)},this.setCustomThumbs=function(e){c.setCustomThumbs(e)},this.________EXTERNAL_GETTERS___________=function(){},this.getObjects=function(){var t=c.getOptions(),i=jQuery.extend(h,t);return{g_gallery:d,g_objGallery:e,g_objWrapper:n,g_arrItems:r,g_objStrip:o,g_objStripInner:a,g_aviaControl:s,g_touchThumbsControl:l,isVertical:g,g_options:i,g_thumbs:c}},this.getObjThumbs=function(){return c},this.getSelectedThumb=function(){var e=d.getSelectedItemIndex();return-1==e?null:c.getThumbByIndex(e)},this.getSizeAndPosition=function(){return _.getElementSize(o)},this.getHeight=function(){return o.outerHeight()},this.getWidth=function(){return o.outerWidth()},this.getSizes=function(){return m},this.isVertical=function(){return g},this.isPlaced=function(){return p.is_placed},this.isMoveEnabled=function(){return C()}}function UGTouchThumbsControl(){var e,t,i,n,r,o,a=new UGFunctions,s={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},l={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};function u(){var e=jQuery.now(),t={};return t.passedTime=l.lastTime-l.startTime,t.lastActiveTime=e-l.buttonReleaseTime,t.passedDistance=l.lastPos-l.startPos,t.passedDistanceAbs=Math.abs(t.passedDistance),t}function d(e){return 0==o?a.getMousePosition(e).pageX:a.getMousePosition(e).pageY}function _(){var e=jQuery.now();e-l.lastTime>=s.touch_portion_time&&(l.lastDeltaTime=e-l.lastTime,l.lastDeltaTime>s.touch_portion_time&&(l.lastDeltaTime=s.touch_portion_time),l.lastDeltaPos=l.lastPos-l.lastPortionPos,l.lastPortionPos=l.lastPos,l.lastTime=e)}function g(){l.lastPos=e.getInnerStripPos(),e.triggerStripMoveEvent()}function c(t){if(0==l.loop_active)return!0;if(t){d(t);!function(){var t=s.thumb_touch_slowFactor,i=s.minDeltaTime,r=s.minPath,a=e.getInnerStripPos(),u=jQuery.now()-l.lastTime,d=a-l.lastPortionPos;u<i&&l.lastDeltaTime>0&&(u=l.lastDeltaTime,d=l.lastDeltaPos+d),u<i&&(u=i);var _=0;u>0&&(_=d/u);var c=_*_/(2*t)*(d>0?1:-1);Math.abs(c)<=r&&(c=0);var h=e.getInnerStripPos(),p=h+c,m=e.fixInnerStripLimits(p),f=e.getInnerStripLimits(),b=s.limitsBreakAddition,v=!1,y=m;if(p>f.maxPos&&(v=!0,m=b,p<b&&(m=p)),p<f.minPos){v=!0;var I=f.minPos-b;m=I,p>I&&(m=p)}var w=m-h,E=Math.abs(Math.round(_/t));if(0!=c&&(E=E*w/c),h!=m){var T={left:m+"px"};1==o&&(T={top:m+"px"}),n.animate(T,{duration:E,easing:s.animationEasing,queue:!0,progress:g})}if(1==v){var S=s.returnAnimateSpeed,P={left:y+"px"};1==o&&(P={top:y+"px"}),n.animate(P,{duration:S,easing:s.returnAnimationEasing,queue:!0,progress:g})}}()}l.loop_active=!1,l.handle=clearInterval(l.handle)}function h(e){return 0==l.isControlEnabled||(l.buttonReleaseTime=jQuery.now(),0==l.touch_active?(c(e),!0):(e.preventDefault(),l.touch_active=!1,c(e),void i.removeClass("ug-dragging")))}function p(t){if(0==l.isControlEnabled)return!0;t.preventDefault(),l.touch_active=!0;var r=d(t);n.stop(!0),function(t){var i=e.getInnerStripPos();l.mousePos=t,l.innerPos=i,l.lastPortionPos=i,l.lastDeltaTime=0,l.lastDeltaPos=0,l.startTime=jQuery.now(),l.startPos=l.innerPos,l.lastTime=l.startTime,l.lastPos=l.startPos,l.speed=0}(r),function(){if(1==l.loop_active)return!0;l.loop_active=!0,l.handle=setInterval(_,10)}(),i.addClass("ug-dragging")}function m(t){if(0==l.isControlEnabled)return!0;if(0==l.touch_active)return!0;if(t.preventDefault(),0==t.buttons)return l.touch_active=!1,c(t),!0;var i=d(t);l.lastPos=e.getInnerStripPos(),function(t){var i=l.mousePos-t,n=l.innerPos-i,r=e.getInnerStripLimits();if(n>r.maxPos){var o=n-r.maxPos;n=r.maxPos+o/3}n<r.minPos&&(o=r.minPos-n,n=r.minPos-o/3);e.positionInnerStrip(n)}(i),_()}this.enable=function(){l.isControlEnabled=!0},this.disable=function(){l.isControlEnabled=!1},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,t.g_objGallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,s.thumb_touch_slowFactor=a.normalizeSetting(5e-5,.01,1,100,r.strip_thumb_touch_sensetivity,!0),i.bind("mousedown touchstart",p),jQuery(window).add("body").bind("mouseup touchend",h),jQuery("body").bind("mousemove touchmove",m)},this.isSignificantPassed=function(){var e=u();return e.passedTime>300||e.passedDistanceAbs>30},this.isTouchActive=function(){return 1==l.touch_active||(1==n.is(":animated")||u().lastActiveTime<50)},this.destroy=function(){i.unbind("mousedown"),i.unbind("touchstart"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){var e,t,i,n,r,o,a,s=new UniteGalleryMain,l=this,u=new UGFunctions;function d(t,n){switch(e.orientation){case"right":case"left":var r={left:t+"px"};break;case"top":case"bottom":r={top:t+"px"}}i.stop(!0).animate(r,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){n&&n()}})}function _(t){switch(e.orientation){case"right":case"left":u.placeElement(i,t,null);break;case"top":case"bottom":u.placeElement(i,null,t)}}function g(){r.trigger(t.events.FINISH_MOVE)}this.init=function(i,o,l,u,d){e=o,t=l,s=i,n=u,r=d,a=jQuery(s)},this.setHtml=function(r){if(i=r,"strip"==e.panelType)var a=n.strippanel_enable_handle;else a=n.gridpanel_enable_handle;if(1==a&&((o=new UGPanelHandle).init(t,i,n,e.panelType,s),o.setHtml()),!0===e.isDisabledAtStart){i.append("<div class='ug-overlay-disabled'></div>"),setTimeout(function(){i.children(".ug-overlay-disabled").hide()},e.disabledAtStartTimeout)}},this.placeElements=function(){o&&o.placeHandle()},this.initEvents=function(){o&&(o.initEvents(),a.on(s.events.SLIDER_ACTION_START,function(){o.hideHandle()}),a.on(s.events.SLIDER_ACTION_END,function(){o.showHandle()}))},this.destroy=function(){o&&(o.destroy(),a.off(s.events.SLIDER_ACTION_START),a.off(s.events.SLIDER_ACTION_END))},this.openPanel=function(n){if(!n)n=!1;return!i.is(":animated")&&(0!=e.isClosed&&(e.isClosed=!1,r.trigger(t.events.OPEN_PANEL),void(!1===n?d(e.originalPos,g):(_(e.originalPos),g()))))},this.closePanel=function(n){if(!n)n=!1;if(i.is(":animated"))return!1;if(1==e.isClosed)return!1;var o=l.getClosedPanelDest();e.isClosed=!0,r.trigger(t.events.CLOSE_PANEL),!1===n?d(o,g):(_(o),g())},this.setClosedState=function(i){e.originalPos=i,r.trigger(t.events.CLOSE_PANEL),e.isClosed=!0},this.setOpenedState=function(i){r.trigger(t.events.OPEN_PANEL),e.isClosed=!1},this.getClosedPanelDest=function(){var t,n=u.getElementSize(i);switch(e.orientation){case"left":e.originalPos=n.left,t=-e.panelWidth;break;case"right":e.originalPos=n.left,t=s.getSize().width;break;case"top":e.originalPos=n.top,t=-e.panelHeight;break;case"bottom":e.originalPos=n.top,t=s.getSize().height}return t},this.isPanelClosed=function(){return e.isClosed},this.setDisabledAtStart=function(t){if(t<=0)return!1;e.isDisabledAtStart=!0,e.disabledAtStartTimeout=t}}function UGPanelHandle(){var e,t,i,n=new UGFunctions,r={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0};function o(){i.removeClass("ug-button-hover")}function a(e){if(e.stopPropagation(),e.stopImmediatePropagation(),0==n.validateClickTouchstartEvent(e.type))return!0;t.isPanelClosed()?t.openPanel():t.closePanel()}this.init=function(i,n,o,a,s){switch(t=i,e=n,a){case"grid":r.panel_handle_align=o.gridpanel_handle_align,r.panel_handle_offset=o.gridpanel_handle_offset,r.panel_handle_skin=o.gridpanel_handle_skin;break;case"strip":r.panel_handle_align=o.strippanel_handle_align,r.panel_handle_offset=o.strippanel_handle_offset,r.panel_handle_skin=o.strippanel_handle_skin;break;default:throw new Error("Panel handle error: wrong panel type: "+a)}var l=s.getOptions().gallery_skin;""==r.panel_handle_skin&&(r.panel_handle_skin=l)},this.setHtml=function(){var n="ug-panel-handle-tip";switch(t.getOrientation()){case"right":n+=" ug-handle-tip-left";break;case"left":n+=" ug-handle-tip-right";break;case"bottom":n+=" ug-handle-tip-top";break;case"top":n+=" ug-handle-tip-bottom"}e.append("<div class='"+n+" ug-skin-"+r.panel_handle_skin+"'></div>"),i=e.children(".ug-panel-handle-tip")},this.initEvents=function(){n.addClassOnHover(i),i.bind("click touchstart",a),jQuery(t).on(t.events.OPEN_PANEL,function(){o(),i.removeClass("ug-button-closed")}),jQuery(t).on(t.events.CLOSE_PANEL,function(){o(),i.addClass("ug-button-closed")})},this.destroy=function(){n.destroyButton(i),jQuery(t).off(t.events.OPEN_PANEL),jQuery(t).off(t.events.CLOSE_PANEL)},this.placeHandle=function(){var e=n.getElementSize(i);!function(){switch(t.getOrientation()){case"right":case"left":"top"!=r.panel_handle_align&&"bottom"!=r.panel_handle_align&&(r.panel_handle_align="top");break;case"bottom":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="left");break;case"top":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="right")}}();var o=t.getOrientation();switch(o){case"left":n.placeElement(i,"right",r.panel_handle_align,-e.width);break;case"right":n.placeElement(i,-e.width,r.panel_handle_align,0,r.panel_handle_offset);break;case"top":n.placeElement(i,r.panel_handle_align,"bottom",r.panel_handle_offset,-e.height);break;case"bottom":n.placeElement(i,r.panel_handle_align,"top",r.panel_handle_offset,-e.height);break;default:throw new Error("Wrong panel orientation: "+o)}},this.hideHandle=function(){1==i.is(":visible")&&i.hide()},this.showHandle=function(){0==i.is(":visible")&&i.show()}}function UGStripPanel(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGThumbsStrip,d=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var _={strippanel_vertical_type:!1,strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},g={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},c={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},h={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0};function p(){if(1==h.isFirstRun&&0==function(){if(0==_.strippanel_vertical_type){if(0==h.panelWidth)throw new Error("Strip panel error: The width not set, please set width")}else if(0==h.panelHeight)throw new Error("Strip panel error: The height not set, please set height");if(null==h.orientation)throw new Error("Wrong orientation, please set panel orientation before run");return!0}())return!1;u.run(),f(),b(),function(){if(1==h.isEventsInited)return!1;if(h.isEventsInited=!0,n)if(l.addClassOnHover(n,"ug-button-hover"),l.addClassOnHover(r,"ug-button-hover"),l.setButtonOnClick(r,y),l.setButtonOnClick(n,v),"advance_item"!=_.strippanel_buttons_role)jQuery(u).on(u.events.STRIP_MOVE,w),jQuery(u).on(u.events.INNER_SIZE_CHANGE,I),e.on(s.events.SIZE_CHANGE,I);else{var t=s.getOptions();0==t.gallery_carousel&&jQuery(s).on(s.events.ITEM_CHANGE,E)}d.initEvents()}(),h.isFirstRun=!1,I()}function m(e){if(!e)e=t;if(e.append("<div class='ug-strip-panel'></div>"),i=e.children(".ug-strip-panel"),1==_.strippanel_enable_buttons){var o="ug-strip-arrow-left",a="ug-strip-arrow-right";1==_.strippanel_vertical_type&&(o="ug-strip-arrow-up",a="ug-strip-arrow-down"),i.append("<div class='ug-strip-arrow "+o+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>"),i.append("<div class='ug-strip-arrow "+a+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>")}d.setHtml(i),u.setHtml(i),1==_.strippanel_enable_buttons&&(r=i.children("."+o),n=i.children("."+a)),""!=_.strippanel_background_color&&i.css("background-color",_.strippanel_background_color)}function f(){0==_.strippanel_vertical_type?function(){var e=u.getHeight(),t=h.panelWidth;if(n){r.height(e),n.height(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_top+_.strippanel_padding_bottom;i.width(t),i.height(s),h.panelHeight=s;var d=t-_.strippanel_padding_left-_.strippanel_padding_right;n&&(d=d-2*n.outerWidth()-2*_.strippanel_padding_buttons),u.resize(d)}():function(){var e=u.getWidth(),t=h.panelHeight;if(n){r.width(e),n.width(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_left+_.strippanel_padding_right;i.width(s),i.height(t),h.panelWidth=s;var d=t-_.strippanel_padding_top-_.strippanel_padding_bottom;n&&(d=d-2*n.outerHeight()-2*_.strippanel_padding_buttons),u.resize(d)}()}function b(){0==_.strippanel_vertical_type?function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"right","top",_.strippanel_padding_right,_.strippanel_padding_top));var e=_.strippanel_padding_left;n&&(e+=n.outerWidth()+_.strippanel_padding_buttons),u.setPosition(e,_.strippanel_padding_top)}():function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"left","bottom",_.strippanel_padding_left,_.strippanel_padding_bottom));var e=_.strippanel_padding_top;n&&(e+=n.outerHeight()+_.strippanel_padding_buttons),u.setPosition(_.strippanel_padding_left,e)}(),d.placeElements()}function v(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.nextItem():u.scrollForeward()}function y(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.prevItem():u.scrollBack()}function I(){if(!n)return!0;if(0==u.isMoveEnabled())return l.disableButton(r),l.disableButton(n),!0;var e=u.getInnerStripLimits(),t=u.getInnerStripPos();t>=e.maxPos?l.disableButton(r):l.enableButton(r),t<=e.minPos?l.disableButton(n):l.enableButton(n)}function w(){I()}function E(){s.isLastItem()?l.disableButton(n):l.enableButton(n),s.isFirstItem()?l.disableButton(r):l.enableButton(r)}this.destroy=function(){n&&(l.destroyButton(n),l.destroyButton(r),jQuery(u).off(u.events.STRIP_MOVE),jQuery(s).off(s.events.ITEM_CHANGE),jQuery(s).off(s.events.SIZE_CHANGE)),d.destroy(),u.destroy()},this.getOrientation=function(){return h.orientation},this.setOrientation=function(e){h.orientation=e},this.init=function(i,n){!function(i,n){s=i,e=jQuery(s);var r=!1;1==(_=jQuery.extend(_,n)).strippanel_vertical_type&&(_=jQuery.extend(_,g),r=!0),0==_.strippanel_enable_buttons&&(_=jQuery.extend(_,c),r=!0),1==r&&(_=jQuery.extend(_,n));var l=s.getOptions().gallery_skin;""==_.strippanel_buttons_skin&&(_.strippanel_buttons_skin=l),t=s.getElement(),d.init(s,h,o,_,a),(u=new UGThumbsStrip).init(s,_)}(i,n)},this.run=function(){p()},this.setHtml=function(e){m(e)},this.getElement=function(){return i},this.getSize=function(){return l.getElementSize(i)},this.setWidth=function(e){h.panelWidth=e},this.setHeight=function(e){h.panelHeight=e},this.resize=function(e){o.setWidth(e),f(),b()},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return d.isPanelClosed()},this.getClosedPanelDest=function(){return d.getClosedPanelDest()},this.openPanel=function(e){d.openPanel(e)},this.closePanel=function(e){d.closePanel(e)},this.setOpenedState=function(e){d.setOpenedState(e)},this.setClosedState=function(e){d.setClosedState(e)},this.setCustomThumbs=function(e){u.setCustomThumbs(e)},this.setDisabledAtStart=function(e){d.setDisabledAtStart(e)}}function UGGridPanel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGThumbsGrid,u=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var d={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!1,gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},_={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},g={gridpanel_grid_align:"center"},c={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};function h(){if(null==c.orientation)throw new Error("Wrong orientation, please set panel orientation before run")}function p(){h(),"center"==d.gridpanel_grid_align&&(d.gridpanel_grid_align="middle"),l.run(),function(){var e=!1;if(1==d.gridpanel_arrows_always_on)e=!0;else{var t=l.getNumPanes();t>1&&(e=!0)}1==e?(i.show().fadeTo(0,1),n.show().fadeTo(0,1),c.arrowsVisible=!0):(i.hide(),n.hide(),c.arrowsVisible=!1)}(),function(){var e=l.getSize();1==c.isHorType?c.panelHeight=e.height+d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom:c.panelWidth=e.width+d.gridpanel_padding_border_left+d.gridpanel_padding_border_right;s.setElementSize(t,c.panelWidth,c.panelHeight)}(),function(){0==c.isHorType?1==d.gridpanel_vertical_scroll?1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"top":e=d.gridpanel_padding_border_top+a.height+d.gridpanel_arrows_padding_vert;break;case"middle":e="middle";break;case"bottom":e=c.panelHeight-u.height-a.height-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert}var _=f(),g=l.getElement();s.placeElement(g,_,e);var u=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":t=(u.top-a.height)/2,r=u.bottom+(c.panelHeight-u.bottom-a.height)/2,o=0;break;case"grid":t=u.top-a.height-d.gridpanel_arrows_padding_vert_vert,r=u.bottom+d.gridpanel_arrows_padding_vert,o=0;break;case"border":case"borders":t=d.gridpanel_padding_border_top,r="bottom",o=d.gridpanel_padding_border_bottom}s.placeElement(n,"center",t),s.placeElement(i,"center",r,0,o)}():b():1==c.arrowsVisible?function(){var e,t,r,o=s.getElementSize(n),a=l.getSize(),u=d.gridpanel_padding_border_top;switch(d.gridpanel_grid_align){case"middle":switch(d.gridpanel_arrows_align_vert){default:var _=a.height+d.gridpanel_arrows_padding_vert+o.height;u=(c.panelHeight-_)/2;break;case"border":case"borders":var g=c.panelHeight-o.height-d.gridpanel_padding_border_bottom;u=(g-a.height)/2}break;case"bottom":var _=a.height+o.height+d.gridpanel_arrows_padding_vert;u=c.panelHeight-_-d.gridpanel_padding_border_bottom}var h=l.getElement(),p=f();s.placeElement(h,p,u);var a=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":e=a.bottom+(c.panelHeight-a.bottom-o.height)/2,r=0;break;case"grid":e=a.bottom+d.gridpanel_arrows_padding_vert,r=0;break;case"border":case"borders":e="bottom",r=d.gridpanel_padding_border_bottom}t=-o.width/2-d.gridpanel_space_between_arrows/2,s.placeElement(n,"center",e,t,r);var m=Math.abs(t);s.placeElement(i,"center",e,m,r)}():b():1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left+d.gridpanel_arrows_padding_hor+a.width;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-u.width-a.width-d.gridpanel_padding_border_right-d.gridpanel_arrows_padding_hor}var _=l.getElement();switch(s.placeElement(_,e,d.gridpanel_padding_border_top),u=l.getSize(),d.gridpanel_arrows_align_vert){default:case"center":case"middle":o=(u.height-a.height)/2+u.top;break;case"top":o=d.gridpanel_padding_border_top+d.gridpanel_arrows_padding_vert;break;case"bottom":o=c.panelHeight-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert-a.height}switch(d.gridpanel_arrows_align_hor){default:case"borders":t=d.gridpanel_padding_border_left,r=c.panelWidth-d.gridpanel_padding_border_right-a.width;break;case"grid":t=u.left-d.gridpanel_arrows_padding_hor-a.width,r=u.right+d.gridpanel_arrows_padding_hor;break;case"center":t=(u.left-a.width)/2,r=u.right+(c.panelWidth-u.right-a.width)/2}s.placeElement(n,t,o),s.placeElement(i,r,o)}():function(){var e,t=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-t.width-d.gridpanel_padding_border_right}var i=l.getElement();s.placeElement(i,e,d.gridpanel_padding_border_top)}();u.placeElements()}(),function(){if(1==c.isEventsInited)return!1;c.isEventsInited=!0,n&&(s.addClassOnHover(n),l.attachPrevPaneButton(n));i&&(s.addClassOnHover(i),l.attachNextPaneButton(i));u.initEvents()}()}function m(){e.append("<div class='ug-grid-panel'></div>"),t=e.children(".ug-grid-panel"),c.isHorType?(t.append("<div class='grid-arrow grid-arrow-left-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left-hortype"),i=t.children(".grid-arrow-right-hortype")):0==d.gridpanel_vertical_scroll?(t.append("<div class='grid-arrow grid-arrow-left ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left"),i=t.children(".grid-arrow-right")):(t.append("<div class='grid-arrow grid-arrow-up ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-down ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-up"),i=t.children(".grid-arrow-down")),u.setHtml(t),n.fadeTo(0,0),i.fadeTo(0,0),l.setHtml(t),""!=d.gridpanel_background_color&&t.css("background-color",d.gridpanel_background_color)}function f(){return d.gridpanel_padding_border_left}function b(){var e=d.gridpanel_grid_align,t=0;switch(e){case"top":t=d.gridpanel_padding_border_top;break;case"bottom":t=d.gridpanel_padding_border_bottom}var i=f(),n=l.getElement();s.placeElement(n,i,e,0,t)}this.destroy=function(){n&&s.destroyButton(n),i&&s.destroyButton(i),u.destroy(),l.destroy()},this.getOrientation=function(){return c.orientation},this.setOrientation=function(e){switch(c.orientation=e,e){case"right":case"left":c.isHorType=!1;break;case"top":case"bottom":c.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+e)}},this.setHeight=function(e){if(1==c.isHorType)throw new Error("setHeight is not appliable to this orientatio ("+c.orientation+"). Please use setWidth");c.panelHeight=e;var t,n,r=(t=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByHeight(n)?n:(t=s.getElementSize(i).height+d.gridpanel_arrows_padding_vert,1==d.gridpanel_vertical_scroll&&(t*=2),t+=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t));l.setMaxHeight(r)},this.setWidth=function(e){if(0==c.isHorType)throw new Error("setWidth is not appliable to this orientatio ("+c.orientation+"). Please use setHeight");c.panelWidth=e;var t,n,r=(t=d.gridpanel_padding_border_left+d.gridpanel_padding_border_right,n=c.panelWidth-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByWidth(n)?n:(t+=2*(s.getElementSize(i).width+d.gridpanel_arrows_padding_hor),n=c.panelWidth-t));l.setMaxWidth(r)},this.init=function(t,i){!function(t,i){a=t,h(),i&&i.vertical_scroll&&(d.gridpanel_vertical_scroll=i.vertical_scroll),d=jQuery.extend(d,i),1==c.isHorType?(d=jQuery.extend(d,g),d=jQuery.extend(d,i)):1==d.gridpanel_vertical_scroll&&(d=jQuery.extend(d,_),(d=jQuery.extend(d,i)).grid_panes_direction="bottom");var n=a.getOptions().gallery_skin;""==d.gridpanel_arrows_skin&&(d.gridpanel_arrows_skin=n);var s=t.getObjects();e=s.g_objWrapper,u.init(a,c,r,d,o),(l=new UGThumbsGrid).init(a,d)}(t,i)},this.setHtml=function(){m()},this.run=function(){p()},this.getElement=function(){return t},this.getSize=function(){return s.getElementSize(t)},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return u.isPanelClosed()},this.getClosedPanelDest=function(){return u.getClosedPanelDest()},this.openPanel=function(e){u.openPanel(e)},this.closePanel=function(e){u.closePanel(e)},this.setOpenedState=function(e){u.setOpenedState(e)},this.setClosedState=function(e){u.setClosedState(e)},this.setDisabledAtStart=function(e){u.setDisabledAtStart(e)}}function UGThumbsGrid(){var e,t,n,r,o,a,s=this,l=jQuery(this),u=new UniteGalleryMain,d=new UGFunctions,_=new UGThumbsGeneral,g=new UGTileDesign,c={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1};this.events={PANE_CHANGE:"pane_change"};var h={eventSizeChange:"thumb_size_change",isHorizontal:!1,isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};function p(i,o,a){var l;if(t=i.getObjects(),(u=i).attachThumbsPanel("grid",s),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,!0===a&&(h.isTilesMode=!0),h.numThumbs=r.length,l=o,c=jQuery.extend(c,l),_.setOptions(l),h.isNavigationVertical="top"==c.grid_panes_direction||"bottom"==c.grid_panes_direction,h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows,1==h.isTilesMode){g.setFixedMode(),g.setApproveClickFunction(j),g.init(i,c);var d=g.getOptions();h.tileMaxHeight=d.tile_height,h.tileMaxWidth=d.tile_width,_=g.getObjThumbs()}else o.thumb_fixed_size=!0,_.init(i,o)}function m(){var t=u.getSelectedItem();(function(){if(0==h.isHorizontal){if(0==h.gridHeight)throw new Error("You must set height before run.")}else if(0==h.gridWidth)throw new Error("You must set width before run.")}(),1==h.isFirstTimeRun)?(!function(){if(0==h.isTilesMode){_.initEvents();var t=o.find(".ug-thumb-wrapper");t.on("click touchend",C),e.on(u.events.ITEM_CHANGE,z)}else g.initEvents();o.bind("mousedown touchstart",A),jQuery("body").bind("mousemove touchmove",M),jQuery(window).add("body").bind("mouseup touchend",O)}(),1==h.isTilesMode?(b(),v(),g.run()):(_.setHtmlProperties(),v(),_.loadThumbsImages())):1==h.isTilesMode&&1==b()&&(v(),g.run());if(0==h.isHorizontal?h.isNavigationVertical?function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(l);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t+=p+h.spaceBetweenCols;var f=n+m;f>r&&(r=f),++s>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=l,s=0),1==h.numPanes&&h.numThumbsInPane++,f=n+m;var b=u+h.gridHeight;f>b&&(1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(h.gridHeight),b=h.gridHeight),n=b+h.spaceBetweenRows,u=n,t=l=0,s=0,i<_-1&&(h.numPanes++,h.arrPanes.push(n)))}a.height(r),h.innerHeight=r,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(r))}():function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(s);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t>l&&(l=t);var f=n+m;f>u&&(u=f);var b=l+p;b>h.innerWidth&&(h.innerWidth=b),t+=p+h.spaceBetweenCols,++r>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=s,r=0),1==h.numPanes&&h.numThumbsInPane++,n+m>h.gridHeight&&(n=0,s=h.innerWidth+h.spaceBetweenCols,t=s,r=0,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(h.gridHeight)),i<_-1&&(h.numPanes++,h.arrPanes.push(s)))}a.width(h.innerWidth),1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(u))}():function(){var e=a.children(".ug-thumb-wrapper"),t=c.grid_padding,n=c.grid_padding,r=n,s=t,l=0,u=0,_=0,g=0,p=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(t-c.grid_padding);var m=e.length;for(i=0;i<m;i++){var f=jQuery(e[i]),b=f.outerWidth(),v=f.outerHeight();s-t+b>h.gridWidth&&(r=0,++p>=c.grid_num_rows?(p=0,t=s,r=n,_=0,1==h.numPanes&&(h.gridWidth=l+c.grid_padding,o.width(h.gridWidth),h.gridHeight=g+c.grid_padding,o.height(h.gridHeight)),h.numPanes++,h.arrPanes.push(t-c.grid_padding)):(s=t,r=_+h.spaceBetweenRows)),d.placeElement(f,s,r);var y=s+b;y>l&&(l=y);var I=r+v;I>_&&(_=I),I>g&&(g=I),I>u&&(u=I);var y=l+b;y>h.innerWidth&&(h.innerWidth=y),s+=b+h.spaceBetweenCols,1==h.numPanes&&h.numThumbsInPane++}h.innerWidth=l+c.grid_padding,h.innerHeight=g+c.grid_padding,a.width(h.innerWidth),a.height(h.innerHeight),1==h.numPanes&&(h.gridWidth=l+c.grid_padding,h.gridHeight=g+c.grid_padding,o.width(h.gridWidth),o.height(h.gridHeight))}(),1==h.isFirstTimeRun&&h.isTilesMode){var r=_.getThumbs();r.each(function(e,t){n.trigger(h.eventSizeChange,jQuery(t))}),r.fadeTo(0,1)}null!=t&&y(t.index),l.trigger(s.events.PANE_CHANGE,h.currentPane),h.isFirstTimeRun=!1}function f(){if(1==h.isTilesMode)var e=g.getGlobalTileSize();else e=_.getGlobalThumbSize();return e}function b(){if(0==h.isTilesMode)throw new Error("Dynamic size can be set only in tiles mode");var e=!1,t=u.isMobileMode(),i=h.spaceBetweenCols;1==t?(h.spaceBetweenCols=c.grid_space_between_mobile,h.spaceBetweenRows=c.grid_space_between_mobile):(h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows),h.spaceBetweenCols!=i&&(e=!0);var n=f().width,r=h.tileMaxWidth;return d.getNumItemsInSpace(h.gridWidth,h.tileMaxWidth,h.spaceBetweenCols)<c.grid_min_cols&&(r=d.getItemSizeInSpace(h.gridWidth,c.grid_min_cols,h.spaceBetweenCols)),g.setTileSizeOptions(r),r!=n&&(e=!0),e}function v(){var e,t,i;0==h.isHorizontal?(e=f().width,t=c.grid_num_cols*e+(c.grid_num_cols-1)*h.spaceBetweenCols+2*c.grid_padding,i=h.gridHeight,h.gridWidth=t,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i):function(){var e=f().height,t=h.gridWidth,i=c.grid_num_rows*e+(c.grid_num_rows-1)*h.spaceBetweenRows+2*c.grid_padding;h.gridHeight=i,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i}()}function y(e){var t=P(e);if(-1==t)return!1;s.gotoPane(t,"scroll")}function I(e){if(e>=h.numPanes||e<0)throw new Error("Pane "+index+" doesn't exists.");return!0}function w(e){var t=T(e);if(0==t)return!1;a.stop(!0).animate(t,{duration:c.grid_transition_duration,easing:c.grid_transition_easing,queue:!1})}function E(){w(-h.arrPanes[h.currentPane])}function T(e){var t={};return 1==h.isNavigationVertical?t.top=e+"px":t.left=e+"px",t}function S(){var e=d.getElementSize(a);return 1==h.isNavigationVertical?e.top:e.left}function P(e){return 0==function(e){if(e<0||e>=h.numThumbs)throw new Error("Thumb not exists: "+e);return!0}(e)?-1:Math.floor(e/h.numThumbsInPane)}function x(){var e=d.getStoredEventData(h.storedEventID),t=S();diffPos=Math.abs(e.startInnerPos-t);var i=1==h.isNavigationVertical?h.gridHeight:h.gridWidth,n=Math.round(3*i/8);return diffPos>=n||e.diffTime<300&&diffPos>25}function j(){return 1==h.numPanes||d.isApproveStoredEventClick(h.storedEventID,h.isNavigationVertical)}function C(e){if(1==function(){if(1==h.numPanes)return!1;var e=d.getStoredEventData(h.storedEventID),t=e.diffTime,i=S(),n=Math.abs(i-e.startInnerPos);return n>30||n>5&&t>300}())return!0;var t=jQuery(this),i=_.getItemByThumb(t);u.selectItem(i)}function A(e){if(1==h.numPanes)return!0;if(1==h.touchActive)return!0;0==h.isTilesMode&&e.preventDefault(),h.touchActive=!0;var t={startInnerPos:S()};d.storeEventData(e,h.storedEventID,t)}function M(e){if(0==h.touchActive)return!0;e.preventDefault(),d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(0!=c.grid_vertical_scroll_ondrag&&1!=h.isNavigationVertical&&"vert"===d.handleScrollTop(h.storedEventID))return!0;var i=t.diffMousePos,n=t.startInnerPos+i,r=i>0?"prev":"next",o=h.arrPanes[h.numPanes-1];0==c.grid_carousel&&n>0&&"prev"==r&&(n/=3),0==c.grid_carousel&&n<-o&&"next"==r&&(n=t.startInnerPos+i/3),function(e){var t=T(e);if(0==t)return!1;a.css(t)}(n)}function O(e){if(0==h.touchActive)return!0;d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(h.touchActive=!1,0==x())return E(),!0;"next"==(S()-t.startInnerPos>0?"prev":"next")?0==c.grid_carousel&&s.isLastPane()?E():s.nextPane():0==c.grid_carousel&&s.isFirstPane()?E():s.prevPane()}function z(){var e=u.getSelectedItem();_.setThumbSelected(e.objThumbWrapper),y(e.index)}this.destroy=function(){if(0==h.isTilesMode){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.on(u.events.ITEM_CHANGE),_.destroy()}else g.destroy();o.unbind("mousedown"),o.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("touchend"),jQuery(window).add("body").unbind("mouseup"),l.off(s.events.PANE_CHANGE)},this.__________EXTERNAL_GENERAL_________=function(){},this.setThumbUnselected=function(e){_.setThumbUnselected(e)},this.isItemThumbVisible=function(e){return P(e.index)==h.currentPane},this.__________EXTERNAL_API_________=function(){},this.getNumPanesEstimationByHeight=function(e){if(1==h.isTilesMode)var t=c.tile_height;else t=_.getOptions().thumb_height;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_cols),r=n*t+(n-1)*h.spaceBetweenRows;return Math.ceil(r/e)},this.getNumPanesEstimationByWidth=function(e){if(h.isTilesMode)var t=c.tile_width;else t=_.getOptions().thumb_width;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_rows),r=n*t+(n-1)*h.spaceBetweenCols;return Math.ceil(r/e)},this.getHeightEstimationByWidth=function(e){if(0==h.isTilesMode)throw new Error("This function works only with tiles mode");var t=_.getNumThumbs(),i=d.getNumItemsInSpace(e,c.tile_width,h.spaceBetweenCols),n=Math.ceil(t/i);n>c.grid_num_rows&&(n=c.grid_num_rows);var r=d.getSpaceByNumItems(n,c.tile_height,h.spaceBetweenRows);return r+=2*c.grid_padding},this.getElement=function(){return o},this.getSize=function(){return d.getElementSize(o)},this.getNumPanes=function(){return h.numPanes},this.isFirstPane=function(){return 0==h.currentPane},this.isLastPane=function(){return h.currentPane==h.numPanes-1},this.getPaneInfo=function(){return{pane:h.currentPane,total:h.numPanes}},this.getPane=function(){return h.currentPane},this.setWidth=function(e){h.gridWidth=e,h.isHorizontal=!0},this.setMaxWidth=function(e){h.gridWidth=e,h.isMaxWidth=!0,h.isHorizontal=!0},this.setHeight=function(e){h.gridHeight=e,h.isHorizontal=!1},this.setMaxHeight=function(e){h.gridHeight=e,h.isMaxHeight=!0,h.isHorizontal=!1},this.gotoPane=function(e,t){if(0==I(e))return!1;if(e==h.currentPane)return!1;var i=-h.arrPanes[e];h.currentPane=e,w(i),l.trigger(s.events.PANE_CHANGE,e)},this.nextPane=function(){var e=h.currentPane+1;if(e>=h.numPanes){if(0==c.grid_carousel)return!0;e=0}s.gotoPane(e,"next")},this.prevPane=function(){var e=h.currentPane-1;if(e<0&&(e=h.numPanes-1,0==c.grid_carousel))return!1;s.gotoPane(e,"prev")},this.attachNextPaneButton=function(e){if(d.setButtonOnClick(e,s.nextPane),1==c.grid_carousel)return!0;s.isLastPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isLastPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachPrevPaneButton=function(e){if(d.setButtonOnClick(e,s.prevPane),1==c.grid_carousel)return!0;s.isFirstPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isFirstPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachBullets=function(e){e.setActive(h.currentPane),jQuery(e).on(e.events.BULLET_CLICK,function(t,i){s.gotoPane(i,"theme"),e.setActive(i)}),jQuery(s).on(s.events.PANE_CHANGE,function(t,i){e.setActive(i)})},this.getObjTileDesign=function(){return g},this.init=function(e,t,i){p(e,t,i)},this.run=function(){m()},this.setHtml=function(e){!function(e){var t=n;e&&(t=e),t.append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'></div></div>"),o=t.children(".ug-thumbs-grid"),a=o.children(".ug-thumbs-grid-inner"),1==h.isTilesMode?g.setHtml(a):_.setHtmlThumbs(a)}(e)}}function UGTileDesign(){var e,t,i=this,n=jQuery(this),r=new UniteGalleryMain,o=new UGFunctions,a=new UGThumbsGeneral;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"},this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"},this.events={TILE_CLICK:"tile_click"};var s={tile_width:250,tile_height:200,tile_size_by:i.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},l={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},u={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};function d(e,n){r=e,jQuery(e);var d=r.getObjects();t=d.g_objWrapper,r.getArrItems(),s=jQuery.extend(s,l),s=jQuery.extend(s,n),function(){1==s.tile_enable_overlay?(s.thumb_overlay_opacity=s.tile_overlay_opacity,s.thumb_overlay_color=s.tile_overlay_color):0==s.tile_enable_icons?s.thumb_color_overlay_effect=!1:s.thumb_overlay_opacity=0;s.tile_as_link&&(s.thumb_wrapper_as_link=!0,s.thumb_link_newpage=s.tile_link_newpage);1==s.tile_enable_outline&&0==s.tile_enable_border&&(s.tile_enable_outline=!1);u.tileInnerReduce=0,s.tile_enable_border&&(u.tileInnerReduce=2*s.tile_border_width,a.setThumbInnerReduce(u.tileInnerReduce));if(u.isSaparateIcons=!o.isRgbaSupported(),1==s.tile_enable_textpanel){switch(s.tile_textpanel_position){case"top":s.tile_textpanel_align="top";case"bottom":u.isTextpanelOutside=!0,s.tile_textpanel_always_on=!0,s.tile_textpanel_offset=0;break;case"inside_top":s.tile_textpanel_align="top";break;case"middle":s.tile_textpanel_align="middle",s.tile_textpanel_appear_type="fade"}0==s.tile_textpanel_always_on&&(u.isSaparateIcons=!0)}0!=s.tile_textpanel_offset&&(s.tile_textpanel_appear_type="fade",s.tile_textpanel_margin=s.tile_textpanel_offset);"title_and_desc"==s.tile_textpanel_source&&(s.tile_textpanel_enable_description=!0,s.tile_textpanel_desc_style_as_title=!0)}(),a.init(e,s);var _=["overlay"];u.funcCustomTileHtml&&(_=[]),a.setCustomThumbs(g,_,{allow_onresize:!1});var c=a.getOptions();s=jQuery.extend(s,c),u.ratioByWidth=s.tile_width/s.tile_height,u.ratioByHeight=s.tile_height/s.tile_width,s.tile_size_by==i.sizeby.GLOBAL_RATIO&&u.isTextpanelOutside&&(u.hasImageContainer=!0)}function _(){var e=r.isMobileMode();switch(u.isTextPanelHidden=!1,1==e&&0==s.tile_textpanel_always_on&&(u.isTextPanelHidden=!0),u.isVideoplayIconAlwaysOn=s.tile_videoplay_icon_always_on,s.tile_videoplay_icon_always_on){case"always":u.isVideoplayIconAlwaysOn=!0;break;case"never":u.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":u.isVideoplayIconAlwaysOn=1==e;break;case"desktop_only":u.isVideoplayIconAlwaysOn=0==e}}function g(e,t){if(e.addClass("ug-tile"),u.funcCustomTileHtml)return u.funcCustomTileHtml(e,t),!1;var n="";1==u.hasImageContainer&&(n+="<div class='ug-image-container ug-trans-enabled'>");var a="ug-thumb-image";0!=s.tile_enable_image_effect&&1!=s.tile_image_effect_reverse||(a+=" ug-trans-enabled");var l=o.stripTags(t.title);l=o.htmlentitles(l),n+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+l+"' class='"+a+"'>",1==u.hasImageContainer&&(n+="</div>"),e.append(n),s.tile_size_by==i.sizeby.GLOBAL_RATIO&&e.fadeTo(0,0);var d={};if(1==s.tile_enable_background&&(d["background-color"]=s.tile_background_color),1==s.tile_enable_border&&(d["border-width"]=s.tile_border_width+"px",d["border-style"]="solid",d["border-color"]=s.tile_border_color,s.tile_border_radius&&(d["border-radius"]=s.tile_border_radius+"px")),1==s.tile_enable_outline&&(d.outline="1px solid "+s.tile_outline_color),1==s.tile_enable_shadow){var _=s.tile_shadow_h+"px ";_+=s.tile_shadow_v+"px ",_+=s.tile_shadow_blur+"px ",_+=s.tile_shadow_spread+"px ",_+=s.tile_shadow_color,d["box-shadow"]=_}e.css(d);var g="";if(s.tile_enable_icons){if(0==s.tile_as_link&&1==s.tile_enable_action){var c="ug-button-play ug-icon-zoom";"image"!=t.type&&(c="ug-button-play ug-icon-play"),g+="<div class='ug-tile-icon "+c+"' style='display:none'></div>"}if(t.link&&1==s.tile_show_link_icon||1==s.tile_as_link)if(0==s.tile_as_link){var h="";1==s.tile_link_newpage&&(h=" target='_blank'"),g+="<a href='"+t.link+"'"+h+" class='ug-tile-icon ug-icon-link'></a>"}else g+="<div class='ug-tile-icon ug-icon-link' style='display:none'></div>";var m=u.isSaparateIcons;if(0==m&&"image"!=t.type&&1==u.isVideoplayIconAlwaysOn&&(m=!0),m)var f=e;else f=e.children(".ug-thumb-overlay");f.append(g);var b=f.children("."+c);0==b.length?b=null:b.hide();var v=f.children(".ug-icon-link");0==v.length?v=null:v.hide(),v||1!=s.tile_enable_action||e.addClass("ug-tile-clickable")}else 1==s.tile_enable_action&&e.addClass("ug-tile-clickable");if(1==s.tile_enable_image_effect){var y="";0==s.tile_image_effect_reverse&&(y=" ug-trans-enabled");var I="<div class='ug-tile-image-overlay"+y+"' >",w=" ug-"+s.tile_image_effect_type+"-effect";I+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+t.title+"' class='"+w+y+"'>",I+="</div>",e.append(I),1==s.tile_image_effect_reverse&&e.children(".ug-tile-image-overlay").fadeTo(0,0)}if(1==s.tile_enable_textpanel){var E=new UGTextPanel;E.init(r,s,"tile");var T="";1!=s.tile_textpanel_always_on&&1!=u.isTextpanelOutside||(T="ug-trans-enabled"),E.appendHTML(e,T);var S=t.title,P="";switch(s.tile_textpanel_source){case"desc":case"description":S=t.description;break;case"desc_title":""!=t.description&&(S=t.description);break;case"title_and_desc":S=t.title,P=t.description}if(E.setTextPlain(S,P),0==s.tile_textpanel_always_on&&E.getElement().fadeTo(0,0),e.data("objTextPanel",E),1==s.tile_textpanel_always_on)p(e).css("z-index",2);if(1==u.isTextpanelOutside){e.append("<div class='ug-tile-cloneswrapper'></div>");var x=e.children(".ug-tile-cloneswrapper"),j=new UGTextPanel;j.init(r,s,"tile"),j.appendHTML(x),j.setTextPlain(S,P),e.data("objTextPanelClone",j)}}null!==t.addHtml&&e.append(t.addHtml)}function c(e){return e.children(".ug-tile-image-overlay")}function h(e){return e.data("objTextPanel")}function p(e){return e.children(".ug-textpanel")}function m(e){if(1==u.isTextpanelOutside)var t=function(e){var t=e.find(".ug-tile-cloneswrapper .ug-textpanel");if(0==t.length)throw new Error("text panel cloned element not found");return t}(e);else t=p(e);return t?o.getElementSize(t).height:0}function f(e){var t=e.find(".ug-icon-link");return 0==t.length?null:t}function b(e){var t=e.find(".ug-button-play");return 0==t.length?null:t}function v(e){return!!e.hasClass("ug-thumb-over")}function y(e){return e.hasClass("ug-tile-clickable")}function I(e){return 1==s.tile_enable_icons&&1==u.isVideoplayIconAlwaysOn&&"image"!=e.type}function w(e,t,n,r){var a=c(e),l=i.getTileImage(e),d=function(e){return e.find(".ug-tile-image-overlay img")}(e);t-=u.tileInnerReduce,n-=u.tileInnerReduce;var _=null;if(1==u.isTextpanelOutside){var g=m(e);if(n-=g,"top"==s.tile_textpanel_position&&(_=g),1==u.hasImageContainer){var h=function(e){return 0==u.hasImageContainer?null:e.children(".ug-image-container")}(e);o.setElementSize(h,t,n),null!==_&&o.placeElement(h,0,_)}}if(0==s.tile_enable_image_effect)o.scaleImageCoverParent(l,t,n),0==u.hasImageContainer&&null!==_&&o.placeElement(l,0,_);else{var p="nothing";!0===r&&0==u.isTextpanelOutside&&(p=1==s.tile_image_effect_reverse?"effect":"image"),"effect"!=p&&(o.setElementSize(a,t,n),null!==_&&o.placeElement(a,0,_),o.scaleImageCoverParent(d,t,n)),"image"!=p&&(1==u.hasImageContainer?o.scaleImageCoverParent(l,t,n):"effect"==p?(o.scaleImageCoverParent(l,t,n),null!==_&&o.placeElement(l,0,_)):o.cloneElementSizeAndPos(d,l,!1,null,_))}}function E(e,t,n,r){var o=null;if(n&&(o=n-u.tileInnerReduce),r&&(r-=u.tileInnerReduce),"clone"==t)return function(e){return e.data("objTextPanelClone")}(e).refresh(!0,!0,o),i.getItemByTile(e).textPanelCloneSizeSet=!0,!1;var a=h(e);if(!a)return!1;var l=null;if(1==u.isTextpanelOutside&&(l=m(e)),a.refresh(!1,!0,o,l),1==s.tile_textpanel_always_on||"fade"==s.tile_textpanel_appear_type)if(1==u.isTextpanelOutside&&r&&"bottom"==s.tile_textpanel_position){var d=r-l;a.positionPanel(d)}else a.positionPanel()}function T(e){i.getItemByTile(e);var t=b(e),n=f(e),r=o.getElementSize(e);w(e,r.width,r.height),1==s.tile_enable_textpanel&&E(e,"regular",r.width,r.height);var a=r.width-u.tileInnerReduce,l=r.height-u.tileInnerReduce,d=0;if(1==u.isTextpanelOutside){var _=m(e);l-=_,"top"==s.tile_textpanel_position&&(d=_)}var g=function(e){return e.children(".ug-thumb-overlay")}(e);if(o.setElementSizeAndPosition(g,0,d,a,l),t||n){var c=0;if(1==s.tile_enable_textpanel&&0==u.isTextPanelHidden&&0==u.isTextpanelOutside){var h=p(e),v=o.getElementSize(h);v.height>0&&(c=Math.floor(v.height/2*-1))}}if(t&&n){var y=o.getElementSize(t),I=o.getElementSize(n),T=s.tile_space_between_icons,S=y.width+T+I.width,P=Math.floor((r.width-S)/2);P<T&&(T=Math.floor((r.width-y.width-I.width)/3),S=y.width+T+I.width,P=Math.floor((r.width-S)/2)),o.placeElement(t,P,"middle",0,c),o.placeElement(n,P+y.width+T,"middle",0,c)}else t&&o.placeElement(t,"center","middle",0,c),n&&o.placeElement(n,"center","middle",0,c);t&&t.show(),n&&n.show()}function S(e,t){i.getItemByTile(e);var n=c(e),r=s.thumb_transition_duration;if(0==s.tile_image_effect_reverse){var o=i.getTileImage(e);t?(o.fadeTo(0,1),n.stop(!0).fadeTo(r,0)):n.stop(!0).fadeTo(r,1)}else t?n.stop(!0).fadeTo(r,1):n.stop(!0).fadeTo(r,0)}function P(e,t){var i=s.thumb_transition_duration,n=p(e);if(!n)return!0;if("slide"==s.tile_textpanel_appear_type){var r=o.getElementSize(n);if(0==r.width)return!1;var a=-r.height,l={},u={},d="bottom";"inside_top"==s.tile_textpanel_position&&(d="top"),l[d]=a+"px",u[d]="0px",1==t?(n.fadeTo(0,1),0==n.is(":animated")&&n.css(l),u.opacity=1,n.stop(!0).animate(u,i)):n.stop(!0).animate(l,i)}else 1==t?n.stop(!0).fadeTo(i,1):n.stop(!0).fadeTo(i,0)}function x(e,t,i){var n=s.thumb_transition_duration;i&&!0===i&&(n=0);var r=b(e),o=f(e),a=t?1:0;r&&r.stop(!0).fadeTo(n,a),o&&o.stop(!0).fadeTo(n,a)}function j(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!0),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&0==u.isTextPanelHidden&&P(t,!0),u.isSaparateIcons&&1==s.tile_enable_icons){var n=1==s.thumb_overlay_reverse;0==I(i.getItemByTile(t))&&x(t,n,!1)}}function C(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!1),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&P(t,!1),1==u.isSaparateIcons&&1==s.tile_enable_icons){var n=1!=s.thumb_overlay_reverse;0==I(i.getItemByTile(t))?x(t,n,!1):x(t,!0,!0)}}function A(e,t,i){if(t=jQuery(t),1==s.tile_visible_before_image&&!0!==t.data("image_placed")&&!0!==i)return!0;T(t),a.setThumbNormalStyle(t)}function M(e,t,i){T(t),i.fadeTo(0,1),t.data("image_placed",!0)}function O(e){if(1==y(e))return n.trigger(i.events.TILE_CLICK,e),!0;var t;0==v(e)&&(t=e,a.getThumbs().not(t).each(function(e,t){a.setThumbNormalStyle(jQuery(t))}),a.setThumbOverStyle(e))}function z(e){var t=jQuery(this),r=t.prop("tagName").toLowerCase(),o=!0;if(u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(o=!1),"a"==r)0==o&&e.preventDefault();else if(0==v(t))1==o&&O(t);else{if(0==y(t))return!0;1==o&&n.trigger(i.events.TILE_CLICK,t)}}function L(e){e.stopPropagation();var t=jQuery(this).parents(".ug-tile"),r=!0;return u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(r=!1),0==v(t)?(O(t),!0):1==r?(n.trigger(i.events.TILE_CLICK,t),!1):void 0}function N(e){var t=jQuery(this).parents(".ug-tile");u.funcParentApproveClick&&0==u.funcParentApproveClick()&&e.preventDefault(),0==v(t)&&0==s.tile_as_link&&(e.preventDefault(),O(t))}this.loadTileImage=function(e){var t=i.getTileImage(e);o.checkImagesLoaded(t,null,function(t,i){M(null,e,jQuery(t))})},this.setHtml=function(t,i){e=t,!0!==i&&_(),a.setHtmlThumbs(t,i)},this.initEvents=function(){a.initEvents(),jQuery(a).on(a.events.SETOVERSTYLE,j),jQuery(a).on(a.events.SETNORMALSTYLE,C),jQuery(a).on(a.events.PLACEIMAGE,M),t.on(u.eventSizeChange,A),e.on("click",".ug-tile",z),e.on("click",".ug-tile .ug-button-play",L),e.on("click",".ug-tile .ug-icon-link",N)},this.destroy=function(){if(e.off("click",".ug-tile"),e.off("click",".ug-tile .ug-button-play"),e.off("click",".ug-tile .ug-icon-link"),jQuery(a).off(a.events.SETOVERSTYLE),jQuery(a).off(a.events.SETNORMALSTYLE),jQuery(a).off(a.events.PLACEIMAGE),t.off(u.eventSizeChange),1==s.tile_enable_textpanel){var i=a.getThumbs();jQuery.each(i,function(e,t){var i=h(jQuery(t));i&&i.destroy()})}a.destroy()},this.init=function(e,t,i){d(e,t)},this.setFixedMode=function(){s.tile_size_by=i.sizeby.GLOBAL_RATIO,s.tile_visible_before_image=!0},this.setApproveClickFunction=function(e){u.funcParentApproveClick=e},this.resizeTile=function(e,t,n,r){if(1==u.isTextpanelOutside&&E(e,"clone",t),t){if(!n)n=i.getTileHeightByWidth(t,e)}else{t=s.tile_width;var n=s.tile_height}switch(o.setElementSize(e,t,n),r){default:case i.resizemode.FULL:i.triggerSizeChangeEvent(e,!0);break;case i.resizemode.WRAPPER_ONLY:return!0;case i.resizemode.VISIBLE_ELEMENTS:if(u.funcCustomTileHtml)return i.triggerSizeChangeEvent(e,!0),!0;w(e,t,n,!0),1==s.tile_enable_textpanel&&1==s.tile_textpanel_always_on&&t&&E(e,"regular",t,n)}},this.resizeAllTiles=function(e,t,n){_();var r=null;if(s.tile_size_by==i.sizeby.GLOBAL_RATIO&&(r=i.getTileHeightByWidth(e)),!n)n=a.getThumbs();n.each(function(n,o){i.resizeTile(jQuery(o),e,r,t)})},this.triggerSizeChangeEvent=function(e,i){if(!e)return!1;if(!i)i=!1;t.trigger(u.eventSizeChange,[e,i])},this.triggerSizeChangeEventAllTiles=function(e){a.getThumbs().each(function(){var t=jQuery(this);i.triggerSizeChangeEvent(t,e)})},this.disableEvents=function(){a.getThumbs().css("pointer-events","none")},this.enableEvents=function(){a.getThumbs().css("pointer-events","auto")},this.setOptions=function(e){s=jQuery.extend(s,e),a.setOptions(e)},this.setTileSizeOptions=function(e){if(s.tile_size_by!==i.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");s.tile_width=e,s.tile_height=Math.floor(e*u.ratioByHeight)},this.setCustomFunctions=function(e,t){u.funcCustomTileHtml=e,u.funcCustomPositionElements=t},this.run=function(e){var t=a.type.GET_THUMBS_ALL;!0===e&&(t=a.type.GET_THUMBS_NEW);var n=a.getThumbs(t);s.tile_size_by==i.sizeby.GLOBAL_RATIO&&i.resizeAllTiles(s.tile_width,i.resizemode.WRAPPER_ONLY,n),1==s.tile_enable_image_effect&&0==s.tile_image_effect_reverse&&n.children(".ug-thumb-image").fadeTo(0,0),a.setHtmlProperties(n),1==s.tile_visible_before_image&&(n.children(".ug-thumb-image").fadeTo(0,0),a.loadThumbsImages())},this._____________EXTERNAL_GETTERS____________=function(){},this.getObjThumbs=function(){return a},this.getOptions=function(){return s},this.getTileImage=function(e){return e.find("img.ug-thumb-image")},this.getItemByTile=function(e){return a.getItemByThumb(e)},this.getTileHeightByWidth=function(e,t){var n=function(e){var t=u.ratioByHeight;switch(s.tile_size_by){default:t=u.ratioByHeight;break;case i.sizeby.IMAGE_RATIO:if(!e)throw new Error("tile should be given for tile ratio");var n=i.getItemByTile(e);if(void 0!==n.thumbRatioByHeight){if(0==n.thumbRatioByHeight)throw trace(n),new Error("the item ratio not inited yet");t=n.thumbRatioByHeight}break;case i.sizeby.CUSTOM:return null}return t}(t);if(null===n)return null;var r=Math.floor((e-u.tileInnerReduce)*n)+u.tileInnerReduce;return t&&1==u.isTextpanelOutside&&s.tile_size_by==i.sizeby.IMAGE_RATIO&&(r+=m(t)),r},this.getTileImageSize=function(e){var t=i.getItemByTile(e);if(!t.thumbWidth||!t.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:t.thumbWidth,height:t.thumbHeight}},this.getGlobalTileSize=function(){if(s.tile_size_by!=i.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:s.tile_width,height:s.tile_height}}}function UGTiles(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGTileDesign,d=new UGThumbsGeneral,_={},g={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0};this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"};var c={isFirstTimeRun:!0,handle:null,isTransActive:!1,isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1},h={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};function p(i,n){g_objects=i.getObjects(),s=i,e=jQuery(i),t=g_objects.g_objWrapper,g_objects.g_arrItems,g=jQuery.extend(g,n),function(){g.tiles_min_columns<1&&(g.tiles_min_columns=1);0!=g.tiles_max_columns&&g.tiles_max_columns<g.tiles_min_columns&&(g.tiles_max_columns=g.tiles_min_columns)}(),u.init(i,g),d=u.getObjThumbs()}function m(){if(i.addClass("ug-tiles-rest-mode"),c.isTransInited=!0,1==g.tiles_enable_transition){i.addClass("ug-tiles-transit");var e=u.getOptions();1==e.tile_enable_image_effect&&0==e.tile_image_effect_reverse&&i.addClass("ug-tiles-transit-overlays"),c.isTransActive=!0}}function f(){return l.getElementSize(i).width}function b(){return 0!=c.isTransInited&&(i.addClass("ug-tiles-transition-active"),i.removeClass("ug-tiles-rest-mode"),0!=c.isTransActive&&void u.disableEvents())}function v(){if(0==c.isTransInited)return!1;i.removeClass("ug-tiles-transition-active"),i.addClass("ug-tiles-rest-mode")}function y(){1==c.isTransActive?(setTimeout(function(){u.enableEvents(),u.triggerSizeChangeEventAllTiles(),v()},800),c.handle&&clearTimeout(c.handle),c.handle=setTimeout(function(){v(),u.triggerSizeChangeEventAllTiles(),c.handle=null},2e3)):(u.triggerSizeChangeEventAllTiles(),v())}function I(){_.colWidth=(_.availWidth-_.colGap*(_.numCols-1))/_.numCols,_.colWidth=Math.floor(_.colWidth),_.totalWidth=l.getSpaceByNumItems(_.numCols,_.colWidth,_.colGap)}function w(){if(_.colWidth=g.tiles_col_width,_.minCols=g.tiles_min_columns,_.maxCols=g.tiles_max_columns,0==s.isMobileMode()?_.colGap=g.tiles_space_between_cols:_.colGap=g.tiles_space_between_cols_mobile,_.galleryWidth=f(),_.availWidth=_.galleryWidth,1==g.tiles_include_padding&&(_.availWidth=_.galleryWidth-2*_.colGap),1==g.tiles_exact_width)_.numCols=l.getNumItemsInSpace(_.availWidth,_.colWidth,_.colGap),_.maxCols>0&&_.numCols>_.maxCols&&(_.numCols=_.maxCols),_.numCols<_.minCols?(_.numCols=_.minCols,I()):_.totalWidth=_.numCols*(_.colWidth+_.colGap)-_.colGap;else{var e=l.getNumItemsInSpaceRound(_.availWidth,_.colWidth,_.colGap);e<_.minCols?e=_.minCols:0!=_.maxCols&&e>_.maxCols&&(e=_.maxCols),_.numCols=e,I()}switch(g.tiles_align){case"center":default:_.addX=Math.round((_.galleryWidth-_.totalWidth)/2);break;case"left":_.addX=0;break;case"right":_.addX=_.galleryWidth-_.totalWidth}for(_.arrPosx=[],col=0;col<_.numCols;col++){var t=l.getColX(col,_.colWidth,_.colGap);_.arrPosx[col]=t+_.addX}}function E(){_.maxColHeight=0,_.colHeights=[0]}function T(e,t,n,r){if(null==r)r=function(){var e=0,t=999999999;for(col=0;col<_.numCols;col++){if(null==_.colHeights[col]||0==_.colHeights[col])return col;_.colHeights[col]<t&&(e=col,t=_.colHeights[col])}return e}();var o=0;void 0!==_.colHeights[r]&&(o=_.colHeights[r]);var a=u.getTileHeightByWidth(_.colWidth,e);if(null===a){if(1==g.tiles_enable_transition)throw new Error("Can't know tile height, please turn off transition");a=l.getElementSize(e).height}var s=_.arrPosx[r];l.placeElement(e,s,o);var d=o+a;_.colHeights[r]=d+_.colGap,_.maxColHeight<d&&(_.maxColHeight=d),1==t&&e.show().fadeTo(0,1),1==n&&i.height(_.maxColHeight)}function S(e){e||(e=!1),w(),E();var t=d.getThumbs(d.type.GET_THUMBS_RATIO);b(),u.resizeAllTiles(_.colWidth,u.resizemode.VISIBLE_ELEMENTS,t);for(var n=0;n<t.length;n++){var r=jQuery(t[n]),o=void 0;1==g.tiles_keep_order&&(o=l.getColByIndex(_.numCols,n)),T(r,e,!1,o)}y();var a=i.height();1==c.isTransActive&&a>_.maxColHeight?setTimeout(function(){i.height(_.maxColHeight)},700):i.height(_.maxColHeight)}function P(e,t){if(!0!==t&&0==function(e){var t=e.index();if(!0===s.getItem(t).ordered_placed)return!1;var i=l.getPrevRowSameColIndex(t,_.numCols);return i<0||!0===s.getItem(i).ordered_placed}(e))return!1;var i=e.index(),n=l.getColByIndex(_.numCols,i),r=s.getItem(i);u.resizeTile(e,_.colWidth),T(e,!0,!0,n),r.ordered_placed=!0;var o=s.getNumItems(),a=l.getNextRowSameColIndex(i,_.numCols);if(a>=o)return!1;var g=d.getThumbByIndex(a),c=s.getItem(a);d.isThumbLoaded(g);d.isThumbLoaded(g)&&!c.ordered_placed&&P(g,!0)}function x(){var e=d.getThumbs(d.type.GET_THUMBS_NO_RATIO);if(!e||0==e.length)return!1;if(c.isAllLoaded=!1,1==c.isFirstPlaced){w(),E();var t=Math.abs(_.galleryWidth-_.totalWidth);if(1==g.tiles_set_initial_height&&0==l.isScrollbarExists()&&t<25){e.length;var n=Math.ceil(e.length/_.numCols)*g.tiles_col_width*.75;i.height(n),w()}}e.fadeTo(0,0);var r=e.find("img.ug-thumb-image"),h=_.numCols,p=_.galleryWidth;l.checkImagesLoaded(r,function(){w(),h==_.numCols&&p==_.galleryWidth||S(!1),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){1==c.isFirstPlaced&&s.triggerEvent(o.events.TILES_FIRST_PLACED),function(e,t){if(1==t)return!1;e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e),1==g.tiles_keep_order?P(i):(u.resizeTile(i,_.colWidth),T(i,!0,!0))}(e,t)})}function j(){var e=f(),t=d.getThumbs(!0),i=g.tiles_justified_row_height,n=[],r=0,o=g.tiles_justified_space_between,a=t.length;jQuery.each(t,function(e,t){t=jQuery(t);var o=d.getItemByThumb(t),a=o.thumbWidth;o.thumbHeight!==i&&(a=Math.floor(o.thumbRatioByWidth*i)),n[e]=a,r+=a});var s=Math.ceil(r/e);s>a&&(s=a);var l=r/s,u=[],_=0,c=[],h=[],p=0,m=0;jQuery.each(t,function(e,t){var i=n[e];p+i/2>(m+1)*l&&(c[u.length]=_,u.push(h),h=[],_=0,m++),p+=i,_+=i,h.push(t)}),c[u.length]=_,u.push(h);var b=[],v=[],y=0;return jQuery.each(u,function(t,r){r.length;var a=c[t],s=(r.length-1)*o,l=(e-s)/a,u=Math.round(i*l);y+=u,t>0&&(y+=o),v.push(u);var d=u/i,_=[],g=s;jQuery.each(r,function(e,t){var i=jQuery(t).index(),r=n[i],o=Math.round(r*d);_[e]=o,g+=o});var h=g-e;jQuery.each(_,function(e,t){if(0==h)return!1;h<0?(_[e]=t+1,h++):(_[e]=t-1,h--),e==_.length-1&&0!=h&&(_[e]-=h)}),b[t]=_}),{arrRows:u,arrRowWidths:b,arrRowHeights:v,gap:o,totalHeight:y}}function C(e){if(!e)e=!1;var t=f(),n=j();i.height(n.totalHeight),f()!=t&&(n=j()),b();var r=0,o=0;jQuery.each(n.arrRows,function(t,i){var a=n.arrRowWidths[t],s=n.arrRowHeights[t],d=0;jQuery.each(i,function(t,i){var _=jQuery(i),g=s,c=a[t];u.resizeTile(_,c,g,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(_,d,r),(d+=c)>o&&(o=d),d+=n.gap,1==e&&jQuery(i).show()}),r+=s+n.gap}),y()}function A(){var e=f();switch(h.galleryWidth=e,n={},h.colWidth=g.tiles_nested_col_width,h.optimalTileWidth=g.tiles_nested_optimal_tile_width,h.currentGap=g.tiles_space_between_cols,1==s.isMobileMode()&&(h.currentGap=g.tiles_space_between_cols_mobile),null==h.colWidth?h.colWidth=Math.floor(h.optimalTileWidth/h.nestedOptimalCols):h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.maxColumns=l.getNumItemsInSpace(e,h.colWidth,h.currentGap),h.colWidth=l.getItemSizeInSpace(e,h.maxColumns,h.currentGap),h.gridY=0,r=[],d.getThumbs(!0).each(function(){var e=function(e){var t,i,n={},r=h.colWidth,o=h.currentGap,a=u.getTileImageSize(e),s=e.index(),l=Math.ceil(function(e){return Math.abs(Math.sin(Math.abs(1e3*Math.sin(e))))}(s)*(1*h.nestedOptimalCols/3)+2*h.nestedOptimalCols/3),d=a.width,_=a.height,g=d/_;d>_?(t=l,0==(i=Math.round(t/g))&&(i=1)):(i=l,0==(t=Math.round(i*g))&&(t=1));return n.dimWidth=t,n.dimHeight=i,n.width=t*r+o*(t-1),n.height=i*r+o*(i-1),n.imgWidth=d,n.imgHeight=_,n.left=0,n.top=0,n}(jQuery(this));r.push(e)}),h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.totalWidth=h.maxColumns*(h.colWidth+h.currentGap)-h.currentGap,g.tiles_align){case"center":default:h.addX=Math.round((h.galleryWidth-h.totalWidth)/2);break;case"left":h.addX=0;break;case"right":h.addX=h.galleryWidth-h.totalWidth}h.maxGridY=0}function M(e){var t=f();A(),O();var n=h.maxGridY*(h.colWidth+h.currentGap)-h.currentGap;i.height(n),f()!=t&&(A(),O()),0==g.tiles_nested_debug&&function(e){if(!e)var e=!1;b();for(var t=0;t<r.length;t++)U(t,e);i.height(h.maxColHeight),y()}(e)}function O(e){if(1==g.tiles_nested_debug)return void 0===e&&(e=!0),function(e,t){if(0==t){for(var i=h.currentItem;i<r.length;i++)z(i,!0);h.currentItem=r.length-1}else z(h.currentItem,!0);for(i=0;i<=h.currentItem;i++)U(i,!0);h.currentItem++}(0,e),!1;for(var t=0;t<r.length;t++)z(t,!0)}function z(e,t){if(!t)t=!1;h.maxColHeight=0;for(var i=l.getObjectLength(n),r=h.gridY;r<=i+1;r++){for(var o=0;o<h.maxColumns;o++){if(0==Q(h.gridY)||0==B(h.gridY,o))return void L(e,D(o),o)}h.gridY++}}function L(e,t,i){var o=jQuery.extend(!0,{},r[e]),a=o.dimWidth,s=t-o.dimWidth,l=h.nestedOptimalCols;if(t<=o.dimWidth||s<=.33*l||t<=l)H(e,t);else if(s<=l)l>=4?1==G(Math.floor(t/2),i)?H(e,Math.floor(t/2)+1):H(e,Math.floor(t/2)):H(objImage,t);else if(1==G(a,i))switch(a>=l){case!0:H(e,a-1);break;case!1:H(e,a+1)}var u,d,_,g,c,p,m,f,b,v=function(e,t,i){var r=h.gridY-1,o=0,a=0,s=1,l=[],u=[];if(l.push(e),r>=0){for(a=0;r>=0;){if(o=n[r][i],void 0!==n[r][i-1]&&n[r][i-1]==n[r][i]||void 0!==n[r][i+t]&&n[r][i+t-1]==n[r][i+t]||n[r][i]!=n[r][i+t-1])return u.push(s),u.push(l),u;a!=o&&(s++,l.push(o)),r--,a=o}return u.push(s),u.push(l),u}return[0,[]]}(e,(o=jQuery.extend(!0,{},r[e])).dimWidth,i);if(h.columnsValueToEnableHeightResize<=v[0]&&h.maxColumns>=2*h.nestedOptimalCols){var y=function(e,t){var i=0,r=0,o=t.dimWidth,a=t.dimHeight,s=0,l=0,u=jQuery.map(n,function(e,t){return[e]});if(void 0===u[h.gridY]||void 0===u[h.gridY][e-1])r=0;else for(var d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e-1];)s=n[h.gridY+d][e-2],d++,r++;if(void 0===u[h.gridY]||void 0===u[h.gridY][e+o])i=0;else for(d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e+o];)l=n[h.gridY+d][e+o+1],d++,i++;var _=0,g=0;Math.abs(a-r)<Math.abs(a-i)&&0!=r?(_=r,g=s):0!=i?(_=i,g=l):_=a;return{newHeight:_,idToResize:g}}(i,o),I=k(e,y.newHeight,!0);r[e].dimHeight=I.dimHeight;var w=function(e,t){for(var i=0,n=0,o=[],a=0,s=0,l=0;l<e[1].length;l++){var u=e[1][l],d=r[e[1][l]];if(n+=d.dimHeight,0!=l)i+=d.dimHeight,o.push([u,d.dimHeight]);else{var _=H(u,t,!0);i+=_.dimHeight,o.push([e[1][l],_.dimHeight])}}a=d.left,s=d.top;for(var g=n,c=[],l=o.length-1;l>=0;l--){var h,u=o[l][0];0!=l?(h=Math.max(Math.round(1*n/3),Math.floor(o[l][1]*(n/i))),g-=h,(_=k(u,h,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}),s+=_.dimHeight):((_=k(u,h=g,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}))}return c}(v,I.dimWidth),E=!1;(function(e){for(var t=0,i=0,r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&h.maxColumns>o.left+o.dimWidth&&(a=n[o.top+o.dimHeight-1][o.left+o.dimWidth],s=n[o.top+o.dimHeight][o.left+o.dimWidth]),a!=s&&t++}for(var r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&o.left-1>=0&&(a=n[o.top+o.dimHeight-1][o.left-1],s=n[o.top+o.dimHeight][o.left-1]),a!=s&&i++}return Math.max(i,t)})(w)>=2&&(E=!0),y.newHeight>=o.dimHeight&&(o=k(e,y.newHeight,!0));var T=(u=y.idToResize,d=y.newHeight,_=o.dimHeight,g=r[u],c=g.dimHeight,g.dimWidth,p=g.left,m=g.top,parseInt(m/(h.colWidth+h.currentGap)),parseInt(p/(h.colWidth+h.currentGap)),f=k(u,c-d+_,!0),(b=[]).push({tileID:u,sizes:f}),b);return o.top=h.gridY,o.left=i,T.push({tileID:e,sizes:o}),R(T)<R(w)||1==E?void N(T):void N(w)}o.left=i,o.top=h.gridY,r[e]=o,W(e,o,i,h.gridY),h.maxGridY=o.top+o.dimHeight}function N(e){for(var t=0;t<e.length;t++){var i=e[t].sizes,n=e[t].tileID;r[n]=jQuery.extend(!0,{},i),W(n,i,i.left,i.top)}}function H(e,t,i){i||(i=!1);var n=h.colWidth,o=h.currentGap,a=r[e],s=a.imgWidth/a.imgHeight;if(dimWidth=t,dimHeight=Math.round(dimWidth/s),1==i){var l=jQuery.extend(!0,{},a);return l.dimWidth=dimWidth,l.dimHeight=dimHeight,l.width=dimWidth*n+o*(dimWidth-1),l.height=dimHeight*n+o*(dimHeight-1),l}a.dimWidth=dimWidth,a.dimHeight=dimHeight,a.width=dimWidth*n+o*(dimWidth-1),a.height=dimHeight*n+o*(dimHeight-1)}function k(e,t,i){i||(i=!1);var n=r[e],o=n.dimWidth,a=h.colWidth,s=h.currentGap;if(1==i){var l=jQuery.extend(!0,{},n);return l.dimHeight=t,l.width=o*a+s*(o-1),l.height=t*a+s*(t-1),l}n.dimHeight=t,n.width=o*a+s*(o-1),n.height=t*a+s*(t-1)}function R(e){for(var t=0,i=0,n=0;n<e.length;n++){var o=r[e[n].tileID];if(0==o.dimHeight||0==o.height)return;resizeVal=o.dimWidth/o.dimHeight/(o.imgWidth/o.imgHeight),resizeVal<1&&(resizeVal=1/resizeVal),t+=resizeVal,i++}return t/i}function G(e,t){var i=h.gridY-1;return!(i<=0||0==Q(i))&&n[i][t+e-1]!=n[i][t+e]}function D(e){var t=e,i=0;if(1==Q(h.gridY))for(;0==B(h.gridY,t);)i++,t++;else i=h.maxColumns;return i}function Q(e){return void 0!==n[e]}function W(e,t,i,n){for(var r=0;r<t.dimHeight;r++)for(var o=0;o<t.dimWidth;o++)0==Q(n+r)&&F(n+r),Y(n+r,i+o,e)}function F(e){n[e]=new Object;for(var t=0;t<h.maxColumns;t++)n[e][t]=-1}function B(e,t){return-1!=n[e][t]}function Y(e,t,i){n[e][t]=i}function U(e,t){var i=d.getThumbByIndex(e),n=r[e],o=n.top*(h.colWidth+h.currentGap),a=h.addX+n.left*(h.colWidth+h.currentGap);u.resizeTile(i,n.width,n.height,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(i,a,o),o+n.height>h.maxColHeight&&(h.maxColHeight=o+n.height),1==t&&i.fadeTo(0,1)}function V(){if(1==c.isFirstTimeRun)return!0;if(0==c.isAllLoaded)return!1;switch(g.tiles_type){case"columns":S(!1);break;case"justified":C(!1);break;case"nested":1==s.isMobileMode()?S(!1):M(!1)}}function X(){switch(t.children(".ug-tile").show(),1==c.isFirstTimeRun&&(a.on(o.events.ALL_TILES_LOADED,function(){c.isAllLoaded=!0}),e.on(s.events.SIZE_CHANGE,V),e.on(o.events.TILES_FIRST_PLACED,function(){c.isFirstPlaced=!1}),u.initEvents()),u.run(),g.tiles_type){default:case"columns":x();break;case"justified":i=jQuery(t).find("img.ug-thumb-image"),n=d.getThumbs(),c.isAllLoaded=!1,n.fadeTo(0,0),l.checkImagesLoaded(i,function(){setTimeout(function(){C(!0),n.fadeTo(0,1),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)})},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)});break;case"nested":!function(){var e=jQuery(t).find("img.ug-thumb-image"),i=d.getThumbs();c.isAllLoaded=!1,i.fadeTo(0,0),l.checkImagesLoaded(e,function(){1==s.isMobileMode()?S(!0):M(!0),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)})}()}var i,n;c.isFirstTimeRun=!1}this.destroy=function(){e.off(s.events.SIZE_CHANGE),u.destroy(),e.off(o.events.TILES_FIRST_PLACED)},this.init=function(e,t){p(e,t)},this.setHtml=function(e){!function(e){e||(e=i||t);i=e;var n=g.tiles_type;e.addClass("ug-tiletype-"+n),u.setHtml(e),e.children(".ug-thumb-wrapper").hide()}(e)},this.getObjTileDesign=function(){return u},this.run=function(){X()},this.runNewItems=function(){if(!i)throw new Error("Can't run new items - parent not set");switch(u.setHtml(i,!0),u.run(!0),g.tiles_type){case"columns":x();break;default:case"justified":case"nested":throw new Error("Tiles type: "+g.tiles_type+" not support load more yet")}}}function UGAviaControl(){var e,t,i,n,r,o,a={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",isStripMoving:!1,isControlEnabled:!0,maxDpos:1e3};function s(t){if(0==a.isControlEnabled)return!0;if(1==a.touchEnabled)return jQuery("body").off("mousemove"),!0;a.isMouseInsideStrip=i.ismouseover();var s=e.isTouchMotionActive();1==a.isMouseInsideStrip&&0==s?function(e){var t=function(e){return 0==o?function(e){var t=r.strip_padding_left,o=r.strip_padding_right,a=i.width()-t-o,s=n.width();if(a>s)return null;var l=i.offset().left,u=e-l-t,d=r.thumb_width,_=a-r.thumb_width;u<d&&(u=d);u>_&&(u=_);var g=(u-d)/(_-d)*(s-a);return g=-1*Math.round(g)+t}(e):function(e){var t=r.strip_padding_top,o=(r.strip_padding_bottom,i.height()),a=n.height();if(o>a)return null;var s=i.offset().top,l=e-s-t;if(l<0)return null;var u=r.thumb_height,d=o-r.thumb_height;l<u&&(l=u);l>d&&(l=d);var _=(l-u)/(d-u)*(a-o);return _=-1*Math.round(_)+t}(e)}(e);if(null===t)return!1;a.is_strip_moving=!0,a.strip_finalPos=t,function(){if(1==a.isStripMoving)return!1;a.isStripMoving=!0,a.handle_timeout=setInterval(l,10)}()}(function(e){return 0==o?e.pageX:e.pageY}(t)):u()}function l(){if(0==a.is_strip_moving)return!1;var t=a.maxDpos,i=e.getInnerStripPos();Math.floor(i)==Math.floor(a.strip_finalPos)&&u();var n,r=Math.abs(a.strip_finalPos-i);r<1?n=r:(n=r/4)>0&&n<1&&(n=1),a.strip_finalPos<i&&(n*=-1),n>t&&(n=t),n<-t&&(n=-t);var o=i+n;e.positionInnerStrip(o)}function u(){if(0==a.isStripMoving)return!1;a.isStripMoving=!1,a.handle_timeout=clearInterval(a.handle_timeout)}this.enable=function(){a.isControlEnabled=!0},this.disable=function(){a.isControlEnabled=!1},this.onResize=function(){},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,jQuery("body").on("touchstart",function(e){if(0==a.isControlEnabled)return!0;a.touchEnabled=!0}),jQuery("body").mousemove(s)},this.destroy=function(){jQuery("body").off("touchstart"),jQuery("body").off("mousemove")}}function UGSlider(){var e,t,i,n,r,o,a,s,l,u,d,_,g,c=this,h=jQuery(c),p=new UniteGalleryMain,m=null,f=null,b=null,v=new UGVideoPlayer,y=new UGFunctions,I=null,w=null;this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"};var E={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!1,slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_skin:"",slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:20,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:20,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square"},T={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},S={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};function P(i,n,r){p=i,r&&(g=r,n=y.convertCustomPrefixOptions(n,g,"slider")),e=jQuery(i);var o=p.getObjects();if(t=o.g_objWrapper,o.g_objThumbs,n.hasOwnProperty("slider_progress_indicator_type")&&(E.slider_progress_indicator_type=n.slider_progress_indicator_type),"bar"==E.slider_progress_indicator_type&&(E=jQuery.extend(E,T)),n&&c.setOptions(n),function(){var e=p.getOptions(),t=e.gallery_skin;""==E.slider_bullets_skin&&(E.slider_bullets_skin=t);""==E.slider_arrows_skin&&(E.slider_arrows_skin=t);""==E.slider_zoompanel_skin&&(E.slider_zoompanel_skin=t);""==E.slider_play_button_skin&&(E.slider_play_button_skin=t);""==E.slider_fullscreen_button_skin&&(E.slider_fullscreen_button_skin=t);E.video_enable_closebutton=E.slider_video_enable_closebutton,"zoom"!=e.gallery_mousewheel_role&&(E.slider_zoom_mousewheel=!1)}(),1==E.slider_enable_bullets){b=new UGBullets;var a={bullets_skin:E.slider_bullets_skin,bullets_space_between:E.slider_bullets_space_between};b.init(p,a)}E.slider_enable_text_panel&&(w=new UGTextPanel).init(p,E,"slider"),E.slider_enable_zoom_panel&&(_=new UGZoomButtonsPanel).init(c,E);var s=p.getGalleryID();v.init(E,!1,s)}function x(){if(1==S.isRunOnce)return!1;if(S.isRunOnce=!0,E.slider_background_color){var t=E.slider_background_color;1!=E.slider_background_opacity&&(t=y.convertHexToRGB(t,E.slider_background_opacity)),i.css("background-color",t)}else 1!=E.slider_background_opacity&&(t=y.convertHexToRGB("#000000",E.slider_background_opacity),i.css("background-color",t));1==E.slider_control_swipe&&(u=new UGTouchSliderControl).init(c,E),1==E.slider_control_zoom&&(d=new UGZoomSliderControl).init(c,E),w&&w.run(),function(){e.on(p.events.ITEM_IMAGE_UPDATED,se),e.on(p.events.ITEM_CHANGE,K),b&&jQuery(b).on(b.events.BULLET_CLICK,J);1==E.slider_enable_arrows&&(y.addClassOnHover(l,"ug-arrow-hover"),y.addClassOnHover(s,"ug-arrow-hover"),p.setNextButton(l),p.setPrevButton(s));0==E.slider_controls_always_on&&i.hover(ie,ne);i.on("touchend click",$),h.on(c.events.CLICK,ee),w&&1==S.isTextPanelSaparateHover&&i.hover(D,G);m&&(y.addClassOnHover(m,"ug-button-hover"),p.setPlayButton(m));f&&(y.addClassOnHover(f,"ug-button-hover"),p.setFullScreenToggleButton(f));d&&h.on(c.events.ZOOM_CHANGE,te);_&&_.initEvents();v.initEvents(),jQuery(v).on(v.events.SHOW,oe),jQuery(v).on(v.events.HIDE,ae),ue(r),ue(o),ue(a),h.on(c.events.AFTER_PUT_IMAGE,le),i.on("mouseenter",".ug-item-wrapper img",function(e){h.trigger(c.events.IMAGE_MOUSEENTER)}),i.on("mouseleave",".ug-item-wrapper img",function(e){var t=c.isMouseInsideSlideImage(e);0==t&&h.trigger(c.events.IMAGE_MOUSELEAVE)})}()}function j(e,t){var i="ug-type-square";"round"==E.slider_videoplay_button_type&&(i="ug-type-round");var n="";return n+="<div class='ug-slide-wrapper ug-slide"+t+"'>",n+="<div class='ug-item-wrapper'></div>",n+="<div class='ug-slider-preloader "+e+"'></div>",n+="<div class='ug-button-videoplay "+i+"' style='display:none'></div>",n+="</div>"}function C(e){e&&(t=e);var u=function(){var e;switch(E.slider_loader_type){default:case 1:e="ug-loader1";break;case 2:e="ug-loader2";break;case 3:e="ug-loader3";break;case 4:e="ug-loader4";break;case 5:e="ug-loader5";break;case 6:e="ug-loader6";break;case 7:e="ug-loader7";break;case 8:e="ug-loader8";break;case 9:e="ug-loader9"}"black"==E.slider_loader_color&&(e+=" ug-loader-black");return e}(),d=(p.getOptions(),"<div class='ug-slider-wrapper'>");(d+="<div class='ug-slider-inner'>",d+=j(u,1),d+=j(u,2),d+=j(u,3),d+="</div>",1==E.slider_enable_arrows&&(d+="<div class='ug-slider-control ug-arrow-left ug-skin-"+E.slider_arrows_skin+"'></div>",d+="<div class='ug-slider-control ug-arrow-right ug-skin-"+E.slider_arrows_skin+"'></div>"),1==E.slider_enable_play_button&&(d+="<div class='ug-slider-control ug-button-play ug-skin-"+E.slider_play_button_skin+"'></div>"),1==E.slider_enable_fullscreen_button&&(d+="<div class='ug-slider-control ug-button-fullscreen ug-skin-"+E.slider_fullscreen_button_skin+"'></div>"),d+="</div>",t.append(d),i=t.children(".ug-slider-wrapper"),n=i.children(".ug-slider-inner"),r=n.children(".ug-slide1"),o=n.children(".ug-slide2"),a=n.children(".ug-slide3"),r.data("slidenum",1),o.data("slidenum",2),a.data("slidenum",3),b&&b.appendHTML(i),1==E.slider_enable_arrows&&(s=i.children(".ug-arrow-left"),l=i.children(".ug-arrow-right")),1==E.slider_enable_play_button&&(m=i.children(".ug-button-play")),1==E.slider_enable_fullscreen_button&&(f=i.children(".ug-button-fullscreen")),1==E.slider_enable_progress_indicator)&&("bar"==(I=y.initProgressIndicator(E.slider_progress_indicator_type,E,i)).getType()&&"pie"==E.slider_progress_indicator_type&&(E.slider_progress_indicator_type="bar",E=jQuery.extend(E,T)),p.setProgressIndicator(I));1==E.slider_enable_text_panel&&(w.appendHTML(i),0==E.slider_textpanel_always_on&&(w.getElement().hide().data("isHidden",!0),S.isTextPanelSaparateHover=!0));1==E.slider_enable_zoom_panel&&_.appendHTML(i),v.setHtml(n)}function A(e){var t=_e(e);y.placeElementInParentCenter(t);var i=ge(e);y.placeElementInParentCenter(i)}function M(){if(b&&(objBullets=b.getElement(),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert)),1==E.slider_enable_arrows&&(y.placeElement(s,E.slider_arrow_left_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_left_offset_hor,E.slider_arrow_left_offset_vert),y.placeElement(l,E.slider_arrow_right_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_right_offset_hor,E.slider_arrow_right_offset_vert)),0==E.slider_controls_always_on&&X(!0),I){var e=I.getElement();if("bar"==E.slider_progress_indicator_type){var t=i.width();I.setSize(t),y.placeElement(e,"left",E.slider_progress_indicator_align_vert,0,E.slider_progress_indicator_offset_vert)}else y.placeElement(e,E.slider_progress_indicator_align_hor,E.slider_progress_indicator_align_vert,E.slider_progress_indicator_offset_hor,E.slider_progress_indicator_offset_vert)}w&&w.positionPanel(),function(){m&&y.placeElement(m,E.slider_play_button_align_hor,E.slider_play_button_align_vert,E.slider_play_button_offset_hor,E.slider_play_button_offset_vert);f&&y.placeElement(f,E.slider_fullscreen_button_align_hor,E.slider_fullscreen_button_align_vert,E.slider_fullscreen_button_offset_hor,E.slider_fullscreen_button_offset_vert);if(_){var e=_.getElement();y.placeElement(e,E.slider_zoompanel_align_hor,E.slider_zoompanel_align_vert,E.slider_zoompanel_offset_hor,E.slider_zoompanel_offset_vert)}}(),A(r),A(o),A(a),p.isMobileMode()?(1==E.slider_fullscreen_button_mobilehide&&f&&f.hide(),1==E.slider_play_button_mobilehide&&m&&m.hide(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().hide()):(1==E.slider_fullscreen_button_mobilehide&&f&&f.show(),1==E.slider_play_button_mobilehide&&m&&m.show(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().show())}function O(){var e,t,i,r,o=c.getSlidesReference(),a=0;i=c.isSlideHasItem(o.objNextSlide),(r=c.isSlideHasItem(o.objPrevSlide))?(a=o.objPrevSlide.outerWidth(),o.objPrevSlide.css("z-index",1)):o.objPrevSlide.hide(),e=t=a+o.objCurrentSlide.outerWidth(),i?(e=t+o.objNextSlide.outerWidth(),o.objPrevSlide.css("z-index",2)):o.objNextSlide.hide(),o.objCurrentSlide.css("z-index",3),y.placeElement(o.objCurrentSlide,a,0),n.css({left:-a+"px",width:e+"px"}),r&&(y.placeElement(o.objPrevSlide,0,0),y.showElement(o.objPrevSlide)),i&&(y.showElement(o.objNextSlide),y.placeElement(o.objNextSlide,t,0))}function z(e){var t=e.data("index");if(void 0===t||null==t)return!1;var i=p.getItem(t);if(!i)return!1;R(e,i)}function L(e){e.stop(!0).hide(100)}function N(e,t,i){var n={};if(1==E.slider_image_border){n["border-style"]="solid";var r=function(e,t){if((a=E.slider_image_border_width)<=10)return a;var i=y.getElementSize(e),n=i.width,r=i.height;if(t&&(t.hasOwnProperty("imageWidth")&&(n=t.imageWidth),t.hasOwnProperty("imageHeight")&&(r=t.imageHeight)),n<=0)return a;var o=n<r?n:r;if(2*a/o<E.slider_image_border_maxratio)return a;var a=o*E.slider_image_border_maxratio/2;return a=Math.round(a)}(e,i);n["border-width"]=r+"px",n["border-color"]=E.slider_image_border_color,n["border-radius"]=E.slider_image_border_radius}"image"!=t&&1==E.slider_video_constantsize&&(n["background-color"]="#000000"),1==E.slider_image_shadow&&(n["box-shadow"]="3px 3px 10px 0px #353535"),e.css(n)}function H(e,t){var i=E.slider_video_constantsize_width,n=E.slider_video_constantsize_height,r=E.slider_video_constantsize_scalemode;return y.scaleImageExactSizeInParent(e,t.imageWidth,t.imageHeight,i,n,r)}function k(e,t,i){var n=e.children(".ug-item-wrapper"),r=_e(e);if(void 0===t.urlImage||""==t.urlImage)throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");var o=t.urlImage,a=e.data("urlImage");e.data("urlImage",o);var s=c.getScaleMode(e),l=c.getSlideType(e);objPadding=c.getObjImagePadding();var u="";if("string"==typeof t.description&&(u=t.description),a==o&&!0!==i){(_=n.children("img")).attr("alt",u),0!=t.imageWidth&&0!=t.imageHeight||p.checkFillImageSize(_,t);var d={};N(_,l,d="image"!=l&&1==E.slider_video_constantsize?H(_,t):y.scaleImageFitParent(_,t.imageWidth,t.imageHeight,s,objPadding)),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else{var _;if((_=y.placeImageInsideParent(o,n,t.imageWidth,t.imageHeight,s,objPadding)).attr("alt",u),1==t.isBigImageLoaded){if(_.fadeTo(0,1),L(r),"image"!=l&&1==E.slider_video_constantsize)d=H(_,t);else d=y.getImageInsideParentData(n,t.imageWidth,t.imageHeight,s,objPadding);_.css("width",d.imageWidth+"px"),N(_,l,d),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else _.fadeTo(0,0),function(e){e.stop(!0).show(100)}(r),e.data("isLoading",!0),c.isSlideCurrent(e)&&h.trigger(c.events.CURRENTSLIDE_LOAD_START),_.data("itemIndex",t.index),_.on("load",function(){var e=jQuery(this),t=e.data("itemIndex");e.fadeTo(0,1);var i=e.parent().parent(),n=c.getSlideType(i),r=_e(i),o=c.getObjImagePadding(),a=c.getScaleMode(i);L(r),i.data("isLoading",!1),c.isSlideCurrent(i)&&h.trigger(c.events.CURRENTSLIDE_LOAD_END),p.onItemBigImageLoaded(null,e);var s=p.getItem(t),l={};"image"!=n&&1==E.slider_video_constantsize?H(e,s):l=y.scaleImageFitParent(e,s.imageWidth,s.imageHeight,a,o),e.fadeTo(0,1),N(e,n,l),h.trigger(c.events.AFTER_PUT_IMAGE,i)})}}function R(e,t){try{var i=e.children(".ug-item-wrapper");if(null==t)return i.html(""),e.removeData("index"),e.removeData("type"),e.removeData("urlImage"),!1;e.data("index");e.data("index",t.index),e.data("type",t.type),1==E.slider_enable_links&&"image"==t.type&&(t.link?e.addClass("ug-slide-clickable"):e.removeClass("ug-slide-clickable")),k(e,t);var n=ge(e);switch(t.type){case"image":n.hide();break;default:n.show()}}catch(e){throw void 0!==e.fileName&&"showbig"==e.fileName&&p.showErrorMessageReplaceGallery(e.message),i.html(""),new Error(e)}}function G(){if(!w)return!1;if(1==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(t=E.slider_controls_appear_duration),e.stop().fadeTo(t,0),e.data("isHidden",!0)}function D(){if(!w)return!1;if(0==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(e.show(),w.positionElements(),t=E.slider_controls_appear_duration),e.stop().show().fadeTo(t,1),e.data("isHidden",!1)}function Q(){return!1!==w.getElement().data("isHidden")}function W(){var e=c.getCurrentSlide(),t=c.getSlideImage(e),i=y.getElementSize(e),n=i.left,r=i.top;if(1==E.slider_video_constantsize){var o=y.getElementSize(t);n+=o.left,r+=o.top}else n+=E.slider_video_padding_left,r+=E.slider_video_padding_top;v.setPosition(n,r)}function F(){var e=E.slider_video_constantsize_width,t=E.slider_video_constantsize_height;v.setSize(e,t),N(v.getObject(),"video")}function B(e,t,i){h.trigger(c.events.TRANSITION_START);var r=E.slider_transition;switch(i&&(r=i),c.stopSlideAction(null,!0),r){default:case"fade":U(t);break;case"slide":!function e(t,i){var r=c.isAnimating();if(1==r)return S.itemWaiting=i,!0;null!=S.itemWaiting&&(S.itemWaiting=null);var o=c.getSlidesReference();switch(t){case"right":R(o.objPrevSlide,i),O();var a=y.getElementSize(o.objPrevSlide),s=-a.left;c.switchSlideNums("right");break;case"left":R(o.objNextSlide,i),O();var l=y.getElementSize(o.objNextSlide),s=-l.left;c.switchSlideNums("left");break;default:throw new Error("wrong direction: "+t)}var u=E.slider_transition_speed;var d=E.slider_transition_easing;var _={duration:u,easing:d,queue:!1,always:function(){if(c.stopSlideAction(),v.hide(),null!=S.itemWaiting){var t=function(e){var t=c.getSlidesReference().objCurrentSlide.data("index"),i=e.index,n="left";t>i&&(n="right");return n}(S.itemWaiting);e(t,S.itemWaiting)}else c.placeNabourItems(),h.trigger(c.events.TRANSITION_END)}};n.animate({left:s+"px"},_)}(e,t);break;case"lightbox_open":U(t,!1,!0)}}function Y(e,t,i){i?e.fadeTo(E.slider_transition_speed,t,i):e.fadeTo(E.slider_transition_speed,t)}function U(e,t,i){if(!t)t=!1;var n=c.getSlidesReference();R(n.objNextSlide,e);var r=y.getElementSize(n.objCurrentSlide);y.placeElement(n.objNextSlide,r.left,r.top);var o=S.numCurrent;if(S.numCurrent=S.numNext,S.numNext=o,h.trigger(c.events.ITEM_CHANGED),n.objNextSlide.stop(!0),n.objCurrentSlide.stop(!0),1==t)n.objCurrentSlide.fadeTo(0,0),n.objNextSlide.fadeTo(0,1),c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide();else{if(n.objNextSlide.fadeTo(0,0),Y(n.objCurrentSlide,0,function(){c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide()}),1==v.isVisible())Y(v.getObject(),0);Y(n.objNextSlide,1)}}function V(){return i.children(".ug-slider-control")}function X(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(0==S.isControlsVisible)return!1;if(!e)e=!1;var t=V();!0===e?t.stop().fadeTo(0,0).hide():t.stop().fadeTo(E.slider_controls_appear_duration,0,function(){t.hide()}),S.isControlsVisible=!1}function Z(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(1==S.isControlsVisible)return!0;if(!e)e=!1;var t=V();!0===e?t.stop().show():(t.stop().show().fadeTo(0,0),t.fadeTo(E.slider_controls_appear_duration,1)),S.isControlsVisible=!0}function q(e){if(e==S.currentControlsMode)return!1;switch(e){case"image":_&&_.getElement().show();break;case"video":_&&_.getElement().hide();break;default:throw new Error("wrong controld mode: "+e)}S.currentControlsMode=e}function K(e,t,i){var n=p.getSelectedItem();c.setItem(n,!1,i);var r=n.index;b&&b.setActive(r),w&&0==S.isTextPanelSaparateHover&&D(),"image"==n.type?q("image"):q("video")}function J(e,t){p.selectItem(t)}function $(e){if(u&&0==u.isTapEventOccured(e))return!0;h.trigger(c.events.CLICK,e)}function ee(){var e=c.getCurrentSlide().hasClass("ug-slide-clickable"),t=c.getCurrentItem();if(e)return 0==E.slider_links_newpage?location.href=t.link:window.open(t.link,"_blank"),!0;0==E.slider_controls_always_on&&1==E.slider_controls_appear_ontap&&1==c.isCurrentSlideType("image")&&(0==S.isControlsVisible?Z():X(),w&&1==E.slider_textpanel_always_on&&c.isCurrentSlideType("image")&&c.isCurrentSlideImageFit()&&D())}function te(e){w&&c.isCurrentSlideType("image")&&0==c.isCurrentSlideImageFit()&&G()}function ie(){Z()}function ne(){X()}function re(e){var t=e.parent();c.startSlideAction(t)}function oe(){p.isPlayMode()&&p.pausePlaying(),h.trigger(c.events.ACTION_START)}function ae(){p.isPlayMode()&&p.continuePlaying(),h.trigger(c.events.ACTION_END)}function se(e,t,i){r.data("index")==t&&(objItem=p.getItem(t),k(r,objItem,!0)),o.data("index")==t&&(objItem=p.getItem(t),k(o,objItem,!0)),a.data("index")==t&&(objItem=p.getItem(t),k(a,objItem,!0))}function le(e,t){t=jQuery(t);var i=c.getSlideImage(t),n=ge(t),r=y.getElementSize(i);y.placeElement(n,"center","middle",r.left,r.top,i)}function ue(e){var t=ge(e);y.addClassOnHover(t),y.setButtonOnClick(t,re)}function de(e){switch(e){case 1:return r;case 2:return o;case 3:return a;default:throw new Error("wrong num: "+e)}}function _e(e){if(!e)e=c.getCurrentSlide();return e.children(".ug-slider-preloader")}function ge(e){return e.children(".ug-button-videoplay")}function ce(e){if(!e)e=c.getCurrentSlide();var t=e.data("index");return null==t?null:p.getItem(t)}this.switchSlideNums=function(e){switch(h.trigger(c.events.BEFORE_SWITCH_SLIDES),e){case"left":var t=S.numCurrent;S.numCurrent=S.numNext,S.numNext=S.numPrev,S.numPrev=t;break;case"right":t=S.numCurrent;S.numCurrent=S.numPrev,S.numPrev=S.numNext,S.numNext=t;break;default:throw new Error("wrong direction: "+e)}h.trigger(c.events.ITEM_CHANGED)},this.destroy=function(){h.off(c.events.AFTER_PUT_IMAGE),e.off(p.events.ITEM_IMAGE_UPDATED),e.off(p.events.ITEM_CHANGE),b&&jQuery(b).on(b.events.BULLET_CLICK),i.off("mouseenter"),i.off("mouseleave"),i.off("touchend"),i.off("click"),h.off(c.events.CLICK),d&&h.off(c.events.ZOOM_CHANGE),h.off(c.events.BEFORE_SWITCH_SLIDES),jQuery(v).off(v.events.SHOW),jQuery(v).off(v.events.HIDE),v.destroy(),i.off("mouseenter",".ug-item-wrapper img"),i.off("mouseleave",".ug-item-wrapper img")},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(e,t,i){P(e,t,i)},this.getSlideImage=function(e){if(!e)e=c.getCurrentSlide();return e.find(".ug-item-wrapper img")},this.setHtml=function(e){C(e)},this.run=function(){x()},this.isInnerInPlace=function(){var e=c.getSlidesReference();return-y.getElementSize(e.objCurrentSlide).left==y.getElementSize(n).left},this.isAnimating=function(){return n.is(":animated")},this.isSlideCurrent=function(e){var t=e.data("slidenum");return S.numCurrent==t},this.isSlideHasItem=function(e){var t=e.data("index");return null!=t},this.getObjImagePadding=function(){return{padding_top:E.slider_image_padding_top,padding_bottom:E.slider_image_padding_bottom,padding_left:E.slider_image_padding_left,padding_right:E.slider_image_padding_right}},this.getSlidesReference=function(){return{objPrevSlide:de(S.numPrev),objNextSlide:de(S.numNext),objCurrentSlide:de(S.numCurrent)}},this.getCurrentSlide=function(){return c.getSlidesReference().objCurrentSlide},this.getCurrentItemIndex=function(){var e=c.getSlidesReference().objCurrentSlide.data("index");return null==e&&(e=-1),e},this.getCurrentItem=function(){var e=c.getCurrentItemIndex();return-1==e?null:p.getItem(e)},this.getSlideType=function(e){return null==e&&(e=c.getCurrentSlide()),e.data("type")},this.isMouseInsideSlideImage=function(e){var t=c.getSlideImage(),i=y.getMousePosition(e);void 0===i.pageX&&(i=u.getLastMousePos());var n=y.getMouseElementPoint(i,t),r=y.getElementSize(t);return isMouseInside=y.isPointInsideElement(n,r),isMouseInside},this.isCurrentSlideType=function(e){return c.getSlideType()==e},this.isCurrentSlideLoadingImage=function(){return!0===c.getCurrentSlide().data("isLoading")},this.setItem=function(e,t,i){var n=c.getSlidesReference(),r=n.objCurrentSlide.data("index"),o=e.index;if(o==r)return!0;if(null==r)R(n.objCurrentSlide,e),c.placeNabourItems();else{var a="left";p.getNumItems();"next"==i?a="left":"prev"==i||r>o?a="right":r>o&&(a="right"),B(a,e,t)}},this.placeNabourItems=function(){var e=c.getSlidesReference(),t=e.objCurrentSlide.data("index"),i=p.getPrevItem(t),n=p.getNextItem(t);R(e.objNextSlide,n),R(e.objPrevSlide,i),O()},this.________EXTERNAL_API___________=function(){},this.stopSlideAction=function(e,t){e||(e=c.getCurrentSlide()),!0===t?v.pause():v.hide()},this.startSlideAction=function(e){e||(e=c.getCurrentSlide());var t=ce(e);if("image"==t.type)return!0;switch(1==E.slider_video_constantsize&&F(),W(),v.show(),t.type){case"youtube":v.playYoutube(t.videoid,!0,t.video_start);break;case"vimeo":v.playVimeo(t.videoid);break;case"html5video":v.playHtml5Video(t.videoogv,t.videowebm,t.videomp4,t.urlImage);break;case"soundcloud":v.playSoundCloud(t.trackid);break;case"wistia":v.playWistia(t.videoid)}},this.getScaleMode=function(e){if(!e)e=c.getCurrentSlide();return"image"!=c.getSlideType(e)?E.slider_scale_mode_media:E.slider_scale_mode==E.slider_scale_mode_fullscreen?E.slider_scale_mode:1==p.isFullScreen()?E.slider_scale_mode_fullscreen:E.slider_scale_mode},this.getObjects=function(){return{g_objSlider:i,g_objInner:n,g_options:E,g_objZoomSlider:d}},this.getObjZoom=function(){return d},this.getOptions=function(){return E},this.getElement=function(){return i},this.getVideoObject=function(){return v},this.isCurrentSlideImageFit=function(){var e=c.getCurrentSlide();c.getSlideType(e);!function(e,t){null==t&&(t=c.getCurrentSlide());var i=c.getSlideType(t);if(i!=e)throw new Error("Wrong slide type: "+i+", should be: "+e)}("image",e);var t=c.getSlideImage(e);return 0!=t.length&&y.isImageFitParent(t)},this.isCurrentImageInPlace=function(){var e=c.getSlideImage();if(0==e.length)return!1;var t=c.getScaleMode(),i=c.getObjImagePadding(),n=ce(),r=e.parent(),o=y.getImageInsideParentData(r,n.imageWidth,n.imageHeight,t,i),a=y.getElementSize(e),s=!1;return o.imageWidth==a.width&&(s=!0),s},this.isSlideActionActive=function(){return v.isVisible()},this.isSwiping=function(){return!!u&&u.isTouchActive()},this.isPreloading=function(){return!!_e().is(":visible")},this.setOptions=function(e){g&&(e=y.convertCustomPrefixOptions(e,g,"slider")),E=jQuery.extend(E,e)},this.setSize=function(e,t){if(e<0||t<0)return!0;var s={};s.width=e+"px",s.height=t+"px",i.css(s);var l={};l.height=t+"px",l.top="0px",l.left="0px",n.css(l);var u={};u.height=t+"px",u.width=e+"px",r.css(u),o.css(u),a.css(u);var d=e-E.slider_item_padding_left-E.slider_item_padding_right,_=t-E.slider_item_padding_top-E.slider_item_padding_bottom,g={};if(g.width=d+"px",g.height=_+"px",g.top=E.slider_item_padding_top+"px",g.left=E.slider_item_padding_left+"px",i.find(".ug-item-wrapper").css(g),w&&w.setSizeByParent(),M(),z(r),z(o),z(a),O(),"image"!=c.getSlideType()&&1==E.slider_video_constantsize)F();else{var h=e-E.slider_video_padding_left-E.slider_video_padding_right,p=t-E.slider_video_padding_top-E.slider_video_padding_bottom;v.setSize(h,p)}W()},this.refreshSlideItems=function(){if(1==c.isAnimating())return!0;z(r),z(o),z(a),O()},this.isMouseOver=function(){return i.ismouseover()},this.setPosition=function(e,t){y.placeElement(i,e,t)},this.zoomIn=function(){if(!d)return!0;d.zoomIn()},this.zoomOut=function(){if(!d)return!0;d.zoomOut()},this.zoomBack=function(){if(!d)return!0;d.zoomBack()}}function UGTextPanel(){var e,t,i,n,r,o,a,s=this,l=new UGFunctions,u="",d={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_title_as_link:!1,textpanel_title_link_newtab:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},_={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};function g(t,a){if(!a)a=d.textpanel_padding_top;var s=a;if(i){var u=s;if(l.placeElement(i,0,u),1==i.is(":visible")){(s=l.getElementSize(i).bottom)>0&&(_.lastTitleBottom=s)}else{s=20;_.lastTitleBottom>0&&(s=_.lastTitleBottom)}}var g="";if(n&&(g=jQuery.trim(n.text())),""!=g){var c=s;if(i&&(c+=d.textpanel_padding_title_description),l.placeElement(n,0,c),1==jQuery(n).is(":visible")){var h=l.getElementSize(n);s=h.bottom,h.height>0&&(_.lastDescHeight=h.height)}else{var p=16;_.lastDescHeight>0&&(p=_.lastDescHeight),s=c+p}}d.textpanel_height||1!=_.setInternalHeight||function(t,i){if(!i)var i=!1;if(1==i){if(r){var n=r.height();t>n&&r.height(t)}var a={height:t+"px"};e.add(o).animate(a,d.textpanel_fade_duration)}else r&&r.height(t),e.add(o).height(t)}(s+d.textpanel_padding_bottom,t)}function c(){var e=0;if(i&&(e+=i.outerHeight()),n){var t="";n&&(t=jQuery.trim(n.text())),""!=t&&(i&&(e+=d.textpanel_padding_title_description),e+=n.outerHeight())}return e}function h(){if(1==d.textpanel_enable_bg){(r=e.children(".ug-textpanel-bg")).fadeTo(0,d.textpanel_bg_opacity);var t={"background-color":d.textpanel_bg_color};t=jQuery.extend(t,d.textpanel_bg_css),r.css(t)}if(1==d.textpanel_enable_title){i=o.children(".ug-textpanel-title");var a={};null!==d.textpanel_title_color&&(a.color=d.textpanel_title_color),null!==d.textpanel_title_font_family&&(a["font-family"]=d.textpanel_title_font_family),null!==d.textpanel_title_text_align&&(a["text-align"]=d.textpanel_title_text_align),null!==d.textpanel_title_font_size&&(a["font-size"]=d.textpanel_title_font_size+"px"),null!==d.textpanel_title_bold&&(!0===d.textpanel_title_bold?a["font-weight"]="bold":a["font-weight"]="normal"),d.textpanel_css_title&&(a=jQuery.extend(a,d.textpanel_css_title)),i.css(a)}if(1==d.textpanel_enable_description){n=o.children(".ug-textpanel-description");var s={};null!==d.textpanel_desc_color&&(s.color=d.textpanel_desc_color),null!==d.textpanel_desc_font_family&&(s["font-family"]=d.textpanel_desc_font_family),null!==d.textpanel_desc_text_align&&(s["text-align"]=d.textpanel_desc_text_align),null!==d.textpanel_desc_font_size&&(s["font-size"]=d.textpanel_desc_font_size+"px"),null!==d.textpanel_desc_bold&&(!0===d.textpanel_desc_bold?s["font-weight"]="bold":s["font-weight"]="normal"),d.textpanel_css_title&&(s=jQuery.extend(s,d.textpanel_css_description)),n.css(s)}}function p(){var e=a.getSelectedItem();s.setText(e.title,e.description,e.link)}this.positionElements=function(e){if(!d.textpanel_height||"top"==d.textpanel_text_valign)return g(e),!1;switch(d.textpanel_text_valign){default:case"top":g(!1);break;case"bottom":t=c(),g(!1,o.height()-t-d.textpanel_padding_bottom);break;case"center":case"middle":!function(){var e=c();g(!1,(o.height()-e)/2)}()}var t},this.init=function(e,t,i){if(a=e,i&&(u=i,t=l.convertCustomPrefixOptions(t,u,"textpanel")),t&&(d=jQuery.extend(d,t)),0==d.textpanel_enable_title&&0==d.textpanel_enable_description)throw new Error("Textpanel Error: The title or description must be enabled");d.textpanel_height&&d.textpanel_height<0&&(d.textpanel_height=null),1==d.textpanel_desc_style_as_title&&(d.textpanel_desc_color||(d.textpanel_desc_color=d.textpanel_title_color),d.textpanel_desc_bold||(d.textpanel_desc_bold=d.textpanel_title_bold),d.textpanel_desc_font_family||(d.textpanel_desc_font_family=d.textpanel_title_font_family),d.textpanel_desc_font_size||(d.textpanel_desc_font_size=d.textpanel_title_font_size),d.textpanel_desc_text_align||(d.textpanel_desc_text_align=d.textpanel_title_text_align))},this.appendHTML=function(i,n){t=i;var r="<div class='ug-textpanel"+(n=n?" "+n:"")+"'>";1==d.textpanel_enable_bg&&(r+="<div class='ug-textpanel-bg"+n+"'></div>"),r+="<div class='ug-textpanel-textwrapper"+n+"'>",1==d.textpanel_enable_title&&(r+="<div class='ug-textpanel-title"+n+"'></div>"),1==d.textpanel_enable_description&&(r+="<div class='ug-textpanel-description"+n+"'></div>"),r+="</div></div>",i.append(r),e=i.children(".ug-textpanel"),o=e.children(".ug-textpanel-textwrapper"),h()},this.destroy=function(){jQuery(a).off(a.events.ITEM_CHANGE)},this.run=function(){s.setSizeByParent(),jQuery(a).on(a.events.ITEM_CHANGE,p)},this.setPanelSize=function(t,a){if(_.setInternalHeight=!0,a)_.setInternalHeight=!1;else a=80;d.textpanel_height&&(a=d.textpanel_height),e.width(t),e.height(a),r&&(r.width(t),r.height(a));var u=t-d.textpanel_padding_left-d.textpanel_padding_right,g=d.textpanel_padding_left;l.setElementSizeAndPosition(o,g,0,u,a),i&&i.width(u),n&&n.width(u),0==_.isFirstTime&&s.positionElements(!1)},this.setSizeByParent=function(){var e=l.getElementSize(t);s.setPanelSize(e.width)},this.setTextPlain=function(e,t,r){if(1==d.textpanel_title_as_link&&e&&r){var o="";1==d.textpanel_title_link_newtab&&(o+=' target="blank"'),e='<a class="ug-textpanel-link" href="'+r+'" '+o+">"+e+"</a>"}i&&i.html(e),n&&n.html(t)},this.setText=function(e,t,i){1==_.isFirstTime?(s.setTextPlain(e,t,i),_.isFirstTime=!1,s.positionElements(!1)):o.stop().fadeTo(d.textpanel_fade_duration,0,function(){s.setTextPlain(e,t,i),s.positionElements(!0),jQuery(this).fadeTo(d.textpanel_fade_duration,1)})},this.positionPanel=function(t,i){var n={};if(null!=t)n.top=t,n.bottom="auto";else switch(d.textpanel_align){case"top":n.top=d.textpanel_margin+"px";break;case"bottom":n.top="auto",n.bottom=d.textpanel_margin+"px";break;case"middle":n.top=l.getElementRelativePos(e,"middle",d.textpanel_margin)}null!=i&&(n.left=i),e.css(n)},this.setOptions=function(e){u&&(e=l.convertCustomPrefixOptions(e,u,"textpanel")),d=jQuery.extend(d,e)},this.getElement=function(){return e},this.getSize=function(){return l.getElementSize(e)},this.refresh=function(e,t,i,n){h(),i?s.setPanelSize(i,n):s.setSizeByParent(),s.positionElements(!1),!0!==t&&s.positionPanel(),!0===e&&s.show()},this.hide=function(){e.hide()},this.show=function(){e.show()},this.getOptions=function(){return d},this.getOption=function(e){return 0==d.hasOwnProperty(e)?null:d[e]}}function UGZoomButtonsPanel(){var e,t,i,n,r=new UGSlider,o=new UGFunctions,a={slider_zoompanel_skin:""};function s(e){return!e||!!e.hasClass("ug-zoompanel-button-disabled")}function l(e){e&&e.addClass("ug-zoompanel-button-disabled")}function u(e){e&&e.removeClass("ug-zoompanel-button-disabled")}function d(){if(0==r.isCurrentSlideType("image"))return!0;1==r.isCurrentSlideImageFit()?0==s(i)&&(l(i),l(n)):1==s(i)&&(u(i),u(n))}this.init=function(e,t){r=e,t&&(a=jQuery.extend(a,t))},this.appendHTML=function(r){r;var o="<div class='ug-slider-control ug-zoompanel ug-skin-"+a.slider_zoompanel_skin+"'>";o+="<div class='ug-zoompanel-button ug-zoompanel-plus'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-minus ug-zoompanel-button-disabled'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-return ug-zoompanel-button-disabled'></div>",o+="</div>",r.append(o),e=r.children(".ug-zoompanel"),t=e.children(".ug-zoompanel-plus"),i=e.children(".ug-zoompanel-minus"),n=e.children(".ug-zoompanel-return")},this.setObjects=function(e,r,o){t=e,n=o,(i=r)&&i.addClass("ug-zoompanel-button-disabled"),n&&n.addClass("ug-zoompanel-button-disabled")},this.getElement=function(){return e},this.initEvents=function(){o.addClassOnHover(t,"ug-button-hover"),o.addClassOnHover(i,"ug-button-hover"),o.addClassOnHover(n,"ug-button-hover"),o.setButtonOnClick(t,function(){if(1==s(t))return!0;r.zoomIn()}),o.setButtonOnClick(i,function(){if(1==s(i))return!0;r.zoomOut()}),o.setButtonOnClick(n,function(){if(1==s(n))return!0;r.zoomBack()}),jQuery(r).on(r.events.ZOOM_CHANGE,d),jQuery(r).on(r.events.ITEM_CHANGED,d)}}function UGBullets(){var e,t,i=this,n=0,r=new UniteGalleryMain,o=new UGFunctions,a={isInited:!1},s={bullets_skin:"",bullets_addclass:"",bullets_space_between:-1};function l(){var i="",r="";-1!=s.bullets_space_between&&(r=" style='margin-left:"+s.bullets_space_between+"px'");for(var o=0;o<n;o++)i+=0==o?"<div class='ug-bullet'></div>":"<div class='ug-bullet'"+r+"></div>";if(e.html(i),!t){var a=e.find(".ug-bullet:first-child");a.length&&(t=a.width())}}function u(e){if(1==i.isActive(e))return!0;var t=e.index();jQuery(i).trigger(i.events.BULLET_CLICK,t)}function d(){var t=e.children(".ug-bullet");o.setButtonOnClick(t,u),t.on("mousedown mouseup",function(e){return!1})}function _(e){if(e<0||e>=n)throw new Error("wrong bullet index: "+e)}function g(){if(1==a.isInited)return!0;throw new Error("The bullets are not inited!")}this.events={BULLET_CLICK:"bullet_click"},this.init=function(e,t,i){r=e,n=i||r.getNumItems(),a.isInited=!0,""==(s=jQuery.extend(s,t)).bullets_skin&&(s.bullets_skin=s.gallery_skin)},this.getBulletsWidth=function(){return 0==n?0:t?n*t+(n-1)*s.bullets_space_between:0},this.appendHTML=function(t){t,g();var i="";""!=s.bullets_addclass&&(i=" "+s.bullets_addclass);var n="<div class='ug-slider-control ug-bullets ug-skin-"+s.bullets_skin+i+"'>";e=jQuery(n+="</div>"),t.append(e),l(),d()},this.updateNumBullets=function(e){n=e,l(),d()},this.getElement=function(){return e},this.setActive=function(t){g(),_(t);var i=e.children(".ug-bullet");i.removeClass("ug-bullet-active"),jQuery(i[t]).addClass("ug-bullet-active"),t},this.isActive=function(t){if(_(t),"number"!=typeof t)var i=t;else i=e.children(".ug-bullet")[t];return!!i.hasClass("ug-bullet-active")},this.getNumBullets=function(){return n}}function UGProgressBar(){var e,t,i=this,n=0,r=new UGFunctions,o={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(i,n){n&&(o=jQuery.extend(o,n)),i.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'></div></div>"),e=i.children(".ug-progress-bar"),(t=e.children(".ug-progress-bar-inner")).css("background-color",o.slider_progressbar_color),e.height(o.slider_progressbar_line_width),t.height(o.slider_progressbar_line_width),t.width("0%");var r=o.slider_progressbar_opacity,a=t[0];a.style.opacity=r,a.style.filter="alpha(opacity="+100*r+")"},this.putHidden=function(t,n){i.put(t,n),e.hide()},this.getElement=function(){return e},this.setSize=function(n){e.width(n),t.width(n),i.draw()},this.setPosition=function(t,i,n,o){r.placeElement(e,t,i,n,o)},this.draw=function(){var e=100*n;t.width(e+"%")},this.setProgress=function(e){n=r.normalizePercent(e),i.draw()},this.getType=function(){return"bar"}}function UGProgressPie(){var e,t=this,i=!1,n=new UGFunctions,r={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};function o(t){if(!t)t=0;var n=Math.min(r.slider_progresspie_width,r.slider_progresspie_height)/2,o=e[0].getContext("2d");0==i&&(i=!0,o.rotate(1.5*Math.PI),o.translate(-2*n,0)),o.clearRect(0,0,r.slider_progresspie_width,r.slider_progresspie_height);var a=r.slider_progresspie_width/2,s=r.slider_progresspie_height/2,l=0,u=t*Math.PI*2;if(1==r.slider_progresspie_type_fill)o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath();else{o.globalCompositeOperation="source-over",o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath(),o.globalCompositeOperation="destination-out";var d=n-r.slider_progresspie_stroke_width;o.beginPath(),o.moveTo(a,s),o.arc(a,s,d,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath()}1==r.slider_progresspie_type_fill&&(l=u,u=2*Math.PI,o.beginPath(),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color2,o.fill(),o.closePath())}this.put=function(t,i){i&&(r=jQuery.extend(r,i)),t.append("<canvas class='ug-canvas-pie' width='"+r.slider_progresspie_width+"' height='"+r.slider_progresspie_height+"'></canvas>"),e=t.children(".ug-canvas-pie")},this.putHidden=function(i,n){t.put(i,n),o(.1),e.hide()},this.getElement=function(){return e},this.setPosition=function(t,i){n.placeElement(e,t,i)},this.getSize=function(){return{width:r.slider_progresspie_width,height:r.slider_progresspie_height}},this.setProgress=function(e){e=n.normalizePercent(e),e,o(e)},this.getType=function(){return"pie"}}function UGTouchSliderControl(){var e,t,i,n=new UGSlider,r=new UGFunctions,o={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},a={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};function s(e){if(!e)e=n.getSlidesReference();return-r.getElementSize(e.objCurrentSlide).left-r.getElementSize(t).left}function l(e){if(1==n.isInnerInPlace())return!1;if(i.trigger(n.events.BEFORE_RETURN),!e)e=n.getSlidesReference();var s=-r.getElementSize(e.objCurrentSlide).left;t.animate({left:s+"px"},{duration:o.slider_transition_return_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(e,i,n){if(1==a.isDragVideo){var o=r.getElementSize(t).left-s,l=a.videoStartX+o;a.videoObject.css("left",l)}},complete:function(){i.trigger(n.events.AFTER_RETURN)}})}function u(){var e=n.getSlidesReference(),u=s(e);if(0==u)return!1;var d=u>0?"left":"right",_=!1;switch(d){case"right":if(n.isSlideHasItem(e.objPrevSlide))var g=-r.getElementSize(e.objPrevSlide).left;else _=!0;break;case"left":if(n.isSlideHasItem(e.objNextSlide))g=-r.getElementSize(e.objNextSlide).left;else _=!0}1==_?l(e):t.stop().animate({left:g+"px"},{duration:o.slider_transition_continuedrag_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(1==a.isDragVideo){var e=r.getElementSize(t).left-a.startPosx,i=a.videoStartX+e;a.videoObject.css("left",i)}},always:function(){!function(e){n.getVideoObject().hide(),n.switchSlideNums(e),n.placeNabourItems()}(d),i.trigger(n.events.AFTER_DRAG_CHANGE)}})}function d(e){var i=r.getMousePosition(e);a.startMouseX=i.pageX,a.startMouseY=i.pageY,a.lastMouseX=a.startMouseX,a.lastMouseY=a.startMouseY,a.startTime=jQuery.now();var n=r.getArrTouches(e);a.startArrTouches=r.getArrTouchPositions(n);var o=r.getElementSize(t);a.startPosx=o.left,a.isInitDataValid=!0,a.isDragVideo=!1,r.storeEventData(e,a.storedEventID)}function _(e){a.touch_active=!1}function g(e,t){a.touch_active=!0,d(t)}function c(e){return e.preventDefault(),a.isDragging=!1,1==n.isAnimating()&&t.stop(!0,!0),r.getArrTouches(e).length>1?(1==a.touch_active&&_(),!0):1==a.touch_active||void g(0,e)}function h(s){if(0==a.touch_active)return!0;if(0==s.buttons)return _(),u(),!0;r.updateStoredEventData(s,a.storedEventID),s.preventDefault();var l=r.getMousePosition(s);a.lastMouseX=l.pageX,a.lastMouseY=l.pageY;var g=null;1==o.slider_vertical_scroll_ondrag&&(g=r.handleScrollTop(a.storedEventID)),"vert"!==g&&function(r){var o=a.lastMouseX-a.startMouseX;if(0==o)return!0;var s=o<0?"left":"right",l=n.getObjZoom();if(l){if(1==l.isPanEnabled(r,s))return a.isInitDataValid=!1,!0;if(0==a.isInitDataValid)return d(r),!0}var u=a.startPosx+o;o>0&&u>0?u/=3:o<0&&u+t.width()<e.width()&&(u=a.startPosx+o/3);if(0==a.isDragging&&(a.isDragging=!0,i.trigger(n.events.START_DRAG)),t.css("left",u+"px"),1==a.isDragVideo){var _=u-a.startPosx,g=a.videoStartX+_;a.videoObject.css("left",g)}}(s)}function p(e){var t=r.getArrTouches(e).length;if(1==n.isInnerInPlace()&&0==a.touch_active&&0==t)return!0;if(0==t&&1==a.touch_active){_();var i=!1;0==r.wasVerticalScroll(a.storedEventID)&&(i=function(){var e=n.getSlidesReference(),t=s(e),i=Math.round(3*e.objCurrentSlide.width()/8);if(Math.abs(t)>=i)return!0;var r=Math.abs(a.lastMouseX-a.startMouseX);return Math.abs(a.lastMouseY-a.startMouseY),!(r<20)&&jQuery.now()-a.startTime<500}()),1==i?u():l()}else 1==t&&0==a.touch_active&&g(0,e)}this.isTapEventOccured=function(e){var t=r.getArrTouches(e).length;if(0!=t||0!=a.lastNumTouches)return a.lastNumTouches=t,!1;a.lastNumTouches=t;s(n.getSlidesReference());var i=Math.abs(a.lastMouseX-a.startMouseX),o=Math.abs(a.lastMouseY-a.startMouseY),l=jQuery.now()-a.startTime;return i<20&&o<50&&l<500},this.init=function(r,a){n=r,i=jQuery(n),g_objects=r.getObjects(),e=g_objects.g_objSlider,t=g_objects.g_objInner,o=jQuery.extend(o,a),e.bind("mousedown touchstart",c),jQuery("body").bind("mousemove touchmove",h),jQuery(window).add("body").bind("mouseup touchend",p)},this.getLastMousePos=function(){return{pageX:a.lastMouseX,pageY:a.lastMouseY}},this.isTouchActive=function(){return a.touch_active}}function UGZoomSliderControl(){var e,t,i=new UGSlider,n=new UGFunctions,r={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},o={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};function a(n,a){i=n,t=jQuery(i),g_objects=n.getObjects(),e=g_objects.g_objSlider,g_objects.g_objInner,r=jQuery.extend(r,a),e.on("mousewheel",b),e.bind("mousedown touchstart",p),jQuery("body").bind("mousemove touchmove",f),jQuery(window).add("body").bind("mouseup touchend",m),t.bind(i.events.BEFORE_RETURN,function(){h()}),t.bind(i.events.ITEM_CHANGED,function(){o.isZoomedOnce=!1}),t.bind(i.events.ZOOM_CHANGE,function(){o.isZoomedOnce=!0})}function s(){var e=i.getScaleMode();return"down"!=e&&(e="fit"),e}function l(){if((r=jQuery.now())-o.storeImageLastTime<20)return!1;var e=i.getSlidesReference();if(o.objSlide=e.objCurrentSlide,o.objImage=e.objCurrentSlide.find("img"),0==o.objImage.length)return!1;o.objImageSize=n.getElementSize(o.objImage),o.objParent=o.objImage.parent(),o.objParentSize=n.getElementSize(o.objParent);var t=s();objPadding=i.getObjImagePadding(),o.objFitImageSize=n.getImageInsideParentDataByImage(o.objImage,t,objPadding);var r=jQuery.now();return o.storeImageLastTime=r,!0}function u(e,o){var a=i.getSlidesReference().objCurrentSlide.find("img"),l=s();t.trigger(i.events.ZOOM_START);var u=!0,d=i.getObjImagePadding();if("back"==e){var _=n.getImageOriginalSize(a);n.scaleImageFitParent(a,_.width,_.height,l,d)}else{var g="in"==e;u=n.zoomImageInsideParent(a,g,r.slider_zoom_step,o,l,r.slider_zoom_max_ratio,d)}1==u&&(t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE),t.trigger(i.events.ZOOM_END))}function d(e,t,i){var r=n.getArrTouches(t);if(!0===i){if(1!=r.length)return!1}else if(r.length>1)return!1;return!!n.isElementBiggerThenParent(e)}function _(e){o.isPanActive=!0,function(e){var t=n.getMousePosition(e);o.startMouseX=t.pageX,o.startMouseY=t.pageY,o.lastMouseX=o.startMouseX,o.lastMouseY=o.startMouseY,o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height}(e)}function g(e){if(0==o.isZoomActive)return!1;2!=n.getArrTouches(e).length&&(o.isZoomActive=!1,t.trigger(i.events.ZOOM_END))}function c(e){if(1==o.isZoomActive)return!0;var r=n.getArrTouches(e);if(2!=r.length)return!0;!function(e){o.isZoomActive=!0,o.startDistance=n.getDistance(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),0==o.startDistance&&(o.startDistance=1),o.startMiddlePoint=n.getMiddlePoint(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),o.objImageSize=n.getElementSize(o.objImage),o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.imageOrientPoint=n.getElementLocalPoint(o.startMiddlePoint,o.objImage),0==n.isPointInsideElement(o.imageOrientPoint,o.objImageSize)&&(o.imageOrientPoint=n.getElementCenterPoint(o.objImage)),t.trigger(i.events.ZOOM_START)}(r)}function h(){if(null==o.objImage||0==o.objImage.length)return!0;if(n.getElementSize(o.objImage).width<o.objFitImageSize.imageWidth){o.objImage.css({position:"absolute",margin:"none"});var e={top:o.objFitImageSize.imageTop+"px",left:o.objFitImageSize.imageLeft+"px",width:o.objFitImageSize.imageWidth+"px",height:o.objFitImageSize.imageHeight+"px"};o.objImage.animate(e,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}else!function(){var e=!1,t=!1,a=0,s=0,l=n.getElementSize(o.objImage),u=i.getObjImagePadding(),d=n.getElementCenterPosition(o.objImage,u);o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height,1==o.panYActive?l.top>0?(s=0,t=!0):l.bottom<o.objParentSize.height&&(s=o.objParentSize.height-l.height,t=!0):l.top!=d.top&&(t=!0,s=d.top),1==o.panXActive?l.left>0?(a=0,e=!0):l.right<o.objParentSize.width&&(a=o.objParentSize.width-l.width,e=!0):l.left!=d.left&&(e=!0,a=d.left);var _={};1==t&&(_.top=s+"px"),1==e&&(_.left=a+"px"),1!=t&&1!=e||o.objImage.animate(_,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}()}function p(e){if(0==i.isCurrentSlideType("image"))return!0;l();if(null==o.objImage||0==o.objImage.length)return!0;e.preventDefault(),1==!(!o.objImage||!o.objImage.is(":animated"))&&o.objImage.stop(!0),1==o.isZoomActive?g(e):c(e),1==o.isZoomActive?o.isPanActive=!1:1==d(o.objImage,e)&&1==o.isZoomedOnce&&_(e)}function m(e){if(0==i.isCurrentSlideType("image"))return!0;if(1==jQuery(e.target).data("ug-button"))return!1;l();if(null==o.objImage||0==o.objImage.length)return!0;var t=o.isPanActive,n=o.isZoomActive;if(0==i.isInnerInPlace())return o.isZoomActive=!1,o.isPanActive=!1,!0;if(1==o.isZoomActive?g(e):c(e),1==o.isZoomActive)o.isPanActive=!1;else{var r=d(o.objImage,e,!0);1==o.isPanActive?o.isPanActive=!1:1==r&&_(e)}(t||n)&&0==o.isZoomActive&&0==o.isPanActive&&h()}function f(e){if(0==i.isCurrentSlideType("image"))return!0;1==o.isZoomActive?function(e){var a=n.getArrTouches(e),s=n.getDistance(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY)/o.startDistance,l=n.getMiddlePoint(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY),u=o.objImageSize.width*s,d=o.objImageSize.height*s,_=n.getImageOriginalSize(o.objImage),g=1;if(_.width>0&&(g=u/_.width),g>r.slider_zoom_max_ratio)return!0;panX=-(o.imageOrientPoint.x*s-o.imageOrientPoint.x),panY=-(o.imageOrientPoint.y*s-o.imageOrientPoint.y);var c=l.x-o.startMiddlePoint.x,h=l.y-o.startMiddlePoint.y,p=o.startImageX+panX+c,m=o.startImageY+panY+h;n.setElementSizeAndPosition(o.objImage,p,m,u,d),t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE)}(e):1==o.isPanActive&&function(e){if(null==o.objImage||0==o.objImage.length)return!0;var t=n.getMousePosition(e),r=(t.pageX,o.startMouseX,t.pageY,o.startMouseY,t.pageX-o.lastMouseX),a=t.pageY-o.lastMouseY,s=r<0?"left":"right",l=a<0?"up":"down";o.lastMouseX=t.pageX,o.lastMouseY=t.pageY;var u=n.getElementSize(o.objImage);0==o.panYActive?a=0:"down"==l&&u.top>0?a/=3:"up"==l&&u.bottom<o.objParentSize.height&&(a/=3),0==o.panXActive||0==i.isInnerInPlace()?r=0:"right"==s&&u.left>0?r/=3:"left"==s&&u.right<o.objParentSize.width&&(r/=3);var d=u.left+r,_=u.top+a;n.placeElement(o.objImage,d,_)}(e)}function b(e,t,o,a){return 0==r.slider_zoom_mousewheel||(0==i.isCurrentSlideType("image")||(e.preventDefault(),void u(1==t>0?"in":"out",n.getMousePosition(e))))}this.________EXTERNAL_____________=function(){},this.isPanEnabled=function(e,t){if(l(),null==o.objImage||0==o.objImage.length)return!1;if(0==o.isZoomedOnce)return!1;if(0==d(o.objImage,e))return!1;if(0==i.isInnerInPlace())return!1;if("left"==t){if(o.objImageSize.right<=o.objParentSize.width)return!1}else if(o.objImageSize.left>=0)return!1;return!0},this.init=function(e,t){a(e,t)},this.zoomIn=function(){u("in")},this.zoomOut=function(){u("out")},this.zoomBack=function(){u("back")}}function UGWistiaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=!1;function o(){return"undefined"!=typeof Wistia}function a(e,o,a,s,l){t=null,r=!1;var u=e+"_video",d="<div id='"+u+"' class='wistia_embed' style='width:"+a+";height:"+s+";' data-video-width='"+a+"' data-video-height='"+s+"'>&nbsp;</div>";jQuery("#"+e).html(d),t=Wistia.embed(o,{version:"v1",videoWidth:a,videoHeight:s,container:u,autoPlay:l}),r=!0,t.bind("play",function(){n.trigger(i.events.START_PLAYING)}),t.bind("pause",function(){n.trigger(i.events.STOP_PLAYING)}),t.bind("end",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugWistiaAPI.isAPILoaded||(o()?(g_ugWistiaAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0),void(g_ugWistiaAPI.isAPILoaded=!0)))},this.doCommand=function(e){if(null==t)return!1;if(0==r)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.putVideo=function(t,i,n,r,s,l){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!r||!t)}}function UGSoundCloudAPI(){this.isAPILoaded=!1;var e,t,i,n=this,r=jQuery(this);function o(){return"undefined"!=typeof SC}function a(e,o,a,s,l){t=null,g_isPlayerReady=!1;var u=e+"_iframe",d=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+o;d+="&amp;buying=false&amp;liking=false&amp;download=false&amp;sharing=false&amp;show_artwork=true&show_comments=false&amp;show_playcount=true&amp;show_user=false&amp;hide_related=true&amp;visual=true&amp;start_track=0&amp;callback=true";var _="<iframe id='"+u+"' src="+(d+=!0===l?"&amp;auto_play=true":"&amp;auto_play=false")+" width='"+a+"' height='"+s+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(_),(t=SC.Widget(u)).bind(SC.Widget.Events.READY,function(){t&&(g_isPlayerReady=!0,t.bind(SC.Widget.Events.PLAY,function(){r.trigger(n.events.START_PLAYING)}),t.bind(SC.Widget.Events.PAUSE,function(){r.trigger(n.events.STOP_PLAYING)}),t.bind(SC.Widget.Events.FINISH,function(){r.trigger(n.events.STOP_PLAYING),r.trigger(n.events.VIDEO_ENDED)}))}),i=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugSoundCloudAPI.isAPILoaded||(o()?(g_ugSoundCloudAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0),void(g_ugSoundCloudAPI.isAPILoaded=!0)))},this.putSound=function(t,i,n,r,s){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){n.doCommand("pause")},this.play=function(){n.doCommand("play")},this.destroy=function(){g_isPlayerReady=!1,t=null,i&&(jQuery("#"+i).html(""),i=null)}}function UGHtml5MediaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this);function r(){return"undefined"!=typeof mejs}function o(e,r,o,a,s){t=null,g_isPlayerReady=!1;var l=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",u=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",d=e+"_video",_="";s&&!0===s&&(_="autoplay='autoplay'");var g="";r.posterImage&&(g="poster='"+r.posterImage+"'");var c="<video id='"+d+"' width='"+o+"' height='"+a+"' controls='controls' preload='none' "+_+" "+g+">";""!=r.mp4&&(c+="<source type='video/mp4' src='"+r.mp4+"' />"),""!=r.webm&&(c+="<source type='video/webm' src='"+r.webm+"' />"),""!=r.ogv&&(c+="<source type='video/ogg' src='"+r.ogv+"' />"),c+="<object width='"+o+"' height='"+a+"' type='application/x-shockwave-flash' data='"+l+"'>",c+="<param name='movie' value='"+l+"' />",c+="<param name='flashvars' value='controls=true&file="+r.mp4+"' />",c+="</object>",c+="</video>",jQuery("#"+e).html(c),new MediaElement(d,{enablePluginDebug:!1,flashName:l,silverlightName:u,success:function(e,r){g_isPlayerReady=!0,t=e,0==s&&t.pause(),g_ugFunctions.addEvent(t,"play",function(){n.trigger(i.events.START_PLAYING)}),g_ugFunctions.addEvent(t,"pause",function(){n.trigger(i.events.STOP_PLAYING)}),g_ugFunctions.addEvent(t,"ended",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})},error:function(e){trace(e)}})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugHtml5MediaAPI.isAPILoaded||(r()?(g_ugHtml5MediaAPI.isAPILoaded=!0,!0):(!0!==e&&(g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0),g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0)),void(g_ugHtml5MediaAPI.isAPILoaded=!0)))},this.putVideo=function(t,i,n,a,s){if(r())return o(t,i,n,a,s),!0;this.loadAPI(),e=setInterval(function(){r()&&(o(t,i,n,a,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")}}function UGVimeoAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=null,o=!1,a=!1;function s(){return"undefined"!=typeof Froogaloop}function l(e,s,l,u,d){r=null,o=!1;var _=location.protocol+"//player.vimeo.com/video/"+s+"?api=1";!0===d&&(_+="&amp;byline=0&amp;autoplay=1&amp;title=0&amp;portrait=0");var g="<iframe src="+_+" width='"+l+"' height='"+u+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(g);var c=jQuery("#"+e+" iframe")[0];(r=Froogaloop(c)).addEvent("ready",function(){r&&(o=!0,function(){if(!r)return!1;r.addEvent("cuechange",function(){1==a&&i.play()}),r.addEvent("play",function(){n.trigger(i.events.START_PLAYING)}),r.addEvent("pause",function(){n.trigger(i.events.STOP_PLAYING)}),r.addEvent("finish",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}())}),t=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugVimeoAPI.isAPILoaded||(s()?(g_ugVimeoAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("f.vimeocdn.com/js/froogaloop2.min.js",!0),void(g_ugVimeoAPI.isAPILoaded=!0)))},this.doCommand=function(e){return null!=r&&(0!=o&&void r.api(e))},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.destroy=function(){r&&(r.api("unload"),r=null,o=!1),t&&jQuery("#"+t).html("")},this.putVideo=function(t,i,n,r,o){if(s())return l(t,i,n,r,o),!0;this.loadAPI(),e=setInterval(function(){s()&&(l(t,i,n,r,o),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!o||!r)},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;a=t,r.api("loadVideo",e)},this.getVideoImages=function(e,t,i){var n=location.protocol+"//vimeo.com/api/v2/video/"+e+".json";jQuery.get(n,{},function(e){var n={};n.preview=e[0].thumbnail_large,n.thumb=e[0].thumbnail_medium,i(t,n)})}}function UGYoutubeAPI(){this.isAPILoaded=!1;var e,t,i=this,n=null,r=!1,o=jQuery(this),a=-1,s=new UGFunctions,l={video_youtube_showinfo:!0};function u(e,i,o,a,u,d){n&&r&&n.destroy();var c={controls:1,showinfo:l.video_youtube_showinfo,start:0,rel:0};!0===u&&(c.autoplay=1);var h=s.getVal(d,"start");h&&jQuery.isNumeric(h)&&(c.start=h),r=!1,n=new YT.Player(e,{height:a,width:o,videoId:i,playerVars:c,events:{onReady:_,onStateChange:g}}),t=e}function d(){return"undefined"!=typeof YT&&void 0!==YT.Player}function _(){r=!0}function g(){if("function"!=typeof n.getPlayerState)return trace("Youtube API error: can't get player state"),!1;var e=n.getPlayerState();switch(e){case YT.PlayerState.PLAYING:o.trigger(i.events.START_PLAYING);break;case YT.PlayerState.ENDED:o.trigger(i.events.STOP_PLAYING),o.trigger(i.events.VIDEO_ENDED);break;default:a==YT.PlayerState.PLAYING&&o.trigger(i.events.STOP_PLAYING)}a=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.setOptions=function(e){l=jQuery.extend(l,e)},this.putVideo=function(t,i,n,r,o,a){if(d())return u(t,i,n,r,o,a),!0;this.loadAPI(),e=setInterval(function(){d()&&(u(t,i,n,r,o,a),clearInterval(e))},500)},this.loadAPI=function(e){return 1==g_ugYoutubeAPI.isAPILoaded||("undefined"!=typeof YT?(g_ugYoutubeAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1),void(g_ugYoutubeAPI.isAPILoaded=!0)))},this.doCommand=function(e,t){if(!n)return!0;if(0==r)return!1;switch(e){case"play":if("function"!=typeof n.playVideo)return!1;n.playVideo();break;case"pause":if("function"!=typeof n.pauseVideo)return!1;n.pauseVideo();break;case"seek":if("function"!=typeof n.seekTo)return!1;n.seekTo(t);break;case"stopToBeginning":var i=n.getPlayerState();switch(n.pauseVideo(),i){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:n.seekTo(0)}}},this.play=function(){i.doCommand("play")},this.pause=function(){i.doCommand("pause")},this.destroy=function(){try{n&&(r=!1,n.clearVideo(),n.destroy())}catch(e){jQuery("#"+t).html("")}},this.stopToBeginning=function(){i.doCommand("stopToBeginning")},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;t&&1==t?n.loadVideoById(e,0,"large"):n.cueVideoById(e,0,"large")},this.isPlayerReady=function(){return!(!r||!n)},this.getVideoImages=function(e){var t={};return t.preview="https://i.ytimg.com/vi/"+e+"/sddefault.jpg",t.thumb="https://i.ytimg.com/vi/"+e+"/default.jpg",t}}function UGVideoPlayer(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UGFunctions,_=new UGYoutubeAPI,g=new UGVimeoAPI,c=new UGHtml5MediaAPI,h=new UGSoundCloudAPI,p=new UGWistiaAPI,m=null,f={video_enable_closebutton:!0};this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"};var b={standAloneMode:!1,youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",soundCloudPlayerID:""};function v(){l.hide()}function y(){u.trigger(l.events.PLAY_START),o&&o.hide()}function I(){u.trigger(l.events.PLAY_STOP),o&&o.show()}function w(){u.trigger(l.events.VIDEO_ENDED)}function E(e){var t=["youtube","vimeo","html5","soundcloud","wistia"];for(var o in t){var l=t[o];if(l!=e)switch(l){case"youtube":_.pause(),_.destroy(),i.hide();break;case"vimeo":g.pause(),g.destroy(),n.hide();break;case"html5":c.pause(),r.hide();break;case"soundcloud":h.pause(),h.destroy(),a.hide();break;case"wistia":p.pause(),s.hide()}}}this.init=function(t,i,n){if(!(e=n))throw new Error("missing gallery ID for video player, it's a must!");f=jQuery.extend(f,t),_.setOptions(f),i&&1==i&&(b.standAloneMode=!0)},this.setHtml=function(l){b.youtubeInnerID=e+"_youtube_inner",b.vimeoPlayerID=e+"_videoplayer_vimeo",b.html5PlayerID=e+"_videoplayer_html5",b.wistiaPlayerID=e+"_videoplayer_wistia",b.soundCloudPlayerID=e+"_videoplayer_soundcloud";var u="<div class='ug-videoplayer' style='display:none'>";u+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+b.youtubeInnerID+"'></div></div>",u+="<div id='"+b.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'></div>",u+="<div id='"+b.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'></div>",u+="<div id='"+b.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'></div>",u+="<div id='"+b.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'></div>",0==b.standAloneMode&&1==f.video_enable_closebutton&&(u+="<div class='ug-videoplayer-button-close'></div>"),u+="</div>",l.append(u),t=l.children(".ug-videoplayer"),i=t.children(".ug-videoplayer-youtube"),n=t.children(".ug-videoplayer-vimeo"),r=t.children(".ug-videoplayer-html5"),a=t.children(".ug-videoplayer-soundcloud"),s=t.children(".ug-videoplayer-wistia"),0==b.standAloneMode&&1==f.video_enable_closebutton&&(o=t.children(".ug-videoplayer-button-close"))},this.destroy=function(){o&&(o.off("click"),o.off("touchend")),jQuery(_).off(_.events.START_PLAYING),jQuery(_).off(_.events.STOP_PLAYING),jQuery(g).off(g.events.START_PLAYING),jQuery(g).off(g.events.STOP_PLAYING),jQuery(c).off(c.events.START_PLAYING),jQuery(c).off(c.events.STOP_PLAYING),jQuery(h).off(h.events.START_PLAYING,y),jQuery(h).off(h.events.STOP_PLAYING,I),jQuery(p).off(p.events.START_PLAYING,y),jQuery(p).off(p.events.STOP_PLAYING,I),m=null},this.initEvents=function(){o&&(d.setButtonMobileReady(o),d.setButtonOnClick(o,v)),jQuery(_).on(_.events.START_PLAYING,y),jQuery(_).on(_.events.STOP_PLAYING,I),jQuery(_).on(_.events.VIDEO_ENDED,w),jQuery(g).on(g.events.START_PLAYING,y),jQuery(g).on(g.events.STOP_PLAYING,I),jQuery(g).on(g.events.VIDEO_ENDED,w),jQuery(c).on(c.events.START_PLAYING,y),jQuery(c).on(c.events.STOP_PLAYING,I),jQuery(c).on(c.events.VIDEO_ENDED,w),jQuery(h).on(h.events.START_PLAYING,y),jQuery(h).on(h.events.STOP_PLAYING,I),jQuery(h).on(h.events.VIDEO_ENDED,w),jQuery(p).on(p.events.START_PLAYING,y),jQuery(p).on(p.events.STOP_PLAYING,I),jQuery(p).on(p.events.VIDEO_ENDED,w)},this.setSize=function(e,i){d.setElementSize(t,e,i),o&&d.placeElement(o,"right","top")},this.setPosition=function(e,i){d.placeElement(t,e,i)},this.getObject=function(){return t},this.show=function(){if(1==l.isVisible())return!0;t.show(),t.fadeTo(0,1),o&&o.show(),u.trigger(l.events.SHOW)},this.hide=function(){if(0==l.isVisible())return!0;E(),m=null,t.hide(),u.trigger(l.events.HIDE)},this.getActiveAPI=function(){switch(m){case"youtube":return _;case"vimeo":return g;case"wistia":return p;case"soundcloud":return h;case"html5":return c;default:return null}},this.pause=function(){var e=l.getActiveAPI();if(null==e)return!1;"function"==typeof e.pause&&e.pause()},this.isVisible=function(){return t.is(":visible")},this.playYoutube=function(e,t,n){if(void 0===t)t=!0;if(!n)n=null;E("youtube"),i.show(),0==i.children("#"+b.youtubeInnerID).length&&i.append("<div id='"+b.youtubeInnerID+"'></div>");var r={};n&&(r.start=n),1==_.isPlayerReady()&&1==b.standAloneMode?_.changeVideo(e,t):_.putVideo(b.youtubeInnerID,e,"100%","100%",t,r),m="youtube"},this.playVimeo=function(e,t){if(void 0===t)t=!0;E("vimeo"),n.show(),g.putVideo(b.vimeoPlayerID,e,"100%","100%",t),m="vimeo"},this.playHtml5Video=function(e,t,i,n,o){if(void 0===o)o=!0;E("html5"),r.show();var a={ogv:e,webm:t,mp4:i,posterImage:n};c.putVideo(b.html5PlayerID,a,"100%","100%",o),m="html5"},this.playSoundCloud=function(e,t){if(void 0===t)t=!0;E("soundcloud"),a.show(),h.putSound(b.soundCloudPlayerID,e,"100%","100%",t),m="soundcloud"},this.playWistia=function(e,t){if(void 0===t)t=!0;E("wistia"),s.show(),p.putVideo(b.wistiaPlayerID,e,"100%","100%",t),m="wistia"}}var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI;function ugCheckForMinJQueryVersion(){if(0==g_ugFunctions.checkMinJqueryVersion("1.8.0"))throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.")}function ugCheckForErrors(e,t){try{"jquery"==t?(!function(){if("undefined"==typeof jQuery)throw new Error("jQuery library not included")}(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),function(){if("function"==typeof jQuery.fn.unitegallery)return!0;var e="You have some jquery.js library include that comes after the gallery files js include.";throw e+="<br> This include eliminates the gallery libraries, and make it not work.","cms"==t?(e+="<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Gallery Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true.",e+="<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it."):e+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.",new Error(e)}())}catch(r){var i=r.message;if(i="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+(i="Unite Gallery Error: "+i)+"</div>","jquery"==t){var n=document.getElementById(e);n.innerHTML=i,n.style.display="block"}else jQuery(e).show().html(i);return!1}return!0}function UniteGalleryMain(){var t=this,g_galleryID,g_objGallery=jQuery(t),g_objWrapper,g_objParent,g_objThumbs,g_objSlider,g_objLightbox,g_functions=new UGFunctions,g_objTabs,g_objLoadMore,g_arrItems=[],g_numItems,g_selectedItem=null,g_selectedItemIndex=-1,g_objTheme,g_objCache={};this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"};var g_options={gallery_width:900,gallery_height:500,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!1,gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:"",load_api_externally:!1},g_temp={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};function __________INIT_GALLERY_______(){}function getThemeFunction(e){var t=e;return-1==t.indexOf("UGTheme_")&&(t="UGTheme_"+t),t}function initTheme(objCustomOptions){if(objCustomOptions.hasOwnProperty("gallery_theme"))g_options.gallery_theme=objCustomOptions.gallery_theme;else{var defaultTheme=g_options.gallery_theme;0==g_ugFunctions.isThemeRegistered(defaultTheme)&&(g_options.gallery_theme=g_ugFunctions.getFirstRegisteredTheme())}var themeFunction=getThemeFunction(g_options.gallery_theme);try{g_options.gallery_theme=eval(themeFunction)}catch(e){}g_options.gallery_theme=eval(themeFunction),g_objTheme=new g_options.gallery_theme,g_objTheme.init(t,objCustomOptions)}function resetOptions(){g_options=jQuery.extend({},g_temp.originalOptions),g_selectedItemIndex=-1,g_selectedItem=null,g_objSlider=void 0,g_objThumbs=void 0,g_objLightbox=void 0}function checkForStartupErrors(){try{ugCheckForMinJQueryVersion()}catch(e){throwErrorShowMessage(e.message)}"object"==typeof g_objWrapper.outerWidth()&&throwErrorShowMessage("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version."),setTimeout(function(){ugCheckForErrors(g_galleryID,"cms")},5e3)}function runGallery(e,i,n,r){var o="object"==typeof i;if(o&&(g_temp.objCustomOptions=i),1==g_temp.isRunFirstTime){if(g_galleryID=e,0==(g_objWrapper=jQuery(g_galleryID)).length)return trace("div with id: "+g_galleryID+" not found"),!1;g_objParent=g_objWrapper.parent(),checkForStartupErrors(),g_temp.originalOptions=jQuery.extend({},g_options),o&&(g_options=jQuery.extend(g_options,i)),1==g_options.gallery_enable_cache&&g_options.gallery_initial_catid&&cacheItems(g_options.gallery_initial_catid),t.setSizeClass(),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.find("img").fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}else if(t.destroy(),resetOptions(),g_options=jQuery.extend(g_options,g_temp.objCustomOptions),n){if(r&&1==g_options.gallery_enable_cache&&cacheItems(r,n),"noitems"==n)return showErrorMessage("No items in this category",""),!1;g_objWrapper.html(n),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.children().fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_tabs&&(g_objTabs=new UGTabs).init(t,g_options),1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_loadmore&&(g_objLoadMore=new UGLoadMore).init(t,g_options),o&&modifyInitParams(g_temp.objCustomOptions),validateParams(),1==g_options.gallery_shuffle&&t.shuffleItems(),initTheme(g_temp.objCustomOptions),setGalleryHtml(),setHtmlObjectsProperties(),0==g_objWrapper.width()?g_functions.waitForWidth(g_objWrapper,runGalleryActually):runGalleryActually()}function runGalleryActually(){t.setSizeClass(),0==g_temp.isFreestyleMode&&1==g_options.gallery_preserve_ratio&&setHeightByOriginalRatio(),g_objTheme.run(),g_objTabs&&g_temp.isRunFirstTime&&g_objTabs.run(),preloadBigImages(),initEvents(),g_numItems>0&&t.selectItem(0),1==g_options.gallery_autoplay&&t.startPlayMode(),g_temp.isRunFirstTime=!1}function showErrorMessage(e,t){if(void 0===t)t="<b>Unite Gallery Error: </b>";else t="<b>"+t+": </b>";var i="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+(e=t+e)+"</div></div>";g_objWrapper.children().remove(),g_objWrapper.html(i),g_objWrapper.show()}function throwErrorShowMessage(e){throw showErrorMessage(e),new Error(e)}function modifyInitParams(){g_options.gallery_images_preload_type||(g_options.gallery_images_preload_type="minimal"),(null==g_options.gallery_min_height||g_options.gallery_height<g_options.gallery_min_height)&&(g_options.gallery_min_height=0),(null==g_options.gallery_min_width||g_options.gallery_width<g_options.gallery_min_width)&&(g_options.gallery_min_width=0)}function validateParams(){if(!g_options.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(g_options.gallery_height)&&g_options.gallery_height<g_options.gallery_min_height)throw new Error("The <b>gallery_height</b> option must be bigger then <b>gallery_min_height option</b>");if(g_options.gallery_width<g_options.gallery_min_width)throw new Error("The <b>gallery_width</b> option must be bigger then <b>gallery_min_width option</b>")}function setGalleryHtml(){g_objWrapper.addClass("ug-gallery-wrapper"),g_objWrapper.append("<div class='ug-overlay-disabled' style='display:none'></div>"),t.setSizeClass()}function clearInitData(){g_objWrapper.children().remove()}function storeLastSize(){var e=t.getSize();g_temp.lastWidth=e.width,g_temp.lastHeight=e.height}function setHeightByOriginalRatio(){var e=t.getSize();if(e.width/e.height!=e.orig_ratio){var i=e.width/e.orig_ratio;(i=Math.round(i))<g_options.gallery_min_height&&(i=g_options.gallery_min_height),g_objWrapper.height(i)}}function setHtmlObjectsProperties(){var e={"max-width":g_functions.getCssSizeParam(g_options.gallery_width),"min-width":g_functions.getCssSizeParam(g_options.gallery_min_width)};if(0==g_temp.isFreestyleMode){var t=g_functions.getCssSizeParam(g_options.gallery_height);e.height=t}else e.overflow="visible";g_options.gallery_background_color&&(e["background-color"]=g_options.gallery_background_color),g_objWrapper.css(e)}function fillItemByChild(e){var i=t.isMobileMode();if("noscript"==(a=e.prop("tagName").toLowerCase()))return null;if("picture"==a){var n=e.find("img");if(0==n.length)return null;e=n,a="img"}var r=e.data("lazy-src");r&&e.attr("src",r);var o="";if("a"==a){o=e.attr("href");var a=(e=e.children("img:first-child")).prop("tagName").toLowerCase()}var s=e.data("type");null==s&&(s="image");var l={};if(l.type=s,"img"==a){if(!(u=e.data("lazyload-src")))var u=e.data("lazy-src");u&&""!=u&&(e.attr("src",u),jQuery.removeData(e,"lazyload-src"));var d=e.data("image"),_=e.data("thumb"),g=e.data("title");void 0===d&&(d=null),void 0===_&&(_=null);var c=e.attr("src");d||(d=c),_||(_=c),_||(_=d),d||(d=_),l.urlThumb=_,l.urlImage=d,l.title=e.attr("alt"),g&&(l.title=g),l.objThumbImage=e,l.objThumbImage.attr("src",l.urlThumb)}else{if("image"==s)throw trace("Problematic gallery item found:"),trace(e),trace("Please look for some third party js script that could add this item to the gallery"),new Error("The item should not be image type");l.urlThumb=e.data("thumb"),l.title=e.data("title"),l.objThumbImage=null,l.urlImage=e.data("image")}if(1==i){var h=e.data("thumb-mobile");void 0!==h&&""!=h&&(l.urlThumb=h,"img"==a&&e.attr("src",l.urlThumb));var p=e.data("image-mobile");void 0!==p&&""!=p&&(l.urlImage=p)}l.link=o,l.description=e.attr("title"),l.description||(l.description=e.data("description")),l.description||(l.description=""),l.isNewAdded=!1,l.isLoaded=!1,l.isThumbImageLoaded=!1,l.objPreloadImage=null,l.isBigImageLoadStarted=!1,l.isBigImageLoaded=!1,l.isBigImageLoadError=!1,l.imageWidth=0,l.imageHeight=0,l.thumbWidth=0,l.thumbHeight=0,l.thumbRatioByWidth=0,l.thumbRatioByHeight=0;var m=e.data("width"),f=e.data("height");m&&"number"==typeof m&&f&&"number"==typeof f&&(l.thumbWidth=m,l.thumbHeight=f,l.thumbRatioByWidth=m/f,l.thumbRatioByHeight=f/m),l.addHtml=null;var b=null==l.urlImage||""==l.urlImage,v=null==l.urlThumb||""==l.urlThumb;switch(l.type){case"youtube":if(l.videoid=e.data("videoid"),l.video_start=e.data("start"),b||v){var y=g_ugYoutubeAPI.getVideoImages(l.videoid);b&&(l.urlImage=y.preview),v&&(l.urlThumb=y.thumb,"img"==a&&e.attr("src",l.urlThumb))}g_temp.isYoutubePresent=!0;break;case"vimeo":l.videoid=e.data("videoid"),g_temp.isVimeoPresent=!0;break;case"html5video":l.videoogv=e.data("videoogv"),l.videowebm=e.data("videowebm"),l.videomp4=e.data("videomp4"),g_temp.isHtml5VideoPresent=!0;break;case"soundcloud":l.trackid=e.data("trackid"),g_temp.isSoundCloudPresent=!0;break;case"wistia":l.videoid=e.data("videoid"),g_temp.isWistiaPresent=!0;break;case"custom":var I=e.children("img");I.length&&(I=jQuery(I[0]),l.urlThumb=I.attr("src"),l.title=I.attr("alt"),l.objThumbImage=I);var w=e.children().not("img:first-child");w.length&&(l.addHtml=w.clone())}return l.objThumbImage&&(l.objThumbImage.removeAttr("data-description",""),l.objThumbImage.removeAttr("data-image",""),l.objThumbImage.removeAttr("data-thumb",""),l.objThumbImage.removeAttr("title","")),l}function fillItemsArray(e,t){if(!0!==t)g_arrItems=[];else for(var i=0;i<g_numItems;i++)g_arrItems[i].isNewAdded=!1;for(i=0;i<e.length;i++){var n=jQuery(e[i]),r=fillItemByChild(n);null!==r?(numIndex=g_arrItems.length,r.index=numIndex,!0===t&&(r.isNewAdded=!0),g_arrItems.push(r)):n.remove()}g_numItems=g_arrItems.length}function loadAPIs(){var e=g_options.load_api_externally;g_temp.isYoutubePresent&&g_ugYoutubeAPI.loadAPI(e),g_temp.isVimeoPresent&&g_ugVimeoAPI.loadAPI(e),g_temp.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI(e),g_temp.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI(e),g_temp.isWistiaPresent&&g_ugWistiaAPI.loadAPI(e)}function preloadBigImages(){if("visible"!=g_options.gallery_images_preload_type||g_objThumbs||(g_options.gallery_images_preload_type="minimal"),1==g_temp.isAllItemsPreloaded)return!0;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":jQuery(g_arrItems).each(function(){preloadItemImage(this)});break;case"visible":jQuery(g_arrItems).each(function(){1==g_objThumbs.isItemThumbVisible(this)&&preloadItemImage(this)})}}function checkPreloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!1;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":preloadItemImage(e);break;case"visible":1==g_objThumbs.isItemThumbVisible(e)&&preloadItemImage(e)}}function preloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!0;var i=e.urlImage;if(""==i||null==i)return e.isBigImageLoadError=!0,!1;e.isBigImageLoadStarted=!0,e.objPreloadImage=jQuery("<img/>").attr("src",i),e.objPreloadImage.data("itemIndex",e.index),e.objPreloadImage.on("load",t.onItemBigImageLoaded),e.objPreloadImage.on("error",function(){var e=jQuery(this).data("itemIndex"),i=g_arrItems[e];i.isBigImageLoadError=!0,i.isBigImageLoaded=!1;var n=jQuery(this).attr("src");console.log("Can't load image: "+n),g_objGallery.trigger(t.events.ITEM_IMAGE_UPDATED,[e,i.urlImage]),i.objThumbImage.attr("src",i.urlThumb)}),checkAllItemsStartedPreloading()}function preloadNearBigImages(e){if(1==g_temp.isAllItemsPreloaded)return!1;if(!e)e=g_selectedItem;if(!e)return!0;var t=e.index,i=t-1,n=t+1;i>0&&preloadItemImage(g_arrItems[i]),n<g_numItems&&preloadItemImage(g_arrItems[n])}function checkAllItemsStartedPreloading(){if(1==g_temp.isAllItemsPreloaded)return!1;for(var e in g_arrItems)if(0==g_arrItems[e].isBigImageLoadStarted)return!1;g_temp.isAllItemsPreloaded=!0}function __________END_INIT_GALLERY_______(){}function __________EVENTS_____________(){}function onSliderMouseEnter(e){1==g_options.gallery_pause_on_mouseover&&0==t.isFullScreen()&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&t.pausePlaying()}function onSliderMouseLeave(e){1==g_options.gallery_pause_on_mouseover&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&(0==g_objSlider.isCurrentSlideLoadingImage()&&t.continuePlaying())}function isThisGalleryForKeyAction(){if(!window.ugArrGalleriesObjects)return!0;window.ugArrGalleriesObjects.length;if(1==window.ugArrGalleriesObjects.length)return!0;var e,i=0,n=t.getGalleryID();return jQuery.each(window.ugArrGalleriesObjects,function(t,r){var o=r.getGalleryID(),a=r.getKeyPressScore();a>i&&(i=a),o==n&&(e=a)}),e==i}function onKeyPress(e){var i=jQuery(e.target);if(i.is("textarea")||i.is("select")||i.is("input"))return!0;var n=e.charCode?e.charCode:e.keyCode?e.keyCode:e.which?e.which:0,r=!1;switch(n){case 39:1==isThisGalleryForKeyAction()&&(t.nextItem(),r=!0);break;case 37:1==isThisGalleryForKeyAction()&&(t.prevItem(),r=!0);break;default:r=!1}1==r&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()),g_objGallery.trigger(t.events.GALLERY_KEYPRESS,[n,e])}function onGalleryResized(){var e;if(0==(e=t.getSize()).width)return!0;if(t.setSizeClass(),(e=t.getSize()).width!=g_temp.lastWidth||0==g_temp.isFreestyleMode&&e.height!=g_temp.lastHeight){var i=!1;if(g_temp.funcCustomHeight){var n=g_temp.funcCustomHeight(e);n&&(g_objWrapper.height(n),i=!0)}0==i&&1==g_options.gallery_preserve_ratio&&0==g_temp.isFreestyleMode&&setHeightByOriginalRatio(),storeLastSize(),g_objGallery.trigger(t.events.SIZE_CHANGE)}}function onThumbsChange(e){"visible"==g_options.gallery_images_preload_type&&0==g_temp.isAllItemsPreloaded&&preloadBigImages()}function onFullScreenChange(){var e=g_functions.isFullScreen(),i=e?t.events.ENTER_FULLSCREEN:t.events.EXIT_FULLSCREEN,n=g_functions.getGlobalData("fullscreenID");if(g_galleryID!==n)return!0;e?g_objWrapper.addClass("ug-fullscreen"):g_objWrapper.removeClass("ug-fullscreen"),g_objGallery.trigger(i),onGalleryResized()}function onItemImageUpdated(e,i){checkPreloadItemImage(t.getItem(i))}function onCurrentSlideImageLoadEnd(){1==t.isPlayMode()&&t.continuePlaying()}function initEvents(){if(g_objWrapper.on("dragstart",function(e){e.preventDefault()}),g_objGallery.on(t.events.ITEM_IMAGE_UPDATED,onItemImageUpdated),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).on(g_objThumbs.events.STRIP_MOVE,onThumbsChange);break;case"grid":jQuery(g_objThumbs).on(g_objThumbs.events.PANE_CHANGE,onThumbsChange)}if("advance"==g_options.gallery_mousewheel_role&&0==g_temp.isFreestyleMode&&g_objWrapper.on("mousewheel",t.onGalleryMouseWheel),storeLastSize(),jQuery(window).resize(function(){g_objWrapper.css("width","auto"),g_functions.whenContiniousEventOver("gallery_resize",onGalleryResized,g_temp.resizeDelay)}),setTimeout(function(){setInterval(onGalleryResized,2e3)},1e4),g_functions.addFullScreenChangeEvent(onFullScreenChange),g_objSlider){if(jQuery(g_objSlider).on(g_objSlider.events.ITEM_CHANGED,function(){var e=g_objSlider.getCurrentItemIndex();-1!=e&&t.selectItem(e)}),1==g_options.gallery_pause_on_mouseover)g_objSlider.getElement().hover(onSliderMouseEnter,onSliderMouseLeave),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){onSliderMouseLeave()});retriggerEvent(g_objSlider,g_objSlider.events.ACTION_START,t.events.SLIDER_ACTION_START),retriggerEvent(g_objSlider,g_objSlider.events.ACTION_END,t.events.SLIDER_ACTION_END),jQuery(g_objSlider).on(g_objSlider.events.CURRENTSLIDE_LOAD_END,onCurrentSlideImageLoadEnd)}1==g_options.gallery_control_keyboard&&jQuery(document).keydown(onKeyPress)}function __________GENERAL_______(){}function cacheItems(e,t){if(t)"noitems"!=(i=t)&&(i=jQuery(t).clone());else var i=g_objWrapper.children().clone();g_objCache[e]=i}function removeAllSizeClasses(e){e||(e=g_objWrapper),e.removeClass("ug-under-480"),e.removeClass("ug-under-780"),e.removeClass("ug-under-960")}function retriggerEvent(e,t,i){jQuery(e).on(t,function(e){g_objGallery.trigger(i,[this])})}function advanceNextStep(){var e=jQuery.now(),i=e-g_temp.playTimeLastStep;if(g_temp.playTimeLastStep=e,0==t.isGalleryVisible())return!1;if(g_temp.playTimePassed+=i,g_temp.objProgress){var n=g_temp.playTimePassed/g_options.gallery_play_interval;g_temp.objProgress.setProgress(n)}g_temp.playTimePassed>=g_options.gallery_play_interval&&(t.nextItem(),g_temp.playTimePassed=0)}function unselectSeletedItem(){if(null==g_selectedItem)return!0;g_objThumbs&&g_objThumbs.setThumbUnselected(g_selectedItem.objThumbWrapper),g_selectedItem=null,g_selectedItemIndex=-1}function toFakeFullScreen(){jQuery("body").addClass("ug-body-fullscreen"),g_objWrapper.addClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!0,g_objGallery.trigger(t.events.ENTER_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}function exitFakeFullscreen(){jQuery("body").removeClass("ug-body-fullscreen"),g_objWrapper.removeClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!1,g_objGallery.trigger(t.events.EXIT_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}this.onItemBigImageLoaded=function(e,t){if(!t)t=jQuery(this);var i=t.data("itemIndex"),n=g_arrItems[i];n.isBigImageLoaded=!0;var r=g_functions.getImageOriginalSize(t);n.imageWidth=r.width,n.imageHeight=r.height},this.checkFillImageSize=function(e,t){if(!t){var i=e.data("itemIndex");if(void 0===i)throw new Error("Wrong image given to gallery.checkFillImageSize");t=g_arrItems[i]}var n=g_functions.getImageOriginalSize(e);t.imageWidth=n.width,t.imageHeight=n.height},this.setFreestyleMode=function(){g_temp.isFreestyleMode=!0},this.attachThumbsPanel=function(e,t){g_temp.thumbsType=e,g_objThumbs=t},this.initSlider=function(e,i){if(!e)e={};e=jQuery.extend(g_temp.objCustomOptions,e),(g_objSlider=new UGSlider).init(t,e,i)},this.onGalleryMouseWheel=function(e,i,n,r){e.preventDefault(),i>0?t.prevItem():t.nextItem()},this.getKeyPressScore=function(){if(t.isGalleryInsideScreen())return 1;if(g_objLightbox&&1==g_objLightbox.isOpened())return 2;return 0},this.getGalleryID=function(){return g_galleryID},this.destroy=function(){if(g_objWrapper.off("dragstart"),g_objGallery.off(t.events.ITEM_IMAGE_UPDATED),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).off(g_objThumbs.events.STRIP_MOVE);break;case"grid":jQuery(g_objThumbs).off(g_objThumbs.events.PANE_CHANGE)}if(g_objWrapper.off("mousewheel"),jQuery(window).off("resize"),g_functions.destroyFullScreenChangeEvent(),g_objSlider){jQuery(g_objSlider).off(g_objSlider.events.ITEM_CHANGED);var e=g_objSlider.getElement();e.off("mouseenter"),e.off("mouseleave"),g_objGallery.off(t.events.ENTER_FULLSCREEN),jQuery(g_objSlider).off(g_objSlider.events.ACTION_START),jQuery(g_objSlider).off(g_objSlider.events.ACTION_END),jQuery(g_objSlider).off(g_objSlider.events.CURRENTSLIDE_LOAD_END)}1==g_options.gallery_control_keyboard&&jQuery(document).off("keydown"),g_objTheme&&"function"==typeof g_objTheme.destroy&&g_objTheme.destroy(),g_objWrapper.html("")},this.getArrItems=function(){return g_arrItems},this.getObjects=function(){return{g_galleryID:g_galleryID,g_objWrapper:g_objWrapper,g_objThumbs:g_objThumbs,g_objSlider:g_objSlider,g_options:g_options,g_arrItems:g_arrItems,g_numItems:g_numItems}},this.getObjSlider=function(){return g_objSlider},this.getItem=function(e){if(e<0)throw new Error("item with index: "+e+" not found");if(e>=g_numItems)throw new Error("item with index: "+e+" not found");return g_arrItems[e]},this.getWidth=function(){return t.getSize().width},this.getHeight=function(){return t.getSize().height},this.getSize=function(){var e=g_functions.getElementSize(g_objWrapper);return e.orig_width=g_options.gallery_width,e.orig_height=g_options.gallery_height,e.orig_ratio=e.orig_width/e.orig_height,e},this.getGalleryID=function(){return g_galleryID.replace("#","")},this.getNextItem=function(e,t){"object"==typeof e&&(e=e.index);var i=e+1;if(!0!==t&&1==g_numItems)return null;if(i>=g_numItems){if(1!=g_options.gallery_carousel&&!0!==t)return null;i=0}return g_arrItems[i]},this.getPrevItem=function(e){"object"==typeof e&&(e=e.index);var t=e-1;if(t<0){if(1!=g_options.gallery_carousel&&!0!==forceCarousel)return null;t=g_numItems-1}return g_arrItems[t]},this.getSelectedItem=function(){return g_selectedItem},this.getSelectedItemIndex=function(){return g_selectedItemIndex},this.getNumItems=function(){return g_numItems},this.isLastItem=function(){return g_selectedItemIndex==g_numItems-1},this.isFirstItem=function(){return 0==g_selectedItemIndex},this.getOptions=function(){return g_options},this.getElement=function(){return g_objWrapper},this.___________SET_CONTROLS___________=function(){},this.setNextButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.nextItem)},this.setPrevButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.prevItem)},this.setFullScreenToggleButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnTap(e,t.toggleFullscreen),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){e.addClass("ug-fullscreenmode")}),g_objGallery.on(t.events.EXIT_FULLSCREEN,function(){e.removeClass("ug-fullscreenmode")})},this.destroyFullscreenButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.ENTER_FULLSCREEN),g_objGallery.off(t.events.EXIT_FULLSCREEN)},this.setPlayButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.togglePlayMode),g_objGallery.on(t.events.START_PLAY,function(){e.addClass("ug-stop-mode")}),g_objGallery.on(t.events.STOP_PLAY,function(){e.removeClass("ug-stop-mode")})},this.destroyPlayButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.START_PLAY),g_objGallery.off(t.events.STOP_PLAY)},this.setProgressIndicator=function(e){g_temp.objProgress=e},this.setTextContainers=function(e,i){g_objGallery.on(t.events.ITEM_CHANGE,function(){var n=t.getSelectedItem();e.html(n.title),i.html(n.description)})},this.showDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").show()},this.hideDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").hide()},this.___________END_SET_CONTROLS___________=function(){},this.___________PLAY_MODE___________=function(){},this.startPlayMode=function(){if(g_temp.isPlayMode=!0,g_temp.isPlayModePaused=!1,g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval),g_temp.objProgress){var e=g_temp.objProgress.getElement();g_temp.objProgress.setProgress(0),e.show()}g_objGallery.trigger(t.events.START_PLAY),g_objSlider&&1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying()},this.resetPlaying=function(){if(0==g_temp.isPlayMode)return!0;g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now()},this.pausePlaying=function(){if(1==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!0,clearInterval(g_temp.playHandle),g_objGallery.trigger(t.events.PAUSE_PLAYING)},this.continuePlaying=function(){if(0==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!1,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval)},this.stopPlayMode=function(){(g_temp.isPlayMode=!1,clearInterval(g_temp.playHandle),g_temp.playTimePassed=0,g_temp.objProgress)&&g_temp.objProgress.getElement().hide();g_objGallery.trigger(t.events.STOP_PLAY)},this.isPlayMode=function(){return g_temp.isPlayMode},this.togglePlayMode=function(){0==t.isPlayMode()?t.startPlayMode():t.stopPlayMode()},this.___________GENERAL_EXTERNAL___________=function(){},this.getCurrentNumItem=function(){return g_selectedItemIndex},this.shuffleItems=function(){for(var e in g_arrItems=g_functions.arrayShuffle(g_arrItems))g_arrItems[e].index=parseInt(e)},this.setOptions=function(e){g_options=jQuery.extend(g_options,e)},this.selectItem=function(e,i){"number"==typeof e&&(e=t.getItem(e));var n=e.index;if(n==g_selectedItemIndex)return!0;(unselectSeletedItem(),g_selectedItem=e,g_selectedItemIndex=n,g_objGallery.trigger(t.events.ITEM_CHANGE,[e,i]),1==g_temp.isPlayMode)&&(t.resetPlaying(),1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying())},this.nextItem=function(){var e=g_selectedItemIndex+1;return 0==g_numItems||(0==g_options.gallery_carousel&&e>=g_numItems||(e>=g_numItems&&(e=0),void t.selectItem(e,"next")))},this.prevItem=function(){var e=g_selectedItemIndex-1;return-1==g_selectedItemIndex&&(e=0),0==g_numItems||(0==g_options.gallery_carousel&&e<0||(e<0&&(e=g_numItems-1),void t.selectItem(e,"prev")))},this.isFullScreen=function(){return 1==g_temp.isFakeFullscreen||1==g_functions.isFullScreen()},this.isFakeFullscreen=function(){return g_temp.isFakeFullscreen},this.toFullScreen=function(){g_functions.setGlobalData("fullscreenID",g_galleryID);var e=g_objWrapper.get(0);0==g_functions.toFullscreen(e)&&toFakeFullScreen()},this.exitFullScreen=function(){1==g_temp.isFakeFullscreen?exitFakeFullscreen():g_functions.exitFullscreen()},this.toggleFullscreen=function(){0==t.isFullScreen()?t.toFullScreen():t.exitFullScreen()},this.resize=function(e,t,i){g_objWrapper.css("width","auto"),g_objWrapper.css("max-width",e+"px"),t&&g_objWrapper.height(t),i||!0===i||onGalleryResized()},this.setSizeClass=function(e,i){if(!e)e=g_objWrapper;if(!i)i=t.getSize().width;if(0==i)i=jQuery(window).width();var n="";if(i<=480?n="ug-under-480":i<=780?n="ug-under-780":i<960&&(n="ug-under-960"),1==e.hasClass(n))return!0;removeAllSizeClasses(e),""!=n&&e.addClass(n)},this.isMobileMode=function(){return!!g_objWrapper.hasClass("ug-under-480")},this.isSmallWindow=function(){var e=jQuery(window).width();return!e||e<=480},this.isGalleryVisible=function(){return g_objWrapper.is(":visible")},this.isGalleryInsideScreen=function(){return 1!=g_temp.isFreestyleMode&&(!!g_objSlider&&g_functions.isElementInsideScreen(g_objWrapper))},this.changeItems=function(e,t){if(!e)e="noitems";runGallery(g_galleryID,"nochange",e,t)},this.addItems=function(e){if(!e||0==e.length)return!1;var t=g_objWrapper.children(".ug-newitems-wrapper");if(0==t.length&&g_objWrapper.append("<div class='ug-newitems-wrapper' style='display:none'></div>"),(t=g_objWrapper.children(".ug-newitems-wrapper")).append(e),fillItemsArray(jQuery(t.children()),!0),loadAPIs(),!g_objTheme||"function"!=typeof g_objTheme.addItems)throw new Error("addItems function not found in the theme");t.remove(),g_objTheme.addItems()},this.getNewAddedItemsIndexes=function(){var e=[];return jQuery.each(g_arrItems,function(t,i){1==i.isNewAdded&&e.push(t)}),e},this.showErrorMessageReplaceGallery=function(e){showErrorMessage(e)},this.setFuncCustomHeight=function(e){g_temp.funcCustomHeight=e},this.setObjLightbox=function(e){g_objLightbox=e},this.__________EXTERNAL_EVENTS_______=function(){},this.triggerEvent=function(e,t){t?("array"!=jQuery.type(t)&&(t=[t]),g_objGallery.trigger(e,t)):g_objGallery.trigger(e)},this.onEvent=function(e,t){g_objGallery.on(e,t)},this.destroyEvent=function(e){g_objGallery.off(e)},this.__________AJAX_REQUEST_______=function(){},this.ajaxRequest=function(e,t,i,n){if(!i||"function"!=typeof i)throw new Error("ajaxRequest error: success function should be passed");var r=g_options.gallery_urlajax;if(!r||""==r)throw new Error("ajaxRequest error: Ajax url don't passed");if(void 0===t)t={};var o={action:"unitegallery_ajax_action",client_action:e,galleryID:g_galleryID,data:t};jQuery.ajax({type:"post",url:g_options.gallery_urlajax,dataType:"json",data:o,success:function(e){if(!e)throw new Error("Empty ajax response!");if(-1==e||0===e)throw new Error("ajax error!!!");if(void 0===e.success)throw new Error("ajax error!!!");if(0==e.success)return showErrorMessage(e.message,"ajax error"),!1;i(e)},error:function(e,t,i){console.log("Ajax Error!!! "+t),responseText=e.responseText,n&&"function"==typeof n?n(responseText):trace(responseText)}})},this.requestNewItems=function(e,i,n){var r=g_options.gallery_enable_cache;if(n||(n=e),1==i&&(r=!1),1==r&&g_objCache.hasOwnProperty(n)){var o=g_objCache[n];t.changeItems(o,n)}else g_objGallery.trigger(t.events.GALLERY_BEFORE_REQUEST_ITEMS),t.ajaxRequest("front_get_cat_items",{catid:e},function(e){var i=e.html;t.changeItems(i,n)})},this.run=function(e,t){if(t&&t.hasOwnProperty("gallery_debug_errors")&&(g_options.gallery_debug_errors=t.gallery_debug_errors),1==g_options.gallery_debug_errors)try{runGallery(e,t)}catch(e){if("object"==typeof e){var i=e.message,n=e.lineNumber,r=e.fileName;e.stack;i+=" <br><br> in file: "+r,i+=" <b> line "+n+"</b>",trace(e)}else i=e;showErrorMessage(i=i.replace("Error:",""))}else runGallery(e,t)}}function UGLightbox(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UniteGalleryMain,_=new UGSlider,g=new UGFunctions,c=new UGTextPanel,h={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0};this.events={LIGHTBOX_INIT:"lightbox_init"};var p={topPanelHeight:44,initTextPanelHeight:26,isOpened:!1,isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},m={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:p.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:0,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},f={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};function b(){1==p.isCompact&&1==h.lightbox_show_textpanel&&(h.lightbox_slider_image_padding_bottom=p.initTextPanelHeight),1==p.isCompact&&"inside"==h.lightbox_arrows_position&&(p.isArrowsInside=!0),1==p.isArrowsInside&&0==h.lightbox_arrows_inside_alwayson&&(p.isArrowsOnHoverMode=!0),0==h.lightbox_show_textpanel&&(p.isTopPanelEnabled=!1,p.topPanelHeight=0,h.lightbox_slider_image_padding_top=0)}function v(e){if(!_)return!0;var t={slider_image_padding_top:e};_.setOptions(t),_.refreshSlideItems()}function y(e){if(!s)return!1;if(!c)return!1;var t=s.height();if(0==t)return!1;if(0==s.is(":visible"))return!1;var i=t,n=c.getSize().height;t!=p.topPanelHeight&&(i=p.topPanelHeight),n>i&&(i=n),t!=i&&(s.height(i),_&&0==_.isAnimating()&&v(i))}function I(e){if(0==p.isOpened)return!1;if(!c)return!1;if(!_)return!1;var i=g.getElementSize(t),n=c.getSize();if(0==n.width||n.height>120)return!1;if(!e){var r=_.getSlideImage();e=g.getElementSize(r)}if(0==e.height||0==e.width)return!1;if(e.bottom+n.height<i.height)return!1;var o=_.getOptions(),a=n.height;if(a!=o.slider_image_padding_bottom){var s={slider_image_padding_bottom:a};if(0==_.isAnimating())return _.setOptions(s),_.refreshSlideItems(),!0}return!1}function w(e){g.getElementSize(t);var i=_.getSlideImage(),n=g.getElementSize(i);if(0==n.width)return!1;p.textPanelLeft=n.left,p.textPanelTop=n.bottom;var r=n.width;if(a){var o=g.getElementSize(a);r-=o.width;var s=n.right-o.width;g.placeElement(a,s,p.textPanelTop)}c&&(c.show(),c.refresh(!0,!0,r),function(e,t){if(!e){var i=_.getSlideImage();e=g.getElementSize(i)}p.textPanelTop=e.bottom,!0===t&&c.positionPanel(p.textPanelTop,p.textPanelLeft)}(n)),0==I(n)&&(p.positionFrom="handleCompactTextpanelSizes",c&&(c.positionPanel(p.textPanelTop,p.textPanelLeft),!0===e&&(e(),H())))}function E(){return 0==_.isCurrentSlideType("image")||1==_.isCurrentImageInPlace()}function T(e,t){if(0==p.isArrowsInside)return!1;if(!n)return!1;var i=E();if(n.show(),r.show(),p.positionFrom="positionArrowsInside",1==p.isArrowsOnHoverMode&&1==i&&0==A()&&M(!0),0==i)var o=g.getElementRelativePos(n,"left",h.lightbox_arrows_offset),a=g.getElementRelativePos(n,"middle"),s=g.getElementRelativePos(r,"right",h.lightbox_arrows_offset),l=a;else{var u=_.getSlideImage(),d=g.getElementSize(u);g.getElementSize(_.getElement()),o=g.getElementRelativePos(n,"left",0,u)+d.left+h.lightbox_arrows_inside_offset,a=g.getElementRelativePos(n,"middle",0,u)+d.top,s=g.getElementRelativePos(n,"right",0,u)+d.left-h.lightbox_arrows_inside_offset,l=a}if(!0===t){var c={left:o,top:a},m={left:s,top:l};n.stop().animate(c,{duration:p.fadeDuration}),r.stop().animate(m,{duration:p.fadeDuration})}else n.stop(),r.stop(),g.placeElement(n,o,a),g.placeElement(r,s,l);1==e&&O(t)}function S(e,i){p.positionFrom=null;var n=E(),r=g.getElementRelativePos(o,"right",2,t);if(0==n)var a=2,s=r;else{var l=_.getSlideImage(),u=g.getElementSize(l),d=g.getElementSize(_.getElement()),c=g.getElementSize(o);d.top==d.height&&(d.top=0);s=d.left+u.right-c.width/2+h.lightbox_compact_closebutton_offsetx;(a=d.top+u.top-c.height/2-h.lightbox_compact_closebutton_offsety)<2&&(a=2),s>r&&(s=r)}if(!0===i){var m={left:s,top:a};o.stop().animate(m,{duration:p.fadeDuration})}else o.stop(),g.placeElement(o,s,a);!0===e&&function(e){!0!==e&&o.stop();o.fadeTo(p.fadeDuration,1)}(i)}function P(){o&&o.stop().fadeTo(p.fadeDuration,0),j(),C(),p.positionFrom="hideCompactElements",1==p.isArrowsInside&&M()}function x(){var e=g.getElementSize(t);s&&g.setElementSizeAndPosition(s,0,0,e.width,p.topPanelHeight),n&&0==p.isArrowsInside&&(1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show()),g.placeElement(n,"left","middle",h.lightbox_arrows_offset),g.placeElement(r,"right","middle",h.lightbox_arrows_offset)),0==p.isCompact&&g.placeElement(o,"right","top",2,2),c&&(p.positionFrom="positionElements",0==p.isCompact?function(e){var t={},i=h.lightbox_textpanel_width;i>e.width-47-40?(t.textpanel_padding_left=47,t.textpanel_padding_right=40,t.textpanel_title_text_align="center",t.textpanel_desc_text_align="center"):(t.textpanel_padding_left=Math.floor((e.width-i)/2),t.textpanel_padding_right=t.textpanel_padding_left,t.textpanel_title_text_align="left",t.textpanel_desc_text_align="left",h.lightbox_textpanel_title_text_align&&(t.textpanel_title_text_align=h.lightbox_textpanel_desc_text_align),h.lightbox_textpanel_desc_text_align&&(t.textpanel_desc_text_align=h.lightbox_textpanel_desc_text_align)),c.setOptions(t),c.refresh(!0,!0),y(),c.positionPanel()}(e):(N(),H()));var i=e.width,a=e.height;if(_){if(s){var l={slider_image_padding_top:s.height()};_.setOptions(l)}_.setSize(i,a),_.setPosition(0,0)}}function j(){c&&c.getElement().stop().fadeTo(p.fadeDuration,0)}function C(){a&&a.stop().fadeTo(p.fadeDuration,0)}function A(){if(!p.lastMouseX)return!0;var e={pageX:p.lastMouseX,pageY:p.lastMouseY};return _.isMouseInsideSlideImage(e)}function M(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!1===t?(A(),!0):void(!0===e?(n.stop().fadeTo(0,0),r.stop().fadeTo(0,0)):(n.stop().fadeTo(p.fadeDuration,0),r.stop().fadeTo(p.fadeDuration,0))))}function O(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!0!==t&&1==E()||(1==_.isSwiping()||(!0!==e&&(n.stop(),r.stop()),n.fadeTo(p.fadeDuration,1),void r.fadeTo(p.fadeDuration,1))))}function z(e){if(!c)return!1;if(!e)e=_.getCurrentItem();c.setTextPlain(e.title,e.description)}function L(e){if(!a)return!1;if(!e)e=_.getCurrentItem();var t=d.getNumItems(),i=e.index+1;a.html(i+" / "+t)}function N(){if(!c)return!1;c.getElement().show().stop().fadeTo(p.fadeDuration,1)}function H(){a&&a.stop().fadeTo(p.fadeDuration,1)}function k(){if(0==p.isCompact)return!0;P()}function R(){if(0==p.isCompact)return!0;(p.positionFrom="onZoomChange",S(!1,!0),T(!1,!0),1==p.isCompact)&&(0==(_.isCurrentSlideType("image")&&1==_.isCurrentImageInPlace())?(j(),C()):(p.positionFrom="onZoomChange",N(),H()))}function G(){if(0==p.isCompact)return!0;p.positionFrom="onSliderAfterReturn",S(!0),T(!0),0==I()&&w(),N(),H()}function D(e,t){return t=jQuery(t),0==p.isCompact||(0==_.isSlideCurrent(t)||(p.positionFrom="onSliderAfterPutImage",S(!0),T(!0),void w()))}function Q(){var e=_.getOptions().slider_image_padding_top;if(s){var t=s.height();t!=e&&v(t)}if(1==p.isCompact){if(z(),L(),p.positionFrom="onSliderTransitionEnd",S(!0),T(!0),0==_.isSlideActionActive())0==I()&&w();N(),H()}}function W(e,t){0==p.isCompact?(a&&L(t),c&&(z(t),0==p.isRightNowOpened&&(c.positionElements(!1),y(),c.positionPanel()))):0==_.isAnimating()&&(c&&z(t),a&&L(t)),0==p.isSliderChangedOnce&&(p.isSliderChangedOnce=!0,u.trigger(l.events.LIGHTBOX_INIT))}function F(e,t){if("image"!=_.getSlideType()&&0==p.isCompact&&_.isSlideActionActive())return!0;if(1==_.isPreloading())return l.close("slider"),!0;1==h.lightbox_close_on_emptyspace&&(0==_.isMouseInsideSlideImage(t)&&l.close("slider_inside"))}function B(){x()}function Y(){s?function(){if(!s)return!1;s.hide()}():a&&a.hide(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.hide(),r.hide())}function U(){s?(!function(){if(!s)return!1;s.show()}(),y()):a&&a.show(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show())}function V(e,t,i){var n=!1;switch(t){case 27:1==p.isOpened&&l.close("keypress");break;case 38:case 40:case 33:case 34:n=!0}1==p.isOpened&&1==n&&i.preventDefault()}function X(){1==p.isArrowsOnHoverMode&&O(!1,!0)}function Z(e){p.positionFrom="hideCompactElements",1==p.isArrowsOnHoverMode&&1==E()&&M(!1,!0)}function q(e){p.lastMouseX=e.pageX,p.lastMouseY=e.pageY,1==(!n||0==n.is(":visible")||1!=n.css("opacity"))&&A()&&0==_.isAnimating()&&(p.positionFrom="onMouseMove",n&&0==n.is(":animated")&&O(!1,!0))}function K(e,t,i,n){if(0==p.isOpened)return!0;switch(h.gallery_mousewheel_role){default:case"zoom":"image"!=_.getSlideType()&&e.preventDefault();break;case"none":e.preventDefault();break;case"advance":d.onGalleryMouseWheel(e,t,i,n)}}this.destroy=function(){if(jQuery(document).unbind("mousemove"),i.off("touchstart"),i.off("touchend"),o.off("click"),e.off(d.events.ITEM_CHANGE),_){jQuery(_).off(_.events.TRANSITION_END),jQuery(_).off(_.events.CLICK),jQuery(_).off(_.events.START_DRAG),jQuery(_).off(_.events.TRANSITION_START),jQuery(_).off(_.events.AFTER_DRAG_CHANGE),jQuery(_).off(_.events.AFTER_RETURN);var n=_.getVideoObject();jQuery(n).off(n.events.PLAY_START),jQuery(n).off(n.events.PLAY_STOP),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z),_.destroy()}jQuery(window).unbind("resize"),e.off(d.events.GALLERY_KEYPRESS,V),t.off("mousewheel"),t.remove()},this.isOpened=function(){return p.isOpened},this.open=function(s){var l=d.getItem(s);(p.isOpened=!0,p.isRightNowOpened=!0,setTimeout(function(){p.isRightNowOpened=!1},100),_&&_.setItem(l,"lightbox_open"),c&&c.setTextPlain(l.title,l.description),i.stop().fadeTo(0,0),t.show(),t.fadeTo(0,1),i.stop().fadeTo(p.fadeDuration,h.lightbox_overlay_opacity),x(),1==p.isCompact)&&(1==_.isPreloading()?(o&&o.hide(),n&&1==p.isArrowsInside&&(n.hide(),r.hide()),a&&a.hide(),c&&c.hide()):1==p.isArrowsInside&&(n.hide(),r.hide()));_&&_.startSlideAction(),e.trigger(d.events.OPEN_LIGHTBOX,l)},this.close=function(i){p.isOpened=!1,1==p.isCompact&&P(),_&&_.stopSlideAction(),"image"!=_.getSlideType()?t.hide():t.fadeTo(p.fadeDuration,0,function(){t.hide()}),e.trigger(d.events.CLOSE_LIGHTBOX)},this.init=function(t,i){!function(t,i){d=t,e=jQuery(t),d.setObjLightbox(l),h=jQuery.extend(h,m),h=jQuery.extend(h,i),p.originalOptions=jQuery.extend({},h),"compact"==h.lightbox_type&&(p.isCompact=!0,h=jQuery.extend(h,f),h=jQuery.extend(h,i)),b(),1==p.putSlider?(d.initSlider(h,"lightbox"),g_objects=t.getObjects(),_=g_objects.g_objSlider):_=null,1==h.lightbox_show_textpanel?c.init(d,h,"lightbox"):c=null}(t,i)},this.putHtml=function(){var e,l;d.isSmallWindow()&&1==p.isCompact&&(p.isCompact=!1,b(),p.isArrowsInside=!1,p.isArrowsOnHoverMode=!1,(h=jQuery.extend({},p.originalOptions)).lightbox_arrows_position="sides",_.setOptions(h)),e="",l="",1==p.isCompact&&(l=" ug-lightbox-compact"),e+="<div class='ug-gallery-wrapper ug-lightbox"+l+"'>",e+="<div class='ug-lightbox-overlay'></div>",0==p.isCompact&&p.isTopPanelEnabled?(e+="<div class='ug-lightbox-top-panel'>",e+="<div class='ug-lightbox-top-panel-overlay'></div>",h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="</div>"):h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="<div class='ug-lightbox-button-close'></div>",e+="<div class='ug-lightbox-arrow-left'></div>",e+="<div class='ug-lightbox-arrow-right'></div>",e+="</div>",t=jQuery(e),jQuery("body").append(t),_&&_.setHtml(t),i=t.children(".ug-lightbox-overlay"),0==p.isCompact&&1==p.isTopPanelEnabled&&0==(s=t.children(".ug-lightbox-top-panel")).length&&(s=null),o=t.find(".ug-lightbox-button-close"),h.lightbox_show_numbers&&(a=t.find(".ug-lightbox-numbers")),n=t.children(".ug-lightbox-arrow-left"),r=t.children(".ug-lightbox-arrow-right"),c&&(s?c.appendHTML(s):c.appendHTML(t))},this.run=function(){!function(){if(null!==h.lightbox_overlay_color&&i.css("background-color",h.lightbox_overlay_color),null!==h.lightbox_overlay_opacity&&i.fadeTo(0,h.lightbox_overlay_opacity),s&&null!==h.lightbox_top_panel_opacity&&s.children(".ug-lightbox-top-panel-overlay").fadeTo(0,h.lightbox_top_panel_opacity),a){var e={};null!==h.lightbox_numbers_size&&(e["font-size"]=h.lightbox_numbers_size+"px"),h.lightbox_numbers_color&&(e.color=h.lightbox_numbers_color),null!==h.lightbox_numbers_padding_right&&(e["padding-right"]=h.lightbox_numbers_padding_right+"px"),null!==h.lightbox_numbers_padding_top&&(e["padding-top"]=h.lightbox_numbers_padding_top+"px"),a.css(e)}}(),_&&_.run(),function(){if(i.on("touchstart",function(e){e.preventDefault()}),i.on("touchend",function(e){l.close("overlay")}),g.addClassOnHover(r,"ug-arrow-hover"),g.addClassOnHover(n,"ug-arrow-hover"),g.addClassOnHover(o),d.setNextButton(r),d.setPrevButton(n),o.click(function(){l.close("button")}),e.on(d.events.ITEM_CHANGE,W),_){jQuery(_).on(_.events.TRANSITION_END,Q),jQuery(_).on(_.events.CLICK,F);var a=_.getVideoObject();jQuery(a).on(a.events.PLAY_START,Y),jQuery(a).on(a.events.PLAY_STOP,U),jQuery(_).on(_.events.START_DRAG,k),jQuery(_).on(_.events.TRANSITION_START,k),jQuery(_).on(_.events.AFTER_DRAG_CHANGE,G),jQuery(_).on(_.events.AFTER_RETURN,G),jQuery(_).on(_.events.AFTER_PUT_IMAGE,D),jQuery(_).on(_.events.ZOOM_CHANGE,R),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z)}jQuery(window).resize(function(){if(0==p.isOpened)return!0;g.whenContiniousEventOver("lightbox_resize",B,100)}),e.on(d.events.GALLERY_KEYPRESS,V),1==p.isArrowsOnHoverMode&&jQuery(document).bind("mousemove",q),t.on("mousewheel",K)}()}}function UGCarousel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGTileDesign,u=new UGThumbsGeneral,d={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1};this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"};var _={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!1,startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};function g(e,t){if(!t)t=_.initTileHeight/_.initTileWidth*e;_.tileWidth=e;var i={tile_width:e,tile_height:t};l.setOptions(i),d.tile_width=e,d.tile_height=t,l.resizeAllTiles(e),I(!0)}function c(){if(null===_.carouselMaxWidth)throw new Error("The carousel width not set");if(_.tileWidth<_.initTileWidth){(a=_.carouselMaxWidth-2*d.carousel_padding)>_.initTileWidth&&(a=_.initTileWidth),g(a);var o=s.getNumItemsInSpace(_.carouselMaxWidth,a,d.carousel_space_between_tiles)}else{var a;if((o=s.getNumItemsInSpace(_.carouselMaxWidth,_.tileWidth,d.carousel_space_between_tiles))<=0)o=1,g(a=_.carouselMaxWidth-2*d.carousel_padding)}var u=s.getSpaceByNumItems(o,_.tileWidth,d.carousel_space_between_tiles);u+=2*d.carousel_padding,i.width(u),1==_.isFirstTimeRun?(l.initEvents(),i.bind("mousedown touchstart",C),jQuery("body").bind("mousemove touchmove",A),jQuery(window).add("body").bind("mouseup touchend",M),i.hover(O,z),l.run(),jQuery.each(t,function(t,i){i.objThumbWrapper.data("index",t),e.trigger(_.eventSizeChange,[i.objThumbWrapper,!0]),i.objTileOriginal=i.objThumbWrapper.clone(!0,!0)}),I(!0),1==d.carousel_autoplay&&r.startAutoplay()):(1==d.carousel_autoplay&&r.pauseAutoplay(),S(0,!1),1==d.carousel_autoplay&&r.startAutoplay()),s.placeElement(n,0,d.carousel_padding),x(),_.isFirstTimeRun=!1}function h(){return s.getElementSize(n).left}function p(e){return s.getMousePosition(e).pageX}function m(){return n.children(".ug-thumb-wrapper")}function f(e){return s.getNumItemsInSpace(e,_.tileWidth,d.carousel_space_between_tiles)}function b(){return m().length}function v(e){w(e);var t=m();return jQuery(t[e])}function y(){return f(s.getElementSize(i).width)}function I(e){if(!e)e=!1;var t,r=m(),o=0,a=0;return jQuery.each(r,function(e,i){i=jQuery(i),s.placeElement(i,o,0);var n=s.getElementSize(i);o+=n.width+d.carousel_space_between_tiles,a=Math.max(a,n.height),e==r.length-1&&(t=n.right)}),n.width(t),a+=2*d.carousel_padding,!0===e&&(n.height(a),i.height(a)),S(_.numCurrent,!1),t}function w(e){if(e>m().length-1)throw new Error("Wrogn tile number: "+e)}function E(t,i){if("left"==i)var r=n.children(".ug-thumb-wrapper").first();else r=n.children(".ug-thumb-wrapper").last();var o=function(e,t,i){var n=e.data("index");if(null==n)throw new Error("every tile should have index!");for(var r=[],o=0;o<t;o++){if("prev"==i)var s=a.getPrevItem(n,!0);else s=a.getNextItem(n,!0);if(!s)throw new Error("the item to add is empty");var l=s.objTileOriginal.clone(!0,!0);n=s.index,l.addClass("cloned"),r.push(l)}return r}(r,t,"left"==i?"prev":"next");jQuery.each(o,function(t,r){"left"==i?n.prepend(r):n.append(r),e.trigger(_.eventSizeChange,r),l.loadTileImage(r)})}function T(e,t){w(n);for(var i=m(),n=i.length,r=0;r<e;r++)"left"==t?jQuery(i[r]).remove():jQuery(i[n-1-r]).remove()}function S(e,t,i){if(void 0===t){t=!0;if(n.is(":animated"))return!0}var r=v(e),o={left:-s.getElementSize(r).left+d.carousel_padding+"px"};if(!0===t){var a=d.carousel_scroll_duration,l=d.carousel_scroll_easing;!0===i&&(a=_.scrollShortDuration,l=_.scrollShortEasing),n.stop(!0).animate(o,{duration:a,easing:l,queue:!1,complete:function(){_.numCurrent=e,x()}})}else _.numCurrent=e,n.css(o)}function P(){var e,t,i,n;S((e=-h(),t=f(e),i=s.getElementSize(v(t)).left,n=s.getElementSize(v(t+1)).left,Math.abs(i-e)<Math.abs(n-e)?t:t+1),!0,!0)}function x(){var e,t=(e=-h(),_.sideSpace-e),r=function(){var e=s.getElementSize(i),t=s.getElementSize(n),r=t.width-e.width+t.left;return _.sideSpace-r}(),o=0,a=0,l=0,u=0,d=b();if(t>_.spaceActionSize)E(o=f(t),"left"),_.numCurrent+=o;else if(t<-_.spaceActionSize){T(l=f(Math.abs(t)),"left"),_.numCurrent-=l}if(r>_.spaceActionSize?E(a=f(r),"right"):r<-_.spaceActionSize&&T(u=f(Math.abs(r)),"right"),u>d)throw new Error("Can't remove more then num tiles");var g=!1;return(o||a||l||u)&&(I(),g=!0),g}function j(){"left"==d.carousel_autoplay_direction?r.scrollRight(1):r.scrollLeft(1)}function C(e){if(1==_.touchActive)return!0;_.touchActive=!0,r.pauseAutoplay(),_.startTime=jQuery.now(),_.startMousePos=p(e),_.startInnerPos=h(),_.lastTime=_.startTime,_.lastMousePos=_.startMousePos,s.storeEventData(e,_.storedEventID)}function A(e){if(0==_.touchActive)return!0;s.updateStoredEventData(e,_.storedEventID),e.preventDefault();var t=null;if(1==d.carousel_vertical_scroll_ondrag&&(t=s.handleScrollTop(_.storedEventID)),"vert"===t)return!0;_.lastMousePos=p(e);var i,r=_.lastMousePos-_.startMousePos,o=_.startInnerPos+r,a=r>0?"prev":"next";o>0&&"prev"==a&&(o/=3),o<-s.getElementSize(n).width&&"next"==a&&(o=_.startInnerPos+r/3),i={left:o+"px"},n.css(i)}function M(e){if(0==_.touchActive)return!0;_.touchActive=!1,P(),r.unpauseAutoplay()}function O(e){if(0==d.carousel_autoplay_pause_onhover)return!0;1==_.isPlayMode&&0==_.isPaused&&r.pauseAutoplay()}function z(e){if(0==d.carousel_autoplay_pause_onhover)return!0;r.unpauseAutoplay()}function L(){var e=_.lastTime-_.startTime,t=Math.abs(_.lastMousePos-_.startMousePos);return!(e>300)&&!(t>30)}this.startAutoplay=function(){_.isPlayMode=!0,_.isPaused=!1,o.trigger(r.events.START_PLAY),_.handle&&clearInterval(_.handle),_.handle=setInterval(j,d.carousel_autoplay_timeout)},this.unpauseAutoplay=function(){return 0==_.isPlayMode||(0==_.isPaused||void r.startAutoplay())},this.pauseAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!0,_.handle&&clearInterval(_.handle),o.trigger(r.events.PAUSE_PLAY)},this.stopAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!1,_.isPlayMode=!1,_.handle&&clearInterval(_.handle),o.trigger(r.events.STOP_PLAY)},this.destroy=function(){_.handle&&clearInterval(_.handle),o.off(r.events.START_PLAY),o.off(r.events.STOP_PLAY),i.unbind("mousedown"),i.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),i.off("mouseenter").off("mouseleave"),l.destroy()},this.init=function(i,n,r){r&&this.setMaxWidth(r),function(i,n){g_objects=i.getObjects(),a=i,jQuery(i),e=g_objects.g_objWrapper,t=g_objects.g_arrItems,d=jQuery.extend(d,n),l.setFixedMode(),l.setApproveClickFunction(L),l.init(i,d),u=l.getObjThumbs(),d=l.getOptions(),_.initTileWidth=d.tile_width,_.initTileHeight=d.tile_height,_.tileWidth=d.tile_width}(i,n)},this.setMaxWidth=function(e){_.carouselMaxWidth=e},this.setHtml=function(t){!function(t){t||(t=e);e.append("<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'></div></div>"),i=e.children(".ug-carousel-wrapper"),n=i.children(".ug-carousel-inner"),l.setHtml(n),u.getThumbs().fadeTo(0,1)}(t)},this.getElement=function(){return i},this.getObjTileDesign=function(){return l},this.getEstimatedHeight=function(){return d.tile_height+2*d.carousel_padding},this.run=function(){c()},this.scrollRight=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=_.numCurrent-e;i<=0&&(i=0),S(i)},this.scrollLeft=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=b(),n=_.numCurrent+e;n>=i&&(n=i-1),S(n)},this.setScrollLeftButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollLeft)},this.setScrollRightButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollRight)},this.setPlayPauseButton=function(e){s.setButtonMobileReady(e),1==_.isPlayMode&&0==_.isPaused&&e.addClass("ug-pause-icon"),o.on(r.events.START_PLAY,function(){e.addClass("ug-pause-icon")}),o.on(r.events.STOP_PLAY,function(){e.removeClass("ug-pause-icon")}),s.setButtonOnClick(e,function(){0==_.isPlayMode||1==_.isPaused?r.startAutoplay():r.stopAutoplay()})}}function UGLoadMore(){jQuery(this);var e,t,i,n,r=new UniteGalleryMain,o=(new UGFunctions,{isInited:!1}),a={loadmore_container:"ug_loadmore_wrapper"};function s(){e.show()}function l(){t.hide(),i.show();var o={numitems:r.getNumItems()};r.ajaxRequest("front_loadmore",o,function(n){i.hide();var o=n.html_items;1==n.show_loadmore?(t.blur().show(),i.hide()):e.hide(),r.addItems(o)},function(e){e="Ajax Error!"+e,i.hide(),n.show(),n.html(e)})}this.events={},this.destroy=function(){if(0==o.isInited)return!1},this.init=function(u,d){if(r=u,jQuery(r),a=jQuery.extend(a,d),0!=(e=jQuery("#"+a.loadmore_container)).length&&0!=(t=e.find(".ug-loadmore-button")).length&&0!=(i=e.find(".ug-loadmore-loader")).length&&0!=(n=e.find(".ug-loadmore-error")).length&&(o.isInited=!0),0==o.isInited)return trace("load more not inited, something is wrong"),!1;r.onEvent("tiles_first_placed",s),t.click(l)}}function UGTabs(){jQuery(this);var e,t,i=new UniteGalleryMain,n=(new UGFunctions,{tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"});function r(){"select"==n.tabs_type?t.change(s):e.click(a)}function o(e){i.requestNewItems(e)}function a(){var t=n.tabs_class_selected,i=jQuery(this);if(i.hasClass(t))return!0;e.not(i).removeClass(t),i.addClass(t);var r=i.data("catid");if(!r)return!0;o(r)}function s(){var e=jQuery(this).val();if(!e)return!0;o(e)}this.events={},this.destroy=function(){t&&t.off("change"),e&&e.off("click")},this.init=function(r,o){!function(r,o){i=r,jQuery(i),"select"==(n=jQuery.extend(n,o)).tabs_type?t=jQuery(n.tabs_container):e=jQuery(n.tabs_container+" .ug-tab")}(r,o)},this.run=function(){r()}}function UG_API(e){var t,i=this,n=(jQuery(i),new UniteGalleryMain),r=[];function o(e){var t={index:e.index,title:e.title,description:e.description,urlImage:e.urlImage,urlThumb:e.urlThumb},i=e.objThumbImage.data();for(var n in i){switch(n){case"image":case"description":continue}t[n]=i[n]}return t}n=e,t=jQuery(e),this.events={API_INIT_FUNCTIONS:"api_init",API_ON_EVENT:"api_on_event"},this.on=function(e,a,s){switch(!0!==s&&r.push({event:e,func:a}),e){case"item_change":t.on(n.events.ITEM_CHANGE,function(){var e=o(n.getSelectedItem());a(e.index,e)});break;case"resize":t.on(n.events.SIZE_CHANGE,a);break;case"enter_fullscreen":t.on(n.events.ENTER_FULLSCREEN,a);break;case"exit_fullscreen":t.on(n.events.EXIT_FULLSCREEN,a);break;case"play":t.on(n.events.START_PLAY,a);break;case"stop":t.on(n.events.STOP_PLAY,a);break;case"pause":t.on(n.events.PAUSE_PLAYING,a);break;case"continue":t.on(n.events.CONTINUE_PLAYING,a);break;case"open_lightbox":t.on(n.events.OPEN_LIGHTBOX,a);break;case"close_lightbox":t.on(n.events.CLOSE_LIGHTBOX,a);break;default:console&&console.log("wrong api event: "+e)}t.trigger(i.events.API_ON_EVENT,[e,a])},this.play=function(){n.startPlayMode()},this.stop=function(){n.stopPlayMode()},this.togglePlay=function(){n.togglePlayMode()},this.enterFullscreen=function(){n.toFullScreen()},this.exitFullscreen=function(){n.exitFullScreen()},this.toggleFullscreen=function(){n.toggleFullscreen()},this.resetZoom=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomBack()},this.zoomIn=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomIn()},this.zoomOut=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomOut()},this.nextItem=function(){n.nextItem()},this.prevItem=function(){n.prevItem()},this.selectItem=function(e){n.selectItem(e)},this.resize=function(e,t){t?n.resize(e,t):n.resize(e)},this.getItem=function(e){return o(n.getItem(e))},this.getNumItems=function(){return n.getNumItems()},this.getNumCurrent=function(){return n.getCurrentNumItem()},this.reloadGallery=function(e){if(!e)e={};n.run(null,e),r.map(function(e){i.on(e.event,e.func,!0)})},this.destroy=function(){n.destroy()},t.trigger(i.events.API_INIT_FUNCTIONS,i)}jQuery.fn.unitegallery=function(e){var t="#"+jQuery(this).attr("id");if(!e)e={};var i=new UniteGalleryMain;return i.run(t,e),void 0===window.ugArrGalleriesObjects&&(window.ugArrGalleriesObjects=[]),window.ugArrGalleriesObjects.push(i),new UG_API(i)};
inc_php/framework/functions.class.php CHANGED
@@ -29,6 +29,23 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
29
  throw new Exception($message);
30
  }
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  /**
34
  * throw error and show function trace
@@ -2383,7 +2400,8 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
2383
 
2384
 
2385
  public static function z___________OTHERS__________(){}
2386
-
 
2387
  /**
2388
  * get youtube video id from url, or ID
2389
  */
29
  throw new Exception($message);
30
  }
31
 
32
+ /**
33
+ * print object data
34
+ */
35
+ public static function showObjData($obj){
36
+
37
+ echo "<pre>";
38
+
39
+ dmp("Vars: ");
40
+ dmp(get_object_vars($obj));
41
+
42
+ dmp("Methods:");
43
+ dmp(get_class_methods($obj));
44
+
45
+ echo "</pre>";
46
+
47
+ }
48
+
49
 
50
  /**
51
  * throw error and show function trace
2400
 
2401
 
2402
  public static function z___________OTHERS__________(){}
2403
+
2404
+
2405
  /**
2406
  * get youtube video id from url, or ID
2407
  */
inc_php/unitecreator_actions.class.php CHANGED
@@ -365,6 +365,7 @@ class UniteCreatorActions{
365
  HelperUC::ajaxResponseSuccess("Product Deactivated, please refresh the page");
366
  break;
367
  case "check_catalog":
 
368
  $isForce = UniteFunctionsUC::getVal($data, "force");
369
  $isForce = UniteFunctionsUC::strToBool($isForce);
370
 
365
  HelperUC::ajaxResponseSuccess("Product Deactivated, please refresh the page");
366
  break;
367
  case "check_catalog":
368
+
369
  $isForce = UniteFunctionsUC::getVal($data, "force");
370
  $isForce = UniteFunctionsUC::strToBool($isForce);
371
 
inc_php/unitecreator_dialog_param.class.php CHANGED
@@ -912,7 +912,7 @@ class UniteCreatorDialogParamWork{
912
  <div class="vert_sap10"></div>
913
 
914
  <?php
915
- $this->putCheckbox("enable_ajax", __("Enable Ajax Options", "unlimited-elements-for-elementor"));
916
  ?>
917
 
918
  <div class="vert_sap10"></div>
912
  <div class="vert_sap10"></div>
913
 
914
  <?php
915
+ $this->putCheckbox("enable_ajax", __("Enable Ajax / Filters Options", "unlimited-elements-for-elementor"));
916
  ?>
917
 
918
  <div class="vert_sap10"></div>
inc_php/unitecreator_filters_process.class.php CHANGED
@@ -10,22 +10,26 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
10
  class UniteCreatorFiltersProcess{
11
 
12
  const DEBUG_MAIN_QUERY = false;
 
13
  const DEBUG_FILTER = false;
14
 
15
  private static $filters = null;
16
  private static $arrInputFiltersCache = null;
17
  private static $arrFiltersAssocCache = null;
18
  private static $currentTermCache = null;
 
19
 
20
  private static $isScriptAdded = false;
21
  private static $isFilesAdded = false;
22
  private static $isStyleAdded = false;
23
  private static $isAjaxCache = null;
24
  private static $isModeReplace = false;
 
25
 
26
  private static $showDebug = false;
27
  private static $originalQueryVars = null;
28
  private $contentWidgetsDebug = array();
 
29
 
30
  const TYPE_TERMS = "terms";
31
 
@@ -312,6 +316,14 @@ class UniteCreatorFiltersProcess{
312
  if(!empty($page))
313
  $arrOutput["page"] = $page;
314
 
 
 
 
 
 
 
 
 
315
  //num items
316
 
317
  $numItems = UniteFunctionsUC::getVal($request, "uccount");
@@ -385,14 +397,21 @@ class UniteCreatorFiltersProcess{
385
 
386
  $page = UniteFunctionsUC::getVal($arrInputFilters, "page");
387
 
388
- if(!empty($page))
389
  self::$filters["page"] = $page;
390
 
 
 
 
 
 
 
 
 
391
  //get num items
392
-
393
  $numItems = UniteFunctionsUC::getVal($arrInputFilters, "num_items");
394
 
395
- if(!empty($numItems))
396
  self::$filters["num_items"] = $numItems;
397
 
398
 
@@ -522,22 +541,32 @@ class UniteCreatorFiltersProcess{
522
  /**
523
  * process request filters
524
  */
525
- public function processRequestFilters($args){
526
-
527
  $isUnderAjax = $this->isUnderAjax();
528
 
529
- if($isUnderAjax == false)
530
  return($args);
531
 
 
532
  $arrFilters = $this->getRequestFilters();
533
 
534
  //---- set offset and count ----
535
 
536
  $page = UniteFunctionsUC::getVal($arrFilters, "page");
537
  $numItems = UniteFunctionsUC::getVal($arrFilters, "num_items");
 
538
 
539
- if(!empty($page)){
540
  $args = $this->processRequestFilters_setPaging($args, $page, $numItems);
 
 
 
 
 
 
 
 
541
  }
542
 
543
  $arrTerms = UniteFunctionsUC::getVal($arrFilters, "terms");
@@ -551,7 +580,6 @@ class UniteCreatorFiltersProcess{
551
 
552
  }
553
 
554
-
555
  if(self::DEBUG_FILTER == true){
556
  dmp("debug!!!");
557
  dmp($args);
@@ -560,8 +588,73 @@ class UniteCreatorFiltersProcess{
560
  }
561
 
562
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  return($args);
564
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
565
 
566
 
567
  private function _______AJAX__________(){}
@@ -659,8 +752,7 @@ class UniteCreatorFiltersProcess{
659
  $arrSettingsValues = UniteFunctionsUC::getVal($arrElement, "settings");
660
 
661
  $widgetName = str_replace("ucaddon_", "", $widgetType);
662
-
663
-
664
  $addon = new UniteCreatorAddon();
665
  $addon->initByAlias($widgetName, GlobalsUC::ADDON_TYPE_ELEMENTOR);
666
 
@@ -726,6 +818,7 @@ class UniteCreatorFiltersProcess{
726
 
727
  $this->contentWidgetsDebug = array();
728
 
 
729
  foreach($arrIDs as $elementID){
730
 
731
  $output = $this->getContentWidgetHtml($arrContent, $elementID, false);
@@ -853,6 +946,8 @@ class UniteCreatorFiltersProcess{
853
  $isModeFiltersInit = UniteFunctionsUC::getPostGetVariable("modeinit","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
854
  $isModeFiltersInit = UniteFunctionsUC::strToBool($isModeFiltersInit);
855
 
 
 
856
  $testTermIDs = UniteFunctionsUC::getPostGetVariable("testtermids","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
857
  UniteFunctionsUC::validateIDsList($testTermIDs);
858
 
@@ -861,18 +956,21 @@ class UniteCreatorFiltersProcess{
861
  $isModeReplace = UniteFunctionsUC::strToBool($isModeReplace);
862
 
863
  self::$isModeReplace = $isModeReplace;
864
-
865
-
866
- if($isModeFiltersInit == true)
867
- GlobalsProviderUC::$skipRunPostQueryOnce = true;
868
 
869
  $arrContent = HelperProviderCoreUC_EL::getElementorContentByPostID($layoutID);
870
 
871
  if(empty($arrContent))
872
  UniteFunctionsUC::throwError("Elementor content not found");
873
 
 
874
  $arrHtmlWidget = $this->getContentWidgetHtml($arrContent, $elementID);
875
 
 
 
 
876
  //find the term id's for test (find or not in the current posts query)
877
  if(!empty($testTermIDs)){
878
 
@@ -883,10 +981,10 @@ class UniteCreatorFiltersProcess{
883
  $request = $query->request;
884
 
885
  $taxRequest = $this->getInitFiltersTaxRequest($request, $testTermIDs);
886
-
887
  $db = HelperUC::getDB();
888
  $arrFoundTermIDs = $db->fetchSql($taxRequest);
889
-
890
  $arrFoundTermIDs = $this->modifyFoundTermsIDs($arrFoundTermIDs);
891
 
892
  //set the test term id's for the output
@@ -898,7 +996,7 @@ class UniteCreatorFiltersProcess{
898
  $htmlDebug = UniteFunctionsUC::getVal($arrHtmlWidget, "html_debug");
899
 
900
  $addWidgetsHTML = $this->getContentWidgetsHTML($arrContent, $addElIDs);
901
-
902
  //output the html
903
  $outputData = array();
904
 
@@ -949,7 +1047,7 @@ class UniteCreatorFiltersProcess{
949
  self::$isScriptAdded = true;
950
 
951
  $arrData = $this->getFiltersJSData();
952
-
953
  $strData = UniteFunctionsUC::jsonEncodeForClientSide($arrData);
954
 
955
  $script = "//Unlimited Elements Filters \n";
@@ -1061,18 +1159,22 @@ class UniteCreatorFiltersProcess{
1061
  //check if ajax related
1062
  $isAjax = UniteFunctionsUC::getVal($dataPosts, $postListName."_isajax");
1063
  $isAjax = UniteFunctionsUC::strToBool($isAjax);
1064
-
1065
  if($isAjax == false)
1066
  return($data);
1067
 
1068
  if(empty($param))
1069
  return($data);
1070
 
 
 
1071
  //check if ajax
1072
  $strAttributes = "";
1073
 
1074
- if($isAjax == true)
1075
- $strAttributes .= " data-ajax='true' ";
 
 
1076
 
1077
  $this->includeClientSideScripts();
1078
 
@@ -1081,7 +1183,7 @@ class UniteCreatorFiltersProcess{
1081
 
1082
  return($data);
1083
  }
1084
-
1085
 
1086
  /**
1087
  * get filters attributes
@@ -1090,11 +1192,19 @@ class UniteCreatorFiltersProcess{
1090
 
1091
  $urlBase = UniteFunctionsUC::getBaseUrl(GlobalsUC::$current_page_url);
1092
 
 
 
 
 
 
 
 
 
1093
  $arrData = array();
1094
  $arrData["urlbase"] = $urlBase;
1095
  $arrData["urlajax"] = GlobalsUC::$url_ajax_full;
1096
  $arrData["querybase"] = self::$originalQueryVars;
1097
-
1098
 
1099
  return($arrData);
1100
  }
@@ -1103,64 +1213,179 @@ class UniteCreatorFiltersProcess{
1103
 
1104
 
1105
  /**
1106
- * get editor filter arguments
1107
  */
1108
- public function addEditorFilterArguments($data, $isInitAfter, $isMainFilter){
1109
 
1110
- $arguments = "";
1111
- $style = "";
1112
- $addClass = " uc-grid-filter";
1113
- $addClassItem = "";
1114
- $isFirstLoad = true; //not in ajax, or with init after (also first load)
1115
 
1116
- $isInsideEditor = UniteCreatorElementorIntegrate::$isEditMode;
 
 
 
1117
 
1118
- $isUnderAjax = $this->isUnderAjax();
 
 
 
1119
 
1120
- if($isUnderAjax == true)
1121
- $isFirstLoad = false;
 
 
 
 
 
 
 
 
1122
 
1123
- if($isInitAfter == true){
1124
- $arguments = " data-initafter=\"true\"";
 
 
 
1125
 
1126
- if($isUnderAjax == false && $isInsideEditor == false){
1127
- $addClassItem = " uc-filter-item-hidden";
1128
- $addClass .= " uc-filter-initing";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1129
  }
1130
 
1131
- $isFirstLoad = true;
 
 
 
1132
  }
1133
 
1134
- if($isInsideEditor == true)
1135
- $isFirstLoad = true;
 
 
1136
 
1137
- if($isMainFilter == true)
1138
- $addClass .= " uc-main-filter";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139
 
1140
- $data["filter_isajax"] = $isUnderAjax?"yes":"no";
1141
- $data["filter_arguments"] = $arguments;
1142
- $data["filter_style"] = $style;
1143
- $data["filter_addclass"] = $addClass;
1144
- $data["filter_addclass_item"] = $addClassItem;
1145
- $data["filter_first_load"] = $isFirstLoad?"yes":"no";
 
 
 
 
 
1146
 
 
 
1147
 
1148
- return($data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1149
  }
1150
 
1151
 
1152
  /**
1153
  * modify the terms for init after
1154
  */
1155
- public function modifyOutputTermsForInitAfter($arrTerms){
1156
 
1157
  if(GlobalsProviderUC::$arrTestTermIDs === null)
1158
  return($arrTerms);
1159
-
1160
  $arrParentNumPosts = array();
1161
 
1162
  $arrPostNums = GlobalsProviderUC::$arrTestTermIDs;
1163
-
1164
  foreach($arrTerms as $key => $term){
1165
 
1166
  $termID = UniteFunctionsUC::getVal($term, "id");
@@ -1202,6 +1427,159 @@ class UniteCreatorFiltersProcess{
1202
  }
1203
 
1204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1205
  private function _______ARCHIVE_QUERY__________(){}
1206
 
1207
 
@@ -1214,19 +1592,11 @@ class UniteCreatorFiltersProcess{
1214
  return(false);
1215
 
1216
  self::$originalQueryVars = $query->query_vars;
1217
-
1218
- $arrFilters = $this->getRequestFilters();
1219
 
1220
- if(empty($arrFilters))
1221
- return(true);
1222
-
1223
- $args = UniteFunctionsWPUC::getPostsArgs($arrFilters, true);
1224
-
1225
- if(empty($args))
1226
- return(false);
1227
 
1228
- $query->query_vars = array_merge($query->query_vars, $args);
1229
 
 
1230
  }
1231
 
1232
 
@@ -1235,7 +1605,6 @@ class UniteCreatorFiltersProcess{
1235
  */
1236
  private function showMainQueryDebug(){
1237
 
1238
-
1239
  global $wp_query;
1240
 
1241
  $args = $wp_query->query_vars;
@@ -1309,11 +1678,11 @@ class UniteCreatorFiltersProcess{
1309
 
1310
  if(is_admin() == true)
1311
  return(false);
1312
-
1313
  add_action("wp", array($this, "operateAjaxResponse"));
1314
 
1315
- //add_action("parse_request", array($this, "checkModifyMainQuery"));
1316
-
1317
  }
1318
 
1319
 
10
  class UniteCreatorFiltersProcess{
11
 
12
  const DEBUG_MAIN_QUERY = false;
13
+
14
  const DEBUG_FILTER = false;
15
 
16
  private static $filters = null;
17
  private static $arrInputFiltersCache = null;
18
  private static $arrFiltersAssocCache = null;
19
  private static $currentTermCache = null;
20
+ private static $isModeInit = false;
21
 
22
  private static $isScriptAdded = false;
23
  private static $isFilesAdded = false;
24
  private static $isStyleAdded = false;
25
  private static $isAjaxCache = null;
26
  private static $isModeReplace = false;
27
+ private static $numTotalPosts;
28
 
29
  private static $showDebug = false;
30
  private static $originalQueryVars = null;
31
  private $contentWidgetsDebug = array();
32
+ private static $lastArgs = null;
33
 
34
  const TYPE_TERMS = "terms";
35
 
316
  if(!empty($page))
317
  $arrOutput["page"] = $page;
318
 
319
+ //offset
320
+ $offset = UniteFunctionsUC::getVal($request, "ucoffset");
321
+ $offset = (int)$offset;
322
+
323
+ if(!empty($offset))
324
+ $arrOutput["offset"] = $offset;
325
+
326
+
327
  //num items
328
 
329
  $numItems = UniteFunctionsUC::getVal($request, "uccount");
397
 
398
  $page = UniteFunctionsUC::getVal($arrInputFilters, "page");
399
 
400
+ if(!empty($page) && is_numeric($page))
401
  self::$filters["page"] = $page;
402
 
403
+ //get the offset
404
+
405
+ $offset = UniteFunctionsUC::getVal($arrInputFilters, "offset");
406
+
407
+ if(!empty($offset) && is_numeric($offset))
408
+ self::$filters["offset"] = $offset;
409
+
410
+
411
  //get num items
 
412
  $numItems = UniteFunctionsUC::getVal($arrInputFilters, "num_items");
413
 
414
+ if(!empty($numItems) && is_numeric($numItems))
415
  self::$filters["num_items"] = $numItems;
416
 
417
 
541
  /**
542
  * process request filters
543
  */
544
+ public function processRequestFilters($args, $isFilterable, $isMainQuery = false){
545
+
546
  $isUnderAjax = $this->isUnderAjax();
547
 
548
+ if($isUnderAjax == false && $isFilterable == false)
549
  return($args);
550
 
551
+
552
  $arrFilters = $this->getRequestFilters();
553
 
554
  //---- set offset and count ----
555
 
556
  $page = UniteFunctionsUC::getVal($arrFilters, "page");
557
  $numItems = UniteFunctionsUC::getVal($arrFilters, "num_items");
558
+ $offset = UniteFunctionsUC::getVal($arrFilters, "offset");
559
 
560
+ if(!empty($page))
561
  $args = $this->processRequestFilters_setPaging($args, $page, $numItems);
562
+
563
+ //set paging by offset
564
+ if(!empty($offset)){
565
+
566
+ $args["offset"] = $offset;
567
+
568
+ if(!empty($numItems))
569
+ $args["posts_per_page"] = $numItems;
570
  }
571
 
572
  $arrTerms = UniteFunctionsUC::getVal($arrFilters, "terms");
580
 
581
  }
582
 
 
583
  if(self::DEBUG_FILTER == true){
584
  dmp("debug!!!");
585
  dmp($args);
588
  }
589
 
590
 
591
+ //skip modify clauses in case of main query
592
+ if($isMainQuery == false)
593
+ return($args);
594
+
595
+
596
+ $postType = UniteFunctionsUC::getVal($args, "post_type");
597
+
598
+ //add additional filters in post clauses in some cases
599
+ switch($postType){
600
+ case "product":
601
+ self::$lastArgs = $args;
602
+ add_filter( 'posts_clauses', array( $this, 'modifyWCQuery' ), 10, 2 );
603
+ break;
604
+ }
605
+
606
  return($args);
607
  }
608
+
609
+ /**
610
+ * before get posts
611
+ */
612
+ public function modifyWCQuery($arrClauses){
613
+
614
+
615
+ if(empty(self::$lastArgs))
616
+ return($arrClauses);
617
+
618
+ $args = self::$lastArgs;
619
+
620
+ $postType = UniteFunctionsUC::getVal($args, "post_type");
621
+
622
+ if($postType != "product")
623
+ return($arrClauses);
624
+
625
+ $orderBY = UniteFunctionsUC::getVal($args, "orderby");
626
+ $dir = UniteFunctionsUC::getVal($args, "order", "DESC");
627
+
628
+ if(empty($orderBY))
629
+ return($arrClauses);
630
+
631
+ //add code filter by orderby
632
+
633
+ if(class_exists("WC_Query") == false)
634
+ return($arrClauses);
635
+
636
+ $objQuery = new WC_Query();
637
+
638
+ switch($orderBY){
639
+ case "price":
640
+ if($dir == "DESC")
641
+ $arrClauses = $objQuery->order_by_price_desc_post_clauses($arrClauses);
642
+ else
643
+ $arrClauses = $objQuery->order_by_price_asc_post_clauses($arrClauses);
644
+
645
+ break;
646
+ case 'popularity':
647
+ $arrClauses = $objQuery->order_by_popularity_post_clauses($arrClauses);
648
+ break;
649
+ case 'rating':
650
+ $arrClauses = $objQuery->order_by_rating_post_clauses($arrClauses);
651
+ break;
652
+ }
653
+
654
+ remove_filter( 'posts_clauses', array( $this, 'modifyWCQuery' ), 10, 2 );
655
+
656
+ return($arrClauses);
657
+ }
658
 
659
 
660
  private function _______AJAX__________(){}
752
  $arrSettingsValues = UniteFunctionsUC::getVal($arrElement, "settings");
753
 
754
  $widgetName = str_replace("ucaddon_", "", $widgetType);
755
+
 
756
  $addon = new UniteCreatorAddon();
757
  $addon->initByAlias($widgetName, GlobalsUC::ADDON_TYPE_ELEMENTOR);
758
 
818
 
819
  $this->contentWidgetsDebug = array();
820
 
821
+
822
  foreach($arrIDs as $elementID){
823
 
824
  $output = $this->getContentWidgetHtml($arrContent, $elementID, false);
946
  $isModeFiltersInit = UniteFunctionsUC::getPostGetVariable("modeinit","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
947
  $isModeFiltersInit = UniteFunctionsUC::strToBool($isModeFiltersInit);
948
 
949
+ self::$isModeInit = $isModeFiltersInit;
950
+
951
  $testTermIDs = UniteFunctionsUC::getPostGetVariable("testtermids","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
952
  UniteFunctionsUC::validateIDsList($testTermIDs);
953
 
956
  $isModeReplace = UniteFunctionsUC::strToBool($isModeReplace);
957
 
958
  self::$isModeReplace = $isModeReplace;
959
+
960
+ //if($isModeFiltersInit == true)
961
+ //GlobalsProviderUC::$skipRunPostQueryOnce = true;
 
962
 
963
  $arrContent = HelperProviderCoreUC_EL::getElementorContentByPostID($layoutID);
964
 
965
  if(empty($arrContent))
966
  UniteFunctionsUC::throwError("Elementor content not found");
967
 
968
+ //run the post query
969
  $arrHtmlWidget = $this->getContentWidgetHtml($arrContent, $elementID);
970
 
971
+ self::$numTotalPosts = GlobalsProviderUC::$lastPostQuery->found_posts;
972
+
973
+
974
  //find the term id's for test (find or not in the current posts query)
975
  if(!empty($testTermIDs)){
976
 
981
  $request = $query->request;
982
 
983
  $taxRequest = $this->getInitFiltersTaxRequest($request, $testTermIDs);
984
+
985
  $db = HelperUC::getDB();
986
  $arrFoundTermIDs = $db->fetchSql($taxRequest);
987
+
988
  $arrFoundTermIDs = $this->modifyFoundTermsIDs($arrFoundTermIDs);
989
 
990
  //set the test term id's for the output
996
  $htmlDebug = UniteFunctionsUC::getVal($arrHtmlWidget, "html_debug");
997
 
998
  $addWidgetsHTML = $this->getContentWidgetsHTML($arrContent, $addElIDs);
999
+
1000
  //output the html
1001
  $outputData = array();
1002
 
1047
  self::$isScriptAdded = true;
1048
 
1049
  $arrData = $this->getFiltersJSData();
1050
+
1051
  $strData = UniteFunctionsUC::jsonEncodeForClientSide($arrData);
1052
 
1053
  $script = "//Unlimited Elements Filters \n";
1159
  //check if ajax related
1160
  $isAjax = UniteFunctionsUC::getVal($dataPosts, $postListName."_isajax");
1161
  $isAjax = UniteFunctionsUC::strToBool($isAjax);
1162
+
1163
  if($isAjax == false)
1164
  return($data);
1165
 
1166
  if(empty($param))
1167
  return($data);
1168
 
1169
+ $filterBehavoiur = UniteFunctionsUC::getVal($dataPosts, $postListName."_ajax_seturl");
1170
+
1171
  //check if ajax
1172
  $strAttributes = "";
1173
 
1174
+ $strAttributes .= " data-ajax='true' ";
1175
+
1176
+ if(!empty($filterBehavoiur))
1177
+ $strAttributes .= " data-filterbehave='$filterBehavoiur' ";
1178
 
1179
  $this->includeClientSideScripts();
1180
 
1183
 
1184
  return($data);
1185
  }
1186
+
1187
 
1188
  /**
1189
  * get filters attributes
1192
 
1193
  $urlBase = UniteFunctionsUC::getBaseUrl(GlobalsUC::$current_page_url);
1194
 
1195
+ //include some common url filters
1196
+ $orderby = UniteFunctionsUC::getGetVar("orderby","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
1197
+
1198
+ if(!empty($orderby))
1199
+ $urlBase = UniteFunctionsUC::addUrlParams($urlBase, "orderby=$orderby");
1200
+
1201
+ //get current filters
1202
+
1203
  $arrData = array();
1204
  $arrData["urlbase"] = $urlBase;
1205
  $arrData["urlajax"] = GlobalsUC::$url_ajax_full;
1206
  $arrData["querybase"] = self::$originalQueryVars;
1207
+
1208
 
1209
  return($arrData);
1210
  }
1213
 
1214
 
1215
  /**
1216
+ * check if term selected by request
1217
  */
1218
+ private function isTermSelectedByRequest($term, $selectedTerms){
1219
 
1220
+ $taxonomy = UniteFunctionsUC::getVal($term, "taxonomy");
 
 
 
 
1221
 
1222
+ if(empty($taxonomy))
1223
+ return(false);
1224
+
1225
+ $arrSlugs = UniteFunctionsUC::getVal($selectedTerms, $taxonomy);
1226
 
1227
+ if(empty($arrSlugs))
1228
+ return(false);
1229
+
1230
+ $slug = UniteFunctionsUC::getVal($term, "slug");
1231
 
1232
+ $found = in_array($slug, $arrSlugs);
1233
+
1234
+ return($found);
1235
+ }
1236
+
1237
+
1238
+ /**
1239
+ * modify selected by request
1240
+ */
1241
+ private function modifyOutputTerms_modifySelectedByRequest($arrTerms){
1242
 
1243
+ $selectedTerms = null;
1244
+ $selectedTermIDs = null;
1245
+
1246
+ //if mode init - get selected id's from request
1247
+ if(self::$isModeInit == true){
1248
 
1249
+ $strSelectedTermIDs = UniteFunctionsUC::getPostGetVariable("ucinitselectedterms","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
1250
+
1251
+ if(empty($strSelectedTermIDs))
1252
+ return($arrTerms);
1253
+
1254
+ UniteFunctionsUC::validateIDsList($strSelectedTermIDs,"selected terms");
1255
+
1256
+ $selectedTermIDs = explode(",", $strSelectedTermIDs);
1257
+
1258
+ if(empty($selectedTermIDs))
1259
+ return($arrTerms);
1260
+
1261
+ }else{
1262
+
1263
+ $arrRequest = $this->getRequestFilters();
1264
+
1265
+ if(empty($arrRequest))
1266
+ return($arrTerms);
1267
+
1268
+ $selectedTerms = UniteFunctionsUC::getVal($arrRequest, "terms");
1269
+
1270
+ if(empty($selectedTerms))
1271
+ return($arrTerms);
1272
+
1273
+ }
1274
+
1275
+
1276
+ $arrSelected = array();
1277
+
1278
+ foreach($arrTerms as $index => $term){
1279
+
1280
+ if(!empty($selectedTerms))
1281
+ $isSelected = $this->isTermSelectedByRequest($term, $selectedTerms);
1282
+ else{
1283
+
1284
+ $termID = UniteFunctionsUC::getVal($term, "id");
1285
+ if(empty($termID))
1286
+ continue;
1287
+
1288
+ $isSelected = in_array($termID, $selectedTermIDs);
1289
  }
1290
 
1291
+ if($isSelected == false)
1292
+ continue;
1293
+
1294
+ $arrSelected["term_".$index] = true;
1295
  }
1296
 
1297
+ if(empty($arrSelected))
1298
+ return($arrTerms);
1299
+
1300
+ //modify the selected
1301
 
1302
+ foreach($arrTerms as $index => $term){
1303
+
1304
+ $isSelected = UniteFunctionsUC::getVal($arrSelected, "term_".$index);
1305
+
1306
+ if($isSelected == true){
1307
+ $term["iscurrent"] = true;
1308
+ $term["isselected"] = true;
1309
+ }else{
1310
+
1311
+ $term["iscurrent"] = false;
1312
+ $term["isselected"] = false;
1313
+ $term["class_selected"] = "";
1314
+ }
1315
+
1316
+ $arrTerms[$index] = $term;
1317
+ }
1318
 
1319
+ return($arrTerms);
1320
+ }
1321
+
1322
+
1323
+ /**
1324
+ * modify the selected and add first term if needed
1325
+ */
1326
+ private function modifyOutputTerms_modifySelected($arrTerms, $data){
1327
+
1328
+ $isSelectFirst = UniteFunctionsUC::getVal($data, "select_first");
1329
+ $isSelectFirst = UniteFunctionsUC::strToBool($isSelectFirst);
1330
 
1331
+ $addFirst = UniteFunctionsUC::getVal($data, "add_first");
1332
+ $addFirst = UniteFunctionsUC::strToBool($addFirst);
1333
 
1334
+ if($addFirst == true){
1335
+
1336
+ $text = UniteFunctionsUC::getVal($data, "first_item_text", __("All","unlimited-elements-for-elementor"));
1337
+
1338
+ $firstTerm = array();
1339
+ $firstTerm["index"] = 0;
1340
+ $firstTerm["name"] = $text;
1341
+ $firstTerm["slug"] = "";
1342
+ $firstTerm["link"] = "";
1343
+ $firstTerm["parent_id"] = "";
1344
+ $firstTerm["taxonomy"] = "";
1345
+
1346
+ if($isSelectFirst == true){
1347
+ $firstTerm["iscurrent"] = true;
1348
+ $firstTerm["isselected"] = true;
1349
+ }
1350
+
1351
+ $firstTerm["addclass"] = " uc-item-all";
1352
+
1353
+ if(!empty(self::$numTotalPosts))
1354
+ $firstTerm["num_posts"] = self::$numTotalPosts;
1355
+
1356
+ array_unshift($arrTerms, $firstTerm);
1357
+ }
1358
+
1359
+
1360
+ //add first selected
1361
+
1362
+ foreach($arrTerms as $index => $term){
1363
+
1364
+ $term["index"] = $index;
1365
+
1366
+ if($index == 0 && $isSelectFirst == true)
1367
+ $term["isselected"] = true;
1368
+
1369
+ $arrTerms[$index] = $term;
1370
+ }
1371
+
1372
+
1373
+ return($arrTerms);
1374
  }
1375
 
1376
 
1377
  /**
1378
  * modify the terms for init after
1379
  */
1380
+ private function modifyOutputTerms_forInitAfter($arrTerms){
1381
 
1382
  if(GlobalsProviderUC::$arrTestTermIDs === null)
1383
  return($arrTerms);
1384
+
1385
  $arrParentNumPosts = array();
1386
 
1387
  $arrPostNums = GlobalsProviderUC::$arrTestTermIDs;
1388
+
1389
  foreach($arrTerms as $key => $term){
1390
 
1391
  $termID = UniteFunctionsUC::getVal($term, "id");
1427
  }
1428
 
1429
 
1430
+ /**
1431
+ * modify limit loaded items
1432
+ */
1433
+ private function modifyOutputTerms_modifyLimitGrayed($arrTerms, $limitGrayedItems){
1434
+
1435
+ if(empty($limitGrayedItems))
1436
+ return($arrTerms);
1437
+
1438
+ $numTerms = count($arrTerms);
1439
+
1440
+ if($numTerms < $limitGrayedItems)
1441
+ return($arrTerms);
1442
+
1443
+ foreach($arrTerms as $index => $term){
1444
+
1445
+ if($index < $limitGrayedItems)
1446
+ continue;
1447
+
1448
+ $addClass = UniteFunctionsUC::getVal($term, "addclass");
1449
+ $addClass .= " uc-hide-loading-item";
1450
+
1451
+ $term["addclass"] = $addClass;
1452
+
1453
+ $arrTerms[$index] = $term;
1454
+ }
1455
+
1456
+
1457
+ return($arrTerms);
1458
+ }
1459
+
1460
+ /**
1461
+ * set selected class by options
1462
+ */
1463
+ private function modifyOutputTerms_setSelectedClass($arrTerms){
1464
+
1465
+ foreach($arrTerms as $index => $term){
1466
+
1467
+ $isSelected = UniteFunctionsUC::getVal($term, "isselected");
1468
+ $isSelected = UniteFunctionsUC::strToBool($isSelected);
1469
+
1470
+ if($isSelected == false)
1471
+ continue;
1472
+
1473
+ $class = UniteFunctionsUC::getVal($term, "addclass","");
1474
+ $class .= " uc-selected";
1475
+
1476
+ $term["addclass"] = $class;
1477
+
1478
+ $arrTerms[$index] = $term;
1479
+
1480
+ }
1481
+
1482
+ return($arrTerms);
1483
+ }
1484
+
1485
+ /**
1486
+ * get editor filter arguments
1487
+ */
1488
+ public function addEditorFilterArguments($data){
1489
+
1490
+ //add the filter related js and css includes
1491
+ $this->includeClientSideScripts();
1492
+
1493
+ $isInitAfter = UniteFunctionsUC::getVal($data, "init_after");
1494
+ $isInitAfter = UniteFunctionsUC::strToBool($isInitAfter);
1495
+
1496
+ $isMainFilter = UniteFunctionsUC::getVal($data, "is_main");
1497
+ $isMainFilter = UniteFunctionsUC::strToBool($isMainFilter);
1498
+
1499
+ $isReplaceTerms = UniteFunctionsUC::getVal($data, "replace_terms");
1500
+ $isReplaceTerms = UniteFunctionsUC::strToBool($isReplaceTerms);
1501
+
1502
+ $limitGrayedItems = UniteFunctionsUC::getVal($data, "load_limit_grayed");
1503
+ $limitGrayedItems = (int)$limitGrayedItems;
1504
+
1505
+
1506
+ $attributes = "";
1507
+ $style = "";
1508
+ $addClass = " uc-grid-filter";
1509
+ $addClassItem = "";
1510
+ $isFirstLoad = true; //not in ajax, or with init after (also first load)
1511
+
1512
+ $isInsideEditor = UniteCreatorElementorIntegrate::$isEditMode;
1513
+
1514
+ $isUnderAjax = $this->isUnderAjax();
1515
+
1516
+ if($isUnderAjax == true)
1517
+ $isFirstLoad = false;
1518
+
1519
+
1520
+ if($isInitAfter == true){
1521
+
1522
+ $attributes = " data-initafter=\"true\"";
1523
+
1524
+ if($isUnderAjax == false && $isInsideEditor == false){
1525
+ $addClassItem = " uc-filter-item-hidden";
1526
+ $addClass .= " uc-filter-initing";
1527
+ }
1528
+
1529
+ $isFirstLoad = true;
1530
+ }
1531
+
1532
+ if($isInsideEditor == true)
1533
+ $isFirstLoad = true;
1534
+
1535
+ //main filter
1536
+
1537
+ if($isMainFilter == true)
1538
+ $attributes .= " data-ismain=\"true\"";
1539
+
1540
+ if($isReplaceTerms == true)
1541
+ $attributes .= " data-replace-mode=\"true\"";
1542
+
1543
+
1544
+ $data["filter_isajax"] = $isUnderAjax?"yes":"no";
1545
+ $data["filter_attributes"] = $attributes;
1546
+ $data["filter_style"] = $style;
1547
+ $data["filter_addclass"] = $addClass;
1548
+ $data["filter_addclass_item"] = $addClassItem;
1549
+ $data["filter_first_load"] = $isFirstLoad?"yes":"no";
1550
+
1551
+ //modify terms
1552
+
1553
+ $arrTerms = UniteFunctionsUC::getVal($data, "taxonomy");
1554
+
1555
+ if($isInitAfter == true){
1556
+ $arrTerms = $this->modifyOutputTerms_forInitAfter($arrTerms, $isInitAfter, $isFirstLoad);
1557
+ }
1558
+
1559
+ //modify the selected class
1560
+
1561
+ $arrTerms = $this->modifyOutputTerms_modifySelected($arrTerms, $data);
1562
+
1563
+ //on init mode - modify selected and grayed loader
1564
+ if($isUnderAjax == false || self::$isModeInit == true){
1565
+
1566
+ $arrTerms = $this->modifyOutputTerms_modifySelectedByRequest($arrTerms);
1567
+ }
1568
+
1569
+ if($isInitAfter == true && !empty($limitGrayedItems) && $isUnderAjax == false)
1570
+ $arrTerms = $this->modifyOutputTerms_modifyLimitGrayed($arrTerms, $limitGrayedItems);
1571
+
1572
+ $arrTerms = $this->modifyOutputTerms_setSelectedClass($arrTerms);
1573
+
1574
+
1575
+ $data["taxonomy"] = $arrTerms;
1576
+
1577
+ return($data);
1578
+ }
1579
+
1580
+
1581
+
1582
+
1583
  private function _______ARCHIVE_QUERY__________(){}
1584
 
1585
 
1592
  return(false);
1593
 
1594
  self::$originalQueryVars = $query->query_vars;
 
 
1595
 
1596
+ $query->query_vars = $this->processRequestFilters($query->query_vars, true, true);
 
 
 
 
 
 
1597
 
 
1598
 
1599
+ return($query);
1600
  }
1601
 
1602
 
1605
  */
1606
  private function showMainQueryDebug(){
1607
 
 
1608
  global $wp_query;
1609
 
1610
  $args = $wp_query->query_vars;
1678
 
1679
  if(is_admin() == true)
1680
  return(false);
1681
+
1682
  add_action("wp", array($this, "operateAjaxResponse"));
1683
 
1684
+ add_action("parse_request", array($this, "checkModifyMainQuery"));
1685
+
1686
  }
1687
 
1688
 
inc_php/unitecreator_helperhtml.class.php CHANGED
@@ -919,84 +919,6 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
919
  return($arrRating);
920
  }
921
 
922
- /**
923
- * put unite gallery item html
924
- */
925
- public static function getUniteGalleryHtmlItem($item){
926
-
927
-
928
- $type = UniteFunctionsUC::getVal($item, "type");
929
- $title = UniteFunctionsUC::getVal($item, "title");
930
- $link = UniteFunctionsUC::getVal($item, "link");
931
- $image = UniteFunctionsUC::getVal($item, "image");
932
- $thumb = UniteFunctionsUC::getVal($item, "thumb");
933
- $description = UniteFunctionsUC::getVal($item, "description");
934
-
935
- $title = htmlspecialchars($title);
936
- $description = htmlspecialchars($description);
937
-
938
- $linkStart = "";
939
- $linkEnd = "";
940
-
941
- if(!empty($link)){
942
- $linkStart = "<a href=\"{$link}\">";
943
- $linkEnd = "</a>";
944
- }
945
-
946
- $nl = "\n";
947
-
948
- $html = "";
949
-
950
- if($linkStart)
951
- $html .= $nl.$linkStart;
952
-
953
- $html .= $nl."<img alt=\"{$title}\"";
954
- $html .= $nl." src=\"$thumb\"";
955
-
956
- if(!empty($image))
957
- $html .= $nl." data-image=\"$image\"";
958
-
959
- if(!empty($title))
960
- $html .= $nl." data-title=\"$title\"";
961
-
962
- if(!empty($description))
963
- $html .= $nl." data-description=\"$description\"";
964
-
965
- if($type != "image")
966
- $html .= $nl." data-type=\"$type\"";
967
-
968
-
969
- switch($type){
970
-
971
- case "youtube":
972
- case "vimeo":
973
- case "wistia":
974
-
975
- $videoID = UniteFunctionsUC::getVal($item, "videoid");
976
-
977
- if(!empty($videoID))
978
- $html .= $nl." data-videoid=\"$videoID\"";
979
-
980
- break;
981
- case "html5video":
982
-
983
- $urlMp4 = UniteFunctionsUC::getVal($item, "url_mp4");
984
-
985
- if(!empty($urlMp4))
986
- $html .= $nl." data-videomp4=\"$urlMp4\"";
987
-
988
- break;
989
- }
990
-
991
- $html .= ">"; //image end
992
-
993
- if($type != "image")
994
-
995
- if(!empty($linkEnd))
996
- $html .= $linkEnd;
997
-
998
- return($html);
999
- }
1000
 
1001
  /**
1002
  * put conditions html
@@ -1079,6 +1001,12 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
1079
  */
1080
  public static function putRemoteParentJS($arg1, $arg2 = null){
1081
 
 
 
 
 
 
 
1082
  $strOptions = "[$arg1";
1083
 
1084
  //maybe put something here
919
  return($arrRating);
920
  }
921
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
 
923
  /**
924
  * put conditions html
1001
  */
1002
  public static function putRemoteParentJS($arg1, $arg2 = null){
1003
 
1004
+
1005
+ if($arg2 == "unitegallery"){
1006
+ echo "{$arg1}.data(\"unitegallery-api\",api);\n";
1007
+ $arg2 = null;
1008
+ }
1009
+
1010
  $strOptions = "[$arg1";
1011
 
1012
  //maybe put something here
inc_php/unitecreator_operations.class.php CHANGED
@@ -709,6 +709,36 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
709
  }
710
 
711
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
712
  }
713
 
714
  ?>
709
  }
710
 
711
 
712
+ /**
713
+ *
714
+ * modify the text from widget
715
+ */
716
+ public function modifyTextFromWidget($text){
717
+
718
+ //convert current page
719
+
720
+ if(strpos($text, "%current_page_url%") !== false){
721
+
722
+ $urlPage = UniteFunctionsWPUC::getUrlCurrentPage(true);
723
+
724
+ $text = str_replace("%current_page_url%", $urlPage, $text);
725
+ }
726
+
727
+ if(strpos($text, "%current_page_title%") !== false){
728
+
729
+ $post = get_post();
730
+ if($post){
731
+ $title = $post->post_title;
732
+ $text = str_replace("%current_page_title%", $title, $text);
733
+ }
734
+ }
735
+
736
+
737
+ return($text);
738
+ }
739
+
740
+
741
+
742
  }
743
 
744
  ?>
inc_php/unitecreator_params_processor.class.php CHANGED
@@ -884,7 +884,7 @@ class UniteCreatorParamsProcessorWork{
884
  * @param $param
885
  */
886
  protected function getProcessedParamsValue_image($data, $value, $param){
887
-
888
  $mediaType = UniteFunctionsUC::getVal($param, "media_type");
889
 
890
  $name = $param["name"];
@@ -1439,6 +1439,41 @@ class UniteCreatorParamsProcessorWork{
1439
  return($html);
1440
  }
1441
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1442
  /**
1443
  * get link param data
1444
  */
@@ -1454,6 +1489,8 @@ class UniteCreatorParamsProcessorWork{
1454
  $noFollow = UniteFunctionsUC::getVal($value, "nofollow");
1455
  $customAttributes = UniteFunctionsUC::getVal($value, "custom_attributes");
1456
 
 
 
1457
  $urlFull = $url;
1458
  $scheme = parse_url($url, PHP_URL_SCHEME);
1459
 
@@ -1472,7 +1509,7 @@ class UniteCreatorParamsProcessorWork{
1472
  $addHtml .= " rel='nofollow'";
1473
 
1474
  if(!empty($customAttributes))
1475
- $addHtml .= " ".$customAttributes;
1476
 
1477
 
1478
  $data[$name] = $url;
@@ -1675,6 +1712,8 @@ class UniteCreatorParamsProcessorWork{
1675
  $data = $this->getProcessedParamData($data, $value, $param, $processType);
1676
  }
1677
 
 
 
1678
  return($data);
1679
  }
1680
 
884
  * @param $param
885
  */
886
  protected function getProcessedParamsValue_image($data, $value, $param){
887
+
888
  $mediaType = UniteFunctionsUC::getVal($param, "media_type");
889
 
890
  $name = $param["name"];
1439
  return($html);
1440
  }
1441
 
1442
+ /**
1443
+ * modify link attributes
1444
+ */
1445
+ private function getLinkData_modifyAttributes($attributes){
1446
+
1447
+ if(empty($attributes))
1448
+ return("");
1449
+
1450
+ $arr = explode(",", $attributes);
1451
+
1452
+ if(empty($arr))
1453
+ return($attributes);
1454
+
1455
+ $html = "";
1456
+
1457
+ foreach($arr as $attribute){
1458
+
1459
+ $arrAttr = explode("|", $attribute);
1460
+
1461
+ $key = $arrAttr[0];
1462
+ $value = $arrAttr[1];
1463
+
1464
+ $key = trim($key);
1465
+ $value = trim($value);
1466
+
1467
+ $key = str_replace('"', '', $key);
1468
+ $value = str_replace('"', '', $value);
1469
+
1470
+ $html .= " $key=\"$value\"";
1471
+ }
1472
+
1473
+ return($html);
1474
+ }
1475
+
1476
+
1477
  /**
1478
  * get link param data
1479
  */
1489
  $noFollow = UniteFunctionsUC::getVal($value, "nofollow");
1490
  $customAttributes = UniteFunctionsUC::getVal($value, "custom_attributes");
1491
 
1492
+ $customAttributes = $this->getLinkData_modifyAttributes($customAttributes);
1493
+
1494
  $urlFull = $url;
1495
  $scheme = parse_url($url, PHP_URL_SCHEME);
1496
 
1509
  $addHtml .= " rel='nofollow'";
1510
 
1511
  if(!empty($customAttributes))
1512
+ $addHtml .= $customAttributes;
1513
 
1514
 
1515
  $data[$name] = $url;
1712
  $data = $this->getProcessedParamData($data, $value, $param, $processType);
1713
  }
1714
 
1715
+ $data = $this->modifyDataBySpecialAddonBehaviour($data);
1716
+
1717
  return($data);
1718
  }
1719
 
inc_php/unitecreator_template_engine.class.php CHANGED
@@ -91,14 +91,34 @@ class UniteCreatorTemplateEngineWork{
91
 
92
  $sap = null;
93
  $numItem = null;
 
94
 
95
  if($input !== null){
96
- if(is_numeric($input))
97
- $numItem = $input;
98
- else
99
- $sap = $input;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
 
 
 
 
 
102
  $this->putItemsWork($templateName, $sap, $numItem);
103
  }
104
 
@@ -241,7 +261,7 @@ class UniteCreatorTemplateEngineWork{
241
  /**
242
  * get term meta
243
  */
244
- public function getTermMeta($termID){
245
 
246
  echo "no term meta in this platform";
247
 
@@ -621,7 +641,7 @@ class UniteCreatorTemplateEngineWork{
621
  public function putDynamicLoopTemplate($item, $templateID){
622
 
623
  $widgetID = UniteFunctionsUC::getVal($this->arrParams, "uc_id");
624
-
625
  HelperProviderCoreUC_EL::putListingItemTemplate($item, $templateID, $widgetID);
626
 
627
  }
@@ -828,7 +848,7 @@ class UniteCreatorTemplateEngineWork{
828
  break;
829
  case "put_unite_gallery_item":
830
 
831
- $htmlItem = HelperHtmlUC::getUniteGalleryHtmlItem($arg1);
832
 
833
  echo $htmlItem;
834
 
@@ -889,6 +909,18 @@ class UniteCreatorTemplateEngineWork{
889
 
890
  return($value);
891
  break;
 
 
 
 
 
 
 
 
 
 
 
 
892
  default:
893
 
894
  $type = UniteFunctionsUC::sanitizeAttr($type);
91
 
92
  $sap = null;
93
  $numItem = null;
94
+ $isGetFirst = false;
95
 
96
  if($input !== null){
97
+ switch($input){
98
+ case "shuffle": //shuffle items
99
+ shuffle($this->arrItems);
100
+ break;
101
+ case "one_random": //get one random item
102
+ shuffle($this->arrItems);
103
+ $isGetFirst = true;
104
+ break;
105
+ case "one_first":
106
+ $isGetFirst = true;
107
+ break;
108
+ default:
109
+ if(is_numeric($input))
110
+ $numItem = $input;
111
+ else
112
+ $sap = $input;
113
+ break;
114
+ }
115
+
116
  }
117
 
118
+ //get first item
119
+ if($isGetFirst == true && !empty($this->arrItems) && count($this->arrItems) > 1)
120
+ $this->arrItems = array($this->arrItems[0]);
121
+
122
  $this->putItemsWork($templateName, $sap, $numItem);
123
  }
124
 
261
  /**
262
  * get term meta
263
  */
264
+ public function getTermMeta($termID, $key=""){
265
 
266
  echo "no term meta in this platform";
267
 
641
  public function putDynamicLoopTemplate($item, $templateID){
642
 
643
  $widgetID = UniteFunctionsUC::getVal($this->arrParams, "uc_id");
644
+
645
  HelperProviderCoreUC_EL::putListingItemTemplate($item, $templateID, $widgetID);
646
 
647
  }
848
  break;
849
  case "put_unite_gallery_item":
850
 
851
+ $htmlItem = UniteCreatorUniteGallery::getUniteGalleryHtmlItem($arg1);
852
 
853
  echo $htmlItem;
854
 
909
 
910
  return($value);
911
  break;
912
+ case "modify_text":
913
+ $operations = new UCOperations();
914
+ $arg1 = $operations->modifyTextFromWidget($arg1);
915
+
916
+ return($arg1);
917
+ break;
918
+ case "get_term_image":
919
+
920
+ $arrImage = UniteFunctionsWPUC::getTermImage($arg1, $arg2);
921
+
922
+ return($arrImage);
923
+ break;
924
  default:
925
 
926
  $type = UniteFunctionsUC::sanitizeAttr($type);
inc_php/unitecreator_unitegallery.class.php CHANGED
@@ -701,4 +701,82 @@ class UniteCreatorUniteGallery{
701
  return($jsOutput);
702
  }
703
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
704
  }
701
  return($jsOutput);
702
  }
703
 
704
+ /**
705
+ * put unite gallery item html
706
+ */
707
+ public static function getUniteGalleryHtmlItem($item){
708
+
709
+
710
+ $type = UniteFunctionsUC::getVal($item, "type");
711
+ $title = UniteFunctionsUC::getVal($item, "title");
712
+ $link = UniteFunctionsUC::getVal($item, "link");
713
+ $image = UniteFunctionsUC::getVal($item, "image");
714
+ $thumb = UniteFunctionsUC::getVal($item, "thumb");
715
+ $description = UniteFunctionsUC::getVal($item, "description");
716
+
717
+ $title = htmlspecialchars($title);
718
+ $description = htmlspecialchars($description);
719
+
720
+ $linkStart = "";
721
+ $linkEnd = "";
722
+
723
+ if(!empty($link)){
724
+ $linkStart = "<a href=\"{$link}\">";
725
+ $linkEnd = "</a>";
726
+ }
727
+
728
+ $nl = "\n";
729
+
730
+ $html = "";
731
+
732
+ if($linkStart)
733
+ $html .= $nl.$linkStart;
734
+
735
+ $html .= $nl."<img alt=\"{$title}\"";
736
+ $html .= $nl." src=\"$thumb\"";
737
+
738
+ if(!empty($image))
739
+ $html .= $nl." data-image=\"$image\"";
740
+
741
+ if(!empty($title))
742
+ $html .= $nl." data-title=\"$title\"";
743
+
744
+ if(!empty($description))
745
+ $html .= $nl." data-description=\"$description\"";
746
+
747
+ if($type != "image")
748
+ $html .= $nl." data-type=\"$type\"";
749
+
750
+
751
+ switch($type){
752
+
753
+ case "youtube":
754
+ case "vimeo":
755
+ case "wistia":
756
+
757
+ $videoID = UniteFunctionsUC::getVal($item, "videoid");
758
+
759
+ if(!empty($videoID))
760
+ $html .= $nl." data-videoid=\"$videoID\"";
761
+
762
+ break;
763
+ case "html5video":
764
+
765
+ $urlMp4 = UniteFunctionsUC::getVal($item, "url_mp4");
766
+
767
+ if(!empty($urlMp4))
768
+ $html .= $nl." data-videomp4=\"$urlMp4\"";
769
+
770
+ break;
771
+ }
772
+
773
+ $html .= ">"; //image end
774
+
775
+ if(!empty($linkEnd))
776
+ $html .= $linkEnd;
777
+
778
+ return($html);
779
+ }
780
+
781
+
782
  }
inc_php/unitecreator_web_api.class.php CHANGED
@@ -14,6 +14,7 @@ class UniteCreatorWebAPIWork{
14
  private static $arrCatalogData;
15
  protected $product;
16
  private $lastAPIData;
 
17
 
18
  const IS_CATALOG_UNLIMITED = true;
19
  const CATALOG_CHECK_PERIOD = 7200; //2 hours
@@ -362,6 +363,25 @@ class UniteCreatorWebAPIWork{
362
  return($arrAddon);
363
  }
364
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  private function a___________GET_CATALOG___________(){}
366
 
367
  /**
@@ -485,8 +505,10 @@ class UniteCreatorWebAPIWork{
485
 
486
  $response = UniteFunctionsUC::getUrlContents(self::$urlAPI, $data);
487
 
488
- $this->lastAPIData["response"] = $response;
 
489
 
 
490
 
491
  if($isRawResponse == true){
492
  $len = strlen($response);
@@ -620,10 +642,28 @@ class UniteCreatorWebAPIWork{
620
  $arrData["stamp"] = $stamp;
621
  $arrData["catalog"] = $arrCatalog;
622
  $arrData["catalog_addon_names"] = $this->getArrAddonNames($arrCatalog);
623
-
 
 
624
  UniteProviderFunctionsUC::updateOption(self::OPTION_CATALOG, $arrData);
625
 
626
  $arrSavedCatalog = UniteProviderFunctionsUC::getOption(self::OPTION_CATALOG);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
627
  }
628
 
629
 
@@ -634,8 +674,12 @@ class UniteCreatorWebAPIWork{
634
 
635
  try{
636
 
 
 
637
  $isCatalogExists = $this->isCatalogExists();
638
 
 
 
639
  if($isCatalogExists == false){
640
  $checkPerioud = self::CATALOG_CHECK_PERIOD_NOTEXIST;
641
  $catalogStamp = null;
@@ -663,6 +707,7 @@ class UniteCreatorWebAPIWork{
663
  $response = $this->callAPI("check_catalog", $data);
664
 
665
 
 
666
  /* print pages
667
  unset($response["catalog"]["addons"]);dmp($response["catalog"]);exit();
668
  */
@@ -670,6 +715,8 @@ class UniteCreatorWebAPIWork{
670
  $updateFound = UniteFunctionsUC::getVal($response, "update_found");
671
  $updateFound = UniteFunctionsUC::strToBool($updateFound);
672
 
 
 
673
  $clientResponse = array();
674
 
675
  //response up to date
@@ -678,6 +725,8 @@ class UniteCreatorWebAPIWork{
678
  $catalogDate = UniteFunctionsUC::timestamp2DateTime($catalogStamp);
679
  $clientResponse["message"] = "The catalog is up to date: ".$catalogDate;
680
 
 
 
681
  return($clientResponse);
682
  }
683
 
@@ -692,6 +741,8 @@ class UniteCreatorWebAPIWork{
692
  $clientResponse["catalog_date"] = $date;
693
  $clientResponse["message"] = "The catalog updated. Catalog Date: $date. \n Please refresh the browser to see the changes";
694
 
 
 
695
  return($clientResponse);
696
 
697
  }catch(Exception $e){
14
  private static $arrCatalogData;
15
  protected $product;
16
  private $lastAPIData;
17
+ private $arrDebug = array();
18
 
19
  const IS_CATALOG_UNLIMITED = true;
20
  const CATALOG_CHECK_PERIOD = 7200; //2 hours
363
  return($arrAddon);
364
  }
365
 
366
+ private function a___________DEBUG___________(){}
367
+
368
+
369
+ /**
370
+ * debug the check catalog
371
+ */
372
+ public function addDebug($str){
373
+
374
+ $this->arrDebug[] = $str;
375
+ }
376
+
377
+ /**
378
+ * get debug
379
+ */
380
+ public function getDebug(){
381
+
382
+ return($this->arrDebug);
383
+ }
384
+
385
  private function a___________GET_CATALOG___________(){}
386
 
387
  /**
505
 
506
  $response = UniteFunctionsUC::getUrlContents(self::$urlAPI, $data);
507
 
508
+ if(is_string($response))
509
+ $this->addDebug("api response length: ".strlen($response));
510
 
511
+ $this->lastAPIData["response"] = $response;
512
 
513
  if($isRawResponse == true){
514
  $len = strlen($response);
642
  $arrData["stamp"] = $stamp;
643
  $arrData["catalog"] = $arrCatalog;
644
  $arrData["catalog_addon_names"] = $this->getArrAddonNames($arrCatalog);
645
+
646
+ $this->addDebug("Updating catalog option: ".self::OPTION_CATALOG);
647
+
648
  UniteProviderFunctionsUC::updateOption(self::OPTION_CATALOG, $arrData);
649
 
650
  $arrSavedCatalog = UniteProviderFunctionsUC::getOption(self::OPTION_CATALOG);
651
+
652
+ //error debug
653
+
654
+ if(empty($arrSavedCatalog)){
655
+
656
+ $strData = serialize($arrData);
657
+
658
+ $len = strlen($strData);
659
+
660
+ $this->addDebug("<span style='color:red;'>The wp option: <b>".self::OPTION_CATALOG."</b> not saved. Options size: $len The Maybe because it's some mysql DB problem. It should save large amount of data, but maybe there is a limit</span>");
661
+
662
+ }else{
663
+
664
+ $this->addDebug("Option updated successfully ");
665
+
666
+ }
667
  }
668
 
669
 
674
 
675
  try{
676
 
677
+ $this->addDebug("Start check update catalog, force: $isForce");
678
+
679
  $isCatalogExists = $this->isCatalogExists();
680
 
681
+ $this->addDebug("Catalog exists: ". $isCatalogExists);
682
+
683
  if($isCatalogExists == false){
684
  $checkPerioud = self::CATALOG_CHECK_PERIOD_NOTEXIST;
685
  $catalogStamp = null;
707
  $response = $this->callAPI("check_catalog", $data);
708
 
709
 
710
+
711
  /* print pages
712
  unset($response["catalog"]["addons"]);dmp($response["catalog"]);exit();
713
  */
715
  $updateFound = UniteFunctionsUC::getVal($response, "update_found");
716
  $updateFound = UniteFunctionsUC::strToBool($updateFound);
717
 
718
+ $this->addDebug("update found: ".$updateFound);
719
+
720
  $clientResponse = array();
721
 
722
  //response up to date
725
  $catalogDate = UniteFunctionsUC::timestamp2DateTime($catalogStamp);
726
  $clientResponse["message"] = "The catalog is up to date: ".$catalogDate;
727
 
728
+ $this->addDebug($clientResponse["message"]);
729
+
730
  return($clientResponse);
731
  }
732
 
741
  $clientResponse["catalog_date"] = $date;
742
  $clientResponse["message"] = "The catalog updated. Catalog Date: $date. \n Please refresh the browser to see the changes";
743
 
744
+ $this->addDebug($clientResponse["message"]);
745
+
746
  return($clientResponse);
747
 
748
  }catch(Exception $e){
includes.php CHANGED
@@ -12,7 +12,7 @@ if(!defined('UNLIMITED_ELEMENTS_INC'))
12
  defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
13
 
14
  if(!defined("UNLIMITED_ELEMENTS_VERSION"))
15
- define("UNLIMITED_ELEMENTS_VERSION", "1.5.0");
16
 
17
  $currentFile = __FILE__;
18
  $currentFolder = dirname($currentFile);
12
  defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
13
 
14
  if(!defined("UNLIMITED_ELEMENTS_VERSION"))
15
+ define("UNLIMITED_ELEMENTS_VERSION", "1.5.3");
16
 
17
  $currentFile = __FILE__;
18
  $currentFolder = dirname($currentFile);
js/unitecreator_admin.js CHANGED
@@ -806,7 +806,7 @@ function UniteCreatorAdmin(){
806
 
807
  //add items related functions
808
  if(hasItems == true){
809
- var paramPutItems = {type:"uc_function", name:"put_items()"};
810
  var paramPutItems2 = {type:"uc_function", name:"put_items2()"};
811
  var paramNumItems = {type:"text", name:"uc_num_items"};
812
 
806
 
807
  //add items related functions
808
  if(hasItems == true){
809
+ var paramPutItems = {type:"uc_function", name:"put_items()",raw_insert_text:"{{put_items()}} {# - you can use parameters: \"shuffle\", \"one_random\", \"one_first\" like put_items(\"shuffle\") #}"};
810
  var paramPutItems2 = {type:"uc_function", name:"put_items2()"};
811
  var paramNumItems = {type:"text", name:"uc_num_items"};
812
 
provider/core/plugins/unlimited_elements/elementor/assets/uc_editor_admin.js CHANGED
@@ -1384,7 +1384,6 @@ function UniteCreatorElementorEditorAdmin(){
1384
  objSettingsData[shortKey] = objData;
1385
  }
1386
 
1387
- trace(objSettingsData);
1388
 
1389
  return(objSettingsData);
1390
  }
1384
  objSettingsData[shortKey] = objData;
1385
  }
1386
 
 
1387
 
1388
  return(objSettingsData);
1389
  }
provider/core/plugins/unlimited_elements/elementor/elementor_integrate.class.php CHANGED
@@ -740,7 +740,7 @@ class UniteCreatorElementorIntegrate{
740
  * on before render
741
  */
742
  public function onFrontAfterRender($objElement){
743
-
744
  $settings = $objElement->get_settings_for_display();
745
 
746
  $backgroundType = UniteFunctionsUC::getVal($settings, self::CONTROL_BACKGROUND_TYPE);
@@ -788,27 +788,42 @@ class UniteCreatorElementorIntegrate{
788
 
789
  jQuery(document).ready(function(){
790
 
791
- var objBG = jQuery(".unlimited-elements-background-overlay");
792
-
793
- if(objBG.length == 0)
794
- return(false);
795
-
796
- objBG.each(function(index, bgElement){
 
 
797
 
798
- var objBgElement = jQuery(bgElement);
799
 
800
- var targetID = objBgElement.data("forid");
801
 
802
- var objTarget = jQuery("*[data-id=\""+targetID+"\"]");
803
-
804
- if(objTarget.length == 0)
805
- return(true);
 
 
 
 
 
 
 
806
 
807
- objBgElement.detach().prependTo(objTarget).show();
808
- objBgElement.trigger("bg_attached");
 
 
 
 
809
 
810
  });
 
811
  });
 
812
 
813
  </script>
814
  <?php
740
  * on before render
741
  */
742
  public function onFrontAfterRender($objElement){
743
+
744
  $settings = $objElement->get_settings_for_display();
745
 
746
  $backgroundType = UniteFunctionsUC::getVal($settings, self::CONTROL_BACKGROUND_TYPE);
788
 
789
  jQuery(document).ready(function(){
790
 
791
+ function ucBackgroundOverlayPutStart(){
792
+
793
+ var objBG = jQuery(".unlimited-elements-background-overlay");
794
+
795
+ if(objBG.length == 0)
796
+ return(false);
797
+
798
+ objBG.each(function(index, bgElement){
799
 
800
+ var objBgElement = jQuery(bgElement);
801
 
802
+ var targetID = objBgElement.data("forid");
803
 
804
+ var objTarget = jQuery("*[data-id=\""+targetID+"\"]");
805
+
806
+ if(objTarget.length == 0)
807
+ return(true);
808
+
809
+ objBgElement.detach().prependTo(objTarget).show();
810
+ objBgElement.trigger("bg_attached");
811
+ objBgElement.addClass("uc-bg-attached");
812
+
813
+ });
814
+ }
815
 
816
+ ucBackgroundOverlayPutStart();
817
+
818
+ jQuery( document ).on( 'elementor/popup/show', () => {
819
+
820
+ if(jQuery(".unlimited-elements-background-overlay").not(".uc-bg-attached").length)
821
+ ucBackgroundOverlayPutStart();
822
 
823
  });
824
+
825
  });
826
+
827
 
828
  </script>
829
  <?php
provider/core/plugins/unlimited_elements/elementor/elementor_widget.class.php CHANGED
@@ -710,8 +710,10 @@ class UniteCreatorElementorWidget extends Widget_Base {
710
  if($conditionOperator == "not_equal")
711
  $conditionAttribute .= "!";
712
 
 
713
  $arrCondition[$conditionAttribute] = $conditionValue;
714
 
 
715
  // add second condition
716
 
717
  $conditionAttribute2 = UniteFunctionsUC::getVal($param, "condition_attribute2");
@@ -729,6 +731,7 @@ class UniteCreatorElementorWidget extends Widget_Base {
729
 
730
  $arrCondition[$conditionAttribute2] = $conditionValue2;
731
 
 
732
  return($arrCondition);
733
  }
734
 
@@ -760,7 +763,7 @@ class UniteCreatorElementorWidget extends Widget_Base {
760
 
761
  //set condition
762
  if($enableCondition == true){
763
- $elementorCondition = $this->getControlArrayUC_getCondition($param, $elementorCondition);
764
  }
765
 
766
  if(isset($param["value"]))
@@ -2233,7 +2236,7 @@ class UniteCreatorElementorWidget extends Widget_Base {
2233
  $elementorCondition = $this->getControlArrayUC_getCondition($arrCat);
2234
 
2235
  if(!empty($elementorCondition))
2236
- $arrSectionOptions["condition"] = $elementorCondition;
2237
  }
2238
 
2239
  $this->start_controls_section($catID, $arrSectionOptions);
@@ -2267,6 +2270,7 @@ class UniteCreatorElementorWidget extends Widget_Base {
2267
  $useFor = UniteFunctionsUC::getVal($param, "use_for");
2268
  switch($useFor){
2269
  case "remote":
 
2270
  break;
2271
  default:
2272
  $hasListing = true;
@@ -2445,6 +2449,7 @@ class UniteCreatorElementorWidget extends Widget_Base {
2445
 
2446
  switch($useFor){
2447
  case "remote":
 
2448
  return(false);
2449
  break;
2450
  }
710
  if($conditionOperator == "not_equal")
711
  $conditionAttribute .= "!";
712
 
713
+
714
  $arrCondition[$conditionAttribute] = $conditionValue;
715
 
716
+
717
  // add second condition
718
 
719
  $conditionAttribute2 = UniteFunctionsUC::getVal($param, "condition_attribute2");
731
 
732
  $arrCondition[$conditionAttribute2] = $conditionValue2;
733
 
734
+
735
  return($arrCondition);
736
  }
737
 
763
 
764
  //set condition
765
  if($enableCondition == true){
766
+ $elementorCondition = $this->getControlArrayUC_getCondition($param, $elementorCondition);
767
  }
768
 
769
  if(isset($param["value"]))
2236
  $elementorCondition = $this->getControlArrayUC_getCondition($arrCat);
2237
 
2238
  if(!empty($elementorCondition))
2239
+ $arrSectionOptions["condition"] = $elementorCondition;
2240
  }
2241
 
2242
  $this->start_controls_section($catID, $arrSectionOptions);
2270
  $useFor = UniteFunctionsUC::getVal($param, "use_for");
2271
  switch($useFor){
2272
  case "remote":
2273
+ case "filter":
2274
  break;
2275
  default:
2276
  $hasListing = true;
2449
 
2450
  switch($useFor){
2451
  case "remote":
2452
+ case "filter":
2453
  return(false);
2454
  break;
2455
  }
provider/core/plugins/unlimited_elements/elementor/pagination.class.php CHANGED
@@ -66,40 +66,39 @@ class UniteCreatorElementorPagination{
66
 
67
  //add filter enabled controls
68
 
69
- if($isFilterable == true){
70
-
71
- $widget->add_control(
72
- $paramName.'_filterable',
73
- [
74
- 'label' => __( 'Filterable', "unlimited-elements-for-elementor"),
75
- 'type' => \Elementor\Controls_Manager::SELECT,
76
- 'default' => '',
77
- 'separator' => 'before',
78
- 'options' => [
79
- '' => __( 'None', "unlimited-elements-for-elementor"),
80
- 'using_widget' => __( 'Using Post Filters Widgets', "unlimited-elements-for-elementor"),
81
- ],
82
- ]
83
- );
84
-
85
- }
86
-
87
  if($enableAjax == true){
88
 
89
  $widget->add_control(
90
  $paramName.'_isajax',
91
  [
92
- 'label' => __( 'Enable Ajax', "unlimited-elements-for-elementor"),
93
  'type' => \Elementor\Controls_Manager::SWITCHER,
94
  'label_on' => __( 'Yes', 'unlimited-elements-for-elementor' ),
95
  'label_off' => __( 'No', 'unlimited-elements-for-elementor' ),
96
  'return_value' => 'true',
97
  'default' => '',
98
  'separator' => 'before',
99
- 'description'=>__('When turn on, all the filters, all the filters interaction will be with ajax', 'unlimited-elements-for-elementor')
100
  ]
101
  );
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
105
  $widget->end_controls_section();
@@ -311,7 +310,7 @@ class UniteCreatorElementorPagination{
311
  private function getCurrentPage(){
312
 
313
  //return by ucpage in case ajax request
314
-
315
  $objFilters = new UniteCreatorFiltersProcess();
316
  $isFrontAjax = $objFilters->isFrontAjaxRequest();
317
 
@@ -325,15 +324,15 @@ class UniteCreatorElementorPagination{
325
  }
326
 
327
  $currentPage = 1;
328
- if(!empty(GlobalsProviderUC::$lastPostQuery_page))
 
329
  $currentPage = GlobalsProviderUC::$lastPostQuery_page;
 
330
  else{
331
- $currentPage = get_query_var("page");
332
  }
333
 
334
- if(empty($currentPage))
335
- $currentPage = 1;
336
-
337
  return($currentPage);
338
  }
339
 
@@ -356,7 +355,7 @@ class UniteCreatorElementorPagination{
356
  /**
357
  * get single page options
358
  */
359
- private function getSinglePageOptions($options){
360
 
361
  //output demo pagination
362
  $isEditMode = UniteCreatorElementorIntegrate::$isEditMode;
@@ -395,7 +394,7 @@ class UniteCreatorElementorPagination{
395
  $options['base'] = trailingslashit( $permalink ) . '%_%';
396
  $options['format'] = user_trailingslashit( '%#%', 'single_paged' );
397
 
398
- if($isFront || $isArchive)
399
  $options['format'] = user_trailingslashit( 'page/%#%', 'single_paged' );
400
 
401
  }else{ //if not permalinks
@@ -423,13 +422,13 @@ class UniteCreatorElementorPagination{
423
  /**
424
  * get has more by last post query
425
  */
426
- private function isHasMoreByLastQuery(){
427
 
428
  //define has more by last post query
429
  $foundPosts = GlobalsProviderUC::$lastPostQuery->found_posts;
430
 
431
  if(empty($foundPosts))
432
- return(false);
433
 
434
  $numPosts = GlobalsProviderUC::$lastPostQuery->post_count;
435
 
@@ -441,10 +440,11 @@ class UniteCreatorElementorPagination{
441
  $offset = 0;
442
 
443
  $lastPost = $offset + $numPosts;
 
444
  if($lastPost >= $foundPosts)
445
- return(false);
446
-
447
- return(true);
448
  }
449
 
450
 
@@ -456,10 +456,16 @@ class UniteCreatorElementorPagination{
456
  $currentPage = $this->getCurrentPage();
457
  $totalPages = $this->getTotalPages();
458
 
 
 
459
  if(GlobalsProviderUC::$lastPostQuery){
460
 
461
- $hasMore = $this->isHasMoreByLastQuery();
462
-
 
 
 
 
463
  }else{
464
 
465
  $hasMore = false;
@@ -469,12 +475,15 @@ class UniteCreatorElementorPagination{
469
 
470
  $nextPage = $currentPage+1;
471
 
472
- $output = array();
473
  $output["current"] = $currentPage;
474
  $output["next"] = $nextPage;
475
  $output["total"] = $totalPages;
476
  $output["has_more"] = $hasMore;
477
 
 
 
 
478
  return($output);
479
  }
480
 
@@ -509,6 +518,9 @@ class UniteCreatorElementorPagination{
509
  $isDebug = UniteFunctionsUC::getVal($args, "debug_pagination_options");
510
  $isDebug = UniteFunctionsUC::strToBool($isDebug);
511
 
 
 
 
512
 
513
  //--------- prepare options
514
 
@@ -536,20 +548,50 @@ class UniteCreatorElementorPagination{
536
  //$options["current"] = 3;
537
 
538
  //-------- put pagination html
539
-
540
  $isArchivePage = UniteFunctionsWPUC::isArchiveLocation();
 
 
 
 
 
 
 
 
 
 
 
 
541
 
542
- if($isArchivePage == true && !empty(GlobalsProviderUC::$lastPostQuery_paginationType) && GlobalsProviderUC::$lastPostQuery_paginationType != GlobalsProviderUC::QUERY_TYPE_CURRENT)
543
  $isArchivePage = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
 
545
  if($isArchivePage == true){
546
-
547
  $options = $this->getArchivePageOptions($options);
548
  $pagination = get_the_posts_pagination($options);
549
 
550
  //put debug
551
  if($isDebug == true){
552
- echo "<div class='uc-pagination-debug'>";
553
  dmP("Archive Pagination");
554
 
555
  global $wp_query;
@@ -575,10 +617,9 @@ class UniteCreatorElementorPagination{
575
  }else{ //on single
576
 
577
  //skip for home pages
578
- $options = $this->getSinglePageOptions($options);
579
 
580
  if($isDebug == true){
581
- echo "<div class='uc-pagination-debug'>";
582
 
583
  dmp("custom query pagination");
584
  }
@@ -629,21 +670,30 @@ class UniteCreatorElementorPagination{
629
  return($output);
630
  }
631
 
632
-
633
  $arrPagingData = $this->getPagingData();
634
-
635
  $hasMore = UniteFunctionsUC::getVal($arrPagingData, "has_more");
636
 
637
  $nextPage = UniteFunctionsUC::getVal($arrPagingData, "next");
638
 
 
 
639
  $attributes = "";
640
  $style = "";
641
-
642
- if($hasMore == true)
643
- $attributes = "data-more=\"$hasMore\" data-nextpage=\"$nextPage\"";
 
 
 
 
 
 
 
644
  else
645
  $style = "style='display:none'";
646
 
 
647
  $output = array();
648
  $output["attributes"] = $attributes;
649
  $output["style"] = $style;
66
 
67
  //add filter enabled controls
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  if($enableAjax == true){
70
 
71
  $widget->add_control(
72
  $paramName.'_isajax',
73
  [
74
+ 'label' => __( 'Enable Post Filtering', "unlimited-elements-for-elementor"),
75
  'type' => \Elementor\Controls_Manager::SWITCHER,
76
  'label_on' => __( 'Yes', 'unlimited-elements-for-elementor' ),
77
  'label_off' => __( 'No', 'unlimited-elements-for-elementor' ),
78
  'return_value' => 'true',
79
  'default' => '',
80
  'separator' => 'before',
81
+ 'description'=>__('When turned on, you can use all the post filters widgets like tabs filter, load more etc with this grid', 'unlimited-elements-for-elementor')
82
  ]
83
  );
84
 
85
+ $widget->add_control(
86
+ $paramName.'_ajax_seturl',
87
+ array(
88
+ 'label' => __( 'Filters Behavoiur', "unlimited-elements-for-elementor"),
89
+ 'type' => \Elementor\Controls_Manager::SELECT,
90
+ 'default' => 'ajax',
91
+ 'options' => array(
92
+ 'ajax' => __( 'Ajax', "unlimited-elements-for-elementor"),
93
+ //'url' => __( 'Url Change Only', "unlimited-elements-for-elementor"),
94
+ 'mixed' => __( 'Ajax and Url Change', "unlimited-elements-for-elementor")
95
+ ),
96
+ 'condition' => array($paramName.'_isajax'=>"true"),
97
+ 'description'=>__('Choose the filters behaviour for the current grid. If third mode selected - after ajax it will remember the current grid and filters state in the url so you can get back to it later', 'unlimited-elements-for-elementor')
98
+ )
99
+ );
100
+
101
+
102
  }
103
 
104
  $widget->end_controls_section();
310
  private function getCurrentPage(){
311
 
312
  //return by ucpage in case ajax request
313
+
314
  $objFilters = new UniteCreatorFiltersProcess();
315
  $isFrontAjax = $objFilters->isFrontAjaxRequest();
316
 
324
  }
325
 
326
  $currentPage = 1;
327
+ if(!empty(GlobalsProviderUC::$lastPostQuery_page)){
328
+
329
  $currentPage = GlobalsProviderUC::$lastPostQuery_page;
330
+ }
331
  else{
332
+ $currentPage = get_query_var("page");
333
  }
334
 
335
+
 
 
336
  return($currentPage);
337
  }
338
 
355
  /**
356
  * get single page options
357
  */
358
+ private function getSinglePageOptions($options, $forceFormat = null){
359
 
360
  //output demo pagination
361
  $isEditMode = UniteCreatorElementorIntegrate::$isEditMode;
394
  $options['base'] = trailingslashit( $permalink ) . '%_%';
395
  $options['format'] = user_trailingslashit( '%#%', 'single_paged' );
396
 
397
+ if($isFront || $isArchive || $forceFormat == "page")
398
  $options['format'] = user_trailingslashit( 'page/%#%', 'single_paged' );
399
 
400
  }else{ //if not permalinks
422
  /**
423
  * get has more by last post query
424
  */
425
+ private function getNextOffsetByQuery(){
426
 
427
  //define has more by last post query
428
  $foundPosts = GlobalsProviderUC::$lastPostQuery->found_posts;
429
 
430
  if(empty($foundPosts))
431
+ return(-1);
432
 
433
  $numPosts = GlobalsProviderUC::$lastPostQuery->post_count;
434
 
440
  $offset = 0;
441
 
442
  $lastPost = $offset + $numPosts;
443
+
444
  if($lastPost >= $foundPosts)
445
+ return(-1);
446
+
447
+ return($lastPost);
448
  }
449
 
450
 
456
  $currentPage = $this->getCurrentPage();
457
  $totalPages = $this->getTotalPages();
458
 
459
+ $nextOffset = null;
460
+
461
  if(GlobalsProviderUC::$lastPostQuery){
462
 
463
+ $currentOffset = GlobalsProviderUC::$lastPostQuery_offset;
464
+
465
+ $nextOffset = $this->getNextOffsetByQuery();
466
+
467
+ $hasMore = $nextOffset >= 0;
468
+
469
  }else{
470
 
471
  $hasMore = false;
475
 
476
  $nextPage = $currentPage+1;
477
 
478
+ $output = array();
479
  $output["current"] = $currentPage;
480
  $output["next"] = $nextPage;
481
  $output["total"] = $totalPages;
482
  $output["has_more"] = $hasMore;
483
 
484
+ if($hasMore == true)
485
+ $output["next_offset"] = $nextOffset;
486
+
487
  return($output);
488
  }
489
 
518
  $isDebug = UniteFunctionsUC::getVal($args, "debug_pagination_options");
519
  $isDebug = UniteFunctionsUC::strToBool($isDebug);
520
 
521
+ $forceFormat = UniteFunctionsUC::getVal($args, "force_format");
522
+ if($forceFormat == "none")
523
+ $forceFormat = null;
524
 
525
  //--------- prepare options
526
 
548
  //$options["current"] = 3;
549
 
550
  //-------- put pagination html
551
+
552
  $isArchivePage = UniteFunctionsWPUC::isArchiveLocation();
553
+
554
+ if($isDebug == true){
555
+ echo "<div class='uc-pagination-debug'>";
556
+
557
+ dmp("is archive (original): ".$isArchivePage);
558
+
559
+ if(!empty($forceFormat))
560
+ dmp("Force Format: ".$forceFormat);
561
+ }
562
+
563
+
564
+ //fix the archive
565
 
566
+ if($isArchivePage == true && !empty(GlobalsProviderUC::$lastPostQuery_paginationType) && GlobalsProviderUC::$lastPostQuery_paginationType != GlobalsProviderUC::QUERY_TYPE_CURRENT){
567
  $isArchivePage = false;
568
+
569
+ if($isDebug == true){
570
+ dmp("last pagination type: ");
571
+ dmp(GlobalsProviderUC::$lastPostQuery_paginationType);
572
+
573
+ dmp("change to custom");
574
+ }
575
+ }
576
+
577
+ //force format yes/no
578
+
579
+ switch($forceFormat){
580
+ case "archive":
581
+ $isArchivePage = true;
582
+ break;
583
+ case "custom":
584
+ $isArchivePage = false;
585
+ break;
586
+ }
587
 
588
  if($isArchivePage == true){
589
+
590
  $options = $this->getArchivePageOptions($options);
591
  $pagination = get_the_posts_pagination($options);
592
 
593
  //put debug
594
  if($isDebug == true){
 
595
  dmP("Archive Pagination");
596
 
597
  global $wp_query;
617
  }else{ //on single
618
 
619
  //skip for home pages
620
+ $options = $this->getSinglePageOptions($options, $forceFormat);
621
 
622
  if($isDebug == true){
 
623
 
624
  dmp("custom query pagination");
625
  }
670
  return($output);
671
  }
672
 
 
673
  $arrPagingData = $this->getPagingData();
674
+
675
  $hasMore = UniteFunctionsUC::getVal($arrPagingData, "has_more");
676
 
677
  $nextPage = UniteFunctionsUC::getVal($arrPagingData, "next");
678
 
679
+ $nextOffset = UniteFunctionsUC::getVal($arrPagingData, "next_offset");
680
+
681
  $attributes = "";
682
  $style = "";
683
+
684
+ if($hasMore == true){
685
+ $attributes = "data-more=\"$hasMore\"";
686
+
687
+ if(!empty($nextOffset))
688
+ $attributes .= " data-nextoffset=\"$nextOffset\" ";
689
+ else
690
+ $attributes .= " data-nextpage=\"$nextPage\" ";
691
+
692
+ }
693
  else
694
  $style = "style='display:none'";
695
 
696
+
697
  $output = array();
698
  $output["attributes"] = $attributes;
699
  $output["style"] = $style;
provider/core/plugins/unlimited_elements/helper_provider_core.class.php CHANGED
@@ -222,9 +222,11 @@ class HelperProviderCoreUC_EL{
222
  //our db avoid some filters like polylang
223
  try{
224
  $db = HelperUC::getDB();
225
- $arrPosts = $db->fetch(UniteProviderFunctionsUC::$tablePosts,
226
- array("post_type"=>"elementor_library",
227
- "post_status"=>"publish"));
 
 
228
 
229
  }catch(Exception $e){
230
  $arrPosts = array();
@@ -241,9 +243,15 @@ class HelperProviderCoreUC_EL{
241
  $postID = UniteFunctionsUC::getVal($post, "ID");
242
  $title = UniteFunctionsUC::getVal($post, "post_title");
243
  $slug = UniteFunctionsUC::getVal($post, "post_name");
244
-
 
245
  $templateType = get_post_meta($postID, "_elementor_template_type", true);
246
 
 
 
 
 
 
247
  switch($templateType){
248
  case "single-post":
249
  $templateType = "single";
@@ -285,7 +293,7 @@ class HelperProviderCoreUC_EL{
285
  }
286
 
287
  asort($arrShort);
288
-
289
  self::$arrCacheElementorTemplate = $arrShort;
290
 
291
  return($arrShort);
@@ -482,6 +490,19 @@ class HelperProviderCoreUC_EL{
482
  echo $output;
483
  }
484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
 
486
  /**
487
  * put elementor template
@@ -500,8 +521,8 @@ class HelperProviderCoreUC_EL{
500
  /**
501
  * put the post listing template
502
  */
503
- public static function putListingItemTemplate_post($post, $templateID, $widgetID){
504
-
505
  if(empty($widgetID))
506
  return(false);
507
 
@@ -530,7 +551,10 @@ class HelperProviderCoreUC_EL{
530
  "template_id" => $templateID,
531
  "widget_id"=>$widgetID);
532
 
533
- $htmlTemplate = self::getElementorTemplate($templateID);
 
 
 
534
 
535
  //add one more class
536
 
@@ -538,7 +562,7 @@ class HelperProviderCoreUC_EL{
538
  $dest = "{$source} uc-post-$postID";
539
 
540
  $htmlTemplate = str_replace($source, $dest, $htmlTemplate);
541
-
542
  echo $htmlTemplate;
543
 
544
  GlobalsUnlimitedElements::$renderingDynamicData = null;
@@ -663,7 +687,15 @@ class HelperProviderCoreUC_EL{
663
  * put listing loop
664
  */
665
  public static function putListingItemTemplate($item, $templateID, $widgetID){
666
-
 
 
 
 
 
 
 
 
667
  //set type
668
 
669
  $type = null;
@@ -689,7 +721,7 @@ class HelperProviderCoreUC_EL{
689
 
690
  //template output
691
  if($type == "post")
692
- self::putListingItemTemplate_post($item, $templateID, $widgetID);
693
  else
694
  echo "output term";
695
 
222
  //our db avoid some filters like polylang
223
  try{
224
  $db = HelperUC::getDB();
225
+
226
+ $tablePosts = UniteProviderFunctionsUC::$tablePosts;
227
+ $sql = "select * from $tablePosts where post_type in ('elementor_library','jet-engine') and post_status='publish'";
228
+ $arrPosts = $db->fetchSql($sql);
229
+
230
 
231
  }catch(Exception $e){
232
  $arrPosts = array();
243
  $postID = UniteFunctionsUC::getVal($post, "ID");
244
  $title = UniteFunctionsUC::getVal($post, "post_title");
245
  $slug = UniteFunctionsUC::getVal($post, "post_name");
246
+ $postType = UniteFunctionsUC::getVal($post, "post_type");
247
+
248
  $templateType = get_post_meta($postID, "_elementor_template_type", true);
249
 
250
+ //jet addition
251
+ if($postType == "jet-engine"){
252
+ $postID = "jet_".$postID;
253
+ }
254
+
255
  switch($templateType){
256
  case "single-post":
257
  $templateType = "single";
293
  }
294
 
295
  asort($arrShort);
296
+
297
  self::$arrCacheElementorTemplate = $arrShort;
298
 
299
  return($arrShort);
490
  echo $output;
491
  }
492
 
493
+ /**
494
+ * get jet template
495
+ */
496
+ public static function getJetTemplateListingItem($templateID, $post){
497
+
498
+ if(function_exists("jet_engine") == false)
499
+ return(false);
500
+
501
+ jet_engine()->frontend->set_listing( $templateID );
502
+ $content = jet_engine()->frontend->get_listing_item( $post );
503
+
504
+ return($content);
505
+ }
506
 
507
  /**
508
  * put elementor template
521
  /**
522
  * put the post listing template
523
  */
524
+ public static function putListingItemTemplate_post($post, $templateID, $widgetID, $listingType = "elementor"){
525
+
526
  if(empty($widgetID))
527
  return(false);
528
 
551
  "template_id" => $templateID,
552
  "widget_id"=>$widgetID);
553
 
554
+ if($listingType == "jet")
555
+ $htmlTemplate = self::getJetTemplateListingItem($templateID, $post);
556
+ else
557
+ $htmlTemplate = self::getElementorTemplate($templateID);
558
 
559
  //add one more class
560
 
562
  $dest = "{$source} uc-post-$postID";
563
 
564
  $htmlTemplate = str_replace($source, $dest, $htmlTemplate);
565
+
566
  echo $htmlTemplate;
567
 
568
  GlobalsUnlimitedElements::$renderingDynamicData = null;
687
  * put listing loop
688
  */
689
  public static function putListingItemTemplate($item, $templateID, $widgetID){
690
+
691
+ $listingType = "elementor";
692
+
693
+ //jet determine
694
+ if(is_string($templateID) == true && strpos($templateID, "jet_") !== false){
695
+ $templateID = (int)str_replace("jet_", "", $templateID);
696
+ $listingType = "jet";
697
+ }
698
+
699
  //set type
700
 
701
  $type = null;
721
 
722
  //template output
723
  if($type == "post")
724
+ self::putListingItemTemplate_post($item, $templateID, $widgetID, $listingType);
725
  else
726
  echo "output term";
727
 
provider/freemius/includes/class-freemius.php CHANGED
@@ -3550,6 +3550,8 @@
3550
  * @since 1.1.7.3
3551
  */
3552
  static function _toggle_debug_mode() {
 
 
3553
  if ( ! is_super_admin() ) {
3554
  return;
3555
  }
@@ -3571,10 +3573,19 @@
3571
  * @since 1.2.1.6
3572
  */
3573
  static function _get_debug_log() {
 
 
 
 
 
 
 
 
 
3574
  $logs = FS_Logger::load_db_logs(
3575
  fs_request_get( 'filters', false, 'post' ),
3576
- ! empty( $_POST['limit'] ) && is_numeric( $_POST['limit'] ) ? $_POST['limit'] : 200,
3577
- ! empty( $_POST['offset'] ) && is_numeric( $_POST['offset'] ) ? $_POST['offset'] : 0
3578
  );
3579
 
3580
  self::shoot_ajax_success( $logs );
@@ -4447,6 +4458,12 @@
4447
  * @since 1.0.9
4448
  */
4449
  function _email_about_firewall_issue() {
 
 
 
 
 
 
4450
  $this->_admin_notices->remove_sticky( 'failed_connect_api' );
4451
 
4452
  $pong = $this->ping();
@@ -4521,6 +4538,12 @@
4521
  * @since 1.1.7.4
4522
  */
4523
  function _retry_connectivity_test() {
 
 
 
 
 
 
4524
  $this->_admin_notices->remove_sticky( 'failed_connect_api_first' );
4525
 
4526
  $pong = $this->ping();
3550
  * @since 1.1.7.3
3551
  */
3552
  static function _toggle_debug_mode() {
3553
+ check_admin_referer( 'fs_toggle_debug_mode' );
3554
+
3555
  if ( ! is_super_admin() ) {
3556
  return;
3557
  }
3573
  * @since 1.2.1.6
3574
  */
3575
  static function _get_debug_log() {
3576
+ check_admin_referer( 'fs_get_debug_log' );
3577
+
3578
+ if ( ! is_super_admin() ) {
3579
+ return;
3580
+ }
3581
+
3582
+ $limit = min( ! empty( $_POST['limit'] ) ? absint( $_POST['limit'] ) : 200, 200 );
3583
+ $offset = min( ! empty( $_POST['offset'] ) ? absint( $_POST['offset'] ) : 200, 200 );
3584
+
3585
  $logs = FS_Logger::load_db_logs(
3586
  fs_request_get( 'filters', false, 'post' ),
3587
+ $limit,
3588
+ $offset
3589
  );
3590
 
3591
  self::shoot_ajax_success( $logs );
4458
  * @since 1.0.9
4459
  */
4460
  function _email_about_firewall_issue() {
4461
+ check_admin_referer( 'fs_resolve_firewall_issues' );
4462
+
4463
+ if ( ! current_user_can( is_multisite() ? 'manage_options' : 'activate_plugins' ) ) {
4464
+ return;
4465
+ }
4466
+
4467
  $this->_admin_notices->remove_sticky( 'failed_connect_api' );
4468
 
4469
  $pong = $this->ping();
4538
  * @since 1.1.7.4
4539
  */
4540
  function _retry_connectivity_test() {
4541
+ check_admin_referer( 'fs_retry_connectivity_test' );
4542
+
4543
+ if ( ! current_user_can( is_multisite() ? 'manage_options' : 'activate_plugins' ) ) {
4544
+ return;
4545
+ }
4546
+
4547
  $this->_admin_notices->remove_sticky( 'failed_connect_api_first' );
4548
 
4549
  $pong = $this->ping();
provider/freemius/includes/managers/class-fs-admin-notice-manager.php CHANGED
@@ -175,7 +175,12 @@
175
  *
176
  */
177
  function dismiss_notice_ajax_callback() {
178
- $this->_sticky_storage->remove( $_POST['message_id'] );
 
 
 
 
 
179
  wp_die();
180
  }
181
 
@@ -469,4 +474,4 @@
469
  }
470
 
471
  #endregion
472
- }
175
  *
176
  */
177
  function dismiss_notice_ajax_callback() {
178
+ check_admin_referer( 'fs_dismiss_notice_action' );
179
+
180
+ if ( ! is_numeric( $_POST['message_id'] ) ) {
181
+ $this->_sticky_storage->remove( $_POST['message_id'] );
182
+ }
183
+
184
  wp_die();
185
  }
186
 
474
  }
475
 
476
  #endregion
477
+ }
provider/freemius/includes/sdk/Exceptions/ArgumentNotExistException.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
3
  exit;
4
  }
@@ -6,4 +10,4 @@
6
  if ( ! class_exists( 'Freemius_ArgumentNotExistException' ) ) {
7
  class Freemius_ArgumentNotExistException extends Freemius_InvalidArgumentException {
8
  }
9
- }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
  if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
7
  exit;
8
  }
10
  if ( ! class_exists( 'Freemius_ArgumentNotExistException' ) ) {
11
  class Freemius_ArgumentNotExistException extends Freemius_InvalidArgumentException {
12
  }
13
+ }
provider/freemius/includes/sdk/Exceptions/EmptyArgumentException.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
3
  exit;
4
  }
@@ -6,4 +10,4 @@
6
  if ( ! class_exists( 'Freemius_EmptyArgumentException' ) ) {
7
  class Freemius_EmptyArgumentException extends Freemius_InvalidArgumentException {
8
  }
9
- }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
  if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
7
  exit;
8
  }
10
  if ( ! class_exists( 'Freemius_EmptyArgumentException' ) ) {
11
  class Freemius_EmptyArgumentException extends Freemius_InvalidArgumentException {
12
  }
13
+ }
provider/freemius/includes/sdk/Exceptions/Exception.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  if ( ! class_exists( 'Freemius_Exception' ) ) {
3
  /**
4
  * Thrown when an API call returns an exception.
@@ -71,4 +75,4 @@
71
  return $str . $this->getMessage();
72
  }
73
  }
74
- }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
  if ( ! class_exists( 'Freemius_Exception' ) ) {
7
  /**
8
  * Thrown when an API call returns an exception.
75
  return $str . $this->getMessage();
76
  }
77
  }
78
+ }
provider/freemius/includes/sdk/Exceptions/InvalidArgumentException.php CHANGED
@@ -1,8 +1,12 @@
1
  <?php
 
 
 
 
2
  if ( ! class_exists( 'Freemius_Exception' ) ) {
3
  exit;
4
  }
5
 
6
  if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
7
  class Freemius_InvalidArgumentException extends Freemius_Exception { }
8
- }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
  if ( ! class_exists( 'Freemius_Exception' ) ) {
7
  exit;
8
  }
9
 
10
  if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
11
  class Freemius_InvalidArgumentException extends Freemius_Exception { }
12
+ }
provider/freemius/includes/sdk/Exceptions/OAuthException.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  if ( ! class_exists( 'Freemius_Exception' ) ) {
3
  exit;
4
  }
@@ -9,4 +13,4 @@
9
  parent::__construct( $pResult );
10
  }
11
  }
12
- }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
  if ( ! class_exists( 'Freemius_Exception' ) ) {
7
  exit;
8
  }
13
  parent::__construct( $pResult );
14
  }
15
  }
16
+ }
provider/freemius/includes/sdk/FreemiusBase.php CHANGED
@@ -15,6 +15,10 @@
15
  * under the License.
16
  */
17
 
 
 
 
 
18
  if ( ! defined( 'FS_API__VERSION' ) ) {
19
  define( 'FS_API__VERSION', '1' );
20
  }
15
  * under the License.
16
  */
17
 
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
  if ( ! defined( 'FS_API__VERSION' ) ) {
23
  define( 'FS_API__VERSION', '1' );
24
  }
provider/freemius/includes/sdk/FreemiusWordPress.php CHANGED
@@ -14,6 +14,9 @@
14
  * License for the specific language governing permissions and limitations
15
  * under the License.
16
  */
 
 
 
17
 
18
  require_once dirname( __FILE__ ) . '/FreemiusBase.php';
19
 
@@ -709,4 +712,4 @@
709
  }
710
 
711
  #endregion
712
- }
14
  * License for the specific language governing permissions and limitations
15
  * under the License.
16
  */
17
+ if ( ! defined( 'ABSPATH' ) ) {
18
+ exit;
19
+ }
20
 
21
  require_once dirname( __FILE__ ) . '/FreemiusBase.php';
22
 
712
  }
713
 
714
  #endregion
715
+ }
provider/freemius/require.php CHANGED
@@ -6,6 +6,10 @@
6
  * @since 1.1.9
7
  */
8
 
 
 
 
 
9
  // Configuration should be loaded first.
10
  require_once dirname( __FILE__ ) . '/config.php';
11
  require_once WP_FS__DIR_INCLUDES . '/fs-core-functions.php';
@@ -46,4 +50,4 @@
46
  require_once WP_FS__DIR_INCLUDES . '/class-fs-admin-notices.php';
47
  require_once WP_FS__DIR_INCLUDES . '/class-freemius-abstract.php';
48
  require_once WP_FS__DIR_INCLUDES . '/sdk/Exceptions/Exception.php';
49
- require_once WP_FS__DIR_INCLUDES . '/class-freemius.php';
6
  * @since 1.1.9
7
  */
8
 
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
  // Configuration should be loaded first.
14
  require_once dirname( __FILE__ ) . '/config.php';
15
  require_once WP_FS__DIR_INCLUDES . '/fs-core-functions.php';
50
  require_once WP_FS__DIR_INCLUDES . '/class-fs-admin-notices.php';
51
  require_once WP_FS__DIR_INCLUDES . '/class-freemius-abstract.php';
52
  require_once WP_FS__DIR_INCLUDES . '/sdk/Exceptions/Exception.php';
53
+ require_once WP_FS__DIR_INCLUDES . '/class-freemius.php';
provider/freemius/start.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @var string
17
  */
18
- $this_sdk_version = '2.4.2';
19
 
20
  #region SDK Selection Logic --------------------------------------------------------------------
21
 
15
  *
16
  * @var string
17
  */
18
+ $this_sdk_version = '2.4.3';
19
 
20
  #region SDK Selection Logic --------------------------------------------------------------------
21
 
provider/freemius/templates/account/partials/addon.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
  /**
3
  * @var array $VARS
4
  * @var Freemius $fs
@@ -443,4 +448,4 @@
443
  </td>
444
  <!--/ Optional Delete Action -->
445
  <?php endif ?>
446
- </tr>
1
  <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
  /**
8
  * @var array $VARS
9
  * @var Freemius $fs
448
  </td>
449
  <!--/ Optional Delete Action -->
450
  <?php endif ?>
451
+ </tr>
provider/freemius/templates/ajax-loader.php CHANGED
@@ -1 +1,6 @@
1
- <div class="fs-ajax-loader" style="display: none"><?php for ( $i = 1; $i <= 8; $i ++ ) : ?><div class="fs-ajax-loader-bar fs-ajax-loader-bar-<?php echo $i ?>"></div><?php endfor ?></div>
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+ ?>
6
+ <div class="fs-ajax-loader" style="display: none"><?php for ( $i = 1; $i <= 8; $i ++ ) : ?><div class="fs-ajax-loader-bar fs-ajax-loader-bar-<?php echo $i ?>"></div><?php endfor ?></div>
provider/freemius/templates/debug.php CHANGED
@@ -37,6 +37,8 @@
37
 
38
  $.post( ajaxurl, {
39
  action: 'fs_toggle_debug_mode',
 
 
40
  is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0)
41
  }, function ( response ) {
42
  if ( 1 == response ) {
@@ -111,7 +113,8 @@
111
  if (optionName) {
112
  $.post(ajaxurl, {
113
  action : 'fs_get_db_option',
114
- _wpnonce : '<?php echo wp_create_nonce( 'fs_get_db_option' ) ?>',
 
115
  option_name: optionName
116
  }, function (response) {
117
  if (response.data.value)
@@ -131,7 +134,8 @@
131
  if (optionValue) {
132
  $.post(ajaxurl, {
133
  action : 'fs_set_db_option',
134
- _wpnonce : '<?php echo wp_create_nonce( 'fs_set_db_option' ) ?>',
 
135
  option_name : optionName,
136
  option_value: optionValue
137
  }, function () {
@@ -724,6 +728,8 @@
724
 
725
  $.post(ajaxurl, {
726
  action : 'fs_get_debug_log',
 
 
727
  filters: filters,
728
  offset : offset,
729
  limit : limit
37
 
38
  $.post( ajaxurl, {
39
  action: 'fs_toggle_debug_mode',
40
+ // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
41
+ _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_toggle_debug_mode' ) ); ?>,
42
  is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0)
43
  }, function ( response ) {
44
  if ( 1 == response ) {
113
  if (optionName) {
114
  $.post(ajaxurl, {
115
  action : 'fs_get_db_option',
116
+ // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
117
+ _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_get_db_option' ) ); ?>,
118
  option_name: optionName
119
  }, function (response) {
120
  if (response.data.value)
134
  if (optionValue) {
135
  $.post(ajaxurl, {
136
  action : 'fs_set_db_option',
137
+ // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
138
+ _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_set_db_option' ) ); ?>,
139
  option_name : optionName,
140
  option_value: optionValue
141
  }, function () {
728
 
729
  $.post(ajaxurl, {
730
  action : 'fs_get_debug_log',
731
+ // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
732
+ _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_get_debug_log' ) ); ?>,
733
  filters: filters,
734
  offset : offset,
735
  limit : limit
provider/freemius/templates/firewall-issues-js.php CHANGED
@@ -22,10 +22,12 @@
22
  notice = $( this ).parents( '.fs-notice' ),
23
  ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' );
24
 
25
- var data = {
26
- action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix,
27
- error_type: error_type
28
- };
 
 
29
 
30
  if ( 'squid' === error_type ) {
31
  data.hosting_company = prompt( 'What is the name or URL of your hosting company?' );
@@ -39,7 +41,9 @@
39
  }
40
 
41
  if ( 'retry_ping' === error_type ) {
42
- data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix;
 
 
43
  }
44
 
45
  $( this ).css({'cursor': 'wait'});
@@ -56,4 +60,4 @@
56
  });
57
  });
58
  });
59
- </script>
22
  notice = $( this ).parents( '.fs-notice' ),
23
  ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' );
24
 
25
+ var data = {
26
+ action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix,
27
+ // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
28
+ _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_resolve_firewall_issues' ) ); ?>,
29
+ error_type: error_type
30
+ };
31
 
32
  if ( 'squid' === error_type ) {
33
  data.hosting_company = prompt( 'What is the name or URL of your hosting company?' );
41
  }
42
 
43
  if ( 'retry_ping' === error_type ) {
44
+ data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix;
45
+ // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
46
+ data._wpnonce = <?php echo wp_json_encode( wp_create_nonce( 'fs_retry_connectivity_test' ) ); ?>;
47
  }
48
 
49
  $( this ).css({'cursor': 'wait'});
60
  });
61
  });
62
  });
63
+ </script>
provider/freemius/templates/partials/network-activation.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
  /**
3
  * @var array $VARS
4
  * @var Freemius $fs
@@ -86,4 +91,4 @@
86
  </tbody>
87
  </table>
88
  </div>
89
- </div>
1
  <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
  /**
8
  * @var array $VARS
9
  * @var Freemius $fs
91
  </tbody>
92
  </table>
93
  </div>
94
+ </div>
provider/freemius/templates/sticky-admin-notice-js.php CHANGED
@@ -23,7 +23,9 @@
23
 
24
  notice.fadeOut( 'fast', function() {
25
  var data = {
26
- action : 'fs_dismiss_notice_action_' + ajaxActionSuffix,
 
 
27
  message_id: id
28
  };
29
 
@@ -36,4 +38,4 @@
36
  });
37
  });
38
  });
39
- </script>
23
 
24
  notice.fadeOut( 'fast', function() {
25
  var data = {
26
+ action : 'fs_dismiss_notice_action_' + ajaxActionSuffix,
27
+ // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
28
+ _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_dismiss_notice_action' ) ); ?>,
29
  message_id: id
30
  };
31
 
38
  });
39
  });
40
  });
41
+ </script>
provider/functions_wordpress.class.php CHANGED
@@ -1279,6 +1279,24 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
1279
  return($arrMetaOutput);
1280
  }
1281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1282
 
1283
  /**
1284
  * get pods meta keys
@@ -3130,7 +3148,7 @@ defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
3130
 
3131
  global $wp;
3132
  $urlPage = home_url($wp->request);
3133
-
3134
  if($isClear == false)
3135
  return($urlPage);
3136
 
1279
  return($arrMetaOutput);
1280
  }
1281
 
1282
+ /**
1283
+ * get term meta
1284
+ */
1285
+ public static function getTermImage($termID, $metaKey){
1286
+
1287
+ if(empty($metaKey))
1288
+ return(null);
1289
+
1290
+ $attachmentID = get_term_meta($termID,$metaKey, true);
1291
+
1292
+ if(empty($attachmentID))
1293
+ return(null);
1294
+
1295
+ $arrImage = self::getAttachmentData($attachmentID);
1296
+
1297
+ return($arrImage);
1298
+ }
1299
+
1300
 
1301
  /**
1302
  * get pods meta keys
3148
 
3149
  global $wp;
3150
  $urlPage = home_url($wp->request);
3151
+
3152
  if($isClear == false)
3153
  return($urlPage);
3154
 
provider/provider_functions.class.php CHANGED
@@ -233,7 +233,7 @@ class UniteProviderFunctionsUC{
233
 
234
  if(empty($url))
235
  UniteFunctionsUC::throwError("empty style url, handle: $handle");
236
-
237
  $version = UNLIMITED_ELEMENTS_VERSION;
238
  if(GlobalsUC::$inDev == true) //add script
239
  $version = time();
233
 
234
  if(empty($url))
235
  UniteFunctionsUC::throwError("empty style url, handle: $handle");
236
+
237
  $version = UNLIMITED_ELEMENTS_VERSION;
238
  if(GlobalsUC::$inDev == true) //add script
239
  $version = time();
provider/provider_globals.class.php CHANGED
@@ -28,6 +28,7 @@ class GlobalsProviderUC{
28
 
29
  public static $lastPostQuery = null;
30
  public static $lastPostQuery_page = null;
 
31
  public static $lastPostQuery_type = null;
32
  public static $lastPostQuery_paginationType = null;
33
  public static $skipRunPostQueryOnce = false;
28
 
29
  public static $lastPostQuery = null;
30
  public static $lastPostQuery_page = null;
31
+ public static $lastPostQuery_offset = null;
32
  public static $lastPostQuery_type = null;
33
  public static $lastPostQuery_paginationType = null;
34
  public static $skipRunPostQueryOnce = false;
provider/provider_params_processor.class.php CHANGED
@@ -554,7 +554,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
554
  /**
555
  * get post featured images id
556
  */
557
- private function getPostFeaturedImageID($postID, $content){
558
 
559
  $featuredImageID = UniteFunctionsWPUC::getFeaturedImageID($postID);
560
 
@@ -567,9 +567,19 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
567
  $featuredImageID = $imageID;
568
  }
569
 
 
 
 
 
 
 
 
 
 
570
  return($featuredImageID);
571
  }
572
 
 
573
  /**
574
  * get post data
575
  */
@@ -631,7 +641,9 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
631
  }
632
 
633
 
634
- $featuredImageID = $this->getPostFeaturedImageID($postID, $content);
 
 
635
 
636
  if(!empty($featuredImageID)){
637
 
@@ -955,8 +967,6 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
955
  if(is_array($value) == false)
956
  return(array());
957
 
958
- //dmp($value);exit();
959
-
960
  $filters = array();
961
 
962
  $showDebugQuery = UniteFunctionsUC::getVal($value, "{$name}_show_query_debug");
@@ -971,6 +981,13 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
971
  $isForWoo = UniteFunctionsUC::getVal($param, "for_woocommerce_products");
972
  $isForWoo = UniteFunctionsUC::strToBool($isForWoo);
973
 
 
 
 
 
 
 
 
974
 
975
  $isRelatedPosts = $source == "related";
976
  if(is_single() == false)
@@ -1178,17 +1195,13 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1178
 
1179
  $filters = $this->getPostListData_addOrderBy($filters, $value, $name);
1180
 
1181
- //update by post and get filters
1182
- $objFiltersProcess = new UniteCreatorFiltersProcess();
1183
 
1184
  //add debug for further use
1185
  HelperUC::addDebug("Post Filters", $filters);
1186
 
1187
  //run custom query if available
1188
  $args = UniteFunctionsWPUC::getPostsArgs($filters);
1189
-
1190
- $args = $objFiltersProcess->processRequestFilters($args);
1191
-
1192
  //exclude by authors
1193
 
1194
  if($excludeByAuthors == true){
@@ -1636,6 +1649,11 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1636
 
1637
  $args = $this->getPostListData_getCustomQueryFilters($args, $value, $name, $data);
1638
 
 
 
 
 
 
1639
  HelperUC::addDebug("Posts Query", $args);
1640
 
1641
  //-------- show debug query --------------
@@ -1768,7 +1786,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1768
 
1769
  if(empty($perPage))
1770
  return(false);
1771
-
1772
  $offset = UniteFunctionsUC::getVal($queryVars, "offset");
1773
 
1774
  if(empty($offset))
@@ -1779,6 +1797,8 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1779
  if(!empty($page))
1780
  GlobalsProviderUC::$lastPostQuery_page = $page;
1781
 
 
 
1782
  }
1783
 
1784
 
@@ -1786,7 +1806,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1786
  * get current posts
1787
  */
1788
  private function getPostListData_currentPosts($value, $name, $data){
1789
-
1790
  //add debug for further use
1791
  HelperUC::addDebug("Getting Current Posts");
1792
 
@@ -1794,6 +1814,15 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1794
  $orderDir = UniteFunctionsUC::getVal($value, $name."_orderdir1");
1795
  $orderByMetaKey = UniteFunctionsUC::getVal($value, $name."_orderby_meta_key1");
1796
 
 
 
 
 
 
 
 
 
 
1797
  if($orderBy == "default")
1798
  $orderBy = null;
1799
 
@@ -1818,7 +1847,13 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1818
  $currentQueryVars["order"] = $orderDir;
1819
 
1820
  $currentQueryVars = apply_filters( 'elementor/theme/posts_archive/query_posts/query_vars', $currentQueryVars);
1821
-
 
 
 
 
 
 
1822
  $currentQueryVars = $this->getPostListData_getCustomQueryFilters($currentQueryVars, $value, $name, $data);
1823
 
1824
 
@@ -1847,10 +1882,16 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1847
 
1848
  $query = $wp_query;
1849
 
 
 
 
 
1850
  //remember last args
1851
  GlobalsProviderUC::$lastQueryArgs = $wp_query->query_vars;
1852
 
1853
- if($currentQueryVars !== $wp_query->query_vars){
 
 
1854
 
1855
  HelperUC::addDebug("New Query", $currentQueryVars);
1856
 
@@ -1863,6 +1904,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1863
  }
1864
 
1865
  $query = new WP_Query( $currentQueryVars );
 
1866
  }
1867
 
1868
 
@@ -1877,7 +1919,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1877
 
1878
  //save last query
1879
  $this->saveLastQueryAndPage($query, GlobalsProviderUC::QUERY_TYPE_CURRENT);
1880
-
1881
  $arrPosts = $query->posts;
1882
 
1883
  if(empty($arrPosts))
@@ -1999,7 +2041,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
1999
  $source = UniteFunctionsUC::getVal($value, "{$name}_source");
2000
 
2001
  $arrPosts = array();
2002
-
2003
  switch($source){
2004
  case "manual":
2005
 
@@ -2083,7 +2125,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2083
  * get gallery item title
2084
  */
2085
  private function getGalleryItem_title($source, $data, $name, $post, $item){
2086
-
2087
  switch($source){
2088
  case "post_title":
2089
  $title = $post->post_title;
@@ -2252,7 +2294,10 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2252
 
2253
  $isAddItemsData = UniteFunctionsUC::getVal($arrParams, "add_item_data");
2254
  $isAddItemsData = UniteFunctionsUC::strToBool($isAddItemsData);
2255
-
 
 
 
2256
  $name = "image";
2257
 
2258
  $param = array();
@@ -2266,11 +2311,13 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2266
  else
2267
  if($titleSource == "item_title" && $descriptionSource == "item_description")
2268
  $param["no_image_data"] = true;
2269
-
2270
-
2271
  $value = $id;
2272
- if(empty($value))
 
2273
  $value = $url;
 
 
2274
 
2275
  $item = array();
2276
  $item["type"] = "image";
@@ -2331,6 +2378,16 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2331
 
2332
  $title = $this->getGalleryItem_title($titleSource, $data, $name, $post, $sourceItem);
2333
  $description = $this->getGalleryItem_title($descriptionSource, $data, $name, $post, $sourceItem);
 
 
 
 
 
 
 
 
 
 
2334
 
2335
  $item["title"] = $title;
2336
  $item["description"] = $description;
@@ -2402,7 +2459,9 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2402
  $params["description_source"] = $descriptionSource;
2403
 
2404
  $output = array();
2405
- foreach($arrItems as $item){
 
 
2406
 
2407
  switch($source){
2408
  case "products":
@@ -2411,8 +2470,8 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2411
  $postID = $item->ID;
2412
  $content = $item->post_content;
2413
 
2414
- $featuredImageID = $this->getPostFeaturedImageID($postID, $content);
2415
-
2416
  $params["post"] = $item;
2417
 
2418
  $galleryItem = $this->getGalleryItem($featuredImageID,null,$params);
@@ -2569,6 +2628,8 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2569
 
2570
  $arrOutput = array();
2571
 
 
 
2572
  $isEnable = UniteFunctionsUC::getVal($value, $name."_enable");
2573
  $isEnable = UniteFunctionsUC::strToBool($isEnable);
2574
 
@@ -2635,6 +2696,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2635
 
2636
  $arrOutput["attributes"] = $attributes;
2637
  $arrOutput["class"] = $class;
 
2638
 
2639
  $data[$name] = $arrOutput;
2640
 
@@ -2763,6 +2825,10 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
2763
 
2764
  $data = $this->getRemoteSettingsData($value, $name, $processType, $param, $data);
2765
 
 
 
 
 
2766
  return($data);
2767
  break;
2768
  }
@@ -3074,7 +3140,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3074
  */
3075
  protected function getWPTermsData($value, $name, $processType, $param){
3076
 
3077
- $postType = UniteFunctionsUC::getVal($value, $name."_posttype");
3078
  $taxonomy = UniteFunctionsUC::getVal($value, $name."_taxonomy","category");
3079
 
3080
  $orderBy = UniteFunctionsUC::getVal($value, $name."_orderby","name");
@@ -3088,7 +3154,8 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3088
 
3089
  $showDebug = UniteFunctionsUC::getVal($value, $name."_show_query_debug");
3090
  $showDebug = UniteFunctionsUC::strToBool($showDebug);
3091
-
 
3092
  $queryDebugType = "";
3093
  if($showDebug == true)
3094
  $queryDebugType = UniteFunctionsUC::getVal($value, $name."_query_debug_type");
@@ -3127,6 +3194,9 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3127
  $taxonomy = "category";
3128
  }
3129
 
 
 
 
3130
  //add exclude
3131
  $arrExcludeSlugs = null;
3132
 
@@ -3294,7 +3364,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3294
  dmp("The terms query is:");
3295
  dmp($args);
3296
  }
3297
-
3298
 
3299
  $term_query = new WP_Term_Query();
3300
  $arrTermsObjects = $term_query->query( $args );
@@ -3310,6 +3380,7 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3310
  dmp("The finals query vars:");
3311
  dmp($originalQueryVars);
3312
 
 
3313
  $arrActions = UniteFunctionsWPUC::getFilterCallbacks("get_terms_args");
3314
 
3315
  dmp("Query modify callbacks ( get_terms_args ):");
@@ -3334,65 +3405,17 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3334
  $arrTermsObjects = UniteFunctionsWPUC::getTerms_filterBySlugs($arrTermsObjects, $arrExcludeSlugs);
3335
 
3336
  $arrTerms = UniteFunctionsWPUC::getTermsObjectsData($arrTermsObjects, $taxonomy);
3337
-
3338
- $arrTerms = $this->modifyArrTermsForOutput($arrTerms, $taxonomy, $useCustomFields);
3339
-
3340
- return($arrTerms);
3341
- }
3342
-
3343
- /**
3344
- * get terms smart data, accordion if it's filter or not
3345
- */
3346
- private function getTermsSmartData($data, $value, $name, $processType, $param){
3347
-
3348
- //check if filter
3349
-
3350
- $filterExists = false;
3351
- $isFilter = false;
3352
- $isInitAfter = false;
3353
- $isMainFilter = false;
3354
 
3355
- if(!$value)
3356
- $value = array();
3357
-
3358
- if(array_key_exists($name."_is_filter", $value)){
3359
-
3360
- $filterExists = true;
3361
- $isFilter = UniteFunctionsUC::getVal($value, $name."_is_filter");
3362
- $isFilter = UniteFunctionsUC::strToBool($isFilter);
3363
-
3364
- $isInitAfter = UniteFunctionsUC::getVal($value, $name."_init_after_grid");
3365
- $isInitAfter = UniteFunctionsUC::strToBool($isInitAfter);
3366
-
3367
- $isMainFilter = UniteFunctionsUC::getVal($value, $name."_is_main_filter");
3368
- $isMainFilter = UniteFunctionsUC::strToBool($isMainFilter);
3369
-
3370
- }
3371
 
3372
- $arrTerms = $this->getWPTermsData($value, $name, $processType, $param);
3373
-
3374
-
3375
- //add filter arguments
3376
-
3377
- $objFilters = new UniteCreatorFiltersProcess();
3378
 
3379
- if($isFilter == true && $isInitAfter == true)
3380
- $arrTerms = $objFilters->modifyOutputTermsForInitAfter($arrTerms);
3381
-
3382
- $data[$name] = $arrTerms;
3383
-
3384
- if($filterExists == true){
3385
-
3386
- $data["is_filter"] = $isFilter?"true":"false";
3387
-
3388
- if($isFilter == true)
3389
- $data = $objFilters->addEditorFilterArguments($data, $isInitAfter, $isMainFilter);
3390
- }
3391
 
3392
- return($data);
3393
  }
3394
 
3395
 
 
3396
  protected function z_______________USERS____________(){}
3397
 
3398
 
@@ -3618,6 +3641,42 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3618
  return($data);
3619
  }
3620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3621
 
3622
  protected function z_______________GET_PARAMS____________(){}
3623
 
@@ -3640,8 +3699,8 @@ class UniteCreatorParamsProcessor extends UniteCreatorParamsProcessorWork{
3640
  break;
3641
  case UniteCreatorDialogParam::PARAM_POST_TERMS:
3642
 
3643
- $data = $this->getTermsSmartData($data, $value, $name, $processType, $param);
3644
-
3645
  break;
3646
  case UniteCreatorDialogParam::PARAM_WOO_CATS:
3647
  $data[$name] = $this->getWooCatsData($value, $name, $processType, $param);
554
  /**
555
  * get post featured images id
556
  */
557
+ private function getPostFeaturedImageID($postID, $content, $postType = null){
558
 
559
  $featuredImageID = UniteFunctionsWPUC::getFeaturedImageID($postID);
560
 
567
  $featuredImageID = $imageID;
568
  }
569
 
570
+
571
+ //get first gallery image
572
+ if(empty($featuredImageID) && $postType == "product"){
573
+
574
+ $objWoo = new UniteCreatorWooIntegrate();
575
+ $featuredImageID = $objWoo->getFirstGalleryImageID($postID);
576
+ }
577
+
578
+
579
  return($featuredImageID);
580
  }
581
 
582
+
583
  /**
584
  * get post data
585
  */
641
  }
642
 
643
 
644
+ $featuredImageID = $this->getPostFeaturedImageID($postID, $content, $postType);
645
+
646
+
647
 
648
  if(!empty($featuredImageID)){
649
 
967
  if(is_array($value) == false)
968
  return(array());
969
 
 
 
970
  $filters = array();
971
 
972
  $showDebugQuery = UniteFunctionsUC::getVal($value, "{$name}_show_query_debug");
981
  $isForWoo = UniteFunctionsUC::getVal($param, "for_woocommerce_products");
982
  $isForWoo = UniteFunctionsUC::strToBool($isForWoo);
983
 
984
+ //enable filters
985
+ $isAjax = UniteFunctionsUC::getVal($value, "{$name}_isajax");
986
+ $isAjax = UniteFunctionsUC::strToBool($isAjax);
987
+
988
+ $isAjaxSetUrl = UniteFunctionsUC::getVal($value, "{$name}_ajax_seturl");
989
+
990
+ $isFilterable = $isAjax && ($isAjaxSetUrl != "ajax");
991
 
992
  $isRelatedPosts = $source == "related";
993
  if(is_single() == false)
1195
 
1196
  $filters = $this->getPostListData_addOrderBy($filters, $value, $name);
1197
 
 
 
1198
 
1199
  //add debug for further use
1200
  HelperUC::addDebug("Post Filters", $filters);
1201
 
1202
  //run custom query if available
1203
  $args = UniteFunctionsWPUC::getPostsArgs($filters);
1204
+
 
 
1205
  //exclude by authors
1206
 
1207
  if($excludeByAuthors == true){
1649
 
1650
  $args = $this->getPostListData_getCustomQueryFilters($args, $value, $name, $data);
1651
 
1652
+ //update by post and get filters
1653
+ $objFiltersProcess = new UniteCreatorFiltersProcess();
1654
+ $args = $objFiltersProcess->processRequestFilters($args, $isFilterable);
1655
+
1656
+
1657
  HelperUC::addDebug("Posts Query", $args);
1658
 
1659
  //-------- show debug query --------------
1786
 
1787
  if(empty($perPage))
1788
  return(false);
1789
+
1790
  $offset = UniteFunctionsUC::getVal($queryVars, "offset");
1791
 
1792
  if(empty($offset))
1797
  if(!empty($page))
1798
  GlobalsProviderUC::$lastPostQuery_page = $page;
1799
 
1800
+ GlobalsProviderUC::$lastPostQuery_offset = $offset;
1801
+
1802
  }
1803
 
1804
 
1806
  * get current posts
1807
  */
1808
  private function getPostListData_currentPosts($value, $name, $data){
1809
+
1810
  //add debug for further use
1811
  HelperUC::addDebug("Getting Current Posts");
1812
 
1814
  $orderDir = UniteFunctionsUC::getVal($value, $name."_orderdir1");
1815
  $orderByMetaKey = UniteFunctionsUC::getVal($value, $name."_orderby_meta_key1");
1816
 
1817
+ //enable filters
1818
+ $isAjax = UniteFunctionsUC::getVal($value, "{$name}_isajax");
1819
+ $isAjax = UniteFunctionsUC::strToBool($isAjax);
1820
+
1821
+ $isAjaxSetUrl = UniteFunctionsUC::getVal($value, "{$name}_ajax_seturl");
1822
+
1823
+ $isFilterable = $isAjax && ($isAjaxSetUrl != "ajax");
1824
+
1825
+
1826
  if($orderBy == "default")
1827
  $orderBy = null;
1828
 
1847
  $currentQueryVars["order"] = $orderDir;
1848
 
1849
  $currentQueryVars = apply_filters( 'elementor/theme/posts_archive/query_posts/query_vars', $currentQueryVars);
1850
+
1851
+ //update by post and get filters
1852
+ $objFiltersProcess = new UniteCreatorFiltersProcess();
1853
+ $currentQueryVars = $objFiltersProcess->processRequestFilters($currentQueryVars, $isFilterable);
1854
+
1855
+
1856
+ //custom filters
1857
  $currentQueryVars = $this->getPostListData_getCustomQueryFilters($currentQueryVars, $value, $name, $data);
1858
 
1859
 
1882
 
1883
  $query = $wp_query;
1884
 
1885
+ $objFilters = new UniteCreatorFiltersProcess();
1886
+ $isFrontAjax = $objFilters->isFrontAjaxRequest();
1887
+
1888
+
1889
  //remember last args
1890
  GlobalsProviderUC::$lastQueryArgs = $wp_query->query_vars;
1891
 
1892
+ //remake the query - not inside ajax
1893
+
1894
+ if($currentQueryVars !== $wp_query->query_vars && $isFrontAjax == false){
1895
 
1896
  HelperUC::addDebug("New Query", $currentQueryVars);
1897
 
1904
  }
1905
 
1906
  $query = new WP_Query( $currentQueryVars );
1907
+
1908
  }
1909
 
1910
 
1919
 
1920
  //save last query
1921
  $this->saveLastQueryAndPage($query, GlobalsProviderUC::QUERY_TYPE_CURRENT);
1922
+
1923
  $arrPosts = $query->posts;
1924
 
1925
  if(empty($arrPosts))
2041
  $source = UniteFunctionsUC::getVal($value, "{$name}_source");
2042
 
2043
  $arrPosts = array();
2044
+
2045
  switch($source){
2046
  case "manual":
2047
 
2125
  * get gallery item title
2126
  */
2127
  private function getGalleryItem_title($source, $data, $name, $post, $item){
2128
+
2129
  switch($source){
2130
  case "post_title":
2131
  $title = $post->post_title;
2294
 
2295
  $isAddItemsData = UniteFunctionsUC::getVal($arrParams, "add_item_data");
2296
  $isAddItemsData = UniteFunctionsUC::strToBool($isAddItemsData);
2297
+
2298
+ $index = UniteFunctionsUC::getVal($arrParams, "index");
2299
+
2300
+
2301
  $name = "image";
2302
 
2303
  $param = array();
2311
  else
2312
  if($titleSource == "item_title" && $descriptionSource == "item_description")
2313
  $param["no_image_data"] = true;
2314
+
 
2315
  $value = $id;
2316
+ $isByUrl = false;
2317
+ if(empty($value)){
2318
  $value = $url;
2319
+ $isByUrl = true;
2320
+ }
2321
 
2322
  $item = array();
2323
  $item["type"] = "image";
2378
 
2379
  $title = $this->getGalleryItem_title($titleSource, $data, $name, $post, $sourceItem);
2380
  $description = $this->getGalleryItem_title($descriptionSource, $data, $name, $post, $sourceItem);
2381
+
2382
+ //demo item text
2383
+ if($isByUrl == true && count($data) == 1){
2384
+
2385
+ if(empty($title))
2386
+ $title = "Demo Item {$index} Title";
2387
+
2388
+ if(empty($description))
2389
+ $description = "Demo Item {$index} Description";
2390
+ }
2391
 
2392
  $item["title"] = $title;
2393
  $item["description"] = $description;
2459
  $params["description_source"] = $descriptionSource;
2460
 
2461
  $output = array();
2462
+ foreach($arrItems as $index => $item){
2463
+
2464
+ $params["index"] = ($index+1);
2465
 
2466
  switch($source){
2467
  case "products":
2470
  $postID = $item->ID;
2471
  $content = $item->post_content;
2472
 
2473
+ $featuredImageID = $this->getPostFeaturedImageID($postID, $content, $item->post_type);
2474
+
2475
  $params["post"] = $item;
2476
 
2477
  $galleryItem = $this->getGalleryItem($featuredImageID,null,$params);
2628
 
2629
  $arrOutput = array();
2630
 
2631
+ $isInsideEditor = UniteCreatorElementorIntegrate::$isEditMode;
2632
+
2633
  $isEnable = UniteFunctionsUC::getVal($value, $name."_enable");
2634
  $isEnable = UniteFunctionsUC::strToBool($isEnable);
2635
 
2696
 
2697
  $arrOutput["attributes"] = $attributes;
2698
  $arrOutput["class"] = $class;
2699
+ $arrOutput["click_event"] = $isInsideEditor?"ucclick":"click";
2700
 
2701
  $data[$name] = $arrOutput;
2702
 
2825
 
2826
  $data = $this->getRemoteSettingsData($value, $name, $processType, $param, $data);
2827
 
2828
+ return($data);
2829
+ break;
2830
+ case "filter":
2831
+
2832
  return($data);
2833
  break;
2834
  }
3140
  */
3141
  protected function getWPTermsData($value, $name, $processType, $param){
3142
 
3143
+ $postType = UniteFunctionsUC::getVal($value, $name."_posttype","post");
3144
  $taxonomy = UniteFunctionsUC::getVal($value, $name."_taxonomy","category");
3145
 
3146
  $orderBy = UniteFunctionsUC::getVal($value, $name."_orderby","name");
3154
 
3155
  $showDebug = UniteFunctionsUC::getVal($value, $name."_show_query_debug");
3156
  $showDebug = UniteFunctionsUC::strToBool($showDebug);
3157
+
3158
+
3159
  $queryDebugType = "";
3160
  if($showDebug == true)
3161
  $queryDebugType = UniteFunctionsUC::getVal($value, $name."_query_debug_type");
3194
  $taxonomy = "category";
3195
  }
3196
 
3197
+
3198
+
3199
+
3200
  //add exclude
3201
  $arrExcludeSlugs = null;
3202
 
3364
  dmp("The terms query is:");
3365
  dmp($args);
3366
  }
3367
+
3368
 
3369
  $term_query = new WP_Term_Query();
3370
  $arrTermsObjects = $term_query->query( $args );
3380
  dmp("The finals query vars:");
3381
  dmp($originalQueryVars);
3382
 
3383
+
3384
  $arrActions = UniteFunctionsWPUC::getFilterCallbacks("get_terms_args");
3385
 
3386
  dmp("Query modify callbacks ( get_terms_args ):");
3405
  $arrTermsObjects = UniteFunctionsWPUC::getTerms_filterBySlugs($arrTermsObjects, $arrExcludeSlugs);
3406
 
3407
  $arrTerms = UniteFunctionsWPUC::getTermsObjectsData($arrTermsObjects, $taxonomy);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3409
 
3410
+ $arrTerms = $this->modifyArrTermsForOutput($arrTerms, $taxonomy, $useCustomFields);
 
 
 
 
 
3411
 
3412
+
 
 
 
 
 
 
 
 
 
 
 
3413
 
3414
+ return($arrTerms);
3415
  }
3416
 
3417
 
3418
+
3419
  protected function z_______________USERS____________(){}
3420
 
3421
 
3641
  return($data);
3642
  }
3643
 
3644
+ protected function z_______________POST_FILTERS____________(){}
3645
+
3646
+
3647
+
3648
+ /**
3649
+ * get post filter options
3650
+ */
3651
+ private function modifyData_postFilterOptions($data){
3652
+
3653
+ $objFilters = new UniteCreatorFiltersProcess();
3654
+
3655
+ $data = $objFilters->addEditorFilterArguments($data);
3656
+
3657
+ return($data);
3658
+ }
3659
+
3660
+
3661
+ /**
3662
+ * modify data by special behaviour
3663
+ */
3664
+ protected function modifyDataBySpecialAddonBehaviour($data){
3665
+
3666
+ $special = $this->addon->getOption("special");
3667
+
3668
+ if(empty($special))
3669
+ return($data);
3670
+
3671
+ switch($special){
3672
+ case "post_filter":
3673
+ $data = $this->modifyData_postFilterOptions($data);
3674
+ break;
3675
+ }
3676
+
3677
+
3678
+ return($data);
3679
+ }
3680
 
3681
  protected function z_______________GET_PARAMS____________(){}
3682
 
3699
  break;
3700
  case UniteCreatorDialogParam::PARAM_POST_TERMS:
3701
 
3702
+ $data[$name] = $this->getWPTermsData($value, $name, $processType, $param);
3703
+
3704
  break;
3705
  case UniteCreatorDialogParam::PARAM_WOO_CATS:
3706
  $data[$name] = $this->getWooCatsData($value, $name, $processType, $param);
provider/provider_settings.class.php CHANGED
@@ -59,12 +59,16 @@ class UniteCreatorSettings extends UniteCreatorSettingsWork{
59
 
60
  $arrTemplates = HelperProviderCoreUC_EL::getArrElementorTemplatesShort();
61
  $arrTemplates = UniteFunctionsUC::addArrFirstValue($arrTemplates, __("[No Template Selected]","unlimited-elements-for-elementor"),"__none__");
 
62
  $arrTemplates = array_flip($arrTemplates);
63
 
64
  $params = array();
65
  $params["origtype"] = "select2";
66
 
67
- $this->addSelect($name."_templateid", $arrTemplates, __("Choose Template","unlimited-elements-for-elementor"),"__none__", $params);
 
 
 
68
 
69
  }
70
 
@@ -377,17 +381,12 @@ class UniteCreatorSettings extends UniteCreatorSettingsWork{
377
  $isForWooCommerce = UniteFunctionsUC::strToBool($isForWooCommerce);
378
 
379
  $filterType = UniteFunctionsUC::getVal($extra, "filter_type");
380
-
381
- $addFilterOptions = false;
382
- if($filterType == "filter_option")
383
- $addFilterOptions = true;
384
-
385
 
386
  $arrPostTypesWithTax = UniteFunctionsWPUC::getPostTypesWithTaxomonies(GlobalsProviderUC::$arrFilterPostTypes, false);
387
 
388
  if($isForWooCommerce == true)
389
  $arrPostTypesWithTax = array("product" => $arrPostTypesWithTax["product"]);
390
-
391
 
392
 
393
  $taxData = $this->addPostTermsPicker_getArrTaxonomies($arrPostTypesWithTax);
@@ -395,44 +394,6 @@ class UniteCreatorSettings extends UniteCreatorSettingsWork{
395
  $arrPostTypesTaxonomies = $taxData["post_type_tax"];
396
 
397
  $arrTaxonomiesSimple = $taxData["taxonomies_simple"];
398
-
399
- // ------ add filter options -----
400
-
401
- if($addFilterOptions == true){
402
-
403
- $params = array();
404
- $params["origtype"] = UniteCreatorDialogParam::PARAM_RADIOBOOLEAN;
405
- $params["description"] = __("If turned on, the widget will be used as a filter for ajax posts", "unlimited-elements-for-elementor");
406
-
407
- $this->addRadioBoolean($name."_is_filter", __("Use As Posts Filter", "unlimited-elements-for-elementor"), false, "Yes", "No", $params);
408
-
409
- //---------- init after grid ---------
410
-
411
- $params = array();
412
- $params["origtype"] = UniteCreatorDialogParam::PARAM_RADIOBOOLEAN;
413
- $params["description"] = __("Show the widget by ajax request after the grid has loaded, only relevant terms from the chosen, according chosen grid posts.", "unlimited-elements-for-elementor");
414
- $params["elementor_condition"] = array($name."_is_filter" => "true");
415
-
416
- $this->addRadioBoolean($name."_init_after_grid", __("Init After Grid", "unlimited-elements-for-elementor"), false, "Yes", "No", $params);
417
-
418
- //---------- is main filter ---------
419
-
420
- $params = array();
421
- $params["origtype"] = UniteCreatorDialogParam::PARAM_RADIOBOOLEAN;
422
- $params["description"] = __("This filter is not redrawable on other filters press.", "unlimited-elements-for-elementor");
423
- $params["elementor_condition"] = array($name."_is_filter" => "true");
424
-
425
- $this->addRadioBoolean($name."_is_main_filter", __("Is Main Filter", "unlimited-elements-for-elementor"), false, "Yes", "No", $params);
426
-
427
-
428
- //---------- add hr ---------
429
-
430
- $params = array();
431
- $params["origtype"] = UniteCreatorDialogParam::PARAM_HR;
432
- $this->addHr($name."_after_filter_checkbox",$params);
433
-
434
- }
435
-
436
 
437
  //----- add post types ---------
438
 
@@ -2315,7 +2276,7 @@ class UniteCreatorSettings extends UniteCreatorSettingsWork{
2315
  $this->addRemoteSettings($name, $value, $title, $param);
2316
  return(false);
2317
  }
2318
-
2319
  $isForGallery = ($useFor == "gallery");
2320
  $isEnableVideoItems = UniteFunctionsUC::getVal($param, "gallery_enable_video");
2321
  $isEnableVideoItems = UniteFunctionsUC::strToBool($isEnableVideoItems);
@@ -2378,27 +2339,5 @@ class UniteCreatorSettings extends UniteCreatorSettingsWork{
2378
  }
2379
 
2380
 
2381
- private function __________FILTERS_______(){}
2382
-
2383
- /**
2384
- * add filter selector
2385
- */
2386
- protected function addFiltersItemSelector($param){
2387
-
2388
- //-----------------
2389
-
2390
- $this->addPostIDSelect("post_ids", "Select Posts", null, false);
2391
-
2392
-
2393
- $params = array();
2394
- $params["origtype"] = UniteCreatorDialogParam::PARAM_TEXTFIELD;
2395
-
2396
- $this->addTextBox("filter_type", "", "Filter Type", $params);
2397
-
2398
-
2399
-
2400
- }
2401
-
2402
-
2403
 
2404
  }
59
 
60
  $arrTemplates = HelperProviderCoreUC_EL::getArrElementorTemplatesShort();
61
  $arrTemplates = UniteFunctionsUC::addArrFirstValue($arrTemplates, __("[No Template Selected]","unlimited-elements-for-elementor"),"__none__");
62
+
63
  $arrTemplates = array_flip($arrTemplates);
64
 
65
  $params = array();
66
  $params["origtype"] = "select2";
67
 
68
+ if(empty($title))
69
+ $title = __("Choose Template", "unlimited-elements-for-elementor");
70
+
71
+ $this->addSelect($name."_templateid", $arrTemplates, $title ,"__none__", $params);
72
 
73
  }
74
 
381
  $isForWooCommerce = UniteFunctionsUC::strToBool($isForWooCommerce);
382
 
383
  $filterType = UniteFunctionsUC::getVal($extra, "filter_type");
384
+
 
 
 
 
385
 
386
  $arrPostTypesWithTax = UniteFunctionsWPUC::getPostTypesWithTaxomonies(GlobalsProviderUC::$arrFilterPostTypes, false);
387
 
388
  if($isForWooCommerce == true)
389
  $arrPostTypesWithTax = array("product" => $arrPostTypesWithTax["product"]);
 
390
 
391
 
392
  $taxData = $this->addPostTermsPicker_getArrTaxonomies($arrPostTypesWithTax);
394
  $arrPostTypesTaxonomies = $taxData["post_type_tax"];
395
 
396
  $arrTaxonomiesSimple = $taxData["taxonomies_simple"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
 
398
  //----- add post types ---------
399
 
2276
  $this->addRemoteSettings($name, $value, $title, $param);
2277
  return(false);
2278
  }
2279
+
2280
  $isForGallery = ($useFor == "gallery");
2281
  $isEnableVideoItems = UniteFunctionsUC::getVal($param, "gallery_enable_video");
2282
  $isEnableVideoItems = UniteFunctionsUC::strToBool($isEnableVideoItems);
2339
  }
2340
 
2341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2342
 
2343
  }
provider/provider_template_engine.class.php CHANGED
@@ -67,11 +67,16 @@ class UniteCreatorTemplateEngine extends UniteCreatorTemplateEngineWork{
67
  /**
68
  * get term meta
69
  */
70
- public function getTermMeta($termID){
71
 
72
  if(is_numeric($termID) == false)
73
  return(null);
74
 
 
 
 
 
 
75
  $arrMeta = UniteFunctionsWPUC::getTermMeta($termID);
76
 
77
  return($arrMeta);
67
  /**
68
  * get term meta
69
  */
70
+ public function getTermMeta($termID, $key = ""){
71
 
72
  if(is_numeric($termID) == false)
73
  return(null);
74
 
75
+ if(!empty($key)){
76
+ $value = get_term_meta($termID, $key, true);
77
+ return($value);
78
+ }
79
+
80
  $arrMeta = UniteFunctionsWPUC::getTermMeta($termID);
81
 
82
  return($arrMeta);
provider/woocommerce_integrate.class.php CHANGED
@@ -485,6 +485,30 @@ class UniteCreatorWooIntegrate{
485
  return($variations);
486
  }
487
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  /**
489
  *
490
  * get product gallery
485
  return($variations);
486
  }
487
 
488
+ /**
489
+ * get first gallery image id
490
+ */
491
+ public function getFirstGalleryImageID($productID){
492
+
493
+ if(function_exists("wc_get_product") == false)
494
+ return(array());
495
+
496
+ $product = wc_get_product($productID);
497
+
498
+ if(empty($product))
499
+ return(array());
500
+
501
+ $arrAttachmentIDs = $product->get_gallery_image_ids();
502
+
503
+ if(empty($arrAttachmentIDs))
504
+ return(null);
505
+
506
+ $firstID = $arrAttachmentIDs[0];
507
+
508
+ return($firstID);
509
+ }
510
+
511
+
512
  /**
513
  *
514
  * get product gallery
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: unitecms, valiano, iritmega
3
  Donate link: http://unlimited-elements.com/
4
  Tags: elementor, elements, addons, elementor addons, elementor widget, page builder, builder, visual editor, wordpress page builder, elementor
5
  Requires at least: 3.5
6
- Tested up to: 5.8.2
7
  Stable tag: 1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -92,16 +92,16 @@ Fully compatible and integrated with Toolset custom post types and fields.
92
 
93
  <h3>Creative Widgets for Elementor</h3>
94
  <ol>
95
- <li><a href="https://unlimited-elements.com/blob-shape-widget-for-elementor/">Blob Shapes Widget for Elementor (Free)</a> - Create Blob Shapes with animated morphing effects. This free Elementor widget will help you make your images into random, unique, and organic-looking blob shapes. </li>
 
96
  <li><a href="https://unlimited-elements.com/number-box-widget-widget-for-elementor/">Number Box Widget for Elementor (Free)</a> - Create stunning number blocks with various styles. The Number Box widget for Elementor helps you display content for step by step diagrams and instructions.</li>
97
  <li><a href="https://unlimited-elements.com/animated-mouse-scroll-icon-widget-for-elementor/">Animated Mouse Scroll Icon Widget for Elementor (Free)</a> - The Animated Mouse Scroll Icon is a small micro animation that indicates to user they needs to scroll the page. You can make the icon an anchor point which scroll down to any section when clicked on.
98
  </li>
99
  <li><a href="https://unlimited-elements.com/svg-animation-widget-for-elementor">SVG Animation Widget for Elementor (Free)</a> - The SVG animation widget for Elementor makes it easy -to create impressive SVG animations for your websitet, without any coding skills just copy paste your SVG code and your animated icon is ready.</li>
100
- <li><a href="https://unlimited-elements.com/material-bullets-widget-for-elementor">Material Bullets Widget for Elementor (Free)</a> - Display feature lists with custom icons and styles. Each list item can have its own icon title and text. Use the bullets widget to display features and highlights on your Elementor website.</li>
101
  <li><a href="https://unlimited-elements.com/animated-hamburger-icon-for-elementor/">Animated Hamburger Icon Widget for Elementor (Free)</a> - Use the animated hamburger icon widget to toggle Elementor pro popus. You can even put a menu in a popup and create a full screen menu.</li>
102
  <li><a href="https://unlimited-elements.com/timeline-bullets-widget-for-elementor/">Timeline Bullets Widget for Elementor (Free)</a> - List your features or services using bullet points in a timeline layout to make it easier for users to read the important information.</li>
103
  <li><a href="https://unlimited-elements.com/lordicon-animated-icons-widget-for-elementor/">Lordicon: Animated Icons Widget for Elementor (Free)</a> - The most powerful animated icon library with 1500+ free and premium animated Lottie animations.</li>
104
- <li><a href="https://unlimited-elements.com/flip-box-widget-for-elementor/">Flip Box Widget for Elementor (Free)</a> - Make your content more interesting with the Elementor Flip Box widget. Use the animated Flip Boxes to highlight any content inside your page with a flip effect.</li>
105
  <li><a href="https://unlimited-elements.com/image-tooltip-widget-for-elementor/">Image Tooltip Widget for Elementor (Free)</a> - The easiest way to set a tooltip to any Image on the page with a short text description or any HTML code.</li>
106
  <li><a href="https://unlimited-elements.com/icon-accordion-widget-for-elementor/">Icon Accordion Widget for Elementor (Pro)</a> - Advanced accordion addon for Elementor page builder offers multiple styles to create interactive collapsable content with multiple layouts on your page.</li>
107
  <li><a href="https://unlimited-elements.com/image-reveal-on-scroll-widget-for-elementor">Image Reveal On Scroll Widget for Elementor (Pro)</a> - The Image Reveal on Scroll widget adds an awesome reveal on scroll effect to your images to spice up your Elementor website design.</li>
@@ -120,7 +120,8 @@ Fully compatible and integrated with Toolset custom post types and fields.
120
  <li><a href="https://unlimited-elements.com/interactive-circle-infographic-widget-for-elementor/">Interactive Circle Infographic Widget for Elementor (Pro)</a> - The Circle Infographic widget for Elementor is a simple and engaging way to present data, processes, concepts, structures and more. Helps your audience understand an entire cycle using a circular interactive tab layout.
121
 
122
  </li>
123
- <li><a href="https://unlimited-elements.com/flip-box-carousel-widget-for-elementor/">Flip Box Carousel Widget for Elementor (Pro)</a></li>
 
124
  <li><a href="https://unlimited-elements.com/christmas-icons-widget-for-elementor/">Christmas Icons Widget for Elementor (Pro)</a></li>
125
  </ol>
126
 
@@ -128,62 +129,74 @@ Fully compatible and integrated with Toolset custom post types and fields.
128
  <ol>
129
  <li><a href="https://unlimited-elements.com/post-tabs-for-elementor/">Post Tabs Widget for Elementor (Free)</a></li>
130
  <li><a href="https://unlimited-elements.com/post-accordions-for-elementor/">Post Accordion Widget for Elementor (Free)</a></li>
 
131
  <li><a href="https://unlimited-elements.com/post-blocks-widget-for-elementor">Post Blocks Widget for Elementor (Free)</a></li>
132
  <li><a href="https://unlimited-elements.com/post-list-widget-for-elementor">Post List Widget for Elementor (Free)</a></li>
133
  <li><a href="https://unlimited-elements.com/post-news-ticker-widget-for-elementor">Post Ticker Widget for Elementor (Free)</a></li>
134
- <li><a href="https://unlimited-elements.com/card-post-carousel-widget-for-elementor">Card Post Carousel Widget for Elementor (Free)</a></li>
135
  <li><a href="https://unlimited-elements.com/post-pagination-widget-for-elementor/">Post Pagination Widget for Elementor (Free)</a></li>
136
  <li><a href="https://unlimited-elements.com/post-gallery-widget-for-elementor">Post Gallery Widget for Elementor (Pro)</a></li>
137
  <li><a href="https://unlimited-elements.com/elementor-author-list-widget/">Author List Widget for Elementor (Pro)</a></li>
138
  <li><a href="https://unlimited-elements.com/masonry-post-grid-widget-for-elementor">Masonry Post Grid Widget for Elementor (Pro)</a></li>
139
  <li><a href="https://unlimited-elements.com/taxonomy-terms-widget-for-elementor/">Taxonomy Terms Widget for Elementor (Pro)</a></li>
140
  <li><a href="https://unlimited-elements.com/post-tiles-widget-for-elementor">Post Tile Widget for Elementor (Pro)</a></li>
141
- <li><a href="https://unlimited-elements.com/post-magazine-grid-widget-for-elementor/">Post Magazine Grid Widget for Elementor (Pro)</a></li>
142
  <li><a href="https://unlimited-elements.com/post-sliders/">Post Slider Widget for Elementor (Pro)</a></li>
143
  <li><a href="https://unlimited-elements.com/blog-card-slider-widget-for-elementor">Post Card Slider Widget for Elementor (Pro)</a></li>
 
144
  <li><a href="https://unlimited-elements.com/load-more-infinite-scroll-widget-for-elementor/">Load More / Infinite Scroll Widget for Elementor (Pro)</a> - Add a load more button to your post or product grids. You can even make an infinite scroll effect that works with AJAX.</li>
145
  <li><a href="https://unlimited-elements.com/post-carousels-for-elementor/">Post Carousel Widget for Elementor (Pro)</a></li>
146
  <li><a href="https://unlimited-elements.com/post-timeline-widget-for-elementor/">Post Timeline Widget for Elementor (Pro)</a></li>
147
  <li><a href="https://unlimited-elements.com/post-scroll-widget-for-elementor">Post Scroll Widget for Elementor (Pro)</a></li>
148
- <li><a href="https://unlimited-elements.com/post-grid">Post Grid Widget for Elementor (Pro)</a></li>
149
  <li><a href="https://unlimited-elements.com/post-horizontal-timeline-widget-for-elementor/">Post Horizontal Timeline Widget for Elementor (Pro)</a></li>
150
  </ol>
151
 
152
  <h3>Marketing Widgets for Elementor</h3>
153
  <ol>
154
- <li><a href="https://unlimited-elements.com/unlimited-timeline-widget-for-elementor">Unlimited Timeline Widget for Elementor (Free)</a> - Showcase your story or company history in a vertical timeline layout using the powerful Unlimited Timeline addon for Elementor.</li>
155
- <li><a href="https://unlimited-elements.com/notification-widget-for-elementor">Notification Widget for Elementor (Free)</a> - The Notification widget enables you to display a colored alert box and draw attention to important messages on your Elementor website.</li>
156
- <li><a href="https://unlimited-elements.com/overlay-product-box-widget-for-elementor/">Overlay Product Box Widget for Elementor (Free)</a></li>
157
- <li><a href="https://unlimited-elements.com/business-hours-widget-for-elementor">Business Hours Widget for Elementor (Free)</a></li>
158
  <li><a href="https://unlimited-elements.com/timer-countdowns-for-elementor-page-builder/">Timer Countdown Widget for Elementor (Free)</a> - Instantly create a beautiful, animated countdown clock addon, to share on your Elementor website. Count down to a date with your own unique timer.
159
 
160
  </li>
161
  <li><a href="https://unlimited-elements.com/call-to-action-button-widget-for-elementor/">Call To Action Button Widget for Elementor (Free)</a> - The Call to Action Button Widget is a tool for creating beautiful buttons that combine an icon, some text, and message notification.</li>
 
 
162
  <li><a href="https://unlimited-elements.com/price-list-widget-for-elementor/">Price List Widget for Elementor (Free)</a> - A powerful addon that allows displaying a list of items, products, services or features for your business with easy styling options.</li>
163
  <li><a href="https://unlimited-elements.com/event-box-widget-for-elementor">Event Box Widget for Elementor (Free)</a> - Showcase events & special occasions on your websites using this unique Elementor addon.</li>
164
- <li><a href="https://unlimited-elements.com/statistic-counters-for-elementor">Counter Widget for Elementor (Free)</a> - Showcasing your business statistics and show fun facts and figures on your Elementor website.</li>
165
  <li><a href="https://unlimited-elements.com/pricing-table-widget-for-elementor/">Pricing Table Widget for Elementor (Free)</a> - Present the available pricing plans in an easy to read format. Use the Pricing Table widget to help your customers make purchasing decisions.</li>
 
 
166
  <li><a href="http://unlimited-elements.com/food-menu-box-widget-for-elementor/">Product Card Widget for Elementor (Free)</a></li>
167
- <li><a href="https://unlimited-elements.com/list-widget-for-elementor/">List Widget for Elementor (Free)</a> - Create styled ordered and unordered lists easily. The ordered list will add index numbers automatically to your list items.</li>
168
- <li><a href="https://unlimited-elements.com/review-box-widget-for-elementor">Review Box Widget for Elementor (Free)</a> - Simply create and display reviews on your Elementor website to build customers� trust and increase SEO.</li>
169
- <li><a href="https://unlimited-elements.com/price-label-product-box-widget-for-elementor/">Product Box Widget for Elementor (Free)</a></li>
170
- <li><a href="https://unlimited-elements.com/product-bullets-widget-for-elementor">Product Bullets Widget for Elementor (Pro)</a></li>
 
 
171
  <li><a href="https://unlimited-elements.com/whatsapp-chat-widget-for-elementor">WhatsApp Chat Widget for Elementor (Pro)</a> - A floating WhatsApp button that allows your website visitors to start a chat conversation from your website directly to your WhatsApp phone number with just one click.</li>
172
- <li><a href="https://unlimited-elements.com/mobile-conversion-menu-for-elementor">Mobile Conversion Menu Widget for Elementor (Pro)</a> - Floating action buttons that display the primary actions in your Elementor website. Provide quick access to social icons or any important or common actions to increase conversions.</li>
173
- <li><a href="https://unlimited-elements.com/icon-mobile-menu-for-elementor">Icon Mobile Menu Widget for Elementor (Pro)</a> - A perfect way to add an icon menu for making your CTA buttons stand out for website visitors using mobile devices.</li>
174
- <li><a href="https://unlimited-elements.com/memory-game-widget-for-elementor">Memory Game Widget for Elementor (Pro)</a></li>
175
- <li><a href="https://unlimited-elements.com/food-menu-carousel-widget-for-elementor">Product Carousel Widget for Elementor (Pro)</a></li>
176
- <li><a href="https://unlimited-elements.com/step-process-widget-for-elementor">Step Process Widget for Elementor (Pro)</a> - Showcase process/steps with unique layout variations. Create visual diagrams of step by step instructions to simplify processes to your website visitors.</li>
177
  <li><a href="https://unlimited-elements.com/event-list-widget-for-elementor/">Event List Widget for Elementor (Pro)</a> - The event list widget is a way to easily show your recent events like concerts, conferences, parties or special occasions.
178
  </li>
179
- <li><a href="https://unlimited-elements.com/pricing-flip-box-widget-for-elementor/">Pricing Table Flip Box Widget for Elementor (Pro)</a> - The Pricing Table Flip Box allows you to showcase the prices for your products, services, or packages in a beautiful flip box pricing table.</li>
180
- <li><a href="https://unlimited-elements.com/list-marquee-widget-for-elementor/">List Marquee Widget for Elementor (Pro)</a></li>
181
- <li><a href="https://unlimited-elements.com/card-testimonial-review-carousel-widget-for-elementor">Review Carousel Widget for Elementor (Pro)</a> - The Reviews Carousel increases the visibility reviews you want to highlight to your users by letting you display them throughout your site in an interactive carousel format. </li>
182
- <li><a href="https://unlimited-elements.com/timer-countdown-banner-widget-for-elementor">Timer Countdown Banner Widget for Elementor (Pro)</a> - An awesome countdown banner with a a call to action button.</li>
183
- <li><a href="https://unlimited-elements.com/google-maps-widget-for-elementor">Unlimited Google Maps Widget for Elementor (Pro)</a></li>
184
- <li><a href="https://unlimited-elements.com/two-column-product-bullets-widget-for-elementor/">Product Highlights Widget for Elementor (Pro)</a> - Design a visually attractive product feature lists that will help your potential buyers to make purchase decision and learn more about your products. </li>
185
- <li><a href="https://unlimited-elements.com/copy-coupon-code-widget-for-elementor">Copy Coupon Code Widget for Elementor (Pro)</a> - Click to copy coupon code to the clipboard. This widgets makes it easy for users to redeem your promotions coupon codes.</li>
186
  <li><a href="https://unlimited-elements.com/price-box-widget-for-elementor/">Price Box Widget for Elementor (Pro)</a></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  </ol>
188
 
189
  <h3>Woocommerce for Elementor</h3>
@@ -207,7 +220,8 @@ Fully compatible and integrated with Toolset custom post types and fields.
207
 
208
  <h3>Menu Widgets for Elementor</h3>
209
  <ol>
210
- <li><a href="https://unlimited-elements.com/simple-fullscreen-navigation-menu-widget-for-elementor/">Fullscreen Navigation Menu Widget for Elementor (Free)</a></li>
 
211
  <li><a href="https://unlimited-elements.com/simple-list-menu-widget-for-elementor">List Menu Widget for Elementor (Free)</a></li>
212
  <li><a href="http://unlimited-elements.com/side-menu-widget-for-elementor">Side Menu Widget for Elementor (Pro)</a> - Off Canvas sidebar with a WordPress menu inside that can include icon links and a search bar. Use the toggle button to open the side menu and the close icon to close it.</li>
213
  <li><a href="https://unlimited-elements.com/liquid-fullscreen-menu-widget-for-elementor">Liquid Full Screen Menu Widget for Elementor (Pro)</a> - Code Credit:
@@ -230,6 +244,16 @@ https://github.com/ykob/shape-overlays</li>
230
  <li><a href="https://unlimited-elements.com/justified-image-carousel-widget-for-elementor/">Justified Image Carousel Widget for Elementor (Pro)</a></li>
231
  </ol>
232
 
 
 
 
 
 
 
 
 
 
 
233
  <h3>Testimonials for Elementor</h3>
234
  <ol>
235
  <li><a href="https://unlimited-elements.com/box-testimonial-widget-for-elementor/">Testimonial Box Widget for Elementor (Free)</a></li>
@@ -342,11 +366,13 @@ https://github.com/ykob/shape-overlays</li>
342
  <ol>
343
  <li><a href="https://unlimited-elements.com/content-tabs-widget-for-elementor/">Content Tabs Widget for Elementor (Free)</a></li>
344
  <li><a href="https://unlimited-elements.com/content-accordion-widget-for-elementor/">Content Accordion Widget for Elementor (Free)</a></li>
 
 
 
345
  <li><a href="https://unlimited-elements.com/content-carousel-widget-for-elementor/">Content Carousel Widget for Elementor (Pro)</a></li>
346
  <li><a href="https://unlimited-elements.com/content-grid-widget-for-elementor/">Content Grid Widget for Elementor (Pro)</a></li>
347
  <li><a href="https://unlimited-elements.com/content-ticker-widget-for-elementor/">Content Ticker Widget for Elementor (Pro)</a></li>
348
  <li><a href="https://unlimited-elements.com/content-slider-widget-for-elementor">Content Slider Widget for Elementor (Pro)</a></li>
349
- <li><a href="https://unlimited-elements.com/content-toggle-widget-for-elementor/">Content Toggle Widget for Elementor (Pro)</a></li>
350
  </ol>
351
 
352
  <h3>Icon Boxes for Elementor</h3>
@@ -363,14 +389,6 @@ https://github.com/ykob/shape-overlays</li>
363
  <li><a href="https://unlimited-elements.com/solid-color-overlay-icon-box-widget-for-elementor">Overlay Icon Box Widget for Elementor (Pro)</a></li>
364
  </ol>
365
 
366
- <h3>Progress Bar for Elementor</h3>
367
- <ol>
368
- <li><a href="https://unlimited-elements.com/linear-progress-bar-widget-for-elementor">Linear Progress Bar Widget for Elementor (Free)</a></li>
369
- <li><a href="https://unlimited-elements.com/circle-progress-bar-widget-for-elementor/">Circle Progress Bar Widget for Elementor (Pro)</a></li>
370
- <li><a href="https://unlimited-elements.com/semi-circle-progress-bar-widget-for-elementor/">Semi Circle Progress Bar Widget for Elementor (Pro)</a></li>
371
- <li><a href="https://unlimited-elements.com/vertical-progress-bar-widget-for-elementor">Vertical Progress Bar Widget for Elementor (Pro)</a></li>
372
- </ol>
373
-
374
  <h3>Image Galleries for Elementor</h3>
375
  <ol>
376
  <li><a href="https://unlimited-elements.com/tile-grid-image-gallery-for-elementor/">Tile Grid Image Gallery Widget for Elementor (Free)</a></li>
@@ -428,15 +446,6 @@ https://github.com/ykob/shape-overlays</li>
428
  <li><a href="https://unlimited-elements.com/christmas-lights-widget-for-elementor/">Christmas Lights Widget for Elementor (Pro)</a></li>
429
  </ol>
430
 
431
- <h3>Google Charts for Elementor</h3>
432
- <ol>
433
- <li><a href="https://unlimited-elements.com/pie-chart-for-elementor">Pie chart Widget for Elementor (Free)</a></li>
434
- <li><a href="https://unlimited-elements.com/line-chart-for-elementor">Line Chart Widget for Elementor (Free)</a></li>
435
- <li><a href="https://unlimited-elements.com/donut-chart-for-elementor">Donut Chart Widget for Elementor (Pro)</a></li>
436
- <li><a href="https://unlimited-elements.com/line-chart-for-elementor">Comparison Line Chart Widget for Elementor (Pro)</a></li>
437
- <li><a href="https://unlimited-elements.com/area-chart-for-elementor">Area Chart Widget for Elementor (Pro)</a></li>
438
- </ol>
439
-
440
  <h3>Hero Widgets for Elementor</h3>
441
  <ol>
442
  <li><a href="https://unlimited-elements.com/title-hero-widget-for-elementor">Title Hero Widget for Elementor (Free)</a></li>
@@ -453,15 +462,7 @@ https://github.com/ykob/shape-overlays</li>
453
  <li><a href="https://unlimited-elements.com/solid-color-hero-widget-for-elementor">Solid Color Hero Widget for Elementor (Pro)</a></li>
454
  </ol>
455
 
456
- <h3>Remote Control Widgets for Elementor</h3>
457
- <ol>
458
- <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Arrows Widget for Elementor (Free)</a></li>
459
- <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Bullets Widget for Elementor (Free)</a></li>
460
- <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Counter Widget for Elementor (Free)</a></li>
461
- <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Play Pause Widget for Elementor (Free)</a></li>
462
- <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Item Navigation Widget for Elementor (Pro)</a></li>
463
- <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Tabs Widget for Elementor (Pro)</a></li>
464
- </ol>
465
 
466
 
467
 
@@ -476,6 +477,39 @@ Note : This plugin works with Elementor. Make sure you have [Elementor](https://
476
 
477
  == Changelog ==
478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
 
480
  version 1.5.0: 2022-02-02:
481
 
@@ -1517,7 +1551,7 @@ Absolutely! It will work with any theme where Elementor works.
1517
 
1518
  = What if i update to the Premium version after using the Free version? =
1519
 
1520
- Your existing elements/content will work with the premium version. So you wont lose your any of your hard work.
1521
 
1522
  = Can i get a refund? =
1523
 
3
  Donate link: http://unlimited-elements.com/
4
  Tags: elementor, elements, addons, elementor addons, elementor widget, page builder, builder, visual editor, wordpress page builder, elementor
5
  Requires at least: 3.5
6
+ Tested up to: 5.9
7
  Stable tag: 1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
92
 
93
  <h3>Creative Widgets for Elementor</h3>
94
  <ol>
95
+ <li><a href="https://unlimited-elements.com/icon-bullets-widget-for-elementor">Icon Bullets Widget for Elementor (Free)</a> - Display feature lists with custom icons and styles. Each list item can have its own icon title and text. Use the bullets widget to display features and highlights on your Elementor website.</li>
96
+ <li><a href="https://unlimited-elements.com/flip-box-widget-for-elementor/">Flip Box Widget for Elementor (Free)</a> - Make your content more interesting with the Elementor Flip Box widget. Use the animated Flip Boxes to highlight any content inside your page with a flip effect.</li>
97
  <li><a href="https://unlimited-elements.com/number-box-widget-widget-for-elementor/">Number Box Widget for Elementor (Free)</a> - Create stunning number blocks with various styles. The Number Box widget for Elementor helps you display content for step by step diagrams and instructions.</li>
98
  <li><a href="https://unlimited-elements.com/animated-mouse-scroll-icon-widget-for-elementor/">Animated Mouse Scroll Icon Widget for Elementor (Free)</a> - The Animated Mouse Scroll Icon is a small micro animation that indicates to user they needs to scroll the page. You can make the icon an anchor point which scroll down to any section when clicked on.
99
  </li>
100
  <li><a href="https://unlimited-elements.com/svg-animation-widget-for-elementor">SVG Animation Widget for Elementor (Free)</a> - The SVG animation widget for Elementor makes it easy -to create impressive SVG animations for your websitet, without any coding skills just copy paste your SVG code and your animated icon is ready.</li>
 
101
  <li><a href="https://unlimited-elements.com/animated-hamburger-icon-for-elementor/">Animated Hamburger Icon Widget for Elementor (Free)</a> - Use the animated hamburger icon widget to toggle Elementor pro popus. You can even put a menu in a popup and create a full screen menu.</li>
102
  <li><a href="https://unlimited-elements.com/timeline-bullets-widget-for-elementor/">Timeline Bullets Widget for Elementor (Free)</a> - List your features or services using bullet points in a timeline layout to make it easier for users to read the important information.</li>
103
  <li><a href="https://unlimited-elements.com/lordicon-animated-icons-widget-for-elementor/">Lordicon: Animated Icons Widget for Elementor (Free)</a> - The most powerful animated icon library with 1500+ free and premium animated Lottie animations.</li>
104
+ <li><a href="https://unlimited-elements.com/blob-shape-widget-for-elementor/">Blob Shapes Widget for Elementor (Free)</a> - Create Blob Shapes with animated morphing effects. This free Elementor widget will help you make your images into random, unique, and organic-looking blob shapes. </li>
105
  <li><a href="https://unlimited-elements.com/image-tooltip-widget-for-elementor/">Image Tooltip Widget for Elementor (Free)</a> - The easiest way to set a tooltip to any Image on the page with a short text description or any HTML code.</li>
106
  <li><a href="https://unlimited-elements.com/icon-accordion-widget-for-elementor/">Icon Accordion Widget for Elementor (Pro)</a> - Advanced accordion addon for Elementor page builder offers multiple styles to create interactive collapsable content with multiple layouts on your page.</li>
107
  <li><a href="https://unlimited-elements.com/image-reveal-on-scroll-widget-for-elementor">Image Reveal On Scroll Widget for Elementor (Pro)</a> - The Image Reveal on Scroll widget adds an awesome reveal on scroll effect to your images to spice up your Elementor website design.</li>
120
  <li><a href="https://unlimited-elements.com/interactive-circle-infographic-widget-for-elementor/">Interactive Circle Infographic Widget for Elementor (Pro)</a> - The Circle Infographic widget for Elementor is a simple and engaging way to present data, processes, concepts, structures and more. Helps your audience understand an entire cycle using a circular interactive tab layout.
121
 
122
  </li>
123
+ <li><a href="https://unlimited-elements.com/flip-box-carousel-widget-for-elementor/">Flip Box Carousel Widget for Elementor (Pro)</a> - Use the animated Carousel Flip Box to highlight content inside your Elementor page in an interactive way.
124
+ </li>
125
  <li><a href="https://unlimited-elements.com/christmas-icons-widget-for-elementor/">Christmas Icons Widget for Elementor (Pro)</a></li>
126
  </ol>
127
 
129
  <ol>
130
  <li><a href="https://unlimited-elements.com/post-tabs-for-elementor/">Post Tabs Widget for Elementor (Free)</a></li>
131
  <li><a href="https://unlimited-elements.com/post-accordions-for-elementor/">Post Accordion Widget for Elementor (Free)</a></li>
132
+ <li><a href="https://unlimited-elements.com/card-post-carousel-widget-for-elementor">Card Post Carousel Widget for Elementor (Free)</a></li>
133
  <li><a href="https://unlimited-elements.com/post-blocks-widget-for-elementor">Post Blocks Widget for Elementor (Free)</a></li>
134
  <li><a href="https://unlimited-elements.com/post-list-widget-for-elementor">Post List Widget for Elementor (Free)</a></li>
135
  <li><a href="https://unlimited-elements.com/post-news-ticker-widget-for-elementor">Post Ticker Widget for Elementor (Free)</a></li>
 
136
  <li><a href="https://unlimited-elements.com/post-pagination-widget-for-elementor/">Post Pagination Widget for Elementor (Free)</a></li>
137
  <li><a href="https://unlimited-elements.com/post-gallery-widget-for-elementor">Post Gallery Widget for Elementor (Pro)</a></li>
138
  <li><a href="https://unlimited-elements.com/elementor-author-list-widget/">Author List Widget for Elementor (Pro)</a></li>
139
  <li><a href="https://unlimited-elements.com/masonry-post-grid-widget-for-elementor">Masonry Post Grid Widget for Elementor (Pro)</a></li>
140
  <li><a href="https://unlimited-elements.com/taxonomy-terms-widget-for-elementor/">Taxonomy Terms Widget for Elementor (Pro)</a></li>
141
  <li><a href="https://unlimited-elements.com/post-tiles-widget-for-elementor">Post Tile Widget for Elementor (Pro)</a></li>
142
+ <li><a href="https://unlimited-elements.com/post-grid-widget-for-elementor/">Post Grid Widget for Elementor (Pro)</a> - The Post Grid widget places multiple posts in an aesthetic post grid layout. The purpose of this widget is to let you organize and display your posts on your Elementor website.</li>
143
  <li><a href="https://unlimited-elements.com/post-sliders/">Post Slider Widget for Elementor (Pro)</a></li>
144
  <li><a href="https://unlimited-elements.com/blog-card-slider-widget-for-elementor">Post Card Slider Widget for Elementor (Pro)</a></li>
145
+ <li><a href="https://unlimited-elements.com/post-magazine-grid-widget-for-elementor/">Post Magazine Grid Widget for Elementor (Pro)</a></li>
146
  <li><a href="https://unlimited-elements.com/load-more-infinite-scroll-widget-for-elementor/">Load More / Infinite Scroll Widget for Elementor (Pro)</a> - Add a load more button to your post or product grids. You can even make an infinite scroll effect that works with AJAX.</li>
147
  <li><a href="https://unlimited-elements.com/post-carousels-for-elementor/">Post Carousel Widget for Elementor (Pro)</a></li>
148
  <li><a href="https://unlimited-elements.com/post-timeline-widget-for-elementor/">Post Timeline Widget for Elementor (Pro)</a></li>
149
  <li><a href="https://unlimited-elements.com/post-scroll-widget-for-elementor">Post Scroll Widget for Elementor (Pro)</a></li>
 
150
  <li><a href="https://unlimited-elements.com/post-horizontal-timeline-widget-for-elementor/">Post Horizontal Timeline Widget for Elementor (Pro)</a></li>
151
  </ol>
152
 
153
  <h3>Marketing Widgets for Elementor</h3>
154
  <ol>
155
+ <li><a href="https://unlimited-elements.com/price-label-product-box-widget-for-elementor/">Product Box Widget for Elementor (Free)</a></li>
 
 
 
156
  <li><a href="https://unlimited-elements.com/timer-countdowns-for-elementor-page-builder/">Timer Countdown Widget for Elementor (Free)</a> - Instantly create a beautiful, animated countdown clock addon, to share on your Elementor website. Count down to a date with your own unique timer.
157
 
158
  </li>
159
  <li><a href="https://unlimited-elements.com/call-to-action-button-widget-for-elementor/">Call To Action Button Widget for Elementor (Free)</a> - The Call to Action Button Widget is a tool for creating beautiful buttons that combine an icon, some text, and message notification.</li>
160
+ <li><a href="https://unlimited-elements.com/list-widget-for-elementor/">List Widget for Elementor (Free)</a> - Create styled ordered and unordered lists easily. The ordered list will add index numbers automatically to your list items.</li>
161
+ <li><a href="https://unlimited-elements.com/statistic-counters-for-elementor">Counter Widget for Elementor (Free)</a> - Showcasing your business statistics and show fun facts and figures on your Elementor website.</li>
162
  <li><a href="https://unlimited-elements.com/price-list-widget-for-elementor/">Price List Widget for Elementor (Free)</a> - A powerful addon that allows displaying a list of items, products, services or features for your business with easy styling options.</li>
163
  <li><a href="https://unlimited-elements.com/event-box-widget-for-elementor">Event Box Widget for Elementor (Free)</a> - Showcase events & special occasions on your websites using this unique Elementor addon.</li>
164
+ <li><a href="https://unlimited-elements.com/notification-widget-for-elementor">Notification Widget for Elementor (Free)</a> - The Notification widget enables you to display a colored alert box and draw attention to important messages on your Elementor website.</li>
165
  <li><a href="https://unlimited-elements.com/pricing-table-widget-for-elementor/">Pricing Table Widget for Elementor (Free)</a> - Present the available pricing plans in an easy to read format. Use the Pricing Table widget to help your customers make purchasing decisions.</li>
166
+ <li><a href="https://unlimited-elements.com/business-hours-widget-for-elementor">Business Hours Widget for Elementor (Free)</a></li>
167
+ <li><a href="https://unlimited-elements.com/overlay-product-box-widget-for-elementor/">Overlay Product Box Widget for Elementor (Free)</a></li>
168
  <li><a href="http://unlimited-elements.com/food-menu-box-widget-for-elementor/">Product Card Widget for Elementor (Free)</a></li>
169
+ <li><a href="https://unlimited-elements.com/review-box-widget-for-elementor">Review Box Widget for Elementor (Free)</a> - Simply create and display reviews on your Elementor website to build customers’ trust and increase SEO.</li>
170
+ <li><a href="https://unlimited-elements.com/timer-countdown-banner-widget-for-elementor">Timer Countdown Banner Widget for Elementor (Pro)</a> - An awesome countdown banner with a a call to action button.</li>
171
+ <li><a href="https://unlimited-elements.com/card-testimonial-review-carousel-widget-for-elementor">Review Carousel Widget for Elementor (Pro)</a> - The Reviews Carousel increases the visibility reviews you want to highlight to your users by letting you display them throughout your site in an interactive carousel format. </li>
172
+ <li><a href="https://unlimited-elements.com/list-marquee-widget-for-elementor/">List Marquee Widget for Elementor (Pro)</a></li>
173
+ <li><a href="https://unlimited-elements.com/copy-coupon-code-widget-for-elementor">Copy Coupon Code Widget for Elementor (Pro)</a> - Click to copy coupon code to the clipboard. This widgets makes it easy for users to redeem your promotions coupon codes.</li>
174
+ <li><a href="https://unlimited-elements.com/pricing-flip-box-widget-for-elementor/">Pricing Table Flip Box Widget for Elementor (Pro)</a> - The Pricing Table Flip Box allows you to showcase the prices for your products, services, or packages in a beautiful flip box pricing table.</li>
175
  <li><a href="https://unlimited-elements.com/whatsapp-chat-widget-for-elementor">WhatsApp Chat Widget for Elementor (Pro)</a> - A floating WhatsApp button that allows your website visitors to start a chat conversation from your website directly to your WhatsApp phone number with just one click.</li>
 
 
 
 
 
176
  <li><a href="https://unlimited-elements.com/event-list-widget-for-elementor/">Event List Widget for Elementor (Pro)</a> - The event list widget is a way to easily show your recent events like concerts, conferences, parties or special occasions.
177
  </li>
 
 
 
 
 
 
 
178
  <li><a href="https://unlimited-elements.com/price-box-widget-for-elementor/">Price Box Widget for Elementor (Pro)</a></li>
179
+ <li><a href="https://unlimited-elements.com/icon-mobile-menu-for-elementor">Icon Mobile Menu Widget for Elementor (Pro)</a> - A perfect way to add an icon menu for making your CTA buttons stand out for website visitors using mobile devices.</li>
180
+ <li><a href="https://unlimited-elements.com/product-bullets-widget-for-elementor">Product Bullets Widget for Elementor (Pro)</a></li>
181
+ <li><a href="https://unlimited-elements.com/food-menu-carousel-widget-for-elementor">Product Carousel Widget for Elementor (Pro)</a></li>
182
+ <li><a href="https://unlimited-elements.com/two-column-product-bullets-widget-for-elementor/">Product Highlights Widget for Elementor (Pro)</a> - Design a visually attractive product feature lists that will help your potential buyers to make purchase decision and learn more about your products. </li>
183
+ <li><a href="https://unlimited-elements.com/memory-game-widget-for-elementor">Memory Game Widget for Elementor (Pro)</a></li>
184
+ <li><a href="https://unlimited-elements.com/google-maps-widget-for-elementor">Unlimited Google Maps Widget for Elementor (Pro)</a></li>
185
+ <li><a href="https://unlimited-elements.com/mobile-conversion-menu-for-elementor">Mobile Conversion Menu Widget for Elementor (Pro)</a> - Floating action buttons that display the primary actions in your Elementor website. Provide quick access to social icons or any important or common actions to increase conversions.</li>
186
+ </ol>
187
+
188
+ <h3>Infographic Widgets for Elementor</h3>
189
+ <ol>
190
+ <li><a href="https://unlimited-elements.com/unlimited-timeline-widget-for-elementor">Unlimited Timeline Widget for Elementor (Free)</a> - Showcase your story or company history in a vertical timeline layout using the powerful Unlimited Timeline addon for Elementor.</li>
191
+ <li><a href="https://unlimited-elements.com/linear-progress-bar-widget-for-elementor">Linear Progress Bar Widget for Elementor (Free)</a></li>
192
+ <li><a href="https://unlimited-elements.com/pie-chart-for-elementor">Pie chart Widget for Elementor (Free)</a></li>
193
+ <li><a href="https://unlimited-elements.com/line-chart-for-elementor">Line Chart Widget for Elementor (Free)</a></li>
194
+ <li><a href="https://unlimited-elements.com/unlimited-charts-widget-for-elementor">Unlimited Charts Widget for Elementor (Pro)</a> - The easy way to include animated, interactive graphs and charts on your Elementor website. 6 Chart styles included: Bar Chart, Line Chart, Pie Chart, Doughnut Chart, Radar Chart and Polar Area Chart.
195
+ </li>
196
+ <li><a href="https://unlimited-elements.com/step-process-widget-for-elementor">Step Process Widget for Elementor (Pro)</a> - Showcase process/steps with unique layout variations. Create visual diagrams of step by step instructions to simplify processes to your website visitors.</li>
197
+ <li><a href="https://unlimited-elements.com/circle-progress-bar-widget-for-elementor/">Circle Progress Bar Widget for Elementor (Pro)</a></li>
198
+ <li><a href="https://unlimited-elements.com/semi-circle-progress-bar-widget-for-elementor/">Semi Circle Progress Bar Widget for Elementor (Pro)</a></li>
199
+ <li><a href="https://unlimited-elements.com/vertical-progress-bar-widget-for-elementor">Vertical Progress Bar Widget for Elementor (Pro)</a></li>
200
  </ol>
201
 
202
  <h3>Woocommerce for Elementor</h3>
220
 
221
  <h3>Menu Widgets for Elementor</h3>
222
  <ol>
223
+ <li><a href="https://unlimited-elements.com/fullscreen-menu-widget-for-elementor/">Fullscreen Menu Widget for Elementor (Free)</a> - Create an awesome Elementor Full-Screen Menu​ easily using this widget. The easiest way to add a hamburger icon that triggers a fullscreen menu overlay with a close button.
224
+ </li>
225
  <li><a href="https://unlimited-elements.com/simple-list-menu-widget-for-elementor">List Menu Widget for Elementor (Free)</a></li>
226
  <li><a href="http://unlimited-elements.com/side-menu-widget-for-elementor">Side Menu Widget for Elementor (Pro)</a> - Off Canvas sidebar with a WordPress menu inside that can include icon links and a search bar. Use the toggle button to open the side menu and the close icon to close it.</li>
227
  <li><a href="https://unlimited-elements.com/liquid-fullscreen-menu-widget-for-elementor">Liquid Full Screen Menu Widget for Elementor (Pro)</a> - Code Credit:
244
  <li><a href="https://unlimited-elements.com/justified-image-carousel-widget-for-elementor/">Justified Image Carousel Widget for Elementor (Pro)</a></li>
245
  </ol>
246
 
247
+ <h3>Remote Control Widgets for Elementor</h3>
248
+ <ol>
249
+ <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Arrows Widget for Elementor (Free)</a></li>
250
+ <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Bullets Widget for Elementor (Free)</a></li>
251
+ <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Counter Widget for Elementor (Free)</a></li>
252
+ <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Play Pause Widget for Elementor (Free)</a></li>
253
+ <li><a href="https://unlimited-elements.com/remote-control-widgets">Remote Item Navigation Widget for Elementor (Pro)</a></li>
254
+ <li><a href="https://unlimited-elements.com/remote-tabs-widget-for-elementor">Remote Tabs Widget for Elementor (Pro)</a></li>
255
+ </ol>
256
+
257
  <h3>Testimonials for Elementor</h3>
258
  <ol>
259
  <li><a href="https://unlimited-elements.com/box-testimonial-widget-for-elementor/">Testimonial Box Widget for Elementor (Free)</a></li>
366
  <ol>
367
  <li><a href="https://unlimited-elements.com/content-tabs-widget-for-elementor/">Content Tabs Widget for Elementor (Free)</a></li>
368
  <li><a href="https://unlimited-elements.com/content-accordion-widget-for-elementor/">Content Accordion Widget for Elementor (Free)</a></li>
369
+ <li><a href="https://unlimited-elements.com/content-switcher-widget-for-elementor/">Content Switcher Widget for Elementor (Pro)</a> - Allow users to switch between two or more types of content using interactive toggle buttons. You can even load Elementor templates as content to make advanced content switcher layouts.
370
+
371
+ </li>
372
  <li><a href="https://unlimited-elements.com/content-carousel-widget-for-elementor/">Content Carousel Widget for Elementor (Pro)</a></li>
373
  <li><a href="https://unlimited-elements.com/content-grid-widget-for-elementor/">Content Grid Widget for Elementor (Pro)</a></li>
374
  <li><a href="https://unlimited-elements.com/content-ticker-widget-for-elementor/">Content Ticker Widget for Elementor (Pro)</a></li>
375
  <li><a href="https://unlimited-elements.com/content-slider-widget-for-elementor">Content Slider Widget for Elementor (Pro)</a></li>
 
376
  </ol>
377
 
378
  <h3>Icon Boxes for Elementor</h3>
389
  <li><a href="https://unlimited-elements.com/solid-color-overlay-icon-box-widget-for-elementor">Overlay Icon Box Widget for Elementor (Pro)</a></li>
390
  </ol>
391
 
 
 
 
 
 
 
 
 
392
  <h3>Image Galleries for Elementor</h3>
393
  <ol>
394
  <li><a href="https://unlimited-elements.com/tile-grid-image-gallery-for-elementor/">Tile Grid Image Gallery Widget for Elementor (Free)</a></li>
446
  <li><a href="https://unlimited-elements.com/christmas-lights-widget-for-elementor/">Christmas Lights Widget for Elementor (Pro)</a></li>
447
  </ol>
448
 
 
 
 
 
 
 
 
 
 
449
  <h3>Hero Widgets for Elementor</h3>
450
  <ol>
451
  <li><a href="https://unlimited-elements.com/title-hero-widget-for-elementor">Title Hero Widget for Elementor (Free)</a></li>
462
  <li><a href="https://unlimited-elements.com/solid-color-hero-widget-for-elementor">Solid Color Hero Widget for Elementor (Pro)</a></li>
463
  </ol>
464
 
465
+
 
 
 
 
 
 
 
 
466
 
467
 
468
 
477
 
478
  == Changelog ==
479
 
480
+ version 1.5.3: 2022-02-23:
481
+
482
+ * Feature: added functionality to put image inside taxonomy terms widget
483
+ * Fix: fixed load more on archive page with orderby=xxx filter in url
484
+ * Fix: made support for woocommerce special order by in load more
485
+ * Change: updated freemius sdk to 2.4.3 version (Security fix)
486
+
487
+
488
+ version 1.5.2: 2022-02-23:
489
+
490
+ * Feature: set up remote and sync functionality for the galleries
491
+ * Fix: fixed load more for current query posts
492
+ * Fix: fixed background js based widgets with elementor popups
493
+ * Fix: fixed unitegallery unclosed tag issue
494
+ * Fix: fixed replace mode in tabs filters
495
+
496
+
497
+ version 1.5.1: 2022-02-21:
498
+
499
+ * Feature: improved post pagination debug and added force options
500
+ * Feature: added code for the button filters
501
+ * Feature: added option to shuffle owl carousel
502
+ * Feature: added option for general "shuffle" in items
503
+ * Feature: made option for text modify, and get the current page url and current page title
504
+ * Feature: get feature image of a product from a first gallery image if featured image not exists
505
+ * Feature: added function "one_random" and "first" to get_items twig function
506
+ * Feature: added support for jet listing item
507
+ * Change: changed the "choose template" setting text to attirbute title
508
+ * Fix: fixed load more if offset turned on in the grid
509
+ * Fix: fixed link control attributes parsing
510
+ * Fix: fixed sync general api related bugs in elementor editor
511
+
512
+
513
 
514
  version 1.5.0: 2022-02-02:
515
 
1551
 
1552
  = What if i update to the Premium version after using the Free version? =
1553
 
1554
+ Your existing elements/content will work with the premium version. So you wont lose your any of your hard work.
1555
 
1556
  = Can i get a refund? =
1557
 
release_log.txt CHANGED
@@ -1,4 +1,40 @@
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  version 1.5.0:
3
 
4
  -feature: added tabs in items controls
1
 
2
+ version 1.5.3:
3
+
4
+ -feature: added functionality to put image inside taxonomy terms widget
5
+ -bug fix: fixed load more on archive page with orderby=xxx filter in url
6
+ -change: updated freemius sdk
7
+ -bug fix: made support for woocommerce special order by in load more
8
+ -change: updated freemius sdk to 2.4.3 version (Security fix)
9
+
10
+
11
+ version 1.5.2:
12
+
13
+ -bug fix: fixed load more for current query posts
14
+ -bug fix: fixed background js based widgets with elementor popups
15
+ -bug fix: fixed unitegallery unclosed tag issue
16
+ -bug fix: fixed replace mode in tabs filters
17
+ -feature: set up remote and sync functionality for the galleries
18
+
19
+
20
+
21
+ version 1.5.1:
22
+
23
+ -feature: improved post pagination debug and added force options
24
+ -feature: added code for the button filters
25
+ -feature: added option to shuffle owl carousel
26
+ -feature: added option for general "shuffle" in items
27
+ -change: changed the "choose template" setting text to attirbute title
28
+ -feature: made option for text modify, and get the current page url and current page title
29
+ -bug fix: fixed load more if offset turned on in the grid
30
+ -bug fix: fixed link control attributes parsing
31
+ -feature: get feature image of a product from a first gallery image if featured image not exists
32
+ -feature: added function "one_random" and "first" to get_items twig function
33
+ -feature: added support for jet listing item
34
+ -bug fix: fixed sync general api related bugs in elementor editor
35
+
36
+
37
+
38
  version 1.5.0:
39
 
40
  -feature: added tabs in items controls
settings/addon_fields.xml CHANGED
@@ -52,9 +52,8 @@
52
 
53
  <field type="bulk_control_end" />
54
 
55
- <field name="hr_dynamic" type="hr">
56
- </field>
57
-
58
  <field name="description"
59
  type="textarea"
60
  default=""
@@ -123,7 +122,14 @@
123
  description="">
124
  </field>
125
 
126
-
 
 
 
 
 
 
 
127
 
128
  </fieldset>
129
 
52
 
53
  <field type="bulk_control_end" />
54
 
55
+ <field name="hr_dynamic" type="hr"></field>
56
+
 
57
  <field name="description"
58
  type="textarea"
59
  default=""
122
  description="">
123
  </field>
124
 
125
+ <field name="hr_special" type="hr"></field>
126
+
127
+ <field name="special"
128
+ type="text"
129
+ default=""
130
+ label="Special Behaviour"
131
+ description="Some special behaviour field. Used in our various widgets">
132
+ </field>
133
 
134
  </fieldset>
135
 
unlimited_elements.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://unlimited-elements.com
5
  * Description: Unlimited Elements - Huge Widgets Pack for Elementor Website Builder, with html/css/js widget creator and editor
6
  * Author: Unlimited Elements
7
- * Version: 1.5.0
8
  * Author URI: http://unlimited-elements.com
9
  * Text Domain: unlimited-elements-for-elementor
10
  * Domain Path: /languages
4
  * Plugin URI: http://unlimited-elements.com
5
  * Description: Unlimited Elements - Huge Widgets Pack for Elementor Website Builder, with html/css/js widget creator and editor
6
  * Author: Unlimited Elements
7
+ * Version: 1.5.3
8
  * Author URI: http://unlimited-elements.com
9
  * Text Domain: unlimited-elements-for-elementor
10
  * Domain Path: /languages
views/troubleshooting-connectivity.php CHANGED
@@ -96,8 +96,79 @@ function checkVariousOptions(){
96
 
97
  }
98
 
99
- try{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  checkVariousOptions();
102
 
103
  echo "<br><br>";
@@ -108,6 +179,10 @@ try{
108
 
109
  checkZipFile();
110
 
 
 
 
 
111
 
112
  }catch(Exception $e){
113
  echo $e->getMessage();
96
 
97
  }
98
 
99
+ /**
100
+ * check and update catalog
101
+ */
102
+ function checkUpdateCatalog(){
103
+
104
+ dmp("Trying to update the catalog from the api... Printing Debug...");
105
+
106
+ $webAPI = new UniteCreatorWebAPI();
107
+
108
+ $webAPI->checkUpdateCatalog(true);
109
+
110
+ $arrDebug = $webAPI->getDebug();
111
+
112
+ dmp($arrDebug);
113
+
114
+ //print option content
115
+ $optionCatalog = UniteCreatorWebAPI::OPTION_CATALOG;
116
+
117
+ dmp("Option catalog raw data: $optionCatalog");
118
+
119
+ $data = get_option($optionCatalog);
120
+
121
+ dmp($data);
122
+
123
+ }
124
+
125
+
126
+ /**
127
+ * check if catalog data is saved well
128
+ */
129
+ function checkingCatalogData(){
130
+
131
+ $webAPI = new UniteCreatorWebAPI();
132
+ $data = $webAPI->getCatalogData();
133
+
134
+
135
+ dmp("Checking saved widgets catalog data");
136
 
137
+ if(empty($data)){
138
+
139
+ dmp("No catalog widgets data found!");
140
+
141
+ checkUpdateCatalog();
142
+
143
+ return(false);
144
+ }
145
+
146
+ if(is_array($data) == false)
147
+ UniteFunctionsUC::throwError("Catalog data is not array");
148
+
149
+ $stamp = UniteFunctionsUC::getVal($data, "stamp");
150
+ $catalog = UniteFunctionsUC::getVal($data, "catalog");
151
+
152
+ if(empty($stamp))
153
+ UniteFunctionsUC::throwError("No stamp found");
154
+
155
+ if(empty($catalog))
156
+ UniteFunctionsUC::throwError("Empty widgets catalog");
157
+
158
+ $date = UniteFunctionsUC::timestamp2Date($stamp);
159
+
160
+ dmp("catalog data found OK from date: $date");
161
+
162
+ $showData = UniteFunctionsUC::getGetVar("showdata","", UniteFunctionsUC::SANITIZE_TEXT_FIELD);
163
+ $showData = UniteFunctionsUC::strToBool($showData);
164
+
165
+ if($showData == true)
166
+ dmp($data);
167
+
168
+ }
169
+
170
+ try{
171
+
172
  checkVariousOptions();
173
 
174
  echo "<br><br>";
179
 
180
  checkZipFile();
181
 
182
+ echo "<br><br>";
183
+
184
+ checkingCatalogData();
185
+
186
 
187
  }catch(Exception $e){
188
  echo $e->getMessage();