Nested Pages - Version 3.1.1

Version Description

  • Removes ability to hide Settings and Nested Pages menus from administrators within the admin customization interface (removing items hides links to necessary admin sections).
  • Adds ability to reset admin menu settings by clicking a single button
  • Fixes bug in new admin menu feature where submenus added by other plugins were not being displayed if a custom menu was in use.
Download this release

Release Info

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

Code changes from version 3.1.0 to 3.1.1

app/Config/AdminMenuSettings.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace NestedPages\Config;
3
+
4
+ use NestedPages\Entities\User\UserRepository;
5
+ use NestedPages\Config\SettingsRepository;
6
+
7
+ /**
8
+ * Displays the admin menu settings
9
+ */
10
+ class AdminMenuSettings
11
+ {
12
+ private $user_repo;
13
+
14
+ private $settings;
15
+
16
+ public $roles;
17
+
18
+ public $nav_menu_options;
19
+
20
+ public $np_menu_original;
21
+
22
+ public $np_submenu_original;
23
+
24
+ public $menu;
25
+
26
+ public function __construct()
27
+ {
28
+ $this->user_repo = new UserRepository;
29
+ $this->settings = new SettingsRepository;
30
+ $this->roles = $this->user_repo->allRoles(null, true);
31
+ $this->nav_menu_options = $this->settings->adminCustomEnabled('nav_menu_options');
32
+
33
+ global $np_menu_original;
34
+ $this->np_menu_original = $np_menu_original;
35
+ global $np_submenu_original;
36
+ $this->np_submenu_original = $np_submenu_original;
37
+ global $menu;
38
+ $this->menu = $menu;
39
+ }
40
+
41
+ /**
42
+ * Data for an individual menu item
43
+ */
44
+ public function menuItemData($menu_item, $role)
45
+ {
46
+ $data = [];
47
+ $id = $menu_item[2];
48
+ $data['id'] = $id;
49
+
50
+ // Separator/WooCommerce Separator
51
+ $data['separator'] = ( $menu_item[0] == '' && isset($menu_item[4]) && $menu_item[4] == 'wp-menu-separator' ) ? true : false;
52
+ if ( isset($menu_item[4]) && $menu_item[4] == 'wp-menu-separator woocommerce' ) $data['separator'] = true;
53
+
54
+ // Set the Label
55
+ $text = strip_tags(preg_replace('#<span[^>]*>(.*)</span>#isU','', $menu_item[0]));
56
+ $original_text = $text;
57
+ $data['custom_label'] = null;
58
+ if ( isset($this->nav_menu_options[$role['name']][$id]['label']) && $this->nav_menu_options[$role['name']][$id]['label'] !== '' )
59
+ $data['custom_label'] = $this->nav_menu_options[$role['name']][$id]['label'];
60
+ if ( $data['separator'] ) $custom_label = __('Separator', 'wp-nested-pages');
61
+ if ( $data['custom_label'] ) $text = $data['custom_label'];
62
+ $data['text'] = $text;
63
+ $data['original_text'] = $original_text;
64
+
65
+ // Set the Icon
66
+ $icon = ( isset($menu_item[6]) && $menu_item[6] !== '' ) ? $menu_item[6] : 'dashicons-admin-post';
67
+ $data['original_icon'] = $icon;
68
+ $data['custom_icon'] = null;
69
+ if ( isset($this->nav_menu_options[$role['name']][$id]['icon']) && $this->nav_menu_options[$role['name']][$id]['icon'] !== '' )
70
+ $data['custom_icon'] = $this->nav_menu_options[$role['name']][$id]['icon'];
71
+ if ( $data['custom_icon'] ) $icon = $data['custom_icon'];
72
+ $data['icon'] = $icon;
73
+
74
+ // Set the original link
75
+ $data['original_link'] = $menu_item[2];
76
+
77
+ // Set the submenu
78
+ $data['submenu'] = ( isset($menu_item['submenu']) ) ? $menu_item['submenu'] : null;
79
+ $data['has_custom_submenu'] = ( isset($this->nav_menu_options[$role['name']][$id]['submenu']) ) ? true : false;
80
+ $data['submenu_items'] = $this->submenuItems($data, $role);
81
+
82
+ return $data;
83
+ }
84
+
85
+ /**
86
+ * Submenu Items
87
+ */
88
+ public function submenuItems($menu_item, $role)
89
+ {
90
+ // Get all submenus
91
+ $unordered_menu = $this->np_menu_original[$role['name']];
92
+ $unordered_submenus = [];
93
+ foreach ( $unordered_menu as $unordered_menu_item ){
94
+ if ( isset($unordered_menu_item['submenu']) ) {
95
+ $unordered_submenus[$unordered_menu_item[2]] = $unordered_menu_item['submenu'];
96
+ }
97
+ }
98
+
99
+ $id = $menu_item['id'];
100
+
101
+ // Use the custom menu if available, otherwise use default
102
+ $submenu_items = ( $menu_item['has_custom_submenu'] )
103
+ ? $this->nav_menu_options[$role['name']][$id]['submenu']
104
+ : $menu_item['submenu'];
105
+
106
+ if ( !$menu_item['has_custom_submenu'] ) return $submenu_items;
107
+
108
+ // Remove submenu items not active (removed by plugin deactivation since last save)
109
+ foreach ( $submenu_items as $submenu_key => $submenu_item ) :
110
+ $exists = false;
111
+ foreach ( $unordered_submenus[$id] as $unordered_item ) :
112
+ if ( $unordered_item[2] == $submenu_item['link'] ) $exists = true;
113
+ endforeach;
114
+ if ( !$exists ) unset($submenu_items[$submenu_key]);
115
+ endforeach;
116
+
117
+ // Add any missing submenu items (added by plugins since last save)
118
+ $missing_items = [];
119
+ foreach ( $unordered_submenus[$id] as $unordered_item ) :
120
+ $missing = true;
121
+ foreach ( $submenu_items as $submenu_key => $submenu_item ) :
122
+ if ( $submenu_item['link'] == $unordered_item[2] ) $missing = false;
123
+ endforeach;
124
+ if ( $missing ){
125
+ $submenu_items[] = [
126
+ 'label' => $unordered_item[0],
127
+ 'role' => $unordered_item[1],
128
+ 'link' => $unordered_item[2],
129
+ 'order' => count($submenu_items) + 1
130
+ ];
131
+ }
132
+ endforeach;
133
+ return $submenu_items;
134
+ }
135
+
136
+ }
app/Config/Settings.php CHANGED
@@ -55,6 +55,11 @@ class Settings
55
  */
56
  private $post_repo;
57
 
 
 
 
 
 
58
  public function __construct()
59
  {
60
  add_action( 'admin_menu', [$this, 'registerSettingsPage' ]);
@@ -147,5 +152,5 @@ class Settings
147
  $this->setMenu();
148
  $tab = ( isset($_GET['tab']) ) ? $_GET['tab'] : 'general';
149
  include( Helpers::view('settings/settings') );
150
- }
151
  }
55
  */
56
  private $post_repo;
57
 
58
+ /**
59
+ * Admin Menu Settings
60
+ */
61
+ private $admin_menu_settings;
62
+
63
  public function __construct()
64
  {
65
  add_action( 'admin_menu', [$this, 'registerSettingsPage' ]);
152
  $this->setMenu();
153
  $tab = ( isset($_GET['tab']) ) ? $_GET['tab'] : 'general';
154
  include( Helpers::view('settings/settings') );
155
+ }
156
  }
app/Config/SettingsRepository.php CHANGED
@@ -178,7 +178,21 @@ class SettingsRepository
178
  'nestedpages_menusync',
179
  'nestedpages_posttypes',
180
  'nestedpages_ui',
