Smart Slider 3 - Version 3.3.15

Version Description

  • 20. February 2019. =
  • NEW DEMO: Brand new demo slider is available to download!
  • Feature: Vimeo layer private video on/off to hide error notification on admin area
  • Fix: Repair WordPress installation
  • Fix: WordPress Gantry theme compatibility
  • Fix: Delayed sliders are now rendered in template tag to make it compatible with W3 Total Cache's Minify feature
Download this release

Release Info

Developer nextendweb
Plugin Icon 128x128 Smart Slider 3
Version 3.3.15
Comparing to
See all releases

Code changes from version 3.3.13 to 3.3.15

includes/integrations/Divi/SmartSlider3Extension.php CHANGED
@@ -13,7 +13,7 @@ class DiviSmartSlider3Extension extends DiviExtension {
13
  $this->plugin_dir_url = plugin_dir_url(__FILE__);
14
 
15
  $this->_builder_js_data = array(
16
- 'iframeUrl' => site_url('') . '?n2prerender=1&n2app=smartslider&n2controller=slider&n2action=iframe&h=' . sha1(NONCE_SALT . date('Y-m-d'))
17
  );
18
 
19
  parent::__construct($name, $args);
@@ -22,36 +22,6 @@ class DiviSmartSlider3Extension extends DiviExtension {
22
  $this,
23
  'admin_enqueue_scripts'
24
  ));
25
-
26
- }
27
-
28
- /**
29
- * Enqueues minified, production javascript bundles.
30
- *
31
- * @since 3.1
32
- */
33
- protected function _enqueue_bundles() {
34
-
35
- if (et_core_is_fb_enabled()) {
36
- // Builder Bundle
37
- $bundle_url = "{$this->plugin_dir_url}scripts/builder-bundle.min.js";
38
-
39
- wp_enqueue_script("{$this->name}-builder-bundle", $bundle_url, $this->_bundle_dependencies['builder'], $this->version, true);
40
- }
41
- }
42
-
43
- /**
44
- * Sets initial value of {@see self::$_bundle_dependencies}.
45
- *
46
- * @since 3.1
47
- */
48
- protected function _set_bundle_dependencies() {
49
- $this->_bundle_dependencies = array(
50
- 'builder' => array(
51
- 'react',
52
- 'react-dom'
53
- )
54
- );
55
  }
56
 
57
  public function admin_enqueue_scripts() {
13
  $this->plugin_dir_url = plugin_dir_url(__FILE__);
14
 
15
  $this->_builder_js_data = array(
16
+ 'iframeUrl' => site_url('/') . '?n2prerender=1&n2app=smartslider&n2controller=slider&n2action=iframe&h=' . sha1(NONCE_SALT . date('Y-m-d'))
17
  );
18
 
19
  parent::__construct($name, $args);
22
  $this,
23
  'admin_enqueue_scripts'
24
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
26
 
27
  public function admin_enqueue_scripts() {
includes/integrations/Divi/includes/modules/SmartSlider3/SmartSlider3.php CHANGED
@@ -27,7 +27,7 @@ class Nextend_SmartSlider3 extends ET_Builder_Module {
27
  public function add_styles_scripts() {
28
  ?>
29
  <script type="text/javascript">
30
- window.SmartSlider3IframeUrl = <?php echo json_encode(site_url('') . '?n2prerender=1&n2app=smartslider&n2controller=slider&n2action=iframe&h=' . sha1(NONCE_SALT . date('Y-m-d'))); ?>;
31
 
32
  <?php
33
  echo file_get_contents(NEXTEND_SMARTSLIDER_3 . '/includes/iframe.min.js');
27
  public function add_styles_scripts() {
28
  ?>
29
  <script type="text/javascript">
30
+ window.SmartSlider3IframeUrl = <?php echo json_encode(site_url('/') . '?n2prerender=1&n2app=smartslider&n2controller=slider&n2action=iframe&h=' . sha1(NONCE_SALT . date('Y-m-d'))); ?>;
31
 
32
  <?php
33
  echo file_get_contents(NEXTEND_SMARTSLIDER_3 . '/includes/iframe.min.js');
includes/shortcode.php CHANGED
@@ -48,7 +48,7 @@ class N2SS3Shortcode {
48
  'class' => "n2-ss-slider-frame",
49
  'style' => 'width:100%;display:block;border:0;',
50
  'frameborder' => 0,
51
- 'src' => site_url() . '?n2prerender=1&n2app=smartslider&n2controller=slider&n2action=iframe&sliderid=' . $sliderIDorAlias . '&hash=' . md5($sliderIDorAlias . NONCE_SALT)
52
  );
53
  $html = '';
54
 
@@ -205,6 +205,10 @@ if (defined('DOING_AJAX') && DOING_AJAX) {
205
  add_action('wp_head', 'N2SS3Shortcode::shortcodeModeToNoop', -10000);
206
  add_action('wp_head', 'N2SS3Shortcode::shortcodeModeToNormal', 10000);
207
 
 
 
 
 
208
  add_action('woocommerce_shop_loop', 'N2SS3Shortcode::shortcodeModeToNoop', 9);
209
  add_action('woocommerce_shop_loop', 'N2SS3Shortcode::shortcodeModeToNormal', 11);
210
 
48
  'class' => "n2-ss-slider-frame",
49
  'style' => 'width:100%;display:block;border:0;',
50
  'frameborder' => 0,
51
+ 'src' => site_url('/') . '?n2prerender=1&n2app=smartslider&n2controller=slider&n2action=iframe&sliderid=' . $sliderIDorAlias . '&hash=' . md5($sliderIDorAlias . NONCE_SALT)
52
  );
53
  $html = '';
54
 
205
  add_action('wp_head', 'N2SS3Shortcode::shortcodeModeToNoop', -10000);
206
  add_action('wp_head', 'N2SS3Shortcode::shortcodeModeToNormal', 10000);
207
 
208
+ add_action('wp_enqueue_scripts', 'N2SS3Shortcode::shortcodeModeToNormal', -1000000);
209
+ add_action('wp_enqueue_scripts', 'N2SS3Shortcode::shortcodeModeToNoop', 1000000);
210
+
211
+
212
  add_action('woocommerce_shop_loop', 'N2SS3Shortcode::shortcodeModeToNoop', 9);
213
  add_action('woocommerce_shop_loop', 'N2SS3Shortcode::shortcodeModeToNormal', 11);
214
 
includes/smartslider3.php CHANGED
@@ -191,7 +191,7 @@ class SmartSlider3 {
191
 
192
  public static function dynamic_sidebar_before($index) {
193
  if (substr($index, 0, strlen('smartslider_area_')) === 'smartslider_area_') {
194
- echo '<div class="description">Display this widget area in your theme with: <pre>&lt;?php dynamic_sidebar(\'' . $index . '\'); ?&gt;</pre></div>';
195
  }
196
 
197
  }
191
 
192
  public static function dynamic_sidebar_before($index) {
193
  if (substr($index, 0, strlen('smartslider_area_')) === 'smartslider_area_') {
194
+ echo '<div class="description">Display this widget area in your theme with: <pre style="white-space: pre-wrap;overflow:hidden;">&lt;?php dynamic_sidebar(\'' . $index . '\'); ?&gt;</pre></div>';
195
  }
196
 
197
  }
library/media/admin/dist/smartslider-backend.css CHANGED
@@ -1469,7 +1469,7 @@ body:not(.n2-ss-layer-edit-visible) #n2-ss-layer-window {
1469
 
1470
  #n2-ss-layer-window .n2-empty-label {
1471
  padding: 0;
1472
- height: 4px;
1473
  }
1474
 
1475
  #n2-ss-layer-window .n2-empty-group-label {
@@ -1603,17 +1603,47 @@ body:not(.n2-ss-layer-edit-visible) #n2-ss-layer-window {
1603
  position: relative;
1604
  }
1605
 
1606
- .n2-ss-small-more {
1607
- float: right;
1608
- margin: -38px 20px 0;
1609
  }
1610
 
1611
- html[dir=rtl] .n2-ss-small-more {
1612
- float: left;
 
 
 
 
 
 
1613
  }
1614
 
1615
- .n2-button-single-animation-play.n2-active .n2-i:before {
1616
- content: '\e607';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1617
  }
1618
  #n2-ss-add-sidebar {
1619
  background: #212d3a;
1469
 
1470
  #n2-ss-layer-window .n2-empty-label {
1471
  padding: 0;
1472
+ height: 9px;
1473
  }
1474
 
1475
  #n2-ss-layer-window .n2-empty-group-label {
1603
  position: relative;
1604
  }
1605
 
1606
+ .n2-button-single-animation-play.n2-active .n2-i:before {
1607
+ content: '\e607';
 
1608
  }
1609
 
1610
+ .n2-ss3-layeranimation-presets-groups {
1611
+ display: flex;
1612
+ flex-wrap: wrap;
1613
+ background: #3c4858;
1614
+ padding: 10px;
1615
+ text-align: center;
1616
+ color: #fff;
1617
+ border-bottom: 1px solid #283039;
1618
  }
1619
 
1620
+ .n2-ss3-layeranimation-presets-groups > div {
1621
+ flex: 1 1 auto;
1622
+ min-width: 60px;
1623
+ }
1624
+
1625
+ .n2-ss3-layeranimation-presets-group {
1626
+ margin: 5px;
1627
+ background: #6b7886;
1628
+ border-radius: 3px;
1629
+ display: flex;
1630
+ justify-content: flex-end;
1631
+ flex-flow: column;
1632
+ height: 65px;
1633
+ cursor: pointer;
1634
+ }
1635
+
1636
+ .n2-ss3-layeranimation-presets-group.n2-active {
1637
+ background: #0c92df;
1638
+ }
1639
+
1640
+ .n2-ss3-layeranimation-presets-group i {
1641
+ font-size: 24px;
1642
+ margin-bottom: 4px;
1643
+ }
1644
+
1645
+ .n2-ss3-layeranimation-presets-group div {
1646
+ margin-bottom: 8px;
1647
  }
1648
  #n2-ss-add-sidebar {
1649
  background: #212d3a;
library/media/admin/dist/smartslider-backend.min.css CHANGED
@@ -1 +1 @@
1
- #html-body header,.adminhtml-smartslider3-index #footer,.adminhtml-smartslider3-index .footer,.n2-ss-live-preview.n2-active .n2-button,.smartslider3-index-index footer{display:none}#html-body #anchor-content #n2-admin{mragin-top:30px}#html-body .header{position:relative;z-index:1100}.n2-lightbox-sidebar-list{overflow-y:auto}#n2-tab-widgets{border-bottom:0;margin-bottom:1000px}.n2-i-edit.n2-active{color:#0c92df}.n2-ss-live-preview span{text-decoration:line-through;vertical-align:middle}.n2-ss-live-preview .n2-button,.n2-widget-area{vertical-align:middle;margin:0 20px}.n2-ss-live-preview.n2-active span{text-decoration:none}.n2-widget-area{display:inline-block;width:80px;height:80px;position:relative;margin:0 10px}.n2-form .n2-widget-area{margin-bottom:10px}.n2-widget-area-inner{position:absolute;top:14px;left:14px;width:46px;height:46px;border:3px solid #bbc3cc;border-radius:3px}.n2-widget-area .n2-area{position:absolute;background-color:#a1aeb5;border-radius:2px;cursor:pointer;width:10px;height:10px;left:0;top:0}.n2-widget-area .n2-area.n2-active{background-color:#0c92df;cursor:default}.n2-widget-area .n2-area-1{left:35px}.n2-widget-area .n2-area-2{left:21px;top:21px}.n2-widget-area .n2-area-3{left:35px;top:21px}.n2-widget-area .n2-area-4{left:49px;top:21px}.n2-widget-area .n2-area-5{top:35px}.n2-widget-area .n2-area-6{left:21px;top:35px}.n2-widget-area .n2-area-7{left:49px;top:35px}.n2-widget-area .n2-area-8{left:70px;top:35px}.n2-widget-area .n2-area-9{left:21px;top:49px}.n2-widget-area .n2-area-10{left:35px;top:49px}.n2-widget-area .n2-area-11{left:49px;top:49px}.n2-widget-area .n2-area-12{left:35px;top:70px}.n2-ss-slider-publish{border-collapse:collapse;overflow:hidden}.n2-ss-slider-publish .n2-td{text-align:center;border-right:1px solid #ccd1d6;color:#6b7989;padding:48px 0 0}.n2-ss-slider-publish .n2-td .n2-h2 a{color:#6b7989}.n2-ss-slider-publish .n2-td.n2-last{border-right:0}.n2-ss-slider-publish div.n2-h2{line-height:30px;font-size:18px}.n2-ss-slider-publish div.n2-h4{line-height:26px}.n2-ss-slider-publish .n2-code{display:inline-block;padding:16px 30px;line-height:20px;border-radius:3px;background-color:#f5e293;text-align:left;margin:17px 0;color:#6f653f;font-size:12px;border:0;direction:ltr}.n2-ss-slider-publish img{margin-top:17px;margin-bottom:-10px}.n2-ss-generator-modal .n2-modal-content h3{text-align:left}.n2-generator-records td div{max-height:100px;overflow:hidden;padding:10px;margin:-10px}.n2-generator-records td:HOVER div{overflow-y:auto;overflow-x:visible}#n2-admin[data-autoplay='0'] #n2-form-matrix-sliderwidgets .n2-fm-autoplay,#n2-admin[data-autoplay='0'] #n2-form-matrix-sliderwidgets .n2-fm-indicator,#n2-admin[data-slider-type=block] .n2-fm-arrow,#n2-admin[data-slider-type=block] .n2-fm-autoplay,#n2-admin[data-slider-type=block] .n2-fm-bar,#n2-admin[data-slider-type=block] .n2-fm-bullet,#n2-admin[data-slider-type=block] .n2-fm-indicator,#n2-admin[data-slider-type=block] .n2-fm-slides,#n2-admin[data-slider-type=block] .n2-fm-thumbnail{display:none}.n2-ss-container-device{position:relative;background-color:#fff;border:1px solid #ccd1d6;border-width:0 1px;margin:40px auto 0}.n2-ss-create-slider-free-sample{float:left;height:70px;width:170px;cursor:pointer}.n2-ss-create-slider-free-sample:HOVER{background-position:0 -80px}.n2-ss-modal-subscribe>.n2-modal-window{text-align:center}.n2-ss-modal-subscribe .n2-form{margin:0 -20px}.n2-ss-modal-subscribe .n2-h3{margin:0 auto;width:95%;text-align:center;line-height:2}.n2-ss-preview-subscribe .n2-input-button{display:inline-block}.n2-input-button,.n2-ss-modal-subscribe .n2-input-button{display:inline-block;margin-top:20px}.n2-input-button>*,.n2-ss-modal-subscribe .n2-input-button>*,.n2-ss-preview-subscribe .n2-input-button>*{display:inline-block;white-space:nowrap;vertical-align:top}.n2-input-button input,.n2-input-button input:focus,.n2-ss-modal-subscribe input,.n2-ss-modal-subscribe input:focus,.n2-ss-preview-subscribe input,.n2-ss-preview-subscribe input:focus{margin:0 auto;width:250px;height:36px;border:2px solid #b9c3c9;border-right:0;border-top-left-radius:3px;border-bottom-left-radius:3px;border-top-right-radius:0;border-bottom-right-radius:0;overflow:hidden;padding:0 10px;line-height:36px;box-shadow:none;color:#7b8898;font-size:12px;background:#fff;box-sizing:border-box}.n2-input-button .n2-button,.n2-ss-modal-subscribe .n2-input-button .n2-button,.n2-ss-preview-subscribe .n2-input-button .n2-button{border-top-left-radius:0;border-bottom-left-radius:0}.n2-ss-preview-subscribe{position:fixed;left:50%;margin-left:-500px;bottom:-100px;transition:bottom .5s ease;background:url(../images/free/subscribepreview.png);width:1000px;height:90px;z-index:1000}.n2-ss-preview-subscribe.n2-active{bottom:10px}.n2-ss-preview-subscribe-close{position:absolute;top:-12px;right:-12px;width:24px;height:24px;cursor:pointer;background:url(../images/free/close.png) no-repeat center center}.n2-ss-preview-subscribe .n2-input-button{position:absolute;right:20px;top:0;margin-top:28px}#n2-ss-edit-group-form>.n2-form>.n2-form-tab,#n2-ss-edit-slider-form>.n2-form>.n2-form-tab{margin:20px 0 0;border-radius:0;border:0}#n2-ss-edit-group-form>.n2-form>.n2-form-tab .n2-form-matrix-views,#n2-ss-edit-slider-form>.n2-form>.n2-form-tab .n2-form-matrix-views{border-radius:0}#n2-ss-slider-container[data-groupid="0"] .n2-ss-remove-from-group,.n2-ss-box-slider-group .n2-ss-add-to-group,.n2-ss-box-slider-group .n2-ss-remove-from-group,body[data-slides='0'] #n2-ss-edit-slider-form,body[data-ss3-activated="0"] [data-ss3-when-activated="1"]{display:none}#n2-ss-slider-container,#n2-ss-slides{position:relative;padding:25px}.n2-ss-sliders .n2-box-new-slider>a:before{content:"\e952"}.n2-ss-sliders .n2-box-template-library>a:before{content:"\e951"}.n2-box-up-group>a:before{content:"\e958"}.n2-box-insert-group>a:before{content:"\e959"}.n2-ss-sliders-header>*{margin:0 10px;vertical-align:top}html[data-sliders='0'] .n2-ss-sliders-header{visibility:hidden}.n2-ss-box-slider{cursor:pointer}.n2-ss-slides-outer-container{display:block}.n2-modal-window .n2-ss-slides-outer-container{height:100%;overflow:auto}.n2-ss-slides-container{position:relative;margin:0 -10px}.n2-slide-first.n2-i{line-height:16px}.n2-slide-first.n2-i,.n2-slide-published{font-size:16px;padding:3px}.n2-i-unpublished{color:#c54633}.n2-slide-state-published .n2-i-unpublished{color:#6fbc49}.n2-slide-state-published .n2-i-unpublished:before{content:"\e60c"}.n2-box-slide.n2-slide-state-published{opacity:1}.n2-box-slide{opacity:.5}.n2-box.n2-first-slide:HOVER .n2-slide-first,.n2-slide-first,.n2-slide-is-first{display:none}.n2-first-slide .n2-slide-is-first{display:inline-block}.n2-slide-duplicate{margin-right:5px}.n2-slide-delete,.n2-slide-duplicate,.n2-slide-selected{padding:0;width:24px}#n2-ss-slides .n2-box.n2-ss-slide-active{box-shadow:0 0 0 3px #0c92df}#n2-ss-slides .n2-box-slide-drag-images,#n2-ss-slides .n2-box-slide-dummy{text-align:center;color:#7b8898;box-sizing:border-box;border:2px dashed #b2bfc9}#n2-ss-slides .n2-box-slide-dummy{background:#e9edf0;background-image:url(../images/dummy-slide.png);background-repeat:no-repeat;background-position:center 36px;font-size:14px;line-height:200px}#n2-ss-slides .n2-box-slide-drag-images{background:url(../images/drag.png) no-repeat center 4px;padding:90px 60px 0;line-height:12px;box-shadow:none}body:not([data-slides='0']) #n2-ss-slides .n2-box-dummy,body:not([data-slides='0']) #n2-ss-slides-container .n2-box-slide-drag-images,body:not([data-slides='0']) #n2-ss-slides-container .n2-box-slide-dummy{display:none}.n2-ss-slides-control{position:relative;padding:22px 10px;border-bottom:1px solid RGBA(0,0,0,.3)}.n2-ss-slides-control .n2-button{margin:0 10px}.n2-slides-add{vertical-align:bottom;margin:-2px}#n2-ss-slides .n2-box-slide-drag-upload{display:none;position:absolute;z-index:101;left:0;top:0;width:100%;height:100%;background-color:rgba(32,41,52,.9);border:0;right:0;bottom:0;margin:0;vertical-align:bottom;line-height:130px;text-align:center;color:#fff}#n2-ss-slides .n2-drag-over .n2-box-slide-drag-upload{display:block}.n2-box-slide .n2-button.n2-sidebar-list-bg:HOVER{background-color:#0c92df}.n2-ss-quick-slides-edit-modal .n2-modal-content table{border-spacing:10px;border-collapse:separate;margin:10px auto}.n2-ss-quick-slides-edit-modal .n2-modal-content table td{padding:0}.n2-ss-quick-slides-edit-modal .n2-modal-content .n2-mixed-label{margin-top:0;margin-bottom:3px}.n2-ss-quick-slides-edit-modal .n2-modal-content .n2-mixed-label label{font-size:11px}.n2-slide-state-first [data-action=setFirst],.n2-slide-state-published [data-action=publish],[data-action=generator],[data-action=unpublish]{display:none}.n2-slide-state-has-generator [data-action=generator],.n2-slide-state-published [data-action=unpublish]{display:block}.n2-box-slide .n2-i-star{display:none}.n2-box-slide.n2-slide-state-first .n2-i-star{display:inline;color:#e19f21;font-size:16px}#n2-ss-slides .n2-box:HOVER img{opacity:.1}.n2-ss-slides-header{position:relative;z-index:9;color:#6b7989;margin:14px 0 4px}.n2-ss-bulk-controls{visibility:hidden}.n2-ss-has-box-selection .n2-ss-bulk-controls{visibility:visible}.n2-ss-slides-header .n2-button-menu-open .n2-button-menu{right:-90px}#n2-ss-slides .n2-box-slide-add{display:inline-block;color:#b2bfc9;background:0 0;text-align:center;z-index:5}#n2-ss-slides .n2-box-slide-add>.n2-ss-add-slide-button{width:100%;height:135px;padding:0}#n2-ss-slides .n2-box-slide-add>.n2-ss-add-slide-button:before{display:block;font-family:'Nextend'!important;font-size:48px;line-height:68px;content:"\e981";margin-top:20px}.n2-ss-slides-header>*{vertical-align:top;display:inline-block}.n2-ss-slides-header .n2-h5,.n2-ss-slides-header .n2-h5 a{margin-right:10px;color:#6b7986}.n2-ss-slides-header .n2-h5 .n2-i{font-size:16px}.n2-top-bar-menu .n2-ss-back-dashboard:before{content:"\e94a"}.n2-top-bar-menu .n2-ss-back-slider:before{content:"\e94b"}.n2-top-bar-menu .n2-ss-back-slides:before{content:"\e91a"}.n2-top-bar-menu>#n2-ss-preview:before{content:"\e92d"}.n2-ss-block-slides-notice{display:none;color:#606d7b;background:#fff;margin-top:25px;padding:10px 15px;border-radius:5px}.n2-ss-block-slides-notice p{margin:0 0 10px}body:not([data-slides='0']):not([data-slides='1']) #n2-admin[data-slider-type=block] .n2-ss-block-slides-notice{display:inline-block}#n2-ss-slides .n2-box-slide-add .n2-ss-add-slide-button:before{transition:transform .4s}#n2-ss-slides .n2-box-slide-add .n2-ss-add-slide-button{transition:background .4s}#n2-ss-slides[data-showcreateslide="1"] .n2-box-slide-add .n2-ss-add-slide-button{background:#6b7986}#n2-ss-slides[data-showcreateslide="1"] .n2-box-slide-add .n2-ss-add-slide-button:before{transform:rotateZ(45deg)}#n2-ss-slides .n2-ss-slides-create{position:relative;background:#202934;margin:-25px -26px 0;height:0;overflow:hidden;transition:height .4s}#n2-ss-slides .n2-ss-slides-create>div{padding:15px 16px}#n2-ss-slides[data-showcreateslide="1"] .n2-ss-slides-create{height:198px}#n2-ss-slides .n2-ss-slides-create-heading{font-size:22px;line-height:38px;color:#fff;margin:0 10px}#n2-ss-slides .n2-ss-slides-create-inner{display:flex}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box{display:flex;flex-flow:column;justify-content:center;max-width:140px;width:140px;height:110px;text-align:center;color:#80a3b5;cursor:pointer;border-radius:5px;margin:10px}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box-label{font-size:14px;margin-top:3px}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box[data-action=image]{background:#51b82d;color:#fff}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box[data-action=library]{background:#5f39c2;color:#fff}.n2-ss-slides-create-action-box-icon{font-size:48px}div#n2-ss-0:HOVER .n2-ss-static-slide{display:none}div#n2-ss-0:HOVER .n2-ss-static-slide.n2-ss-currently-edited-slide{display:flex}.n2-ss-select-layer-mode #n2-ss-0 .n2-ss-layer-selected .n2-ss-layer-cc,.n2-ss-select-layer-mode #n2-ss-0 .n2-ss-layer-selected .nui-normal-sizing-handle,.n2-ss-select-layer-mode #n2-ss-0 .n2-ss-layer-selected .nui-resizable-handle{display:none!important}.n2-ss-select-layer-mode-group .n2-list li.n2-ss-layerlist-row.n2-active.n2-selected{color:#b2bfc9}#n2-ss-0 .n2-ss-layer{cursor:not-allowed}#n2-ss-0 .n2-ss-currently-edited-slide .n2-ss-layer{cursor:move}.n2-ss-currently-edited-slide .n2-ss-layer{background:RGBA(0,0,0,0)}#n2-ss-0 .n2-ss-currently-edited-slide .n2-ss-layer[data-sstype=col],#n2-ss-0 .n2-ss-currently-edited-slide .n2-ss-layer[data-sstype=col] .n2-ss-layer{cursor:pointer}#n2-ss-0 .n2-ss-slide.n2-ss-slide-active .n2-ss-layer.n2-ss-layer-locked,#n2-ss-0 .n2-ss-static-slide .n2-ss-layer.n2-ss-layer-locked{cursor:auto}.n2-ss-preview-mode #n2-ss-0 .n2-ss-layer{cursor:default}#n2-ss-0 .n2-ss-slide.n2-ss-slide-active .n2-ss-layer.n2-ss-layer-locked .n2-ss-layer-cc,#n2-ss-0 .n2-ss-static-slide .n2-ss-layer.n2-ss-layer-locked .n2-ss-layer-cc,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .n2-ss-layer-cc,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .n2-ss-layer-chain-parent,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .nui-normal-sizing-handle,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .nui-resizable-handle,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer-highlight,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer-selected .n2-ss-item-overlay{display:none!important}.n2-grid{background:#4affff;position:absolute;left:0;top:0;z-index:1000000;display:none}.n2-grid-h{width:100%;height:1px}.n2-grid-v{height:100%;width:1px}.n2-ss-edit-slide-top{background:#fff;border-bottom:1px solid #ccd1d6;padding:30px 20px 30px 40px;display:flex;flex-wrap:nowrap;justify-content:space-between;flex-flow:row}.n2-ss-edit-slide-top-thumbnail{width:200px;height:135px;cursor:pointer}.n2-ss-edit-slide-top-thumbnail img{width:200px;height:135px;border-radius:5px}.n2-ss-edit-slide-top-actions{width:180px;text-align:left;vertical-align:middle;flex:1}.n2-ss-edit-slide-top-actions>*{margin:10px 0}.n2-ss-edit-slide-top-details{flex:1;align-self:flex-end;padding:0 20px}.n2-slider-name .n2-h1,.n2-ss-edit-slide-top-details .n2-h1{color:#606d7b;margin-bottom:15px;cursor:pointer;line-height:30px}[dir=ltr] .n2-slider-name .n2-h1:HOVER:after,[dir=ltr] .n2-ss-edit-slide-top-details .n2-h1:HOVER:after,[dir=rtl] .n2-slider-name .n2-h1:HOVER:before,[dir=rtl] .n2-ss-edit-slide-top-details .n2-h1:HOVER:before{font-family:'Nextend'!important;content:"\e94f";font-size:22px;vertical-align:top;margin:0 5px;color:#b0b9bf}body[data-slides="0"] .n2-slider-name .n2-h1{cursor:default}body[data-slides="0"] .n2-slider-name .n2-h1:HOVER:after{display:none}.n2-ss-edit-slide-top-details .n2-h4 a{color:#7b8898}.n2-ss-edit-slide-top-details .n2-h4 a .n2-i{font-size:16px}.n2-ss-edit-slide-top-tabs{margin-top:15px}.n2-ss-edit-slide-top-tabs a{margin:0}.n2-ss-edit-slide-top-tabs a.n2-active{color:#fff;background-color:#0c92df;border-color:#0c92df}.n2-ss-edit-slide-top-tabs .n2-button{border-radius:0;border-left:0;padding:0 20px}.n2-ss-edit-slide-top-tabs .n2-button.n2-first{border-top-left-radius:3px;border-bottom-left-radius:3px;border-left:2px solid #e0e6ed}[dir=rtl] .n2-ss-edit-slide-top-tabs .n2-button.n2-first{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;border-right:2px solid #e0e6ed}.n2-ss-edit-slide-top-tabs .n2-button.n2-last,[dir=rtl] .n2-ss-edit-slide-top-tabs .n2-button.n2-first{border-top-right-radius:3px;border-bottom-right-radius:3px}[dir=rtl] .n2-ss-edit-slide-top-tabs .n2-button.n2-last{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:3px;border-bottom-left-radius:3px;border-left:2px solid #e0e6ed}.n2-ss-edit-slide-top-tabs .n2-button.n2-active{background:#0c92df;color:#fff;border-color:#0c92df!important}.n2-ss-edit-slide-top-tabs .n2-button.n2-active:not(.n2-first){border-left:2px solid #0c92df;margin-left:-2px}#n2-form-matrix-slide-settings{margin:0;border:0;border-radius:0}.n2-ss-slider-real-container{position:relative}.n2-ss-slider-outer-container{position:relative;padding:40px 0 0 40px}.n2-ss-canvas-slider-container{padding-bottom:99px;margin:10px}.n2-ss-has-ruler .n2-ss-canvas-slider-container{margin:0}#n2-ss-0-align{margin:0!important}.n2-i-desktopPortrait:before{content:'\e925'}.n2-i-desktopLandscape:before{content:'\e95a'}.n2-i-tabletPortrait:before{content:'\e928'}.n2-i-tabletLandscape:before{content:'\e927'}.n2-i-mobilePortrait:before{content:'\e92a'}.n2-i-mobileLandscape:before{content:'\e929'}#n2-tab-basiccsspreset{background-color:#3c4958;z-index:3}#n2-tab-basiccsspreset>.n2-h2{margin-bottom:0}.n2-basiccss-show-preset-list .n2-editor-header .n2-ss-button-container>.n2-basiccss-choose,.n2-editor-header .n2-ss-button-container>.n2-basiccss-back{display:none}.n2-basiccss-show-preset-list .n2-editor-header .n2-ss-button-container>.n2-basiccss-back{display:inline-block}.n2-ss-preview-modal .n2-modal-window{background-color:#e9edf0}#n2-admin.n2-ss-mode-desktopPortrait .n2-ss-responsive-helper,.n2-ss-background-type-color .n2-ss-background-video-param,.n2-ss-background-type-color .n2-ss-slide-background-image-param,.n2-ss-background-type-gradient .n2-ss-background-video-param,.n2-ss-background-type-gradient .n2-ss-slide-background-image-param,.n2-ss-background-type-image .n2-ss-background-video-param:not(.n2-ss-slide-background-image-param),body[data-editormode=content] #n2-admin .n2-ss-responsive-helper{display:none}#n2-tab-animations-events td.n2-label{padding:0}#n2-tab-animations-events td.n2-element{padding:6px 0}.n2-ss-editor-window-notice{padding:8px 10px;line-height:18px;background:#6b7986;color:#fff}.n2-ss-editor-window-notice a{color:#ffb527}#n2-ss-slide-edit-slides{display:none;border-bottom:1px solid #e0e6ed}.n2-ss-show-slides #n2-ss-slide-edit-slides{display:block}.n2-ss-show-slides a.n2-ss-back-slides,.n2-ss-show-slides a.n2-ss-back-slides:before{color:#fff}.n2-ss-columns-element{background:#28313a}.n2-ss-columns-element-add-col{vertical-align:top;display:inline-block;background:#51b82d;width:28px;height:28px;border-radius:3px;margin:8px 0;cursor:pointer;text-align:center;color:#fff;font-size:16px}.n2-ss-columns-element-add-col .n2-i,.n2-ss-columns-element-container .n2-ss-columns-element-handle .n2-i{line-height:28px}.n2-ss-columns-element-container{vertical-align:top;position:relative;width:300px;display:inline-flex;padding:8px;box-sizing:border-box;overflow:hidden}.n2-ss-columns-element-container>.n2-ss-columns-element-column{position:relative;flex:0 0 auto;background:#51b82d;height:28px;line-height:28px;width:25%;color:#fff;text-align:center;overflow:hidden;cursor:move;border-radius:3px;min-width:5px}.n2-ss-columns-element-container .n2-ss-columns-element-handle{display:block;width:11px;height:28px;background:#202934;flex:0 0 11px;border-radius:3px;margin:0 2px;cursor:ew-resize;color:#9aa7b2;text-align:center}.n2-ss-columns-element-container.n2-sortable-currently-sorted .n2-ss-columns-element-handle{display:none}.n2-ss-columns-element-container.n2-sortable-currently-sorted .n2-ss-columns-element-column{margin-right:15px}.n2-ss-columns-element-container.n2-sortable-currently-sorted .n2-ss-columns-element-column:last-child{margin-right:0}.n2-ss-section-main-content{min-height:20px}#n2-ss-0 .n2-ss-slide{opacity:.3}#n2-ss-0 .n2-ss-slide.n2-ss-currently-edited-slide{opacity:1}.n2-form-element-style-mode{display:flex;background:#28313a;padding:10px;border:1px solid #20282f;border-width:1px 0;margin-bottom:-1px;align-items:center}.n2-form-element-style-mode-reset{margin:0 10px 0 auto}.n2-form-element-style-mode .n2-form-element-radio-tab{height:24px;line-height:24px;margin:0}.n2-form-element-style-mode .n2-form-element-radio-tab .n2-radio-option{background:#6b7986;color:#fff;font-size:11px}.n2-form-element-style-mode .n2-form-element-radio-tab .n2-radio-option.n2-active{background:#0c92df}.n2-form-element-style-mode-label{display:inline-block;font-size:11px;color:#b2bfc9}#n2-ss-layer-window{z-index:100000;position:fixed;left:100px;top:100px;width:355px}#n2-ss-layer-window.n2-ss-layer-window-minized .n2-ss-layer-window-resizer,.n2-ss-has-layers.n2-ss-layer-edit-visible.n2-ss-preview-mode #n2-ss-layer-window,.n2-ss-layer-edit-visible.n2-ss-move-layer #n2-ss-layer-window,.n2-ss-layer-edit-visible.n2-ss-resize-layer #n2-ss-layer-window,body:not(.n2-ss-has-layers) #n2-ss-layer-window,body:not(.n2-ss-layer-edit-visible) #n2-ss-layer-window{display:none}#n2-ss-layer-window.n2-ss-layer-window-minized{height:30px!important}#n2-ss-layer-window.n2-ss-layer-window-minized .n2-i-minimize:before{content:'\e915'}#n2-ss-layer-window .n2-ss-layer-window-actions{display:none;position:absolute;top:0;left:-35px;width:32px;background-color:#202934;border-radius:3px}#n2-ss-layer-window .n2-ss-layer-window-actions>.n2-button{width:32px;height:32px;line-height:32px;color:#b0bdc7}#n2-ss-layer-window .n2-ss-layer-window-resizer{height:7px;width:100%;cursor:ns-resize;text-align:center;color:#95a1ab;bottom:0;background:#202934;border-bottom-left-radius:5px;border-bottom-right-radius:5px}#n2-ss-layer-window .n2-ss-layer-window-crop{position:relative;width:100%;height:100%;border-radius:3px;box-shadow:0 1px 10px RGBA(0,0,0,.5);overflow:hidden;background:#3c4958;z-index:2}.n2-ss-layer-window-title{position:relative;line-height:60px;height:60px;overflow:hidden;background:#202934;font-size:12px;color:#cbd6df;text-align:left}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav{position:absolute;top:0;line-height:30px;height:30px;margin:0 5px}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav-left{left:0}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav-right{right:0}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav>*{display:inline-block;width:20px;height:30px;line-height:30px;font-size:16px;color:#fff;padding:0;vertical-align:top;text-align:center}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav .n2-i{vertical-align:middle}.n2-ss-layer-window-title .n2-ss-layer-window-title span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0 60px;text-align:center}.n2-ss-layer-window-breadcrumb{display:none;height:22px;font-size:11px;color:#b2bfc9;background-color:#202934;border-bottom:1px solid #1a2028;text-transform:uppercase;padding:0 5px}.n2-ss-layer-window-breadcrumb.n2-has-breadcrumb{display:block}.n2-ss-layer-window-breadcrumb *{display:inline-block;height:22px;vertical-align:top;line-height:22px}.n2-window-title-structure-nav span{padding:0 5px;cursor:pointer}.n2-window-title-structure-nav .n2-i-mini-arrow-thin{font-size:16px;padding:0}.n2-window-title-structure-nav:last-child{color:#fff}.n2-window-title-structure-nav:last-child .n2-i-mini-arrow-thin{display:none}#n2-tabbed-slide-editor-settings .n2-tabs{position:relative;overflow-y:auto;overflow-x:hidden}#n2-ss-layer-window table,#n2-ss-layer-window tbody,#n2-ss-layer-window tr{display:block}#n2-ss-layer-window td{display:block;width:auto}#n2-ss-layer-window .n2-label{background:#3c4958;border-top:1px solid #303b47;padding:3px 10px 0}#n2-ss-layer-window .n2-empty-label{padding:0;height:4px}#n2-ss-layer-window .n2-empty-group-label{padding:0;height:0}#n2-ss-layer-window .n2-label label{color:#b2bfc9;font-size:10px}#n2-ss-layer-window .n2-element{background:#3c4958;border-top:0;padding:0}#n2-ss-layer-window textarea{max-width:290px!important;width:290px!important}#n2-ss-layer-window .n2-form-element-button{max-width:38px;overflow:hidden}#n2-ss-layer-window .n2-sidebar-row{line-height:34px;background:#28313a}#n2-ss-layer-window .n2-list li,#n2-ss-layer-window .n2-sidebar-row{border-bottom:1px solid RGBA(0,0,0,.2)}#n2-ss-layer-window .n2-button-m{height:24px;line-height:24px}#n2-ss-layer-window .n2-sidebar-tab-switcher{border:0;border-collapse:separate}#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td{font-size:11px;line-height:47px;height:47px;border:1px solid #1a2028;border-left:0;color:#b2bfc9}#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td .n2-i{font-size:32px;line-height:47px}#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td.n2-active{background:#0c92df;color:#fff}#n2-ss-layer-window .n2-has-underline>.n2-underline::after,#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td[data-tab=style]{display:none}#n2-ss-layer-window.n2-ss-has-design-option .n2-sidebar-tab-switcher .n2-td[data-tab=style]{display:table-cell}#n2-ss-layer-window .n2-ss-layer-window-title{line-height:30px;height:30px;cursor:move;border-top-left-radius:5px;border-top-right-radius:5px}#n2-ss-layer-window .n2-ss-layer-window-title .n2-ss-layer-window-title-inner{white-space:nowrap;margin:0 10px;text-align:center}#n2-ss-layer-window .ui-autocomplete{padding:0;max-height:200px;overflow-y:auto;overflow-x:hidden}#n2-ss-layer-window .n2-form-element-autocomplete .nui-autocomplete .nui-menu-item{padding-right:20px}#n2-ss-add-sidebar.n2-active .n2-ss-add-sidebar-inner>a,#n2-ss-layer-window .n2-ss-generator-param{display:none}.n2-ss-dynamic-slide #n2-ss-layer-window .n2-ss-generator-param{display:block}#n2-tabbed-animations-tabbed>.n2-table{border-spacing:8px;border-collapse:separate;background:#28313a;border-bottom:1px solid #20282f}#n2-tabbed-animations-tabbed .n2-sidebar-tab-switcher .n2-td{line-height:28px;height:28px;border:0;border-radius:50px}#n2-tabbed-animations-tabbed .n2-editor-header.n2-h2{background:#303b47;border-bottom:1px solid #28313a;position:relative}.n2-ss-small-more{float:right;margin:-38px 20px 0}html[dir=rtl] .n2-ss-small-more{float:left}.n2-button-single-animation-play.n2-active .n2-i:before{content:'\e607'}#n2-ss-add-sidebar{background:#212d3a;position:absolute;left:-1px;top:54px;bottom:-1px;width:50px;text-align:center}[dir=rtl] #n2-ss-add-sidebar{right:-1px;left:auto}#n2-ss-add-sidebar .n2-ss-add-sidebar-inner{position:relative;padding-top:.1px}#n2-ss-add-sidebar .n2-ss-add-sidebar-inner>*{margin-top:10px;color:#80a3b5}#n2-ss-add-sidebar .n2-ss-add-sidebar-inner>.n2-button-blue,.n2-ss-theme-dark .n2-ruler>span span{color:#fff}#n2-ss-add-sidebar.n2-active .n2-ss-add-sidebar-inner>*{margin-top:0}#n2-ss-add-sidebar.n2-active{width:341px;z-index:1010}#n2-ss-add-sidebar.n2-active .n2-ss-add-layer-button{margin:0;background:0 0;position:absolute;top:16px;right:5px}#n2-ss-add-sidebar.n2-active .n2-ss-add-layer-button .n2-i:before{content:"\e90a";color:#b2bfc9}#n2-ss-add-sidebar.n2-active .n2-ss-add-sidebar-inner{width:341px!important}#n2-ss-add-sidebar.n2-active .n2-ss-available-layers{display:block}.n2-ss-available-layers .n2-sidebar-tab-switcher{border:0}.n2-ss-available-layers-container{width:300px;margin:0 auto;padding:10px 0 90px}.n2-ss-slide-item-group{color:#b2bfc9;padding:4px 5px 1px}.n2-ss-addlayer .n2-ss-available-layers{display:none;box-sizing:border-box;white-space:normal;text-align:left}.n2-ss-core-item{display:inline-block;margin:5px;background-color:#6b7986;color:#fff;line-height:15px;cursor:pointer;text-align:center;border-radius:3px;width:90px;min-height:73px;z-index:1000;vertical-align:top}.n2-ss-core-item-title{display:flex;align-items:center;justify-content:center;height:34px}.n2-ss-core-item:before{font-family:'Nextend';font-size:32px;content:"\e943";display:block;line-height:32px;margin-top:14px}.n2-ss-core-item[data-item=heading]:before{content:"\e945"}.n2-ss-core-item[data-item=highlightedHeading]:before{content:"\e990"}.n2-ss-core-item[data-item=animatedHeading]:before{content:"\e991"}.n2-ss-core-item[data-item=text]:before{content:"\e944"}.n2-ss-core-item[data-item=button]:before{content:"\e942"}.n2-ss-core-item[data-item=imagearea]:before{content:"\e950"}.n2-ss-core-item[data-item=icon2]:before,.n2-ss-core-item[data-item=icon]:before{content:"\e941"}.n2-ss-core-item[data-item=input]:before{content:"\e939"}.n2-ss-core-item[data-item=iframe]:before{content:"\e938"}.n2-ss-core-item[data-item=area]:before{content:"\e937"}.n2-ss-core-item[data-item=list]:before{content:"\e93e"}.n2-ss-core-item[data-item=caption]:before{content:"\e940"}.n2-ss-core-item[data-item=transition]:before{content:"\e93f"}.n2-ss-core-item[data-item=youtube]:before{content:"\e93d"}.n2-ss-core-item[data-item=vimeo]:before{content:"\e93c"}.n2-ss-core-item[data-item=video]:before{content:"\e93b"}.n2-ss-core-item[data-item=html]:before{content:"\e93a"}.n2-ss-core-item[data-item=progressbar]:before{content:"\e982"}.n2-ss-core-item[data-item=imagebox]:before{content:"\e983"}.n2-ss-core-item[data-item=counter]:before{content:"\e984"}.n2-ss-core-item[data-item=circlecounter]:before{content:"\e985"}.n2-ss-core-item[data-item=audio]:before{content:"\e986"}.n2-ss-core-item[data-item=structure]:before{font-size:74px;margin-top:24px}.n2-ss-core-item[data-item=structure][data-sstype="1col"]:before{content:"\e967"}.n2-ss-core-item[data-item=structure][data-sstype="2col"]:before{content:"\e966"}.n2-ss-core-item[data-item=structure][data-sstype="3col"]:before{content:"\e961"}.n2-ss-core-item[data-item=structure][data-sstype="4col"]:before{content:"\e95f"}.n2-ss-core-item[data-item=structure][data-sstype="2col-60-40"]:before{content:"\e965"}.n2-ss-core-item[data-item=structure][data-sstype="2col-40-60"]:before{content:"\e964"}.n2-ss-core-item[data-item=structure][data-sstype="2col-80-20"]:before{content:"\e963"}.n2-ss-core-item[data-item=structure][data-sstype="2col-20-80"]:before{content:"\e962"}.n2-ss-core-item[data-item=structure][data-sstype="3col-20-60-20"]:before{content:"\e960"}.n2-ss-core-item[data-item=structure][data-sstype=special]:before{content:"\e95d"}#n2-ss-toolbar{z-index:9;position:relative;height:28px;line-height:28px;background:#f2f5fa;white-space:nowrap;padding:13px 10px}.n2-ss-slider-visible #n2-ss-slide-canvas-container #n2-ss-toolbar{height:auto}#n2-ss-slide-canvas-container.n2-scroll-disable #n2-ss-toolbar{height:28px;border-bottom:0}#n2-ss-toolbar>*{line-height:28px;height:28px;vertical-align:top;display:inline-block}#n2-ss-toolbar .n2-ss-tool{margin:0 5px;display:inline-block;vertical-align:top!important}#n2-ss-toolbar .n2-ss-tool.n2-form-element-text{height:24px;line-height:24px;position:relative}#n2-ss-toolbar .n2-text-sub-label{font-size:16px}#n2-ss-layer-list>.n2-list>li li,.n2-ss-theme-dark #n2-ss-slide-canvas-container-inner,.n2-ss-theme-dark .n2-ruler-vertical{background-color:#28313a}.n2-ss-preview-mode .n2-main-top-bar{opacity:0}#n2-ss-slide-canvas-settings{display:inline-block;position:relative}#n2-ss-slide-canvas-settings>.n2-button{width:28px;padding:0;text-align:center}#n2-ss-slide-canvas-settings.n2-active>.n2-button{background-color:#0c92df;border-color:#0c92df}#n2-ss-slide-canvas-settings .n2-ss-settings-panel{position:absolute;left:0;top:28px}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner{margin-top:6px;min-width:180px;box-shadow:0 0 5px 0 RGBA(0,0,0,.3);background-color:#fff;border-radius:3px}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner>*{display:block;line-height:32px;margin:0 10px;position:relative;text-align:left}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner a{color:#7b8898}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-panel-action{color:#0c92df}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-tick{display:block;position:absolute;right:0;top:8px;border-radius:3px;border:2px solid #8793a2;width:12px;height:12px}#n2-ss-layer-show-on,#n2-ss-slide-canvas-settings.n2-active .n2-ss-settings-panel{display:inline-block}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-enabled .n2-setting-tick{border-color:#1999e3;background-color:#1999e3}#n2-ss-slide-canvas-settings .n2-ss-settings-panel,#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-tick .n2-i{display:none}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-enabled .n2-i{display:inline-block;color:#fff;font-size:16px;line-height:12px;margin:0 -2px}#n2-ss-toolbar .n2-button-grey{background-color:#a1aeb5}#n2-ss-toolbar .n2-radio-option{background-color:#a1aeb5;border-left:1px solid #8c99a1}#n2-ss-toolbar .n2-radio-option.n2-first{border-left-width:0}#n2-ss-toolbar .n2-radio-option.n2-active{background-color:#0c92df;border-color:#0c92df}#n2-ss-toolbar .n2-radio-option.n2-active[data-mode=canvas]{background-color:#5f39c2;border-color:#5f39c2}#n2-ss-toolbar .n2-radio-option.n2-sub-active{background-color:#51b82d;border-color:#51b82d}#n2-ss-toolbar .n2-ss-tool.n2-button{height:28px;line-height:28px;background-color:#a1aeb5}#n2-ss-toolbar .n2-ss-tool.n2-button-icon{padding:0;width:28px}#n2-ss-toolbar .n2-ss-tool.n2-button.n2-active{background-color:#0c92df}#n2-ss-toolbar .n2-ss-tool.n2-button.n2-sub-active{background-color:#51b82d}#n2-ss-toolbar .ui-autocomplete{max-width:100%}#n2-ss-layer-parent-linker,#n2-ss-theme,#n2-ss-toolbar #n2-ss-theme.n2-active{width:28px;height:28px;line-height:28px;padding:0;background-color:#a1aeb5}#n2-ss-theme.n2-active .n2-i:before{content:"\e64c"}#n2-ss-layer-list .n2-list .n2-ss-layerlist-row.n2-ss-ll-dragging-parent{background:#000}#n2-ss-layer-list>.n2-list>li{background-color:#303b47}#n2-ss-layer-list .n2-list>li{line-height:31px}#n2-ss-layer-list .n2-list .n2-ss-layerlist-row.n2-active,#n2-ss-layer-list .n2-list .n2-ss-layerlist-row.n2-selected,.n2-list .n2-ss-layerlist-row.n2-active,.n2-list .n2-ss-layerlist-row.n2-selected{background:#1681c1}#n2-ss-layer-list .n2-ss-layer-content-row .n2-list>li .n2-actions-left,#n2-ss-layer-list .n2-ss-layerlist-row-row .n2-list>li .n2-actions-left,#n2-ss-layer-list .n2-ss-layerlist-row.n2-ss-ll-dragging .n2-actions,#n2-ss-layer-list .n2-ss-layerlist-row.n2-ss-ll-dragging .n2-actions-left{display:none}#n2-ss-layer-list .n2-ss-layerlist-row.n2-ss-ll-dragging{position:absolute;left:0;width:100%;height:32px;overflow:hidden;opacity:.5}#n2-ss-layers .nextend-sortable-placeholder{border:0;position:relative;height:0;overflow:visible;z-index:1001}#n2-ss-layers .nextend-sortable-placeholder div{position:absolute;left:0;top:-1px;width:100%;height:0;box-shadow:0 0 0 2px #0c92df}#n2-ss-layers ul .nextend-sortable-placeholder div{margin-left:30px}#n2-ss-layers ul ul .nextend-sortable-placeholder div{margin-left:50px}#n2-ss-layers ul ul ul .nextend-sortable-placeholder div{margin-left:70px}#n2-ss-layers ul ul ul ul .nextend-sortable-placeholder div{margin-left:90px}#n2-ss-layers ul ul ul ul ul .nextend-sortable-placeholder div{margin-left:110px}#n2-ss-layers ul ul ul ul ul ul .nextend-sortable-placeholder div{margin-left:130px}#n2-ss-layers .n2-ui-sortable-helper{opacity:.5}#n2-ss-layers-table .n2-list li,.n2-list .n2-ss-layer-group-row{border-bottom:0}#n2-ss-layers-table .n2-ss-layer-title{border-bottom:1px solid RGBA(0,0,0,.2)}#n2-ss-layers-table .n2-active>.n2-ss-layer-title,#n2-ss-layers-table .n2-selected>.n2-ss-layer-title{border-color:#1681c1}.n2-ss-layer-group-row ul.n2-list{margin-top:-10px;padding-top:10px}.n2-ss-layer-title{display:block;line-height:31px;position:relative;cursor:pointer;overflow:hidden}.n2-ss-layer-title span{margin:0 30px;display:block;width:170px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.n2-ss-layer-group-row>.n2-ss-layer-title span,ul>li>.n2-ss-layer-title span{margin:0 30px}.n2-ss-layer-icon{position:absolute;top:2px}ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:3px}#n2-ss-layer-list>ul>li.n2-ss-layer-content-row>.n2-ss-layer-title span,#n2-ss-layer-list>ul>li.n2-ss-layer-row-row>.n2-ss-layer-title span,ul>li .n2-inline-form,ul>li>ul>li>.n2-ss-layer-title span{margin:0 50px}#n2-ss-layer-list>ul>li.n2-ss-layer-content-row>.n2-ss-layer-title .n2-ss-layer-icon,#n2-ss-layer-list>ul>li.n2-ss-layer-row-row>.n2-ss-layer-title .n2-ss-layer-icon,ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:23px}ul>li>ul>li>ul>li .n2-inline-form,ul>li>ul>li>ul>li>.n2-ss-layer-title span{margin:0 70px}ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:43px}ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title span,ul>li>ul>li>ul>li>ul>li>ul>li .n2-inline-form{margin:0 90px}ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:63px}ul>li>ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title span{margin:0 110px}ul>li>ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:83px}ul>li>ul>li>ul>li>ul>li>ul>li>ul>li .n2-ss-layer-title span{margin:0 130px}ul>li>ul>li>ul>li>ul>li>ul>li>ul>li .n2-ss-layer-title .n2-ss-layer-icon{left:103px}[dir=rtl] ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:3px;left:auto}[dir=rtl] #n2-ss-layer-list>ul>li.n2-ss-layer-content-row>.n2-ss-layer-title .n2-ss-layer-icon,[dir=rtl] #n2-ss-layer-list>ul>li.n2-ss-layer-row-row>.n2-ss-layer-title .n2-ss-layer-icon,[dir=rtl] ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:23px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:43px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:63px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:83px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>ul>li>ul>li>ul>li .n2-ss-layer-title .n2-ss-layer-icon{right:103px;left:auto}.n2-ss-layerlist-row .n2-inline-form input{background:#3c4958 0 0;color:#b2bfc9;font-size:11px;border:2px solid #28313a;line-height:24px;padding:0 10px;border-radius:3px;margin:0}.n2-ss-layerlist-row .n2-inline-form input:focus{box-shadow:none}.n2-ss-layer-title .n2-actions{position:absolute;top:0;right:0;padding:0 6px;cursor:default;opacity:.2}.n2-active>.n2-ss-layer-title .n2-actions{opacity:1}.n2-ss-layer-title .n2-actions-left{position:absolute;top:0;left:0;padding:2px 0;cursor:default;line-height:24px}html[dir=rtl] .n2-ss-layer-title .n2-actions-left{right:0;left:auto}#n2-ss-layer-list .n2-ss-layerlist-row.n2-active>.n2-ss-layer-title,#n2-ss-layer-list .n2-ss-layerlist-row.n2-active>.n2-ss-layer-title .n2-i,#n2-ss-layer-list .n2-ss-layerlist-row.n2-selected .n2-ss-layer-title,#n2-ss-layer-list .n2-ss-layerlist-row.n2-selected .n2-ss-layer-title .n2-i{color:#fff}.n2-ss-layer-title .n2-actions a,.n2-ss-layer-title .n2-actions-left a{display:inline-block;padding:0}.n2-ss-layer-title .n2-actions-left i{padding:0 2px;vertical-align:middle}.n2-ss-layer-title .n2-i-order{cursor:move}.n2-ss-layer-status{display:inline-block;position:relative;margin:0 3px}#n2-ss-layer-list a .n2-i,#n2-ss-layer-list a:HOVER .n2-i{color:#b2bfc9}.n2-ss-layer-status-hidden .n2-ss-layer-status .n2-ss-sc-hide .n2-i:before{content:"\e923"}.n2-ss-layer-list-top-bar .n2-h2{display:inline-block;line-height:28px;color:#fff;padding:0 5px}.n2-ss-layer-list-opener{width:28px;display:inline-block;padding:0;vertical-align:top;margin:0 5px}#n2-ss-layers.n2-active .n2-ss-layer-list-opener>.n2-i:before{content:"\e92c"}.n2-closed .n2-i-col:before,.n2-closed .n2-i-row:before,.n2-ss-layer-list-group-opener.n2-closed .n2-i:before{content:"\e921"}#n2-ss-layers{position:fixed;bottom:0;width:340px;margin:0 -1px;height:48px;display:none;background-color:#28313a;z-index:1019}#n2-ss-layers.n2-active{height:100px}#n2-ss-layers:not(.n2-active){width:50px!important}#n2-ss-layers:not(.n2-active) .n2-ss-layers-sidebar{width:50px}#n2-ss-layers:not(.n2-active) .n2-ss-layer-list-layers-top-bar>div{display:none!important}.n2-ss-has-layers #n2-ss-layers{display:block}#n2-ss-layers-table .n2-td{position:relative;vertical-align:top}#n2-ss-layers-table .n2-ss-layers-sidebar{width:340px}.n2-ss-layer-list-top-bar{position:relative;padding:10px 5px 9px;height:28px;background-color:#212d3a;border-bottom:1px solid #20282f}#n2-ss-layers.n2-active .n2-ss-layer-list-layers-top-bar{cursor:ns-resize}.n2-ss-layer-list-bulk-top-bar,[data-component=layer] .n2-ss-select-layer-mode #n2-ss-layers.n2-active .n2-ss-layer-list-layers-top-bar{display:none}[data-component=layer] .n2-ss-select-layer-mode #n2-ss-layers.n2-active .n2-ss-layer-list-bulk-top-bar{display:block}.n2-ss-layer-list-top-bar .n2-form-element-text{margin:0}.n2-ss-layers-sidebar-rows{position:relative;height:100%;overflow-x:hidden;overflow-y:visible}#n2-ss-layers .n2-form-element-text{margin:0 10px;line-height:2px}#n2-ss-layers .n2-text-sub-label{width:30px;text-align:center;overflow:hidden}.n2-ss-layer-list-bulk-top-bar{text-align:right;color:#fff;vertical-align:top;padding:10px 15px 9px}.n2-ss-layer-list-bulk-top-bar .n2-button{vertical-align:middle}.n2-ss-layer-list-bulk-top-bar .n2-button+.n2-button,.n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control .n2-button{margin:0 0 0 5px}html[dir=rtl] .n2-ss-layer-list-top-bar .n2-button+.n2-button,html[dir=rtl] .n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control .n2-button{margin:0 5px 0 0}.n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control{position:absolute;top:10px;right:5px;margin:0 10px}html[dir=rtl] .n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control{right:auto;left:5px}.n2-ss-layer-list-topbar-control{text-align:right;color:#fff;padding:0 10px;vertical-align:top}#n2-ss-layers .n2-ss-layer-list-topbar-control{padding:0}.n2-ss-layer-list-topbar-control .n2-button{padding:0;width:28px;font-size:16px;vertical-align:middle}.n2-ss-layer-list-topbar-control .n2-button i{line-height:inherit}.n2-play.n2-active i:before{content:"\e607"}#n2-ss-slide-canvas-container{background-color:#fff;border-width:1px 0 0;padding-bottom:400px;padding-bottom:40vh;position:relative;z-index:1;border-top:1px solid #ccd1d6}#smartslider-form>div{margin-bottom:-1px}#n2-ss-slide-canvas-container-inner{position:relative;z-index:1;overflow:hidden;border-bottom:1px solid #ccd1d6;background-color:#e9edf0;margin-left:49px;border-top:1px solid #ccd1d6}[dir=rtl] #n2-ss-slide-canvas-container-inner{margin-right:49px;margin-left:0}.n2-ss-position-display{display:none;position:absolute;border-radius:3px;z-index:10000;line-height:16px;padding:4px 6px;color:#fff;font-size:10px;background:RGBA(32,41,52,.95)}.n2-ss-position-display.n2-active{display:block}#n2-ss-0 .n2-ss-slide-border{display:none;position:absolute;background:#a1aeb5;width:1px;height:1px}#n2-ss-0 .n2-ss-slide-border-left{left:0;top:0;height:100%}#n2-ss-0 .n2-ss-slide-border-right{right:0;top:0;height:100%}#n2-ss-0 .n2-ss-slide-border-top{left:0;top:0;width:100%}#n2-ss-0 .n2-ss-slide-border-bottom{left:0;bottom:0;width:100%}#n2-ss-0:HOVER .n2-ss-slide-border{display:block}.n2-ss-layer-placeholder{position:relative;height:0;width:100%;box-shadow:0 0 0 2px #0c92df;display:block;z-index:100000}.n2-ss-layer-inline>.n2-ss-layer-placeholder,.n2-ss-layer-row>.n2-ss-layer-placeholder{height:auto;width:0;align-self:stretch;flex:0 0 auto}.n2-ss-core-item.n2-canvas-item-drag{opacity:.5;z-index:9999;margin:0}.n2-canvas-item-drag{opacity:.5!important}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer.n2-ss-mouse-over,.n2-ss-move-layer div#n2-ss-0 .n2-ss-layer.nui-resizable,.n2-ss-resize-layer div#n2-ss-0 .n2-ss-layer.nui-resizable{box-shadow:inset 0 0 0 1px #0c92df}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer.n2-ss-mouse-over[data-pm=absolute],#n2-ss-slide-canvas-container #n2-ss-0 [data-pm=absolute] .n2-ss-layer.n2-ss-mouse-over,.n2-ss-move-layer div#n2-ss-0 .n2-ss-layer.nui-resizable[data-pm=absolute],.n2-ss-move-layer div#n2-ss-0 [data-pm=absolute] .n2-ss-layer.nui-resizable,.n2-ss-resize-layer div#n2-ss-0 .n2-ss-layer.nui-resizable[data-pm=absolute],.n2-ss-resize-layer div#n2-ss-0 [data-pm=absolute] .n2-ss-layer.nui-resizable{box-shadow:inset 0 0 0 1px #5f39c2}div#n2-ss-0 .n2-ss-layer-ui-label-container{display:none;position:absolute;left:0;top:0;text-align:left;line-height:16px;z-index:91;white-space:nowrap;border-bottom-right-radius:2px;overflow:hidden;background:#0c92df;max-width:100%;max-height:100%}div#n2-ss-0 [data-pm=absolute] .n2-ss-layer-ui-label-container{background:#5f39c2}div#n2-ss-0 .n2-ss-layer-ui-label-container:HOVER{max-width:none;max-height:none}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer.n2-active>.n2-ss-layer-ui-label-container,div#n2-ss-0 .n2-ss-layer.n2-ss-mouse-over-delayed>.n2-ss-layer-ui-label-container{display:block}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .n2-ss-layer-ui-label{display:inline-block;height:16px;font-size:10px;line-height:16px;color:#fff;padding:0 5px;vertical-align:top;text-transform:uppercase;border-left:1px solid #0b7dbe}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer[data-pm=absolute] .n2-ss-layer-ui-label{border-left:1px solid #422887}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-label-action{padding:0;cursor:pointer;font-size:16px;display:none}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer.n2-active>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-label-action,#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container:HOVER .n2-ss-layer-ui-label-action{display:inline-block}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-label:first-child{border-left:0}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-layer-move{cursor:move}div#n2-ss-0 .n2-ss-layer-ui-label-container.invisible{visibility:hidden}.n2-ss-layer[data-sstype=col].n2-highlight{box-shadow:inset 0 0 0 1px #0c92df}div#n2-ss-0 .n2-ss-layer.n2-ss-mouse-hover[data-sstype=col]{z-index:2}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer.n2-active{box-shadow:inset 0 0 0 1px #0c92df}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer[data-pm=absolute] .n2-ss-layer[data-sstype=col].n2-active,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer[data-pm=absolute].n2-active,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 [data-pm=absolute] .n2-ss-layer.n2-active{box-shadow:inset 0 0 0 1px #5f39c2}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER #n2-ss-0 .n2-ss-layer[data-sstype=row].n2-active,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer .n2-ss-layer[data-sstype=col].n2-active{box-shadow:inset 0 0 0 1px RGBA(12,146,223,1)}.n2-ss-move-layer .n2-ss-layer[data-sstype=col]{box-shadow:inset 0 0 0 1px RGBA(12,146,223,1)}.n2-ss-move-layer #n2-ss-0 .n2-ss-layer:HOVER{box-shadow:none}div#n2-ss-0 .n2-ss-layer[data-sstype=col] .n2-ss-layer.nui-draggable-dragging,div#n2-ss-0 .n2-ss-layer[data-sstype=content] .n2-ss-layer.nui-draggable-dragging{z-index:100000;outline:0!important}.n2-ss-item-overlay{display:none;position:absolute;top:0;left:0;width:100%;height:100%}.n2-ss-select-layer-mode .n2-ss-layer-selected .n2-ss-item-overlay{display:block;background-color:RGBA(0,132,255,.4)}.n2-ss-item-html .n2-ss-item-overlay,.n2-ss-item-iframe .n2-ss-item-overlay{display:block}.n2-ss-layer .n2-ss-layer-cc{opacity:0}.n2-ss-layer-cc:HOVER,.nui-resizable-e:HOVER,.nui-resizable-n:HOVER,.nui-resizable-ne:HOVER,.nui-resizable-nw:HOVER,.nui-resizable-s:HOVER,.nui-resizable-se:HOVER,.nui-resizable-sw:HOVER,.nui-resizable-w:HOVER{opacity:1}.n2-ss-layer[data-align=center][data-valign=bottom] .nui-resizable-s,.n2-ss-layer[data-align=center][data-valign=middle] .n2-ss-layer-cc,.n2-ss-layer[data-align=center][data-valign=top] .nui-resizable-n,.n2-ss-layer[data-align=left][data-valign=bottom] .nui-resizable-sw,.n2-ss-layer[data-align=left][data-valign=middle] .nui-resizable-w,.n2-ss-layer[data-align=left][data-valign=top] .nui-resizable-nw,.n2-ss-layer[data-align=right][data-valign=bottom] .nui-resizable-se,.n2-ss-layer[data-align=right][data-valign=middle] .nui-resizable-e,.n2-ss-layer[data-align=right][data-valign=top] .nui-resizable-ne{background:#0c92df;opacity:1;border:1px solid #fff}.n2-ss-layer[data-align=center][data-valign=bottom][data-pm=absolute] .nui-resizable-s,.n2-ss-layer[data-align=center][data-valign=middle][data-pm=absolute] .n2-ss-layer-cc,.n2-ss-layer[data-align=center][data-valign=top][data-pm=absolute] .nui-resizable-n,.n2-ss-layer[data-align=left][data-valign=bottom][data-pm=absolute] .nui-resizable-sw,.n2-ss-layer[data-align=left][data-valign=middle][data-pm=absolute] .nui-resizable-w,.n2-ss-layer[data-align=left][data-valign=top][data-pm=absolute] .nui-resizable-nw,.n2-ss-layer[data-align=right][data-valign=bottom][data-pm=absolute] .nui-resizable-se,.n2-ss-layer[data-align=right][data-valign=middle][data-pm=absolute] .nui-resizable-e,.n2-ss-layer[data-align=right][data-valign=top][data-pm=absolute] .nui-resizable-ne{background:#5f39c2}.n2-ss-layer-cc{position:absolute;font-size:.1px;display:block;z-index:92}.n2-ss-layer .nui-normal-sizing-handle,.n2-ss-layer .nui-resizable-handle{border-radius:50px}.n2-ss-layer .n2-ss-layer-cc,.n2-ss-layer .nui-normal-sizing-handle,.n2-ss-layer .nui-resizable-handle{display:none!important;background-image:none;border:1px solid #0c92df;height:7px;width:7px;background:#fff}.n2-ss-layer[data-pm=absolute] .n2-ss-layer-cc,.n2-ss-layer[data-pm=absolute] .nui-normal-sizing-handle,.n2-ss-layer[data-pm=absolute] .nui-resizable-handle{border:1px solid #5f39c2}.n2-ss-layer .ui-column-width-handle{display:none!important;position:absolute;top:25%;height:50%;cursor:ew-resize;width:5px;background:RGBA(12,146,223,.5);z-index:88;opacity:1;box-sizing:border-box!important;border-radius:5px}.n2-ss-layer .ui-column-width-handle:HOVER{background:RGBA(12,146,223,1)}.n2-ss-layer[data-pm=absolute] .ui-column-width-handle{background:RGBA(95,57,194,.5)}.n2-ss-layer[data-pm=absolute] .ui-column-width-handle:HOVER{background:RGBA(95,57,194,1)}.n2-ss-layer .nui-spacing-handle{display:none!important;z-index:89;background:#0c92df;opacity:.5;overflow:hidden}.n2-ss-layer[data-pm=absolute] .nui-spacing-handle{background:#5f39c2}.n2-ss-layer .nui-spacing-handle.nui-spacing-under-spacing,.n2-ss-layer .nui-spacing-handle:HOVER{opacity:.8}.n2-ss-layer .nui-resizable-n{left:50%;top:-4px;margin-left:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-n{min-height:5px;cursor:s-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-n{top:0;margin-left:0;left:25%;width:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-n{left:0;bottom:100%;width:100%}.n2-ss-layer .nui-normal-sizing-e,.n2-ss-layer .nui-resizable-e{right:-4px;top:50%;margin-top:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-e{min-width:5px;cursor:w-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-e{top:25%;margin-top:0;right:0;height:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-e{top:0;left:100%;height:100%}.n2-ss-layer .nui-normal-sizing-s,.n2-ss-layer .nui-resizable-s{bottom:-4px;left:50%;margin-left:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-s{min-height:5px;cursor:n-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-s{bottom:0;margin-left:0;left:25%;width:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-s{bottom:auto;top:100%;left:0;width:100%}.n2-ss-layer .nui-normal-sizing-w,.n2-ss-layer .nui-resizable-w{left:-4px;top:50%;margin-top:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-w{min-width:5px;cursor:e-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-w{top:25%;margin-top:0;left:0;height:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-w{left:auto;right:100%;top:0;height:100%}.n2-ss-layer .nui-resizable-ne{right:-4px;top:-4px}.n2-ss-layer .nui-resizable-se{right:-4px;bottom:-4px}.n2-ss-layer .nui-resizable-sw{left:-4px;bottom:-4px}.n2-ss-layer .nui-resizable-nw{left:-4px;top:-4px}.n2-ss-layer .n2-ss-layer-cc{left:50%;top:50%;margin-top:-4px;margin-left:-4px}.n2-ss-layer.n2-active:HOVER{box-shadow:inset 0 0 0 1px #0c92df}.n2-ss-layer.n2-active[data-pm=absolute]:HOVER,[data-pm=absolute] .n2-ss-layer.n2-active:HOVER{box-shadow:inset 0 0 0 1px #5f39c2}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.n2-ss-layer-cc,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.nui-normal-sizing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.nui-resizable-handle,.n2-ss-layer.n2-active:HOVER>.n2-ss-layer-cc,.n2-ss-layer.n2-active:HOVER>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-layer.n2-active:HOVER>.n2-ss-layer-row>.ui-column-width-handle,.n2-ss-layer.n2-active:HOVER>.nui-normal-sizing-handle,.n2-ss-layer.n2-active:HOVER>.nui-resizable-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.n2-ss-layer-row>.ui-column-width-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.nui-normal-sizing-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.nui-resizable-handle{display:block!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.nui-spacing-handle{display:none!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-content>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-mask>.n2-ss-layer-content>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-mask>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.nui-resizable-resizing>div>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.nui-spacing-resizing>.nui-spacing-handle,.nui-resizable-resizing>.nui-spacing-handle,.nui-spacing-resizing>.nui-spacing-handle{display:block!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.nui-spacing-resizing>.nui-spacing-handle.nui-spacing-under-spacing{opacity:1}#n2-ss-0 .n2-ss-layer-row[row-wrapped="1"] .ui-column-width-handle,#n2-ss-0 .nui-spacing-resizing .ui-column-width-handle,#n2-ss-0 [data-frontend-fullwidth="0"]>.n2-ss-layer-row .ui-column-width-handle{display:none!important}.n2-ss-animation-play-single #n2-ss-0 .n2-ss-layer .n2-ss-layer-cc,.n2-ss-animation-play-single #n2-ss-0 .n2-ss-layer .nui-normal-sizing-handle,.n2-ss-animation-play-single #n2-ss-0 .n2-ss-layer .nui-resizable-handle,.n2-ss-move-layer .n2-ss-layer.n2-active:HOVER .n2-ss-layer-cc,.n2-ss-move-layer .n2-ss-layer.n2-active:HOVER .nui-normal-sizing-handle,.n2-ss-move-layer .n2-ss-layer.n2-active:HOVER .nui-resizable-handle{display:none!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active{overflow:visible!important}.n2-ss-item{position:relative;float:left;width:100%}.n2-ss-item-area,.n2-ss-item-imagearea,.n2-ss-item-video,.n2-ss-item-vimeo,.n2-ss-item-youtube{height:100%}.n2-ss-editor-group-mode-only,.n2-ss-editor-layer-mode-only,[data-placement=""] [data-placement],[data-placement=absolute] [data-placement]:not([data-placement=absolute]):not([data-placement=all]),[data-placement=content] [data-placement]:not([data-placement=content]):not([data-placement=all]),[data-placement=default] [data-placement]:not([data-placement=default]):not([data-placement=all]),[data-placement=group] [data-placement]:not([data-placement=group]):not([data-placement=all]),[data-placement=normal] [data-placement]:not([data-placement=normal]):not([data-placement=all]){display:none!important}.n2-ss-has-layers[data-component=group] .n2-ss-editor-group-mode-only,.n2-ss-has-layers[data-component=layer] .n2-ss-editor-layer-mode-only{display:inline-block!important}div#n2-ss-0 .n2-ss-layer-chain-parent{position:absolute;z-index:10;right:10px;top:10px;line-height:18px;font-size:12px;width:18px;display:none}.n2-ss-layer-edit-visible .n2-ss-mode-desktopPortrait #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active.n2-ss-layer-has-parent .n2-ss-layer-chain-parent,.n2-ss-mode-desktopPortrait #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active.n2-ss-layer-has-parent:HOVER .n2-ss-layer-chain-parent{display:inline-block}.n2-ss-layer-highlight{position:absolute;background:#0c92df;z-index:91;opacity:1}.n2-ss-layer-highlight-n{top:0;left:0;width:100%;height:1px}.n2-ss-layer-highlight-e{top:0;right:0;width:1px;height:100%}.n2-ss-layer-highlight-s{bottom:0;left:0;width:100%;height:1px}.n2-ss-layer-highlight-w{top:0;left:0;width:1px;height:100%}#n2-ss-0 .n2-ss-layer-row .n2-ss-layer-content{min-height:20px}[data-devicespecific]{position:relative}#n2-ss-devicespecific-settings{position:absolute;bottom:40px;left:0;padding:0 10px;white-space:nowrap;z-index:2}#n2-ss-devicespecific-settings *{cursor:pointer;background:#a1aeb5;display:inline-block;width:20px;height:20px;line-height:20px;text-align:center;font-size:16px;color:#fff;border-left:1px solid #5b6874}#n2-ss-devicespecific-settings>:first-child{border-top-left-radius:3px;border-bottom-left-radius:3px;border-left:0}#n2-ss-devicespecific-settings>:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}.n2-ss-mode-desktopLandscape #n2-ss-devicespecific-settings .n2-i-mini-desktop-landscape,.n2-ss-mode-desktopPortrait #n2-ss-devicespecific-settings .n2-i-mini-desktop-portrait,.n2-ss-mode-mobileLandscape #n2-ss-devicespecific-settings .n2-i-mini-mobile-landscape,.n2-ss-mode-mobilePortrait #n2-ss-devicespecific-settings .n2-i-mini-mobile-portrait,.n2-ss-mode-tabletLandscape #n2-ss-devicespecific-settings .n2-i-mini-tablet-landscape,.n2-ss-mode-tabletPortrait #n2-ss-devicespecific-settings .n2-i-mini-tablet-portrait{background:#0c92df;border-color:#0b7dbe}.n2-ss-layer[data-sstype=col]>.n2-ss-layer-ui-label-container>.n2-ss-layer-ui-label-self{cursor:move}.n2-highlight-structure .n2-ss-layer[data-sstype=col]{box-shadow:0 0 0 2px #0c92df}.n2-highlight-structure[data-pm=absolute] .n2-ss-layer[data-sstype=col]{box-shadow:0 0 0 2px #5f39c2}.n2-ss-layer-under-creation{visibility:hidden!important}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layers-container>.n2-ss-layer>.n2-ss-layer-ui-label-container>.n2-ss-layer-ui-label-up,[data-editormode=canvas] div#n2-ss-0 .n2-ss-layer[data-sstype=content].n2-ss-content-empty{display:none}[data-editormode=content] div#n2-ss-0 .n2-ss-layer[data-sstype=content].n2-ss-content-empty{height:100%}div#n2-ss-0 .n2-ss-layer-content .n2-ss-layer.n2-active:HOVER{z-index:10}#n2-ss-editor-mode .n2-i{font-size:16px;vertical-align:middle}.n2-context-menu{display:none;position:absolute;left:0;top:0;font-family:"Montserrat",Arial,sans-serif;font-size:13px;background-color:#202934;color:#cedae2;z-index:1000000;border-radius:3px;line-height:25px}.n2-context-menu.n2-active{display:block}.n2-context-menu>div{padding:3px 10px;cursor:pointer}.n2-context-menu>div:HOVER{background-color:RGBA(255,255,255,.2)}.n2-context-menu>div *{margin:0 3px;vertical-align:middle}.n2-context-menu>div .n2-i{font-size:16px}.n2-ss-banner{background-color:#212d3a;margin:0 -1px;z-index:2;position:relative;color:#fff}.n2-ss-banner .n2-ss-banner-inner{display:flex;align-items:center;max-width:960px}.n2-ss-banner .n2-ss-banner-inner>div{margin:20px}.n2-ss-banner .n2-ss-banner-inner a+a{margin:0 20px}.n2-ss-banner .n2-ss-banner-inner p{color:#b2bfc9;font-size:14px;margin:20px 0}[data-visibility=hidden],[data-visibility=hidden] *{visibility:hidden!important}div div#n2-ss-0 .n2-ss-static-slide div[data-sstype=content],div div#n2-ss-0 .n2-ss-static-slide div[data-sstype=content] div.n2-ss-section-main-content{visibility:visible}.n2-ss-sample-slides-container{display:none;position:relative;margin:0 -1px -1px;background-color:#202934;z-index:2}.n2-ss-add-slide-with-sample .n2-main-top-bar{display:none}.n2-ss-add-slide-with-sample .n2-ss-sample-slides-container{display:block}.n2-ss-add-slide-with-sample #n2-ss-devices,.n2-ss-add-slide-with-sample #n2-ss-toolbar,.n2-ss-add-slide-with-sample #smartslider-form,.n2-ss-add-slide-with-sample .n2-ss-edit-slide-top{display:none}.n2-ss-add-slide-with-sample #n2-ss-add-sidebar{top:0}.n2-ss-add-slide-with-sample #n2-ss-slide-canvas-container-inner{border-top:0}.n2-ss-sample-slides-container iframe{width:100%;height:240px;border:0}.n2-ss-sample-slide-settings{padding:20px;background:#212d3a;height:68px;display:flex}.n2-ss-sample-slide-settings .n2-ss-sample-slide-settings-col{flex:0 0 auto;margin:0 10px;display:flex;flex-direction:column;justify-content:space-around}.n2-ss-sample-slide-settings-col .n2-ss-sample-slide-setting{flex:0 0 auto;display:flex;align-items:center}.n2-ss-sample-slide-setting-label{color:#b2bfc9;font-size:10px;text-transform:uppercase;padding-right:20px}#n2-ss-sample-slide-setting-background-image{position:relative;width:100px;height:68px;background-size:cover;border-radius:5px;overflow:hidden;cursor:pointer}#n2-ss-sample-slide-setting-background-image .n2-i-close{position:absolute;right:0;top:0;display:block;width:16px;height:16px;border-bottom-left-radius:5px;background-color:#526377;color:#fff;font-size:14px;text-align:center;line-height:16px;cursor:pointer}.n2-ss-sample-slide-setting-field{margin-left:auto}.n2-ss-sample-slide-setting-field .nui-slider{width:100px;position:relative;background:#374d64;height:6px;margin:10px;border-radius:10px}.n2-ss-sample-slide-setting-field .nui-slider .nui-slider-handle{position:absolute;top:0;z-index:2;width:14px;height:14px;-ms-touch-action:none;touch-action:none;background:#fff;margin:-4px -7px 0;border-radius:50px;cursor:ew-resize}.n2-ss-sample-slide-settings .n2-ss-sample-slide-settings-col.n2-ss-sample-slide-settings-image-specific,.n2-ss-sample-slide-settings-col .n2-ss-sample-slide-setting.n2-ss-sample-slide-setting-gradient-specific{display:none}.n2-ss-sample-slide-settings.n2-ss-has-gradient .n2-ss-sample-slide-settings-col .n2-ss-sample-slide-setting.n2-ss-sample-slide-setting-gradient-specific,.n2-ss-sample-slide-settings.n2-ss-has-image .n2-ss-sample-slide-settings-col.n2-ss-sample-slide-settings-image-specific{display:flex}.n2-ss-scrollbar-wrapper{background-color:#212d3a;padding:4px;height:8px;z-index:10}.n2-scroll-disable .n2-ss-scrollbar-wrapper{visibility:hidden;height:0;padding:0}.n2-ss-scrollbar-wrapper .track{position:relative;height:8px}.n2-ss-scrollbar-wrapper .thumb{position:absolute;top:0;background-color:#49586a;height:8px;cursor:default;width:20px;z-index:2;border:0;border-radius:5px}.n2-ss-scrollbar-wrapper.n2-ss-scrollbar-light{background-color:#b9c3c9}.n2-ss-scrollbar-wrapper.n2-ss-scrollbar-light .thumb{background-color:#fff}#n2-ss-zoom{width:280px;text-align:center;vertical-align:middle}#n2-ss-zoom .n2-ss-slider-zoom-container{position:relative;display:inline-block;vertical-align:middle;width:150px;height:34px;padding:0 23px}#n2-ss-zoom .n2-ss-slider-zoom-container>.n2-i{position:absolute;top:9px;color:#6b7986;font-size:16px}#n2-ss-zoom .n2-ss-slider-zoom-container .n2-i-minus{left:-18px}#n2-ss-zoom .n2-ss-slider-zoom-container .n2-i-plus{right:-18px}.n2-ss-slider-zoom-bg{position:absolute;left:0;top:50%;margin-top:-3px;width:100%;background:#505c69;height:6px;border-radius:3px}#n2-ss-slider-zoom{height:100%;position:relative;margin:0;background:0 0;border:none;border-radius:0}#n2-ss-slider-zoom .nui-slider-range{display:none}#n2-ss-slider-zoom .nui-slider-handle{position:absolute;top:50%;display:block;width:47px;height:22px;margin-top:-11px;margin-left:-23px;background-color:#e6eaee;background:#e6eaee;border:none;border-radius:3px;z-index:2;color:#7b8898;font-size:10px;text-align:center;line-height:22px;cursor:pointer}.n2-ss-slider-zoom-1{position:absolute;left:50%;top:0;margin-left:-1.5px;width:3px;height:100%;background-color:#6b7986}.n2-ss-device-zoomer{min-width:280px}.n2-ss-device-zoomer #n2-ss-zoom{padding:10px 0;background:#212d3a;margin:0 auto;display:none;border-bottom-left-radius:3px;border-bottom-right-radius:3px}.n2-ss-device-zoomer:HOVER #n2-ss-zoom{display:block}.n2-ss-device-zoomer .n2-ss-slider-zoom-1,.n2-ss-device-zoomer .n2-ss-slider-zoom-bg{background-color:#374d64}.n2-ss-device-zoomer #n2-ss-zoom .n2-ss-slider-zoom-container>.n2-i{color:#4e667f}.n2-ss-device-zoomer #n2-ss-slider-zoom .nui-slider-handle{background-color:#526a80;color:#fff}#n2-ss-devices{height:60px}#n2-ss-devices.n2-ss-devices-compact>.n2-controls-panel{width:260px}#n2-ss-devices .n2-table{font-size:32px;color:#80a3b5;margin:0 auto}.n2-lb-header #n2-ss-devices .n2-table{color:#a4b0b7}#n2-ss-devices .n2-td{height:60px;vertical-align:middle;text-align:center;padding:0 15px;cursor:pointer}#n2-ss-devices .n2-td.n2-active{cursor:default;color:#0c92df}.n2-i-devices:before{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATEAAAAeCAMAAABzNtkNAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACdlBMVEUAAAChrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrWhrrUZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeOhrrUZmeOhrrWhrrUZmeMZmeOhrrUZmeOhrrWhrrUZmeMZmeOhrrUZmeOhrrUZmeOhrrUZmeOhrrWhrrUZmeMZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrUZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrUZmeOhrrUZmeMAAAA99lBfAAAA0XRSTlMAJ6DHzCgytbY2MLMnoMfMKDK1tjYws5+ytLGfsrSxxh0ixh0il5qXmgY7a5SvvspsB2aHBjtrlK++ymwHZod+wiN+wiMSgbh6SiYQAnl9DBKBuHpKJhACeX0MNbmdQwQzNbmdQwQzRrtLAUa7SwHIpRWkyKUVpJgKUqLDnk2YClKiw55Nhq2KhIatioTLLlgOT8suWA5PcH9ZX3B/WV+sJcQqrqwlxCquKSmjXqNeV1eRiZGJCQmIiLq6AzQDNIK3SYK3SSQkCG2hCG2hsLA3NxRx1r0AAAABYktHRACIBR1IAAAACXBIWXMAAAsSAAALEgHS3X78AAAE0UlEQVRo3s2a+18UVRTAN/eYJLmHJCAjS4pehG4vQrcHhq0bCrFu6BKkRmq+JSNTpBQpVlnjEY+wtAglFIjeWmCWZb7t8Se109z57Mzcc+eBLrPnl7nn3DOP8/3MvXPPueNyWZSbprhBKO4pU9W+N0+jnFJuIS47PVXrlDrd6gPp5NYZHhSKZ0aa2ve2mZRT+u3EZTMytU6ZGZafKAsMJUvtewftk0Jcdpbe6c4JEstGQ8lW+95F+6QTl52td7rb8hO5wagX7tFopC9pBZijVnPA8DYG4kGjXrxXo5G+pBXxPrWai4a3MY9X0BvT7te/Ow+IiNm5jRETtN4b0x7UvzsPiYiJ9YfzHsmfO8/rnTc3/9G8x6jQHhcNySd4YryTiBjnJ5AnC54qnL/A51swv/Dpgmeo0J4VDcnneGK8k4gY58ckp2ih+rEXFj3PExPPYhQx4vTrIJZbvEj92IuKX+CJiWcxihhxug1i/sVegMCLJUuWlpYuXVJSFgDwvlRuKWSqyxYxY12W4DIfYujliuUrwuEVyysqQ4i+V6oshUx12SJG6tWvAqxctTpuX71qJcC015KFWM3riGvWrosb1q1dgzjzDceIrXfDho2btD2bNm4A9/rkILbZg1u2btPatm3dgp7NDhGrroU3t/O+298Cd3UyEKupw7d38GfueAc9NY4Q8wdg5y5ZLa3f3dDw7nvsddu1EwJ+54kFQ7hnr9wMN+5ranr/A/a67d2DoaATxJohwub40v3y1+oAQ1YegWbnibVglM3x4YPy1+pDhqwqii0OEMtp9bYxrR7c7R0d7W74iBnavK05ThPL7fR1sWYjerp7ero9+DEzdPk6cyefWC8cUrQs+EQ6fBpPEhdDr9PEDuMRpZmNn0mHz+NJ4jI8PPnE+uALReuHDunQAf2K5Sgcc5rYAH6pNAexRzr04KBiOY4nJp9YBI6KiQ05TyyKx8XEhp0g1gtFijYij8qv4qPyUDKMymKlOSqPyq/jo/KIE6MyNvMPMe0bZeavZ4ah5Jj5h1nzW2Xmb2SGYUdm/tjqok9ZXXwnry6+L5X18r7kWF0MKKuLH+TVxY9hWa8acGR18f8K9iRD1j7S37+7ngE7ya9gE1G7MCMmrWBPMWTdo4OD+xoZsFP8CjYRtQtCj2VJI1SWNAK12ixpvwjYT4nOkkapLGkU67RZ0kERsJ8TkImPlegz8ZIxLhM3kERn4uMV+ky8YpzLxA3khld7xqRqz+m4/bRU7Un5xSwUQ2I3sAZbMy5Ve87EDWekak/6r0ahmRK7vhqs/7dYRfFsGaso/l52FqC1SFtRtLkz0mw2cu0QcwX/iFUUz1WyiuKflecQO4u1FUWbOyMtZiPXhJjLdV5ftT6vO9XO7putvSQLTjG5oK9aX9A52Nl9s7WXJNYv5l3Kj0g7I5H8S3kXuVOnXq4V86q9rNnhVYVNN3nXhgZjYi7XlYKrhVFpZyRaeLXgCteddq1OzKvuWpogbLrJuzY1GcE2FTkscXAJIWZD5LDEwSU1MTMrgF+t+iebmJkVMahWgxMhZmGv7C967KYSrql6p4n+RaCKkZqnNfI3PXYzCddMvZP1vwjsEGs7RgGbRf2p8k9AB2yif6rYIdZ1ggI2m/pT5d+QDljGf3zSNGZGqKPpAAAAAElFTkSuQmCC)}.n2-i-devices-all:before{background-position:0 0}.n2-i-devices-desktop:before{background-position:-40px 0}.n2-i-devices-tablet:before{background-position:-80px 0}.n2-i-devices-phone:before{background-position:-120px 0}.n2-active>.n2-i-devices-all:before{background-position:-160px 0}.n2-active>.n2-i-devices-desktop:before{background-position:-200px 0}.n2-active>.n2-i-devices-tablet:before{background-position:-240px 0}.n2-active>.n2-i-devices-phone:before{background-position:-280px 0}.n2-generator-insert-variable .n2-variable-container{height:90px;overflow:auto}.n2-generator-insert-variable .n2-group-container{height:40px;overflow:auto}.n2-generator-insert-variable .n2-group-container .n2-button,.n2-generator-insert-variable .n2-variable-container .n2-button{margin:3px}.n2-generator-insert-variable .n2-group-container .n2-button.n2-active,.n2-generator-insert-variable .n2-variable-container .n2-button.n2-active,.n2-ss-layer-picker.n2-active{background:#0c92df}.n2-generator-result-container{height:100px;overflow:auto;margin:0 3px}.n2-ss-layer-picker{background:#6b7986;color:#fff;font-size:16px;height:28px;line-height:28px;padding:0;text-align:center;width:28px;border-radius:3px;margin:0 10px 10px;cursor:pointer}#n2-ss-toolbar #n2-ss-layer-parent-linker.n2-under-pick,.n2-ss-layer-picker.n2-under-pick{background-color:#51b82d}#n2-ss-layer-parent-linker.n2-under-pick .n2-i-layerlink:before,.n2-ss-layer-picker.n2-under-pick .n2-i-layerlink:before{content:"\e64b"}.n2-ss-picker-overlay,.n2-ss-picker-overlay-tile{position:absolute;left:0;top:0;background:RGBA(25,153,227,.8);cursor:pointer;width:100%;height:100%;z-index:1000000;box-shadow:inset 0 0 0 1px rgba(0,0,0,.4)}.n2-ss-picker-overlay-tile{width:33%;height:33%}.n2-ss-picker-overlay-tile:HOVER,.n2-ss-picker-overlay:HOVER{background:RGBA(42,52,63,.9)}.n2-ss-picker-overlay-tile.n2-active,.n2-ss-picker-overlay-tile.n2-active:HOVER{background:RGBA(0,52,63,.9)}#n2-ss-toolbar #n2-ss-layer-parent-linker{display:none}.n2-ss-has-layers .n2-ss-mode-desktopPortrait #n2-ss-toolbar #n2-ss-layer-parent-linker,.n2-ss-has-ruler .n2-ruler>span{display:inline-block}.n2-ss-layer.n2-ss-picking-on-layer{z-index:1000000!important}.n2-ruler-container{position:absolute;left:0;top:0;height:100%;width:100%;visibility:hidden;z-index:10}.n2-ruler-container>*{visibility:visible}.n2-ruler,.n2-ruler-guide{position:absolute;left:0;top:0}.n2-ruler{box-sizing:border-box;white-space:nowrap;direction:ltr}.n2-ruler>span{position:relative;display:none;vertical-align:top}.n2-ruler>span span{position:absolute;display:block;font-size:10px;color:#7b8898;line-height:10px}.n2-ruler-guide{display:none;z-index:2}.n2-ss-show-guides .n2-ruler-guide{display:block}.n2-ruler-guide .n2-ruler-guide-handle{position:absolute;background:#e6b625;left:0;top:0;width:9px;height:9px;cursor:pointer;font-family:'Nextend'!important;font-size:9px;color:#fff;line-height:9px;text-align:center}.n2-ruler-guide .n2-ruler-guide-handle:before{content:"\e90a"}.n2-ruler-horizontal{padding-left:1px;height:0;width:100%}.n2-ss-has-ruler .n2-ruler-horizontal{height:39px}.n2-ruler-horizontal>span.n2-ss-ruler-mark-large{height:20px}.n2-ruler-horizontal>span.n2-ss-ruler-mark-medium{height:10px}.n2-ruler-horizontal>span{width:9px;height:5px;border-right:1px solid #bcc4c8}.n2-ruler-horizontal span span{left:12px;top:10px}.n2-ruler-vertical .n2-ruler-guide{height:0;width:3000px}.n2-ss-lock-guides .n2-ruler-vertical .n2-ruler-guide{cursor:default}.n2-ruler-vertical .n2-ruler-guide .n2-ruler-guide-border{border-bottom:1px solid #ccaa2b;width:100%}.n2-ruler-vertical .n2-ruler-guide-handle{top:-4px}.n2-ruler-vertical{padding-top:1px;width:0;height:100%;background:#e9edf0;z-index:5}.n2-ss-has-ruler .n2-ruler-vertical{width:40px}.n2-ruler-vertical>span.n2-ss-ruler-mark-large{width:20px}.n2-ruler-vertical>span.n2-ss-ruler-mark-medium{width:10px}.n2-ruler-vertical>span{display:none;width:5px;height:9px;border-bottom:1px solid #bcc4c8}.n2-ss-has-ruler .n2-ruler-vertical>span{display:block}.n2-ruler-vertical span span{left:8px;top:12px}.n2-ruler-horizontal .n2-ruler-guide{width:0;height:3000px}.n2-ss-lock-guides .n2-ruler-horizontal .n2-ruler-guide{cursor:default}.n2-ruler-horizontal .n2-ruler-guide .n2-ruler-guide-border{border-right:1px solid #ccaa2b;height:100%}.n2-ruler-horizontal .n2-ruler-guide-handle{left:-4px}.n2-ruler-guide-handle{display:none}.n2-ss-has-ruler .n2-ruler-guide-handle{display:block}
1
+ #html-body header,.adminhtml-smartslider3-index #footer,.adminhtml-smartslider3-index .footer,.n2-ss-live-preview.n2-active .n2-button,.smartslider3-index-index footer{display:none}#html-body #anchor-content #n2-admin{mragin-top:30px}#html-body .header{position:relative;z-index:1100}.n2-lightbox-sidebar-list{overflow-y:auto}#n2-tab-widgets{border-bottom:0;margin-bottom:1000px}.n2-i-edit.n2-active{color:#0c92df}.n2-ss-live-preview span{text-decoration:line-through;vertical-align:middle}.n2-ss-live-preview .n2-button,.n2-widget-area{vertical-align:middle;margin:0 20px}.n2-ss-live-preview.n2-active span{text-decoration:none}.n2-widget-area{display:inline-block;width:80px;height:80px;position:relative;margin:0 10px}.n2-form .n2-widget-area{margin-bottom:10px}.n2-widget-area-inner{position:absolute;top:14px;left:14px;width:46px;height:46px;border:3px solid #bbc3cc;border-radius:3px}.n2-widget-area .n2-area{position:absolute;background-color:#a1aeb5;border-radius:2px;cursor:pointer;width:10px;height:10px;left:0;top:0}.n2-widget-area .n2-area.n2-active{background-color:#0c92df;cursor:default}.n2-widget-area .n2-area-1{left:35px}.n2-widget-area .n2-area-2{left:21px;top:21px}.n2-widget-area .n2-area-3{left:35px;top:21px}.n2-widget-area .n2-area-4{left:49px;top:21px}.n2-widget-area .n2-area-5{top:35px}.n2-widget-area .n2-area-6{left:21px;top:35px}.n2-widget-area .n2-area-7{left:49px;top:35px}.n2-widget-area .n2-area-8{left:70px;top:35px}.n2-widget-area .n2-area-9{left:21px;top:49px}.n2-widget-area .n2-area-10{left:35px;top:49px}.n2-widget-area .n2-area-11{left:49px;top:49px}.n2-widget-area .n2-area-12{left:35px;top:70px}.n2-ss-slider-publish{border-collapse:collapse;overflow:hidden}.n2-ss-slider-publish .n2-td{text-align:center;border-right:1px solid #ccd1d6;color:#6b7989;padding:48px 0 0}.n2-ss-slider-publish .n2-td .n2-h2 a{color:#6b7989}.n2-ss-slider-publish .n2-td.n2-last{border-right:0}.n2-ss-slider-publish div.n2-h2{line-height:30px;font-size:18px}.n2-ss-slider-publish div.n2-h4{line-height:26px}.n2-ss-slider-publish .n2-code{display:inline-block;padding:16px 30px;line-height:20px;border-radius:3px;background-color:#f5e293;text-align:left;margin:17px 0;color:#6f653f;font-size:12px;border:0;direction:ltr}.n2-ss-slider-publish img{margin-top:17px;margin-bottom:-10px}.n2-ss-generator-modal .n2-modal-content h3{text-align:left}.n2-generator-records td div{max-height:100px;overflow:hidden;padding:10px;margin:-10px}.n2-generator-records td:HOVER div{overflow-y:auto;overflow-x:visible}#n2-admin[data-autoplay='0'] #n2-form-matrix-sliderwidgets .n2-fm-autoplay,#n2-admin[data-autoplay='0'] #n2-form-matrix-sliderwidgets .n2-fm-indicator,#n2-admin[data-slider-type=block] .n2-fm-arrow,#n2-admin[data-slider-type=block] .n2-fm-autoplay,#n2-admin[data-slider-type=block] .n2-fm-bar,#n2-admin[data-slider-type=block] .n2-fm-bullet,#n2-admin[data-slider-type=block] .n2-fm-indicator,#n2-admin[data-slider-type=block] .n2-fm-slides,#n2-admin[data-slider-type=block] .n2-fm-thumbnail{display:none}.n2-ss-container-device{position:relative;background-color:#fff;border:1px solid #ccd1d6;border-width:0 1px;margin:40px auto 0}.n2-ss-create-slider-free-sample{float:left;height:70px;width:170px;cursor:pointer}.n2-ss-create-slider-free-sample:HOVER{background-position:0 -80px}.n2-ss-modal-subscribe>.n2-modal-window{text-align:center}.n2-ss-modal-subscribe .n2-form{margin:0 -20px}.n2-ss-modal-subscribe .n2-h3{margin:0 auto;width:95%;text-align:center;line-height:2}.n2-ss-preview-subscribe .n2-input-button{display:inline-block}.n2-input-button,.n2-ss-modal-subscribe .n2-input-button{display:inline-block;margin-top:20px}.n2-input-button>*,.n2-ss-modal-subscribe .n2-input-button>*,.n2-ss-preview-subscribe .n2-input-button>*{display:inline-block;white-space:nowrap;vertical-align:top}.n2-input-button input,.n2-input-button input:focus,.n2-ss-modal-subscribe input,.n2-ss-modal-subscribe input:focus,.n2-ss-preview-subscribe input,.n2-ss-preview-subscribe input:focus{margin:0 auto;width:250px;height:36px;border:2px solid #b9c3c9;border-right:0;border-top-left-radius:3px;border-bottom-left-radius:3px;border-top-right-radius:0;border-bottom-right-radius:0;overflow:hidden;padding:0 10px;line-height:36px;box-shadow:none;color:#7b8898;font-size:12px;background:#fff;box-sizing:border-box}.n2-input-button .n2-button,.n2-ss-modal-subscribe .n2-input-button .n2-button,.n2-ss-preview-subscribe .n2-input-button .n2-button{border-top-left-radius:0;border-bottom-left-radius:0}.n2-ss-preview-subscribe{position:fixed;left:50%;margin-left:-500px;bottom:-100px;transition:bottom .5s ease;background:url(../images/free/subscribepreview.png);width:1000px;height:90px;z-index:1000}.n2-ss-preview-subscribe.n2-active{bottom:10px}.n2-ss-preview-subscribe-close{position:absolute;top:-12px;right:-12px;width:24px;height:24px;cursor:pointer;background:url(../images/free/close.png) no-repeat center center}.n2-ss-preview-subscribe .n2-input-button{position:absolute;right:20px;top:0;margin-top:28px}#n2-ss-edit-group-form>.n2-form>.n2-form-tab,#n2-ss-edit-slider-form>.n2-form>.n2-form-tab{margin:20px 0 0;border-radius:0;border:0}#n2-ss-edit-group-form>.n2-form>.n2-form-tab .n2-form-matrix-views,#n2-ss-edit-slider-form>.n2-form>.n2-form-tab .n2-form-matrix-views{border-radius:0}#n2-ss-slider-container[data-groupid="0"] .n2-ss-remove-from-group,.n2-ss-box-slider-group .n2-ss-add-to-group,.n2-ss-box-slider-group .n2-ss-remove-from-group,body[data-slides='0'] #n2-ss-edit-slider-form,body[data-ss3-activated="0"] [data-ss3-when-activated="1"]{display:none}#n2-ss-slider-container,#n2-ss-slides{position:relative;padding:25px}.n2-ss-sliders .n2-box-new-slider>a:before{content:"\e952"}.n2-ss-sliders .n2-box-template-library>a:before{content:"\e951"}.n2-box-up-group>a:before{content:"\e958"}.n2-box-insert-group>a:before{content:"\e959"}.n2-ss-sliders-header>*{margin:0 10px;vertical-align:top}html[data-sliders='0'] .n2-ss-sliders-header{visibility:hidden}.n2-ss-box-slider{cursor:pointer}.n2-ss-slides-outer-container{display:block}.n2-modal-window .n2-ss-slides-outer-container{height:100%;overflow:auto}.n2-ss-slides-container{position:relative;margin:0 -10px}.n2-slide-first.n2-i{line-height:16px}.n2-slide-first.n2-i,.n2-slide-published{font-size:16px;padding:3px}.n2-i-unpublished{color:#c54633}.n2-slide-state-published .n2-i-unpublished{color:#6fbc49}.n2-slide-state-published .n2-i-unpublished:before{content:"\e60c"}.n2-box-slide.n2-slide-state-published{opacity:1}.n2-box-slide{opacity:.5}.n2-box.n2-first-slide:HOVER .n2-slide-first,.n2-slide-first,.n2-slide-is-first{display:none}.n2-first-slide .n2-slide-is-first{display:inline-block}.n2-slide-duplicate{margin-right:5px}.n2-slide-delete,.n2-slide-duplicate,.n2-slide-selected{padding:0;width:24px}#n2-ss-slides .n2-box.n2-ss-slide-active{box-shadow:0 0 0 3px #0c92df}#n2-ss-slides .n2-box-slide-drag-images,#n2-ss-slides .n2-box-slide-dummy{text-align:center;color:#7b8898;box-sizing:border-box;border:2px dashed #b2bfc9}#n2-ss-slides .n2-box-slide-dummy{background:#e9edf0;background-image:url(../images/dummy-slide.png);background-repeat:no-repeat;background-position:center 36px;font-size:14px;line-height:200px}#n2-ss-slides .n2-box-slide-drag-images{background:url(../images/drag.png) no-repeat center 4px;padding:90px 60px 0;line-height:12px;box-shadow:none}body:not([data-slides='0']) #n2-ss-slides .n2-box-dummy,body:not([data-slides='0']) #n2-ss-slides-container .n2-box-slide-drag-images,body:not([data-slides='0']) #n2-ss-slides-container .n2-box-slide-dummy{display:none}.n2-ss-slides-control{position:relative;padding:22px 10px;border-bottom:1px solid RGBA(0,0,0,.3)}.n2-ss-slides-control .n2-button{margin:0 10px}.n2-slides-add{vertical-align:bottom;margin:-2px}#n2-ss-slides .n2-box-slide-drag-upload{display:none;position:absolute;z-index:101;left:0;top:0;width:100%;height:100%;background-color:rgba(32,41,52,.9);border:0;right:0;bottom:0;margin:0;vertical-align:bottom;line-height:130px;text-align:center;color:#fff}#n2-ss-slides .n2-drag-over .n2-box-slide-drag-upload{display:block}.n2-box-slide .n2-button.n2-sidebar-list-bg:HOVER{background-color:#0c92df}.n2-ss-quick-slides-edit-modal .n2-modal-content table{border-spacing:10px;border-collapse:separate;margin:10px auto}.n2-ss-quick-slides-edit-modal .n2-modal-content table td{padding:0}.n2-ss-quick-slides-edit-modal .n2-modal-content .n2-mixed-label{margin-top:0;margin-bottom:3px}.n2-ss-quick-slides-edit-modal .n2-modal-content .n2-mixed-label label{font-size:11px}.n2-slide-state-first [data-action=setFirst],.n2-slide-state-published [data-action=publish],[data-action=generator],[data-action=unpublish]{display:none}.n2-slide-state-has-generator [data-action=generator],.n2-slide-state-published [data-action=unpublish]{display:block}.n2-box-slide .n2-i-star{display:none}.n2-box-slide.n2-slide-state-first .n2-i-star{display:inline;color:#e19f21;font-size:16px}#n2-ss-slides .n2-box:HOVER img{opacity:.1}.n2-ss-slides-header{position:relative;z-index:9;color:#6b7989;margin:14px 0 4px}.n2-ss-bulk-controls{visibility:hidden}.n2-ss-has-box-selection .n2-ss-bulk-controls{visibility:visible}.n2-ss-slides-header .n2-button-menu-open .n2-button-menu{right:-90px}#n2-ss-slides .n2-box-slide-add{display:inline-block;color:#b2bfc9;background:0 0;text-align:center;z-index:5}#n2-ss-slides .n2-box-slide-add>.n2-ss-add-slide-button{width:100%;height:135px;padding:0}#n2-ss-slides .n2-box-slide-add>.n2-ss-add-slide-button:before{display:block;font-family:'Nextend'!important;font-size:48px;line-height:68px;content:"\e981";margin-top:20px}.n2-ss-slides-header>*{vertical-align:top;display:inline-block}.n2-ss-slides-header .n2-h5,.n2-ss-slides-header .n2-h5 a{margin-right:10px;color:#6b7986}.n2-ss-slides-header .n2-h5 .n2-i{font-size:16px}.n2-top-bar-menu .n2-ss-back-dashboard:before{content:"\e94a"}.n2-top-bar-menu .n2-ss-back-slider:before{content:"\e94b"}.n2-top-bar-menu .n2-ss-back-slides:before{content:"\e91a"}.n2-top-bar-menu>#n2-ss-preview:before{content:"\e92d"}.n2-ss-block-slides-notice{display:none;color:#606d7b;background:#fff;margin-top:25px;padding:10px 15px;border-radius:5px}.n2-ss-block-slides-notice p{margin:0 0 10px}body:not([data-slides='0']):not([data-slides='1']) #n2-admin[data-slider-type=block] .n2-ss-block-slides-notice{display:inline-block}#n2-ss-slides .n2-box-slide-add .n2-ss-add-slide-button:before{transition:transform .4s}#n2-ss-slides .n2-box-slide-add .n2-ss-add-slide-button{transition:background .4s}#n2-ss-slides[data-showcreateslide="1"] .n2-box-slide-add .n2-ss-add-slide-button{background:#6b7986}#n2-ss-slides[data-showcreateslide="1"] .n2-box-slide-add .n2-ss-add-slide-button:before{transform:rotateZ(45deg)}#n2-ss-slides .n2-ss-slides-create{position:relative;background:#202934;margin:-25px -26px 0;height:0;overflow:hidden;transition:height .4s}#n2-ss-slides .n2-ss-slides-create>div{padding:15px 16px}#n2-ss-slides[data-showcreateslide="1"] .n2-ss-slides-create{height:198px}#n2-ss-slides .n2-ss-slides-create-heading{font-size:22px;line-height:38px;color:#fff;margin:0 10px}#n2-ss-slides .n2-ss-slides-create-inner{display:flex}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box{display:flex;flex-flow:column;justify-content:center;max-width:140px;width:140px;height:110px;text-align:center;color:#80a3b5;cursor:pointer;border-radius:5px;margin:10px}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box-label{font-size:14px;margin-top:3px}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box[data-action=image]{background:#51b82d;color:#fff}#n2-ss-slides .n2-ss-slides-create .n2-ss-slides-create-action-box[data-action=library]{background:#5f39c2;color:#fff}.n2-ss-slides-create-action-box-icon{font-size:48px}div#n2-ss-0:HOVER .n2-ss-static-slide{display:none}div#n2-ss-0:HOVER .n2-ss-static-slide.n2-ss-currently-edited-slide{display:flex}.n2-ss-select-layer-mode #n2-ss-0 .n2-ss-layer-selected .n2-ss-layer-cc,.n2-ss-select-layer-mode #n2-ss-0 .n2-ss-layer-selected .nui-normal-sizing-handle,.n2-ss-select-layer-mode #n2-ss-0 .n2-ss-layer-selected .nui-resizable-handle{display:none!important}.n2-ss-select-layer-mode-group .n2-list li.n2-ss-layerlist-row.n2-active.n2-selected{color:#b2bfc9}#n2-ss-0 .n2-ss-layer{cursor:not-allowed}#n2-ss-0 .n2-ss-currently-edited-slide .n2-ss-layer{cursor:move}.n2-ss-currently-edited-slide .n2-ss-layer{background:RGBA(0,0,0,0)}#n2-ss-0 .n2-ss-currently-edited-slide .n2-ss-layer[data-sstype=col],#n2-ss-0 .n2-ss-currently-edited-slide .n2-ss-layer[data-sstype=col] .n2-ss-layer{cursor:pointer}#n2-ss-0 .n2-ss-slide.n2-ss-slide-active .n2-ss-layer.n2-ss-layer-locked,#n2-ss-0 .n2-ss-static-slide .n2-ss-layer.n2-ss-layer-locked{cursor:auto}.n2-ss-preview-mode #n2-ss-0 .n2-ss-layer{cursor:default}#n2-ss-0 .n2-ss-slide.n2-ss-slide-active .n2-ss-layer.n2-ss-layer-locked .n2-ss-layer-cc,#n2-ss-0 .n2-ss-static-slide .n2-ss-layer.n2-ss-layer-locked .n2-ss-layer-cc,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .n2-ss-layer-cc,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .n2-ss-layer-chain-parent,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .nui-normal-sizing-handle,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .nui-resizable-handle,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer-highlight,.n2-ss-preview-mode #n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer-selected .n2-ss-item-overlay{display:none!important}.n2-grid{background:#4affff;position:absolute;left:0;top:0;z-index:1000000;display:none}.n2-grid-h{width:100%;height:1px}.n2-grid-v{height:100%;width:1px}.n2-ss-edit-slide-top{background:#fff;border-bottom:1px solid #ccd1d6;padding:30px 20px 30px 40px;display:flex;flex-wrap:nowrap;justify-content:space-between;flex-flow:row}.n2-ss-edit-slide-top-thumbnail{width:200px;height:135px;cursor:pointer}.n2-ss-edit-slide-top-thumbnail img{width:200px;height:135px;border-radius:5px}.n2-ss-edit-slide-top-actions{width:180px;text-align:left;vertical-align:middle;flex:1}.n2-ss-edit-slide-top-actions>*{margin:10px 0}.n2-ss-edit-slide-top-details{flex:1;align-self:flex-end;padding:0 20px}.n2-slider-name .n2-h1,.n2-ss-edit-slide-top-details .n2-h1{color:#606d7b;margin-bottom:15px;cursor:pointer;line-height:30px}[dir=ltr] .n2-slider-name .n2-h1:HOVER:after,[dir=ltr] .n2-ss-edit-slide-top-details .n2-h1:HOVER:after,[dir=rtl] .n2-slider-name .n2-h1:HOVER:before,[dir=rtl] .n2-ss-edit-slide-top-details .n2-h1:HOVER:before{font-family:'Nextend'!important;content:"\e94f";font-size:22px;vertical-align:top;margin:0 5px;color:#b0b9bf}body[data-slides="0"] .n2-slider-name .n2-h1{cursor:default}body[data-slides="0"] .n2-slider-name .n2-h1:HOVER:after{display:none}.n2-ss-edit-slide-top-details .n2-h4 a{color:#7b8898}.n2-ss-edit-slide-top-details .n2-h4 a .n2-i{font-size:16px}.n2-ss-edit-slide-top-tabs{margin-top:15px}.n2-ss-edit-slide-top-tabs a{margin:0}.n2-ss-edit-slide-top-tabs a.n2-active{color:#fff;background-color:#0c92df;border-color:#0c92df}.n2-ss-edit-slide-top-tabs .n2-button{border-radius:0;border-left:0;padding:0 20px}.n2-ss-edit-slide-top-tabs .n2-button.n2-first{border-top-left-radius:3px;border-bottom-left-radius:3px;border-left:2px solid #e0e6ed}[dir=rtl] .n2-ss-edit-slide-top-tabs .n2-button.n2-first{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;border-right:2px solid #e0e6ed}.n2-ss-edit-slide-top-tabs .n2-button.n2-last,[dir=rtl] .n2-ss-edit-slide-top-tabs .n2-button.n2-first{border-top-right-radius:3px;border-bottom-right-radius:3px}[dir=rtl] .n2-ss-edit-slide-top-tabs .n2-button.n2-last{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:3px;border-bottom-left-radius:3px;border-left:2px solid #e0e6ed}.n2-ss-edit-slide-top-tabs .n2-button.n2-active{background:#0c92df;color:#fff;border-color:#0c92df!important}.n2-ss-edit-slide-top-tabs .n2-button.n2-active:not(.n2-first){border-left:2px solid #0c92df;margin-left:-2px}#n2-form-matrix-slide-settings{margin:0;border:0;border-radius:0}.n2-ss-slider-real-container{position:relative}.n2-ss-slider-outer-container{position:relative;padding:40px 0 0 40px}.n2-ss-canvas-slider-container{padding-bottom:99px;margin:10px}.n2-ss-has-ruler .n2-ss-canvas-slider-container{margin:0}#n2-ss-0-align{margin:0!important}.n2-i-desktopPortrait:before{content:'\e925'}.n2-i-desktopLandscape:before{content:'\e95a'}.n2-i-tabletPortrait:before{content:'\e928'}.n2-i-tabletLandscape:before{content:'\e927'}.n2-i-mobilePortrait:before{content:'\e92a'}.n2-i-mobileLandscape:before{content:'\e929'}#n2-tab-basiccsspreset{background-color:#3c4958;z-index:3}#n2-tab-basiccsspreset>.n2-h2{margin-bottom:0}.n2-basiccss-show-preset-list .n2-editor-header .n2-ss-button-container>.n2-basiccss-choose,.n2-editor-header .n2-ss-button-container>.n2-basiccss-back{display:none}.n2-basiccss-show-preset-list .n2-editor-header .n2-ss-button-container>.n2-basiccss-back{display:inline-block}.n2-ss-preview-modal .n2-modal-window{background-color:#e9edf0}#n2-admin.n2-ss-mode-desktopPortrait .n2-ss-responsive-helper,.n2-ss-background-type-color .n2-ss-background-video-param,.n2-ss-background-type-color .n2-ss-slide-background-image-param,.n2-ss-background-type-gradient .n2-ss-background-video-param,.n2-ss-background-type-gradient .n2-ss-slide-background-image-param,.n2-ss-background-type-image .n2-ss-background-video-param:not(.n2-ss-slide-background-image-param),body[data-editormode=content] #n2-admin .n2-ss-responsive-helper{display:none}#n2-tab-animations-events td.n2-label{padding:0}#n2-tab-animations-events td.n2-element{padding:6px 0}.n2-ss-editor-window-notice{padding:8px 10px;line-height:18px;background:#6b7986;color:#fff}.n2-ss-editor-window-notice a{color:#ffb527}#n2-ss-slide-edit-slides{display:none;border-bottom:1px solid #e0e6ed}.n2-ss-show-slides #n2-ss-slide-edit-slides{display:block}.n2-ss-show-slides a.n2-ss-back-slides,.n2-ss-show-slides a.n2-ss-back-slides:before{color:#fff}.n2-ss-columns-element{background:#28313a}.n2-ss-columns-element-add-col{vertical-align:top;display:inline-block;background:#51b82d;width:28px;height:28px;border-radius:3px;margin:8px 0;cursor:pointer;text-align:center;color:#fff;font-size:16px}.n2-ss-columns-element-add-col .n2-i,.n2-ss-columns-element-container .n2-ss-columns-element-handle .n2-i{line-height:28px}.n2-ss-columns-element-container{vertical-align:top;position:relative;width:300px;display:inline-flex;padding:8px;box-sizing:border-box;overflow:hidden}.n2-ss-columns-element-container>.n2-ss-columns-element-column{position:relative;flex:0 0 auto;background:#51b82d;height:28px;line-height:28px;width:25%;color:#fff;text-align:center;overflow:hidden;cursor:move;border-radius:3px;min-width:5px}.n2-ss-columns-element-container .n2-ss-columns-element-handle{display:block;width:11px;height:28px;background:#202934;flex:0 0 11px;border-radius:3px;margin:0 2px;cursor:ew-resize;color:#9aa7b2;text-align:center}.n2-ss-columns-element-container.n2-sortable-currently-sorted .n2-ss-columns-element-handle{display:none}.n2-ss-columns-element-container.n2-sortable-currently-sorted .n2-ss-columns-element-column{margin-right:15px}.n2-ss-columns-element-container.n2-sortable-currently-sorted .n2-ss-columns-element-column:last-child{margin-right:0}.n2-ss-section-main-content{min-height:20px}#n2-ss-0 .n2-ss-slide{opacity:.3}#n2-ss-0 .n2-ss-slide.n2-ss-currently-edited-slide{opacity:1}.n2-form-element-style-mode{display:flex;background:#28313a;padding:10px;border:1px solid #20282f;border-width:1px 0;margin-bottom:-1px;align-items:center}.n2-form-element-style-mode-reset{margin:0 10px 0 auto}.n2-form-element-style-mode .n2-form-element-radio-tab{height:24px;line-height:24px;margin:0}.n2-form-element-style-mode .n2-form-element-radio-tab .n2-radio-option{background:#6b7986;color:#fff;font-size:11px}.n2-form-element-style-mode .n2-form-element-radio-tab .n2-radio-option.n2-active{background:#0c92df}.n2-form-element-style-mode-label{display:inline-block;font-size:11px;color:#b2bfc9}#n2-ss-layer-window{z-index:100000;position:fixed;left:100px;top:100px;width:355px}#n2-ss-layer-window.n2-ss-layer-window-minized .n2-ss-layer-window-resizer,.n2-ss-has-layers.n2-ss-layer-edit-visible.n2-ss-preview-mode #n2-ss-layer-window,.n2-ss-layer-edit-visible.n2-ss-move-layer #n2-ss-layer-window,.n2-ss-layer-edit-visible.n2-ss-resize-layer #n2-ss-layer-window,body:not(.n2-ss-has-layers) #n2-ss-layer-window,body:not(.n2-ss-layer-edit-visible) #n2-ss-layer-window{display:none}#n2-ss-layer-window.n2-ss-layer-window-minized{height:30px!important}#n2-ss-layer-window.n2-ss-layer-window-minized .n2-i-minimize:before{content:'\e915'}#n2-ss-layer-window .n2-ss-layer-window-actions{display:none;position:absolute;top:0;left:-35px;width:32px;background-color:#202934;border-radius:3px}#n2-ss-layer-window .n2-ss-layer-window-actions>.n2-button{width:32px;height:32px;line-height:32px;color:#b0bdc7}#n2-ss-layer-window .n2-ss-layer-window-resizer{height:7px;width:100%;cursor:ns-resize;text-align:center;color:#95a1ab;bottom:0;background:#202934;border-bottom-left-radius:5px;border-bottom-right-radius:5px}#n2-ss-layer-window .n2-ss-layer-window-crop{position:relative;width:100%;height:100%;border-radius:3px;box-shadow:0 1px 10px RGBA(0,0,0,.5);overflow:hidden;background:#3c4958;z-index:2}.n2-ss-layer-window-title{position:relative;line-height:60px;height:60px;overflow:hidden;background:#202934;font-size:12px;color:#cbd6df;text-align:left}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav{position:absolute;top:0;line-height:30px;height:30px;margin:0 5px}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav-left{left:0}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav-right{right:0}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav>*{display:inline-block;width:20px;height:30px;line-height:30px;font-size:16px;color:#fff;padding:0;vertical-align:top;text-align:center}.n2-ss-layer-window-title .n2-ss-layer-window-title-nav .n2-i{vertical-align:middle}.n2-ss-layer-window-title .n2-ss-layer-window-title span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0 60px;text-align:center}.n2-ss-layer-window-breadcrumb{display:none;height:22px;font-size:11px;color:#b2bfc9;background-color:#202934;border-bottom:1px solid #1a2028;text-transform:uppercase;padding:0 5px}.n2-ss-layer-window-breadcrumb.n2-has-breadcrumb{display:block}.n2-ss-layer-window-breadcrumb *{display:inline-block;height:22px;vertical-align:top;line-height:22px}.n2-window-title-structure-nav span{padding:0 5px;cursor:pointer}.n2-window-title-structure-nav .n2-i-mini-arrow-thin{font-size:16px;padding:0}.n2-window-title-structure-nav:last-child{color:#fff}.n2-window-title-structure-nav:last-child .n2-i-mini-arrow-thin{display:none}#n2-tabbed-slide-editor-settings .n2-tabs{position:relative;overflow-y:auto;overflow-x:hidden}#n2-ss-layer-window table,#n2-ss-layer-window tbody,#n2-ss-layer-window tr{display:block}#n2-ss-layer-window td{display:block;width:auto}#n2-ss-layer-window .n2-label{background:#3c4958;border-top:1px solid #303b47;padding:3px 10px 0}#n2-ss-layer-window .n2-empty-label{padding:0;height:9px}#n2-ss-layer-window .n2-empty-group-label{padding:0;height:0}#n2-ss-layer-window .n2-label label{color:#b2bfc9;font-size:10px}#n2-ss-layer-window .n2-element{background:#3c4958;border-top:0;padding:0}#n2-ss-layer-window textarea{max-width:290px!important;width:290px!important}#n2-ss-layer-window .n2-form-element-button{max-width:38px;overflow:hidden}#n2-ss-layer-window .n2-sidebar-row{line-height:34px;background:#28313a}#n2-ss-layer-window .n2-list li,#n2-ss-layer-window .n2-sidebar-row{border-bottom:1px solid RGBA(0,0,0,.2)}#n2-ss-layer-window .n2-button-m{height:24px;line-height:24px}#n2-ss-layer-window .n2-sidebar-tab-switcher{border:0;border-collapse:separate}#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td{font-size:11px;line-height:47px;height:47px;border:1px solid #1a2028;border-left:0;color:#b2bfc9}#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td .n2-i{font-size:32px;line-height:47px}#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td.n2-active{background:#0c92df;color:#fff}#n2-ss-layer-window .n2-has-underline>.n2-underline::after,#n2-ss-layer-window .n2-sidebar-tab-switcher .n2-td[data-tab=style]{display:none}#n2-ss-layer-window.n2-ss-has-design-option .n2-sidebar-tab-switcher .n2-td[data-tab=style]{display:table-cell}#n2-ss-layer-window .n2-ss-layer-window-title{line-height:30px;height:30px;cursor:move;border-top-left-radius:5px;border-top-right-radius:5px}#n2-ss-layer-window .n2-ss-layer-window-title .n2-ss-layer-window-title-inner{white-space:nowrap;margin:0 10px;text-align:center}#n2-ss-layer-window .ui-autocomplete{padding:0;max-height:200px;overflow-y:auto;overflow-x:hidden}#n2-ss-layer-window .n2-form-element-autocomplete .nui-autocomplete .nui-menu-item{padding-right:20px}#n2-ss-add-sidebar.n2-active .n2-ss-add-sidebar-inner>a,#n2-ss-layer-window .n2-ss-generator-param{display:none}.n2-ss-dynamic-slide #n2-ss-layer-window .n2-ss-generator-param{display:block}#n2-tabbed-animations-tabbed>.n2-table{border-spacing:8px;border-collapse:separate;background:#28313a;border-bottom:1px solid #20282f}#n2-tabbed-animations-tabbed .n2-sidebar-tab-switcher .n2-td{line-height:28px;height:28px;border:0;border-radius:50px}#n2-tabbed-animations-tabbed .n2-editor-header.n2-h2{background:#303b47;border-bottom:1px solid #28313a;position:relative}.n2-button-single-animation-play.n2-active .n2-i:before{content:'\e607'}.n2-ss3-layeranimation-presets-groups{display:flex;flex-wrap:wrap;background:#3c4858;padding:10px;text-align:center;color:#fff;border-bottom:1px solid #283039}.n2-ss3-layeranimation-presets-groups>div{flex:1 1 auto;min-width:60px}.n2-ss3-layeranimation-presets-group{margin:5px;background:#6b7886;border-radius:3px;display:flex;justify-content:flex-end;flex-flow:column;height:65px;cursor:pointer}.n2-ss3-layeranimation-presets-group.n2-active{background:#0c92df}.n2-ss3-layeranimation-presets-group i{font-size:24px;margin-bottom:4px}.n2-ss3-layeranimation-presets-group div{margin-bottom:8px}#n2-ss-add-sidebar{background:#212d3a;position:absolute;left:-1px;top:54px;bottom:-1px;width:50px;text-align:center}[dir=rtl] #n2-ss-add-sidebar{right:-1px;left:auto}#n2-ss-add-sidebar .n2-ss-add-sidebar-inner{position:relative;padding-top:.1px}#n2-ss-add-sidebar .n2-ss-add-sidebar-inner>*{margin-top:10px;color:#80a3b5}#n2-ss-add-sidebar .n2-ss-add-sidebar-inner>.n2-button-blue,.n2-ss-theme-dark .n2-ruler>span span{color:#fff}#n2-ss-add-sidebar.n2-active .n2-ss-add-sidebar-inner>*{margin-top:0}#n2-ss-add-sidebar.n2-active{width:341px;z-index:1010}#n2-ss-add-sidebar.n2-active .n2-ss-add-layer-button{margin:0;background:0 0;position:absolute;top:16px;right:5px}#n2-ss-add-sidebar.n2-active .n2-ss-add-layer-button .n2-i:before{content:"\e90a";color:#b2bfc9}#n2-ss-add-sidebar.n2-active .n2-ss-add-sidebar-inner{width:341px!important}#n2-ss-add-sidebar.n2-active .n2-ss-available-layers{display:block}.n2-ss-available-layers .n2-sidebar-tab-switcher{border:0}.n2-ss-available-layers-container{width:300px;margin:0 auto;padding:10px 0 90px}.n2-ss-slide-item-group{color:#b2bfc9;padding:4px 5px 1px}.n2-ss-addlayer .n2-ss-available-layers{display:none;box-sizing:border-box;white-space:normal;text-align:left}.n2-ss-core-item{display:inline-block;margin:5px;background-color:#6b7986;color:#fff;line-height:15px;cursor:pointer;text-align:center;border-radius:3px;width:90px;min-height:73px;z-index:1000;vertical-align:top}.n2-ss-core-item-title{display:flex;align-items:center;justify-content:center;height:34px}.n2-ss-core-item:before{font-family:'Nextend';font-size:32px;content:"\e943";display:block;line-height:32px;margin-top:14px}.n2-ss-core-item[data-item=heading]:before{content:"\e945"}.n2-ss-core-item[data-item=highlightedHeading]:before{content:"\e990"}.n2-ss-core-item[data-item=animatedHeading]:before{content:"\e991"}.n2-ss-core-item[data-item=text]:before{content:"\e944"}.n2-ss-core-item[data-item=button]:before{content:"\e942"}.n2-ss-core-item[data-item=imagearea]:before{content:"\e950"}.n2-ss-core-item[data-item=icon2]:before,.n2-ss-core-item[data-item=icon]:before{content:"\e941"}.n2-ss-core-item[data-item=input]:before{content:"\e939"}.n2-ss-core-item[data-item=iframe]:before{content:"\e938"}.n2-ss-core-item[data-item=area]:before{content:"\e937"}.n2-ss-core-item[data-item=list]:before{content:"\e93e"}.n2-ss-core-item[data-item=caption]:before{content:"\e940"}.n2-ss-core-item[data-item=transition]:before{content:"\e93f"}.n2-ss-core-item[data-item=youtube]:before{content:"\e93d"}.n2-ss-core-item[data-item=vimeo]:before{content:"\e93c"}.n2-ss-core-item[data-item=video]:before{content:"\e93b"}.n2-ss-core-item[data-item=html]:before{content:"\e93a"}.n2-ss-core-item[data-item=progressbar]:before{content:"\e982"}.n2-ss-core-item[data-item=imagebox]:before{content:"\e983"}.n2-ss-core-item[data-item=counter]:before{content:"\e984"}.n2-ss-core-item[data-item=circlecounter]:before{content:"\e985"}.n2-ss-core-item[data-item=audio]:before{content:"\e986"}.n2-ss-core-item[data-item=structure]:before{font-size:74px;margin-top:24px}.n2-ss-core-item[data-item=structure][data-sstype="1col"]:before{content:"\e967"}.n2-ss-core-item[data-item=structure][data-sstype="2col"]:before{content:"\e966"}.n2-ss-core-item[data-item=structure][data-sstype="3col"]:before{content:"\e961"}.n2-ss-core-item[data-item=structure][data-sstype="4col"]:before{content:"\e95f"}.n2-ss-core-item[data-item=structure][data-sstype="2col-60-40"]:before{content:"\e965"}.n2-ss-core-item[data-item=structure][data-sstype="2col-40-60"]:before{content:"\e964"}.n2-ss-core-item[data-item=structure][data-sstype="2col-80-20"]:before{content:"\e963"}.n2-ss-core-item[data-item=structure][data-sstype="2col-20-80"]:before{content:"\e962"}.n2-ss-core-item[data-item=structure][data-sstype="3col-20-60-20"]:before{content:"\e960"}.n2-ss-core-item[data-item=structure][data-sstype=special]:before{content:"\e95d"}#n2-ss-toolbar{z-index:9;position:relative;height:28px;line-height:28px;background:#f2f5fa;white-space:nowrap;padding:13px 10px}.n2-ss-slider-visible #n2-ss-slide-canvas-container #n2-ss-toolbar{height:auto}#n2-ss-slide-canvas-container.n2-scroll-disable #n2-ss-toolbar{height:28px;border-bottom:0}#n2-ss-toolbar>*{line-height:28px;height:28px;vertical-align:top;display:inline-block}#n2-ss-toolbar .n2-ss-tool{margin:0 5px;display:inline-block;vertical-align:top!important}#n2-ss-toolbar .n2-ss-tool.n2-form-element-text{height:24px;line-height:24px;position:relative}#n2-ss-toolbar .n2-text-sub-label{font-size:16px}#n2-ss-layer-list>.n2-list>li li,.n2-ss-theme-dark #n2-ss-slide-canvas-container-inner,.n2-ss-theme-dark .n2-ruler-vertical{background-color:#28313a}.n2-ss-preview-mode .n2-main-top-bar{opacity:0}#n2-ss-slide-canvas-settings{display:inline-block;position:relative}#n2-ss-slide-canvas-settings>.n2-button{width:28px;padding:0;text-align:center}#n2-ss-slide-canvas-settings.n2-active>.n2-button{background-color:#0c92df;border-color:#0c92df}#n2-ss-slide-canvas-settings .n2-ss-settings-panel{position:absolute;left:0;top:28px}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner{margin-top:6px;min-width:180px;box-shadow:0 0 5px 0 RGBA(0,0,0,.3);background-color:#fff;border-radius:3px}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner>*{display:block;line-height:32px;margin:0 10px;position:relative;text-align:left}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner a{color:#7b8898}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-panel-action{color:#0c92df}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-tick{display:block;position:absolute;right:0;top:8px;border-radius:3px;border:2px solid #8793a2;width:12px;height:12px}#n2-ss-layer-show-on,#n2-ss-slide-canvas-settings.n2-active .n2-ss-settings-panel{display:inline-block}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-enabled .n2-setting-tick{border-color:#1999e3;background-color:#1999e3}#n2-ss-slide-canvas-settings .n2-ss-settings-panel,#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-tick .n2-i{display:none}#n2-ss-slide-canvas-settings .n2-ss-settings-panel-inner .n2-setting-enabled .n2-i{display:inline-block;color:#fff;font-size:16px;line-height:12px;margin:0 -2px}#n2-ss-toolbar .n2-button-grey{background-color:#a1aeb5}#n2-ss-toolbar .n2-radio-option{background-color:#a1aeb5;border-left:1px solid #8c99a1}#n2-ss-toolbar .n2-radio-option.n2-first{border-left-width:0}#n2-ss-toolbar .n2-radio-option.n2-active{background-color:#0c92df;border-color:#0c92df}#n2-ss-toolbar .n2-radio-option.n2-active[data-mode=canvas]{background-color:#5f39c2;border-color:#5f39c2}#n2-ss-toolbar .n2-radio-option.n2-sub-active{background-color:#51b82d;border-color:#51b82d}#n2-ss-toolbar .n2-ss-tool.n2-button{height:28px;line-height:28px;background-color:#a1aeb5}#n2-ss-toolbar .n2-ss-tool.n2-button-icon{padding:0;width:28px}#n2-ss-toolbar .n2-ss-tool.n2-button.n2-active{background-color:#0c92df}#n2-ss-toolbar .n2-ss-tool.n2-button.n2-sub-active{background-color:#51b82d}#n2-ss-toolbar .ui-autocomplete{max-width:100%}#n2-ss-layer-parent-linker,#n2-ss-theme,#n2-ss-toolbar #n2-ss-theme.n2-active{width:28px;height:28px;line-height:28px;padding:0;background-color:#a1aeb5}#n2-ss-theme.n2-active .n2-i:before{content:"\e64c"}#n2-ss-layer-list .n2-list .n2-ss-layerlist-row.n2-ss-ll-dragging-parent{background:#000}#n2-ss-layer-list>.n2-list>li{background-color:#303b47}#n2-ss-layer-list .n2-list>li{line-height:31px}#n2-ss-layer-list .n2-list .n2-ss-layerlist-row.n2-active,#n2-ss-layer-list .n2-list .n2-ss-layerlist-row.n2-selected,.n2-list .n2-ss-layerlist-row.n2-active,.n2-list .n2-ss-layerlist-row.n2-selected{background:#1681c1}#n2-ss-layer-list .n2-ss-layer-content-row .n2-list>li .n2-actions-left,#n2-ss-layer-list .n2-ss-layerlist-row-row .n2-list>li .n2-actions-left,#n2-ss-layer-list .n2-ss-layerlist-row.n2-ss-ll-dragging .n2-actions,#n2-ss-layer-list .n2-ss-layerlist-row.n2-ss-ll-dragging .n2-actions-left{display:none}#n2-ss-layer-list .n2-ss-layerlist-row.n2-ss-ll-dragging{position:absolute;left:0;width:100%;height:32px;overflow:hidden;opacity:.5}#n2-ss-layers .nextend-sortable-placeholder{border:0;position:relative;height:0;overflow:visible;z-index:1001}#n2-ss-layers .nextend-sortable-placeholder div{position:absolute;left:0;top:-1px;width:100%;height:0;box-shadow:0 0 0 2px #0c92df}#n2-ss-layers ul .nextend-sortable-placeholder div{margin-left:30px}#n2-ss-layers ul ul .nextend-sortable-placeholder div{margin-left:50px}#n2-ss-layers ul ul ul .nextend-sortable-placeholder div{margin-left:70px}#n2-ss-layers ul ul ul ul .nextend-sortable-placeholder div{margin-left:90px}#n2-ss-layers ul ul ul ul ul .nextend-sortable-placeholder div{margin-left:110px}#n2-ss-layers ul ul ul ul ul ul .nextend-sortable-placeholder div{margin-left:130px}#n2-ss-layers .n2-ui-sortable-helper{opacity:.5}#n2-ss-layers-table .n2-list li,.n2-list .n2-ss-layer-group-row{border-bottom:0}#n2-ss-layers-table .n2-ss-layer-title{border-bottom:1px solid RGBA(0,0,0,.2)}#n2-ss-layers-table .n2-active>.n2-ss-layer-title,#n2-ss-layers-table .n2-selected>.n2-ss-layer-title{border-color:#1681c1}.n2-ss-layer-group-row ul.n2-list{margin-top:-10px;padding-top:10px}.n2-ss-layer-title{display:block;line-height:31px;position:relative;cursor:pointer;overflow:hidden}.n2-ss-layer-title span{margin:0 30px;display:block;width:170px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.n2-ss-layer-group-row>.n2-ss-layer-title span,ul>li>.n2-ss-layer-title span{margin:0 30px}.n2-ss-layer-icon{position:absolute;top:2px}ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:3px}#n2-ss-layer-list>ul>li.n2-ss-layer-content-row>.n2-ss-layer-title span,#n2-ss-layer-list>ul>li.n2-ss-layer-row-row>.n2-ss-layer-title span,ul>li .n2-inline-form,ul>li>ul>li>.n2-ss-layer-title span{margin:0 50px}#n2-ss-layer-list>ul>li.n2-ss-layer-content-row>.n2-ss-layer-title .n2-ss-layer-icon,#n2-ss-layer-list>ul>li.n2-ss-layer-row-row>.n2-ss-layer-title .n2-ss-layer-icon,ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:23px}ul>li>ul>li>ul>li .n2-inline-form,ul>li>ul>li>ul>li>.n2-ss-layer-title span{margin:0 70px}ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:43px}ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title span,ul>li>ul>li>ul>li>ul>li>ul>li .n2-inline-form{margin:0 90px}ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:63px}ul>li>ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title span{margin:0 110px}ul>li>ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{left:83px}ul>li>ul>li>ul>li>ul>li>ul>li>ul>li .n2-ss-layer-title span{margin:0 130px}ul>li>ul>li>ul>li>ul>li>ul>li>ul>li .n2-ss-layer-title .n2-ss-layer-icon{left:103px}[dir=rtl] ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:3px;left:auto}[dir=rtl] #n2-ss-layer-list>ul>li.n2-ss-layer-content-row>.n2-ss-layer-title .n2-ss-layer-icon,[dir=rtl] #n2-ss-layer-list>ul>li.n2-ss-layer-row-row>.n2-ss-layer-title .n2-ss-layer-icon,[dir=rtl] ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:23px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:43px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:63px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>ul>li>ul>li>.n2-ss-layer-title .n2-ss-layer-icon{right:83px;left:auto}[dir=rtl] ul>li>ul>li>ul>li>ul>li>ul>li>ul>li .n2-ss-layer-title .n2-ss-layer-icon{right:103px;left:auto}.n2-ss-layerlist-row .n2-inline-form input{background:#3c4958 0 0;color:#b2bfc9;font-size:11px;border:2px solid #28313a;line-height:24px;padding:0 10px;border-radius:3px;margin:0}.n2-ss-layerlist-row .n2-inline-form input:focus{box-shadow:none}.n2-ss-layer-title .n2-actions{position:absolute;top:0;right:0;padding:0 6px;cursor:default;opacity:.2}.n2-active>.n2-ss-layer-title .n2-actions{opacity:1}.n2-ss-layer-title .n2-actions-left{position:absolute;top:0;left:0;padding:2px 0;cursor:default;line-height:24px}html[dir=rtl] .n2-ss-layer-title .n2-actions-left{right:0;left:auto}#n2-ss-layer-list .n2-ss-layerlist-row.n2-active>.n2-ss-layer-title,#n2-ss-layer-list .n2-ss-layerlist-row.n2-active>.n2-ss-layer-title .n2-i,#n2-ss-layer-list .n2-ss-layerlist-row.n2-selected .n2-ss-layer-title,#n2-ss-layer-list .n2-ss-layerlist-row.n2-selected .n2-ss-layer-title .n2-i{color:#fff}.n2-ss-layer-title .n2-actions a,.n2-ss-layer-title .n2-actions-left a{display:inline-block;padding:0}.n2-ss-layer-title .n2-actions-left i{padding:0 2px;vertical-align:middle}.n2-ss-layer-title .n2-i-order{cursor:move}.n2-ss-layer-status{display:inline-block;position:relative;margin:0 3px}#n2-ss-layer-list a .n2-i,#n2-ss-layer-list a:HOVER .n2-i{color:#b2bfc9}.n2-ss-layer-status-hidden .n2-ss-layer-status .n2-ss-sc-hide .n2-i:before{content:"\e923"}.n2-ss-layer-list-top-bar .n2-h2{display:inline-block;line-height:28px;color:#fff;padding:0 5px}.n2-ss-layer-list-opener{width:28px;display:inline-block;padding:0;vertical-align:top;margin:0 5px}#n2-ss-layers.n2-active .n2-ss-layer-list-opener>.n2-i:before{content:"\e92c"}.n2-closed .n2-i-col:before,.n2-closed .n2-i-row:before,.n2-ss-layer-list-group-opener.n2-closed .n2-i:before{content:"\e921"}#n2-ss-layers{position:fixed;bottom:0;width:340px;margin:0 -1px;height:48px;display:none;background-color:#28313a;z-index:1019}#n2-ss-layers.n2-active{height:100px}#n2-ss-layers:not(.n2-active){width:50px!important}#n2-ss-layers:not(.n2-active) .n2-ss-layers-sidebar{width:50px}#n2-ss-layers:not(.n2-active) .n2-ss-layer-list-layers-top-bar>div{display:none!important}.n2-ss-has-layers #n2-ss-layers{display:block}#n2-ss-layers-table .n2-td{position:relative;vertical-align:top}#n2-ss-layers-table .n2-ss-layers-sidebar{width:340px}.n2-ss-layer-list-top-bar{position:relative;padding:10px 5px 9px;height:28px;background-color:#212d3a;border-bottom:1px solid #20282f}#n2-ss-layers.n2-active .n2-ss-layer-list-layers-top-bar{cursor:ns-resize}.n2-ss-layer-list-bulk-top-bar,[data-component=layer] .n2-ss-select-layer-mode #n2-ss-layers.n2-active .n2-ss-layer-list-layers-top-bar{display:none}[data-component=layer] .n2-ss-select-layer-mode #n2-ss-layers.n2-active .n2-ss-layer-list-bulk-top-bar{display:block}.n2-ss-layer-list-top-bar .n2-form-element-text{margin:0}.n2-ss-layers-sidebar-rows{position:relative;height:100%;overflow-x:hidden;overflow-y:visible}#n2-ss-layers .n2-form-element-text{margin:0 10px;line-height:2px}#n2-ss-layers .n2-text-sub-label{width:30px;text-align:center;overflow:hidden}.n2-ss-layer-list-bulk-top-bar{text-align:right;color:#fff;vertical-align:top;padding:10px 15px 9px}.n2-ss-layer-list-bulk-top-bar .n2-button{vertical-align:middle}.n2-ss-layer-list-bulk-top-bar .n2-button+.n2-button,.n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control .n2-button{margin:0 0 0 5px}html[dir=rtl] .n2-ss-layer-list-top-bar .n2-button+.n2-button,html[dir=rtl] .n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control .n2-button{margin:0 5px 0 0}.n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control{position:absolute;top:10px;right:5px;margin:0 10px}html[dir=rtl] .n2-ss-layer-list-top-bar .n2-ss-layer-list-topbar-control{right:auto;left:5px}.n2-ss-layer-list-topbar-control{text-align:right;color:#fff;padding:0 10px;vertical-align:top}#n2-ss-layers .n2-ss-layer-list-topbar-control{padding:0}.n2-ss-layer-list-topbar-control .n2-button{padding:0;width:28px;font-size:16px;vertical-align:middle}.n2-ss-layer-list-topbar-control .n2-button i{line-height:inherit}.n2-play.n2-active i:before{content:"\e607"}#n2-ss-slide-canvas-container{background-color:#fff;border-width:1px 0 0;padding-bottom:400px;padding-bottom:40vh;position:relative;z-index:1;border-top:1px solid #ccd1d6}#smartslider-form>div{margin-bottom:-1px}#n2-ss-slide-canvas-container-inner{position:relative;z-index:1;overflow:hidden;border-bottom:1px solid #ccd1d6;background-color:#e9edf0;margin-left:49px;border-top:1px solid #ccd1d6}[dir=rtl] #n2-ss-slide-canvas-container-inner{margin-right:49px;margin-left:0}.n2-ss-position-display{display:none;position:absolute;border-radius:3px;z-index:10000;line-height:16px;padding:4px 6px;color:#fff;font-size:10px;background:RGBA(32,41,52,.95)}.n2-ss-position-display.n2-active{display:block}#n2-ss-0 .n2-ss-slide-border{display:none;position:absolute;background:#a1aeb5;width:1px;height:1px}#n2-ss-0 .n2-ss-slide-border-left{left:0;top:0;height:100%}#n2-ss-0 .n2-ss-slide-border-right{right:0;top:0;height:100%}#n2-ss-0 .n2-ss-slide-border-top{left:0;top:0;width:100%}#n2-ss-0 .n2-ss-slide-border-bottom{left:0;bottom:0;width:100%}#n2-ss-0:HOVER .n2-ss-slide-border{display:block}.n2-ss-layer-placeholder{position:relative;height:0;width:100%;box-shadow:0 0 0 2px #0c92df;display:block;z-index:100000}.n2-ss-layer-inline>.n2-ss-layer-placeholder,.n2-ss-layer-row>.n2-ss-layer-placeholder{height:auto;width:0;align-self:stretch;flex:0 0 auto}.n2-ss-core-item.n2-canvas-item-drag{opacity:.5;z-index:9999;margin:0}.n2-canvas-item-drag{opacity:.5!important}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer.n2-ss-mouse-over,.n2-ss-move-layer div#n2-ss-0 .n2-ss-layer.nui-resizable,.n2-ss-resize-layer div#n2-ss-0 .n2-ss-layer.nui-resizable{box-shadow:inset 0 0 0 1px #0c92df}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer.n2-ss-mouse-over[data-pm=absolute],#n2-ss-slide-canvas-container #n2-ss-0 [data-pm=absolute] .n2-ss-layer.n2-ss-mouse-over,.n2-ss-move-layer div#n2-ss-0 .n2-ss-layer.nui-resizable[data-pm=absolute],.n2-ss-move-layer div#n2-ss-0 [data-pm=absolute] .n2-ss-layer.nui-resizable,.n2-ss-resize-layer div#n2-ss-0 .n2-ss-layer.nui-resizable[data-pm=absolute],.n2-ss-resize-layer div#n2-ss-0 [data-pm=absolute] .n2-ss-layer.nui-resizable{box-shadow:inset 0 0 0 1px #5f39c2}div#n2-ss-0 .n2-ss-layer-ui-label-container{display:none;position:absolute;left:0;top:0;text-align:left;line-height:16px;z-index:91;white-space:nowrap;border-bottom-right-radius:2px;overflow:hidden;background:#0c92df;max-width:100%;max-height:100%}div#n2-ss-0 [data-pm=absolute] .n2-ss-layer-ui-label-container{background:#5f39c2}div#n2-ss-0 .n2-ss-layer-ui-label-container:HOVER{max-width:none;max-height:none}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer.n2-active>.n2-ss-layer-ui-label-container,div#n2-ss-0 .n2-ss-layer.n2-ss-mouse-over-delayed>.n2-ss-layer-ui-label-container{display:block}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer .n2-ss-layer-ui-label{display:inline-block;height:16px;font-size:10px;line-height:16px;color:#fff;padding:0 5px;vertical-align:top;text-transform:uppercase;border-left:1px solid #0b7dbe}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer[data-pm=absolute] .n2-ss-layer-ui-label{border-left:1px solid #422887}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-label-action{padding:0;cursor:pointer;font-size:16px;display:none}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer.n2-active>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-label-action,#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container:HOVER .n2-ss-layer-ui-label-action{display:inline-block}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-label:first-child{border-left:0}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layer>.n2-ss-layer-ui-label-container .n2-ss-layer-ui-layer-move{cursor:move}div#n2-ss-0 .n2-ss-layer-ui-label-container.invisible{visibility:hidden}.n2-ss-layer[data-sstype=col].n2-highlight{box-shadow:inset 0 0 0 1px #0c92df}div#n2-ss-0 .n2-ss-layer.n2-ss-mouse-hover[data-sstype=col]{z-index:2}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer.n2-active{box-shadow:inset 0 0 0 1px #0c92df}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer[data-pm=absolute] .n2-ss-layer[data-sstype=col].n2-active,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer[data-pm=absolute].n2-active,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 [data-pm=absolute] .n2-ss-layer.n2-active{box-shadow:inset 0 0 0 1px #5f39c2}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER #n2-ss-0 .n2-ss-layer[data-sstype=row].n2-active,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER div#n2-ss-0 .n2-ss-layer .n2-ss-layer[data-sstype=col].n2-active{box-shadow:inset 0 0 0 1px RGBA(12,146,223,1)}.n2-ss-move-layer .n2-ss-layer[data-sstype=col]{box-shadow:inset 0 0 0 1px RGBA(12,146,223,1)}.n2-ss-move-layer #n2-ss-0 .n2-ss-layer:HOVER{box-shadow:none}div#n2-ss-0 .n2-ss-layer[data-sstype=col] .n2-ss-layer.nui-draggable-dragging,div#n2-ss-0 .n2-ss-layer[data-sstype=content] .n2-ss-layer.nui-draggable-dragging{z-index:100000;outline:0!important}.n2-ss-item-overlay{display:none;position:absolute;top:0;left:0;width:100%;height:100%}.n2-ss-select-layer-mode .n2-ss-layer-selected .n2-ss-item-overlay{display:block;background-color:RGBA(0,132,255,.4)}.n2-ss-item-html .n2-ss-item-overlay,.n2-ss-item-iframe .n2-ss-item-overlay{display:block}.n2-ss-layer .n2-ss-layer-cc{opacity:0}.n2-ss-layer-cc:HOVER,.nui-resizable-e:HOVER,.nui-resizable-n:HOVER,.nui-resizable-ne:HOVER,.nui-resizable-nw:HOVER,.nui-resizable-s:HOVER,.nui-resizable-se:HOVER,.nui-resizable-sw:HOVER,.nui-resizable-w:HOVER{opacity:1}.n2-ss-layer[data-align=center][data-valign=bottom] .nui-resizable-s,.n2-ss-layer[data-align=center][data-valign=middle] .n2-ss-layer-cc,.n2-ss-layer[data-align=center][data-valign=top] .nui-resizable-n,.n2-ss-layer[data-align=left][data-valign=bottom] .nui-resizable-sw,.n2-ss-layer[data-align=left][data-valign=middle] .nui-resizable-w,.n2-ss-layer[data-align=left][data-valign=top] .nui-resizable-nw,.n2-ss-layer[data-align=right][data-valign=bottom] .nui-resizable-se,.n2-ss-layer[data-align=right][data-valign=middle] .nui-resizable-e,.n2-ss-layer[data-align=right][data-valign=top] .nui-resizable-ne{background:#0c92df;opacity:1;border:1px solid #fff}.n2-ss-layer[data-align=center][data-valign=bottom][data-pm=absolute] .nui-resizable-s,.n2-ss-layer[data-align=center][data-valign=middle][data-pm=absolute] .n2-ss-layer-cc,.n2-ss-layer[data-align=center][data-valign=top][data-pm=absolute] .nui-resizable-n,.n2-ss-layer[data-align=left][data-valign=bottom][data-pm=absolute] .nui-resizable-sw,.n2-ss-layer[data-align=left][data-valign=middle][data-pm=absolute] .nui-resizable-w,.n2-ss-layer[data-align=left][data-valign=top][data-pm=absolute] .nui-resizable-nw,.n2-ss-layer[data-align=right][data-valign=bottom][data-pm=absolute] .nui-resizable-se,.n2-ss-layer[data-align=right][data-valign=middle][data-pm=absolute] .nui-resizable-e,.n2-ss-layer[data-align=right][data-valign=top][data-pm=absolute] .nui-resizable-ne{background:#5f39c2}.n2-ss-layer-cc{position:absolute;font-size:.1px;display:block;z-index:92}.n2-ss-layer .nui-normal-sizing-handle,.n2-ss-layer .nui-resizable-handle{border-radius:50px}.n2-ss-layer .n2-ss-layer-cc,.n2-ss-layer .nui-normal-sizing-handle,.n2-ss-layer .nui-resizable-handle{display:none!important;background-image:none;border:1px solid #0c92df;height:7px;width:7px;background:#fff}.n2-ss-layer[data-pm=absolute] .n2-ss-layer-cc,.n2-ss-layer[data-pm=absolute] .nui-normal-sizing-handle,.n2-ss-layer[data-pm=absolute] .nui-resizable-handle{border:1px solid #5f39c2}.n2-ss-layer .ui-column-width-handle{display:none!important;position:absolute;top:25%;height:50%;cursor:ew-resize;width:5px;background:RGBA(12,146,223,.5);z-index:88;opacity:1;box-sizing:border-box!important;border-radius:5px}.n2-ss-layer .ui-column-width-handle:HOVER{background:RGBA(12,146,223,1)}.n2-ss-layer[data-pm=absolute] .ui-column-width-handle{background:RGBA(95,57,194,.5)}.n2-ss-layer[data-pm=absolute] .ui-column-width-handle:HOVER{background:RGBA(95,57,194,1)}.n2-ss-layer .nui-spacing-handle{display:none!important;z-index:89;background:#0c92df;opacity:.5;overflow:hidden}.n2-ss-layer[data-pm=absolute] .nui-spacing-handle{background:#5f39c2}.n2-ss-layer .nui-spacing-handle.nui-spacing-under-spacing,.n2-ss-layer .nui-spacing-handle:HOVER{opacity:.8}.n2-ss-layer .nui-resizable-n{left:50%;top:-4px;margin-left:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-n{min-height:5px;cursor:s-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-n{top:0;margin-left:0;left:25%;width:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-n{left:0;bottom:100%;width:100%}.n2-ss-layer .nui-normal-sizing-e,.n2-ss-layer .nui-resizable-e{right:-4px;top:50%;margin-top:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-e{min-width:5px;cursor:w-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-e{top:25%;margin-top:0;right:0;height:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-e{top:0;left:100%;height:100%}.n2-ss-layer .nui-normal-sizing-s,.n2-ss-layer .nui-resizable-s{bottom:-4px;left:50%;margin-left:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-s{min-height:5px;cursor:n-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-s{bottom:0;margin-left:0;left:25%;width:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-s{bottom:auto;top:100%;left:0;width:100%}.n2-ss-layer .nui-normal-sizing-w,.n2-ss-layer .nui-resizable-w{left:-4px;top:50%;margin-top:-4px}.n2-ss-layer .nui-spacing-handle.nui-spacing-w{min-width:5px;cursor:e-resize}.n2-ss-layer .nui-spacing-handle-padding.nui-spacing-w{top:25%;margin-top:0;left:0;height:50%}.n2-ss-layer .nui-spacing-handle-margin.nui-spacing-w{left:auto;right:100%;top:0;height:100%}.n2-ss-layer .nui-resizable-ne{right:-4px;top:-4px}.n2-ss-layer .nui-resizable-se{right:-4px;bottom:-4px}.n2-ss-layer .nui-resizable-sw{left:-4px;bottom:-4px}.n2-ss-layer .nui-resizable-nw{left:-4px;top:-4px}.n2-ss-layer .n2-ss-layer-cc{left:50%;top:50%;margin-top:-4px;margin-left:-4px}.n2-ss-layer.n2-active:HOVER{box-shadow:inset 0 0 0 1px #0c92df}.n2-ss-layer.n2-active[data-pm=absolute]:HOVER,[data-pm=absolute] .n2-ss-layer.n2-active:HOVER{box-shadow:inset 0 0 0 1px #5f39c2}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.n2-ss-layer-cc,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.nui-normal-sizing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.nui-resizable-handle,.n2-ss-layer.n2-active:HOVER>.n2-ss-layer-cc,.n2-ss-layer.n2-active:HOVER>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-layer.n2-active:HOVER>.n2-ss-layer-row>.ui-column-width-handle,.n2-ss-layer.n2-active:HOVER>.nui-normal-sizing-handle,.n2-ss-layer.n2-active:HOVER>.nui-resizable-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.n2-ss-layer-row>.ui-column-width-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.nui-normal-sizing-handle,.n2-ss-resize-layer .n2-ss-layer.n2-active>.nui-resizable-handle{display:block!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active>.nui-spacing-handle{display:none!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-content>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-mask>.n2-ss-layer-content>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-mask>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.n2-ss-layer-row>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container .n2-ss-layer.n2-active:HOVER>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.nui-resizable-resizing>div>.nui-spacing-handle,.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.nui-spacing-resizing>.nui-spacing-handle,.nui-resizable-resizing>.nui-spacing-handle,.nui-spacing-resizing>.nui-spacing-handle{display:block!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.nui-spacing-resizing>.nui-spacing-handle.nui-spacing-under-spacing{opacity:1}#n2-ss-0 .n2-ss-layer-row[row-wrapped="1"] .ui-column-width-handle,#n2-ss-0 .nui-spacing-resizing .ui-column-width-handle,#n2-ss-0 [data-frontend-fullwidth="0"]>.n2-ss-layer-row .ui-column-width-handle{display:none!important}.n2-ss-animation-play-single #n2-ss-0 .n2-ss-layer .n2-ss-layer-cc,.n2-ss-animation-play-single #n2-ss-0 .n2-ss-layer .nui-normal-sizing-handle,.n2-ss-animation-play-single #n2-ss-0 .n2-ss-layer .nui-resizable-handle,.n2-ss-move-layer .n2-ss-layer.n2-active:HOVER .n2-ss-layer-cc,.n2-ss-move-layer .n2-ss-layer.n2-active:HOVER .nui-normal-sizing-handle,.n2-ss-move-layer .n2-ss-layer.n2-active:HOVER .nui-resizable-handle{display:none!important}.n2-ss-layer-edit-visible #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active{overflow:visible!important}.n2-ss-item{position:relative;float:left;width:100%}.n2-ss-item-area,.n2-ss-item-imagearea,.n2-ss-item-video,.n2-ss-item-vimeo,.n2-ss-item-youtube{height:100%}.n2-ss-editor-group-mode-only,.n2-ss-editor-layer-mode-only,[data-placement=""] [data-placement],[data-placement=absolute] [data-placement]:not([data-placement=absolute]):not([data-placement=all]),[data-placement=content] [data-placement]:not([data-placement=content]):not([data-placement=all]),[data-placement=default] [data-placement]:not([data-placement=default]):not([data-placement=all]),[data-placement=group] [data-placement]:not([data-placement=group]):not([data-placement=all]),[data-placement=normal] [data-placement]:not([data-placement=normal]):not([data-placement=all]){display:none!important}.n2-ss-has-layers[data-component=group] .n2-ss-editor-group-mode-only,.n2-ss-has-layers[data-component=layer] .n2-ss-editor-layer-mode-only{display:inline-block!important}div#n2-ss-0 .n2-ss-layer-chain-parent{position:absolute;z-index:10;right:10px;top:10px;line-height:18px;font-size:12px;width:18px;display:none}.n2-ss-layer-edit-visible .n2-ss-mode-desktopPortrait #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active.n2-ss-layer-has-parent .n2-ss-layer-chain-parent,.n2-ss-mode-desktopPortrait #n2-ss-slide-canvas-container:HOVER .n2-ss-layer.n2-active.n2-ss-layer-has-parent:HOVER .n2-ss-layer-chain-parent{display:inline-block}.n2-ss-layer-highlight{position:absolute;background:#0c92df;z-index:91;opacity:1}.n2-ss-layer-highlight-n{top:0;left:0;width:100%;height:1px}.n2-ss-layer-highlight-e{top:0;right:0;width:1px;height:100%}.n2-ss-layer-highlight-s{bottom:0;left:0;width:100%;height:1px}.n2-ss-layer-highlight-w{top:0;left:0;width:1px;height:100%}#n2-ss-0 .n2-ss-layer-row .n2-ss-layer-content{min-height:20px}[data-devicespecific]{position:relative}#n2-ss-devicespecific-settings{position:absolute;bottom:40px;left:0;padding:0 10px;white-space:nowrap;z-index:2}#n2-ss-devicespecific-settings *{cursor:pointer;background:#a1aeb5;display:inline-block;width:20px;height:20px;line-height:20px;text-align:center;font-size:16px;color:#fff;border-left:1px solid #5b6874}#n2-ss-devicespecific-settings>:first-child{border-top-left-radius:3px;border-bottom-left-radius:3px;border-left:0}#n2-ss-devicespecific-settings>:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}.n2-ss-mode-desktopLandscape #n2-ss-devicespecific-settings .n2-i-mini-desktop-landscape,.n2-ss-mode-desktopPortrait #n2-ss-devicespecific-settings .n2-i-mini-desktop-portrait,.n2-ss-mode-mobileLandscape #n2-ss-devicespecific-settings .n2-i-mini-mobile-landscape,.n2-ss-mode-mobilePortrait #n2-ss-devicespecific-settings .n2-i-mini-mobile-portrait,.n2-ss-mode-tabletLandscape #n2-ss-devicespecific-settings .n2-i-mini-tablet-landscape,.n2-ss-mode-tabletPortrait #n2-ss-devicespecific-settings .n2-i-mini-tablet-portrait{background:#0c92df;border-color:#0b7dbe}.n2-ss-layer[data-sstype=col]>.n2-ss-layer-ui-label-container>.n2-ss-layer-ui-label-self{cursor:move}.n2-highlight-structure .n2-ss-layer[data-sstype=col]{box-shadow:0 0 0 2px #0c92df}.n2-highlight-structure[data-pm=absolute] .n2-ss-layer[data-sstype=col]{box-shadow:0 0 0 2px #5f39c2}.n2-ss-layer-under-creation{visibility:hidden!important}#n2-ss-slide-canvas-container #n2-ss-0 .n2-ss-layers-container>.n2-ss-layer>.n2-ss-layer-ui-label-container>.n2-ss-layer-ui-label-up,[data-editormode=canvas] div#n2-ss-0 .n2-ss-layer[data-sstype=content].n2-ss-content-empty{display:none}[data-editormode=content] div#n2-ss-0 .n2-ss-layer[data-sstype=content].n2-ss-content-empty{height:100%}div#n2-ss-0 .n2-ss-layer-content .n2-ss-layer.n2-active:HOVER{z-index:10}#n2-ss-editor-mode .n2-i{font-size:16px;vertical-align:middle}.n2-context-menu{display:none;position:absolute;left:0;top:0;font-family:"Montserrat",Arial,sans-serif;font-size:13px;background-color:#202934;color:#cedae2;z-index:1000000;border-radius:3px;line-height:25px}.n2-context-menu.n2-active{display:block}.n2-context-menu>div{padding:3px 10px;cursor:pointer}.n2-context-menu>div:HOVER{background-color:RGBA(255,255,255,.2)}.n2-context-menu>div *{margin:0 3px;vertical-align:middle}.n2-context-menu>div .n2-i{font-size:16px}.n2-ss-banner{background-color:#212d3a;margin:0 -1px;z-index:2;position:relative;color:#fff}.n2-ss-banner .n2-ss-banner-inner{display:flex;align-items:center;max-width:960px}.n2-ss-banner .n2-ss-banner-inner>div{margin:20px}.n2-ss-banner .n2-ss-banner-inner a+a{margin:0 20px}.n2-ss-banner .n2-ss-banner-inner p{color:#b2bfc9;font-size:14px;margin:20px 0}[data-visibility=hidden],[data-visibility=hidden] *{visibility:hidden!important}div div#n2-ss-0 .n2-ss-static-slide div[data-sstype=content],div div#n2-ss-0 .n2-ss-static-slide div[data-sstype=content] div.n2-ss-section-main-content{visibility:visible}.n2-ss-sample-slides-container{display:none;position:relative;margin:0 -1px -1px;background-color:#202934;z-index:2}.n2-ss-add-slide-with-sample .n2-main-top-bar{display:none}.n2-ss-add-slide-with-sample .n2-ss-sample-slides-container{display:block}.n2-ss-add-slide-with-sample #n2-ss-devices,.n2-ss-add-slide-with-sample #n2-ss-toolbar,.n2-ss-add-slide-with-sample #smartslider-form,.n2-ss-add-slide-with-sample .n2-ss-edit-slide-top{display:none}.n2-ss-add-slide-with-sample #n2-ss-add-sidebar{top:0}.n2-ss-add-slide-with-sample #n2-ss-slide-canvas-container-inner{border-top:0}.n2-ss-sample-slides-container iframe{width:100%;height:240px;border:0}.n2-ss-sample-slide-settings{padding:20px;background:#212d3a;height:68px;display:flex}.n2-ss-sample-slide-settings .n2-ss-sample-slide-settings-col{flex:0 0 auto;margin:0 10px;display:flex;flex-direction:column;justify-content:space-around}.n2-ss-sample-slide-settings-col .n2-ss-sample-slide-setting{flex:0 0 auto;display:flex;align-items:center}.n2-ss-sample-slide-setting-label{color:#b2bfc9;font-size:10px;text-transform:uppercase;padding-right:20px}#n2-ss-sample-slide-setting-background-image{position:relative;width:100px;height:68px;background-size:cover;border-radius:5px;overflow:hidden;cursor:pointer}#n2-ss-sample-slide-setting-background-image .n2-i-close{position:absolute;right:0;top:0;display:block;width:16px;height:16px;border-bottom-left-radius:5px;background-color:#526377;color:#fff;font-size:14px;text-align:center;line-height:16px;cursor:pointer}.n2-ss-sample-slide-setting-field{margin-left:auto}.n2-ss-sample-slide-setting-field .nui-slider{width:100px;position:relative;background:#374d64;height:6px;margin:10px;border-radius:10px}.n2-ss-sample-slide-setting-field .nui-slider .nui-slider-handle{position:absolute;top:0;z-index:2;width:14px;height:14px;-ms-touch-action:none;touch-action:none;background:#fff;margin:-4px -7px 0;border-radius:50px;cursor:ew-resize}.n2-ss-sample-slide-settings .n2-ss-sample-slide-settings-col.n2-ss-sample-slide-settings-image-specific,.n2-ss-sample-slide-settings-col .n2-ss-sample-slide-setting.n2-ss-sample-slide-setting-gradient-specific{display:none}.n2-ss-sample-slide-settings.n2-ss-has-gradient .n2-ss-sample-slide-settings-col .n2-ss-sample-slide-setting.n2-ss-sample-slide-setting-gradient-specific,.n2-ss-sample-slide-settings.n2-ss-has-image .n2-ss-sample-slide-settings-col.n2-ss-sample-slide-settings-image-specific{display:flex}.n2-ss-scrollbar-wrapper{background-color:#212d3a;padding:4px;height:8px;z-index:10}.n2-scroll-disable .n2-ss-scrollbar-wrapper{visibility:hidden;height:0;padding:0}.n2-ss-scrollbar-wrapper .track{position:relative;height:8px}.n2-ss-scrollbar-wrapper .thumb{position:absolute;top:0;background-color:#49586a;height:8px;cursor:default;width:20px;z-index:2;border:0;border-radius:5px}.n2-ss-scrollbar-wrapper.n2-ss-scrollbar-light{background-color:#b9c3c9}.n2-ss-scrollbar-wrapper.n2-ss-scrollbar-light .thumb{background-color:#fff}#n2-ss-zoom{width:280px;text-align:center;vertical-align:middle}#n2-ss-zoom .n2-ss-slider-zoom-container{position:relative;display:inline-block;vertical-align:middle;width:150px;height:34px;padding:0 23px}#n2-ss-zoom .n2-ss-slider-zoom-container>.n2-i{position:absolute;top:9px;color:#6b7986;font-size:16px}#n2-ss-zoom .n2-ss-slider-zoom-container .n2-i-minus{left:-18px}#n2-ss-zoom .n2-ss-slider-zoom-container .n2-i-plus{right:-18px}.n2-ss-slider-zoom-bg{position:absolute;left:0;top:50%;margin-top:-3px;width:100%;background:#505c69;height:6px;border-radius:3px}#n2-ss-slider-zoom{height:100%;position:relative;margin:0;background:0 0;border:none;border-radius:0}#n2-ss-slider-zoom .nui-slider-range{display:none}#n2-ss-slider-zoom .nui-slider-handle{position:absolute;top:50%;display:block;width:47px;height:22px;margin-top:-11px;margin-left:-23px;background-color:#e6eaee;background:#e6eaee;border:none;border-radius:3px;z-index:2;color:#7b8898;font-size:10px;text-align:center;line-height:22px;cursor:pointer}.n2-ss-slider-zoom-1{position:absolute;left:50%;top:0;margin-left:-1.5px;width:3px;height:100%;background-color:#6b7986}.n2-ss-device-zoomer{min-width:280px}.n2-ss-device-zoomer #n2-ss-zoom{padding:10px 0;background:#212d3a;margin:0 auto;display:none;border-bottom-left-radius:3px;border-bottom-right-radius:3px}.n2-ss-device-zoomer:HOVER #n2-ss-zoom{display:block}.n2-ss-device-zoomer .n2-ss-slider-zoom-1,.n2-ss-device-zoomer .n2-ss-slider-zoom-bg{background-color:#374d64}.n2-ss-device-zoomer #n2-ss-zoom .n2-ss-slider-zoom-container>.n2-i{color:#4e667f}.n2-ss-device-zoomer #n2-ss-slider-zoom .nui-slider-handle{background-color:#526a80;color:#fff}#n2-ss-devices{height:60px}#n2-ss-devices.n2-ss-devices-compact>.n2-controls-panel{width:260px}#n2-ss-devices .n2-table{font-size:32px;color:#80a3b5;margin:0 auto}.n2-lb-header #n2-ss-devices .n2-table{color:#a4b0b7}#n2-ss-devices .n2-td{height:60px;vertical-align:middle;text-align:center;padding:0 15px;cursor:pointer}#n2-ss-devices .n2-td.n2-active{cursor:default;color:#0c92df}.n2-i-devices:before{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATEAAAAeCAMAAABzNtkNAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACdlBMVEUAAAChrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrWhrrUZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeOhrrWhrrWhrrWhrrWhrrUZmeMZmeMZmeMZmeMZmeOhrrUZmeOhrrWhrrUZmeMZmeOhrrUZmeOhrrWhrrUZmeMZmeOhrrUZmeOhrrUZmeOhrrUZmeOhrrWhrrUZmeMZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrUZmeOhrrWhrrWhrrUZmeMZmeMZmeOhrrUZmeOhrrUZmeMAAAA99lBfAAAA0XRSTlMAJ6DHzCgytbY2MLMnoMfMKDK1tjYws5+ytLGfsrSxxh0ixh0il5qXmgY7a5SvvspsB2aHBjtrlK++ymwHZod+wiN+wiMSgbh6SiYQAnl9DBKBuHpKJhACeX0MNbmdQwQzNbmdQwQzRrtLAUa7SwHIpRWkyKUVpJgKUqLDnk2YClKiw55Nhq2KhIatioTLLlgOT8suWA5PcH9ZX3B/WV+sJcQqrqwlxCquKSmjXqNeV1eRiZGJCQmIiLq6AzQDNIK3SYK3SSQkCG2hCG2hsLA3NxRx1r0AAAABYktHRACIBR1IAAAACXBIWXMAAAsSAAALEgHS3X78AAAE0UlEQVRo3s2a+18UVRTAN/eYJLmHJCAjS4pehG4vQrcHhq0bCrFu6BKkRmq+JSNTpBQpVlnjEY+wtAglFIjeWmCWZb7t8Se109z57Mzcc+eBLrPnl7nn3DOP8/3MvXPPueNyWZSbprhBKO4pU9W+N0+jnFJuIS47PVXrlDrd6gPp5NYZHhSKZ0aa2ve2mZRT+u3EZTMytU6ZGZafKAsMJUvtewftk0Jcdpbe6c4JEstGQ8lW+95F+6QTl52td7rb8hO5wagX7tFopC9pBZijVnPA8DYG4kGjXrxXo5G+pBXxPrWai4a3MY9X0BvT7te/Ow+IiNm5jRETtN4b0x7UvzsPiYiJ9YfzHsmfO8/rnTc3/9G8x6jQHhcNySd4YryTiBjnJ5AnC54qnL/A51swv/Dpgmeo0J4VDcnneGK8k4gY58ckp2ih+rEXFj3PExPPYhQx4vTrIJZbvEj92IuKX+CJiWcxihhxug1i/sVegMCLJUuWlpYuXVJSFgDwvlRuKWSqyxYxY12W4DIfYujliuUrwuEVyysqQ4i+V6oshUx12SJG6tWvAqxctTpuX71qJcC015KFWM3riGvWrosb1q1dgzjzDceIrXfDho2btD2bNm4A9/rkILbZg1u2btPatm3dgp7NDhGrroU3t/O+298Cd3UyEKupw7d38GfueAc9NY4Q8wdg5y5ZLa3f3dDw7nvsddu1EwJ+54kFQ7hnr9wMN+5ranr/A/a67d2DoaATxJohwub40v3y1+oAQ1YegWbnibVglM3x4YPy1+pDhqwqii0OEMtp9bYxrR7c7R0d7W74iBnavK05ThPL7fR1sWYjerp7ero9+DEzdPk6cyefWC8cUrQs+EQ6fBpPEhdDr9PEDuMRpZmNn0mHz+NJ4jI8PPnE+uALReuHDunQAf2K5Sgcc5rYAH6pNAexRzr04KBiOY4nJp9YBI6KiQ05TyyKx8XEhp0g1gtFijYij8qv4qPyUDKMymKlOSqPyq/jo/KIE6MyNvMPMe0bZeavZ4ah5Jj5h1nzW2Xmb2SGYUdm/tjqok9ZXXwnry6+L5X18r7kWF0MKKuLH+TVxY9hWa8acGR18f8K9iRD1j7S37+7ngE7ya9gE1G7MCMmrWBPMWTdo4OD+xoZsFP8CjYRtQtCj2VJI1SWNAK12ixpvwjYT4nOkkapLGkU67RZ0kERsJ8TkImPlegz8ZIxLhM3kERn4uMV+ky8YpzLxA3khld7xqRqz+m4/bRU7Un5xSwUQ2I3sAZbMy5Ve87EDWekak/6r0ahmRK7vhqs/7dYRfFsGaso/l52FqC1SFtRtLkz0mw2cu0QcwX/iFUUz1WyiuKflecQO4u1FUWbOyMtZiPXhJjLdV5ftT6vO9XO7putvSQLTjG5oK9aX9A52Nl9s7WXJNYv5l3Kj0g7I5H8S3kXuVOnXq4V86q9rNnhVYVNN3nXhgZjYi7XlYKrhVFpZyRaeLXgCteddq1OzKvuWpogbLrJuzY1GcE2FTkscXAJIWZD5LDEwSU1MTMrgF+t+iebmJkVMahWgxMhZmGv7C967KYSrql6p4n+RaCKkZqnNfI3PXYzCddMvZP1vwjsEGs7RgGbRf2p8k9AB2yif6rYIdZ1ggI2m/pT5d+QDljGf3zSNGZGqKPpAAAAAElFTkSuQmCC)}.n2-i-devices-all:before{background-position:0 0}.n2-i-devices-desktop:before{background-position:-40px 0}.n2-i-devices-tablet:before{background-position:-80px 0}.n2-i-devices-phone:before{background-position:-120px 0}.n2-active>.n2-i-devices-all:before{background-position:-160px 0}.n2-active>.n2-i-devices-desktop:before{background-position:-200px 0}.n2-active>.n2-i-devices-tablet:before{background-position:-240px 0}.n2-active>.n2-i-devices-phone:before{background-position:-280px 0}.n2-generator-insert-variable .n2-variable-container{height:90px;overflow:auto}.n2-generator-insert-variable .n2-group-container{height:40px;overflow:auto}.n2-generator-insert-variable .n2-group-container .n2-button,.n2-generator-insert-variable .n2-variable-container .n2-button{margin:3px}.n2-generator-insert-variable .n2-group-container .n2-button.n2-active,.n2-generator-insert-variable .n2-variable-container .n2-button.n2-active,.n2-ss-layer-picker.n2-active{background:#0c92df}.n2-generator-result-container{height:100px;overflow:auto;margin:0 3px}.n2-ss-layer-picker{background:#6b7986;color:#fff;font-size:16px;height:28px;line-height:28px;padding:0;text-align:center;width:28px;border-radius:3px;margin:0 10px 10px;cursor:pointer}#n2-ss-toolbar #n2-ss-layer-parent-linker.n2-under-pick,.n2-ss-layer-picker.n2-under-pick{background-color:#51b82d}#n2-ss-layer-parent-linker.n2-under-pick .n2-i-layerlink:before,.n2-ss-layer-picker.n2-under-pick .n2-i-layerlink:before{content:"\e64b"}.n2-ss-picker-overlay,.n2-ss-picker-overlay-tile{position:absolute;left:0;top:0;background:RGBA(25,153,227,.8);cursor:pointer;width:100%;height:100%;z-index:1000000;box-shadow:inset 0 0 0 1px rgba(0,0,0,.4)}.n2-ss-picker-overlay-tile{width:33%;height:33%}.n2-ss-picker-overlay-tile:HOVER,.n2-ss-picker-overlay:HOVER{background:RGBA(42,52,63,.9)}.n2-ss-picker-overlay-tile.n2-active,.n2-ss-picker-overlay-tile.n2-active:HOVER{background:RGBA(0,52,63,.9)}#n2-ss-toolbar #n2-ss-layer-parent-linker{display:none}.n2-ss-has-layers .n2-ss-mode-desktopPortrait #n2-ss-toolbar #n2-ss-layer-parent-linker,.n2-ss-has-ruler .n2-ruler>span{display:inline-block}.n2-ss-layer.n2-ss-picking-on-layer{z-index:1000000!important}.n2-ruler-container{position:absolute;left:0;top:0;height:100%;width:100%;visibility:hidden;z-index:10}.n2-ruler-container>*{visibility:visible}.n2-ruler,.n2-ruler-guide{position:absolute;left:0;top:0}.n2-ruler{box-sizing:border-box;white-space:nowrap;direction:ltr}.n2-ruler>span{position:relative;display:none;vertical-align:top}.n2-ruler>span span{position:absolute;display:block;font-size:10px;color:#7b8898;line-height:10px}.n2-ruler-guide{display:none;z-index:2}.n2-ss-show-guides .n2-ruler-guide{display:block}.n2-ruler-guide .n2-ruler-guide-handle{position:absolute;background:#e6b625;left:0;top:0;width:9px;height:9px;cursor:pointer;font-family:'Nextend'!important;font-size:9px;color:#fff;line-height:9px;text-align:center}.n2-ruler-guide .n2-ruler-guide-handle:before{content:"\e90a"}.n2-ruler-horizontal{padding-left:1px;height:0;width:100%}.n2-ss-has-ruler .n2-ruler-horizontal{height:39px}.n2-ruler-horizontal>span.n2-ss-ruler-mark-large{height:20px}.n2-ruler-horizontal>span.n2-ss-ruler-mark-medium{height:10px}.n2-ruler-horizontal>span{width:9px;height:5px;border-right:1px solid #bcc4c8}.n2-ruler-horizontal span span{left:12px;top:10px}.n2-ruler-vertical .n2-ruler-guide{height:0;width:3000px}.n2-ss-lock-guides .n2-ruler-vertical .n2-ruler-guide{cursor:default}.n2-ruler-vertical .n2-ruler-guide .n2-ruler-guide-border{border-bottom:1px solid #ccaa2b;width:100%}.n2-ruler-vertical .n2-ruler-guide-handle{top:-4px}.n2-ruler-vertical{padding-top:1px;width:0;height:100%;background:#e9edf0;z-index:5}.n2-ss-has-ruler .n2-ruler-vertical{width:40px}.n2-ruler-vertical>span.n2-ss-ruler-mark-large{width:20px}.n2-ruler-vertical>span.n2-ss-ruler-mark-medium{width:10px}.n2-ruler-vertical>span{display:none;width:5px;height:9px;border-bottom:1px solid #bcc4c8}.n2-ss-has-ruler .n2-ruler-vertical>span{display:block}.n2-ruler-vertical span span{left:8px;top:12px}.n2-ruler-horizontal .n2-ruler-guide{width:0;height:3000px}.n2-ss-lock-guides .n2-ruler-horizontal .n2-ruler-guide{cursor:default}.n2-ruler-horizontal .n2-ruler-guide .n2-ruler-guide-border{border-right:1px solid #ccaa2b;height:100%}.n2-ruler-horizontal .n2-ruler-guide-handle{left:-4px}.n2-ruler-guide-handle{display:none}.n2-ss-has-ruler .n2-ruler-guide-handle{display:block}
library/media/dist/smartslider-backend.js CHANGED
@@ -89,7 +89,7 @@ N2D('Zoom', function ($, undefined) {
89
  };
90
  /**
91
  *
92
- * @type {SmartSliderResponsive[]}
93
  */
94
  this.responsives = [];
95
 
@@ -242,6 +242,8 @@ N2D('Zoom', function ($, undefined) {
242
 
243
  this.zoom.nUISlider("option", 'value', v);
244
  }
 
 
245
  }
246
  };
247
 
@@ -3268,7 +3270,7 @@ N2D('SmartSliderSlideBackgroundAdmin', ['SmartSliderSlideBackground'], function
3268
  *
3269
  * @param {N2Classes.FrontendSliderSlide} slide
3270
  * @param {jQuery} element
3271
- * @param {SmartSliderBackgrounds} manager
3272
  * @constructor
3273
  */
3274
  function SmartSliderSlideBackgroundAdmin(slide, element, manager) {
@@ -3391,7 +3393,9 @@ N2D('SmartSliderSlideBackgroundAdmin', ['SmartSliderSlideBackground'], function
3391
  if (this.elements.image) {
3392
  this.elements.image.setDesktopSrc(image);
3393
  } else if (image !== '') {
3394
- if (this.editor.settings.getType() === 'image') {
 
 
3395
  this.createImageElement(image);
3396
  }
3397
  }
@@ -3517,7 +3521,7 @@ N2D('EditorSlide', ['EditorAbstract'], function ($, undefined) {
3517
  * @param {string} slideContentElementID
3518
  * @param {object} options
3519
  * @constructor
3520
- * @augments {EditorAbstract}
3521
  */
3522
  function EditorSlide(sliderElementID, slideContentElementID, options) {
3523
 
@@ -3539,7 +3543,7 @@ N2D('EditorSlide', ['EditorAbstract'], function ($, undefined) {
3539
  this.slideStartValue = this.$slideContentElement.val();
3540
 
3541
  N2R('#' + this.sliderElementID, $.proxy(function ($, slider) {
3542
- /** @type {SmartSliderAbstract} */
3543
  this.frontend = slider;
3544
  this.frontend.editor = this;
3545
  nextend.pre = 'div#' + this.frontend.elementID + ' ';
@@ -3957,7 +3961,7 @@ N2D('EditorSlide', ['EditorAbstract'], function ($, undefined) {
3957
  };
3958
 
3959
  /**
3960
- * @returns {FrontendSliderSlide}
3961
  */
3962
  EditorSlide.prototype.getFrontendSlide = function () {
3963
  return this.editedInstance;
@@ -3987,13 +3991,13 @@ N2D('Generator', ['EditorAbstract'], function ($, undefined) {
3987
  /**
3988
  * @memberOf N2Classes
3989
  *
3990
- * @param {EditorAbstract} editor
3991
  * @constructor
3992
  */
3993
  function Generator(editor) {
3994
 
3995
  /**
3996
- * @type {EditorAbstract}
3997
  */
3998
  this.editor = editor;
3999
  this._refreshTimeout = null;
@@ -4495,6 +4499,55 @@ N2D('Generator', ['EditorAbstract'], function ($, undefined) {
4495
 
4496
  return Generator;
4497
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4498
  N2D('History', function ($, undefined) {
4499
  "use strict";
4500
 
@@ -4535,12 +4588,12 @@ N2D('History', function ($, undefined) {
4535
  }
4536
 
4537
  /**
4538
- * @returns {History}
4539
  */
4540
  History.get = function () {
4541
  var history = new History();
4542
  /**
4543
- * @returns {History}
4544
  */
4545
  History.get = function () {
4546
  return history;
@@ -4931,14 +4984,14 @@ N2D('SlideSettings', function ($, undefined) {
4931
  /**
4932
  * @memberOf N2Classes
4933
  *
4934
- * @param {EditorSlide} editor
4935
  * @param {boolean} isStatic
4936
  * @constructor
4937
  */
4938
  function SlideSettings(editor, isStatic) {
4939
 
4940
  /**
4941
- * @type {EditorSlide}
4942
  */
4943
  this.editor = editor;
4944
  this.isStatic = isStatic;
@@ -5461,7 +5514,7 @@ N2D('LayerContainer', function ($, undefined) {
5461
  break;
5462
  }
5463
  }
5464
- /** @type {ComponentAbstract} */
5465
  var component;
5466
  switch (type) {
5467
  case 'layer':
@@ -5982,7 +6035,7 @@ N2D('LayerDataStorage', function ($, undefined) {
5982
  };
5983
 
5984
  /**
5985
- * @param {LayerAdvancedProperty} advancedProperty
5986
  * @param $layer
5987
  * @param scope
5988
  */
@@ -6166,7 +6219,7 @@ N2D('FragmentEditor', function ($, undefined) {
6166
  /**
6167
  * @memberOf N2Classes
6168
  *
6169
- * @param {EditorAbstract} editor
6170
  * @param jQuery $editedElement
6171
  * @param configuration
6172
  * @param options
@@ -6176,7 +6229,7 @@ N2D('FragmentEditor', function ($, undefined) {
6176
  this.mode = 'desktopPortrait';
6177
 
6178
  /**
6179
- * @type {EditorAbstract}
6180
  */
6181
  this.editor = editor;
6182
  this.$editedElement = $editedElement;
@@ -6200,7 +6253,7 @@ N2D('FragmentEditor', function ($, undefined) {
6200
  this.ui = new N2Classes.CanvasUserInterface(this);
6201
 
6202
  /**
6203
- * @type {MainContainer}
6204
  */
6205
  this.mainContainer = new N2Classes.MainContainer(this);
6206
 
@@ -6211,7 +6264,7 @@ N2D('FragmentEditor', function ($, undefined) {
6211
  this._initDeviceModeChange();
6212
 
6213
  /**
6214
- * @type {CanvasSettings}
6215
  */
6216
  this.canvasSettings = new N2Classes.CanvasSettings(this);
6217
 
@@ -6538,7 +6591,6 @@ N2D('FragmentEditor', function ($, undefined) {
6538
  this.layerOptions.changeActiveComponentPlacement(current, nextActiveLayer.property);
6539
  }, this)
6540
  });
6541
-
6542
  }
6543
 
6544
  this.$.trigger('activeLayerChanged');
@@ -7892,7 +7944,7 @@ N2D('Ruler', function ($, undefined) {
7892
  /**
7893
  * @memberOf N2Classes
7894
  *
7895
- * @param {EditorAbstract} editor
7896
  * @param stored
7897
  * @constructor
7898
  */
@@ -8104,7 +8156,7 @@ N2D('Ruler', function ($, undefined) {
8104
 
8105
  /**
8106
  *
8107
- * @param {Ruler} ruler
8108
  * @param {jQuery} container
8109
  * @param e
8110
  * @constructor
@@ -8214,13 +8266,13 @@ N2D('CanvasSettings', function ($, undefined) {
8214
  /**
8215
  * @memberOf N2Classes
8216
  *
8217
- * @param {FragmentEditor} fragmentEditor
8218
  * @constructor
8219
  */
8220
  function CanvasSettings(fragmentEditor) {
8221
 
8222
  /**
8223
- * @type {FragmentEditor}
8224
  */
8225
  this.fragmentEditor = fragmentEditor;
8226
 
@@ -8324,6107 +8376,5849 @@ N2D('CanvasSettings', function ($, undefined) {
8324
 
8325
  return CanvasSettings;
8326
  });
8327
- N2D('PlacementAbsolute', ['PlacementAbstract'], function ($, undefined) {
8328
  "use strict";
8329
 
8330
- var rAFShim = (function () {
8331
- var timeLast = 0;
8332
-
8333
- return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) {
8334
- var timeCurrent = (new Date()).getTime(),
8335
- timeDelta;
8336
-
8337
- /* Dynamically set delay on a per-tick basis to match 60fps. */
8338
- /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */
8339
- timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));
8340
- timeLast = timeCurrent + timeDelta;
8341
-
8342
- return setTimeout(function () {
8343
- callback(timeCurrent + timeDelta);
8344
- }, timeDelta);
8345
- };
8346
- })(),
8347
- resizeCollection = {
8348
- raf: false,
8349
- ratios: null,
8350
- isThrottled: false,
8351
- layers: []
8352
- },
8353
- requestRender = function () {
8354
- if (resizeCollection.raf === false) {
8355
- resizeCollection.raf = true;
8356
- rAFShim(function () {
8357
- for (var i = 0; i < resizeCollection.layers.length; i++) {
8358
- if (!resizeCollection.layers[i].isDeleted) {
8359
- resizeCollection.layers[i].doTheResize(resizeCollection.ratios, true, resizeCollection.isThrottled);
8360
- }
8361
- }
8362
- resizeCollection = {
8363
- raf: false,
8364
- ratios: null,
8365
- isThrottled: false,
8366
- layers: []
8367
- };
8368
- });
8369
- }
8370
- };
8371
-
8372
  /**
8373
  * @memberOf N2Classes
8374
  *
8375
- * @param placement
8376
- * @param layer
8377
- * @param fragmentEditor
8378
  * @constructor
8379
- * @augments PlacementAbstract
 
 
8380
  */
8381
- function PlacementAbsolute(placement, layer, fragmentEditor) {
8382
- this.type = 'absolute';
8383
 
8384
- this.transferredProperties = {};
 
8385
 
8386
- N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
 
 
 
 
 
8387
 
8388
- this.doThrottledTheResize = this.doTheResize;
8389
- this._triggerLayerResizedThrottled = NextendThrottle(this._triggerLayerResized, 30);
8390
 
8391
- this.parentIsVisible = true; // Related to parent child layer picker
8392
 
8393
- this.children = [];
8394
  }
8395
 
8396
- PlacementAbsolute.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
8397
- PlacementAbsolute.prototype.constructor = PlacementAbsolute;
8398
 
8399
- PlacementAbsolute.prototype.start = function () {
8400
- this.$layer = this.layer.layer;
8401
- this.$layerRow = this.layer.layerRow;
8402
- };
8403
 
8404
- PlacementAbsolute.prototype.preActivation = function (lastPlacement) {
8405
- if (lastPlacement.type == 'normal') {
8406
- var height = this.layer.getProperty('height');
8407
- if (height > 0) {
8408
- this.transferredProperties.height = height;
8409
- }
8410
  }
8411
- };
8412
 
8413
- PlacementAbsolute.prototype.activated = function (properties) {
8414
- var delayedActivate = false,
8415
- parentid = this.$layer.data('parentid');
8416
- if (parentid) {
8417
- var $parent = $('#' + parentid);
8418
- if ($parent.length > 0) {
8419
- this.activatedAfterParentReady(properties);
8420
- } else {
8421
- setTimeout($.proxy(function () {
8422
- this.activatedAfterParentReady(properties);
8423
- }, this), 300);
8424
- }
8425
- } else {
8426
- this._activated(properties);
8427
- }
8428
  };
8429
 
8430
- PlacementAbsolute.prototype.activatedAfterParentReady = function (properties) {
8431
- var parentid = this.$layer.data('parentid');
8432
- if (parentid) {
8433
- var $parent = $('#' + parentid);
8434
- if ($parent.length > 0) {
8435
- var layerObject = $parent.data('layerObject');
8436
- if (layerObject) {
8437
- layerObject.readyDeferred.done($.proxy(this._activated, this, properties));
8438
- } else {
8439
- $parent.on('layerStarted', $.proxy(function (e, layerObject) {
8440
- layerObject.readyDeferred.done($.proxy(this._activated, this, properties));
8441
- }, this));
8442
- }
8443
- } else {
8444
- this.$layer.data('parentid', '');
8445
- this._activated(properties);
8446
- }
8447
- } else {
8448
- this._activated(properties);
8449
- }
8450
  };
8451
 
8452
- PlacementAbsolute.prototype._activated = function (properties) {
8453
- this.loadProperties($.extend(properties, this.transferredProperties));
8454
- this.transferredProperties = {};
8455
 
8456
- this.$layer.css('zIndex', '');
 
8457
 
8458
- this.___makeLayerAlign();
8459
- this.___makeLayerResizeable();
8460
  };
8461
 
8462
- PlacementAbsolute.cleanLayer = function ($layer) {
8463
- var devices = [
8464
- 'desktopPortrait',
8465
- 'desktopLandscape',
8466
- 'tabletPortrait',
8467
- 'tabletLandscape',
8468
- 'mobilePortrait',
8469
- 'mobileLandscape'
8470
- ];
8471
-
8472
- $layer
8473
- .removeAttr('data-align')
8474
- .removeAttr('data-valign')
8475
- .css({
8476
- left: '',
8477
- top: '',
8478
- right: '',
8479
- bottom: '',
8480
- width: '',
8481
- height: '',
8482
- 'text-align': ''
8483
- });
8484
- var properties = ['parentid', 'responsiveposition', 'responsivesize', 'parentalign', 'parentvalign',
8485
- 'align', 'valign', 'left', 'top', 'width', 'height'];
8486
 
8487
- var data = {};
8488
- for (var i = 0; i < properties.length; i++) {
8489
- var prop = properties[i].toLowerCase();
8490
- data[prop] = $layer.data(prop);
8491
- $layer.removeAttr(prop);
8492
- $layer.removeData(prop);
8493
- for (var j = 0; j < devices.length; j++) {
8494
- var device = devices[j].toLowerCase();
8495
- data[device + prop] = $layer.data(device + prop);
8496
- $layer.removeAttr(device + prop);
8497
- $layer.removeData(device + prop);
8498
- }
8499
- }
8500
- return data;
8501
  };
8502
 
8503
- PlacementAbsolute.prototype.deActivated = function (newMode) {
8504
-
8505
- var value = this.layer.getProperty('parentid');
8506
- if (value && value != '') {
8507
- this.$layer.removeAttr('data-parentid');
8508
- this.unSubscribeParent();
8509
- }
8510
 
8511
- this.$layer
8512
- .removeAttr('data-align')
8513
- .removeAttr('data-valign')
8514
- .css({
8515
- left: '',
8516
- top: '',
8517
- right: '',
8518
- bottom: '',
8519
- width: '',
8520
- height: '',
8521
- 'text-align': ''
8522
- });
8523
 
8524
- this.alignMarker.remove();
8525
- this.$layer.nUIResizable('destroy');
8526
- this.$layer.off('.n2-ss-absolute');
 
 
 
8527
 
8528
- this.$layer.triggerHandler('LayerUnavailable');
 
 
 
8529
 
8530
- var properties = ['parentid', 'responsiveposition', 'responsivesize', 'parentalign', 'parentvalign',
8531
- 'align', 'valign', 'left', 'top', 'width', 'height'],
8532
- historicalData = this.layer.getPropertiesData(properties);
8533
 
8534
- this.layer.removeProperties(properties);
 
 
 
 
 
 
8535
 
 
 
8536
 
8537
- this.chainParent.remove();
8538
 
8539
- return historicalData;
 
8540
  };
8541
 
8542
- PlacementAbsolute.prototype.loadProperties = function (options) {
8543
- this.layer.createProperty('parentid', null, this.layer.layer, this);
8544
 
8545
- this.layer.createProperty('responsiveposition', 1, this.layer.layer, this);
8546
- this.layer.createProperty('responsivesize', 1, this.layer.layer, this);
8547
 
8548
- this.layer.createDeviceProperty('parentalign', {desktopPortrait: 'center'}, this.layer.layer, this);
8549
- this.layer.createDeviceProperty('parentvalign', {desktopPortrait: 'middle'}, this.layer.layer, this);
8550
 
8551
- this.layer.createDeviceProperty('align', {desktopPortrait: options.align || 'center'}, this.layer.layer, this);
8552
- this.layer.createDeviceProperty('valign', {desktopPortrait: options.valign || 'middle'}, this.layer.layer, this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8553
 
8554
- this.layer.createDeviceProperty('left', {desktopPortrait: options.left || 0}, this.layer.layer, this);
8555
- this.layer.createDeviceProperty('top', {desktopPortrait: options.top || 0}, this.layer.layer, this);
 
 
 
8556
 
8557
- this.layer.createDeviceProperty('width', {desktopPortrait: options.width || 'auto'}, this.layer.layer, this);
8558
- this.layer.createDeviceProperty('height', {desktopPortrait: options.height || 'auto'}, this.layer.layer, this);
8559
 
8560
- var $layer = this.layer.layer;
 
 
 
 
 
8561
 
8562
- this.subscribeParentCallbacks = {};
8563
- if (this.layer.getProperty('parentid')) {
8564
- this.subscribeParent();
8565
- }
8566
 
8567
- $layer.attr({
8568
- 'data-align': this.layer.getProperty('align'),
8569
- 'data-valign': this.layer.getProperty('valign')
8570
- });
8571
 
8572
- var $lastParent = null;
8573
- this.chainParent = $('<div class="n2-ss-layer-chain-parent n2-button n2-button-icon n2-button-xs n2-radius-s n2-button-blue"><i class="n2-i n2-i-layerunlink"></i></div>').on({
8574
- click: $.proxy(this.unlink, this),
8575
- mouseenter: $.proxy(function () {
8576
- $lastParent = $('#' + this.layer.getProperty('parentid')).addClass('n2-highlight');
8577
- }, this),
8578
- mouseleave: $.proxy(function () {
8579
- if ($lastParent) {
8580
- $lastParent.removeClass('n2-highlight');
8581
- $lastParent = null;
8582
- }
8583
- }, this)
8584
- }).appendTo(this.$layer);
8585
- };
8586
 
 
8587
 
8588
- PlacementAbsolute.prototype.triggerLayerResized = function (isThrottled, ratios) {
8589
- if (isThrottled) {
8590
- this._triggerLayerResized(isThrottled, ratios);
8591
- } else {
8592
- this._triggerLayerResizedThrottled(true, ratios);
8593
- }
8594
- };
8595
 
8596
- PlacementAbsolute.prototype._triggerLayerResized = function (isThrottled, ratios) {
8597
- if (!this.layer.isDeleted) {
8598
- this.$layer.triggerHandler('LayerResized', [ratios || {
8599
- slideW: this.fragmentEditor.getResponsiveRatioHorizontal(),
8600
- slideH: this.fragmentEditor.getResponsiveRatioVertical()
8601
- }, isThrottled || false]);
8602
  }
8603
- };
8604
 
8605
- PlacementAbsolute.prototype.___makeLayerAlign = function () {
8606
- this.alignMarker = $('<div class="n2-ss-layer-cc" />').appendTo(this.$layer);
8607
- };
8608
-
8609
- //<editor-fold desc="Makes layer resizable">
8610
-
8611
- /**
8612
- * Add resize handles to the specified layer
8613
- * @param {jQuery} layer
8614
- * @private
8615
- */
8616
- PlacementAbsolute.prototype.___makeLayerResizeable = function () {
8617
- this._resizableJustClick = false;
8618
- this.$layer.nUIResizable({
8619
- handles: 'n, e, s, w, ne, se, sw, nw',
8620
- _containment: this.fragmentEditor.mainContainer.layer,
8621
- start: $.proxy(this.____makeLayerResizeableStart, this),
8622
- resize: $.proxy(this.____makeLayerResizeableResize, this),
8623
- stop: $.proxy(this.____makeLayerResizeableStop, this),
8624
- create: $.proxy(function () {
8625
- this.$layer.find('.nui-resizable-handle, .n2-ss-layer-cc').on({
8626
- mousedown: $.proxy(function (e) {
8627
- this._resizableJustClick = [e.clientX, e.clientY];
8628
- }, this),
8629
- mouseup: $.proxy(function (e) {
8630
- if (this._resizableJustClick && Math.abs(Math.sqrt(Math.pow(this._resizableJustClick[0] - e.clientX, 2) + Math.pow(this._resizableJustClick[1] - e.clientY, 2))) < 1) {
8631
- var $target = $(e.currentTarget),
8632
- layerFeatures = this.fragmentEditor.layerOptions.layerFeatures;
8633
- if ($target.hasClass('nui-resizable-nw')) {
8634
- layerFeatures.horizontalAlign('left', false);
8635
- layerFeatures.verticalAlign('top', false);
8636
- } else if ($target.hasClass('nui-resizable-w')) {
8637
- layerFeatures.horizontalAlign('left', false);
8638
- layerFeatures.verticalAlign('middle', false);
8639
- } else if ($target.hasClass('nui-resizable-sw')) {
8640
- layerFeatures.horizontalAlign('left', false);
8641
- layerFeatures.verticalAlign('bottom', false);
8642
- } else if ($target.hasClass('nui-resizable-n')) {
8643
- layerFeatures.horizontalAlign('center', false);
8644
- layerFeatures.verticalAlign('top', false);
8645
- } else if ($target.hasClass('n2-ss-layer-cc')) {
8646
- layerFeatures.horizontalAlign('center', false);
8647
- layerFeatures.verticalAlign('middle', false);
8648
- } else if ($target.hasClass('nui-resizable-s')) {
8649
- layerFeatures.horizontalAlign('center', false);
8650
- layerFeatures.verticalAlign('bottom', false);
8651
- } else if ($target.hasClass('nui-resizable-ne')) {
8652
- layerFeatures.horizontalAlign('right', false);
8653
- layerFeatures.verticalAlign('top', false);
8654
- } else if ($target.hasClass('nui-resizable-e')) {
8655
- layerFeatures.horizontalAlign('right', false);
8656
- layerFeatures.verticalAlign('middle', false);
8657
- } else if ($target.hasClass('nui-resizable-se')) {
8658
- layerFeatures.horizontalAlign('right', false);
8659
- layerFeatures.verticalAlign('bottom', false);
8660
- }
8661
- }
8662
- this._resizableJustClick = false;
8663
- }, this)
8664
- });
8665
- }, this),
8666
- smartguides: $.proxy(function () {
8667
- this.$layer.triggerHandler('LayerParent');
8668
- return this.fragmentEditor.getSnap();
8669
- }, this),
8670
- tolerance: 5
8671
- })
8672
- .on({
8673
- 'mousedown.n2-ss-absolute': $.proxy(function (e) {
8674
- if (!this.layer.status != N2Classes.ComponentAbstract.STATUS.LOCKED) {
8675
- N2Classes.PositionDisplay.get().show('Canvas');
8676
 
8677
- N2Classes.PositionDisplay.get().update(e, 'Canvas', 'W: ' + parseInt(this.$layer.width()) + 'px<br />H: ' + parseInt(this.$layer.height()) + 'px');
8678
 
8679
- }
8680
- if (document.activeElement) {
8681
- document.activeElement.blur();
8682
- }
8683
- }, this),
8684
- 'mouseup.n2-ss-absolute': $.proxy(function (e) {
8685
- N2Classes.PositionDisplay.get().hide('Canvas');
8686
- }, this)
8687
- });
8688
- };
8689
 
8690
- PlacementAbsolute.prototype.____makeLayerResizeableStart = function (event, ui) {
8691
- this.preventActivation = true;
8692
- this.resizableDeferred = $.Deferred();
8693
- this.fragmentEditor.layerWindow.hideWithDeferred(this.resizableDeferred);
8694
- $('body').addClass('n2-ss-resize-layer');
8695
- if (this._resizableJustClick) {
8696
- this._resizableJustClick = false;
8697
- }
8698
- this.____makeLayerResizeableResize(event, ui);
8699
- N2Classes.PositionDisplay.get().show('Canvas');
8700
- };
8701
 
8702
- PlacementAbsolute.prototype.____makeLayerResizeableResize = function (e, ui) {
8703
 
 
8704
 
8705
- N2Classes.PositionDisplay.get().update(e, 'Canvas', 'W: ' + ui.size.width + 'px<br />H: ' + ui.size.height + 'px');
 
 
 
8706
 
8707
- this.triggerLayerResized();
8708
  };
8709
 
8710
- PlacementAbsolute.prototype.____makeLayerResizeableStop = function (event, ui) {
8711
- $('body').removeClass('n2-ss-resize-layer');
8712
- this.resizableDeferred.resolve();
8713
-
8714
- var isAutoWidth = false;
8715
- if (ui.axis == "n" || ui.axis == "s" || ui.originalSize.width == ui.size.width) {
8716
- var currentValue = this.layer.getProperty('width');
8717
- if (this.layer.isDimensionPropertyAccepted(currentValue)) {
8718
- isAutoWidth = true;
8719
- this._syncwidth();
8720
- }
 
8721
  }
8722
 
8723
- var isAutoHeight = false;
8724
- if (ui.axis == "e" || ui.axis == "w" || ui.originalSize.height == ui.size.height) {
8725
- var currentValue = this.layer.getProperty('height');
8726
- if (this.layer.isDimensionPropertyAccepted(currentValue)) {
8727
- isAutoHeight = true;
8728
- this._syncheight();
8729
- }
8730
  }
 
 
8731
 
8732
- var ratioSizeH = this.fragmentEditor.getResponsiveRatioHorizontal(),
8733
- ratioSizeV = this.fragmentEditor.getResponsiveRatioVertical();
 
8734
 
8735
- if (!parseInt(this.layer.getProperty('responsivesize'))) {
8736
- ratioSizeH = ratioSizeV = 1;
8737
- }
8738
- var width = null;
8739
- if (!isAutoWidth) {
8740
- width = Math.round(ui.size.width * (1 / ratioSizeH));
8741
- }
8742
- var height = null;
8743
- if (!isAutoHeight) {
8744
- height = Math.round(ui.size.height * (1 / ratioSizeV));
 
 
 
 
 
8745
  }
8746
 
8747
- this._setPosition(null, null, ui.position.left, ui.position.top, width, height, true);
8748
 
8749
- this.triggerLayerResized();
8750
 
8751
- this.$layer.triggerHandler('LayerUnParent');
 
 
 
 
 
 
 
 
 
8752
 
8753
- N2Classes.PositionDisplay.get().hide('Canvas');
 
 
 
8754
 
8755
- setTimeout($.proxy(function () {
8756
- this.preventActivation = false;
8757
- }, this), 80);
8758
 
8759
- //this.fragmentEditor.panel.positionMenu(this.$layer);
8760
  };
8761
- //</editor-fold>
8762
 
8763
- PlacementAbsolute.prototype._setPosition = function (align, valign, left, top, width, height, isPositionAbsolute) {
8764
- var mode = this.layer.getMode();
8765
- if (align === null) {
8766
- align = this.layer.getProperty('align');
8767
- }
8768
- if (valign === null) {
8769
- valign = this.layer.getProperty('valign');
8770
- }
8771
 
8772
- if (left === null) {
8773
- left = this.layer.getProperty('left');
8774
- } else if (isPositionAbsolute) {
8775
- left = this.calculatePositionLeft(align, left);
8776
- }
8777
 
8778
- if (top === null) {
8779
- top = this.layer.getProperty('top');
8780
- } else if (isPositionAbsolute) {
8781
- top = this.calculatePositionTop(valign, top);
8782
- }
8783
 
8784
- if (width === null) {
8785
- width = this.layer.getProperty('width');
8786
- }
 
 
8787
 
8788
- if (height === null) {
8789
- height = this.layer.getProperty('height');
8790
- }
 
8791
 
8792
- var task = N2Classes.History.get().addValue(this.layer, this.layer.historyStoreOnPlacement, ['historyStorePosition', mode]);
8793
- if (task) {
8794
- task.setValues({
8795
- align: this.layer.getRawProperty('align'),
8796
- valign: this.layer.getRawProperty('valign'),
8797
- left: this.layer.getRawProperty('left'),
8798
- top: this.layer.getRawProperty('top'),
8799
- width: this.layer.getRawProperty('width'),
8800
- height: this.layer.getRawProperty('height')
8801
- }, {
8802
- align: align,
8803
- valign: valign,
8804
- left: left,
8805
- top: top,
8806
- width: width,
8807
- height: height
8808
- });
8809
- }
8810
 
8811
- N2Classes.History.get().off();
 
 
8812
 
8813
- this.layer.store('width', width, true, 'layer');
8814
- this.layer.$.trigger('propertyChanged', ['width', width]);
 
 
 
8815
 
8816
- this.layer.store('height', height, true, 'layer');
8817
- this.layer.$.trigger('propertyChanged', ['height', height]);
8818
 
8819
- this.layer.store('align', align, true, 'layer');
8820
- this.layer.$.trigger('propertyChanged', ['align', align]);
8821
 
8822
- this.layer.store('valign', valign, true, 'layer');
8823
- this.layer.$.trigger('propertyChanged', ['valign', valign]);
8824
 
8825
- this.layer.store('left', left, true, 'layer');
8826
- this.layer.$.trigger('propertyChanged', ['left', left]);
8827
 
8828
- this.layer.store('top', top, true, 'layer');
8829
- this.layer.$.trigger('propertyChanged', ['top', top]);
 
 
 
8830
 
8831
- N2Classes.History.get().on();
 
8832
 
8833
- };
8834
 
8835
- PlacementAbsolute.prototype.historyStorePosition = function (values, mode) {
 
 
 
8836
 
8837
- this.layer.historyStore(values.align, 'align', mode);
8838
- this.layer.historyStore(values.valign, 'valign', mode);
 
 
8839
 
8840
- this.layer.historyStore(values.width, 'width', mode);
8841
- this.layer.historyStore(values.height, 'height', mode);
 
 
 
 
8842
 
8843
- this.layer.historyStore(values.left, 'left', mode);
8844
- this.layer.historyStore(values.top, 'top', mode);
 
8845
 
8846
- this.triggerLayerResized();
8847
- };
8848
 
8849
- PlacementAbsolute.prototype.calculatePositionLeft = function (align, left) {
8850
- var ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
8851
 
8852
- if (!parseInt(this.layer.getProperty('responsiveposition'))) {
8853
- ratioH = 1;
8854
- }
 
 
 
 
8855
 
8856
- var parent = this.parent,
8857
- p = {
8858
- left: 0,
8859
- leftMultiplier: 1
8860
- };
8861
- if (!parent || !parent.is(':visible')) {
8862
- parent = this.$layer.parent();
8863
 
 
 
 
 
 
 
 
8864
 
8865
- switch (align) {
8866
- case 'center':
8867
- p.left += parent.width() / 2;
8868
- break;
8869
- case 'right':
8870
- p.left += parent.width();
8871
- break;
8872
- }
8873
- } else {
8874
- var position = parent.position();
8875
- switch (this.layer.getProperty('parentalign')) {
8876
- case 'right':
8877
- p.left = position.left + parent.width();
8878
- break;
8879
- case 'center':
8880
- p.left = position.left + parent.width() / 2;
8881
- break;
8882
- default:
8883
- p.left = position.left;
8884
  }
8885
  }
8886
 
 
8887
 
8888
- var left;
8889
- switch (align) {
8890
- case 'left':
8891
- left = -Math.round((p.left - left) * (1 / ratioH));
8892
- break;
8893
- case 'center':
8894
- left = -Math.round((p.left - left - this.$layer.width() / 2) * (1 / ratioH));
8895
- break;
8896
- case 'right':
8897
- left = -Math.round((p.left - left - this.$layer.width()) * (1 / ratioH));
8898
- break;
8899
  }
8900
 
8901
- return left;
8902
- };
 
8903
 
 
8904
 
8905
- PlacementAbsolute.prototype.calculatePositionTop = function (valign, top) {
8906
- var ratioV = this.fragmentEditor.getResponsiveRatioVertical();
8907
 
8908
- if (!parseInt(this.layer.getProperty('responsiveposition'))) {
8909
- ratioV = 1;
8910
- }
8911
 
 
 
8912
 
8913
- var parent = this.parent,
8914
- p = {
8915
- top: 0,
8916
- topMultiplier: 1
 
 
 
8917
  };
8918
- if (!parent || !parent.is(':visible')) {
8919
- parent = this.$layer.parent();
8920
-
8921
- switch (valign) {
8922
- case 'middle':
8923
- p.top += parent.height() / 2;
8924
- break;
8925
- case 'bottom':
8926
- p.top += parent.height();
8927
- break;
8928
- }
8929
- } else {
8930
- var position = parent.position();
8931
 
8932
- switch (this.layer.getProperty('parentvalign')) {
8933
- case 'bottom':
8934
- p.top = position.top + parent.height();
8935
- break;
8936
- case 'middle':
8937
- p.top = position.top + parent.height() / 2;
8938
- break;
8939
- default:
8940
- p.top = position.top;
8941
  }
8942
  }
 
 
8943
 
8944
- var top;
8945
- switch (valign) {
8946
- case 'top':
8947
- top = -Math.round((p.top - top) * (1 / ratioV));
8948
- break;
8949
- case 'middle':
8950
- top = -Math.round((p.top - top - this.$layer.height() / 2) * (1 / ratioV));
8951
- break;
8952
- case 'bottom':
8953
- top = -Math.round((p.top - top - this.$layer.height()) * (1 / ratioV));
8954
- break;
 
 
 
 
 
8955
  }
8956
 
8957
- return top;
8958
  };
8959
 
8960
- PlacementAbsolute.prototype.moveX = function (x) {
 
8961
 
8962
- this._setPosition(null, null, this.layer.getProperty('left') + x, null, null, null, false);
8963
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8964
 
8965
- PlacementAbsolute.prototype.moveY = function (y) {
 
 
8966
 
8967
- this._setPosition(null, null, null, this.layer.getProperty('top') + y, null, null, false);
8968
  };
8969
 
8970
- PlacementAbsolute.prototype.setPositionLeft = function (left) {
8971
-
8972
- left = this.calculatePositionLeft(this.layer.getProperty('align'), left);
8973
-
8974
- this.layer.store('left', left, true);
8975
- this.layer.$.trigger('propertyChanged', ['left', left]);
8976
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8977
  };
8978
 
8979
- PlacementAbsolute.prototype.setPositionTop = function (top) {
 
8980
 
8981
- top = this.calculatePositionTop(this.layer.getProperty('valign'), top);
8982
 
8983
- this.layer.store('top', top, true);
8984
- this.layer.$.trigger('propertyChanged', ['top', top]);
8985
- };
8986
 
8987
- PlacementAbsolute.prototype.setPosition = function (left, top) {
8988
- this.setPositionLeft(left);
8989
- this.setPositionTop(top);
8990
  };
8991
 
8992
- PlacementAbsolute.prototype.setDeviceBasedAlign = function () {
8993
- var mode = this.layer.getMode();
8994
- if (typeof this.layer.deviceProperty[mode]['align'] == 'undefined') {
8995
- this.layer.setProperty('align', this.layer.getProperty('align'), 'layer');
8996
- }
8997
- if (typeof this.layer.deviceProperty[mode]['valign'] == 'undefined') {
8998
- this.layer.setProperty('valign', this.layer.getProperty('valign'), 'layer');
8999
- }
9000
  };
9001
- //</editor-fold
9002
 
 
9003
 
9004
- PlacementAbsolute.prototype.setPropertyresponsiveposition =
9005
- PlacementAbsolute.prototype.setPropertyresponsivesize = function (name, value, from) {
9006
- this.layer._setProperty(name, parseInt(value), from);
9007
- };
9008
 
 
 
 
9009
 
9010
- PlacementAbsolute.prototype.setPropertywidth =
9011
- PlacementAbsolute.prototype.setPropertyheight = function (name, value, from) {
9012
- var v = value;
9013
- if (!this.layer.isDimensionPropertyAccepted(value)) {
9014
- v = ~~value;
9015
- if (v != value) {
9016
- this.layer.$.trigger('propertyChanged', [name, v]);
 
 
 
 
 
 
 
 
 
 
 
9017
  }
 
 
 
 
 
 
9018
  }
9019
- setTimeout($.proxy(function () {
9020
- this.onResize(false);
9021
- }, this), 50);
9022
 
9023
- this.layer._setProperty(name, v, from);
9024
- };
9025
 
9026
- PlacementAbsolute.prototype.setPropertyleft =
9027
- PlacementAbsolute.prototype.setPropertytop = function (name, value, from) {
9028
- var v = ~~value;
9029
- if (v != value) {
9030
- this.layer.$.trigger('propertyChanged', [name, v]);
9031
- }
9032
- this.layer._setProperty(name, v, from);
9033
- };
9034
 
9035
- PlacementAbsolute.prototype.render = function (name) {
9036
- this['_sync' + name]();
9037
- };
9038
 
9039
- PlacementAbsolute.prototype.renderWithModifier = function (name, value, modifier) {
9040
- try {
9041
- if ((name == 'width' || name == 'height') && this.layer.isDimensionPropertyAccepted(value)) {
9042
- this['_sync' + name](value);
9043
- } else {
9044
- this['_sync' + name](Math.round(value * modifier));
9045
- }
9046
- } catch (e) {
9047
- console.error('_sync' + name);
9048
- }
9049
- };
9050
 
9051
- PlacementAbsolute.prototype.onResize = function (isForced) {
9052
- this.resize({
9053
- slideW: this.fragmentEditor.getResponsiveRatioHorizontal(),
9054
- slideH: this.fragmentEditor.getResponsiveRatioVertical()
9055
- }, isForced);
9056
- };
9057
 
9058
- PlacementAbsolute.prototype.resize = function (ratios, isForced) {
 
9059
 
9060
- if (!this.parent || isForced) {
9061
- //this.doThrottledTheResize(ratios, false);
9062
- this.addToResizeCollection(this, ratios, false);
9063
- }
9064
- };
9065
 
9066
- PlacementAbsolute.prototype.addToResizeCollection = function (layer, ratios, isThrottled) {
9067
- resizeCollection.ratios = ratios;
9068
- resizeCollection.isThrottled = isThrottled;
9069
- for (var i = 0; i < resizeCollection.layers.length; i++) {
9070
- if (resizeCollection.layers[i] == this) {
9071
- resizeCollection.layers.splice(i, 1);
9072
- break;
9073
- }
9074
- }
9075
- resizeCollection.layers.push(layer);
9076
 
9077
- requestRender();
9078
- this.triggerLayerResized(isThrottled, ratios);
9079
- };
 
 
 
 
 
 
 
 
 
 
9080
 
9081
- PlacementAbsolute.prototype._syncresponsiveposition = function () {
9082
- this.onResize(false);
9083
- };
9084
 
9085
- PlacementAbsolute.prototype._syncwidth = function () {
9086
- var value = this.layer.getProperty('width');
 
9087
 
9088
- if (!this.layer.isDimensionPropertyAccepted(value)) {
9089
- if (parseInt(this.layer.getProperty('responsivesize'))) {
9090
- var ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
9091
- value = (value * ratio);
9092
- }
9093
- value += 'px';
9094
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9095
 
9096
- this.$layer.css('width', value);
9097
- };
 
 
 
 
9098
 
9099
- PlacementAbsolute.prototype._syncheight = function () {
9100
- var value = this.layer.getProperty('height');
9101
- if (!this.layer.isDimensionPropertyAccepted(value)) {
9102
- if (parseInt(this.layer.getProperty('responsivesize'))) {
9103
- var ratio = this.fragmentEditor.getResponsiveRatioVertical();
9104
- value = (value * ratio);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9105
  }
9106
- value += 'px';
9107
  }
 
9108
 
9109
- this.$layer.css('height', value);
9110
- };
 
 
9111
 
9112
- PlacementAbsolute.prototype._syncparentalign = function () {
9113
- var value = this.layer.getProperty('parentalign');
9114
- this.$layer.data('parentalign', value);
9115
- var parent = this.getParent();
9116
- if (parent) {
9117
- parent.placement.current.onResize(false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9118
  }
9119
  };
9120
 
9121
- PlacementAbsolute.prototype._syncparentvalign = function () {
9122
- var value = this.layer.getProperty('parentvalign');
9123
- this.$layer.data('parentvalign', value);
9124
- var parent = this.getParent();
9125
- if (parent) {
9126
- parent.placement.current.onResize(false);
 
 
 
 
 
 
 
 
 
9127
  }
 
9128
  };
9129
 
 
 
9130
 
9131
- PlacementAbsolute.prototype._syncleft = function () {
9132
- var value = this.layer.getProperty('left');
9133
 
9134
- if (parseInt(this.layer.getProperty('responsiveposition'))) {
9135
- var ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
9136
- value = (value * ratio);
9137
  }
 
9138
 
9139
- if (!this.parent || !this.parentIsVisible) {
9140
- switch (this.layer.getProperty('align')) {
9141
- case 'right':
9142
- this.$layer.css({
9143
- left: 'auto',
9144
- right: -value + 'px'
9145
- });
9146
- break;
9147
- case 'center':
9148
- this.$layer.css({
9149
- left: (this.$layer.parent().width() / 2 + value - this.$layer.width() / 2) + 'px',
9150
- right: 'auto'
9151
- });
9152
- break;
9153
- default:
9154
- this.$layer.css({
9155
- left: value + 'px',
9156
- right: 'auto'
9157
- });
9158
- }
9159
- } else {
9160
- var position = this.parent.position(),
9161
- align = this.layer.getProperty('align'),
9162
- parentAlign = this.layer.getProperty('parentalign'),
9163
- left = 0;
9164
- switch (parentAlign) {
9165
- case 'right':
9166
- left = position.left + this.parent.width();
9167
- break;
9168
- case 'center':
9169
- left = position.left + this.parent.width() / 2;
9170
- break;
9171
- default:
9172
- left = position.left;
9173
- }
9174
-
9175
- switch (align) {
9176
- case 'right':
9177
- this.$layer.css({
9178
- left: 'auto',
9179
- right: (this.$layer.parent().width() - left - value) + 'px'
9180
- });
9181
- break;
9182
- case 'center':
9183
- this.$layer.css({
9184
- left: (left + value - this.$layer.width() / 2) + 'px',
9185
- right: 'auto'
9186
- });
9187
- break;
9188
- default:
9189
- this.$layer.css({
9190
- left: (left + value) + 'px',
9191
- right: 'auto'
9192
- });
9193
- }
9194
 
 
 
 
 
 
 
9195
  }
9196
 
9197
- this.triggerLayerResized();
 
 
 
 
9198
  };
9199
 
9200
- PlacementAbsolute.prototype._synctop = function () {
9201
- var value = this.layer.getProperty('top');
 
 
9202
 
9203
- if (parseInt(this.layer.getProperty('responsiveposition'))) {
9204
- var ratio = this.fragmentEditor.getResponsiveRatioVertical();
9205
- value = (value * ratio);
9206
- }
9207
 
9208
- if (!this.parent || !this.parentIsVisible) {
9209
- switch (this.layer.getProperty('valign')) {
9210
- case 'bottom':
9211
- this.$layer.css({
9212
- top: 'auto',
9213
- bottom: -value + 'px'
9214
- });
9215
- break;
9216
- case 'middle':
9217
- this.$layer.css({
9218
- top: (this.$layer.parent().height() / 2 + value - this.$layer.height() / 2) + 'px',
9219
- bottom: 'auto'
9220
- });
9221
- break;
9222
- default:
9223
- this.$layer.css({
9224
- top: value + 'px',
9225
- bottom: 'auto'
9226
- });
9227
- }
9228
- } else {
9229
- var position = this.parent.position(),
9230
- valign = this.layer.getProperty('valign'),
9231
- parentVAlign = this.layer.getProperty('parentvalign'),
9232
- top = 0;
9233
- switch (parentVAlign) {
9234
- case 'bottom':
9235
- top = position.top + this.parent.height();
9236
- break;
9237
- case 'middle':
9238
- top = position.top + this.parent.height() / 2;
9239
- break;
9240
- default:
9241
- top = position.top;
9242
- }
9243
 
9244
- switch (valign) {
9245
- case 'bottom':
9246
- this.$layer.css({
9247
- top: 'auto',
9248
- bottom: (this.$layer.parent().height() - top - value) + 'px'
9249
- });
9250
- break;
9251
- case 'middle':
9252
- this.$layer.css({
9253
- top: (top + value - this.$layer.height() / 2) + 'px',
9254
- bottom: 'auto'
9255
- });
9256
- break;
9257
- default:
9258
- this.$layer.css({
9259
- top: (top + value) + 'px',
9260
- bottom: 'auto'
9261
- });
9262
  }
 
 
9263
  }
 
9264
 
9265
- this.triggerLayerResized();
 
 
 
 
9266
  };
9267
 
9268
- PlacementAbsolute.prototype._syncresponsivesize = function () {
9269
- this.onResize(false);
9270
  };
9271
 
9272
- PlacementAbsolute.prototype.historyStoreDoubleProp = function (data, mode, prop, prop2) {
9273
- var currentMode = this.layer.getMode();
9274
- if (mode == currentMode) {
9275
- this.layer._setProperty(prop, data.value, 'history');
9276
- this.layer._setProperty(prop2, data.value2, 'history');
9277
- } else {
9278
- this.layer.deviceProperty[mode][prop] = data.value;
9279
- this.layer.deviceProperty[mode][prop2] = data.value2;
9280
- this.layer.$.trigger('propertyChanged', [prop, this.layer.getProperty(prop)]);
9281
- this.layer.$.trigger('propertyChanged', [prop2, this.layer.getProperty(prop2)]);
9282
- this.layer.render(prop, null, 'history');
9283
- this.layer.render(prop2, null, 'history');
 
 
 
 
 
 
 
 
 
 
9284
  }
9285
  };
9286
 
9287
- PlacementAbsolute.prototype.setPropertyalign = function (name, value, from) {
9288
- var oldValue = this.layer.getProperty(name),
9289
- oldLeft = this.layer.getRawProperty('left');
9290
-
9291
- N2Classes.History.get().off();
9292
- this.layer._setProperty(name, value, from);
9293
- N2Classes.History.get().on();
9294
 
9295
- var task = N2Classes.History.get().addValue(this.layer, this.layer.historyStoreOnPlacement, ['historyStoreDoubleProp', this.layer.getMode(), 'align', 'left']);
9296
- if (task) {
9297
- task.setValues({
9298
- value: oldValue,
9299
- value2: oldLeft
9300
- }, {
9301
- value: value,
9302
- value2: this.layer.getRawProperty('left')
9303
- });
9304
  }
 
 
9305
  };
9306
 
9307
- PlacementAbsolute.prototype.setPropertyvalign = function (name, value, from) {
9308
- var oldValue = this.layer.getProperty(name),
9309
- oldTop = this.layer.getRawProperty('top');
 
9310
 
9311
- N2Classes.History.get().off();
9312
- this.layer._setProperty(name, value, from);
9313
- N2Classes.History.get().on();
 
 
 
9314
 
9315
- var task = N2Classes.History.get().addValue(this.layer, this.layer.historyStoreOnPlacement, ['historyStoreDoubleProp', this.layer.getMode(), 'valign', 'top']);
9316
- if (task) {
9317
- task.setValues({
9318
- value: oldValue,
9319
- value2: oldTop
9320
- }, {
9321
- value: value,
9322
- value2: this.layer.getRawProperty('top')
9323
- });
9324
  }
9325
- };
9326
 
9327
- PlacementAbsolute.prototype._syncalign = function (oldValue, from) {
9328
- var value = this.layer.getProperty('align');
9329
- this.$layer.attr('data-align', value);
9330
 
9331
- if (from !== 'history' && value != oldValue) {
9332
- this.setPositionLeft(this.$layer.position().left);
9333
- }
 
 
9334
  };
9335
- PlacementAbsolute.prototype._syncvalign = function (oldValue, from) {
9336
- var value = this.layer.getProperty('valign');
9337
- this.$layer.attr('data-valign', value);
9338
 
9339
- if (from !== 'history' && value != oldValue) {
9340
- this.setPositionTop(this.$layer.position().top);
9341
- }
9342
- };
9343
 
9344
- PlacementAbsolute.prototype.fit = function () {
9345
- var layer = this.$layer.get(0);
9346
 
9347
- var position = this.$layer.position();
 
 
 
 
 
9348
 
9349
- if (layer.scrollWidth > 0 && layer.scrollHeight > 0) {
9350
- var resized = false;
9351
- if (this.layer.item) {
9352
- resized = this.layer.item.fitLayer();
9353
- }
9354
- if (!resized) {
9355
- this.layer.setProperty('width', 'auto', 'layer');
9356
- this.layer.setProperty('height', 'auto', 'layer');
9357
 
9358
- var layerWidth = this.$layer.width();
9359
- if (Math.abs(this.fragmentEditor.mainContainer.layer.width() - this.$layer.position().left - layerWidth) < 2) {
9360
- this.layer.setProperty('width', layerWidth, 'layer');
9361
- }
9362
- }
 
 
9363
  }
9364
- };
9365
 
9366
- PlacementAbsolute.prototype.hide = function (targetMode) {
9367
- this.layer.store((targetMode ? targetMode : this.layer.getMode()), 0, true);
9368
  };
9369
 
9370
- PlacementAbsolute.prototype.show = function (targetMode) {
9371
- this.layer.store((targetMode ? targetMode : this.layer.getMode()), 1, true);
9372
- };
9373
 
 
9374
 
9375
- PlacementAbsolute.prototype.changeStatus = function (oldStatus, newStatus) {
9376
 
9377
- if (oldStatus == N2Classes.ComponentAbstract.STATUS.LOCKED) {
9378
- this.layer.nUIResizable("enable");
9379
- }
9380
 
 
9381
 
9382
- if (newStatus == N2Classes.ComponentAbstract.STATUS.LOCKED) {
9383
- this.$layer.nUIResizable("disable");
9384
- }
9385
  };
9386
 
9387
- PlacementAbsolute.prototype.getParent = function () {
9388
- return $('#' + this.layer.getProperty('parentid')).data('layerObject');
 
 
 
 
 
 
9389
  };
9390
 
9391
- PlacementAbsolute.prototype.subscribeParent = function () {
9392
- var that = this;
9393
- var $newParent = $('#' + this.layer.property.parentid);
9394
- if (this.parent && !$newParent.is(this.parent)) {
9395
- this.parent.off(this.subscribeParentCallbacks);
9396
- this.parent = false;
9397
- }
9398
- if (!this.parent) {
9399
- this.subscribeParentCallbacks = {
9400
- LayerResized: function () {
9401
- that.resizeParent.apply(that, arguments);
9402
- },
9403
- LayerParent: function () {
9404
- that.$layer.addClass('n2-ss-layer-parent');
9405
- that.$layer.triggerHandler('LayerParent');
9406
- },
9407
- LayerUnParent: function () {
9408
- that.$layer.removeClass('n2-ss-layer-parent');
9409
- that.$layer.triggerHandler('LayerUnParent');
9410
- },
9411
- LayerDeleted: function (e) {
9412
 
9413
- that.layer.setProperty('parentid', '', 'layer');
9414
- },
9415
- LayerUnavailable: function (e) {
 
9416
 
9417
- that.layer.setProperty('parentid', '', 'layer');
9418
- that.layer.setProperty('left', 0, 'layer');
9419
- that.layer.setProperty('top', 0, 'layer');
9420
- },
9421
- LayerShowChange: function (e, mode, value) {
9422
- if (that.layer.getMode() == mode) {
9423
- that.parentIsVisible = value;
9424
- }
9425
- },
9426
- 'n2-ss-activate': function () {
9427
- that.$layerRow.addClass('n2-parent-active');
9428
- },
9429
- 'n2-ss-deactivate': function () {
9430
- that.$layerRow.removeClass('n2-parent-active');
9431
- },
9432
- 'LayerGetDataWithChildren': function (e, layersData, layers) {
9433
- that.layer.getDataWithChildren(layersData, layers);
9434
- }
9435
- };
9436
- this.parent = $newParent.on(this.subscribeParentCallbacks);
9437
- this.parent.data('layerObject').placement.current.addChild(this);
9438
- this.$layer.addClass('n2-ss-layer-has-parent');
9439
- }
9440
- };
9441
 
9442
- PlacementAbsolute.prototype.unSubscribeParent = function (context) {
9443
- this.$layerRow.removeClass('n2-parent-active');
9444
- this.$layer.removeClass('n2-ss-layer-has-parent');
9445
- if (this.parent) {
9446
- this.parent.off(this.subscribeParentCallbacks);
9447
- this.parent = false;
9448
- this.subscribeParentCallbacks = {};
9449
- if (context != 'delete') {
9450
- var position = this.$layer.position();
9451
- this._setPosition(null, null, position.left, position.top, null, null, true);
9452
- }
9453
- }
9454
 
9455
- };
 
9456
 
9457
- PlacementAbsolute.prototype.addChild = function (childPlacement) {
9458
- this.children.push(childPlacement);
9459
- };
 
 
 
9460
 
9461
- PlacementAbsolute.prototype.removeChild = function (childPlacement) {
9462
- this.children.splice($.inArray(childPlacement, this.children), 1);
9463
- };
9464
 
9465
- PlacementAbsolute.prototype.unlink = function (e) {
9466
- if (e) e.preventDefault();
9467
- this.layer.setProperty('parentid', '', 'layer');
9468
- };
9469
 
9470
- PlacementAbsolute.prototype.parentPicked = function (parentObject, parentAlign, parentValign, align, valign) {
9471
- this.layer.setProperty('parentid', '', 'layer');
9472
 
9473
- this.layer.setProperty('align', align, 'layer');
9474
- this.layer.setProperty('valign', valign, 'layer');
9475
- this.layer.setProperty('parentalign', parentAlign, 'layer');
9476
- this.layer.setProperty('parentvalign', parentValign, 'layer');
9477
 
9478
- this.layer.setProperty('parentid', parentObject.requestID(), 'layer');
 
9479
 
9480
- var undef;
9481
- for (var device in this.layer.deviceProperty) {
9482
- if (device == 'desktopPortrait') continue;
9483
- this.layer.deviceProperty[device].left = undef;
9484
- this.layer.deviceProperty[device].top = undef;
9485
- this.layer.deviceProperty[device].valign = undef;
9486
- this.layer.deviceProperty[device].align = undef;
9487
- }
9488
  };
9489
 
9490
- PlacementAbsolute.prototype._syncparentid = function () {
9491
- var value = this.layer.getProperty('parentid');
9492
- if (!value || value == '') {
9493
- this.$layer.removeAttr('data-parentid');
9494
- this.unSubscribeParent();
9495
- } else {
9496
- //setTimeout($.proxy(function () {
9497
- if ($('#' + value).length == 0) {
9498
- this.layer.setProperty('parentid', '', 'layer');
9499
- } else {
9500
- this.$layer.attr('data-parentid', value).addClass('n2-ss-layer-has-parent');
9501
- this.subscribeParent();
9502
- var position = this.$layer.position();
9503
- this._setPosition(null, null, position.left, position.top, null, null, true);
9504
- }
9505
- //}, this), 50);
9506
- }
9507
  };
9508
 
9509
- PlacementAbsolute.prototype.snap = function () {
9510
- this.$layer.nextendResizable("option", "smartguides", $.proxy(function () {
9511
- this.$layer.triggerHandler('LayerParent');
9512
- return this.fragmentEditor.getSnap();
9513
- }, this));
9514
  };
9515
 
9516
- PlacementAbsolute.prototype._renderModeProperties = function (isReset) {
 
9517
 
9518
- this.$layer.attr('data-align', this.layer.property.align);
9519
- this.$layer.attr('data-valign', this.layer.property.valign);
9520
- if (isReset) {
9521
- this.onResize(true);
9522
- }
9523
  };
9524
 
9525
- PlacementAbsolute.prototype.doLinearResize = function (ratios) {
9526
- this.doThrottledTheResize(ratios, true);
 
9527
  };
9528
 
9529
- PlacementAbsolute.prototype.doTheResize = function (ratios, isLinear, isThrottled) {
9530
-
9531
- this.render('width');
9532
- this.render('height');
9533
 
9534
- this.render('left');
9535
- this.render('top');
 
 
9536
 
9537
- if (!isLinear) {
9538
- this.triggerLayerResized(isThrottled, ratios);
9539
- }
9540
- };
 
 
9541
 
9542
- PlacementAbsolute.prototype.resizeParent = function (e, ratios, isThrottled) {
9543
- this.addToResizeCollection(this, ratios, isThrottled);
9544
- };
 
9545
 
9546
- PlacementAbsolute.prototype.updatePosition = function () {
9547
- var parent = this.parent;
9548
-
9549
- if (this.layer.getProperty('align') == 'center') {
9550
- var left = 0;
9551
- if (parent) {
9552
- left = parent.position().left + parent.width() / 2;
9553
- } else {
9554
- left = this.$layer.parent().width() / 2;
9555
- }
9556
- var ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
9557
- if (!parseInt(this.layer.getProperty('responsiveposition'))) {
9558
- ratio = 1;
9559
- }
9560
- this.$layer.css('left', (left - this.$layer.width() / 2 + this.layer.getProperty('left') * ratio));
9561
- }
9562
-
9563
- if (this.layer.getProperty('valign') == 'middle') {
9564
- var top = 0;
9565
- if (parent) {
9566
- top = parent.position().top + parent.height() / 2;
9567
- } else {
9568
- top = this.$layer.parent().height() / 2;
9569
- }
9570
- var ratio = this.fragmentEditor.getResponsiveRatioVertical();
9571
- if (!parseInt(this.layer.getProperty('responsiveposition'))) {
9572
- ratio = 1;
9573
- }
9574
- this.$layer.css('top', (top - this.$layer.height() / 2 + this.layer.getProperty('top') * ratio));
9575
- }
9576
- this.triggerLayerResized();
9577
- };
9578
-
9579
- PlacementAbsolute.prototype.getIndex = function () {
9580
- var index = parseInt(this.$layer.css('zIndex'));
9581
- if (isNaN(index)) {
9582
- index = 0;
9583
- }
9584
- return index;
9585
- };
9586
 
9587
- PlacementAbsolute.prototype.renderIndex = function (index) {
9588
- //this.layer.layer.css('zIndex', index + 1);
9589
- };
 
9590
 
9591
- PlacementAbsolute.prototype.sync = function () {
9592
 
9593
- this._syncalign(null, 'history');
9594
- this._syncvalign(null, 'history');
9595
 
9596
- this._syncwidth();
9597
- this._syncheight();
9598
- this._synctop();
9599
- this._syncleft();
9600
 
9601
- this._syncparentid();
9602
 
 
9603
  };
9604
 
9605
- PlacementAbsolute.prototype.delete = function () {
9606
-
9607
- var parentId = this.layer.getProperty('parentid');
9608
- if (parentId) {
9609
- this.unSubscribeParent('delete');
9610
- }
9611
- };
9612
 
9613
- PlacementAbsolute.prototype.isParentOrChild = function () {
9614
- return this.parent || this.children.length > 0;
9615
  };
9616
 
9617
- return PlacementAbsolute;
9618
- });
9619
- N2D('PlacementContent', ['PlacementAbstract'], function ($, undefined) {
9620
- "use strict";
9621
 
9622
- /**
9623
- * @memberOf N2Classes
9624
- *
9625
- * @param placement
9626
- * @param layer
9627
- * @param fragmentEditor
9628
- * @constructor
9629
- */
9630
- function PlacementContent(placement, layer, fragmentEditor) {
9631
- this.type = 'content';
9632
 
9633
- N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
9634
- }
9635
 
9636
- PlacementContent.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
9637
- PlacementContent.prototype.constructor = PlacementContent;
 
 
 
 
 
 
 
9638
 
9639
- return PlacementContent;
9640
- });
9641
- N2D('PlacementDefault', ['PlacementAbstract'], function ($, undefined) {
9642
- "use strict";
9643
 
9644
- /**
9645
- * @memberOf N2Classes
9646
- *
9647
- * @param placement
9648
- * @param layer
9649
- * @param fragmentEditor
9650
- * @constructor
9651
- */
9652
- function PlacementDefault(placement, layer, fragmentEditor) {
9653
- this.type = 'default';
9654
 
9655
- N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
9656
- }
9657
 
9658
- PlacementDefault.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
9659
- PlacementDefault.prototype.constructor = PlacementDefault;
9660
 
9661
- PlacementDefault.prototype.start = function () {
9662
- this.$layer = this.layer.layer;
9663
  };
9664
 
9665
-
9666
- PlacementDefault.prototype.activated = function (properties) {
9667
-
9668
- this.startUISizing();
 
 
 
 
 
 
 
9669
  };
9670
 
9671
- PlacementDefault.prototype.deActivated = function (newMode) {
9672
- this.$layer.nUINormalSizing('destroy');
 
 
 
 
 
 
 
9673
  };
9674
 
9675
- PlacementDefault.prototype.startUISizing = function () {
9676
- var needSize = false;
9677
- if (this.layer.item && this.layer.item.needSize) {
9678
- needSize = true;
9679
- }
9680
- this.$layer.nUINormalSizing({
9681
- start: $.proxy(function (e, prop) {
9682
- N2Classes.PositionDisplay.get().show('NormalSizing');
9683
- if (prop === 'maxwidth') {
9684
- this.layer.layer.attr('data-has-maxwidth', '1');
9685
- }
9686
- }, this),
9687
- resizeMaxWidth: $.proxy(function (e, ui) {
9688
 
9689
- N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Max-width: ' + (ui.value == 0 ? 'none' : (ui.value + 'px')));
9690
 
9691
- }, this),
9692
- stopMaxWidth: $.proxy(function (e, ui) {
9693
- N2Classes.PositionDisplay.get().hide('NormalSizing');
9694
- this.layer.setProperty('maxwidth', ui.value);
9695
- }, this)
9696
- });
9697
- };
 
 
 
9698
 
9699
- return PlacementDefault;
9700
- });
9701
- N2D('PlacementNormal', ['PlacementAbstract'], function ($, undefined) {
9702
- "use strict";
9703
 
9704
- /**
9705
- * @memberOf N2Classes
9706
- *
9707
- * @param placement
9708
- * @param layer
9709
- * @param fragmentEditor
9710
- * @constructor
9711
- * @augments PlacementAbstract
9712
 
9713
- */
9714
- function PlacementNormal(placement, layer, fragmentEditor) {
9715
- this.type = 'normal';
9716
 
9717
- this.transferredProperties = {};
 
 
 
9718
 
9719
- N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
9720
- }
 
9721
 
9722
- PlacementNormal.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
9723
- PlacementNormal.prototype.constructor = PlacementNormal;
9724
 
9725
- PlacementNormal.prototype.start = function () {
9726
- this.$layer = this.layer.layer;
9727
- };
 
 
9728
 
9729
- PlacementNormal.prototype.preActivation = function (lastPlacement) {
9730
- if (lastPlacement.type == 'absolute' && this.layer.item && this.layer.item.needSize) {
9731
- var height = this.layer.getProperty('height');
9732
- if (height.match && height.match(/[0-9]+%$/)) {
9733
- this.transferredProperties.height = Math.max(100, parseInt(this.$layer.parent().height() * parseInt(height) / 100));
9734
- } else if (height > 0) {
9735
- this.transferredProperties.height = height;
9736
- }
9737
  }
9738
- };
9739
 
9740
- PlacementNormal.prototype.activated = function (properties) {
9741
- this.loadProperties($.extend(properties, this.transferredProperties));
9742
- this.transferredProperties = {};
9743
 
9744
- this.layer.$.on('baseSizeUpdated.placementnormal', $.proxy(this._syncmargin, this));
9745
- this.layer.$.on('baseSizeUpdated.placementnormal', $.proxy(this._syncheight, this));
 
9746
 
9747
- this.startUISpacing();
9748
 
9749
- this.startUISizing();
9750
 
9751
- this.$layer.on({
9752
- mousedown: $.proxy(function (e) {
9753
- e.stopPropagation();
9754
- })
9755
- });
9756
- };
9757
-
9758
- PlacementNormal.prototype.loadProperties = function (options) {
9759
- this.layer.createDeviceProperty('margin', {desktopPortrait: '0|*|0|*|0|*|0|*|px+'}, this.layer.layer, this);
9760
- this.layer.createDeviceProperty('height', {desktopPortrait: (options.height || 0)}, this.layer.layer, this);
9761
- this.layer.createDeviceProperty('maxwidth', {desktopPortrait: 0}, this.layer.layer, this);
9762
- this.layer.createDeviceProperty('selfalign', {desktopPortrait: 'inherit'}, this.layer.layer, this);
9763
- };
9764
-
9765
- PlacementNormal.cleanLayer = function ($layer) {
9766
- var devices = [
9767
- 'desktopPortrait',
9768
- 'desktopLandscape',
9769
- 'tabletPortrait',
9770
- 'tabletLandscape',
9771
- 'mobilePortrait',
9772
- 'mobileLandscape'
9773
- ];
9774
-
9775
- $layer
9776
- .attr('data-has-maxwidth', '0')
9777
- .removeAttr('data-cssselfalign')
9778
- .css({
9779
- position: '',
9780
- margin: '',
9781
- height: '',
9782
- maxWidth: ''
9783
- });
9784
-
9785
- var properties = ['margin', 'height', 'maxwidth', 'selfalign'];
9786
-
9787
- var data = {};
9788
- for (var i = 0; i < properties.length; i++) {
9789
- var prop = properties[i].toLowerCase();
9790
- data[prop] = $layer.data(prop);
9791
- $layer.removeAttr(prop);
9792
- $layer.removeData(prop);
9793
- for (var j = 0; j < devices.length; j++) {
9794
- var device = devices[j].toLowerCase();
9795
- data[prop] = $layer.data(device + prop);
9796
- $layer.removeAttr(device + prop);
9797
- $layer.removeData(device + prop);
9798
- }
9799
  }
9800
- return data;
9801
- };
9802
 
9803
- PlacementNormal.prototype.deActivated = function (newMode) {
9804
- this.layer.$.off('.placementnormal');
9805
- this.$layer.nUISpacing('destroy');
9806
- this.$layer.nUINormalSizing('destroy');
9807
 
9808
- this.layer.layer.attr('data-has-maxwidth', '0');
9809
- this.layer.layer.removeAttr('data-cssselfalign');
9810
 
9811
- var properties = ['margin', 'height', 'maxwidth', 'selfalign'],
9812
- historicalData = this.layer.getPropertiesData(properties);
9813
- this.layer.removeProperties(properties);
9814
 
 
 
 
 
9815
 
9816
- this.layer.layer.css({
9817
- position: '',
9818
- margin: '',
9819
- height: '',
9820
- maxWidth: ''
9821
- });
9822
- return historicalData;
9823
- };
9824
 
9825
- PlacementNormal.prototype._renderModeProperties = function (isReset) {
 
 
 
 
9826
 
9827
- this._syncmargin();
9828
- this._syncheight();
9829
- this._syncmaxwidth();
9830
- this._syncselfalign();
9831
- };
9832
 
9833
- PlacementNormal.prototype._syncmargin = function () {
9834
- var margin = this.layer.getProperty('margin').split('|*|'),
9835
- unit = margin.pop(),
9836
- baseSize = this.layer.baseSize;
9837
 
9838
- if (unit == 'px+' && baseSize > 0) {
9839
- unit = 'em';
9840
- for (var i = 0; i < margin.length; i++) {
9841
- margin[i] = parseInt(margin[i]) / baseSize;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9842
  }
9843
  }
9844
 
9845
- var margin = margin.join(unit + ' ') + unit;
9846
- this.layer.layer.css('margin', margin);
9847
- this.layer.update();
9848
 
9849
- this.$layer.nUISpacing('option', 'current', margin);
9850
- };
9851
 
9852
- PlacementNormal.prototype.startUISpacing = function () {
9853
- this.$layer.nUISpacing({
9854
- mode: 'margin',
9855
- sync: {
9856
- n: 'margin-top',
9857
- e: 'margin-right',
9858
- s: 'margin-bottom',
9859
- w: 'margin-left',
9860
- },
9861
- handles: 'n, s, e, w',
9862
- start: $.proxy(function (e, ui) {
9863
- N2Classes.PositionDisplay.get().show('Spacing');
9864
- }, this),
9865
- spacing: $.proxy(function (e, ui) {
9866
- var html = '';
9867
- for (var k in ui.changed) {
9868
- html += 'Margin ' + k + ': ' + ui.changed[k] + 'px<br>';
9869
- }
9870
 
9871
- N2Classes.PositionDisplay.get().update(e, 'Spacing', html);
9872
- }, this),
9873
- stop: $.proxy(this.onSpacingStop, this),
9874
- });
9875
  };
9876
 
9877
- PlacementNormal.prototype.onSpacingStop = function (event, ui) {
9878
- N2Classes.PositionDisplay.get().hide('Spacing');
9879
- var margin = this.layer.getProperty('margin').split('|*|'),
9880
- ratioH = 1,
9881
- ratioV = 1;
9882
- if (margin[margin.length - 1] == 'px+' && Math.abs(parseFloat(this.$layer.css('fontSize')) - this.layer.baseSize) > 1) {
9883
- ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
9884
- ratioV = this.fragmentEditor.getResponsiveRatioVertical();
 
9885
  }
 
9886
 
9887
- for (var k in ui.changed) {
9888
- var value = ui.changed[k];
9889
- switch (k) {
9890
- case 'top':
9891
- margin[0] = Math.round(value / ratioV);
9892
- break;
9893
- case 'right':
9894
- margin[1] = Math.round(value / ratioH);
9895
- break;
9896
- case 'bottom':
9897
- margin[2] = Math.round(value / ratioV);
9898
- break;
9899
- case 'left':
9900
- margin[3] = Math.round(value / ratioH);
9901
- break;
9902
  }
9903
  }
9904
- this.layer.setProperty('margin', margin.join('|*|'));
9905
- $('#layernormal-margin').data('field').insideChange(margin.join('|*|'));
9906
  };
9907
 
9908
- PlacementNormal.prototype.startUISizing = function () {
9909
- var needSize = false;
9910
- if (this.layer.item && this.layer.item.needSize) {
9911
- needSize = true;
9912
- }
9913
- this.$layer.nUINormalSizing({
9914
- height: needSize,
9915
- syncWidth: true,
9916
- start: $.proxy(function (e, prop) {
9917
- N2Classes.PositionDisplay.get().show('NormalSizing');
9918
- if (prop === 'maxwidth') {
9919
- this.layer.layer.attr('data-has-maxwidth', '1');
9920
- }
9921
- }, this),
9922
- resizeMaxWidth: $.proxy(function (e, ui) {
9923
- N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Max-width: ' + (ui.value == 0 ? 'none' : (ui.value + 'px')));
9924
 
9925
- }, this),
9926
- stopMaxWidth: $.proxy(function (e, ui) {
9927
- N2Classes.PositionDisplay.get().hide('NormalSizing');
9928
- this.layer.setProperty('maxwidth', ui.value);
9929
- }, this),
9930
- resizeHeight: $.proxy(function (e, ui) {
9931
- N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Height: ' + ui.value + 'px');
 
 
 
 
9932
 
9933
- }, this),
9934
- stopHeight: $.proxy(function (e, ui) {
9935
- N2Classes.PositionDisplay.get().hide('NormalSizing');
9936
- var ratio = 1;
9937
- if (parseInt(this.$layer.css('fontSize')) != this.layer.baseSize) {
9938
- ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
9939
- }
9940
- var value = Math.round(value / ratio);
9941
 
9942
- this.layer.setProperty('height', ui.value);
9943
- }, this)
9944
- });
9945
  };
9946
 
9947
- PlacementNormal.prototype._syncheight = function () {
9948
- var height = parseInt(this.layer.getProperty('height'));
9949
-
9950
- if (height > 0) {
9951
- var unit = 'px',
9952
- baseSize = this.layer.baseSize;
9953
- if (baseSize > 0) {
9954
- unit = 'em';
9955
- height = parseInt(height) / baseSize;
9956
  }
9957
-
9958
- this.layer.layer.css('height', height + unit);
9959
- } else {
9960
-
9961
- this.layer.layer.css('height', '');
9962
  }
9963
-
9964
- this.layer.update();
9965
  };
9966
 
9967
- PlacementNormal.prototype._syncmaxwidth = function () {
9968
- var value = parseInt(this.layer.getProperty('maxwidth'));
9969
- if (value <= 0 || isNaN(value)) {
9970
- this.layer.layer.css('maxWidth', '')
9971
- .attr('data-has-maxwidth', '0');
9972
- } else {
9973
- this.layer.layer.css('maxWidth', value + 'px')
9974
- .attr('data-has-maxwidth', '1');
9975
- }
9976
 
9977
- this.layer.update();
9978
- };
 
 
9979
 
9980
- PlacementNormal.prototype._syncselfalign = function () {
9981
- this.layer.layer.attr('data-cssselfalign', this.layer.getProperty('selfalign'));
9982
- };
9983
 
9984
- PlacementNormal.prototype.sync = function () {
9985
- this._syncmargin();
9986
- this._syncheight();
9987
- this._syncmaxwidth();
9988
- };
9989
 
9990
- return PlacementNormal;
9991
- });
9992
- N2D('Placement', function ($, undefined) {
9993
- "use strict";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9994
 
9995
  /**
9996
  * @memberOf N2Classes
9997
  *
 
9998
  * @param layer
 
9999
  * @constructor
 
10000
  */
10001
- function Placement(layer) {
10002
- this.layer = layer;
10003
- this.fragmentEditor = layer.fragmentEditor;
10004
- this.modes = {};
10005
- this.current = null;
10006
- this.isTransferHandled = false;
10007
 
10008
- this.updatePositionThrottled = NextendDeBounce(this.updatePosition, 200);
10009
- }
10010
 
10011
- Placement.prototype.allow = function (mode) {
10012
- switch (mode) {
10013
- case 'absolute':
10014
- this.modes.absolute = new N2Classes.PlacementAbsolute(this, this.layer, this.fragmentEditor);
10015
- break;
10016
- case 'normal':
10017
- this.modes.normal = new N2Classes.PlacementNormal(this, this.layer, this.fragmentEditor);
10018
- break;
10019
- case 'group':
10020
- this.modes.absolute = new N2Classes.PlacementGroup(this, this.layer, this.fragmentEditor);
10021
- break;
10022
- case 'content':
10023
- this.modes.absolute = new N2Classes.PlacementContent(this, this.layer, this.fragmentEditor);
10024
- break;
10025
- case 'default':
10026
- this.modes['default'] = new N2Classes.PlacementDefault(this, this.layer, this.fragmentEditor);
10027
- break;
10028
- }
10029
- };
10030
 
10031
- Placement.prototype.start = function () {
10032
- for (var k in this.modes) {
10033
- this.modes[k].start();
10034
- }
10035
- };
10036
 
10037
- Placement.prototype.setMode = function (mode, properties) {
10038
- var historicalData = false;
10039
- properties = properties || {};
10040
- if (typeof this.modes[mode] !== 'undefined') {
10041
- if (this.current != this.modes[mode]) {
10042
- var lastType;
10043
- if (this.current) {
10044
 
10045
- this.modes[mode].preActivation(this.current);
10046
- lastType = this.current.type;
10047
- historicalData = this.current.deActivated(this.modes[mode]);
10048
- }
10049
- this.current = this.modes[mode];
10050
 
10051
- this.layer.layer.attr('data-pm', this.current.type);
10052
- this.current.activated(properties);
10053
 
10054
- this.layer.$.triggerHandler('placementChanged', [this.current.type, lastType]);
10055
- }
10056
- } else {
10057
- throw new Exception('Layer placement(' + mode + ') not allowed for the container', this.layer);
10058
- }
10059
- return historicalData;
10060
  };
10061
 
10062
- Placement.prototype.doAction = function (action) {
10063
- try {
10064
- return this.current[action].apply(this.current, Array.prototype.slice.call(arguments, 1));
10065
- } catch (e) {
10066
-
 
10067
  }
10068
  };
10069
 
10070
- Placement.prototype.getType = function () {
10071
- return this.current.type;
10072
- };
10073
-
10074
- Placement.prototype.onResize = function (isForced) {
10075
- if (typeof this.current.onResize == 'function') {
10076
- this.current.onResize(isForced);
 
 
 
 
 
 
 
10077
  }
10078
  };
10079
 
10080
- Placement.prototype.updatePosition = function () {
10081
- this.current.updatePosition();
10082
- };
10083
-
10084
- Placement.prototype.getIndex = function () {
10085
- return this.current.getIndex();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10086
  };
10087
 
10088
- Placement.prototype.renderIndex = function (index) {
10089
- return this.current.renderIndex(index);
10090
- };
10091
 
10092
- Placement.prototype.doLinearResize = function (ratios) {
10093
- this.current.doLinearResize(ratios);
10094
- };
10095
 
10096
- Placement.prototype.sync = function () {
10097
- this.current.sync();
10098
  };
10099
 
10100
- Placement.prototype.renderModeProperties = function (isReset) {
 
 
 
 
 
 
 
 
10101
 
10102
- var fontSize = this.layer.getProperty('fontsize');
10103
- this.layer.adjustFontSize(this.layer.getProperty('adaptivefont'), fontSize, false);
 
 
 
 
 
 
 
 
 
 
 
 
10104
 
10105
- this.current._renderModeProperties(isReset);
10106
- };
10107
-
10108
- Placement.prototype.delete = function () {
10109
- this.current.delete();
 
 
 
 
 
 
 
 
 
10110
  };
10111
 
10112
- return Placement;
10113
- });
10114
- N2D('PlacementAbstract', ['Placement'], function ($, undefined) {
10115
- "use strict";
10116
 
10117
- /**
10118
- * @memberOf N2Classes
10119
- *
10120
- * @param placement
10121
- * @param {ComponentAbstract} layer
10122
- * @param fragmentEditor
10123
- * @constructor
10124
- */
10125
- function PlacementAbstract(placement, layer, fragmentEditor) {
10126
- this.placement = placement;
10127
- /**
10128
- * @type {ComponentAbstract}
10129
- */
10130
- this.layer = layer;
10131
- this.fragmentEditor = fragmentEditor;
10132
- }
10133
 
10134
- PlacementAbstract.prototype.start = function () {
 
 
 
 
 
 
 
 
 
 
 
10135
 
10136
- };
 
 
10137
 
10138
- PlacementAbstract.prototype.preActivation = function (lastPlacement) {
10139
 
10140
- };
 
 
10141
 
10142
- PlacementAbstract.prototype.activated = function () {
10143
 
10144
- };
10145
 
10146
- PlacementAbstract.prototype.deActivated = function (newMode) {
10147
 
10148
- return false;
10149
  };
10150
 
10151
- PlacementAbstract.prototype.updatePosition = function () {
10152
- this.layer.group.update();
10153
- };
10154
 
10155
- PlacementAbstract.prototype._renderModeProperties = function (isReset) {
 
10156
 
10157
- };
 
10158
 
10159
- PlacementAbstract.prototype._hide = function () {
10160
- };
10161
 
10162
- PlacementAbstract.prototype._show = function () {
10163
- };
10164
 
10165
- PlacementAbstract.prototype.snap = function () {
10166
- return false;
10167
- };
10168
 
10169
- PlacementAbstract.prototype.getIndex = function () {
10170
- return this.layer.layer.index();
10171
- };
10172
 
10173
- PlacementAbstract.prototype.renderIndex = function (index) {
 
 
 
10174
 
10175
- };
 
 
 
10176
 
10177
- PlacementAbstract.prototype.doLinearResize = function (ratios) {
 
 
 
 
 
 
 
 
 
 
 
 
10178
  };
10179
 
10180
- PlacementAbstract.prototype.sync = function () {
10181
 
 
 
 
 
 
 
10182
  };
10183
 
10184
- PlacementAbstract.prototype.delete = function () {
 
 
 
 
 
 
10185
  };
10186
 
 
 
 
10187
 
10188
- PlacementAbstract.prototype.triggerLayerResized = function (isThrottled, ratios) {
10189
 
10190
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10191
 
10192
- PlacementAbstract.prototype.changeStatus = function (oldStatus, newStatus) {
10193
 
 
 
 
 
 
 
 
 
 
10194
  };
10195
 
10196
- return PlacementAbstract;
10197
- });
10198
- N2D('Item', function ($, undefined) {
10199
- "use strict";
10200
-
10201
- /**
10202
- * @memberOf N2Classes
10203
- *
10204
- * @constructor
10205
- */
10206
- function Item($item, layer, itemEditor) {
10207
- if (this.type === undefined) {
10208
- this.type = $item.data('item');
10209
  }
 
 
 
10210
 
10211
- this.needSize = this.constructor.needSize;
10212
 
10213
- this.fragmentEditor = itemEditor.fragmentEditor;
10214
- /**
10215
- * @type {Generator}
10216
- */
10217
- this.generator = this.fragmentEditor.editor.generator;
10218
 
10219
- this.self = this;
10220
- this.$item = $item;
10221
- this.layer = layer;
10222
- this.itemEditor = itemEditor;
10223
 
10224
- this.fonts = [];
10225
- this.styles = [];
10226
 
10227
- this.needFill = [];
 
 
10228
 
10229
- this.values = this.$item.data('itemvalues');
10230
- if (typeof this.values !== 'object') {
10231
- this.values = $.parseJSON(this.values);
 
 
 
 
10232
  }
10233
 
10234
- this.pre = 'div#' + this.fragmentEditor.editor.frontend.elementID + ' ';
10235
- this.defaultValues = itemEditor.getItemForm(this.type).values;
10236
-
10237
- this.added();
 
 
 
 
10238
 
10239
- this.$item.data('item', this);
 
10240
 
10241
- this.$item.appendTo(this.layer.getContent());
 
 
 
 
 
 
 
 
 
 
10242
 
10243
- this.layer.item = this;
10244
 
10245
- if (this.$item.children().length === 0) {
10246
- // It's create, so render the item
10247
- this.layer.readyDeferred.done($.proxy(this.reRender, this));
10248
- }
10249
 
 
10250
 
10251
- $('<div/>')
10252
- .addClass('n2-ss-item-overlay')
10253
- .css('zIndex', 89)
10254
- .appendTo(this.$item);
10255
 
10256
- this.$item.find('a').on('click', function (e) {
10257
- e.preventDefault();
10258
- });
10259
 
 
 
 
10260
 
10261
- $(window).trigger('ItemCreated');
10262
- }
 
 
 
 
 
 
10263
 
10264
- Item.needSize = false;
 
 
 
 
10265
 
10266
- Item.prototype.setSelf = function (self) {
10267
- if (this.self != this) {
10268
- this.self.setSelf(self);
 
10269
  }
10270
- this.self = self;
10271
- };
10272
 
10273
- Item.prototype.getSelf = function () {
10274
- if (this.self != this) {
10275
- this.self = this.self.getSelf();
10276
  }
10277
- return this.self;
10278
- };
10279
 
10280
- Item.prototype.changeValue = function (property, value) {
10281
- if (this == this.itemEditor.activeItem) {
10282
- $('#item_' + this.type + property).data('field')
10283
- .insideChange(value);
10284
- } else {
10285
- this.values[property] = value;
10286
  }
10287
- };
10288
 
10289
- Item.prototype.activate = function (e, context, force) {
10290
- if (this.itemEditor.setActiveItem(this, context, force)) {
10291
- nextend.basicCSS.activate('ss3item' + this.type, this.values, {
10292
- font: this.fonts,
10293
- style: this.styles
 
 
 
 
 
 
 
 
 
 
 
10294
  });
10295
- this.itemEditor.lastValues[this.type] = this.values;
10296
  }
10297
- };
10298
 
10299
- Item.prototype.deActivate = function () {
10300
- nextend.basicCSS.deActivate();
10301
- };
10302
 
10303
- Item.prototype.render = function (data, originalData) {
10304
- this.layer.layer.triggerHandler('itemRender');
10305
- this.$item.html('');
10306
 
10307
- this.parseAll(data);
10308
- this._render(data);
10309
 
10310
- // These will be available on the backend render
10311
- this.itemEditor.lastValues[this.type] = this.values = originalData;
10312
 
10313
- $('<div/>')
10314
- .addClass('n2-ss-item-overlay')
10315
- .css('zIndex', 89)
10316
- .appendTo(this.$item);
10317
 
10318
- var layerName = this.getName(data);
10319
- if (layerName === false || layerName == '' || layerName == 'Layer') {
10320
- layerName = this.type;
10321
- } else {
10322
- layerName = layerName.replace(/[<>]/gi, '');
10323
- }
10324
- this.layer.rename(layerName, false);
10325
 
10326
- this.layer.update();
 
10327
 
10328
- this.$item.find('a').on('click', function (e) {
10329
- e.preventDefault();
10330
- });
10331
- };
10332
 
10333
- Item.prototype._render = function (data) {
10334
  };
10335
 
10336
- Item.prototype.reRender = function (newData) {
10337
 
10338
- this.values = $.extend({}, this.getDefault(), this.values, newData);
 
10339
 
10340
- this.render($.extend({}, this.values), this.values);
 
 
 
 
 
 
10341
  };
10342
 
10343
- Item.prototype.delete = function () {
10344
- this.$item.trigger('mouseleave');
10345
- this.$item.remove();
10346
 
10347
- if (this.itemEditor.activeItem == this) {
10348
- this.itemEditor.activeItem = null;
10349
  }
10350
- };
10351
 
10352
- Item.prototype.getHTML = function (base64) {
10353
- var item = '';
10354
- if (base64) {
 
 
 
 
10355
 
10356
- item = '[' + this.type + ' values="' + N2Classes.Base64.encode(JSON.stringify(this.values)) + '"]';
 
 
 
 
 
 
 
 
10357
  } else {
10358
- item = $('<div class="n2-ss-item n2-ss-item-' + this.type + '"></div>')
10359
- .attr('data-item', this.type)
10360
- .attr('data-itemvalues', JSON.stringify(this.values));
 
 
 
 
 
 
 
 
10361
  }
10362
- return item;
10363
- };
10364
 
10365
- Item.prototype.getData = function () {
10366
- return {
10367
- type: this.type,
10368
- values: this.values
10369
- };
10370
- };
10371
 
 
 
 
 
 
 
 
 
 
 
 
 
10372
 
10373
- Item.prototype.getDefault = function () {
10374
- return {};
10375
  };
10376
 
10377
- Item.prototype.added = function () {
10378
 
10379
- };
 
10380
 
10381
- Item.prototype.addedFont = function (mode, name) {
10382
- var $input = $('#item_' + this.type + name);
10383
- if ($input.length) {
10384
- this.fonts.push({
10385
- mode: mode,
10386
- name: name,
10387
- field: $input.data('field'),
10388
- def: this.defaultValues[name]
10389
- });
10390
- $.when(nextend.fontManager.addVisualUsage(mode, this.values[name], this.pre))
10391
- .done($.proxy(function (existsFont) {
10392
- if (!existsFont) {
10393
- this.changeValue(name, '');
10394
- }
10395
- }, this));
10396
- }
10397
- };
10398
-
10399
- Item.prototype.addedStyle = function (mode, name) {
10400
- var $input = $('#item_' + this.type + name);
10401
- if ($input.length) {
10402
- this.styles.push({
10403
- mode: mode,
10404
- name: name,
10405
- field: $input.data('field'),
10406
- def: this.defaultValues[name]
10407
- });
10408
-
10409
- $.when(nextend.styleManager.addVisualUsage(mode, this.values[name], this.pre))
10410
- .done($.proxy(function (existsStyle) {
10411
- if (!existsStyle) {
10412
- this.changeValue(name, '');
10413
- }
10414
- }, this));
10415
  }
10416
 
10417
- };
10418
 
10419
- Item.prototype.parseAll = function (data) {
 
 
 
 
 
 
10420
 
10421
- for (var i = 0; i < this.fonts.length; i++) {
10422
- data[this.fonts[i].name + 'class'] = nextend.fontManager.getClass(data[this.fonts[i].name], this.fonts[i].mode) + ' ';
10423
- }
 
 
 
 
 
 
 
10424
 
10425
- for (var i = 0; i < this.styles.length; i++) {
10426
- data[this.styles[i].name + 'class'] = nextend.styleManager.getClass(data[this.styles[i].name], this.styles[i].mode) + ' ';
 
 
 
 
 
 
 
 
10427
  }
10428
 
10429
- for (var i = 0; i < this.needFill.length; i++) {
10430
- if (typeof data[this.needFill[i]] !== 'undefined') {
10431
- data[this.needFill[i]] = this.generator.fill(data[this.needFill[i]] + '');
10432
- }
 
 
 
 
 
 
 
10433
  }
10434
- };
10435
 
10436
- Item.prototype.getName = function (data) {
10437
- return 'Layer';
10438
  };
10439
 
10440
- Item.prototype.resizeLayerToImage = function (image) {
10441
- var layer = this.layer,
10442
- $image = $("<img/>")
10443
- .attr("src", image)
10444
- .on('load', $.proxy(function () {
10445
- var width = $image[0].width,
10446
- height = $image[0].height;
10447
-
10448
- if (width > 0 && height > 0) {
10449
- var $containerElement = this.fragmentEditor.editor.getMainContainerElement(),
10450
- maxWidth = $containerElement.width(),
10451
- maxHeight = $containerElement.height();
10452
-
10453
- if (width > maxWidth) {
10454
- height = height * maxWidth / width;
10455
- width = maxWidth;
10456
- }
10457
- if (height > maxHeight) {
10458
- width = width * maxHeight / height;
10459
- //height = maxHeight;
10460
- }
10461
- N2Classes.History.get().off();
10462
- layer.setProperty('width', width);
10463
- layer.setProperty('height', 'auto');
10464
- N2Classes.History.get().on();
10465
- }
10466
- }, this));
10467
- };
10468
 
10469
- Item.prototype.fitLayer = function (item) {
10470
- return false;
10471
  };
10472
 
10473
- return Item;
10474
- });
10475
- N2D('ItemManager', function ($, undefined) {
10476
- "use strict";
10477
 
10478
- /**
10479
- * @memberOf N2Classes
10480
- *
10481
- * @param {FragmentEditor} fragmentEditor
10482
- * @param options
10483
- * @constructor
10484
- */
10485
- function ItemManager(fragmentEditor, options) {
10486
- this.suppressChange = false;
10487
 
10488
- this.activeItemOriginalData = null;
10489
 
10490
- this.fragmentEditor = fragmentEditor;
10491
 
10492
- this.lastValues = {};
 
10493
 
10494
- this.startItems();
10495
 
10496
- this.forms = {};
10497
- this.activeForm = false;
10498
 
10499
- if (!options.isUploadDisabled) {
10500
- var dropArea = $('#n2-ss-slide-canvas-container-inner');
10501
- dropArea.nUIFileUpload({
10502
- url: options.uploadUrl,
10503
- pasteZone: false,
10504
- dropZone: dropArea,
10505
- dataType: 'json',
10506
- paramName: 'image',
10507
- add: function (e, data) {
10508
- data.formData = {path: '/' + options.uploadDir};
10509
- data.submit();
10510
- },
10511
- done: $.proxy(function (e, data) {
10512
- var response = data.result;
10513
- if (response.data && response.data.name) {
10514
- var item = this.createLayerItem(false, {item: 'image'});
10515
- item.reRender({
10516
- image: response.data.url
10517
- });
10518
- item.activate(null, null, true);
10519
- } else {
10520
- N2Classes.AjaxHelper.notification(response);
10521
- }
10522
 
10523
- }, this),
10524
- fail: function (e, data) {
10525
- N2Classes.AjaxHelper.notification(data.jqXHR.responseJSON);
10526
- },
10527
 
10528
- start: function () {
10529
- N2Classes.AjaxHelper.startLoading();
10530
- },
 
10531
 
10532
- stop: function () {
10533
- setTimeout(function () {
10534
- N2Classes.AjaxHelper.stopLoading();
10535
- }, 100);
10536
- }
10537
- });
10538
  }
10539
- }
 
 
 
 
10540
 
10541
- ItemManager.prototype.setActiveItem = function (item, context, force) {
10542
- // Must be called through N2Classes.Item.activate();
10543
- if (item != this.activeItem || force) {
10544
- this.activeItemOriginalData = null;
10545
 
10546
- var type = item.type;
 
 
 
10547
 
10548
- if (this.activeForm) {
10549
- this.activeForm.form.css('display', 'none');
10550
- }
10551
 
10552
- if (this.activeItem) {
10553
- this.activeItem.deActivate();
 
 
 
 
 
 
10554
  }
 
 
 
10555
 
10556
- this.activeForm = this.getItemForm(type);
10557
-
10558
- var values = $.extend({}, this.activeForm.values, item.values);
10559
-
10560
- this.activeItem = item;
10561
-
10562
- this.suppressChange = true;
10563
 
10564
- for (var key in values) {
10565
- var field = $('#item_' + type + key).data('field');
10566
- if (field) {
10567
- field.insideChange(values[key]);
10568
- }
10569
  }
 
 
10570
 
10571
- this.suppressChange = false;
10572
-
10573
- this.activeForm.form.css('display', 'block');
10574
- this.focusFirst(context);
10575
- return true;
10576
- }
10577
- //this.focusFirst(context);
10578
- return false;
10579
  };
10580
 
10581
- ItemManager.prototype.focusFirst = function (context) {
10582
- var field = this.activeForm.fields.eq(0).data('field');
10583
- if (this.fragmentEditor.editor.generator.isDynamicSlide() && field.connectedField && field.connectedField instanceof N2Classes.FormElementImage) {
10584
-
10585
- } else {
10586
- field.focus(typeof context !== 'undefined' && context);
 
 
 
10587
  }
10588
  };
10589
 
10590
- ItemManager.prototype.startItems = function () {
10591
-
10592
- $('.n2-ss-core-item').nUICanvasItem({
10593
- canvasUIManager: this.fragmentEditor.mainContainer.canvasUIManager,
10594
- distance: 5,
10595
- $layer: function () {
10596
- return this.element.clone();
10597
- },
10598
- onCreate: $.proxy(function (e, itemOptions, targetContainer, targetIndex) {
10599
- switch (targetContainer.layer.type) {
10600
- case 'content':
10601
- case 'col':
10602
- N2Classes.History.get().startBatch();
10603
- var item = this.createLayerItem(targetContainer.layer, itemOptions.$layer.data(), 'click');
10604
- N2Classes.History.get().addControl('skipForwardUndos');
10605
 
10606
- targetContainer.layer.container.insertLayerAt(item.layer, targetIndex);
10607
- item.layer.changeGroup(false, targetContainer.layer);
10608
 
10609
- N2Classes.History.get().endBatch();
 
 
 
 
10610
 
10611
- break;
 
 
 
 
 
 
 
 
 
10612
 
10613
- case 'row':
10614
- var col = targetContainer.layer.createCol();
10615
- targetContainer.layer.moveCol(col.getIndex(), targetIndex);
10616
 
10617
- N2Classes.History.get().startBatch();
10618
- var item = this.createLayerItem(col, itemOptions.$layer.data(), 'click');
10619
- N2Classes.History.get().addControl('skipForwardUndos');
10620
 
10621
- col.container.insertLayerAt(item.layer, 0);
10622
- item.layer.changeGroup(false, col);
10623
 
10624
- N2Classes.History.get().endBatch();
 
 
 
 
 
 
10625
 
10626
- break;
10627
- default:
10628
- var mainContainerOffset = this.fragmentEditor.mainContainer.layer.offset(),
10629
- item = this.createLayerItem(this.fragmentEditor.mainContainer, itemOptions.$layer.data(), 'click');
10630
- item.layer.placement.current.setPosition(e.pageX - mainContainerOffset.left - 20, e.pageY - mainContainerOffset.top - 20);
10631
 
10632
- break;
10633
- }
10634
- }, this),
10635
- start: function () {
10636
- $('#n2-ss-add-sidebar').removeClass('n2-active');
 
10637
  }
10638
- }).on('click', $.proxy(function (e) {
10639
- this.createLayerItem(this.fragmentEditor.mainContainer.getActiveGroup(), $(e.currentTarget).data(), 'click');
10640
- }, this));
10641
 
 
 
10642
 
10643
- $('[data-itemshortcut]').on({
10644
- click: $.proxy(function (e) {
10645
- e.preventDefault();
10646
- $('.n2-ss-core-item[data-item="' + $(e.currentTarget).data('itemshortcut') + '"]').trigger('click');
10647
- }, this),
10648
- mousedown: $.proxy(function (e) {
10649
- $('.n2-ss-core-item[data-item="' + $(e.currentTarget).data('itemshortcut') + '"]').trigger(e);
10650
- }, this)
10651
- });
10652
 
10653
- $('[data-structureshortcut]').on({
10654
- click: $.proxy(function (e) {
10655
- e.preventDefault();
10656
- $('.n2-ss-add-layer-button').trigger('click');
10657
- $('#n2-ss-layers-switcher > .n2-labels .n2-td').eq(1).trigger('click');
10658
- }, this),
10659
- mousedown: $.proxy(function (e) {
10660
- $('.n2-ss-core-item[data-sstype="' + $(e.currentTarget).data('structureshortcut') + '"]').trigger(e);
10661
- }, this)
10662
- });
10663
  };
10664
 
10665
- ItemManager.prototype.createLayerItem = function (group, data, interaction, props) {
10666
- group = group || this.fragmentEditor.mainContainer.getActiveGroup();
10667
- var type = data.item;
10668
- if (type === 'structure') {
10669
- var layer = new N2Classes.Row(this.fragmentEditor, group, {});
10670
- layer.create(data.sstype);
10671
- layer.hightlightStructure();
10672
 
10673
- return {
10674
- layer: layer
10675
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10676
  } else {
10677
- var itemData = this.getItemForm(type),
10678
- extraValues = {};
10679
- switch (type) {
10680
- case 'image':
10681
- if (group.container.allowedPlacementMode === 'absolute') {
10682
- extraValues.size = '100%|*|auto';
10683
- } else {
10684
- extraValues.size = 'auto|*|auto';
10685
- }
 
10686
  break;
 
 
10687
  }
10688
 
10689
- var $item = $('<div></div>').attr('data-item', type)
10690
- .data('itemvalues', $.extend(true, {}, itemData.values, this.getLastValues(type), extraValues))
10691
- .addClass('n2-ss-item n2-ss-item-' + type),
10692
- layer = this._createLayer($item, group, $.extend($('.n2-ss-core-item-' + type).data('layerproperties'), props));
10693
-
10694
- if (interaction && interaction == "click") {
10695
- setTimeout(function () {
10696
- layer.layer.trigger('mousedown', ['create']).trigger('mouseup', ['create']).trigger('click', ['create']);
10697
- }, 500);
10698
- } else {
10699
- layer.activate();
 
 
 
 
 
 
 
10700
  }
10701
 
10702
- this.fragmentEditor.layerWindow.switchTab('item');
10703
-
10704
- N2Classes.History.get().addSimple(this, this.historyDelete, this.historyCreate, [group, layer, data]);
10705
-
10706
- return layer.item;
10707
  }
10708
- };
10709
 
10710
- ItemManager.prototype.getLastValues = function (type) {
10711
- if (this.lastValues[type] !== undefined) {
10712
- return this.lastValues[type];
10713
- }
10714
- return {};
10715
  };
10716
 
10717
- ItemManager.prototype.getItemClass = function (type) {
10718
- var itemClass = 'Item' + N2Classes.StringHelper.capitalize(type);
10719
- if (typeof N2Classes[itemClass] === 'undefined') {
10720
- return 'Item';
10721
- }
10722
- return itemClass;
10723
- };
10724
 
10725
- ItemManager.prototype._createLayer = function ($item, group, properties) {
10726
- var defaultAlign = this.fragmentEditor.layerOptions.layerFeatures.layerDefault;
10727
- for (var k in defaultAlign) {
10728
- if (defaultAlign[k] !== null) {
10729
- properties[k] = defaultAlign[k];
10730
- }
10731
  }
10732
 
10733
- var newLayer = new N2Classes.Layer(this.fragmentEditor, group, properties);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10734
 
10735
- newLayer.create(function (layer) {
10736
- return layer._createLayer()
10737
- .append($item);
10738
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10739
 
10740
- return newLayer;
10741
  };
10742
 
10743
- /**
10744
- * Initialize an item type and subscribe the field changes on that type.
10745
- * We use event normalization to prevent rendering.
10746
- * @param type
10747
- * @private
10748
- */
10749
- ItemManager.prototype.getItemForm = function (type) {
10750
- if (this.forms[type] === undefined) {
10751
- var form = $('#smartslider-slide-toolbox-item-type-' + type),
10752
- formData = {
10753
- form: form,
10754
- values: form.data('itemvalues'),
10755
- fields: form.find('[name^="item_' + type + '"]'),
10756
- fieldNameRegexp: new RegExp('item_' + type + "\\[(.*?)\\]", "")
10757
- };
10758
- formData.fields.on({
10759
- nextendChange: $.proxy(this.updateCurrentItem, this),
10760
- keydown: $.proxy(this.updateCurrentItemDeBounced, this)
10761
- });
10762
 
10763
- this.forms[type] = formData;
 
 
 
 
 
 
 
 
 
 
 
10764
  }
10765
- return this.forms[type];
10766
  };
10767
 
10768
- /**
10769
- * This function renders the current item with the current values of the related form field.
10770
- */
10771
- ItemManager.prototype.updateCurrentItem = function (e) {
10772
- if (!this.suppressChange) {
10773
- if (this.activeItemOriginalData === null) {
10774
- this.activeItemOriginalData = $.extend({}, this.activeItem.values);
10775
- }
10776
- var data = {},
10777
- originalData = {};
10778
- // Get the current values of the fields
10779
- // Run through the related item filter
10780
- this.activeForm.fields.each($.proxy(function (i, field) {
10781
- var field = $(field),
10782
- name = field.attr('name').match(this.activeForm.fieldNameRegexp)[1];
10783
-
10784
- originalData[name] = data[name] = field.val();
10785
-
10786
- }, this));
10787
-
10788
- if (e && e.type == 'nextendChange') {
10789
- var task = N2Classes.History.get().addValue(this, this.historyUpdateCurrentItem, [this.activeItem]);
10790
- if (task) {
10791
- task.setValues(this.activeItemOriginalData, $.extend({}, originalData));
10792
- }
10793
 
10794
- this.activeItemOriginalData = null;
10795
- }
 
10796
 
10797
- this.activeItem.render($.extend({}, this.activeItem.getDefault(), data), originalData);
 
 
 
 
 
 
 
 
10798
  }
10799
  };
10800
 
10801
- ItemManager.prototype.historyUpdateCurrentItem = function (values, historyActiveItem) {
10802
- var maybeOldActiveItem = historyActiveItem.getSelf();
10803
- maybeOldActiveItem.reRender($.extend(true, {}, values));
10804
- maybeOldActiveItem.values = values;
10805
- if (this.activeItem == maybeOldActiveItem) {
10806
- maybeOldActiveItem.activate(null, null, true);
10807
- }
10808
- };
10809
 
10810
- ItemManager.prototype.updateCurrentItemDeBounced = NextendDeBounce(function (e) {
10811
- this.updateCurrentItem(e);
10812
- }, 100);
10813
 
10814
- ItemManager.prototype.historyDelete = function (historyGroup, historyLayer) {
10815
- historyLayer.getSelf().delete();
 
 
 
 
 
 
 
 
10816
  };
10817
 
10818
- ItemManager.prototype.historyCreate = function (historyGroup, historyLayer, data) {
10819
- var item = this.createLayerItem(historyGroup.getSelf(), data);
10820
- historyLayer.setSelf(item.layer);
10821
- };
10822
 
10823
- ItemManager.prototype.historyCreateStructure = function (historyGroup, historyLayer, data) {
10824
- var obj = this.createLayerItem(historyGroup.getSelf(), data);
10825
- historyLayer.setSelf(obj.layer);
10826
  };
 
 
 
10827
 
10828
- ItemManager.prototype.getSelf = function () {
10829
- return this;
 
10830
  };
10831
 
10832
- return ItemManager;
10833
- });
10834
- N2D('PluginActivatable', function ($, undefined) {
10835
- "use strict";
10836
 
10837
- /**
10838
- * @memberOf N2Classes
10839
- *
10840
- * @constructor
10841
- */
10842
- function PluginActivatable() {
10843
- this.isActive = false;
10844
- this.preventActivation = false;
10845
- }
10846
 
10847
- PluginActivatable.prototype.activate = function (e, context, preventExitFromSelection) {
10848
- if (this.preventActivation) return false;
10849
- if (document.activeElement) {
10850
- document.activeElement.blur();
10851
- }
10852
- if (e && (e.ctrlKey || e.metaKey) && this.fragmentEditor.mainContainer.getSelectedLayer()) {
10853
- return !this.select();
10854
- } else {
10855
- if (e && e.which == 3 && this.fragmentEditor.selectMode) {
10856
- return false;
10857
  }
 
 
 
10858
 
10859
- if (!preventExitFromSelection) {
10860
- this.fragmentEditor.exitSelectMode();
 
 
10861
  }
10862
  }
 
10863
 
10864
- if (e) {
10865
- this.positionSidebar();
10866
- }
10867
 
 
 
 
10868
 
10869
- // Set the layer active if it is not active currently
10870
- if (this.fragmentEditor.mainContainer.getSelectedLayer() !== this) {
10871
- this.layerRow.addClass('n2-active');
10872
- this.layer.addClass('n2-active');
10873
- this.layer.triggerHandler('n2-ss-activate');
10874
- this.fragmentEditor.changeActiveLayer(this, preventExitFromSelection);
10875
- nextend.activeLayer = this.layer;
10876
 
 
10877
 
10878
- this.fragmentEditor.ui.onActivateLayer(this);
 
10879
  }
10880
- this.isActive = true;
10881
- return true;
10882
- };
10883
 
10884
- PluginActivatable.prototype.deActivate = function () {
10885
- this.isActive = false;
10886
- if (this.layer === undefined) {
10887
- console.error();
10888
  }
10889
- this.layer.removeClass('n2-active');
10890
- this.layerRow.removeClass('n2-active');
10891
- this.layer.triggerHandler('n2-ss-deactivate');
10892
  };
10893
 
10894
- return PluginActivatable;
10895
- });
10896
- N2D('PluginEditableName', function ($, undefined) {
10897
- "use strict";
10898
- var dblClickInterval = 300,
10899
- timeout = null;
10900
 
10901
- /**
10902
- * @memberOf N2Classes
10903
- *
10904
- * @constructor
10905
- */
10906
- function PluginEditableName() {
10907
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10908
 
10909
- PluginEditableName.prototype.addProperties = function ($layer) {
10910
- this.createProperty('name', this.label, $layer);
10911
- this.createProperty('nameSynced', 1, $layer);
10912
- };
10913
 
10914
- PluginEditableName.prototype.makeNameEditable = function () {
10915
- this.layerTitleSpan.on({
10916
- mouseup: $.proxy(function (e) {
10917
- if (timeout) {
10918
- clearTimeout(timeout);
10919
- timeout = null;
10920
- this.editName();
10921
- } else {
10922
- this.activate(e);
10923
- timeout = setTimeout($.proxy(function () {
10924
- timeout = null;
10925
- }, this), dblClickInterval);
 
 
 
 
 
10926
  }
10927
- }, this)
10928
- })
 
 
 
10929
  };
10930
 
10931
- PluginEditableName.prototype.editName = function () {
10932
- var input = new N2Classes.InlineField();
 
 
 
 
 
 
 
 
 
 
10933
 
10934
- input.$input.on({
10935
- valueChanged: $.proxy(function (e, newName) {
10936
- this.rename(newName, true);
10937
- this.layerTitleSpan.css('display', 'inline');
10938
- }, this),
10939
- cancel: $.proxy(function () {
10940
- this.layerTitleSpan.css('display', 'inline');
10941
- }, this)
10942
- });
10943
 
10944
- this.layerTitleSpan.css('display', 'none');
10945
- input.injectNode(this.layerTitle, this.property.name);
 
10946
 
 
 
10947
  };
10948
 
10949
- PluginEditableName.prototype.rename = function (newName, force) {
 
 
 
10950
 
10951
- if (this.property.nameSynced || force) {
 
10952
 
10953
- if (force) {
10954
- this.property.nameSynced = 0;
10955
- }
 
10956
 
10957
- if (newName == '') {
10958
- if (force) {
10959
- this.property.nameSynced = 1;
10960
- this.item.reRender();
10961
- return false;
10962
- }
10963
- newName = 'Layer #' + (this.group.getLayerCount() + 1);
10964
- }
10965
- newName = newName.substr(0, 35);
10966
- if (this.property.name != newName) {
10967
- this.property.name = newName;
10968
- this.layerTitleSpan.html(newName);
10969
 
10970
- this.$.trigger('layerRenamed', newName);
10971
- }
 
 
 
 
 
10972
  }
10973
  };
10974
 
10975
- return PluginEditableName;
10976
- });
10977
- N2D('PluginShowOn', function ($, undefined) {
10978
- "use strict";
10979
-
10980
- /**
10981
- * @memberOf N2Classes
10982
- *
10983
- * @constructor
10984
- */
10985
- function PluginShowOn() {
10986
-
10987
- }
10988
-
10989
- PluginShowOn.prototype.addProperties = function ($layer) {
10990
- this.showsOnCurrent = true;
10991
- this.createProperty('generatorvisible', '', $layer);
10992
- this.createProperty('desktopPortrait', 1, $layer);
10993
- this.createProperty('desktopLandscape', 1, $layer);
10994
- this.createProperty('tabletPortrait', 1, $layer);
10995
- this.createProperty('tabletLandscape', 1, $layer);
10996
- this.createProperty('mobilePortrait', 1, $layer);
10997
- this.createProperty('mobileLandscape', 1, $layer);
10998
  };
10999
 
11000
- PluginShowOn.prototype._hide = function () {
11001
- this.layer.css('display', 'none');
11002
- this.showsOnCurrent = false;
11003
- this.update();
 
11004
  };
11005
 
11006
- PluginShowOn.prototype._show = function () {
11007
- if (parseInt(this.property[this.fragmentEditor.getMode()])) {
11008
- this.layer.css('display', '');
11009
- this.showsOnCurrent = true;
 
 
11010
  }
11011
- this.update();
11012
  };
11013
 
11014
-
11015
- PluginShowOn.prototype._syncdesktopPortrait = function () {
11016
- var value = this.getProperty('desktopPortrait');
11017
- this.__syncShowOnDevice('desktopPortrait', value);
11018
  };
11019
 
11020
- PluginShowOn.prototype._syncdesktopLandscape = function () {
11021
- var value = this.getProperty('desktopLandscape');
11022
- this.__syncShowOnDevice('desktopLandscape', value);
11023
- };
11024
 
11025
- PluginShowOn.prototype._synctabletPortrait = function () {
11026
- var value = this.getProperty('tabletPortrait');
11027
- this.__syncShowOnDevice('tabletPortrait', value);
11028
- };
11029
 
11030
- PluginShowOn.prototype._synctabletLandscape = function () {
11031
- var value = this.getProperty('tabletLandscape');
11032
- this.__syncShowOnDevice('tabletLandscape', value);
11033
- };
11034
 
11035
- PluginShowOn.prototype._syncmobilePortrait = function () {
11036
- var value = this.getProperty('mobilePortrait');
11037
- this.__syncShowOnDevice('mobilePortrait', value);
11038
  };
11039
 
11040
- PluginShowOn.prototype._syncmobileLandscape = function () {
11041
- var value = this.getProperty('mobileLandscape');
11042
- this.__syncShowOnDevice('mobileLandscape', value);
11043
  };
11044
 
11045
- PluginShowOn.prototype.__syncShowOnDevice = function (mode, value) {
11046
- if (this.getMode() == mode) {
11047
- var value = parseInt(value);
11048
- if (value) {
11049
- this._show();
11050
- } else {
11051
- this._hide();
 
 
11052
  }
11053
- this.layer.triggerHandler('LayerShowChange', [mode, value]);
11054
- this.placement.doAction('triggerLayerResized');
 
 
 
11055
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11056
  };
11057
 
11058
- return PluginShowOn;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11059
  });
11060
- N2D('Col', ['ContentAbstract'], function ($, undefined) {
11061
  "use strict";
11062
 
11063
  /**
11064
  * @memberOf N2Classes
11065
  *
 
 
11066
  * @param fragmentEditor
11067
- * @param group
11068
- * @param properties
11069
  * @constructor
11070
-
11071
- * @augments ContentAbstract
11072
  */
11073
- function Col(fragmentEditor, group, properties) {
11074
- this.label = 'Col';
11075
- this.type = 'col';
11076
-
11077
- this.innerContainer = '> .n2-ss-layer-col';
11078
-
11079
- this.localStyle = [
11080
- {
11081
- group: 'normal', selector: '-inner', css: {
11082
- transition: 'transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;'
11083
- }
11084
- },
11085
- {group: 'hover', selector: '-inner:HOVER', css: {}}
11086
- ];
11087
-
11088
- N2Classes.ContentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
11089
 
11090
- this.placement.allow('default');
11091
  }
11092
 
11093
- Col.prototype = Object.create(N2Classes.ContentAbstract.prototype);
11094
- Col.prototype.constructor = Col;
11095
-
11096
- Col.prototype._createLayer = function () {
11097
- return $('<div class="n2-ss-layer"><div class="n2-ss-layer-content n2-ss-layer-col"></div></div>')
11098
- .attr('data-sstype', this.type);
11099
- };
11100
 
11101
- Col.prototype.addProperties = function ($layer) {
 
 
 
11102
 
11103
- N2Classes.ContentAbstract.prototype.addProperties.call(this, $layer);
 
 
 
 
 
 
 
 
 
11104
 
11105
- this.createProperty('colwidth', '1', $layer);
11106
- this.createProperty('href', '', $layer);
11107
- this.createProperty('href-target', '_self', $layer);
11108
 
11109
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderradius', 0, {
11110
- "-hover": undefined
11111
- }, this, "stylemode"), $layer);
11112
 
11113
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('boxshadow', '0|*|0|*|0|*|0|*|00000080', {
11114
- "-hover": undefined
11115
- }, this, "stylemode"), $layer);
11116
 
11117
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderwidth', '1|*|1|*|1|*|1', {
11118
- "-hover": undefined
11119
- }, this, "stylemode"), $layer);
11120
 
11121
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderstyle', 'none', {
11122
- "-hover": undefined
11123
- }, this, "stylemode"), $layer);
11124
 
11125
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bordercolor', 'ffffffff', {
11126
- "-hover": undefined
11127
- }, this, "stylemode"), $layer);
11128
 
11129
- this.createDeviceProperty('order', {desktopPortrait: 0}, $layer);
 
11130
  };
11131
 
11132
- Col.prototype.create = function () {
11133
- N2Classes.ContentAbstract.prototype.create.call(this);
 
 
 
 
 
 
 
 
 
 
 
11134
 
11135
- this._syncorder();
11136
 
11137
- this._syncborder();
 
 
 
 
 
 
11138
 
11139
- this._syncborderradius();
11140
- this._syncboxshadow();
 
 
11141
 
11142
- this._onReady();
11143
- };
 
 
 
 
 
 
11144
 
11145
- Col.prototype.load = function ($layer, isEditorStart) {
 
 
11146
 
11147
- N2Classes.ContentAbstract.prototype.load.call(this, $layer, isEditorStart);
11148
 
11149
- this._syncorder();
 
11150
 
11151
- this._syncborder();
11152
- this._syncborderradius();
11153
- this._syncboxshadow();
11154
 
11155
- this._onReady();
 
 
11156
 
11157
- var storedRowColumnWidths = $layer.data('rowcolumns') + ''; //jQuery can convert it to number
11158
- if (storedRowColumnWidths != undefined) {
11159
- if (this.group.readyDeferred.state() == 'resolved') {
11160
- var widths = storedRowColumnWidths.split('+');
11161
- for (var i = 0; i < widths.length; i++) {
11162
- widths[i] = new Fraction(widths[i]);
11163
- }
11164
- this.group.setColsWidth(widths);
11165
  }
11166
  }
11167
  };
11168
 
11169
- Col.prototype.createRow = function () {
11170
- this.$content = this.layer.find('.n2-ss-layer-content:first');
11171
-
11172
- this.container = new N2Classes.LayerContainer(this, $('<ul class="n2-list n2-h4 n2-list-orderable" />'), 'normal', '> .n2-ss-layer', ['row', 'layer']);
11173
- this.container.setLayerContainerElement(this.$content);
11174
 
11175
- this.addClassElement(this.layer);
11176
- this.addClassElement(this.$content, '-inner');
11177
 
11178
- var remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this)),
11179
- duplicate = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Duplicate layer') + '"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on('click', $.proxy(function () {
11180
- this.duplicate(true, false)
11181
- }, this));
11182
 
 
11183
 
11184
- this._createLayerListRow([
11185
- $('<div class="n2-actions"></div>').append(duplicate).append(remove)
11186
- ]).addClass('n2-ss-layer-content-row');
 
 
 
11187
 
11188
-
11189
- this.openerElement = $('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-col"></i></a>').insertBefore(this.layerTitleSpan)
11190
- .on('click', $.proxy(this.switchOpened, this));
11191
-
11192
- this.container.$ul.appendTo(this.layerRow);
11193
-
11194
- this.readyDeferred.done($.proxy(this._syncopened, this));
11195
  };
11196
 
11197
- Col.prototype._start = function (isCreate) {
 
 
 
 
 
 
 
 
11198
 
11199
- N2Classes.ContentAbstract.prototype._start.call(this, isCreate);
 
 
 
 
 
 
 
 
11200
 
11201
- if (isCreate) {
11202
- this.highlight(2000);
11203
- }
11204
- };
11205
 
11206
- Col.prototype.getRealOrder = function () {
11207
- var order = this.getProperty('order');
11208
- if (order == 0) {
11209
- return 10;
 
 
 
 
 
 
 
 
11210
  }
11211
- return order;
11212
  };
11213
 
11214
- Col.prototype._syncorder = function () {
11215
- var order = this.getProperty('order');
 
 
11216
 
11217
- if (order == 0) {
11218
- this.layer.css('order', '');
11219
- } else {
11220
- this.layer.css('order', order * 2);
11221
- }
11222
 
11223
- this.group.refreshUI();
11224
- };
 
11225
 
11226
- Col.prototype._synccolwidth = function () {
11227
- this.widthPercentage = ((new Fraction(this.getProperty('colwidth'))).valueOf() * 100);
11228
- //this.layer.css('width', this.widthPercentage + '%');
11229
- this.group.refreshUI();
11230
- };
11231
 
11232
- Col.prototype.getWidthPercentage = function () {
11233
- return this.widthPercentage;
 
 
 
 
 
11234
  };
11235
 
11236
- Col.prototype._synchref =
11237
- Col.prototype['_synchref-target'] = function () {
11238
- };
11239
 
11240
- Col.prototype._syncborderradius =
11241
- Col.prototype['_syncborderradius-hover'] = function () {
11242
- var borderRadius = this.getProperty('borderradius');
11243
- if (borderRadius > 0) {
11244
- this.addLocalStyle('normal', 'borderradius', 'border-radius:' + borderRadius + 'px;');
11245
- }
11246
 
11247
- var borderRadiusHover = this.getProperty('borderradius-hover');
11248
- if (borderRadiusHover && borderRadiusHover != borderRadius) {
11249
- this.addLocalStyle('hover', 'borderradius', 'border-radius:' + borderRadiusHover + 'px;');
 
 
 
 
 
 
11250
  }
11251
- };
11252
 
11253
- Col.prototype._syncborderwidth =
11254
- Col.prototype._syncbordercolor =
11255
- Col.prototype._syncborderstyle =
11256
- Col.prototype['_syncborderstyle-hover'] =
11257
- Col.prototype['_syncbordercolor-hover'] =
11258
- Col.prototype['_syncborderwidth-hover'] = function () {
11259
- this._syncborder();
11260
- };
11261
 
11262
- Col.prototype._syncborder = function () {
11263
- var borderstyle = this.getProperty('borderstyle'),
11264
- bordercolor = this.getProperty('bordercolor'),
11265
- borderwidth = this.getProperty('borderwidth');
11266
 
11267
- this.addLocalStyle('normal', 'border', this.getBorderCSS(borderstyle, bordercolor, borderwidth));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11268
 
11269
- var hoverStyle = '',
11270
- isHoverDifferent = false,
11271
- borderstyleHover = this.getProperty('borderstyle-hover'),
11272
- bordercolorHover = this.getProperty('bordercolor-hover'),
11273
- borderwidthHover = this.getProperty('borderwidth-hover');
11274
 
11275
- if (borderstyleHover !== undefined && borderstyleHover != borderstyle) {
11276
- isHoverDifferent = true;
11277
- }
11278
- if (bordercolorHover !== undefined && bordercolorHover != bordercolor) {
11279
- isHoverDifferent = true;
11280
- }
11281
- if (borderwidthHover !== undefined && borderwidthHover != borderwidth) {
11282
- isHoverDifferent = true;
11283
  }
11284
 
11285
- if (isHoverDifferent) {
11286
- if (borderstyleHover === undefined) {
11287
- borderstyleHover = borderstyle;
11288
- }
11289
- if (bordercolorHover === undefined) {
11290
- bordercolorHover = bordercolor;
11291
- }
11292
- if (borderwidthHover === undefined) {
11293
- borderwidthHover = borderwidth;
 
 
 
 
 
 
11294
  }
11295
- hoverStyle = this.getBorderCSS(borderstyleHover, bordercolorHover, borderwidthHover);
11296
  }
11297
- this.addLocalStyle('hover', 'border', hoverStyle);
11298
-
11299
- this.update();
11300
  };
11301
 
11302
- Col.prototype.getBorderCSS = function (borderStyle, borderColor, borderWidth) {
11303
- var style = '';
11304
- if (borderStyle != 'none') {
11305
- style += 'border-color:' + N2Color.hex2rgbaCSS(borderColor) + ';';
11306
- style += 'border-style:' + borderStyle + ';';
11307
- borderWidth = borderWidth.split('|*|');
11308
- var unit = 'px';
11309
-
11310
- style += 'border-width:' + borderWidth.join(unit + ' ') + unit + ';';
11311
  }
11312
- return style;
11313
- };
 
 
 
 
 
 
 
 
 
11314
 
11315
- Col.prototype._syncboxshadow =
11316
- Col.prototype['_syncboxshadow-hover'] = function () {
 
 
 
 
 
11317
 
11318
- var boxShadow = this.getProperty('boxshadow');
11319
- this.addLocalStyle('normal', 'boxshadow', this.getBoxShadowCSS(boxShadow.split('|*|')));
 
 
 
 
 
 
11320
 
11321
- var hoverStyle = '',
11322
- boxShadowHover = this.getProperty('boxshadow-hover');
11323
- if (boxShadowHover !== undefined && boxShadowHover != boxShadow) {
11324
- hoverStyle = this.getBoxShadowCSS(boxShadowHover.split('|*|'));
 
 
 
 
 
 
 
 
 
 
11325
  }
11326
- this.addLocalStyle('hover', 'boxshadow', hoverStyle);
11327
- };
11328
 
11329
- Col.prototype.getBoxShadowCSS = function (boxShadow) {
11330
- if ((boxShadow[0] != 0 || boxShadow[1] != 0 || boxShadow[2] != 0 || boxShadow[3] != 0) && N2Color.hex2alpha(boxShadow[4]) != 0) {
11331
- return 'box-shadow:' + boxShadow[0] + 'px ' + boxShadow[1] + 'px ' + boxShadow[2] + 'px ' + boxShadow[3] + 'px ' + N2Color.hex2rgbaCSS(boxShadow[4]) + ';';
 
11332
  }
11333
- return '';
 
11334
  };
11335
 
11336
- Col.prototype.delete = function () {
11337
- if (this.group.container.getLayerCount() > 1) {
11338
- this._delete();
 
 
11339
  } else {
11340
- this.group.delete();
 
11341
  }
 
 
11342
  };
11343
 
11344
- Col.prototype.getHTML = function (base64) {
11345
- var layer = N2Classes.ComponentAbstract.prototype.getHTML.call(this, base64);
 
11346
 
11347
- layer.attr('data-rowcolumns', this.group.getColumns());
11348
- return layer;
 
 
11349
  };
11350
 
11351
- Col.prototype.renderModeProperties = function (isReset) {
11352
- this._syncorder();
 
 
11353
 
11354
- N2Classes.ContentAbstract.prototype.renderModeProperties.call(this, isReset);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11355
  };
11356
 
11357
- Col.prototype.update = function () {
 
 
 
 
11358
 
11359
- this.group._syncwrapafter();
11360
- N2Classes.ComponentAbstract.prototype.update.call(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11361
  };
11362
 
11363
- Col.prototype.setPropertystylemode = function () {
11364
- N2Classes.ContentAbstract.prototype.setPropertystylemode.apply(this, arguments);
 
 
11365
 
11366
- this.syncAdvancedField('borderradius');
11367
- this.syncAdvancedField('boxshadow');
11368
- this.syncAdvancedField('borderwidth');
11369
- this.syncAdvancedField('borderstyle');
11370
- this.syncAdvancedField('bordercolor');
11371
  };
11372
 
11373
- Col.prototype.getOrderedIndex = function () {
11374
- return this.group.getOrderedColumns().indexOf(this);
11375
  };
11376
 
11377
- return Col;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11378
  });
11379
- var dependencies = ['LayerDataStorage', 'PluginEditableName'];
11380
- N2D('ComponentAbstract', dependencies, function ($, undefined) {
11381
  "use strict";
11382
 
11383
- var i = 0;
11384
- window.layers = [];
11385
-
11386
  /**
11387
  * @memberOf N2Classes
11388
  *
11389
- * @param {FragmentEditor} fragmentEditor
11390
- * @param group
11391
- * @param properties
11392
  * @constructor
11393
- * @augments PluginActivatable
11394
- * @augments LayerDataStorage
11395
- * @augments PluginEditableName
11396
- * @augments PluginAnimatable
11397
- * @augments PluginShowOn
11398
  */
11399
- function ComponentAbstract(fragmentEditor, group, properties) {
 
 
 
 
 
 
 
11400
 
11401
- this.wraps = {};
11402
- this.counter = i++;
11403
- window.layers[this.counter] = this;
11404
- this.self = this;
11405
- this.originalProperties = properties || {};
11406
- N2Classes.LayerDataStorage.prototype.constructor.call(this);
11407
- this.readyDeferred = $.Deferred();
11408
- this.readyDeferred.done($.proxy(this.onReady, this));
11409
- this.isDeleteStarted = false;
11410
- this.isDeleted = false;
11411
 
11412
- this._lastClasses = false;
11413
 
11414
- this.$ = $(this);
11415
 
11416
- this.proxyRefreshBaseSize = $.proxy(this.refreshBaseSize, this);
11417
- this.proxyRefreshTextAlign = $.proxy(this.refreshTextAlign, this);
11418
 
11419
- this.status = ComponentAbstract.STATUS.UNDEFINED;
11420
 
11421
- this.fragmentEditor = fragmentEditor;
11422
- this.group = group;
11423
 
11424
- this.classElements = [];
11425
 
11426
- this.localStyleSyncThrottled = NextendThrottle(this.localStyleSync, 50);
 
11427
 
 
 
 
11428
 
11429
- N2Classes.PluginActivatable.prototype.constructor.call(this);
11430
 
11431
- /** @type {Placement} */
11432
- this.placement = new N2Classes.Placement(this);
11433
 
11434
- this.readyDeferred.done($.proxy(this.addUILabels, this));
 
11435
 
11436
- }
 
11437
 
11438
- ComponentAbstract.STATUS = {
11439
- UNDEFINED: 0,
11440
- NORMAL: 1,
11441
- LOCKED: 2,
11442
- HIDDEN: 3
11443
  };
11444
 
11445
- ComponentAbstract.STATUS_INV = {
11446
- 0: 'UNDEFINED',
11447
- 1: 'NORMAL',
11448
- 2: 'LOCKED',
11449
- 3: 'HIDDEN'
11450
  };
11451
 
 
11452
 
11453
- for (var k in N2Classes.PluginActivatable.prototype) {
11454
- ComponentAbstract.prototype[k] = N2Classes.PluginActivatable.prototype[k];
11455
- }
11456
 
11457
- for (var k in N2Classes.LayerDataStorage.prototype) {
11458
- ComponentAbstract.prototype[k] = N2Classes.LayerDataStorage.prototype[k];
11459
- }
11460
 
11461
- for (var k in N2Classes.PluginEditableName.prototype) {
11462
- ComponentAbstract.prototype[k] = N2Classes.PluginEditableName.prototype[k];
11463
- }
11464
 
11465
- for (var k in N2Classes.PluginShowOn.prototype) {
11466
- ComponentAbstract.prototype[k] = N2Classes.PluginShowOn.prototype[k];
11467
- }
11468
 
11469
- ComponentAbstract.prototype.addUILabels = function () {
11470
- this.markTimer = null;
11471
- this.uiLabel = $('<div class="n2-ss-layer-ui-label-container"><div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-self">' + this.getUILabel() + '</div></div>')
11472
- .appendTo(this.layer);
11473
 
11474
- nextend.tooltip.addElement($('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-up n2-ss-layer-ui-label-action"><i class="n2-i n2-i-uplevel"/></div>')
11475
- .on({
11476
- mousedown: function (e) {
11477
- e.stopPropagation();
11478
- },
11479
- click: $.proxy(function (e) {
11480
- this.up(e);
11481
- }, this)
11482
- })
11483
- .appendTo(this.uiLabel), 'Select parent');
11484
 
11485
- $('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-action"><i class="n2-i n2-i-mini-duplicate"/></div>')
11486
- .on({
11487
- mousedown: function (e) {
11488
- e.stopPropagation();
11489
- },
11490
- click: $.proxy(function () {
11491
- this.duplicate();
11492
- }, this)
11493
- })
11494
- .appendTo(this.uiLabel);
11495
 
11496
- $('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-action"><i class="n2-i n2-i-mini-trash"/></div>')
11497
- .on({
11498
- mousedown: function (e) {
11499
- e.stopPropagation();
11500
- },
11501
- click: $.proxy(function () {
11502
- this.delete();
11503
- }, this)
11504
- })
11505
- .appendTo(this.uiLabel);
11506
  };
11507
 
11508
- ComponentAbstract.prototype.getUILabel = function () {
11509
- return this.label;
11510
- };
11511
 
11512
- ComponentAbstract.prototype.up = function (e) {
11513
- e.stopImmediatePropagation();
11514
- this.group.activate(e);
11515
  };
11516
 
11517
- ComponentAbstract.prototype.addProperties = function ($layer) {
 
 
 
11518
 
11519
- this.createProperty('id', null, $layer, this);
11520
- this.createProperty('uniqueclass', null, $layer, this);
 
 
 
 
 
 
 
 
11521
 
11522
- this.createProperty('class', '', $layer);
11523
- this.createProperty('crop', 'visible', $layer);
11524
- this.createProperty('rotation', 0, $layer);
11525
- this.createProperty('parallax', 0, $layer);
11526
- this.createProperty('adaptivefont', 0, $layer);
11527
 
11528
- this.createDeviceProperty('fontsize', {desktopPortrait: 100}, $layer);
11529
- N2Classes.PluginShowOn.prototype.addProperties.call(this, $layer);
11530
- N2Classes.PluginEditableName.prototype.addProperties.call(this, $layer);
11531
- };
 
11532
 
11533
- ComponentAbstract.prototype.getRootElement = function () {
11534
- return this.layer;
11535
- };
 
11536
 
11537
- ComponentAbstract.prototype.create = function (cb, useCreatedLayerProperties) {
11538
- useCreatedLayerProperties = useCreatedLayerProperties || false;
11539
- if (!useCreatedLayerProperties) {
11540
- this.addProperties(false);
11541
- }
11542
- if (typeof cb == 'function') {
11543
- this.layer = cb.call(null, this);
11544
- } else {
11545
- this.layer = this._createLayer();
11546
- }
11547
 
11548
- this.layer.addClass('n2-ss-layer-under-creation');
11549
 
11550
- if (useCreatedLayerProperties) {
11551
- this.addProperties(this.layer);
 
11552
  }
11553
 
11554
- this.layer.data('layerObject', this);
11555
- this.layer.triggerHandler('layerStarted', [this]);
11556
 
 
11557
 
11558
- this.group.container.insert(this);
11559
- this.group.onChildCountChange();
11560
 
11561
- this.$.triggerHandler('create');
11562
 
11563
- this._start(true);
11564
- };
11565
 
11566
- ComponentAbstract.prototype.load = function ($layer, isEditorStart) {
 
 
 
11567
 
11568
- this.addProperties($layer);
11569
 
11570
- this.layer = $layer.data('layerObject', this);
 
 
 
11571
 
11572
- this.layer.triggerHandler('layerStarted', [this]);
 
 
11573
 
11574
- this.$.triggerHandler('load');
11575
 
11576
- this._start(false);
 
11577
 
11578
- var status = $layer.data('status');
11579
- if (status !== null && typeof status != 'undefined') {
11580
- this.changeStatus(status);
11581
- } else {
11582
- this.changeStatus(ComponentAbstract.STATUS.NORMAL);
11583
- }
11584
 
11585
- if (!isEditorStart) {
11586
- this.regenerateUniqueClass();
 
 
 
 
 
 
11587
  }
11588
  };
11589
 
11590
- ComponentAbstract.prototype._start = function (isCreate) {
11591
- this.createRow();
11592
-
11593
- var mask = this.layer.find('> .n2-ss-layer-mask');
11594
- if (mask.length) {
11595
- this.wraps.mask = mask;
 
11596
  }
 
11597
 
11598
- this._synccrop();
11599
- this._syncrotation();
 
11600
 
11601
- this.placement.start();
11602
- this.placement.setMode(this.group.container.allowedPlacementMode, this.originalProperties);
 
11603
 
11604
- this.setGroup(this.group);
 
11605
 
 
 
11606
 
11607
- this.fragmentEditor.$.triggerHandler('layerCreated', this);
 
 
 
11608
 
11609
- if (isCreate) {
11610
- this.refreshBaseSize();
11611
- this.$.triggerHandler('created');
 
 
11612
  }
 
11613
 
11614
- setTimeout($.proxy(function () {
11615
- if (!this.isDeleted) {
11616
- this.placement.onResize(true);
11617
- this.layer.css('visibility', '');
11618
 
11619
- this.layer.removeClass('n2-ss-layer-under-creation');
11620
- }
11621
- }, this), 300);
11622
  };
11623
 
 
 
11624
 
11625
- ComponentAbstract.prototype._onReady = function () {
11626
-
11627
- this.originalProperties = {};
11628
 
11629
- this.readyDeferred.resolve();
11630
 
11631
- this.layer.on({
11632
- mouseover: $.proxy(this.markOver, this),
11633
- mouseout: $.proxy(this.markOut, this)
11634
- });
11635
  };
11636
 
11637
- ComponentAbstract.prototype.isReady = function () {
11638
- return this.readyDeferred.state() == 'resolved';
11639
- };
11640
 
11641
- ComponentAbstract.prototype.getName = function () {
11642
- return this.property.name;
 
11643
  };
11644
 
11645
- ComponentAbstract.prototype.setGroup = function (group) {
11646
- this.group.$.off('baseSizeUpdated.sslayer' + this.counter);
11647
- this.group.$.off('textAlignUpdated.sslayer' + this.counter);
11648
-
11649
- this.group = group;
11650
- this.placement.setMode(group.container.allowedPlacementMode);
11651
- group.container.syncLayerRow(this);
11652
 
11653
- if (this.isReady()) {
11654
- this.refreshBaseSize();
 
 
 
11655
  }
11656
- this.group.$.on('baseSizeUpdated.sslayer' + this.counter, this.proxyRefreshBaseSize);
11657
- this.group.$.on('textAlignUpdated.sslayer' + this.counter, this.proxyRefreshTextAlign);
11658
  };
11659
 
11660
- ComponentAbstract.prototype.changeGroup = function (originalIndex, newGroup) {
11661
- var originalGroup = this.group;
11662
- originalGroup.$.off('baseSizeUpdated.sslayer' + this.counter);
11663
- originalGroup.$.off('textAlignUpdated.sslayer' + this.counter);
 
 
11664
 
11665
- this.group = newGroup;
11666
- var originalPlacementData = this.placement.setMode(newGroup.container.allowedPlacementMode);
11667
- newGroup.container.syncLayerRow(this);
11668
 
11669
- this.refreshBaseSize();
11670
- newGroup.$.on('baseSizeUpdated.sslayer' + this.counter, this.proxyRefreshBaseSize);
11671
- newGroup.$.on('textAlignUpdated.sslayer' + this.counter, this.proxyRefreshTextAlign);
11672
 
11673
- this.userGroupChange(originalGroup, originalIndex, originalPlacementData, newGroup, this.getIndex());
11674
 
11675
- originalGroup.update();
11676
  };
11677
 
11678
- ComponentAbstract.prototype.userGroupChange = function (originalGroup, originalIndex, originalPlacementData, newGroup, newIndex) {
11679
- if (originalGroup == newGroup) {
11680
- this.userIndexChange(originalIndex, newIndex);
11681
- } else {
11682
- var task = N2Classes.History.get().addValue(this, this.historyUserGroupChange, []);
11683
-
11684
- if (task) {
11685
- task.setValues({
11686
- historyGroup: originalGroup,
11687
- index: originalIndex,
11688
- placementData: originalPlacementData
11689
- }, {
11690
- historyGroup: newGroup,
11691
- index: newIndex
11692
- });
11693
- }
11694
  }
11695
  };
11696
 
11697
- ComponentAbstract.prototype.historyUserGroupChange = function (data) {
11698
- var originalGroup = this.group,
11699
- group = data.historyGroup.getSelf(),
11700
- index = data.index;
11701
- group.container.insertLayerAt(this, index);
11702
-
11703
- this.group.$.off('baseSizeUpdated.sslayer' + this.counter);
11704
- this.group.$.off('refreshTextAlign.sslayer' + this.counter);
 
11705
 
11706
- this.group = group;
11707
- if (data.placementData) {
11708
- this.layer.data(data.placementData);
 
 
 
11709
  }
11710
- this.placement.setMode(group.container.allowedPlacementMode);
11711
- group.container.syncLayerRow(this);
11712
-
11713
- this.refreshBaseSize();
11714
- this.group.$.on('baseSizeUpdated.sslayer' + this.counter, this.proxyRefreshBaseSize);
11715
- this.group.$.on('refreshTextAlign.sslayer' + this.counter, this.proxyRefreshBaseSize);
11716
 
 
11717
 
11718
- group.onChildCountChange();
11719
 
11720
- if (data.placementData) {
11721
- this.placement.sync();
11722
  }
11723
 
11724
- originalGroup.update();
11725
- };
11726
-
11727
- ComponentAbstract.prototype.userIndexChange = function (originalIndex, newIndex) {
11728
 
11729
- var task = N2Classes.History.get().addValue(this, this.historyUserIndexChange);
11730
- if (task) {
11731
- task.setValues(originalIndex, newIndex);
 
11732
  }
11733
- this.group.container.insertLayerAt(this, newIndex);
11734
  };
11735
 
11736
- ComponentAbstract.prototype.historyUserIndexChange = function (value) {
11737
- this.group.container.insertLayerAt(this, value);
11738
  };
11739
 
 
 
 
 
 
 
 
11740
 
11741
- ComponentAbstract.prototype._createLayerListRow = function (actions) {
11742
- this.layerRow = $('<li class="n2-ss-layerlist-row"></li>')
11743
- .data('layer', this)
11744
- .on({
11745
- mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerRowClicked')
11746
- })
11747
- .appendTo(this.group.container.$ul);
11748
- this.layerTitleSpan = $('<span class="n2-ucf">' + this.property.name + '</span>');
11749
-
11750
- this.makeNameEditable();
11751
 
11752
- this.layerTitle = $('<div class="n2-ss-layer-title"></div>')
11753
- .on({
11754
- mouseenter: $.proxy(function () {
11755
- this.fragmentEditor.highlight(this);
11756
- }, this),
11757
- mouseleave: $.proxy(function () {
11758
- this.fragmentEditor.deHighlight(this);
11759
- }, this),
11760
- })
11761
- .append(this.layerTitleSpan)
11762
- .append(actions)
11763
- .appendTo(this.layerRow)
11764
- .on({
11765
- mouseup: $.proxy(function (e) {
11766
- if (!nextend.shouldPreventMouseUp && e.target.tagName === 'DIV') {
11767
- this.activate(e);
11768
  }
11769
- }, this)
11770
- });
11771
-
11772
- nextend.tooltip.add(this.layerRow);
11773
-
11774
- this.layerRow.nUILayerListItem({
11775
- UIManager: this.fragmentEditor.mainContainer.layerListUIManager,
11776
- layer: this,
11777
- $item: this.layerRow
11778
- });
11779
-
11780
- return this.layerRow;
11781
- };
11782
-
11783
- ComponentAbstract.prototype.select = function (e) {
11784
- return this.fragmentEditor.selectLayer(this, true);
11785
- };
11786
-
11787
- ComponentAbstract.prototype.update = function () {
11788
- this.readyDeferred.done($.proxy(this.placement.updatePositionThrottled, this.placement));
11789
- //this.placement.updatePositionThrottled();
11790
- };
11791
-
11792
- ComponentAbstract.prototype.updateThrottled = function () {
11793
- this.placement.updatePositionThrottled();
11794
- };
11795
-
11796
- ComponentAbstract.prototype.positionSidebar = function () {
11797
- this.fragmentEditor.layerWindow.show(this, this.layer);
11798
- };
11799
-
11800
- ComponentAbstract.prototype.showEditor = function () {
11801
- this.fragmentEditor.layerWindow._show();
11802
  };
11803
 
11804
- ComponentAbstract.prototype.highlight = function (hideInterval) {
11805
- hideInterval = hideInterval || 2000;
11806
- if (this.isHighlighted) {
11807
- clearTimeout(this.isHighlighted);
11808
- this.isHighlighted = false;
11809
- }
11810
- this.layer.addClass('n2-highlight');
11811
- this.isHighlighted = setTimeout($.proxy(function () {
11812
- this.layer.removeClass('n2-highlight');
11813
- }, this), hideInterval);
11814
  };
11815
 
11816
- ComponentAbstract.prototype.setPropertydesktopPortrait =
11817
- ComponentAbstract.prototype.setPropertydesktopLandscape =
11818
- ComponentAbstract.prototype.setPropertytabletPortrait =
11819
- ComponentAbstract.prototype.setPropertytabletLandscape =
11820
- ComponentAbstract.prototype.setPropertymobilePortrait =
11821
- ComponentAbstract.prototype.setPropertymobileLandscape = function (name, value, from) {
11822
- this._setProperty(name, parseInt(value), from);
11823
- };
11824
 
11825
- ComponentAbstract.prototype.getHTML = function (base64) {
11826
- var $layer = this._createLayer();
 
 
 
 
 
 
 
11827
 
11828
- for (var k in this.property) {
11829
- if (k != 'width' && k != 'height' && k != 'left' && k != 'top') {
11830
- $layer.attr('data-' + k.toLowerCase(), this.property[k]);
11831
- }
11832
- }
11833
 
11834
- for (var k in this.deviceProperty) {
11835
- for (var k2 in this.deviceProperty[k]) {
11836
- $layer.attr('data-' + k.toLowerCase() + k2, this.deviceProperty[k][k2]);
11837
- }
11838
- }
11839
 
11840
- for (var k in this.deviceProperty['desktop']) {
11841
- $layer.css(k, this.deviceProperty['desktop'][k] + 'px');
11842
- }
11843
 
11844
- if (this.container != undefined) {
11845
- var $innerContainer = $layer;
11846
- if (this.innerContainer != undefined) {
11847
- $innerContainer = $layer.find(this.innerContainer);
11848
- }
11849
 
11850
- $innerContainer.append(this.container.getHTML(base64));
11851
- }
11852
 
11853
- var id = this.getProperty('id');
11854
- if (id && id != '') {
11855
- $layer.attr('id', id);
11856
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11857
 
11858
- if (this.status > N2Classes.ComponentAbstract.STATUS.NORMAL) {
11859
- $layer.attr('data-status', this.status);
 
 
 
 
 
 
 
 
 
 
 
 
 
11860
  }
 
11861
 
11862
- return $layer;
11863
- };
 
 
11864
 
11865
- ComponentAbstract.prototype.duplicate = function (needActivate) {
11866
- var $component = this.getHTML(false);
11867
 
11868
- if (this.placement.getType() == 'absolute') {
11869
- var id = $component.attr('id');
11870
- if (id) {
11871
- id = $.fn.uid();
11872
- $component.attr('id', id);
11873
- $component.attr('data-id', id);
11874
- }
11875
- if ($component.attr('data-parentid')) {
11876
- $component.data('desktopportraittop', 0);
11877
- $component.data('desktopportraitleft', 0);
11878
- } else {
11879
- $component.data('desktopportraittop', $component.data('desktopportraittop') + 40);
11880
- $component.data('desktopportraitleft', $component.data('desktopportraitleft') + 40);
11881
  }
11882
- $component.attr('data-parentid', '');
11883
 
11884
- }
11885
- /*
11886
- console.log($component.find('[data-uniqueclass]').addBack('[data-uniqueclass]'));
11887
- var uniqueclass = $component.attr('data-uniqueclass');
11888
- if (uniqueclass) {
11889
- $component.removeClass(uniqueclass);
11890
- uniqueclass = $.fn.generateUniqueClass('n-uc-');
11891
- $component.attr('data-uniqueclass', uniqueclass);
11892
- $component.addClass(uniqueclass);
11893
- }
11894
- */
11895
- var newComponent = this.fragmentEditor.insertComponentWithNode(this.group, $component, this.getIndex() + 1, false, true);
11896
 
11897
- this.layerRow.trigger('mouseleave');
11898
 
11899
- if (needActivate) {
11900
- newComponent.activate();
11901
- }
11902
 
11903
- N2Classes.History.get().addSimple(this, this.historyDeleteDuplicated, this.historyDuplicate, [newComponent, newComponent.container ? newComponent.container.getAllLayers() : false]);
11904
 
11905
- return newComponent;
11906
- };
11907
 
11908
- ComponentAbstract.prototype.historyDeleteDuplicated = function (historicalNewComponent) {
11909
- historicalNewComponent.getSelf().delete();
11910
- };
 
 
 
11911
 
11912
- ComponentAbstract.prototype.historyDuplicate = function (historicalNewComponent, historicalAllLayers) {
11913
- var newComponent = this.duplicate(false, false);
11914
- historicalNewComponent.setSelf(newComponent);
11915
 
11916
- if (historicalAllLayers) {
11917
- var newAllLayers = newComponent.container.getAllLayers();
11918
- for (var i = 0; i < newAllLayers.length; i++) {
11919
- historicalAllLayers[i].setSelf(newAllLayers[i]);
11920
- }
11921
  }
 
 
11922
  };
11923
 
11924
- ComponentAbstract.prototype.historyDelete = function () {
11925
- this.delete();
11926
- };
11927
-
11928
- ComponentAbstract.prototype.historyRestore = function ($component, historicalGroup, index, historicalAllLayers) {
11929
- var newComponent = this.fragmentEditor.insertComponentWithNode(this.group.getSelf(), $component.clone(), index, false, true);
11930
- this.setSelf(newComponent);
11931
 
11932
- if (historicalAllLayers) {
11933
- var newAllLayers = newComponent.container.getAllLayers();
11934
- for (var i = 0; i < newAllLayers.length; i++) {
11935
- historicalAllLayers[i].setSelf(newAllLayers[i]);
11936
- }
11937
  }
11938
  };
11939
 
11940
- ComponentAbstract.prototype.delete = function () {
11941
- N2Classes.PositionDisplay.get().hide();
11942
- nextend.tooltip.onLeave();
11943
- this._delete();
11944
- };
11945
 
11946
- ComponentAbstract.prototype._delete = function () {
 
 
 
 
 
 
 
 
 
 
 
 
11947
 
11948
- this.isDeleteStarted = true;
 
11949
 
11950
- if (this.fragmentEditor.mainContainer.getSelectedLayer() == this) {
11951
- this.fragmentEditor.layerWindow.hide();
11952
- }
11953
 
11954
- if (this.isHighlighted) {
11955
- clearTimeout(this.isHighlighted);
11956
- this.isHighlighted = false;
11957
- }
11958
 
11959
- N2Classes.History.get().startBatch();
11960
- N2Classes.History.get().addSimple(this, this.historyRestore, this.historyDelete, [this.getHTML(false), this.group, this.getIndex(), this.container ? this.container.getAllLayers() : false]);
 
11961
 
11962
- this.deActivate();
 
 
11963
 
11964
- if (this.container != undefined) {
11965
- N2Classes.History.get().off();
11966
- var layers = this.container.getSortedLayers();
11967
- for (var i = 0; i < layers.length; i++) {
11968
- layers[i]._delete();
11969
- }
11970
- N2Classes.History.get().on();
11971
- }
11972
- N2Classes.History.get().endBatch();
11973
 
11974
- if (this.item != undefined) {
11975
- this.item.delete();
11976
- }
11977
 
11978
- this.placement.delete();
 
 
 
 
11979
 
11980
- // If delete happen meanwhile layer dragged or resized, we have to cancel that.
11981
- this.layer.trigger('mouseup');
 
 
 
 
 
 
 
11982
 
11983
- this.isDeleted = true;
11984
 
11985
- this.fragmentEditor.mainContainer.layerDeleted(this);
 
 
 
 
 
 
 
 
11986
 
11987
- this.layer.triggerHandler('LayerDeleted');
11988
- this.getRootElement().remove();
11989
- this.layerRow.remove();
 
 
 
 
 
 
 
 
11990
 
11991
- this.group.update();
 
 
 
 
 
 
11992
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11993
 
11994
- this.group.$.off('baseSizeUpdated.sslayer' + this.counter);
11995
- this.group.$.off('refreshTextAlign.sslayer' + this.counter);
11996
- this.$.trigger('layerDeleted');
 
11997
 
11998
- if (this.markTimer) {
11999
- clearTimeout(this.markTimer);
12000
- }
 
 
 
 
12001
 
12002
- //delete this.fragmentEditor;
12003
- delete this.layer;
12004
- delete this.itemEditor;
12005
- this.group.onChildCountChange();
12006
- };
12007
 
12008
- ComponentAbstract.prototype.getData = function (params) {
12009
- var data = {
12010
- type: this.type,
12011
- lastplacement: this.placement.getType()
12012
- };
12013
 
12014
- if (this.status > N2Classes.ComponentAbstract.STATUS.NORMAL) {
12015
- data.status = this.status;
12016
  }
 
12017
 
12018
- var properties = $.extend({}, this.property);
12019
-
12020
- // store the device based properties
12021
- for (var device in this.deviceProperty) {
12022
- for (var property in this.deviceProperty[device]) {
12023
- delete properties[property];
12024
- var value = this.deviceProperty[device][property];
12025
- if (typeof value === 'undefined') {
12026
- continue;
12027
- }
12028
 
12029
- switch (property) {
12030
- case 'width':
12031
- case 'height':
12032
- if (!this.isDimensionPropertyAccepted(value)) {
12033
- value = parseFloat(value);
12034
- }
12035
- break;
12036
- case 'fontsize':
12037
- case 'left':
12038
- case 'top':
12039
- case 'gutter':
12040
- case 'wrap':
12041
- value = parseFloat(value);
12042
- break;
12043
- }
12044
- data[device.toLowerCase() + property] = value;
12045
- }
12046
  }
 
 
12047
 
12048
- for (var k in properties) {
12049
- data[k.toLowerCase()] = properties[k];
 
 
 
 
12050
  }
12051
 
12052
- return data;
12053
- };
12054
 
12055
- ComponentAbstract.prototype.onChildCountChange = function () {
 
 
 
12056
 
 
12057
  };
12058
 
12059
  /**
12060
- *
12061
- * @param array layersData Contains
12062
- * @param array layers Contains layer objects to be able to track layers in the current copy process to prevent same layer inserted into the clipboard twice when parent picker used.
12063
- * @returns array layersData
12064
  */
12065
- ComponentAbstract.prototype.getDataWithChildren = function (layersData, layers) {
12066
- if ($.inArray(this, layers) == -1) {
12067
- layers.push(this);
12068
- layersData.push(this.getData({
12069
- layersIncluded: true,
12070
- itemsIncluded: true
12071
- }));
12072
- this.layer.triggerHandler('LayerGetDataWithChildren', [layersData, layers]);
12073
- }
12074
- return layersData;
12075
- };
12076
-
12077
- ComponentAbstract.prototype.markOver = function (e) {
12078
- this.layer.addClass('n2-ss-mouse-over');
12079
- e.stopPropagation();
12080
-
12081
- this.group.markEnter();
12082
 
12083
- if (this.markTimer) {
12084
- clearTimeout(this.markTimer);
12085
  }
12086
- this.layer.addClass('n2-ss-mouse-over-delayed');
12087
- this.uiLabel.removeClass('invisible');
12088
  };
12089
 
12090
- ComponentAbstract.prototype.markOut = function (e) {
12091
- this.layer.removeClass('n2-ss-mouse-over');
12092
- if (e) {
12093
- e.stopPropagation();
12094
- }
12095
- this.group.markLeave();
 
 
 
 
 
 
 
 
 
12096
 
12097
- if (this.markTimer) {
12098
- clearTimeout(this.markTimer);
12099
- }
12100
- if (!this.isActive) {
12101
- this.uiLabel.addClass('invisible');
12102
- }
12103
- this.markTimer = setTimeout($.proxy(function () {
12104
- this.layer.removeClass('n2-ss-mouse-over-delayed');
12105
- this.uiLabel.removeClass('invisible');
12106
- this.markTimer = null;
12107
- }, this), 10);
12108
- };
12109
 
12110
- ComponentAbstract.prototype.markEnter = function (e) {
12111
- this.layer.addClass('n2-ss-mouse-hover');
12112
- this.group.markEnter();
12113
- };
12114
 
12115
- ComponentAbstract.prototype.markLeave = function (e) {
12116
- this.layer.removeClass('n2-ss-mouse-hover');
12117
- this.group.markLeave();
12118
- };
 
12119
 
 
 
12120
 
12121
- ComponentAbstract.prototype.formSetname = function (options, value) {
 
 
12122
 
 
 
 
 
 
 
 
12123
  };
12124
 
12125
- ComponentAbstract.prototype.formSetnameSynced = function (options, value) {
 
 
12126
 
 
 
12127
  };
12128
 
12129
- ComponentAbstract.prototype.formSetdesktopPortrait = function (options, value) {
12130
- options.currentForm.desktopPortrait.data('field').insideChange(value);
 
12131
  };
12132
 
12133
- ComponentAbstract.prototype.formSetdesktopLandscape = function (options, value) {
12134
- options.currentForm.desktopLandscape.data('field').insideChange(value);
 
12135
  };
12136
 
12137
- ComponentAbstract.prototype.formSettabletPortrait = function (options, value) {
12138
- options.currentForm.tabletPortrait.data('field').insideChange(value);
12139
  };
12140
 
12141
- ComponentAbstract.prototype.formSettabletLandscape = function (options, value) {
12142
- options.currentForm.tabletLandscape.data('field').insideChange(value);
12143
- };
 
12144
 
12145
- ComponentAbstract.prototype.formSetmobilePortrait = function (options, value) {
12146
- options.currentForm.mobilePortrait.data('field').insideChange(value);
12147
- };
 
 
 
 
 
 
12148
 
12149
- ComponentAbstract.prototype.formSetmobileLandscape = function (options, value) {
12150
- options.currentForm.mobileLandscape.data('field').insideChange(value);
12151
- };
 
 
 
 
 
 
 
 
12152
 
12153
- ComponentAbstract.prototype.sync = function () {
12154
- this._syncid();
12155
- if (this.container) {
12156
- var layers = this.container.getSortedLayers();
12157
- for (var i = 0; i < layers.length; i++) {
12158
- layers[i].sync();
12159
  }
12160
  }
12161
- this.placement.sync();
12162
- };
12163
 
12164
- ComponentAbstract.prototype._syncid = function () {
12165
- var value = this.getProperty('id');
12166
- if (!value || value == '') {
12167
- this.layer.removeAttr('id');
12168
- } else {
12169
- this.layer.attr('id', value);
12170
  }
12171
- };
12172
 
12173
- ComponentAbstract.prototype.requestID = function () {
12174
- var id = this.getProperty('id');
12175
- if (!id) {
12176
- id = $.fn.uid();
12177
- this.setProperty('id', id, 'layer');
 
 
 
 
 
 
12178
  }
12179
- return id;
 
12180
  };
12181
 
12182
- ComponentAbstract.prototype.requestUniqueClass = function () {
12183
- var uniqueClass = this.getProperty('uniqueclass');
12184
- if (!uniqueClass) {
12185
- uniqueClass = $.fn.generateUniqueClass('n-uc-');
12186
- this.setProperty('uniqueclass', uniqueClass, 'layer');
12187
  }
12188
- return uniqueClass;
 
 
12189
  };
12190
 
 
 
 
 
 
 
 
12191
  /**
12192
- * Used when duplicate or paste node to prevent class name conflicts
 
 
12193
  */
12194
- ComponentAbstract.prototype.regenerateUniqueClass = function () {
12195
- if (this.getProperty('uniqueclass')) {
12196
- this.setProperty('uniqueclass', $.fn.generateUniqueClass('n-uc-'), 'layer');
12197
- }
12198
- };
12199
-
12200
- ComponentAbstract.prototype._syncuniqueclass = function () {
12201
- var value = this.getProperty('uniqueclass');
12202
 
12203
- for (var i = 0; i < this.classElements.length; i++) {
12204
- this.classElements[i].$el
12205
- .removeClass(function (index, className) {
12206
- return (className.match(/n-uc-[a-z0-9\-]+/gi) || []).join(' ');
12207
- })
12208
- .addClass(value + this.classElements[i].postfix);
12209
- }
12210
  };
12211
 
12212
- ComponentAbstract.prototype._syncfontsize = function () {
12213
- this.adjustFontSize(this.getProperty('adaptivefont'), this.getProperty('fontsize'), true);
 
 
 
 
 
 
 
 
 
 
 
 
 
12214
  };
12215
 
12216
- ComponentAbstract.prototype._syncadaptivefont = function () {
12217
- this.adjustFontSize(this.getProperty('adaptivefont'), this.getProperty('fontsize'), true);
12218
- };
 
 
 
 
 
 
 
 
 
 
 
 
12219
 
12220
- ComponentAbstract.prototype.adjustFontSize = function (isAdaptive, fontSize, shouldUpdatePosition) {
12221
- fontSize = parseInt(fontSize);
12222
- if (parseInt(isAdaptive)) {
12223
- this.layer.css('font-size', (16 * fontSize / 100) + 'px');
12224
- } else if (fontSize != 100) {
12225
- this.layer.css('font-size', fontSize + '%');
12226
- } else {
12227
- this.layer.css('font-size', '');
12228
- }
12229
- this.refreshBaseSize();
12230
- if (shouldUpdatePosition) {
12231
- this.update();
12232
- }
12233
  };
12234
 
12235
- ComponentAbstract.prototype.refreshBaseSize = function () {
12236
- var fontSize = this.getFontSize();
12237
- if (this.isAdaptiveFont()) {
12238
- this.baseSize = (16 * fontSize / 100);
12239
- } else {
12240
- this.baseSize = this.group.baseSize * fontSize / 100;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12241
  }
12242
- this.$.triggerHandler('baseSizeUpdated');
12243
  };
12244
 
12245
- ComponentAbstract.prototype.refreshTextAlign = function () {
 
 
 
 
 
 
 
 
 
 
12246
 
12247
- this.$.triggerHandler('textAlignUpdated');
12248
  }
12249
 
12250
- ComponentAbstract.prototype.getFontSize = function () {
12251
- return parseInt(this.getProperty('fontsize'));
 
 
 
 
 
 
 
12252
  };
12253
 
12254
- ComponentAbstract.prototype.isAdaptiveFont = function () {
12255
- return parseInt(this.getProperty('adaptivefont'));
 
 
12256
  };
12257
 
12258
- ComponentAbstract.prototype._synccrop = function () {
12259
- var value = this.getProperty('crop');
12260
- if (value == 'auto') {
12261
- value = 'hidden';
12262
  }
 
 
12263
 
12264
- if (value == 'mask') {
12265
- value = 'hidden';
12266
- this.addWrap('mask', "<div class='n2-ss-layer-mask'></div>");
12267
 
12268
- } else {
12269
- this.removeWrap('mask');
 
 
12270
 
12271
- this.layer.data('animatableselector', null);
12272
- }
12273
- this.layer.css('overflow', value);
12274
  };
12275
 
12276
- ComponentAbstract.prototype._syncrotation = function () {
12277
- var rotation = parseFloat(this.getProperty('rotation'));
12278
- if (rotation / 360 != 0) {
12279
- var $el = this.addWrap('rotation', "<div class='n2-ss-layer-rotation'></div>");
12280
 
12281
- NextendTween.set($el[0], {
12282
- rotationZ: rotation
12283
- });
12284
- } else {
12285
- this.removeWrap('rotation');
12286
- }
12287
  };
12288
 
12289
- ComponentAbstract.prototype.addWrap = function (key, html) {
12290
- if (this.wraps[key] === undefined) {
12291
- var $el = $(html);
12292
- this.wraps[key] = $el;
12293
 
12294
- switch (key) {
12295
- case 'mask':
12296
- $el.appendTo(this.layer);
12297
- if (this.wraps.rotation !== undefined) {
12298
- $el.append(this.wraps.rotation);
12299
- } else {
12300
- $el.append(this.getContents());
12301
- }
12302
- this.layer.data('animatableselector', '.n2-ss-layer-mask:first');
12303
- break;
12304
- case 'rotation':
12305
- if (this.wraps.mask !== undefined) {
12306
- $el.appendTo(this.wraps.mask);
12307
- } else {
12308
- $el.appendTo(this.layer);
12309
- }
12310
- $el.append(this.getContents());
12311
- break;
12312
  }
 
 
12313
  }
12314
- return this.wraps[key];
12315
  };
12316
 
12317
- ComponentAbstract.prototype.removeWrap = function (key) {
12318
- if (this.wraps[key] !== undefined) {
 
 
12319
 
12320
- switch (key) {
12321
- case 'mask':
12322
- if (this.wraps.rotation !== undefined) {
12323
- this.layer.append(this.wraps.rotation);
12324
- } else {
12325
- this.layer.append(this.getContents());
12326
- }
12327
- break;
12328
- case 'rotation':
12329
- if (this.wraps.mask !== undefined) {
12330
- this.wraps.mask.append(this.getContents());
12331
- } else {
12332
- this.layer.append(this.getContents());
12333
- }
12334
- break;
12335
- }
12336
- this.wraps[key].remove();
12337
- delete this.wraps[key];
12338
- }
12339
- };
12340
 
12341
- ComponentAbstract.prototype.getContents = function () {
12342
- return false;
12343
- };
 
 
12344
 
12345
- ComponentAbstract.prototype._syncclass = function () {
12346
- if (this._lastClasses !== false) {
12347
- this.layer.removeClass(this._lastClasses);
12348
- }
12349
- var value = this.fragmentEditor.editor.generator.fill(this.getProperty('class'));
12350
 
12351
- if (value && value != '') {
12352
- this.layer.addClass(value);
12353
- this._lastClasses = value;
12354
- } else {
12355
- this._lastClasses = false;
12356
- }
12357
- };
 
12358
 
12359
- ComponentAbstract.prototype._syncparallax = function () {
12360
 
12361
- };
 
12362
 
12363
- ComponentAbstract.prototype._syncgeneratorvisible = function () {
 
 
 
 
 
12364
  };
12365
 
12366
- ComponentAbstract.prototype._syncmouseenter =
12367
- ComponentAbstract.prototype._syncclick =
12368
- ComponentAbstract.prototype._syncmouseleave =
12369
- ComponentAbstract.prototype._syncplay =
12370
- ComponentAbstract.prototype._syncpause =
12371
- ComponentAbstract.prototype._syncstop = function () {
12372
- };
12373
 
 
12374
 
12375
- ComponentAbstract.prototype.renderModeProperties = function (isReset) {
 
 
12376
 
12377
- N2Classes.LayerDataStorage.prototype.renderModeProperties.call(this);
 
 
12378
 
 
 
 
12379
 
12380
- this.placement.renderModeProperties(isReset);
12381
- };
 
12382
 
12383
- ComponentAbstract.prototype.getIndex = function () {
12384
- return this.group.container.getLayerIndex(this.layer);
12385
- };
12386
 
12387
- ComponentAbstract.prototype.toString = function () {
12388
- return this.type + ' #' + this.counter;
 
 
 
12389
  };
12390
 
12391
- ComponentAbstract.prototype.setSelf = function (self) {
12392
- if (self === undefined) {
12393
- console.error(self);
12394
- }
12395
- if (this.self != this) {
12396
- this.self.setSelf(self);
12397
- }
12398
- this.self = self;
12399
 
12400
- };
12401
 
12402
- ComponentAbstract.prototype.getSelf = function () {
12403
- if (this.self !== this) {
12404
- this.self = this.self.getSelf();
12405
- }
12406
- return this.self;
12407
- };
12408
 
12409
- ComponentAbstract.prototype.historyStoreOnPlacement = function () {
12410
- var args = Array.prototype.slice.call(arguments);
12411
- args.splice(1, 1);
12412
- this.placement.current[arguments[1]].apply(this.placement.current, args);
12413
- };
12414
 
12415
- ComponentAbstract.prototype.getDroppable = function () {
12416
- return false;
12417
  };
12418
 
12419
- ComponentAbstract.prototype.onCanvasUpdate = function (originalIndex, targetGroup, newIndex) {
12420
 
12421
- if (this.group === targetGroup) {
12422
 
12423
- if (originalIndex != newIndex) {
12424
- this.userIndexChange(originalIndex, newIndex)
12425
- }
12426
- } else {
12427
- var oldAbsoluteParent;
12428
- if (this.fragmentEditor.isCol(this.group)) {
12429
- oldAbsoluteParent = this;
12430
- while (oldAbsoluteParent && (!oldAbsoluteParent.placement || oldAbsoluteParent.placement.getType() !== 'absolute')) {
12431
- oldAbsoluteParent = oldAbsoluteParent.group;
12432
- }
12433
- }
12434
- this.changeGroup(originalIndex, targetGroup);
12435
 
12436
- targetGroup.onChildCountChange();
 
 
12437
 
12438
- // Find the the first absolute element from the layer parents
12439
- var absoluteParent = this;
12440
- while (absoluteParent && (!absoluteParent.placement || absoluteParent.placement.getType() !== 'absolute')) {
12441
- absoluteParent = absoluteParent.group;
12442
- }
12443
 
12444
- // Update the closest absolute parent's position as the content changed
12445
- if (oldAbsoluteParent && oldAbsoluteParent != absoluteParent) {
12446
- oldAbsoluteParent.placement.updatePosition();
12447
- }
12448
- if (absoluteParent) {
12449
- absoluteParent.placement.updatePosition();
 
 
12450
  }
12451
  }
12452
  };
12453
 
12454
- ComponentAbstract.prototype.setStatusNormal = function () {
12455
- this.changeStatus(ComponentAbstract.STATUS.NORMAL);
12456
- };
12457
 
12458
- ComponentAbstract.prototype.changeStatus = function (status) {
12459
- var oldStatus = this.status;
12460
 
12461
- if (status == this.status) {
12462
- status = ComponentAbstract.STATUS.NORMAL;
12463
- }
12464
 
12465
- switch (this.status) {
12466
- case ComponentAbstract.STATUS.HIDDEN:
12467
- this.getRootElement().removeAttr('data-visibility');
12468
- this.layerRow.removeClass('n2-ss-layer-status-hidden');
12469
- break;
12470
- case ComponentAbstract.STATUS.LOCKED:
12471
- this.layer.removeClass('n2-ss-layer-locked');
12472
- this.layerRow.removeClass('n2-ss-layer-status-locked');
12473
- break;
12474
- }
12475
 
12476
- this.status = status;
12477
 
12478
- switch (this.status) {
12479
- case ComponentAbstract.STATUS.HIDDEN:
12480
- this.getRootElement().attr('data-visibility', 'hidden');
12481
- this.layerRow.addClass('n2-ss-layer-status-hidden');
12482
- break;
12483
- case ComponentAbstract.STATUS.LOCKED:
12484
- this.layer.addClass('n2-ss-layer-locked');
12485
- this.layerRow.addClass('n2-ss-layer-status-locked');
12486
- break;
12487
- }
12488
 
12489
- this.placement.current.changeStatus(oldStatus, this.status);
12490
 
 
 
 
 
 
 
12491
  };
12492
 
12493
- ComponentAbstract.prototype.moveX = function (x) {
12494
- if (this.placement.getType() == 'absolute') {
12495
- this.placement.current.moveX(x);
 
 
 
12496
  }
12497
  };
12498
 
12499
- ComponentAbstract.prototype.moveY = function (y) {
12500
- if (this.placement.getType() == 'absolute') {
12501
- this.placement.current.moveY(y);
 
12502
  }
 
12503
  };
12504
 
12505
- ComponentAbstract.prototype.localStyleSync = function () {
12506
- if (this.localStyle !== undefined) {
12507
- var rulesToDelete = [],
12508
- css = '';
12509
- if (this.$localStyle !== undefined) {
12510
- this.$localStyle.remove();
12511
- delete this.$localStyle;
12512
- }
12513
-
12514
- for (var i = 0; i < this.localStyle.length; i++) {
12515
 
12516
- var rule = '@rule' + this.localStyle[i].selector,
12517
- style = '';
12518
- rulesToDelete.push(rule);
12519
-
12520
- if (Object.keys(this.localStyle[i].css).length === 1 && this.localStyle[i].css.transition !== undefined) {
12521
- continue;
12522
- }
12523
- for (var k in this.localStyle[i].css) {
12524
- style += this.localStyle[i].css[k];
12525
- }
12526
- if (style != '') {
12527
- css += rule + '{' + style + '}';
12528
- }
12529
- }
12530
-
12531
- var className = this.getProperty('uniqueclass');
12532
- if (className) {
12533
- // We have to remove all previous rules before adding new ones.
12534
- for (var i = 0; i < rulesToDelete.length; i++) {
12535
- nextend.css.deleteRule(rulesToDelete[i].replace(/@rule/g, window.nextend.pre + '.' + className));
12536
- }
12537
- }
12538
- if (css != '') {
12539
- if (!className) {
12540
- className = this.requestUniqueClass();
12541
- }
12542
- this.$localStyle = $("<style>" + css.replace(/@rule/g, window.nextend.pre + '.' + className) + "</style>").appendTo("head");
12543
- }
12544
  }
12545
- };
12546
 
12547
- ComponentAbstract.prototype.addLocalStyle = function (group, name, style) {
12548
- for (var i = 0; i < this.localStyle.length; i++) {
12549
- if (this.localStyle[i].group === group) {
12550
- if (style === '') {
12551
- if (this.localStyle[i].css[name] !== undefined) {
12552
- delete this.localStyle[i].css[name];
12553
- }
12554
- } else {
12555
- this.localStyle[i].css[name] = style;
12556
- }
12557
- this.localStyleSyncThrottled();
12558
- break;
12559
- }
12560
- }
12561
  };
12562
 
12563
- ComponentAbstract.prototype.addClassElement = function ($el, postfix) {
12564
- if (arguments.length < 2) postfix = '';
12565
- this.classElements.push({
12566
- $el: $el,
12567
- postfix: postfix
12568
- });
12569
  };
12570
 
12571
- return ComponentAbstract;
12572
- });
12573
- N2D('Content', ['ContentAbstract'], function ($, undefined) {
12574
- "use strict";
12575
-
12576
- /**
12577
- * @memberOf N2Classes
12578
- *
12579
- * @constructor
12580
- * @augments ComponentAbstract
12581
- */
12582
- function Content(fragmentEditor, group, properties) {
12583
- this.label = n2_('Content');
12584
- this.type = 'content';
12585
-
12586
- this.innerContainer = '> .n2-ss-layer-content';
12587
-
12588
- this._defaults = $.extend({verticalalign: 'center'}, this._defaults);
12589
 
 
 
 
12590
 
12591
- this.localStyle = [
12592
- {
12593
- group: 'normal', selector: '', css: {
12594
- transition: 'transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;'
 
12595
  }
12596
- },
12597
- {group: 'hover', selector: ':HOVER', css: {}}
12598
- ];
12599
-
12600
- N2Classes.ContentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
12601
 
12602
- this.placement.allow('content');
12603
-
12604
- fragmentEditor.setMainContent(this);
12605
- }
 
12606
 
12607
- Content.prototype = Object.create(N2Classes.ContentAbstract.prototype);
12608
- Content.prototype.constructor = Content;
 
 
 
 
 
 
12609
 
12610
- Content.prototype.addUILabels = function () {
12611
- this.markTimer = null;
12612
- this.uiLabel = $('<div class="n2-ss-layer-ui-label-container"><div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-self">' + this.getUILabel() + '</div></div>')
12613
- .appendTo(this.layer);
12614
- };
12615
 
12616
- Content.prototype.addProperties = function ($layer) {
12617
 
12618
- N2Classes.ContentAbstract.prototype.addProperties.call(this, $layer);
 
 
 
 
12619
 
12620
- this.createDeviceProperty('selfalign', {desktopPortrait: 'inherit'}, $layer);
 
 
 
 
 
 
 
 
12621
 
12622
- };
 
 
 
 
 
 
 
 
 
 
 
 
12623
 
12624
- Content.prototype.getRootElement = function () {
12625
- return this.layer;
12626
  };
12627
 
12628
- Content.prototype.getBackgroundElement = function () {
12629
- return this.layer;
12630
- };
 
 
 
 
12631
 
12632
- Content.prototype._createLayer = function () {
12633
- return $('<div class="n2-ss-layer n2-ss-content-empty"><div class="n2-ss-section-main-content n2-ss-layer-content"></div></div>')
12634
- .attr('data-sstype', this.type);
12635
  };
12636
 
12637
- Content.prototype.createRow = function () {
12638
-
12639
- this.addClassElement(this.layer);
12640
-
12641
- this.$content = this.layer.find('.n2-ss-layer-content:first');
12642
-
12643
- var status = $('<div class="n2-ss-layer-status"></div>'),
12644
- remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this));
12645
-
12646
- this.container = new N2Classes.LayerContainer(this, $('<ul class="n2-list n2-h4 n2-list-orderable" />'), 'normal', '> .n2-ss-layer', ['row', 'layer']);
12647
- this.container.setLayerContainerElement(this.$content);
12648
 
 
 
12649
 
12650
- $('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(status).on('click', $.proxy(function (e) {
12651
- e.preventDefault();
12652
- if (this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN) {
12653
- this.setStatusNormal();
12654
- } else {
12655
- this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN);
12656
  }
12657
- }, this));
12658
-
12659
- this._createLayerListRow([
12660
- $('<div class="n2-actions-left"></div>').append(status),
12661
- $('<div class="n2-actions"></div>').append(remove)
12662
- ]).addClass('n2-ss-layer-content-row');
12663
-
12664
-
12665
- this.openerElement = $('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-col"></i></a>').insertBefore(this.layerTitleSpan)
12666
- .on('click', $.proxy(this.switchOpened, this));
12667
-
12668
- this.container.$ul.appendTo(this.layerRow);
12669
 
12670
- this.readyDeferred.done($.proxy(this._syncopened, this));
 
 
 
 
12671
  };
12672
 
12673
- Content.prototype.create = function () {
 
 
 
 
 
 
12674
 
12675
- this.originalProperties.adaptivefont = 1;
 
12676
 
12677
- N2Classes.ContentAbstract.prototype.create.call(this);
 
 
12678
 
12679
- this._syncselfalign();
 
12680
 
12681
- this._onReady();
12682
  };
12683
 
12684
- Content.prototype.load = function ($layer, isEditorStart) {
12685
 
12686
- N2Classes.ContentAbstract.prototype.load.call(this, $layer, isEditorStart);
 
 
12687
 
12688
- this._syncselfalign();
 
12689
 
12690
- this._onReady();
 
 
 
 
12691
  };
12692
 
12693
- Content.prototype._onReady = function () {
12694
- N2Classes.ContentAbstract.prototype._onReady.call(this);
12695
- this.startUISizing();
12696
  };
12697
 
12698
- Content.prototype.startUISizing = function () {
12699
- this.layer.nUINormalSizing({
12700
- start: $.proxy(function (e, prop) {
12701
- N2Classes.PositionDisplay.get().show('NormalSizing');
12702
- if (prop === 'maxwidth') {
12703
- this.layer.attr('data-has-maxwidth', '1');
12704
- }
12705
- }, this),
12706
- resizeMaxWidth: $.proxy(function (e, ui) {
12707
 
12708
- N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Max-width: ' + (ui.value == 0 ? 'none' : (ui.value + 'px')));
 
12709
 
12710
- }, this),
12711
- stopMaxWidth: $.proxy(function (e, ui) {
12712
- N2Classes.PositionDisplay.get().hide('NormalSizing');
12713
- this.setProperty('maxwidth', ui.value);
12714
- }, this)
12715
- });
12716
- };
 
 
 
 
 
 
 
 
12717
 
12718
- Content.prototype.delete = function () {
12719
- var layers = this.container.getSortedLayers();
12720
- for (var i = 0; i < layers.length; i++) {
12721
- layers[i].delete();
12722
- }
12723
- };
 
 
 
 
12724
 
12725
- Content.prototype.remove = function () {
12726
- this._delete();
12727
- };
12728
 
12729
- Content.prototype.update = function () {
12730
- this.fragmentEditor.editor.getMainContainerElement().triggerHandler('updateSize');
12731
- };
12732
 
12733
- Content.prototype.onChildCountChange = function () {
 
12734
 
12735
- var layers = this.container.getSortedLayers();
12736
 
12737
- this.layer.toggleClass('n2-ss-content-empty', layers.length == 0);
12738
- };
12739
 
12740
- Content.prototype.renderModeProperties = function (isReset) {
12741
- N2Classes.ContentAbstract.prototype.renderModeProperties.call(this, isReset);
12742
 
12743
- this._syncselfalign();
12744
- };
12745
 
12746
- Content.prototype._syncselfalign = function () {
12747
- this.layer.attr('data-cssselfalign', this.getProperty('selfalign'));
12748
- };
12749
 
12750
- Content.prototype.duplicate = function (needActivate) {
12751
- console.error('Content can not be duplicated!');
12752
- };
12753
 
12754
- return Content;
12755
- });
12756
- N2D('ContentAbstract', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
12757
- "use strict";
12758
 
12759
- /**
12760
- * @memberOf N2Classes
12761
- *
12762
- * @param fragmentEditor
12763
- * @param group
12764
- * @param properties
12765
- * @constructor
12766
- * @augments ComponentAbstract
12767
- */
12768
- function ContentAbstract(fragmentEditor, group, properties) {
12769
 
12770
- this._defaults = $.extend({verticalalign: 'flex-start'}, this._defaults);
12771
 
12772
- this._syncbgThrottled = NextendThrottle(this._syncbgThrottled, 50);
 
 
 
 
 
12773
 
12774
- this.stylemode = '';
 
 
 
 
 
12775
 
12776
- N2Classes.ComponentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
 
 
12777
  }
12778
 
12779
- ContentAbstract.prototype = Object.create(N2Classes.ComponentAbstract.prototype);
12780
- ContentAbstract.prototype.constructor = ContentAbstract;
 
12781
 
12782
- ContentAbstract.prototype.addProperties = function ($layer) {
 
 
12783
 
12784
- this.createProperty('opened', 1, $layer, this);
 
 
12785
 
12786
- N2Classes.ComponentAbstract.prototype.addProperties.call(this, $layer);
12787
 
12788
- this.createProperty('bgimage', '', $layer);
12789
- this.createProperty('bgimagex', 50, $layer);
12790
- this.createProperty('bgimagey', 50, $layer);
12791
- this.createProperty('bgimageparallax', 0, $layer);
12792
 
12793
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolor', '00000000', {
12794
- "-hover": undefined
12795
- }, this, "stylemode"), $layer);
 
12796
 
12797
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradient', 'off', {
12798
- "-hover": undefined
12799
- }, this, "stylemode"), $layer);
 
 
 
 
 
 
 
12800
 
12801
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradientend', '00000000', {
12802
- "-hover": undefined
12803
- }, this, "stylemode"), $layer);
 
 
 
 
 
 
 
12804
 
12805
- this.createProperty('verticalalign', this._defaults.verticalalign, $layer);
 
 
 
 
 
 
 
 
 
 
12806
 
12807
- this.createDeviceProperty('maxwidth', {desktopPortrait: 0}, $layer);
 
 
12808
 
12809
- this.createDeviceProperty('inneralign', {desktopPortrait: 'inherit'}, $layer);
12810
- this.createDeviceProperty('padding', {desktopPortrait: '10|*|10|*|10|*|10|*|px+'}, $layer);
 
 
12811
 
 
12812
 
12813
- this.$.on('baseSizeUpdated.contentAbstract', $.proxy(this._syncpadding, this));
12814
- };
12815
 
12816
- ContentAbstract.prototype.getBackgroundElement = function () {
12817
- return this.$content;
 
 
 
 
 
 
 
12818
  };
12819
 
12820
- ContentAbstract.prototype.getPaddingElement = function () {
12821
- return this.$content;
12822
  };
12823
 
12824
- ContentAbstract.prototype.create = function () {
12825
- N2Classes.ComponentAbstract.prototype.create.call(this);
 
 
 
 
 
 
 
 
12826
 
12827
- this.initUI();
12828
 
12829
- this._syncverticalalign();
 
 
12830
 
12831
- this._syncmaxwidth();
12832
- this._syncpadding();
12833
- this._syncinneralign();
12834
- this._syncbgThrottled();
 
 
 
 
 
 
12835
  };
12836
 
12837
- ContentAbstract.prototype.load = function ($layer, isEditorStart) {
12838
 
12839
- N2Classes.ComponentAbstract.prototype.load.call(this, $layer, isEditorStart);
12840
 
12841
- this.initUI();
12842
 
12843
- this._syncverticalalign();
12844
- this._syncmaxwidth();
12845
- this._syncpadding();
12846
- this._syncinneralign();
12847
- this._syncbgThrottled();
12848
 
12849
- this.container.startWithExistingNodes(isEditorStart);
12850
- };
12851
 
12852
- ContentAbstract.prototype.initUI = function () {
12853
 
12854
- this.layer.on({
12855
- mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerClicked'),
12856
- click: $.proxy(function (e) {
12857
- if (!nextend.shouldPreventMouseUp && this.fragmentEditor.preventActivationBubbling()) {
12858
- this.activate(e);
12859
- }
12860
- }, this),
12861
- dblclick: $.proxy(function (e) {
12862
- e.stopPropagation();
12863
- $('[data-tab="layer"]').trigger('click');
12864
- }, this)
12865
- });
12866
-
12867
- this.getPaddingElement().nUISpacing({
12868
- handles: 'n, s, e, w',
12869
- start: $.proxy(function (e, ui) {
12870
- N2Classes.PositionDisplay.get().show('Spacing');
12871
- }, this),
12872
- spacing: $.proxy(function (e, ui) {
12873
- var html = '';
12874
- for (var k in ui.changed) {
12875
- html += 'Padding ' + k + ': ' + ui.changed[k] + 'px<br>';
12876
- }
12877
-
12878
- N2Classes.PositionDisplay.get().update(e, 'Spacing', html);
12879
- }, this),
12880
- stop: $.proxy(this.onSpacingStop, this),
12881
- });
12882
- };
12883
-
12884
- ContentAbstract.prototype.onSpacingStop = function (event, ui) {
12885
- N2Classes.PositionDisplay.get().hide('Spacing');
12886
- var padding = this.getPadding().split('|*|'),
12887
- ratioH = 1,
12888
- ratioV = 1;
12889
-
12890
- if (padding[padding.length - 1] == 'px+' && Math.abs(parseFloat(this.layer.css('fontSize')) - this.baseSize) > 1) {
12891
- ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
12892
- ratioV = this.fragmentEditor.getResponsiveRatioVertical();
12893
  }
12894
 
12895
- for (var k in ui.changed) {
12896
- var value = ui.changed[k];
12897
- switch (k) {
12898
- case 'top':
12899
- padding[0] = Math.round(value / ratioV);
12900
- break;
12901
- case 'right':
12902
- padding[1] = Math.round(value / ratioH);
12903
- break;
12904
- case 'bottom':
12905
- padding[2] = Math.round(value / ratioV);
12906
- break;
12907
- case 'left':
12908
- padding[3] = Math.round(value / ratioH);
12909
- break;
12910
- }
12911
  }
12912
- this.setProperty('padding', padding.join('|*|'));
12913
- $('#layercol-padding').data('field').insideChange(padding.join('|*|'));
12914
  };
12915
 
12916
- ContentAbstract.prototype.switchOpened = function (e) {
12917
- e.preventDefault();
12918
- if (this.getProperty('opened')) {
12919
- this.setProperty('opened', 0);
12920
- } else {
12921
- this.setProperty('opened', 1);
12922
  }
12923
- };
12924
 
12925
- ContentAbstract.prototype._syncopened = function () {
12926
- if (this.getProperty('opened')) {
12927
- this.openerElement.removeClass('n2-closed');
12928
- this.container.$ul.css('display', '');
12929
 
12930
- this.layer.triggerHandler('opened');
12931
- } else {
12932
- this.openerElement.addClass('n2-closed');
12933
- this.container.$ul.css('display', 'none');
12934
 
12935
- this.layer.triggerHandler('closed');
12936
- }
12937
- };
12938
 
12939
- ContentAbstract.prototype.getPadding = function () {
12940
- return this.getProperty('padding');
12941
- };
12942
 
12943
- ContentAbstract.prototype._syncpadding = function () {
12944
- var padding = this.getPadding().split('|*|'),
12945
- unit = padding.pop(),
12946
- baseSize = this.baseSize;
12947
- if (unit == 'px+' && baseSize > 0) {
12948
- unit = 'em';
12949
- for (var i = 0; i < padding.length; i++) {
12950
- padding[i] = parseInt(padding[i]) / baseSize;
12951
- }
12952
  }
12953
 
12954
- var css = padding.join(unit + ' ') + unit;
12955
- this.getPaddingElement().css('padding', css);
12956
- this.update();
 
12957
 
12958
- this.getPaddingElement().nUISpacing('option', 'current', css);
 
 
12959
  };
12960
 
12961
- ContentAbstract.prototype._syncmaxwidth = function () {
12962
- var value = parseInt(this.getProperty('maxwidth'));
12963
- if (value <= 0 || isNaN(value)) {
12964
- this.layer.css('maxWidth', '')
12965
- .attr('data-has-maxwidth', '0');
12966
- } else {
12967
- this.layer.css('maxWidth', value + 'px')
12968
- .attr('data-has-maxwidth', '1');
12969
- }
12970
 
12971
- this.update();
12972
- };
12973
 
12974
- ContentAbstract.prototype.getInnerAlign = function () {
12975
- return this.getProperty('inneralign');
12976
- };
12977
 
12978
- ContentAbstract.prototype._syncinneralign = function () {
12979
- this.layer.attr('data-csstextalign', this.getInnerAlign());
12980
 
12981
- this.refreshTextAlign();
 
 
 
12982
  };
12983
 
12984
- ContentAbstract.prototype.getVerticalAlign = function () {
12985
- return this.getProperty('verticalalign');
12986
  };
12987
 
12988
- ContentAbstract.prototype._syncverticalalign = function () {
12989
- this.$content.attr('data-verticalalign', this.getVerticalAlign());
12990
  };
12991
 
12992
- ContentAbstract.prototype._syncbgimage =
12993
- ContentAbstract.prototype._syncbgimagex =
12994
- ContentAbstract.prototype._syncbgimagey =
12995
- ContentAbstract.prototype._syncbgimageparallax =
12996
- ContentAbstract.prototype._syncbgcolor =
12997
- ContentAbstract.prototype._syncbgcolorgradient =
12998
- ContentAbstract.prototype._syncbgcolorgradientend =
12999
- ContentAbstract.prototype['_syncbgcolor-hover'] =
13000
- ContentAbstract.prototype['_syncbgcolorgradient-hover'] =
13001
- ContentAbstract.prototype['_syncbgcolorgradientend-hover'] = function () {
13002
- this._syncbgThrottled();
13003
- };
13004
 
 
 
 
13005
 
13006
- ContentAbstract.prototype._syncbgThrottled = function () {
13007
- var background = '',
13008
- image = this.fragmentEditor.editor.generator.fill(this.getProperty('bgimage')),
13009
- gradientBackgroundProps = '';
13010
- if (image != '') {
13011
- var x = parseInt(this.getProperty('bgimagex'));
13012
- if (!isFinite(x)) {
13013
- x = 50;
13014
- }
13015
- var y = parseInt(this.getProperty('bgimagey'));
13016
- if (!isFinite(y)) {
13017
- y = 50;
13018
- }
13019
- background += 'URL("' + nextend.imageHelper.fixed(image) + '") ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '');
13020
- gradientBackgroundProps = ' ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '')
13021
  }
13022
- var color = this.getProperty('bgcolor'),
13023
- gradient = this.getProperty('bgcolorgradient'),
13024
- colorend = this.getProperty('bgcolorgradientend');
13025
 
13026
- var normalStyle = this.getBackgroundCSS(color, gradient, colorend, background, gradientBackgroundProps);
 
 
 
13027
 
13028
- this.addLocalStyle('normal', 'bgcolor', normalStyle);
 
 
13029
 
 
 
 
13030
 
13031
- var hoverStyle = '',
13032
- isHoverDifferent = false,
13033
- colorHover = this.getProperty('bgcolor-hover'),
13034
- gradientHover = this.getProperty('bgcolorgradient-hover'),
13035
- colorendHover = this.getProperty('bgcolorgradientend-hover');
13036
 
13037
- if (colorHover !== undefined && colorHover != color) {
13038
- isHoverDifferent = true;
13039
- }
13040
- if (gradientHover !== undefined && gradientHover != gradient) {
13041
- isHoverDifferent = true;
13042
- }
13043
- if (colorendHover !== undefined && colorendHover != colorend) {
13044
- isHoverDifferent = true;
13045
- }
13046
 
13047
- if (isHoverDifferent) {
13048
- if (colorHover === undefined) {
13049
- colorHover = color;
13050
- }
13051
- if (gradientHover === undefined) {
13052
- gradientHover = gradient;
13053
- }
13054
- if (colorendHover === undefined) {
13055
- colorendHover = colorend;
 
 
 
 
 
 
13056
  }
13057
- hoverStyle = this.getBackgroundCSS(colorHover, gradientHover, colorendHover, background, gradientBackgroundProps);
13058
  }
13059
- this.addLocalStyle('hover', 'bgcolor', hoverStyle);
13060
  };
13061
 
13062
- ContentAbstract.prototype.getBackgroundCSS = function (color, gradient, colorend, backgroundImage, gradientBackgroundProps) {
13063
- if (N2Color.hex2alpha(color) != 0 || (gradient != 'off' && N2Color.hex2alpha(colorend) != 0)) {
13064
- var after = '';
13065
- if (backgroundImage != '') {
13066
- after = gradientBackgroundProps + ',' + backgroundImage;
13067
- }
13068
- switch (gradient) {
13069
- case 'horizontal':
13070
- return 'background:linear-gradient(to right, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
13071
- case 'vertical':
13072
- return 'background:linear-gradient(to bottom, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
13073
- case 'diagonal1':
13074
- return 'background:linear-gradient(45deg, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
13075
- case 'diagonal2':
13076
- return 'background:linear-gradient(135deg, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
13077
- case 'off':
13078
- default:
13079
- if (backgroundImage != '') {
13080
- return "background: linear-gradient(" + N2Color.hex2rgbaCSS(color) + ", " + N2Color.hex2rgbaCSS(color) + ")" + after + ';';
13081
- }
13082
- return 'background:' + N2Color.hex2rgbaCSS(color) + ';';
13083
- }
13084
- } else if (backgroundImage != '') {
13085
- return 'background:' + backgroundImage + ';';
13086
- }
13087
- return '';
13088
- };
13089
 
13090
- ContentAbstract.prototype.getData = function (params) {
13091
- var data = N2Classes.ComponentAbstract.prototype.getData.call(this, params);
13092
 
13093
- if (params.layersIncluded) {
13094
- data.layers = this.container.getData(params);
 
13095
  }
 
 
13096
 
13097
- return data;
13098
- };
13099
-
13100
- ContentAbstract.prototype.onChildCountChange = function () {
13101
- this.layer.toggleClass('n2-ss-content-empty', this.container.getLayerCount() == 0);
13102
-
13103
- this.update();
13104
- };
13105
-
13106
- ContentAbstract.prototype.renderModeProperties = function (isReset) {
13107
- N2Classes.ComponentAbstract.prototype.renderModeProperties.call(this, isReset);
13108
-
13109
- this._syncmaxwidth();
13110
 
13111
- this._syncpadding();
13112
- this._syncinneralign();
13113
- };
13114
 
13115
- ContentAbstract.prototype.getDroppable = function () {
13116
- if (!this.layer.is(":visible") || this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN || this.status == N2Classes.ComponentAbstract.STATUS.LOCKED) {
13117
- return 'hidden';
13118
- }
13119
- return {
13120
- $container: this.$content,
13121
- layer: this,
13122
- placement: 'normal',
13123
- axis: 'y'
13124
- }
13125
- };
13126
 
13127
- ContentAbstract.prototype.getLLDroppable = function (layer) {
13128
- switch (layer.type) {
13129
- case 'layer':
13130
- case 'row':
13131
- return {
13132
- $container: this.container.$ul,
13133
- layer: this
13134
- };
13135
- break;
13136
  }
13137
- return false;
13138
- };
13139
 
13140
- ContentAbstract.prototype.getContents = function () {
13141
- return this.$content;
13142
  };
13143
 
13144
- ContentAbstract.prototype.setPropertystylemode = function (name, value, from) {
13145
- this.stylemode = value;
13146
 
13147
- this.syncAdvancedField('bgcolor');
13148
- this.syncAdvancedField('bgcolorgradient');
13149
- this.syncAdvancedField('bgcolorgradientend');
 
 
13150
  };
13151
 
13152
- ContentAbstract.prototype.onSyncFields = function () {
13153
- this.fragmentEditor.layerOptions.updateField('stylemode', this.stylemode);
13154
  };
13155
 
13156
- return ContentAbstract;
13157
- });
13158
- N2D('Layer', ['ComponentAbstract'], function ($, undefined) {
13159
- "use strict";
13160
 
13161
- /**
13162
- * @memberOf N2Classes
13163
- *
13164
- * @constructor
13165
- * @augments ComponentAbstract
13166
- */
13167
- function Layer(fragmentEditor, group, properties) {
13168
- this.label = n2_('Layer');
13169
- this.type = 'layer';
13170
 
13171
- this.parent = false;
13172
 
13173
- this.itemEditor = fragmentEditor.itemEditor;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13174
 
13175
- N2Classes.ComponentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
13176
 
13177
- this.placement.allow('absolute');
13178
- this.placement.allow('normal');
 
 
 
13179
 
13180
- this.$.on('load create', $.proxy(this.startItem, this));
13181
  };
13182
 
13183
- Layer.prototype = Object.create(N2Classes.ComponentAbstract.prototype);
13184
- Layer.prototype.constructor = Layer;
 
13185
 
 
 
 
13186
 
13187
- Layer.prototype.create = function () {
 
 
13188
 
13189
- N2Classes.ComponentAbstract.prototype.create.apply(this, arguments);
 
 
13190
 
13191
- this.initUI();
 
 
13192
 
13193
- this._onReady();
 
 
 
 
 
 
 
 
 
13194
  };
13195
 
13196
- Layer.prototype.load = function ($layer, isEditorStart) {
 
 
 
 
 
 
 
13197
 
13198
- N2Classes.ComponentAbstract.prototype.load.call(this, $layer, isEditorStart);
 
13199
 
13200
- this.initUI();
 
 
 
 
13201
 
13202
- this._onReady();
13203
- };
 
 
 
13204
 
13205
- Layer.prototype.startItem = function () {
13206
- var $item = this.layer.find('.n2-ss-item');
 
13207
 
13208
- new N2Classes[this.itemEditor.getItemClass($item.data('item'))]($item, this, this.itemEditor);
 
 
 
 
13209
 
13210
- this.layer.nUICanvasItem({
13211
- canvasUIManager: this.fragmentEditor.mainContainer.canvasUIManager,
13212
- layer: this,
13213
- $layer: this.layer
13214
- });
13215
 
13216
- if (this.item.needSize) {
13217
- this.layer.addClass('n2-ss-layer-needsize');
 
13218
  }
13219
- };
13220
 
13221
- Layer.prototype.initUI = function () {
 
 
13222
 
13223
- this.layer.on({
13224
- mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerClicked'),
13225
- click: $.proxy(function (e) {
13226
- if (this.fragmentEditor.preventActivationBubbling()) {
13227
- this.activate(e);
13228
- }
13229
- }, this),
13230
- dblclick: $.proxy(function (e) {
13231
- if (!N2Classes.WindowManager.get().isPreventDblClick) {
13232
- e.stopPropagation();
13233
- $('[data-tab="item"]').trigger('click');
13234
- this.item.itemEditor.focusFirst('dblclick');
13235
- }
13236
- }, this)
13237
- });
13238
  };
13239
 
13240
- Layer.prototype.getContent = function () {
 
13241
 
13242
- var $content = this.layer,
13243
- selector = $content.data('animatableselector');
13244
- if (selector) {
13245
- $content = $content.find(selector);
13246
- }
13247
- return $content;
13248
- };
13249
-
13250
- Layer.prototype._createLayer = function () {
13251
- return $('<div class="n2-ss-layer"></div>')
13252
- .attr('data-sstype', this.type);
13253
- };
13254
-
13255
- Layer.prototype.createRow = function () {
13256
- var status = $('<div class="n2-ss-layer-status"></div>'),
13257
- remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this)),
13258
- duplicate = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Duplicate layer') + '"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on('click', $.proxy(function () {
13259
- this.duplicate(true, false)
13260
- }, this));
13261
-
13262
- $('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(status).on('click', $.proxy(function (e) {
13263
- e.preventDefault();
13264
- if (this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN) {
13265
- this.setStatusNormal();
13266
  } else {
13267
- this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN);
 
13268
  }
13269
- }, this));
13270
-
13271
 
13272
- this._createLayerListRow([
13273
- $('<div class="n2-actions-left"></div>').append(status),
13274
- $('<div class="n2-actions"></div>').append(duplicate).append(remove)
13275
- ])
13276
- .addClass('n2-ss-layer-layer-row');
13277
- };
13278
 
13279
- /**
13280
- *
13281
- * @param e if provided, the layerWindow will show
13282
- * @param context
13283
- * @param preventExitFromSelection
13284
- */
13285
- Layer.prototype.activate = function (e, context, preventExitFromSelection) {
13286
 
13287
- N2Classes.PluginActivatable.prototype.activate.call(this, e, context, preventExitFromSelection);
13288
 
13289
- if (this.item) {
13290
- this.item.activate(null, context);
13291
- } else {
13292
- console.error('The layer do not have item on it!');
13293
  }
13294
- };
13295
 
13296
- Layer.prototype.getHTML = function (base64) {
13297
-
13298
- var $node = N2Classes.ComponentAbstract.prototype.getHTML.call(this, base64);
13299
 
13300
- var $item = this.item.getHTML(base64);
13301
- $node.attr('style', $node.attr('style') + this.getStyleText())
13302
- .append($item);
13303
 
13304
- return $node;
 
13305
  };
13306
 
13307
- Layer.prototype.getData = function (params) {
13308
- var data = N2Classes.ComponentAbstract.prototype.getData.call(this, params);
 
13309
 
13310
- if (params.itemsIncluded) {
13311
- data.item = this.item.getData();
 
 
 
13312
  }
13313
- return data;
13314
  };
13315
 
13316
- Layer.prototype.getStyleText = function () {
13317
- var style = '';
13318
- var crop = this.property.crop;
13319
- if (crop == 'auto' || crop == 'mask') {
13320
- crop = 'hidden';
13321
- }
13322
-
13323
- style += 'overflow:' + crop + ';';
13324
- return style;
13325
  };
13326
 
13327
- Layer.prototype.getContents = function () {
13328
- return this.item.$item;
13329
- };
13330
 
13331
- Layer.prototype.setSelf = function (self) {
13332
- if (this.self != this) {
13333
- this.self.setSelf(self);
 
 
13334
  }
13335
- this.self = self;
13336
- this.item.setSelf(self.item);
13337
  };
13338
 
13339
- Layer.prototype.getSelf = function () {
13340
- if (this.self !== this) {
13341
- this.self = this.self.getSelf();
13342
- }
13343
- return this.self;
13344
  };
13345
 
13346
- return Layer;
13347
- });
13348
- N2D('LayerAdvancedProperty', function ($, undefined) {
13349
- "use strict";
13350
-
13351
- /**
13352
- * @memberOf N2Classes
13353
- *
13354
- * @param basename
13355
- * @param def
13356
- * @param modesDef
13357
- * @param obj
13358
- * @param propName
13359
- * @constructor
13360
- */
13361
- function LayerAdvancedProperty(basename, def, modesDef, obj, propName) {
13362
- this.basename = basename;
13363
- this.def = def;
13364
- this.modesDef = modesDef;
13365
- this.obj = obj;
13366
- this.propName = propName;
13367
- }
13368
 
13369
- LayerAdvancedProperty.prototype.getBaseName = function () {
13370
- return this.basename;
13371
- };
13372
 
13373
- /**
13374
- *
13375
- * @returns {object}
13376
- */
13377
- LayerAdvancedProperty.prototype.getNames = function () {
13378
- var a = {};
13379
- a[this.basename] = this.def;
13380
- for (var k in this.modesDef) {
13381
- a[this.basename + k] = this.modesDef[k];
13382
  }
13383
- return a;
13384
- };
13385
-
13386
- LayerAdvancedProperty.prototype.getCurrentMode = function () {
13387
- return this.obj[this.propName];
13388
- };
13389
 
13390
- LayerAdvancedProperty.prototype.getName = function () {
13391
- var currentMode = this.getCurrentMode();
13392
- if (currentMode !== '') {
13393
- return this.basename + currentMode;
13394
  }
13395
- return this.basename;
13396
- };
13397
 
13398
- LayerAdvancedProperty.prototype.getDefault = function () {
13399
- var currentMode = this.getCurrentMode();
13400
- if (currentMode !== '') {
13401
- return this.modesDef[currentMode];
13402
- }
13403
- return this.def;
13404
- };
13405
 
13406
- LayerAdvancedProperty.prototype.resetMode = function (name) {
13407
- if (this.propName == name) {
13408
- var currentMode = this.getCurrentMode();
13409
- if (currentMode !== '') {
13410
- var oldValue = this.obj.property[this.basename + currentMode];
13411
- this.obj.property[this.basename + currentMode] = this.modesDef[currentMode];
13412
- this.obj.syncAdvancedField(this.basename);
13413
 
13414
- this.obj.render(this.basename + currentMode, oldValue, 'manager');
 
 
 
 
13415
  }
 
13416
  }
13417
- };
13418
-
13419
- return LayerAdvancedProperty;
13420
- });
13421
- N2D('MainContainer', ['LayerContainer'], function ($, undefined) {
13422
- "use strict";
13423
 
13424
- /**
13425
- * @memberOf N2Classes
13426
- *
13427
- * @param {FragmentEditor} fragmentEditor
13428
- * @constructor
13429
- */
13430
- function MainContainer(fragmentEditor) {
13431
 
13432
- this.baseSize = 16;
13433
 
13434
- this.activeLayer = null;
 
13435
 
13436
- this.$ = fragmentEditor.$;
13437
 
13438
- this.isActiveGroupBlurred = true;
13439
 
13440
- this.isMainGroup = true;
13441
- this.fragmentEditor = fragmentEditor;
13442
- this.layer = fragmentEditor.editor.getMainContainerElement();
13443
 
13444
- this.layer.nUICanvas({
13445
- mainContainer: this,
13446
- tolerance: 5,
13447
- smartguides: $.proxy(function (context) {
13448
- context.$layer.triggerHandler('LayerParent');
13449
- return this.fragmentEditor.getSnap();
13450
- }, this),
13451
- display: {
13452
- hidden: true,
13453
- show: $.proxy(function () {
13454
- N2Classes.PositionDisplay.get().show('Canvas');
13455
- }, this),
13456
- update: $.proxy(function (e, position) {
13457
- N2Classes.PositionDisplay.get().update(e, 'Canvas', 'L: ' + parseInt(position.left | 0) + 'px<br />T: ' + parseInt(position.top | 0) + 'px');
13458
 
13459
- }, this),
13460
- hide: $.proxy(function () {
13461
- N2Classes.PositionDisplay.get().hide('Canvas');
13462
- }, this)
13463
- },
13464
- start: $.proxy(function (e, ui) {
13465
- this.fragmentEditor.canvasDragStart(e, ui);
13466
- }, this),
13467
- drag: $.proxy(function (e, ui) {
13468
- this.fragmentEditor.canvasDragMove(e, ui);
13469
 
13470
- if (ui.layer) ui.layer.placement.current.triggerLayerResized();
13471
- }, this),
13472
- stop: $.proxy(function (e, ui) {
13473
- this.fragmentEditor.canvasDragStop(e, ui);
13474
 
13475
- if (ui.layer) ui.layer.placement.current.triggerLayerResized();
13476
- }, this)
13477
- });
13478
- this.canvasUIManager = this.layer.nUICanvas('instance');
13479
 
13480
- this.layer.nUILayerList({
13481
- mainContainer: this,
13482
- $fixed: $('#n2-ss-layers'),
13483
- $scrolled: $('#n2-ss-layer-list')
13484
- });
13485
- this.layerListUIManager = this.layer.nUILayerList('instance');
13486
 
13487
- this.layer.parent().prepend('<div class="n2-ss-slide-border n2-ss-slide-border-left" /><div class="n2-ss-slide-border n2-ss-slide-border-top" /><div class="n2-ss-slide-border n2-ss-slide-border-right" /><div class="n2-ss-slide-border n2-ss-slide-border-bottom" />');
 
 
 
 
13488
 
13489
- this.container = new N2Classes.LayerContainer(this, $('#n2-ss-layer-list').find('ul'), 'absolute', '> .n2-ss-layer, > .n2-ss-layer-group', ['content', 'row', 'layer', 'group']);
 
 
13490
 
13491
- this.layerRow = this.container.$ul;
13492
 
13493
- this.$.on('layerCreated', $.proxy(function () {
13494
- this.refreshHasLayers();
13495
- }, this));
13496
- }
 
 
 
 
13497
 
13498
- MainContainer.prototype.lateInit = function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13499
 
13500
- this.container.startWithExistingNodes(true);
 
 
13501
 
13502
- this.layer.parent().on('click', $.proxy(function () {
13503
- if (this.fragmentEditor.shouldPreventActivationBubble) {
13504
- this.blurActiveGroup();
13505
- } else {
13506
- this.unBlurActiveGroup();
13507
- }
13508
- this.fragmentEditor.allowActivation();
13509
- }, this));
13510
  };
13511
 
13512
- MainContainer.prototype.onResize = function (ratios) {
13513
- var sortedLayerList = this.getEverySortedLayers();
13514
 
13515
- for (var i = 0; i < sortedLayerList.length; i++) {
13516
- sortedLayerList[i].placement.doLinearResize(ratios);
13517
- }
13518
  };
13519
 
13520
- MainContainer.prototype.getEverySortedLayers = function () {
13521
- var list = this.container.getChildLayersRecursive(false),
13522
- children = {};
13523
- for (var i = list.length - 1; i >= 0; i--) {
13524
- if (typeof list[i].property.parentid !== 'undefined' && list[i].property.parentid) {
13525
- if (typeof children[list[i].property.parentid] == 'undefined') {
13526
- children[list[i].property.parentid] = [];
13527
- }
13528
- children[list[i].property.parentid].push(list[i]);
13529
- list.splice(i, 1);
13530
- }
13531
- }
13532
- for (var i = 0; i < list.length; i++) {
13533
- if (typeof list[i].property.id !== 'undefined' && list[i].property.id && typeof children[list[i].property.id] !== 'undefined') {
13534
- children[list[i].property.id].unshift(0);
13535
- children[list[i].property.id].unshift(i + 1);
13536
- list.splice.apply(list, children[list[i].property.id]);
13537
- delete children[list[i].property.id];
13538
- }
13539
  }
13540
- return list;
13541
  };
13542
 
13543
- MainContainer.prototype.deleteLayers = function () {
13544
- var layers = this.container.getSortedLayers();
13545
- for (var i = 0; i < layers.length; i++) {
13546
- layers[i].delete();
13547
- }
13548
- };
13549
 
13550
- MainContainer.prototype.blurActiveGroup = function () {
13551
- this.isActiveGroupBlurred = true;
13552
- };
13553
 
13554
- MainContainer.prototype.unBlurActiveGroup = function () {
13555
- this.isActiveGroupBlurred = false;
 
 
 
13556
  };
13557
 
13558
- MainContainer.prototype.getActiveGroup = function () {
13559
- if (this.isActiveGroupBlurred) {
13560
- var group = this,
13561
- activeLayer = this.activeLayer;
13562
- if (this.fragmentEditor.isGroup(activeLayer) || this.fragmentEditor.isCol(activeLayer) || this.fragmentEditor.isContent(activeLayer)) {
13563
- group = activeLayer;
13564
- } else if (this.fragmentEditor.isRow(activeLayer)) {
13565
- group = activeLayer.container.getSortedLayers()[0];
13566
- } else if (activeLayer) {
13567
- group = activeLayer.group;
13568
- }
13569
- switch (this.fragmentEditor.currentEditorMode) {
13570
- case 'content':
13571
- if (group == this) {
13572
- group = this.fragmentEditor.mainContent;
13573
- }
13574
- break;
13575
- case 'canvas':
13576
- if (group == this.fragmentEditor.mainContent) {
13577
- group = this;
13578
- }
13579
- break;
13580
- }
13581
 
13582
- return group;
 
13583
  }
13584
- switch (this.fragmentEditor.currentEditorMode) {
13585
- case 'content':
13586
- return this.fragmentEditor.mainContent;
13587
  }
13588
- return this;
 
 
 
 
13589
  };
13590
 
13591
- MainContainer.prototype.getSelectedLayer = function () {
13592
- if (this.activeLayer == null) {
13593
- return false;
13594
- }
13595
- return this.activeLayer;
13596
  };
13597
 
13598
- MainContainer.prototype.getLayerData = function (requestedLayers) {
13599
- if (requestedLayers === undefined) {
13600
- return [];
13601
- }
13602
- var layersData = [],
13603
- layers = [];
13604
-
13605
- for (var i = 0; i < requestedLayers.length; i++) {
13606
- requestedLayers[i].getDataWithChildren(layersData, layers);
13607
- }
13608
- return layersData;
13609
  };
13610
 
13611
- MainContainer.prototype.layerDeleted = function (layer) {
13612
-
13613
- var i = this.fragmentEditor.selectedLayers.length;
13614
- while (i--) {
13615
- if (layer == this.fragmentEditor.selectedLayers[i]) {
13616
- this.fragmentEditor.selectedLayers.splice(i, 1);
13617
- }
13618
- }
13619
 
13620
- this._afterLayerDeletedDeBounced(layer);
13621
 
13622
- this.refreshHasLayers();
13623
  };
13624
 
13625
- MainContainer.prototype._afterLayerDeletedDeBounced = NextendDeBounce(function (layer) {
13626
-
13627
- if (!this.activeLayer || this.activeLayer.isDeleted) {
13628
- this.fragmentEditor.resetActiveLayer();
13629
- }
13630
- }, 50);
13631
 
13632
- MainContainer.prototype.refreshHasLayers = function () {
13633
- $('body').toggleClass('n2-ss-has-layers', this.container.getLayerCount() > 0);
13634
- nextend.triggerResize();
13635
  };
13636
 
13637
- MainContainer.prototype.getName = function () {
13638
- return 'Slide';
13639
  };
13640
 
13641
- MainContainer.prototype.update = function () {
13642
-
13643
  };
13644
 
13645
- MainContainer.prototype.onChildCountChange = function () {
13646
-
13647
  };
13648
 
13649
- MainContainer.prototype.markEnter = function (e) {
13650
-
13651
  };
13652
 
13653
- MainContainer.prototype.markLeave = function (e) {
13654
-
13655
  };
13656
 
13657
- MainContainer.prototype.getSelf = function () {
13658
- return this;
13659
  };
13660
 
13661
- MainContainer.prototype.createLayerAnimations = function () {
 
 
 
 
 
 
 
 
 
13662
 
13663
- var horizontalRatio = this.fragmentEditor.editor.getHorizontalRatio(),
13664
- verticalRatio = this.fragmentEditor.editor.getVerticalRatio(),
13665
- animations = [],
13666
- children = this.container.getSortedLayers();
13667
- for (var i = 0; i < children.length; i++) {
13668
- animations.push.apply(animations, children[i].createLayerAnimations(horizontalRatio, verticalRatio));
13669
  }
13670
- return animations;
13671
  };
13672
 
13673
- MainContainer.prototype.getDroppables = function (exclude) {
13674
- var editorMode = this.fragmentEditor.currentEditorMode,
13675
- droppables = [],
13676
- layers;
 
 
 
 
13677
 
13678
- if (editorMode == 'canvas') {
13679
- droppables.push(this.getDroppable());
13680
- layers = this.container.getSortedLayers();
13681
- var index = $.inArray(this.fragmentEditor.mainContent, layers);
13682
- if (index > -1) {
13683
- layers.splice(index, 1);
13684
- }
13685
- } else if (editorMode == 'content') {
13686
- layers = [this.fragmentEditor.mainContent]
13687
  }
 
 
13688
 
13689
- for (var i = 0; i < layers.length; i++) {
13690
- if (layers[i] == exclude) continue;
13691
- var droppable = layers[i].getDroppable();
13692
- if (typeof droppable == 'object') {
13693
- droppables.push(droppable);
13694
- }
13695
- if (droppable != 'hidden' && layers[i].container) {
13696
- droppables.push.apply(droppables, layers[i].container.getDroppables(exclude));
13697
- }
13698
  }
 
13699
 
13700
- return droppables;
 
 
 
 
 
 
 
 
 
13701
  };
13702
 
13703
- MainContainer.prototype.getLLDroppables = function (layer) {
13704
- return this.container.getLLDroppables(layer);
13705
  };
13706
 
13707
- MainContainer.prototype.getDroppable = function () {
13708
- return {
13709
- $container: this.layer,
13710
- layer: this,
13711
- placement: 'absolute'
13712
- }
13713
  };
13714
 
13715
- MainContainer.prototype.getLLDroppable = function (layer) {
13716
- switch (layer.type) {
13717
- case 'layer':
13718
- case 'row':
13719
- case 'group':
13720
- case 'content':
13721
- return {
13722
- $container: this.container.$ul,
13723
- layer: this
13724
- };
13725
- break;
 
13726
  }
13727
- return false;
13728
  };
13729
 
13730
- MainContainer.prototype.replaceLayers = function (layersData) {
 
 
 
 
 
 
 
 
13731
 
13732
- this._idTranslation = {};
13733
- var layerNodes = this.dataToLayers($.extend(true, [], layersData).reverse()),
13734
- layers = [];
13735
 
13736
- this.deleteLayers();
 
13737
 
13738
- this.fragmentEditor.mainContent.remove();
 
 
13739
 
 
 
 
13740
 
13741
- for (var i = 0; i < layerNodes.length; i++) {
13742
- layers.push(this.container.append(layerNodes[i]));
 
 
13743
  }
13744
 
13745
- this.fragmentEditor.refreshMode();
13746
-
13747
- this.container.layerContainerElement.n2imagesLoaded()
13748
- .always($.proxy(this.fragmentEditor.refreshMode, this.fragmentEditor));
13749
 
13750
- if (!this.getSelectedLayer()) {
13751
- if (layers.length > 0) {
13752
- layers[0].activate();
13753
- }
13754
- }
13755
 
13756
- if (N2Classes.History.get().isEnabled()) {
13757
- N2Classes.History.get().addSimple(this, this.historyDeleteAll, this.historyReplaceLayers, [layersData, layers, this.container.getAllLayers()]);
13758
  }
13759
-
13760
- return layers;
13761
  };
13762
 
13763
- MainContainer.prototype.historyDeleteAll = function (layersData, historicalLayers) {
13764
- for (var i = 0; i < historicalLayers.length; i++) {
13765
- historicalLayers[i].getSelf().delete();
13766
- }
13767
 
13768
- this.fragmentEditor.mainContent.getSelf().remove();
 
 
 
 
 
13769
  };
13770
 
13771
- MainContainer.prototype.historyReplaceLayers = function (layersData, historicalLayers, historicalAllLayers) {
13772
- this.replaceLayers(layersData);
 
 
13773
 
13774
- var layers = this.container.getAllLayers();
13775
- for (var i = 0; i < historicalAllLayers.length; i++) {
13776
- historicalAllLayers[i].setSelf(layers[i]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13777
  }
 
13778
  };
13779
 
13780
- MainContainer.prototype.addLayers = function (layersData, group) {
13781
-
13782
- this._idTranslation = {};
13783
- var layerNodes = this.dataToLayers($.extend(true, [], layersData)),
13784
- layers = [];
13785
 
13786
- for (var i = 0; i < layerNodes.length; i++) {
13787
- layers.push(group.container.append(layerNodes[i]));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13788
  }
 
13789
 
13790
- this.fragmentEditor.refreshMode();
 
 
13791
 
13792
- N2Classes.History.get().addSimple(this, this.historyDeleteLayers, this.historyAddLayers, [layersData, layers, group]);
 
 
 
 
13793
 
13794
- return layers;
 
 
 
 
 
13795
  };
13796
 
13797
- MainContainer.prototype.historyDeleteLayers = function (layersData, historicalLayers, historicalGroup) {
13798
- for (var i = 0; i < historicalLayers.length; i++) {
13799
- historicalLayers[i].getSelf().delete();
13800
- }
13801
  };
13802
 
13803
- MainContainer.prototype.historyAddLayers = function (layersData, historicalLayers, historicalGroup) {
13804
- var layers = this.addLayers(layersData, historicalGroup.getSelf());
13805
- for (var i = 0; i < historicalLayers.length; i++) {
13806
- historicalLayers[i].setSelf(layers[i]);
13807
- }
13808
  };
13809
 
13810
- MainContainer.prototype.dataToLayers = function (layers, $targetGroupContent) {
13811
- var nodes = [];
13812
- for (var i = 0; i < layers.length; i++) {
13813
- switch (layers[i].type) {
13814
- case 'group':
13815
- console.error('Group data to layer not implemented!');
13816
- //new N2Classes.Group(this, this.mainContainer, false, layers[i].data, layers[i]);
13817
- break;
13818
- case 'row':
13819
- nodes.push(this.buildRowNode(layers[i], $targetGroupContent));
13820
- break;
13821
- case 'col':
13822
- nodes.push(this.buildColNode(layers[i], $targetGroupContent));
13823
- break;
13824
- case 'content':
13825
- nodes.push(this.buildContentNode(layers[i], $targetGroupContent));
13826
- break;
13827
- case 'layer':
13828
- default:
13829
- nodes.push(this.buildLayerNode(layers[i], $targetGroupContent));
13830
- break;
13831
- }
13832
- }
13833
 
13834
- return nodes;
13835
- };
13836
 
13837
- MainContainer.prototype._buildNodePrepareID = function ($layer, layerData) {
13838
- if (layerData.id) {
13839
- var id = $.fn.uid();
13840
 
13841
- var deferred = false;
13842
- if (typeof this._idTranslation[layerData.id] == 'object') {
13843
- deferred = this._idTranslation[layerData.id];
13844
- }
13845
 
13846
- this._idTranslation[layerData.id] = id;
13847
- layerData.id = id;
13848
- $layer.attr('id', id);
13849
 
13850
- if (deferred) {
13851
- deferred.resolve(layerData.id, id);
13852
- }
13853
- }
13854
- if (layerData.parentid) {
13855
- switch (typeof this._idTranslation[layerData.parentid]) {
13856
- case 'string':
13857
- layerData.parentid = this._idTranslation[layerData.parentid];
13858
- break;
13859
- case 'undefined':
13860
- this._idTranslation[layerData.parentid] = $.Deferred();
13861
- case 'object':
13862
- this._idTranslation[layerData.parentid].done($.proxy(function ($_layer, originalID, newID) {
13863
- $_layer.data('parentid', newID);
13864
- }, this, $layer));
13865
- break;
13866
- default:
13867
- layerData.parentid = '';
13868
- }
13869
- }
13870
  };
13871
 
 
 
 
13872
 
13873
- MainContainer.prototype.buildContentNode = function (layerData, $targetGroupContent) {
 
 
13874
 
13875
- var $layer = $("<div class='n2-ss-layer' data-sstype='content'/>"),
13876
- $content = $("<div class='n2-ss-section-main-content n2-ss-layer-content' />").appendTo($layer);
13877
- for (var k in layerData) {
13878
- $layer.data(k, layerData[k]);
13879
- }
13880
 
13881
- if ($targetGroupContent !== undefined) {
13882
- $layer.appendTo($targetGroupContent);
13883
- }
13884
 
13885
- this.dataToLayers(layerData.layers, $content);
13886
 
13887
- return $layer;
13888
- };
13889
 
13890
- MainContainer.prototype.buildRowNode = function (layerData, $targetGroupContent) {
 
 
 
 
 
 
 
 
 
 
 
13891
 
13892
- var $layer = $("<div class='n2-ss-layer' data-sstype='row'/>"),
13893
- $content = $("<div class='n2-ss-layer-row' />").appendTo($layer);
13894
 
13895
- this._buildNodePrepareID($layer, layerData);
13896
- for (var k in layerData) {
13897
- $layer.data(k, layerData[k]);
13898
- }
 
13899
 
13900
- if ($targetGroupContent !== undefined) {
13901
- $layer.appendTo($targetGroupContent);
 
 
 
 
 
13902
  }
 
13903
 
13904
- this.dataToLayers(layerData.cols, $content);
13905
-
13906
- return $layer;
13907
  };
13908
 
13909
- MainContainer.prototype.buildColNode = function (layerData, $targetGroupContent) {
 
13910
 
13911
- var $layer = $("<div class='n2-ss-layer' data-sstype='col'/>"),
13912
- $content = $("<div class='n2-ss-layer-col n2-ss-layer-content' />").appendTo($layer);
13913
- for (var k in layerData) {
13914
- $layer.data(k, layerData[k]);
13915
  }
13916
 
13917
- if ($targetGroupContent !== undefined) {
13918
- $layer.appendTo($targetGroupContent);
 
 
 
 
 
 
 
13919
  }
13920
 
13921
- this.dataToLayers(layerData.layers, $content);
13922
-
13923
- return $layer;
13924
- };
13925
-
13926
- MainContainer.prototype.buildLayerNode = function (layerData, $targetGroupContent) {
13927
-
13928
- var $layer = $("<div class='n2-ss-layer' data-sstype='layer'></div>")
13929
- .attr('style', layerData.style);
13930
 
13931
- var storedIndex = 1;
13932
- if (layerData.zIndex) {
13933
- storedIndex = layerData.zIndex;
 
 
 
 
 
 
13934
  }
13935
 
13936
- this._buildNodePrepareID($layer, layerData);
13937
-
13938
- if (layerData.items !== undefined) {
13939
- layerData.item = layerData.items[0];
13940
- delete layerData.items;
13941
- }
13942
 
13943
- $('<div class="n2-ss-item n2-ss-item-' + layerData.item.type + '"></div>')
13944
- .data('item', layerData.item.type)
13945
- .data('itemvalues', layerData.item.values)
13946
- .appendTo($layer);
13947
 
13948
- delete layerData.style;
13949
- delete layerData.item;
13950
- for (var k in layerData) {
13951
- $layer.data(k, layerData[k]);
13952
  }
 
13953
 
13954
- if ($targetGroupContent !== undefined) {
13955
- $layer.appendTo($targetGroupContent);
 
13956
  }
13957
-
13958
- return $layer;
13959
  };
13960
 
13961
- return MainContainer;
13962
- });
13963
- N2D('Row', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
13964
- "use strict";
13965
-
13966
- /**
13967
- * @memberOf N2Classes
13968
- *
13969
- * @param fragmentEditor
13970
- * @param group
13971
- * @param properties
13972
- * @constructor
13973
- * @augments ComponentAbstract
13974
- */
13975
- function Row(fragmentEditor, group, properties) {
13976
- this.label = n2_('Row');
13977
- this.type = 'row';
13978
 
13979
- this._syncbgThrottled = NextendThrottle(this._syncbgThrottled, 50);
13980
 
13981
- this.innerContainer = '> .n2-ss-layer-row > .n2-ss-layer-row-inner';
 
 
13982
 
13983
- this.localStyle = [
13984
- {
13985
- group: 'normal', selector: '-inner', css: {
13986
- transition: 'transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;'
13987
  }
13988
- },
13989
- {group: 'hover', selector: '-inner:HOVER', css: {}}
13990
- ];
13991
-
13992
- this.columnsField = $('#layerrow-columns').data('field');
13993
-
13994
- this.refreshUI = NextendDeBounce(this.refreshUI, 100);
13995
-
13996
- this.stylemode = '';
13997
-
13998
- N2Classes.ComponentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
13999
 
14000
- this.placement.allow('absolute');
14001
- this.placement.allow('normal');
14002
- }
 
 
 
 
 
 
 
 
 
 
 
 
14003
 
14004
- Row.prototype = Object.create(N2Classes.ComponentAbstract.prototype);
14005
- Row.prototype.constructor = Row;
 
 
 
 
 
 
 
 
 
 
 
 
 
14006
 
14007
- Row.prototype.addProperties = function ($layer) {
 
 
 
 
 
 
14008
 
14009
- this.createProperty('opened', 1, $layer, this);
 
14010
 
14011
- N2Classes.ComponentAbstract.prototype.addProperties.call(this, $layer);
 
 
 
14012
 
 
 
 
 
 
 
 
 
 
14013
 
14014
- this.createProperty('href', '', $layer);
14015
- this.createProperty('href-target', '_self', $layer);
14016
 
14017
- this.createProperty('bgimage', '', $layer);
14018
- this.createProperty('bgimagex', 50, $layer);
14019
- this.createProperty('bgimagey', 50, $layer);
14020
- this.createProperty('bgimageparallax', 0, $layer);
14021
 
14022
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolor', '00000000', {
14023
- "-hover": undefined
14024
- }, this, "stylemode"), $layer);
14025
 
14026
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradient', 'off', {
14027
- "-hover": undefined
14028
- }, this, "stylemode"), $layer);
 
 
 
 
 
14029
 
14030
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradientend', '00000000', {
14031
- "-hover": undefined
14032
- }, this, "stylemode"), $layer);
14033
 
14034
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderradius', 0, {
14035
- "-hover": undefined
14036
- }, this, "stylemode"), $layer);
14037
 
14038
- this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('boxshadow', '0|*|0|*|0|*|0|*|00000080', {
14039
- "-hover": undefined
14040
- }, this, "stylemode"), $layer);
14041
 
14042
- this.createProperty('fullwidth', 1, $layer);
14043
- this.createProperty('stretch', 0, $layer);
14044
 
 
 
 
 
 
14045
 
14046
- this.createDeviceProperty('inneralign', {desktopPortrait: 'inherit'}, $layer);
14047
- this.createDeviceProperty('padding', {desktopPortrait: '10|*|10|*|10|*|10|*|px+'}, $layer);
14048
- this.createDeviceProperty('gutter', {desktopPortrait: 20}, $layer);
14049
- this.createDeviceProperty('wrapafter', {desktopPortrait: 0, mobilePortrait: 1, mobileLandscape: 1}, $layer);
14050
 
14051
- this.$.on('baseSizeUpdated.row', $.proxy(this._syncpadding, this));
14052
- };
 
14053
 
14054
- Row.prototype.historyDeleteSelf = function () {
14055
- this.delete();
14056
  };
14057
 
14058
- Row.prototype.historyCreateSelf = function (historyGroup, preset, historyCols) {
14059
- var newLayer = new N2Classes.Row(this.fragmentEditor, historyGroup.getSelf(), {});
14060
- newLayer.create(preset);
14061
 
14062
- this.setSelf(newLayer);
 
 
14063
 
14064
- var newCols = newLayer.container.getSortedLayers();
14065
- for (var i = 0; i < newCols.length; i++) {
14066
- historyCols[i].setSelf(newCols[i]);
14067
- }
14068
  };
14069
 
14070
- Row.prototype.create = function (preset) {
14071
- var cb,
14072
- _createRawRow = function (cols) {
14073
- return $("<div class='n2-ss-layer' />")
14074
- .append($("<div class='n2-ss-layer-row' />")
14075
- .append($("<div class='n2-ss-layer-row-inner' />")
14076
- .append(cols)))
14077
- .attr('data-sstype', 'row');
14078
- },
14079
- _createRawCol = function (inner) {
14080
- return $("<div class='n2-ss-layer' data-sstype='col'/>").append($("<div class='n2-ss-layer-col n2-ss-layer-content' />").append(inner));
14081
- };
14082
- switch (preset) {
14083
- case '2col':
14084
- cb = function (layer) {
14085
- return _createRawRow([_createRawCol(), _createRawCol()]);
14086
- };
14087
- break;
14088
- case '2col-60-40':
14089
- cb = function (layer) {
14090
- return _createRawRow([_createRawCol().data('colwidth', '6/10'), _createRawCol().data('colwidth', '4/10')]);
14091
- };
14092
- break;
14093
- case '2col-40-60':
14094
- cb = function (layer) {
14095
- return _createRawRow([_createRawCol().data('colwidth', '4/10'), _createRawCol().data('colwidth', '6/10')]);
14096
- };
14097
- break;
14098
- case '2col-80-20':
14099
- cb = function (layer) {
14100
- return _createRawRow([_createRawCol().data('colwidth', '8/10'), _createRawCol().data('colwidth', '2/10')]);
14101
- };
14102
- break;
14103
- case '2col-20-80':
14104
- cb = function (layer) {
14105
- return _createRawRow([_createRawCol().data('colwidth', '2/10'), _createRawCol().data('colwidth', '8/10')]);
14106
- };
14107
- break;
14108
- case '3col':
14109
- cb = function (layer) {
14110
- return _createRawRow([_createRawCol(), _createRawCol(), _createRawCol()]);
14111
- };
14112
- break;
14113
- case '3col-20-60-20':
14114
- cb = function (layer) {
14115
- return _createRawRow([_createRawCol().data('colwidth', '2/10'), _createRawCol().data('colwidth', '6/10'), _createRawCol().data('colwidth', '2/10')]);
14116
- };
14117
- break;
14118
- case '4col':
14119
- cb = function (layer) {
14120
- return _createRawRow([_createRawCol(), _createRawCol(), _createRawCol(), _createRawCol()]);
14121
- };
14122
- break;
14123
 
14124
- case "special":
14125
- cb = function (layer) {
14126
- var $innerRow = _createRawRow([_createRawCol(), _createRawCol()]);
14127
- return _createRawRow([_createRawCol().data('colwidth', '1/5'), _createRawCol($innerRow).data('colwidth', '4/5')]);
14128
- };
14129
- break;
14130
- default:
14131
- cb = function (layer) {
14132
- return _createRawRow([_createRawCol()]);
14133
- };
14134
- }
14135
 
14136
- if (this.group.container.allowedPlacementMode === 'absolute') {
14137
- this.originalProperties = $.extend({
14138
- width: '100%',
14139
- align: 'center',
14140
- valign: 'top',
14141
- top: 20
14142
- }, this.originalProperties);
14143
- }
14144
 
14145
- N2Classes.ComponentAbstract.prototype.create.call(this, cb, true);
14146
 
14147
- this.initUI();
 
14148
 
14149
- this.container.startWithExistingNodes(false);
 
14150
 
14151
- this._syncpadding();
14152
- this._syncinneralign();
14153
- this._syncfullwidth();
14154
- this._syncstretch();
14155
- this._syncbgThrottled();
14156
- this._syncborderradius();
14157
- this._syncboxshadow();
14158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14159
 
14160
- this.renderModeProperties();
14161
- this.container.renderModeProperties();
14162
 
 
 
14163
 
14164
- N2Classes.History.get().addSimple(this, this.historyDeleteSelf, this.historyCreateSelf, [this.group, preset, this.container.getSortedLayers()]);
14165
 
14166
- this._onReady();
14167
  };
14168
 
14169
- Row.prototype.load = function ($layer, isEditorStart) {
14170
 
14171
- N2Classes.ComponentAbstract.prototype.load.call(this, $layer, isEditorStart);
14172
 
14173
- this.initUI();
14174
 
14175
- this.container.startWithExistingNodes(isEditorStart);
14176
-
14177
- this._syncpadding();
14178
- this._syncinneralign();
14179
- this._syncfullwidth();
14180
- this._syncstretch();
14181
- this._syncbgThrottled();
14182
- this._syncborderradius();
14183
- this._syncboxshadow();
14184
 
14185
  this._onReady();
14186
  };
14187
 
14188
- Row.prototype.initUI = function () {
14189
-
14190
- this.layer.nUICanvasItem({
14191
- canvasUIManager: this.fragmentEditor.mainContainer.canvasUIManager,
14192
- layer: this,
14193
- $layer: this.layer
14194
- });
14195
-
14196
- this.layer.on({
14197
- mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerClicked'),
14198
- click: $.proxy(function (e) {
14199
- if (!nextend.shouldPreventMouseUp && this.fragmentEditor.preventActivationBubbling()) {
14200
- this.activate(e);
14201
- }
14202
- }, this),
14203
- dblclick: $.proxy(function (e) {
14204
- e.stopPropagation();
14205
- $('[data-tab="row"]').trigger('click');
14206
- }, this)
14207
- });
14208
-
14209
- this.$row.nUISpacing({
14210
- handles: 'n, s, e, w',
14211
- start: $.proxy(function (e, ui) {
14212
- N2Classes.PositionDisplay.get().show('Spacing');
14213
- }, this),
14214
- spacing: $.proxy(function (e, ui) {
14215
- var html = '';
14216
- for (var k in ui.changed) {
14217
- html += 'Padding ' + k + ': ' + ui.changed[k] + 'px<br>';
14218
- }
14219
- N2Classes.PositionDisplay.get().update(e, 'Spacing', html);
14220
- }, this),
14221
- stop: $.proxy(this.____makeLayerResizeableStop, this),
14222
- });
14223
-
14224
- this.$row.nUIColumns({
14225
- columns: '1',
14226
- gutter: this.getGutter(),
14227
- start: $.proxy(function (e, ui) {
14228
- N2Classes.PositionDisplay.get().show('Columns');
14229
- }, this),
14230
- colwidth: $.proxy(function (e, ui) {
14231
- this.updateColumnWidth(ui.currentPercent);
14232
-
14233
- N2Classes.PositionDisplay.get().update(e, 'Columns', Math.round(ui.currentPercent[ui.index] * 100) + '% &mdash; ' + Math.round(ui.currentPercent[ui.index + 1] * 100) + '%');
14234
-
14235
-
14236
- }, this),
14237
- stop: $.proxy(function (e, ui) {
14238
- N2Classes.PositionDisplay.get().hide('Columns');
14239
 
14240
- this.setRealColsWidth(ui.currentFractions);
14241
- }, this)
14242
- });
14243
 
14244
- var context = {};
14245
 
14246
- this.$rowInner.nUISortableRow({
14247
- distance: 10,
14248
- helper: 'clone_hide',
14249
- forceHelperSize: true,
14250
- forcePlaceholderSize: true,
14251
- items: '> .n2-ss-layer',
14252
- handle: " > .n2-ss-layer-ui-label-container > .n2-ss-layer-ui-label-self",
14253
- start: $.proxy(function (e, ui) {
14254
- context.originalPrevLayer = ui.item.prevAll('.n2-ss-layer').not(ui.placeholder).first()
14255
- .data('layerObject');
14256
 
14257
- var parts = this.getColumns().split('+');
 
 
 
14258
 
14259
- ui.placeholder.css({
14260
- width: ((new Fraction(parts[ui.item.data('layerObject').getIndex()])).valueOf() * 100) + '%',
14261
- visibility: 'visible',
14262
- margin: this.getGutter() + 'px'
14263
- });
14264
- if (ui.helper.hasClass('n2-ss-last-in-row')) {
14265
- ui.placeholder.addClass('n2-ss-last-in-row');
14266
  }
14267
-
14268
- ui.placeholder.css('order', ui.helper.css('order'));
14269
-
14270
- ui.placeholder.attr('data-r', ui.helper.attr('data-r'));
14271
-
14272
  }, this),
14273
- beforestop: $.proxy(function (e, ui) {
14274
- ui.placeholder.detach();
14275
- context.layer = ui.item.data('layerObject');
14276
- context.oldIndex = context.layer.getOrderedIndex();
14277
- }, this),
14278
- stop: $.proxy(function (e, ui) {
14279
- var layer = context.layer,
14280
- oldIndex = context.oldIndex,
14281
- newIndex = 0;
14282
 
14283
- if (context.originalPrevLayer) {
14284
- layer.layer.insertAfter(context.originalPrevLayer.layer);
14285
- } else {
14286
- layer.layer.prependTo(layer.group.container.layerContainerElement);
14287
- }
14288
 
14289
- switch (ui.lastPosition[1]) {
14290
- case 'before':
14291
- newIndex = ui.lastPosition[0].data('layerObject').getOrderedIndex();
14292
- if (newIndex > oldIndex) {
14293
- newIndex--;
14294
- }
14295
- break;
14296
- case 'after':
14297
- newIndex = ui.lastPosition[0].data('layerObject').getOrderedIndex();
14298
- if (newIndex < oldIndex) {
14299
- newIndex++;
14300
- }
14301
- break;
14302
- }
14303
- if (oldIndex !== newIndex) {
14304
- this.moveCol(oldIndex, newIndex);
14305
- }
14306
  }, this)
14307
  });
14308
  };
14309
 
14310
- Row.prototype.____makeLayerResizeableStop = function (event, ui) {
14311
- N2Classes.PositionDisplay.get().hide('Spacing');
14312
- var padding = this.getPadding().split('|*|'),
14313
- ratioH = 1,
14314
- ratioV = 1;
14315
-
14316
- if (padding[padding.length - 1] == 'px+' && Math.abs(parseFloat(this.layer.css('fontSize')) - this.baseSize) > 1) {
14317
- ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
14318
- ratioV = this.fragmentEditor.getResponsiveRatioVertical();
14319
- }
14320
-
14321
- for (var k in ui.changed) {
14322
- var value = ui.changed[k];
14323
- switch (k) {
14324
- case 'top':
14325
- padding[0] = Math.round(value / ratioV);
14326
- break;
14327
- case 'right':
14328
- padding[1] = Math.round(value / ratioH);
14329
- break;
14330
- case 'bottom':
14331
- padding[2] = Math.round(value / ratioV);
14332
- break;
14333
- case 'left':
14334
- padding[3] = Math.round(value / ratioH);
14335
- break;
14336
- }
14337
  }
14338
- this.setProperty('padding', padding.join('|*|'));
14339
- $('#layerrow-padding').data('field').insideChange(padding.join('|*|'));
14340
  };
14341
 
14342
- Row.prototype._createLayer = function () {
14343
- return $('<div class="n2-ss-layer"><div class="n2-ss-layer-row"><div class="n2-ss-layer-row-inner"></div></div></div>')
14344
- .attr('data-sstype', this.type);
14345
  };
14346
 
14347
- Row.prototype.historyDeleteCol = function (historicalRow, historicalCol) {
14348
- historicalCol.getSelf().delete();
14349
  };
14350
 
14351
- Row.prototype.historyCreateCol = function (historicalRow, historicalCol) {
14352
- var newCol = historicalRow.getSelf().createCol();
14353
- historicalCol.setSelf(newCol);
 
 
14354
  };
14355
 
14356
- Row.prototype.createCol = function () {
 
14357
 
14358
- var col = new N2Classes.Col(this.fragmentEditor, this, {});
14359
- N2Classes.History.get().addSimple(this, this.historyDeleteCol, this.historyCreateCol, [this, col]);
14360
- col.create();
14361
- if (this.isReady()) {
14362
- this.placement.updatePosition();
14363
- }
14364
 
14365
- return col;
 
14366
  };
14367
 
14368
- Row.prototype.createRow = function () {
14369
- this.$row = this.layer.find('.n2-ss-layer-row:first');
14370
- this.$rowInner = this.$row.find('.n2-ss-layer-row-inner:first');
14371
 
14372
- //Fix for Slide Library 3.2 --> 3.3 change
14373
- if (this.$rowInner.length === 0) {
14374
- this.$rowInner = $('<div class="n2-ss-layer-row-inner"></div>').append(this.$row.find('> *')).appendTo(this.$row);
14375
- }
14376
 
14377
- this.container = new N2Classes.LayerContainer(this, $('<ul class="n2-list n2-h4 n2-list-orderable" />'), 'default', ' > .n2-ss-layer', ['col']);
14378
- this.container.setLayerContainerElement(this.$rowInner);
 
 
 
 
 
 
 
 
14379
 
14380
- this.addClassElement(this.layer);
14381
- this.addClassElement(this.$row, '-inner');
14382
 
14383
- var status = $('<div class="n2-ss-layer-status"></div>'),
14384
- remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this)),
14385
- duplicate = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Duplicate layer') + '"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on('click', $.proxy(function () {
14386
- this.duplicate(true, false)
14387
- }, this));
14388
 
14389
- $('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(status).on('click', $.proxy(function (e) {
14390
- e.preventDefault();
14391
- if (this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN) {
14392
- this.setStatusNormal();
14393
- } else {
14394
- this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN);
14395
- }
14396
- }, this));
14397
 
14398
- this._createLayerListRow([
14399
- $('<div class="n2-actions-left"></div>').append(status),
14400
- $('<div class="n2-actions"></div>').append(duplicate).append(remove)
14401
- ]).addClass('n2-ss-layer-row-row');
14402
 
14403
- this.openerElement = $('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-row"></i></a>').insertBefore(this.layerTitleSpan)
14404
- .on('click', $.proxy(this.switchOpened, this));
14405
 
 
14406
 
14407
- this.container.$ul.appendTo(this.layerRow);
14408
 
14409
- this.readyDeferred.done($.proxy(this._syncopened, this));
14410
- };
14411
 
14412
- Row.prototype.activate = function () {
14413
- N2Classes.PluginActivatable.prototype.activate.apply(this, arguments);
 
 
14414
 
14415
- this.columnsField.setRow(this);
 
 
14416
 
14417
- this.$row.nUIColumns('option', 'active', 1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14418
  };
14419
 
14420
- Row.prototype.deActivate = function () {
 
 
14421
 
14422
- this.$row.nUIColumns('option', 'active', 0);
 
 
14423
 
14424
- N2Classes.PluginActivatable.prototype.deActivate.apply(this, arguments);
 
 
 
 
 
 
 
 
 
 
14425
  };
14426
 
14427
- Row.prototype.switchOpened = function (e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14428
  e.preventDefault();
14429
  if (this.getProperty('opened')) {
14430
  this.setProperty('opened', 0);
@@ -14433,7 +14227,7 @@ N2D('Row', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
14433
  }
14434
  };
14435
 
14436
- Row.prototype._syncopened = function () {
14437
  if (this.getProperty('opened')) {
14438
  this.openerElement.removeClass('n2-closed');
14439
  this.container.$ul.css('display', '');
@@ -14447,41 +14241,14 @@ N2D('Row', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
14447
  }
14448
  };
14449
 
14450
- Row.prototype.getColumns = function () {
14451
- var layers = this.container.getSortedLayers(),
14452
- columns = [];
14453
- for (var i = 0; i < layers.length; i++) {
14454
- columns.push(layers[i].getProperty('colwidth'));
14455
- }
14456
- return columns.join('+');
14457
- };
14458
-
14459
- Row.prototype.getColumnsOrdered = function () {
14460
- var layers = this.getOrderedColumns(),
14461
- columns = [];
14462
- for (var i = 0; i < layers.length; i++) {
14463
- columns.push(layers[i].getProperty('colwidth'));
14464
- }
14465
- return columns.join('+');
14466
- };
14467
-
14468
- Row.prototype._synccolumns = function () {
14469
- var layers = this.container.getSortedLayers();
14470
- for (var i = 0; i < layers.length; i++) {
14471
- layers[i]._synccolwidth();
14472
- }
14473
- this.update();
14474
- };
14475
-
14476
- Row.prototype.getPadding = function () {
14477
  return this.getProperty('padding');
14478
  };
14479
 
14480
- Row.prototype._syncpadding = function () {
14481
  var padding = this.getPadding().split('|*|'),
14482
  unit = padding.pop(),
14483
  baseSize = this.baseSize;
14484
-
14485
  if (unit == 'px+' && baseSize > 0) {
14486
  unit = 'em';
14487
  for (var i = 0; i < padding.length; i++) {
@@ -14490,200 +14257,76 @@ N2D('Row', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
14490
  }
14491
 
14492
  var css = padding.join(unit + ' ') + unit;
14493
- this.$row.css('padding', css);
14494
- this.$row.nUISpacing('option', 'current', css);
14495
-
14496
  this.update();
14497
- };
14498
 
14499
- Row.prototype.getGutter = function () {
14500
- return this.getProperty('gutter');
14501
  };
14502
 
14503
- Row.prototype._syncgutter = function () {
14504
- var gutterValue = this.getGutter(),
14505
- sideGutterValue = gutterValue / 2,
14506
- cols = this.container.getSortedLayers();
14507
- if (cols.length > 0) {
14508
- for (var i = cols.length - 1; i >= 0; i--) {
14509
- cols[i].layer
14510
- .css('margin', sideGutterValue + 'px');
14511
- }
14512
  }
14513
 
14514
- this.$rowInner.css({
14515
- width: 'calc(100% + ' + (gutterValue + 1) + 'px)',
14516
- margin: -sideGutterValue + 'px'
14517
- });
14518
 
14519
- this.$row.nUIColumns('option', 'gutter', this.getGutter());
 
 
14520
 
14521
- this._syncwrapafter();
 
14522
 
14523
- this.update();
14524
  };
14525
 
14526
- Row.prototype._syncwrapafter = function () {
14527
- if (!this.isDeleted && !this.isDeleteStarted) {
14528
- var wrapAfter = parseInt(this.getProperty('wrapafter')),
14529
- columns = this.getOrderedColumns(),
14530
- isWrapped = false,
14531
- i;
14532
 
14533
- for (i = columns.length - 1; i >= 0; i--) {
14534
- if (!columns[i].showsOnCurrent) {
14535
- columns.splice(i, 1);
14536
- }
14537
- }
14538
 
14539
- // columnsLength can be 0 if all the columns hidden in the row
14540
- var columnsLength = columns.length;
 
 
 
 
 
 
 
 
 
 
14541
 
14542
- if (wrapAfter > 0 && wrapAfter < columnsLength) {
14543
- isWrapped = true;
 
 
 
 
 
 
 
 
 
 
 
14544
  }
14545
-
14546
- this.$row.attr('row-wrapped', isWrapped ? 1 : 0);
14547
-
14548
- if (isWrapped) {
14549
- var flexLines = [];
14550
- for (i = 0; i < columnsLength; i++) {
14551
- var row = Math.floor(i / wrapAfter);
14552
- if (typeof flexLines[row] === 'undefined') {
14553
- flexLines[row] = [];
14554
- }
14555
- flexLines[row].push(columns[i]);
14556
- columns[i].layer
14557
- .attr('data-r', row)
14558
- .toggleClass('n2-ss-last-in-row', (i + 1) % wrapAfter === 0 || i === columnsLength - 1);
14559
- }
14560
-
14561
- var gutterValue = this.getGutter();
14562
- for (i = 0; i < flexLines.length; i++) {
14563
- var flexLine = flexLines[i],
14564
- sumWidth = 0,
14565
- j;
14566
- for (j = 0; j < flexLine.length; j++) {
14567
- sumWidth += flexLine[j].getWidthPercentage();
14568
- }
14569
- for (j = 0; j < flexLine.length; j++) {
14570
- flexLine[j].layer.css('width', 'calc(' + (flexLine[j].getWidthPercentage() / sumWidth * 100) + '% - ' + (n2const.isIE ? gutterValue + 1 : gutterValue) + 'px)');
14571
- }
14572
- }
14573
- } else {
14574
- var sumWidth = 0;
14575
- for (i = 0; i < columnsLength; i++) {
14576
- sumWidth += columns[i].getWidthPercentage();
14577
- }
14578
- for (i = 0; i < columnsLength; i++) {
14579
- columns[i].layer
14580
- .css('width', (columns[i].getWidthPercentage() / sumWidth * 100) + '%')
14581
- .removeClass('n2-ss-last-in-row')
14582
- .attr('data-r', 0);
14583
- }
14584
- if (columnsLength > 0) {
14585
- columns[columnsLength - 1].layer.addClass('n2-ss-last-in-row');
14586
- }
14587
- }
14588
-
14589
- this.update();
14590
- }
14591
- };
14592
-
14593
- Row.prototype.getOrderedColumns = function () {
14594
- return this.container.getSortedLayers().sort(function (a, b) {
14595
- return a.getRealOrder() - b.getRealOrder();
14596
- });
14597
- };
14598
-
14599
- Row.prototype.getInnerAlign = function () {
14600
- return this.getProperty('inneralign');
14601
- };
14602
-
14603
- Row.prototype._syncinneralign = function () {
14604
- this.layer.attr('data-csstextalign', this.getInnerAlign());
14605
-
14606
- this.refreshTextAlign();
14607
- };
14608
-
14609
- Row.prototype._syncfullwidth = function () {
14610
- this.layer.attr('data-frontend-fullwidth', this.getProperty('fullwidth') == 0 ? '0' : '1')
14611
- };
14612
-
14613
- Row.prototype._syncstretch = function () {
14614
- this.layer.toggleClass('n2-ss-stretch-layer', this.getProperty('stretch') == 1);
14615
- };
14616
-
14617
- Row.prototype._syncborderradius =
14618
- Row.prototype['_syncborderradius-hover'] = function () {
14619
- var borderRadius = this.getProperty('borderradius');
14620
- if (borderRadius > 0) {
14621
- this.addLocalStyle('normal', 'borderradius', 'border-radius:' + borderRadius + 'px;');
14622
- }
14623
-
14624
- var borderRadiusHover = this.getProperty('borderradius-hover');
14625
- if (borderRadiusHover && borderRadiusHover != borderRadius) {
14626
- this.addLocalStyle('hover', 'borderradius', 'border-radius:' + borderRadiusHover + 'px;');
14627
- }
14628
- };
14629
-
14630
- Row.prototype._syncboxshadow =
14631
- Row.prototype['_syncboxshadow-hover'] = function () {
14632
- var boxShadow = this.getProperty('boxshadow');
14633
- this.addLocalStyle('normal', 'boxshadow', this.getBoxShadowCSS(boxShadow.split('|*|')));
14634
-
14635
- var hoverStyle = '',
14636
- boxShadowHover = this.getProperty('boxshadow-hover');
14637
- if (boxShadowHover !== undefined && boxShadowHover != boxShadow) {
14638
- hoverStyle = this.getBoxShadowCSS(boxShadowHover.split('|*|'));
14639
- }
14640
- this.addLocalStyle('hover', 'boxshadow', hoverStyle);
14641
- };
14642
-
14643
- Row.prototype.getBoxShadowCSS = function (boxShadow) {
14644
- if ((boxShadow[0] != 0 || boxShadow[1] != 0 || boxShadow[2] != 0 || boxShadow[3] != 0) && N2Color.hex2alpha(boxShadow[4]) != 0) {
14645
- return 'box-shadow:' + boxShadow[0] + 'px ' + boxShadow[1] + 'px ' + boxShadow[2] + 'px ' + boxShadow[3] + 'px ' + N2Color.hex2rgbaCSS(boxShadow[4]) + ';';
14646
- }
14647
- return '';
14648
- };
14649
-
14650
- Row.prototype._synchref =
14651
- Row.prototype['_synchref-target'] = function () {
14652
- };
14653
-
14654
- Row.prototype._syncbgimage =
14655
- Row.prototype._syncbgimagex =
14656
- Row.prototype._syncbgimagey =
14657
- Row.prototype._syncbgimageparallax =
14658
- Row.prototype._syncbgcolor =
14659
- Row.prototype._syncbgcolorgradient =
14660
- Row.prototype._syncbgcolorgradientend =
14661
- Row.prototype['_syncbgcolor-hover'] =
14662
- Row.prototype['_syncbgcolorgradient-hover'] =
14663
- Row.prototype['_syncbgcolorgradientend-hover'] = function () {
14664
- this._syncbgThrottled();
14665
- };
14666
-
14667
-
14668
- Row.prototype._syncbgThrottled = function () {
14669
- var background = '',
14670
- image = this.fragmentEditor.editor.generator.fill(this.getProperty('bgimage')),
14671
- gradientBackgroundProps = '';
14672
- if (image != '') {
14673
- var x = parseInt(this.getProperty('bgimagex'));
14674
- if (!isFinite(x)) {
14675
- x = 50;
14676
- }
14677
- var y = parseInt(this.getProperty('bgimagey'));
14678
- if (!isFinite(y)) {
14679
- y = 50;
14680
- }
14681
- background += 'URL("' + nextend.imageHelper.fixed(image) + '") ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '');
14682
- gradientBackgroundProps = ' ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '');
14683
- }
14684
- var color = this.getProperty('bgcolor'),
14685
- gradient = this.getProperty('bgcolorgradient'),
14686
- colorend = this.getProperty('bgcolorgradientend');
14687
 
14688
  var normalStyle = this.getBackgroundCSS(color, gradient, colorend, background, gradientBackgroundProps);
14689
 
@@ -14721,7 +14364,7 @@ N2D('Row', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
14721
  this.addLocalStyle('hover', 'bgcolor', hoverStyle);
14722
  };
14723
 
14724
- Row.prototype.getBackgroundCSS = function (color, gradient, colorend, backgroundImage, gradientBackgroundProps) {
14725
  if (N2Color.hex2alpha(color) != 0 || (gradient != 'off' && N2Color.hex2alpha(colorend) != 0)) {
14726
  var after = '';
14727
  if (backgroundImage != '') {
@@ -14749,2038 +14392,2414 @@ N2D('Row', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
14749
  return '';
14750
  };
14751
 
14752
- Row.prototype.getData = function (params) {
14753
  var data = N2Classes.ComponentAbstract.prototype.getData.call(this, params);
14754
 
14755
- if (params.itemsIncluded) {
14756
- data.cols = this.container.getData(params);
14757
  }
 
14758
  return data;
14759
  };
14760
 
14761
- /**
14762
- * Example: Cols: 0 - 1 - 2
14763
- * oldIndex: 0, newIndex: 2 => 1 - 2 - 0 Moves the col #0 to after the #2 col
14764
- * @param oldIndex
14765
- * @param newIndex
14766
- */
14767
- Row.prototype.moveCol = function (oldIndex, newIndex) {
14768
-
14769
- if (this.getMode() == 'desktopPortrait') {
14770
- this._moveCol(oldIndex, newIndex);
14771
 
14772
- var task = N2Classes.History.get().addValue(this, this.historyMoveCol, []);
14773
- if (task) {
14774
- task.setValues({
14775
- oldIndex: newIndex,
14776
- newIndex: oldIndex
14777
- }, {
14778
- oldIndex: oldIndex,
14779
- newIndex: newIndex
14780
- });
14781
- }
14782
- } else {
14783
- var orderedColumns = this.getOrderedColumns(),
14784
- colToMove = orderedColumns[oldIndex];
14785
- orderedColumns.splice(oldIndex, 1);
14786
- orderedColumns.splice(newIndex, 0, colToMove);
14787
- for (var i = 0; i < orderedColumns.length; i++) {
14788
- orderedColumns[i].setProperty('order', i + 1);
14789
- }
14790
- this.refreshUI();
14791
- }
14792
  };
14793
 
14794
- Row.prototype._moveCol = function (oldIndex, newIndex) {
 
14795
 
14796
- var layers = this.container.getSortedLayers();
14797
- this.container.insertLayerAt(layers[oldIndex], newIndex);
14798
 
14799
- this.refreshUI();
 
14800
  };
14801
 
14802
- Row.prototype.historyMoveCol = function (data) {
14803
-
14804
- this._moveCol(data.oldIndex, data.newIndex);
 
 
 
 
 
 
 
14805
  };
14806
 
14807
- Row.prototype.setColsWidth = function (fractions) {
14808
- var cols = this.container.getSortedLayers();
14809
- for (var i = 0; i < fractions.length; i++) {
14810
- cols[i].setProperty('colwidth', fractions[i].toFraction());
 
 
 
 
 
14811
  }
 
 
14812
 
14813
- this._syncwrapafter();
14814
- this.update();
14815
-
14816
- this.refreshUI();
14817
  };
14818
 
14819
- Row.prototype.setRealColsWidth = function (fractions) {
14820
- var cols = this.getOrderedColumns();
14821
- for (var i = 0; i < fractions.length; i++) {
14822
- cols[i].setProperty('colwidth', fractions[i].toFraction());
14823
- }
14824
 
14825
- this._syncwrapafter();
14826
- this.update();
 
 
14827
 
14828
- this.refreshUI();
 
14829
  };
14830
 
14831
- Row.prototype.updateColumnWidth = function (widths) {
14832
- var wrapAfter = parseInt(this.getProperty('wrapafter')),
14833
- columns = this.getOrderedColumns(),
14834
- i;
14835
 
14836
- for (i = columns.length - 1; i >= 0; i--) {
14837
- if (!columns[i].showsOnCurrent) {
14838
- columns.splice(i, 1);
14839
- widths.splice(i, 1);
14840
- }
14841
- }
 
 
 
14842
 
14843
- var columnsLength = columns.length;
14844
 
14845
- if (wrapAfter > 0 && wrapAfter < columnsLength) {
14846
- var flexLines = [];
14847
- for (i = 0; i < columnsLength; i++) {
14848
- var row = Math.floor(i / wrapAfter);
14849
- if (typeof flexLines[row] === 'undefined') {
14850
- flexLines[row] = [];
14851
- }
14852
- columns[i]._tempWidth = widths[i];
14853
- flexLines[row].push(columns[i]);
14854
- }
14855
 
14856
- var gutterValue = this.getGutter();
14857
- for (i = 0; i < flexLines.length; i++) {
14858
- var flexLine = flexLines[i],
14859
- sumWidth = 0,
14860
- j;
14861
- for (j = 0; j < flexLine.length; j++) {
14862
- sumWidth += flexLine[j]._tempWidth;
14863
- }
14864
- for (j = 0; j < flexLine.length; j++) {
14865
- flexLine[j].layer.css('width', 'calc(' + (flexLine[j]._tempWidth / sumWidth * 100) + '% - ' + (n2const.isIE ? gutterValue + 1 : gutterValue) + 'px)');
14866
- }
14867
- }
14868
- } else {
14869
- for (i = 0; i < columnsLength; i++) {
14870
- columns[i].layer.css('width', (widths[i] * 100) + '%');
14871
- }
14872
- }
14873
 
14874
- this.update();
 
 
 
14875
  };
14876
 
14877
- Row.prototype.activateColumn = function (index, e) {
14878
- this.container.getSortedLayers()[index].activate(e);
 
 
 
 
 
 
 
 
 
14879
  };
14880
 
14881
- Row.prototype.onChildCountChange = function () {
14882
- if (!this.isDeleted && !this.isDeleteStarted) {
14883
- var layers = this.container.getSortedLayers(),
14884
- colLength = layers.length;
14885
- if (colLength) {
14886
- var currentColumns = this.getColumns().split('+'),
14887
- add = 0;
14888
- for (var i = 0; i < currentColumns.length; i++) {
14889
- add = (new Fraction(currentColumns[i])).add(add);
14890
- }
14891
- if (add.valueOf() != 1) {
14892
- for (var i = 0; i < colLength; i++) {
14893
- layers[i].setProperty('colwidth', "1/" + colLength);
14894
- }
14895
- } else {
14896
 
14897
- for (var i = 0; i < colLength; i++) {
14898
- layers[i]._synccolwidth();
14899
- }
14900
- }
14901
- this.refreshUI();
14902
- }
14903
- this._syncgutter();
14904
- }
14905
  };
14906
 
14907
- Row.prototype.renderModeProperties = function (isReset) {
14908
- N2Classes.ComponentAbstract.prototype.renderModeProperties.call(this, isReset);
14909
 
14910
- this._syncpadding();
14911
- this._syncinneralign();
14912
- this._syncgutter();
14913
 
14914
- if (this.isActive) {
14915
- this.columnsField.setRow(this);
 
 
 
 
 
 
14916
  }
14917
  };
14918
 
14919
- Row.prototype.hightlightStructure = function (hideInterval) {
14920
 
14921
- hideInterval = hideInterval || 4000;
14922
- if (this.isStructureHighlighted) {
14923
- clearTimeout(this.isStructureHighlighted);
14924
- this.isStructureHighlighted = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14925
  }
14926
- this.layer.addClass('n2-highlight-structure');
14927
- this.isStructureHighlighted = setTimeout($.proxy(function () {
14928
- if (!this.isDeleted) {
14929
- this.layer.removeClass('n2-highlight-structure');
14930
- }
14931
- }, this), hideInterval);
14932
  };
14933
 
14934
- Row.prototype.refreshUI = function () {
14935
- if (!this.isDeleteStarted) {
14936
- if (this.isActive) {
14937
- this.columnsField.setRow(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14938
  }
14939
- this._syncwrapafter();
14940
- this.$row.nUIColumns('option', 'columns', this.getColumnsOrdered());
14941
- }
 
 
 
 
 
14942
  };
14943
 
14944
- Row.prototype.getDroppable = function () {
14945
- if (!this.layer.is(":visible") || this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN || this.status == N2Classes.ComponentAbstract.STATUS.LOCKED) {
14946
- return 'hidden';
14947
- }
14948
- return {
14949
- $container: this.$row,
14950
- layer: this,
14951
- placement: 'normal',
14952
- axis: 'x'
 
 
 
 
 
14953
  }
14954
  };
14955
 
14956
- Row.prototype.getLLDroppable = function (layer) {
14957
- switch (layer.type) {
14958
- case 'col':
14959
- if (layer.group == this) {
14960
- return {
14961
- $container: this.container.$ul,
14962
- layer: this
14963
- };
14964
- }
14965
- break;
14966
- }
14967
- return false;
14968
  };
14969
 
14970
- Row.prototype.getContents = function () {
14971
- return this.$row;
 
 
 
 
 
14972
  };
14973
 
14974
- Row.prototype.setPropertystylemode = function (name, value, from) {
14975
- this.stylemode = value;
 
 
 
 
14976
 
14977
- this.syncAdvancedField('bgcolor');
14978
- this.syncAdvancedField('bgcolorgradient');
14979
- this.syncAdvancedField('bgcolorgradientend');
14980
- this.syncAdvancedField('borderradius');
14981
- this.syncAdvancedField('boxshadow');
14982
  };
14983
 
14984
- Row.prototype.onSyncFields = function () {
14985
- this.fragmentEditor.layerOptions.updateField('stylemode', this.stylemode);
14986
  };
14987
 
14988
- return Row;
 
 
 
 
 
 
14989
  });
14990
- N2D('ComponentSettings', function ($, undefined) {
14991
  "use strict";
14992
 
14993
  /**
14994
  * @memberOf N2Classes
14995
  *
14996
- * @param {FragmentEditor} fragmentEditor
14997
- * @constructor
14998
- */
14999
- function ComponentSettings(fragmentEditor) {
15000
- this.componentType = 'undefined';
15001
- this.placementType = 'undefined';
 
 
 
 
 
 
 
 
15002
 
15003
- $('html')
15004
- .attr('data-component', '')
15005
- .attr('data-placement', '');
15006
 
15007
- this.currentForm = {};
 
 
 
 
 
 
 
 
 
 
 
15008
 
15009
- this.forms = {
15010
- 'undefined': null,
15011
- placement: {
15012
- absolute: {},
15013
- normal: {},
15014
- default: {}
15015
- },
15016
- component: {
15017
- content: {},
15018
- layer: {},
15019
- row: {},
15020
- col: {},
15021
- group: {}
15022
- },
15023
- global: {
15024
- id: $('#layerid'),
15025
- uniqueclass: $('#layeruniqueclass'),
15026
- desktopPortrait: $('#layershow-desktop-portrait'),
15027
- desktopLandscape: $('#layershow-desktop-landscape'),
15028
- tabletPortrait: $('#layershow-tablet-portrait'),
15029
- tabletLandscape: $('#layershow-tablet-landscape'),
15030
- mobilePortrait: $('#layershow-mobile-portrait'),
15031
- mobileLandscape: $('#layershow-mobile-landscape'),
15032
- class: $('#layerclass'),
15033
- generatorvisible: $('#layergenerator-visible'),
15034
- crop: $('#layercrop'),
15035
- rotation: $('#layerrotation'),
15036
- parallax: $('#layerparallax'),
15037
- fontsize: $('#layerfont-size'),
15038
- adaptivefont: $('#layeradaptive-font'),
15039
- mouseenter: $('#layeronmouseenter'),
15040
- click: $('#layeronclick'),
15041
- mouseleave: $('#layeronmouseleave'),
15042
- play: $('#layeronplay'),
15043
- pause: $('#layeronpause'),
15044
- stop: $('#layeronstop')
15045
  }
15046
- };
15047
- fragmentEditor.editor.generator.registerField(this.forms.global.class);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15048
 
 
 
 
 
 
15049
  this.fragmentEditor = fragmentEditor;
 
15050
 
15051
- var availableDeviceModes = fragmentEditor.editor.getAvailableDeviceModes();
 
 
 
 
 
 
 
 
 
 
 
 
 
15052
 
15053
- if (!availableDeviceModes.desktopLandscape) {
15054
- this.forms.global.desktopLandscape.closest('.n2-mixed-group').css('display', 'none');
15055
- }
15056
- if (!availableDeviceModes.tabletPortrait) {
15057
- this.forms.global.tabletPortrait.closest('.n2-mixed-group').css('display', 'none');
15058
- }
15059
- if (!availableDeviceModes.tabletLandscape) {
15060
- this.forms.global.tabletLandscape.closest('.n2-mixed-group').css('display', 'none');
15061
- }
15062
- if (!availableDeviceModes.mobilePortrait) {
15063
- this.forms.global.mobilePortrait.closest('.n2-mixed-group').css('display', 'none');
15064
- }
15065
- if (!availableDeviceModes.mobileLandscape) {
15066
- this.forms.global.mobileLandscape.closest('.n2-mixed-group').css('display', 'none');
15067
- }
15068
 
15069
- this.forms.placement.absolute = {
15070
- parentid: $('#layerparentid'),
15071
- parentalign: $('#layerparentalign'),
15072
- parentvalign: $('#layerparentvalign'),
15073
- left: $('#layerleft'),
15074
- top: $('#layertop'),
15075
- responsiveposition: $('#layerresponsive-position'),
15076
- width: $('#layerwidth'),
15077
- height: $('#layerheight'),
15078
- responsivesize: $('#layerresponsive-size'),
15079
- align: $('#layeralign'),
15080
- valign: $('#layervalign')
15081
- };
15082
 
15083
- this.forms.placement.normal = {
15084
- margin: $('#layernormal-margin'),
15085
- height: $('#layernormal-height'),
15086
- maxwidth: $('#layernormal-maxwidth'),
15087
- selfalign: $('#layernormal-selfalign')
15088
- };
15089
 
15090
- this.forms.component.content = {
15091
- maxwidth: $('#layercontent-maxwidth'),
15092
- selfalign: $('#layercontent-selfalign'),
15093
- padding: $('#layercontent-padding'),
15094
- inneralign: $('#layercontent-inneralign'),
15095
- verticalalign: $('#layercontent-verticalalign'),
15096
- stylemode: $('#layercontent-style-mode').on('n2resetmode', $.proxy(this.resetStyleMode, this, 'stylemode')),
15097
- bgcolor: $('#layercontent-background-color'),
15098
- bgimage: $('#layercontent-background-image'),
15099
- bgimagex: $('#layercontent-background-focus-x'),
15100
- bgimagey: $('#layercontent-background-focus-y'),
15101
- bgimageparallax: $('#layercontent-background-parallax'),
15102
- bgcolorgradient: $('#layercontent-background-gradient'),
15103
- bgcolorgradientend: $('#layercontent-background-color-end'),
15104
- opened: $('#layercontent-opened')
15105
- };
15106
- fragmentEditor.editor.generator.registerField(this.forms.component.content.bgimage);
15107
 
15108
- this.forms.component.row = {
15109
- padding: $('#layerrow-padding'),
15110
- gutter: $('#layerrow-gutter'),
15111
- fullwidth: $('#layerrow-fullwidth'),
15112
- stretch: $('#layerrow-stretch'),
15113
- wrapafter: $('#layerrow-wrap-after'),
15114
- inneralign: $('#layerrow-inneralign'),
15115
- href: $('#layerrow-href'),
15116
- 'href-target': $('#layerrow-href-target'),
15117
- bgimage: $('#layerrow-background-image'),
15118
- bgimagex: $('#layerrow-background-focus-x'),
15119
- bgimagey: $('#layerrow-background-focus-y'),
15120
- bgimageparallax: $('#layerrow-background-parallax'),
15121
- stylemode: $('#layerrow-style-mode').on('n2resetmode', $.proxy(this.resetStyleMode, this, 'stylemode')),
15122
- bgcolor: $('#layerrow-background-color'),
15123
- bgcolorgradient: $('#layerrow-background-gradient'),
15124
- bgcolorgradientend: $('#layerrow-background-color-end'),
15125
- borderradius: $('#layerrow-border-radius'),
15126
- boxshadow: $('#layerrow-boxshadow'),
15127
- opened: $('#layerrow-opened')
15128
- };
15129
- fragmentEditor.editor.generator.registerField(this.forms.component.row.href);
15130
- fragmentEditor.editor.generator.registerField(this.forms.component.row.bgimage);
15131
 
15132
- this.forms.component.col = {
15133
- maxwidth: $('#layercol-maxwidth'),
15134
- padding: $('#layercol-padding'),
15135
- inneralign: $('#layercol-inneralign'),
15136
- verticalalign: $('#layercol-verticalalign'),
15137
- href: $('#layercol-href'),
15138
- 'href-target': $('#layercol-href-target'),
15139
- bgimage: $('#layercol-background-image'),
15140
- bgimagex: $('#layercol-background-focus-x'),
15141
- bgimagey: $('#layercol-background-focus-y'),
15142
- bgimageparallax: $('#layercol-background-parallax'),
15143
- stylemode: $('#layercol-style-mode').on('n2resetmode', $.proxy(this.resetStyleMode, this, 'stylemode')),
15144
- bgcolor: $('#layercol-background-color'),
15145
- bgcolorgradient: $('#layercol-background-gradient'),
15146
- bgcolorgradientend: $('#layercol-background-color-end'),
15147
- borderradius: $('#layercol-border-radius'),
15148
- boxshadow: $('#layercol-boxshadow'),
15149
- borderwidth: $('#layercol-border-width'),
15150
- borderstyle: $('#layercol-border-style'),
15151
- bordercolor: $('#layercol-border-color'),
15152
- opened: $('#layercol-opened'),
15153
- colwidth: $('#layercol-colwidth'),
15154
- order: $('#layercol-order')
15155
- };
15156
- fragmentEditor.editor.generator.registerField(this.forms.component.col.href);
15157
- fragmentEditor.editor.generator.registerField(this.forms.component.col.bgimage);
15158
- }
15159
 
15160
- ComponentSettings.prototype.changeActiveComponent = function (layer, componentType, placementType, properties) {
15161
- this.currentLayer = layer;
15162
 
15163
- if (this.componentType != componentType) {
 
 
 
15164
 
15165
- $('html').attr('data-component', componentType);
15166
- var pane = $('#n2-tabbed-slide-editor-settings').data('pane');
15167
 
15168
- switch (componentType) {
15169
- case 'content':
15170
- pane.showTabs(['content', 'animations', 'position']);
15171
- break;
15172
- case 'layer':
15173
- pane.showTabs(['item', 'style', 'animations', 'position']);
15174
- break;
15175
- case 'group':
15176
- pane.showTabs(['group', 'animations']);
15177
- break;
15178
- case 'row':
15179
- pane.showTabs(['row', 'animations', 'position']);
15180
- break;
15181
- case 'col':
15182
- pane.showTabs(['column', 'animations', 'position']);
15183
- break;
15184
 
 
 
 
 
 
15185
  }
15186
- this.componentType = componentType;
15187
- }
 
15188
 
 
 
15189
 
15190
- this.changeActiveComponentPlacement(placementType);
15191
- this.syncFields(properties);
 
15192
  };
15193
 
15194
- ComponentSettings.prototype.changeActiveComponentPlacement = function (placementType, properties) {
15195
-
15196
- if (this.placementType != placementType) {
15197
- $('html').attr('data-placement', placementType);
15198
- this.placementType = placementType;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15199
  }
 
 
15200
 
15201
- this.syncFields(properties);
 
 
 
 
15202
  };
15203
 
15204
- ComponentSettings.prototype.syncFields = function (properties) {
15205
- if (typeof properties == 'object') {
15206
- this.currentForm = $.extend({}, this.forms.global, this.forms.component[this.componentType], this.forms.placement[this.placementType]);
15207
 
15208
- for (var name in properties) {
15209
- if (typeof properties[name] !== undefined) {
 
15210
 
15211
- this.updateField(name, properties[name]);
15212
- } else {
15213
- console.error('Value is undefined for: ' + name);
15214
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15215
  }
15216
 
15217
- this.currentLayer.onSyncFields();
 
 
 
 
 
 
 
15218
 
15219
- for (var k in this.currentForm) {
15220
- this.currentForm[k].off('.layeroptions').on('outsideChange.layeroptions', $.proxy(this.activeComponentPropertyChanged, this, k));
15221
- }
15222
  }
 
15223
  };
15224
 
15225
- ComponentSettings.prototype.onUpdateField = function (e, name, value) {
15226
- if (e.target == this.currentLayer) {
15227
- this.updateField(name, value);
 
 
 
 
 
 
15228
  }
 
15229
  };
15230
 
15231
- ComponentSettings.prototype.updateField = function (name, value) {
15232
- if (typeof this.currentLayer['formSet' + name] === 'function') {
15233
- this.currentLayer['formSet' + name](this, value);
15234
- } else {
15235
- if (this.currentForm[name] !== undefined) {
15236
- var field = this.currentForm[name].data('field');
15237
- if (field !== undefined) {
15238
- field.insideChange(value);
15239
- }
15240
  }
15241
  }
 
 
 
 
15242
  };
15243
 
15244
- ComponentSettings.prototype.activeComponentPropertyChanged = function (name, e) {
15245
- if (this.currentLayer && !this.currentLayer.isDeleted) {
15246
- this.updateLayerProperty(name);
15247
- } else {
15248
- var field = this.currentForm[name].data('field');
15249
- if (typeof field !== 'undefined' && field !== null) {
15250
- field.insideChange('');
15251
- }
15252
  }
 
 
 
 
 
15253
  };
15254
 
15255
- ComponentSettings.prototype.updateLayerProperty = function (name) {
15256
- var value = this.currentForm[name].val();
15257
- this.currentLayer.setProperty(name, value, 'manager');
15258
  };
15259
 
15260
- ComponentSettings.prototype.startFeatures = function () {
15261
- this.layerFeatures = new N2Classes.LayerFeatures(this.forms.placement.absolute, this.fragmentEditor);
15262
 
15263
- var globalAdaptiveFont = $('#n2-ss-layer-adaptive-font').on('click', $.proxy(function () {
15264
- this.currentForm.adaptivefont.data('field').onoff.trigger('click');
15265
- }, this));
15266
 
15267
- this.forms.global.adaptivefont.on('nextendChange', $.proxy(function () {
15268
- if (this.currentForm.adaptivefont.val() == 1) {
15269
- globalAdaptiveFont.addClass('n2-active');
15270
- } else {
15271
- globalAdaptiveFont.removeClass('n2-active');
15272
- }
15273
- }, this));
15274
 
 
15275
 
15276
- new N2Classes.FormElementNumber("n2-ss-layer-font-size", -Number.MAX_VALUE, Number.MAX_VALUE);
15277
- new N2Classes.FormElementNumberSlider("n2-ss-layer-font-size", {
15278
- min: 50,
15279
- max: 300,
15280
- step: 5
15281
- });
15282
 
15283
- var globalFontSize = $('#n2-ss-layer-font-size').on('outsideChange', $.proxy(function () {
15284
- var value = parseInt(globalFontSize.val());
15285
- this.currentForm.fontsize.val(value).trigger('change');
15286
- }, this));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15287
 
15288
- this.forms.global.fontsize.on('nextendChange', $.proxy(function () {
15289
- globalFontSize.data('field').insideChange(this.forms.global.fontsize.val());
15290
- }, this));
15291
  };
15292
 
15293
- ComponentSettings.prototype.resetStyleMode = function (name, e) {
15294
- this.currentLayer.resetStyleMode(name);
15295
  };
15296
 
15297
- return ComponentSettings;
15298
- });
15299
- N2D('BgAnimationEditor', ['NextendFragmentEditorController'], function ($, undefined) {
 
 
 
 
15300
 
15301
- /**
15302
- * @memberOf N2Classes
15303
- *
15304
- * @constructor
15305
- */
15306
- function BgAnimationEditor() {
15307
- this.parameters = {
15308
- shiftedBackgroundAnimation: 0
15309
- };
 
 
 
 
 
15310
 
15311
- this.$css = $('<style></style>').appendTo('head');
15312
- this.backgroundAnimations = {
15313
- color: 'eeeeeeff'
15314
- };
15315
 
15316
- N2Classes.NextendFragmentEditorController.prototype.constructor.call(this, false);
 
 
15317
 
15318
- this.bgAnimationElement = $('.n2-bg-animation');
15319
- this.slides = $('.n2-bg-animation-slide');
15320
- this.bgImages = $('.n2-bg-animation-slide-bg');
15321
- NextendTween.set(this.bgImages, {
15322
- rotationZ: 0.0001
15323
- });
15324
 
15325
- this.directionTab = new N2Classes.FormElementRadio('n2-background-animation-preview-tabs', ['0', '1']);
15326
- this.directionTab.element.on('nextendChange.n2-editor', $.proxy(this.directionTabChanged, this));
15327
 
15328
- if (!nModernizr.csstransforms3d || !nModernizr.csstransformspreserve3d) {
15329
- N2Classes.Notification.error('Background animations are not available in your browser. It works if the <i>transform-style: preserve-3d</i> feature available. ')
 
15330
  }
15331
 
 
15332
 
15333
- this.$colorField = $('#n2-background-animationcolor')
15334
- .on('nextendChange', $.proxy(this.changeColor, this));
15335
- }
15336
 
15337
- BgAnimationEditor.prototype = Object.create(N2Classes.NextendFragmentEditorController.prototype);
15338
- BgAnimationEditor.prototype.constructor = BgAnimationEditor;
 
 
 
15339
 
15340
- BgAnimationEditor.prototype.loadDefaults = function () {
15341
- N2Classes.NextendFragmentEditorController.prototype.loadDefaults.call(this);
15342
- this.type = 'backgroundanimation';
15343
- this.current = 0;
15344
- this.animationProperties = false;
15345
- this.direction = 0;
15346
- };
15347
 
15348
- BgAnimationEditor.prototype.get = function () {
15349
- return null;
15350
  };
15351
 
15352
- BgAnimationEditor.prototype.load = function (visual, tabs, mode, preview) {
15353
- this.lightbox.addClass('n2-editor-loaded');
 
 
 
 
15354
  };
15355
 
15356
- BgAnimationEditor.prototype.setTabs = function (labels) {
 
15357
 
 
 
 
 
15358
  };
15359
 
15360
- BgAnimationEditor.prototype.directionTabChanged = function () {
15361
- this.direction = parseInt(this.directionTab.element.val());
15362
- };
15363
 
15364
- BgAnimationEditor.prototype.start = function (data) {
15365
- if (data.color !== undefined) {
15366
- this.$colorField.data('field').insideChange(data.color);
15367
- this.backgroundAnimations.color = data.color;
15368
- } else {
15369
- $('#n2-tab-background-animation-form').remove();
15370
- this.$css.html('.n2-3d-side,.tile-colored-overlay{background: ' + nextend.currentEditor.frontend.parameters.bgAnimationsColor + ';}');
15371
- }
15372
- if (this.animationProperties) {
15373
- if (!this.timeline) {
15374
- this.next();
15375
- } else {
15376
- this.timeline.play();
15377
- }
15378
  }
 
 
 
 
 
 
15379
  };
15380
 
15381
- BgAnimationEditor.prototype.changeColor = function () {
15382
- this.backgroundAnimations.color = this.$colorField.val();
15383
- this.$css.html('.n2-3d-side,.tile-colored-overlay{background: ' + N2Color.hex2rgbaCSS(this.backgroundAnimations.color) + ';}');
 
15384
  };
15385
 
15386
- BgAnimationEditor.prototype.pause = function () {
15387
- if (this.timeline) {
15388
- this.timeline.pause();
 
15389
  }
15390
  };
15391
 
15392
- BgAnimationEditor.prototype.next = function () {
15393
- this.timeline = new NextendTimeline({
15394
- paused: true,
15395
- onComplete: $.proxy(this.ended, this)
15396
- });
15397
- var current = this.bgImages.eq(this.current),
15398
- next = this.bgImages.eq(1 - this.current);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15399
 
15400
- if (nModernizr.csstransforms3d && nModernizr.csstransformspreserve3d) {
15401
- this.currentAnimation = new N2Classes['SmartSliderBackgroundAnimation' + this.animationProperties.type](this, current, next, this.animationProperties, 1, this.direction);
15402
 
15403
- this.slides.eq(this.current).css('zIndex', 2);
15404
- this.slides.eq(1 - this.current).css('zIndex', 3);
 
15405
 
15406
- this.timeline.to(this.slides.eq(this.current), 0.5, {
15407
- opacity: 0
15408
- }, this.currentAnimation.getExtraDelay());
 
15409
 
15410
- this.timeline.to(this.slides.eq(1 - this.current), 0.5, {
15411
- opacity: 1
15412
- }, this.currentAnimation.getExtraDelay());
15413
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15414
 
15415
- this.currentAnimation.postSetup();
15416
 
15417
- } else {
15418
 
15419
- this.timeline.to(this.slides.eq(this.current), 1.5, {
15420
- opacity: 0
15421
- }, 0);
 
 
15422
 
15423
- this.timeline.to(this.slides.eq(1 - this.current), 1.5, {
15424
- opacity: 1
15425
- }, 0);
15426
  }
15427
- this.current = 1 - this.current;
15428
- this.timeline.play();
 
 
15429
  };
15430
 
15431
- BgAnimationEditor.prototype.ended = function () {
15432
- if (this.currentAnimation) {
15433
- this.currentAnimation.ended();
 
 
 
 
 
15434
  }
15435
- this.next();
15436
- };
15437
 
15438
- BgAnimationEditor.prototype.setAnimationProperties = function (animationProperties) {
15439
- var lastAnimationProperties = this.animationProperties;
15440
- this.animationProperties = animationProperties;
15441
- if (!lastAnimationProperties) {
15442
- this.next();
15443
  }
 
 
 
 
15444
  };
15445
 
15446
- return BgAnimationEditor;
15447
- });
15448
-
15449
- N2D('BgAnimationManager', ['NextendVisualManagerMultipleSelection'], function ($, undefined) {
15450
 
15451
- /**
15452
- * @memberOf N2Classes
15453
- *
15454
- * @constructor
15455
- */
15456
- function BgAnimationManager() {
15457
- this.type = 'backgroundanimation';
15458
- N2Classes.NextendVisualManagerMultipleSelection.prototype.constructor.apply(this, arguments);
15459
- }
15460
 
15461
- BgAnimationManager.prototype = Object.create(N2Classes.NextendVisualManagerMultipleSelection.prototype);
15462
- BgAnimationManager.prototype.constructor = BgAnimationManager;
 
15463
 
15464
- BgAnimationManager.prototype.loadDefaults = function () {
15465
- N2Classes.NextendVisualManagerMultipleSelection.prototype.loadDefaults.apply(this, arguments);
15466
- this.type = 'backgroundanimation';
15467
- this.labels = {
15468
- visual: 'Background animation',
15469
- visuals: 'Background animations'
15470
- };
15471
- };
15472
 
15473
- BgAnimationManager.prototype.initController = function () {
15474
- return new N2Classes.BgAnimationEditor();
15475
  };
15476
 
15477
- BgAnimationManager.prototype.createVisual = function (visual, set) {
15478
- return new N2Classes.NextendVisualWithSetRowMultipleSelection(visual, set, this);
15479
- };
15480
 
15481
- BgAnimationManager.prototype.show = function (data, saveCallback) {
15482
- var controllerParameters = {};
15483
 
15484
- var $colorField = $('#sliderbackground-animation-color');
15485
- if ($colorField.length) {
15486
- controllerParameters.color = $colorField.val();
15487
  }
15488
- N2Classes.NextendVisualManagerMultipleSelection.prototype.show.call(this, data, saveCallback, controllerParameters);
15489
- };
15490
 
15491
- BgAnimationManager.prototype.getAsString = function () {
15492
 
15493
- var $colorField = $('#sliderbackground-animation-color');
15494
- if ($colorField.length) {
15495
- $colorField.val($('#n2-background-animationcolor').val());
15496
  }
15497
- return N2Classes.NextendVisualManagerMultipleSelection.prototype.getAsString.call(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15498
  };
15499
 
15500
- return BgAnimationManager;
15501
- });
15502
-
15503
- N2D('nUICanvasItem', ['nUIMouse'], function ($, undefined) {
15504
  "use strict";
15505
 
15506
  /**
15507
  * @memberOf N2Classes
15508
  *
15509
- * @class
 
 
15510
  * @constructor
15511
- * @augments nUIMouse
15512
-
15513
- * @this nUICanvasItem
15514
  */
15515
- function nUICanvasItem(element, options) {
15516
- this.element = $(element);
15517
-
15518
- this.widgetName = this.widgetName || 'nUICanvasItem';
15519
- this.widgetEventPrefix = "canvasItem";
15520
 
15521
- this.options = $.extend({
15522
- canvasUIManager: null,
15523
- layer: false,
15524
- $layer: null,
15525
- distance: 2,
15526
- onCreate: function () {
15527
 
15528
- }
15529
- }, this.options, options);
15530
 
15531
- N2Classes.nUIMouse.prototype.constructor.apply(this, arguments);
 
 
 
 
 
 
 
15532
 
15533
- this.create();
15534
- }
15535
 
15536
- nUICanvasItem.prototype = Object.create(N2Classes.nUIMouse.prototype);
15537
- nUICanvasItem.prototype.constructor = nUICanvasItem;
15538
 
15539
- nUICanvasItem.prototype.create = function () {
15540
 
15541
- if (typeof this.options.$layer === 'function') {
15542
- this.options.$layer = this.options.$layer.call(this, this);
15543
- }
15544
 
15545
- this._mouseInit();
15546
- };
15547
- nUICanvasItem.prototype._mouseCapture = function (event, overrideHandle) {
15548
- return this.options.canvasUIManager._mouseCapture(this.options, event, overrideHandle);
15549
- };
15550
 
15551
- nUICanvasItem.prototype._mouseStart = function (event, overrideHandle, noActivation) {
15552
- this._trigger('start');
15553
- return this.options.canvasUIManager._mouseStart(this.options, event, overrideHandle, noActivation);
15554
- };
15555
 
15556
- nUICanvasItem.prototype._mouseDrag = function (event) {
15557
- return this.options.canvasUIManager._mouseDrag(this.options, event);
15558
- };
15559
 
15560
- nUICanvasItem.prototype._mouseStop = function (event, noPropagation) {
15561
- return this.options.canvasUIManager._mouseStop(this.options, event, noPropagation);
15562
 
15563
- };
15564
 
15565
- nUICanvasItem.prototype._destroy = function () {
15566
- this._mouseDestroy();
15567
 
15568
- return this;
15569
- };
15570
 
15571
- N2Classes.nUIWidgetBase.register('nUICanvasItem');
 
 
 
15572
 
15573
- return nUICanvasItem;
15574
- });
15575
- N2D('nUICanvas', ['nUIWidgetBase'], function ($, undefined) {
15576
- "use strict";
15577
 
15578
- /**
15579
- * @memberOf N2Classes
15580
- *
15581
- * @class
15582
- * @constructor
15583
- * @augments nUIWidgetBase
15584
 
15585
- * @this nUICanvas
15586
- */
15587
- function nUICanvas(element, options) {
15588
- this.element = $(element);
15589
 
15590
- this.widgetName = this.widgetName || 'nUICanvas';
15591
- this.widgetEventPrefix = "canvas";
 
15592
 
15593
- this.options = $.extend({
15594
- mainContainer: null,
15595
- display: false,
15596
- }, this.options, options);
15597
 
15598
- N2Classes.nUIWidgetBase.prototype.constructor.apply(this, arguments);
15599
- }
15600
 
15601
- nUICanvas.prototype = Object.create(N2Classes.nUIWidgetBase.prototype);
15602
- nUICanvas.prototype.constructor = nUICanvas;
15603
 
15604
- nUICanvas.plugins = {};
 
 
 
15605
 
15606
- nUICanvas.prototype._mouseCapture = function (itemOptions, event, overrideHandle) {
15607
- return $(event.target).closest(".nui-resizable-handle, .nui-normal-sizing-handle, .nui-spacing-handle").length == 0;
15608
  };
15609
 
15610
- nUICanvas.prototype._mouseStart = function (itemOptions, event, overrideHandle, noActivation) {
 
 
15611
 
15612
- $('body').addClass('n2-ss-move-layer');
 
 
15613
 
15614
- this.dragDeferred = $.Deferred();
15615
- this.options.mainContainer.fragmentEditor.layerWindow.hideWithDeferred(this.dragDeferred);
15616
 
15617
- this.context = {
15618
- placeholder: $('<div class="n2-ss-layer-placeholder" />'),
15619
- mouse: {
15620
- offset: {
15621
- left: event.pageX,
15622
- top: event.pageY
15623
- }
15624
- },
15625
- canvas: {
15626
- offset: this.options.mainContainer.layer.offset(),
15627
- size: {
15628
- width: this.options.mainContainer.layer.outerWidth(),
15629
- height: this.options.mainContainer.layer.outerHeight()
15630
- }
15631
  },
15632
- $layer: itemOptions.$layer
15633
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15634
 
15635
- var css = {
15636
- position: 'absolute',
15637
- right: 'auto',
15638
- bottom: 'auto'
15639
- };
 
 
 
 
 
 
15640
 
15641
- if (!itemOptions.layer) {
15642
- this.startMode = 'create';
 
 
 
 
 
 
15643
 
15644
- this.context.layer = {
15645
- offset: {
15646
- left: 0,
15647
- top: 0
15648
- }
15649
- };
15650
 
15651
- itemOptions.$layer.appendTo('body');
15652
- } else {
15653
- this.startMode = itemOptions.layer.placement.getType();
15654
 
15655
- this.context.layer = {
15656
- offset: itemOptions.$layer.offset()
15657
- };
15658
 
15659
- this.context.originalIndex = itemOptions.layer.getIndex();
 
 
 
 
 
 
15660
 
15661
- if (this.startMode == 'normal') {
15662
 
15663
- css.width = itemOptions.$layer.width();
15664
- //css.height = itemOptions.$layer.height();
15665
 
15666
- itemOptions.$layer.appendTo(this.options.mainContainer.layer);
15667
- }
15668
- }
15669
 
15670
- itemOptions.$layer
15671
- .addClass('n2-canvas-item-drag')
15672
- .css(css);
15673
 
15674
- this._cacheMargins(itemOptions.$layer);
 
15675
 
15676
- this.context.size = {
15677
- width: itemOptions.$layer.outerWidth(),
15678
- height: itemOptions.$layer.outerHeight()
15679
- };
15680
 
 
15681
 
15682
- this.context.droppables = this.options.mainContainer.getDroppables(itemOptions.layer);
15683
 
15684
- this._cacheContainers();
15685
 
15686
- this._trigger("start", event, {
15687
- layer: itemOptions.layer,
15688
- mode: this.startMode
15689
- });
 
 
 
15690
 
15691
- this._mouseDrag(itemOptions, event);
15692
  };
15693
 
15694
- nUICanvas.prototype._mouseDrag = function (itemOptions, event) {
15695
- var position;
15696
- if (this.startMode == 'create') {
15697
- position = {
15698
- top: event.pageY - this.context.canvas.offset.top - 20,
15699
- left: event.pageX - this.context.canvas.offset.left - 20
15700
- };
15701
- } else {
15702
- position = {
15703
- top: this.context.layer.offset.top - this.context.canvas.offset.top + event.pageY - this.context.mouse.offset.top,
15704
- left: this.context.layer.offset.left - this.context.canvas.offset.left + event.pageX - this.context.mouse.offset.left
15705
- };
15706
- }
15707
 
15708
- var targetContainer = this._findInnerContainer(event);
15709
- if (targetContainer === false && this.startMode != 'create') {
15710
- targetContainer = this.context.droppables[0];
15711
- }
15712
- if (targetContainer) {
15713
- if (targetContainer.placement == 'normal') {
15714
 
15715
- if (typeof targetContainer.layers === "undefined") {
15716
- targetContainer.layers = this._cacheContainerLayers(targetContainer);
 
 
 
15717
  }
 
 
 
 
 
 
15718
 
15719
- var targetIndex = this._findNormalIndex(event, targetContainer);
15720
- if (targetIndex > 0) {
15721
- this.context.placeholder.css('order', targetContainer.layers[targetIndex - 1].layer.layer.css('order'));
15722
- this.context.placeholder.insertAfter(targetContainer.layers[targetIndex - 1].layer.layer);
15723
- } else {
15724
- this.context.placeholder.css('order', 0);
15725
- this.context.placeholder.prependTo(targetContainer.$container);
 
 
15726
  }
 
 
 
 
15727
 
15728
- this.context.targetIndex = targetIndex;
15729
- } else {
15730
- this.context.placeholder.detach();
15731
- }
15732
- } else {
15733
- this.context.placeholder.detach();
15734
- }
15735
-
15736
- this.context.targetContainer = targetContainer;
15737
-
15738
 
15739
- this._trigger("drag", event, {
15740
- layer: itemOptions.layer,
15741
- originalOffset: this.context.layer.offset,
15742
- position: position,
15743
- canvasOffset: this.context.canvas.offset,
15744
- offset: {
15745
- left: position.left + this.context.canvas.offset.left,
15746
- top: position.top + this.context.canvas.offset.top
15747
- }
15748
- });
15749
 
15750
- if (this.startMode == 'create') {
15751
- position.left += this.context.canvas.offset.left;
15752
- position.top += this.context.canvas.offset.top;
15753
- }
15754
 
15755
- itemOptions.$layer.css(position);
 
 
15756
 
15757
- this._displayPosition(event, position);
15758
- };
 
15759
 
15760
- nUICanvas.prototype._mouseStop = function (itemOptions, event, noPropagation) {
15761
- this.context.placeholder.remove();
15762
 
15763
- var targetIndex = this.context.targetIndex,
15764
- targetContainer = this.context.targetContainer;
 
 
 
 
 
 
 
 
15765
 
15766
- itemOptions.$layer
15767
- .removeClass('n2-canvas-item-drag');
15768
 
15769
- if (this.startMode == 'create') {
15770
- if (targetContainer) {
15771
- itemOptions.onCreate.call(this, event, itemOptions, targetContainer, targetIndex);
15772
- }
15773
- itemOptions.$layer.detach();
 
 
 
15774
 
15775
- } else {
15776
- if (targetContainer === undefined) {
15777
- targetContainer = this.options.mainContainer.layer;
15778
- }
15779
 
15780
- if (this.startMode == 'absolute' && targetContainer.placement == 'absolute') {
15781
 
15782
- // Simple drag on the canvas on an absolute layer. Just update its position!
15783
- var left = parseInt(itemOptions.$layer.css('left')),
15784
- top = parseInt(itemOptions.$layer.css('top'));
 
 
 
 
 
 
 
15785
 
15786
- itemOptions.$layer.css({
15787
- position: '',
15788
- right: '',
15789
- bottom: '',
15790
- });
15791
 
15792
- itemOptions.layer.placement.current.setPosition(left, top);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15793
 
15794
- } else if (targetContainer.placement == 'absolute') {
 
 
 
 
15795
 
15796
- // Layer moved from a normal container to the canvas.
 
 
 
15797
 
15798
- var left = parseInt(itemOptions.$layer.css('left')),
15799
- top = parseInt(itemOptions.$layer.css('top'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15800
 
15801
- itemOptions.$layer.css({
15802
- position: '',
15803
- right: '',
15804
- bottom: '',
15805
- });
15806
 
15807
- var width = itemOptions.$layer.width(),
15808
- height = itemOptions.$layer.height();
 
15809
 
15810
- itemOptions.layer.group.onChildCountChange();
 
 
 
15811
 
15812
- var oldAbsoluteGroup = itemOptions.layer;
15813
- while (oldAbsoluteGroup && (!oldAbsoluteGroup.placement || oldAbsoluteGroup.placement.getType() !== 'absolute')) {
15814
- oldAbsoluteGroup = oldAbsoluteGroup.group;
15815
- }
15816
 
15817
- N2Classes.History.get().startBatch();
15818
- // Set the new group, which will trigger this current placement to activate
15819
- itemOptions.layer.changeGroup(this.context.originalIndex, this.options.mainContainer);
15820
- N2Classes.History.get().addControl('skipForwardUndos');
 
 
15821
 
15822
- if (itemOptions.layer.type == 'layer' && itemOptions.layer.item) {
15823
- if (!itemOptions.layer.item.needSize) {
15824
- height = 'auto';
15825
- width++; //Prevent text layers to wrap line ending to new line after drag
15826
- }
15827
- }
15828
 
15829
- // As this placement activated, we have to set these values from the closest absolute parent
15830
- var targetAlign = oldAbsoluteGroup ? oldAbsoluteGroup.getProperty('align') : 'center',
15831
- targetValign = oldAbsoluteGroup ? oldAbsoluteGroup.getProperty('valign') : 'middle';
15832
 
15833
- itemOptions.layer.placement.current._setPosition(targetAlign, targetValign, left, top, width, height, true);
 
 
 
15834
 
15835
- N2Classes.History.get().endBatch();
 
15836
 
15837
- } else if (targetContainer.placement == 'normal') {
15838
- itemOptions.$layer.css({
15839
- position: 'relative',
15840
- width: '',
15841
- left: '',
15842
- top: ''
15843
- });
15844
 
15845
- switch (targetContainer.layer.type) {
 
 
 
 
15846
 
15847
- case 'content':
15848
- case 'col':
15849
- if (targetIndex > 0) {
15850
- itemOptions.$layer.insertAfter(targetContainer.layers[targetIndex - 1].layer.layer);
15851
- } else {
15852
- itemOptions.$layer.prependTo(targetContainer.$container);
15853
- }
 
15854
 
15855
- itemOptions.layer.onCanvasUpdate(this.context.originalIndex, targetContainer.layer, targetIndex);
15856
- break;
 
 
15857
 
15858
- case 'row':
15859
- var col = targetContainer.layer.createCol();
15860
- targetContainer.layer.moveCol(col.getIndex(), targetIndex);
15861
 
15862
- itemOptions.$layer.prependTo(col.$content);
15863
- itemOptions.layer.onCanvasUpdate(this.context.originalIndex, col, 0);
15864
 
15865
- break;
15866
- }
15867
 
15868
- //itemOptions.layer.placement.current._syncheight(); // we should sync back the height of the normal layer
15869
- }
15870
- }
15871
 
15872
- delete this.context;
 
15873
 
15874
- if (this.options.display) {
15875
- this.options.display.hide();
15876
- }
15877
 
15878
- this._trigger("stop", event, {
15879
- layer: itemOptions.layer
15880
- });
15881
 
15882
- this.dragDeferred.resolve();
15883
 
 
15884
 
15885
- $('body').removeClass('n2-ss-move-layer');
15886
  };
15887
 
15888
- nUICanvas.prototype.cancel = function (itemOptions) {
 
 
 
 
 
 
15889
  };
15890
 
15891
- nUICanvas.prototype._cacheContainers = function () {
15892
- for (var i = 0; i < this.context.droppables.length; i++) {
15893
- var obj = this.context.droppables[i];
15894
- obj.offset = obj.$container.offset();
15895
- obj.size = {
15896
- width: obj.$container.outerWidth(),
15897
- height: obj.$container.outerHeight()
15898
- };
15899
- obj.offset.right = obj.offset.left + obj.size.width;
15900
- obj.offset.bottom = obj.offset.top + obj.size.height;
 
15901
  }
15902
  };
15903
 
15904
- nUICanvas.prototype._findInnerContainer = function (event) {
15905
- for (var i = this.context.droppables.length - 1; i >= 0; i--) {
15906
- var obj = this.context.droppables[i];
15907
- if (obj.offset.left <= event.pageX && obj.offset.right >= event.pageX && obj.offset.top <= event.pageY && obj.offset.bottom >= event.pageY) {
15908
- return obj;
15909
- }
15910
  }
15911
- return false;
15912
  };
15913
 
15914
- nUICanvas.prototype._cacheContainerLayers = function (droppable) {
15915
- var layerObjects = [],
15916
- layers = droppable.layer.container.getSortedLayers();
 
 
 
 
 
15917
 
 
 
15918
  for (var i = 0; i < layers.length; i++) {
15919
- var obj = {
15920
- layer: layers[i]
15921
- };
15922
- obj.offset = obj.layer.layer.offset();
15923
- obj.size = {
15924
- width: obj.layer.layer.outerWidth(),
15925
- height: obj.layer.layer.outerHeight()
15926
- };
15927
- obj.offset.right = obj.offset.left + obj.size.width / 2;
15928
- obj.offset.bottom = obj.offset.top + obj.size.height / 2;
15929
- layerObjects.push(obj);
15930
  }
 
 
15931
 
15932
- return layerObjects;
 
15933
  };
15934
 
15935
- nUICanvas.prototype._findNormalIndex = function (event, targetContainer) {
15936
- var index = -1;
 
 
15937
 
15938
- switch (targetContainer.axis) {
15939
- case 'y':
15940
- for (var i = 0; i < targetContainer.layers.length; i++) {
15941
- var obj = targetContainer.layers[i];
15942
- if (event.pageY <= obj.offset.bottom) {
15943
- index = i;
15944
- break;
15945
- }
15946
- }
15947
- break;
15948
- case 'x':
15949
- for (var i = 0; i < targetContainer.layers.length; i++) {
15950
- var obj = targetContainer.layers[i];
15951
- if (event.pageX <= obj.offset.right) {
15952
- index = i;
15953
- break;
15954
- }
15955
- }
15956
- break;
15957
  }
15958
 
15959
- if (index === -1) {
15960
- index = targetContainer.layers.length;
15961
- }
15962
 
15963
- return index;
15964
  };
15965
 
15966
- nUICanvas.prototype._displayPosition = function (event, position) {
 
 
15967
 
15968
- if (this.options.display) {
15969
- if (this.context.targetContainer && this.context.targetContainer.placement == 'absolute') {
15970
- if (this.options.display.hidden) {
15971
- this.options.display.show();
15972
- }
15973
- if (this.startMode == 'create') {
15974
- position.left -= this.context.canvas.offset.left;
15975
- position.top -= this.context.canvas.offset.top;
15976
- }
15977
- this.options.display.update(event, position);
15978
- } else {
15979
- if (this.options.display.hidden) {
15980
- this.options.display.hide();
15981
- }
15982
  }
15983
  }
15984
- };
15985
 
15986
- nUICanvas.prototype._trigger = function (type, event, ui) {
15987
- ui = ui || {};
15988
-
15989
- this.callPlugin(type, [event, ui]);
15990
 
 
15991
 
15992
- return N2Classes.nUIWidgetBase.prototype._trigger.apply(this, arguments);
15993
- };
15994
 
15995
- nUICanvas.prototype._cacheMargins = function (layer) {
15996
- this.margins = {
15997
- left: ( parseInt(layer.css("marginLeft"), 10) || 0 ),
15998
- top: ( parseInt(layer.css("marginTop"), 10) || 0 ),
15999
- right: ( parseInt(layer.css("marginRight"), 10) || 0 ),
16000
- bottom: ( parseInt(layer.css("marginBottom"), 10) || 0 )
16001
- };
16002
  };
16003
 
16004
- N2Classes.nUIWidgetBase.register('nUICanvas');
16005
-
16006
-
16007
- N2Classes.nUIWidgetBase.addPlugin(nUICanvas, "smartguides", {
16008
- start: function (event, ui) {
16009
- var inst = $(this).data("nUICanvas"), o = inst.options;
16010
-
16011
- if (inst.startMode == 'create') return;
16012
 
16013
- inst.gridH = $('<div class="n2-grid n2-grid-h"></div>').appendTo(o.mainContainer.layer);
16014
- inst.gridV = $('<div class="n2-grid n2-grid-v"></div>').appendTo(o.mainContainer.layer);
16015
- inst.elements = [];
16016
- if (typeof o.smartguides == 'function') {
16017
- var guides = $(o.smartguides(inst.context)).not(inst.context.$layer);
16018
- if (guides && guides.length) {
16019
- guides.each(function () {
16020
- var $t = $(this);
16021
- var $o = $t.offset();
16022
- if (this != inst.element[0]) inst.elements.push({
16023
- item: this,
16024
- width: $t.outerWidth(), height: $t.outerHeight(),
16025
- top: Math.round($o.top), left: Math.round($o.left),
16026
- backgroundColor: ''
16027
- });
16028
- });
16029
  }
16030
- var $o = o.mainContainer.layer.offset();
16031
- inst.elements.push({
16032
- width: o.mainContainer.layer.width(), height: o.mainContainer.layer.height(),
16033
- top: Math.round($o.top), left: Math.round($o.left),
16034
- backgroundColor: '#ff4aff'
16035
- });
16036
  }
16037
- },
16038
 
16039
- stop: function (event, ui) {
16040
- var inst = $(this).data("nUICanvas");
16041
-
16042
- if (inst.startMode == 'create') return;
16043
-
16044
- inst.gridH.remove();
16045
- inst.gridV.remove();
16046
- },
16047
 
16048
- drag: function (event, ui) {
16049
- var vElement = false,
16050
- hElement = false,
16051
- inst = $(this).data("nUICanvas"),
16052
- o = inst.options,
16053
- verticalTolerance = o.tolerance,
16054
- horizontalTolerance = o.tolerance;
16055
 
16056
- if (inst.startMode == 'create') return;
16057
 
16058
- inst.gridH.css({"display": "none"});
16059
- inst.gridV.css({"display": "none"});
 
 
 
 
 
 
 
 
 
 
16060
 
16061
- if (inst.context.targetContainer && inst.context.targetContainer.placement == 'absolute') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16062
 
16063
- var container = inst.elements[inst.elements.length - 1],
16064
- setGridV = function (left) {
16065
- inst.gridV.css({left: Math.min(left, container.width - 1), display: "block"});
16066
- },
16067
- setGridH = function (top) {
16068
- inst.gridH.css({top: Math.min(top, container.height - 1), display: "block"});
16069
- };
16070
 
16071
- var ctrlKey = event.ctrlKey || event.metaKey,
16072
- altKey = event.altKey;
16073
- if (ctrlKey && altKey) {
16074
- return;
16075
- } else if (ctrlKey) {
16076
- vElement = true;
16077
- } else if (altKey) {
16078
- hElement = true;
16079
- }
16080
- var x1 = ui.offset.left, x2 = x1 + inst.context.size.width,
16081
- y1 = ui.offset.top, y2 = y1 + inst.context.size.height,
16082
- xc = (x1 + x2) / 2,
16083
- yc = (y1 + y2) / 2;
16084
 
16085
- if (!vElement) {
16086
- for (var i = inst.elements.length - 1; i >= 0; i--) {
16087
- if (verticalTolerance == 0) break;
16088
 
16089
- var l = inst.elements[i].left,
16090
- r = l + inst.elements[i].width,
16091
- hc = (l + r) / 2;
16092
 
16093
- var v = true,
16094
- c;
16095
- if ((c = Math.abs(l - x2)) < verticalTolerance) {
16096
- ui.position.left = l - inst.context.size.width - inst.context.canvas.offset.left - inst.margins.left;
16097
- setGridV(ui.position.left + inst.context.size.width);
16098
- } else if ((c = Math.abs(l - x1)) < verticalTolerance) {
16099
- ui.position.left = l - inst.context.canvas.offset.left - inst.margins.left;
16100
- setGridV(ui.position.left);
16101
- } else if ((c = Math.abs(r - x1)) < verticalTolerance) {
16102
- ui.position.left = r - inst.context.canvas.offset.left - inst.margins.left;
16103
- setGridV(ui.position.left);
16104
- } else if ((c = Math.abs(r - x2)) < verticalTolerance) {
16105
- ui.position.left = r - inst.context.size.width - inst.context.canvas.offset.left - inst.margins.left;
16106
- setGridV(ui.position.left + inst.context.size.width);
16107
- } else if ((c = Math.abs(hc - x2)) < verticalTolerance) {
16108
- ui.position.left = hc - inst.context.size.width - inst.context.canvas.offset.left - inst.margins.left;
16109
- setGridV(ui.position.left + inst.context.size.width);
16110
- } else if ((c = Math.abs(hc - x1)) < verticalTolerance) {
16111
- ui.position.left = hc - inst.context.canvas.offset.left - inst.margins.left;
16112
- setGridV(ui.position.left);
16113
- } else if ((c = Math.abs(hc - xc)) < verticalTolerance) {
16114
- ui.position.left = hc - inst.context.size.width / 2 - inst.context.canvas.offset.left - inst.margins.left;
16115
- setGridV(ui.position.left + inst.context.size.width / 2);
16116
- } else {
16117
- v = false;
16118
- }
16119
 
16120
- if (v) {
16121
- vElement = inst.elements[i];
16122
- verticalTolerance = Math.min(c, verticalTolerance);
16123
- }
16124
- }
16125
- }
16126
 
16127
- if (!hElement) {
16128
- for (var i = inst.elements.length - 1; i >= 0; i--) {
16129
- if (horizontalTolerance == 0) break;
16130
 
16131
- var t = inst.elements[i].top,
16132
- b = t + inst.elements[i].height,
16133
- vc = (t + b) / 2;
 
 
 
16134
 
16135
- var h = true,
16136
- c;
16137
- if ((c = Math.abs(t - y2)) < horizontalTolerance) {
16138
- ui.position.top = t - inst.context.size.height - inst.context.canvas.offset.top - inst.margins.top;
16139
- setGridH(ui.position.top + inst.context.size.height);
16140
- } else if ((c = Math.abs(t - y1)) < horizontalTolerance) {
16141
- ui.position.top = t - inst.context.canvas.offset.top - inst.margins.top;
16142
- setGridH(ui.position.top);
16143
- } else if ((c = Math.abs(b - y1)) < horizontalTolerance) {
16144
- ui.position.top = b - inst.context.canvas.offset.top - inst.margins.top;
16145
- setGridH(ui.position.top);
16146
- } else if ((c = Math.abs(b - y2)) < horizontalTolerance) {
16147
- ui.position.top = b - inst.context.size.height - inst.context.canvas.offset.top - inst.margins.top;
16148
- setGridH(ui.position.top + inst.context.size.height);
16149
- } else if ((c = Math.abs(vc - y2)) < horizontalTolerance) {
16150
- ui.position.top = vc - inst.context.size.height - inst.context.canvas.offset.top - inst.margins.top;
16151
- setGridH(ui.position.top + inst.context.size.height);
16152
- } else if ((c = Math.abs(vc - y1)) < horizontalTolerance) {
16153
- ui.position.top = vc - inst.context.canvas.offset.top - inst.margins.top;
16154
- setGridH(ui.position.top);
16155
- } else if ((c = Math.abs(vc - yc)) < horizontalTolerance) {
16156
- ui.position.top = vc - inst.context.size.height / 2 - inst.context.canvas.offset.top - inst.margins.top;
16157
- setGridH(ui.position.top + inst.context.size.height / 2);
16158
- } else {
16159
- h = false;
16160
- }
16161
 
16162
- if (h) {
16163
- hElement = inst.elements[i];
16164
- horizontalTolerance = Math.min(c, horizontalTolerance);
16165
- }
16166
- }
16167
- }
16168
 
16169
- if (vElement && vElement !== true) {
16170
- inst.gridV.css('backgroundColor', vElement.backgroundColor);
16171
- }
16172
- if (hElement && hElement !== true) {
16173
- inst.gridH.css('backgroundColor', hElement.backgroundColor);
16174
- }
16175
  }
 
 
 
 
 
 
16176
  }
16177
- });
 
16178
 
16179
- return nUICanvas;
16180
- });
16181
- N2D('nUIColumns', ['nUIMouse'], function ($, undefined) {
16182
- "use strict";
16183
 
16184
- /**
16185
- * @memberOf N2Classes
16186
- *
16187
- * @class
16188
- * @constructor
16189
- * @augments nUIMouse
 
 
 
 
 
 
16190
 
16191
- * @this nUIColumns
16192
- */
16193
- function nUIColumns(element, options) {
16194
- this.active = 0;
16195
- this.created = false;
16196
- this.invalidated = false;
16197
 
16198
- this.element = $(element);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16199
 
16200
- this.widgetName = this.widgetName || 'nUIColumns';
16201
- this.widgetEventPrefix = "columns";
16202
 
16203
- this.options = $.extend({
16204
- columns: '1',
16205
- gutter: 0,
16206
- denominators: {
16207
- 1: 100,
16208
- 2: 100,
16209
- 3: 144,
16210
- 4: 100,
16211
- 5: 100,
16212
- 6: 144
16213
- },
16214
- // Callbacks
16215
- drag: null,
16216
- start: null,
16217
- stop: null
16218
- }, this.options, options);
16219
 
16220
- N2Classes.nUIMouse.prototype.constructor.apply(this, arguments);
16221
- }
16222
 
16223
- nUIColumns.prototype = Object.create(N2Classes.nUIMouse.prototype);
16224
- nUIColumns.prototype.constructor = nUIColumns;
 
 
 
16225
 
16226
- nUIColumns.prototype.create = function () {
16227
- if (!this.created) {
16228
- this.created = true;
 
 
 
 
 
 
16229
 
16230
- this._setupHandles();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16231
 
16232
- $(window).on('resize', $.proxy(this._resize, this));
 
16233
 
16234
- this._mouseInit();
 
16235
  }
 
16236
  };
16237
 
16238
- nUIColumns.prototype._destroy = function () {
 
 
 
 
 
 
16239
 
16240
- this._mouseDestroy();
16241
- this.element
16242
- .removeData("uiNextendColumns")
16243
- .off(".columns")
16244
- .find("> .ui-column-width-handle")
16245
- .remove();
16246
 
16247
- return this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16248
  };
16249
 
16250
- nUIColumns.prototype.getDenominator = function (i) {
16251
- if (this.options.denominators[i] === undefined) {
16252
- this.options.denominators[i] = i * 15;
16253
- }
16254
- return this.options.denominators[i];
 
16255
  };
16256
 
16257
- nUIColumns.prototype._setupHandles = function () {
16258
- var o = this.options, handle, i, n, axis;
16259
 
16260
- this.fractions = [];
 
16261
 
16262
- var columnWidths = o.columns.split('+');
16263
- for (var i = 0; i < columnWidths.length; i++) {
16264
- this.fractions.push(new Fraction(columnWidths[i]));
 
16265
  }
16266
- this.currentDenominator = this.getDenominator(this.fractions.length);
16267
 
16268
- var currentPercent = 0;
16269
- for (i = 0; i < this.fractions.length - 1; i++) {
16270
- axis = $("<div class='ui-column-width-handle'>");
16271
 
16272
- currentPercent += this.fractions[i].valueOf() * 100;
16273
- axis
16274
- .data('i', i)
16275
- .data('percent', currentPercent)
16276
- .appendTo(this.element)
16277
- .on('mousedown', $.proxy(this._mouseDown, this));
16278
- }
16279
 
16280
- this.handles = this.element.find('> .ui-column-width-handle');
 
 
 
 
16281
 
16282
- this.handles.addClass('n2-unselectable');
 
16283
 
16284
- this._resize();
16285
  };
16286
 
16287
- nUIColumns.prototype._resize = function () {
16288
- if (this.active) {
16289
- this.paddingLeft = parseInt(this.element.css('paddingLeft'));
16290
- this.paddingRight = parseInt(this.element.css('paddingRight'));
16291
 
16292
- var containerWidth = this.element.width();
 
 
 
 
 
16293
 
16294
- this.outerWidth = containerWidth + this.paddingLeft + this.paddingRight;
16295
- this.innerWidth = containerWidth - this.handles.length * this.options.gutter;
16296
 
16297
- for (var i = 0; i < this.handles.length; i++) {
16298
- var currentPercent = this.handles.eq(i).data('percent');
16299
- this._updateResizer(i, currentPercent);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16300
  }
16301
  } else {
16302
- this.invalidated = true;
 
 
16303
  }
16304
- };
16305
 
16306
- nUIColumns.prototype._updateResizer = function (i, currentPercent) {
16307
- this.handles.eq(i).css({
16308
- left: currentPercent + '%',
16309
- marginLeft: -2 + this.paddingLeft + (i + 0.5) * this.options.gutter + (this.innerWidth - this.outerWidth) * currentPercent / 100
16310
- })
16311
  };
16312
 
16313
- nUIColumns.prototype._removeHandles = function () {
16314
- this.handles.remove();
16315
  };
16316
 
16317
- nUIColumns.prototype.setOption = function (key, value) {
16318
- N2Classes.nUIWidgetBase.prototype.setOption.apply(this, arguments);
 
 
 
 
 
 
 
 
 
 
 
 
 
16319
 
16320
- switch (key) {
16321
- case "active":
16322
- this.active = value;
16323
- if (this.active) {
16324
- this.create();
16325
- if (this.invalidated) {
16326
- this._resize();
16327
  }
16328
  }
16329
- break;
16330
- case "columns":
16331
- if (this.created) {
16332
- this._removeHandles();
16333
- this._setupHandles();
16334
- }
16335
- break;
16336
- case "gutter":
16337
- this._resize();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16338
  break;
16339
  }
 
16340
  };
16341
 
16342
- nUIColumns.prototype._mouseCapture = function (event) {
16343
- var i, handle,
16344
- capture = false;
16345
 
16346
- for (i = 0; i < this.handles.length; i++) {
16347
- handle = this.handles[i];
16348
- if (handle === event.target) {
16349
- capture = true;
16350
- }
16351
- }
16352
 
16353
- return !this.options.disabled && capture;
 
 
 
 
16354
  };
16355
 
16356
- nUIColumns.prototype._mouseStart = function (event) {
16357
- var index = $(event.target).data('i'),
16358
- cLeft = this.element.offset().left + 10,
16359
- containerWidth = this.element.width() - 20;
16360
 
16361
- this.resizeContext = {
16362
- index: index,
16363
- cLeft: cLeft,
16364
- containerWidth: containerWidth,
16365
- startX: Math.max(0, Math.min(event.clientX - cLeft, containerWidth)),
16366
- };
16367
 
16368
- this.currentFractions = [];
16369
- this.currentPercent = [];
16370
- for (var i = 0; i < this.fractions.length; i++) {
16371
- this.currentFractions.push(this.fractions[i].clone());
16372
- this.currentPercent.push(this.fractions[i].valueOf());
16373
- }
 
 
 
16374
 
16375
- this.resizing = true;
 
 
16376
 
16377
- $("body").css("cursor", "ew-resize");
16378
 
16379
- this.element.addClass("ui-column-width-resizing");
16380
- this._trigger("start", event, this.ui());
16381
- return true;
16382
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16383
 
16384
- nUIColumns.prototype._mouseDrag = function (event) {
16385
 
16386
- var currentX = Math.max(0, Math.min(event.clientX - this.resizeContext.cLeft, this.resizeContext.containerWidth)),
16387
- fractionDifference = new Fraction(Math.round((currentX - this.resizeContext.startX) / (this.resizeContext.containerWidth / this.currentDenominator)), this.currentDenominator);
16388
 
16389
- if (fractionDifference.compare(this.fractions[this.resizeContext.index].clone().mul(-1)) < 0) {
16390
- fractionDifference = this.fractions[this.resizeContext.index].clone().mul(-1);
16391
  }
16392
- if (fractionDifference.compare(this.fractions[this.resizeContext.index + 1]) > 0) {
16393
- fractionDifference = this.fractions[this.resizeContext.index + 1].clone();
16394
  }
16395
-
16396
- this.currentFractions[this.resizeContext.index] = this.fractions[this.resizeContext.index].add(fractionDifference);
16397
- this.currentFractions[this.resizeContext.index + 1] = this.fractions[this.resizeContext.index + 1].sub(fractionDifference);
16398
-
16399
- var currentPercent = 0;
16400
- this.currentPercent = [];
16401
- for (var i = 0; i < this.currentFractions.length; i++) {
16402
- var width = this.currentFractions[i].valueOf();
16403
- this.currentPercent.push(width);
16404
- currentPercent += width * 100;
16405
- this._updateResizer(i, currentPercent);
16406
  }
16407
 
16408
- this._trigger("colwidth", event, this.ui());
16409
- };
16410
-
16411
- nUIColumns.prototype._mouseStop = function (event) {
16412
-
16413
- this.resizing = false;
16414
-
16415
- $("body").css("cursor", "auto");
16416
-
16417
- this._trigger("stop", event, this.ui());
16418
-
16419
- this.fractions = this.currentFractions;
16420
-
16421
- nextend.preventMouseUp();
16422
- return false;
16423
- };
16424
-
16425
- nUIColumns.prototype.ui = function () {
16426
- return {
16427
- element: this.element,
16428
- originalFractions: this.fractions,
16429
- currentFractions: this.currentFractions,
16430
- currentPercent: this.currentPercent,
16431
- index: this.resizeContext.index
16432
  };
16433
- };
16434
 
16435
- N2Classes.nUIWidgetBase.register('nUIColumns');
 
 
 
 
 
16436
 
16437
- return nUIColumns;
16438
- });
16439
- N2D('nUILayerListItem', ['nUIMouse'], function ($, undefined) {
16440
- "use strict";
 
 
 
 
 
 
 
 
 
 
 
 
 
16441
 
16442
- /**
16443
- * @memberOf N2Classes
16444
- *
16445
- * @class
16446
- * @constructor
16447
- * @augments nUIMouse
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16448
 
16449
- * @this nUILayerListItem
16450
- */
16451
- function nUILayerListItem(element, options) {
16452
- this.element = $(element);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16453
 
16454
- this.widgetName = this.widgetName || 'nUILayerListItem';
16455
- this.widgetEventPrefix = "layerListItem";
16456
 
16457
- this.options = $.extend({
16458
- UIManager: null,
16459
- layer: false,
16460
- $layer: null,
16461
- distance: 2
16462
- }, this.options, options);
16463
 
16464
- N2Classes.nUIMouse.prototype.constructor.apply(this, arguments);
 
16465
 
16466
- this.create();
16467
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16468
 
16469
- nUILayerListItem.prototype = Object.create(N2Classes.nUIMouse.prototype);
16470
- nUILayerListItem.prototype.constructor = nUILayerListItem;
 
16471
 
16472
- nUILayerListItem.prototype.create = function () {
16473
 
16474
- this._mouseInit();
 
16475
  };
16476
 
16477
- nUILayerListItem.prototype._mouseCapture = function (event, overrideHandle) {
16478
- return this.options.UIManager._mouseCapture(this.options, event, overrideHandle);
16479
- };
16480
 
16481
- nUILayerListItem.prototype._mouseStart = function (event, overrideHandle, noActivation) {
16482
- this._trigger('start');
16483
- return this.options.UIManager._mouseStart(this.options, event, overrideHandle, noActivation);
16484
- };
16485
 
16486
- nUILayerListItem.prototype._mouseDrag = function (event) {
16487
- return this.options.UIManager._mouseDrag(this.options, event);
16488
  };
16489
 
16490
- nUILayerListItem.prototype._mouseStop = function (event, noPropagation) {
16491
- return this.options.UIManager._mouseStop(this.options, event, noPropagation);
 
16492
 
16493
- };
 
16494
 
16495
- nUILayerListItem.prototype._destroy = function () {
16496
- this._mouseDestroy();
16497
- return this;
16498
- };
 
16499
 
16500
- N2Classes.nUIWidgetBase.register('nUILayerListItem');
16501
 
16502
- return nUILayerListItem;
16503
- });
16504
- N2D('nUILayerList', ['nUIWidgetBase'], function ($, undefined) {
16505
- "use strict";
 
16506
 
16507
- /**
16508
- * @memberOf N2Classes
16509
- *
16510
- * @class
16511
- * @constructor
16512
- * @augments nUIWidgetBase
16513
 
16514
- * @this nUILayerList
16515
- */
16516
- function nUILayerList(element, options) {
16517
- this.element = $(element);
 
 
 
 
 
 
 
 
16518
 
16519
- this.widgetName = this.widgetName || 'nUILayerList';
16520
- this.widgetEventPrefix = "layerList";
 
 
 
 
 
 
 
 
16521
 
16522
- this.options = $.extend({
16523
- $fixed: null,
16524
- $scrolled: null
16525
- }, this.options, options);
16526
 
16527
- N2Classes.nUIWidgetBase.prototype.constructor.apply(this, arguments);
 
16528
 
16529
- this.create();
16530
- }
 
16531
 
16532
- nUILayerList.prototype = Object.create(N2Classes.nUIWidgetBase.prototype);
16533
- nUILayerList.prototype.constructor = nUILayerList;
 
 
 
 
 
16534
 
16535
- nUILayerList.prototype.create = function () {
16536
 
16537
- this.scrollTimeout = null;
16538
- };
 
 
 
 
16539
 
 
 
 
 
16540
 
16541
- nUILayerList.prototype._mouseCapture = function (itemOptions, event, overrideHandle) {
16542
- return true;
 
16543
  };
16544
 
16545
- nUILayerList.prototype._mouseStart = function (itemOptions, event, overrideHandle, noActivation) {
16546
-
16547
- this.scrolledTop = this.options.$scrolled.offset().top;
16548
- this.scrolledHeight = this.options.$scrolled.height();
16549
- this.scrolledScroll = this.options.$scrolled.scrollTop();
16550
- this.scrolledMaxHeight = this.options.$scrolled[0].scrollHeight - this.scrolledHeight;
16551
 
16552
- $('body').addClass('n2-ss-layer-list-move-layer');
 
 
16553
 
16554
- this.context = {
16555
- placeholder: $('<div class="nextend-sortable-placeholder"><div></div></div>'),
16556
- mouse: {
16557
- y: event.pageY,
16558
- topModifier: itemOptions.$item.offset().top - event.pageY
16559
- },
16560
- $item: itemOptions.$item,
16561
- $clone: itemOptions.$item.clone()
16562
  };
16563
 
16564
- this.context.$clone.addClass('n2-ss-ll-dragging').appendTo(this.options.$scrolled.find('> ul'));
16565
-
16566
- this.context.droppables = this.options.mainContainer.getLLDroppables(itemOptions.layer);
16567
-
16568
- this._cacheContainers();
16569
-
16570
- this._trigger("start", event);
16571
-
16572
- this._mouseDrag(itemOptions, event);
16573
- };
16574
-
16575
- nUILayerList.prototype._scrollUp = function () {
16576
- if (this.scrolledTop > 0) {
16577
- if (this.scrollTimeout === null) {
16578
- this.scrollTimeout = setInterval($.proxy(function () {
16579
- this.scrolledScroll -= 30;
16580
- this.options.$scrolled.scrollTop(this.scrolledScroll);
16581
- }, this), 100);
16582
- this.scrolledScroll -= 30;
16583
- this.options.$scrolled.scrollTop(this.scrolledScroll);
16584
- }
16585
- }
16586
- };
16587
 
16588
- nUILayerList.prototype._scrollDown = function () {
16589
- if (this.scrollTimeout === null) {
16590
- this.scrollTimeout = setInterval($.proxy(function () {
16591
- this.scrolledScroll += 30;
16592
- this.options.$scrolled.scrollTop(Math.min(this.scrolledScroll, this.scrolledMaxHeight));
16593
- }, this), 100);
16594
- this.scrolledScroll += 30;
16595
- this.options.$scrolled.scrollTop(Math.min(this.scrolledScroll, this.scrolledMaxHeight));
16596
- }
16597
- };
16598
 
16599
- nUILayerList.prototype._mouseDrag = function (itemOptions, event) {
 
 
 
 
 
16600
 
16601
- this.scrolledTop = this.options.$scrolled.offset().top;
 
16602
 
16603
- if (this.scrolledHeight > 60) {
16604
- if (event.pageY < this.scrolledTop + 30) {
16605
- this._scrollUp();
16606
- } else if (event.pageY > this.scrolledTop + this.scrolledHeight - 30) {
16607
- this._scrollDown();
16608
- } else {
16609
- clearInterval(this.scrollTimeout);
16610
- this.scrollTimeout = null;
16611
- }
16612
  }
16613
 
16614
 
16615
- this.scrolledScroll = this.options.$scrolled.scrollTop();
 
 
16616
 
16617
- var y = event.pageY - this.scrolledTop + this.scrolledScroll;
 
16618
 
16619
- var targetContainer = this._findInnerContainer(y);
16620
- if (targetContainer === false) {
16621
- targetContainer = this.context.droppables[0];
16622
- }
 
 
 
16623
 
16624
- if (typeof targetContainer.layers === "undefined") {
16625
- targetContainer.layers = this._cacheContainerLayers(targetContainer);
16626
- }
16627
 
16628
- var targetIndex = this._findNormalIndex(y, targetContainer);
 
 
16629
 
16630
- if (targetIndex > 0) {
16631
- this.context.placeholder.insertAfter(targetContainer.layers[targetIndex - 1].layer.layerRow);
 
 
 
 
 
 
 
 
 
 
16632
  } else {
16633
- this.context.placeholder.prependTo(targetContainer.$container);
 
16634
  }
16635
-
16636
- this.context.targetIndex = targetIndex;
16637
- if (this.context.targetContainer && this.context.targetContainer != targetContainer) {
16638
- this.context.targetContainer.layer.layerRow.removeClass('n2-ss-ll-dragging-parent');
 
 
16639
  }
 
16640
 
16641
- this.context.targetContainer = targetContainer;
16642
- this.context.targetContainer.layer.layerRow.addClass('n2-ss-ll-dragging-parent');
16643
-
16644
- this.context.$clone.css({
16645
- top: y + this.context.mouse.topModifier
16646
- });
16647
 
 
 
 
 
16648
  };
16649
 
16650
- nUILayerList.prototype._mouseStop = function (itemOptions, event, noPropagation) {
 
 
 
 
 
 
16651
 
16652
- if (this.scrollTimeout !== null) {
16653
- clearInterval(this.scrollTimeout);
16654
- this.scrollTimeout = null;
16655
- }
16656
 
16657
- this.context.placeholder.remove();
 
16658
 
16659
- this.context.$clone.remove();
 
 
16660
 
16661
- this.context.targetContainer.layer.layerRow.removeClass('n2-ss-ll-dragging-parent');
 
 
16662
 
16663
- var targetIndex = this.context.targetIndex,
16664
- targetContainer = this.context.targetContainer,
16665
- originalIndex = itemOptions.layer.getIndex(),
16666
- newIndex = -1;
16667
 
 
16668
 
16669
- if (this.context.targetContainer.layers.length === 0) {
16670
- newIndex = 0;
16671
  } else {
16672
- var nextLayer = false,
16673
- prevLayer = false;
16674
-
16675
- if (this.context.targetContainer.layers[targetIndex]) {
16676
- nextLayer = this.context.targetContainer.layers[targetIndex].layer;
16677
- }
16678
 
16679
- if (this.context.targetContainer.layers[targetIndex - 1]) {
16680
- prevLayer = this.context.targetContainer.layers[targetIndex - 1].layer;
16681
- }
16682
 
16683
- if (nextLayer === itemOptions.layer || prevLayer === itemOptions.layer) {
16684
- newIndex = -1;
16685
- } else {
16686
- if (targetContainer.layer.container.allowedPlacementMode === 'absolute') {
16687
- if (nextLayer) {
16688
- //itemOptions.layer.layer.detach();
16689
- newIndex = nextLayer.getIndex() + 1;
16690
- } else if (prevLayer) {
16691
- //itemOptions.layer.layer.detach();
16692
- newIndex = prevLayer.getIndex();
16693
- }
16694
- } else {
16695
- if (prevLayer) {
16696
- //itemOptions.layer.layer.detach();
16697
- newIndex = prevLayer.getIndex() + 1;
16698
- } else if (nextLayer) {
16699
- //itemOptions.layer.layer.detach();
16700
- newIndex = nextLayer.getIndex();
16701
- }
16702
- }
16703
- }
16704
  }
16705
- if (newIndex >= 0) {
16706
- if (newIndex > originalIndex) {
16707
- newIndex--;
16708
- }
16709
- if (itemOptions.layer.type === 'col') {
16710
- targetContainer.layer.moveCol(originalIndex, newIndex);
16711
- } else {
16712
- targetContainer.layer.container.insertLayerAt(itemOptions.layer, newIndex);
16713
- itemOptions.layer.onCanvasUpdate(originalIndex, targetContainer.layer, newIndex);
16714
- }
16715
  }
 
 
16716
 
16717
- delete this.context;
 
 
 
 
 
 
16718
 
16719
- this._trigger("stop", event);
 
 
 
16720
 
 
 
 
 
 
 
 
 
 
16721
 
16722
- $('body').removeClass('n2-ss-layer-list-move-layer');
16723
- };
16724
 
16725
- nUILayerList.prototype.cancel = function (itemOptions) {
 
 
 
 
 
 
16726
  };
16727
 
16728
- nUILayerList.prototype._cacheContainers = function () {
16729
- for (var i = 0; i < this.context.droppables.length; i++) {
16730
- var obj = this.context.droppables[i];
16731
- obj.top = obj.$container.offset().top - this.scrolledTop + this.scrolledScroll - 15;
16732
- obj.height = obj.$container.outerHeight();
16733
- obj.bottom = obj.top + obj.height + 15;
16734
- }
16735
  };
16736
 
16737
- nUILayerList.prototype._findInnerContainer = function (y) {
16738
- for (var i = this.context.droppables.length - 1; i >= 0; i--) {
16739
- var obj = this.context.droppables[i];
16740
- if (obj.top <= y && obj.bottom >= y) {
16741
- return obj;
16742
- }
16743
- }
16744
- return false;
16745
  };
16746
 
16747
- nUILayerList.prototype._cacheContainerLayers = function (droppable) {
16748
- var layerObjects = [],
16749
- layers = droppable.layer.container.getSortedLayers();
16750
-
16751
- for (var i = 0; i < layers.length; i++) {
16752
- //if (layers[i].layerRow[0] === this.context.$item[0]) continue;
16753
- var obj = {
16754
- layer: layers[i]
16755
- };
16756
- obj.top = obj.layer.layerRow.offset().top - this.scrolledTop + this.scrolledScroll;
16757
- obj.height = obj.layer.layerRow.outerHeight();
16758
- obj.bottom = obj.top + obj.height / 2;
16759
- obj.index = i;
16760
- layerObjects.push(obj);
16761
- }
16762
 
16763
- if (droppable.layer.container.allowedPlacementMode == 'absolute') {
16764
- layerObjects.reverse();
 
16765
  }
16766
-
16767
- return layerObjects;
16768
  };
16769
 
16770
- nUILayerList.prototype._findNormalIndex = function (y, targetContainer) {
16771
- for (var i = 0; i < targetContainer.layers.length; i++) {
16772
- var obj = targetContainer.layers[i];
16773
- if (y <= obj.bottom) {
16774
- return i;
16775
- }
16776
  }
16777
- return targetContainer.layers.length;
16778
  };
16779
 
16780
- N2Classes.nUIWidgetBase.register('nUILayerList');
16781
-
16782
- return nUILayerList;
16783
- });
16784
  N2D('ItemButton', ['Item'], function ($, undefined) {
16785
  "use strict";
16786
 
@@ -17258,7 +17277,9 @@ N2D('ItemVimeo', ['Item'], function ($, undefined) {
17258
  N2Classes.AjaxHelper.getJSON('https://vimeo.com/api/v2/video/' + encodeURI(videoCode) + '.json').done($.proxy(function (data) {
17259
  $('#item_vimeoimage').val(data[0].thumbnail_large).trigger('change');
17260
  }, this)).fail(function (data) {
17261
- N2Classes.Notification.error('Video not found or private.');
 
 
17262
  });
17263
  } else {
17264
  N2Classes.Notification.error('The provided URL does not match any known Vimeo url or code.');
89
  };
90
  /**
91
  *
92
+ * @type {N2Classes.SmartSliderResponsive[]}
93
  */
94
  this.responsives = [];
95
 
242
 
243
  this.zoom.nUISlider("option", 'value', v);
244
  }
245
+
246
+ $(window).trigger('resize');
247
  }
248
  };
249
 
3270
  *
3271
  * @param {N2Classes.FrontendSliderSlide} slide
3272
  * @param {jQuery} element
3273
+ * @param {N2Classes.SmartSliderBackgrounds} manager
3274
  * @constructor
3275
  */
3276
  function SmartSliderSlideBackgroundAdmin(slide, element, manager) {
3393
  if (this.elements.image) {
3394
  this.elements.image.setDesktopSrc(image);
3395
  } else if (image !== '') {
3396
+ if (image.toLowerCase().match(/\.(png|jpg|jpeg|gif|webp|svg)$/) === null) {
3397
+ N2Classes.Notification.error('The background image format is not correct! The supported image formats are: png, jpg, jpeg, gif, webp, svg.');
3398
+ } else if (this.editor.settings.getType() === 'image') {
3399
  this.createImageElement(image);
3400
  }
3401
  }
3521
  * @param {string} slideContentElementID
3522
  * @param {object} options
3523
  * @constructor
3524
+ * @augments {N2Classes.EditorAbstract}
3525
  */
3526
  function EditorSlide(sliderElementID, slideContentElementID, options) {
3527
 
3543
  this.slideStartValue = this.$slideContentElement.val();
3544
 
3545
  N2R('#' + this.sliderElementID, $.proxy(function ($, slider) {
3546
+ /** @type {N2Classes.SmartSliderAbstract} */
3547
  this.frontend = slider;
3548
  this.frontend.editor = this;
3549
  nextend.pre = 'div#' + this.frontend.elementID + ' ';
3961
  };
3962
 
3963
  /**
3964
+ * @returns {N2Classes.FrontendSliderSlide}
3965
  */
3966
  EditorSlide.prototype.getFrontendSlide = function () {
3967
  return this.editedInstance;
3991
  /**
3992
  * @memberOf N2Classes
3993
  *
3994
+ * @param {N2Classes.EditorAbstract} editor
3995
  * @constructor
3996
  */
3997
  function Generator(editor) {
3998
 
3999
  /**
4000
+ * @type {N2Classes.EditorAbstract}
4001
  */
4002
  this.editor = editor;
4003
  this._refreshTimeout = null;
4499
 
4500
  return Generator;
4501
  });
4502
+ N2D('Historical', function ($, undefined) {
4503
+ "use strict";
4504
+
4505
+ /**
4506
+ * @memberOf N2Classes
4507
+ * @param c class
4508
+ */
4509
+ function Historical(c) {
4510
+ for (var k in Historical.prototype) {
4511
+ c.prototype[k] = Historical.prototype[k];
4512
+ }
4513
+ }
4514
+
4515
+ /**
4516
+ * @param {N2Classes.Historical} self
4517
+ */
4518
+ Historical.prototype.setSelf = function (self) {
4519
+ if (self === undefined) {
4520
+ console.error(self);
4521
+ }
4522
+ if (this.self !== undefined && this.self !== this) {
4523
+ this.self.setSelf(self);
4524
+ }
4525
+ /**
4526
+ * @type {N2Classes.Historical}
4527
+ */
4528
+ this.self = self;
4529
+
4530
+ this.onSelfChange();
4531
+ };
4532
+
4533
+ /**
4534
+ * @returns {N2Classes.Historical}
4535
+ */
4536
+ Historical.prototype.getSelf = function () {
4537
+ if (this.self === undefined) {
4538
+ this.self = this;
4539
+ } else if (this.self !== this) {
4540
+ this.self = this.self.getSelf();
4541
+ }
4542
+ return this.self;
4543
+ };
4544
+
4545
+ Historical.prototype.onSelfChange = function () {
4546
+
4547
+ };
4548
+
4549
+ return Historical;
4550
+ });
4551
  N2D('History', function ($, undefined) {
4552
  "use strict";
4553
 
4588
  }
4589
 
4590
  /**
4591
+ * @returns {N2Classes.History}
4592
  */
4593
  History.get = function () {
4594
  var history = new History();
4595
  /**
4596
+ * @returns {N2Classes.History}
4597
  */
4598
  History.get = function () {
4599
  return history;
4984
  /**
4985
  * @memberOf N2Classes
4986
  *
4987
+ * @param {N2Classes.EditorSlide} editor
4988
  * @param {boolean} isStatic
4989
  * @constructor
4990
  */
4991
  function SlideSettings(editor, isStatic) {
4992
 
4993
  /**
4994
+ * @type {N2Classes.EditorSlide}
4995
  */
4996
  this.editor = editor;
4997
  this.isStatic = isStatic;
5514
  break;
5515
  }
5516
  }
5517
+ /** @type {N2Classes.ComponentAbstract} */
5518
  var component;
5519
  switch (type) {
5520
  case 'layer':
6035
  };
6036
 
6037
  /**
6038
+ * @param {N2Classes.LayerAdvancedProperty} advancedProperty
6039
  * @param $layer
6040
  * @param scope
6041
  */
6219
  /**
6220
  * @memberOf N2Classes
6221
  *
6222
+ * @param {N2Classes.EditorAbstract} editor
6223
  * @param jQuery $editedElement
6224
  * @param configuration
6225
  * @param options
6229
  this.mode = 'desktopPortrait';
6230
 
6231
  /**
6232
+ * @type {N2Classes.EditorAbstract}
6233
  */
6234
  this.editor = editor;
6235
  this.$editedElement = $editedElement;
6253
  this.ui = new N2Classes.CanvasUserInterface(this);
6254
 
6255
  /**
6256
+ * @type {N2Classes.MainContainer}
6257
  */
6258
  this.mainContainer = new N2Classes.MainContainer(this);
6259
 
6264
  this._initDeviceModeChange();
6265
 
6266
  /**
6267
+ * @type {N2Classes.CanvasSettings}
6268
  */
6269
  this.canvasSettings = new N2Classes.CanvasSettings(this);
6270
 
6591
  this.layerOptions.changeActiveComponentPlacement(current, nextActiveLayer.property);
6592
  }, this)
6593
  });
 
6594
  }
6595
 
6596
  this.$.trigger('activeLayerChanged');
7944
  /**
7945
  * @memberOf N2Classes
7946
  *
7947
+ * @param {N2Classes.EditorAbstract} editor
7948
  * @param stored
7949
  * @constructor
7950
  */
8156
 
8157
  /**
8158
  *
8159
+ * @param {N2Classes.Ruler} ruler
8160
  * @param {jQuery} container
8161
  * @param e
8162
  * @constructor
8266
  /**
8267
  * @memberOf N2Classes
8268
  *
8269
+ * @param {N2Classes.FragmentEditor} fragmentEditor
8270
  * @constructor
8271
  */
8272
  function CanvasSettings(fragmentEditor) {
8273
 
8274
  /**
8275
+ * @type {N2Classes.FragmentEditor}
8276
  */
8277
  this.fragmentEditor = fragmentEditor;
8278
 
8376
 
8377
  return CanvasSettings;
8378
  });
8379
+ N2D('nUICanvasItem', ['nUIMouse'], function ($, undefined) {
8380
  "use strict";
8381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8382
  /**
8383
  * @memberOf N2Classes
8384
  *
8385
+ * @class
 
 
8386
  * @constructor
8387
+ * @augments nUIMouse
8388
+
8389
+ * @this nUICanvasItem
8390
  */
8391
+ function nUICanvasItem(element, options) {
8392
+ this.element = $(element);
8393
 
8394
+ this.widgetName = this.widgetName || 'nUICanvasItem';
8395
+ this.widgetEventPrefix = "canvasItem";
8396
 
8397
+ this.options = $.extend({
8398
+ canvasUIManager: null,
8399
+ layer: false,
8400
+ $layer: null,
8401
+ distance: 2,
8402
+ onCreate: function () {
8403
 
8404
+ }
8405
+ }, this.options, options);
8406
 
8407
+ N2Classes.nUIMouse.prototype.constructor.apply(this, arguments);
8408
 
8409
+ this.create();
8410
  }
8411
 
8412
+ nUICanvasItem.prototype = Object.create(N2Classes.nUIMouse.prototype);
8413
+ nUICanvasItem.prototype.constructor = nUICanvasItem;
8414
 
8415
+ nUICanvasItem.prototype.create = function () {
 
 
 
8416
 
8417
+ if (typeof this.options.$layer === 'function') {
8418
+ this.options.$layer = this.options.$layer.call(this, this);
 
 
 
 
8419
  }
 
8420
 
8421
+ this._mouseInit();
8422
+ };
8423
+ nUICanvasItem.prototype._mouseCapture = function (event, overrideHandle) {
8424
+ return this.options.canvasUIManager._mouseCapture(this.options, event, overrideHandle);
 
 
 
 
 
 
 
 
 
 
 
8425
  };
8426
 
8427
+ nUICanvasItem.prototype._mouseStart = function (event, overrideHandle, noActivation) {
8428
+ this._trigger('start');
8429
+ return this.options.canvasUIManager._mouseStart(this.options, event, overrideHandle, noActivation);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8430
  };
8431
 
8432
+ nUICanvasItem.prototype._mouseDrag = function (event) {
8433
+ return this.options.canvasUIManager._mouseDrag(this.options, event);
8434
+ };
8435
 
8436
+ nUICanvasItem.prototype._mouseStop = function (event, noPropagation) {
8437
+ return this.options.canvasUIManager._mouseStop(this.options, event, noPropagation);
8438
 
 
 
8439
  };
8440
 
8441
+ nUICanvasItem.prototype._destroy = function () {
8442
+ this._mouseDestroy();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8443
 
8444
+ return this;
 
 
 
 
 
 
 
 
 
 
 
 
 
8445
  };
8446
 
8447
+ N2Classes.nUIWidgetBase.register('nUICanvasItem');
 
 
 
 
 
 
8448
 
8449
+ return nUICanvasItem;
8450
+ });
8451
+ N2D('nUICanvas', ['nUIWidgetBase'], function ($, undefined) {
8452
+ "use strict";
 
 
 
 
 
 
 
 
8453
 
8454
+ /**
8455
+ * @memberOf N2Classes
8456
+ *
8457
+ * @class
8458
+ * @constructor
8459
+ * @augments nUIWidgetBase
8460
 
8461
+ * @this nUICanvas
8462
+ */
8463
+ function nUICanvas(element, options) {
8464
+ this.element = $(element);
8465
 
8466
+ this.widgetName = this.widgetName || 'nUICanvas';
8467
+ this.widgetEventPrefix = "canvas";
 
8468
 
8469
+ this.options = $.extend({
8470
+ mainContainer: null,
8471
+ display: false,
8472
+ }, this.options, options);
8473
+
8474
+ N2Classes.nUIWidgetBase.prototype.constructor.apply(this, arguments);
8475
+ }
8476
 
8477
+ nUICanvas.prototype = Object.create(N2Classes.nUIWidgetBase.prototype);
8478
+ nUICanvas.prototype.constructor = nUICanvas;
8479
 
8480
+ nUICanvas.plugins = {};
8481
 
8482
+ nUICanvas.prototype._mouseCapture = function (itemOptions, event, overrideHandle) {
8483
+ return $(event.target).closest(".nui-resizable-handle, .nui-normal-sizing-handle, .nui-spacing-handle").length == 0;
8484
  };
8485
 
8486
+ nUICanvas.prototype._mouseStart = function (itemOptions, event, overrideHandle, noActivation) {
 
8487
 
8488
+ $('body').addClass('n2-ss-move-layer');
 
8489
 
8490
+ this.dragDeferred = $.Deferred();
8491
+ this.options.mainContainer.fragmentEditor.layerWindow.hideWithDeferred(this.dragDeferred);
8492
 
8493
+ this.context = {
8494
+ placeholder: $('<div class="n2-ss-layer-placeholder" />'),
8495
+ mouse: {
8496
+ offset: {
8497
+ left: event.pageX,
8498
+ top: event.pageY
8499
+ }
8500
+ },
8501
+ canvas: {
8502
+ offset: this.options.mainContainer.layer.offset(),
8503
+ size: {
8504
+ width: this.options.mainContainer.layer.outerWidth(),
8505
+ height: this.options.mainContainer.layer.outerHeight()
8506
+ }
8507
+ },
8508
+ $layer: itemOptions.$layer
8509
+ };
8510
 
8511
+ var css = {
8512
+ position: 'absolute',
8513
+ right: 'auto',
8514
+ bottom: 'auto'
8515
+ };
8516
 
8517
+ if (!itemOptions.layer) {
8518
+ this.startMode = 'create';
8519
 
8520
+ this.context.layer = {
8521
+ offset: {
8522
+ left: 0,
8523
+ top: 0
8524
+ }
8525
+ };
8526
 
8527
+ itemOptions.$layer.appendTo('body');
8528
+ } else {
8529
+ this.startMode = itemOptions.layer.placement.getType();
 
8530
 
8531
+ this.context.layer = {
8532
+ offset: itemOptions.$layer.offset()
8533
+ };
 
8534
 
8535
+ this.context.originalIndex = itemOptions.layer.getIndex();
 
 
 
 
 
 
 
 
 
 
 
 
 
8536
 
8537
+ if (this.startMode == 'normal') {
8538
 
8539
+ css.width = itemOptions.$layer.width();
8540
+ //css.height = itemOptions.$layer.height();
 
 
 
 
 
8541
 
8542
+ itemOptions.$layer.appendTo(this.options.mainContainer.layer);
8543
+ }
 
 
 
 
8544
  }
 
8545
 
8546
+ itemOptions.$layer
8547
+ .addClass('n2-canvas-item-drag')
8548
+ .css(css);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8549
 
8550
+ this._cacheMargins(itemOptions.$layer);
8551
 
8552
+ this.context.size = {
8553
+ width: itemOptions.$layer.outerWidth(),
8554
+ height: itemOptions.$layer.outerHeight()
8555
+ };
 
 
 
 
 
 
8556
 
 
 
 
 
 
 
 
 
 
 
 
8557
 
8558
+ this.context.droppables = this.options.mainContainer.getDroppables(itemOptions.layer);
8559
 
8560
+ this._cacheContainers();
8561
 
8562
+ this._trigger("start", event, {
8563
+ layer: itemOptions.layer,
8564
+ mode: this.startMode
8565
+ });
8566
 
8567
+ this._mouseDrag(itemOptions, event);
8568
  };
8569
 
8570
+ nUICanvas.prototype._mouseDrag = function (itemOptions, event) {
8571
+ var position;
8572
+ if (this.startMode == 'create') {
8573
+ position = {
8574
+ top: event.pageY - this.context.canvas.offset.top - 20,
8575
+ left: event.pageX - this.context.canvas.offset.left - 20
8576
+ };
8577
+ } else {
8578
+ position = {
8579
+ top: this.context.layer.offset.top - this.context.canvas.offset.top + event.pageY - this.context.mouse.offset.top,
8580
+ left: this.context.layer.offset.left - this.context.canvas.offset.left + event.pageX - this.context.mouse.offset.left
8581
+ };
8582
  }
8583
 
8584
+ var targetContainer = this._findInnerContainer(event);
8585
+ if (targetContainer === false && this.startMode != 'create') {
8586
+ targetContainer = this.context.droppables[0];
 
 
 
 
8587
  }
8588
+ if (targetContainer) {
8589
+ if (targetContainer.placement == 'normal') {
8590
 
8591
+ if (typeof targetContainer.layers === "undefined") {
8592
+ targetContainer.layers = this._cacheContainerLayers(targetContainer);
8593
+ }
8594
 
8595
+ var targetIndex = this._findNormalIndex(event, targetContainer);
8596
+ if (targetIndex > 0) {
8597
+ this.context.placeholder.css('order', targetContainer.layers[targetIndex - 1].layer.layer.css('order'));
8598
+ this.context.placeholder.insertAfter(targetContainer.layers[targetIndex - 1].layer.layer);
8599
+ } else {
8600
+ this.context.placeholder.css('order', 0);
8601
+ this.context.placeholder.prependTo(targetContainer.$container);
8602
+ }
8603
+
8604
+ this.context.targetIndex = targetIndex;
8605
+ } else {
8606
+ this.context.placeholder.detach();
8607
+ }
8608
+ } else {
8609
+ this.context.placeholder.detach();
8610
  }
8611
 
8612
+ this.context.targetContainer = targetContainer;
8613
 
 
8614
 
8615
+ this._trigger("drag", event, {
8616
+ layer: itemOptions.layer,
8617
+ originalOffset: this.context.layer.offset,
8618
+ position: position,
8619
+ canvasOffset: this.context.canvas.offset,
8620
+ offset: {
8621
+ left: position.left + this.context.canvas.offset.left,
8622
+ top: position.top + this.context.canvas.offset.top
8623
+ }
8624
+ });
8625
 
8626
+ if (this.startMode == 'create') {
8627
+ position.left += this.context.canvas.offset.left;
8628
+ position.top += this.context.canvas.offset.top;
8629
+ }
8630
 
8631
+ itemOptions.$layer.css(position);
 
 
8632
 
8633
+ this._displayPosition(event, position);
8634
  };
 
8635
 
8636
+ nUICanvas.prototype._mouseStop = function (itemOptions, event, noPropagation) {
8637
+ this.context.placeholder.remove();
 
 
 
 
 
 
8638
 
8639
+ var targetIndex = this.context.targetIndex,
8640
+ targetContainer = this.context.targetContainer;
 
 
 
8641
 
8642
+ itemOptions.$layer
8643
+ .removeClass('n2-canvas-item-drag');
 
 
 
8644
 
8645
+ if (this.startMode == 'create') {
8646
+ if (targetContainer) {
8647
+ itemOptions.onCreate.call(this, event, itemOptions, targetContainer, targetIndex);
8648
+ }
8649
+ itemOptions.$layer.detach();
8650
 
8651
+ } else {
8652
+ if (targetContainer === undefined) {
8653
+ targetContainer = this.options.mainContainer.layer;
8654
+ }
8655
 
8656
+ if (this.startMode == 'absolute' && targetContainer.placement == 'absolute') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8657
 
8658
+ // Simple drag on the canvas on an absolute layer. Just update its position!
8659
+ var left = parseInt(itemOptions.$layer.css('left')),
8660
+ top = parseInt(itemOptions.$layer.css('top'));
8661
 
8662
+ itemOptions.$layer.css({
8663
+ position: '',
8664
+ right: '',
8665
+ bottom: '',
8666
+ });
8667
 
8668
+ itemOptions.layer.placement.current.setPosition(left, top);
 
8669
 
8670
+ } else if (targetContainer.placement == 'absolute') {
 
8671
 
8672
+ // Layer moved from a normal container to the canvas.
 
8673
 
8674
+ var left = parseInt(itemOptions.$layer.css('left')),
8675
+ top = parseInt(itemOptions.$layer.css('top'));
8676
 
8677
+ itemOptions.$layer.css({
8678
+ position: '',
8679
+ right: '',
8680
+ bottom: '',
8681
+ });
8682
 
8683
+ var width = itemOptions.$layer.width(),
8684
+ height = itemOptions.$layer.height();
8685
 
8686
+ itemOptions.layer.group.onChildCountChange();
8687
 
8688
+ var oldAbsoluteGroup = itemOptions.layer;
8689
+ while (oldAbsoluteGroup && (!oldAbsoluteGroup.placement || oldAbsoluteGroup.placement.getType() !== 'absolute')) {
8690
+ oldAbsoluteGroup = oldAbsoluteGroup.group;
8691
+ }
8692
 
8693
+ N2Classes.History.get().startBatch();
8694
+ // Set the new group, which will trigger this current placement to activate
8695
+ itemOptions.layer.changeGroup(this.context.originalIndex, this.options.mainContainer);
8696
+ N2Classes.History.get().addControl('skipForwardUndos');
8697
 
8698
+ if (itemOptions.layer.type == 'layer' && itemOptions.layer.item) {
8699
+ if (!itemOptions.layer.item.needSize) {
8700
+ height = 'auto';
8701
+ width++; //Prevent text layers to wrap line ending to new line after drag
8702
+ }
8703
+ }
8704
 
8705
+ // As this placement activated, we have to set these values from the closest absolute parent
8706
+ var targetAlign = oldAbsoluteGroup ? oldAbsoluteGroup.getProperty('align') : 'center',
8707
+ targetValign = oldAbsoluteGroup ? oldAbsoluteGroup.getProperty('valign') : 'middle';
8708
 
8709
+ itemOptions.layer.placement.current._setPosition(targetAlign, targetValign, left, top, width, height, true);
 
8710
 
8711
+ N2Classes.History.get().endBatch();
 
8712
 
8713
+ } else if (targetContainer.placement == 'normal') {
8714
+ itemOptions.$layer.css({
8715
+ position: 'relative',
8716
+ width: '',
8717
+ left: '',
8718
+ top: ''
8719
+ });
8720
 
8721
+ switch (targetContainer.layer.type) {
 
 
 
 
 
 
8722
 
8723
+ case 'content':
8724
+ case 'col':
8725
+ if (targetIndex > 0) {
8726
+ itemOptions.$layer.insertAfter(targetContainer.layers[targetIndex - 1].layer.layer);
8727
+ } else {
8728
+ itemOptions.$layer.prependTo(targetContainer.$container);
8729
+ }
8730
 
8731
+ itemOptions.layer.onCanvasUpdate(this.context.originalIndex, targetContainer.layer, targetIndex);
8732
+ break;
8733
+
8734
+ case 'row':
8735
+ var col = targetContainer.layer.createCol();
8736
+ targetContainer.layer.moveCol(col.getIndex(), targetIndex);
8737
+
8738
+ itemOptions.$layer.prependTo(col.$content);
8739
+ itemOptions.layer.onCanvasUpdate(this.context.originalIndex, col, 0);
8740
+
8741
+ break;
8742
+ }
8743
+
8744
+ //itemOptions.layer.placement.current._syncheight(); // we should sync back the height of the normal layer
 
 
 
 
 
8745
  }
8746
  }
8747
 
8748
+ delete this.context;
8749
 
8750
+ if (this.options.display) {
8751
+ this.options.display.hide();
 
 
 
 
 
 
 
 
 
8752
  }
8753
 
8754
+ this._trigger("stop", event, {
8755
+ layer: itemOptions.layer
8756
+ });
8757
 
8758
+ this.dragDeferred.resolve();
8759
 
 
 
8760
 
8761
+ $('body').removeClass('n2-ss-move-layer');
8762
+ };
 
8763
 
8764
+ nUICanvas.prototype.cancel = function (itemOptions) {
8765
+ };
8766
 
8767
+ nUICanvas.prototype._cacheContainers = function () {
8768
+ for (var i = 0; i < this.context.droppables.length; i++) {
8769
+ var obj = this.context.droppables[i];
8770
+ obj.offset = obj.$container.offset();
8771
+ obj.size = {
8772
+ width: obj.$container.outerWidth(),
8773
+ height: obj.$container.outerHeight()
8774
  };
8775
+ obj.offset.right = obj.offset.left + obj.size.width;
8776
+ obj.offset.bottom = obj.offset.top + obj.size.height;
8777
+ }
8778
+ };
 
 
 
 
 
 
 
 
 
8779
 
8780
+ nUICanvas.prototype._findInnerContainer = function (event) {
8781
+ for (var i = this.context.droppables.length - 1; i >= 0; i--) {
8782
+ var obj = this.context.droppables[i];
8783
+ if (obj.offset.left <= event.pageX && obj.offset.right >= event.pageX && obj.offset.top <= event.pageY && obj.offset.bottom >= event.pageY) {
8784
+ return obj;
 
 
 
 
8785
  }
8786
  }
8787
+ return false;
8788
+ };
8789
 
8790
+ nUICanvas.prototype._cacheContainerLayers = function (droppable) {
8791
+ var layerObjects = [],
8792
+ layers = droppable.layer.container.getSortedLayers();
8793
+
8794
+ for (var i = 0; i < layers.length; i++) {
8795
+ var obj = {
8796
+ layer: layers[i]
8797
+ };
8798
+ obj.offset = obj.layer.layer.offset();
8799
+ obj.size = {
8800
+ width: obj.layer.layer.outerWidth(),
8801
+ height: obj.layer.layer.outerHeight()
8802
+ };
8803
+ obj.offset.right = obj.offset.left + obj.size.width / 2;
8804
+ obj.offset.bottom = obj.offset.top + obj.size.height / 2;
8805
+ layerObjects.push(obj);
8806
  }
8807
 
8808
+ return layerObjects;
8809
  };
8810
 
8811
+ nUICanvas.prototype._findNormalIndex = function (event, targetContainer) {
8812
+ var index = -1;
8813
 
8814
+ switch (targetContainer.axis) {
8815
+ case 'y':
8816
+ for (var i = 0; i < targetContainer.layers.length; i++) {
8817
+ var obj = targetContainer.layers[i];
8818
+ if (event.pageY <= obj.offset.bottom) {
8819
+ index = i;
8820
+ break;
8821
+ }
8822
+ }
8823
+ break;
8824
+ case 'x':
8825
+ for (var i = 0; i < targetContainer.layers.length; i++) {
8826
+ var obj = targetContainer.layers[i];
8827
+ if (event.pageX <= obj.offset.right) {
8828
+ index = i;
8829
+ break;
8830
+ }
8831
+ }
8832
+ break;
8833
+ }
8834
 
8835
+ if (index === -1) {
8836
+ index = targetContainer.layers.length;
8837
+ }
8838
 
8839
+ return index;
8840
  };
8841
 
8842
+ nUICanvas.prototype._displayPosition = function (event, position) {
 
 
 
 
 
8843
 
8844
+ if (this.options.display) {
8845
+ if (this.context.targetContainer && this.context.targetContainer.placement == 'absolute') {
8846
+ if (this.options.display.hidden) {
8847
+ this.options.display.show();
8848
+ }
8849
+ if (this.startMode == 'create') {
8850
+ position.left -= this.context.canvas.offset.left;
8851
+ position.top -= this.context.canvas.offset.top;
8852
+ }
8853
+ this.options.display.update(event, position);
8854
+ } else {
8855
+ if (this.options.display.hidden) {
8856
+ this.options.display.hide();
8857
+ }
8858
+ }
8859
+ }
8860
  };
8861
 
8862
+ nUICanvas.prototype._trigger = function (type, event, ui) {
8863
+ ui = ui || {};
8864
 
8865
+ this.callPlugin(type, [event, ui]);
8866
 
 
 
 
8867
 
8868
+ return N2Classes.nUIWidgetBase.prototype._trigger.apply(this, arguments);
 
 
8869
  };
8870
 
8871
+ nUICanvas.prototype._cacheMargins = function (layer) {
8872
+ this.margins = {
8873
+ left: ( parseInt(layer.css("marginLeft"), 10) || 0 ),
8874
+ top: ( parseInt(layer.css("marginTop"), 10) || 0 ),
8875
+ right: ( parseInt(layer.css("marginRight"), 10) || 0 ),
8876
+ bottom: ( parseInt(layer.css("marginBottom"), 10) || 0 )
8877
+ };
 
8878
  };
 
8879
 
8880
+ N2Classes.nUIWidgetBase.register('nUICanvas');
8881
 
 
 
 
 
8882
 
8883
+ N2Classes.nUIWidgetBase.addPlugin(nUICanvas, "smartguides", {
8884
+ start: function (event, ui) {
8885
+ var inst = $(this).data("nUICanvas"), o = inst.options;
8886
 
8887
+ if (inst.startMode == 'create') return;
8888
+
8889
+ inst.gridH = $('<div class="n2-grid n2-grid-h"></div>').appendTo(o.mainContainer.layer);
8890
+ inst.gridV = $('<div class="n2-grid n2-grid-v"></div>').appendTo(o.mainContainer.layer);
8891
+ inst.elements = [];
8892
+ if (typeof o.smartguides == 'function') {
8893
+ var guides = $(o.smartguides(inst.context)).not(inst.context.$layer);
8894
+ if (guides && guides.length) {
8895
+ guides.each(function () {
8896
+ var $t = $(this);
8897
+ var $o = $t.offset();
8898
+ if (this != inst.element[0]) inst.elements.push({
8899
+ item: this,
8900
+ width: $t.outerWidth(), height: $t.outerHeight(),
8901
+ top: Math.round($o.top), left: Math.round($o.left),
8902
+ backgroundColor: ''
8903
+ });
8904
+ });
8905
  }
8906
+ var $o = o.mainContainer.layer.offset();
8907
+ inst.elements.push({
8908
+ width: o.mainContainer.layer.width(), height: o.mainContainer.layer.height(),
8909
+ top: Math.round($o.top), left: Math.round($o.left),
8910
+ backgroundColor: '#ff4aff'
8911
+ });
8912
  }
8913
+ },
 
 
8914
 
8915
+ stop: function (event, ui) {
8916
+ var inst = $(this).data("nUICanvas");
8917
 
8918
+ if (inst.startMode == 'create') return;
 
 
 
 
 
 
 
8919
 
8920
+ inst.gridH.remove();
8921
+ inst.gridV.remove();
8922
+ },
8923
 
8924
+ drag: function (event, ui) {
8925
+ var vElement = false,
8926
+ hElement = false,
8927
+ inst = $(this).data("nUICanvas"),
8928
+ o = inst.options,
8929
+ verticalTolerance = o.tolerance,
8930
+ horizontalTolerance = o.tolerance;
 
 
 
 
8931
 
8932
+ if (inst.startMode == 'create') return;
 
 
 
 
 
8933
 
8934
+ inst.gridH.css({"display": "none"});
8935
+ inst.gridV.css({"display": "none"});
8936
 
8937
+ if (inst.context.targetContainer && inst.context.targetContainer.placement == 'absolute') {
 
 
 
 
8938
 
8939
+ var container = inst.elements[inst.elements.length - 1],
8940
+ setGridV = function (left) {
8941
+ inst.gridV.css({left: Math.min(left, container.width - 1), display: "block"});
8942
+ },
8943
+ setGridH = function (top) {
8944
+ inst.gridH.css({top: Math.min(top, container.height - 1), display: "block"});
8945
+ };
 
 
 
8946
 
8947
+ var ctrlKey = event.ctrlKey || event.metaKey,
8948
+ altKey = event.altKey;
8949
+ if (ctrlKey && altKey) {
8950
+ return;
8951
+ } else if (ctrlKey) {
8952
+ vElement = true;
8953
+ } else if (altKey) {
8954
+ hElement = true;
8955
+ }
8956
+ var x1 = ui.offset.left, x2 = x1 + inst.context.size.width,
8957
+ y1 = ui.offset.top, y2 = y1 + inst.context.size.height,
8958
+ xc = (x1 + x2) / 2,
8959
+ yc = (y1 + y2) / 2;
8960
 
8961
+ if (!vElement) {
8962
+ for (var i = inst.elements.length - 1; i >= 0; i--) {
8963
+ if (verticalTolerance == 0) break;
8964
 
8965
+ var l = inst.elements[i].left,
8966
+ r = l + inst.elements[i].width,
8967
+ hc = (l + r) / 2;
8968
 
8969
+ var v = true,
8970
+ c;
8971
+ if ((c = Math.abs(l - x2)) < verticalTolerance) {
8972
+ ui.position.left = l - inst.context.size.width - inst.context.canvas.offset.left - inst.margins.left;
8973
+ setGridV(ui.position.left + inst.context.size.width);
8974
+ } else if ((c = Math.abs(l - x1)) < verticalTolerance) {
8975
+ ui.position.left = l - inst.context.canvas.offset.left - inst.margins.left;
8976
+ setGridV(ui.position.left);
8977
+ } else if ((c = Math.abs(r - x1)) < verticalTolerance) {
8978
+ ui.position.left = r - inst.context.canvas.offset.left - inst.margins.left;
8979
+ setGridV(ui.position.left);
8980
+ } else if ((c = Math.abs(r - x2)) < verticalTolerance) {
8981
+ ui.position.left = r - inst.context.size.width - inst.context.canvas.offset.left - inst.margins.left;
8982
+ setGridV(ui.position.left + inst.context.size.width);
8983
+ } else if ((c = Math.abs(hc - x2)) < verticalTolerance) {
8984
+ ui.position.left = hc - inst.context.size.width - inst.context.canvas.offset.left - inst.margins.left;
8985
+ setGridV(ui.position.left + inst.context.size.width);
8986
+ } else if ((c = Math.abs(hc - x1)) < verticalTolerance) {
8987
+ ui.position.left = hc - inst.context.canvas.offset.left - inst.margins.left;
8988
+ setGridV(ui.position.left);
8989
+ } else if ((c = Math.abs(hc - xc)) < verticalTolerance) {
8990
+ ui.position.left = hc - inst.context.size.width / 2 - inst.context.canvas.offset.left - inst.margins.left;
8991
+ setGridV(ui.position.left + inst.context.size.width / 2);
8992
+ } else {
8993
+ v = false;
8994
+ }
8995
 
8996
+ if (v) {
8997
+ vElement = inst.elements[i];
8998
+ verticalTolerance = Math.min(c, verticalTolerance);
8999
+ }
9000
+ }
9001
+ }
9002
 
9003
+ if (!hElement) {
9004
+ for (var i = inst.elements.length - 1; i >= 0; i--) {
9005
+ if (horizontalTolerance == 0) break;
9006
+
9007
+ var t = inst.elements[i].top,
9008
+ b = t + inst.elements[i].height,
9009
+ vc = (t + b) / 2;
9010
+
9011
+ var h = true,
9012
+ c;
9013
+ if ((c = Math.abs(t - y2)) < horizontalTolerance) {
9014
+ ui.position.top = t - inst.context.size.height - inst.context.canvas.offset.top - inst.margins.top;
9015
+ setGridH(ui.position.top + inst.context.size.height);
9016
+ } else if ((c = Math.abs(t - y1)) < horizontalTolerance) {
9017
+ ui.position.top = t - inst.context.canvas.offset.top - inst.margins.top;
9018
+ setGridH(ui.position.top);
9019
+ } else if ((c = Math.abs(b - y1)) < horizontalTolerance) {
9020
+ ui.position.top = b - inst.context.canvas.offset.top - inst.margins.top;
9021
+ setGridH(ui.position.top);
9022
+ } else if ((c = Math.abs(b - y2)) < horizontalTolerance) {
9023
+ ui.position.top = b - inst.context.size.height - inst.context.canvas.offset.top - inst.margins.top;
9024
+ setGridH(ui.position.top + inst.context.size.height);
9025
+ } else if ((c = Math.abs(vc - y2)) < horizontalTolerance) {
9026
+ ui.position.top = vc - inst.context.size.height - inst.context.canvas.offset.top - inst.margins.top;
9027
+ setGridH(ui.position.top + inst.context.size.height);
9028
+ } else if ((c = Math.abs(vc - y1)) < horizontalTolerance) {
9029
+ ui.position.top = vc - inst.context.canvas.offset.top - inst.margins.top;
9030
+ setGridH(ui.position.top);
9031
+ } else if ((c = Math.abs(vc - yc)) < horizontalTolerance) {
9032
+ ui.position.top = vc - inst.context.size.height / 2 - inst.context.canvas.offset.top - inst.margins.top;
9033
+ setGridH(ui.position.top + inst.context.size.height / 2);
9034
+ } else {
9035
+ h = false;
9036
+ }
9037
+
9038
+ if (h) {
9039
+ hElement = inst.elements[i];
9040
+ horizontalTolerance = Math.min(c, horizontalTolerance);
9041
+ }
9042
+ }
9043
+ }
9044
+
9045
+ if (vElement && vElement !== true) {
9046
+ inst.gridV.css('backgroundColor', vElement.backgroundColor);
9047
+ }
9048
+ if (hElement && hElement !== true) {
9049
+ inst.gridH.css('backgroundColor', hElement.backgroundColor);
9050
+ }
9051
  }
 
9052
  }
9053
+ });
9054
 
9055
+ return nUICanvas;
9056
+ });
9057
+ N2D('nUIColumns', ['nUIMouse'], function ($, undefined) {
9058
+ "use strict";
9059
 
9060
+ /**
9061
+ * @memberOf N2Classes
9062
+ *
9063
+ * @class
9064
+ * @constructor
9065
+ * @augments nUIMouse
9066
+
9067
+ * @this nUIColumns
9068
+ */
9069
+ function nUIColumns(element, options) {
9070
+ this.active = 0;
9071
+ this.created = false;
9072
+ this.invalidated = false;
9073
+
9074
+ this.element = $(element);
9075
+
9076
+ this.widgetName = this.widgetName || 'nUIColumns';
9077
+ this.widgetEventPrefix = "columns";
9078
+
9079
+ this.options = $.extend({
9080
+ columns: '1',
9081
+ gutter: 0,
9082
+ denominators: {
9083
+ 1: 100,
9084
+ 2: 100,
9085
+ 3: 144,
9086
+ 4: 100,
9087
+ 5: 100,
9088
+ 6: 144
9089
+ },
9090
+ // Callbacks
9091
+ drag: null,
9092
+ start: null,
9093
+ stop: null
9094
+ }, this.options, options);
9095
+
9096
+ N2Classes.nUIMouse.prototype.constructor.apply(this, arguments);
9097
+ }
9098
+
9099
+ nUIColumns.prototype = Object.create(N2Classes.nUIMouse.prototype);
9100
+ nUIColumns.prototype.constructor = nUIColumns;
9101
+
9102
+ nUIColumns.prototype.create = function () {
9103
+ if (!this.created) {
9104
+ this.created = true;
9105
+
9106
+ this._setupHandles();
9107
+
9108
+ $(window).on('resize', $.proxy(this._resize, this));
9109
+
9110
+ this._mouseInit();
9111
  }
9112
  };
9113
 
9114
+ nUIColumns.prototype._destroy = function () {
9115
+
9116
+ this._mouseDestroy();
9117
+ this.element
9118
+ .removeData("uiNextendColumns")
9119
+ .off(".columns")
9120
+ .find("> .ui-column-width-handle")
9121
+ .remove();
9122
+
9123
+ return this;
9124
+ };
9125
+
9126
+ nUIColumns.prototype.getDenominator = function (i) {
9127
+ if (this.options.denominators[i] === undefined) {
9128
+ this.options.denominators[i] = i * 15;
9129
  }
9130
+ return this.options.denominators[i];
9131
  };
9132
 
9133
+ nUIColumns.prototype._setupHandles = function () {
9134
+ var o = this.options, handle, i, n, axis;
9135
 
9136
+ this.fractions = [];
 
9137
 
9138
+ var columnWidths = o.columns.split('+');
9139
+ for (var i = 0; i < columnWidths.length; i++) {
9140
+ this.fractions.push(new Fraction(columnWidths[i]));
9141
  }
9142
+ this.currentDenominator = this.getDenominator(this.fractions.length);
9143
 
9144
+ var currentPercent = 0;
9145
+ for (i = 0; i < this.fractions.length - 1; i++) {
9146
+ axis = $("<div class='ui-column-width-handle'>");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9147
 
9148
+ currentPercent += this.fractions[i].valueOf() * 100;
9149
+ axis
9150
+ .data('i', i)
9151
+ .data('percent', currentPercent)
9152
+ .appendTo(this.element)
9153
+ .on('mousedown', $.proxy(this._mouseDown, this));
9154
  }
9155
 
9156
+ this.handles = this.element.find('> .ui-column-width-handle');
9157
+
9158
+ this.handles.addClass('n2-unselectable');
9159
+
9160
+ this._resize();
9161
  };
9162
 
9163
+ nUIColumns.prototype._resize = function () {
9164
+ if (this.active) {
9165
+ this.paddingLeft = parseInt(this.element.css('paddingLeft'));
9166
+ this.paddingRight = parseInt(this.element.css('paddingRight'));
9167
 
9168
+ var containerWidth = this.element.width();
 
 
 
9169
 
9170
+ this.outerWidth = containerWidth + this.paddingLeft + this.paddingRight;
9171
+ this.innerWidth = containerWidth - this.handles.length * this.options.gutter;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9172
 
9173
+ for (var i = 0; i < this.handles.length; i++) {
9174
+ var currentPercent = this.handles.eq(i).data('percent');
9175
+ this._updateResizer(i, currentPercent);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9176
  }
9177
+ } else {
9178
+ this.invalidated = true;
9179
  }
9180
+ };
9181
 
9182
+ nUIColumns.prototype._updateResizer = function (i, currentPercent) {
9183
+ this.handles.eq(i).css({
9184
+ left: currentPercent + '%',
9185
+ marginLeft: -2 + this.paddingLeft + (i + 0.5) * this.options.gutter + (this.innerWidth - this.outerWidth) * currentPercent / 100
9186
+ })
9187
  };
9188
 
9189
+ nUIColumns.prototype._removeHandles = function () {
9190
+ this.handles.remove();
9191
  };
9192
 
9193
+ nUIColumns.prototype.setOption = function (key, value) {
9194
+ N2Classes.nUIWidgetBase.prototype.setOption.apply(this, arguments);
9195
+
9196
+ switch (key) {
9197
+ case "active":
9198
+ this.active = value;
9199
+ if (this.active) {
9200
+ this.create();
9201
+ if (this.invalidated) {
9202
+ this._resize();
9203
+ }
9204
+ }
9205
+ break;
9206
+ case "columns":
9207
+ if (this.created) {
9208
+ this._removeHandles();
9209
+ this._setupHandles();
9210
+ }
9211
+ break;
9212
+ case "gutter":
9213
+ this._resize();
9214
+ break;
9215
  }
9216
  };
9217
 
9218
+ nUIColumns.prototype._mouseCapture = function (event) {
9219
+ var i, handle,
9220
+ capture = false;
 
 
 
 
9221
 
9222
+ for (i = 0; i < this.handles.length; i++) {
9223
+ handle = this.handles[i];
9224
+ if (handle === event.target) {
9225
+ capture = true;
9226
+ }
 
 
 
 
9227
  }
9228
+
9229
+ return !this.options.disabled && capture;
9230
  };
9231
 
9232
+ nUIColumns.prototype._mouseStart = function (event) {
9233
+ var index = $(event.target).data('i'),
9234
+ cLeft = this.element.offset().left + 10,
9235
+ containerWidth = this.element.width() - 20;
9236
 
9237
+ this.resizeContext = {
9238
+ index: index,
9239
+ cLeft: cLeft,
9240
+ containerWidth: containerWidth,
9241
+ startX: Math.max(0, Math.min(event.clientX - cLeft, containerWidth)),
9242
+ };
9243
 
9244
+ this.currentFractions = [];
9245
+ this.currentPercent = [];
9246
+ for (var i = 0; i < this.fractions.length; i++) {
9247
+ this.currentFractions.push(this.fractions[i].clone());
9248
+ this.currentPercent.push(this.fractions[i].valueOf());
 
 
 
 
9249
  }
 
9250
 
9251
+ this.resizing = true;
 
 
9252
 
9253
+ $("body").css("cursor", "ew-resize");
9254
+
9255
+ this.element.addClass("ui-column-width-resizing");
9256
+ this._trigger("start", event, this.ui());
9257
+ return true;
9258
  };
 
 
 
9259
 
9260
+ nUIColumns.prototype._mouseDrag = function (event) {
 
 
 
9261
 
9262
+ var currentX = Math.max(0, Math.min(event.clientX - this.resizeContext.cLeft, this.resizeContext.containerWidth)),
9263
+ fractionDifference = new Fraction(Math.round((currentX - this.resizeContext.startX) / (this.resizeContext.containerWidth / this.currentDenominator)), this.currentDenominator);
9264
 
9265
+ if (fractionDifference.compare(this.fractions[this.resizeContext.index].clone().mul(-1)) < 0) {
9266
+ fractionDifference = this.fractions[this.resizeContext.index].clone().mul(-1);
9267
+ }
9268
+ if (fractionDifference.compare(this.fractions[this.resizeContext.index + 1]) > 0) {
9269
+ fractionDifference = this.fractions[this.resizeContext.index + 1].clone();
9270
+ }
9271
 
9272
+ this.currentFractions[this.resizeContext.index] = this.fractions[this.resizeContext.index].add(fractionDifference);
9273
+ this.currentFractions[this.resizeContext.index + 1] = this.fractions[this.resizeContext.index + 1].sub(fractionDifference);
 
 
 
 
 
 
9274
 
9275
+ var currentPercent = 0;
9276
+ this.currentPercent = [];
9277
+ for (var i = 0; i < this.currentFractions.length; i++) {
9278
+ var width = this.currentFractions[i].valueOf();
9279
+ this.currentPercent.push(width);
9280
+ currentPercent += width * 100;
9281
+ this._updateResizer(i, currentPercent);
9282
  }
 
9283
 
9284
+ this._trigger("colwidth", event, this.ui());
 
9285
  };
9286
 
9287
+ nUIColumns.prototype._mouseStop = function (event) {
 
 
9288
 
9289
+ this.resizing = false;
9290
 
9291
+ $("body").css("cursor", "auto");
9292
 
9293
+ this._trigger("stop", event, this.ui());
 
 
9294
 
9295
+ this.fractions = this.currentFractions;
9296
 
9297
+ nextend.preventMouseUp();
9298
+ return false;
 
9299
  };
9300
 
9301
+ nUIColumns.prototype.ui = function () {
9302
+ return {
9303
+ element: this.element,
9304
+ originalFractions: this.fractions,
9305
+ currentFractions: this.currentFractions,
9306
+ currentPercent: this.currentPercent,
9307
+ index: this.resizeContext.index
9308
+ };
9309
  };
9310
 
9311
+ N2Classes.nUIWidgetBase.register('nUIColumns');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9312
 
9313
+ return nUIColumns;
9314
+ });
9315
+ N2D('nUILayerListItem', ['nUIMouse'], function ($, undefined) {
9316
+ "use strict";
9317
 
9318
+ /**
9319
+ * @memberOf N2Classes
9320
+ *
9321
+ * @class
9322
+ * @constructor
9323
+ * @augments nUIMouse
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9324
 
9325
+ * @this nUILayerListItem
9326
+ */
9327
+ function nUILayerListItem(element, options) {
9328
+ this.element = $(element);
 
 
 
 
 
 
 
 
9329
 
9330
+ this.widgetName = this.widgetName || 'nUILayerListItem';
9331
+ this.widgetEventPrefix = "layerListItem";
9332
 
9333
+ this.options = $.extend({
9334
+ UIManager: null,
9335
+ layer: false,
9336
+ $layer: null,
9337
+ distance: 2
9338
+ }, this.options, options);
9339
 
9340
+ N2Classes.nUIMouse.prototype.constructor.apply(this, arguments);
 
 
9341
 
9342
+ this.create();
9343
+ }
 
 
9344
 
9345
+ nUILayerListItem.prototype = Object.create(N2Classes.nUIMouse.prototype);
9346
+ nUILayerListItem.prototype.constructor = nUILayerListItem;
9347
 
9348
+ nUILayerListItem.prototype.create = function () {
 
 
 
9349
 
9350
+ this._mouseInit();
9351
+ };
9352
 
9353
+ nUILayerListItem.prototype._mouseCapture = function (event, overrideHandle) {
9354
+ return this.options.UIManager._mouseCapture(this.options, event, overrideHandle);
 
 
 
 
 
 
9355
  };
9356
 
9357
+ nUILayerListItem.prototype._mouseStart = function (event, overrideHandle, noActivation) {
9358
+ this._trigger('start');
9359
+ return this.options.UIManager._mouseStart(this.options, event, overrideHandle, noActivation);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9360
  };
9361
 
9362
+ nUILayerListItem.prototype._mouseDrag = function (event) {
9363
+ return this.options.UIManager._mouseDrag(this.options, event);
 
 
 
9364
  };
9365
 
9366
+ nUILayerListItem.prototype._mouseStop = function (event, noPropagation) {
9367
+ return this.options.UIManager._mouseStop(this.options, event, noPropagation);
9368
 
 
 
 
 
 
9369
  };
9370
 
9371
+ nUILayerListItem.prototype._destroy = function () {
9372
+ this._mouseDestroy();
9373
+ return this;
9374
  };
9375
 
9376
+ N2Classes.nUIWidgetBase.register('nUILayerListItem');
 
 
 
9377
 
9378
+ return nUILayerListItem;
9379
+ });
9380
+ N2D('nUILayerList', ['nUIWidgetBase'], function ($, undefined) {
9381
+ "use strict";
9382
 
9383
+ /**
9384
+ * @memberOf N2Classes
9385
+ *
9386
+ * @class
9387
+ * @constructor
9388
+ * @augments nUIWidgetBase
9389
 
9390
+ * @this nUILayerList
9391
+ */
9392
+ function nUILayerList(element, options) {
9393
+ this.element = $(element);
9394
 
9395
+ this.widgetName = this.widgetName || 'nUILayerList';
9396
+ this.widgetEventPrefix = "layerList";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9397
 
9398
+ this.options = $.extend({
9399
+ $fixed: null,
9400
+ $scrolled: null
9401
+ }, this.options, options);
9402
 
9403
+ N2Classes.nUIWidgetBase.prototype.constructor.apply(this, arguments);
9404
 
9405
+ this.create();
9406
+ }
9407
 
9408
+ nUILayerList.prototype = Object.create(N2Classes.nUIWidgetBase.prototype);
9409
+ nUILayerList.prototype.constructor = nUILayerList;
 
 
9410
 
9411
+ nUILayerList.prototype.create = function () {
9412
 
9413
+ this.scrollTimeout = null;
9414
  };
9415
 
 
 
 
 
 
 
 
9416
 
9417
+ nUILayerList.prototype._mouseCapture = function (itemOptions, event, overrideHandle) {
9418
+ return true;
9419
  };
9420
 
9421
+ nUILayerList.prototype._mouseStart = function (itemOptions, event, overrideHandle, noActivation) {
 
 
 
9422
 
9423
+ this.scrolledTop = this.options.$scrolled.offset().top;
9424
+ this.scrolledHeight = this.options.$scrolled.height();
9425
+ this.scrolledScroll = this.options.$scrolled.scrollTop();
9426
+ this.scrolledMaxHeight = this.options.$scrolled[0].scrollHeight - this.scrolledHeight;
 
 
 
 
 
 
9427
 
9428
+ $('body').addClass('n2-ss-layer-list-move-layer');
 
9429
 
9430
+ this.context = {
9431
+ placeholder: $('<div class="nextend-sortable-placeholder"><div></div></div>'),
9432
+ mouse: {
9433
+ y: event.pageY,
9434
+ topModifier: itemOptions.$item.offset().top - event.pageY
9435
+ },
9436
+ $item: itemOptions.$item,
9437
+ $clone: itemOptions.$item.clone()
9438
+ };
9439
 
9440
+ this.context.$clone.addClass('n2-ss-ll-dragging').appendTo(this.options.$scrolled.find('> ul'));
 
 
 
9441
 
9442
+ this.context.droppables = this.options.mainContainer.getLLDroppables(itemOptions.layer);
 
 
 
 
 
 
 
 
 
9443
 
9444
+ this._cacheContainers();
 
9445
 
9446
+ this._trigger("start", event);
 
9447
 
9448
+ this._mouseDrag(itemOptions, event);
 
9449
  };
9450
 
9451
+ nUILayerList.prototype._scrollUp = function () {
9452
+ if (this.scrolledTop > 0) {
9453
+ if (this.scrollTimeout === null) {
9454
+ this.scrollTimeout = setInterval($.proxy(function () {
9455
+ this.scrolledScroll -= 30;
9456
+ this.options.$scrolled.scrollTop(this.scrolledScroll);
9457
+ }, this), 100);
9458
+ this.scrolledScroll -= 30;
9459
+ this.options.$scrolled.scrollTop(this.scrolledScroll);
9460
+ }
9461
+ }
9462
  };
9463
 
9464
+ nUILayerList.prototype._scrollDown = function () {
9465
+ if (this.scrollTimeout === null) {
9466
+ this.scrollTimeout = setInterval($.proxy(function () {
9467
+ this.scrolledScroll += 30;
9468
+ this.options.$scrolled.scrollTop(Math.min(this.scrolledScroll, this.scrolledMaxHeight));
9469
+ }, this), 100);
9470
+ this.scrolledScroll += 30;
9471
+ this.options.$scrolled.scrollTop(Math.min(this.scrolledScroll, this.scrolledMaxHeight));
9472
+ }
9473
  };
9474
 
9475
+ nUILayerList.prototype._mouseDrag = function (itemOptions, event) {
 
 
 
 
 
 
 
 
 
 
 
 
9476
 
9477
+ this.scrolledTop = this.options.$scrolled.offset().top;
9478
 
9479
+ if (this.scrolledHeight > 60) {
9480
+ if (event.pageY < this.scrolledTop + 30) {
9481
+ this._scrollUp();
9482
+ } else if (event.pageY > this.scrolledTop + this.scrolledHeight - 30) {
9483
+ this._scrollDown();
9484
+ } else {
9485
+ clearInterval(this.scrollTimeout);
9486
+ this.scrollTimeout = null;
9487
+ }
9488
+ }
9489
 
 
 
 
 
9490
 
9491
+ this.scrolledScroll = this.options.$scrolled.scrollTop();
 
 
 
 
 
 
 
9492
 
9493
+ var y = event.pageY - this.scrolledTop + this.scrolledScroll;
 
 
9494
 
9495
+ var targetContainer = this._findInnerContainer(y);
9496
+ if (targetContainer === false) {
9497
+ targetContainer = this.context.droppables[0];
9498
+ }
9499
 
9500
+ if (typeof targetContainer.layers === "undefined") {
9501
+ targetContainer.layers = this._cacheContainerLayers(targetContainer);
9502
+ }
9503
 
9504
+ var targetIndex = this._findNormalIndex(y, targetContainer);
 
9505
 
9506
+ if (targetIndex > 0) {
9507
+ this.context.placeholder.insertAfter(targetContainer.layers[targetIndex - 1].layer.layerRow);
9508
+ } else {
9509
+ this.context.placeholder.prependTo(targetContainer.$container);
9510
+ }
9511
 
9512
+ this.context.targetIndex = targetIndex;
9513
+ if (this.context.targetContainer && this.context.targetContainer != targetContainer) {
9514
+ this.context.targetContainer.layer.layerRow.removeClass('n2-ss-ll-dragging-parent');
 
 
 
 
 
9515
  }
 
9516
 
9517
+ this.context.targetContainer = targetContainer;
9518
+ this.context.targetContainer.layer.layerRow.addClass('n2-ss-ll-dragging-parent');
 
9519
 
9520
+ this.context.$clone.css({
9521
+ top: y + this.context.mouse.topModifier
9522
+ });
9523
 
9524
+ };
9525
 
9526
+ nUILayerList.prototype._mouseStop = function (itemOptions, event, noPropagation) {
9527
 
9528
+ if (this.scrollTimeout !== null) {
9529
+ clearInterval(this.scrollTimeout);
9530
+ this.scrollTimeout = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9531
  }
 
 
9532
 
9533
+ this.context.placeholder.remove();
 
 
 
9534
 
9535
+ this.context.$clone.remove();
 
9536
 
9537
+ this.context.targetContainer.layer.layerRow.removeClass('n2-ss-ll-dragging-parent');
 
 
9538
 
9539
+ var targetIndex = this.context.targetIndex,
9540
+ targetContainer = this.context.targetContainer,
9541
+ originalIndex = itemOptions.layer.getIndex(),
9542
+ newIndex = -1;
9543
 
 
 
 
 
 
 
 
 
9544
 
9545
+ if (this.context.targetContainer.layers.length === 0) {
9546
+ newIndex = 0;
9547
+ } else {
9548
+ var nextLayer = false,
9549
+ prevLayer = false;
9550
 
9551
+ if (this.context.targetContainer.layers[targetIndex]) {
9552
+ nextLayer = this.context.targetContainer.layers[targetIndex].layer;
9553
+ }
 
 
9554
 
9555
+ if (this.context.targetContainer.layers[targetIndex - 1]) {
9556
+ prevLayer = this.context.targetContainer.layers[targetIndex - 1].layer;
9557
+ }
 
9558
 
9559
+ if (nextLayer === itemOptions.layer || prevLayer === itemOptions.layer) {
9560
+ newIndex = -1;
9561
+ } else {
9562
+ if (targetContainer.layer.container.allowedPlacementMode === 'absolute') {
9563
+ if (nextLayer) {
9564
+ //itemOptions.layer.layer.detach();
9565
+ newIndex = nextLayer.getIndex() + 1;
9566
+ } else if (prevLayer) {
9567
+ //itemOptions.layer.layer.detach();
9568
+ newIndex = prevLayer.getIndex();
9569
+ }
9570
+ } else {
9571
+ if (prevLayer) {
9572
+ //itemOptions.layer.layer.detach();
9573
+ newIndex = prevLayer.getIndex() + 1;
9574
+ } else if (nextLayer) {
9575
+ //itemOptions.layer.layer.detach();
9576
+ newIndex = nextLayer.getIndex();
9577
+ }
9578
+ }
9579
+ }
9580
+ }
9581
+ if (newIndex >= 0) {
9582
+ if (newIndex > originalIndex) {
9583
+ newIndex--;
9584
+ }
9585
+ if (itemOptions.layer.type === 'col') {
9586
+ targetContainer.layer.moveCol(originalIndex, newIndex);
9587
+ } else {
9588
+ targetContainer.layer.container.insertLayerAt(itemOptions.layer, newIndex);
9589
+ itemOptions.layer.onCanvasUpdate(originalIndex, targetContainer.layer, newIndex);
9590
  }
9591
  }
9592
 
9593
+ delete this.context;
 
 
9594
 
9595
+ this._trigger("stop", event);
 
9596
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9597
 
9598
+ $('body').removeClass('n2-ss-layer-list-move-layer');
 
 
 
9599
  };
9600
 
9601
+ nUILayerList.prototype.cancel = function (itemOptions) {
9602
+ };
9603
+
9604
+ nUILayerList.prototype._cacheContainers = function () {
9605
+ for (var i = 0; i < this.context.droppables.length; i++) {
9606
+ var obj = this.context.droppables[i];
9607
+ obj.top = obj.$container.offset().top - this.scrolledTop + this.scrolledScroll - 15;
9608
+ obj.height = obj.$container.outerHeight();
9609
+ obj.bottom = obj.top + obj.height + 15;
9610
  }
9611
+ };
9612
 
9613
+ nUILayerList.prototype._findInnerContainer = function (y) {
9614
+ for (var i = this.context.droppables.length - 1; i >= 0; i--) {
9615
+ var obj = this.context.droppables[i];
9616
+ if (obj.top <= y && obj.bottom >= y) {
9617
+ return obj;
 
 
 
 
 
 
 
 
 
 
9618
  }
9619
  }
9620
+ return false;
 
9621
  };
9622
 
9623
+ nUILayerList.prototype._cacheContainerLayers = function (droppable) {
9624
+ var layerObjects = [],
9625
+ layers = droppable.layer.container.getSortedLayers();
 
 
 
 
 
 
 
 
 
 
 
 
 
9626
 
9627
+ for (var i = 0; i < layers.length; i++) {
9628
+ //if (layers[i].layerRow[0] === this.context.$item[0]) continue;
9629
+ var obj = {
9630
+ layer: layers[i]
9631
+ };
9632
+ obj.top = obj.layer.layerRow.offset().top - this.scrolledTop + this.scrolledScroll;
9633
+ obj.height = obj.layer.layerRow.outerHeight();
9634
+ obj.bottom = obj.top + obj.height / 2;
9635
+ obj.index = i;
9636
+ layerObjects.push(obj);
9637
+ }
9638
 
9639
+ if (droppable.layer.container.allowedPlacementMode == 'absolute') {
9640
+ layerObjects.reverse();
9641
+ }
 
 
 
 
 
9642
 
9643
+ return layerObjects;
 
 
9644
  };
9645
 
9646
+ nUILayerList.prototype._findNormalIndex = function (y, targetContainer) {
9647
+ for (var i = 0; i < targetContainer.layers.length; i++) {
9648
+ var obj = targetContainer.layers[i];
9649
+ if (y <= obj.bottom) {
9650
+ return i;
 
 
 
 
9651
  }
 
 
 
 
 
9652
  }
9653
+ return targetContainer.layers.length;
 
9654
  };
9655
 
9656
+ N2Classes.nUIWidgetBase.register('nUILayerList');
 
 
 
 
 
 
 
 
9657
 
9658
+ return nUILayerList;
9659
+ });
9660
+ N2D('PlacementAbsolute', ['PlacementAbstract'], function ($, undefined) {
9661
+ "use strict";
9662
 
9663
+ var rAFShim = (function () {
9664
+ var timeLast = 0;
 
9665
 
9666
+ return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) {
9667
+ var timeCurrent = (new Date()).getTime(),
9668
+ timeDelta;
 
 
9669
 
9670
+ /* Dynamically set delay on a per-tick basis to match 60fps. */
9671
+ /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */
9672
+ timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));
9673
+ timeLast = timeCurrent + timeDelta;
9674
+
9675
+ return setTimeout(function () {
9676
+ callback(timeCurrent + timeDelta);
9677
+ }, timeDelta);
9678
+ };
9679
+ })(),
9680
+ resizeCollection = {
9681
+ raf: false,
9682
+ ratios: null,
9683
+ isThrottled: false,
9684
+ layers: []
9685
+ },
9686
+ requestRender = function () {
9687
+ if (resizeCollection.raf === false) {
9688
+ resizeCollection.raf = true;
9689
+ rAFShim(function () {
9690
+ for (var i = 0; i < resizeCollection.layers.length; i++) {
9691
+ if (!resizeCollection.layers[i].isDeleted) {
9692
+ resizeCollection.layers[i].doTheResize(resizeCollection.ratios, true, resizeCollection.isThrottled);
9693
+ }
9694
+ }
9695
+ resizeCollection = {
9696
+ raf: false,
9697
+ ratios: null,
9698
+ isThrottled: false,
9699
+ layers: []
9700
+ };
9701
+ });
9702
+ }
9703
+ };
9704
 
9705
  /**
9706
  * @memberOf N2Classes
9707
  *
9708
+ * @param placement
9709
  * @param layer
9710
+ * @param fragmentEditor
9711
  * @constructor
9712
+ * @augments PlacementAbstract
9713
  */
9714
+ function PlacementAbsolute(placement, layer, fragmentEditor) {
9715
+ this.type = 'absolute';
 
 
 
 
9716
 
9717
+ this.transferredProperties = {};
 
9718
 
9719
+ N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9720
 
9721
+ this.doThrottledTheResize = this.doTheResize;
9722
+ this._triggerLayerResizedThrottled = NextendThrottle(this._triggerLayerResized, 30);
 
 
 
9723
 
9724
+ this.parentIsVisible = true; // Related to parent child layer picker
 
 
 
 
 
 
9725
 
9726
+ this.children = [];
9727
+ }
 
 
 
9728
 
9729
+ PlacementAbsolute.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
9730
+ PlacementAbsolute.prototype.constructor = PlacementAbsolute;
9731
 
9732
+ PlacementAbsolute.prototype.start = function () {
9733
+ this.$layer = this.layer.layer;
9734
+ this.$layerRow = this.layer.layerRow;
 
 
 
9735
  };
9736
 
9737
+ PlacementAbsolute.prototype.preActivation = function (lastPlacement) {
9738
+ if (lastPlacement.type == 'normal') {
9739
+ var height = this.layer.getProperty('height');
9740
+ if (height > 0) {
9741
+ this.transferredProperties.height = height;
9742
+ }
9743
  }
9744
  };
9745
 
9746
+ PlacementAbsolute.prototype.activated = function (properties) {
9747
+ var delayedActivate = false,
9748
+ parentid = this.$layer.data('parentid');
9749
+ if (parentid) {
9750
+ var $parent = $('#' + parentid);
9751
+ if ($parent.length > 0) {
9752
+ this.activatedAfterParentReady(properties);
9753
+ } else {
9754
+ setTimeout($.proxy(function () {
9755
+ this.activatedAfterParentReady(properties);
9756
+ }, this), 300);
9757
+ }
9758
+ } else {
9759
+ this._activated(properties);
9760
  }
9761
  };
9762
 
9763
+ PlacementAbsolute.prototype.activatedAfterParentReady = function (properties) {
9764
+ var parentid = this.$layer.data('parentid');
9765
+ if (parentid) {
9766
+ var $parent = $('#' + parentid);
9767
+ if ($parent.length > 0) {
9768
+ var layerObject = $parent.data('layerObject');
9769
+ if (layerObject) {
9770
+ layerObject.readyDeferred.done($.proxy(this._activated, this, properties));
9771
+ } else {
9772
+ $parent.on('layerStarted', $.proxy(function (e, layerObject) {
9773
+ layerObject.readyDeferred.done($.proxy(this._activated, this, properties));
9774
+ }, this));
9775
+ }
9776
+ } else {
9777
+ this.$layer.data('parentid', '');
9778
+ this._activated(properties);
9779
+ }
9780
+ } else {
9781
+ this._activated(properties);
9782
+ }
9783
  };
9784
 
9785
+ PlacementAbsolute.prototype._activated = function (properties) {
9786
+ this.loadProperties($.extend(properties, this.transferredProperties));
9787
+ this.transferredProperties = {};
9788
 
9789
+ this.$layer.css('zIndex', '');
 
 
9790
 
9791
+ this.___makeLayerAlign();
9792
+ this.___makeLayerResizeable();
9793
  };
9794
 
9795
+ PlacementAbsolute.cleanLayer = function ($layer) {
9796
+ var devices = [
9797
+ 'desktopPortrait',
9798
+ 'desktopLandscape',
9799
+ 'tabletPortrait',
9800
+ 'tabletLandscape',
9801
+ 'mobilePortrait',
9802
+ 'mobileLandscape'
9803
+ ];
9804
 
9805
+ $layer
9806
+ .removeAttr('data-align')
9807
+ .removeAttr('data-valign')
9808
+ .css({
9809
+ left: '',
9810
+ top: '',
9811
+ right: '',
9812
+ bottom: '',
9813
+ width: '',
9814
+ height: '',
9815
+ 'text-align': ''
9816
+ });
9817
+ var properties = ['parentid', 'responsiveposition', 'responsivesize', 'parentalign', 'parentvalign',
9818
+ 'align', 'valign', 'left', 'top', 'width', 'height'];
9819
 
9820
+ var data = {};
9821
+ for (var i = 0; i < properties.length; i++) {
9822
+ var prop = properties[i].toLowerCase();
9823
+ data[prop] = $layer.data(prop);
9824
+ $layer.removeAttr(prop);
9825
+ $layer.removeData(prop);
9826
+ for (var j = 0; j < devices.length; j++) {
9827
+ var device = devices[j].toLowerCase();
9828
+ data[device + prop] = $layer.data(device + prop);
9829
+ $layer.removeAttr(device + prop);
9830
+ $layer.removeData(device + prop);
9831
+ }
9832
+ }
9833
+ return data;
9834
  };
9835
 
9836
+ PlacementAbsolute.prototype.deActivated = function (newMode) {
 
 
 
9837
 
9838
+ var value = this.layer.getProperty('parentid');
9839
+ if (value && value != '') {
9840
+ this.$layer.removeAttr('data-parentid');
9841
+ this.unSubscribeParent();
9842
+ }
 
 
 
 
 
 
 
 
 
 
 
9843
 
9844
+ this.$layer
9845
+ .removeAttr('data-align')
9846
+ .removeAttr('data-valign')
9847
+ .css({
9848
+ left: '',
9849
+ top: '',
9850
+ right: '',
9851
+ bottom: '',
9852
+ width: '',
9853
+ height: '',
9854
+ 'text-align': ''
9855
+ });
9856
 
9857
+ this.alignMarker.remove();
9858
+ this.$layer.nUIResizable('destroy');
9859
+ this.$layer.off('.n2-ss-absolute');
9860
 
9861
+ this.$layer.triggerHandler('LayerUnavailable');
9862
 
9863
+ var properties = ['parentid', 'responsiveposition', 'responsivesize', 'parentalign', 'parentvalign',
9864
+ 'align', 'valign', 'left', 'top', 'width', 'height'],
9865
+ historicalData = this.layer.getPropertiesData(properties);
9866
 
9867
+ this.layer.removeProperties(properties);
9868
 
 
9869
 
9870
+ this.chainParent.remove();
9871
 
9872
+ return historicalData;
9873
  };
9874
 
9875
+ PlacementAbsolute.prototype.loadProperties = function (options) {
9876
+ this.layer.createProperty('parentid', null, this.layer.layer, this);
 
9877
 
9878
+ this.layer.createProperty('responsiveposition', 1, this.layer.layer, this);
9879
+ this.layer.createProperty('responsivesize', 1, this.layer.layer, this);
9880
 
9881
+ this.layer.createDeviceProperty('parentalign', {desktopPortrait: 'center'}, this.layer.layer, this);
9882
+ this.layer.createDeviceProperty('parentvalign', {desktopPortrait: 'middle'}, this.layer.layer, this);
9883
 
9884
+ this.layer.createDeviceProperty('align', {desktopPortrait: options.align || 'center'}, this.layer.layer, this);
9885
+ this.layer.createDeviceProperty('valign', {desktopPortrait: options.valign || 'middle'}, this.layer.layer, this);
9886
 
9887
+ this.layer.createDeviceProperty('left', {desktopPortrait: options.left || 0}, this.layer.layer, this);
9888
+ this.layer.createDeviceProperty('top', {desktopPortrait: options.top || 0}, this.layer.layer, this);
9889
 
9890
+ this.layer.createDeviceProperty('width', {desktopPortrait: options.width || 'auto'}, this.layer.layer, this);
9891
+ this.layer.createDeviceProperty('height', {desktopPortrait: options.height || 'auto'}, this.layer.layer, this);
 
9892
 
9893
+ var $layer = this.layer.layer;
 
 
9894
 
9895
+ this.subscribeParentCallbacks = {};
9896
+ if (this.layer.getProperty('parentid')) {
9897
+ this.subscribeParent();
9898
+ }
9899
 
9900
+ $layer.attr({
9901
+ 'data-align': this.layer.getProperty('align'),
9902
+ 'data-valign': this.layer.getProperty('valign')
9903
+ });
9904
 
9905
+ var $lastParent = null;
9906
+ this.chainParent = $('<div class="n2-ss-layer-chain-parent n2-button n2-button-icon n2-button-xs n2-radius-s n2-button-blue"><i class="n2-i n2-i-layerunlink"></i></div>').on({
9907
+ click: $.proxy(this.unlink, this),
9908
+ mouseenter: $.proxy(function () {
9909
+ $lastParent = $('#' + this.layer.getProperty('parentid')).addClass('n2-highlight');
9910
+ }, this),
9911
+ mouseleave: $.proxy(function () {
9912
+ if ($lastParent) {
9913
+ $lastParent.removeClass('n2-highlight');
9914
+ $lastParent = null;
9915
+ }
9916
+ }, this)
9917
+ }).appendTo(this.$layer);
9918
  };
9919
 
 
9920
 
9921
+ PlacementAbsolute.prototype.triggerLayerResized = function (isThrottled, ratios) {
9922
+ if (isThrottled) {
9923
+ this._triggerLayerResized(isThrottled, ratios);
9924
+ } else {
9925
+ this._triggerLayerResizedThrottled(true, ratios);
9926
+ }
9927
  };
9928
 
9929
+ PlacementAbsolute.prototype._triggerLayerResized = function (isThrottled, ratios) {
9930
+ if (!this.layer.isDeleted) {
9931
+ this.$layer.triggerHandler('LayerResized', [ratios || {
9932
+ slideW: this.fragmentEditor.getResponsiveRatioHorizontal(),
9933
+ slideH: this.fragmentEditor.getResponsiveRatioVertical()
9934
+ }, isThrottled || false]);
9935
+ }
9936
  };
9937
 
9938
+ PlacementAbsolute.prototype.___makeLayerAlign = function () {
9939
+ this.alignMarker = $('<div class="n2-ss-layer-cc" />').appendTo(this.$layer);
9940
+ };
9941
 
9942
+ //<editor-fold desc="Makes layer resizable">
9943
 
9944
+ /**
9945
+ * Add resize handles to the specified layer
9946
+ * @param {jQuery} layer
9947
+ * @private
9948
+ */
9949
+ PlacementAbsolute.prototype.___makeLayerResizeable = function () {
9950
+ this._resizableJustClick = false;
9951
+ this.$layer.nUIResizable({
9952
+ handles: 'n, e, s, w, ne, se, sw, nw',
9953
+ _containment: this.fragmentEditor.mainContainer.layer,
9954
+ start: $.proxy(this.____makeLayerResizeableStart, this),
9955
+ resize: $.proxy(this.____makeLayerResizeableResize, this),
9956
+ stop: $.proxy(this.____makeLayerResizeableStop, this),
9957
+ create: $.proxy(function () {
9958
+ this.$layer.find('.nui-resizable-handle, .n2-ss-layer-cc').on({
9959
+ mousedown: $.proxy(function (e) {
9960
+ this._resizableJustClick = [e.clientX, e.clientY];
9961
+ }, this),
9962
+ mouseup: $.proxy(function (e) {
9963
+ if (this._resizableJustClick && Math.abs(Math.sqrt(Math.pow(this._resizableJustClick[0] - e.clientX, 2) + Math.pow(this._resizableJustClick[1] - e.clientY, 2))) < 1) {
9964
+ var $target = $(e.currentTarget),
9965
+ layerFeatures = this.fragmentEditor.layerOptions.layerFeatures;
9966
+ if ($target.hasClass('nui-resizable-nw')) {
9967
+ layerFeatures.horizontalAlign('left', false);
9968
+ layerFeatures.verticalAlign('top', false);
9969
+ } else if ($target.hasClass('nui-resizable-w')) {
9970
+ layerFeatures.horizontalAlign('left', false);
9971
+ layerFeatures.verticalAlign('middle', false);
9972
+ } else if ($target.hasClass('nui-resizable-sw')) {
9973
+ layerFeatures.horizontalAlign('left', false);
9974
+ layerFeatures.verticalAlign('bottom', false);
9975
+ } else if ($target.hasClass('nui-resizable-n')) {
9976
+ layerFeatures.horizontalAlign('center', false);
9977
+ layerFeatures.verticalAlign('top', false);
9978
+ } else if ($target.hasClass('n2-ss-layer-cc')) {
9979
+ layerFeatures.horizontalAlign('center', false);
9980
+ layerFeatures.verticalAlign('middle', false);
9981
+ } else if ($target.hasClass('nui-resizable-s')) {
9982
+ layerFeatures.horizontalAlign('center', false);
9983
+ layerFeatures.verticalAlign('bottom', false);
9984
+ } else if ($target.hasClass('nui-resizable-ne')) {
9985
+ layerFeatures.horizontalAlign('right', false);
9986
+ layerFeatures.verticalAlign('top', false);
9987
+ } else if ($target.hasClass('nui-resizable-e')) {
9988
+ layerFeatures.horizontalAlign('right', false);
9989
+ layerFeatures.verticalAlign('middle', false);
9990
+ } else if ($target.hasClass('nui-resizable-se')) {
9991
+ layerFeatures.horizontalAlign('right', false);
9992
+ layerFeatures.verticalAlign('bottom', false);
9993
+ }
9994
+ }
9995
+ this._resizableJustClick = false;
9996
+ }, this)
9997
+ });
9998
+ }, this),
9999
+ smartguides: $.proxy(function () {
10000
+ this.$layer.triggerHandler('LayerParent');
10001
+ return this.fragmentEditor.getSnap();
10002
+ }, this),
10003
+ tolerance: 5
10004
+ })
10005
+ .on({
10006
+ 'mousedown.n2-ss-absolute': $.proxy(function (e) {
10007
+ if (!this.layer.status != N2Classes.ComponentAbstract.STATUS.LOCKED) {
10008
+ N2Classes.PositionDisplay.get().show('Canvas');
10009
 
10010
+ N2Classes.PositionDisplay.get().update(e, 'Canvas', 'W: ' + parseInt(this.$layer.width()) + 'px<br />H: ' + parseInt(this.$layer.height()) + 'px');
10011
 
10012
+ }
10013
+ if (document.activeElement) {
10014
+ document.activeElement.blur();
10015
+ }
10016
+ }, this),
10017
+ 'mouseup.n2-ss-absolute': $.proxy(function (e) {
10018
+ N2Classes.PositionDisplay.get().hide('Canvas');
10019
+ }, this)
10020
+ });
10021
  };
10022
 
10023
+ PlacementAbsolute.prototype.____makeLayerResizeableStart = function (event, ui) {
10024
+ this.preventActivation = true;
10025
+ this.resizableDeferred = $.Deferred();
10026
+ this.fragmentEditor.layerWindow.hideWithDeferred(this.resizableDeferred);
10027
+ $('body').addClass('n2-ss-resize-layer');
10028
+ if (this._resizableJustClick) {
10029
+ this._resizableJustClick = false;
 
 
 
 
 
 
10030
  }
10031
+ this.____makeLayerResizeableResize(event, ui);
10032
+ N2Classes.PositionDisplay.get().show('Canvas');
10033
+ };
10034
 
10035
+ PlacementAbsolute.prototype.____makeLayerResizeableResize = function (e, ui) {
10036
 
 
 
 
 
 
10037
 
10038
+ N2Classes.PositionDisplay.get().update(e, 'Canvas', 'W: ' + ui.size.width + 'px<br />H: ' + ui.size.height + 'px');
 
 
 
10039
 
10040
+ this.triggerLayerResized();
10041
+ };
10042
 
10043
+ PlacementAbsolute.prototype.____makeLayerResizeableStop = function (event, ui) {
10044
+ $('body').removeClass('n2-ss-resize-layer');
10045
+ this.resizableDeferred.resolve();
10046
 
10047
+ var isAutoWidth = false;
10048
+ if (ui.axis == "n" || ui.axis == "s" || ui.originalSize.width == ui.size.width) {
10049
+ var currentValue = this.layer.getProperty('width');
10050
+ if (this.layer.isDimensionPropertyAccepted(currentValue)) {
10051
+ isAutoWidth = true;
10052
+ this._syncwidth();
10053
+ }
10054
  }
10055
 
10056
+ var isAutoHeight = false;
10057
+ if (ui.axis == "e" || ui.axis == "w" || ui.originalSize.height == ui.size.height) {
10058
+ var currentValue = this.layer.getProperty('height');
10059
+ if (this.layer.isDimensionPropertyAccepted(currentValue)) {
10060
+ isAutoHeight = true;
10061
+ this._syncheight();
10062
+ }
10063
+ }
10064
 
10065
+ var ratioSizeH = this.fragmentEditor.getResponsiveRatioHorizontal(),
10066
+ ratioSizeV = this.fragmentEditor.getResponsiveRatioVertical();
10067
 
10068
+ if (!parseInt(this.layer.getProperty('responsivesize'))) {
10069
+ ratioSizeH = ratioSizeV = 1;
10070
+ }
10071
+ var width = null;
10072
+ if (!isAutoWidth) {
10073
+ width = Math.round(ui.size.width * (1 / ratioSizeH));
10074
+ }
10075
+ var height = null;
10076
+ if (!isAutoHeight) {
10077
+ height = Math.round(ui.size.height * (1 / ratioSizeV));
10078
+ }
10079
 
10080
+ this._setPosition(null, null, ui.position.left, ui.position.top, width, height, true);
10081
 
10082
+ this.triggerLayerResized();
 
 
 
10083
 
10084
+ this.$layer.triggerHandler('LayerUnParent');
10085
 
10086
+ N2Classes.PositionDisplay.get().hide('Canvas');
 
 
 
10087
 
10088
+ setTimeout($.proxy(function () {
10089
+ this.preventActivation = false;
10090
+ }, this), 80);
10091
 
10092
+ //this.fragmentEditor.panel.positionMenu(this.$layer);
10093
+ };
10094
+ //</editor-fold>
10095
 
10096
+ PlacementAbsolute.prototype._setPosition = function (align, valign, left, top, width, height, isPositionAbsolute) {
10097
+ var mode = this.layer.getMode();
10098
+ if (align === null) {
10099
+ align = this.layer.getProperty('align');
10100
+ }
10101
+ if (valign === null) {
10102
+ valign = this.layer.getProperty('valign');
10103
+ }
10104
 
10105
+ if (left === null) {
10106
+ left = this.layer.getProperty('left');
10107
+ } else if (isPositionAbsolute) {
10108
+ left = this.calculatePositionLeft(align, left);
10109
+ }
10110
 
10111
+ if (top === null) {
10112
+ top = this.layer.getProperty('top');
10113
+ } else if (isPositionAbsolute) {
10114
+ top = this.calculatePositionTop(valign, top);
10115
  }
 
 
10116
 
10117
+ if (width === null) {
10118
+ width = this.layer.getProperty('width');
 
10119
  }
 
 
10120
 
10121
+ if (height === null) {
10122
+ height = this.layer.getProperty('height');
 
 
 
 
10123
  }
 
10124
 
10125
+ var task = N2Classes.History.get().addValue(this.layer, this.layer.historyStoreOnPlacement, ['historyStorePosition', mode]);
10126
+ if (task) {
10127
+ task.setValues({
10128
+ align: this.layer.getRawProperty('align'),
10129
+ valign: this.layer.getRawProperty('valign'),
10130
+ left: this.layer.getRawProperty('left'),
10131
+ top: this.layer.getRawProperty('top'),
10132
+ width: this.layer.getRawProperty('width'),
10133
+ height: this.layer.getRawProperty('height')
10134
+ }, {
10135
+ align: align,
10136
+ valign: valign,
10137
+ left: left,
10138
+ top: top,
10139
+ width: width,
10140
+ height: height
10141
  });
 
10142
  }
 
10143
 
10144
+ N2Classes.History.get().off();
 
 
10145
 
10146
+ this.layer.store('width', width, true, 'layer');
10147
+ this.layer.$.trigger('propertyChanged', ['width', width]);
 
10148
 
10149
+ this.layer.store('height', height, true, 'layer');
10150
+ this.layer.$.trigger('propertyChanged', ['height', height]);
10151
 
10152
+ this.layer.store('align', align, true, 'layer');
10153
+ this.layer.$.trigger('propertyChanged', ['align', align]);
10154
 
10155
+ this.layer.store('valign', valign, true, 'layer');
10156
+ this.layer.$.trigger('propertyChanged', ['valign', valign]);
 
 
10157
 
10158
+ this.layer.store('left', left, true, 'layer');
10159
+ this.layer.$.trigger('propertyChanged', ['left', left]);
 
 
 
 
 
10160
 
10161
+ this.layer.store('top', top, true, 'layer');
10162
+ this.layer.$.trigger('propertyChanged', ['top', top]);
10163
 
10164
+ N2Classes.History.get().on();
 
 
 
10165
 
 
10166
  };
10167
 
10168
+ PlacementAbsolute.prototype.historyStorePosition = function (values, mode) {
10169
 
10170
+ this.layer.historyStore(values.align, 'align', mode);
10171
+ this.layer.historyStore(values.valign, 'valign', mode);
10172
 
10173
+ this.layer.historyStore(values.width, 'width', mode);
10174
+ this.layer.historyStore(values.height, 'height', mode);
10175
+
10176
+ this.layer.historyStore(values.left, 'left', mode);
10177
+ this.layer.historyStore(values.top, 'top', mode);
10178
+
10179
+ this.triggerLayerResized();
10180
  };
10181
 
10182
+ PlacementAbsolute.prototype.calculatePositionLeft = function (align, left) {
10183
+ var ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
 
10184
 
10185
+ if (!parseInt(this.layer.getProperty('responsiveposition'))) {
10186
+ ratioH = 1;
10187
  }
 
10188
 
10189
+ var parent = this.parent,
10190
+ p = {
10191
+ left: 0,
10192
+ leftMultiplier: 1
10193
+ };
10194
+ if (!parent || !parent.is(':visible')) {
10195
+ parent = this.$layer.parent();
10196
 
10197
+
10198
+ switch (align) {
10199
+ case 'center':
10200
+ p.left += parent.width() / 2;
10201
+ break;
10202
+ case 'right':
10203
+ p.left += parent.width();
10204
+ break;
10205
+ }
10206
  } else {
10207
+ var position = parent.position();
10208
+ switch (this.layer.getProperty('parentalign')) {
10209
+ case 'right':
10210
+ p.left = position.left + parent.width();
10211
+ break;
10212
+ case 'center':
10213
+ p.left = position.left + parent.width() / 2;
10214
+ break;
10215
+ default:
10216
+ p.left = position.left;
10217
+ }
10218
  }
 
 
10219
 
 
 
 
 
 
 
10220
 
10221
+ var left;
10222
+ switch (align) {
10223
+ case 'left':
10224
+ left = -Math.round((p.left - left) * (1 / ratioH));
10225
+ break;
10226
+ case 'center':
10227
+ left = -Math.round((p.left - left - this.$layer.width() / 2) * (1 / ratioH));
10228
+ break;
10229
+ case 'right':
10230
+ left = -Math.round((p.left - left - this.$layer.width()) * (1 / ratioH));
10231
+ break;
10232
+ }
10233
 
10234
+ return left;
 
10235
  };
10236
 
 
10237
 
10238
+ PlacementAbsolute.prototype.calculatePositionTop = function (valign, top) {
10239
+ var ratioV = this.fragmentEditor.getResponsiveRatioVertical();
10240
 
10241
+ if (!parseInt(this.layer.getProperty('responsiveposition'))) {
10242
+ ratioV = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10243
  }
10244
 
 
10245
 
10246
+ var parent = this.parent,
10247
+ p = {
10248
+ top: 0,
10249
+ topMultiplier: 1
10250
+ };
10251
+ if (!parent || !parent.is(':visible')) {
10252
+ parent = this.$layer.parent();
10253
 
10254
+ switch (valign) {
10255
+ case 'middle':
10256
+ p.top += parent.height() / 2;
10257
+ break;
10258
+ case 'bottom':
10259
+ p.top += parent.height();
10260
+ break;
10261
+ }
10262
+ } else {
10263
+ var position = parent.position();
10264
 
10265
+ switch (this.layer.getProperty('parentvalign')) {
10266
+ case 'bottom':
10267
+ p.top = position.top + parent.height();
10268
+ break;
10269
+ case 'middle':
10270
+ p.top = position.top + parent.height() / 2;
10271
+ break;
10272
+ default:
10273
+ p.top = position.top;
10274
+ }
10275
  }
10276
 
10277
+ var top;
10278
+ switch (valign) {
10279
+ case 'top':
10280
+ top = -Math.round((p.top - top) * (1 / ratioV));
10281
+ break;
10282
+ case 'middle':
10283
+ top = -Math.round((p.top - top - this.$layer.height() / 2) * (1 / ratioV));
10284
+ break;
10285
+ case 'bottom':
10286
+ top = -Math.round((p.top - top - this.$layer.height()) * (1 / ratioV));
10287
+ break;
10288
  }
 
10289
 
10290
+ return top;
 
10291
  };
10292
 
10293
+ PlacementAbsolute.prototype.moveX = function (x) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10294
 
10295
+ this._setPosition(null, null, this.layer.getProperty('left') + x, null, null, null, false);
 
10296
  };
10297
 
10298
+ PlacementAbsolute.prototype.moveY = function (y) {
 
 
 
10299
 
10300
+ this._setPosition(null, null, null, this.layer.getProperty('top') + y, null, null, false);
10301
+ };
 
 
 
 
 
 
 
10302
 
10303
+ PlacementAbsolute.prototype.setPositionLeft = function (left) {
10304
 
10305
+ left = this.calculatePositionLeft(this.layer.getProperty('align'), left);
10306
 
10307
+ this.layer.store('left', left, true);
10308
+ this.layer.$.trigger('propertyChanged', ['left', left]);
10309
 
10310
+ };
10311
 
10312
+ PlacementAbsolute.prototype.setPositionTop = function (top) {
 
10313
 
10314
+ top = this.calculatePositionTop(this.layer.getProperty('valign'), top);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10315
 
10316
+ this.layer.store('top', top, true);
10317
+ this.layer.$.trigger('propertyChanged', ['top', top]);
10318
+ };
 
10319
 
10320
+ PlacementAbsolute.prototype.setPosition = function (left, top) {
10321
+ this.setPositionLeft(left);
10322
+ this.setPositionTop(top);
10323
+ };
10324
 
10325
+ PlacementAbsolute.prototype.setDeviceBasedAlign = function () {
10326
+ var mode = this.layer.getMode();
10327
+ if (typeof this.layer.deviceProperty[mode]['align'] == 'undefined') {
10328
+ this.layer.setProperty('align', this.layer.getProperty('align'), 'layer');
 
 
10329
  }
10330
+ if (typeof this.layer.deviceProperty[mode]['valign'] == 'undefined') {
10331
+ this.layer.setProperty('valign', this.layer.getProperty('valign'), 'layer');
10332
+ }
10333
+ };
10334
+ //</editor-fold
10335
 
 
 
 
 
10336
 
10337
+ PlacementAbsolute.prototype.setPropertyresponsiveposition =
10338
+ PlacementAbsolute.prototype.setPropertyresponsivesize = function (name, value, from) {
10339
+ this.layer._setProperty(name, parseInt(value), from);
10340
+ };
10341
 
 
 
 
10342
 
10343
+ PlacementAbsolute.prototype.setPropertywidth =
10344
+ PlacementAbsolute.prototype.setPropertyheight = function (name, value, from) {
10345
+ var v = value;
10346
+ if (!this.layer.isDimensionPropertyAccepted(value)) {
10347
+ v = ~~value;
10348
+ if (v != value) {
10349
+ this.layer.$.trigger('propertyChanged', [name, v]);
10350
+ }
10351
  }
10352
+ setTimeout($.proxy(function () {
10353
+ this.onResize(false);
10354
+ }, this), 50);
10355
 
10356
+ this.layer._setProperty(name, v, from);
10357
+ };
 
 
 
 
 
10358
 
10359
+ PlacementAbsolute.prototype.setPropertyleft =
10360
+ PlacementAbsolute.prototype.setPropertytop = function (name, value, from) {
10361
+ var v = ~~value;
10362
+ if (v != value) {
10363
+ this.layer.$.trigger('propertyChanged', [name, v]);
10364
  }
10365
+ this.layer._setProperty(name, v, from);
10366
+ };
10367
 
10368
+ PlacementAbsolute.prototype.render = function (name) {
10369
+ this['_sync' + name]();
 
 
 
 
 
 
10370
  };
10371
 
10372
+ PlacementAbsolute.prototype.renderWithModifier = function (name, value, modifier) {
10373
+ try {
10374
+ if ((name == 'width' || name == 'height') && this.layer.isDimensionPropertyAccepted(value)) {
10375
+ this['_sync' + name](value);
10376
+ } else {
10377
+ this['_sync' + name](Math.round(value * modifier));
10378
+ }
10379
+ } catch (e) {
10380
+ console.error('_sync' + name);
10381
  }
10382
  };
10383
 
10384
+ PlacementAbsolute.prototype.onResize = function (isForced) {
10385
+ this.resize({
10386
+ slideW: this.fragmentEditor.getResponsiveRatioHorizontal(),
10387
+ slideH: this.fragmentEditor.getResponsiveRatioVertical()
10388
+ }, isForced);
10389
+ };
 
 
 
 
 
 
 
 
 
10390
 
10391
+ PlacementAbsolute.prototype.resize = function (ratios, isForced) {
 
10392
 
10393
+ if (!this.parent || isForced) {
10394
+ //this.doThrottledTheResize(ratios, false);
10395
+ this.addToResizeCollection(this, ratios, false);
10396
+ }
10397
+ };
10398
 
10399
+ PlacementAbsolute.prototype.addToResizeCollection = function (layer, ratios, isThrottled) {
10400
+ resizeCollection.ratios = ratios;
10401
+ resizeCollection.isThrottled = isThrottled;
10402
+ for (var i = 0; i < resizeCollection.layers.length; i++) {
10403
+ if (resizeCollection.layers[i] == this) {
10404
+ resizeCollection.layers.splice(i, 1);
10405
+ break;
10406
+ }
10407
+ }
10408
+ resizeCollection.layers.push(layer);
10409
 
10410
+ requestRender();
10411
+ this.triggerLayerResized(isThrottled, ratios);
10412
+ };
10413
 
10414
+ PlacementAbsolute.prototype._syncresponsiveposition = function () {
10415
+ this.onResize(false);
10416
+ };
10417
 
10418
+ PlacementAbsolute.prototype._syncwidth = function () {
10419
+ var value = this.layer.getProperty('width');
10420
 
10421
+ if (!this.layer.isDimensionPropertyAccepted(value)) {
10422
+ if (parseInt(this.layer.getProperty('responsivesize'))) {
10423
+ var ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
10424
+ value = (value * ratio);
10425
+ }
10426
+ value += 'px';
10427
+ }
10428
 
10429
+ this.$layer.css('width', value);
10430
+ };
 
 
 
10431
 
10432
+ PlacementAbsolute.prototype._syncheight = function () {
10433
+ var value = this.layer.getProperty('height');
10434
+ if (!this.layer.isDimensionPropertyAccepted(value)) {
10435
+ if (parseInt(this.layer.getProperty('responsivesize'))) {
10436
+ var ratio = this.fragmentEditor.getResponsiveRatioVertical();
10437
+ value = (value * ratio);
10438
  }
10439
+ value += 'px';
10440
+ }
 
10441
 
10442
+ this.$layer.css('height', value);
10443
+ };
10444
 
10445
+ PlacementAbsolute.prototype._syncparentalign = function () {
10446
+ var value = this.layer.getProperty('parentalign');
10447
+ this.$layer.data('parentalign', value);
10448
+ var parent = this.getParent();
10449
+ if (parent) {
10450
+ parent.placement.current.onResize(false);
10451
+ }
10452
+ };
 
10453
 
10454
+ PlacementAbsolute.prototype._syncparentvalign = function () {
10455
+ var value = this.layer.getProperty('parentvalign');
10456
+ this.$layer.data('parentvalign', value);
10457
+ var parent = this.getParent();
10458
+ if (parent) {
10459
+ parent.placement.current.onResize(false);
10460
+ }
 
 
 
10461
  };
10462
 
 
 
 
 
 
 
 
10463
 
10464
+ PlacementAbsolute.prototype._syncleft = function () {
10465
+ var value = this.layer.getProperty('left');
10466
+
10467
+ if (parseInt(this.layer.getProperty('responsiveposition'))) {
10468
+ var ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
10469
+ value = (value * ratio);
10470
+ }
10471
+
10472
+ if (!this.parent || !this.parentIsVisible) {
10473
+ switch (this.layer.getProperty('align')) {
10474
+ case 'right':
10475
+ this.$layer.css({
10476
+ left: 'auto',
10477
+ right: -value + 'px'
10478
+ });
10479
+ break;
10480
+ case 'center':
10481
+ this.$layer.css({
10482
+ left: (this.$layer.parent().width() / 2 + value - this.$layer.width() / 2) + 'px',
10483
+ right: 'auto'
10484
+ });
10485
+ break;
10486
+ default:
10487
+ this.$layer.css({
10488
+ left: value + 'px',
10489
+ right: 'auto'
10490
+ });
10491
+ }
10492
  } else {
10493
+ var position = this.parent.position(),
10494
+ align = this.layer.getProperty('align'),
10495
+ parentAlign = this.layer.getProperty('parentalign'),
10496
+ left = 0;
10497
+ switch (parentAlign) {
10498
+ case 'right':
10499
+ left = position.left + this.parent.width();
10500
+ break;
10501
+ case 'center':
10502
+ left = position.left + this.parent.width() / 2;
10503
  break;
10504
+ default:
10505
+ left = position.left;
10506
  }
10507
 
10508
+ switch (align) {
10509
+ case 'right':
10510
+ this.$layer.css({
10511
+ left: 'auto',
10512
+ right: (this.$layer.parent().width() - left - value) + 'px'
10513
+ });
10514
+ break;
10515
+ case 'center':
10516
+ this.$layer.css({
10517
+ left: (left + value - this.$layer.width() / 2) + 'px',
10518
+ right: 'auto'
10519
+ });
10520
+ break;
10521
+ default:
10522
+ this.$layer.css({
10523
+ left: (left + value) + 'px',
10524
+ right: 'auto'
10525
+ });
10526
  }
10527
 
 
 
 
 
 
10528
  }
 
10529
 
10530
+ this.triggerLayerResized();
 
 
 
 
10531
  };
10532
 
10533
+ PlacementAbsolute.prototype._synctop = function () {
10534
+ var value = this.layer.getProperty('top');
 
 
 
 
 
10535
 
10536
+ if (parseInt(this.layer.getProperty('responsiveposition'))) {
10537
+ var ratio = this.fragmentEditor.getResponsiveRatioVertical();
10538
+ value = (value * ratio);
 
 
 
10539
  }
10540
 
10541
+ if (!this.parent || !this.parentIsVisible) {
10542
+ switch (this.layer.getProperty('valign')) {
10543
+ case 'bottom':
10544
+ this.$layer.css({
10545
+ top: 'auto',
10546
+ bottom: -value + 'px'
10547
+ });
10548
+ break;
10549
+ case 'middle':
10550
+ this.$layer.css({
10551
+ top: (this.$layer.parent().height() / 2 + value - this.$layer.height() / 2) + 'px',
10552
+ bottom: 'auto'
10553
+ });
10554
+ break;
10555
+ default:
10556
+ this.$layer.css({
10557
+ top: value + 'px',
10558
+ bottom: 'auto'
10559
+ });
10560
+ }
10561
+ } else {
10562
+ var position = this.parent.position(),
10563
+ valign = this.layer.getProperty('valign'),
10564
+ parentVAlign = this.layer.getProperty('parentvalign'),
10565
+ top = 0;
10566
+ switch (parentVAlign) {
10567
+ case 'bottom':
10568
+ top = position.top + this.parent.height();
10569
+ break;
10570
+ case 'middle':
10571
+ top = position.top + this.parent.height() / 2;
10572
+ break;
10573
+ default:
10574
+ top = position.top;
10575
+ }
10576
 
10577
+ switch (valign) {
10578
+ case 'bottom':
10579
+ this.$layer.css({
10580
+ top: 'auto',
10581
+ bottom: (this.$layer.parent().height() - top - value) + 'px'
10582
+ });
10583
+ break;
10584
+ case 'middle':
10585
+ this.$layer.css({
10586
+ top: (top + value - this.$layer.height() / 2) + 'px',
10587
+ bottom: 'auto'
10588
+ });
10589
+ break;
10590
+ default:
10591
+ this.$layer.css({
10592
+ top: (top + value) + 'px',
10593
+ bottom: 'auto'
10594
+ });
10595
+ }
10596
+ }
10597
 
10598
+ this.triggerLayerResized();
10599
  };
10600
 
10601
+ PlacementAbsolute.prototype._syncresponsivesize = function () {
10602
+ this.onResize(false);
10603
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10604
 
10605
+ PlacementAbsolute.prototype.historyStoreDoubleProp = function (data, mode, prop, prop2) {
10606
+ var currentMode = this.layer.getMode();
10607
+ if (mode == currentMode) {
10608
+ this.layer._setProperty(prop, data.value, 'history');
10609
+ this.layer._setProperty(prop2, data.value2, 'history');
10610
+ } else {
10611
+ this.layer.deviceProperty[mode][prop] = data.value;
10612
+ this.layer.deviceProperty[mode][prop2] = data.value2;
10613
+ this.layer.$.trigger('propertyChanged', [prop, this.layer.getProperty(prop)]);
10614
+ this.layer.$.trigger('propertyChanged', [prop2, this.layer.getProperty(prop2)]);
10615
+ this.layer.render(prop, null, 'history');
10616
+ this.layer.render(prop2, null, 'history');
10617
  }
 
10618
  };
10619
 
10620
+ PlacementAbsolute.prototype.setPropertyalign = function (name, value, from) {
10621
+ var oldValue = this.layer.getProperty(name),
10622
+ oldLeft = this.layer.getRawProperty('left');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10623
 
10624
+ N2Classes.History.get().off();
10625
+ this.layer._setProperty(name, value, from);
10626
+ N2Classes.History.get().on();
10627
 
10628
+ var task = N2Classes.History.get().addValue(this.layer, this.layer.historyStoreOnPlacement, ['historyStoreDoubleProp', this.layer.getMode(), 'align', 'left']);
10629
+ if (task) {
10630
+ task.setValues({
10631
+ value: oldValue,
10632
+ value2: oldLeft
10633
+ }, {
10634
+ value: value,
10635
+ value2: this.layer.getRawProperty('left')
10636
+ });
10637
  }
10638
  };
10639
 
10640
+ PlacementAbsolute.prototype.setPropertyvalign = function (name, value, from) {
10641
+ var oldValue = this.layer.getProperty(name),
10642
+ oldTop = this.layer.getRawProperty('top');
 
 
 
 
 
10643
 
10644
+ N2Classes.History.get().off();
10645
+ this.layer._setProperty(name, value, from);
10646
+ N2Classes.History.get().on();
10647
 
10648
+ var task = N2Classes.History.get().addValue(this.layer, this.layer.historyStoreOnPlacement, ['historyStoreDoubleProp', this.layer.getMode(), 'valign', 'top']);
10649
+ if (task) {
10650
+ task.setValues({
10651
+ value: oldValue,
10652
+ value2: oldTop
10653
+ }, {
10654
+ value: value,
10655
+ value2: this.layer.getRawProperty('top')
10656
+ });
10657
+ }
10658
  };
10659
 
10660
+ PlacementAbsolute.prototype._syncalign = function (oldValue, from) {
10661
+ var value = this.layer.getProperty('align');
10662
+ this.$layer.attr('data-align', value);
 
10663
 
10664
+ if (from !== 'history' && value != oldValue) {
10665
+ this.setPositionLeft(this.$layer.position().left);
10666
+ }
10667
  };
10668
+ PlacementAbsolute.prototype._syncvalign = function (oldValue, from) {
10669
+ var value = this.layer.getProperty('valign');
10670
+ this.$layer.attr('data-valign', value);
10671
 
10672
+ if (from !== 'history' && value != oldValue) {
10673
+ this.setPositionTop(this.$layer.position().top);
10674
+ }
10675
  };
10676
 
10677
+ PlacementAbsolute.prototype.fit = function () {
10678
+ var layer = this.$layer.get(0);
 
 
10679
 
10680
+ var position = this.$layer.position();
 
 
 
 
 
 
 
 
10681
 
10682
+ if (layer.scrollWidth > 0 && layer.scrollHeight > 0) {
10683
+ var resized = false;
10684
+ if (this.layer.item) {
10685
+ resized = this.layer.item.fitLayer();
 
 
 
 
 
 
10686
  }
10687
+ if (!resized) {
10688
+ this.layer.setProperty('width', 'auto', 'layer');
10689
+ this.layer.setProperty('height', 'auto', 'layer');
10690
 
10691
+ var layerWidth = this.$layer.width();
10692
+ if (Math.abs(this.fragmentEditor.mainContainer.layer.width() - this.$layer.position().left - layerWidth) < 2) {
10693
+ this.layer.setProperty('width', layerWidth, 'layer');
10694
+ }
10695
  }
10696
  }
10697
+ };
10698
 
10699
+ PlacementAbsolute.prototype.hide = function (targetMode) {
10700
+ this.layer.store((targetMode ? targetMode : this.layer.getMode()), 0, true);
10701
+ };
10702
 
10703
+ PlacementAbsolute.prototype.show = function (targetMode) {
10704
+ this.layer.store((targetMode ? targetMode : this.layer.getMode()), 1, true);
10705
+ };
10706
 
 
 
 
 
 
 
 
10707
 
10708
+ PlacementAbsolute.prototype.changeStatus = function (oldStatus, newStatus) {
10709
 
10710
+ if (oldStatus == N2Classes.ComponentAbstract.STATUS.LOCKED) {
10711
+ this.layer.nUIResizable("enable");
10712
  }
 
 
 
10713
 
10714
+
10715
+ if (newStatus == N2Classes.ComponentAbstract.STATUS.LOCKED) {
10716
+ this.$layer.nUIResizable("disable");
 
10717
  }
 
 
 
10718
  };
10719
 
10720
+ PlacementAbsolute.prototype.getParent = function () {
10721
+ return $('#' + this.layer.getProperty('parentid')).data('layerObject');
10722
+ };
 
 
 
10723
 
10724
+ PlacementAbsolute.prototype.subscribeParent = function () {
10725
+ var that = this;
10726
+ var $newParent = $('#' + this.layer.property.parentid);
10727
+ if (this.parent && !$newParent.is(this.parent)) {
10728
+ this.parent.off(this.subscribeParentCallbacks);
10729
+ this.parent = false;
10730
+ }
10731
+ if (!this.parent) {
10732
+ this.subscribeParentCallbacks = {
10733
+ LayerResized: function () {
10734
+ that.resizeParent.apply(that, arguments);
10735
+ },
10736
+ LayerParent: function () {
10737
+ that.$layer.addClass('n2-ss-layer-parent');
10738
+ that.$layer.triggerHandler('LayerParent');
10739
+ },
10740
+ LayerUnParent: function () {
10741
+ that.$layer.removeClass('n2-ss-layer-parent');
10742
+ that.$layer.triggerHandler('LayerUnParent');
10743
+ },
10744
+ LayerDeleted: function (e) {
10745
 
10746
+ that.layer.setProperty('parentid', '', 'layer');
10747
+ },
10748
+ LayerUnavailable: function (e) {
 
10749
 
10750
+ that.layer.setProperty('parentid', '', 'layer');
10751
+ that.layer.setProperty('left', 0, 'layer');
10752
+ that.layer.setProperty('top', 0, 'layer');
10753
+ },
10754
+ LayerShowChange: function (e, mode, value) {
10755
+ if (that.layer.getMode() == mode) {
10756
+ that.parentIsVisible = value;
10757
+ }
10758
+ },
10759
+ 'n2-ss-activate': function () {
10760
+ that.$layerRow.addClass('n2-parent-active');
10761
+ },
10762
+ 'n2-ss-deactivate': function () {
10763
+ that.$layerRow.removeClass('n2-parent-active');
10764
+ },
10765
+ 'LayerGetDataWithChildren': function (e, layersData, layers) {
10766
+ that.layer.getDataWithChildren(layersData, layers);
10767
  }
10768
+ };
10769
+ this.parent = $newParent.on(this.subscribeParentCallbacks);
10770
+ this.parent.data('layerObject').placement.current.addChild(this);
10771
+ this.$layer.addClass('n2-ss-layer-has-parent');
10772
+ }
10773
  };
10774
 
10775
+ PlacementAbsolute.prototype.unSubscribeParent = function (context) {
10776
+ this.$layerRow.removeClass('n2-parent-active');
10777
+ this.$layer.removeClass('n2-ss-layer-has-parent');
10778
+ if (this.parent) {
10779
+ this.parent.off(this.subscribeParentCallbacks);
10780
+ this.parent = false;
10781
+ this.subscribeParentCallbacks = {};
10782
+ if (context != 'delete') {
10783
+ var position = this.$layer.position();
10784
+ this._setPosition(null, null, position.left, position.top, null, null, true);
10785
+ }
10786
+ }
10787
 
10788
+ };
 
 
 
 
 
 
 
 
10789
 
10790
+ PlacementAbsolute.prototype.addChild = function (childPlacement) {
10791
+ this.children.push(childPlacement);
10792
+ };
10793
 
10794
+ PlacementAbsolute.prototype.removeChild = function (childPlacement) {
10795
+ this.children.splice($.inArray(childPlacement, this.children), 1);
10796
  };
10797
 
10798
+ PlacementAbsolute.prototype.unlink = function (e) {
10799
+ if (e) e.preventDefault();
10800
+ this.layer.setProperty('parentid', '', 'layer');
10801
+ };
10802
 
10803
+ PlacementAbsolute.prototype.parentPicked = function (parentObject, parentAlign, parentValign, align, valign) {
10804
+ this.layer.setProperty('parentid', '', 'layer');
10805
 
10806
+ this.layer.setProperty('align', align, 'layer');
10807
+ this.layer.setProperty('valign', valign, 'layer');
10808
+ this.layer.setProperty('parentalign', parentAlign, 'layer');
10809
+ this.layer.setProperty('parentvalign', parentValign, 'layer');
10810
 
10811
+ this.layer.setProperty('parentid', parentObject.requestID(), 'layer');
 
 
 
 
 
 
 
 
 
 
 
10812
 
10813
+ var undef;
10814
+ for (var device in this.layer.deviceProperty) {
10815
+ if (device == 'desktopPortrait') continue;
10816
+ this.layer.deviceProperty[device].left = undef;
10817
+ this.layer.deviceProperty[device].top = undef;
10818
+ this.layer.deviceProperty[device].valign = undef;
10819
+ this.layer.deviceProperty[device].align = undef;
10820
  }
10821
  };
10822
 
10823
+ PlacementAbsolute.prototype._syncparentid = function () {
10824
+ var value = this.layer.getProperty('parentid');
10825
+ if (!value || value == '') {
10826
+ this.$layer.removeAttr('data-parentid');
10827
+ this.unSubscribeParent();
10828
+ } else {
10829
+ //setTimeout($.proxy(function () {
10830
+ if ($('#' + value).length == 0) {
10831
+ this.layer.setProperty('parentid', '', 'layer');
10832
+ } else {
10833
+ this.$layer.attr('data-parentid', value).addClass('n2-ss-layer-has-parent');
10834
+ this.subscribeParent();
10835
+ var position = this.$layer.position();
10836
+ this._setPosition(null, null, position.left, position.top, null, null, true);
10837
+ }
10838
+ //}, this), 50);
10839
+ }
 
 
 
 
 
 
10840
  };
10841
 
10842
+ PlacementAbsolute.prototype.snap = function () {
10843
+ this.$layer.nextendResizable("option", "smartguides", $.proxy(function () {
10844
+ this.$layer.triggerHandler('LayerParent');
10845
+ return this.fragmentEditor.getSnap();
10846
+ }, this));
10847
  };
10848
 
10849
+ PlacementAbsolute.prototype._renderModeProperties = function (isReset) {
10850
+
10851
+ this.$layer.attr('data-align', this.layer.property.align);
10852
+ this.$layer.attr('data-valign', this.layer.property.valign);
10853
+ if (isReset) {
10854
+ this.onResize(true);
10855
  }
 
10856
  };
10857
 
10858
+ PlacementAbsolute.prototype.doLinearResize = function (ratios) {
10859
+ this.doThrottledTheResize(ratios, true);
 
 
10860
  };
10861
 
10862
+ PlacementAbsolute.prototype.doTheResize = function (ratios, isLinear, isThrottled) {
 
 
 
10863
 
10864
+ this.render('width');
10865
+ this.render('height');
 
 
10866
 
10867
+ this.render('left');
10868
+ this.render('top');
 
 
10869
 
10870
+ if (!isLinear) {
10871
+ this.triggerLayerResized(isThrottled, ratios);
10872
+ }
10873
  };
10874
 
10875
+ PlacementAbsolute.prototype.resizeParent = function (e, ratios, isThrottled) {
10876
+ this.addToResizeCollection(this, ratios, isThrottled);
 
10877
  };
10878
 
10879
+ PlacementAbsolute.prototype.updatePosition = function () {
10880
+ var parent = this.parent;
10881
+
10882
+ if (this.layer.getProperty('align') == 'center') {
10883
+ var left = 0;
10884
+ if (parent) {
10885
+ left = parent.position().left + parent.width() / 2;
10886
+ } else {
10887
+ left = this.$layer.parent().width() / 2;
10888
  }
10889
+ var ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
10890
+ if (!parseInt(this.layer.getProperty('responsiveposition'))) {
10891
+ ratio = 1;
10892
+ }
10893
+ this.$layer.css('left', (left - this.$layer.width() / 2 + this.layer.getProperty('left') * ratio));
10894
  }
10895
+
10896
+ if (this.layer.getProperty('valign') == 'middle') {
10897
+ var top = 0;
10898
+ if (parent) {
10899
+ top = parent.position().top + parent.height() / 2;
10900
+ } else {
10901
+ top = this.$layer.parent().height() / 2;
10902
+ }
10903
+ var ratio = this.fragmentEditor.getResponsiveRatioVertical();
10904
+ if (!parseInt(this.layer.getProperty('responsiveposition'))) {
10905
+ ratio = 1;
10906
+ }
10907
+ this.$layer.css('top', (top - this.$layer.height() / 2 + this.layer.getProperty('top') * ratio));
10908
+ }
10909
+ this.triggerLayerResized();
10910
  };
10911
 
10912
+ PlacementAbsolute.prototype.getIndex = function () {
10913
+ var index = parseInt(this.$layer.css('zIndex'));
10914
+ if (isNaN(index)) {
10915
+ index = 0;
10916
+ }
10917
+ return index;
10918
+ };
10919
+
10920
+ PlacementAbsolute.prototype.renderIndex = function (index) {
10921
+ //this.layer.layer.css('zIndex', index + 1);
10922
+ };
10923
+
10924
+ PlacementAbsolute.prototype.sync = function () {
10925
+
10926
+ this._syncalign(null, 'history');
10927
+ this._syncvalign(null, 'history');
10928
+
10929
+ this._syncwidth();
10930
+ this._syncheight();
10931
+ this._synctop();
10932
+ this._syncleft();
10933
+
10934
+ this._syncparentid();
10935
+
10936
+ };
10937
+
10938
+ PlacementAbsolute.prototype.delete = function () {
10939
+
10940
+ var parentId = this.layer.getProperty('parentid');
10941
+ if (parentId) {
10942
+ this.unSubscribeParent('delete');
10943
+ }
10944
+ };
10945
+
10946
+ PlacementAbsolute.prototype.isParentOrChild = function () {
10947
+ return this.parent || this.children.length > 0;
10948
+ };
10949
+
10950
+ return PlacementAbsolute;
10951
  });
10952
+ N2D('PlacementContent', ['PlacementAbstract'], function ($, undefined) {
10953
  "use strict";
10954
 
10955
  /**
10956
  * @memberOf N2Classes
10957
  *
10958
+ * @param placement
10959
+ * @param layer
10960
  * @param fragmentEditor
 
 
10961
  * @constructor
 
 
10962
  */
10963
+ function PlacementContent(placement, layer, fragmentEditor) {
10964
+ this.type = 'content';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10965
 
10966
+ N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
10967
  }
10968
 
10969
+ PlacementContent.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
10970
+ PlacementContent.prototype.constructor = PlacementContent;
 
 
 
 
 
10971
 
10972
+ return PlacementContent;
10973
+ });
10974
+ N2D('PlacementDefault', ['PlacementAbstract'], function ($, undefined) {
10975
+ "use strict";
10976
 
10977
+ /**
10978
+ * @memberOf N2Classes
10979
+ *
10980
+ * @param placement
10981
+ * @param layer
10982
+ * @param fragmentEditor
10983
+ * @constructor
10984
+ */
10985
+ function PlacementDefault(placement, layer, fragmentEditor) {
10986
+ this.type = 'default';
10987
 
10988
+ N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
10989
+ }
 
10990
 
10991
+ PlacementDefault.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
10992
+ PlacementDefault.prototype.constructor = PlacementDefault;
 
10993
 
10994
+ PlacementDefault.prototype.start = function () {
10995
+ this.$layer = this.layer.layer;
10996
+ };
10997
 
 
 
 
10998
 
10999
+ PlacementDefault.prototype.activated = function (properties) {
 
 
11000
 
11001
+ this.startUISizing();
11002
+ };
 
11003
 
11004
+ PlacementDefault.prototype.deActivated = function (newMode) {
11005
+ this.$layer.nUINormalSizing('destroy');
11006
  };
11007
 
11008
+ PlacementDefault.prototype.startUISizing = function () {
11009
+ var needSize = false;
11010
+ if (this.layer.item && this.layer.item.needSize) {
11011
+ needSize = true;
11012
+ }
11013
+ this.$layer.nUINormalSizing({
11014
+ start: $.proxy(function (e, prop) {
11015
+ N2Classes.PositionDisplay.get().show('NormalSizing');
11016
+ if (prop === 'maxwidth') {
11017
+ this.layer.layer.attr('data-has-maxwidth', '1');
11018
+ }
11019
+ }, this),
11020
+ resizeMaxWidth: $.proxy(function (e, ui) {
11021
 
11022
+ N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Max-width: ' + (ui.value == 0 ? 'none' : (ui.value + 'px')));
11023
 
11024
+ }, this),
11025
+ stopMaxWidth: $.proxy(function (e, ui) {
11026
+ N2Classes.PositionDisplay.get().hide('NormalSizing');
11027
+ this.layer.setProperty('maxwidth', ui.value);
11028
+ }, this)
11029
+ });
11030
+ };
11031
 
11032
+ return PlacementDefault;
11033
+ });
11034
+ N2D('PlacementNormal', ['PlacementAbstract'], function ($, undefined) {
11035
+ "use strict";
11036
 
11037
+ /**
11038
+ * @memberOf N2Classes
11039
+ *
11040
+ * @param placement
11041
+ * @param layer
11042
+ * @param fragmentEditor
11043
+ * @constructor
11044
+ * @augments PlacementAbstract
11045
 
11046
+ */
11047
+ function PlacementNormal(placement, layer, fragmentEditor) {
11048
+ this.type = 'normal';
11049
 
11050
+ this.transferredProperties = {};
11051
 
11052
+ N2Classes.PlacementAbstract.prototype.constructor.apply(this, arguments);
11053
+ }
11054
 
11055
+ PlacementNormal.prototype = Object.create(N2Classes.PlacementAbstract.prototype);
11056
+ PlacementNormal.prototype.constructor = PlacementNormal;
 
11057
 
11058
+ PlacementNormal.prototype.start = function () {
11059
+ this.$layer = this.layer.layer;
11060
+ };
11061
 
11062
+ PlacementNormal.prototype.preActivation = function (lastPlacement) {
11063
+ if (lastPlacement.type == 'absolute' && this.layer.item && this.layer.item.needSize) {
11064
+ var height = this.layer.getProperty('height');
11065
+ if (height.match && height.match(/[0-9]+%$/)) {
11066
+ this.transferredProperties.height = Math.max(100, parseInt(this.$layer.parent().height() * parseInt(height) / 100));
11067
+ } else if (height > 0) {
11068
+ this.transferredProperties.height = height;
 
11069
  }
11070
  }
11071
  };
11072
 
11073
+ PlacementNormal.prototype.activated = function (properties) {
11074
+ this.loadProperties($.extend(properties, this.transferredProperties));
11075
+ this.transferredProperties = {};
 
 
11076
 
11077
+ this.layer.$.on('baseSizeUpdated.placementnormal', $.proxy(this._syncmargin, this));
11078
+ this.layer.$.on('baseSizeUpdated.placementnormal', $.proxy(this._syncheight, this));
11079
 
11080
+ this.startUISpacing();
 
 
 
11081
 
11082
+ this.startUISizing();
11083
 
11084
+ this.$layer.on({
11085
+ mousedown: $.proxy(function (e) {
11086
+ e.stopPropagation();
11087
+ })
11088
+ });
11089
+ };
11090
 
11091
+ PlacementNormal.prototype.loadProperties = function (options) {
11092
+ this.layer.createDeviceProperty('margin', {desktopPortrait: '0|*|0|*|0|*|0|*|px+'}, this.layer.layer, this);
11093
+ this.layer.createDeviceProperty('height', {desktopPortrait: (options.height || 0)}, this.layer.layer, this);
11094
+ this.layer.createDeviceProperty('maxwidth', {desktopPortrait: 0}, this.layer.layer, this);
11095
+ this.layer.createDeviceProperty('selfalign', {desktopPortrait: 'inherit'}, this.layer.layer, this);
 
 
11096
  };
11097
 
11098
+ PlacementNormal.cleanLayer = function ($layer) {
11099
+ var devices = [
11100
+ 'desktopPortrait',
11101
+ 'desktopLandscape',
11102
+ 'tabletPortrait',
11103
+ 'tabletLandscape',
11104
+ 'mobilePortrait',
11105
+ 'mobileLandscape'
11106
+ ];
11107
 
11108
+ $layer
11109
+ .attr('data-has-maxwidth', '0')
11110
+ .removeAttr('data-cssselfalign')
11111
+ .css({
11112
+ position: '',
11113
+ margin: '',
11114
+ height: '',
11115
+ maxWidth: ''
11116
+ });
11117
 
11118
+ var properties = ['margin', 'height', 'maxwidth', 'selfalign'];
 
 
 
11119
 
11120
+ var data = {};
11121
+ for (var i = 0; i < properties.length; i++) {
11122
+ var prop = properties[i].toLowerCase();
11123
+ data[prop] = $layer.data(prop);
11124
+ $layer.removeAttr(prop);
11125
+ $layer.removeData(prop);
11126
+ for (var j = 0; j < devices.length; j++) {
11127
+ var device = devices[j].toLowerCase();
11128
+ data[prop] = $layer.data(device + prop);
11129
+ $layer.removeAttr(device + prop);
11130
+ $layer.removeData(device + prop);
11131
+ }
11132
  }
11133
+ return data;
11134
  };
11135
 
11136
+ PlacementNormal.prototype.deActivated = function (newMode) {
11137
+ this.layer.$.off('.placementnormal');
11138
+ this.$layer.nUISpacing('destroy');
11139
+ this.$layer.nUINormalSizing('destroy');
11140
 
11141
+ this.layer.layer.attr('data-has-maxwidth', '0');
11142
+ this.layer.layer.removeAttr('data-cssselfalign');
 
 
 
11143
 
11144
+ var properties = ['margin', 'height', 'maxwidth', 'selfalign'],
11145
+ historicalData = this.layer.getPropertiesData(properties);
11146
+ this.layer.removeProperties(properties);
11147
 
 
 
 
 
 
11148
 
11149
+ this.layer.layer.css({
11150
+ position: '',
11151
+ margin: '',
11152
+ height: '',
11153
+ maxWidth: ''
11154
+ });
11155
+ return historicalData;
11156
  };
11157
 
11158
+ PlacementNormal.prototype._renderModeProperties = function (isReset) {
 
 
11159
 
11160
+ this._syncmargin();
11161
+ this._syncheight();
11162
+ this._syncmaxwidth();
11163
+ this._syncselfalign();
11164
+ };
 
11165
 
11166
+ PlacementNormal.prototype._syncmargin = function () {
11167
+ var margin = this.layer.getProperty('margin').split('|*|'),
11168
+ unit = margin.pop(),
11169
+ baseSize = this.layer.baseSize;
11170
+
11171
+ if (unit == 'px+' && baseSize > 0) {
11172
+ unit = 'em';
11173
+ for (var i = 0; i < margin.length; i++) {
11174
+ margin[i] = parseInt(margin[i]) / baseSize;
11175
  }
11176
+ }
11177
 
11178
+ var margin = margin.join(unit + ' ') + unit;
11179
+ this.layer.layer.css('margin', margin);
11180
+ this.layer.update();
 
 
 
 
 
11181
 
11182
+ this.$layer.nUISpacing('option', 'current', margin);
11183
+ };
 
 
11184
 
11185
+ PlacementNormal.prototype.startUISpacing = function () {
11186
+ this.$layer.nUISpacing({
11187
+ mode: 'margin',
11188
+ sync: {
11189
+ n: 'margin-top',
11190
+ e: 'margin-right',
11191
+ s: 'margin-bottom',
11192
+ w: 'margin-left',
11193
+ },
11194
+ handles: 'n, s, e, w',
11195
+ start: $.proxy(function (e, ui) {
11196
+ N2Classes.PositionDisplay.get().show('Spacing');
11197
+ }, this),
11198
+ spacing: $.proxy(function (e, ui) {
11199
+ var html = '';
11200
+ for (var k in ui.changed) {
11201
+ html += 'Margin ' + k + ': ' + ui.changed[k] + 'px<br>';
11202
+ }
11203
 
11204
+ N2Classes.PositionDisplay.get().update(e, 'Spacing', html);
11205
+ }, this),
11206
+ stop: $.proxy(this.onSpacingStop, this),
11207
+ });
11208
+ };
11209
 
11210
+ PlacementNormal.prototype.onSpacingStop = function (event, ui) {
11211
+ N2Classes.PositionDisplay.get().hide('Spacing');
11212
+ var margin = this.layer.getProperty('margin').split('|*|'),
11213
+ ratioH = 1,
11214
+ ratioV = 1;
11215
+ if (margin[margin.length - 1] == 'px+' && Math.abs(parseFloat(this.$layer.css('fontSize')) - this.layer.baseSize) > 1) {
11216
+ ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
11217
+ ratioV = this.fragmentEditor.getResponsiveRatioVertical();
11218
  }
11219
 
11220
+ for (var k in ui.changed) {
11221
+ var value = ui.changed[k];
11222
+ switch (k) {
11223
+ case 'top':
11224
+ margin[0] = Math.round(value / ratioV);
11225
+ break;
11226
+ case 'right':
11227
+ margin[1] = Math.round(value / ratioH);
11228
+ break;
11229
+ case 'bottom':
11230
+ margin[2] = Math.round(value / ratioV);
11231
+ break;
11232
+ case 'left':
11233
+ margin[3] = Math.round(value / ratioH);
11234
+ break;
11235
  }
 
11236
  }
11237
+ this.layer.setProperty('margin', margin.join('|*|'));
11238
+ $('#layernormal-margin').data('field').insideChange(margin.join('|*|'));
 
11239
  };
11240
 
11241
+ PlacementNormal.prototype.startUISizing = function () {
11242
+ var needSize = false;
11243
+ if (this.layer.item && this.layer.item.needSize) {
11244
+ needSize = true;
 
 
 
 
 
11245
  }
11246
+ this.$layer.nUINormalSizing({
11247
+ height: needSize,
11248
+ syncWidth: true,
11249
+ start: $.proxy(function (e, prop) {
11250
+ N2Classes.PositionDisplay.get().show('NormalSizing');
11251
+ if (prop === 'maxwidth') {
11252
+ this.layer.layer.attr('data-has-maxwidth', '1');
11253
+ }
11254
+ }, this),
11255
+ resizeMaxWidth: $.proxy(function (e, ui) {
11256
+ N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Max-width: ' + (ui.value == 0 ? 'none' : (ui.value + 'px')));
11257
 
11258
+ }, this),
11259
+ stopMaxWidth: $.proxy(function (e, ui) {
11260
+ N2Classes.PositionDisplay.get().hide('NormalSizing');
11261
+ this.layer.setProperty('maxwidth', ui.value);
11262
+ }, this),
11263
+ resizeHeight: $.proxy(function (e, ui) {
11264
+ N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Height: ' + ui.value + 'px');
11265
 
11266
+ }, this),
11267
+ stopHeight: $.proxy(function (e, ui) {
11268
+ N2Classes.PositionDisplay.get().hide('NormalSizing');
11269
+ var ratio = 1;
11270
+ if (parseInt(this.$layer.css('fontSize')) != this.layer.baseSize) {
11271
+ ratio = this.fragmentEditor.getResponsiveRatioHorizontal();
11272
+ }
11273
+ var value = Math.round(value / ratio);
11274
 
11275
+ this.layer.setProperty('height', ui.value);
11276
+ }, this)
11277
+ });
11278
+ };
11279
+
11280
+ PlacementNormal.prototype._syncheight = function () {
11281
+ var height = parseInt(this.layer.getProperty('height'));
11282
+
11283
+ if (height > 0) {
11284
+ var unit = 'px',
11285
+ baseSize = this.layer.baseSize;
11286
+ if (baseSize > 0) {
11287
+ unit = 'em';
11288
+ height = parseInt(height) / baseSize;
11289
  }
 
 
11290
 
11291
+ this.layer.layer.css('height', height + unit);
11292
+ } else {
11293
+
11294
+ this.layer.layer.css('height', '');
11295
  }
11296
+
11297
+ this.layer.update();
11298
  };
11299
 
11300
+ PlacementNormal.prototype._syncmaxwidth = function () {
11301
+ var value = parseInt(this.layer.getProperty('maxwidth'));
11302
+ if (value <= 0 || isNaN(value)) {
11303
+ this.layer.layer.css('maxWidth', '')
11304
+ .attr('data-has-maxwidth', '0');
11305
  } else {
11306
+ this.layer.layer.css('maxWidth', value + 'px')
11307
+ .attr('data-has-maxwidth', '1');
11308
  }
11309
+
11310
+ this.layer.update();
11311
  };
11312
 
11313
+ PlacementNormal.prototype._syncselfalign = function () {
11314
+ this.layer.layer.attr('data-cssselfalign', this.layer.getProperty('selfalign'));
11315
+ };
11316
 
11317
+ PlacementNormal.prototype.sync = function () {
11318
+ this._syncmargin();
11319
+ this._syncheight();
11320
+ this._syncmaxwidth();
11321
  };
11322
 
11323
+ return PlacementNormal;
11324
+ });
11325
+ N2D('Placement', function ($, undefined) {
11326
+ "use strict";
11327
 
11328
+ /**
11329
+ * @memberOf N2Classes
11330
+ *
11331
+ * @param layer
11332
+ * @constructor
11333
+ */
11334
+ function Placement(layer) {
11335
+ this.layer = layer;
11336
+ this.fragmentEditor = layer.fragmentEditor;
11337
+ this.modes = {};
11338
+ this.current = null;
11339
+ this.isTransferHandled = false;
11340
+
11341
+ this.updatePositionThrottled = NextendDeBounce(this.updatePosition, 200);
11342
+ }
11343
+
11344
+ Placement.prototype.allow = function (mode) {
11345
+ switch (mode) {
11346
+ case 'absolute':
11347
+ this.modes.absolute = new N2Classes.PlacementAbsolute(this, this.layer, this.fragmentEditor);
11348
+ break;
11349
+ case 'normal':
11350
+ this.modes.normal = new N2Classes.PlacementNormal(this, this.layer, this.fragmentEditor);
11351
+ break;
11352
+ case 'group':
11353
+ this.modes.absolute = new N2Classes.PlacementGroup(this, this.layer, this.fragmentEditor);
11354
+ break;
11355
+ case 'content':
11356
+ this.modes.absolute = new N2Classes.PlacementContent(this, this.layer, this.fragmentEditor);
11357
+ break;
11358
+ case 'default':
11359
+ this.modes['default'] = new N2Classes.PlacementDefault(this, this.layer, this.fragmentEditor);
11360
+ break;
11361
+ }
11362
  };
11363
 
11364
+ Placement.prototype.start = function () {
11365
+ for (var k in this.modes) {
11366
+ this.modes[k].start();
11367
+ }
11368
+ };
11369
 
11370
+ Placement.prototype.setMode = function (mode, properties) {
11371
+ var historicalData = false;
11372
+ properties = properties || {};
11373
+ if (typeof this.modes[mode] !== 'undefined') {
11374
+ if (this.current != this.modes[mode]) {
11375
+ var lastType;
11376
+ if (this.current) {
11377
+
11378
+ this.modes[mode].preActivation(this.current);
11379
+ lastType = this.current.type;
11380
+ historicalData = this.current.deActivated(this.modes[mode]);
11381
+ }
11382
+ this.current = this.modes[mode];
11383
+
11384
+ this.layer.layer.attr('data-pm', this.current.type);
11385
+ this.current.activated(properties);
11386
+
11387
+ this.layer.$.triggerHandler('placementChanged', [this.current.type, lastType]);
11388
+ }
11389
+ } else {
11390
+ throw new Exception('Layer placement(' + mode + ') not allowed for the container', this.layer);
11391
+ }
11392
+ return historicalData;
11393
  };
11394
 
11395
+ Placement.prototype.doAction = function (action) {
11396
+ try {
11397
+ return this.current[action].apply(this.current, Array.prototype.slice.call(arguments, 1));
11398
+ } catch (e) {
11399
 
11400
+ }
 
 
 
 
11401
  };
11402
 
11403
+ Placement.prototype.getType = function () {
11404
+ return this.current.type;
11405
  };
11406
 
11407
+ Placement.prototype.onResize = function (isForced) {
11408
+ if (typeof this.current.onResize == 'function') {
11409
+ this.current.onResize(isForced);
11410
+ }
11411
+ };
11412
+
11413
+ Placement.prototype.updatePosition = function () {
11414
+ this.current.updatePosition();
11415
+ };
11416
+
11417
+ Placement.prototype.getIndex = function () {
11418
+ return this.current.getIndex();
11419
+ };
11420
+
11421
+ Placement.prototype.renderIndex = function (index) {
11422
+ return this.current.renderIndex(index);
11423
+ };
11424
+
11425
+ Placement.prototype.doLinearResize = function (ratios) {
11426
+ this.current.doLinearResize(ratios);
11427
+ };
11428
+
11429
+ Placement.prototype.sync = function () {
11430
+ this.current.sync();
11431
+ };
11432
+
11433
+ Placement.prototype.renderModeProperties = function (isReset) {
11434
+
11435
+ var fontSize = this.layer.getProperty('fontsize');
11436
+ this.layer.adjustFontSize(this.layer.getProperty('adaptivefont'), fontSize, false);
11437
+
11438
+ this.current._renderModeProperties(isReset);
11439
+ };
11440
+
11441
+ Placement.prototype.delete = function () {
11442
+ this.current.delete();
11443
+ };
11444
+
11445
+ return Placement;
11446
  });
11447
+ N2D('PlacementAbstract', ['Placement'], function ($, undefined) {
 
11448
  "use strict";
11449
 
 
 
 
11450
  /**
11451
  * @memberOf N2Classes
11452
  *
11453
+ * @param placement
11454
+ * @param {N2Classes.ComponentAbstract} layer
11455
+ * @param fragmentEditor
11456
  * @constructor
 
 
 
 
 
11457
  */
11458
+ function PlacementAbstract(placement, layer, fragmentEditor) {
11459
+ this.placement = placement;
11460
+ /**
11461
+ * @type {N2Classes.ComponentAbstract}
11462
+ */
11463
+ this.layer = layer;
11464
+ this.fragmentEditor = fragmentEditor;
11465
+ }
11466
 
11467
+ PlacementAbstract.prototype.start = function () {
 
 
 
 
 
 
 
 
 
11468
 
11469
+ };
11470
 
11471
+ PlacementAbstract.prototype.preActivation = function (lastPlacement) {
11472
 
11473
+ };
 
11474
 
11475
+ PlacementAbstract.prototype.activated = function () {
11476
 
11477
+ };
 
11478
 
11479
+ PlacementAbstract.prototype.deActivated = function (newMode) {
11480
 
11481
+ return false;
11482
+ };
11483
 
11484
+ PlacementAbstract.prototype.updatePosition = function () {
11485
+ this.layer.group.update();
11486
+ };
11487
 
11488
+ PlacementAbstract.prototype._renderModeProperties = function (isReset) {
11489
 
11490
+ };
 
11491
 
11492
+ PlacementAbstract.prototype._hide = function () {
11493
+ };
11494
 
11495
+ PlacementAbstract.prototype._show = function () {
11496
+ };
11497
 
11498
+ PlacementAbstract.prototype.snap = function () {
11499
+ return false;
 
 
 
11500
  };
11501
 
11502
+ PlacementAbstract.prototype.getIndex = function () {
11503
+ return this.layer.layer.index();
 
 
 
11504
  };
11505
 
11506
+ PlacementAbstract.prototype.renderIndex = function (index) {
11507
 
11508
+ };
 
 
11509
 
11510
+ PlacementAbstract.prototype.doLinearResize = function (ratios) {
11511
+ };
 
11512
 
11513
+ PlacementAbstract.prototype.sync = function () {
 
 
11514
 
11515
+ };
 
 
11516
 
11517
+ PlacementAbstract.prototype.delete = function () {
11518
+ };
 
 
11519
 
 
 
 
 
 
 
 
 
 
 
11520
 
11521
+ PlacementAbstract.prototype.triggerLayerResized = function (isThrottled, ratios) {
 
 
 
 
 
 
 
 
 
11522
 
 
 
 
 
 
 
 
 
 
 
11523
  };
11524
 
11525
+ PlacementAbstract.prototype.changeStatus = function (oldStatus, newStatus) {
 
 
11526
 
 
 
 
11527
  };
11528
 
11529
+ return PlacementAbstract;
11530
+ });
11531
+ N2D('Item', function ($, undefined) {
11532
+ "use strict";
11533
 
11534
+ /**
11535
+ * @memberOf N2Classes
11536
+ * @augments N2Classes.Historical
11537
+ *
11538
+ * @constructor
11539
+ */
11540
+ function Item($item, layer, itemEditor) {
11541
+ if (this.type === undefined) {
11542
+ this.type = $item.data('item');
11543
+ }
11544
 
11545
+ this.needSize = this.constructor.needSize;
 
 
 
 
11546
 
11547
+ this.fragmentEditor = itemEditor.fragmentEditor;
11548
+ /**
11549
+ * @type {N2Classes.Generator}
11550
+ */
11551
+ this.generator = this.fragmentEditor.editor.generator;
11552
 
11553
+ this.self = this;
11554
+ this.$item = $item;
11555
+ this.layer = layer;
11556
+ this.itemEditor = itemEditor;
11557
 
11558
+ this.fonts = [];
11559
+ this.styles = [];
 
 
 
 
 
 
 
 
11560
 
11561
+ this.needFill = [];
11562
 
11563
+ this.values = this.$item.data('itemvalues');
11564
+ if (typeof this.values !== 'object') {
11565
+ this.values = $.parseJSON(this.values);
11566
  }
11567
 
11568
+ this.pre = 'div#' + this.fragmentEditor.editor.frontend.elementID + ' ';
11569
+ this.defaultValues = itemEditor.getItemForm(this.type).values;
11570
 
11571
+ this.added();
11572
 
11573
+ this.$item.data('item', this);
 
11574
 
11575
+ this.$item.appendTo(this.layer.getContent());
11576
 
11577
+ this.layer.item = this;
 
11578
 
11579
+ if (this.$item.children().length === 0) {
11580
+ // It's create, so render the item
11581
+ this.layer.readyDeferred.done($.proxy(this.reRender, this));
11582
+ }
11583
 
 
11584
 
11585
+ $('<div/>')
11586
+ .addClass('n2-ss-item-overlay')
11587
+ .css('zIndex', 89)
11588
+ .appendTo(this.$item);
11589
 
11590
+ this.$item.find('a').on('click', function (e) {
11591
+ e.preventDefault();
11592
+ });
11593
 
 
11594
 
11595
+ $(window).trigger('ItemCreated');
11596
+ }
11597
 
11598
+ Item.needSize = false;
 
 
 
 
 
11599
 
11600
+ N2Classes.Historical(Item);
11601
+
11602
+ Item.prototype.changeValue = function (property, value) {
11603
+ if (this == this.itemEditor.activeItem) {
11604
+ $('#item_' + this.type + property).data('field')
11605
+ .insideChange(value);
11606
+ } else {
11607
+ this.values[property] = value;
11608
  }
11609
  };
11610
 
11611
+ Item.prototype.activate = function (e, context, force) {
11612
+ if (this.itemEditor.setActiveItem(this, context, force)) {
11613
+ nextend.basicCSS.activate('ss3item' + this.type, this.values, {
11614
+ font: this.fonts,
11615
+ style: this.styles
11616
+ });
11617
+ this.itemEditor.lastValues[this.type] = this.values;
11618
  }
11619
+ };
11620
 
11621
+ Item.prototype.deActivate = function () {
11622
+ nextend.basicCSS.deActivate();
11623
+ };
11624
 
11625
+ Item.prototype.render = function (data, originalData) {
11626
+ this.layer.layer.triggerHandler('itemRender');
11627
+ this.$item.html('');
11628
 
11629
+ this.parseAll(data);
11630
+ this._render(data);
11631
 
11632
+ // These will be available on the backend render
11633
+ this.itemEditor.lastValues[this.type] = this.values = originalData;
11634
 
11635
+ $('<div/>')
11636
+ .addClass('n2-ss-item-overlay')
11637
+ .css('zIndex', 89)
11638
+ .appendTo(this.$item);
11639
 
11640
+ var layerName = this.getName(data);
11641
+ if (layerName === false || layerName == '' || layerName == 'Layer') {
11642
+ layerName = this.type;
11643
+ } else {
11644
+ layerName = layerName.replace(/[<>]/gi, '');
11645
  }
11646
+ this.layer.rename(layerName, false);
11647
 
11648
+ this.layer.update();
 
 
 
11649
 
11650
+ this.$item.find('a').on('click', function (e) {
11651
+ e.preventDefault();
11652
+ });
11653
  };
11654
 
11655
+ Item.prototype._render = function (data) {
11656
+ };
11657
 
11658
+ Item.prototype.reRender = function (newData) {
 
 
11659
 
11660
+ this.values = $.extend({}, this.getDefault(), this.values, newData);
11661
 
11662
+ this.render($.extend({}, this.values), this.values);
 
 
 
11663
  };
11664
 
11665
+ Item.prototype.delete = function () {
11666
+ this.$item.trigger('mouseleave');
11667
+ this.$item.remove();
11668
 
11669
+ if (this.itemEditor.activeItem == this) {
11670
+ this.itemEditor.activeItem = null;
11671
+ }
11672
  };
11673
 
11674
+ Item.prototype.getHTML = function (base64) {
11675
+ var item = '';
11676
+ if (base64) {
 
 
 
 
11677
 
11678
+ item = '[' + this.type + ' values="' + N2Classes.Base64.encode(JSON.stringify(this.values)) + '"]';
11679
+ } else {
11680
+ item = $('<div class="n2-ss-item n2-ss-item-' + this.type + '"></div>')
11681
+ .attr('data-item', this.type)
11682
+ .attr('data-itemvalues', JSON.stringify(this.values));
11683
  }
11684
+ return item;
 
11685
  };
11686
 
11687
+ Item.prototype.getData = function () {
11688
+ return {
11689
+ type: this.type,
11690
+ values: this.values
11691
+ };
11692
+ };
11693
 
 
 
 
11694
 
11695
+ Item.prototype.getDefault = function () {
11696
+ return {};
11697
+ };
11698
 
11699
+ Item.prototype.added = function () {
11700
 
 
11701
  };
11702
 
11703
+ Item.prototype.addedFont = function (mode, name) {
11704
+ var $input = $('#item_' + this.type + name);
11705
+ if ($input.length) {
11706
+ this.fonts.push({
11707
+ mode: mode,
11708
+ name: name,
11709
+ field: $input.data('field'),
11710
+ def: this.defaultValues[name]
11711
+ });
11712
+ $.when(nextend.fontManager.addVisualUsage(mode, this.values[name], this.pre))
11713
+ .done($.proxy(function (existsFont) {
11714
+ if (!existsFont) {
11715
+ this.changeValue(name, '');
11716
+ }
11717
+ }, this));
 
11718
  }
11719
  };
11720
 
11721
+ Item.prototype.addedStyle = function (mode, name) {
11722
+ var $input = $('#item_' + this.type + name);
11723
+ if ($input.length) {
11724
+ this.styles.push({
11725
+ mode: mode,
11726
+ name: name,
11727
+ field: $input.data('field'),
11728
+ def: this.defaultValues[name]
11729
+ });
11730
 
11731
+ $.when(nextend.styleManager.addVisualUsage(mode, this.values[name], this.pre))
11732
+ .done($.proxy(function (existsStyle) {
11733
+ if (!existsStyle) {
11734
+ this.changeValue(name, '');
11735
+ }
11736
+ }, this));
11737
  }
 
 
 
 
 
 
11738
 
11739
+ };
11740
 
11741
+ Item.prototype.parseAll = function (data) {
11742
 
11743
+ for (var i = 0; i < this.fonts.length; i++) {
11744
+ data[this.fonts[i].name + 'class'] = nextend.fontManager.getClass(data[this.fonts[i].name], this.fonts[i].mode) + ' ';
11745
  }
11746
 
11747
+ for (var i = 0; i < this.styles.length; i++) {
11748
+ data[this.styles[i].name + 'class'] = nextend.styleManager.getClass(data[this.styles[i].name], this.styles[i].mode) + ' ';
11749
+ }
 
11750
 
11751
+ for (var i = 0; i < this.needFill.length; i++) {
11752
+ if (typeof data[this.needFill[i]] !== 'undefined') {
11753
+ data[this.needFill[i]] = this.generator.fill(data[this.needFill[i]] + '');
11754
+ }
11755
  }
 
11756
  };
11757
 
11758
+ Item.prototype.getName = function (data) {
11759
+ return 'Layer';
11760
  };
11761
 
11762
+ Item.prototype.resizeLayerToImage = function (image) {
11763
+ var layer = this.layer,
11764
+ $image = $("<img/>")
11765
+ .attr("src", image)
11766
+ .on('load', $.proxy(function () {
11767
+ var width = $image[0].width,
11768
+ height = $image[0].height;
11769
 
11770
+ if (width > 0 && height > 0) {
11771
+ var $containerElement = this.fragmentEditor.editor.getMainContainerElement(),
11772
+ maxWidth = $containerElement.width(),
11773
+ maxHeight = $containerElement.height();
 
 
 
 
 
 
11774
 
11775
+ if (width > maxWidth) {
11776
+ height = height * maxWidth / width;
11777
+ width = maxWidth;
11778
+ }
11779
+ if (height > maxHeight) {
11780
+ width = width * maxHeight / height;
11781
+ //height = maxHeight;
11782
+ }
11783
+ N2Classes.History.get().off();
11784
+ layer.setProperty('width', width);
11785
+ layer.setProperty('height', 'auto');
11786
+ N2Classes.History.get().on();
 
 
 
 
11787
  }
11788
+ }, this));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11789
  };
11790
 
11791
+ Item.prototype.fitLayer = function (item) {
11792
+ return false;
 
 
 
 
 
 
 
 
11793
  };
11794
 
11795
+ return Item;
11796
+ });
11797
+ N2D('ItemManager', function ($, undefined) {
11798
+ "use strict";
 
 
 
 
11799
 
11800
+ /**
11801
+ * @memberOf N2Classes
11802
+ *
11803
+ * @param {N2Classes.FragmentEditor} fragmentEditor
11804
+ * @param options
11805
+ * @constructor
11806
+ */
11807
+ function ItemManager(fragmentEditor, options) {
11808
+ this.suppressChange = false;
11809
 
11810
+ this.activeItemOriginalData = null;
 
 
 
 
11811
 
11812
+ this.fragmentEditor = fragmentEditor;
 
 
 
 
11813
 
11814
+ this.lastValues = {};
 
 
11815
 
11816
+ this.startItems();
 
 
 
 
11817
 
11818
+ this.forms = {};
11819
+ this.activeForm = false;
11820
 
11821
+ if (!options.isUploadDisabled) {
11822
+ var dropArea = $('#n2-ss-slide-canvas-container-inner');
11823
+ dropArea.nUIFileUpload({
11824
+ url: options.uploadUrl,
11825
+ pasteZone: false,
11826
+ dropZone: dropArea,
11827
+ dataType: 'json',
11828
+ paramName: 'image',
11829
+ add: function (e, data) {
11830
+ data.formData = {path: '/' + options.uploadDir};
11831
+ data.submit();
11832
+ },
11833
+ done: $.proxy(function (e, data) {
11834
+ var response = data.result;
11835
+ if (response.data && response.data.name) {
11836
+ var item = this.createLayerItem(false, {item: 'image'});
11837
+ item.reRender({
11838
+ image: response.data.url
11839
+ });
11840
+ item.activate(null, null, true);
11841
+ } else {
11842
+ N2Classes.AjaxHelper.notification(response);
11843
+ }
11844
 
11845
+ }, this),
11846
+ fail: function (e, data) {
11847
+ N2Classes.AjaxHelper.notification(data.jqXHR.responseJSON);
11848
+ },
11849
+
11850
+ start: function () {
11851
+ N2Classes.AjaxHelper.startLoading();
11852
+ },
11853
+
11854
+ stop: function () {
11855
+ setTimeout(function () {
11856
+ N2Classes.AjaxHelper.stopLoading();
11857
+ }, 100);
11858
+ }
11859
+ });
11860
  }
11861
+ }
11862
 
11863
+ ItemManager.prototype.setActiveItem = function (item, context, force) {
11864
+ // Must be called through N2Classes.Item.activate();
11865
+ if (item != this.activeItem || force) {
11866
+ this.activeItemOriginalData = null;
11867
 
11868
+ var type = item.type;
 
11869
 
11870
+ if (this.activeForm) {
11871
+ this.activeForm.form.css('display', 'none');
 
 
 
 
 
 
 
 
 
 
 
11872
  }
 
11873
 
11874
+ if (this.activeItem) {
11875
+ this.activeItem.deActivate();
11876
+ }
 
 
 
 
 
 
 
 
 
11877
 
11878
+ this.activeForm = this.getItemForm(type);
11879
 
11880
+ var values = $.extend({}, this.activeForm.values, item.values);
 
 
11881
 
11882
+ this.activeItem = item;
11883
 
11884
+ this.suppressChange = true;
 
11885
 
11886
+ for (var key in values) {
11887
+ var field = $('#item_' + type + key).data('field');
11888
+ if (field) {
11889
+ field.insideChange(values[key]);
11890
+ }
11891
+ }
11892
 
11893
+ this.suppressChange = false;
 
 
11894
 
11895
+ this.activeForm.form.css('display', 'block');
11896
+ this.focusFirst(context);
11897
+ return true;
 
 
11898
  }
11899
+ //this.focusFirst(context);
11900
+ return false;
11901
  };
11902
 
11903
+ ItemManager.prototype.focusFirst = function (context) {
11904
+ var field = this.activeForm.fields.eq(0).data('field');
11905
+ if (this.fragmentEditor.editor.generator.isDynamicSlide() && field.connectedField && field.connectedField instanceof N2Classes.FormElementImage) {
 
 
 
 
11906
 
11907
+ } else {
11908
+ field.focus(typeof context !== 'undefined' && context);
 
 
 
11909
  }
11910
  };
11911
 
11912
+ ItemManager.prototype.startItems = function () {
 
 
 
 
11913
 
11914
+ $('.n2-ss-core-item').nUICanvasItem({
11915
+ canvasUIManager: this.fragmentEditor.mainContainer.canvasUIManager,
11916
+ distance: 5,
11917
+ $layer: function () {
11918
+ return this.element.clone();
11919
+ },
11920
+ onCreate: $.proxy(function (e, itemOptions, targetContainer, targetIndex) {
11921
+ switch (targetContainer.layer.type) {
11922
+ case 'content':
11923
+ case 'col':
11924
+ N2Classes.History.get().startBatch();
11925
+ var item = this.createLayerItem(targetContainer.layer, itemOptions.$layer.data(), 'click');
11926
+ N2Classes.History.get().addControl('skipForwardUndos');
11927
 
11928
+ targetContainer.layer.container.insertLayerAt(item.layer, targetIndex);
11929
+ item.layer.changeGroup(false, targetContainer.layer);
11930
 
11931
+ N2Classes.History.get().endBatch();
 
 
11932
 
11933
+ break;
 
 
 
11934
 
11935
+ case 'row':
11936
+ var col = targetContainer.layer.createCol();
11937
+ targetContainer.layer.moveCol(col.getIndex(), targetIndex);
11938
 
11939
+ N2Classes.History.get().startBatch();
11940
+ var item = this.createLayerItem(col, itemOptions.$layer.data(), 'click');
11941
+ N2Classes.History.get().addControl('skipForwardUndos');
11942
 
11943
+ col.container.insertLayerAt(item.layer, 0);
11944
+ item.layer.changeGroup(false, col);
 
 
 
 
 
 
 
11945
 
11946
+ N2Classes.History.get().endBatch();
 
 
11947
 
11948
+ break;
11949
+ default:
11950
+ var mainContainerOffset = this.fragmentEditor.mainContainer.layer.offset(),
11951
+ item = this.createLayerItem(this.fragmentEditor.mainContainer, itemOptions.$layer.data(), 'click');
11952
+ item.layer.placement.current.setPosition(e.pageX - mainContainerOffset.left - 20, e.pageY - mainContainerOffset.top - 20);
11953
 
11954
+ break;
11955
+ }
11956
+ }, this),
11957
+ start: function () {
11958
+ $('#n2-ss-add-sidebar').removeClass('n2-active');
11959
+ }
11960
+ }).on('click', $.proxy(function (e) {
11961
+ this.createLayerItem(this.fragmentEditor.mainContainer.getActiveGroup(), $(e.currentTarget).data(), 'click');
11962
+ }, this));
11963
 
 
11964
 
11965
+ $('[data-itemshortcut]').on({
11966
+ click: $.proxy(function (e) {
11967
+ e.preventDefault();
11968
+ $('.n2-ss-core-item[data-item="' + $(e.currentTarget).data('itemshortcut') + '"]').trigger('click');
11969
+ }, this),
11970
+ mousedown: $.proxy(function (e) {
11971
+ $('.n2-ss-core-item[data-item="' + $(e.currentTarget).data('itemshortcut') + '"]').trigger(e);
11972
+ }, this)
11973
+ });
11974
 
11975
+ $('[data-structureshortcut]').on({
11976
+ click: $.proxy(function (e) {
11977
+ e.preventDefault();
11978
+ $('.n2-ss-add-layer-button').trigger('click');
11979
+ $('#n2-ss-layers-switcher > .n2-labels .n2-td').eq(1).trigger('click');
11980
+ }, this),
11981
+ mousedown: $.proxy(function (e) {
11982
+ $('.n2-ss-core-item[data-sstype="' + $(e.currentTarget).data('structureshortcut') + '"]').trigger(e);
11983
+ }, this)
11984
+ });
11985
+ };
11986
 
11987
+ ItemManager.prototype.createLayerItem = function (group, data, interaction, props) {
11988
+ group = group || this.fragmentEditor.mainContainer.getActiveGroup();
11989
+ var type = data.item;
11990
+ if (type === 'structure') {
11991
+ var layer = new N2Classes.Row(this.fragmentEditor, group, {});
11992
+ layer.create(data.sstype);
11993
+ layer.hightlightStructure();
11994
 
11995
+ return {
11996
+ layer: layer
11997
+ };
11998
+ } else {
11999
+ var itemData = this.getItemForm(type),
12000
+ extraValues = {};
12001
+ switch (type) {
12002
+ case 'image':
12003
+ if (group.container.allowedPlacementMode === 'absolute') {
12004
+ extraValues.size = '100%|*|auto';
12005
+ } else {
12006
+ extraValues.size = 'auto|*|auto';
12007
+ }
12008
+ break;
12009
+ }
12010
 
12011
+ var $item = $('<div></div>').attr('data-item', type)
12012
+ .data('itemvalues', $.extend(true, {}, itemData.values, this.getLastValues(type), extraValues))
12013
+ .addClass('n2-ss-item n2-ss-item-' + type),
12014
+ layer = this._createLayer($item, group, $.extend($('.n2-ss-core-item-' + type).data('layerproperties'), props));
12015
 
12016
+ if (interaction && interaction == "click") {
12017
+ setTimeout(function () {
12018
+ layer.layer.trigger('mousedown', ['create']).trigger('mouseup', ['create']).trigger('click', ['create']);
12019
+ }, 500);
12020
+ } else {
12021
+ layer.activate();
12022
+ }
12023
 
12024
+ this.fragmentEditor.layerWindow.switchTab('item');
 
 
 
 
12025
 
12026
+ N2Classes.History.get().addSimple(this, this.historyDelete, this.historyCreate, [group, layer, data]);
 
 
 
 
12027
 
12028
+ return layer.item;
 
12029
  }
12030
+ };
12031
 
12032
+ ItemManager.prototype.getLastValues = function (type) {
12033
+ if (this.lastValues[type] !== undefined) {
12034
+ return this.lastValues[type];
12035
+ }
12036
+ return {};
12037
+ };
 
 
 
 
12038
 
12039
+ ItemManager.prototype.getItemClass = function (type) {
12040
+ var itemClass = 'Item' + N2Classes.StringHelper.capitalize(type);
12041
+ if (typeof N2Classes[itemClass] === 'undefined') {
12042
+ return 'Item';
 
 
 
 
 
 
 
 
 
 
 
 
 
12043
  }
12044
+ return itemClass;
12045
+ };
12046
 
12047
+ ItemManager.prototype._createLayer = function ($item, group, properties) {
12048
+ var defaultAlign = this.fragmentEditor.layerOptions.layerFeatures.layerDefault;
12049
+ for (var k in defaultAlign) {
12050
+ if (defaultAlign[k] !== null) {
12051
+ properties[k] = defaultAlign[k];
12052
+ }
12053
  }
12054
 
12055
+ var newLayer = new N2Classes.Layer(this.fragmentEditor, group, properties);
 
12056
 
12057
+ newLayer.create(function (layer) {
12058
+ return layer._createLayer()
12059
+ .append($item);
12060
+ });
12061
 
12062
+ return newLayer;
12063
  };
12064
 
12065
  /**
12066
+ * Initialize an item type and subscribe the field changes on that type.
12067
+ * We use event normalization to prevent rendering.
12068
+ * @param type
12069
+ * @private
12070
  */
12071
+ ItemManager.prototype.getItemForm = function (type) {
12072
+ if (this.forms[type] === undefined) {
12073
+ var form = $('#smartslider-slide-toolbox-item-type-' + type),
12074
+ formData = {
12075
+ form: form,
12076
+ values: form.data('itemvalues'),
12077
+ fields: form.find('[name^="item_' + type + '"]'),
12078
+ fieldNameRegexp: new RegExp('item_' + type + "\\[(.*?)\\]", "")
12079
+ };
12080
+ formData.fields.on({
12081
+ nextendChange: $.proxy(this.updateCurrentItem, this),
12082
+ keydown: $.proxy(this.updateCurrentItemDeBounced, this)
12083
+ });
 
 
 
 
12084
 
12085
+ this.forms[type] = formData;
 
12086
  }
12087
+ return this.forms[type];
 
12088
  };
12089
 
12090
+ /**
12091
+ * This function renders the current item with the current values of the related form field.
12092
+ */
12093
+ ItemManager.prototype.updateCurrentItem = function (e) {
12094
+ if (!this.suppressChange) {
12095
+ if (this.activeItemOriginalData === null) {
12096
+ this.activeItemOriginalData = $.extend({}, this.activeItem.values);
12097
+ }
12098
+ var data = {},
12099
+ originalData = {};
12100
+ // Get the current values of the fields
12101
+ // Run through the related item filter
12102
+ this.activeForm.fields.each($.proxy(function (i, field) {
12103
+ var field = $(field),
12104
+ name = field.attr('name').match(this.activeForm.fieldNameRegexp)[1];
12105
 
12106
+ originalData[name] = data[name] = field.val();
 
 
 
 
 
 
 
 
 
 
 
12107
 
12108
+ }, this));
 
 
 
12109
 
12110
+ if (e && e.type == 'nextendChange') {
12111
+ var task = N2Classes.History.get().addValue(this, this.historyUpdateCurrentItem, [this.activeItem]);
12112
+ if (task) {
12113
+ task.setValues(this.activeItemOriginalData, $.extend({}, originalData));
12114
+ }
12115
 
12116
+ this.activeItemOriginalData = null;
12117
+ }
12118
 
12119
+ this.activeItem.render($.extend({}, this.activeItem.getDefault(), data), originalData);
12120
+ }
12121
+ };
12122
 
12123
+ ItemManager.prototype.historyUpdateCurrentItem = function (values, historyActiveItem) {
12124
+ var maybeOldActiveItem = historyActiveItem.getSelf();
12125
+ maybeOldActiveItem.reRender($.extend(true, {}, values));
12126
+ maybeOldActiveItem.values = values;
12127
+ if (this.activeItem == maybeOldActiveItem) {
12128
+ maybeOldActiveItem.activate(null, null, true);
12129
+ }
12130
  };
12131
 
12132
+ ItemManager.prototype.updateCurrentItemDeBounced = NextendDeBounce(function (e) {
12133
+ this.updateCurrentItem(e);
12134
+ }, 100);
12135
 
12136
+ ItemManager.prototype.historyDelete = function (historyGroup, historyLayer) {
12137
+ historyLayer.getSelf().delete();
12138
  };
12139
 
12140
+ ItemManager.prototype.historyCreate = function (historyGroup, historyLayer, data) {
12141
+ var item = this.createLayerItem(historyGroup.getSelf(), data);
12142
+ historyLayer.setSelf(item.layer);
12143
  };
12144
 
12145
+ ItemManager.prototype.historyCreateStructure = function (historyGroup, historyLayer, data) {
12146
+ var obj = this.createLayerItem(historyGroup.getSelf(), data);
12147
+ historyLayer.setSelf(obj.layer);
12148
  };
12149
 
12150
+ ItemManager.prototype.getSelf = function () {
12151
+ return this;
12152
  };
12153
 
12154
+ return ItemManager;
12155
+ });
12156
+ N2D('PluginActivatable', function ($, undefined) {
12157
+ "use strict";
12158
 
12159
+ /**
12160
+ * @memberOf N2Classes
12161
+ *
12162
+ * @constructor
12163
+ */
12164
+ function PluginActivatable() {
12165
+ this.isActive = false;
12166
+ this.preventActivation = false;
12167
+ }
12168
 
12169
+ PluginActivatable.prototype.activate = function (e, context, preventExitFromSelection) {
12170
+ if (this.preventActivation) return false;
12171
+ if (document.activeElement) {
12172
+ document.activeElement.blur();
12173
+ }
12174
+ if (e && (e.ctrlKey || e.metaKey) && this.fragmentEditor.mainContainer.getSelectedLayer()) {
12175
+ return !this.select();
12176
+ } else {
12177
+ if (e && e.which == 3 && this.fragmentEditor.selectMode) {
12178
+ return false;
12179
+ }
12180
 
12181
+ if (!preventExitFromSelection) {
12182
+ this.fragmentEditor.exitSelectMode();
 
 
 
 
12183
  }
12184
  }
 
 
12185
 
12186
+ if (e) {
12187
+ this.positionSidebar();
 
 
 
 
12188
  }
 
12189
 
12190
+
12191
+ // Set the layer active if it is not active currently
12192
+ if (this.fragmentEditor.mainContainer.getSelectedLayer() !== this) {
12193
+ this.layerRow.addClass('n2-active');
12194
+ this.layer.addClass('n2-active');
12195
+ this.layer.triggerHandler('n2-ss-activate');
12196
+ this.fragmentEditor.changeActiveLayer(this, preventExitFromSelection);
12197
+ nextend.activeLayer = this.layer;
12198
+
12199
+
12200
+ this.fragmentEditor.ui.onActivateLayer(this);
12201
  }
12202
+ this.isActive = true;
12203
+ return true;
12204
  };
12205
 
12206
+ PluginActivatable.prototype.deActivate = function () {
12207
+ this.isActive = false;
12208
+ if (this.layer === undefined) {
12209
+ console.error();
 
12210
  }
12211
+ this.layer.removeClass('n2-active');
12212
+ this.layerRow.removeClass('n2-active');
12213
+ this.layer.triggerHandler('n2-ss-deactivate');
12214
  };
12215
 
12216
+ return PluginActivatable;
12217
+ });
12218
+ N2D('PluginEditableName', function ($, undefined) {
12219
+ "use strict";
12220
+ var dblClickInterval = 300,
12221
+ timeout = null;
12222
+
12223
  /**
12224
+ * @memberOf N2Classes
12225
+ *
12226
+ * @constructor
12227
  */
12228
+ function PluginEditableName() {
12229
+ }
 
 
 
 
 
 
12230
 
12231
+ PluginEditableName.prototype.addProperties = function ($layer) {
12232
+ this.createProperty('name', this.label, $layer);
12233
+ this.createProperty('nameSynced', 1, $layer);
 
 
 
 
12234
  };
12235
 
12236
+ PluginEditableName.prototype.makeNameEditable = function () {
12237
+ this.layerTitleSpan.on({
12238
+ mouseup: $.proxy(function (e) {
12239
+ if (timeout) {
12240
+ clearTimeout(timeout);
12241
+ timeout = null;
12242
+ this.editName();
12243
+ } else {
12244
+ this.activate(e);
12245
+ timeout = setTimeout($.proxy(function () {
12246
+ timeout = null;
12247
+ }, this), dblClickInterval);
12248
+ }
12249
+ }, this)
12250
+ })
12251
  };
12252
 
12253
+ PluginEditableName.prototype.editName = function () {
12254
+ var input = new N2Classes.InlineField();
12255
+
12256
+ input.$input.on({
12257
+ valueChanged: $.proxy(function (e, newName) {
12258
+ this.rename(newName, true);
12259
+ this.layerTitleSpan.css('display', 'inline');
12260
+ }, this),
12261
+ cancel: $.proxy(function () {
12262
+ this.layerTitleSpan.css('display', 'inline');
12263
+ }, this)
12264
+ });
12265
+
12266
+ this.layerTitleSpan.css('display', 'none');
12267
+ input.injectNode(this.layerTitle, this.property.name);
12268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12269
  };
12270
 
12271
+ PluginEditableName.prototype.rename = function (newName, force) {
12272
+
12273
+ if (this.property.nameSynced || force) {
12274
+
12275
+ if (force) {
12276
+ this.property.nameSynced = 0;
12277
+ }
12278
+
12279
+ if (newName == '') {
12280
+ if (force) {
12281
+ this.property.nameSynced = 1;
12282
+ this.item.reRender();
12283
+ return false;
12284
+ }
12285
+ newName = 'Layer #' + (this.group.getLayerCount() + 1);
12286
+ }
12287
+ newName = newName.substr(0, 35);
12288
+ if (this.property.name != newName) {
12289
+ this.property.name = newName;
12290
+ this.layerTitleSpan.html(newName);
12291
+
12292
+ this.$.trigger('layerRenamed', newName);
12293
+ }
12294
  }
 
12295
  };
12296
 
12297
+ return PluginEditableName;
12298
+ });
12299
+ N2D('PluginShowOn', function ($, undefined) {
12300
+ "use strict";
12301
+
12302
+ /**
12303
+ * @memberOf N2Classes
12304
+ *
12305
+ * @constructor
12306
+ */
12307
+ function PluginShowOn() {
12308
 
 
12309
  }
12310
 
12311
+ PluginShowOn.prototype.addProperties = function ($layer) {
12312
+ this.showsOnCurrent = true;
12313
+ this.createProperty('generatorvisible', '', $layer);
12314
+ this.createProperty('desktopPortrait', 1, $layer);
12315
+ this.createProperty('desktopLandscape', 1, $layer);
12316
+ this.createProperty('tabletPortrait', 1, $layer);
12317
+ this.createProperty('tabletLandscape', 1, $layer);
12318
+ this.createProperty('mobilePortrait', 1, $layer);
12319
+ this.createProperty('mobileLandscape', 1, $layer);
12320
  };
12321
 
12322
+ PluginShowOn.prototype._hide = function () {
12323
+ this.layer.css('display', 'none');
12324
+ this.showsOnCurrent = false;
12325
+ this.update();
12326
  };
12327
 
12328
+ PluginShowOn.prototype._show = function () {
12329
+ if (parseInt(this.property[this.fragmentEditor.getMode()])) {
12330
+ this.layer.css('display', '');
12331
+ this.showsOnCurrent = true;
12332
  }
12333
+ this.update();
12334
+ };
12335
 
 
 
 
12336
 
12337
+ PluginShowOn.prototype._syncdesktopPortrait = function () {
12338
+ var value = this.getProperty('desktopPortrait');
12339
+ this.__syncShowOnDevice('desktopPortrait', value);
12340
+ };
12341
 
12342
+ PluginShowOn.prototype._syncdesktopLandscape = function () {
12343
+ var value = this.getProperty('desktopLandscape');
12344
+ this.__syncShowOnDevice('desktopLandscape', value);
12345
  };
12346
 
12347
+ PluginShowOn.prototype._synctabletPortrait = function () {
12348
+ var value = this.getProperty('tabletPortrait');
12349
+ this.__syncShowOnDevice('tabletPortrait', value);
12350
+ };
12351
 
12352
+ PluginShowOn.prototype._synctabletLandscape = function () {
12353
+ var value = this.getProperty('tabletLandscape');
12354
+ this.__syncShowOnDevice('tabletLandscape', value);
 
 
 
12355
  };
12356
 
12357
+ PluginShowOn.prototype._syncmobilePortrait = function () {
12358
+ var value = this.getProperty('mobilePortrait');
12359
+ this.__syncShowOnDevice('mobilePortrait', value);
12360
+ };
12361
 
12362
+ PluginShowOn.prototype._syncmobileLandscape = function () {
12363
+ var value = this.getProperty('mobileLandscape');
12364
+ this.__syncShowOnDevice('mobileLandscape', value);
12365
+ };
12366
+
12367
+ PluginShowOn.prototype.__syncShowOnDevice = function (mode, value) {
12368
+ if (this.getMode() == mode) {
12369
+ var value = parseInt(value);
12370
+ if (value) {
12371
+ this._show();
12372
+ } else {
12373
+ this._hide();
 
 
 
 
 
 
12374
  }
12375
+ this.layer.triggerHandler('LayerShowChange', [mode, value]);
12376
+ this.placement.doAction('triggerLayerResized');
12377
  }
 
12378
  };
12379
 
12380
+ return PluginShowOn;
12381
+ });
12382
+ N2D('Col', ['ContentAbstract'], function ($, undefined) {
12383
+ "use strict";
12384
 
12385
+ /**
12386
+ * @memberOf N2Classes
12387
+ *
12388
+ * @param fragmentEditor
12389
+ * @param group
12390
+ * @param properties
12391
+ * @constructor
 
 
 
 
 
 
 
 
 
 
 
 
 
12392
 
12393
+ * @augments ContentAbstract
12394
+ */
12395
+ function Col(fragmentEditor, group, properties) {
12396
+ this.label = 'Col';
12397
+ this.type = 'col';
12398
 
12399
+ this.innerContainer = '> .n2-ss-layer-col';
 
 
 
 
12400
 
12401
+ this.localStyle = [
12402
+ {
12403
+ group: 'normal', selector: '-inner', css: {
12404
+ transition: 'transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;'
12405
+ }
12406
+ },
12407
+ {group: 'hover', selector: '-inner:HOVER', css: {}}
12408
+ ];
12409
 
12410
+ N2Classes.ContentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
12411
 
12412
+ this.placement.allow('default');
12413
+ }
12414
 
12415
+ Col.prototype = Object.create(N2Classes.ContentAbstract.prototype);
12416
+ Col.prototype.constructor = Col;
12417
+
12418
+ Col.prototype._createLayer = function () {
12419
+ return $('<div class="n2-ss-layer"><div class="n2-ss-layer-content n2-ss-layer-col"></div></div>')
12420
+ .attr('data-sstype', this.type);
12421
  };
12422
 
12423
+ Col.prototype.addProperties = function ($layer) {
 
 
 
 
 
 
12424
 
12425
+ N2Classes.ContentAbstract.prototype.addProperties.call(this, $layer);
12426
 
12427
+ this.createProperty('colwidth', '1', $layer);
12428
+ this.createProperty('href', '', $layer);
12429
+ this.createProperty('href-target', '_self', $layer);
12430
 
12431
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderradius', 0, {
12432
+ "-hover": undefined
12433
+ }, this, "stylemode"), $layer);
12434
 
12435
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('boxshadow', '0|*|0|*|0|*|0|*|00000080', {
12436
+ "-hover": undefined
12437
+ }, this, "stylemode"), $layer);
12438
 
12439
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderwidth', '1|*|1|*|1|*|1', {
12440
+ "-hover": undefined
12441
+ }, this, "stylemode"), $layer);
12442
 
12443
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderstyle', 'none', {
12444
+ "-hover": undefined
12445
+ }, this, "stylemode"), $layer);
12446
 
12447
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bordercolor', 'ffffffff', {
12448
+ "-hover": undefined
12449
+ }, this, "stylemode"), $layer);
12450
+
12451
+ this.createDeviceProperty('order', {desktopPortrait: 0}, $layer);
12452
  };
12453
 
12454
+ Col.prototype.create = function () {
12455
+ N2Classes.ContentAbstract.prototype.create.call(this);
 
 
 
 
 
 
12456
 
12457
+ this._syncorder();
12458
 
12459
+ this._syncborder();
 
 
 
 
 
12460
 
12461
+ this._syncborderradius();
12462
+ this._syncboxshadow();
 
 
 
12463
 
12464
+ this._onReady();
 
12465
  };
12466
 
12467
+ Col.prototype.load = function ($layer, isEditorStart) {
12468
 
12469
+ N2Classes.ContentAbstract.prototype.load.call(this, $layer, isEditorStart);
12470
 
12471
+ this._syncorder();
 
 
 
 
 
 
 
 
 
 
 
12472
 
12473
+ this._syncborder();
12474
+ this._syncborderradius();
12475
+ this._syncboxshadow();
12476
 
12477
+ this._onReady();
 
 
 
 
12478
 
12479
+ var storedRowColumnWidths = $layer.data('rowcolumns') + ''; //jQuery can convert it to number
12480
+ if (storedRowColumnWidths != undefined) {
12481
+ if (this.group.readyDeferred.state() == 'resolved') {
12482
+ var widths = storedRowColumnWidths.split('+');
12483
+ for (var i = 0; i < widths.length; i++) {
12484
+ widths[i] = new Fraction(widths[i]);
12485
+ }
12486
+ this.group.setColsWidth(widths);
12487
  }
12488
  }
12489
  };
12490
 
12491
+ Col.prototype.createRow = function () {
12492
+ this.$content = this.layer.find('.n2-ss-layer-content:first');
 
12493
 
12494
+ this.container = new N2Classes.LayerContainer(this, $('<ul class="n2-list n2-h4 n2-list-orderable" />'), 'normal', '> .n2-ss-layer', ['row', 'layer']);
12495
+ this.container.setLayerContainerElement(this.$content);
12496
 
12497
+ this.addClassElement(this.layer);
12498
+ this.addClassElement(this.$content, '-inner');
 
12499
 
12500
+ var remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this)),
12501
+ duplicate = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Duplicate layer') + '"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on('click', $.proxy(function () {
12502
+ this.duplicate(true, false)
12503
+ }, this));
 
 
 
 
 
 
12504
 
 
12505
 
12506
+ this._createLayerListRow([
12507
+ $('<div class="n2-actions"></div>').append(duplicate).append(remove)
12508
+ ]).addClass('n2-ss-layer-content-row');
 
 
 
 
 
 
 
12509
 
 
12510
 
12511
+ this.openerElement = $('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-col"></i></a>').insertBefore(this.layerTitleSpan)
12512
+ .on('click', $.proxy(this.switchOpened, this));
12513
+
12514
+ this.container.$ul.appendTo(this.layerRow);
12515
+
12516
+ this.readyDeferred.done($.proxy(this._syncopened, this));
12517
  };
12518
 
12519
+ Col.prototype._start = function (isCreate) {
12520
+
12521
+ N2Classes.ContentAbstract.prototype._start.call(this, isCreate);
12522
+
12523
+ if (isCreate) {
12524
+ this.highlight(2000);
12525
  }
12526
  };
12527
 
12528
+ Col.prototype.getRealOrder = function () {
12529
+ var order = this.getProperty('order');
12530
+ if (order == 0) {
12531
+ return 10;
12532
  }
12533
+ return order;
12534
  };
12535
 
12536
+ Col.prototype._syncorder = function () {
12537
+ var order = this.getProperty('order');
 
 
 
 
 
 
 
 
12538
 
12539
+ if (order == 0) {
12540
+ this.layer.css('order', '');
12541
+ } else {
12542
+ this.layer.css('order', order * 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12543
  }
 
12544
 
12545
+ this.group.refreshUI();
 
 
 
 
 
 
 
 
 
 
 
 
 
12546
  };
12547
 
12548
+ Col.prototype._synccolwidth = function () {
12549
+ this.widthPercentage = ((new Fraction(this.getProperty('colwidth'))).valueOf() * 100);
12550
+ //this.layer.css('width', this.widthPercentage + '%');
12551
+ this.group.refreshUI();
 
 
12552
  };
12553
 
12554
+ Col.prototype.getWidthPercentage = function () {
12555
+ return this.widthPercentage;
12556
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12557
 
12558
+ Col.prototype._synchref =
12559
+ Col.prototype['_synchref-target'] = function () {
12560
+ };
12561
 
12562
+ Col.prototype._syncborderradius =
12563
+ Col.prototype['_syncborderradius-hover'] = function () {
12564
+ var borderRadius = this.getProperty('borderradius');
12565
+ if (borderRadius > 0) {
12566
+ this.addLocalStyle('normal', 'borderradius', 'border-radius:' + borderRadius + 'px;');
12567
  }
 
 
 
 
 
12568
 
12569
+ var borderRadiusHover = this.getProperty('borderradius-hover');
12570
+ if (borderRadiusHover && borderRadiusHover != borderRadius) {
12571
+ this.addLocalStyle('hover', 'borderradius', 'border-radius:' + borderRadiusHover + 'px;');
12572
+ }
12573
+ };
12574
 
12575
+ Col.prototype._syncborderwidth =
12576
+ Col.prototype._syncbordercolor =
12577
+ Col.prototype._syncborderstyle =
12578
+ Col.prototype['_syncborderstyle-hover'] =
12579
+ Col.prototype['_syncbordercolor-hover'] =
12580
+ Col.prototype['_syncborderwidth-hover'] = function () {
12581
+ this._syncborder();
12582
+ };
12583
 
12584
+ Col.prototype._syncborder = function () {
12585
+ var borderstyle = this.getProperty('borderstyle'),
12586
+ bordercolor = this.getProperty('bordercolor'),
12587
+ borderwidth = this.getProperty('borderwidth');
 
12588
 
12589
+ this.addLocalStyle('normal', 'border', this.getBorderCSS(borderstyle, bordercolor, borderwidth));
12590
 
12591
+ var hoverStyle = '',
12592
+ isHoverDifferent = false,
12593
+ borderstyleHover = this.getProperty('borderstyle-hover'),
12594
+ bordercolorHover = this.getProperty('bordercolor-hover'),
12595
+ borderwidthHover = this.getProperty('borderwidth-hover');
12596
 
12597
+ if (borderstyleHover !== undefined && borderstyleHover != borderstyle) {
12598
+ isHoverDifferent = true;
12599
+ }
12600
+ if (bordercolorHover !== undefined && bordercolorHover != bordercolor) {
12601
+ isHoverDifferent = true;
12602
+ }
12603
+ if (borderwidthHover !== undefined && borderwidthHover != borderwidth) {
12604
+ isHoverDifferent = true;
12605
+ }
12606
 
12607
+ if (isHoverDifferent) {
12608
+ if (borderstyleHover === undefined) {
12609
+ borderstyleHover = borderstyle;
12610
+ }
12611
+ if (bordercolorHover === undefined) {
12612
+ bordercolorHover = bordercolor;
12613
+ }
12614
+ if (borderwidthHover === undefined) {
12615
+ borderwidthHover = borderwidth;
12616
+ }
12617
+ hoverStyle = this.getBorderCSS(borderstyleHover, bordercolorHover, borderwidthHover);
12618
+ }
12619
+ this.addLocalStyle('hover', 'border', hoverStyle);
12620
 
12621
+ this.update();
 
12622
  };
12623
 
12624
+ Col.prototype.getBorderCSS = function (borderStyle, borderColor, borderWidth) {
12625
+ var style = '';
12626
+ if (borderStyle != 'none') {
12627
+ style += 'border-color:' + N2Color.hex2rgbaCSS(borderColor) + ';';
12628
+ style += 'border-style:' + borderStyle + ';';
12629
+ borderWidth = borderWidth.split('|*|');
12630
+ var unit = 'px';
12631
 
12632
+ style += 'border-width:' + borderWidth.join(unit + ' ') + unit + ';';
12633
+ }
12634
+ return style;
12635
  };
12636
 
12637
+ Col.prototype._syncboxshadow =
12638
+ Col.prototype['_syncboxshadow-hover'] = function () {
 
 
 
 
 
 
 
 
 
12639
 
12640
+ var boxShadow = this.getProperty('boxshadow');
12641
+ this.addLocalStyle('normal', 'boxshadow', this.getBoxShadowCSS(boxShadow.split('|*|')));
12642
 
12643
+ var hoverStyle = '',
12644
+ boxShadowHover = this.getProperty('boxshadow-hover');
12645
+ if (boxShadowHover !== undefined && boxShadowHover != boxShadow) {
12646
+ hoverStyle = this.getBoxShadowCSS(boxShadowHover.split('|*|'));
 
 
12647
  }
12648
+ this.addLocalStyle('hover', 'boxshadow', hoverStyle);
12649
+ };
 
 
 
 
 
 
 
 
 
 
12650
 
12651
+ Col.prototype.getBoxShadowCSS = function (boxShadow) {
12652
+ if ((boxShadow[0] != 0 || boxShadow[1] != 0 || boxShadow[2] != 0 || boxShadow[3] != 0) && N2Color.hex2alpha(boxShadow[4]) != 0) {
12653
+ return 'box-shadow:' + boxShadow[0] + 'px ' + boxShadow[1] + 'px ' + boxShadow[2] + 'px ' + boxShadow[3] + 'px ' + N2Color.hex2rgbaCSS(boxShadow[4]) + ';';
12654
+ }
12655
+ return '';
12656
  };
12657
 
12658
+ Col.prototype.delete = function () {
12659
+ if (this.group.container.getLayerCount() > 1) {
12660
+ this._delete();
12661
+ } else {
12662
+ this.group.delete();
12663
+ }
12664
+ };
12665
 
12666
+ Col.prototype.getHTML = function (base64) {
12667
+ var layer = N2Classes.ComponentAbstract.prototype.getHTML.call(this, base64);
12668
 
12669
+ layer.attr('data-rowcolumns', this.group.getColumns());
12670
+ return layer;
12671
+ };
12672
 
12673
+ Col.prototype.renderModeProperties = function (isReset) {
12674
+ this._syncorder();
12675
 
12676
+ N2Classes.ContentAbstract.prototype.renderModeProperties.call(this, isReset);
12677
  };
12678
 
12679
+ Col.prototype.update = function () {
12680
 
12681
+ this.group._syncwrapafter();
12682
+ N2Classes.ComponentAbstract.prototype.update.call(this);
12683
+ };
12684
 
12685
+ Col.prototype.setPropertystylemode = function () {
12686
+ N2Classes.ContentAbstract.prototype.setPropertystylemode.apply(this, arguments);
12687
 
12688
+ this.syncAdvancedField('borderradius');
12689
+ this.syncAdvancedField('boxshadow');
12690
+ this.syncAdvancedField('borderwidth');
12691
+ this.syncAdvancedField('borderstyle');
12692
+ this.syncAdvancedField('bordercolor');
12693
  };
12694
 
12695
+ Col.prototype.getOrderedIndex = function () {
12696
+ return this.group.getOrderedColumns().indexOf(this);
 
12697
  };
12698
 
12699
+ return Col;
12700
+ });
12701
+ var dependencies = ['Historical', 'LayerDataStorage', 'PluginEditableName'];
12702
+ N2D('ComponentAbstract', dependencies, function ($, undefined) {
12703
+ "use strict";
 
 
 
 
12704
 
12705
+ var i = 0;
12706
+ window.layers = [];
12707
 
12708
+ /**
12709
+ * @memberOf N2Classes
12710
+ *
12711
+ * @param {N2Classes.FragmentEditor} fragmentEditor
12712
+ * @param group
12713
+ * @param properties
12714
+ * @constructor
12715
+ * @augments N2Classes.Historical
12716
+ * @augments N2Classes.PluginActivatable
12717
+ * @augments N2Classes.LayerDataStorage
12718
+ * @augments N2Classes.PluginEditableName
12719
+ * @augments N2Classes.PluginAnimatable
12720
+ * @augments N2Classes.PluginShowOn
12721
+ */
12722
+ function ComponentAbstract(fragmentEditor, group, properties) {
12723
 
12724
+ this.wraps = {};
12725
+ this.counter = i++;
12726
+ window.layers[this.counter] = this;
12727
+ this.self = this;
12728
+ this.originalProperties = properties || {};
12729
+ N2Classes.LayerDataStorage.prototype.constructor.call(this);
12730
+ this.readyDeferred = $.Deferred();
12731
+ this.readyDeferred.done($.proxy(this.onReady, this));
12732
+ this.isDeleteStarted = false;
12733
+ this.isDeleted = false;
12734
 
12735
+ this._lastClasses = false;
 
 
12736
 
12737
+ this.$ = $(this);
 
 
12738
 
12739
+ this.proxyRefreshBaseSize = $.proxy(this.refreshBaseSize, this);
12740
+ this.proxyRefreshTextAlign = $.proxy(this.refreshTextAlign, this);
12741
 
12742
+ this.status = ComponentAbstract.STATUS.UNDEFINED;
12743
 
12744
+ this.fragmentEditor = fragmentEditor;
12745
+ this.group = group;
12746
 
12747
+ this.classElements = [];
 
12748
 
12749
+ this.localStyleSyncThrottled = NextendThrottle(this.localStyleSync, 50);
 
12750
 
 
 
 
12751
 
12752
+ N2Classes.PluginActivatable.prototype.constructor.call(this);
 
 
12753
 
12754
+ /** @type {N2Classes.Placement} */
12755
+ this.placement = new N2Classes.Placement(this);
 
 
12756
 
12757
+ this.readyDeferred.done($.proxy(this.addUILabels, this));
 
 
 
 
 
 
 
 
 
12758
 
12759
+ }
12760
 
12761
+ ComponentAbstract.STATUS = {
12762
+ UNDEFINED: 0,
12763
+ NORMAL: 1,
12764
+ LOCKED: 2,
12765
+ HIDDEN: 3
12766
+ };
12767
 
12768
+ ComponentAbstract.STATUS_INV = {
12769
+ 0: 'UNDEFINED',
12770
+ 1: 'NORMAL',
12771
+ 2: 'LOCKED',
12772
+ 3: 'HIDDEN'
12773
+ };
12774
 
12775
+
12776
+ for (var k in N2Classes.PluginActivatable.prototype) {
12777
+ ComponentAbstract.prototype[k] = N2Classes.PluginActivatable.prototype[k];
12778
  }
12779
 
12780
+ for (var k in N2Classes.LayerDataStorage.prototype) {
12781
+ ComponentAbstract.prototype[k] = N2Classes.LayerDataStorage.prototype[k];
12782
+ }
12783
 
12784
+ for (var k in N2Classes.PluginEditableName.prototype) {
12785
+ ComponentAbstract.prototype[k] = N2Classes.PluginEditableName.prototype[k];
12786
+ }
12787
 
12788
+ for (var k in N2Classes.PluginShowOn.prototype) {
12789
+ ComponentAbstract.prototype[k] = N2Classes.PluginShowOn.prototype[k];
12790
+ }
12791
 
12792
+ N2Classes.Historical(ComponentAbstract);
12793
 
12794
+ ComponentAbstract.prototype.onSelfChange = function () {
12795
+ };
 
 
12796
 
12797
+ ComponentAbstract.prototype.addUILabels = function () {
12798
+ this.markTimer = null;
12799
+ this.uiLabel = $('<div class="n2-ss-layer-ui-label-container"><div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-self">' + this.getUILabel() + '</div></div>')
12800
+ .appendTo(this.layer);
12801
 
12802
+ nextend.tooltip.addElement($('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-up n2-ss-layer-ui-label-action"><i class="n2-i n2-i-uplevel"/></div>')
12803
+ .on({
12804
+ mousedown: function (e) {
12805
+ e.stopPropagation();
12806
+ },
12807
+ click: $.proxy(function (e) {
12808
+ this.up(e);
12809
+ }, this)
12810
+ })
12811
+ .appendTo(this.uiLabel), 'Select parent');
12812
 
12813
+ $('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-action"><i class="n2-i n2-i-mini-duplicate"/></div>')
12814
+ .on({
12815
+ mousedown: function (e) {
12816
+ e.stopPropagation();
12817
+ },
12818
+ click: $.proxy(function () {
12819
+ this.duplicate();
12820
+ }, this)
12821
+ })
12822
+ .appendTo(this.uiLabel);
12823
 
12824
+ $('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-action"><i class="n2-i n2-i-mini-trash"/></div>')
12825
+ .on({
12826
+ mousedown: function (e) {
12827
+ e.stopPropagation();
12828
+ },
12829
+ click: $.proxy(function () {
12830
+ this.delete();
12831
+ }, this)
12832
+ })
12833
+ .appendTo(this.uiLabel);
12834
+ };
12835
 
12836
+ ComponentAbstract.prototype.getUILabel = function () {
12837
+ return this.label;
12838
+ };
12839
 
12840
+ ComponentAbstract.prototype.up = function (e) {
12841
+ e.stopImmediatePropagation();
12842
+ this.group.activate(e);
12843
+ };
12844
 
12845
+ ComponentAbstract.prototype.addProperties = function ($layer) {
12846
 
12847
+ this.createProperty('id', null, $layer, this);
12848
+ this.createProperty('uniqueclass', null, $layer, this);
12849
 
12850
+ this.createProperty('class', '', $layer);
12851
+ this.createProperty('crop', 'visible', $layer);
12852
+ this.createProperty('rotation', 0, $layer);
12853
+ this.createProperty('parallax', 0, $layer);
12854
+ this.createProperty('adaptivefont', 0, $layer);
12855
+
12856
+ this.createDeviceProperty('fontsize', {desktopPortrait: 100}, $layer);
12857
+ N2Classes.PluginShowOn.prototype.addProperties.call(this, $layer);
12858
+ N2Classes.PluginEditableName.prototype.addProperties.call(this, $layer);
12859
  };
12860
 
12861
+ ComponentAbstract.prototype.getRootElement = function () {
12862
+ return this.layer;
12863
  };
12864
 
12865
+ ComponentAbstract.prototype.create = function (cb, useCreatedLayerProperties) {
12866
+ useCreatedLayerProperties = useCreatedLayerProperties || false;
12867
+ if (!useCreatedLayerProperties) {
12868
+ this.addProperties(false);
12869
+ }
12870
+ if (typeof cb == 'function') {
12871
+ this.layer = cb.call(null, this);
12872
+ } else {
12873
+ this.layer = this._createLayer();
12874
+ }
12875
 
12876
+ this.layer.addClass('n2-ss-layer-under-creation');
12877
 
12878
+ if (useCreatedLayerProperties) {
12879
+ this.addProperties(this.layer);
12880
+ }
12881
 
12882
+ this.layer.data('layerObject', this);
12883
+ this.layer.triggerHandler('layerStarted', [this]);
12884
+
12885
+
12886
+ this.group.container.insert(this);
12887
+ this.group.onChildCountChange();
12888
+
12889
+ this.$.triggerHandler('create');
12890
+
12891
+ this._start(true);
12892
  };
12893
 
12894
+ ComponentAbstract.prototype.load = function ($layer, isEditorStart) {
12895
 
12896
+ this.addProperties($layer);
12897
 
12898
+ this.layer = $layer.data('layerObject', this);
12899
 
12900
+ this.layer.triggerHandler('layerStarted', [this]);
 
 
 
 
12901
 
12902
+ this.$.triggerHandler('load');
 
12903
 
12904
+ this._start(false);
12905
 
12906
+ var status = $layer.data('status');
12907
+ if (status !== null && typeof status != 'undefined') {
12908
+ this.changeStatus(status);
12909
+ } else {
12910
+ this.changeStatus(ComponentAbstract.STATUS.NORMAL);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12911
  }
12912
 
12913
+ if (!isEditorStart) {
12914
+ this.regenerateUniqueClass();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12915
  }
 
 
12916
  };
12917
 
12918
+ ComponentAbstract.prototype._start = function (isCreate) {
12919
+ this.createRow();
12920
+
12921
+ var mask = this.layer.find('> .n2-ss-layer-mask');
12922
+ if (mask.length) {
12923
+ this.wraps.mask = mask;
12924
  }
 
12925
 
12926
+ this._synccrop();
12927
+ this._syncrotation();
 
 
12928
 
12929
+ this.placement.start();
12930
+ this.placement.setMode(this.group.container.allowedPlacementMode, this.originalProperties);
 
 
12931
 
12932
+ this.setGroup(this.group);
 
 
12933
 
 
 
 
12934
 
12935
+ this.fragmentEditor.$.triggerHandler('layerCreated', this);
12936
+
12937
+ if (isCreate) {
12938
+ this.refreshBaseSize();
12939
+ this.$.triggerHandler('created');
 
 
 
 
12940
  }
12941
 
12942
+ setTimeout($.proxy(function () {
12943
+ if (!this.isDeleted) {
12944
+ this.placement.onResize(true);
12945
+ this.layer.css('visibility', '');
12946
 
12947
+ this.layer.removeClass('n2-ss-layer-under-creation');
12948
+ }
12949
+ }, this), 300);
12950
  };
12951
 
 
 
 
 
 
 
 
 
 
12952
 
12953
+ ComponentAbstract.prototype._onReady = function () {
 
12954
 
12955
+ this.originalProperties = {};
 
 
12956
 
12957
+ this.readyDeferred.resolve();
 
12958
 
12959
+ this.layer.on({
12960
+ mouseover: $.proxy(this.markOver, this),
12961
+ mouseout: $.proxy(this.markOut, this)
12962
+ });
12963
  };
12964
 
12965
+ ComponentAbstract.prototype.isReady = function () {
12966
+ return this.readyDeferred.state() == 'resolved';
12967
  };
12968
 
12969
+ ComponentAbstract.prototype.getName = function () {
12970
+ return this.property.name;
12971
  };
12972
 
12973
+ ComponentAbstract.prototype.setGroup = function (group) {
12974
+ this.group.$.off('baseSizeUpdated.sslayer' + this.counter);
12975
+ this.group.$.off('textAlignUpdated.sslayer' + this.counter);
 
 
 
 
 
 
 
 
 
12976
 
12977
+ this.group = group;
12978
+ this.placement.setMode(group.container.allowedPlacementMode);
12979
+ group.container.syncLayerRow(this);
12980
 
12981
+ if (this.isReady()) {
12982
+ this.refreshBaseSize();
 
 
 
 
 
 
 
 
 
 
 
 
 
12983
  }
12984
+ this.group.$.on('baseSizeUpdated.sslayer' + this.counter, this.proxyRefreshBaseSize);
12985
+ this.group.$.on('textAlignUpdated.sslayer' + this.counter, this.proxyRefreshTextAlign);
12986
+ };
12987
 
12988
+ ComponentAbstract.prototype.changeGroup = function (originalIndex, newGroup) {
12989
+ var originalGroup = this.group;
12990
+ originalGroup.$.off('baseSizeUpdated.sslayer' + this.counter);
12991
+ originalGroup.$.off('textAlignUpdated.sslayer' + this.counter);
12992
 
12993
+ this.group = newGroup;
12994
+ var originalPlacementData = this.placement.setMode(newGroup.container.allowedPlacementMode);
12995
+ newGroup.container.syncLayerRow(this);
12996
 
12997
+ this.refreshBaseSize();
12998
+ newGroup.$.on('baseSizeUpdated.sslayer' + this.counter, this.proxyRefreshBaseSize);
12999
+ newGroup.$.on('textAlignUpdated.sslayer' + this.counter, this.proxyRefreshTextAlign);
13000
 
13001
+ this.userGroupChange(originalGroup, originalIndex, originalPlacementData, newGroup, this.getIndex());
 
 
 
 
13002
 
13003
+ originalGroup.update();
13004
+ };
 
 
 
 
 
 
 
13005
 
13006
+ ComponentAbstract.prototype.userGroupChange = function (originalGroup, originalIndex, originalPlacementData, newGroup, newIndex) {
13007
+ if (originalGroup == newGroup) {
13008
+ this.userIndexChange(originalIndex, newIndex);
13009
+ } else {
13010
+ var task = N2Classes.History.get().addValue(this, this.historyUserGroupChange, []);
13011
+
13012
+ if (task) {
13013
+ task.setValues({
13014
+ historyGroup: originalGroup,
13015
+ index: originalIndex,
13016
+ placementData: originalPlacementData
13017
+ }, {
13018
+ historyGroup: newGroup,
13019
+ index: newIndex
13020
+ });
13021
  }
 
13022
  }
 
13023
  };
13024
 
13025
+ ComponentAbstract.prototype.historyUserGroupChange = function (data) {
13026
+ var originalGroup = this.group,
13027
+ group = data.historyGroup.getSelf(),
13028
+ index = data.index;
13029
+ group.container.insertLayerAt(this, index);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13030
 
13031
+ this.group.$.off('baseSizeUpdated.sslayer' + this.counter);
13032
+ this.group.$.off('refreshTextAlign.sslayer' + this.counter);
13033
 
13034
+ this.group = group;
13035
+ if (data.placementData) {
13036
+ this.layer.data(data.placementData);
13037
  }
13038
+ this.placement.setMode(group.container.allowedPlacementMode);
13039
+ group.container.syncLayerRow(this);
13040
 
13041
+ this.refreshBaseSize();
13042
+ this.group.$.on('baseSizeUpdated.sslayer' + this.counter, this.proxyRefreshBaseSize);
13043
+ this.group.$.on('refreshTextAlign.sslayer' + this.counter, this.proxyRefreshBaseSize);
 
 
 
 
 
 
 
 
 
 
13044
 
 
 
 
13045
 
13046
+ group.onChildCountChange();
 
 
 
 
 
 
 
 
 
 
13047
 
13048
+ if (data.placementData) {
13049
+ this.placement.sync();
 
 
 
 
 
 
 
13050
  }
 
 
13051
 
13052
+ originalGroup.update();
 
13053
  };
13054
 
13055
+ ComponentAbstract.prototype.userIndexChange = function (originalIndex, newIndex) {
 
13056
 
13057
+ var task = N2Classes.History.get().addValue(this, this.historyUserIndexChange);
13058
+ if (task) {
13059
+ task.setValues(originalIndex, newIndex);
13060
+ }
13061
+ this.group.container.insertLayerAt(this, newIndex);
13062
  };
13063
 
13064
+ ComponentAbstract.prototype.historyUserIndexChange = function (value) {
13065
+ this.group.container.insertLayerAt(this, value);
13066
  };
13067
 
 
 
 
 
13068
 
13069
+ ComponentAbstract.prototype._createLayerListRow = function (actions) {
13070
+ this.layerRow = $('<li class="n2-ss-layerlist-row"></li>')
13071
+ .data('layer', this)
13072
+ .on({
13073
+ mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerRowClicked')
13074
+ })
13075
+ .appendTo(this.group.container.$ul);
13076
+ this.layerTitleSpan = $('<span class="n2-ucf">' + this.property.name + '</span>');
 
13077
 
13078
+ this.makeNameEditable();
13079
 
13080
+ this.layerTitle = $('<div class="n2-ss-layer-title"></div>')
13081
+ .on({
13082
+ mouseenter: $.proxy(function () {
13083
+ this.fragmentEditor.highlight(this);
13084
+ }, this),
13085
+ mouseleave: $.proxy(function () {
13086
+ this.fragmentEditor.deHighlight(this);
13087
+ }, this),
13088
+ })
13089
+ .append(this.layerTitleSpan)
13090
+ .append(actions)
13091
+ .appendTo(this.layerRow)
13092
+ .on({
13093
+ mouseup: $.proxy(function (e) {
13094
+ if (!nextend.shouldPreventMouseUp && e.target.tagName === 'DIV') {
13095
+ this.activate(e);
13096
+ }
13097
+ }, this)
13098
+ });
13099
 
13100
+ nextend.tooltip.add(this.layerRow);
13101
 
13102
+ this.layerRow.nUILayerListItem({
13103
+ UIManager: this.fragmentEditor.mainContainer.layerListUIManager,
13104
+ layer: this,
13105
+ $item: this.layerRow
13106
+ });
13107
 
13108
+ return this.layerRow;
13109
  };
13110
 
13111
+ ComponentAbstract.prototype.select = function (e) {
13112
+ return this.fragmentEditor.selectLayer(this, true);
13113
+ };
13114
 
13115
+ ComponentAbstract.prototype.update = function () {
13116
+ this.readyDeferred.done($.proxy(this.placement.updatePositionThrottled, this.placement));
13117
+ };
13118
 
13119
+ ComponentAbstract.prototype.updateThrottled = function () {
13120
+ this.placement.updatePositionThrottled();
13121
+ };
13122
 
13123
+ ComponentAbstract.prototype.positionSidebar = function () {
13124
+ this.fragmentEditor.layerWindow.show(this, this.layer);
13125
+ };
13126
 
13127
+ ComponentAbstract.prototype.showEditor = function () {
13128
+ this.fragmentEditor.layerWindow._show();
13129
+ };
13130
 
13131
+ ComponentAbstract.prototype.highlight = function (hideInterval) {
13132
+ hideInterval = hideInterval || 2000;
13133
+ if (this.isHighlighted) {
13134
+ clearTimeout(this.isHighlighted);
13135
+ this.isHighlighted = false;
13136
+ }
13137
+ this.layer.addClass('n2-highlight');
13138
+ this.isHighlighted = setTimeout($.proxy(function () {
13139
+ this.layer.removeClass('n2-highlight');
13140
+ }, this), hideInterval);
13141
  };
13142
 
13143
+ ComponentAbstract.prototype.setPropertydesktopPortrait =
13144
+ ComponentAbstract.prototype.setPropertydesktopLandscape =
13145
+ ComponentAbstract.prototype.setPropertytabletPortrait =
13146
+ ComponentAbstract.prototype.setPropertytabletLandscape =
13147
+ ComponentAbstract.prototype.setPropertymobilePortrait =
13148
+ ComponentAbstract.prototype.setPropertymobileLandscape = function (name, value, from) {
13149
+ this._setProperty(name, parseInt(value), from);
13150
+ };
13151
 
13152
+ ComponentAbstract.prototype.getHTML = function (base64) {
13153
+ var $layer = this._createLayer();
13154
 
13155
+ for (var k in this.property) {
13156
+ if (k != 'width' && k != 'height' && k != 'left' && k != 'top') {
13157
+ $layer.attr('data-' + k.toLowerCase(), this.property[k]);
13158
+ }
13159
+ }
13160
 
13161
+ for (var k in this.deviceProperty) {
13162
+ for (var k2 in this.deviceProperty[k]) {
13163
+ $layer.attr('data-' + k.toLowerCase() + k2, this.deviceProperty[k][k2]);
13164
+ }
13165
+ }
13166
 
13167
+ for (var k in this.deviceProperty['desktop']) {
13168
+ $layer.css(k, this.deviceProperty['desktop'][k] + 'px');
13169
+ }
13170
 
13171
+ if (this.container !== undefined) {
13172
+ var $innerContainer = $layer;
13173
+ if (this.innerContainer !== undefined) {
13174
+ $innerContainer = $layer.find(this.innerContainer);
13175
+ }
13176
 
13177
+ $innerContainer.append(this.container.getHTML(base64));
13178
+ }
 
 
 
13179
 
13180
+ var id = this.getProperty('id');
13181
+ if (id && id != '') {
13182
+ $layer.attr('id', id);
13183
  }
 
13184
 
13185
+ if (this.status > N2Classes.ComponentAbstract.STATUS.NORMAL) {
13186
+ $layer.attr('data-status', this.status);
13187
+ }
13188
 
13189
+ return $layer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13190
  };
13191
 
13192
+ ComponentAbstract.prototype.duplicate = function (needActivate) {
13193
+ var $component = this.getHTML(false);
13194
 
13195
+ if (this.placement.getType() === 'absolute') {
13196
+ var id = $component.attr('id');
13197
+ if (id) {
13198
+ id = $.fn.uid();
13199
+ $component.attr('id', id);
13200
+ $component.attr('data-id', id);
13201
+ }
13202
+ if ($component.attr('data-parentid')) {
13203
+ $component.data('desktopportraittop', 0);
13204
+ $component.data('desktopportraitleft', 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13205
  } else {
13206
+ $component.data('desktopportraittop', $component.data('desktopportraittop') + 40);
13207
+ $component.data('desktopportraitleft', $component.data('desktopportraitleft') + 40);
13208
  }
13209
+ $component.attr('data-parentid', '');
 
13210
 
13211
+ }
 
 
 
 
 
13212
 
13213
+ var newComponent = this.fragmentEditor.insertComponentWithNode(this.group, $component, this.getIndex() + 1, false, true);
 
 
 
 
 
 
13214
 
13215
+ this.layerRow.trigger('mouseleave');
13216
 
13217
+ if (needActivate) {
13218
+ newComponent.activate();
 
 
13219
  }
 
13220
 
13221
+ N2Classes.History.get().addSimple(this, this.historyDeleteDuplicated, this.historyDuplicate, [newComponent, newComponent.container ? newComponent.container.getAllLayers() : false]);
 
 
13222
 
13223
+ return newComponent;
13224
+ };
 
13225
 
13226
+ ComponentAbstract.prototype.historyDeleteDuplicated = function (historicalNewComponent) {
13227
+ historicalNewComponent.getSelf().delete();
13228
  };
13229
 
13230
+ ComponentAbstract.prototype.historyDuplicate = function (historicalNewComponent, historicalAllLayers) {
13231
+ var newComponent = this.duplicate(false, false);
13232
+ historicalNewComponent.setSelf(newComponent);
13233
 
13234
+ if (historicalAllLayers) {
13235
+ var newAllLayers = newComponent.container.getAllLayers();
13236
+ for (var i = 0; i < newAllLayers.length; i++) {
13237
+ historicalAllLayers[i].setSelf(newAllLayers[i]);
13238
+ }
13239
  }
 
13240
  };
13241
 
13242
+ ComponentAbstract.prototype.historyDelete = function () {
13243
+ this.delete();
 
 
 
 
 
 
 
13244
  };
13245
 
13246
+ ComponentAbstract.prototype.historyRestore = function ($component, historicalGroup, index, historicalAllLayers) {
13247
+ var newComponent = this.fragmentEditor.insertComponentWithNode(this.group.getSelf(), $component.clone(), index, false, true);
13248
+ this.setSelf(newComponent);
13249
 
13250
+ if (historicalAllLayers) {
13251
+ var newAllLayers = newComponent.container.getAllLayers();
13252
+ for (var i = 0; i < newAllLayers.length; i++) {
13253
+ historicalAllLayers[i].setSelf(newAllLayers[i]);
13254
+ }
13255
  }
 
 
13256
  };
13257
 
13258
+ ComponentAbstract.prototype.delete = function () {
13259
+ N2Classes.PositionDisplay.get().hide();
13260
+ nextend.tooltip.onLeave();
13261
+ this._delete();
 
13262
  };
13263
 
13264
+ ComponentAbstract.prototype._delete = function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13265
 
13266
+ this.isDeleteStarted = true;
 
 
13267
 
13268
+ if (this.fragmentEditor.mainContainer.getSelectedLayer() == this) {
13269
+ this.fragmentEditor.layerWindow.hide();
 
 
 
 
 
 
 
13270
  }
 
 
 
 
 
 
13271
 
13272
+ if (this.isHighlighted) {
13273
+ clearTimeout(this.isHighlighted);
13274
+ this.isHighlighted = false;
 
13275
  }
 
 
13276
 
13277
+ N2Classes.History.get().startBatch();
13278
+ N2Classes.History.get().addSimple(this, this.historyRestore, this.historyDelete, [this.getHTML(false), this.group, this.getIndex(), this.container ? this.container.getAllLayers() : false]);
 
 
 
 
 
13279
 
13280
+ this.deActivate();
 
 
 
 
 
 
13281
 
13282
+ if (this.container != undefined) {
13283
+ N2Classes.History.get().off();
13284
+ var layers = this.container.getSortedLayers();
13285
+ for (var i = 0; i < layers.length; i++) {
13286
+ layers[i]._delete();
13287
  }
13288
+ N2Classes.History.get().on();
13289
  }
13290
+ N2Classes.History.get().endBatch();
 
 
 
 
 
13291
 
13292
+ if (this.item != undefined) {
13293
+ this.item.delete();
13294
+ }
 
 
 
 
13295
 
13296
+ this.placement.delete();
13297
 
13298
+ // If delete happen meanwhile layer dragged or resized, we have to cancel that.
13299
+ this.layer.trigger('mouseup');
13300
 
13301
+ this.isDeleted = true;
13302
 
13303
+ this.fragmentEditor.mainContainer.layerDeleted(this);
13304
 
13305
+ this.layer.triggerHandler('LayerDeleted');
13306
+ this.getRootElement().remove();
13307
+ this.layerRow.remove();
13308
 
13309
+ this.group.update();
 
 
 
 
 
 
 
 
 
 
 
 
 
13310
 
 
 
 
 
 
 
 
 
 
 
13311
 
13312
+ this.group.$.off('baseSizeUpdated.sslayer' + this.counter);
13313
+ this.group.$.off('refreshTextAlign.sslayer' + this.counter);
13314
+ this.$.trigger('layerDeleted');
 
13315
 
13316
+ if (this.markTimer) {
13317
+ clearTimeout(this.markTimer);
13318
+ }
 
13319
 
13320
+ //delete this.fragmentEditor;
13321
+ delete this.layer;
13322
+ delete this.itemEditor;
13323
+ this.group.onChildCountChange();
13324
+ };
 
13325
 
13326
+ ComponentAbstract.prototype.getData = function (params) {
13327
+ var data = {
13328
+ type: this.type,
13329
+ lastplacement: this.placement.getType()
13330
+ };
13331
 
13332
+ if (this.status > N2Classes.ComponentAbstract.STATUS.NORMAL) {
13333
+ data.status = this.status;
13334
+ }
13335
 
13336
+ var properties = $.extend({}, this.property);
13337
 
13338
+ // store the device based properties
13339
+ for (var device in this.deviceProperty) {
13340
+ for (var property in this.deviceProperty[device]) {
13341
+ delete properties[property];
13342
+ var value = this.deviceProperty[device][property];
13343
+ if (typeof value === 'undefined') {
13344
+ continue;
13345
+ }
13346
 
13347
+ switch (property) {
13348
+ case 'width':
13349
+ case 'height':
13350
+ if (!this.isDimensionPropertyAccepted(value)) {
13351
+ value = parseFloat(value);
13352
+ }
13353
+ break;
13354
+ case 'fontsize':
13355
+ case 'left':
13356
+ case 'top':
13357
+ case 'gutter':
13358
+ case 'wrap':
13359
+ value = parseFloat(value);
13360
+ break;
13361
+ }
13362
+ data[device.toLowerCase() + property] = value;
13363
+ }
13364
+ }
13365
 
13366
+ for (var k in properties) {
13367
+ data[k.toLowerCase()] = properties[k];
13368
+ }
13369
 
13370
+ return data;
 
 
 
 
 
 
 
13371
  };
13372
 
13373
+ ComponentAbstract.prototype.onChildCountChange = function () {
 
13374
 
 
 
 
13375
  };
13376
 
13377
+ /**
13378
+ *
13379
+ * @param array layersData Contains
13380
+ * @param array layers Contains layer objects to be able to track layers in the current copy process to prevent same layer inserted into the clipboard twice when parent picker used.
13381
+ * @returns array layersData
13382
+ */
13383
+ ComponentAbstract.prototype.getDataWithChildren = function (layersData, layers) {
13384
+ if ($.inArray(this, layers) == -1) {
13385
+ layers.push(this);
13386
+ layersData.push(this.getData({
13387
+ layersIncluded: true,
13388
+ itemsIncluded: true
13389
+ }));
13390
+ this.layer.triggerHandler('LayerGetDataWithChildren', [layersData, layers]);
 
 
 
 
 
13391
  }
13392
+ return layersData;
13393
  };
13394
 
13395
+ ComponentAbstract.prototype.markOver = function (e) {
13396
+ this.layer.addClass('n2-ss-mouse-over');
13397
+ e.stopPropagation();
 
 
 
13398
 
13399
+ this.group.markEnter();
 
 
13400
 
13401
+ if (this.markTimer) {
13402
+ clearTimeout(this.markTimer);
13403
+ }
13404
+ this.layer.addClass('n2-ss-mouse-over-delayed');
13405
+ this.uiLabel.removeClass('invisible');
13406
  };
13407
 
13408
+ ComponentAbstract.prototype.markOut = function (e) {
13409
+ this.layer.removeClass('n2-ss-mouse-over');
13410
+ if (e) {
13411
+ e.stopPropagation();
13412
+ }
13413
+ this.group.markLeave();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13414
 
13415
+ if (this.markTimer) {
13416
+ clearTimeout(this.markTimer);
13417
  }
13418
+ if (!this.isActive) {
13419
+ this.uiLabel.addClass('invisible');
 
13420
  }
13421
+ this.markTimer = setTimeout($.proxy(function () {
13422
+ this.layer.removeClass('n2-ss-mouse-over-delayed');
13423
+ this.uiLabel.removeClass('invisible');
13424
+ this.markTimer = null;
13425
+ }, this), 10);
13426
  };
13427
 
13428
+ ComponentAbstract.prototype.markEnter = function (e) {
13429
+ this.layer.addClass('n2-ss-mouse-hover');
13430
+ this.group.markEnter();
 
 
13431
  };
13432
 
13433
+ ComponentAbstract.prototype.markLeave = function (e) {
13434
+ this.layer.removeClass('n2-ss-mouse-hover');
13435
+ this.group.markLeave();
 
 
 
 
 
 
 
 
13436
  };
13437
 
 
 
 
 
 
 
 
 
13438
 
13439
+ ComponentAbstract.prototype.formSetname = function (options, value) {
13440
 
 
13441
  };
13442
 
13443
+ ComponentAbstract.prototype.formSetnameSynced = function (options, value) {
 
 
 
 
 
13444
 
 
 
 
13445
  };
13446
 
13447
+ ComponentAbstract.prototype.formSetdesktopPortrait = function (options, value) {
13448
+ options.currentForm.desktopPortrait.data('field').insideChange(value);
13449
  };
13450
 
13451
+ ComponentAbstract.prototype.formSetdesktopLandscape = function (options, value) {
13452
+ options.currentForm.desktopLandscape.data('field').insideChange(value);
13453
  };
13454
 
13455
+ ComponentAbstract.prototype.formSettabletPortrait = function (options, value) {
13456
+ options.currentForm.tabletPortrait.data('field').insideChange(value);
13457
  };
13458
 
13459
+ ComponentAbstract.prototype.formSettabletLandscape = function (options, value) {
13460
+ options.currentForm.tabletLandscape.data('field').insideChange(value);
13461
  };
13462
 
13463
+ ComponentAbstract.prototype.formSetmobilePortrait = function (options, value) {
13464
+ options.currentForm.mobilePortrait.data('field').insideChange(value);
13465
  };
13466
 
13467
+ ComponentAbstract.prototype.formSetmobileLandscape = function (options, value) {
13468
+ options.currentForm.mobileLandscape.data('field').insideChange(value);
13469
  };
13470
 
13471
+ ComponentAbstract.prototype.sync = function () {
13472
+ this._syncid();
13473
+ if (this.container) {
13474
+ var layers = this.container.getSortedLayers();
13475
+ for (var i = 0; i < layers.length; i++) {
13476
+ layers[i].sync();
13477
+ }
13478
+ }
13479
+ this.placement.sync();
13480
+ };
13481
 
13482
+ ComponentAbstract.prototype._syncid = function () {
13483
+ var value = this.getProperty('id');
13484
+ if (!value || value == '') {
13485
+ this.layer.removeAttr('id');
13486
+ } else {
13487
+ this.layer.attr('id', value);
13488
  }
 
13489
  };
13490
 
13491
+ ComponentAbstract.prototype.requestID = function () {
13492
+ var id = this.getProperty('id');
13493
+ if (!id) {
13494
+ id = $.fn.uid();
13495
+ this.setProperty('id', id, 'layer');
13496
+ }
13497
+ return id;
13498
+ };
13499
 
13500
+ ComponentAbstract.prototype.requestUniqueClass = function () {
13501
+ var uniqueClass = this.getProperty('uniqueclass');
13502
+ if (!uniqueClass) {
13503
+ uniqueClass = $.fn.generateUniqueClass('n-uc-');
13504
+ this.setProperty('uniqueclass', uniqueClass, 'layer');
 
 
 
 
13505
  }
13506
+ return uniqueClass;
13507
+ };
13508
 
13509
+ /**
13510
+ * Used when duplicate or paste node to prevent class name conflicts
13511
+ */
13512
+ ComponentAbstract.prototype.regenerateUniqueClass = function () {
13513
+ if (this.getProperty('uniqueclass')) {
13514
+ this.setProperty('uniqueclass', $.fn.generateUniqueClass('n-uc-'), 'layer');
 
 
 
13515
  }
13516
+ };
13517
 
13518
+ ComponentAbstract.prototype._syncuniqueclass = function () {
13519
+ var value = this.getProperty('uniqueclass');
13520
+
13521
+ for (var i = 0; i < this.classElements.length; i++) {
13522
+ this.classElements[i].$el
13523
+ .removeClass(function (index, className) {
13524
+ return (className.match(/n-uc-[a-z0-9\-]+/gi) || []).join(' ');
13525
+ })
13526
+ .addClass(value + this.classElements[i].postfix);
13527
+ }
13528
  };
13529
 
13530
+ ComponentAbstract.prototype._syncfontsize = function () {
13531
+ this.adjustFontSize(this.getProperty('adaptivefont'), this.getProperty('fontsize'), true);
13532
  };
13533
 
13534
+ ComponentAbstract.prototype._syncadaptivefont = function () {
13535
+ this.adjustFontSize(this.getProperty('adaptivefont'), this.getProperty('fontsize'), true);
 
 
 
 
13536
  };
13537
 
13538
+ ComponentAbstract.prototype.adjustFontSize = function (isAdaptive, fontSize, shouldUpdatePosition) {
13539
+ fontSize = parseInt(fontSize);
13540
+ if (parseInt(isAdaptive)) {
13541
+ this.layer.css('font-size', (16 * fontSize / 100) + 'px');
13542
+ } else if (fontSize != 100) {
13543
+ this.layer.css('font-size', fontSize + '%');
13544
+ } else {
13545
+ this.layer.css('font-size', '');
13546
+ }
13547
+ this.refreshBaseSize();
13548
+ if (shouldUpdatePosition) {
13549
+ this.update();
13550
  }
 
13551
  };
13552
 
13553
+ ComponentAbstract.prototype.refreshBaseSize = function () {
13554
+ var fontSize = this.getFontSize();
13555
+ if (this.isAdaptiveFont()) {
13556
+ this.baseSize = (16 * fontSize / 100);
13557
+ } else {
13558
+ this.baseSize = this.group.baseSize * fontSize / 100;
13559
+ }
13560
+ this.$.triggerHandler('baseSizeUpdated');
13561
+ };
13562
 
13563
+ ComponentAbstract.prototype.refreshTextAlign = function () {
 
 
13564
 
13565
+ this.$.triggerHandler('textAlignUpdated');
13566
+ }
13567
 
13568
+ ComponentAbstract.prototype.getFontSize = function () {
13569
+ return parseInt(this.getProperty('fontsize'));
13570
+ };
13571
 
13572
+ ComponentAbstract.prototype.isAdaptiveFont = function () {
13573
+ return parseInt(this.getProperty('adaptivefont'));
13574
+ };
13575
 
13576
+ ComponentAbstract.prototype._synccrop = function () {
13577
+ var value = this.getProperty('crop');
13578
+ if (value == 'auto') {
13579
+ value = 'hidden';
13580
  }
13581
 
13582
+ if (value == 'mask') {
13583
+ value = 'hidden';
13584
+ this.addWrap('mask', "<div class='n2-ss-layer-mask'></div>");
 
13585
 
13586
+ } else {
13587
+ this.removeWrap('mask');
 
 
 
13588
 
13589
+ this.layer.data('animatableselector', null);
 
13590
  }
13591
+ this.layer.css('overflow', value);
 
13592
  };
13593
 
13594
+ ComponentAbstract.prototype._syncrotation = function () {
13595
+ var rotation = parseFloat(this.getProperty('rotation'));
13596
+ if (rotation / 360 != 0) {
13597
+ var $el = this.addWrap('rotation', "<div class='n2-ss-layer-rotation'></div>");
13598
 
13599
+ NextendTween.set($el[0], {
13600
+ rotationZ: rotation
13601
+ });
13602
+ } else {
13603
+ this.removeWrap('rotation');
13604
+ }
13605
  };
13606
 
13607
+ ComponentAbstract.prototype.addWrap = function (key, html) {
13608
+ if (this.wraps[key] === undefined) {
13609
+ var $el = $(html);
13610
+ this.wraps[key] = $el;
13611
 
13612
+ switch (key) {
13613
+ case 'mask':
13614
+ $el.appendTo(this.layer);
13615
+ if (this.wraps.rotation !== undefined) {
13616
+ $el.append(this.wraps.rotation);
13617
+ } else {
13618
+ $el.append(this.getContents());
13619
+ }
13620
+ this.layer.data('animatableselector', '.n2-ss-layer-mask:first');
13621
+ break;
13622
+ case 'rotation':
13623
+ if (this.wraps.mask !== undefined) {
13624
+ $el.appendTo(this.wraps.mask);
13625
+ } else {
13626
+ $el.appendTo(this.layer);
13627
+ }
13628
+ $el.append(this.getContents());
13629
+ break;
13630
+ }
13631
  }
13632
+ return this.wraps[key];
13633
  };
13634
 
13635
+ ComponentAbstract.prototype.removeWrap = function (key) {
13636
+ if (this.wraps[key] !== undefined) {
 
 
 
13637
 
13638
+ switch (key) {
13639
+ case 'mask':
13640
+ if (this.wraps.rotation !== undefined) {
13641
+ this.layer.append(this.wraps.rotation);
13642
+ } else {
13643
+ this.layer.append(this.getContents());
13644
+ }
13645
+ break;
13646
+ case 'rotation':
13647
+ if (this.wraps.mask !== undefined) {
13648
+ this.wraps.mask.append(this.getContents());
13649
+ } else {
13650
+ this.layer.append(this.getContents());
13651
+ }
13652
+ break;
13653
+ }
13654
+ this.wraps[key].remove();
13655
+ delete this.wraps[key];
13656
  }
13657
+ };
13658
 
13659
+ ComponentAbstract.prototype.getContents = function () {
13660
+ return false;
13661
+ };
13662
 
13663
+ ComponentAbstract.prototype._syncclass = function () {
13664
+ if (this._lastClasses !== false) {
13665
+ this.layer.removeClass(this._lastClasses);
13666
+ }
13667
+ var value = this.fragmentEditor.editor.generator.fill(this.getProperty('class'));
13668
 
13669
+ if (value && value != '') {
13670
+ this.layer.addClass(value);
13671
+ this._lastClasses = value;
13672
+ } else {
13673
+ this._lastClasses = false;
13674
+ }
13675
  };
13676
 
13677
+ ComponentAbstract.prototype._syncparallax = function () {
13678
+
 
 
13679
  };
13680
 
13681
+ ComponentAbstract.prototype._syncgeneratorvisible = function () {
 
 
 
 
13682
  };
13683
 
13684
+ ComponentAbstract.prototype._syncmouseenter =
13685
+ ComponentAbstract.prototype._syncclick =
13686
+ ComponentAbstract.prototype._syncmouseleave =
13687
+ ComponentAbstract.prototype._syncplay =
13688
+ ComponentAbstract.prototype._syncpause =
13689
+ ComponentAbstract.prototype._syncstop = function () {
13690
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13691
 
 
 
13692
 
13693
+ ComponentAbstract.prototype.renderModeProperties = function (isReset) {
 
 
13694
 
13695
+ N2Classes.LayerDataStorage.prototype.renderModeProperties.call(this);
 
 
 
13696
 
 
 
 
13697
 
13698
+ this.placement.renderModeProperties(isReset);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13699
  };
13700
 
13701
+ ComponentAbstract.prototype.getIndex = function () {
13702
+ return this.group.container.getLayerIndex(this.layer);
13703
+ };
13704
 
13705
+ ComponentAbstract.prototype.toString = function () {
13706
+ return this.type + ' #' + this.counter;
13707
+ };
13708
 
13709
+ ComponentAbstract.prototype.historyStoreOnPlacement = function () {
13710
+ var args = Array.prototype.slice.call(arguments);
13711
+ args.splice(1, 1);
13712
+ this.placement.current[arguments[1]].apply(this.placement.current, args);
13713
+ };
13714
 
13715
+ ComponentAbstract.prototype.getDroppable = function () {
13716
+ return false;
13717
+ };
13718
 
13719
+ ComponentAbstract.prototype.onCanvasUpdate = function (originalIndex, targetGroup, newIndex) {
13720
 
13721
+ if (this.group === targetGroup) {
 
13722
 
13723
+ if (originalIndex != newIndex) {
13724
+ this.userIndexChange(originalIndex, newIndex)
13725
+ }
13726
+ } else {
13727
+ var oldAbsoluteParent;
13728
+ if (this.fragmentEditor.isCol(this.group)) {
13729
+ oldAbsoluteParent = this;
13730
+ while (oldAbsoluteParent && (!oldAbsoluteParent.placement || oldAbsoluteParent.placement.getType() !== 'absolute')) {
13731
+ oldAbsoluteParent = oldAbsoluteParent.group;
13732
+ }
13733
+ }
13734
+ this.changeGroup(originalIndex, targetGroup);
13735
 
13736
+ targetGroup.onChildCountChange();
 
13737
 
13738
+ // Find the the first absolute element from the layer parents
13739
+ var absoluteParent = this;
13740
+ while (absoluteParent && (!absoluteParent.placement || absoluteParent.placement.getType() !== 'absolute')) {
13741
+ absoluteParent = absoluteParent.group;
13742
+ }
13743
 
13744
+ // Update the closest absolute parent's position as the content changed
13745
+ if (oldAbsoluteParent && oldAbsoluteParent != absoluteParent) {
13746
+ oldAbsoluteParent.placement.updatePosition();
13747
+ }
13748
+ if (absoluteParent) {
13749
+ absoluteParent.placement.updatePosition();
13750
+ }
13751
  }
13752
+ };
13753
 
13754
+ ComponentAbstract.prototype.setStatusNormal = function () {
13755
+ this.changeStatus(ComponentAbstract.STATUS.NORMAL);
 
13756
  };
13757
 
13758
+ ComponentAbstract.prototype.changeStatus = function (status) {
13759
+ var oldStatus = this.status;
13760
 
13761
+ if (status == this.status) {
13762
+ status = ComponentAbstract.STATUS.NORMAL;
 
 
13763
  }
13764
 
13765
+ switch (this.status) {
13766
+ case ComponentAbstract.STATUS.HIDDEN:
13767
+ this.getRootElement().removeAttr('data-visibility');
13768
+ this.layerRow.removeClass('n2-ss-layer-status-hidden');
13769
+ break;
13770
+ case ComponentAbstract.STATUS.LOCKED:
13771
+ this.layer.removeClass('n2-ss-layer-locked');
13772
+ this.layerRow.removeClass('n2-ss-layer-status-locked');
13773
+ break;
13774
  }
13775
 
13776
+ this.status = status;
 
 
 
 
 
 
 
 
13777
 
13778
+ switch (this.status) {
13779
+ case ComponentAbstract.STATUS.HIDDEN:
13780
+ this.getRootElement().attr('data-visibility', 'hidden');
13781
+ this.layerRow.addClass('n2-ss-layer-status-hidden');
13782
+ break;
13783
+ case ComponentAbstract.STATUS.LOCKED:
13784
+ this.layer.addClass('n2-ss-layer-locked');
13785
+ this.layerRow.addClass('n2-ss-layer-status-locked');
13786
+ break;
13787
  }
13788
 
13789
+ this.placement.current.changeStatus(oldStatus, this.status);
 
 
 
 
 
13790
 
13791
+ };
 
 
 
13792
 
13793
+ ComponentAbstract.prototype.moveX = function (x) {
13794
+ if (this.placement.getType() == 'absolute') {
13795
+ this.placement.current.moveX(x);
 
13796
  }
13797
+ };
13798
 
13799
+ ComponentAbstract.prototype.moveY = function (y) {
13800
+ if (this.placement.getType() == 'absolute') {
13801
+ this.placement.current.moveY(y);
13802
  }
 
 
13803
  };
13804
 
13805
+ ComponentAbstract.prototype.localStyleSync = function () {
13806
+ if (this.localStyle !== undefined) {
13807
+ var rulesToDelete = [],
13808
+ css = '';
13809
+ if (this.$localStyle !== undefined) {
13810
+ this.$localStyle.remove();
13811
+ delete this.$localStyle;
13812
+ }
 
 
 
 
 
 
 
 
 
13813
 
13814
+ for (var i = 0; i < this.localStyle.length; i++) {
13815
 
13816
+ var rule = '@rule' + this.localStyle[i].selector,
13817
+ style = '';
13818
+ rulesToDelete.push(rule);
13819
 
13820
+ if (Object.keys(this.localStyle[i].css).length === 1 && this.localStyle[i].css.transition !== undefined) {
13821
+ continue;
 
 
13822
  }
13823
+ for (var k in this.localStyle[i].css) {
13824
+ style += this.localStyle[i].css[k];
13825
+ }
13826
+ if (style != '') {
13827
+ css += rule + '{' + style + '}';
13828
+ }
13829
+ }
 
 
 
 
13830
 
13831
+ var className = this.getProperty('uniqueclass');
13832
+ if (className) {
13833
+ // We have to remove all previous rules before adding new ones.
13834
+ for (var i = 0; i < rulesToDelete.length; i++) {
13835
+ nextend.css.deleteRule(rulesToDelete[i].replace(/@rule/g, window.nextend.pre + '.' + className));
13836
+ }
13837
+ }
13838
+ if (css != '') {
13839
+ if (!className) {
13840
+ className = this.requestUniqueClass();
13841
+ }
13842
+ this.$localStyle = $("<style>" + css.replace(/@rule/g, window.nextend.pre + '.' + className) + "</style>").appendTo("head");
13843
+ }
13844
+ }
13845
+ };
13846
 
13847
+ ComponentAbstract.prototype.addLocalStyle = function (group, name, style) {
13848
+ for (var i = 0; i < this.localStyle.length; i++) {
13849
+ if (this.localStyle[i].group === group) {
13850
+ if (style === '') {
13851
+ if (this.localStyle[i].css[name] !== undefined) {
13852
+ delete this.localStyle[i].css[name];
13853
+ }
13854
+ } else {
13855
+ this.localStyle[i].css[name] = style;
13856
+ }
13857
+ this.localStyleSyncThrottled();
13858
+ break;
13859
+ }
13860
+ }
13861
+ };
13862
 
13863
+ ComponentAbstract.prototype.addClassElement = function ($el, postfix) {
13864
+ if (arguments.length < 2) postfix = '';
13865
+ this.classElements.push({
13866
+ $el: $el,
13867
+ postfix: postfix
13868
+ });
13869
+ };
13870
 
13871
+ ComponentAbstract.prototype.setState = function (name, value) {
13872
+ };
13873
 
13874
+ return ComponentAbstract;
13875
+ });
13876
+ N2D('Content', ['ContentAbstract'], function ($, undefined) {
13877
+ "use strict";
13878
 
13879
+ /**
13880
+ * @memberOf N2Classes
13881
+ *
13882
+ * @constructor
13883
+ * @augments ComponentAbstract
13884
+ */
13885
+ function Content(fragmentEditor, group, properties) {
13886
+ this.label = n2_('Content');
13887
+ this.type = 'content';
13888
 
13889
+ this.innerContainer = '> .n2-ss-layer-content';
 
13890
 
13891
+ this._defaults = $.extend({verticalalign: 'center'}, this._defaults);
 
 
 
13892
 
 
 
 
13893
 
13894
+ this.localStyle = [
13895
+ {
13896
+ group: 'normal', selector: '-inner', css: {
13897
+ transition: 'transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;'
13898
+ }
13899
+ },
13900
+ {group: 'hover', selector: '-inner:HOVER', css: {}}
13901
+ ];
13902
 
13903
+ N2Classes.ContentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
 
 
13904
 
13905
+ this.placement.allow('content');
 
 
13906
 
13907
+ fragmentEditor.setMainContent(this);
13908
+ }
 
13909
 
13910
+ Content.prototype = Object.create(N2Classes.ContentAbstract.prototype);
13911
+ Content.prototype.constructor = Content;
13912
 
13913
+ Content.prototype.addUILabels = function () {
13914
+ this.markTimer = null;
13915
+ this.uiLabel = $('<div class="n2-ss-layer-ui-label-container"><div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-self">' + this.getUILabel() + '</div></div>')
13916
+ .appendTo(this.layer);
13917
+ };
13918
 
13919
+ Content.prototype.addProperties = function ($layer) {
 
 
 
13920
 
13921
+ N2Classes.ContentAbstract.prototype.addProperties.call(this, $layer);
13922
+
13923
+ this.createDeviceProperty('selfalign', {desktopPortrait: 'inherit'}, $layer);
13924
 
 
 
13925
  };
13926
 
13927
+ Content.prototype.getRootElement = function () {
13928
+ return this.layer;
13929
+ };
13930
 
13931
+ Content.prototype.getBackgroundElement = function () {
13932
+ return this.layer;
13933
+ };
13934
 
13935
+ Content.prototype._createLayer = function () {
13936
+ return $('<div class="n2-ss-layer n2-ss-content-empty"><div class="n2-ss-section-main-content n2-ss-layer-content"></div></div>')
13937
+ .attr('data-sstype', this.type);
 
13938
  };
13939
 
13940
+ Content.prototype.createRow = function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13941
 
13942
+ this.$content = this.layer.find('.n2-ss-layer-content:first');
 
 
 
 
 
 
 
 
 
 
13943
 
13944
+ this.addClassElement(this.layer);
13945
+ this.addClassElement(this.$content, '-inner');
 
 
 
 
 
 
13946
 
 
13947
 
13948
+ var status = $('<div class="n2-ss-layer-status"></div>'),
13949
+ remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this));
13950
 
13951
+ this.container = new N2Classes.LayerContainer(this, $('<ul class="n2-list n2-h4 n2-list-orderable" />'), 'normal', '> .n2-ss-layer', ['row', 'layer']);
13952
+ this.container.setLayerContainerElement(this.$content);
13953
 
 
 
 
 
 
 
 
13954
 
13955
+ $('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(status).on('click', $.proxy(function (e) {
13956
+ e.preventDefault();
13957
+ if (this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN) {
13958
+ this.setStatusNormal();
13959
+ } else {
13960
+ this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN);
13961
+ }
13962
+ }, this));
13963
+
13964
+ this._createLayerListRow([
13965
+ $('<div class="n2-actions-left"></div>').append(status),
13966
+ $('<div class="n2-actions"></div>').append(remove)
13967
+ ]).addClass('n2-ss-layer-content-row');
13968
 
 
 
13969
 
13970
+ this.openerElement = $('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-col"></i></a>').insertBefore(this.layerTitleSpan)
13971
+ .on('click', $.proxy(this.switchOpened, this));
13972
 
13973
+ this.container.$ul.appendTo(this.layerRow);
13974
 
13975
+ this.readyDeferred.done($.proxy(this._syncopened, this));
13976
  };
13977
 
13978
+ Content.prototype.create = function () {
13979
 
13980
+ this.originalProperties.adaptivefont = 1;
13981
 
13982
+ N2Classes.ContentAbstract.prototype.create.call(this);
13983
 
13984
+ this._syncselfalign();
 
 
 
 
 
 
 
 
13985
 
13986
  this._onReady();
13987
  };
13988
 
13989
+ Content.prototype.load = function ($layer, isEditorStart) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13990
 
13991
+ N2Classes.ContentAbstract.prototype.load.call(this, $layer, isEditorStart);
 
 
13992
 
13993
+ this._syncselfalign();
13994
 
13995
+ this._onReady();
13996
+ };
 
 
 
 
 
 
 
 
13997
 
13998
+ Content.prototype._onReady = function () {
13999
+ N2Classes.ContentAbstract.prototype._onReady.call(this);
14000
+ this.startUISizing();
14001
+ };
14002
 
14003
+ Content.prototype.startUISizing = function () {
14004
+ this.layer.nUINormalSizing({
14005
+ start: $.proxy(function (e, prop) {
14006
+ N2Classes.PositionDisplay.get().show('NormalSizing');
14007
+ if (prop === 'maxwidth') {
14008
+ this.layer.attr('data-has-maxwidth', '1');
 
14009
  }
 
 
 
 
 
14010
  }, this),
14011
+ resizeMaxWidth: $.proxy(function (e, ui) {
 
 
 
 
 
 
 
 
14012
 
14013
+ N2Classes.PositionDisplay.get().update(e, 'NormalSizing', 'Max-width: ' + (ui.value == 0 ? 'none' : (ui.value + 'px')));
 
 
 
 
14014
 
14015
+ }, this),
14016
+ stopMaxWidth: $.proxy(function (e, ui) {
14017
+ N2Classes.PositionDisplay.get().hide('NormalSizing');
14018
+ this.setProperty('maxwidth', ui.value);
 
 
 
 
 
 
 
 
 
 
 
 
 
14019
  }, this)
14020
  });
14021
  };
14022
 
14023
+ Content.prototype.delete = function () {
14024
+ var layers = this.container.getSortedLayers();
14025
+ for (var i = 0; i < layers.length; i++) {
14026
+ layers[i].delete();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14027
  }
 
 
14028
  };
14029
 
14030
+ Content.prototype.remove = function () {
14031
+ this._delete();
 
14032
  };
14033
 
14034
+ Content.prototype.update = function () {
14035
+ this.fragmentEditor.editor.getMainContainerElement().triggerHandler('updateSize');
14036
  };
14037
 
14038
+ Content.prototype.onChildCountChange = function () {
14039
+
14040
+ var layers = this.container.getSortedLayers();
14041
+
14042
+ this.layer.toggleClass('n2-ss-content-empty', layers.length == 0);
14043
  };
14044
 
14045
+ Content.prototype.renderModeProperties = function (isReset) {
14046
+ N2Classes.ContentAbstract.prototype.renderModeProperties.call(this, isReset);
14047
 
14048
+ this._syncselfalign();
14049
+ };
 
 
 
 
14050
 
14051
+ Content.prototype._syncselfalign = function () {
14052
+ this.layer.attr('data-cssselfalign', this.getProperty('selfalign'));
14053
  };
14054
 
14055
+ Content.prototype.duplicate = function (needActivate) {
14056
+ console.error('Content can not be duplicated!');
14057
+ };
14058
 
14059
+ return Content;
14060
+ });
14061
+ N2D('ContentAbstract', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
14062
+ "use strict";
14063
 
14064
+ /**
14065
+ * @memberOf N2Classes
14066
+ *
14067
+ * @param fragmentEditor
14068
+ * @param group
14069
+ * @param properties
14070
+ * @constructor
14071
+ * @augments ComponentAbstract
14072
+ */
14073
+ function ContentAbstract(fragmentEditor, group, properties) {
14074
 
14075
+ this._defaults = $.extend({verticalalign: 'flex-start'}, this._defaults);
 
14076
 
14077
+ this._syncbgThrottled = NextendThrottle(this._syncbgThrottled, 50);
 
 
 
 
14078
 
14079
+ this.stylemode = '';
 
 
 
 
 
 
 
14080
 
14081
+ N2Classes.ComponentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
14082
+ }
 
 
14083
 
14084
+ ContentAbstract.prototype = Object.create(N2Classes.ComponentAbstract.prototype);
14085
+ ContentAbstract.prototype.constructor = ContentAbstract;
14086
 
14087
+ ContentAbstract.prototype.addProperties = function ($layer) {
14088
 
14089
+ this.createProperty('opened', 1, $layer, this);
14090
 
14091
+ N2Classes.ComponentAbstract.prototype.addProperties.call(this, $layer);
 
14092
 
14093
+ this.createProperty('bgimage', '', $layer);
14094
+ this.createProperty('bgimagex', 50, $layer);
14095
+ this.createProperty('bgimagey', 50, $layer);
14096
+ this.createProperty('bgimageparallax', 0, $layer);
14097
 
14098
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolor', '00000000', {
14099
+ "-hover": undefined
14100
+ }, this, "stylemode"), $layer);
14101
 
14102
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradient', 'off', {
14103
+ "-hover": undefined
14104
+ }, this, "stylemode"), $layer);
14105
+
14106
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradientend', '00000000', {
14107
+ "-hover": undefined
14108
+ }, this, "stylemode"), $layer);
14109
+
14110
+ this.createProperty('verticalalign', this._defaults.verticalalign, $layer);
14111
+
14112
+ this.createDeviceProperty('maxwidth', {desktopPortrait: 0}, $layer);
14113
+
14114
+ this.createDeviceProperty('inneralign', {desktopPortrait: 'inherit'}, $layer);
14115
+ this.createDeviceProperty('padding', {desktopPortrait: '10|*|10|*|10|*|10|*|px+'}, $layer);
14116
+
14117
+
14118
+ this.$.on('baseSizeUpdated.contentAbstract', $.proxy(this._syncpadding, this));
14119
  };
14120
 
14121
+ ContentAbstract.prototype.getBackgroundElement = function () {
14122
+ return this.$content;
14123
+ };
14124
 
14125
+ ContentAbstract.prototype.getPaddingElement = function () {
14126
+ return this.$content;
14127
+ };
14128
 
14129
+ ContentAbstract.prototype.create = function () {
14130
+ N2Classes.ComponentAbstract.prototype.create.call(this);
14131
+
14132
+ this.initUI();
14133
+
14134
+ this._syncverticalalign();
14135
+
14136
+ this._syncmaxwidth();
14137
+ this._syncpadding();
14138
+ this._syncinneralign();
14139
+ this._syncbgThrottled();
14140
  };
14141
 
14142
+ ContentAbstract.prototype.load = function ($layer, isEditorStart) {
14143
+
14144
+ N2Classes.ComponentAbstract.prototype.load.call(this, $layer, isEditorStart);
14145
+
14146
+ this.initUI();
14147
+
14148
+ this._syncverticalalign();
14149
+ this._syncmaxwidth();
14150
+ this._syncpadding();
14151
+ this._syncinneralign();
14152
+ this._syncbgThrottled();
14153
+
14154
+ this.container.startWithExistingNodes(isEditorStart);
14155
+ };
14156
+
14157
+ ContentAbstract.prototype.initUI = function () {
14158
+
14159
+ this.layer.on({
14160
+ mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerClicked'),
14161
+ click: $.proxy(function (e) {
14162
+ if (!nextend.shouldPreventMouseUp && this.fragmentEditor.preventActivationBubbling()) {
14163
+ this.activate(e);
14164
+ }
14165
+ }, this),
14166
+ dblclick: $.proxy(function (e) {
14167
+ e.stopPropagation();
14168
+ $('[data-tab="layer"]').trigger('click');
14169
+ }, this)
14170
+ });
14171
+
14172
+ this.getPaddingElement().nUISpacing({
14173
+ handles: 'n, s, e, w',
14174
+ start: $.proxy(function (e, ui) {
14175
+ N2Classes.PositionDisplay.get().show('Spacing');
14176
+ }, this),
14177
+ spacing: $.proxy(function (e, ui) {
14178
+ var html = '';
14179
+ for (var k in ui.changed) {
14180
+ html += 'Padding ' + k + ': ' + ui.changed[k] + 'px<br>';
14181
+ }
14182
+
14183
+ N2Classes.PositionDisplay.get().update(e, 'Spacing', html);
14184
+ }, this),
14185
+ stop: $.proxy(this.onSpacingStop, this),
14186
+ });
14187
+ };
14188
+
14189
+ ContentAbstract.prototype.onSpacingStop = function (event, ui) {
14190
+ N2Classes.PositionDisplay.get().hide('Spacing');
14191
+ var padding = this.getPadding().split('|*|'),
14192
+ ratioH = 1,
14193
+ ratioV = 1;
14194
+
14195
+ if (padding[padding.length - 1] == 'px+' && Math.abs(parseFloat(this.layer.css('fontSize')) - this.baseSize) > 1) {
14196
+ ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
14197
+ ratioV = this.fragmentEditor.getResponsiveRatioVertical();
14198
+ }
14199
+
14200
+ for (var k in ui.changed) {
14201
+ var value = ui.changed[k];
14202
+ switch (k) {
14203
+ case 'top':
14204
+ padding[0] = Math.round(value / ratioV);
14205
+ break;
14206
+ case 'right':
14207
+ padding[1] = Math.round(value / ratioH);
14208
+ break;
14209
+ case 'bottom':
14210
+ padding[2] = Math.round(value / ratioV);
14211
+ break;
14212
+ case 'left':
14213
+ padding[3] = Math.round(value / ratioH);
14214
+ break;
14215
+ }
14216
+ }
14217
+ this.setProperty('padding', padding.join('|*|'));
14218
+ $('#layercol-padding').data('field').insideChange(padding.join('|*|'));
14219
+ };
14220
+
14221
+ ContentAbstract.prototype.switchOpened = function (e) {
14222
  e.preventDefault();
14223
  if (this.getProperty('opened')) {
14224
  this.setProperty('opened', 0);
14227
  }
14228
  };
14229
 
14230
+ ContentAbstract.prototype._syncopened = function () {
14231
  if (this.getProperty('opened')) {
14232
  this.openerElement.removeClass('n2-closed');
14233
  this.container.$ul.css('display', '');
14241
  }
14242
  };
14243
 
14244
+ ContentAbstract.prototype.getPadding = function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14245
  return this.getProperty('padding');
14246
  };
14247
 
14248
+ ContentAbstract.prototype._syncpadding = function () {
14249
  var padding = this.getPadding().split('|*|'),
14250
  unit = padding.pop(),
14251
  baseSize = this.baseSize;
 
14252
  if (unit == 'px+' && baseSize > 0) {
14253
  unit = 'em';
14254
  for (var i = 0; i < padding.length; i++) {
14257
  }
14258
 
14259
  var css = padding.join(unit + ' ') + unit;
14260
+ this.getPaddingElement().css('padding', css);
 
 
14261
  this.update();
 
14262
 
14263
+ this.getPaddingElement().nUISpacing('option', 'current', css);
 
14264
  };
14265
 
14266
+ ContentAbstract.prototype._syncmaxwidth = function () {
14267
+ var value = parseInt(this.getProperty('maxwidth'));
14268
+ if (value <= 0 || isNaN(value)) {
14269
+ this.layer.css('maxWidth', '')
14270
+ .attr('data-has-maxwidth', '0');
14271
+ } else {
14272
+ this.layer.css('maxWidth', value + 'px')
14273
+ .attr('data-has-maxwidth', '1');
 
14274
  }
14275
 
14276
+ this.update();
14277
+ };
 
 
14278
 
14279
+ ContentAbstract.prototype.getInnerAlign = function () {
14280
+ return this.getProperty('inneralign');
14281
+ };
14282
 
14283
+ ContentAbstract.prototype._syncinneralign = function () {
14284
+ this.layer.attr('data-csstextalign', this.getInnerAlign());
14285
 
14286
+ this.refreshTextAlign();
14287
  };
14288
 
14289
+ ContentAbstract.prototype.getVerticalAlign = function () {
14290
+ return this.getProperty('verticalalign');
14291
+ };
 
 
 
14292
 
14293
+ ContentAbstract.prototype._syncverticalalign = function () {
14294
+ this.$content.attr('data-verticalalign', this.getVerticalAlign());
14295
+ };
 
 
14296
 
14297
+ ContentAbstract.prototype._syncbgimage =
14298
+ ContentAbstract.prototype._syncbgimagex =
14299
+ ContentAbstract.prototype._syncbgimagey =
14300
+ ContentAbstract.prototype._syncbgimageparallax =
14301
+ ContentAbstract.prototype._syncbgcolor =
14302
+ ContentAbstract.prototype._syncbgcolorgradient =
14303
+ ContentAbstract.prototype._syncbgcolorgradientend =
14304
+ ContentAbstract.prototype['_syncbgcolor-hover'] =
14305
+ ContentAbstract.prototype['_syncbgcolorgradient-hover'] =
14306
+ ContentAbstract.prototype['_syncbgcolorgradientend-hover'] = function () {
14307
+ this._syncbgThrottled();
14308
+ };
14309
 
14310
+
14311
+ ContentAbstract.prototype._syncbgThrottled = function () {
14312
+ var background = '',
14313
+ image = this.fragmentEditor.editor.generator.fill(this.getProperty('bgimage')),
14314
+ gradientBackgroundProps = '';
14315
+ if (image != '') {
14316
+ var x = parseInt(this.getProperty('bgimagex'));
14317
+ if (!isFinite(x)) {
14318
+ x = 50;
14319
+ }
14320
+ var y = parseInt(this.getProperty('bgimagey'));
14321
+ if (!isFinite(y)) {
14322
+ y = 50;
14323
  }
14324
+ background += 'URL("' + nextend.imageHelper.fixed(image) + '") ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '');
14325
+ gradientBackgroundProps = ' ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '')
14326
+ }
14327
+ var color = this.getProperty('bgcolor'),
14328
+ gradient = this.getProperty('bgcolorgradient'),
14329
+ colorend = this.getProperty('bgcolorgradientend');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14330
 
14331
  var normalStyle = this.getBackgroundCSS(color, gradient, colorend, background, gradientBackgroundProps);
14332
 
14364
  this.addLocalStyle('hover', 'bgcolor', hoverStyle);
14365
  };
14366
 
14367
+ ContentAbstract.prototype.getBackgroundCSS = function (color, gradient, colorend, backgroundImage, gradientBackgroundProps) {
14368
  if (N2Color.hex2alpha(color) != 0 || (gradient != 'off' && N2Color.hex2alpha(colorend) != 0)) {
14369
  var after = '';
14370
  if (backgroundImage != '') {
14392
  return '';
14393
  };
14394
 
14395
+ ContentAbstract.prototype.getData = function (params) {
14396
  var data = N2Classes.ComponentAbstract.prototype.getData.call(this, params);
14397
 
14398
+ if (params.layersIncluded) {
14399
+ data.layers = this.container.getData(params);
14400
  }
14401
+
14402
  return data;
14403
  };
14404
 
14405
+ ContentAbstract.prototype.onChildCountChange = function () {
14406
+ this.layer.toggleClass('n2-ss-content-empty', this.container.getLayerCount() == 0);
 
 
 
 
 
 
 
 
14407
 
14408
+ this.update();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14409
  };
14410
 
14411
+ ContentAbstract.prototype.renderModeProperties = function (isReset) {
14412
+ N2Classes.ComponentAbstract.prototype.renderModeProperties.call(this, isReset);
14413
 
14414
+ this._syncmaxwidth();
 
14415
 
14416
+ this._syncpadding();
14417
+ this._syncinneralign();
14418
  };
14419
 
14420
+ ContentAbstract.prototype.getDroppable = function () {
14421
+ if (!this.layer.is(":visible") || this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN || this.status == N2Classes.ComponentAbstract.STATUS.LOCKED) {
14422
+ return 'hidden';
14423
+ }
14424
+ return {
14425
+ $container: this.$content,
14426
+ layer: this,
14427
+ placement: 'normal',
14428
+ axis: 'y'
14429
+ }
14430
  };
14431
 
14432
+ ContentAbstract.prototype.getLLDroppable = function (layer) {
14433
+ switch (layer.type) {
14434
+ case 'layer':
14435
+ case 'row':
14436
+ return {
14437
+ $container: this.container.$ul,
14438
+ layer: this
14439
+ };
14440
+ break;
14441
  }
14442
+ return false;
14443
+ };
14444
 
14445
+ ContentAbstract.prototype.getContents = function () {
14446
+ return this.$content;
 
 
14447
  };
14448
 
14449
+ ContentAbstract.prototype.setPropertystylemode = function (name, value, from) {
14450
+ this.stylemode = value;
 
 
 
14451
 
14452
+ this.syncAdvancedField('bgcolor');
14453
+ this.syncAdvancedField('bgcolorgradient');
14454
+ this.syncAdvancedField('bgcolorgradientend');
14455
+ };
14456
 
14457
+ ContentAbstract.prototype.onSyncFields = function () {
14458
+ this.fragmentEditor.layerOptions.updateField('stylemode', this.stylemode);
14459
  };
14460
 
14461
+ return ContentAbstract;
14462
+ });
14463
+ N2D('Layer', ['ComponentAbstract'], function ($, undefined) {
14464
+ "use strict";
14465
 
14466
+ /**
14467
+ * @memberOf N2Classes
14468
+ *
14469
+ * @constructor
14470
+ * @augments ComponentAbstract
14471
+ */
14472
+ function Layer(fragmentEditor, group, properties) {
14473
+ this.label = n2_('Layer');
14474
+ this.type = 'layer';
14475
 
14476
+ this.parent = false;
14477
 
14478
+ this.itemEditor = fragmentEditor.itemEditor;
 
 
 
 
 
 
 
 
 
14479
 
14480
+ N2Classes.ComponentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14481
 
14482
+ this.placement.allow('absolute');
14483
+ this.placement.allow('normal');
14484
+
14485
+ this.$.on('load create', $.proxy(this.startItem, this));
14486
  };
14487
 
14488
+ Layer.prototype = Object.create(N2Classes.ComponentAbstract.prototype);
14489
+ Layer.prototype.constructor = Layer;
14490
+
14491
+
14492
+ Layer.prototype.create = function () {
14493
+
14494
+ N2Classes.ComponentAbstract.prototype.create.apply(this, arguments);
14495
+
14496
+ this.initUI();
14497
+
14498
+ this._onReady();
14499
  };
14500
 
14501
+ Layer.prototype.load = function ($layer, isEditorStart) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14502
 
14503
+ N2Classes.ComponentAbstract.prototype.load.call(this, $layer, isEditorStart);
14504
+
14505
+ this.initUI();
14506
+
14507
+ this._onReady();
 
 
 
14508
  };
14509
 
14510
+ Layer.prototype.startItem = function () {
14511
+ var $item = this.layer.find('.n2-ss-item');
14512
 
14513
+ new N2Classes[this.itemEditor.getItemClass($item.data('item'))]($item, this, this.itemEditor);
 
 
14514
 
14515
+ this.layer.nUICanvasItem({
14516
+ canvasUIManager: this.fragmentEditor.mainContainer.canvasUIManager,
14517
+ layer: this,
14518
+ $layer: this.layer
14519
+ });
14520
+
14521
+ if (this.item.needSize) {
14522
+ this.layer.addClass('n2-ss-layer-needsize');
14523
  }
14524
  };
14525
 
14526
+ Layer.prototype.initUI = function () {
14527
 
14528
+ this.layer.on({
14529
+ mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerClicked'),
14530
+ click: $.proxy(function (e) {
14531
+ if (this.fragmentEditor.preventActivationBubbling()) {
14532
+ this.activate(e);
14533
+ }
14534
+ }, this),
14535
+ dblclick: $.proxy(function (e) {
14536
+ if (!N2Classes.WindowManager.get().isPreventDblClick) {
14537
+ e.stopPropagation();
14538
+ $('[data-tab="item"]').trigger('click');
14539
+ this.item.itemEditor.focusFirst('dblclick');
14540
+ }
14541
+ }, this)
14542
+ });
14543
+ };
14544
+
14545
+ Layer.prototype.getContent = function () {
14546
+
14547
+ var $content = this.layer,
14548
+ selector = $content.data('animatableselector');
14549
+ if (selector) {
14550
+ $content = $content.find(selector);
14551
  }
14552
+ return $content;
 
 
 
 
 
14553
  };
14554
 
14555
+ Layer.prototype._createLayer = function () {
14556
+ return $('<div class="n2-ss-layer"></div>')
14557
+ .attr('data-sstype', this.type);
14558
+ };
14559
+
14560
+ Layer.prototype.createRow = function () {
14561
+ var status = $('<div class="n2-ss-layer-status"></div>'),
14562
+ remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this)),
14563
+ duplicate = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Duplicate layer') + '"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on('click', $.proxy(function () {
14564
+ this.duplicate(true, false)
14565
+ }, this));
14566
+
14567
+ $('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(status).on('click', $.proxy(function (e) {
14568
+ e.preventDefault();
14569
+ if (this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN) {
14570
+ this.setStatusNormal();
14571
+ } else {
14572
+ this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN);
14573
  }
14574
+ }, this));
14575
+
14576
+
14577
+ this._createLayerListRow([
14578
+ $('<div class="n2-actions-left"></div>').append(status),
14579
+ $('<div class="n2-actions"></div>').append(duplicate).append(remove)
14580
+ ])
14581
+ .addClass('n2-ss-layer-layer-row');
14582
  };
14583
 
14584
+ /**
14585
+ *
14586
+ * @param e if provided, the layerWindow will show
14587
+ * @param context
14588
+ * @param preventExitFromSelection
14589
+ */
14590
+ Layer.prototype.activate = function (e, context, preventExitFromSelection) {
14591
+
14592
+ N2Classes.PluginActivatable.prototype.activate.call(this, e, context, preventExitFromSelection);
14593
+
14594
+ if (this.item) {
14595
+ this.item.activate(null, context);
14596
+ } else {
14597
+ console.error('The layer do not have item on it!');
14598
  }
14599
  };
14600
 
14601
+ Layer.prototype.getHTML = function (base64) {
14602
+
14603
+ var $node = N2Classes.ComponentAbstract.prototype.getHTML.call(this, base64);
14604
+
14605
+ var $item = this.item.getHTML(base64);
14606
+ $node.attr('style', $node.attr('style') + this.getStyleText())
14607
+ .append($item);
14608
+
14609
+ return $node;
 
 
 
14610
  };
14611
 
14612
+ Layer.prototype.getData = function (params) {
14613
+ var data = N2Classes.ComponentAbstract.prototype.getData.call(this, params);
14614
+
14615
+ if (params.itemsIncluded) {
14616
+ data.item = this.item.getData();
14617
+ }
14618
+ return data;
14619
  };
14620
 
14621
+ Layer.prototype.getStyleText = function () {
14622
+ var style = '';
14623
+ var crop = this.property.crop;
14624
+ if (crop == 'auto' || crop == 'mask') {
14625
+ crop = 'hidden';
14626
+ }
14627
 
14628
+ style += 'overflow:' + crop + ';';
14629
+ return style;
 
 
 
14630
  };
14631
 
14632
+ Layer.prototype.getContents = function () {
14633
+ return this.item.$item;
14634
  };
14635
 
14636
+ Layer.prototype.onSelfChange = function () {
14637
+ N2Classes.ComponentAbstract.prototype.onSelfChange.call(this);
14638
+
14639
+ this.item.setSelf(this.self.item);
14640
+ };
14641
+
14642
+ return Layer;
14643
  });
14644
+ N2D('LayerAdvancedProperty', function ($, undefined) {
14645
  "use strict";
14646
 
14647
  /**
14648
  * @memberOf N2Classes
14649
  *
14650
+ * @param basename
14651
+ * @param def
14652
+ * @param modesDef
14653
+ * @param obj
14654
+ * @param propName
14655
+ * @constructor
14656
+ */
14657
+ function LayerAdvancedProperty(basename, def, modesDef, obj, propName) {
14658
+ this.basename = basename;
14659
+ this.def = def;
14660
+ this.modesDef = modesDef;
14661
+ this.obj = obj;
14662
+ this.propName = propName;
14663
+ }
14664
 
14665
+ LayerAdvancedProperty.prototype.getBaseName = function () {
14666
+ return this.basename;
14667
+ };
14668
 
14669
+ /**
14670
+ *
14671
+ * @returns {object}
14672
+ */
14673
+ LayerAdvancedProperty.prototype.getNames = function () {
14674
+ var a = {};
14675
+ a[this.basename] = this.def;
14676
+ for (var k in this.modesDef) {
14677
+ a[this.basename + k] = this.modesDef[k];
14678
+ }
14679
+ return a;
14680
+ };
14681
 
14682
+ LayerAdvancedProperty.prototype.getCurrentMode = function () {
14683
+ return this.obj[this.propName];
14684
+ };
14685
+
14686
+ LayerAdvancedProperty.prototype.getName = function () {
14687
+ var currentMode = this.getCurrentMode();
14688
+ if (currentMode !== '') {
14689
+ return this.basename + currentMode;
14690
+ }
14691
+ return this.basename;
14692
+ };
14693
+
14694
+ LayerAdvancedProperty.prototype.getDefault = function () {
14695
+ var currentMode = this.getCurrentMode();
14696
+ if (currentMode !== '') {
14697
+ return this.modesDef[currentMode];
14698
+ }
14699
+ return this.def;
14700
+ };
14701
+
14702
+ LayerAdvancedProperty.prototype.resetMode = function (name) {
14703
+ if (this.propName == name) {
14704
+ var currentMode = this.getCurrentMode();
14705
+ if (currentMode !== '') {
14706
+ var oldValue = this.obj.property[this.basename + currentMode];
14707
+ this.obj.property[this.basename + currentMode] = this.modesDef[currentMode];
14708
+ this.obj.syncAdvancedField(this.basename);
14709
+
14710
+ this.obj.render(this.basename + currentMode, oldValue, 'manager');
 
 
 
 
 
 
 
14711
  }
14712
+ }
14713
+ };
14714
+
14715
+ return LayerAdvancedProperty;
14716
+ });
14717
+ N2D('MainContainer', ['LayerContainer'], function ($, undefined) {
14718
+ "use strict";
14719
+
14720
+ /**
14721
+ * @memberOf N2Classes
14722
+ *
14723
+ * @param {N2Classes.FragmentEditor} fragmentEditor
14724
+ * @constructor
14725
+ */
14726
+ function MainContainer(fragmentEditor) {
14727
+
14728
+ this.baseSize = 16;
14729
+
14730
+ this.activeLayer = null;
14731
 
14732
+ this.$ = fragmentEditor.$;
14733
+
14734
+ this.isActiveGroupBlurred = true;
14735
+
14736
+ this.isMainGroup = true;
14737
  this.fragmentEditor = fragmentEditor;
14738
+ this.layer = fragmentEditor.editor.getMainContainerElement();
14739
 
14740
+ this.layer.nUICanvas({
14741
+ mainContainer: this,
14742
+ tolerance: 5,
14743
+ smartguides: $.proxy(function (context) {
14744
+ context.$layer.triggerHandler('LayerParent');
14745
+ return this.fragmentEditor.getSnap();
14746
+ }, this),
14747
+ display: {
14748
+ hidden: true,
14749
+ show: $.proxy(function () {
14750
+ N2Classes.PositionDisplay.get().show('Canvas');
14751
+ }, this),
14752
+ update: $.proxy(function (e, position) {
14753
+ N2Classes.PositionDisplay.get().update(e, 'Canvas', 'L: ' + parseInt(position.left | 0) + 'px<br />T: ' + parseInt(position.top | 0) + 'px');
14754
 
14755
+ }, this),
14756
+ hide: $.proxy(function () {
14757
+ N2Classes.PositionDisplay.get().hide('Canvas');
14758
+ }, this)
14759
+ },
14760
+ start: $.proxy(function (e, ui) {
14761
+ this.fragmentEditor.canvasDragStart(e, ui);
14762
+ }, this),
14763
+ drag: $.proxy(function (e, ui) {
14764
+ this.fragmentEditor.canvasDragMove(e, ui);
 
 
 
 
 
14765
 
14766
+ if (ui.layer) ui.layer.placement.current.triggerLayerResized();
14767
+ }, this),
14768
+ stop: $.proxy(function (e, ui) {
14769
+ this.fragmentEditor.canvasDragStop(e, ui);
 
 
 
 
 
 
 
 
 
14770
 
14771
+ if (ui.layer) ui.layer.placement.current.triggerLayerResized();
14772
+ }, this)
14773
+ });
14774
+ this.canvasUIManager = this.layer.nUICanvas('instance');
 
 
14775
 
14776
+ this.layer.nUILayerList({
14777
+ mainContainer: this,
14778
+ $fixed: $('#n2-ss-layers'),
14779
+ $scrolled: $('#n2-ss-layer-list')
14780
+ });
14781
+ this.layerListUIManager = this.layer.nUILayerList('instance');
 
 
 
 
 
 
 
 
 
 
 
14782
 
14783
+ this.layer.parent().prepend('<div class="n2-ss-slide-border n2-ss-slide-border-left" /><div class="n2-ss-slide-border n2-ss-slide-border-top" /><div class="n2-ss-slide-border n2-ss-slide-border-right" /><div class="n2-ss-slide-border n2-ss-slide-border-bottom" />');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14784
 
14785
+ this.container = new N2Classes.LayerContainer(this, $('#n2-ss-layer-list').find('ul'), 'absolute', '> .n2-ss-layer, > .n2-ss-layer-group', ['content', 'row', 'layer', 'group']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14786
 
14787
+ this.layerRow = this.container.$ul;
 
14788
 
14789
+ this.$.on('layerCreated', $.proxy(function () {
14790
+ this.refreshHasLayers();
14791
+ }, this));
14792
+ }
14793
 
14794
+ MainContainer.prototype.lateInit = function () {
 
14795
 
14796
+ this.container.startWithExistingNodes(true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14797
 
14798
+ this.layer.parent().on('click', $.proxy(function () {
14799
+ if (this.fragmentEditor.shouldPreventActivationBubble) {
14800
+ this.blurActiveGroup();
14801
+ } else {
14802
+ this.unBlurActiveGroup();
14803
  }
14804
+ this.fragmentEditor.allowActivation();
14805
+ }, this));
14806
+ };
14807
 
14808
+ MainContainer.prototype.onResize = function (ratios) {
14809
+ var sortedLayerList = this.getEverySortedLayers();
14810
 
14811
+ for (var i = 0; i < sortedLayerList.length; i++) {
14812
+ sortedLayerList[i].placement.doLinearResize(ratios);
14813
+ }
14814
  };
14815
 
14816
+ MainContainer.prototype.getEverySortedLayers = function () {
14817
+ var list = this.container.getChildLayersRecursive(false),
14818
+ children = {};
14819
+ for (var i = list.length - 1; i >= 0; i--) {
14820
+ if (typeof list[i].property.parentid !== 'undefined' && list[i].property.parentid) {
14821
+ if (typeof children[list[i].property.parentid] == 'undefined') {
14822
+ children[list[i].property.parentid] = [];
14823
+ }
14824
+ children[list[i].property.parentid].push(list[i]);
14825
+ list.splice(i, 1);
14826
+ }
14827
+ }
14828
+ for (var i = 0; i < list.length; i++) {
14829
+ if (typeof list[i].property.id !== 'undefined' && list[i].property.id && typeof children[list[i].property.id] !== 'undefined') {
14830
+ children[list[i].property.id].unshift(0);
14831
+ children[list[i].property.id].unshift(i + 1);
14832
+ list.splice.apply(list, children[list[i].property.id]);
14833
+ delete children[list[i].property.id];
14834
+ }
14835
  }
14836
+ return list;
14837
+ };
14838
 
14839
+ MainContainer.prototype.deleteLayers = function () {
14840
+ var layers = this.container.getSortedLayers();
14841
+ for (var i = 0; i < layers.length; i++) {
14842
+ layers[i].delete();
14843
+ }
14844
  };
14845
 
14846
+ MainContainer.prototype.blurActiveGroup = function () {
14847
+ this.isActiveGroupBlurred = true;
14848
+ };
14849
 
14850
+ MainContainer.prototype.unBlurActiveGroup = function () {
14851
+ this.isActiveGroupBlurred = false;
14852
+ };
14853
 
14854
+ MainContainer.prototype.getActiveGroup = function () {
14855
+ if (this.isActiveGroupBlurred) {
14856
+ var group = this,
14857
+ activeLayer = this.activeLayer;
14858
+ if (this.fragmentEditor.isGroup(activeLayer) || this.fragmentEditor.isCol(activeLayer) || this.fragmentEditor.isContent(activeLayer)) {
14859
+ group = activeLayer;
14860
+ } else if (this.fragmentEditor.isRow(activeLayer)) {
14861
+ group = activeLayer.container.getSortedLayers()[0];
14862
+ } else if (activeLayer) {
14863
+ group = activeLayer.group;
14864
+ }
14865
+ switch (this.fragmentEditor.currentEditorMode) {
14866
+ case 'content':
14867
+ if (group == this) {
14868
+ group = this.fragmentEditor.mainContent;
14869
+ }
14870
+ break;
14871
+ case 'canvas':
14872
+ if (group == this.fragmentEditor.mainContent) {
14873
+ group = this;
14874
+ }
14875
+ break;
14876
  }
14877
 
14878
+ return group;
14879
+ }
14880
+ switch (this.fragmentEditor.currentEditorMode) {
14881
+ case 'content':
14882
+ return this.fragmentEditor.mainContent;
14883
+ }
14884
+ return this;
14885
+ };
14886
 
14887
+ MainContainer.prototype.getSelectedLayer = function () {
14888
+ if (this.activeLayer == null) {
14889
+ return false;
14890
  }
14891
+ return this.activeLayer;
14892
  };
14893
 
14894
+ MainContainer.prototype.getLayerData = function (requestedLayers) {
14895
+ if (requestedLayers === undefined) {
14896
+ return [];
14897
+ }
14898
+ var layersData = [],
14899
+ layers = [];
14900
+
14901
+ for (var i = 0; i < requestedLayers.length; i++) {
14902
+ requestedLayers[i].getDataWithChildren(layersData, layers);
14903
  }
14904
+ return layersData;
14905
  };
14906
 
14907
+ MainContainer.prototype.layerDeleted = function (layer) {
14908
+
14909
+ var i = this.fragmentEditor.selectedLayers.length;
14910
+ while (i--) {
14911
+ if (layer == this.fragmentEditor.selectedLayers[i]) {
14912
+ this.fragmentEditor.selectedLayers.splice(i, 1);
 
 
 
14913
  }
14914
  }
14915
+
14916
+ this._afterLayerDeletedDeBounced(layer);
14917
+
14918
+ this.refreshHasLayers();
14919
  };
14920
 
14921
+ MainContainer.prototype._afterLayerDeletedDeBounced = NextendDeBounce(function (layer) {
14922
+
14923
+ if (!this.activeLayer || this.activeLayer.isDeleted) {
14924
+ this.fragmentEditor.resetActiveLayer();
 
 
 
 
14925
  }
14926
+ }, 50);
14927
+
14928
+ MainContainer.prototype.refreshHasLayers = function () {
14929
+ $('body').toggleClass('n2-ss-has-layers', this.container.getLayerCount() > 0);
14930
+ nextend.triggerResize();
14931
  };
14932
 
14933
+ MainContainer.prototype.getName = function () {
14934
+ return 'Slide';
 
14935
  };
14936
 
14937
+ MainContainer.prototype.update = function () {
 
14938
 
14939
+ };
 
 
14940
 
14941
+ MainContainer.prototype.onChildCountChange = function () {
 
 
 
 
 
 
14942
 
14943
+ };
14944
 
14945
+ MainContainer.prototype.markEnter = function (e) {
 
 
 
 
 
14946
 
14947
+ };
14948
+
14949
+ MainContainer.prototype.markLeave = function (e) {
14950
+
14951
+ };
14952
+
14953
+ MainContainer.prototype.getSelf = function () {
14954
+ return this;
14955
+ };
14956
+
14957
+ /**
14958
+ *
14959
+ * @returns {N2Classes.FrontendLayerAnimationManager[]}
14960
+ */
14961
+ MainContainer.prototype.createLayerAnimations = function () {
14962
+
14963
+ var horizontalRatio = this.fragmentEditor.editor.getHorizontalRatio(),
14964
+ verticalRatio = this.fragmentEditor.editor.getVerticalRatio(),
14965
+ animations = [],
14966
+ children = this.container.getSortedLayers();
14967
+ for (var i = 0; i < children.length; i++) {
14968
+ animations.push.apply(animations, children[i].createLayerAnimations(horizontalRatio, verticalRatio));
14969
+ }
14970
+ return animations;
14971
+ };
14972
+
14973
+ MainContainer.prototype.getDroppables = function (exclude) {
14974
+ var editorMode = this.fragmentEditor.currentEditorMode,
14975
+ droppables = [],
14976
+ layers;
14977
+
14978
+ if (editorMode == 'canvas') {
14979
+ droppables.push(this.getDroppable());
14980
+ layers = this.container.getSortedLayers();
14981
+ var index = $.inArray(this.fragmentEditor.mainContent, layers);
14982
+ if (index > -1) {
14983
+ layers.splice(index, 1);
14984
+ }
14985
+ } else if (editorMode == 'content') {
14986
+ layers = [this.fragmentEditor.mainContent]
14987
+ }
14988
+
14989
+ for (var i = 0; i < layers.length; i++) {
14990
+ if (layers[i] == exclude) continue;
14991
+ var droppable = layers[i].getDroppable();
14992
+ if (typeof droppable == 'object') {
14993
+ droppables.push(droppable);
14994
+ }
14995
+ if (droppable != 'hidden' && layers[i].container) {
14996
+ droppables.push.apply(droppables, layers[i].container.getDroppables(exclude));
14997
+ }
14998
+ }
14999
 
15000
+ return droppables;
 
 
15001
  };
15002
 
15003
+ MainContainer.prototype.getLLDroppables = function (layer) {
15004
+ return this.container.getLLDroppables(layer);
15005
  };
15006
 
15007
+ MainContainer.prototype.getDroppable = function () {
15008
+ return {
15009
+ $container: this.layer,
15010
+ layer: this,
15011
+ placement: 'absolute'
15012
+ }
15013
+ };
15014
 
15015
+ MainContainer.prototype.getLLDroppable = function (layer) {
15016
+ switch (layer.type) {
15017
+ case 'layer':
15018
+ case 'row':
15019
+ case 'group':
15020
+ case 'content':
15021
+ return {
15022
+ $container: this.container.$ul,
15023
+ layer: this
15024
+ };
15025
+ break;
15026
+ }
15027
+ return false;
15028
+ };
15029
 
15030
+ MainContainer.prototype.replaceLayers = function (layersData) {
 
 
 
15031
 
15032
+ this._idTranslation = {};
15033
+ var layerNodes = this.dataToLayers($.extend(true, [], layersData).reverse()),
15034
+ layers = [];
15035
 
15036
+ this.deleteLayers();
 
 
 
 
 
15037
 
15038
+ this.fragmentEditor.mainContent.remove();
 
15039
 
15040
+
15041
+ for (var i = 0; i < layerNodes.length; i++) {
15042
+ layers.push(this.container.append(layerNodes[i]));
15043
  }
15044
 
15045
+ this.fragmentEditor.refreshMode();
15046
 
15047
+ this.container.layerContainerElement.n2imagesLoaded()
15048
+ .always($.proxy(this.fragmentEditor.refreshMode, this.fragmentEditor));
 
15049
 
15050
+ if (!this.getSelectedLayer()) {
15051
+ if (layers.length > 0) {
15052
+ layers[0].activate();
15053
+ }
15054
+ }
15055
 
15056
+ if (N2Classes.History.get().isEnabled()) {
15057
+ N2Classes.History.get().addSimple(this, this.historyDeleteAll, this.historyReplaceLayers, [layersData, layers, this.container.getAllLayers()]);
15058
+ }
 
 
 
 
15059
 
15060
+ return layers;
 
15061
  };
15062
 
15063
+ MainContainer.prototype.historyDeleteAll = function (layersData, historicalLayers) {
15064
+ for (var i = 0; i < historicalLayers.length; i++) {
15065
+ historicalLayers[i].getSelf().delete();
15066
+ }
15067
+
15068
+ this.fragmentEditor.mainContent.getSelf().remove();
15069
  };
15070
 
15071
+ MainContainer.prototype.historyReplaceLayers = function (layersData, historicalLayers, historicalAllLayers) {
15072
+ this.replaceLayers(layersData);
15073
 
15074
+ var layers = this.container.getAllLayers();
15075
+ for (var i = 0; i < historicalAllLayers.length; i++) {
15076
+ historicalAllLayers[i].setSelf(layers[i]);
15077
+ }
15078
  };
15079
 
15080
+ MainContainer.prototype.addLayers = function (layersData, group) {
 
 
15081
 
15082
+ this._idTranslation = {};
15083
+ var layerNodes = this.dataToLayers($.extend(true, [], layersData)),
15084
+ layers = [];
15085
+
15086
+ for (var i = 0; i < layerNodes.length; i++) {
15087
+ layers.push(group.container.append(layerNodes[i]));
 
 
 
 
 
 
 
 
15088
  }
15089
+
15090
+ this.fragmentEditor.refreshMode();
15091
+
15092
+ N2Classes.History.get().addSimple(this, this.historyDeleteLayers, this.historyAddLayers, [layersData, layers, group]);
15093
+
15094
+ return layers;
15095
  };
15096
 
15097
+ MainContainer.prototype.historyDeleteLayers = function (layersData, historicalLayers, historicalGroup) {
15098
+ for (var i = 0; i < historicalLayers.length; i++) {
15099
+ historicalLayers[i].getSelf().delete();
15100
+ }
15101
  };
15102
 
15103
+ MainContainer.prototype.historyAddLayers = function (layersData, historicalLayers, historicalGroup) {
15104
+ var layers = this.addLayers(layersData, historicalGroup.getSelf());
15105
+ for (var i = 0; i < historicalLayers.length; i++) {
15106
+ historicalLayers[i].setSelf(layers[i]);
15107
  }
15108
  };
15109
 
15110
+ MainContainer.prototype.dataToLayers = function (layers, $targetGroupContent) {
15111
+ var nodes = [];
15112
+ for (var i = 0; i < layers.length; i++) {
15113
+ switch (layers[i].type) {
15114
+ case 'group':
15115
+ console.error('Group data to layer not implemented!');
15116
+ //new N2Classes.Group(this, this.mainContainer, false, layers[i].data, layers[i]);
15117
+ break;
15118
+ case 'row':
15119
+ nodes.push(this.buildRowNode(layers[i], $targetGroupContent));
15120
+ break;
15121
+ case 'col':
15122
+ nodes.push(this.buildColNode(layers[i], $targetGroupContent));
15123
+ break;
15124
+ case 'content':
15125
+ nodes.push(this.buildContentNode(layers[i], $targetGroupContent));
15126
+ break;
15127
+ case 'layer':
15128
+ default:
15129
+ nodes.push(this.buildLayerNode(layers[i], $targetGroupContent));
15130
+ break;
15131
+ }
15132
+ }
15133
 
15134
+ return nodes;
15135
+ };
15136
 
15137
+ MainContainer.prototype._buildNodePrepareID = function ($layer, layerData) {
15138
+ if (layerData.id) {
15139
+ var id = $.fn.uid();
15140
 
15141
+ var deferred = false;
15142
+ if (typeof this._idTranslation[layerData.id] == 'object') {
15143
+ deferred = this._idTranslation[layerData.id];
15144
+ }
15145
 
15146
+ this._idTranslation[layerData.id] = id;
15147
+ layerData.id = id;
15148
+ $layer.attr('id', id);
15149
 
15150
+ if (deferred) {
15151
+ deferred.resolve(layerData.id, id);
15152
+ }
15153
+ }
15154
+ if (layerData.parentid) {
15155
+ switch (typeof this._idTranslation[layerData.parentid]) {
15156
+ case 'string':
15157
+ layerData.parentid = this._idTranslation[layerData.parentid];
15158
+ break;
15159
+ case 'undefined':
15160
+ this._idTranslation[layerData.parentid] = $.Deferred();
15161
+ case 'object':
15162
+ this._idTranslation[layerData.parentid].done($.proxy(function ($_layer, originalID, newID) {
15163
+ $_layer.data('parentid', newID);
15164
+ }, this, $layer));
15165
+ break;
15166
+ default:
15167
+ layerData.parentid = '';
15168
+ }
15169
+ }
15170
+ };
15171
 
 
15172
 
15173
+ MainContainer.prototype.buildContentNode = function (layerData, $targetGroupContent) {
15174
 
15175
+ var $layer = $("<div class='n2-ss-layer' data-sstype='content'/>"),
15176
+ $content = $("<div class='n2-ss-section-main-content n2-ss-layer-content' />").appendTo($layer);
15177
+ for (var k in layerData) {
15178
+ $layer.data(k, layerData[k]);
15179
+ }
15180
 
15181
+ if ($targetGroupContent !== undefined) {
15182
+ $layer.appendTo($targetGroupContent);
 
15183
  }
15184
+
15185
+ this.dataToLayers(layerData.layers, $content);
15186
+
15187
+ return $layer;
15188
  };
15189
 
15190
+ MainContainer.prototype.buildRowNode = function (layerData, $targetGroupContent) {
15191
+
15192
+ var $layer = $("<div class='n2-ss-layer' data-sstype='row'/>"),
15193
+ $content = $("<div class='n2-ss-layer-row' />").appendTo($layer);
15194
+
15195
+ this._buildNodePrepareID($layer, layerData);
15196
+ for (var k in layerData) {
15197
+ $layer.data(k, layerData[k]);
15198
  }
 
 
15199
 
15200
+ if ($targetGroupContent !== undefined) {
15201
+ $layer.appendTo($targetGroupContent);
 
 
 
15202
  }
15203
+
15204
+ this.dataToLayers(layerData.cols, $content);
15205
+
15206
+ return $layer;
15207
  };
15208
 
15209
+ MainContainer.prototype.buildColNode = function (layerData, $targetGroupContent) {
 
 
 
15210
 
15211
+ var $layer = $("<div class='n2-ss-layer' data-sstype='col'/>"),
15212
+ $content = $("<div class='n2-ss-layer-col n2-ss-layer-content' />").appendTo($layer);
15213
+ for (var k in layerData) {
15214
+ $layer.data(k, layerData[k]);
15215
+ }
 
 
 
 
15216
 
15217
+ if ($targetGroupContent !== undefined) {
15218
+ $layer.appendTo($targetGroupContent);
15219
+ }
15220
 
15221
+ this.dataToLayers(layerData.layers, $content);
 
 
 
 
 
 
 
15222
 
15223
+ return $layer;
 
15224
  };
15225
 
15226
+ MainContainer.prototype.buildLayerNode = function (layerData, $targetGroupContent) {
 
 
15227
 
15228
+ var $layer = $("<div class='n2-ss-layer' data-sstype='layer'></div>")
15229
+ .attr('style', layerData.style);
15230
 
15231
+ var storedIndex = 1;
15232
+ if (layerData.zIndex) {
15233
+ storedIndex = layerData.zIndex;
15234
  }
 
 
15235
 
15236
+ this._buildNodePrepareID($layer, layerData);
15237
 
15238
+ if (layerData.items !== undefined) {
15239
+ layerData.item = layerData.items[0];
15240
+ delete layerData.items;
15241
  }
15242
+
15243
+ $('<div class="n2-ss-item n2-ss-item-' + layerData.item.type + '"></div>')
15244
+ .data('item', layerData.item.type)
15245
+ .data('itemvalues', layerData.item.values)
15246
+ .appendTo($layer);
15247
+
15248
+ delete layerData.style;
15249
+ delete layerData.item;
15250
+ for (var k in layerData) {
15251
+ $layer.data(k, layerData[k]);
15252
+ }
15253
+
15254
+ if ($targetGroupContent !== undefined) {
15255
+ $layer.appendTo($targetGroupContent);
15256
+ }
15257
+
15258
+ return $layer;
15259
  };
15260
 
15261
+ return MainContainer;
15262
+ });
15263
+ N2D('Row', ['LayerContainer', 'ComponentAbstract'], function ($, undefined) {
 
15264
  "use strict";
15265
 
15266
  /**
15267
  * @memberOf N2Classes
15268
  *
15269
+ * @param fragmentEditor
15270
+ * @param group
15271
+ * @param properties
15272
  * @constructor
15273
+ * @augments ComponentAbstract
 
 
15274
  */
15275
+ function Row(fragmentEditor, group, properties) {
15276
+ this.label = n2_('Row');
15277
+ this.type = 'row';
 
 
15278
 
15279
+ this._syncbgThrottled = NextendThrottle(this._syncbgThrottled, 50);
 
 
 
 
 
15280
 
15281
+ this.innerContainer = '> .n2-ss-layer-row > .n2-ss-layer-row-inner';
 
15282
 
15283
+ this.localStyle = [
15284
+ {
15285
+ group: 'normal', selector: '-inner', css: {
15286
+ transition: 'transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;'
15287
+ }
15288
+ },
15289
+ {group: 'hover', selector: '-inner:HOVER', css: {}}
15290
+ ];
15291
 
15292
+ this.columnsField = $('#layerrow-columns').data('field');
 
15293
 
15294
+ this.refreshUI = NextendDeBounce(this.refreshUI, 100);
 
15295
 
15296
+ this.stylemode = '';
15297
 
15298
+ N2Classes.ComponentAbstract.prototype.constructor.call(this, fragmentEditor, group, properties);
 
 
15299
 
15300
+ this.placement.allow('absolute');
15301
+ this.placement.allow('normal');
15302
+ }
 
 
15303
 
15304
+ Row.prototype = Object.create(N2Classes.ComponentAbstract.prototype);
15305
+ Row.prototype.constructor = Row;
 
 
15306
 
15307
+ Row.prototype.addProperties = function ($layer) {
 
 
15308
 
15309
+ this.createProperty('opened', 1, $layer, this);
 
15310
 
15311
+ N2Classes.ComponentAbstract.prototype.addProperties.call(this, $layer);
15312
 
 
 
15313
 
15314
+ this.createProperty('href', '', $layer);
15315
+ this.createProperty('href-target', '_self', $layer);
15316
 
15317
+ this.createProperty('bgimage', '', $layer);
15318
+ this.createProperty('bgimagex', 50, $layer);
15319
+ this.createProperty('bgimagey', 50, $layer);
15320
+ this.createProperty('bgimageparallax', 0, $layer);
15321
 
15322
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolor', '00000000', {
15323
+ "-hover": undefined
15324
+ }, this, "stylemode"), $layer);
 
15325
 
15326
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradient', 'off', {
15327
+ "-hover": undefined
15328
+ }, this, "stylemode"), $layer);
 
 
 
15329
 
15330
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('bgcolorgradientend', '00000000', {
15331
+ "-hover": undefined
15332
+ }, this, "stylemode"), $layer);
 
15333
 
15334
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('borderradius', 0, {
15335
+ "-hover": undefined
15336
+ }, this, "stylemode"), $layer);
15337
 
15338
+ this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty('boxshadow', '0|*|0|*|0|*|0|*|00000080', {
15339
+ "-hover": undefined
15340
+ }, this, "stylemode"), $layer);
 
15341
 
15342
+ this.createProperty('fullwidth', 1, $layer);
15343
+ this.createProperty('stretch', 0, $layer);
15344
 
 
 
15345
 
15346
+ this.createDeviceProperty('inneralign', {desktopPortrait: 'inherit'}, $layer);
15347
+ this.createDeviceProperty('padding', {desktopPortrait: '10|*|10|*|10|*|10|*|px+'}, $layer);
15348
+ this.createDeviceProperty('gutter', {desktopPortrait: 20}, $layer);
15349
+ this.createDeviceProperty('wrapafter', {desktopPortrait: 0, mobilePortrait: 1, mobileLandscape: 1}, $layer);
15350
 
15351
+ this.$.on('baseSizeUpdated.row', $.proxy(this._syncpadding, this));
 
15352
  };
15353
 
15354
+ Row.prototype.historyDeleteSelf = function () {
15355
+ this.delete();
15356
+ };
15357
 
15358
+ Row.prototype.historyCreateSelf = function (historyGroup, preset, historyCols) {
15359
+ var newLayer = new N2Classes.Row(this.fragmentEditor, historyGroup.getSelf(), {});
15360
+ newLayer.create(preset);
15361
 
15362
+ this.setSelf(newLayer);
 
15363
 
15364
+ var newCols = newLayer.container.getSortedLayers();
15365
+ for (var i = 0; i < newCols.length; i++) {
15366
+ historyCols[i].setSelf(newCols[i]);
15367
+ }
15368
+ };
15369
+
15370
+ Row.prototype.create = function (preset) {
15371
+ var cb,
15372
+ _createRawRow = function (cols) {
15373
+ return $("<div class='n2-ss-layer' />")
15374
+ .append($("<div class='n2-ss-layer-row' />")
15375
+ .append($("<div class='n2-ss-layer-row-inner' />")
15376
+ .append(cols)))
15377
+ .attr('data-sstype', 'row');
15378
  },
15379
+ _createRawCol = function (inner) {
15380
+ return $("<div class='n2-ss-layer' data-sstype='col'/>").append($("<div class='n2-ss-layer-col n2-ss-layer-content' />").append(inner));
15381
+ };
15382
+ switch (preset) {
15383
+ case '2col':
15384
+ cb = function (layer) {
15385
+ return _createRawRow([_createRawCol(), _createRawCol()]);
15386
+ };
15387
+ break;
15388
+ case '2col-60-40':
15389
+ cb = function (layer) {
15390
+ return _createRawRow([_createRawCol().data('colwidth', '6/10'), _createRawCol().data('colwidth', '4/10')]);
15391
+ };
15392
+ break;
15393
+ case '2col-40-60':
15394
+ cb = function (layer) {
15395
+ return _createRawRow([_createRawCol().data('colwidth', '4/10'), _createRawCol().data('colwidth', '6/10')]);
15396
+ };
15397
+ break;
15398
+ case '2col-80-20':
15399
+ cb = function (layer) {
15400
+ return _createRawRow([_createRawCol().data('colwidth', '8/10'), _createRawCol().data('colwidth', '2/10')]);
15401
+ };
15402
+ break;
15403
+ case '2col-20-80':
15404
+ cb = function (layer) {
15405
+ return _createRawRow([_createRawCol().data('colwidth', '2/10'), _createRawCol().data('colwidth', '8/10')]);
15406
+ };
15407
+ break;
15408
+ case '3col':
15409
+ cb = function (layer) {
15410
+ return _createRawRow([_createRawCol(), _createRawCol(), _createRawCol()]);
15411
+ };
15412
+ break;
15413
+ case '3col-20-60-20':
15414
+ cb = function (layer) {
15415
+ return _createRawRow([_createRawCol().data('colwidth', '2/10'), _createRawCol().data('colwidth', '6/10'), _createRawCol().data('colwidth', '2/10')]);
15416
+ };
15417
+ break;
15418
+ case '4col':
15419
+ cb = function (layer) {
15420
+ return _createRawRow([_createRawCol(), _createRawCol(), _createRawCol(), _createRawCol()]);
15421
+ };
15422
+ break;
15423
 
15424
+ case "special":
15425
+ cb = function (layer) {
15426
+ var $innerRow = _createRawRow([_createRawCol(), _createRawCol()]);
15427
+ return _createRawRow([_createRawCol().data('colwidth', '1/5'), _createRawCol($innerRow).data('colwidth', '4/5')]);
15428
+ };
15429
+ break;
15430
+ default:
15431
+ cb = function (layer) {
15432
+ return _createRawRow([_createRawCol()]);
15433
+ };
15434
+ }
15435
 
15436
+ if (this.group.container.allowedPlacementMode === 'absolute') {
15437
+ this.originalProperties = $.extend({
15438
+ width: '100%',
15439
+ align: 'center',
15440
+ valign: 'top',
15441
+ top: 20
15442
+ }, this.originalProperties);
15443
+ }
15444
 
15445
+ N2Classes.ComponentAbstract.prototype.create.call(this, cb, true);
 
 
 
 
 
15446
 
15447
+ this.initUI();
 
 
15448
 
15449
+ this.container.startWithExistingNodes(false);
 
 
15450
 
15451
+ this._syncpadding();
15452
+ this._syncinneralign();
15453
+ this._syncfullwidth();
15454
+ this._syncstretch();
15455
+ this._syncbgThrottled();
15456
+ this._syncborderradius();
15457
+ this._syncboxshadow();
15458
 
 
15459
 
15460
+ this.renderModeProperties();
15461
+ this.container.renderModeProperties();
15462
 
 
 
 
15463
 
15464
+ N2Classes.History.get().addSimple(this, this.historyDeleteSelf, this.historyCreateSelf, [this.group, preset, this.container.getSortedLayers()]);
 
 
15465
 
15466
+ this._onReady();
15467
+ };
15468
 
15469
+ Row.prototype.load = function ($layer, isEditorStart) {
 
 
 
15470
 
15471
+ N2Classes.ComponentAbstract.prototype.load.call(this, $layer, isEditorStart);
15472
 
15473
+ this.initUI();
15474
 
15475
+ this.container.startWithExistingNodes(isEditorStart);
15476
 
15477
+ this._syncpadding();
15478
+ this._syncinneralign();
15479
+ this._syncfullwidth();
15480
+ this._syncstretch();
15481
+ this._syncbgThrottled();
15482
+ this._syncborderradius();
15483
+ this._syncboxshadow();
15484
 
15485
+ this._onReady();
15486
  };
15487
 
15488
+ Row.prototype.initUI = function () {
 
 
 
 
 
 
 
 
 
 
 
 
15489
 
15490
+ this.layer.nUICanvasItem({
15491
+ canvasUIManager: this.fragmentEditor.mainContainer.canvasUIManager,
15492
+ layer: this,
15493
+ $layer: this.layer
15494
+ });
 
15495
 
15496
+ this.layer.on({
15497
+ mousedown: $.proxy(N2Classes.WindowManager.setMouseDownArea, null, 'layerClicked'),
15498
+ click: $.proxy(function (e) {
15499
+ if (!nextend.shouldPreventMouseUp && this.fragmentEditor.preventActivationBubbling()) {
15500
+ this.activate(e);
15501
  }
15502
+ }, this),
15503
+ dblclick: $.proxy(function (e) {
15504
+ e.stopPropagation();
15505
+ $('[data-tab="row"]').trigger('click');
15506
+ }, this)
15507
+ });
15508
 
15509
+ this.$row.nUISpacing({
15510
+ handles: 'n, s, e, w',
15511
+ start: $.proxy(function (e, ui) {
15512
+ N2Classes.PositionDisplay.get().show('Spacing');
15513
+ }, this),
15514
+ spacing: $.proxy(function (e, ui) {
15515
+ var html = '';
15516
+ for (var k in ui.changed) {
15517
+ html += 'Padding ' + k + ': ' + ui.changed[k] + 'px<br>';
15518
  }
15519
+ N2Classes.PositionDisplay.get().update(e, 'Spacing', html);
15520
+ }, this),
15521
+ stop: $.proxy(this.____makeLayerResizeableStop, this),
15522
+ });
15523
 
15524
+ this.$row.nUIColumns({
15525
+ columns: '1',
15526
+ gutter: this.getGutter(),
15527
+ start: $.proxy(function (e, ui) {
15528
+ N2Classes.PositionDisplay.get().show('Columns');
15529
+ }, this),
15530
+ colwidth: $.proxy(function (e, ui) {
15531
+ this.updateColumnWidth(ui.currentPercent);
 
 
15532
 
15533
+ N2Classes.PositionDisplay.get().update(e, 'Columns', Math.round(ui.currentPercent[ui.index] * 100) + '% &mdash; ' + Math.round(ui.currentPercent[ui.index + 1] * 100) + '%');
 
 
 
 
 
 
 
 
 
15534
 
 
 
 
 
15535
 
15536
+ }, this),
15537
+ stop: $.proxy(function (e, ui) {
15538
+ N2Classes.PositionDisplay.get().hide('Columns');
15539
 
15540
+ this.setRealColsWidth(ui.currentFractions);
15541
+ }, this)
15542
+ });
15543
 
15544
+ var context = {};
 
15545
 
15546
+ this.$rowInner.nUISortableRow({
15547
+ distance: 10,
15548
+ helper: 'clone_hide',
15549
+ forceHelperSize: true,
15550
+ forcePlaceholderSize: true,
15551
+ items: '> .n2-ss-layer',
15552
+ handle: " > .n2-ss-layer-ui-label-container > .n2-ss-layer-ui-label-self",
15553
+ start: $.proxy(function (e, ui) {
15554
+ context.originalPrevLayer = ui.item.prevAll('.n2-ss-layer').not(ui.placeholder).first()
15555
+ .data('layerObject');
15556
 
15557
+ var parts = this.getColumns().split('+');
 
15558
 
15559
+ ui.placeholder.css({
15560
+ width: ((new Fraction(parts[ui.item.data('layerObject').getIndex()])).valueOf() * 100) + '%',
15561
+ visibility: 'visible',
15562
+ margin: this.getGutter() + 'px'
15563
+ });
15564
+ if (ui.helper.hasClass('n2-ss-last-in-row')) {
15565
+ ui.placeholder.addClass('n2-ss-last-in-row');
15566
+ }
15567
 
15568
+ ui.placeholder.css('order', ui.helper.css('order'));
 
 
 
15569
 
15570
+ ui.placeholder.attr('data-r', ui.helper.attr('data-r'));
15571
 
15572
+ }, this),
15573
+ beforestop: $.proxy(function (e, ui) {
15574
+ ui.placeholder.detach();
15575
+ context.layer = ui.item.data('layerObject');
15576
+ context.oldIndex = context.layer.getOrderedIndex();
15577
+ }, this),
15578
+ stop: $.proxy(function (e, ui) {
15579
+ var layer = context.layer,
15580
+ oldIndex = context.oldIndex,
15581
+ newIndex = 0;
15582
 
15583
+ if (context.originalPrevLayer) {
15584
+ layer.layer.insertAfter(context.originalPrevLayer.layer);
15585
+ } else {
15586
+ layer.layer.prependTo(layer.group.container.layerContainerElement);
15587
+ }
15588
 
15589
+ switch (ui.lastPosition[1]) {
15590
+ case 'before':
15591
+ newIndex = ui.lastPosition[0].data('layerObject').getOrderedIndex();
15592
+ if (newIndex > oldIndex) {
15593
+ newIndex--;
15594
+ }
15595
+ break;
15596
+ case 'after':
15597
+ newIndex = ui.lastPosition[0].data('layerObject').getOrderedIndex();
15598
+ if (newIndex < oldIndex) {
15599
+ newIndex++;
15600
+ }
15601
+ break;
15602
+ }
15603
+ if (oldIndex !== newIndex) {
15604
+ this.moveCol(oldIndex, newIndex);
15605
+ }
15606
+ }, this)
15607
+ });
15608
+ };
15609
 
15610
+ Row.prototype.____makeLayerResizeableStop = function (event, ui) {
15611
+ N2Classes.PositionDisplay.get().hide('Spacing');
15612
+ var padding = this.getPadding().split('|*|'),
15613
+ ratioH = 1,
15614
+ ratioV = 1;
15615
 
15616
+ if (padding[padding.length - 1] == 'px+' && Math.abs(parseFloat(this.layer.css('fontSize')) - this.baseSize) > 1) {
15617
+ ratioH = this.fragmentEditor.getResponsiveRatioHorizontal();
15618
+ ratioV = this.fragmentEditor.getResponsiveRatioVertical();
15619
+ }
15620
 
15621
+ for (var k in ui.changed) {
15622
+ var value = ui.changed[k];
15623
+ switch (k) {
15624
+ case 'top':
15625
+ padding[0] = Math.round(value / ratioV);
15626
+ break;
15627
+ case 'right':
15628
+ padding[1] = Math.round(value / ratioH);
15629
+ break;
15630
+ case 'bottom':
15631
+ padding[2] = Math.round(value / ratioV);
15632
+ break;
15633
+ case 'left':
15634
+ padding[3] = Math.round(value / ratioH);
15635
+ break;
15636
+ }
15637
+ }
15638
+ this.setProperty('padding', padding.join('|*|'));
15639
+ $('#layerrow-padding').data('field').insideChange(padding.join('|*|'));
15640
+ };
15641
 
15642
+ Row.prototype._createLayer = function () {
15643
+ return $('<div class="n2-ss-layer"><div class="n2-ss-layer-row"><div class="n2-ss-layer-row-inner"></div></div></div>')
15644
+ .attr('data-sstype', this.type);
15645
+ };
 
15646
 
15647
+ Row.prototype.historyDeleteCol = function (historicalRow, historicalCol) {
15648
+ historicalCol.getSelf().delete();
15649
+ };
15650
 
15651
+ Row.prototype.historyCreateCol = function (historicalRow, historicalCol) {
15652
+ var newCol = historicalRow.getSelf().createCol();
15653
+ historicalCol.setSelf(newCol);
15654
+ };
15655
 
15656
+ Row.prototype.createCol = function () {
 
 
 
15657
 
15658
+ var col = new N2Classes.Col(this.fragmentEditor, this, {});
15659
+ N2Classes.History.get().addSimple(this, this.historyDeleteCol, this.historyCreateCol, [this, col]);
15660
+ col.create();
15661
+ if (this.isReady()) {
15662
+ this.placement.updatePosition();
15663
+ }
15664
 
15665
+ return col;
15666
+ };
 
 
 
 
15667
 
15668
+ Row.prototype.createRow = function () {
15669
+ this.$row = this.layer.find('.n2-ss-layer-row:first');
15670
+ this.$rowInner = this.$row.find('.n2-ss-layer-row-inner:first');
15671
 
15672
+ //Fix for Slide Library 3.2 --> 3.3 change
15673
+ if (this.$rowInner.length === 0) {
15674
+ this.$rowInner = $('<div class="n2-ss-layer-row-inner"></div>').append(this.$row.find('> *')).appendTo(this.$row);
15675
+ }
15676
 
15677
+ this.container = new N2Classes.LayerContainer(this, $('<ul class="n2-list n2-h4 n2-list-orderable" />'), 'default', ' > .n2-ss-layer', ['col']);
15678
+ this.container.setLayerContainerElement(this.$rowInner);
15679
 
15680
+ this.addClassElement(this.layer);
15681
+ this.addClassElement(this.$row, '-inner');
 
 
 
 
 
15682
 
15683
+ var status = $('<div class="n2-ss-layer-status"></div>'),
15684
+ remove = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Delete layer') + '"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on('click', $.proxy(this.delete, this)),
15685
+ duplicate = $('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="' + n2_('Duplicate layer') + '"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on('click', $.proxy(function () {
15686
+ this.duplicate(true, false)
15687
+ }, this));
15688
 
15689
+ $('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(status).on('click', $.proxy(function (e) {
15690
+ e.preventDefault();
15691
+ if (this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN) {
15692
+ this.setStatusNormal();
15693
+ } else {
15694
+ this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN);
15695
+ }
15696
+ }, this));
15697
 
15698
+ this._createLayerListRow([
15699
+ $('<div class="n2-actions-left"></div>').append(status),
15700
+ $('<div class="n2-actions"></div>').append(duplicate).append(remove)
15701
+ ]).addClass('n2-ss-layer-row-row');
15702
 
15703
+ this.openerElement = $('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-row"></i></a>').insertBefore(this.layerTitleSpan)
15704
+ .on('click', $.proxy(this.switchOpened, this));
 
15705
 
 
 
15706
 
15707
+ this.container.$ul.appendTo(this.layerRow);
 
15708
 
15709
+ this.readyDeferred.done($.proxy(this._syncopened, this));
15710
+ };
 
15711
 
15712
+ Row.prototype.activate = function () {
15713
+ N2Classes.PluginActivatable.prototype.activate.apply(this, arguments);
15714
 
15715
+ this.columnsField.setRow(this);
 
 
15716
 
15717
+ this.$row.nUIColumns('option', 'active', 1);
15718
+ };
 
15719
 
15720
+ Row.prototype.deActivate = function () {
15721
 
15722
+ this.$row.nUIColumns('option', 'active', 0);
15723
 
15724
+ N2Classes.PluginActivatable.prototype.deActivate.apply(this, arguments);
15725
  };
15726
 
15727
+ Row.prototype.switchOpened = function (e) {
15728
+ e.preventDefault();
15729
+ if (this.getProperty('opened')) {
15730
+ this.setProperty('opened', 0);
15731
+ } else {
15732
+ this.setProperty('opened', 1);
15733
+ }
15734
  };
15735
 
15736
+ Row.prototype._syncopened = function () {
15737
+ if (this.getProperty('opened')) {
15738
+ this.openerElement.removeClass('n2-closed');
15739
+ this.container.$ul.css('display', '');
15740
+
15741
+ this.layer.triggerHandler('opened');
15742
+ } else {
15743
+ this.openerElement.addClass('n2-closed');
15744
+ this.container.$ul.css('display', 'none');
15745
+
15746
+ this.layer.triggerHandler('closed');
15747
  }
15748
  };
15749
 
15750
+ Row.prototype.getColumns = function () {
15751
+ var layers = this.container.getSortedLayers(),
15752
+ columns = [];
15753
+ for (var i = 0; i < layers.length; i++) {
15754
+ columns.push(layers[i].getProperty('colwidth'));
 
15755
  }
15756
+ return columns.join('+');
15757
  };
15758
 
15759
+ Row.prototype.getColumnsOrdered = function () {
15760
+ var layers = this.getOrderedColumns(),
15761
+ columns = [];
15762
+ for (var i = 0; i < layers.length; i++) {
15763
+ columns.push(layers[i].getProperty('colwidth'));
15764
+ }
15765
+ return columns.join('+');
15766
+ };
15767
 
15768
+ Row.prototype._synccolumns = function () {
15769
+ var layers = this.container.getSortedLayers();
15770
  for (var i = 0; i < layers.length; i++) {
15771
+ layers[i]._synccolwidth();
 
 
 
 
 
 
 
 
 
 
15772
  }
15773
+ this.update();
15774
+ };
15775
 
15776
+ Row.prototype.getPadding = function () {
15777
+ return this.getProperty('padding');
15778
  };
15779
 
15780
+ Row.prototype._syncpadding = function () {
15781
+ var padding = this.getPadding().split('|*|'),
15782
+ unit = padding.pop(),
15783
+ baseSize = this.baseSize;
15784
 
15785
+ if (unit == 'px+' && baseSize > 0) {
15786
+ unit = 'em';
15787
+ for (var i = 0; i < padding.length; i++) {
15788
+ padding[i] = parseInt(padding[i]) / baseSize;
15789
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15790
  }
15791
 
15792
+ var css = padding.join(unit + ' ') + unit;
15793
+ this.$row.css('padding', css);
15794
+ this.$row.nUISpacing('option', 'current', css);
15795
 
15796
+ this.update();
15797
  };
15798
 
15799
+ Row.prototype.getGutter = function () {
15800
+ return this.getProperty('gutter');
15801
+ };
15802
 
15803
+ Row.prototype._syncgutter = function () {
15804
+ var gutterValue = this.getGutter(),
15805
+ sideGutterValue = gutterValue / 2,
15806
+ cols = this.container.getSortedLayers();
15807
+ if (cols.length > 0) {
15808
+ for (var i = cols.length - 1; i >= 0; i--) {
15809
+ cols[i].layer
15810
+ .css('margin', sideGutterValue + 'px');
 
 
 
 
 
 
15811
  }
15812
  }
 
15813
 
15814
+ this.$rowInner.css({
15815
+ width: 'calc(100% + ' + (gutterValue + 1) + 'px)',
15816
+ margin: -sideGutterValue + 'px'
15817
+ });
15818
 
15819
+ this.$row.nUIColumns('option', 'gutter', this.getGutter());
15820
 
15821
+ this._syncwrapafter();
 
15822
 
15823
+ this.update();
 
 
 
 
 
 
15824
  };
15825
 
15826
+ Row.prototype._syncwrapafter = function () {
15827
+ if (!this.isDeleted && !this.isDeleteStarted) {
15828
+ var wrapAfter = parseInt(this.getProperty('wrapafter')),
15829
+ columns = this.getOrderedColumns(),
15830
+ isWrapped = false,
15831
+ i;
 
 
15832
 
15833
+ for (i = columns.length - 1; i >= 0; i--) {
15834
+ if (!columns[i].showsOnCurrent) {
15835
+ columns.splice(i, 1);
 
 
 
 
 
 
 
 
 
 
 
 
 
15836
  }
 
 
 
 
 
 
15837
  }
 
15838
 
15839
+ // columnsLength can be 0 if all the columns hidden in the row
15840
+ var columnsLength = columns.length;
 
 
 
 
 
 
15841
 
15842
+ if (wrapAfter > 0 && wrapAfter < columnsLength) {
15843
+ isWrapped = true;
15844
+ }
 
 
 
 
15845
 
15846
+ this.$row.attr('row-wrapped', isWrapped ? 1 : 0);
15847
 
15848
+ if (isWrapped) {
15849
+ var flexLines = [];
15850
+ for (i = 0; i < columnsLength; i++) {
15851
+ var row = Math.floor(i / wrapAfter);
15852
+ if (typeof flexLines[row] === 'undefined') {
15853
+ flexLines[row] = [];
15854
+ }
15855
+ flexLines[row].push(columns[i]);
15856
+ columns[i].layer
15857
+ .attr('data-r', row)
15858
+ .toggleClass('n2-ss-last-in-row', (i + 1) % wrapAfter === 0 || i === columnsLength - 1);
15859
+ }
15860
 
15861
+ var gutterValue = this.getGutter();
15862
+ for (i = 0; i < flexLines.length; i++) {
15863
+ var flexLine = flexLines[i],
15864
+ sumWidth = 0,
15865
+ j;
15866
+ for (j = 0; j < flexLine.length; j++) {
15867
+ sumWidth += flexLine[j].getWidthPercentage();
15868
+ }
15869
+ for (j = 0; j < flexLine.length; j++) {
15870
+ flexLine[j].layer.css('width', 'calc(' + (flexLine[j].getWidthPercentage() / sumWidth * 100) + '% - ' + (n2const.isIE ? gutterValue + 1 : gutterValue) + 'px)');
15871
+ }
15872
+ }
15873
+ } else {
15874
+ var sumWidth = 0;
15875
+ for (i = 0; i < columnsLength; i++) {
15876
+ sumWidth += columns[i].getWidthPercentage();
15877
+ }
15878
+ for (i = 0; i < columnsLength; i++) {
15879
+ columns[i].layer
15880
+ .css('width', (columns[i].getWidthPercentage() / sumWidth * 100) + '%')
15881
+ .removeClass('n2-ss-last-in-row')
15882
+ .attr('data-r', 0);
15883
+ }
15884
+ if (columnsLength > 0) {
15885
+ columns[columnsLength - 1].layer.addClass('n2-ss-last-in-row');
15886
+ }
15887
+ }
15888
 
15889
+ this.update();
15890
+ }
15891
+ };
 
 
 
 
15892
 
15893
+ Row.prototype.getOrderedColumns = function () {
15894
+ return this.container.getSortedLayers().sort(function (a, b) {
15895
+ return a.getRealOrder() - b.getRealOrder();
15896
+ });
15897
+ };
 
 
 
 
 
 
 
 
15898
 
15899
+ Row.prototype.getInnerAlign = function () {
15900
+ return this.getProperty('inneralign');
15901
+ };
15902
 
15903
+ Row.prototype._syncinneralign = function () {
15904
+ this.layer.attr('data-csstextalign', this.getInnerAlign());
 
15905
 
15906
+ this.refreshTextAlign();
15907
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15908
 
15909
+ Row.prototype._syncfullwidth = function () {
15910
+ this.layer.attr('data-frontend-fullwidth', this.getProperty('fullwidth') == 0 ? '0' : '1')
15911
+ };
 
 
 
15912
 
15913
+ Row.prototype._syncstretch = function () {
15914
+ this.layer.toggleClass('n2-ss-stretch-layer', this.getProperty('stretch') == 1);
15915
+ };
15916
 
15917
+ Row.prototype._syncborderradius =
15918
+ Row.prototype['_syncborderradius-hover'] = function () {
15919
+ var borderRadius = this.getProperty('borderradius');
15920
+ if (borderRadius > 0) {
15921
+ this.addLocalStyle('normal', 'borderradius', 'border-radius:' + borderRadius + 'px;');
15922
+ }
15923
 
15924
+ var borderRadiusHover = this.getProperty('borderradius-hover');
15925
+ if (borderRadiusHover && borderRadiusHover != borderRadius) {
15926
+ this.addLocalStyle('hover', 'borderradius', 'border-radius:' + borderRadiusHover + 'px;');
15927
+ }
15928
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15929
 
15930
+ Row.prototype._syncboxshadow =
15931
+ Row.prototype['_syncboxshadow-hover'] = function () {
15932
+ var boxShadow = this.getProperty('boxshadow');
15933
+ this.addLocalStyle('normal', 'boxshadow', this.getBoxShadowCSS(boxShadow.split('|*|')));
 
 
15934
 
15935
+ var hoverStyle = '',
15936
+ boxShadowHover = this.getProperty('boxshadow-hover');
15937
+ if (boxShadowHover !== undefined && boxShadowHover != boxShadow) {
15938
+ hoverStyle = this.getBoxShadowCSS(boxShadowHover.split('|*|'));
 
 
15939
  }
15940
+ this.addLocalStyle('hover', 'boxshadow', hoverStyle);
15941
+ };
15942
+
15943
+ Row.prototype.getBoxShadowCSS = function (boxShadow) {
15944
+ if ((boxShadow[0] != 0 || boxShadow[1] != 0 || boxShadow[2] != 0 || boxShadow[3] != 0) && N2Color.hex2alpha(boxShadow[4]) != 0) {
15945
+ return 'box-shadow:' + boxShadow[0] + 'px ' + boxShadow[1] + 'px ' + boxShadow[2] + 'px ' + boxShadow[3] + 'px ' + N2Color.hex2rgbaCSS(boxShadow[4]) + ';';
15946
  }
15947
+ return '';
15948
+ };
15949
 
15950
+ Row.prototype._synchref =
15951
+ Row.prototype['_synchref-target'] = function () {
15952
+ };
 
15953
 
15954
+ Row.prototype._syncbgimage =
15955
+ Row.prototype._syncbgimagex =
15956
+ Row.prototype._syncbgimagey =
15957
+ Row.prototype._syncbgimageparallax =
15958
+ Row.prototype._syncbgcolor =
15959
+ Row.prototype._syncbgcolorgradient =
15960
+ Row.prototype._syncbgcolorgradientend =
15961
+ Row.prototype['_syncbgcolor-hover'] =
15962
+ Row.prototype['_syncbgcolorgradient-hover'] =
15963
+ Row.prototype['_syncbgcolorgradientend-hover'] = function () {
15964
+ this._syncbgThrottled();
15965
+ };
15966
 
 
 
 
 
 
 
15967
 
15968
+ Row.prototype._syncbgThrottled = function () {
15969
+ var background = '',
15970
+ image = this.fragmentEditor.editor.generator.fill(this.getProperty('bgimage')),
15971
+ gradientBackgroundProps = '';
15972
+ if (image != '') {
15973
+ var x = parseInt(this.getProperty('bgimagex'));
15974
+ if (!isFinite(x)) {
15975
+ x = 50;
15976
+ }
15977
+ var y = parseInt(this.getProperty('bgimagey'));
15978
+ if (!isFinite(y)) {
15979
+ y = 50;
15980
+ }
15981
+ background += 'URL("' + nextend.imageHelper.fixed(image) + '") ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '');
15982
+ gradientBackgroundProps = ' ' + x + '% ' + y + '% / cover no-repeat' + (this.getProperty('bgimageparallax') == 1 ? ' fixed' : '');
15983
+ }
15984
+ var color = this.getProperty('bgcolor'),
15985
+ gradient = this.getProperty('bgcolorgradient'),
15986
+ colorend = this.getProperty('bgcolorgradientend');
15987
 
15988
+ var normalStyle = this.getBackgroundCSS(color, gradient, colorend, background, gradientBackgroundProps);
 
15989
 
15990
+ this.addLocalStyle('normal', 'bgcolor', normalStyle);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15991
 
 
 
15992
 
15993
+ var hoverStyle = '',
15994
+ isHoverDifferent = false,
15995
+ colorHover = this.getProperty('bgcolor-hover'),
15996
+ gradientHover = this.getProperty('bgcolorgradient-hover'),
15997
+ colorendHover = this.getProperty('bgcolorgradientend-hover');
15998
 
15999
+ if (colorHover !== undefined && colorHover != color) {
16000
+ isHoverDifferent = true;
16001
+ }
16002
+ if (gradientHover !== undefined && gradientHover != gradient) {
16003
+ isHoverDifferent = true;
16004
+ }
16005
+ if (colorendHover !== undefined && colorendHover != colorend) {
16006
+ isHoverDifferent = true;
16007
+ }
16008
 
16009
+ if (isHoverDifferent) {
16010
+ if (colorHover === undefined) {
16011
+ colorHover = color;
16012
+ }
16013
+ if (gradientHover === undefined) {
16014
+ gradientHover = gradient;
16015
+ }
16016
+ if (colorendHover === undefined) {
16017
+ colorendHover = colorend;
16018
+ }
16019
+ hoverStyle = this.getBackgroundCSS(colorHover, gradientHover, colorendHover, background, gradientBackgroundProps);
16020
+ }
16021
+ this.addLocalStyle('hover', 'bgcolor', hoverStyle);
16022
+ };
16023
+
16024
+ Row.prototype.getBackgroundCSS = function (color, gradient, colorend, backgroundImage, gradientBackgroundProps) {
16025
+ if (N2Color.hex2alpha(color) != 0 || (gradient != 'off' && N2Color.hex2alpha(colorend) != 0)) {
16026
+ var after = '';
16027
+ if (backgroundImage != '') {
16028
+ after = gradientBackgroundProps + ',' + backgroundImage;
16029
+ }
16030
+ switch (gradient) {
16031
+ case 'horizontal':
16032
+ return 'background:linear-gradient(to right, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
16033
+ case 'vertical':
16034
+ return 'background:linear-gradient(to bottom, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
16035
+ case 'diagonal1':
16036
+ return 'background:linear-gradient(45deg, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
16037
+ case 'diagonal2':
16038
+ return 'background:linear-gradient(135deg, ' + N2Color.hex2rgbaCSS(color) + ' 0%,' + N2Color.hex2rgbaCSS(colorend) + ' 100%)' + after + ';';
16039
+ case 'off':
16040
+ default:
16041
+ if (backgroundImage != '') {
16042
+ return "background: linear-gradient(" + N2Color.hex2rgbaCSS(color) + ", " + N2Color.hex2rgbaCSS(color) + ")" + after + ';';
16043
+ }
16044
+ return 'background:' + N2Color.hex2rgbaCSS(color) + ';';
16045
+ }
16046
+ } else if (backgroundImage != '') {
16047
+ return 'background:' + backgroundImage + ';';
16048
+ }
16049
+ return '';
16050
+ };
16051
 
16052
+ Row.prototype.getData = function (params) {
16053
+ var data = N2Classes.ComponentAbstract.prototype.getData.call(this, params);
16054
 
16055
+ if (params.itemsIncluded) {
16056
+ data.cols = this.container.getData(params);
16057
  }
16058
+ return data;
16059
  };
16060
 
16061
+ /**
16062
+ * Example: Cols: 0 - 1 - 2
16063
+ * oldIndex: 0, newIndex: 2 => 1 - 2 - 0 Moves the col #0 to after the #2 col
16064
+ * @param oldIndex
16065
+ * @param newIndex
16066
+ */
16067
+ Row.prototype.moveCol = function (oldIndex, newIndex) {
16068
 
16069
+ if (this.getMode() == 'desktopPortrait') {
16070
+ this._moveCol(oldIndex, newIndex);
 
 
 
 
16071
 
16072
+ var task = N2Classes.History.get().addValue(this, this.historyMoveCol, []);
16073
+ if (task) {
16074
+ task.setValues({
16075
+ oldIndex: newIndex,
16076
+ newIndex: oldIndex
16077
+ }, {
16078
+ oldIndex: oldIndex,
16079
+ newIndex: newIndex
16080
+ });
16081
+ }
16082
+ } else {
16083
+ var orderedColumns = this.getOrderedColumns(),
16084
+ colToMove = orderedColumns[oldIndex];
16085
+ orderedColumns.splice(oldIndex, 1);
16086
+ orderedColumns.splice(newIndex, 0, colToMove);
16087
+ for (var i = 0; i < orderedColumns.length; i++) {
16088
+ orderedColumns[i].setProperty('order', i + 1);
16089
+ }
16090
+ this.refreshUI();
16091
+ }
16092
  };
16093
 
16094
+ Row.prototype._moveCol = function (oldIndex, newIndex) {
16095
+
16096
+ var layers = this.container.getSortedLayers();
16097
+ this.container.insertLayerAt(layers[oldIndex], newIndex);
16098
+
16099
+ this.refreshUI();
16100
  };
16101
 
16102
+ Row.prototype.historyMoveCol = function (data) {
 
16103
 
16104
+ this._moveCol(data.oldIndex, data.newIndex);
16105
+ };
16106
 
16107
+ Row.prototype.setColsWidth = function (fractions) {
16108
+ var cols = this.container.getSortedLayers();
16109
+ for (var i = 0; i < fractions.length; i++) {
16110
+ cols[i].setProperty('colwidth', fractions[i].toFraction());
16111
  }
 
16112
 
16113
+ this._syncwrapafter();
16114
+ this.update();
 
16115
 
16116
+ this.refreshUI();
16117
+ };
 
 
 
 
 
16118
 
16119
+ Row.prototype.setRealColsWidth = function (fractions) {
16120
+ var cols = this.getOrderedColumns();
16121
+ for (var i = 0; i < fractions.length; i++) {
16122
+ cols[i].setProperty('colwidth', fractions[i].toFraction());
16123
+ }
16124
 
16125
+ this._syncwrapafter();
16126
+ this.update();
16127
 
16128
+ this.refreshUI();
16129
  };
16130
 
16131
+ Row.prototype.updateColumnWidth = function (widths) {
16132
+ var wrapAfter = parseInt(this.getProperty('wrapafter')),
16133
+ columns = this.getOrderedColumns(),
16134
+ i;
16135
 
16136
+ for (i = columns.length - 1; i >= 0; i--) {
16137
+ if (!columns[i].showsOnCurrent) {
16138
+ columns.splice(i, 1);
16139
+ widths.splice(i, 1);
16140
+ }
16141
+ }
16142
 
16143
+ var columnsLength = columns.length;
 
16144
 
16145
+ if (wrapAfter > 0 && wrapAfter < columnsLength) {
16146
+ var flexLines = [];
16147
+ for (i = 0; i < columnsLength; i++) {
16148
+ var row = Math.floor(i / wrapAfter);
16149
+ if (typeof flexLines[row] === 'undefined') {
16150
+ flexLines[row] = [];
16151
+ }
16152
+ columns[i]._tempWidth = widths[i];
16153
+ flexLines[row].push(columns[i]);
16154
+ }
16155
+
16156
+ var gutterValue = this.getGutter();
16157
+ for (i = 0; i < flexLines.length; i++) {
16158
+ var flexLine = flexLines[i],
16159
+ sumWidth = 0,
16160
+ j;
16161
+ for (j = 0; j < flexLine.length; j++) {
16162
+ sumWidth += flexLine[j]._tempWidth;
16163
+ }
16164
+ for (j = 0; j < flexLine.length; j++) {
16165
+ flexLine[j].layer.css('width', 'calc(' + (flexLine[j]._tempWidth / sumWidth * 100) + '% - ' + (n2const.isIE ? gutterValue + 1 : gutterValue) + 'px)');
16166
+ }
16167
  }
16168
  } else {
16169
+ for (i = 0; i < columnsLength; i++) {
16170
+ columns[i].layer.css('width', (widths[i] * 100) + '%');
16171
+ }
16172
  }
 
16173
 
16174
+ this.update();
 
 
 
 
16175
  };
16176
 
16177
+ Row.prototype.activateColumn = function (index, e) {
16178
+ this.container.getSortedLayers()[index].activate(e);
16179
  };
16180
 
16181
+ Row.prototype.onChildCountChange = function () {
16182
+ if (!this.isDeleted && !this.isDeleteStarted) {
16183
+ var layers = this.container.getSortedLayers(),
16184
+ colLength = layers.length;
16185
+ if (colLength) {
16186
+ var currentColumns = this.getColumns().split('+'),
16187
+ add = 0;
16188
+ for (var i = 0; i < currentColumns.length; i++) {
16189
+ add = (new Fraction(currentColumns[i])).add(add);
16190
+ }
16191
+ if (add.valueOf() != 1) {
16192
+ for (var i = 0; i < colLength; i++) {
16193
+ layers[i].setProperty('colwidth', "1/" + colLength);
16194
+ }
16195
+ } else {
16196
 
16197
+ for (var i = 0; i < colLength; i++) {
16198
+ layers[i]._synccolwidth();
 
 
 
 
 
16199
  }
16200
  }
16201
+ this.refreshUI();
16202
+ }
16203
+ this._syncgutter();
16204
+ }
16205
+ };
16206
+
16207
+ Row.prototype.renderModeProperties = function (isReset) {
16208
+ N2Classes.ComponentAbstract.prototype.renderModeProperties.call(this, isReset);
16209
+
16210
+ this._syncpadding();
16211
+ this._syncinneralign();
16212
+ this._syncgutter();
16213
+
16214
+ if (this.isActive) {
16215
+ this.columnsField.setRow(this);
16216
+ }
16217
+ };
16218
+
16219
+ Row.prototype.hightlightStructure = function (hideInterval) {
16220
+
16221
+ hideInterval = hideInterval || 4000;
16222
+ if (this.isStructureHighlighted) {
16223
+ clearTimeout(this.isStructureHighlighted);
16224
+ this.isStructureHighlighted = false;
16225
+ }
16226
+ this.layer.addClass('n2-highlight-structure');
16227
+ this.isStructureHighlighted = setTimeout($.proxy(function () {
16228
+ if (!this.isDeleted) {
16229
+ this.layer.removeClass('n2-highlight-structure');
16230
+ }
16231
+ }, this), hideInterval);
16232
+ };
16233
+
16234
+ Row.prototype.refreshUI = function () {
16235
+ if (!this.isDeleteStarted) {
16236
+ if (this.isActive) {
16237
+ this.columnsField.setRow(this);
16238
+ }
16239
+ this._syncwrapafter();
16240
+ this.$row.nUIColumns('option', 'columns', this.getColumnsOrdered());
16241
+ }
16242
+ };
16243
+
16244
+ Row.prototype.getDroppable = function () {
16245
+ if (!this.layer.is(":visible") || this.status == N2Classes.ComponentAbstract.STATUS.HIDDEN || this.status == N2Classes.ComponentAbstract.STATUS.LOCKED) {
16246
+ return 'hidden';
16247
+ }
16248
+ return {
16249
+ $container: this.$row,
16250
+ layer: this,
16251
+ placement: 'normal',
16252
+ axis: 'x'
16253
+ }
16254
+ };
16255
+
16256
+ Row.prototype.getLLDroppable = function (layer) {
16257
+ switch (layer.type) {
16258
+ case 'col':
16259
+ if (layer.group == this) {
16260
+ return {
16261
+ $container: this.container.$ul,
16262
+ layer: this
16263
+ };
16264
+ }
16265
  break;
16266
  }
16267
+ return false;
16268
  };
16269
 
16270
+ Row.prototype.getContents = function () {
16271
+ return this.$row;
16272
+ };
16273
 
16274
+ Row.prototype.setPropertystylemode = function (name, value, from) {
16275
+ this.stylemode = value;
 
 
 
 
16276
 
16277
+ this.syncAdvancedField('bgcolor');
16278
+ this.syncAdvancedField('bgcolorgradient');
16279
+ this.syncAdvancedField('bgcolorgradientend');
16280
+ this.syncAdvancedField('borderradius');
16281
+ this.syncAdvancedField('boxshadow');
16282
  };
16283
 
16284
+ Row.prototype.onSyncFields = function () {
16285
+ this.fragmentEditor.layerOptions.updateField('stylemode', this.stylemode);
16286
+ };
 
16287
 
16288
+ return Row;
16289
+ });
16290
+ N2D('ComponentSettings', function ($, undefined) {
16291
+ "use strict";
 
 
16292
 
16293
+ /**
16294
+ * @memberOf N2Classes
16295
+ *
16296
+ * @param {N2Classes.FragmentEditor} fragmentEditor
16297
+ * @constructor
16298
+ */
16299
+ function ComponentSettings(fragmentEditor) {
16300
+ this.componentType = 'undefined';
16301
+ this.placementType = 'undefined';
16302
 
16303
+ $('html')
16304
+ .attr('data-component', '')
16305
+ .attr('data-placement', '');
16306
 
16307
+ this.currentForm = {};
16308
 
16309
+ this.forms = {
16310
+ 'undefined': null,
16311
+ placement: {
16312
+ absolute: {},
16313
+ normal: {},
16314
+ default: {}
16315
+ },
16316
+ component: {
16317
+ content: {},
16318
+ layer: {},
16319
+ row: {},
16320
+ col: {},
16321
+ group: {}
16322
+ },
16323
+ global: {
16324
+ id: $('#layerid'),
16325
+ uniqueclass: $('#layeruniqueclass'),
16326
+ desktopPortrait: $('#layershow-desktop-portrait'),
16327
+ desktopLandscape: $('#layershow-desktop-landscape'),
16328
+ tabletPortrait: $('#layershow-tablet-portrait'),
16329
+ tabletLandscape: $('#layershow-tablet-landscape'),
16330
+ mobilePortrait: $('#layershow-mobile-portrait'),
16331
+ mobileLandscape: $('#layershow-mobile-landscape'),
16332
+ class: $('#layerclass'),
16333
+ generatorvisible: $('#layergenerator-visible'),
16334
+ crop: $('#layercrop'),
16335
+ rotation: $('#layerrotation'),
16336
+ parallax: $('#layerparallax'),
16337
+ fontsize: $('#layerfont-size'),
16338
+ adaptivefont: $('#layeradaptive-font'),
16339
+ mouseenter: $('#layeronmouseenter'),
16340
+ click: $('#layeronclick'),
16341
+ mouseleave: $('#layeronmouseleave'),
16342
+ play: $('#layeronplay'),
16343
+ pause: $('#layeronpause'),
16344
+ stop: $('#layeronstop')
16345
+ }
16346
+ };
16347
+ fragmentEditor.editor.generator.registerField(this.forms.global.class);
16348
 
16349
+ this.fragmentEditor = fragmentEditor;
16350
 
16351
+ var availableDeviceModes = fragmentEditor.editor.getAvailableDeviceModes();
 
16352
 
16353
+ if (!availableDeviceModes.desktopLandscape) {
16354
+ this.forms.global.desktopLandscape.closest('.n2-mixed-group').css('display', 'none');
16355
  }
16356
+ if (!availableDeviceModes.tabletPortrait) {
16357
+ this.forms.global.tabletPortrait.closest('.n2-mixed-group').css('display', 'none');
16358
  }
16359
+ if (!availableDeviceModes.tabletLandscape) {
16360
+ this.forms.global.tabletLandscape.closest('.n2-mixed-group').css('display', 'none');
16361
+ }
16362
+ if (!availableDeviceModes.mobilePortrait) {
16363
+ this.forms.global.mobilePortrait.closest('.n2-mixed-group').css('display', 'none');
16364
+ }
16365
+ if (!availableDeviceModes.mobileLandscape) {
16366
+ this.forms.global.mobileLandscape.closest('.n2-mixed-group').css('display', 'none');
 
 
 
16367
  }
16368
 
16369
+ this.forms.placement.absolute = {
16370
+ parentid: $('#layerparentid'),
16371
+ parentalign: $('#layerparentalign'),
16372
+ parentvalign: $('#layerparentvalign'),
16373
+ left: $('#layerleft'),
16374
+ top: $('#layertop'),
16375
+ responsiveposition: $('#layerresponsive-position'),
16376
+ width: $('#layerwidth'),
16377
+ height: $('#layerheight'),
16378
+ responsivesize: $('#layerresponsive-size'),
16379
+ align: $('#layeralign'),
16380
+ valign: $('#layervalign')
 
 
 
 
 
 
 
 
 
 
 
 
16381
  };
 
16382
 
16383
+ this.forms.placement.normal = {
16384
+ margin: $('#layernormal-margin'),
16385
+ height: $('#layernormal-height'),
16386
+ maxwidth: $('#layernormal-maxwidth'),
16387
+ selfalign: $('#layernormal-selfalign')
16388
+ };
16389
 
16390
+ this.forms.component.content = {
16391
+ maxwidth: $('#layercontent-maxwidth'),
16392
+ selfalign: $('#layercontent-selfalign'),
16393
+ padding: $('#layercontent-padding'),
16394
+ inneralign: $('#layercontent-inneralign'),
16395
+ verticalalign: $('#layercontent-verticalalign'),
16396
+ stylemode: $('#layercontent-style-mode').on('n2resetmode', $.proxy(this.resetStyleMode, this, 'stylemode')),
16397
+ bgcolor: $('#layercontent-background-color'),
16398
+ bgimage: $('#layercontent-background-image'),
16399
+ bgimagex: $('#layercontent-background-focus-x'),
16400
+ bgimagey: $('#layercontent-background-focus-y'),
16401
+ bgimageparallax: $('#layercontent-background-parallax'),
16402
+ bgcolorgradient: $('#layercontent-background-gradient'),
16403
+ bgcolorgradientend: $('#layercontent-background-color-end'),
16404
+ opened: $('#layercontent-opened')
16405
+ };
16406
+ fragmentEditor.editor.generator.registerField(this.forms.component.content.bgimage);
16407
 
16408
+ this.forms.component.row = {
16409
+ padding: $('#layerrow-padding'),
16410
+ gutter: $('#layerrow-gutter'),
16411
+ fullwidth: $('#layerrow-fullwidth'),
16412
+ stretch: $('#layerrow-stretch'),
16413
+ wrapafter: $('#layerrow-wrap-after'),
16414
+ inneralign: $('#layerrow-inneralign'),
16415
+ href: $('#layerrow-href'),
16416
+ 'href-target': $('#layerrow-href-target'),
16417
+ bgimage: $('#layerrow-background-image'),
16418
+ bgimagex: $('#layerrow-background-focus-x'),
16419
+ bgimagey: $('#layerrow-background-focus-y'),
16420
+ bgimageparallax: $('#layerrow-background-parallax'),
16421
+ stylemode: $('#layerrow-style-mode').on('n2resetmode', $.proxy(this.resetStyleMode, this, 'stylemode')),
16422
+ bgcolor: $('#layerrow-background-color'),
16423
+ bgcolorgradient: $('#layerrow-background-gradient'),
16424
+ bgcolorgradientend: $('#layerrow-background-color-end'),
16425
+ borderradius: $('#layerrow-border-radius'),
16426
+ boxshadow: $('#layerrow-boxshadow'),
16427
+ opened: $('#layerrow-opened')
16428
+ };
16429
+ fragmentEditor.editor.generator.registerField(this.forms.component.row.href);
16430
+ fragmentEditor.editor.generator.registerField(this.forms.component.row.bgimage);
16431
 
16432
+ this.forms.component.col = {
16433
+ maxwidth: $('#layercol-maxwidth'),
16434
+ padding: $('#layercol-padding'),
16435
+ inneralign: $('#layercol-inneralign'),
16436
+ verticalalign: $('#layercol-verticalalign'),
16437
+ href: $('#layercol-href'),
16438
+ 'href-target': $('#layercol-href-target'),
16439
+ bgimage: $('#layercol-background-image'),
16440
+ bgimagex: $('#layercol-background-focus-x'),
16441
+ bgimagey: $('#layercol-background-focus-y'),
16442
+ bgimageparallax: $('#layercol-background-parallax'),
16443
+ stylemode: $('#layercol-style-mode').on('n2resetmode', $.proxy(this.resetStyleMode, this, 'stylemode')),
16444
+ bgcolor: $('#layercol-background-color'),
16445
+ bgcolorgradient: $('#layercol-background-gradient'),
16446
+ bgcolorgradientend: $('#layercol-background-color-end'),
16447
+ borderradius: $('#layercol-border-radius'),
16448
+ boxshadow: $('#layercol-boxshadow'),
16449
+ borderwidth: $('#layercol-border-width'),
16450
+ borderstyle: $('#layercol-border-style'),
16451
+ bordercolor: $('#layercol-border-color'),
16452
+ opened: $('#layercol-opened'),
16453
+ colwidth: $('#layercol-colwidth'),
16454
+ order: $('#layercol-order')
16455
+ };
16456
+ fragmentEditor.editor.generator.registerField(this.forms.component.col.href);
16457
+ fragmentEditor.editor.generator.registerField(this.forms.component.col.bgimage);
16458
+ }
16459
 
16460
+ ComponentSettings.prototype.changeActiveComponent = function (layer, componentType, placementType, properties) {
16461
+ this.currentLayer = layer;
16462
 
16463
+ if (this.componentType != componentType) {
 
 
 
 
 
16464
 
16465
+ $('html').attr('data-component', componentType);
16466
+ var pane = $('#n2-tabbed-slide-editor-settings').data('pane');
16467
 
16468
+ switch (componentType) {
16469
+ case 'content':
16470
+ pane.showTabs(['content', 'animations', 'position']);
16471
+ break;
16472
+ case 'layer':
16473
+ pane.showTabs(['item', 'style', 'animations', 'position']);
16474
+ break;
16475
+ case 'group':
16476
+ pane.showTabs(['group', 'animations']);
16477
+ break;
16478
+ case 'row':
16479
+ pane.showTabs(['row', 'animations', 'position']);
16480
+ break;
16481
+ case 'col':
16482
+ pane.showTabs(['column', 'animations', 'position']);
16483
+ break;
16484
 
16485
+ }
16486
+ this.componentType = componentType;
16487
+ }
16488
 
 
16489
 
16490
+ this.changeActiveComponentPlacement(placementType);
16491
+ this.syncFields(properties);
16492
  };
16493
 
16494
+ ComponentSettings.prototype.changeActiveComponentPlacement = function (placementType, properties) {
 
 
16495
 
16496
+ if (this.placementType != placementType) {
16497
+ $('html').attr('data-placement', placementType);
16498
+ this.placementType = placementType;
16499
+ }
16500
 
16501
+ this.syncFields(properties);
 
16502
  };
16503
 
16504
+ ComponentSettings.prototype.syncFields = function (properties) {
16505
+ if (typeof properties == 'object') {
16506
+ this.currentForm = $.extend({}, this.forms.global, this.forms.component[this.componentType], this.forms.placement[this.placementType]);
16507
 
16508
+ for (var name in properties) {
16509
+ if (typeof properties[name] !== undefined) {
16510
 
16511
+ this.updateField(name, properties[name]);
16512
+ } else {
16513
+ console.error('Value is undefined for: ' + name);
16514
+ }
16515
+ }
16516
 
16517
+ this.currentLayer.onSyncFields();
16518
 
16519
+ for (var k in this.currentForm) {
16520
+ this.currentForm[k].off('.layeroptions').on('outsideChange.layeroptions', $.proxy(this.activeComponentPropertyChanged, this, k));
16521
+ }
16522
+ }
16523
+ };
16524
 
16525
+ ComponentSettings.prototype.onUpdateField = function (e, name, value) {
16526
+ if (e.target == this.currentLayer) {
16527
+ this.updateField(name, value);
16528
+ }
16529
+ };
 
16530
 
16531
+ ComponentSettings.prototype.updateField = function (name, value) {
16532
+ if (typeof this.currentLayer['formSet' + name] === 'function') {
16533
+ this.currentLayer['formSet' + name](this, value);
16534
+ } else {
16535
+ if (this.currentForm[name] !== undefined) {
16536
+ var field = this.currentForm[name].data('field');
16537
+ if (field !== undefined) {
16538
+ field.insideChange(value);
16539
+ }
16540
+ }
16541
+ }
16542
+ };
16543
 
16544
+ ComponentSettings.prototype.activeComponentPropertyChanged = function (name, e) {
16545
+ if (this.currentLayer && !this.currentLayer.isDeleted) {
16546
+ this.updateLayerProperty(name);
16547
+ } else {
16548
+ var field = this.currentForm[name].data('field');
16549
+ if (typeof field !== 'undefined' && field !== null) {
16550
+ field.insideChange('');
16551
+ }
16552
+ }
16553
+ };
16554
 
16555
+ ComponentSettings.prototype.updateLayerProperty = function (name) {
16556
+ var value = this.currentForm[name].val();
16557
+ this.currentLayer.setProperty(name, value, 'manager');
16558
+ };
16559
 
16560
+ ComponentSettings.prototype.startFeatures = function () {
16561
+ this.layerFeatures = new N2Classes.LayerFeatures(this.forms.placement.absolute, this.fragmentEditor);
16562
 
16563
+ var globalAdaptiveFont = $('#n2-ss-layer-adaptive-font').on('click', $.proxy(function () {
16564
+ this.currentForm.adaptivefont.data('field').onoff.trigger('click');
16565
+ }, this));
16566
 
16567
+ this.forms.global.adaptivefont.on('nextendChange', $.proxy(function () {
16568
+ if (this.currentForm.adaptivefont.val() == 1) {
16569
+ globalAdaptiveFont.addClass('n2-active');
16570
+ } else {
16571
+ globalAdaptiveFont.removeClass('n2-active');
16572
+ }
16573
+ }, this));
16574
 
 
16575
 
16576
+ new N2Classes.FormElementNumber("n2-ss-layer-font-size", -Number.MAX_VALUE, Number.MAX_VALUE);
16577
+ new N2Classes.FormElementNumberSlider("n2-ss-layer-font-size", {
16578
+ min: 50,
16579
+ max: 300,
16580
+ step: 5
16581
+ });
16582
 
16583
+ var globalFontSize = $('#n2-ss-layer-font-size').on('outsideChange', $.proxy(function () {
16584
+ var value = parseInt(globalFontSize.val());
16585
+ this.currentForm.fontsize.val(value).trigger('change');
16586
+ }, this));
16587
 
16588
+ this.forms.global.fontsize.on('nextendChange', $.proxy(function () {
16589
+ globalFontSize.data('field').insideChange(this.forms.global.fontsize.val());
16590
+ }, this));
16591
  };
16592
 
16593
+ ComponentSettings.prototype.resetStyleMode = function (name, e) {
16594
+ this.currentLayer.resetStyleMode(name);
16595
+ };
 
 
 
16596
 
16597
+ return ComponentSettings;
16598
+ });
16599
+ N2D('BgAnimationEditor', ['NextendFragmentEditorController'], function ($, undefined) {
16600
 
16601
+ /**
16602
+ * @memberOf N2Classes
16603
+ *
16604
+ * @constructor
16605
+ */
16606
+ function BgAnimationEditor() {
16607
+ this.parameters = {
16608
+ shiftedBackgroundAnimation: 0
16609
  };
16610
 
16611
+ this.$css = $('<style></style>').appendTo('head');
16612
+ this.backgroundAnimations = {
16613
+ color: 'eeeeeeff'
16614
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16615
 
16616
+ N2Classes.NextendFragmentEditorController.prototype.constructor.call(this, false);
 
 
 
 
 
 
 
 
 
16617
 
16618
+ this.bgAnimationElement = $('.n2-bg-animation');
16619
+ this.slides = $('.n2-bg-animation-slide');
16620
+ this.bgImages = $('.n2-bg-animation-slide-bg');
16621
+ NextendTween.set(this.bgImages, {
16622
+ rotationZ: 0.0001
16623
+ });
16624
 
16625
+ this.directionTab = new N2Classes.FormElementRadio('n2-background-animation-preview-tabs', ['0', '1']);
16626
+ this.directionTab.element.on('nextendChange.n2-editor', $.proxy(this.directionTabChanged, this));
16627
 
16628
+ if (!nModernizr.csstransforms3d || !nModernizr.csstransformspreserve3d) {
16629
+ N2Classes.Notification.error('Background animations are not available in your browser. It works if the <i>transform-style: preserve-3d</i> feature available. ')
 
 
 
 
 
 
 
16630
  }
16631
 
16632
 
16633
+ this.$colorField = $('#n2-background-animationcolor')
16634
+ .on('nextendChange', $.proxy(this.changeColor, this));
16635
+ }
16636
 
16637
+ BgAnimationEditor.prototype = Object.create(N2Classes.NextendFragmentEditorController.prototype);
16638
+ BgAnimationEditor.prototype.constructor = BgAnimationEditor;
16639
 
16640
+ BgAnimationEditor.prototype.loadDefaults = function () {
16641
+ N2Classes.NextendFragmentEditorController.prototype.loadDefaults.call(this);
16642
+ this.type = 'backgroundanimation';
16643
+ this.current = 0;
16644
+ this.animationProperties = false;
16645
+ this.direction = 0;
16646
+ };
16647
 
16648
+ BgAnimationEditor.prototype.get = function () {
16649
+ return null;
16650
+ };
16651
 
16652
+ BgAnimationEditor.prototype.load = function (visual, tabs, mode, preview) {
16653
+ this.lightbox.addClass('n2-editor-loaded');
16654
+ };
16655
 
16656
+ BgAnimationEditor.prototype.setTabs = function (labels) {
16657
+
16658
+ };
16659
+
16660
+ BgAnimationEditor.prototype.directionTabChanged = function () {
16661
+ this.direction = parseInt(this.directionTab.element.val());
16662
+ };
16663
+
16664
+ BgAnimationEditor.prototype.start = function (data) {
16665
+ if (data.color !== undefined) {
16666
+ this.$colorField.data('field').insideChange(data.color);
16667
+ this.backgroundAnimations.color = data.color;
16668
  } else {
16669
+ $('#n2-tab-background-animation-form').remove();
16670
+ this.$css.html('.n2-3d-side,.tile-colored-overlay{background: ' + nextend.currentEditor.frontend.parameters.bgAnimationsColor + ';}');
16671
  }
16672
+ if (this.animationProperties) {
16673
+ if (!this.timeline) {
16674
+ this.next();
16675
+ } else {
16676
+ this.timeline.play();
16677
+ }
16678
  }
16679
+ };
16680
 
16681
+ BgAnimationEditor.prototype.changeColor = function () {
16682
+ this.backgroundAnimations.color = this.$colorField.val();
16683
+ this.$css.html('.n2-3d-side,.tile-colored-overlay{background: ' + N2Color.hex2rgbaCSS(this.backgroundAnimations.color) + ';}');
16684
+ };
 
 
16685
 
16686
+ BgAnimationEditor.prototype.pause = function () {
16687
+ if (this.timeline) {
16688
+ this.timeline.pause();
16689
+ }
16690
  };
16691
 
16692
+ BgAnimationEditor.prototype.next = function () {
16693
+ this.timeline = new NextendTimeline({
16694
+ paused: true,
16695
+ onComplete: $.proxy(this.ended, this)
16696
+ });
16697
+ var current = this.bgImages.eq(this.current),
16698
+ next = this.bgImages.eq(1 - this.current);
16699
 
16700
+ if (nModernizr.csstransforms3d && nModernizr.csstransformspreserve3d) {
16701
+ this.currentAnimation = new N2Classes['SmartSliderBackgroundAnimation' + this.animationProperties.type](this, current, next, this.animationProperties, 1, this.direction);
 
 
16702
 
16703
+ this.slides.eq(this.current).css('zIndex', 2);
16704
+ this.slides.eq(1 - this.current).css('zIndex', 3);
16705
 
16706
+ this.timeline.to(this.slides.eq(this.current), 0.5, {
16707
+ opacity: 0
16708
+ }, this.currentAnimation.getExtraDelay());
16709
 
16710
+ this.timeline.to(this.slides.eq(1 - this.current), 0.5, {
16711
+ opacity: 1
16712
+ }, this.currentAnimation.getExtraDelay());
16713
 
 
 
 
 
16714
 
16715
+ this.currentAnimation.postSetup();
16716
 
 
 
16717
  } else {
 
 
 
 
 
 
16718
 
16719
+ this.timeline.to(this.slides.eq(this.current), 1.5, {
16720
+ opacity: 0
16721
+ }, 0);
16722
 
16723
+ this.timeline.to(this.slides.eq(1 - this.current), 1.5, {
16724
+ opacity: 1
16725
+ }, 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16726
  }
16727
+ this.current = 1 - this.current;
16728
+ this.timeline.play();
16729
+ };
16730
+
16731
+ BgAnimationEditor.prototype.ended = function () {
16732
+ if (this.currentAnimation) {
16733
+ this.currentAnimation.ended();
 
 
 
16734
  }
16735
+ this.next();
16736
+ };
16737
 
16738
+ BgAnimationEditor.prototype.setAnimationProperties = function (animationProperties) {
16739
+ var lastAnimationProperties = this.animationProperties;
16740
+ this.animationProperties = animationProperties;
16741
+ if (!lastAnimationProperties) {
16742
+ this.next();
16743
+ }
16744
+ };
16745
 
16746
+ return BgAnimationEditor;
16747
+ });
16748
+
16749
+ N2D('BgAnimationManager', ['NextendVisualManagerMultipleSelection'], function ($, undefined) {
16750
 
16751
+ /**
16752
+ * @memberOf N2Classes
16753
+ *
16754
+ * @constructor
16755
+ */
16756
+ function BgAnimationManager() {
16757
+ this.type = 'backgroundanimation';
16758
+ N2Classes.NextendVisualManagerMultipleSelection.prototype.constructor.apply(this, arguments);
16759
+ }
16760
 
16761
+ BgAnimationManager.prototype = Object.create(N2Classes.NextendVisualManagerMultipleSelection.prototype);
16762
+ BgAnimationManager.prototype.constructor = BgAnimationManager;
16763
 
16764
+ BgAnimationManager.prototype.loadDefaults = function () {
16765
+ N2Classes.NextendVisualManagerMultipleSelection.prototype.loadDefaults.apply(this, arguments);
16766
+ this.type = 'backgroundanimation';
16767
+ this.labels = {
16768
+ visual: 'Background animation',
16769
+ visuals: 'Background animations'
16770
+ };
16771
  };
16772
 
16773
+ BgAnimationManager.prototype.initController = function () {
16774
+ return new N2Classes.BgAnimationEditor();
 
 
 
 
 
16775
  };
16776
 
16777
+ BgAnimationManager.prototype.createVisual = function (visual, set) {
16778
+ return new N2Classes.NextendVisualWithSetRowMultipleSelection(visual, set, this);
 
 
 
 
 
 
16779
  };
16780
 
16781
+ BgAnimationManager.prototype.show = function (data, saveCallback) {
16782
+ var controllerParameters = {};
 
 
 
 
 
 
 
 
 
 
 
 
 
16783
 
16784
+ var $colorField = $('#sliderbackground-animation-color');
16785
+ if ($colorField.length) {
16786
+ controllerParameters.color = $colorField.val();
16787
  }
16788
+ N2Classes.NextendVisualManagerMultipleSelection.prototype.show.call(this, data, saveCallback, controllerParameters);
 
16789
  };
16790
 
16791
+ BgAnimationManager.prototype.getAsString = function () {
16792
+
16793
+ var $colorField = $('#sliderbackground-animation-color');
16794
+ if ($colorField.length) {
16795
+ $colorField.val($('#n2-background-animationcolor').val());
 
16796
  }
16797
+ return N2Classes.NextendVisualManagerMultipleSelection.prototype.getAsString.call(this);
16798
  };
16799
 
16800
+ return BgAnimationManager;
16801
+ });
16802
+
 
16803
  N2D('ItemButton', ['Item'], function ($, undefined) {
16804
  "use strict";
16805
 
17277
  N2Classes.AjaxHelper.getJSON('https://vimeo.com/api/v2/video/' + encodeURI(videoCode) + '.json').done($.proxy(function (data) {
17278
  $('#item_vimeoimage').val(data[0].thumbnail_large).trigger('change');
17279
  }, this)).fail(function (data) {
17280
+ if (data.privateurl == 0) {
17281
+ N2Classes.Notification.error('Video not found or private.');
17282
+ }
17283
  });
17284
  } else {
17285
  N2Classes.Notification.error('The provided URL does not match any known Vimeo url or code.');
library/media/dist/smartslider-backend.min.js CHANGED
@@ -1,10 +1,10 @@
1
- (function(){var t=this;t.N2_=t.N2_||{r:[],d:[]},t.N2R=t.N2R||function(){t.N2_.r.push(arguments)},t.N2D=t.N2D||function(){t.N2_.d.push(arguments)}}).call(window),N2D("ContextMenu",function(t,e){function i(e,i){this.isActive=!1,this.$el=e.data("nextendcontextmenu",this),this.parameters=t.extend({selector:!1,onShow:function(){}},i),this.$menu=t('<div class="n2-context-menu"></div>').on("mousedown",function(){N2Classes.WindowManager.get().setMouseDownArea("context-menu")}).appendTo("body"),this.parameters.selector?this.$el.on("contextmenu",this.parameters.selector,t.proxy(this.onShowContextMenu,this)):this.$el.on("contextmenu",t.proxy(this.onShowContextMenu,this))}return i.prototype.onShowContextMenu=function(e){e.preventDefault(),this.clearItems(),this.parameters.onShow.call(this,e,this),this.hasItems&&(e.stopPropagation(),this.isActive=!0,this.$menu.css({left:e.pageX,top:e.pageY}),t("html").on("mouseleave.nextendcontextmenu, click.nextendcontextmenu",t.proxy(this.onHide,this))),this.$menu.toggleClass("n2-active",this.hasItems)},i.prototype.onHide=function(){t("html").off(".nextendcontextmenu"),this.$menu.removeClass("n2-active"),this.isActive=!1},i.prototype.clearItems=function(){this.isActive&&this.onHide(),this.hasItems=!1,this.$menu.html("")},i.prototype.addItem=function(e,i,s){this.hasItems=!0,this.$menu.append(t('<div><i class="n2-i '+i+'"></i><span>'+e+"</span></div>").on("click",s))},t.fn.nextendContextMenu=function(e){return this.each(function(){new i(t(this),e)})},i}),N2D("Zoom",function(t,e){function i(e){this.currentContainerWidth=0,this.devices={unknownUnknown:t("<div />")},this.responsives=[],this.add(e);var i=e.parameters.sliderWidthToDevice.desktopPortrait;this.container=e.containerElement.closest(".n2-ss-container-device,.n2-ss-canvas-slider-container").add(e.containerElement.closest(".n2-ss-slider-outer-container")),this.container.width(i),this.containerWidth=i,this.initZoom();var s=t("#n2-ss-devices .n2-tr"),r=e.parameters.deviceModes;this.devices.desktopPortrait=t('<div class="n2-td n2-panel-option" data-device="desktop" data-orientation="portrait"><i class="n2-i n2-it n2-i-v-desktop"></i></div>').prependTo(s),r.desktopLandscape?this.devices.desktopLandscape=t('<div class="n2-td n2-panel-option" data-device="desktop" data-orientation="landscape"><i class="n2-i n2-it n2-i-v-desktop-landscape"></i></div>').prependTo(s):this.devices.desktopLandscape=this.devices.desktopPortrait,r.tabletPortrait?this.devices.tabletPortrait=t('<div class="n2-td n2-panel-option" data-device="tablet" data-orientation="portrait"><i class="n2-i n2-it n2-i-v-tablet"></i></div>').prependTo(s):this.devices.tabletPortrait=this.devices.desktopPortrait,r.tabletLandscape?this.devices.tabletLandscape=t('<div class="n2-td n2-panel-option" data-device="tablet" data-orientation="landscape"><i class="n2-i n2-it n2-i-v-tablet-landscape"></i></div>').prependTo(s):this.devices.tabletLandscape=this.devices.desktopLandscape,r.mobilePortrait?this.devices.mobilePortrait=t('<div class="n2-td n2-panel-option" data-device="mobile" data-orientation="portrait"><i class="n2-i n2-it n2-i-v-mobile"></i></div>').prependTo(s):this.devices.mobilePortrait=this.devices.tabletPortrait,r.mobileLandscape?this.devices.mobileLandscape=t('<div class="n2-td n2-panel-option" data-device="mobile" data-orientation="landscape"><i class="n2-i n2-it n2-i-v-mobile-landscape"></i></div>').prependTo(s):this.devices.mobileLandscape=this.devices.tabletLandscape,this.deviceOptions=t("#n2-ss-devices .n2-panel-option"),this.deviceOptions.each(t.proxy(function(e,i){t(i).on({mousedown:t.proxy(N2Classes.WindowManager.setMouseDownArea,null,"zoomDeviceClicked"),click:t.proxy(this.setDeviceMode,this)})},this)),e.sliderElement.on("SliderDeviceOrientation",t.proxy(this.onDeviceOrientationChange,this))}var s=null;return i.add=function(t){s=new i(t),i.add=function(t){s.add(t)}},i.prototype.add=function(t){this.responsives.push(t),this.setOrientation("portrait"),t.parameters.onResizeEnabled=0,t.parameters.forceFull=0,t._getDevice=t._getDeviceZoom},i.prototype.onDeviceOrientationChange=function(e,i){t("#n2-admin").removeClass("n2-ss-mode-"+i.lastDevice+i.lastOrientation).addClass("n2-ss-mode-"+i.device+i.orientation),this.devices[i.lastDevice+i.lastOrientation].removeClass("n2-active"),this.devices[i.device+i.orientation].addClass("n2-active")},i.prototype.initZoom=function(){var e=t("#n2-ss-slider-zoom");e.length>0&&("undefined"!=typeof e[0].slide&&(e[0].slide=null),this.zoom=e.removeAttr("slide").prop("slide",!1).nUISlider({step:1,value:1,min:0,max:102}),this.$handle=e.data("nUISlider").handle,this.responsives[0].sliderElement.one("SliderResize",t.proxy(function(t){var e=this.responsives[0].containerElement.width();this.setContainerWidth(t,e,!0)},this)),this.zoom.on({"slide.n2-ss-zoom":t.proxy(this.zoomChange,this),"slidechange.n2-ss-zoom":t.proxy(this.zoomChange,this)}))},i.prototype.zoomChange=function(t,i){if(t.originalEvent!==e){var s,r=i.value,n=1;50>r?n=nextend.smallestZoom/this.containerWidth+Math.max(r/50,0)*(1-nextend.smallestZoom/this.containerWidth):r>52&&(n=1+(r-52)/50),s=parseInt(n*this.containerWidth),this.setContainerWidth(t,s)}},i.prototype.setContainerWidth=function(t,e,i){if(this.currentContainerWidth!=e){this.currentContainerWidth=e,this.$handle.html(e+"px"),this.container.width(e);for(var s=0;s<this.responsives.length;s++)this.responsives[s].doResize(t);if(i){var r=e/this.containerWidth,n=50;1>r?n=(r-nextend.smallestZoom/this.containerWidth)/(1-nextend.smallestZoom/this.containerWidth)*50:r>1&&(n=50*(r-1)+52),this.zoom.nUISlider("option","value",n)}}},i.prototype.setDeviceMode=function(e){var i=t(e.currentTarget);if((e.ctrlKey||e.metaKey)&&this.responsives[0].slider.editor.fragmentEditor){var s=i.data("orientation");this.responsives[0].slider.editor.fragmentEditor.copyOrResetMode(i.data("device")+s[0].toUpperCase()+s.substr(1))}else this.setOrientation(i.data("orientation")),this.setContainerWidth(e,this.getModeWidth(i.data("device")),!0)},i.prototype.getModeWidth=function(t){var e,i=this.responsives[0];e=i.orientationMode==N2Classes.SmartSliderResponsive.OrientationMode.ADMIN_PORTRAIT?N2Classes.SmartSliderResponsive.DeviceOrientation.PORTRAIT:N2Classes.SmartSliderResponsive.DeviceOrientation.LANDSCAPE;var s=i.parameters.sliderWidthToDevice[t+N2Classes.SmartSliderResponsive._DeviceOrientation[e]];if("mobile"==t)switch(N2Classes.SmartSliderResponsive._DeviceOrientation[e]){case"Portrait":s=Math.max(nextend.smallestZoom,320)}return s},i.prototype.setOrientation=function(t){if("portrait"==t)for(var e=0;e<this.responsives.length;e++)this.responsives[e].orientationMode=N2Classes.SmartSliderResponsive.OrientationMode.ADMIN_PORTRAIT;else for(var e=0;e<this.responsives.length;e++)this.responsives[e].orientationMode=N2Classes.SmartSliderResponsive.OrientationMode.ADMIN_LANDSCAPE},i}),N2D("CreateSlider",function(t,e){function i(e,i,s){this.addToGroupModal=null,this.groupID=e,this.ajaxUrl=i,this.shouldSkipLicenseModal=s,t(".n2-ss-create-slider").click(t.proxy(function(t){t.preventDefault(),t.stopImmediatePropagation(),this.showModal()},this)),this.notificationStack=new N2Classes.NotificationStackModal(t("body")),t(".n2-ss-add-sample-slider").click(t.proxy(function(t){t.preventDefault(),t.stopImmediatePropagation(),this.showDemoSliders()},this)),"createslider"===window.location.hash.substring(1)&&this.showModal()}return i.prototype.showModal=function(){if(!this.createSliderModal){var e=this,i=this.ajaxUrl,s=[];s.push({key:"default",name:n2_("Default"),image:"$ss$/admin/images/sliderpresets/default.png"}),s.push({key:"fullwidth",name:n2_("Full width"),image:"$ss$/admin/images/sliderpresets/fullwidth.png"}),s.push({key:"thumbnailhorizontal",name:n2_("Thumbnail - horizontal"),image:"$ss$/admin/images/sliderpresets/thumbnailhorizontal.png"});var r=[550,540];this.createSliderModal=new N2Classes.NextendModal({zero:{size:r,title:n2_("Create Slider"),back:!1,close:!0,content:'<form class="n2-form"></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Create")+"</a>"],fn:{show:function(){var r=this.controls.find(".n2-button-green"),n=this.content.find(".n2-form").on("submit",function(t){t.preventDefault(),r.trigger("click")});n.append(this.createInput(n2_("Slider name"),"createslidertitle","width: 240px;")),n.append(this.createInputUnit(n2_("Width"),"createsliderwidth","px","width: 30px;")),n.append(this.createInputUnit(n2_("Height"),"createsliderheight","px","width: 30px;")),new N2Classes.FormElementAutocompleteSimple("createsliderwidth",["1920","1200","1000","800","600","400"]),new N2Classes.FormElementAutocompleteSimple("createsliderheight",["800","600","500","400","300","200"]);var o=t("#createslidertitle").val(n2_("Slider")).focus(),a=t("#createsliderwidth").val(1200),l=t("#createsliderheight").val(500);a.parent().addClass("n2-form-element-autocomplete"),l.parent().addClass("n2-form-element-autocomplete"),this.createHeading(n2_("Preset")).appendTo(this.content);var h=120,d=this.createImageRadio(s).css({height:h,display:"flex",flexWrap:"wrap"}).appendTo(this.content),p=d.find("input");d.css("overflow","hidden"),this.createHeading(n2_("Import Sample Sliders")).appendTo(this.content),t('<div class="n2-ss-create-slider-free-sample" style="background-image: url(\''+nextend.imageHelper.fixed("$ss$/admin/images/free/sample1.png")+'\')"></div><div class="n2-ss-create-slider-free-sample" style="background-image: url(\''+nextend.imageHelper.fixed("$ss$/admin/images/free/sample2.png")+'\')"></div><div class="n2-ss-create-slider-free-sample" style="background-image: url(\''+nextend.imageHelper.fixed("$ss$/admin/images/free/sample3.png")+"')\"></div>").on("click",t.proxy(function(){this.hide(),e.showDemoSliders()},this)).appendTo(this.content),r.on("click",t.proxy(function(){N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(i,{nextendaction:"create"}),data:{groupID:e.groupID,sliderTitle:o.val(),sliderSizeWidth:a.val(),sliderSizeHeight:l.val(),preset:p.val()},dataType:"json"}).done(t.proxy(function(t){N2Classes.AjaxHelper.startLoading()},this))},this))}}}})}this.createSliderModal.show()},i.prototype.showDemoSliders=function(){var e=this;t("body").css("overflow","hidden");var i=0,s=t('<iframe src="//smartslider3.com/demo-import/?pro='+i+"&version="+N2SS3VERSION+"&utm_campaign="+N2SS3C+"&utm_source=import-slider-frame&utm_medium=smartslider-"+N2PLATFORM+"-"+(i?"pro":"free")+'" frameborder="0"></iframe>').css({position:"fixed",zIndex:1e5,left:0,top:0,width:"100%",height:"100%"}).appendTo("body"),r=function(){t("body").css("overflow",""),s.remove(),window.removeEventListener("message",o,!1),e.notificationStack.popStack()},n=function(t){N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(e.ajaxUrl,{nextendaction:"importDemo"}),data:{groupID:e.groupID,key:N2Classes.Base64.encode(t.replace(/^(http(s)?:)?\/\//,"//"))},dataType:"json"}).fail(function(){})},o=function(t){if("http://smartslider3.com"===t.origin||"https://smartslider3.com"===t.origin){var e=t.data;switch(e.key){case"importSlider":return void("function"==typeof nextend.joinCommunity?nextend.joinCommunity(function(){n(e.data.href)}):n(e.data.href));case"closeWindow":r()}}};this.notificationStack.enableStack(),N2Classes.Esc.add(t.proxy(function(){return r(),!0},this)),window.addEventListener("message",o,!1)},i}),N2D("ManageSliders",function(t,e){function i(e,i,s){this.groupID=e,this.ajaxUrl=i,this.sliders=[],this.sliderPanel=t("#n2-ss-slider-container"),this.orderBy="ordering"==this.sliderPanel.data("orderby"),this.slidersContainer=this.sliderPanel.find(".n2-ss-sliders-container");for(var r=this.slidersContainer.find(".n2-ss-box-slider"),n=0;n<r.length;n++)this.sliders.push(new N2Classes.Slider(this,r.eq(n)));this.changed(),this.initMenu(),this.initOrderable(),this.create=new N2Classes.CreateSlider(e,i,s),this.initBulk()}return i.prototype.changed=function(){t("html").attr("data-sliders",this.sliders.length)},i.prototype.initSliders=function(){for(var e=this.slidersContainer.find(".n2-ss-box-slider"),i=[],s=0;s<e.length;s++){var r=e.eq(s).data("slider");i.push(r)}this.sliders=i,this.changed(),t(window).triggerHandler("SmartSliderSidebarSlidersChanged")},i.prototype.initOrderable=function(){if(this.orderBy){var e={helper:"clone",items:"> .n2-ss-box-slider",stop:t.proxy(this.saveOrder,this),placeholder:"n2-box-sortable-placeholder",distance:10};this.slidersContainer.nUISortable(e)}},i.prototype.saveOrder=function(e,i){for(var s=this.slidersContainer.find(".n2-ss-box-slider"),r=[],n=[],o=[],a=0;a<s.length;a++){var l=s.eq(a).data("slider");r.push(l),n.push(l.getId())}for(var a=0;a<this.sliders.length;a++)o.push(this.sliders[a].getId());if(JSON.stringify(o)!=JSON.stringify(n)){t(window).triggerHandler("SmartSliderSidebarSlidersOrderChanged");var h={nextendcontroller:"sliders",nextendaction:"order"};N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,h),data:{groupID:this.groupID,sliderorder:n,isReversed:"DESC"==this.sliderPanel.data("orderbydirection")?1:0}}),this.sliders=r}},i.prototype.initMenu=function(){this.slider=null,this.menu=t("#n2-ss-slider-menu").detach().addClass("n2-inited"),this.menuActions={duplicate:this.menu.find(".n2-ss-duplicate").on("click",t.proxy(function(t){this.slider.duplicate(t)},this)),"delete":this.menu.find(".n2-ss-delete").on("click",t.proxy(function(t){this.slider["delete"](t)},this)),preview:this.menu.find(".n2-ss-preview").on("click",t.proxy(function(t){this.slider.preview(t)},this))},this.menu.find(".n2-button").on("click",t.proxy(function(e){e.preventDefault(),e.stopPropagation(),this.menu.hasClass("n2-active")?this.menu.removeClass("n2-active").off("mouseleave"):this.menu.addClass("n2-active").on("mouseleave",function(){t(this).removeClass("n2-active")})},this))},i.prototype.showMenu=function(t){this.slider=t,this.menu.appendTo(t.box)},i.prototype.hideMenu=function(){this.menu.hasClass("n2-active")&&this.menu.removeClass("n2-active").off("mouseleave"),this.menu.detach()},i.prototype.deleteSliders=function(e,i){this.hideMenu();var s=i[0].box.find(".n2-box-placeholder-title a").text();i.length>1&&(s+=" and "+(i.length-1)+" more"),N2Classes.NextendModal.deleteModal("slider-delete",s,t.proxy(function(){N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendcontroller:"sliders",nextendaction:"delete"}),type:"POST",data:{sliders:e}}).done(t.proxy(function(){for(var t=0;t<i.length;t++)i[t].deleted();this.initSliders(),this.leaveBulk()},this))},this))},i.prototype.duplicateSliders=function(e,i){for(var s=0;s<this.sliders.length;s++)this.sliders[s].selected&&this.sliders[s].duplicate(t.Event("click",{currentTarget:null}))},i.prototype.exportSliders=function(e,i){window.location.href=N2Classes.AjaxHelper.makeFallbackUrl(this.ajaxUrl,{nextendcontroller:"sliders",nextendaction:"exportAll"})+"&"+t.param({sliders:e,currentGroupID:this.groupID})},i.prototype.initBulk=function(){this.selection=[],this.isBulkSelection=!1;var e=t(".n2-bulk-select").find("a");e.eq(0).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.select()})},this)),e.eq(1).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.deSelect()})},this));t(".n2-bulk-actions").find("a").on("click",t.proxy(function(e){switch(e.preventDefault(),t(e.currentTarget).data("action")){case"duplicate":this.bulkAction("duplicateSliders",!1);break;case"delete":this.bulkAction("deleteSliders",!1);break;case"export":this.bulkAction("exportSliders",!1);break;case"addToGroup":this.bulkAction("addToGroup",!0)}},this))},i.prototype.addSelection=function(t){0==this.selection.length&&this.enterBulk(),this.selection.push(t)},i.prototype.removeSelection=function(e){this.selection.splice(t.inArray(e,this.selection),1),0==this.selection.length&&this.leaveBulk()},i.prototype.bulkSelect=function(t){for(var e=0;e<this.sliders.length;e++)t(this.sliders[e])},i.prototype.bulkAction=function(t,e){var i=[],s=[];this.bulkSelect(function(t){!t.selected||e&&t.isGroup||(i.push(t),s.push(t.getId()))}),s.length?(this[t](s,i),this.leaveBulk()):e?N2Classes.Notification.notice("Please select one or more sliders for the action!"):N2Classes.Notification.notice("Please select one or more sliders or groups for the action!")},i.prototype.enterBulk=function(){this.isBulkSelection||(this.isBulkSelection=!0,this.orderBy&&this.slidersContainer.nUISortable("option","disabled",!0),t("#n2-admin").addClass("n2-ss-has-box-selection"))},i.prototype.leaveBulk=function(){if(this.isBulkSelection){this.orderBy&&this.slidersContainer.nUISortable("option","disabled",!1),t("#n2-admin").removeClass("n2-ss-has-box-selection");for(var e=0;e<this.sliders.length;e++)this.sliders[e].deSelect();this.selection=[],this.isBulkSelection=!1}},i}),N2D("Slider",function(t,e){function i(e,i){this.selected=!1,this.manager=e,this.box=i.data("slider",this).addClass("n2-clickable"),this.isGroup=this.box.hasClass("n2-ss-box-slider-group"),this.box.on("mouseenter",t.proxy(function(){this.manager.showMenu(this)},this)).on("mouseleave",t.proxy(function(){this.manager.hideMenu()},this)).on("click.n2-slider",t.proxy(this.goToEdit,this)),this.box.find(".n2-ss-box-select").on("click",t.proxy(function(t){t.stopPropagation(),t.preventDefault(),this.invertSelection()},this))}return i.prototype.getId=function(){return this.box.data("sliderid")},i.prototype.goToEdit=function(t,e){if("A"!==t.target.tagName){var i=this.box.data("editurl");"undefined"!=typeof e&&e?window.open(i,"_blank"):window.location=i}},i.prototype.preview=function(t){t.stopPropagation(),t.preventDefault(),window.open(N2Classes.AjaxHelper.makeFallbackUrl(this.box.data("editurl"),{nextendcontroller:"preview",nextendaction:"index"}),"_blank")},i.prototype.duplicate=function(e){e.stopPropagation(),e.preventDefault();var s=t.Deferred();return N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.box.data("editurl"),{nextendcontroller:"slider",nextendaction:"duplicate"})}).done(t.proxy(function(e){var r=t(e.data).insertAfter(this.box),n=new i(this.manager,r);this.manager.initSliders(),s.resolve(n)},this)),s},i.prototype["delete"]=function(t){t.stopPropagation(),t.preventDefault(),this.manager.deleteSliders([this.getId()],[this])},i.prototype.deleted=function(){this.box.remove()},i.prototype.invertSelection=function(t){t&&t.preventDefault(),this.selected?this.deSelect():this.select()},i.prototype.select=function(){this.selected||(this.selected=!0,this.box.addClass("n2-selected"),this.manager.addSelection(this))},i.prototype.deSelect=function(){this.selected&&(this.selected=!1,this.box.removeClass("n2-selected"),this.manager.removeSelection(this))},i}),N2D("FormElementAnimationManager",["FormElement"],function(t,e){function i(e,i){this.element=t("#"+e),this.managerIdentifier=i,this.element.parent().on("click",t.proxy(this.show,this)),this.element.siblings(".n2-form-element-clear").on("click",t.proxy(this.clear,this)),this.name=this.element.siblings("input"),this.updateName(this.element.val()),N2Classes.FormElement.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.FormElement.prototype),i.prototype.constructor=i,i.prototype.show=function(e){e.preventDefault(),nextend[this.managerIdentifier].show(this.element.val(),t.proxy(this.save,this))},i.prototype.clear=function(t){t.preventDefault(),t.stopPropagation(),this.val("")},i.prototype.save=function(t,e){this.val(e)},i.prototype.val=function(t){this.element.val(t),this.updateName(t),this.triggerOutsideChange()},i.prototype.insideChange=function(t){this.element.val(t),this.updateName(t),this.triggerInsideChange()},i.prototype.updateName=function(t){t=""==t?n2_("Disabled"):t.split("||").length>1?n2_("Multiple animations"):n2_("Single animation"),this.name.val(t)},i}),N2D("FormElementBackground",["FormElement"],function(t,e){function i(e,i){this.value="",this.element=t("#"+e),this.$container=this.element.closest(".n2-form-tab"),this.panel=t("#"+e+"-panel"),this.setValue(i),this.options=this.panel.find(".n2-subform-image-option").on("click",t.proxy(this.selectOption,this)),this.active=this.getIndex(this.options.filter(".n2-active").get(0)),this.element.on("change",t.proxy(function(){this.insideChange(this.element.val())},this)),N2Classes.FormElement.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.FormElement.prototype),i.prototype.constructor=i,i.prototype.selectOption=function(e){var i=this.getIndex(e.currentTarget);if(i!=this.active){this.options.eq(i).addClass("n2-active"),this.options.eq(this.active).removeClass("n2-active"),this.active=i;var s=t(e.currentTarget).data("value");this.insideChange(s)}},i.prototype.setValue=function(t){this.$container.removeClass("n2-ss-background-type-"+this.value),this.value=t,this.$container.addClass("n2-ss-background-type-"+this.value)},i.prototype.insideChange=function(t){this.setValue(t),this.element.val(t),this.options.removeClass("n2-active"),this.options.filter('[data-value="'+t+'"]').addClass("n2-active"),this.triggerInsideChange()},i.prototype.getIndex=function(e){return t.inArray(e,this.options)},i}),N2D("FormElementColumns",["FormElement"],function(t,e){function i(e){this.denominators={1:100,2:100,3:144,4:100,5:100,6:144},this.element=t("#"+e),N2Classes.FormElement.prototype.constructor.apply(this,arguments),this.$c=t("#"+e).parent(),this.$container=this.$c.find(".n2-ss-columns-element-container"),this.containerWidth=284,this.maxWidth=0,this.$container.nUISortable({axis:"x",items:".n2-ss-columns-element-column",helper:"clone_hide",start:t.proxy(function(t,e){this.$container.addClass("n2-sortable-currently-sorted"),e.placeholder.css({width:e.item.width(),visibility:"hidden"});var i=this.$container.find(".n2-ss-columns-element-column");e.item.data("index",i.index(e.item))},this),stop:t.proxy(function(t,e){var i=this.$container.find(".n2-ss-columns-element-column"),s=e.item.data("index"),r=i.index(e.item);s!=r&&(this.currentRow.moveCol(s,r),e.item.data("index",null)),this.makeResizable(),this.$container.removeClass("n2-sortable-currently-sorted")},this)}),this.$c.find(".n2-ss-columns-element-add-col").on({click:t.proxy(function(){this.currentRow.createCol()},this)})}return i.prototype=Object.create(N2Classes.FormElement.prototype),i.prototype.constructor=i,i.prototype.getDenominator=function(t){return this.denominators[t]===e&&(this.denominators[t]=15*t),this.denominators[t]},i.prototype.setRow=function(t){this.currentRow=t,this.insideChange(t.getColumnsOrdered())},i.prototype.setValue=function(t){},i.prototype.insideChange=function(t){this.start(t)},i.prototype.activateColumn=function(t){var e=this.$container.find(".n2-ss-columns-element-column").index(t.currentTarget);this.currentRow.activateColumn(e,t)},i.prototype.start=function(e){this.percentages=[];for(var i=e.split("+"),s=0;s<i.length;s++)this.percentages.push(new Fraction(i[s]));this.refreshMaxWidth(),this.$container.empty();for(var s=0;s<this.percentages.length;s++)this.updateColumn(t('<div class="n2-ss-columns-element-column">').on("click",t.proxy(this.activateColumn,this)).appendTo(this.$container),this.percentages[s]);this.makeResizable()},i.prototype.refreshMaxWidth=function(){this.maxWidth=this.containerWidth-15*(this.percentages.length-1)},i.prototype.updateColumn=function(t,e){t.css("width",this.maxWidth*e.valueOf()+"px").html(Math.round(100*e.valueOf()*10)/10+"%")},i.prototype.makeResizable=function(){this.handles&&this.handles.remove(),this.$columns=this.$container.find(".n2-ss-columns-element-column"),t('<div class="n2-ss-columns-element-handle"><div class="n2-i n2-i-more"></div></div>').insertAfter(this.$columns.not(this.$columns.last())),this.handles=this.$container.find(".n2-ss-columns-element-handle").on("mousedown",t.proxy(this._resizeStart,this))},i.prototype._resizeStart=function(e){var i=this.handles.index(e.currentTarget),s=this.$container.offset().left+8;this.resizeContext={index:i,cLeft:s,$currentCol:this.$columns.eq(i),$nextCol:this.$columns.eq(i+1),startX:Math.max(0,Math.min(e.clientX-s,this.containerWidth))},this._resizeMove(e),t("html").off(".resizecol").on({"mousemove.resizecol":t.proxy(this._resizeMove,this),"mouseup.resizecol mouseleave.resizecol":t.proxy(this._resizeStop,this)})},i.prototype._resizeMove=function(e){e.preventDefault();var i=Math.max(0,Math.min(e.clientX-this.resizeContext.cLeft,this.containerWidth)),s=this.getDenominator(this.percentages.length),r=new Fraction(Math.round((i-this.resizeContext.startX)/(this.maxWidth/s)),s);r.compare(this.percentages[this.resizeContext.index].clone().mul(-1))<0&&(r=this.percentages[this.resizeContext.index].clone().mul(-1)),r.compare(this.percentages[this.resizeContext.index+1])>0&&(r=this.percentages[this.resizeContext.index+1].clone());var n=this.percentages[this.resizeContext.index].add(r),o=this.percentages[this.resizeContext.index+1].sub(r);this.updateColumn(this.resizeContext.$currentCol,n),this.updateColumn(this.resizeContext.$nextCol,o);var a=t.extend([],this.percentages);return a[this.resizeContext.index]=n,a[this.resizeContext.index+1]=o,this.onColumnWidthChange(a),[n,o]},i.prototype._resizeStop=function(e){var i=this._resizeMove(e);this.percentages[this.resizeContext.index]=i[0],this.percentages[this.resizeContext.index+1]=i[1],t("html").off(".resizecol"),delete this.resizeContext,this.currentRow.setRealColsWidth(this.percentages)},i.prototype.onColumnWidthChange=function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i].valueOf());this.currentRow.updateColumnWidth(e)},i}),function(t){"use strict";function e(t,e){return isNaN(t=parseInt(t,10))&&i(),t*e}function i(){throw"Invalid Param"}function s(t,e){return this instanceof s?(o(t,e),t=s.REDUCE?d(n.d,n.n):1,this.s=n.s,this.n=n.n/t,void(this.d=n.d/t)):new s(t,e)}var r=2e3,n={s:1,n:0,d:1},o=function(t,s){var r,o=0,a=1,l=1,h=0,d=0,p=0,c=1,u=1,y=0,g=1,f=1,m=1,v=1e7;if(void 0===t||null===t);else if(void 0!==s)o=t,a=s,l=o*a;else switch(typeof t){case"object":"d"in t&&"n"in t?(o=t.n,a=t.d,"s"in t&&(o*=t.s)):0 in t?(o=t[0],1 in t&&(a=t[1])):i(),l=o*a;break;case"number":if(0>t&&(l=t,t=-t),t%1===0)o=t;else if(t>0){for(t>=1&&(u=Math.pow(10,Math.floor(1+Math.log(t)/Math.LN10)),t/=u);v>=g&&v>=m;){if(r=(y+f)/(g+m),t===r){v>=g+m?(o=y+f,a=g+m):m>g?(o=f,a=m):(o=y,a=g);break}t>r?(y+=f,g+=m):(f+=y,m+=g),g>v?(o=f,a=m):(o=y,a=g)}o*=u}else(isNaN(t)||isNaN(s))&&(a=o=NaN);break;case"string":if(g=t.match(/\d+|./g),"-"===g[y]?(l=-1,y++):"+"===g[y]&&y++,g.length===y+1?d=e(g[y++],l):"."===g[y+1]||"."===g[y]?("."!==g[y]&&(h=e(g[y++],l)),y++,(y+1===g.length||"("===g[y+1]&&")"===g[y+3]||"'"===g[y+1]&&"'"===g[y+3])&&(d=e(g[y],l),c=Math.pow(10,g[y].length),y++),("("===g[y]&&")"===g[y+2]||"'"===g[y]&&"'"===g[y+2])&&(p=e(g[y+1],l),u=Math.pow(10,g[y+1].length)-1,y+=3)):"/"===g[y+1]||":"===g[y+1]?(d=e(g[y],l),c=e(g[y+2],1),y+=3):"/"===g[y+3]&&" "===g[y+1]&&(h=e(g[y],l),d=e(g[y+2],l),c=e(g[y+4],1),y+=5),g.length<=y){a=c*u,l=o=p+a*h+u*d;break}default:i()}if(0===a)throw"DIV/0";n.s=0>l?-1:1,n.n=Math.abs(o),n.d=Math.abs(a)},a=function(t,e,i){for(var s=1;e>0;t=t*t%i,e>>=1)1&e&&(s=s*t%i);return s},l=function(t,e){for(;e%2===0;e/=2);for(;e%5===0;e/=5);if(1===e)return 0;for(var i=10%e,s=1;1!==i;s++)if(i=10*i%e,s>r)return 0;return s},h=function(t,e,i){for(var s=1,r=a(10,i,e),n=0;300>n;n++){if(s===r)return n;s=10*s%e,r=10*r%e}return 0},d=function(t,e){if(!t)return e;if(!e)return t;for(;;){if(t%=e,!t)return e;if(e%=t,!e)return t}};s.REDUCE=1,s.prototype={s:1,n:0,d:1,abs:function(){return new s(this.n,this.d)},neg:function(){return new s(-this.s*this.n,this.d)},add:function(t,e){return o(t,e),new s(this.s*this.n*n.d+n.s*this.d*n.n,this.d*n.d)},sub:function(t,e){return o(t,e),new s(this.s*this.n*n.d-n.s*this.d*n.n,this.d*n.d)},mul:function(t,e){return o(t,e),new s(this.s*n.s*this.n*n.n,this.d*n.d)},div:function(t,e){return o(t,e),new s(this.s*n.s*this.n*n.d,this.d*n.n)},clone:function(){return new s(this)},mod:function(t,e){return isNaN(this.n)||isNaN(this.d)?new s(NaN):void 0===t?new s(this.s*this.n%this.d,1):(o(t,e),0===n.n&&0===this.d&&s(0,0),new s(this.s*n.d*this.n%(n.n*this.d),n.d*this.d))},gcd:function(t,e){return o(t,e),new s(d(n.n,this.n),n.d*this.d/d(n.d,this.d))},lcm:function(t,e){return o(t,e),0===n.n&&0===this.n?new s:new s(n.n*this.n/d(n.n,this.n),d(n.d,this.d))},ceil:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new s(NaN):new s(Math.ceil(t*this.s*this.n/this.d),t)},floor:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new s(NaN):new s(Math.floor(t*this.s*this.n/this.d),t)},round:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new s(NaN):new s(Math.round(t*this.s*this.n/this.d),t)},inverse:function(){return new s(this.s*this.d,this.n)},pow:function(t){return 0>t?new s(Math.pow(this.s*this.d,-t),Math.pow(this.n,-t)):new s(Math.pow(this.s*this.n,t),Math.pow(this.d,t))},equals:function(t,e){return o(t,e),this.s*this.n*n.d===n.s*n.n*this.d},compare:function(t,e){o(t,e);var i=this.s*this.n*n.d-n.s*n.n*this.d;return(i>0)-(0>i)},divisible:function(t,e){return o(t,e),!(!(n.n*this.d)||this.n*n.d%(n.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(t){var e,i="",s=this.n,r=this.d;return this.s<0&&(i+="-"),1===r?i+=s:(t&&(e=Math.floor(s/r))>0&&(i+=e,i+=" ",s%=r),i+=s,i+="/",i+=r),i},toLatex:function(t){var e,i="",s=this.n,r=this.d;return this.s<0&&(i+="-"),1===r?i+=s:(t&&(e=Math.floor(s/r))>0&&(i+=e,s%=r),i+="\\frac{",i+=s,i+="}{",i+=r,i+="}"),i},toContinued:function(){var t,e=this.n,i=this.d,s=[];do s.push(Math.floor(e/i)),t=e%i,e=i,i=t;while(1!==e);return s},toString:function(){var t,e=this.n,i=this.d;if(isNaN(e)||isNaN(i))return"NaN";s.REDUCE||(t=d(e,i),e/=t,i/=t);for(var r=String(e).split(""),n=0,o=[~this.s?"":"-","",""],a="",p=l(e,i),c=h(e,i,p),u=-1,y=1,g=15+p+c+r.length,f=0;g>f;f++,n*=10){if(f<r.length?n+=Number(r[f]):(y=2,u++),p>0)if(u===c)o[y]+=a+"(",a="";else if(u===p+c){o[y]+=a+")";break}n>=i?(o[y]+=a+(n/i|0),a="",n%=i):y>1?a+="0":o[y]&&(o[y]+="0")}return o[0]+=o[1]||"0",o[2]?o[0]+"."+o[2]:o[0]}},t.Fraction=s}(window),N2D("FormElementSliderType",function(t,e){function i(e){this.element=t("#"+e),this.setAttribute(),this.element.on("nextendChange",t.proxy(this.setAttribute,this))}return i.prototype.setAttribute=function(){var e=this.element.val();t("#n2-admin").data("slider-type",e).attr("data-slider-type",e),"block"===this.element.val()&&t(".n2-fm-shadow").trigger("click")},i}),N2D("FormElementSliderWidgetArea",["FormElement"],function(t,e){function i(e){this.element=t("#"+e),this.area=t("#"+e+"_area"),this.areas=this.area.find(".n2-area"),this.areas.on("click",t.proxy(this.chooseArea,this)),N2Classes.FormElement.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.FormElement.prototype),i.prototype.constructor=i,i.prototype.chooseArea=function(e){var i=parseInt(t(e.target).data("area"));this.element.val(i),this.setSelected(i),this.triggerOutsideChange()},i.prototype.insideChange=function(t){t=parseInt(t),this.element.val(t),this.setSelected(t),this.triggerInsideChange()},i.prototype.setSelected=function(t){this.areas.removeClass("n2-active"),this.areas.eq(t-1).addClass("n2-active")},i}),N2D("FormElementWidgetPosition",function(t,e){function i(e){this.element=t("#"+e+"-mode"),this.container=this.element.closest(".n2-form-element-mixed"),this.tabs=this.container.find("> .n2-mixed-group"),this.element.on("nextendChange",t.proxy(this.onChange,this)),this.onChange()}return i.prototype.onChange=function(){var t=this.element.val();"advanced"===t?(this.tabs.eq(2).css("display",""),this.tabs.eq(1).css("display","none")):(this.tabs.eq(1).css("display",""),this.tabs.eq(2).css("display","none"))},i}),N2D("SmartSliderGeneratorRecords",function(t,e){function i(e){this.ajaxUrl=e,t("#generatorrecord-viewer").on("click",t.proxy(this.showRecords,this))}return i.prototype.showRecords=function(e){
2
- e.preventDefault(),N2Classes.AjaxHelper.ajax({type:"POST",url:this.ajaxUrl,data:t("#smartslider-form").serialize(),dataType:"json"}).done(function(t){var e=new N2Classes.NextendModal({zero:{size:[1300,700],title:"Records",content:t.data.html}},!0);e.content.css("overflow","auto")}).error(function(t){if(200==t.status){var e=new N2Classes.NextendModal({zero:{size:[1300,700],title:"Response",content:t.responseText}},!0);e.content.css("overflow","auto")}})},i}),N2D("QuickSlides",function(t,e){function i(e){var i=t("#n2-quick-slides-edit");i.length<1||(this.ajaxUrl=e,i.on("click",t.proxy(this.openEdit,this)))}return i.prototype.openEdit=function(e){e.preventDefault();var i=t("#n2-ss-slides .n2-box-slide"),s=this;this.modal=new N2Classes.NextendModal({zero:{fit:!0,fitX:!1,overflow:"auto",size:[1200,700],title:n2_("Quick Edit - Slides"),back:!1,close:!0,content:'<form class="n2-form"><table></table></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Save")+"</a>"],fn:{show:function(){var e=this.controls.find(".n2-button-green"),r=this.content.find(".n2-form").on("submit",function(t){t.preventDefault(),e.trigger("click")}),n=r.find("table");i.each(t.proxy(function(e,i){var r=t(i),o=t("<tr />").appendTo(n),a=r.data("slideid");o.append(t("<td />").append('<img src="'+r.data("image")+'" style="width:100px;"/>')),o.append(t("<td />").append(s.createInput(n2_("Name"),"title-"+a,r.data("title"),"width: 240px;"))),o.append(t("<td />").append(s.createTextarea(n2_("Description"),"description-"+a,r.data("description"),"width: 330px;height:24px;")));var l=r.data("link").split("|*|");o.append(t("<td />").append(s.createLink(n2_("Link"),"link-"+a,l[0],"width: 180px;"))),o.append(t("<td />").append(s.createTarget(n2_("Target window"),"target-"+a,l.length>1?l[1]:"_self",""))),new N2Classes.FormElementUrl("link-"+a,nextend.NextendElementUrlParams)},this)),e.on("click",t.proxy(function(e){var r={};i.each(t.proxy(function(e,i){var s=t(i),n=s.data("slideid"),o=t("#title-"+n).val(),a=t("#description-"+n).val(),l=t("#link-"+n).val()+"|*|"+t("#target-"+n).val();o==s.data("title")&&a==s.data("description")&&l==s.data("link")||(r[n]={name:o,description:a,link:l})},this)),jQuery.isEmptyObject(r)?this.hide(e):(this.hide(e),N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(s.ajaxUrl),data:{changed:N2Classes.Base64.encode(JSON.stringify(r))},dataType:"json"}).done(t.proxy(function(e){var i=e.data;for(var s in i){var r=t('.n2-box-slide[data-slideid="'+s+'"]');r.find(".n2-box-placeholder a.n2-h4").html(i[s].title),r.attr("data-title",i[s].rawTitle),r.data("title",i[s].rawTitle),r.attr("data-description",i[s].rawDescription),r.data("description",i[s].rawDescription),r.attr("data-link",i[s].rawLink),r.data("link",i[s].rawLink)}},this)))},this))}}}}),this.modal.setCustomClass("n2-ss-quick-slides-edit-modal"),this.modal.show()},i.prototype.createInput=function(e,i,s){var r="";4==arguments.length&&(r=arguments[3]);var n=t('<div class="n2-form-element-mixed"><div class="n2-mixed-group"><div class="n2-mixed-label"><label for="'+i+'">'+e+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-text n2-border-radius"><input type="text" id="'+i+'" class="n2-h5" autocomplete="off" style="'+r+'"></div></div></div></div>');return n.find("input").val(s),n},i.prototype.createTextarea=function(e,i,s){var r="";4==arguments.length&&(r=arguments[3]);var n=t('<div class="n2-form-element-mixed"><div class="n2-mixed-group"><div class="n2-mixed-label"><label for="'+i+'">'+e+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-textarea n2-border-radius"><textarea id="'+i+'" class="n2-h5" autocomplete="off" style="resize:y;'+r+'"></textarea></div></div></div></div>');return n.find("textarea").val(s),n},i.prototype.createLink=function(e,i,s){var r="";4==arguments.length&&(r=arguments[3]);var n=t('<div class="n2-form-element-mixed"><div class="n2-mixed-group"><div class="n2-mixed-label"><label for="'+i+'">'+e+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-text n2-border-radius"><input type="text" id="'+i+'" class="n2-h5" autocomplete="off" style="'+r+'"><a href="#" class="n2-form-element-clear"><i class="n2-i n2-it n2-i-empty n2-i-grey-opacity"></i></a><a id="'+i+'_button" class="n2-form-element-button n2-h5 n2-uc" href="#">Link</a></div></div></div></div>');return n.find("input").val(s),n},i.prototype.createTarget=function(e,i,s){var r="";4==arguments.length&&(r=arguments[3]);var n=t('<div class="n2-form-element-mixed"><div class="n2-mixed-group"><div class="n2-mixed-label"><label for="'+i+'">'+e+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-list"><select id="'+i+'" autocomplete="off" style="'+r+'"><option value="_self">Self</option><option value="_blank">Blank</option></select></div></div></div></div>');return n.find("select").val(s),n},i}),N2D("Slide",function(t,e){function i(e,i){this.selected=!1,this.manager=e,this.box=i.data("slide",this).addClass("n2-clickable"),this.box.on("mouseenter",t.proxy(function(){this.manager.showMenu(this)},this)).on("mouseleave",t.proxy(function(){this.manager.hideMenu()},this)).on("click.n2-slide",t.proxy(this.goToEdit,this)),this.publishElement=this.box.find(".n2-slide-published").on("click",t.proxy(this.switchPublished,this)),this.box.find(".n2-ss-box-select").on("click",t.proxy(function(t){t.stopPropagation(),t.preventDefault(),this.invertSelection()},this))}return i.prototype.getId=function(){return this.box.data("slideid")},i.prototype.setFirst=function(e){e.stopPropagation(),e.preventDefault(),N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.manager.ajaxUrl,{nextendaction:"first"}),type:"POST",data:{id:this.getId()}}).done(t.proxy(function(){this.manager.unsetFirst(),this.box.addClass("n2-slide-state-first")},this))},i.prototype.unsetFirst=function(){this.box.removeClass("n2-slide-state-first")},i.prototype.switchPublished=function(t){t.stopPropagation(),t.preventDefault(),this.isPublished()?this.manager.unPublishSlides([this.getId()],[this]):this.manager.publishSlides([this.getId()],[this])},i.prototype.isPublished=function(){return this.box.hasClass("n2-slide-state-published")},i.prototype.published=function(){this.box.addClass("n2-slide-state-published")},i.prototype.unPublished=function(){this.box.removeClass("n2-slide-state-published")},i.prototype.goToEdit=function(e,i){if(this.manager.isBulkSelection)this.invertSelection(),e.preventDefault();else if("A"!==e.target.tagName){var s=this.box.data("editurl");"undefined"!=typeof i&&i?window.open(s,"_blank"):s===location.href?t("#n2-admin").toggleClass("n2-ss-slides-outer-container-visible"):window.location=s}},i.prototype.duplicate=function(e){e.stopPropagation(),e.preventDefault();var s=t.Deferred();return N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.box.data("editurl"),{nextendaction:"duplicate"})}).done(t.proxy(function(e){var r=t(e.data).insertAfter(this.box),n=new i(this.manager,r);this.manager.initSlides(),s.resolve(n)},this)),s},i.prototype["delete"]=function(t){t.stopPropagation(),t.preventDefault(),this.manager.deleteSlides([this.getId()],[this])},i.prototype.deleted=function(){this.box.remove()},i.prototype.invertSelection=function(t){t&&t.preventDefault(),this.selected?this.deSelect():this.select()},i.prototype.select=function(){this.selected||(this.selected=!0,this.box.addClass("n2-selected"),this.manager.addSelection(this))},i.prototype.deSelect=function(){this.selected&&(this.selected=!1,this.box.removeClass("n2-selected"),this.manager.removeSelection(this))},i.prototype.publish=function(t){this.switchPublished(t)},i.prototype.unpublish=function(t){this.switchPublished(t)},i.prototype.generator=function(t){window.location=this.box.data("generator")},i.prototype.copy=function(e){this.manager.showSliderSelector(n2_("Copy slide to ..."),t.proxy(function(t){N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.box.data("editurl"),{nextendaction:"copy",targetSliderID:t.sliderID})})},this))},i}),N2D("SlidesManager",function(t,e){function i(i,s,r,n,o,a){this.quickPostModal=null,this.quickVideoModal=null,this.parameters=r,this.slides=[],this.ajaxUrl=i,this.contentAjaxUrl=s,this.slidesPanel=t("#n2-ss-slides-container"),this.slidesContainer=this.slidesPanel.find(".n2-ss-slides-container"),this.initMenu(),this.initSlidesOrderable();for(var l=this.slidesContainer.find(".n2-box-slide"),h=0;h<l.length;h++)this.slides.push(new N2Classes.Slide(this,l.eq(h)));if(t("body").attr("data-slides",this.slides.length),t("#n2-ss-slides").find(".n2-ss-slides-create-action-box").on("mouseup",t.proxy(function(i){i.preventDefault();var s=0;if(i.which!==e&&(s=i.which),2>=s)switch(t(i.currentTarget).data("action")){case"image":this.addQuickImage(i);break;case"video":this.addQuickVideo(i);break;case"post":this.addQuickPost(i);break;case"empty":case"static":case"dynamic":2===s?window.open(t(i.currentTarget).data("href"),"_blank").focus():window.location=t(i.currentTarget).data("href");break;case"library":2===s?window.open(t(i.currentTarget).data("href"),"_blank").focus():window.location=t(i.currentTarget).data("href")}},this)),t(".n2-box-slide-dummy").on("click",t.proxy(this.addQuickImage,this)),this.initBulk(),!n){var d=[];this.slidesContainer.nUIFileUpload({url:o,pasteZone:!1,dataType:"json",paramName:"image",dropZone:t(".n2-ss-slides-outer-container"),add:t.proxy(function(t,e){e.formData={path:"/"+a},e.submit()},this),done:t.proxy(function(t,e){var i=e.result;i.data&&i.data.name?d.push({title:i.data.name.replace(/\.[^\/.]+$/,""),description:"",image:i.data.url}):N2Classes.AjaxHelper.notification(i)},this),fail:t.proxy(function(t,e){N2Classes.AjaxHelper.notification(e.jqXHR.responseJSON)},this),start:function(){N2Classes.AjaxHelper.startLoading()},stop:t.proxy(function(){d.length?this._addQuickImages(d):setTimeout(function(){N2Classes.AjaxHelper.stopLoading()},100),d=[]},this)});var p=null;this.slidesContainer.on("dragover",t.proxy(function(e){null!==p?(clearTimeout(p),p=null):this.slidesContainer.addClass("n2-drag-over"),p=setTimeout(t.proxy(function(){this.slidesContainer.removeClass("n2-drag-over"),p=null},this),400)},this))}}return i.prototype.changed=function(){},i.prototype.initSlidesOrderable=function(){this.slidesContainer.nUISortable({items:".n2-box-slide",stop:t.proxy(this.saveSlideOrder,this),placeholder:"n2-box-sortable-placeholder n2-box-sortable-placeholder-small",distance:10,helper:"clone"})},i.prototype.saveSlideOrder=function(e){for(var i=this.slidesContainer.find(".n2-box-slide"),s=[],r=[],n=[],o=0;o<i.length;o++){var a=i.eq(o).data("slide");s.push(a),r.push(a.getId())}for(var o=0;o<this.slides.length;o++)n.push(this.slides[o].getId());if(JSON.stringify(n)!=JSON.stringify(r)){t(window).triggerHandler("SmartSliderSidebarSlidesOrderChanged");var l={nextendcontroller:"slides",nextendaction:"order"};N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,l),data:{slideorder:r}}),this.slides=s,this.changed()}},i.prototype.initSlides=function(){for(var e=this.slidesContainer.find(".n2-box-slide"),i=[],s=0;s<e.length;s++){var r=e.eq(s).data("slide");i.push(r)}this.slides=i,this.changed(),t(window).triggerHandler("SmartSliderSidebarSlidesChanged"),t("body").attr("data-slides",this.slides.length)},i.prototype.unsetFirst=function(){for(var t=0;t<this.slides.length;t++)this.slides[t].unsetFirst();this.changed()},i.prototype.addQuickImage=function(e){e.preventDefault(),nextend.imageHelper.openMultipleLightbox(t.proxy(this._addQuickImages,this))},i.prototype.addBoxes=function(e){e.insertBefore(this.slidesContainer.find(".n2-clear")),e.addClass("n2-ss-box-just-added").each(t.proxy(function(e,i){new N2Classes.Slide(this,t(i))},this)),this.initSlides(),setTimeout(function(){e.removeClass("n2-ss-box-just-added")},200)},i.prototype._addQuickImages=function(e){for(var i=[],s=0;s<e.length;s++)e[s].image.match(/\.(mp4)/i)?N2Classes.Notification.error("Video is not supported!"):i.push(e[s]);i.length&&N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendaction:"quickImages"}),data:{images:N2Classes.Base64.encode(JSON.stringify(i))}}).done(t.proxy(function(e){this.addBoxes(t(e.data))},this))},i.prototype.addQuickVideo=function(e){e.preventDefault();var i=this;this.quickVideoModal||(this.quickVideoModal=new N2Classes.NextendModal({zero:{size:[500,360],title:n2_("Add video"),back:!1,close:!0,content:'<form class="n2-form"></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Add video")+"</a>"],fn:{show:function(){var e=this.controls.find(".n2-button"),s=(this.content.find(".n2-form").on("submit",function(t){t.preventDefault(),e.trigger("click")}).append(this.createInput(n2_("Video url"),"n2-slide-video-url","width: 446px;")),this.content.find("#n2-slide-video-url").focus());this.content.append(this.createHeading(n2_("Examples"))),this.content.append(this.createTable([["YouTube","https://www.youtube.com/watch?v=lsq09izc1H4"],["Vimeo","https://vimeo.com/144598279"]],["",""])),e.on("click",t.proxy(t.proxy(function(e){e.preventDefault();var r=s.val(),n=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,o=r.match(n),a=/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/,l=r.match(a),h=r.match(/\.(mp4)/i);o?N2Classes.AjaxHelper.getJSON("https://www.googleapis.com/youtube/v3/videos?id="+encodeURI(o[2])+"&part=snippet&key=AIzaSyC3AolfvPAPlJs-2FgyPJdEEKS6nbPHdSM").done(t.proxy(function(t){if(t.items.length){var e=t.items[0].snippet,s=t.items[0].snippet.thumbnails,n=s.maxres||s.standard||s.high||s.medium||s["default"];i._addQuickVideo(this,{type:"youtube",title:e.title,description:e.description,image:n.url,video:r})}},this)).fail(function(t){N2Classes.Notification.error(t.error.errors[0].message)}):l?N2Classes.AjaxHelper.getJSON("https://vimeo.com/api/v2/video/"+l[3]+".json").done(t.proxy(function(t){i._addQuickVideo(this,{type:"vimeo",title:t[0].title,description:t[0].description,video:l[3],image:t[0].thumbnail_large})},this)).fail(function(t){N2Classes.Notification.error("Video not found or private."),i._addQuickVideo(this,{type:"vimeo",title:"",description:"",video:l[3],image:""})}):h?N2Classes.Notification.error(n2_("This video url is not supported!")):N2Classes.Notification.error(n2_("This video url is not supported!"))},this)))}}}})),this.quickVideoModal.show()},i.prototype._addQuickVideo=function(e,i){N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendaction:"quickVideo"}),data:{video:N2Classes.Base64.encode(encodeURIComponent(JSON.stringify(i)))}}).done(t.proxy(function(e){this.addBoxes(t(e.data)),this.initSlides()},this)),e&&e.hide()},i.prototype.addQuickPost=function(e){if(e.preventDefault(),!this.quickPostModal){var i=this,s={},r=t.proxy(function(t){return"undefined"==typeof s[t]&&(s[t]=N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(this.contentAjaxUrl),data:{keyword:t},dataType:"json"})),s[t]},this);this.quickPostModal=new N2Classes.NextendModal({zero:{size:[600,430],title:n2_("Add post"),back:!1,close:!0,content:'<div class="n2-form"></div>',fn:{show:function(){this.content.find(".n2-form").append(this.createInput(n2_("Keyword"),"n2-ss-keyword","width:546px;"));var e=t("#n2-ss-keyword"),s=this.createHeading("").appendTo(this.content),n=this.createResult().appendTo(this.content),o="";e.on("keyup",t.proxy(function(){o=e.val(),r(o).done(t.proxy(function(r){if(e.val()==o){""==o?s.html(n2_("No search term specified. Showing recent items.")):s.html(n2_printf(n2_('Showing items match for "%s"'),o));for(var a=r.data,l=[],h=this,d=0;d<a.length;d++)l.push([a[d].title,a[d].info,t('<div class="n2-button n2-button-normal n2-button-xs n2-button-green n2-radius-s n2-uc n2-h5">'+n2_("Select")+"</div>").on("click",{post:a[d]},function(t){i._addQuickPost(h,t.data.post)})]);n.html(""),this.createTable(l,["width:100%;","",""]).appendTo(this.createTableWrap().appendTo(n))}},this))},this)).trigger("keyup").focus()}}}})}this.quickPostModal.show()},i.prototype._addQuickPost=function(e,i){i.image||(i.image=""),N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendaction:"quickPost"}),data:{post:i}}).done(t.proxy(function(e){this.addBoxes(t(e.data)),this.initSlides()},this)),e.hide()},i.prototype.initBulk=function(){this.selection=[],this.isBulkSelection=!1;var e=t(".n2-bulk-select").find("a");e.eq(0).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.select()})},this)),e.eq(1).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.deSelect()})},this)),e.eq(2).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.box.hasClass("n2-slide-state-published")?t.select():t.deSelect()})},this)),e.eq(3).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.box.hasClass("n2-slide-state-published")?t.deSelect():t.select()})},this)),t(".n2-bulk-actions a").on("click",t.proxy(function(e){var i=t(e.currentTarget).data("action");i&&(e.preventDefault(),this.bulkAction(i))},this))},i.prototype.addSelection=function(t){0==this.selection.length&&this.enterBulk(),this.selection.push(t)},i.prototype.removeSelection=function(e){this.selection.splice(t.inArray(e,this.selection),1),0==this.selection.length&&this.leaveBulk()},i.prototype.bulkSelect=function(t){for(var e=0;e<this.slides.length;e++)t(this.slides[e])},i.prototype.bulkAction=function(t){var e=[],i=[];this.bulkSelect(function(t){t.selected&&(e.push(t),i.push(t.getId()))}),i.length?this[t](i,e):N2Classes.Notification.notice("Please select one or more slides for the action!")},i.prototype.enterBulk=function(){this.isBulkSelection||(this.isBulkSelection=!0,this.slidesContainer.nUISortable("option","disabled",!0),t("#n2-admin").addClass("n2-ss-has-box-selection"))},i.prototype.leaveBulk=function(){if(this.isBulkSelection){this.slidesContainer.nUISortable("option","disabled",!1),t("#n2-admin").removeClass("n2-ss-has-box-selection");for(var e=0;e<this.slides.length;e++)this.slides[e].deSelect();this.selection=[],this.isBulkSelection=!1}},i.prototype.deleteSlides=function(e,i){this.hideMenu();var s=i[0].box.find(".n2-box-placeholder-title a").text();i.length>1&&(s+=" and "+(i.length-1)+" more"),N2Classes.NextendModal.deleteModal("slide-delete",s,t.proxy(function(){N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendaction:"delete"}),type:"POST",data:{slides:e}}).done(t.proxy(function(){for(var t=0;t<i.length;t++)i[t].deleted();this.initSlides(),this.leaveBulk()},this))},this))},i.prototype.duplicateSlides=function(e,i){for(var s=0;s<this.slides.length;s++)this.slides[s].selected&&this.slides[s].duplicate(t.Event("click",{currentTarget:null}))},i.prototype.copySlides=function(e,i){this.showSliderSelector(n2_("Copy slide to ..."),t.proxy(function(t){N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendaction:"copySlides",targetSliderID:t.sliderID}),type:"POST",data:{slides:e}})},this))},i.prototype.publishSlides=function(e,i){N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendaction:"publish"}),type:"POST",data:{slides:e}}).done(t.proxy(function(){for(var t=0;t<i.length;t++)i[t].published();this.changed()},this))},i.prototype.unPublishSlides=function(e,i){N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendaction:"unpublish"}),type:"POST",data:{slides:e}}).done(t.proxy(function(){for(var t=0;t<i.length;t++)i[t].unPublished();this.changed()},this))},i.prototype.initMenu=function(){this.slide=null,this.menu=t("#n2-ss-slide-menu").detach().addClass("n2-inited"),this.menu.find("li").on("click",t.proxy(function(e){e.stopPropagation();var i=t(e.currentTarget).data("action");i&&"function"==typeof this.slide[i]&&this.slide[i](e),this.menu.removeClass("n2-active").off("mouseleave")},this)),this.menu.find(".n2-button").on("click",t.proxy(function(e){e.preventDefault(),e.stopPropagation(),this.menu.hasClass("n2-active")?this.menu.removeClass("n2-active").off("mouseleave"):this.menu.addClass("n2-active").on("mouseleave",function(){t(this).removeClass("n2-active")})},this))},i.prototype.showMenu=function(t){this.slide=t,this.menu.appendTo(t.box)},i.prototype.hideMenu=function(){this.menu.detach()},i.prototype.showSliderSelector=function(e,i){var s=N2Classes.AjaxHelper.makeFallbackUrl(this.ajaxUrl,{nextendcontroller:"sliders",nextendaction:"choose"});this.sliderSelectorModal=new N2Classes.NextendModal({zero:{size:[970,600],title:e,back:!1,close:!0,content:"",fn:{show:function(){var e=t('<iframe src="'+s+'" width="970" height="540" style="margin: 0 -20px 0 -20px;"></iframe>').appendTo(this.content),r=window.addEventListener?"addEventListener":"attachEvent";window[r]("attachEvent"==r?"onmessage":"message",t.proxy(function(t){if(t.source==(e[0].contentWindow||e[0].contentDocument)){var s=t[t.message?"message":"data"];try{s=JSON.parse(s),s.action&&"ss3embed"===s.action&&i(s)}catch(r){}this.hide()}},this),!1)},destroy:function(){this.destroy()}}}},!0)},i}),N2D("SmartSliderSlideBackgroundAdmin",["SmartSliderSlideBackground"],function(t,e){function i(t,e,i){this.types={color:"SmartSliderAdminSlideBackgroundColor",image:"SmartSliderAdminSlideBackgroundImage",video:"SmartSliderAdminSlideBackgroundVideo"},this.allowVisualLoad=!0,this.slider=t.slider,this.editor=nextend.currentEditor,N2Classes.SmartSliderSlideBackground.prototype.constructor.call(this,t,e,i)}return i.prototype=Object.create(N2Classes.SmartSliderSlideBackground.prototype),i.prototype.constructor=i,i.prototype.setVisualLoad=function(t){this.allowVisualLoad=t},i.prototype.setType=function(t){"color"===t?(this.elements.color||this.createColorElement(!0),this.elements.image&&(this.elements.image.kill(),this.elements.image=!1)):"image"===t&&(this.elements.color||this.createColorElement(!0),this.elements.image||this.createImageElement())},i.prototype.setMode=function(t){"default"===t&&(t=this.slider.editor.options.slideBackgroundMode),this.element.attr("data-mode",t),this.elements.image&&this.elements.image.updateMode(t,this.mode),this.mode=t},i.prototype.setFocus=function(t,e){this.elements.image&&this.elements.image.updateFocus(t,e)},i.prototype.setImageOpacity=function(t){this.elements.image&&this.elements.image.updateOpacity(t)},i.prototype.setBlur=function(t){this.elements.image&&this.elements.image.updateBlur(t)},i.prototype.createColorElement=function(e){e=e||!1,this.elements.color=new N2Classes[this.types.color](this,t('<div class="n2-ss-slide-background-color"></div>').appendTo(this.$wrapElement)),e&&this.elements.color.update(this.editor.settings.getBackgroundColor(),this.editor.settings.getBackgroundGradient(),this.editor.settings.getBackgroundColorEnd())},i.prototype.updateColor=function(t,e,i){this.elements.color||this.createColorElement(),this.elements.color.update(t,e,i)},i.prototype.createImageElement=function(){var e=this.editor.settings,i=e.getBackgroundImage();if(""!==i){var s=nextend.imageHelper.fixed(i),r=t('<img src="'+s+'" alt="" />').attr({"data-hash":md5(i),"data-desktop":s,"data-opacity":e.getBackgroundImageOpacity(),"data-blur":e.getBackgroundImageBlur(),"data-x":e.getBackgroundFocusX(),"data-y":e.getBackgroundFocusY()}).appendTo(this.$wrapElement);this.elements.image=new N2Classes[this.types.image](this.slide,this.manager,this,r),this.elements.image.preLoadAdmin(i)}},i.prototype.setImage=function(t){this.elements.image?this.elements.image.setDesktopSrc(t):""!==t&&"image"===this.editor.settings.getType()&&this.createImageElement(t)},i}),N2D("EditorAbstract",function(t,e){function i(e,i,r){s(),this.readyDeferred=t.Deferred(),this.sliderElementID=e,this.slideContentElementID=i,this.readyDeferred.done(t.proxy(function(){N2D("SSEditor",t.proxy(function(){return this},this))},this)),this.options=t.extend({slideAsFile:0,isUploadDisabled:!0,uploadUrl:"",uploadDir:""},r),nextend.currentEditor=this,this.frontend=null,this.generator=null,this.fragmentEditor=null,this.$editedElement=null,this.editedInstance=null,N2R("documentReady",t.proxy(function(t){"undefined"!=typeof nextend.fontsDeferred?nextend.fontsDeferred.done(t.proxy(this.startEditor,this)):this.startEditor()},this))}function s(){var t=r();t&&10>t&&alert(window.ss2lang.The_editor_was_tested_under_Internet_Explorer_10_Firefox_and_Chrome_Please_use_one_of_the_tested_browser)}function r(){var t=navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):!1}return i.prototype.startEditor=function(){},i.prototype.ready=function(t){this.readyDeferred.done(t)},i.prototype.getSelf=function(){return this},i.prototype.getAvailableDeviceModes=function(){return{desktopPortrait:1,desktopLandscape:0,tabletPortrait:1,tabletLandscape:1,mobilePortrait:1,mobileLandscape:1}},i.prototype.getGeneratorVariables=function(){return this.$editedElement.data("variables")},i.prototype.getMainContainerElement=function(){return this.$editedElement.find(".n2-ss-layers-container").addBack().last()},i}),N2D("EditorSlide",["EditorAbstract"],function(t,e){function i(e,i,s){N2Classes.EditorAbstract.prototype.constructor.call(this,e,i,t.extend({isAddSample:!1,sampleSlidesUrl:"",slideBackgroundMode:"fill"},s))}return i.prototype=Object.create(N2Classes.EditorAbstract.prototype),i.prototype.constructor=i,i.prototype.startEditor=function(){this.$slideContentElement=t("#"+this.slideContentElementID),this.slideStartValue=this.$slideContentElement.val(),N2R("#"+this.sliderElementID,t.proxy(function(t,e){this.frontend=e,this.frontend.editor=this,nextend.pre="div#"+this.frontend.elementID+" ",this.frontend.visible(t.proxy(this.sliderStarted,this))},this))},i.prototype.sliderStarted=function(){t("body").addClass("n2-ss-slider-visible");var e=t("#n2-ss-slide-canvas-container"),i=e.tinyscrollbar({axis:"x",wheel:!1,wheelLock:!1}).data("plugin_tinyscrollbar");"function"==typeof e.get(0).move&&(e.get(0).move=null),this.frontend.sliderElement.on("SliderResize",function(){i.update("relative")}),this.$editedElement=this.frontend.sliderElement.find(".n2-ss-currently-edited-slide"),this.editedInstance=this.$editedElement.data("slide");var s=this.$editedElement.hasClass("n2-ss-static-slide");this.generator=new N2Classes.Generator(this),this.generator.registerFields(["#slidetitle","#sldedescription","#slidethumbnail","#slidebackgroundImage","#slidebackgroundAlt","#slidebackgroundTitle","#slidebackgroundVideoMp4","#slidebackgroundColor","#slidebackgroundColorEnd","#slidehref","#layergenerator-visible","#layergroup-generator-visible"]),this.generator.registerGlobalField("slide","name","#slidetitle"),this.generator.registerGlobalField("slide","description","#slidedescription"),this.getMainContainerElement().on("updateSize",t.proxy(this.updateSize,this)),this.settings=new N2Classes.SlideSettings(this,s);var r={};s?r.snapSelector=".n2-ss-static-slide .n2-ss-layer.nui-resizable:not(.n2-ss-layer-locked):not(.n2-ss-layer-parent):not(.n2-ss-layer-selected):visible, .n2-ruler-user-guide":r.snapSelector=".n2-ss-slide.n2-ss-slide-active .n2-ss-layer.nui-resizable:not(.n2-ss-layer-locked):not(.n2-ss-layer-parent):not(.n2-ss-layer-selected):visible, .n2-ruler-user-guide",this.fragmentEditor=new N2Classes.FragmentEditor(this,this.getFrontendSlide().$element,r,this.options),this.getFrontendElement().on({SliderResize:t.proxy(this.fragmentEditor.onResize,this.fragmentEditor),SliderDeviceOrientation:t.proxy(this.fragmentEditor.onChangeDeviceOrientation,this.fragmentEditor)}),this.readyDeferred.resolve(),t("#smartslider-form").on({checkChanged:t.proxy(this.prepareFormForCheck,this),submit:t.proxy(this.onSlideSubmit,this)}),this.options.isAddSample&&this.startSampleSlides()},i.prototype.prepareFormForCheck=function(){var t=JSON.stringify(this.fragmentEditor.getData()),e=JSON.stringify(JSON.parse(N2Classes.Base64.decode(this.slideStartValue)));this.$slideContentElement.val(e==t?this.slideStartValue:N2Classes.Base64.encode(t))},i.prototype.onSlideSubmit=function(i){if(!nextend.isPreview)if(this.prepareForm(),i.preventDefault(),nextend.askToSave=!1,this.options.slideAsFile&&typeof window.FormData!==e&&"undefined"!=typeof window.File){var s=new FormData,r=t("#smartslider-form").serializeArray();t.each(r,function(t,e){if("slide[slide]"==e.name)try{s.append("slide",new Blob([e.value]),"slide.txt")}catch(i){try{s.append("slide",new Blob([e.value]))}catch(i){try{s.append("slide",new File([e.value],"slide.txt"))}catch(i){N2Classes.Notification.notice('Your browser does not support File api, please disable "Send slide as file" option in the global settings.')}}}else s.append(e.name,e.value)}),N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(window.location.href),type:"POST",data:s,contentType:!1,processData:!1}).done(t.proxy(this.afterSave,this))}else N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(window.location.href),data:t("#smartslider-form").serialize(),dataType:"json"}).done(t.proxy(this.afterSave,this))},i.prototype.afterSave=function(){nextend.askToSave=!0,t("#smartslider-form").trigger("saved"),t(".n2-ss-edit-slide-top-details .n2-h1").text(t("#slidetitle").val())},i.prototype.prepareForm=function(){this.fragmentEditor.canvasSettings.ruler&&t("#slideguides").val(N2Classes.Base64.encode(JSON.stringify(this.fragmentEditor.canvasSettings.ruler.toArray()))),this.$slideContentElement.val(N2Classes.Base64.encode(nextend.UnicodeToHTMLEntity(JSON.stringify(this.fragmentEditor.getData()))))},i.prototype.getLayout=function(){for(var e=t("#smartslider-form").serializeArray(),i={},s=0;s<e.length;s++){var r=e[s].name.match(/slide\[(.*?)\]/);r&&(i[r[1]]=e[s].value)}return delete i.generator,delete i.published,delete i.publishdates,delete i["record-start"],delete i["record-slides"],delete i.slide,i.slide=this.fragmentEditor.getData(),i},i.prototype.loadLayout=function(e,i,s){var r=e.slide;if(delete e.slide,s?this.fragmentEditor.importLayers(r,!0):this.fragmentEditor.importLayers(r,!1),i)for(var n in e)t("#slide"+n).val(e[n]).trigger("change");e.slide=r},i.prototype.copy=function(){var e={data:this.settings.getBackgroundData(),layers:this.fragmentEditor.getData()};t.jStorage.set("copiedSlide",JSON.stringify(e))},i.prototype.paste=function(){var e=t.jStorage.get("copiedSlide");e&&(e=JSON.parse(e),this.settings.setData(e.data),this.fragmentEditor.mainContainer.replaceLayers(e.layers))},i.prototype.hasClipboard=function(){var e=t.jStorage.get("copiedSlide");return!!e},i.prototype.startSampleSlides=function(){var i=this,s=window.addEventListener?"addEventListener":"attachEvent",r=t('<iframe src="'+this.options.sampleSlidesUrl+'"></iframe>').prependTo(".n2-ss-sample-slides-container"),n=r[0];t("html, body").scrollTop(r.offset().top-t("#wpadminbar").height());var o=t(".n2-ss-sample-slide-settings"),a=t("#slidebackground-type"),l=t("#slidebackgroundImage"),h=t("#n2-ss-sample-slide-setting-background-image").on("click",function(){l.parent().find(".n2-form-element-button").trigger("click")}),d=function(){var t=l.val();""===t?(o.removeClass("n2-ss-has-image"),h.css("background-image","url("+nextend.imageHelper.fixed("$system$/images/placeholder/image.png")+")"),"color"!==a.val()&&a.val("color").trigger("change")):(o.addClass("n2-ss-has-image"),"image"!==a.val()&&a.val("image").trigger("change"),h.css("background-image","url("+nextend.imageHelper.fixed(t)+")"))};h.find(".n2-i-close").on("click",function(t){t.stopPropagation(),l.parent().find(".n2-form-element-clear").trigger("click")}),l.on("nextendChange",d),d();var p=t("#slidebackgroundImageOpacity"),c=t("#n2-ss-sample-slide-setting-opacity-slider").removeAttr("slide").prop("slide",!1).nUISlider({
3
- min:0,max:100,step:1,slide:function(t,e){p.data("field").insideChange(e.value)}}),u=function(t){c.nUISlider("option","value",p.val())};p.on("nextendChange",u),u();var y=t("#slidebackgroundImageBlur"),g=t("#n2-ss-sample-slide-setting-blur-slider").removeAttr("slide").prop("slide",!1).nUISlider({min:0,max:40,step:1,slide:function(t,e){y.data("field").insideChange(e.value)}}),f=function(t){g.nUISlider("option","value",y.val())};y.on("nextendChange",f),f();var m=t("#slidebackgroundColor"),v=t("#n2-ss-sample-slide-setting-color").n2spectrum({showAlpha:1,preferredFormat:"hex8",showInput:!1,showButtons:!1,move:function(){var t=v.n2spectrum("get").toHexString8();v.val(t),m.data("field").insideChange(t)},showSelectionPalette:!0,showPalette:!0,maxSelectionSize:6,localStorageKey:"color",palette:[["000000","55aa39","357cbd","bb4a28","8757b2","000000CC"],["81898d","5cba3c","4594e1","d85935","9e74c2","00000080"],["ced3d5","27ae60","01add3","e79d19","e264af","FFFFFFCC"],["ffffff","2ecc71","00c1c4","ecc31f","ec87c0","FFFFFF80"]]}),b=function(t){var e=m.val();e!=v.val()&&v.n2spectrum("set",e)};m.on("nextendChange",b),b();var C=t("#slidebackgroundGradient"),x=function(){"off"==C.val()?o.removeClass("n2-ss-has-gradient"):o.addClass("n2-ss-has-gradient")};C.on("nextendChange",x),x();var w=t("#slidebackgroundColorEnd"),S=t("#n2-ss-sample-slide-setting-gradient").n2spectrum({showAlpha:1,preferredFormat:"hex8",showInput:!1,showButtons:!1,move:function(){var t=S.n2spectrum("get").toHexString8();w.data("field").insideChange(t)},showSelectionPalette:!0,showPalette:!0,maxSelectionSize:6,localStorageKey:"color",palette:[["000000","55aa39","357cbd","bb4a28","8757b2","000000CC"],["81898d","5cba3c","4594e1","d85935","9e74c2","00000080"],["ced3d5","27ae60","01add3","e79d19","e264af","FFFFFFCC"],["ffffff","2ecc71","00c1c4","ecc31f","ec87c0","FFFFFF80"]]}),P=function(t){S.n2spectrum("set",w.val())};w.on("outsideChange",P),P(),window[s]("attachEvent"==s?"onmessage":"message",function(t){if(t.source==(n.contentWindow||n.contentDocument)){var s=t[t.message?"message":"data"];if(s.key)switch(s.key){case"sampleSlide":var r=JSON.parse(s.data);i.settings.setData(r.data,!0),i.fragmentEditor.mainContainer.replaceLayers(r.layers),"content"!=i.fragmentEditor.currentEditorMode&&i.fragmentEditor.mainContent!=e&&i.fragmentEditor.updateEditorMode("content");break;case"ready":(n.contentWindow||n.contentDocument).postMessage({key:"ackReady"},"*"),i.options.isAddSample&&((n.contentWindow||n.contentDocument).postMessage({key:"create"},"*"),i.options.isAddSample=!1)}}},!1)},i.prototype.getAvailableDeviceModes=function(){return this.frontend.responsive.parameters.deviceModes},i.prototype.getSlideBackground=function(){return this.$editedElement.data("slideBackground")},i.prototype.getFrontendElement=function(){return this.frontend.sliderElement},i.prototype.getFrontendSlide=function(){return this.editedInstance},i.prototype.getHorizontalRatio=function(){return this.frontend.responsive.lastRatios.slideW},i.prototype.getVerticalRatio=function(){return this.frontend.responsive.lastRatios.slideH},i.prototype.updateSize=function(){return this.frontend.responsive.doVerticalResize()},i.prototype.getDeviceMode=function(){return this.frontend.responsive.getNormalizedModeString()},i}),N2D("Generator",["EditorAbstract"],function(t,e){"use strict";function i(e){this.editor=e,this._refreshTimeout=null,this.modal=!1,this.group=0,this.editor.generator=this;var i=this.editor.getGeneratorVariables();if(i){this.variables=i;for(var s in this.variables)!isNaN(parseFloat(s))&&isFinite(s)&&(this.group=Math.max(this.group,parseInt(s)+1));this.fill=this.generatorFill,this.group>0&&(this.registerField=this.generatorRegisterField,this.button=t('<a href="#" class="n2-button n2-button-normal n2-button-xs n2-radius-s n2-button-blue n2-h5 n2-uc" style="position:absolute;right: -2px;top: -18px;">Variable</a>').on("click",t.proxy(function(t){t.preventDefault(),this.showModal()},this)),t("body").addClass("n2-ss-dynamic-slide"))}else this.variables=null}return i.prototype.isDynamicSlide=function(){return this.group>0},i.prototype.splitTokens=function(t){for(var e=[],i="",s=0,r=0;r<t.length;r++){var n=t[r];","===n&&0===s?(e.push(i),i=""):(i+=n,"("===n?s++:")"===n&&s--)}return i.length&&e.push(i),e},i.prototype.fill=function(t){return t},i.prototype.generatorFill=function(e){return e.replace(/{((([a-z]+)\(([^}]+)\))|([a-zA-Z0-9][a-zA-Z0-9_\/]*))}/g,t.proxy(this.parseFunction,this))},i.prototype.parseFunction=function(t,e,i,s,r,n){if("undefined"==typeof n){for(var o=this.splitTokens(r),a=0;a<o.length;a++)o[a]=this.parseVariable(o[a]);return"function"==typeof this[s]?this[s].apply(this,o):t}return this.parseVariable(n)},i.prototype.parseVariable=function(t){var e=t.match(/^("|')(.*)("|')$/);if(e)return e[2];var i=t.match(/((([a-z]+)\(([^}]+)\)))/);if(i)return this.parseFunction.apply(this,i);var s=t.match(/([a-zA-Z][0-9a-zA-Z_]*)(\/([0-9a-z]+))?/);if(s){var r=s[3];if("undefined"==typeof r)r=0;else{var n=parseInt(r);isNaN(n)||(r=Math.max(r,1)-1)}return"undefined"!=typeof this.variables[r]&&"undefined"!=typeof this.variables[r][s[1]]?this.variables[r][s[1]]:""}return t},i.prototype.fallback=function(t,e){return""==t?e:t},i.prototype.cleanhtml=function(t){return this.stripTags(t,"<p><a><b><br /><br/><i>")},i.prototype.stripTags=function(t,e){e=(((e||"")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join("");var i=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,s=/<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;return t.replace(s,"").replace(i,function(t,i){return e.indexOf("<"+i.toLowerCase()+">")>-1?t:""})},i.prototype.removehtml=function(e){return t("<div>"+e+"</div>").text()},i.prototype.splitbychars=function(t,e,i){return t.substr(e,i)},i.prototype.splitbywords=function(t,e,i){var s=t,r=s.length,n=Math.max(0,0==e?0:s.indexOf(" ",e)),o=Math.max(0,i>r?r:s.indexOf(" ",i));return 0==o&&r>=i&&(o=r),s.substr(n,o)},i.prototype.findimage=function(t,e){var i=t,s=/(<img.*?src=[\'"](.*?)[\'"][^>]*>)|(background(-image)??\s*?:.*?url\((["|\']?)?(.+?)(["|\']?)?\))/gi,r=[],n=null;for(e="undefined"!=typeof e?parseInt(e)-1:0;n=s.exec(i);)"undefined"!=typeof n[2]?r.push(n[2]):"undefined"!=typeof n[6]&&r.push(n[6]);return r.length?r.length>e?r[e]:r[r.length-1]:""},i.prototype.findlink=function(t,e){var i=t,s=/href=["\']?([^"\'>]+)["\']?/gi,r=[],n=null;for(e="undefined"!=typeof e?parseInt(e)-1:0;n=s.exec(i);)"undefined"!=typeof n[1]&&r.push(n[1]);return r.length?r.length>e?r[e]:r[r.length-1]:""},i.prototype.removevarlink=function(t){var e=String(t),i=/<a href=\"(.*?)\">(.*?)<\/a>/g;return e.replace(i,"")},i.prototype.removelinebreaks=function(t){var e=String(t),i=/\r?\n|\r/g;return e.replace(i,"")},i.prototype.registerFields=function(t){for(var e=0;e<t.length;e++)this.registerField(t[e])},i.prototype.registerGlobalField=function(e,i,s){null!==this.variables&&(s=t(s).on("nextendChange",t.proxy(function(){this.variables[e][i]=s.val(),this.refresh()},this)))},i.prototype.registerField=function(t){},i.prototype.generatorRegisterField=function(e){e=t(e);var i=e.parent();i.on({mouseenter:t.proxy(function(){this.activeField=e,this.button.prependTo(i)},this)})},i.prototype.getModal=function(){var e=this;if(!this.modal){var i={key:"",group:1,filter:"no",split:"no",splitStart:0,splitLength:300,findImage:0,findImageIndex:1,findLink:0,findLinkIndex:1,removeVarLink:0,removelinebreaks:0},s=function(){var t=i.key+"/"+i.group;return i.findImage&&(t="findimage("+t+","+Math.max(1,i.findImageIndex)+")"),i.findLink&&(t="findlink("+t+","+Math.max(1,i.findLinkIndex)+")"),i.removeVarLink&&(t="removevarlink("+t+")"),i.removelinebreaks&&(t="removelinebreaks("+t+")"),"no"!=i.filter&&(t=i.filter+"("+t+")"),"no"!=i.split&&i.splitStart>=0&&i.splitLength>0&&(t=i.split+"("+t+","+i.splitStart+","+i.splitLength+")"),"{"+t+"}"},r=t('<div class="n2-generator-result-container" />'),n=function(){r.html(t("<div/>").text(e.fill(s())).html())},o=e.group,a=null,l=null,h=t('<div class="n2-generator-insert-variable"/>'),d=N2Classes.NextendModal.prototype.createHeading(n2_("Choose the group")).appendTo(h),p=t('<div class="n2-group-container" />').appendTo(h);h.append(N2Classes.NextendModal.prototype.createHeading(n2_("Choose the variable")));var c=t('<div class="n2-variable-container webkit-scroll-fix" />').appendTo(h),u=t('<div class="n2-generator-functions-container n2-form-element-mixed" />').appendTo(t('<div class="n2-form" />').appendTo(h));h.append(N2Classes.NextendModal.prototype.createHeading(n2_("Result"))),r.appendTo(h),t('<div class="n2-mixed-group"><div class="n2-mixed-label"><label>'+n2_("Filter")+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-list"><select autocomplete="off" name="filter" id="n2-generator-function-filter"><option selected="selected" value="no">'+n2_("No")+'</option><option value="cleanhtml">'+n2_("Clean HTML")+'</option><option value="removehtml">'+n2_("Remove HTML")+"</option></select></div></div></div>").appendTo(u);var y=u.find("#n2-generator-function-filter");y.on("change",t.proxy(function(){i.filter=y.val(),n()},this)),t('<div class="n2-mixed-group"><div class="n2-mixed-label"><label>'+n2_("Split by chars")+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-list"><select autocomplete="off" name="split" id="n2-generator-function-split"><option selected="selected" value="no">'+n2_("No")+'</option><option value="splitbychars">'+n2_("Strict")+'</option><option value="splitbywords">'+n2_("Respect words")+'</option></select></div><div class="n2-form-element-text n2-text-has-unit n2-border-radius"><div class="n2-text-sub-label n2-h5 n2-uc">'+n2_("Start")+'</div><input type="text" autocomplete="off" style="width: 22px;" class="n2-h5" value="0" id="n2-generator-function-split-start"></div><div class="n2-form-element-text n2-text-has-unit n2-border-radius"><div class="n2-text-sub-label n2-h5 n2-uc">'+n2_("Length")+'</div><input type="text" autocomplete="off" style="width: 22px;" class="n2-h5" value="300" id="n2-generator-function-split-length"></div></div></div>').appendTo(u);var g=u.find("#n2-generator-function-split");g.on("change",t.proxy(function(){i.split=g.val(),n()},this));var f=u.find("#n2-generator-function-split-start");f.on("change",t.proxy(function(){i.splitStart=parseInt(f.val()),n()},this));var m=u.find("#n2-generator-function-split-length");m.on("change",t.proxy(function(){i.splitLength=parseInt(m.val()),n()},this)),t('<div class="n2-mixed-group"><div class="n2-mixed-label"><label>'+n2_("Find image")+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-onoff"><div class="n2-onoff-slider"><div class="n2-onoff-yes"><i class="n2-i n2-i-tick"></i></div><div class="n2-onoff-round"></div><div class="n2-onoff-no"><i class="n2-i n2-i-close"></i></div></div><input type="hidden" autocomplete="off" value="0" id="n2-generator-function-findimage"></div><div class="n2-form-element-text n2-text-has-unit n2-border-radius"><div class="n2-text-sub-label n2-h5 n2-uc">'+n2_("Index")+'</div><input type="text" autocomplete="off" style="width: 22px;" class="n2-h5" value="1" id="n2-generator-function-findimage-index"></div></div></div>').appendTo(u);var v=u.find("#n2-generator-function-findimage");v.on("nextendChange",t.proxy(function(){i.findImage=parseInt(v.val()),n()},this));var b=u.find("#n2-generator-function-findimage-index");b.on("change",t.proxy(function(){i.findImageIndex=parseInt(b.val()),n()},this)),t('<div class="n2-mixed-group"><div class="n2-mixed-label"><label>'+n2_("Find link")+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-onoff"><div class="n2-onoff-slider"><div class="n2-onoff-yes"><i class="n2-i n2-i-tick"></i></div><div class="n2-onoff-round"></div><div class="n2-onoff-no"><i class="n2-i n2-i-close"></i></div></div><input type="hidden" autocomplete="off" value="0" id="n2-generator-function-findlink"></div><div class="n2-form-element-text n2-text-has-unit n2-border-radius"><div class="n2-text-sub-label n2-h5 n2-uc">'+n2_("Index")+'</div><input type="text" autocomplete="off" style="width: 22px;" class="n2-h5" value="1" id="n2-generator-function-findlink-index"></div></div></div>').appendTo(u);var C=u.find("#n2-generator-function-findlink");C.on("nextendChange",t.proxy(function(){i.findLink=parseInt(C.val()),n()},this));var x=u.find("#n2-generator-function-findlink-index");x.on("change",t.proxy(function(){i.findLinkIndex=parseInt(x.val()),n()},this)),t('<div class="n2-mixed-group"><div class="n2-mixed-label"><label>'+n2_("Remove links")+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-onoff"><div class="n2-onoff-slider"><div class="n2-onoff-yes"><i class="n2-i n2-i-tick"></i></div><div class="n2-onoff-round"></div><div class="n2-onoff-no"><i class="n2-i n2-i-close"></i></div></div><input type="hidden" autocomplete="off" value="0" id="n2-generator-function-removevarlink"></div></div></div>').appendTo(u);var w=u.find("#n2-generator-function-removevarlink");w.on("nextendChange",t.proxy(function(){i.removeVarLink=parseInt(w.val()),n()},this));var S=u.find("#n2-generator-function-removevarlink-index");S.on("change",t.proxy(function(){i.removeVarLinkIndex=parseInt(S.val()),n()},this)),t('<div class="n2-mixed-group"><div class="n2-mixed-label"><label>'+n2_("Remove line breaks")+'</label></div><div class="n2-mixed-element"><div class="n2-form-element-onoff"><div class="n2-onoff-slider"><div class="n2-onoff-yes"><i class="n2-i n2-i-tick"></i></div><div class="n2-onoff-round"></div><div class="n2-onoff-no"><i class="n2-i n2-i-close"></i></div></div><input type="hidden" autocomplete="off" value="0" id="n2-generator-function-removelinebreaks"></div></div></div>').appendTo(u);var P=u.find("#n2-generator-function-removelinebreaks");P.on("nextendChange",t.proxy(function(){i.removelinebreaks=parseInt(P.val()),n()},this));var k=u.find("#n2-generator-function-removelinebreaks-index");k.on("change",t.proxy(function(){i.removelinebreaksIndex=parseInt(k.val()),n()},this));for(var N in this.variables[0])t('<a href="#" class="n2-button n2-button-normal n2-button-s n2-button-grey n2-radius-s">'+N+"</a>").on("click",t.proxy(function(e,s){s.preventDefault(),a.removeClass("n2-active"),t(s.currentTarget).addClass("n2-active"),i.key=e,n()},this,N)).appendTo(c);a=c.find("a"),a.eq(0).trigger("click"),1==o&&(d.css("display","none"),p.css("display","none"));for(var L=0;o>L;L++)t('<a href="#" class="n2-button n2-button-normal n2-button-s n2-button-grey n2-radius-s">'+(L+1)+"</a>").on("click",t.proxy(function(e,s){s.preventDefault(),l.removeClass("n2-active"),t(s.currentTarget).addClass("n2-active"),i.group=e+1,n()},this,L)).appendTo(p);l=p.find("a"),l.eq(0).trigger("click");var _=!1;this.modal=new N2Classes.NextendModal({zero:{size:[1e3,o>1?670:600],title:n2_("Insert variable"),back:!1,close:!0,content:h,controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green">'+n2_("Insert")+"</a>"],fn:{show:function(){_||(new N2Classes.FormElementOnoff("n2-generator-function-findimage"),new N2Classes.FormElementOnoff("n2-generator-function-findlink"),new N2Classes.FormElementOnoff("n2-generator-function-removevarlink"),new N2Classes.FormElementOnoff("n2-generator-function-removelinebreaks"),_=!0),this.controls.find(".n2-button").on("click",t.proxy(function(t){t.preventDefault(),e.insert(s()),this.hide(t)},this))}}}},!1),this.modal.setCustomClass("n2-ss-generator-modal")}return this.modal},i.prototype.showModal=function(){this.getModal().show()},i.prototype.insert=function(t){this.activeField.val(t).trigger("change")},i.prototype.refresh=function(){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),this._refreshTimeout=setTimeout(t.proxy(this._refresh,this),100)},i.prototype._refresh=function(){for(var t=this.editor.fragmentEditor.mainContainer.container.getAllLayers(),e=0;e<t.length;e++)"layer"==t[e].type&&t[e].item.reRender()},i}),N2D("History",function(t,e){"use strict";function i(){this.historyStates=50,this.enabled=0!=this.historyStates,this.historyAddAllowed=!0,this.isBatched=!1,this.currentBatch=this,this.index=-1,this.stackedOff=[],this.tasks=[],this.preventUndoRedo=!1,this.undoBTN=t("#n2-ss-undo").on({click:t.proxy(this.undo,this),mousedown:function(t){N2Classes.WindowManager.get().setMouseDownArea("undo",t)}}),this.redoBTN=t("#n2-ss-redo").on({click:t.proxy(this.redo,this),mousedown:function(t){N2Classes.WindowManager.get().setMouseDownArea("redo",t)}}),this.updateUI()}function s(t){this.parent=t,this.tasks=[]}function r(t){switch(t){case"skipForwardUndos":this.undo=function(){return!1}}}function n(t,e,i,s){this.that=t,this.undoAction=e,this.redoAction=i,this.context=s||[]}function o(){n.prototype.constructor.apply(this,arguments)}return i.get=function(){var t=new i;return i.get=function(){return t},t},i.prototype.updateUI=function(){0==this.index||0==this.tasks.length?this.undoBTN.removeClass("n2-active"):this.undoBTN.addClass("n2-active"),-1==this.index||this.index>=this.tasks.length?this.redoBTN.removeClass("n2-active"):this.redoBTN.addClass("n2-active")},i.prototype.throttleUndoRedo=function(){return this.preventUndoRedo?!0:(this.preventUndoRedo=!0,setTimeout(t.proxy(function(){this.preventUndoRedo=!1},this),100),!1)},i.prototype.isEnabled=function(){return this.enabled&&this.historyAddAllowed},i.prototype.startBatch=function(){if(this.isEnabled()){var t=new s(this.currentBatch);return this.currentBatch._add(t),this.currentBatch=t,t}return!1},i.prototype.endBatch=function(){this.isEnabled()&&(this.currentBatch.parent==e,this.currentBatch=this.currentBatch.parent)},i.prototype.addControl=function(t){return this.currentBatch._add(new r(t))},i.prototype.addSimple=function(t,e,i,s){return this.isEnabled()?this.currentBatch._add(new n(t,e,i,s)):!1},i.prototype.addValue=function(t,e,i){if(this.isEnabled()){if(this.isBatched||this.currentBatch!=this)for(var s=this.getCurrentBatchStack(),r=0;r<s.length;r++)if(s[r].isEqual(t,e,i))return s.push(s.splice(r,1)[0]),s[s.length-1];return this.currentBatch._add(new o(t,e,e,i))}return!1},i.prototype.getCurrentBatchStack=function(){return this.currentBatch!=this?this.currentBatch.tasks:this.tasks[this.tasks.length-1]},i.prototype._add=function(e){return-1!=this.index&&this.tasks.splice(this.index,this.tasks.length),this.index=-1,this.isBatched?this.tasks[this.tasks.length-1].push(e):(this.tasks.push([e]),this.isBatched=!0,setTimeout(t.proxy(function(){this.isBatched=!1},this),100)),this.tasks.length>this.historyStates&&this.tasks.unshift(),this.updateUI(),e},i.prototype.off=function(){this.historyAddAllowed=!1,this.stackedOff.push(1)},i.prototype.on=function(){this.stackedOff.pop(),0==this.stackedOff.length&&(this.historyAddAllowed=!0)},i.prototype.undo=function(t){if(t&&t.preventDefault(),this.throttleUndoRedo())return!1;if(this.off(),-1==this.index?this.index=this.tasks.length-1:this.index--,this.index>=0)for(var e=this.tasks[this.index],i=e.length-1;i>=0&&e[i].undo();i--);else this.index=0;return this.on(),this.updateUI(),!0},i.prototype.redo=function(t){if(t&&t.preventDefault(),this.throttleUndoRedo())return!1;if(this.off(),-1!=this.index&&this.index<this.tasks.length){var e=this.tasks[this.index];this.index++;for(var i=0;i<e.length&&e[i].redo();i++);}return this.on(),this.updateUI(),!0},s.prototype._add=function(t){return this.tasks.push(t),t},s.prototype.invertUndo=function(){return this.undo=function(){for(var t=this.tasks.length-1;t>=0&&this.tasks[t].undo();t--);return!0},this},s.prototype.undo=function(){for(var t=0;t<this.tasks.length&&this.tasks[t].undo();t++);return!0},s.prototype.redo=function(){for(var t=0;t<this.tasks.length&&this.tasks[t].redo();t++);return!0},s.prototype.isEqual=function(){return!1},r.prototype.undo=function(){return!0},r.prototype.redo=function(){return!0},r.prototype.isEqual=function(){return!1},n.prototype.undo=function(){return this.undoAction.apply(this.that.getSelf(),this.context),!0},n.prototype.redo=function(){return this.redoAction.apply(this.that.getSelf(),this.context),!0},n.prototype.isEqual=function(){return!1},o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.prototype.setValues=function(t,e){this.undoValue=t,this.redoValue=e},o.prototype.undo=function(){return this.context.unshift(this.undoValue),this.undoAction.apply(this.that.getSelf(),this.context),this.context.shift(),!0},o.prototype.redo=function(){return this.context.unshift(this.redoValue),this.redoAction.apply(this.that.getSelf(),this.context),this.context.shift(),!0},o.prototype.isEqual=function(t,e,i){if(t==this.that&&e==this.undoAction){for(var s=0;s<i.length;s++)if(i[s]!=this.context[s])return!1;return this.setValues=function(t,e){this.redoValue=e},!0}return!1},i}),N2D("InlineField",function(t,e){function i(){this.$input=t('<input type="text" name="name" />').on({mouseup:function(t){t.stopPropagation()},keyup:t.proxy(function(t){27==t.keyCode&&this.cancel()},this),blur:t.proxy(this.save,this)}),this.$form=t('<form class="n2-inline-form"></form>').append(this.$input).on("submit",t.proxy(this.save,this))}return i.prototype.injectNode=function(t,e){this.$input.val(e),t.append(this.$form),this.$input.focus()},i.prototype.save=function(t){t.preventDefault(),this.$input.trigger("valueChanged",[this.$input.val()]),this.$input.off("blur"),this.destroy()},i.prototype.cancel=function(){this.$input.trigger("cancel"),this.destroy()},i.prototype.destroy=function(){this.$input.off("blur"),this.$form.remove()},i}),N2D("SlideSettings",function(t,e){"use strict";function i(e,i){this.editor=e,this.isStatic=i;var s=t("#smartslider-form").find('input[id][name^="slide"], textarea[id][name^="slide"]'),r={};if(s.each(t.proxy(function(e,i){var s=t(i),n=s.attr("name").match(/slide\[(.*)\]/)[1];r[n]=s.on("nextendChange",t.proxy(this.onChange,this,n))},this)),this.fields=r,this.slideBackground=this.editor.getSlideBackground(),!i){var n=t("#slidethumbnail").on("change, nextendChange",function(){var e=n.val();""===e&&(e="$system$/images/placeholder/image.png"),t(".n2-ss-edit-slide-top-thumbnail img").attr("src",nextend.imageHelper.fixed(e))}),o=null,a=this.fields.backgroundImage.val(),l=t.proxy(function(t){""===t||"$system$/images/placeholder/image.png"===t||""!==n.val()&&n.val()!==a||(n.val(t).trigger("change"),o&&(o.off(".slidethumbnail"),o=null))},this);this.fields.backgroundImage.on("nextendChange.slidethumbnail",t.proxy(function(){var t=this.fields.backgroundImage.val();l(t),a=t},this)),""===n.val()&&(o=t("#item_imageimage").on("nextendChange.slidethumbnail",t.proxy(function(){l(o.val())},this)))}this.createHistory()}i.prototype.createHistory=function(){this.values={},t("#smartslider-form").find('input[id][name^="slide"], textarea[id][name^="slide"]').not("#slideslide").each(t.proxy(function(e,i){var s=t(i),r=s.data("field"),n=s.attr("id");this.values[n]=s.val(),s.on("nextendChange",t.proxy(function(){var t=s.val(),e=N2Classes.History.get().addValue(this,this.historyUpdateSlideValue,[r]);e&&e.setValues(this.values[n],t),this.values[n]=t},this))},this))},i.prototype.getSelf=function(){return this},i.prototype.historyUpdateSlideValue=function(t,e){e.insideChange(t)},i.prototype.getAllData=function(){var t={};for(var e in this.fields)t[e]=this.fields[e].val();return t};var s=["thumbnail","background-type","backgroundColor","backgroundGradient","backgroundColorEnd","backgroundImage","backgroundImageOpacity","backgroundImageBlur","backgroundFocusX","backgroundFocusY","backgroundMode"];return i.prototype.getBackgroundData=function(){for(var t={},e=0;e<s.length;e++)t[s[e]]=this.fields[s[e]].val();return t},i.prototype.setData=function(t,e){e&&this.slideBackground.setVisualLoad(!1);for(var i in t)this.fields[i].val(t[i]).trigger("change");e&&this.slideBackground.setVisualLoad(!1)},i.prototype.onChange=function(t,e){t=t.replace(/-/g,"_"),"function"==typeof this["sync_"+t]&&this["sync_"+t].call(this)},i.prototype.sync_backgroundColor=i.prototype.sync_backgroundGradient=i.prototype.sync_backgroundColorEnd=function(){this.updateBackgroundColor()},i.prototype.updateBackgroundColor=function(){var t,e=this.getBackgroundColor(),i=this.getBackgroundGradient();"off"!==i&&(t=this.getBackgroundColorEnd()),this.slideBackground.updateColor(e,i,t)},i.prototype.sync_backgroundImage=function(){this.slideBackground.setImage(this.getBackgroundImage())},i.prototype.sync_background_type=function(){this.slideBackground.setType(this.fields["background-type"].val())},i.prototype.getType=function(){return this.fields["background-type"].val()},i.prototype.sync_backgroundMode=function(){this.slideBackground.setMode(this.fields.backgroundMode.val())},i.prototype.sync_backgroundFocusY=i.prototype.sync_backgroundFocusX=function(){this.slideBackground.setFocus(this.getBackgroundFocusX(),this.getBackgroundFocusY())},i.prototype.sync_backgroundImageOpacity=function(){this.slideBackground.setImageOpacity(this.getBackgroundImageOpacity())},i.prototype.getBackgroundImageOpacity=function(){return this.fields.backgroundImageOpacity.val()},i.prototype.sync_backgroundImageBlur=function(){this.slideBackground.setBlur(this.getBackgroundImageBlur())},i.prototype.getBackgroundColor=function(){return this.editor.generator.fill(this.fields.backgroundColor.val())},i.prototype.getBackgroundGradient=function(){return this.fields.backgroundGradient.val()},i.prototype.getBackgroundColorEnd=function(){return this.editor.generator.fill(this.fields.backgroundColorEnd.val())},i.prototype.getBackgroundImage=function(){return this.editor.generator.fill(this.fields.backgroundImage.val())},i.prototype.getBackgroundImageBlur=function(){return this.fields.backgroundImageBlur.val()},i.prototype.getBackgroundFocusX=function(){return this.fields.backgroundFocusX.val()},i.prototype.getBackgroundFocusY=function(){return this.fields.backgroundFocusY.val()},i}),N2D("FormElementStyleMode",function(t,e){function i(e){this.$element=t("#"+e).on("nextendChange",t.proxy(function(){""==this.$element.val()?this.$reset.css("visibility","hidden"):this.$reset.css("visibility","")},this)),this.$container=this.$element.parent(),this.$reset=this.$container.find(".n2-form-element-style-mode-reset").on("click",t.proxy(function(){this.$element.triggerHandler("n2resetmode")},this))}return i}),N2D("SmartSliderAdminSlideBackgroundColor",["SmartSliderSlideBackgroundColor"],function(t,e){function i(t,e){N2Classes.SmartSliderSlideBackgroundColor.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.SmartSliderSlideBackgroundColor.prototype),i.prototype.constructor=i,i.prototype.update=function(t,e,i){t=this.fixColor(t),this.$el.css({background:""}),"off"!==e?this.updateGradient(t,e,i):this.updateColor(t)},i.prototype.updateColor=function(t){"00"!==t.substr(6,8)&&this.$el.css("background","#"+t.substr(0,6)).css("background",N2Color.hex2rgbaCSS(t))},i.prototype.updateGradient=function(t,e,i){switch(this.$el.css({background:""}),i=this.fixColor(i),e){case"horizontal":this.$el.css("background","linear-gradient(to right, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)");break;case"vertical":this.$el.css("background","linear-gradient(to bottom, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)");break;case"diagonal1":this.$el.css("background","linear-gradient(45deg, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)");break;case"diagonal2":this.$el.css("background","linear-gradient(135deg, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)")}},i.prototype.fixColor=function(t){return t.length&&"#"===t.charAt(0)&&(t=t.substring(1),6===t.length&&(t+="ff")),t},i}),N2D("SmartSliderAdminSlideBackgroundImage",["SmartSliderSlideBackgroundImage"],function(t,e){function i(t,e,i,s){this.hash=s.data("hash"),N2Classes.SmartSliderSlideBackgroundImage.prototype.constructor.apply(this,arguments),this.loadAllowed=!0,this.listenImageManager()}return i.prototype=Object.create(N2Classes.SmartSliderSlideBackgroundImage.prototype),i.prototype.constructor=i,i.prototype.listenImageManager=function(){""!==this.hash&&t(window).on(this.hash,t.proxy(this.onImageManagerChanged,this))},i.prototype.notListenImageManager=function(){""!==this.hash&&t(window).off(this.hash,null,t.proxy(this.onImageManagerChanged,this))},i.prototype.onImageManagerChanged=function(t,e){this.tabletSrc=e.tablet.image,this.mobileSrc=e.mobile.image,this.updateBackgroundToDevice(this.manager.device)},i.prototype.preLoadAdmin=function(e){this.preLoad(),""!==e&&this.background.allowVisualLoad&&(this.notListenImageManager(),this.deferred.done(t.proxy(function(){t.when(nextend.imageManager.getVisual(e)).done(t.proxy(function(t){this.onImageManagerChanged(null,t.value),this.listenImageManager()},this))},this)))},i.prototype.setDesktopSrc=function(e){if(this.notListenImageManager(),this.desktopSrc=e,this.hash=md5(e),""!==e&&this.background.allowVisualLoad){var i=new Image;i.addEventListener("load",t.proxy(function(){t.when(nextend.imageManager.getVisual(e)).done(t.proxy(function(t){this.onImageManagerChanged(null,t.value),this.listenImageManager()},this))},this),!1),i.src=nextend.imageHelper.fixed(e)}else this.tabletSrc="",this.mobileSrc="",this.setSrc(nextend.imageHelper.fixed(e))},i.prototype.setSrc=function(t){N2Classes.SmartSliderSlideBackgroundImage.prototype.setSrc.call(this,nextend.imageHelper.fixed(t))},i.prototype.startFixed=function(){},i.prototype.updateMode=function(t,e){if("blurfit"===t&&1===this.$background.length){this.$background=this.$background.add(this.$background.clone().insertAfter(this.$background));var i=7;this.$background.first().css({margin:"-"+2*i+"px",padding:2*i+"px"}).css(window.n2FilterProperty,"blur("+i+"px)")}"blurfit"===e&&"blurfit"!==t&&(this.$background.eq(1).remove(),this.$background=this.$background.eq(0),this.updateBlur(this.blur))},i.prototype.updateFocus=function(t,e){this.$background.css("background-position",t+"% "+e+"%")},i.prototype.updateOpacity=function(t){this.$background.css("opacity",t/100)},i.prototype.updateBlur=function(t){window.n2FilterProperty&&(t>0?this.$background.last().css({margin:"-"+2*t+"px",padding:2*t+"px"}).css(window.n2FilterProperty,"blur("+t+"px)"):this.$background.last().css({margin:"",padding:""}).css(window.n2FilterProperty,"")),this.blur=t},i.prototype.kill=function(){this.notListenImageManager(),this.$el.remove(),this.$background.remove()},i}),N2D("LayerContainer",function(t,e){"use strict";function i(t,e,i,s,r){this.component=t,this.$ul=e.data("container",this),this.allowedPlacementMode=i,this.childrenSelector=s,this.allowedChildren=r,this.layerContainerElement=t.layer}return i.prototype.setLayerContainerElement=function(t){this.layerContainerElement=t},i.prototype.startWithExistingNodes=function(t){for(var e=this.layerContainerElement.find(this.childrenSelector),i=0;i<e.length;i++)this._loadNode(e.eq(i),t);this.component.onChildCountChange()},i.prototype.isChildAllowed=function(e){return-1!==t.inArray(e,this.allowedChildren)},i.prototype._loadNode=function(t,i){var s=t.data("sstype");if(this.isChildAllowed(s)){var r=t.data("lastplacement"),n={};if(r!==e&&r!=this.allowedPlacementMode)switch(r){case"absolute":n=N2Classes.PlacementAbsolute.cleanLayer(t);break;case"normal":n=N2Classes.PlacementNormal.cleanLayer(t)}var o;switch(s){case"layer":o=new N2Classes.Layer(this.component.fragmentEditor,this.component);var a=o.itemEditor.getItemClass(t.find(".n2-ss-item").data("item"));a&&N2Classes[a].needSize&&n.desktopportraitheight!==e&&t.data("desktopportraitheight",n.desktopportraitheight);break;case"content":o=new N2Classes.Content(this.component.fragmentEditor,this.component);break;case"row":o=new N2Classes.Row(this.component.fragmentEditor,this.component);break;case"col":o=new N2Classes.Col(this.component.fragmentEditor,this.component);break;case"group":}if(o)return o.load(t,i),i||o.sync(),o}else console.error(s+" is not allowed in "+this.component.label);return!1},i.prototype.getLayerCount=function(){return this.layerContainerElement.find(this.childrenSelector).length;
4
- },i.prototype.getLayerIndex=function(t){return this.layerContainerElement.find(this.childrenSelector).index(t)},i.prototype.getSortedLayers=function(){var i=[];return this.layerContainerElement.find(this.childrenSelector).each(function(s,r){var n=t(r).data("layerObject");n!==e&&i.push(n)}),i},i.prototype.append=function(t){t.appendTo(this.layerContainerElement);var e=this._loadNode(t,!1);return this.component.onChildCountChange(),e},i.prototype.insertAt=function(t,e){var i=this.getSortedLayers();e>=i.length?t.appendTo(this.layerContainerElement):t.insertBefore(i[e].layer);var s=this._loadNode(t,!1);return this.component.onChildCountChange(),s},i.prototype.insert=function(t){t.getRootElement().appendTo(this.layerContainerElement)},i.prototype.insertLayerAt=function(e,i){var s=this.getSortedLayers(),r=e.group,n=t.inArray(e,s);n>-1&&i>n&&i++,i>=s.length?e.getRootElement().appendTo(this.layerContainerElement):e.getRootElement().insertBefore(s[i].getRootElement()),this.syncLayerRow(e),r!==this.component&&r.onChildCountChange()},i.prototype.syncLayerRow=function(t){var i,s="absolute"===this.allowedPlacementMode;i=s?t.getRootElement().prevAll(".n2-ss-layer, .n2-ss-layer-group").first().data("layerObject"):t.getRootElement().nextAll(".n2-ss-layer, .n2-ss-layer-group").first().data("layerObject"),i!==e?t.layerRow.insertBefore(i.layerRow):this.$ul.append(t.layerRow),t.animations&&t.animations.syncRow(i,s)},i.prototype.getChildLayersRecursive=function(t){for(var e=this.getSortedLayers(),i=[],s=0;s<e.length;s++)t?i.push(e[s].layer[0]):i.push(e[s]),e[s].container&&i.push.apply(i,e[s].container.getChildLayersRecursive(t));return i},i.prototype.moveLayerToGroup=function(t,e){this.moveLayersToGroup([t],[e])},i.prototype.moveLayersToGroup=function(e,i){i=i||[];for(var s=[],r=0;r<e.length;r++){var n=e[r],o=n.group,a=n.getIndex();"undefined"!=typeof i[r]?this.insertLayerAt(n,i[r]):this.insert(n),n.changeGroup(a,this.component),this!=o&&-1==t.inArray(o,s)&&s.push(o)}for(var r=0;r<s.length;r++)s[r].update()},i.prototype.activateFirst=function(){var t=this.getSortedLayers();t.length>0&&t[t.length-1].activate()},i.prototype.resetModes=function(t){for(var i=this.getSortedLayers(),s=0;s<i.length;s++)i[s].resetMode(t),i[s].container!=e&&i[s].container.resetModes(t)},i.prototype.copyModes=function(t,i){for(var s=this.getSortedLayers(),r=0;r<s.length;r++)s[r].copyMode(t,i),s[r].container!=e&&s[r].container.copyModes(t,i)},i.prototype.changeEditorModes=function(t){for(var i=this.getSortedLayers(),s=0;s<i.length;s++)i[s].changeEditorMode(t),i[s].container!=e&&i[s].container.changeEditorModes(t)},i.prototype.renderModeProperties=function(){for(var t=this.getSortedLayers(),i=0;i<t.length;i++)t[i].renderModeProperties(),t[i].container!=e&&t[i].container.renderModeProperties()},i.prototype.getAllLayers=function(t){t=t||[];for(var i=this.getSortedLayers(),s=0;s<i.length;s++)t.push(i[s]),i[s].container!=e&&i[s].container.getAllLayers(t);return t},i.prototype.getData=function(e){e=t.extend({layersIncluded:!0,itemsIncluded:!0},e);var i=[],s=this.getSortedLayers();if("absolute"==this.allowedPlacementMode)for(var r=s.length-1;r>=0;r--)i.push(s[r].getData(e));else for(var r=0;r<s.length;r++)i.push(s[r].getData(e));return i},i.prototype.getHTML=function(t){for(var e=this.getSortedLayers(),i=[],s=0;s<e.length;s++)i.push(e[s].getHTML(t));return i},i.prototype.getDroppables=function(t){for(var e=[],i=this.getSortedLayers(),s=0;s<i.length;s++)if(i[s]!=t){var r=i[s].getDroppable();"object"==typeof r&&e.push(r),"hidden"!=r&&i[s].container&&e.push.apply(e,i[s].container.getDroppables(t))}return e},i.prototype.getLLDroppables=function(t){var e=[],i=this.component.getLLDroppable(t);i&&e.push(i);for(var s=this.getSortedLayers(),r=0;r<s.length;r++)s[r].container&&s[r]!=t&&e.push.apply(e,s[r].container.getLLDroppables(t));return e},i}),N2D("LayerDataStorage",function(t,e){"use strict";function i(){this.isDeviceProp={},this.propertyScope={},this.property={},this.deviceProperty={desktopPortrait:{},desktopLandscape:{},tabletPortrait:{},tabletLandscape:{},mobilePortrait:{},mobileLandscape:{}},this.advancedProperties={}}return i.prototype.getMode=function(){return this.fragmentEditor.getMode()},i.prototype.getProperties=function(){var t={};for(var i in this.property)if(this.advancedProperties[i]!==e){if(i==this.advancedProperties[i].getName()){var s=this.property[i],r=this.advancedProperties[i].getBaseName();this.property[i]===e&&(s=this.property[r]),t[r]=s}}else t[i]=this.property[i];return t},i.prototype.getRawProperty=function(t){if(this.isDeviceProp[t]){var i=this.getMode(),s=this.deviceProperty[i];return s[t]!==e?s[t]:e}return this.property[t]},i.prototype.getProperty=function(t){if(this.isDeviceProp[t]){var e=this.getMode(),i=this.deviceProperty[e],s=this.deviceProperty.desktopPortrait;if("undefined"!=typeof i[t])return i[t];if("undefined"!=typeof s[t])return s[t]}return this.property[t]},i.prototype.historyStore=function(t,e,i){if(!this.isDeleteStarted){var s=this.getMode();this.isDeviceProp[e]&&i!=s?(this.deviceProperty[i][e]=t,this.render(e)):(this.store(e,t,!0,"history"),this.$.trigger("propertyChanged",[e,this.getProperty(e)]))}},i.prototype.store=function(t,e,i,s){var r,n,o=this.getMode();this.isDeviceProp[t]?(r=this.deviceProperty[o][t],n=this.getProperty(t)):n=r=this.property[t];var a=N2Classes.History.get().addValue(this,this.historyStore,[t,o]);a&&a.setValues(r,e),this.property[t]=e,this.isDeviceProp[t]&&(this.deviceProperty[o][t]=e),i&&this.render(t,n,s)},i.prototype.render=function(t,e,i){this.propertyScope[t]["_sync"+t](e,i)},i.prototype.isDimensionPropertyAccepted=function(t){return(t+"").match(/[0-9]+%/)||"auto"==t},i.prototype.changeEditorMode=function(t){var e=parseInt(this.property[t]);e?this._show():this._hide(),this.layer.triggerHandler("LayerShowChange",[t,e]),this.renderModeProperties(!1)},i.prototype.renderModeProperties=function(t){for(var e in this.isDeviceProp)this.isDeviceProp[e]&&(this.property[e]=this.getProperty(e),this.$.trigger("propertyChanged",[e,this.property[e]]))},i.prototype.historyResetMode=function(e,i){this.deviceProperty[i]=t.extend({},e),i==this.fragmentEditor.getMode()&&this.renderModeProperties(!0)},i.prototype.resetMode=function(e){if("desktopPortrait"!=e){var i,s=N2Classes.History.get().addValue(this,this.historyResetMode,[e]);s&&s.setValues(t.extend({},this.deviceProperty[e]),{});for(var r in this.deviceProperty[e])this.deviceProperty[e][r]=i;e==this.fragmentEditor.getMode()&&this.renderModeProperties(!0)}},i.prototype.copyMode=function(e,i){if(e!=i){var s=this.deviceProperty[i];this.deviceProperty[i]=t.extend({},this.deviceProperty[i],this.deviceProperty[e]);var r=N2Classes.History.get().addValue(this,this.historyResetMode,[i]);r&&r.setValues(s,this.deviceProperty[i])}},i.prototype._getDefault=function(t,i){return this.originalProperties[t]!==e?this.originalProperties[t]:i},i.prototype.createProperty=function(t,i,s,r){this.isDeviceProp[t]=!1,this.propertyScope[t]=r||this,s?(this.property[t]=s.data(t.toLowerCase()),this.property[t]===e&&(this.property[t]=this._getDefault(t,i))):this.property[t]=this._getDefault(t,i)},i.prototype.createAdvancedProperty=function(t,e,i){var s=t.getNames();for(var r in s)this.advancedProperties[r]=t,this.createProperty(r,s[r],e,i)},i.prototype.syncAdvancedField=function(t){var i=this.advancedProperties[t].getName(),s=this.property[i];this.property[i]===e&&(s=this.property[t]),this.fragmentEditor.layerOptions.updateField(t,s)},i.prototype.createDeviceProperty=function(t,i,s,r){var n,o;if(this.isDeviceProp[t]=!0,this.propertyScope[t]=r||this,s){for(n in this.deviceProperty)this.deviceProperty[n][t]=s.data(n.toLowerCase()+t.toLowerCase()),""===this.deviceProperty[n][t]&&(this.deviceProperty[n][t]=e);for(n in this.deviceProperty)this.deviceProperty[n][t]!==e&&""!==this.deviceProperty[n][t]||(o=this._getDefault(n.toLowerCase()+t.toLowerCase()),o!==e&&(this.deviceProperty[n][t]=o));for(n in i)this.deviceProperty[n][t]!==e&&""!==this.deviceProperty[n][t]||(this.deviceProperty[n][t]=i[n])}else{for(n in i)this.deviceProperty[n][t]=i[n];for(n in this.deviceProperty)o=this._getDefault(n.toLowerCase()+t.toLowerCase()),o!==e&&(this.deviceProperty[n][t]=o)}this.property[t]=this.deviceProperty.desktopPortrait[t]},i.prototype.removeProperty=function(t){if(delete this.property[t],this.layer.removeData(t.toLowerCase()).removeAttr("data-"+t.toLowerCase()),this.isDeviceProp[t])for(var e in this.deviceProperty)delete this.deviceProperty[e][t],this.layer.removeData(e.toLowerCase()+t.toLowerCase()).removeAttr("data-"+e.toLowerCase()+t.toLowerCase());delete this.isDeviceProp[t],delete this.propertyScope[t]},i.prototype.removeProperties=function(t){for(var e=0;e<t.length;e++)this.removeProperty(t[e])},i.prototype.getPropertiesData=function(t){for(var i={},s=0;s<t.length;s++){var r=t[s];if(this.property[r]!==e&&(i[r]=this.property[r]),this.isDeviceProp[r])for(var n in this.deviceProperty)this.deviceProperty[n][r]!==e&&(i[n.toLowerCase()+r]=this.deviceProperty[n][r])}return i},i.prototype.setProperty=function(t,i,s){this.advancedProperties[t]!==e&&(t=this.advancedProperties[t].getName()),this.propertyScope[t]!==e?"function"==typeof this.propertyScope[t]["setProperty"+t]?this.propertyScope[t]["setProperty"+t](t,i,s):this._setProperty(t,i,s):"function"==typeof this["setProperty"+t]&&this["setProperty"+t](t,i,s)},i.prototype._setProperty=function(t,e,i){this.store(t,e,!0,i),"manager"!=i&&this.$.trigger("propertyChanged",[t,this.getProperty(t)])},i.prototype.onSyncFields=function(){},i.prototype.resetStyleMode=function(t){for(var e in this.advancedProperties)this.advancedProperties[e].resetMode(t)},i}),N2D("FragmentEditor",function(t,e){"use strict";function i(e,i,s,r){this.mode="desktopPortrait",this.editor=e,this.$editedElement=i,this.configuration=s,this.ready=t.Deferred(),this.shouldPreventActivationBubble=!1,this.$=t(this),e.fragmentEditor=this,this.$highlight=t('<div class="n2-ss-layer-highlight n2-ss-layer-highlight-n" /><div class="n2-ss-layer-highlight n2-ss-layer-highlight-e" /><div class="n2-ss-layer-highlight n2-ss-layer-highlight-s" /><div class="n2-ss-layer-highlight n2-ss-layer-highlight-w" />'),this.initSelectMode(),this.layerWindow=new N2Classes.LayerWindow(this),this.layerOptions=new N2Classes.ComponentSettings(this),this.ui=new N2Classes.CanvasUserInterface(this),this.mainContainer=new N2Classes.MainContainer(this),this.itemEditor=new N2Classes.ItemManager(this,r),this.mainContainer.lateInit(),this._initDeviceModeChange(),this.canvasSettings=new N2Classes.CanvasSettings(this),this.layerOptions.startFeatures(),this.hotkeys(),this.addContextMenu(),this.mainContainer.refreshHasLayers();var n=t("#n2-ss-editor-mode .n2-radio-option"),o=t.proxy(function(t){switch(this.updateEditorMode(t),t){case"content":n.eq(0).addClass("n2-active"),n.eq(1).removeClass("n2-active");break;case"canvas":n.eq(0).removeClass("n2-active"),n.eq(1).addClass("n2-active")}},this);if(this.mainContent&&this.mainContent.container.getLayerCount())o("content");else{var a=this.mainContainer.container.getSortedLayers();if(this.mainContent&&a.length>1||!this.mainContent&&a.length>0)o("canvas");else{var l=t.jStorage.get("editormode");l||(l="content",t.jStorage.set("editormode",l)),o(l)}}n.on("click",t.proxy(function(e){n.removeClass("n2-active");var i=t(e.currentTarget),s=i.data("mode");i.addClass("n2-active"),s!=this.currentEditorMode&&(this.updateEditorMode(s),t.jStorage.set("editormode",s))},this)),this.isMultiDrag=!1}var s={16:0,38:0,40:0,37:0,39:0},r={97:"left",98:"center",99:"right",100:"left",101:"center",102:"right",103:"left",104:"center",105:"right"},n={97:"bottom",98:"bottom",99:"bottom",100:"middle",101:"middle",102:"middle",103:"top",104:"top",105:"top"},o={OFF:0,ON:1,GROUP:2};return i.prototype.updateEditorMode=function(e){this.currentEditorMode=e,t("body").attr("data-editormode",this.currentEditorMode)},i.prototype.getMode=function(){return this.mode},i.prototype.getResponsiveRatioHorizontal=function(){return this.editor.getHorizontalRatio()},i.prototype.getResponsiveRatioVertical=function(){return this.editor.getVerticalRatio()},i.prototype.setMainContent=function(t){this.mainContent=t},i.prototype.isGroup=function(t){return!1},i.prototype.isRow=function(t){return t instanceof N2Classes.Row},i.prototype.isCol=function(t){return t instanceof N2Classes.Col},i.prototype.isLayer=function(t){return t instanceof N2Classes.Layer},i.prototype.isContent=function(t){return t instanceof N2Classes.Content},i.prototype._initDeviceModeChange=function(){var e=t("#layerresettodesktop").on("click",t.proxy(this.__onResetToDesktopClick,this));this.resetToDesktopTRElement=e.closest("tr"),this.resetToDesktopGlobalElement=t("#n2-ss-layer-reset-to-desktop").on("click",t.proxy(function(){"block"==this.resetToDesktopTRElement.css("display")&&e.trigger("click")},this));var i=t("#n2-ss-layer-show-on"),s={},r=this.editor.getAvailableDeviceModes();for(var n in r)r[n]&&(s[n]=t('<div class="n2-radio-option"><i class="n2-i n2-it n2-i-'+n+'"></i></div>').on("click",t.proxy(function(t){this.layerOptions.currentForm[t].data("field").onoff.trigger("click")},this,n)).appendTo(i));i.children().first().addClass("n2-first"),i.children().last().addClass("n2-last"),this.globalShowOnDeviceCB=function(t){"undefined"!=typeof s[t]&&s[t].toggleClass("n2-active",1==this.layerOptions.currentForm[t].val())},this.layerOptions.forms.global.desktopPortrait.on("nextendChange",t.proxy(this.globalShowOnDeviceCB,this,"desktopPortrait")),this.layerOptions.forms.global.desktopLandscape.on("nextendChange",t.proxy(this.globalShowOnDeviceCB,this,"desktopLandscape")),this.layerOptions.forms.global.tabletPortrait.on("nextendChange",t.proxy(this.globalShowOnDeviceCB,this,"tabletPortrait")),this.layerOptions.forms.global.tabletLandscape.on("nextendChange",t.proxy(this.globalShowOnDeviceCB,this,"tabletLandscape")),this.layerOptions.forms.global.mobilePortrait.on("nextendChange",t.proxy(this.globalShowOnDeviceCB,this,"mobilePortrait")),this.layerOptions.forms.global.mobileLandscape.on("nextendChange",t.proxy(this.globalShowOnDeviceCB,this,"mobileLandscape")),t("#layershow").data("field").setAvailableDevices(r),this.refreshMode(),this.ready.resolve()},i.prototype.refreshMode=function(){this.mode=this.editor.getDeviceMode(),this.resetToDesktopTRElement.css("display","desktopPortrait"==this.mode?"none":""),this.resetToDesktopGlobalElement.css("display","desktopPortrait"==this.mode?"none":""),this.mainContainer.container.changeEditorModes(this.mode)},i.prototype.onChangeDeviceOrientation=function(){this.refreshMode()},i.prototype.onResize=function(t){this.mainContainer.onResize(t),this.canvasSettings.ruler&&this.canvasSettings.ruler.onResize()},i.prototype.__onResetToDesktopClick=function(){if(this.mainContainer.getSelectedLayer()){var t=this.getMode();this.mainContainer.getSelectedLayer().resetMode(t)}},i.prototype.copyOrResetMode=function(t){var e=this.getMode();"desktopPortrait"==e?"desktopPortrait"!=t&&this.mainContainer.container.resetModes(t):t==e?this.mainContainer.container.resetModes(t):this.mainContainer.container.copyModes(e,t)},i.prototype.getSnap=function(){return this.canvasSettings.get("n2-ss-snap-to-enabled")?t(this.configuration.snapSelector):!1},i.prototype.getHTML=function(){for(var e=t("<div></div>"),i=this.mainContainer.container.getAllLayers(),s=0;s<i.length;s++)e.append(i[s].getHTML(!0));return e.html()},i.prototype.getData=function(){return this.mainContainer.container.getData()},i.prototype.importLayers=function(e,i){var s=(this.mainContainer,t.extend(!0,[],e));i&&this.mainContainer.deleteLayers(),this._idTranslation={};for(var r=this.dataToLayers(s),n=0;n<r.length;n++)this.mainContainer.container.append(r[n]);if(this.refreshMode(),!this.mainContainer.getSelectedLayer()){var s=this.mainContainer.container.getSortedLayers();s.length>0&&s[0].activate()}},i.prototype.loadComponentWithNode=function(t,e,i,s){var r=t.container.append(e);return s&&this.refreshMode(),r},i.prototype.insertComponentWithNode=function(t,e,i,s,r){var n=t.container.insertAt(e,i);return r&&this.refreshMode(),n},i.prototype.fixActiveLayer=function(){var t=this.mainContainer.getSelectedLayer();(0==t||t.isDeleted)&&this.resetActiveLayer()},i.prototype.resetActiveLayer=function(){var t=this.mainContainer.container.getSortedLayers();t.length?t[t.length-1].activate():this.changeActiveLayer(null)},i.prototype.changeActiveLayer=function(e,i){var s=this.mainContainer.getSelectedLayer();s&&!s.isDeleted&&(s.$.off("propertyChanged.editor").off(".active"),s.deActivate()),this.mainContainer.activeLayer=e,i||this.exitSelectMode(),e&&(this.layerOptions.changeActiveComponent(e,e.type,e.placement.getType(),e.getProperties()),e.$.on({"propertyChanged.editor":t.proxy(this.layerOptions.onUpdateField,this.layerOptions),"placementChanged.active":t.proxy(function(t,i,s){this.layerOptions.changeActiveComponentPlacement(i,e.property)},this)})),this.$.trigger("activeLayerChanged")},i.prototype.highlight=function(t){this.$highlight.appendTo(t.layer)},i.prototype.deHighlight=function(t){this.$highlight.detach()},i.prototype["delete"]=function(){this.mainContainer.getSelectedLayer()&&this.doActionOnActiveLayer("delete")},i.prototype.duplicate=function(){this.mainContainer.getSelectedLayer()&&this.doActionOnActiveLayer("duplicate",[this.selectMode!=o.ON,!1])},i.prototype.copy=function(i){var s;if(i==e)if(1==this.selectMode)s=this.selectedLayers;else{var r=this.mainContainer.getSelectedLayer();r&&(s=this.isCol(r)||this.isContent(r)?r.container.getSortedLayers():[r])}else s=this.isCol(i)||this.isContent(i)?i.container.getSortedLayers():[i];var n=this.mainContainer.getLayerData(s);n.length&&t.jStorage.set("ss3layersclipboard",JSON.stringify(n))},i.prototype.paste=function(i){var s=t.jStorage.get("ss3layersclipboard");if(s){var r=JSON.parse(s);if(r.length){var n;n=i!==e&&i?this.isCol(i)||this.isContent(i)?i:i.group:this.mainContainer.getActiveGroup(),this.mainContainer.addLayers(r,n)}}},i.prototype.hasLayersOnClipboard=function(){return!!t.jStorage.get("ss3layersclipboard")},i.prototype.addContextMenu=function(){this.$editedElement.nextendContextMenu({onShow:t.proxy(function(e,i){var s=t(e.target),r=s.closest(".n2-ss-layer"),n=r.data("layerObject");n||(n=this.mainContainer.getSelectedLayer()),n&&(this.isCol(n)||this.isContent(n)?i.addItem("Copy child layers","n2-i-copy",t.proxy(function(){this.copy(n)},this)):i.addItem("Copy layer","n2-i-copy",t.proxy(function(){this.selectMode==o.ON?this.copy():this.copy(n)},this))),this.hasLayersOnClipboard()&&i.addItem("Paste layer(s)","n2-i-paste",t.proxy(function(){this.paste(n)},this)),i.addItem("Copy slide","n2-i-copy",t.proxy(function(){this.editor.copy()},this)),this.editor.hasClipboard()&&i.addItem("Paste slide","n2-i-paste",t.proxy(function(){this.editor.paste()},this))},this)})},i.prototype.initSelectMode=function(){this.selectMode=o.OFF,this.selectedLayers=[],t(".n2-ss-layer-list-top-bar .n2-button").on("mousedown",t.proxy(function(e){switch(e.preventDefault(),t(e.currentTarget).data("action")){case"delete":this["delete"]();break;case"duplicate":this.duplicate();break;case"group":this.createGroupFromSelected();break;case"cancel":this.exitSelectMode()}},this))},i.prototype.startSelection=function(t){t?(this.selectMode==o.ON&&this.exitSelectMode(),this.changeSelectMode(o.GROUP)):this.changeSelectMode(o.ON)},i.prototype.changeSelectMode=function(e){var i=this.selectMode;i!=e&&(i==o.ON?t("#n2-admin").removeClass("n2-ss-select-layer-mode-on"):i==o.GROUP&&t("#n2-admin").removeClass("n2-ss-select-layer-mode-group"),this.selectMode=e,i==o.GROUP&&e==o.ON&&this.selectedLayers[0].activate(null,null,!0),e==o.OFF?t("#n2-admin").removeClass("n2-ss-select-layer-mode"):(t("#n2-admin").addClass("n2-ss-select-layer-mode"),e==o.ON?t("#n2-admin").addClass("n2-ss-select-layer-mode-on"):e==o.GROUP&&t("#n2-admin").addClass("n2-ss-select-layer-mode-group")),this.selectMode==o.OFF?t("body").off(".n2-ss-selection"):t("body").on("mousedown.n2-ss-selection",t.proxy(function(t){3!=t.which&&"main"==N2Classes.WindowManager.get().getCurrentWindow()&&N2Classes.WindowManager.get().mouseDownArea===!1&&this.exitSelectMode()},this)))},i.prototype.endSelection=function(t){t&&this.selectMode==o.GROUP&&this.exitSelectMode()},i.prototype.selectLayer=function(t,e){if("layer"!=t.type)return!0;if(this.selectMode!=o.ON){var i=this.mainContainer.getSelectedLayer();if("layer"!=i.type)return t.activate(null),!0;this.startSelection(!1),e&&this.selectedLayers.push(i)}return this._selectLayer(t),!0},i.prototype._selectLayer=function(e){var i=t.inArray(e,this.selectedLayers);if(-1!=i){if(this.selectMode==o.ON&&this.selectedLayers.length<=1)return this.exitSelectMode(),!1;var s=this.selectedLayers[i];if(this.selectedLayers.splice(i,1),e.layerRow.removeClass("n2-selected"),e.layer.removeClass("n2-ss-layer-selected"),this.selectMode==o.ON&&this.selectedLayers.length<=1)return this.selectedLayers[0].activate(),this.exitSelectMode(),!1;s===this.mainContainer.getSelectedLayer()&&this.selectedLayers[0].activate(!1,null,!0)}else{for(var r=this.selectedLayers.length,n=0;n<this.selectedLayers.length;n++)if(e.layer.add(this.selectedLayers[n].layer).index(this.selectedLayers[n].layer)>0){r=n;break}this.selectedLayers.splice(r,0,e)}for(var n=0;n<this.selectedLayers.length;n++)this.selectedLayers[n].layerRow.addClass("n2-selected"),this.selectedLayers[n].layer.addClass("n2-ss-layer-selected")},i.prototype.addSelection=function(t,e){e||this.changeSelectMode(o.ON);for(var i=0;i<t.length;i++)this._selectLayer(t[i],!1)},i.prototype.exitSelectMode=function(){if(this.selectMode){for(var e=0;e<this.selectedLayers.length;e++)this.selectedLayers[e]!=this.mainContainer.getSelectedLayer()&&this.selectedLayers[e].layerRow.removeClass("n2-active"),this.selectedLayers[e].layerRow.removeClass("n2-selected"),this.selectedLayers[e].layer.removeClass("n2-ss-layer-selected");t("#n2-admin").removeClass("n2-ss-select-layer-mode"),this.selectedLayers=[],this.changeSelectMode(o.OFF)}},i.prototype.doActionOnActiveLayer=function(e,i){if(this.selectMode==o.ON)for(var s=t.extend([],this.selectedLayers),r=0;r<s.length;r++)s[r][e].apply(s[r],i);else{var n=this.mainContainer.getSelectedLayer();n&&n[e].apply(n,i)}},i.prototype.canvasDragStart=function(t,e){if(this.selectMode&&"canvas"==this.currentEditorMode&&"absolute"==e.mode){for(var i=!1,s=0;s<this.selectedLayers.length;s++){var r=this.selectedLayers[s],n=r.layer;if(n[0]!=e.layer.layer[0]){var o=n.css("display");"none"==o&&n.css("display",""),r._originalPosition=n.position(),"none"==o&&n.css("display","none")}else i=!0}i||this.exitSelectMode(),this.isMultiDrag=!0}},i.prototype.canvasDragMove=function(t,e){if(this.isMultiDrag===!0)for(var i={left:e.position.left+e.canvasOffset.left-e.originalOffset.left,top:e.position.top+e.canvasOffset.top-e.originalOffset.top},s=0;s<this.selectedLayers.length;s++){var r=this.selectedLayers[s];if(!this.isGroup(r)){var n=r.layer;n[0]!=e.layer.layer[0]&&(n.css({left:r._originalPosition.left+i.left,top:r._originalPosition.top+i.top,bottom:"auto",right:"auto"}),r.placement.doAction("triggerLayerResized"))}}},i.prototype.canvasDragStop=function(t,e){if(this.isMultiDrag===!0){for(var i=0;i<this.selectedLayers.length;i++){var s=this.selectedLayers[i];if(!this.isGroup(s)){var r=s.layer;if(r[0]!=e.layer.layer[0]){var n=r.css("display");"none"==n&&r.css("display","block");var o=parseInt(s.layer.css("left")),a=parseInt(s.layer.css("top"));s.placement.current.setPosition(o,a),s.placement.doAction("triggerLayerResized"),"none"==n&&r.css("display","none")}}}return this.isMultiDrag=!1,!0}return!1},i.prototype.historyDeleteGroup=function(t){t.getSelf()["delete"]()},i.prototype.historyCreateGroup=function(t){var e=new N2Classes.Group(this,this.mainContainer,{},null);e.create(),t.setSelf(e)},i.prototype.createGroupFromSelected=function(){var t;switch(this.selectMode){case o.ON:t=new N2Classes.Group(this,this.mainContainer,{},null),t.create(),N2Classes.History.get().addSimple(this,this.historyDeleteGroup,this.historyCreateGroup,[t]),t.addLayers(this.selectedLayers),this.exitSelectMode(),t.activate();break;case o.OFF:var e=this.mainContainer.getSelectedLayer();e.group instanceof N2Classes.Group?e.group.activate():e instanceof N2Classes.Content||e instanceof N2Classes.Col||(t=new N2Classes.Group(this,this.mainContainer,{},null),t.create(),N2Classes.History.get().addSimple(this,this.historyDeleteGroup,this.historyCreateGroup,[t]),t.addLayers([e]),t.activate());break;case o.GROUP:}},i.prototype.createRow=function(t){var e=new N2Classes.Row(this,t,{});return e.create(),e.hightlightStructure(),{layer:e}},i.prototype.createCol=function(t){var e=t,i=null;if(this.isCol(e))i=e.group.createCol();else if(this.isRow(e))i=e.createCol();else{if(!this.isCol(e.group))return this.createRow(t);i=e.group.group.createCol()}return i.activate(null),{layer:i}},i.prototype.preventActivationBubbling=function(){return this.shouldPreventActivationBubble?!1:(this.shouldPreventActivationBubble=!0,!0)},i.prototype.allowActivation=function(){this.shouldPreventActivationBubble=!1},i.prototype.hotkeys=function(){t(window).on({keydown:t.proxy(function(e){var i=!1;if("TEXTAREA"!=e.target.tagName&&"INPUT"!=e.target.tagName&&!i){var o=this.mainContainer.getSelectedLayer(),a=e.keyCode;if(a>=49&&57>=a){var l=e.originalEvent.location||e.originalEvent.keyLocation||0;3==l&&(a+=48)}if(o)if(46==a||8==a)this["delete"](),e.preventDefault();else if(35==a)this.duplicate(),e.preventDefault();else if(16==a)s[a]=1;else if(38==a){if(!s[a]){var h=t.proxy(function(){this.doActionOnActiveLayer("moveY",[-1*(s[16]?10:1)])},this);h(),s[a]=setInterval(h,100)}e.preventDefault()}else if(40==a){if(!s[a]){var h=t.proxy(function(){this.doActionOnActiveLayer("moveY",[s[16]?10:1])},this);h(),s[a]=setInterval(h,100)}e.preventDefault()}else if(37==a){if(!s[a]){var h=t.proxy(function(){this.doActionOnActiveLayer("moveX",[-1*(s[16]?10:1)])},this);h(),s[a]=setInterval(h,100)}e.preventDefault()}else if(39==a){if(!s[a]){var h=t.proxy(function(){this.doActionOnActiveLayer("moveX",[s[16]?10:1])},this);h(),s[a]=setInterval(h,100)}e.preventDefault()}else if(a>=97&&105>=a){var d=r[a],p=n[a],c=!1;this.layerOptions.forms.placement.absolute.align.val()==d&&this.layerOptions.forms.placement.absolute.valign.val()==p&&(c=!0),this.layerOptions.layerFeatures.horizontalAlign(d,c),this.layerOptions.layerFeatures.verticalAlign(p,c)}else if(65==a){e.preventDefault();var u=this.mainContainer.getSelectedLayer();u&&"absolute"==u.placement.getType()&&u.placement.current.fit()}(e.ctrlKey||e.metaKey)&&(90==a?e.shiftKey?N2Classes.History.get().redo()&&e.preventDefault():N2Classes.History.get().undo()&&e.preventDefault():71==a?(this.createGroupFromSelected(),e.preventDefault()):68==a?(e.preventDefault(),this.editor.copy()):70==a?(e.preventDefault(),this.editor.paste()):67==a?this.copy():86==a&&this.paste())}},this),keyup:t.proxy(function(t){"undefined"!=typeof s[t.keyCode]&&s[t.keyCode]&&(clearInterval(s[t.keyCode]),s[t.keyCode]=0)},this)})},i.prototype.getSelf=function(){return this},i}),N2D("CanvasUserInterface",function(t,e){"use strict";function i(e){this.fragmentEditor=e,this.isShown=!t.jStorage.get("ssLayersShown",!1),this.tlHeight=t.jStorage.get("ssLayersHeight")||200,this.$container=t("#n2-ss-layers"),this.fixScroll(),this.switchLayerList(),this.topBar=t(".n2-ss-layer-list-top-bar").on("mousedown",t.proxy(this.resizeStart,this)),this.topBar.find(".n2-ss-layer-list-opener").on("click",t.proxy(function(t){t.preventDefault(),this.switchLayerList()},this)),t(".n2-ss-slide-show-layers").on("click",t.proxy(function(t){t.preventDefault(),this.switchLayerList()},this)),this.onResize(),t(window).on("resize",t.proxy(this.onResize,this))}return i.prototype.onResize=function(){var t=this.$container.height();this.paneLeft.height(t-48),this.paneRight.height(t-48)},i.prototype.onActivateLayer=function(t){var e=this.paneLeft.scrollTop(),i=0,s=t;do i+=s.layerRow.get(0).offsetTop,s=s.group;while(s!==this.fragmentEditor.mainContainer);(e>i||i>e+this.paneLeft.height()-32)&&(this.paneLeft.scrollTop(i),this.paneRight.scrollTop(i))},i.prototype.fixScroll=function(){this.paneLeft=t(".n2-ss-layers-sidebar-rows"),this.paneRight=t(".n2-ss-timeline-content-layers-container");var e=t.proxy(function(t){var e=this.paneLeft.scrollTop();t.originalEvent.deltaY>0?e+=32:e-=32,e=32*Math.round(e/32),this.paneLeft.scrollTop(e),this.paneRight.scrollTop(e),t.preventDefault()},this);this.paneLeft.on("mousewheel",e),this.paneLeft.on("scroll",t.proxy(function(t){var e=this.paneLeft.scrollTop();this.paneRight.scrollTop(e),t.preventDefault()},this)),this.paneRight.on("mousewheel",e)},i.prototype.resizeStart=function(e){this.isShown&&(e.target==this.topBar[0]||t(e.target).hasClass("n2-h2"))&&(e.preventDefault(),this.startY=e.clientY,this.height=this.$container.height(),t("body").on({"mousemove.n2-ss-tl-resize":t.proxy(this.resizeMove,this),"mouseup.n2-ss-tl-resize":t.proxy(this.resizeStop,this),"mouseleave.n2-ss-tl-resize":t.proxy(this.resizeStop,this)}))},i.prototype.resizeMove=function(t){t.preventDefault(),this.setTLHeight(this._calculateDesiredHeight(t))},i.prototype.resizeStop=function(e){e.preventDefault(),t("body").off(".n2-ss-tl-resize");var i=this._calculateDesiredHeight(e);this.setTLHeight(i),this.tlHeight=i,t.jStorage.set("ssLayersHeight",i),t("#n2-admin").triggerHandler("resize")},i.prototype._calculateDesiredHeight=function(t){var e=this.startY-t.clientY+this.height-48;return this.__calculateDesiredHeight(e)},i.prototype.__calculateDesiredHeight=function(t){return 32*Math.round(Math.min(Math.max(32,t),(window.innerHeight||document.documentElement.clientHeight)/2)/32)+48},i.prototype.switchLayerList=function(){this.isShown=!this.isShown,this.$container.toggleClass("n2-active",this.isShown),this.isShown?this.setTLHeight(this.tlHeight):this.setTLHeight(48),t.jStorage.set("ssLayersShown",this.isShown)},i.prototype.setTLHeight=function(t){t=Math.max(48,t),this.$container.height(t),t=this.$container.height(),this.paneLeft.height(t-48),this.paneRight.height(t-48),nextend.triggerResize()},i.prototype.activateAdd=function(t,e){this.$add.css({left:t,top:e}).appendTo(this.$container)},i}),N2D("LayerFeatures",function(t,e){"use strict";function i(t,e){this.fields=t,this.fragmentEditor=e,this.initParentLinker(),this.initAlign(),this.initEvents()}var s={left:0,center:1,right:2,top:0,middle:1,bottom:2};return i.prototype.initParentLinker=function(){var e=this.fields.parentid.data("field");t("#n2-ss-layer-parent-linker").on({click:function(t){e.click(t)}})},i.prototype.initAlign=function(){this.layerDefault={align:null,valign:null};var e=t("#n2-ss-layer-horizontal-align .n2-radio-option"),i=t("#n2-ss-layer-vertical-align .n2-radio-option");e.add(i).on("click",t.proxy(function(s){if(s.ctrlKey||s.metaKey){var r=t(s.currentTarget),n=r.hasClass("n2-sub-active"),o=r.data("align");switch(o){case"left":case"center":case"right":e.removeClass("n2-sub-active"),n?(t.jStorage.set("ss-item-horizontal-align",null),this.layerDefault.align=null):(t.jStorage.set("ss-item-horizontal-align",o),this.layerDefault.align=o,r.addClass("n2-sub-active"));break;case"top":case"middle":case"bottom":i.removeClass("n2-sub-active"),n?(t.jStorage.set("ss-item-vertical-align",null),this.layerDefault.valign=null):(t.jStorage.set("ss-item-vertical-align",o),this.layerDefault.valign=o,r.addClass("n2-sub-active"))}}else if(this.fragmentEditor.mainContainer.getSelectedLayer()){var o=t(s.currentTarget).data("align");switch(o){case"left":case"center":case"right":this.horizontalAlign(o,!0);break;case"top":case"middle":case"bottom":this.verticalAlign(o,!0)}}},this)),this.fields.align.on("nextendChange",t.proxy(function(){switch(e.removeClass("n2-active"),this.fields.align.val()){case"left":e.eq(0).addClass("n2-active");break;case"center":e.eq(1).addClass("n2-active");break;case"right":e.eq(2).addClass("n2-active")}},this)),this.fields.valign.on("nextendChange",t.proxy(function(){
5
- switch(i.removeClass("n2-active"),this.fields.valign.val()){case"top":i.eq(0).addClass("n2-active");break;case"middle":i.eq(1).addClass("n2-active");break;case"bottom":i.eq(2).addClass("n2-active")}},this));var r=t.jStorage.get("ss-item-horizontal-align",null),n=t.jStorage.get("ss-item-vertical-align",null);null!=r&&(e.eq(s[r]).addClass("n2-sub-active"),this.layerDefault.align=r),null!=n&&(i.eq(s[n]).addClass("n2-sub-active"),this.layerDefault.valign=n)},i.prototype.horizontalAlign=function(t,e){this.fields.align.val()!=t?this.fields.align.data("field").options.eq(s[t]).trigger("click"):e&&this.fields.left.val(0).trigger("change")},i.prototype.verticalAlign=function(t,e){this.fields.valign.val()!=t?this.fields.valign.data("field").options.eq(s[t]).trigger("click"):e&&this.fields.top.val(0).trigger("change")},i.prototype.initEvents=function(){var e=t("#n2-tab-events"),i=e.find(".n2-h3"),s=i.html(),r=t('<div class="n2-editor-header n2-h2 n2-uc"><span>'+s+"</span></div>");i.replaceWith(r)},i}),N2D("LayerWindow",function(t,e){"use strict";function i(e){this.isMinimized=!1,this.detachedPosition={left:t.jStorage.get("ssPanelLeft")||200,top:t.jStorage.get("ssPanelTop")||100,height:t.jStorage.get("ssPanelHeight")||400},this.hasBreadcrumb=!1,this.lastHeight=this.detachedPosition.height,this.admin=t("#n2-admin"),this.sidebar=t("#n2-ss-layer-window").on("mousedown",t.proxy(N2Classes.WindowManager.setMouseDownArea,null,"sidebarClicked")),this.title=this.sidebar.find(".n2-ss-layer-window-title-inner"),this.fragmentEditor=e,this.viewPanes={layerEdit:t("#n2-tabbed-slide-editor-settings > .n2-tabs").addClass("n2-scrollable")};for(var i in this.viewPanes)this.viewPanes[i].on("DOMMouseScroll mousewheel",function(e){var i=!1;e.originalEvent&&(e.originalEvent.wheelDelta&&(i=e.originalEvent.wheelDelta/-1<0),e.originalEvent.deltaY&&(i=e.originalEvent.deltaY<0),e.originalEvent.detail&&(i=e.originalEvent.detail<0));var s=function(){return e.stopPropagation(),e.preventDefault(),e.returnValue=!1,!1};return!i&&this.scrollHeight<=t(this).innerHeight()+this.scrollTop+1?s():i&&0>=this.scrollTop-1?s():void 0});this.panelHeading=t("#n2-tabbed-slide-editor-settings").find(".n2-sidebar-tab-switcher .n2-td");var s=this.sidebar.find(".n2-ss-layer-window-title-nav-left");t('<a href="#"><i class="n2-i n2-i-minimize n2-i-grey-opacity"></i></a>').on("click",t.proxy(function(t){t.preventDefault(),this.toggleMinimize()},this)).appendTo(s);var r=this.sidebar.find(".n2-ss-layer-window-title-nav-right");t('<a href="#"><i class="n2-i n2-i-closewindow n2-i-grey-opacity"></i></a>').on("click",t.proxy(function(t){t.preventDefault(),this.hide()},this)).appendTo(r),nextend.tooltip.add(r),this.$breadcrumb=t('<div class="n2-ss-layer-window-breadcrumb"></div>').insertAfter("#n2-tabbed-slide-editor-settings > .n2-sidebar-tab-switcher");var n=t("#n2-ss-add-sidebar");t(".n2-ss-add-layer-button").on("click",function(e){e.preventDefault(),t("#n2-ss-layers-switcher > .n2-labels .n2-td").eq(0).trigger("click"),n.toggleClass("n2-active")}),t(".n2-ss-core-item").on("click",function(t){n.removeClass("n2-active")});var o=t("#wpadminbar, .navbar-fixed-top").height()+t(".n2-top-bar").height();this.$verticalBarInner=t(".n2-ss-add-sidebar-inner").each(function(){var e=t(this);e.fixTo(e.parent(),{top:o})}),this.$resizeInnerContainer=t("#n2-ss-layers-switcher_0, #n2-ss-layers-switcher_1"),this.extraHeightToRemove=60,this.$resizeInnerContainer.length||(this.extraHeightToRemove=0,this.$resizeInnerContainer=this.$verticalBarInner),this.$resizeInnerContainer.css("overflow","auto"),this.detach(),t("#n2-admin").on("resize",t.proxy(this.resizeVerticalBar,this)),t(window).on("resize",t.proxy(this.onResize,this)),t(".n2-ss-slide-duplicate-layer").on("click",t.proxy(function(t){t.preventDefault(),this.duplicate()},this.fragmentEditor)),t(".n2-ss-slide-delete-layer").on("click",t.proxy(function(t){t.preventDefault(),this["delete"]()},this.fragmentEditor)),t("body").on("mousedown",t.proxy(function(t){"main"==N2Classes.WindowManager.get().getCurrentWindow()&&N2Classes.WindowManager.get().mouseDownArea===!1&&this.hide()},this));var a=t('<div id="n2-ss-devicespecific-settings"></div>'),l=this.fragmentEditor.editor.getAvailableDeviceModes();for(var i in l)if(l[i]){var h=i.replace(/([A-Z])/g," $1").split(" "),d=h[0],p=h[1].toLowerCase();a.append('<i class="n2-i n2-it n2-i-mini-'+d+"-"+p+'" data-device="'+d+'" data-orientation="'+p+'"></i>')}var c={mouseenter:t.proxy(function(t){a.appendTo(t.currentTarget)},this),mouseleave:t.proxy(function(t){a.detach()},this)};this.sidebar.find("[data-devicespecific] label").prepend('<span class="n2-i n2-i-mini-desktop-portrait"></span>'),this.sidebar.find("[data-devicespecific] label").on(c),a.find(".n2-i").on({click:t.proxy(function(e){e.preventDefault();var i=t(e.currentTarget);t("#n2-ss-devices").find('[data-device="'+i.data("device")+'"][data-orientation="'+i.data("orientation")+'"]').trigger("click")},this)})}return i.prototype.toggleMinimize=function(){this.isMinimized=!this.isMinimized,this.sidebar.toggleClass("n2-ss-layer-window-minized",this.isMinimized),this.isMinimized||this.onResize()},i.prototype.magnetize=function(){if(!this.autoPosition){this.autoPosition=1,t.jStorage.set("ssPanelAutoPosition",1),this.magnet.css("display","none");var e=this.fragmentEditor.mainContainer.getSelectedLayer();e&&e.positionSidebar()}},i.prototype.show=function(e,i){this.setTitle(e),t("body").addClass("n2-ss-layer-edit-visible")},i.prototype._show=function(){t("body").addClass("n2-ss-layer-edit-visible")},i.prototype.hide=function(){t("body").removeClass("n2-ss-layer-edit-visible")},i.prototype.isVisible=function(){return t("body").hasClass("n2-ss-layer-edit-visible")},i.prototype.hideWithDeferred=function(e){t("body").hasClass("n2-ss-layer-edit-visible")&&(this.hide(),e.done(t.proxy(this._show,this)))},i.prototype.setTitle=function(t){this.title.html(t.getName()),this.updateGroupTitle(t)},i.prototype.updateGroupTitle=function(e){var i;for(this.$breadcrumb.html(""),i=0;5>i&&(t('<span class="n2-window-title-structure-nav"><span>'+e.label+'</span><span class="n2-i n2-it n2-i-mini-arrow-thin"></span></span>').on({mouseenter:t.proxy(function(){this.fragmentEditor.highlight(this)},e),mouseleave:t.proxy(function(){this.fragmentEditor.deHighlight(this)},e),click:t.proxy(function(t){this.fragmentEditor.deHighlight(this),this.activate(t)},e)}).prependTo(this.$breadcrumb),e.group&&e.group!==this.fragmentEditor.mainContainer);i++)e=e.group;this.hasBreadcrumb=i>0,this.$breadcrumb.toggleClass("n2-has-breadcrumb",this.hasBreadcrumb),this.onResize()},i.prototype.getLayerEditExcludedHeight=function(){return 85+(this.hasBreadcrumb?23:0)},i.prototype.resizeVerticalBar=function(){this.$resizeInnerContainer.height((window.innerHeight||document.documentElement.clientHeight)-(t("#n2-ss-layers").is(":visible")&&t("#n2-ss-layers").hasClass("n2-active")?t("#n2-ss-layers").height():0)-t("#wpadminbar, .navbar-fixed-top").height()-t(".n2-top-bar").height()-this.extraHeightToRemove)},i.prototype.onResize=function(){this.sidebar.css("display","block"),this.resizeVerticalBar();var t=window.innerHeight||document.documentElement.clientHeight,e=this.sidebar.height()-this.getLayerEditExcludedHeight();this.viewPanes.layerEdit.height(e);var i={},s=window.innerWidth||document.documentElement.clientWidth,r=this.sidebar[0].getBoundingClientRect();r.left<0?i.left=0:r.left+r.width>s&&(i.left=Math.max(0,s-r.width)),r.height>t-r.top&&(i.top=t-r.top-r.height+r.top,i.top<0&&(this.lastHeight=i.height=r.height+i.top,i.top=0)),this.sidebar.css(i),this.sidebar.css("display","")},i.prototype.detach=function(){this.sidebar.css(this.detachedPosition),this.sidebar.appendTo(this.admin),this.admin.addClass("n2-sidebar-hidden"),t(window).off(".n2-ss-panel"),this.sidebar.removeClass("n2-sidebar-fixed"),this.sidebar.nUIDraggable({distance:5,handle:".n2-ss-layer-window-title",containment:"window",stop:t.proxy(function(e,i){this.sidebar.css("height",this.lastHeight);var s=this.sidebar[0].getBoundingClientRect();this.detachedPosition.left=s.left,this.detachedPosition.top=s.top,t.jStorage.set("ssPanelLeft",s.left),t.jStorage.set("ssPanelTop",s.top)},this),scroll:!1}).nUIResizable({distance:5,handles:"s",stop:t.proxy(function(e,i){this.lastHeight=this.detachedPosition.height=this.sidebar.height(),t.jStorage.set("ssPanelHeight",this.detachedPosition.height)},this),create:t.proxy(function(e,i){t(e.target).find(".nui-resizable-handle").addClass("n2-ss-layer-window-resizer")},this)}),this.onResize(),nextend.triggerResize()},i.prototype.switchTab=function(t){this.panelHeading.filter('[data-tab="'+t+'"]').trigger("click")},i}),N2D("PositionDisplay",function(t,e){"use strict";function i(){this.currentSource="",t(window).ready(t.proxy(this._ready,this))}return i.prototype._ready=function(){this.$body=t("body"),this.$el=t('<div class="n2 n2-ss-position-display"/>').appendTo("body")},i.prototype.show=function(t){""==this.currentSource&&(this.currentSource=t,this.$el.addClass("n2-active"),this.$body.addClass("n2-position-display-active"))},i.prototype.update=function(t,e,i){this.currentSource==e&&this.$el.html(i).css({left:t.pageX+10,top:t.pageY+10})},i.prototype.hide=function(t){this.currentSource!=t&&t!==e||(this.$body.removeClass("n2-position-display-active"),this.$el.removeClass("n2-active"),this.currentSource="")},i.get=function(){var t=new i;return i.get=function(){return t},t},i}),N2D("Ruler",function(t,e){"use strict";function i(e,i){this.editor=e,this.showGuides=1,this.guides=[],this.container=t('<div class="n2-ruler-container" />').appendTo("#n2-ss-slide-canvas-container-inner .n2-ss-slider-outer-container"),this.scale=10,this.vertical=t('<div class="n2-ruler n2-ruler-vertical n2-unselectable"></div>').appendTo(".n2-ss-slider-real-container"),this.horizontal=t('<div class="n2-ruler n2-ruler-horizontal n2-unselectable"></div>').appendTo(this.container),this.verticalSpans=t(),this.horizontalSpans=t(),this.onResize(),t(window).on("resize",t.proxy(this.onResize,this)),this.horizontal.on("mousedown",t.proxy(function(t){this.showGuides&&new r(this,this.horizontal,t)},this)),this.vertical.on("mousedown",t.proxy(function(t){this.showGuides&&new n(this,this.vertical,t)},this));try{i=t.extend({vertical:[],horizontal:[]},JSON.parse(N2Classes.Base64.decode(i)));for(var s=0;s<i.horizontal.length;s++){var o=new r(this,this.horizontal);o.setPosition(i.horizontal[s])}for(var s=0;s<i.vertical.length;s++){var o=new n(this,this.vertical);o.setPosition(i.vertical[s])}}catch(a){}this.measureToolVertical(),this.measureToolHorizontal()}function s(e,i,s){this.ruler=e,this.container=i,this.position=0,this.guide=t('<div class="n2-ruler-guide n2-ruler-user-guide"><div class="n2-ruler-guide-border"></div><div class="n2-ruler-guide-handle"></div></div>').appendTo(i).on("mousedown",t.proxy(function(t){t.preventDefault(),t.stopPropagation(),e.editor.fragmentEditor.canvasSettings.settings["n2-ss-lock-guides"]||this["delete"]()},this)),this.ruler.addGuide(this),s&&this.create(s)}function r(){s.prototype.constructor.apply(this,arguments)}function n(){s.prototype.constructor.apply(this,arguments)}return i.prototype.addGuide=function(t){this.guides.push(t)},i.prototype.removeGuide=function(e){this.guides.splice(t.inArray(e,this.guides),1)},i.prototype.clearGuides=function(){for(var t=this.guides.length-1;t>=0;t--)this.guides[t]["delete"]()},i.prototype.onResize=function(){var e=t(".n2-ss-slider-outer-container"),i=e.width(),s=e.height();this.container.css({width:i+40,height:s+40});for(var r=this.horizontalSpans.length-3;r<i/this.scale;r++){var n=t("<span />").appendTo(this.horizontal);r%10==0?n.addClass("n2-ss-ruler-mark-large").append("<span>"+r/10*100+"</span>"):r%2==0&&n.addClass("n2-ss-ruler-mark-medium"),this.horizontalSpans=this.horizontalSpans.add(n)}for(var r=this.verticalSpans.length-3;r<s/this.scale;r++){var n=t("<span />").appendTo(this.vertical);r%10==0?n.addClass("n2-ss-ruler-mark-large").append("<span>"+r/10*100+"</span>"):r%2==0&&n.addClass("n2-ss-ruler-mark-medium"),this.verticalSpans=this.verticalSpans.add(n)}},i.prototype.toArray=function(){for(var t={horizontal:[],vertical:[]},e=0;e<this.guides.length;e++)this.guides[e]instanceof r?t.horizontal.push(this.guides[e].position):this.guides[e]instanceof n&&t.vertical.push(this.guides[e].position);return t},i.prototype.measureToolVertical=function(){var e=t('<div class="n2-ruler-guide" style="z-index:1;"><div class="n2-ruler-guide-border" style="border-color: #f00;"></div></div>').css("display","none").appendTo(this.vertical),i=!1,s=t.proxy(function(){i||(i=!0,e.css("display",""),N2Classes.PositionDisplay.get().show("Guide"))},this),r=t.proxy(function(){i&&(i=!1,e.css("display","none"),N2Classes.PositionDisplay.get().hide("Guide"))},this);this.vertical.on({mouseenter:t.proxy(function(i){if(this.showGuides){var n=0,o=Math.round(this.vertical.offset().top);s(),this.vertical.on("mousemove.n2-ruler-measure-tool",t.proxy(function(i){if(t(i.target).hasClass("n2-ruler-guide-border")&&t(i.target).parent()[0]!=e[0])r();else if(s(),n!=i.pageY){var a=i.pageY-o;e.css("top",a),N2Classes.PositionDisplay.get().update(i,"Guide",a-40+"px"),n=i.pageY}},this))}},this),mouseleave:t.proxy(function(){this.vertical.off(".n2-ruler-measure-tool"),r()},this)})},i.prototype.measureToolHorizontal=function(){var e=t('<div class="n2-ruler-guide" style="z-index:1;"><div class="n2-ruler-guide-border" style="border-color: #f00;"></div></div>').css("display","none").appendTo(this.horizontal),i=!1,s=t.proxy(function(){i||(i=!0,e.css("display",""),N2Classes.PositionDisplay.get().show("Guide"))},this),r=t.proxy(function(){i&&(i=!1,e.css("display","none"),N2Classes.PositionDisplay.get().hide("Guide"))},this);this.horizontal.on({mouseenter:t.proxy(function(i){if(this.showGuides){var n=0,o=Math.round(this.horizontal.offset().left);s(),this.horizontal.on("mousemove.n2-ruler-measure-tool",t.proxy(function(i){if(t(i.target).hasClass("n2-ruler-guide-border")&&t(i.target).parent()[0]!=e[0])r();else if(s(),n!=i.pageX){var a=Math.max(i.pageX-o,40);e.css("left",a),N2Classes.PositionDisplay.get().update(i,"Guide",a-40+"px"),n=i.pageX}},this))}},this),mouseleave:t.proxy(function(){this.horizontal.off(".n2-ruler-measure-tool"),r()},this)})},s.prototype._position=function(t,e){return Math.max(0,t)},s.prototype.setPosition=function(t){this.position=t,this.refresh()},s.prototype.refresh=function(){this.positionRender(this.position)},s.prototype["delete"]=function(){this.ruler.removeGuide(this),this.guide.remove()},r.prototype=Object.create(s.prototype),r.prototype.constructor=r,r.prototype.create=function(t){var e=Math.round(this.container.offset().left)+40;this.position=this._position(t.pageX-e,t),this.positionRender(this.position)},r.prototype.rawPositionRender=function(t){this.guide.css("left",Math.max(0,t)+40)},r.prototype.positionRender=function(t){this.guide.css("left",Math.max(0,t)+40)},n.prototype=Object.create(s.prototype),n.prototype.constructor=n,n.prototype.create=function(t){var e=Math.round(this.container.offset().top)+40;this.position=this._position(t.pageY-e,t),this.positionRender(this.position)},n.prototype.rawPositionRender=function(t){this.guide.css("top",Math.max(0,t)+40)},n.prototype.positionRender=function(t){this.guide.css("top",Math.max(0,t)+40)},i}),N2D("CanvasSettings",function(t,e){"use strict";function i(e){this.fragmentEditor=e,this.settings={};var i=t("#n2-ss-slide-canvas-settings").on("mouseleave",t.proxy(function(){i.removeClass("n2-active")},this));i.find("> a").on("click",function(t){t.preventDefault(),i.toggleClass("n2-active")}),this.$settingsPanel=i.find(".n2-ss-settings-panel-inner"),this.snapTo(),this.roundTo(),this.colorScheme(),this.fragmentEditor.editor.options.isAddSample||this.startRuler()}return i.prototype._addSettings=function(e,i,s,r){this.settings[e]=parseInt(t.jStorage.get(e,s));var n=t('<a href="#">'+i+'<span class="n2-setting-tick"><i class="n2-i n2-it n2-i-tick2"></i></span></a>').on("click",t.proxy(function(i){i.preventDefault(),this.settings[e]=1==this.settings[e]?0:1,t.jStorage.set(e,this.settings[e]),n.toggleClass("n2-setting-enabled",1==this.settings[e]),r(this.settings[e],!1)},this)).appendTo(this.$settingsPanel);n.toggleClass("n2-setting-enabled",1==this.settings[e]),r(this.settings[e],!0)},i.prototype._addAction=function(e,i){t('<a href="#" class="n2-panel-action">'+e+"</a>").on("click",t.proxy(function(t){t.preventDefault(),i()},this)).appendTo(this.$settingsPanel)},i.prototype.get=function(t){return this.settings[t]},i.prototype.snapTo=function(){this._addSettings("n2-ss-snap-to-enabled",n2_("Smart Snap"),1,t.proxy(function(t){for(var e=this.mainContainer.container.getSortedLayers(),i=0;i<e.length;i++)e[i].placement.doAction("snap")},this.fragmentEditor))},i.prototype.roundTo=function(){this._addSettings("n2-ss-round-to-enabled",n2_("Round to 5px"),1,function(t){1==t?nextend.roundTo=5:nextend.roundTo=1})},i.prototype.colorScheme=function(){var e=t("#n2-ss-slide-canvas-container");this._addSettings("n2-ss-theme-dark",n2_("Dark Mode"),0,function(t){e.toggleClass("n2-ss-theme-dark",1==t)})},i.prototype.startRuler=function(){this.ruler=new N2Classes.Ruler(this.fragmentEditor.editor,t("#slideguides").val());var e=t("#n2-ss-slide-canvas-container");this._addSettings("n2-ss-ruler-enabled",n2_("Ruler"),1,t.proxy(function(t){e.toggleClass("n2-ss-has-ruler",1==t),nextend.triggerResize()},this)),this._addSettings("n2-ss-show-guides",n2_("Show Guides"),1,t.proxy(function(t){this.ruler.showGuides=t,e.toggleClass("n2-ss-show-guides",1==t)},this)),this._addSettings("n2-ss-lock-guides",n2_("Lock Guides"),0,t.proxy(function(t){e.toggleClass("n2-ss-lock-guides",1==t)},this)),this._addAction(n2_("Clear Guides"),t.proxy(function(){this.ruler.clearGuides()},this))},i}),N2D("PlacementAbsolute",["PlacementAbstract"],function(t,e){"use strict";function i(t,e,i){this.type="absolute",this.transferredProperties={},N2Classes.PlacementAbstract.prototype.constructor.apply(this,arguments),this.doThrottledTheResize=this.doTheResize,this._triggerLayerResizedThrottled=NextendThrottle(this._triggerLayerResized,30),this.parentIsVisible=!0,this.children=[]}var s=function(){var t=0;return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){var i,s=(new Date).getTime();return i=Math.max(0,16-(s-t)),t=s+i,setTimeout(function(){e(s+i)},i)}}(),r={raf:!1,ratios:null,isThrottled:!1,layers:[]},n=function(){r.raf===!1&&(r.raf=!0,s(function(){for(var t=0;t<r.layers.length;t++)r.layers[t].isDeleted||r.layers[t].doTheResize(r.ratios,!0,r.isThrottled);r={raf:!1,ratios:null,isThrottled:!1,layers:[]}}))};return i.prototype=Object.create(N2Classes.PlacementAbstract.prototype),i.prototype.constructor=i,i.prototype.start=function(){this.$layer=this.layer.layer,this.$layerRow=this.layer.layerRow},i.prototype.preActivation=function(t){if("normal"==t.type){var e=this.layer.getProperty("height");e>0&&(this.transferredProperties.height=e)}},i.prototype.activated=function(e){var i=this.$layer.data("parentid");if(i){var s=t("#"+i);s.length>0?this.activatedAfterParentReady(e):setTimeout(t.proxy(function(){this.activatedAfterParentReady(e)},this),300)}else this._activated(e)},i.prototype.activatedAfterParentReady=function(e){var i=this.$layer.data("parentid");if(i){var s=t("#"+i);if(s.length>0){var r=s.data("layerObject");r?r.readyDeferred.done(t.proxy(this._activated,this,e)):s.on("layerStarted",t.proxy(function(i,s){s.readyDeferred.done(t.proxy(this._activated,this,e))},this))}else this.$layer.data("parentid",""),this._activated(e)}else this._activated(e)},i.prototype._activated=function(e){this.loadProperties(t.extend(e,this.transferredProperties)),this.transferredProperties={},this.$layer.css("zIndex",""),this.___makeLayerAlign(),this.___makeLayerResizeable()},i.cleanLayer=function(t){var e=["desktopPortrait","desktopLandscape","tabletPortrait","tabletLandscape","mobilePortrait","mobileLandscape"];t.removeAttr("data-align").removeAttr("data-valign").css({left:"",top:"",right:"",bottom:"",width:"",height:"","text-align":""});for(var i=["parentid","responsiveposition","responsivesize","parentalign","parentvalign","align","valign","left","top","width","height"],s={},r=0;r<i.length;r++){var n=i[r].toLowerCase();s[n]=t.data(n),t.removeAttr(n),t.removeData(n);for(var o=0;o<e.length;o++){var a=e[o].toLowerCase();s[a+n]=t.data(a+n),t.removeAttr(a+n),t.removeData(a+n)}}return s},i.prototype.deActivated=function(t){var e=this.layer.getProperty("parentid");e&&""!=e&&(this.$layer.removeAttr("data-parentid"),this.unSubscribeParent()),this.$layer.removeAttr("data-align").removeAttr("data-valign").css({left:"",top:"",right:"",bottom:"",width:"",height:"","text-align":""}),this.alignMarker.remove(),this.$layer.nUIResizable("destroy"),this.$layer.off(".n2-ss-absolute"),this.$layer.triggerHandler("LayerUnavailable");var i=["parentid","responsiveposition","responsivesize","parentalign","parentvalign","align","valign","left","top","width","height"],s=this.layer.getPropertiesData(i);return this.layer.removeProperties(i),this.chainParent.remove(),s},i.prototype.loadProperties=function(e){this.layer.createProperty("parentid",null,this.layer.layer,this),this.layer.createProperty("responsiveposition",1,this.layer.layer,this),this.layer.createProperty("responsivesize",1,this.layer.layer,this),this.layer.createDeviceProperty("parentalign",{desktopPortrait:"center"},this.layer.layer,this),this.layer.createDeviceProperty("parentvalign",{desktopPortrait:"middle"},this.layer.layer,this),this.layer.createDeviceProperty("align",{desktopPortrait:e.align||"center"},this.layer.layer,this),this.layer.createDeviceProperty("valign",{desktopPortrait:e.valign||"middle"},this.layer.layer,this),this.layer.createDeviceProperty("left",{desktopPortrait:e.left||0},this.layer.layer,this),this.layer.createDeviceProperty("top",{desktopPortrait:e.top||0},this.layer.layer,this),this.layer.createDeviceProperty("width",{desktopPortrait:e.width||"auto"},this.layer.layer,this),this.layer.createDeviceProperty("height",{desktopPortrait:e.height||"auto"},this.layer.layer,this);var i=this.layer.layer;this.subscribeParentCallbacks={},this.layer.getProperty("parentid")&&this.subscribeParent(),i.attr({"data-align":this.layer.getProperty("align"),"data-valign":this.layer.getProperty("valign")});var s=null;this.chainParent=t('<div class="n2-ss-layer-chain-parent n2-button n2-button-icon n2-button-xs n2-radius-s n2-button-blue"><i class="n2-i n2-i-layerunlink"></i></div>').on({click:t.proxy(this.unlink,this),mouseenter:t.proxy(function(){s=t("#"+this.layer.getProperty("parentid")).addClass("n2-highlight")},this),mouseleave:t.proxy(function(){s&&(s.removeClass("n2-highlight"),s=null)},this)}).appendTo(this.$layer)},i.prototype.triggerLayerResized=function(t,e){t?this._triggerLayerResized(t,e):this._triggerLayerResizedThrottled(!0,e)},i.prototype._triggerLayerResized=function(t,e){this.layer.isDeleted||this.$layer.triggerHandler("LayerResized",[e||{slideW:this.fragmentEditor.getResponsiveRatioHorizontal(),slideH:this.fragmentEditor.getResponsiveRatioVertical()},t||!1])},i.prototype.___makeLayerAlign=function(){this.alignMarker=t('<div class="n2-ss-layer-cc" />').appendTo(this.$layer)},i.prototype.___makeLayerResizeable=function(){this._resizableJustClick=!1,this.$layer.nUIResizable({handles:"n, e, s, w, ne, se, sw, nw",_containment:this.fragmentEditor.mainContainer.layer,start:t.proxy(this.____makeLayerResizeableStart,this),resize:t.proxy(this.____makeLayerResizeableResize,this),stop:t.proxy(this.____makeLayerResizeableStop,this),create:t.proxy(function(){this.$layer.find(".nui-resizable-handle, .n2-ss-layer-cc").on({mousedown:t.proxy(function(t){this._resizableJustClick=[t.clientX,t.clientY]},this),mouseup:t.proxy(function(e){if(this._resizableJustClick&&Math.abs(Math.sqrt(Math.pow(this._resizableJustClick[0]-e.clientX,2)+Math.pow(this._resizableJustClick[1]-e.clientY,2)))<1){var i=t(e.currentTarget),s=this.fragmentEditor.layerOptions.layerFeatures;i.hasClass("nui-resizable-nw")?(s.horizontalAlign("left",!1),s.verticalAlign("top",!1)):i.hasClass("nui-resizable-w")?(s.horizontalAlign("left",!1),s.verticalAlign("middle",!1)):i.hasClass("nui-resizable-sw")?(s.horizontalAlign("left",!1),s.verticalAlign("bottom",!1)):i.hasClass("nui-resizable-n")?(s.horizontalAlign("center",!1),s.verticalAlign("top",!1)):i.hasClass("n2-ss-layer-cc")?(s.horizontalAlign("center",!1),s.verticalAlign("middle",!1)):i.hasClass("nui-resizable-s")?(s.horizontalAlign("center",!1),s.verticalAlign("bottom",!1)):i.hasClass("nui-resizable-ne")?(s.horizontalAlign("right",!1),s.verticalAlign("top",!1)):i.hasClass("nui-resizable-e")?(s.horizontalAlign("right",!1),s.verticalAlign("middle",!1)):i.hasClass("nui-resizable-se")&&(s.horizontalAlign("right",!1),s.verticalAlign("bottom",!1))}this._resizableJustClick=!1},this)})},this),smartguides:t.proxy(function(){return this.$layer.triggerHandler("LayerParent"),this.fragmentEditor.getSnap()},this),tolerance:5}).on({"mousedown.n2-ss-absolute":t.proxy(function(t){!this.layer.status!=N2Classes.ComponentAbstract.STATUS.LOCKED&&(N2Classes.PositionDisplay.get().show("Canvas"),N2Classes.PositionDisplay.get().update(t,"Canvas","W: "+parseInt(this.$layer.width())+"px<br />H: "+parseInt(this.$layer.height())+"px")),document.activeElement&&document.activeElement.blur()},this),"mouseup.n2-ss-absolute":t.proxy(function(t){N2Classes.PositionDisplay.get().hide("Canvas")},this)})},i.prototype.____makeLayerResizeableStart=function(e,i){this.preventActivation=!0,this.resizableDeferred=t.Deferred(),this.fragmentEditor.layerWindow.hideWithDeferred(this.resizableDeferred),t("body").addClass("n2-ss-resize-layer"),this._resizableJustClick&&(this._resizableJustClick=!1),this.____makeLayerResizeableResize(e,i),N2Classes.PositionDisplay.get().show("Canvas")},i.prototype.____makeLayerResizeableResize=function(t,e){N2Classes.PositionDisplay.get().update(t,"Canvas","W: "+e.size.width+"px<br />H: "+e.size.height+"px"),this.triggerLayerResized()},i.prototype.____makeLayerResizeableStop=function(e,i){t("body").removeClass("n2-ss-resize-layer"),this.resizableDeferred.resolve();var s=!1;if("n"==i.axis||"s"==i.axis||i.originalSize.width==i.size.width){var r=this.layer.getProperty("width");this.layer.isDimensionPropertyAccepted(r)&&(s=!0,this._syncwidth())}var n=!1;if("e"==i.axis||"w"==i.axis||i.originalSize.height==i.size.height){var r=this.layer.getProperty("height");this.layer.isDimensionPropertyAccepted(r)&&(n=!0,this._syncheight())}var o=this.fragmentEditor.getResponsiveRatioHorizontal(),a=this.fragmentEditor.getResponsiveRatioVertical();parseInt(this.layer.getProperty("responsivesize"))||(o=a=1);var l=null;s||(l=Math.round(i.size.width*(1/o)));var h=null;n||(h=Math.round(i.size.height*(1/a))),this._setPosition(null,null,i.position.left,i.position.top,l,h,!0),this.triggerLayerResized(),this.$layer.triggerHandler("LayerUnParent"),N2Classes.PositionDisplay.get().hide("Canvas"),setTimeout(t.proxy(function(){this.preventActivation=!1},this),80)},i.prototype._setPosition=function(t,e,i,s,r,n,o){var a=this.layer.getMode();null===t&&(t=this.layer.getProperty("align")),null===e&&(e=this.layer.getProperty("valign")),null===i?i=this.layer.getProperty("left"):o&&(i=this.calculatePositionLeft(t,i)),null===s?s=this.layer.getProperty("top"):o&&(s=this.calculatePositionTop(e,s)),null===r&&(r=this.layer.getProperty("width")),null===n&&(n=this.layer.getProperty("height"));var l=N2Classes.History.get().addValue(this.layer,this.layer.historyStoreOnPlacement,["historyStorePosition",a]);l&&l.setValues({align:this.layer.getRawProperty("align"),valign:this.layer.getRawProperty("valign"),left:this.layer.getRawProperty("left"),top:this.layer.getRawProperty("top"),width:this.layer.getRawProperty("width"),height:this.layer.getRawProperty("height")},{align:t,valign:e,left:i,top:s,width:r,height:n}),N2Classes.History.get().off(),this.layer.store("width",r,!0,"layer"),this.layer.$.trigger("propertyChanged",["width",r]),this.layer.store("height",n,!0,"layer"),this.layer.$.trigger("propertyChanged",["height",n]),this.layer.store("align",t,!0,"layer"),this.layer.$.trigger("propertyChanged",["align",t]),this.layer.store("valign",e,!0,"layer"),this.layer.$.trigger("propertyChanged",["valign",e]),this.layer.store("left",i,!0,"layer"),this.layer.$.trigger("propertyChanged",["left",i]),this.layer.store("top",s,!0,"layer"),this.layer.$.trigger("propertyChanged",["top",s]),N2Classes.History.get().on()},i.prototype.historyStorePosition=function(t,e){this.layer.historyStore(t.align,"align",e),this.layer.historyStore(t.valign,"valign",e),this.layer.historyStore(t.width,"width",e),this.layer.historyStore(t.height,"height",e),this.layer.historyStore(t.left,"left",e),this.layer.historyStore(t.top,"top",e),this.triggerLayerResized()},i.prototype.calculatePositionLeft=function(t,e){var i=this.fragmentEditor.getResponsiveRatioHorizontal();parseInt(this.layer.getProperty("responsiveposition"))||(i=1);var s=this.parent,r={left:0,leftMultiplier:1};if(s&&s.is(":visible")){var n=s.position();switch(this.layer.getProperty("parentalign")){case"right":r.left=n.left+s.width();break;case"center":r.left=n.left+s.width()/2;break;default:r.left=n.left}}else switch(s=this.$layer.parent(),t){case"center":r.left+=s.width()/2;break;case"right":r.left+=s.width()}var e;switch(t){case"left":e=-Math.round((r.left-e)*(1/i));break;case"center":e=-Math.round((r.left-e-this.$layer.width()/2)*(1/i));break;case"right":e=-Math.round((r.left-e-this.$layer.width())*(1/i))}return e},i.prototype.calculatePositionTop=function(t,e){var i=this.fragmentEditor.getResponsiveRatioVertical();parseInt(this.layer.getProperty("responsiveposition"))||(i=1);var s=this.parent,r={top:0,topMultiplier:1};if(s&&s.is(":visible")){var n=s.position();switch(this.layer.getProperty("parentvalign")){case"bottom":r.top=n.top+s.height();break;case"middle":r.top=n.top+s.height()/2;break;default:r.top=n.top}}else switch(s=this.$layer.parent(),t){case"middle":r.top+=s.height()/2;break;case"bottom":r.top+=s.height()}var e;switch(t){case"top":e=-Math.round((r.top-e)*(1/i));break;case"middle":e=-Math.round((r.top-e-this.$layer.height()/2)*(1/i));break;case"bottom":e=-Math.round((r.top-e-this.$layer.height())*(1/i))}return e},i.prototype.moveX=function(t){this._setPosition(null,null,this.layer.getProperty("left")+t,null,null,null,!1)},i.prototype.moveY=function(t){this._setPosition(null,null,null,this.layer.getProperty("top")+t,null,null,!1)},i.prototype.setPositionLeft=function(t){t=this.calculatePositionLeft(this.layer.getProperty("align"),t),this.layer.store("left",t,!0),this.layer.$.trigger("propertyChanged",["left",t])},i.prototype.setPositionTop=function(t){t=this.calculatePositionTop(this.layer.getProperty("valign"),t),this.layer.store("top",t,!0),this.layer.$.trigger("propertyChanged",["top",t])},i.prototype.setPosition=function(t,e){this.setPositionLeft(t),this.setPositionTop(e)},i.prototype.setDeviceBasedAlign=function(){var t=this.layer.getMode();"undefined"==typeof this.layer.deviceProperty[t].align&&this.layer.setProperty("align",this.layer.getProperty("align"),"layer"),"undefined"==typeof this.layer.deviceProperty[t].valign&&this.layer.setProperty("valign",this.layer.getProperty("valign"),"layer")},i.prototype.setPropertyresponsiveposition=i.prototype.setPropertyresponsivesize=function(t,e,i){this.layer._setProperty(t,parseInt(e),i)},i.prototype.setPropertywidth=i.prototype.setPropertyheight=function(e,i,s){var r=i;this.layer.isDimensionPropertyAccepted(i)||(r=~~i,r!=i&&this.layer.$.trigger("propertyChanged",[e,r])),setTimeout(t.proxy(function(){this.onResize(!1)},this),50),this.layer._setProperty(e,r,s)},i.prototype.setPropertyleft=i.prototype.setPropertytop=function(t,e,i){var s=~~e;s!=e&&this.layer.$.trigger("propertyChanged",[t,s]),this.layer._setProperty(t,s,i)},i.prototype.render=function(t){this["_sync"+t]()},i.prototype.renderWithModifier=function(t,e,i){try{"width"!=t&&"height"!=t||!this.layer.isDimensionPropertyAccepted(e)?this["_sync"+t](Math.round(e*i)):this["_sync"+t](e);
6
- }catch(s){console.error("_sync"+t)}},i.prototype.onResize=function(t){this.resize({slideW:this.fragmentEditor.getResponsiveRatioHorizontal(),slideH:this.fragmentEditor.getResponsiveRatioVertical()},t)},i.prototype.resize=function(t,e){this.parent&&!e||this.addToResizeCollection(this,t,!1)},i.prototype.addToResizeCollection=function(t,e,i){r.ratios=e,r.isThrottled=i;for(var s=0;s<r.layers.length;s++)if(r.layers[s]==this){r.layers.splice(s,1);break}r.layers.push(t),n(),this.triggerLayerResized(i,e)},i.prototype._syncresponsiveposition=function(){this.onResize(!1)},i.prototype._syncwidth=function(){var t=this.layer.getProperty("width");if(!this.layer.isDimensionPropertyAccepted(t)){if(parseInt(this.layer.getProperty("responsivesize"))){var e=this.fragmentEditor.getResponsiveRatioHorizontal();t*=e}t+="px"}this.$layer.css("width",t)},i.prototype._syncheight=function(){var t=this.layer.getProperty("height");if(!this.layer.isDimensionPropertyAccepted(t)){if(parseInt(this.layer.getProperty("responsivesize"))){var e=this.fragmentEditor.getResponsiveRatioVertical();t*=e}t+="px"}this.$layer.css("height",t)},i.prototype._syncparentalign=function(){var t=this.layer.getProperty("parentalign");this.$layer.data("parentalign",t);var e=this.getParent();e&&e.placement.current.onResize(!1)},i.prototype._syncparentvalign=function(){var t=this.layer.getProperty("parentvalign");this.$layer.data("parentvalign",t);var e=this.getParent();e&&e.placement.current.onResize(!1)},i.prototype._syncleft=function(){var t=this.layer.getProperty("left");if(parseInt(this.layer.getProperty("responsiveposition"))){var e=this.fragmentEditor.getResponsiveRatioHorizontal();t*=e}if(this.parent&&this.parentIsVisible){var i=this.parent.position(),s=this.layer.getProperty("align"),r=this.layer.getProperty("parentalign"),n=0;switch(r){case"right":n=i.left+this.parent.width();break;case"center":n=i.left+this.parent.width()/2;break;default:n=i.left}switch(s){case"right":this.$layer.css({left:"auto",right:this.$layer.parent().width()-n-t+"px"});break;case"center":this.$layer.css({left:n+t-this.$layer.width()/2+"px",right:"auto"});break;default:this.$layer.css({left:n+t+"px",right:"auto"})}}else switch(this.layer.getProperty("align")){case"right":this.$layer.css({left:"auto",right:-t+"px"});break;case"center":this.$layer.css({left:this.$layer.parent().width()/2+t-this.$layer.width()/2+"px",right:"auto"});break;default:this.$layer.css({left:t+"px",right:"auto"})}this.triggerLayerResized()},i.prototype._synctop=function(){var t=this.layer.getProperty("top");if(parseInt(this.layer.getProperty("responsiveposition"))){var e=this.fragmentEditor.getResponsiveRatioVertical();t*=e}if(this.parent&&this.parentIsVisible){var i=this.parent.position(),s=this.layer.getProperty("valign"),r=this.layer.getProperty("parentvalign"),n=0;switch(r){case"bottom":n=i.top+this.parent.height();break;case"middle":n=i.top+this.parent.height()/2;break;default:n=i.top}switch(s){case"bottom":this.$layer.css({top:"auto",bottom:this.$layer.parent().height()-n-t+"px"});break;case"middle":this.$layer.css({top:n+t-this.$layer.height()/2+"px",bottom:"auto"});break;default:this.$layer.css({top:n+t+"px",bottom:"auto"})}}else switch(this.layer.getProperty("valign")){case"bottom":this.$layer.css({top:"auto",bottom:-t+"px"});break;case"middle":this.$layer.css({top:this.$layer.parent().height()/2+t-this.$layer.height()/2+"px",bottom:"auto"});break;default:this.$layer.css({top:t+"px",bottom:"auto"})}this.triggerLayerResized()},i.prototype._syncresponsivesize=function(){this.onResize(!1)},i.prototype.historyStoreDoubleProp=function(t,e,i,s){var r=this.layer.getMode();e==r?(this.layer._setProperty(i,t.value,"history"),this.layer._setProperty(s,t.value2,"history")):(this.layer.deviceProperty[e][i]=t.value,this.layer.deviceProperty[e][s]=t.value2,this.layer.$.trigger("propertyChanged",[i,this.layer.getProperty(i)]),this.layer.$.trigger("propertyChanged",[s,this.layer.getProperty(s)]),this.layer.render(i,null,"history"),this.layer.render(s,null,"history"))},i.prototype.setPropertyalign=function(t,e,i){var s=this.layer.getProperty(t),r=this.layer.getRawProperty("left");N2Classes.History.get().off(),this.layer._setProperty(t,e,i),N2Classes.History.get().on();var n=N2Classes.History.get().addValue(this.layer,this.layer.historyStoreOnPlacement,["historyStoreDoubleProp",this.layer.getMode(),"align","left"]);n&&n.setValues({value:s,value2:r},{value:e,value2:this.layer.getRawProperty("left")})},i.prototype.setPropertyvalign=function(t,e,i){var s=this.layer.getProperty(t),r=this.layer.getRawProperty("top");N2Classes.History.get().off(),this.layer._setProperty(t,e,i),N2Classes.History.get().on();var n=N2Classes.History.get().addValue(this.layer,this.layer.historyStoreOnPlacement,["historyStoreDoubleProp",this.layer.getMode(),"valign","top"]);n&&n.setValues({value:s,value2:r},{value:e,value2:this.layer.getRawProperty("top")})},i.prototype._syncalign=function(t,e){var i=this.layer.getProperty("align");this.$layer.attr("data-align",i),"history"!==e&&i!=t&&this.setPositionLeft(this.$layer.position().left)},i.prototype._syncvalign=function(t,e){var i=this.layer.getProperty("valign");this.$layer.attr("data-valign",i),"history"!==e&&i!=t&&this.setPositionTop(this.$layer.position().top)},i.prototype.fit=function(){var t=this.$layer.get(0);this.$layer.position();if(t.scrollWidth>0&&t.scrollHeight>0){var e=!1;if(this.layer.item&&(e=this.layer.item.fitLayer()),!e){this.layer.setProperty("width","auto","layer"),this.layer.setProperty("height","auto","layer");var i=this.$layer.width();Math.abs(this.fragmentEditor.mainContainer.layer.width()-this.$layer.position().left-i)<2&&this.layer.setProperty("width",i,"layer")}}},i.prototype.hide=function(t){this.layer.store(t?t:this.layer.getMode(),0,!0)},i.prototype.show=function(t){this.layer.store(t?t:this.layer.getMode(),1,!0)},i.prototype.changeStatus=function(t,e){t==N2Classes.ComponentAbstract.STATUS.LOCKED&&this.layer.nUIResizable("enable"),e==N2Classes.ComponentAbstract.STATUS.LOCKED&&this.$layer.nUIResizable("disable")},i.prototype.getParent=function(){return t("#"+this.layer.getProperty("parentid")).data("layerObject")},i.prototype.subscribeParent=function(){var e=this,i=t("#"+this.layer.property.parentid);this.parent&&!i.is(this.parent)&&(this.parent.off(this.subscribeParentCallbacks),this.parent=!1),this.parent||(this.subscribeParentCallbacks={LayerResized:function(){e.resizeParent.apply(e,arguments)},LayerParent:function(){e.$layer.addClass("n2-ss-layer-parent"),e.$layer.triggerHandler("LayerParent")},LayerUnParent:function(){e.$layer.removeClass("n2-ss-layer-parent"),e.$layer.triggerHandler("LayerUnParent")},LayerDeleted:function(t){e.layer.setProperty("parentid","","layer")},LayerUnavailable:function(t){e.layer.setProperty("parentid","","layer"),e.layer.setProperty("left",0,"layer"),e.layer.setProperty("top",0,"layer")},LayerShowChange:function(t,i,s){e.layer.getMode()==i&&(e.parentIsVisible=s)},"n2-ss-activate":function(){e.$layerRow.addClass("n2-parent-active")},"n2-ss-deactivate":function(){e.$layerRow.removeClass("n2-parent-active")},LayerGetDataWithChildren:function(t,i,s){e.layer.getDataWithChildren(i,s)}},this.parent=i.on(this.subscribeParentCallbacks),this.parent.data("layerObject").placement.current.addChild(this),this.$layer.addClass("n2-ss-layer-has-parent"))},i.prototype.unSubscribeParent=function(t){if(this.$layerRow.removeClass("n2-parent-active"),this.$layer.removeClass("n2-ss-layer-has-parent"),this.parent&&(this.parent.off(this.subscribeParentCallbacks),this.parent=!1,this.subscribeParentCallbacks={},"delete"!=t)){var e=this.$layer.position();this._setPosition(null,null,e.left,e.top,null,null,!0)}},i.prototype.addChild=function(t){this.children.push(t)},i.prototype.removeChild=function(e){this.children.splice(t.inArray(e,this.children),1)},i.prototype.unlink=function(t){t&&t.preventDefault(),this.layer.setProperty("parentid","","layer")},i.prototype.parentPicked=function(t,e,i,s,r){this.layer.setProperty("parentid","","layer"),this.layer.setProperty("align",s,"layer"),this.layer.setProperty("valign",r,"layer"),this.layer.setProperty("parentalign",e,"layer"),this.layer.setProperty("parentvalign",i,"layer"),this.layer.setProperty("parentid",t.requestID(),"layer");var n;for(var o in this.layer.deviceProperty)"desktopPortrait"!=o&&(this.layer.deviceProperty[o].left=n,this.layer.deviceProperty[o].top=n,this.layer.deviceProperty[o].valign=n,this.layer.deviceProperty[o].align=n)},i.prototype._syncparentid=function(){var e=this.layer.getProperty("parentid");if(e&&""!=e)if(0==t("#"+e).length)this.layer.setProperty("parentid","","layer");else{this.$layer.attr("data-parentid",e).addClass("n2-ss-layer-has-parent"),this.subscribeParent();var i=this.$layer.position();this._setPosition(null,null,i.left,i.top,null,null,!0)}else this.$layer.removeAttr("data-parentid"),this.unSubscribeParent()},i.prototype.snap=function(){this.$layer.nextendResizable("option","smartguides",t.proxy(function(){return this.$layer.triggerHandler("LayerParent"),this.fragmentEditor.getSnap()},this))},i.prototype._renderModeProperties=function(t){this.$layer.attr("data-align",this.layer.property.align),this.$layer.attr("data-valign",this.layer.property.valign),t&&this.onResize(!0)},i.prototype.doLinearResize=function(t){this.doThrottledTheResize(t,!0)},i.prototype.doTheResize=function(t,e,i){this.render("width"),this.render("height"),this.render("left"),this.render("top"),e||this.triggerLayerResized(i,t)},i.prototype.resizeParent=function(t,e,i){this.addToResizeCollection(this,e,i)},i.prototype.updatePosition=function(){var t=this.parent;if("center"==this.layer.getProperty("align")){var e=0;e=t?t.position().left+t.width()/2:this.$layer.parent().width()/2;var i=this.fragmentEditor.getResponsiveRatioHorizontal();parseInt(this.layer.getProperty("responsiveposition"))||(i=1),this.$layer.css("left",e-this.$layer.width()/2+this.layer.getProperty("left")*i)}if("middle"==this.layer.getProperty("valign")){var s=0;s=t?t.position().top+t.height()/2:this.$layer.parent().height()/2;var i=this.fragmentEditor.getResponsiveRatioVertical();parseInt(this.layer.getProperty("responsiveposition"))||(i=1),this.$layer.css("top",s-this.$layer.height()/2+this.layer.getProperty("top")*i)}this.triggerLayerResized()},i.prototype.getIndex=function(){var t=parseInt(this.$layer.css("zIndex"));return isNaN(t)&&(t=0),t},i.prototype.renderIndex=function(t){},i.prototype.sync=function(){this._syncalign(null,"history"),this._syncvalign(null,"history"),this._syncwidth(),this._syncheight(),this._synctop(),this._syncleft(),this._syncparentid()},i.prototype["delete"]=function(){var t=this.layer.getProperty("parentid");t&&this.unSubscribeParent("delete")},i.prototype.isParentOrChild=function(){return this.parent||this.children.length>0},i}),N2D("PlacementContent",["PlacementAbstract"],function(t,e){"use strict";function i(t,e,i){this.type="content",N2Classes.PlacementAbstract.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.PlacementAbstract.prototype),i.prototype.constructor=i,i}),N2D("PlacementDefault",["PlacementAbstract"],function(t,e){"use strict";function i(t,e,i){this.type="default",N2Classes.PlacementAbstract.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.PlacementAbstract.prototype),i.prototype.constructor=i,i.prototype.start=function(){this.$layer=this.layer.layer},i.prototype.activated=function(t){this.startUISizing()},i.prototype.deActivated=function(t){this.$layer.nUINormalSizing("destroy")},i.prototype.startUISizing=function(){var e=!1;this.layer.item&&this.layer.item.needSize&&(e=!0),this.$layer.nUINormalSizing({start:t.proxy(function(t,e){N2Classes.PositionDisplay.get().show("NormalSizing"),"maxwidth"===e&&this.layer.layer.attr("data-has-maxwidth","1")},this),resizeMaxWidth:t.proxy(function(t,e){N2Classes.PositionDisplay.get().update(t,"NormalSizing","Max-width: "+(0==e.value?"none":e.value+"px"))},this),stopMaxWidth:t.proxy(function(t,e){N2Classes.PositionDisplay.get().hide("NormalSizing"),this.layer.setProperty("maxwidth",e.value)},this)})},i}),N2D("PlacementNormal",["PlacementAbstract"],function(t,e){"use strict";function i(t,e,i){this.type="normal",this.transferredProperties={},N2Classes.PlacementAbstract.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.PlacementAbstract.prototype),i.prototype.constructor=i,i.prototype.start=function(){this.$layer=this.layer.layer},i.prototype.preActivation=function(t){if("absolute"==t.type&&this.layer.item&&this.layer.item.needSize){var e=this.layer.getProperty("height");e.match&&e.match(/[0-9]+%$/)?this.transferredProperties.height=Math.max(100,parseInt(this.$layer.parent().height()*parseInt(e)/100)):e>0&&(this.transferredProperties.height=e)}},i.prototype.activated=function(e){this.loadProperties(t.extend(e,this.transferredProperties)),this.transferredProperties={},this.layer.$.on("baseSizeUpdated.placementnormal",t.proxy(this._syncmargin,this)),this.layer.$.on("baseSizeUpdated.placementnormal",t.proxy(this._syncheight,this)),this.startUISpacing(),this.startUISizing(),this.$layer.on({mousedown:t.proxy(function(t){t.stopPropagation()})})},i.prototype.loadProperties=function(t){this.layer.createDeviceProperty("margin",{desktopPortrait:"0|*|0|*|0|*|0|*|px+"},this.layer.layer,this),this.layer.createDeviceProperty("height",{desktopPortrait:t.height||0},this.layer.layer,this),this.layer.createDeviceProperty("maxwidth",{desktopPortrait:0},this.layer.layer,this),this.layer.createDeviceProperty("selfalign",{desktopPortrait:"inherit"},this.layer.layer,this)},i.cleanLayer=function(t){var e=["desktopPortrait","desktopLandscape","tabletPortrait","tabletLandscape","mobilePortrait","mobileLandscape"];t.attr("data-has-maxwidth","0").removeAttr("data-cssselfalign").css({position:"",margin:"",height:"",maxWidth:""});for(var i=["margin","height","maxwidth","selfalign"],s={},r=0;r<i.length;r++){var n=i[r].toLowerCase();s[n]=t.data(n),t.removeAttr(n),t.removeData(n);for(var o=0;o<e.length;o++){var a=e[o].toLowerCase();s[n]=t.data(a+n),t.removeAttr(a+n),t.removeData(a+n)}}return s},i.prototype.deActivated=function(t){this.layer.$.off(".placementnormal"),this.$layer.nUISpacing("destroy"),this.$layer.nUINormalSizing("destroy"),this.layer.layer.attr("data-has-maxwidth","0"),this.layer.layer.removeAttr("data-cssselfalign");var e=["margin","height","maxwidth","selfalign"],i=this.layer.getPropertiesData(e);return this.layer.removeProperties(e),this.layer.layer.css({position:"",margin:"",height:"",maxWidth:""}),i},i.prototype._renderModeProperties=function(t){this._syncmargin(),this._syncheight(),this._syncmaxwidth(),this._syncselfalign()},i.prototype._syncmargin=function(){var t=this.layer.getProperty("margin").split("|*|"),e=t.pop(),i=this.layer.baseSize;if("px+"==e&&i>0){e="em";for(var s=0;s<t.length;s++)t[s]=parseInt(t[s])/i}var t=t.join(e+" ")+e;this.layer.layer.css("margin",t),this.layer.update(),this.$layer.nUISpacing("option","current",t)},i.prototype.startUISpacing=function(){this.$layer.nUISpacing({mode:"margin",sync:{n:"margin-top",e:"margin-right",s:"margin-bottom",w:"margin-left"},handles:"n, s, e, w",start:t.proxy(function(t,e){N2Classes.PositionDisplay.get().show("Spacing")},this),spacing:t.proxy(function(t,e){var i="";for(var s in e.changed)i+="Margin "+s+": "+e.changed[s]+"px<br>";N2Classes.PositionDisplay.get().update(t,"Spacing",i)},this),stop:t.proxy(this.onSpacingStop,this)})},i.prototype.onSpacingStop=function(e,i){N2Classes.PositionDisplay.get().hide("Spacing");var s=this.layer.getProperty("margin").split("|*|"),r=1,n=1;"px+"==s[s.length-1]&&Math.abs(parseFloat(this.$layer.css("fontSize"))-this.layer.baseSize)>1&&(r=this.fragmentEditor.getResponsiveRatioHorizontal(),n=this.fragmentEditor.getResponsiveRatioVertical());for(var o in i.changed){var a=i.changed[o];switch(o){case"top":s[0]=Math.round(a/n);break;case"right":s[1]=Math.round(a/r);break;case"bottom":s[2]=Math.round(a/n);break;case"left":s[3]=Math.round(a/r)}}this.layer.setProperty("margin",s.join("|*|")),t("#layernormal-margin").data("field").insideChange(s.join("|*|"))},i.prototype.startUISizing=function(){var e=!1;this.layer.item&&this.layer.item.needSize&&(e=!0),this.$layer.nUINormalSizing({height:e,syncWidth:!0,start:t.proxy(function(t,e){N2Classes.PositionDisplay.get().show("NormalSizing"),"maxwidth"===e&&this.layer.layer.attr("data-has-maxwidth","1")},this),resizeMaxWidth:t.proxy(function(t,e){N2Classes.PositionDisplay.get().update(t,"NormalSizing","Max-width: "+(0==e.value?"none":e.value+"px"))},this),stopMaxWidth:t.proxy(function(t,e){N2Classes.PositionDisplay.get().hide("NormalSizing"),this.layer.setProperty("maxwidth",e.value)},this),resizeHeight:t.proxy(function(t,e){N2Classes.PositionDisplay.get().update(t,"NormalSizing","Height: "+e.value+"px")},this),stopHeight:t.proxy(function(t,e){N2Classes.PositionDisplay.get().hide("NormalSizing");var i=1;parseInt(this.$layer.css("fontSize"))!=this.layer.baseSize&&(i=this.fragmentEditor.getResponsiveRatioHorizontal());var s=Math.round(s/i);this.layer.setProperty("height",e.value)},this)})},i.prototype._syncheight=function(){var t=parseInt(this.layer.getProperty("height"));if(t>0){var e="px",i=this.layer.baseSize;i>0&&(e="em",t=parseInt(t)/i),this.layer.layer.css("height",t+e)}else this.layer.layer.css("height","");this.layer.update()},i.prototype._syncmaxwidth=function(){var t=parseInt(this.layer.getProperty("maxwidth"));0>=t||isNaN(t)?this.layer.layer.css("maxWidth","").attr("data-has-maxwidth","0"):this.layer.layer.css("maxWidth",t+"px").attr("data-has-maxwidth","1"),this.layer.update()},i.prototype._syncselfalign=function(){this.layer.layer.attr("data-cssselfalign",this.layer.getProperty("selfalign"))},i.prototype.sync=function(){this._syncmargin(),this._syncheight(),this._syncmaxwidth()},i}),N2D("Placement",function(t,e){"use strict";function i(t){this.layer=t,this.fragmentEditor=t.fragmentEditor,this.modes={},this.current=null,this.isTransferHandled=!1,this.updatePositionThrottled=NextendDeBounce(this.updatePosition,200)}return i.prototype.allow=function(t){switch(t){case"absolute":this.modes.absolute=new N2Classes.PlacementAbsolute(this,this.layer,this.fragmentEditor);break;case"normal":this.modes.normal=new N2Classes.PlacementNormal(this,this.layer,this.fragmentEditor);break;case"group":this.modes.absolute=new N2Classes.PlacementGroup(this,this.layer,this.fragmentEditor);break;case"content":this.modes.absolute=new N2Classes.PlacementContent(this,this.layer,this.fragmentEditor);break;case"default":this.modes["default"]=new N2Classes.PlacementDefault(this,this.layer,this.fragmentEditor)}},i.prototype.start=function(){for(var t in this.modes)this.modes[t].start()},i.prototype.setMode=function(t,e){var i=!1;if(e=e||{},"undefined"==typeof this.modes[t])throw new Exception("Layer placement("+t+") not allowed for the container",this.layer);if(this.current!=this.modes[t]){var s;this.current&&(this.modes[t].preActivation(this.current),s=this.current.type,i=this.current.deActivated(this.modes[t])),this.current=this.modes[t],this.layer.layer.attr("data-pm",this.current.type),this.current.activated(e),this.layer.$.triggerHandler("placementChanged",[this.current.type,s])}return i},i.prototype.doAction=function(t){try{return this.current[t].apply(this.current,Array.prototype.slice.call(arguments,1))}catch(e){}},i.prototype.getType=function(){return this.current.type},i.prototype.onResize=function(t){"function"==typeof this.current.onResize&&this.current.onResize(t)},i.prototype.updatePosition=function(){this.current.updatePosition()},i.prototype.getIndex=function(){return this.current.getIndex()},i.prototype.renderIndex=function(t){return this.current.renderIndex(t)},i.prototype.doLinearResize=function(t){this.current.doLinearResize(t)},i.prototype.sync=function(){this.current.sync()},i.prototype.renderModeProperties=function(t){var e=this.layer.getProperty("fontsize");this.layer.adjustFontSize(this.layer.getProperty("adaptivefont"),e,!1),this.current._renderModeProperties(t)},i.prototype["delete"]=function(){this.current["delete"]()},i}),N2D("PlacementAbstract",["Placement"],function(t,e){"use strict";function i(t,e,i){this.placement=t,this.layer=e,this.fragmentEditor=i}return i.prototype.start=function(){},i.prototype.preActivation=function(t){},i.prototype.activated=function(){},i.prototype.deActivated=function(t){return!1},i.prototype.updatePosition=function(){this.layer.group.update()},i.prototype._renderModeProperties=function(t){},i.prototype._hide=function(){},i.prototype._show=function(){},i.prototype.snap=function(){return!1},i.prototype.getIndex=function(){return this.layer.layer.index()},i.prototype.renderIndex=function(t){},i.prototype.doLinearResize=function(t){},i.prototype.sync=function(){},i.prototype["delete"]=function(){},i.prototype.triggerLayerResized=function(t,e){},i.prototype.changeStatus=function(t,e){},i}),N2D("Item",function(t,e){"use strict";function i(i,s,r){this.type===e&&(this.type=i.data("item")),this.needSize=this.constructor.needSize,this.fragmentEditor=r.fragmentEditor,this.generator=this.fragmentEditor.editor.generator,this.self=this,this.$item=i,this.layer=s,this.itemEditor=r,this.fonts=[],this.styles=[],this.needFill=[],this.values=this.$item.data("itemvalues"),"object"!=typeof this.values&&(this.values=t.parseJSON(this.values)),this.pre="div#"+this.fragmentEditor.editor.frontend.elementID+" ",this.defaultValues=r.getItemForm(this.type).values,this.added(),this.$item.data("item",this),this.$item.appendTo(this.layer.getContent()),this.layer.item=this,0===this.$item.children().length&&this.layer.readyDeferred.done(t.proxy(this.reRender,this)),t("<div/>").addClass("n2-ss-item-overlay").css("zIndex",89).appendTo(this.$item),this.$item.find("a").on("click",function(t){t.preventDefault()}),t(window).trigger("ItemCreated")}return i.needSize=!1,i.prototype.setSelf=function(t){this.self!=this&&this.self.setSelf(t),this.self=t},i.prototype.getSelf=function(){return this.self!=this&&(this.self=this.self.getSelf()),this.self},i.prototype.changeValue=function(e,i){this==this.itemEditor.activeItem?t("#item_"+this.type+e).data("field").insideChange(i):this.values[e]=i},i.prototype.activate=function(t,e,i){this.itemEditor.setActiveItem(this,e,i)&&(nextend.basicCSS.activate("ss3item"+this.type,this.values,{font:this.fonts,style:this.styles}),this.itemEditor.lastValues[this.type]=this.values)},i.prototype.deActivate=function(){nextend.basicCSS.deActivate()},i.prototype.render=function(e,i){this.layer.layer.triggerHandler("itemRender"),this.$item.html(""),this.parseAll(e),this._render(e),this.itemEditor.lastValues[this.type]=this.values=i,t("<div/>").addClass("n2-ss-item-overlay").css("zIndex",89).appendTo(this.$item);var s=this.getName(e);s=s===!1||""==s||"Layer"==s?this.type:s.replace(/[<>]/gi,""),this.layer.rename(s,!1),this.layer.update(),this.$item.find("a").on("click",function(t){t.preventDefault()})},i.prototype._render=function(t){},i.prototype.reRender=function(e){this.values=t.extend({},this.getDefault(),this.values,e),this.render(t.extend({},this.values),this.values)},i.prototype["delete"]=function(){this.$item.trigger("mouseleave"),this.$item.remove(),this.itemEditor.activeItem==this&&(this.itemEditor.activeItem=null)},i.prototype.getHTML=function(e){var i="";return i=e?"["+this.type+' values="'+N2Classes.Base64.encode(JSON.stringify(this.values))+'"]':t('<div class="n2-ss-item n2-ss-item-'+this.type+'"></div>').attr("data-item",this.type).attr("data-itemvalues",JSON.stringify(this.values))},i.prototype.getData=function(){return{type:this.type,values:this.values}},i.prototype.getDefault=function(){return{}},i.prototype.added=function(){},i.prototype.addedFont=function(e,i){var s=t("#item_"+this.type+i);s.length&&(this.fonts.push({mode:e,name:i,field:s.data("field"),def:this.defaultValues[i]}),t.when(nextend.fontManager.addVisualUsage(e,this.values[i],this.pre)).done(t.proxy(function(t){t||this.changeValue(i,"")},this)))},i.prototype.addedStyle=function(e,i){var s=t("#item_"+this.type+i);s.length&&(this.styles.push({mode:e,name:i,field:s.data("field"),def:this.defaultValues[i]}),t.when(nextend.styleManager.addVisualUsage(e,this.values[i],this.pre)).done(t.proxy(function(t){t||this.changeValue(i,"")},this)))},i.prototype.parseAll=function(t){for(var e=0;e<this.fonts.length;e++)t[this.fonts[e].name+"class"]=nextend.fontManager.getClass(t[this.fonts[e].name],this.fonts[e].mode)+" ";for(var e=0;e<this.styles.length;e++)t[this.styles[e].name+"class"]=nextend.styleManager.getClass(t[this.styles[e].name],this.styles[e].mode)+" ";for(var e=0;e<this.needFill.length;e++)"undefined"!=typeof t[this.needFill[e]]&&(t[this.needFill[e]]=this.generator.fill(t[this.needFill[e]]+""))},i.prototype.getName=function(t){return"Layer"},i.prototype.resizeLayerToImage=function(e){var i=this.layer,s=t("<img/>").attr("src",e).on("load",t.proxy(function(){var t=s[0].width,e=s[0].height;if(t>0&&e>0){var r=this.fragmentEditor.editor.getMainContainerElement(),n=r.width(),o=r.height();t>n&&(e=e*n/t,t=n),e>o&&(t=t*o/e),N2Classes.History.get().off(),i.setProperty("width",t),i.setProperty("height","auto"),N2Classes.History.get().on()}},this))},i.prototype.fitLayer=function(t){return!1},i}),N2D("ItemManager",function(t,e){"use strict";function i(e,i){if(this.suppressChange=!1,this.activeItemOriginalData=null,this.fragmentEditor=e,this.lastValues={},this.startItems(),this.forms={},this.activeForm=!1,!i.isUploadDisabled){var s=t("#n2-ss-slide-canvas-container-inner");s.nUIFileUpload({url:i.uploadUrl,pasteZone:!1,dropZone:s,dataType:"json",paramName:"image",add:function(t,e){e.formData={path:"/"+i.uploadDir},e.submit()},done:t.proxy(function(t,e){var i=e.result;if(i.data&&i.data.name){var s=this.createLayerItem(!1,{item:"image"});s.reRender({image:i.data.url}),s.activate(null,null,!0)}else N2Classes.AjaxHelper.notification(i)},this),fail:function(t,e){N2Classes.AjaxHelper.notification(e.jqXHR.responseJSON)},start:function(){N2Classes.AjaxHelper.startLoading()},stop:function(){setTimeout(function(){N2Classes.AjaxHelper.stopLoading()},100)}})}}return i.prototype.setActiveItem=function(e,i,s){if(e!=this.activeItem||s){this.activeItemOriginalData=null;var r=e.type;this.activeForm&&this.activeForm.form.css("display","none"),this.activeItem&&this.activeItem.deActivate(),this.activeForm=this.getItemForm(r);var n=t.extend({},this.activeForm.values,e.values);this.activeItem=e,this.suppressChange=!0;for(var o in n){var a=t("#item_"+r+o).data("field");a&&a.insideChange(n[o])}return this.suppressChange=!1,this.activeForm.form.css("display","block"),this.focusFirst(i),!0}return!1},i.prototype.focusFirst=function(t){var e=this.activeForm.fields.eq(0).data("field");this.fragmentEditor.editor.generator.isDynamicSlide()&&e.connectedField&&e.connectedField instanceof N2Classes.FormElementImage||e.focus("undefined"!=typeof t&&t)},i.prototype.startItems=function(){t(".n2-ss-core-item").nUICanvasItem({canvasUIManager:this.fragmentEditor.mainContainer.canvasUIManager,distance:5,$layer:function(){return this.element.clone()},onCreate:t.proxy(function(t,e,i,s){switch(i.layer.type){case"content":case"col":N2Classes.History.get().startBatch();var r=this.createLayerItem(i.layer,e.$layer.data(),"click");N2Classes.History.get().addControl("skipForwardUndos"),i.layer.container.insertLayerAt(r.layer,s),r.layer.changeGroup(!1,i.layer),N2Classes.History.get().endBatch();break;case"row":var n=i.layer.createCol();i.layer.moveCol(n.getIndex(),s),N2Classes.History.get().startBatch();var r=this.createLayerItem(n,e.$layer.data(),"click");N2Classes.History.get().addControl("skipForwardUndos"),n.container.insertLayerAt(r.layer,0),r.layer.changeGroup(!1,n),N2Classes.History.get().endBatch();break;default:var o=this.fragmentEditor.mainContainer.layer.offset(),r=this.createLayerItem(this.fragmentEditor.mainContainer,e.$layer.data(),"click");r.layer.placement.current.setPosition(t.pageX-o.left-20,t.pageY-o.top-20)}},this),start:function(){t("#n2-ss-add-sidebar").removeClass("n2-active")}}).on("click",t.proxy(function(e){this.createLayerItem(this.fragmentEditor.mainContainer.getActiveGroup(),t(e.currentTarget).data(),"click")},this)),t("[data-itemshortcut]").on({click:t.proxy(function(e){e.preventDefault(),t('.n2-ss-core-item[data-item="'+t(e.currentTarget).data("itemshortcut")+'"]').trigger("click")},this),mousedown:t.proxy(function(e){t('.n2-ss-core-item[data-item="'+t(e.currentTarget).data("itemshortcut")+'"]').trigger(e)},this)}),t("[data-structureshortcut]").on({click:t.proxy(function(e){e.preventDefault(),t(".n2-ss-add-layer-button").trigger("click"),t("#n2-ss-layers-switcher > .n2-labels .n2-td").eq(1).trigger("click")},this),mousedown:t.proxy(function(e){t('.n2-ss-core-item[data-sstype="'+t(e.currentTarget).data("structureshortcut")+'"]').trigger(e)},this)})},i.prototype.createLayerItem=function(e,i,s,r){e=e||this.fragmentEditor.mainContainer.getActiveGroup();var n=i.item;if("structure"===n){var o=new N2Classes.Row(this.fragmentEditor,e,{});return o.create(i.sstype),o.hightlightStructure(),{layer:o}}var a=this.getItemForm(n),l={};switch(n){case"image":"absolute"===e.container.allowedPlacementMode?l.size="100%|*|auto":l.size="auto|*|auto"}var h=t("<div></div>").attr("data-item",n).data("itemvalues",t.extend(!0,{},a.values,this.getLastValues(n),l)).addClass("n2-ss-item n2-ss-item-"+n),o=this._createLayer(h,e,t.extend(t(".n2-ss-core-item-"+n).data("layerproperties"),r));return s&&"click"==s?setTimeout(function(){o.layer.trigger("mousedown",["create"]).trigger("mouseup",["create"]).trigger("click",["create"])},500):o.activate(),this.fragmentEditor.layerWindow.switchTab("item"),N2Classes.History.get().addSimple(this,this.historyDelete,this.historyCreate,[e,o,i]),o.item},i.prototype.getLastValues=function(t){return this.lastValues[t]!==e?this.lastValues[t]:{}},i.prototype.getItemClass=function(t){var e="Item"+N2Classes.StringHelper.capitalize(t);return"undefined"==typeof N2Classes[e]?"Item":e},i.prototype._createLayer=function(t,e,i){var s=this.fragmentEditor.layerOptions.layerFeatures.layerDefault;for(var r in s)null!==s[r]&&(i[r]=s[r]);var n=new N2Classes.Layer(this.fragmentEditor,e,i);return n.create(function(e){return e._createLayer().append(t)}),n},i.prototype.getItemForm=function(i){if(this.forms[i]===e){var s=t("#smartslider-slide-toolbox-item-type-"+i),r={form:s,values:s.data("itemvalues"),fields:s.find('[name^="item_'+i+'"]'),fieldNameRegexp:new RegExp("item_"+i+"\\[(.*?)\\]","")};r.fields.on({nextendChange:t.proxy(this.updateCurrentItem,this),keydown:t.proxy(this.updateCurrentItemDeBounced,this)}),this.forms[i]=r}return this.forms[i]},i.prototype.updateCurrentItem=function(e){if(!this.suppressChange){null===this.activeItemOriginalData&&(this.activeItemOriginalData=t.extend({},this.activeItem.values));var i={},s={};if(this.activeForm.fields.each(t.proxy(function(e,r){var r=t(r),n=r.attr("name").match(this.activeForm.fieldNameRegexp)[1];s[n]=i[n]=r.val()},this)),e&&"nextendChange"==e.type){var r=N2Classes.History.get().addValue(this,this.historyUpdateCurrentItem,[this.activeItem]);r&&r.setValues(this.activeItemOriginalData,t.extend({},s)),this.activeItemOriginalData=null}this.activeItem.render(t.extend({},this.activeItem.getDefault(),i),s)}},i.prototype.historyUpdateCurrentItem=function(e,i){var s=i.getSelf();s.reRender(t.extend(!0,{},e)),s.values=e,this.activeItem==s&&s.activate(null,null,!0)},i.prototype.updateCurrentItemDeBounced=NextendDeBounce(function(t){this.updateCurrentItem(t)},100),i.prototype.historyDelete=function(t,e){e.getSelf()["delete"]()},i.prototype.historyCreate=function(t,e,i){var s=this.createLayerItem(t.getSelf(),i);e.setSelf(s.layer)},i.prototype.historyCreateStructure=function(t,e,i){var s=this.createLayerItem(t.getSelf(),i);e.setSelf(s.layer)},i.prototype.getSelf=function(){return this},i}),N2D("PluginActivatable",function(t,e){"use strict";function i(){this.isActive=!1,
7
- this.preventActivation=!1}return i.prototype.activate=function(t,e,i){return this.preventActivation?!1:(document.activeElement&&document.activeElement.blur(),t&&(t.ctrlKey||t.metaKey)&&this.fragmentEditor.mainContainer.getSelectedLayer()?!this.select():t&&3==t.which&&this.fragmentEditor.selectMode?!1:(i||this.fragmentEditor.exitSelectMode(),t&&this.positionSidebar(),this.fragmentEditor.mainContainer.getSelectedLayer()!==this&&(this.layerRow.addClass("n2-active"),this.layer.addClass("n2-active"),this.layer.triggerHandler("n2-ss-activate"),this.fragmentEditor.changeActiveLayer(this,i),nextend.activeLayer=this.layer,this.fragmentEditor.ui.onActivateLayer(this)),this.isActive=!0,!0))},i.prototype.deActivate=function(){this.isActive=!1,this.layer===e&&console.error(),this.layer.removeClass("n2-active"),this.layerRow.removeClass("n2-active"),this.layer.triggerHandler("n2-ss-deactivate")},i}),N2D("PluginEditableName",function(t,e){"use strict";function i(){}var s=300,r=null;return i.prototype.addProperties=function(t){this.createProperty("name",this.label,t),this.createProperty("nameSynced",1,t)},i.prototype.makeNameEditable=function(){this.layerTitleSpan.on({mouseup:t.proxy(function(e){r?(clearTimeout(r),r=null,this.editName()):(this.activate(e),r=setTimeout(t.proxy(function(){r=null},this),s))},this)})},i.prototype.editName=function(){var e=new N2Classes.InlineField;e.$input.on({valueChanged:t.proxy(function(t,e){this.rename(e,!0),this.layerTitleSpan.css("display","inline")},this),cancel:t.proxy(function(){this.layerTitleSpan.css("display","inline")},this)}),this.layerTitleSpan.css("display","none"),e.injectNode(this.layerTitle,this.property.name)},i.prototype.rename=function(t,e){if(this.property.nameSynced||e){if(e&&(this.property.nameSynced=0),""==t){if(e)return this.property.nameSynced=1,this.item.reRender(),!1;t="Layer #"+(this.group.getLayerCount()+1)}t=t.substr(0,35),this.property.name!=t&&(this.property.name=t,this.layerTitleSpan.html(t),this.$.trigger("layerRenamed",t))}},i}),N2D("PluginShowOn",function(t,e){"use strict";function i(){}return i.prototype.addProperties=function(t){this.showsOnCurrent=!0,this.createProperty("generatorvisible","",t),this.createProperty("desktopPortrait",1,t),this.createProperty("desktopLandscape",1,t),this.createProperty("tabletPortrait",1,t),this.createProperty("tabletLandscape",1,t),this.createProperty("mobilePortrait",1,t),this.createProperty("mobileLandscape",1,t)},i.prototype._hide=function(){this.layer.css("display","none"),this.showsOnCurrent=!1,this.update()},i.prototype._show=function(){parseInt(this.property[this.fragmentEditor.getMode()])&&(this.layer.css("display",""),this.showsOnCurrent=!0),this.update()},i.prototype._syncdesktopPortrait=function(){var t=this.getProperty("desktopPortrait");this.__syncShowOnDevice("desktopPortrait",t)},i.prototype._syncdesktopLandscape=function(){var t=this.getProperty("desktopLandscape");this.__syncShowOnDevice("desktopLandscape",t)},i.prototype._synctabletPortrait=function(){var t=this.getProperty("tabletPortrait");this.__syncShowOnDevice("tabletPortrait",t)},i.prototype._synctabletLandscape=function(){var t=this.getProperty("tabletLandscape");this.__syncShowOnDevice("tabletLandscape",t)},i.prototype._syncmobilePortrait=function(){var t=this.getProperty("mobilePortrait");this.__syncShowOnDevice("mobilePortrait",t)},i.prototype._syncmobileLandscape=function(){var t=this.getProperty("mobileLandscape");this.__syncShowOnDevice("mobileLandscape",t)},i.prototype.__syncShowOnDevice=function(t,e){if(this.getMode()==t){var e=parseInt(e);e?this._show():this._hide(),this.layer.triggerHandler("LayerShowChange",[t,e]),this.placement.doAction("triggerLayerResized")}},i}),N2D("Col",["ContentAbstract"],function(t,e){"use strict";function i(t,e,i){this.label="Col",this.type="col",this.innerContainer="> .n2-ss-layer-col",this.localStyle=[{group:"normal",selector:"-inner",css:{transition:"transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;"}},{group:"hover",selector:"-inner:HOVER",css:{}}],N2Classes.ContentAbstract.prototype.constructor.call(this,t,e,i),this.placement.allow("default")}return i.prototype=Object.create(N2Classes.ContentAbstract.prototype),i.prototype.constructor=i,i.prototype._createLayer=function(){return t('<div class="n2-ss-layer"><div class="n2-ss-layer-content n2-ss-layer-col"></div></div>').attr("data-sstype",this.type)},i.prototype.addProperties=function(t){N2Classes.ContentAbstract.prototype.addProperties.call(this,t),this.createProperty("colwidth","1",t),this.createProperty("href","",t),this.createProperty("href-target","_self",t),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("borderradius",0,{"-hover":e},this,"stylemode"),t),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("boxshadow","0|*|0|*|0|*|0|*|00000080",{"-hover":e},this,"stylemode"),t),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("borderwidth","1|*|1|*|1|*|1",{"-hover":e},this,"stylemode"),t),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("borderstyle","none",{"-hover":e},this,"stylemode"),t),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("bordercolor","ffffffff",{"-hover":e},this,"stylemode"),t),this.createDeviceProperty("order",{desktopPortrait:0},t)},i.prototype.create=function(){N2Classes.ContentAbstract.prototype.create.call(this),this._syncorder(),this._syncborder(),this._syncborderradius(),this._syncboxshadow(),this._onReady()},i.prototype.load=function(t,i){N2Classes.ContentAbstract.prototype.load.call(this,t,i),this._syncorder(),this._syncborder(),this._syncborderradius(),this._syncboxshadow(),this._onReady();var s=t.data("rowcolumns")+"";if(s!=e&&"resolved"==this.group.readyDeferred.state()){for(var r=s.split("+"),n=0;n<r.length;n++)r[n]=new Fraction(r[n]);this.group.setColsWidth(r)}},i.prototype.createRow=function(){this.$content=this.layer.find(".n2-ss-layer-content:first"),this.container=new N2Classes.LayerContainer(this,t('<ul class="n2-list n2-h4 n2-list-orderable" />'),"normal","> .n2-ss-layer",["row","layer"]),this.container.setLayerContainerElement(this.$content),this.addClassElement(this.layer),this.addClassElement(this.$content,"-inner");var e=t('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="'+n2_("Delete layer")+'"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on("click",t.proxy(this["delete"],this)),i=t('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="'+n2_("Duplicate layer")+'"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on("click",t.proxy(function(){this.duplicate(!0,!1)},this));this._createLayerListRow([t('<div class="n2-actions"></div>').append(i).append(e)]).addClass("n2-ss-layer-content-row"),this.openerElement=t('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-col"></i></a>').insertBefore(this.layerTitleSpan).on("click",t.proxy(this.switchOpened,this)),this.container.$ul.appendTo(this.layerRow),this.readyDeferred.done(t.proxy(this._syncopened,this))},i.prototype._start=function(t){N2Classes.ContentAbstract.prototype._start.call(this,t),t&&this.highlight(2e3)},i.prototype.getRealOrder=function(){var t=this.getProperty("order");return 0==t?10:t},i.prototype._syncorder=function(){var t=this.getProperty("order");0==t?this.layer.css("order",""):this.layer.css("order",2*t),this.group.refreshUI()},i.prototype._synccolwidth=function(){this.widthPercentage=100*new Fraction(this.getProperty("colwidth")).valueOf(),this.group.refreshUI()},i.prototype.getWidthPercentage=function(){return this.widthPercentage},i.prototype._synchref=i.prototype["_synchref-target"]=function(){},i.prototype._syncborderradius=i.prototype["_syncborderradius-hover"]=function(){var t=this.getProperty("borderradius");t>0&&this.addLocalStyle("normal","borderradius","border-radius:"+t+"px;");var e=this.getProperty("borderradius-hover");e&&e!=t&&this.addLocalStyle("hover","borderradius","border-radius:"+e+"px;")},i.prototype._syncborderwidth=i.prototype._syncbordercolor=i.prototype._syncborderstyle=i.prototype["_syncborderstyle-hover"]=i.prototype["_syncbordercolor-hover"]=i.prototype["_syncborderwidth-hover"]=function(){this._syncborder()},i.prototype._syncborder=function(){var t=this.getProperty("borderstyle"),i=this.getProperty("bordercolor"),s=this.getProperty("borderwidth");this.addLocalStyle("normal","border",this.getBorderCSS(t,i,s));var r="",n=!1,o=this.getProperty("borderstyle-hover"),a=this.getProperty("bordercolor-hover"),l=this.getProperty("borderwidth-hover");o!==e&&o!=t&&(n=!0),a!==e&&a!=i&&(n=!0),l!==e&&l!=s&&(n=!0),n&&(o===e&&(o=t),a===e&&(a=i),l===e&&(l=s),r=this.getBorderCSS(o,a,l)),this.addLocalStyle("hover","border",r),this.update()},i.prototype.getBorderCSS=function(t,e,i){var s="";if("none"!=t){s+="border-color:"+N2Color.hex2rgbaCSS(e)+";",s+="border-style:"+t+";",i=i.split("|*|");var r="px";s+="border-width:"+i.join(r+" ")+r+";"}return s},i.prototype._syncboxshadow=i.prototype["_syncboxshadow-hover"]=function(){var t=this.getProperty("boxshadow");this.addLocalStyle("normal","boxshadow",this.getBoxShadowCSS(t.split("|*|")));var i="",s=this.getProperty("boxshadow-hover");s!==e&&s!=t&&(i=this.getBoxShadowCSS(s.split("|*|"))),this.addLocalStyle("hover","boxshadow",i)},i.prototype.getBoxShadowCSS=function(t){return 0==t[0]&&0==t[1]&&0==t[2]&&0==t[3]||0==N2Color.hex2alpha(t[4])?"":"box-shadow:"+t[0]+"px "+t[1]+"px "+t[2]+"px "+t[3]+"px "+N2Color.hex2rgbaCSS(t[4])+";"},i.prototype["delete"]=function(){this.group.container.getLayerCount()>1?this._delete():this.group["delete"]()},i.prototype.getHTML=function(t){var e=N2Classes.ComponentAbstract.prototype.getHTML.call(this,t);return e.attr("data-rowcolumns",this.group.getColumns()),e},i.prototype.renderModeProperties=function(t){this._syncorder(),N2Classes.ContentAbstract.prototype.renderModeProperties.call(this,t)},i.prototype.update=function(){this.group._syncwrapafter(),N2Classes.ComponentAbstract.prototype.update.call(this)},i.prototype.setPropertystylemode=function(){N2Classes.ContentAbstract.prototype.setPropertystylemode.apply(this,arguments),this.syncAdvancedField("borderradius"),this.syncAdvancedField("boxshadow"),this.syncAdvancedField("borderwidth"),this.syncAdvancedField("borderstyle"),this.syncAdvancedField("bordercolor")},i.prototype.getOrderedIndex=function(){return this.group.getOrderedColumns().indexOf(this)},i});var dependencies=["LayerDataStorage","PluginEditableName"];N2D("ComponentAbstract",dependencies,function(t,e){"use strict";function i(e,r,n){this.wraps={},this.counter=s++,window.layers[this.counter]=this,this.self=this,this.originalProperties=n||{},N2Classes.LayerDataStorage.prototype.constructor.call(this),this.readyDeferred=t.Deferred(),this.readyDeferred.done(t.proxy(this.onReady,this)),this.isDeleteStarted=!1,this.isDeleted=!1,this._lastClasses=!1,this.$=t(this),this.proxyRefreshBaseSize=t.proxy(this.refreshBaseSize,this),this.proxyRefreshTextAlign=t.proxy(this.refreshTextAlign,this),this.status=i.STATUS.UNDEFINED,this.fragmentEditor=e,this.group=r,this.classElements=[],this.localStyleSyncThrottled=NextendThrottle(this.localStyleSync,50),N2Classes.PluginActivatable.prototype.constructor.call(this),this.placement=new N2Classes.Placement(this),this.readyDeferred.done(t.proxy(this.addUILabels,this))}var s=0;window.layers=[],i.STATUS={UNDEFINED:0,NORMAL:1,LOCKED:2,HIDDEN:3},i.STATUS_INV={0:"UNDEFINED",1:"NORMAL",2:"LOCKED",3:"HIDDEN"};for(var r in N2Classes.PluginActivatable.prototype)i.prototype[r]=N2Classes.PluginActivatable.prototype[r];for(var r in N2Classes.LayerDataStorage.prototype)i.prototype[r]=N2Classes.LayerDataStorage.prototype[r];for(var r in N2Classes.PluginEditableName.prototype)i.prototype[r]=N2Classes.PluginEditableName.prototype[r];for(var r in N2Classes.PluginShowOn.prototype)i.prototype[r]=N2Classes.PluginShowOn.prototype[r];return i.prototype.addUILabels=function(){this.markTimer=null,this.uiLabel=t('<div class="n2-ss-layer-ui-label-container"><div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-self">'+this.getUILabel()+"</div></div>").appendTo(this.layer),nextend.tooltip.addElement(t('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-up n2-ss-layer-ui-label-action"><i class="n2-i n2-i-uplevel"/></div>').on({mousedown:function(t){t.stopPropagation()},click:t.proxy(function(t){this.up(t)},this)}).appendTo(this.uiLabel),"Select parent"),t('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-action"><i class="n2-i n2-i-mini-duplicate"/></div>').on({mousedown:function(t){t.stopPropagation()},click:t.proxy(function(){this.duplicate()},this)}).appendTo(this.uiLabel),t('<div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-action"><i class="n2-i n2-i-mini-trash"/></div>').on({mousedown:function(t){t.stopPropagation()},click:t.proxy(function(){this["delete"]()},this)}).appendTo(this.uiLabel)},i.prototype.getUILabel=function(){return this.label},i.prototype.up=function(t){t.stopImmediatePropagation(),this.group.activate(t)},i.prototype.addProperties=function(t){this.createProperty("id",null,t,this),this.createProperty("uniqueclass",null,t,this),this.createProperty("class","",t),this.createProperty("crop","visible",t),this.createProperty("rotation",0,t),this.createProperty("parallax",0,t),this.createProperty("adaptivefont",0,t),this.createDeviceProperty("fontsize",{desktopPortrait:100},t),N2Classes.PluginShowOn.prototype.addProperties.call(this,t),N2Classes.PluginEditableName.prototype.addProperties.call(this,t)},i.prototype.getRootElement=function(){return this.layer},i.prototype.create=function(t,e){e=e||!1,e||this.addProperties(!1),"function"==typeof t?this.layer=t.call(null,this):this.layer=this._createLayer(),this.layer.addClass("n2-ss-layer-under-creation"),e&&this.addProperties(this.layer),this.layer.data("layerObject",this),this.layer.triggerHandler("layerStarted",[this]),this.group.container.insert(this),this.group.onChildCountChange(),this.$.triggerHandler("create"),this._start(!0)},i.prototype.load=function(t,e){this.addProperties(t),this.layer=t.data("layerObject",this),this.layer.triggerHandler("layerStarted",[this]),this.$.triggerHandler("load"),this._start(!1);var s=t.data("status");null!==s&&"undefined"!=typeof s?this.changeStatus(s):this.changeStatus(i.STATUS.NORMAL),e||this.regenerateUniqueClass()},i.prototype._start=function(e){this.createRow();var i=this.layer.find("> .n2-ss-layer-mask");i.length&&(this.wraps.mask=i),this._synccrop(),this._syncrotation(),this.placement.start(),this.placement.setMode(this.group.container.allowedPlacementMode,this.originalProperties),this.setGroup(this.group),this.fragmentEditor.$.triggerHandler("layerCreated",this),e&&(this.refreshBaseSize(),this.$.triggerHandler("created")),setTimeout(t.proxy(function(){this.isDeleted||(this.placement.onResize(!0),this.layer.css("visibility",""),this.layer.removeClass("n2-ss-layer-under-creation"))},this),300)},i.prototype._onReady=function(){this.originalProperties={},this.readyDeferred.resolve(),this.layer.on({mouseover:t.proxy(this.markOver,this),mouseout:t.proxy(this.markOut,this)})},i.prototype.isReady=function(){return"resolved"==this.readyDeferred.state()},i.prototype.getName=function(){return this.property.name},i.prototype.setGroup=function(t){this.group.$.off("baseSizeUpdated.sslayer"+this.counter),this.group.$.off("textAlignUpdated.sslayer"+this.counter),this.group=t,this.placement.setMode(t.container.allowedPlacementMode),t.container.syncLayerRow(this),this.isReady()&&this.refreshBaseSize(),this.group.$.on("baseSizeUpdated.sslayer"+this.counter,this.proxyRefreshBaseSize),this.group.$.on("textAlignUpdated.sslayer"+this.counter,this.proxyRefreshTextAlign)},i.prototype.changeGroup=function(t,e){var i=this.group;i.$.off("baseSizeUpdated.sslayer"+this.counter),i.$.off("textAlignUpdated.sslayer"+this.counter),this.group=e;var s=this.placement.setMode(e.container.allowedPlacementMode);e.container.syncLayerRow(this),this.refreshBaseSize(),e.$.on("baseSizeUpdated.sslayer"+this.counter,this.proxyRefreshBaseSize),e.$.on("textAlignUpdated.sslayer"+this.counter,this.proxyRefreshTextAlign),this.userGroupChange(i,t,s,e,this.getIndex()),i.update()},i.prototype.userGroupChange=function(t,e,i,s,r){if(t==s)this.userIndexChange(e,r);else{var n=N2Classes.History.get().addValue(this,this.historyUserGroupChange,[]);n&&n.setValues({historyGroup:t,index:e,placementData:i},{historyGroup:s,index:r})}},i.prototype.historyUserGroupChange=function(t){var e=this.group,i=t.historyGroup.getSelf(),s=t.index;i.container.insertLayerAt(this,s),this.group.$.off("baseSizeUpdated.sslayer"+this.counter),this.group.$.off("refreshTextAlign.sslayer"+this.counter),this.group=i,t.placementData&&this.layer.data(t.placementData),this.placement.setMode(i.container.allowedPlacementMode),i.container.syncLayerRow(this),this.refreshBaseSize(),this.group.$.on("baseSizeUpdated.sslayer"+this.counter,this.proxyRefreshBaseSize),this.group.$.on("refreshTextAlign.sslayer"+this.counter,this.proxyRefreshBaseSize),i.onChildCountChange(),t.placementData&&this.placement.sync(),e.update()},i.prototype.userIndexChange=function(t,e){var i=N2Classes.History.get().addValue(this,this.historyUserIndexChange);i&&i.setValues(t,e),this.group.container.insertLayerAt(this,e)},i.prototype.historyUserIndexChange=function(t){this.group.container.insertLayerAt(this,t)},i.prototype._createLayerListRow=function(e){return this.layerRow=t('<li class="n2-ss-layerlist-row"></li>').data("layer",this).on({mousedown:t.proxy(N2Classes.WindowManager.setMouseDownArea,null,"layerRowClicked")}).appendTo(this.group.container.$ul),this.layerTitleSpan=t('<span class="n2-ucf">'+this.property.name+"</span>"),this.makeNameEditable(),this.layerTitle=t('<div class="n2-ss-layer-title"></div>').on({mouseenter:t.proxy(function(){this.fragmentEditor.highlight(this)},this),mouseleave:t.proxy(function(){this.fragmentEditor.deHighlight(this)},this)}).append(this.layerTitleSpan).append(e).appendTo(this.layerRow).on({mouseup:t.proxy(function(t){nextend.shouldPreventMouseUp||"DIV"!==t.target.tagName||this.activate(t)},this)}),nextend.tooltip.add(this.layerRow),this.layerRow.nUILayerListItem({UIManager:this.fragmentEditor.mainContainer.layerListUIManager,layer:this,$item:this.layerRow}),this.layerRow},i.prototype.select=function(t){return this.fragmentEditor.selectLayer(this,!0)},i.prototype.update=function(){this.readyDeferred.done(t.proxy(this.placement.updatePositionThrottled,this.placement))},i.prototype.updateThrottled=function(){this.placement.updatePositionThrottled()},i.prototype.positionSidebar=function(){this.fragmentEditor.layerWindow.show(this,this.layer)},i.prototype.showEditor=function(){this.fragmentEditor.layerWindow._show()},i.prototype.highlight=function(e){e=e||2e3,this.isHighlighted&&(clearTimeout(this.isHighlighted),this.isHighlighted=!1),this.layer.addClass("n2-highlight"),this.isHighlighted=setTimeout(t.proxy(function(){this.layer.removeClass("n2-highlight")},this),e)},i.prototype.setPropertydesktopPortrait=i.prototype.setPropertydesktopLandscape=i.prototype.setPropertytabletPortrait=i.prototype.setPropertytabletLandscape=i.prototype.setPropertymobilePortrait=i.prototype.setPropertymobileLandscape=function(t,e,i){this._setProperty(t,parseInt(e),i)},i.prototype.getHTML=function(t){var i=this._createLayer();for(var s in this.property)"width"!=s&&"height"!=s&&"left"!=s&&"top"!=s&&i.attr("data-"+s.toLowerCase(),this.property[s]);for(var s in this.deviceProperty)for(var r in this.deviceProperty[s])i.attr("data-"+s.toLowerCase()+r,this.deviceProperty[s][r]);for(var s in this.deviceProperty.desktop)i.css(s,this.deviceProperty.desktop[s]+"px");if(this.container!=e){var n=i;this.innerContainer!=e&&(n=i.find(this.innerContainer)),n.append(this.container.getHTML(t))}var o=this.getProperty("id");return o&&""!=o&&i.attr("id",o),this.status>N2Classes.ComponentAbstract.STATUS.NORMAL&&i.attr("data-status",this.status),i},i.prototype.duplicate=function(e){var i=this.getHTML(!1);if("absolute"==this.placement.getType()){var s=i.attr("id");s&&(s=t.fn.uid(),i.attr("id",s),i.attr("data-id",s)),i.attr("data-parentid")?(i.data("desktopportraittop",0),i.data("desktopportraitleft",0)):(i.data("desktopportraittop",i.data("desktopportraittop")+40),i.data("desktopportraitleft",i.data("desktopportraitleft")+40)),i.attr("data-parentid","")}var r=this.fragmentEditor.insertComponentWithNode(this.group,i,this.getIndex()+1,!1,!0);return this.layerRow.trigger("mouseleave"),e&&r.activate(),N2Classes.History.get().addSimple(this,this.historyDeleteDuplicated,this.historyDuplicate,[r,r.container?r.container.getAllLayers():!1]),r},i.prototype.historyDeleteDuplicated=function(t){t.getSelf()["delete"]()},i.prototype.historyDuplicate=function(t,e){var i=this.duplicate(!1,!1);if(t.setSelf(i),e)for(var s=i.container.getAllLayers(),r=0;r<s.length;r++)e[r].setSelf(s[r])},i.prototype.historyDelete=function(){this["delete"]()},i.prototype.historyRestore=function(t,e,i,s){var r=this.fragmentEditor.insertComponentWithNode(this.group.getSelf(),t.clone(),i,!1,!0);if(this.setSelf(r),s)for(var n=r.container.getAllLayers(),o=0;o<n.length;o++)s[o].setSelf(n[o])},i.prototype["delete"]=function(){N2Classes.PositionDisplay.get().hide(),nextend.tooltip.onLeave(),this._delete()},i.prototype._delete=function(){if(this.isDeleteStarted=!0,this.fragmentEditor.mainContainer.getSelectedLayer()==this&&this.fragmentEditor.layerWindow.hide(),this.isHighlighted&&(clearTimeout(this.isHighlighted),this.isHighlighted=!1),N2Classes.History.get().startBatch(),N2Classes.History.get().addSimple(this,this.historyRestore,this.historyDelete,[this.getHTML(!1),this.group,this.getIndex(),this.container?this.container.getAllLayers():!1]),this.deActivate(),this.container!=e){N2Classes.History.get().off();for(var t=this.container.getSortedLayers(),i=0;i<t.length;i++)t[i]._delete();N2Classes.History.get().on()}N2Classes.History.get().endBatch(),this.item!=e&&this.item["delete"](),this.placement["delete"](),this.layer.trigger("mouseup"),this.isDeleted=!0,this.fragmentEditor.mainContainer.layerDeleted(this),this.layer.triggerHandler("LayerDeleted"),this.getRootElement().remove(),this.layerRow.remove(),this.group.update(),this.group.$.off("baseSizeUpdated.sslayer"+this.counter),this.group.$.off("refreshTextAlign.sslayer"+this.counter),this.$.trigger("layerDeleted"),this.markTimer&&clearTimeout(this.markTimer),delete this.layer,delete this.itemEditor,this.group.onChildCountChange()},i.prototype.getData=function(e){var i={type:this.type,lastplacement:this.placement.getType()};this.status>N2Classes.ComponentAbstract.STATUS.NORMAL&&(i.status=this.status);var s=t.extend({},this.property);for(var r in this.deviceProperty)for(var n in this.deviceProperty[r]){delete s[n];var o=this.deviceProperty[r][n];if("undefined"!=typeof o){switch(n){case"width":case"height":this.isDimensionPropertyAccepted(o)||(o=parseFloat(o));break;case"fontsize":case"left":case"top":case"gutter":case"wrap":o=parseFloat(o)}i[r.toLowerCase()+n]=o}}for(var a in s)i[a.toLowerCase()]=s[a];return i},i.prototype.onChildCountChange=function(){},i.prototype.getDataWithChildren=function(e,i){return-1==t.inArray(this,i)&&(i.push(this),e.push(this.getData({layersIncluded:!0,itemsIncluded:!0})),this.layer.triggerHandler("LayerGetDataWithChildren",[e,i])),e},i.prototype.markOver=function(t){this.layer.addClass("n2-ss-mouse-over"),t.stopPropagation(),this.group.markEnter(),this.markTimer&&clearTimeout(this.markTimer),this.layer.addClass("n2-ss-mouse-over-delayed"),this.uiLabel.removeClass("invisible")},i.prototype.markOut=function(e){this.layer.removeClass("n2-ss-mouse-over"),e&&e.stopPropagation(),this.group.markLeave(),this.markTimer&&clearTimeout(this.markTimer),this.isActive||this.uiLabel.addClass("invisible"),this.markTimer=setTimeout(t.proxy(function(){this.layer.removeClass("n2-ss-mouse-over-delayed"),this.uiLabel.removeClass("invisible"),this.markTimer=null},this),10)},i.prototype.markEnter=function(t){this.layer.addClass("n2-ss-mouse-hover"),this.group.markEnter()},i.prototype.markLeave=function(t){this.layer.removeClass("n2-ss-mouse-hover"),this.group.markLeave()},i.prototype.formSetname=function(t,e){},i.prototype.formSetnameSynced=function(t,e){},i.prototype.formSetdesktopPortrait=function(t,e){t.currentForm.desktopPortrait.data("field").insideChange(e)},i.prototype.formSetdesktopLandscape=function(t,e){t.currentForm.desktopLandscape.data("field").insideChange(e)},i.prototype.formSettabletPortrait=function(t,e){t.currentForm.tabletPortrait.data("field").insideChange(e)},i.prototype.formSettabletLandscape=function(t,e){t.currentForm.tabletLandscape.data("field").insideChange(e)},i.prototype.formSetmobilePortrait=function(t,e){t.currentForm.mobilePortrait.data("field").insideChange(e)},i.prototype.formSetmobileLandscape=function(t,e){t.currentForm.mobileLandscape.data("field").insideChange(e)},i.prototype.sync=function(){if(this._syncid(),this.container)for(var t=this.container.getSortedLayers(),e=0;e<t.length;e++)t[e].sync();this.placement.sync()},i.prototype._syncid=function(){var t=this.getProperty("id");t&&""!=t?this.layer.attr("id",t):this.layer.removeAttr("id")},i.prototype.requestID=function(){var e=this.getProperty("id");return e||(e=t.fn.uid(),this.setProperty("id",e,"layer")),e},i.prototype.requestUniqueClass=function(){var e=this.getProperty("uniqueclass");return e||(e=t.fn.generateUniqueClass("n-uc-"),this.setProperty("uniqueclass",e,"layer")),e},i.prototype.regenerateUniqueClass=function(){this.getProperty("uniqueclass")&&this.setProperty("uniqueclass",t.fn.generateUniqueClass("n-uc-"),"layer")},i.prototype._syncuniqueclass=function(){for(var t=this.getProperty("uniqueclass"),e=0;e<this.classElements.length;e++)this.classElements[e].$el.removeClass(function(t,e){return(e.match(/n-uc-[a-z0-9\-]+/gi)||[]).join(" ")}).addClass(t+this.classElements[e].postfix)},i.prototype._syncfontsize=function(){this.adjustFontSize(this.getProperty("adaptivefont"),this.getProperty("fontsize"),!0)},i.prototype._syncadaptivefont=function(){this.adjustFontSize(this.getProperty("adaptivefont"),this.getProperty("fontsize"),!0)},i.prototype.adjustFontSize=function(t,e,i){e=parseInt(e),parseInt(t)?this.layer.css("font-size",16*e/100+"px"):100!=e?this.layer.css("font-size",e+"%"):this.layer.css("font-size",""),this.refreshBaseSize(),i&&this.update()},i.prototype.refreshBaseSize=function(){var t=this.getFontSize();this.isAdaptiveFont()?this.baseSize=16*t/100:this.baseSize=this.group.baseSize*t/100,this.$.triggerHandler("baseSizeUpdated")},i.prototype.refreshTextAlign=function(){this.$.triggerHandler("textAlignUpdated")},i.prototype.getFontSize=function(){return parseInt(this.getProperty("fontsize"))},i.prototype.isAdaptiveFont=function(){return parseInt(this.getProperty("adaptivefont"))},i.prototype._synccrop=function(){var t=this.getProperty("crop");"auto"==t&&(t="hidden"),"mask"==t?(t="hidden",this.addWrap("mask","<div class='n2-ss-layer-mask'></div>")):(this.removeWrap("mask"),this.layer.data("animatableselector",null)),this.layer.css("overflow",t)},i.prototype._syncrotation=function(){var t=parseFloat(this.getProperty("rotation"));if(t/360!=0){var e=this.addWrap("rotation","<div class='n2-ss-layer-rotation'></div>");NextendTween.set(e[0],{rotationZ:t})}else this.removeWrap("rotation")},i.prototype.addWrap=function(i,s){if(this.wraps[i]===e){var r=t(s);switch(this.wraps[i]=r,i){case"mask":r.appendTo(this.layer),this.wraps.rotation!==e?r.append(this.wraps.rotation):r.append(this.getContents()),this.layer.data("animatableselector",".n2-ss-layer-mask:first");break;case"rotation":this.wraps.mask!==e?r.appendTo(this.wraps.mask):r.appendTo(this.layer),r.append(this.getContents())}}return this.wraps[i]},i.prototype.removeWrap=function(t){if(this.wraps[t]!==e){switch(t){case"mask":this.wraps.rotation!==e?this.layer.append(this.wraps.rotation):this.layer.append(this.getContents());break;case"rotation":this.wraps.mask!==e?this.wraps.mask.append(this.getContents()):this.layer.append(this.getContents())}this.wraps[t].remove(),delete this.wraps[t]}},i.prototype.getContents=function(){return!1},i.prototype._syncclass=function(){this._lastClasses!==!1&&this.layer.removeClass(this._lastClasses);var t=this.fragmentEditor.editor.generator.fill(this.getProperty("class"));t&&""!=t?(this.layer.addClass(t),this._lastClasses=t):this._lastClasses=!1},i.prototype._syncparallax=function(){},i.prototype._syncgeneratorvisible=function(){},i.prototype._syncmouseenter=i.prototype._syncclick=i.prototype._syncmouseleave=i.prototype._syncplay=i.prototype._syncpause=i.prototype._syncstop=function(){},i.prototype.renderModeProperties=function(t){N2Classes.LayerDataStorage.prototype.renderModeProperties.call(this),this.placement.renderModeProperties(t)},i.prototype.getIndex=function(){return this.group.container.getLayerIndex(this.layer)},i.prototype.toString=function(){return this.type+" #"+this.counter},i.prototype.setSelf=function(t){t===e&&console.error(t),this.self!=this&&this.self.setSelf(t),this.self=t},i.prototype.getSelf=function(){return this.self!==this&&(this.self=this.self.getSelf()),this.self},i.prototype.historyStoreOnPlacement=function(){var t=Array.prototype.slice.call(arguments);t.splice(1,1),this.placement.current[arguments[1]].apply(this.placement.current,t)},i.prototype.getDroppable=function(){return!1},i.prototype.onCanvasUpdate=function(t,e,i){if(this.group===e)t!=i&&this.userIndexChange(t,i);else{var s;if(this.fragmentEditor.isCol(this.group))for(s=this;s&&(!s.placement||"absolute"!==s.placement.getType());)s=s.group;this.changeGroup(t,e),e.onChildCountChange();for(var r=this;r&&(!r.placement||"absolute"!==r.placement.getType());)r=r.group;s&&s!=r&&s.placement.updatePosition(),r&&r.placement.updatePosition()}},i.prototype.setStatusNormal=function(){this.changeStatus(i.STATUS.NORMAL)},i.prototype.changeStatus=function(t){var e=this.status;switch(t==this.status&&(t=i.STATUS.NORMAL),this.status){case i.STATUS.HIDDEN:this.getRootElement().removeAttr("data-visibility"),this.layerRow.removeClass("n2-ss-layer-status-hidden");break;case i.STATUS.LOCKED:this.layer.removeClass("n2-ss-layer-locked"),this.layerRow.removeClass("n2-ss-layer-status-locked")}switch(this.status=t,this.status){case i.STATUS.HIDDEN:this.getRootElement().attr("data-visibility","hidden"),this.layerRow.addClass("n2-ss-layer-status-hidden");break;case i.STATUS.LOCKED:this.layer.addClass("n2-ss-layer-locked"),this.layerRow.addClass("n2-ss-layer-status-locked")}this.placement.current.changeStatus(e,this.status)},i.prototype.moveX=function(t){"absolute"==this.placement.getType()&&this.placement.current.moveX(t)},i.prototype.moveY=function(t){"absolute"==this.placement.getType()&&this.placement.current.moveY(t)},i.prototype.localStyleSync=function(){if(this.localStyle!==e){var i=[],s="";this.$localStyle!==e&&(this.$localStyle.remove(),delete this.$localStyle);for(var r=0;r<this.localStyle.length;r++){var n="@rule"+this.localStyle[r].selector,o="";if(i.push(n),1!==Object.keys(this.localStyle[r].css).length||this.localStyle[r].css.transition===e){for(var a in this.localStyle[r].css)o+=this.localStyle[r].css[a];""!=o&&(s+=n+"{"+o+"}")}}var l=this.getProperty("uniqueclass");if(l)for(var r=0;r<i.length;r++)nextend.css.deleteRule(i[r].replace(/@rule/g,window.nextend.pre+"."+l));""!=s&&(l||(l=this.requestUniqueClass()),this.$localStyle=t("<style>"+s.replace(/@rule/g,window.nextend.pre+"."+l)+"</style>").appendTo("head"))}},i.prototype.addLocalStyle=function(t,i,s){for(var r=0;r<this.localStyle.length;r++)if(this.localStyle[r].group===t){""===s?this.localStyle[r].css[i]!==e&&delete this.localStyle[r].css[i]:this.localStyle[r].css[i]=s,this.localStyleSyncThrottled();break}},i.prototype.addClassElement=function(t,e){arguments.length<2&&(e=""),this.classElements.push({$el:t,postfix:e})},i}),N2D("Content",["ContentAbstract"],function(t,e){"use strict";function i(e,i,s){
8
- this.label=n2_("Content"),this.type="content",this.innerContainer="> .n2-ss-layer-content",this._defaults=t.extend({verticalalign:"center"},this._defaults),this.localStyle=[{group:"normal",selector:"",css:{transition:"transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;"}},{group:"hover",selector:":HOVER",css:{}}],N2Classes.ContentAbstract.prototype.constructor.call(this,e,i,s),this.placement.allow("content"),e.setMainContent(this)}return i.prototype=Object.create(N2Classes.ContentAbstract.prototype),i.prototype.constructor=i,i.prototype.addUILabels=function(){this.markTimer=null,this.uiLabel=t('<div class="n2-ss-layer-ui-label-container"><div class="n2-ss-layer-ui-label n2-ss-layer-ui-label-self">'+this.getUILabel()+"</div></div>").appendTo(this.layer)},i.prototype.addProperties=function(t){N2Classes.ContentAbstract.prototype.addProperties.call(this,t),this.createDeviceProperty("selfalign",{desktopPortrait:"inherit"},t)},i.prototype.getRootElement=function(){return this.layer},i.prototype.getBackgroundElement=function(){return this.layer},i.prototype._createLayer=function(){return t('<div class="n2-ss-layer n2-ss-content-empty"><div class="n2-ss-section-main-content n2-ss-layer-content"></div></div>').attr("data-sstype",this.type)},i.prototype.createRow=function(){this.addClassElement(this.layer),this.$content=this.layer.find(".n2-ss-layer-content:first");var e=t('<div class="n2-ss-layer-status"></div>'),i=t('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="'+n2_("Delete layer")+'"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on("click",t.proxy(this["delete"],this));this.container=new N2Classes.LayerContainer(this,t('<ul class="n2-list n2-h4 n2-list-orderable" />'),"normal","> .n2-ss-layer",["row","layer"]),this.container.setLayerContainerElement(this.$content),t('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(e).on("click",t.proxy(function(t){t.preventDefault(),this.status==N2Classes.ComponentAbstract.STATUS.HIDDEN?this.setStatusNormal():this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN)},this)),this._createLayerListRow([t('<div class="n2-actions-left"></div>').append(e),t('<div class="n2-actions"></div>').append(i)]).addClass("n2-ss-layer-content-row"),this.openerElement=t('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-col"></i></a>').insertBefore(this.layerTitleSpan).on("click",t.proxy(this.switchOpened,this)),this.container.$ul.appendTo(this.layerRow),this.readyDeferred.done(t.proxy(this._syncopened,this))},i.prototype.create=function(){this.originalProperties.adaptivefont=1,N2Classes.ContentAbstract.prototype.create.call(this),this._syncselfalign(),this._onReady()},i.prototype.load=function(t,e){N2Classes.ContentAbstract.prototype.load.call(this,t,e),this._syncselfalign(),this._onReady()},i.prototype._onReady=function(){N2Classes.ContentAbstract.prototype._onReady.call(this),this.startUISizing()},i.prototype.startUISizing=function(){this.layer.nUINormalSizing({start:t.proxy(function(t,e){N2Classes.PositionDisplay.get().show("NormalSizing"),"maxwidth"===e&&this.layer.attr("data-has-maxwidth","1")},this),resizeMaxWidth:t.proxy(function(t,e){N2Classes.PositionDisplay.get().update(t,"NormalSizing","Max-width: "+(0==e.value?"none":e.value+"px"))},this),stopMaxWidth:t.proxy(function(t,e){N2Classes.PositionDisplay.get().hide("NormalSizing"),this.setProperty("maxwidth",e.value)},this)})},i.prototype["delete"]=function(){for(var t=this.container.getSortedLayers(),e=0;e<t.length;e++)t[e]["delete"]()},i.prototype.remove=function(){this._delete()},i.prototype.update=function(){this.fragmentEditor.editor.getMainContainerElement().triggerHandler("updateSize")},i.prototype.onChildCountChange=function(){var t=this.container.getSortedLayers();this.layer.toggleClass("n2-ss-content-empty",0==t.length)},i.prototype.renderModeProperties=function(t){N2Classes.ContentAbstract.prototype.renderModeProperties.call(this,t),this._syncselfalign()},i.prototype._syncselfalign=function(){this.layer.attr("data-cssselfalign",this.getProperty("selfalign"))},i.prototype.duplicate=function(t){console.error("Content can not be duplicated!")},i}),N2D("ContentAbstract",["LayerContainer","ComponentAbstract"],function(t,e){"use strict";function i(e,i,s){this._defaults=t.extend({verticalalign:"flex-start"},this._defaults),this._syncbgThrottled=NextendThrottle(this._syncbgThrottled,50),this.stylemode="",N2Classes.ComponentAbstract.prototype.constructor.call(this,e,i,s)}return i.prototype=Object.create(N2Classes.ComponentAbstract.prototype),i.prototype.constructor=i,i.prototype.addProperties=function(i){this.createProperty("opened",1,i,this),N2Classes.ComponentAbstract.prototype.addProperties.call(this,i),this.createProperty("bgimage","",i),this.createProperty("bgimagex",50,i),this.createProperty("bgimagey",50,i),this.createProperty("bgimageparallax",0,i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("bgcolor","00000000",{"-hover":e},this,"stylemode"),i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("bgcolorgradient","off",{"-hover":e},this,"stylemode"),i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("bgcolorgradientend","00000000",{"-hover":e},this,"stylemode"),i),this.createProperty("verticalalign",this._defaults.verticalalign,i),this.createDeviceProperty("maxwidth",{desktopPortrait:0},i),this.createDeviceProperty("inneralign",{desktopPortrait:"inherit"},i),this.createDeviceProperty("padding",{desktopPortrait:"10|*|10|*|10|*|10|*|px+"},i),this.$.on("baseSizeUpdated.contentAbstract",t.proxy(this._syncpadding,this))},i.prototype.getBackgroundElement=function(){return this.$content},i.prototype.getPaddingElement=function(){return this.$content},i.prototype.create=function(){N2Classes.ComponentAbstract.prototype.create.call(this),this.initUI(),this._syncverticalalign(),this._syncmaxwidth(),this._syncpadding(),this._syncinneralign(),this._syncbgThrottled()},i.prototype.load=function(t,e){N2Classes.ComponentAbstract.prototype.load.call(this,t,e),this.initUI(),this._syncverticalalign(),this._syncmaxwidth(),this._syncpadding(),this._syncinneralign(),this._syncbgThrottled(),this.container.startWithExistingNodes(e)},i.prototype.initUI=function(){this.layer.on({mousedown:t.proxy(N2Classes.WindowManager.setMouseDownArea,null,"layerClicked"),click:t.proxy(function(t){!nextend.shouldPreventMouseUp&&this.fragmentEditor.preventActivationBubbling()&&this.activate(t)},this),dblclick:t.proxy(function(e){e.stopPropagation(),t('[data-tab="layer"]').trigger("click")},this)}),this.getPaddingElement().nUISpacing({handles:"n, s, e, w",start:t.proxy(function(t,e){N2Classes.PositionDisplay.get().show("Spacing")},this),spacing:t.proxy(function(t,e){var i="";for(var s in e.changed)i+="Padding "+s+": "+e.changed[s]+"px<br>";N2Classes.PositionDisplay.get().update(t,"Spacing",i)},this),stop:t.proxy(this.onSpacingStop,this)})},i.prototype.onSpacingStop=function(e,i){N2Classes.PositionDisplay.get().hide("Spacing");var s=this.getPadding().split("|*|"),r=1,n=1;"px+"==s[s.length-1]&&Math.abs(parseFloat(this.layer.css("fontSize"))-this.baseSize)>1&&(r=this.fragmentEditor.getResponsiveRatioHorizontal(),n=this.fragmentEditor.getResponsiveRatioVertical());for(var o in i.changed){var a=i.changed[o];switch(o){case"top":s[0]=Math.round(a/n);break;case"right":s[1]=Math.round(a/r);break;case"bottom":s[2]=Math.round(a/n);break;case"left":s[3]=Math.round(a/r)}}this.setProperty("padding",s.join("|*|")),t("#layercol-padding").data("field").insideChange(s.join("|*|"))},i.prototype.switchOpened=function(t){t.preventDefault(),this.getProperty("opened")?this.setProperty("opened",0):this.setProperty("opened",1)},i.prototype._syncopened=function(){this.getProperty("opened")?(this.openerElement.removeClass("n2-closed"),this.container.$ul.css("display",""),this.layer.triggerHandler("opened")):(this.openerElement.addClass("n2-closed"),this.container.$ul.css("display","none"),this.layer.triggerHandler("closed"))},i.prototype.getPadding=function(){return this.getProperty("padding")},i.prototype._syncpadding=function(){var t=this.getPadding().split("|*|"),e=t.pop(),i=this.baseSize;if("px+"==e&&i>0){e="em";for(var s=0;s<t.length;s++)t[s]=parseInt(t[s])/i}var r=t.join(e+" ")+e;this.getPaddingElement().css("padding",r),this.update(),this.getPaddingElement().nUISpacing("option","current",r)},i.prototype._syncmaxwidth=function(){var t=parseInt(this.getProperty("maxwidth"));0>=t||isNaN(t)?this.layer.css("maxWidth","").attr("data-has-maxwidth","0"):this.layer.css("maxWidth",t+"px").attr("data-has-maxwidth","1"),this.update()},i.prototype.getInnerAlign=function(){return this.getProperty("inneralign")},i.prototype._syncinneralign=function(){this.layer.attr("data-csstextalign",this.getInnerAlign()),this.refreshTextAlign()},i.prototype.getVerticalAlign=function(){return this.getProperty("verticalalign")},i.prototype._syncverticalalign=function(){this.$content.attr("data-verticalalign",this.getVerticalAlign())},i.prototype._syncbgimage=i.prototype._syncbgimagex=i.prototype._syncbgimagey=i.prototype._syncbgimageparallax=i.prototype._syncbgcolor=i.prototype._syncbgcolorgradient=i.prototype._syncbgcolorgradientend=i.prototype["_syncbgcolor-hover"]=i.prototype["_syncbgcolorgradient-hover"]=i.prototype["_syncbgcolorgradientend-hover"]=function(){this._syncbgThrottled()},i.prototype._syncbgThrottled=function(){var t="",i=this.fragmentEditor.editor.generator.fill(this.getProperty("bgimage")),s="";if(""!=i){var r=parseInt(this.getProperty("bgimagex"));isFinite(r)||(r=50);var n=parseInt(this.getProperty("bgimagey"));isFinite(n)||(n=50),t+='URL("'+nextend.imageHelper.fixed(i)+'") '+r+"% "+n+"% / cover no-repeat"+(1==this.getProperty("bgimageparallax")?" fixed":""),s=" "+r+"% "+n+"% / cover no-repeat"+(1==this.getProperty("bgimageparallax")?" fixed":"")}var o=this.getProperty("bgcolor"),a=this.getProperty("bgcolorgradient"),l=this.getProperty("bgcolorgradientend"),h=this.getBackgroundCSS(o,a,l,t,s);this.addLocalStyle("normal","bgcolor",h);var d="",p=!1,c=this.getProperty("bgcolor-hover"),u=this.getProperty("bgcolorgradient-hover"),y=this.getProperty("bgcolorgradientend-hover");c!==e&&c!=o&&(p=!0),u!==e&&u!=a&&(p=!0),y!==e&&y!=l&&(p=!0),p&&(c===e&&(c=o),u===e&&(u=a),y===e&&(y=l),d=this.getBackgroundCSS(c,u,y,t,s)),this.addLocalStyle("hover","bgcolor",d)},i.prototype.getBackgroundCSS=function(t,e,i,s,r){if(0!=N2Color.hex2alpha(t)||"off"!=e&&0!=N2Color.hex2alpha(i)){var n="";switch(""!=s&&(n=r+","+s),e){case"horizontal":return"background:linear-gradient(to right, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"vertical":return"background:linear-gradient(to bottom, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"diagonal1":return"background:linear-gradient(45deg, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"diagonal2":return"background:linear-gradient(135deg, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"off":default:return""!=s?"background: linear-gradient("+N2Color.hex2rgbaCSS(t)+", "+N2Color.hex2rgbaCSS(t)+")"+n+";":"background:"+N2Color.hex2rgbaCSS(t)+";"}}else if(""!=s)return"background:"+s+";";return""},i.prototype.getData=function(t){var e=N2Classes.ComponentAbstract.prototype.getData.call(this,t);return t.layersIncluded&&(e.layers=this.container.getData(t)),e},i.prototype.onChildCountChange=function(){this.layer.toggleClass("n2-ss-content-empty",0==this.container.getLayerCount()),this.update()},i.prototype.renderModeProperties=function(t){N2Classes.ComponentAbstract.prototype.renderModeProperties.call(this,t),this._syncmaxwidth(),this._syncpadding(),this._syncinneralign()},i.prototype.getDroppable=function(){return this.layer.is(":visible")&&this.status!=N2Classes.ComponentAbstract.STATUS.HIDDEN&&this.status!=N2Classes.ComponentAbstract.STATUS.LOCKED?{$container:this.$content,layer:this,placement:"normal",axis:"y"}:"hidden"},i.prototype.getLLDroppable=function(t){switch(t.type){case"layer":case"row":return{$container:this.container.$ul,layer:this}}return!1},i.prototype.getContents=function(){return this.$content},i.prototype.setPropertystylemode=function(t,e,i){this.stylemode=e,this.syncAdvancedField("bgcolor"),this.syncAdvancedField("bgcolorgradient"),this.syncAdvancedField("bgcolorgradientend")},i.prototype.onSyncFields=function(){this.fragmentEditor.layerOptions.updateField("stylemode",this.stylemode)},i}),N2D("Layer",["ComponentAbstract"],function(t,e){"use strict";function i(e,i,s){this.label=n2_("Layer"),this.type="layer",this.parent=!1,this.itemEditor=e.itemEditor,N2Classes.ComponentAbstract.prototype.constructor.call(this,e,i,s),this.placement.allow("absolute"),this.placement.allow("normal"),this.$.on("load create",t.proxy(this.startItem,this))}return i.prototype=Object.create(N2Classes.ComponentAbstract.prototype),i.prototype.constructor=i,i.prototype.create=function(){N2Classes.ComponentAbstract.prototype.create.apply(this,arguments),this.initUI(),this._onReady()},i.prototype.load=function(t,e){N2Classes.ComponentAbstract.prototype.load.call(this,t,e),this.initUI(),this._onReady()},i.prototype.startItem=function(){var t=this.layer.find(".n2-ss-item");new(N2Classes[this.itemEditor.getItemClass(t.data("item"))])(t,this,this.itemEditor),this.layer.nUICanvasItem({canvasUIManager:this.fragmentEditor.mainContainer.canvasUIManager,layer:this,$layer:this.layer}),this.item.needSize&&this.layer.addClass("n2-ss-layer-needsize")},i.prototype.initUI=function(){this.layer.on({mousedown:t.proxy(N2Classes.WindowManager.setMouseDownArea,null,"layerClicked"),click:t.proxy(function(t){this.fragmentEditor.preventActivationBubbling()&&this.activate(t)},this),dblclick:t.proxy(function(e){N2Classes.WindowManager.get().isPreventDblClick||(e.stopPropagation(),t('[data-tab="item"]').trigger("click"),this.item.itemEditor.focusFirst("dblclick"))},this)})},i.prototype.getContent=function(){var t=this.layer,e=t.data("animatableselector");return e&&(t=t.find(e)),t},i.prototype._createLayer=function(){return t('<div class="n2-ss-layer"></div>').attr("data-sstype",this.type)},i.prototype.createRow=function(){var e=t('<div class="n2-ss-layer-status"></div>'),i=t('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="'+n2_("Delete layer")+'"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on("click",t.proxy(this["delete"],this)),s=t('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="'+n2_("Duplicate layer")+'"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on("click",t.proxy(function(){this.duplicate(!0,!1)},this));t('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(e).on("click",t.proxy(function(t){t.preventDefault(),this.status==N2Classes.ComponentAbstract.STATUS.HIDDEN?this.setStatusNormal():this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN)},this)),this._createLayerListRow([t('<div class="n2-actions-left"></div>').append(e),t('<div class="n2-actions"></div>').append(s).append(i)]).addClass("n2-ss-layer-layer-row")},i.prototype.activate=function(t,e,i){N2Classes.PluginActivatable.prototype.activate.call(this,t,e,i),this.item?this.item.activate(null,e):console.error("The layer do not have item on it!")},i.prototype.getHTML=function(t){var e=N2Classes.ComponentAbstract.prototype.getHTML.call(this,t),i=this.item.getHTML(t);return e.attr("style",e.attr("style")+this.getStyleText()).append(i),e},i.prototype.getData=function(t){var e=N2Classes.ComponentAbstract.prototype.getData.call(this,t);return t.itemsIncluded&&(e.item=this.item.getData()),e},i.prototype.getStyleText=function(){var t="",e=this.property.crop;return"auto"!=e&&"mask"!=e||(e="hidden"),t+="overflow:"+e+";"},i.prototype.getContents=function(){return this.item.$item},i.prototype.setSelf=function(t){this.self!=this&&this.self.setSelf(t),this.self=t,this.item.setSelf(t.item)},i.prototype.getSelf=function(){return this.self!==this&&(this.self=this.self.getSelf()),this.self},i}),N2D("LayerAdvancedProperty",function(t,e){"use strict";function i(t,e,i,s,r){this.basename=t,this.def=e,this.modesDef=i,this.obj=s,this.propName=r}return i.prototype.getBaseName=function(){return this.basename},i.prototype.getNames=function(){var t={};t[this.basename]=this.def;for(var e in this.modesDef)t[this.basename+e]=this.modesDef[e];return t},i.prototype.getCurrentMode=function(){return this.obj[this.propName]},i.prototype.getName=function(){var t=this.getCurrentMode();return""!==t?this.basename+t:this.basename},i.prototype.getDefault=function(){var t=this.getCurrentMode();return""!==t?this.modesDef[t]:this.def},i.prototype.resetMode=function(t){if(this.propName==t){var e=this.getCurrentMode();if(""!==e){var i=this.obj.property[this.basename+e];this.obj.property[this.basename+e]=this.modesDef[e],this.obj.syncAdvancedField(this.basename),this.obj.render(this.basename+e,i,"manager")}}},i}),N2D("MainContainer",["LayerContainer"],function(t,e){"use strict";function i(e){this.baseSize=16,this.activeLayer=null,this.$=e.$,this.isActiveGroupBlurred=!0,this.isMainGroup=!0,this.fragmentEditor=e,this.layer=e.editor.getMainContainerElement(),this.layer.nUICanvas({mainContainer:this,tolerance:5,smartguides:t.proxy(function(t){return t.$layer.triggerHandler("LayerParent"),this.fragmentEditor.getSnap()},this),display:{hidden:!0,show:t.proxy(function(){N2Classes.PositionDisplay.get().show("Canvas")},this),update:t.proxy(function(t,e){N2Classes.PositionDisplay.get().update(t,"Canvas","L: "+parseInt(0|e.left)+"px<br />T: "+parseInt(0|e.top)+"px")},this),hide:t.proxy(function(){N2Classes.PositionDisplay.get().hide("Canvas")},this)},start:t.proxy(function(t,e){this.fragmentEditor.canvasDragStart(t,e)},this),drag:t.proxy(function(t,e){this.fragmentEditor.canvasDragMove(t,e),e.layer&&e.layer.placement.current.triggerLayerResized()},this),stop:t.proxy(function(t,e){this.fragmentEditor.canvasDragStop(t,e),e.layer&&e.layer.placement.current.triggerLayerResized()},this)}),this.canvasUIManager=this.layer.nUICanvas("instance"),this.layer.nUILayerList({mainContainer:this,$fixed:t("#n2-ss-layers"),$scrolled:t("#n2-ss-layer-list")}),this.layerListUIManager=this.layer.nUILayerList("instance"),this.layer.parent().prepend('<div class="n2-ss-slide-border n2-ss-slide-border-left" /><div class="n2-ss-slide-border n2-ss-slide-border-top" /><div class="n2-ss-slide-border n2-ss-slide-border-right" /><div class="n2-ss-slide-border n2-ss-slide-border-bottom" />'),this.container=new N2Classes.LayerContainer(this,t("#n2-ss-layer-list").find("ul"),"absolute","> .n2-ss-layer, > .n2-ss-layer-group",["content","row","layer","group"]),this.layerRow=this.container.$ul,this.$.on("layerCreated",t.proxy(function(){this.refreshHasLayers()},this))}return i.prototype.lateInit=function(){this.container.startWithExistingNodes(!0),this.layer.parent().on("click",t.proxy(function(){this.fragmentEditor.shouldPreventActivationBubble?this.blurActiveGroup():this.unBlurActiveGroup(),this.fragmentEditor.allowActivation()},this))},i.prototype.onResize=function(t){for(var e=this.getEverySortedLayers(),i=0;i<e.length;i++)e[i].placement.doLinearResize(t)},i.prototype.getEverySortedLayers=function(){for(var t=this.container.getChildLayersRecursive(!1),e={},i=t.length-1;i>=0;i--)"undefined"!=typeof t[i].property.parentid&&t[i].property.parentid&&("undefined"==typeof e[t[i].property.parentid]&&(e[t[i].property.parentid]=[]),e[t[i].property.parentid].push(t[i]),t.splice(i,1));for(var i=0;i<t.length;i++)"undefined"!=typeof t[i].property.id&&t[i].property.id&&"undefined"!=typeof e[t[i].property.id]&&(e[t[i].property.id].unshift(0),e[t[i].property.id].unshift(i+1),t.splice.apply(t,e[t[i].property.id]),delete e[t[i].property.id]);return t},i.prototype.deleteLayers=function(){for(var t=this.container.getSortedLayers(),e=0;e<t.length;e++)t[e]["delete"]()},i.prototype.blurActiveGroup=function(){this.isActiveGroupBlurred=!0},i.prototype.unBlurActiveGroup=function(){this.isActiveGroupBlurred=!1},i.prototype.getActiveGroup=function(){if(this.isActiveGroupBlurred){var t=this,e=this.activeLayer;switch(this.fragmentEditor.isGroup(e)||this.fragmentEditor.isCol(e)||this.fragmentEditor.isContent(e)?t=e:this.fragmentEditor.isRow(e)?t=e.container.getSortedLayers()[0]:e&&(t=e.group),this.fragmentEditor.currentEditorMode){case"content":t==this&&(t=this.fragmentEditor.mainContent);break;case"canvas":t==this.fragmentEditor.mainContent&&(t=this)}return t}switch(this.fragmentEditor.currentEditorMode){case"content":return this.fragmentEditor.mainContent}return this},i.prototype.getSelectedLayer=function(){return null==this.activeLayer?!1:this.activeLayer},i.prototype.getLayerData=function(t){if(t===e)return[];for(var i=[],s=[],r=0;r<t.length;r++)t[r].getDataWithChildren(i,s);return i},i.prototype.layerDeleted=function(t){for(var e=this.fragmentEditor.selectedLayers.length;e--;)t==this.fragmentEditor.selectedLayers[e]&&this.fragmentEditor.selectedLayers.splice(e,1);this._afterLayerDeletedDeBounced(t),this.refreshHasLayers()},i.prototype._afterLayerDeletedDeBounced=NextendDeBounce(function(t){this.activeLayer&&!this.activeLayer.isDeleted||this.fragmentEditor.resetActiveLayer()},50),i.prototype.refreshHasLayers=function(){t("body").toggleClass("n2-ss-has-layers",this.container.getLayerCount()>0),nextend.triggerResize()},i.prototype.getName=function(){return"Slide"},i.prototype.update=function(){},i.prototype.onChildCountChange=function(){},i.prototype.markEnter=function(t){},i.prototype.markLeave=function(t){},i.prototype.getSelf=function(){return this},i.prototype.createLayerAnimations=function(){for(var t=this.fragmentEditor.editor.getHorizontalRatio(),e=this.fragmentEditor.editor.getVerticalRatio(),i=[],s=this.container.getSortedLayers(),r=0;r<s.length;r++)i.push.apply(i,s[r].createLayerAnimations(t,e));return i},i.prototype.getDroppables=function(e){var i,s=this.fragmentEditor.currentEditorMode,r=[];if("canvas"==s){r.push(this.getDroppable()),i=this.container.getSortedLayers();var n=t.inArray(this.fragmentEditor.mainContent,i);n>-1&&i.splice(n,1)}else"content"==s&&(i=[this.fragmentEditor.mainContent]);for(var o=0;o<i.length;o++)if(i[o]!=e){var a=i[o].getDroppable();"object"==typeof a&&r.push(a),"hidden"!=a&&i[o].container&&r.push.apply(r,i[o].container.getDroppables(e))}return r},i.prototype.getLLDroppables=function(t){return this.container.getLLDroppables(t)},i.prototype.getDroppable=function(){return{$container:this.layer,layer:this,placement:"absolute"}},i.prototype.getLLDroppable=function(t){switch(t.type){case"layer":case"row":case"group":case"content":return{$container:this.container.$ul,layer:this}}return!1},i.prototype.replaceLayers=function(e){this._idTranslation={};var i=this.dataToLayers(t.extend(!0,[],e).reverse()),s=[];this.deleteLayers(),this.fragmentEditor.mainContent.remove();for(var r=0;r<i.length;r++)s.push(this.container.append(i[r]));return this.fragmentEditor.refreshMode(),this.container.layerContainerElement.n2imagesLoaded().always(t.proxy(this.fragmentEditor.refreshMode,this.fragmentEditor)),this.getSelectedLayer()||s.length>0&&s[0].activate(),N2Classes.History.get().isEnabled()&&N2Classes.History.get().addSimple(this,this.historyDeleteAll,this.historyReplaceLayers,[e,s,this.container.getAllLayers()]),s},i.prototype.historyDeleteAll=function(t,e){for(var i=0;i<e.length;i++)e[i].getSelf()["delete"]();this.fragmentEditor.mainContent.getSelf().remove()},i.prototype.historyReplaceLayers=function(t,e,i){this.replaceLayers(t);for(var s=this.container.getAllLayers(),r=0;r<i.length;r++)i[r].setSelf(s[r])},i.prototype.addLayers=function(e,i){this._idTranslation={};for(var s=this.dataToLayers(t.extend(!0,[],e)),r=[],n=0;n<s.length;n++)r.push(i.container.append(s[n]));return this.fragmentEditor.refreshMode(),N2Classes.History.get().addSimple(this,this.historyDeleteLayers,this.historyAddLayers,[e,r,i]),r},i.prototype.historyDeleteLayers=function(t,e,i){for(var s=0;s<e.length;s++)e[s].getSelf()["delete"]()},i.prototype.historyAddLayers=function(t,e,i){for(var s=this.addLayers(t,i.getSelf()),r=0;r<e.length;r++)e[r].setSelf(s[r])},i.prototype.dataToLayers=function(t,e){for(var i=[],s=0;s<t.length;s++)switch(t[s].type){case"group":console.error("Group data to layer not implemented!");break;case"row":i.push(this.buildRowNode(t[s],e));break;case"col":i.push(this.buildColNode(t[s],e));break;case"content":i.push(this.buildContentNode(t[s],e));break;case"layer":default:i.push(this.buildLayerNode(t[s],e))}return i},i.prototype._buildNodePrepareID=function(e,i){if(i.id){var s=t.fn.uid(),r=!1;"object"==typeof this._idTranslation[i.id]&&(r=this._idTranslation[i.id]),this._idTranslation[i.id]=s,i.id=s,e.attr("id",s),r&&r.resolve(i.id,s)}if(i.parentid)switch(typeof this._idTranslation[i.parentid]){case"string":i.parentid=this._idTranslation[i.parentid];break;case"undefined":this._idTranslation[i.parentid]=t.Deferred();case"object":this._idTranslation[i.parentid].done(t.proxy(function(t,e,i){t.data("parentid",i)},this,e));break;default:i.parentid=""}},i.prototype.buildContentNode=function(i,s){var r=t("<div class='n2-ss-layer' data-sstype='content'/>"),n=t("<div class='n2-ss-section-main-content n2-ss-layer-content' />").appendTo(r);for(var o in i)r.data(o,i[o]);return s!==e&&r.appendTo(s),this.dataToLayers(i.layers,n),r},i.prototype.buildRowNode=function(i,s){var r=t("<div class='n2-ss-layer' data-sstype='row'/>"),n=t("<div class='n2-ss-layer-row' />").appendTo(r);this._buildNodePrepareID(r,i);for(var o in i)r.data(o,i[o]);return s!==e&&r.appendTo(s),this.dataToLayers(i.cols,n),r},i.prototype.buildColNode=function(i,s){var r=t("<div class='n2-ss-layer' data-sstype='col'/>"),n=t("<div class='n2-ss-layer-col n2-ss-layer-content' />").appendTo(r);for(var o in i)r.data(o,i[o]);return s!==e&&r.appendTo(s),this.dataToLayers(i.layers,n),r},i.prototype.buildLayerNode=function(i,s){var r=t("<div class='n2-ss-layer' data-sstype='layer'></div>").attr("style",i.style),n=1;i.zIndex&&(n=i.zIndex),this._buildNodePrepareID(r,i),i.items!==e&&(i.item=i.items[0],delete i.items),t('<div class="n2-ss-item n2-ss-item-'+i.item.type+'"></div>').data("item",i.item.type).data("itemvalues",i.item.values).appendTo(r),delete i.style,delete i.item;for(var o in i)r.data(o,i[o]);return s!==e&&r.appendTo(s),r},i}),N2D("Row",["LayerContainer","ComponentAbstract"],function(t,e){"use strict";function i(e,i,s){this.label=n2_("Row"),this.type="row",this._syncbgThrottled=NextendThrottle(this._syncbgThrottled,50),this.innerContainer="> .n2-ss-layer-row > .n2-ss-layer-row-inner",this.localStyle=[{group:"normal",selector:"-inner",css:{transition:"transition:all .3s;transition-property:border,background-image,background-color,border-radius,box-shadow;"}},{group:"hover",selector:"-inner:HOVER",css:{}}],this.columnsField=t("#layerrow-columns").data("field"),this.refreshUI=NextendDeBounce(this.refreshUI,100),this.stylemode="",N2Classes.ComponentAbstract.prototype.constructor.call(this,e,i,s),this.placement.allow("absolute"),this.placement.allow("normal")}return i.prototype=Object.create(N2Classes.ComponentAbstract.prototype),i.prototype.constructor=i,i.prototype.addProperties=function(i){this.createProperty("opened",1,i,this),N2Classes.ComponentAbstract.prototype.addProperties.call(this,i),this.createProperty("href","",i),this.createProperty("href-target","_self",i),this.createProperty("bgimage","",i),this.createProperty("bgimagex",50,i),this.createProperty("bgimagey",50,i),this.createProperty("bgimageparallax",0,i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("bgcolor","00000000",{"-hover":e},this,"stylemode"),i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("bgcolorgradient","off",{"-hover":e},this,"stylemode"),i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("bgcolorgradientend","00000000",{"-hover":e},this,"stylemode"),i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("borderradius",0,{"-hover":e},this,"stylemode"),i),this.createAdvancedProperty(new N2Classes.LayerAdvancedProperty("boxshadow","0|*|0|*|0|*|0|*|00000080",{"-hover":e},this,"stylemode"),i),this.createProperty("fullwidth",1,i),this.createProperty("stretch",0,i),this.createDeviceProperty("inneralign",{desktopPortrait:"inherit"},i),this.createDeviceProperty("padding",{desktopPortrait:"10|*|10|*|10|*|10|*|px+"},i),this.createDeviceProperty("gutter",{desktopPortrait:20},i),this.createDeviceProperty("wrapafter",{desktopPortrait:0,mobilePortrait:1,mobileLandscape:1},i),this.$.on("baseSizeUpdated.row",t.proxy(this._syncpadding,this))},i.prototype.historyDeleteSelf=function(){this["delete"]()},i.prototype.historyCreateSelf=function(t,e,i){var s=new N2Classes.Row(this.fragmentEditor,t.getSelf(),{});s.create(e),this.setSelf(s);for(var r=s.container.getSortedLayers(),n=0;n<r.length;n++)i[n].setSelf(r[n])},i.prototype.create=function(e){var i,s=function(e){return t("<div class='n2-ss-layer' />").append(t("<div class='n2-ss-layer-row' />").append(t("<div class='n2-ss-layer-row-inner' />").append(e))).attr("data-sstype","row")},r=function(e){return t("<div class='n2-ss-layer' data-sstype='col'/>").append(t("<div class='n2-ss-layer-col n2-ss-layer-content' />").append(e))};switch(e){case"2col":i=function(t){return s([r(),r()])};break;case"2col-60-40":i=function(t){return s([r().data("colwidth","6/10"),r().data("colwidth","4/10")])};break;case"2col-40-60":i=function(t){return s([r().data("colwidth","4/10"),r().data("colwidth","6/10")])};break;case"2col-80-20":i=function(t){return s([r().data("colwidth","8/10"),r().data("colwidth","2/10")])};break;case"2col-20-80":i=function(t){return s([r().data("colwidth","2/10"),r().data("colwidth","8/10")])};break;case"3col":i=function(t){return s([r(),r(),r()])};break;case"3col-20-60-20":i=function(t){return s([r().data("colwidth","2/10"),r().data("colwidth","6/10"),r().data("colwidth","2/10")])};break;case"4col":i=function(t){return s([r(),r(),r(),r()])};break;case"special":i=function(t){var e=s([r(),r()]);return s([r().data("colwidth","1/5"),r(e).data("colwidth","4/5")])};break;default:i=function(t){return s([r()])}}"absolute"===this.group.container.allowedPlacementMode&&(this.originalProperties=t.extend({width:"100%",align:"center",valign:"top",top:20},this.originalProperties)),N2Classes.ComponentAbstract.prototype.create.call(this,i,!0),this.initUI(),this.container.startWithExistingNodes(!1),this._syncpadding(),this._syncinneralign(),this._syncfullwidth(),this._syncstretch(),this._syncbgThrottled(),this._syncborderradius(),this._syncboxshadow(),this.renderModeProperties(),this.container.renderModeProperties(),N2Classes.History.get().addSimple(this,this.historyDeleteSelf,this.historyCreateSelf,[this.group,e,this.container.getSortedLayers()]),this._onReady()},i.prototype.load=function(t,e){N2Classes.ComponentAbstract.prototype.load.call(this,t,e),this.initUI(),this.container.startWithExistingNodes(e),this._syncpadding(),this._syncinneralign(),this._syncfullwidth(),this._syncstretch(),this._syncbgThrottled(),this._syncborderradius(),this._syncboxshadow(),this._onReady()},i.prototype.initUI=function(){this.layer.nUICanvasItem({canvasUIManager:this.fragmentEditor.mainContainer.canvasUIManager,layer:this,$layer:this.layer}),this.layer.on({mousedown:t.proxy(N2Classes.WindowManager.setMouseDownArea,null,"layerClicked"),click:t.proxy(function(t){!nextend.shouldPreventMouseUp&&this.fragmentEditor.preventActivationBubbling()&&this.activate(t)},this),dblclick:t.proxy(function(e){e.stopPropagation(),t('[data-tab="row"]').trigger("click")},this)}),this.$row.nUISpacing({handles:"n, s, e, w",start:t.proxy(function(t,e){N2Classes.PositionDisplay.get().show("Spacing")},this),spacing:t.proxy(function(t,e){var i="";for(var s in e.changed)i+="Padding "+s+": "+e.changed[s]+"px<br>";
9
- N2Classes.PositionDisplay.get().update(t,"Spacing",i)},this),stop:t.proxy(this.____makeLayerResizeableStop,this)}),this.$row.nUIColumns({columns:"1",gutter:this.getGutter(),start:t.proxy(function(t,e){N2Classes.PositionDisplay.get().show("Columns")},this),colwidth:t.proxy(function(t,e){this.updateColumnWidth(e.currentPercent),N2Classes.PositionDisplay.get().update(t,"Columns",Math.round(100*e.currentPercent[e.index])+"% &mdash; "+Math.round(100*e.currentPercent[e.index+1])+"%")},this),stop:t.proxy(function(t,e){N2Classes.PositionDisplay.get().hide("Columns"),this.setRealColsWidth(e.currentFractions)},this)});var e={};this.$rowInner.nUISortableRow({distance:10,helper:"clone_hide",forceHelperSize:!0,forcePlaceholderSize:!0,items:"> .n2-ss-layer",handle:" > .n2-ss-layer-ui-label-container > .n2-ss-layer-ui-label-self",start:t.proxy(function(t,i){e.originalPrevLayer=i.item.prevAll(".n2-ss-layer").not(i.placeholder).first().data("layerObject");var s=this.getColumns().split("+");i.placeholder.css({width:100*new Fraction(s[i.item.data("layerObject").getIndex()]).valueOf()+"%",visibility:"visible",margin:this.getGutter()+"px"}),i.helper.hasClass("n2-ss-last-in-row")&&i.placeholder.addClass("n2-ss-last-in-row"),i.placeholder.css("order",i.helper.css("order")),i.placeholder.attr("data-r",i.helper.attr("data-r"))},this),beforestop:t.proxy(function(t,i){i.placeholder.detach(),e.layer=i.item.data("layerObject"),e.oldIndex=e.layer.getOrderedIndex()},this),stop:t.proxy(function(t,i){var s=e.layer,r=e.oldIndex,n=0;switch(e.originalPrevLayer?s.layer.insertAfter(e.originalPrevLayer.layer):s.layer.prependTo(s.group.container.layerContainerElement),i.lastPosition[1]){case"before":n=i.lastPosition[0].data("layerObject").getOrderedIndex(),n>r&&n--;break;case"after":n=i.lastPosition[0].data("layerObject").getOrderedIndex(),r>n&&n++}r!==n&&this.moveCol(r,n)},this)})},i.prototype.____makeLayerResizeableStop=function(e,i){N2Classes.PositionDisplay.get().hide("Spacing");var s=this.getPadding().split("|*|"),r=1,n=1;"px+"==s[s.length-1]&&Math.abs(parseFloat(this.layer.css("fontSize"))-this.baseSize)>1&&(r=this.fragmentEditor.getResponsiveRatioHorizontal(),n=this.fragmentEditor.getResponsiveRatioVertical());for(var o in i.changed){var a=i.changed[o];switch(o){case"top":s[0]=Math.round(a/n);break;case"right":s[1]=Math.round(a/r);break;case"bottom":s[2]=Math.round(a/n);break;case"left":s[3]=Math.round(a/r)}}this.setProperty("padding",s.join("|*|")),t("#layerrow-padding").data("field").insideChange(s.join("|*|"))},i.prototype._createLayer=function(){return t('<div class="n2-ss-layer"><div class="n2-ss-layer-row"><div class="n2-ss-layer-row-inner"></div></div></div>').attr("data-sstype",this.type)},i.prototype.historyDeleteCol=function(t,e){e.getSelf()["delete"]()},i.prototype.historyCreateCol=function(t,e){var i=t.getSelf().createCol();e.setSelf(i)},i.prototype.createCol=function(){var t=new N2Classes.Col(this.fragmentEditor,this,{});return N2Classes.History.get().addSimple(this,this.historyDeleteCol,this.historyCreateCol,[this,t]),t.create(),this.isReady()&&this.placement.updatePosition(),t},i.prototype.createRow=function(){this.$row=this.layer.find(".n2-ss-layer-row:first"),this.$rowInner=this.$row.find(".n2-ss-layer-row-inner:first"),0===this.$rowInner.length&&(this.$rowInner=t('<div class="n2-ss-layer-row-inner"></div>').append(this.$row.find("> *")).appendTo(this.$row)),this.container=new N2Classes.LayerContainer(this,t('<ul class="n2-list n2-h4 n2-list-orderable" />'),"default"," > .n2-ss-layer",["col"]),this.container.setLayerContainerElement(this.$rowInner),this.addClassElement(this.layer),this.addClassElement(this.$row,"-inner");var e=t('<div class="n2-ss-layer-status"></div>'),i=t('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="'+n2_("Delete layer")+'"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on("click",t.proxy(this["delete"],this)),s=t('<div class="n2-button n2-button-icon n2-button-m n2-button-m-narrow" data-n2tip="'+n2_("Duplicate layer")+'"><i class="n2-i n2-i-duplicate n2-i-grey-opacity"></i></div>').on("click",t.proxy(function(){this.duplicate(!0,!1)},this));t('<a href="#" class="n2-ss-sc-hide n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-eye"></i></a>').appendTo(e).on("click",t.proxy(function(t){t.preventDefault(),this.status==N2Classes.ComponentAbstract.STATUS.HIDDEN?this.setStatusNormal():this.changeStatus(N2Classes.ComponentAbstract.STATUS.HIDDEN)},this)),this._createLayerListRow([t('<div class="n2-actions-left"></div>').append(e),t('<div class="n2-actions"></div>').append(s).append(i)]).addClass("n2-ss-layer-row-row"),this.openerElement=t('<a href="#" class="n2-ss-layer-icon n2-button n2-button-icon n2-button-m"><i class="n2-i n2-i-row"></i></a>').insertBefore(this.layerTitleSpan).on("click",t.proxy(this.switchOpened,this)),this.container.$ul.appendTo(this.layerRow),this.readyDeferred.done(t.proxy(this._syncopened,this))},i.prototype.activate=function(){N2Classes.PluginActivatable.prototype.activate.apply(this,arguments),this.columnsField.setRow(this),this.$row.nUIColumns("option","active",1)},i.prototype.deActivate=function(){this.$row.nUIColumns("option","active",0),N2Classes.PluginActivatable.prototype.deActivate.apply(this,arguments)},i.prototype.switchOpened=function(t){t.preventDefault(),this.getProperty("opened")?this.setProperty("opened",0):this.setProperty("opened",1)},i.prototype._syncopened=function(){this.getProperty("opened")?(this.openerElement.removeClass("n2-closed"),this.container.$ul.css("display",""),this.layer.triggerHandler("opened")):(this.openerElement.addClass("n2-closed"),this.container.$ul.css("display","none"),this.layer.triggerHandler("closed"))},i.prototype.getColumns=function(){for(var t=this.container.getSortedLayers(),e=[],i=0;i<t.length;i++)e.push(t[i].getProperty("colwidth"));return e.join("+")},i.prototype.getColumnsOrdered=function(){for(var t=this.getOrderedColumns(),e=[],i=0;i<t.length;i++)e.push(t[i].getProperty("colwidth"));return e.join("+")},i.prototype._synccolumns=function(){for(var t=this.container.getSortedLayers(),e=0;e<t.length;e++)t[e]._synccolwidth();this.update()},i.prototype.getPadding=function(){return this.getProperty("padding")},i.prototype._syncpadding=function(){var t=this.getPadding().split("|*|"),e=t.pop(),i=this.baseSize;if("px+"==e&&i>0){e="em";for(var s=0;s<t.length;s++)t[s]=parseInt(t[s])/i}var r=t.join(e+" ")+e;this.$row.css("padding",r),this.$row.nUISpacing("option","current",r),this.update()},i.prototype.getGutter=function(){return this.getProperty("gutter")},i.prototype._syncgutter=function(){var t=this.getGutter(),e=t/2,i=this.container.getSortedLayers();if(i.length>0)for(var s=i.length-1;s>=0;s--)i[s].layer.css("margin",e+"px");this.$rowInner.css({width:"calc(100% + "+(t+1)+"px)",margin:-e+"px"}),this.$row.nUIColumns("option","gutter",this.getGutter()),this._syncwrapafter(),this.update()},i.prototype._syncwrapafter=function(){if(!this.isDeleted&&!this.isDeleteStarted){var t,e=parseInt(this.getProperty("wrapafter")),i=this.getOrderedColumns(),s=!1;for(t=i.length-1;t>=0;t--)i[t].showsOnCurrent||i.splice(t,1);var r=i.length;if(e>0&&r>e&&(s=!0),this.$row.attr("row-wrapped",s?1:0),s){var n=[];for(t=0;r>t;t++){var o=Math.floor(t/e);"undefined"==typeof n[o]&&(n[o]=[]),n[o].push(i[t]),i[t].layer.attr("data-r",o).toggleClass("n2-ss-last-in-row",(t+1)%e===0||t===r-1)}var a=this.getGutter();for(t=0;t<n.length;t++){var l,h=n[t],d=0;for(l=0;l<h.length;l++)d+=h[l].getWidthPercentage();for(l=0;l<h.length;l++)h[l].layer.css("width","calc("+h[l].getWidthPercentage()/d*100+"% - "+(n2const.isIE?a+1:a)+"px)")}}else{var d=0;for(t=0;r>t;t++)d+=i[t].getWidthPercentage();for(t=0;r>t;t++)i[t].layer.css("width",i[t].getWidthPercentage()/d*100+"%").removeClass("n2-ss-last-in-row").attr("data-r",0);r>0&&i[r-1].layer.addClass("n2-ss-last-in-row")}this.update()}},i.prototype.getOrderedColumns=function(){return this.container.getSortedLayers().sort(function(t,e){return t.getRealOrder()-e.getRealOrder()})},i.prototype.getInnerAlign=function(){return this.getProperty("inneralign")},i.prototype._syncinneralign=function(){this.layer.attr("data-csstextalign",this.getInnerAlign()),this.refreshTextAlign()},i.prototype._syncfullwidth=function(){this.layer.attr("data-frontend-fullwidth",0==this.getProperty("fullwidth")?"0":"1")},i.prototype._syncstretch=function(){this.layer.toggleClass("n2-ss-stretch-layer",1==this.getProperty("stretch"))},i.prototype._syncborderradius=i.prototype["_syncborderradius-hover"]=function(){var t=this.getProperty("borderradius");t>0&&this.addLocalStyle("normal","borderradius","border-radius:"+t+"px;");var e=this.getProperty("borderradius-hover");e&&e!=t&&this.addLocalStyle("hover","borderradius","border-radius:"+e+"px;")},i.prototype._syncboxshadow=i.prototype["_syncboxshadow-hover"]=function(){var t=this.getProperty("boxshadow");this.addLocalStyle("normal","boxshadow",this.getBoxShadowCSS(t.split("|*|")));var i="",s=this.getProperty("boxshadow-hover");s!==e&&s!=t&&(i=this.getBoxShadowCSS(s.split("|*|"))),this.addLocalStyle("hover","boxshadow",i)},i.prototype.getBoxShadowCSS=function(t){return 0==t[0]&&0==t[1]&&0==t[2]&&0==t[3]||0==N2Color.hex2alpha(t[4])?"":"box-shadow:"+t[0]+"px "+t[1]+"px "+t[2]+"px "+t[3]+"px "+N2Color.hex2rgbaCSS(t[4])+";"},i.prototype._synchref=i.prototype["_synchref-target"]=function(){},i.prototype._syncbgimage=i.prototype._syncbgimagex=i.prototype._syncbgimagey=i.prototype._syncbgimageparallax=i.prototype._syncbgcolor=i.prototype._syncbgcolorgradient=i.prototype._syncbgcolorgradientend=i.prototype["_syncbgcolor-hover"]=i.prototype["_syncbgcolorgradient-hover"]=i.prototype["_syncbgcolorgradientend-hover"]=function(){this._syncbgThrottled()},i.prototype._syncbgThrottled=function(){var t="",i=this.fragmentEditor.editor.generator.fill(this.getProperty("bgimage")),s="";if(""!=i){var r=parseInt(this.getProperty("bgimagex"));isFinite(r)||(r=50);var n=parseInt(this.getProperty("bgimagey"));isFinite(n)||(n=50),t+='URL("'+nextend.imageHelper.fixed(i)+'") '+r+"% "+n+"% / cover no-repeat"+(1==this.getProperty("bgimageparallax")?" fixed":""),s=" "+r+"% "+n+"% / cover no-repeat"+(1==this.getProperty("bgimageparallax")?" fixed":"")}var o=this.getProperty("bgcolor"),a=this.getProperty("bgcolorgradient"),l=this.getProperty("bgcolorgradientend"),h=this.getBackgroundCSS(o,a,l,t,s);this.addLocalStyle("normal","bgcolor",h);var d="",p=!1,c=this.getProperty("bgcolor-hover"),u=this.getProperty("bgcolorgradient-hover"),y=this.getProperty("bgcolorgradientend-hover");c!==e&&c!=o&&(p=!0),u!==e&&u!=a&&(p=!0),y!==e&&y!=l&&(p=!0),p&&(c===e&&(c=o),u===e&&(u=a),y===e&&(y=l),d=this.getBackgroundCSS(c,u,y,t,s)),this.addLocalStyle("hover","bgcolor",d)},i.prototype.getBackgroundCSS=function(t,e,i,s,r){if(0!=N2Color.hex2alpha(t)||"off"!=e&&0!=N2Color.hex2alpha(i)){var n="";switch(""!=s&&(n=r+","+s),e){case"horizontal":return"background:linear-gradient(to right, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"vertical":return"background:linear-gradient(to bottom, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"diagonal1":return"background:linear-gradient(45deg, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"diagonal2":return"background:linear-gradient(135deg, "+N2Color.hex2rgbaCSS(t)+" 0%,"+N2Color.hex2rgbaCSS(i)+" 100%)"+n+";";case"off":default:return""!=s?"background: linear-gradient("+N2Color.hex2rgbaCSS(t)+", "+N2Color.hex2rgbaCSS(t)+")"+n+";":"background:"+N2Color.hex2rgbaCSS(t)+";"}}else if(""!=s)return"background:"+s+";";return""},i.prototype.getData=function(t){var e=N2Classes.ComponentAbstract.prototype.getData.call(this,t);return t.itemsIncluded&&(e.cols=this.container.getData(t)),e},i.prototype.moveCol=function(t,e){if("desktopPortrait"==this.getMode()){this._moveCol(t,e);var i=N2Classes.History.get().addValue(this,this.historyMoveCol,[]);i&&i.setValues({oldIndex:e,newIndex:t},{oldIndex:t,newIndex:e})}else{var s=this.getOrderedColumns(),r=s[t];s.splice(t,1),s.splice(e,0,r);for(var n=0;n<s.length;n++)s[n].setProperty("order",n+1);this.refreshUI()}},i.prototype._moveCol=function(t,e){var i=this.container.getSortedLayers();this.container.insertLayerAt(i[t],e),this.refreshUI()},i.prototype.historyMoveCol=function(t){this._moveCol(t.oldIndex,t.newIndex)},i.prototype.setColsWidth=function(t){for(var e=this.container.getSortedLayers(),i=0;i<t.length;i++)e[i].setProperty("colwidth",t[i].toFraction());this._syncwrapafter(),this.update(),this.refreshUI()},i.prototype.setRealColsWidth=function(t){for(var e=this.getOrderedColumns(),i=0;i<t.length;i++)e[i].setProperty("colwidth",t[i].toFraction());this._syncwrapafter(),this.update(),this.refreshUI()},i.prototype.updateColumnWidth=function(t){var e,i=parseInt(this.getProperty("wrapafter")),s=this.getOrderedColumns();for(e=s.length-1;e>=0;e--)s[e].showsOnCurrent||(s.splice(e,1),t.splice(e,1));var r=s.length;if(i>0&&r>i){var n=[];for(e=0;r>e;e++){var o=Math.floor(e/i);"undefined"==typeof n[o]&&(n[o]=[]),s[e]._tempWidth=t[e],n[o].push(s[e])}var a=this.getGutter();for(e=0;e<n.length;e++){var l,h=n[e],d=0;for(l=0;l<h.length;l++)d+=h[l]._tempWidth;for(l=0;l<h.length;l++)h[l].layer.css("width","calc("+h[l]._tempWidth/d*100+"% - "+(n2const.isIE?a+1:a)+"px)")}}else for(e=0;r>e;e++)s[e].layer.css("width",100*t[e]+"%");this.update()},i.prototype.activateColumn=function(t,e){this.container.getSortedLayers()[t].activate(e)},i.prototype.onChildCountChange=function(){if(!this.isDeleted&&!this.isDeleteStarted){var t=this.container.getSortedLayers(),e=t.length;if(e){for(var i=this.getColumns().split("+"),s=0,r=0;r<i.length;r++)s=new Fraction(i[r]).add(s);if(1!=s.valueOf())for(var r=0;e>r;r++)t[r].setProperty("colwidth","1/"+e);else for(var r=0;e>r;r++)t[r]._synccolwidth();this.refreshUI()}this._syncgutter()}},i.prototype.renderModeProperties=function(t){N2Classes.ComponentAbstract.prototype.renderModeProperties.call(this,t),this._syncpadding(),this._syncinneralign(),this._syncgutter(),this.isActive&&this.columnsField.setRow(this)},i.prototype.hightlightStructure=function(e){e=e||4e3,this.isStructureHighlighted&&(clearTimeout(this.isStructureHighlighted),this.isStructureHighlighted=!1),this.layer.addClass("n2-highlight-structure"),this.isStructureHighlighted=setTimeout(t.proxy(function(){this.isDeleted||this.layer.removeClass("n2-highlight-structure")},this),e)},i.prototype.refreshUI=function(){this.isDeleteStarted||(this.isActive&&this.columnsField.setRow(this),this._syncwrapafter(),this.$row.nUIColumns("option","columns",this.getColumnsOrdered()))},i.prototype.getDroppable=function(){return this.layer.is(":visible")&&this.status!=N2Classes.ComponentAbstract.STATUS.HIDDEN&&this.status!=N2Classes.ComponentAbstract.STATUS.LOCKED?{$container:this.$row,layer:this,placement:"normal",axis:"x"}:"hidden"},i.prototype.getLLDroppable=function(t){switch(t.type){case"col":if(t.group==this)return{$container:this.container.$ul,layer:this}}return!1},i.prototype.getContents=function(){return this.$row},i.prototype.setPropertystylemode=function(t,e,i){this.stylemode=e,this.syncAdvancedField("bgcolor"),this.syncAdvancedField("bgcolorgradient"),this.syncAdvancedField("bgcolorgradientend"),this.syncAdvancedField("borderradius"),this.syncAdvancedField("boxshadow")},i.prototype.onSyncFields=function(){this.fragmentEditor.layerOptions.updateField("stylemode",this.stylemode)},i}),N2D("ComponentSettings",function(t,e){"use strict";function i(e){this.componentType="undefined",this.placementType="undefined",t("html").attr("data-component","").attr("data-placement",""),this.currentForm={},this.forms={undefined:null,placement:{absolute:{},normal:{},"default":{}},component:{content:{},layer:{},row:{},col:{},group:{}},global:{id:t("#layerid"),uniqueclass:t("#layeruniqueclass"),desktopPortrait:t("#layershow-desktop-portrait"),desktopLandscape:t("#layershow-desktop-landscape"),tabletPortrait:t("#layershow-tablet-portrait"),tabletLandscape:t("#layershow-tablet-landscape"),mobilePortrait:t("#layershow-mobile-portrait"),mobileLandscape:t("#layershow-mobile-landscape"),"class":t("#layerclass"),generatorvisible:t("#layergenerator-visible"),crop:t("#layercrop"),rotation:t("#layerrotation"),parallax:t("#layerparallax"),fontsize:t("#layerfont-size"),adaptivefont:t("#layeradaptive-font"),mouseenter:t("#layeronmouseenter"),click:t("#layeronclick"),mouseleave:t("#layeronmouseleave"),play:t("#layeronplay"),pause:t("#layeronpause"),stop:t("#layeronstop")}},e.editor.generator.registerField(this.forms.global["class"]),this.fragmentEditor=e;var i=e.editor.getAvailableDeviceModes();i.desktopLandscape||this.forms.global.desktopLandscape.closest(".n2-mixed-group").css("display","none"),i.tabletPortrait||this.forms.global.tabletPortrait.closest(".n2-mixed-group").css("display","none"),i.tabletLandscape||this.forms.global.tabletLandscape.closest(".n2-mixed-group").css("display","none"),i.mobilePortrait||this.forms.global.mobilePortrait.closest(".n2-mixed-group").css("display","none"),i.mobileLandscape||this.forms.global.mobileLandscape.closest(".n2-mixed-group").css("display","none"),this.forms.placement.absolute={parentid:t("#layerparentid"),parentalign:t("#layerparentalign"),parentvalign:t("#layerparentvalign"),left:t("#layerleft"),top:t("#layertop"),responsiveposition:t("#layerresponsive-position"),width:t("#layerwidth"),height:t("#layerheight"),responsivesize:t("#layerresponsive-size"),align:t("#layeralign"),valign:t("#layervalign")},this.forms.placement.normal={margin:t("#layernormal-margin"),height:t("#layernormal-height"),maxwidth:t("#layernormal-maxwidth"),selfalign:t("#layernormal-selfalign")},this.forms.component.content={maxwidth:t("#layercontent-maxwidth"),selfalign:t("#layercontent-selfalign"),padding:t("#layercontent-padding"),inneralign:t("#layercontent-inneralign"),verticalalign:t("#layercontent-verticalalign"),stylemode:t("#layercontent-style-mode").on("n2resetmode",t.proxy(this.resetStyleMode,this,"stylemode")),bgcolor:t("#layercontent-background-color"),bgimage:t("#layercontent-background-image"),bgimagex:t("#layercontent-background-focus-x"),bgimagey:t("#layercontent-background-focus-y"),bgimageparallax:t("#layercontent-background-parallax"),bgcolorgradient:t("#layercontent-background-gradient"),bgcolorgradientend:t("#layercontent-background-color-end"),opened:t("#layercontent-opened")},e.editor.generator.registerField(this.forms.component.content.bgimage),this.forms.component.row={padding:t("#layerrow-padding"),gutter:t("#layerrow-gutter"),fullwidth:t("#layerrow-fullwidth"),stretch:t("#layerrow-stretch"),wrapafter:t("#layerrow-wrap-after"),inneralign:t("#layerrow-inneralign"),href:t("#layerrow-href"),"href-target":t("#layerrow-href-target"),bgimage:t("#layerrow-background-image"),bgimagex:t("#layerrow-background-focus-x"),bgimagey:t("#layerrow-background-focus-y"),bgimageparallax:t("#layerrow-background-parallax"),stylemode:t("#layerrow-style-mode").on("n2resetmode",t.proxy(this.resetStyleMode,this,"stylemode")),bgcolor:t("#layerrow-background-color"),bgcolorgradient:t("#layerrow-background-gradient"),bgcolorgradientend:t("#layerrow-background-color-end"),borderradius:t("#layerrow-border-radius"),boxshadow:t("#layerrow-boxshadow"),opened:t("#layerrow-opened")},e.editor.generator.registerField(this.forms.component.row.href),e.editor.generator.registerField(this.forms.component.row.bgimage),this.forms.component.col={maxwidth:t("#layercol-maxwidth"),padding:t("#layercol-padding"),inneralign:t("#layercol-inneralign"),verticalalign:t("#layercol-verticalalign"),href:t("#layercol-href"),"href-target":t("#layercol-href-target"),bgimage:t("#layercol-background-image"),bgimagex:t("#layercol-background-focus-x"),bgimagey:t("#layercol-background-focus-y"),bgimageparallax:t("#layercol-background-parallax"),stylemode:t("#layercol-style-mode").on("n2resetmode",t.proxy(this.resetStyleMode,this,"stylemode")),bgcolor:t("#layercol-background-color"),bgcolorgradient:t("#layercol-background-gradient"),bgcolorgradientend:t("#layercol-background-color-end"),borderradius:t("#layercol-border-radius"),boxshadow:t("#layercol-boxshadow"),borderwidth:t("#layercol-border-width"),borderstyle:t("#layercol-border-style"),bordercolor:t("#layercol-border-color"),opened:t("#layercol-opened"),colwidth:t("#layercol-colwidth"),order:t("#layercol-order")},e.editor.generator.registerField(this.forms.component.col.href),e.editor.generator.registerField(this.forms.component.col.bgimage)}return i.prototype.changeActiveComponent=function(e,i,s,r){if(this.currentLayer=e,this.componentType!=i){t("html").attr("data-component",i);var n=t("#n2-tabbed-slide-editor-settings").data("pane");switch(i){case"content":n.showTabs(["content","animations","position"]);break;case"layer":n.showTabs(["item","style","animations","position"]);break;case"group":n.showTabs(["group","animations"]);break;case"row":n.showTabs(["row","animations","position"]);break;case"col":n.showTabs(["column","animations","position"])}this.componentType=i}this.changeActiveComponentPlacement(s),this.syncFields(r)},i.prototype.changeActiveComponentPlacement=function(e,i){this.placementType!=e&&(t("html").attr("data-placement",e),this.placementType=e),this.syncFields(i)},i.prototype.syncFields=function(i){if("object"==typeof i){this.currentForm=t.extend({},this.forms.global,this.forms.component[this.componentType],this.forms.placement[this.placementType]);for(var s in i)typeof i[s]!==e?this.updateField(s,i[s]):console.error("Value is undefined for: "+s);this.currentLayer.onSyncFields();for(var r in this.currentForm)this.currentForm[r].off(".layeroptions").on("outsideChange.layeroptions",t.proxy(this.activeComponentPropertyChanged,this,r))}},i.prototype.onUpdateField=function(t,e,i){t.target==this.currentLayer&&this.updateField(e,i)},i.prototype.updateField=function(t,i){if("function"==typeof this.currentLayer["formSet"+t])this.currentLayer["formSet"+t](this,i);else if(this.currentForm[t]!==e){var s=this.currentForm[t].data("field");s!==e&&s.insideChange(i)}},i.prototype.activeComponentPropertyChanged=function(t,e){if(this.currentLayer&&!this.currentLayer.isDeleted)this.updateLayerProperty(t);else{var i=this.currentForm[t].data("field");"undefined"!=typeof i&&null!==i&&i.insideChange("")}},i.prototype.updateLayerProperty=function(t){var e=this.currentForm[t].val();this.currentLayer.setProperty(t,e,"manager")},i.prototype.startFeatures=function(){this.layerFeatures=new N2Classes.LayerFeatures(this.forms.placement.absolute,this.fragmentEditor);var e=t("#n2-ss-layer-adaptive-font").on("click",t.proxy(function(){this.currentForm.adaptivefont.data("field").onoff.trigger("click")},this));this.forms.global.adaptivefont.on("nextendChange",t.proxy(function(){1==this.currentForm.adaptivefont.val()?e.addClass("n2-active"):e.removeClass("n2-active")},this)),new N2Classes.FormElementNumber("n2-ss-layer-font-size",-Number.MAX_VALUE,Number.MAX_VALUE),new N2Classes.FormElementNumberSlider("n2-ss-layer-font-size",{min:50,max:300,step:5});var i=t("#n2-ss-layer-font-size").on("outsideChange",t.proxy(function(){var t=parseInt(i.val());this.currentForm.fontsize.val(t).trigger("change")},this));this.forms.global.fontsize.on("nextendChange",t.proxy(function(){i.data("field").insideChange(this.forms.global.fontsize.val())},this))},i.prototype.resetStyleMode=function(t,e){this.currentLayer.resetStyleMode(t)},i}),N2D("BgAnimationEditor",["NextendFragmentEditorController"],function(t,e){function i(){this.parameters={shiftedBackgroundAnimation:0},this.$css=t("<style></style>").appendTo("head"),this.backgroundAnimations={color:"eeeeeeff"},N2Classes.NextendFragmentEditorController.prototype.constructor.call(this,!1),this.bgAnimationElement=t(".n2-bg-animation"),this.slides=t(".n2-bg-animation-slide"),this.bgImages=t(".n2-bg-animation-slide-bg"),NextendTween.set(this.bgImages,{rotationZ:1e-4}),this.directionTab=new N2Classes.FormElementRadio("n2-background-animation-preview-tabs",["0","1"]),this.directionTab.element.on("nextendChange.n2-editor",t.proxy(this.directionTabChanged,this)),nModernizr.csstransforms3d&&nModernizr.csstransformspreserve3d||N2Classes.Notification.error("Background animations are not available in your browser. It works if the <i>transform-style: preserve-3d</i> feature available. "),this.$colorField=t("#n2-background-animationcolor").on("nextendChange",t.proxy(this.changeColor,this))}return i.prototype=Object.create(N2Classes.NextendFragmentEditorController.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){N2Classes.NextendFragmentEditorController.prototype.loadDefaults.call(this),this.type="backgroundanimation",this.current=0,this.animationProperties=!1,this.direction=0},i.prototype.get=function(){return null},i.prototype.load=function(t,e,i,s){this.lightbox.addClass("n2-editor-loaded")},i.prototype.setTabs=function(t){},i.prototype.directionTabChanged=function(){this.direction=parseInt(this.directionTab.element.val())},i.prototype.start=function(i){i.color!==e?(this.$colorField.data("field").insideChange(i.color),this.backgroundAnimations.color=i.color):(t("#n2-tab-background-animation-form").remove(),this.$css.html(".n2-3d-side,.tile-colored-overlay{background: "+nextend.currentEditor.frontend.parameters.bgAnimationsColor+";}")),this.animationProperties&&(this.timeline?this.timeline.play():this.next())},i.prototype.changeColor=function(){this.backgroundAnimations.color=this.$colorField.val(),this.$css.html(".n2-3d-side,.tile-colored-overlay{background: "+N2Color.hex2rgbaCSS(this.backgroundAnimations.color)+";}")},i.prototype.pause=function(){this.timeline&&this.timeline.pause()},i.prototype.next=function(){this.timeline=new NextendTimeline({paused:!0,onComplete:t.proxy(this.ended,this)});var e=this.bgImages.eq(this.current),i=this.bgImages.eq(1-this.current);nModernizr.csstransforms3d&&nModernizr.csstransformspreserve3d?(this.currentAnimation=new N2Classes["SmartSliderBackgroundAnimation"+this.animationProperties.type](this,e,i,this.animationProperties,1,this.direction),this.slides.eq(this.current).css("zIndex",2),this.slides.eq(1-this.current).css("zIndex",3),this.timeline.to(this.slides.eq(this.current),.5,{opacity:0},this.currentAnimation.getExtraDelay()),this.timeline.to(this.slides.eq(1-this.current),.5,{opacity:1},this.currentAnimation.getExtraDelay()),this.currentAnimation.postSetup()):(this.timeline.to(this.slides.eq(this.current),1.5,{opacity:0},0),this.timeline.to(this.slides.eq(1-this.current),1.5,{opacity:1},0)),this.current=1-this.current,this.timeline.play()},i.prototype.ended=function(){this.currentAnimation&&this.currentAnimation.ended(),this.next()},i.prototype.setAnimationProperties=function(t){var e=this.animationProperties;this.animationProperties=t,e||this.next()},i}),N2D("BgAnimationManager",["NextendVisualManagerMultipleSelection"],function(t,e){function i(){this.type="backgroundanimation",N2Classes.NextendVisualManagerMultipleSelection.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.NextendVisualManagerMultipleSelection.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){N2Classes.NextendVisualManagerMultipleSelection.prototype.loadDefaults.apply(this,arguments),this.type="backgroundanimation",this.labels={visual:"Background animation",visuals:"Background animations"}},i.prototype.initController=function(){return new N2Classes.BgAnimationEditor},i.prototype.createVisual=function(t,e){return new N2Classes.NextendVisualWithSetRowMultipleSelection(t,e,this)},i.prototype.show=function(e,i){var s={},r=t("#sliderbackground-animation-color");r.length&&(s.color=r.val()),N2Classes.NextendVisualManagerMultipleSelection.prototype.show.call(this,e,i,s)},i.prototype.getAsString=function(){var e=t("#sliderbackground-animation-color");return e.length&&e.val(t("#n2-background-animationcolor").val()),N2Classes.NextendVisualManagerMultipleSelection.prototype.getAsString.call(this)},i}),N2D("nUICanvasItem",["nUIMouse"],function(t,e){"use strict";function i(e,i){this.element=t(e),this.widgetName=this.widgetName||"nUICanvasItem",this.widgetEventPrefix="canvasItem",this.options=t.extend({canvasUIManager:null,layer:!1,$layer:null,distance:2,onCreate:function(){}},this.options,i),N2Classes.nUIMouse.prototype.constructor.apply(this,arguments),this.create()}return i.prototype=Object.create(N2Classes.nUIMouse.prototype),i.prototype.constructor=i,i.prototype.create=function(){"function"==typeof this.options.$layer&&(this.options.$layer=this.options.$layer.call(this,this)),this._mouseInit()},i.prototype._mouseCapture=function(t,e){return this.options.canvasUIManager._mouseCapture(this.options,t,e)},i.prototype._mouseStart=function(t,e,i){return this._trigger("start"),this.options.canvasUIManager._mouseStart(this.options,t,e,i)},i.prototype._mouseDrag=function(t){return this.options.canvasUIManager._mouseDrag(this.options,t)},i.prototype._mouseStop=function(t,e){return this.options.canvasUIManager._mouseStop(this.options,t,e)},i.prototype._destroy=function(){return this._mouseDestroy(),this},N2Classes.nUIWidgetBase.register("nUICanvasItem"),i}),N2D("nUICanvas",["nUIWidgetBase"],function(t,e){"use strict";function i(e,i){this.element=t(e),this.widgetName=this.widgetName||"nUICanvas",this.widgetEventPrefix="canvas",this.options=t.extend({mainContainer:null,display:!1},this.options,i),N2Classes.nUIWidgetBase.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.nUIWidgetBase.prototype),i.prototype.constructor=i,i.plugins={},i.prototype._mouseCapture=function(e,i,s){return 0==t(i.target).closest(".nui-resizable-handle, .nui-normal-sizing-handle, .nui-spacing-handle").length},i.prototype._mouseStart=function(e,i,s,r){t("body").addClass("n2-ss-move-layer"),this.dragDeferred=t.Deferred(),this.options.mainContainer.fragmentEditor.layerWindow.hideWithDeferred(this.dragDeferred),this.context={placeholder:t('<div class="n2-ss-layer-placeholder" />'),mouse:{offset:{left:i.pageX,top:i.pageY}},canvas:{offset:this.options.mainContainer.layer.offset(),size:{width:this.options.mainContainer.layer.outerWidth(),height:this.options.mainContainer.layer.outerHeight()}},$layer:e.$layer};var n={position:"absolute",right:"auto",bottom:"auto"};e.layer?(this.startMode=e.layer.placement.getType(),this.context.layer={offset:e.$layer.offset()},this.context.originalIndex=e.layer.getIndex(),"normal"==this.startMode&&(n.width=e.$layer.width(),e.$layer.appendTo(this.options.mainContainer.layer))):(this.startMode="create",this.context.layer={offset:{left:0,top:0}},e.$layer.appendTo("body")),e.$layer.addClass("n2-canvas-item-drag").css(n),this._cacheMargins(e.$layer),this.context.size={width:e.$layer.outerWidth(),height:e.$layer.outerHeight()},this.context.droppables=this.options.mainContainer.getDroppables(e.layer),this._cacheContainers(),this._trigger("start",i,{layer:e.layer,mode:this.startMode}),this._mouseDrag(e,i)},i.prototype._mouseDrag=function(t,e){var i;i="create"==this.startMode?{top:e.pageY-this.context.canvas.offset.top-20,left:e.pageX-this.context.canvas.offset.left-20}:{top:this.context.layer.offset.top-this.context.canvas.offset.top+e.pageY-this.context.mouse.offset.top,left:this.context.layer.offset.left-this.context.canvas.offset.left+e.pageX-this.context.mouse.offset.left};var s=this._findInnerContainer(e);if(s===!1&&"create"!=this.startMode&&(s=this.context.droppables[0]),s)if("normal"==s.placement){"undefined"==typeof s.layers&&(s.layers=this._cacheContainerLayers(s));var r=this._findNormalIndex(e,s);r>0?(this.context.placeholder.css("order",s.layers[r-1].layer.layer.css("order")),this.context.placeholder.insertAfter(s.layers[r-1].layer.layer)):(this.context.placeholder.css("order",0),this.context.placeholder.prependTo(s.$container)),this.context.targetIndex=r}else this.context.placeholder.detach();else this.context.placeholder.detach();this.context.targetContainer=s,this._trigger("drag",e,{layer:t.layer,originalOffset:this.context.layer.offset,
10
- position:i,canvasOffset:this.context.canvas.offset,offset:{left:i.left+this.context.canvas.offset.left,top:i.top+this.context.canvas.offset.top}}),"create"==this.startMode&&(i.left+=this.context.canvas.offset.left,i.top+=this.context.canvas.offset.top),t.$layer.css(i),this._displayPosition(e,i)},i.prototype._mouseStop=function(i,s,r){this.context.placeholder.remove();var n=this.context.targetIndex,o=this.context.targetContainer;if(i.$layer.removeClass("n2-canvas-item-drag"),"create"==this.startMode)o&&i.onCreate.call(this,s,i,o,n),i.$layer.detach();else if(o===e&&(o=this.options.mainContainer.layer),"absolute"==this.startMode&&"absolute"==o.placement){var a=parseInt(i.$layer.css("left")),l=parseInt(i.$layer.css("top"));i.$layer.css({position:"",right:"",bottom:""}),i.layer.placement.current.setPosition(a,l)}else if("absolute"==o.placement){var a=parseInt(i.$layer.css("left")),l=parseInt(i.$layer.css("top"));i.$layer.css({position:"",right:"",bottom:""});var h=i.$layer.width(),d=i.$layer.height();i.layer.group.onChildCountChange();for(var p=i.layer;p&&(!p.placement||"absolute"!==p.placement.getType());)p=p.group;N2Classes.History.get().startBatch(),i.layer.changeGroup(this.context.originalIndex,this.options.mainContainer),N2Classes.History.get().addControl("skipForwardUndos"),"layer"==i.layer.type&&i.layer.item&&(i.layer.item.needSize||(d="auto",h++));var c=p?p.getProperty("align"):"center",u=p?p.getProperty("valign"):"middle";i.layer.placement.current._setPosition(c,u,a,l,h,d,!0),N2Classes.History.get().endBatch()}else if("normal"==o.placement)switch(i.$layer.css({position:"relative",width:"",left:"",top:""}),o.layer.type){case"content":case"col":n>0?i.$layer.insertAfter(o.layers[n-1].layer.layer):i.$layer.prependTo(o.$container),i.layer.onCanvasUpdate(this.context.originalIndex,o.layer,n);break;case"row":var y=o.layer.createCol();o.layer.moveCol(y.getIndex(),n),i.$layer.prependTo(y.$content),i.layer.onCanvasUpdate(this.context.originalIndex,y,0)}delete this.context,this.options.display&&this.options.display.hide(),this._trigger("stop",s,{layer:i.layer}),this.dragDeferred.resolve(),t("body").removeClass("n2-ss-move-layer")},i.prototype.cancel=function(t){},i.prototype._cacheContainers=function(){for(var t=0;t<this.context.droppables.length;t++){var e=this.context.droppables[t];e.offset=e.$container.offset(),e.size={width:e.$container.outerWidth(),height:e.$container.outerHeight()},e.offset.right=e.offset.left+e.size.width,e.offset.bottom=e.offset.top+e.size.height}},i.prototype._findInnerContainer=function(t){for(var e=this.context.droppables.length-1;e>=0;e--){var i=this.context.droppables[e];if(i.offset.left<=t.pageX&&i.offset.right>=t.pageX&&i.offset.top<=t.pageY&&i.offset.bottom>=t.pageY)return i}return!1},i.prototype._cacheContainerLayers=function(t){for(var e=[],i=t.layer.container.getSortedLayers(),s=0;s<i.length;s++){var r={layer:i[s]};r.offset=r.layer.layer.offset(),r.size={width:r.layer.layer.outerWidth(),height:r.layer.layer.outerHeight()},r.offset.right=r.offset.left+r.size.width/2,r.offset.bottom=r.offset.top+r.size.height/2,e.push(r)}return e},i.prototype._findNormalIndex=function(t,e){var i=-1;switch(e.axis){case"y":for(var s=0;s<e.layers.length;s++){var r=e.layers[s];if(t.pageY<=r.offset.bottom){i=s;break}}break;case"x":for(var s=0;s<e.layers.length;s++){var r=e.layers[s];if(t.pageX<=r.offset.right){i=s;break}}}return-1===i&&(i=e.layers.length),i},i.prototype._displayPosition=function(t,e){this.options.display&&(this.context.targetContainer&&"absolute"==this.context.targetContainer.placement?(this.options.display.hidden&&this.options.display.show(),"create"==this.startMode&&(e.left-=this.context.canvas.offset.left,e.top-=this.context.canvas.offset.top),this.options.display.update(t,e)):this.options.display.hidden&&this.options.display.hide())},i.prototype._trigger=function(t,e,i){return i=i||{},this.callPlugin(t,[e,i]),N2Classes.nUIWidgetBase.prototype._trigger.apply(this,arguments)},i.prototype._cacheMargins=function(t){this.margins={left:parseInt(t.css("marginLeft"),10)||0,top:parseInt(t.css("marginTop"),10)||0,right:parseInt(t.css("marginRight"),10)||0,bottom:parseInt(t.css("marginBottom"),10)||0}},N2Classes.nUIWidgetBase.register("nUICanvas"),N2Classes.nUIWidgetBase.addPlugin(i,"smartguides",{start:function(e,i){var s=t(this).data("nUICanvas"),r=s.options;if("create"!=s.startMode&&(s.gridH=t('<div class="n2-grid n2-grid-h"></div>').appendTo(r.mainContainer.layer),s.gridV=t('<div class="n2-grid n2-grid-v"></div>').appendTo(r.mainContainer.layer),s.elements=[],"function"==typeof r.smartguides)){var n=t(r.smartguides(s.context)).not(s.context.$layer);n&&n.length&&n.each(function(){var e=t(this),i=e.offset();this!=s.element[0]&&s.elements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:Math.round(i.top),left:Math.round(i.left),backgroundColor:""})});var o=r.mainContainer.layer.offset();s.elements.push({width:r.mainContainer.layer.width(),height:r.mainContainer.layer.height(),top:Math.round(o.top),left:Math.round(o.left),backgroundColor:"#ff4aff"})}},stop:function(e,i){var s=t(this).data("nUICanvas");"create"!=s.startMode&&(s.gridH.remove(),s.gridV.remove())},drag:function(e,i){var s=!1,r=!1,n=t(this).data("nUICanvas"),o=n.options,a=o.tolerance,l=o.tolerance;if("create"!=n.startMode&&(n.gridH.css({display:"none"}),n.gridV.css({display:"none"}),n.context.targetContainer&&"absolute"==n.context.targetContainer.placement)){var h=n.elements[n.elements.length-1],d=function(t){n.gridV.css({left:Math.min(t,h.width-1),display:"block"})},p=function(t){n.gridH.css({top:Math.min(t,h.height-1),display:"block"})},c=e.ctrlKey||e.metaKey,u=e.altKey;if(c&&u)return;c?s=!0:u&&(r=!0);var y=i.offset.left,g=y+n.context.size.width,f=i.offset.top,m=f+n.context.size.height,v=(y+g)/2,b=(f+m)/2;if(!s)for(var C=n.elements.length-1;C>=0&&0!=a;C--){var x,w=n.elements[C].left,S=w+n.elements[C].width,P=(w+S)/2,k=!0;(x=Math.abs(w-g))<a?(i.position.left=w-n.context.size.width-n.context.canvas.offset.left-n.margins.left,d(i.position.left+n.context.size.width)):(x=Math.abs(w-y))<a?(i.position.left=w-n.context.canvas.offset.left-n.margins.left,d(i.position.left)):(x=Math.abs(S-y))<a?(i.position.left=S-n.context.canvas.offset.left-n.margins.left,d(i.position.left)):(x=Math.abs(S-g))<a?(i.position.left=S-n.context.size.width-n.context.canvas.offset.left-n.margins.left,d(i.position.left+n.context.size.width)):(x=Math.abs(P-g))<a?(i.position.left=P-n.context.size.width-n.context.canvas.offset.left-n.margins.left,d(i.position.left+n.context.size.width)):(x=Math.abs(P-y))<a?(i.position.left=P-n.context.canvas.offset.left-n.margins.left,d(i.position.left)):(x=Math.abs(P-v))<a?(i.position.left=P-n.context.size.width/2-n.context.canvas.offset.left-n.margins.left,d(i.position.left+n.context.size.width/2)):k=!1,k&&(s=n.elements[C],a=Math.min(x,a))}if(!r)for(var C=n.elements.length-1;C>=0&&0!=l;C--){var x,N=n.elements[C].top,L=N+n.elements[C].height,_=(N+L)/2,D=!0;(x=Math.abs(N-m))<l?(i.position.top=N-n.context.size.height-n.context.canvas.offset.top-n.margins.top,p(i.position.top+n.context.size.height)):(x=Math.abs(N-f))<l?(i.position.top=N-n.context.canvas.offset.top-n.margins.top,p(i.position.top)):(x=Math.abs(L-f))<l?(i.position.top=L-n.context.canvas.offset.top-n.margins.top,p(i.position.top)):(x=Math.abs(L-m))<l?(i.position.top=L-n.context.size.height-n.context.canvas.offset.top-n.margins.top,p(i.position.top+n.context.size.height)):(x=Math.abs(_-m))<l?(i.position.top=_-n.context.size.height-n.context.canvas.offset.top-n.margins.top,p(i.position.top+n.context.size.height)):(x=Math.abs(_-f))<l?(i.position.top=_-n.context.canvas.offset.top-n.margins.top,p(i.position.top)):(x=Math.abs(_-b))<l?(i.position.top=_-n.context.size.height/2-n.context.canvas.offset.top-n.margins.top,p(i.position.top+n.context.size.height/2)):D=!1,D&&(r=n.elements[C],l=Math.min(x,l))}s&&s!==!0&&n.gridV.css("backgroundColor",s.backgroundColor),r&&r!==!0&&n.gridH.css("backgroundColor",r.backgroundColor)}}}),i}),N2D("nUIColumns",["nUIMouse"],function(t,e){"use strict";function i(e,i){this.active=0,this.created=!1,this.invalidated=!1,this.element=t(e),this.widgetName=this.widgetName||"nUIColumns",this.widgetEventPrefix="columns",this.options=t.extend({columns:"1",gutter:0,denominators:{1:100,2:100,3:144,4:100,5:100,6:144},drag:null,start:null,stop:null},this.options,i),N2Classes.nUIMouse.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.nUIMouse.prototype),i.prototype.constructor=i,i.prototype.create=function(){this.created||(this.created=!0,this._setupHandles(),t(window).on("resize",t.proxy(this._resize,this)),this._mouseInit())},i.prototype._destroy=function(){return this._mouseDestroy(),this.element.removeData("uiNextendColumns").off(".columns").find("> .ui-column-width-handle").remove(),this},i.prototype.getDenominator=function(t){return this.options.denominators[t]===e&&(this.options.denominators[t]=15*t),this.options.denominators[t]},i.prototype._setupHandles=function(){var e,i,s=this.options;this.fractions=[];for(var r=s.columns.split("+"),e=0;e<r.length;e++)this.fractions.push(new Fraction(r[e]));this.currentDenominator=this.getDenominator(this.fractions.length);var n=0;for(e=0;e<this.fractions.length-1;e++)i=t("<div class='ui-column-width-handle'>"),n+=100*this.fractions[e].valueOf(),i.data("i",e).data("percent",n).appendTo(this.element).on("mousedown",t.proxy(this._mouseDown,this));this.handles=this.element.find("> .ui-column-width-handle"),this.handles.addClass("n2-unselectable"),this._resize()},i.prototype._resize=function(){if(this.active){this.paddingLeft=parseInt(this.element.css("paddingLeft")),this.paddingRight=parseInt(this.element.css("paddingRight"));var t=this.element.width();this.outerWidth=t+this.paddingLeft+this.paddingRight,this.innerWidth=t-this.handles.length*this.options.gutter;for(var e=0;e<this.handles.length;e++){var i=this.handles.eq(e).data("percent");this._updateResizer(e,i)}}else this.invalidated=!0},i.prototype._updateResizer=function(t,e){this.handles.eq(t).css({left:e+"%",marginLeft:-2+this.paddingLeft+(t+.5)*this.options.gutter+(this.innerWidth-this.outerWidth)*e/100})},i.prototype._removeHandles=function(){this.handles.remove()},i.prototype.setOption=function(t,e){switch(N2Classes.nUIWidgetBase.prototype.setOption.apply(this,arguments),t){case"active":this.active=e,this.active&&(this.create(),this.invalidated&&this._resize());break;case"columns":this.created&&(this._removeHandles(),this._setupHandles());break;case"gutter":this._resize()}},i.prototype._mouseCapture=function(t){var e,i,s=!1;for(e=0;e<this.handles.length;e++)i=this.handles[e],i===t.target&&(s=!0);return!this.options.disabled&&s},i.prototype._mouseStart=function(e){var i=t(e.target).data("i"),s=this.element.offset().left+10,r=this.element.width()-20;this.resizeContext={index:i,cLeft:s,containerWidth:r,startX:Math.max(0,Math.min(e.clientX-s,r))},this.currentFractions=[],this.currentPercent=[];for(var n=0;n<this.fractions.length;n++)this.currentFractions.push(this.fractions[n].clone()),this.currentPercent.push(this.fractions[n].valueOf());return this.resizing=!0,t("body").css("cursor","ew-resize"),this.element.addClass("ui-column-width-resizing"),this._trigger("start",e,this.ui()),!0},i.prototype._mouseDrag=function(t){var e=Math.max(0,Math.min(t.clientX-this.resizeContext.cLeft,this.resizeContext.containerWidth)),i=new Fraction(Math.round((e-this.resizeContext.startX)/(this.resizeContext.containerWidth/this.currentDenominator)),this.currentDenominator);i.compare(this.fractions[this.resizeContext.index].clone().mul(-1))<0&&(i=this.fractions[this.resizeContext.index].clone().mul(-1)),i.compare(this.fractions[this.resizeContext.index+1])>0&&(i=this.fractions[this.resizeContext.index+1].clone()),this.currentFractions[this.resizeContext.index]=this.fractions[this.resizeContext.index].add(i),this.currentFractions[this.resizeContext.index+1]=this.fractions[this.resizeContext.index+1].sub(i);var s=0;this.currentPercent=[];for(var r=0;r<this.currentFractions.length;r++){var n=this.currentFractions[r].valueOf();this.currentPercent.push(n),s+=100*n,this._updateResizer(r,s)}this._trigger("colwidth",t,this.ui())},i.prototype._mouseStop=function(e){return this.resizing=!1,t("body").css("cursor","auto"),this._trigger("stop",e,this.ui()),this.fractions=this.currentFractions,nextend.preventMouseUp(),!1},i.prototype.ui=function(){return{element:this.element,originalFractions:this.fractions,currentFractions:this.currentFractions,currentPercent:this.currentPercent,index:this.resizeContext.index}},N2Classes.nUIWidgetBase.register("nUIColumns"),i}),N2D("nUILayerListItem",["nUIMouse"],function(t,e){"use strict";function i(e,i){this.element=t(e),this.widgetName=this.widgetName||"nUILayerListItem",this.widgetEventPrefix="layerListItem",this.options=t.extend({UIManager:null,layer:!1,$layer:null,distance:2},this.options,i),N2Classes.nUIMouse.prototype.constructor.apply(this,arguments),this.create()}return i.prototype=Object.create(N2Classes.nUIMouse.prototype),i.prototype.constructor=i,i.prototype.create=function(){this._mouseInit()},i.prototype._mouseCapture=function(t,e){return this.options.UIManager._mouseCapture(this.options,t,e)},i.prototype._mouseStart=function(t,e,i){return this._trigger("start"),this.options.UIManager._mouseStart(this.options,t,e,i)},i.prototype._mouseDrag=function(t){return this.options.UIManager._mouseDrag(this.options,t)},i.prototype._mouseStop=function(t,e){return this.options.UIManager._mouseStop(this.options,t,e)},i.prototype._destroy=function(){return this._mouseDestroy(),this},N2Classes.nUIWidgetBase.register("nUILayerListItem"),i}),N2D("nUILayerList",["nUIWidgetBase"],function(t,e){"use strict";function i(e,i){this.element=t(e),this.widgetName=this.widgetName||"nUILayerList",this.widgetEventPrefix="layerList",this.options=t.extend({$fixed:null,$scrolled:null},this.options,i),N2Classes.nUIWidgetBase.prototype.constructor.apply(this,arguments),this.create()}return i.prototype=Object.create(N2Classes.nUIWidgetBase.prototype),i.prototype.constructor=i,i.prototype.create=function(){this.scrollTimeout=null},i.prototype._mouseCapture=function(t,e,i){return!0},i.prototype._mouseStart=function(e,i,s,r){this.scrolledTop=this.options.$scrolled.offset().top,this.scrolledHeight=this.options.$scrolled.height(),this.scrolledScroll=this.options.$scrolled.scrollTop(),this.scrolledMaxHeight=this.options.$scrolled[0].scrollHeight-this.scrolledHeight,t("body").addClass("n2-ss-layer-list-move-layer"),this.context={placeholder:t('<div class="nextend-sortable-placeholder"><div></div></div>'),mouse:{y:i.pageY,topModifier:e.$item.offset().top-i.pageY},$item:e.$item,$clone:e.$item.clone()},this.context.$clone.addClass("n2-ss-ll-dragging").appendTo(this.options.$scrolled.find("> ul")),this.context.droppables=this.options.mainContainer.getLLDroppables(e.layer),this._cacheContainers(),this._trigger("start",i),this._mouseDrag(e,i)},i.prototype._scrollUp=function(){this.scrolledTop>0&&null===this.scrollTimeout&&(this.scrollTimeout=setInterval(t.proxy(function(){this.scrolledScroll-=30,this.options.$scrolled.scrollTop(this.scrolledScroll)},this),100),this.scrolledScroll-=30,this.options.$scrolled.scrollTop(this.scrolledScroll))},i.prototype._scrollDown=function(){null===this.scrollTimeout&&(this.scrollTimeout=setInterval(t.proxy(function(){this.scrolledScroll+=30,this.options.$scrolled.scrollTop(Math.min(this.scrolledScroll,this.scrolledMaxHeight))},this),100),this.scrolledScroll+=30,this.options.$scrolled.scrollTop(Math.min(this.scrolledScroll,this.scrolledMaxHeight)))},i.prototype._mouseDrag=function(t,e){this.scrolledTop=this.options.$scrolled.offset().top,this.scrolledHeight>60&&(e.pageY<this.scrolledTop+30?this._scrollUp():e.pageY>this.scrolledTop+this.scrolledHeight-30?this._scrollDown():(clearInterval(this.scrollTimeout),this.scrollTimeout=null)),this.scrolledScroll=this.options.$scrolled.scrollTop();var i=e.pageY-this.scrolledTop+this.scrolledScroll,s=this._findInnerContainer(i);s===!1&&(s=this.context.droppables[0]),"undefined"==typeof s.layers&&(s.layers=this._cacheContainerLayers(s));var r=this._findNormalIndex(i,s);r>0?this.context.placeholder.insertAfter(s.layers[r-1].layer.layerRow):this.context.placeholder.prependTo(s.$container),this.context.targetIndex=r,this.context.targetContainer&&this.context.targetContainer!=s&&this.context.targetContainer.layer.layerRow.removeClass("n2-ss-ll-dragging-parent"),this.context.targetContainer=s,this.context.targetContainer.layer.layerRow.addClass("n2-ss-ll-dragging-parent"),this.context.$clone.css({top:i+this.context.mouse.topModifier})},i.prototype._mouseStop=function(e,i,s){null!==this.scrollTimeout&&(clearInterval(this.scrollTimeout),this.scrollTimeout=null),this.context.placeholder.remove(),this.context.$clone.remove(),this.context.targetContainer.layer.layerRow.removeClass("n2-ss-ll-dragging-parent");var r=this.context.targetIndex,n=this.context.targetContainer,o=e.layer.getIndex(),a=-1;if(0===this.context.targetContainer.layers.length)a=0;else{var l=!1,h=!1;this.context.targetContainer.layers[r]&&(l=this.context.targetContainer.layers[r].layer),this.context.targetContainer.layers[r-1]&&(h=this.context.targetContainer.layers[r-1].layer),l===e.layer||h===e.layer?a=-1:"absolute"===n.layer.container.allowedPlacementMode?l?a=l.getIndex()+1:h&&(a=h.getIndex()):h?a=h.getIndex()+1:l&&(a=l.getIndex())}a>=0&&(a>o&&a--,"col"===e.layer.type?n.layer.moveCol(o,a):(n.layer.container.insertLayerAt(e.layer,a),e.layer.onCanvasUpdate(o,n.layer,a))),delete this.context,this._trigger("stop",i),t("body").removeClass("n2-ss-layer-list-move-layer")},i.prototype.cancel=function(t){},i.prototype._cacheContainers=function(){for(var t=0;t<this.context.droppables.length;t++){var e=this.context.droppables[t];e.top=e.$container.offset().top-this.scrolledTop+this.scrolledScroll-15,e.height=e.$container.outerHeight(),e.bottom=e.top+e.height+15}},i.prototype._findInnerContainer=function(t){for(var e=this.context.droppables.length-1;e>=0;e--){var i=this.context.droppables[e];if(i.top<=t&&i.bottom>=t)return i}return!1},i.prototype._cacheContainerLayers=function(t){for(var e=[],i=t.layer.container.getSortedLayers(),s=0;s<i.length;s++){var r={layer:i[s]};r.top=r.layer.layerRow.offset().top-this.scrolledTop+this.scrolledScroll,r.height=r.layer.layerRow.outerHeight(),r.bottom=r.top+r.height/2,r.index=s,e.push(r)}return"absolute"==t.layer.container.allowedPlacementMode&&e.reverse(),e},i.prototype._findNormalIndex=function(t,e){for(var i=0;i<e.layers.length;i++){var s=e.layers[i];if(t<=s.bottom)return i}return e.layers.length},N2Classes.nUIWidgetBase.register("nUILayerList"),i}),N2D("ItemButton",["Item"],function(t,e){"use strict";function i(){this.type="button",N2Classes.Item.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.Item.prototype),i.prototype.constructor=i,i.needSize=!1,i.prototype.added=function(){this.needFill=["content","class"],this.addedFont("link","font"),this.addedStyle("button","style"),this.generator.registerFields(["#item_buttoncontent","#item_buttonhref","#item_buttonclass"])},i.prototype.getName=function(t){return t.content},i.prototype.parseAll=function(t){t.classes="",parseInt(t.fullwidth)&&(t.classes+=" n2-ss-fullwidth"),parseInt(t.nowrap)&&(t.classes+=" n2-ss-nowrap"),N2Classes.Item.prototype.parseAll.apply(this,arguments)},i.prototype._render=function(e){var i=t('<div class="n2-ss-button-container n2-ow '+e.fontclass+" "+e.classes+'" />'),s=t('<a href="#" onclick="return false;" class="'+e.styleclass+" "+e["class"]+' n2-ow"></a>').appendTo(i);t("<span><span>"+e.content+"</span></span>").appendTo(s);this.$item.append(i)},i}),N2D("ItemHeading",["Item"],function(t,e){"use strict";function i(){this.type="heading",N2Classes.Item.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.Item.prototype),i.prototype.constructor=i,i.needSize=!1,i.prototype.getDefault=function(){return{href:"",font:"",style:""}},i.prototype.added=function(){this.needFill=["heading","class"],this.addedFont("hover","font"),this.addedStyle("heading","style"),this.generator.registerFields(["#item_headingheading","#item_headinghref","#item_headingclass"])},i.prototype.getName=function(t){return t.heading},i.prototype.parseAll=function(e){e.uid=t.fn.uid(),parseInt(e.fullwidth)?e.display="block":e.display="inline-block",e.extrastyle=parseInt(e.nowrap)?"white-space: nowrap;":"",e.heading=t("<div>"+e.heading+"</div>").text().replace(/\n/g,"<br />"),e.priority=2,e["class"]="",N2Classes.Item.prototype.parseAll.apply(this,arguments),"#"==e.href||""==e.href?(e.afontclass="",e.astyleclass=""):(e.afontclass=e.fontclass,e.fontclass="",e.astyleclass=e.styleclass,e.styleclass="")},i.prototype._render=function(e){var i=t('<div class="n2-ow" />'),s=t('<div id="'+e.uid+'" style="'+e.extrastyle+'"></div>').addClass("n2-ow "+e.fontclass+" "+e.styleclass+" "+e["class"]).css({display:e.display}).appendTo(i);"#"==e.href||""==e.href?s.html(e.heading):s.append(t('<a style="display:'+e.display+';" href="#" class="'+e.afontclass+" "+e.astyleclass+' n2-ow" onclick="return false;">'+e.heading+"</a>")),this.$item.append(i)},i}),N2D("ItemImage",["Item"],function(t,e){"use strict";function i(){this.type="image",N2Classes.Item.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.Item.prototype),i.prototype.constructor=i,i.needSize=!1,i.prototype.getDefault=function(){return{size:"auto|*|auto",href:"",style:""}},i.prototype.added=function(){this.needFill=["image","cssclass"],this.generator.registerFields(["#item_imageimage","#item_imagealt","#item_imagetitle","#item_imagehref","#item_imagecssclass"])},i.prototype.getName=function(t){return t.image.split("/").pop()},i.prototype.parseAll=function(t){var e=t.size.split("|*|");t.width=e[0],t.height=e[1],delete t.size,N2Classes.Item.prototype.parseAll.apply(this,arguments),t.image!=this.values.image?(t.image=nextend.imageHelper.fixed(t.image),"absolute"==this.layer.placement.getType()&&this.resizeLayerToImage(t.image)):t.image=nextend.imageHelper.fixed(t.image)},i.prototype.fitLayer=function(){return"absolute"==this.layer.placement.getType()&&this.resizeLayerToImage(nextend.imageHelper.fixed(this.values.image)),!0},i.prototype._render=function(e){e.styleclass="";var i=t('<div class="'+e.styleclass+' n2-ss-img-wrapper n2-ow" style="overflow:hidden"></div>'),s=i;"#"!=e.href&&""!=e.href&&(s=t('<a href="#" class="n2-ow" onclick="return false;" style="display: block;background: none !important;"></a>').appendTo(i)),t('<img class="n2-ow '+e.cssclass+'" src="'+e.image+'"/>').css({display:"inline-block",maxWidth:"100%",width:e.width,height:e.height}).appendTo(s),this.$item.append(i)},i}),N2D("ItemText",["Item"],function(t,e){"use strict";function i(){this.type="text",N2Classes.Item.prototype.constructor.apply(this,arguments)}function s(t){var e=!1,i=!1,s="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary";return t=t.replace(/\r\n|\r/g,"\n")+"\n",-1===t.indexOf("\n")?t:(-1!==t.indexOf("<object")&&(t=t.replace(/<object[\s\S]+?<\/object>/g,function(t){return t.replace(/\n+/g,"")})),t=t.replace(/<[^<>]+>/g,function(t){return t.replace(/[\n\t ]+/g," ")}),-1===t.indexOf("<pre")&&-1===t.indexOf("<script")||(e=!0,t=t.replace(/<(pre|script)[^>]*>[\s\S]*?<\/\1>/g,function(t){return t.replace(/\n/g,"<wp-line-break>")})),-1!==t.indexOf("<figcaption")&&(t=t.replace(/\s*(<figcaption[^>]*>)/g,"$1"),t=t.replace(/<\/figcaption>\s*/g,"</figcaption>")),-1!==t.indexOf("[caption")&&(i=!0,t=t.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(t){return t=t.replace(/<br([^>]*)>/g,"<wp-temp-br$1>"),t=t.replace(/<[^<>]+>/g,function(t){return t.replace(/[\n\t ]+/," ")}),t.replace(/\s*\n\s*/g,"<wp-temp-br />")})),t+="\n\n",t=t.replace(/<br \/>\s*<br \/>/gi,"\n\n"),t=t.replace(new RegExp("(<(?:"+s+")(?: [^>]*)?>)","gi"),"\n\n$1"),t=t.replace(new RegExp("(</(?:"+s+")>)","gi"),"$1\n\n"),t=t.replace(/<hr( [^>]*)?>/gi,"<hr$1>\n\n"),t=t.replace(/\s*<option/gi,"<option"),t=t.replace(/<\/option>\s*/gi,"</option>"),t=t.replace(/\n\s*\n+/g,"\n\n"),t=t.replace(/([\s\S]+?)\n\n/g,"<p>$1</p>\n"),t=t.replace(/<p>\s*?<\/p>/gi,""),t=t.replace(new RegExp("<p>\\s*(</?(?:"+s+")(?: [^>]*)?>)\\s*</p>","gi"),"$1"),t=t.replace(/<p>(<li.+?)<\/p>/gi,"$1"),t=t.replace(/<p>\s*<blockquote([^>]*)>/gi,"<blockquote$1><p>"),t=t.replace(/<\/blockquote>\s*<\/p>/gi,"</p></blockquote>"),t=t.replace(new RegExp("<p>\\s*(</?(?:"+s+")(?: [^>]*)?>)","gi"),"$1"),t=t.replace(new RegExp("(</?(?:"+s+")(?: [^>]*)?>)\\s*</p>","gi"),"$1"),t=t.replace(/(<br[^>]*>)\s*\n/gi,"$1"),t=t.replace(/\s*\n/g,"<br />\n"),t=t.replace(new RegExp("(</?(?:"+s+")[^>]*>)\\s*<br />","gi"),"$1"),t=t.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1"),t=t.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi,"[caption$1[/caption]"),t=t.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(t,e,i){return i.match(/<p( [^>]*)?>/)?t:e+"<p>"+i+"</p>"}),e&&(t=t.replace(/<wp-line-break>/g,"\n")),i&&(t=t.replace(/<wp-temp-br([^>]*)>/g,"<br$1>")),t)}return i.prototype=Object.create(N2Classes.Item.prototype),i.prototype.constructor=i,i.needSize=!1,i.prototype.getDefault=function(){return{contentmobile:"",contenttablet:"",font:"",style:""}},i.prototype.added=function(){this.needFill=["content","contenttablet","contentmobile"],this.addedFont("paragraph","font"),this.addedStyle("heading","style"),this.generator.registerFields(["#item_textcontent","#item_textcontenttablet","#item_textcontentmobile"])},i.prototype.getName=function(t){return t.content},i.prototype.parseAll=function(t){N2Classes.Item.prototype.parseAll.apply(this,arguments),t.p=s(t.content),t.ptablet=s(t.contenttablet),t.pmobile=s(t.contentmobile)},i.prototype._render=function(e){var i=t('<div class="n2-ss-desktop n2-ow n2-ow-all">'+e.p+"</div>").appendTo(this.$item);""==e.contenttablet?i.addClass("n2-ss-tablet"):i=t('<div class="n2-ss-tablet n2-ow n2-ow-all">'+e.ptablet+"</div>").appendTo(this.$item),""==e.contentmobile?i.addClass("n2-ss-mobile"):t('<div class="n2-ss-mobile n2-ow n2-ow-all">'+e.pmobile+"</div>").appendTo(this.$item),this.$item.find("p").addClass(e.fontclass+" "+e.styleclass)},i}),N2D("ItemVimeo",["Item"],function(t,e){"use strict";function i(){this.type="vimeo",N2Classes.Item.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.Item.prototype),i.prototype.constructor=i,i.needSize=!0,i.prototype.added=function(){this.needFill=["vimeourl"],this.generator.registerField("#item_vimeovimeourl")},i.prototype.getName=function(t){return t.vimeourl},i.prototype.parseAll=function(e){var i=this.values.vimeourl!=e.vimeourl;if(N2Classes.Item.prototype.parseAll.apply(this,arguments),""==e.image&&(e.image="$system$/images/placeholder/video.png"),e.image=nextend.imageHelper.fixed(e.image),i&&""!=e.vimeourl){var s=/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/,r=e.vimeourl.match(s),n=!1;r?n=r[3]:e.vimeourl.match(/^[0-9]+$/)&&(n=e.vimeourl),n?N2Classes.AjaxHelper.getJSON("https://vimeo.com/api/v2/video/"+encodeURI(n)+".json").done(t.proxy(function(e){t("#item_vimeoimage").val(e[0].thumbnail_large).trigger("change")},this)).fail(function(t){N2Classes.Notification.error("Video not found or private.")}):N2Classes.Notification.error("The provided URL does not match any known Vimeo url or code.")}},i.prototype._render=function(e){var i=t('<div class="n2-ow"></div>').css({width:"100%",height:"100%",minHeight:"50px",background:"url("+e.image+") no-repeat 50% 50%",backgroundSize:"cover"});t('<div class="n2-ss-layer-player n2-ss-layer-player-cover"><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0OCA0OCI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIyNCIgY3k9IjI0IiByPSIyNCIgZmlsbD0iIzAwMCIgb3BhY2l0eT0iLjYiLz48cGF0aCBmaWxsPSIjRkZGIiBkPSJNMTkuOCAzMmMtLjEyNCAwLS4yNDctLjAyOC0uMzYtLjA4LS4yNjQtLjExNi0uNDM2LS4zNzUtLjQ0LS42NjRWMTYuNzQ0Yy4wMDUtLjI5LjE3Ni0uNTUuNDQtLjY2Ni4yNzMtLjEyNi41OTItLjEuODQuMDdsMTAuNCA3LjI1N2MuMi4xMzIuMzIuMzU1LjMyLjU5NXMtLjEyLjQ2My0uMzIuNTk1bC0xMC40IDcuMjU2Yy0uMTQuMS0uMzEuMTUtLjQ4LjE1eiIvPjwvZz48L3N2Zz4=" /></div>').appendTo(i),this.$item.append(i)},i.prototype.fitLayer=function(){return!0},i}),N2D("ItemYoutube",["Item"],function(t,e){"use strict";function i(){this.type="youtube",N2Classes.Item.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.Item.prototype),i.prototype.constructor=i,i.needSize=!0,i.prototype.added=function(){this.needFill=["youtubeurl","image","start"],this.generator.registerFields(["#item_youtubeyoutubeurl","#item_youtubeimage","#item_youtubestart"])},i.prototype.getName=function(t){return t.youtubeurl},i.prototype.parseAll=function(e){var i=this.values.youtubeurl!==e.youtubeurl;if(N2Classes.Item.prototype.parseAll.apply(this,arguments),""===e.image&&(e.image="$system$/images/placeholder/video.png"),e.image=nextend.imageHelper.fixed(e.image),i){var s=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,r=e.youtubeurl.match(s);r?N2Classes.AjaxHelper.getJSON("https://www.googleapis.com/youtube/v3/videos?id="+encodeURI(r[2])+"&part=snippet&key=AIzaSyC3AolfvPAPlJs-2FgyPJdEEKS6nbPHdSM").done(t.proxy(function(e){if(e.items.length){var i=e.items[0].snippet.thumbnails,s=i.maxres||i.standard||i.high||i.medium||i["default"],n=s.url;"{video_url}"==this.values.youtubeurl&&(n=n.replace(r[2],"{video_id}")),t("#item_youtubeimage").val(n).trigger("change")}},this)).fail(function(t){N2Classes.Notification.error(t.error.errors[0].message)}):N2Classes.Notification.error("The provided URL does not match any known YouTube url or code!")}},i.prototype.fitLayer=function(){return!0},i.prototype._render=function(e){var i=t('<div class="n2-ow"></div>').css({width:"100%",height:"100%",minHeight:"50px",background:"url("+e.image+") no-repeat 50% 50%",backgroundSize:"cover"});parseInt(e.playbutton)&&t('<div class="n2-ss-layer-player n2-ss-layer-player-cover"><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0OCA0OCI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIyNCIgY3k9IjI0IiByPSIyNCIgZmlsbD0iIzAwMCIgb3BhY2l0eT0iLjYiLz48cGF0aCBmaWxsPSIjRkZGIiBkPSJNMTkuOCAzMmMtLjEyNCAwLS4yNDctLjAyOC0uMzYtLjA4LS4yNjQtLjExNi0uNDM2LS4zNzUtLjQ0LS42NjRWMTYuNzQ0Yy4wMDUtLjI5LjE3Ni0uNTUuNDQtLjY2Ni4yNzMtLjEyNi41OTItLjEuODQuMDdsMTAuNCA3LjI1N2MuMi4xMzIuMzIuMzU1LjMyLjU5NXMtLjEyLjQ2My0uMzIuNTk1bC0xMC40IDcuMjU2Yy0uMTQuMS0uMzEuMTUtLjQ4LjE1eiIvPjwvZz48L3N2Zz4=" /></div>').appendTo(i),this.$item.append(i)},i}),N2D("smartslider-backend");
1
+ (function(){var t=this;t.N2_=t.N2_||{r:[],d:[]},t.N2R=t.N2R||function(){t.N2_.r.push(arguments)},t.N2D=t.N2D||function(){t.N2_.d.push(arguments)}}).call(window),N2D("ContextMenu",function(t,e){function i(e,i){this.isActive=!1,this.$el=e.data("nextendcontextmenu",this),this.parameters=t.extend({selector:!1,onShow:function(){}},i),this.$menu=t('<div class="n2-context-menu"></div>').on("mousedown",function(){N2Classes.WindowManager.get().setMouseDownArea("context-menu")}).appendTo("body"),this.parameters.selector?this.$el.on("contextmenu",this.parameters.selector,t.proxy(this.onShowContextMenu,this)):this.$el.on("contextmenu",t.proxy(this.onShowContextMenu,this))}return i.prototype.onShowContextMenu=function(e){e.preventDefault(),this.clearItems(),this.parameters.onShow.call(this,e,this),this.hasItems&&(e.stopPropagation(),this.isActive=!0,this.$menu.css({left:e.pageX,top:e.pageY}),t("html").on("mouseleave.nextendcontextmenu, click.nextendcontextmenu",t.proxy(this.onHide,this))),this.$menu.toggleClass("n2-active",this.hasItems)},i.prototype.onHide=function(){t("html").off(".nextendcontextmenu"),this.$menu.removeClass("n2-active"),this.isActive=!1},i.prototype.clearItems=function(){this.isActive&&this.onHide(),this.hasItems=!1,this.$menu.html("")},i.prototype.addItem=function(e,i,s){this.hasItems=!0,this.$menu.append(t('<div><i class="n2-i '+i+'"></i><span>'+e+"</span></div>").on("click",s))},t.fn.nextendContextMenu=function(e){return this.each(function(){new i(t(this),e)})},i}),N2D("Zoom",function(t,e){function i(e){this.currentContainerWidth=0,this.devices={unknownUnknown:t("<div />")},this.responsives=[],this.add(e);var i=e.parameters.sliderWidthToDevice.desktopPortrait;this.container=e.containerElement.closest(".n2-ss-container-device,.n2-ss-canvas-slider-container").add(e.containerElement.closest(".n2-ss-slider-outer-container")),this.container.width(i),this.containerWidth=i,this.initZoom();var s=t("#n2-ss-devices .n2-tr"),r=e.parameters.deviceModes;this.devices.desktopPortrait=t('<div class="n2-td n2-panel-option" data-device="desktop" data-orientation="portrait"><i class="n2-i n2-it n2-i-v-desktop"></i></div>').prependTo(s),r.desktopLandscape?this.devices.desktopLandscape=t('<div class="n2-td n2-panel-option" data-device="desktop" data-orientation="landscape"><i class="n2-i n2-it n2-i-v-desktop-landscape"></i></div>').prependTo(s):this.devices.desktopLandscape=this.devices.desktopPortrait,r.tabletPortrait?this.devices.tabletPortrait=t('<div class="n2-td n2-panel-option" data-device="tablet" data-orientation="portrait"><i class="n2-i n2-it n2-i-v-tablet"></i></div>').prependTo(s):this.devices.tabletPortrait=this.devices.desktopPortrait,r.tabletLandscape?this.devices.tabletLandscape=t('<div class="n2-td n2-panel-option" data-device="tablet" data-orientation="landscape"><i class="n2-i n2-it n2-i-v-tablet-landscape"></i></div>').prependTo(s):this.devices.tabletLandscape=this.devices.desktopLandscape,r.mobilePortrait?this.devices.mobilePortrait=t('<div class="n2-td n2-panel-option" data-device="mobile" data-orientation="portrait"><i class="n2-i n2-it n2-i-v-mobile"></i></div>').prependTo(s):this.devices.mobilePortrait=this.devices.tabletPortrait,r.mobileLandscape?this.devices.mobileLandscape=t('<div class="n2-td n2-panel-option" data-device="mobile" data-orientation="landscape"><i class="n2-i n2-it n2-i-v-mobile-landscape"></i></div>').prependTo(s):this.devices.mobileLandscape=this.devices.tabletLandscape,this.deviceOptions=t("#n2-ss-devices .n2-panel-option"),this.deviceOptions.each(t.proxy(function(e,i){t(i).on({mousedown:t.proxy(N2Classes.WindowManager.setMouseDownArea,null,"zoomDeviceClicked"),click:t.proxy(this.setDeviceMode,this)})},this)),e.sliderElement.on("SliderDeviceOrientation",t.proxy(this.onDeviceOrientationChange,this))}var s=null;return i.add=function(t){s=new i(t),i.add=function(t){s.add(t)}},i.prototype.add=function(t){this.responsives.push(t),this.setOrientation("portrait"),t.parameters.onResizeEnabled=0,t.parameters.forceFull=0,t._getDevice=t._getDeviceZoom},i.prototype.onDeviceOrientationChange=function(e,i){t("#n2-admin").removeClass("n2-ss-mode-"+i.lastDevice+i.lastOrientation).addClass("n2-ss-mode-"+i.device+i.orientation),this.devices[i.lastDevice+i.lastOrientation].removeClass("n2-active"),this.devices[i.device+i.orientation].addClass("n2-active")},i.prototype.initZoom=function(){var e=t("#n2-ss-slider-zoom");e.length>0&&("undefined"!=typeof e[0].slide&&(e[0].slide=null),this.zoom=e.removeAttr("slide").prop("slide",!1).nUISlider({step:1,value:1,min:0,max:102}),this.$handle=e.data("nUISlider").handle,this.responsives[0].sliderElement.one("SliderResize",t.proxy(function(t){var e=this.responsives[0].containerElement.width();this.setContainerWidth(t,e,!0)},this)),this.zoom.on({"slide.n2-ss-zoom":t.proxy(this.zoomChange,this),"slidechange.n2-ss-zoom":t.proxy(this.zoomChange,this)}))},i.prototype.zoomChange=function(t,i){if(t.originalEvent!==e){var s,r=i.value,n=1;50>r?n=nextend.smallestZoom/this.containerWidth+Math.max(r/50,0)*(1-nextend.smallestZoom/this.containerWidth):r>52&&(n=1+(r-52)/50),s=parseInt(n*this.containerWidth),this.setContainerWidth(t,s)}},i.prototype.setContainerWidth=function(e,i,s){if(this.currentContainerWidth!=i){this.currentContainerWidth=i,this.$handle.html(i+"px"),this.container.width(i);for(var r=0;r<this.responsives.length;r++)this.responsives[r].doResize(e);if(s){var n=i/this.containerWidth,o=50;1>n?o=(n-nextend.smallestZoom/this.containerWidth)/(1-nextend.smallestZoom/this.containerWidth)*50:n>1&&(o=50*(n-1)+52),this.zoom.nUISlider("option","value",o)}t(window).trigger("resize")}},i.prototype.setDeviceMode=function(e){var i=t(e.currentTarget);if((e.ctrlKey||e.metaKey)&&this.responsives[0].slider.editor.fragmentEditor){var s=i.data("orientation");this.responsives[0].slider.editor.fragmentEditor.copyOrResetMode(i.data("device")+s[0].toUpperCase()+s.substr(1))}else this.setOrientation(i.data("orientation")),this.setContainerWidth(e,this.getModeWidth(i.data("device")),!0)},i.prototype.getModeWidth=function(t){var e,i=this.responsives[0];e=i.orientationMode==N2Classes.SmartSliderResponsive.OrientationMode.ADMIN_PORTRAIT?N2Classes.SmartSliderResponsive.DeviceOrientation.PORTRAIT:N2Classes.SmartSliderResponsive.DeviceOrientation.LANDSCAPE;var s=i.parameters.sliderWidthToDevice[t+N2Classes.SmartSliderResponsive._DeviceOrientation[e]];if("mobile"==t)switch(N2Classes.SmartSliderResponsive._DeviceOrientation[e]){case"Portrait":s=Math.max(nextend.smallestZoom,320)}return s},i.prototype.setOrientation=function(t){if("portrait"==t)for(var e=0;e<this.responsives.length;e++)this.responsives[e].orientationMode=N2Classes.SmartSliderResponsive.OrientationMode.ADMIN_PORTRAIT;else for(var e=0;e<this.responsives.length;e++)this.responsives[e].orientationMode=N2Classes.SmartSliderResponsive.OrientationMode.ADMIN_LANDSCAPE},i}),N2D("CreateSlider",function(t,e){function i(e,i,s){this.addToGroupModal=null,this.groupID=e,this.ajaxUrl=i,this.shouldSkipLicenseModal=s,t(".n2-ss-create-slider").click(t.proxy(function(t){t.preventDefault(),t.stopImmediatePropagation(),this.showModal()},this)),this.notificationStack=new N2Classes.NotificationStackModal(t("body")),t(".n2-ss-add-sample-slider").click(t.proxy(function(t){t.preventDefault(),t.stopImmediatePropagation(),this.showDemoSliders()},this)),"createslider"===window.location.hash.substring(1)&&this.showModal()}return i.prototype.showModal=function(){if(!this.createSliderModal){var e=this,i=this.ajaxUrl,s=[];s.push({key:"default",name:n2_("Default"),image:"$ss$/admin/images/sliderpresets/default.png"}),s.push({key:"fullwidth",name:n2_("Full width"),image:"$ss$/admin/images/sliderpresets/fullwidth.png"}),s.push({key:"thumbnailhorizontal",name:n2_("Thumbnail - horizontal"),image:"$ss$/admin/images/sliderpresets/thumbnailhorizontal.png"});var r=[550,540];this.createSliderModal=new N2Classes.NextendModal({zero:{size:r,title:n2_("Create Slider"),back:!1,close:!0,content:'<form class="n2-form"></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Create")+"</a>"],fn:{show:function(){var r=this.controls.find(".n2-button-green"),n=this.content.find(".n2-form").on("submit",function(t){t.preventDefault(),r.trigger("click")});n.append(this.createInput(n2_("Slider name"),"createslidertitle","width: 240px;")),n.append(this.createInputUnit(n2_("Width"),"createsliderwidth","px","width: 30px;")),n.append(this.createInputUnit(n2_("Height"),"createsliderheight","px","width: 30px;")),new N2Classes.FormElementAutocompleteSimple("createsliderwidth",["1920","1200","1000","800","600","400"]),new N2Classes.FormElementAutocompleteSimple("createsliderheight",["800","600","500","400","300","200"]);var o=t("#createslidertitle").val(n2_("Slider")).focus(),a=t("#createsliderwidth").val(1200),l=t("#createsliderheight").val(500);a.parent().addClass("n2-form-element-autocomplete"),l.parent().addClass("n2-form-element-autocomplete"),this.createHeading(n2_("Preset")).appendTo(this.content);var h=120,d=this.createImageRadio(s).css({height:h,display:"flex",flexWrap:"wrap"}).appendTo(this.content),p=d.find("input");d.css("overflow","hidden"),this.createHeading(n2_("Import Sample Sliders")).appendTo(this.content),t('<div class="n2-ss-create-slider-free-sample" style="background-image: url(\''+nextend.imageHelper.fixed("$ss$/admin/images/free/sample1.png")+'\')"></div><div class="n2-ss-create-slider-free-sample" style="background-image: url(\''+nextend.imageHelper.fixed("$ss$/admin/images/free/sample2.png")+'\')"></div><div class="n2-ss-create-slider-free-sample" style="background-image: url(\''+nextend.imageHelper.fixed("$ss$/admin/images/free/sample3.png")+"')\"></div>").on("click",t.proxy(function(){this.hide(),e.showDemoSliders()},this)).appendTo(this.content),r.on("click",t.proxy(function(){N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(i,{nextendaction:"create"}),data:{groupID:e.groupID,sliderTitle:o.val(),sliderSizeWidth:a.val(),sliderSizeHeight:l.val(),preset:p.val()},dataType:"json"}).done(t.proxy(function(t){N2Classes.AjaxHelper.startLoading()},this))},this))}}}})}this.createSliderModal.show()},i.prototype.showDemoSliders=function(){var e=this;t("body").css("overflow","hidden");var i=0,s=t('<iframe src="//smartslider3.com/demo-import/?pro='+i+"&version="+N2SS3VERSION+"&utm_campaign="+N2SS3C+"&utm_source=import-slider-frame&utm_medium=smartslider-"+N2PLATFORM+"-"+(i?"pro":"free")+'" frameborder="0"></iframe>').css({position:"fixed",zIndex:1e5,left:0,top:0,width:"100%",height:"100%"}).appendTo("body"),r=function(){t("body").css("overflow",""),s.remove(),window.removeEventListener("message",o,!1),e.notificationStack.popStack()},n=function(t){N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(e.ajaxUrl,{nextendaction:"importDemo"}),data:{groupID:e.groupID,key:N2Classes.Base64.encode(t.replace(/^(http(s)?:)?\/\//,"//"))},dataType:"json"}).fail(function(){})},o=function(t){if("http://smartslider3.com"===t.origin||"https://smartslider3.com"===t.origin){var e=t.data;switch(e.key){case"importSlider":return void("function"==typeof nextend.joinCommunity?nextend.joinCommunity(function(){n(e.data.href)}):n(e.data.href));case"closeWindow":r()}}};this.notificationStack.enableStack(),N2Classes.Esc.add(t.proxy(function(){return r(),!0},this)),window.addEventListener("message",o,!1)},i}),N2D("ManageSliders",function(t,e){function i(e,i,s){this.groupID=e,this.ajaxUrl=i,this.sliders=[],this.sliderPanel=t("#n2-ss-slider-container"),this.orderBy="ordering"==this.sliderPanel.data("orderby"),this.slidersContainer=this.sliderPanel.find(".n2-ss-sliders-container");for(var r=this.slidersContainer.find(".n2-ss-box-slider"),n=0;n<r.length;n++)this.sliders.push(new N2Classes.Slider(this,r.eq(n)));this.changed(),this.initMenu(),this.initOrderable(),this.create=new N2Classes.CreateSlider(e,i,s),this.initBulk()}return i.prototype.changed=function(){t("html").attr("data-sliders",this.sliders.length)},i.prototype.initSliders=function(){for(var e=this.slidersContainer.find(".n2-ss-box-slider"),i=[],s=0;s<e.length;s++){var r=e.eq(s).data("slider");i.push(r)}this.sliders=i,this.changed(),t(window).triggerHandler("SmartSliderSidebarSlidersChanged")},i.prototype.initOrderable=function(){if(this.orderBy){var e={helper:"clone",items:"> .n2-ss-box-slider",stop:t.proxy(this.saveOrder,this),placeholder:"n2-box-sortable-placeholder",distance:10};this.slidersContainer.nUISortable(e)}},i.prototype.saveOrder=function(e,i){for(var s=this.slidersContainer.find(".n2-ss-box-slider"),r=[],n=[],o=[],a=0;a<s.length;a++){var l=s.eq(a).data("slider");r.push(l),n.push(l.getId())}for(var a=0;a<this.sliders.length;a++)o.push(this.sliders[a].getId());if(JSON.stringify(o)!=JSON.stringify(n)){t(window).triggerHandler("SmartSliderSidebarSlidersOrderChanged");var h={nextendcontroller:"sliders",nextendaction:"order"};N2Classes.AjaxHelper.ajax({type:"POST",url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,h),data:{groupID:this.groupID,sliderorder:n,isReversed:"DESC"==this.sliderPanel.data("orderbydirection")?1:0}}),this.sliders=r}},i.prototype.initMenu=function(){this.slider=null,this.menu=t("#n2-ss-slider-menu").detach().addClass("n2-inited"),this.menuActions={duplicate:this.menu.find(".n2-ss-duplicate").on("click",t.proxy(function(t){this.slider.duplicate(t)},this)),"delete":this.menu.find(".n2-ss-delete").on("click",t.proxy(function(t){this.slider["delete"](t)},this)),preview:this.menu.find(".n2-ss-preview").on("click",t.proxy(function(t){this.slider.preview(t)},this))},this.menu.find(".n2-button").on("click",t.proxy(function(e){e.preventDefault(),e.stopPropagation(),this.menu.hasClass("n2-active")?this.menu.removeClass("n2-active").off("mouseleave"):this.menu.addClass("n2-active").on("mouseleave",function(){t(this).removeClass("n2-active")})},this))},i.prototype.showMenu=function(t){this.slider=t,this.menu.appendTo(t.box)},i.prototype.hideMenu=function(){this.menu.hasClass("n2-active")&&this.menu.removeClass("n2-active").off("mouseleave"),this.menu.detach()},i.prototype.deleteSliders=function(e,i){this.hideMenu();var s=i[0].box.find(".n2-box-placeholder-title a").text();i.length>1&&(s+=" and "+(i.length-1)+" more"),N2Classes.NextendModal.deleteModal("slider-delete",s,t.proxy(function(){N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.ajaxUrl,{nextendcontroller:"sliders",nextendaction:"delete"}),type:"POST",data:{sliders:e}}).done(t.proxy(function(){for(var t=0;t<i.length;t++)i[t].deleted();this.initSliders(),this.leaveBulk()},this))},this))},i.prototype.duplicateSliders=function(e,i){for(var s=0;s<this.sliders.length;s++)this.sliders[s].selected&&this.sliders[s].duplicate(t.Event("click",{currentTarget:null}))},i.prototype.exportSliders=function(e,i){window.location.href=N2Classes.AjaxHelper.makeFallbackUrl(this.ajaxUrl,{nextendcontroller:"sliders",nextendaction:"exportAll"})+"&"+t.param({sliders:e,currentGroupID:this.groupID})},i.prototype.initBulk=function(){this.selection=[],this.isBulkSelection=!1;var e=t(".n2-bulk-select").find("a");e.eq(0).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.select()})},this)),e.eq(1).on("click",t.proxy(function(t){t.preventDefault(),this.bulkSelect(function(t){t.deSelect()})},this));t(".n2-bulk-actions").find("a").on("click",t.proxy(function(e){switch(e.preventDefault(),t(e.currentTarget).data("action")){case"duplicate":this.bulkAction("duplicateSliders",!1);break;case"delete":this.bulkAction("deleteSliders",!1);break;case"export":this.bulkAction("exportSliders",!1);break;case"addToGroup":this.bulkAction("addToGroup",!0)}},this))},i.prototype.addSelection=function(t){0==this.selection.length&&this.enterBulk(),this.selection.push(t)},i.prototype.removeSelection=function(e){this.selection.splice(t.inArray(e,this.selection),1),0==this.selection.length&&this.leaveBulk()},i.prototype.bulkSelect=function(t){for(var e=0;e<this.sliders.length;e++)t(this.sliders[e])},i.prototype.bulkAction=function(t,e){var i=[],s=[];this.bulkSelect(function(t){!t.selected||e&&t.isGroup||(i.push(t),s.push(t.getId()))}),s.length?(this[t](s,i),this.leaveBulk()):e?N2Classes.Notification.notice("Please select one or more sliders for the action!"):N2Classes.Notification.notice("Please select one or more sliders or groups for the action!")},i.prototype.enterBulk=function(){this.isBulkSelection||(this.isBulkSelection=!0,this.orderBy&&this.slidersContainer.nUISortable("option","disabled",!0),t("#n2-admin").addClass("n2-ss-has-box-selection"))},i.prototype.leaveBulk=function(){if(this.isBulkSelection){this.orderBy&&this.slidersContainer.nUISortable("option","disabled",!1),t("#n2-admin").removeClass("n2-ss-has-box-selection");for(var e=0;e<this.sliders.length;e++)this.sliders[e].deSelect();this.selection=[],this.isBulkSelection=!1}},i}),N2D("Slider",function(t,e){function i(e,i){this.selected=!1,this.manager=e,this.box=i.data("slider",this).addClass("n2-clickable"),this.isGroup=this.box.hasClass("n2-ss-box-slider-group"),this.box.on("mouseenter",t.proxy(function(){this.manager.showMenu(this)},this)).on("mouseleave",t.proxy(function(){this.manager.hideMenu()},this)).on("click.n2-slider",t.proxy(this.goToEdit,this)),this.box.find(".n2-ss-box-select").on("click",t.proxy(function(t){t.stopPropagation(),t.preventDefault(),this.invertSelection()},this))}return i.prototype.getId=function(){return this.box.data("sliderid")},i.prototype.goToEdit=function(t,e){if("A"!==t.target.tagName){var i=this.box.data("editurl");"undefined"!=typeof e&&e?window.open(i,"_blank"):window.location=i}},i.prototype.preview=function(t){t.stopPropagation(),t.preventDefault(),window.open(N2Classes.AjaxHelper.makeFallbackUrl(this.box.data("editurl"),{nextendcontroller:"preview",nextendaction:"index"}),"_blank")},i.prototype.duplicate=function(e){e.stopPropagation(),e.preventDefault();var s=t.Deferred();return N2Classes.AjaxHelper.ajax({url:N2Classes.AjaxHelper.makeAjaxUrl(this.box.data("editurl"),{nextendcontroller:"slider",nextendaction:"duplicate"})}).done(t.proxy(function(e){var r=t(e.data).insertAfter(this.box),n=new i(this.manager,r);this.manager.initSliders(),s.resolve(n)},this)),s},i.prototype["delete"]=function(t){t.stopPropagation(),t.preventDefault(),this.manager.deleteSliders([this.getId()],[this])},i.prototype.deleted=function(){this.box.remove()},i.prototype.invertSelection=function(t){t&&t.preventDefault(),this.selected?this.deSelect():this.select()},i.prototype.select=function(){this.selected||(this.selected=!0,this.box.addClass("n2-selected"),this.manager.addSelection(this))},i.prototype.deSelect=function(){this.selected&&(this.selected=!1,this.box.removeClass("n2-selected"),this.manager.removeSelection(this))},i}),N2D("FormElementAnimationManager",["FormElement"],function(t,e){function i(e,i){this.element=t("#"+e),this.managerIdentifier=i,this.element.parent().on("click",t.proxy(this.show,this)),this.element.siblings(".n2-form-element-clear").on("click",t.proxy(this.clear,this)),this.name=this.element.siblings("input"),this.updateName(this.element.val()),N2Classes.FormElement.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.FormElement.prototype),i.prototype.constructor=i,i.prototype.show=function(e){e.preventDefault(),nextend[this.managerIdentifier].show(this.element.val(),t.proxy(this.save,this))},i.prototype.clear=function(t){t.preventDefault(),t.stopPropagation(),this.val("")},i.prototype.save=function(t,e){this.val(e)},i.prototype.val=function(t){this.element.val(t),this.updateName(t),this.triggerOutsideChange()},i.prototype.insideChange=function(t){this.element.val(t),this.updateName(t),this.triggerInsideChange()},i.prototype.updateName=function(t){t=""==t?n2_("Disabled"):t.split("||").length>1?n2_("Multiple animations"):n2_("Single animation"),this.name.val(t)},i}),N2D("FormElementBackground",["FormElement"],function(t,e){function i(e,i){this.value="",this.element=t("#"+e),this.$container=this.element.closest(".n2-form-tab"),this.panel=t("#"+e+"-panel"),this.setValue(i),this.options=this.panel.find(".n2-subform-image-option").on("click",t.proxy(this.selectOption,this)),this.active=this.getIndex(this.options.filter(".n2-active").get(0)),this.element.on("change",t.proxy(function(){this.insideChange(this.element.val())},this)),N2Classes.FormElement.prototype.constructor.apply(this,arguments)}return i.prototype=Object.create(N2Classes.FormElement.prototype),i.prototype.constructor=i,i.prototype.selectOption=function(e){var i=this.getIndex(e.currentTarget);if(i!=this.active){this.options.eq(i).addClass("n2-active"),this.options.eq(this.active).removeClass("n2-active"),this.active=i;var s=t(e.currentTarget).data("value");this.insideChange(s)}},i.prototype.setValue=function(t){this.$container.removeClass("n2-ss-background-type-"+this.value),this.value=t,this.$container.addClass("n2-ss-background-type-"+this.value)},i.prototype.insideChange=function(t){this.setValue(t),this.element.val(t),this.options.removeClass("n2-active"),this.options.filter('[data-value="'+t+'"]').addClass("n2-active"),this.triggerInsideChange()},i.prototype.getIndex=function(e){return t.inArray(e,this.options)},i}),N2D("FormElementColumns",["FormElement"],function(t,e){function i(e){this.denominators={1:100,2:100,3:144,4:100,5:100,6:144},this.element=t("#"+e),N2Classes.FormElement.prototype.constructor.apply(this,arguments),this.$c=t("#"+e).parent(),this.$container=this.$c.find(".n2-ss-columns-element-container"),this.containerWidth=284,this.maxWidth=0,this.$container.nUISortable({axis:"x",items:".n2-ss-columns-element-column",helper:"clone_hide",start:t.proxy(function(t,e){this.$container.addClass("n2-sortable-currently-sorted"),e.placeholder.css({width:e.item.width(),visibility:"hidden"});var i=this.$container.find(".n2-ss-columns-element-column");e.item.data("index",i.index(e.item))},this),stop:t.proxy(function(t,e){var i=this.$container.find(".n2-ss-columns-element-column"),s=e.item.data("index"),r=i.index(e.item);s!=r&&(this.currentRow.moveCol(s,r),e.item.data("index",null)),this.makeResizable(),this.$container.removeClass("n2-sortable-currently-sorted")},this)}),this.$c.find(".n2-ss-columns-element-add-col").on({click:t.proxy(function(){this.currentRow.createCol()},this)})}return i.prototype=Object.create(N2Classes.FormElement.prototype),i.prototype.constructor=i,i.prototype.getDenominator=function(t){return this.denominators[t]===e&&(this.denominators[t]=15*t),this.denominators[t]},i.prototype.setRow=function(t){this.currentRow=t,this.insideChange(t.getColumnsOrdered())},i.prototype.setValue=function(t){},i.prototype.insideChange=function(t){this.start(t)},i.prototype.activateColumn=function(t){var e=this.$container.find(".n2-ss-columns-element-column").index(t.currentTarget);this.currentRow.activateColumn(e,t)},i.prototype.start=function(e){this.percentages=[];for(var i=e.split("+"),s=0;s<i.length;s++)this.percentages.push(new Fraction(i[s]));thi