Nested Pages - Version 3.2.3

Version Description

  • Adds the ability to clone the post/page tree in hierarchical post types.
  • Adds option to set the maximum nesting level per post type. To configure, visit Settings > Nested Pages > Post Types, and select the post type you'd like to configure. The option can be located under the "Maximum Nesting Depth" tab.
  • Fixes bug where nav menu was being added when saving plugin options, even when "Disable menu sync completely" was selected.
Download this release

Release Info

Developer kylephillips
Plugin Icon 128x128 Nested Pages
Version 3.2.3
Comparing to
See all releases

Code changes from version 3.2.2 to 3.2.3

app/Activation/Updates/Updates.php CHANGED
@@ -57,6 +57,9 @@ class Updates
57
  */
58
  private function addMenu()
59
  {
 
 
 
60
  if ( !get_option('nestedpages_menu') ){
61
  $menu_id = $this->nav_menu_repo->getMenuIDFromTitle('Nested Pages');
62
  if ( !$menu_id ) $menu_id = wp_create_nav_menu('Nested Pages');
57
  */
58
  private function addMenu()
59
  {
60
+ if ( get_option('nestedpages_menusync') !== 'sync' ) return;
61
+ if ( get_option('nestedpages_disable_menu') == 'true' ) return;
62
+
63
  if ( !get_option('nestedpages_menu') ){
64
  $menu_id = $this->nav_menu_repo->getMenuIDFromTitle('Nested Pages');
65
  if ( !$menu_id ) $menu_id = wp_create_nav_menu('Nested Pages');
app/Entities/NavMenu/NavMenuSync.php CHANGED
@@ -51,12 +51,33 @@ abstract class NavMenuSync
51
  }
52
 
53
  /**
54
- * Remove a Menu Item
55
- * @since 1.3.4
56
- * @param int $id - ID of nav menu item
57
- */
58
- protected function removeItem($id)
59
- {
60
- wp_delete_post($id, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
- }
51
  }
52
 
53
  /**
54
+ * Remove a Menu Item
55
+ * @since 1.3.4
56
+ *
57
+ * @param int $id - ID of nav menu item
58
+ */
59
+ protected function removeItem($id) {
60
+
61
+ $recurse = apply_filters('nestedpages_recursive_remove_menu_item', false, $id);
62
+ if ( ! empty( $id ) && $recurse ) {
63
+ $args = [
64
+ 'post_type' => 'nav_menu_item',
65
+ 'meta_query' => [
66
+ [
67
+ 'key' => '_menu_item_menu_item_parent',
68
+ 'value' => $id
69
+ ]
70
+ ],
71
+ 'fields' => 'ids'
72
+ ];
73
+ $children = get_posts( $args );
74
+ if ( $children ) {
75
+ foreach ( $children as $child ) {
76
+ $this->removeItem( $child, true );
77
+ }
78
+ }
79
+ }
80
+
81
+ wp_delete_post( $id, true );
82
  }
83
+ }
app/Entities/Post/PostCloner.php CHANGED
@@ -33,17 +33,17 @@ class PostCloner
33
  */
34
  private $clone_options = [];
35
 
36
- /**
37
- * New Posts
38
- * @var array of post IDs
39
- */
40
- private $new_posts;
41
-
42
  /**
43
  * Clone the post
44
- * @var int $id
 
 
 
 
 
 
45
  */
46
- public function clonePost($id, $quantity = 1, $status = 'publish', $author = null)
47
  {
48
  if ( !current_user_can('edit_post', $id) ) return;
49
  $this->original_id = $id;
@@ -51,8 +51,10 @@ class PostCloner
51
  $this->clone_options['quantity'] = $quantity;
52
  $this->clone_options['status'] = $status;
53
  $this->clone_options['author'] = $author;
 
 
 
54
  $this->loopClone();
55
- return $this->new_posts;
56
  }
57
 
58
  /**
@@ -60,10 +62,44 @@ class PostCloner
60
  */
61
  private function loopClone()
62
  {
63
- for ( $i = 0; $i < $this->clone_options['quantity']; $i++ ){
 
64
  $this->clonePostData();
65
  $this->cloneTaxonomies();
66
  $this->cloneMeta();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
  }
69
 
@@ -72,6 +108,7 @@ class PostCloner
72
  */
73
  private function clonePostData()
74
  {
 
75
  $args = [
76
  'comment_status' => $this->original_post->comment_status,
77
  'ping_status' => $this->original_post->ping_status,
@@ -79,7 +116,7 @@ class PostCloner
79
  'post_content' => $this->original_post->post_content,
80
  'post_excerpt' => $this->original_post->post_excerpt,
81
  'post_name' => $this->original_post->post_name,
82
- 'post_parent' => $this->original_post->post_parent,
83
  'post_password' => $this->original_post->post_password,
84
  'post_status' => $this->clone_options['status'],
85
  'post_title' => $this->original_post->post_title,
@@ -88,7 +125,6 @@ class PostCloner
88
  'menu_order' => $this->original_post->menu_order
89
  ];
90
  $this->new_id = wp_insert_post(wp_slash($args));
91
- $this->new_posts[] = $this->new_id;
92
  }
93
 
94
  /**
33
  */
34
  private $clone_options = [];
35
 
 
 
 
 
 
 
36
  /**
37
  * Clone the post
38
+ * @param int $id - The ID of the original post to clone
39
+ * @param int $quantity - The number of copies to make
40
+ * @param str $status - The post status
41
+ * @param int $author - The author id to assign the new post(s) to
42
+ * @param bool $clone_children - Whether to clone the post tree (hierarchical only)
43
+ * @param int $parent_id - The parent post to assign the clone to
44
+ * @param bool $original_clone - Whether this is the original clone. Used in post tree cloning only
45
  */
46
+ public function clonePost($id, $quantity = 1, $status = 'publish', $author = null, $clone_children = false, $parent_id = null, $original_clone = true)
47
  {
48
  if ( !current_user_can('edit_post', $id) ) return;
49
  $this->original_id = $id;
51
  $this->clone_options['quantity'] = $quantity;
52
  $this->clone_options['status'] = $status;
53
  $this->clone_options['author'] = $author;
54
+ $this->clone_options['clone_children'] = $clone_children;
55
+ $this->clone_options['parent_id'] = $parent_id;
56
+ $this->clone_options['original_clone'] = $original_clone;
57
  $this->loopClone();
 
58
  }
59
 
60
  /**
62
  */
63
  private function loopClone()
64
  {
65
+ $quantity = ( $this->clone_options['original_clone'] ) ? $this->clone_options['quantity'] : 1;
66
+ for ( $i = 0; $i < $quantity; $i++ ){
67
  $this->clonePostData();
68
  $this->cloneTaxonomies();
69
  $this->cloneMeta();
70
+ $this->cloneChildren();
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Loop through and clone the children if set to do so
76
+ */
77
+ private function cloneChildren()
78
+ {
79
+ if ( !$this->clone_options['clone_children'] ) return;
80
+ $post_type = $this->original_post->post_type;
81
+ if ( $post_type = 'page' ) $post_type = ['page', 'np-redirect'];
82
+ $child_ids = [];
83
+ $children = new \WP_Query([
84
+ 'post_type' => $post_type,
85
+ 'post_parent' => $this->original_id,
86
+ 'posts_per_page' => -1,
87
+ 'fields' => 'ids'
88
+ ]);
89
+ if ( $children->have_posts() ) $child_ids = $children->posts;
90
+ wp_reset_postdata();
91
+ if ( empty($child_ids) ) return;
92
+ foreach ( $child_ids as $child_id ){
93
+ $cloner = (new PostCloner)
94
+ ->clonePost(
95
+ $child_id,
96
+ $this->clone_options['quantity'],
97
+ $this->clone_options['status'],
98
+ $this->clone_options['author'],
99
+ $this->clone_options['clone_children'],
100
+ $this->new_id,
101
+ false
102
+ );
103
  }
104
  }
105
 
108
  */
109
  private function clonePostData()
110
  {
111
+ $parent = ( $this->clone_options['parent_id'] ) ? $this->clone_options['parent_id'] : $this->original_post->post_parent;
112
  $args = [
113
  'comment_status' => $this->original_post->comment_status,
114
  'ping_status' => $this->original_post->ping_status,
116
  'post_content' => $this->original_post->post_content,
117
  'post_excerpt' => $this->original_post->post_excerpt,
118
  'post_name' => $this->original_post->post_name,
119
+ 'post_parent' => $parent,
120
  'post_password' => $this->original_post->post_password,
121
  'post_status' => $this->clone_options['status'],
122
  'post_title' => $this->original_post->post_title,
125
  'menu_order' => $this->original_post->menu_order
126
  ];
127
  $this->new_id = wp_insert_post(wp_slash($args));
 
128
  }
129
 
130
  /**
app/Entities/PostType/PostTypeRepository.php CHANGED
@@ -72,6 +72,8 @@ class PostTypeRepository
72
  $post_types[$type->name]->hide_default = $this->postTypeSetting($type->name, 'hide_default');
73
  $post_types[$type->name]->disable_sorting = $this->postTypeSetting($type->name, 'disable_sorting');
74
  $post_types[$type->name]->disable_nesting = $this->postTypeSetting($type->name, 'disable_nesting');
 
 
75
  $post_types[$type->name]->custom_fields_enabled = $this->postTypeSetting($type->name, 'custom_fields_enabled');
76
  $post_types[$type->name]->standard_fields_enabled = $this->postTypeSetting($type->name, 'standard_fields_enabled');
77
  $post_types[$type->name]->custom_fields = $this->configuredFields($type->name, 'custom_fields');
72
  $post_types[$type->name]->hide_default = $this->postTypeSetting($type->name, 'hide_default');
73
  $post_types[$type->name]->disable_sorting = $this->postTypeSetting($type->name, 'disable_sorting');
74
  $post_types[$type->name]->disable_nesting = $this->postTypeSetting($type->name, 'disable_nesting');
75
+ $post_types[$type->name]->enable_max_nesting = $this->postTypeSetting($type->name, 'enable_max_nesting');
76
+ $post_types[$type->name]->maximum_nesting = $this->postTypeSetting($type->name, 'maximum_nesting');
77
  $post_types[$type->name]->custom_fields_enabled = $this->postTypeSetting($type->name, 'custom_fields_enabled');
78
  $post_types[$type->name]->standard_fields_enabled = $this->postTypeSetting($type->name, 'standard_fields_enabled');
79
  $post_types[$type->name]->custom_fields = $this->configuredFields($type->name, 'custom_fields');
app/Form/Listeners/ClonePost.php CHANGED
@@ -40,6 +40,7 @@ class ClonePost extends BaseHandler
40
  $this->data['author'] = intval(sanitize_text_field($_POST['author']));
41
  $this->data['quantity'] = intval(sanitize_text_field($_POST['quantity']));
42
  $this->data['post_type'] = sanitize_text_field($_POST['posttype']);
 
43
  }
44
 
45
  /**
@@ -47,10 +48,13 @@ class ClonePost extends BaseHandler
47
  */
48
  private function clonePost()
49
  {
50
- $new_posts = $this->cloner->clonePost($this->data['post_id'], $this->data['quantity'], $this->data['status'], $this->data['author']);
51
- return wp_send_json([
52
- 'status' => 'success',
53
- 'posts' => $this->post_repo->postArray($new_posts, $this->data['post_type'])
54
- ]);
 
 
 
55
  }
56
  }
40
  $this->data['author'] = intval(sanitize_text_field($_POST['author']));
41
  $this->data['quantity'] = intval(sanitize_text_field($_POST['quantity']));
42
  $this->data['post_type'] = sanitize_text_field($_POST['posttype']);
43
+ $this->data['clone_children'] = ( $_POST['clone_children'] == 'true' ) ? true : false;
44
  }
45
 
46
  /**
48
  */
49
  private function clonePost()
50
  {
51
+ $this->cloner->clonePost(
52
+ $this->data['post_id'],
53
+ $this->data['quantity'],
54
+ $this->data['status'],
55
+ $this->data['author'],
56
+ $this->data['clone_children']
57
+ );
58
+ return wp_send_json(['status' => 'success']);
59
  }
60
  }
app/NestedPages.php CHANGED
@@ -12,7 +12,7 @@ class NestedPages
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
- $np_version = '3.2.2';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
+ $np_version = '3.2.3';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
app/Views/forms/clone-form.php CHANGED
@@ -55,6 +55,15 @@
55
  echo $authors_dropdown;
56
  endif;
57
  ?>
 
 
 
 
 
 
 
 
 
58
  </div><!-- .modal-body -->
59
 
60
 
55
  echo $authors_dropdown;
56
  endif;
57
  ?>
58
+
59
+ <?php if ( $this->post_type->hierarchical ) : ?>
60
+ <div class="form-control">
61
+ <label>
62
+ <input type="checkbox" data-clone-children value="true" />
63
+ <?php _e( 'Clone Children', 'wp-nested-pages' ); ?></label>
64
+ </div>
65
+ <?php endif; ?>
66
+
67
  </div><!-- .modal-body -->
68
 
69
 
app/Views/settings/settings-posttypes.php CHANGED
@@ -69,6 +69,21 @@ settings_fields( 'nestedpages-posttypes' );
69
  </div>
70
  </div><!-- .row -->
71
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  <?php endif; ?>
73
  <li>
74
  <div class="row">
69
  </div>
70
  </div><!-- .row -->
71
  </li>
72
+ <li>
73
+ <div class="row">
74
+ <div class="description">
75
+ <p><strong><?php _e('Maximum Nesting Depth', 'wp-nested-pages'); ?></strong><br>
76
+ <?php _e('By default, there is no maximum level of nesting for hierarchical posts. Value includes the primary level.', 'wp-nested-pages'); ?></p>
77
+ </div>
78
+ <div class="field">
79
+ <label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][enable_max_nesting]" value="true" <?php if ( $type->enable_max_nesting ) echo 'checked '; ?> data-nested-pages-enable-maximum-nesting/><?php printf(__('Enable Maximum Nesting Level %s', 'wp-nested-pages'), esc_html($type->label)); ?></label>
80
+ <div class="nestedpages-checklist-field" data-nested-pages-maximum-nesting style="padding-top: 5px;<?php if ( !$type->enable_max_nesting ) echo 'display:none;'; ?>">
81
+ <label><?php printf(__('Maximum Nesting Level for %s', 'wp-nested-pages'), esc_html($type->label)); ?></label>
82
+ <input type="number" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][maximum_nesting]" <?php if ( $type->maximum_nesting ) echo ' value="' . $type->maximum_nesting . '"'?>>
83
+ </div>
84
+ </div>
85
+ </div><!-- .row -->
86
+ </li>
87
  <?php endif; ?>
88
  <li>
89
  <div class="row">
assets/js/lib/nestedpages-factory.js CHANGED
@@ -101,6 +101,7 @@ NestedPages.selectors = {
101
  cloneQuantity : '[data-clone-quantity]', // Quantity to Clone
102
  cloneStatus : '[data-clone-status]', // Clone Status
103
  cloneAuthor : '[data-clone-author]', // Clone Author
 
104
 
105
  // Tabs
106
  tabButtonParent : '[data-np-tabs]', // Tab Parent
101
  cloneQuantity : '[data-clone-quantity]', // Quantity to Clone
102
  cloneStatus : '[data-clone-status]', // Clone Status
103
  cloneAuthor : '[data-clone-author]', // Clone Author
104
+ cloneChildren : '[data-clone-children]', // Checkbox to clone children
105
 
106
  // Tabs
107
  tabButtonParent : '[data-np-tabs]', // Tab Parent
assets/js/lib/nestedpages.clone.js CHANGED
@@ -41,6 +41,7 @@ NestedPages.Clone = function()
41
  // Clone the post
42
  plugin.clone = function()
43
  {
 
44
  plugin.toggleLoading(true);
45
  $.ajax({
46
  url : NestedPages.jsData.ajaxurl,
@@ -51,6 +52,7 @@ NestedPages.Clone = function()
51
  quantity : $(NestedPages.selectors.cloneQuantity).val(),
52
  status : $(NestedPages.selectors.cloneStatus).val(),
53
  author : $(NestedPages.selectors.cloneAuthor).find('select').val(),
 
54
  nonce : NestedPages.jsData.nonce,
55
  posttype : NestedPages.jsData.posttype
56
  },
41
  // Clone the post
42
  plugin.clone = function()
43
  {
44
+ var clone_children = ( $(NestedPages.selectors.cloneChildren).is(':checked') ) ? true : false;
45
  plugin.toggleLoading(true);
46
  $.ajax({
47
  url : NestedPages.jsData.ajaxurl,
52
  quantity : $(NestedPages.selectors.cloneQuantity).val(),
53
  status : $(NestedPages.selectors.cloneStatus).val(),
54
  author : $(NestedPages.selectors.cloneAuthor).find('select').val(),
55
+ clone_children : clone_children,
56
  nonce : NestedPages.jsData.nonce,
57
  posttype : NestedPages.jsData.posttype
58
  },
assets/js/lib/nestedpages.nesting.js CHANGED
@@ -16,6 +16,13 @@ NestedPages.Nesting = function()
16
  plugin.initializeSortable = function()
17
  {
18
  if ( !NestedPages.jsData.nestable ) return plugin.initializeSortableFlat();
 
 
 
 
 
 
 
19
 
20
  $(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({
21
  items : NestedPages.selectors.rows,
@@ -23,6 +30,7 @@ NestedPages.Nesting = function()
23
  handle: NestedPages.selectors.handle,
24
  placeholder: "ui-sortable-placeholder",
25
  tabSize : 56,
 
26
  isAllowed: function(placeholder, placeholderParent, currentItem){
27
  return ( $(placeholderParent).hasClass('post-type-np-redirect') && !$(currentItem).hasClass('post-type-np-redirect') ) ? false : true;
28
  },
16
  plugin.initializeSortable = function()
17
  {
18
  if ( !NestedPages.jsData.nestable ) return plugin.initializeSortableFlat();
19
+ var maxLevels = 0;
20
+
21
+ // Set the max level if necessary
22
+ if ( typeof nestedpages.post_types[NestedPages.jsData.posttype] !== 'undefined' ){
23
+ var post_type = nestedpages.post_types[NestedPages.jsData.posttype];
24
+ if ( typeof post_type.enable_max_nesting !== 'undefined' && post_type.enable_max_nesting && typeof post_type.maximum_nesting !== 'undefined' && post_type.maximum_nesting > 1 ) maxLevels = post_type.maximum_nesting;
25
+ }
26
 
27
  $(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({
28
  items : NestedPages.selectors.rows,
30
  handle: NestedPages.selectors.handle,
31
  placeholder: "ui-sortable-placeholder",
32
  tabSize : 56,
33
+ maxLevels : maxLevels,
34
  isAllowed: function(placeholder, placeholderParent, currentItem){
35
  return ( $(placeholderParent).hasClass('post-type-np-redirect') && !$(currentItem).hasClass('post-type-np-redirect') ) ? false : true;
36
  },
assets/js/lib/nestedpages.settings.js CHANGED
@@ -29,6 +29,9 @@ NestedPages.Settings = function()
29
  assignPostTypeRemove : '[data-nestedpages-page-pt-assignment-remove]', // Link to remove the assigned page for the post type,
30
  assignPostTypeSelection : '[data-nestedpages-page-pt-assignment-selection]', // The div displaying the selection
31
 
 
 
 
32
  // Sort Options for Post Types
33
  sortOptionCheckbox : '[data-nestedpages-sort-option-checkbox]', // Checkbox for enabling a sort option
34
  defaultSortOptions : '[data-nestedpages-sort-option-default]', // Default sort options (containing div)
@@ -84,6 +87,9 @@ NestedPages.Settings = function()
84
  $(document).on('change', plugin.selectors.sortOptionCheckbox, function(){
85
  plugin.toggleDefaultSortOptions($(this));
86
  });
 
 
 
87
  }
88
 
89
  /**
@@ -276,6 +282,20 @@ NestedPages.Settings = function()
276
  $(options).hide();
277
  }
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  return plugin.bindEvents();
280
  }
281
 
29
  assignPostTypeRemove : '[data-nestedpages-page-pt-assignment-remove]', // Link to remove the assigned page for the post type,
30
  assignPostTypeSelection : '[data-nestedpages-page-pt-assignment-selection]', // The div displaying the selection
31
 
32
+ enableMaximumNestingLevel : '[data-nested-pages-enable-maximum-nesting]', // Checkbox to enable maximum nesting level depth,
33
+ maximumNestingLevel : '[data-nested-pages-maximum-nesting]', // Input for setting maximum nesting level depth
34
+
35
  // Sort Options for Post Types
36
  sortOptionCheckbox : '[data-nestedpages-sort-option-checkbox]', // Checkbox for enabling a sort option
37
  defaultSortOptions : '[data-nestedpages-sort-option-default]', // Default sort options (containing div)
87
  $(document).on('change', plugin.selectors.sortOptionCheckbox, function(){
88
  plugin.toggleDefaultSortOptions($(this));
89
  });
90
+ $(document).on('change', plugin.selectors.enableMaximumNestingLevel, function(){
91
+ plugin.toggleMaximumNesting($(this));
92
+ });
93
  }
94
 
95
  /**
282
  $(options).hide();
283
  }
284
 
285
+ /**
286
+ * Toggle the Maximum Nesting Level Option
287
+ */
288
+ plugin.toggleMaximumNesting = function(checkbox)
289
+ {
290
+ var checked = ( $(checkbox).is(':checked') ) ? true : false;
291
+ var input = $(checkbox).parents('.field').find(plugin.selectors.maximumNestingLevel);
292
+ if ( checked ){
293
+ $(input).show();
294
+ return;
295
+ }
296
+ $(input).hide();
297
+ }
298
+
299
  return plugin.bindEvents();
300
  }
301
 
assets/js/nestedpages.js CHANGED
@@ -1 +1 @@
1
- var NestedPages=NestedPages||{};NestedPages.Formatter=function(){var s=this,i=jQuery;s.updateSubMenuToggle=function(){for(var e=i(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a,s=e[t],n=i(s).parent(".row").parent("li");0<i(n).children("ol").length?i(n).children("ol").find("li.page-row").length<1?i(n).children("ol").hide():(a='<div class="child-toggle-spacer"></div>',a+='<a href="#"',0<i(n).children("ol:visible").length&&(a+=' class="open"'),a+='><span class="np-icon-arrow"></span></a>',i(s).html(a),0<i(n).children("ol").children(".np-hide").length&&0===i(n).children("ol").children(".np-hide.shown").length?i(s).find("a").hide():0<i(n).children("ol").children(".np-hide").length&&0<i(n).children("ol").children(".np-hide.shown").length&&i(s).find("a").show(),0<i(n).children("ol").find(".page-row").not(".np-hide").length&&i(s).find("a").show()):i(s).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){i(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),i.each(i(NestedPages.selectors.lists),function(){i(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){s.setIndent()},s.setIndent=function(){var n="1"===nestedpages.non_indent?20:30,o="1"===nestedpages.non_indent?".row-inner":".child-toggle";i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=a*n+s,i(this).find(o).css("padding-left",s+"px")):(a<1&&i(this).find(o).css("padding-left","0px"),NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px"))})},s.setClassicIndent=function(){i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=20*a+s,i(this).find(".row-inner").css("padding-left",s+"px")):NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){var t,a;NestedPages.jsData.nestable&&(t=40*i(e.placeholder).parents("ol").length-40,a=i(NestedPages.selectors.sortable).width()-t,i(e.placeholder).width(a).css("margin-left",t+"px")),s.updateListVisibility(e)},s.updateListVisibility=function(e){e=i(e.placeholder).parent("ol");i(e).is(":visible")||(i(e).addClass("nplist"),i(e).show())},s.removeQuickEdit=function(){i(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),i(".sortable .quick-edit").remove(),i(".row").show()},s.showQuickEdit=function(){i("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){i(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){i(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){i(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){i(NestedPages.selectors.ajaxError).find("p").text(e),i(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){i(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=i(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=i(e).width(),a=i(e).height();i.each(i(NestedPages.selectors.thumbnailContainerLink),function(){i(this).width(t),i(this).height(a)})}},(NestedPages=NestedPages||{}).Dropdowns=function(){var t=this,a=jQuery;return t.dropdown="",t.activeBtn="",t.activeContent="",t.toggleBtn="[data-dropdown-toggle]",t.dropdownContainer="[data-dropdown]",t.dropdownContent="[data-dropdown-content]",t.selectors={caret_up:"icon-arrow_drop_up",caret_down:"icon-arrow_drop_down"},t.bindEvents=function(){a(document).on("click",t.toggleBtn,function(e){e.preventDefault(),t.activeBtn=a(this),t.dropdown=a(this).parents(t.dropdownContainer),t.toggleDropdown()}),a(document).on("click",function(e){t.closeDropdowns(e.target)}),a(document).on("dropdown-opened",function(e,t){0<a(t).parents(NestedPages.selectors.row).length&&a(t).parents(NestedPages.selectors.row).addClass("active")}),a(document).on("dropdown-closed",function(){a(NestedPages.selectors.row).removeClass("active")})},t.toggleDropdown=function(){a("."+t.selectors.caret_up).attr("class",t.selectors.caret_down);var e=a(t.dropdown).find(t.dropdownContent);if(t.activeContent=e,a(e).hasClass("active"))return a(e).removeClass("active"),a(t.activeBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),void a(document).trigger("dropdown-closed",e);t.setPositioning(),a(t.toggleBtn).removeClass("active"),a(t.dropdownContent).removeClass("active"),a(e).addClass("active"),a(t.activeBtn).find("."+t.selectors.caret_down).attr("class",t.selectors.caret_up),a(t.activeBtn).addClass("active"),a(document).trigger("dropdown-opened",e)},t.setPositioning=function(){var e=a(t.activeBtn).outerHeight();a(t.activeContent).css("top",e+"px")},t.closeDropdowns=function(e){0===a(e).parents(t.dropdownContainer).length&&(a(t.dropdownContent).removeClass("active"),a(t.toggleBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),a(document).trigger("dropdown-closed",void 0))},t.bindEvents()},(NestedPages=NestedPages||{}).Modals=function(){var a=this,s=jQuery;return a.activeBtn="",a.activeModal="",a.modalOpen=!1,a.selectors={toggleBtn:"[data-nestedpages-modal-toggle]",backdrop:"[data-nestedpages-modal-backdrop]",closeBtn:"[data-nestedpages-modal-close]",title:"data-nestedpages-modal-title",content:"data-nestedpages-modal-content"},a.bindEvents=function(){s(document).on("click",a.selectors.toggleBtn,function(e){e.preventDefault(),a.activeBtn=s(this),a.openModal()}),s(document).on("click",a.selectors.closeBtn,function(e){e.preventDefault(),a.closeModals()}),s(document).on("open-modal-manual",function(e,t){a.activeModal=s('[data-nestedpages-modal="'+t+'"]'),a.openModal()}),s(document).on("close-modal-manual",function(e){a.closeModals()}),s(document).on("click",a.selectors.backdrop,function(e){a.closeModals()}),s(document).ready(function(){a.checkHash()})},a.openModal=function(){var e;a.modalOpen?a.closeModals():(0<s(a.activeBtn).length&&(e=s(a.activeBtn).attr("data-nestedpages-modal-toggle"),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]')),s(a.activeModal).addClass("active"),a.modalOpen=!0,a.populateModal(),s(document).trigger("open-modal",[a.activeBtn,a.activeModal]))},a.closeModals=function(){a.modalOpen=!1,s("[data-nestedpages-modal]").removeClass("active"),a.activeModal="",a.activeBtn=""},a.populateModal=function(){var e=s(a.activeBtn).attr(a.selectors.title);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-title]").text(e);e=s(a.activeBtn).attr(a.selectors.content);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(e)},a.checkHash=function(){var e;window.location.hash&&"#modal"===window.location.hash.substring(0,6)&&(e=window.location.hash.substring(7),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal())},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var a=this,s=jQuery;return a.activeCheckbox="",a.selectors={checkbox:"[data-np-check-all]"},a.bindEvents=function(){s(document).on("change",a.selectors.checkbox,function(){a.activeCheckbox=s(this),a.toggleCheckboxes()}),s(document).on("change","input[type=checkbox]",function(){a.checkAllStatus(s(this))})},a.init=function(){a.bindEvents()},a.toggleCheckboxes=function(){var t=!!s(a.activeCheckbox).is(":checked"),e=s(a.activeCheckbox).attr("data-np-check-all"),e=s('*[name="'+e+'"]');s.each(e,function(){var e=s(this).parents(NestedPages.selectors.rows);s(this).prop("checked",t),s(e).hasClass("np-hide")&&!s(e).is(":visible")&&s(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),a.toggleCheckAll()},a.toggleCheckAll=function(){var e=s(a.activeCheckbox).attr("data-np-check-all"),t=(t=s('*[name="'+e+'"]').length)-s(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+s(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length,e=s('*[name="'+e+'"]:checked').length;if(t==e)return s(a.activeCheckbox).prop("checked",!0),void s(a.activeCheckbox).removeClass("check-all-partial");0<e?s(a.activeCheckbox).addClass("check-all-partial"):(s(a.activeCheckbox).attr("checked",!1),s(a.activeCheckbox).removeClass("check-all-partial"))},a.checkAllStatus=function(e){e=s(e).attr("name"),e=s('*[data-np-check-all="'+e+'"]');0!==e.length&&(a.activeCheckbox=s(e)[0],a.toggleCheckAll())},a.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var n=this,o=jQuery;return n.selectedNumber=0,n.selectedLinks=[],n.selectedPosts=[],n.bindEvents=function(){o(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){n.toggleBulkForm()}),o(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===o("select[name=np_bulk_action]").val()&&(e.preventDefault(),n.toggleBulkEdit(!0))}),o(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();e=o(this).siblings("input[type=hidden]").val();n.uncheckBulkItem(e)}),o(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),n.uncheckAllBulkItems()})},n.toggleBulkForm=function(){var t=!1,a="",s="";if(n.selectedPosts=[],n.selectedLinks=[],o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){var e;o(this).is(":checked")&&(e=o(this).parents(NestedPages.selectors.rows),t=!0,o(this).parent("div").hasClass("np-check-all")||o(e).hasClass("post-type-np-redirect")||(a+=o(this).val()+","),o(e).hasClass("post-type-np-redirect")&&(s+=o(this).val()+",",n.selectedLinks.push(o(this).val())),"np-redirect"===o(this).attr("data-np-post-type")||o(this).parent("div").hasClass("np-check-all")||((e=[]).title=o(this).attr("data-np-bulk-checkbox"),e.id=o(this).val(),n.selectedPosts.push(e)))}),n.setBulkEditPosts(),n.toggleEditOption(),n.toggleLinkCountAlert(),t)return o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkActionsIds).val(a),o(NestedPages.selectors.bulkActionRedirectIds).val(s),void n.setSelectedNumber();o(NestedPages.selectors.bulkActionsIds).val(""),o(NestedPages.selectors.bulkActionsForm).hide()},n.setBulkEditPosts=function(){for(var e="",t=0;t<n.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>&times;</a>',e+=n.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+n.selectedPosts[t].id+'"></li>';o(NestedPages.selectors.bulkEditTitles).html(e)},n.uncheckBulkItem=function(e){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).val()==e&&o(this).prop("checked",!1).change()}),0===o(NestedPages.selectors.bulkEditRemoveItem).length&&n.toggleBulkEdit(!1)},n.uncheckAllBulkItems=function(){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).prop("checked",!1).change()}),n.toggleBulkEdit(!1)},n.setSelectedNumber=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option").first();o(t).text(nestedpages.bulk_actions+" ("+e+")")},n.toggleEditOption=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return o(t).prop("disabled",!0),o(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void n.toggleBulkEdit(!1);o(t).prop("disabled",!1)},n.toggleBulkEdit=function(e){if(n.toggleLinkCountAlert(),e)return n.disableParentOptions(),o(NestedPages.selectors.bulkEditForm).show(),o(NestedPages.selectors.bulkActionsForm).hide(),void n.setWPSuggest();o(NestedPages.selectors.bulkEditForm).hide(),o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),o(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),n.resetBulkEditFields()},n.toggleLinkCountAlert=function(){0!==n.selectedLinks.length?o(NestedPages.selectors.bulkEditLinkCount).parent("div").show():o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},n.disableParentOptions=function(){for(var e=o(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<n.selectedPosts.length;t++)o(e).find("option[value="+n.selectedPosts[t].id+"]").attr("disabled",!0)},n.setWPSuggest=function(){var e=o(NestedPages.selectors.bulkEditForm).find("[data-autotag]");o.each(e,function(e,t){var a=o(this).attr("data-taxonomy");o(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},n.resetBulkEditFields=function(){var e=o(NestedPages.selectors.bulkEditForm).find("select");o.each(e,function(){o(this).find("option").first().prop("selected",!0),o(this).find("option").removeAttr("disabled")});e=o(NestedPages.selectors.bulkEditForm).find(".cat-checklist");o.each(e,function(){o(this).find("input[type=checkbox]").prop("checked",!1)})},n.bindEvents()},(NestedPages=NestedPages||{}).HiddenItemCount=function(){var e=this,a=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){a(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var t=0;a.each(a(NestedPages.selectors.bulkActionsCheckbox),function(){var e;a(this).is(":checked")&&(a(this).parent("div").hasClass("np-check-all")||(e=a(this).closest(".page-row"),a(e).is(":visible")||t++))}),t<1?a(NestedPages.selectors.hiddenItemCountParent).hide():(a(NestedPages.selectors.hiddenItemCount).text(t),a(NestedPages.selectors.hiddenItemCountParent).show())},e.init()},(NestedPages=NestedPages||{}).MenuToggle=function(){var a=this,n=jQuery;return a.formatter=new NestedPages.Formatter,a.bindEvents=function(){n(document).on("click",NestedPages.selectors.childToggleLink,function(e){e.preventDefault(),a.toggleSingleMenu(n(this))}),n(document).on("click",NestedPages.selectors.toggleAll,function(e){e.preventDefault(),a.toggleAllMenus()})},a.toggleSingleMenu=function(e){var t=n(e).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");n(e).toggleClass("open"),n(t).toggle(),a.formatter.setBorders(),a.formatter.setNestedMargins(),a.syncUserToggles()},a.toggleAllMenus=function(){var e=NestedPages.selectors.toggleAll;if("closed"===n(e).attr("data-toggle"))return n(NestedPages.selectors.lists).show(),n(e).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),n(NestedPages.selectors.childToggle+" a").addClass("open"),a.formatter.setBorders(),void a.syncUserToggles();n(NestedPages.selectors.lists).not(n(NestedPages.selectors.lists)[0]).hide(),n(e).attr("data-toggle","closed").text(NestedPages.jsData.expandText),n(NestedPages.selectors.childToggle+" a").removeClass("open"),a.formatter.setBorders(),a.syncUserToggles()},a.visibleRowIDs=function(){var s=[],e=n(NestedPages.selectors.rows+":visible");return n.each(e,function(e,t){var a=n(this).attr("id");s.push(a.replace("menuItem_",""))}),s},a.syncUserToggles=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:a.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},a.bindEvents()},(NestedPages=NestedPages||{}).PageToggle=function(){var a=this,s=jQuery;return a.activeButton="",a.formatter=new NestedPages.Formatter,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.toggleHidden,function(e){e.preventDefault(),a.activeButton=s(this),a.toggleHidden()}),s(document).on("click",NestedPages.selectors.toggleStatus,function(e){e.preventDefault(),a.toggleStatus(s(this))})},a.toggleHidden=function(){var e=s(a.activeButton),t=s(e).attr("href");if("#show"==t)return s(e).attr("href","#hide").text(NestedPages.jsData.showHiddenText),s(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),a.formatter.updateSubMenuToggle(),void a.formatter.setBorders();"#hide"==t&&(s(e).attr("href","#show").text(NestedPages.jsData.hideHiddenText),s(NestedPages.selectors.hiddenRows).addClass("shown").show(),a.formatter.updateSubMenuToggle(),a.formatter.setBorders())},a.toggleStatus=function(e){var t=(t=s(e).attr("href")).substring(1);s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),a.saveStatusPreference(t),"draft"==t&&(s(NestedPages.selectors.syncCheckbox).attr("disabled",!0),s("."+t).addClass("nested-visible")),"all"!=t?(s(NestedPages.selectors.rows).hide(),s("."+t).show()):s(NestedPages.selectors.rows).show()},a.saveStatusPreference=function(e){s.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.toggleStatusDisplay,nonce:NestedPages.jsData.nonce,status:e,post_type:NestedPages.jsData.posttype}})},a.bindEvents()},(NestedPages=NestedPages||{}).Nesting=function(){var n=this,o=jQuery;n.formatter=new NestedPages.Formatter,n.initializeSortable=function(){if(!NestedPages.jsData.nestable)return n.initializeSortableFlat();o(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",tabSize:56,isAllowed:function(e,t,a){return!(o(t).hasClass("post-type-np-redirect")&&!o(a).hasClass("post-type-np-redirect"))},start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})},n.initializeSortableFlat=function(){var e=o(NestedPages.selectors.lists).not(NestedPages.selectors.notSortable);o.each(e,function(){o(this).sortable({items:">"+NestedPages.selectors.rows,handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",forcePlaceholderSize:!0,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})})},n.disableNesting=function(){o(NestedPages.selectors.sortable).sortable("destroy")},n.syncNesting=function(e,t){var a,s;"1"===nestedpages.manual_order_sync&&!e||(o(NestedPages.selectors.errorDiv).hide(),o(NestedPages.selectors.loadingIndicator).show(),s=!!o(NestedPages.selectors.lists).first().hasClass("filtered"),a=NestedPages.jsData.nestable&&!s?o(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):n.setNestingArray(),n.disableNesting(),e=NestedPages.jsData.syncmenu,"1"===nestedpages.manual_menu_sync&&(e="nosync"),o.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:a,post_type:NestedPages.jsData.posttype,syncmenu:e,filtered:s},success:function(e,t){n.initializeSortable(),"error"===e.status?(o(NestedPages.selectors.errorDiv).text(e.message).show(),o(NestedPages.selectors.loadingIndicator).hide()):t&&"function"==typeof t?t():o(NestedPages.selectors.loadingIndicator).hide()}}))},n.setNestingArray=function(e){return ret=[],o(NestedPages.selectors.lists).first().children("li.page-row").each(function(){var e=n.recursiveNesting(this);ret.push(e)}),ret},n.recursiveNesting=function(e){var t,a=o(e).attr("id");if(a)return a=a.replace("menuItem_",""),t={id:a},0<o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).length&&(t.children=[],o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).each(function(){var e=n.recursiveNesting(this);t.children.push(e)})),t}},(NestedPages=NestedPages||{}).SyncMenuSetting=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.init=function(){t.bindEvents()},t.bindEvents=function(){e(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&t.syncSetting()}),e(document).on("change",NestedPages.selectors.syncCheckbox,function(){t.syncSetting()})},t.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==e(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=e(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",e.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncMenu,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:NestedPages.jsData.syncmenu},success:function(e){"error"===e.status&&t.formatter.showAjaxError(e.message)},error:function(e){console.log(e)}}))},t.bindEvents()},(NestedPages=NestedPages||{}).NewPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.parent_id=0,r.posts="",r.form="",r.bindEvents=function(){d(document).on("open-modal",function(e,t,a){t=d(t).attr("data-nestedpages-modal-toggle");void 0!==t&&"np-bulk-modal"==t&&r.openModal()}),d(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),d(document).on("click",NestedPages.selectors.newPageSubmitButton,function(e){e.preventDefault(),r.submitForm(d(this))}),d(document).on("click",NestedPages.selectors.newPageTitle,function(e){e.preventDefault(),r.addTitleField(d(this))}),d(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(e){e.preventDefault(),r.removeTitleField(d(this))}),d(document).on("click",NestedPages.selectors.addChildButton,function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click",NestedPages.selectors.cancelNewChildButton,function(e){e.preventDefault(),r.cancelNewPage()}),d(document).on("click","["+NestedPages.selectors.newBeforeButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click","["+NestedPages.selectors.newAfterButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("keydown",function(e){27===e.keyCode&&(r.cancelNewPage(),d(document).click())})},r.openModal=function(){var e=d(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);d(e).addClass("in-modal"),d(NestedPages.selectors.newPageModal).find(".modal-body").html(e),d(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),d(NestedPages.selectors.newPageModal).find(".page_parent_id").val(r.parent_id),d(e).find(".np_title").first().focus(),d(e).find(NestedPages.selectors.newPageTitle).first().prop("tabindex","2")},r.openQuickEdit=function(e){var t,a=void 0!==(a=d(e).attr(NestedPages.selectors.newBeforeButton))&&""!==a&&a,s=void 0!==(s=d(e).attr(NestedPages.selectors.newAfterButton))&&""!==s&&s,n=d(e).closest(NestedPages.selectors.row).parent("li"),o=d(NestedPages.selectors.newPageFormContainer).clone();0<d(n).children("ol").length?(t=d(n).children("ol"),d(o).insertBefore(t)):d(o).appendTo(n),d(o).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(o).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),a||s||d(o).find(".page_parent_id").val(d(e).attr("data-id")),a&&(d(o).find(".page_before_id").val(a),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),s&&(d(o).find(".page_after_id").val(s),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(o).show(),d(o).find(".np_title").focus(),d(o).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},r.cancelNewPage=function(){r.formatter.removeQuickEdit(),d(NestedPages.selectors.newChildError).hide(),d(NestedPages.selectors.newPageModal).find(".modal-body").empty(),d(NestedPages.selectors.sortable).find(".new-child").remove(),d(NestedPages.selectors.row).show()},r.addTitleField=function(e){var t=d(e).parents("form"),a=d(e).siblings(".new-page-titles").children("li").length+1,s='<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg><div class="form-control new-child-row"><label>'+NestedPages.jsData.titleText+'</label><div><input type="text" name="post_title[]" class="np_title" placeholder="'+NestedPages.jsData.titleText+'" value="" tabindex="'+a+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';d(e).siblings(".new-page-titles").append(s);d(t).find(".np_title").last().focus(),d(t).find(NestedPages.selectors.newPageTitle).prop("tabindex",+a),d(".new-page-titles").sortable({items:"li",handle:".handle"}),r.toggleAddEditButton(t)},r.removeTitleField=function(e){var t=d(e).parents("form");d(e).parents(".new-child-row").parent("li").remove(),r.toggleAddEditButton(t)},r.submitForm=function(e){r.toggleLoading(!0),r.form=d(e).parents("form");var t=!!d(e).hasClass("add-edit"),e=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(e=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(e=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+e+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){if("error"===e.status)return r.toggleLoading(!1),void d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show();!0!=t?(r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()):(e=(e=e.new_pages[0].edit_link).replace(/&amp;/g,"&"),window.location.replace(e))},error:function(e){console.log(e),r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},r.addPosts=function(){var e,t=""!==(t=d(r.form).find(".page_before_id").val())&&t,a=""!==(a=d(r.form).find(".page_after_id").val())&&a,s=d(r.form).parent(".new-child").parent(".page-row");for(0!==d(s).children("ol").length||t||a||d(s).append('<ol class="nplist"></ol>'),e=d(r.form).hasClass("in-modal")?d(".nplist.sortable li.page-row:first"):d(s).children("ol"),i=0;i<r.posts.length;i++)r.appendRows(e,r.posts[i],t,a);t||a||d(e).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n,o='<li id="menuItem_'+t.id+'" class="page-row';"publish"===t.status&&(o+=" published"),o+='">',NestedPages.jsData.hierarchical?(o+='<div class="row">',o+='<div class="child-toggle"></div>'):(o+='<div class="row non-hierarchical">',o+='<div class="non-hierarchical-spacer"></div>'),o+='<div class="row-inner">',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',o+='<a href="'+t.edit_link+'" class="page-link page-title">',o+='<span class="title">'+t.title+"</span>","Publish"!==t.status?o+='<span class="status">('+t.status+")</span>":o+='<span class="status"></span>',o+='<span class="nav-status">',"hide"===t.np_nav_status&&(o+=" "+nestedpages.hidden),o+="</span>",o+='<span class="edit-indicator">Edit</span>',o+="</a>",NestedPages.jsData.hierarchical||(o+='<div class="np-post-columns">',o+='<ul class="np-post-info">',o+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",o+="<li>"+t.date_formatted+"</li>",o+="</ul>",o+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(o+='<span class="np-seo-indicator na"></span>'),o+='<div class="action-buttons">',o+='<div class="nestedpages-dropdown" data-dropdown><a href="#" class="np-btn has-icon toggle" data-dropdown-toggle><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></a><ul class="nestedpages-dropdown-content" data-dropdown-content>',o+='<li><a href="#" class="open-redirect-modal" data-parentid="'+t.id+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'+nestedpages.add_link+"</a></li>",o+='<li><a href="#" class="add-new-child" data-id="'+t.id+'" data-parentname="'+t.title+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'+nestedpages.add_child_short+"</a></li>",o+="</ul></div>",o+='<a href="#" class="np-btn np-quick-edit" data-id="'+t.id+'" data-template="'+t.page_template+'" data-title="'+t.title+'" data-slug="'+t.slug+'" data-commentstatus="closed" data-status="'+t.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+t.author+'" data-template="'+t.template+'" data-month="'+t.month+'" data-day="'+t.day+'" data-year="'+t.year+'" data-hour="'+t.hour+'" data-minute="'+t.minute+'" data-datepicker="'+t.datepicker+'" data-time="'+t.time+'" data-formattedtime="'+t.formattedtime+'" data-ampm="'+t.ampm+'">'+nestedpages.quick_edit+"</a>",o+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",o+='<a href="'+t.delete_link+'" class="np-btn np-btn-trash"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-remove"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" class="icon"/><path d="M0 0h24v24H0z" fill="none"/></svg></a>',o+="</div>\x3c!-- .action-buttons --\x3e",o+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",o+="</li>",a?(n=r.findRowById(a),d(o).insertBefore(n)):s?(n=r.findRowById(s),d(o).insertAfter(n)):d(e).append(o)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){e=d(e).find(".np_title").length;e<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<e?d(NestedPages.selectors.newPageSubmitButton+".add-edit").hide():d(NestedPages.selectors.newPageSubmitButton+".add-edit").show())},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.button="",r.initialData="",r.parent_li="",r.form="",r.flatTerms="",r.termNames="",r.saveButton="",r.newData="",r.row="",r.bindEvents=function(){d(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),r.button=d(this),r.openForm()}),d(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),r.formatter.removeQuickEdit()}),d(document).on("change",".keep_private",function(){this.checked?d(".post_password").val("").prop("readonly",!0):d(".post_password").prop("readonly",!1)}),d(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),r.saveButton=d(this),r.save()}),d(document).on("keydown",function(e){27===e.keyCode&&r.formatter.removeQuickEdit()})},r.openForm=function(){r.setInitialData(),r.createForm(),r.populateForm(),r.populateFlatTaxonomies()},r.setInitialData=function(){r.initialData={id:d(r.button).attr("data-id"),title:d(r.button).attr("data-title"),slug:d(r.button).attr("data-slug"),author:d(r.button).attr("data-author"),cs:d(r.button).attr("data-commentstatus"),status:d(r.button).attr("data-status"),template:d(r.button).attr("data-template"),month:d(r.button).attr("data-month"),day:d(r.button).attr("data-day"),year:d(r.button).attr("data-year"),hour:d(r.button).attr("data-hour"),minute:d(r.button).attr("data-minute"),navstatus:d(r.button).attr("data-navstatus"),navCustomUrl:d(r.button).attr("data-custom-url"),npstatus:d(r.button).attr("data-np-status"),navtitle:d(r.button).attr("data-navtitle"),navtitleattr:d(r.button).attr("data-navtitleattr"),navcss:d(r.button).attr("data-navcss"),linktarget:d(r.button).attr("data-linktarget"),password:d(r.button).attr("data-password"),datepicker:d(r.button).attr("data-datepicker"),time:d(r.button).attr("data-formattedtime"),timeTwentyFour:d(r.button).attr("data-time"),ampm:d(r.button).attr("data-ampm"),timeFormat:d(r.button).attr("data-timeformat"),sticky:d(r.button).attr("data-sticky")};var e=d(r.button)[0].attributes;d.each(e,function(e,t){t.name.includes("data-npcustom")&&(r.initialData[t.name]=t.value)}),r.initialData.h_taxonomies=[],r.initialData.f_taxonomies=[],r.parent_li=d(r.button).closest(NestedPages.selectors.row).parent("li");var t=d(r.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&r.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&r.initialData.f_taxonomies.push(t[i])},r.createForm=function(){var e;r.form=d(NestedPages.selectors.quickEditPostForm).clone(),0<d(r.parent_li).children("ol").length?(e=d(r.parent_li).children("ol"),d(r.form).insertBefore(e)):d(r.form).appendTo(r.parent_li),d(r.form).siblings(NestedPages.selectors.row).hide(),d(r.form).show()},r.populateForm=function(){for(var e in d(r.form).find(".page_id").html("<em>ID:</em> "+r.initialData.id),d(r.form).find(".np_id").val(r.initialData.id),d(r.form).find(".np_title").val(r.initialData.title),d(r.form).find(".np_slug").val(r.initialData.slug),d(r.form).find(".np_author select").val(r.initialData.author),d(r.form).find(".np_status").val(r.initialData.status),d(r.form).find(".np_nav_title").val(r.initialData.navtitle),d(r.form).find(".np_nav_css_classes").val(r.initialData.navcss),d(r.form).find(".np_title_attribute").val(r.initialData.navtitleattr),d(r.form).find(".np_nav_custom_url").val(r.initialData.navCustomUrl),d(r.form).find(".post_password").val(r.initialData.password),d(r.form).find(".np_publish_date").val(r.initialData.datepicker),"open"===r.initialData.cs&&d(r.form).find(".np_cs").attr("checked","checked"),""!==r.initialData.template?d(r.form).find(".np_template").val(r.initialData.template):d(r.form).find(".np_template").val("default"),"private"===r.initialData.status&&(d(r.form).find(".post_password").attr("readonly",!0),d(r.form).find(".keep_private").attr("checked",!0)),"hide"===r.initialData.npstatus?d(r.form).find(".nested_pages_status").attr("checked","checked"):d(r.form).find(".nested_pages_status").removeAttr("checked"),"hide"===r.initialData.navstatus?d(r.form).find(".np_nav_status").attr("checked","checked"):d(r.form).find(".np_nav_status").attr("checked",!1),"_blank"===r.initialData.linktarget?d(r.form).find(".link_target").attr("checked","checked"):d(r.form).find(".link_target").attr("checked",!1),"private"===r.initialData.status&&d(r.form).find(".np_status").val("publish"),"sticky"===r.initialData.sticky?d(r.form).find(".np-sticky").attr("checked","checked"):d(r.form).find(".np-sticky").removeAttr("checked"),"H:i"===r.initialData.timeFormat?d(r.form).find(".np_time").val(r.initialData.timeTwentyFour):(d(r.form).find(".np_time").val(r.initialData.time),d(r.form).find(".np_ampm").val(r.initialData.ampm),d(r.form).find('select[name="mm"]').val(r.initialData.month),d(r.form).find('input[name="jj"]').val(r.initialData.day),d(r.form).find('input[name="aa"]').val(r.initialData.year),d(r.form).find('input[name="hh"]').val(r.initialData.hour),d(r.form).find('input[name="mn"]').val(r.initialData.minute)),r.initialData){var t;e.includes("npcustom")&&r.initialData.hasOwnProperty(e)&&(t=(t=e.replace("data-npcustom-","")).toLowerCase(),d(r.form).find('[data-np-custom-field="'+t+'"]').val(r.initialData[e]))}if(r.populateFlatTaxonomies(),r.initialData.hasOwnProperty("h_taxonomies")){var a=r.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];d(r.form).find(s).attr("checked","checked")}}var n=d(r.form).find(".np_datepicker");d.each(n,function(){var e=d(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){d("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),r.formatter.showQuickEdit(),d(r.form).show()},r.populateFlatTaxonomies=function(){r.initialData.hasOwnProperty("f_taxonomies")&&(r.createTaxonomyObject(),r.getTermNames(),r.setWPSuggest())},r.createTaxonomyObject=function(){var e={};for(i=0;i<r.initialData.f_taxonomies.length;i++){var t=r.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),a=(a=a.splice(s+1)).join("-"),s=t.split("-").splice(0,s);s.shift("inf");s=s.join("-");s in e||(e[s]=[]),e[s].push(a)}r.flatTerms=e},r.getTermNames=function(){d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:r.flatTerms},success:function(e){r.termNames=e.terms,r.populateFlatTaxonomyFields()}})},r.populateFlatTaxonomyFields=function(){r.termNames&&d.each(r.termNames,function(e,t){e=d("#"+e+"-quickedit");d(e).val(t.join(","))})},r.setWPSuggest=function(){var e=d(r.form).find("[data-autotag]");d.each(e,function(e,t){var a=d(this).attr("data-taxonomy");d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},r.save=function(){r.toggleLoading(!0),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(r.toggleLoading(!1),r.newData=e.post_data,r.updatePostRow())},error:function(e){console.log(e)}})},r.updatePostRow=function(){r.row=d(r.button).parents(".row-inner"),d(r.row).find(".title").text(r.newData.post_title),d(r.row).find(".np-view-button").attr("href",r.newData.permalink);var e,t=d(r.row).find(".status");"publish"!==r.newData._status&&"future"!==r.newData._status?(e=nestedpages.post_statuses[r.newData._status].label,d(t).text("("+e+")")):d(t).text(""),"private"===r.newData.keep_private&&d(t).text(nestedpages.private),""!==r.newData.post_password&&void 0!==r.newData.post_password&&(a=d(t).text(),a+=' <span class="locked">',a+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>',a+="</span>",d(t).html(a));var a=d(r.row).find(".nav-status");"hide"==r.newData.nav_status?d(a).text("(Hidden)"):d(a).text("");a=d(r.row).parent("li");"hide"==r.newData.np_status?(d(a).addClass("np-hide"),d(r.row).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(d(a).removeClass("np-hide"),d(r.row).find(".status-np-hidden").remove());a=d(r.row).find(".sticky");"sticky"==r.newData.sticky?d(a).show():d(a).hide(),NestedPages.jsData.hierarchical||d(r.row).find(".np-author-display").text(r.newData.author_name);var s,n,o=d(r.row).find(NestedPages.selectors.quickEditOpen);for(s in d(o).attr("data-id",r.newData.post_id),d(o).attr("data-template",r.newData.page_template),d(o).attr("data-title",r.newData.post_title),d(o).attr("data-slug",r.newData.post_name),d(o).attr("data-commentstatus",r.newData.comment_status),d(o).attr("data-status",r.newData._status),d(o).attr("data-sticky",r.newData.sticky),"private"===r.newData.keep_private&&d(o).attr("data-status","private"),d(o).attr("data-author",r.newData.post_author),d(o).attr("data-np-status",r.newData.np_status),d(o).attr("data-password",r.newData.post_password),d(o).attr("data-navstatus",r.newData.nav_status),d(o).attr("data-navtitle",r.newData.np_nav_title),d(o).attr("data-linktarget",r.newData.link_target),d(o).attr("data-navtitleattr",r.newData.np_title_attribute),d(o).attr("data-navcss",r.newData.np_nav_css_classes),d(o).attr("data-month",r.newData.mm),d(o).attr("data-day",r.newData.jj),d(o).attr("data-year",r.newData.aa),d(o).attr("data-hour",r.newData.hh),d(o).attr("data-minute",r.newData.mn),d(o).attr("data-datepicker",r.newData.np_date),d(o).attr("data-time",r.newData.np_time),d(o).attr("data-formattedtime",r.newData.np_time),d(o).attr("data-ampm",r.newData.np_ampm),r.newData)s.includes("np_custom")&&r.newData.hasOwnProperty(s)&&(n=s.replace("np_custom_","data-npcustom-"),d(o).attr(n,r.newData[s]));r.removeTaxonomyClasses(),r.addCategoryClasses(),r.addHierarchicalClasses(),r.addFlatClasses(),r.addStatusClass(),r.formatter.removeQuickEdit(),r.formatter.flashRow(r.row)},r.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)d(r.row).removeClass(e[i]);d(r.row).addClass(r.newData._status)},r.removeTaxonomyClasses=function(){taxonomies=[];var e=d(r.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&d(r.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&d(r.row).removeClass(e[i])},r.addCategoryClasses=function(){if(r.newData.hasOwnProperty("post_category")){var e=r.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];d(r.row).addClass(t)}}},r.addHierarchicalClasses=function(){var e;r.newData.hasOwnProperty("tax_input")&&(e=r.newData.tax_input,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];d(r.row).addClass(a)}}))},r.addFlatClasses=function(){var e;r.newData.hasOwnProperty("flat_tax")&&(e=r.newData.flat_tax,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];d(r.row).addClass(a)}}))},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(r.saveButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(r.saveButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.button="",a.postData="",a.newPostData="",a.form="",a.bindEvents=function(){s(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),a.formatter.removeQuickEdit(),a.button=s(this),a.openQuickEdit()}),s(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&a.formatter.removeQuickEdit()})},a.openQuickEdit=function(){a.setData(),a.createForm(),a.populateForm()},a.setData=function(){a.postData={id:s(a.button).attr("data-id"),url:s(a.button).attr("data-url"),title:s(a.button).attr("data-title"),status:s(a.button).attr("data-status"),navstatus:s(a.button).attr("data-navstatus"),npstatus:s(a.button).attr("data-np-status"),linktarget:s(a.button).attr("data-linktarget"),parentid:s(a.button).attr("data-parentid"),navtitleattr:s(a.button).attr("data-navtitleattr"),navcss:s(a.button).attr("data-navcss"),navtype:s(a.button).attr("data-nav-type"),navobject:s(a.button).attr("data-nav-object"),navobjectid:s(a.button).attr("data-nav-object-id"),navoriginallink:s(a.button).attr("data-nav-original-link"),navoriginaltitle:s(a.button).attr("data-nav-original-title")}},a.createForm=function(){var e,t=s(a.button).closest(NestedPages.selectors.row).parent("li");a.form=s(NestedPages.selectors.quickEditLinkForm).clone(),0<s(t).children("ol").length?(e=s(t).children("ol"),s(a.form).insertBefore(e)):s(a.form).appendTo(t);s(a.form).siblings(NestedPages.selectors.row).hide()},a.populateForm=function(){var e;s(a.form).find(".np_id").val(a.postData.id),s(a.form).find(".np_title").val(a.postData.title),s(a.form).find(".np_author select").val(a.postData.author),s(a.form).find(".np_status").val(a.postData.status),s(a.form).find(".np_content").val(a.postData.url),s(a.form).find(".np_parent_id").val(a.postData.parentid),s(a.form).find(".np_title_attribute").val(a.postData.navtitleattr),s(a.form).find(".np_nav_css_classes").val(a.postData.navcss),"hide"===a.postData.npstatus?s(a.form).find(".np_status").prop("checked","checked"):s(a.form).find(".np_status").removeAttr("checked"),"hide"===a.postData.navstatus?s(a.form).find(".np_nav_status").prop("checked","checked"):s(a.form).find(".np_nav_status").removeAttr("checked"),"_blank"===a.postData.linktarget?s(a.form).find(".link_target").prop("checked","checked"):s(a.form).find(".link_target").removeAttr("checked"),"custom"!==a.postData.navobject&&""!==a.postData.navobject?(e='<div class="form-control original-link">Original: <a href="'+a.postData.navoriginallink+'" target="_blank">'+a.postData.navoriginaltitle+"</a></div>",s(a.form).find("[data-url-field]").remove(),s(e).insertAfter(s(a.form).find("h3")),s(a.form).find("[data-np-menu-object-input]").val(a.postData.navobject),s(a.form).find("[data-np-menu-objectid-input]").val(a.postData.navobjectid),s(a.form).find("[data-np-menu-type-input]").val(a.postData.navtype),s(a.form).find("h3").text("Link: "+a.postData.navoriginaltitle)):(s(a.form).find("h3").text("Link"),s(a.form).find("[data-np-menu-object-input]").val("custom"),s(a.form).find("[data-np-menu-type-input]").val("custom")),a.formatter.showQuickEdit(),s(a.form).show()},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:s(a.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(a.toggleLoading(!1),a.newPostData=e.post_data,a.updateRow())},error:function(e){a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},a.updateRow=function(){var e=s(a.form).siblings(".row");s(e).find(".title").html(a.newPostData.post_title+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>');var t=s(e).find(".status");"publish"!==a.newPostData._status&&"future"!==a.newPostData._status?s(t).text("("+a.newPostData._status+")"):s(t).text("");t=s(e).find(".nav-status");"hide"==a.newPostData.nav_status?s(t).text("("+NestedPages.jsData.hiddenText+")"):s(t).text("");t=s(e).parent("li");"hide"==a.newPostData.np_status?(s(t).addClass("np-hide"),s(e).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(s(t).removeClass("np-hide"),s(e).find(".status-np-hidden").remove());t=s(e).find(NestedPages.selectors.quickEditButtonLink);s(t).attr("data-id",a.newPostData.post_id),s(t).attr("data-title",a.newPostData.post_title),s(t).attr("data-url",a.newPostData.post_content),s(t).attr("data-status",a.newPostData._status),s(t).attr("data-navstatus",a.newPostData.nav_status),s(t).attr("data-np-status",a.newPostData.np_status),s(t).attr("data-linkTarget",a.newPostData.linkTarget),s(t).attr("data-navtitleattr",a.newPostData.titleAttribute),s(t).attr("data-navcss",a.newPostData.cssClasses),a.formatter.removeQuickEdit(),a.formatter.flashRow(e)},a.toggleLoading=function(e){if(s(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return s(NestedPages.selectors.quickEditErrorDiv).hide(),s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void s(NestedPages.selectors.quickEditLoadingIndicator).show();s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),s(NestedPages.selectors.quickEditLoadingIndicator).hide()},a.bindEvents()},(NestedPages=NestedPages||{}).Clone=function(){var t=this,a=jQuery;return t.parent_id="",t.parent_title="",t.parentLi=null,t.formatter=new NestedPages.Formatter,t.bindEvents=function(){a(document).on("click",NestedPages.selectors.cloneButton,function(e){e.preventDefault(),t.parent_id=a(this).attr("data-id"),t.parent_title=a(this).attr("data-parentname"),t.parentLi=a(this).parent(".row").parent(".page-row").parent(".npList"),t.openModal()}),a(document).on("click",NestedPages.selectors.confirmClone,function(e){e.preventDefault(),t.clone()})},t.openModal=function(){a("#"+NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(t.parent_title),a(document).trigger("open-modal-manual",NestedPages.selectors.cloneModal)},t.clone=function(){t.toggleLoading(!0),a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:t.parent_id,quantity:a(NestedPages.selectors.cloneQuantity).val(),status:a(NestedPages.selectors.cloneStatus).val(),author:a(NestedPages.selectors.cloneAuthor).find("select").val(),nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(e){t.toggleLoading(!1),a(document).trigger("close-modal-manual"),location.reload()}})},t.toggleLoading=function(e){if(e)return a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void a(NestedPages.selectors.confirmClone).attr("disabled","disabled");a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),a(NestedPages.selectors.confirmClone).attr("disabled",!1)},t.bindEvents()},(NestedPages=NestedPages||{}).Tabs=function(){var r=this,d=jQuery;return r.selectors={tabToggle:"data-np-tab-toggle",tabPane:"data-np-tab-pane",tabGroup:"data-np-tab-group"},r.bindEvents=function(){d(document).on("click","["+r.selectors.tabToggle+"]",function(e){e.preventDefault(),r.toggleTabs(d(this))})},r.toggleTabs=function(e){for(var t=d(e).attr(r.selectors.tabGroup),a=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabPane+"]"),s=d(e).attr(r.selectors.tabToggle),n=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabToggle+"]"),o=[],i=0;i<n.length;i++)o[i]=d(n[i]).parent("li")[0];d(a).hide(),d(n).removeClass("active"),d(o).removeClass("active"),d.each(a,function(){d(this).attr(r.selectors.tabPane)==s&&d(this).show()}),d.each(n,function(){d(this).attr(r.selectors.tabToggle)==s&&(d(this).addClass("active"),d(this).parent("li").addClass("active"))}),d(document).trigger("tabs-changed",[s,t,e])},r.bindEvents()},jQuery(document).ready(function(){new NestedPages.Factory}),(NestedPages=NestedPages||{}).selectors={childToggle:".child-toggle",childToggleLink:".child-toggle a",toggleAll:".nestedpages-toggleall",toggleHidden:".np-toggle-hidden",toggleStatus:".np-toggle-publish",lists:".nplist",rows:".page-row",row:".row",sortable:".sortable",notSortable:".no-sort",handle:".handle",published:".published",hiddenRows:".np-hide",errorDiv:"#np-error",loadingIndicator:"#nested-loading",syncCheckbox:".np-sync-menu",syncForm:".np-sync-menu-cont",ajaxError:"[data-nestedpages-error]",trashWithChildrenButton:"[data-nestedpages-trash-children]",toggleEditButtons:".np-toggle-edit",bulkActionsHeader:".nestedpages-list-header",bulkActionsForm:"[data-np-bulk-form]",bulkActionsCheckbox:"[data-np-bulk-checkbox]",bulkActionsIds:"[data-np-bulk-ids]",bulkActionRedirectIds:"[data-np-bulk-redirect-ids]",hiddenItemCount:"[data-np-hidden-count]",hiddenItemCountParent:"[data-np-hidden-count-parent]",bulkEditForm:"[data-np-bulk-edit-form]",bulkEditTitles:"[data-np-bulk-titles]",bulkEditRemoveItem:"[data-np-remove-bulk-item]",bulkEditCancel:"[data-np-cancel-bulk-edit]",bulkEditLinkCount:"[data-bulk-edit-link-count]",quickEditOverlay:".np-inline-overlay",quickEditLoadingIndicator:".np-qe-loading",quickEditErrorDiv:".np-quickedit-error",quickEditCancel:".np-cancel-quickedit",quickEditButtonLink:".np-quick-edit-redirect",quickEditLinkForm:".quick-edit-form-redirect",quickEditLinkSaveButton:".np-save-quickedit-redirect",quickEditOpen:".np-quick-edit",quickEditPostForm:".quick-edit-form",quickEditSaveButton:".np-save-quickedit",openLinkModal:".open-redirect-modal",linkModal:"np-link-modal",saveLink:".np-save-link",linkLoadingIndicator:".np-link-loading",linkErrorDiv:".np-new-link-error",linkForm:".np-new-link-form",linkDeleteButton:"[data-np-confirm-delete]",linkDeleteConfirmationButton:"[data-delete-confirmation]",linkDeleteConfirmationModal:"np-delete-confirmation-modal",linkDeleteConfirmationModalText:"[data-np-link-delete-text]",openPageModal:".open-bulk-modal",newPageModal:"#np-bulk-modal",newPageFormContainer:".new-child-form",newPageForm:".np-new-child-form",newPageSubmitButton:".np-save-newchild",newPageTitle:".add-new-child-row",newPageRemoveTitle:".np-remove-child",addChildButton:".add-new-child",newChildError:".np-newchild-error",cancelNewChildButton:".np-cancel-newchild",newBeforeButton:"data-insert-before",newAfterButton:"data-insert-after",cloneButton:".clone-post",confirmClone:"[data-confirm-clone]",cloneModal:"np-clone-modal",cloneQuantity:"[data-clone-quantity]",cloneStatus:"[data-clone-status]",cloneAuthor:"[data-clone-author]",tabButtonParent:"[data-np-tabs]",tabButton:"[data-np-tab]",tabContent:"[data-np-tab-pane]",thumbnailContainer:".np-thumbnail",thumbnailContainerLink:".np-thumbnail.link",manualMenuSync:"[data-np-manual-menu-sync]",manualOrderSync:"[data-np-manual-order-sync]"},NestedPages.cssClasses={noborder:"no-border"},NestedPages.jsData={ajaxurl:ajaxurl,nonce:nestedpages.np_nonce,allPostTypes:nestedpages.post_types,syncmenu:"nosync",posttype:"",nestable:!0,sortable:!0,hierarchical:!0,expandText:nestedpages.expand_text,collapseText:nestedpages.collapse_text,showHiddenText:nestedpages.show_hidden,hideHiddenText:nestedpages.hide_hidden,quickEditText:nestedpages.quick_edit,hiddenText:nestedpages.hidden,titleText:nestedpages.title},NestedPages.formActions={syncToggles:"npnestToggle",syncNesting:"npsort",syncMenu:"npsyncMenu",newPage:"npnewChild",newBeforeAfter:"npnewBeforeAfter",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch",wpmlTranslations:"npWpmlTranslations",resetSettings:"npresetSettings",resetUserPrefs:"npresetUserPreferences",resetAdminMenuSettings:"npresetAdminMenuSettings",trashWithChildren:"nptrashWithChildren",toggleStatusDisplay:"nptoggleStatusDisplay"},NestedPages.Factory=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.dropdowns=new NestedPages.Dropdowns,t.modals=new NestedPages.Modals,t.checkAll=new NestedPages.CheckAll,t.bulkActions=new NestedPages.BulkActions,t.menuToggle=new NestedPages.MenuToggle,t.pageToggle=new NestedPages.PageToggle,t.nesting=new NestedPages.Nesting,t.syncMenuSetting=new NestedPages.SyncMenuSetting,t.newPage=new NestedPages.NewPost,t.quickEditLink=new NestedPages.QuickEditLink,t.quickEditPost=new NestedPages.QuickEditPost,t.clone=new NestedPages.Clone,t.tabs=new NestedPages.Tabs,t.menuLinks=new NestedPages.MenuLinks,t.hiddenItemCount=new NestedPages.HiddenItemCount,t.confirmDelete=new NestedPages.ConfirmDelete,t.manualSync=new NestedPages.ManualSync,t.postSearch=new NestedPages.PostSearch,t.postMove=new NestedPages.MovePost,t.wpml=new NestedPages.Wpml,t.trashWithChildren=new NestedPages.TrashWithChildren,t.init=function(){nestedpages.settings_page||(t.bindEvents(),t.setPostType(),t.setMenuSync(),t.setNestable(),t.setSortable(),t.formatter.updateSubMenuToggle(),t.formatter.setBorders(),t.formatter.setNestedMargins(),t.nesting.initializeSortable())},t.bindEvents=function(){e(document).on("click",NestedPages.selectors.quickEditOverlay,function(e){t.formatter.removeQuickEdit(),t.newPage.cancelNewPage()}),e(document).ready(function(){t.formatter.hideAjaxError(),t.formatter.sizeLinkThumbnails()})},t.setNestable=function(){var a=!1;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&(!0===t.hierarchical&&(a=!0),!0===t.disable_nesting&&(a=!1))}),NestedPages.jsData.nestable=a},t.setSortable=function(){var a=!0;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&void 0!==t.disable_sorting&&""!==t.disable_sorting&&"true"===t.disable_sorting&&(a=!1)}),NestedPages.jsData.sortable=a},t.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,void 0!==NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=e(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},t.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},t.init()},(NestedPages=NestedPages||{}).MenuLinks=function(){var a=this,s=jQuery;return a.typeButton="",a.post="",a.formatter=new NestedPages.Formatter,a.selectors={form:"[data-np-menu-item-form]",typeSelect:"[data-np-menu-selection]",accordion:"[data-np-menu-accordion]",accordionItem:"[data-np-menu-accordion-item]",formPlaceholder:".np-menu-link-object-placeholder",formDetails:".np-menu-link-details",searchResults:"[data-np-search-result]",defaultResults:"[data-default-result]",originalLink:"[data-np-original-link]",saveButton:"[data-np-save-link]",urlInputCont:"[data-np-menu-url-cont]",errorDiv:"[data-np-error]"},a.fields={object:"[data-np-menu-object-input]",objectid:"[data-np-menu-objectid-input]",itemType:"[data-np-menu-type-input]",url:"[data-np-menu-url]",navigationLabel:"[data-np-menu-navigation-label]",titleAttribute:"[data-np-menu-title-attr]",cssClasses:"[data-np-menu-css-classes]",npStatus:"[data-np-menu-np-status]",linkTarget:"[data-np-menu-link-target]",menuTitle:"[data-np-menu-title]",parentPostType:"[data-np-menu-parent-post-type]"},a.search=new NestedPages.MenuSearch,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.openLinkModal,function(e){e.preventDefault(),a.postParent=s(this).attr("data-parentid"),s(a.selectors.form).find(".parent_id").val(s(this).attr("data-parentid")),a.openModal()}),s(document).on("click",a.selectors.accordionItem,function(e){e.preventDefault(),a.accordion(s(this))}),s(document).on("click",a.selectors.typeSelect,function(e){e.preventDefault(),a.typeButton=s(this),a.setLinkType()}),s(document).on("keyup",a.fields.navigationLabel,function(){a.updateTitle()}),s(document).on("click",a.selectors.saveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&s(document).trigger("close-modal-manual")})},a.openModal=function(){s(NestedPages.selectors.linkErrorDiv).hide(),s(NestedPages.selectors.linkModal).find("input").val(""),s(NestedPages.selectors.linkModal).find(".parent_id").val(a.postParent),a.clearForm(),s(a.selectors.accordion).find("ul").hide(),s(a.selectors.typeSelect).removeClass("active"),s(document).trigger("open-modal-manual",NestedPages.selectors.linkModal)},a.accordion=function(e){a.clearForm();var t=s(e).siblings("ul");if(s(t).is(":visible"))return s(e).removeClass("active"),void s(t).slideUp("fast");s(a.selectors.accordionItem).removeClass("active"),s(e).addClass("active"),s(e).parents(a.selectors.accordion).find("ul").slideUp("fast"),s(t).slideDown("fast")},a.setLinkType=function(){s(a.typeButton).hasClass("active")?a.clearForm():(s(a.typeButton).hasClass("np-custom-link")&&(s(a.selectors.accordionItem).removeClass("active"),s(a.selectors.accordion).find("ul").slideUp("fast")),s(a.selectors.formPlaceholder).hide(),a.populateForm())},a.populateForm=function(){s(a.selectors.saveButton).show(),s(a.selectors.typeSelect).removeClass("active"),s(a.typeButton).addClass("active"),s(a.fields.menuTitle).text(s(a.typeButton).text()).val(s(a.typeButton).text()),s(a.selectors.form).find("h3").find("em").text(s(a.typeButton).attr("data-np-object-name")),""!==s(a.typeButton).attr("data-np-permalink")?(s(a.selectors.form).find(a.selectors.urlInputCont).hide(),s(a.selectors.form).find(a.selectors.originalLink).html('<a href="'+s(a.typeButton).attr("data-np-permalink")+'">'+s(a.typeButton).text()+"</a>"),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").show()):(s(a.selectors.form).find(a.selectors.urlInputCont).show(),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").hide()),s(a.fields.object).val(s(a.typeButton).attr("data-np-menu-object")),s(a.fields.objectid).val(s(a.typeButton).attr("data-np-menu-objectid")),s(a.fields.itemType).val(s(a.typeButton).attr("data-np-menu-type")),s(a.selectors.formDetails).show()},a.clearForm=function(){s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.saveButton).hide(),s(a.selectors.formDetails).hide(),s(a.selectors.formPlaceholder).show(),s(a.selectors.form).find("input").not(".parent_id").not(".parent-post-type").val(""),s(a.selectors.form).find(a.fields.linkTarget).val("_blank"),s(a.selectors.form).find('input[type="checkbox"]').attr("checked",!1),s(a.selectors.typeSelect).removeClass("active"),a.search.toggleLoading(!1),s(a.selectors.searchResults).remove(),s(a.selectors.defaultResults).show()},a.updateTitle=function(){var e=s(a.fields.navigationLabel).val(),t=s(a.selectors.form).find("h3").find("span");""!==e?(s(a.fields.menuTitle).val(e),s(t).text(e)):(s(a.fields.menuTitle).val(s(a.typeButton).text()),s(t).text(s(a.typeButton).text()))},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:s(a.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(e){a.toggleLoading(!1),"error"!==e.status?(a.post=e.post_data,a.createRow()):s(a.selectors.form).find(a.selectors.errorDiv).text(e.message).show()},error:function(e){console.log(e)}})},a.createRow=function(){var e='<li id="menuItem_'+a.post.id+'" class="page-row post-type-np-redirect published';e+='">',e+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner">',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',e+='<a href="'+a.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+a.post.menuTitle+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></span>',e+='</a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',e+='data-id="'+a.post.id+'"',e+='data-parentid="'+a.post.parent_id+'"',e+='data-title="'+a.post.menuTitle+'" ',e+='data-url="'+a.post.url+'" ',e+='data-status="publish" ',e+='data-np-status="show" ',e+='data-navstatus="show" ',e+='data-navcss="'+a.post.cssClasses+'" ',e+='data-navtitleattr="'+a.post.titleAttribute+'" ',e+='data-nav-type="'+a.post.menuType+'" ',e+='data-nav-object="'+a.post.objectType+'" ',e+='data-nav-object-id="'+a.post.objectId+'" ',e+='data-nav-original-link="'+a.post.original_link+'" ',e+='data-nav-original-title="'+a.post.original_title+'" ',e+='data-linktarget="'+a.post.link_target+'">',e+=NestedPages.jsData.quickEditText,e+="</a>",e+='<a href="'+a.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',e+="</div></div></div></li>","0"===a.post.parent_id?s(".nplist:first li:first").after(e):a.appendChildRow(e),s(document).trigger("close-modal-manual"),a.row=s("#menuItem_"+a.post.id).find(".row"),a.formatter.flashRow(a.row)},a.appendChildRow=function(e){var t=s("#menuItem_"+a.post.parent_id);0===s(t).children("ol").length?(e='<ol class="sortable nplist" style="display:block;">'+e+"</ol>",s(t).append(e)):s(t).find("ol:first").prepend(e),a.formatter.updateSubMenuToggle()},a.toggleLoading=function(e){if(e)return s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void s(a.selectors.saveButton).attr("disabled","disabled");s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),s(a.selectors.saveButton).attr("disabled",!1)},a.bindEvents()},(NestedPages=NestedPages||{}).MenuSearch=function(){var s=this,n=jQuery;return s.selectors={searchForms:"*[data-np-menu-search]",defaultResults:"[data-default-result]",loadingIndicator:".np-menu-search-loading",noResults:".np-menu-search-noresults",searchType:"data-search-type",searchObject:"data-search-object",searchResults:"[data-np-search-result]"},s.activeForm="",s.results="",s.defaultResults="",s.searchType="",s.searchObject="",s.init=function(){s.bindEvents()},s.bindEvents=function(){n(document).on("keyup",s.selectors.searchForms,function(){s.activeForm=n(this),n(s.selectors.searchResults).remove(),s.performSearch()})},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){s.searchType=n(s.activeForm).attr(s.selectors.searchType),s.searchObject=n(s.activeForm).attr(s.selectors.searchObject),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:n(s.activeForm).val(),searchType:s.searchType,searchObject:s.searchObject},success:function(e){console.log(e),e.results?(s.results=e.results,s.toggleLoading(!1),"post_type"===s.searchType?s.appendPosts():s.appendTaxonomies()):(s.toggleLoading(!1),n(s.activeForm).siblings(s.selectors.noResults).show())}})},s.appendPosts=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.ID+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.singular_name+'" data-np-menu-selection>'+t.post_title+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.appendTaxonomies=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.term_id+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.taxonomy+'" data-np-menu-selection>'+t.name+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).siblings(s.selectors.loadingIndicator);n(s.selectors.noResults).hide(),e?n(t).show():n(t).hide()},s.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPagesTrash=function(){var t=this,a=jQuery;return t.trashButton=".np-empty-trash",t.confirmButton=".np-trash-confirm",t.warningModal="#np-trash-modal",t.errorAlert="#np-error",t.loadingIndicator="#nested-loading",t.trashLinks=".np-trash-links",t.postType=a("#np-trash-posttype").val(),t.nonce=nestedpages.np_nonce,t.formAction="npEmptyTrash",t.bindEvents=function(){a(document).on("click",t.confirmButton,function(e){e.preventDefault(),t.confirmEmpty()})},t.confirmEmpty=function(){t.loading(!0),a(document).trigger("close-modal-manual"),a(t.errorAlert).hide(),t.emptyTrash()},t.emptyTrash=function(){a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:t.formAction,nonce:t.nonce,posttype:t.postType},success:function(e){t.loading(!1),"error"===e.status?a(t.errorAlert).text(e.message).show():(a(t.trashLinks).hide(),a(".notice-dismiss").click())}})},t.loading=function(e){e?a(t.loadingIndicator).show():a(t.loadingIndicator).hide()},t.bindEvents()};(NestedPages=NestedPages||{}).ConfirmDelete=function(){var t=this,a=jQuery;return t.deleteLink="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.linkDeleteButton,function(e){e.preventDefault(),t.confirmSingle(a(this))}),a(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(e){e.preventDefault(),a(this).hasClass("bulk")?t.deleteMultiple():t.deleteSingle()}),a(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){t.confirmMultiple(e)})},t.confirmSingle=function(e){t.deleteLink=a(e).attr("href"),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),a(document).trigger("open-modal-manual",NestedPages.selectors.linkDeleteConfirmationModal)},t.confirmMultiple=function(e){"trash"===a('select[name="np_bulk_action"]').val()&&""!==a(NestedPages.selectors.bulkActionRedirectIds).val()&&(e.preventDefault(),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),a(document).trigger("open-modal-manual",[NestedPages.selectors.linkDeleteConfirmationModal]))},t.deleteMultiple=function(){a(NestedPages.selectors.bulkActionsForm)[0].submit()},t.deleteSingle=function(){window.location.replace(t.deleteLink)},t.bindEvents()},(NestedPages=NestedPages||{}).ManualSync=function(){var t=this,a=jQuery;return t.activeBtn="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.manualMenuSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncMenu()}),a(document).on("click",NestedPages.selectors.manualOrderSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncOrder()})},t.syncMenu=function(){t.loading(!0),a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.manualMenuSync,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:"sync"},success:function(e){"error"===e.status?(a(NestedPages.selectors.errorDiv).text(e.message).show(),a(NestedPages.selectors.loadingIndicator).hide()):t.loading(!1)}})},t.syncOrder=function(){t.loading(!0),(new NestedPages.Nesting).syncNesting(!0,t.loading(!1))},t.loading=function(e){if(e)return a(t.activeBtn).addClass("disabled"),void a(NestedPages.selectors.loadingIndicator).show();a(t.activeBtn).removeClass("disabled"),a(NestedPages.selectors.loadingIndicator).hide()},t.bindEvents()},(NestedPages=NestedPages||{}).PostSearch=function(){var s=this,n=jQuery;return s.selectors={input:"data-nestedpages-post-search",form:"data-nestedpages-post-search-form",loadingIndicator:"data-nestedpages-loading",noResults:"data-nestedpages-no-results",results:"data-nestedpages-search-results"},s.changed=!1,s.activeInput="",s.results="",s.defaultResults="",s.postType="",s.activeForm="",s.bindEvents=function(){n("["+s.selectors.input+"]").on("input",function(){return s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val()?(n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults()):void s.query()})},s.setDefaultResults=function(){s.defaultResults=n(s.activeForm).find("["+s.selectors.results+"]").html(),s.changed=!0},s.showDefaultResults=function(){n(s.activeForm).find("["+s.selectors.results+"]").html(s.defaultResults)},s.setOptions=function(){s.postType=n(s.activeInput).attr(s.selectors.input),s.activeForm=n(s.activeInput).parents("["+s.selectors.form+"]")},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){n(s.activeForm).find("["+s.selectors.results+"]").empty(),s.toggleLoading(!0),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:n(s.activeInput).val(),postType:s.postType},success:function(e){e.results?(s.results=e.results,s.loadResults(),s.toggleLoading(!1)):(s.toggleLoading(!1),n(s.activeForm).find("["+s.selectors.noResults+"]").show())}})},s.loadResults=function(){var a="<ul>";n.each(s.results,function(e,t){a+='<li><a href="#" data-assignment-page-id="'+t.ID+'" data-assignment-page-title="'+t.post_title+'">'+t.post_title+"</a></li>"}),a+="</ul>",n(s.activeForm).find("["+s.selectors.results+"]").html(a),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).find("["+s.selectors.loadingIndicator+"]"),a=n(s.activeForm).find("["+s.selectors.noResults+"]");n(a).hide(),e?n(t).show():n(t).hide()},s.bindEvents()},(NestedPages=NestedPages||{}).MovePost=function(){var t=this,a=jQuery;return t.formatter=new NestedPages.Formatter,t.nesting=new NestedPages.Nesting,t.activeRow,t.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},t.bindEvents=function(){a(document).ready(function(){t.disableTopOnFirst(),t.disableBottomOnLast()}),a(document).on("click","["+t.selectors.moveToTop+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToTop())}),a(document).on("click","["+t.selectors.moveToBottom+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToBottom())})},t.moveToTop=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).find(NestedPages.selectors.rows).first();a(t.activeRow).insertBefore(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.moveToBottom=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).children(NestedPages.selectors.rows).last();a(t.activeRow).insertAfter(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.disableTopOnFirst=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToTop+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).first();a(e).find("["+t.selectors.moveToTop+"]").addClass("disabled")})},t.disableBottomOnLast=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToBottom+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).last();a(e).find("["+t.selectors.moveToBottom+"]").addClass("disabled")})},t.bindEvents()},(NestedPages=NestedPages||{}).TrashWithChildren=function(){var t=this,a=jQuery;return t.post_id="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.trashWithChildrenButton,function(e){e.preventDefault(),t.post_id=a(this).attr("data-post-id"),t.trash()})},t.trash=function(){a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.trashWithChildren,nonce:NestedPages.jsData.nonce,post_id:t.post_id,screen:nestedpages.current_page},success:function(e){window.location.replace(e.redirect)},error:function(e){console.log(e)}})},t.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var t=this,n=jQuery;return t.button=null,t.postData=null,t.modal=null,t.parent_li=null,t.formatter=new NestedPages.Formatter,t.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},t.bindEvents=function(){nestedpages.wpml&&n(document).on("click","["+t.selectors.translationsBtn+"]",function(e){e.preventDefault(),t.createTranslationsModal(n(this))})},t.createTranslationsModal=function(e){t.parent_li=n(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),t.button=n(t.parent_li).find(NestedPages.selectors.quickEditOpen),t.postData={id:n(t.button).attr("data-id"),title:n(t.button).attr("data-title"),slug:n(t.button).attr("data-slug")},t.modal=n("["+t.selectors.modal+"]").clone(),0<n(t.parent_li).children("ol").length?(e=n(t.parent_li).children("ol"),n(t.modal).insertBefore(e)):n(t.modal).appendTo(t.parent_li),n(t.modal).find("["+t.selectors.title+"]").text(t.postData.title),t.formatter.showQuickEdit(),n(t.modal).show(),t.getTranslationData()},t.getTranslationData=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:t.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(t.postData.id),"success"===e.status?t.populateModal(e.translations):(n(t.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),t.toggleLoading(!1))}})},t.populateModal=function(a){var s="<tbody>";n.each(a,function(e,t){e=a[e];s+="<tr>",s+='<td><img src="'+e.country_flag_url+'" alt="'+e.translated_name+'" /> '+e.translated_name+"</td>",s+="<td>",e.has_translation&&e.edit_link?s+='<a href="'+e.edit_link+'">'+e.translation.post_title+" ("+nestedpages.edit+")</a>":s+='<a href="'+e.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",s+="</td>",s+="</tr>"}),s+="</tbody>",n(t.modal).find("["+t.selectors.table+"]").html(s),t.toggleLoading(!1)},t.toggleLoading=function(e){e?n(t.modal).addClass("loading"):n(t.modal).removeClass("loading")},t.bindEvents()};
1
+ var NestedPages=NestedPages||{};NestedPages.Formatter=function(){var s=this,i=jQuery;s.updateSubMenuToggle=function(){for(var e=i(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a,s=e[t],n=i(s).parent(".row").parent("li");0<i(n).children("ol").length?i(n).children("ol").find("li.page-row").length<1?i(n).children("ol").hide():(a='<div class="child-toggle-spacer"></div>',a+='<a href="#"',0<i(n).children("ol:visible").length&&(a+=' class="open"'),a+='><span class="np-icon-arrow"></span></a>',i(s).html(a),0<i(n).children("ol").children(".np-hide").length&&0===i(n).children("ol").children(".np-hide.shown").length?i(s).find("a").hide():0<i(n).children("ol").children(".np-hide").length&&0<i(n).children("ol").children(".np-hide.shown").length&&i(s).find("a").show(),0<i(n).children("ol").find(".page-row").not(".np-hide").length&&i(s).find("a").show()):i(s).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){i(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),i.each(i(NestedPages.selectors.lists),function(){i(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){s.setIndent()},s.setIndent=function(){var n="1"===nestedpages.non_indent?20:30,o="1"===nestedpages.non_indent?".row-inner":".child-toggle";i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=a*n+s,i(this).find(o).css("padding-left",s+"px")):(a<1&&i(this).find(o).css("padding-left","0px"),NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px"))})},s.setClassicIndent=function(){i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=20*a+s,i(this).find(".row-inner").css("padding-left",s+"px")):NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){var t,a;NestedPages.jsData.nestable&&(t=40*i(e.placeholder).parents("ol").length-40,a=i(NestedPages.selectors.sortable).width()-t,i(e.placeholder).width(a).css("margin-left",t+"px")),s.updateListVisibility(e)},s.updateListVisibility=function(e){e=i(e.placeholder).parent("ol");i(e).is(":visible")||(i(e).addClass("nplist"),i(e).show())},s.removeQuickEdit=function(){i(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),i(".sortable .quick-edit").remove(),i(".row").show()},s.showQuickEdit=function(){i("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){i(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){i(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){i(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){i(NestedPages.selectors.ajaxError).find("p").text(e),i(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){i(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=i(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=i(e).width(),a=i(e).height();i.each(i(NestedPages.selectors.thumbnailContainerLink),function(){i(this).width(t),i(this).height(a)})}},(NestedPages=NestedPages||{}).Dropdowns=function(){var t=this,a=jQuery;return t.dropdown="",t.activeBtn="",t.activeContent="",t.toggleBtn="[data-dropdown-toggle]",t.dropdownContainer="[data-dropdown]",t.dropdownContent="[data-dropdown-content]",t.selectors={caret_up:"icon-arrow_drop_up",caret_down:"icon-arrow_drop_down"},t.bindEvents=function(){a(document).on("click",t.toggleBtn,function(e){e.preventDefault(),t.activeBtn=a(this),t.dropdown=a(this).parents(t.dropdownContainer),t.toggleDropdown()}),a(document).on("click",function(e){t.closeDropdowns(e.target)}),a(document).on("dropdown-opened",function(e,t){0<a(t).parents(NestedPages.selectors.row).length&&a(t).parents(NestedPages.selectors.row).addClass("active")}),a(document).on("dropdown-closed",function(){a(NestedPages.selectors.row).removeClass("active")})},t.toggleDropdown=function(){a("."+t.selectors.caret_up).attr("class",t.selectors.caret_down);var e=a(t.dropdown).find(t.dropdownContent);if(t.activeContent=e,a(e).hasClass("active"))return a(e).removeClass("active"),a(t.activeBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),void a(document).trigger("dropdown-closed",e);t.setPositioning(),a(t.toggleBtn).removeClass("active"),a(t.dropdownContent).removeClass("active"),a(e).addClass("active"),a(t.activeBtn).find("."+t.selectors.caret_down).attr("class",t.selectors.caret_up),a(t.activeBtn).addClass("active"),a(document).trigger("dropdown-opened",e)},t.setPositioning=function(){var e=a(t.activeBtn).outerHeight();a(t.activeContent).css("top",e+"px")},t.closeDropdowns=function(e){0===a(e).parents(t.dropdownContainer).length&&(a(t.dropdownContent).removeClass("active"),a(t.toggleBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),a(document).trigger("dropdown-closed",void 0))},t.bindEvents()},(NestedPages=NestedPages||{}).Modals=function(){var a=this,s=jQuery;return a.activeBtn="",a.activeModal="",a.modalOpen=!1,a.selectors={toggleBtn:"[data-nestedpages-modal-toggle]",backdrop:"[data-nestedpages-modal-backdrop]",closeBtn:"[data-nestedpages-modal-close]",title:"data-nestedpages-modal-title",content:"data-nestedpages-modal-content"},a.bindEvents=function(){s(document).on("click",a.selectors.toggleBtn,function(e){e.preventDefault(),a.activeBtn=s(this),a.openModal()}),s(document).on("click",a.selectors.closeBtn,function(e){e.preventDefault(),a.closeModals()}),s(document).on("open-modal-manual",function(e,t){a.activeModal=s('[data-nestedpages-modal="'+t+'"]'),a.openModal()}),s(document).on("close-modal-manual",function(e){a.closeModals()}),s(document).on("click",a.selectors.backdrop,function(e){a.closeModals()}),s(document).ready(function(){a.checkHash()})},a.openModal=function(){var e;a.modalOpen?a.closeModals():(0<s(a.activeBtn).length&&(e=s(a.activeBtn).attr("data-nestedpages-modal-toggle"),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]')),s(a.activeModal).addClass("active"),a.modalOpen=!0,a.populateModal(),s(document).trigger("open-modal",[a.activeBtn,a.activeModal]))},a.closeModals=function(){a.modalOpen=!1,s("[data-nestedpages-modal]").removeClass("active"),a.activeModal="",a.activeBtn=""},a.populateModal=function(){var e=s(a.activeBtn).attr(a.selectors.title);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-title]").text(e);e=s(a.activeBtn).attr(a.selectors.content);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(e)},a.checkHash=function(){var e;window.location.hash&&"#modal"===window.location.hash.substring(0,6)&&(e=window.location.hash.substring(7),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal())},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var a=this,s=jQuery;return a.activeCheckbox="",a.selectors={checkbox:"[data-np-check-all]"},a.bindEvents=function(){s(document).on("change",a.selectors.checkbox,function(){a.activeCheckbox=s(this),a.toggleCheckboxes()}),s(document).on("change","input[type=checkbox]",function(){a.checkAllStatus(s(this))})},a.init=function(){a.bindEvents()},a.toggleCheckboxes=function(){var t=!!s(a.activeCheckbox).is(":checked"),e=s(a.activeCheckbox).attr("data-np-check-all"),e=s('*[name="'+e+'"]');s.each(e,function(){var e=s(this).parents(NestedPages.selectors.rows);s(this).prop("checked",t),s(e).hasClass("np-hide")&&!s(e).is(":visible")&&s(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),a.toggleCheckAll()},a.toggleCheckAll=function(){var e=s(a.activeCheckbox).attr("data-np-check-all"),t=(t=s('*[name="'+e+'"]').length)-s(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+s(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length,e=s('*[name="'+e+'"]:checked').length;if(t==e)return s(a.activeCheckbox).prop("checked",!0),void s(a.activeCheckbox).removeClass("check-all-partial");0<e?s(a.activeCheckbox).addClass("check-all-partial"):(s(a.activeCheckbox).attr("checked",!1),s(a.activeCheckbox).removeClass("check-all-partial"))},a.checkAllStatus=function(e){e=s(e).attr("name"),e=s('*[data-np-check-all="'+e+'"]');0!==e.length&&(a.activeCheckbox=s(e)[0],a.toggleCheckAll())},a.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var n=this,o=jQuery;return n.selectedNumber=0,n.selectedLinks=[],n.selectedPosts=[],n.bindEvents=function(){o(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){n.toggleBulkForm()}),o(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===o("select[name=np_bulk_action]").val()&&(e.preventDefault(),n.toggleBulkEdit(!0))}),o(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();e=o(this).siblings("input[type=hidden]").val();n.uncheckBulkItem(e)}),o(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),n.uncheckAllBulkItems()})},n.toggleBulkForm=function(){var t=!1,a="",s="";if(n.selectedPosts=[],n.selectedLinks=[],o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){var e;o(this).is(":checked")&&(e=o(this).parents(NestedPages.selectors.rows),t=!0,o(this).parent("div").hasClass("np-check-all")||o(e).hasClass("post-type-np-redirect")||(a+=o(this).val()+","),o(e).hasClass("post-type-np-redirect")&&(s+=o(this).val()+",",n.selectedLinks.push(o(this).val())),"np-redirect"===o(this).attr("data-np-post-type")||o(this).parent("div").hasClass("np-check-all")||((e=[]).title=o(this).attr("data-np-bulk-checkbox"),e.id=o(this).val(),n.selectedPosts.push(e)))}),n.setBulkEditPosts(),n.toggleEditOption(),n.toggleLinkCountAlert(),t)return o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkActionsIds).val(a),o(NestedPages.selectors.bulkActionRedirectIds).val(s),void n.setSelectedNumber();o(NestedPages.selectors.bulkActionsIds).val(""),o(NestedPages.selectors.bulkActionsForm).hide()},n.setBulkEditPosts=function(){for(var e="",t=0;t<n.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>&times;</a>',e+=n.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+n.selectedPosts[t].id+'"></li>';o(NestedPages.selectors.bulkEditTitles).html(e)},n.uncheckBulkItem=function(e){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).val()==e&&o(this).prop("checked",!1).change()}),0===o(NestedPages.selectors.bulkEditRemoveItem).length&&n.toggleBulkEdit(!1)},n.uncheckAllBulkItems=function(){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).prop("checked",!1).change()}),n.toggleBulkEdit(!1)},n.setSelectedNumber=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option").first();o(t).text(nestedpages.bulk_actions+" ("+e+")")},n.toggleEditOption=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return o(t).prop("disabled",!0),o(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void n.toggleBulkEdit(!1);o(t).prop("disabled",!1)},n.toggleBulkEdit=function(e){if(n.toggleLinkCountAlert(),e)return n.disableParentOptions(),o(NestedPages.selectors.bulkEditForm).show(),o(NestedPages.selectors.bulkActionsForm).hide(),void n.setWPSuggest();o(NestedPages.selectors.bulkEditForm).hide(),o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),o(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),n.resetBulkEditFields()},n.toggleLinkCountAlert=function(){0!==n.selectedLinks.length?o(NestedPages.selectors.bulkEditLinkCount).parent("div").show():o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},n.disableParentOptions=function(){for(var e=o(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<n.selectedPosts.length;t++)o(e).find("option[value="+n.selectedPosts[t].id+"]").attr("disabled",!0)},n.setWPSuggest=function(){var e=o(NestedPages.selectors.bulkEditForm).find("[data-autotag]");o.each(e,function(e,t){var a=o(this).attr("data-taxonomy");o(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},n.resetBulkEditFields=function(){var e=o(NestedPages.selectors.bulkEditForm).find("select");o.each(e,function(){o(this).find("option").first().prop("selected",!0),o(this).find("option").removeAttr("disabled")});e=o(NestedPages.selectors.bulkEditForm).find(".cat-checklist");o.each(e,function(){o(this).find("input[type=checkbox]").prop("checked",!1)})},n.bindEvents()},(NestedPages=NestedPages||{}).HiddenItemCount=function(){var e=this,a=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){a(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var t=0;a.each(a(NestedPages.selectors.bulkActionsCheckbox),function(){var e;a(this).is(":checked")&&(a(this).parent("div").hasClass("np-check-all")||(e=a(this).closest(".page-row"),a(e).is(":visible")||t++))}),t<1?a(NestedPages.selectors.hiddenItemCountParent).hide():(a(NestedPages.selectors.hiddenItemCount).text(t),a(NestedPages.selectors.hiddenItemCountParent).show())},e.init()},(NestedPages=NestedPages||{}).MenuToggle=function(){var a=this,n=jQuery;return a.formatter=new NestedPages.Formatter,a.bindEvents=function(){n(document).on("click",NestedPages.selectors.childToggleLink,function(e){e.preventDefault(),a.toggleSingleMenu(n(this))}),n(document).on("click",NestedPages.selectors.toggleAll,function(e){e.preventDefault(),a.toggleAllMenus()})},a.toggleSingleMenu=function(e){var t=n(e).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");n(e).toggleClass("open"),n(t).toggle(),a.formatter.setBorders(),a.formatter.setNestedMargins(),a.syncUserToggles()},a.toggleAllMenus=function(){var e=NestedPages.selectors.toggleAll;if("closed"===n(e).attr("data-toggle"))return n(NestedPages.selectors.lists).show(),n(e).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),n(NestedPages.selectors.childToggle+" a").addClass("open"),a.formatter.setBorders(),void a.syncUserToggles();n(NestedPages.selectors.lists).not(n(NestedPages.selectors.lists)[0]).hide(),n(e).attr("data-toggle","closed").text(NestedPages.jsData.expandText),n(NestedPages.selectors.childToggle+" a").removeClass("open"),a.formatter.setBorders(),a.syncUserToggles()},a.visibleRowIDs=function(){var s=[],e=n(NestedPages.selectors.rows+":visible");return n.each(e,function(e,t){var a=n(this).attr("id");s.push(a.replace("menuItem_",""))}),s},a.syncUserToggles=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:a.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},a.bindEvents()},(NestedPages=NestedPages||{}).PageToggle=function(){var a=this,s=jQuery;return a.activeButton="",a.formatter=new NestedPages.Formatter,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.toggleHidden,function(e){e.preventDefault(),a.activeButton=s(this),a.toggleHidden()}),s(document).on("click",NestedPages.selectors.toggleStatus,function(e){e.preventDefault(),a.toggleStatus(s(this))})},a.toggleHidden=function(){var e=s(a.activeButton),t=s(e).attr("href");if("#show"==t)return s(e).attr("href","#hide").text(NestedPages.jsData.showHiddenText),s(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),a.formatter.updateSubMenuToggle(),void a.formatter.setBorders();"#hide"==t&&(s(e).attr("href","#show").text(NestedPages.jsData.hideHiddenText),s(NestedPages.selectors.hiddenRows).addClass("shown").show(),a.formatter.updateSubMenuToggle(),a.formatter.setBorders())},a.toggleStatus=function(e){var t=(t=s(e).attr("href")).substring(1);s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),a.saveStatusPreference(t),"draft"==t&&(s(NestedPages.selectors.syncCheckbox).attr("disabled",!0),s("."+t).addClass("nested-visible")),"all"!=t?(s(NestedPages.selectors.rows).hide(),s("."+t).show()):s(NestedPages.selectors.rows).show()},a.saveStatusPreference=function(e){s.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.toggleStatusDisplay,nonce:NestedPages.jsData.nonce,status:e,post_type:NestedPages.jsData.posttype}})},a.bindEvents()},(NestedPages=NestedPages||{}).Nesting=function(){var n=this,o=jQuery;n.formatter=new NestedPages.Formatter,n.initializeSortable=function(){if(!NestedPages.jsData.nestable)return n.initializeSortableFlat();var e,t=0;void 0===nestedpages.post_types[NestedPages.jsData.posttype]||void 0!==(e=nestedpages.post_types[NestedPages.jsData.posttype]).enable_max_nesting&&e.enable_max_nesting&&void 0!==e.maximum_nesting&&1<e.maximum_nesting&&(t=e.maximum_nesting),o(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",tabSize:56,maxLevels:t,isAllowed:function(e,t,a){return!(o(t).hasClass("post-type-np-redirect")&&!o(a).hasClass("post-type-np-redirect"))},start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})},n.initializeSortableFlat=function(){var e=o(NestedPages.selectors.lists).not(NestedPages.selectors.notSortable);o.each(e,function(){o(this).sortable({items:">"+NestedPages.selectors.rows,handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",forcePlaceholderSize:!0,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})})},n.disableNesting=function(){o(NestedPages.selectors.sortable).sortable("destroy")},n.syncNesting=function(e,t){var a,s;"1"===nestedpages.manual_order_sync&&!e||(o(NestedPages.selectors.errorDiv).hide(),o(NestedPages.selectors.loadingIndicator).show(),s=!!o(NestedPages.selectors.lists).first().hasClass("filtered"),a=NestedPages.jsData.nestable&&!s?o(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):n.setNestingArray(),n.disableNesting(),e=NestedPages.jsData.syncmenu,"1"===nestedpages.manual_menu_sync&&(e="nosync"),o.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:a,post_type:NestedPages.jsData.posttype,syncmenu:e,filtered:s},success:function(e,t){n.initializeSortable(),"error"===e.status?(o(NestedPages.selectors.errorDiv).text(e.message).show(),o(NestedPages.selectors.loadingIndicator).hide()):t&&"function"==typeof t?t():o(NestedPages.selectors.loadingIndicator).hide()}}))},n.setNestingArray=function(e){return ret=[],o(NestedPages.selectors.lists).first().children("li.page-row").each(function(){var e=n.recursiveNesting(this);ret.push(e)}),ret},n.recursiveNesting=function(e){var t,a=o(e).attr("id");if(a)return a=a.replace("menuItem_",""),t={id:a},0<o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).length&&(t.children=[],o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).each(function(){var e=n.recursiveNesting(this);t.children.push(e)})),t}},(NestedPages=NestedPages||{}).SyncMenuSetting=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.init=function(){t.bindEvents()},t.bindEvents=function(){e(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&t.syncSetting()}),e(document).on("change",NestedPages.selectors.syncCheckbox,function(){t.syncSetting()})},t.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==e(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=e(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",e.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncMenu,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:NestedPages.jsData.syncmenu},success:function(e){"error"===e.status&&t.formatter.showAjaxError(e.message)},error:function(e){console.log(e)}}))},t.bindEvents()},(NestedPages=NestedPages||{}).NewPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.parent_id=0,r.posts="",r.form="",r.bindEvents=function(){d(document).on("open-modal",function(e,t,a){t=d(t).attr("data-nestedpages-modal-toggle");void 0!==t&&"np-bulk-modal"==t&&r.openModal()}),d(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),d(document).on("click",NestedPages.selectors.newPageSubmitButton,function(e){e.preventDefault(),r.submitForm(d(this))}),d(document).on("click",NestedPages.selectors.newPageTitle,function(e){e.preventDefault(),r.addTitleField(d(this))}),d(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(e){e.preventDefault(),r.removeTitleField(d(this))}),d(document).on("click",NestedPages.selectors.addChildButton,function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click",NestedPages.selectors.cancelNewChildButton,function(e){e.preventDefault(),r.cancelNewPage()}),d(document).on("click","["+NestedPages.selectors.newBeforeButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click","["+NestedPages.selectors.newAfterButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("keydown",function(e){27===e.keyCode&&(r.cancelNewPage(),d(document).click())})},r.openModal=function(){var e=d(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);d(e).addClass("in-modal"),d(NestedPages.selectors.newPageModal).find(".modal-body").html(e),d(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),d(NestedPages.selectors.newPageModal).find(".page_parent_id").val(r.parent_id),d(e).find(".np_title").first().focus(),d(e).find(NestedPages.selectors.newPageTitle).first().prop("tabindex","2")},r.openQuickEdit=function(e){var t,a=void 0!==(a=d(e).attr(NestedPages.selectors.newBeforeButton))&&""!==a&&a,s=void 0!==(s=d(e).attr(NestedPages.selectors.newAfterButton))&&""!==s&&s,n=d(e).closest(NestedPages.selectors.row).parent("li"),o=d(NestedPages.selectors.newPageFormContainer).clone();0<d(n).children("ol").length?(t=d(n).children("ol"),d(o).insertBefore(t)):d(o).appendTo(n),d(o).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(o).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),a||s||d(o).find(".page_parent_id").val(d(e).attr("data-id")),a&&(d(o).find(".page_before_id").val(a),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),s&&(d(o).find(".page_after_id").val(s),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(o).show(),d(o).find(".np_title").focus(),d(o).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},r.cancelNewPage=function(){r.formatter.removeQuickEdit(),d(NestedPages.selectors.newChildError).hide(),d(NestedPages.selectors.newPageModal).find(".modal-body").empty(),d(NestedPages.selectors.sortable).find(".new-child").remove(),d(NestedPages.selectors.row).show()},r.addTitleField=function(e){var t=d(e).parents("form"),a=d(e).siblings(".new-page-titles").children("li").length+1,s='<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg><div class="form-control new-child-row"><label>'+NestedPages.jsData.titleText+'</label><div><input type="text" name="post_title[]" class="np_title" placeholder="'+NestedPages.jsData.titleText+'" value="" tabindex="'+a+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';d(e).siblings(".new-page-titles").append(s);d(t).find(".np_title").last().focus(),d(t).find(NestedPages.selectors.newPageTitle).prop("tabindex",+a),d(".new-page-titles").sortable({items:"li",handle:".handle"}),r.toggleAddEditButton(t)},r.removeTitleField=function(e){var t=d(e).parents("form");d(e).parents(".new-child-row").parent("li").remove(),r.toggleAddEditButton(t)},r.submitForm=function(e){r.toggleLoading(!0),r.form=d(e).parents("form");var t=!!d(e).hasClass("add-edit"),e=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(e=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(e=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+e+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){if("error"===e.status)return r.toggleLoading(!1),void d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show();!0!=t?(r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()):(e=(e=e.new_pages[0].edit_link).replace(/&amp;/g,"&"),window.location.replace(e))},error:function(e){console.log(e),r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},r.addPosts=function(){var e,t=""!==(t=d(r.form).find(".page_before_id").val())&&t,a=""!==(a=d(r.form).find(".page_after_id").val())&&a,s=d(r.form).parent(".new-child").parent(".page-row");for(0!==d(s).children("ol").length||t||a||d(s).append('<ol class="nplist"></ol>'),e=d(r.form).hasClass("in-modal")?d(".nplist.sortable li.page-row:first"):d(s).children("ol"),i=0;i<r.posts.length;i++)r.appendRows(e,r.posts[i],t,a);t||a||d(e).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n,o='<li id="menuItem_'+t.id+'" class="page-row';"publish"===t.status&&(o+=" published"),o+='">',NestedPages.jsData.hierarchical?(o+='<div class="row">',o+='<div class="child-toggle"></div>'):(o+='<div class="row non-hierarchical">',o+='<div class="non-hierarchical-spacer"></div>'),o+='<div class="row-inner">',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',o+='<a href="'+t.edit_link+'" class="page-link page-title">',o+='<span class="title">'+t.title+"</span>","Publish"!==t.status?o+='<span class="status">('+t.status+")</span>":o+='<span class="status"></span>',o+='<span class="nav-status">',"hide"===t.np_nav_status&&(o+=" "+nestedpages.hidden),o+="</span>",o+='<span class="edit-indicator">Edit</span>',o+="</a>",NestedPages.jsData.hierarchical||(o+='<div class="np-post-columns">',o+='<ul class="np-post-info">',o+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",o+="<li>"+t.date_formatted+"</li>",o+="</ul>",o+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(o+='<span class="np-seo-indicator na"></span>'),o+='<div class="action-buttons">',o+='<div class="nestedpages-dropdown" data-dropdown><a href="#" class="np-btn has-icon toggle" data-dropdown-toggle><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></a><ul class="nestedpages-dropdown-content" data-dropdown-content>',o+='<li><a href="#" class="open-redirect-modal" data-parentid="'+t.id+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'+nestedpages.add_link+"</a></li>",o+='<li><a href="#" class="add-new-child" data-id="'+t.id+'" data-parentname="'+t.title+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'+nestedpages.add_child_short+"</a></li>",o+="</ul></div>",o+='<a href="#" class="np-btn np-quick-edit" data-id="'+t.id+'" data-template="'+t.page_template+'" data-title="'+t.title+'" data-slug="'+t.slug+'" data-commentstatus="closed" data-status="'+t.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+t.author+'" data-template="'+t.template+'" data-month="'+t.month+'" data-day="'+t.day+'" data-year="'+t.year+'" data-hour="'+t.hour+'" data-minute="'+t.minute+'" data-datepicker="'+t.datepicker+'" data-time="'+t.time+'" data-formattedtime="'+t.formattedtime+'" data-ampm="'+t.ampm+'">'+nestedpages.quick_edit+"</a>",o+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",o+='<a href="'+t.delete_link+'" class="np-btn np-btn-trash"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-remove"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" class="icon"/><path d="M0 0h24v24H0z" fill="none"/></svg></a>',o+="</div>\x3c!-- .action-buttons --\x3e",o+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",o+="</li>",a?(n=r.findRowById(a),d(o).insertBefore(n)):s?(n=r.findRowById(s),d(o).insertAfter(n)):d(e).append(o)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){e=d(e).find(".np_title").length;e<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<e?d(NestedPages.selectors.newPageSubmitButton+".add-edit").hide():d(NestedPages.selectors.newPageSubmitButton+".add-edit").show())},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.button="",r.initialData="",r.parent_li="",r.form="",r.flatTerms="",r.termNames="",r.saveButton="",r.newData="",r.row="",r.bindEvents=function(){d(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),r.button=d(this),r.openForm()}),d(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),r.formatter.removeQuickEdit()}),d(document).on("change",".keep_private",function(){this.checked?d(".post_password").val("").prop("readonly",!0):d(".post_password").prop("readonly",!1)}),d(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),r.saveButton=d(this),r.save()}),d(document).on("keydown",function(e){27===e.keyCode&&r.formatter.removeQuickEdit()})},r.openForm=function(){r.setInitialData(),r.createForm(),r.populateForm(),r.populateFlatTaxonomies()},r.setInitialData=function(){r.initialData={id:d(r.button).attr("data-id"),title:d(r.button).attr("data-title"),slug:d(r.button).attr("data-slug"),author:d(r.button).attr("data-author"),cs:d(r.button).attr("data-commentstatus"),status:d(r.button).attr("data-status"),template:d(r.button).attr("data-template"),month:d(r.button).attr("data-month"),day:d(r.button).attr("data-day"),year:d(r.button).attr("data-year"),hour:d(r.button).attr("data-hour"),minute:d(r.button).attr("data-minute"),navstatus:d(r.button).attr("data-navstatus"),navCustomUrl:d(r.button).attr("data-custom-url"),npstatus:d(r.button).attr("data-np-status"),navtitle:d(r.button).attr("data-navtitle"),navtitleattr:d(r.button).attr("data-navtitleattr"),navcss:d(r.button).attr("data-navcss"),linktarget:d(r.button).attr("data-linktarget"),password:d(r.button).attr("data-password"),datepicker:d(r.button).attr("data-datepicker"),time:d(r.button).attr("data-formattedtime"),timeTwentyFour:d(r.button).attr("data-time"),ampm:d(r.button).attr("data-ampm"),timeFormat:d(r.button).attr("data-timeformat"),sticky:d(r.button).attr("data-sticky")};var e=d(r.button)[0].attributes;d.each(e,function(e,t){t.name.includes("data-npcustom")&&(r.initialData[t.name]=t.value)}),r.initialData.h_taxonomies=[],r.initialData.f_taxonomies=[],r.parent_li=d(r.button).closest(NestedPages.selectors.row).parent("li");var t=d(r.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&r.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&r.initialData.f_taxonomies.push(t[i])},r.createForm=function(){var e;r.form=d(NestedPages.selectors.quickEditPostForm).clone(),0<d(r.parent_li).children("ol").length?(e=d(r.parent_li).children("ol"),d(r.form).insertBefore(e)):d(r.form).appendTo(r.parent_li),d(r.form).siblings(NestedPages.selectors.row).hide(),d(r.form).show()},r.populateForm=function(){for(var e in d(r.form).find(".page_id").html("<em>ID:</em> "+r.initialData.id),d(r.form).find(".np_id").val(r.initialData.id),d(r.form).find(".np_title").val(r.initialData.title),d(r.form).find(".np_slug").val(r.initialData.slug),d(r.form).find(".np_author select").val(r.initialData.author),d(r.form).find(".np_status").val(r.initialData.status),d(r.form).find(".np_nav_title").val(r.initialData.navtitle),d(r.form).find(".np_nav_css_classes").val(r.initialData.navcss),d(r.form).find(".np_title_attribute").val(r.initialData.navtitleattr),d(r.form).find(".np_nav_custom_url").val(r.initialData.navCustomUrl),d(r.form).find(".post_password").val(r.initialData.password),d(r.form).find(".np_publish_date").val(r.initialData.datepicker),"open"===r.initialData.cs&&d(r.form).find(".np_cs").attr("checked","checked"),""!==r.initialData.template?d(r.form).find(".np_template").val(r.initialData.template):d(r.form).find(".np_template").val("default"),"private"===r.initialData.status&&(d(r.form).find(".post_password").attr("readonly",!0),d(r.form).find(".keep_private").attr("checked",!0)),"hide"===r.initialData.npstatus?d(r.form).find(".nested_pages_status").attr("checked","checked"):d(r.form).find(".nested_pages_status").removeAttr("checked"),"hide"===r.initialData.navstatus?d(r.form).find(".np_nav_status").attr("checked","checked"):d(r.form).find(".np_nav_status").attr("checked",!1),"_blank"===r.initialData.linktarget?d(r.form).find(".link_target").attr("checked","checked"):d(r.form).find(".link_target").attr("checked",!1),"private"===r.initialData.status&&d(r.form).find(".np_status").val("publish"),"sticky"===r.initialData.sticky?d(r.form).find(".np-sticky").attr("checked","checked"):d(r.form).find(".np-sticky").removeAttr("checked"),"H:i"===r.initialData.timeFormat?d(r.form).find(".np_time").val(r.initialData.timeTwentyFour):(d(r.form).find(".np_time").val(r.initialData.time),d(r.form).find(".np_ampm").val(r.initialData.ampm),d(r.form).find('select[name="mm"]').val(r.initialData.month),d(r.form).find('input[name="jj"]').val(r.initialData.day),d(r.form).find('input[name="aa"]').val(r.initialData.year),d(r.form).find('input[name="hh"]').val(r.initialData.hour),d(r.form).find('input[name="mn"]').val(r.initialData.minute)),r.initialData){var t;e.includes("npcustom")&&r.initialData.hasOwnProperty(e)&&(t=(t=e.replace("data-npcustom-","")).toLowerCase(),d(r.form).find('[data-np-custom-field="'+t+'"]').val(r.initialData[e]))}if(r.populateFlatTaxonomies(),r.initialData.hasOwnProperty("h_taxonomies")){var a=r.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];d(r.form).find(s).attr("checked","checked")}}var n=d(r.form).find(".np_datepicker");d.each(n,function(){var e=d(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){d("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),r.formatter.showQuickEdit(),d(r.form).show()},r.populateFlatTaxonomies=function(){r.initialData.hasOwnProperty("f_taxonomies")&&(r.createTaxonomyObject(),r.getTermNames(),r.setWPSuggest())},r.createTaxonomyObject=function(){var e={};for(i=0;i<r.initialData.f_taxonomies.length;i++){var t=r.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),a=(a=a.splice(s+1)).join("-"),s=t.split("-").splice(0,s);s.shift("inf");s=s.join("-");s in e||(e[s]=[]),e[s].push(a)}r.flatTerms=e},r.getTermNames=function(){d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:r.flatTerms},success:function(e){r.termNames=e.terms,r.populateFlatTaxonomyFields()}})},r.populateFlatTaxonomyFields=function(){r.termNames&&d.each(r.termNames,function(e,t){e=d("#"+e+"-quickedit");d(e).val(t.join(","))})},r.setWPSuggest=function(){var e=d(r.form).find("[data-autotag]");d.each(e,function(e,t){var a=d(this).attr("data-taxonomy");d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},r.save=function(){r.toggleLoading(!0),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(r.toggleLoading(!1),r.newData=e.post_data,r.updatePostRow())},error:function(e){console.log(e)}})},r.updatePostRow=function(){r.row=d(r.button).parents(".row-inner"),d(r.row).find(".title").text(r.newData.post_title),d(r.row).find(".np-view-button").attr("href",r.newData.permalink);var e,t=d(r.row).find(".status");"publish"!==r.newData._status&&"future"!==r.newData._status?(e=nestedpages.post_statuses[r.newData._status].label,d(t).text("("+e+")")):d(t).text(""),"private"===r.newData.keep_private&&d(t).text(nestedpages.private),""!==r.newData.post_password&&void 0!==r.newData.post_password&&(a=d(t).text(),a+=' <span class="locked">',a+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>',a+="</span>",d(t).html(a));var a=d(r.row).find(".nav-status");"hide"==r.newData.nav_status?d(a).text("(Hidden)"):d(a).text("");a=d(r.row).parent("li");"hide"==r.newData.np_status?(d(a).addClass("np-hide"),d(r.row).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(d(a).removeClass("np-hide"),d(r.row).find(".status-np-hidden").remove());a=d(r.row).find(".sticky");"sticky"==r.newData.sticky?d(a).show():d(a).hide(),NestedPages.jsData.hierarchical||d(r.row).find(".np-author-display").text(r.newData.author_name);var s,n,o=d(r.row).find(NestedPages.selectors.quickEditOpen);for(s in d(o).attr("data-id",r.newData.post_id),d(o).attr("data-template",r.newData.page_template),d(o).attr("data-title",r.newData.post_title),d(o).attr("data-slug",r.newData.post_name),d(o).attr("data-commentstatus",r.newData.comment_status),d(o).attr("data-status",r.newData._status),d(o).attr("data-sticky",r.newData.sticky),"private"===r.newData.keep_private&&d(o).attr("data-status","private"),d(o).attr("data-author",r.newData.post_author),d(o).attr("data-np-status",r.newData.np_status),d(o).attr("data-password",r.newData.post_password),d(o).attr("data-navstatus",r.newData.nav_status),d(o).attr("data-navtitle",r.newData.np_nav_title),d(o).attr("data-linktarget",r.newData.link_target),d(o).attr("data-navtitleattr",r.newData.np_title_attribute),d(o).attr("data-navcss",r.newData.np_nav_css_classes),d(o).attr("data-month",r.newData.mm),d(o).attr("data-day",r.newData.jj),d(o).attr("data-year",r.newData.aa),d(o).attr("data-hour",r.newData.hh),d(o).attr("data-minute",r.newData.mn),d(o).attr("data-datepicker",r.newData.np_date),d(o).attr("data-time",r.newData.np_time),d(o).attr("data-formattedtime",r.newData.np_time),d(o).attr("data-ampm",r.newData.np_ampm),r.newData)s.includes("np_custom")&&r.newData.hasOwnProperty(s)&&(n=s.replace("np_custom_","data-npcustom-"),d(o).attr(n,r.newData[s]));r.removeTaxonomyClasses(),r.addCategoryClasses(),r.addHierarchicalClasses(),r.addFlatClasses(),r.addStatusClass(),r.formatter.removeQuickEdit(),r.formatter.flashRow(r.row)},r.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)d(r.row).removeClass(e[i]);d(r.row).addClass(r.newData._status)},r.removeTaxonomyClasses=function(){taxonomies=[];var e=d(r.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&d(r.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&d(r.row).removeClass(e[i])},r.addCategoryClasses=function(){if(r.newData.hasOwnProperty("post_category")){var e=r.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];d(r.row).addClass(t)}}},r.addHierarchicalClasses=function(){var e;r.newData.hasOwnProperty("tax_input")&&(e=r.newData.tax_input,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];d(r.row).addClass(a)}}))},r.addFlatClasses=function(){var e;r.newData.hasOwnProperty("flat_tax")&&(e=r.newData.flat_tax,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];d(r.row).addClass(a)}}))},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(r.saveButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(r.saveButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.button="",a.postData="",a.newPostData="",a.form="",a.bindEvents=function(){s(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),a.formatter.removeQuickEdit(),a.button=s(this),a.openQuickEdit()}),s(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&a.formatter.removeQuickEdit()})},a.openQuickEdit=function(){a.setData(),a.createForm(),a.populateForm()},a.setData=function(){a.postData={id:s(a.button).attr("data-id"),url:s(a.button).attr("data-url"),title:s(a.button).attr("data-title"),status:s(a.button).attr("data-status"),navstatus:s(a.button).attr("data-navstatus"),npstatus:s(a.button).attr("data-np-status"),linktarget:s(a.button).attr("data-linktarget"),parentid:s(a.button).attr("data-parentid"),navtitleattr:s(a.button).attr("data-navtitleattr"),navcss:s(a.button).attr("data-navcss"),navtype:s(a.button).attr("data-nav-type"),navobject:s(a.button).attr("data-nav-object"),navobjectid:s(a.button).attr("data-nav-object-id"),navoriginallink:s(a.button).attr("data-nav-original-link"),navoriginaltitle:s(a.button).attr("data-nav-original-title")}},a.createForm=function(){var e,t=s(a.button).closest(NestedPages.selectors.row).parent("li");a.form=s(NestedPages.selectors.quickEditLinkForm).clone(),0<s(t).children("ol").length?(e=s(t).children("ol"),s(a.form).insertBefore(e)):s(a.form).appendTo(t);s(a.form).siblings(NestedPages.selectors.row).hide()},a.populateForm=function(){var e;s(a.form).find(".np_id").val(a.postData.id),s(a.form).find(".np_title").val(a.postData.title),s(a.form).find(".np_author select").val(a.postData.author),s(a.form).find(".np_status").val(a.postData.status),s(a.form).find(".np_content").val(a.postData.url),s(a.form).find(".np_parent_id").val(a.postData.parentid),s(a.form).find(".np_title_attribute").val(a.postData.navtitleattr),s(a.form).find(".np_nav_css_classes").val(a.postData.navcss),"hide"===a.postData.npstatus?s(a.form).find(".np_status").prop("checked","checked"):s(a.form).find(".np_status").removeAttr("checked"),"hide"===a.postData.navstatus?s(a.form).find(".np_nav_status").prop("checked","checked"):s(a.form).find(".np_nav_status").removeAttr("checked"),"_blank"===a.postData.linktarget?s(a.form).find(".link_target").prop("checked","checked"):s(a.form).find(".link_target").removeAttr("checked"),"custom"!==a.postData.navobject&&""!==a.postData.navobject?(e='<div class="form-control original-link">Original: <a href="'+a.postData.navoriginallink+'" target="_blank">'+a.postData.navoriginaltitle+"</a></div>",s(a.form).find("[data-url-field]").remove(),s(e).insertAfter(s(a.form).find("h3")),s(a.form).find("[data-np-menu-object-input]").val(a.postData.navobject),s(a.form).find("[data-np-menu-objectid-input]").val(a.postData.navobjectid),s(a.form).find("[data-np-menu-type-input]").val(a.postData.navtype),s(a.form).find("h3").text("Link: "+a.postData.navoriginaltitle)):(s(a.form).find("h3").text("Link"),s(a.form).find("[data-np-menu-object-input]").val("custom"),s(a.form).find("[data-np-menu-type-input]").val("custom")),a.formatter.showQuickEdit(),s(a.form).show()},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:s(a.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(a.toggleLoading(!1),a.newPostData=e.post_data,a.updateRow())},error:function(e){a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},a.updateRow=function(){var e=s(a.form).siblings(".row");s(e).find(".title").html(a.newPostData.post_title+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>');var t=s(e).find(".status");"publish"!==a.newPostData._status&&"future"!==a.newPostData._status?s(t).text("("+a.newPostData._status+")"):s(t).text("");t=s(e).find(".nav-status");"hide"==a.newPostData.nav_status?s(t).text("("+NestedPages.jsData.hiddenText+")"):s(t).text("");t=s(e).parent("li");"hide"==a.newPostData.np_status?(s(t).addClass("np-hide"),s(e).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(s(t).removeClass("np-hide"),s(e).find(".status-np-hidden").remove());t=s(e).find(NestedPages.selectors.quickEditButtonLink);s(t).attr("data-id",a.newPostData.post_id),s(t).attr("data-title",a.newPostData.post_title),s(t).attr("data-url",a.newPostData.post_content),s(t).attr("data-status",a.newPostData._status),s(t).attr("data-navstatus",a.newPostData.nav_status),s(t).attr("data-np-status",a.newPostData.np_status),s(t).attr("data-linkTarget",a.newPostData.linkTarget),s(t).attr("data-navtitleattr",a.newPostData.titleAttribute),s(t).attr("data-navcss",a.newPostData.cssClasses),a.formatter.removeQuickEdit(),a.formatter.flashRow(e)},a.toggleLoading=function(e){if(s(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return s(NestedPages.selectors.quickEditErrorDiv).hide(),s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void s(NestedPages.selectors.quickEditLoadingIndicator).show();s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),s(NestedPages.selectors.quickEditLoadingIndicator).hide()},a.bindEvents()},(NestedPages=NestedPages||{}).Clone=function(){var t=this,a=jQuery;return t.parent_id="",t.parent_title="",t.parentLi=null,t.formatter=new NestedPages.Formatter,t.bindEvents=function(){a(document).on("click",NestedPages.selectors.cloneButton,function(e){e.preventDefault(),t.parent_id=a(this).attr("data-id"),t.parent_title=a(this).attr("data-parentname"),t.parentLi=a(this).parent(".row").parent(".page-row").parent(".npList"),t.openModal()}),a(document).on("click",NestedPages.selectors.confirmClone,function(e){e.preventDefault(),t.clone()})},t.openModal=function(){a("#"+NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(t.parent_title),a(document).trigger("open-modal-manual",NestedPages.selectors.cloneModal)},t.clone=function(){var e=!!a(NestedPages.selectors.cloneChildren).is(":checked");t.toggleLoading(!0),a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:t.parent_id,quantity:a(NestedPages.selectors.cloneQuantity).val(),status:a(NestedPages.selectors.cloneStatus).val(),author:a(NestedPages.selectors.cloneAuthor).find("select").val(),clone_children:e,nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(e){t.toggleLoading(!1),a(document).trigger("close-modal-manual"),location.reload()}})},t.toggleLoading=function(e){if(e)return a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void a(NestedPages.selectors.confirmClone).attr("disabled","disabled");a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),a(NestedPages.selectors.confirmClone).attr("disabled",!1)},t.bindEvents()},(NestedPages=NestedPages||{}).Tabs=function(){var r=this,d=jQuery;return r.selectors={tabToggle:"data-np-tab-toggle",tabPane:"data-np-tab-pane",tabGroup:"data-np-tab-group"},r.bindEvents=function(){d(document).on("click","["+r.selectors.tabToggle+"]",function(e){e.preventDefault(),r.toggleTabs(d(this))})},r.toggleTabs=function(e){for(var t=d(e).attr(r.selectors.tabGroup),a=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabPane+"]"),s=d(e).attr(r.selectors.tabToggle),n=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabToggle+"]"),o=[],i=0;i<n.length;i++)o[i]=d(n[i]).parent("li")[0];d(a).hide(),d(n).removeClass("active"),d(o).removeClass("active"),d.each(a,function(){d(this).attr(r.selectors.tabPane)==s&&d(this).show()}),d.each(n,function(){d(this).attr(r.selectors.tabToggle)==s&&(d(this).addClass("active"),d(this).parent("li").addClass("active"))}),d(document).trigger("tabs-changed",[s,t,e])},r.bindEvents()},jQuery(document).ready(function(){new NestedPages.Factory}),(NestedPages=NestedPages||{}).selectors={childToggle:".child-toggle",childToggleLink:".child-toggle a",toggleAll:".nestedpages-toggleall",toggleHidden:".np-toggle-hidden",toggleStatus:".np-toggle-publish",lists:".nplist",rows:".page-row",row:".row",sortable:".sortable",notSortable:".no-sort",handle:".handle",published:".published",hiddenRows:".np-hide",errorDiv:"#np-error",loadingIndicator:"#nested-loading",syncCheckbox:".np-sync-menu",syncForm:".np-sync-menu-cont",ajaxError:"[data-nestedpages-error]",trashWithChildrenButton:"[data-nestedpages-trash-children]",toggleEditButtons:".np-toggle-edit",bulkActionsHeader:".nestedpages-list-header",bulkActionsForm:"[data-np-bulk-form]",bulkActionsCheckbox:"[data-np-bulk-checkbox]",bulkActionsIds:"[data-np-bulk-ids]",bulkActionRedirectIds:"[data-np-bulk-redirect-ids]",hiddenItemCount:"[data-np-hidden-count]",hiddenItemCountParent:"[data-np-hidden-count-parent]",bulkEditForm:"[data-np-bulk-edit-form]",bulkEditTitles:"[data-np-bulk-titles]",bulkEditRemoveItem:"[data-np-remove-bulk-item]",bulkEditCancel:"[data-np-cancel-bulk-edit]",bulkEditLinkCount:"[data-bulk-edit-link-count]",quickEditOverlay:".np-inline-overlay",quickEditLoadingIndicator:".np-qe-loading",quickEditErrorDiv:".np-quickedit-error",quickEditCancel:".np-cancel-quickedit",quickEditButtonLink:".np-quick-edit-redirect",quickEditLinkForm:".quick-edit-form-redirect",quickEditLinkSaveButton:".np-save-quickedit-redirect",quickEditOpen:".np-quick-edit",quickEditPostForm:".quick-edit-form",quickEditSaveButton:".np-save-quickedit",openLinkModal:".open-redirect-modal",linkModal:"np-link-modal",saveLink:".np-save-link",linkLoadingIndicator:".np-link-loading",linkErrorDiv:".np-new-link-error",linkForm:".np-new-link-form",linkDeleteButton:"[data-np-confirm-delete]",linkDeleteConfirmationButton:"[data-delete-confirmation]",linkDeleteConfirmationModal:"np-delete-confirmation-modal",linkDeleteConfirmationModalText:"[data-np-link-delete-text]",openPageModal:".open-bulk-modal",newPageModal:"#np-bulk-modal",newPageFormContainer:".new-child-form",newPageForm:".np-new-child-form",newPageSubmitButton:".np-save-newchild",newPageTitle:".add-new-child-row",newPageRemoveTitle:".np-remove-child",addChildButton:".add-new-child",newChildError:".np-newchild-error",cancelNewChildButton:".np-cancel-newchild",newBeforeButton:"data-insert-before",newAfterButton:"data-insert-after",cloneButton:".clone-post",confirmClone:"[data-confirm-clone]",cloneModal:"np-clone-modal",cloneQuantity:"[data-clone-quantity]",cloneStatus:"[data-clone-status]",cloneAuthor:"[data-clone-author]",cloneChildren:"[data-clone-children]",tabButtonParent:"[data-np-tabs]",tabButton:"[data-np-tab]",tabContent:"[data-np-tab-pane]",thumbnailContainer:".np-thumbnail",thumbnailContainerLink:".np-thumbnail.link",manualMenuSync:"[data-np-manual-menu-sync]",manualOrderSync:"[data-np-manual-order-sync]"},NestedPages.cssClasses={noborder:"no-border"},NestedPages.jsData={ajaxurl:ajaxurl,nonce:nestedpages.np_nonce,allPostTypes:nestedpages.post_types,syncmenu:"nosync",posttype:"",nestable:!0,sortable:!0,hierarchical:!0,expandText:nestedpages.expand_text,collapseText:nestedpages.collapse_text,showHiddenText:nestedpages.show_hidden,hideHiddenText:nestedpages.hide_hidden,quickEditText:nestedpages.quick_edit,hiddenText:nestedpages.hidden,titleText:nestedpages.title},NestedPages.formActions={syncToggles:"npnestToggle",syncNesting:"npsort",syncMenu:"npsyncMenu",newPage:"npnewChild",newBeforeAfter:"npnewBeforeAfter",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch",wpmlTranslations:"npWpmlTranslations",resetSettings:"npresetSettings",resetUserPrefs:"npresetUserPreferences",resetAdminMenuSettings:"npresetAdminMenuSettings",trashWithChildren:"nptrashWithChildren",toggleStatusDisplay:"nptoggleStatusDisplay"},NestedPages.Factory=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.dropdowns=new NestedPages.Dropdowns,t.modals=new NestedPages.Modals,t.checkAll=new NestedPages.CheckAll,t.bulkActions=new NestedPages.BulkActions,t.menuToggle=new NestedPages.MenuToggle,t.pageToggle=new NestedPages.PageToggle,t.nesting=new NestedPages.Nesting,t.syncMenuSetting=new NestedPages.SyncMenuSetting,t.newPage=new NestedPages.NewPost,t.quickEditLink=new NestedPages.QuickEditLink,t.quickEditPost=new NestedPages.QuickEditPost,t.clone=new NestedPages.Clone,t.tabs=new NestedPages.Tabs,t.menuLinks=new NestedPages.MenuLinks,t.hiddenItemCount=new NestedPages.HiddenItemCount,t.confirmDelete=new NestedPages.ConfirmDelete,t.manualSync=new NestedPages.ManualSync,t.postSearch=new NestedPages.PostSearch,t.postMove=new NestedPages.MovePost,t.wpml=new NestedPages.Wpml,t.trashWithChildren=new NestedPages.TrashWithChildren,t.init=function(){nestedpages.settings_page||(t.bindEvents(),t.setPostType(),t.setMenuSync(),t.setNestable(),t.setSortable(),t.formatter.updateSubMenuToggle(),t.formatter.setBorders(),t.formatter.setNestedMargins(),t.nesting.initializeSortable())},t.bindEvents=function(){e(document).on("click",NestedPages.selectors.quickEditOverlay,function(e){t.formatter.removeQuickEdit(),t.newPage.cancelNewPage()}),e(document).ready(function(){t.formatter.hideAjaxError(),t.formatter.sizeLinkThumbnails()})},t.setNestable=function(){var a=!1;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&(!0===t.hierarchical&&(a=!0),!0===t.disable_nesting&&(a=!1))}),NestedPages.jsData.nestable=a},t.setSortable=function(){var a=!0;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&void 0!==t.disable_sorting&&""!==t.disable_sorting&&"true"===t.disable_sorting&&(a=!1)}),NestedPages.jsData.sortable=a},t.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,void 0!==NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=e(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},t.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},t.init()},(NestedPages=NestedPages||{}).MenuLinks=function(){var a=this,s=jQuery;return a.typeButton="",a.post="",a.formatter=new NestedPages.Formatter,a.selectors={form:"[data-np-menu-item-form]",typeSelect:"[data-np-menu-selection]",accordion:"[data-np-menu-accordion]",accordionItem:"[data-np-menu-accordion-item]",formPlaceholder:".np-menu-link-object-placeholder",formDetails:".np-menu-link-details",searchResults:"[data-np-search-result]",defaultResults:"[data-default-result]",originalLink:"[data-np-original-link]",saveButton:"[data-np-save-link]",urlInputCont:"[data-np-menu-url-cont]",errorDiv:"[data-np-error]"},a.fields={object:"[data-np-menu-object-input]",objectid:"[data-np-menu-objectid-input]",itemType:"[data-np-menu-type-input]",url:"[data-np-menu-url]",navigationLabel:"[data-np-menu-navigation-label]",titleAttribute:"[data-np-menu-title-attr]",cssClasses:"[data-np-menu-css-classes]",npStatus:"[data-np-menu-np-status]",linkTarget:"[data-np-menu-link-target]",menuTitle:"[data-np-menu-title]",parentPostType:"[data-np-menu-parent-post-type]"},a.search=new NestedPages.MenuSearch,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.openLinkModal,function(e){e.preventDefault(),a.postParent=s(this).attr("data-parentid"),s(a.selectors.form).find(".parent_id").val(s(this).attr("data-parentid")),a.openModal()}),s(document).on("click",a.selectors.accordionItem,function(e){e.preventDefault(),a.accordion(s(this))}),s(document).on("click",a.selectors.typeSelect,function(e){e.preventDefault(),a.typeButton=s(this),a.setLinkType()}),s(document).on("keyup",a.fields.navigationLabel,function(){a.updateTitle()}),s(document).on("click",a.selectors.saveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&s(document).trigger("close-modal-manual")})},a.openModal=function(){s(NestedPages.selectors.linkErrorDiv).hide(),s(NestedPages.selectors.linkModal).find("input").val(""),s(NestedPages.selectors.linkModal).find(".parent_id").val(a.postParent),a.clearForm(),s(a.selectors.accordion).find("ul").hide(),s(a.selectors.typeSelect).removeClass("active"),s(document).trigger("open-modal-manual",NestedPages.selectors.linkModal)},a.accordion=function(e){a.clearForm();var t=s(e).siblings("ul");if(s(t).is(":visible"))return s(e).removeClass("active"),void s(t).slideUp("fast");s(a.selectors.accordionItem).removeClass("active"),s(e).addClass("active"),s(e).parents(a.selectors.accordion).find("ul").slideUp("fast"),s(t).slideDown("fast")},a.setLinkType=function(){s(a.typeButton).hasClass("active")?a.clearForm():(s(a.typeButton).hasClass("np-custom-link")&&(s(a.selectors.accordionItem).removeClass("active"),s(a.selectors.accordion).find("ul").slideUp("fast")),s(a.selectors.formPlaceholder).hide(),a.populateForm())},a.populateForm=function(){s(a.selectors.saveButton).show(),s(a.selectors.typeSelect).removeClass("active"),s(a.typeButton).addClass("active"),s(a.fields.menuTitle).text(s(a.typeButton).text()).val(s(a.typeButton).text()),s(a.selectors.form).find("h3").find("em").text(s(a.typeButton).attr("data-np-object-name")),""!==s(a.typeButton).attr("data-np-permalink")?(s(a.selectors.form).find(a.selectors.urlInputCont).hide(),s(a.selectors.form).find(a.selectors.originalLink).html('<a href="'+s(a.typeButton).attr("data-np-permalink")+'">'+s(a.typeButton).text()+"</a>"),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").show()):(s(a.selectors.form).find(a.selectors.urlInputCont).show(),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").hide()),s(a.fields.object).val(s(a.typeButton).attr("data-np-menu-object")),s(a.fields.objectid).val(s(a.typeButton).attr("data-np-menu-objectid")),s(a.fields.itemType).val(s(a.typeButton).attr("data-np-menu-type")),s(a.selectors.formDetails).show()},a.clearForm=function(){s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.saveButton).hide(),s(a.selectors.formDetails).hide(),s(a.selectors.formPlaceholder).show(),s(a.selectors.form).find("input").not(".parent_id").not(".parent-post-type").val(""),s(a.selectors.form).find(a.fields.linkTarget).val("_blank"),s(a.selectors.form).find('input[type="checkbox"]').attr("checked",!1),s(a.selectors.typeSelect).removeClass("active"),a.search.toggleLoading(!1),s(a.selectors.searchResults).remove(),s(a.selectors.defaultResults).show()},a.updateTitle=function(){var e=s(a.fields.navigationLabel).val(),t=s(a.selectors.form).find("h3").find("span");""!==e?(s(a.fields.menuTitle).val(e),s(t).text(e)):(s(a.fields.menuTitle).val(s(a.typeButton).text()),s(t).text(s(a.typeButton).text()))},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:s(a.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(e){a.toggleLoading(!1),"error"!==e.status?(a.post=e.post_data,a.createRow()):s(a.selectors.form).find(a.selectors.errorDiv).text(e.message).show()},error:function(e){console.log(e)}})},a.createRow=function(){var e='<li id="menuItem_'+a.post.id+'" class="page-row post-type-np-redirect published';e+='">',e+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner">',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',e+='<a href="'+a.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+a.post.menuTitle+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></span>',e+='</a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',e+='data-id="'+a.post.id+'"',e+='data-parentid="'+a.post.parent_id+'"',e+='data-title="'+a.post.menuTitle+'" ',e+='data-url="'+a.post.url+'" ',e+='data-status="publish" ',e+='data-np-status="show" ',e+='data-navstatus="show" ',e+='data-navcss="'+a.post.cssClasses+'" ',e+='data-navtitleattr="'+a.post.titleAttribute+'" ',e+='data-nav-type="'+a.post.menuType+'" ',e+='data-nav-object="'+a.post.objectType+'" ',e+='data-nav-object-id="'+a.post.objectId+'" ',e+='data-nav-original-link="'+a.post.original_link+'" ',e+='data-nav-original-title="'+a.post.original_title+'" ',e+='data-linktarget="'+a.post.link_target+'">',e+=NestedPages.jsData.quickEditText,e+="</a>",e+='<a href="'+a.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',e+="</div></div></div></li>","0"===a.post.parent_id?s(".nplist:first li:first").after(e):a.appendChildRow(e),s(document).trigger("close-modal-manual"),a.row=s("#menuItem_"+a.post.id).find(".row"),a.formatter.flashRow(a.row)},a.appendChildRow=function(e){var t=s("#menuItem_"+a.post.parent_id);0===s(t).children("ol").length?(e='<ol class="sortable nplist" style="display:block;">'+e+"</ol>",s(t).append(e)):s(t).find("ol:first").prepend(e),a.formatter.updateSubMenuToggle()},a.toggleLoading=function(e){if(e)return s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void s(a.selectors.saveButton).attr("disabled","disabled");s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),s(a.selectors.saveButton).attr("disabled",!1)},a.bindEvents()},(NestedPages=NestedPages||{}).MenuSearch=function(){var s=this,n=jQuery;return s.selectors={searchForms:"*[data-np-menu-search]",defaultResults:"[data-default-result]",loadingIndicator:".np-menu-search-loading",noResults:".np-menu-search-noresults",searchType:"data-search-type",searchObject:"data-search-object",searchResults:"[data-np-search-result]"},s.activeForm="",s.results="",s.defaultResults="",s.searchType="",s.searchObject="",s.init=function(){s.bindEvents()},s.bindEvents=function(){n(document).on("keyup",s.selectors.searchForms,function(){s.activeForm=n(this),n(s.selectors.searchResults).remove(),s.performSearch()})},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){s.searchType=n(s.activeForm).attr(s.selectors.searchType),s.searchObject=n(s.activeForm).attr(s.selectors.searchObject),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:n(s.activeForm).val(),searchType:s.searchType,searchObject:s.searchObject},success:function(e){console.log(e),e.results?(s.results=e.results,s.toggleLoading(!1),"post_type"===s.searchType?s.appendPosts():s.appendTaxonomies()):(s.toggleLoading(!1),n(s.activeForm).siblings(s.selectors.noResults).show())}})},s.appendPosts=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.ID+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.singular_name+'" data-np-menu-selection>'+t.post_title+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.appendTaxonomies=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.term_id+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.taxonomy+'" data-np-menu-selection>'+t.name+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).siblings(s.selectors.loadingIndicator);n(s.selectors.noResults).hide(),e?n(t).show():n(t).hide()},s.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPagesTrash=function(){var t=this,a=jQuery;return t.trashButton=".np-empty-trash",t.confirmButton=".np-trash-confirm",t.warningModal="#np-trash-modal",t.errorAlert="#np-error",t.loadingIndicator="#nested-loading",t.trashLinks=".np-trash-links",t.postType=a("#np-trash-posttype").val(),t.nonce=nestedpages.np_nonce,t.formAction="npEmptyTrash",t.bindEvents=function(){a(document).on("click",t.confirmButton,function(e){e.preventDefault(),t.confirmEmpty()})},t.confirmEmpty=function(){t.loading(!0),a(document).trigger("close-modal-manual"),a(t.errorAlert).hide(),t.emptyTrash()},t.emptyTrash=function(){a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:t.formAction,nonce:t.nonce,posttype:t.postType},success:function(e){t.loading(!1),"error"===e.status?a(t.errorAlert).text(e.message).show():(a(t.trashLinks).hide(),a(".notice-dismiss").click())}})},t.loading=function(e){e?a(t.loadingIndicator).show():a(t.loadingIndicator).hide()},t.bindEvents()};(NestedPages=NestedPages||{}).ConfirmDelete=function(){var t=this,a=jQuery;return t.deleteLink="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.linkDeleteButton,function(e){e.preventDefault(),t.confirmSingle(a(this))}),a(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(e){e.preventDefault(),a(this).hasClass("bulk")?t.deleteMultiple():t.deleteSingle()}),a(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){t.confirmMultiple(e)})},t.confirmSingle=function(e){t.deleteLink=a(e).attr("href"),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),a(document).trigger("open-modal-manual",NestedPages.selectors.linkDeleteConfirmationModal)},t.confirmMultiple=function(e){"trash"===a('select[name="np_bulk_action"]').val()&&""!==a(NestedPages.selectors.bulkActionRedirectIds).val()&&(e.preventDefault(),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),a(document).trigger("open-modal-manual",[NestedPages.selectors.linkDeleteConfirmationModal]))},t.deleteMultiple=function(){a(NestedPages.selectors.bulkActionsForm)[0].submit()},t.deleteSingle=function(){window.location.replace(t.deleteLink)},t.bindEvents()},(NestedPages=NestedPages||{}).ManualSync=function(){var t=this,a=jQuery;return t.activeBtn="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.manualMenuSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncMenu()}),a(document).on("click",NestedPages.selectors.manualOrderSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncOrder()})},t.syncMenu=function(){t.loading(!0),a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.manualMenuSync,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:"sync"},success:function(e){"error"===e.status?(a(NestedPages.selectors.errorDiv).text(e.message).show(),a(NestedPages.selectors.loadingIndicator).hide()):t.loading(!1)}})},t.syncOrder=function(){t.loading(!0),(new NestedPages.Nesting).syncNesting(!0,t.loading(!1))},t.loading=function(e){if(e)return a(t.activeBtn).addClass("disabled"),void a(NestedPages.selectors.loadingIndicator).show();a(t.activeBtn).removeClass("disabled"),a(NestedPages.selectors.loadingIndicator).hide()},t.bindEvents()},(NestedPages=NestedPages||{}).PostSearch=function(){var s=this,n=jQuery;return s.selectors={input:"data-nestedpages-post-search",form:"data-nestedpages-post-search-form",loadingIndicator:"data-nestedpages-loading",noResults:"data-nestedpages-no-results",results:"data-nestedpages-search-results"},s.changed=!1,s.activeInput="",s.results="",s.defaultResults="",s.postType="",s.activeForm="",s.bindEvents=function(){n("["+s.selectors.input+"]").on("input",function(){return s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val()?(n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults()):void s.query()})},s.setDefaultResults=function(){s.defaultResults=n(s.activeForm).find("["+s.selectors.results+"]").html(),s.changed=!0},s.showDefaultResults=function(){n(s.activeForm).find("["+s.selectors.results+"]").html(s.defaultResults)},s.setOptions=function(){s.postType=n(s.activeInput).attr(s.selectors.input),s.activeForm=n(s.activeInput).parents("["+s.selectors.form+"]")},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){n(s.activeForm).find("["+s.selectors.results+"]").empty(),s.toggleLoading(!0),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:n(s.activeInput).val(),postType:s.postType},success:function(e){e.results?(s.results=e.results,s.loadResults(),s.toggleLoading(!1)):(s.toggleLoading(!1),n(s.activeForm).find("["+s.selectors.noResults+"]").show())}})},s.loadResults=function(){var a="<ul>";n.each(s.results,function(e,t){a+='<li><a href="#" data-assignment-page-id="'+t.ID+'" data-assignment-page-title="'+t.post_title+'">'+t.post_title+"</a></li>"}),a+="</ul>",n(s.activeForm).find("["+s.selectors.results+"]").html(a),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).find("["+s.selectors.loadingIndicator+"]"),a=n(s.activeForm).find("["+s.selectors.noResults+"]");n(a).hide(),e?n(t).show():n(t).hide()},s.bindEvents()},(NestedPages=NestedPages||{}).MovePost=function(){var t=this,a=jQuery;return t.formatter=new NestedPages.Formatter,t.nesting=new NestedPages.Nesting,t.activeRow,t.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},t.bindEvents=function(){a(document).ready(function(){t.disableTopOnFirst(),t.disableBottomOnLast()}),a(document).on("click","["+t.selectors.moveToTop+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToTop())}),a(document).on("click","["+t.selectors.moveToBottom+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToBottom())})},t.moveToTop=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).find(NestedPages.selectors.rows).first();a(t.activeRow).insertBefore(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.moveToBottom=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).children(NestedPages.selectors.rows).last();a(t.activeRow).insertAfter(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.disableTopOnFirst=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToTop+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).first();a(e).find("["+t.selectors.moveToTop+"]").addClass("disabled")})},t.disableBottomOnLast=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToBottom+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).last();a(e).find("["+t.selectors.moveToBottom+"]").addClass("disabled")})},t.bindEvents()},(NestedPages=NestedPages||{}).TrashWithChildren=function(){var t=this,a=jQuery;return t.post_id="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.trashWithChildrenButton,function(e){e.preventDefault(),t.post_id=a(this).attr("data-post-id"),t.trash()})},t.trash=function(){a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.trashWithChildren,nonce:NestedPages.jsData.nonce,post_id:t.post_id,screen:nestedpages.current_page},success:function(e){window.location.replace(e.redirect)},error:function(e){console.log(e)}})},t.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var t=this,n=jQuery;return t.button=null,t.postData=null,t.modal=null,t.parent_li=null,t.formatter=new NestedPages.Formatter,t.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},t.bindEvents=function(){nestedpages.wpml&&n(document).on("click","["+t.selectors.translationsBtn+"]",function(e){e.preventDefault(),t.createTranslationsModal(n(this))})},t.createTranslationsModal=function(e){t.parent_li=n(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),t.button=n(t.parent_li).find(NestedPages.selectors.quickEditOpen),t.postData={id:n(t.button).attr("data-id"),title:n(t.button).attr("data-title"),slug:n(t.button).attr("data-slug")},t.modal=n("["+t.selectors.modal+"]").clone(),0<n(t.parent_li).children("ol").length?(e=n(t.parent_li).children("ol"),n(t.modal).insertBefore(e)):n(t.modal).appendTo(t.parent_li),n(t.modal).find("["+t.selectors.title+"]").text(t.postData.title),t.formatter.showQuickEdit(),n(t.modal).show(),t.getTranslationData()},t.getTranslationData=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:t.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(t.postData.id),"success"===e.status?t.populateModal(e.translations):(n(t.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),t.toggleLoading(!1))}})},t.populateModal=function(a){var s="<tbody>";n.each(a,function(e,t){e=a[e];s+="<tr>",s+='<td><img src="'+e.country_flag_url+'" alt="'+e.translated_name+'" /> '+e.translated_name+"</td>",s+="<td>",e.has_translation&&e.edit_link?s+='<a href="'+e.edit_link+'">'+e.translation.post_title+" ("+nestedpages.edit+")</a>":s+='<a href="'+e.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",s+="</td>",s+="</tr>"}),s+="</tbody>",n(t.modal).find("["+t.selectors.table+"]").html(s),t.toggleLoading(!1)},t.toggleLoading=function(e){e?n(t.modal).addClass("loading"):n(t.modal).removeClass("loading")},t.bindEvents()};
assets/js/nestedpages.min.js CHANGED
@@ -1 +1 @@
1
- var NestedPages=NestedPages||{};NestedPages.Formatter=function(){var s=this,i=jQuery;s.updateSubMenuToggle=function(){for(var e=i(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a,s=e[t],n=i(s).parent(".row").parent("li");0<i(n).children("ol").length?i(n).children("ol").find("li.page-row").length<1?i(n).children("ol").hide():(a='<div class="child-toggle-spacer"></div>',a+='<a href="#"',0<i(n).children("ol:visible").length&&(a+=' class="open"'),a+='><span class="np-icon-arrow"></span></a>',i(s).html(a),0<i(n).children("ol").children(".np-hide").length&&0===i(n).children("ol").children(".np-hide.shown").length?i(s).find("a").hide():0<i(n).children("ol").children(".np-hide").length&&0<i(n).children("ol").children(".np-hide.shown").length&&i(s).find("a").show(),0<i(n).children("ol").find(".page-row").not(".np-hide").length&&i(s).find("a").show()):i(s).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){i(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),i.each(i(NestedPages.selectors.lists),function(){i(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){s.setIndent()},s.setIndent=function(){var n="1"===nestedpages.non_indent?20:30,o="1"===nestedpages.non_indent?".row-inner":".child-toggle";i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=a*n+s,i(this).find(o).css("padding-left",s+"px")):(a<1&&i(this).find(o).css("padding-left","0px"),NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px"))})},s.setClassicIndent=function(){i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=20*a+s,i(this).find(".row-inner").css("padding-left",s+"px")):NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){var t,a;NestedPages.jsData.nestable&&(t=40*i(e.placeholder).parents("ol").length-40,a=i(NestedPages.selectors.sortable).width()-t,i(e.placeholder).width(a).css("margin-left",t+"px")),s.updateListVisibility(e)},s.updateListVisibility=function(e){e=i(e.placeholder).parent("ol");i(e).is(":visible")||(i(e).addClass("nplist"),i(e).show())},s.removeQuickEdit=function(){i(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),i(".sortable .quick-edit").remove(),i(".row").show()},s.showQuickEdit=function(){i("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){i(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){i(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){i(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){i(NestedPages.selectors.ajaxError).find("p").text(e),i(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){i(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=i(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=i(e).width(),a=i(e).height();i.each(i(NestedPages.selectors.thumbnailContainerLink),function(){i(this).width(t),i(this).height(a)})}},(NestedPages=NestedPages||{}).Dropdowns=function(){var t=this,a=jQuery;return t.dropdown="",t.activeBtn="",t.activeContent="",t.toggleBtn="[data-dropdown-toggle]",t.dropdownContainer="[data-dropdown]",t.dropdownContent="[data-dropdown-content]",t.selectors={caret_up:"icon-arrow_drop_up",caret_down:"icon-arrow_drop_down"},t.bindEvents=function(){a(document).on("click",t.toggleBtn,function(e){e.preventDefault(),t.activeBtn=a(this),t.dropdown=a(this).parents(t.dropdownContainer),t.toggleDropdown()}),a(document).on("click",function(e){t.closeDropdowns(e.target)}),a(document).on("dropdown-opened",function(e,t){0<a(t).parents(NestedPages.selectors.row).length&&a(t).parents(NestedPages.selectors.row).addClass("active")}),a(document).on("dropdown-closed",function(){a(NestedPages.selectors.row).removeClass("active")})},t.toggleDropdown=function(){a("."+t.selectors.caret_up).attr("class",t.selectors.caret_down);var e=a(t.dropdown).find(t.dropdownContent);if(t.activeContent=e,a(e).hasClass("active"))return a(e).removeClass("active"),a(t.activeBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),void a(document).trigger("dropdown-closed",e);t.setPositioning(),a(t.toggleBtn).removeClass("active"),a(t.dropdownContent).removeClass("active"),a(e).addClass("active"),a(t.activeBtn).find("."+t.selectors.caret_down).attr("class",t.selectors.caret_up),a(t.activeBtn).addClass("active"),a(document).trigger("dropdown-opened",e)},t.setPositioning=function(){var e=a(t.activeBtn).outerHeight();a(t.activeContent).css("top",e+"px")},t.closeDropdowns=function(e){0===a(e).parents(t.dropdownContainer).length&&(a(t.dropdownContent).removeClass("active"),a(t.toggleBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),a(document).trigger("dropdown-closed",void 0))},t.bindEvents()},(NestedPages=NestedPages||{}).Modals=function(){var a=this,s=jQuery;return a.activeBtn="",a.activeModal="",a.modalOpen=!1,a.selectors={toggleBtn:"[data-nestedpages-modal-toggle]",backdrop:"[data-nestedpages-modal-backdrop]",closeBtn:"[data-nestedpages-modal-close]",title:"data-nestedpages-modal-title",content:"data-nestedpages-modal-content"},a.bindEvents=function(){s(document).on("click",a.selectors.toggleBtn,function(e){e.preventDefault(),a.activeBtn=s(this),a.openModal()}),s(document).on("click",a.selectors.closeBtn,function(e){e.preventDefault(),a.closeModals()}),s(document).on("open-modal-manual",function(e,t){a.activeModal=s('[data-nestedpages-modal="'+t+'"]'),a.openModal()}),s(document).on("close-modal-manual",function(e){a.closeModals()}),s(document).on("click",a.selectors.backdrop,function(e){a.closeModals()}),s(document).ready(function(){a.checkHash()})},a.openModal=function(){var e;a.modalOpen?a.closeModals():(0<s(a.activeBtn).length&&(e=s(a.activeBtn).attr("data-nestedpages-modal-toggle"),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]')),s(a.activeModal).addClass("active"),a.modalOpen=!0,a.populateModal(),s(document).trigger("open-modal",[a.activeBtn,a.activeModal]))},a.closeModals=function(){a.modalOpen=!1,s("[data-nestedpages-modal]").removeClass("active"),a.activeModal="",a.activeBtn=""},a.populateModal=function(){var e=s(a.activeBtn).attr(a.selectors.title);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-title]").text(e);e=s(a.activeBtn).attr(a.selectors.content);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(e)},a.checkHash=function(){var e;window.location.hash&&"#modal"===window.location.hash.substring(0,6)&&(e=window.location.hash.substring(7),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal())},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var a=this,s=jQuery;return a.activeCheckbox="",a.selectors={checkbox:"[data-np-check-all]"},a.bindEvents=function(){s(document).on("change",a.selectors.checkbox,function(){a.activeCheckbox=s(this),a.toggleCheckboxes()}),s(document).on("change","input[type=checkbox]",function(){a.checkAllStatus(s(this))})},a.init=function(){a.bindEvents()},a.toggleCheckboxes=function(){var t=!!s(a.activeCheckbox).is(":checked"),e=s(a.activeCheckbox).attr("data-np-check-all"),e=s('*[name="'+e+'"]');s.each(e,function(){var e=s(this).parents(NestedPages.selectors.rows);s(this).prop("checked",t),s(e).hasClass("np-hide")&&!s(e).is(":visible")&&s(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),a.toggleCheckAll()},a.toggleCheckAll=function(){var e=s(a.activeCheckbox).attr("data-np-check-all"),t=(t=s('*[name="'+e+'"]').length)-s(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+s(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length,e=s('*[name="'+e+'"]:checked').length;if(t==e)return s(a.activeCheckbox).prop("checked",!0),void s(a.activeCheckbox).removeClass("check-all-partial");0<e?s(a.activeCheckbox).addClass("check-all-partial"):(s(a.activeCheckbox).attr("checked",!1),s(a.activeCheckbox).removeClass("check-all-partial"))},a.checkAllStatus=function(e){e=s(e).attr("name"),e=s('*[data-np-check-all="'+e+'"]');0!==e.length&&(a.activeCheckbox=s(e)[0],a.toggleCheckAll())},a.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var n=this,o=jQuery;return n.selectedNumber=0,n.selectedLinks=[],n.selectedPosts=[],n.bindEvents=function(){o(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){n.toggleBulkForm()}),o(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===o("select[name=np_bulk_action]").val()&&(e.preventDefault(),n.toggleBulkEdit(!0))}),o(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();e=o(this).siblings("input[type=hidden]").val();n.uncheckBulkItem(e)}),o(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),n.uncheckAllBulkItems()})},n.toggleBulkForm=function(){var t=!1,a="",s="";if(n.selectedPosts=[],n.selectedLinks=[],o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){var e;o(this).is(":checked")&&(e=o(this).parents(NestedPages.selectors.rows),t=!0,o(this).parent("div").hasClass("np-check-all")||o(e).hasClass("post-type-np-redirect")||(a+=o(this).val()+","),o(e).hasClass("post-type-np-redirect")&&(s+=o(this).val()+",",n.selectedLinks.push(o(this).val())),"np-redirect"===o(this).attr("data-np-post-type")||o(this).parent("div").hasClass("np-check-all")||((e=[]).title=o(this).attr("data-np-bulk-checkbox"),e.id=o(this).val(),n.selectedPosts.push(e)))}),n.setBulkEditPosts(),n.toggleEditOption(),n.toggleLinkCountAlert(),t)return o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkActionsIds).val(a),o(NestedPages.selectors.bulkActionRedirectIds).val(s),void n.setSelectedNumber();o(NestedPages.selectors.bulkActionsIds).val(""),o(NestedPages.selectors.bulkActionsForm).hide()},n.setBulkEditPosts=function(){for(var e="",t=0;t<n.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>&times;</a>',e+=n.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+n.selectedPosts[t].id+'"></li>';o(NestedPages.selectors.bulkEditTitles).html(e)},n.uncheckBulkItem=function(e){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).val()==e&&o(this).prop("checked",!1).change()}),0===o(NestedPages.selectors.bulkEditRemoveItem).length&&n.toggleBulkEdit(!1)},n.uncheckAllBulkItems=function(){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).prop("checked",!1).change()}),n.toggleBulkEdit(!1)},n.setSelectedNumber=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option").first();o(t).text(nestedpages.bulk_actions+" ("+e+")")},n.toggleEditOption=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return o(t).prop("disabled",!0),o(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void n.toggleBulkEdit(!1);o(t).prop("disabled",!1)},n.toggleBulkEdit=function(e){if(n.toggleLinkCountAlert(),e)return n.disableParentOptions(),o(NestedPages.selectors.bulkEditForm).show(),o(NestedPages.selectors.bulkActionsForm).hide(),void n.setWPSuggest();o(NestedPages.selectors.bulkEditForm).hide(),o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),o(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),n.resetBulkEditFields()},n.toggleLinkCountAlert=function(){0!==n.selectedLinks.length?o(NestedPages.selectors.bulkEditLinkCount).parent("div").show():o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},n.disableParentOptions=function(){for(var e=o(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<n.selectedPosts.length;t++)o(e).find("option[value="+n.selectedPosts[t].id+"]").attr("disabled",!0)},n.setWPSuggest=function(){var e=o(NestedPages.selectors.bulkEditForm).find("[data-autotag]");o.each(e,function(e,t){var a=o(this).attr("data-taxonomy");o(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},n.resetBulkEditFields=function(){var e=o(NestedPages.selectors.bulkEditForm).find("select");o.each(e,function(){o(this).find("option").first().prop("selected",!0),o(this).find("option").removeAttr("disabled")});e=o(NestedPages.selectors.bulkEditForm).find(".cat-checklist");o.each(e,function(){o(this).find("input[type=checkbox]").prop("checked",!1)})},n.bindEvents()},(NestedPages=NestedPages||{}).HiddenItemCount=function(){var e=this,a=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){a(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var t=0;a.each(a(NestedPages.selectors.bulkActionsCheckbox),function(){var e;a(this).is(":checked")&&(a(this).parent("div").hasClass("np-check-all")||(e=a(this).closest(".page-row"),a(e).is(":visible")||t++))}),t<1?a(NestedPages.selectors.hiddenItemCountParent).hide():(a(NestedPages.selectors.hiddenItemCount).text(t),a(NestedPages.selectors.hiddenItemCountParent).show())},e.init()},(NestedPages=NestedPages||{}).MenuToggle=function(){var a=this,n=jQuery;return a.formatter=new NestedPages.Formatter,a.bindEvents=function(){n(document).on("click",NestedPages.selectors.childToggleLink,function(e){e.preventDefault(),a.toggleSingleMenu(n(this))}),n(document).on("click",NestedPages.selectors.toggleAll,function(e){e.preventDefault(),a.toggleAllMenus()})},a.toggleSingleMenu=function(e){var t=n(e).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");n(e).toggleClass("open"),n(t).toggle(),a.formatter.setBorders(),a.formatter.setNestedMargins(),a.syncUserToggles()},a.toggleAllMenus=function(){var e=NestedPages.selectors.toggleAll;if("closed"===n(e).attr("data-toggle"))return n(NestedPages.selectors.lists).show(),n(e).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),n(NestedPages.selectors.childToggle+" a").addClass("open"),a.formatter.setBorders(),void a.syncUserToggles();n(NestedPages.selectors.lists).not(n(NestedPages.selectors.lists)[0]).hide(),n(e).attr("data-toggle","closed").text(NestedPages.jsData.expandText),n(NestedPages.selectors.childToggle+" a").removeClass("open"),a.formatter.setBorders(),a.syncUserToggles()},a.visibleRowIDs=function(){var s=[],e=n(NestedPages.selectors.rows+":visible");return n.each(e,function(e,t){var a=n(this).attr("id");s.push(a.replace("menuItem_",""))}),s},a.syncUserToggles=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:a.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},a.bindEvents()},(NestedPages=NestedPages||{}).PageToggle=function(){var a=this,s=jQuery;return a.activeButton="",a.formatter=new NestedPages.Formatter,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.toggleHidden,function(e){e.preventDefault(),a.activeButton=s(this),a.toggleHidden()}),s(document).on("click",NestedPages.selectors.toggleStatus,function(e){e.preventDefault(),a.toggleStatus(s(this))})},a.toggleHidden=function(){var e=s(a.activeButton),t=s(e).attr("href");if("#show"==t)return s(e).attr("href","#hide").text(NestedPages.jsData.showHiddenText),s(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),a.formatter.updateSubMenuToggle(),void a.formatter.setBorders();"#hide"==t&&(s(e).attr("href","#show").text(NestedPages.jsData.hideHiddenText),s(NestedPages.selectors.hiddenRows).addClass("shown").show(),a.formatter.updateSubMenuToggle(),a.formatter.setBorders())},a.toggleStatus=function(e){var t=(t=s(e).attr("href")).substring(1);s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),a.saveStatusPreference(t),"draft"==t&&(s(NestedPages.selectors.syncCheckbox).attr("disabled",!0),s("."+t).addClass("nested-visible")),"all"!=t?(s(NestedPages.selectors.rows).hide(),s("."+t).show()):s(NestedPages.selectors.rows).show()},a.saveStatusPreference=function(e){s.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.toggleStatusDisplay,nonce:NestedPages.jsData.nonce,status:e,post_type:NestedPages.jsData.posttype}})},a.bindEvents()},(NestedPages=NestedPages||{}).Nesting=function(){var n=this,o=jQuery;n.formatter=new NestedPages.Formatter,n.initializeSortable=function(){if(!NestedPages.jsData.nestable)return n.initializeSortableFlat();o(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",tabSize:56,isAllowed:function(e,t,a){return!(o(t).hasClass("post-type-np-redirect")&&!o(a).hasClass("post-type-np-redirect"))},start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})},n.initializeSortableFlat=function(){var e=o(NestedPages.selectors.lists).not(NestedPages.selectors.notSortable);o.each(e,function(){o(this).sortable({items:">"+NestedPages.selectors.rows,handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",forcePlaceholderSize:!0,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})})},n.disableNesting=function(){o(NestedPages.selectors.sortable).sortable("destroy")},n.syncNesting=function(e,t){var a,s;"1"===nestedpages.manual_order_sync&&!e||(o(NestedPages.selectors.errorDiv).hide(),o(NestedPages.selectors.loadingIndicator).show(),s=!!o(NestedPages.selectors.lists).first().hasClass("filtered"),a=NestedPages.jsData.nestable&&!s?o(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):n.setNestingArray(),n.disableNesting(),e=NestedPages.jsData.syncmenu,"1"===nestedpages.manual_menu_sync&&(e="nosync"),o.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:a,post_type:NestedPages.jsData.posttype,syncmenu:e,filtered:s},success:function(e,t){n.initializeSortable(),"error"===e.status?(o(NestedPages.selectors.errorDiv).text(e.message).show(),o(NestedPages.selectors.loadingIndicator).hide()):t&&"function"==typeof t?t():o(NestedPages.selectors.loadingIndicator).hide()}}))},n.setNestingArray=function(e){return ret=[],o(NestedPages.selectors.lists).first().children("li.page-row").each(function(){var e=n.recursiveNesting(this);ret.push(e)}),ret},n.recursiveNesting=function(e){var t,a=o(e).attr("id");if(a)return a=a.replace("menuItem_",""),t={id:a},0<o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).length&&(t.children=[],o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).each(function(){var e=n.recursiveNesting(this);t.children.push(e)})),t}},(NestedPages=NestedPages||{}).SyncMenuSetting=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.init=function(){t.bindEvents()},t.bindEvents=function(){e(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&t.syncSetting()}),e(document).on("change",NestedPages.selectors.syncCheckbox,function(){t.syncSetting()})},t.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==e(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=e(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",e.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncMenu,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:NestedPages.jsData.syncmenu},success:function(e){"error"===e.status&&t.formatter.showAjaxError(e.message)},error:function(e){console.log(e)}}))},t.bindEvents()},(NestedPages=NestedPages||{}).NewPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.parent_id=0,r.posts="",r.form="",r.bindEvents=function(){d(document).on("open-modal",function(e,t,a){t=d(t).attr("data-nestedpages-modal-toggle");void 0!==t&&"np-bulk-modal"==t&&r.openModal()}),d(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),d(document).on("click",NestedPages.selectors.newPageSubmitButton,function(e){e.preventDefault(),r.submitForm(d(this))}),d(document).on("click",NestedPages.selectors.newPageTitle,function(e){e.preventDefault(),r.addTitleField(d(this))}),d(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(e){e.preventDefault(),r.removeTitleField(d(this))}),d(document).on("click",NestedPages.selectors.addChildButton,function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click",NestedPages.selectors.cancelNewChildButton,function(e){e.preventDefault(),r.cancelNewPage()}),d(document).on("click","["+NestedPages.selectors.newBeforeButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click","["+NestedPages.selectors.newAfterButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("keydown",function(e){27===e.keyCode&&(r.cancelNewPage(),d(document).click())})},r.openModal=function(){var e=d(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);d(e).addClass("in-modal"),d(NestedPages.selectors.newPageModal).find(".modal-body").html(e),d(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),d(NestedPages.selectors.newPageModal).find(".page_parent_id").val(r.parent_id),d(e).find(".np_title").first().focus(),d(e).find(NestedPages.selectors.newPageTitle).first().prop("tabindex","2")},r.openQuickEdit=function(e){var t,a=void 0!==(a=d(e).attr(NestedPages.selectors.newBeforeButton))&&""!==a&&a,s=void 0!==(s=d(e).attr(NestedPages.selectors.newAfterButton))&&""!==s&&s,n=d(e).closest(NestedPages.selectors.row).parent("li"),o=d(NestedPages.selectors.newPageFormContainer).clone();0<d(n).children("ol").length?(t=d(n).children("ol"),d(o).insertBefore(t)):d(o).appendTo(n),d(o).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(o).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),a||s||d(o).find(".page_parent_id").val(d(e).attr("data-id")),a&&(d(o).find(".page_before_id").val(a),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),s&&(d(o).find(".page_after_id").val(s),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(o).show(),d(o).find(".np_title").focus(),d(o).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},r.cancelNewPage=function(){r.formatter.removeQuickEdit(),d(NestedPages.selectors.newChildError).hide(),d(NestedPages.selectors.newPageModal).find(".modal-body").empty(),d(NestedPages.selectors.sortable).find(".new-child").remove(),d(NestedPages.selectors.row).show()},r.addTitleField=function(e){var t=d(e).parents("form"),a=d(e).siblings(".new-page-titles").children("li").length+1,s='<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg><div class="form-control new-child-row"><label>'+NestedPages.jsData.titleText+'</label><div><input type="text" name="post_title[]" class="np_title" placeholder="'+NestedPages.jsData.titleText+'" value="" tabindex="'+a+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';d(e).siblings(".new-page-titles").append(s);d(t).find(".np_title").last().focus(),d(t).find(NestedPages.selectors.newPageTitle).prop("tabindex",+a),d(".new-page-titles").sortable({items:"li",handle:".handle"}),r.toggleAddEditButton(t)},r.removeTitleField=function(e){var t=d(e).parents("form");d(e).parents(".new-child-row").parent("li").remove(),r.toggleAddEditButton(t)},r.submitForm=function(e){r.toggleLoading(!0),r.form=d(e).parents("form");var t=!!d(e).hasClass("add-edit"),e=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(e=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(e=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+e+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){if("error"===e.status)return r.toggleLoading(!1),void d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show();!0!=t?(r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()):(e=(e=e.new_pages[0].edit_link).replace(/&amp;/g,"&"),window.location.replace(e))},error:function(e){console.log(e),r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},r.addPosts=function(){var e,t=""!==(t=d(r.form).find(".page_before_id").val())&&t,a=""!==(a=d(r.form).find(".page_after_id").val())&&a,s=d(r.form).parent(".new-child").parent(".page-row");for(0!==d(s).children("ol").length||t||a||d(s).append('<ol class="nplist"></ol>'),e=d(r.form).hasClass("in-modal")?d(".nplist.sortable li.page-row:first"):d(s).children("ol"),i=0;i<r.posts.length;i++)r.appendRows(e,r.posts[i],t,a);t||a||d(e).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n,o='<li id="menuItem_'+t.id+'" class="page-row';"publish"===t.status&&(o+=" published"),o+='">',NestedPages.jsData.hierarchical?(o+='<div class="row">',o+='<div class="child-toggle"></div>'):(o+='<div class="row non-hierarchical">',o+='<div class="non-hierarchical-spacer"></div>'),o+='<div class="row-inner">',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',o+='<a href="'+t.edit_link+'" class="page-link page-title">',o+='<span class="title">'+t.title+"</span>","Publish"!==t.status?o+='<span class="status">('+t.status+")</span>":o+='<span class="status"></span>',o+='<span class="nav-status">',"hide"===t.np_nav_status&&(o+=" "+nestedpages.hidden),o+="</span>",o+='<span class="edit-indicator">Edit</span>',o+="</a>",NestedPages.jsData.hierarchical||(o+='<div class="np-post-columns">',o+='<ul class="np-post-info">',o+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",o+="<li>"+t.date_formatted+"</li>",o+="</ul>",o+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(o+='<span class="np-seo-indicator na"></span>'),o+='<div class="action-buttons">',o+='<div class="nestedpages-dropdown" data-dropdown><a href="#" class="np-btn has-icon toggle" data-dropdown-toggle><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></a><ul class="nestedpages-dropdown-content" data-dropdown-content>',o+='<li><a href="#" class="open-redirect-modal" data-parentid="'+t.id+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'+nestedpages.add_link+"</a></li>",o+='<li><a href="#" class="add-new-child" data-id="'+t.id+'" data-parentname="'+t.title+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'+nestedpages.add_child_short+"</a></li>",o+="</ul></div>",o+='<a href="#" class="np-btn np-quick-edit" data-id="'+t.id+'" data-template="'+t.page_template+'" data-title="'+t.title+'" data-slug="'+t.slug+'" data-commentstatus="closed" data-status="'+t.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+t.author+'" data-template="'+t.template+'" data-month="'+t.month+'" data-day="'+t.day+'" data-year="'+t.year+'" data-hour="'+t.hour+'" data-minute="'+t.minute+'" data-datepicker="'+t.datepicker+'" data-time="'+t.time+'" data-formattedtime="'+t.formattedtime+'" data-ampm="'+t.ampm+'">'+nestedpages.quick_edit+"</a>",o+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",o+='<a href="'+t.delete_link+'" class="np-btn np-btn-trash"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-remove"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" class="icon"/><path d="M0 0h24v24H0z" fill="none"/></svg></a>',o+="</div>\x3c!-- .action-buttons --\x3e",o+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",o+="</li>",a?(n=r.findRowById(a),d(o).insertBefore(n)):s?(n=r.findRowById(s),d(o).insertAfter(n)):d(e).append(o)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){e=d(e).find(".np_title").length;e<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<e?d(NestedPages.selectors.newPageSubmitButton+".add-edit").hide():d(NestedPages.selectors.newPageSubmitButton+".add-edit").show())},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.button="",r.initialData="",r.parent_li="",r.form="",r.flatTerms="",r.termNames="",r.saveButton="",r.newData="",r.row="",r.bindEvents=function(){d(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),r.button=d(this),r.openForm()}),d(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),r.formatter.removeQuickEdit()}),d(document).on("change",".keep_private",function(){this.checked?d(".post_password").val("").prop("readonly",!0):d(".post_password").prop("readonly",!1)}),d(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),r.saveButton=d(this),r.save()}),d(document).on("keydown",function(e){27===e.keyCode&&r.formatter.removeQuickEdit()})},r.openForm=function(){r.setInitialData(),r.createForm(),r.populateForm(),r.populateFlatTaxonomies()},r.setInitialData=function(){r.initialData={id:d(r.button).attr("data-id"),title:d(r.button).attr("data-title"),slug:d(r.button).attr("data-slug"),author:d(r.button).attr("data-author"),cs:d(r.button).attr("data-commentstatus"),status:d(r.button).attr("data-status"),template:d(r.button).attr("data-template"),month:d(r.button).attr("data-month"),day:d(r.button).attr("data-day"),year:d(r.button).attr("data-year"),hour:d(r.button).attr("data-hour"),minute:d(r.button).attr("data-minute"),navstatus:d(r.button).attr("data-navstatus"),navCustomUrl:d(r.button).attr("data-custom-url"),npstatus:d(r.button).attr("data-np-status"),navtitle:d(r.button).attr("data-navtitle"),navtitleattr:d(r.button).attr("data-navtitleattr"),navcss:d(r.button).attr("data-navcss"),linktarget:d(r.button).attr("data-linktarget"),password:d(r.button).attr("data-password"),datepicker:d(r.button).attr("data-datepicker"),time:d(r.button).attr("data-formattedtime"),timeTwentyFour:d(r.button).attr("data-time"),ampm:d(r.button).attr("data-ampm"),timeFormat:d(r.button).attr("data-timeformat"),sticky:d(r.button).attr("data-sticky")};var e=d(r.button)[0].attributes;d.each(e,function(e,t){t.name.includes("data-npcustom")&&(r.initialData[t.name]=t.value)}),r.initialData.h_taxonomies=[],r.initialData.f_taxonomies=[],r.parent_li=d(r.button).closest(NestedPages.selectors.row).parent("li");var t=d(r.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&r.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&r.initialData.f_taxonomies.push(t[i])},r.createForm=function(){var e;r.form=d(NestedPages.selectors.quickEditPostForm).clone(),0<d(r.parent_li).children("ol").length?(e=d(r.parent_li).children("ol"),d(r.form).insertBefore(e)):d(r.form).appendTo(r.parent_li),d(r.form).siblings(NestedPages.selectors.row).hide(),d(r.form).show()},r.populateForm=function(){for(var e in d(r.form).find(".page_id").html("<em>ID:</em> "+r.initialData.id),d(r.form).find(".np_id").val(r.initialData.id),d(r.form).find(".np_title").val(r.initialData.title),d(r.form).find(".np_slug").val(r.initialData.slug),d(r.form).find(".np_author select").val(r.initialData.author),d(r.form).find(".np_status").val(r.initialData.status),d(r.form).find(".np_nav_title").val(r.initialData.navtitle),d(r.form).find(".np_nav_css_classes").val(r.initialData.navcss),d(r.form).find(".np_title_attribute").val(r.initialData.navtitleattr),d(r.form).find(".np_nav_custom_url").val(r.initialData.navCustomUrl),d(r.form).find(".post_password").val(r.initialData.password),d(r.form).find(".np_publish_date").val(r.initialData.datepicker),"open"===r.initialData.cs&&d(r.form).find(".np_cs").attr("checked","checked"),""!==r.initialData.template?d(r.form).find(".np_template").val(r.initialData.template):d(r.form).find(".np_template").val("default"),"private"===r.initialData.status&&(d(r.form).find(".post_password").attr("readonly",!0),d(r.form).find(".keep_private").attr("checked",!0)),"hide"===r.initialData.npstatus?d(r.form).find(".nested_pages_status").attr("checked","checked"):d(r.form).find(".nested_pages_status").removeAttr("checked"),"hide"===r.initialData.navstatus?d(r.form).find(".np_nav_status").attr("checked","checked"):d(r.form).find(".np_nav_status").attr("checked",!1),"_blank"===r.initialData.linktarget?d(r.form).find(".link_target").attr("checked","checked"):d(r.form).find(".link_target").attr("checked",!1),"private"===r.initialData.status&&d(r.form).find(".np_status").val("publish"),"sticky"===r.initialData.sticky?d(r.form).find(".np-sticky").attr("checked","checked"):d(r.form).find(".np-sticky").removeAttr("checked"),"H:i"===r.initialData.timeFormat?d(r.form).find(".np_time").val(r.initialData.timeTwentyFour):(d(r.form).find(".np_time").val(r.initialData.time),d(r.form).find(".np_ampm").val(r.initialData.ampm),d(r.form).find('select[name="mm"]').val(r.initialData.month),d(r.form).find('input[name="jj"]').val(r.initialData.day),d(r.form).find('input[name="aa"]').val(r.initialData.year),d(r.form).find('input[name="hh"]').val(r.initialData.hour),d(r.form).find('input[name="mn"]').val(r.initialData.minute)),r.initialData){var t;e.includes("npcustom")&&r.initialData.hasOwnProperty(e)&&(t=(t=e.replace("data-npcustom-","")).toLowerCase(),d(r.form).find('[data-np-custom-field="'+t+'"]').val(r.initialData[e]))}if(r.populateFlatTaxonomies(),r.initialData.hasOwnProperty("h_taxonomies")){var a=r.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];d(r.form).find(s).attr("checked","checked")}}var n=d(r.form).find(".np_datepicker");d.each(n,function(){var e=d(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){d("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),r.formatter.showQuickEdit(),d(r.form).show()},r.populateFlatTaxonomies=function(){r.initialData.hasOwnProperty("f_taxonomies")&&(r.createTaxonomyObject(),r.getTermNames(),r.setWPSuggest())},r.createTaxonomyObject=function(){var e={};for(i=0;i<r.initialData.f_taxonomies.length;i++){var t=r.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),a=(a=a.splice(s+1)).join("-"),s=t.split("-").splice(0,s);s.shift("inf");s=s.join("-");s in e||(e[s]=[]),e[s].push(a)}r.flatTerms=e},r.getTermNames=function(){d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:r.flatTerms},success:function(e){r.termNames=e.terms,r.populateFlatTaxonomyFields()}})},r.populateFlatTaxonomyFields=function(){r.termNames&&d.each(r.termNames,function(e,t){e=d("#"+e+"-quickedit");d(e).val(t.join(","))})},r.setWPSuggest=function(){var e=d(r.form).find("[data-autotag]");d.each(e,function(e,t){var a=d(this).attr("data-taxonomy");d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},r.save=function(){r.toggleLoading(!0),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(r.toggleLoading(!1),r.newData=e.post_data,r.updatePostRow())},error:function(e){console.log(e)}})},r.updatePostRow=function(){r.row=d(r.button).parents(".row-inner"),d(r.row).find(".title").text(r.newData.post_title),d(r.row).find(".np-view-button").attr("href",r.newData.permalink);var e,t=d(r.row).find(".status");"publish"!==r.newData._status&&"future"!==r.newData._status?(e=nestedpages.post_statuses[r.newData._status].label,d(t).text("("+e+")")):d(t).text(""),"private"===r.newData.keep_private&&d(t).text(nestedpages.private),""!==r.newData.post_password&&void 0!==r.newData.post_password&&(a=d(t).text(),a+=' <span class="locked">',a+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>',a+="</span>",d(t).html(a));var a=d(r.row).find(".nav-status");"hide"==r.newData.nav_status?d(a).text("(Hidden)"):d(a).text("");a=d(r.row).parent("li");"hide"==r.newData.np_status?(d(a).addClass("np-hide"),d(r.row).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(d(a).removeClass("np-hide"),d(r.row).find(".status-np-hidden").remove());a=d(r.row).find(".sticky");"sticky"==r.newData.sticky?d(a).show():d(a).hide(),NestedPages.jsData.hierarchical||d(r.row).find(".np-author-display").text(r.newData.author_name);var s,n,o=d(r.row).find(NestedPages.selectors.quickEditOpen);for(s in d(o).attr("data-id",r.newData.post_id),d(o).attr("data-template",r.newData.page_template),d(o).attr("data-title",r.newData.post_title),d(o).attr("data-slug",r.newData.post_name),d(o).attr("data-commentstatus",r.newData.comment_status),d(o).attr("data-status",r.newData._status),d(o).attr("data-sticky",r.newData.sticky),"private"===r.newData.keep_private&&d(o).attr("data-status","private"),d(o).attr("data-author",r.newData.post_author),d(o).attr("data-np-status",r.newData.np_status),d(o).attr("data-password",r.newData.post_password),d(o).attr("data-navstatus",r.newData.nav_status),d(o).attr("data-navtitle",r.newData.np_nav_title),d(o).attr("data-linktarget",r.newData.link_target),d(o).attr("data-navtitleattr",r.newData.np_title_attribute),d(o).attr("data-navcss",r.newData.np_nav_css_classes),d(o).attr("data-month",r.newData.mm),d(o).attr("data-day",r.newData.jj),d(o).attr("data-year",r.newData.aa),d(o).attr("data-hour",r.newData.hh),d(o).attr("data-minute",r.newData.mn),d(o).attr("data-datepicker",r.newData.np_date),d(o).attr("data-time",r.newData.np_time),d(o).attr("data-formattedtime",r.newData.np_time),d(o).attr("data-ampm",r.newData.np_ampm),r.newData)s.includes("np_custom")&&r.newData.hasOwnProperty(s)&&(n=s.replace("np_custom_","data-npcustom-"),d(o).attr(n,r.newData[s]));r.removeTaxonomyClasses(),r.addCategoryClasses(),r.addHierarchicalClasses(),r.addFlatClasses(),r.addStatusClass(),r.formatter.removeQuickEdit(),r.formatter.flashRow(r.row)},r.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)d(r.row).removeClass(e[i]);d(r.row).addClass(r.newData._status)},r.removeTaxonomyClasses=function(){taxonomies=[];var e=d(r.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&d(r.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&d(r.row).removeClass(e[i])},r.addCategoryClasses=function(){if(r.newData.hasOwnProperty("post_category")){var e=r.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];d(r.row).addClass(t)}}},r.addHierarchicalClasses=function(){var e;r.newData.hasOwnProperty("tax_input")&&(e=r.newData.tax_input,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];d(r.row).addClass(a)}}))},r.addFlatClasses=function(){var e;r.newData.hasOwnProperty("flat_tax")&&(e=r.newData.flat_tax,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];d(r.row).addClass(a)}}))},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(r.saveButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(r.saveButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.button="",a.postData="",a.newPostData="",a.form="",a.bindEvents=function(){s(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),a.formatter.removeQuickEdit(),a.button=s(this),a.openQuickEdit()}),s(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&a.formatter.removeQuickEdit()})},a.openQuickEdit=function(){a.setData(),a.createForm(),a.populateForm()},a.setData=function(){a.postData={id:s(a.button).attr("data-id"),url:s(a.button).attr("data-url"),title:s(a.button).attr("data-title"),status:s(a.button).attr("data-status"),navstatus:s(a.button).attr("data-navstatus"),npstatus:s(a.button).attr("data-np-status"),linktarget:s(a.button).attr("data-linktarget"),parentid:s(a.button).attr("data-parentid"),navtitleattr:s(a.button).attr("data-navtitleattr"),navcss:s(a.button).attr("data-navcss"),navtype:s(a.button).attr("data-nav-type"),navobject:s(a.button).attr("data-nav-object"),navobjectid:s(a.button).attr("data-nav-object-id"),navoriginallink:s(a.button).attr("data-nav-original-link"),navoriginaltitle:s(a.button).attr("data-nav-original-title")}},a.createForm=function(){var e,t=s(a.button).closest(NestedPages.selectors.row).parent("li");a.form=s(NestedPages.selectors.quickEditLinkForm).clone(),0<s(t).children("ol").length?(e=s(t).children("ol"),s(a.form).insertBefore(e)):s(a.form).appendTo(t);s(a.form).siblings(NestedPages.selectors.row).hide()},a.populateForm=function(){var e;s(a.form).find(".np_id").val(a.postData.id),s(a.form).find(".np_title").val(a.postData.title),s(a.form).find(".np_author select").val(a.postData.author),s(a.form).find(".np_status").val(a.postData.status),s(a.form).find(".np_content").val(a.postData.url),s(a.form).find(".np_parent_id").val(a.postData.parentid),s(a.form).find(".np_title_attribute").val(a.postData.navtitleattr),s(a.form).find(".np_nav_css_classes").val(a.postData.navcss),"hide"===a.postData.npstatus?s(a.form).find(".np_status").prop("checked","checked"):s(a.form).find(".np_status").removeAttr("checked"),"hide"===a.postData.navstatus?s(a.form).find(".np_nav_status").prop("checked","checked"):s(a.form).find(".np_nav_status").removeAttr("checked"),"_blank"===a.postData.linktarget?s(a.form).find(".link_target").prop("checked","checked"):s(a.form).find(".link_target").removeAttr("checked"),"custom"!==a.postData.navobject&&""!==a.postData.navobject?(e='<div class="form-control original-link">Original: <a href="'+a.postData.navoriginallink+'" target="_blank">'+a.postData.navoriginaltitle+"</a></div>",s(a.form).find("[data-url-field]").remove(),s(e).insertAfter(s(a.form).find("h3")),s(a.form).find("[data-np-menu-object-input]").val(a.postData.navobject),s(a.form).find("[data-np-menu-objectid-input]").val(a.postData.navobjectid),s(a.form).find("[data-np-menu-type-input]").val(a.postData.navtype),s(a.form).find("h3").text("Link: "+a.postData.navoriginaltitle)):(s(a.form).find("h3").text("Link"),s(a.form).find("[data-np-menu-object-input]").val("custom"),s(a.form).find("[data-np-menu-type-input]").val("custom")),a.formatter.showQuickEdit(),s(a.form).show()},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:s(a.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(a.toggleLoading(!1),a.newPostData=e.post_data,a.updateRow())},error:function(e){a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},a.updateRow=function(){var e=s(a.form).siblings(".row");s(e).find(".title").html(a.newPostData.post_title+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>');var t=s(e).find(".status");"publish"!==a.newPostData._status&&"future"!==a.newPostData._status?s(t).text("("+a.newPostData._status+")"):s(t).text("");t=s(e).find(".nav-status");"hide"==a.newPostData.nav_status?s(t).text("("+NestedPages.jsData.hiddenText+")"):s(t).text("");t=s(e).parent("li");"hide"==a.newPostData.np_status?(s(t).addClass("np-hide"),s(e).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(s(t).removeClass("np-hide"),s(e).find(".status-np-hidden").remove());t=s(e).find(NestedPages.selectors.quickEditButtonLink);s(t).attr("data-id",a.newPostData.post_id),s(t).attr("data-title",a.newPostData.post_title),s(t).attr("data-url",a.newPostData.post_content),s(t).attr("data-status",a.newPostData._status),s(t).attr("data-navstatus",a.newPostData.nav_status),s(t).attr("data-np-status",a.newPostData.np_status),s(t).attr("data-linkTarget",a.newPostData.linkTarget),s(t).attr("data-navtitleattr",a.newPostData.titleAttribute),s(t).attr("data-navcss",a.newPostData.cssClasses),a.formatter.removeQuickEdit(),a.formatter.flashRow(e)},a.toggleLoading=function(e){if(s(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return s(NestedPages.selectors.quickEditErrorDiv).hide(),s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void s(NestedPages.selectors.quickEditLoadingIndicator).show();s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),s(NestedPages.selectors.quickEditLoadingIndicator).hide()},a.bindEvents()},(NestedPages=NestedPages||{}).Clone=function(){var t=this,a=jQuery;return t.parent_id="",t.parent_title="",t.parentLi=null,t.formatter=new NestedPages.Formatter,t.bindEvents=function(){a(document).on("click",NestedPages.selectors.cloneButton,function(e){e.preventDefault(),t.parent_id=a(this).attr("data-id"),t.parent_title=a(this).attr("data-parentname"),t.parentLi=a(this).parent(".row").parent(".page-row").parent(".npList"),t.openModal()}),a(document).on("click",NestedPages.selectors.confirmClone,function(e){e.preventDefault(),t.clone()})},t.openModal=function(){a("#"+NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(t.parent_title),a(document).trigger("open-modal-manual",NestedPages.selectors.cloneModal)},t.clone=function(){t.toggleLoading(!0),a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:t.parent_id,quantity:a(NestedPages.selectors.cloneQuantity).val(),status:a(NestedPages.selectors.cloneStatus).val(),author:a(NestedPages.selectors.cloneAuthor).find("select").val(),nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(e){t.toggleLoading(!1),a(document).trigger("close-modal-manual"),location.reload()}})},t.toggleLoading=function(e){if(e)return a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void a(NestedPages.selectors.confirmClone).attr("disabled","disabled");a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),a(NestedPages.selectors.confirmClone).attr("disabled",!1)},t.bindEvents()},(NestedPages=NestedPages||{}).Tabs=function(){var r=this,d=jQuery;return r.selectors={tabToggle:"data-np-tab-toggle",tabPane:"data-np-tab-pane",tabGroup:"data-np-tab-group"},r.bindEvents=function(){d(document).on("click","["+r.selectors.tabToggle+"]",function(e){e.preventDefault(),r.toggleTabs(d(this))})},r.toggleTabs=function(e){for(var t=d(e).attr(r.selectors.tabGroup),a=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabPane+"]"),s=d(e).attr(r.selectors.tabToggle),n=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabToggle+"]"),o=[],i=0;i<n.length;i++)o[i]=d(n[i]).parent("li")[0];d(a).hide(),d(n).removeClass("active"),d(o).removeClass("active"),d.each(a,function(){d(this).attr(r.selectors.tabPane)==s&&d(this).show()}),d.each(n,function(){d(this).attr(r.selectors.tabToggle)==s&&(d(this).addClass("active"),d(this).parent("li").addClass("active"))}),d(document).trigger("tabs-changed",[s,t,e])},r.bindEvents()},jQuery(document).ready(function(){new NestedPages.Factory}),(NestedPages=NestedPages||{}).selectors={childToggle:".child-toggle",childToggleLink:".child-toggle a",toggleAll:".nestedpages-toggleall",toggleHidden:".np-toggle-hidden",toggleStatus:".np-toggle-publish",lists:".nplist",rows:".page-row",row:".row",sortable:".sortable",notSortable:".no-sort",handle:".handle",published:".published",hiddenRows:".np-hide",errorDiv:"#np-error",loadingIndicator:"#nested-loading",syncCheckbox:".np-sync-menu",syncForm:".np-sync-menu-cont",ajaxError:"[data-nestedpages-error]",trashWithChildrenButton:"[data-nestedpages-trash-children]",toggleEditButtons:".np-toggle-edit",bulkActionsHeader:".nestedpages-list-header",bulkActionsForm:"[data-np-bulk-form]",bulkActionsCheckbox:"[data-np-bulk-checkbox]",bulkActionsIds:"[data-np-bulk-ids]",bulkActionRedirectIds:"[data-np-bulk-redirect-ids]",hiddenItemCount:"[data-np-hidden-count]",hiddenItemCountParent:"[data-np-hidden-count-parent]",bulkEditForm:"[data-np-bulk-edit-form]",bulkEditTitles:"[data-np-bulk-titles]",bulkEditRemoveItem:"[data-np-remove-bulk-item]",bulkEditCancel:"[data-np-cancel-bulk-edit]",bulkEditLinkCount:"[data-bulk-edit-link-count]",quickEditOverlay:".np-inline-overlay",quickEditLoadingIndicator:".np-qe-loading",quickEditErrorDiv:".np-quickedit-error",quickEditCancel:".np-cancel-quickedit",quickEditButtonLink:".np-quick-edit-redirect",quickEditLinkForm:".quick-edit-form-redirect",quickEditLinkSaveButton:".np-save-quickedit-redirect",quickEditOpen:".np-quick-edit",quickEditPostForm:".quick-edit-form",quickEditSaveButton:".np-save-quickedit",openLinkModal:".open-redirect-modal",linkModal:"np-link-modal",saveLink:".np-save-link",linkLoadingIndicator:".np-link-loading",linkErrorDiv:".np-new-link-error",linkForm:".np-new-link-form",linkDeleteButton:"[data-np-confirm-delete]",linkDeleteConfirmationButton:"[data-delete-confirmation]",linkDeleteConfirmationModal:"np-delete-confirmation-modal",linkDeleteConfirmationModalText:"[data-np-link-delete-text]",openPageModal:".open-bulk-modal",newPageModal:"#np-bulk-modal",newPageFormContainer:".new-child-form",newPageForm:".np-new-child-form",newPageSubmitButton:".np-save-newchild",newPageTitle:".add-new-child-row",newPageRemoveTitle:".np-remove-child",addChildButton:".add-new-child",newChildError:".np-newchild-error",cancelNewChildButton:".np-cancel-newchild",newBeforeButton:"data-insert-before",newAfterButton:"data-insert-after",cloneButton:".clone-post",confirmClone:"[data-confirm-clone]",cloneModal:"np-clone-modal",cloneQuantity:"[data-clone-quantity]",cloneStatus:"[data-clone-status]",cloneAuthor:"[data-clone-author]",tabButtonParent:"[data-np-tabs]",tabButton:"[data-np-tab]",tabContent:"[data-np-tab-pane]",thumbnailContainer:".np-thumbnail",thumbnailContainerLink:".np-thumbnail.link",manualMenuSync:"[data-np-manual-menu-sync]",manualOrderSync:"[data-np-manual-order-sync]"},NestedPages.cssClasses={noborder:"no-border"},NestedPages.jsData={ajaxurl:ajaxurl,nonce:nestedpages.np_nonce,allPostTypes:nestedpages.post_types,syncmenu:"nosync",posttype:"",nestable:!0,sortable:!0,hierarchical:!0,expandText:nestedpages.expand_text,collapseText:nestedpages.collapse_text,showHiddenText:nestedpages.show_hidden,hideHiddenText:nestedpages.hide_hidden,quickEditText:nestedpages.quick_edit,hiddenText:nestedpages.hidden,titleText:nestedpages.title},NestedPages.formActions={syncToggles:"npnestToggle",syncNesting:"npsort",syncMenu:"npsyncMenu",newPage:"npnewChild",newBeforeAfter:"npnewBeforeAfter",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch",wpmlTranslations:"npWpmlTranslations",resetSettings:"npresetSettings",resetUserPrefs:"npresetUserPreferences",resetAdminMenuSettings:"npresetAdminMenuSettings",trashWithChildren:"nptrashWithChildren",toggleStatusDisplay:"nptoggleStatusDisplay"},NestedPages.Factory=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.dropdowns=new NestedPages.Dropdowns,t.modals=new NestedPages.Modals,t.checkAll=new NestedPages.CheckAll,t.bulkActions=new NestedPages.BulkActions,t.menuToggle=new NestedPages.MenuToggle,t.pageToggle=new NestedPages.PageToggle,t.nesting=new NestedPages.Nesting,t.syncMenuSetting=new NestedPages.SyncMenuSetting,t.newPage=new NestedPages.NewPost,t.quickEditLink=new NestedPages.QuickEditLink,t.quickEditPost=new NestedPages.QuickEditPost,t.clone=new NestedPages.Clone,t.tabs=new NestedPages.Tabs,t.menuLinks=new NestedPages.MenuLinks,t.hiddenItemCount=new NestedPages.HiddenItemCount,t.confirmDelete=new NestedPages.ConfirmDelete,t.manualSync=new NestedPages.ManualSync,t.postSearch=new NestedPages.PostSearch,t.postMove=new NestedPages.MovePost,t.wpml=new NestedPages.Wpml,t.trashWithChildren=new NestedPages.TrashWithChildren,t.init=function(){nestedpages.settings_page||(t.bindEvents(),t.setPostType(),t.setMenuSync(),t.setNestable(),t.setSortable(),t.formatter.updateSubMenuToggle(),t.formatter.setBorders(),t.formatter.setNestedMargins(),t.nesting.initializeSortable())},t.bindEvents=function(){e(document).on("click",NestedPages.selectors.quickEditOverlay,function(e){t.formatter.removeQuickEdit(),t.newPage.cancelNewPage()}),e(document).ready(function(){t.formatter.hideAjaxError(),t.formatter.sizeLinkThumbnails()})},t.setNestable=function(){var a=!1;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&(!0===t.hierarchical&&(a=!0),!0===t.disable_nesting&&(a=!1))}),NestedPages.jsData.nestable=a},t.setSortable=function(){var a=!0;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&void 0!==t.disable_sorting&&""!==t.disable_sorting&&"true"===t.disable_sorting&&(a=!1)}),NestedPages.jsData.sortable=a},t.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,void 0!==NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=e(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},t.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},t.init()},(NestedPages=NestedPages||{}).MenuLinks=function(){var a=this,s=jQuery;return a.typeButton="",a.post="",a.formatter=new NestedPages.Formatter,a.selectors={form:"[data-np-menu-item-form]",typeSelect:"[data-np-menu-selection]",accordion:"[data-np-menu-accordion]",accordionItem:"[data-np-menu-accordion-item]",formPlaceholder:".np-menu-link-object-placeholder",formDetails:".np-menu-link-details",searchResults:"[data-np-search-result]",defaultResults:"[data-default-result]",originalLink:"[data-np-original-link]",saveButton:"[data-np-save-link]",urlInputCont:"[data-np-menu-url-cont]",errorDiv:"[data-np-error]"},a.fields={object:"[data-np-menu-object-input]",objectid:"[data-np-menu-objectid-input]",itemType:"[data-np-menu-type-input]",url:"[data-np-menu-url]",navigationLabel:"[data-np-menu-navigation-label]",titleAttribute:"[data-np-menu-title-attr]",cssClasses:"[data-np-menu-css-classes]",npStatus:"[data-np-menu-np-status]",linkTarget:"[data-np-menu-link-target]",menuTitle:"[data-np-menu-title]",parentPostType:"[data-np-menu-parent-post-type]"},a.search=new NestedPages.MenuSearch,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.openLinkModal,function(e){e.preventDefault(),a.postParent=s(this).attr("data-parentid"),s(a.selectors.form).find(".parent_id").val(s(this).attr("data-parentid")),a.openModal()}),s(document).on("click",a.selectors.accordionItem,function(e){e.preventDefault(),a.accordion(s(this))}),s(document).on("click",a.selectors.typeSelect,function(e){e.preventDefault(),a.typeButton=s(this),a.setLinkType()}),s(document).on("keyup",a.fields.navigationLabel,function(){a.updateTitle()}),s(document).on("click",a.selectors.saveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&s(document).trigger("close-modal-manual")})},a.openModal=function(){s(NestedPages.selectors.linkErrorDiv).hide(),s(NestedPages.selectors.linkModal).find("input").val(""),s(NestedPages.selectors.linkModal).find(".parent_id").val(a.postParent),a.clearForm(),s(a.selectors.accordion).find("ul").hide(),s(a.selectors.typeSelect).removeClass("active"),s(document).trigger("open-modal-manual",NestedPages.selectors.linkModal)},a.accordion=function(e){a.clearForm();var t=s(e).siblings("ul");if(s(t).is(":visible"))return s(e).removeClass("active"),void s(t).slideUp("fast");s(a.selectors.accordionItem).removeClass("active"),s(e).addClass("active"),s(e).parents(a.selectors.accordion).find("ul").slideUp("fast"),s(t).slideDown("fast")},a.setLinkType=function(){s(a.typeButton).hasClass("active")?a.clearForm():(s(a.typeButton).hasClass("np-custom-link")&&(s(a.selectors.accordionItem).removeClass("active"),s(a.selectors.accordion).find("ul").slideUp("fast")),s(a.selectors.formPlaceholder).hide(),a.populateForm())},a.populateForm=function(){s(a.selectors.saveButton).show(),s(a.selectors.typeSelect).removeClass("active"),s(a.typeButton).addClass("active"),s(a.fields.menuTitle).text(s(a.typeButton).text()).val(s(a.typeButton).text()),s(a.selectors.form).find("h3").find("em").text(s(a.typeButton).attr("data-np-object-name")),""!==s(a.typeButton).attr("data-np-permalink")?(s(a.selectors.form).find(a.selectors.urlInputCont).hide(),s(a.selectors.form).find(a.selectors.originalLink).html('<a href="'+s(a.typeButton).attr("data-np-permalink")+'">'+s(a.typeButton).text()+"</a>"),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").show()):(s(a.selectors.form).find(a.selectors.urlInputCont).show(),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").hide()),s(a.fields.object).val(s(a.typeButton).attr("data-np-menu-object")),s(a.fields.objectid).val(s(a.typeButton).attr("data-np-menu-objectid")),s(a.fields.itemType).val(s(a.typeButton).attr("data-np-menu-type")),s(a.selectors.formDetails).show()},a.clearForm=function(){s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.saveButton).hide(),s(a.selectors.formDetails).hide(),s(a.selectors.formPlaceholder).show(),s(a.selectors.form).find("input").not(".parent_id").not(".parent-post-type").val(""),s(a.selectors.form).find(a.fields.linkTarget).val("_blank"),s(a.selectors.form).find('input[type="checkbox"]').attr("checked",!1),s(a.selectors.typeSelect).removeClass("active"),a.search.toggleLoading(!1),s(a.selectors.searchResults).remove(),s(a.selectors.defaultResults).show()},a.updateTitle=function(){var e=s(a.fields.navigationLabel).val(),t=s(a.selectors.form).find("h3").find("span");""!==e?(s(a.fields.menuTitle).val(e),s(t).text(e)):(s(a.fields.menuTitle).val(s(a.typeButton).text()),s(t).text(s(a.typeButton).text()))},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:s(a.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(e){a.toggleLoading(!1),"error"!==e.status?(a.post=e.post_data,a.createRow()):s(a.selectors.form).find(a.selectors.errorDiv).text(e.message).show()},error:function(e){console.log(e)}})},a.createRow=function(){var e='<li id="menuItem_'+a.post.id+'" class="page-row post-type-np-redirect published';e+='">',e+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner">',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',e+='<a href="'+a.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+a.post.menuTitle+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></span>',e+='</a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',e+='data-id="'+a.post.id+'"',e+='data-parentid="'+a.post.parent_id+'"',e+='data-title="'+a.post.menuTitle+'" ',e+='data-url="'+a.post.url+'" ',e+='data-status="publish" ',e+='data-np-status="show" ',e+='data-navstatus="show" ',e+='data-navcss="'+a.post.cssClasses+'" ',e+='data-navtitleattr="'+a.post.titleAttribute+'" ',e+='data-nav-type="'+a.post.menuType+'" ',e+='data-nav-object="'+a.post.objectType+'" ',e+='data-nav-object-id="'+a.post.objectId+'" ',e+='data-nav-original-link="'+a.post.original_link+'" ',e+='data-nav-original-title="'+a.post.original_title+'" ',e+='data-linktarget="'+a.post.link_target+'">',e+=NestedPages.jsData.quickEditText,e+="</a>",e+='<a href="'+a.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',e+="</div></div></div></li>","0"===a.post.parent_id?s(".nplist:first li:first").after(e):a.appendChildRow(e),s(document).trigger("close-modal-manual"),a.row=s("#menuItem_"+a.post.id).find(".row"),a.formatter.flashRow(a.row)},a.appendChildRow=function(e){var t=s("#menuItem_"+a.post.parent_id);0===s(t).children("ol").length?(e='<ol class="sortable nplist" style="display:block;">'+e+"</ol>",s(t).append(e)):s(t).find("ol:first").prepend(e),a.formatter.updateSubMenuToggle()},a.toggleLoading=function(e){if(e)return s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void s(a.selectors.saveButton).attr("disabled","disabled");s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),s(a.selectors.saveButton).attr("disabled",!1)},a.bindEvents()},(NestedPages=NestedPages||{}).MenuSearch=function(){var s=this,n=jQuery;return s.selectors={searchForms:"*[data-np-menu-search]",defaultResults:"[data-default-result]",loadingIndicator:".np-menu-search-loading",noResults:".np-menu-search-noresults",searchType:"data-search-type",searchObject:"data-search-object",searchResults:"[data-np-search-result]"},s.activeForm="",s.results="",s.defaultResults="",s.searchType="",s.searchObject="",s.init=function(){s.bindEvents()},s.bindEvents=function(){n(document).on("keyup",s.selectors.searchForms,function(){s.activeForm=n(this),n(s.selectors.searchResults).remove(),s.performSearch()})},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){s.searchType=n(s.activeForm).attr(s.selectors.searchType),s.searchObject=n(s.activeForm).attr(s.selectors.searchObject),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:n(s.activeForm).val(),searchType:s.searchType,searchObject:s.searchObject},success:function(e){console.log(e),e.results?(s.results=e.results,s.toggleLoading(!1),"post_type"===s.searchType?s.appendPosts():s.appendTaxonomies()):(s.toggleLoading(!1),n(s.activeForm).siblings(s.selectors.noResults).show())}})},s.appendPosts=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.ID+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.singular_name+'" data-np-menu-selection>'+t.post_title+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.appendTaxonomies=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.term_id+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.taxonomy+'" data-np-menu-selection>'+t.name+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).siblings(s.selectors.loadingIndicator);n(s.selectors.noResults).hide(),e?n(t).show():n(t).hide()},s.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPagesTrash=function(){var t=this,a=jQuery;return t.trashButton=".np-empty-trash",t.confirmButton=".np-trash-confirm",t.warningModal="#np-trash-modal",t.errorAlert="#np-error",t.loadingIndicator="#nested-loading",t.trashLinks=".np-trash-links",t.postType=a("#np-trash-posttype").val(),t.nonce=nestedpages.np_nonce,t.formAction="npEmptyTrash",t.bindEvents=function(){a(document).on("click",t.confirmButton,function(e){e.preventDefault(),t.confirmEmpty()})},t.confirmEmpty=function(){t.loading(!0),a(document).trigger("close-modal-manual"),a(t.errorAlert).hide(),t.emptyTrash()},t.emptyTrash=function(){a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:t.formAction,nonce:t.nonce,posttype:t.postType},success:function(e){t.loading(!1),"error"===e.status?a(t.errorAlert).text(e.message).show():(a(t.trashLinks).hide(),a(".notice-dismiss").click())}})},t.loading=function(e){e?a(t.loadingIndicator).show():a(t.loadingIndicator).hide()},t.bindEvents()};(NestedPages=NestedPages||{}).ConfirmDelete=function(){var t=this,a=jQuery;return t.deleteLink="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.linkDeleteButton,function(e){e.preventDefault(),t.confirmSingle(a(this))}),a(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(e){e.preventDefault(),a(this).hasClass("bulk")?t.deleteMultiple():t.deleteSingle()}),a(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){t.confirmMultiple(e)})},t.confirmSingle=function(e){t.deleteLink=a(e).attr("href"),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),a(document).trigger("open-modal-manual",NestedPages.selectors.linkDeleteConfirmationModal)},t.confirmMultiple=function(e){"trash"===a('select[name="np_bulk_action"]').val()&&""!==a(NestedPages.selectors.bulkActionRedirectIds).val()&&(e.preventDefault(),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),a(document).trigger("open-modal-manual",[NestedPages.selectors.linkDeleteConfirmationModal]))},t.deleteMultiple=function(){a(NestedPages.selectors.bulkActionsForm)[0].submit()},t.deleteSingle=function(){window.location.replace(t.deleteLink)},t.bindEvents()},(NestedPages=NestedPages||{}).ManualSync=function(){var t=this,a=jQuery;return t.activeBtn="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.manualMenuSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncMenu()}),a(document).on("click",NestedPages.selectors.manualOrderSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncOrder()})},t.syncMenu=function(){t.loading(!0),a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.manualMenuSync,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:"sync"},success:function(e){"error"===e.status?(a(NestedPages.selectors.errorDiv).text(e.message).show(),a(NestedPages.selectors.loadingIndicator).hide()):t.loading(!1)}})},t.syncOrder=function(){t.loading(!0),(new NestedPages.Nesting).syncNesting(!0,t.loading(!1))},t.loading=function(e){if(e)return a(t.activeBtn).addClass("disabled"),void a(NestedPages.selectors.loadingIndicator).show();a(t.activeBtn).removeClass("disabled"),a(NestedPages.selectors.loadingIndicator).hide()},t.bindEvents()},(NestedPages=NestedPages||{}).PostSearch=function(){var s=this,n=jQuery;return s.selectors={input:"data-nestedpages-post-search",form:"data-nestedpages-post-search-form",loadingIndicator:"data-nestedpages-loading",noResults:"data-nestedpages-no-results",results:"data-nestedpages-search-results"},s.changed=!1,s.activeInput="",s.results="",s.defaultResults="",s.postType="",s.activeForm="",s.bindEvents=function(){n("["+s.selectors.input+"]").on("input",function(){return s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val()?(n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults()):void s.query()})},s.setDefaultResults=function(){s.defaultResults=n(s.activeForm).find("["+s.selectors.results+"]").html(),s.changed=!0},s.showDefaultResults=function(){n(s.activeForm).find("["+s.selectors.results+"]").html(s.defaultResults)},s.setOptions=function(){s.postType=n(s.activeInput).attr(s.selectors.input),s.activeForm=n(s.activeInput).parents("["+s.selectors.form+"]")},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){n(s.activeForm).find("["+s.selectors.results+"]").empty(),s.toggleLoading(!0),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:n(s.activeInput).val(),postType:s.postType},success:function(e){e.results?(s.results=e.results,s.loadResults(),s.toggleLoading(!1)):(s.toggleLoading(!1),n(s.activeForm).find("["+s.selectors.noResults+"]").show())}})},s.loadResults=function(){var a="<ul>";n.each(s.results,function(e,t){a+='<li><a href="#" data-assignment-page-id="'+t.ID+'" data-assignment-page-title="'+t.post_title+'">'+t.post_title+"</a></li>"}),a+="</ul>",n(s.activeForm).find("["+s.selectors.results+"]").html(a),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).find("["+s.selectors.loadingIndicator+"]"),a=n(s.activeForm).find("["+s.selectors.noResults+"]");n(a).hide(),e?n(t).show():n(t).hide()},s.bindEvents()},(NestedPages=NestedPages||{}).MovePost=function(){var t=this,a=jQuery;return t.formatter=new NestedPages.Formatter,t.nesting=new NestedPages.Nesting,t.activeRow,t.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},t.bindEvents=function(){a(document).ready(function(){t.disableTopOnFirst(),t.disableBottomOnLast()}),a(document).on("click","["+t.selectors.moveToTop+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToTop())}),a(document).on("click","["+t.selectors.moveToBottom+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToBottom())})},t.moveToTop=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).find(NestedPages.selectors.rows).first();a(t.activeRow).insertBefore(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.moveToBottom=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).children(NestedPages.selectors.rows).last();a(t.activeRow).insertAfter(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.disableTopOnFirst=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToTop+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).first();a(e).find("["+t.selectors.moveToTop+"]").addClass("disabled")})},t.disableBottomOnLast=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToBottom+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).last();a(e).find("["+t.selectors.moveToBottom+"]").addClass("disabled")})},t.bindEvents()},(NestedPages=NestedPages||{}).TrashWithChildren=function(){var t=this,a=jQuery;return t.post_id="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.trashWithChildrenButton,function(e){e.preventDefault(),t.post_id=a(this).attr("data-post-id"),t.trash()})},t.trash=function(){a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.trashWithChildren,nonce:NestedPages.jsData.nonce,post_id:t.post_id,screen:nestedpages.current_page},success:function(e){window.location.replace(e.redirect)},error:function(e){console.log(e)}})},t.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var t=this,n=jQuery;return t.button=null,t.postData=null,t.modal=null,t.parent_li=null,t.formatter=new NestedPages.Formatter,t.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},t.bindEvents=function(){nestedpages.wpml&&n(document).on("click","["+t.selectors.translationsBtn+"]",function(e){e.preventDefault(),t.createTranslationsModal(n(this))})},t.createTranslationsModal=function(e){t.parent_li=n(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),t.button=n(t.parent_li).find(NestedPages.selectors.quickEditOpen),t.postData={id:n(t.button).attr("data-id"),title:n(t.button).attr("data-title"),slug:n(t.button).attr("data-slug")},t.modal=n("["+t.selectors.modal+"]").clone(),0<n(t.parent_li).children("ol").length?(e=n(t.parent_li).children("ol"),n(t.modal).insertBefore(e)):n(t.modal).appendTo(t.parent_li),n(t.modal).find("["+t.selectors.title+"]").text(t.postData.title),t.formatter.showQuickEdit(),n(t.modal).show(),t.getTranslationData()},t.getTranslationData=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:t.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(t.postData.id),"success"===e.status?t.populateModal(e.translations):(n(t.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),t.toggleLoading(!1))}})},t.populateModal=function(a){var s="<tbody>";n.each(a,function(e,t){e=a[e];s+="<tr>",s+='<td><img src="'+e.country_flag_url+'" alt="'+e.translated_name+'" /> '+e.translated_name+"</td>",s+="<td>",e.has_translation&&e.edit_link?s+='<a href="'+e.edit_link+'">'+e.translation.post_title+" ("+nestedpages.edit+")</a>":s+='<a href="'+e.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",s+="</td>",s+="</tr>"}),s+="</tbody>",n(t.modal).find("["+t.selectors.table+"]").html(s),t.toggleLoading(!1)},t.toggleLoading=function(e){e?n(t.modal).addClass("loading"):n(t.modal).removeClass("loading")},t.bindEvents()};
1
+ var NestedPages=NestedPages||{};NestedPages.Formatter=function(){var s=this,i=jQuery;s.updateSubMenuToggle=function(){for(var e=i(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a,s=e[t],n=i(s).parent(".row").parent("li");0<i(n).children("ol").length?i(n).children("ol").find("li.page-row").length<1?i(n).children("ol").hide():(a='<div class="child-toggle-spacer"></div>',a+='<a href="#"',0<i(n).children("ol:visible").length&&(a+=' class="open"'),a+='><span class="np-icon-arrow"></span></a>',i(s).html(a),0<i(n).children("ol").children(".np-hide").length&&0===i(n).children("ol").children(".np-hide.shown").length?i(s).find("a").hide():0<i(n).children("ol").children(".np-hide").length&&0<i(n).children("ol").children(".np-hide.shown").length&&i(s).find("a").show(),0<i(n).children("ol").find(".page-row").not(".np-hide").length&&i(s).find("a").show()):i(s).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){i(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),i.each(i(NestedPages.selectors.lists),function(){i(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){s.setIndent()},s.setIndent=function(){var n="1"===nestedpages.non_indent?20:30,o="1"===nestedpages.non_indent?".row-inner":".child-toggle";i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=a*n+s,i(this).find(o).css("padding-left",s+"px")):(a<1&&i(this).find(o).css("padding-left","0px"),NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px"))})},s.setClassicIndent=function(){i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;NestedPages.jsData.sortable||(s=10),0<a?(s=20*a+s,i(this).find(".row-inner").css("padding-left",s+"px")):NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){var t,a;NestedPages.jsData.nestable&&(t=40*i(e.placeholder).parents("ol").length-40,a=i(NestedPages.selectors.sortable).width()-t,i(e.placeholder).width(a).css("margin-left",t+"px")),s.updateListVisibility(e)},s.updateListVisibility=function(e){e=i(e.placeholder).parent("ol");i(e).is(":visible")||(i(e).addClass("nplist"),i(e).show())},s.removeQuickEdit=function(){i(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),i(".sortable .quick-edit").remove(),i(".row").show()},s.showQuickEdit=function(){i("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){i(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){i(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){i(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){i(NestedPages.selectors.ajaxError).find("p").text(e),i(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){i(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=i(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=i(e).width(),a=i(e).height();i.each(i(NestedPages.selectors.thumbnailContainerLink),function(){i(this).width(t),i(this).height(a)})}},(NestedPages=NestedPages||{}).Dropdowns=function(){var t=this,a=jQuery;return t.dropdown="",t.activeBtn="",t.activeContent="",t.toggleBtn="[data-dropdown-toggle]",t.dropdownContainer="[data-dropdown]",t.dropdownContent="[data-dropdown-content]",t.selectors={caret_up:"icon-arrow_drop_up",caret_down:"icon-arrow_drop_down"},t.bindEvents=function(){a(document).on("click",t.toggleBtn,function(e){e.preventDefault(),t.activeBtn=a(this),t.dropdown=a(this).parents(t.dropdownContainer),t.toggleDropdown()}),a(document).on("click",function(e){t.closeDropdowns(e.target)}),a(document).on("dropdown-opened",function(e,t){0<a(t).parents(NestedPages.selectors.row).length&&a(t).parents(NestedPages.selectors.row).addClass("active")}),a(document).on("dropdown-closed",function(){a(NestedPages.selectors.row).removeClass("active")})},t.toggleDropdown=function(){a("."+t.selectors.caret_up).attr("class",t.selectors.caret_down);var e=a(t.dropdown).find(t.dropdownContent);if(t.activeContent=e,a(e).hasClass("active"))return a(e).removeClass("active"),a(t.activeBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),void a(document).trigger("dropdown-closed",e);t.setPositioning(),a(t.toggleBtn).removeClass("active"),a(t.dropdownContent).removeClass("active"),a(e).addClass("active"),a(t.activeBtn).find("."+t.selectors.caret_down).attr("class",t.selectors.caret_up),a(t.activeBtn).addClass("active"),a(document).trigger("dropdown-opened",e)},t.setPositioning=function(){var e=a(t.activeBtn).outerHeight();a(t.activeContent).css("top",e+"px")},t.closeDropdowns=function(e){0===a(e).parents(t.dropdownContainer).length&&(a(t.dropdownContent).removeClass("active"),a(t.toggleBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),a(document).trigger("dropdown-closed",void 0))},t.bindEvents()},(NestedPages=NestedPages||{}).Modals=function(){var a=this,s=jQuery;return a.activeBtn="",a.activeModal="",a.modalOpen=!1,a.selectors={toggleBtn:"[data-nestedpages-modal-toggle]",backdrop:"[data-nestedpages-modal-backdrop]",closeBtn:"[data-nestedpages-modal-close]",title:"data-nestedpages-modal-title",content:"data-nestedpages-modal-content"},a.bindEvents=function(){s(document).on("click",a.selectors.toggleBtn,function(e){e.preventDefault(),a.activeBtn=s(this),a.openModal()}),s(document).on("click",a.selectors.closeBtn,function(e){e.preventDefault(),a.closeModals()}),s(document).on("open-modal-manual",function(e,t){a.activeModal=s('[data-nestedpages-modal="'+t+'"]'),a.openModal()}),s(document).on("close-modal-manual",function(e){a.closeModals()}),s(document).on("click",a.selectors.backdrop,function(e){a.closeModals()}),s(document).ready(function(){a.checkHash()})},a.openModal=function(){var e;a.modalOpen?a.closeModals():(0<s(a.activeBtn).length&&(e=s(a.activeBtn).attr("data-nestedpages-modal-toggle"),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]')),s(a.activeModal).addClass("active"),a.modalOpen=!0,a.populateModal(),s(document).trigger("open-modal",[a.activeBtn,a.activeModal]))},a.closeModals=function(){a.modalOpen=!1,s("[data-nestedpages-modal]").removeClass("active"),a.activeModal="",a.activeBtn=""},a.populateModal=function(){var e=s(a.activeBtn).attr(a.selectors.title);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-title]").text(e);e=s(a.activeBtn).attr(a.selectors.content);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(e)},a.checkHash=function(){var e;window.location.hash&&"#modal"===window.location.hash.substring(0,6)&&(e=window.location.hash.substring(7),a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal())},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var a=this,s=jQuery;return a.activeCheckbox="",a.selectors={checkbox:"[data-np-check-all]"},a.bindEvents=function(){s(document).on("change",a.selectors.checkbox,function(){a.activeCheckbox=s(this),a.toggleCheckboxes()}),s(document).on("change","input[type=checkbox]",function(){a.checkAllStatus(s(this))})},a.init=function(){a.bindEvents()},a.toggleCheckboxes=function(){var t=!!s(a.activeCheckbox).is(":checked"),e=s(a.activeCheckbox).attr("data-np-check-all"),e=s('*[name="'+e+'"]');s.each(e,function(){var e=s(this).parents(NestedPages.selectors.rows);s(this).prop("checked",t),s(e).hasClass("np-hide")&&!s(e).is(":visible")&&s(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),a.toggleCheckAll()},a.toggleCheckAll=function(){var e=s(a.activeCheckbox).attr("data-np-check-all"),t=(t=s('*[name="'+e+'"]').length)-s(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+s(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length,e=s('*[name="'+e+'"]:checked').length;if(t==e)return s(a.activeCheckbox).prop("checked",!0),void s(a.activeCheckbox).removeClass("check-all-partial");0<e?s(a.activeCheckbox).addClass("check-all-partial"):(s(a.activeCheckbox).attr("checked",!1),s(a.activeCheckbox).removeClass("check-all-partial"))},a.checkAllStatus=function(e){e=s(e).attr("name"),e=s('*[data-np-check-all="'+e+'"]');0!==e.length&&(a.activeCheckbox=s(e)[0],a.toggleCheckAll())},a.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var n=this,o=jQuery;return n.selectedNumber=0,n.selectedLinks=[],n.selectedPosts=[],n.bindEvents=function(){o(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){n.toggleBulkForm()}),o(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===o("select[name=np_bulk_action]").val()&&(e.preventDefault(),n.toggleBulkEdit(!0))}),o(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();e=o(this).siblings("input[type=hidden]").val();n.uncheckBulkItem(e)}),o(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),n.uncheckAllBulkItems()})},n.toggleBulkForm=function(){var t=!1,a="",s="";if(n.selectedPosts=[],n.selectedLinks=[],o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){var e;o(this).is(":checked")&&(e=o(this).parents(NestedPages.selectors.rows),t=!0,o(this).parent("div").hasClass("np-check-all")||o(e).hasClass("post-type-np-redirect")||(a+=o(this).val()+","),o(e).hasClass("post-type-np-redirect")&&(s+=o(this).val()+",",n.selectedLinks.push(o(this).val())),"np-redirect"===o(this).attr("data-np-post-type")||o(this).parent("div").hasClass("np-check-all")||((e=[]).title=o(this).attr("data-np-bulk-checkbox"),e.id=o(this).val(),n.selectedPosts.push(e)))}),n.setBulkEditPosts(),n.toggleEditOption(),n.toggleLinkCountAlert(),t)return o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkActionsIds).val(a),o(NestedPages.selectors.bulkActionRedirectIds).val(s),void n.setSelectedNumber();o(NestedPages.selectors.bulkActionsIds).val(""),o(NestedPages.selectors.bulkActionsForm).hide()},n.setBulkEditPosts=function(){for(var e="",t=0;t<n.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>&times;</a>',e+=n.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+n.selectedPosts[t].id+'"></li>';o(NestedPages.selectors.bulkEditTitles).html(e)},n.uncheckBulkItem=function(e){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).val()==e&&o(this).prop("checked",!1).change()}),0===o(NestedPages.selectors.bulkEditRemoveItem).length&&n.toggleBulkEdit(!1)},n.uncheckAllBulkItems=function(){o.each(o(NestedPages.selectors.bulkActionsCheckbox),function(){o(this).prop("checked",!1).change()}),n.toggleBulkEdit(!1)},n.setSelectedNumber=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option").first();o(t).text(nestedpages.bulk_actions+" ("+e+")")},n.toggleEditOption=function(){var e=o(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=o(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return o(t).prop("disabled",!0),o(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void n.toggleBulkEdit(!1);o(t).prop("disabled",!1)},n.toggleBulkEdit=function(e){if(n.toggleLinkCountAlert(),e)return n.disableParentOptions(),o(NestedPages.selectors.bulkEditForm).show(),o(NestedPages.selectors.bulkActionsForm).hide(),void n.setWPSuggest();o(NestedPages.selectors.bulkEditForm).hide(),o(NestedPages.selectors.bulkActionsForm).show(),o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),o(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),n.resetBulkEditFields()},n.toggleLinkCountAlert=function(){0!==n.selectedLinks.length?o(NestedPages.selectors.bulkEditLinkCount).parent("div").show():o(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},n.disableParentOptions=function(){for(var e=o(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<n.selectedPosts.length;t++)o(e).find("option[value="+n.selectedPosts[t].id+"]").attr("disabled",!0)},n.setWPSuggest=function(){var e=o(NestedPages.selectors.bulkEditForm).find("[data-autotag]");o.each(e,function(e,t){var a=o(this).attr("data-taxonomy");o(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},n.resetBulkEditFields=function(){var e=o(NestedPages.selectors.bulkEditForm).find("select");o.each(e,function(){o(this).find("option").first().prop("selected",!0),o(this).find("option").removeAttr("disabled")});e=o(NestedPages.selectors.bulkEditForm).find(".cat-checklist");o.each(e,function(){o(this).find("input[type=checkbox]").prop("checked",!1)})},n.bindEvents()},(NestedPages=NestedPages||{}).HiddenItemCount=function(){var e=this,a=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){a(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var t=0;a.each(a(NestedPages.selectors.bulkActionsCheckbox),function(){var e;a(this).is(":checked")&&(a(this).parent("div").hasClass("np-check-all")||(e=a(this).closest(".page-row"),a(e).is(":visible")||t++))}),t<1?a(NestedPages.selectors.hiddenItemCountParent).hide():(a(NestedPages.selectors.hiddenItemCount).text(t),a(NestedPages.selectors.hiddenItemCountParent).show())},e.init()},(NestedPages=NestedPages||{}).MenuToggle=function(){var a=this,n=jQuery;return a.formatter=new NestedPages.Formatter,a.bindEvents=function(){n(document).on("click",NestedPages.selectors.childToggleLink,function(e){e.preventDefault(),a.toggleSingleMenu(n(this))}),n(document).on("click",NestedPages.selectors.toggleAll,function(e){e.preventDefault(),a.toggleAllMenus()})},a.toggleSingleMenu=function(e){var t=n(e).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");n(e).toggleClass("open"),n(t).toggle(),a.formatter.setBorders(),a.formatter.setNestedMargins(),a.syncUserToggles()},a.toggleAllMenus=function(){var e=NestedPages.selectors.toggleAll;if("closed"===n(e).attr("data-toggle"))return n(NestedPages.selectors.lists).show(),n(e).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),n(NestedPages.selectors.childToggle+" a").addClass("open"),a.formatter.setBorders(),void a.syncUserToggles();n(NestedPages.selectors.lists).not(n(NestedPages.selectors.lists)[0]).hide(),n(e).attr("data-toggle","closed").text(NestedPages.jsData.expandText),n(NestedPages.selectors.childToggle+" a").removeClass("open"),a.formatter.setBorders(),a.syncUserToggles()},a.visibleRowIDs=function(){var s=[],e=n(NestedPages.selectors.rows+":visible");return n.each(e,function(e,t){var a=n(this).attr("id");s.push(a.replace("menuItem_",""))}),s},a.syncUserToggles=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:a.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},a.bindEvents()},(NestedPages=NestedPages||{}).PageToggle=function(){var a=this,s=jQuery;return a.activeButton="",a.formatter=new NestedPages.Formatter,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.toggleHidden,function(e){e.preventDefault(),a.activeButton=s(this),a.toggleHidden()}),s(document).on("click",NestedPages.selectors.toggleStatus,function(e){e.preventDefault(),a.toggleStatus(s(this))})},a.toggleHidden=function(){var e=s(a.activeButton),t=s(e).attr("href");if("#show"==t)return s(e).attr("href","#hide").text(NestedPages.jsData.showHiddenText),s(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),a.formatter.updateSubMenuToggle(),void a.formatter.setBorders();"#hide"==t&&(s(e).attr("href","#show").text(NestedPages.jsData.hideHiddenText),s(NestedPages.selectors.hiddenRows).addClass("shown").show(),a.formatter.updateSubMenuToggle(),a.formatter.setBorders())},a.toggleStatus=function(e){var t=(t=s(e).attr("href")).substring(1);s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),a.saveStatusPreference(t),"draft"==t&&(s(NestedPages.selectors.syncCheckbox).attr("disabled",!0),s("."+t).addClass("nested-visible")),"all"!=t?(s(NestedPages.selectors.rows).hide(),s("."+t).show()):s(NestedPages.selectors.rows).show()},a.saveStatusPreference=function(e){s.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.toggleStatusDisplay,nonce:NestedPages.jsData.nonce,status:e,post_type:NestedPages.jsData.posttype}})},a.bindEvents()},(NestedPages=NestedPages||{}).Nesting=function(){var n=this,o=jQuery;n.formatter=new NestedPages.Formatter,n.initializeSortable=function(){if(!NestedPages.jsData.nestable)return n.initializeSortableFlat();var e,t=0;void 0===nestedpages.post_types[NestedPages.jsData.posttype]||void 0!==(e=nestedpages.post_types[NestedPages.jsData.posttype]).enable_max_nesting&&e.enable_max_nesting&&void 0!==e.maximum_nesting&&1<e.maximum_nesting&&(t=e.maximum_nesting),o(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",tabSize:56,maxLevels:t,isAllowed:function(e,t,a){return!(o(t).hasClass("post-type-np-redirect")&&!o(a).hasClass("post-type-np-redirect"))},start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})},n.initializeSortableFlat=function(){var e=o(NestedPages.selectors.lists).not(NestedPages.selectors.notSortable);o.each(e,function(){o(this).sortable({items:">"+NestedPages.selectors.rows,handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",forcePlaceholderSize:!0,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})})},n.disableNesting=function(){o(NestedPages.selectors.sortable).sortable("destroy")},n.syncNesting=function(e,t){var a,s;"1"===nestedpages.manual_order_sync&&!e||(o(NestedPages.selectors.errorDiv).hide(),o(NestedPages.selectors.loadingIndicator).show(),s=!!o(NestedPages.selectors.lists).first().hasClass("filtered"),a=NestedPages.jsData.nestable&&!s?o(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):n.setNestingArray(),n.disableNesting(),e=NestedPages.jsData.syncmenu,"1"===nestedpages.manual_menu_sync&&(e="nosync"),o.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:a,post_type:NestedPages.jsData.posttype,syncmenu:e,filtered:s},success:function(e,t){n.initializeSortable(),"error"===e.status?(o(NestedPages.selectors.errorDiv).text(e.message).show(),o(NestedPages.selectors.loadingIndicator).hide()):t&&"function"==typeof t?t():o(NestedPages.selectors.loadingIndicator).hide()}}))},n.setNestingArray=function(e){return ret=[],o(NestedPages.selectors.lists).first().children("li.page-row").each(function(){var e=n.recursiveNesting(this);ret.push(e)}),ret},n.recursiveNesting=function(e){var t,a=o(e).attr("id");if(a)return a=a.replace("menuItem_",""),t={id:a},0<o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).length&&(t.children=[],o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).each(function(){var e=n.recursiveNesting(this);t.children.push(e)})),t}},(NestedPages=NestedPages||{}).SyncMenuSetting=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.init=function(){t.bindEvents()},t.bindEvents=function(){e(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&t.syncSetting()}),e(document).on("change",NestedPages.selectors.syncCheckbox,function(){t.syncSetting()})},t.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==e(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=e(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",e.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncMenu,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:NestedPages.jsData.syncmenu},success:function(e){"error"===e.status&&t.formatter.showAjaxError(e.message)},error:function(e){console.log(e)}}))},t.bindEvents()},(NestedPages=NestedPages||{}).NewPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.parent_id=0,r.posts="",r.form="",r.bindEvents=function(){d(document).on("open-modal",function(e,t,a){t=d(t).attr("data-nestedpages-modal-toggle");void 0!==t&&"np-bulk-modal"==t&&r.openModal()}),d(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),d(document).on("click",NestedPages.selectors.newPageSubmitButton,function(e){e.preventDefault(),r.submitForm(d(this))}),d(document).on("click",NestedPages.selectors.newPageTitle,function(e){e.preventDefault(),r.addTitleField(d(this))}),d(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(e){e.preventDefault(),r.removeTitleField(d(this))}),d(document).on("click",NestedPages.selectors.addChildButton,function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click",NestedPages.selectors.cancelNewChildButton,function(e){e.preventDefault(),r.cancelNewPage()}),d(document).on("click","["+NestedPages.selectors.newBeforeButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click","["+NestedPages.selectors.newAfterButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("keydown",function(e){27===e.keyCode&&(r.cancelNewPage(),d(document).click())})},r.openModal=function(){var e=d(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);d(e).addClass("in-modal"),d(NestedPages.selectors.newPageModal).find(".modal-body").html(e),d(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),d(NestedPages.selectors.newPageModal).find(".page_parent_id").val(r.parent_id),d(e).find(".np_title").first().focus(),d(e).find(NestedPages.selectors.newPageTitle).first().prop("tabindex","2")},r.openQuickEdit=function(e){var t,a=void 0!==(a=d(e).attr(NestedPages.selectors.newBeforeButton))&&""!==a&&a,s=void 0!==(s=d(e).attr(NestedPages.selectors.newAfterButton))&&""!==s&&s,n=d(e).closest(NestedPages.selectors.row).parent("li"),o=d(NestedPages.selectors.newPageFormContainer).clone();0<d(n).children("ol").length?(t=d(n).children("ol"),d(o).insertBefore(t)):d(o).appendTo(n),d(o).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(o).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),a||s||d(o).find(".page_parent_id").val(d(e).attr("data-id")),a&&(d(o).find(".page_before_id").val(a),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),s&&(d(o).find(".page_after_id").val(s),d(o).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(o).show(),d(o).find(".np_title").focus(),d(o).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},r.cancelNewPage=function(){r.formatter.removeQuickEdit(),d(NestedPages.selectors.newChildError).hide(),d(NestedPages.selectors.newPageModal).find(".modal-body").empty(),d(NestedPages.selectors.sortable).find(".new-child").remove(),d(NestedPages.selectors.row).show()},r.addTitleField=function(e){var t=d(e).parents("form"),a=d(e).siblings(".new-page-titles").children("li").length+1,s='<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg><div class="form-control new-child-row"><label>'+NestedPages.jsData.titleText+'</label><div><input type="text" name="post_title[]" class="np_title" placeholder="'+NestedPages.jsData.titleText+'" value="" tabindex="'+a+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';d(e).siblings(".new-page-titles").append(s);d(t).find(".np_title").last().focus(),d(t).find(NestedPages.selectors.newPageTitle).prop("tabindex",+a),d(".new-page-titles").sortable({items:"li",handle:".handle"}),r.toggleAddEditButton(t)},r.removeTitleField=function(e){var t=d(e).parents("form");d(e).parents(".new-child-row").parent("li").remove(),r.toggleAddEditButton(t)},r.submitForm=function(e){r.toggleLoading(!0),r.form=d(e).parents("form");var t=!!d(e).hasClass("add-edit"),e=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(e=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(e=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+e+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){if("error"===e.status)return r.toggleLoading(!1),void d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show();!0!=t?(r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()):(e=(e=e.new_pages[0].edit_link).replace(/&amp;/g,"&"),window.location.replace(e))},error:function(e){console.log(e),r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},r.addPosts=function(){var e,t=""!==(t=d(r.form).find(".page_before_id").val())&&t,a=""!==(a=d(r.form).find(".page_after_id").val())&&a,s=d(r.form).parent(".new-child").parent(".page-row");for(0!==d(s).children("ol").length||t||a||d(s).append('<ol class="nplist"></ol>'),e=d(r.form).hasClass("in-modal")?d(".nplist.sortable li.page-row:first"):d(s).children("ol"),i=0;i<r.posts.length;i++)r.appendRows(e,r.posts[i],t,a);t||a||d(e).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n,o='<li id="menuItem_'+t.id+'" class="page-row';"publish"===t.status&&(o+=" published"),o+='">',NestedPages.jsData.hierarchical?(o+='<div class="row">',o+='<div class="child-toggle"></div>'):(o+='<div class="row non-hierarchical">',o+='<div class="non-hierarchical-spacer"></div>'),o+='<div class="row-inner">',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',o+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',o+='<a href="'+t.edit_link+'" class="page-link page-title">',o+='<span class="title">'+t.title+"</span>","Publish"!==t.status?o+='<span class="status">('+t.status+")</span>":o+='<span class="status"></span>',o+='<span class="nav-status">',"hide"===t.np_nav_status&&(o+=" "+nestedpages.hidden),o+="</span>",o+='<span class="edit-indicator">Edit</span>',o+="</a>",NestedPages.jsData.hierarchical||(o+='<div class="np-post-columns">',o+='<ul class="np-post-info">',o+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",o+="<li>"+t.date_formatted+"</li>",o+="</ul>",o+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(o+='<span class="np-seo-indicator na"></span>'),o+='<div class="action-buttons">',o+='<div class="nestedpages-dropdown" data-dropdown><a href="#" class="np-btn has-icon toggle" data-dropdown-toggle><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></a><ul class="nestedpages-dropdown-content" data-dropdown-content>',o+='<li><a href="#" class="open-redirect-modal" data-parentid="'+t.id+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'+nestedpages.add_link+"</a></li>",o+='<li><a href="#" class="add-new-child" data-id="'+t.id+'" data-parentname="'+t.title+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'+nestedpages.add_child_short+"</a></li>",o+="</ul></div>",o+='<a href="#" class="np-btn np-quick-edit" data-id="'+t.id+'" data-template="'+t.page_template+'" data-title="'+t.title+'" data-slug="'+t.slug+'" data-commentstatus="closed" data-status="'+t.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+t.author+'" data-template="'+t.template+'" data-month="'+t.month+'" data-day="'+t.day+'" data-year="'+t.year+'" data-hour="'+t.hour+'" data-minute="'+t.minute+'" data-datepicker="'+t.datepicker+'" data-time="'+t.time+'" data-formattedtime="'+t.formattedtime+'" data-ampm="'+t.ampm+'">'+nestedpages.quick_edit+"</a>",o+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",o+='<a href="'+t.delete_link+'" class="np-btn np-btn-trash"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-remove"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" class="icon"/><path d="M0 0h24v24H0z" fill="none"/></svg></a>',o+="</div>\x3c!-- .action-buttons --\x3e",o+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",o+="</li>",a?(n=r.findRowById(a),d(o).insertBefore(n)):s?(n=r.findRowById(s),d(o).insertAfter(n)):d(e).append(o)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){e=d(e).find(".np_title").length;e<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<e?d(NestedPages.selectors.newPageSubmitButton+".add-edit").hide():d(NestedPages.selectors.newPageSubmitButton+".add-edit").show())},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.button="",r.initialData="",r.parent_li="",r.form="",r.flatTerms="",r.termNames="",r.saveButton="",r.newData="",r.row="",r.bindEvents=function(){d(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),r.button=d(this),r.openForm()}),d(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),r.formatter.removeQuickEdit()}),d(document).on("change",".keep_private",function(){this.checked?d(".post_password").val("").prop("readonly",!0):d(".post_password").prop("readonly",!1)}),d(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),r.saveButton=d(this),r.save()}),d(document).on("keydown",function(e){27===e.keyCode&&r.formatter.removeQuickEdit()})},r.openForm=function(){r.setInitialData(),r.createForm(),r.populateForm(),r.populateFlatTaxonomies()},r.setInitialData=function(){r.initialData={id:d(r.button).attr("data-id"),title:d(r.button).attr("data-title"),slug:d(r.button).attr("data-slug"),author:d(r.button).attr("data-author"),cs:d(r.button).attr("data-commentstatus"),status:d(r.button).attr("data-status"),template:d(r.button).attr("data-template"),month:d(r.button).attr("data-month"),day:d(r.button).attr("data-day"),year:d(r.button).attr("data-year"),hour:d(r.button).attr("data-hour"),minute:d(r.button).attr("data-minute"),navstatus:d(r.button).attr("data-navstatus"),navCustomUrl:d(r.button).attr("data-custom-url"),npstatus:d(r.button).attr("data-np-status"),navtitle:d(r.button).attr("data-navtitle"),navtitleattr:d(r.button).attr("data-navtitleattr"),navcss:d(r.button).attr("data-navcss"),linktarget:d(r.button).attr("data-linktarget"),password:d(r.button).attr("data-password"),datepicker:d(r.button).attr("data-datepicker"),time:d(r.button).attr("data-formattedtime"),timeTwentyFour:d(r.button).attr("data-time"),ampm:d(r.button).attr("data-ampm"),timeFormat:d(r.button).attr("data-timeformat"),sticky:d(r.button).attr("data-sticky")};var e=d(r.button)[0].attributes;d.each(e,function(e,t){t.name.includes("data-npcustom")&&(r.initialData[t.name]=t.value)}),r.initialData.h_taxonomies=[],r.initialData.f_taxonomies=[],r.parent_li=d(r.button).closest(NestedPages.selectors.row).parent("li");var t=d(r.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&r.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&r.initialData.f_taxonomies.push(t[i])},r.createForm=function(){var e;r.form=d(NestedPages.selectors.quickEditPostForm).clone(),0<d(r.parent_li).children("ol").length?(e=d(r.parent_li).children("ol"),d(r.form).insertBefore(e)):d(r.form).appendTo(r.parent_li),d(r.form).siblings(NestedPages.selectors.row).hide(),d(r.form).show()},r.populateForm=function(){for(var e in d(r.form).find(".page_id").html("<em>ID:</em> "+r.initialData.id),d(r.form).find(".np_id").val(r.initialData.id),d(r.form).find(".np_title").val(r.initialData.title),d(r.form).find(".np_slug").val(r.initialData.slug),d(r.form).find(".np_author select").val(r.initialData.author),d(r.form).find(".np_status").val(r.initialData.status),d(r.form).find(".np_nav_title").val(r.initialData.navtitle),d(r.form).find(".np_nav_css_classes").val(r.initialData.navcss),d(r.form).find(".np_title_attribute").val(r.initialData.navtitleattr),d(r.form).find(".np_nav_custom_url").val(r.initialData.navCustomUrl),d(r.form).find(".post_password").val(r.initialData.password),d(r.form).find(".np_publish_date").val(r.initialData.datepicker),"open"===r.initialData.cs&&d(r.form).find(".np_cs").attr("checked","checked"),""!==r.initialData.template?d(r.form).find(".np_template").val(r.initialData.template):d(r.form).find(".np_template").val("default"),"private"===r.initialData.status&&(d(r.form).find(".post_password").attr("readonly",!0),d(r.form).find(".keep_private").attr("checked",!0)),"hide"===r.initialData.npstatus?d(r.form).find(".nested_pages_status").attr("checked","checked"):d(r.form).find(".nested_pages_status").removeAttr("checked"),"hide"===r.initialData.navstatus?d(r.form).find(".np_nav_status").attr("checked","checked"):d(r.form).find(".np_nav_status").attr("checked",!1),"_blank"===r.initialData.linktarget?d(r.form).find(".link_target").attr("checked","checked"):d(r.form).find(".link_target").attr("checked",!1),"private"===r.initialData.status&&d(r.form).find(".np_status").val("publish"),"sticky"===r.initialData.sticky?d(r.form).find(".np-sticky").attr("checked","checked"):d(r.form).find(".np-sticky").removeAttr("checked"),"H:i"===r.initialData.timeFormat?d(r.form).find(".np_time").val(r.initialData.timeTwentyFour):(d(r.form).find(".np_time").val(r.initialData.time),d(r.form).find(".np_ampm").val(r.initialData.ampm),d(r.form).find('select[name="mm"]').val(r.initialData.month),d(r.form).find('input[name="jj"]').val(r.initialData.day),d(r.form).find('input[name="aa"]').val(r.initialData.year),d(r.form).find('input[name="hh"]').val(r.initialData.hour),d(r.form).find('input[name="mn"]').val(r.initialData.minute)),r.initialData){var t;e.includes("npcustom")&&r.initialData.hasOwnProperty(e)&&(t=(t=e.replace("data-npcustom-","")).toLowerCase(),d(r.form).find('[data-np-custom-field="'+t+'"]').val(r.initialData[e]))}if(r.populateFlatTaxonomies(),r.initialData.hasOwnProperty("h_taxonomies")){var a=r.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];d(r.form).find(s).attr("checked","checked")}}var n=d(r.form).find(".np_datepicker");d.each(n,function(){var e=d(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){d("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),r.formatter.showQuickEdit(),d(r.form).show()},r.populateFlatTaxonomies=function(){r.initialData.hasOwnProperty("f_taxonomies")&&(r.createTaxonomyObject(),r.getTermNames(),r.setWPSuggest())},r.createTaxonomyObject=function(){var e={};for(i=0;i<r.initialData.f_taxonomies.length;i++){var t=r.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),a=(a=a.splice(s+1)).join("-"),s=t.split("-").splice(0,s);s.shift("inf");s=s.join("-");s in e||(e[s]=[]),e[s].push(a)}r.flatTerms=e},r.getTermNames=function(){d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:r.flatTerms},success:function(e){r.termNames=e.terms,r.populateFlatTaxonomyFields()}})},r.populateFlatTaxonomyFields=function(){r.termNames&&d.each(r.termNames,function(e,t){e=d("#"+e+"-quickedit");d(e).val(t.join(","))})},r.setWPSuggest=function(){var e=d(r.form).find("[data-autotag]");d.each(e,function(e,t){var a=d(this).attr("data-taxonomy");d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},r.save=function(){r.toggleLoading(!0),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(r.toggleLoading(!1),r.newData=e.post_data,r.updatePostRow())},error:function(e){console.log(e)}})},r.updatePostRow=function(){r.row=d(r.button).parents(".row-inner"),d(r.row).find(".title").text(r.newData.post_title),d(r.row).find(".np-view-button").attr("href",r.newData.permalink);var e,t=d(r.row).find(".status");"publish"!==r.newData._status&&"future"!==r.newData._status?(e=nestedpages.post_statuses[r.newData._status].label,d(t).text("("+e+")")):d(t).text(""),"private"===r.newData.keep_private&&d(t).text(nestedpages.private),""!==r.newData.post_password&&void 0!==r.newData.post_password&&(a=d(t).text(),a+=' <span class="locked">',a+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>',a+="</span>",d(t).html(a));var a=d(r.row).find(".nav-status");"hide"==r.newData.nav_status?d(a).text("(Hidden)"):d(a).text("");a=d(r.row).parent("li");"hide"==r.newData.np_status?(d(a).addClass("np-hide"),d(r.row).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(d(a).removeClass("np-hide"),d(r.row).find(".status-np-hidden").remove());a=d(r.row).find(".sticky");"sticky"==r.newData.sticky?d(a).show():d(a).hide(),NestedPages.jsData.hierarchical||d(r.row).find(".np-author-display").text(r.newData.author_name);var s,n,o=d(r.row).find(NestedPages.selectors.quickEditOpen);for(s in d(o).attr("data-id",r.newData.post_id),d(o).attr("data-template",r.newData.page_template),d(o).attr("data-title",r.newData.post_title),d(o).attr("data-slug",r.newData.post_name),d(o).attr("data-commentstatus",r.newData.comment_status),d(o).attr("data-status",r.newData._status),d(o).attr("data-sticky",r.newData.sticky),"private"===r.newData.keep_private&&d(o).attr("data-status","private"),d(o).attr("data-author",r.newData.post_author),d(o).attr("data-np-status",r.newData.np_status),d(o).attr("data-password",r.newData.post_password),d(o).attr("data-navstatus",r.newData.nav_status),d(o).attr("data-navtitle",r.newData.np_nav_title),d(o).attr("data-linktarget",r.newData.link_target),d(o).attr("data-navtitleattr",r.newData.np_title_attribute),d(o).attr("data-navcss",r.newData.np_nav_css_classes),d(o).attr("data-month",r.newData.mm),d(o).attr("data-day",r.newData.jj),d(o).attr("data-year",r.newData.aa),d(o).attr("data-hour",r.newData.hh),d(o).attr("data-minute",r.newData.mn),d(o).attr("data-datepicker",r.newData.np_date),d(o).attr("data-time",r.newData.np_time),d(o).attr("data-formattedtime",r.newData.np_time),d(o).attr("data-ampm",r.newData.np_ampm),r.newData)s.includes("np_custom")&&r.newData.hasOwnProperty(s)&&(n=s.replace("np_custom_","data-npcustom-"),d(o).attr(n,r.newData[s]));r.removeTaxonomyClasses(),r.addCategoryClasses(),r.addHierarchicalClasses(),r.addFlatClasses(),r.addStatusClass(),r.formatter.removeQuickEdit(),r.formatter.flashRow(r.row)},r.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)d(r.row).removeClass(e[i]);d(r.row).addClass(r.newData._status)},r.removeTaxonomyClasses=function(){taxonomies=[];var e=d(r.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&d(r.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&d(r.row).removeClass(e[i])},r.addCategoryClasses=function(){if(r.newData.hasOwnProperty("post_category")){var e=r.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];d(r.row).addClass(t)}}},r.addHierarchicalClasses=function(){var e;r.newData.hasOwnProperty("tax_input")&&(e=r.newData.tax_input,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];d(r.row).addClass(a)}}))},r.addFlatClasses=function(){var e;r.newData.hasOwnProperty("flat_tax")&&(e=r.newData.flat_tax,d.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];d(r.row).addClass(a)}}))},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(r.saveButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(r.saveButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.button="",a.postData="",a.newPostData="",a.form="",a.bindEvents=function(){s(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),a.formatter.removeQuickEdit(),a.button=s(this),a.openQuickEdit()}),s(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&a.formatter.removeQuickEdit()})},a.openQuickEdit=function(){a.setData(),a.createForm(),a.populateForm()},a.setData=function(){a.postData={id:s(a.button).attr("data-id"),url:s(a.button).attr("data-url"),title:s(a.button).attr("data-title"),status:s(a.button).attr("data-status"),navstatus:s(a.button).attr("data-navstatus"),npstatus:s(a.button).attr("data-np-status"),linktarget:s(a.button).attr("data-linktarget"),parentid:s(a.button).attr("data-parentid"),navtitleattr:s(a.button).attr("data-navtitleattr"),navcss:s(a.button).attr("data-navcss"),navtype:s(a.button).attr("data-nav-type"),navobject:s(a.button).attr("data-nav-object"),navobjectid:s(a.button).attr("data-nav-object-id"),navoriginallink:s(a.button).attr("data-nav-original-link"),navoriginaltitle:s(a.button).attr("data-nav-original-title")}},a.createForm=function(){var e,t=s(a.button).closest(NestedPages.selectors.row).parent("li");a.form=s(NestedPages.selectors.quickEditLinkForm).clone(),0<s(t).children("ol").length?(e=s(t).children("ol"),s(a.form).insertBefore(e)):s(a.form).appendTo(t);s(a.form).siblings(NestedPages.selectors.row).hide()},a.populateForm=function(){var e;s(a.form).find(".np_id").val(a.postData.id),s(a.form).find(".np_title").val(a.postData.title),s(a.form).find(".np_author select").val(a.postData.author),s(a.form).find(".np_status").val(a.postData.status),s(a.form).find(".np_content").val(a.postData.url),s(a.form).find(".np_parent_id").val(a.postData.parentid),s(a.form).find(".np_title_attribute").val(a.postData.navtitleattr),s(a.form).find(".np_nav_css_classes").val(a.postData.navcss),"hide"===a.postData.npstatus?s(a.form).find(".np_status").prop("checked","checked"):s(a.form).find(".np_status").removeAttr("checked"),"hide"===a.postData.navstatus?s(a.form).find(".np_nav_status").prop("checked","checked"):s(a.form).find(".np_nav_status").removeAttr("checked"),"_blank"===a.postData.linktarget?s(a.form).find(".link_target").prop("checked","checked"):s(a.form).find(".link_target").removeAttr("checked"),"custom"!==a.postData.navobject&&""!==a.postData.navobject?(e='<div class="form-control original-link">Original: <a href="'+a.postData.navoriginallink+'" target="_blank">'+a.postData.navoriginaltitle+"</a></div>",s(a.form).find("[data-url-field]").remove(),s(e).insertAfter(s(a.form).find("h3")),s(a.form).find("[data-np-menu-object-input]").val(a.postData.navobject),s(a.form).find("[data-np-menu-objectid-input]").val(a.postData.navobjectid),s(a.form).find("[data-np-menu-type-input]").val(a.postData.navtype),s(a.form).find("h3").text("Link: "+a.postData.navoriginaltitle)):(s(a.form).find("h3").text("Link"),s(a.form).find("[data-np-menu-object-input]").val("custom"),s(a.form).find("[data-np-menu-type-input]").val("custom")),a.formatter.showQuickEdit(),s(a.form).show()},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:s(a.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(a.toggleLoading(!1),a.newPostData=e.post_data,a.updateRow())},error:function(e){a.toggleLoading(!1),s(a.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},a.updateRow=function(){var e=s(a.form).siblings(".row");s(e).find(".title").html(a.newPostData.post_title+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>');var t=s(e).find(".status");"publish"!==a.newPostData._status&&"future"!==a.newPostData._status?s(t).text("("+a.newPostData._status+")"):s(t).text("");t=s(e).find(".nav-status");"hide"==a.newPostData.nav_status?s(t).text("("+NestedPages.jsData.hiddenText+")"):s(t).text("");t=s(e).parent("li");"hide"==a.newPostData.np_status?(s(t).addClass("np-hide"),s(e).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(s(t).removeClass("np-hide"),s(e).find(".status-np-hidden").remove());t=s(e).find(NestedPages.selectors.quickEditButtonLink);s(t).attr("data-id",a.newPostData.post_id),s(t).attr("data-title",a.newPostData.post_title),s(t).attr("data-url",a.newPostData.post_content),s(t).attr("data-status",a.newPostData._status),s(t).attr("data-navstatus",a.newPostData.nav_status),s(t).attr("data-np-status",a.newPostData.np_status),s(t).attr("data-linkTarget",a.newPostData.linkTarget),s(t).attr("data-navtitleattr",a.newPostData.titleAttribute),s(t).attr("data-navcss",a.newPostData.cssClasses),a.formatter.removeQuickEdit(),a.formatter.flashRow(e)},a.toggleLoading=function(e){if(s(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return s(NestedPages.selectors.quickEditErrorDiv).hide(),s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void s(NestedPages.selectors.quickEditLoadingIndicator).show();s(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),s(NestedPages.selectors.quickEditLoadingIndicator).hide()},a.bindEvents()},(NestedPages=NestedPages||{}).Clone=function(){var t=this,a=jQuery;return t.parent_id="",t.parent_title="",t.parentLi=null,t.formatter=new NestedPages.Formatter,t.bindEvents=function(){a(document).on("click",NestedPages.selectors.cloneButton,function(e){e.preventDefault(),t.parent_id=a(this).attr("data-id"),t.parent_title=a(this).attr("data-parentname"),t.parentLi=a(this).parent(".row").parent(".page-row").parent(".npList"),t.openModal()}),a(document).on("click",NestedPages.selectors.confirmClone,function(e){e.preventDefault(),t.clone()})},t.openModal=function(){a("#"+NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(t.parent_title),a(document).trigger("open-modal-manual",NestedPages.selectors.cloneModal)},t.clone=function(){var e=!!a(NestedPages.selectors.cloneChildren).is(":checked");t.toggleLoading(!0),a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:t.parent_id,quantity:a(NestedPages.selectors.cloneQuantity).val(),status:a(NestedPages.selectors.cloneStatus).val(),author:a(NestedPages.selectors.cloneAuthor).find("select").val(),clone_children:e,nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(e){t.toggleLoading(!1),a(document).trigger("close-modal-manual"),location.reload()}})},t.toggleLoading=function(e){if(e)return a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void a(NestedPages.selectors.confirmClone).attr("disabled","disabled");a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),a(NestedPages.selectors.confirmClone).attr("disabled",!1)},t.bindEvents()},(NestedPages=NestedPages||{}).Tabs=function(){var r=this,d=jQuery;return r.selectors={tabToggle:"data-np-tab-toggle",tabPane:"data-np-tab-pane",tabGroup:"data-np-tab-group"},r.bindEvents=function(){d(document).on("click","["+r.selectors.tabToggle+"]",function(e){e.preventDefault(),r.toggleTabs(d(this))})},r.toggleTabs=function(e){for(var t=d(e).attr(r.selectors.tabGroup),a=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabPane+"]"),s=d(e).attr(r.selectors.tabToggle),n=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabToggle+"]"),o=[],i=0;i<n.length;i++)o[i]=d(n[i]).parent("li")[0];d(a).hide(),d(n).removeClass("active"),d(o).removeClass("active"),d.each(a,function(){d(this).attr(r.selectors.tabPane)==s&&d(this).show()}),d.each(n,function(){d(this).attr(r.selectors.tabToggle)==s&&(d(this).addClass("active"),d(this).parent("li").addClass("active"))}),d(document).trigger("tabs-changed",[s,t,e])},r.bindEvents()},jQuery(document).ready(function(){new NestedPages.Factory}),(NestedPages=NestedPages||{}).selectors={childToggle:".child-toggle",childToggleLink:".child-toggle a",toggleAll:".nestedpages-toggleall",toggleHidden:".np-toggle-hidden",toggleStatus:".np-toggle-publish",lists:".nplist",rows:".page-row",row:".row",sortable:".sortable",notSortable:".no-sort",handle:".handle",published:".published",hiddenRows:".np-hide",errorDiv:"#np-error",loadingIndicator:"#nested-loading",syncCheckbox:".np-sync-menu",syncForm:".np-sync-menu-cont",ajaxError:"[data-nestedpages-error]",trashWithChildrenButton:"[data-nestedpages-trash-children]",toggleEditButtons:".np-toggle-edit",bulkActionsHeader:".nestedpages-list-header",bulkActionsForm:"[data-np-bulk-form]",bulkActionsCheckbox:"[data-np-bulk-checkbox]",bulkActionsIds:"[data-np-bulk-ids]",bulkActionRedirectIds:"[data-np-bulk-redirect-ids]",hiddenItemCount:"[data-np-hidden-count]",hiddenItemCountParent:"[data-np-hidden-count-parent]",bulkEditForm:"[data-np-bulk-edit-form]",bulkEditTitles:"[data-np-bulk-titles]",bulkEditRemoveItem:"[data-np-remove-bulk-item]",bulkEditCancel:"[data-np-cancel-bulk-edit]",bulkEditLinkCount:"[data-bulk-edit-link-count]",quickEditOverlay:".np-inline-overlay",quickEditLoadingIndicator:".np-qe-loading",quickEditErrorDiv:".np-quickedit-error",quickEditCancel:".np-cancel-quickedit",quickEditButtonLink:".np-quick-edit-redirect",quickEditLinkForm:".quick-edit-form-redirect",quickEditLinkSaveButton:".np-save-quickedit-redirect",quickEditOpen:".np-quick-edit",quickEditPostForm:".quick-edit-form",quickEditSaveButton:".np-save-quickedit",openLinkModal:".open-redirect-modal",linkModal:"np-link-modal",saveLink:".np-save-link",linkLoadingIndicator:".np-link-loading",linkErrorDiv:".np-new-link-error",linkForm:".np-new-link-form",linkDeleteButton:"[data-np-confirm-delete]",linkDeleteConfirmationButton:"[data-delete-confirmation]",linkDeleteConfirmationModal:"np-delete-confirmation-modal",linkDeleteConfirmationModalText:"[data-np-link-delete-text]",openPageModal:".open-bulk-modal",newPageModal:"#np-bulk-modal",newPageFormContainer:".new-child-form",newPageForm:".np-new-child-form",newPageSubmitButton:".np-save-newchild",newPageTitle:".add-new-child-row",newPageRemoveTitle:".np-remove-child",addChildButton:".add-new-child",newChildError:".np-newchild-error",cancelNewChildButton:".np-cancel-newchild",newBeforeButton:"data-insert-before",newAfterButton:"data-insert-after",cloneButton:".clone-post",confirmClone:"[data-confirm-clone]",cloneModal:"np-clone-modal",cloneQuantity:"[data-clone-quantity]",cloneStatus:"[data-clone-status]",cloneAuthor:"[data-clone-author]",cloneChildren:"[data-clone-children]",tabButtonParent:"[data-np-tabs]",tabButton:"[data-np-tab]",tabContent:"[data-np-tab-pane]",thumbnailContainer:".np-thumbnail",thumbnailContainerLink:".np-thumbnail.link",manualMenuSync:"[data-np-manual-menu-sync]",manualOrderSync:"[data-np-manual-order-sync]"},NestedPages.cssClasses={noborder:"no-border"},NestedPages.jsData={ajaxurl:ajaxurl,nonce:nestedpages.np_nonce,allPostTypes:nestedpages.post_types,syncmenu:"nosync",posttype:"",nestable:!0,sortable:!0,hierarchical:!0,expandText:nestedpages.expand_text,collapseText:nestedpages.collapse_text,showHiddenText:nestedpages.show_hidden,hideHiddenText:nestedpages.hide_hidden,quickEditText:nestedpages.quick_edit,hiddenText:nestedpages.hidden,titleText:nestedpages.title},NestedPages.formActions={syncToggles:"npnestToggle",syncNesting:"npsort",syncMenu:"npsyncMenu",newPage:"npnewChild",newBeforeAfter:"npnewBeforeAfter",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch",wpmlTranslations:"npWpmlTranslations",resetSettings:"npresetSettings",resetUserPrefs:"npresetUserPreferences",resetAdminMenuSettings:"npresetAdminMenuSettings",trashWithChildren:"nptrashWithChildren",toggleStatusDisplay:"nptoggleStatusDisplay"},NestedPages.Factory=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.dropdowns=new NestedPages.Dropdowns,t.modals=new NestedPages.Modals,t.checkAll=new NestedPages.CheckAll,t.bulkActions=new NestedPages.BulkActions,t.menuToggle=new NestedPages.MenuToggle,t.pageToggle=new NestedPages.PageToggle,t.nesting=new NestedPages.Nesting,t.syncMenuSetting=new NestedPages.SyncMenuSetting,t.newPage=new NestedPages.NewPost,t.quickEditLink=new NestedPages.QuickEditLink,t.quickEditPost=new NestedPages.QuickEditPost,t.clone=new NestedPages.Clone,t.tabs=new NestedPages.Tabs,t.menuLinks=new NestedPages.MenuLinks,t.hiddenItemCount=new NestedPages.HiddenItemCount,t.confirmDelete=new NestedPages.ConfirmDelete,t.manualSync=new NestedPages.ManualSync,t.postSearch=new NestedPages.PostSearch,t.postMove=new NestedPages.MovePost,t.wpml=new NestedPages.Wpml,t.trashWithChildren=new NestedPages.TrashWithChildren,t.init=function(){nestedpages.settings_page||(t.bindEvents(),t.setPostType(),t.setMenuSync(),t.setNestable(),t.setSortable(),t.formatter.updateSubMenuToggle(),t.formatter.setBorders(),t.formatter.setNestedMargins(),t.nesting.initializeSortable())},t.bindEvents=function(){e(document).on("click",NestedPages.selectors.quickEditOverlay,function(e){t.formatter.removeQuickEdit(),t.newPage.cancelNewPage()}),e(document).ready(function(){t.formatter.hideAjaxError(),t.formatter.sizeLinkThumbnails()})},t.setNestable=function(){var a=!1;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&(!0===t.hierarchical&&(a=!0),!0===t.disable_nesting&&(a=!1))}),NestedPages.jsData.nestable=a},t.setSortable=function(){var a=!0;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&void 0!==t.disable_sorting&&""!==t.disable_sorting&&"true"===t.disable_sorting&&(a=!1)}),NestedPages.jsData.sortable=a},t.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,void 0!==NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=e(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},t.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},t.init()},(NestedPages=NestedPages||{}).MenuLinks=function(){var a=this,s=jQuery;return a.typeButton="",a.post="",a.formatter=new NestedPages.Formatter,a.selectors={form:"[data-np-menu-item-form]",typeSelect:"[data-np-menu-selection]",accordion:"[data-np-menu-accordion]",accordionItem:"[data-np-menu-accordion-item]",formPlaceholder:".np-menu-link-object-placeholder",formDetails:".np-menu-link-details",searchResults:"[data-np-search-result]",defaultResults:"[data-default-result]",originalLink:"[data-np-original-link]",saveButton:"[data-np-save-link]",urlInputCont:"[data-np-menu-url-cont]",errorDiv:"[data-np-error]"},a.fields={object:"[data-np-menu-object-input]",objectid:"[data-np-menu-objectid-input]",itemType:"[data-np-menu-type-input]",url:"[data-np-menu-url]",navigationLabel:"[data-np-menu-navigation-label]",titleAttribute:"[data-np-menu-title-attr]",cssClasses:"[data-np-menu-css-classes]",npStatus:"[data-np-menu-np-status]",linkTarget:"[data-np-menu-link-target]",menuTitle:"[data-np-menu-title]",parentPostType:"[data-np-menu-parent-post-type]"},a.search=new NestedPages.MenuSearch,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.openLinkModal,function(e){e.preventDefault(),a.postParent=s(this).attr("data-parentid"),s(a.selectors.form).find(".parent_id").val(s(this).attr("data-parentid")),a.openModal()}),s(document).on("click",a.selectors.accordionItem,function(e){e.preventDefault(),a.accordion(s(this))}),s(document).on("click",a.selectors.typeSelect,function(e){e.preventDefault(),a.typeButton=s(this),a.setLinkType()}),s(document).on("keyup",a.fields.navigationLabel,function(){a.updateTitle()}),s(document).on("click",a.selectors.saveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&s(document).trigger("close-modal-manual")})},a.openModal=function(){s(NestedPages.selectors.linkErrorDiv).hide(),s(NestedPages.selectors.linkModal).find("input").val(""),s(NestedPages.selectors.linkModal).find(".parent_id").val(a.postParent),a.clearForm(),s(a.selectors.accordion).find("ul").hide(),s(a.selectors.typeSelect).removeClass("active"),s(document).trigger("open-modal-manual",NestedPages.selectors.linkModal)},a.accordion=function(e){a.clearForm();var t=s(e).siblings("ul");if(s(t).is(":visible"))return s(e).removeClass("active"),void s(t).slideUp("fast");s(a.selectors.accordionItem).removeClass("active"),s(e).addClass("active"),s(e).parents(a.selectors.accordion).find("ul").slideUp("fast"),s(t).slideDown("fast")},a.setLinkType=function(){s(a.typeButton).hasClass("active")?a.clearForm():(s(a.typeButton).hasClass("np-custom-link")&&(s(a.selectors.accordionItem).removeClass("active"),s(a.selectors.accordion).find("ul").slideUp("fast")),s(a.selectors.formPlaceholder).hide(),a.populateForm())},a.populateForm=function(){s(a.selectors.saveButton).show(),s(a.selectors.typeSelect).removeClass("active"),s(a.typeButton).addClass("active"),s(a.fields.menuTitle).text(s(a.typeButton).text()).val(s(a.typeButton).text()),s(a.selectors.form).find("h3").find("em").text(s(a.typeButton).attr("data-np-object-name")),""!==s(a.typeButton).attr("data-np-permalink")?(s(a.selectors.form).find(a.selectors.urlInputCont).hide(),s(a.selectors.form).find(a.selectors.originalLink).html('<a href="'+s(a.typeButton).attr("data-np-permalink")+'">'+s(a.typeButton).text()+"</a>"),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").show()):(s(a.selectors.form).find(a.selectors.urlInputCont).show(),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").hide()),s(a.fields.object).val(s(a.typeButton).attr("data-np-menu-object")),s(a.fields.objectid).val(s(a.typeButton).attr("data-np-menu-objectid")),s(a.fields.itemType).val(s(a.typeButton).attr("data-np-menu-type")),s(a.selectors.formDetails).show()},a.clearForm=function(){s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.saveButton).hide(),s(a.selectors.formDetails).hide(),s(a.selectors.formPlaceholder).show(),s(a.selectors.form).find("input").not(".parent_id").not(".parent-post-type").val(""),s(a.selectors.form).find(a.fields.linkTarget).val("_blank"),s(a.selectors.form).find('input[type="checkbox"]').attr("checked",!1),s(a.selectors.typeSelect).removeClass("active"),a.search.toggleLoading(!1),s(a.selectors.searchResults).remove(),s(a.selectors.defaultResults).show()},a.updateTitle=function(){var e=s(a.fields.navigationLabel).val(),t=s(a.selectors.form).find("h3").find("span");""!==e?(s(a.fields.menuTitle).val(e),s(t).text(e)):(s(a.fields.menuTitle).val(s(a.typeButton).text()),s(t).text(s(a.typeButton).text()))},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:s(a.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(e){a.toggleLoading(!1),"error"!==e.status?(a.post=e.post_data,a.createRow()):s(a.selectors.form).find(a.selectors.errorDiv).text(e.message).show()},error:function(e){console.log(e)}})},a.createRow=function(){var e='<li id="menuItem_'+a.post.id+'" class="page-row post-type-np-redirect published';e+='">',e+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner">',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',e+='<a href="'+a.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+a.post.menuTitle+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></span>',e+='</a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',e+='data-id="'+a.post.id+'"',e+='data-parentid="'+a.post.parent_id+'"',e+='data-title="'+a.post.menuTitle+'" ',e+='data-url="'+a.post.url+'" ',e+='data-status="publish" ',e+='data-np-status="show" ',e+='data-navstatus="show" ',e+='data-navcss="'+a.post.cssClasses+'" ',e+='data-navtitleattr="'+a.post.titleAttribute+'" ',e+='data-nav-type="'+a.post.menuType+'" ',e+='data-nav-object="'+a.post.objectType+'" ',e+='data-nav-object-id="'+a.post.objectId+'" ',e+='data-nav-original-link="'+a.post.original_link+'" ',e+='data-nav-original-title="'+a.post.original_title+'" ',e+='data-linktarget="'+a.post.link_target+'">',e+=NestedPages.jsData.quickEditText,e+="</a>",e+='<a href="'+a.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',e+="</div></div></div></li>","0"===a.post.parent_id?s(".nplist:first li:first").after(e):a.appendChildRow(e),s(document).trigger("close-modal-manual"),a.row=s("#menuItem_"+a.post.id).find(".row"),a.formatter.flashRow(a.row)},a.appendChildRow=function(e){var t=s("#menuItem_"+a.post.parent_id);0===s(t).children("ol").length?(e='<ol class="sortable nplist" style="display:block;">'+e+"</ol>",s(t).append(e)):s(t).find("ol:first").prepend(e),a.formatter.updateSubMenuToggle()},a.toggleLoading=function(e){if(e)return s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void s(a.selectors.saveButton).attr("disabled","disabled");s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),s(a.selectors.saveButton).attr("disabled",!1)},a.bindEvents()},(NestedPages=NestedPages||{}).MenuSearch=function(){var s=this,n=jQuery;return s.selectors={searchForms:"*[data-np-menu-search]",defaultResults:"[data-default-result]",loadingIndicator:".np-menu-search-loading",noResults:".np-menu-search-noresults",searchType:"data-search-type",searchObject:"data-search-object",searchResults:"[data-np-search-result]"},s.activeForm="",s.results="",s.defaultResults="",s.searchType="",s.searchObject="",s.init=function(){s.bindEvents()},s.bindEvents=function(){n(document).on("keyup",s.selectors.searchForms,function(){s.activeForm=n(this),n(s.selectors.searchResults).remove(),s.performSearch()})},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){s.searchType=n(s.activeForm).attr(s.selectors.searchType),s.searchObject=n(s.activeForm).attr(s.selectors.searchObject),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:n(s.activeForm).val(),searchType:s.searchType,searchObject:s.searchObject},success:function(e){console.log(e),e.results?(s.results=e.results,s.toggleLoading(!1),"post_type"===s.searchType?s.appendPosts():s.appendTaxonomies()):(s.toggleLoading(!1),n(s.activeForm).siblings(s.selectors.noResults).show())}})},s.appendPosts=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.ID+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.singular_name+'" data-np-menu-selection>'+t.post_title+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.appendTaxonomies=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.term_id+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.taxonomy+'" data-np-menu-selection>'+t.name+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).siblings(s.selectors.loadingIndicator);n(s.selectors.noResults).hide(),e?n(t).show():n(t).hide()},s.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPagesTrash=function(){var t=this,a=jQuery;return t.trashButton=".np-empty-trash",t.confirmButton=".np-trash-confirm",t.warningModal="#np-trash-modal",t.errorAlert="#np-error",t.loadingIndicator="#nested-loading",t.trashLinks=".np-trash-links",t.postType=a("#np-trash-posttype").val(),t.nonce=nestedpages.np_nonce,t.formAction="npEmptyTrash",t.bindEvents=function(){a(document).on("click",t.confirmButton,function(e){e.preventDefault(),t.confirmEmpty()})},t.confirmEmpty=function(){t.loading(!0),a(document).trigger("close-modal-manual"),a(t.errorAlert).hide(),t.emptyTrash()},t.emptyTrash=function(){a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:t.formAction,nonce:t.nonce,posttype:t.postType},success:function(e){t.loading(!1),"error"===e.status?a(t.errorAlert).text(e.message).show():(a(t.trashLinks).hide(),a(".notice-dismiss").click())}})},t.loading=function(e){e?a(t.loadingIndicator).show():a(t.loadingIndicator).hide()},t.bindEvents()};(NestedPages=NestedPages||{}).ConfirmDelete=function(){var t=this,a=jQuery;return t.deleteLink="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.linkDeleteButton,function(e){e.preventDefault(),t.confirmSingle(a(this))}),a(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(e){e.preventDefault(),a(this).hasClass("bulk")?t.deleteMultiple():t.deleteSingle()}),a(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){t.confirmMultiple(e)})},t.confirmSingle=function(e){t.deleteLink=a(e).attr("href"),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),a(document).trigger("open-modal-manual",NestedPages.selectors.linkDeleteConfirmationModal)},t.confirmMultiple=function(e){"trash"===a('select[name="np_bulk_action"]').val()&&""!==a(NestedPages.selectors.bulkActionRedirectIds).val()&&(e.preventDefault(),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),a(document).trigger("open-modal-manual",[NestedPages.selectors.linkDeleteConfirmationModal]))},t.deleteMultiple=function(){a(NestedPages.selectors.bulkActionsForm)[0].submit()},t.deleteSingle=function(){window.location.replace(t.deleteLink)},t.bindEvents()},(NestedPages=NestedPages||{}).ManualSync=function(){var t=this,a=jQuery;return t.activeBtn="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.manualMenuSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncMenu()}),a(document).on("click",NestedPages.selectors.manualOrderSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncOrder()})},t.syncMenu=function(){t.loading(!0),a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.manualMenuSync,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:"sync"},success:function(e){"error"===e.status?(a(NestedPages.selectors.errorDiv).text(e.message).show(),a(NestedPages.selectors.loadingIndicator).hide()):t.loading(!1)}})},t.syncOrder=function(){t.loading(!0),(new NestedPages.Nesting).syncNesting(!0,t.loading(!1))},t.loading=function(e){if(e)return a(t.activeBtn).addClass("disabled"),void a(NestedPages.selectors.loadingIndicator).show();a(t.activeBtn).removeClass("disabled"),a(NestedPages.selectors.loadingIndicator).hide()},t.bindEvents()},(NestedPages=NestedPages||{}).PostSearch=function(){var s=this,n=jQuery;return s.selectors={input:"data-nestedpages-post-search",form:"data-nestedpages-post-search-form",loadingIndicator:"data-nestedpages-loading",noResults:"data-nestedpages-no-results",results:"data-nestedpages-search-results"},s.changed=!1,s.activeInput="",s.results="",s.defaultResults="",s.postType="",s.activeForm="",s.bindEvents=function(){n("["+s.selectors.input+"]").on("input",function(){return s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val()?(n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults()):void s.query()})},s.setDefaultResults=function(){s.defaultResults=n(s.activeForm).find("["+s.selectors.results+"]").html(),s.changed=!0},s.showDefaultResults=function(){n(s.activeForm).find("["+s.selectors.results+"]").html(s.defaultResults)},s.setOptions=function(){s.postType=n(s.activeInput).attr(s.selectors.input),s.activeForm=n(s.activeInput).parents("["+s.selectors.form+"]")},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){n(s.activeForm).find("["+s.selectors.results+"]").empty(),s.toggleLoading(!0),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:n(s.activeInput).val(),postType:s.postType},success:function(e){e.results?(s.results=e.results,s.loadResults(),s.toggleLoading(!1)):(s.toggleLoading(!1),n(s.activeForm).find("["+s.selectors.noResults+"]").show())}})},s.loadResults=function(){var a="<ul>";n.each(s.results,function(e,t){a+='<li><a href="#" data-assignment-page-id="'+t.ID+'" data-assignment-page-title="'+t.post_title+'">'+t.post_title+"</a></li>"}),a+="</ul>",n(s.activeForm).find("["+s.selectors.results+"]").html(a),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).find("["+s.selectors.loadingIndicator+"]"),a=n(s.activeForm).find("["+s.selectors.noResults+"]");n(a).hide(),e?n(t).show():n(t).hide()},s.bindEvents()},(NestedPages=NestedPages||{}).MovePost=function(){var t=this,a=jQuery;return t.formatter=new NestedPages.Formatter,t.nesting=new NestedPages.Nesting,t.activeRow,t.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},t.bindEvents=function(){a(document).ready(function(){t.disableTopOnFirst(),t.disableBottomOnLast()}),a(document).on("click","["+t.selectors.moveToTop+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToTop())}),a(document).on("click","["+t.selectors.moveToBottom+"]",function(e){e.preventDefault(),a(this).hasClass("disabled")||(t.activeRow=a(this).closest(NestedPages.selectors.rows),t.moveToBottom())})},t.moveToTop=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).find(NestedPages.selectors.rows).first();a(t.activeRow).insertBefore(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.moveToBottom=function(){var e=a(t.activeRow).parent(NestedPages.selectors.lists),e=a(e).children(NestedPages.selectors.rows).last();a(t.activeRow).insertAfter(e),t.formatter.setBorders(),a(document).click(),t.nesting.syncNesting(),t.disableTopOnFirst(),t.disableBottomOnLast()},t.disableTopOnFirst=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToTop+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).first();a(e).find("["+t.selectors.moveToTop+"]").addClass("disabled")})},t.disableBottomOnLast=function(){var e=a(NestedPages.selectors.lists);a.each(e,function(){a(this).find("["+t.selectors.moveToBottom+"]").removeClass("disabled");var e=a(this).find(NestedPages.selectors.rows).last();a(e).find("["+t.selectors.moveToBottom+"]").addClass("disabled")})},t.bindEvents()},(NestedPages=NestedPages||{}).TrashWithChildren=function(){var t=this,a=jQuery;return t.post_id="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.trashWithChildrenButton,function(e){e.preventDefault(),t.post_id=a(this).attr("data-post-id"),t.trash()})},t.trash=function(){a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.trashWithChildren,nonce:NestedPages.jsData.nonce,post_id:t.post_id,screen:nestedpages.current_page},success:function(e){window.location.replace(e.redirect)},error:function(e){console.log(e)}})},t.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var t=this,n=jQuery;return t.button=null,t.postData=null,t.modal=null,t.parent_li=null,t.formatter=new NestedPages.Formatter,t.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},t.bindEvents=function(){nestedpages.wpml&&n(document).on("click","["+t.selectors.translationsBtn+"]",function(e){e.preventDefault(),t.createTranslationsModal(n(this))})},t.createTranslationsModal=function(e){t.parent_li=n(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),t.button=n(t.parent_li).find(NestedPages.selectors.quickEditOpen),t.postData={id:n(t.button).attr("data-id"),title:n(t.button).attr("data-title"),slug:n(t.button).attr("data-slug")},t.modal=n("["+t.selectors.modal+"]").clone(),0<n(t.parent_li).children("ol").length?(e=n(t.parent_li).children("ol"),n(t.modal).insertBefore(e)):n(t.modal).appendTo(t.parent_li),n(t.modal).find("["+t.selectors.title+"]").text(t.postData.title),t.formatter.showQuickEdit(),n(t.modal).show(),t.getTranslationData()},t.getTranslationData=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:t.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(t.postData.id),"success"===e.status?t.populateModal(e.translations):(n(t.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),t.toggleLoading(!1))}})},t.populateModal=function(a){var s="<tbody>";n.each(a,function(e,t){e=a[e];s+="<tr>",s+='<td><img src="'+e.country_flag_url+'" alt="'+e.translated_name+'" /> '+e.translated_name+"</td>",s+="<td>",e.has_translation&&e.edit_link?s+='<a href="'+e.edit_link+'">'+e.translation.post_title+" ("+nestedpages.edit+")</a>":s+='<a href="'+e.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",s+="</td>",s+="</tr>"}),s+="</tbody>",n(t.modal).find("["+t.selectors.table+"]").html(s),t.toggleLoading(!1)},t.toggleLoading=function(e){e?n(t.modal).addClass("loading"):n(t.modal).removeClass("loading")},t.bindEvents()};
assets/js/nestedpages.settings.min.js CHANGED
@@ -1 +1 @@
1
- var NestedPages=NestedPages||{};NestedPages.SettingsReset=function(){var t=this,s=jQuery;return t.selectors={resetButton:"data-nestedpages-reset-settings",resetForm:".nestedpages-reset-settings",formComplete:".nestedpages-reset-settings-complete",resetAdminMenu:"data-nestedpages-reset-admin-menu"},t.bindEvents=function(){s(document).on("click","["+t.selectors.resetButton+"]",function(e){e.preventDefault(),t.resetSettings()}),s(document).on("click","["+t.selectors.resetAdminMenu+"]",function(e){e.preventDefault(),t.resetAdminMenu()})},t.resetSettings=function(){t.loading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.resetSettings,nonce:NestedPages.jsData.nonce},success:function(e){t.loading(!1),s(t.selectors.resetForm).hide(),s(t.selectors.formComplete).show(),"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},t.resetAdminMenu=function(){t.loading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.resetAdminMenuSettings,nonce:NestedPages.jsData.nonce},success:function(e){t.loading(!1),"success"==e.status&&location.reload(),"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},t.loading=function(e){if(e)return s("["+t.selectors.resetButton+"]").attr("disabled",!0),void s("["+t.selectors.resetAdminMenu+"]").attr("disabled",!0);s("["+t.selectors.resetButton+"]").removeAttr("disabled"),s("["+t.selectors.resetAdminMenu+"]").removeAttr("disabled")},t.bindEvents()},new NestedPages.SettingsReset,(NestedPages=NestedPages||{}).UserPreferencesReset=function(){var t=this,s=jQuery;return t.selectors={resetButton:"data-nestedpages-reset-user-prefs",resetForm:".nestedpages-reset-user-prefs",formComplete:".nestedpages-reset-user-prefs-complete"},t.bindEvents=function(){s(document).on("click","["+t.selectors.resetButton+"]",function(e){e.preventDefault(),t.resetPreferences()})},t.resetPreferences=function(){t.loading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.resetUserPrefs,nonce:NestedPages.jsData.nonce},success:function(e){t.loading(!1),s(t.selectors.resetForm).hide(),s(t.selectors.formComplete).show(),"success"!==e.status&&console.log("There was an error clearing user preferences.")}})},t.loading=function(e){e?s("["+t.selectors.resetButton+"]").attr("disabled",!0):s("["+t.selectors.resetButton+"]").removeAttr("disabled")},t.bindEvents()},new NestedPages.UserPreferencesReset,(NestedPages=NestedPages||{}).AdminCustomizationSettings=function(){var o=this,a=jQuery;return o.selectors={navItemCheckbox:"data-nestedpages-admin-nav-item-checkbox",adminNavList:"data-np-sortable-admin-nav",adminNavRoleSelect:"data-np-nav-menu-user-role-select",adminNavRoleMenu:"data-np-nav-menu-customization",adminNavDetails:"data-np-extra-options",adminNavDetailsToggle:"data-np-extra-options-button",adminSubNavList:"data-np-sortable-admin-subnav",submenuToggle:"data-np-nav-menu-customization-submenu-toggle",separatorRow:"data-np-separator-row",separatorRemoveButton:"data-np-remove-separator-button",separatorAddButton:"data-np-add-separator-button"},o.bindEvents=function(){a(document).ready(function(){o.enableSortableAdminSorting(),o.defaultAdminMenuRoleSelect()}),a(document).on("change","["+o.selectors.navItemCheckbox+"]",function(e){o.toggleNavItemVisibility(a(this))}),a(document).on("change","["+o.selectors.adminNavRoleSelect+"]",function(e){var t=a(this).val();o.toggleNavRoleMenu(t)}),a(document).on("click","["+o.selectors.adminNavDetailsToggle+"]",function(e){e.preventDefault(),o.toggleNavExtraOptions(a(this))}),a(document).on("click","["+o.selectors.submenuToggle+"]",function(e){e.preventDefault(),o.toggleSubmenu(a(this))}),a(document).on("click","["+o.selectors.separatorRemoveButton+"]",function(e){e.preventDefault(),o.removeSeparator(a(this))}),a(document).on("click","["+o.selectors.separatorAddButton+"]",function(e){e.preventDefault(),o.addSeparator()})},o.enableSortableAdminSorting=function(){a("["+o.selectors.adminNavList+"]").sortable({handle:".handle",items:".np-nav-preview",stop:function(e,t){var s=a("["+o.selectors.adminNavList+"] li");a.each(s,function(){a(this).find("[data-np-menu-order]").val(a(this).index())})}}),a("["+o.selectors.adminSubNavList+"]").sortable({handle:".handle",items:".submenu-item",stop:function(e,t){var s=a("["+o.selectors.adminSubNavList+"] li");a.each(s,function(){a(this).find("[data-np-submenu-order]").val(a(this).index())})}})},o.defaultAdminMenuRoleSelect=function(){a("["+o.selectors.adminNavRoleSelect+"]").find("option:eq(0)").prop("selected",!0)},o.toggleNavItemVisibility=function(e){var t=a(e).closest("li.np-nav-preview");!a(e).is(":checked")?a(t).removeClass("disabled"):a(t).addClass("disabled")},o.toggleNavRoleMenu=function(e){a("["+o.selectors.adminNavRoleMenu+"]").hide();var t=a("["+o.selectors.adminNavRoleMenu+'="'+e+'"]');a("["+o.selectors.adminNavRoleSelect+"]").val(e),a(t).show()},o.toggleNavExtraOptions=function(e){a(e).parents(".np-nav-preview").find("["+o.selectors.adminNavDetails+"]");a(e).parents(".np-nav-preview").toggleClass("options-open")},o.toggleSubmenu=function(e){a(e).toggleClass("active"),a(e).parents("li").toggleClass("submenu-open")},o.removeSeparator=function(e){a(e).closest("["+o.selectors.separatorRow+"]").fadeOut(function(){a(this).remove()})},o.addSeparator=function(){var e=a("["+o.selectors.adminNavList+"]:visible"),t=a(e).find("["+o.selectors.separatorRow+"]").length+1,s=a("["+o.selectors.adminNavRoleSelect+"]").val(),n='<li class="np-nav-preview separator" data-np-separator-row>';n+='<div class="menu-item">',n+='<div class="submenu-toggle"></div>',n+='<div class="handle"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class=" np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg></div>',n+='<div class="title"><div class="menu-icon dashicons-before dashicons-admin-post"></div><p>Separator<button class="button button-small details-button" data-np-remove-separator-button="">Remove</button></p></div>\x3c!-- .title --\x3e',n+="</div>\x3c!-- .menu-item --\x3e",n+='<input type="hidden" name="nestedpages_admin[nav_menu_options]['+(s=s.replace("menu_role_",""))+"][custom_sep"+t+']" value="true">',n+='<input type="hidden" name="nestedpages_admin[nav_menu_options]['+s+"][custom_sep"+t+'][order]" value="" data-np-menu-order>',n+="</li>",a(e).prepend(n),o.resetNavOrder(a(e))},o.resetNavOrder=function(e){e=a(e).find("[data-np-menu-order]");a.each(e,function(e,t){a(this).val(e)}),o.enableSortableAdminSorting()},o.bindEvents()},new NestedPages.AdminCustomizationSettings,(NestedPages=NestedPages||{}).Settings=function(){var o=this,a=jQuery;return o.selectors={postTypeToggle:"[data-toggle-nestedpages-pt-settings]",postTypeCheckbox:"[data-nestedpages-settings-row-checkbox]",customFieldsCheckbox:"[data-toggle-nestedpages-cf-settings]",standardFieldsCheckbox:"[data-toggle-nestedpages-sf-settings]",taxonomiesFieldCheckbox:"[data-hide-taxonomies]",thumbnailsCheckbox:"[data-enable-thumbnails]",menuEnabledOption:"[data-menu-enabled-option]",disableMenuCheckbox:"[data-disable-menu-checkbox]",disableAutoCheckbox:"[data-menu-disable-auto-checkbox]",assignPostTypeCheckbox:"[data-nestedpages-assign-post-type]",assignPostTypeId:"[data-nested-pages-assign-post-type-id]",assignPostTypeTitle:"[data-nested-pages-assign-post-type-title]",assignPostTypeOption:"[data-assignment-page-id]",assignPostTypeRemove:"[data-nestedpages-page-pt-assignment-remove]",assignPostTypeSelection:"[data-nestedpages-page-pt-assignment-selection]",sortOptionCheckbox:"[data-nestedpages-sort-option-checkbox]",defaultSortOptions:"[data-nestedpages-sort-option-default]"},o.bindEvents=function(){a(document).ready(function(){o.toggleAllSettingsButtons(),o.toogleAllFieldSettings(".custom-fields"),o.toogleAllFieldSettings(".standard-fields"),o.toggleMenuCheckboxes(),o.toggleHideCheckbox(),o.toggleAssignPostType(),o.toggleAllDefaultSortOptions()}),a(document).on("click",o.selectors.postTypeToggle,function(e){e.preventDefault(),o.toggleRow(a(this))}),a(document).on("change",o.selectors.postTypeCheckbox,function(){o.toggleSettingsButton(a(this))}),a(document).on("change",o.selectors.customFieldsCheckbox,function(){o.toogleFieldSettings(a(this),".custom-fields")}),a(document).on("change",o.selectors.standardFieldsCheckbox,function(){o.toogleFieldSettings(a(this),".standard-fields")}),a(document).on("change",o.selectors.taxonomiesFieldCheckbox,function(){o.toggleTaxonomyCheckboxes(a(this))}),a(document).on("change",o.selectors.thumbnailsCheckbox,function(){o.toggleThumbnailSettings(a(this))}),a(document).on("change",o.selectors.disableMenuCheckbox,function(){o.toggleMenuCheckboxes()}),a(document).on("change",o.selectors.disableAutoCheckbox,function(){o.toggleHideCheckbox()}),a(document).on("change",o.selectors.assignPostTypeCheckbox,function(){o.toggleAssignPostType()}),a(document).on("click",o.selectors.assignPostTypeOption,function(e){e.preventDefault(),o.chooseAssignPostType(a(this))}),a(document).on("click",o.selectors.assignPostTypeRemove,function(e){e.preventDefault(),o.removeAssignPostType(a(this))}),a(document).on("change",o.selectors.sortOptionCheckbox,function(){o.toggleDefaultSortOptions(a(this))})},o.toggleRow=function(e){a(e).parent(".head").siblings(".body").toggle(),a(e).parents(".row-container").toggleClass("active")},o.toggleSettingsButton=function(e){var t=a(e).parents(".head").find(o.selectors.postTypeToggle);if(a(e).is(":checked"))return a(t).show(),void a(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!1);a(t).hide(),a(t).parents(".head").siblings(".body").hide(),a(t).parents(".row-container").removeClass("active"),a(t).parents(".head").siblings(".body").find('input[type="checkbox"]').attr("checked",!1),a(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!0),a(t).parents(".head").siblings(".body").find("select").val(!1)},o.toggleAllSettingsButtons=function(){var e=a(o.selectors.postTypeCheckbox);a.each(e,function(){o.toggleSettingsButton(a(this))})},o.toogleFieldSettings=function(e,t){t=a(e).parents(".body").find(t);a(e).is(":checked")?a(t).show():a(t).hide()},o.toogleAllFieldSettings=function(e){var t=a(o.selectors.customFieldsCheckbox);".standard-fields"==e&&(t=a(o.selectors.standardFieldsCheckbox)),a.each(t,function(){o.toogleFieldSettings(a(this),e)})},o.toggleTaxonomyCheckboxes=function(e){var t=a(e).parents("ul").find(a("*[data-taxonomy-single]"));a(e).is(":checked")?a(t).hide():a(t).show()},o.toggleThumbnailSettings=function(e){var t=a(e).parents(".field").find(a("*[data-thumbnail-options]"));a(e).is(":checked")?a(t).show():a(t).hide()},o.toggleMenuCheckboxes=function(){var e=a(o.selectors.disableMenuCheckbox),t=a(o.selectors.menuEnabledOption);a(e).is(":checked")?a(t).hide():a(t).show()},o.toggleHideCheckbox=function(){var e=a(o.selectors.disableAutoCheckbox),t=a("[data-menu-hide-checkbox]");a(e).is(":checked")?a(t).hide():a(t).show()},o.toggleAssignPostType=function(){var e=a(o.selectors.assignPostTypeCheckbox);a.each(e,function(){var e=a(this),t=a(this).parents(".field").find(".nestedpages-assignment-display");a(e).is(":checked")?a(t).show():a(t).hide()})},o.chooseAssignPostType=function(e){var t=a(e).attr("data-assignment-page-id"),s=a(e).attr("data-assignment-page-title"),n=a(e).parents(".field"),e=nestedpages.currently_assigned_to+" "+s+' <a href="#" data-nestedpages-page-pt-assignment-remove>('+nestedpages.remove+")</a>";a(n).find(o.selectors.assignPostTypeId).val(t),a(n).find(o.selectors.assignPostTypeTitle).val(s),a(n).find(o.selectors.assignPostTypeSelection).html(e).show(),a(n).find("[data-nestedpages-post-search-form]").hide()},o.removeAssignPostType=function(e){e=a(e).parents(".field");a(e).find(o.selectors.assignPostTypeSelection).hide(),a(e).find("[data-nestedpages-post-search-form]").show(),a(e).find(o.selectors.assignPostTypeId).val(""),a(e).find(o.selectors.assignPostTypeTitle).val("")},o.toggleAllDefaultSortOptions=function(){var e=a(o.selectors.sortOptionCheckbox);a.each(e,function(){o.toggleDefaultSortOptions(a(this))})},o.toggleDefaultSortOptions=function(e){var t=!!a(e).is(":checked"),e=a(e).parent("label").next(o.selectors.defaultSortOptions);a(e).length<1||(t?a(e).show():a(e).hide())},o.bindEvents()},new NestedPages.Settings;
1
+ var NestedPages=NestedPages||{};NestedPages.SettingsReset=function(){var t=this,s=jQuery;return t.selectors={resetButton:"data-nestedpages-reset-settings",resetForm:".nestedpages-reset-settings",formComplete:".nestedpages-reset-settings-complete",resetAdminMenu:"data-nestedpages-reset-admin-menu"},t.bindEvents=function(){s(document).on("click","["+t.selectors.resetButton+"]",function(e){e.preventDefault(),t.resetSettings()}),s(document).on("click","["+t.selectors.resetAdminMenu+"]",function(e){e.preventDefault(),t.resetAdminMenu()})},t.resetSettings=function(){t.loading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.resetSettings,nonce:NestedPages.jsData.nonce},success:function(e){t.loading(!1),s(t.selectors.resetForm).hide(),s(t.selectors.formComplete).show(),"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},t.resetAdminMenu=function(){t.loading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.resetAdminMenuSettings,nonce:NestedPages.jsData.nonce},success:function(e){t.loading(!1),"success"==e.status&&location.reload(),"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},t.loading=function(e){if(e)return s("["+t.selectors.resetButton+"]").attr("disabled",!0),void s("["+t.selectors.resetAdminMenu+"]").attr("disabled",!0);s("["+t.selectors.resetButton+"]").removeAttr("disabled"),s("["+t.selectors.resetAdminMenu+"]").removeAttr("disabled")},t.bindEvents()},new NestedPages.SettingsReset,(NestedPages=NestedPages||{}).UserPreferencesReset=function(){var t=this,s=jQuery;return t.selectors={resetButton:"data-nestedpages-reset-user-prefs",resetForm:".nestedpages-reset-user-prefs",formComplete:".nestedpages-reset-user-prefs-complete"},t.bindEvents=function(){s(document).on("click","["+t.selectors.resetButton+"]",function(e){e.preventDefault(),t.resetPreferences()})},t.resetPreferences=function(){t.loading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.resetUserPrefs,nonce:NestedPages.jsData.nonce},success:function(e){t.loading(!1),s(t.selectors.resetForm).hide(),s(t.selectors.formComplete).show(),"success"!==e.status&&console.log("There was an error clearing user preferences.")}})},t.loading=function(e){e?s("["+t.selectors.resetButton+"]").attr("disabled",!0):s("["+t.selectors.resetButton+"]").removeAttr("disabled")},t.bindEvents()},new NestedPages.UserPreferencesReset,(NestedPages=NestedPages||{}).AdminCustomizationSettings=function(){var o=this,a=jQuery;return o.selectors={navItemCheckbox:"data-nestedpages-admin-nav-item-checkbox",adminNavList:"data-np-sortable-admin-nav",adminNavRoleSelect:"data-np-nav-menu-user-role-select",adminNavRoleMenu:"data-np-nav-menu-customization",adminNavDetails:"data-np-extra-options",adminNavDetailsToggle:"data-np-extra-options-button",adminSubNavList:"data-np-sortable-admin-subnav",submenuToggle:"data-np-nav-menu-customization-submenu-toggle",separatorRow:"data-np-separator-row",separatorRemoveButton:"data-np-remove-separator-button",separatorAddButton:"data-np-add-separator-button"},o.bindEvents=function(){a(document).ready(function(){o.enableSortableAdminSorting(),o.defaultAdminMenuRoleSelect()}),a(document).on("change","["+o.selectors.navItemCheckbox+"]",function(e){o.toggleNavItemVisibility(a(this))}),a(document).on("change","["+o.selectors.adminNavRoleSelect+"]",function(e){var t=a(this).val();o.toggleNavRoleMenu(t)}),a(document).on("click","["+o.selectors.adminNavDetailsToggle+"]",function(e){e.preventDefault(),o.toggleNavExtraOptions(a(this))}),a(document).on("click","["+o.selectors.submenuToggle+"]",function(e){e.preventDefault(),o.toggleSubmenu(a(this))}),a(document).on("click","["+o.selectors.separatorRemoveButton+"]",function(e){e.preventDefault(),o.removeSeparator(a(this))}),a(document).on("click","["+o.selectors.separatorAddButton+"]",function(e){e.preventDefault(),o.addSeparator()})},o.enableSortableAdminSorting=function(){a("["+o.selectors.adminNavList+"]").sortable({handle:".handle",items:".np-nav-preview",stop:function(e,t){var s=a("["+o.selectors.adminNavList+"] li");a.each(s,function(){a(this).find("[data-np-menu-order]").val(a(this).index())})}}),a("["+o.selectors.adminSubNavList+"]").sortable({handle:".handle",items:".submenu-item",stop:function(e,t){var s=a("["+o.selectors.adminSubNavList+"] li");a.each(s,function(){a(this).find("[data-np-submenu-order]").val(a(this).index())})}})},o.defaultAdminMenuRoleSelect=function(){a("["+o.selectors.adminNavRoleSelect+"]").find("option:eq(0)").prop("selected",!0)},o.toggleNavItemVisibility=function(e){var t=a(e).closest("li.np-nav-preview");!a(e).is(":checked")?a(t).removeClass("disabled"):a(t).addClass("disabled")},o.toggleNavRoleMenu=function(e){a("["+o.selectors.adminNavRoleMenu+"]").hide();var t=a("["+o.selectors.adminNavRoleMenu+'="'+e+'"]');a("["+o.selectors.adminNavRoleSelect+"]").val(e),a(t).show()},o.toggleNavExtraOptions=function(e){a(e).parents(".np-nav-preview").find("["+o.selectors.adminNavDetails+"]");a(e).parents(".np-nav-preview").toggleClass("options-open")},o.toggleSubmenu=function(e){a(e).toggleClass("active"),a(e).parents("li").toggleClass("submenu-open")},o.removeSeparator=function(e){a(e).closest("["+o.selectors.separatorRow+"]").fadeOut(function(){a(this).remove()})},o.addSeparator=function(){var e=a("["+o.selectors.adminNavList+"]:visible"),t=a(e).find("["+o.selectors.separatorRow+"]").length+1,s=a("["+o.selectors.adminNavRoleSelect+"]").val(),n='<li class="np-nav-preview separator" data-np-separator-row>';n+='<div class="menu-item">',n+='<div class="submenu-toggle"></div>',n+='<div class="handle"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class=" np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg></div>',n+='<div class="title"><div class="menu-icon dashicons-before dashicons-admin-post"></div><p>Separator<button class="button button-small details-button" data-np-remove-separator-button="">Remove</button></p></div>\x3c!-- .title --\x3e',n+="</div>\x3c!-- .menu-item --\x3e",n+='<input type="hidden" name="nestedpages_admin[nav_menu_options]['+(s=s.replace("menu_role_",""))+"][custom_sep"+t+']" value="true">',n+='<input type="hidden" name="nestedpages_admin[nav_menu_options]['+s+"][custom_sep"+t+'][order]" value="" data-np-menu-order>',n+="</li>",a(e).prepend(n),o.resetNavOrder(a(e))},o.resetNavOrder=function(e){e=a(e).find("[data-np-menu-order]");a.each(e,function(e,t){a(this).val(e)}),o.enableSortableAdminSorting()},o.bindEvents()},new NestedPages.AdminCustomizationSettings,(NestedPages=NestedPages||{}).Settings=function(){var o=this,a=jQuery;return o.selectors={postTypeToggle:"[data-toggle-nestedpages-pt-settings]",postTypeCheckbox:"[data-nestedpages-settings-row-checkbox]",customFieldsCheckbox:"[data-toggle-nestedpages-cf-settings]",standardFieldsCheckbox:"[data-toggle-nestedpages-sf-settings]",taxonomiesFieldCheckbox:"[data-hide-taxonomies]",thumbnailsCheckbox:"[data-enable-thumbnails]",menuEnabledOption:"[data-menu-enabled-option]",disableMenuCheckbox:"[data-disable-menu-checkbox]",disableAutoCheckbox:"[data-menu-disable-auto-checkbox]",assignPostTypeCheckbox:"[data-nestedpages-assign-post-type]",assignPostTypeId:"[data-nested-pages-assign-post-type-id]",assignPostTypeTitle:"[data-nested-pages-assign-post-type-title]",assignPostTypeOption:"[data-assignment-page-id]",assignPostTypeRemove:"[data-nestedpages-page-pt-assignment-remove]",assignPostTypeSelection:"[data-nestedpages-page-pt-assignment-selection]",enableMaximumNestingLevel:"[data-nested-pages-enable-maximum-nesting]",maximumNestingLevel:"[data-nested-pages-maximum-nesting]",sortOptionCheckbox:"[data-nestedpages-sort-option-checkbox]",defaultSortOptions:"[data-nestedpages-sort-option-default]"},o.bindEvents=function(){a(document).ready(function(){o.toggleAllSettingsButtons(),o.toogleAllFieldSettings(".custom-fields"),o.toogleAllFieldSettings(".standard-fields"),o.toggleMenuCheckboxes(),o.toggleHideCheckbox(),o.toggleAssignPostType(),o.toggleAllDefaultSortOptions()}),a(document).on("click",o.selectors.postTypeToggle,function(e){e.preventDefault(),o.toggleRow(a(this))}),a(document).on("change",o.selectors.postTypeCheckbox,function(){o.toggleSettingsButton(a(this))}),a(document).on("change",o.selectors.customFieldsCheckbox,function(){o.toogleFieldSettings(a(this),".custom-fields")}),a(document).on("change",o.selectors.standardFieldsCheckbox,function(){o.toogleFieldSettings(a(this),".standard-fields")}),a(document).on("change",o.selectors.taxonomiesFieldCheckbox,function(){o.toggleTaxonomyCheckboxes(a(this))}),a(document).on("change",o.selectors.thumbnailsCheckbox,function(){o.toggleThumbnailSettings(a(this))}),a(document).on("change",o.selectors.disableMenuCheckbox,function(){o.toggleMenuCheckboxes()}),a(document).on("change",o.selectors.disableAutoCheckbox,function(){o.toggleHideCheckbox()}),a(document).on("change",o.selectors.assignPostTypeCheckbox,function(){o.toggleAssignPostType()}),a(document).on("click",o.selectors.assignPostTypeOption,function(e){e.preventDefault(),o.chooseAssignPostType(a(this))}),a(document).on("click",o.selectors.assignPostTypeRemove,function(e){e.preventDefault(),o.removeAssignPostType(a(this))}),a(document).on("change",o.selectors.sortOptionCheckbox,function(){o.toggleDefaultSortOptions(a(this))}),a(document).on("change",o.selectors.enableMaximumNestingLevel,function(){o.toggleMaximumNesting(a(this))})},o.toggleRow=function(e){a(e).parent(".head").siblings(".body").toggle(),a(e).parents(".row-container").toggleClass("active")},o.toggleSettingsButton=function(e){var t=a(e).parents(".head").find(o.selectors.postTypeToggle);if(a(e).is(":checked"))return a(t).show(),void a(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!1);a(t).hide(),a(t).parents(".head").siblings(".body").hide(),a(t).parents(".row-container").removeClass("active"),a(t).parents(".head").siblings(".body").find('input[type="checkbox"]').attr("checked",!1),a(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!0),a(t).parents(".head").siblings(".body").find("select").val(!1)},o.toggleAllSettingsButtons=function(){var e=a(o.selectors.postTypeCheckbox);a.each(e,function(){o.toggleSettingsButton(a(this))})},o.toogleFieldSettings=function(e,t){t=a(e).parents(".body").find(t);a(e).is(":checked")?a(t).show():a(t).hide()},o.toogleAllFieldSettings=function(e){var t=a(o.selectors.customFieldsCheckbox);".standard-fields"==e&&(t=a(o.selectors.standardFieldsCheckbox)),a.each(t,function(){o.toogleFieldSettings(a(this),e)})},o.toggleTaxonomyCheckboxes=function(e){var t=a(e).parents("ul").find(a("*[data-taxonomy-single]"));a(e).is(":checked")?a(t).hide():a(t).show()},o.toggleThumbnailSettings=function(e){var t=a(e).parents(".field").find(a("*[data-thumbnail-options]"));a(e).is(":checked")?a(t).show():a(t).hide()},o.toggleMenuCheckboxes=function(){var e=a(o.selectors.disableMenuCheckbox),t=a(o.selectors.menuEnabledOption);a(e).is(":checked")?a(t).hide():a(t).show()},o.toggleHideCheckbox=function(){var e=a(o.selectors.disableAutoCheckbox),t=a("[data-menu-hide-checkbox]");a(e).is(":checked")?a(t).hide():a(t).show()},o.toggleAssignPostType=function(){var e=a(o.selectors.assignPostTypeCheckbox);a.each(e,function(){var e=a(this),t=a(this).parents(".field").find(".nestedpages-assignment-display");a(e).is(":checked")?a(t).show():a(t).hide()})},o.chooseAssignPostType=function(e){var t=a(e).attr("data-assignment-page-id"),s=a(e).attr("data-assignment-page-title"),n=a(e).parents(".field"),e=nestedpages.currently_assigned_to+" "+s+' <a href="#" data-nestedpages-page-pt-assignment-remove>('+nestedpages.remove+")</a>";a(n).find(o.selectors.assignPostTypeId).val(t),a(n).find(o.selectors.assignPostTypeTitle).val(s),a(n).find(o.selectors.assignPostTypeSelection).html(e).show(),a(n).find("[data-nestedpages-post-search-form]").hide()},o.removeAssignPostType=function(e){e=a(e).parents(".field");a(e).find(o.selectors.assignPostTypeSelection).hide(),a(e).find("[data-nestedpages-post-search-form]").show(),a(e).find(o.selectors.assignPostTypeId).val(""),a(e).find(o.selectors.assignPostTypeTitle).val("")},o.toggleAllDefaultSortOptions=function(){var e=a(o.selectors.sortOptionCheckbox);a.each(e,function(){o.toggleDefaultSortOptions(a(this))})},o.toggleDefaultSortOptions=function(e){var t=!!a(e).is(":checked"),e=a(e).parent("label").next(o.selectors.defaultSortOptions);a(e).length<1||(t?a(e).show():a(e).hide())},o.toggleMaximumNesting=function(e){var t=!!a(e).is(":checked"),e=a(e).parents(".field").find(o.selectors.maximumNestingLevel);t?a(e).show():a(e).hide()},o.bindEvents()},new NestedPages.Settings;
nestedpages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Nested Pages
4
  Plugin URI: http://nestedpages.com
5
  Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
6
- Version: 3.2.2
7
  Author: Kyle Phillips
8
  Author URI: https://github.com/kylephillips
9
  Text Domain: wp-nested-pages
3
  Plugin Name: Nested Pages
4
  Plugin URI: http://nestedpages.com
5
  Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
6
+ Version: 3.2.3
7
  Author: Kyle Phillips
8
  Author URI: https://github.com/kylephillips
9
  Text Domain: wp-nested-pages
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
5
  Requires at least: 3.8
6
  Tested up to: 6.1
7
  Requires PHP: 5.4
8
- Stable tag: 3.2.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -105,6 +105,11 @@ No. The menu synchronization currently only works within the pages post type.
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
108
  = 3.2.2 =
109
  * Adds option to default new pages to hide in the generated nav menu.
110
  * Adds two new filters: "nestedpages_page_listing" & "nestedpages_show_links". These filters allow access to add the "Links" interface to post types other than pages.
5
  Requires at least: 3.8
6
  Tested up to: 6.1
7
  Requires PHP: 5.4
8
+ Stable tag: 3.2.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
105
 
106
  == Changelog ==
107
 
108
+ = 3.2.3 =
109
+ * Adds the ability to clone the post/page tree in hierarchical post types.
110
+ * Adds option to set the maximum nesting level per post type. To configure, visit Settings > Nested Pages > Post Types, and select the post type you'd like to configure. The option can be located under the "Maximum Nesting Depth" tab.
111
+ * Fixes bug where nav menu was being added when saving plugin options, even when "Disable menu sync completely" was selected.
112
+
113
  = 3.2.2 =
114
  * Adds option to default new pages to hide in the generated nav menu.
115
  * Adds two new filters: "nestedpages_page_listing" & "nestedpages_show_links". These filters allow access to add the "Links" interface to post types other than pages.