181
- 'nestedpages_version'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  ];
183
  foreach($options as $option){
184
  delete_option($option);
178
  'nestedpages_menusync',
179
  'nestedpages_posttypes',
180
  'nestedpages_ui',
181
+ 'nestedpages_version',
182
+ 'nestedpages_admin'
183
+ ];
184
+ foreach($options as $option){
185
+ delete_option($option);
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Reset admin menu customizations
191
+ */
192
+ public function resetAdminMenuSettings()
193
+ {
194
+ $options = [
195
+ 'nestedpages_admin'
196
  ];
197
  foreach($options as $option){
198
  delete_option($option);
app/Entities/AdminCustomization/AdminMenuItems.php CHANGED
@@ -92,7 +92,9 @@ class AdminMenuItems extends AdminCustomizationBase
92
  $separator_index = 1;
93
  foreach ( $menu_options[$this->current_user_role] as $key => $item ){
94
 
95
- if ( isset($item['hidden']) ) continue;
 
 
96
  $slug = ( isset($item['original_link']) ) ? $item['original_link'] : $key;
97
 
98
  // Loop through the original menu and get the item if it exists (associated through original link)
@@ -120,6 +122,7 @@ class AdminMenuItems extends AdminCustomizationBase
120
  {
121
  global $submenu;
122
  global $np_submenu_original;
 
123
 
124
  if ( !$this->settings->adminCustomEnabled('enabled_menu') ) return;
125
  $menu_options = $this->settings->adminCustomEnabled('nav_menu_options');
@@ -136,6 +139,7 @@ class AdminMenuItems extends AdminCustomizationBase
136
 
137
  // Add the Submenu pages back in, ordered and labeled how we want
138
  foreach ( $menu_options[$this->current_user_role] as $menu_option ){
 
139
  if ( !isset($menu_option['original_link']) ) continue;
140
  if ( !isset($menu_option['submenu']) || !$menu_option['submenu'] ){
141
  $submenu[$menu_option['link']] = $np_submenu_original[$menu_option['original_link']];
@@ -144,11 +148,15 @@ class AdminMenuItems extends AdminCustomizationBase
144
  $new_submenu = [];
145
  foreach ( $menu_option['submenu'] as $key => $menu ){
146
  $index = ($key + 1) * 10;
 
 
 
 
147
  $np_submenu_original[$index][0] = $menu['label'];
148
  $np_submenu_original[$index][1] = $menu['role'];
149
  $np_submenu_original[$index][2] = $menu['link'];
150
  $np_submenu_original[$index][3] = $menu['label'];
151
- $np_submenu_original[$index][4] = (isset($menu['hidden']) && $menu['hidden'] == 'true') ? true : false;;
152
 
153
  if ( isset($menu['hidden']) && $menu['hidden'] == 'true' ) continue;
154
  $new_submenu[$index][0] = $menu['label'];
@@ -158,6 +166,42 @@ class AdminMenuItems extends AdminCustomizationBase
158
  }
159
  $submenu[$menu_option['link']] = $new_submenu;
160
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
 
163
  /**
@@ -178,13 +222,15 @@ class AdminMenuItems extends AdminCustomizationBase
178
  // Set each role's menu order
179
  $user_roles = $this->user_repo->allRoles(array());
180
  foreach( $user_roles as $role ){
181
- if ( !array_key_exists($role['name'], $menu_options) ) continue;
182
 
 
 
183
  foreach ( $menu_options[$role['name']] as $key => $item ){
184
-
185
  foreach ( $np_menu_original as $menu_key => $menu_item ){
186
  if ( isset($menu_item[2]) && $menu_item[2] == $key ) {
187
- if ( isset($np_submenu_original[$menu_item[2]]) ) $menu_item['submenu'] = $np_submenu_original[$menu_item[2]];
 
 
188
  $np_menu_ordered[$role['name']][] = $menu_item;
189
  } // submenu
190
  } // np menu original
@@ -207,7 +253,8 @@ class AdminMenuItems extends AdminCustomizationBase
207
  }
208
 
209
  // Add missing items (added by plugins after saving a custom menu)
210
- $missing_items = [];
 
211
  foreach ( $np_menu_ordered as $role => $ordered_menu ){
212
  if ( $role == 'default' ) continue;
213
  $all_items = [];
@@ -218,14 +265,17 @@ class AdminMenuItems extends AdminCustomizationBase
218
  foreach ( $ordered_menu as $ordered_item ){
219
  if ( array_key_exists($ordered_item[2], $all_items) ) unset($all_items[$ordered_item[2]]);
220
  }
221
- $missing_items[$role] = $all_items;
 
 
 
222
  }
223
- foreach ( $missing_items as $role => $items ){
 
224
  foreach ( $items as $item_id => $key ){
225
  $np_menu_ordered[$role][] = $np_menu_ordered['default'][$key];
226
  }
227
  }
228
-
229
  $np_menu_original = $np_menu_ordered;
230
  }
231
 
92
  $separator_index = 1;
93
  foreach ( $menu_options[$this->current_user_role] as $key => $item ){
94
 
95
+ // Settings can't be hidden (unable to return to reset customizations)
96
+ if ( isset($item['hidden']) && $item['link'] !== 'options-general.php' ) continue;
97
+
98
  $slug = ( isset($item['original_link']) ) ? $item['original_link'] : $key;
99
 
100
  // Loop through the original menu and get the item if it exists (associated through original link)
122
  {
123
  global $submenu;
124
  global $np_submenu_original;
125
+ $original_submenu = $submenu;
126
 
127
  if ( !$this->settings->adminCustomEnabled('enabled_menu') ) return;
128
  $menu_options = $this->settings->adminCustomEnabled('nav_menu_options');
139
 
140
  // Add the Submenu pages back in, ordered and labeled how we want
141
  foreach ( $menu_options[$this->current_user_role] as $menu_option ){
142
+
143
  if ( !isset($menu_option['original_link']) ) continue;
144
  if ( !isset($menu_option['submenu']) || !$menu_option['submenu'] ){
145
  $submenu[$menu_option['link']] = $np_submenu_original[$menu_option['original_link']];
148
  $new_submenu = [];
149
  foreach ( $menu_option['submenu'] as $key => $menu ){
150
  $index = ($key + 1) * 10;
151
+
152
+ // Items saved that no longer exist
153
+ if ( !$this->submenuExists($np_submenu_original[$menu_option['link']], $menu['link'], $menu_option) ) continue;
154
+
155
  $np_submenu_original[$index][0] = $menu['label'];
156
  $np_submenu_original[$index][1] = $menu['role'];
157
  $np_submenu_original[$index][2] = $menu['link'];
158
  $np_submenu_original[$index][3] = $menu['label'];
159
+ $np_submenu_original[$index][4] = (isset($menu['hidden']) && $menu['hidden'] == 'true') ? true : false;
160
 
161
  if ( isset($menu['hidden']) && $menu['hidden'] == 'true' ) continue;
162
  $new_submenu[$index][0] = $menu['label'];
166
  }
167
  $submenu[$menu_option['link']] = $new_submenu;
168
  }
169
+
170
+ // Submenu pages added by plugins after saving customizations
171
+ foreach ( $np_submenu_original as $id => $submenu_original ){
172
+ if ( !isset($submenu[$id]) || empty($submenu[$id]) ) continue;
173
+ foreach ( $submenu_original as $submenu_item ){
174
+ if ( !$this->submenuExists($submenu[$id], $submenu_item[2])
175
+ && !$this->submenuHidden($menu_options[$this->current_user_role][$id]['submenu'], $submenu_item[2]) ) {
176
+ $submenu[$id][] = $submenu_item;
177
+ }
178
+ }
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Does the submenu exist in the source menu?
184
+ */
185
+ private function submenuExists($source_menu, $link)
186
+ {
187
+ $exists = false;
188
+ foreach ( $source_menu as $menu_item ){
189
+ if ( $menu_item[2] == $link ) $exists = true;
190
+ }
191
+ return $exists;
192
+ }
193
+
194
+ private function submenuHidden($menu_options, $submenu_link)
195
+ {
196
+ $hidden = false;
197
+ foreach ( $menu_options as $option ){
198
+ if ( $option['link'] == $submenu_link && isset($option['hidden']) ) $hidden = true;
199
+ }
200
+ return $hidden;
201
+ echo '<pre>';
202
+ var_dump($submenu_link);
203
+ var_dump($menu_options);
204
+ echo '</pre>';
205
  }
206
 
207
  /**
222
  // Set each role's menu order
223
  $user_roles = $this->user_repo->allRoles(array());
224
  foreach( $user_roles as $role ){
 
225
 
226
+ if ( !array_key_exists($role['name'], $menu_options) ) continue;
227
+ $missing_submenus = [];
228
  foreach ( $menu_options[$role['name']] as $key => $item ){
 
229
  foreach ( $np_menu_original as $menu_key => $menu_item ){
230
  if ( isset($menu_item[2]) && $menu_item[2] == $key ) {
231
+ if ( isset($np_submenu_original[$menu_item[2]]) ) {
232
+ $menu_item['submenu'] = $np_submenu_original[$menu_item[2]];
233
+ }
234
  $np_menu_ordered[$role['name']][] = $menu_item;
235
  } // submenu
236
  } // np menu original
253
  }
254
 
255
  // Add missing items (added by plugins after saving a custom menu)
256
+ $missing_top_items = [];
257
+ $missing_sub_items = [];
258
  foreach ( $np_menu_ordered as $role => $ordered_menu ){
259
  if ( $role == 'default' ) continue;
260
  $all_items = [];
265
  foreach ( $ordered_menu as $ordered_item ){
266
  if ( array_key_exists($ordered_item[2], $all_items) ) unset($all_items[$ordered_item[2]]);
267
  }
268
+ $missing_top_items[$role] = $all_items;
269
+ foreach ( $ordered_menu as $ordered_item ){
270
+
271
+ }
272
  }
273
+
274
+ foreach ( $missing_top_items as $role => $items ){
275
  foreach ( $items as $item_id => $key ){
276
  $np_menu_ordered[$role][] = $np_menu_ordered['default'][$key];
277
  }
278
  }
 
279
  $np_menu_original = $np_menu_ordered;
280
  }
281
 
app/Form/Events.php CHANGED
@@ -50,7 +50,8 @@ class Events
50
  'wp_ajax_nppostSearch',
51
  'wp_ajax_npWpmlTranslations',
52
  'wp_ajax_npresetSettings',
53
- 'wp_ajax_npresetUserPreferences'
 
54
  ];
55
  $this->setHandlers();
56
  }
50
  'wp_ajax_nppostSearch',
51
  'wp_ajax_npWpmlTranslations',
52
  'wp_ajax_npresetSettings',
53
+ 'wp_ajax_npresetUserPreferences',
54
+ 'wp_ajax_npresetAdminMenuSettings'
55
  ];
56
  $this->setHandlers();
57
  }
app/Form/Listeners/ResetAdminMenuSettings.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace NestedPages\Form\Listeners;
3
+
4
+ class ResetAdminMenuSettings extends BaseHandler
5
+ {
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->reset();
10
+ }
11
+
12
+ private function reset()
13
+ {
14
+ $this->settings->resetAdminMenuSettings();
15
+ return wp_send_json(['status' => 'success']);
16
+ }
17
+ }
app/NestedPages.php CHANGED
@@ -12,7 +12,7 @@ class NestedPages
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
- $np_version = '3.1.0';
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.1.1';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
app/Views/settings/partials/nav-menu-settings.php CHANGED
@@ -2,14 +2,9 @@
2
  /**
3
  * Outputs the Admin Navigation Customization Settings, with specific settings for each user role
4
  */
5
- $roles = $this->user_repo->allRoles(null, true);
6
- $nav_menu_options = $this->settings->adminCustomEnabled('nav_menu_options');
7
- global $np_menu_original;
8
- global $np_submenu_original;
9
- global $menu;
10
  $c = 1;
11
- foreach ( $roles as $role ) :
12
- $menu = $np_menu_original;
13
  $menu = ( isset($menu[$role['name']]) ) ? $menu[$role['name']] : $menu['default'];
14
  $role_capabilities = $this->user_repo->getSingleRole($role['name']);
15
  $role_capabilities = $role_capabilities['capabilities'];
@@ -18,34 +13,7 @@ foreach ( $roles as $role ) :
18
  ?>
19
  <div class="np-menu-customization" <?php if ( $c == 1 ) echo ' style="display:block;"'; ?> data-np-nav-menu-customization="menu_role_<?php echo $role['name']; ?>">
20
 
21
- <div class="np-menu-customization-header">
22
- <div class="role-select">
23
- <select data-np-nav-menu-user-role-select>
24
- <?php
25
- $s = 0;
26
- foreach ( $roles as $select_role ){
27
- $out = '';
28
- $out .= '<option value="menu_role_' . $select_role['name'] . '"';
29
- if ( $s == 0 ) $out .= ' selected="selected"';
30
- $out .= '>' . $select_role['label'] . '</option>';
31
- echo $out;
32
- $s++;
33
- }
34
- ?>
35
- </select>
36
- </div><!-- .role-select -->
37
- <div class="new">
38
- <div class="nestedpages-dropdown" data-dropdown>
39
- <a href="#" class="nestedpages-dropdown-toggle" data-dropdown-toggle><?php _e('New', 'wp-nested-pages'); ?> <span class="np-caret"></span></a>
40
- <div class="nestedpages-dropdown-content right" data-dropdown-content>
41
- <ul>
42
- <li><a href="#" data-np-add-separator-button><?php _e('Separator', 'wp-nested-pages'); ?></a></li>
43
- </ul>
44
- </div>
45
- </div>
46
- </div><!-- .new -->
47
- <div class="hide"><?php _e('Hide', 'wp-nested-pages'); ?></div>
48
- </div><!-- .np-menu-customization-header -->
49
 
50
  <ul class="np-nav-menu-settings" data-np-sortable-admin-nav>
51
 
@@ -53,101 +21,67 @@ foreach ( $roles as $role ) :
53
  $i = 0; // Counter for order
54
  foreach ( $menu as $menu_item ) :
55
 
56
- $separator = ( $menu_item[0] == '' && isset($menu_item[4]) && $menu_item[4] == 'wp-menu-separator' ) ? true : false;
57
-
58
- // WooCommerce Separator
59
- if ( isset($menu_item[4]) && $menu_item[4] == 'wp-menu-separator woocommerce' ) $separator = true;
60
- if ( !array_key_exists($menu_item[1], $role_capabilities) || !$role_capabilities[$menu_item[1]] ) continue; // This role doesn't have access to this item
61
- $custom_item = ( isset($menu_item[7]) && $menu_item[7] == 'custom-item' ) ? true : false;
62
- $id = $menu_item[2];
63
-
64
- // Set the Label
65
- $text = strip_tags(preg_replace('#<span[^>]*>(.*)</span>#isU','', $menu_item[0]));
66
- $original_text = $text;
67
- $custom_label = null;
68
- if ( isset($nav_menu_options[$role['name']][$id]['label']) && $nav_menu_options[$role['name']][$id]['label'] !== '' )
69
- $custom_label = $nav_menu_options[$role['name']][$id]['label'];
70
- if ( $custom_item && !$custom_label ) $custom_label = strip_tags(preg_replace('#<span[^>]*>(.*)</span>#isU','', $menu_item[0]));
71
- if ( $separator ) $custom_label = __('Separator', 'wp-nested-pages');
72
- if ( $custom_label ) $text = $custom_label;
73
 
74
- // Set the Icon
75
- $icon = ( isset($menu_item[6]) && $menu_item[6] !== '' ) ? $menu_item[6] : 'dashicons-admin-post';
76
- $original_icon = $icon;
77
- $custom_icon = null;
78
- if ( isset($nav_menu_options[$role['name']][$id]['icon']) && $nav_menu_options[$role['name']][$id]['icon'] !== '' )
79
- $custom_icon = $nav_menu_options[$role['name']][$id]['icon'];
80
- if ( $custom_item && !$custom_icon ) $custom_icon = $menu_item[6];
81
- if ( $custom_icon ) $icon = $custom_icon;
82
-
83
- // Set the Link
84
- $original_link = $menu_item[2];
85
  ?>
86
- <li class="np-nav-preview <?php if ( in_array($id, $hidden) ) echo 'disabled'; ?><?php if ( $separator ) echo ' separator';?>" <?php if ( $separator ) echo 'data-np-separator-row'; ?>>
87
  <div class="menu-item">
88
  <div class="submenu-toggle">
89
- <?php if ( isset($menu_item['submenu']) ) : ?>
90
  <a href="#" data-np-nav-menu-customization-submenu-toggle><span class="arrow"></span></a>
91
  <?php endif; ?>
92
  </div>
93
  <div class="handle">
94
  <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>
95
  </div>
96
- <div class="title"><div class="menu-icon dashicons-before <?php echo $icon; ?>"></div>
97
  <p>
98
- <?php if ( $separator ) : ?>
99
  <?php
100
  echo ( $menu_item[4] !== 'wp-menu-separator woocommerce' ) ? __('Separator', 'wp-nested-pages') : __('Separator (WooCommerce)', 'wp-nested-pages');
101
  ?>
102
  <button class="button button-small details-button" data-np-remove-separator-button><?php _e('Remove', 'wp-nested-pages'); ?></button>
103
  <?php else : ?>
104
- <input type="text" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][label]" value="<?php if ( $custom_label ) echo $custom_label; ?>" placeholder="<?php echo esc_html($original_text); ?>" class="menu-title-field" />
105
  <button class="button button-small details-button" data-np-extra-options-button><?php _e('Details', 'wp-nested-pages');?></button>
106
  <?php endif; ?>
107
  </p>
108
  </div><!-- .title -->
109
  </div><!-- .menu-item -->
110
- <?php if ( !$separator ) : ?>
111
  <div class="hide-checkbox">
112
- <input type="checkbox" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][hidden]" value="<?php echo $id; ?>" data-nestedpages-admin-nav-item-checkbox <?php if ( in_array($id, $hidden) ) echo 'checked'; ?> />
 
 
113
  </div>
114
  <?php else : ?>
115
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>]" value="true">
116
  <?php endif; ?>
117
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][order]" value="<?php echo $i; ?>" data-np-menu-order>
118
- <?php if ( !$separator ) : ?>
119
  <div class="np-extra-options" data-np-extra-options>
120
  <div class="half">
121
  <label><?php _e('Icon CSS Class', 'wp-nested-pages'); ?> <em>(<a href="https://developer.wordpress.org/resource/dashicons/#admin-site" target="_blank"><?php _e('Reference', 'wp-nested-pages'); ?></a>)</em></label>
122
- <input type="text" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][icon]" value="<?php if ( $custom_icon ) echo $custom_icon; ?>" placeholder="<?php echo $original_icon; ?>" />
123
  </div><!-- .half -->
124
  <div class="half right" style="display:none;">
125
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][link]" value="<?php echo $original_link; ?>">
126
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][original_link]" value="<?php echo $original_link; ?>">
127
  </div>
128
  </div><!-- .np-extra-options -->
129
  <?php endif; ?>
130
 
131
- <?php
132
- if ( isset($menu_item['submenu']) ) :
133
-
134
- // Use the custom menu if available, otherwise use default
135
- if ( isset($nav_menu_options[$role['name']][$id]['submenu']) ){
136
- $submenu_items = $nav_menu_options[$role['name']][$id]['submenu'];
137
- $has_custom_submenu = true;
138
- } else {
139
- $submenu_items = $menu_item['submenu'];
140
- $has_custom_submenu = false;
141
- }
142
- ?>
143
  <ul class="submenu-listing" data-np-sortable-admin-subnav>
144
  <?php
145
  $si = 0;
146
- foreach ( $submenu_items as $submenu ) :
147
- $label = ( $has_custom_submenu ) ? $submenu['label'] : $submenu[0];
148
- $role_name = ( $has_custom_submenu ) ? $submenu['role'] : $submenu[1];
149
- $link = ( $has_custom_submenu ) ? $submenu['link'] : $submenu[2];
150
- $hidden_sub = ( $has_custom_submenu && isset($submenu['hidden']) && $submenu['hidden'] == 'true' ) ? true : false;
151
  if ( !array_key_exists($role_name, $role_capabilities) || !$role_capabilities[$role_name] ) continue; // This role doesn't have access to this item
152
  ?>
153
  <li class="np-nav-preview <?php if ( $hidden_sub ) echo 'disabled'; ?> submenu-item" data-np-sortable-admin-nav>
@@ -155,25 +89,23 @@ foreach ( $roles as $role ) :
155
  <div class="handle">
156
  <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>
157
  </div>
158
- <div class="title">
159
- <p><?php echo $label; ?></p>
160
- </div>
161
  <div class="hide-checkbox">
162
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][submenu][<?php echo $si; ?>][label]" value="<?php echo $label; ?>" />
163
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][submenu][<?php echo $si; ?>][role]" value="<?php echo $role_name; ?>" />
164
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][submenu][<?php echo $si; ?>][link]" value="<?php echo $link; ?>" />
165
- <input type="checkbox" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][submenu][<?php echo $si; ?>][hidden]" value="true" data-nestedpages-admin-nav-item-checkbox <?php if ( $hidden_sub ) echo 'checked'; ?>/>
166
- <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $id; ?>][submenu][<?php echo $si; ?>][order]" value="<?php echo $si; ?>" data-np-submenu-order>
 
 
167
  </div>
168
  </div><!-- .menu-item -->
169
  </li>
170
  <?php $si++; endforeach; ?>
171
  </ul>
172
  <?php endif; // Submenu ?>
173
-
174
  </li>
175
  <?php $i++; endforeach; ?>
176
  </ul>
177
  </div><!-- .np-menu-customization -->
178
-
179
  <?php $c++; endforeach;
2
  /**
3
  * Outputs the Admin Navigation Customization Settings, with specific settings for each user role
4
  */
 
 
 
 
 
5
  $c = 1;
6
+ foreach ( $this->admin_menu_settings->roles as $role ) :
7
+ $menu = $this->admin_menu_settings->np_menu_original;
8
  $menu = ( isset($menu[$role['name']]) ) ? $menu[$role['name']] : $menu['default'];
9
  $role_capabilities = $this->user_repo->getSingleRole($role['name']);
10
  $role_capabilities = $role_capabilities['capabilities'];
13
  ?>
14
  <div class="np-menu-customization" <?php if ( $c == 1 ) echo ' style="display:block;"'; ?> data-np-nav-menu-customization="menu_role_<?php echo $role['name']; ?>">
15
 
16
+ <?php include(NestedPages\Helpers::view('settings/partials/nav-menu-settings/header')); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  <ul class="np-nav-menu-settings" data-np-sortable-admin-nav>
19
 
21
  $i = 0; // Counter for order
22
  foreach ( $menu as $menu_item ) :
23
 
24
+ // This role doesn't have access to this item
25
+ if ( !array_key_exists($menu_item[1], $role_capabilities) || !$role_capabilities[$menu_item[1]] ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ $item_data = $this->admin_menu_settings->menuItemData($menu_item, $role);
 
 
 
 
 
 
 
 
 
 
28
  ?>
29
+ <li class="np-nav-preview <?php if ( in_array($item_data['id'], $hidden) ) echo 'disabled'; ?><?php if ( $item_data['separator'] ) echo ' separator';?>" <?php if ( $item_data['separator'] ) echo 'data-np-separator-row'; ?>>
30
  <div class="menu-item">
31
  <div class="submenu-toggle">
32
+ <?php if ( $item_data['submenu'] ) : ?>
33
  <a href="#" data-np-nav-menu-customization-submenu-toggle><span class="arrow"></span></a>
34
  <?php endif; ?>
35
  </div>
36
  <div class="handle">
37
  <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>
38
  </div>
39
+ <div class="title"><div class="menu-icon dashicons-before <?php echo $item_data['icon']; ?>"></div>
40
  <p>
41
+ <?php if ( $item_data['separator'] ) : ?>
42
  <?php
43
  echo ( $menu_item[4] !== 'wp-menu-separator woocommerce' ) ? __('Separator', 'wp-nested-pages') : __('Separator (WooCommerce)', 'wp-nested-pages');
44
  ?>
45
  <button class="button button-small details-button" data-np-remove-separator-button><?php _e('Remove', 'wp-nested-pages'); ?></button>
46
  <?php else : ?>
47
+ <input type="text" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][label]" value="<?php if ( $item_data['custom_label'] ) echo $item_data['custom_label']; ?>" placeholder="<?php echo esc_html($item_data['original_text']); ?>" class="menu-title-field" />
48
  <button class="button button-small details-button" data-np-extra-options-button><?php _e('Details', 'wp-nested-pages');?></button>
49
  <?php endif; ?>
50
  </p>
51
  </div><!-- .title -->
52
  </div><!-- .menu-item -->
53
+ <?php if ( !$item_data['separator'] ) : ?>
54
  <div class="hide-checkbox">
55
+ <?php if ( $item_data['original_link'] !== 'options-general.php' ) : ?>
56
+ <input type="checkbox" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][hidden]" value="<?php echo $item_data['id']; ?>" data-nestedpages-admin-nav-item-checkbox <?php if ( in_array($item_data['id'], $hidden) ) echo 'checked'; ?> />
57
+ <?php endif; ?>
58
  </div>
59
  <?php else : ?>
60
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>]" value="true">
61
  <?php endif; ?>
62
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][order]" value="<?php echo $i; ?>" data-np-menu-order>
63
+ <?php if ( !$item_data['separator'] ) : ?>
64
  <div class="np-extra-options" data-np-extra-options>
65
  <div class="half">
66
  <label><?php _e('Icon CSS Class', 'wp-nested-pages'); ?> <em>(<a href="https://developer.wordpress.org/resource/dashicons/#admin-site" target="_blank"><?php _e('Reference', 'wp-nested-pages'); ?></a>)</em></label>
67
+ <input type="text" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][icon]" value="<?php if ( $item_data['custom_icon'] ) echo $item_data['custom_icon']; ?>" placeholder="<?php echo $item_data['original_icon']; ?>" />
68
  </div><!-- .half -->
69
  <div class="half right" style="display:none;">
70
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][link]" value="<?php echo $item_data['original_link']; ?>">
71
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][original_link]" value="<?php echo $item_data['original_link']; ?>">
72
  </div>
73
  </div><!-- .np-extra-options -->
74
  <?php endif; ?>
75
 
76
+ <?php if ( $item_data['submenu'] ) : ?>
 
 
 
 
 
 
 
 
 
 
 
77
  <ul class="submenu-listing" data-np-sortable-admin-subnav>
78
  <?php
79
  $si = 0;
80
+ foreach ( $item_data['submenu_items'] as $submenu ) :
81
+ $label = ( $item_data['has_custom_submenu'] ) ? $submenu['label'] : $submenu[0];
82
+ $role_name = ( $item_data['has_custom_submenu'] ) ? $submenu['role'] : $submenu[1];
83
+ $link = ( $item_data['has_custom_submenu'] ) ? $submenu['link'] : $submenu[2];
84
+ $hidden_sub = ( $item_data['has_custom_submenu'] && isset($submenu['hidden']) && $submenu['hidden'] == 'true' ) ? true : false;
85
  if ( !array_key_exists($role_name, $role_capabilities) || !$role_capabilities[$role_name] ) continue; // This role doesn't have access to this item
86
  ?>
87
  <li class="np-nav-preview <?php if ( $hidden_sub ) echo 'disabled'; ?> submenu-item" data-np-sortable-admin-nav>
89
  <div class="handle">
90
  <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>
91
  </div>
92
+ <div class="title"><p><?php echo $label; ?></p></div>
 
 
93
  <div class="hide-checkbox">
94
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][submenu][<?php echo $si; ?>][label]" value="<?php echo $label; ?>" />
95
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][submenu][<?php echo $si; ?>][role]" value="<?php echo $role_name; ?>" />
96
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][submenu][<?php echo $si; ?>][link]" value="<?php echo $link; ?>" />
97
+ <input type="hidden" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][submenu][<?php echo $si; ?>][order]" value="<?php echo $si; ?>" data-np-submenu-order>
98
+ <?php if ( $link !== 'nested-pages-settings' ) : ?>
99
+ <input type="checkbox" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][submenu][<?php echo $si; ?>][hidden]" value="true" data-nestedpages-admin-nav-item-checkbox <?php if ( $hidden_sub ) echo 'checked'; ?>/>
100
+ <?php endif; ?>
101
  </div>
102
  </div><!-- .menu-item -->
103
  </li>
104
  <?php $si++; endforeach; ?>
105
  </ul>
106
  <?php endif; // Submenu ?>
 
107
  </li>
108
  <?php $i++; endforeach; ?>
109
  </ul>
110
  </div><!-- .np-menu-customization -->
 
111
  <?php $c++; endforeach;
app/Views/settings/partials/nav-menu-settings/header.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="np-menu-customization-header">
2
+ <div class="role-select">
3
+ <select data-np-nav-menu-user-role-select>
4
+ <?php
5
+ $s = 0;
6
+ foreach ( $this->admin_menu_settings->roles as $select_role ){
7
+ $out = '';
8
+ $out .= '<option value="menu_role_' . $select_role['name'] . '"';
9
+ if ( $s == 0 ) $out .= ' selected="selected"';
10
+ $out .= '>' . $select_role['label'] . '</option>';
11
+ echo $out;
12
+ $s++;
13
+ }
14
+ ?>
15
+ </select>
16
+ </div><!-- .role-select -->
17
+ <div class="new">
18
+ <div class="nestedpages-dropdown" data-dropdown>
19
+ <a href="#" class="nestedpages-dropdown-toggle" data-dropdown-toggle><?php _e('New', 'wp-nested-pages'); ?> <span class="np-caret"></span></a>
20
+ <div class="nestedpages-dropdown-content right" data-dropdown-content>
21
+ <ul>
22
+ <li><a href="#" data-np-add-separator-button><?php _e('Separator', 'wp-nested-pages'); ?></a></li>
23
+ </ul>
24
+ </div>
25
+ </div>
26
+ </div><!-- .new -->
27
+ <div class="hide"><?php _e('Hide', 'wp-nested-pages'); ?></div>
28
+ </div><!-- .np-menu-customization-header -->
app/Views/settings/settings-admincustom.php CHANGED
@@ -1,4 +1,6 @@
1
- <?php settings_fields( 'nestedpages-admincustomization' ); ?>
 
 
2
  <h3><?php _e('Select Items to Customize', 'wp-nested-pages'); ?></h3>
3
  <div class="nestedpages-settings-table">
4
 
@@ -18,6 +20,9 @@
18
  <div class="description">
19
  <p><strong><?php _e('Menu Items', 'wp-nested-pages'); ?></strong><br><?php _e('Reorder, hide and rename admin menu items by user role. These changes do not effect actual permissions, only menu appearance.'); ?></p>
20
  <p><strong><?php _e('Important: Plugin Menu Items ', 'wp-nested-pages'); ?></strong><br><?php _e('Some plugins may add menu items on activation. These new menu items will not display until the Nested Pages Admin Menu has been configured with these items.', 'wp-nested-pages'); ?></p>
 
 
 
21
  </div>
22
  <div class="field">
23
  <?php include(NestedPages\Helpers::view('settings/partials/nav-menu-settings')); ?>
1
+ <?php
2
+ $this->admin_menu_settings = new NestedPages\Config\AdminMenuSettings;
3
+ settings_fields( 'nestedpages-admincustomization' ); ?>
4
  <h3><?php _e('Select Items to Customize', 'wp-nested-pages'); ?></h3>
5
  <div class="nestedpages-settings-table">
6
 
20
  <div class="description">
21
  <p><strong><?php _e('Menu Items', 'wp-nested-pages'); ?></strong><br><?php _e('Reorder, hide and rename admin menu items by user role. These changes do not effect actual permissions, only menu appearance.'); ?></p>
22
  <p><strong><?php _e('Important: Plugin Menu Items ', 'wp-nested-pages'); ?></strong><br><?php _e('Some plugins may add menu items on activation. These new menu items will not display until the Nested Pages Admin Menu has been configured with these items.', 'wp-nested-pages'); ?></p>
23
+ <p>
24
+ <button class="np-btn np-btn-trash" data-nestedpages-reset-admin-menu><?php _e('Reset Admin Menu Settings', 'wp-nested-pages'); ?></button>
25
+ </p>
26
  </div>
27
  <div class="field">
28
  <?php include(NestedPages\Helpers::view('settings/partials/nav-menu-settings')); ?>
assets/js/lib/nestedpages-factory.js CHANGED
@@ -162,7 +162,8 @@ NestedPages.formActions = {
162
  postSearch: 'nppostSearch',
163
  wpmlTranslations : 'npWpmlTranslations',
164
  resetSettings : 'npresetSettings',
165
- resetUserPrefs : 'npresetUserPreferences'
 
166
  }
167
 
168
 
162
  postSearch: 'nppostSearch',
163
  wpmlTranslations : 'npWpmlTranslations',
164
  resetSettings : 'npresetSettings',
165
+ resetUserPrefs : 'npresetUserPreferences',
166
+ resetAdminMenuSettings : 'npresetAdminMenuSettings'
167
  }
168
 
169
 
assets/js/lib/nestedpages.settings-reset.js CHANGED
@@ -13,7 +13,8 @@ NestedPages.SettingsReset = function()
13
  plugin.selectors = {
14
  resetButton : 'data-nestedpages-reset-settings',
15
  resetForm : '.nestedpages-reset-settings',
16
- formComplete : '.nestedpages-reset-settings-complete'
 
17
  }
18
 
19
  plugin.bindEvents = function()
@@ -22,6 +23,10 @@ NestedPages.SettingsReset = function()
22
  e.preventDefault();
23
  plugin.resetSettings();
24
  });
 
 
 
 
25
  }
26
 
27
  plugin.resetSettings = function()
@@ -46,13 +51,38 @@ NestedPages.SettingsReset = function()
46
  });
47
  }
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  plugin.loading = function(loading)
50
  {
51
  if ( loading ){
52
  $('[' + plugin.selectors.resetButton + ']').attr('disabled', true);
 
53
  return;
54
  }
55
  $('[' + plugin.selectors.resetButton + ']').removeAttr('disabled');
 
56
  }
57
 
58
  return plugin.bindEvents();
13
  plugin.selectors = {
14
  resetButton : 'data-nestedpages-reset-settings',
15
  resetForm : '.nestedpages-reset-settings',
16
+ formComplete : '.nestedpages-reset-settings-complete',
17
+ resetAdminMenu : 'data-nestedpages-reset-admin-menu'
18
  }
19
 
20
  plugin.bindEvents = function()
23
  e.preventDefault();
24
  plugin.resetSettings();
25
  });
26
+ $(document).on('click', '[' + plugin.selectors.resetAdminMenu + ']', function(e){
27
+ e.preventDefault();
28
+ plugin.resetAdminMenu();
29
+ });
30
  }
31
 
32
  plugin.resetSettings = function()
51
  });
52
  }
53
 
54
+ plugin.resetAdminMenu = function()
55
+ {
56
+ plugin.loading(true);
57
+ $.ajax({
58
+ url: NestedPages.jsData.ajaxurl,
59
+ type: 'post',
60
+ datatype: 'json',
61
+ data: {
62
+ action : NestedPages.formActions.resetAdminMenuSettings,
63
+ nonce : NestedPages.jsData.nonce
64
+ },
65
+ success: function(data){
66
+ plugin.loading(false);
67
+ if ( data.status == 'success' ){
68
+ location.reload();
69
+ }
70
+ if ( data.status !== 'success' ){
71
+ console.log('There was an error saving toggled pages.');
72
+ }
73
+ }
74
+ });
75
+ }
76
+
77
  plugin.loading = function(loading)
78
  {
79
  if ( loading ){
80
  $('[' + plugin.selectors.resetButton + ']').attr('disabled', true);
81
+ $('[' + plugin.selectors.resetAdminMenu + ']').attr('disabled', true);
82
  return;
83
  }
84
  $('[' + plugin.selectors.resetButton + ']').removeAttr('disabled');
85
+ $('[' + plugin.selectors.resetAdminMenu + ']').removeAttr('disabled');
86
  }
87
 
88
  return plugin.bindEvents();
assets/js/nestedpages.js CHANGED
@@ -2551,7 +2551,8 @@ NestedPages.formActions = {
2551
  postSearch: 'nppostSearch',
2552
  wpmlTranslations : 'npWpmlTranslations',
2553
  resetSettings : 'npresetSettings',
2554
- resetUserPrefs : 'npresetUserPreferences'
 
2555
  }
2556
 
2557
 
2551
  postSearch: 'nppostSearch',
2552
  wpmlTranslations : 'npWpmlTranslations',
2553
  resetSettings : 'npresetSettings',
2554
+ resetUserPrefs : 'npresetUserPreferences',
2555
+ resetAdminMenuSettings : 'npresetAdminMenuSettings'
2556
  }
2557
 
2558
 
assets/js/nestedpages.min.js CHANGED
@@ -1 +1 @@
1
- (NestedPages=NestedPages||{}).Formatter=function(){var s=this,o=jQuery;s.updateSubMenuToggle=function(){for(var e=o(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a=e[t],s=o(a).parent(".row").parent("li");if(0<o(s).children("ol").length){if(o(s).children("ol").find("li.page-row").length<1){o(s).children("ol").hide();continue}var n='<div class="child-toggle-spacer"></div>';n+='<a href="#"',0<o(s).children("ol:visible").length&&(n+=' class="open"'),n+='><span class="np-icon-arrow"></span></a>',o(a).html(n),0<o(s).children("ol").children(".np-hide").length&&0===o(s).children("ol").children(".np-hide.shown").length?o(a).find("a").hide():0<o(s).children("ol").children(".np-hide").length&&0<o(s).children("ol").children(".np-hide.shown").length&&o(a).find("a").show()}else o(a).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){o(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),o.each(o(NestedPages.selectors.lists),function(){o(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){o.each(o(NestedPages.selectors.lists),function(e,t){var a=o(this).parents(NestedPages.selectors.lists).length,s=0;if(NestedPages.jsData.sortable||(s=10),0<a){s=20*a+s;o(this).find(".row-inner").css("padding-left",s+"px")}else NestedPages.jsData.sortable&&!o(this).hasClass("no-sort")?o(this).find(".row-inner").css("padding-left","0px"):o(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){if(NestedPages.jsData.nestable){var t=40*o(e.placeholder).parents("ol").length-40,a=o(NestedPages.selectors.sortable).width()-t;o(e.placeholder).width(a).css("margin-left",t+"px")}s.updateListVisibility(e)},s.updateListVisibility=function(e){var t=o(e.placeholder).parent("ol");o(t).is(":visible")||(o(t).addClass("nplist"),o(t).show())},s.removeQuickEdit=function(){o(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),o(".sortable .quick-edit").remove(),o(".row").show()},s.showQuickEdit=function(){o("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){o(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){o(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){o(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){o(NestedPages.selectors.ajaxError).find("p").text(e),o(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){o(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=o(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=o(e).width(),a=o(e).height();o.each(o(NestedPages.selectors.thumbnailContainerLink),function(){o(this).width(t),o(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(){if(a.modalOpen)a.closeModals();else{if(0<s(a.activeBtn).length){var 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);var t=s(a.activeBtn).attr(a.selectors.content);void 0!==t&&""!==t&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(t)},a.checkHash=function(){if(window.location.hash&&"#modal"===window.location.hash.substring(0,6)){var e=window.location.hash.substring(7);a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal()}},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var s=this,n=jQuery;return s.activeCheckbox="",s.selectors={checkbox:"[data-np-check-all]"},s.bindEvents=function(){n(document).on("change",s.selectors.checkbox,function(){s.activeCheckbox=n(this),s.toggleCheckboxes()}),n(document).on("change","input[type=checkbox]",function(){s.checkAllStatus(n(this))})},s.init=function(){s.bindEvents()},s.toggleCheckboxes=function(){var t=!!n(s.activeCheckbox).is(":checked"),e=n(s.activeCheckbox).attr("data-np-check-all"),a=n('*[name="'+e+'"]');n.each(a,function(){var e=n(this).parents(NestedPages.selectors.rows);n(this).prop("checked",t),n(e).hasClass("np-hide")&&!n(e).is(":visible")&&n(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),s.toggleCheckAll()},s.toggleCheckAll=function(){var e=n(s.activeCheckbox).attr("data-np-check-all"),t=n('*[name="'+e+'"]').length;t=t-n(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+n(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length;var a=n('*[name="'+e+'"]:checked').length;if(t==a)return n(s.activeCheckbox).prop("checked",!0),void n(s.activeCheckbox).removeClass("check-all-partial");0<a?n(s.activeCheckbox).addClass("check-all-partial"):(n(s.activeCheckbox).attr("checked",!1),n(s.activeCheckbox).removeClass("check-all-partial"))},s.checkAllStatus=function(e){var t=n(e).attr("name"),a=n('*[data-np-check-all="'+t+'"]');0!==a.length&&(s.activeCheckbox=n(a)[0],s.toggleCheckAll())},s.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var o=this,i=jQuery;return o.selectedNumber=0,o.selectedLinks=[],o.selectedPosts=[],o.init=function(){o.bindEvents()},o.bindEvents=function(){i(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){o.toggleBulkForm()}),i(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===i("select[name=np_bulk_action]").val()&&(e.preventDefault(),o.toggleBulkEdit(!0))}),i(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();var t=i(this).siblings("input[type=hidden]").val();o.uncheckBulkItem(t)}),i(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),o.uncheckAllBulkItems()})},o.toggleBulkForm=function(){var a=!1,s="",n="";if(o.selectedPosts=[],o.selectedLinks=[],i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){if(i(this).is(":checked")){var e=i(this).parents(NestedPages.selectors.rows);if(a=!0,i(this).parent("div").hasClass("np-check-all")||i(e).hasClass("post-type-np-redirect")||(s+=i(this).val()+","),i(e).hasClass("post-type-np-redirect")&&(n+=i(this).val()+",",o.selectedLinks.push(i(this).val())),"np-redirect"!==i(this).attr("data-np-post-type")&&!i(this).parent("div").hasClass("np-check-all")){var t=[];t.title=i(this).attr("data-np-bulk-checkbox"),t.id=i(this).val(),o.selectedPosts.push(t)}}}),o.setBulkEditPosts(),o.toggleEditOption(),o.toggleLinkCountAlert(),a)return i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkActionsIds).val(s),i(NestedPages.selectors.bulkActionRedirectIds).val(n),void o.setSelectedNumber();i(NestedPages.selectors.bulkActionsIds).val(""),i(NestedPages.selectors.bulkActionsForm).hide()},o.setBulkEditPosts=function(){for(var e="",t=0;t<o.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>&times;</a>',e+=o.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+o.selectedPosts[t].id+'"></li>';i(NestedPages.selectors.bulkEditTitles).html(e)},o.uncheckBulkItem=function(e){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).val()==e&&i(this).prop("checked",!1).change()}),0===i(NestedPages.selectors.bulkEditRemoveItem).length&&o.toggleBulkEdit(!1)},o.uncheckAllBulkItems=function(){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).prop("checked",!1).change()}),o.toggleBulkEdit(!1)},o.setSelectedNumber=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option").first();i(t).text(nestedpages.bulk_actions+" ("+e+")")},o.toggleEditOption=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return i(t).prop("disabled",!0),i(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void o.toggleBulkEdit(!1);i(t).prop("disabled",!1)},o.toggleBulkEdit=function(e){if(o.toggleLinkCountAlert(),e)return o.disableParentOptions(),i(NestedPages.selectors.bulkEditForm).show(),i(NestedPages.selectors.bulkActionsForm).hide(),void o.setWPSuggest();i(NestedPages.selectors.bulkEditForm).hide(),i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),i(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),o.resetBulkEditFields()},o.toggleLinkCountAlert=function(){0!==o.selectedLinks.length?i(NestedPages.selectors.bulkEditLinkCount).parent("div").show():i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},o.disableParentOptions=function(){for(var e=i(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<o.selectedPosts.length;t++)i(e).find("option[value="+o.selectedPosts[t].id+"]").attr("disabled",!0)},o.setWPSuggest=function(){var e=i(NestedPages.selectors.bulkEditForm).find("[data-autotag]");i.each(e,function(e,t){var a=i(this).attr("data-taxonomy");i(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},o.resetBulkEditFields=function(){var e=i(NestedPages.selectors.bulkEditForm).find("select");i.each(e,function(){i(this).find("option").first().prop("selected",!0),i(this).find("option").removeAttr("disabled")});var t=i(NestedPages.selectors.bulkEditForm).find(".cat-checklist");i.each(t,function(){i(this).find("input[type=checkbox]").prop("checked",!1)})},o.init()},(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(){if(a(this).is(":checked")){if(a(this).parent("div").hasClass("np-check-all"))return;var 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.init=function(){a.bindEvents()},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=s(e).attr("href");t=t.substring(1),s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),"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.init()},(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;if("1"!==nestedpages.manual_order_sync||e){o(NestedPages.selectors.errorDiv).hide(),o(NestedPages.selectors.loadingIndicator).show(),a=NestedPages.jsData.nestable?o(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):n.setNestingArray(),n.disableNesting();var s=NestedPages.jsData.syncmenu;"1"===nestedpages.manual_menu_sync&&(s="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:s},success:function(e,t){if(n.initializeSortable(),"error"===e.status)o(NestedPages.selectors.errorDiv).text(e.message).show(),o(NestedPages.selectors.loadingIndicator).hide();else{if(t&&"function"==typeof t)return void 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){var s=d(t).attr("data-nestedpages-modal-toggle");void 0!==s&&"np-bulk-modal"==s&&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))})},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=d(e).attr(NestedPages.selectors.newBeforeButton);t=void 0!==t&&""!==t&&t;var a=d(e).attr(NestedPages.selectors.newAfterButton);a=void 0!==a&&""!==a&&a;var s=d(e).closest(NestedPages.selectors.row).parent("li"),n=d(NestedPages.selectors.newPageFormContainer).clone();if(0<d(s).children("ol").length){var o=d(s).children("ol");d(n).insertBefore(o)}else d(n).appendTo(s);d(n).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(n).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),t||a||d(n).find(".page_parent_id").val(d(e).attr("data-id")),t&&(d(n).find(".page_before_id").val(t),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),a&&(d(n).find(".page_after_id").val(a),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(n).show(),d(n).find(".np_title").focus(),d(n).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 a=!!d(e).hasClass("add-edit"),t=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(t=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(t=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+t+"&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();if(!0==a){var t=e.new_pages[0].edit_link;return t=t.replace(/&amp;/g,"&"),void window.location.replace(t)}r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()},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=d(r.form).find(".page_before_id").val();e=""!==e&&e;var t=d(r.form).find(".page_after_id").val();t=""!==t&&t;var a=d(r.form).parent(".new-child").parent(".page-row");if(0!==d(a).children("ol").length||e||t||d(a).append('<ol class="nplist"></ol>'),d(r.form).hasClass("in-modal"))var s=d(".nplist.sortable li.page-row:first");else s=d(a).children("ol");for(i=0;i<r.posts.length;i++)r.appendRows(s,r.posts[i],e,t);e||t||d(s).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n='<li id="menuItem_'+t.id+'" class="page-row';if("publish"===t.status&&(n+=" published"),n+='">',NestedPages.jsData.hierarchical?(n+='<div class="row">',n+='<div class="child-toggle"></div>'):(n+='<div class="row non-hierarchical">',n+='<div class="non-hierarchical-spacer"></div>'),n+='<div class="row-inner">',n+='<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>',n+='<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>',n+='<a href="'+t.edit_link+'" class="page-link page-title">',n+='<span class="title">'+t.title+"</span>","Publish"!==t.status?n+='<span class="status">('+t.status+")</span>":n+='<span class="status"></span>',n+='<span class="nav-status">',"hide"===t.np_nav_status&&(n+=" "+nestedpages.hidden),n+="</span>",n+='<span class="edit-indicator">Edit</span>',n+="</a>",NestedPages.jsData.hierarchical||(n+='<div class="np-post-columns">',n+='<ul class="np-post-info">',n+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",n+="<li>"+t.date_formatted+"</li>",n+="</ul>",n+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(n+='<span class="np-seo-indicator na"></span>'),n+='<div class="action-buttons">',n+='<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>',n+='<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>",n+='<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>",n+="</ul></div>",n+='<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>",n+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",n+='<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>',n+="</div>\x3c!-- .action-buttons --\x3e",n+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",n+="</li>",a){var o=r.findRowById(a);d(n).insertBefore(o)}else if(s){o=r.findRowById(s);d(n).insertAfter(o)}else d(e).append(n)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){var t=d(e).find(".np_title").length;t<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<t?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 d=this,l=jQuery;return d.formatter=new NestedPages.Formatter,d.button="",d.initialData="",d.parent_li="",d.form="",d.flatTerms="",d.termNames="",d.saveButton="",d.newData="",d.row="",d.bindEvents=function(){l(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),d.button=l(this),d.openForm()}),l(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),d.formatter.removeQuickEdit()}),l(document).on("click",NestedPages.selectors.quickEditToggleTaxonomies,function(e){e.preventDefault(),l(this).parents("form").find(".np-taxonomies").toggle()}),l(document).on("click",NestedPages.selectors.quickEditToggleMenuOptions,function(e){e.preventDefault(),l(this).parents("form").find(".np-menuoptions").toggle()}),l(document).on("change",".keep_private",function(){this.checked?l(".post_password").val("").prop("readonly",!0):l(".post_password").prop("readonly",!1)}),l(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),d.saveButton=l(this),d.save()}),l(document).on("keydown",function(e){27===e.keyCode&&d.formatter.removeQuickEdit()})},d.openForm=function(){d.setInitialData(),d.createForm(),d.populateForm(),d.populateFlatTaxonomies()},d.setInitialData=function(){d.initialData={id:l(d.button).attr("data-id"),title:l(d.button).attr("data-title"),slug:l(d.button).attr("data-slug"),author:l(d.button).attr("data-author"),cs:l(d.button).attr("data-commentstatus"),status:l(d.button).attr("data-status"),template:l(d.button).attr("data-template"),month:l(d.button).attr("data-month"),day:l(d.button).attr("data-day"),year:l(d.button).attr("data-year"),hour:l(d.button).attr("data-hour"),minute:l(d.button).attr("data-minute"),navstatus:l(d.button).attr("data-navstatus"),npstatus:l(d.button).attr("data-np-status"),navtitle:l(d.button).attr("data-navtitle"),navtitleattr:l(d.button).attr("data-navtitleattr"),navcss:l(d.button).attr("data-navcss"),linktarget:l(d.button).attr("data-linktarget"),password:l(d.button).attr("data-password"),datepicker:l(d.button).attr("data-datepicker"),time:l(d.button).attr("data-formattedtime"),timeTwentyFour:l(d.button).attr("data-time"),ampm:l(d.button).attr("data-ampm"),timeFormat:l(d.button).attr("data-timeformat"),sticky:l(d.button).attr("data-sticky")};var e=l(d.button)[0].attributes;l.each(e,function(e,t){t.name.includes("data-npcustom")&&(d.initialData[t.name]=t.value)}),d.initialData.h_taxonomies=[],d.initialData.f_taxonomies=[],d.parent_li=l(d.button).closest(NestedPages.selectors.row).parent("li");var t=l(d.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&d.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&d.initialData.f_taxonomies.push(t[i])},d.createForm=function(){if(d.form=l(NestedPages.selectors.quickEditPostForm).clone(),0<l(d.parent_li).children("ol").length){var e=l(d.parent_li).children("ol");l(d.form).insertBefore(e)}else l(d.form).appendTo(d.parent_li);l(d.form).siblings(NestedPages.selectors.row).hide(),l(d.form).show()},d.populateForm=function(){for(var e in l(d.form).find(".page_id").html("<em>ID:</em> "+d.initialData.id),l(d.form).find(".np_id").val(d.initialData.id),l(d.form).find(".np_title").val(d.initialData.title),l(d.form).find(".np_slug").val(d.initialData.slug),l(d.form).find(".np_author select").val(d.initialData.author),l(d.form).find(".np_status").val(d.initialData.status),l(d.form).find(".np_nav_title").val(d.initialData.navtitle),l(d.form).find(".np_title_attribute").val(d.initialData.navtitleattr),l(d.form).find(".np_nav_css_classes").val(d.initialData.navcss),l(d.form).find(".post_password").val(d.initialData.password),l(d.form).find(".np_publish_date").val(d.initialData.datepicker),"open"===d.initialData.cs&&l(d.form).find(".np_cs").attr("checked","checked"),""!==d.initialData.template?l(d.form).find(".np_template").val(d.initialData.template):l(d.form).find(".np_template").val("default"),"private"===d.initialData.status&&(l(d.form).find(".post_password").attr("readonly",!0),l(d.form).find(".keep_private").attr("checked",!0)),"hide"===d.initialData.npstatus?l(d.form).find(".nested_pages_status").attr("checked","checked"):l(d.form).find(".nested_pages_status").removeAttr("checked"),"hide"===d.initialData.navstatus?l(d.form).find(".np_nav_status").attr("checked","checked"):l(d.form).find(".np_nav_status").attr("checked",!1),"_blank"===d.initialData.linktarget?l(d.form).find(".link_target").attr("checked","checked"):l(d.form).find(".link_target").attr("checked",!1),"private"===d.initialData.status&&l(d.form).find(".np_status").val("publish"),"sticky"===d.initialData.sticky?l(d.form).find(".np-sticky").attr("checked","checked"):l(d.form).find(".np-sticky").removeAttr("checked"),"H:i"===d.initialData.timeFormat?l(d.form).find(".np_time").val(d.initialData.timeTwentyFour):(l(d.form).find(".np_time").val(d.initialData.time),l(d.form).find(".np_ampm").val(d.initialData.ampm),l(d.form).find('select[name="mm"]').val(d.initialData.month),l(d.form).find('input[name="jj"]').val(d.initialData.day),l(d.form).find('input[name="aa"]').val(d.initialData.year),l(d.form).find('input[name="hh"]').val(d.initialData.hour),l(d.form).find('input[name="mn"]').val(d.initialData.minute)),d.initialData)if(e.includes("npcustom")&&d.initialData.hasOwnProperty(e)){var t=e.replace("data-npcustom-","");t=t.toLowerCase(),l(d.form).find('[data-np-custom-field="'+t+'"]').val(d.initialData[e])}if(d.populateFlatTaxonomies(),d.initialData.hasOwnProperty("h_taxonomies")){var a=d.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];l(d.form).find(s).attr("checked","checked")}}var n=l(d.form).find(".np_datepicker");l.each(n,function(){var e=l(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){l("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),d.formatter.showQuickEdit(),l(d.form).show()},d.populateFlatTaxonomies=function(){d.initialData.hasOwnProperty("f_taxonomies")&&(d.createTaxonomyObject(),d.getTermNames(),d.setWPSuggest())},d.createTaxonomyObject=function(){var e={};for(i=0;i<d.initialData.f_taxonomies.length;i++){var t=d.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),n=a.splice(s+1);n=n.join("-");var o=t.split("-").splice(0,s);o.shift("inf");var r=o.join("-");r in e||(e[r]=[]),e[r].push(n)}d.flatTerms=e},d.getTermNames=function(){l.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:d.flatTerms},success:function(e){d.termNames=e.terms,d.populateFlatTaxonomyFields()}})},d.populateFlatTaxonomyFields=function(){d.termNames&&l.each(d.termNames,function(e,t){var a=l("#"+e+"-quickedit");l(a).val(t.join(","))})},d.setWPSuggest=function(){var e=l(d.form).find("[data-autotag]");l.each(e,function(e,t){var a=l(this).attr("data-taxonomy");l(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},d.save=function(){d.toggleLoading(!0),l.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:l(d.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?(d.toggleLoading(!1),l(d.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(d.toggleLoading(!1),d.newData=e.post_data,d.updatePostRow())},error:function(e){console.log(e)}})},d.updatePostRow=function(){d.row=l(d.button).parents(".row-inner"),l(d.row).find(".title").text(d.newData.post_title),l(d.row).find(".np-view-button").attr("href",d.newData.permalink);var e=l(d.row).find(".status");if("publish"!==d.newData._status&&"future"!==d.newData._status?l(e).text("("+d.newData._status+")"):"private"===d.newData.keep_private?l(e).text("("+d.newData.keep_private+")"):l(e).text(""),""!==d.newData.post_password&&void 0!==d.newData.post_password){var t=l(e).text();t+=' <span class="locked">',t+='<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>',t+="</span>",l(e).html(t)}var a=l(d.row).find(".nav-status");"hide"==d.newData.nav_status?l(a).text("(Hidden)"):l(a).text("");var s=l(d.row).parent("li");"hide"==d.newData.np_status?(l(s).addClass("np-hide"),l(d.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>')):(l(s).removeClass("np-hide"),l(d.row).find(".status-np-hidden").remove());var n=l(d.row).find(".sticky");"sticky"==d.newData.sticky?l(n).show():l(n).hide(),NestedPages.jsData.hierarchical||l(d.row).find(".np-author-display").text(d.newData.author_name);var o=l(d.row).find(NestedPages.selectors.quickEditOpen);for(var i in l(o).attr("data-id",d.newData.post_id),l(o).attr("data-template",d.newData.page_template),l(o).attr("data-title",d.newData.post_title),l(o).attr("data-slug",d.newData.post_name),l(o).attr("data-commentstatus",d.newData.comment_status),l(o).attr("data-status",d.newData._status),l(o).attr("data-sticky",d.newData.sticky),"private"===d.newData.keep_private&&l(o).attr("data-status","private"),l(o).attr("data-author",d.newData.post_author),l(o).attr("data-np-status",d.newData.np_status),l(o).attr("data-password",d.newData.post_password),l(o).attr("data-navstatus",d.newData.nav_status),l(o).attr("data-navtitle",d.newData.np_nav_title),l(o).attr("data-linktarget",d.newData.link_target),l(o).attr("data-navtitleattr",d.newData.np_title_attribute),l(o).attr("data-navcss",d.newData.np_nav_css_classes),l(o).attr("data-month",d.newData.mm),l(o).attr("data-day",d.newData.jj),l(o).attr("data-year",d.newData.aa),l(o).attr("data-hour",d.newData.hh),l(o).attr("data-minute",d.newData.mn),l(o).attr("data-datepicker",d.newData.np_date),l(o).attr("data-time",d.newData.np_time),l(o).attr("data-formattedtime",d.newData.np_time),l(o).attr("data-ampm",d.newData.np_ampm),d.newData)if(i.includes("np_custom")&&d.newData.hasOwnProperty(i)){var r=i.replace("np_custom_","data-npcustom-");l(o).attr(r,d.newData[i])}d.removeTaxonomyClasses(),d.addCategoryClasses(),d.addHierarchicalClasses(),d.addFlatClasses(),d.addStatusClass(),d.formatter.removeQuickEdit(),d.formatter.flashRow(d.row)},d.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)l(d.row).removeClass(e[i]);l(d.row).addClass(d.newData._status)},d.removeTaxonomyClasses=function(){taxonomies=[];var e=l(d.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&l(d.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&l(d.row).removeClass(e[i])},d.addCategoryClasses=function(){if(d.newData.hasOwnProperty("post_category")){var e=d.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];l(d.row).addClass(t)}}},d.addHierarchicalClasses=function(){if(d.newData.hasOwnProperty("tax_input")){var e=d.newData.tax_input;l.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];l(d.row).addClass(a)}})}},d.addFlatClasses=function(){if(d.newData.hasOwnProperty("flat_tax")){var e=d.newData.flat_tax;l.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];l(d.row).addClass(a)}})}},d.toggleLoading=function(e){if(e)return l(NestedPages.selectors.quickEditErrorDiv).hide(),l(d.saveButton).attr("disabled","disabled"),void l(NestedPages.selectors.quickEditLoadingIndicator).show();l(d.saveButton).attr("disabled",!1),l(NestedPages.selectors.quickEditLoadingIndicator).hide()},d.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var o=this,i=jQuery;return o.formatter=new NestedPages.Formatter,o.button="",o.postData="",o.newPostData="",o.form="",o.bindEvents=function(){i(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),o.formatter.removeQuickEdit(),o.button=i(this),o.openQuickEdit()}),i(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),o.submitForm()}),i(document).on("keydown",function(e){27===e.keyCode&&o.formatter.removeQuickEdit()})},o.openQuickEdit=function(){o.setData(),o.createForm(),o.populateForm()},o.setData=function(){o.postData={id:i(o.button).attr("data-id"),url:i(o.button).attr("data-url"),title:i(o.button).attr("data-title"),status:i(o.button).attr("data-status"),navstatus:i(o.button).attr("data-navstatus"),npstatus:i(o.button).attr("data-np-status"),linktarget:i(o.button).attr("data-linktarget"),parentid:i(o.button).attr("data-parentid"),navtitleattr:i(o.button).attr("data-navtitleattr"),navcss:i(o.button).attr("data-navcss"),navtype:i(o.button).attr("data-nav-type"),navobject:i(o.button).attr("data-nav-object"),navobjectid:i(o.button).attr("data-nav-object-id"),navoriginallink:i(o.button).attr("data-nav-original-link"),navoriginaltitle:i(o.button).attr("data-nav-original-title")}},o.createForm=function(){var e=i(o.button).closest(NestedPages.selectors.row).parent("li");if(o.form=i(NestedPages.selectors.quickEditLinkForm).clone(),0<i(e).children("ol").length){var t=i(e).children("ol");i(o.form).insertBefore(t)}else i(o.form).appendTo(e);i(o.form).siblings(NestedPages.selectors.row).hide()},o.populateForm=function(){if(i(o.form).find(".np_id").val(o.postData.id),i(o.form).find(".np_title").val(o.postData.title),i(o.form).find(".np_author select").val(o.postData.author),i(o.form).find(".np_status").val(o.postData.status),i(o.form).find(".np_content").val(o.postData.url),i(o.form).find(".np_parent_id").val(o.postData.parentid),i(o.form).find(".np_title_attribute").val(o.postData.navtitleattr),i(o.form).find(".np_nav_css_classes").val(o.postData.navcss),"hide"===o.postData.npstatus?i(o.form).find(".np_status").prop("checked","checked"):i(o.form).find(".np_status").removeAttr("checked"),"hide"===o.postData.navstatus?i(o.form).find(".np_nav_status").prop("checked","checked"):i(o.form).find(".np_nav_status").removeAttr("checked"),"_blank"===o.postData.linktarget?i(o.form).find(".link_target").prop("checked","checked"):i(o.form).find(".link_target").removeAttr("checked"),"custom"!==o.postData.navobject&&""!==o.postData.navobject){var e='<div class="form-control original-link">Original: <a href="'+o.postData.navoriginallink+'" target="_blank">'+o.postData.navoriginaltitle+"</a></div>";i(o.form).find("[data-url-field]").remove(),i(e).insertAfter(i(o.form).find("h3")),i(o.form).find("[data-np-menu-object-input]").val(o.postData.navobject),i(o.form).find("[data-np-menu-objectid-input]").val(o.postData.navobjectid),i(o.form).find("[data-np-menu-type-input]").val(o.postData.navtype),i(o.form).find("h3").text("Link: "+o.postData.navoriginaltitle)}else i(o.form).find("h3").text("Link"),i(o.form).find("[data-np-menu-object-input]").val("custom"),i(o.form).find("[data-np-menu-type-input]").val("custom");o.formatter.showQuickEdit(),i(o.form).show()},o.submitForm=function(){o.toggleLoading(!0),i.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:i(o.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?(o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(o.toggleLoading(!1),o.newPostData=e.post_data,o.updateRow())},error:function(e){o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},o.updateRow=function(){var e=i(o.form).siblings(".row");i(e).find(".title").html(o.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=i(e).find(".status");"publish"!==o.newPostData._status&&"future"!==o.newPostData._status?i(t).text("("+o.newPostData._status+")"):i(t).text("");var a=i(e).find(".nav-status");"hide"==o.newPostData.nav_status?i(a).text("("+NestedPages.jsData.hiddenText+")"):i(a).text("");var s=i(e).parent("li");"hide"==o.newPostData.np_status?(i(s).addClass("np-hide"),i(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>')):(i(s).removeClass("np-hide"),i(e).find(".status-np-hidden").remove());var n=i(e).find(NestedPages.selectors.quickEditButtonLink);i(n).attr("data-id",o.newPostData.post_id),i(n).attr("data-title",o.newPostData.post_title),i(n).attr("data-url",o.newPostData.post_content),i(n).attr("data-status",o.newPostData._status),i(n).attr("data-navstatus",o.newPostData.nav_status),i(n).attr("data-np-status",o.newPostData.np_status),i(n).attr("data-linkTarget",o.newPostData.linkTarget),i(n).attr("data-navtitleattr",o.newPostData.titleAttribute),i(n).attr("data-navcss",o.newPostData.cssClasses),o.formatter.removeQuickEdit(),o.formatter.flashRow(e)},o.toggleLoading=function(e){if(i(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return i(NestedPages.selectors.quickEditErrorDiv).hide(),i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void i(NestedPages.selectors.quickEditLoadingIndicator).show();i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),i(NestedPages.selectors.quickEditLoadingIndicator).hide()},o.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 t=this,a=jQuery;return t.activeContent="",t.activeButton="",t.init=function(){t.bindEvents()},t.bindEvents=function(){a(document).on("click",NestedPages.selectors.tabButton,function(e){e.preventDefault(),t.activeButton=a(this),t.toggleTabs()})},t.toggleTabs=function(){t.activeContent=a(t.activeButton).attr("href"),a(NestedPages.selectors.tabContent).hide(),a(t.activeContent).show(),a(t.activeButton).parents(NestedPages.selectors.tabButtonParent).find(NestedPages.selectors.tabButton).removeClass("active"),a(t.activeButton).addClass("active")},t.init()},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]",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",quickEditToggleTaxonomies:".np-toggle-taxonomies",quickEditToggleMenuOptions:".np-toggle-menuoptions",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"},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.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]"},a.search=new NestedPages.MenuSearch,a.init=function(){a.bindEvents()},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").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 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.init()},(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 NestedPages,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(){if(s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val())return n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults();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 a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.nesting=new NestedPages.Nesting,a.activeRow,a.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},a.bindEvents=function(){s(document).ready(function(){a.disableTopOnFirst(),a.disableBottomOnLast()}),s(document).on("click","["+a.selectors.moveToTop+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToTop())}),s(document).on("click","["+a.selectors.moveToBottom+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToBottom())})},a.moveToTop=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).find(NestedPages.selectors.rows).first();s(a.activeRow).insertBefore(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.moveToBottom=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).children(NestedPages.selectors.rows).last();s(a.activeRow).insertAfter(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.disableTopOnFirst=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToTop+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).first();s(e).find("["+a.selectors.moveToTop+"]").addClass("disabled")})},a.disableBottomOnLast=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToBottom+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).last();s(e).find("["+a.selectors.moveToBottom+"]").addClass("disabled")})},a.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var a=this,o=jQuery;return a.button=null,a.postData=null,a.modal=null,a.parent_li=null,a.formatter=new NestedPages.Formatter,a.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},a.bindEvents=function(){nestedpages.wpml&&o(document).on("click","["+a.selectors.translationsBtn+"]",function(e){e.preventDefault(),a.createTranslationsModal(o(this))})},a.createTranslationsModal=function(e){if(a.parent_li=o(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),a.button=o(a.parent_li).find(NestedPages.selectors.quickEditOpen),a.postData={id:o(a.button).attr("data-id"),title:o(a.button).attr("data-title"),slug:o(a.button).attr("data-slug")},a.modal=o("["+a.selectors.modal+"]").clone(),0<o(a.parent_li).children("ol").length){var t=o(a.parent_li).children("ol");o(a.modal).insertBefore(t)}else o(a.modal).appendTo(a.parent_li);o(a.modal).find("["+a.selectors.title+"]").text(a.postData.title),a.formatter.showQuickEdit(),o(a.modal).show(),a.getTranslationData()},a.getTranslationData=function(){o.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:a.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(a.postData.id),"success"===e.status?a.populateModal(e.translations):(o(a.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),a.toggleLoading(!1))}})},a.populateModal=function(s){var n="<tbody>";o.each(s,function(e,t){var a=s[e];n+="<tr>",n+='<td><img src="'+a.country_flag_url+'" alt="'+a.translated_name+'" /> '+a.translated_name+"</td>",n+="<td>",a.has_translation&&a.edit_link?n+='<a href="'+a.edit_link+'">'+a.translation.post_title+" ("+nestedpages.edit+")</a>":n+='<a href="'+a.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",n+="</td>",n+="</tr>"}),n+="</tbody>",o(a.modal).find("["+a.selectors.table+"]").html(n),a.toggleLoading(!1)},a.toggleLoading=function(e){e?o(a.modal).addClass("loading"):o(a.modal).removeClass("loading")},a.bindEvents()};
1
+ (NestedPages=NestedPages||{}).Formatter=function(){var s=this,o=jQuery;s.updateSubMenuToggle=function(){for(var e=o(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a=e[t],s=o(a).parent(".row").parent("li");if(0<o(s).children("ol").length){if(o(s).children("ol").find("li.page-row").length<1){o(s).children("ol").hide();continue}var n='<div class="child-toggle-spacer"></div>';n+='<a href="#"',0<o(s).children("ol:visible").length&&(n+=' class="open"'),n+='><span class="np-icon-arrow"></span></a>',o(a).html(n),0<o(s).children("ol").children(".np-hide").length&&0===o(s).children("ol").children(".np-hide.shown").length?o(a).find("a").hide():0<o(s).children("ol").children(".np-hide").length&&0<o(s).children("ol").children(".np-hide.shown").length&&o(a).find("a").show()}else o(a).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){o(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),o.each(o(NestedPages.selectors.lists),function(){o(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){o.each(o(NestedPages.selectors.lists),function(e,t){var a=o(this).parents(NestedPages.selectors.lists).length,s=0;if(NestedPages.jsData.sortable||(s=10),0<a){s=20*a+s;o(this).find(".row-inner").css("padding-left",s+"px")}else NestedPages.jsData.sortable&&!o(this).hasClass("no-sort")?o(this).find(".row-inner").css("padding-left","0px"):o(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){if(NestedPages.jsData.nestable){var t=40*o(e.placeholder).parents("ol").length-40,a=o(NestedPages.selectors.sortable).width()-t;o(e.placeholder).width(a).css("margin-left",t+"px")}s.updateListVisibility(e)},s.updateListVisibility=function(e){var t=o(e.placeholder).parent("ol");o(t).is(":visible")||(o(t).addClass("nplist"),o(t).show())},s.removeQuickEdit=function(){o(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),o(".sortable .quick-edit").remove(),o(".row").show()},s.showQuickEdit=function(){o("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){o(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){o(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){o(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){o(NestedPages.selectors.ajaxError).find("p").text(e),o(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){o(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=o(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=o(e).width(),a=o(e).height();o.each(o(NestedPages.selectors.thumbnailContainerLink),function(){o(this).width(t),o(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(){if(a.modalOpen)a.closeModals();else{if(0<s(a.activeBtn).length){var 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);var t=s(a.activeBtn).attr(a.selectors.content);void 0!==t&&""!==t&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(t)},a.checkHash=function(){if(window.location.hash&&"#modal"===window.location.hash.substring(0,6)){var e=window.location.hash.substring(7);a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal()}},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var s=this,n=jQuery;return s.activeCheckbox="",s.selectors={checkbox:"[data-np-check-all]"},s.bindEvents=function(){n(document).on("change",s.selectors.checkbox,function(){s.activeCheckbox=n(this),s.toggleCheckboxes()}),n(document).on("change","input[type=checkbox]",function(){s.checkAllStatus(n(this))})},s.init=function(){s.bindEvents()},s.toggleCheckboxes=function(){var t=!!n(s.activeCheckbox).is(":checked"),e=n(s.activeCheckbox).attr("data-np-check-all"),a=n('*[name="'+e+'"]');n.each(a,function(){var e=n(this).parents(NestedPages.selectors.rows);n(this).prop("checked",t),n(e).hasClass("np-hide")&&!n(e).is(":visible")&&n(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),s.toggleCheckAll()},s.toggleCheckAll=function(){var e=n(s.activeCheckbox).attr("data-np-check-all"),t=n('*[name="'+e+'"]').length;t=t-n(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+n(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length;var a=n('*[name="'+e+'"]:checked').length;if(t==a)return n(s.activeCheckbox).prop("checked",!0),void n(s.activeCheckbox).removeClass("check-all-partial");0<a?n(s.activeCheckbox).addClass("check-all-partial"):(n(s.activeCheckbox).attr("checked",!1),n(s.activeCheckbox).removeClass("check-all-partial"))},s.checkAllStatus=function(e){var t=n(e).attr("name"),a=n('*[data-np-check-all="'+t+'"]');0!==a.length&&(s.activeCheckbox=n(a)[0],s.toggleCheckAll())},s.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var o=this,i=jQuery;return o.selectedNumber=0,o.selectedLinks=[],o.selectedPosts=[],o.init=function(){o.bindEvents()},o.bindEvents=function(){i(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){o.toggleBulkForm()}),i(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===i("select[name=np_bulk_action]").val()&&(e.preventDefault(),o.toggleBulkEdit(!0))}),i(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();var t=i(this).siblings("input[type=hidden]").val();o.uncheckBulkItem(t)}),i(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),o.uncheckAllBulkItems()})},o.toggleBulkForm=function(){var a=!1,s="",n="";if(o.selectedPosts=[],o.selectedLinks=[],i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){if(i(this).is(":checked")){var e=i(this).parents(NestedPages.selectors.rows);if(a=!0,i(this).parent("div").hasClass("np-check-all")||i(e).hasClass("post-type-np-redirect")||(s+=i(this).val()+","),i(e).hasClass("post-type-np-redirect")&&(n+=i(this).val()+",",o.selectedLinks.push(i(this).val())),"np-redirect"!==i(this).attr("data-np-post-type")&&!i(this).parent("div").hasClass("np-check-all")){var t=[];t.title=i(this).attr("data-np-bulk-checkbox"),t.id=i(this).val(),o.selectedPosts.push(t)}}}),o.setBulkEditPosts(),o.toggleEditOption(),o.toggleLinkCountAlert(),a)return i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkActionsIds).val(s),i(NestedPages.selectors.bulkActionRedirectIds).val(n),void o.setSelectedNumber();i(NestedPages.selectors.bulkActionsIds).val(""),i(NestedPages.selectors.bulkActionsForm).hide()},o.setBulkEditPosts=function(){for(var e="",t=0;t<o.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>&times;</a>',e+=o.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+o.selectedPosts[t].id+'"></li>';i(NestedPages.selectors.bulkEditTitles).html(e)},o.uncheckBulkItem=function(e){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).val()==e&&i(this).prop("checked",!1).change()}),0===i(NestedPages.selectors.bulkEditRemoveItem).length&&o.toggleBulkEdit(!1)},o.uncheckAllBulkItems=function(){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).prop("checked",!1).change()}),o.toggleBulkEdit(!1)},o.setSelectedNumber=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option").first();i(t).text(nestedpages.bulk_actions+" ("+e+")")},o.toggleEditOption=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return i(t).prop("disabled",!0),i(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void o.toggleBulkEdit(!1);i(t).prop("disabled",!1)},o.toggleBulkEdit=function(e){if(o.toggleLinkCountAlert(),e)return o.disableParentOptions(),i(NestedPages.selectors.bulkEditForm).show(),i(NestedPages.selectors.bulkActionsForm).hide(),void o.setWPSuggest();i(NestedPages.selectors.bulkEditForm).hide(),i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),i(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),o.resetBulkEditFields()},o.toggleLinkCountAlert=function(){0!==o.selectedLinks.length?i(NestedPages.selectors.bulkEditLinkCount).parent("div").show():i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},o.disableParentOptions=function(){for(var e=i(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<o.selectedPosts.length;t++)i(e).find("option[value="+o.selectedPosts[t].id+"]").attr("disabled",!0)},o.setWPSuggest=function(){var e=i(NestedPages.selectors.bulkEditForm).find("[data-autotag]");i.each(e,function(e,t){var a=i(this).attr("data-taxonomy");i(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},o.resetBulkEditFields=function(){var e=i(NestedPages.selectors.bulkEditForm).find("select");i.each(e,function(){i(this).find("option").first().prop("selected",!0),i(this).find("option").removeAttr("disabled")});var t=i(NestedPages.selectors.bulkEditForm).find(".cat-checklist");i.each(t,function(){i(this).find("input[type=checkbox]").prop("checked",!1)})},o.init()},(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(){if(a(this).is(":checked")){if(a(this).parent("div").hasClass("np-check-all"))return;var 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.init=function(){a.bindEvents()},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=s(e).attr("href");t=t.substring(1),s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),"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.init()},(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;if("1"!==nestedpages.manual_order_sync||e){o(NestedPages.selectors.errorDiv).hide(),o(NestedPages.selectors.loadingIndicator).show(),a=NestedPages.jsData.nestable?o(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):n.setNestingArray(),n.disableNesting();var s=NestedPages.jsData.syncmenu;"1"===nestedpages.manual_menu_sync&&(s="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:s},success:function(e,t){if(n.initializeSortable(),"error"===e.status)o(NestedPages.selectors.errorDiv).text(e.message).show(),o(NestedPages.selectors.loadingIndicator).hide();else{if(t&&"function"==typeof t)return void 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){var s=d(t).attr("data-nestedpages-modal-toggle");void 0!==s&&"np-bulk-modal"==s&&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))})},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=d(e).attr(NestedPages.selectors.newBeforeButton);t=void 0!==t&&""!==t&&t;var a=d(e).attr(NestedPages.selectors.newAfterButton);a=void 0!==a&&""!==a&&a;var s=d(e).closest(NestedPages.selectors.row).parent("li"),n=d(NestedPages.selectors.newPageFormContainer).clone();if(0<d(s).children("ol").length){var o=d(s).children("ol");d(n).insertBefore(o)}else d(n).appendTo(s);d(n).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(n).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),t||a||d(n).find(".page_parent_id").val(d(e).attr("data-id")),t&&(d(n).find(".page_before_id").val(t),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),a&&(d(n).find(".page_after_id").val(a),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(n).show(),d(n).find(".np_title").focus(),d(n).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 a=!!d(e).hasClass("add-edit"),t=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(t=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(t=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+t+"&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();if(!0===a){var t=e.new_pages[0].edit_link;return t=t.replace(/&amp;/g,"&"),void window.location.replace(t)}r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()},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=d(r.form).find(".page_before_id").val();e=""!==e&&e;var t=d(r.form).find(".page_after_id").val();t=""!==t&&t;var a=d(r.form).parent(".new-child").parent(".page-row");if(0!==d(a).children("ol").length||e||t||d(a).append('<ol class="nplist"></ol>'),d(r.form).hasClass("in-modal"))var s=d(".nplist.sortable li.page-row:first");else s=d(a).children("ol");for(i=0;i<r.posts.length;i++)r.appendRows(s,r.posts[i],e,t);e||t||d(s).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n='<li id="menuItem_'+t.id+'" class="page-row';if("publish"===t.status&&(n+=" published"),n+='">',NestedPages.jsData.hierarchical?(n+='<div class="row">',n+='<div class="child-toggle"></div>'):(n+='<div class="row non-hierarchical">',n+='<div class="non-hierarchical-spacer"></div>'),n+='<div class="row-inner">',n+='<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>',n+='<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>',n+='<a href="'+t.edit_link+'" class="page-link page-title">',n+='<span class="title">'+t.title+"</span>","Publish"!==t.status?n+='<span class="status">('+t.status+")</span>":n+='<span class="status"></span>',n+='<span class="nav-status">',"hide"===t.np_nav_status&&(n+=" "+nestedpages.hidden),n+="</span>",n+='<span class="edit-indicator">Edit</span>',n+="</a>",NestedPages.jsData.hierarchical||(n+='<div class="np-post-columns">',n+='<ul class="np-post-info">',n+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",n+="<li>"+t.date_formatted+"</li>",n+="</ul>",n+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(n+='<span class="np-seo-indicator na"></span>'),n+='<div class="action-buttons">',n+='<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>',n+='<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>",n+='<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>",n+="</ul></div>",n+='<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>",n+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",n+='<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>',n+="</div>\x3c!-- .action-buttons --\x3e",n+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",n+="</li>",a){var o=r.findRowById(a);d(n).insertBefore(o)}else if(s){o=r.findRowById(s);d(n).insertAfter(o)}else d(e).append(n)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){var t=d(e).find(".np_title").length;t<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<t?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 d=this,l=jQuery;return d.formatter=new NestedPages.Formatter,d.button="",d.initialData="",d.parent_li="",d.form="",d.flatTerms="",d.termNames="",d.saveButton="",d.newData="",d.row="",d.bindEvents=function(){l(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),d.button=l(this),d.openForm()}),l(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),d.formatter.removeQuickEdit()}),l(document).on("click",NestedPages.selectors.quickEditToggleTaxonomies,function(e){e.preventDefault(),l(this).parents("form").find(".np-taxonomies").toggle()}),l(document).on("click",NestedPages.selectors.quickEditToggleMenuOptions,function(e){e.preventDefault(),l(this).parents("form").find(".np-menuoptions").toggle()}),l(document).on("change",".keep_private",function(){this.checked?l(".post_password").val("").prop("readonly",!0):l(".post_password").prop("readonly",!1)}),l(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),d.saveButton=l(this),d.save()}),l(document).on("keydown",function(e){27===e.keyCode&&d.formatter.removeQuickEdit()})},d.openForm=function(){d.setInitialData(),d.createForm(),d.populateForm(),d.populateFlatTaxonomies()},d.setInitialData=function(){d.initialData={id:l(d.button).attr("data-id"),title:l(d.button).attr("data-title"),slug:l(d.button).attr("data-slug"),author:l(d.button).attr("data-author"),cs:l(d.button).attr("data-commentstatus"),status:l(d.button).attr("data-status"),template:l(d.button).attr("data-template"),month:l(d.button).attr("data-month"),day:l(d.button).attr("data-day"),year:l(d.button).attr("data-year"),hour:l(d.button).attr("data-hour"),minute:l(d.button).attr("data-minute"),navstatus:l(d.button).attr("data-navstatus"),npstatus:l(d.button).attr("data-np-status"),navtitle:l(d.button).attr("data-navtitle"),navtitleattr:l(d.button).attr("data-navtitleattr"),navcss:l(d.button).attr("data-navcss"),linktarget:l(d.button).attr("data-linktarget"),password:l(d.button).attr("data-password"),datepicker:l(d.button).attr("data-datepicker"),time:l(d.button).attr("data-formattedtime"),timeTwentyFour:l(d.button).attr("data-time"),ampm:l(d.button).attr("data-ampm"),timeFormat:l(d.button).attr("data-timeformat"),sticky:l(d.button).attr("data-sticky")};var e=l(d.button)[0].attributes;l.each(e,function(e,t){t.name.includes("data-npcustom")&&(d.initialData[t.name]=t.value)}),d.initialData.h_taxonomies=[],d.initialData.f_taxonomies=[],d.parent_li=l(d.button).closest(NestedPages.selectors.row).parent("li");var t=l(d.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&d.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&d.initialData.f_taxonomies.push(t[i])},d.createForm=function(){if(d.form=l(NestedPages.selectors.quickEditPostForm).clone(),0<l(d.parent_li).children("ol").length){var e=l(d.parent_li).children("ol");l(d.form).insertBefore(e)}else l(d.form).appendTo(d.parent_li);l(d.form).siblings(NestedPages.selectors.row).hide(),l(d.form).show()},d.populateForm=function(){for(var e in l(d.form).find(".page_id").html("<em>ID:</em> "+d.initialData.id),l(d.form).find(".np_id").val(d.initialData.id),l(d.form).find(".np_title").val(d.initialData.title),l(d.form).find(".np_slug").val(d.initialData.slug),l(d.form).find(".np_author select").val(d.initialData.author),l(d.form).find(".np_status").val(d.initialData.status),l(d.form).find(".np_nav_title").val(d.initialData.navtitle),l(d.form).find(".np_title_attribute").val(d.initialData.navtitleattr),l(d.form).find(".np_nav_css_classes").val(d.initialData.navcss),l(d.form).find(".post_password").val(d.initialData.password),l(d.form).find(".np_publish_date").val(d.initialData.datepicker),"open"===d.initialData.cs&&l(d.form).find(".np_cs").attr("checked","checked"),""!==d.initialData.template?l(d.form).find(".np_template").val(d.initialData.template):l(d.form).find(".np_template").val("default"),"private"===d.initialData.status&&(l(d.form).find(".post_password").attr("readonly",!0),l(d.form).find(".keep_private").attr("checked",!0)),"hide"===d.initialData.npstatus?l(d.form).find(".nested_pages_status").attr("checked","checked"):l(d.form).find(".nested_pages_status").removeAttr("checked"),"hide"===d.initialData.navstatus?l(d.form).find(".np_nav_status").attr("checked","checked"):l(d.form).find(".np_nav_status").attr("checked",!1),"_blank"===d.initialData.linktarget?l(d.form).find(".link_target").attr("checked","checked"):l(d.form).find(".link_target").attr("checked",!1),"private"===d.initialData.status&&l(d.form).find(".np_status").val("publish"),"sticky"===d.initialData.sticky?l(d.form).find(".np-sticky").attr("checked","checked"):l(d.form).find(".np-sticky").removeAttr("checked"),"H:i"===d.initialData.timeFormat?l(d.form).find(".np_time").val(d.initialData.timeTwentyFour):(l(d.form).find(".np_time").val(d.initialData.time),l(d.form).find(".np_ampm").val(d.initialData.ampm),l(d.form).find('select[name="mm"]').val(d.initialData.month),l(d.form).find('input[name="jj"]').val(d.initialData.day),l(d.form).find('input[name="aa"]').val(d.initialData.year),l(d.form).find('input[name="hh"]').val(d.initialData.hour),l(d.form).find('input[name="mn"]').val(d.initialData.minute)),d.initialData)if(e.includes("npcustom")&&d.initialData.hasOwnProperty(e)){var t=e.replace("data-npcustom-","");t=t.toLowerCase(),l(d.form).find('[data-np-custom-field="'+t+'"]').val(d.initialData[e])}if(d.populateFlatTaxonomies(),d.initialData.hasOwnProperty("h_taxonomies")){var a=d.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];l(d.form).find(s).attr("checked","checked")}}var n=l(d.form).find(".np_datepicker");l.each(n,function(){var e=l(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){l("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),d.formatter.showQuickEdit(),l(d.form).show()},d.populateFlatTaxonomies=function(){d.initialData.hasOwnProperty("f_taxonomies")&&(d.createTaxonomyObject(),d.getTermNames(),d.setWPSuggest())},d.createTaxonomyObject=function(){var e={};for(i=0;i<d.initialData.f_taxonomies.length;i++){var t=d.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),n=a.splice(s+1);n=n.join("-");var o=t.split("-").splice(0,s);o.shift("inf");var r=o.join("-");r in e||(e[r]=[]),e[r].push(n)}d.flatTerms=e},d.getTermNames=function(){l.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:d.flatTerms},success:function(e){d.termNames=e.terms,d.populateFlatTaxonomyFields()}})},d.populateFlatTaxonomyFields=function(){d.termNames&&l.each(d.termNames,function(e,t){var a=l("#"+e+"-quickedit");l(a).val(t.join(","))})},d.setWPSuggest=function(){var e=l(d.form).find("[data-autotag]");l.each(e,function(e,t){var a=l(this).attr("data-taxonomy");l(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},d.save=function(){d.toggleLoading(!0),l.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:l(d.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?(d.toggleLoading(!1),l(d.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(d.toggleLoading(!1),d.newData=e.post_data,d.updatePostRow())},error:function(e){console.log(e)}})},d.updatePostRow=function(){d.row=l(d.button).parents(".row-inner"),l(d.row).find(".title").text(d.newData.post_title),l(d.row).find(".np-view-button").attr("href",d.newData.permalink);var e=l(d.row).find(".status");if("publish"!==d.newData._status&&"future"!==d.newData._status?l(e).text("("+d.newData._status+")"):"private"===d.newData.keep_private?l(e).text("("+d.newData.keep_private+")"):l(e).text(""),""!==d.newData.post_password&&void 0!==d.newData.post_password){var t=l(e).text();t+=' <span class="locked">',t+='<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>',t+="</span>",l(e).html(t)}var a=l(d.row).find(".nav-status");"hide"==d.newData.nav_status?l(a).text("(Hidden)"):l(a).text("");var s=l(d.row).parent("li");"hide"==d.newData.np_status?(l(s).addClass("np-hide"),l(d.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>')):(l(s).removeClass("np-hide"),l(d.row).find(".status-np-hidden").remove());var n=l(d.row).find(".sticky");"sticky"==d.newData.sticky?l(n).show():l(n).hide(),NestedPages.jsData.hierarchical||l(d.row).find(".np-author-display").text(d.newData.author_name);var o=l(d.row).find(NestedPages.selectors.quickEditOpen);for(var i in l(o).attr("data-id",d.newData.post_id),l(o).attr("data-template",d.newData.page_template),l(o).attr("data-title",d.newData.post_title),l(o).attr("data-slug",d.newData.post_name),l(o).attr("data-commentstatus",d.newData.comment_status),l(o).attr("data-status",d.newData._status),l(o).attr("data-sticky",d.newData.sticky),"private"===d.newData.keep_private&&l(o).attr("data-status","private"),l(o).attr("data-author",d.newData.post_author),l(o).attr("data-np-status",d.newData.np_status),l(o).attr("data-password",d.newData.post_password),l(o).attr("data-navstatus",d.newData.nav_status),l(o).attr("data-navtitle",d.newData.np_nav_title),l(o).attr("data-linktarget",d.newData.link_target),l(o).attr("data-navtitleattr",d.newData.np_title_attribute),l(o).attr("data-navcss",d.newData.np_nav_css_classes),l(o).attr("data-month",d.newData.mm),l(o).attr("data-day",d.newData.jj),l(o).attr("data-year",d.newData.aa),l(o).attr("data-hour",d.newData.hh),l(o).attr("data-minute",d.newData.mn),l(o).attr("data-datepicker",d.newData.np_date),l(o).attr("data-time",d.newData.np_time),l(o).attr("data-formattedtime",d.newData.np_time),l(o).attr("data-ampm",d.newData.np_ampm),d.newData)if(i.includes("np_custom")&&d.newData.hasOwnProperty(i)){var r=i.replace("np_custom_","data-npcustom-");l(o).attr(r,d.newData[i])}d.removeTaxonomyClasses(),d.addCategoryClasses(),d.addHierarchicalClasses(),d.addFlatClasses(),d.addStatusClass(),d.formatter.removeQuickEdit(),d.formatter.flashRow(d.row)},d.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)l(d.row).removeClass(e[i]);l(d.row).addClass(d.newData._status)},d.removeTaxonomyClasses=function(){taxonomies=[];var e=l(d.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&l(d.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&l(d.row).removeClass(e[i])},d.addCategoryClasses=function(){if(d.newData.hasOwnProperty("post_category")){var e=d.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];l(d.row).addClass(t)}}},d.addHierarchicalClasses=function(){if(d.newData.hasOwnProperty("tax_input")){var e=d.newData.tax_input;l.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];l(d.row).addClass(a)}})}},d.addFlatClasses=function(){if(d.newData.hasOwnProperty("flat_tax")){var e=d.newData.flat_tax;l.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];l(d.row).addClass(a)}})}},d.toggleLoading=function(e){if(e)return l(NestedPages.selectors.quickEditErrorDiv).hide(),l(d.saveButton).attr("disabled","disabled"),void l(NestedPages.selectors.quickEditLoadingIndicator).show();l(d.saveButton).attr("disabled",!1),l(NestedPages.selectors.quickEditLoadingIndicator).hide()},d.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var o=this,i=jQuery;return o.formatter=new NestedPages.Formatter,o.button="",o.postData="",o.newPostData="",o.form="",o.bindEvents=function(){i(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),o.formatter.removeQuickEdit(),o.button=i(this),o.openQuickEdit()}),i(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),o.submitForm()}),i(document).on("keydown",function(e){27===e.keyCode&&o.formatter.removeQuickEdit()})},o.openQuickEdit=function(){o.setData(),o.createForm(),o.populateForm()},o.setData=function(){o.postData={id:i(o.button).attr("data-id"),url:i(o.button).attr("data-url"),title:i(o.button).attr("data-title"),status:i(o.button).attr("data-status"),navstatus:i(o.button).attr("data-navstatus"),npstatus:i(o.button).attr("data-np-status"),linktarget:i(o.button).attr("data-linktarget"),parentid:i(o.button).attr("data-parentid"),navtitleattr:i(o.button).attr("data-navtitleattr"),navcss:i(o.button).attr("data-navcss"),navtype:i(o.button).attr("data-nav-type"),navobject:i(o.button).attr("data-nav-object"),navobjectid:i(o.button).attr("data-nav-object-id"),navoriginallink:i(o.button).attr("data-nav-original-link"),navoriginaltitle:i(o.button).attr("data-nav-original-title")}},o.createForm=function(){var e=i(o.button).closest(NestedPages.selectors.row).parent("li");if(o.form=i(NestedPages.selectors.quickEditLinkForm).clone(),0<i(e).children("ol").length){var t=i(e).children("ol");i(o.form).insertBefore(t)}else i(o.form).appendTo(e);i(o.form).siblings(NestedPages.selectors.row).hide()},o.populateForm=function(){if(i(o.form).find(".np_id").val(o.postData.id),i(o.form).find(".np_title").val(o.postData.title),i(o.form).find(".np_author select").val(o.postData.author),i(o.form).find(".np_status").val(o.postData.status),i(o.form).find(".np_content").val(o.postData.url),i(o.form).find(".np_parent_id").val(o.postData.parentid),i(o.form).find(".np_title_attribute").val(o.postData.navtitleattr),i(o.form).find(".np_nav_css_classes").val(o.postData.navcss),"hide"===o.postData.npstatus?i(o.form).find(".np_status").prop("checked","checked"):i(o.form).find(".np_status").removeAttr("checked"),"hide"===o.postData.navstatus?i(o.form).find(".np_nav_status").prop("checked","checked"):i(o.form).find(".np_nav_status").removeAttr("checked"),"_blank"===o.postData.linktarget?i(o.form).find(".link_target").prop("checked","checked"):i(o.form).find(".link_target").removeAttr("checked"),"custom"!==o.postData.navobject&&""!==o.postData.navobject){var e='<div class="form-control original-link">Original: <a href="'+o.postData.navoriginallink+'" target="_blank">'+o.postData.navoriginaltitle+"</a></div>";i(o.form).find("[data-url-field]").remove(),i(e).insertAfter(i(o.form).find("h3")),i(o.form).find("[data-np-menu-object-input]").val(o.postData.navobject),i(o.form).find("[data-np-menu-objectid-input]").val(o.postData.navobjectid),i(o.form).find("[data-np-menu-type-input]").val(o.postData.navtype),i(o.form).find("h3").text("Link: "+o.postData.navoriginaltitle)}else i(o.form).find("h3").text("Link"),i(o.form).find("[data-np-menu-object-input]").val("custom"),i(o.form).find("[data-np-menu-type-input]").val("custom");o.formatter.showQuickEdit(),i(o.form).show()},o.submitForm=function(){o.toggleLoading(!0),i.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:i(o.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?(o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(o.toggleLoading(!1),o.newPostData=e.post_data,o.updateRow())},error:function(e){o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},o.updateRow=function(){var e=i(o.form).siblings(".row");i(e).find(".title").html(o.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=i(e).find(".status");"publish"!==o.newPostData._status&&"future"!==o.newPostData._status?i(t).text("("+o.newPostData._status+")"):i(t).text("");var a=i(e).find(".nav-status");"hide"==o.newPostData.nav_status?i(a).text("("+NestedPages.jsData.hiddenText+")"):i(a).text("");var s=i(e).parent("li");"hide"==o.newPostData.np_status?(i(s).addClass("np-hide"),i(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>')):(i(s).removeClass("np-hide"),i(e).find(".status-np-hidden").remove());var n=i(e).find(NestedPages.selectors.quickEditButtonLink);i(n).attr("data-id",o.newPostData.post_id),i(n).attr("data-title",o.newPostData.post_title),i(n).attr("data-url",o.newPostData.post_content),i(n).attr("data-status",o.newPostData._status),i(n).attr("data-navstatus",o.newPostData.nav_status),i(n).attr("data-np-status",o.newPostData.np_status),i(n).attr("data-linkTarget",o.newPostData.linkTarget),i(n).attr("data-navtitleattr",o.newPostData.titleAttribute),i(n).attr("data-navcss",o.newPostData.cssClasses),o.formatter.removeQuickEdit(),o.formatter.flashRow(e)},o.toggleLoading=function(e){if(i(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return i(NestedPages.selectors.quickEditErrorDiv).hide(),i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void i(NestedPages.selectors.quickEditLoadingIndicator).show();i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),i(NestedPages.selectors.quickEditLoadingIndicator).hide()},o.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 t=this,a=jQuery;return t.activeContent="",t.activeButton="",t.init=function(){t.bindEvents()},t.bindEvents=function(){a(document).on("click",NestedPages.selectors.tabButton,function(e){e.preventDefault(),t.activeButton=a(this),t.toggleTabs()})},t.toggleTabs=function(){t.activeContent=a(t.activeButton).attr("href"),a(NestedPages.selectors.tabContent).hide(),a(t.activeContent).show(),a(t.activeButton).parents(NestedPages.selectors.tabButtonParent).find(NestedPages.selectors.tabButton).removeClass("active"),a(t.activeButton).addClass("active")},t.init()},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]",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",quickEditToggleTaxonomies:".np-toggle-taxonomies",quickEditToggleMenuOptions:".np-toggle-menuoptions",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"},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.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]"},a.search=new NestedPages.MenuSearch,a.init=function(){a.bindEvents()},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").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 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.init()},(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 NestedPages,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(){if(s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val())return n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults();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 a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.nesting=new NestedPages.Nesting,a.activeRow,a.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},a.bindEvents=function(){s(document).ready(function(){a.disableTopOnFirst(),a.disableBottomOnLast()}),s(document).on("click","["+a.selectors.moveToTop+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToTop())}),s(document).on("click","["+a.selectors.moveToBottom+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToBottom())})},a.moveToTop=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).find(NestedPages.selectors.rows).first();s(a.activeRow).insertBefore(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.moveToBottom=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).children(NestedPages.selectors.rows).last();s(a.activeRow).insertAfter(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.disableTopOnFirst=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToTop+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).first();s(e).find("["+a.selectors.moveToTop+"]").addClass("disabled")})},a.disableBottomOnLast=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToBottom+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).last();s(e).find("["+a.selectors.moveToBottom+"]").addClass("disabled")})},a.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var a=this,o=jQuery;return a.button=null,a.postData=null,a.modal=null,a.parent_li=null,a.formatter=new NestedPages.Formatter,a.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},a.bindEvents=function(){nestedpages.wpml&&o(document).on("click","["+a.selectors.translationsBtn+"]",function(e){e.preventDefault(),a.createTranslationsModal(o(this))})},a.createTranslationsModal=function(e){if(a.parent_li=o(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),a.button=o(a.parent_li).find(NestedPages.selectors.quickEditOpen),a.postData={id:o(a.button).attr("data-id"),title:o(a.button).attr("data-title"),slug:o(a.button).attr("data-slug")},a.modal=o("["+a.selectors.modal+"]").clone(),0<o(a.parent_li).children("ol").length){var t=o(a.parent_li).children("ol");o(a.modal).insertBefore(t)}else o(a.modal).appendTo(a.parent_li);o(a.modal).find("["+a.selectors.title+"]").text(a.postData.title),a.formatter.showQuickEdit(),o(a.modal).show(),a.getTranslationData()},a.getTranslationData=function(){o.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:a.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(a.postData.id),"success"===e.status?a.populateModal(e.translations):(o(a.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),a.toggleLoading(!1))}})},a.populateModal=function(s){var n="<tbody>";o.each(s,function(e,t){var a=s[e];n+="<tr>",n+='<td><img src="'+a.country_flag_url+'" alt="'+a.translated_name+'" /> '+a.translated_name+"</td>",n+="<td>",a.has_translation&&a.edit_link?n+='<a href="'+a.edit_link+'">'+a.translation.post_title+" ("+nestedpages.edit+")</a>":n+='<a href="'+a.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",n+="</td>",n+="</tr>"}),n+="</tbody>",o(a.modal).find("["+a.selectors.table+"]").html(n),a.toggleLoading(!1)},a.toggleLoading=function(e){e?o(a.modal).addClass("loading"):o(a.modal).removeClass("loading")},a.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"},t.bindEvents=function(){s(document).on("click","["+t.selectors.resetButton+"]",function(e){e.preventDefault(),t.resetSettings()})},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.loading=function(e){e?s("["+t.selectors.resetButton+"]").attr("disabled",!0):s("["+t.selectors.resetButton+"]").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){var t=a(e).find("[data-np-menu-order]");a.each(t,function(e,t){a(this).val(e)}),o.enableSortableAdminSorting()},o.bindEvents()},new NestedPages.AdminCustomizationSettings,(NestedPages=NestedPages||{}).Settings=function(){var a=this,i=jQuery;return a.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]"},a.bindEvents=function(){i(document).ready(function(){a.toggleAllSettingsButtons(),a.toogleAllFieldSettings(".custom-fields"),a.toogleAllFieldSettings(".standard-fields"),a.toggleMenuCheckboxes(),a.toggleHideCheckbox(),a.toggleAssignPostType(),a.toggleAllDefaultSortOptions()}),i(document).on("click",a.selectors.postTypeToggle,function(e){e.preventDefault(),a.toggleRow(i(this))}),i(document).on("change",a.selectors.postTypeCheckbox,function(){a.toggleSettingsButton(i(this))}),i(document).on("change",a.selectors.customFieldsCheckbox,function(){a.toogleFieldSettings(i(this),".custom-fields")}),i(document).on("change",a.selectors.standardFieldsCheckbox,function(){a.toogleFieldSettings(i(this),".standard-fields")}),i(document).on("change",a.selectors.taxonomiesFieldCheckbox,function(){a.toggleTaxonomyCheckboxes(i(this))}),i(document).on("change",a.selectors.thumbnailsCheckbox,function(){a.toggleThumbnailSettings(i(this))}),i(document).on("change",a.selectors.disableMenuCheckbox,function(){a.toggleMenuCheckboxes()}),i(document).on("change",a.selectors.disableAutoCheckbox,function(){a.toggleHideCheckbox()}),i(document).on("change",a.selectors.assignPostTypeCheckbox,function(){a.toggleAssignPostType()}),i(document).on("click",a.selectors.assignPostTypeOption,function(e){e.preventDefault(),a.chooseAssignPostType(i(this))}),i(document).on("click",a.selectors.assignPostTypeRemove,function(e){e.preventDefault(),a.removeAssignPostType(i(this))}),i(document).on("change",a.selectors.sortOptionCheckbox,function(){a.toggleDefaultSortOptions(i(this))})},a.toggleRow=function(e){i(e).parent(".head").siblings(".body").toggle(),i(e).parents(".row-container").toggleClass("active")},a.toggleSettingsButton=function(e){var t=i(e).parents(".head").find(a.selectors.postTypeToggle);if(i(e).is(":checked"))return i(t).show(),void i(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!1);i(t).hide(),i(t).parents(".head").siblings(".body").hide(),i(t).parents(".row-container").removeClass("active"),i(t).parents(".head").siblings(".body").find('input[type="checkbox"]').attr("checked",!1),i(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!0),i(t).parents(".head").siblings(".body").find("select").val(!1)},a.toggleAllSettingsButtons=function(){var e=i(a.selectors.postTypeCheckbox);i.each(e,function(){a.toggleSettingsButton(i(this))})},a.toogleFieldSettings=function(e,t){var s=i(e).parents(".body").find(t);i(e).is(":checked")?i(s).show():i(s).hide()},a.toogleAllFieldSettings=function(e){var t=i(a.selectors.customFieldsCheckbox);if(".standard-fields"==e)t=i(a.selectors.standardFieldsCheckbox);i.each(t,function(){a.toogleFieldSettings(i(this),e)})},a.toggleTaxonomyCheckboxes=function(e){var t=i(e).parents("ul").find(i("*[data-taxonomy-single]"));i(e).is(":checked")?i(t).hide():i(t).show()},a.toggleThumbnailSettings=function(e){var t=i(e).parents(".field").find(i("*[data-thumbnail-options]"));i(e).is(":checked")?i(t).show():i(t).hide()},a.toggleMenuCheckboxes=function(){var e=i(a.selectors.disableMenuCheckbox),t=i(a.selectors.menuEnabledOption);i(e).is(":checked")?i(t).hide():i(t).show()},a.toggleHideCheckbox=function(){var e=i(a.selectors.disableAutoCheckbox),t=i("[data-menu-hide-checkbox]");i(e).is(":checked")?i(t).hide():i(t).show()},a.toggleAssignPostType=function(){var e=i(a.selectors.assignPostTypeCheckbox);i.each(e,function(){var e=i(this),t=i(this).parents(".field").find(".nestedpages-assignment-display");i(e).is(":checked")?i(t).show():i(t).hide()})},a.chooseAssignPostType=function(e){var t=i(e).attr("data-assignment-page-id"),s=i(e).attr("data-assignment-page-title"),n=i(e).parents(".field"),o=nestedpages.currently_assigned_to+" "+s+' <a href="#" data-nestedpages-page-pt-assignment-remove>('+nestedpages.remove+")</a>";i(n).find(a.selectors.assignPostTypeId).val(t),i(n).find(a.selectors.assignPostTypeTitle).val(s),i(n).find(a.selectors.assignPostTypeSelection).html(o).show(),i(n).find("[data-nestedpages-post-search-form]").hide()},a.removeAssignPostType=function(e){var t=i(e).parents(".field");i(t).find(a.selectors.assignPostTypeSelection).hide(),i(t).find("[data-nestedpages-post-search-form]").show(),i(t).find(a.selectors.assignPostTypeId).val(""),i(t).find(a.selectors.assignPostTypeTitle).val("")},a.toggleAllDefaultSortOptions=function(){var e=i(a.selectors.sortOptionCheckbox);i.each(e,function(){a.toggleDefaultSortOptions(i(this))})},a.toggleDefaultSortOptions=function(e){var t=!!i(e).is(":checked"),s=i(e).parent("label").next(a.selectors.defaultSortOptions);i(s).length<1||(t?i(s).show():i(s).hide())},a.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){var t=a(e).find("[data-np-menu-order]");a.each(t,function(e,t){a(this).val(e)}),o.enableSortableAdminSorting()},o.bindEvents()},new NestedPages.AdminCustomizationSettings,(NestedPages=NestedPages||{}).Settings=function(){var a=this,i=jQuery;return a.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]"},a.bindEvents=function(){i(document).ready(function(){a.toggleAllSettingsButtons(),a.toogleAllFieldSettings(".custom-fields"),a.toogleAllFieldSettings(".standard-fields"),a.toggleMenuCheckboxes(),a.toggleHideCheckbox(),a.toggleAssignPostType(),a.toggleAllDefaultSortOptions()}),i(document).on("click",a.selectors.postTypeToggle,function(e){e.preventDefault(),a.toggleRow(i(this))}),i(document).on("change",a.selectors.postTypeCheckbox,function(){a.toggleSettingsButton(i(this))}),i(document).on("change",a.selectors.customFieldsCheckbox,function(){a.toogleFieldSettings(i(this),".custom-fields")}),i(document).on("change",a.selectors.standardFieldsCheckbox,function(){a.toogleFieldSettings(i(this),".standard-fields")}),i(document).on("change",a.selectors.taxonomiesFieldCheckbox,function(){a.toggleTaxonomyCheckboxes(i(this))}),i(document).on("change",a.selectors.thumbnailsCheckbox,function(){a.toggleThumbnailSettings(i(this))}),i(document).on("change",a.selectors.disableMenuCheckbox,function(){a.toggleMenuCheckboxes()}),i(document).on("change",a.selectors.disableAutoCheckbox,function(){a.toggleHideCheckbox()}),i(document).on("change",a.selectors.assignPostTypeCheckbox,function(){a.toggleAssignPostType()}),i(document).on("click",a.selectors.assignPostTypeOption,function(e){e.preventDefault(),a.chooseAssignPostType(i(this))}),i(document).on("click",a.selectors.assignPostTypeRemove,function(e){e.preventDefault(),a.removeAssignPostType(i(this))}),i(document).on("change",a.selectors.sortOptionCheckbox,function(){a.toggleDefaultSortOptions(i(this))})},a.toggleRow=function(e){i(e).parent(".head").siblings(".body").toggle(),i(e).parents(".row-container").toggleClass("active")},a.toggleSettingsButton=function(e){var t=i(e).parents(".head").find(a.selectors.postTypeToggle);if(i(e).is(":checked"))return i(t).show(),void i(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!1);i(t).hide(),i(t).parents(".head").siblings(".body").hide(),i(t).parents(".row-container").removeClass("active"),i(t).parents(".head").siblings(".body").find('input[type="checkbox"]').attr("checked",!1),i(t).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!0),i(t).parents(".head").siblings(".body").find("select").val(!1)},a.toggleAllSettingsButtons=function(){var e=i(a.selectors.postTypeCheckbox);i.each(e,function(){a.toggleSettingsButton(i(this))})},a.toogleFieldSettings=function(e,t){var s=i(e).parents(".body").find(t);i(e).is(":checked")?i(s).show():i(s).hide()},a.toogleAllFieldSettings=function(e){var t=i(a.selectors.customFieldsCheckbox);if(".standard-fields"==e)t=i(a.selectors.standardFieldsCheckbox);i.each(t,function(){a.toogleFieldSettings(i(this),e)})},a.toggleTaxonomyCheckboxes=function(e){var t=i(e).parents("ul").find(i("*[data-taxonomy-single]"));i(e).is(":checked")?i(t).hide():i(t).show()},a.toggleThumbnailSettings=function(e){var t=i(e).parents(".field").find(i("*[data-thumbnail-options]"));i(e).is(":checked")?i(t).show():i(t).hide()},a.toggleMenuCheckboxes=function(){var e=i(a.selectors.disableMenuCheckbox),t=i(a.selectors.menuEnabledOption);i(e).is(":checked")?i(t).hide():i(t).show()},a.toggleHideCheckbox=function(){var e=i(a.selectors.disableAutoCheckbox),t=i("[data-menu-hide-checkbox]");i(e).is(":checked")?i(t).hide():i(t).show()},a.toggleAssignPostType=function(){var e=i(a.selectors.assignPostTypeCheckbox);i.each(e,function(){var e=i(this),t=i(this).parents(".field").find(".nestedpages-assignment-display");i(e).is(":checked")?i(t).show():i(t).hide()})},a.chooseAssignPostType=function(e){var t=i(e).attr("data-assignment-page-id"),s=i(e).attr("data-assignment-page-title"),n=i(e).parents(".field"),o=nestedpages.currently_assigned_to+" "+s+' <a href="#" data-nestedpages-page-pt-assignment-remove>('+nestedpages.remove+")</a>";i(n).find(a.selectors.assignPostTypeId).val(t),i(n).find(a.selectors.assignPostTypeTitle).val(s),i(n).find(a.selectors.assignPostTypeSelection).html(o).show(),i(n).find("[data-nestedpages-post-search-form]").hide()},a.removeAssignPostType=function(e){var t=i(e).parents(".field");i(t).find(a.selectors.assignPostTypeSelection).hide(),i(t).find("[data-nestedpages-post-search-form]").show(),i(t).find(a.selectors.assignPostTypeId).val(""),i(t).find(a.selectors.assignPostTypeTitle).val("")},a.toggleAllDefaultSortOptions=function(){var e=i(a.selectors.sortOptionCheckbox);i.each(e,function(){a.toggleDefaultSortOptions(i(this))})},a.toggleDefaultSortOptions=function(e){var t=!!i(e).is(":checked"),s=i(e).parent("label").next(a.selectors.defaultSortOptions);i(s).length<1||(t?i(s).show():i(s).hide())},a.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.1.0
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.1.1
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: 5.2
7
  Requires PHP: 5.4
8
- Stable tag: 3.0.11
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.1.0 =
109
  * Adds new feature for customizing the order, visibility, and labels of the admin menu. To view the feature, visit Settings > Nested Pages > Admin Customization > Admin Menu. Important: once custom menus have been configured, new menu items added by other plugins may not appear upon activation. To add these items, revisit the Nested Pages settings and reconfigure the menus with the new items (they will appear at the bottom of the customized menu in the drag and drop interface). While menus may be configured for each user group, the plugin does not set any permissions. While items may be hidden from the menu, they will still be accessible with a direct link if the user has the appropriate permissions.
110
  * Adds filters for adding basic custom fields to the quick edit interface. Currently supported field types include text, date, and select. See https://gist.github.com/kylephillips/236d0a90aa2ea6fb628c5c1e4010f7be for example usage.
5
  Requires at least: 3.8
6
  Tested up to: 5.2
7
  Requires PHP: 5.4
8
+ Stable tag: 3.1.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
105
 
106
  == Changelog ==
107
 
108
+ = 3.1.1 =
109
+ * Removes ability to hide Settings and Nested Pages menus from administrators within the admin customization interface (removing items hides links to necessary admin sections).
110
+ * Adds ability to reset admin menu settings by clicking a single button
111
+ * Fixes bug in new admin menu feature where submenus added by other plugins were not being displayed if a custom menu was in use.
112
+
113
  = 3.1.0 =
114
  * Adds new feature for customizing the order, visibility, and labels of the admin menu. To view the feature, visit Settings > Nested Pages > Admin Customization > Admin Menu. Important: once custom menus have been configured, new menu items added by other plugins may not appear upon activation. To add these items, revisit the Nested Pages settings and reconfigure the menus with the new items (they will appear at the bottom of the customized menu in the drag and drop interface). While menus may be configured for each user group, the plugin does not set any permissions. While items may be hidden from the menu, they will still be accessible with a direct link if the user has the appropriate permissions.
115
  * Adds filters for adding basic custom fields to the quick edit interface. Currently supported field types include text, date, and select. See https://gist.github.com/kylephillips/236d0a90aa2ea6fb628c5c1e4010f7be for example usage.